@azure/communication-react 1.5.1-alpha-202306010016 → 1.5.1-alpha-202306020014

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 +21 -1
  2. package/dist/dist-cjs/communication-react/index.js +79 -14
  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/react-components/src/components/ChatMessage/MentionRenderer.js +1 -1
  7. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js.map +1 -1
  8. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js +6 -10
  9. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -1
  10. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +5 -1
  11. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +71 -2
  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 +19 -0
  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 -0
  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 -0
  18. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  19. package/package.json +8 -8
@@ -94,6 +94,7 @@ import { TeamsCall } from '@azure/communication-calling';
94
94
  import { TeamsCallAgent } from '@azure/communication-calling';
95
95
  import { TeamsMeetingLinkLocator } from '@azure/communication-calling';
96
96
  import { Theme } from '@fluentui/react';
97
+ import { TransferRequestedEventArgs } from '@azure/communication-calling';
97
98
  import { TypingIndicatorReceivedEvent } from '@azure/communication-chat';
98
99
  import { UnknownIdentifier } from '@azure/communication-common';
99
100
  import { UnknownIdentifierKind } from '@azure/communication-common';
@@ -863,6 +864,10 @@ export declare type CallAdapterClientState = {
863
864
  * State to track the selected video background effect.
864
865
  */
865
866
  selectedVideoBackgroundEffect?: SelectedVideoBackgroundEffect;
867
+ /**
868
+ * Call from transfer request accepted by local user
869
+ */
870
+ acceptedTransferCallState?: CallState;
866
871
  };
867
872
 
868
873
  /**
@@ -1032,6 +1037,10 @@ export declare interface CallAdapterSubscribers {
1032
1037
  * Subscribe function for 'isCaptionsActiveChanged' event.
1033
1038
  */
1034
1039
  on(event: 'isCaptionsActiveChanged', listener: IsCaptionsActiveChangedListener): void;
1040
+ /**
1041
+ * Subscribe function for 'transferRequested' event.
1042
+ */
1043
+ on(event: 'transferRequested', listener: TransferRequestedListener): void;
1035
1044
  /**
1036
1045
  * Unsubscribe function for 'participantsJoined' event.
1037
1046
  */
@@ -1088,6 +1097,10 @@ export declare interface CallAdapterSubscribers {
1088
1097
  * Unsubscribe function for 'isCaptionsActiveChanged' event.
1089
1098
  */
1090
1099
  off(event: 'isCaptionsActiveChanged', listener: IsCaptionsActiveChangedListener): void;
1100
+ /**
1101
+ * Unsubscribe function for 'transferRequested' event.
1102
+ */
1103
+ off(event: 'transferRequested', listener: TransferRequestedListener): void;
1091
1104
  }
1092
1105
 
1093
1106
  /**
@@ -8407,7 +8420,7 @@ export declare interface TeamsCallAdapter extends CommonCallAdapter {
8407
8420
  export declare type TeamsCallAdapterArgs = {
8408
8421
  userId: MicrosoftTeamsUserIdentifier;
8409
8422
  credential: CommunicationTokenCredential;
8410
- locator: TeamsMeetingLinkLocator;
8423
+ locator: TeamsMeetingLinkLocator | /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator;
8411
8424
  /**
8412
8425
  * Optional parameters for the {@link TeamsCallAdapter} created
8413
8426
  */
@@ -8485,6 +8498,13 @@ export declare interface TransferFeature {
8485
8498
  };
8486
8499
  }
8487
8500
 
8501
+ /**
8502
+ * Callback for {@link CallAdapterSubscribers} 'isCaptionsActiveChanged' event.
8503
+ *
8504
+ * @beta
8505
+ */
8506
+ export declare type TransferRequestedListener = (event: TransferRequestedEventArgs) => void;
8507
+
8488
8508
  /**
8489
8509
  * Component to notify local user when one or more participants in the chat thread are typing.
8490
8510
  *
@@ -167,7 +167,7 @@ const _toCommunicationIdentifier = (id) => {
167
167
  // Copyright (c) Microsoft Corporation.
168
168
  // Licensed under the MIT license.
169
169
  // GENERATED FILE. DO NOT EDIT MANUALLY.
170
- var telemetryVersion = '1.5.1-alpha-202306010016';
170
+ var telemetryVersion = '1.5.1-alpha-202306020014';
171
171
 
172
172
  // Copyright (c) Microsoft Corporation.
173
173
  /**
@@ -6366,12 +6366,6 @@ const InputBoxComponent = (props) => {
6366
6366
  updateMentionSuggestions(suggestions);
6367
6367
  }), 500);
6368
6368
  /* @conditional-compile-remove(mention) */
6369
- React.useEffect(() => {
6370
- return () => {
6371
- debouncedQueryUpdate.cancel();
6372
- };
6373
- }, [debouncedQueryUpdate]);
6374
- /* @conditional-compile-remove(mention) */
6375
6369
  // Update selections index in mention to navigate by words
6376
6370
  const updateSelectionIndexesWithMentionIfNeeded = React.useCallback((event, inputTextValue, selectionStartValue, selectionEndValue, tagsValue) => {
6377
6371
  var _a, _b, _c;
@@ -6496,6 +6490,7 @@ const InputBoxComponent = (props) => {
6496
6490
  /* @conditional-compile-remove(mention) */
6497
6491
  const handleOnChange = React.useCallback((event, tagsValue, htmlTextValue, inputTextValue, currentTriggerStartIndex, previousSelectionStart, previousSelectionEnd, currentSelectionStart, currentSelectionEnd, updatedValue) => __awaiter$w(void 0, void 0, void 0, function* () {
6498
6492
  var _b;
6493
+ debouncedQueryUpdate.cancel();
6499
6494
  if (event.currentTarget === null) {
6500
6495
  return;
6501
6496
  }
@@ -6717,8 +6712,10 @@ const InputBoxComponent = (props) => {
6717
6712
  setCaretIndex(undefined);
6718
6713
  setSelectionStartValue(null);
6719
6714
  setSelectionEndValue(null);
6720
- // Dismiss the suggestions on blur
6721
- setMentionSuggestions([]);
6715
+ // Dismiss the suggestions on blur, after enough time to select by mouse if needed
6716
+ setTimeout(() => {
6717
+ setMentionSuggestions([]);
6718
+ }, 200);
6722
6719
  }, autoComplete: "off", onKeyDown: onTextFieldKeyDown, styles: mergedTextFieldStyle, disabled: disabled, errorMessage: errorMessage, onRenderSuffix: onRenderChildren, elementRef: inputBoxRef }))));
6723
6720
  };
6724
6721
  /**
@@ -7358,9 +7355,8 @@ const findStringsDiffIndexes = (props) => {
7358
7355
  */
7359
7356
  const htmlStringForMentionSuggestion = (suggestion, localeStrings) => {
7360
7357
  const idHTML = ' id ="' + suggestion.id + '"';
7361
- const displayTextHTML = ' displayText ="' + suggestion.displayText + '"';
7362
7358
  const displayText = getDisplayNameForMentionSuggestion(suggestion, localeStrings);
7363
- return '<' + MSFT_MENTION_TAG + idHTML + displayTextHTML + '>' + displayText + '</' + MSFT_MENTION_TAG + '>';
7359
+ return '<' + MSFT_MENTION_TAG + idHTML + '>' + displayText + '</' + MSFT_MENTION_TAG + '>';
7364
7360
  };
7365
7361
  /* @conditional-compile-remove(mention) */
7366
7362
  /**
@@ -8771,7 +8767,7 @@ const preventUnwantedDismissProps = {
8771
8767
  const defaultOnMentionRender = (mention) => {
8772
8768
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8773
8769
  const MsftMention = 'msft-mention';
8774
- return (React__default['default'].createElement(MsftMention, { id: mention.id, displayText: mention.displayText }, mention.displayText));
8770
+ return React__default['default'].createElement(MsftMention, { id: mention.id }, mention.displayText);
8775
8771
  };
8776
8772
 
8777
8773
  // Copyright (c) Microsoft Corporation.
@@ -26340,11 +26336,18 @@ class CallContext {
26340
26336
  // Make sure that the call is set to undefined in the state.
26341
26337
  call = undefined;
26342
26338
  }
26339
+ /* @conditional-compile-remove(call-transfer) */
26340
+ const latestAcceptedTransfer = (call === null || call === void 0 ? void 0 : call.transferFeature.acceptedTransfers)
26341
+ ? findLatestAcceptedTransfer(call.transferFeature.acceptedTransfers)
26342
+ : undefined;
26343
+ /* @conditional-compile-remove(call-transfer) */
26344
+ const transferCall = latestAcceptedTransfer ? clientState.calls[latestAcceptedTransfer.callId] : undefined;
26343
26345
  if (this.state.page) {
26344
26346
  this.setState(Object.assign(Object.assign({}, this.state), { userId: clientState.userId, displayName: (_a = clientState.callAgent) === null || _a === void 0 ? void 0 : _a.displayName, call, page: newPage, endedCall: latestEndedCall, devices: clientState.deviceManager, latestErrors: clientState.latestErrors, cameraStatus: (call === null || call === void 0 ? void 0 : call.localVideoStreams.find((s) => s.mediaStreamType === 'Video')) ||
26345
26347
  clientState.deviceManager.unparentedViews.find((s) => s.mediaStreamType === 'Video')
26346
26348
  ? 'On'
26347
- : 'Off' }));
26349
+ : 'Off',
26350
+ /* @conditional-compile-remove(call-transfer) */ acceptedTransferCallState: transferCall }));
26348
26351
  }
26349
26352
  }
26350
26353
  /* @conditional-compile-remove(unsupported-browser) */
@@ -26359,6 +26362,10 @@ class CallContext {
26359
26362
  setSelectedVideoBackgroundEffect(selectedVideoBackgroundEffect) {
26360
26363
  this.setState(Object.assign(Object.assign({}, this.state), { selectedVideoBackgroundEffect }));
26361
26364
  }
26365
+ /* @conditional-compile-remove(call-transfer) */
26366
+ setAcceptedTransferCall(call) {
26367
+ this.setState(Object.assign(Object.assign({}, this.state), { acceptedTransferCallState: call }));
26368
+ }
26362
26369
  }
26363
26370
  const findLatestEndedCall = (calls) => {
26364
26371
  var _a, _b, _c, _d;
@@ -26374,6 +26381,21 @@ const findLatestEndedCall = (calls) => {
26374
26381
  }
26375
26382
  return latestCall;
26376
26383
  };
26384
+ /* @conditional-compile-remove(call-transfer) */
26385
+ const findLatestAcceptedTransfer = (acceptedTransfers) => {
26386
+ var _a, _b, _c, _d;
26387
+ const acceptedTransferValues = Object.values(acceptedTransfers);
26388
+ if (acceptedTransferValues.length === 0) {
26389
+ return undefined;
26390
+ }
26391
+ let latestAcceptedTransfer = acceptedTransferValues[0];
26392
+ for (const acceptedTransfer of acceptedTransferValues.slice(1)) {
26393
+ if (((_b = (_a = acceptedTransfer.timestamp) === null || _a === void 0 ? void 0 : _a.getTime()) !== null && _b !== void 0 ? _b : 0) > ((_d = (_c = latestAcceptedTransfer.timestamp) === null || _c === void 0 ? void 0 : _c.getTime()) !== null && _d !== void 0 ? _d : 0)) {
26394
+ latestAcceptedTransfer = acceptedTransfer;
26395
+ }
26396
+ }
26397
+ return latestAcceptedTransfer;
26398
+ };
26377
26399
  /**
26378
26400
  * @private
26379
26401
  */
@@ -26425,6 +26447,43 @@ class AzureCommunicationCallAdapter {
26425
26447
  this.onClientStateChange = onStateChange;
26426
26448
  this.subscribeDeviceManagerEvents();
26427
26449
  this.callClient.onStateChange(onStateChange);
26450
+ /* @conditional-compile-remove(call-transfer) */
26451
+ if (this.callAgent.kind === 'CallAgent') {
26452
+ const onCallsUpdated = (args) => {
26453
+ var _a;
26454
+ if ((_a = this.call) === null || _a === void 0 ? void 0 : _a.id) {
26455
+ const removedCall = args.removed.find((call) => { var _a; return call.id === ((_a = this.call) === null || _a === void 0 ? void 0 : _a.id); });
26456
+ if (removedCall) {
26457
+ const removedCallState = this.callClient.getState().callsEnded[removedCall.id];
26458
+ const latestAcceptedTransfer = findLatestAcceptedTransfer(removedCallState.transferFeature.acceptedTransfers);
26459
+ const _callAgent = callAgent;
26460
+ const transferCall = _callAgent.calls.find((call) => call.id === (latestAcceptedTransfer === null || latestAcceptedTransfer === void 0 ? void 0 : latestAcceptedTransfer.callId));
26461
+ if (transferCall) {
26462
+ this.processNewCall(transferCall);
26463
+ }
26464
+ }
26465
+ }
26466
+ };
26467
+ this.callAgent.on('callsUpdated', onCallsUpdated);
26468
+ }
26469
+ else if (this.callAgent.kind === 'TeamsCallAgent') {
26470
+ const onTeamsCallsUpdated = (args) => {
26471
+ var _a;
26472
+ if ((_a = this.call) === null || _a === void 0 ? void 0 : _a.id) {
26473
+ const removedCall = args.removed.find((call) => { var _a; return call.id === ((_a = this.call) === null || _a === void 0 ? void 0 : _a.id); });
26474
+ if (removedCall) {
26475
+ const removedCallState = this.callClient.getState().callsEnded[removedCall.id];
26476
+ const latestAcceptedTransfer = findLatestAcceptedTransfer(removedCallState.transferFeature.acceptedTransfers);
26477
+ const _callAgent = callAgent;
26478
+ const transferCall = _callAgent.calls.find((call) => call.id === (latestAcceptedTransfer === null || latestAcceptedTransfer === void 0 ? void 0 : latestAcceptedTransfer.callId));
26479
+ if (transferCall) {
26480
+ this.processNewCall(transferCall);
26481
+ }
26482
+ }
26483
+ }
26484
+ };
26485
+ this.callAgent.on('callsUpdated', onTeamsCallsUpdated);
26486
+ }
26428
26487
  }
26429
26488
  get call() {
26430
26489
  return this._call;
@@ -26870,13 +26929,15 @@ class AzureCommunicationCallAdapter {
26870
26929
  }
26871
26930
  }
26872
26931
  subscribeCallEvents() {
26873
- var _a, _b, _c, _d, _e;
26932
+ var _a, _b, _c, _d, _e, _f;
26874
26933
  (_a = this.call) === null || _a === void 0 ? void 0 : _a.on('remoteParticipantsUpdated', this.onRemoteParticipantsUpdated.bind(this));
26875
26934
  (_b = this.call) === null || _b === void 0 ? void 0 : _b.on('isMutedChanged', this.isMyMutedChanged.bind(this));
26876
26935
  (_c = this.call) === null || _c === void 0 ? void 0 : _c.on('isScreenSharingOnChanged', this.isScreenSharingOnChanged.bind(this));
26877
26936
  (_d = this.call) === null || _d === void 0 ? void 0 : _d.on('idChanged', this.callIdChanged.bind(this));
26878
26937
  /* @conditional-compile-remove(close-captions) */
26879
26938
  (_e = this.call) === null || _e === void 0 ? void 0 : _e.on('stateChanged', this.subscribeToCaptionEvents.bind(this));
26939
+ /* @conditional-compile-remove(call-transfer) */
26940
+ (_f = this.call) === null || _f === void 0 ? void 0 : _f.feature(communicationCalling.Features.Transfer).on('transferRequested', this.transferRequested.bind(this));
26880
26941
  }
26881
26942
  unsubscribeCallEvents() {
26882
26943
  var _a, _b, _c, _d, _e, _f, _g;
@@ -26926,6 +26987,10 @@ class AzureCommunicationCallAdapter {
26926
26987
  isActive: (_a = this.call) === null || _a === void 0 ? void 0 : _a.feature(communicationCalling.Features.TeamsCaptions).isCaptionsFeatureActive
26927
26988
  });
26928
26989
  }
26990
+ /* @conditional-compile-remove(call-transfer) */
26991
+ transferRequested(args) {
26992
+ this.emitter.emit('transferRequested', args);
26993
+ }
26929
26994
  callIdChanged() {
26930
26995
  var _a;
26931
26996
  ((_a = this.call) === null || _a === void 0 ? void 0 : _a.id) && this.emitter.emit('callIdChanged', { callId: this.call.id });