@azure/communication-react 1.11.1-alpha-202401100012 → 1.11.1-alpha-202401110013
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/dist/dist-cjs/communication-react/index.js +52 -73
- package/dist/dist-cjs/communication-react/index.js.map +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
- package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/errorBarSelector.js +5 -4
- package/dist/dist-esm/chat-component-bindings/src/errorBarSelector.js.map +1 -1
- package/dist/dist-esm/chat-component-bindings/src/hooks/usePropsFor.js.map +1 -1
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +46 -69
- package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
- package/package.json +2 -2
@@ -17,7 +17,7 @@ var reactFileTypeIcons = require('@fluentui/react-file-type-icons');
|
|
17
17
|
var uuid = require('uuid');
|
18
18
|
var reactChat = require('@fluentui-contrib/react-chat');
|
19
19
|
var react$1 = require('@griffel/react');
|
20
|
-
var
|
20
|
+
var parse = require('html-react-parser');
|
21
21
|
var Linkify = require('react-linkify');
|
22
22
|
var DOMPurify = require('dompurify');
|
23
23
|
var reactHooks = require('@fluentui/react-hooks');
|
@@ -170,7 +170,7 @@ function getDefaultExportFromCjs (x) {
|
|
170
170
|
// Copyright (c) Microsoft Corporation.
|
171
171
|
// Licensed under the MIT License.
|
172
172
|
// GENERATED FILE. DO NOT EDIT MANUALLY.
|
173
|
-
var telemetryVersion = '1.11.1-alpha-
|
173
|
+
var telemetryVersion = '1.11.1-alpha-202401110013';
|
174
174
|
|
175
175
|
|
176
176
|
var telemetryVersion$1 = /*@__PURE__*/getDefaultExportFromCjs(telemetryVersion);
|
@@ -10413,76 +10413,54 @@ const messageContentAriaText = (props) => {
|
|
10413
10413
|
})
|
10414
10414
|
: undefined;
|
10415
10415
|
};
|
10416
|
-
const processNodeDefinitions = htmlToReact.ProcessNodeDefinitions();
|
10417
|
-
const htmlToReactParser = htmlToReact.Parser();
|
10418
|
-
const processInlineImage = (props) => ({
|
10419
|
-
// Custom <img> processing
|
10420
|
-
shouldProcessNode: (node) => {
|
10421
|
-
var _a;
|
10422
|
-
function matchingImageNode(imageMetadata) {
|
10423
|
-
return imageMetadata.id === node.attribs.id;
|
10424
|
-
}
|
10425
|
-
// Process img node with id in attachments list
|
10426
|
-
return (node.name &&
|
10427
|
-
node.name === 'img' &&
|
10428
|
-
node.attribs &&
|
10429
|
-
node.attribs.id &&
|
10430
|
-
((_a = props.message.inlineImages) === null || _a === void 0 ? void 0 : _a.find(matchingImageNode)));
|
10431
|
-
},
|
10432
|
-
processNode: (node, children, index) => {
|
10433
|
-
node.attribs = Object.assign(Object.assign({}, node.attribs), { 'aria-label': node.attribs.name });
|
10434
|
-
// logic to check id in map/list
|
10435
|
-
if (props.attachmentsMap && node.attribs.id in props.attachmentsMap) {
|
10436
|
-
node.attribs = Object.assign(Object.assign({}, node.attribs), { src: props.attachmentsMap[node.attribs.id] });
|
10437
|
-
}
|
10438
|
-
const handleOnClick = () => {
|
10439
|
-
props.onInlineImageClicked && props.onInlineImageClicked(node.attribs.id);
|
10440
|
-
};
|
10441
|
-
return (React.createElement("span", { "data-ui-id": node.attribs.id, onClick: handleOnClick, tabIndex: 0, role: "button", style: {
|
10442
|
-
cursor: 'pointer'
|
10443
|
-
}, onKeyDown: (e) => {
|
10444
|
-
if (e.key === 'Enter') {
|
10445
|
-
handleOnClick();
|
10446
|
-
}
|
10447
|
-
} }, processNodeDefinitions.processDefaultNode(node, children, index)));
|
10448
|
-
}
|
10449
|
-
});
|
10450
|
-
/* @conditional-compile-remove(mention) */
|
10451
|
-
const processMention = (props) => ({
|
10452
|
-
shouldProcessNode: (node) => {
|
10453
|
-
var _a;
|
10454
|
-
if ((_a = props.mentionDisplayOptions) === null || _a === void 0 ? void 0 : _a.onRenderMention) {
|
10455
|
-
// Override the handling of the <msft-mention> tag in the HTML if there's a custom renderer
|
10456
|
-
return node.name === 'msft-mention';
|
10457
|
-
}
|
10458
|
-
return false;
|
10459
|
-
},
|
10460
|
-
processNode: (node) => {
|
10461
|
-
var _a, _b, _c;
|
10462
|
-
if ((_a = props.mentionDisplayOptions) === null || _a === void 0 ? void 0 : _a.onRenderMention) {
|
10463
|
-
const { id } = node.attribs;
|
10464
|
-
const mention = {
|
10465
|
-
id: id,
|
10466
|
-
displayText: (_c = (_b = node.children[0]) === null || _b === void 0 ? void 0 : _b.data) !== null && _c !== void 0 ? _c : ''
|
10467
|
-
};
|
10468
|
-
return props.mentionDisplayOptions.onRenderMention(mention, defaultOnMentionRender);
|
10469
|
-
}
|
10470
|
-
return processNodeDefinitions.processDefaultNode;
|
10471
|
-
}
|
10472
|
-
});
|
10473
10416
|
const processHtmlToReact = (props) => {
|
10474
10417
|
var _a;
|
10475
|
-
const
|
10476
|
-
|
10477
|
-
|
10478
|
-
|
10479
|
-
|
10480
|
-
|
10481
|
-
|
10482
|
-
|
10418
|
+
const options = {
|
10419
|
+
transform(reactNode, domNode) {
|
10420
|
+
var _a, _b, _c;
|
10421
|
+
if (domNode instanceof parse.Element && domNode.attribs) {
|
10422
|
+
// Transform custom rendering of mentions
|
10423
|
+
/* @conditional-compile-remove(mention) */
|
10424
|
+
if (((_a = props.mentionDisplayOptions) === null || _a === void 0 ? void 0 : _a.onRenderMention) && domNode.name === 'msft-mention') {
|
10425
|
+
const { id } = domNode.attribs;
|
10426
|
+
const mention = {
|
10427
|
+
id: id,
|
10428
|
+
displayText: (_b = domNode.children[0].nodeValue) !== null && _b !== void 0 ? _b : ''
|
10429
|
+
};
|
10430
|
+
return props.mentionDisplayOptions.onRenderMention(mention, defaultOnMentionRender);
|
10431
|
+
}
|
10432
|
+
// Transform inline images
|
10433
|
+
if (domNode.name &&
|
10434
|
+
domNode.name === 'img' &&
|
10435
|
+
domNode.attribs &&
|
10436
|
+
domNode.attribs.id &&
|
10437
|
+
((_c = props.message.inlineImages) === null || _c === void 0 ? void 0 : _c.find((metadata) => {
|
10438
|
+
return metadata.id === domNode.attribs.id;
|
10439
|
+
}))) {
|
10440
|
+
domNode.attribs['aria-label'] = domNode.attribs.name;
|
10441
|
+
// logic to check id in map/list
|
10442
|
+
if (props.attachmentsMap && domNode.attribs.id in props.attachmentsMap) {
|
10443
|
+
domNode.attribs.src = props.attachmentsMap[domNode.attribs.id];
|
10444
|
+
}
|
10445
|
+
const handleOnClick = () => {
|
10446
|
+
props.onInlineImageClicked && props.onInlineImageClicked(domNode.attribs.id);
|
10447
|
+
};
|
10448
|
+
const imgProps = parse.attributesToProps(domNode.attribs);
|
10449
|
+
return (React.createElement("span", { "data-ui-id": domNode.attribs.id, onClick: handleOnClick, tabIndex: 0, role: "button", style: {
|
10450
|
+
cursor: 'pointer'
|
10451
|
+
}, onKeyDown: (e) => {
|
10452
|
+
if (e.key === 'Enter') {
|
10453
|
+
handleOnClick();
|
10454
|
+
}
|
10455
|
+
} },
|
10456
|
+
React.createElement("img", Object.assign({}, imgProps))));
|
10457
|
+
}
|
10458
|
+
}
|
10459
|
+
// Pass through the original node
|
10460
|
+
return reactNode;
|
10483
10461
|
}
|
10484
|
-
|
10485
|
-
return
|
10462
|
+
};
|
10463
|
+
return React.createElement(React.Fragment, null, parse((_a = props.message.content) !== null && _a !== void 0 ? _a : '', options));
|
10486
10464
|
};
|
10487
10465
|
|
10488
10466
|
// Copyright (c) Microsoft Corporation.
|
@@ -21007,12 +20985,12 @@ const accessErrorTargets = [
|
|
21007
20985
|
];
|
21008
20986
|
const latestUnableToReachChatServiceError = (latestErrors) => {
|
21009
20987
|
return latestActiveErrorSatisfying(latestErrors, 'unableToReachChatService', (error) => {
|
21010
|
-
return !!error && !!error.innerError && error.innerError
|
20988
|
+
return (!!error && !!error.innerError && 'code' in error.innerError && error.innerError.code === 'REQUEST_SEND_ERROR');
|
21011
20989
|
});
|
21012
20990
|
};
|
21013
20991
|
const latestAccessDeniedError = (latestErrors) => {
|
21014
20992
|
return latestActiveErrorSatisfying(latestErrors, 'accessDenied', (error) => {
|
21015
|
-
return !!error && !!error.innerError && error.innerError
|
20993
|
+
return !!error && !!error.innerError && 'statusCode' in error.innerError && error.innerError.statusCode === 401;
|
21016
20994
|
});
|
21017
20995
|
};
|
21018
20996
|
const latestNotInThisThreadError = (latestErrors) => {
|
@@ -21029,11 +21007,12 @@ const latestNotInThisThreadError = (latestErrors) => {
|
|
21029
21007
|
}
|
21030
21008
|
// Chat service returns 403 if a user has been removed from a thread.
|
21031
21009
|
// Chat service returns either 400 or 404 if the thread ID is malformed, depending on how the thread ID is malformed.
|
21032
|
-
return [400, 403, 404].some((statusCode) => error.innerError
|
21010
|
+
return [400, 403, 404].some((statusCode) => 'statusCode' in error.innerError && error.innerError.statusCode === statusCode);
|
21033
21011
|
});
|
21034
21012
|
};
|
21035
21013
|
const botContactMRIPrefix = '28:';
|
21036
|
-
const isErrorDueToBotContact = (error) =>
|
21014
|
+
const isErrorDueToBotContact = (error) => 'statusCode' in error.innerError &&
|
21015
|
+
error.innerError.statusCode === 400 &&
|
21037
21016
|
error.innerError.message.includes(`Identifier format is not supported (${botContactMRIPrefix}`);
|
21038
21017
|
const latestActiveErrorSatisfying = (errors, activeErrorType, predicate) => {
|
21039
21018
|
const activeErrorMessages = [];
|