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

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 (102) hide show
  1. package/README.md +7 -34
  2. package/lib/cjs/common/Constants.js +12 -3
  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 +35 -4
  6. package/lib/cjs/common/telemetry/TelemetryHelper.js +2 -1
  7. package/lib/cjs/common/utils.js +23 -2
  8. package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +12 -19
  9. package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
  10. package/lib/cjs/components/headerstateful/HeaderStateful.js +5 -2
  11. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +139 -0
  12. package/lib/cjs/components/livechatwidget/common/agentEndConversationHelper.js +36 -0
  13. package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
  14. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -10
  15. package/lib/cjs/components/livechatwidget/common/endChat.js +43 -63
  16. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +11 -49
  17. package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +5 -5
  18. package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +254 -2
  19. package/lib/cjs/components/livechatwidget/common/startChat.js +70 -59
  20. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +81 -43
  21. package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +8 -1
  22. package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -1
  23. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
  24. package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  25. package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
  26. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
  27. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  28. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
  29. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
  30. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
  31. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  32. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +7 -3
  33. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +75 -11
  34. package/lib/cjs/contexts/common/ConversationEndEntity.js +12 -0
  35. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +10 -7
  36. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +8 -3
  37. package/lib/cjs/contexts/createReducer.js +28 -2
  38. package/lib/cjs/hooks/useDebounce.js +28 -0
  39. package/lib/cjs/hooks/useWindowDimensions.js +30 -0
  40. package/lib/cjs/plugins/newMessageEventHandler.js +14 -0
  41. package/lib/esm/common/Constants.js +10 -2
  42. package/lib/esm/common/storage/default/defaultCacheManager.js +2 -2
  43. package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +15 -6
  44. package/lib/esm/common/telemetry/TelemetryConstants.js +35 -4
  45. package/lib/esm/common/telemetry/TelemetryHelper.js +2 -1
  46. package/lib/esm/common/utils.js +20 -0
  47. package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +12 -19
  48. package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
  49. package/lib/esm/components/headerstateful/HeaderStateful.js +5 -2
  50. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +134 -0
  51. package/lib/esm/components/livechatwidget/common/agentEndConversationHelper.js +30 -0
  52. package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
  53. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +14 -10
  54. package/lib/esm/components/livechatwidget/common/endChat.js +45 -65
  55. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -51
  56. package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +6 -5
  57. package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +254 -3
  58. package/lib/esm/components/livechatwidget/common/startChat.js +70 -59
  59. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +82 -44
  60. package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +8 -1
  61. package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -1
  62. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
  63. package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
  64. package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
  65. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
  66. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
  67. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
  68. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
  69. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
  70. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
  71. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +5 -3
  72. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.js +75 -11
  73. package/lib/esm/contexts/common/ConversationEndEntity.js +5 -0
  74. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +10 -7
  75. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +8 -3
  76. package/lib/esm/contexts/createReducer.js +28 -2
  77. package/lib/esm/hooks/useDebounce.js +22 -0
  78. package/lib/esm/hooks/useWindowDimensions.js +23 -0
  79. package/lib/esm/plugins/newMessageEventHandler.js +14 -0
  80. package/lib/types/common/Constants.d.ts +9 -0
  81. package/lib/types/common/storage/default/defaultCacheManager.d.ts +1 -1
  82. package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -1
  83. package/lib/types/common/telemetry/TelemetryConstants.d.ts +31 -6
  84. package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -0
  85. package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
  86. package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +4 -0
  87. package/lib/types/common/utils.d.ts +1 -0
  88. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +0 -7
  89. package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +9 -0
  90. package/lib/types/components/livechatwidget/common/agentEndConversationHelper.d.ts +6 -0
  91. package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +1 -1
  92. package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +6 -1
  93. package/lib/types/components/livechatwidget/common/startChat.d.ts +3 -3
  94. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -0
  95. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
  96. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware.d.ts +1 -1
  97. package/lib/types/contexts/common/ConversationEndEntity.d.ts +4 -0
  98. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +5 -1
  99. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +10 -7
  100. package/lib/types/hooks/useDebounce.d.ts +3 -0
  101. package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
  102. package/package.json +3 -3
@@ -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;
@@ -10,6 +10,7 @@ var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcont
10
10
  var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
11
11
  var _ChatAdapterShim = require("./ChatAdapterShim");
12
12
  var _PauseActivitySubscriber = require("./ActivitySubscriber/PauseActivitySubscriber");
13
+ var _BotAuthActivitySubscriber = require("./ActivitySubscriber/BotAuthActivitySubscriber");
13
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
15
  const createAdapter = async chatSDK => {
15
16
  const chatAdapterOptionalParams = {
@@ -34,6 +35,7 @@ const createAdapter = async chatSDK => {
34
35
  if (chatSDK.isMockModeOn !== true) {
35
36
  adapter = new _ChatAdapterShim.ChatAdapterShim(adapter);
36
37
  adapter.addSubscriber(new _PauseActivitySubscriber.PauseActivitySubscriber());
38
+ adapter.addSubscriber(new _BotAuthActivitySubscriber.BotAuthActivitySubscriber());
37
39
  return adapter.chatAdapter;
38
40
  }
39
41
  return adapter;
@@ -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+DQo8cGF0aCBkPSJNMTUuMTk3MSAxNi4yNzI1VjI1Ljg1MjRDMTUuMTk3MSAyNy4zODExIDE1Ljg0MDEgMjcuNTIwMSAxNi45ODMyIDI3LjUyMDFMMjYuNzA4NCAyNy41NjQ5TDMxLjAwMzkgMzIuMzEyM1YyNy41NjQ5SDMxLjg5N0MzMi4xNzQzIDI3LjU2MzcgMzIuNDQ4NyAyNy41MDc3IDMyLjcwNDUgMjcuNDAwMUMzMi45NjAzIDI3LjI5MjQgMzMuMTkyNSAyNy4xMzUzIDMzLjM4NzggMjYuOTM3NUMzMy41ODMxIDI2LjczOTggMzMuNzM3NyAyNi41MDU0IDMzLjg0Mjcg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9IndoaXRlIi8+DQo8L2xpbmVhckdyYWRpZW50Pg0KPC9kZWZzPg0KPC9zdmc+DQo=",
@@ -1123,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",
@@ -11,21 +11,17 @@ 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 _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;
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);
27
23
  if (props.getAuthToken && authClientFunction) {
28
- // set auth token to chat sdk before start chat
24
+ // set auth token to chat sdk before end chat
29
25
  const authSuccess = await (0, _authHelper.handleAuthentication)(chatSDK, props.chatConfig, props.getAuthToken);
30
26
  if (!authSuccess) {
31
27
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
@@ -37,60 +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) {
44
+ } else {
45
+ if (state.appStates.conversationEndedBy === _ConversationEndEntity.ConversationEndEntity.Agent) {
64
46
  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);
73
- } else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
74
- var _props$webChatContain, _props$webChatContain2;
47
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
48
+ payload: undefined
49
+ });
75
50
  dispatch({
76
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
77
- payload: _ConversationState.ConversationState.InActive
51
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
52
+ payload: undefined
78
53
  });
79
-
80
- // Disable SendBox
81
- 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) {
82
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
83
- setWebChatStyles(styles => {
84
- return {
85
- ...styles,
86
- hideSendBox: true
87
- };
88
- });
89
- }
54
+ } else {
55
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
90
56
  }
91
- return;
92
57
  }
93
- await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
94
58
  };
95
59
 
96
60
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -112,7 +76,6 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
112
76
  postMessageToOtherTab = false;
113
77
  }
114
78
  }
115
-
116
79
  // Need to clear these states immediately when chat ended from OC.
117
80
  dispatch({
118
81
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
@@ -132,12 +95,12 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
132
95
  });
133
96
  if (!skipCloseChat) {
134
97
  try {
135
- var _props$webChatContain3;
98
+ var _props$webChatContain;
136
99
  adapter === null || adapter === void 0 ? void 0 : adapter.end();
137
100
  setAdapter(undefined);
138
101
  setWebChatStyles({
139
102
  ..._defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles,
140
- ...((_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)
141
104
  });
142
105
  _WebChatStoreLoader.WebChatStoreLoader.store = null;
143
106
  dispatch({
@@ -145,9 +108,21 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
145
108
  payload: _ConversationState.ConversationState.Closed
146
109
  });
147
110
  dispatch({
148
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
111
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_POST_CHAT_WORKFLOW_IN_PROGRESS,
149
112
  payload: false
150
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
+ });
151
126
  dispatch({
152
127
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
153
128
  payload: undefined
@@ -156,10 +131,6 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
156
131
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
157
132
  payload: null
158
133
  });
159
- dispatch({
160
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
161
- payload: 0
162
- });
163
134
  dispatch({
164
135
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_PROACTIVE_CHAT_PARAMS,
165
136
  payload: {
@@ -175,6 +146,10 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
175
146
  eventName: endChatEventName
176
147
  });
177
148
  }
149
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
150
+ Event: _TelemetryConstants.TelemetryEvent.CloseChatCall,
151
+ Description: "Chat was closed succesfully"
152
+ });
178
153
  } catch (error) {
179
154
  _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
180
155
  Event: _TelemetryConstants.TelemetryEvent.CloseChatMethodException,
@@ -182,6 +157,11 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
182
157
  exception: `Failed to endChat: ${error}`
183
158
  }
184
159
  });
160
+ } finally {
161
+ dispatch({
162
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
163
+ payload: 0
164
+ });
185
165
  }
186
166
  }
187
167
  };
@@ -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, _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;
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 = (_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;
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,46 +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
- _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);
83
- } else if (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Link) {
84
- dispatch({
85
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
86
- payload: _ConversationState.ConversationState.InActive
87
- });
88
- }
89
- } else {
90
- dispatch({
91
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
92
- payload: _ConversationState.ConversationState.InActive
93
- });
94
- dispatch({
95
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT,
96
- payload: true
97
- });
98
- }
99
60
  dispatch({
100
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_TOKEN,
101
- payload: undefined
61
+ type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED,
62
+ payload: true
102
63
  });
103
- dispatch({
104
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
105
- 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."
106
67
  });
107
68
  };
108
69
  webChatStore = (0, _botframeworkWebchat.createStore)({},
109
70
  //initial state
110
- _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,
111
72
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
112
73
  ...(((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.storeMiddlewares) ?? []));
113
74
  _WebChatStoreLoader.WebChatStoreLoader.store = webChatStore;
@@ -117,7 +78,7 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
117
78
  const webChatProps = {
118
79
  ..._defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatProps,
119
80
  dir: state.domainStates.globalDir,
120
- 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)),
121
82
  store: webChatStore,
122
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),
123
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),
@@ -128,6 +89,7 @@ const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles)
128
89
  typingIndicatorMiddleware: (_props$webChatContain19 = props.webChatContainerProps) !== null && _props$webChatContain19 !== void 0 && (_props$webChatContain20 = _props$webChatContain19.renderingMiddlewareProps) !== null && _props$webChatContain20 !== void 0 && _props$webChatContain20.disableTypingIndicatorMiddleware ? undefined : (_defaultWebChatContai3 = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.typingIndicatorMiddleware,
129
90
  onTelemetry: (0, _WebChatLogger.createWebChatTelemetry)(),
130
91
  cardActionMiddleware: (0, _cardActionMiddleware.createCardActionMiddleware)(((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.botMagicCode) || undefined),
92
+ sendTypingIndicator: true,
131
93
  ...((_props$webChatContain22 = props.webChatContainerProps) === null || _props$webChatContain22 === void 0 ? void 0 : _props$webChatContain22.webChatProps)
132
94
  };
133
95
  return webChatProps;
@@ -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 = {