@microsoft/omnichannel-chat-widget 0.1.0-main.170e416 → 0.1.0-main.18d1166
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -34
- package/lib/cjs/assets/Icons.js +4 -2
- package/lib/cjs/common/Constants.js +9 -3
- package/lib/cjs/common/KeyCodes.js +3 -1
- package/lib/cjs/common/contextDataStore/DataStoreManager.js +3 -1
- package/lib/cjs/common/storage/default/defaultCacheManager.js +5 -3
- package/lib/cjs/common/storage/default/defaultClientDataStoreProvider.js +15 -6
- package/lib/cjs/common/telemetry/TelemetryConstants.js +34 -4
- package/lib/cjs/common/telemetry/TelemetryHelper.js +5 -2
- package/lib/cjs/common/telemetry/TelemetryManager.js +3 -1
- package/lib/cjs/common/utils.js +23 -2
- package/lib/cjs/components/confirmationpanestateful/ConfirmationPaneStateful.js +12 -19
- package/lib/cjs/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
- package/lib/cjs/components/headerstateful/HeaderStateful.js +7 -4
- package/lib/cjs/components/livechatwidget/common/ActivityStreamHandler.js +3 -1
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +139 -0
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +3 -1
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +3 -1
- package/lib/cjs/components/livechatwidget/common/ChatAdapterShim.js +3 -1
- package/lib/cjs/components/livechatwidget/common/Deferred.js +3 -1
- package/lib/cjs/components/livechatwidget/common/agentEndConversationHelper.js +36 -0
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +2 -0
- package/lib/cjs/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +66 -14
- package/lib/cjs/components/livechatwidget/common/endChat.js +41 -49
- package/lib/cjs/components/livechatwidget/common/initWebChatComposer.js +11 -49
- package/lib/cjs/components/livechatwidget/common/reconnectChatHelper.js +6 -9
- package/lib/cjs/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +254 -2
- package/lib/cjs/components/livechatwidget/common/startChat.js +76 -53
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +82 -44
- package/lib/cjs/components/loadingpanestateful/LoadingPaneStateful.js +22 -2
- package/lib/cjs/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +57 -0
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -1
- package/lib/cjs/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/cjs/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/common/mockadapter.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/mockchatsdk.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +5 -6
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +7 -3
- package/lib/cjs/contexts/common/ConversationEndEntity.js +12 -0
- package/lib/cjs/contexts/common/LiveChatWidgetActionType.js +32 -28
- package/lib/cjs/contexts/common/LiveChatWidgetContextInitialState.js +9 -3
- package/lib/cjs/contexts/createReducer.js +36 -2
- package/lib/cjs/hooks/useDebounce.js +28 -0
- package/lib/cjs/hooks/useWindowDimensions.js +30 -0
- package/lib/cjs/plugins/newMessageEventHandler.js +14 -0
- package/lib/esm/assets/Icons.js +2 -1
- package/lib/esm/common/Constants.js +9 -3
- package/lib/esm/common/KeyCodes.js +3 -1
- package/lib/esm/common/contextDataStore/DataStoreManager.js +3 -1
- package/lib/esm/common/storage/default/defaultCacheManager.js +5 -3
- package/lib/esm/common/storage/default/defaultClientDataStoreProvider.js +15 -6
- package/lib/esm/common/telemetry/TelemetryConstants.js +34 -4
- package/lib/esm/common/telemetry/TelemetryHelper.js +5 -2
- package/lib/esm/common/telemetry/TelemetryManager.js +3 -1
- package/lib/esm/common/utils.js +20 -0
- package/lib/esm/components/confirmationpanestateful/ConfirmationPaneStateful.js +12 -19
- package/lib/esm/components/emailtranscriptpanestateful/EmailTranscriptPaneStateful.js +1 -1
- package/lib/esm/components/headerstateful/HeaderStateful.js +7 -4
- package/lib/esm/components/livechatwidget/common/ActivityStreamHandler.js +3 -1
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +134 -0
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/DefaultActivitySubscriber.js +3 -1
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/PauseActivitySubscriber.js +3 -1
- package/lib/esm/components/livechatwidget/common/ChatAdapterShim.js +3 -1
- package/lib/esm/components/livechatwidget/common/Deferred.js +3 -1
- package/lib/esm/components/livechatwidget/common/agentEndConversationHelper.js +30 -0
- package/lib/esm/components/livechatwidget/common/createAdapter.js +2 -0
- package/lib/esm/components/livechatwidget/common/defaultProps/dummyDefaultProps.js +66 -14
- package/lib/esm/components/livechatwidget/common/endChat.js +43 -51
- package/lib/esm/components/livechatwidget/common/initWebChatComposer.js +13 -51
- package/lib/esm/components/livechatwidget/common/reconnectChatHelper.js +7 -9
- package/lib/esm/components/livechatwidget/common/setPostChatContextAndLoadSurvey.js +254 -3
- package/lib/esm/components/livechatwidget/common/startChat.js +76 -53
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +83 -45
- package/lib/esm/components/loadingpanestateful/LoadingPaneStateful.js +22 -2
- package/lib/esm/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.js +50 -0
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +3 -1
- package/lib/esm/components/prechatsurveypanestateful/PreChatSurveyPaneStateful.js +1 -1
- package/lib/esm/components/prechatsurveypanestateful/common/defaultStyles/defaultGeneralPreChatSurveyPaneStyleProps.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/common/mockadapter.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/mockchatsdk.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js +2 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/BotMagicCodeStore.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/WebChatStoreLoader.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activityStatusMiddleware.js +1 -3
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/attachmentMiddleware.js +2 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultSystemMessageBoxStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/defaultStyles/defaultUserMessageBoxStyles.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/DeliveredTimestamp.js +5 -6
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -14
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.js +2 -11
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/typingIndicatorMiddleware.js +5 -3
- package/lib/esm/contexts/common/ConversationEndEntity.js +5 -0
- package/lib/esm/contexts/common/LiveChatWidgetActionType.js +32 -28
- package/lib/esm/contexts/common/LiveChatWidgetContextInitialState.js +9 -3
- package/lib/esm/contexts/createReducer.js +36 -2
- package/lib/esm/hooks/useDebounce.js +22 -0
- package/lib/esm/hooks/useWindowDimensions.js +23 -0
- package/lib/esm/plugins/newMessageEventHandler.js +14 -0
- package/lib/types/assets/Icons.d.ts +1 -0
- package/lib/types/common/Constants.d.ts +4 -0
- package/lib/types/common/storage/default/defaultCacheManager.d.ts +1 -1
- package/lib/types/common/storage/default/defaultClientDataStoreProvider.d.ts +1 -1
- package/lib/types/common/telemetry/TelemetryConstants.d.ts +30 -6
- package/lib/types/common/telemetry/definitions/Contracts.d.ts +2 -0
- package/lib/types/common/telemetry/definitions/Payload.d.ts +1 -0
- package/lib/types/common/telemetry/interfaces/ITelemetryConfig.d.ts +4 -0
- package/lib/types/common/utils.d.ts +1 -0
- package/lib/types/components/confirmationpanestateful/interfaces/IConfirmationPaneStatefulParams.d.ts +0 -7
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +9 -0
- package/lib/types/components/livechatwidget/common/agentEndConversationHelper.d.ts +6 -0
- package/lib/types/components/livechatwidget/common/initWebChatComposer.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/setPostChatContextAndLoadSurvey.d.ts +6 -1
- package/lib/types/components/livechatwidget/common/startChat.d.ts +3 -3
- package/lib/types/components/livechatwidget/interfaces/ILiveChatWidgetControlProps.d.ts +2 -0
- package/lib/types/components/loadingpanestateful/common/errorUIStyleProps/errorUILoadingPaneStyleProps.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/SendingTimestamp.d.ts +1 -1
- package/lib/types/contexts/common/ConversationEndEntity.d.ts +4 -0
- package/lib/types/contexts/common/ILiveChatWidgetContext.d.ts +6 -1
- package/lib/types/contexts/common/LiveChatWidgetActionType.d.ts +32 -28
- package/lib/types/hooks/useDebounce.d.ts +3 -0
- package/lib/types/hooks/useWindowDimensions.d.ts +4 -0
- package/package.json +3 -3
|
@@ -11,6 +11,8 @@ var _TelemetryHelper = require("../../common/telemetry/TelemetryHelper");
|
|
|
11
11
|
var _defaultgeneralLoadingPaneStyleProps = require("./common/defaultStyleProps/defaultgeneralLoadingPaneStyleProps");
|
|
12
12
|
var _utils = require("../../common/utils");
|
|
13
13
|
var _useChatContextStore = _interopRequireDefault(require("../../hooks/useChatContextStore"));
|
|
14
|
+
var _useWindowDimensions = _interopRequireDefault(require("../../hooks/useWindowDimensions"));
|
|
15
|
+
var _errorUILoadingPaneStyleProps = require("./common/errorUIStyleProps/errorUILoadingPaneStyleProps");
|
|
14
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
17
|
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); }
|
|
16
18
|
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; }
|
|
@@ -22,11 +24,27 @@ const LoadingPaneStateful = props => {
|
|
|
22
24
|
...props.styleProps,
|
|
23
25
|
generalStyleProps: generalStyleProps
|
|
24
26
|
};
|
|
27
|
+
const errorUIStyleProps = {
|
|
28
|
+
..._errorUILoadingPaneStyleProps.errorUILoadingPaneStyleProps
|
|
29
|
+
};
|
|
25
30
|
const controlProps = {
|
|
26
31
|
id: "oc-lcw-loading-pane",
|
|
27
32
|
dir: state.domainStates.globalDir,
|
|
28
33
|
...props.controlProps
|
|
29
34
|
};
|
|
35
|
+
const errorUIControlProps = {
|
|
36
|
+
id: "oc-lcw-alert-pane",
|
|
37
|
+
dir: state.domainStates.globalDir,
|
|
38
|
+
titleText: "Chat is failing to load.",
|
|
39
|
+
subtitleText: "Please Close the chat and try again.",
|
|
40
|
+
hideSpinner: true,
|
|
41
|
+
hideSpinnerText: true,
|
|
42
|
+
...props.controlProps
|
|
43
|
+
};
|
|
44
|
+
const {
|
|
45
|
+
height,
|
|
46
|
+
width
|
|
47
|
+
} = (0, _useWindowDimensions.default)();
|
|
30
48
|
|
|
31
49
|
// Move focus to the first button
|
|
32
50
|
(0, _react.useEffect)(() => {
|
|
@@ -41,8 +59,10 @@ const LoadingPaneStateful = props => {
|
|
|
41
59
|
}, []);
|
|
42
60
|
return /*#__PURE__*/_react.default.createElement(_omnichannelChatComponents.LoadingPane, {
|
|
43
61
|
componentOverrides: props.componentOverrides,
|
|
44
|
-
controlProps: controlProps,
|
|
45
|
-
styleProps: styleProps
|
|
62
|
+
controlProps: state.appStates.isStartChatFailing ? errorUIControlProps : controlProps,
|
|
63
|
+
styleProps: state.appStates.isStartChatFailing ? errorUIStyleProps : styleProps,
|
|
64
|
+
windowWidth: width,
|
|
65
|
+
windowHeight: height
|
|
46
66
|
});
|
|
47
67
|
};
|
|
48
68
|
exports.LoadingPaneStateful = LoadingPaneStateful;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.errorUILoadingPaneStyleProps = void 0;
|
|
7
|
+
var _react = require("@fluentui/react");
|
|
8
|
+
var _Icons = require("../../../../assets/Icons");
|
|
9
|
+
const errorUILoadingPaneStyleProps = {
|
|
10
|
+
generalStyleProps: {
|
|
11
|
+
position: "initial",
|
|
12
|
+
width: "100%",
|
|
13
|
+
height: "100%",
|
|
14
|
+
left: "0%",
|
|
15
|
+
top: "0%",
|
|
16
|
+
borderRadius: "0 0 4px 4px",
|
|
17
|
+
borderWidth: "0px",
|
|
18
|
+
backgroundColor: "#FFFFFF"
|
|
19
|
+
},
|
|
20
|
+
titleStyleProps: {
|
|
21
|
+
fontFamily: "'Segoe UI',Arial,sans-serif",
|
|
22
|
+
fontWeight: "normal",
|
|
23
|
+
fontSize: "18px",
|
|
24
|
+
color: "#36454F",
|
|
25
|
+
textAlign: "center",
|
|
26
|
+
display: "flex",
|
|
27
|
+
order: 2,
|
|
28
|
+
alignSelf: "auto"
|
|
29
|
+
},
|
|
30
|
+
subtitleStyleProps: {
|
|
31
|
+
fontFamily: "'Segoe UI',Arial,sans-serif",
|
|
32
|
+
fontWeight: "normal",
|
|
33
|
+
fontSize: "18px",
|
|
34
|
+
color: "#36454F",
|
|
35
|
+
textAlign: "center",
|
|
36
|
+
display: "flex",
|
|
37
|
+
order: 3,
|
|
38
|
+
alignSelf: "auto"
|
|
39
|
+
},
|
|
40
|
+
iconStyleProps: {
|
|
41
|
+
display: "flex",
|
|
42
|
+
order: 1,
|
|
43
|
+
alignSelf: "auto",
|
|
44
|
+
backgroundColor: "#FFFFFF",
|
|
45
|
+
boxShadow: "#FFFFFF 0px 0px 0px 0px",
|
|
46
|
+
margin: "0px 0px 0px 0px"
|
|
47
|
+
},
|
|
48
|
+
iconImageProps: {
|
|
49
|
+
src: _Icons.AlertIcon,
|
|
50
|
+
imageFit: _react.ImageFit.center,
|
|
51
|
+
width: "86px",
|
|
52
|
+
height: "86px",
|
|
53
|
+
shouldFadeIn: false,
|
|
54
|
+
shouldStartVisible: true
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.errorUILoadingPaneStyleProps = errorUILoadingPaneStyleProps;
|
|
@@ -24,7 +24,9 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
24
24
|
display: state.appStates.isMinimized ? "none" : ""
|
|
25
25
|
});
|
|
26
26
|
let surveyInviteLink = "";
|
|
27
|
-
if (state.domainStates.postChatContext.
|
|
27
|
+
if (state.appStates.shouldUseBotSurvey && state.domainStates.postChatContext.botSurveyInviteLink) {
|
|
28
|
+
surveyInviteLink = state.domainStates.postChatContext.botSurveyInviteLink + "&embed=" + (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed).toString() + "&compact=" + (props.isCustomerVoiceSurveyCompact ?? true).toString() + "&lang=" + (state.domainStates.postChatContext.formsProLocale ?? "en") + "&showmultilingual=false";
|
|
29
|
+
} else {
|
|
28
30
|
surveyInviteLink = state.domainStates.postChatContext.surveyInviteLink + "&embed=" + (postChatSurveyMode === _PostChatSurveyMode.PostChatSurveyMode.Embed).toString() + "&compact=" + (props.isCustomerVoiceSurveyCompact ?? true).toString() + "&lang=" + (state.domainStates.postChatContext.formsProLocale ?? "en") + "&showmultilingual=false";
|
|
29
31
|
}
|
|
30
32
|
const styleProps = {
|
|
@@ -120,7 +120,7 @@ const PreChatSurveyPaneStateful = props => {
|
|
|
120
120
|
}
|
|
121
121
|
if (current && current.tagName.toLowerCase() == _Constants.HtmlAttributeNames.div && current.childElementCount > 0) {
|
|
122
122
|
const input = current.children[0].children;
|
|
123
|
-
if (input
|
|
123
|
+
if ((input === null || input === void 0 ? void 0 : input.length) > 0 && input[0].className != _Constants.HtmlAttributeNames.adaptiveCardToggleInputClassName && input[0].className != _Constants.HtmlAttributeNames.adaptiveCardActionSetClassName) {
|
|
124
124
|
input[0].setAttribute(_Constants.HtmlAttributeNames.ariaLabel, value);
|
|
125
125
|
}
|
|
126
126
|
}
|
|
@@ -7,7 +7,7 @@ exports.defaultGeneralPreChatSurveyPaneStyleProps = void 0;
|
|
|
7
7
|
const defaultGeneralPreChatSurveyPaneStyleProps = {
|
|
8
8
|
borderStyle: "solid",
|
|
9
9
|
borderRadius: "inherit",
|
|
10
|
-
borderWidth: "
|
|
10
|
+
borderWidth: "0px",
|
|
11
11
|
backgroundColor: "#FFFFFF",
|
|
12
12
|
borderColor: "#F1F1F1",
|
|
13
13
|
overflowY: "auto",
|
|
@@ -10,7 +10,9 @@ var _botframeworkDirectlinejs = require("botframework-directlinejs");
|
|
|
10
10
|
var _rxjs = require("rxjs");
|
|
11
11
|
var _Observable = require("rxjs/Observable");
|
|
12
12
|
var _omnichannelChatSdk = require("@microsoft/omnichannel-chat-sdk");
|
|
13
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
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; }
|
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
15
|
+
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); }
|
|
14
16
|
class MockAdapter {
|
|
15
17
|
constructor() {
|
|
16
18
|
_defineProperty(this, "activityObserver", void 0);
|
|
@@ -6,7 +6,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.MockChatSDK = void 0;
|
|
7
7
|
var _mockadapter = _interopRequireDefault(require("./mockadapter"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
9
|
+
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; }
|
|
10
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
11
|
+
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
12
|
class MockChatSDK {
|
|
11
13
|
constructor() {
|
|
12
14
|
_defineProperty(this, "sleep", ms => new Promise(r => setTimeout(r, ms)));
|
package/lib/cjs/components/webchatcontainerstateful/common/utils/FileAttachmentIconManager.js
CHANGED
|
@@ -12,6 +12,7 @@ const FileAttachmentIconMap = {
|
|
|
12
12
|
"aac": _Icons.AudioIcon,
|
|
13
13
|
"aiff": _Icons.AudioIcon,
|
|
14
14
|
"alac": _Icons.AudioIcon,
|
|
15
|
+
"amr": _Icons.AudioIcon,
|
|
15
16
|
"avchd": _Icons.VideoIcon,
|
|
16
17
|
"avi": _Icons.VideoIcon,
|
|
17
18
|
"bmp": _Icons.ImageIcon,
|
|
@@ -50,6 +51,7 @@ const FileAttachmentIconMap = {
|
|
|
50
51
|
"vsdx": _Icons.VisioIcon,
|
|
51
52
|
"wav": _Icons.AudioIcon,
|
|
52
53
|
"webm": _Icons.VideoIcon,
|
|
54
|
+
"webp": _Icons.ImageIcon,
|
|
53
55
|
"wma": _Icons.AudioIcon,
|
|
54
56
|
"wmv": _Icons.VideoIcon,
|
|
55
57
|
"xls": _Icons.ExcelIcon,
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.BotMagicCodeStore = void 0;
|
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
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); }
|
|
8
10
|
class BotMagicCodeStore {}
|
|
9
11
|
exports.BotMagicCodeStore = BotMagicCodeStore;
|
|
10
12
|
_defineProperty(BotMagicCodeStore, "botOAuthSignInId", "");
|
|
@@ -4,7 +4,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.WebChatStoreLoader = void 0;
|
|
7
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
7
|
+
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; }
|
|
8
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
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); }
|
|
8
10
|
class WebChatStoreLoader {}
|
|
9
11
|
exports.WebChatStoreLoader = WebChatStoreLoader;
|
|
10
12
|
_defineProperty(WebChatStoreLoader, "store", void 0);
|
|
@@ -57,9 +57,7 @@ const activityStatusMiddleware = () => next => args => {
|
|
|
57
57
|
style: {
|
|
58
58
|
padding: "2px"
|
|
59
59
|
}
|
|
60
|
-
}, sendState === _SendStatus.SendStatus.Sending && /*#__PURE__*/_react.default.createElement(_SendingTimestamp.SendingTimestamp, {
|
|
61
|
-
args: args
|
|
62
|
-
}), sendState === _SendStatus.SendStatus.SendFailed && /*#__PURE__*/_react.default.createElement(_NotDeliveredTimestamp.NotDeliveredTimestamp, {
|
|
60
|
+
}, sendState === _SendStatus.SendStatus.Sending && /*#__PURE__*/_react.default.createElement(_SendingTimestamp.SendingTimestamp, null), sendState === _SendStatus.SendStatus.SendFailed && /*#__PURE__*/_react.default.createElement(_NotDeliveredTimestamp.NotDeliveredTimestamp, {
|
|
63
61
|
args: args
|
|
64
62
|
}), sendState === _SendStatus.SendStatus.Sent && /*#__PURE__*/_react.default.createElement(_DeliveredTimestamp.DeliveredTimestamp, {
|
|
65
63
|
args: args,
|
|
@@ -236,7 +236,8 @@ const createAttachmentMiddleware = enableInlinePlaying => {
|
|
|
236
236
|
renderer: next
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
|
-
|
|
239
|
+
const isUnknownImageObject = contentType.toLowerCase().includes("image") && !imageExtension;
|
|
240
|
+
if (fileExtension === "txt" || isUnknownImageObject) {
|
|
240
241
|
return /*#__PURE__*/_react.default.createElement(Attachment, {
|
|
241
242
|
iconData: iconData,
|
|
242
243
|
textCard: patchAttachment(card, {
|
|
@@ -33,14 +33,13 @@ const DeliveredTimestamp = _ref => {
|
|
|
33
33
|
} = args;
|
|
34
34
|
return /*#__PURE__*/_react.default.createElement(_react2.Stack, {
|
|
35
35
|
style: contentStyles,
|
|
36
|
+
dir: dir
|
|
37
|
+
}, role === _DirectLineSenderRole.DirectLineSenderRole.Bot && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
36
38
|
dir: dir,
|
|
37
|
-
horizontal: true
|
|
38
|
-
}, role === _DirectLineSenderRole.DirectLineSenderRole.Bot && /*#__PURE__*/_react.default.createElement("span", {
|
|
39
39
|
"aria-hidden": "false"
|
|
40
|
-
}, name), role === _DirectLineSenderRole.DirectLineSenderRole.
|
|
40
|
+
}, name, " - ", (0, _utils.getTimestampHourMinute)(timestamp))), role === _DirectLineSenderRole.DirectLineSenderRole.User && /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
41
|
+
"aria-hidden": "false",
|
|
41
42
|
dir: dir
|
|
42
|
-
}, " ", (0, _utils.getTimestampHourMinute)(timestamp)
|
|
43
|
-
"aria-hidden": "false"
|
|
44
|
-
}, ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_DELIVERED) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_DELIVERED));
|
|
43
|
+
}, " ", (0, _utils.getTimestampHourMinute)(timestamp), " - ", ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_DELIVERED) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_DELIVERED)));
|
|
45
44
|
};
|
|
46
45
|
exports.DeliveredTimestamp = DeliveredTimestamp;
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.NotDeliveredTimestamp = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
-
var _Constants = require("../../../../../../common/Constants");
|
|
9
8
|
var _KeyCodes = require("../../../../../../common/KeyCodes");
|
|
10
9
|
var _react2 = require("@fluentui/react");
|
|
11
10
|
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
@@ -57,9 +56,8 @@ const NotDeliveredTimestamp = _ref => {
|
|
|
57
56
|
timestampWebChatNodes[1].innerText = (0, _utils.getTimestampHourMinute)(timestamp);
|
|
58
57
|
}
|
|
59
58
|
}, [timestampRef]);
|
|
60
|
-
const onRetryClick = (0, _react.useCallback)(async
|
|
59
|
+
const onRetryClick = (0, _react.useCallback)(async () => {
|
|
61
60
|
var _activity$channelData;
|
|
62
|
-
removeNotDeliveredTimestamp(event);
|
|
63
61
|
activity.previousClientActivityID = (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : _activity$channelData.clientActivityID;
|
|
64
62
|
await postActivity(activity);
|
|
65
63
|
focus("sendBox");
|
|
@@ -67,19 +65,9 @@ const NotDeliveredTimestamp = _ref => {
|
|
|
67
65
|
const onRetryKeyEnter = event => {
|
|
68
66
|
if (event.code === _KeyCodes.KeyCodes.ENTER) {
|
|
69
67
|
event.preventDefault();
|
|
70
|
-
onRetryClick(
|
|
68
|
+
onRetryClick();
|
|
71
69
|
}
|
|
72
70
|
};
|
|
73
|
-
const removeNotDeliveredTimestamp = event => {
|
|
74
|
-
let parent = event.target.parentElement;
|
|
75
|
-
while (parent.tagName !== _Constants.HtmlAttributeNames.listItem) {
|
|
76
|
-
parent = parent.parentElement;
|
|
77
|
-
if (parent.tagName === _Constants.HtmlAttributeNames.unorderedList) {
|
|
78
|
-
return;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
parent.parentNode.removeChild(parent);
|
|
82
|
-
};
|
|
83
71
|
return /*#__PURE__*/_react.default.createElement(_react2.Stack, {
|
|
84
72
|
style: contentStyles,
|
|
85
73
|
dir: dir,
|
|
@@ -8,30 +8,21 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
8
8
|
var _react2 = require("@fluentui/react");
|
|
9
9
|
var _defaultMiddlewareLocalizedTexts = require("../../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
10
10
|
var _defaultTimestampContentStyles = require("../defaultStyles/defaultTimestampContentStyles");
|
|
11
|
-
var _utils = require("../../../../../../common/utils");
|
|
12
11
|
var _ = require("../../../../../..");
|
|
13
12
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
13
|
/* eslint @typescript-eslint/no-explicit-any: "off" */
|
|
15
|
-
const SendingTimestamp =
|
|
14
|
+
const SendingTimestamp = () => {
|
|
16
15
|
var _state$domainStates$r, _state$domainStates$r2, _state$domainStates$m;
|
|
17
|
-
let {
|
|
18
|
-
args
|
|
19
|
-
} = _ref;
|
|
20
16
|
const [state] = (0, _.useChatContextStore)();
|
|
21
17
|
const dir = ((_state$domainStates$r = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r === void 0 ? void 0 : _state$domainStates$r.timestampDir) ?? state.domainStates.globalDir;
|
|
22
18
|
const contentStyles = {
|
|
23
19
|
..._defaultTimestampContentStyles.defaultTimestampContentStyles,
|
|
24
20
|
...((_state$domainStates$r2 = state.domainStates.renderingMiddlewareProps) === null || _state$domainStates$r2 === void 0 ? void 0 : _state$domainStates$r2.timestampContentStyleProps)
|
|
25
21
|
};
|
|
26
|
-
const {
|
|
27
|
-
activity: {
|
|
28
|
-
timestamp
|
|
29
|
-
}
|
|
30
|
-
} = args;
|
|
31
22
|
return /*#__PURE__*/_react.default.createElement(_react2.Stack, {
|
|
32
23
|
style: contentStyles,
|
|
33
24
|
dir: dir,
|
|
34
25
|
horizontal: true
|
|
35
|
-
}, /*#__PURE__*/_react.default.createElement("span", null, " ", (
|
|
26
|
+
}, /*#__PURE__*/_react.default.createElement("span", null, " ", ((_state$domainStates$m = state.domainStates.middlewareLocalizedTexts) === null || _state$domainStates$m === void 0 ? void 0 : _state$domainStates$m.MIDDLEWARE_MESSAGE_SENDING) ?? _defaultMiddlewareLocalizedTexts.defaultMiddlewareLocalizedTexts.MIDDLEWARE_MESSAGE_SENDING, " "));
|
|
36
27
|
};
|
|
37
28
|
exports.SendingTimestamp = SendingTimestamp;
|
|
@@ -4,18 +4,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.typingIndicatorMiddleware = void 0;
|
|
7
|
-
var _react =
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _DirectLineSenderRole = require("../../enums/DirectLineSenderRole");
|
|
9
9
|
var _defaultMiddlewareLocalizedTexts = require("../../../common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
10
10
|
var _defaultTypingIndicatorBubbleStyles = require("./defaultStyles/defaultTypingIndicatorBubbleStyles");
|
|
11
11
|
var _defaultTypingIndicatorContainerStyles = require("./defaultStyles/defaultTypingIndicatorContainerStyles");
|
|
12
12
|
var _defaultTypingIndicatorMessageStyles = require("./defaultStyles/defaultTypingIndicatorMessageStyles");
|
|
13
13
|
var _ = require("../../../../..");
|
|
14
|
+
var _utils = require("../../../../../common/utils");
|
|
14
15
|
var _useChatSDKStore = _interopRequireDefault(require("../../../../../hooks/useChatSDKStore"));
|
|
15
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
17
|
+
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
|
+
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; }
|
|
16
19
|
/******
|
|
17
20
|
* TypingIndicatorMiddleware
|
|
18
|
-
*
|
|
21
|
+
*
|
|
19
22
|
* This middleware changes the component that shows who's actively typing. It uses the default Microsoft LiveChatWidget styles.
|
|
20
23
|
******/
|
|
21
24
|
|
|
@@ -29,6 +32,7 @@ const TypingIndicator = _ref => {
|
|
|
29
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
33
|
const chatSDK = (0, _useChatSDKStore.default)();
|
|
31
34
|
const [state] = (0, _.useChatContextStore)();
|
|
35
|
+
const debounceTyping = (0, _react.useCallback)((0, _utils.debounceLeading)(() => chatSDK === null || chatSDK === void 0 ? void 0 : chatSDK.sendTypingEvent()), []);
|
|
32
36
|
if (!activeTyping || Object.keys(activeTyping).length === 0 || ((_state$domainStates$l = state.domainStates.liveChatConfig) === null || _state$domainStates$l === void 0 ? void 0 : _state$domainStates$l.LiveChatVersion) === 1 && !visible) {
|
|
33
37
|
return null;
|
|
34
38
|
}
|
|
@@ -38,7 +42,7 @@ const TypingIndicator = _ref => {
|
|
|
38
42
|
var _state$domainStates$l2;
|
|
39
43
|
//visible is set to false if the current user is typing, in which case, we just send typing indicator to OC
|
|
40
44
|
if (((_state$domainStates$l2 = state.domainStates.liveChatConfig) === null || _state$domainStates$l2 === void 0 ? void 0 : _state$domainStates$l2.LiveChatVersion) === 2 && !visible) {
|
|
41
|
-
|
|
45
|
+
debounceTyping();
|
|
42
46
|
return null;
|
|
43
47
|
}
|
|
44
48
|
activeTyping.splice(i, 1);
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ConversationEndEntity = void 0;
|
|
7
|
+
let ConversationEndEntity;
|
|
8
|
+
exports.ConversationEndEntity = ConversationEndEntity;
|
|
9
|
+
(function (ConversationEndEntity) {
|
|
10
|
+
ConversationEndEntity[ConversationEndEntity["Customer"] = 0] = "Customer";
|
|
11
|
+
ConversationEndEntity[ConversationEndEntity["Agent"] = 1] = "Agent";
|
|
12
|
+
})(ConversationEndEntity || (exports.ConversationEndEntity = ConversationEndEntity = {}));
|
|
@@ -14,32 +14,36 @@ exports.LiveChatWidgetActionType = LiveChatWidgetActionType;
|
|
|
14
14
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_MINIMIZED"] = 4] = "SET_MINIMIZED";
|
|
15
15
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_STATE"] = 5] = "SET_CONVERSATION_STATE";
|
|
16
16
|
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PREVIOUS_FOCUSED_ELEMENT_ID"] = 6] = "SET_PREVIOUS_FOCUSED_ELEMENT_ID";
|
|
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["
|
|
17
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_FAILING"] = 7] = "SET_START_CHAT_FAILING";
|
|
18
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_OUTSIDE_OPERATING_HOURS"] = 8] = "SET_OUTSIDE_OPERATING_HOURS";
|
|
19
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRE_CHAT_SURVEY_RESPONSE"] = 9] = "SET_PRE_CHAT_SURVEY_RESPONSE";
|
|
20
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CUSTOM_CONTEXT"] = 10] = "SET_CUSTOM_CONTEXT";
|
|
21
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_CONFIRMATION"] = 11] = "SET_SHOW_CONFIRMATION";
|
|
22
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOW_EMAIL_TRANSCRIPT_PANE"] = 12] = "SET_SHOW_EMAIL_TRANSCRIPT_PANE";
|
|
23
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PRECHAT_RESPONSE_EMAIL"] = 13] = "SET_PRECHAT_RESPONSE_EMAIL";
|
|
24
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_AUDIO_NOTIFICATION"] = 14] = "SET_AUDIO_NOTIFICATION";
|
|
25
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_E2VV_ENABLED"] = 15] = "SET_E2VV_ENABLED";
|
|
26
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_CONTEXT"] = 16] = "SET_POST_CHAT_CONTEXT";
|
|
27
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SHOW_CALLING_CONTAINER"] = 17] = "SHOW_CALLING_CONTAINER";
|
|
28
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_INCOMING_CALL"] = 18] = "SET_INCOMING_CALL";
|
|
29
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_VIDEO_CALL"] = 19] = "DISABLE_VIDEO_CALL";
|
|
30
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_LOCAL_VIDEO"] = 20] = "DISABLE_LOCAL_VIDEO";
|
|
31
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["DISABLE_REMOTE_VIDEO"] = 21] = "DISABLE_REMOTE_VIDEO";
|
|
32
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CHAT_TOKEN"] = 22] = "SET_CHAT_TOKEN";
|
|
33
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_START_CHAT_BUTTON_DISPLAY"] = 23] = "SET_START_CHAT_BUTTON_DISPLAY";
|
|
34
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_PROACTIVE_CHAT_PARAMS"] = 24] = "SET_PROACTIVE_CHAT_PARAMS";
|
|
35
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_TELEMETRY_DATA"] = 25] = "SET_TELEMETRY_DATA";
|
|
36
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_RECONNECT_ID"] = 26] = "SET_RECONNECT_ID";
|
|
37
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_UNREAD_MESSAGE_COUNT"] = 27] = "SET_UNREAD_MESSAGE_COUNT";
|
|
38
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_FOCUS_CHAT_BUTTON"] = 28] = "SET_FOCUS_CHAT_BUTTON";
|
|
39
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED"] = 29] = "SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED";
|
|
40
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_CONVERSATION_ENDED_BY"] = 30] = "SET_CONVERSATION_ENDED_BY";
|
|
41
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_STATE"] = 31] = "SET_WIDGET_STATE";
|
|
42
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONTEXT"] = 32] = "SET_LIVE_CHAT_CONTEXT";
|
|
43
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_BOT_OAUTH_SIGNIN_ID"] = 33] = "SET_BOT_OAUTH_SIGNIN_ID";
|
|
44
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_SIZE"] = 34] = "SET_WIDGET_SIZE";
|
|
45
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_WIDGET_INSTANCE_ID"] = 35] = "SET_WIDGET_INSTANCE_ID";
|
|
46
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_LIVE_CHAT_CONFIG"] = 36] = "SET_LIVE_CHAT_CONFIG";
|
|
47
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_POST_CHAT_WORKFLOW_IN_PROGRESS"] = 37] = "SET_POST_CHAT_WORKFLOW_IN_PROGRESS";
|
|
48
|
+
LiveChatWidgetActionType[LiveChatWidgetActionType["SET_SHOULD_USE_BOT_SURVEY"] = 38] = "SET_SHOULD_USE_BOT_SURVEY";
|
|
45
49
|
})(LiveChatWidgetActionType || (exports.LiveChatWidgetActionType = LiveChatWidgetActionType = {}));
|
|
@@ -8,10 +8,12 @@ var _ConversationState = require("./ConversationState");
|
|
|
8
8
|
var _defaultMiddlewareLocalizedTexts = require("../../components/webchatcontainerstateful/common/defaultProps/defaultMiddlewareLocalizedTexts");
|
|
9
9
|
var _utils = require("../../common/utils");
|
|
10
10
|
var _defaultClientDataStoreProvider = require("../../common/storage/default/defaultClientDataStoreProvider");
|
|
11
|
+
var _Constants = require("../../common/Constants");
|
|
11
12
|
const getLiveChatWidgetContextInitialState = props => {
|
|
12
|
-
var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$controlProps, _props$webChatContain;
|
|
13
|
+
var _props$chatSDK, _props$chatSDK$omnich, _props$chatSDK2, _props$chatSDK2$omnic, _props$controlProps, _props$controlProps2, _props$webChatContain;
|
|
13
14
|
const widgetCacheId = (0, _utils.getWidgetCacheId)(props === null || props === void 0 ? void 0 : (_props$chatSDK = props.chatSDK) === null || _props$chatSDK === void 0 ? void 0 : (_props$chatSDK$omnich = _props$chatSDK.omnichannelConfig) === null || _props$chatSDK$omnich === void 0 ? void 0 : _props$chatSDK$omnich.orgId, props === null || props === void 0 ? void 0 : (_props$chatSDK2 = props.chatSDK) === null || _props$chatSDK2 === void 0 ? void 0 : (_props$chatSDK2$omnic = _props$chatSDK2.omnichannelConfig) === null || _props$chatSDK2$omnic === void 0 ? void 0 : _props$chatSDK2$omnic.widgetId, (props === null || props === void 0 ? void 0 : (_props$controlProps = props.controlProps) === null || _props$controlProps === void 0 ? void 0 : _props$controlProps.widgetInstanceId) ?? "");
|
|
14
|
-
const
|
|
15
|
+
const cacheTtlInMins = (props === null || props === void 0 ? void 0 : (_props$controlProps2 = props.controlProps) === null || _props$controlProps2 === void 0 ? void 0 : _props$controlProps2.cacheTtlInMins) ?? _Constants.Constants.CacheTtlInMinutes;
|
|
16
|
+
const initialState = (0, _defaultClientDataStoreProvider.defaultClientDataStoreProvider)(cacheTtlInMins).getData(widgetCacheId, "localStorage");
|
|
15
17
|
if (!(0, _utils.isNullOrUndefined)(initialState)) {
|
|
16
18
|
return JSON.parse(initialState);
|
|
17
19
|
}
|
|
@@ -35,6 +37,7 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
35
37
|
conversationState: _ConversationState.ConversationState.Closed,
|
|
36
38
|
isMinimized: false,
|
|
37
39
|
previousElementIdOnFocusBeforeModalOpen: null,
|
|
40
|
+
isStartChatFailing: false,
|
|
38
41
|
outsideOperatingHours: false,
|
|
39
42
|
preChatResponseEmail: "",
|
|
40
43
|
isAudioMuted: null,
|
|
@@ -48,7 +51,10 @@ const getLiveChatWidgetContextInitialState = props => {
|
|
|
48
51
|
},
|
|
49
52
|
e2vvEnabled: false,
|
|
50
53
|
unreadMessageCount: 0,
|
|
51
|
-
|
|
54
|
+
conversationEndedByAgentEventReceived: false,
|
|
55
|
+
conversationEndedBy: undefined,
|
|
56
|
+
postChatWorkflowInProgress: false,
|
|
57
|
+
shouldUseBotSurvey: false
|
|
52
58
|
},
|
|
53
59
|
uiStates: {
|
|
54
60
|
showConfirmationPane: false,
|
|
@@ -59,6 +59,14 @@ const createReducer = () => {
|
|
|
59
59
|
conversationState: action.payload
|
|
60
60
|
}
|
|
61
61
|
};
|
|
62
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_START_CHAT_FAILING:
|
|
63
|
+
return {
|
|
64
|
+
...state,
|
|
65
|
+
appStates: {
|
|
66
|
+
...state.appStates,
|
|
67
|
+
isStartChatFailing: action.payload
|
|
68
|
+
}
|
|
69
|
+
};
|
|
62
70
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_OUTSIDE_OPERATING_HOURS:
|
|
63
71
|
return {
|
|
64
72
|
...state,
|
|
@@ -256,12 +264,20 @@ const createReducer = () => {
|
|
|
256
264
|
return {
|
|
257
265
|
...action.payload
|
|
258
266
|
};
|
|
259
|
-
case _LiveChatWidgetActionType.LiveChatWidgetActionType.
|
|
267
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY_AGENT_EVENT_RECEIVED:
|
|
260
268
|
return {
|
|
261
269
|
...state,
|
|
262
270
|
appStates: {
|
|
263
271
|
...state.appStates,
|
|
264
|
-
|
|
272
|
+
conversationEndedByAgentEventReceived: action.payload
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_ENDED_BY:
|
|
276
|
+
return {
|
|
277
|
+
...state,
|
|
278
|
+
appStates: {
|
|
279
|
+
...state.appStates,
|
|
280
|
+
conversationEndedBy: action.payload
|
|
265
281
|
}
|
|
266
282
|
};
|
|
267
283
|
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_WIDGET_SIZE:
|
|
@@ -291,6 +307,24 @@ const createReducer = () => {
|
|
|
291
307
|
liveChatConfig: action.payload
|
|
292
308
|
}
|
|
293
309
|
};
|
|
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
|
+
case _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_SHOULD_USE_BOT_SURVEY:
|
|
320
|
+
return {
|
|
321
|
+
...state,
|
|
322
|
+
appStates: {
|
|
323
|
+
...state.appStates,
|
|
324
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
325
|
+
shouldUseBotSurvey: action.payload
|
|
326
|
+
}
|
|
327
|
+
};
|
|
294
328
|
default:
|
|
295
329
|
return state;
|
|
296
330
|
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = useDebounce;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
function useDebounce(func) {
|
|
9
|
+
let delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;
|
|
10
|
+
const timer = (0, _react.useRef)();
|
|
11
|
+
(0, _react.useEffect)(() => {
|
|
12
|
+
return () => {
|
|
13
|
+
if (!timer.current) return;
|
|
14
|
+
clearTimeout(timer.current);
|
|
15
|
+
};
|
|
16
|
+
}, []);
|
|
17
|
+
const debouncedFunction = function () {
|
|
18
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
19
|
+
args[_key] = arguments[_key];
|
|
20
|
+
}
|
|
21
|
+
const newTimer = setTimeout(() => {
|
|
22
|
+
func(...args);
|
|
23
|
+
}, delay);
|
|
24
|
+
clearTimeout(timer.current);
|
|
25
|
+
timer.current = newTimer;
|
|
26
|
+
};
|
|
27
|
+
return debouncedFunction;
|
|
28
|
+
}
|