@microsoft/omnichannel-chat-widget 1.8.3-main.717ca8d → 1.8.3-main.ec1328d

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 (23) hide show
  1. package/lib/cjs/common/telemetry/TelemetryConstants.js +1 -0
  2. package/lib/cjs/components/livechatwidget/common/endChat.js +12 -2
  3. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +12 -9
  4. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +10 -0
  5. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +17 -1
  6. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +72 -0
  7. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +54 -0
  8. package/lib/cjs/firstresponselatency/util.js +12 -2
  9. package/lib/cjs/plugins/newMessageEventHandler.js +2 -2
  10. package/lib/esm/common/telemetry/TelemetryConstants.js +1 -0
  11. package/lib/esm/components/livechatwidget/common/endChat.js +12 -2
  12. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -10
  13. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +10 -0
  14. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +17 -1
  15. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +65 -0
  16. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +46 -0
  17. package/lib/esm/firstresponselatency/util.js +9 -0
  18. package/lib/esm/plugins/newMessageEventHandler.js +3 -3
  19. package/lib/types/common/telemetry/TelemetryConstants.d.ts +1 -0
  20. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +5 -0
  21. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +5 -0
  22. package/lib/types/firstresponselatency/util.d.ts +1 -0
  23. package/package.json +3 -2
@@ -195,6 +195,7 @@ exports.TelemetryEvent = TelemetryEvent;
195
195
  TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
196
196
  TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
197
197
  TelemetryEvent["AttachmentUploadValidatorMiddlewareFailed"] = "AttachmentUploadValidatorMiddlewareFailed";
198
+ TelemetryEvent["CitationMiddlewareFailed"] = "CitationMiddlewareFailed";
198
199
  TelemetryEvent["QueuePositionMessageRecieved"] = "QueuePositionMessageRecieved";
199
200
  TelemetryEvent["AverageWaitTimeMessageRecieved"] = "AverageWaitTimeMessageRecieved";
200
201
  TelemetryEvent["DataMaskingRuleApplied"] = "DataMaskingRuleApplied";
@@ -217,7 +217,7 @@ const endChat = async (props, facadeChatSDK, state, dispatch, setAdapter, setWeb
217
217
  payload: undefined
218
218
  });
219
219
  // Always allow to close the chat for embedded mode irrespective of end chat errors
220
- closeChatWidget(dispatch);
220
+ closeChatWidget(dispatch, setWebChatStyles, props);
221
221
  facadeChatSDK.destroy();
222
222
  }
223
223
  }
@@ -350,13 +350,23 @@ const endVoiceVideoCallIfOngoing = async (facadeChatSDK, dispatch) => {
350
350
  }, callId);
351
351
  }
352
352
  };
353
+
354
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
353
355
  exports.endVoiceVideoCallIfOngoing = endVoiceVideoCallIfOngoing;
354
- const closeChatWidget = dispatch => {
356
+ const closeChatWidget = (dispatch, setWebChatStyles, props) => {
357
+ var _props$webChatContain2, _props$webChatContain3;
355
358
  // Embedded chat
356
359
  dispatch({
357
360
  type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
358
361
  payload: _ConversationState.ConversationState.Closed
359
362
  });
363
+
364
+ // if customer is setting the hideSendbox, we should not alter its value
365
+ if ((props === null || props === void 0 ? void 0 : (_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : (_props$webChatContain3 = _props$webChatContain2.webChatStyles) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.hideSendBox) === true) return;
366
+ setWebChatStyles(styles => ({
367
+ ...styles,
368
+ hideSendBox: false
369
+ }));
360
370
  };
361
371
 
362
372
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -7,6 +7,8 @@ exports.initWebChatComposer = void 0;
7
7
  var _Constants = require("../../../common/Constants");
8
8
  var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants");
9
9
  var _utils = require("../../../common/utils");
10
+ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
11
+ var _ConversationState = require("../../../contexts/common/ConversationState");
10
12
  var _dompurify = _interopRequireDefault(require("dompurify"));
11
13
  var _HyperlinkTextOverrideRenderer = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer"));
12
14
  var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
@@ -18,35 +20,35 @@ var _activityMiddleware = require("../../webchatcontainerstateful/webchatcontrol
18
20
  var _attachmentMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware");
19
21
  var _attachmentUploadValidatorMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware"));
20
22
  var _avatarMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware");
23
+ var _callActionMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware"));
21
24
  var _cardActionMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware");
25
+ var _citationsMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware");
22
26
  var _conversationEndMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware"));
27
+ var _customEventMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware"));
23
28
  var _dataMaskingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware"));
24
29
  var _createMarkdown = require("./createMarkdown");
25
30
  var _maxMessageSizeValidator = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator"));
26
31
  var _messageSequenceIdOverrideMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware");
27
32
  var _messageTimestampMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware");
33
+ var _queueOverflowHandlerMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware");
28
34
  var _botframeworkWebchat = require("botframework-webchat");
29
35
  var _toastMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware");
30
36
  var _WebChatLogger = require("../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger");
31
37
  var _defaultAttachmentProps = require("../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps");
32
38
  var _defaultMiddlewareLocalizedTexts = require("../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
33
39
  var _defaultWebChatContainerStatefulProps = require("../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps");
40
+ var _createReducer = require("../../../contexts/createReducer");
34
41
  var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
35
42
  var _gifUploadMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware"));
36
43
  var _htmlPlayerMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware"));
37
44
  var _htmlTextMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware"));
38
45
  var _preProcessingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware"));
39
46
  var _sanitizationMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"));
40
- var _callActionMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware"));
41
- var _customEventMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware"));
42
- var _ConversationState = require("../../../contexts/common/ConversationState");
43
- var _createReducer = require("../../../contexts/createReducer");
44
- var _queueOverflowHandlerMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware");
45
- var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
47
+ var _localizedStringsBotInitialsMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware");
46
48
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
47
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
50
  const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) => {
49
- var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain13, _props$webChatContain14, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain15, _props$webChatContain16, _defaultWebChatContai, _props$webChatContain17, _props$webChatContain18, _props$webChatContain19, _props$webChatContain20, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain21, _props$webChatContain22, _defaultWebChatContai2, _props$webChatContain23, _props$webChatContain24, _defaultWebChatContai3, _props$webChatContain25, _props$webChatContain26;
51
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain13, _props$webChatContain14, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain15, _props$webChatContain16, _defaultWebChatContai, _props$webChatContain17, _props$webChatContain18, _props$webChatContain19, _props$webChatContain20, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain21, _props$webChatContain22, _defaultWebChatContai2, _props$webChatContain23, _props$webChatContain24, _defaultWebChatContai3, _props$webChatContain25, _props$webChatContain26, _props$webChatContain27, _props$webChatContain28;
50
52
  // Add a hook to make all links open a new window
51
53
  postDomPurifyActivities();
52
54
  const localizedTexts = {
@@ -121,7 +123,7 @@ const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) =>
121
123
  };
122
124
  webChatStore = (0, _botframeworkWebchat.createStore)({},
123
125
  //initial state
124
- _preProcessingMiddleware.default, _attachmentProcessingMiddleware.default, (0, _attachmentUploadValidatorMiddleware.default)((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), (0, _customEventMiddleware.default)(_omnichannelChatComponents.BroadcastService), (0, _queueOverflowHandlerMiddleware.createQueueOverflowMiddleware)(state, dispatch), (0, _channelDataMiddleware.default)(addConversationalSurveyTagsCallback), (0, _conversationEndMiddleware.default)(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), (0, _dataMaskingMiddleware.default)((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), _messageTimestampMiddleware.createMessageTimeStampMiddleware, _messageSequenceIdOverrideMiddleware.createMessageSequenceIdOverrideMiddleware, _gifUploadMiddleware.default, _htmlPlayerMiddleware.default, (0, _htmlTextMiddleware.default)(honorsTargetInHTMLLinks), (0, _maxMessageSizeValidator.default)(localizedTexts), _sanitizationMiddleware.default, (0, _callActionMiddleware.default)(),
126
+ _preProcessingMiddleware.default, _attachmentProcessingMiddleware.default, (0, _attachmentUploadValidatorMiddleware.default)((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), (0, _customEventMiddleware.default)(_omnichannelChatComponents.BroadcastService), (0, _queueOverflowHandlerMiddleware.createQueueOverflowMiddleware)(state, dispatch), (0, _channelDataMiddleware.default)(addConversationalSurveyTagsCallback), (0, _conversationEndMiddleware.default)(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), (0, _dataMaskingMiddleware.default)((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), _messageTimestampMiddleware.createMessageTimeStampMiddleware, _messageSequenceIdOverrideMiddleware.createMessageSequenceIdOverrideMiddleware, _citationsMiddleware.createCitationsMiddleware, _gifUploadMiddleware.default, _htmlPlayerMiddleware.default, (0, _htmlTextMiddleware.default)(honorsTargetInHTMLLinks), (0, _maxMessageSizeValidator.default)(localizedTexts), _sanitizationMiddleware.default, (0, _callActionMiddleware.default)(), (0, _localizedStringsBotInitialsMiddleware.localizedStringsBotInitialsMiddleware)(),
125
127
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
126
128
  ...(((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.storeMiddlewares) ?? []));
127
129
  _WebChatStoreLoader.WebChatStoreLoader.store = webChatStore;
@@ -175,7 +177,8 @@ const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) =>
175
177
  onTelemetry: (0, _WebChatLogger.createWebChatTelemetry)(),
176
178
  cardActionMiddleware: (0, _cardActionMiddleware.createCardActionMiddleware)(((_props$webChatContain25 = props.webChatContainerProps) === null || _props$webChatContain25 === void 0 ? void 0 : _props$webChatContain25.botMagicCode) || undefined),
177
179
  sendTypingIndicator: true,
178
- ...((_props$webChatContain26 = props.webChatContainerProps) === null || _props$webChatContain26 === void 0 ? void 0 : _props$webChatContain26.webChatProps)
180
+ overrideLocalizedStrings: (0, _localizedStringsBotInitialsMiddleware.getOverriddenLocalizedStrings)((_props$webChatContain26 = props.webChatContainerProps) === null || _props$webChatContain26 === void 0 ? void 0 : (_props$webChatContain27 = _props$webChatContain26.webChatProps) === null || _props$webChatContain27 === void 0 ? void 0 : _props$webChatContain27.overrideLocalizedStrings),
181
+ ...((_props$webChatContain28 = props.webChatContainerProps) === null || _props$webChatContain28 === void 0 ? void 0 : _props$webChatContain28.webChatProps)
179
182
  };
180
183
  return webChatProps;
181
184
  };
@@ -900,11 +900,21 @@ const LiveChatWidgetStateful = props => {
900
900
  .webchat__basic-transcript__activity-markdown-body > :first-child {
901
901
  margin-top: 0px;
902
902
  }
903
+
903
904
  .webchat__basic-transcript__activity-markdown-body img.webchat__render-markdown__external-link-icon {
904
905
  background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3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gxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjMjEyMTIxIiAvPjwvc3ZnPg==) !important;
905
906
  height: .75em;
906
907
  margin-left: .25em;
907
908
  }
909
+
910
+ .webchat__link-definitions__header-text {
911
+ color: ${bubbleBackground}
912
+ }
913
+
914
+ .webchat__link-definitions__header-chevron {
915
+ color: ${bubbleBackground}
916
+ }
917
+
908
918
  ${(sendBoxTextArea === null || sendBoxTextArea === void 0 ? void 0 : sendBoxTextArea.minHeight) && `
909
919
  .webchat__auto-resize-textarea.webchat__send-box-text-box__text-area {
910
920
  min-height: ${sendBoxTextArea === null || sendBoxTextArea === void 0 ? void 0 : sendBoxTextArea.minHeight} !important;
@@ -295,7 +295,23 @@ const WebChatContainerStateful = props => {
295
295
  overflow-y: unset;
296
296
  }
297
297
 
298
-
298
+ /* Custom styles for carousel hero cards */
299
+ ul.webchat__carousel-filmstrip__attachments .ac-image {
300
+ width: 200px !important;
301
+ height: 150px !important;
302
+ object-fit: cover !important;
303
+ border-radius: 8px !important;
304
+ border: 1px solid #e0e0e0 !important;
305
+ }
306
+
307
+ .webchat__carousel-filmstrip-attachment .webchat__bubble {
308
+ height: 100% !important;
309
+ }
310
+
311
+ .webchat__carousel-filmstrip-attachment .webchat__bubble #ms_lcw_webchat_adaptive_card {
312
+ height: 100% !important;
313
+ }
314
+
299
315
  `), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
300
316
  styles: containerStyles,
301
317
  className: "webchat__stacked-layout_container"
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.createCitationsMiddleware = void 0;
7
+ var _TelemetryConstants = require("../../../../../common/telemetry/TelemetryConstants");
8
+ var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
9
+ const createCitationsMiddleware = _ref => {
10
+ let {
11
+ dispatch
12
+ } = _ref;
13
+ return next => action => {
14
+ var _action$payload;
15
+ if ((_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
16
+ if (isApplicable(action)) {
17
+ try {
18
+ const gptFeedback = JSON.parse(action.payload.activity.channelData.metadata["pva:gpt-feedback"]);
19
+ // Replace citations in the text
20
+ const updatedText = replaceCitations(action.payload.activity.text, gptFeedback.summarizationOpenAIResponse.result.textCitations);
21
+ action.payload.activity.text = updatedText;
22
+ } catch (error) {
23
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
24
+ Event: _TelemetryConstants.TelemetryEvent.CitationMiddlewareFailed,
25
+ ExceptionDetails: {
26
+ ErrorData: "Error while converting citation labels",
27
+ Exception: error
28
+ }
29
+ });
30
+ }
31
+ }
32
+ }
33
+ return next(action);
34
+ };
35
+ };
36
+ exports.createCitationsMiddleware = createCitationsMiddleware;
37
+ const isApplicable = action => {
38
+ var _action$payload2, _action$payload2$acti, _action$payload3, _action$payload3$acti;
39
+ if ((action === null || action === void 0 ? void 0 : (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : _action$payload2$acti.actionType) === "DIRECT_LINE/INCOMING_ACTIVITY" && (action === null || action === void 0 ? void 0 : (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : (_action$payload3$acti = _action$payload3.activity) === null || _action$payload3$acti === void 0 ? void 0 : _action$payload3$acti.channelId) === "ACS_CHANNEL") {
40
+ var _action$payload4, _action$payload4$acti, _action$payload4$acti2, _action$payload4$acti3;
41
+ // Validate if pva:gpt-feedback exists and is not null
42
+ if (action !== null && action !== void 0 && (_action$payload4 = action.payload) !== null && _action$payload4 !== void 0 && (_action$payload4$acti = _action$payload4.activity) !== null && _action$payload4$acti !== void 0 && (_action$payload4$acti2 = _action$payload4$acti.channelData) !== null && _action$payload4$acti2 !== void 0 && (_action$payload4$acti3 = _action$payload4$acti2.metadata) !== null && _action$payload4$acti3 !== void 0 && _action$payload4$acti3["pva:gpt-feedback"]) {
43
+ return true;
44
+ }
45
+ }
46
+ return false;
47
+ };
48
+ const replaceCitations = (text, citations) => {
49
+ if (!citations || !Array.isArray(citations)) {
50
+ return text;
51
+ }
52
+ try {
53
+ return text.replace(/\[(\d+)\]:\s(cite:\d+)\s"([^"]+)"/g, (match, number, citeId) => {
54
+ const citation = citations.find(c => c.id === citeId);
55
+ if (citation) {
56
+ // Replace only the citation label while preserving the original format
57
+ return `[${number}]: ${citeId} "${citation.title}"`;
58
+ }
59
+ return match; // Keep the original match if no replacement is found
60
+ });
61
+ } catch (error) {
62
+ _TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
63
+ Event: _TelemetryConstants.TelemetryEvent.CitationMiddlewareFailed,
64
+ ExceptionDetails: {
65
+ ErrorData: "Error while finding citations references",
66
+ Exception: error
67
+ }
68
+ });
69
+ // Return the original text in case of issues
70
+ return text;
71
+ }
72
+ };
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.localizedStringsBotInitialsMiddleware = exports.getOverriddenLocalizedStrings = void 0;
7
+ var _Constants = require("../../../../../common/Constants");
8
+ var _utils = require("../../../../../common/utils");
9
+ var _defaultWebChatStyles = require("../../../common/defaultStyles/defaultWebChatStyles");
10
+ var _WebChatActionType = require("../../enums/WebChatActionType");
11
+ /* eslint-disable @typescript-eslint/no-explicit-any */
12
+
13
+ let currentAgentInitials = _defaultWebChatStyles.defaultWebChatStyles.botAvatarInitials;
14
+ const localizedStringsBotInitialsMiddleware = () => _ref => {
15
+ let {
16
+ dispatch
17
+ } = _ref;
18
+ return next => action => {
19
+ if (action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
20
+ var _action$payload, _activity$from;
21
+ const activity = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.activity;
22
+ if (activity !== null && activity !== void 0 && (_activity$from = activity.from) !== null && _activity$from !== void 0 && _activity$from.name && activity.from.role !== _Constants.Constants.userMessageTag && activity.from.name !== _Constants.Constants.userMessageTag) {
23
+ var _activity$channelData, _activity$channelData2, _activity$tags;
24
+ const agentName = activity.from.name.trim();
25
+ const isSystemMessage = agentName === "__agent__" || agentName.startsWith("__") || ((_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.tags) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.includes(_Constants.Constants.systemMessageTag)) || ((_activity$tags = activity.tags) === null || _activity$tags === void 0 ? void 0 : _activity$tags.includes(_Constants.Constants.systemMessageTag));
26
+ if (!isSystemMessage && agentName !== "") {
27
+ // Update initials for valid agent/bot names
28
+ const newInitials = (0, _utils.getIconText)(agentName) || currentAgentInitials;
29
+ currentAgentInitials = newInitials;
30
+ }
31
+ }
32
+ }
33
+ return next(action);
34
+ };
35
+ };
36
+ exports.localizedStringsBotInitialsMiddleware = localizedStringsBotInitialsMiddleware;
37
+ const getOverriddenLocalizedStrings = existingOverrides => {
38
+ return strings => {
39
+ const result = {
40
+ ...strings,
41
+ ...existingOverrides
42
+ };
43
+
44
+ // Apply dynamic bot initials to alt text if not already overridden through props
45
+ if (!(existingOverrides !== null && existingOverrides !== void 0 && existingOverrides.ACTIVITY_BOT_SAID_ALT)) {
46
+ result.ACTIVITY_BOT_SAID_ALT = `${currentAgentInitials} said:`;
47
+ }
48
+ if (!(existingOverrides !== null && existingOverrides !== void 0 && existingOverrides.ACTIVITY_BOT_ATTACHED_ALT)) {
49
+ result.ACTIVITY_BOT_ATTACHED_ALT = `${currentAgentInitials} attached:`;
50
+ }
51
+ return result;
52
+ };
53
+ };
54
+ exports.getOverriddenLocalizedStrings = getOverriddenLocalizedStrings;
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.polyfillMessagePayloadForEvent = exports.isHistoryMessage = exports.getScenarioType = exports.extractTimestampFromId = exports.createTrackingMessage = exports.buildMessagePayload = void 0;
6
+ exports.polyfillMessagePayloadForEvent = exports.maskPayloadText = exports.isHistoryMessage = exports.getScenarioType = exports.extractTimestampFromId = exports.createTrackingMessage = exports.buildMessagePayload = void 0;
7
7
  var _Constants = require("./Constants");
8
8
  var _Constants2 = require("../common/Constants");
9
9
  const DELTA_WITHIN_LIMITS_IN_MS = 250;
@@ -126,4 +126,14 @@ const createTrackingMessage = (payload, type) => {
126
126
  checkTime: new Date().getTime()
127
127
  };
128
128
  };
129
- exports.createTrackingMessage = createTrackingMessage;
129
+ exports.createTrackingMessage = createTrackingMessage;
130
+ const maskPayloadText = payload => {
131
+ if (!payload) {
132
+ return payload;
133
+ }
134
+ return {
135
+ ...payload,
136
+ text: "*contents hidden*"
137
+ };
138
+ };
139
+ exports.maskPayloadText = maskPayloadText;
@@ -71,7 +71,7 @@ const createOnNewAdapterActivityHandler = (chatId, userId, startTime) => {
71
71
  _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
72
72
  Event: _TelemetryConstants.TelemetryEvent.RehydrateMessageReceived,
73
73
  Description: "History message received",
74
- CustomProperties: payload
74
+ CustomProperties: (0, _util.maskPayloadText)(payload)
75
75
  });
76
76
  }
77
77
  };
@@ -108,7 +108,7 @@ const createOnNewAdapterActivityHandler = (chatId, userId, startTime) => {
108
108
  _TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
109
109
  Event: _TelemetryConstants.TelemetryEvent.MessageReceived,
110
110
  Description: "New message received",
111
- CustomProperties: payload
111
+ CustomProperties: (0, _util.maskPayloadText)(payload)
112
112
  });
113
113
  };
114
114
  const raiseMessageEvent = activity => {
@@ -189,6 +189,7 @@ export let TelemetryEvent;
189
189
  TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
190
190
  TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
191
191
  TelemetryEvent["AttachmentUploadValidatorMiddlewareFailed"] = "AttachmentUploadValidatorMiddlewareFailed";
192
+ TelemetryEvent["CitationMiddlewareFailed"] = "CitationMiddlewareFailed";
192
193
  TelemetryEvent["QueuePositionMessageRecieved"] = "QueuePositionMessageRecieved";
193
194
  TelemetryEvent["AverageWaitTimeMessageRecieved"] = "AverageWaitTimeMessageRecieved";
194
195
  TelemetryEvent["DataMaskingRuleApplied"] = "DataMaskingRuleApplied";
@@ -211,7 +211,7 @@ const endChat = async (props, facadeChatSDK, state, dispatch, setAdapter, setWeb
211
211
  payload: undefined
212
212
  });
213
213
  // Always allow to close the chat for embedded mode irrespective of end chat errors
214
- closeChatWidget(dispatch);
214
+ closeChatWidget(dispatch, setWebChatStyles, props);
215
215
  facadeChatSDK.destroy();
216
216
  }
217
217
  }
@@ -339,12 +339,22 @@ export const endVoiceVideoCallIfOngoing = async (facadeChatSDK, dispatch) => {
339
339
  }, callId);
340
340
  }
341
341
  };
342
- const closeChatWidget = dispatch => {
342
+
343
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
344
+ const closeChatWidget = (dispatch, setWebChatStyles, props) => {
345
+ var _props$webChatContain2, _props$webChatContain3;
343
346
  // Embedded chat
344
347
  dispatch({
345
348
  type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
346
349
  payload: ConversationState.Closed
347
350
  });
351
+
352
+ // if customer is setting the hideSendbox, we should not alter its value
353
+ if ((props === null || props === void 0 ? void 0 : (_props$webChatContain2 = props.webChatContainerProps) === null || _props$webChatContain2 === void 0 ? void 0 : (_props$webChatContain3 = _props$webChatContain2.webChatStyles) === null || _props$webChatContain3 === void 0 ? void 0 : _props$webChatContain3.hideSendBox) === true) return;
354
+ setWebChatStyles(styles => ({
355
+ ...styles,
356
+ hideSendBox: false
357
+ }));
348
358
  };
349
359
 
350
360
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -1,6 +1,9 @@
1
1
  import { ConversationEndEntity, ParticipantType } from "../../../common/Constants";
2
2
  import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
3
3
  import { changeLanguageCodeFormatForWebChat, getConversationDetailsCall } from "../../../common/utils";
4
+ import { BroadcastService } from "@microsoft/omnichannel-chat-components";
5
+ import { Constants } from "../../../common/Constants";
6
+ import { ConversationState } from "../../../contexts/common/ConversationState";
4
7
  import DOMPurify from "dompurify";
5
8
  import HyperlinkTextOverrideRenderer from "../../webchatcontainerstateful/webchatcontroller/markdownrenderers/HyperlinkTextOverrideRenderer";
6
9
  import { LiveChatWidgetActionType } from "../../../contexts/common/LiveChatWidgetActionType";
@@ -12,36 +15,35 @@ import { createActivityMiddleware } from "../../webchatcontainerstateful/webchat
12
15
  import { createAttachmentMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware";
13
16
  import createAttachmentUploadValidatorMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/attachmentUploadValidatorMiddleware";
14
17
  import { createAvatarMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/avatarMiddleware";
18
+ import createCallActionMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware";
15
19
  import { createCardActionMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware";
20
+ import { createCitationsMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware";
16
21
  import createConversationEndMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware";
22
+ import createCustomEventMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware";
17
23
  import createDataMaskingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/dataMaskingMiddleware";
18
24
  import { createMarkdown } from "./createMarkdown";
19
25
  import createMaxMessageSizeValidator from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/maxMessageSizeValidator";
20
26
  import { createMessageSequenceIdOverrideMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageSequenceIdOverrideMiddleware";
21
27
  import { createMessageTimeStampMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware";
28
+ import { createQueueOverflowMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware";
22
29
  import { createStore } from "botframework-webchat";
23
30
  import { createToastMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/toastMiddleware";
24
31
  import { createWebChatTelemetry } from "../../webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger";
25
32
  import { defaultAttachmentProps } from "../../webchatcontainerstateful/common/defaultProps/defaultAttachmentProps";
26
33
  import { defaultMiddlewareLocalizedTexts } from "../../webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts";
27
34
  import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
35
+ import { executeReducer } from "../../../contexts/createReducer";
28
36
  import { getLocaleStringFromId } from "@microsoft/omnichannel-chat-sdk";
29
37
  import gifUploadMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/gifUploadMiddleware";
30
38
  import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware";
31
39
  import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
32
40
  import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
33
41
  import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
34
- import { Constants } from "../../../common/Constants";
35
- import createCallActionMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/callActionMiddleware";
36
- import createCustomEventMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/customEventMiddleware";
37
- import { ConversationState } from "../../../contexts/common/ConversationState";
38
- import { executeReducer } from "../../../contexts/createReducer";
39
- import { createQueueOverflowMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware";
40
- import { BroadcastService } from "@microsoft/omnichannel-chat-components";
42
+ import { localizedStringsBotInitialsMiddleware, getOverriddenLocalizedStrings } from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware";
41
43
 
42
44
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
43
45
  export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) => {
44
- var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain13, _props$webChatContain14, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain15, _props$webChatContain16, _defaultWebChatContai, _props$webChatContain17, _props$webChatContain18, _props$webChatContain19, _props$webChatContain20, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain21, _props$webChatContain22, _defaultWebChatContai2, _props$webChatContain23, _props$webChatContain24, _defaultWebChatContai3, _props$webChatContain25, _props$webChatContain26;
46
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _state$domainStates$l4, _state$domainStates$l5, _props$webChatContain11, _props$webChatContain12, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain13, _props$webChatContain14, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain15, _props$webChatContain16, _defaultWebChatContai, _props$webChatContain17, _props$webChatContain18, _props$webChatContain19, _props$webChatContain20, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain21, _props$webChatContain22, _defaultWebChatContai2, _props$webChatContain23, _props$webChatContain24, _defaultWebChatContai3, _props$webChatContain25, _props$webChatContain26, _props$webChatContain27, _props$webChatContain28;
45
47
  // Add a hook to make all links open a new window
46
48
  postDomPurifyActivities();
47
49
  const localizedTexts = {
@@ -116,7 +118,7 @@ export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endCh
116
118
  };
117
119
  webChatStore = createStore({},
118
120
  //initial state
119
- preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), createCustomEventMiddleware(BroadcastService), createQueueOverflowMiddleware(state, dispatch), channelDataMiddleware(addConversationalSurveyTagsCallback), createConversationEndMiddleware(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), createDataMaskingMiddleware((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), createMessageTimeStampMiddleware, createMessageSequenceIdOverrideMiddleware, gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware(honorsTargetInHTMLLinks), createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, createCallActionMiddleware(),
121
+ preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), createCustomEventMiddleware(BroadcastService), createQueueOverflowMiddleware(state, dispatch), channelDataMiddleware(addConversationalSurveyTagsCallback), createConversationEndMiddleware(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), createDataMaskingMiddleware((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), createMessageTimeStampMiddleware, createMessageSequenceIdOverrideMiddleware, createCitationsMiddleware, gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware(honorsTargetInHTMLLinks), createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, createCallActionMiddleware(), localizedStringsBotInitialsMiddleware(),
120
122
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
121
123
  ...(((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.storeMiddlewares) ?? []));
122
124
  WebChatStoreLoader.store = webChatStore;
@@ -170,7 +172,8 @@ export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endCh
170
172
  onTelemetry: createWebChatTelemetry(),
171
173
  cardActionMiddleware: createCardActionMiddleware(((_props$webChatContain25 = props.webChatContainerProps) === null || _props$webChatContain25 === void 0 ? void 0 : _props$webChatContain25.botMagicCode) || undefined),
172
174
  sendTypingIndicator: true,
173
- ...((_props$webChatContain26 = props.webChatContainerProps) === null || _props$webChatContain26 === void 0 ? void 0 : _props$webChatContain26.webChatProps)
175
+ overrideLocalizedStrings: getOverriddenLocalizedStrings((_props$webChatContain26 = props.webChatContainerProps) === null || _props$webChatContain26 === void 0 ? void 0 : (_props$webChatContain27 = _props$webChatContain26.webChatProps) === null || _props$webChatContain27 === void 0 ? void 0 : _props$webChatContain27.overrideLocalizedStrings),
176
+ ...((_props$webChatContain28 = props.webChatContainerProps) === null || _props$webChatContain28 === void 0 ? void 0 : _props$webChatContain28.webChatProps)
174
177
  };
175
178
  return webChatProps;
176
179
  };
@@ -892,11 +892,21 @@ export const LiveChatWidgetStateful = props => {
892
892
  .webchat__basic-transcript__activity-markdown-body > :first-child {
893
893
  margin-top: 0px;
894
894
  }
895
+
895
896
  .webchat__basic-transcript__activity-markdown-body img.webchat__render-markdown__external-link-icon {
896
897
  background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTgg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itions__header-text {
903
+ color: ${bubbleBackground}
904
+ }
905
+
906
+ .webchat__link-definitions__header-chevron {
907
+ color: ${bubbleBackground}
908
+ }
909
+
900
910
  ${(sendBoxTextArea === null || sendBoxTextArea === void 0 ? void 0 : sendBoxTextArea.minHeight) && `
901
911
  .webchat__auto-resize-textarea.webchat__send-box-text-box__text-area {
902
912
  min-height: ${sendBoxTextArea === null || sendBoxTextArea === void 0 ? void 0 : sendBoxTextArea.minHeight} !important;
@@ -287,7 +287,23 @@ export const WebChatContainerStateful = props => {
287
287
  overflow-y: unset;
288
288
  }
289
289
 
290
-
290
+ /* Custom styles for carousel hero cards */
291
+ ul.webchat__carousel-filmstrip__attachments .ac-image {
292
+ width: 200px !important;
293
+ height: 150px !important;
294
+ object-fit: cover !important;
295
+ border-radius: 8px !important;
296
+ border: 1px solid #e0e0e0 !important;
297
+ }
298
+
299
+ .webchat__carousel-filmstrip-attachment .webchat__bubble {
300
+ height: 100% !important;
301
+ }
302
+
303
+ .webchat__carousel-filmstrip-attachment .webchat__bubble #ms_lcw_webchat_adaptive_card {
304
+ height: 100% !important;
305
+ }
306
+
291
307
  `), /*#__PURE__*/React.createElement(Stack, {
292
308
  styles: containerStyles,
293
309
  className: "webchat__stacked-layout_container"
@@ -0,0 +1,65 @@
1
+ import { LogLevel, TelemetryEvent } from "../../../../../common/telemetry/TelemetryConstants";
2
+ import { TelemetryHelper } from "../../../../../common/telemetry/TelemetryHelper";
3
+ export const createCitationsMiddleware = _ref => {
4
+ let {
5
+ dispatch
6
+ } = _ref;
7
+ return next => action => {
8
+ var _action$payload;
9
+ if ((_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
10
+ if (isApplicable(action)) {
11
+ try {
12
+ const gptFeedback = JSON.parse(action.payload.activity.channelData.metadata["pva:gpt-feedback"]);
13
+ // Replace citations in the text
14
+ const updatedText = replaceCitations(action.payload.activity.text, gptFeedback.summarizationOpenAIResponse.result.textCitations);
15
+ action.payload.activity.text = updatedText;
16
+ } catch (error) {
17
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
18
+ Event: TelemetryEvent.CitationMiddlewareFailed,
19
+ ExceptionDetails: {
20
+ ErrorData: "Error while converting citation labels",
21
+ Exception: error
22
+ }
23
+ });
24
+ }
25
+ }
26
+ }
27
+ return next(action);
28
+ };
29
+ };
30
+ const isApplicable = action => {
31
+ var _action$payload2, _action$payload2$acti, _action$payload3, _action$payload3$acti;
32
+ if ((action === null || action === void 0 ? void 0 : (_action$payload2 = action.payload) === null || _action$payload2 === void 0 ? void 0 : (_action$payload2$acti = _action$payload2.activity) === null || _action$payload2$acti === void 0 ? void 0 : _action$payload2$acti.actionType) === "DIRECT_LINE/INCOMING_ACTIVITY" && (action === null || action === void 0 ? void 0 : (_action$payload3 = action.payload) === null || _action$payload3 === void 0 ? void 0 : (_action$payload3$acti = _action$payload3.activity) === null || _action$payload3$acti === void 0 ? void 0 : _action$payload3$acti.channelId) === "ACS_CHANNEL") {
33
+ var _action$payload4, _action$payload4$acti, _action$payload4$acti2, _action$payload4$acti3;
34
+ // Validate if pva:gpt-feedback exists and is not null
35
+ if (action !== null && action !== void 0 && (_action$payload4 = action.payload) !== null && _action$payload4 !== void 0 && (_action$payload4$acti = _action$payload4.activity) !== null && _action$payload4$acti !== void 0 && (_action$payload4$acti2 = _action$payload4$acti.channelData) !== null && _action$payload4$acti2 !== void 0 && (_action$payload4$acti3 = _action$payload4$acti2.metadata) !== null && _action$payload4$acti3 !== void 0 && _action$payload4$acti3["pva:gpt-feedback"]) {
36
+ return true;
37
+ }
38
+ }
39
+ return false;
40
+ };
41
+ const replaceCitations = (text, citations) => {
42
+ if (!citations || !Array.isArray(citations)) {
43
+ return text;
44
+ }
45
+ try {
46
+ return text.replace(/\[(\d+)\]:\s(cite:\d+)\s"([^"]+)"/g, (match, number, citeId) => {
47
+ const citation = citations.find(c => c.id === citeId);
48
+ if (citation) {
49
+ // Replace only the citation label while preserving the original format
50
+ return `[${number}]: ${citeId} "${citation.title}"`;
51
+ }
52
+ return match; // Keep the original match if no replacement is found
53
+ });
54
+ } catch (error) {
55
+ TelemetryHelper.logActionEvent(LogLevel.ERROR, {
56
+ Event: TelemetryEvent.CitationMiddlewareFailed,
57
+ ExceptionDetails: {
58
+ ErrorData: "Error while finding citations references",
59
+ Exception: error
60
+ }
61
+ });
62
+ // Return the original text in case of issues
63
+ return text;
64
+ }
65
+ };
@@ -0,0 +1,46 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+
3
+ import { Constants } from "../../../../../common/Constants";
4
+ import { getIconText } from "../../../../../common/utils";
5
+ import { defaultWebChatStyles } from "../../../common/defaultStyles/defaultWebChatStyles";
6
+ import { WebChatActionType } from "../../enums/WebChatActionType";
7
+ let currentAgentInitials = defaultWebChatStyles.botAvatarInitials;
8
+ export const localizedStringsBotInitialsMiddleware = () => _ref => {
9
+ let {
10
+ dispatch
11
+ } = _ref;
12
+ return next => action => {
13
+ if (action.type === WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY) {
14
+ var _action$payload, _activity$from;
15
+ const activity = (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.activity;
16
+ if (activity !== null && activity !== void 0 && (_activity$from = activity.from) !== null && _activity$from !== void 0 && _activity$from.name && activity.from.role !== Constants.userMessageTag && activity.from.name !== Constants.userMessageTag) {
17
+ var _activity$channelData, _activity$channelData2, _activity$tags;
18
+ const agentName = activity.from.name.trim();
19
+ const isSystemMessage = agentName === "__agent__" || agentName.startsWith("__") || ((_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : (_activity$channelData2 = _activity$channelData.tags) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.includes(Constants.systemMessageTag)) || ((_activity$tags = activity.tags) === null || _activity$tags === void 0 ? void 0 : _activity$tags.includes(Constants.systemMessageTag));
20
+ if (!isSystemMessage && agentName !== "") {
21
+ // Update initials for valid agent/bot names
22
+ const newInitials = getIconText(agentName) || currentAgentInitials;
23
+ currentAgentInitials = newInitials;
24
+ }
25
+ }
26
+ }
27
+ return next(action);
28
+ };
29
+ };
30
+ export const getOverriddenLocalizedStrings = existingOverrides => {
31
+ return strings => {
32
+ const result = {
33
+ ...strings,
34
+ ...existingOverrides
35
+ };
36
+
37
+ // Apply dynamic bot initials to alt text if not already overridden through props
38
+ if (!(existingOverrides !== null && existingOverrides !== void 0 && existingOverrides.ACTIVITY_BOT_SAID_ALT)) {
39
+ result.ACTIVITY_BOT_SAID_ALT = `${currentAgentInitials} said:`;
40
+ }
41
+ if (!(existingOverrides !== null && existingOverrides !== void 0 && existingOverrides.ACTIVITY_BOT_ATTACHED_ALT)) {
42
+ result.ACTIVITY_BOT_ATTACHED_ALT = `${currentAgentInitials} attached:`;
43
+ }
44
+ return result;
45
+ };
46
+ };
@@ -114,4 +114,13 @@ export const createTrackingMessage = (payload, type) => {
114
114
  type: type,
115
115
  checkTime: new Date().getTime()
116
116
  };
117
+ };
118
+ export const maskPayloadText = payload => {
119
+ if (!payload) {
120
+ return payload;
121
+ }
122
+ return {
123
+ ...payload,
124
+ text: "*contents hidden*"
125
+ };
117
126
  };
@@ -1,6 +1,6 @@
1
1
  import { BroadcastEvent, LogLevel, TelemetryEvent } from "../common/telemetry/TelemetryConstants";
2
2
  import { ScenarioType } from "../firstresponselatency/Constants";
3
- import { buildMessagePayload, getScenarioType, isHistoryMessage, polyfillMessagePayloadForEvent } from "../firstresponselatency/util";
3
+ import { buildMessagePayload, getScenarioType, isHistoryMessage, maskPayloadText, polyfillMessagePayloadForEvent } from "../firstresponselatency/util";
4
4
  import { BroadcastService } from "@microsoft/omnichannel-chat-components";
5
5
  import { Constants } from "../common/Constants";
6
6
  import { FirstResponseLatencyTracker } from "../firstresponselatency/FirstResponseLatencyTracker";
@@ -65,7 +65,7 @@ export const createOnNewAdapterActivityHandler = (chatId, userId, startTime) =>
65
65
  TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
66
66
  Event: TelemetryEvent.RehydrateMessageReceived,
67
67
  Description: "History message received",
68
- CustomProperties: payload
68
+ CustomProperties: maskPayloadText(payload)
69
69
  });
70
70
  }
71
71
  };
@@ -102,7 +102,7 @@ export const createOnNewAdapterActivityHandler = (chatId, userId, startTime) =>
102
102
  TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
103
103
  Event: TelemetryEvent.MessageReceived,
104
104
  Description: "New message received",
105
- CustomProperties: payload
105
+ CustomProperties: maskPayloadText(payload)
106
106
  });
107
107
  };
108
108
  const raiseMessageEvent = activity => {
@@ -177,6 +177,7 @@ export declare enum TelemetryEvent {
177
177
  ProcessingSanitizationMiddlewareFailed = "ProcessingSanitizationMiddlewareFailed",
178
178
  FormatTagsMiddlewareJSONStringifyFailed = "FormatTagsMiddlewareJSONStringifyFailed",
179
179
  AttachmentUploadValidatorMiddlewareFailed = "AttachmentUploadValidatorMiddlewareFailed",
180
+ CitationMiddlewareFailed = "CitationMiddlewareFailed",
180
181
  QueuePositionMessageRecieved = "QueuePositionMessageRecieved",
181
182
  AverageWaitTimeMessageRecieved = "AverageWaitTimeMessageRecieved",
182
183
  DataMaskingRuleApplied = "DataMaskingRuleApplied",
@@ -0,0 +1,5 @@
1
+ import { Dispatch } from "redux";
2
+ import { IWebChatAction } from "../../../interfaces/IWebChatAction";
3
+ export declare const createCitationsMiddleware: ({ dispatch }: {
4
+ dispatch: Dispatch<IWebChatAction>;
5
+ }) => (next: Dispatch<IWebChatAction>) => (action: IWebChatAction) => IWebChatAction;
@@ -0,0 +1,5 @@
1
+ import { IWebChatAction } from "../../../interfaces/IWebChatAction";
2
+ export declare const localizedStringsBotInitialsMiddleware: () => ({ dispatch }: {
3
+ dispatch: any;
4
+ }) => (next: any) => (action: IWebChatAction) => any;
5
+ export declare const getOverriddenLocalizedStrings: (existingOverrides?: any) => (strings: any) => any;
@@ -22,3 +22,4 @@ export declare const buildMessagePayload: (activity: IActivity, userId: string)
22
22
  export declare const polyfillMessagePayloadForEvent: (activity: IActivity, payload: MessagePayload, conversationId?: string) => MessagePayload;
23
23
  export declare const getScenarioType: (activity: IActivity) => ScenarioType;
24
24
  export declare const createTrackingMessage: (payload: MessagePayload, type: string) => TrackingMessage;
25
+ export declare const maskPayloadText: (payload: MessagePayload) => MessagePayload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.8.3-main.717ca8d",
3
+ "version": "1.8.3-main.ec1328d",
4
4
  "description": "Microsoft Omnichannel Chat Widget",
5
5
  "main": "lib/cjs/index.js",
6
6
  "types": "lib/types/index.d.ts",
@@ -144,7 +144,8 @@
144
144
  "**/abort-controller-es5": "^2.0.1",
145
145
  "**/minimist": "1.2.6",
146
146
  "**/sanitize-html": "2.14.0",
147
- "@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0"
147
+ "@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.cd77847.0",
148
+ "**/semver": "7.5.4"
148
149
  },
149
150
  "jest": {
150
151
  "verbose": true,