@azure/communication-react 1.14.0-alpha-202403070010 → 1.14.0-alpha-202403080013

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.
Files changed (26) hide show
  1. package/dist/communication-react.d.ts +10 -1
  2. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-DQB5BrFt.js → RichTextSendBoxWrapper-CQnsLK4_.js} +2 -2
  3. package/dist/dist-cjs/communication-react/{RichTextSendBoxWrapper-DQB5BrFt.js.map → RichTextSendBoxWrapper-CQnsLK4_.js.map} +1 -1
  4. package/dist/dist-cjs/communication-react/{index-szH03w3_.js → index--vbi3hW5.js} +46 -29
  5. package/dist/dist-cjs/communication-react/{index-szH03w3_.js.map → index--vbi3hW5.js.map} +1 -1
  6. package/dist/dist-cjs/communication-react/index.js +1 -1
  7. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  8. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  9. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js +14 -5
  10. package/dist/dist-esm/chat-component-bindings/src/messageThreadSelector.js.map +1 -1
  11. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js +4 -4
  12. package/dist/dist-esm/chat-stateful-client/src/ChatContext.js.map +1 -1
  13. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.d.ts +0 -11
  14. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js +19 -47
  15. package/dist/dist-esm/chat-stateful-client/src/ResourceDownloadQueue.js.map +1 -1
  16. package/dist/dist-esm/chat-stateful-client/src/index.d.ts +1 -0
  17. package/dist/dist-esm/chat-stateful-client/src/index.js.map +1 -1
  18. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.d.ts +9 -1
  19. package/dist/dist-esm/chat-stateful-client/src/types/ChatMessageWithStatus.js.map +1 -1
  20. package/dist/dist-esm/communication-react/src/index.d.ts +1 -0
  21. package/dist/dist-esm/communication-react/src/index.js.map +1 -1
  22. package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js +4 -4
  23. package/dist/dist-esm/react-components/src/components/CaptionsSettingsModal.js.map +1 -1
  24. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js +2 -2
  25. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  26. package/package.json +1 -1
@@ -4799,7 +4799,7 @@ export declare type ChatMessageWithStatus = ChatMessage_2 & {
4799
4799
  clientMessageId?: string;
4800
4800
  status: MessageStatus;
4801
4801
  policyViolation?: boolean;
4802
- resourceCache?: Record<string, string>;
4802
+ resourceCache?: Record<string, ResourceFetchResult>;
4803
4803
  };
4804
4804
 
4805
4805
  /**
@@ -9520,6 +9520,15 @@ export declare type ResourceDetails = {
9520
9520
  resourceUrl: string;
9521
9521
  };
9522
9522
 
9523
+ /**
9524
+ * Result of the Resource downloaded from stateful client
9525
+ * @public
9526
+ */
9527
+ export declare type ResourceFetchResult = {
9528
+ sourceUrl: string;
9529
+ error?: Error;
9530
+ };
9531
+
9523
9532
  /**
9524
9533
  * Options for configuring the rich text editor.
9525
9534
  *
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var React = require('react');
4
- var index = require('./index-szH03w3_.js');
4
+ var index = require('./index--vbi3hW5.js');
5
5
  require('@fluentui/react');
6
6
  require('@fluentui/react-file-type-icons');
7
7
  require('@azure/communication-common');
@@ -48,4 +48,4 @@ const RichTextSendBoxWrapper = () => {
48
48
  };
49
49
 
50
50
  exports.RichTextSendBoxWrapper = RichTextSendBoxWrapper;
51
- //# sourceMappingURL=RichTextSendBoxWrapper-DQB5BrFt.js.map
51
+ //# sourceMappingURL=RichTextSendBoxWrapper-CQnsLK4_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextSendBoxWrapper-DQB5BrFt.js","sources":["../../../../react-composites/src/composites/common/RichTextSendBoxWrapper.tsx"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* @conditional-compile-remove(rich-text-editor) */\nimport React from 'react';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { usePropsFor } from '../ChatComposite/hooks/usePropsFor';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { RichTextSendBox } from '@internal/react-components';\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * @private\n *\n * Wrapper for RichTextSendBox component to allow us to use usePropsFor with richTextSendBox\n * before lazyLoading is done\n */\nexport const RichTextSendBoxWrapper = (): JSX.Element => {\n const richTextSendBoxProps = usePropsFor(RichTextSendBox);\n\n return <RichTextSendBox {...richTextSendBoxProps} />;\n};\n"],"names":["usePropsFor","RichTextSendBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAEA;AAOA;AACA;;;;;AAKG;AACI,MAAM,sBAAsB,GAAG,MAAkB;AACtD,IAAA,MAAM,oBAAoB,GAAGA,iBAAW,CAACC,qBAAe,CAAC,CAAC;AAE1D,IAAA,OAAO,KAAC,CAAA,aAAA,CAAAA,qBAAe,EAAK,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,oBAAoB,EAAI,CAAC;AACvD;;;;"}
1
+ {"version":3,"file":"RichTextSendBoxWrapper-CQnsLK4_.js","sources":["../../../../react-composites/src/composites/common/RichTextSendBoxWrapper.tsx"],"sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/* @conditional-compile-remove(rich-text-editor) */\nimport React from 'react';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { usePropsFor } from '../ChatComposite/hooks/usePropsFor';\n/* @conditional-compile-remove(rich-text-editor) */\nimport { RichTextSendBox } from '@internal/react-components';\n\n/* @conditional-compile-remove(rich-text-editor) */\n/**\n * @private\n *\n * Wrapper for RichTextSendBox component to allow us to use usePropsFor with richTextSendBox\n * before lazyLoading is done\n */\nexport const RichTextSendBoxWrapper = (): JSX.Element => {\n const richTextSendBoxProps = usePropsFor(RichTextSendBox);\n\n return <RichTextSendBox {...richTextSendBoxProps} />;\n};\n"],"names":["usePropsFor","RichTextSendBox"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AACA;AAEA;AAOA;AACA;;;;;AAKG;AACI,MAAM,sBAAsB,GAAG,MAAkB;AACtD,IAAA,MAAM,oBAAoB,GAAGA,iBAAW,CAACC,qBAAe,CAAC,CAAC;AAE1D,IAAA,OAAO,KAAC,CAAA,aAAA,CAAAA,qBAAe,EAAK,MAAA,CAAA,MAAA,CAAA,EAAA,EAAA,oBAAoB,EAAI,CAAC;AACvD;;;;"}
@@ -173,7 +173,7 @@ function getDefaultExportFromCjs (x) {
173
173
  // Copyright (c) Microsoft Corporation.
174
174
  // Licensed under the MIT License.
175
175
  // GENERATED FILE. DO NOT EDIT MANUALLY.
176
- var telemetryVersion = '1.14.0-alpha-202403070010';
176
+ var telemetryVersion = '1.14.0-alpha-202403080013';
177
177
 
178
178
 
179
179
  var telemetryVersion$1 = /*@__PURE__*/getDefaultExportFromCjs(telemetryVersion);
@@ -20428,12 +20428,12 @@ const _CaptionsSettingsModal = (props) => {
20428
20428
  const theme = react.useTheme();
20429
20429
  const [hasSetSpokenLanguage, setHasSetSpokenLanguage] = React.useState(false);
20430
20430
  const [selectedSpokenLanguage, setSelectedSpokenLanguage] = React.useState({
20431
- key: currentSpokenLanguage !== null && currentSpokenLanguage !== void 0 ? currentSpokenLanguage : defaultSpokenLanguage,
20432
- text: currentSpokenLanguage !== null && currentSpokenLanguage !== void 0 ? currentSpokenLanguage : defaultSpokenLanguage
20431
+ key: currentSpokenLanguage || defaultSpokenLanguage,
20432
+ text: currentSpokenLanguage || defaultSpokenLanguage
20433
20433
  });
20434
20434
  const [selectedCaptionLanguage, setSelectedCaptionLanguage] = React.useState({
20435
- key: currentCaptionLanguage !== null && currentCaptionLanguage !== void 0 ? currentCaptionLanguage : _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key],
20436
- text: currentCaptionLanguage !== null && currentCaptionLanguage !== void 0 ? currentCaptionLanguage : _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key]
20435
+ key: currentCaptionLanguage || _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key],
20436
+ text: currentCaptionLanguage || _spokenLanguageToCaptionLanguage[selectedSpokenLanguage.key]
20437
20437
  });
20438
20438
  React.useEffect(() => {
20439
20439
  // set spoken language when start captions with a spoken language specified.
@@ -22078,11 +22078,11 @@ const processChatMessageContent = (message) => {
22078
22078
  if (content) {
22079
22079
  const document = new DOMParser().parseFromString(content !== null && content !== void 0 ? content : '', 'text/html');
22080
22080
  document.querySelectorAll('img').forEach((img) => {
22081
- var _a, _b, _c;
22081
+ var _a, _b;
22082
22082
  const attachmentPreviewUrl = (_a = attachments.find((attachment) => attachment.id === img.id)) === null || _a === void 0 ? void 0 : _a.previewUrl;
22083
22083
  if (attachmentPreviewUrl) {
22084
- const src = (_c = (_b = message.resourceCache) === null || _b === void 0 ? void 0 : _b[attachmentPreviewUrl]) !== null && _c !== void 0 ? _c : '';
22085
- img.src = src;
22084
+ const resourceCache = (_b = message.resourceCache) === null || _b === void 0 ? void 0 : _b[attachmentPreviewUrl];
22085
+ img.src = getResourceSourceUrl(resourceCache);
22086
22086
  }
22087
22087
  });
22088
22088
  content = document.body.innerHTML;
@@ -22104,15 +22104,24 @@ const processChatMessageContent = (message) => {
22104
22104
  };
22105
22105
  /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
22106
22106
  const generateImageAttachmentImgHtml = (message, attachment) => {
22107
- var _a, _b;
22107
+ var _a;
22108
22108
  if (attachment.previewUrl !== undefined) {
22109
22109
  const contentType = extractAttachmentContentTypeFromName(attachment.name);
22110
- const src = (_b = (_a = message.resourceCache) === null || _a === void 0 ? void 0 : _a[attachment.previewUrl]) !== null && _b !== void 0 ? _b : '';
22110
+ const resourceCache = (_a = message.resourceCache) === null || _a === void 0 ? void 0 : _a[attachment.previewUrl];
22111
+ const src = getResourceSourceUrl(resourceCache);
22111
22112
  return `\r\n<p><img alt="image" src="${src}" itemscope="${contentType}" id="${attachment.id}"></p>`;
22112
22113
  }
22113
22114
  return '';
22114
22115
  };
22115
22116
  /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
22117
+ const getResourceSourceUrl = (result) => {
22118
+ let src = 'blob://';
22119
+ if (result && result.error === undefined) {
22120
+ src = result.sourceUrl;
22121
+ }
22122
+ return src;
22123
+ };
22124
+ /* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
22116
22125
  const extractAttachmentContentTypeFromName = (name) => {
22117
22126
  if (name === undefined) {
22118
22127
  return '';
@@ -22629,8 +22638,15 @@ class ResourceDownloadQueue {
22629
22638
  }
22630
22639
  downloadSingleUrl(message, resourceUrl, operation) {
22631
22640
  return __awaiter$t(this, void 0, void 0, function* () {
22632
- const blobUrl = yield this.downloadResource(operation, resourceUrl);
22633
- message = Object.assign(Object.assign({}, message), { resourceCache: Object.assign(Object.assign({}, message.resourceCache), { [resourceUrl]: blobUrl }) });
22641
+ const response = { sourceUrl: '' };
22642
+ try {
22643
+ const blobUrl = yield this.downloadResource(operation, resourceUrl);
22644
+ response.sourceUrl = blobUrl;
22645
+ }
22646
+ catch (error) {
22647
+ response.error = error;
22648
+ }
22649
+ message = Object.assign(Object.assign({}, message), { resourceCache: Object.assign(Object.assign({}, message.resourceCache), { [resourceUrl]: response }) });
22634
22650
  return message;
22635
22651
  });
22636
22652
  }
@@ -22644,8 +22660,15 @@ class ResourceDownloadQueue {
22644
22660
  }
22645
22661
  for (const attachment of attachments) {
22646
22662
  if (attachment.previewUrl && attachment.attachmentType === 'image') {
22647
- const blobUrl = yield this.downloadResource(operation, attachment.previewUrl);
22648
- message.resourceCache[attachment.previewUrl] = blobUrl;
22663
+ const response = { sourceUrl: '' };
22664
+ try {
22665
+ const blobUrl = yield this.downloadResource(operation, attachment.previewUrl);
22666
+ response.sourceUrl = blobUrl;
22667
+ }
22668
+ catch (error) {
22669
+ response.error = error;
22670
+ }
22671
+ message.resourceCache[attachment.previewUrl] = response;
22649
22672
  }
22650
22673
  }
22651
22674
  }
@@ -22654,13 +22677,7 @@ class ResourceDownloadQueue {
22654
22677
  }
22655
22678
  downloadResource(operation, url) {
22656
22679
  return __awaiter$t(this, void 0, void 0, function* () {
22657
- let blobUrl = URL.createObjectURL(new Blob());
22658
- try {
22659
- blobUrl = yield operation(url, this._credential);
22660
- }
22661
- catch (error) {
22662
- console.log('Downloading Resource error: ', error);
22663
- }
22680
+ const blobUrl = yield operation(url, this._credential);
22664
22681
  return blobUrl;
22665
22682
  });
22666
22683
  }
@@ -22766,8 +22783,8 @@ let ChatContext$1 = class ChatContext {
22766
22783
  const cache = thread.chatMessages[messageId].resourceCache;
22767
22784
  if (cache) {
22768
22785
  Object.keys(cache).forEach((resourceUrl) => {
22769
- const blobUrl = cache[resourceUrl];
22770
- URL.revokeObjectURL(blobUrl);
22786
+ const resource = cache[resourceUrl];
22787
+ URL.revokeObjectURL(resource.sourceUrl);
22771
22788
  });
22772
22789
  }
22773
22790
  thread.chatMessages[messageId].resourceCache = undefined;
@@ -22799,8 +22816,8 @@ let ChatContext$1 = class ChatContext {
22799
22816
  var _a;
22800
22817
  const message = (_a = draft.threads[threadId]) === null || _a === void 0 ? void 0 : _a.chatMessages[messageId];
22801
22818
  if (message && message.resourceCache) {
22802
- const blobUrl = message.resourceCache[resourceUrl];
22803
- URL.revokeObjectURL(blobUrl);
22819
+ const resource = message.resourceCache[resourceUrl];
22820
+ URL.revokeObjectURL(resource.sourceUrl);
22804
22821
  delete message.resourceCache[resourceUrl];
22805
22822
  }
22806
22823
  });
@@ -25396,7 +25413,7 @@ const useSelector$2 = (selector, selectorProps) => {
25396
25413
  // Copyright (c) Microsoft Corporation.
25397
25414
  // Licensed under the MIT License.
25398
25415
  /* @conditional-compile-remove(rich-text-editor) */
25399
- const RichTextSendBoxWrapper = React.lazy(() => Promise.resolve().then(function () { return require('./RichTextSendBoxWrapper-DQB5BrFt.js'); }).then((module) => ({ default: module.RichTextSendBoxWrapper })));
25416
+ const RichTextSendBoxWrapper = React.lazy(() => Promise.resolve().then(function () { return require('./RichTextSendBoxWrapper-CQnsLK4_.js'); }).then((module) => ({ default: module.RichTextSendBoxWrapper })));
25400
25417
  /**
25401
25418
  * @private
25402
25419
  */
@@ -25477,7 +25494,7 @@ const ChatScreen = (props) => {
25477
25494
  const message = adapter.getState().thread.chatMessages[overlayImageItem === null || overlayImageItem === void 0 ? void 0 : overlayImageItem.messageId];
25478
25495
  const resourceCache = message.resourceCache;
25479
25496
  if (overlayImageItem.imageSrc === '' && resourceCache) {
25480
- const fullSizeImageSrc = resourceCache[overlayImageItem.imageUrl];
25497
+ const fullSizeImageSrc = resourceCache[overlayImageItem.imageUrl].sourceUrl;
25481
25498
  if (fullSizeImageSrc === undefined || fullSizeImageSrc === '' || overlayImageItem.imageSrc === fullSizeImageSrc) {
25482
25499
  return;
25483
25500
  }
@@ -25524,7 +25541,7 @@ const ChatScreen = (props) => {
25524
25541
  let imageSrc = '';
25525
25542
  if (attachment.url) {
25526
25543
  if (resourceCache && resourceCache[attachment.url]) {
25527
- imageSrc = resourceCache[attachment.url];
25544
+ imageSrc = resourceCache[attachment.url].sourceUrl;
25528
25545
  }
25529
25546
  else {
25530
25547
  adapter.downloadResourceToCache({
@@ -38008,4 +38025,4 @@ exports.useTeamsCall = useTeamsCall;
38008
38025
  exports.useTeamsCallAdapter = useTeamsCallAdapter;
38009
38026
  exports.useTeamsCallAgent = useTeamsCallAgent;
38010
38027
  exports.useTheme = useTheme;
38011
- //# sourceMappingURL=index-szH03w3_.js.map
38028
+ //# sourceMappingURL=index--vbi3hW5.js.map