@microsoft/omnichannel-chat-widget 1.8.3-main.ec1328d → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/common/Constants.js +2 -0
- package/lib/cjs/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/cjs/components/citationpanestateful/CitationDim.js +29 -0
- package/lib/cjs/components/citationpanestateful/CitationPaneStateful.js +199 -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/livechatwidget/LiveChatWidget.js +4 -4
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
- package/lib/cjs/components/livechatwidget/common/endChat.js +21 -2
- package/lib/cjs/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +1 -1
- package/lib/cjs/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
- package/lib/cjs/components/livechatwidget/common/startChat.js +5 -4
- package/lib/cjs/components/livechatwidget/interfaces/IMockProps.js +8 -2
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +29 -5
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +96 -11
- 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/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/interfaces/ICitation.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +97 -30
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +46 -45
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
- package/lib/cjs/contexts/createReducer.js +15 -0
- package/lib/cjs/index.js +9 -1
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/telemetry/TelemetryConstants.js +3 -0
- package/lib/esm/components/citationpanestateful/CitationDim.js +20 -0
- package/lib/esm/components/citationpanestateful/CitationPaneStateful.js +188 -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/livechatwidget/LiveChatWidget.js +4 -4
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +4 -5
- package/lib/esm/components/livechatwidget/common/endChat.js +22 -3
- package/lib/esm/components/livechatwidget/common/getMockChatSDKIfApplicable.js +4 -3
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +1 -1
- package/lib/esm/components/livechatwidget/common/overridePropsOnMockIfApplicable.js +2 -1
- package/lib/esm/components/livechatwidget/common/startChat.js +5 -4
- package/lib/esm/components/livechatwidget/interfaces/IMockProps.js +3 -3
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +29 -5
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +96 -12
- 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/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/interfaces/ICitation.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultAvatarTextStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.js +98 -30
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.js +2 -2
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +46 -45
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +2 -0
- package/lib/esm/contexts/createReducer.js +15 -0
- package/lib/esm/index.js +1 -0
- package/lib/types/common/Constants.d.ts +2 -0
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +3 -0
- 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/getMockChatSDKIfApplicable.d.ts +2 -1
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
- package/lib/types/components/livechatwidget/interfaces/IMockProps.d.ts +5 -3
- 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/utils/chatAdapterUtils.d.ts +6 -1
- package/lib/types/components/webchatcontainerstateful/common/utils/fontUtils.d.ts +10 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/ICitation.d.ts +12 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/citationsMiddleware.d.ts +3 -4
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/queueOverflowHandlerMiddleware.d.ts +2 -2
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +1 -0
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +46 -45
- package/lib/types/index.d.ts +1 -0
- package/package.json +2 -2
- /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
|
@@ -10,49 +10,50 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
10
10
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_ELEMENT_ID"] = 0] = "SET_WIDGET_ELEMENT_ID";
|
|
11
11
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RENDERING_MIDDLEWARE_PROPS"] = 1] = "SET_RENDERING_MIDDLEWARE_PROPS";
|
|
12
12
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MIDDLEWARE_LOCALIZED_TEXTS"] = 2] = "SET_MIDDLEWARE_LOCALIZED_TEXTS";
|
|
13
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
14
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
15
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
16
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
17
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
18
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
19
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
20
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
21
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
22
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
23
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
24
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
25
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
26
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
27
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
28
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
29
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
30
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
31
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
32
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
33
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
34
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
35
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
36
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
37
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
38
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
39
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
40
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
41
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
42
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
43
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
44
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
45
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
46
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
47
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
48
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
49
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
50
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
51
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
52
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
53
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
54
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
55
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
56
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
57
|
-
LiveChatWidgetActionType[LiveChatWidgetActionType["
|
|
13
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CITATIONS"] = 3] = "SET_CITATIONS";
|
|
14
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_GLOBAL_DIR"] = 4] = "SET_GLOBAL_DIR";
|
|
15
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MINIMIZED"] = 5] = "SET_MINIMIZED";
|
|
16
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 6] = "SET_CONVERSATION_STATE";
|
|
17
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 7] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
|
|
18
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 8] = "SET_START_CHAT_FAILING";
|
|
19
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILURE_TYPE"] = 9] = "SET_START_CHAT_FAILURE_TYPE";
|
|
20
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 10] = "SET_OUTSIDE_OPERATING_HOURS";
|
|
21
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 11] = "SET_PRE_CHAT_SURVEY_RESPONSE";
|
|
22
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 12] = "SET_CUSTOM_CONTEXT";
|
|
23
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 13] = "SET_SHOW_CONFIRMATION";
|
|
24
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 14] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
|
|
25
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 15] = "SET_PRECHAT_RESPONSE_EMAIL";
|
|
26
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 16] = "SET_AUDIO_NOTIFICATION";
|
|
27
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 17] = "SET_E2VV_ENABLED";
|
|
28
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 18] = "SET_POST_CHAT_CONTEXT";
|
|
29
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 19] = "SHOW_CALLING_CONTAINER";
|
|
30
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 20] = "SET_INCOMING_CALL";
|
|
31
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 21] = "DISABLE_VIDEO_CALL";
|
|
32
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 22] = "DISABLE_LOCAL_VIDEO";
|
|
33
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 23] = "DISABLE_REMOTE_VIDEO";
|
|
34
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 24] = "SET_CHAT_TOKEN";
|
|
35
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 25] = "SET_START_CHAT_BUTTON_DISPLAY";
|
|
36
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 26] = "SET_PROACTIVE_CHAT_PARAMS";
|
|
37
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 27] = "SET_TELEMETRY_DATA";
|
|
38
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 28] = "SET_RECONNECT_ID";
|
|
39
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 29] = "SET_UNREAD_MESSAGE_COUNT";
|
|
40
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 30] = "SET_FOCUS_CHAT_BUTTON";
|
|
41
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 31] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
|
|
42
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 32] = "SET_CONVERSATION_ENDED_BY";
|
|
43
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 33] = "SET_WIDGET_STATE";
|
|
44
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 34] = "SET_LIVE_CHAT_CONTEXT";
|
|
45
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 35] = "SET_BOT_OAUTH_SIGNIN_ID";
|
|
46
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 36] = "SET_WIDGET_SIZE";
|
|
47
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 37] = "SET_WIDGET_INSTANCE_ID";
|
|
48
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 38] = "SET_LIVE_CHAT_CONFIG";
|
|
49
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 39] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
|
|
50
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 40] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
|
|
51
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 41] = "SET_SHOULD_USE_BOT_SURVEY";
|
|
52
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 42] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
|
|
53
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 43] = "SET_SURVEY_MODE";
|
|
54
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 44] = "SET_CONFIRMATION_STATE";
|
|
55
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_PARTICIPANT_TYPE"] = 45] = "SET_POST_CHAT_PARTICIPANT_TYPE";
|
|
56
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_ENABLED"] = 46] = "SET_CONVERSATIONAL_SURVEY_ENABLED";
|
|
57
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATIONAL_SURVEY_DISPLAY"] = 47] = "SET_CONVERSATIONAL_SURVEY_DISPLAY";
|
|
58
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["GET_IN_MEMORY_STATE"] = 48] = "GET_IN_MEMORY_STATE";
|
|
58
59
|
})(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
|
|
@@ -45,6 +45,8 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
45
45
|
domainStates: {
|
|
46
46
|
liveChatConfig: props.chatConfig,
|
|
47
47
|
widgetElementId: "",
|
|
48
|
+
// Map of citation id => content injected by citations middleware
|
|
49
|
+
citations: {},
|
|
48
50
|
renderingMiddlewareProps: (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : _props$webChatContain.renderingMiddlewareProps,
|
|
49
51
|
middlewareLocalizedTexts: _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts,
|
|
50
52
|
preChatSurveyResponse: "{}",
|
|
@@ -70,6 +70,21 @@ const reducer = (state, action) => {
|
|
|
70
70
|
middlewareLocalizedTexts: action.payload
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CITATIONS:
|
|
74
|
+
inMemory = {
|
|
75
|
+
...inMemory,
|
|
76
|
+
domainStates: {
|
|
77
|
+
...inMemory.domainStates,
|
|
78
|
+
citations: action.payload
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
return {
|
|
82
|
+
...state,
|
|
83
|
+
domainStates: {
|
|
84
|
+
...state.domainStates,
|
|
85
|
+
citations: action.payload
|
|
86
|
+
}
|
|
87
|
+
};
|
|
73
88
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_GLOBAL_DIR:
|
|
74
89
|
inMemory = {
|
|
75
90
|
...inMemory,
|
package/lib/cjs/index.js
CHANGED
|
@@ -14,7 +14,8 @@ var _exportNames = {
|
|
|
14
14
|
useChatSDKStore: true,
|
|
15
15
|
useFacadeChatSDKStore: true,
|
|
16
16
|
LiveChatWidget: true,
|
|
17
|
-
getMockChatSDKIfApplicable: true
|
|
17
|
+
getMockChatSDKIfApplicable: true,
|
|
18
|
+
LiveChatWidgetMockType: true
|
|
18
19
|
};
|
|
19
20
|
Object.defineProperty(exports, "BroadcastService", {
|
|
20
21
|
enumerable: true,
|
|
@@ -34,6 +35,12 @@ Object.defineProperty(exports, "LiveChatWidget", {
|
|
|
34
35
|
return _LiveChatWidget.default;
|
|
35
36
|
}
|
|
36
37
|
});
|
|
38
|
+
Object.defineProperty(exports, "LiveChatWidgetMockType", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return _IMockProps.LiveChatWidgetMockType;
|
|
42
|
+
}
|
|
43
|
+
});
|
|
37
44
|
Object.defineProperty(exports, "decodeComponentString", {
|
|
38
45
|
enumerable: true,
|
|
39
46
|
get: function () {
|
|
@@ -90,6 +97,7 @@ var _useChatSDKStore = _interopRequireDefault(require("./hooks/useChatSDKStore")
|
|
|
90
97
|
var _useFacadeChatSDKStore = _interopRequireDefault(require("./hooks/useFacadeChatSDKStore"));
|
|
91
98
|
var _LiveChatWidget = _interopRequireDefault(require("./components/livechatwidget/LiveChatWidget"));
|
|
92
99
|
var _getMockChatSDKIfApplicable = require("./components/livechatwidget/common/getMockChatSDKIfApplicable");
|
|
100
|
+
var _IMockProps = require("./components/livechatwidget/interfaces/IMockProps");
|
|
93
101
|
var _renderingmiddlewares = require("./components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares");
|
|
94
102
|
Object.keys(_renderingmiddlewares).forEach(function (key) {
|
|
95
103
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -184,6 +184,8 @@ _defineProperty(HtmlAttributeNames, "adaptiveCardClassName", "ac-adaptiveCard");
|
|
|
184
184
|
_defineProperty(HtmlAttributeNames, "adaptiveCardTextBlockClassName", "ac-textBlock");
|
|
185
185
|
_defineProperty(HtmlAttributeNames, "adaptiveCardToggleInputClassName", "ac-toggleInput");
|
|
186
186
|
_defineProperty(HtmlAttributeNames, "adaptiveCardActionSetClassName", "ac-actionSet");
|
|
187
|
+
_defineProperty(HtmlAttributeNames, "ocwCitationPaneClassName", "ocw-citation-pane");
|
|
188
|
+
_defineProperty(HtmlAttributeNames, "ocwCitationPaneTitle", "Citation");
|
|
187
189
|
export let WebChatMiddlewareConstants = /*#__PURE__*/_createClass(function WebChatMiddlewareConstants() {
|
|
188
190
|
_classCallCheck(this, WebChatMiddlewareConstants);
|
|
189
191
|
});
|
|
@@ -148,6 +148,7 @@ export let TelemetryEvent;
|
|
|
148
148
|
TelemetryEvent["EmailTranscriptLoaded"] = "EmailTranscriptLoaded";
|
|
149
149
|
TelemetryEvent["OutOfOfficePaneLoaded"] = "OutOfOfficePaneLoaded";
|
|
150
150
|
TelemetryEvent["ConfirmationPaneLoaded"] = "ConfirmationPaneLoaded";
|
|
151
|
+
TelemetryEvent["CitationPaneLoaded"] = "CitationPaneLoaded";
|
|
151
152
|
TelemetryEvent["ProactiveChatPaneLoaded"] = "ProactiveChatPaneLoaded";
|
|
152
153
|
TelemetryEvent["ReconnectChatPaneLoaded"] = "ReconnectChatPaneLoaded";
|
|
153
154
|
TelemetryEvent["HeaderCloseButtonClicked"] = "HeaderCloseButtonClicked";
|
|
@@ -274,7 +275,9 @@ export let TelemetryEvent;
|
|
|
274
275
|
TelemetryEvent["UXLCWChatButtonLoadingStart"] = "UXLCWChatButtonLoadingStart";
|
|
275
276
|
TelemetryEvent["UXLCWChatButtonLoadingCompleted"] = "UXLCWChatButtonLoadingCompleted";
|
|
276
277
|
TelemetryEvent["UXConfirmationPaneStart"] = "UXConfirmationPaneStart";
|
|
278
|
+
TelemetryEvent["UXCitationPaneStart"] = "UXCitationPaneStart";
|
|
277
279
|
TelemetryEvent["UXConfirmationPaneCompleted"] = "UXConfirmationPaneCompleted";
|
|
280
|
+
TelemetryEvent["UXCitationPaneCompleted"] = "UXCitationPaneCompleted";
|
|
278
281
|
TelemetryEvent["UXLiveChatWidgetStart"] = "UXLiveChatWidgetStart";
|
|
279
282
|
TelemetryEvent["UXLiveChatWidgetCompleted"] = "UXLiveChatWidgetCompleted";
|
|
280
283
|
TelemetryEvent["AppInsightsInitialized"] = "AppInsightsInitialized";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import ReactDOM from "react-dom";
|
|
3
|
+
import { DimLayer } from "../dimlayer/DimLayer";
|
|
4
|
+
const CONTAINER_SELECTOR = ".webchat__stacked-layout_container";
|
|
5
|
+
export const CitationDim = _ref => {
|
|
6
|
+
let {
|
|
7
|
+
brightness = "0.2"
|
|
8
|
+
} = _ref;
|
|
9
|
+
const container = document.querySelector(CONTAINER_SELECTOR);
|
|
10
|
+
if (!container) return null;
|
|
11
|
+
return /*#__PURE__*/ReactDOM.createPortal( /*#__PURE__*/React.createElement("div", {
|
|
12
|
+
style: {
|
|
13
|
+
position: "absolute",
|
|
14
|
+
inset: 0
|
|
15
|
+
}
|
|
16
|
+
}, /*#__PURE__*/React.createElement(DimLayer, {
|
|
17
|
+
brightness: brightness
|
|
18
|
+
})), container);
|
|
19
|
+
};
|
|
20
|
+
export default CitationDim;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { LogLevel, TelemetryEvent } from "../../common/telemetry/TelemetryConstants";
|
|
2
|
+
import React, { useEffect, useState } from "react";
|
|
3
|
+
import { createTimer, findAllFocusableElement, findParentFocusableElementsWithoutChildContainer, preventFocusToMoveOutOfElement, setTabIndices } from "../../common/utils";
|
|
4
|
+
import CitationDim from "./CitationDim";
|
|
5
|
+
import { CitationPane } from "@microsoft/omnichannel-chat-components";
|
|
6
|
+
import { HtmlAttributeNames } from "../../common/Constants";
|
|
7
|
+
import { LiveChatWidgetActionType } from "../../contexts/common/LiveChatWidgetActionType";
|
|
8
|
+
import { TelemetryHelper } from "../../common/telemetry/TelemetryHelper";
|
|
9
|
+
import { defaultCitationPaneStyles } from "./common/defaultProps/defaultCitationPaneProps";
|
|
10
|
+
import useChatContextStore from "../../hooks/useChatContextStore";
|
|
11
|
+
let uiTimer;
|
|
12
|
+
export const CitationPaneStateful = props => {
|
|
13
|
+
var _props$styleProps3;
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
uiTimer = createTimer();
|
|
16
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
17
|
+
Event: TelemetryEvent.UXCitationPaneStart
|
|
18
|
+
});
|
|
19
|
+
}, []);
|
|
20
|
+
const initialTabIndexMap = new Map();
|
|
21
|
+
let elements = [];
|
|
22
|
+
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
+
const [state, dispatch] = useChatContextStore();
|
|
25
|
+
|
|
26
|
+
// Use props.id if provided, otherwise fall back to default
|
|
27
|
+
const controlId = props.id || HtmlAttributeNames.ocwCitationPaneClassName;
|
|
28
|
+
|
|
29
|
+
// Pane style computed to match the webchat widget container bounds so the pane
|
|
30
|
+
// stays within the widget and scrolls only vertically. We also track an
|
|
31
|
+
// "isReady" flag so we don't render the pane contents until the style is
|
|
32
|
+
// computed — this prevents a transient render that can appear as a flicker.
|
|
33
|
+
const [paneStyle, setPaneStyle] = useState(null);
|
|
34
|
+
const [isReady, setIsReady] = useState(false);
|
|
35
|
+
|
|
36
|
+
// Move focus to the container
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
preventFocusToMoveOutOfElement(controlId);
|
|
39
|
+
const focusableElements = findAllFocusableElement(`#${controlId}`);
|
|
40
|
+
requestAnimationFrame(() => {
|
|
41
|
+
if (focusableElements && focusableElements.length > 0 && focusableElements[0]) {
|
|
42
|
+
focusableElements[0].focus({
|
|
43
|
+
preventScroll: true
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
elements = findParentFocusableElementsWithoutChildContainer(controlId);
|
|
48
|
+
setTabIndices(elements, initialTabIndexMap, false);
|
|
49
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
50
|
+
Event: TelemetryEvent.CitationPaneLoaded
|
|
51
|
+
});
|
|
52
|
+
TelemetryHelper.logLoadingEvent(LogLevel.INFO, {
|
|
53
|
+
Event: TelemetryEvent.UXCitationPaneCompleted,
|
|
54
|
+
ElapsedTimeInMilliseconds: uiTimer.milliSecondsElapsed
|
|
55
|
+
});
|
|
56
|
+
}, []);
|
|
57
|
+
|
|
58
|
+
// Compute the widget bounds and set pane style accordingly (95% of widget size
|
|
59
|
+
// and centered inside the widget). If the widget container can't be found,
|
|
60
|
+
// fall back to the default pane styles from defaultCitationPaneProps.
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
const compute = () => {
|
|
63
|
+
var _props$styleProps2;
|
|
64
|
+
try {
|
|
65
|
+
const container = document.querySelector(".webchat__stacked-layout_container");
|
|
66
|
+
if (container) {
|
|
67
|
+
var _props$styleProps;
|
|
68
|
+
const rect = container.getBoundingClientRect();
|
|
69
|
+
const widthPx = Math.round(rect.width * 0.95);
|
|
70
|
+
const heightPx = Math.round(rect.height * 0.95);
|
|
71
|
+
const leftPx = Math.round(rect.left + (rect.width - widthPx) / 2);
|
|
72
|
+
const topPx = Math.round(rect.top + (rect.height - heightPx) / 2);
|
|
73
|
+
// Clone defaults and remove transform so explicit left/top pixel
|
|
74
|
+
// coordinates are respected and the pane stays within the
|
|
75
|
+
// widget bounds.
|
|
76
|
+
const base = Object.assign({}, defaultCitationPaneStyles.pane);
|
|
77
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
78
|
+
if (base && base.transform) {
|
|
79
|
+
// remove centering transform when we compute exact pixel coords
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
81
|
+
delete base.transform;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Merge user styles first, then computed positioning to ensure proper positioning
|
|
85
|
+
const computedStyle = {
|
|
86
|
+
left: `${leftPx}px`,
|
|
87
|
+
top: `${topPx}px`,
|
|
88
|
+
width: `${widthPx}px`,
|
|
89
|
+
height: `${heightPx}px`
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
// Apply user styles first, then override with computed positioning
|
|
93
|
+
const generalProps = (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps;
|
|
94
|
+
const userStyles = generalProps && typeof generalProps === "object" ? Object.assign({}, generalProps) : {};
|
|
95
|
+
// Remove positioning properties from user styles that would interfere
|
|
96
|
+
delete userStyles.position;
|
|
97
|
+
delete userStyles.left;
|
|
98
|
+
delete userStyles.top;
|
|
99
|
+
delete userStyles.width;
|
|
100
|
+
delete userStyles.height;
|
|
101
|
+
setPaneStyle(Object.assign({}, base, userStyles, computedStyle));
|
|
102
|
+
// Make the pane visible after the next paint to avoid layout
|
|
103
|
+
// flashes on initial mount.
|
|
104
|
+
requestAnimationFrame(() => setIsReady(true));
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
} catch (e) {
|
|
108
|
+
// ignore
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
// fallback - merge defaults with user-provided styles but preserve positioning
|
|
112
|
+
const generalProps = (_props$styleProps2 = props.styleProps) === null || _props$styleProps2 === void 0 ? void 0 : _props$styleProps2.generalStyleProps;
|
|
113
|
+
const userStyles = generalProps && typeof generalProps === "object" ? Object.assign({}, generalProps) : {};
|
|
114
|
+
// Remove positioning properties from user styles for fallback
|
|
115
|
+
delete userStyles.position;
|
|
116
|
+
delete userStyles.left;
|
|
117
|
+
delete userStyles.top;
|
|
118
|
+
delete userStyles.width;
|
|
119
|
+
delete userStyles.height;
|
|
120
|
+
const fallbackStyle = Object.assign({}, defaultCitationPaneStyles.pane, userStyles);
|
|
121
|
+
setPaneStyle(fallbackStyle);
|
|
122
|
+
requestAnimationFrame(() => setIsReady(true));
|
|
123
|
+
};
|
|
124
|
+
compute();
|
|
125
|
+
window.addEventListener("resize", compute);
|
|
126
|
+
return () => window.removeEventListener("resize", compute);
|
|
127
|
+
}, [(_props$styleProps3 = props.styleProps) === null || _props$styleProps3 === void 0 ? void 0 : _props$styleProps3.generalStyleProps]);
|
|
128
|
+
const handleClose = () => {
|
|
129
|
+
if (props.onClose) props.onClose();
|
|
130
|
+
dispatch({
|
|
131
|
+
type: LiveChatWidgetActionType.SET_PREVIOUS_FOCUSED_ELEMENT_ID,
|
|
132
|
+
payload: null
|
|
133
|
+
});
|
|
134
|
+
setTabIndices(elements, initialTabIndexMap, true);
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
// Merge a safe style object for the container and cast to CSSProperties to satisfy TS
|
|
138
|
+
const baseStyle = Object.assign({
|
|
139
|
+
position: "relative"
|
|
140
|
+
}, paneStyle ?? {
|
|
141
|
+
position: "fixed"
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
// If paneStyle hasn't been computed yet, render the DimLayer so clicks
|
|
145
|
+
// still close overlays but hide the pane itself to avoid flashes.
|
|
146
|
+
const hiddenStyle = {
|
|
147
|
+
visibility: isReady ? "visible" : "hidden",
|
|
148
|
+
pointerEvents: isReady ? "auto" : "none"
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// Default wrapper styles - these control the positioning container
|
|
152
|
+
const defaultWrapperStyles = {
|
|
153
|
+
display: "flex",
|
|
154
|
+
flexDirection: "column",
|
|
155
|
+
zIndex: 10001
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
// Wrapper styles for the positioning container
|
|
159
|
+
const wrapperStyles = Object.assign({}, baseStyle, hiddenStyle, defaultWrapperStyles);
|
|
160
|
+
|
|
161
|
+
// Merge the computed positioning styles with user's generalStyleProps for the CitationPane
|
|
162
|
+
const mergedStyleProps = props.styleProps ? {
|
|
163
|
+
...props.styleProps,
|
|
164
|
+
generalStyleProps: Object.assign({}, props.styleProps.generalStyleProps)
|
|
165
|
+
} : undefined;
|
|
166
|
+
const controlProps = {
|
|
167
|
+
id: controlId,
|
|
168
|
+
dir: state.domainStates.globalDir,
|
|
169
|
+
titleText: props.title,
|
|
170
|
+
contentHtml: props.contentHtml,
|
|
171
|
+
brightnessValueOnDim: "0.2",
|
|
172
|
+
// Default brightness
|
|
173
|
+
onClose: handleClose,
|
|
174
|
+
...(props === null || props === void 0 ? void 0 : props.controlProps) // User props override defaults
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(CitationDim, {
|
|
179
|
+
brightness: controlProps.brightnessValueOnDim
|
|
180
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
181
|
+
style: wrapperStyles
|
|
182
|
+
}, /*#__PURE__*/React.createElement(CitationPane, {
|
|
183
|
+
componentOverrides: props === null || props === void 0 ? void 0 : props.componentOverrides,
|
|
184
|
+
controlProps: controlProps,
|
|
185
|
+
styleProps: mergedStyleProps
|
|
186
|
+
})));
|
|
187
|
+
};
|
|
188
|
+
export default CitationPaneStateful;
|
package/lib/esm/components/citationpanestateful/common/defaultProps/defaultCitationPaneProps.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export const defaultCitationPaneStyles = {
|
|
2
|
+
pane: {
|
|
3
|
+
position: "fixed",
|
|
4
|
+
left: "50%",
|
|
5
|
+
top: "18%",
|
|
6
|
+
transform: "translateX(-50%)",
|
|
7
|
+
background: "#fff",
|
|
8
|
+
width: "85%",
|
|
9
|
+
height: "85%",
|
|
10
|
+
overflowY: "auto",
|
|
11
|
+
overflowX: "hidden",
|
|
12
|
+
padding: 16,
|
|
13
|
+
borderRadius: 6,
|
|
14
|
+
zIndex: 10001,
|
|
15
|
+
boxSizing: "border-box"
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export const defaultCitationContentCSS = controlId => `
|
|
19
|
+
#${controlId} .citation-content {
|
|
20
|
+
flex: 1;
|
|
21
|
+
min-height: 0; /* allow flex child to scroll */
|
|
22
|
+
overflow-y: auto;
|
|
23
|
+
overflow-x: auto;
|
|
24
|
+
margin-bottom: 12px;
|
|
25
|
+
white-space: normal; /* wrap normal text */
|
|
26
|
+
word-break: break-word;
|
|
27
|
+
-webkit-overflow-scrolling: touch;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#${controlId} .citation-content pre,
|
|
31
|
+
#${controlId} .citation-content code {
|
|
32
|
+
white-space: pre; /* preserve formatting */
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#${controlId} .citation-content table {
|
|
36
|
+
width: 100%;
|
|
37
|
+
border-collapse: collapse;
|
|
38
|
+
margin-bottom: 12px;
|
|
39
|
+
table-layout: auto;
|
|
40
|
+
overflow-x: auto;
|
|
41
|
+
display: block;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#${controlId} .citation-content table th,
|
|
45
|
+
#${controlId} .citation-content table td {
|
|
46
|
+
padding: 8px 12px;
|
|
47
|
+
border: 1px solid rgba(0,0,0,0.08);
|
|
48
|
+
text-align: left;
|
|
49
|
+
vertical-align: top;
|
|
50
|
+
word-break: break-word;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
#${controlId} .citation-content img {
|
|
54
|
+
max-width: 100%;
|
|
55
|
+
height: auto;
|
|
56
|
+
}
|
|
57
|
+
`;
|
|
58
|
+
export default {
|
|
59
|
+
defaultCitationPaneStyles,
|
|
60
|
+
defaultCitationContentCSS
|
|
61
|
+
};
|
package/lib/esm/components/confirmationpanestateful/interfaces/IConfirmationPaneLocalizedTexts.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,13 +13,13 @@ import { isPersistentChatEnabled } from "./common/liveChatConfigUtils";
|
|
|
13
13
|
import overridePropsOnMockIfApplicable from "./common/overridePropsOnMockIfApplicable";
|
|
14
14
|
import { registerTelemetryLoggers } from "./common/registerTelemetryLoggers";
|
|
15
15
|
export const LiveChatWidget = props => {
|
|
16
|
-
var _props$
|
|
16
|
+
var _props$featureConfigP, _props$chatConfig, _props$chatConfig$Liv, _props$chatConfig2, _props$chatConfig2$Li;
|
|
17
17
|
const reducer = createReducer();
|
|
18
18
|
const [state, dispatch] = useReducer(reducer, getLiveChatWidgetContextInitialState(props));
|
|
19
19
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
20
20
|
const [adapter, setAdapter] = useState(undefined);
|
|
21
21
|
const [facadeChatSDK, setFacadeChatSDK] = useState(undefined);
|
|
22
|
-
const chatSDK = getMockChatSDKIfApplicable(props.chatSDK, props === null || props === void 0 ? void 0 :
|
|
22
|
+
const chatSDK = getMockChatSDKIfApplicable(props.chatSDK, props === null || props === void 0 ? void 0 : props.mock);
|
|
23
23
|
const disableReauthentication = ((_props$featureConfigP = props.featureConfigProps) === null || _props$featureConfigP === void 0 ? void 0 : _props$featureConfigP.disableReauthentication) === true;
|
|
24
24
|
overridePropsOnMockIfApplicable(props);
|
|
25
25
|
if (!props.chatConfig) {
|
|
@@ -29,14 +29,14 @@ export const LiveChatWidget = props => {
|
|
|
29
29
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
30
|
const isAuthenticatedChat = !!((_props$chatConfig = props.chatConfig) !== null && _props$chatConfig !== void 0 && (_props$chatConfig$Liv = _props$chatConfig.LiveChatConfigAuthSettings) !== null && _props$chatConfig$Liv !== void 0 && _props$chatConfig$Liv.msdyn_javascriptclientfunction) || isPersistentChatEnabled((_props$chatConfig2 = props.chatConfig) === null || _props$chatConfig2 === void 0 ? void 0 : (_props$chatConfig2$Li = _props$chatConfig2.LiveWSAndLiveChatEngJoin) === null || _props$chatConfig2$Li === void 0 ? void 0 : _props$chatConfig2$Li.msdyn_conversationmode);
|
|
31
31
|
if (!facadeChatSDK) {
|
|
32
|
-
var _props$
|
|
32
|
+
var _props$mock;
|
|
33
33
|
setFacadeChatSDK(new FacadeChatSDK({
|
|
34
34
|
"chatSDK": chatSDK,
|
|
35
35
|
"chatConfig": props.chatConfig,
|
|
36
36
|
"isAuthenticated": isAuthenticatedChat,
|
|
37
37
|
"getAuthToken": props === null || props === void 0 ? void 0 : props.getAuthToken,
|
|
38
38
|
//when type is not undefined, it means the SDK is mocked
|
|
39
|
-
"isSDKMocked": !isNullOrUndefined(props === null || props === void 0 ? void 0 : (_props$
|
|
39
|
+
"isSDKMocked": !isNullOrUndefined(props === null || props === void 0 ? void 0 : (_props$mock = props.mock) === null || _props$mock === void 0 ? void 0 : _props$mock.type)
|
|
40
40
|
}, disableReauthentication));
|
|
41
41
|
}
|
|
42
42
|
useEffect(() => {
|
package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js
CHANGED
|
@@ -13,7 +13,6 @@ import { TelemetryManager } from "../../../../common/telemetry/TelemetryManager"
|
|
|
13
13
|
const supportedSignInCardContentTypes = ["application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"];
|
|
14
14
|
const botOauthUrlRegex = /[\S]+.botframework.com\/api\/oauth\/signin\?signin=([\S]+)/;
|
|
15
15
|
const delay = t => new Promise(resolve => setTimeout(resolve, t));
|
|
16
|
-
let response;
|
|
17
16
|
const extractSignInId = signInUrl => {
|
|
18
17
|
const result = botOauthUrlRegex.exec(signInUrl);
|
|
19
18
|
if (result && result[1]) {
|
|
@@ -49,20 +48,20 @@ const fetchBotAuthConfig = async (retries, interval) => {
|
|
|
49
48
|
eventName: BroadcastEvent.BotAuthConfigRequest
|
|
50
49
|
};
|
|
51
50
|
BroadcastService.postMessage(botAuthConfigRequestEvent);
|
|
51
|
+
let response;
|
|
52
52
|
const listener = BroadcastService.getMessageByEventName(BroadcastEvent.BotAuthConfigResponse).subscribe(data => {
|
|
53
53
|
var _data$payload, _data$payload2;
|
|
54
54
|
response = ((_data$payload = data.payload) === null || _data$payload === void 0 ? void 0 : _data$payload.response) !== undefined ? (_data$payload2 = data.payload) === null || _data$payload2 === void 0 ? void 0 : _data$payload2.response : response;
|
|
55
55
|
listener.unsubscribe();
|
|
56
56
|
});
|
|
57
|
-
if (response !== undefined) {
|
|
58
|
-
//return response;
|
|
59
|
-
return response;
|
|
60
|
-
}
|
|
61
57
|
if (retries === 1) {
|
|
62
58
|
// Base Case
|
|
63
59
|
throw new Error();
|
|
64
60
|
}
|
|
65
61
|
await delay(interval);
|
|
62
|
+
if (response !== undefined) {
|
|
63
|
+
return response;
|
|
64
|
+
}
|
|
66
65
|
return await fetchBotAuthConfig(--retries, interval);
|
|
67
66
|
};
|
|
68
67
|
export let BotAuthActivitySubscriber = /*#__PURE__*/function () {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BroadcastEvent, LogLevel, TelemetryEvent } from "../../../common/telemetry/TelemetryConstants";
|
|
2
|
-
import { ConfirmationState, Constants, ConversationEndEntity, ParticipantType, PrepareEndChatDescriptionConstants } from "../../../common/Constants";
|
|
2
|
+
import { ConfirmationState, Constants, ConversationEndEntity, LiveWorkItemState, ParticipantType, PrepareEndChatDescriptionConstants } from "../../../common/Constants";
|
|
3
3
|
import { getConversationDetailsCall, getWidgetEndChatEventName } from "../../../common/utils";
|
|
4
4
|
import { getPostChatContext, initiatePostChat } from "./renderSurveyHelpers";
|
|
5
5
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
@@ -39,7 +39,7 @@ const prepareEndChat = async (props, facadeChatSDK, state, dispatch, setAdapter,
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Use Case: If ended by Agent, stay chat in InActive state
|
|
42
|
-
|
|
42
|
+
const isConversationalSurveyEnabled = state.appStates.isConversationalSurveyEnabled;
|
|
43
43
|
if (isConversationalSurveyEnabled && ((state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.conversationEndedBy) === ConversationEndEntity.Agent || (state === null || state === void 0 ? void 0 : (_state$appStates3 = state.appStates) === null || _state$appStates3 === void 0 ? void 0 : _state$appStates3.conversationEndedBy) === ConversationEndEntity.Bot)) {
|
|
44
44
|
dispatch({
|
|
45
45
|
type: LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
@@ -147,8 +147,23 @@ const endChat = async (props, facadeChatSDK, state, dispatch, setAdapter, setWeb
|
|
|
147
147
|
type: LiveChatWidgetActionType.GET_IN_MEMORY_STATE,
|
|
148
148
|
payload: null
|
|
149
149
|
});
|
|
150
|
+
let isSessionEnded = inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta = inMemoryState.appStates) === null || _inMemoryState$appSta === void 0 ? void 0 : _inMemoryState$appSta.chatDisconnectEventReceived;
|
|
151
|
+
if (!isSessionEnded) {
|
|
152
|
+
// double check by fetching the latest conversation details
|
|
153
|
+
const conversationDetails = await getConversationDetailsCall(facadeChatSDK);
|
|
154
|
+
if ((conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.WrapUp || (conversationDetails === null || conversationDetails === void 0 ? void 0 : conversationDetails.state) === LiveWorkItemState.Closed) {
|
|
155
|
+
TelemetryHelper.logActionEvent(LogLevel.INFO, {
|
|
156
|
+
Event: TelemetryEvent.ChatDisconnectThreadEventReceived,
|
|
157
|
+
Description: "Checking conversation details upon endChat. Chat disconnected.",
|
|
158
|
+
CustomProperties: {
|
|
159
|
+
conversationDetails
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
isSessionEnded = true;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
150
165
|
const endChatOptionalParameters = {
|
|
151
|
-
isSessionEnded
|
|
166
|
+
isSessionEnded
|
|
152
167
|
};
|
|
153
168
|
try {
|
|
154
169
|
TelemetryHelper.logSDKEvent(LogLevel.INFO, {
|
|
@@ -296,6 +311,10 @@ export const closeChatStateCleanUp = dispatch => {
|
|
|
296
311
|
proactiveChatInNewWindow: false
|
|
297
312
|
}
|
|
298
313
|
});
|
|
314
|
+
dispatch({
|
|
315
|
+
type: LiveChatWidgetActionType.SET_CITATIONS,
|
|
316
|
+
payload: {}
|
|
317
|
+
});
|
|
299
318
|
|
|
300
319
|
// Clear live chat context only if chat widget is fully closed to support transcript calls after sessionclose is called
|
|
301
320
|
dispatch({
|
|
@@ -3,14 +3,15 @@ import { DesignerChatSDK } from "../../webchatcontainerstateful/common/DesignerC
|
|
|
3
3
|
import { MockChatSDK } from "../../webchatcontainerstateful/common/mockchatsdk";
|
|
4
4
|
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
-
export const getMockChatSDKIfApplicable = (chatSDK,
|
|
7
|
-
if (type) {
|
|
8
|
-
switch (type.toLowerCase()) {
|
|
6
|
+
export const getMockChatSDKIfApplicable = (chatSDK, mockProps) => {
|
|
7
|
+
if (mockProps !== null && mockProps !== void 0 && mockProps.type) {
|
|
8
|
+
switch (mockProps.type.toLowerCase()) {
|
|
9
9
|
case "demo":
|
|
10
10
|
chatSDK = new DemoChatSDK();
|
|
11
11
|
break;
|
|
12
12
|
case "designer":
|
|
13
13
|
chatSDK = new DesignerChatSDK();
|
|
14
|
+
chatSDK.mockMessages = mockProps === null || mockProps === void 0 ? void 0 : mockProps.mockMessages;
|
|
14
15
|
break;
|
|
15
16
|
default:
|
|
16
17
|
chatSDK = new MockChatSDK();
|
|
@@ -118,7 +118,7 @@ export const initWebChatComposer = (props, state, dispatch, facadeChatSDK, endCh
|
|
|
118
118
|
};
|
|
119
119
|
webChatStore = createStore({},
|
|
120
120
|
//initial state
|
|
121
|
-
preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), createCustomEventMiddleware(BroadcastService), createQueueOverflowMiddleware(state, dispatch), channelDataMiddleware(addConversationalSurveyTagsCallback), createConversationEndMiddleware(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), createDataMaskingMiddleware((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), createMessageTimeStampMiddleware, createMessageSequenceIdOverrideMiddleware, createCitationsMiddleware, gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware(honorsTargetInHTMLLinks), createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, createCallActionMiddleware(), localizedStringsBotInitialsMiddleware(),
|
|
121
|
+
preProcessingMiddleware, attachmentProcessingMiddleware, createAttachmentUploadValidatorMiddleware((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.allowedFileExtensions, (_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.maxUploadFileSize, localizedTexts), createCustomEventMiddleware(BroadcastService), createQueueOverflowMiddleware(state, dispatch), channelDataMiddleware(addConversationalSurveyTagsCallback), createConversationEndMiddleware(conversationEndCallback, startConversationalSurveyCallback, endConversationalSurveyCallback), createDataMaskingMiddleware((_state$domainStates$l3 = state.domainStates.liveChatConfig) === null || _state$domainStates$l3 === void 0 ? void 0 : _state$domainStates$l3.DataMaskingInfo), createMessageTimeStampMiddleware, createMessageSequenceIdOverrideMiddleware, createCitationsMiddleware(state, dispatch), gifUploadMiddleware, htmlPlayerMiddleware, htmlTextMiddleware(honorsTargetInHTMLLinks), createMaxMessageSizeValidator(localizedTexts), sanitizationMiddleware, createCallActionMiddleware(), localizedStringsBotInitialsMiddleware(),
|
|
122
122
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
123
123
|
...(((_props$webChatContain7 = props.webChatContainerProps) === null || _props$webChatContain7 === void 0 ? void 0 : _props$webChatContain7.storeMiddlewares) ?? []));
|
|
124
124
|
WebChatStoreLoader.store = webChatStore;
|