@microsoft/omnichannel-chat-widget 0.1.0-main.4188c11 → 0.1.0-main.592da7b

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 (62) hide show
  1. package/README.md +32 -0
  2. package/lib/cjs/common/Constants.js +14 -2
  3. package/lib/cjs/common/telemetry/TelemetryConstants.js +15 -3
  4. package/lib/cjs/common/utils.js +16 -2
  5. package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +19 -3
  6. package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +10 -1
  7. package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +7 -1
  8. package/lib/cjs/components/livechatwidget/common/endChat.js +24 -6
  9. package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +8 -3
  10. package/lib/cjs/components/livechatwidget/common/startChat.js +86 -31
  11. package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +142 -45
  12. package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -6
  13. package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
  14. package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +80 -0
  15. package/lib/cjs/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  16. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +14 -0
  17. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
  18. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +52 -0
  19. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +98 -0
  20. package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +117 -0
  21. package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +2 -0
  22. package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -1
  23. package/lib/cjs/contexts/createReducer.js +8 -0
  24. package/lib/cjs/controller/componentController.js +1 -1
  25. package/lib/esm/common/Constants.js +14 -2
  26. package/lib/esm/common/telemetry/TelemetryConstants.js +15 -3
  27. package/lib/esm/common/utils.js +7 -0
  28. package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +21 -6
  29. package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -2
  30. package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +7 -1
  31. package/lib/esm/components/livechatwidget/common/endChat.js +21 -6
  32. package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +7 -4
  33. package/lib/esm/components/livechatwidget/common/startChat.js +85 -34
  34. package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +134 -46
  35. package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +7 -8
  36. package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +17 -1
  37. package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +72 -0
  38. package/lib/esm/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.js +1 -0
  39. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +5 -0
  40. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +16 -2
  41. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.js +41 -0
  42. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.js +94 -0
  43. package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.js +107 -0
  44. package/lib/esm/contexts/common/LiveChatWidgetActionType.js +2 -0
  45. package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -1
  46. package/lib/esm/contexts/createReducer.js +8 -0
  47. package/lib/esm/controller/componentController.js +1 -1
  48. package/lib/types/common/Constants.d.ts +7 -1
  49. package/lib/types/common/interfaces/IContextDataStore.d.ts +1 -1
  50. package/lib/types/common/telemetry/TelemetryConstants.d.ts +16 -4
  51. package/lib/types/common/utils.d.ts +2 -0
  52. package/lib/types/components/livechatwidget/common/endChat.d.ts +1 -1
  53. package/lib/types/components/livechatwidget/common/startChat.d.ts +2 -1
  54. package/lib/types/components/webchatcontainerstateful/interfaces/IBotMagicCodeConfig.d.ts +4 -0
  55. package/lib/types/components/webchatcontainerstateful/interfaces/IWebChatContainerStatefulProps.d.ts +2 -0
  56. package/lib/types/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.d.ts +3 -0
  57. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.d.ts +2 -0
  58. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware.spec.d.ts +1 -0
  59. package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware.d.ts +5 -0
  60. package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
  61. package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +3 -1
  62. package/package.json +2 -2
@@ -0,0 +1,98 @@
1
+ "use strict";
2
+
3
+ require("@testing-library/jest-dom/extend-expect");
4
+
5
+ var _cardActionMiddleware = require("./cardActionMiddleware");
6
+
7
+ describe("cardActionMiddleware test", () => {
8
+ it("createCardActionMiddleware() with undefined botMagicCodeConfig should not change the sign in card url", () => {
9
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
10
+
11
+
12
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
13
+ const args = {
14
+ cardAction: {
15
+ type: "signin",
16
+ value: signInUrl
17
+ }
18
+ };
19
+ const results = (0, _cardActionMiddleware.createCardActionMiddleware)(undefined)()(next)(args);
20
+ expect(signInUrl).toEqual(results.cardAction.value);
21
+ });
22
+ it("createCardActionMiddleware() with botMagicCode enabled should not change the sign in card url", () => {
23
+ const botMagicCodeConfig = {
24
+ disabled: false
25
+ };
26
+
27
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
28
+
29
+
30
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
31
+ const args = {
32
+ cardAction: {
33
+ type: "signin",
34
+ value: signInUrl
35
+ }
36
+ };
37
+ const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
38
+ expect(args.cardAction.value).toEqual(results.cardAction.value);
39
+ });
40
+ it("createCardActionMiddleware() with botMagicCode disabled & no fwdUrl should not change the sign in card url", () => {
41
+ const botMagicCodeConfig = {
42
+ disabled: true
43
+ };
44
+
45
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
46
+
47
+
48
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
49
+ const args = {
50
+ cardAction: {
51
+ type: "signin",
52
+ value: signInUrl
53
+ }
54
+ };
55
+ const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
56
+ expect(args.cardAction.value).toEqual(results.cardAction.value);
57
+ });
58
+ it("createCardActionMiddleware() with botMagicCode disabled & fwdUrl should append the fwdUrl in the sign in card url", () => {
59
+ const botMagicCodeConfig = {
60
+ disabled: true,
61
+ fwdUrl: "http://localhost/forwarder.html"
62
+ };
63
+
64
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
65
+
66
+
67
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
68
+ const args = {
69
+ cardAction: {
70
+ type: "signin",
71
+ value: signInUrl
72
+ }
73
+ };
74
+ const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
75
+ expect(signInUrl === results.cardAction.value).toBe(false);
76
+ expect(results.cardAction.value === `${signInUrl}&fwdUrl=${botMagicCodeConfig.fwdUrl}`).toBe(true);
77
+ });
78
+ it("createCardActionMiddleware() should not append fwdUrl if fwdUrl & sign in card url are not in the same domain", () => {
79
+ const botMagicCodeConfig = {
80
+ disabled: true,
81
+ fwdUrl: "https://localhost/forwarder.html"
82
+ };
83
+
84
+ const next = args => args; // eslint-disable-line @typescript-eslint/no-explicit-any
85
+
86
+
87
+ const signInUrl = "https://token.botframework.com/api/oauth/signin?signin=[signin]";
88
+ const args = {
89
+ cardAction: {
90
+ type: "signin",
91
+ value: signInUrl
92
+ }
93
+ };
94
+ const results = (0, _cardActionMiddleware.createCardActionMiddleware)(botMagicCodeConfig)()(next)(args);
95
+ expect(signInUrl === results.cardAction.value).toBe(true);
96
+ expect(results.cardAction.value === `${signInUrl}&fwdUrl=${botMagicCodeConfig.fwdUrl}`).toBe(false);
97
+ });
98
+ });
@@ -0,0 +1,117 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _WebChatActionType = require("../../enums/WebChatActionType");
9
+
10
+ var _Constants = require("../../../../../common/Constants");
11
+
12
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
13
+ const createMessageTimeStampMiddleware = _ref => {
14
+ let {
15
+ dispatch
16
+ } = _ref;
17
+ return next => action => {
18
+ if (isApplicable(action)) {
19
+ return next(evaluateTagsAndOverrideTimeStamp(action));
20
+ }
21
+
22
+ return next(action);
23
+ };
24
+ };
25
+
26
+ const isApplicable = action => {
27
+ return action.type === _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && isPVAConversation(action) && isPayloadValid(action) && isValidChannel(action);
28
+ };
29
+
30
+ const isPayloadValid = action => {
31
+ var _action$payload;
32
+
33
+ return action === null || action === void 0 ? void 0 : (_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : _action$payload.activity;
34
+ };
35
+
36
+ const isValidChannel = action => {
37
+ var _action$payload2, _action$payload2$acti;
38
+
39
+ return (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.channelId) === _Constants.Constants.acsChannel;
40
+ };
41
+
42
+ const isPVAConversation = action => {
43
+ return !isTagIncluded(action, _Constants.Constants.systemMessageTag) && !isTagIncluded(action, _Constants.Constants.publicMessageTag) && !isRoleUserOn(action);
44
+ }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
45
+
46
+
47
+ const isTagIncluded = (action, tag) => {
48
+ return isDataTagsPresent(action) && action.payload.activity.channelData.tags.includes(tag);
49
+ };
50
+
51
+ const isRoleUserOn = action => {
52
+ var _action$payload3, _action$payload3$acti, _action$payload3$acti2;
53
+
54
+ return (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$acti2 = _action$payload3$acti.from) === null || _action$payload3$acti2 === void 0 ? void 0 : _action$payload3$acti2.role) === _Constants.Constants.userMessageTag;
55
+ };
56
+
57
+ const overrideTimeStamp = (timestampOriginal, timeStampNew) => {
58
+ return isTimestampValid(timeStampNew) ? timeStampNew : timestampOriginal;
59
+ };
60
+
61
+ const isTimestampValid = timeStamp => {
62
+ const regex = /(\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])(T)(\d{2})(:{1})(\d{2})(:{1})(\d{2})(.\d+)([Z]{1}))/;
63
+ return regex.test(timeStamp);
64
+ };
65
+
66
+ const isDataTagsPresent = action => {
67
+ var _action$payload4, _action$payload4$acti, _action$payload4$acti2;
68
+
69
+ return (action === null || action === void 0 ? void 0 : (_action$payload4 = action.payload) === null || _action$payload4 === void 0 ? void 0 : (_action$payload4$acti = _action$payload4.activity) === null || _action$payload4$acti === void 0 ? void 0 : (_action$payload4$acti2 = _action$payload4$acti.channelData) === null || _action$payload4$acti2 === void 0 ? void 0 : _action$payload4$acti2.tags) && action.payload.activity.channelData.tags.length > 0;
70
+ };
71
+
72
+ const evaluateTagsAndOverrideTimeStamp = action => {
73
+ const tagValue = tagLookup(action, _Constants.Constants.prefixTimestampTag);
74
+
75
+ if (tagValue) {
76
+ const newTimestamp = extractTimeStamp(tagValue);
77
+ action.payload.activity.timestamp = overrideTimeStamp(action.payload.activity.timestamp, newTimestamp);
78
+ }
79
+
80
+ return action;
81
+ };
82
+
83
+ const extractTimeStamp = timeStamp => {
84
+ if (timeStamp && timeStamp.length > 0) {
85
+ const ts = timeStamp.split(_Constants.Constants.prefixTimestampTag);
86
+
87
+ if (ts && ts.length > 1) {
88
+ return ts[1];
89
+ }
90
+ }
91
+
92
+ return timeStamp;
93
+ };
94
+
95
+ const tagLookup = (action, tag) => {
96
+ if (!isDataTagsPresent(action)) {
97
+ return null;
98
+ }
99
+
100
+ const tags = action.payload.activity.channelData.tags;
101
+ let value;
102
+
103
+ if (tags && tags.length > 0) {
104
+ for (let i = 0; i < tags.length; i++) {
105
+ value = tags[i];
106
+
107
+ if (value && value.indexOf(tag) > -1) {
108
+ return value;
109
+ }
110
+ }
111
+ }
112
+
113
+ return null;
114
+ };
115
+
116
+ var _default = createMessageTimeStampMiddleware;
117
+ exports.default = _default;
@@ -39,4 +39,6 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
39
39
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT"] = 28] = "SET_CONVERSATION_ENDED_BY_AGENT";
40
40
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 29] = "SET_WIDGET_STATE";
41
41
  LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 30] = "SET_LIVE_CHAT_CONTEXT";
42
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 31] = "SET_BOT_OAUTH_SIGNIN_ID";
43
+ LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 32] = "SET_WIDGET_SIZE";
42
44
  })(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
@@ -28,7 +28,8 @@ const getLiveChatWidgetContextInitialState = props => {
28
28
  telemetryInternalData: {},
29
29
  globalDir: "ltr",
30
30
  liveChatContext: undefined,
31
- customContext: undefined
31
+ customContext: undefined,
32
+ widgetSize: undefined
32
33
  },
33
34
  appStates: {
34
35
  conversationState: _ConversationState.ConversationState.Closed,
@@ -235,6 +235,14 @@ const createReducer = () => {
235
235
  }
236
236
  };
237
237
 
238
+ case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_SIZE:
239
+ return { ...state,
240
+ domainStates: { ...state.domainStates,
241
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
242
+ widgetSize: action.payload
243
+ }
244
+ };
245
+
238
246
  default:
239
247
  return state;
240
248
  }
@@ -8,7 +8,7 @@ exports.shouldShowWebChatContainer = exports.shouldShowReconnectChatPane = expor
8
8
  var _ConversationState = require("../contexts/common/ConversationState");
9
9
 
10
10
  const shouldShowChatButton = state => {
11
- return state.appStates.isMinimized || state.appStates.conversationState === _ConversationState.ConversationState.Closed;
11
+ return (state.appStates.isMinimized || state.appStates.conversationState === _ConversationState.ConversationState.Closed) && state.appStates.skipChatButtonRendering == false; // Do not show chat button in case of popout
12
12
  };
13
13
 
14
14
  exports.shouldShowChatButton = shouldShowChatButton;
@@ -4,6 +4,10 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
4
4
 
5
5
  export class Constants {}
6
6
 
7
+ _defineProperty(Constants, "magicCodeBroadcastChannel", "MagicCodeChannel");
8
+
9
+ _defineProperty(Constants, "magicCodeResponseBroadcastChannel", "MagicCodeResponseChannel");
10
+
7
11
  _defineProperty(Constants, "systemMessageTag", "system");
8
12
 
9
13
  _defineProperty(Constants, "userMessageTag", "user");
@@ -36,8 +40,6 @@ _defineProperty(Constants, "false", "false");
36
40
 
37
41
  _defineProperty(Constants, "maximumUnreadMessageCount", 99);
38
42
 
39
- _defineProperty(Constants, "widgetStateDataKey", "LcwChatWidgetState");
40
-
41
43
  _defineProperty(Constants, "channelIdKey", "ChannelId-");
42
44
 
43
45
  _defineProperty(Constants, "ChannelId", "lcw");
@@ -72,6 +74,14 @@ _defineProperty(Constants, "averageWaitTimeMessageTag", "averagewaittime");
72
74
 
73
75
  _defineProperty(Constants, "message", "message");
74
76
 
77
+ _defineProperty(Constants, "hiddenTag", "Hidden");
78
+
79
+ _defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
80
+
81
+ _defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
82
+
83
+ _defineProperty(Constants, "publicMessageTag", "public");
84
+
75
85
  _defineProperty(Constants, "supportedAdaptiveCardContentTypes", ["application/vnd.microsoft.card.adaptive", "application/vnd.microsoft.card.audio", "application/vnd.microsoft.card.hero", "application/vnd.microsoft.card.receipt", "application/vnd.microsoft.card.thumbnail", "application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"]);
76
86
 
77
87
  _defineProperty(Constants, "maxUploadFileSize", "500000");
@@ -146,6 +156,8 @@ _defineProperty(Constants, "internetConnectionTestUrl", "https://ocsdk-prod.azur
146
156
 
147
157
  _defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect Test");
148
158
 
159
+ _defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
160
+
149
161
  export const Regex = (_class = class Regex {}, _defineProperty(_class, "EmailRegex", "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"), _class);
150
162
  export class HtmlIdNames {}
151
163
 
@@ -26,19 +26,28 @@ export let BroadcastEvent; // Events being logged
26
26
 
27
27
  (function (BroadcastEvent) {
28
28
  BroadcastEvent["LoadPostChatSurvey"] = "LoadPostChatSurvey";
29
- BroadcastEvent["EndChat"] = "ChatEnded";
29
+ BroadcastEvent["ChatEnded"] = "ChatEnded";
30
30
  BroadcastEvent["NewMessageNotification"] = "NewMessageNotification";
31
31
  BroadcastEvent["UnreadMessageCount"] = "UnreadMessageCount";
32
- BroadcastEvent["ChatWidgetStateChanged"] = "ChatWidgetStateChanged";
32
+ BroadcastEvent["StartProactiveChat"] = "StartProactiveChat";
33
33
  BroadcastEvent["ProactiveChatStartChat"] = "ProactiveChatStartChat";
34
34
  BroadcastEvent["ProactiveChatStartPopoutChat"] = "ProactiveChatStartPopoutChat";
35
+ BroadcastEvent["ProactiveChatIsInPopoutMode"] = "ProactiveChatIsInPopoutMode";
36
+ BroadcastEvent["ResetProactiveChatParams"] = "ResetProactiveChatParams";
35
37
  BroadcastEvent["InvalidAdaptiveCardFormat"] = "InvalidAdaptiveCardFormat";
36
38
  BroadcastEvent["NewMessageSent"] = "NewMessageSent";
37
39
  BroadcastEvent["NewMessageReceived"] = "NewMessageReceived";
38
40
  BroadcastEvent["RedirectPageRequest"] = "RedirectPageRequest";
41
+ BroadcastEvent["StartChat"] = "StartChat";
39
42
  BroadcastEvent["StartChatSkippingChatButtonRendering"] = "StartChatSkippingChatButtonRendering";
40
43
  BroadcastEvent["StartUnauthenticatedReconnectChat"] = "StartUnauthenticatedReconnectChat";
44
+ BroadcastEvent["InitiateEndChat"] = "InitiateEndChat";
41
45
  BroadcastEvent["SetCustomContext"] = "SetCustomContext";
46
+ BroadcastEvent["ChatRetrievedFromCache"] = "ChatRetrievedFromCache";
47
+ BroadcastEvent["MaximizeChat"] = "MaximizeChat";
48
+ BroadcastEvent["ChatInitiated"] = "ChatInitiated";
49
+ BroadcastEvent["CloseChat"] = "CloseChat";
50
+ BroadcastEvent["InitiateEndChatOnBrowserUnload"] = "InitiateEndChatOnBrowserUnload";
42
51
  })(BroadcastEvent || (BroadcastEvent = {}));
43
52
 
44
53
  export let TelemetryEvent;
@@ -90,8 +99,9 @@ export let TelemetryEvent;
90
99
  TelemetryEvent["PrechatSubmitted"] = "PrechatSubmitted";
91
100
  TelemetryEvent["StartChatSDKCall"] = "StartChatCall";
92
101
  TelemetryEvent["StartChatEventRecevied"] = "StartChatEventReceived";
93
- TelemetryEvent["EndChatSDKCall"] = "EndChatCall";
102
+ TelemetryEvent["EndChatSDKCall"] = "EndChatSDKCall";
94
103
  TelemetryEvent["EndChatEventReceived"] = "EndChatEventReceived";
104
+ TelemetryEvent["WindowClosed"] = "WindowClosed";
95
105
  TelemetryEvent["OnNewMessageFailed"] = "OnNewMessageFailed";
96
106
  TelemetryEvent["OnNewMessageAudioNotificationFailed"] = "OnNewMessageAudioNotificationFailed";
97
107
  TelemetryEvent["DownloadTranscriptResponseNullOrUndefined"] = "DownloadTranscriptResponseNullOrUndefined";
@@ -116,6 +126,8 @@ export let TelemetryEvent;
116
126
  TelemetryEvent["EmailTranscriptButtonClicked"] = "EmailTranscriptButtonClicked";
117
127
  TelemetryEvent["EmailTranscriptCancelButtonClicked"] = "EmailTranscriptCancelButtonClicked";
118
128
  TelemetryEvent["AudioToggleButtonClicked"] = "AudioToggleButtonClicked";
129
+ TelemetryEvent["SuppressBotMagicCodeSucceeded"] = "SuppressBotMagicCodeSucceeded";
130
+ TelemetryEvent["SuppressBotMagicCodeFailed"] = "SuppressBotMagicCodeFailed";
119
131
  TelemetryEvent["ProcessingHTMLTextMiddlewareFailed"] = "ProcessingHTMLTextMiddlewareFailed";
120
132
  TelemetryEvent["ProcessingSanitizationMiddlewareFailed"] = "ProcessingSanitizationMiddlewareFailed";
121
133
  TelemetryEvent["FormatTagsMiddlewareJSONStringifyFailed"] = "FormatTagsMiddlewareJSONStringifyFailed";
@@ -1,5 +1,6 @@
1
1
  import { AriaTelemetryConstants, Constants, LocaleConstants } from "./Constants";
2
2
  import { KeyCodes } from "./KeyCodes";
3
+ import { BroadcastEvent } from "./telemetry/TelemetryConstants";
3
4
 
4
5
  const getElementBySelector = selector => {
5
6
  let element;
@@ -287,4 +288,10 @@ export const getDomain = hostValue => {
287
288
  }
288
289
 
289
290
  return AriaTelemetryConstants.Public;
291
+ };
292
+ export const getWidgetCacheId = (orgId, widgetId) => {
293
+ return `${Constants.ChatWidgetStateChangedPrefix}_${orgId}_${widgetId}`;
294
+ };
295
+ export const getWidgetEndChatEventName = (orgId, widgetId) => {
296
+ return `${BroadcastEvent.ChatEnded}_${orgId}_${widgetId}`;
290
297
  };
@@ -1,6 +1,6 @@
1
- import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
- import React, { useEffect, useState } from "react";
3
- import { ChatButton } from "@microsoft/omnichannel-chat-components";
1
+ import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
2
+ import React, { useEffect, useRef, useState } from "react";
3
+ import { BroadcastService, ChatButton } from "@microsoft/omnichannel-chat-components";
4
4
  import { Constants } from "../../common/Constants";
5
5
  import { setFocusOnElement } from "../../common/utils";
6
6
  import { ConversationState } from "../../contexts/common/ConversationState";
@@ -10,7 +10,7 @@ import { TelemetryTimers } from "../../common/telemetry/TelemetryManager";
10
10
  import { defaultOutOfOfficeChatButtonStyleProps } from "./common/styleProps/defaultOutOfOfficeChatButtonStyleProps";
11
11
  import useChatContextStore from "../../hooks/useChatContextStore";
12
12
  export const ChatButtonStateful = props => {
13
- var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP;
13
+ var _state$domainStates$l, _state$domainStates$l2, _buttonProps$controlP, _props$buttonProps, _props$buttonProps$co, _props$buttonProps2, _props$buttonProps2$c, _props$buttonProps3, _props$buttonProps3$c;
14
14
 
15
15
  const [state, dispatch] = useChatContextStore();
16
16
  const {
@@ -20,6 +20,7 @@ export const ChatButtonStateful = props => {
20
20
  } = props; //Setting OutOfOperatingHours Flag
21
21
 
22
22
  const [outOfOperatingHours, setOutOfOperatingHours] = useState(((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.OutOfOperatingHours) === "True");
23
+ const proactiveChatInNewWindow = useRef(state.appStates.proactiveChatStates.proactiveChatInNewWindow);
23
24
  const outOfOfficeStyleProps = Object.assign({}, defaultOutOfOfficeChatButtonStyleProps, outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.styleProps);
24
25
  const controlProps = {
25
26
  id: "oc-lcw-chat-button",
@@ -27,13 +28,18 @@ export const ChatButtonStateful = props => {
27
28
  titleText: "Let's Chat!",
28
29
  subtitleText: "We're online.",
29
30
  hideNotificationBubble: (buttonProps === null || buttonProps === void 0 ? void 0 : (_buttonProps$controlP = buttonProps.controlProps) === null || _buttonProps$controlP === void 0 ? void 0 : _buttonProps$controlP.hideNotificationBubble) === true || state.appStates.isMinimized === false,
30
- unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ? Constants.maximumUnreadMessageCount.toString() + "+" : state.appStates.unreadMessageCount.toString() : "0",
31
+ unreadMessageCount: state.appStates.unreadMessageCount ? state.appStates.unreadMessageCount > Constants.maximumUnreadMessageCount ? (_props$buttonProps = props.buttonProps) === null || _props$buttonProps === void 0 ? void 0 : (_props$buttonProps$co = _props$buttonProps.controlProps) === null || _props$buttonProps$co === void 0 ? void 0 : _props$buttonProps$co.largeUnreadMessageString : state.appStates.unreadMessageCount.toString() : "0",
31
32
  onClick: async () => {
32
33
  TelemetryHelper.logActionEvent(LogLevel.INFO, {
33
34
  Event: TelemetryEvent.LCWChatButtonClicked
34
35
  });
35
36
 
36
- if (state.appStates.isMinimized) {
37
+ if (proactiveChatInNewWindow.current) {
38
+ const proactiveChatIsInPopoutModeEvent = {
39
+ eventName: BroadcastEvent.ProactiveChatIsInPopoutMode
40
+ };
41
+ BroadcastService.postMessage(proactiveChatIsInPopoutModeEvent);
42
+ } else if (state.appStates.isMinimized) {
37
43
  dispatch({
38
44
  type: LiveChatWidgetActionType.SET_MINIMIZED,
39
45
  payload: false
@@ -42,6 +48,7 @@ export const ChatButtonStateful = props => {
42
48
  await startChat();
43
49
  }
44
50
  },
51
+ unreadMessageString: (_props$buttonProps2 = props.buttonProps) === null || _props$buttonProps2 === void 0 ? void 0 : (_props$buttonProps2$c = _props$buttonProps2.controlProps) === null || _props$buttonProps2$c === void 0 ? void 0 : _props$buttonProps2$c.unreadMessageString,
45
52
  ...(buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.controlProps)
46
53
  };
47
54
  const outOfOfficeControlProps = {
@@ -50,6 +57,10 @@ export const ChatButtonStateful = props => {
50
57
  titleText: "We're Offline",
51
58
  subtitleText: "No agents available",
52
59
  onClick: async () => {
60
+ TelemetryHelper.logActionEvent(LogLevel.INFO, {
61
+ Event: TelemetryEvent.LCWChatButtonClicked
62
+ });
63
+
53
64
  if (state.appStates.isMinimized) {
54
65
  dispatch({
55
66
  type: LiveChatWidgetActionType.SET_MINIMIZED,
@@ -62,6 +73,7 @@ export const ChatButtonStateful = props => {
62
73
  });
63
74
  }
64
75
  },
76
+ unreadMessageString: (_props$buttonProps3 = props.buttonProps) === null || _props$buttonProps3 === void 0 ? void 0 : (_props$buttonProps3$c = _props$buttonProps3.controlProps) === null || _props$buttonProps3$c === void 0 ? void 0 : _props$buttonProps3$c.unreadMessageString,
65
77
  ...(outOfOfficeButtonProps === null || outOfOfficeButtonProps === void 0 ? void 0 : outOfOfficeButtonProps.controlProps)
66
78
  };
67
79
  useEffect(() => {
@@ -83,6 +95,9 @@ export const ChatButtonStateful = props => {
83
95
  });
84
96
  }
85
97
  }, []);
98
+ useEffect(() => {
99
+ proactiveChatInNewWindow.current = state.appStates.proactiveChatStates.proactiveChatInNewWindow;
100
+ }, [state.appStates.proactiveChatStates.proactiveChatInNewWindow]);
86
101
  return /*#__PURE__*/React.createElement(ChatButton, {
87
102
  componentOverrides: buttonProps === null || buttonProps === void 0 ? void 0 : buttonProps.componentOverrides,
88
103
  controlProps: outOfOperatingHours ? outOfOfficeControlProps : controlProps,
@@ -105,8 +105,14 @@ const beautifyChatTranscripts = (chatTranscripts, renderMarkDown, attachmentMess
105
105
  let fileAttachmentName = TranscriptConstants.DefaultFileAttachmentName;
106
106
  let dialogColor = TranscriptConstants.CustomerDialogColor;
107
107
  let fontColor = TranscriptConstants.CustomerFontColor;
108
-
109
- if (value.tags && value.tags.toLowerCase().indexOf(Constants.systemMessageTag) !== -1 || value.isControlMessage && value.isControlMessage === true || value.contentType && value.contentType.toLowerCase() === TranscriptConstants.AdaptiveCardType || value.deliveryMode && value.deliveryMode.toLowerCase() === TranscriptConstants.InternalMode) {
108
+ const isSystemMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.systemMessageTag) !== -1;
109
+ const isControlMessage = value.isControlMessage && value.isControlMessage === true;
110
+ const isAdaptiveCard = value.contentType && value.contentType.toLowerCase() === TranscriptConstants.AdaptiveCardType;
111
+ const isInternalMessage = value.deliveryMode && value.deliveryMode.toLowerCase() === TranscriptConstants.InternalMode;
112
+ const isHiddenMessage = value.tags && value.tags.toLowerCase().indexOf(Constants.hiddenTag.toLowerCase()) !== -1;
113
+ const shouldIgnoreMessage = isSystemMessage || isControlMessage || isAdaptiveCard || isInternalMessage || isHiddenMessage;
114
+
115
+ if (shouldIgnoreMessage) {
110
116
  return;
111
117
  } else if (value.from) {
112
118
  if (value.from.application) {
@@ -316,7 +316,9 @@ export const dummyDefaultProps = {
316
316
  hideChatTextContainer: false,
317
317
  hideChatSubtitle: false,
318
318
  hideChatTitle: false,
319
- hideNotificationBubble: true
319
+ hideNotificationBubble: true,
320
+ unreadMessageString: "new messages",
321
+ largeUnreadMessageString: "99+"
320
322
  },
321
323
  styleProps: {
322
324
  generalStyleProps: {
@@ -1676,6 +1678,10 @@ export const dummyDefaultProps = {
1676
1678
  MIDDLEWARE_MESSAGE_RETRY: "Retry",
1677
1679
  PRECHAT_REQUIRED_FIELD_MISSING_MESSAGE: "{0} field is required",
1678
1680
  MARKDOWN_EXTERNAL_LINK_ALT: "Opens in a new window; external."
1681
+ },
1682
+ botMagicCode: {
1683
+ disabled: false,
1684
+ fwdUrl: ""
1679
1685
  }
1680
1686
  },
1681
1687
  telemetryConfig: undefined
@@ -7,8 +7,8 @@ import { WebChatStoreLoader } from "../../webchatcontainerstateful/webchatcontro
7
7
  import { defaultWebChatContainerStatefulProps } from "../../webchatcontainerstateful/common/defaultProps/defaultWebChatContainerStatefulProps";
8
8
  import { PostChatSurveyMode } from "../../postchatsurveypanestateful/enums/PostChatSurveyMode";
9
9
  import { Constants } from "../../../common/Constants";
10
+ import { getWidgetEndChatEventName } from "../../../common/utils"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
10
11
 
11
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
12
12
  const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, state) => {
13
13
  var _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4;
14
14
 
@@ -19,7 +19,7 @@ const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, disp
19
19
  if (isPostChatEnabled === "true" && (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.canRenderPostChat) === Constants.truePascal) {
20
20
  const skipEndChatSDK = false;
21
21
  const skipCloseChat = true;
22
- await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat);
22
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, true);
23
23
 
24
24
  if (postChatSurveyMode === PostChatSurveyMode.Embed) {
25
25
  const loadPostChatEvent = {
@@ -33,12 +33,12 @@ const prepareEndChat = async (props, chatSDK, setAdapter, setWebChatStyles, disp
33
33
  });
34
34
  }
35
35
  } else {
36
- await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter);
36
+ await endChat(props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, false, false, true);
37
37
  }
38
38
  }; // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
39
 
40
40
 
41
- const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat) => {
41
+ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, adapter, skipEndChatSDK, skipCloseChat, postMessageToOtherTab) => {
42
42
  if (!skipEndChatSDK) {
43
43
  try {
44
44
  TelemetryHelper.logSDKEvent(LogLevel.INFO, {
@@ -46,6 +46,10 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
46
46
  });
47
47
  await (chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.endChat()); // Need to clear these states immediately when chat ended from OC.
48
48
 
49
+ dispatch({
50
+ type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
51
+ payload: undefined
52
+ });
49
53
  dispatch({
50
54
  type: LiveChatWidgetActionType.SET_CHAT_TOKEN,
51
55
  payload: undefined
@@ -61,6 +65,7 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
61
65
  exception: ex
62
66
  }
63
67
  });
68
+ postMessageToOtherTab = false;
64
69
  }
65
70
  }
66
71
 
@@ -90,9 +95,19 @@ const endChat = async (props, chatSDK, setAdapter, setWebChatStyles, dispatch, a
90
95
  type: LiveChatWidgetActionType.SET_AUDIO_NOTIFICATION,
91
96
  payload: null
92
97
  });
93
- BroadcastService.postMessage({
94
- eventName: BroadcastEvent.EndChat
98
+ dispatch({
99
+ type: LiveChatWidgetActionType.SET_UNREAD_MESSAGE_COUNT,
100
+ payload: 0
95
101
  });
102
+
103
+ if (postMessageToOtherTab) {
104
+ var _chatSDK$omnichannelC, _chatSDK$omnichannelC2;
105
+
106
+ const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC === void 0 ? void 0 : _chatSDK$omnichannelC.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.widgetId);
107
+ BroadcastService.postMessage({
108
+ eventName: endChatEventName
109
+ });
110
+ }
96
111
  } catch (error) {
97
112
  TelemetryHelper.logActionEvent(LogLevel.ERROR, {
98
113
  Event: TelemetryEvent.CloseChatMethodException,
@@ -26,10 +26,12 @@ import gifUploadMiddleware from "../../webchatcontainerstateful/webchatcontrolle
26
26
  import htmlPlayerMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlPlayerMiddleware";
27
27
  import htmlTextMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware";
28
28
  import preProcessingMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/preProcessingMiddleware";
29
- import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
+ import sanitizationMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/sanitizationMiddleware";
30
+ import { createCardActionMiddleware } from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/cardActionMiddleware";
31
+ import createMessageTimeStampMiddleware from "../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/messageTimestampMiddleware"; // eslint-disable-next-line @typescript-eslint/no-explicit-any
30
32
 
31
33
  export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatStyles) => {
32
- var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21;
34
+ var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _state$domainStates$l, _state$domainStates$l2, _state$domainStates$l3, _state$domainStates$l4, _state$domainStates$l8, _state$domainStates$l9, _props$webChatContain7, _props$webChatContain8, _state$domainStates$r, _state$domainStates$r2, _props$webChatContain9, _props$webChatContain10, _state$domainStates$r3, _state$domainStates$r4, _props$webChatContain11, _props$webChatContain12, _defaultWebChatContai, _props$webChatContain13, _props$webChatContain14, _props$webChatContain15, _props$webChatContain16, _state$domainStates$r5, _state$domainStates$r6, _props$webChatContain17, _props$webChatContain18, _defaultWebChatContai2, _props$webChatContain19, _props$webChatContain20, _defaultWebChatContai3, _props$webChatContain21, _props$webChatContain22;
33
35
 
34
36
  const localizedTexts = { ...defaultMiddlewareLocalizedTexts,
35
37
  ...((_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.localizedTexts)
@@ -91,7 +93,7 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
91
93
  };
92
94
 
93
95
  webChatStore = createStore({}, //initial state
94
- preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), channelDataMiddleware, createConversationEndMiddleware(conversationEndCallback), createDataMaskingMiddleware((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware, createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
+ preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l5 = state.domainStates.liveChatConfig) === null || _state$domainStates$l5 === void 0 ? void 0 : _state$domainStates$l5.allowedFileExtensions, (_state$domainStates$l6 = state.domainStates.liveChatConfig) === null || _state$domainStates$l6 === void 0 ? void 0 : _state$domainStates$l6.maxUploadFileSize, localizedTexts), channelDataMiddleware, createConversationEndMiddleware(conversationEndCallback), createDataMaskingMiddleware((_state$domainStates$l7 = state.domainStates.liveChatConfig) === null || _state$domainStates$l7 === void 0 ? void 0 : _state$domainStates$l7.DataMaskingInfo), createMessageTimeStampMiddleware, gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware, createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, // eslint-disable-next-line @typescript-eslint/no-explicit-any
95
97
  ...(((_props$webChatContain6 = props.webChatContainerProps) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.storeMiddlewares) ?? []));
96
98
  WebChatStoreLoader.store = webChatStore;
97
99
  } // Initialize the remaining Web Chat props
@@ -109,7 +111,8 @@ export const initWebChatComposer = (props, chatSDK, state, dispatch, setWebChatS
109
111
  groupActivitiesMiddleware: (_props$webChatContain17 = props.webChatContainerProps) !== null && _props$webChatContain17 !== void 0 && (_props$webChatContain18 = _props$webChatContain17.renderingMiddlewareProps) !== null && _props$webChatContain18 !== void 0 && _props$webChatContain18.disableGroupActivitiesMiddleware ? undefined : (_defaultWebChatContai2 = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai2 === void 0 ? void 0 : _defaultWebChatContai2.groupActivitiesMiddleware,
110
112
  typingIndicatorMiddleware: (_props$webChatContain19 = props.webChatContainerProps) !== null && _props$webChatContain19 !== void 0 && (_props$webChatContain20 = _props$webChatContain19.renderingMiddlewareProps) !== null && _props$webChatContain20 !== void 0 && _props$webChatContain20.disableTypingIndicatorMiddleware ? undefined : (_defaultWebChatContai3 = defaultWebChatContainerStatefulProps.webChatProps) === null || _defaultWebChatContai3 === void 0 ? void 0 : _defaultWebChatContai3.typingIndicatorMiddleware,
111
113
  onTelemetry: createWebChatTelemetry(),
112
- ...((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.webChatProps)
114
+ cardActionMiddleware: createCardActionMiddleware(((_props$webChatContain21 = props.webChatContainerProps) === null || _props$webChatContain21 === void 0 ? void 0 : _props$webChatContain21.botMagicCode) || undefined),
115
+ ...((_props$webChatContain22 = props.webChatContainerProps) === null || _props$webChatContain22 === void 0 ? void 0 : _props$webChatContain22.webChatProps)
113
116
  };
114
117
  return webChatProps;
115
118
  };