@microsoft/omnichannel-chat-widget 1.8.2 → 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 (95) hide show
  1. package/lib/cjs/common/Constants.js +2 -0
  2. package/lib/cjs/common/telemetry/TelemetryConstants.js +4 -0
  3. package/lib/cjs/common/telemetry/TelemetryHelper.js +7 -5
  4. package/lib/cjs/components/citationpanestateful/CitationDim.js +29 -0
  5. package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +199 -0
  6. package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +70 -0
  7. package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
  8. package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -4
  9. package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
  10. package/lib/cjs/components/livechatwidget/common/endChat.js +33 -4
  11. package/lib/cjs/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
  12. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +12 -9
  13. package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
  14. package/lib/cjs/components/livechatwidget/common/startChat.js +7 -5
  15. package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +8 -2
  16. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +41 -11
  17. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +114 -13
  18. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
  19. package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
  20. package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
  21. package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +36 -2
  22. package/lib/cjs/components/webchatcontainerstateful/common/utils/fontUtils.js +28 -0
  23. package/lib/cjs/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
  24. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  25. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
  26. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +139 -0
  27. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +54 -0
  28. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
  29. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +46 -45
  30. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
  31. package/lib/cjs/contexts/createReducer.js +15 -0
  32. package/lib/cjs/firstresponselatency/util.js +12 -2
  33. package/lib/cjs/index.js +9 -1
  34. package/lib/cjs/plugins/newMessageEventHandler.js +2 -2
  35. package/lib/esm/common/Constants.js +2 -0
  36. package/lib/esm/common/telemetry/TelemetryConstants.js +4 -0
  37. package/lib/esm/common/telemetry/TelemetryHelper.js +7 -5
  38. package/lib/esm/components/citationpanestateful/CitationDim.js +20 -0
  39. package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +188 -0
  40. package/lib/esm/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +61 -0
  41. package/lib/esm/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
  42. package/lib/esm/components/livechatwidget/LiveChatWidget.js +4 -4
  43. package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
  44. package/lib/esm/components/livechatwidget/common/endChat.js +34 -5
  45. package/lib/esm/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
  46. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -10
  47. package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
  48. package/lib/esm/components/livechatwidget/common/startChat.js +7 -5
  49. package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +3 -3
  50. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +41 -11
  51. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +114 -14
  52. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
  53. package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
  54. package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
  55. package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +32 -0
  56. package/lib/esm/components/webchatcontainerstateful/common/utils/fontUtils.js +21 -0
  57. package/lib/esm/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
  58. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
  59. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
  60. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +133 -0
  61. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +46 -0
  62. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
  63. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +46 -45
  64. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
  65. package/lib/esm/contexts/createReducer.js +15 -0
  66. package/lib/esm/firstresponselatency/util.js +9 -0
  67. package/lib/esm/index.js +1 -0
  68. package/lib/esm/plugins/newMessageEventHandler.js +3 -3
  69. package/lib/types/common/Constants.d.ts +2 -0
  70. package/lib/types/common/telemetry/TelemetryConstants.d.ts +4 -0
  71. package/lib/types/components/citationpanestateful/CitationDim.d.ts +5 -0
  72. package/lib/types/components/citationpanestateful/CitationPaneStateful.d.ts +4 -0
  73. package/lib/types/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.d.ts +11 -0
  74. package/lib/types/components/citationpanestateful/interfaces/ICitationPaneStatefulProps.d.ts +19 -0
  75. package/lib/types/components/confirmationpanestateful/common/defaultProps/defaultConfirmationPaneLocalizedTexts.d.ts +1 -1
  76. package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.d.ts +1 -1
  77. package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +2 -1
  78. package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
  79. package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +5 -3
  80. package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +4 -2
  81. package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +5 -0
  82. package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +6 -1
  83. package/lib/types/components/webchatcontainerstateful/common/utils/fontUtils.d.ts +10 -0
  84. package/lib/types/components/webchatcontainerstateful/interfaces/ICitation.d.ts +12 -0
  85. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +4 -0
  86. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +5 -0
  87. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +2 -2
  88. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
  89. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +46 -45
  90. package/lib/types/firstresponselatency/util.d.ts +1 -0
  91. package/lib/types/index.d.ts +1 -0
  92. package/package.json +4 -3
  93. /package/lib/cjs/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
  94. /package/lib/esm/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
  95. /package/lib/types/components/confirmationpanestateful/interfaces/{IConfirmationPaneLocalizedText.d.ts → IConfirmationPaneLocalizedTexts.d.ts} +0 -0
@@ -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";
@@ -53,7 +54,6 @@ import { startProactiveChat } from "../common/startProactiveChat";
53
54
  import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
54
55
  import useChatContextStore from "../../../hooks/useChatContextStore";
55
56
  import useFacadeSDKStore from "../../../hooks/useFacadeChatSDKStore";
56
- import { customEventCallback, subscribeToSendCustomEvent } from "../common/customEventHandler";
57
57
  let uiTimer;
58
58
  export const LiveChatWidgetStateful = props => {
59
59
  var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _props$webChatContain7, _props$webChatContain8, _props$webChatContain9, _props$styleProps, _props$webChatContain10, _props$webChatContain11, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain15, _state$appStates14, _props$webChatContain17, _props$webChatContain18, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
@@ -480,7 +480,8 @@ export const LiveChatWidgetStateful = props => {
480
480
  eventName: BroadcastEvent.MaximizeChat,
481
481
  payload: {
482
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,
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
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
484
485
  }
485
486
  });
486
487
  return;
@@ -719,11 +720,7 @@ export const LiveChatWidgetStateful = props => {
719
720
  endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
720
721
  return;
721
722
  }
722
- const inMemoryState = executeReducer(state, {
723
- type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
724
- payload: null
725
- });
726
- let isConversationalSurveyEnabled = state.appStates.isConversationalSurveyEnabled;
723
+ const isConversationalSurveyEnabled = state.appStates.isConversationalSurveyEnabled;
727
724
 
728
725
  // In conversational survey, we need to check post chat survey logics before we set ConversationState to InActive
729
726
  // Hence setting ConversationState to InActive will be done later in the post chat flows
@@ -872,23 +869,46 @@ export const LiveChatWidgetStateful = props => {
872
869
 
873
870
  // WebChat's Composer can only be rendered if a directLine object is defined
874
871
  return directLine && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
875
- ::-webkit-scrollbar {
872
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar {
876
873
  width: ${scrollbarProps.width};
877
874
  }
878
875
 
879
- ::-webkit-scrollbar-track {
876
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
880
877
  background: ${scrollbarProps.trackBackgroundColor};
881
878
  }
882
879
 
883
- ::-webkit-scrollbar-thumb {
880
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
884
881
  background: ${scrollbarProps.thumbBackgroundColor};
885
882
  border-radius: ${scrollbarProps.thumbBorderRadius};
886
883
  }
887
884
 
888
- ::-webkit-scrollbar-thumb:hover {
885
+ #oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
889
886
  background: ${scrollbarProps.thumbHoverColor};
890
887
  }
891
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
+
892
912
  .webchat__basic-transcript__activity-markdown-body > :last-child {
893
913
  margin-bottom: 0px;
894
914
  }
@@ -896,11 +916,21 @@ export const LiveChatWidgetStateful = props => {
896
916
  .webchat__basic-transcript__activity-markdown-body > :first-child {
897
917
  margin-top: 0px;
898
918
  }
919
+
899
920
  .webchat__basic-transcript__activity-markdown-body img.webchat__render-markdown__external-link-icon {
900
921
  background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjMjEyMTIxIiAvPjwvc3ZnPg==) !important;
901
922
  height: .75em;
902
923
  margin-left: .25em;
903
924
  }
925
+
926
+ .webchat__link-definitions__header-text {
927
+ color: ${bubbleBackground}
928
+ }
929
+
930
+ .webchat__link-definitions__header-chevron {
931
+ color: ${bubbleBackground}
932
+ }
933
+
904
934
  ${(sendBoxTextArea === null || sendBoxTextArea === void 0 ? void 0 : sendBoxTextArea.minHeight) && `
905
935
  .webchat__auto-resize-textarea.webchat__send-box-text-box__text-area {
906
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;
@@ -1,8 +1,6 @@
1
1
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
2
2
  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); } }
3
3
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
5
- 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); }
6
4
  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); }
7
5
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
8
6
  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); }; }
@@ -10,28 +8,59 @@ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "
10
8
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
11
9
  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; } }
12
10
  function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
13
- import { Observable } from "rxjs/Observable";
11
+ 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; }
12
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
13
+ 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); }
14
+ import { customerUser, postAgentAttachmentActivity, postAgentMessageActivity, postAgentSuggestedActionsActivity, postBotMessageActivity, postEchoActivity, postSystemMessageActivity } from "./utils/chatAdapterUtils";
14
15
  import MockAdapter from "./mockadapter";
15
- import { customerUser, postAgentMessageActivity, postBotMessageActivity, postEchoActivity, postSystemMessageActivity } from "./utils/chatAdapterUtils";
16
+ import { Observable } from "rxjs/Observable";
16
17
  export let DesignerChatAdapter = /*#__PURE__*/function (_MockAdapter) {
17
18
  _inherits(DesignerChatAdapter, _MockAdapter);
18
19
  var _super = _createSuper(DesignerChatAdapter);
19
- function DesignerChatAdapter() {
20
+ function DesignerChatAdapter(messages) {
20
21
  var _this;
21
22
  _classCallCheck(this, DesignerChatAdapter);
22
23
  _this = _super.call(this);
23
- setTimeout(() => {
24
- postBotMessageActivity(_this.activityObserver, "Thank you for contacting us! How can I help you today?", undefined, 0);
25
- postBotMessageActivity(_this.activityObserver, "Please accept terms and conditions to proceed. Visit the link for terms and conditions <a href=\"\">here</a>.", undefined, 0);
26
- _this.postUserActivity("I need to change my address.", 0);
27
- postBotMessageActivity(_this.activityObserver, "Okay, let me connect you with a live agent.", undefined, 100);
28
- postSystemMessageActivity(_this.activityObserver, "John has joined the chat", 100);
29
- postAgentMessageActivity(_this.activityObserver, "I'd be happy to help you update your account.", undefined, 100);
30
- _this.postUserActivity("I have trouble visiting the signin page <a href=\"\">signin</a>.", 0);
31
- }, 1000);
24
+ _defineProperty(_assertThisInitialized(_this), "messages", void 0);
25
+ _this.messages = messages;
26
+ if (_this.messages) {
27
+ if (_this.messages.length > 0) {
28
+ setTimeout(() => {
29
+ var _this$messages;
30
+ (_this$messages = _this.messages) === null || _this$messages === void 0 ? void 0 : _this$messages.forEach((msg, index) => {
31
+ _this.processMessage(msg, index);
32
+ });
33
+ }, 1000); // Initial 1 second delay to ensure activityObserver is ready
34
+ }
35
+ } else {
36
+ // Default hardcoded flow
37
+ setTimeout(() => {
38
+ postBotMessageActivity(_this.activityObserver, "Thank you for contacting us! How can I help you today?", undefined, 0);
39
+ postBotMessageActivity(_this.activityObserver, "Please accept terms and conditions to proceed. Visit the link for terms and conditions <a href=\"\">here</a>.", undefined, 0);
40
+ _this.postUserActivity("I need to change my address.", 0);
41
+ postBotMessageActivity(_this.activityObserver, "Okay, let me connect you with a live agent.", undefined, 100);
42
+ postSystemMessageActivity(_this.activityObserver, "John has joined the chat", 100);
43
+ postAgentMessageActivity(_this.activityObserver, "I'd be happy to help you update your account.", undefined, 100);
44
+ _this.postUserActivity("I have trouble visiting the signin page <a href=\"\">signin</a>.", 0);
45
+ }, 1000);
46
+ }
32
47
  return _this;
33
48
  }
34
49
  _createClass(DesignerChatAdapter, [{
50
+ key: "processMessage",
51
+ value: function processMessage(msg, index) {
52
+ if (msg.text) {
53
+ if (msg.suggestedActions) {
54
+ postAgentSuggestedActionsActivity(this.activityObserver, msg.text, msg.suggestedActions, index * 100);
55
+ } else {
56
+ postBotMessageActivity(this.activityObserver, msg.text, undefined, index * 100);
57
+ }
58
+ }
59
+ if (msg.attachments && msg.attachments.length > 0) {
60
+ postAgentAttachmentActivity(this.activityObserver, msg.attachments, index * 100, msg.attachmentLayout);
61
+ }
62
+ }
63
+ }, {
35
64
  key: "postUserActivity",
36
65
  value: function postUserActivity(text) {
37
66
  let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
@@ -20,13 +20,18 @@ export let DesignerChatSDK = /*#__PURE__*/function (_MockChatSDK) {
20
20
  var _this;
21
21
  _classCallCheck(this, DesignerChatSDK);
22
22
  _this = _super.call(this);
23
+ /**
24
+ * Create a chat adapter for the designer. Uses this.mockMessages if set.
25
+ */
26
+ _defineProperty(_assertThisInitialized(_this), "mockMessages", void 0);
23
27
  _defineProperty(_assertThisInitialized(_this), "localeId", _this.getLiveChatConfig().ChatWidgetLanguage.msdyn_localeid);
24
28
  return _this;
25
29
  }
26
30
  _createClass(DesignerChatSDK, [{
27
31
  key: "createChatAdapter",
28
32
  value: function createChatAdapter() {
29
- return new DesignerChatAdapter();
33
+ const adapter = new DesignerChatAdapter(this.mockMessages);
34
+ return adapter;
30
35
  }
31
36
  }, {
32
37
  key: "getLiveChatConfig",
@@ -17,7 +17,7 @@ export const defaultWebChatStyles = {
17
17
  bubbleTextColor: "White",
18
18
  hideSendBox: false,
19
19
  hideUploadButton: true,
20
- primaryFont: "Segoe UI, Arial, sans-serif",
20
+ primaryFont: "Segoe UI, Arial, sans-serif, \"Apple Color Emoji\", \"Segoe UI Emoji\", \"Noto Color Emoji\"",
21
21
  rootHeight: "100%",
22
22
  rootWidth: "100%",
23
23
  sendBoxTextWrap: true,
@@ -97,4 +97,36 @@ export const postBotAttachmentActivity = function (activityObserver) {
97
97
  timestamp: new Date().toISOString()
98
98
  });
99
99
  }, delay);
100
+ };
101
+ export const postAgentAttachmentActivity = function (activityObserver) {
102
+ let attachments = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
103
+ let delay = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1000;
104
+ let attachmentLayout = arguments.length > 3 ? arguments[3] : undefined;
105
+ setTimeout(() => {
106
+ activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next({
107
+ id: uuidv4(),
108
+ from: {
109
+ ...agentUser
110
+ },
111
+ attachments,
112
+ attachmentLayout,
113
+ type: "message",
114
+ timestamp: new Date().toISOString()
115
+ });
116
+ }, delay);
117
+ };
118
+ export const postAgentSuggestedActionsActivity = function (activityObserver, text, suggestedActions) {
119
+ let delay = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1000;
120
+ setTimeout(() => {
121
+ activityObserver === null || activityObserver === void 0 ? void 0 : activityObserver.next({
122
+ id: uuidv4(),
123
+ from: {
124
+ ...agentUser
125
+ },
126
+ text,
127
+ type: "message",
128
+ suggestedActions,
129
+ timestamp: new Date().toISOString()
130
+ });
131
+ }, delay);
100
132
  };
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Utility functions for font handling and emoji support
3
+ */
4
+
5
+ /**
6
+ * Creates a font family optimized for iOS emoji support
7
+ * Uses system-ui as the primary font for better emoji rendering on iOS
8
+ * @param primaryFont - The base font family string (optional, used as fallback)
9
+ * @returns Font family string optimized for iOS emoji support
10
+ */
11
+ export const createIOSOptimizedEmojiFont = primaryFont => {
12
+ // For iOS emoji support, system-ui should be first
13
+ const baseFont = "system-ui";
14
+ const emojiSupport = "\"Apple Color Emoji\", \"Segoe UI Emoji\"";
15
+ if (!primaryFont || primaryFont.includes("system-ui") || primaryFont.includes("Apple Color Emoji")) {
16
+ return `${baseFont}, ${emojiSupport}`;
17
+ }
18
+
19
+ // Add configured font as fallback after emoji fonts
20
+ return `${baseFont}, ${emojiSupport}, ${primaryFont}`;
21
+ };
@@ -1,6 +1,6 @@
1
1
  export const defaultAvatarTextStyles = {
2
2
  margin: "0",
3
- fontFamily: "\"Segoe UI\", Arial, sans-serif",
3
+ fontFamily: "'Segoe UI', 'Apple Color Emoji', 'Noto Color Emoji', 'Segoe UI Emoji', Arial, sans-serif",
4
4
  fontWeight: 600,
5
5
  fontSize: "13px",
6
6
  lineHeight: "18px",
@@ -5,7 +5,7 @@ export const defaultSystemMessageStyles = {
5
5
  fontSize: "12px",
6
6
  borderRadius: 0,
7
7
  minHeight: "auto",
8
- fontFamily: "Segoe UI",
8
+ fontFamily: "'Segoe UI', 'Apple Color Emoji', 'Noto Color Emoji', 'Segoe UI Emoji', Arial, sans-serif",
9
9
  lineHeight: "16px",
10
10
  padding: "0px 10px 0 10px"
11
11
  };