@microsoft/omnichannel-chat-widget 1.6.3-main.e6221d5 → 1.6.4-main.0fc902c
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.
- package/lib/cjs/common/telemetry/TelemetryConstants.js +1 -0
- package/lib/cjs/common/utils.js +9 -4
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +29 -24
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +12 -6
- package/lib/cjs/components/livechatwidget/common/authHelper.js +4 -1
- package/lib/cjs/components/livechatwidget/common/endChat.js +9 -30
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +1 -1
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +13 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +35 -19
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +5 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +27 -20
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +8 -4
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +5 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAttachmentDownloadIconStyles.js +1 -1
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +10 -0
- package/lib/cjs/contexts/createReducer.js +1 -1
- package/lib/esm/common/telemetry/TelemetryConstants.js +1 -0
- package/lib/esm/common/utils.js +9 -4
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +30 -25
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +12 -6
- package/lib/esm/components/livechatwidget/common/authHelper.js +4 -1
- package/lib/esm/components/livechatwidget/common/endChat.js +10 -31
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +1 -1
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +15 -4
- package/lib/esm/components/livechatwidget/common/startChat.js +35 -19
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +5 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +27 -20
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +8 -4
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +5 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAttachmentDownloadIconStyles.js +1 -1
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +10 -0
- package/lib/esm/contexts/createReducer.js +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -1
- package/lib/types/common/utils.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/reconnectChatHelper.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +1 -1
- package/package.json +6 -4
|
@@ -136,9 +136,6 @@ export const LiveChatWidgetStateful = props => {
|
|
|
136
136
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
137
137
|
payload: ConversationState.Loading
|
|
138
138
|
});
|
|
139
|
-
if (localState) {
|
|
140
|
-
localState.appStates.conversationState = ConversationState.Loading;
|
|
141
|
-
}
|
|
142
139
|
|
|
143
140
|
//Check if conversation state is not in wrapup or closed state
|
|
144
141
|
isChatValid = await checkIfConversationStillValid(chatSDK, dispatch, state);
|
|
@@ -155,7 +152,11 @@ export const LiveChatWidgetStateful = props => {
|
|
|
155
152
|
// adding the reconnect logic for the case when customer tries to reconnect from a new browser or InPrivate browser
|
|
156
153
|
const reconnectTriggered = await isReconnectTriggered();
|
|
157
154
|
if (!reconnectTriggered) {
|
|
158
|
-
|
|
155
|
+
const inMemoryState = executeReducer(state, {
|
|
156
|
+
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
157
|
+
payload: null
|
|
158
|
+
});
|
|
159
|
+
await setPreChatAndInitiateChat(chatSDK, dispatch, setAdapter, undefined, undefined, inMemoryState, props);
|
|
159
160
|
}
|
|
160
161
|
return;
|
|
161
162
|
} else {
|
|
@@ -335,31 +336,35 @@ export const LiveChatWidgetStateful = props => {
|
|
|
335
336
|
}
|
|
336
337
|
});
|
|
337
338
|
|
|
339
|
+
/**
|
|
340
|
+
* This will allow to sync multiple tabs to handle minimize and maximize state,
|
|
341
|
+
* the event is expected to be emitted from scripting layer.
|
|
342
|
+
*/
|
|
343
|
+
BroadcastService.getMessageByEventName(BroadcastEvent.SyncMinimize).subscribe(msg => {
|
|
344
|
+
var _msg$payload4;
|
|
345
|
+
dispatch({
|
|
346
|
+
type: LiveChatWidgetActionType.SET_MINIMIZED,
|
|
347
|
+
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload4 = msg.payload) === null || _msg$payload4 === void 0 ? void 0 : _msg$payload4.minimized
|
|
348
|
+
});
|
|
349
|
+
});
|
|
350
|
+
|
|
338
351
|
// Start chat from SDK Event
|
|
339
352
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartChat).subscribe(msg => {
|
|
340
|
-
var _msg$
|
|
353
|
+
var _msg$payload5, _msg$payload6, _msg$payload7, _msg$payload9, _inMemoryState$appSta, _inMemoryState$appSta2, _inMemoryState$appSta3, _inMemoryState$appSta4;
|
|
341
354
|
// If the startChat event is not initiated by the same tab. Ignore the call
|
|
342
|
-
if (!isNullOrUndefined(msg === null || msg === void 0 ? void 0 : (_msg$
|
|
355
|
+
if (!isNullOrUndefined(msg === null || msg === void 0 ? void 0 : (_msg$payload5 = msg.payload) === null || _msg$payload5 === void 0 ? void 0 : _msg$payload5.runtimeId) && (msg === null || msg === void 0 ? void 0 : (_msg$payload6 = msg.payload) === null || _msg$payload6 === void 0 ? void 0 : _msg$payload6.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
343
356
|
return;
|
|
344
357
|
}
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
var _msg$payload7, _msg$payload8;
|
|
358
|
+
if (msg !== null && msg !== void 0 && (_msg$payload7 = msg.payload) !== null && _msg$payload7 !== void 0 && _msg$payload7.customContext) {
|
|
359
|
+
var _msg$payload8;
|
|
348
360
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
349
361
|
Event: TelemetryEvent.CustomContextReceived,
|
|
350
362
|
Description: "CustomContext received through startChat event."
|
|
351
363
|
});
|
|
352
364
|
dispatch({
|
|
353
365
|
type: LiveChatWidgetActionType.SET_CUSTOM_CONTEXT,
|
|
354
|
-
payload: msg === null || msg === void 0 ? void 0 : (_msg$
|
|
366
|
+
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
355
367
|
});
|
|
356
|
-
stateWithUpdatedContext = {
|
|
357
|
-
...state,
|
|
358
|
-
domainStates: {
|
|
359
|
-
...state.domainStates,
|
|
360
|
-
customContext: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
361
|
-
}
|
|
362
|
-
};
|
|
363
368
|
}
|
|
364
369
|
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
365
370
|
Event: TelemetryEvent.StartChatEventRecevied,
|
|
@@ -369,13 +374,14 @@ export const LiveChatWidgetStateful = props => {
|
|
|
369
374
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
370
375
|
payload: null
|
|
371
376
|
});
|
|
377
|
+
inMemoryState.domainStates.customContext = msg === null || msg === void 0 ? void 0 : (_msg$payload9 = msg.payload) === null || _msg$payload9 === void 0 ? void 0 : _msg$payload9.customContext;
|
|
372
378
|
|
|
373
379
|
// Only initiate new chat if widget runtime state is one of the followings
|
|
374
380
|
if (((_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.conversationState) === ConversationState.Closed || ((_inMemoryState$appSta2 = inMemoryState.appStates) === null || _inMemoryState$appSta2 === void 0 ? void 0 : _inMemoryState$appSta2.conversationState) === ConversationState.InActive || ((_inMemoryState$appSta3 = inMemoryState.appStates) === null || _inMemoryState$appSta3 === void 0 ? void 0 : _inMemoryState$appSta3.conversationState) === ConversationState.Postchat) {
|
|
375
381
|
BroadcastService.postMessage({
|
|
376
382
|
eventName: BroadcastEvent.ChatInitiated
|
|
377
383
|
});
|
|
378
|
-
prepareStartChat(props, chatSDK,
|
|
384
|
+
prepareStartChat(props, chatSDK, inMemoryState, dispatch, setAdapter);
|
|
379
385
|
return;
|
|
380
386
|
}
|
|
381
387
|
|
|
@@ -442,8 +448,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
442
448
|
// Listen to end chat event from other tabs
|
|
443
449
|
const endChatEventName = getWidgetEndChatEventName(chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC2 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC2 === void 0 ? void 0 : _chatSDK$omnichannelC2.orgId, chatSDK === null || chatSDK === void 0 ? void 0 : (_chatSDK$omnichannelC3 = chatSDK.omnichannelConfig) === null || _chatSDK$omnichannelC3 === void 0 ? void 0 : _chatSDK$omnichannelC3.widgetId, ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "");
|
|
444
450
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
445
|
-
var _msg$
|
|
446
|
-
if ((msg === null || msg === void 0 ? void 0 : (_msg$
|
|
451
|
+
var _msg$payload10;
|
|
452
|
+
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload10 = msg.payload) === null || _msg$payload10 === void 0 ? void 0 : _msg$payload10.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
447
453
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
448
454
|
Event: TelemetryEvent.PrepareEndChat,
|
|
449
455
|
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
@@ -712,6 +718,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
712
718
|
::-webkit-scrollbar-thumb:hover {
|
|
713
719
|
background: ${scrollbarProps.thumbHoverColor};
|
|
714
720
|
}
|
|
721
|
+
}
|
|
715
722
|
`), /*#__PURE__*/React.createElement(DraggableChatWidget, chatWidgetDraggableConfig, /*#__PURE__*/React.createElement(Composer, _extends({}, webChatProps, {
|
|
716
723
|
styleOptions: {
|
|
717
724
|
...webChatStyles,
|
|
@@ -177,10 +177,10 @@ export const WebChatContainerStateful = props => {
|
|
|
177
177
|
|
|
178
178
|
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
179
179
|
|
|
180
|
-
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
|
|
181
|
-
background-image : url(data:image/svg+xml;base64,
|
|
182
|
-
height:
|
|
183
|
-
|
|
180
|
+
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon, img.webchat__render-markdown__external-link-icon {
|
|
181
|
+
background-image : url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjMjEyMTIxIiAvPjwvc3ZnPg==) !important;
|
|
182
|
+
height: .75em;
|
|
183
|
+
margin-left: .25em;
|
|
184
184
|
filter:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp9 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp9 === void 0 ? void 0 : (_webChatContainerProp10 = _webChatContainerProp9.receivedMessageAnchorStyles) === null || _webChatContainerProp10 === void 0 ? void 0 : _webChatContainerProp10.filter) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.filter)};
|
|
185
185
|
}
|
|
186
186
|
pre {
|
|
@@ -202,6 +202,10 @@ export const WebChatContainerStateful = props => {
|
|
|
202
202
|
.ms_lcw_webchat_sent_message a:active {
|
|
203
203
|
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp13 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp13 === void 0 ? void 0 : (_webChatContainerProp14 = _webChatContainerProp13.sentMessageAnchorStyles) === null || _webChatContainerProp14 === void 0 ? void 0 : _webChatContainerProp14.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
|
|
204
204
|
}
|
|
205
|
+
|
|
206
|
+
.webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
|
|
207
|
+
border-radius: 0 !important; /* Override border-radius */
|
|
208
|
+
}
|
|
205
209
|
`), /*#__PURE__*/React.createElement(Stack, {
|
|
206
210
|
styles: containerStyles
|
|
207
211
|
}, /*#__PURE__*/React.createElement(BasicWebChat, null)));
|
|
@@ -25,7 +25,7 @@ export const defaultMiddlewareLocalizedTexts = {
|
|
|
25
25
|
MIDDLEWARE_MESSAGE_NOT_DELIVERED: "Not Delivered",
|
|
26
26
|
MIDDLEWARE_MESSAGE_RETRY: "Retry",
|
|
27
27
|
MIDDLEWARE_BANNER_CHAT_DISCONNECT: "Your conversation has been disconnected. For additional assistance, please start a new chat.",
|
|
28
|
-
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "
|
|
28
|
+
THIRD_PARTY_COOKIES_BLOCKED_ALERT_MESSAGE: "Allow sites to save/read cookies in browser settings. Reloading page starts a new chat.",
|
|
29
29
|
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
|
|
30
30
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
|
|
31
31
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later."
|
|
@@ -17,9 +17,8 @@ import { defaultSystemMessageStyles } from "./defaultStyles/defaultSystemMessage
|
|
|
17
17
|
import { defaultUserMessageStyles } from "./defaultStyles/defaultUserMessageStyles";
|
|
18
18
|
import { escapeHtml } from "../../../../../common/utils";
|
|
19
19
|
const loggedSystemMessages = new Array();
|
|
20
|
-
|
|
21
20
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
-
const handleSystemMessage = (next, args, card, systemMessageStyleProps) => {
|
|
21
|
+
const handleSystemMessage = (next, args, card, renderMarkdown, systemMessageStyleProps) => {
|
|
23
22
|
var _card$activity, _card$activity$channe, _card$activity$channe2, _card$activity2, _card$activity2$chann, _card$activity3, _card$activity3$chann, _card$activity3$chann2, _card$activity4, _card$activity4$chann, _card$activity5, _card$activity5$chann, _card$nextVisibleActi, _card$nextVisibleActi2, _card$activity6, _card$activity6$chann, _card$activity7, _card$nextVisibleActi3, _card$activity8;
|
|
24
23
|
const systemMessageStyles = {
|
|
25
24
|
...defaultSystemMessageStyles,
|
|
@@ -42,14 +41,14 @@ const handleSystemMessage = (next, args, card, systemMessageStyleProps) => {
|
|
|
42
41
|
if ((_card$activity5 = card.activity) !== null && _card$activity5 !== void 0 && (_card$activity5$chann = _card$activity5.channelData) !== null && _card$activity5$chann !== void 0 && _card$activity5$chann.clientmessageid && ((_card$nextVisibleActi = card.nextVisibleActivity) === null || _card$nextVisibleActi === void 0 ? void 0 : (_card$nextVisibleActi2 = _card$nextVisibleActi.channelData) === null || _card$nextVisibleActi2 === void 0 ? void 0 : _card$nextVisibleActi2.clientmessageid) === ((_card$activity6 = card.activity) === null || _card$activity6 === void 0 ? void 0 : (_card$activity6$chann = _card$activity6.channelData) === null || _card$activity6$chann === void 0 ? void 0 : _card$activity6$chann.clientmessageid) || (_card$activity7 = card.activity) !== null && _card$activity7 !== void 0 && _card$activity7.messageid && ((_card$nextVisibleActi3 = card.nextVisibleActivity) === null || _card$nextVisibleActi3 === void 0 ? void 0 : _card$nextVisibleActi3.messageid) === ((_card$activity8 = card.activity) === null || _card$activity8 === void 0 ? void 0 : _card$activity8.messageid)) {
|
|
43
42
|
return () => false;
|
|
44
43
|
}
|
|
45
|
-
|
|
44
|
+
card.activity.text = renderMarkdown(card.activity.text);
|
|
46
45
|
// eslint-disable-next-line react/display-name
|
|
47
46
|
return () => /*#__PURE__*/React.createElement("div", {
|
|
48
47
|
key: card.activity.id,
|
|
49
48
|
style: systemMessageStyles,
|
|
50
49
|
"aria-hidden": "false",
|
|
51
50
|
dangerouslySetInnerHTML: {
|
|
52
|
-
__html:
|
|
51
|
+
__html: card.activity.text
|
|
53
52
|
}
|
|
54
53
|
});
|
|
55
54
|
};
|
|
@@ -65,7 +64,7 @@ const isDataTagsPresent = card => {
|
|
|
65
64
|
};
|
|
66
65
|
|
|
67
66
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
68
|
-
export const createActivityMiddleware = (systemMessageStyleProps, userMessageStyleProps) => () => next => function () {
|
|
67
|
+
export const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userMessageStyleProps) => () => next => function () {
|
|
69
68
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
70
69
|
args[_key] = arguments[_key];
|
|
71
70
|
}
|
|
@@ -79,7 +78,7 @@ export const createActivityMiddleware = (systemMessageStyleProps, userMessageSty
|
|
|
79
78
|
return () => false;
|
|
80
79
|
}
|
|
81
80
|
if (isTagIncluded(card, Constants.systemMessageTag)) {
|
|
82
|
-
return handleSystemMessage(next, args, card, systemMessageStyleProps);
|
|
81
|
+
return handleSystemMessage(next, args, card, renderMarkdown, systemMessageStyleProps);
|
|
83
82
|
} else if (card.activity.text && card.activity.type === DirectLineActivityType.Message) {
|
|
84
83
|
if (!card.activity.channelData.isHtmlEncoded && card.activity.channelId === Constants.webchatChannelId) {
|
|
85
84
|
card.activity.text = escapeHtml(card.activity.text);
|
|
@@ -12,6 +12,16 @@ export const getLiveChatWidgetContextInitialState = props => {
|
|
|
12
12
|
const initialState = defaultClientDataStoreProvider(cacheTtlInMins, storageType).getData(widgetCacheId);
|
|
13
13
|
if (!isNullOrUndefined(initialState)) {
|
|
14
14
|
const initialStateFromCache = JSON.parse(initialState);
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* this step is needed to avoid the pre-chat pane to be injected in the DOM when the widget is reloaded, because wont be visible
|
|
18
|
+
* and it will be blocking all elements behind it
|
|
19
|
+
* as part of the flow, the pre-chat will be detected and then it will be displayed properly
|
|
20
|
+
* this case is only and only for pre-chat pane.
|
|
21
|
+
* **/
|
|
22
|
+
if (initialStateFromCache.appStates.conversationState === ConversationState.Prechat) {
|
|
23
|
+
initialStateFromCache.appStates.conversationState = ConversationState.Closed;
|
|
24
|
+
}
|
|
15
25
|
return initialStateFromCache;
|
|
16
26
|
}
|
|
17
27
|
const LiveChatWidgetContextInitialState = {
|
|
@@ -52,7 +52,8 @@ export declare enum BroadcastEvent {
|
|
|
52
52
|
HideChatVisibilityChangeEvent = "hideChatVisibilityChangeEvent",
|
|
53
53
|
UpdateSessionDataForTelemetry = "UpdateSessionDataForTelemetry",
|
|
54
54
|
UpdateConversationDataForTelemetry = "UpdateConversationDataForTelemetry",
|
|
55
|
-
ContactIdNotFound = "ContactIdNotFound"
|
|
55
|
+
ContactIdNotFound = "ContactIdNotFound",
|
|
56
|
+
SyncMinimize = "SyncMinimize"
|
|
56
57
|
}
|
|
57
58
|
export declare enum TelemetryEvent {
|
|
58
59
|
CallAdded = "CallAdded",
|
|
@@ -30,7 +30,7 @@ export declare const addDelayInMs: (ms: number) => Promise<void>;
|
|
|
30
30
|
export declare const getBroadcastChannelName: (widgetId: string, widgetInstanceId: string) => string;
|
|
31
31
|
export declare const getWidgetCacheIdfromProps: (props: any, popoutChat?: boolean) => string;
|
|
32
32
|
export declare const debounceLeading: (fn: any, ms?: number) => (...args: any[]) => void;
|
|
33
|
-
export declare const getConversationDetailsCall: (chatSDK: any) => Promise<any>;
|
|
33
|
+
export declare const getConversationDetailsCall: (chatSDK: any, liveChatContext?: any) => Promise<any>;
|
|
34
34
|
export declare const checkContactIdError: (e: any) => void;
|
|
35
35
|
export declare const createFileAndDownload: (fileName: string, blobData: string, mimeType: string) => void;
|
|
36
36
|
/**
|
|
@@ -5,7 +5,7 @@ import { ILiveChatWidgetAction } from "../../../contexts/common/ILiveChatWidgetA
|
|
|
5
5
|
import { ILiveChatWidgetContext } from "../../../contexts/common/ILiveChatWidgetContext";
|
|
6
6
|
import { ILiveChatWidgetProps } from "../interfaces/ILiveChatWidgetProps";
|
|
7
7
|
declare const handleChatReconnect: (chatSDK: any, props: ILiveChatWidgetProps, dispatch: Dispatch<ILiveChatWidgetAction>, setAdapter: any, initStartChat: any, state: ILiveChatWidgetContext) => Promise<boolean>;
|
|
8
|
-
declare const getChatReconnectContext: (chatSDK: any, chatConfig: ChatConfig, props: any, isAuthenticatedChat: boolean) => Promise<any>;
|
|
8
|
+
declare const getChatReconnectContext: (chatSDK: any, chatConfig: ChatConfig, props: any, isAuthenticatedChat: boolean, dispatch: Dispatch<ILiveChatWidgetAction>) => Promise<any>;
|
|
9
9
|
declare const isReconnectEnabled: (chatConfig?: ChatConfig | undefined) => boolean;
|
|
10
10
|
declare const isPersistentEnabled: (chatConfig?: ChatConfig | undefined) => boolean;
|
|
11
11
|
export { handleChatReconnect, isReconnectEnabled, isPersistentEnabled, getChatReconnectContext };
|
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* 3. Decodes certain html characters that came through from chat services
|
|
8
8
|
******/
|
|
9
9
|
import React from "react";
|
|
10
|
-
export declare const createActivityMiddleware: (systemMessageStyleProps?: React.CSSProperties | undefined, userMessageStyleProps?: React.CSSProperties | undefined) => () => (next: any) => (...args: any) => any;
|
|
10
|
+
export declare const createActivityMiddleware: (renderMarkdown: (text: string) => string, systemMessageStyleProps?: React.CSSProperties | undefined, userMessageStyleProps?: React.CSSProperties | undefined) => () => (next: any) => (...args: any) => any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@microsoft/omnichannel-chat-widget",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4-main.0fc902c",
|
|
4
4
|
"description": "Microsoft Omnichannel Chat Widget",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"types": "lib/types/index.d.ts",
|
|
@@ -74,8 +74,8 @@
|
|
|
74
74
|
"webpack-cli": "^4.9.2"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
-
"@microsoft/omnichannel-chat-components": "
|
|
78
|
-
"@microsoft/omnichannel-chat-sdk": "1.
|
|
77
|
+
"@microsoft/omnichannel-chat-components": "1.1.5",
|
|
78
|
+
"@microsoft/omnichannel-chat-sdk": "^1.8.0",
|
|
79
79
|
"abort-controller-es5": "^2.0.1",
|
|
80
80
|
"dompurify": "^2.3.4",
|
|
81
81
|
"markdown-it": "^12.3.2",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"markdown-it-for-inline": "^0.1.1",
|
|
85
85
|
"md5-typescript": "^1.0.5",
|
|
86
86
|
"p-defer-es5": "^2.0.1",
|
|
87
|
+
"sanitize-html": "2.12.1",
|
|
87
88
|
"slack-markdown-it": "^1.0.5"
|
|
88
89
|
},
|
|
89
90
|
"scripts": {
|
|
@@ -110,6 +111,7 @@
|
|
|
110
111
|
"**/url-parse": "1.5.9",
|
|
111
112
|
"**/p-defer-es5": "^2.0.1",
|
|
112
113
|
"**/abort-controller-es5": "^2.0.1",
|
|
113
|
-
"**/minimist": "1.2.6"
|
|
114
|
+
"**/minimist": "1.2.6",
|
|
115
|
+
"**/sanitize-html": "2.12.1"
|
|
114
116
|
}
|
|
115
117
|
}
|