@microsoft/omnichannel-chat-widget 0.1.0-main.21ab3ba → 0.1.0-main.23dc34f

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 (68) hide show
  1. package/README.md +7 -34
  2. package/lib/cjs/common/Constants.js +2 -0
  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 +5 -0
  6. package/lib/cjs/common/telemetry/TelemetryHelper.js +2 -1
  7. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +1 -1
  8. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
  9. package/lib/cjs/components/headerstateful/HeaderStateful.js +4 -2
  10. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -10
  11. package/lib/cjs/components/livechatwidget/common/endChat.js +23 -17
  12. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +25 -13
  13. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +5 -5
  14. package/lib/cjs/components/livechatwidget/common/startChat.js +70 -59
  15. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +43 -37
  16. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +8 -1
  17. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
  18. package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  19. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
  20. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  21. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
  22. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
  23. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
  24. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  25. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
  26. package/lib/cjs/hooks/useDebounce.js +28 -0
  27. package/lib/cjs/hooks/useWindowDimensions.js +30 -0
  28. package/lib/cjs/plugins/newMessageEventHandler.js +14 -0
  29. package/lib/esm/common/Constants.js +2 -0
  30. package/lib/esm/common/storage/default/defaultCacheManager.js +2 -2
  31. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +15 -6
  32. package/lib/esm/common/telemetry/TelemetryConstants.js +5 -0
  33. package/lib/esm/common/telemetry/TelemetryHelper.js +2 -1
  34. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +1 -1
  35. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
  36. package/lib/esm/components/headerstateful/HeaderStateful.js +4 -2
  37. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -10
  38. package/lib/esm/components/livechatwidget/common/endChat.js +23 -17
  39. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +25 -13
  40. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +6 -5
  41. package/lib/esm/components/livechatwidget/common/startChat.js +70 -59
  42. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +44 -38
  43. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +8 -1
  44. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
  45. package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  46. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
  47. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  48. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
  49. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
  50. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
  51. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  52. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +4 -2
  53. package/lib/esm/hooks/useDebounce.js +22 -0
  54. package/lib/esm/hooks/useWindowDimensions.js +23 -0
  55. package/lib/esm/plugins/newMessageEventHandler.js +14 -0
  56. package/lib/types/common/Constants.d.ts +2 -0
  57. package/lib/types/common/storage/default/defaultCacheManager.d.ts +1 -1
  58. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -1
  59. package/lib/types/common/telemetry/TelemetryConstants.d.ts +6 -1
  60. package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -0
  61. package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
  62. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +4 -0
  63. package/lib/types/components/livechatwidget/common/startChat.d.ts +3 -3
  64. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -0
  65. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
  66. package/lib/types/hooks/useDebounce.d.ts +3 -0
  67. package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
  68. package/package.json +3 -3
package/README.md CHANGED
@@ -11,8 +11,6 @@
11
11
  1. [Installation](#installation)
12
12
  1. [Example Usage](#example-usage)
13
13
  1. [Components](#components)
14
- 1. [Common Scenarios](#common-scenarios)
15
- - [Disable Bot Magic Code](#disable-bot-magic-code)
16
14
  1. [See Also](#see-also)
17
15
 
18
16
  ## Introduction
@@ -97,7 +95,9 @@ const render = async () => {
97
95
  render();
98
96
  ```
99
97
 
100
- A sample widget can be found in this repo [here](https://github.com/microsoft/omnichannel-chat-widget/tree/main/chat-widget/sample). To build it, do ```yarn build-sample``` or ```yarn build-sample:dev``` from project root.
98
+ A javascript sample widget can be found in this repo [here](https://github.com/microsoft/omnichannel-chat-widget/tree/main/chat-widget/samples/javascript-sample). To build it, do ```yarn build-sample``` or ```yarn build-sample:dev``` from project root.
99
+
100
+ A typescript sample widget can be found [here](https://github.com/microsoft/omnichannel-chat-widget/tree/main/chat-widget/samples/typescript-sample)
101
101
 
102
102
  ## Components
103
103
 
@@ -129,6 +129,7 @@ These are components that are included in the ```@microsoft/omnichannel-chat-com
129
129
  | ----- | -------- | ----- |
130
130
  | WebChatContainer | The default wrapper around BotFramework's [WebChat](https://github.com/microsoft/BotFramework-WebChat), which is the message container we are using | [IWebChatContainerStatefulProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-widget/src/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.ts) |
131
131
  | LiveChatWidget | The default widget that stitches the UI components with Chat SDK | [ILiveChatWidgetProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-widget/src/components/livechatwidget/interfaces/ILiveChatWidgetProps.ts) |
132
+ | PostChatLoadingPane | The default loading pane used after the chat is ended and before the post chat pane loads completely | [ILoadingPaneProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-components/src/components/loadingpane/interfaces/ILoadingPaneProps.ts) |
132
133
 
133
134
  Some of the interfaces listed in the Stateless table have Stateful counterparts defined in the ```@microsoft/omnichannel-chat-widget``` package. For example, [IConfirmationPaneStatefulProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-widget/src/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.ts) extends [IConfirmationPaneProps](https://github.com/microsoft/omnichannel-chat-widget/blob/main/chat-components/src/components/confirmationpane/interfaces/IConfirmationPaneProps.ts) with additional attributes that only makes sense in the stateful context.
134
135
 
@@ -220,40 +221,12 @@ const customizedFooterProp: IFooterProps = {
220
221
 
221
222
  > :pushpin: Note that [WebChat hooks](https://github.com/microsoft/BotFramework-WebChat/blob/main/docs/HOOKS.md) can also be used in any custom components.
222
223
 
223
- ## Common Scenarios
224
-
225
- ### Disable Bot Magic Code
226
-
227
- Configuration to disable the default behaviour of having to type the magic code in the conversation to complete the sign-in proccess with a bot. Instead, the magic code will be sent to the bot behind the scenes.
228
-
229
- 1. Add [MagicCodeForwarder.html](sample/MagicCodeForwarder.html) in the same location as the chat widget
230
-
231
- 2. Add `botMagicCode` configuration to disable default magic code feature
232
-
233
- > :exclamation: `fwdUrl` **MUST** have the same `origin` as the chat widget URL
234
-
235
- ```js
236
- const liveChatWidgetProps = {
237
- chatSDK: chatSDK, // mandatory
238
- chatConfig: chatConfig, // mandatory
239
- webChatContainerProps: {
240
- botMagicCode: {
241
- disabled: true,
242
- fwdUrl: 'http://localhost:8000/sample/MagicCodeForwarder.html'
243
- }
244
- },
245
- };
246
-
247
- ReactDOM.render(
248
- <LiveChatWidget {...liveChatWidgetProps}/>,
249
- document.getElementById("my-container")
250
- );
251
- ```
252
-
253
224
  ## See Also
254
225
 
255
226
  [Telemetry](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/Telemetry.md)\
256
227
  [Create LCW widget with Webpack5 and TypeScript](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/BuildingUsingWebpack5.md)\
257
228
  [Omnichannel Features](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/Features.md)\
258
229
  [How to Add Visual Regression Tests](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/VisualRegressionTestingGuide.md)\
259
- [Security](https://github.com/microsoft/omnichannel-chat-widget/blob/main/SECURITY.md)
230
+ [Security](https://github.com/microsoft/omnichannel-chat-widget/blob/main/SECURITY.md)\
231
+ [Third Party Cookie Support](https://github.com/microsoft/omnichannel-chat-widget/blob/main/docs/Tpc.md)\
232
+ [Storybook](https://microsoft.github.io/omnichannel-chat-widget/docs/storybook/)
@@ -89,6 +89,7 @@ _defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect
89
89
  _defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
90
90
  _defineProperty(Constants, "PostChatLoadingDurationInMs", 2000);
91
91
  _defineProperty(Constants, "BrowserUnloadConfirmationMessage", "Do you want to leave chat?");
92
+ _defineProperty(Constants, "CacheTtlInMinutes", 15);
92
93
  const Regex = (_class = class Regex {}, _defineProperty(_class, "EmailRegex", "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"), _class);
93
94
  exports.Regex = Regex;
94
95
  class HtmlIdNames {}
@@ -134,6 +135,7 @@ _defineProperty(HtmlAttributeNames, "noreferrerTag", "noreferrer");
134
135
  _defineProperty(HtmlAttributeNames, "adaptiveCardClassName", "ac-adaptiveCard");
135
136
  _defineProperty(HtmlAttributeNames, "adaptiveCardTextBlockClassName", "ac-textBlock");
136
137
  _defineProperty(HtmlAttributeNames, "adaptiveCardToggleInputClassName", "ac-toggleInput");
138
+ _defineProperty(HtmlAttributeNames, "adaptiveCardActionSetClassName", "ac-actionSet");
137
139
  class WebChatMiddlewareConstants {}
138
140
  exports.WebChatMiddlewareConstants = WebChatMiddlewareConstants;
139
141
  _defineProperty(WebChatMiddlewareConstants, "nextVisibleActivity", "nextVisibleActivity");
@@ -13,11 +13,11 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
13
13
  class defaultCacheManager {}
14
14
  exports.defaultCacheManager = defaultCacheManager;
15
15
  _defineProperty(defaultCacheManager, "InternalCache", {});
16
- const registerBroadcastServiceForLocalStorage = (orgid, widgetId, widgetInstanceId) => {
16
+ const registerBroadcastServiceForLocalStorage = (orgid, widgetId, widgetInstanceId, ttlInMins) => {
17
17
  const widgetCacheId = (0, _utils.getWidgetCacheId)(orgid, widgetId, widgetInstanceId);
18
18
  _omnichannelChatComponents.BroadcastService.getMessageByEventName(widgetCacheId).subscribe(msg => {
19
19
  try {
20
- (0, _defaultClientDataStoreProvider.defaultClientDataStoreProvider)().setData(widgetCacheId, JSON.stringify(msg.payload), "localStorage");
20
+ (0, _defaultClientDataStoreProvider.defaultClientDataStoreProvider)(ttlInMins).setData(widgetCacheId, JSON.stringify(msg.payload), "localStorage");
21
21
  } catch (error) {
22
22
  console.error("Error in setting data to localstorage", error);
23
23
  }
@@ -4,21 +4,30 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.defaultClientDataStoreProvider = void 0;
7
- var _defaultInMemoryDataStore = require("./defaultInMemoryDataStore");
8
- var _TelemetryHelper = require("../../telemetry/TelemetryHelper");
9
7
  var _TelemetryConstants = require("../../telemetry/TelemetryConstants");
10
- const defaultClientDataStoreProvider = () => {
8
+ var _TelemetryHelper = require("../../telemetry/TelemetryHelper");
9
+ var _defaultInMemoryDataStore = require("./defaultInMemoryDataStore");
10
+ /* eslint-disable @typescript-eslint/no-explicit-any */
11
+
12
+ const defaultClientDataStoreProvider = function () {
13
+ let cacheTtlinMins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
14
+ let ttlInMs = 0;
11
15
  const isCookieAllowed = () => {
12
16
  try {
13
17
  localStorage;
14
18
  sessionStorage;
15
19
  return true;
16
20
  } catch (error) {
17
- console.error("Third party cookie blocked");
21
+ if (!window.TPCWarningShown) {
22
+ console.warn("Third party cookies blocked.");
23
+ window.TPCWarningShown = true;
24
+ }
18
25
  return false;
19
26
  }
20
27
  };
21
- const TtlInMs = 15 * 60 * 1000; // 15 mins
28
+ if (ttlInMs == 0) {
29
+ ttlInMs = cacheTtlinMins * 60 * 1000;
30
+ }
22
31
  const dataStoreProvider = {
23
32
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
24
33
  setData: (key, data, type) => {
@@ -28,7 +37,7 @@ const defaultClientDataStoreProvider = () => {
28
37
  const now = new Date();
29
38
  const item = {
30
39
  data: data,
31
- expiry: now.getTime() + TtlInMs
40
+ expiry: now.getTime() + ttlInMs
32
41
  };
33
42
  const strItem = JSON.stringify(item);
34
43
  if (type === "localStorage") {
@@ -54,6 +54,8 @@ exports.BroadcastEvent = BroadcastEvent;
54
54
  BroadcastEvent["InitiateEndChatOnBrowserUnload"] = "InitiateEndChatOnBrowserUnload";
55
55
  BroadcastEvent["ClosePopoutWindow"] = "ClosePopoutWindow";
56
56
  BroadcastEvent["RaiseErrorEvent"] = "RaiseErrorEvent";
57
+ BroadcastEvent["NetworkDisconnected"] = "NetworkDisconnected";
58
+ BroadcastEvent["NetworkReconnected"] = "NetworkReconnected";
57
59
  })(BroadcastEvent || (exports.BroadcastEvent = BroadcastEvent = {}));
58
60
  let TelemetryEvent;
59
61
  exports.TelemetryEvent = TelemetryEvent;
@@ -115,6 +117,7 @@ exports.TelemetryEvent = TelemetryEvent;
115
117
  TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
116
118
  TelemetryEvent["EmailTranscriptSent"] = "EmailTranscriptSent";
117
119
  TelemetryEvent["EmailTranscriptFailed"] = "EmailTranscriptFailed";
120
+ TelemetryEvent["ErrorUIPaneLoaded"] = "ErrorUIPaneLoaded";
118
121
  TelemetryEvent["DownloadTranscriptFailed"] = "DownloadTranscriptFailed";
119
122
  TelemetryEvent["StartChatFailed"] = "StartChatFailed";
120
123
  TelemetryEvent["IC3ThreadUpdateEventReceived"] = "IC3ThreadUpdateEventReceived";
@@ -170,6 +173,8 @@ exports.TelemetryEvent = TelemetryEvent;
170
173
  TelemetryEvent["ReconnectChatMinimize"] = "ReconnectChatMinimize";
171
174
  TelemetryEvent["MessageSent"] = "MessageSent";
172
175
  TelemetryEvent["MessageReceived"] = "MessageReceived";
176
+ TelemetryEvent["SystemMessageReceived"] = "SystemMessageReceived";
177
+ TelemetryEvent["HistoryMessageReceived"] = "HistoryMessageReceived";
173
178
  TelemetryEvent["CustomContextReceived"] = "CustomContextReceived";
174
179
  TelemetryEvent["NetworkDisconnected"] = "NetworkDisconnected";
175
180
  TelemetryEvent["NetworkReconnected"] = "NetworkReconnected";
@@ -62,6 +62,7 @@ class TelemetryHelper {
62
62
  event.ElapsedTimeInMilliseconds = payload.ElapsedTimeInMilliseconds;
63
63
  event.ExceptionDetails = JSON.stringify(payload.ExceptionDetails);
64
64
  event.Description = payload.Description;
65
+ event.CustomProperties = JSON.stringify(payload.CustomProperties);
65
66
  });
66
67
  }
67
68
  static conformToWebChatContract(level, input) {
@@ -167,7 +168,7 @@ class TelemetryHelper {
167
168
  telemetryDataLocal.widgetId = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.appId;
168
169
  telemetryDataLocal.orgId = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.orgId;
169
170
  telemetryDataLocal.orgUrl = telemetryConfig === null || telemetryConfig === void 0 ? void 0 : telemetryConfig.orgUrl;
170
- telemetryDataLocal.lcwRuntimeId = (0, _utils.newGuid)();
171
+ telemetryDataLocal.lcwRuntimeId = telemetryConfig.LCWRuntimeId ?? (0, _utils.newGuid)();
171
172
  return telemetryDataLocal;
172
173
  }
173
174
  static addSessionDataToTelemetry(chatSession, telemetryInternalData) {
@@ -90,7 +90,7 @@ const ConfirmationPaneStateful = props => {
90
90
  Event: _TelemetryConstants.TelemetryEvent.ConfirmationPaneLoaded
91
91
  });
92
92
  }, []);
93
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !(controlProps !== null && controlProps !== void 0 && controlProps.disableDimLayer) && /*#__PURE__*/_react.default.createElement(_DimLayer.DimLayer, {
93
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_DimLayer.DimLayer, {
94
94
  brightness: (controlProps === null || controlProps === void 0 ? void 0 : controlProps.brightnessValueOnDim) ?? "0.2"
95
95
  }), /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.ConfirmationPane, {
96
96
  componentOverrides: props === null || props === void 0 ? void 0 : props.componentOverrides,
@@ -97,7 +97,7 @@ const EmailTranscriptPaneStateful = props => {
97
97
  Event: _TelemetryConstants.TelemetryEvent.EmailTranscriptLoaded
98
98
  });
99
99
  }, [initialEmail]);
100
- return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, !(controlProps !== null && controlProps !== void 0 && controlProps.disableDimLayer) && /*#__PURE__*/_react.default.createElement(_DimLayer.DimLayer, {
100
+ return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_DimLayer.DimLayer, {
101
101
  brightness: (controlProps === null || controlProps === void 0 ? void 0 : controlProps.brightnessValueOnDim) ?? "0.2"
102
102
  }), /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.InputValidationPane, {
103
103
  componentOverrides: props.componentOverrides,
@@ -30,6 +30,7 @@ const HeaderStateful = props => {
30
30
  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
31
  const outOfOfficeStyleProps = Object.assign({}, _defaultOutOfOfficeHeaderStyleProps.defaultOutOfOfficeHeaderStyleProps, outOfOfficeHeaderProps === null || outOfOfficeHeaderProps === void 0 ? void 0 : outOfOfficeHeaderProps.styleProps);
32
32
  const conversationState = (0, _react.useRef)(state.appStates.conversationState);
33
+ const conversationEndedByAgent = (0, _react.useRef)(state.appStates.conversationEndedByAgent);
33
34
  const controlProps = {
34
35
  id: "oc-lcw-header",
35
36
  dir: state.domainStates.globalDir,
@@ -49,7 +50,7 @@ const HeaderStateful = props => {
49
50
  Event: _TelemetryConstants.TelemetryEvent.HeaderCloseButtonClicked,
50
51
  Description: "Header Close button clicked."
51
52
  });
52
- if (conversationState.current === _ConversationState.ConversationState.Active) {
53
+ if (conversationState.current === _ConversationState.ConversationState.Active || conversationEndedByAgent.current) {
53
54
  dispatch({
54
55
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOW_CONFIRMATION,
55
56
  payload: true
@@ -71,7 +72,7 @@ const HeaderStateful = props => {
71
72
  ...(headerProps === null || headerProps === void 0 ? void 0 : headerProps.controlProps),
72
73
  hideTitle: state.appStates.conversationState === _ConversationState.ConversationState.Loading && !state.appStates.isStartChatFailing || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP = headerProps.controlProps) === null || _headerProps$controlP === void 0 ? void 0 : _headerProps$controlP.hideTitle),
73
74
  hideIcon: state.appStates.conversationState === _ConversationState.ConversationState.Loading && !state.appStates.isStartChatFailing || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP2 = headerProps.controlProps) === null || _headerProps$controlP2 === void 0 ? void 0 : _headerProps$controlP2.hideIcon),
74
- hideCloseButton: state.appStates.conversationState === _ConversationState.ConversationState.Loading && !state.appStates.isStartChatFailing || state.appStates.conversationState === _ConversationState.ConversationState.Prechat || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
75
+ hideCloseButton: state.appStates.conversationState === _ConversationState.ConversationState.Loading && !state.appStates.isStartChatFailing || state.appStates.conversationState === _ConversationState.ConversationState.PostchatLoading || state.appStates.conversationState === _ConversationState.ConversationState.Prechat || state.appStates.conversationState === _ConversationState.ConversationState.ReconnectChat || (headerProps === null || headerProps === void 0 ? void 0 : (_headerProps$controlP3 = headerProps.controlProps) === null || _headerProps$controlP3 === void 0 ? void 0 : _headerProps$controlP3.hideCloseButton)
75
76
  };
76
77
  const outOfOfficeControlProps = {
77
78
  id: "oc-lcw-header",
@@ -95,6 +96,7 @@ const HeaderStateful = props => {
95
96
  if (state.appStates.conversationState) {
96
97
  conversationState.current = state.appStates.conversationState;
97
98
  }
99
+ conversationEndedByAgent.current = state.appStates.conversationEndedByAgent;
98
100
  }, [state.appStates]);
99
101
  return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.Header, {
100
102
  componentOverrides: headerProps === null || headerProps === void 0 ? void 0 : headerProps.componentOverrides,
@@ -13,9 +13,9 @@ var _activityMiddleware = require("../../../webchatcontainerstateful/webchatcont
13
13
  var _attachmentMiddleware = _interopRequireDefault(require("../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware"));
14
14
  var _avatarMiddleware = require("../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware");
15
15
  var _createMarkdown = require("../createMarkdown");
16
+ var _WebChatLogger = require("../../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger");
16
17
  var _groupActivitiesMiddleware = require("../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/groupActivitiesMiddleware");
17
18
  var _typingIndicatorMiddleware = require("../../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware");
18
- var _WebChatLogger = require("../../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger");
19
19
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20
20
  /* eslint-disable @typescript-eslint/no-empty-function, @typescript-eslint/no-explicit-any */
21
21
 
@@ -413,6 +413,7 @@ const dummyDefaultProps = {
413
413
  width: "90px",
414
414
  cursor: "pointer",
415
415
  overflow: "hidden",
416
+ padding: "0px",
416
417
  whiteSpace: "nowrap"
417
418
  },
418
419
  subtitleStyleProps: {
@@ -420,12 +421,14 @@ const dummyDefaultProps = {
420
421
  fontWeight: "200",
421
422
  color: "#666",
422
423
  overflow: "hidden",
424
+ padding: "0px",
423
425
  fontFamily: "'Segoe UI',Arial,sans-serif",
424
426
  display: "block",
425
427
  alignItems: "center",
426
428
  margin: "0px 14px 0px 14px",
427
429
  textOverflow: "ellipsis !important",
428
- width: "max-content",
430
+ width: "90px",
431
+ whiteSpace: "nowrap",
429
432
  cursor: "pointer"
430
433
  },
431
434
  classNames: {
@@ -475,7 +478,6 @@ const dummyDefaultProps = {
475
478
  cancelButtonText: "Cancel",
476
479
  cancelButtonAriaLabel: "Cancel. Return to Chat",
477
480
  brightnessValueOnDim: "0.2",
478
- disableDimLayer: false,
479
481
  onConfirm: () => {},
480
482
  // Detailed implementation omitted
481
483
  onCancel: () => {} // Detailed implementation omitted
@@ -583,6 +585,7 @@ const dummyDefaultProps = {
583
585
  hideCallingContainer: false,
584
586
  hideChatButton: false,
585
587
  hideConfirmationPane: false,
588
+ hideErrorUIPane: false,
586
589
  hideFooter: false,
587
590
  hideHeader: false,
588
591
  hideLoadingPane: false,
@@ -633,7 +636,6 @@ const dummyDefaultProps = {
633
636
  cancelButtonText: "Cancel",
634
637
  cancelButtonAriaLabel: "Cancel",
635
638
  brightnessValueOnDim: "0.2",
636
- disableDimLayer: false,
637
639
  onSend: undefined,
638
640
  onCancel: undefined,
639
641
  checkInput: undefined
@@ -1031,7 +1033,8 @@ const dummyDefaultProps = {
1031
1033
  margin: "0px 0px 20px 0px",
1032
1034
  display: "flex",
1033
1035
  order: 1,
1034
- alignSelf: "auto"
1036
+ alignSelf: "auto",
1037
+ overflow: "visible"
1035
1038
  },
1036
1039
  iconImageProps: {
1037
1040
  src: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAiIGhlaWdodD0iNDAiIHZpZXdCb3g9IjAgMCA0MCA0MCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4NCjxnIGZpbHRlcj0idXJsKCNmaWx0ZXIwX2lpKSI+DQo8cGF0aCBkPSJNMTUuMTk3MSAxNi4yNzI1VjI1Ljg1MjRDMTUuMTk3MSAyNy4zODExIDE1Ljg0MDEgMjcuNTIwMSAxNi45ODMyIDI3LjUyMDFMMjYuNzA4NCAyNy41NjQ5TDMxLjAwMzkgMzIuMzEyM1YyNy41NjQ5SDMxLjg5N0MzMi4xNzQzIDI3LjU2MzcgMzIuNDQ4NyAyNy41MDc3IDMyLjcwNDUgMjcuNDAwMUMzMi45NjAzIDI3LjI5MjQgMzMuMTkyNSAyNy4xMzUzIDMzLjM4NzggMjYuOTM3NUMzMy41ODMxIDI2LjczOTggMzMuNzM3NyAyNi41MDU0IDMzLjg0MjcgMjYuMjQ3N0MzMy45NDc4IDI1Ljk5IDM0LjAwMTMgMjUuNzE0IDM0LjAwMDEgMjUuNDM1NVY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7 +1126,8 @@ const dummyDefaultProps = {
1123
1126
  dir: "auto",
1124
1127
  hideOOOHPane: false,
1125
1128
  hideTitle: false,
1126
- titleText: "Thanks for contacting us. You have reached us outside of our operating hours. An agent will respond when we open."
1129
+ titleText: "Thanks for contacting us. You have reached us outside of our operating hours. An agent will respond when we open. Please see link https://microsoft.com",
1130
+ openLinkInNewTab: true
1127
1131
  },
1128
1132
  styleProps: {
1129
1133
  generalStyleProps: {
@@ -1166,7 +1170,7 @@ const dummyDefaultProps = {
1166
1170
  subtitleText: "Please take a moment to give us feedback about your chat experience. We are loading the survey for you now."
1167
1171
  },
1168
1172
  styleProps: {
1169
- // ...[Existing chat button style props]
1173
+ // ...[Existing loading pane style props]
1170
1174
  generalStyleProps: {
1171
1175
  position: "initial",
1172
1176
  width: "100%",
@@ -1211,7 +1215,7 @@ const dummyDefaultProps = {
1211
1215
  generalStyleProps: {
1212
1216
  borderStyle: "solid",
1213
1217
  borderRadius: "4px",
1214
- borderWidth: "3px",
1218
+ borderWidth: "0px",
1215
1219
  backgroundColor: "#FFFFFF",
1216
1220
  borderColor: "#F1F1F1",
1217
1221
  overflowY: "auto",
@@ -1616,10 +1620,10 @@ const dummyDefaultProps = {
1616
1620
  padding: "0px 10px 0 10px"
1617
1621
  },
1618
1622
  userMessageBoxStyles: {
1619
- maxWidth: "75%"
1623
+ maxWidth: "90%"
1620
1624
  },
1621
1625
  systemMessageBoxStyles: {
1622
- maxWidth: "75%"
1626
+ maxWidth: "90%"
1623
1627
  },
1624
1628
  typingIndicatorStyleProps: {
1625
1629
  marginLeft: "10px",
@@ -17,15 +17,15 @@ var _utils = require("../../../common/utils");
17
17
  var _authHelper = require("./authHelper");
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 _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _conversationDetails;
21
- const isPostChatEnabled = (_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 = (_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;
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
23
 
24
24
  //Unable to end chat if token has expired
25
25
  if (props.getAuthToken) {
26
26
  const authClientFunction = (0, _authHelper.getAuthClientFunction)(props.chatConfig);
27
27
  if (props.getAuthToken && authClientFunction) {
28
- // set auth token to chat sdk before start chat
28
+ // set auth token to chat sdk before end chat
29
29
  const authSuccess = await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
30
30
  if (!authSuccess) {
31
31
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
@@ -61,15 +61,20 @@ const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, disp
61
61
  chatSDK.requestId = chatSession.requestId;
62
62
  }
63
63
  if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
64
- dispatch({
65
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
66
- payload: _ConversationState.ConversationState.PostchatLoading
67
- });
68
- await (0, _utils.addDelayInMs)(_Constants.Constants.PostChatLoadingDurationInMs);
69
- const loadPostChatEvent = {
70
- eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
71
- };
72
- _omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
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
+ }
73
78
  } else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
74
79
  var _props$webChatContain, _props$webChatContain2;
75
80
  dispatch({
@@ -156,10 +161,6 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
156
161
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
157
162
  payload: null
158
163
  });
159
- dispatch({
160
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
161
- payload: 0
162
- });
163
164
  dispatch({
164
165
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
165
166
  payload: {
@@ -182,6 +183,11 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
182
183
  exception: `Failed to endChat: ${error}`
183
184
  }
184
185
  });
186
+ } finally {
187
+ dispatch({
188
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
189
+ payload: 0
190
+ });
185
191
  }
186
192
  }
187
193
  };
@@ -39,7 +39,7 @@ var _Constants = require("../../../common/Constants");
39
39
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40
40
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
41
  const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles) => {
42
- var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _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;
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;
43
43
  const localizedTexts = {
44
44
  ..._defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts,
45
45
  ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.localizedTexts)
@@ -47,8 +47,8 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
47
47
  const disableNewLineMarkdownSupport = ((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.disableNewLineMarkdownSupport) ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.disableNewLineMarkdownSupport;
48
48
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
49
49
  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 = (_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 = (_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;
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
52
 
53
53
  // Initialize Web Chat's redux store
54
54
  let webChatStore = _WebChatStoreLoader.WebChatStoreLoader.store;
@@ -70,16 +70,28 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
70
70
  }
71
71
  if (isPostChatEnabled === "true") {
72
72
  if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed) {
73
- _WebChatStoreLoader.WebChatStoreLoader.store = null;
74
- dispatch({
75
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
76
- payload: _ConversationState.ConversationState.PostchatLoading
77
- });
78
- await (0, _utils.addDelayInMs)(_Constants.Constants.PostChatLoadingDurationInMs);
79
- const loadPostChatEvent = {
80
- eventName: _TelemetryConstants.BroadcastEvent.LoadPostChatSurvey
81
- };
82
- _omnichannelChatComponents.BroadcastService.postMessage(loadPostChatEvent);
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
+ }
83
95
  } else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
84
96
  dispatch({
85
97
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.isReconnectEnabled = exports.handleChatReconnect = exports.getChatReconnectContext = void 0;
7
7
  require("regenerator-runtime/runtime");
8
8
  var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
9
+ var _authHelper = require("./authHelper");
10
+ var _utils = require("../../../common/utils");
9
11
  var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
10
12
  var _ConversationState = require("../../../contexts/common/ConversationState");
11
13
  var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
12
14
  var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
13
- var _authHelper = require("./authHelper");
14
- var _utils = require("../../../common/utils");
15
15
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
16
  const handleChatReconnect = async (chatSDK, props, dispatch, setAdapter, initStartChat, state) => {
17
17
  var _props$chatConfig, _props$chatConfig$Liv;
@@ -60,14 +60,14 @@ const getChatReconnectContext = async (chatSDK, chatConfig, props, isAuthenticat
60
60
  const chatReconnectOptionalParams = {
61
61
  reconnectId: (_props$reconnectChatP4 = props.reconnectChatPaneProps) === null || _props$reconnectChatP4 === void 0 ? void 0 : _props$reconnectChatP4.reconnectId
62
62
  };
63
+ // Get auth token for getting chat reconnect context
63
64
  if (isAuthenticatedChat) {
64
- // Get auth token for for getting chat reconnect context
65
65
  await (0, _authHelper.handleAuthentication)(chatSDK, chatConfig, props.getAuthToken);
66
66
  }
67
67
  const reconnectChatContext = await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.getChatReconnectContext(chatReconnectOptionalParams));
68
68
  if (isAuthenticatedChat) {
69
69
  // remove auth token after reconnectId is fetched
70
- // this will be reset later at start chat
70
+ // AuthToken will be reset later at start chat
71
71
  (0, _authHelper.removeAuthTokenProvider)(chatSDK);
72
72
  }
73
73
  return reconnectChatContext;
@@ -101,7 +101,7 @@ const setReconnectIdAndStartChat = async (isAuthenticatedChat, chatSDK, props, d
101
101
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
102
102
  payload: _ConversationState.ConversationState.Loading
103
103
  });
104
- await initStartChat(chatSDK, props.chatConfig, props.getAuthToken, dispatch, setAdapter, optionalParams);
104
+ await initStartChat(chatSDK, dispatch, setAdapter, props, optionalParams);
105
105
  };
106
106
  const redirectPage = (redirectURL, redirectInSameWindow) => {
107
107
  const redirectPageRequest = {