@azure/communication-react 1.13.0-alpha-202402130013 → 1.13.0-alpha-202402150012

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 (19) hide show
  1. package/dist/communication-react.d.ts +10 -10
  2. package/dist/dist-cjs/communication-react/index.js +36 -62
  3. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  5. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  6. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js +8 -12
  7. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js.map +1 -1
  8. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +23 -8
  9. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  10. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +4 -4
  11. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +4 -41
  12. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  13. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +4 -4
  14. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  15. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +1 -1
  16. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  17. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +1 -1
  18. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  19. package/package.json +2 -2
@@ -103,7 +103,7 @@ import { TeamsCall } from '@azure/communication-calling';
103
103
  import { TeamsCallAgent } from '@azure/communication-calling';
104
104
  import { TeamsMeetingLinkLocator } from '@azure/communication-calling';
105
105
  import { Theme } from '@fluentui/react';
106
- import { TransferRequestedEventArgs } from '@azure/communication-calling';
106
+ import { TransferEventArgs } from '@azure/communication-calling';
107
107
  import { TypingIndicatorReceivedEvent } from '@azure/communication-chat';
108
108
  import { UnknownIdentifier } from '@azure/communication-common';
109
109
  import { VideoDeviceInfo } from '@azure/communication-calling';
@@ -1180,7 +1180,7 @@ export declare interface CallAdapterSubscribers {
1180
1180
  /**
1181
1181
  * Subscribe function for 'transferRequested' event.
1182
1182
  */
1183
- on(event: 'transferRequested', listener: TransferRequestedListener): void;
1183
+ on(event: 'transferAccepted', listener: TransferAcceptedListener): void;
1184
1184
  /**
1185
1185
  * Subscribe function for 'capabilitiesChanged' event.
1186
1186
  */
@@ -1260,7 +1260,7 @@ export declare interface CallAdapterSubscribers {
1260
1260
  /**
1261
1261
  * Unsubscribe function for 'transferRequested' event.
1262
1262
  */
1263
- off(event: 'transferRequested', listener: TransferRequestedListener): void;
1263
+ off(event: 'transferAccepted', listener: TransferAcceptedListener): void;
1264
1264
  /**
1265
1265
  * Unsubscribe function for 'capabilitiesChanged' event.
1266
1266
  */
@@ -10396,6 +10396,13 @@ export declare interface TranscriptionCallFeature {
10396
10396
  isTranscriptionActive: boolean;
10397
10397
  }
10398
10398
 
10399
+ /**
10400
+ * Callback for {@link CallAdapterSubscribers} 'transferRequested' event.
10401
+ *
10402
+ * @beta
10403
+ */
10404
+ export declare type TransferAcceptedListener = (event: TransferEventArgs) => void;
10405
+
10399
10406
  /**
10400
10407
  * Transfer feature state
10401
10408
  *
@@ -10410,13 +10417,6 @@ export declare interface TransferFeature {
10410
10417
  };
10411
10418
  }
10412
10419
 
10413
- /**
10414
- * Callback for {@link CallAdapterSubscribers} 'transferRequested' event.
10415
- *
10416
- * @beta
10417
- */
10418
- export declare type TransferRequestedListener = (event: TransferRequestedEventArgs) => void;
10419
-
10420
10420
  /**
10421
10421
  * Component to notify local user when one or more participants in the chat thread are typing.
10422
10422
  *
@@ -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.13.0-alpha-202402130013';
176
+ var telemetryVersion = '1.13.0-alpha-202402150012';
177
177
 
178
178
 
179
179
  var telemetryVersion$1 = /*@__PURE__*/getDefaultExportFromCjs(telemetryVersion);
@@ -4528,21 +4528,17 @@ class ProxyTransferCallFeature {
4528
4528
  switch (prop) {
4529
4529
  case 'on':
4530
4530
  return (...args) => {
4531
- const isTransferRequested = args[0] === 'transferRequested';
4532
- if (isTransferRequested) {
4531
+ const isTransferAccepted = args[0] === 'transferAccepted';
4532
+ if (isTransferAccepted) {
4533
4533
  const listener = args[1];
4534
4534
  const newListener = (args) => {
4535
- const newArgs = Object.assign(Object.assign({}, args), { accept: (acceptOptions) => {
4536
- const acceptedTransferCall = args.accept(acceptOptions);
4537
- this._context.setAcceptedTransfer(this._call.id, {
4538
- callId: acceptedTransferCall.id,
4539
- timestamp: new Date()
4540
- });
4541
- return acceptedTransferCall;
4542
- } });
4543
- listener(newArgs);
4535
+ this._context.setAcceptedTransfer(this._call.id, {
4536
+ callId: args.targetCall.id,
4537
+ timestamp: new Date()
4538
+ });
4539
+ listener(args);
4544
4540
  };
4545
- return target.on('transferRequested', newListener);
4541
+ return target.on('transferAccepted', newListener);
4546
4542
  }
4547
4543
  };
4548
4544
  default:
@@ -10672,21 +10668,36 @@ const generateLiveMessage = (props) => {
10672
10668
  return `${props.message.editedOn ? props.strings.editedTag : ''} ${props.message.mine ? '' : liveAuthor} ${extractContent(props.message.content || '')} `;
10673
10669
  };
10674
10670
  const messageContentAriaText = (props) => {
10675
- // Strip all html tags from the content for aria.
10676
- return props.message.content
10677
- ? props.message.mine
10671
+ if (props.message.content) {
10672
+ // Replace all <img> tags with 'image' for aria.
10673
+ const parsedContent = DOMPurify.sanitize(props.message.content, {
10674
+ ALLOWED_TAGS: ['img'],
10675
+ RETURN_DOM_FRAGMENT: true
10676
+ });
10677
+ parsedContent.childNodes.forEach((child) => {
10678
+ if (child.nodeName.toLowerCase() !== 'img') {
10679
+ return;
10680
+ }
10681
+ const imageTextNode = document.createElement('div');
10682
+ imageTextNode.innerHTML = 'image ';
10683
+ parsedContent.replaceChild(imageTextNode, child);
10684
+ });
10685
+ // Strip all html tags from the content for aria.
10686
+ const message = DOMPurify.sanitize(parsedContent, { ALLOWED_TAGS: [] });
10687
+ return props.message.mine
10678
10688
  ? _formatString(props.strings.messageContentMineAriaText, {
10679
- message: DOMPurify.sanitize(props.message.content, { ALLOWED_TAGS: [] })
10689
+ message: message
10680
10690
  })
10681
10691
  : _formatString(props.strings.messageContentAriaText, {
10682
10692
  author: `${props.message.senderDisplayName}`,
10683
- message: DOMPurify.sanitize(props.message.content, { ALLOWED_TAGS: [] })
10684
- })
10685
- : undefined;
10693
+ message: message
10694
+ });
10695
+ }
10696
+ return undefined;
10686
10697
  };
10687
10698
  /* @conditional-compile-remove(image-overlay) */
10688
10699
  const defaultOnRenderInlineImage = (inlineImage) => {
10689
- return (React.createElement("img", Object.assign({}, inlineImage.imgAttrs, { "data-ui-id": inlineImage.imgAttrs.id, tabIndex: 0, role: "button", style: Object.assign({ cursor: 'pointer' }, inlineImage.imgAttrs.style) })));
10700
+ return React.createElement("img", Object.assign({ tabIndex: 0, "data-ui-id": inlineImage.imgAttrs.id }, inlineImage.imgAttrs));
10690
10701
  };
10691
10702
  const processHtmlToReact = (props) => {
10692
10703
  var _a;
@@ -33443,7 +33454,7 @@ class AzureCommunicationCallAdapter {
33443
33454
  /* @conditional-compile-remove(video-background-effects) */ options, this.targetCallees);
33444
33455
  this.context.onCallEnded((endCallData) => this.emitter.emit('callEnded', endCallData));
33445
33456
  const onStateChange = (clientState) => {
33446
- var _a, _b, _c, _d;
33457
+ var _a, _b, _c;
33447
33458
  // unsubscribe when the instance gets disposed
33448
33459
  if (!this) {
33449
33460
  callClient.offStateChange(onStateChange);
@@ -33465,31 +33476,6 @@ class AzureCommunicationCallAdapter {
33465
33476
  });
33466
33477
  }
33467
33478
  this.context.updateClientState(clientState);
33468
- /* @conditional-compile-remove(call-transfer) */
33469
- const acceptedTransferCallState = this.context.getState().acceptedTransferCallState;
33470
- /* @conditional-compile-remove(call-transfer) */
33471
- // TODO: Remove this if statement when Calling SDK prevents accepting transfer requests that have timed out
33472
- // This is to handle the case when there has been an accepted transfer call that is now in the connected state
33473
- // AND is not the current call. Ensure we leave the current call.
33474
- if (acceptedTransferCallState &&
33475
- acceptedTransferCallState.state === 'Connected' &&
33476
- ((_d = this.call) === null || _d === void 0 ? void 0 : _d.id) &&
33477
- acceptedTransferCallState.id !== this.call.id) {
33478
- const cAgent = callAgent;
33479
- const transferCall = cAgent.calls.find((call) => call.id === acceptedTransferCallState.id);
33480
- if (transferCall) {
33481
- const oldCall = this.call;
33482
- this.processNewCall(transferCall);
33483
- // Arbitrary wait time before hanging up. 2 seconds is derived from manual testing. This is to allow
33484
- // transferor to hang up themselves. If the transferor has not hung up, we hang up because we are now
33485
- // in the transfer call
33486
- setTimeout(() => {
33487
- if ((oldCall === null || oldCall === void 0 ? void 0 : oldCall.state) === 'Connected') {
33488
- oldCall.hangUp();
33489
- }
33490
- }, 2000);
33491
- }
33492
- }
33493
33479
  };
33494
33480
  this.handlers = createHandlers(callClient, callAgent, deviceManager, undefined,
33495
33481
  /* @conditional-compile-remove(video-background-effects) */ {
@@ -34133,7 +34119,7 @@ class AzureCommunicationCallAdapter {
34133
34119
  /* @conditional-compile-remove(rooms) */
34134
34120
  (_f = this.call) === null || _f === void 0 ? void 0 : _f.on('roleChanged', this.roleChanged.bind(this));
34135
34121
  /* @conditional-compile-remove(call-transfer) */
34136
- (_g = this.call) === null || _g === void 0 ? void 0 : _g.feature(communicationCalling.Features.Transfer).on('transferRequested', this.transferRequested.bind(this));
34122
+ (_g = this.call) === null || _g === void 0 ? void 0 : _g.feature(communicationCalling.Features.Transfer).on('transferAccepted', this.transferAccepted.bind(this));
34137
34123
  /* @conditional-compile-remove(capabilities) */
34138
34124
  (_h = this.call) === null || _h === void 0 ? void 0 : _h.feature(communicationCalling.Features.Capabilities).on('capabilitiesChanged', this.capabilitiesChanged.bind(this));
34139
34125
  /* @conditional-compile-remove(spotlight) */
@@ -34207,20 +34193,8 @@ class AzureCommunicationCallAdapter {
34207
34193
  });
34208
34194
  }
34209
34195
  /* @conditional-compile-remove(call-transfer) */
34210
- transferRequested(args) {
34211
- const newArgs = Object.assign(Object.assign({}, args), { accept: (options) => {
34212
- var _a, _b, _c, _d, _e, _f;
34213
- const videoSource = (_c = (_b = (_a = this.context.getState().call) === null || _a === void 0 ? void 0 : _a.localVideoStreams) === null || _b === void 0 ? void 0 : _b[0]) === null || _c === void 0 ? void 0 : _c.source;
34214
- args.accept({
34215
- audioOptions: (_d = options === null || options === void 0 ? void 0 : options.audioOptions) !== null && _d !== void 0 ? _d : {
34216
- muted: !!((_e = this.context.getState().call) === null || _e === void 0 ? void 0 : _e.isMuted)
34217
- },
34218
- videoOptions: (_f = options === null || options === void 0 ? void 0 : options.videoOptions) !== null && _f !== void 0 ? _f :
34219
- /* maintain video state if options.videoOptions is not defined */
34220
- (videoSource ? { localVideoStreams: [new communicationCalling.LocalVideoStream(videoSource)] } : undefined)
34221
- });
34222
- } });
34223
- this.emitter.emit('transferRequested', newArgs);
34196
+ transferAccepted(args) {
34197
+ this.emitter.emit('transferAccepted', args);
34224
34198
  }
34225
34199
  /* @conditional-compile-remove(capabilities) */
34226
34200
  capabilitiesChanged(data) {