@azure/communication-react 1.5.1-alpha-202305310014 → 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 (32) hide show
  1. package/dist/communication-react.d.ts +55 -1
  2. package/dist/dist-cjs/communication-react/index.js +189 -45
  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/CallClientState.d.ts +32 -0
  7. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  8. package/dist/dist-esm/calling-stateful-client/src/CallContext.d.ts +2 -0
  9. package/dist/dist-esm/calling-stateful-client/src/CallContext.js +9 -0
  10. package/dist/dist-esm/calling-stateful-client/src/CallContext.js.map +1 -1
  11. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js +41 -0
  12. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js.map +1 -1
  13. package/dist/dist-esm/calling-stateful-client/src/Converter.js +4 -0
  14. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  15. package/dist/dist-esm/calling-stateful-client/src/index-public.d.ts +1 -0
  16. package/dist/dist-esm/calling-stateful-client/src/index-public.js.map +1 -1
  17. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js +4 -2
  18. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  19. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js +1 -1
  20. package/dist/dist-esm/react-components/src/components/ChatMessage/MentionRenderer.js.map +1 -1
  21. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js +34 -14
  22. package/dist/dist-esm/react-components/src/components/InputBoxComponent.js.map +1 -1
  23. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +5 -1
  24. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +71 -2
  25. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  26. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +19 -0
  27. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  28. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +1 -0
  29. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  30. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +1 -0
  31. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  32. package/package.json +10 -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';
@@ -102,6 +103,22 @@ import { VideoEffectName } from '@azure/communication-calling';
102
103
  import { VideoStreamRenderer } from '@azure/communication-calling';
103
104
  import { VideoStreamRendererView } from '@azure/communication-calling';
104
105
 
106
+ /**
107
+ * Transfer feature state
108
+ *
109
+ * @beta
110
+ */
111
+ export declare interface AcceptedTransfer {
112
+ /**
113
+ * Stores call id of accepted transfer
114
+ */
115
+ callId: string;
116
+ /**
117
+ * Stores timestamp when transfer was accepted
118
+ */
119
+ timestamp: Date;
120
+ }
121
+
105
122
  /**
106
123
  * Active error messages to be shown via {@link ErrorBar}.
107
124
  *
@@ -847,6 +864,10 @@ export declare type CallAdapterClientState = {
847
864
  * State to track the selected video background effect.
848
865
  */
849
866
  selectedVideoBackgroundEffect?: SelectedVideoBackgroundEffect;
867
+ /**
868
+ * Call from transfer request accepted by local user
869
+ */
870
+ acceptedTransferCallState?: CallState;
850
871
  };
851
872
 
852
873
  /**
@@ -1016,6 +1037,10 @@ export declare interface CallAdapterSubscribers {
1016
1037
  * Subscribe function for 'isCaptionsActiveChanged' event.
1017
1038
  */
1018
1039
  on(event: 'isCaptionsActiveChanged', listener: IsCaptionsActiveChangedListener): void;
1040
+ /**
1041
+ * Subscribe function for 'transferRequested' event.
1042
+ */
1043
+ on(event: 'transferRequested', listener: TransferRequestedListener): void;
1019
1044
  /**
1020
1045
  * Unsubscribe function for 'participantsJoined' event.
1021
1046
  */
@@ -1072,6 +1097,10 @@ export declare interface CallAdapterSubscribers {
1072
1097
  * Unsubscribe function for 'isCaptionsActiveChanged' event.
1073
1098
  */
1074
1099
  off(event: 'isCaptionsActiveChanged', listener: IsCaptionsActiveChangedListener): void;
1100
+ /**
1101
+ * Unsubscribe function for 'transferRequested' event.
1102
+ */
1103
+ off(event: 'transferRequested', listener: TransferRequestedListener): void;
1075
1104
  }
1076
1105
 
1077
1106
  /**
@@ -2164,6 +2193,10 @@ export declare interface CallState {
2164
2193
  * Proxy of {@link @azure/communication-calling#Call.totalParticipantCount}.
2165
2194
  */
2166
2195
  totalParticipantCount?: number;
2196
+ /**
2197
+ * Transfer state of call
2198
+ */
2199
+ transferFeature: TransferFeature;
2167
2200
  }
2168
2201
 
2169
2202
  /**
@@ -8387,7 +8420,7 @@ export declare interface TeamsCallAdapter extends CommonCallAdapter {
8387
8420
  export declare type TeamsCallAdapterArgs = {
8388
8421
  userId: MicrosoftTeamsUserIdentifier;
8389
8422
  credential: CommunicationTokenCredential;
8390
- locator: TeamsMeetingLinkLocator;
8423
+ locator: TeamsMeetingLinkLocator | /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator;
8391
8424
  /**
8392
8425
  * Optional parameters for the {@link TeamsCallAdapter} created
8393
8426
  */
@@ -8451,6 +8484,27 @@ export declare interface TranscriptionCallFeature {
8451
8484
  isTranscriptionActive: boolean;
8452
8485
  }
8453
8486
 
8487
+ /**
8488
+ * Transfer feature state
8489
+ *
8490
+ * @beta
8491
+ */
8492
+ export declare interface TransferFeature {
8493
+ /**
8494
+ * Accepted transfer requests
8495
+ */
8496
+ acceptedTransfers: {
8497
+ [key: string]: AcceptedTransfer;
8498
+ };
8499
+ }
8500
+
8501
+ /**
8502
+ * Callback for {@link CallAdapterSubscribers} 'isCaptionsActiveChanged' event.
8503
+ *
8504
+ * @beta
8505
+ */
8506
+ export declare type TransferRequestedListener = (event: TransferRequestedEventArgs) => void;
8507
+
8454
8508
  /**
8455
8509
  * Component to notify local user when one or more participants in the chat thread are typing.
8456
8510
  *
@@ -20,6 +20,7 @@ var reactFileTypeIcons = require('@fluentui/react-file-type-icons');
20
20
  var uuid = require('uuid');
21
21
  var htmlToReact = require('html-to-react');
22
22
  var Linkify = require('react-linkify');
23
+ var DOMPurify = require('dompurify');
23
24
  var reactUseDraggableScroll = require('react-use-draggable-scroll');
24
25
  var reactHooks = require('@fluentui/react-hooks');
25
26
  var reactWindowProvider = require('@fluentui/react-window-provider');
@@ -57,6 +58,7 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
57
58
  var React__namespace = /*#__PURE__*/_interopNamespace(React);
58
59
  var r__namespace = /*#__PURE__*/_interopNamespace(r);
59
60
  var Linkify__default = /*#__PURE__*/_interopDefaultLegacy(Linkify);
61
+ var DOMPurify__default = /*#__PURE__*/_interopDefaultLegacy(DOMPurify);
60
62
  var copy__default = /*#__PURE__*/_interopDefaultLegacy(copy);
61
63
 
62
64
  // Copyright (c) Microsoft Corporation.
@@ -165,7 +167,7 @@ const _toCommunicationIdentifier = (id) => {
165
167
  // Copyright (c) Microsoft Corporation.
166
168
  // Licensed under the MIT license.
167
169
  // GENERATED FILE. DO NOT EDIT MANUALLY.
168
- var telemetryVersion = '1.5.1-alpha-202305310014';
170
+ var telemetryVersion = '1.5.1-alpha-202306020014';
169
171
 
170
172
  // Copyright (c) Microsoft Corporation.
171
173
  /**
@@ -1457,6 +1459,10 @@ function convertSdkCallToDeclarativeCall(call) {
1457
1459
  currentSpokenLanguage: '',
1458
1460
  isCaptionsFeatureActive: false,
1459
1461
  startCaptionsInProgress: false
1462
+ },
1463
+ /* @conditional-compile-remove(call-transfer) */
1464
+ transferFeature: {
1465
+ acceptedTransfers: {}
1460
1466
  }
1461
1467
  };
1462
1468
  }
@@ -2153,6 +2159,15 @@ class CallContext$2 {
2153
2159
  }
2154
2160
  });
2155
2161
  }
2162
+ /* @conditional-compile-remove(call-transfer) */
2163
+ setAcceptedTransfer(callId, acceptedTransfer) {
2164
+ this.modifyState((draft) => {
2165
+ const call = draft.calls[this._callIdHistory.latestCallId(callId)];
2166
+ if (call) {
2167
+ call.transferFeature.acceptedTransfers[acceptedTransfer.callId] = acceptedTransfer;
2168
+ }
2169
+ });
2170
+ }
2156
2171
  /**
2157
2172
  * Tees any errors encountered in an async function to the state.
2158
2173
  *
@@ -3685,6 +3700,12 @@ class ProxyCallCommon {
3685
3700
  const proxyFeature = new ProxyTeamsCaptionsFeature(this._context, target);
3686
3701
  return new Proxy(captionsFeature, proxyFeature);
3687
3702
  }
3703
+ /* @conditional-compile-remove(call-transfer) */
3704
+ if (args[0] === communicationCalling.Features.Transfer) {
3705
+ const transferFeature = target.feature(communicationCalling.Features.Transfer);
3706
+ const proxyFeature = new ProxyTransferCallFeature(this._context, target);
3707
+ return new Proxy(transferFeature, proxyFeature);
3708
+ }
3688
3709
  return target.feature(...args);
3689
3710
  }, 'Call.feature');
3690
3711
  }
@@ -3736,6 +3757,41 @@ class ProxyTeamsCaptionsFeature {
3736
3757
  }
3737
3758
  }
3738
3759
  }
3760
+ /* @conditional-compile-remove(call-transfer) */
3761
+ /**
3762
+ * @private
3763
+ */
3764
+ class ProxyTransferCallFeature {
3765
+ constructor(context, call) {
3766
+ this._context = context;
3767
+ this._call = call;
3768
+ }
3769
+ get(target, prop) {
3770
+ switch (prop) {
3771
+ case 'on':
3772
+ return (...args) => {
3773
+ const isTransferRequested = args[0] === 'transferRequested';
3774
+ if (isTransferRequested) {
3775
+ const listener = args[1];
3776
+ const newListener = (args) => {
3777
+ const newArgs = Object.assign(Object.assign({}, args), { accept: (acceptOptions) => {
3778
+ const acceptedTransferCall = args.accept(acceptOptions);
3779
+ this._context.setAcceptedTransfer(this._call.id, {
3780
+ callId: acceptedTransferCall.id,
3781
+ timestamp: new Date()
3782
+ });
3783
+ return acceptedTransferCall;
3784
+ } });
3785
+ listener(newArgs);
3786
+ };
3787
+ return target.on('transferRequested', newListener);
3788
+ }
3789
+ };
3790
+ default:
3791
+ return Reflect.get(target, prop);
3792
+ }
3793
+ }
3794
+ }
3739
3795
 
3740
3796
  // Copyright (c) Microsoft Corporation.
3741
3797
  // Licensed under the MIT license.
@@ -5730,6 +5786,32 @@ const DEFAULT_COMPONENT_ICONS = {
5730
5786
  ChangeSpokenLanguageIcon: React__default['default'].createElement(reactIcons.PersonVoice20Regular, null)
5731
5787
  };
5732
5788
 
5789
+ // Copyright (c) Microsoft Corporation.
5790
+ /**
5791
+ * @internal
5792
+ * Announcer component to maker aria announcements on actions
5793
+ */
5794
+ const Announcer$1 = (props) => {
5795
+ const { announcementString, ariaLive } = props;
5796
+ return React__default['default'].createElement(react.Stack, { "aria-label": announcementString, "aria-live": ariaLive, styles: announcerStyles });
5797
+ };
5798
+ /**
5799
+ * Styles to hide the announcer from view but still existing on the DOM tree it so that narration can happen.
5800
+ */
5801
+ const announcerStyles = {
5802
+ root: {
5803
+ position: 'absolute',
5804
+ width: '1px',
5805
+ height: '1px',
5806
+ padding: 0,
5807
+ margin: '-1px',
5808
+ overflow: 'hidden',
5809
+ clip: 'rect(0,0,0,0)',
5810
+ whiteSpace: 'nowrap',
5811
+ border: 0
5812
+ }
5813
+ };
5814
+
5733
5815
  // Copyright (c) Microsoft Corporation.
5734
5816
  /**
5735
5817
  * @private
@@ -6119,7 +6201,7 @@ const InputBoxComponent = (props) => {
6119
6201
  updateMentionSuggestions([]);
6120
6202
  }, [textValue, mentionLookupOptions === null || mentionLookupOptions === void 0 ? void 0 : mentionLookupOptions.trigger, updateMentionSuggestions]);
6121
6203
  const mergedRootStyle = react.mergeStyles(inputBoxWrapperStyle, styles === null || styles === void 0 ? void 0 : styles.root);
6122
- const mergedTextFiledStyle = react.mergeStyles(inputBoxStyle, inputClassName, props.inlineChildren ? {} : inputBoxNewLineSpaceAffordance);
6204
+ const mergedInputFieldStyle = react.mergeStyles(inputBoxStyle, inputClassName, props.inlineChildren ? {} : inputBoxNewLineSpaceAffordance);
6123
6205
  /* @conditional-compile-remove(mention) */
6124
6206
  React.useEffect(() => {
6125
6207
  var _a;
@@ -6215,9 +6297,9 @@ const InputBoxComponent = (props) => {
6215
6297
  return;
6216
6298
  }
6217
6299
  if (ev.key === 'ArrowUp') {
6218
- ev.preventDefault();
6219
6300
  /* @conditional-compile-remove(mention) */
6220
6301
  if (mentionSuggestions.length > 0) {
6302
+ ev.preventDefault();
6221
6303
  const newActiveIndex = activeSuggestionIndex === undefined
6222
6304
  ? mentionSuggestions.length - 1
6223
6305
  : Math.max(activeSuggestionIndex - 1, 0);
@@ -6225,15 +6307,21 @@ const InputBoxComponent = (props) => {
6225
6307
  }
6226
6308
  }
6227
6309
  else if (ev.key === 'ArrowDown') {
6228
- ev.preventDefault();
6229
6310
  /* @conditional-compile-remove(mention) */
6230
6311
  if (mentionSuggestions.length > 0) {
6312
+ ev.preventDefault();
6231
6313
  const newActiveIndex = activeSuggestionIndex === undefined
6232
6314
  ? 0
6233
6315
  : Math.min(activeSuggestionIndex + 1, mentionSuggestions.length - 1);
6234
6316
  setActiveSuggestionIndex(newActiveIndex);
6235
6317
  }
6236
6318
  }
6319
+ else if (ev.key === 'Escape') {
6320
+ /* @conditional-compile-remove(mention) */
6321
+ if (mentionSuggestions.length > 0) {
6322
+ updateMentionSuggestions([]);
6323
+ }
6324
+ }
6237
6325
  if (ev.key === 'Enter' && (ev.shiftKey === false || !supportNewline)) {
6238
6326
  ev.preventDefault();
6239
6327
  // If we are looking up a mention, select the focused suggestion
@@ -6257,7 +6345,9 @@ const InputBoxComponent = (props) => {
6257
6345
  /* @conditional-compile-remove(mention) */
6258
6346
  activeSuggestionIndex,
6259
6347
  /* @conditional-compile-remove(mention) */
6260
- onSuggestionSelected
6348
+ onSuggestionSelected,
6349
+ /* @conditional-compile-remove(mention) */
6350
+ updateMentionSuggestions
6261
6351
  ]);
6262
6352
  const onRenderChildren = () => {
6263
6353
  return (React__default['default'].createElement(react.Stack, { horizontal: true, className: mergedChildrenStyle }, children));
@@ -6270,17 +6360,12 @@ const InputBoxComponent = (props) => {
6270
6360
  setActiveSuggestionIndex(undefined);
6271
6361
  }
6272
6362
  else if (activeSuggestionIndex === undefined) {
6363
+ // Set the active to the first, if it's not already set
6273
6364
  setActiveSuggestionIndex(0);
6274
6365
  }
6275
6366
  updateMentionSuggestions(suggestions);
6276
6367
  }), 500);
6277
6368
  /* @conditional-compile-remove(mention) */
6278
- React.useEffect(() => {
6279
- return () => {
6280
- debouncedQueryUpdate.cancel();
6281
- };
6282
- }, [debouncedQueryUpdate]);
6283
- /* @conditional-compile-remove(mention) */
6284
6369
  // Update selections index in mention to navigate by words
6285
6370
  const updateSelectionIndexesWithMentionIfNeeded = React.useCallback((event, inputTextValue, selectionStartValue, selectionEndValue, tagsValue) => {
6286
6371
  var _a, _b, _c;
@@ -6405,6 +6490,7 @@ const InputBoxComponent = (props) => {
6405
6490
  /* @conditional-compile-remove(mention) */
6406
6491
  const handleOnChange = React.useCallback((event, tagsValue, htmlTextValue, inputTextValue, currentTriggerStartIndex, previousSelectionStart, previousSelectionEnd, currentSelectionStart, currentSelectionEnd, updatedValue) => __awaiter$w(void 0, void 0, void 0, function* () {
6407
6492
  var _b;
6493
+ debouncedQueryUpdate.cancel();
6408
6494
  if (event.currentTarget === null) {
6409
6495
  return;
6410
6496
  }
@@ -6547,12 +6633,23 @@ const InputBoxComponent = (props) => {
6547
6633
  }
6548
6634
  }
6549
6635
  }, [setTargetSelection, targetSelection, setShouldHandleOnMouseDownDuringSelect, interactionStartPoint, tagsValue]);
6636
+ /* @conditional-compile-remove(mention) */
6637
+ const announcerText = React.useMemo(() => {
6638
+ if (activeSuggestionIndex === undefined) {
6639
+ return undefined;
6640
+ }
6641
+ const currentMention = mentionSuggestions[activeSuggestionIndex !== null && activeSuggestionIndex !== void 0 ? activeSuggestionIndex : 0];
6642
+ return (currentMention === null || currentMention === void 0 ? void 0 : currentMention.displayText.length) > 0
6643
+ ? currentMention === null || currentMention === void 0 ? void 0 : currentMention.displayText
6644
+ : localeStrings.participantItem.displayNamePlaceholder;
6645
+ }, [activeSuggestionIndex, mentionSuggestions, localeStrings.participantItem.displayNamePlaceholder]);
6550
6646
  return (React__default['default'].createElement(react.Stack, { className: mergedRootStyle },
6551
6647
  React__default['default'].createElement("div", { className: mergedTextContainerStyle },
6552
6648
  /* @conditional-compile-remove(mention) */ mentionSuggestions.length > 0 && (React__default['default'].createElement(_MentionPopover, { suggestions: mentionSuggestions, activeSuggestionIndex: activeSuggestionIndex, target: inputBoxRef, targetPositionOffset: caretPosition, onRenderSuggestionItem: mentionLookupOptions === null || mentionLookupOptions === void 0 ? void 0 : mentionLookupOptions.onRenderSuggestionItem, onSuggestionSelected: onSuggestionSelected, onDismiss: () => {
6553
6649
  updateMentionSuggestions([]);
6554
6650
  } })),
6555
- React__default['default'].createElement(react.TextField, { autoFocus: props.autoFocus === 'sendBoxTextField', "data-ui-id": dataUiId, multiline: true, autoAdjustHeight: true, multiple: false, resizable: false, componentRef: textFieldRef, id: id, inputClassName: mergedTextFiledStyle, placeholder: placeholderText, value: getInputFieldTextValue(), onChange: (e, newValue) => {
6651
+ /* @conditional-compile-remove(mention) */ announcerText !== undefined && (React__default['default'].createElement(Announcer$1, { announcementString: announcerText, ariaLive: 'polite' })),
6652
+ React__default['default'].createElement(react.TextField, { autoFocus: props.autoFocus === 'sendBoxTextField', "data-ui-id": dataUiId, multiline: true, autoAdjustHeight: true, multiple: false, resizable: false, componentRef: textFieldRef, id: id, inputClassName: mergedInputFieldStyle, placeholder: placeholderText, value: getInputFieldTextValue(), onChange: (e, newValue) => {
6556
6653
  // Remove when switching to react 17+, currently needed because of https://legacy.reactjs.org/docs/legacy-event-pooling.html
6557
6654
  /* @conditional-compile-remove(mention) */
6558
6655
  // Prevents React from resetting event's properties
@@ -6615,6 +6712,10 @@ const InputBoxComponent = (props) => {
6615
6712
  setCaretIndex(undefined);
6616
6713
  setSelectionStartValue(null);
6617
6714
  setSelectionEndValue(null);
6715
+ // Dismiss the suggestions on blur, after enough time to select by mouse if needed
6716
+ setTimeout(() => {
6717
+ setMentionSuggestions([]);
6718
+ }, 200);
6618
6719
  }, autoComplete: "off", onKeyDown: onTextFieldKeyDown, styles: mergedTextFieldStyle, disabled: disabled, errorMessage: errorMessage, onRenderSuffix: onRenderChildren, elementRef: inputBoxRef }))));
6619
6720
  };
6620
6721
  /**
@@ -7254,9 +7355,8 @@ const findStringsDiffIndexes = (props) => {
7254
7355
  */
7255
7356
  const htmlStringForMentionSuggestion = (suggestion, localeStrings) => {
7256
7357
  const idHTML = ' id ="' + suggestion.id + '"';
7257
- const displayTextHTML = ' displayText ="' + suggestion.displayText + '"';
7258
7358
  const displayText = getDisplayNameForMentionSuggestion(suggestion, localeStrings);
7259
- return '<' + MSFT_MENTION_TAG + idHTML + displayTextHTML + '>' + displayText + '</' + MSFT_MENTION_TAG + '>';
7359
+ return '<' + MSFT_MENTION_TAG + idHTML + '>' + displayText + '</' + MSFT_MENTION_TAG + '>';
7260
7360
  };
7261
7361
  /* @conditional-compile-remove(mention) */
7262
7362
  /**
@@ -7427,32 +7527,6 @@ const addTag = (tag, parseStack, tags) => {
7427
7527
  }
7428
7528
  };
7429
7529
 
7430
- // Copyright (c) Microsoft Corporation.
7431
- /**
7432
- * @internal
7433
- * Announcer component to maker aria announcements on actions
7434
- */
7435
- const Announcer$1 = (props) => {
7436
- const { announcementString, ariaLive } = props;
7437
- return React__default['default'].createElement(react.Stack, { "aria-label": announcementString, "aria-live": ariaLive, styles: announcerStyles });
7438
- };
7439
- /**
7440
- * Styles to hide the announcer from view but still existing on the DOM tree it so that narration can happen.
7441
- */
7442
- const announcerStyles = {
7443
- root: {
7444
- position: 'absolute',
7445
- width: '1px',
7446
- height: '1px',
7447
- padding: 0,
7448
- margin: '-1px',
7449
- overflow: 'hidden',
7450
- clip: 'rect(0,0,0,0)',
7451
- whiteSpace: 'nowrap',
7452
- border: 0
7453
- }
7454
- };
7455
-
7456
7530
  // Copyright (c) Microsoft Corporation.
7457
7531
  /**
7458
7532
  * @private
@@ -8693,7 +8767,7 @@ const preventUnwantedDismissProps = {
8693
8767
  const defaultOnMentionRender = (mention) => {
8694
8768
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
8695
8769
  const MsftMention = 'msft-mention';
8696
- 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);
8697
8771
  };
8698
8772
 
8699
8773
  // Copyright (c) Microsoft Corporation.
@@ -8761,14 +8835,15 @@ const extractContent = (s) => {
8761
8835
  return span.textContent || span.innerText;
8762
8836
  };
8763
8837
  const messageContentAriaText = (props) => {
8838
+ // Strip all html tags from the content for aria.
8764
8839
  return props.message.content
8765
8840
  ? props.message.mine
8766
8841
  ? _formatString(props.strings.messageContentMineAriaText, {
8767
- message: props.message.content
8842
+ message: DOMPurify__default['default'].sanitize(props.message.content, { ALLOWED_TAGS: [] })
8768
8843
  })
8769
8844
  : _formatString(props.strings.messageContentAriaText, {
8770
8845
  author: `${props.message.senderDisplayName}`,
8771
- message: props.message.content
8846
+ message: DOMPurify__default['default'].sanitize(props.message.content, { ALLOWED_TAGS: [] })
8772
8847
  })
8773
8848
  : undefined;
8774
8849
  };
@@ -26261,11 +26336,18 @@ class CallContext {
26261
26336
  // Make sure that the call is set to undefined in the state.
26262
26337
  call = undefined;
26263
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;
26264
26345
  if (this.state.page) {
26265
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')) ||
26266
26347
  clientState.deviceManager.unparentedViews.find((s) => s.mediaStreamType === 'Video')
26267
26348
  ? 'On'
26268
- : 'Off' }));
26349
+ : 'Off',
26350
+ /* @conditional-compile-remove(call-transfer) */ acceptedTransferCallState: transferCall }));
26269
26351
  }
26270
26352
  }
26271
26353
  /* @conditional-compile-remove(unsupported-browser) */
@@ -26280,6 +26362,10 @@ class CallContext {
26280
26362
  setSelectedVideoBackgroundEffect(selectedVideoBackgroundEffect) {
26281
26363
  this.setState(Object.assign(Object.assign({}, this.state), { selectedVideoBackgroundEffect }));
26282
26364
  }
26365
+ /* @conditional-compile-remove(call-transfer) */
26366
+ setAcceptedTransferCall(call) {
26367
+ this.setState(Object.assign(Object.assign({}, this.state), { acceptedTransferCallState: call }));
26368
+ }
26283
26369
  }
26284
26370
  const findLatestEndedCall = (calls) => {
26285
26371
  var _a, _b, _c, _d;
@@ -26295,6 +26381,21 @@ const findLatestEndedCall = (calls) => {
26295
26381
  }
26296
26382
  return latestCall;
26297
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
+ };
26298
26399
  /**
26299
26400
  * @private
26300
26401
  */
@@ -26346,6 +26447,43 @@ class AzureCommunicationCallAdapter {
26346
26447
  this.onClientStateChange = onStateChange;
26347
26448
  this.subscribeDeviceManagerEvents();
26348
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
+ }
26349
26487
  }
26350
26488
  get call() {
26351
26489
  return this._call;
@@ -26791,13 +26929,15 @@ class AzureCommunicationCallAdapter {
26791
26929
  }
26792
26930
  }
26793
26931
  subscribeCallEvents() {
26794
- var _a, _b, _c, _d, _e;
26932
+ var _a, _b, _c, _d, _e, _f;
26795
26933
  (_a = this.call) === null || _a === void 0 ? void 0 : _a.on('remoteParticipantsUpdated', this.onRemoteParticipantsUpdated.bind(this));
26796
26934
  (_b = this.call) === null || _b === void 0 ? void 0 : _b.on('isMutedChanged', this.isMyMutedChanged.bind(this));
26797
26935
  (_c = this.call) === null || _c === void 0 ? void 0 : _c.on('isScreenSharingOnChanged', this.isScreenSharingOnChanged.bind(this));
26798
26936
  (_d = this.call) === null || _d === void 0 ? void 0 : _d.on('idChanged', this.callIdChanged.bind(this));
26799
26937
  /* @conditional-compile-remove(close-captions) */
26800
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));
26801
26941
  }
26802
26942
  unsubscribeCallEvents() {
26803
26943
  var _a, _b, _c, _d, _e, _f, _g;
@@ -26847,6 +26987,10 @@ class AzureCommunicationCallAdapter {
26847
26987
  isActive: (_a = this.call) === null || _a === void 0 ? void 0 : _a.feature(communicationCalling.Features.TeamsCaptions).isCaptionsFeatureActive
26848
26988
  });
26849
26989
  }
26990
+ /* @conditional-compile-remove(call-transfer) */
26991
+ transferRequested(args) {
26992
+ this.emitter.emit('transferRequested', args);
26993
+ }
26850
26994
  callIdChanged() {
26851
26995
  var _a;
26852
26996
  ((_a = this.call) === null || _a === void 0 ? void 0 : _a.id) && this.emitter.emit('callIdChanged', { callId: this.call.id });