@azure/communication-react 1.4.2-alpha-202211030017.0 → 1.4.2-alpha-202211040017.0

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 (48) hide show
  1. package/dist/communication-react.d.ts +21 -13
  2. package/dist/dist-cjs/communication-react/index.js +451 -191
  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/BetaToStableTypes.d.ts +23 -0
  7. package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.js +4 -0
  8. package/dist/dist-esm/calling-stateful-client/src/BetaToStableTypes.js.map +1 -0
  9. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.d.ts +9 -6
  10. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js +37 -182
  11. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarative.js.map +1 -1
  12. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.d.ts +53 -0
  13. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js +204 -0
  14. package/dist/dist-esm/calling-stateful-client/src/CallAgentDeclarativeCommon.js.map +1 -0
  15. package/dist/dist-esm/calling-stateful-client/src/CallClientState.d.ts +5 -1
  16. package/dist/dist-esm/calling-stateful-client/src/CallClientState.js.map +1 -1
  17. package/dist/dist-esm/calling-stateful-client/src/CallDeclarative.js +4 -65
  18. package/dist/dist-esm/calling-stateful-client/src/CallDeclarative.js.map +1 -1
  19. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.d.ts +13 -0
  20. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js +88 -0
  21. package/dist/dist-esm/calling-stateful-client/src/CallDeclarativeCommon.js.map +1 -0
  22. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.d.ts +2 -2
  23. package/dist/dist-esm/calling-stateful-client/src/CallSubscriber.js.map +1 -1
  24. package/dist/dist-esm/calling-stateful-client/src/Converter.d.ts +4 -3
  25. package/dist/dist-esm/calling-stateful-client/src/Converter.js +4 -0
  26. package/dist/dist-esm/calling-stateful-client/src/Converter.js.map +1 -1
  27. package/dist/dist-esm/calling-stateful-client/src/IncomingCallDeclarative.d.ts +2 -1
  28. package/dist/dist-esm/calling-stateful-client/src/IncomingCallDeclarative.js.map +1 -1
  29. package/dist/dist-esm/calling-stateful-client/src/IncomingCallSubscriber.d.ts +3 -2
  30. package/dist/dist-esm/calling-stateful-client/src/IncomingCallSubscriber.js.map +1 -1
  31. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js +16 -0
  32. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js.map +1 -1
  33. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.d.ts +19 -0
  34. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js +89 -0
  35. package/dist/dist-esm/calling-stateful-client/src/TeamsCallAgentDeclarative.js.map +1 -0
  36. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.d.ts +23 -0
  37. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js +48 -0
  38. package/dist/dist-esm/calling-stateful-client/src/TeamsCallDeclarative.js.map +1 -0
  39. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.d.ts +19 -0
  40. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js +35 -0
  41. package/dist/dist-esm/calling-stateful-client/src/TypeGuards.js.map +1 -0
  42. package/dist/dist-esm/calling-stateful-client/src/index.d.ts +1 -1
  43. package/dist/dist-esm/calling-stateful-client/src/index.js.map +1 -1
  44. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +2 -1
  45. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  46. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +2 -1
  47. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  48. package/package.json +8 -8
@@ -202,7 +202,7 @@ const _toCommunicationIdentifier = (id) => {
202
202
  // Copyright (c) Microsoft Corporation.
203
203
  // Licensed under the MIT license.
204
204
  // GENERATED FILE. DO NOT EDIT MANUALLY.
205
- var telemetryVersion = '1.4.2-alpha-202211030017.0';
205
+ var telemetryVersion = '1.4.2-alpha-202211040017.0';
206
206
 
207
207
  // Copyright (c) Microsoft Corporation.
208
208
  /**
@@ -401,7 +401,7 @@ const getCallState = (state, props) => { var _a; return (_a = state.calls[props.
401
401
 
402
402
  // Copyright (c) Microsoft Corporation.
403
403
  // Licensed under the MIT license.
404
- var __awaiter$x = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
404
+ var __awaiter$z = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
405
405
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
406
406
  return new (P || (P = Promise))(function (resolve, reject) {
407
407
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -439,7 +439,7 @@ const _isPreviewOn = (deviceManager) => {
439
439
  *
440
440
  * @private
441
441
  */
442
- const disposeAllLocalPreviewViews = (callClient) => __awaiter$x(void 0, void 0, void 0, function* () {
442
+ const disposeAllLocalPreviewViews = (callClient) => __awaiter$z(void 0, void 0, void 0, function* () {
443
443
  const unparentedViews = callClient.getState().deviceManager.unparentedViews;
444
444
  for (const view of unparentedViews) {
445
445
  yield callClient.disposeView(undefined, undefined, view);
@@ -549,7 +549,7 @@ const holdButtonSelector = reselect__namespace.createSelector([getCallState], (c
549
549
 
550
550
  // Copyright (c) Microsoft Corporation.
551
551
  // Licensed under the MIT license.
552
- var __awaiter$w = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
552
+ var __awaiter$y = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
553
553
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
554
554
  return new (P || (P = Promise))(function (resolve, reject) {
555
555
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -573,7 +573,7 @@ const areStreamsEqual = (prevStream, newStream) => {
573
573
  * @public
574
574
  */
575
575
  const createDefaultCallingHandlers = memoizeOne__default['default']((callClient, callAgent, deviceManager, call) => {
576
- const onStartLocalVideo = () => __awaiter$w(void 0, void 0, void 0, function* () {
576
+ const onStartLocalVideo = () => __awaiter$y(void 0, void 0, void 0, function* () {
577
577
  // Before the call object creates a stream, dispose of any local preview streams.
578
578
  // @TODO: is there any way to parent the unparented view to the call object instead
579
579
  // of disposing and creating a new stream?
@@ -593,7 +593,7 @@ const createDefaultCallingHandlers = memoizeOne__default['default']((callClient,
593
593
  yield call.startVideo(stream);
594
594
  }
595
595
  });
596
- const onStopLocalVideo = (stream) => __awaiter$w(void 0, void 0, void 0, function* () {
596
+ const onStopLocalVideo = (stream) => __awaiter$y(void 0, void 0, void 0, function* () {
597
597
  const callId = call === null || call === void 0 ? void 0 : call.id;
598
598
  if (!callId) {
599
599
  return;
@@ -606,7 +606,7 @@ const createDefaultCallingHandlers = memoizeOne__default['default']((callClient,
606
606
  });
607
607
  }
608
608
  });
609
- const onToggleCamera = (options) => __awaiter$w(void 0, void 0, void 0, function* () {
609
+ const onToggleCamera = (options) => __awaiter$y(void 0, void 0, void 0, function* () {
610
610
  const previewOn = _isPreviewOn(callClient.getState().deviceManager);
611
611
  if (previewOn && call && call.state === 'Connecting') {
612
612
  // This is to workaround: https://skype.visualstudio.com/SPOOL/_workitems/edit/3030558.
@@ -657,19 +657,19 @@ const createDefaultCallingHandlers = memoizeOne__default['default']((callClient,
657
657
  const onStartCall = (participants, options) => {
658
658
  return callAgent ? callAgent.startCall(participants, options) : undefined;
659
659
  };
660
- const onSelectMicrophone = (device) => __awaiter$w(void 0, void 0, void 0, function* () {
660
+ const onSelectMicrophone = (device) => __awaiter$y(void 0, void 0, void 0, function* () {
661
661
  if (!deviceManager) {
662
662
  return;
663
663
  }
664
664
  return deviceManager.selectMicrophone(device);
665
665
  });
666
- const onSelectSpeaker = (device) => __awaiter$w(void 0, void 0, void 0, function* () {
666
+ const onSelectSpeaker = (device) => __awaiter$y(void 0, void 0, void 0, function* () {
667
667
  if (!deviceManager) {
668
668
  return;
669
669
  }
670
670
  return deviceManager.selectSpeaker(device);
671
671
  });
672
- const onSelectCamera = (device, options) => __awaiter$w(void 0, void 0, void 0, function* () {
672
+ const onSelectCamera = (device, options) => __awaiter$y(void 0, void 0, void 0, function* () {
673
673
  if (!deviceManager) {
674
674
  return;
675
675
  }
@@ -692,19 +692,19 @@ const createDefaultCallingHandlers = memoizeOne__default['default']((callClient,
692
692
  }, options);
693
693
  }
694
694
  });
695
- const onToggleMicrophone = () => __awaiter$w(void 0, void 0, void 0, function* () {
695
+ const onToggleMicrophone = () => __awaiter$y(void 0, void 0, void 0, function* () {
696
696
  if (!call || !_isInCall(call.state)) {
697
697
  throw new Error(`Please invoke onToggleMicrophone after call is started`);
698
698
  }
699
699
  return call.isMuted ? yield call.unmute() : yield call.mute();
700
700
  });
701
- const onStartScreenShare = () => __awaiter$w(void 0, void 0, void 0, function* () { return yield (call === null || call === void 0 ? void 0 : call.startScreenSharing()); });
702
- const onStopScreenShare = () => __awaiter$w(void 0, void 0, void 0, function* () { return yield (call === null || call === void 0 ? void 0 : call.stopScreenSharing()); });
703
- const onToggleScreenShare = () => __awaiter$w(void 0, void 0, void 0, function* () { return (call === null || call === void 0 ? void 0 : call.isScreenSharingOn) ? yield onStopScreenShare() : yield onStartScreenShare(); });
704
- const onHangUp = (forEveryone) => __awaiter$w(void 0, void 0, void 0, function* () { return yield (call === null || call === void 0 ? void 0 : call.hangUp({ forEveryone: forEveryone === true ? true : false })); });
701
+ const onStartScreenShare = () => __awaiter$y(void 0, void 0, void 0, function* () { return yield (call === null || call === void 0 ? void 0 : call.startScreenSharing()); });
702
+ const onStopScreenShare = () => __awaiter$y(void 0, void 0, void 0, function* () { return yield (call === null || call === void 0 ? void 0 : call.stopScreenSharing()); });
703
+ const onToggleScreenShare = () => __awaiter$y(void 0, void 0, void 0, function* () { return (call === null || call === void 0 ? void 0 : call.isScreenSharingOn) ? yield onStopScreenShare() : yield onStartScreenShare(); });
704
+ const onHangUp = (forEveryone) => __awaiter$y(void 0, void 0, void 0, function* () { return yield (call === null || call === void 0 ? void 0 : call.hangUp({ forEveryone: forEveryone === true ? true : false })); });
705
705
  /* @conditional-compile-remove(PSTN-calls) */
706
- const onToggleHold = () => __awaiter$w(void 0, void 0, void 0, function* () { return (call === null || call === void 0 ? void 0 : call.state) === 'LocalHold' ? yield (call === null || call === void 0 ? void 0 : call.resume()) : yield (call === null || call === void 0 ? void 0 : call.hold()); });
707
- const onCreateLocalStreamView = (options = { scalingMode: 'Crop', isMirrored: true }) => __awaiter$w(void 0, void 0, void 0, function* () {
706
+ const onToggleHold = () => __awaiter$y(void 0, void 0, void 0, function* () { return (call === null || call === void 0 ? void 0 : call.state) === 'LocalHold' ? yield (call === null || call === void 0 ? void 0 : call.resume()) : yield (call === null || call === void 0 ? void 0 : call.hold()); });
707
+ const onCreateLocalStreamView = (options = { scalingMode: 'Crop', isMirrored: true }) => __awaiter$y(void 0, void 0, void 0, function* () {
708
708
  var _a;
709
709
  if (!call || call.localVideoStreams.length === 0) {
710
710
  return;
@@ -720,7 +720,7 @@ const createDefaultCallingHandlers = memoizeOne__default['default']((callClient,
720
720
  const { view } = (_a = (yield callClient.createView(call.id, undefined, localStream, options))) !== null && _a !== void 0 ? _a : {};
721
721
  return view ? { view } : undefined;
722
722
  });
723
- const onCreateRemoteStreamView = (userId, options = { scalingMode: 'Crop' }) => __awaiter$w(void 0, void 0, void 0, function* () {
723
+ const onCreateRemoteStreamView = (userId, options = { scalingMode: 'Crop' }) => __awaiter$y(void 0, void 0, void 0, function* () {
724
724
  if (!call) {
725
725
  return;
726
726
  }
@@ -748,7 +748,7 @@ const createDefaultCallingHandlers = memoizeOne__default['default']((callClient,
748
748
  }
749
749
  return (createViewResult === null || createViewResult === void 0 ? void 0 : createViewResult.view) ? { view: createViewResult === null || createViewResult === void 0 ? void 0 : createViewResult.view } : undefined;
750
750
  });
751
- const onDisposeRemoteStreamView = (userId) => __awaiter$w(void 0, void 0, void 0, function* () {
751
+ const onDisposeRemoteStreamView = (userId) => __awaiter$y(void 0, void 0, void 0, function* () {
752
752
  if (!call) {
753
753
  return;
754
754
  }
@@ -769,7 +769,7 @@ const createDefaultCallingHandlers = memoizeOne__default['default']((callClient,
769
769
  callClient.disposeView(call.id, participant.identifier, screenShareStream);
770
770
  }
771
771
  });
772
- const onDisposeLocalStreamView = () => __awaiter$w(void 0, void 0, void 0, function* () {
772
+ const onDisposeLocalStreamView = () => __awaiter$y(void 0, void 0, void 0, function* () {
773
773
  // If the user is currently in a call, dispose of the local stream view attached to that call.
774
774
  const callState = call && callClient.getState().calls[call.id];
775
775
  const localStream = callState === null || callState === void 0 ? void 0 : callState.localVideoStreams.find((item) => item.mediaStreamType === 'Video');
@@ -781,12 +781,12 @@ const createDefaultCallingHandlers = memoizeOne__default['default']((callClient,
781
781
  // TODO: we need to remember which LocalVideoStream was used for LocalPreview and dispose that one.
782
782
  yield disposeAllLocalPreviewViews(callClient);
783
783
  });
784
- const onRemoveParticipant = (userId) => __awaiter$w(void 0, void 0, void 0, function* () {
784
+ const onRemoveParticipant = (userId) => __awaiter$y(void 0, void 0, void 0, function* () {
785
785
  const participant = _toCommunicationIdentifier(userId);
786
786
  yield (call === null || call === void 0 ? void 0 : call.removeParticipant(participant));
787
787
  });
788
788
  /* @conditional-compile-remove(PSTN-calls) */
789
- const onAddParticipant = (participant, options) => __awaiter$w(void 0, void 0, void 0, function* () {
789
+ const onAddParticipant = (participant, options) => __awaiter$y(void 0, void 0, void 0, function* () {
790
790
  const participantType = participantTypeHelper(participant);
791
791
  switch (participantType) {
792
792
  case 'PSTN':
@@ -798,9 +798,9 @@ const createDefaultCallingHandlers = memoizeOne__default['default']((callClient,
798
798
  }
799
799
  });
800
800
  /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */
801
- const onSendDtmfTone = (dtmfTone) => __awaiter$w(void 0, void 0, void 0, function* () { return yield (call === null || call === void 0 ? void 0 : call.sendDtmf(dtmfTone)); });
801
+ const onSendDtmfTone = (dtmfTone) => __awaiter$y(void 0, void 0, void 0, function* () { return yield (call === null || call === void 0 ? void 0 : call.sendDtmf(dtmfTone)); });
802
802
  /* @conditional-compile-remove(call-readiness) */
803
- const askDevicePermission = (constrain) => __awaiter$w(void 0, void 0, void 0, function* () {
803
+ const askDevicePermission = (constrain) => __awaiter$y(void 0, void 0, void 0, function* () {
804
804
  if (deviceManager) {
805
805
  yield (deviceManager === null || deviceManager === void 0 ? void 0 : deviceManager.askDevicePermission(constrain));
806
806
  }
@@ -3553,7 +3553,7 @@ const chatMessageActionMenuProps = (menuProps) => {
3553
3553
  return actionMenuProps;
3554
3554
  };
3555
3555
 
3556
- var __awaiter$v = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3556
+ var __awaiter$x = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3557
3557
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3558
3558
  return new (P || (P = Promise))(function (resolve, reject) {
3559
3559
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -3578,7 +3578,7 @@ const _FileDownloadCards = (props) => {
3578
3578
  var _a, _b;
3579
3579
  return (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadFile) !== null && _b !== void 0 ? _b : localeStrings.downloadFile;
3580
3580
  }, [(_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadFile, localeStrings.downloadFile]);
3581
- const fileDownloadHandler = React.useCallback((userId, file) => __awaiter$v(void 0, void 0, void 0, function* () {
3581
+ const fileDownloadHandler = React.useCallback((userId, file) => __awaiter$x(void 0, void 0, void 0, function* () {
3582
3582
  if (!props.downloadHandler) {
3583
3583
  window.open(file.url, '_blank', 'noopener,noreferrer');
3584
3584
  }
@@ -3726,7 +3726,7 @@ const ChatMessageComponentAsMessageBubble = React__default['default'].memo(Messa
3726
3726
 
3727
3727
  // Copyright (c) Microsoft Corporation.
3728
3728
  // Licensed under the MIT license.
3729
- var __awaiter$u = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3729
+ var __awaiter$w = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3730
3730
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3731
3731
  return new (P || (P = Promise))(function (resolve, reject) {
3732
3732
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -3760,7 +3760,7 @@ const ChatMessageComponent = (props) => {
3760
3760
  return React__default['default'].createElement(React__default['default'].Fragment, null);
3761
3761
  }
3762
3762
  else if (isEditing) {
3763
- return (React__default['default'].createElement(ChatMessageComponentAsEditBox, { message: message, inlineEditButtons: props.inlineAcceptRejectEditButtons, strings: props.strings, onSubmit: (text, metadata, options) => __awaiter$u(void 0, void 0, void 0, function* () {
3763
+ return (React__default['default'].createElement(ChatMessageComponentAsEditBox, { message: message, inlineEditButtons: props.inlineAcceptRejectEditButtons, strings: props.strings, onSubmit: (text, metadata, options) => __awaiter$w(void 0, void 0, void 0, function* () {
3764
3764
  props.onUpdateMessage &&
3765
3765
  props.message.messageId &&
3766
3766
  (yield props.onUpdateMessage(props.message.messageId, text, metadata, options));
@@ -3859,7 +3859,7 @@ const getParticipantsWhoHaveReadMessage = (message, readReceiptsBySenderId) => {
3859
3859
 
3860
3860
  // Copyright (c) Microsoft Corporation.
3861
3861
  // Licensed under the MIT license.
3862
- var __awaiter$t = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3862
+ var __awaiter$v = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3863
3863
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3864
3864
  return new (P || (P = Promise))(function (resolve, reject) {
3865
3865
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -4086,7 +4086,7 @@ const MessageThread = (props) => {
4086
4086
  setChatMessagesInitialized(chatMessagesInitialized);
4087
4087
  };
4088
4088
  // we try to only send those message status if user is scrolled to the bottom.
4089
- const sendMessageStatusIfAtBottom = React.useCallback(() => __awaiter$t(void 0, void 0, void 0, function* () {
4089
+ const sendMessageStatusIfAtBottom = React.useCallback(() => __awaiter$v(void 0, void 0, void 0, function* () {
4090
4090
  if (!isAtBottomOfScrollRef.current ||
4091
4091
  !document.hasFocus() ||
4092
4092
  !messagesRef.current ||
@@ -4137,7 +4137,7 @@ const MessageThread = (props) => {
4137
4137
  setIsAtBottomOfScrollRef(atBottom);
4138
4138
  }, [scrollToBottom, sendMessageStatusIfAtBottom]);
4139
4139
  // Infinite scrolling + threadInitialize function
4140
- const fetchNewMessageWhenAtTop = React.useCallback(() => __awaiter$t(void 0, void 0, void 0, function* () {
4140
+ const fetchNewMessageWhenAtTop = React.useCallback(() => __awaiter$v(void 0, void 0, void 0, function* () {
4141
4141
  if (chatScrollDivRef.current && !isLoadingChatMessagesRef.current) {
4142
4142
  if (onLoadPreviousChatMessages) {
4143
4143
  isLoadingChatMessagesRef.current = true;
@@ -6928,7 +6928,7 @@ const DevicesButton = (props) => {
6928
6928
 
6929
6929
  // Copyright (c) Microsoft Corporation.
6930
6930
  // Licensed under the MIT license.
6931
- var __awaiter$s = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
6931
+ var __awaiter$u = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
6932
6932
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6933
6933
  return new (P || (P = Promise))(function (resolve, reject) {
6934
6934
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -6966,7 +6966,7 @@ const CameraButton = (props) => {
6966
6966
  const toggleAnnouncerString = React.useCallback((isCameraOn) => {
6967
6967
  setAnnouncerString(!isCameraOn ? strings.cameraActionTurnedOffAnnouncement : strings.cameraActionTurnedOnAnnouncement);
6968
6968
  }, [strings.cameraActionTurnedOffAnnouncement, strings.cameraActionTurnedOnAnnouncement]);
6969
- const onToggleClick = React.useCallback(() => __awaiter$s(void 0, void 0, void 0, function* () {
6969
+ const onToggleClick = React.useCallback(() => __awaiter$u(void 0, void 0, void 0, function* () {
6970
6970
  // Throttle click on camera, need to await onToggleCamera then allow another click
6971
6971
  if (onToggleCamera) {
6972
6972
  setWaitForCamera(true);
@@ -7098,7 +7098,7 @@ const lightThemeCallButtonStyles = {
7098
7098
 
7099
7099
  // Copyright (c) Microsoft Corporation.
7100
7100
  // Licensed under the MIT license.
7101
- var __awaiter$r = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
7101
+ var __awaiter$t = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
7102
7102
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7103
7103
  return new (P || (P = Promise))(function (resolve, reject) {
7104
7104
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -7139,7 +7139,7 @@ const MicrophoneButton = (props) => {
7139
7139
  const toggleAnnouncerString = React.useCallback((isMicOn) => {
7140
7140
  setAnnouncerString(!isMicOn ? strings.microphoneActionTurnedOffAnnouncement : strings.microphoneActionTurnedOnAnnouncement);
7141
7141
  }, [strings.microphoneActionTurnedOffAnnouncement, strings.microphoneActionTurnedOnAnnouncement]);
7142
- const onToggleClick = React.useCallback(() => __awaiter$r(void 0, void 0, void 0, function* () {
7142
+ const onToggleClick = React.useCallback(() => __awaiter$t(void 0, void 0, void 0, function* () {
7143
7143
  if (onToggleMicrophone) {
7144
7144
  try {
7145
7145
  yield onToggleMicrophone();
@@ -8131,7 +8131,7 @@ function useLongPress(onClick, onLongPress, isMobile) {
8131
8131
 
8132
8132
  // Copyright (c) Microsoft Corporation.
8133
8133
  // Licensed under the MIT license.
8134
- var __awaiter$q = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
8134
+ var __awaiter$s = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
8135
8135
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8136
8136
  return new (P || (P = Promise))(function (resolve, reject) {
8137
8137
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -8172,10 +8172,10 @@ const DialpadButton = (props) => {
8172
8172
  var _a, _b, _c, _d;
8173
8173
  const theme = react.useTheme();
8174
8174
  const { digit, index, onClick, onLongPress, isMobile = false } = props;
8175
- const clickFunction = React.useCallback(() => __awaiter$q(void 0, void 0, void 0, function* () {
8175
+ const clickFunction = React.useCallback(() => __awaiter$s(void 0, void 0, void 0, function* () {
8176
8176
  onClick(digit, index);
8177
8177
  }), [digit, index, onClick]);
8178
- const longPressFunction = React.useCallback(() => __awaiter$q(void 0, void 0, void 0, function* () {
8178
+ const longPressFunction = React.useCallback(() => __awaiter$s(void 0, void 0, void 0, function* () {
8179
8179
  onLongPress(digit, index);
8180
8180
  }), [digit, index, onLongPress]);
8181
8181
  const { handlers } = useLongPress(clickFunction, longPressFunction, isMobile);
@@ -8954,7 +8954,7 @@ const findConditionalCompiledSelector = (component) => {
8954
8954
 
8955
8955
  // Copyright (c) Microsoft Corporation.
8956
8956
  // Licensed under the MIT license.
8957
- var __awaiter$p = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
8957
+ var __awaiter$r = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
8958
8958
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8959
8959
  return new (P || (P = Promise))(function (resolve, reject) {
8960
8960
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -8977,35 +8977,35 @@ const createDefaultChatHandlers = memoizeOne__default['default']((chatClient, ch
8977
8977
  let messageIterator = undefined;
8978
8978
  let readReceiptIterator = undefined;
8979
8979
  return {
8980
- onSendMessage: (content, options) => __awaiter$p(void 0, void 0, void 0, function* () {
8980
+ onSendMessage: (content, options) => __awaiter$r(void 0, void 0, void 0, function* () {
8981
8981
  const sendMessageRequest = {
8982
8982
  content,
8983
8983
  senderDisplayName: chatClient.getState().displayName
8984
8984
  };
8985
8985
  yield chatThreadClient.sendMessage(sendMessageRequest, options);
8986
8986
  }),
8987
- onUpdateMessage: (messageId, content, metadata, options) => __awaiter$p(void 0, void 0, void 0, function* () {
8987
+ onUpdateMessage: (messageId, content, metadata, options) => __awaiter$r(void 0, void 0, void 0, function* () {
8988
8988
  const updatedMetadata = metadata ? Object.assign({}, metadata) : {};
8989
8989
  updatedMetadata['fileSharingMetadata'] = JSON.stringify((options === null || options === void 0 ? void 0 : options.attachedFilesMetadata) || []);
8990
8990
  yield chatThreadClient.updateMessage(messageId, { content, metadata: updatedMetadata });
8991
8991
  }),
8992
- onDeleteMessage: (messageId) => __awaiter$p(void 0, void 0, void 0, function* () {
8992
+ onDeleteMessage: (messageId) => __awaiter$r(void 0, void 0, void 0, function* () {
8993
8993
  yield chatThreadClient.deleteMessage(messageId);
8994
8994
  }),
8995
8995
  // This handler is designed for chatThread to consume
8996
- onMessageSeen: (chatMessageId) => __awaiter$p(void 0, void 0, void 0, function* () {
8996
+ onMessageSeen: (chatMessageId) => __awaiter$r(void 0, void 0, void 0, function* () {
8997
8997
  yield chatThreadClient.sendReadReceipt({ chatMessageId });
8998
8998
  }),
8999
- onTyping: () => __awaiter$p(void 0, void 0, void 0, function* () {
8999
+ onTyping: () => __awaiter$r(void 0, void 0, void 0, function* () {
9000
9000
  yield chatThreadClient.sendTypingNotification();
9001
9001
  }),
9002
- onRemoveParticipant: (userId) => __awaiter$p(void 0, void 0, void 0, function* () {
9002
+ onRemoveParticipant: (userId) => __awaiter$r(void 0, void 0, void 0, function* () {
9003
9003
  yield chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));
9004
9004
  }),
9005
- updateThreadTopicName: (topicName) => __awaiter$p(void 0, void 0, void 0, function* () {
9005
+ updateThreadTopicName: (topicName) => __awaiter$r(void 0, void 0, void 0, function* () {
9006
9006
  yield chatThreadClient.updateTopic(topicName);
9007
9007
  }),
9008
- onLoadPreviousChatMessages: (messagesToLoad) => __awaiter$p(void 0, void 0, void 0, function* () {
9008
+ onLoadPreviousChatMessages: (messagesToLoad) => __awaiter$r(void 0, void 0, void 0, function* () {
9009
9009
  var _a, _b, _c;
9010
9010
  if (messageIterator === undefined) {
9011
9011
  // Lazy definition so that errors in the method call are reported correctly.
@@ -9707,7 +9707,7 @@ const findSelector = (component) => {
9707
9707
 
9708
9708
  // Copyright (c) Microsoft Corporation.
9709
9709
  // Licensed under the MIT license.
9710
- var __awaiter$o = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
9710
+ var __awaiter$q = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
9711
9711
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9712
9712
  return new (P || (P = Promise))(function (resolve, reject) {
9713
9713
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -9756,13 +9756,13 @@ class ProxyDeviceManager {
9756
9756
  this.selectCamera = (videoDeviceInfo) => {
9757
9757
  this._context.setDeviceManagerSelectedCamera(videoDeviceInfo);
9758
9758
  };
9759
- this.videoDevicesUpdated = () => __awaiter$o(this, void 0, void 0, function* () {
9759
+ this.videoDevicesUpdated = () => __awaiter$q(this, void 0, void 0, function* () {
9760
9760
  // Device Manager always has a camera with '' name if there are no real camera devices available.
9761
9761
  // We don't want to show that in the UI.
9762
9762
  const realCameras = (yield this._deviceManager.getCameras()).filter((c) => !!c.name);
9763
9763
  this._context.setDeviceManagerCameras(dedupeById(realCameras));
9764
9764
  });
9765
- this.audioDevicesUpdated = () => __awaiter$o(this, void 0, void 0, function* () {
9765
+ this.audioDevicesUpdated = () => __awaiter$q(this, void 0, void 0, function* () {
9766
9766
  this._context.setDeviceManagerMicrophones(dedupeById(yield this._deviceManager.getMicrophones()));
9767
9767
  this._context.setDeviceManagerSpeakers(dedupeById(yield this._deviceManager.getSpeakers()));
9768
9768
  });
@@ -9968,7 +9968,7 @@ class CallIdHistory {
9968
9968
 
9969
9969
  // Copyright (c) Microsoft Corporation.
9970
9970
  // Licensed under the MIT license.
9971
- var __awaiter$n = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
9971
+ var __awaiter$p = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
9972
9972
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9973
9973
  return new (P || (P = Promise))(function (resolve, reject) {
9974
9974
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -10476,7 +10476,7 @@ class CallContext$1 {
10476
10476
  * @throws CallError. Exceptions thrown from `f` are tagged with the failed `target.
10477
10477
  */
10478
10478
  withAsyncErrorTeedToState(action, target) {
10479
- return (...args) => __awaiter$n(this, void 0, void 0, function* () {
10479
+ return (...args) => __awaiter$p(this, void 0, void 0, function* () {
10480
10480
  try {
10481
10481
  return yield action(...args);
10482
10482
  }
@@ -10540,108 +10540,33 @@ const findOldestCallEnded = (calls) => {
10540
10540
 
10541
10541
  // Copyright (c) Microsoft Corporation.
10542
10542
  // Licensed under the MIT license.
10543
- var __awaiter$m = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
10544
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10545
- return new (P || (P = Promise))(function (resolve, reject) {
10546
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10547
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10548
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10549
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10550
- });
10543
+ /**
10544
+ * @private
10545
+ */
10546
+ const isACSCall = (call) => {
10547
+ /* @conditional-compile-remove(teams-identity-support) */
10548
+ return call.kind === 'Call';
10551
10549
  };
10552
- class ProxyCall {
10553
- constructor(context) {
10554
- this._context = context;
10555
- }
10556
- unsubscribe() {
10557
- /** No subscriptions yet. But there will be one for transfer feature soon. */
10558
- }
10559
- get(target, prop) {
10560
- switch (prop) {
10561
- case 'mute': {
10562
- return this._context.withAsyncErrorTeedToState(function (...args) {
10563
- return __awaiter$m(this, void 0, void 0, function* () {
10564
- return yield target.mute(...args);
10565
- });
10566
- }, 'Call.mute');
10567
- }
10568
- case 'unmute': {
10569
- return this._context.withAsyncErrorTeedToState(function (...args) {
10570
- return __awaiter$m(this, void 0, void 0, function* () {
10571
- return yield target.unmute(...args);
10572
- });
10573
- }, 'Call.unmute');
10574
- }
10575
- case 'startVideo': {
10576
- return this._context.withAsyncErrorTeedToState(function (...args) {
10577
- return __awaiter$m(this, void 0, void 0, function* () {
10578
- return yield target.startVideo(...args);
10579
- });
10580
- }, 'Call.startVideo');
10581
- }
10582
- case 'stopVideo': {
10583
- return this._context.withAsyncErrorTeedToState(function (...args) {
10584
- return __awaiter$m(this, void 0, void 0, function* () {
10585
- return yield target.stopVideo(...args);
10586
- });
10587
- }, 'Call.stopVideo');
10588
- }
10589
- case 'startScreenSharing': {
10590
- return this._context.withAsyncErrorTeedToState(function (...args) {
10591
- return __awaiter$m(this, void 0, void 0, function* () {
10592
- return yield target.startScreenSharing(...args);
10593
- });
10594
- }, 'Call.startScreenSharing');
10595
- }
10596
- case 'stopScreenSharing': {
10597
- return this._context.withAsyncErrorTeedToState(function (...args) {
10598
- return __awaiter$m(this, void 0, void 0, function* () {
10599
- return yield target.stopScreenSharing(...args);
10600
- });
10601
- }, 'Call.stopScreenSharing');
10602
- }
10603
- case 'hold': {
10604
- return this._context.withAsyncErrorTeedToState(function (...args) {
10605
- return __awaiter$m(this, void 0, void 0, function* () {
10606
- return yield target.hold(...args);
10607
- });
10608
- }, 'Call.hold');
10609
- }
10610
- case 'resume': {
10611
- return this._context.withAsyncErrorTeedToState(function (...args) {
10612
- return __awaiter$m(this, void 0, void 0, function* () {
10613
- return yield target.resume(...args);
10614
- });
10615
- }, 'Call.resume');
10616
- }
10617
- case 'addParticipant': {
10618
- return this._context.withAsyncErrorTeedToState(function (...args) {
10619
- return __awaiter$m(this, void 0, void 0, function* () {
10620
- return yield target.addParticipant(...args);
10621
- });
10622
- }, 'Call.addParticipant');
10623
- }
10624
- default:
10625
- return Reflect.get(target, prop);
10626
- }
10627
- }
10628
- }
10629
10550
  /**
10630
- * Creates a declarative Call by proxying Call with ProxyCall.
10631
- * This should only be used with CallAgentDeclarative as CallAgentDeclarative will add that
10632
- * call to the context properly (need to have the Call in context to update it - CallAgentDeclarative will add Call to
10633
- * context)
10634
- *
10635
- * @param call - Call from SDK
10636
- * @param context - CallContext from StatefulCallClient
10551
+ * @private
10637
10552
  */
10638
- const callDeclaratify = (call, context) => {
10639
- const proxyCall = new ProxyCall(context);
10640
- Object.defineProperty(call, 'unsubscribe', {
10641
- configurable: false,
10642
- value: () => proxyCall.unsubscribe()
10643
- });
10644
- return new Proxy(call, proxyCall);
10553
+ const isACSCallAgent = (callAgent) => {
10554
+ /* @conditional-compile-remove(teams-identity-support) */
10555
+ return callAgent.kind === 'CallAgent';
10556
+ };
10557
+ /**
10558
+ * @private
10559
+ */
10560
+ const isTeamsCall = (call) => {
10561
+ /* @conditional-compile-remove(teams-identity-support) */
10562
+ return call.kind === 'TeamsCall';
10563
+ };
10564
+ /**
10565
+ * @private
10566
+ */
10567
+ const isTeamsCallAgent = (callAgent) => {
10568
+ /* @conditional-compile-remove(teams-identity-support) */
10569
+ return callAgent.kind === 'TeamsCallAgent';
10645
10570
  };
10646
10571
 
10647
10572
  // Copyright (c) Microsoft Corporation.
@@ -10699,6 +10624,8 @@ function convertSdkCallToDeclarativeCall(call) {
10699
10624
  });
10700
10625
  return {
10701
10626
  id: call.id,
10627
+ /* @conditional-compile-remove(teams-identity-support) */
10628
+ type: isACSCall(call) ? 'ACS' : 'Teams',
10702
10629
  callerInfo: call.callerInfo,
10703
10630
  state: call.state,
10704
10631
  callEndReason: call.callEndReason,
@@ -10826,7 +10753,7 @@ class RemoteVideoStreamSubscriber {
10826
10753
 
10827
10754
  // Copyright (c) Microsoft Corporation.
10828
10755
  // Licensed under the MIT license.
10829
- var __awaiter$l = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
10756
+ var __awaiter$o = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
10830
10757
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10831
10758
  return new (P || (P = Promise))(function (resolve, reject) {
10832
10759
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -10836,7 +10763,7 @@ var __awaiter$l = (window && window.__awaiter) || function (thisArg, _arguments,
10836
10763
  });
10837
10764
  };
10838
10765
  function createViewRemoteVideo(context, internalContext, callId, participantId, stream, options) {
10839
- return __awaiter$l(this, void 0, void 0, function* () {
10766
+ return __awaiter$o(this, void 0, void 0, function* () {
10840
10767
  // Render RemoteVideoStream that is part of a Call
10841
10768
  const streamId = stream.id;
10842
10769
  let participantKey;
@@ -10944,7 +10871,7 @@ function createViewRemoteVideo(context, internalContext, callId, participantId,
10944
10871
  });
10945
10872
  }
10946
10873
  function createViewLocalVideo(context, internalContext, callId, options) {
10947
- return __awaiter$l(this, void 0, void 0, function* () {
10874
+ return __awaiter$o(this, void 0, void 0, function* () {
10948
10875
  _logEvent(callingStatefulLogger, {
10949
10876
  name: EventNames.START_LOCAL_STREAM_RENDERING,
10950
10877
  level: 'info',
@@ -11060,7 +10987,7 @@ function createViewLocalVideo(context, internalContext, callId, options) {
11060
10987
  });
11061
10988
  }
11062
10989
  function createViewUnparentedVideo(context, internalContext, stream, options) {
11063
- return __awaiter$l(this, void 0, void 0, function* () {
10990
+ return __awaiter$o(this, void 0, void 0, function* () {
11064
10991
  const renderInfo = internalContext.getUnparentedRenderInfo(stream);
11065
10992
  if (renderInfo && renderInfo.status === 'Rendered') {
11066
10993
  console.warn('Unparented LocalVideoStream is already rendered');
@@ -11704,7 +11631,7 @@ class CallSubscriber {
11704
11631
 
11705
11632
  // Copyright (c) Microsoft Corporation.
11706
11633
  // Licensed under the MIT license.
11707
- var __awaiter$k = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
11634
+ var __awaiter$n = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
11708
11635
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11709
11636
  return new (P || (P = Promise))(function (resolve, reject) {
11710
11637
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -11724,14 +11651,14 @@ class ProxyIncomingCall {
11724
11651
  switch (prop) {
11725
11652
  case 'accept': {
11726
11653
  return this._context.withAsyncErrorTeedToState(function (...args) {
11727
- return __awaiter$k(this, void 0, void 0, function* () {
11654
+ return __awaiter$n(this, void 0, void 0, function* () {
11728
11655
  return yield target.accept(...args);
11729
11656
  });
11730
11657
  }, 'IncomingCall.accept');
11731
11658
  }
11732
11659
  case 'reject': {
11733
11660
  return this._context.withAsyncErrorTeedToState(function (...args) {
11734
- return __awaiter$k(this, void 0, void 0, function* () {
11661
+ return __awaiter$n(this, void 0, void 0, function* () {
11735
11662
  return yield target.reject(...args);
11736
11663
  });
11737
11664
  }, 'IncomingCall.reject');
@@ -11794,22 +11721,11 @@ class IncomingCallSubscriber {
11794
11721
  * updates in the CallAgent and in the contained Calls and RemoteParticipants. When dispose is called it will
11795
11722
  * unsubscribe from all state updates.
11796
11723
  */
11797
- class ProxyCallAgent {
11798
- constructor(callAgent, context, internalContext) {
11799
- this.subscribe = () => {
11800
- this._callAgent.on('callsUpdated', this.callsUpdated);
11801
- this._callAgent.on('incomingCall', this.incomingCall);
11802
- // There could be scenario that when ProxyCallAgent is created that the given CallAgent already has Calls. In this
11803
- // case we need to make sure to subscribe to those already existing Calls.
11804
- for (const call of this._callAgent.calls) {
11805
- this.addCall(call);
11806
- }
11807
- };
11808
- this.unsubscribe = () => {
11809
- this._callAgent.off('callsUpdated', this.callsUpdated);
11810
- this._callAgent.off('incomingCall', this.incomingCall);
11811
- // Unsubscribe is called when CallAgent is disposed. This should mean no more updating of existing call but we don't
11812
- // remove any existing state.
11724
+ class ProxyCallAgentCommon {
11725
+ constructor(context, internalContext) {
11726
+ // Unsubscribe is called when CallAgent is disposed. This should mean no more updating of existing call but we don't
11727
+ // remove any existing state.
11728
+ this.unregisterSubscriber = () => {
11813
11729
  for (const [_, callSubscriber] of this._callSubscribers.entries()) {
11814
11730
  callSubscriber.unsubscribe();
11815
11731
  }
@@ -11846,7 +11762,7 @@ class ProxyCallAgent {
11846
11762
  this._declarativeCalls.delete(call);
11847
11763
  }
11848
11764
  else {
11849
- removedStatefulCall.push(callDeclaratify(call, this._context));
11765
+ removedStatefulCall.push(this.callDeclaratify(call, this._context));
11850
11766
  }
11851
11767
  }
11852
11768
  for (const externalCallsUpdatedListener of this._externalCallsUpdatedListeners) {
@@ -11884,11 +11800,10 @@ class ProxyCallAgent {
11884
11800
  if (declarativeCall) {
11885
11801
  return declarativeCall;
11886
11802
  }
11887
- const newDeclarativeCall = callDeclaratify(call, this._context);
11803
+ const newDeclarativeCall = this.callDeclaratify(call, this._context);
11888
11804
  this._declarativeCalls.set(call, newDeclarativeCall);
11889
11805
  return newDeclarativeCall;
11890
11806
  };
11891
- this._callAgent = callAgent;
11892
11807
  this._context = context;
11893
11808
  this._internalContext = internalContext;
11894
11809
  this._callSubscribers = new Map();
@@ -11896,20 +11811,21 @@ class ProxyCallAgent {
11896
11811
  this._declarativeIncomingCalls = new Map();
11897
11812
  this._declarativeCalls = new Map();
11898
11813
  this._externalCallsUpdatedListeners = new Set();
11899
- this.subscribe();
11900
11814
  }
11901
- get(target, prop) {
11815
+ // We can't directly override get function because it is proxied,
11816
+ // Add a getCommon function and call it in child class
11817
+ getCommon(target, prop) {
11902
11818
  switch (prop) {
11903
11819
  case 'startCall': {
11904
11820
  return this._context.withErrorTeedToState((...args) => {
11905
- const call = target.startCall(...args);
11821
+ const call = this.startCall(target, args);
11906
11822
  this.addCall(call);
11907
11823
  return this.getOrCreateDeclarativeCall(call);
11908
11824
  }, 'CallAgent.startCall');
11909
11825
  }
11910
11826
  case 'join': {
11911
11827
  return this._context.withErrorTeedToState((...args) => {
11912
- const call = target.join(...args);
11828
+ const call = this.joinCall(target, args);
11913
11829
  this.addCall(call);
11914
11830
  return this.getOrCreateDeclarativeCall(call);
11915
11831
  }, 'CallAgent.join');
@@ -11925,7 +11841,7 @@ class ProxyCallAgent {
11925
11841
  this._externalCallsUpdatedListeners.add(listener);
11926
11842
  }
11927
11843
  else {
11928
- target.on(...args);
11844
+ this.agentSubscribe(target, args);
11929
11845
  }
11930
11846
  };
11931
11847
  }
@@ -11937,7 +11853,7 @@ class ProxyCallAgent {
11937
11853
  this._externalCallsUpdatedListeners.delete(listener);
11938
11854
  }
11939
11855
  else {
11940
- target.off(...args);
11856
+ this.agentUnsubscribe(target, args);
11941
11857
  }
11942
11858
  };
11943
11859
  }
@@ -11965,6 +11881,210 @@ class ProxyCallAgent {
11965
11881
  }
11966
11882
  }
11967
11883
  }
11884
+ /**
11885
+ * @private
11886
+ */
11887
+ const clearCallRelatedState = (context, internalContext) => {
11888
+ // Make sure there are no existing call data if creating a new CallAgentDeclarative (if creating a new
11889
+ // CallAgentDeclarative after disposing of the hold one will mean context have old call state). TODO: should we stop
11890
+ // rendering when the previous callAgent is disposed?
11891
+ disposeAllViews(context, internalContext);
11892
+ context.clearCallRelatedState();
11893
+ internalContext.clearCallRelatedState();
11894
+ };
11895
+
11896
+ // Copyright (c) Microsoft Corporation.
11897
+ // Licensed under the MIT license.
11898
+ var __awaiter$m = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
11899
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11900
+ return new (P || (P = Promise))(function (resolve, reject) {
11901
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11902
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11903
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11904
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11905
+ });
11906
+ };
11907
+ /**
11908
+ * @private
11909
+ */
11910
+ class ProxyCallCommon {
11911
+ constructor(context) {
11912
+ this._context = context;
11913
+ }
11914
+ unsubscribe() {
11915
+ /** No subscriptions yet. But there will be one for transfer feature soon. */
11916
+ }
11917
+ getContext() {
11918
+ return this._context;
11919
+ }
11920
+ get(target, prop) {
11921
+ switch (prop) {
11922
+ case 'mute': {
11923
+ return this._context.withAsyncErrorTeedToState(function (...args) {
11924
+ return __awaiter$m(this, void 0, void 0, function* () {
11925
+ return yield target.mute(...args);
11926
+ });
11927
+ }, 'Call.mute');
11928
+ }
11929
+ case 'unmute': {
11930
+ return this._context.withAsyncErrorTeedToState(function (...args) {
11931
+ return __awaiter$m(this, void 0, void 0, function* () {
11932
+ return yield target.unmute(...args);
11933
+ });
11934
+ }, 'Call.unmute');
11935
+ }
11936
+ case 'startVideo': {
11937
+ return this._context.withAsyncErrorTeedToState(function (...args) {
11938
+ return __awaiter$m(this, void 0, void 0, function* () {
11939
+ return yield target.startVideo(...args);
11940
+ });
11941
+ }, 'Call.startVideo');
11942
+ }
11943
+ case 'stopVideo': {
11944
+ return this._context.withAsyncErrorTeedToState(function (...args) {
11945
+ return __awaiter$m(this, void 0, void 0, function* () {
11946
+ return yield target.stopVideo(...args);
11947
+ });
11948
+ }, 'Call.stopVideo');
11949
+ }
11950
+ case 'startScreenSharing': {
11951
+ return this._context.withAsyncErrorTeedToState(function (...args) {
11952
+ return __awaiter$m(this, void 0, void 0, function* () {
11953
+ return yield target.startScreenSharing(...args);
11954
+ });
11955
+ }, 'Call.startScreenSharing');
11956
+ }
11957
+ case 'stopScreenSharing': {
11958
+ return this._context.withAsyncErrorTeedToState(function (...args) {
11959
+ return __awaiter$m(this, void 0, void 0, function* () {
11960
+ return yield target.stopScreenSharing(...args);
11961
+ });
11962
+ }, 'Call.stopScreenSharing');
11963
+ }
11964
+ case 'hold': {
11965
+ return this._context.withAsyncErrorTeedToState(function (...args) {
11966
+ return __awaiter$m(this, void 0, void 0, function* () {
11967
+ return yield target.hold(...args);
11968
+ });
11969
+ }, 'Call.hold');
11970
+ }
11971
+ case 'resume': {
11972
+ return this._context.withAsyncErrorTeedToState(function (...args) {
11973
+ return __awaiter$m(this, void 0, void 0, function* () {
11974
+ return yield target.resume(...args);
11975
+ });
11976
+ }, 'Call.resume');
11977
+ }
11978
+ default:
11979
+ return Reflect.get(target, prop);
11980
+ }
11981
+ }
11982
+ }
11983
+
11984
+ // Copyright (c) Microsoft Corporation.
11985
+ // Licensed under the MIT license.
11986
+ var __awaiter$l = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
11987
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11988
+ return new (P || (P = Promise))(function (resolve, reject) {
11989
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11990
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11991
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11992
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11993
+ });
11994
+ };
11995
+ class ProxyCall extends ProxyCallCommon {
11996
+ get(target, prop) {
11997
+ switch (prop) {
11998
+ case 'addParticipant': {
11999
+ return this.getContext().withAsyncErrorTeedToState(function (...args) {
12000
+ return __awaiter$l(this, void 0, void 0, function* () {
12001
+ return yield target.addParticipant(...args);
12002
+ });
12003
+ }, 'Call.addParticipant');
12004
+ }
12005
+ default:
12006
+ return super.get(target, prop);
12007
+ }
12008
+ }
12009
+ }
12010
+ /**
12011
+ * Creates a declarative Call by proxying Call with ProxyCall.
12012
+ * This should only be used with CallAgentDeclarative as CallAgentDeclarative will add that
12013
+ * call to the context properly (need to have the Call in context to update it - CallAgentDeclarative will add Call to
12014
+ * context)
12015
+ *
12016
+ * @param call - Call from SDK
12017
+ * @param context - CallContext from StatefulCallClient
12018
+ */
12019
+ const callDeclaratify = (call, context) => {
12020
+ const proxyCall = new ProxyCall(context);
12021
+ Object.defineProperty(call, 'unsubscribe', {
12022
+ configurable: false,
12023
+ value: () => proxyCall.unsubscribe()
12024
+ });
12025
+ return new Proxy(call, proxyCall);
12026
+ };
12027
+
12028
+ // Copyright (c) Microsoft Corporation.
12029
+ /**
12030
+ * ProxyCallAgent proxies CallAgent and saves any returned state in the given context. It will subscribe to all state
12031
+ * updates in the CallAgent and in the contained Calls and RemoteParticipants. When dispose is called it will
12032
+ * unsubscribe from all state updates.
12033
+ */
12034
+ class ProxyCallAgent extends ProxyCallAgentCommon {
12035
+ constructor(callAgent, context, internalContext) {
12036
+ super(context, internalContext);
12037
+ this.subscribe = () => {
12038
+ this._callAgent.on('callsUpdated', this.callsUpdated);
12039
+ this._callAgent.on('incomingCall', this.incomingCall);
12040
+ // There could be scenario that when ProxyCallAgent is created that the given CallAgent already has Calls. In this
12041
+ // case we need to make sure to subscribe to those already existing Calls.
12042
+ for (const call of this._callAgent.calls) {
12043
+ this.addCall(call);
12044
+ }
12045
+ };
12046
+ this.unsubscribe = () => {
12047
+ this._callAgent.off('callsUpdated', this.callsUpdated);
12048
+ this._callAgent.off('incomingCall', this.incomingCall);
12049
+ this.unregisterSubscriber();
12050
+ };
12051
+ this._callAgent = callAgent;
12052
+ this.subscribe();
12053
+ }
12054
+ callDeclaratify(call, context) {
12055
+ if (isACSCall(call)) {
12056
+ return callDeclaratify(call, context);
12057
+ }
12058
+ throw new Error('Not reachable code, DeclarativeCallAgent.callDeclaratify must be called with an ACS call.');
12059
+ }
12060
+ startCall(agent, args) {
12061
+ if (isACSCallAgent(agent)) {
12062
+ return agent.startCall(...args);
12063
+ }
12064
+ throw Error('Unreachable code, DeclarativeCallAgent.startCall must be called with an ACS callAgent.');
12065
+ }
12066
+ joinCall(agent, args) {
12067
+ if (isACSCallAgent(agent)) {
12068
+ return agent.join(...args);
12069
+ }
12070
+ throw Error('Unreachable code, DeclarativeCallAgent.joinCall must be called with an ACS callAgent.');
12071
+ }
12072
+ agentSubscribe(agent, args) {
12073
+ if (isACSCallAgent(agent)) {
12074
+ return agent.on(...args);
12075
+ }
12076
+ throw Error('Unreachable code, DeclarativeCallAgent.agentSubscribe must be called with an ACS callAgent.');
12077
+ }
12078
+ agentUnsubscribe(agent, args) {
12079
+ if (isACSCallAgent(agent)) {
12080
+ return agent.off(...args);
12081
+ }
12082
+ throw Error('Unreachable code, DeclarativeCallAgent.agentUnsubscribe must be called with an ACS callAgent.');
12083
+ }
12084
+ get(target, prop) {
12085
+ return super.getCommon(target, prop);
12086
+ }
12087
+ }
11968
12088
  /**
11969
12089
  * Creates a declarative CallAgent by proxying CallAgent with ProxyCallAgent which will track state updates by updating
11970
12090
  * the given context.
@@ -11974,12 +12094,7 @@ class ProxyCallAgent {
11974
12094
  * @param internalContext- InternalCallContext from StatefulCallClient
11975
12095
  */
11976
12096
  const callAgentDeclaratify = (callAgent, context, internalContext) => {
11977
- // Make sure there are no existing call data if creating a new CallAgentDeclarative (if creating a new
11978
- // CallAgentDeclarative after disposing of the hold one will mean context have old call state). TODO: should we stop
11979
- // rendering when the previous callAgent is disposed?
11980
- disposeAllViews(context, internalContext);
11981
- context.clearCallRelatedState();
11982
- internalContext.clearCallRelatedState();
12097
+ clearCallRelatedState(context, internalContext);
11983
12098
  return new Proxy(callAgent, new ProxyCallAgent(callAgent, context, internalContext));
11984
12099
  };
11985
12100
 
@@ -12077,6 +12192,136 @@ class InternalCallContext {
12077
12192
  }
12078
12193
  }
12079
12194
 
12195
+ // Copyright (c) Microsoft Corporation.
12196
+ // Licensed under the MIT license.
12197
+ var __awaiter$k = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
12198
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
12199
+ return new (P || (P = Promise))(function (resolve, reject) {
12200
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
12201
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
12202
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
12203
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
12204
+ });
12205
+ };
12206
+ class ProxyTeamsCall extends ProxyCallCommon {
12207
+ get(target, prop) {
12208
+ /* @conditional-compile-remove(teams-identity-support) */
12209
+ switch (prop) {
12210
+ case 'addParticipant': {
12211
+ return this.getContext().withAsyncErrorTeedToState(function (...args) {
12212
+ return __awaiter$k(this, void 0, void 0, function* () {
12213
+ return yield target.addParticipant(...args);
12214
+ });
12215
+ }, 'TeamsCall.addParticipant');
12216
+ }
12217
+ default:
12218
+ return super.get(target, prop);
12219
+ }
12220
+ }
12221
+ }
12222
+ /**
12223
+ * Creates a declarative Call by proxying Call with ProxyCall.
12224
+ * This should only be used with CallAgentDeclarative as CallAgentDeclarative will add that
12225
+ * call to the context properly (need to have the Call in context to update it - CallAgentDeclarative will add Call to
12226
+ * context)
12227
+ *
12228
+ * @param call - TeamsCall from SDK
12229
+ * @param context - CallContext from StatefulCallClient
12230
+ */
12231
+ const teamsCallDeclaratify = (call, context) => {
12232
+ const proxyCall = new ProxyTeamsCall(context);
12233
+ proxyCall.unsubscribe();
12234
+ Object.defineProperty(call, 'unsubscribe', {
12235
+ configurable: false,
12236
+ value: () => proxyCall.unsubscribe()
12237
+ });
12238
+ return new Proxy(call, proxyCall);
12239
+ };
12240
+
12241
+ /**
12242
+ * ProxyTeamsCallAgent proxies TeamsCallAgent and saves any returned state in the given context. It will subscribe to all state
12243
+ * updates in the TeamsCallAgent and in the contained TeamsCalls and RemoteParticipants. When dispose is called it will
12244
+ * unsubscribe from all state updates.
12245
+ */
12246
+ class ProxyTeamsCallAgent extends ProxyCallAgentCommon {
12247
+ constructor(callAgent, context, internalContext) {
12248
+ super(context, internalContext);
12249
+ this.subscribe = () => {
12250
+ /* @conditional-compile-remove(teams-identity-support) */
12251
+ this._callAgent.on('callsUpdated', this.callsUpdated);
12252
+ /* @conditional-compile-remove(teams-identity-support) */
12253
+ this._callAgent.on('incomingCall', this.incomingCall);
12254
+ /* @conditional-compile-remove(teams-identity-support) */
12255
+ // There could be scenario that when ProxyTeamsCallAgent is created that the given CallAgent already has TeamsCalls. In this
12256
+ // case we need to make sure to subscribe to those already existing Calls.
12257
+ for (const call of this._callAgent.calls) {
12258
+ this.addCall(call);
12259
+ }
12260
+ };
12261
+ this.unsubscribe = () => {
12262
+ /* @conditional-compile-remove(teams-identity-support) */
12263
+ this._callAgent.off('callsUpdated', this.callsUpdated);
12264
+ /* @conditional-compile-remove(teams-identity-support) */
12265
+ this._callAgent.off('incomingCall', this.incomingCall);
12266
+ this.unregisterSubscriber();
12267
+ };
12268
+ /* @conditional-compile-remove(teams-identity-support) */
12269
+ this._callAgent = callAgent;
12270
+ this.subscribe();
12271
+ }
12272
+ callDeclaratify(call, context) {
12273
+ /* @conditional-compile-remove(teams-identity-support) */
12274
+ if (isTeamsCall(call)) {
12275
+ return teamsCallDeclaratify(call, context);
12276
+ }
12277
+ throw new Error('Not reachable code, DeclarativeTeamsCallAgent.callDeclaratify must be called with an TeamsCall.');
12278
+ }
12279
+ startCall(agent, args) {
12280
+ /* @conditional-compile-remove(teams-identity-support) */
12281
+ if (isTeamsCallAgent(agent)) {
12282
+ return agent.startCall(...args);
12283
+ }
12284
+ throw new Error('Not reachable code, DeclarativeTeamsCallAgent.startCall must be called with an TeamsCallAgent.');
12285
+ }
12286
+ joinCall(agent, args) {
12287
+ /* @conditional-compile-remove(teams-identity-support) */
12288
+ if (isTeamsCallAgent(agent)) {
12289
+ return agent.join(...args);
12290
+ }
12291
+ throw new Error('Not reachable code, DeclarativeTeamsCallAgent.joinCall must be called with an TeamsCallAgent.');
12292
+ }
12293
+ agentSubscribe(agent, args) {
12294
+ /* @conditional-compile-remove(teams-identity-support) */
12295
+ if (isTeamsCallAgent(agent)) {
12296
+ agent.on(...args);
12297
+ }
12298
+ throw new Error('Not reachable code, DeclarativeTeamsCallAgent.agentSubscribe must be called with an TeamsCallAgent.');
12299
+ }
12300
+ agentUnsubscribe(agent, args) {
12301
+ /* @conditional-compile-remove(teams-identity-support) */
12302
+ if (isTeamsCallAgent(agent)) {
12303
+ agent.off(...args);
12304
+ }
12305
+ throw new Error('Not reachable code, DeclarativeTeamsCallAgent.agentUnsubscribe must be called with an TeamsCallAgent.');
12306
+ }
12307
+ get(target, prop) {
12308
+ /* @conditional-compile-remove(teams-identity-support) */
12309
+ return super.getCommon(target, prop);
12310
+ }
12311
+ }
12312
+ /**
12313
+ * Creates a declarative CallAgent by proxying TeamsCallAgent with ProxyTeamsCallAgent which will track state updates by updating
12314
+ * the given context.
12315
+ *
12316
+ * @param callAgent - TeamsCallAgent from SDK
12317
+ * @param context - CallContext from StatefulCallClient
12318
+ * @param internalContext- InternalCallContext from StatefulCallClient
12319
+ */
12320
+ const teamsCallAgentDeclaratify = (callAgent, context, internalContext) => {
12321
+ clearCallRelatedState(context, internalContext);
12322
+ return new Proxy(callAgent, new ProxyTeamsCallAgent(callAgent, context, internalContext));
12323
+ };
12324
+
12080
12325
  // Copyright (c) Microsoft Corporation.
12081
12326
  // Licensed under the MIT license.
12082
12327
  var __awaiter$j = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -12113,6 +12358,19 @@ class ProxyCallClient {
12113
12358
  return this._callAgent;
12114
12359
  }), 'CallClient.createCallAgent');
12115
12360
  }
12361
+ case 'createTeamsCallAgent': {
12362
+ /* @conditional-compile-remove(teams-identity-support) */ return this._context.withAsyncErrorTeedToState((...args) => __awaiter$j(this, void 0, void 0, function* () {
12363
+ // createCallAgent will throw an exception if the previous callAgent was not disposed. If the previous
12364
+ // callAgent was disposed then it would have unsubscribed to events so we can just create a new declarative
12365
+ // callAgent if the createCallAgent succeeds.
12366
+ const callAgent = yield target.createTeamsCallAgent(...args);
12367
+ this._callAgent = teamsCallAgentDeclaratify(callAgent, this._context, this._internalContext);
12368
+ this._context.setCallAgent({
12369
+ displayName: undefined
12370
+ });
12371
+ return this._callAgent;
12372
+ }), 'CallClient.createTeamsCallAgent');
12373
+ }
12116
12374
  case 'getDeviceManager': {
12117
12375
  return this._context.withAsyncErrorTeedToState(() => __awaiter$j(this, void 0, void 0, function* () {
12118
12376
  // As of writing, the SDK always returns the same instance of DeviceManager so we keep a reference of
@@ -18597,7 +18855,7 @@ var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments,
18597
18855
  };
18598
18856
  /** Context of call, which is a centralized context for all state updates */
18599
18857
  class CallContext {
18600
- constructor(clientState, isTeamsCall) {
18858
+ constructor(clientState, isTeamsCall, maxListeners = 50) {
18601
18859
  var _a;
18602
18860
  this.emitter = new EventEmitter.EventEmitter();
18603
18861
  this.state = {
@@ -18611,6 +18869,7 @@ class CallContext {
18611
18869
  isTeamsCall,
18612
18870
  /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId: clientState.alternateCallerId
18613
18871
  };
18872
+ this.emitter.setMaxListeners(maxListeners);
18614
18873
  }
18615
18874
  onStateChange(handler) {
18616
18875
  this.emitter.on('stateChanged', handler);
@@ -20511,9 +20770,10 @@ var __awaiter = (window && window.__awaiter) || function (thisArg, _arguments, P
20511
20770
  };
20512
20771
  /** Context of Call with Chat, which is a centralized context for all state updates */
20513
20772
  class CallWithChatContext {
20514
- constructor(clientState) {
20773
+ constructor(clientState, maxListeners = 50) {
20515
20774
  this.emitter = new EventEmitter.EventEmitter();
20516
20775
  this.state = clientState;
20776
+ this.emitter.setMaxListeners(maxListeners);
20517
20777
  }
20518
20778
  onStateChange(handler) {
20519
20779
  this.emitter.on('stateChanged', handler);