@microsoft/omnichannel-chat-widget 1.8.3-main.ec1328d → 1.8.4-main.1bfa518
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 +9 -0
- package/lib/cjs/common/facades/FacadeChatSDK.js +6 -0
- package/lib/cjs/common/telemetry/AppInsightsEvents.js +14 -9
- package/lib/cjs/common/telemetry/TelemetryConstants.js +49 -2
- package/lib/cjs/common/telemetry/TelemetryManager.js +10 -7
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +29 -13
- package/lib/cjs/common/utils/SecureEventBus.js +307 -0
- package/lib/cjs/common/utils/dispatchCustomEvent.js +25 -0
- package/lib/cjs/common/utils.js +14 -1
- package/lib/cjs/components/chatbuttonstateful/ChatButtonStateful.js +16 -4
- package/lib/cjs/components/citationpanestateful/CitationDim.js +29 -0
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +218 -0
- package/lib/cjs/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +70 -0
- package/lib/cjs/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
- package/lib/cjs/components/headerstateful/HeaderStateful.js +8 -2
- package/lib/cjs/components/livechatwidget/LiveChatWidget.js +4 -4
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +127 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
- package/lib/cjs/components/livechatwidget/common/ChatWidgetEvents.js +15 -0
- package/lib/cjs/components/livechatwidget/common/PersistentConversationHandler.js +290 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +17 -0
- package/lib/cjs/components/livechatwidget/common/endChat.js +54 -12
- package/lib/cjs/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +16 -7
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +36 -4
- package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
- package/lib/cjs/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
- package/lib/cjs/components/livechatwidget/common/startChat.js +10 -5
- package/lib/cjs/components/livechatwidget/common/startChatErrorHandler.js +24 -4
- package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +8 -2
- package/lib/cjs/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +152 -33
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +37 -8
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +12 -3
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +135 -26
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
- package/lib/cjs/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/common/activities/botActivity.js +14 -0
- package/lib/cjs/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +17 -0
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +103 -0
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +36 -2
- package/lib/cjs/components/webchatcontainerstateful/common/utils/fontUtils.js +28 -0
- package/lib/cjs/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +57 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +121 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +10 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +47 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1058 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +34 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +50 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +16 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +20 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +59 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +5 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -2
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +102 -30
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +47 -45
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +9 -1
- package/lib/cjs/contexts/createReducer.js +30 -0
- package/lib/cjs/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/cjs/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/cjs/index.js +9 -1
- package/lib/cjs/plugins/newMessageEventHandler.js +4 -1
- package/lib/esm/common/Constants.js +9 -0
- package/lib/esm/common/facades/FacadeChatSDK.js +6 -0
- package/lib/esm/common/telemetry/AppInsightsEvents.js +14 -9
- package/lib/esm/common/telemetry/TelemetryConstants.js +47 -1
- package/lib/esm/common/telemetry/TelemetryManager.js +10 -7
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +30 -14
- package/lib/esm/common/utils/SecureEventBus.js +328 -0
- package/lib/esm/common/utils/dispatchCustomEvent.js +18 -0
- package/lib/esm/common/utils.js +11 -0
- package/lib/esm/components/chatbuttonstateful/ChatButtonStateful.js +17 -5
- package/lib/esm/components/citationpanestateful/CitationDim.js +20 -0
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +207 -0
- package/lib/esm/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js +61 -0
- package/lib/esm/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js +1 -0
- package/lib/esm/components/headerstateful/HeaderStateful.js +9 -3
- package/lib/esm/components/livechatwidget/LiveChatWidget.js +4 -4
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.js +120 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
- package/lib/esm/components/livechatwidget/common/ChatWidgetEvents.js +8 -0
- package/lib/esm/components/livechatwidget/common/PersistentConversationHandler.js +283 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.js +10 -0
- package/lib/esm/components/livechatwidget/common/endChat.js +55 -13
- package/lib/esm/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +16 -7
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +33 -2
- package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
- package/lib/esm/components/livechatwidget/common/registerTelemetryLoggers.js +3 -0
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +2 -2
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +12 -7
- package/lib/esm/components/livechatwidget/common/startChatErrorHandler.js +23 -4
- package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +3 -3
- package/lib/esm/components/livechatwidget/interfaces/IPersistentChatHistoryProps.js +1 -0
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +153 -34
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +39 -10
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +13 -4
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +135 -27
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatAdapter.js +43 -14
- package/lib/esm/components/webchatcontainerstateful/common/DesignerChatSDK.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/common/activities/botActivity.js +7 -0
- package/lib/esm/components/webchatcontainerstateful/common/activities/conversationDividerActivity.js +9 -0
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +96 -0
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/defaultProps/defaultWebChatStatefulProps.js +2 -2
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultWebChatStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/common/utils/chatAdapterUtils.js +32 -0
- package/lib/esm/components/webchatcontainerstateful/common/utils/fontUtils.js +21 -0
- package/lib/esm/components/webchatcontainerstateful/hooks/usePersistentChatHistory.js +49 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/ICitation.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.js +114 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.js +3 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.js +39 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.js +1080 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.js +25 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.js +48 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.js +13 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.js +52 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +3 -2
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +103 -30
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.js +29 -7
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +47 -45
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +9 -1
- package/lib/esm/contexts/createReducer.js +30 -0
- package/lib/esm/firstresponselatency/FirstMessageTrackerFromBot.js +3 -2
- package/lib/esm/firstresponselatency/FirstResponseLatencyTracker.js +6 -2
- package/lib/esm/index.js +1 -0
- package/lib/esm/plugins/newMessageEventHandler.js +4 -1
- package/lib/types/common/Constants.d.ts +8 -0
- package/lib/types/common/facades/FacadeChatSDK.d.ts +3 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +44 -2
- package/lib/types/common/telemetry/interfaces/IInternalTelemetryData.d.ts +1 -0
- package/lib/types/common/utils/SecureEventBus.d.ts +159 -0
- package/lib/types/common/utils/dispatchCustomEvent.d.ts +2 -0
- package/lib/types/common/utils.d.ts +9 -1
- package/lib/types/components/citationpanestateful/CitationDim.d.ts +5 -0
- package/lib/types/components/citationpanestateful/CitationPaneStateful.d.ts +4 -0
- package/lib/types/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.d.ts +11 -0
- package/lib/types/components/citationpanestateful/interfaces/ICitationPaneStatefulProps.d.ts +19 -0
- package/lib/types/components/confirmationpanestateful/common/defaultProps/defaultConfirmationPaneLocalizedTexts.d.ts +1 -1
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulProps.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/AddActivitySubscriber.d.ts +45 -0
- package/lib/types/components/livechatwidget/common/ChatWidgetEvents.d.ts +7 -0
- package/lib/types/components/livechatwidget/common/PersistentConversationHandler.d.ts +28 -0
- package/lib/types/components/livechatwidget/common/defaultProps/defaultPersistentChatHistoryProps.d.ts +2 -0
- package/lib/types/components/livechatwidget/common/getMockChatSDKIfApplicable.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +11 -0
- package/lib/types/components/livechatwidget/common/startChatErrorHandler.d.ts +1 -0
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +5 -1
- package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +5 -3
- package/lib/types/components/livechatwidget/interfaces/IPersistentChatHistoryProps.d.ts +11 -0
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatAdapter.d.ts +4 -2
- package/lib/types/components/webchatcontainerstateful/common/DesignerChatSDK.d.ts +5 -0
- package/lib/types/components/webchatcontainerstateful/common/activities/botActivity.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/common/activities/conversationDividerActivity.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/common/utils/chatAdapterUtils.d.ts +6 -1
- package/lib/types/components/webchatcontainerstateful/common/utils/fontUtils.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/hooks/usePersistentChatHistory.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/ICitation.d.ts +12 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +15 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/WebChatEventSubscribers.d.ts +6 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/Constants.d.ts +3 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/ConversationDividerActivity.d.ts +4 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity.d.ts +326 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LoadInlineBannerActivity.d.ts +8 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityMiddleware.d.ts +2 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultInLineBannerStyle.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/HistoryMessageTimestamp.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +3 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/localizedStringsBotInitialsMiddleware.d.ts +1 -1
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +2 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +2 -0
- package/lib/types/contexts/common/ILiveChatWidgetLocalizedTexts.d.ts +6 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +47 -45
- package/lib/types/index.d.ts +1 -0
- package/package.json +3 -3
- /package/lib/cjs/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
- /package/lib/esm/components/{confirmationpanestateful/interfaces/IConfirmationPaneLocalizedText.js → citationpanestateful/interfaces/ICitationPaneStatefulProps.js} +0 -0
- /package/lib/types/components/confirmationpanestateful/interfaces/{IConfirmationPaneLocalizedText.d.ts → IConfirmationPaneLocalizedTexts.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
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); }
|
|
2
|
-
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { BroadcastEvent, ConversationStage, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import { BroadcastService, BroadcastServiceInitialize, decodeComponentString } from "@microsoft/omnichannel-chat-components";
|
|
4
4
|
import { Components } from "botframework-webchat";
|
|
5
5
|
import { ConfirmationState, Constants, ConversationEndEntity, E2VVOptions, LiveWorkItemState, PrepareEndChatDescriptionConstants, StorageType, WidgetLoadCustomErrorString } from "../../../common/Constants";
|
|
@@ -54,14 +54,18 @@ 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, {
|
|
63
64
|
Event: TelemetryEvent.UXLiveChatWidgetStart,
|
|
64
|
-
Description: "Live chat widget loading started."
|
|
65
|
+
Description: "Live chat widget loading started.",
|
|
66
|
+
CustomProperties: {
|
|
67
|
+
ConversationStage: ConversationStage.Initialization
|
|
68
|
+
}
|
|
65
69
|
});
|
|
66
70
|
}, []);
|
|
67
71
|
const [state, dispatch] = useChatContextStore();
|
|
@@ -314,7 +318,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
314
318
|
});
|
|
315
319
|
});
|
|
316
320
|
BroadcastService.getMessageByEventName(BroadcastEvent.StartProactiveChat).subscribe(msg => {
|
|
317
|
-
TelemetryHelper.
|
|
321
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
318
322
|
Event: TelemetryEvent.StartProactiveChatEventReceived,
|
|
319
323
|
Description: "Start proactive chat event received."
|
|
320
324
|
});
|
|
@@ -440,7 +444,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
440
444
|
payload: msg === null || msg === void 0 ? void 0 : (_msg$payload8 = msg.payload) === null || _msg$payload8 === void 0 ? void 0 : _msg$payload8.customContext
|
|
441
445
|
});
|
|
442
446
|
}
|
|
443
|
-
TelemetryHelper.
|
|
447
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
444
448
|
Event: TelemetryEvent.StartChatEventReceived,
|
|
445
449
|
Description: "Start chat event received."
|
|
446
450
|
});
|
|
@@ -480,24 +484,98 @@ export const LiveChatWidgetStateful = props => {
|
|
|
480
484
|
eventName: BroadcastEvent.MaximizeChat,
|
|
481
485
|
payload: {
|
|
482
486
|
height: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain = inMemoryState.domainStates) === null || _inMemoryState$domain === void 0 ? void 0 : (_inMemoryState$domain2 = _inMemoryState$domain.widgetSize) === null || _inMemoryState$domain2 === void 0 ? void 0 : _inMemoryState$domain2.height,
|
|
483
|
-
width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width
|
|
487
|
+
width: inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$domain3 = inMemoryState.domainStates) === null || _inMemoryState$domain3 === void 0 ? void 0 : (_inMemoryState$domain4 = _inMemoryState$domain3.widgetSize) === null || _inMemoryState$domain4 === void 0 ? void 0 : _inMemoryState$domain4.width,
|
|
488
|
+
lcwRuntimeId: TelemetryManager.InternalTelemetryData.lcwRuntimeId
|
|
484
489
|
}
|
|
485
490
|
});
|
|
486
491
|
return;
|
|
487
492
|
}
|
|
488
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
|
+
};
|
|
489
544
|
|
|
490
545
|
// End chat
|
|
491
|
-
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async
|
|
546
|
+
BroadcastService.getMessageByEventName(BroadcastEvent.InitiateEndChat).subscribe(async msg => {
|
|
547
|
+
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
548
|
+
Event: TelemetryEvent.EndChatEventReceived,
|
|
549
|
+
Description: "Received InitiateEndChat BroadcastEvent.",
|
|
550
|
+
CustomProperties: {
|
|
551
|
+
ConversationStage: ConversationStage.ConversationEnd,
|
|
552
|
+
payload: msg === null || msg === void 0 ? void 0 : msg.payload
|
|
553
|
+
}
|
|
554
|
+
});
|
|
555
|
+
const conversationDetails = await getConversationDetailsCall(facadeChatSDK);
|
|
556
|
+
const {
|
|
557
|
+
chatConfig
|
|
558
|
+
} = props;
|
|
559
|
+
const isPersistent = isPersistentEnabled(chatConfig);
|
|
492
560
|
TelemetryHelper.logSDKEventToAllTelemetry(LogLevel.INFO, {
|
|
493
561
|
Event: TelemetryEvent.EndChatEventReceived,
|
|
494
|
-
Description: "
|
|
562
|
+
Description: "Processing initiateEndChat, fetched conversation details",
|
|
563
|
+
CustomProperties: {
|
|
564
|
+
conversationDetails,
|
|
565
|
+
isPersistent
|
|
566
|
+
}
|
|
495
567
|
});
|
|
496
|
-
|
|
497
|
-
|
|
568
|
+
if (isPersistent && conversationDetails) {
|
|
569
|
+
await handleInitiateEndChatForPersistentChat(msg, conversationDetails);
|
|
570
|
+
return;
|
|
571
|
+
}
|
|
498
572
|
const persistedState = getStateFromCache(getWidgetCacheIdfromProps(props));
|
|
499
573
|
if (persistedState && persistedState.appStates.conversationState === ConversationState.Active) {
|
|
500
|
-
|
|
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.
|
|
501
579
|
dispatch({
|
|
502
580
|
type: LiveChatWidgetActionType.SET_CONFIRMATION_STATE,
|
|
503
581
|
payload: ConfirmationState.Ok
|
|
@@ -517,11 +595,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
517
595
|
Event: TelemetryEvent.PrepareEndChat,
|
|
518
596
|
Description: PrepareEndChatDescriptionConstants.InitiateEndChatReceived
|
|
519
597
|
});
|
|
520
|
-
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
598
|
+
await endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, skipEndChatSDK, skipCloseChat);
|
|
521
599
|
}
|
|
522
|
-
BroadcastService.postMessage({
|
|
523
|
-
eventName: BroadcastEvent.CloseChat
|
|
524
|
-
});
|
|
525
600
|
});
|
|
526
601
|
|
|
527
602
|
// End chat on browser unload
|
|
@@ -532,8 +607,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
532
607
|
// Listen to end chat event from other tabs
|
|
533
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) ?? "");
|
|
534
609
|
BroadcastService.getMessageByEventName(endChatEventName).subscribe(msg => {
|
|
535
|
-
var _msg$
|
|
536
|
-
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) {
|
|
537
612
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
538
613
|
Event: TelemetryEvent.PrepareEndChat,
|
|
539
614
|
Description: "Received EndChat BroadcastEvent from other tabs. Closing this chat."
|
|
@@ -575,8 +650,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
575
650
|
|
|
576
651
|
// Retrieve convId
|
|
577
652
|
BroadcastService.getMessageByEventName(BroadcastEvent.UpdateConversationDataForTelemetry).subscribe(msg => {
|
|
578
|
-
var _msg$
|
|
579
|
-
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) {
|
|
580
655
|
setConversationId(msg.payload.liveWorkItem.conversationId);
|
|
581
656
|
}
|
|
582
657
|
});
|
|
@@ -694,14 +769,22 @@ export const LiveChatWidgetStateful = props => {
|
|
|
694
769
|
}
|
|
695
770
|
}, [state.domainStates.confirmationState]);
|
|
696
771
|
useEffect(() => {
|
|
697
|
-
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
|
+
});
|
|
698
777
|
// Do not process anything during initialization
|
|
699
|
-
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
|
+
});
|
|
700
783
|
return;
|
|
701
784
|
}
|
|
702
785
|
|
|
703
786
|
// If start chat failed, and C2 is trying to close chat widget
|
|
704
|
-
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) {
|
|
705
788
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
706
789
|
Event: TelemetryEvent.PrepareEndChat,
|
|
707
790
|
Description: PrepareEndChatDescriptionConstants.CustomerCloseChatOnFailureOrPostChat
|
|
@@ -711,7 +794,7 @@ export const LiveChatWidgetStateful = props => {
|
|
|
711
794
|
}
|
|
712
795
|
|
|
713
796
|
// Scenario -> Chat was InActive and closing the chat (Refresh scenario on post chat)
|
|
714
|
-
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) {
|
|
715
798
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
716
799
|
Event: TelemetryEvent.PrepareEndChat,
|
|
717
800
|
Description: PrepareEndChatDescriptionConstants.CustomerCloseInactiveChat
|
|
@@ -719,11 +802,11 @@ export const LiveChatWidgetStateful = props => {
|
|
|
719
802
|
endChat(props, facadeChatSDK, state, dispatch, setAdapter, setWebChatStyles, adapter, false, false, true);
|
|
720
803
|
return;
|
|
721
804
|
}
|
|
722
|
-
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;
|
|
723
806
|
|
|
724
807
|
// In conversational survey, we need to check post chat survey logics before we set ConversationState to InActive
|
|
725
808
|
// Hence setting ConversationState to InActive will be done later in the post chat flows
|
|
726
|
-
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) {
|
|
727
810
|
dispatch({
|
|
728
811
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
729
812
|
payload: ConversationState.InActive
|
|
@@ -731,8 +814,8 @@ export const LiveChatWidgetStateful = props => {
|
|
|
731
814
|
}
|
|
732
815
|
|
|
733
816
|
// All other cases
|
|
734
|
-
prepareEndChat(props, facadeChatSDK,
|
|
735
|
-
}, [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]);
|
|
736
819
|
|
|
737
820
|
// Publish chat widget state
|
|
738
821
|
useEffect(() => {
|
|
@@ -764,13 +847,13 @@ export const LiveChatWidgetStateful = props => {
|
|
|
764
847
|
|
|
765
848
|
// Handle Chat disconnect cases
|
|
766
849
|
useEffect(() => {
|
|
767
|
-
var _inMemoryState$
|
|
850
|
+
var _inMemoryState$appSta14;
|
|
768
851
|
const inMemoryState = executeReducer(state, {
|
|
769
852
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
770
853
|
payload: null
|
|
771
854
|
});
|
|
772
855
|
handleChatDisconnect(props, inMemoryState, setWebChatStyles);
|
|
773
|
-
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;
|
|
774
857
|
if (chatDisconnectState && adapter) {
|
|
775
858
|
try {
|
|
776
859
|
adapter.end();
|
|
@@ -796,7 +879,10 @@ export const LiveChatWidgetStateful = props => {
|
|
|
796
879
|
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
797
880
|
Event: TelemetryEvent.UXLiveChatWidgetCompleted,
|
|
798
881
|
Description: "Live chat widget loading completed.",
|
|
799
|
-
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
882
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
883
|
+
CustomProperties: {
|
|
884
|
+
ConversationStage: ConversationStage.Initialization
|
|
885
|
+
}
|
|
800
886
|
});
|
|
801
887
|
}, []);
|
|
802
888
|
const initiateEndChatOnBrowserUnload = () => {
|
|
@@ -866,25 +952,58 @@ export const LiveChatWidgetStateful = props => {
|
|
|
866
952
|
bubbleTextColor
|
|
867
953
|
}), [webChatStyles, bubbleBackground, bubbleTextColor]);
|
|
868
954
|
|
|
955
|
+
// React to dynamic bot avatar initials updates from context
|
|
956
|
+
useEffect(() => {
|
|
957
|
+
if (state.domainStates.botAvatarInitials && state.domainStates.botAvatarInitials !== webChatStyles.botAvatarInitials) {
|
|
958
|
+
setWebChatStyles(styles => ({
|
|
959
|
+
...styles,
|
|
960
|
+
botAvatarInitials: state.domainStates.botAvatarInitials
|
|
961
|
+
}));
|
|
962
|
+
}
|
|
963
|
+
}, [state.domainStates.botAvatarInitials]);
|
|
964
|
+
|
|
869
965
|
// WebChat's Composer can only be rendered if a directLine object is defined
|
|
870
966
|
return directLine && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("style", null, `
|
|
871
|
-
::-webkit-scrollbar {
|
|
967
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar {
|
|
872
968
|
width: ${scrollbarProps.width};
|
|
873
969
|
}
|
|
874
970
|
|
|
875
|
-
::-webkit-scrollbar-track {
|
|
971
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
|
|
876
972
|
background: ${scrollbarProps.trackBackgroundColor};
|
|
877
973
|
}
|
|
878
974
|
|
|
879
|
-
::-webkit-scrollbar-thumb {
|
|
975
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
|
|
880
976
|
background: ${scrollbarProps.thumbBackgroundColor};
|
|
881
977
|
border-radius: ${scrollbarProps.thumbBorderRadius};
|
|
882
978
|
}
|
|
883
979
|
|
|
884
|
-
::-webkit-scrollbar-thumb:hover {
|
|
980
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
|
|
885
981
|
background: ${scrollbarProps.thumbHoverColor};
|
|
886
982
|
}
|
|
887
983
|
|
|
984
|
+
/* High Contrast mode support - optimized for all variants */
|
|
985
|
+
@media (prefers-contrast: high), (-ms-high-contrast: active), (forced-colors: active) {
|
|
986
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-track {
|
|
987
|
+
background: Canvas !important;
|
|
988
|
+
border: 1px solid CanvasText !important;
|
|
989
|
+
}
|
|
990
|
+
|
|
991
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb {
|
|
992
|
+
background: CanvasText !important;
|
|
993
|
+
border: 1px solid Canvas !important;
|
|
994
|
+
min-height: 20px !important;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-thumb:hover {
|
|
998
|
+
background: Highlight !important;
|
|
999
|
+
border: 1px solid CanvasText !important;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
#oc-lcw .webchat__basic-transcript__scrollable::-webkit-scrollbar-corner {
|
|
1003
|
+
background: Canvas !important;
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
|
|
888
1007
|
.webchat__basic-transcript__activity-markdown-body > :last-child {
|
|
889
1008
|
margin-bottom: 0px;
|
|
890
1009
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
1
|
+
import { ConversationStage, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
2
|
import React, { useEffect } from "react";
|
|
3
3
|
import { ParticipantType } from "../../common/Constants";
|
|
4
4
|
import { CustomerVoiceEvents } from "./enums/CustomerVoiceEvents";
|
|
@@ -6,9 +6,10 @@ import { PostChatSurveyMode } from "./enums/PostChatSurveyMode";
|
|
|
6
6
|
import { PostChatSurveyPane } from "@microsoft/omnichannel-chat-components";
|
|
7
7
|
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
8
8
|
import { defaultGeneralPostChatSurveyPaneStyleProps } from "./common/defaultStyleProps/defaultgeneralPostChatSurveyPaneStyleProps";
|
|
9
|
-
import { findAllFocusableElement } from "../../common/utils";
|
|
9
|
+
import { createTimer, findAllFocusableElement } from "../../common/utils";
|
|
10
10
|
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
11
11
|
import isValidSurveyUrl from "./common/isValidSurveyUrl";
|
|
12
|
+
let uiTimer;
|
|
12
13
|
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact, customerVoiceSurveyCorrelationId) {
|
|
13
14
|
let showMultiLingual = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
14
15
|
const surveyLinkParams = new URLSearchParams({
|
|
@@ -21,20 +22,32 @@ const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, co
|
|
|
21
22
|
return `${surveyInviteLink}&${surveyLinkParams.toString()}`;
|
|
22
23
|
};
|
|
23
24
|
export const PostChatSurveyPaneStateful = props => {
|
|
24
|
-
var _props$styleProps, _state$appStates, _props$controlProps;
|
|
25
|
+
var _props$styleProps, _state$appStates, _state$domainStates$p, _props$controlProps;
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
uiTimer = createTimer();
|
|
28
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
29
|
+
Event: TelemetryEvent.UXPostChatPaneStarted,
|
|
30
|
+
Description: "Postchat survey pane loading started.",
|
|
31
|
+
CustomProperties: {
|
|
32
|
+
ConversationStage: ConversationStage.ConversationEnd
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}, []);
|
|
25
36
|
const [state] = useChatContextStore();
|
|
26
37
|
const generalStyleProps = Object.assign({}, defaultGeneralPostChatSurveyPaneStyleProps, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps, {
|
|
27
38
|
display: state.appStates.isMinimized ? "none" : "contents"
|
|
28
39
|
});
|
|
29
40
|
let surveyInviteLink = "";
|
|
30
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;
|
|
31
|
-
if (state.domainStates.postChatContext.botSurveyInviteLink &&
|
|
42
|
+
if ((_state$domainStates$p = state.domainStates.postChatContext) !== null && _state$domainStates$p !== void 0 && _state$domainStates$p.botSurveyInviteLink &&
|
|
32
43
|
// Bot survey enabled
|
|
33
44
|
state.appStates.postChatParticipantType === ParticipantType.Bot) {
|
|
45
|
+
var _state$domainStates$p2, _state$domainStates$p3;
|
|
34
46
|
// Only Bot has engaged
|
|
35
|
-
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 || "");
|
|
36
48
|
} else {
|
|
37
|
-
|
|
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 || "");
|
|
38
51
|
}
|
|
39
52
|
if (props.copilotSurveyContext) {
|
|
40
53
|
surveyInviteLink = `${surveyInviteLink}&mcs_additionalcontext=${JSON.stringify(props.copilotSurveyContext)}`;
|
|
@@ -72,7 +85,14 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
72
85
|
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
73
86
|
Event: TelemetryEvent.PostChatSurveyLoaded
|
|
74
87
|
});
|
|
75
|
-
|
|
88
|
+
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
89
|
+
Event: TelemetryEvent.UXPostChatPaneCompleted,
|
|
90
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
91
|
+
Description: "Postchat survey pane loading completed.",
|
|
92
|
+
CustomProperties: {
|
|
93
|
+
ConversationStage: ConversationStage.ConversationEnd
|
|
94
|
+
}
|
|
95
|
+
});
|
|
76
96
|
//Customer Voice Telemetry Events
|
|
77
97
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
98
|
window.addEventListener("message", message => {
|
|
@@ -85,16 +105,22 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
85
105
|
Event: TelemetryEvent.CustomerVoiceResponsePageLoaded
|
|
86
106
|
});
|
|
87
107
|
} else if (data === CustomerVoiceEvents.FormResponseSubmitted) {
|
|
88
|
-
TelemetryHelper.
|
|
108
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
89
109
|
Event: TelemetryEvent.CustomerVoiceFormResponseSubmitted,
|
|
90
|
-
Description: "Customer Voice form response submitted."
|
|
110
|
+
Description: "Customer Voice form response submitted.",
|
|
111
|
+
CustomProperties: {
|
|
112
|
+
ConversationStage: ConversationStage.ConversationEnd
|
|
113
|
+
}
|
|
91
114
|
});
|
|
92
115
|
} else if (data === CustomerVoiceEvents.FormResponseError) {
|
|
93
|
-
TelemetryHelper.
|
|
116
|
+
TelemetryHelper.logActionEvent(LogLevel.ERROR, {
|
|
94
117
|
Event: TelemetryEvent.CustomerVoiceFormResponseError,
|
|
95
118
|
Description: "Customer Voice form response error.",
|
|
96
119
|
ExceptionDetails: {
|
|
97
120
|
message: "Customer Voice form response error."
|
|
121
|
+
},
|
|
122
|
+
CustomProperties: {
|
|
123
|
+
ConversationStage: ConversationStage.ConversationEnd
|
|
98
124
|
}
|
|
99
125
|
});
|
|
100
126
|
} else if (typeof data === "string" && data.startsWith(CustomerVoiceEvents.FormsError)) {
|
|
@@ -103,6 +129,9 @@ export const PostChatSurveyPaneStateful = props => {
|
|
|
103
129
|
Description: "Customer Voice failed to load with forms error.",
|
|
104
130
|
ExceptionDetails: {
|
|
105
131
|
message: `Customer Voice forms error details: ${data}`
|
|
132
|
+
},
|
|
133
|
+
CustomProperties: {
|
|
134
|
+
ConversationStage: ConversationStage.ConversationEnd
|
|
106
135
|
}
|
|
107
136
|
});
|
|
108
137
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HtmlAttributeNames, Regex } from "../../common/Constants";
|
|
2
|
-
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import { ConversationStage, LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
3
3
|
import React, { useEffect } from "react";
|
|
4
4
|
import { createTimer, extractPreChatSurveyResponseValues, findAllFocusableElement, getStateFromCache, getWidgetCacheId, isUndefinedOrEmpty, parseAdaptiveCardPayload } from "../../common/utils";
|
|
5
5
|
import { ConversationState } from "../../contexts/common/ConversationState";
|
|
@@ -19,7 +19,10 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
19
19
|
uiTimer = createTimer();
|
|
20
20
|
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
21
21
|
Event: TelemetryEvent.UXPrechatPaneStart,
|
|
22
|
-
Description: "Prechat survey pane loading started."
|
|
22
|
+
Description: "Prechat survey pane loading started.",
|
|
23
|
+
CustomProperties: {
|
|
24
|
+
ConversationStage: ConversationStage.Initialization
|
|
25
|
+
}
|
|
23
26
|
});
|
|
24
27
|
}, []);
|
|
25
28
|
|
|
@@ -70,7 +73,10 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
70
73
|
onSubmit: async values => {
|
|
71
74
|
TelemetryHelper.logActionEventToAllTelemetry(LogLevel.INFO, {
|
|
72
75
|
Event: TelemetryEvent.PrechatSubmitted,
|
|
73
|
-
Description: "Prechat survey submitted."
|
|
76
|
+
Description: "Prechat survey submitted.",
|
|
77
|
+
CustomProperties: {
|
|
78
|
+
ConversationStage: ConversationStage.Initialization
|
|
79
|
+
}
|
|
74
80
|
});
|
|
75
81
|
dispatch({
|
|
76
82
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
@@ -144,7 +150,10 @@ export const PreChatSurveyPaneStateful = props => {
|
|
|
144
150
|
TelemetryHelper.logLoadingEventToAllTelemetry(LogLevel.INFO, {
|
|
145
151
|
Event: TelemetryEvent.UXPrechatPaneCompleted,
|
|
146
152
|
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed,
|
|
147
|
-
Description: "Prechat survey pane loading completed."
|
|
153
|
+
Description: "Prechat survey pane loading completed.",
|
|
154
|
+
CustomProperties: {
|
|
155
|
+
ConversationStage: ConversationStage.Initialization
|
|
156
|
+
}
|
|
148
157
|
});
|
|
149
158
|
}, []);
|
|
150
159
|
|