@microsoft/omnichannel-chat-widget 1.7.7 → 1.7.8-main.2e1cc2b
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/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +7 -1
- package/lib/cjs/plugins/createChatTranscript.js +1 -1
- package/lib/esm/components/webchatcontainerstateful/webchatcontroller/middlewares/storemiddlewares/htmlTextMiddleware.js +7 -1
- package/lib/esm/plugins/createChatTranscript.js +1 -1
- package/package.json +1 -1
|
@@ -41,6 +41,7 @@ const convertTextToHtmlNode = text => {
|
|
|
41
41
|
|
|
42
42
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
43
43
|
const processHTMLText = (action, text, honorsTargetInHTMLLinks) => {
|
|
44
|
+
var _htmlNode$tagName;
|
|
44
45
|
const htmlNode = convertTextToHtmlNode(text);
|
|
45
46
|
const aNodes = htmlNode.getElementsByTagName(_Constants.HtmlAttributeNames.aTagName);
|
|
46
47
|
if ((aNodes === null || aNodes === void 0 ? void 0 : aNodes.length) > 0) {
|
|
@@ -70,6 +71,7 @@ const processHTMLText = (action, text, honorsTargetInHTMLLinks) => {
|
|
|
70
71
|
}
|
|
71
72
|
}
|
|
72
73
|
}
|
|
74
|
+
action = (0, _simpleUpdateIn.default)(action, [_Constants.Constants.payload, _Constants.Constants.activity, _Constants.Constants.text], () => htmlNode.innerHTML);
|
|
73
75
|
} catch (e) {
|
|
74
76
|
let errorMessage = "Failed to apply action: ";
|
|
75
77
|
try {
|
|
@@ -86,7 +88,11 @@ const processHTMLText = (action, text, honorsTargetInHTMLLinks) => {
|
|
|
86
88
|
});
|
|
87
89
|
}
|
|
88
90
|
}
|
|
89
|
-
|
|
91
|
+
|
|
92
|
+
// if empty div tag after sanitization
|
|
93
|
+
if (((_htmlNode$tagName = htmlNode.tagName) === null || _htmlNode$tagName === void 0 ? void 0 : _htmlNode$tagName.toLowerCase()) === _Constants.HtmlAttributeNames.div && htmlNode.children.length === 0 && htmlNode.innerHTML.trim() === "") {
|
|
94
|
+
action = (0, _simpleUpdateIn.default)(action, [_Constants.Constants.payload, _Constants.Constants.activity, _Constants.Constants.text], () => "");
|
|
95
|
+
}
|
|
90
96
|
return action;
|
|
91
97
|
};
|
|
92
98
|
|
|
@@ -677,7 +677,7 @@ const createChatTranscript = async function (transcript, facadeChatSDK) {
|
|
|
677
677
|
};
|
|
678
678
|
let messages = transcriptMessages.filter(message => {
|
|
679
679
|
message.content = _dompurify.default.sanitize(message.content);
|
|
680
|
-
return message
|
|
680
|
+
return message;
|
|
681
681
|
});
|
|
682
682
|
if (renderAttachments) {
|
|
683
683
|
messages = await Promise.all(transcriptMessages.map(async message => {
|
|
@@ -35,6 +35,7 @@ const convertTextToHtmlNode = text => {
|
|
|
35
35
|
|
|
36
36
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
37
37
|
const processHTMLText = (action, text, honorsTargetInHTMLLinks) => {
|
|
38
|
+
var _htmlNode$tagName;
|
|
38
39
|
const htmlNode = convertTextToHtmlNode(text);
|
|
39
40
|
const aNodes = htmlNode.getElementsByTagName(HtmlAttributeNames.aTagName);
|
|
40
41
|
if ((aNodes === null || aNodes === void 0 ? void 0 : aNodes.length) > 0) {
|
|
@@ -64,6 +65,7 @@ const processHTMLText = (action, text, honorsTargetInHTMLLinks) => {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
}
|
|
68
|
+
action = updateIn(action, [Constants.payload, Constants.activity, Constants.text], () => htmlNode.innerHTML);
|
|
67
69
|
} catch (e) {
|
|
68
70
|
let errorMessage = "Failed to apply action: ";
|
|
69
71
|
try {
|
|
@@ -80,7 +82,11 @@ const processHTMLText = (action, text, honorsTargetInHTMLLinks) => {
|
|
|
80
82
|
});
|
|
81
83
|
}
|
|
82
84
|
}
|
|
83
|
-
|
|
85
|
+
|
|
86
|
+
// if empty div tag after sanitization
|
|
87
|
+
if (((_htmlNode$tagName = htmlNode.tagName) === null || _htmlNode$tagName === void 0 ? void 0 : _htmlNode$tagName.toLowerCase()) === HtmlAttributeNames.div && htmlNode.children.length === 0 && htmlNode.innerHTML.trim() === "") {
|
|
88
|
+
action = updateIn(action, [Constants.payload, Constants.activity, Constants.text], () => "");
|
|
89
|
+
}
|
|
84
90
|
return action;
|
|
85
91
|
};
|
|
86
92
|
|
|
@@ -672,7 +672,7 @@ const createChatTranscript = async function (transcript, facadeChatSDK) {
|
|
|
672
672
|
};
|
|
673
673
|
let messages = transcriptMessages.filter(message => {
|
|
674
674
|
message.content = DOMPurify.sanitize(message.content);
|
|
675
|
-
return message
|
|
675
|
+
return message;
|
|
676
676
|
});
|
|
677
677
|
if (renderAttachments) {
|
|
678
678
|
messages = await Promise.all(transcriptMessages.map(async message => {
|