@microsoft/omnichannel-chat-widget 1.0.3-main.527b216 → 1.0.3-main.c925679
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 +54 -1
- package/lib/cjs/common/storage/default/defaultCacheManager.js +7 -6
- package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +9 -7
- package/lib/cjs/common/telemetry/TelemetryConstants.js +6 -0
- package/lib/cjs/common/utils.js +27 -5
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -6
- package/lib/cjs/components/footerstateful/FooterStateful.js +1 -1
- package/lib/cjs/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -1
- package/lib/cjs/components/headerstateful/HeaderStateful.js +14 -13
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +1 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +1 -0
- package/lib/cjs/components/livechatwidget/common/Deferred.js +2 -3
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +2 -1
- package/lib/cjs/components/livechatwidget/common/endChat.js +197 -99
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +29 -27
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +11 -8
- package/lib/cjs/components/livechatwidget/common/renderSurveyHelpers.js +139 -0
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +2 -255
- package/lib/cjs/components/livechatwidget/common/startChat.js +70 -57
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +162 -100
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +2 -2
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +15 -5
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -4
- package/lib/cjs/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -1
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +6 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +1 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +8 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +7 -1
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +2 -0
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +16 -13
- package/lib/cjs/contexts/createReducer.js +13 -23
- package/lib/cjs/controller/componentController.js +2 -1
- package/lib/cjs/index.js +20 -0
- package/lib/esm/common/Constants.js +49 -0
- package/lib/esm/common/storage/default/defaultCacheManager.js +5 -4
- package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +9 -7
- package/lib/esm/common/telemetry/TelemetryConstants.js +6 -0
- package/lib/esm/common/utils.js +25 -4
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +8 -6
- package/lib/esm/components/footerstateful/FooterStateful.js +1 -1
- package/lib/esm/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.js +8 -1
- package/lib/esm/components/headerstateful/HeaderStateful.js +14 -13
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +1 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +1 -0
- package/lib/esm/components/livechatwidget/common/Deferred.js +2 -3
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +2 -1
- package/lib/esm/components/livechatwidget/common/endChat.js +196 -99
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +29 -27
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +11 -8
- package/lib/esm/components/livechatwidget/common/renderSurveyHelpers.js +130 -0
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +3 -255
- package/lib/esm/components/livechatwidget/common/startChat.js +71 -58
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +164 -102
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +2 -2
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +15 -5
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +5 -4
- package/lib/esm/components/reconnectchatpanestateful/ReconnectChatPaneStateful.js +4 -1
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +6 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +1 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/conversationEndMiddleware.js +8 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/webchattelemetry/WebChatLogger.js +7 -1
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +2 -0
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +18 -15
- package/lib/esm/contexts/createReducer.js +13 -23
- package/lib/esm/controller/componentController.js +2 -1
- package/lib/esm/index.js +4 -1
- package/lib/types/common/Constants.d.ts +21 -0
- package/lib/types/common/interfaces/IContextDataStore.d.ts +3 -3
- package/lib/types/common/storage/default/defaultCacheManager.d.ts +2 -1
- package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +2 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +6 -0
- package/lib/types/common/utils.d.ts +3 -2
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +6 -0
- package/lib/types/components/footerstateful/downloadtranscriptstateful/DownloadTranscriptStateful.d.ts +2 -1
- package/lib/types/components/livechatwidget/common/endChat.d.ts +4 -3
- package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/renderSurveyHelpers.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +1 -6
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetProps.d.ts +3 -1
- package/lib/types/components/webchatcontainerstateful/common/mockchatsdk.d.ts +4 -0
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +8 -7
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +3 -1
- package/lib/types/contexts/common/LiveChatWidgetContextInitialState.d.ts +2 -1
- package/lib/types/index.d.ts +3 -0
- package/package.json +2 -1
- package/lib/cjs/components/livechatwidget/common/agentEndConversationHelper.js +0 -36
- package/lib/cjs/contexts/common/ConversationEndEntity.js +0 -12
- package/lib/esm/components/livechatwidget/common/agentEndConversationHelper.js +0 -30
- package/lib/esm/contexts/common/ConversationEndEntity.js +0 -5
- package/lib/types/components/livechatwidget/common/agentEndConversationHelper.d.ts +0 -6
- package/lib/types/contexts/common/ConversationEndEntity.d.ts +0 -4
|
@@ -13,21 +13,31 @@ var _utils = require("../../common/utils");
|
|
|
13
13
|
var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
|
|
14
14
|
var _PostChatSurveyMode = require("./enums/PostChatSurveyMode");
|
|
15
15
|
var _CustomerVoiceEvents = require("./enums/CustomerVoiceEvents");
|
|
16
|
+
var _Constants = require("../../common/Constants");
|
|
16
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
18
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
+
const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, compact) {
|
|
21
|
+
let showMultiLingual = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
22
|
+
const surveyLink = `${surveyInviteLink}
|
|
23
|
+
&embed=${isEmbed.toString()}
|
|
24
|
+
&compact=${compact.toString() ?? "true"}
|
|
25
|
+
&lang=${locale ?? "en-us"}
|
|
26
|
+
&showmultilingual=${showMultiLingual.toString() ?? "false"}`;
|
|
27
|
+
return surveyLink;
|
|
28
|
+
};
|
|
19
29
|
const PostChatSurveyPaneStateful = props => {
|
|
20
|
-
var
|
|
30
|
+
var _props$styleProps, _state$appStates, _state$appStates2, _props$controlProps;
|
|
21
31
|
const [state] = (0, _useChatContextStore.default)();
|
|
22
|
-
const postChatSurveyMode = (_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : (_state$domainStates$l2 = _state$domainStates$l.LiveWSAndLiveChatEngJoin) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.msdyn_postconversationsurveymode;
|
|
23
32
|
const generalStyleProps = Object.assign({}, _defaultgeneralPostChatSurveyPaneStyleProps.defaultGeneralPostChatSurveyPaneStyleProps, (_props$styleProps = props.styleProps) === null || _props$styleProps === void 0 ? void 0 : _props$styleProps.generalStyleProps, {
|
|
24
33
|
display: state.appStates.isMinimized ? "none" : ""
|
|
25
34
|
});
|
|
26
35
|
let surveyInviteLink = "";
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
const surveyMode = (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.selectedSurveyMode) === _PostChatSurveyMode.PostChatSurveyMode.Embed;
|
|
37
|
+
if ((state === null || state === void 0 ? void 0 : (_state$appStates2 = state.appStates) === null || _state$appStates2 === void 0 ? void 0 : _state$appStates2.conversationEndedBy) === _Constants.ConversationEndEntity.Bot && state.domainStates.postChatContext.botSurveyInviteLink) {
|
|
38
|
+
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
|
|
29
39
|
} else {
|
|
30
|
-
surveyInviteLink = state.domainStates.postChatContext.surveyInviteLink
|
|
40
|
+
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.surveyInviteLink, surveyMode, state.domainStates.postChatContext.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true);
|
|
31
41
|
}
|
|
32
42
|
const styleProps = {
|
|
33
43
|
...props.styleProps,
|
|
@@ -7,8 +7,8 @@ exports.default = exports.PreChatSurveyPaneStateful = void 0;
|
|
|
7
7
|
var _Constants = require("../../common/Constants");
|
|
8
8
|
var _TelemetryConstants = require("../../common/telemetry/TelemetryConstants");
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
|
-
var _markdownIt = _interopRequireDefault(require("markdown-it"));
|
|
11
10
|
var _utils = require("../../common/utils");
|
|
11
|
+
var _markdownIt = _interopRequireDefault(require("markdown-it"));
|
|
12
12
|
var _ConversationState = require("../../contexts/common/ConversationState");
|
|
13
13
|
var _LiveChatWidgetActionType = require("../../contexts/common/LiveChatWidgetActionType");
|
|
14
14
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
@@ -75,12 +75,13 @@ const PreChatSurveyPaneStateful = props => {
|
|
|
75
75
|
payload: _ConversationState.ConversationState.Loading
|
|
76
76
|
});
|
|
77
77
|
try {
|
|
78
|
-
var _state$domainStates, _state$domainStates$t, _state$domainStates$t2, _persistedState$domai, _persistedState$appSt;
|
|
79
|
-
const
|
|
78
|
+
var _state$domainStates, _state$domainStates$t, _state$domainStates$t2, _persistedState$domai, _persistedState$appSt, _state$appStates;
|
|
79
|
+
const widgetInstanceId = (0, _utils.getWidgetCacheId)(((_state$domainStates = state.domainStates) === null || _state$domainStates === void 0 ? void 0 : (_state$domainStates$t = _state$domainStates.telemetryInternalData) === null || _state$domainStates$t === void 0 ? void 0 : _state$domainStates$t.orgId) ?? "", ((_state$domainStates$t2 = state.domainStates.telemetryInternalData) === null || _state$domainStates$t2 === void 0 ? void 0 : _state$domainStates$t2.widgetId) ?? "", state.domainStates.widgetInstanceId ?? "");
|
|
80
|
+
const persistedState = (0, _utils.getStateFromCache)(widgetInstanceId);
|
|
80
81
|
let optionalParams = {};
|
|
81
82
|
|
|
82
83
|
//Connect to Active chats and chat is not popout
|
|
83
|
-
if (persistedState && !(0, _utils.isUndefinedOrEmpty)(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai = persistedState.domainStates) === null || _persistedState$domai === void 0 ? void 0 : _persistedState$domai.liveChatContext) && (persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$appSt = persistedState.appStates) === null || _persistedState$appSt === void 0 ? void 0 : _persistedState$appSt.conversationState) === _ConversationState.ConversationState.Active && state.appStates.hideStartChatButton === false) {
|
|
84
|
+
if (persistedState && !(0, _utils.isUndefinedOrEmpty)(persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai = persistedState.domainStates) === null || _persistedState$domai === void 0 ? void 0 : _persistedState$domai.liveChatContext) && (persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$appSt = persistedState.appStates) === null || _persistedState$appSt === void 0 ? void 0 : _persistedState$appSt.conversationState) === _ConversationState.ConversationState.Active && (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.hideStartChatButton) === false) {
|
|
84
85
|
var _persistedState$domai2;
|
|
85
86
|
optionalParams = {
|
|
86
87
|
liveChatContext: persistedState === null || persistedState === void 0 ? void 0 : (_persistedState$domai2 = persistedState.domainStates) === null || _persistedState$domai2 === void 0 ? void 0 : _persistedState$domai2.liveChatContext
|
|
@@ -40,7 +40,10 @@ const ReconnectChatPaneStateful = props => {
|
|
|
40
40
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_RECONNECT_ID,
|
|
41
41
|
payload: undefined
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
if (state !== null && state !== void 0 && (_state$domainStates = state.domainStates) !== null && _state$domainStates !== void 0 && _state$domainStates.initialChatSdkRequestId) {
|
|
44
|
+
var _state$domainStates2;
|
|
45
|
+
chatSDK.requestId = state === null || state === void 0 ? void 0 : (_state$domainStates2 = state.domainStates) === null || _state$domainStates2 === void 0 ? void 0 : _state$domainStates2.initialChatSdkRequestId;
|
|
46
|
+
}
|
|
44
47
|
const parseToJson = false;
|
|
45
48
|
const preChatSurveyResponse = await chatSDK.getPreChatSurvey(parseToJson);
|
|
46
49
|
if (preChatSurveyResponse) {
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.MockChatSDK = void 0;
|
|
7
|
+
var _Constants = require("../../../common/Constants");
|
|
7
8
|
var _mockadapter = _interopRequireDefault(require("./mockadapter"));
|
|
8
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
10
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -11,6 +12,7 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
11
12
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
12
13
|
class MockChatSDK {
|
|
13
14
|
constructor() {
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
14
16
|
_defineProperty(this, "sleep", ms => new Promise(r => setTimeout(r, ms)));
|
|
15
17
|
_defineProperty(this, "isMockModeOn", true);
|
|
16
18
|
}
|
|
@@ -33,7 +35,10 @@ class MockChatSDK {
|
|
|
33
35
|
}
|
|
34
36
|
getConversationDetails() {
|
|
35
37
|
return {
|
|
36
|
-
State: "Active"
|
|
38
|
+
State: "Active",
|
|
39
|
+
conversationId: "",
|
|
40
|
+
canRenderPostChat: "",
|
|
41
|
+
participantType: _Constants.ParticipantType.User
|
|
37
42
|
};
|
|
38
43
|
}
|
|
39
44
|
getCurrentLiveChatContext() {
|
|
@@ -9,4 +9,5 @@ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typ
|
|
|
9
9
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
10
10
|
class WebChatStoreLoader {}
|
|
11
11
|
exports.WebChatStoreLoader = WebChatStoreLoader;
|
|
12
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
13
|
_defineProperty(WebChatStoreLoader, "store", void 0);
|
|
@@ -23,13 +23,15 @@ const createConversationEndMiddleware = conversationEndCallback => _ref => {
|
|
|
23
23
|
return next => action => {
|
|
24
24
|
var _action$payload;
|
|
25
25
|
if ((action === null || action === void 0 ? void 0 : action.type) == _WebChatActionType.WebChatActionType.DIRECT_LINE_INCOMING_ACTIVITY && (_action$payload = action.payload) !== null && _action$payload !== void 0 && _action$payload.activity) {
|
|
26
|
-
var _activity$
|
|
26
|
+
var _activity$from2, _activity$channelData7, _activity$channelData8;
|
|
27
27
|
const activity = action.payload.activity;
|
|
28
|
-
if (
|
|
29
|
-
var _activity$
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
if (activity.channelId === "ACS_CHANNEL") {
|
|
29
|
+
var _activity$from;
|
|
30
|
+
if (((_activity$from = activity.from) === null || _activity$from === void 0 ? void 0 : _activity$from.role) === _DirectLineSenderRole.DirectLineSenderRole.Bot) {
|
|
31
|
+
var _activity$channelData, _activity$channelData2, _activity$channelData3, _activity$channelData4, _activity$channelData5, _activity$channelData6;
|
|
32
|
+
if ((_activity$channelData = activity.channelData) !== null && _activity$channelData !== void 0 && (_activity$channelData2 = _activity$channelData.tags) !== null && _activity$channelData2 !== void 0 && _activity$channelData2.includes(_Constants.Constants.systemMessageTag) && ((_activity$channelData3 = activity.channelData) !== null && _activity$channelData3 !== void 0 && (_activity$channelData4 = _activity$channelData3.tags) !== null && _activity$channelData4 !== void 0 && _activity$channelData4.includes(_Constants.Constants.agentEndConversationMessageTag) || (_activity$channelData5 = activity.channelData) !== null && _activity$channelData5 !== void 0 && (_activity$channelData6 = _activity$channelData5.tags) !== null && _activity$channelData6 !== void 0 && _activity$channelData6.includes(_Constants.Constants.supervisorForceCloseMessageTag))) {
|
|
33
|
+
conversationEndCallback();
|
|
34
|
+
}
|
|
33
35
|
}
|
|
34
36
|
} else if (((_activity$from2 = activity.from) === null || _activity$from2 === void 0 ? void 0 : _activity$from2.role) === _DirectLineSenderRole.DirectLineSenderRole.Channel && ((_activity$channelData7 = activity.channelData) === null || _activity$channelData7 === void 0 ? void 0 : _activity$channelData7.type) === _MessageType.MessageTypes.Thread && (_activity$channelData8 = activity.channelData) !== null && _activity$channelData8 !== void 0 && _activity$channelData8.properties) {
|
|
35
37
|
var _activity$channelData9, _activity$channelData10, _activity$channelData11, _activity$channelData12;
|
|
@@ -7,12 +7,15 @@ exports.createWebChatTelemetry = createWebChatTelemetry;
|
|
|
7
7
|
var _TelemetryConstants = require("../../../../common/telemetry/TelemetryConstants");
|
|
8
8
|
var _TelemetryHelper = require("../../../../common/telemetry/TelemetryHelper");
|
|
9
9
|
function createWebChatTelemetry() {
|
|
10
|
+
let isInitEventLogged = false;
|
|
10
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
11
12
|
const handleTelemetry = event => {
|
|
12
13
|
const {
|
|
13
|
-
level
|
|
14
|
+
level,
|
|
15
|
+
name
|
|
14
16
|
} = event;
|
|
15
17
|
const loglevel = level ? level.toUpperCase() : "";
|
|
18
|
+
if ((name === null || name === void 0 ? void 0 : name.toLowerCase()) === "init" && isInitEventLogged) return;
|
|
16
19
|
switch (loglevel) {
|
|
17
20
|
case _TelemetryConstants.LogLevel.DEBUG:
|
|
18
21
|
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.DEBUG, event);
|
|
@@ -28,6 +31,9 @@ function createWebChatTelemetry() {
|
|
|
28
31
|
_TelemetryHelper.TelemetryHelper.logWebChatEvent(_TelemetryConstants.LogLevel.INFO, event);
|
|
29
32
|
break;
|
|
30
33
|
}
|
|
34
|
+
if ((name === null || name === void 0 ? void 0 : name.toLowerCase()) === "init") {
|
|
35
|
+
isInitEventLogged = true;
|
|
36
|
+
}
|
|
31
37
|
};
|
|
32
38
|
return handleTelemetry;
|
|
33
39
|
}
|
|
@@ -48,4 +48,6 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
48
48
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INITIAL_CHAT_SDK_REQUEST_ID"] = 38] = "SET_INITIAL_CHAT_SDK_REQUEST_ID";
|
|
49
49
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 39] = "SET_SHOULD_USE_BOT_SURVEY";
|
|
50
50
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_DISCONNECT_EVENT_RECEIVED"] = 40] = "SET_CHAT_DISCONNECT_EVENT_RECEIVED";
|
|
51
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SURVEY_MODE"] = 41] = "SET_SURVEY_MODE";
|
|
52
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONFIRMATION_STATE"] = 42] = "SET_CONFIRMATION_STATE";
|
|
51
53
|
})(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
|
|
@@ -10,12 +10,14 @@ var _utils = require("../../common/utils");
|
|
|
10
10
|
var _defaultClientDataStoreProvider = require("../../common/storage/default/defaultClientDataStoreProvider");
|
|
11
11
|
var _Constants = require("../../common/Constants");
|
|
12
12
|
const getLiveChatWidgetContextInitialState = props => {
|
|
13
|
-
var _props$
|
|
14
|
-
const widgetCacheId = (0, _utils.
|
|
15
|
-
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$
|
|
16
|
-
const
|
|
13
|
+
var _props$controlProps, _props$webChatContain;
|
|
14
|
+
const widgetCacheId = (0, _utils.getWidgetCacheIdfromProps)(props);
|
|
15
|
+
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.cacheTtlInMins) ?? _Constants.Constants.CacheTtlInMinutes;
|
|
16
|
+
const storageType = (props === null || props === void 0 ? void 0 : props.useSessionStorage) === true ? _Constants.StorageType.sessionStorage : _Constants.StorageType.localStorage;
|
|
17
|
+
const initialState = (0, _defaultClientDataStoreProvider.defaultClientDataStoreProvider)(cacheTtlInMins, storageType).getData(widgetCacheId);
|
|
17
18
|
if (!(0, _utils.isNullOrUndefined)(initialState)) {
|
|
18
|
-
|
|
19
|
+
const initialStateFromCache = JSON.parse(initialState);
|
|
20
|
+
return initialStateFromCache;
|
|
19
21
|
}
|
|
20
22
|
const LiveChatWidgetContextInitialState = {
|
|
21
23
|
domainStates: {
|
|
@@ -32,13 +34,16 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
32
34
|
customContext: undefined,
|
|
33
35
|
widgetSize: undefined,
|
|
34
36
|
widgetInstanceId: "",
|
|
35
|
-
initialChatSdkRequestId: ""
|
|
37
|
+
initialChatSdkRequestId: "",
|
|
38
|
+
transcriptRequestId: "",
|
|
39
|
+
confirmationPaneConfirmedOptionClicked: false,
|
|
40
|
+
confirmationState: _Constants.ConfirmationState.NotSet
|
|
36
41
|
},
|
|
37
42
|
appStates: {
|
|
38
43
|
conversationState: _ConversationState.ConversationState.Closed,
|
|
39
|
-
isMinimized:
|
|
44
|
+
isMinimized: undefined,
|
|
40
45
|
previousElementIdOnFocusBeforeModalOpen: null,
|
|
41
|
-
|
|
46
|
+
startChatFailed: false,
|
|
42
47
|
outsideOperatingHours: false,
|
|
43
48
|
preChatResponseEmail: "",
|
|
44
49
|
isAudioMuted: null,
|
|
@@ -52,11 +57,9 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
52
57
|
},
|
|
53
58
|
e2vvEnabled: false,
|
|
54
59
|
unreadMessageCount: 0,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
shouldUseBotSurvey: false,
|
|
59
|
-
chatDisconnectEventReceived: false
|
|
60
|
+
conversationEndedBy: _Constants.ConversationEndEntity.NotSet,
|
|
61
|
+
chatDisconnectEventReceived: false,
|
|
62
|
+
selectedSurveyMode: null
|
|
60
63
|
},
|
|
61
64
|
uiStates: {
|
|
62
65
|
showConfirmationPane: false,
|
|
@@ -64,7 +64,7 @@ const createReducer = () => {
|
|
|
64
64
|
...state,
|
|
65
65
|
appStates: {
|
|
66
66
|
...state.appStates,
|
|
67
|
-
|
|
67
|
+
startChatFailed: action.payload
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS:
|
|
@@ -264,14 +264,6 @@ const createReducer = () => {
|
|
|
264
264
|
return {
|
|
265
265
|
...action.payload
|
|
266
266
|
};
|
|
267
|
-
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED:
|
|
268
|
-
return {
|
|
269
|
-
...state,
|
|
270
|
-
appStates: {
|
|
271
|
-
...state.appStates,
|
|
272
|
-
conversationEndedByAgentEventReceived: action.payload
|
|
273
|
-
}
|
|
274
|
-
};
|
|
275
267
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY:
|
|
276
268
|
return {
|
|
277
269
|
...state,
|
|
@@ -307,15 +299,6 @@ const createReducer = () => {
|
|
|
307
299
|
liveChatConfig: action.payload
|
|
308
300
|
}
|
|
309
301
|
};
|
|
310
|
-
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_POST_CHAT_WORKFLOW_IN_PROGRESS:
|
|
311
|
-
return {
|
|
312
|
-
...state,
|
|
313
|
-
appStates: {
|
|
314
|
-
...state.appStates,
|
|
315
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
316
|
-
postChatWorkflowInProgress: action.payload
|
|
317
|
-
}
|
|
318
|
-
};
|
|
319
302
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_INITIAL_CHAT_SDK_REQUEST_ID:
|
|
320
303
|
return {
|
|
321
304
|
...state,
|
|
@@ -324,21 +307,28 @@ const createReducer = () => {
|
|
|
324
307
|
initialChatSdkRequestId: action.payload
|
|
325
308
|
}
|
|
326
309
|
};
|
|
327
|
-
case _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
310
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CHAT_DISCONNECT_EVENT_RECEIVED:
|
|
328
311
|
return {
|
|
329
312
|
...state,
|
|
330
313
|
appStates: {
|
|
331
314
|
...state.appStates,
|
|
332
|
-
|
|
333
|
-
shouldUseBotSurvey: action.payload
|
|
315
|
+
chatDisconnectEventReceived: action.payload
|
|
334
316
|
}
|
|
335
317
|
};
|
|
336
|
-
case _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
318
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SURVEY_MODE:
|
|
337
319
|
return {
|
|
338
320
|
...state,
|
|
339
321
|
appStates: {
|
|
340
322
|
...state.appStates,
|
|
341
|
-
|
|
323
|
+
selectedSurveyMode: action.payload
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONFIRMATION_STATE:
|
|
327
|
+
return {
|
|
328
|
+
...state,
|
|
329
|
+
domainStates: {
|
|
330
|
+
...state.domainStates,
|
|
331
|
+
confirmationState: action.payload
|
|
342
332
|
}
|
|
343
333
|
};
|
|
344
334
|
default:
|
|
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.shouldShowWebChatContainer = exports.shouldShowReconnectChatPane = exports.shouldShowProactiveChatPane = exports.shouldShowPreChatSurveyPane = exports.shouldShowPostChatSurveyPane = exports.shouldShowPostChatLoadingPane = exports.shouldShowOutOfOfficeHoursPane = exports.shouldShowLoadingPane = exports.shouldShowHeader = exports.shouldShowFooter = exports.shouldShowEmailTranscriptPane = exports.shouldShowConfirmationPane = exports.shouldShowChatButton = exports.shouldShowCallingContainer = void 0;
|
|
7
7
|
var _ConversationState = require("../contexts/common/ConversationState");
|
|
8
8
|
const shouldShowChatButton = state => {
|
|
9
|
-
|
|
9
|
+
var _state$appStates;
|
|
10
|
+
return (state.appStates.isMinimized || state.appStates.conversationState === _ConversationState.ConversationState.Closed) && (state === null || state === void 0 ? void 0 : (_state$appStates = state.appStates) === null || _state$appStates === void 0 ? void 0 : _state$appStates.hideStartChatButton) === false; // Do not show chat button in case of popout
|
|
10
11
|
};
|
|
11
12
|
exports.shouldShowChatButton = shouldShowChatButton;
|
|
12
13
|
const shouldShowProactiveChatPane = state => {
|
package/lib/cjs/index.js
CHANGED
|
@@ -9,6 +9,12 @@ Object.defineProperty(exports, "BroadcastService", {
|
|
|
9
9
|
return _omnichannelChatComponents.BroadcastService;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "ConversationState", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _ConversationState.ConversationState;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
12
18
|
Object.defineProperty(exports, "LiveChatWidget", {
|
|
13
19
|
enumerable: true,
|
|
14
20
|
get: function () {
|
|
@@ -27,6 +33,18 @@ Object.defineProperty(exports, "encodeComponentString", {
|
|
|
27
33
|
return _omnichannelChatComponents.encodeComponentString;
|
|
28
34
|
}
|
|
29
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "getWidgetCacheId", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _utils.getWidgetCacheId;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "getWidgetEndChatEventName", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () {
|
|
45
|
+
return _utils.getWidgetEndChatEventName;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
30
48
|
Object.defineProperty(exports, "useChatContextStore", {
|
|
31
49
|
enumerable: true,
|
|
32
50
|
get: function () {
|
|
@@ -42,5 +60,7 @@ Object.defineProperty(exports, "useChatSDKStore", {
|
|
|
42
60
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
43
61
|
var _useChatContextStore = _interopRequireDefault(require("./hooks/useChatContextStore"));
|
|
44
62
|
var _useChatSDKStore = _interopRequireDefault(require("./hooks/useChatSDKStore"));
|
|
63
|
+
var _utils = require("./common/utils");
|
|
64
|
+
var _ConversationState = require("./contexts/common/ConversationState");
|
|
45
65
|
var _LiveChatWidget = _interopRequireDefault(require("./components/livechatwidget/LiveChatWidget"));
|
|
46
66
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -23,27 +23,34 @@ _defineProperty(Constants, "false", "false");
|
|
|
23
23
|
_defineProperty(Constants, "maximumUnreadMessageCount", 99);
|
|
24
24
|
_defineProperty(Constants, "userParticipantTypeTag", "User");
|
|
25
25
|
_defineProperty(Constants, "botParticipantTypeTag", "Bot");
|
|
26
|
+
// channelDataMiddleware
|
|
26
27
|
_defineProperty(Constants, "channelIdKey", "ChannelId-");
|
|
27
28
|
_defineProperty(Constants, "ChannelId", "lcw");
|
|
28
29
|
_defineProperty(Constants, "CustomerTag", "FromCustomer");
|
|
30
|
+
// gifUploadMiddleware
|
|
29
31
|
_defineProperty(Constants, "GifContentType", "image/gif");
|
|
32
|
+
// htmlPlayerMiddleware
|
|
30
33
|
_defineProperty(Constants, "video", "video");
|
|
31
34
|
_defineProperty(Constants, "audio", "audio");
|
|
32
35
|
_defineProperty(Constants, "controlsList", "controlsList");
|
|
33
36
|
_defineProperty(Constants, "nodownload", "nodownload");
|
|
37
|
+
// htmlTextMiddleware
|
|
34
38
|
_defineProperty(Constants, "activity", "activity");
|
|
35
39
|
_defineProperty(Constants, "payload", "payload");
|
|
36
40
|
_defineProperty(Constants, "text", "text");
|
|
37
41
|
_defineProperty(Constants, "blank", "_blank");
|
|
42
|
+
// activityMiddleware
|
|
38
43
|
_defineProperty(Constants, "visitorIdPrefix", "8:");
|
|
39
44
|
_defineProperty(Constants, "left", "left");
|
|
40
45
|
_defineProperty(Constants, "queuePositionMessageTag", "queueposition");
|
|
41
46
|
_defineProperty(Constants, "averageWaitTimeMessageTag", "averagewaittime");
|
|
42
47
|
_defineProperty(Constants, "message", "message");
|
|
43
48
|
_defineProperty(Constants, "hiddenTag", "Hidden");
|
|
49
|
+
// messageTimestampMiddleware
|
|
44
50
|
_defineProperty(Constants, "prefixTimestampTag", "ServerMessageTimestamp_");
|
|
45
51
|
_defineProperty(Constants, "acsChannel", "ACS_CHANNEL");
|
|
46
52
|
_defineProperty(Constants, "publicMessageTag", "public");
|
|
53
|
+
//attachmentMiddleware
|
|
47
54
|
_defineProperty(Constants, "supportedAdaptiveCardContentTypes", ["application/vnd.microsoft.card.adaptive", "application/vnd.microsoft.card.audio", "application/vnd.microsoft.card.hero", "application/vnd.microsoft.card.receipt", "application/vnd.microsoft.card.thumbnail", "application/vnd.microsoft.card.signin", "application/vnd.microsoft.card.oauth"]);
|
|
48
55
|
_defineProperty(Constants, "maxUploadFileSize", "500000");
|
|
49
56
|
_defineProperty(Constants, "imageRegex", /(\.)(jpeg|jpg|jiff|png|gif|bmp|webp)$/i);
|
|
@@ -51,6 +58,7 @@ _defineProperty(Constants, "audioMediaRegex", /(\.)(aac|aiff|alac|amr|flac|mp2|m
|
|
|
51
58
|
_defineProperty(Constants, "videoMediaRegex", /(\.)(avchd|avi|flv|mpe|mpeg|mpg|mpv|mp4|m4p|m4v|mov|qt|swf|webm|wmv)$/i);
|
|
52
59
|
_defineProperty(Constants, "chromeSupportedInlineMediaRegex", /(\.)(aac|mp3|wav|mp4)$/i);
|
|
53
60
|
_defineProperty(Constants, "firefoxSupportedInlineMediaRegex", /(\.)(aac|flac|mp3|wav|mp4|mov)$/i);
|
|
61
|
+
// calling container event names
|
|
54
62
|
_defineProperty(Constants, "CallAdded", "callAdded");
|
|
55
63
|
_defineProperty(Constants, "LocalVideoStreamAdded", "localVideoStreamAdded");
|
|
56
64
|
_defineProperty(Constants, "LocalVideoStreamRemoved", "localVideoStreamRemoved");
|
|
@@ -65,12 +73,18 @@ _defineProperty(Constants, "VoiceVideoNotLoaded", "voiceVideoNotLoaded");
|
|
|
65
73
|
_defineProperty(Constants, "VoiceVideoLoadingException", "voiceVideoLoadingOnException");
|
|
66
74
|
_defineProperty(Constants, "VoiceVideoAcceptCallException", "voiceVideoAcceptCallOnException");
|
|
67
75
|
_defineProperty(Constants, "VoiceVideoAcceptCallWithVideoException", "voiceVideoAcceptCallWithVideoException");
|
|
76
|
+
// download transcript
|
|
68
77
|
_defineProperty(Constants, "defaultDownloadTranscriptError", "Download transcript failed.");
|
|
78
|
+
// proactive chat
|
|
69
79
|
_defineProperty(Constants, "ProactiveChatInviteTimeoutInMs", 60000);
|
|
80
|
+
// 1 minute
|
|
81
|
+
// prechat survey
|
|
70
82
|
_defineProperty(Constants, "InputSubmit", "InputSubmit");
|
|
83
|
+
// reconnect chat
|
|
71
84
|
_defineProperty(Constants, "ReconnectIdAttributeName", "oc.reconnectid");
|
|
72
85
|
_defineProperty(Constants, "LiveChatWidget", "LiveChatWidgetNew");
|
|
73
86
|
_defineProperty(Constants, "GuidPattern", "xx-x-4m-ym-xxx");
|
|
87
|
+
// Markdown plugin
|
|
74
88
|
_defineProperty(Constants, "Default", "default");
|
|
75
89
|
_defineProperty(Constants, "Zero", "zero");
|
|
76
90
|
_defineProperty(Constants, "Title", "title");
|
|
@@ -78,13 +92,18 @@ _defineProperty(Constants, "Target", "target");
|
|
|
78
92
|
_defineProperty(Constants, "Blank", "_blank");
|
|
79
93
|
_defineProperty(Constants, "TargetRelationship", "rel");
|
|
80
94
|
_defineProperty(Constants, "TargetRelationshipAttributes", "noopener noreferrer");
|
|
95
|
+
// Markdown icons
|
|
81
96
|
_defineProperty(Constants, "OpenLinkIconCssClass", "webchat__markdown__external-link-icon");
|
|
97
|
+
// internet connection test
|
|
82
98
|
_defineProperty(Constants, "internetConnectionTestUrl", "https://ocsdk-prod.azureedge.net/public/connecttest.txt");
|
|
83
99
|
_defineProperty(Constants, "internetConnectionTestUrlText", "Omnichannel Connect Test");
|
|
84
100
|
_defineProperty(Constants, "ChatWidgetStateChangedPrefix", "ChatWidgetStateChanged");
|
|
85
101
|
_defineProperty(Constants, "PostChatLoadingDurationInMs", 2000);
|
|
86
102
|
_defineProperty(Constants, "BrowserUnloadConfirmationMessage", "Do you want to leave chat?");
|
|
87
103
|
_defineProperty(Constants, "CacheTtlInMinutes", 15);
|
|
104
|
+
_defineProperty(Constants, "SessionCacheSuffix", "session");
|
|
105
|
+
_defineProperty(Constants, "PopoutCacheSuffix", "popout");
|
|
106
|
+
// Visibility timeout for conversation details
|
|
88
107
|
_defineProperty(Constants, "LWICheckOnVisibilityTimeout", 3 * 60 * 1000);
|
|
89
108
|
export const Regex = (_class = class Regex {}, _defineProperty(_class, "EmailRegex", "(?:[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-zA-Z0-9-]*[a-zA-Z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])"), _class);
|
|
90
109
|
export class HtmlIdNames {}
|
|
@@ -130,11 +149,13 @@ _defineProperty(HtmlAttributeNames, "adaptiveCardActionSetClassName", "ac-action
|
|
|
130
149
|
export class WebChatMiddlewareConstants {}
|
|
131
150
|
_defineProperty(WebChatMiddlewareConstants, "nextVisibleActivity", "nextVisibleActivity");
|
|
132
151
|
_defineProperty(WebChatMiddlewareConstants, "timeBetweenTimestampGroups", 300000);
|
|
152
|
+
//5 minutes
|
|
133
153
|
_defineProperty(WebChatMiddlewareConstants, "maxTextLength", 6000);
|
|
134
154
|
_defineProperty(WebChatMiddlewareConstants, "adaptiveCard", "AdaptiveCard");
|
|
135
155
|
export class AMSConstants {}
|
|
136
156
|
_defineProperty(AMSConstants, "supportedImagesMimeTypes", ["image/jpeg", "image/png", "image/gif", "image/heic", "image/webp"]);
|
|
137
157
|
_defineProperty(AMSConstants, "maxSupportedImageSize", 20);
|
|
158
|
+
// AMS max file limit outside of supported Images MIME Types.
|
|
138
159
|
_defineProperty(AMSConstants, "maxSupportedFileSize", 300);
|
|
139
160
|
export class MimeTypes {}
|
|
140
161
|
_defineProperty(MimeTypes, "UnknownFileType", "application/octet-stream");
|
|
@@ -169,6 +190,29 @@ export let LiveWorkItemState;
|
|
|
169
190
|
LiveWorkItemState["Waiting"] = "Waiting";
|
|
170
191
|
LiveWorkItemState["WrapUp"] = "WrapUp";
|
|
171
192
|
})(LiveWorkItemState || (LiveWorkItemState = {}));
|
|
193
|
+
export let StorageType;
|
|
194
|
+
(function (StorageType) {
|
|
195
|
+
StorageType[StorageType["localStorage"] = 0] = "localStorage";
|
|
196
|
+
StorageType[StorageType["sessionStorage"] = 1] = "sessionStorage";
|
|
197
|
+
})(StorageType || (StorageType = {}));
|
|
198
|
+
export let ParticipantType;
|
|
199
|
+
(function (ParticipantType) {
|
|
200
|
+
ParticipantType["User"] = "User";
|
|
201
|
+
ParticipantType["Bot"] = "Bot";
|
|
202
|
+
})(ParticipantType || (ParticipantType = {}));
|
|
203
|
+
export let ConversationEndEntity;
|
|
204
|
+
(function (ConversationEndEntity) {
|
|
205
|
+
ConversationEndEntity["Customer"] = "Customer";
|
|
206
|
+
ConversationEndEntity["Agent"] = "Agent";
|
|
207
|
+
ConversationEndEntity["Bot"] = "Bot";
|
|
208
|
+
ConversationEndEntity["NotSet"] = "NotSet";
|
|
209
|
+
})(ConversationEndEntity || (ConversationEndEntity = {}));
|
|
210
|
+
export let ConfirmationState;
|
|
211
|
+
(function (ConfirmationState) {
|
|
212
|
+
ConfirmationState["Ok"] = "Ok";
|
|
213
|
+
ConfirmationState["Cancel"] = "Cancel";
|
|
214
|
+
ConfirmationState["NotSet"] = "NotSet";
|
|
215
|
+
})(ConfirmationState || (ConfirmationState = {}));
|
|
172
216
|
export class TranscriptConstants {}
|
|
173
217
|
_defineProperty(TranscriptConstants, "ChatTranscriptsBodyColor", "#F5F5F5");
|
|
174
218
|
_defineProperty(TranscriptConstants, "TranscriptMessageEmojiMessageType", "http://schema.skype.com/emoji");
|
|
@@ -181,11 +225,16 @@ _defineProperty(TranscriptConstants, "InternalMode", "internal");
|
|
|
181
225
|
_defineProperty(TranscriptConstants, "AgentDialogColor", "#2266E3");
|
|
182
226
|
_defineProperty(TranscriptConstants, "AgentFontColor", "white");
|
|
183
227
|
export class AriaTelemetryConstants {}
|
|
228
|
+
// Aria Endpoint for different environment types.
|
|
184
229
|
_defineProperty(AriaTelemetryConstants, "GERMANY_ENDPOINT", "https://de.pipe.aria.microsoft.com/Collector/3.0/");
|
|
185
230
|
_defineProperty(AriaTelemetryConstants, "GCCH_ENDPOINT", "https://tb.pipe.aria.microsoft.com/Collector/3.0/");
|
|
186
231
|
_defineProperty(AriaTelemetryConstants, "DOD_ENDPOINT", "https://pf.pipe.aria.microsoft.com/Collector/3.0");
|
|
187
232
|
_defineProperty(AriaTelemetryConstants, "EUROPE_ENDPOINT", "https://eu-mobile.events.data.microsoft.com/Collector/3.0/");
|
|
233
|
+
// EUDB Collector URL
|
|
188
234
|
_defineProperty(AriaTelemetryConstants, "MOONCAKE_ENDPOINT", "");
|
|
235
|
+
// Add MoonCake ARIA Endpoint whenever available
|
|
236
|
+
// Environment types
|
|
189
237
|
_defineProperty(AriaTelemetryConstants, "Public", "Public");
|
|
190
238
|
_defineProperty(AriaTelemetryConstants, "EU", "Europe");
|
|
239
|
+
// EUR: crm4; FRA: crm12; GER: crm16; CHE: crm17; NOR: crm19
|
|
191
240
|
_defineProperty(AriaTelemetryConstants, "lcwEUDomainNames", ["crm4.omnichannelengagementhub.com", "crm12.omnichannelengagementhub.com", "crm16.omnichannelengagementhub.com", "crm17.omnichannelengagementhub.com", "crm19.omnichannelengagementhub.com"]);
|
|
@@ -2,15 +2,16 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
|
2
2
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
3
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
4
|
import { BroadcastService } from "@microsoft/omnichannel-chat-components";
|
|
5
|
-
import { getWidgetCacheId } from "../../utils";
|
|
6
5
|
import { defaultClientDataStoreProvider } from "./defaultClientDataStoreProvider";
|
|
7
6
|
export class defaultCacheManager {}
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
8
10
|
_defineProperty(defaultCacheManager, "InternalCache", {});
|
|
9
|
-
export const
|
|
10
|
-
const widgetCacheId = getWidgetCacheId(orgid, widgetId, widgetInstanceId);
|
|
11
|
+
export const registerBroadcastServiceForStorage = (widgetCacheId, ttlInMins, storageType) => {
|
|
11
12
|
BroadcastService.getMessageByEventName(widgetCacheId).subscribe(msg => {
|
|
12
13
|
try {
|
|
13
|
-
defaultClientDataStoreProvider(ttlInMins).setData(widgetCacheId, JSON.stringify(msg.payload)
|
|
14
|
+
defaultClientDataStoreProvider(ttlInMins, storageType).setData(widgetCacheId, JSON.stringify(msg.payload));
|
|
14
15
|
} catch (error) {
|
|
15
16
|
console.error("Error in setting data to localstorage", error);
|
|
16
17
|
}
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
import { LogLevel, TelemetryEvent } from "../../telemetry/TelemetryConstants";
|
|
4
4
|
import { TelemetryHelper } from "../../telemetry/TelemetryHelper";
|
|
5
5
|
import { inMemoryDataStore } from "./defaultInMemoryDataStore";
|
|
6
|
+
import { StorageType } from "../../Constants";
|
|
6
7
|
export const defaultClientDataStoreProvider = function () {
|
|
7
8
|
let cacheTtlinMins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
|
|
9
|
+
let storageType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : StorageType.localStorage;
|
|
8
10
|
let ttlInMs = 0;
|
|
9
11
|
const isCookieAllowed = () => {
|
|
10
12
|
try {
|
|
@@ -24,7 +26,7 @@ export const defaultClientDataStoreProvider = function () {
|
|
|
24
26
|
}
|
|
25
27
|
const dataStoreProvider = {
|
|
26
28
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
-
setData: (key, data
|
|
29
|
+
setData: (key, data) => {
|
|
28
30
|
if (isCookieAllowed()) {
|
|
29
31
|
try {
|
|
30
32
|
if (key) {
|
|
@@ -34,7 +36,7 @@ export const defaultClientDataStoreProvider = function () {
|
|
|
34
36
|
expiry: now.getTime() + ttlInMs
|
|
35
37
|
};
|
|
36
38
|
const strItem = JSON.stringify(item);
|
|
37
|
-
if (
|
|
39
|
+
if (storageType === StorageType.localStorage) {
|
|
38
40
|
localStorage.setItem(key, strItem);
|
|
39
41
|
} else {
|
|
40
42
|
sessionStorage.setItem(key, strItem);
|
|
@@ -51,16 +53,16 @@ export const defaultClientDataStoreProvider = function () {
|
|
|
51
53
|
const dataToCache = {
|
|
52
54
|
key: key,
|
|
53
55
|
data: data,
|
|
54
|
-
type:
|
|
56
|
+
type: storageType == StorageType.localStorage ? "localStorage" : "sessionStorage"
|
|
55
57
|
};
|
|
56
58
|
parent.postMessage(dataToCache, "*");
|
|
57
59
|
}
|
|
58
60
|
},
|
|
59
61
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
-
getData:
|
|
62
|
+
getData: key => {
|
|
61
63
|
if (isCookieAllowed()) {
|
|
62
64
|
let item;
|
|
63
|
-
if (
|
|
65
|
+
if (storageType === StorageType.localStorage) {
|
|
64
66
|
item = localStorage.getItem(key);
|
|
65
67
|
} else {
|
|
66
68
|
item = sessionStorage.getItem(key);
|
|
@@ -85,10 +87,10 @@ export const defaultClientDataStoreProvider = function () {
|
|
|
85
87
|
}
|
|
86
88
|
},
|
|
87
89
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
88
|
-
removeData:
|
|
90
|
+
removeData: key => {
|
|
89
91
|
if (isCookieAllowed()) {
|
|
90
92
|
if (key) {
|
|
91
|
-
if (
|
|
93
|
+
if (storageType === StorageType.localStorage) {
|
|
92
94
|
return localStorage.removeItem(key);
|
|
93
95
|
} else {
|
|
94
96
|
return sessionStorage.removeItem(key);
|
|
@@ -54,6 +54,8 @@ export let BroadcastEvent;
|
|
|
54
54
|
BroadcastEvent["SigninCardReceived"] = "SignInCardReceived";
|
|
55
55
|
BroadcastEvent["BotAuthConfigRequest"] = "BotAuthConfigRequest";
|
|
56
56
|
BroadcastEvent["BotAuthConfigResponse"] = "BotAuthConfigResponse";
|
|
57
|
+
BroadcastEvent["RemoveWidgetDataFromCache"] = "RemoveWidgetDataFromCache";
|
|
58
|
+
BroadcastEvent["InitiateStartChatInPopoutMode"] = "InitiateStartChatInPopoutMode";
|
|
57
59
|
BroadcastEvent["HideChatVisibilityChangeEvent"] = "hideChatVisibilityChangeEvent";
|
|
58
60
|
BroadcastEvent["UpdateSessionDataForTelemetry"] = "UpdateSessionDataForTelemetry";
|
|
59
61
|
BroadcastEvent["UpdateConversationDataForTelemetry"] = "UpdateConversationDataForTelemetry";
|
|
@@ -89,13 +91,17 @@ export let TelemetryEvent;
|
|
|
89
91
|
TelemetryEvent["CallingSDKInitFailed"] = "CallingSDKInitFailed";
|
|
90
92
|
TelemetryEvent["CallingSDKLoadSuccess"] = "CallingSDKLoadSuccess";
|
|
91
93
|
TelemetryEvent["CallingSDKLoadFailed"] = "CallingSDKLoadFailed";
|
|
94
|
+
TelemetryEvent["GetConversationDetailsCallStarted"] = "GetConversationDetailsCallStarted";
|
|
92
95
|
TelemetryEvent["GetConversationDetailsCallFailed"] = "GetConversationDetailsCallFailed";
|
|
93
96
|
TelemetryEvent["EndChatSDKCallFailed"] = "EndChatSDKCallFailed";
|
|
97
|
+
TelemetryEvent["GetChatReconnectContextSDKCallStarted"] = "GetChatReconnectContextSDKCallStarted";
|
|
94
98
|
TelemetryEvent["GetChatReconnectContextSDKCallFailed"] = "GetChatReconnectContextSDKCallFailed";
|
|
95
99
|
TelemetryEvent["ParseAdaptiveCardFailed"] = "ParseAdaptiveCardFailed";
|
|
96
100
|
TelemetryEvent["ClientDataStoreProviderFailed"] = "ClientDataStoreProviderFailed";
|
|
97
101
|
TelemetryEvent["InMemoryDataStoreFailed"] = "InMemoryDataStoreFailed";
|
|
98
102
|
TelemetryEvent["ChatVisibilityChanged"] = "ChatVisibilityChanged";
|
|
103
|
+
TelemetryEvent["EndChatSucceeded"] = "EndChatSucceeded";
|
|
104
|
+
TelemetryEvent["EndChatFailed"] = "EndChatFailed";
|
|
99
105
|
TelemetryEvent["WebChatLoaded"] = "WebChatLoaded";
|
|
100
106
|
TelemetryEvent["LCWChatButtonClicked"] = "LCWChatButtonClicked";
|
|
101
107
|
TelemetryEvent["LCWChatButtonShow"] = "LCWChatButtonShow";
|