@microsoft/omnichannel-chat-widget 0.1.0-main.50fdaaa → 0.1.0-main.52fa2fc

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 (51) hide show
  1. package/lib/cjs/common/Constants.js +8 -1
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +22 -4
  3. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +11 -18
  4. package/lib/cjs/components/headerstateful/HeaderStateful.js +4 -3
  5. package/lib/cjs/components/livechatwidget/common/agentEndConversationHelper.js +36 -0
  6. package/lib/cjs/components/livechatwidget/common/endChat.js +38 -64
  7. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +10 -61
  8. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +6 -2
  9. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +255 -2
  10. package/lib/cjs/components/livechatwidget/common/startChat.js +14 -6
  11. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +65 -25
  12. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -1
  13. package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +2 -0
  14. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +1 -0
  15. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +75 -11
  16. package/lib/cjs/contexts/common/ConversationEndEntity.js +12 -0
  17. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +11 -7
  18. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +6 -2
  19. package/lib/cjs/contexts/createReducer.js +36 -2
  20. package/lib/esm/common/Constants.js +6 -0
  21. package/lib/esm/common/telemetry/TelemetryConstants.js +22 -4
  22. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +11 -18
  23. package/lib/esm/components/headerstateful/HeaderStateful.js +4 -3
  24. package/lib/esm/components/livechatwidget/common/agentEndConversationHelper.js +30 -0
  25. package/lib/esm/components/livechatwidget/common/endChat.js +40 -66
  26. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +12 -63
  27. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +6 -2
  28. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +255 -3
  29. package/lib/esm/components/livechatwidget/common/startChat.js +14 -6
  30. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +65 -25
  31. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -1
  32. package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +2 -0
  33. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +2 -0
  34. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +75 -11
  35. package/lib/esm/contexts/common/ConversationEndEntity.js +5 -0
  36. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +11 -7
  37. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +6 -2
  38. package/lib/esm/contexts/createReducer.js +36 -2
  39. package/lib/types/common/Constants.d.ts +7 -0
  40. package/lib/types/common/telemetry/TelemetryConstants.d.ts +18 -6
  41. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +0 -7
  42. package/lib/types/components/livechatwidget/common/agentEndConversationHelper.d.ts +6 -0
  43. package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +1 -1
  44. package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +1 -1
  45. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +6 -1
  46. package/lib/types/components/livechatwidget/common/startChat.d.ts +1 -1
  47. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.d.ts +1 -1
  48. package/lib/types/contexts/common/ConversationEndEntity.d.ts +4 -0
  49. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +6 -1
  50. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +11 -7
  51. package/package.json +1 -1
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.Regex = exports.MimeTypes = exports.LocaleConstants = exports.LiveWorkItemState = exports.HtmlIdNames = exports.HtmlElementSelectors = exports.HtmlClassNames = exports.HtmlAttributeNames = exports.EnvironmentVersion = exports.ElementType = exports.E2VVOptions = exports.Constants = exports.ChatSDKError = exports.AriaTelemetryConstants = void 0;
6
+ exports.WebChatMiddlewareConstants = exports.TranscriptConstants = exports.Regex = exports.MimeTypes = exports.LocaleConstants = exports.LiveWorkItemState = exports.HtmlIdNames = exports.HtmlElementSelectors = exports.HtmlClassNames = exports.HtmlAttributeNames = exports.EnvironmentVersion = exports.ElementType = exports.E2VVOptions = exports.Constants = exports.ChatSDKError = exports.AriaTelemetryConstants = exports.AMSConstants = void 0;
7
7
  var _class;
8
8
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
9
9
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
@@ -28,6 +28,8 @@ _defineProperty(Constants, "truePascal", "True");
28
28
  _defineProperty(Constants, "true", "true");
29
29
  _defineProperty(Constants, "false", "false");
30
30
  _defineProperty(Constants, "maximumUnreadMessageCount", 99);
31
+ _defineProperty(Constants, "userParticipantTypeTag", "User");
32
+ _defineProperty(Constants, "botParticipantTypeTag", "Bot");
31
33
  _defineProperty(Constants, "channelIdKey", "ChannelId-");
32
34
  _defineProperty(Constants, "ChannelId", "lcw");
33
35
  _defineProperty(Constants, "CustomerTag", "FromCustomer");
@@ -142,6 +144,11 @@ _defineProperty(WebChatMiddlewareConstants, "nextVisibleActivity", "nextVisibleA
142
144
  _defineProperty(WebChatMiddlewareConstants, "timeBetweenTimestampGroups", 300000);
143
145
  _defineProperty(WebChatMiddlewareConstants, "maxTextLength", 6000);
144
146
  _defineProperty(WebChatMiddlewareConstants, "adaptiveCard", "AdaptiveCard");
147
+ class AMSConstants {}
148
+ exports.AMSConstants = AMSConstants;
149
+ _defineProperty(AMSConstants, "supportedImagesMimeTypes", ["image/jpeg", "image/png", "image/gif", "image/heic", "image/webp"]);
150
+ _defineProperty(AMSConstants, "maxSupportedImageSize", 20);
151
+ _defineProperty(AMSConstants, "maxSupportedFileSize", 300);
145
152
  class MimeTypes {}
146
153
  exports.MimeTypes = MimeTypes;
147
154
  _defineProperty(MimeTypes, "UnknownFileType", "application/octet-stream");
@@ -59,6 +59,7 @@ exports.BroadcastEvent = BroadcastEvent;
59
59
  BroadcastEvent["SigninCardReceived"] = "SignInCardReceived";
60
60
  BroadcastEvent["BotAuthConfigRequest"] = "BotAuthConfigRequest";
61
61
  BroadcastEvent["BotAuthConfigResponse"] = "BotAuthConfigResponse";
62
+ BroadcastEvent["HideChatVisibilityChangeEvent"] = "hideChatVisibilityChangeEvent";
62
63
  })(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
63
64
  let TelemetryEvent;
64
65
  exports.TelemetryEvent = TelemetryEvent;
@@ -95,11 +96,10 @@ exports.TelemetryEvent = TelemetryEvent;
95
96
  TelemetryEvent["GetConversationDetailsCallFailed"] = "GetConversationDetailsCallFailed";
96
97
  TelemetryEvent["EndChatSDKCallFailed"] = "EndChatSDKCallFailed";
97
98
  TelemetryEvent["GetChatReconnectContextSDKCallFailed"] = "GetChatReconnectContextSDKCallFailed";
98
- TelemetryEvent["PostChatContextCallSucceed"] = "PostChatContextCallSucceed";
99
- TelemetryEvent["PostChatContextCallFailed"] = "PostChatContextCallFailed";
100
99
  TelemetryEvent["ParseAdaptiveCardFailed"] = "ParseAdaptiveCardFailed";
101
100
  TelemetryEvent["ClientDataStoreProviderFailed"] = "ClientDataStoreProviderFailed";
102
101
  TelemetryEvent["InMemoryDataStoreFailed"] = "InMemoryDataStoreFailed";
102
+ TelemetryEvent["ChatVisibilityChanged"] = "ChatVisibilityChanged";
103
103
  TelemetryEvent["WebChatLoaded"] = "WebChatLoaded";
104
104
  TelemetryEvent["LCWChatButtonClicked"] = "LCWChatButtonClicked";
105
105
  TelemetryEvent["LCWChatButtonShow"] = "LCWChatButtonShow";
@@ -107,6 +107,7 @@ exports.TelemetryEvent = TelemetryEvent;
107
107
  TelemetryEvent["WidgetLoadComplete"] = "WidgetLoadComplete";
108
108
  TelemetryEvent["WidgetLoadFailed"] = "WidgetLoadFailed";
109
109
  TelemetryEvent["StartChatMethodException"] = "StartChatMethodException";
110
+ TelemetryEvent["CloseChatCall"] = "CloseChatCall";
110
111
  TelemetryEvent["CloseChatMethodException"] = "CloseChatMethodException";
111
112
  TelemetryEvent["PrechatSurveyLoaded"] = "PrechatSurveyLoaded";
112
113
  TelemetryEvent["PrechatSubmitted"] = "PrechatSubmitted";
@@ -129,8 +130,6 @@ exports.TelemetryEvent = TelemetryEvent;
129
130
  TelemetryEvent["LoadingPaneLoaded"] = "LoadingPaneLoaded";
130
131
  TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
131
132
  TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
132
- TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
133
- TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
134
133
  TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
135
134
  TelemetryEvent["ProactiveChatPaneLoaded"] = "ProactiveChatPaneLoaded";
136
135
  TelemetryEvent["ReconnectChatPaneLoaded"] = "ReconnectChatPaneLoaded";
@@ -143,6 +142,7 @@ exports.TelemetryEvent = TelemetryEvent;
143
142
  TelemetryEvent["SuppressBotMagicCodeSucceeded"] = "SuppressBotMagicCodeSucceeded";
144
143
  TelemetryEvent["SuppressBotMagicCodeFailed"] = "SuppressBotMagicCodeFailed";
145
144
  TelemetryEvent["GetConversationDetailsException"] = "GetConversationDetailsException";
145
+ TelemetryEvent["AppStatesException"] = "AppStatesException";
146
146
  TelemetryEvent["BrowserUnloadEventStarted"] = "BrowserUnloadEventStarted";
147
147
  TelemetryEvent["GetAuthTokenCalled"] = "GetAuthTokenCalled";
148
148
  TelemetryEvent["GetAuthTokenFailed"] = "GetAuthTokenFailed";
@@ -158,12 +158,15 @@ exports.TelemetryEvent = TelemetryEvent;
158
158
  TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
159
159
  TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
160
160
  TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
161
+ TelemetryEvent["AttachmentUploadValidatorMiddlewareFailed"] = "AttachmentUploadValidatorMiddlewareFailed";
161
162
  TelemetryEvent["QueuePositionMessageRecieved"] = "QueuePositionMessageRecieved";
162
163
  TelemetryEvent["AverageWaitTimeMessageRecieved"] = "AverageWaitTimeMessageRecieved";
163
164
  TelemetryEvent["DataMaskingRuleApplied"] = "DataMaskingRuleApplied";
164
165
  TelemetryEvent["DataMaskingRuleApplyFailed"] = "DataMaskingRuleApplyFailed";
165
166
  TelemetryEvent["IC3ClientEvent"] = "IC3ClientEvent";
166
167
  TelemetryEvent["ConversationEndedThreadEventReceived"] = "ConversationEndedThreadEventReceived";
168
+ TelemetryEvent["ConversationEndedByCustomer"] = "ConversationEndedByCustomer";
169
+ TelemetryEvent["ConversationEndedByAgent"] = "ConversationEndedByAgent";
167
170
  TelemetryEvent["InvalidConfiguration"] = "InvalidConfiguration";
168
171
  TelemetryEvent["SendTypingIndicatorSucceeded"] = "SendTypingIndicatorSucceeded";
169
172
  TelemetryEvent["SendTypingIndicatorFailed"] = "SendTypingIndicatorFailed";
@@ -186,6 +189,15 @@ exports.TelemetryEvent = TelemetryEvent;
186
189
  TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
187
190
  TelemetryEvent["NetworkDisconnected"] = "NetworkDisconnected";
188
191
  TelemetryEvent["NetworkReconnected"] = "NetworkReconnected";
192
+ TelemetryEvent["LinkModePostChatWorkflowStarted"] = "LinkModePostChatWorkflowStarted";
193
+ TelemetryEvent["EmbedModePostChatWorkflowStarted"] = "EmbedModePostChatWorkflowStarted";
194
+ TelemetryEvent["PostChatWorkflowFromCustomer"] = "PostChatWorkflowFromCustomer";
195
+ TelemetryEvent["PostChatWorkflowFromAgent"] = "PostChatWorkflowFromAgent";
196
+ TelemetryEvent["PostChatWorkflowFromBot"] = "PostChatWorkflowFromBot";
197
+ TelemetryEvent["PostChatContextCallSucceed"] = "PostChatContextCallSucceed";
198
+ TelemetryEvent["PostChatContextCallFailed"] = "PostChatContextCallFailed";
199
+ TelemetryEvent["PostChatSurveyLoadingPaneLoaded"] = "PostChatSurveyLoadingPaneLoaded";
200
+ TelemetryEvent["PostChatSurveyLoaded"] = "PostChatSurveyLoaded";
189
201
  })(TelemetryEvent || (exports.TelemetryEvent = TelemetryEvent = {}));
190
202
  class TelemetryConstants {
191
203
  static map(eventTypeOrScenarioType) {
@@ -240,6 +252,12 @@ class TelemetryConstants {
240
252
  case TelemetryEvent.CustomerVoiceResponsePageLoaded:
241
253
  case TelemetryEvent.CustomerVoiceFormResponseSubmitted:
242
254
  case TelemetryEvent.CustomerVoiceFormResponseError:
255
+ case TelemetryEvent.LinkModePostChatWorkflowStarted:
256
+ case TelemetryEvent.EmbedModePostChatWorkflowStarted:
257
+ case TelemetryEvent.PostChatWorkflowFromCustomer:
258
+ case TelemetryEvent.PostChatWorkflowFromAgent:
259
+ case TelemetryEvent.PostChatWorkflowFromBot:
260
+ case TelemetryEvent.AppStatesException:
243
261
  return ScenarioType.ACTIONS;
244
262
  case TelemetryEvent.StartChatSDKCall:
245
263
  case TelemetryEvent.StartChatEventRecevied:
@@ -10,11 +10,10 @@ var _react = _interopRequireWildcard(require("react"));
10
10
  var _utils = require("../../common/utils");
11
11
  var _DimLayer = require("../dimlayer/DimLayer");
12
12
  var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
13
- var _NotificationHandler = require("../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler");
14
- var _NotificationScenarios = require("../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
15
13
  var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
16
14
  var _useChatAdapterStore = _interopRequireDefault(require("../../hooks/useChatAdapterStore"));
17
15
  var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
16
+ var _ConversationEndEntity = require("../../contexts/common/ConversationEndEntity");
18
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
19
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -23,10 +22,7 @@ const ConfirmationPaneStateful = props => {
23
22
  const initialTabIndexMap = new Map();
24
23
  let elements = [];
25
24
  const [state, dispatch] = (0, _useChatContextStore.default)();
26
- const {
27
- prepareEndChat
28
- } = props;
29
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
25
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
30
26
  const [adapter] = (0, _useChatAdapterStore.default)();
31
27
  const controlProps = {
32
28
  id: "oc-lcw-confirmation-pane",
@@ -40,18 +36,15 @@ const ConfirmationPaneStateful = props => {
40
36
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
41
37
  payload: false
42
38
  });
43
- try {
44
- (0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
45
- await prepareEndChat(adapter, state);
46
- } catch (ex) {
47
- _TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.ERROR, {
48
- Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsCallFailed,
49
- ExceptionDetails: {
50
- exception: `Get Conversation Details Call Failed : ${ex}`
51
- }
52
- });
53
- _NotificationHandler.NotificationHandler.notifyError(_NotificationScenarios.NotificationScenarios.Connection, "Get Conversation Details Call Failed: " + ex);
54
- }
39
+ (0, _utils.setTabIndices)(elements, initialTabIndexMap, true);
40
+ dispatch({
41
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
42
+ payload: _ConversationEndEntity.ConversationEndEntity.Customer
43
+ });
44
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
45
+ Event: _TelemetryConstants.TelemetryEvent.ConversationEndedByCustomer,
46
+ Description: "Conversation is ended by customer."
47
+ });
55
48
  },
56
49
  onCancel: () => {
57
50
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
@@ -13,6 +13,7 @@ var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
13
13
  var _defaultOutOfOfficeHeaderStyleProps = require("./common/styleProps/defaultOutOfOfficeHeaderStyleProps");
14
14
  var _useChatAdapterStore = _interopRequireDefault(require("../../hooks/useChatAdapterStore"));
15
15
  var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
16
+ var _ConversationEndEntity = require("../../contexts/common/ConversationEndEntity");
16
17
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17
18
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
18
19
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
@@ -30,7 +31,7 @@ const HeaderStateful = props => {
30
31
  const [outOfOperatingHours, setOutOfOperatingHours] = (0, _react.useState)(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
31
32
  const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeHeaderStyleProps.defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
32
33
  const conversationState = (0, _react.useRef)(state.appStates.conversationState);
33
- const conversationEndedByAgent = (0, _react.useRef)(state.appStates.conversationEndedByAgent);
34
+ const conversationEndedBy = (0, _react.useRef)(state.appStates.conversationEndedBy);
34
35
  const controlProps = {
35
36
  id: "oc-lcw-header",
36
37
  dir: state.domainStates.globalDir,
@@ -50,7 +51,7 @@ const HeaderStateful = props => {
50
51
  Event: _TelemetryConstants.TelemetryEvent.HeaderCloseButtonClicked,
51
52
  Description: "Header Close button clicked."
52
53
  });
53
- if (conversationState.current === _ConversationState.ConversationState.Active || conversationEndedByAgent.current) {
54
+ if (conversationState.current === _ConversationState.ConversationState.Active || conversationEndedBy.current === _ConversationEndEntity.ConversationEndEntity.Agent) {
54
55
  dispatch({
55
56
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
56
57
  payload: true
@@ -96,7 +97,7 @@ const HeaderStateful = props => {
96
97
  if (state.appStates.conversationState) {
97
98
  conversationState.current = state.appStates.conversationState;
98
99
  }
99
- conversationEndedByAgent.current = state.appStates.conversationEndedByAgent;
100
+ conversationEndedBy.current = state.appStates.conversationEndedBy;
100
101
  }, [state.appStates]);
101
102
  return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.Header, {
102
103
  componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.handleAgentEndConversation = void 0;
7
+ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
8
+ var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
9
+ var _ConversationEndEntity = require("../../../contexts/common/ConversationEndEntity");
10
+ var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
11
+ var _setPostChatContextAndLoadSurvey = require("./setPostChatContextAndLoadSurvey");
12
+ const handleAgentEndConversation = (props, state, dispatch) => {
13
+ const isPostChatEnabled = (0, _setPostChatContextAndLoadSurvey.checkPostChatEnabled)(props, state);
14
+ if (isPostChatEnabled) {
15
+ if (!state.appStates.postChatWorkflowInProgress) {
16
+ dispatch({
17
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
18
+ payload: _ConversationEndEntity.ConversationEndEntity.Agent
19
+ });
20
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
21
+ Event: _TelemetryConstants.TelemetryEvent.ConversationEndedByAgent,
22
+ Description: "Conversation is ended from agent side"
23
+ });
24
+ }
25
+ } else {
26
+ dispatch({
27
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
28
+ payload: _ConversationEndEntity.ConversationEndEntity.Agent
29
+ });
30
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
31
+ Event: _TelemetryConstants.TelemetryEvent.ConversationEndedByAgent,
32
+ Description: "Conversation is ended from agent side"
33
+ });
34
+ }
35
+ };
36
+ exports.handleAgentEndConversation = handleAgentEndConversation;
@@ -11,16 +11,12 @@ var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidget
11
11
  var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
12
12
  var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader");
13
13
  var _defaultWebChatContainerStatefulProps = require("../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps");
14
- var _PostChatSurveyMode = require("../../postchatsurveypanestateful/enums/PostChatSurveyMode");
15
- var _Constants = require("../../../common/Constants");
16
14
  var _utils = require("../../../common/utils");
17
15
  var _authHelper = require("./authHelper");
16
+ var _setPostChatContextAndLoadSurvey = require("./setPostChatContextAndLoadSurvey");
17
+ var _ConversationEndEntity = require("../../../contexts/common/ConversationEndEntity");
18
18
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
19
  const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state) => {
20
- var _props$chatConfig, _props$chatConfig$Liv, _state$domainStates$l, _state$domainStates$l2, _props$chatConfig2, _props$chatConfig2$Li, _state$domainStates$l3, _state$domainStates$l4, _conversationDetails;
21
- const isPostChatEnabled = ((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : _props$chatConfig$Liv.msdyn_postconversationsurveyenable) ?? ((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveyenable);
22
- const postChatSurveyMode = ((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Li = _props$chatConfig2.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig2$Li === void 0 ? void 0 : _props$chatConfig2$Li.msdyn_postconversationsurveymode) ?? ((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode);
23
-
24
20
  //Unable to end chat if token has expired
25
21
  if (props.getAuthToken) {
26
22
  const authClientFunction = (0, _authHelper.getAuthClientFunction)(props.chatConfig);
@@ -37,65 +33,28 @@ const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, disp
37
33
  }
38
34
  }
39
35
  }
40
-
41
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
- let conversationDetails = undefined;
43
- try {
44
- conversationDetails = await chatSDK.getConversationDetails();
45
- } catch (erorr) {
46
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
47
- Event: _TelemetryConstants.TelemetryEvent.GetConversationDetailsException,
48
- ExceptionDetails: {
49
- exception: `Failed to get conversation details: ${erorr}`
50
- }
51
- });
52
- }
53
- if (isPostChatEnabled === "true" && ((_conversationDetails = conversationDetails) === null || _conversationDetails === void 0 ? void 0 : _conversationDetails.canRenderPostChat) === _Constants.Constants.truePascal) {
54
- const skipEndChatSDK = false;
55
- const skipCloseChat = true;
56
- const chatSession = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getCurrentLiveChatContext());
57
- await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, false);
58
- if (chatSession) {
59
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
60
- chatSDK.chatToken = chatSession.chatToken ?? {};
61
- chatSDK.requestId = chatSession.requestId;
36
+ const isPostChatEnabled = (0, _setPostChatContextAndLoadSurvey.checkPostChatEnabled)(props, state);
37
+ if (isPostChatEnabled) {
38
+ try {
39
+ await (0, _setPostChatContextAndLoadSurvey.initiatePostChat)(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state);
40
+ } catch (error) {
41
+ // Ending chat because something went wrong
42
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
62
43
  }
63
- if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
64
- // Only start embedded Postchat workflow if postchat context is set successfully else close chat
65
- if (state.domainStates.postChatContext) {
66
- dispatch({
67
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
68
- payload: _ConversationState.ConversationState.PostchatLoading
69
- });
70
- await (0, _utils.addDelayInMs)(_Constants.Constants.PostChatLoadingDurationInMs);
71
- const loadPostChatEvent = {
72
- eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
73
- };
74
- _omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
75
- } else {
76
- await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, true, false, true);
77
- }
78
- } else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
79
- var _props$webChatContain, _props$webChatContain2;
44
+ } else {
45
+ if (state.appStates.conversationEndedBy === _ConversationEndEntity.ConversationEndEntity.Agent) {
80
46
  dispatch({
81
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
82
- payload: _ConversationState.ConversationState.InActive
47
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
48
+ payload: undefined
83
49
  });
84
-
85
- // Disable SendBox
86
- if ((props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.renderingMiddlewareProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.hideSendboxOnConversationEnd) !== false) {
87
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
88
- setWebChatStyles(styles => {
89
- return {
90
- ...styles,
91
- hideSendBox: true
92
- };
93
- });
94
- }
50
+ dispatch({
51
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
52
+ payload: undefined
53
+ });
54
+ } else {
55
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
95
56
  }
96
- return;
97
57
  }
98
- await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
99
58
  };
100
59
 
101
60
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -117,7 +76,6 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
117
76
  postMessageToOtherTab = false;
118
77
  }
119
78
  }
120
-
121
79
  // Need to clear these states immediately when chat ended from OC.
122
80
  dispatch({
123
81
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
@@ -137,12 +95,12 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
137
95
  });
138
96
  if (!skipCloseChat) {
139
97
  try {
140
- var _props$webChatContain3;
98
+ var _props$webChatContain;
141
99
  adapter === null || adapter === void 0 ? void 0 : adapter.end();
142
100
  setAdapter(undefined);
143
101
  setWebChatStyles({
144
102
  ..._defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles,
145
- ...((_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.webChatStyles)
103
+ ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles)
146
104
  });
147
105
  _WebChatStoreLoader.WebChatStoreLoader.store = null;
148
106
  dispatch({
@@ -150,9 +108,21 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
150
108
  payload: _ConversationState.ConversationState.Closed
151
109
  });
152
110
  dispatch({
153
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
111
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_POST_CHAT_WORKFLOW_IN_PROGRESS,
154
112
  payload: false
155
113
  });
114
+ dispatch({
115
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOULD_USE_BOT_SURVEY,
116
+ payload: false
117
+ });
118
+ dispatch({
119
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED,
120
+ payload: false
121
+ });
122
+ dispatch({
123
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY,
124
+ payload: undefined
125
+ });
156
126
  dispatch({
157
127
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
158
128
  payload: undefined
@@ -176,6 +146,10 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
176
146
  eventName: endChatEventName
177
147
  });
178
148
  }
149
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
150
+ Event: _TelemetryConstants.TelemetryEvent.CloseChatCall,
151
+ Description: "Chat was closed succesfully"
152
+ });
179
153
  } catch (error) {
180
154
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
181
155
  Event: _TelemetryConstants.TelemetryEvent.CloseChatMethodException,
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.initWebChatComposer = void 0;
7
7
  var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
8
8
  var _botframeworkWebchat = require("botframework-webchat");
9
- var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
10
- var _ConversationState = require("../../../contexts/common/ConversationState");
11
9
  var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
12
- var _PostChatSurveyMode = require("../../postchatsurveypanestateful/enums/PostChatSurveyMode");
13
10
  var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
14
11
  var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader");
15
12
  var _attachmentProcessingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentProcessingMiddleware"));
@@ -35,11 +32,10 @@ var _preProcessingMiddleware = _interopRequireDefault(require("../../webchatcont
35
32
  var _sanitizationMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"));
36
33
  var _cardActionMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware");
37
34
  var _messageTimestampMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware"));
38
- var _Constants = require("../../../common/Constants");
39
35
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
- const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles) => {
42
- var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$chatConfig, _props$chatConfig$Liv, _state$domainStates$l, _state$domainStates$l2, _props$chatConfig2, _props$chatConfig2$Li, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21, _props$webChatContain22;
37
+ const initWebChatComposer = (props, chatSDK, setAdapter, state, dispatch, adapter, setWebChatStyles) => {
38
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21, _props$webChatContain22;
43
39
  const localizedTexts = {
44
40
  ..._defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts,
45
41
  ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.localizedTexts)
@@ -47,19 +43,12 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
47
43
  const disableNewLineMarkdownSupport = ((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.disableNewLineMarkdownSupport) ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.disableNewLineMarkdownSupport;
48
44
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
49
45
  const markdown = (0, _createMarkdown.createMarkdown)(((_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.disableMarkdownMessageFormatting) ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.disableMarkdownMessageFormatting, disableNewLineMarkdownSupport);
50
- const isPostChatEnabled = ((_props$chatConfig = props.chatConfig) === null || _props$chatConfig === void 0 ? void 0 : (_props$chatConfig$Liv = _props$chatConfig.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig$Liv === void 0 ? void 0 : _props$chatConfig$Liv.msdyn_postconversationsurveyenable) ?? ((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveyenable);
51
- const postChatSurveyMode = ((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Li = _props$chatConfig2.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig2$Li === void 0 ? void 0 : _props$chatConfig2$Li.msdyn_postconversationsurveymode) ?? ((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : (_state$domainStates$l4 = _state$domainStates$l3.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l4 === void 0 ? void 0 : _state$domainStates$l4.msdyn_postconversationsurveymode);
52
-
53
46
  // Initialize Web Chat's redux store
54
47
  let webChatStore = _WebChatStoreLoader.WebChatStoreLoader.store;
55
48
  if (!webChatStore) {
56
- var _state$domainStates$l5, _state$domainStates$l6, _state$domainStates$l7, _props$webChatContain6;
49
+ var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _props$webChatContain6;
57
50
  const conversationEndCallback = async () => {
58
51
  var _props$webChatContain4, _props$webChatContain5;
59
- _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
60
- Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
61
- Description: "Conversation is ended by agent side or by timeout."
62
- });
63
52
  if ((props === null || props === void 0 ? void 0 : (_props$webChatContain4 = props.webChatContainerProps) === null || _props$webChatContain4 === void 0 ? void 0 : (_props$webChatContain5 = _props$webChatContain4.renderingMiddlewareProps) === null || _props$webChatContain5 === void 0 ? void 0 : _props$webChatContain5.hideSendboxOnConversationEnd) !== false) {
64
53
  setWebChatStyles(styles => {
65
54
  return {
@@ -68,58 +57,18 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
68
57
  };
69
58
  });
70
59
  }
71
- if (isPostChatEnabled === "true") {
72
- if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
73
- // Only start embedded Postchat workflow if postchat context is set successfully else close chat
74
- if (state.domainStates.postChatContext) {
75
- _WebChatStoreLoader.WebChatStoreLoader.store = null;
76
- dispatch({
77
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
78
- payload: _ConversationState.ConversationState.PostchatLoading
79
- });
80
- await (0, _utils.addDelayInMs)(_Constants.Constants.PostChatLoadingDurationInMs);
81
- const loadPostChatEvent = {
82
- eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
83
- };
84
- _omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
85
- } else {
86
- dispatch({
87
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
88
- payload: _ConversationState.ConversationState.InActive
89
- });
90
- dispatch({
91
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
92
- payload: true
93
- });
94
- }
95
- } else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
96
- dispatch({
97
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
98
- payload: _ConversationState.ConversationState.InActive
99
- });
100
- }
101
- } else {
102
- dispatch({
103
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
104
- payload: _ConversationState.ConversationState.InActive
105
- });
106
- dispatch({
107
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
108
- payload: true
109
- });
110
- }
111
60
  dispatch({
112
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
113
- payload: undefined
61
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED,
62
+ payload: true
114
63
  });
115
- dispatch({
116
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
117
- payload: undefined
64
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
65
+ Event: _TelemetryConstants.TelemetryEvent.ConversationEndedThreadEventReceived,
66
+ Description: "Conversation end by agent side or by timeout event received."
118
67
  });
119
68
  };
120
69
  webChatStore = (0, _botframeworkWebchat.createStore)({},
121
70
  //initial state
122
- _preProcessingMiddleware.default, _attachmentProcessingMiddleware.default, (0, _attachmentUploadValidatorMiddleware.default)((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), _channelDataMiddleware.default, (0, _conversationEndMiddleware.default)(conversationEndCallback), (0, _dataMaskingMiddleware.default)((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), _messageTimestampMiddleware.default, _gifUploadMiddleware.default, _htmlPlayerMiddleware.default, _htmlTextMiddleware.default, (0, _maxMessageSizeValidator.default)(localizedTexts), _sanitizationMiddleware.default,
71
+ _preProcessingMiddleware.default, _attachmentProcessingMiddleware.default, (0, _attachmentUploadValidatorMiddleware.default)((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), _channelDataMiddleware.default, (0, _conversationEndMiddleware.default)(conversationEndCallback), (0, _dataMaskingMiddleware.default)((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), _messageTimestampMiddleware.default, _gifUploadMiddleware.default, _htmlPlayerMiddleware.default, _htmlTextMiddleware.default, (0, _maxMessageSizeValidator.default)(localizedTexts), _sanitizationMiddleware.default,
123
72
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
124
73
  ...(((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.storeMiddlewares) ?? []));
125
74
  _WebChatStoreLoader.WebChatStoreLoader.store = webChatStore;
@@ -129,7 +78,7 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
129
78
  const webChatProps = {
130
79
  ..._defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatProps,
131
80
  dir: state.domainStates.globalDir,
132
- locale: (0, _utils.changeLanguageCodeFormatForWebChat)((0, _omnichannelChatSdk.getLocaleStringFromId)((_state$domainStates$l8 = state.domainStates.liveChatConfig) === null || _state$domainStates$l8 === void 0 ? void 0 : (_state$domainStates$l9 = _state$domainStates$l8.ChatWidgetLanguage) === null || _state$domainStates$l9 === void 0 ? void 0 : _state$domainStates$l9.msdyn_localeid)),
81
+ locale: (0, _utils.changeLanguageCodeFormatForWebChat)((0, _omnichannelChatSdk.getLocaleStringFromId)((_state$domainStates$l4 = state.domainStates.liveChatConfig) === null || _state$domainStates$l4 === void 0 ? void 0 : (_state$domainStates$l5 = _state$domainStates$l4.ChatWidgetLanguage) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.msdyn_localeid)),
133
82
  store: webChatStore,
134
83
  activityMiddleware: (_props$webChatContain7 = props.webChatContainerProps) !== null && _props$webChatContain7 !== void 0 && (_props$webChatContain8 = _props$webChatContain7.renderingMiddlewareProps) !== null && _props$webChatContain8 !== void 0 && _props$webChatContain8.disableActivityMiddleware ? undefined : (0, _activityMiddleware.createActivityMiddleware)((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.systemMessageStyleProps, (_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.userMessageStyleProps),
135
84
  attachmentMiddleware: (_props$webChatContain9 = props.webChatContainerProps) !== null && _props$webChatContain9 !== void 0 && (_props$webChatContain10 = _props$webChatContain9.renderingMiddlewareProps) !== null && _props$webChatContain10 !== void 0 && _props$webChatContain10.disableAttachmentMiddleware ? undefined : (0, _attachmentMiddleware.default)(((_state$domainStates$r3 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r3 === void 0 ? void 0 : (_state$domainStates$r4 = _state$domainStates$r3.attachmentProps) === null || _state$domainStates$r4 === void 0 ? void 0 : _state$domainStates$r4.enableInlinePlaying) ?? _defaultAttachmentProps.defaultAttachmentProps.enableInlinePlaying),
@@ -116,8 +116,12 @@ const redirectPage = (redirectURL, redirectInSameWindow) => {
116
116
  }
117
117
  };
118
118
  const isReconnectEnabled = chatConfig => {
119
- var _chatConfig$LiveWSAnd;
120
- return chatConfig && ((_chatConfig$LiveWSAnd = chatConfig.LiveWSAndLiveChatEngJoin) === null || _chatConfig$LiveWSAnd === void 0 ? void 0 : _chatConfig$LiveWSAnd.msdyn_enablechatreconnect) && (chatConfig.LiveWSAndLiveChatEngJoin.msdyn_enablechatreconnect === "true" || chatConfig.LiveWSAndLiveChatEngJoin.msdyn_enablechatreconnect === true);
119
+ if (chatConfig) {
120
+ var _chatConfig$LiveWSAnd, _chatConfig$LiveWSAnd2;
121
+ const reconnectEnabled = ((_chatConfig$LiveWSAnd = chatConfig.LiveWSAndLiveChatEngJoin) === null || _chatConfig$LiveWSAnd === void 0 ? void 0 : (_chatConfig$LiveWSAnd2 = _chatConfig$LiveWSAnd.msdyn_enablechatreconnect) === null || _chatConfig$LiveWSAnd2 === void 0 ? void 0 : _chatConfig$LiveWSAnd2.toLowerCase()) === "true";
122
+ return reconnectEnabled;
123
+ }
124
+ return false;
121
125
  };
122
126
  exports.isReconnectEnabled = isReconnectEnabled;
123
127
  const hasReconnectId = reconnectAvailabilityResponse => {