@microsoft/omnichannel-chat-widget 1.8.3-main.892e099 → 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.
@@ -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
@@ -44,10 +44,11 @@ var _htmlPlayerMiddleware = _interopRequireDefault(require("../../webchatcontain
44
44
  var _htmlTextMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware"));
45
45
  var _preProcessingMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware"));
46
46
  var _sanitizationMiddleware = _interopRequireDefault(require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"));
47
+ var _localizedStringsBotInitialsMiddleware = require("../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware");
47
48
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
48
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
49
50
  const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) => {
50
- 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;
51
52
  // Add a hook to make all links open a new window
52
53
  postDomPurifyActivities();
53
54
  const localizedTexts = {
@@ -122,7 +123,7 @@ const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) =>
122
123
  };
123
124
  webChatStore = (0, _botframeworkWebchat.createStore)({},
124
125
  //initial state
125
- _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)(),
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)(),
126
127
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
127
128
  ...(((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.storeMiddlewares) ?? []));
128
129
  _WebChatStoreLoader.WebChatStoreLoader.store = webChatStore;
@@ -176,7 +177,8 @@ const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) =>
176
177
  onTelemetry: (0, _WebChatLogger.createWebChatTelemetry)(),
177
178
  cardActionMiddleware: (0, _cardActionMiddleware.createCardActionMiddleware)(((_props$webChatContain25 = props.webChatContainerProps) === null || _props$webChatContain25 === void 0 ? void 0 : _props$webChatContain25.botMagicCode) || undefined),
178
179
  sendTypingIndicator: true,
179
- ...((_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)
180
182
  };
181
183
  return webChatProps;
182
184
  };
@@ -295,6 +295,23 @@ const WebChatContainerStateful = props => {
295
295
  overflow-y: unset;
296
296
  }
297
297
 
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
+
298
315
  `), /*#__PURE__*/_react2.default.createElement(_react.Stack, {
299
316
  styles: containerStyles,
300
317
  className: "webchat__stacked-layout_container"
@@ -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;
@@ -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
@@ -39,10 +39,11 @@ import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroll
39
39
  import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
40
40
  import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
41
41
  import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
42
+ import { localizedStringsBotInitialsMiddleware, getOverriddenLocalizedStrings } from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware";
42
43
 
43
44
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
44
45
  export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endChat) => {
45
- 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;
46
47
  // Add a hook to make all links open a new window
47
48
  postDomPurifyActivities();
48
49
  const localizedTexts = {
@@ -117,7 +118,7 @@ export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endCh
117
118
  };
118
119
  webChatStore = createStore({},
119
120
  //initial state
120
- 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(),
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(),
121
122
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
122
123
  ...(((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.storeMiddlewares) ?? []));
123
124
  WebChatStoreLoader.store = webChatStore;
@@ -171,7 +172,8 @@ export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endCh
171
172
  onTelemetry: createWebChatTelemetry(),
172
173
  cardActionMiddleware: createCardActionMiddleware(((_props$webChatContain25 = props.webChatContainerProps) === null || _props$webChatContain25 === void 0 ? void 0 : _props$webChatContain25.botMagicCode) || undefined),
173
174
  sendTypingIndicator: true,
174
- ...((_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)
175
177
  };
176
178
  return webChatProps;
177
179
  };
@@ -287,6 +287,23 @@ export const WebChatContainerStateful = props => {
287
287
  overflow-y: unset;
288
288
  }
289
289
 
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
+
290
307
  `), /*#__PURE__*/React.createElement(Stack, {
291
308
  styles: containerStyles,
292
309
  className: "webchat__stacked-layout_container"
@@ -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
+ };
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@microsoft/omnichannel-chat-widget",
3
- "version": "1.8.3-main.892e099",
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,