@microsoft/omnichannel-chat-widget 1.8.4-main.9ae37a9 → 1.8.4-main.acea70c
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/common/Constants.js +2 -0
- package/lib/cjs/common/telemetry/loggers/appInsightsLogger.js +7 -7
- package/lib/cjs/common/utils/xssUtils.js +23 -51
- package/lib/cjs/common/utils.js +14 -1
- package/lib/cjs/components/errorboundary/ErrorBoundary.js +2 -1
- package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +23 -6
- package/lib/cjs/components/livechatwidget/common/createAdapter.js +3 -2
- package/lib/cjs/components/livechatwidget/common/endChat.js +5 -0
- package/lib/cjs/components/livechatwidget/common/liveChatConfigUtils.js +36 -4
- package/lib/cjs/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +2 -1
- package/lib/cjs/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +6 -4
- package/lib/cjs/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +0 -1
- package/lib/cjs/components/webchatcontainerstateful/WebChatContainerStateful.js +31 -24
- package/lib/cjs/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +42 -14
- package/lib/cjs/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
- package/lib/cjs/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -0
- package/lib/esm/common/Constants.js +2 -0
- package/lib/esm/common/telemetry/loggers/appInsightsLogger.js +7 -7
- package/lib/esm/common/utils/xssUtils.js +23 -51
- package/lib/esm/common/utils.js +11 -0
- package/lib/esm/components/errorboundary/ErrorBoundary.js +4 -2
- package/lib/esm/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js +23 -6
- package/lib/esm/components/livechatwidget/common/createAdapter.js +3 -2
- package/lib/esm/components/livechatwidget/common/endChat.js +5 -0
- package/lib/esm/components/livechatwidget/common/liveChatConfigUtils.js +33 -2
- package/lib/esm/components/livechatwidget/livechatwidgetstateful/LiveChatWidgetStateful.js +2 -1
- package/lib/esm/components/postchatsurveypanestateful/PostChatSurveyPaneStateful.js +6 -4
- package/lib/esm/components/proactivechatpanestateful/ProactiveChatPaneStateful.js +1 -2
- package/lib/esm/components/webchatcontainerstateful/WebChatContainerStateful.js +32 -25
- package/lib/esm/components/webchatcontainerstateful/common/activityConverters/convertPersistentChatHistoryMessageToActivity.js +42 -14
- package/lib/esm/components/webchatcontainerstateful/common/defaultStyles/defaultAdaptiveCardStyles.js +3 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/timestamps/NotDeliveredTimestamp.js +2 -0
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/channelDataMiddleware.js +1 -0
- package/lib/types/common/Constants.d.ts +2 -0
- package/lib/types/common/utils/xssUtils.d.ts +5 -21
- package/lib/types/common/utils.d.ts +9 -1
- package/lib/types/components/errorboundary/ErrorBoundary.d.ts +1 -1
- package/lib/types/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.d.ts +1 -0
- package/lib/types/components/livechatwidget/common/liveChatConfigUtils.d.ts +11 -0
- package/lib/types/components/livechatwidget/interfaces/IBotAuthActivitySubscriberOptionalParams.d.ts +1 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IAdaptiveCardStyles.d.ts +2 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IBotAuthConfig.d.ts +7 -0
- package/lib/types/components/webchatcontainerstateful/interfaces/IExtendedChatConffig.d.ts +1 -1
- package/package.json +7 -4
|
@@ -82,6 +82,8 @@ _defineProperty(Constants, "audioMediaRegex", /(\.)(aac|aiff|alac|amr|flac|mp2|m
|
|
|
82
82
|
_defineProperty(Constants, "videoMediaRegex", /(\.)(avchd|avi|flv|mpe|mpeg|mpg|mpv|mp4|m4p|m4v|mov|qt|swf|webm|wmv)$/i);
|
|
83
83
|
_defineProperty(Constants, "chromeSupportedInlineMediaRegex", /(\.)(aac|mp3|wav|mp4)$/i);
|
|
84
84
|
_defineProperty(Constants, "firefoxSupportedInlineMediaRegex", /(\.)(aac|flac|mp3|wav|mp4|mov)$/i);
|
|
85
|
+
_defineProperty(Constants, "AdaptiveCardType", "adaptivecard");
|
|
86
|
+
_defineProperty(Constants, "SuggestedActionsType", "suggestedactions");
|
|
85
87
|
// calling container event names
|
|
86
88
|
_defineProperty(Constants, "CallAdded", "callAdded");
|
|
87
89
|
_defineProperty(Constants, "LocalVideoStreamAdded", "localVideoStreamAdded");
|
|
@@ -14,11 +14,11 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
|
|
|
14
14
|
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; }
|
|
15
15
|
var AllowedKeys;
|
|
16
16
|
(function (AllowedKeys) {
|
|
17
|
-
AllowedKeys["OrganizationId"] = "
|
|
18
|
-
AllowedKeys["ConversationId"] = "
|
|
17
|
+
AllowedKeys["OrganizationId"] = "powerplatform.analytics.resource.organization.id";
|
|
18
|
+
AllowedKeys["ConversationId"] = "powerplatform.analytics.resource.id";
|
|
19
19
|
AllowedKeys["ElapsedTimeInMilliseconds"] = "Duration";
|
|
20
|
-
AllowedKeys["Description"] = "
|
|
21
|
-
AllowedKeys["ChannelId"] = "
|
|
20
|
+
AllowedKeys["Description"] = "omnichannel.description";
|
|
21
|
+
AllowedKeys["ChannelId"] = "omnichannel.channel.type";
|
|
22
22
|
AllowedKeys["LCWRuntimeId"] = "ClientSessionId";
|
|
23
23
|
})(AllowedKeys || (AllowedKeys = {}));
|
|
24
24
|
let initializationPromise = null;
|
|
@@ -95,8 +95,8 @@ const appInsightsLogger = appInsightsKey => {
|
|
|
95
95
|
if (eventName) {
|
|
96
96
|
const trackingEventName = getTrackingEventName(logLevel, eventName);
|
|
97
97
|
const eventProperties = setEventProperties(trackingEventName, telemetryInfo);
|
|
98
|
-
_logger.
|
|
99
|
-
|
|
98
|
+
_logger.trackTrace({
|
|
99
|
+
message: trackingEventName,
|
|
100
100
|
properties: eventProperties
|
|
101
101
|
});
|
|
102
102
|
}
|
|
@@ -142,7 +142,7 @@ const appInsightsLogger = appInsightsKey => {
|
|
|
142
142
|
// Additional properties
|
|
143
143
|
eventProperties["ConversationStage"] = customProperties.ConversationStage ?? _TelemetryConstants.ConversationStage.CSREngagement;
|
|
144
144
|
eventProperties["Scenario"] = "Conversation Diagnostics";
|
|
145
|
-
eventProperties["
|
|
145
|
+
eventProperties["powerplatform.analytics.subscenario"] = eventName.includes(": ") ? eventName.split(": ")[1] : eventName;
|
|
146
146
|
return eventProperties;
|
|
147
147
|
}
|
|
148
148
|
function getTrackingEventName(logLevel, eventName) {
|
|
@@ -7,70 +7,42 @@ exports.detectAndCleanXSS = void 0;
|
|
|
7
7
|
var _dompurify = _interopRequireDefault(require("dompurify"));
|
|
8
8
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Sanitizes text input and detects XSS attack patterns.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* against various XSS techniques including script injection, event handler injection, style-based
|
|
15
|
-
* attacks, and encoded payloads.
|
|
12
|
+
* Sanitizes first with DOMPurify, then checks for malicious patterns in both
|
|
13
|
+
* the original and sanitized text to catch mutation XSS attacks.
|
|
16
14
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* - HTML event handlers (onmouseover, onclick, etc.)
|
|
20
|
-
* - Script tags (<script>)
|
|
21
|
-
* - CSS expression() functions
|
|
22
|
-
* - CSS url() functions
|
|
23
|
-
* - Position-based CSS attacks (position: fixed/absolute)
|
|
24
|
-
* - VBScript protocol URLs
|
|
25
|
-
* - Data URLs with HTML content
|
|
26
|
-
* - Fragment identifiers with escaped quotes
|
|
27
|
-
* - HTML entity-encoded angle brackets
|
|
28
|
-
*
|
|
29
|
-
* @param text - The input text to be analyzed and sanitized
|
|
30
|
-
* @returns An object containing:
|
|
31
|
-
* - cleanText: The sanitized version of the input text with all HTML tags and attributes removed
|
|
32
|
-
* - isXSSDetected: Boolean flag indicating whether potential XSS patterns were found in the original text
|
|
15
|
+
* @param text - Input text to sanitize
|
|
16
|
+
* @returns Object with cleanText (sanitized) and isXSSDetected flag
|
|
33
17
|
*/
|
|
34
18
|
const detectAndCleanXSS = text => {
|
|
35
|
-
//
|
|
36
|
-
const xssPatterns = [/javascript\s*:/gi,
|
|
37
|
-
// JavaScript protocol URLs (with optional spaces)
|
|
38
|
-
/vbscript\s*:/gi,
|
|
39
|
-
// VBScript protocol URLs (with optional spaces)
|
|
40
|
-
/on\w+\s*=/gi,
|
|
41
|
-
// HTML event handlers (onmouseover, onclick, onload, etc.)
|
|
42
|
-
/<\s*script/gi,
|
|
43
|
-
// Script tag opening (with optional spaces)
|
|
44
|
-
/expression\s*\(/gi,
|
|
45
|
-
// CSS expression() function (IE-specific)
|
|
46
|
-
/url\s*\(/gi,
|
|
47
|
-
// CSS url() function
|
|
48
|
-
/style\s*=.*position\s*:\s*fixed/gi,
|
|
49
|
-
// CSS position fixed attacks
|
|
50
|
-
/style\s*=.*position\s*:\s*absolute/gi,
|
|
51
|
-
// CSS position absolute attacks
|
|
52
|
-
/data\s*:\s*text\s*\/\s*html/gi,
|
|
53
|
-
// Data URLs containing HTML
|
|
54
|
-
/#.*\\"/gi,
|
|
55
|
-
// Fragment identifiers with escaped quotes
|
|
56
|
-
/>.*</gi // HTML entity-encoded angle brackets indicating tag structure
|
|
57
|
-
];
|
|
58
|
-
|
|
59
|
-
// Check if any XSS patterns are detected in the input text
|
|
60
|
-
const isXSSDetected = xssPatterns.some(pattern => pattern.test(text));
|
|
61
|
-
|
|
62
|
-
// Clean the text using DOMPurify with strict config
|
|
19
|
+
// Sanitize first to prevent mutation XSS (e.g., "s<iframe></iframe>tyle" → "style")
|
|
63
20
|
const cleanText = _dompurify.default.sanitize(text, {
|
|
64
21
|
ALLOWED_TAGS: [],
|
|
65
|
-
// No HTML tags allowed in title
|
|
66
22
|
ALLOWED_ATTR: [],
|
|
67
23
|
KEEP_CONTENT: true,
|
|
68
|
-
// Keep text content
|
|
69
24
|
ALLOW_DATA_ATTR: false,
|
|
70
25
|
ALLOW_UNKNOWN_PROTOCOLS: false,
|
|
71
26
|
SANITIZE_DOM: true,
|
|
72
27
|
FORCE_BODY: false
|
|
73
28
|
});
|
|
29
|
+
const contentChanged = text !== cleanText;
|
|
30
|
+
|
|
31
|
+
// Non-global regex patterns to avoid stateful .test() issues
|
|
32
|
+
const xssPatterns = [/javascript\s*:/i, /vbscript\s*:/i, /on\w+\s*=/i,
|
|
33
|
+
// Event handlers
|
|
34
|
+
/<\s*script/i, /<\s*iframe/i, /<\s*object/i, /<\s*embed/i, /<\s*svg/i, /expression\s*\(/i,
|
|
35
|
+
// IE CSS expressions
|
|
36
|
+
/style\s*=.*position\s*:\s*(fixed|absolute)/i, /data\s*:\s*text\s*\/\s*html/i, /#.*\\"/i, /&(lt|gt|#x3c|#60|#x3e|#62);/i,
|
|
37
|
+
// HTML entities
|
|
38
|
+
/&#x?[0-9a-f]+;.*</i, /\u003c.*\u003e/i,
|
|
39
|
+
// Unicode escapes
|
|
40
|
+
/src\s*=\s*["']?\s*javascript:/i, /href\s*=\s*["']?\s*javascript:/i];
|
|
41
|
+
const hasXSSPattern = xssPatterns.some(pattern => {
|
|
42
|
+
return pattern.test(text) || pattern.test(cleanText);
|
|
43
|
+
});
|
|
44
|
+
const hasHTMLStructure = /<[^>]+>/.test(text) && !/<[^>]+>/.test(cleanText);
|
|
45
|
+
const isXSSDetected = contentChanged || hasXSSPattern || hasHTMLStructure;
|
|
74
46
|
return {
|
|
75
47
|
cleanText,
|
|
76
48
|
isXSSDetected
|
package/lib/cjs/common/utils.js
CHANGED
|
@@ -7,7 +7,9 @@ exports.getCustomEventValue = exports.getConversationDetailsCall = exports.getBr
|
|
|
7
7
|
exports.getDeviceType = getDeviceType;
|
|
8
8
|
exports.getWidgetEndChatEventName = exports.getWidgetCacheIdfromProps = exports.getWidgetCacheId = exports.getTimestampHourMinute = exports.getStateFromCache = exports.getLocaleDirection = exports.getIconText = exports.getDomain = void 0;
|
|
9
9
|
exports.isEndConversationDueToOverflowActivity = isEndConversationDueToOverflowActivity;
|
|
10
|
-
exports.
|
|
10
|
+
exports.parseAdaptiveCardPayload = exports.newGuid = exports.isValidCustomEvent = exports.isUndefinedOrEmpty = exports.isThisSessionPopout = exports.isNullOrUndefined = exports.isNullOrEmptyString = void 0;
|
|
11
|
+
exports.parseBooleanFromConfig = parseBooleanFromConfig;
|
|
12
|
+
exports.setTabIndices = exports.setOcUserAgent = exports.setFocusOnSendBox = exports.setFocusOnElement = exports.preventFocusToMoveOutOfElement = exports.parseLowerCaseString = void 0;
|
|
11
13
|
var _Constants = require("./Constants");
|
|
12
14
|
var _TelemetryConstants = require("./telemetry/TelemetryConstants");
|
|
13
15
|
var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components");
|
|
@@ -519,4 +521,15 @@ exports.getCustomEventValue = getCustomEventValue;
|
|
|
519
521
|
function isEndConversationDueToOverflowActivity(activity) {
|
|
520
522
|
var _activity$channelData, _activity$channelData2;
|
|
521
523
|
return (activity === null || activity === void 0 ? void 0 : (_activity$channelData = activity.channelData) === null || _activity$channelData === void 0 ? void 0 : _activity$channelData.tags) && Array.isArray(activity === null || activity === void 0 ? void 0 : (_activity$channelData2 = activity.channelData) === null || _activity$channelData2 === void 0 ? void 0 : _activity$channelData2.tags) && activity.channelData.tags.includes(_Constants.Constants.EndConversationDueToOverflow);
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Parses a value that can be boolean or string ("true"/"false") into a boolean.
|
|
528
|
+
* Handles null/undefined by returning false.
|
|
529
|
+
*
|
|
530
|
+
* @param value - The value to parse (can be boolean, string, null, or undefined)
|
|
531
|
+
* @returns true if value is true or "true" (case-insensitive), false otherwise
|
|
532
|
+
*/
|
|
533
|
+
function parseBooleanFromConfig(value) {
|
|
534
|
+
return value === true || (value === null || value === void 0 ? void 0 : value.toString().toLowerCase()) === "true";
|
|
522
535
|
}
|
|
@@ -19,11 +19,12 @@ function _possibleConstructorReturn(self, call) { if (call && (typeof call === "
|
|
|
19
19
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
20
20
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
21
21
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
22
|
+
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
22
23
|
const RenderChildrenFunction = _ref => {
|
|
23
24
|
let {
|
|
24
25
|
children
|
|
25
26
|
} = _ref;
|
|
26
|
-
return typeof children ===
|
|
27
|
+
return typeof children === "function" ? children() : children;
|
|
27
28
|
};
|
|
28
29
|
let ErrorBoundary = /*#__PURE__*/function (_Component) {
|
|
29
30
|
_inherits(ErrorBoundary, _Component);
|
package/lib/cjs/components/livechatwidget/common/ActivitySubscriber/BotAuthActivitySubscriber.js
CHANGED
|
@@ -44,7 +44,7 @@ const extractSasUrl = async attachment => {
|
|
|
44
44
|
}
|
|
45
45
|
return sasUrl;
|
|
46
46
|
};
|
|
47
|
-
const fetchBotAuthConfig = async (retries, interval) => {
|
|
47
|
+
const fetchBotAuthConfig = async (retries, interval, fallback) => {
|
|
48
48
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
49
49
|
Event: _TelemetryConstants.TelemetryEvent.SetBotAuthProviderFetchConfig
|
|
50
50
|
});
|
|
@@ -60,13 +60,23 @@ const fetchBotAuthConfig = async (retries, interval) => {
|
|
|
60
60
|
});
|
|
61
61
|
if (retries === 1) {
|
|
62
62
|
// Base Case
|
|
63
|
-
|
|
63
|
+
if (response !== undefined) {
|
|
64
|
+
return response;
|
|
65
|
+
}
|
|
66
|
+
if (fallback !== undefined) {
|
|
67
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.WARN, {
|
|
68
|
+
Event: _TelemetryConstants.TelemetryEvent.SetBotAuthProviderNotFound,
|
|
69
|
+
Description: `Failed to fetch bot auth config after maximum retries. Using fallback value: ${fallback}`
|
|
70
|
+
});
|
|
71
|
+
return fallback;
|
|
72
|
+
}
|
|
73
|
+
throw new Error("Failed to fetch bot auth config after maximum retries");
|
|
64
74
|
}
|
|
65
75
|
await delay(interval);
|
|
66
76
|
if (response !== undefined) {
|
|
67
77
|
return response;
|
|
68
78
|
}
|
|
69
|
-
return await fetchBotAuthConfig(--retries, interval);
|
|
79
|
+
return await fetchBotAuthConfig(--retries, interval, fallback);
|
|
70
80
|
};
|
|
71
81
|
let BotAuthActivitySubscriber = /*#__PURE__*/function () {
|
|
72
82
|
function BotAuthActivitySubscriber() {
|
|
@@ -76,6 +86,7 @@ let BotAuthActivitySubscriber = /*#__PURE__*/function () {
|
|
|
76
86
|
_defineProperty(this, "signInCardSeen", void 0);
|
|
77
87
|
_defineProperty(this, "fetchBotAuthConfigRetries", void 0);
|
|
78
88
|
_defineProperty(this, "fetchBotAuthConfigRetryInterval", void 0);
|
|
89
|
+
_defineProperty(this, "fallbackShowSignInCard", void 0);
|
|
79
90
|
this.signInCardSeen = new Set();
|
|
80
91
|
this.fetchBotAuthConfigRetries = 3;
|
|
81
92
|
this.fetchBotAuthConfigRetryInterval = 1000;
|
|
@@ -85,6 +96,11 @@ let BotAuthActivitySubscriber = /*#__PURE__*/function () {
|
|
|
85
96
|
if (optionalParams.fetchBotAuthConfigRetryInterval) {
|
|
86
97
|
this.fetchBotAuthConfigRetryInterval = optionalParams.fetchBotAuthConfigRetryInterval;
|
|
87
98
|
}
|
|
99
|
+
this.fallbackShowSignInCard = optionalParams.fallbackShowSignInCard;
|
|
100
|
+
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
101
|
+
Event: _TelemetryConstants.TelemetryEvent.SetBotAuthProviderFetchConfig,
|
|
102
|
+
Description: `BotAuthActivitySubscriber initialized with fallbackShowSignInCard: ${optionalParams.fallbackShowSignInCard}`
|
|
103
|
+
});
|
|
88
104
|
}
|
|
89
105
|
_createClass(BotAuthActivitySubscriber, [{
|
|
90
106
|
key: "applicable",
|
|
@@ -129,7 +145,7 @@ let BotAuthActivitySubscriber = /*#__PURE__*/function () {
|
|
|
129
145
|
_omnichannelChatComponents.BroadcastService.postMessage(event);
|
|
130
146
|
}
|
|
131
147
|
try {
|
|
132
|
-
const response = await fetchBotAuthConfig(this.fetchBotAuthConfigRetries, this.fetchBotAuthConfigRetryInterval);
|
|
148
|
+
const response = await fetchBotAuthConfig(this.fetchBotAuthConfigRetries, this.fetchBotAuthConfigRetryInterval, this.fallbackShowSignInCard);
|
|
133
149
|
if (response === false) {
|
|
134
150
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
135
151
|
Event: _TelemetryConstants.TelemetryEvent.SetBotAuthProviderHideCard
|
|
@@ -140,9 +156,10 @@ let BotAuthActivitySubscriber = /*#__PURE__*/function () {
|
|
|
140
156
|
});
|
|
141
157
|
return activity;
|
|
142
158
|
}
|
|
143
|
-
} catch {
|
|
159
|
+
} catch (e) {
|
|
144
160
|
_TelemetryHelper.TelemetryHelper.logLoadingEvent(_TelemetryConstants.LogLevel.INFO, {
|
|
145
|
-
Event: _TelemetryConstants.TelemetryEvent.SetBotAuthProviderNotFound
|
|
161
|
+
Event: _TelemetryConstants.TelemetryEvent.SetBotAuthProviderNotFound,
|
|
162
|
+
ExceptionDetails: e instanceof Error ? e.message : JSON.stringify(e)
|
|
146
163
|
});
|
|
147
164
|
//this is to ensure listener continues waiting for response
|
|
148
165
|
if (this.signInCardSeen.has(signInId)) {
|
|
@@ -45,10 +45,11 @@ const createAdapter = async (facadeChatSDK, props) => {
|
|
|
45
45
|
//so far, there is no need to convert to the shim adapter when using visual tests
|
|
46
46
|
const isMocked = facadeChatSDK.getChatSDK() instanceof _mockchatsdk.MockChatSDK;
|
|
47
47
|
if (isMocked !== true) {
|
|
48
|
-
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4;
|
|
48
|
+
var _props$webChatContain, _props$webChatContain2, _props$webChatContain3, _props$webChatContain4, _props$webChatContain5, _props$webChatContain6;
|
|
49
49
|
const botAuthActivitySubscriberOptionalParams = {
|
|
50
50
|
fetchBotAuthConfigRetries: (props === null || props === void 0 ? void 0 : (_props$webChatContain = props.webChatContainerProps) === null || _props$webChatContain === void 0 ? void 0 : (_props$webChatContain2 = _props$webChatContain.botAuthConfig) === null || _props$webChatContain2 === void 0 ? void 0 : _props$webChatContain2.fetchBotAuthConfigRetries) || defaultBotAuthConfig.fetchBotAuthConfigRetries,
|
|
51
|
-
fetchBotAuthConfigRetryInterval: (props === null || props === void 0 ? void 0 : (_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : (_props$webChatContain4 = _props$webChatContain3.botAuthConfig) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.fetchBotAuthConfigRetryInterval) || defaultBotAuthConfig.fetchBotAuthConfigRetryInterval
|
|
51
|
+
fetchBotAuthConfigRetryInterval: (props === null || props === void 0 ? void 0 : (_props$webChatContain3 = props.webChatContainerProps) === null || _props$webChatContain3 === void 0 ? void 0 : (_props$webChatContain4 = _props$webChatContain3.botAuthConfig) === null || _props$webChatContain4 === void 0 ? void 0 : _props$webChatContain4.fetchBotAuthConfigRetryInterval) || defaultBotAuthConfig.fetchBotAuthConfigRetryInterval,
|
|
52
|
+
fallbackShowSignInCard: props === null || props === void 0 ? void 0 : (_props$webChatContain5 = props.webChatContainerProps) === null || _props$webChatContain5 === void 0 ? void 0 : (_props$webChatContain6 = _props$webChatContain5.botAuthConfig) === null || _props$webChatContain6 === void 0 ? void 0 : _props$webChatContain6.fallbackShowSignInCard
|
|
52
53
|
};
|
|
53
54
|
adapter = new _ChatAdapterShim.ChatAdapterShim(adapter);
|
|
54
55
|
adapter.addSubscriber(new _AddActivitySubscriber.AddActivitySubscriber());
|
|
@@ -12,6 +12,8 @@ var _omnichannelChatComponents = require("@microsoft/omnichannel-chat-components
|
|
|
12
12
|
var _ConversationState = require("../../../contexts/common/ConversationState");
|
|
13
13
|
var _LazyLoadActivity = require("../../webchatcontainerstateful/webchatcontroller/middlewares/renderingmiddlewares/activities/LazyLoadActivity");
|
|
14
14
|
var _LiveChatWidgetActionType = require("../../../contexts/common/LiveChatWidgetActionType");
|
|
15
|
+
var _NotificationHandler = require("../../webchatcontainerstateful/webchatcontroller/notification/NotificationHandler");
|
|
16
|
+
var _NotificationScenarios = require("../../webchatcontainerstateful/webchatcontroller/enums/NotificationScenarios");
|
|
15
17
|
var _TelemetryHelper = require("../../../common/telemetry/TelemetryHelper");
|
|
16
18
|
var _TelemetryManager = require("../../../common/telemetry/TelemetryManager");
|
|
17
19
|
var _WebChatStoreLoader = require("../../webchatcontainerstateful/webchatcontroller/WebChatStoreLoader");
|
|
@@ -343,6 +345,9 @@ const closeChatStateCleanUp = dispatch => {
|
|
|
343
345
|
payload: {}
|
|
344
346
|
});
|
|
345
347
|
|
|
348
|
+
// Dismiss the chat disconnect notification banner if it was shown
|
|
349
|
+
_NotificationHandler.NotificationHandler.dismissNotification(_NotificationScenarios.NotificationScenarios.ChatDisconnect);
|
|
350
|
+
|
|
346
351
|
// Clear live chat context only if chat widget is fully closed to support transcript calls after sessionclose is called
|
|
347
352
|
dispatch({
|
|
348
353
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_LIVE_CHAT_CONTEXT,
|
|
@@ -3,15 +3,17 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.isPostChatSurveyEnabled = exports.isPersistentChatEnabled = exports.getPostChatSurveyConfig = void 0;
|
|
7
|
-
var _Constants = require("../../../common/Constants");
|
|
6
|
+
exports.shouldLoadPersistentChatHistory = exports.isPostChatSurveyEnabled = exports.isPersistentChatEnabled = exports.getPostChatSurveyConfig = void 0;
|
|
8
7
|
var _utils = require("../../../common/utils");
|
|
8
|
+
var _Constants = require("../../../common/Constants");
|
|
9
9
|
const isPostChatSurveyEnabled = async facadeChatSDK => {
|
|
10
10
|
var _chatConfig$LiveWSAnd;
|
|
11
11
|
const chatConfig = await facadeChatSDK.getLiveChatConfig();
|
|
12
12
|
const postChatEnabled = (_chatConfig$LiveWSAnd = chatConfig.LiveWSAndLiveChatEngJoin) === null || _chatConfig$LiveWSAnd === void 0 ? void 0 : _chatConfig$LiveWSAnd.msdyn_postconversationsurveyenable.toString().toLowerCase();
|
|
13
13
|
return postChatEnabled === "true";
|
|
14
14
|
};
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
15
17
|
exports.isPostChatSurveyEnabled = isPostChatSurveyEnabled;
|
|
16
18
|
const getPostChatSurveyConfig = async facadeChatSDK => {
|
|
17
19
|
var _chatConfig$LiveWSAnd2, _chatConfig$LiveWSAnd3, _chatConfig$LiveWSAnd4, _chatConfig$LiveWSAnd5, _chatConfig$LiveWSAnd6, _chatConfig$LiveWSAnd7, _chatConfig$LiveWSAnd8, _chatConfig$LiveWSAnd9, _chatConfig$LiveWSAnd10;
|
|
@@ -34,6 +36,36 @@ const isPersistentChatEnabled = conversationMode => {
|
|
|
34
36
|
if ((0, _utils.isNullOrUndefined)(conversationMode)) {
|
|
35
37
|
return false;
|
|
36
38
|
}
|
|
37
|
-
return (conversationMode === null || conversationMode === void 0 ? void 0 : conversationMode.toString()
|
|
39
|
+
return (conversationMode === null || conversationMode === void 0 ? void 0 : conversationMode.toString()) === _Constants.ConversationMode.Persistent;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Determines if persistent chat history should be loaded based on all required conditions.
|
|
44
|
+
*
|
|
45
|
+
* @param extendedChatConfig - The extended chat configuration object
|
|
46
|
+
* @returns true if ALL conditions are met:
|
|
47
|
+
* 1. Conversation mode must be Persistent ("192350001")
|
|
48
|
+
* 2. History is enabled in admin config (msdyn_enablepersistentchatpreviousconversations)
|
|
49
|
+
* 3. History is enabled via feature flag (lcwPersistentChatHistoryEnabled)
|
|
50
|
+
*/
|
|
51
|
+
exports.isPersistentChatEnabled = isPersistentChatEnabled;
|
|
52
|
+
const shouldLoadPersistentChatHistory = extendedChatConfig => {
|
|
53
|
+
var _extendedChatConfig$L, _extendedChatConfig$L2, _extendedChatConfig$L3;
|
|
54
|
+
// CRITICAL: First check if conversation mode is persistent
|
|
55
|
+
// Only persistent mode ("192350001") should allow history loading
|
|
56
|
+
const isPersistentChatEnabledForWidget = isPersistentChatEnabled(extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L = extendedChatConfig.LiveWSAndLiveChatEngJoin) === null || _extendedChatConfig$L === void 0 ? void 0 : _extendedChatConfig$L.msdyn_conversationmode);
|
|
57
|
+
if (!isPersistentChatEnabledForWidget) {
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Check if history is enabled in admin config (handles both boolean and string "true"/"false")
|
|
62
|
+
const isHistoryEnabledInConfig = (0, _utils.parseBooleanFromConfig)(extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L2 = extendedChatConfig.LiveWSAndLiveChatEngJoin) === null || _extendedChatConfig$L2 === void 0 ? void 0 : _extendedChatConfig$L2.msdyn_enablepersistentchatpreviousconversations);
|
|
63
|
+
if (!isHistoryEnabledInConfig) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Check if history is enabled via feature flag (handles both boolean and string "true"/"false")
|
|
68
|
+
const isHistoryEnabledViaFCB = (0, _utils.parseBooleanFromConfig)(extendedChatConfig === null || extendedChatConfig === void 0 ? void 0 : (_extendedChatConfig$L3 = extendedChatConfig.LcwFcbConfiguration) === null || _extendedChatConfig$L3 === void 0 ? void 0 : _extendedChatConfig$L3.lcwPersistentChatHistoryEnabled);
|
|
69
|
+
return isHistoryEnabledViaFCB;
|
|
38
70
|
};
|
|
39
|
-
exports.
|
|
71
|
+
exports.shouldLoadPersistentChatHistory = shouldLoadPersistentChatHistory;
|
|
@@ -814,7 +814,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
814
814
|
|
|
815
815
|
// In conversational survey, we need to check post chat survey logics before we set ConversationState to InActive
|
|
816
816
|
// Hence setting ConversationState to InActive will be done later in the post chat flows
|
|
817
|
-
if (!isConversationalSurveyEnabled && (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta12 = inMemoryState.appStates) === null || _inMemoryState$appSta12 === void 0 ? void 0 : _inMemoryState$appSta12.conversationEndedBy) === _Constants.ConversationEndEntity.Agent || (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta13 = inMemoryState.appStates) === null || _inMemoryState$appSta13 === void 0 ? void 0 : _inMemoryState$appSta13.conversationEndedBy) === _Constants.ConversationEndEntity.Bot) {
|
|
817
|
+
if (!isConversationalSurveyEnabled && ((inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta12 = inMemoryState.appStates) === null || _inMemoryState$appSta12 === void 0 ? void 0 : _inMemoryState$appSta12.conversationEndedBy) === _Constants.ConversationEndEntity.Agent || (inMemoryState === null || inMemoryState === void 0 ? void 0 : (_inMemoryState$appSta13 = inMemoryState.appStates) === null || _inMemoryState$appSta13 === void 0 ? void 0 : _inMemoryState$appSta13.conversationEndedBy) === _Constants.ConversationEndEntity.Bot)) {
|
|
818
818
|
dispatch({
|
|
819
819
|
type: _LiveChatWidgetActionType.LiveChatWidgetActionType.SET_CONVERSATION_STATE,
|
|
820
820
|
payload: _ConversationState.ConversationState.InActive
|
|
@@ -963,6 +963,7 @@ const LiveChatWidgetStateful = props => {
|
|
|
963
963
|
// React to dynamic bot avatar initials updates from context
|
|
964
964
|
(0, _react2.useEffect)(() => {
|
|
965
965
|
if (state.domainStates.botAvatarInitials && state.domainStates.botAvatarInitials !== webChatStyles.botAvatarInitials) {
|
|
966
|
+
/* eslint-disable-next-line @typescript-eslint/no-non-null-assertion */
|
|
966
967
|
setWebChatStyles(styles => ({
|
|
967
968
|
...styles,
|
|
968
969
|
botAvatarInitials: state.domainStates.botAvatarInitials
|
|
@@ -31,7 +31,7 @@ const generateSurveyInviteLink = function (surveyInviteLink, isEmbed, locale, co
|
|
|
31
31
|
return `${surveyInviteLink}&${surveyLinkParams.toString()}`;
|
|
32
32
|
};
|
|
33
33
|
const PostChatSurveyPaneStateful = props => {
|
|
34
|
-
var _props$styleProps, _state$appStates, _props$controlProps;
|
|
34
|
+
var _props$styleProps, _state$appStates, _state$domainStates$p, _props$controlProps;
|
|
35
35
|
(0, _react.useEffect)(() => {
|
|
36
36
|
uiTimer = (0, _utils.createTimer)();
|
|
37
37
|
_TelemetryHelper.TelemetryHelper.logLoadingEventToAllTelemetry(_TelemetryConstants.LogLevel.INFO, {
|
|
@@ -48,13 +48,15 @@ const PostChatSurveyPaneStateful = props => {
|
|
|
48
48
|
});
|
|
49
49
|
let surveyInviteLink = "";
|
|
50
50
|
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;
|
|
51
|
-
if (state.domainStates.postChatContext.botSurveyInviteLink &&
|
|
51
|
+
if ((_state$domainStates$p = state.domainStates.postChatContext) !== null && _state$domainStates$p !== void 0 && _state$domainStates$p.botSurveyInviteLink &&
|
|
52
52
|
// Bot survey enabled
|
|
53
53
|
state.appStates.postChatParticipantType === _Constants.ParticipantType.Bot) {
|
|
54
|
+
var _state$domainStates$p2, _state$domainStates$p3;
|
|
54
55
|
// Only Bot has engaged
|
|
55
|
-
surveyInviteLink = generateSurveyInviteLink(state.domainStates.postChatContext.botSurveyInviteLink, surveyMode, state.domainStates.postChatContext.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
|
|
56
|
+
surveyInviteLink = generateSurveyInviteLink((_state$domainStates$p2 = state.domainStates.postChatContext) === null || _state$domainStates$p2 === void 0 ? void 0 : _state$domainStates$p2.botSurveyInviteLink, surveyMode, (_state$domainStates$p3 = state.domainStates.postChatContext) === null || _state$domainStates$p3 === void 0 ? void 0 : _state$domainStates$p3.botFormsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
|
|
56
57
|
} else {
|
|
57
|
-
|
|
58
|
+
var _state$domainStates$p4, _state$domainStates$p5;
|
|
59
|
+
surveyInviteLink = generateSurveyInviteLink((_state$domainStates$p4 = state.domainStates.postChatContext) === null || _state$domainStates$p4 === void 0 ? void 0 : _state$domainStates$p4.surveyInviteLink, surveyMode, (_state$domainStates$p5 = state.domainStates.postChatContext) === null || _state$domainStates$p5 === void 0 ? void 0 : _state$domainStates$p5.formsProLocale, props.isCustomerVoiceSurveyCompact ?? true, props.customerVoiceSurveyCorrelationId || "");
|
|
58
60
|
}
|
|
59
61
|
if (props.copilotSurveyContext) {
|
|
60
62
|
surveyInviteLink = `${surveyInviteLink}&mcs_additionalcontext=${JSON.stringify(props.copilotSurveyContext)}`;
|
|
@@ -122,7 +122,6 @@ const ProactiveChatPaneStateful = props => {
|
|
|
122
122
|
bodyTitleText: state.appStates.proactiveChatStates.proactiveChatBodyTitle ? state.appStates.proactiveChatStates.proactiveChatBodyTitle : proactiveChatProps === null || proactiveChatProps === void 0 ? void 0 : (_proactiveChatProps$c = proactiveChatProps.controlProps) === null || _proactiveChatProps$c === void 0 ? void 0 : _proactiveChatProps$c.bodyTitleText
|
|
123
123
|
};
|
|
124
124
|
(0, _react.useEffect)(() => {
|
|
125
|
-
(0, _utils.setFocusOnElement)(document.getElementById(controlProps.id + "-startbutton"));
|
|
126
125
|
_TelemetryManager.TelemetryTimers.ProactiveChatScreenTimer = (0, _utils.createTimer)();
|
|
127
126
|
const timeoutEvent = setTimeout(() => {
|
|
128
127
|
handleProactiveChatInviteTimeout();
|