@microsoft/omnichannel-chat-widget 1.8.4-main.4478bbf → 1.8.4-main.6672d3a
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 +3 -0
- package/lib/cjs/common/telemetry/TelemetryManager.js +10 -7
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +20 -1
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +1 -1
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +26 -20
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +1 -2
- package/lib/cjs/components/livechatwidget/common/endChat.js +21 -9
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +9 -2
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +112 -26
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +9 -12
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +8 -2
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
- 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/ConversationDividerActivity.js +30 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +21 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +7 -1
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/telemetry/AppInsightsEvents.js +11 -5
- package/lib/esm/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/esm/common/telemetry/TelemetryManager.js +10 -7
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +20 -1
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +1 -1
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +26 -20
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +1 -2
- package/lib/esm/components/livechatwidget/common/endChat.js +21 -9
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +9 -2
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +112 -26
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +2 -2
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +9 -15
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +8 -2
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +2 -1
- 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/ConversationDividerActivity.js +30 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +21 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +7 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +1 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +7 -1
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/types/common/Constants.d.ts +2 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +3 -0
- package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +1 -1
- package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +5 -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/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +1 -1
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +5 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +2 -1
- package/package.json +1 -1
|
@@ -58,13 +58,14 @@ var _startProactiveChat = require("../common/startProactiveChat");
|
|
|
58
58
|
var _useChatAdapterStore = _interopRequireDefault(require("../../../hooks/useChatAdapterStore"));
|
|
59
59
|
var _useChatContextStore = _interopRequireDefault(require("../../../hooks/useChatContextStore"));
|
|
60
60
|
var _useFacadeChatSDKStore = _interopRequireDefault(require("../../../hooks/useFacadeChatSDKStore"));
|
|
61
|
+
var _renderSurveyHelpers = require("../common/renderSurveyHelpers");
|
|
61
62
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
62
63
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
63
64
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
64
65
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
65
66
|
let uiTimer;
|
|
66
67
|
const LiveChatWidgetStateful = props => {
|
|
67
|
-
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$
|
|
68
|
+
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;
|
|
68
69
|
(0, _react2.useEffect)(() => {
|
|
69
70
|
uiTimer = (0, _utils.createTimer)();
|
|
70
71
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -325,7 +326,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
325
326
|
});
|
|
326
327
|
});
|
|
327
328
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.StartProactiveChat).subscribe(msg => {
|
|
328
|
-
_TelemetryHelper.TelemetryHelper.
|
|
329
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
329
330
|
Event: _TelemetryConstants.TelemetryEvent.StartProactiveChatEventReceived,
|
|
330
331
|
Description: "Start proactive chat event received."
|
|
331
332
|
});
|
|
@@ -451,7 +452,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
451
452
|
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
452
453
|
});
|
|
453
454
|
}
|
|
454
|
-
_TelemetryHelper.TelemetryHelper.
|
|
455
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
455
456
|
Event: _TelemetryConstants.TelemetryEvent.StartChatEventReceived,
|
|
456
457
|
Description: "Start chat event received."
|
|
457
458
|
});
|
|
@@ -498,21 +499,91 @@ const LiveChatWidgetStateful = props => {
|
|
|
498
499
|
return;
|
|
499
500
|
}
|
|
500
501
|
});
|
|
502
|
+
const handleInitiateEndChatForPersistentChat = async (msg, conversationDetails) => {
|
|
503
|
+
var _msg$payload10, _msg$payload11, _msg$payload12;
|
|
504
|
+
//If the payload does NOT include the skipSessionCloseForPersistentChat flag, default is false. Upon receiving the customer event, always ending session from C2.
|
|
505
|
+
const skipSessionCloseForPersistentChat = typeof (msg === null || msg === void 0 ? void 0 : (_msg$payload10 = msg.payload) === null || _msg$payload10 === void 0 ? void 0 : _msg$payload10[_Constants.Constants.SkipSessionCloseForPersistentChatFlag]) === _Constants.Constants.String && (msg === null || msg === void 0 ? void 0 : (_msg$payload11 = msg.payload) === null || _msg$payload11 === void 0 ? void 0 : _msg$payload11[_Constants.Constants.SkipSessionCloseForPersistentChatFlag]).toLowerCase() === _Constants.Constants.true || (msg === null || msg === void 0 ? void 0 : (_msg$payload12 = msg.payload) === null || _msg$payload12 === void 0 ? void 0 : _msg$payload12[_Constants.Constants.SkipSessionCloseForPersistentChatFlag]) === true;
|
|
506
|
+
_TelemetryHelper.TelemetryHelper.logSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
507
|
+
Event: _TelemetryConstants.TelemetryEvent.EndChatEventReceived,
|
|
508
|
+
Description: "Processing initiateEndChat for persistent chat",
|
|
509
|
+
CustomProperties: {
|
|
510
|
+
conversationDetails
|
|
511
|
+
}
|
|
512
|
+
});
|
|
513
|
+
const conversationState = conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state;
|
|
514
|
+
if (conversationState !== _Constants.LiveWorkItemState.Closed && conversationState !== _Constants.LiveWorkItemState.WrapUp) {
|
|
515
|
+
if (skipSessionCloseForPersistentChat) {
|
|
516
|
+
var _conversationDetails$;
|
|
517
|
+
if (((_conversationDetails$ = conversationDetails.canRenderPostChat) === null || _conversationDetails$ === void 0 ? void 0 : _conversationDetails$.toLowerCase()) === "true") {
|
|
518
|
+
var _state$domainStates3;
|
|
519
|
+
_TelemetryHelper.TelemetryHelper.logSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
520
|
+
Event: _TelemetryConstants.TelemetryEvent.EndChatEventReceived,
|
|
521
|
+
Description: "Processing initiateEndChat, fetching postChatContext"
|
|
522
|
+
});
|
|
523
|
+
const postchatContext = (await (0, _renderSurveyHelpers.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);
|
|
524
|
+
if (postchatContext) {
|
|
525
|
+
_TelemetryHelper.TelemetryHelper.logSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
526
|
+
Event: _TelemetryConstants.TelemetryEvent.EndChatEventReceived,
|
|
527
|
+
Description: "Processing initiateEndChat, initiatePostChat",
|
|
528
|
+
CustomProperties: {
|
|
529
|
+
postchatContext
|
|
530
|
+
}
|
|
531
|
+
});
|
|
532
|
+
await (0, _renderSurveyHelpers.initiatePostChat)(props, conversationDetails, state, dispatch, postchatContext);
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
} else {
|
|
536
|
+
const skipEndChatSDK = false;
|
|
537
|
+
const skipCloseChat = false;
|
|
538
|
+
_TelemetryHelper.TelemetryHelper.logSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
539
|
+
Event: _TelemetryConstants.TelemetryEvent.EndChatEventReceived,
|
|
540
|
+
Description: "Processing initiateEndChat, trigger endChat"
|
|
541
|
+
});
|
|
542
|
+
await (0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
//if conversation already closed, it is safe to unmount it upon receiving the closeChat event
|
|
546
|
+
else {
|
|
547
|
+
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
548
|
+
eventName: _TelemetryConstants.BroadcastEvent.CloseChat
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
};
|
|
501
552
|
|
|
502
553
|
// End chat
|
|
503
|
-
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.InitiateEndChat).subscribe(async
|
|
554
|
+
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.InitiateEndChat).subscribe(async msg => {
|
|
504
555
|
_TelemetryHelper.TelemetryHelper.logSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
505
556
|
Event: _TelemetryConstants.TelemetryEvent.EndChatEventReceived,
|
|
506
557
|
Description: "Received InitiateEndChat BroadcastEvent.",
|
|
507
558
|
CustomProperties: {
|
|
508
|
-
ConversationStage: _TelemetryConstants.ConversationStage.ConversationEnd
|
|
559
|
+
ConversationStage: _TelemetryConstants.ConversationStage.ConversationEnd,
|
|
560
|
+
payload: msg === null || msg === void 0 ? void 0 : msg.payload
|
|
509
561
|
}
|
|
510
562
|
});
|
|
511
|
-
|
|
512
|
-
|
|
563
|
+
const conversationDetails = await (0, _utils.getConversationDetailsCall)(facadeChatSDK);
|
|
564
|
+
const {
|
|
565
|
+
chatConfig
|
|
566
|
+
} = props;
|
|
567
|
+
const isPersistent = (0, _reconnectChatHelper.isPersistentEnabled)(chatConfig);
|
|
568
|
+
_TelemetryHelper.TelemetryHelper.logSDKEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
569
|
+
Event: _TelemetryConstants.TelemetryEvent.EndChatEventReceived,
|
|
570
|
+
Description: "Processing initiateEndChat, fetched conversation details",
|
|
571
|
+
CustomProperties: {
|
|
572
|
+
conversationDetails,
|
|
573
|
+
isPersistent
|
|
574
|
+
}
|
|
575
|
+
});
|
|
576
|
+
if (isPersistent && conversationDetails) {
|
|
577
|
+
await handleInitiateEndChatForPersistentChat(msg, conversationDetails);
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
513
580
|
const persistedState = (0, _utils.getStateFromCache)((0, _utils.getWidgetCacheIdfromProps)(props));
|
|
514
581
|
if (persistedState && persistedState.appStates.conversationState === _ConversationState.ConversationState.Active) {
|
|
515
|
-
|
|
582
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
583
|
+
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
584
|
+
Description: _Constants.PrepareEndChatDescriptionConstants.InitiateEndChatReceivedActiveChat
|
|
585
|
+
});
|
|
586
|
+
//We need to simulate states for closing chat, in order to messup with close confirmation pane.
|
|
516
587
|
dispatch({
|
|
517
588
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONFIRMATION_STATE,
|
|
518
589
|
payload: _Constants.ConfirmationState.Ok
|
|
@@ -532,11 +603,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
532
603
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
533
604
|
Description: _Constants.PrepareEndChatDescriptionConstants.InitiateEndChatReceived
|
|
534
605
|
});
|
|
535
|
-
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
606
|
+
await (0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
536
607
|
}
|
|
537
|
-
_omnichannelChatComponents.BroadcastService.postMessage({
|
|
538
|
-
eventName: _TelemetryConstants.BroadcastEvent.CloseChat
|
|
539
|
-
});
|
|
540
608
|
});
|
|
541
609
|
|
|
542
610
|
// End chat on browser unload
|
|
@@ -547,8 +615,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
547
615
|
// Listen to end chat event from other tabs
|
|
548
616
|
const endChatEventName = (0, _utils.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) ?? "");
|
|
549
617
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
550
|
-
var _msg$
|
|
551
|
-
if ((msg === null || msg === void 0 ? void 0 : (_msg$
|
|
618
|
+
var _msg$payload13;
|
|
619
|
+
if ((msg === null || msg === void 0 ? void 0 : (_msg$payload13 = msg.payload) === null || _msg$payload13 === void 0 ? void 0 : _msg$payload13.runtimeId) !== _TelemetryManager.TelemetryManager.InternalTelemetryData.lcwRuntimeId) {
|
|
552
620
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
553
621
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
554
622
|
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
@@ -590,8 +658,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
590
658
|
|
|
591
659
|
// Retrieve convId
|
|
592
660
|
_omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.UpdateConversationDataForTelemetry).subscribe(msg => {
|
|
593
|
-
var _msg$
|
|
594
|
-
if ((_msg$
|
|
661
|
+
var _msg$payload14, _msg$payload14$liveWo;
|
|
662
|
+
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) {
|
|
595
663
|
setConversationId(msg.payload.liveWorkItem.conversationId);
|
|
596
664
|
}
|
|
597
665
|
});
|
|
@@ -709,14 +777,22 @@ const LiveChatWidgetStateful = props => {
|
|
|
709
777
|
}
|
|
710
778
|
}, [state.domainStates.confirmationState]);
|
|
711
779
|
(0, _react2.useEffect)(() => {
|
|
712
|
-
var
|
|
780
|
+
var _inMemoryState$appSta7, _inMemoryState$appSta8, _inMemoryState$appSta9, _inMemoryState$appSta10, _inMemoryState$appSta11, _inMemoryState$appSta12, _inMemoryState$appSta13;
|
|
781
|
+
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
782
|
+
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
783
|
+
payload: null
|
|
784
|
+
});
|
|
713
785
|
// Do not process anything during initialization
|
|
714
|
-
if ((
|
|
786
|
+
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta7 = inMemoryState.appStates) === null || _inMemoryState$appSta7 === void 0 ? void 0 : _inMemoryState$appSta7.conversationEndedBy) === _Constants.ConversationEndEntity.NotSet) {
|
|
787
|
+
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
788
|
+
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
789
|
+
Description: "conversationEndedBy is not set"
|
|
790
|
+
});
|
|
715
791
|
return;
|
|
716
792
|
}
|
|
717
793
|
|
|
718
794
|
// If start chat failed, and C2 is trying to close chat widget
|
|
719
|
-
if (
|
|
795
|
+
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.ConversationState.Postchat) {
|
|
720
796
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
721
797
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
722
798
|
Description: _Constants.PrepareEndChatDescriptionConstants.CustomerCloseChatOnFailureOrPostChat
|
|
@@ -726,7 +802,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
726
802
|
}
|
|
727
803
|
|
|
728
804
|
// Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
|
|
729
|
-
if ((
|
|
805
|
+
if ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta10 = inMemoryState.appStates) === null || _inMemoryState$appSta10 === void 0 ? void 0 : _inMemoryState$appSta10.conversationState) === _ConversationState.ConversationState.InActive) {
|
|
730
806
|
_TelemetryHelper.TelemetryHelper.logSDKEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
731
807
|
Event: _TelemetryConstants.TelemetryEvent.PrepareEndChat,
|
|
732
808
|
Description: _Constants.PrepareEndChatDescriptionConstants.CustomerCloseInactiveChat
|
|
@@ -734,11 +810,11 @@ const LiveChatWidgetStateful = props => {
|
|
|
734
810
|
(0, _endChat.endChat)(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
735
811
|
return;
|
|
736
812
|
}
|
|
737
|
-
const isConversationalSurveyEnabled =
|
|
813
|
+
const isConversationalSurveyEnabled = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta11 = inMemoryState.appStates) === null || _inMemoryState$appSta11 === void 0 ? void 0 : _inMemoryState$appSta11.isConversationalSurveyEnabled;
|
|
738
814
|
|
|
739
815
|
// In conversational survey, we need to check post chat survey logics before we set ConversationState to InActive
|
|
740
816
|
// Hence setting ConversationState to InActive will be done later in the post chat flows
|
|
741
|
-
if (!isConversationalSurveyEnabled && (
|
|
817
|
+
if (!isConversationalSurveyEnabled && (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta12 = inMemoryState.appStates) === null || _inMemoryState$appSta12 === void 0 ? void 0 : _inMemoryState$appSta12.conversationEndedBy) === _Constants.ConversationEndEntity.Agent || (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta13 = inMemoryState.appStates) === null || _inMemoryState$appSta13 === void 0 ? void 0 : _inMemoryState$appSta13.conversationEndedBy) === _Constants.ConversationEndEntity.Bot) {
|
|
742
818
|
dispatch({
|
|
743
819
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
744
820
|
payload: _ConversationState.ConversationState.InActive
|
|
@@ -746,8 +822,8 @@ const LiveChatWidgetStateful = props => {
|
|
|
746
822
|
}
|
|
747
823
|
|
|
748
824
|
// All other cases
|
|
749
|
-
(0, _endChat.prepareEndChat)(props, facadeChatSDK,
|
|
750
|
-
}, [state === null || state === void 0 ? void 0 : (_state$
|
|
825
|
+
(0, _endChat.prepareEndChat)(props, facadeChatSDK, inMemoryState, dispatch, setAdapter, setWebChatStyles, adapter);
|
|
826
|
+
}, [state === null || state === void 0 ? void 0 : (_state$appStates8 = state.appStates) === null || _state$appStates8 === void 0 ? void 0 : _state$appStates8.conversationEndedBy]);
|
|
751
827
|
|
|
752
828
|
// Publish chat widget state
|
|
753
829
|
(0, _react2.useEffect)(() => {
|
|
@@ -779,13 +855,13 @@ const LiveChatWidgetStateful = props => {
|
|
|
779
855
|
|
|
780
856
|
// Handle Chat disconnect cases
|
|
781
857
|
(0, _react2.useEffect)(() => {
|
|
782
|
-
var _inMemoryState$
|
|
858
|
+
var _inMemoryState$appSta14;
|
|
783
859
|
const inMemoryState = (0, _createReducer.executeReducer)(state, {
|
|
784
860
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
785
861
|
payload: null
|
|
786
862
|
});
|
|
787
863
|
(0, _chatDisconnectHelper.handleChatDisconnect)(props, inMemoryState, setWebChatStyles);
|
|
788
|
-
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$
|
|
864
|
+
const chatDisconnectState = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta14 = inMemoryState.appStates) === null || _inMemoryState$appSta14 === void 0 ? void 0 : _inMemoryState$appSta14.chatDisconnectEventReceived;
|
|
789
865
|
if (chatDisconnectState && adapter) {
|
|
790
866
|
try {
|
|
791
867
|
adapter.end();
|
|
@@ -884,6 +960,16 @@ const LiveChatWidgetStateful = props => {
|
|
|
884
960
|
bubbleTextColor
|
|
885
961
|
}), [webChatStyles, bubbleBackground, bubbleTextColor]);
|
|
886
962
|
|
|
963
|
+
// React to dynamic bot avatar initials updates from context
|
|
964
|
+
(0, _react2.useEffect)(() => {
|
|
965
|
+
if (state.domainStates.botAvatarInitials && state.domainStates.botAvatarInitials !== webChatStyles.botAvatarInitials) {
|
|
966
|
+
setWebChatStyles(styles => ({
|
|
967
|
+
...styles,
|
|
968
|
+
botAvatarInitials: state.domainStates.botAvatarInitials
|
|
969
|
+
}));
|
|
970
|
+
}
|
|
971
|
+
}, [state.domainStates.botAvatarInitials]);
|
|
972
|
+
|
|
887
973
|
// WebChat's Composer can only be rendered if a directLine object is defined
|
|
888
974
|
return directLine && /*#__PURE__*/_react2.default.createElement(_react2.default.Fragment, null, /*#__PURE__*/_react2.default.createElement("style", null, `
|
|
889
975
|
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar {
|
|
@@ -112,7 +112,7 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
112
112
|
Event: _TelemetryConstants.TelemetryEvent.CustomerVoiceResponsePageLoaded
|
|
113
113
|
});
|
|
114
114
|
} else if (data === _CustomerVoiceEvents.CustomerVoiceEvents.FormResponseSubmitted) {
|
|
115
|
-
_TelemetryHelper.TelemetryHelper.
|
|
115
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
116
116
|
Event: _TelemetryConstants.TelemetryEvent.CustomerVoiceFormResponseSubmitted,
|
|
117
117
|
Description: "Customer Voice form response submitted.",
|
|
118
118
|
CustomProperties: {
|
|
@@ -120,7 +120,7 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
} else if (data === _CustomerVoiceEvents.CustomerVoiceEvents.FormResponseError) {
|
|
123
|
-
_TelemetryHelper.TelemetryHelper.
|
|
123
|
+
_TelemetryHelper.TelemetryHelper.logActionEvent(_TelemetryConstants.LogLevel.ERROR, {
|
|
124
124
|
Event: _TelemetryConstants.TelemetryEvent.CustomerVoiceFormResponseError,
|
|
125
125
|
Description: "Customer Voice form response error.",
|
|
126
126
|
ExceptionDetails: {
|
|
@@ -62,7 +62,7 @@ const createMagicCodeSuccessResponse = signin => {
|
|
|
62
62
|
};
|
|
63
63
|
};
|
|
64
64
|
const WebChatContainerStateful = props => {
|
|
65
|
-
var _props$webChatContain, _defaultWebChatContai, _extendedChatConfig$L,
|
|
65
|
+
var _props$webChatContain, _defaultWebChatContai, _extendedChatConfig$L, _extendedChatConfig$L2, _extendedChatConfig$L3, _extendedChatConfig$L4, _webChatContainerProp, _webChatContainerProp2, _webChatContainerProp3, _webChatContainerProp4, _webChatContainerProp5, _webChatContainerProp6, _webChatContainerProp7, _webChatContainerProp8, _props$webChatContain6, _props$webChatContain7, _defaultWebChatContai2, _props$webChatContain8, _props$webChatContain9, _defaultWebChatContai3, _webChatContainerProp9, _webChatContainerProp10, _webChatContainerProp11, _webChatContainerProp12, _webChatContainerProp13, _webChatContainerProp14, _webChatContainerProp15, _webChatContainerProp16, _webChatContainerProp17, _webChatContainerProp18, _webChatContainerProp19, _webChatContainerProp20, _webChatContainerProp21, _webChatContainerProp22, _webChatContainerProp23, _props$webChatContain10, _props$webChatContain11, _webChatContainerProp24, _webChatContainerProp25, _webChatContainerProp26, _webChatContainerProp27, _props$citationPanePr, _props$citationPanePr2, _props$citationPanePr3, _props$citationPanePr4, _props$citationPanePr5;
|
|
66
66
|
const [facadeChatSDK] = (0, _useFacadeChatSDKStore.default)();
|
|
67
67
|
|
|
68
68
|
// Create a font family that includes emoji support, based on the primary font or default
|
|
@@ -96,17 +96,16 @@ const WebChatContainerStateful = props => {
|
|
|
96
96
|
|
|
97
97
|
// Type the chatConfig properly to avoid 'any' usage
|
|
98
98
|
const extendedChatConfig = props.chatConfig;
|
|
99
|
-
const isHistoryEnabledInConfig = extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L = extendedChatConfig.
|
|
100
|
-
const
|
|
101
|
-
const isPersistentChatEnabledForWidget = !!(extendedChatConfig !== null && extendedChatConfig !== void 0 && (_extendedChatConfig$
|
|
102
|
-
|
|
103
|
-
// Persistent chat history is enabled if explicitly set via props, or if enabled in config
|
|
104
|
-
// Props take precedence over config settings
|
|
105
|
-
const isPersistentHistoryEnabled = isHistoryEnabledViaProps || isHistoryEnabledInConfig;
|
|
99
|
+
const isHistoryEnabledInConfig = extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L = extendedChatConfig.LiveWSAndLiveChatEngJoin) === null || _extendedChatConfig$L === void 0 ? void 0 : _extendedChatConfig$L.msdyn_enablepersistentchatpreviousconversations;
|
|
100
|
+
const isHistoryEnabledViaFCB = extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L2 = extendedChatConfig.LcwFcbConfiguration) === null || _extendedChatConfig$L2 === void 0 ? void 0 : _extendedChatConfig$L2.lcwPersistentChatHistoryEnabled;
|
|
101
|
+
const isPersistentChatEnabledForWidget = !!(extendedChatConfig !== null && extendedChatConfig !== void 0 && (_extendedChatConfig$L3 = extendedChatConfig.LiveChatConfigAuthSettings) !== null && _extendedChatConfig$L3 !== void 0 && _extendedChatConfig$L3.msdyn_javascriptclientfunction) || (0, _liveChatConfigUtils.isPersistentChatEnabled)(extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L4 = extendedChatConfig.LiveWSAndLiveChatEngJoin) === null || _extendedChatConfig$L4 === void 0 ? void 0 : _extendedChatConfig$L4.msdyn_conversationmode);
|
|
106
102
|
|
|
107
103
|
// Check if both persistent chat and widget support are enabled
|
|
108
|
-
const shouldLoadPersistentHistoryMessages =
|
|
104
|
+
const shouldLoadPersistentHistoryMessages = isHistoryEnabledInConfig && isHistoryEnabledViaFCB && isPersistentChatEnabledForWidget;
|
|
109
105
|
if (shouldLoadPersistentHistoryMessages) {
|
|
106
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
107
|
+
Event: _TelemetryConstants.TelemetryEvent.PersistentChatHistoryEnabled
|
|
108
|
+
});
|
|
110
109
|
(0, _usePersistentChatHistory.default)(facadeChatSDK, (props === null || props === void 0 ? void 0 : props.persistentChatHistoryProps) ?? {});
|
|
111
110
|
}
|
|
112
111
|
// Delegated click handler for citation anchors. Placed after state is
|
|
@@ -416,9 +415,7 @@ const WebChatContainerStateful = props => {
|
|
|
416
415
|
height: "100%",
|
|
417
416
|
width: "100%"
|
|
418
417
|
}
|
|
419
|
-
}, shouldLoadPersistentHistoryMessages && /*#__PURE__*/_react2.default.createElement(_WebChatEventSubscribers.default, {
|
|
420
|
-
persistentChatHistoryEnabled: props === null || props === void 0 ? void 0 : (_props$persistentChat2 = props.persistentChatHistoryProps) === null || _props$persistentChat2 === void 0 ? void 0 : _props$persistentChat2.persistentChatHistoryEnabled
|
|
421
|
-
}), /*#__PURE__*/_react2.default.createElement(BasicWebChat, null))), citationPaneOpen && /*#__PURE__*/_react2.default.createElement(_CitationPaneStateful.default, {
|
|
418
|
+
}, shouldLoadPersistentHistoryMessages && /*#__PURE__*/_react2.default.createElement(_WebChatEventSubscribers.default, null), /*#__PURE__*/_react2.default.createElement(BasicWebChat, null))), citationPaneOpen && /*#__PURE__*/_react2.default.createElement(_CitationPaneStateful.default, {
|
|
422
419
|
id: ((_props$citationPanePr = props.citationPaneProps) === null || _props$citationPanePr === void 0 ? void 0 : _props$citationPanePr.id) || _Constants.HtmlAttributeNames.ocwCitationPaneClassName,
|
|
423
420
|
title: ((_props$citationPanePr2 = props.citationPaneProps) === null || _props$citationPanePr2 === void 0 ? void 0 : _props$citationPanePr2.title) || _Constants.HtmlAttributeNames.ocwCitationPaneTitle,
|
|
424
421
|
contentHtml: citationPaneText,
|
|
@@ -62,11 +62,17 @@ const convertPersistentChatHistoryMessageToActivity = message => {
|
|
|
62
62
|
}
|
|
63
63
|
if (tags) {
|
|
64
64
|
const formattedTags = additionalData.tags.split(",");
|
|
65
|
-
activity.channelData
|
|
65
|
+
activity.channelData = {
|
|
66
|
+
...activity.channelData,
|
|
67
|
+
tags: [...activity.channelData.tags, ...formattedTags]
|
|
68
|
+
};
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
if (from !== null && from !== void 0 && (_from$user = from.user) !== null && _from$user !== void 0 && _from$user.displayName) {
|
|
69
|
-
activity.from
|
|
72
|
+
activity.from = {
|
|
73
|
+
...activity.from,
|
|
74
|
+
name: from.user.displayName
|
|
75
|
+
};
|
|
70
76
|
}
|
|
71
77
|
if ((from === null || from === void 0 ? void 0 : (_from$application = from.application) === null || _from$application === void 0 ? void 0 : _from$application.displayName) === "Customer") {
|
|
72
78
|
activity.from = {
|
|
@@ -35,6 +35,7 @@ const defaultMiddlewareLocalizedTexts = {
|
|
|
35
35
|
MIDDLEWARE_BANNER_FILE_IS_MALICIOUS: "{0} has been blocked because the file may contain a malware.",
|
|
36
36
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_SUCCESS: "Email will be sent after chat ends!",
|
|
37
37
|
MIDDLEWARE_BANNER_FILE_EMAIL_ADDRESS_RECORDED_ERROR: "Email {0} could not be saved, try again later.",
|
|
38
|
-
PREVIOUS_MESSAGES_LOADING: "Loading previous messages..."
|
|
38
|
+
PREVIOUS_MESSAGES_LOADING: "Loading previous messages...",
|
|
39
|
+
CONVERSATION_DIVIDER_ARIA_LABEL: "Conversation history divider"
|
|
39
40
|
};
|
|
40
41
|
exports.defaultMiddlewareLocalizedTexts = defaultMiddlewareLocalizedTexts;
|
|
@@ -8,9 +8,8 @@ var _TelemetryConstants = require("../../../common/telemetry/TelemetryConstants"
|
|
|
8
8
|
var _react = require("react");
|
|
9
9
|
var _ChatWidgetEvents = _interopRequireDefault(require("../../livechatwidget/common/ChatWidgetEvents"));
|
|
10
10
|
var _PersistentConversationHandler = _interopRequireDefault(require("../../livechatwidget/common/PersistentConversationHandler"));
|
|
11
|
-
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
12
|
-
var _dispatchCustomEvent = _interopRequireDefault(require("../../../common/utils/dispatchCustomEvent"));
|
|
13
11
|
var _SecureEventBus = _interopRequireDefault(require("../../../common/utils/SecureEventBus"));
|
|
12
|
+
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
14
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
14
|
const usePersistentChatHistory = (facadeChatSDK, props) => {
|
|
16
15
|
const handlerRef = (0, _react.useRef)(null);
|
|
@@ -31,7 +30,6 @@ const usePersistentChatHistory = (facadeChatSDK, props) => {
|
|
|
31
30
|
try {
|
|
32
31
|
var _handlerRef$current;
|
|
33
32
|
await ((_handlerRef$current = handlerRef.current) === null || _handlerRef$current === void 0 ? void 0 : _handlerRef$current.pullHistory());
|
|
34
|
-
(0, _dispatchCustomEvent.default)(_ChatWidgetEvents.default.HIDE_LOADING_BANNER);
|
|
35
33
|
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
36
34
|
Event: _TelemetryConstants.TelemetryEvent.LCWPersistentChatHistoryFetchCompleted,
|
|
37
35
|
Description: "Persistent chat history fetch completed successfully"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js
CHANGED
|
@@ -17,14 +17,13 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
* Component to handle persistent chat history events.
|
|
18
18
|
* Uses WebChatStoreLoader instead of hooks to avoid context issues.
|
|
19
19
|
*/
|
|
20
|
-
const WebChatEventSubscribers =
|
|
20
|
+
const WebChatEventSubscribers = () => {
|
|
21
21
|
const [isConnected, setIsConnected] = (0, _react.useState)(false);
|
|
22
22
|
const [storeReady, setStoreReady] = (0, _react.useState)(false);
|
|
23
23
|
const storeWaitTimer = (0, _utils.createTimer)();
|
|
24
|
+
// Type the chatConfig properly to avoid 'any' usage
|
|
25
|
+
|
|
24
26
|
(0, _react.useEffect)(() => {
|
|
25
|
-
if (!props.persistentChatHistoryEnabled) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
27
|
_TelemetryHelper.TelemetryHelper.logActionEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
29
28
|
Event: _TelemetryConstants.TelemetryEvent.LCWWebChatStorePollingStarted,
|
|
30
29
|
Description: "WebChat store polling started"
|
|
@@ -56,9 +55,9 @@ const WebChatEventSubscribers = props => {
|
|
|
56
55
|
clearInterval(storeCheckInterval);
|
|
57
56
|
};
|
|
58
57
|
}
|
|
59
|
-
}, [
|
|
58
|
+
}, []);
|
|
60
59
|
(0, _react.useEffect)(() => {
|
|
61
|
-
if (!
|
|
60
|
+
if (!storeReady) {
|
|
62
61
|
return;
|
|
63
62
|
}
|
|
64
63
|
const checkConnectionStatus = () => {
|
|
@@ -115,7 +114,7 @@ const WebChatEventSubscribers = props => {
|
|
|
115
114
|
return () => {
|
|
116
115
|
clearInterval(interval);
|
|
117
116
|
};
|
|
118
|
-
}, [isConnected,
|
|
117
|
+
}, [isConnected, storeReady]);
|
|
119
118
|
return null;
|
|
120
119
|
};
|
|
121
120
|
var _default = WebChatEventSubscribers;
|
|
@@ -5,13 +5,42 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
8
9
|
var _defaultPersistentChatHistoryProps = require("../../../../../livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps");
|
|
9
10
|
var _react2 = require("@fluentui/react");
|
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
12
|
const ConversationDividerActivity = props => {
|
|
12
13
|
const styleApplied = (0, _react2.mergeStyles)(_defaultPersistentChatHistoryProps.defaultPersistentChatHistoryProps.dividerActivityStyle, props.dividerActivityStyle);
|
|
14
|
+
const ariaLabel = props.dividerActivityAriaLabel || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.CONVERSATION_DIVIDER_ARIA_LABEL;
|
|
15
|
+
|
|
16
|
+
// Create a simple separator that screen readers can detect without being interactive
|
|
17
|
+
// Preserve the visual divider styling while making it accessible
|
|
18
|
+
// Use a ref to programmatically remove only the "EL said:" prefix from the label
|
|
19
|
+
const dividerRef = _react.default.useRef(null);
|
|
20
|
+
_react.default.useEffect(() => {
|
|
21
|
+
if (dividerRef.current) {
|
|
22
|
+
// Find and hardcode the text in the label div to just show the divider label
|
|
23
|
+
const article = dividerRef.current.closest(".webchat__basic-transcript__activity");
|
|
24
|
+
if (article) {
|
|
25
|
+
const labelDiv = article.querySelector("div[id*=\"webchat__basic-transcript__active-descendant-label--\"]");
|
|
26
|
+
if (labelDiv) {
|
|
27
|
+
// Hardcode the text to just the aria label
|
|
28
|
+
labelDiv.textContent = ariaLabel || "";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}, [ariaLabel]);
|
|
13
33
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
14
|
-
|
|
34
|
+
ref: dividerRef,
|
|
35
|
+
role: "separator",
|
|
36
|
+
"aria-label": ariaLabel,
|
|
37
|
+
"aria-hidden": false,
|
|
38
|
+
className: styleApplied,
|
|
39
|
+
"data-accessibility-divider": "true",
|
|
40
|
+
style: {
|
|
41
|
+
// Add accessibility enhancements
|
|
42
|
+
position: "relative"
|
|
43
|
+
}
|
|
15
44
|
});
|
|
16
45
|
};
|
|
17
46
|
var _default = ConversationDividerActivity;
|
|
@@ -62,7 +62,7 @@ let LazyLoadHandler = /*#__PURE__*/function () {
|
|
|
62
62
|
|
|
63
63
|
// Scroll operation state
|
|
64
64
|
// Current scroll operation tracking
|
|
65
|
-
// Prevents concurrent scroll operations
|
|
65
|
+
// Prevents concurrent scroll operations (public for event handlers)
|
|
66
66
|
|
|
67
67
|
// Timeout and queue management
|
|
68
68
|
// Tracks all setTimeout IDs for cleanup
|
|
@@ -934,6 +934,21 @@ const LazyLoadActivity = props => {
|
|
|
934
934
|
setHasMoreHistory(false);
|
|
935
935
|
};
|
|
936
936
|
|
|
937
|
+
// Event listener for HISTORY_LOAD_ERROR - hides banner temporarily without disabling future loads
|
|
938
|
+
const handleHistoryLoadError = () => {
|
|
939
|
+
// Temporarily hide the banner by pausing, but keep hasMoreHistory true to allow retry
|
|
940
|
+
LazyLoadHandler.paused = true;
|
|
941
|
+
LazyLoadHandler.pendingScrollAction = false;
|
|
942
|
+
|
|
943
|
+
// Re-enable after a delay to allow retry on next scroll
|
|
944
|
+
// Note: This timeout is intentionally not tracked as it's scoped to the component lifecycle
|
|
945
|
+
window.setTimeout(() => {
|
|
946
|
+
LazyLoadHandler.paused = false;
|
|
947
|
+
}, 2000); // 2 second delay before allowing retry
|
|
948
|
+
|
|
949
|
+
LazyLoadHandler.logLifecycleEvent(_TelemetryConstants.TelemetryEvent.LCWLazyLoadHistoryError, "History load error - will retry on next scroll");
|
|
950
|
+
};
|
|
951
|
+
|
|
937
952
|
// Event listener for PersistentConversationReset to sync React state
|
|
938
953
|
// This fixes the issue where banner doesn't appear in start chat + close chat + start chat sequence
|
|
939
954
|
// by ensuring React state (hasMoreHistory) is synchronized with handler state when reset occurs
|
|
@@ -946,6 +961,9 @@ const LazyLoadActivity = props => {
|
|
|
946
961
|
const eventBus = _SecureEventBus.default.getInstance();
|
|
947
962
|
const unsubscribeNoMoreHistory = eventBus.subscribe(_ChatWidgetEvents.default.NO_MORE_HISTORY_AVAILABLE, handleNoMoreHistory);
|
|
948
963
|
|
|
964
|
+
// Add event listener for history load errors
|
|
965
|
+
const unsubscribeHistoryError = eventBus.subscribe(_ChatWidgetEvents.default.HISTORY_LOAD_ERROR, handleHistoryLoadError);
|
|
966
|
+
|
|
949
967
|
// Add event listener for persistent conversation reset
|
|
950
968
|
const resetSubscription = _omnichannelChatComponents.BroadcastService.getMessageByEventName(_TelemetryConstants.BroadcastEvent.PersistentConversationReset).subscribe(handlePersistentConversationReset);
|
|
951
969
|
|
|
@@ -962,6 +980,7 @@ const LazyLoadActivity = props => {
|
|
|
962
980
|
// Still need to return cleanup function even after reset
|
|
963
981
|
return () => {
|
|
964
982
|
unsubscribeNoMoreHistory();
|
|
983
|
+
unsubscribeHistoryError();
|
|
965
984
|
resetSubscription.unsubscribe();
|
|
966
985
|
};
|
|
967
986
|
}
|
|
@@ -1014,6 +1033,7 @@ const LazyLoadActivity = props => {
|
|
|
1014
1033
|
|
|
1015
1034
|
// Remove event listeners
|
|
1016
1035
|
unsubscribeNoMoreHistory();
|
|
1036
|
+
unsubscribeHistoryError();
|
|
1017
1037
|
resetSubscription.unsubscribe();
|
|
1018
1038
|
if (container) {
|
|
1019
1039
|
container.removeEventListener("scroll", handleScroll);
|
|
@@ -12,6 +12,7 @@ var _DirectLineActivityType = require("../../enums/DirectLineActivityType");
|
|
|
12
12
|
var _DirectLineSenderRole = require("../../enums/DirectLineSenderRole");
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _TelemetryHelper = require("../../../../../common/telemetry/TelemetryHelper");
|
|
15
|
+
var _defaultMiddlewareLocalizedTexts = require("../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
15
16
|
var _defaultSystemMessageStyles = require("./defaultStyles/defaultSystemMessageStyles");
|
|
16
17
|
var _defaultUserMessageStyles = require("./defaultStyles/defaultUserMessageStyles");
|
|
17
18
|
var _utils = require("../../../../../common/utils");
|
|
@@ -79,7 +80,7 @@ const isDataTagsPresent = card => {
|
|
|
79
80
|
};
|
|
80
81
|
|
|
81
82
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
82
|
-
const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userMessageStyleProps) => () => next => function () {
|
|
83
|
+
const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userMessageStyleProps, localizedTexts) => () => next => function () {
|
|
83
84
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
84
85
|
args[_key] = arguments[_key];
|
|
85
86
|
}
|
|
@@ -130,7 +131,11 @@ const createActivityMiddleware = (renderMarkdown, systemMessageStyleProps, userM
|
|
|
130
131
|
};
|
|
131
132
|
}
|
|
132
133
|
if (isTagIncluded(card, _Constants.Constants.conversationDividerTag)) {
|
|
133
|
-
|
|
134
|
+
const conversationDividerLabel = (localizedTexts === null || localizedTexts === void 0 ? void 0 : localizedTexts.CONVERSATION_DIVIDER_ARIA_LABEL) || _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.CONVERSATION_DIVIDER_ARIA_LABEL;
|
|
135
|
+
// Pass the computed localized text to the divider component
|
|
136
|
+
return /*#__PURE__*/_react.default.createElement(_ConversationDividerActivity.default, {
|
|
137
|
+
dividerActivityAriaLabel: conversationDividerLabel
|
|
138
|
+
});
|
|
134
139
|
}
|
|
135
140
|
if (card.activity.text && card.activity.type === _DirectLineActivityType.DirectLineActivityType.Message) {
|
|
136
141
|
if (!card.activity.channelData.isHtmlEncoded && card.activity.channelId === _Constants.Constants.webchatChannelId) {
|
|
@@ -32,7 +32,12 @@ const createCitationsMiddleware = (state, dispatch) => () => next => action => {
|
|
|
32
32
|
const citations = (_gptFeedback$summariz = gptFeedback.summarizationOpenAIResponse) === null || _gptFeedback$summariz === void 0 ? void 0 : (_gptFeedback$summariz2 = _gptFeedback$summariz.result) === null || _gptFeedback$summariz2 === void 0 ? void 0 : _gptFeedback$summariz2.textCitations;
|
|
33
33
|
// Rewrite inline citation labels in activity.text to match the global map keys
|
|
34
34
|
const updatedText = replaceCitations(action.payload.activity.text, citations, messagePrefix);
|
|
35
|
-
|
|
35
|
+
|
|
36
|
+
// Create new activity object to avoid mutation
|
|
37
|
+
action.payload.activity = {
|
|
38
|
+
...action.payload.activity,
|
|
39
|
+
text: updatedText
|
|
40
|
+
};
|
|
36
41
|
// Build a global citation map keyed by the prefixed citation id and
|
|
37
42
|
// dispatch it to app state so the UI container can render citations.
|
|
38
43
|
try {
|