@microsoft/omnichannel-chat-widget 1.8.2-main.fc93d3d → 1.8.3-main.1381896

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 (126) hide show
  1. package/README.md +46 -1
  2. package/lib/cjs/common/Constants.js +10 -2
  3. package/lib/cjs/common/telemetry/TelemetryConstants.js +6 -0
  4. package/lib/cjs/common/telemetry/TelemetryHelper.js +7 -5
  5. package/lib/cjs/common/utils.js +27 -2
  6. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +4 -4
  7. package/lib/cjs/components/citationpanestateful/CitationDim.js +29 -0
  8. package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +199 -0
  9. package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +70 -0
  10. package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
  11. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -4
  12. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
  13. package/lib/cjs/components/livechatwidget/common/createInternetConnectionChangeHandler.js +22 -9
  14. package/lib/cjs/components/livechatwidget/common/createMarkdown.js +54 -1
  15. package/lib/cjs/components/livechatwidget/common/customEventHandler.js +53 -0
  16. package/lib/cjs/components/livechatwidget/common/endChat.js +34 -4
  17. package/lib/cjs/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
  18. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +12 -5
  19. package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
  20. package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +23 -0
  21. package/lib/cjs/components/livechatwidget/common/startChat.js +8 -6
  22. package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +8 -2
  23. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +45 -11
  24. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +114 -13
  25. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -12
  26. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
  27. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
  28. package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +62 -3
  29. package/lib/cjs/components/webchatcontainerstateful/common/utils/fontUtils.js +28 -0
  30. package/lib/cjs/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
  31. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  32. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
  33. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.js +42 -0
  34. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +139 -0
  35. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.js +41 -0
  36. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +54 -0
  37. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +45 -0
  38. package/lib/cjs/contexts/common/CustomEventType.js +1 -0
  39. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +46 -45
  40. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
  41. package/lib/cjs/contexts/createReducer.js +15 -0
  42. package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +101 -36
  43. package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +39 -21
  44. package/lib/cjs/firstresponselatency/util.js +24 -10
  45. package/lib/cjs/index.js +9 -1
  46. package/lib/cjs/plugins/createChatTranscript.js +13 -0
  47. package/lib/cjs/plugins/newMessageEventHandler.js +2 -2
  48. package/lib/esm/common/Constants.js +10 -2
  49. package/lib/esm/common/telemetry/TelemetryConstants.js +6 -0
  50. package/lib/esm/common/telemetry/TelemetryHelper.js +7 -5
  51. package/lib/esm/common/utils.js +21 -0
  52. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +4 -4
  53. package/lib/esm/components/citationpanestateful/CitationDim.js +20 -0
  54. package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +188 -0
  55. package/lib/esm/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +61 -0
  56. package/lib/esm/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
  57. package/lib/esm/components/livechatwidget/LiveChatWidget.js +4 -4
  58. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
  59. package/lib/esm/components/livechatwidget/common/createInternetConnectionChangeHandler.js +22 -9
  60. package/lib/esm/components/livechatwidget/common/createMarkdown.js +54 -1
  61. package/lib/esm/components/livechatwidget/common/customEventHandler.js +45 -0
  62. package/lib/esm/components/livechatwidget/common/endChat.js +35 -5
  63. package/lib/esm/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
  64. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -6
  65. package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
  66. package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +23 -0
  67. package/lib/esm/components/livechatwidget/common/startChat.js +8 -6
  68. package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +3 -3
  69. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +45 -11
  70. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +114 -14
  71. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -12
  72. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
  73. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
  74. package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +55 -0
  75. package/lib/esm/components/webchatcontainerstateful/common/utils/fontUtils.js +21 -0
  76. package/lib/esm/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
  77. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  78. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
  79. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.js +36 -0
  80. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +133 -0
  81. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.js +33 -0
  82. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +46 -0
  83. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +38 -0
  84. package/lib/esm/contexts/common/CustomEventType.js +1 -0
  85. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +46 -45
  86. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
  87. package/lib/esm/contexts/createReducer.js +15 -0
  88. package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +101 -36
  89. package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +39 -21
  90. package/lib/esm/firstresponselatency/util.js +21 -8
  91. package/lib/esm/index.js +1 -0
  92. package/lib/esm/plugins/createChatTranscript.js +13 -0
  93. package/lib/esm/plugins/newMessageEventHandler.js +3 -3
  94. package/lib/types/common/Constants.d.ts +10 -2
  95. package/lib/types/common/telemetry/TelemetryConstants.d.ts +6 -0
  96. package/lib/types/common/utils.d.ts +8 -0
  97. package/lib/types/components/citationpanestateful/CitationDim.d.ts +5 -0
  98. package/lib/types/components/citationpanestateful/CitationPaneStateful.d.ts +4 -0
  99. package/lib/types/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.d.ts +11 -0
  100. package/lib/types/components/citationpanestateful/interfaces/ICitationPaneStatefulProps.d.ts +19 -0
  101. package/lib/types/components/confirmationpanestateful/common/defaultProps/defaultConfirmationPaneLocalizedTexts.d.ts +1 -1
  102. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.d.ts +1 -1
  103. package/lib/types/components/livechatwidget/common/customEventHandler.d.ts +4 -0
  104. package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +2 -1
  105. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
  106. package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +5 -3
  107. package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +4 -2
  108. package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +5 -0
  109. package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +8 -1
  110. package/lib/types/components/webchatcontainerstateful/common/utils/fontUtils.d.ts +10 -0
  111. package/lib/types/components/webchatcontainerstateful/interfaces/ICitation.d.ts +12 -0
  112. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware.d.ts +8 -0
  113. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +4 -0
  114. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware.d.ts +22 -0
  115. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +5 -0
  116. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +5 -0
  117. package/lib/types/contexts/common/CustomEventType.d.ts +6 -0
  118. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
  119. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +46 -45
  120. package/lib/types/firstresponselatency/FirstResponseLatencyTracker.d.ts +2 -2
  121. package/lib/types/firstresponselatency/util.d.ts +1 -0
  122. package/lib/types/index.d.ts +1 -0
  123. package/package.json +5 -4
  124. /package/lib/cjs/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
  125. /package/lib/esm/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
  126. /package/lib/types/components/confirmationpanestateful/interfaces/{IConfirmationPaneLocalizedText.d.ts → IConfirmationPaneLocalizedTexts.d.ts} +0 -0
@@ -1,6 +1,9 @@
1
1
  import { ConversationEndEntity, ParticipantType } from "../../../common/Constants";
2
2
  import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
3
  import { changeLanguageCodeFormatForWebChat, getConversationDetailsCall } from "../../../common/utils";
4
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
5
+ import { Constants } from "../../../common/Constants";
6
+ import { ConversationState } from "../../../contexts/common/ConversationState";
4
7
  import DOMPurify from "dompurify";
5
8
  import HyperlinkTextOverrideRenderer from "../../webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer";
6
9
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
@@ -12,32 +15,35 @@ import { createActivityMiddleware } from "../../webchatcontainerstateful/webchat
12
15
  import { createAttachmentMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware";
13
16
  import createAttachmentUploadValidatorMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware";
14
17
  import { createAvatarMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware";
18
+ import createCallActionMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware";
15
19
  import { createCardActionMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware";
20
+ import { createCitationsMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware";
16
21
  import createConversationEndMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware";
22
+ import createCustomEventMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware";
17
23
  import createDataMaskingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware";
18
24
  import { createMarkdown } from "./createMarkdown";
19
25
  import createMaxMessageSizeValidator from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator";
20
26
  import { createMessageSequenceIdOverrideMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware";
21
27
  import { createMessageTimeStampMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware";
28
+ import { createQueueOverflowMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware";
22
29
  import { createStore } from "botframework-webchat";
23
30
  import { createToastMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware";
24
31
  import { createWebChatTelemetry } from "../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger";
25
32
  import { defaultAttachmentProps } from "../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps";
26
33
  import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
27
34
  import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
35
+ import { executeReducer } from "../../../contexts/createReducer";
28
36
  import { getLocaleStringFromId } from "@microsoft/omnichannel-chat-sdk";
29
37
  import gifUploadMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware";
30
38
  import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware";
31
39
  import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
32
40
  import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
33
41
  import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
34
- import { Constants } from "../../../common/Constants";
35
- import { ConversationState } from "../../../contexts/common/ConversationState";
36
- import { executeReducer } from "../../../contexts/createReducer";
42
+ import { localizedStringsBotInitialsMiddleware, getOverriddenLocalizedStrings } from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware";
37
43
 
38
44
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
45
  export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) => {
40
- var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain13, _props$webChatContain14, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain15, _props$webChatContain16, _defaultWebChatContai, _props$webChatContain17, _props$webChatContain18, _props$webChatContain19, _props$webChatContain20, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain21, _props$webChatContain22, _defaultWebChatContai2, _props$webChatContain23, _props$webChatContain24, _defaultWebChatContai3, _props$webChatContain25, _props$webChatContain26;
46
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain13, _props$webChatContain14, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain15, _props$webChatContain16, _defaultWebChatContai, _props$webChatContain17, _props$webChatContain18, _props$webChatContain19, _props$webChatContain20, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain21, _props$webChatContain22, _defaultWebChatContai2, _props$webChatContain23, _props$webChatContain24, _defaultWebChatContai3, _props$webChatContain25, _props$webChatContain26, _props$webChatContain27, _props$webChatContain28;
41
47
  // Add a hook to make all links open a new window
42
48
  postDomPurifyActivities();
43
49
  const localizedTexts = {
@@ -112,7 +118,7 @@ export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endCh
112
118
  };
113
119
  webChatStore = createStore({},
114
120
  //initial state
115
- preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_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(addConversationalSurveyTagsCallback), createConversationEndMiddleware(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), createDataMaskingMiddleware((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), createMessageTimeStampMiddleware, createMessageSequenceIdOverrideMiddleware, gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware(honorsTargetInHTMLLinks), createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware,
121
+ preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_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), createCustomEventMiddleware(BroadcastService), createQueueOverflowMiddleware(state, dispatch), channelDataMiddleware(addConversationalSurveyTagsCallback), createConversationEndMiddleware(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), createDataMaskingMiddleware((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), createMessageTimeStampMiddleware, createMessageSequenceIdOverrideMiddleware, createCitationsMiddleware(state, dispatch), gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware(honorsTargetInHTMLLinks), createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, createCallActionMiddleware(), localizedStringsBotInitialsMiddleware(),
116
122
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
117
123
  ...(((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.storeMiddlewares) ?? []));
118
124
  WebChatStoreLoader.store = webChatStore;
@@ -166,7 +172,8 @@ export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endCh
166
172
  onTelemetry: createWebChatTelemetry(),
167
173
  cardActionMiddleware: createCardActionMiddleware(((_props$webChatContain25 = props.webChatContainerProps) === null || _props$webChatContain25 === void 0 ? void 0 : _props$webChatContain25.botMagicCode) || undefined),
168
174
  sendTypingIndicator: true,
169
- ...((_props$webChatContain26 = props.webChatContainerProps) === null || _props$webChatContain26 === void 0 ? void 0 : _props$webChatContain26.webChatProps)
175
+ overrideLocalizedStrings: getOverriddenLocalizedStrings((_props$webChatContain26 = props.webChatContainerProps) === null || _props$webChatContain26 === void 0 ? void 0 : (_props$webChatContain27 = _props$webChatContain26.webChatProps) === null || _props$webChatContain27 === void 0 ? void 0 : _props$webChatContain27.overrideLocalizedStrings),
176
+ ...((_props$webChatContain28 = props.webChatContainerProps) === null || _props$webChatContain28 === void 0 ? void 0 : _props$webChatContain28.webChatProps)
170
177
  };
171
178
  return webChatProps;
172
179
  };
@@ -1,6 +1,7 @@
1
1
  const overridePropsOnMockIfApplicable = props => {
2
2
  var _props$mock, _props$mock2;
3
3
  if (props !== null && props !== void 0 && (_props$mock = props.mock) !== null && _props$mock !== void 0 && _props$mock.type && (props === null || props === void 0 ? void 0 : (_props$mock2 = props.mock) === null || _props$mock2 === void 0 ? void 0 : _props$mock2.type.toLowerCase()) === "designer") {
4
+ var _props$mock3, _props$mock3$mockMess;
4
5
  if (!props.webChatContainerProps) {
5
6
  props.webChatContainerProps = {};
6
7
  }
@@ -16,7 +17,7 @@ const overridePropsOnMockIfApplicable = props => {
16
17
  props.webChatContainerProps = {
17
18
  ...props.webChatContainerProps,
18
19
  webChatProps: {
19
- disabled: true,
20
+ disabled: !(props !== null && props !== void 0 && (_props$mock3 = props.mock) !== null && _props$mock3 !== void 0 && (_props$mock3$mockMess = _props$mock3.mockMessages) !== null && _props$mock3$mockMess !== void 0 && _props$mock3$mockMess.length),
20
21
  ...props.webChatContainerProps.webChatProps,
21
22
  overrideLocalizedStrings: {
22
23
  TEXT_INPUT_PLACEHOLDER: "Send a message . . .",
@@ -6,6 +6,7 @@ import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostC
6
6
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
7
7
  import { addDelayInMs } from "../../../common/utils";
8
8
  import { getPostChatSurveyConfig } from "./liveChatConfigUtils";
9
+ import { executeReducer } from "../../../contexts/createReducer";
9
10
 
10
11
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
12
  let conversationDetails = undefined;
@@ -59,6 +60,13 @@ const renderSurvey = async (postChatContext, state, dispatch) => {
59
60
  // Function for embed mode postchat workflow which is essentially same for both customer and agent
60
61
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
61
62
  const embedModePostChatWorkflow = async (postChatContext, state, dispatch) => {
63
+ const inMemoryState = executeReducer(state, {
64
+ type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
65
+ payload: null
66
+ });
67
+ if (inMemoryState.appStates.conversationState === ConversationState.Closed) {
68
+ return;
69
+ }
62
70
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
63
71
  Event: TelemetryEvent.EmbedModePostChatWorkflowStarted
64
72
  });
@@ -79,6 +87,13 @@ const embedModePostChatWorkflow = async (postChatContext, state, dispatch) => {
79
87
  payload: ConversationState.PostchatLoading
80
88
  });
81
89
  await addDelayInMs(Constants.PostChatLoadingDurationInMs);
90
+ const inMemoryState = executeReducer(state, {
91
+ type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
92
+ payload: null
93
+ });
94
+ if (inMemoryState.appStates.conversationState === ConversationState.Closed) {
95
+ return;
96
+ }
82
97
  dispatch({
83
98
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
84
99
  payload: ConversationState.Postchat
@@ -97,6 +112,14 @@ const embedModePostChatWorkflow = async (postChatContext, state, dispatch) => {
97
112
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
98
113
  const initiatePostChat = async (props, conversationDetailsParam, state, dispatch, postchatContext) => {
99
114
  var _conversationDetails;
115
+ const inMemoryState = executeReducer(state, {
116
+ type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
117
+ payload: null
118
+ });
119
+ if (inMemoryState.appStates.conversationState === ConversationState.Closed) {
120
+ // If the conversation is closed, we need to reset the state
121
+ return;
122
+ }
100
123
  conversationDetails = conversationDetailsParam;
101
124
  const participantType = ((_conversationDetails = conversationDetails) === null || _conversationDetails === void 0 ? void 0 : _conversationDetails.participantType) ?? postchatContext.participantType;
102
125
  await setSurveyMode(props, participantType, state, dispatch);
@@ -1,5 +1,6 @@
1
1
  import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
2
2
  import { Constants, LiveWorkItemState, WidgetLoadTelemetryMessage } from "../../../common/Constants";
3
+ import { TelemetryManager, TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
3
4
  import { checkContactIdError, createTimer, getConversationDetailsCall, getStateFromCache, getWidgetCacheIdfromProps, isNullOrEmptyString, isNullOrUndefined, isUndefinedOrEmpty } from "../../../common/utils";
4
5
  import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "./reconnectChatHelper";
5
6
  import { handleStartChatError, logWidgetLoadComplete } from "./startChatErrorHandler";
@@ -8,7 +9,6 @@ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
8
9
  import { ConversationState } from "../../../contexts/common/ConversationState";
9
10
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
10
11
  import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
11
- import { TelemetryTimers } from "../../../common/telemetry/TelemetryManager";
12
12
  import { chatSDKStateCleanUp } from "./endChat";
13
13
  import { createAdapter } from "./createAdapter";
14
14
  import { createOnNewAdapterActivityHandler } from "../../../plugins/newMessageEventHandler";
@@ -99,7 +99,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
99
99
 
100
100
  // If minimized, maximize the chat, if the state is missing, consider it as minimized
101
101
  if ((state === null || state === void 0 ? void 0 : state.appStates.isMinimized) === undefined || (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.isMinimized) === true) {
102
- var _state$domainStates3, _state$domainStates3$, _state$domainStates4, _state$domainStates4$;
102
+ var _state$domainStates3, _state$domainStates3$, _state$domainStates4, _state$domainStates4$, _TelemetryManager$Int;
103
103
  dispatch({
104
104
  type: LiveChatWidgetActionType.SET_MINIMIZED,
105
105
  payload: false
@@ -110,7 +110,8 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
110
110
  eventName: BroadcastEvent.MaximizeChat,
111
111
  payload: {
112
112
  height: state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : (_state$domainStates3$ = _state$domainStates3.widgetSize) === null || _state$domainStates3$ === void 0 ? void 0 : _state$domainStates3$.height,
113
- width: state === null || state === void 0 ? void 0 : (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.widgetSize) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.width
113
+ width: state === null || state === void 0 ? void 0 : (_state$domainStates4 = state.domainStates) === null || _state$domainStates4 === void 0 ? void 0 : (_state$domainStates4$ = _state$domainStates4.widgetSize) === null || _state$domainStates4$ === void 0 ? void 0 : _state$domainStates4$.width,
114
+ runtimeId: TelemetryManager === null || TelemetryManager === void 0 ? void 0 : (_TelemetryManager$Int = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int === void 0 ? void 0 : _TelemetryManager$Int.lcwRuntimeId
114
115
  }
115
116
  });
116
117
  }
@@ -131,7 +132,7 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
131
132
  * This is because a new change to control OOH as closed event when a widget is coming from chat.
132
133
  */
133
134
  if ((state === null || state === void 0 ? void 0 : state.appStates.isMinimized) === undefined || (state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.isMinimized) === true) {
134
- var _state$domainStates5, _state$domainStates5$, _state$domainStates6, _state$domainStates6$;
135
+ var _state$domainStates5, _state$domainStates5$, _state$domainStates6, _state$domainStates6$, _TelemetryManager$Int2;
135
136
  dispatch({
136
137
  type: LiveChatWidgetActionType.SET_MINIMIZED,
137
138
  payload: false
@@ -141,14 +142,14 @@ const setPreChatAndInitiateChat = async (facadeChatSDK, dispatch, setAdapter, is
141
142
  eventName: BroadcastEvent.MaximizeChat,
142
143
  payload: {
143
144
  height: state === null || state === void 0 ? void 0 : (_state$domainStates5 = state.domainStates) === null || _state$domainStates5 === void 0 ? void 0 : (_state$domainStates5$ = _state$domainStates5.widgetSize) === null || _state$domainStates5$ === void 0 ? void 0 : _state$domainStates5$.height,
144
- width: state === null || state === void 0 ? void 0 : (_state$domainStates6 = state.domainStates) === null || _state$domainStates6 === void 0 ? void 0 : (_state$domainStates6$ = _state$domainStates6.widgetSize) === null || _state$domainStates6$ === void 0 ? void 0 : _state$domainStates6$.width
145
+ width: state === null || state === void 0 ? void 0 : (_state$domainStates6 = state.domainStates) === null || _state$domainStates6 === void 0 ? void 0 : (_state$domainStates6$ = _state$domainStates6.widgetSize) === null || _state$domainStates6$ === void 0 ? void 0 : _state$domainStates6$.width,
146
+ runtimeId: TelemetryManager === null || TelemetryManager === void 0 ? void 0 : (_TelemetryManager$Int2 = TelemetryManager.InternalTelemetryData) === null || _TelemetryManager$Int2 === void 0 ? void 0 : _TelemetryManager$Int2.lcwRuntimeId
145
147
  }
146
148
  });
147
149
  }
148
150
  const optionalParams = {
149
151
  isProactiveChat
150
152
  };
151
- createTrackingForFirstMessage();
152
153
  await initStartChat(facadeChatSDK, dispatch, setAdapter, state, props, optionalParams);
153
154
  };
154
155
 
@@ -199,6 +200,7 @@ const initStartChat = async (facadeChatSDK, dispatch, setAdapter, state, props,
199
200
  const startChatOptionalParams = Object.assign({}, params, optionalParams, defaultOptionalParams);
200
201
  // startTime is used to determine if a message is history or new, better to be set before creating the adapter to get bandwidth
201
202
  const startTime = new Date().getTime();
203
+ createTrackingForFirstMessage();
202
204
  await facadeChatSDK.startChat(startChatOptionalParams);
203
205
  isStartChatSuccessful = true;
204
206
  await createAdapterAndSubscribe(facadeChatSDK, dispatch, setAdapter, startTime, props);
@@ -1,6 +1,6 @@
1
- var LiveChatWidgetMockType;
1
+ export let LiveChatWidgetMockType;
2
2
  (function (LiveChatWidgetMockType) {
3
3
  LiveChatWidgetMockType["Test"] = "Test";
4
4
  LiveChatWidgetMockType["Demo"] = "Demo";
5
- })(LiveChatWidgetMockType || (LiveChatWidgetMockType = {}));
6
- export {};
5
+ LiveChatWidgetMockType["Designer"] = "Designer";
6
+ })(LiveChatWidgetMockType || (LiveChatWidgetMockType = {}));
@@ -9,6 +9,7 @@ import { TelemetryManager, TelemetryTimers } from "../../../common/telemetry/Tel
9
9
  import { chatSDKStateCleanUp, endChat, endChatStateCleanUp, prepareEndChat } from "../common/endChat";
10
10
  import { checkIfConversationStillValid, initStartChat, prepareStartChat, setPreChatAndInitiateChat } from "../common/startChat";
11
11
  import { createTimer, getBroadcastChannelName, getConversationDetailsCall, getLocaleDirection, getStateFromCache, getWidgetCacheIdfromProps, getWidgetEndChatEventName, isNullOrEmptyString, isNullOrUndefined, isThisSessionPopout, isUndefinedOrEmpty, setOcUserAgent } from "../../../common/utils";
12
+ import { customEventCallback, subscribeToSendCustomEvent } from "../common/customEventHandler";
12
13
  import { defaultClientDataStoreProvider, isCookieAllowed } from "../../../common/storage/default/defaultClientDataStoreProvider";
13
14
  import { handleChatReconnect, isPersistentEnabled, isReconnectEnabled } from "../common/reconnectChatHelper";
14
15
  import { shouldShowCallingContainer, shouldShowChatButton, shouldShowConfirmationPane, shouldShowEmailTranscriptPane, shouldShowHeader, shouldShowLoadingPane, shouldShowOutOfOfficeHoursPane, shouldShowPostChatLoadingPane, shouldShowPostChatSurveyPane, shouldShowPreChatSurveyPane, shouldShowProactiveChatPane, shouldShowReconnectChatPane, shouldShowStartChatErrorPane, shouldShowWebChatContainer } from "../../../controller/componentController";
@@ -413,7 +414,7 @@ export const LiveChatWidgetStateful = props => {
413
414
  BroadcastService.getMessageByEventName(BroadcastEvent.StartChat).subscribe(msg => {
414
415
  var _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4;
415
416
  // If chat is out of operating hours chat widget sets the conversation state to OutOfOffice.
416
- if (state.appStates.outsideOperatingHours === true) {
417
+ if (state.appStates.outsideOperatingHours && state.appStates.conversationState !== ConversationState.Active) {
417
418
  dispatch({
418
419
  type: LiveChatWidgetActionType.SET_MINIMIZED,
419
420
  payload: false
@@ -479,7 +480,8 @@ export const LiveChatWidgetStateful = props => {
479
480
  eventName: BroadcastEvent.MaximizeChat,
480
481
  payload: {
481
482
  height: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain = inMemoryState.domainStates) === null || _inMemoryState$domain === void 0 ? void 0 : (_inMemoryState$domain2 = _inMemoryState$domain.widgetSize) === null || _inMemoryState$domain2 === void 0 ? void 0 : _inMemoryState$domain2.height,
482
- width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width
483
+ width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width,
484
+ lcwRuntimeId: TelemetryManager.InternalTelemetryData.lcwRuntimeId
483
485
  }
484
486
  });
485
487
  return;
@@ -580,6 +582,9 @@ export const LiveChatWidgetStateful = props => {
580
582
  }
581
583
  });
582
584
 
585
+ // subscribe custom event
586
+ subscribeToSendCustomEvent(BroadcastService, facadeChatSDK, customEventCallback);
587
+
583
588
  // Check for TPC and log in telemetry if blocked
584
589
  isCookieAllowed();
585
590
  return () => {
@@ -715,11 +720,7 @@ export const LiveChatWidgetStateful = props => {
715
720
  endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
716
721
  return;
717
722
  }
718
- const inMemoryState = executeReducer(state, {
719
- type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
720
- payload: null
721
- });
722
- let isConversationalSurveyEnabled = state.appStates.isConversationalSurveyEnabled;
723
+ const isConversationalSurveyEnabled = state.appStates.isConversationalSurveyEnabled;
723
724
 
724
725
  // In conversational survey, we need to check post chat survey logics before we set ConversationState to InActive
725
726
  // Hence setting ConversationState to InActive will be done later in the post chat flows
@@ -868,23 +869,46 @@ export const LiveChatWidgetStateful = props => {
868
869
 
869
870
  // WebChat's Composer can only be rendered if a directLine object is defined
870
871
  return directLine && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
871
- ::-webkit-scrollbar {
872
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar {
872
873
  width: ${scrollbarProps.width};
873
874
  }
874
875
 
875
- ::-webkit-scrollbar-track {
876
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
876
877
  background: ${scrollbarProps.trackBackgroundColor};
877
878
  }
878
879
 
879
- ::-webkit-scrollbar-thumb {
880
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
880
881
  background: ${scrollbarProps.thumbBackgroundColor};
881
882
  border-radius: ${scrollbarProps.thumbBorderRadius};
882
883
  }
883
884
 
884
- ::-webkit-scrollbar-thumb:hover {
885
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
885
886
  background: ${scrollbarProps.thumbHoverColor};
886
887
  }
887
888
 
889
+ /* High Contrast mode support - optimized for all variants */
890
+ @media (prefers-contrast: high), (-ms-high-contrast: active), (forced-colors: active) {
891
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
892
+ background: Canvas !important;
893
+ border: 1px solid CanvasText !important;
894
+ }
895
+
896
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
897
+ background: CanvasText !important;
898
+ border: 1px solid Canvas !important;
899
+ min-height: 20px !important;
900
+ }
901
+
902
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
903
+ background: Highlight !important;
904
+ border: 1px solid CanvasText !important;
905
+ }
906
+
907
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-corner {
908
+ background: Canvas !important;
909
+ }
910
+ }
911
+
888
912
  .webchat__basic-transcript__activity-markdown-body > :last-child {
889
913
  margin-bottom: 0px;
890
914
  }
@@ -892,11 +916,21 @@ export const LiveChatWidgetStateful = props => {
892
916
  .webchat__basic-transcript__activity-markdown-body > :first-child {
893
917
  margin-top: 0px;
894
918
  }
919
+
895
920
  .webchat__basic-transcript__activity-markdown-body img.webchat__render-markdown__external-link-icon {
896
921
  background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjMjEyMTIxIiAvPjwvc3ZnPg==) !important;
897
922
  height: .75em;
898
923
  margin-left: .25em;
899
924
  }
925
+
926
+ .webchat__link-definitions__header-text {
927
+ color: ${bubbleBackground}
928
+ }
929
+
930
+ .webchat__link-definitions__header-chevron {
931
+ color: ${bubbleBackground}
932
+ }
933
+
900
934
  ${(sendBoxTextArea === null || sendBoxTextArea === void 0 ? void 0 : sendBoxTextArea.minHeight) && `
901
935
  .webchat__auto-resize-textarea.webchat__send-box-text-box__text-area {
902
936
  min-height: ${sendBoxTextArea === null || sendBoxTextArea === void 0 ? void 0 : sendBoxTextArea.minHeight} !important;
@@ -1,11 +1,10 @@
1
- /* eslint-disable @typescript-eslint/no-explicit-any */
2
-
3
1
  import { Constants, HtmlAttributeNames, HtmlClassNames } from "../../common/Constants";
4
2
  import { Stack } from "@fluentui/react";
5
3
  import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
6
- import React, { useEffect } from "react";
4
+ import React, { useEffect, useRef, useState } from "react";
7
5
  import { createTimer, getDeviceType, setFocusOnSendBox } from "../../common/utils";
8
6
  import { BotMagicCodeStore } from "./webchatcontroller/BotMagicCodeStore";
7
+ import CitationPaneStateful from "../citationpanestateful/CitationPaneStateful";
9
8
  import { Components } from "botframework-webchat";
10
9
  import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
11
10
  import { NotificationHandler } from "./webchatcontroller/notification/NotificationHandler";
@@ -13,6 +12,7 @@ import { NotificationScenarios } from "./webchatcontroller/enums/NotificationSce
13
12
  import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
14
13
  import { WebChatActionType } from "./webchatcontroller/enums/WebChatActionType";
15
14
  import { WebChatStoreLoader } from "./webchatcontroller/WebChatStoreLoader";
15
+ import { createIOSOptimizedEmojiFont } from "./common/utils/fontUtils";
16
16
  import { defaultAdaptiveCardStyles } from "./common/defaultStyles/defaultAdaptiveCardStyles";
17
17
  import { defaultMiddlewareLocalizedTexts } from "./common/defaultProps/defaultMiddlewareLocalizedTexts";
18
18
  import { defaultReceivedMessageAnchorStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles";
@@ -23,6 +23,7 @@ import { defaultWebChatContainerStatefulProps } from "./common/defaultProps/defa
23
23
  import { useChatContextStore } from "../..";
24
24
  let uiTimer;
25
25
  const broadcastChannelMessageEvent = "message";
26
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
26
27
  const postActivity = activity => {
27
28
  // eslint-disable-line @typescript-eslint/no-explicit-any
28
29
  return {
@@ -48,13 +49,30 @@ const createMagicCodeSuccessResponse = signin => {
48
49
  };
49
50
  };
50
51
  export const WebChatContainerStateful = props => {
51
- var _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _props$webChatContain5, _props$webChatContain6, _defaultWebChatContai, _props$webChatContain7, _props$webChatContain8, _defaultWebChatContai2, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _props$webChatContain9, _props$webChatContain10;
52
+ var _props$webChatContain, _defaultWebChatContai, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _props$webChatContain6, _props$webChatContain7, _defaultWebChatContai2, _props$webChatContain8, _props$webChatContain9, _defaultWebChatContai3, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _props$webChatContain10, _props$webChatContain11, _webChatContainerProp24, _webChatContainerProp25, _webChatContainerProp26, _webChatContainerProp27, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
53
+ // Create a font family that includes emoji support, based on the primary font or default
54
+ const webChatStyles = ((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles) ?? defaultWebChatContainerStatefulProps.webChatStyles;
55
+ const primaryFont = (webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.primaryFont) ?? ((_defaultWebChatContai = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.primaryFont);
56
+
57
+ // Use iOS-optimized emoji font that prioritizes system-ui for proper emoji rendering
58
+ const fontFamilyWithEmojis = createIOSOptimizedEmojiFont(primaryFont);
52
59
  useEffect(() => {
53
60
  uiTimer = createTimer();
54
61
  TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
55
62
  Event: TelemetryEvent.UXWebchatContainerCompleted
56
63
  });
57
64
  }, []);
65
+
66
+ // Citation pane state
67
+ const [citationPaneOpen, setCitationPaneOpen] = useState(false);
68
+ const [citationPaneText, setCitationPaneText] = useState("");
69
+
70
+ // Guard to prevent handling multiple rapid clicks which could cause
71
+ // the dim layer and pane to re-render out of sync and create a flicker.
72
+ const citationOpeningRef = useRef(false);
73
+
74
+ // ...existing code...
75
+
58
76
  const {
59
77
  BasicWebChat
60
78
  } = Components;
@@ -63,6 +81,53 @@ export const WebChatContainerStateful = props => {
63
81
  webChatContainerProps,
64
82
  contextDataStore
65
83
  } = props;
84
+
85
+ // Delegated click handler for citation anchors. Placed after state is
86
+ // available so we can prefer reading citations from app state and fall
87
+ // back to the legacy window map for backward-compatibility in tests.
88
+ useEffect(() => {
89
+ const clickHandler = ev => {
90
+ try {
91
+ if (citationOpeningRef.current) {
92
+ return;
93
+ }
94
+ const target = ev.target;
95
+ // Only consider anchors whose href starts with the citation scheme
96
+ const anchor = target.closest && target.closest("a[href^=\"cite:\"]");
97
+ if (anchor) {
98
+ ev.preventDefault();
99
+ citationOpeningRef.current = true;
100
+ // Rely only on the href to identify the citation key
101
+ let text = "";
102
+ try {
103
+ var _state$domainStates;
104
+ const cid = anchor.getAttribute("href");
105
+ // Prefer state-based citations injected by middleware
106
+ if (state !== null && state !== void 0 && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.citations && cid) {
107
+ text = state.domainStates.citations[cid] ?? "";
108
+ }
109
+ // If state lookup failed, fall back to the anchor's title or innerText
110
+ if (!text) {
111
+ text = anchor.getAttribute("title") || anchor.innerText || "";
112
+ }
113
+ } catch (e) {
114
+ // ignore
115
+ }
116
+ setCitationPaneOpen(true);
117
+ setCitationPaneText(text);
118
+
119
+ // Simple debounce - reset guard after a short delay
120
+ setTimeout(() => {
121
+ citationOpeningRef.current = false;
122
+ }, 100);
123
+ }
124
+ } catch (e) {
125
+ citationOpeningRef.current = false;
126
+ }
127
+ };
128
+ document.addEventListener("click", clickHandler);
129
+ return () => document.removeEventListener("click", clickHandler);
130
+ }, [state]);
66
131
  const containerStyles = {
67
132
  root: Object.assign({}, defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, {
68
133
  display: state.appStates.isMinimized ? "none" : ""
@@ -74,7 +139,7 @@ export const WebChatContainerStateful = props => {
74
139
  ...(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts)
75
140
  };
76
141
  useEffect(() => {
77
- var _props$webChatContain, _props$webChatContain2;
142
+ var _props$webChatContain2, _props$webChatContain3;
78
143
  if (getDeviceType() !== "standard" && (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatHistoryMobileAccessibilityLabel) !== undefined) {
79
144
  const chatHistoryElement = document.querySelector(`.${HtmlClassNames.webChatHistoryContainer}`);
80
145
  if (chatHistoryElement) {
@@ -92,21 +157,23 @@ export const WebChatContainerStateful = props => {
92
157
  TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
93
158
  Event: TelemetryEvent.WebChatLoaded
94
159
  });
95
- if (((_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.disableThirdPartyCookiesAlert) !== true && !contextDataStore) {
160
+ if (((_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : (_props$webChatContain3 = _props$webChatContain2.renderingMiddlewareProps) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.disableThirdPartyCookiesAlert) !== true && !contextDataStore) {
96
161
  try {
97
162
  localStorage;
98
163
  sessionStorage;
99
164
  } catch (error) {
165
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
100
166
  if (!window.TPCWarningShown) {
101
167
  NotificationHandler.notifyWarning(NotificationScenarios.TPC, (localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE) ?? "");
168
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
102
169
  window.TPCWarningShown = true;
103
170
  }
104
171
  }
105
172
  }
106
173
  }, []);
107
174
  useEffect(() => {
108
- var _props$webChatContain3, _props$webChatContain4;
109
- if (!((_props$webChatContain3 = props.webChatContainerProps) !== null && _props$webChatContain3 !== void 0 && (_props$webChatContain4 = _props$webChatContain3.botMagicCode) !== null && _props$webChatContain4 !== void 0 && _props$webChatContain4.disabled)) {
175
+ var _props$webChatContain4, _props$webChatContain5;
176
+ if (!((_props$webChatContain4 = props.webChatContainerProps) !== null && _props$webChatContain4 !== void 0 && (_props$webChatContain5 = _props$webChatContain4.botMagicCode) !== null && _props$webChatContain5 !== void 0 && _props$webChatContain5.disabled)) {
110
177
  return;
111
178
  }
112
179
  if (!window.BroadcastChannel) {
@@ -178,7 +245,7 @@ export const WebChatContainerStateful = props => {
178
245
  }
179
246
 
180
247
  .webchat__bubble__content>div#ms_lcw_webchat_adaptive_card .ac-textBlock {
181
- color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? defaultAdaptiveCardStyles.color} !important;
248
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? defaultAdaptiveCardStyles.color};
182
249
  }
183
250
 
184
251
  .webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__bubble--from-user {
@@ -198,8 +265,8 @@ export const WebChatContainerStateful = props => {
198
265
  }
199
266
 
200
267
  .ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
201
- background-color: ${((_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 ? void 0 : (_props$webChatContain6 = _props$webChatContain5.webChatStyles) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.bubbleBackground) ?? ((_defaultWebChatContai = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.bubbleBackground)};
202
- color:${((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : (_props$webChatContain8 = _props$webChatContain7.webChatStyles) === null || _props$webChatContain8 === void 0 ? void 0 : _props$webChatContain8.bubbleTextColor) ?? ((_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleTextColor)};
268
+ background-color: ${((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : (_props$webChatContain7 = _props$webChatContain6.webChatStyles) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.bubbleBackground) ?? ((_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleBackground)};
269
+ color:${((_props$webChatContain8 = props.webChatContainerProps) === null || _props$webChatContain8 === void 0 ? void 0 : (_props$webChatContain9 = _props$webChatContain8.webChatStyles) === null || _props$webChatContain9 === void 0 ? void 0 : _props$webChatContain9.bubbleTextColor) ?? ((_defaultWebChatContai3 = defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.bubbleTextColor)};
203
270
  }
204
271
 
205
272
  div[class="ac-textBlock"] a:link,
@@ -277,7 +344,7 @@ export const WebChatContainerStateful = props => {
277
344
  }
278
345
 
279
346
  .webchat__stacked-layout_container>div {
280
- background: ${(props === null || props === void 0 ? void 0 : (_props$webChatContain9 = props.webChatContainerProps) === null || _props$webChatContain9 === void 0 ? void 0 : (_props$webChatContain10 = _props$webChatContain9.containerStyles) === null || _props$webChatContain10 === void 0 ? void 0 : _props$webChatContain10.background) ?? ""}
347
+ background: ${(props === null || props === void 0 ? void 0 : (_props$webChatContain10 = props.webChatContainerProps) === null || _props$webChatContain10 === void 0 ? void 0 : (_props$webChatContain11 = _props$webChatContain10.containerStyles) === null || _props$webChatContain11 === void 0 ? void 0 : _props$webChatContain11.background) ?? ""}
281
348
  }
282
349
  .webchat__toast_text {
283
350
  display: flex;
@@ -287,10 +354,43 @@ export const WebChatContainerStateful = props => {
287
354
  overflow-y: unset;
288
355
  }
289
356
 
290
-
357
+ /* Custom styles for carousel hero cards */
358
+ ul.webchat__carousel-filmstrip__attachments .ac-image {
359
+ width: 200px !important;
360
+ height: 150px !important;
361
+ object-fit: cover !important;
362
+ border-radius: 8px !important;
363
+ border: 1px solid #e0e0e0 !important;
364
+ }
365
+
366
+ .webchat__carousel-filmstrip-attachment .webchat__bubble {
367
+ height: 100% !important;
368
+ }
369
+
370
+ .webchat__carousel-filmstrip-attachment .webchat__bubble #ms_lcw_webchat_adaptive_card {
371
+ height: 100% !important;
372
+ }
373
+
374
+ .webchat__auto-resize-textarea__textarea.webchat__send-box-text-box__html-text-area {
375
+ font-family: ${fontFamilyWithEmojis} !important;
376
+ }
377
+
378
+ /* Suggested actions carousel previous/next navigation focus */
379
+ .webchat__suggested-actions .webchat__suggested-actions__carousel .react-film__flipper:focus-visible .react-film__flipper__body {
380
+ outline: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp24 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp24 === void 0 ? void 0 : _webChatContainerProp24.suggestedActionKeyboardFocusIndicatorBorderStyle) ?? "dashed"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp25 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp25 === void 0 ? void 0 : _webChatContainerProp25.suggestedActionKeyboardFocusIndicatorBorderWidth) ?? "1px"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp26 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp26 === void 0 ? void 0 : _webChatContainerProp26.suggestedActionKeyboardFocusIndicatorBorderColor) ?? "#605E5C"} !important;
381
+ outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp27 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp27 === void 0 ? void 0 : _webChatContainerProp27.suggestedActionKeyboardFocusIndicatorInset) ?? "2px"} !important;
382
+
291
383
  `), /*#__PURE__*/React.createElement(Stack, {
292
384
  styles: containerStyles,
293
385
  className: "webchat__stacked-layout_container"
294
- }, /*#__PURE__*/React.createElement(BasicWebChat, null)));
386
+ }, /*#__PURE__*/React.createElement(BasicWebChat, null)), citationPaneOpen && /*#__PURE__*/React.createElement(CitationPaneStateful, {
387
+ id: ((_props$citationPanePr = props.citationPaneProps) === null || _props$citationPanePr === void 0 ? void 0 : _props$citationPanePr.id) || HtmlAttributeNames.ocwCitationPaneClassName,
388
+ title: ((_props$citationPanePr2 = props.citationPaneProps) === null || _props$citationPanePr2 === void 0 ? void 0 : _props$citationPanePr2.title) || HtmlAttributeNames.ocwCitationPaneTitle,
389
+ contentHtml: citationPaneText,
390
+ onClose: () => setCitationPaneOpen(false),
391
+ componentOverrides: (_props$citationPanePr3 = props.citationPaneProps) === null || _props$citationPanePr3 === void 0 ? void 0 : _props$citationPanePr3.componentOverrides,
392
+ controlProps: (_props$citationPanePr4 = props.citationPaneProps) === null || _props$citationPanePr4 === void 0 ? void 0 : _props$citationPanePr4.controlProps,
393
+ styleProps: (_props$citationPanePr5 = props.citationPaneProps) === null || _props$citationPanePr5 === void 0 ? void 0 : _props$citationPanePr5.styleProps
394
+ }));
295
395
  };
296
396
  export default WebChatContainerStateful;