@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
@@ -14,6 +14,7 @@ var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
14
14
  var _endChat = require("../common/endChat");
15
15
  var _startChat = require("../common/startChat");
16
16
  var _utils = require("../../../common/utils");
17
+ var _customEventHandler = require("../common/customEventHandler");
17
18
  var _defaultClientDataStoreProvider = require("../../../common/storage/default/defaultClientDataStoreProvider");
18
19
  var _reconnectChatHelper = require("../common/reconnectChatHelper");
19
20
  var _componentController = require("../../../controller/componentController");
@@ -421,7 +422,7 @@ const LiveChatWidgetStateful = props => {
421
422
  _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartChat).subscribe(msg => {
422
423
  var _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4;
423
424
  // If chat is out of operating hours chat widget sets the conversation state to OutOfOffice.
424
- if (state.appStates.outsideOperatingHours === true) {
425
+ if (state.appStates.outsideOperatingHours && state.appStates.conversationState !== _ConversationState.ConversationState.Active) {
425
426
  dispatch({
426
427
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_MINIMIZED,
427
428
  payload: false
@@ -487,7 +488,8 @@ const LiveChatWidgetStateful = props => {
487
488
  eventName: _TelemetryConstants.BroadcastEvent.MaximizeChat,
488
489
  payload: {
489
490
  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,
490
- 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
491
+ 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,
492
+ lcwRuntimeId: _TelemetryManager.TelemetryManager.InternalTelemetryData.lcwRuntimeId
491
493
  }
492
494
  });
493
495
  return;
@@ -588,6 +590,9 @@ const LiveChatWidgetStateful = props => {
588
590
  }
589
591
  });
590
592
 
593
+ // subscribe custom event
594
+ (0, _customEventHandler.subscribeToSendCustomEvent)(_omnichannelChatComponents.BroadcastService, facadeChatSDK, _customEventHandler.customEventCallback);
595
+
591
596
  // Check for TPC and log in telemetry if blocked
592
597
  (0, _defaultClientDataStoreProvider.isCookieAllowed)();
593
598
  return () => {
@@ -723,11 +728,7 @@ const LiveChatWidgetStateful = props => {
723
728
  (0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
724
729
  return;
725
730
  }
726
- const inMemoryState = (0, _createReducer.executeReducer)(state, {
727
- type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
728
- payload: null
729
- });
730
- let isConversationalSurveyEnabled = state.appStates.isConversationalSurveyEnabled;
731
+ const isConversationalSurveyEnabled = state.appStates.isConversationalSurveyEnabled;
731
732
 
732
733
  // In conversational survey, we need to check post chat survey logics before we set ConversationState to InActive
733
734
  // Hence setting ConversationState to InActive will be done later in the post chat flows
@@ -876,23 +877,46 @@ const LiveChatWidgetStateful = props => {
876
877
 
877
878
  // WebChat's Composer can only be rendered if a directLine object is defined
878
879
  return directLine && /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement("style", null, `
879
- ::-webkit-scrollbar {
880
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar {
880
881
  width: ${scrollbarProps.width};
881
882
  }
882
883
 
883
- ::-webkit-scrollbar-track {
884
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
884
885
  background: ${scrollbarProps.trackBackgroundColor};
885
886
  }
886
887
 
887
- ::-webkit-scrollbar-thumb {
888
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
888
889
  background: ${scrollbarProps.thumbBackgroundColor};
889
890
  border-radius: ${scrollbarProps.thumbBorderRadius};
890
891
  }
891
892
 
892
- ::-webkit-scrollbar-thumb:hover {
893
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
893
894
  background: ${scrollbarProps.thumbHoverColor};
894
895
  }
895
896
 
897
+ /* High Contrast mode support - optimized for all variants */
898
+ @media (prefers-contrast: high), (-ms-high-contrast: active), (forced-colors: active) {
899
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
900
+ background: Canvas !important;
901
+ border: 1px solid CanvasText !important;
902
+ }
903
+
904
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
905
+ background: CanvasText !important;
906
+ border: 1px solid Canvas !important;
907
+ min-height: 20px !important;
908
+ }
909
+
910
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
911
+ background: Highlight !important;
912
+ border: 1px solid CanvasText !important;
913
+ }
914
+
915
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-corner {
916
+ background: Canvas !important;
917
+ }
918
+ }
919
+
896
920
  .webchat__basic-transcript__activity-markdown-body > :last-child {
897
921
  margin-bottom: 0px;
898
922
  }
@@ -900,11 +924,21 @@ const LiveChatWidgetStateful = props => {
900
924
  .webchat__basic-transcript__activity-markdown-body > :first-child {
901
925
  margin-top: 0px;
902
926
  }
927
+
903
928
  .webchat__basic-transcript__activity-markdown-body img.webchat__render-markdown__external-link-icon {
904
929
  background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjMjEyMTIxIiAvPjwvc3ZnPg==) !important;
905
930
  height: .75em;
906
931
  margin-left: .25em;
907
932
  }
933
+
934
+ .webchat__link-definitions__header-text {
935
+ color: ${bubbleBackground}
936
+ }
937
+
938
+ .webchat__link-definitions__header-chevron {
939
+ color: ${bubbleBackground}
940
+ }
941
+
908
942
  ${(sendBoxTextArea === null || sendBoxTextArea === void 0 ? void 0 : sendBoxTextArea.minHeight) && `
909
943
  .webchat__auto-resize-textarea.webchat__send-box-text-box__text-area {
910
944
  min-height: ${sendBoxTextArea === null || sendBoxTextArea === void 0 ? void 0 : sendBoxTextArea.minHeight} !important;
@@ -10,6 +10,7 @@ var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
10
10
  var _react2 = _interopRequireWildcard(require("react"));
11
11
  var _utils = require("../../common/utils");
12
12
  var _BotMagicCodeStore = require("./webchatcontroller/BotMagicCodeStore");
13
+ var _CitationPaneStateful = _interopRequireDefault(require("../citationpanestateful/CitationPaneStateful"));
13
14
  var _botframeworkWebchat = require("botframework-webchat");
14
15
  var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
15
16
  var _NotificationHandler = require("./webchatcontroller/notification/NotificationHandler");
@@ -17,6 +18,7 @@ var _NotificationScenarios = require("./webchatcontroller/enums/NotificationScen
17
18
  var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
18
19
  var _WebChatActionType = require("./webchatcontroller/enums/WebChatActionType");
19
20
  var _WebChatStoreLoader = require("./webchatcontroller/WebChatStoreLoader");
21
+ var _fontUtils = require("./common/utils/fontUtils");
20
22
  var _defaultAdaptiveCardStyles = require("./common/defaultStyles/defaultAdaptiveCardStyles");
21
23
  var _defaultMiddlewareLocalizedTexts = require("./common/defaultProps/defaultMiddlewareLocalizedTexts");
22
24
  var _defaultReceivedMessageAnchorStyles = require("./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultReceivedMessageAnchorStyles");
@@ -25,12 +27,12 @@ var _defaultSystemMessageBoxStyles = require("./webchatcontroller/middlewares/re
25
27
  var _defaultUserMessageBoxStyles = require("./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles");
26
28
  var _defaultWebChatContainerStatefulProps = require("./common/defaultProps/defaultWebChatContainerStatefulProps");
27
29
  var _ = require("../..");
30
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
28
31
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
30
- /* eslint-disable @typescript-eslint/no-explicit-any */
31
-
32
33
  let uiTimer;
33
34
  const broadcastChannelMessageEvent = "message";
35
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
34
36
  const postActivity = activity => {
35
37
  // eslint-disable-line @typescript-eslint/no-explicit-any
36
38
  return {
@@ -56,13 +58,30 @@ const createMagicCodeSuccessResponse = signin => {
56
58
  };
57
59
  };
58
60
  const WebChatContainerStateful = props => {
59
- 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;
61
+ 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;
62
+ // Create a font family that includes emoji support, based on the primary font or default
63
+ const webChatStyles = ((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.webChatStyles) ?? _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles;
64
+ const primaryFont = (webChatStyles === null || webChatStyles === void 0 ? void 0 : webChatStyles.primaryFont) ?? ((_defaultWebChatContai = _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.primaryFont);
65
+
66
+ // Use iOS-optimized emoji font that prioritizes system-ui for proper emoji rendering
67
+ const fontFamilyWithEmojis = (0, _fontUtils.createIOSOptimizedEmojiFont)(primaryFont);
60
68
  (0, _react2.useEffect)(() => {
61
69
  uiTimer = (0, _utils.createTimer)();
62
70
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
63
71
  Event: _TelemetryConstants.TelemetryEvent.UXWebchatContainerCompleted
64
72
  });
65
73
  }, []);
74
+
75
+ // Citation pane state
76
+ const [citationPaneOpen, setCitationPaneOpen] = (0, _react2.useState)(false);
77
+ const [citationPaneText, setCitationPaneText] = (0, _react2.useState)("");
78
+
79
+ // Guard to prevent handling multiple rapid clicks which could cause
80
+ // the dim layer and pane to re-render out of sync and create a flicker.
81
+ const citationOpeningRef = (0, _react2.useRef)(false);
82
+
83
+ // ...existing code...
84
+
66
85
  const {
67
86
  BasicWebChat
68
87
  } = _botframeworkWebchat.Components;
@@ -71,6 +90,53 @@ const WebChatContainerStateful = props => {
71
90
  webChatContainerProps,
72
91
  contextDataStore
73
92
  } = props;
93
+
94
+ // Delegated click handler for citation anchors. Placed after state is
95
+ // available so we can prefer reading citations from app state and fall
96
+ // back to the legacy window map for backward-compatibility in tests.
97
+ (0, _react2.useEffect)(() => {
98
+ const clickHandler = ev => {
99
+ try {
100
+ if (citationOpeningRef.current) {
101
+ return;
102
+ }
103
+ const target = ev.target;
104
+ // Only consider anchors whose href starts with the citation scheme
105
+ const anchor = target.closest && target.closest("a[href^=\"cite:\"]");
106
+ if (anchor) {
107
+ ev.preventDefault();
108
+ citationOpeningRef.current = true;
109
+ // Rely only on the href to identify the citation key
110
+ let text = "";
111
+ try {
112
+ var _state$domainStates;
113
+ const cid = anchor.getAttribute("href");
114
+ // Prefer state-based citations injected by middleware
115
+ if (state !== null && state !== void 0 && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.citations && cid) {
116
+ text = state.domainStates.citations[cid] ?? "";
117
+ }
118
+ // If state lookup failed, fall back to the anchor's title or innerText
119
+ if (!text) {
120
+ text = anchor.getAttribute("title") || anchor.innerText || "";
121
+ }
122
+ } catch (e) {
123
+ // ignore
124
+ }
125
+ setCitationPaneOpen(true);
126
+ setCitationPaneText(text);
127
+
128
+ // Simple debounce - reset guard after a short delay
129
+ setTimeout(() => {
130
+ citationOpeningRef.current = false;
131
+ }, 100);
132
+ }
133
+ } catch (e) {
134
+ citationOpeningRef.current = false;
135
+ }
136
+ };
137
+ document.addEventListener("click", clickHandler);
138
+ return () => document.removeEventListener("click", clickHandler);
139
+ }, [state]);
74
140
  const containerStyles = {
75
141
  root: Object.assign({}, _defaultWebChatContainerStatefulProps.defaultWebChatContainerStatefulProps.containerStyles, webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.containerStyles, {
76
142
  display: state.appStates.isMinimized ? "none" : ""
@@ -82,7 +148,7 @@ const WebChatContainerStateful = props => {
82
148
  ...(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.localizedTexts)
83
149
  };
84
150
  (0, _react2.useEffect)(() => {
85
- var _props$webChatContain, _props$webChatContain2;
151
+ var _props$webChatContain2, _props$webChatContain3;
86
152
  if ((0, _utils.getDeviceType)() !== "standard" && (webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : webChatContainerProps.webChatHistoryMobileAccessibilityLabel) !== undefined) {
87
153
  const chatHistoryElement = document.querySelector(`.${_Constants.HtmlClassNames.webChatHistoryContainer}`);
88
154
  if (chatHistoryElement) {
@@ -100,21 +166,23 @@ const WebChatContainerStateful = props => {
100
166
  _TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
101
167
  Event: _TelemetryConstants.TelemetryEvent.WebChatLoaded
102
168
  });
103
- 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) {
169
+ 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) {
104
170
  try {
105
171
  localStorage;
106
172
  sessionStorage;
107
173
  } catch (error) {
174
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
108
175
  if (!window.TPCWarningShown) {
109
176
  _NotificationHandler.NotificationHandler.notifyWarning(_NotificationScenarios.NotificationScenarios.TPC, (localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE) ?? "");
177
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
110
178
  window.TPCWarningShown = true;
111
179
  }
112
180
  }
113
181
  }
114
182
  }, []);
115
183
  (0, _react2.useEffect)(() => {
116
- var _props$webChatContain3, _props$webChatContain4;
117
- if (!((_props$webChatContain3 = props.webChatContainerProps) !== null && _props$webChatContain3 !== void 0 && (_props$webChatContain4 = _props$webChatContain3.botMagicCode) !== null && _props$webChatContain4 !== void 0 && _props$webChatContain4.disabled)) {
184
+ var _props$webChatContain4, _props$webChatContain5;
185
+ if (!((_props$webChatContain4 = props.webChatContainerProps) !== null && _props$webChatContain4 !== void 0 && (_props$webChatContain5 = _props$webChatContain4.botMagicCode) !== null && _props$webChatContain5 !== void 0 && _props$webChatContain5.disabled)) {
118
186
  return;
119
187
  }
120
188
  if (!window.BroadcastChannel) {
@@ -186,7 +254,7 @@ const WebChatContainerStateful = props => {
186
254
  }
187
255
 
188
256
  .webchat__bubble__content>div#ms_lcw_webchat_adaptive_card .ac-textBlock {
189
- color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color} !important;
257
+ color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? _defaultAdaptiveCardStyles.defaultAdaptiveCardStyles.color};
190
258
  }
191
259
 
192
260
  .webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__bubble--from-user {
@@ -206,8 +274,8 @@ const WebChatContainerStateful = props => {
206
274
  }
207
275
 
208
276
  .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 {
209
- 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.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai === void 0 ? void 0 : _defaultWebChatContai.bubbleBackground)};
210
- 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.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleTextColor)};
277
+ 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.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.bubbleBackground)};
278
+ 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.defaultWebChatContainerStatefulProps.webChatStyles) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.bubbleTextColor)};
211
279
  }
212
280
 
213
281
  div[class="ac-textBlock"] a:link,
@@ -285,7 +353,7 @@ const WebChatContainerStateful = props => {
285
353
  }
286
354
 
287
355
  .webchat__stacked-layout_container>div {
288
- 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) ?? ""}
356
+ 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) ?? ""}
289
357
  }
290
358
  .webchat__toast_text {
291
359
  display: flex;
@@ -295,11 +363,44 @@ const WebChatContainerStateful = props => {
295
363
  overflow-y: unset;
296
364
  }
297
365
 
298
-
366
+ /* Custom styles for carousel hero cards */
367
+ ul.webchat__carousel-filmstrip__attachments .ac-image {
368
+ width: 200px !important;
369
+ height: 150px !important;
370
+ object-fit: cover !important;
371
+ border-radius: 8px !important;
372
+ border: 1px solid #e0e0e0 !important;
373
+ }
374
+
375
+ .webchat__carousel-filmstrip-attachment .webchat__bubble {
376
+ height: 100% !important;
377
+ }
378
+
379
+ .webchat__carousel-filmstrip-attachment .webchat__bubble #ms_lcw_webchat_adaptive_card {
380
+ height: 100% !important;
381
+ }
382
+
383
+ .webchat__auto-resize-textarea__textarea.webchat__send-box-text-box__html-text-area {
384
+ font-family: ${fontFamilyWithEmojis} !important;
385
+ }
386
+
387
+ /* Suggested actions carousel previous/next navigation focus */
388
+ .webchat__suggested-actions .webchat__suggested-actions__carousel .react-film__flipper:focus-visible .react-film__flipper__body {
389
+ 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;
390
+ outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp27 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp27 === void 0 ? void 0 : _webChatContainerProp27.suggestedActionKeyboardFocusIndicatorInset) ?? "2px"} !important;
391
+
299
392
  `), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
300
393
  styles: containerStyles,
301
394
  className: "webchat__stacked-layout_container"
302
- }, /*#__PURE__*/_react2.default.createElement(BasicWebChat, null)));
395
+ }, /*#__PURE__*/_react2.default.createElement(BasicWebChat, null)), citationPaneOpen && /*#__PURE__*/_react2.default.createElement(_CitationPaneStateful.default, {
396
+ id: ((_props$citationPanePr = props.citationPaneProps) === null || _props$citationPanePr === void 0 ? void 0 : _props$citationPanePr.id) || _Constants.HtmlAttributeNames.ocwCitationPaneClassName,
397
+ title: ((_props$citationPanePr2 = props.citationPaneProps) === null || _props$citationPanePr2 === void 0 ? void 0 : _props$citationPanePr2.title) || _Constants.HtmlAttributeNames.ocwCitationPaneTitle,
398
+ contentHtml: citationPaneText,
399
+ onClose: () => setCitationPaneOpen(false),
400
+ componentOverrides: (_props$citationPanePr3 = props.citationPaneProps) === null || _props$citationPanePr3 === void 0 ? void 0 : _props$citationPanePr3.componentOverrides,
401
+ controlProps: (_props$citationPanePr4 = props.citationPaneProps) === null || _props$citationPanePr4 === void 0 ? void 0 : _props$citationPanePr4.controlProps,
402
+ styleProps: (_props$citationPanePr5 = props.citationPaneProps) === null || _props$citationPanePr5 === void 0 ? void 0 : _props$citationPanePr5.styleProps
403
+ }));
303
404
  };
304
405
  exports.WebChatContainerStateful = WebChatContainerStateful;
305
406
  var _default = WebChatContainerStateful;
@@ -4,15 +4,13 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DesignerChatAdapter = void 0;
7
- var _Observable = require("rxjs/Observable");
8
- var _mockadapter = _interopRequireDefault(require("./mockadapter"));
9
7
  var _chatAdapterUtils = require("./utils/chatAdapterUtils");
8
+ var _mockadapter = _interopRequireDefault(require("./mockadapter"));
9
+ var _Observable = require("rxjs/Observable");
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
12
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
13
13
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
14
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
15
- function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
16
14
  function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
17
15
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
18
16
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -20,23 +18,56 @@ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "
20
18
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
21
19
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
22
20
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
21
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
22
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
23
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
23
24
  let DesignerChatAdapter = /*#__PURE__*/function (_MockAdapter) {
24
25
  _inherits(DesignerChatAdapter, _MockAdapter);
25
26
  var _super = _createSuper(DesignerChatAdapter);
26
- function DesignerChatAdapter() {
27
+ function DesignerChatAdapter(messages) {
27
28
  var _this;
28
29
  _classCallCheck(this, DesignerChatAdapter);
29
30
  _this = _super.call(this);
30
- setTimeout(() => {
31
- (0, _chatAdapterUtils.postBotMessageActivity)(_this.activityObserver, "Thank you for contacting us! How can I help you today?", undefined, 0);
32
- _this.postUserActivity("I need to change my address.", 0);
33
- (0, _chatAdapterUtils.postBotMessageActivity)(_this.activityObserver, "Okay, let me connect you with a live agent.", undefined, 100);
34
- (0, _chatAdapterUtils.postSystemMessageActivity)(_this.activityObserver, "John has joined the chat", 100);
35
- (0, _chatAdapterUtils.postBotMessageActivity)(_this.activityObserver, "I'd be happy to help you update your account.", undefined, 100);
36
- }, 1000);
31
+ _defineProperty(_assertThisInitialized(_this), "messages", void 0);
32
+ _this.messages = messages;
33
+ if (_this.messages) {
34
+ if (_this.messages.length > 0) {
35
+ setTimeout(() => {
36
+ var _this$messages;
37
+ (_this$messages = _this.messages) === null || _this$messages === void 0 ? void 0 : _this$messages.forEach((msg, index) => {
38
+ _this.processMessage(msg, index);
39
+ });
40
+ }, 1000); // Initial 1 second delay to ensure activityObserver is ready
41
+ }
42
+ } else {
43
+ // Default hardcoded flow
44
+ setTimeout(() => {
45
+ (0, _chatAdapterUtils.postBotMessageActivity)(_this.activityObserver, "Thank you for contacting us! How can I help you today?", undefined, 0);
46
+ (0, _chatAdapterUtils.postBotMessageActivity)(_this.activityObserver, "Please accept terms and conditions to proceed. Visit the link for terms and conditions <a href=\"\">here</a>.", undefined, 0);
47
+ _this.postUserActivity("I need to change my address.", 0);
48
+ (0, _chatAdapterUtils.postBotMessageActivity)(_this.activityObserver, "Okay, let me connect you with a live agent.", undefined, 100);
49
+ (0, _chatAdapterUtils.postSystemMessageActivity)(_this.activityObserver, "John has joined the chat", 100);
50
+ (0, _chatAdapterUtils.postAgentMessageActivity)(_this.activityObserver, "I'd be happy to help you update your account.", undefined, 100);
51
+ _this.postUserActivity("I have trouble visiting the signin page <a href=\"\">signin</a>.", 0);
52
+ }, 1000);
53
+ }
37
54
  return _this;
38
55
  }
39
56
  _createClass(DesignerChatAdapter, [{
57
+ key: "processMessage",
58
+ value: function processMessage(msg, index) {
59
+ if (msg.text) {
60
+ if (msg.suggestedActions) {
61
+ (0, _chatAdapterUtils.postAgentSuggestedActionsActivity)(this.activityObserver, msg.text, msg.suggestedActions, index * 100);
62
+ } else {
63
+ (0, _chatAdapterUtils.postBotMessageActivity)(this.activityObserver, msg.text, undefined, index * 100);
64
+ }
65
+ }
66
+ if (msg.attachments && msg.attachments.length > 0) {
67
+ (0, _chatAdapterUtils.postAgentAttachmentActivity)(this.activityObserver, msg.attachments, index * 100, msg.attachmentLayout);
68
+ }
69
+ }
70
+ }, {
40
71
  key: "postUserActivity",
41
72
  value: function postUserActivity(text) {
42
73
  let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
@@ -26,13 +26,18 @@ let DesignerChatSDK = /*#__PURE__*/function (_MockChatSDK) {
26
26
  var _this;
27
27
  _classCallCheck(this, DesignerChatSDK);
28
28
  _this = _super.call(this);
29
+ /**
30
+ * Create a chat adapter for the designer. Uses this.mockMessages if set.
31
+ */
32
+ _defineProperty(_assertThisInitialized(_this), "mockMessages", void 0);
29
33
  _defineProperty(_assertThisInitialized(_this), "localeId", _this.getLiveChatConfig().ChatWidgetLanguage.msdyn_localeid);
30
34
  return _this;
31
35
  }
32
36
  _createClass(DesignerChatSDK, [{
33
37
  key: "createChatAdapter",
34
38
  value: function createChatAdapter() {
35
- return new _DesignerChatAdapter.DesignerChatAdapter();
39
+ const adapter = new _DesignerChatAdapter.DesignerChatAdapter(this.mockMessages);
40
+ return adapter;
36
41
  }
37
42
  }, {
38
43
  key: "getLiveChatConfig",
@@ -23,7 +23,7 @@ const defaultWebChatStyles = {
23
23
  bubbleTextColor: "White",
24
24
  hideSendBox: false,
25
25
  hideUploadButton: true,
26
- primaryFont: "Segoe UI, Arial, sans-serif",
26
+ primaryFont: "Segoe UI, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Noto Color Emoji\"",
27
27
  rootHeight: "100%",
28
28
  rootWidth: "100%",
29
29
  sendBoxTextWrap: true,
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.postSystemMessageActivity = exports.postEchoActivity = exports.postBotTypingActivity = exports.postBotMessageActivity = exports.postBotAttachmentActivity = exports.customerUser = exports.botUser = void 0;
6
+ exports.postSystemMessageActivity = exports.postEchoActivity = exports.postBotTypingActivity = exports.postBotMessageActivity = exports.postBotAttachmentActivity = exports.postAgentSuggestedActionsActivity = exports.postAgentMessageActivity = exports.postAgentAttachmentActivity = exports.customerUser = exports.botUser = exports.agentUser = void 0;
7
7
  var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
8
8
  const customerUser = {
9
9
  id: "usedId",
@@ -16,9 +16,15 @@ const botUser = {
16
16
  name: "Bot",
17
17
  role: "bot"
18
18
  };
19
+ exports.botUser = botUser;
20
+ const agentUser = {
21
+ id: "AgentId",
22
+ name: "John",
23
+ role: "bot"
24
+ };
19
25
 
20
26
  // WebChat expects an "echo" activity to confirm the message has been sent successfully
21
- exports.botUser = botUser;
27
+ exports.agentUser = agentUser;
22
28
  const postEchoActivity = function (activityObserver, activity, user) {
23
29
  let delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1000;
24
30
  const echoActivity = {
@@ -54,6 +60,25 @@ const postBotMessageActivity = function (activityObserver, text) {
54
60
  }, delay);
55
61
  };
56
62
  exports.postBotMessageActivity = postBotMessageActivity;
63
+ const postAgentMessageActivity = function (activityObserver, text) {
64
+ let tags = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "";
65
+ let delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1000;
66
+ setTimeout(() => {
67
+ activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next({
68
+ id: (0, _omnichannelChatSdk.uuidv4)(),
69
+ from: {
70
+ ...agentUser
71
+ },
72
+ text,
73
+ type: "message",
74
+ channelData: {
75
+ tags
76
+ },
77
+ timestamp: new Date().toISOString()
78
+ });
79
+ }, delay);
80
+ };
81
+ exports.postAgentMessageActivity = postAgentMessageActivity;
57
82
  const postSystemMessageActivity = function (activityObserver, text) {
58
83
  let delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
59
84
  postBotMessageActivity(activityObserver, text, "system", delay);
@@ -87,4 +112,38 @@ const postBotAttachmentActivity = function (activityObserver) {
87
112
  });
88
113
  }, delay);
89
114
  };
90
- exports.postBotAttachmentActivity = postBotAttachmentActivity;
115
+ exports.postBotAttachmentActivity = postBotAttachmentActivity;
116
+ const postAgentAttachmentActivity = function (activityObserver) {
117
+ let attachments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
118
+ let delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
119
+ let attachmentLayout = arguments.length > 3 ? arguments[3] : undefined;
120
+ setTimeout(() => {
121
+ activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next({
122
+ id: (0, _omnichannelChatSdk.uuidv4)(),
123
+ from: {
124
+ ...agentUser
125
+ },
126
+ attachments,
127
+ attachmentLayout,
128
+ type: "message",
129
+ timestamp: new Date().toISOString()
130
+ });
131
+ }, delay);
132
+ };
133
+ exports.postAgentAttachmentActivity = postAgentAttachmentActivity;
134
+ const postAgentSuggestedActionsActivity = function (activityObserver, text, suggestedActions) {
135
+ let delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1000;
136
+ setTimeout(() => {
137
+ activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next({
138
+ id: (0, _omnichannelChatSdk.uuidv4)(),
139
+ from: {
140
+ ...agentUser
141
+ },
142
+ text,
143
+ type: "message",
144
+ suggestedActions,
145
+ timestamp: new Date().toISOString()
146
+ });
147
+ }, delay);
148
+ };
149
+ exports.postAgentSuggestedActionsActivity = postAgentSuggestedActionsActivity;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createIOSOptimizedEmojiFont = void 0;
7
+ /**
8
+ * Utility functions for font handling and emoji support
9
+ */
10
+
11
+ /**
12
+ * Creates a font family optimized for iOS emoji support
13
+ * Uses system-ui as the primary font for better emoji rendering on iOS
14
+ * @param primaryFont - The base font family string (optional, used as fallback)
15
+ * @returns Font family string optimized for iOS emoji support
16
+ */
17
+ const createIOSOptimizedEmojiFont = primaryFont => {
18
+ // For iOS emoji support, system-ui should be first
19
+ const baseFont = "system-ui";
20
+ const emojiSupport = "\"Apple Color Emoji\", \"Segoe UI Emoji\"";
21
+ if (!primaryFont || primaryFont.includes("system-ui") || primaryFont.includes("Apple Color Emoji")) {
22
+ return `${baseFont}, ${emojiSupport}`;
23
+ }
24
+
25
+ // Add configured font as fallback after emoji fonts
26
+ return `${baseFont}, ${emojiSupport}, ${primaryFont}`;
27
+ };
28
+ exports.createIOSOptimizedEmojiFont = createIOSOptimizedEmojiFont;
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.defaultAvatarTextStyles = void 0;
7
7
  const defaultAvatarTextStyles = {
8
8
  margin: "0",
9
- fontFamily: "\"Segoe UI\", Arial, sans-serif",
9
+ fontFamily: "'Segoe UI', 'Apple Color Emoji', 'Noto Color Emoji', 'Segoe UI Emoji', Arial, sans-serif",
10
10
  fontWeight: 600,
11
11
  fontSize: "13px",
12
12
  lineHeight: "18px",
@@ -11,7 +11,7 @@ const defaultSystemMessageStyles = {
11
11
  fontSize: "12px",
12
12
  borderRadius: 0,
13
13
  minHeight: "auto",
14
- fontFamily: "Segoe UI",
14
+ fontFamily: "'Segoe UI', 'Apple Color Emoji', 'Noto Color Emoji', 'Segoe UI Emoji', Arial, sans-serif",
15
15
  lineHeight: "16px",
16
16
  padding: "0px 10px 0 10px"
17
17
  };