@microsoft/omnichannel-chat-widget 1.8.4-main.424a580 → 1.8.4-main.4f09da2
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/README.md +27 -0
- package/lib/cjs/common/Constants.js +2 -0
- package/lib/cjs/common/telemetry/AppInsightsEvents.js +11 -5
- package/lib/cjs/common/telemetry/TelemetryConstants.js +2 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +10 -7
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +7 -7
- package/lib/cjs/common/utils.js +14 -1
- package/lib/cjs/components/errorboundary/ErrorBoundary.js +2 -1
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +1 -1
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +24 -21
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +1 -2
- package/lib/cjs/components/livechatwidget/common/endChat.js +26 -9
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +36 -4
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +103 -26
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +8 -6
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +26 -33
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +8 -2
- package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +1 -3
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +6 -7
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +21 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/telemetry/AppInsightsEvents.js +11 -5
- package/lib/esm/common/telemetry/TelemetryConstants.js +2 -0
- package/lib/esm/common/telemetry/TelemetryManager.js +10 -7
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +7 -7
- package/lib/esm/common/utils.js +11 -0
- package/lib/esm/components/errorboundary/ErrorBoundary.js +4 -2
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +1 -1
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +24 -21
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +1 -2
- package/lib/esm/components/livechatwidget/common/endChat.js +26 -9
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +33 -2
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +103 -26
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +8 -6
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +27 -37
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +8 -2
- package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +1 -3
- package/lib/esm/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +6 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +21 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
- package/lib/types/common/Constants.d.ts +2 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +2 -0
- package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +1 -0
- package/lib/types/common/utils.d.ts +9 -1
- package/lib/types/components/errorboundary/ErrorBoundary.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +11 -0
- package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +0 -1
- package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +15 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +1 -2
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +1 -1
- package/package.json +2 -2
|
@@ -54,9 +54,10 @@ import { startProactiveChat } from "../common/startProactiveChat";
|
|
|
54
54
|
import useChatAdapterStore from "../../../hooks/useChatAdapterStore";
|
|
55
55
|
import useChatContextStore from "../../../hooks/useChatContextStore";
|
|
56
56
|
import useFacadeSDKStore from "../../../hooks/useFacadeChatSDKStore";
|
|
57
|
+
import { getPostChatContext, initiatePostChat } from "../common/renderSurveyHelpers";
|
|
57
58
|
let uiTimer;
|
|
58
59
|
export const LiveChatWidgetStateful = props => {
|
|
59
|
-
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _props$webChatContain7, _props$webChatContain8, _props$webChatContain9, _props$styleProps, _props$webChatContain10, _props$webChatContain11, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain15, _state$
|
|
60
|
+
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6, _props$webChatContain7, _props$webChatContain8, _props$webChatContain9, _props$styleProps, _props$webChatContain10, _props$webChatContain11, _props$controlProps, _props$controlProps3, _state$appStates7, _props$webChatContain15, _state$appStates8, _props$webChatContain17, _props$webChatContain18, _props$controlProps12, _props$draggableChatW, _props$draggableChatW2, _props$draggableChatW3, _props$draggableChatW4, _props$draggableChatW5, _livechatProps$webCha, _livechatProps$styleP, _livechatProps$contro, _livechatProps$contro2, _livechatProps$compon, _livechatProps$contro3, _livechatProps$compon2, _livechatProps$contro4, _livechatProps$compon3, _livechatProps$contro5, _livechatProps$compon4, _livechatProps$contro6, _livechatProps$compon5, _livechatProps$contro7, _livechatProps$compon6, _livechatProps$contro8, _livechatProps$compon7, _livechatProps$contro9, _livechatProps$compon8, _livechatProps$contro10, _livechatProps$contro11, _livechatProps$compon9, _livechatProps$contro12, _livechatProps$compon10, _livechatProps$contro13, _livechatProps$compon11, _livechatProps$compon12, _livechatProps$compon13;
|
|
60
61
|
useEffect(() => {
|
|
61
62
|
uiTimer = createTimer();
|
|
62
63
|
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
@@ -317,7 +318,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
317
318
|
});
|
|
318
319
|
});
|
|
319
320
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartProactiveChat).subscribe(msg => {
|
|
320
|
-
TelemetryHelper.
|
|
321
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
321
322
|
Event: TelemetryEvent.StartProactiveChatEventReceived,
|
|
322
323
|
Description: "Start proactive chat event received."
|
|
323
324
|
});
|
|
@@ -443,7 +444,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
443
444
|
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
444
445
|
});
|
|
445
446
|
}
|
|
446
|
-
TelemetryHelper.
|
|
447
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
447
448
|
Event: TelemetryEvent.StartChatEventReceived,
|
|
448
449
|
Description: "Start chat event received."
|
|
449
450
|
});
|
|
@@ -490,21 +491,91 @@ export const LiveChatWidgetStateful = props => {
|
|
|
490
491
|
return;
|
|
491
492
|
}
|
|
492
493
|
});
|
|
494
|
+
const handleInitiateEndChatForPersistentChat = async (msg, conversationDetails) => {
|
|
495
|
+
var _msg$payload10, _msg$payload11, _msg$payload12;
|
|
496
|
+
//If the payload does NOT include the skipSessionCloseForPersistentChat flag, default is false. Upon receiving the customer event, always ending session from C2.
|
|
497
|
+
const skipSessionCloseForPersistentChat = typeof (msg === null || msg === void 0 ? void 0 : (_msg$payload10 = msg.payload) === null || _msg$payload10 === void 0 ? void 0 : _msg$payload10[Constants.SkipSessionCloseForPersistentChatFlag]) === Constants.String && (msg === null || msg === void 0 ? void 0 : (_msg$payload11 = msg.payload) === null || _msg$payload11 === void 0 ? void 0 : _msg$payload11[Constants.SkipSessionCloseForPersistentChatFlag]).toLowerCase() === Constants.true || (msg === null || msg === void 0 ? void 0 : (_msg$payload12 = msg.payload) === null || _msg$payload12 === void 0 ? void 0 : _msg$payload12[Constants.SkipSessionCloseForPersistentChatFlag]) === true;
|
|
498
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
499
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
500
|
+
Description: "Processing initiateEndChat for persistent chat",
|
|
501
|
+
CustomProperties: {
|
|
502
|
+
conversationDetails
|
|
503
|
+
}
|
|
504
|
+
});
|
|
505
|
+
const conversationState = conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state;
|
|
506
|
+
if (conversationState !== LiveWorkItemState.Closed && conversationState !== LiveWorkItemState.WrapUp) {
|
|
507
|
+
if (skipSessionCloseForPersistentChat) {
|
|
508
|
+
var _conversationDetails$;
|
|
509
|
+
if (((_conversationDetails$ = conversationDetails.canRenderPostChat) === null || _conversationDetails$ === void 0 ? void 0 : _conversationDetails$.toLowerCase()) === "true") {
|
|
510
|
+
var _state$domainStates3;
|
|
511
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
512
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
513
|
+
Description: "Processing initiateEndChat, fetching postChatContext"
|
|
514
|
+
});
|
|
515
|
+
const postchatContext = (await getPostChatContext(facadeChatSDK, state, dispatch)) ?? (state === null || state === void 0 ? void 0 : (_state$domainStates3 = state.domainStates) === null || _state$domainStates3 === void 0 ? void 0 : _state$domainStates3.postChatContext);
|
|
516
|
+
if (postchatContext) {
|
|
517
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
518
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
519
|
+
Description: "Processing initiateEndChat, initiatePostChat",
|
|
520
|
+
CustomProperties: {
|
|
521
|
+
postchatContext
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
await initiatePostChat(props, conversationDetails, state, dispatch, postchatContext);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
} else {
|
|
528
|
+
const skipEndChatSDK = false;
|
|
529
|
+
const skipCloseChat = false;
|
|
530
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
531
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
532
|
+
Description: "Processing initiateEndChat, trigger endChat"
|
|
533
|
+
});
|
|
534
|
+
await endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
//if conversation already closed, it is safe to unmount it upon receiving the closeChat event
|
|
538
|
+
else {
|
|
539
|
+
BroadcastService.postMessage({
|
|
540
|
+
eventName: BroadcastEvent.CloseChat
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
};
|
|
493
544
|
|
|
494
545
|
// End chat
|
|
495
|
-
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async
|
|
546
|
+
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async msg => {
|
|
496
547
|
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
497
548
|
Event: TelemetryEvent.EndChatEventReceived,
|
|
498
549
|
Description: "Received InitiateEndChat BroadcastEvent.",
|
|
499
550
|
CustomProperties: {
|
|
500
|
-
ConversationStage: ConversationStage.ConversationEnd
|
|
551
|
+
ConversationStage: ConversationStage.ConversationEnd,
|
|
552
|
+
payload: msg === null || msg === void 0 ? void 0 : msg.payload
|
|
501
553
|
}
|
|
502
554
|
});
|
|
503
|
-
|
|
504
|
-
|
|
555
|
+
const conversationDetails = await getConversationDetailsCall(facadeChatSDK);
|
|
556
|
+
const {
|
|
557
|
+
chatConfig
|
|
558
|
+
} = props;
|
|
559
|
+
const isPersistent = isPersistentEnabled(chatConfig);
|
|
560
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
561
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
562
|
+
Description: "Processing initiateEndChat, fetched conversation details",
|
|
563
|
+
CustomProperties: {
|
|
564
|
+
conversationDetails,
|
|
565
|
+
isPersistent
|
|
566
|
+
}
|
|
567
|
+
});
|
|
568
|
+
if (isPersistent && conversationDetails) {
|
|
569
|
+
await handleInitiateEndChatForPersistentChat(msg, conversationDetails);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
505
572
|
const persistedState = getStateFromCache(getWidgetCacheIdfromProps(props));
|
|
506
573
|
if (persistedState && persistedState.appStates.conversationState === ConversationState.Active) {
|
|
507
|
-
|
|
574
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
575
|
+
Event: TelemetryEvent.PrepareEndChat,
|
|
576
|
+
Description: PrepareEndChatDescriptionConstants.InitiateEndChatReceivedActiveChat
|
|
577
|
+
});
|
|
578
|
+
//We need to simulate states for closing chat, in order to messup with close confirmation pane.
|
|
508
579
|
dispatch({
|
|
509
580
|
type: LiveChatWidgetActionType.SET_CONFIRMATION_STATE,
|
|
510
581
|
payload: ConfirmationState.Ok
|
|
@@ -524,11 +595,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
524
595
|
Event: TelemetryEvent.PrepareEndChat,
|
|
525
596
|
Description: PrepareEndChatDescriptionConstants.InitiateEndChatReceived
|
|
526
597
|
});
|
|
527
|
-
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
598
|
+
await endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
528
599
|
}
|
|
529
|
-
BroadcastService.postMessage({
|
|
530
|
-
eventName: BroadcastEvent.CloseChat
|
|
531
|
-
});
|
|
532
600
|
});
|
|
533
601
|
|
|
534
602
|
// End chat on browser unload
|
|
@@ -539,8 +607,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
539
607
|
// Listen to end chat event from other tabs
|
|
540
608
|
const endChatEventName = getWidgetEndChatEventName((_facadeChatSDK$getCha3 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha3 === void 0 ? void 0 : (_facadeChatSDK$getCha4 = _facadeChatSDK$getCha3.omnichannelConfig) === null || _facadeChatSDK$getCha4 === void 0 ? void 0 : _facadeChatSDK$getCha4.orgId, (_facadeChatSDK$getCha5 = facadeChatSDK.getChatSDK()) === null || _facadeChatSDK$getCha5 === void 0 ? void 0 : (_facadeChatSDK$getCha6 = _facadeChatSDK$getCha5.omnichannelConfig) === null || _facadeChatSDK$getCha6 === void 0 ? void 0 : _facadeChatSDK$getCha6.widgetId, ((_props$controlProps11 = props.controlProps) === null || _props$controlProps11 === void 0 ? void 0 : _props$controlProps11.widgetInstanceId) ?? "");
|
|
541
609
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
542
|
-
var _msg$
|
|
543
|
-
if ((msg === null || msg === void 0 ? void 0 : (_msg$
|
|
610
|
+
var _msg$payload13;
|
|
611
|
+
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload13 = msg.payload) === null || _msg$payload13 === void 0 ? void 0 : _msg$payload13.runtimeId) !== TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
544
612
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
545
613
|
Event: TelemetryEvent.PrepareEndChat,
|
|
546
614
|
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
@@ -582,8 +650,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
582
650
|
|
|
583
651
|
// Retrieve convId
|
|
584
652
|
BroadcastService.getMessageByEventName(BroadcastEvent.UpdateConversationDataForTelemetry).subscribe(msg => {
|
|
585
|
-
var _msg$
|
|
586
|
-
if ((_msg$
|
|
653
|
+
var _msg$payload14, _msg$payload14$liveWo;
|
|
654
|
+
if ((_msg$payload14 = msg.payload) !== null && _msg$payload14 !== void 0 && (_msg$payload14$liveWo = _msg$payload14.liveWorkItem) !== null && _msg$payload14$liveWo !== void 0 && _msg$payload14$liveWo.conversationId) {
|
|
587
655
|
setConversationId(msg.payload.liveWorkItem.conversationId);
|
|
588
656
|
}
|
|
589
657
|
});
|
|
@@ -701,14 +769,22 @@ export const LiveChatWidgetStateful = props => {
|
|
|
701
769
|
}
|
|
702
770
|
}, [state.domainStates.confirmationState]);
|
|
703
771
|
useEffect(() => {
|
|
704
|
-
var
|
|
772
|
+
var _inMemoryState$appSta7, _inMemoryState$appSta8, _inMemoryState$appSta9, _inMemoryState$appSta10, _inMemoryState$appSta11, _inMemoryState$appSta12, _inMemoryState$appSta13;
|
|
773
|
+
const inMemoryState = executeReducer(state, {
|
|
774
|
+
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
775
|
+
payload: null
|
|
776
|
+
});
|
|
705
777
|
// Do not process anything during initialization
|
|
706
|
-
if ((
|
|
778
|
+
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta7 = inMemoryState.appStates) === null || _inMemoryState$appSta7 === void 0 ? void 0 : _inMemoryState$appSta7.conversationEndedBy) === ConversationEndEntity.NotSet) {
|
|
779
|
+
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
780
|
+
Event: TelemetryEvent.PrepareEndChat,
|
|
781
|
+
Description: "conversationEndedBy is not set"
|
|
782
|
+
});
|
|
707
783
|
return;
|
|
708
784
|
}
|
|
709
785
|
|
|
710
786
|
// If start chat failed, and C2 is trying to close chat widget
|
|
711
|
-
if (
|
|
787
|
+
if (inMemoryState !== null && inMemoryState !== void 0 && (_inMemoryState$appSta8 = inMemoryState.appStates) !== null && _inMemoryState$appSta8 !== void 0 && _inMemoryState$appSta8.startChatFailed || (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta9 = inMemoryState.appStates) === null || _inMemoryState$appSta9 === void 0 ? void 0 : _inMemoryState$appSta9.conversationState) === ConversationState.Postchat) {
|
|
712
788
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
713
789
|
Event: TelemetryEvent.PrepareEndChat,
|
|
714
790
|
Description: PrepareEndChatDescriptionConstants.CustomerCloseChatOnFailureOrPostChat
|
|
@@ -718,7 +794,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
718
794
|
}
|
|
719
795
|
|
|
720
796
|
// Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
|
|
721
|
-
if ((
|
|
797
|
+
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta10 = inMemoryState.appStates) === null || _inMemoryState$appSta10 === void 0 ? void 0 : _inMemoryState$appSta10.conversationState) === ConversationState.InActive) {
|
|
722
798
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
723
799
|
Event: TelemetryEvent.PrepareEndChat,
|
|
724
800
|
Description: PrepareEndChatDescriptionConstants.CustomerCloseInactiveChat
|
|
@@ -726,11 +802,11 @@ export const LiveChatWidgetStateful = props => {
|
|
|
726
802
|
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
727
803
|
return;
|
|
728
804
|
}
|
|
729
|
-
const isConversationalSurveyEnabled =
|
|
805
|
+
const isConversationalSurveyEnabled = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta11 = inMemoryState.appStates) === null || _inMemoryState$appSta11 === void 0 ? void 0 : _inMemoryState$appSta11.isConversationalSurveyEnabled;
|
|
730
806
|
|
|
731
807
|
// In conversational survey, we need to check post chat survey logics before we set ConversationState to InActive
|
|
732
808
|
// Hence setting ConversationState to InActive will be done later in the post chat flows
|
|
733
|
-
if (!isConversationalSurveyEnabled && ((
|
|
809
|
+
if (!isConversationalSurveyEnabled && ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta12 = inMemoryState.appStates) === null || _inMemoryState$appSta12 === void 0 ? void 0 : _inMemoryState$appSta12.conversationEndedBy) === ConversationEndEntity.Agent || (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta13 = inMemoryState.appStates) === null || _inMemoryState$appSta13 === void 0 ? void 0 : _inMemoryState$appSta13.conversationEndedBy) === ConversationEndEntity.Bot)) {
|
|
734
810
|
dispatch({
|
|
735
811
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
736
812
|
payload: ConversationState.InActive
|
|
@@ -738,8 +814,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
738
814
|
}
|
|
739
815
|
|
|
740
816
|
// All other cases
|
|
741
|
-
prepareEndChat(props, facadeChatSDK,
|
|
742
|
-
}, [state === null || state === void 0 ? void 0 : (_state$
|
|
817
|
+
prepareEndChat(props, facadeChatSDK, inMemoryState, dispatch, setAdapter, setWebChatStyles, adapter);
|
|
818
|
+
}, [state === null || state === void 0 ? void 0 : (_state$appStates8 = state.appStates) === null || _state$appStates8 === void 0 ? void 0 : _state$appStates8.conversationEndedBy]);
|
|
743
819
|
|
|
744
820
|
// Publish chat widget state
|
|
745
821
|
useEffect(() => {
|
|
@@ -771,13 +847,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
771
847
|
|
|
772
848
|
// Handle Chat disconnect cases
|
|
773
849
|
useEffect(() => {
|
|
774
|
-
var _inMemoryState$
|
|
850
|
+
var _inMemoryState$appSta14;
|
|
775
851
|
const inMemoryState = executeReducer(state, {
|
|
776
852
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
777
853
|
payload: null
|
|
778
854
|
});
|
|
779
855
|
handleChatDisconnect(props, inMemoryState, setWebChatStyles);
|
|
780
|
-
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
856
|
+
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta14 = inMemoryState.appStates) === null || _inMemoryState$appSta14 === void 0 ? void 0 : _inMemoryState$appSta14.chatDisconnectEventReceived;
|
|
781
857
|
if (chatDisconnectState && adapter) {
|
|
782
858
|
try {
|
|
783
859
|
adapter.end();
|
|
@@ -879,6 +955,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
879
955
|
// React to dynamic bot avatar initials updates from context
|
|
880
956
|
useEffect(() => {
|
|
881
957
|
if (state.domainStates.botAvatarInitials && state.domainStates.botAvatarInitials !== webChatStyles.botAvatarInitials) {
|
|
958
|
+
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
882
959
|
setWebChatStyles(styles => ({
|
|
883
960
|
...styles,
|
|
884
961
|
botAvatarInitials: state.domainStates.botAvatarInitials
|
|
@@ -22,7 +22,7 @@ const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, co
|
|
|
22
22
|
return `${surveyInviteLink}&${surveyLinkParams.toString()}`;
|
|
23
23
|
};
|
|
24
24
|
export const PostChatSurveyPaneStateful = props => {
|
|
25
|
-
var _props$styleProps, _state$appStates, _props$controlProps;
|
|
25
|
+
var _props$styleProps, _state$appStates, _state$domainStates$p, _props$controlProps;
|
|
26
26
|
useEffect(() => {
|
|
27
27
|
uiTimer = createTimer();
|
|
28
28
|
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
@@ -39,13 +39,15 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
39
39
|
});
|
|
40
40
|
let surveyInviteLink = "";
|
|
41
41
|
const surveyMode = (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.selectedSurveyMode) === PostChatSurveyMode.Embed;
|
|
42
|
-
if (state.domainStates.postChatContext.botSurveyInviteLink &&
|
|
42
|
+
if ((_state$domainStates$p = state.domainStates.postChatContext) !== null && _state$domainStates$p !== void 0 && _state$domainStates$p.botSurveyInviteLink &&
|
|
43
43
|
// Bot survey enabled
|
|
44
44
|
state.appStates.postChatParticipantType === ParticipantType.Bot) {
|
|
45
|
+
var _state$domainStates$p2, _state$domainStates$p3;
|
|
45
46
|
// Only Bot has engaged
|
|
46
|
-
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
|
|
47
|
+
surveyInviteLink = generateSurveyInviteLink((_state$domainStates$p2 = state.domainStates.postChatContext) === null || _state$domainStates$p2 === void 0 ? void 0 : _state$domainStates$p2.botSurveyInviteLink, surveyMode, (_state$domainStates$p3 = state.domainStates.postChatContext) === null || _state$domainStates$p3 === void 0 ? void 0 : _state$domainStates$p3.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
|
|
47
48
|
} else {
|
|
48
|
-
|
|
49
|
+
var _state$domainStates$p4, _state$domainStates$p5;
|
|
50
|
+
surveyInviteLink = generateSurveyInviteLink((_state$domainStates$p4 = state.domainStates.postChatContext) === null || _state$domainStates$p4 === void 0 ? void 0 : _state$domainStates$p4.surveyInviteLink, surveyMode, (_state$domainStates$p5 = state.domainStates.postChatContext) === null || _state$domainStates$p5 === void 0 ? void 0 : _state$domainStates$p5.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
|
|
49
51
|
}
|
|
50
52
|
if (props.copilotSurveyContext) {
|
|
51
53
|
surveyInviteLink = `${surveyInviteLink}&mcs_additionalcontext=${JSON.stringify(props.copilotSurveyContext)}`;
|
|
@@ -103,7 +105,7 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
103
105
|
Event: TelemetryEvent.CustomerVoiceResponsePageLoaded
|
|
104
106
|
});
|
|
105
107
|
} else if (data === CustomerVoiceEvents.FormResponseSubmitted) {
|
|
106
|
-
TelemetryHelper.
|
|
108
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
107
109
|
Event: TelemetryEvent.CustomerVoiceFormResponseSubmitted,
|
|
108
110
|
Description: "Customer Voice form response submitted.",
|
|
109
111
|
CustomProperties: {
|
|
@@ -111,7 +113,7 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
111
113
|
}
|
|
112
114
|
});
|
|
113
115
|
} else if (data === CustomerVoiceEvents.FormResponseError) {
|
|
114
|
-
TelemetryHelper.
|
|
116
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
115
117
|
Event: TelemetryEvent.CustomerVoiceFormResponseError,
|
|
116
118
|
Description: "Customer Voice form response error.",
|
|
117
119
|
ExceptionDetails: {
|
|
@@ -21,13 +21,10 @@ import { defaultSentMessageAnchorStyles } from "./webchatcontroller/middlewares/
|
|
|
21
21
|
import { defaultSystemMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles";
|
|
22
22
|
import { defaultUserMessageBoxStyles } from "./webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles";
|
|
23
23
|
import { defaultWebChatContainerStatefulProps } from "./common/defaultProps/defaultWebChatContainerStatefulProps";
|
|
24
|
-
import {
|
|
24
|
+
import { shouldLoadPersistentChatHistory } from "../livechatwidget/common/liveChatConfigUtils";
|
|
25
25
|
import { useChatContextStore } from "../..";
|
|
26
26
|
import useFacadeSDKStore from "../../hooks/useFacadeChatSDKStore";
|
|
27
27
|
import usePersistentChatHistory from "./hooks/usePersistentChatHistory";
|
|
28
|
-
|
|
29
|
-
// Types for better type safety
|
|
30
|
-
|
|
31
28
|
let uiTimer;
|
|
32
29
|
const broadcastChannelMessageEvent = "message";
|
|
33
30
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -56,7 +53,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
56
53
|
};
|
|
57
54
|
};
|
|
58
55
|
export const WebChatContainerStateful = props => {
|
|
59
|
-
var _props$webChatContain, _defaultWebChatContai,
|
|
56
|
+
var _props$webChatContain, _defaultWebChatContai, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _webChatContainerProp9, _props$webChatContain6, _props$webChatContain7, _defaultWebChatContai2, _props$webChatContain8, _props$webChatContain9, _defaultWebChatContai3, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _webChatContainerProp24, _props$webChatContain10, _props$webChatContain11, _webChatContainerProp25, _webChatContainerProp26, _webChatContainerProp27, _webChatContainerProp28, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
|
|
60
57
|
const [facadeChatSDK] = useFacadeSDKStore();
|
|
61
58
|
|
|
62
59
|
// Create a font family that includes emoji support, based on the primary font or default
|
|
@@ -90,18 +87,9 @@ export const WebChatContainerStateful = props => {
|
|
|
90
87
|
|
|
91
88
|
// Type the chatConfig properly to avoid 'any' usage
|
|
92
89
|
const extendedChatConfig = props.chatConfig;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
const
|
|
96
|
-
const isPersistentChatEnabledForWidget = !!(extendedChatConfig !== null && extendedChatConfig !== void 0 && (_extendedChatConfig$L3 = extendedChatConfig.LiveChatConfigAuthSettings) !== null && _extendedChatConfig$L3 !== void 0 && _extendedChatConfig$L3.msdyn_javascriptclientfunction) || isPersistentChatEnabled(extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L4 = extendedChatConfig.LiveWSAndLiveChatEngJoin) === null || _extendedChatConfig$L4 === void 0 ? void 0 : _extendedChatConfig$L4.msdyn_conversationmode);
|
|
97
|
-
|
|
98
|
-
// isPersistentHistoryEnabled can only be true if isHistoryEnabledViaFCB is true, and next conditions are met:
|
|
99
|
-
// 1. isHistoryEnabledViaProps is true (takes precedence over config)
|
|
100
|
-
// 2. isHistoryEnabledInConfig is true and isHistoryEnabledViaProps is undefined
|
|
101
|
-
const isPersistentHistoryEnabled = isHistoryEnabledViaProps || isHistoryEnabledInConfig && !isHistoryEnabledViaProps;
|
|
102
|
-
|
|
103
|
-
// Check if both persistent chat and widget support are enabled
|
|
104
|
-
const shouldLoadPersistentHistoryMessages = isPersistentHistoryEnabled && isHistoryEnabledViaFCB && isPersistentChatEnabledForWidget;
|
|
90
|
+
|
|
91
|
+
// Determine if persistent chat history should be loaded based on all conditions
|
|
92
|
+
const shouldLoadPersistentHistoryMessages = shouldLoadPersistentChatHistory(extendedChatConfig);
|
|
105
93
|
if (shouldLoadPersistentHistoryMessages) {
|
|
106
94
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
107
95
|
Event: TelemetryEvent.PersistentChatHistoryEnabled
|
|
@@ -270,24 +258,28 @@ export const WebChatContainerStateful = props => {
|
|
|
270
258
|
background: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp === void 0 ? void 0 : _webChatContainerProp.background) ?? defaultAdaptiveCardStyles.background};
|
|
271
259
|
}
|
|
272
260
|
|
|
273
|
-
.webchat__bubble__content>div#ms_lcw_webchat_adaptive_card .ac-textBlock {
|
|
274
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? defaultAdaptiveCardStyles.color};
|
|
261
|
+
.webchat__bubble__content>div#ms_lcw_webchat_adaptive_card .ac-textBlock[role=heading] {
|
|
262
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp2 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp2 === void 0 ? void 0 : _webChatContainerProp2.color) ?? defaultAdaptiveCardStyles.color} !important;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.webchat__bubble__content>div#ms_lcw_webchat_adaptive_card label .ac-textRun:first-child {
|
|
266
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp3 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp3 === void 0 ? void 0 : _webChatContainerProp3.color) ?? defaultAdaptiveCardStyles.color} !important;
|
|
275
267
|
}
|
|
276
268
|
|
|
277
269
|
.webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__bubble--from-user {
|
|
278
|
-
max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
270
|
+
max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp4 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp4 === void 0 ? void 0 : (_webChatContainerProp5 = _webChatContainerProp4.userMessageBoxStyles) === null || _webChatContainerProp5 === void 0 ? void 0 : _webChatContainerProp5.maxWidth) ?? (defaultUserMessageBoxStyles === null || defaultUserMessageBoxStyles === void 0 ? void 0 : defaultUserMessageBoxStyles.maxWidth)}
|
|
279
271
|
}
|
|
280
272
|
|
|
281
273
|
.webchat__stacked-layout--show-avatar div.webchat__stacked-layout__content div.webchat__stacked-layout__message-row div.webchat__stacked-layout__message {
|
|
282
|
-
max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
274
|
+
max-width: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp6 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp6 === void 0 ? void 0 : (_webChatContainerProp7 = _webChatContainerProp6.systemMessageBoxStyles) === null || _webChatContainerProp7 === void 0 ? void 0 : _webChatContainerProp7.maxWidth) ?? (defaultSystemMessageBoxStyles === null || defaultSystemMessageBoxStyles === void 0 ? void 0 : defaultSystemMessageBoxStyles.maxWidth)}
|
|
283
275
|
}
|
|
284
276
|
|
|
285
277
|
div[class="ac-textBlock"] *,
|
|
286
|
-
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
278
|
+
div[class="ac-input-container"] * {white-space:${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp8 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp8 === void 0 ? void 0 : _webChatContainerProp8.textWhiteSpace) ?? defaultAdaptiveCardStyles.textWhiteSpace}}
|
|
287
279
|
|
|
288
280
|
div[class="ac-input-container"] input.ac-multichoiceInput,
|
|
289
281
|
div[class="ac-input-container"] select.ac-multichoiceInput {
|
|
290
|
-
${webChatContainerProps !== null && webChatContainerProps !== void 0 && (
|
|
282
|
+
${webChatContainerProps !== null && webChatContainerProps !== void 0 && (_webChatContainerProp9 = webChatContainerProps.adaptiveCardStyles) !== null && _webChatContainerProp9 !== void 0 && _webChatContainerProp9.choiceInputPadding ? `padding: ${webChatContainerProps.adaptiveCardStyles.choiceInputPadding} !important;` : ""}
|
|
291
283
|
}
|
|
292
284
|
|
|
293
285
|
.ms_lcw_webchat_received_message>div.webchat__stacked-layout>div.webchat__stacked-layout__main>div.webchat__stacked-layout__content>div.webchat__stacked-layout__message-row>[class^=webchat]:not(.webchat__bubble--from-user)>.webchat__bubble__content {
|
|
@@ -299,15 +291,15 @@ export const WebChatContainerStateful = props => {
|
|
|
299
291
|
div[class="ac-textBlock"] a:visited,
|
|
300
292
|
div[class="ac-textBlock"] a:hover,
|
|
301
293
|
div[class="ac-textBlock"] a:active {
|
|
302
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
294
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp10 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp10 === void 0 ? void 0 : _webChatContainerProp10.anchorColor) ?? defaultAdaptiveCardStyles.anchorColor};
|
|
303
295
|
}
|
|
304
296
|
|
|
305
|
-
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
297
|
+
.webchat__stacked-layout__content .ac-actionSet > .ac-pushButton > div {white-space: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp11 = webChatContainerProps.adaptiveCardStyles) === null || _webChatContainerProp11 === void 0 ? void 0 : _webChatContainerProp11.buttonWhiteSpace) ?? defaultAdaptiveCardStyles.buttonWhiteSpace} !important;}
|
|
306
298
|
|
|
307
299
|
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
|
|
308
300
|
/* Fallback for browsers that don't support mask */
|
|
309
301
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjRkZGRkZGIiAvPjwvc3ZnPg==);
|
|
310
|
-
filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
302
|
+
filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp12 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp12 === void 0 ? void 0 : (_webChatContainerProp13 = _webChatContainerProp12.receivedMessageAnchorStyles) === null || _webChatContainerProp13 === void 0 ? void 0 : _webChatContainerProp13.filter) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.filter)};
|
|
311
303
|
height: .75em;
|
|
312
304
|
width: .75em;
|
|
313
305
|
margin-left: .25em;
|
|
@@ -317,7 +309,7 @@ export const WebChatContainerStateful = props => {
|
|
|
317
309
|
.ms_lcw_webchat_sent_message img.webchat__render-markdown__external-link-icon {
|
|
318
310
|
/* Fallback for browsers that don't support mask */
|
|
319
311
|
background-image: url(data:image/svg+xml;base64,PHN2ZyB2aWV3Qm94PSIzIDMgMTggMTgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTcuMjUwMSA0LjUwMDE3SDEwLjc0OTVDMTEuMTYzNyA0LjUwMDE3IDExLjQ5OTUgNC44MzU5NiAxMS40OTk1IDUuMjUwMTdDMTEuNDk5NSA1LjYyOTg2IDExLjIxNzMgNS45NDM2NiAxMC44NTEzIDUuOTkzMzJMMTAuNzQ5NSA2LjAwMDE3SDcuMjQ5NzRDNi4wNzA3OSA1Ljk5OTYxIDUuMTAzNDkgNi45MDY1NiA1LjAwNzg2IDguMDYxMTJMNS4wMDAyOCA4LjIyMDAzTDUuMDAzMTIgMTYuNzUwN0M1LjAwMzQzIDE3Ljk0MTUgNS45Mjg4NSAxOC45MTYxIDcuMDk5NjYgMTguOTk0OUw3LjI1MzcxIDE5LjAwMDFMMTUuNzUxOCAxOC45ODg0QzE2Ljk0MTUgMTguOTg2OCAxNy45MTQ1IDE4LjA2MiAxNy45OTM1IDE2Ljg5MjNMMTcuOTk4NyAxNi43Mzg0VjEzLjIzMjFDMTcuOTk4NyAxMi44MTc5IDE4LjMzNDUgMTIuNDgyMSAxOC43NDg3IDEyLjQ4MjFDMTkuMTI4NCAxMi40ODIxIDE5LjQ0MjIgMTIuNzY0MyAxOS40OTE4IDEzLjEzMDNMMTkuNDk4NyAxMy4yMzIxVjE2LjczODRDMTkuNDk4NyAxOC43NDA3IDE3LjkyOTMgMjAuMzc2OSAxNS45NTI4IDIwLjQ4MjlMMTUuNzUzOCAyMC40ODg0TDcuMjU4MjcgMjAuNTAwMUw3LjA1NDk1IDIwLjQ5NDlDNS4xNDIzOSAyMC4zOTU0IDMuNjA4OTUgMTguODYyNyAzLjUwODM3IDE2Ljk1MDJMMy41MDMxMiAxNi43NTExTDMuNTAwODkgOC4yNTI3TDMuNTA1MjkgOC4wNTAyQzMuNjA1MzkgNi4xMzc0OSA1LjEzODY3IDQuNjA0NDkgNy4wNTA5NiA0LjUwNTI3TDcuMjUwMSA0LjUwMDE3SDEwLjc0OTVINy4yNTAxWk0xMy43NDgxIDMuMDAxNDZMMjAuMzAxOCAzLjAwMTk3TDIwLjQwMTQgMy4wMTU3NUwyMC41MDIyIDMuMDQzOTNMMjAuNTU5IDMuMDY4MDNDMjAuNjEyMiAzLjA5MTIyIDIwLjY2MzQgMy4xMjE2MyAyMC43MTExIDMuMTU4ODVMMjAuNzgwNCAzLjIyMTU2TDIwLjg2NDEgMy4zMjAxNEwyMC45MTgzIDMuNDEwMjVMMjAuOTU3IDMuNTAwNTdMMjAuOTc2MiAzLjU2NDc2TDIwLjk4OTggMy42Mjg2MkwyMC45OTkyIDMuNzIyODJMMjAuOTk5NyAxMC4yNTU0QzIwLjk5OTcgMTAuNjY5NiAyMC42NjM5IDExLjAwNTQgMjAuMjQ5NyAxMS4wMDU0QzE5Ljg3IDExLjAwNTQgMTkuNTU2MiAxMC43MjMyIDE5LjUwNjUgMTAuMzU3MUwxOS40OTk3IDEwLjI1NTRMMTkuNDk4OSA1LjU2MTQ3TDEyLjI3OTcgMTIuNzg0N0MxMi4wMTM0IDEzLjA1MSAxMS41OTY4IDEzLjA3NTMgMTEuMzAzMSAxMi44NTc1TDExLjIxOSAxMi43ODQ5QzEwLjk1MjcgMTIuNTE4NyAxMC45Mjg0IDEyLjEwMjEgMTEuMTQ2MiAxMS44MDg0TDExLjIxODggMTEuNzI0M0wxOC40MzY5IDQuNTAxNDZIMTMuNzQ4MUMxMy4zNjg0IDQuNTAxNDYgMTMuMDU0NiA0LjIxOTMxIDEzLjAwNSAzLjg1MzI0TDEyLjk5ODEgMy43NTE0NkMxMi45OTgxIDMuMzcxNzcgMTMuMjgwMyAzLjA1Nzk3IDEzLjY0NjQgMy4wMDgzMUwxMy43NDgxIDMuMDAxNDZaIiBmaWxsPSIjRkZGRkZGIiAvPjwvc3ZnPg==);
|
|
320
|
-
filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
312
|
+
filter: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp14 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp14 === void 0 ? void 0 : (_webChatContainerProp15 = _webChatContainerProp14.sentMessageAnchorStyles) === null || _webChatContainerProp15 === void 0 ? void 0 : _webChatContainerProp15.filter) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.filter)};
|
|
321
313
|
height: .75em;
|
|
322
314
|
width: .75em;
|
|
323
315
|
margin-left: .25em;
|
|
@@ -327,7 +319,7 @@ export const WebChatContainerStateful = props => {
|
|
|
327
319
|
/* Modern browsers with mask support */
|
|
328
320
|
@supports (mask: url()) or (-webkit-mask: url()) {
|
|
329
321
|
.ms_lcw_webchat_received_message img.webchat__render-markdown__external-link-icon {
|
|
330
|
-
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
322
|
+
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp16 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp16 === void 0 ? void 0 : (_webChatContainerProp17 = _webChatContainerProp16.receivedMessageAnchorStyles) === null || _webChatContainerProp17 === void 0 ? void 0 : _webChatContainerProp17.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)} !important;
|
|
331
323
|
background-image: none !important;
|
|
332
324
|
filter: none !important;
|
|
333
325
|
mask: url("data:image/svg+xml,%3Csvg viewBox='3 3 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.2501 4.50017H10.7495C11.1637 4.50017 11.4995 4.83596 11.4995 5.25017C11.4995 5.62986 11.2173 5.94366 10.8513 5.99332L10.7495 6.00017H7.24974C6.07079 5.99961 5.10349 6.90656 5.00786 8.06112L5.00028 8.22003L5.00312 16.7507C5.00343 17.9415 5.92885 18.9161 7.09966 18.9949L7.25371 19.0001L15.7518 18.9884C16.9415 18.9868 17.9145 18.062 17.9935 16.8923L17.9987 16.7384V13.2321C17.9987 12.8179 18.3345 12.4821 18.7487 12.4821C19.1284 12.4821 19.4422 12.7643 19.4918 13.1303L19.4987 13.2321V16.7384C19.4987 18.7407 17.9293 20.3769 15.9528 20.4829L15.7538 20.4884L7.25827 20.5001L7.05495 20.4949C5.14239 20.3954 3.60895 18.8627 3.50837 16.9502L3.50312 16.7511L3.50089 8.2527L3.50529 8.0502C3.60539 6.13749 5.13867 4.60449 7.05096 4.50527L7.2501 4.50017H10.7495H7.2501ZM13.7481 3.00146L20.3018 3.00197L20.4014 3.01575L20.5022 3.04393L20.559 3.06803C20.6122 3.09122 20.6634 3.12163 20.7111 3.15885L20.7804 3.22156L20.8641 3.32014L20.9183 3.41025L20.957 3.50057L20.9762 3.56476L20.9898 3.62862L20.9992 3.72282L20.9997 10.2554C20.9997 10.6696 20.6639 11.0054 20.2497 11.0054C19.87 11.0054 19.5562 10.7232 19.5065 10.3571L19.4997 10.2554L19.4989 5.56147L12.2797 12.7847C12.0134 13.051 11.5968 13.0753 11.3031 12.8575L11.219 12.7849C10.9527 12.5187 10.9284 12.1021 11.1462 11.8084L11.2188 11.7243L18.4369 4.50146H13.7481C13.3684 4.50146 13.0546 4.21931 13.005 3.85324L12.9981 3.75146C12.9981 3.37177 13.2803 3.05797 13.6464 3.00831L13.7481 3.00146Z' fill='currentColor' /%3E%3C/svg%3E") no-repeat center;
|
|
@@ -337,7 +329,7 @@ export const WebChatContainerStateful = props => {
|
|
|
337
329
|
}
|
|
338
330
|
|
|
339
331
|
.ms_lcw_webchat_sent_message img.webchat__render-markdown__external-link-icon {
|
|
340
|
-
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
332
|
+
background-color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp18 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp18 === void 0 ? void 0 : (_webChatContainerProp19 = _webChatContainerProp18.sentMessageAnchorStyles) === null || _webChatContainerProp19 === void 0 ? void 0 : _webChatContainerProp19.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)} !important;
|
|
341
333
|
background-image: none !important;
|
|
342
334
|
filter: none !important;
|
|
343
335
|
mask: url("data:image/svg+xml,%3Csvg viewBox='3 3 18 18' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7.2501 4.50017H10.7495C11.1637 4.50017 11.4995 4.83596 11.4995 5.25017C11.4995 5.62986 11.2173 5.94366 10.8513 5.99332L10.7495 6.00017H7.24974C6.07079 5.99961 5.10349 6.90656 5.00786 8.06112L5.00028 8.22003L5.00312 16.7507C5.00343 17.9415 5.92885 18.9161 7.09966 18.9949L7.25371 19.0001L15.7518 18.9884C16.9415 18.9868 17.9145 18.062 17.9935 16.8923L17.9987 16.7384V13.2321C17.9987 12.8179 18.3345 12.4821 18.7487 12.4821C19.1284 12.4821 19.4422 12.7643 19.4918 13.1303L19.4987 13.2321V16.7384C19.4987 18.7407 17.9293 20.3769 15.9528 20.4829L15.7538 20.4884L7.25827 20.5001L7.05495 20.4949C5.14239 20.3954 3.60895 18.8627 3.50837 16.9502L3.50312 16.7511L3.50089 8.2527L3.50529 8.0502C3.60539 6.13749 5.13867 4.60449 7.05096 4.50527L7.2501 4.50017H10.7495H7.2501ZM13.7481 3.00146L20.3018 3.00197L20.4014 3.01575L20.5022 3.04393L20.559 3.06803C20.6122 3.09122 20.6634 3.12163 20.7111 3.15885L20.7804 3.22156L20.8641 3.32014L20.9183 3.41025L20.957 3.50057L20.9762 3.56476L20.9898 3.62862L20.9992 3.72282L20.9997 10.2554C20.9997 10.6696 20.6639 11.0054 20.2497 11.0054C19.87 11.0054 19.5562 10.7232 19.5065 10.3571L19.4997 10.2554L19.4989 5.56147L12.2797 12.7847C12.0134 13.051 11.5968 13.0753 11.3031 12.8575L11.219 12.7849C10.9527 12.5187 10.9284 12.1021 11.1462 11.8084L11.2188 11.7243L18.4369 4.50146H13.7481C13.3684 4.50146 13.0546 4.21931 13.005 3.85324L12.9981 3.75146C12.9981 3.37177 13.2803 3.05797 13.6464 3.00831L13.7481 3.00146Z' fill='currentColor' /%3E%3C/svg%3E") no-repeat center;
|
|
@@ -355,18 +347,18 @@ export const WebChatContainerStateful = props => {
|
|
|
355
347
|
.ms_lcw_webchat_received_message a:visited,
|
|
356
348
|
.ms_lcw_webchat_received_message a:hover,
|
|
357
349
|
.ms_lcw_webchat_received_message a:active {
|
|
358
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
350
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp20 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp20 === void 0 ? void 0 : (_webChatContainerProp21 = _webChatContainerProp20.receivedMessageAnchorStyles) === null || _webChatContainerProp21 === void 0 ? void 0 : _webChatContainerProp21.color) ?? (defaultReceivedMessageAnchorStyles === null || defaultReceivedMessageAnchorStyles === void 0 ? void 0 : defaultReceivedMessageAnchorStyles.color)};
|
|
359
351
|
}
|
|
360
352
|
.ms_lcw_webchat_sent_message a:link,
|
|
361
353
|
.ms_lcw_webchat_sent_message a:visited,
|
|
362
354
|
.ms_lcw_webchat_sent_message a:hover,
|
|
363
355
|
.ms_lcw_webchat_sent_message a:active {
|
|
364
|
-
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
356
|
+
color: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp22 = webChatContainerProps.renderingMiddlewareProps) === null || _webChatContainerProp22 === void 0 ? void 0 : (_webChatContainerProp23 = _webChatContainerProp22.sentMessageAnchorStyles) === null || _webChatContainerProp23 === void 0 ? void 0 : _webChatContainerProp23.color) ?? (defaultSentMessageAnchorStyles === null || defaultSentMessageAnchorStyles === void 0 ? void 0 : defaultSentMessageAnchorStyles.color)};
|
|
365
357
|
}
|
|
366
358
|
|
|
367
359
|
// we had a nasty bug long time ago with crashing borders messing with the sendbox, so if customer adds this value, they need to deal with that
|
|
368
360
|
.webchat__bubble:not(.webchat__bubble--from-user) .webchat__bubble__content {
|
|
369
|
-
border-radius: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
361
|
+
border-radius: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp24 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp24 === void 0 ? void 0 : _webChatContainerProp24.bubbleBorderRadius) ?? 0} !important; /* Override border-radius */
|
|
370
362
|
}
|
|
371
363
|
|
|
372
364
|
.webchat__stacked-layout_container>div {
|
|
@@ -403,8 +395,8 @@ export const WebChatContainerStateful = props => {
|
|
|
403
395
|
|
|
404
396
|
/* Suggested actions carousel previous/next navigation focus */
|
|
405
397
|
.webchat__suggested-actions .webchat__suggested-actions__carousel .react-film__flipper:focus-visible .react-film__flipper__body {
|
|
406
|
-
outline: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
407
|
-
outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (
|
|
398
|
+
outline: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp25 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp25 === void 0 ? void 0 : _webChatContainerProp25.suggestedActionKeyboardFocusIndicatorBorderStyle) ?? "dashed"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp26 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp26 === void 0 ? void 0 : _webChatContainerProp26.suggestedActionKeyboardFocusIndicatorBorderWidth) ?? "1px"} ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp27 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp27 === void 0 ? void 0 : _webChatContainerProp27.suggestedActionKeyboardFocusIndicatorBorderColor) ?? "#605E5C"} !important;
|
|
399
|
+
outline-offset: ${(webChatContainerProps === null || webChatContainerProps === void 0 ? void 0 : (_webChatContainerProp28 = webChatContainerProps.webChatStyles) === null || _webChatContainerProp28 === void 0 ? void 0 : _webChatContainerProp28.suggestedActionKeyboardFocusIndicatorInset) ?? "2px"} !important;
|
|
408
400
|
|
|
409
401
|
`), /*#__PURE__*/React.createElement(Stack, {
|
|
410
402
|
styles: containerStyles,
|
|
@@ -415,9 +407,7 @@ export const WebChatContainerStateful = props => {
|
|
|
415
407
|
height: "100%",
|
|
416
408
|
width: "100%"
|
|
417
409
|
}
|
|
418
|
-
}, shouldLoadPersistentHistoryMessages && /*#__PURE__*/React.createElement(WebChatEventSubscribers, {
|
|
419
|
-
persistentChatHistoryEnabled: props === null || props === void 0 ? void 0 : (_props$persistentChat2 = props.persistentChatHistoryProps) === null || _props$persistentChat2 === void 0 ? void 0 : _props$persistentChat2.persistentChatHistoryEnabled
|
|
420
|
-
}), /*#__PURE__*/React.createElement(BasicWebChat, null))), citationPaneOpen && /*#__PURE__*/React.createElement(CitationPaneStateful, {
|
|
410
|
+
}, shouldLoadPersistentHistoryMessages && /*#__PURE__*/React.createElement(WebChatEventSubscribers, null), /*#__PURE__*/React.createElement(BasicWebChat, null))), citationPaneOpen && /*#__PURE__*/React.createElement(CitationPaneStateful, {
|
|
421
411
|
id: ((_props$citationPanePr = props.citationPaneProps) === null || _props$citationPanePr === void 0 ? void 0 : _props$citationPanePr.id) || HtmlAttributeNames.ocwCitationPaneClassName,
|
|
422
412
|
title: ((_props$citationPanePr2 = props.citationPaneProps) === null || _props$citationPanePr2 === void 0 ? void 0 : _props$citationPanePr2.title) || HtmlAttributeNames.ocwCitationPaneTitle,
|
|
423
413
|
contentHtml: citationPaneText,
|
|
@@ -56,11 +56,17 @@ const convertPersistentChatHistoryMessageToActivity = message => {
|
|
|
56
56
|
}
|
|
57
57
|
if (tags) {
|
|
58
58
|
const formattedTags = additionalData.tags.split(",");
|
|
59
|
-
activity.channelData
|
|
59
|
+
activity.channelData = {
|
|
60
|
+
...activity.channelData,
|
|
61
|
+
tags: [...activity.channelData.tags, ...formattedTags]
|
|
62
|
+
};
|
|
60
63
|
}
|
|
61
64
|
}
|
|
62
65
|
if (from !== null && from !== void 0 && (_from$user = from.user) !== null && _from$user !== void 0 && _from$user.displayName) {
|
|
63
|
-
activity.from
|
|
66
|
+
activity.from = {
|
|
67
|
+
...activity.from,
|
|
68
|
+
name: from.user.displayName
|
|
69
|
+
};
|
|
64
70
|
}
|
|
65
71
|
if ((from === null || from === void 0 ? void 0 : (_from$application = from.application) === null || _from$application === void 0 ? void 0 : _from$application.displayName) === "Customer") {
|
|
66
72
|
activity.from = {
|
|
@@ -2,9 +2,8 @@ import { LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryCon
|
|
|
2
2
|
import { useEffect, useRef } from "react";
|
|
3
3
|
import ChatWidgetEvents from "../../livechatwidget/common/ChatWidgetEvents";
|
|
4
4
|
import PersistentConversationHandler from "../../livechatwidget/common/PersistentConversationHandler";
|
|
5
|
-
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
6
|
-
import dispatchCustomEvent from "../../../common/utils/dispatchCustomEvent";
|
|
7
5
|
import SecureEventBus from "../../../common/utils/SecureEventBus";
|
|
6
|
+
import { TelemetryHelper } from "../../../common/telemetry/TelemetryHelper";
|
|
8
7
|
const usePersistentChatHistory = (facadeChatSDK, props) => {
|
|
9
8
|
const handlerRef = useRef(null);
|
|
10
9
|
useEffect(() => {
|
|
@@ -24,7 +23,6 @@ const usePersistentChatHistory = (facadeChatSDK, props) => {
|
|
|
24
23
|
try {
|
|
25
24
|
var _handlerRef$current;
|
|
26
25
|
await ((_handlerRef$current = handlerRef.current) === null || _handlerRef$current === void 0 ? void 0 : _handlerRef$current.pullHistory());
|
|
27
|
-
dispatchCustomEvent(ChatWidgetEvents.HIDE_LOADING_BANNER);
|
|
28
26
|
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
29
27
|
Event: TelemetryEvent.LCWPersistentChatHistoryFetchCompleted,
|
|
30
28
|
Description: "Persistent chat history fetch completed successfully"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js
CHANGED
|
@@ -11,14 +11,13 @@ import dispatchCustomEvent from "../../../common/utils/dispatchCustomEvent";
|
|
|
11
11
|
* Component to handle persistent chat history events.
|
|
12
12
|
* Uses WebChatStoreLoader instead of hooks to avoid context issues.
|
|
13
13
|
*/
|
|
14
|
-
const WebChatEventSubscribers =
|
|
14
|
+
const WebChatEventSubscribers = () => {
|
|
15
15
|
const [isConnected, setIsConnected] = useState(false);
|
|
16
16
|
const [storeReady, setStoreReady] = useState(false);
|
|
17
17
|
const storeWaitTimer = createTimer();
|
|
18
|
+
// Type the chatConfig properly to avoid 'any' usage
|
|
19
|
+
|
|
18
20
|
useEffect(() => {
|
|
19
|
-
if (!props.persistentChatHistoryEnabled) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
21
|
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
23
22
|
Event: TelemetryEvent.LCWWebChatStorePollingStarted,
|
|
24
23
|
Description: "WebChat store polling started"
|
|
@@ -50,9 +49,9 @@ const WebChatEventSubscribers = props => {
|
|
|
50
49
|
clearInterval(storeCheckInterval);
|
|
51
50
|
};
|
|
52
51
|
}
|
|
53
|
-
}, [
|
|
52
|
+
}, []);
|
|
54
53
|
useEffect(() => {
|
|
55
|
-
if (!
|
|
54
|
+
if (!storeReady) {
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
58
57
|
const checkConnectionStatus = () => {
|
|
@@ -109,7 +108,7 @@ const WebChatEventSubscribers = props => {
|
|
|
109
108
|
return () => {
|
|
110
109
|
clearInterval(interval);
|
|
111
110
|
};
|
|
112
|
-
}, [isConnected,
|
|
111
|
+
}, [isConnected, storeReady]);
|
|
113
112
|
return null;
|
|
114
113
|
};
|
|
115
114
|
export default WebChatEventSubscribers;
|