@azure/communication-react 1.4.2-alpha-202211020017.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 (73) hide show
  1. package/dist/communication-react.d.ts +29 -17
  2. package/dist/dist-cjs/communication-react/index.js +487 -202
  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-components/src/components/BrowserPermissionDenied.d.ts +3 -3
  45. package/dist/dist-esm/react-components/src/components/BrowserPermissionDenied.js +6 -4
  46. package/dist/dist-esm/react-components/src/components/BrowserPermissionDenied.js.map +1 -1
  47. package/dist/dist-esm/react-components/src/components/BrowserPermissionDeniedIOS.d.ts +1 -1
  48. package/dist/dist-esm/react-components/src/components/BrowserPermissionDeniedIOS.js +19 -18
  49. package/dist/dist-esm/react-components/src/components/BrowserPermissionDeniedIOS.js.map +1 -1
  50. package/dist/dist-esm/react-components/src/components/DevicePermissionDropdown.d.ts +4 -0
  51. package/dist/dist-esm/react-components/src/components/DevicePermissionDropdown.js +3 -2
  52. package/dist/dist-esm/react-components/src/components/DevicePermissionDropdown.js.map +1 -1
  53. package/dist/dist-esm/react-components/src/components/DomainPermissions.js +2 -4
  54. package/dist/dist-esm/react-components/src/components/DomainPermissions.js.map +1 -1
  55. package/dist/dist-esm/react-components/src/components/utils.d.ts +4 -0
  56. package/dist/dist-esm/react-components/src/components/utils.js +7 -0
  57. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  58. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +2 -1
  59. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  60. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationpageCameraDropdown.d.ts +1 -0
  61. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationpageCameraDropdown.js +1 -1
  62. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationpageCameraDropdown.js.map +1 -1
  63. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationpageMicDropdown.d.ts +1 -0
  64. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationpageMicDropdown.js +1 -1
  65. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/ConfigurationpageMicDropdown.js.map +1 -1
  66. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.d.ts +1 -0
  67. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js +6 -2
  68. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/LocalDeviceSettings.js.map +1 -1
  69. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +20 -1
  70. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
  71. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js +2 -1
  72. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/adapter/AzureCommunicationCallWithChatAdapter.js.map +1 -1
  73. 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-202211020017.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
  }
@@ -1510,6 +1510,13 @@ const customIconName = {
1510
1510
  callVideoRecoveredBySystem: 'ErrorBarCallVideoRecoveredBySystem',
1511
1511
  callMacOsCameraAccessDenied: 'ErrorBarCallMacOsCameraAccessDenied'
1512
1512
  };
1513
+ /* @conditional-compile-remove(call-readiness) */
1514
+ /**
1515
+ * @private
1516
+ */
1517
+ const isValidString = (string) => {
1518
+ return !!string && string.length > 0;
1519
+ };
1513
1520
 
1514
1521
  // Copyright (c) Microsoft Corporation.
1515
1522
  /**
@@ -3546,7 +3553,7 @@ const chatMessageActionMenuProps = (menuProps) => {
3546
3553
  return actionMenuProps;
3547
3554
  };
3548
3555
 
3549
- var __awaiter$v = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3556
+ var __awaiter$x = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3550
3557
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3551
3558
  return new (P || (P = Promise))(function (resolve, reject) {
3552
3559
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -3571,7 +3578,7 @@ const _FileDownloadCards = (props) => {
3571
3578
  var _a, _b;
3572
3579
  return (_b = (_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadFile) !== null && _b !== void 0 ? _b : localeStrings.downloadFile;
3573
3580
  }, [(_a = props.strings) === null || _a === void 0 ? void 0 : _a.downloadFile, localeStrings.downloadFile]);
3574
- 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* () {
3575
3582
  if (!props.downloadHandler) {
3576
3583
  window.open(file.url, '_blank', 'noopener,noreferrer');
3577
3584
  }
@@ -3719,7 +3726,7 @@ const ChatMessageComponentAsMessageBubble = React__default['default'].memo(Messa
3719
3726
 
3720
3727
  // Copyright (c) Microsoft Corporation.
3721
3728
  // Licensed under the MIT license.
3722
- var __awaiter$u = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3729
+ var __awaiter$w = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3723
3730
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3724
3731
  return new (P || (P = Promise))(function (resolve, reject) {
3725
3732
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -3753,7 +3760,7 @@ const ChatMessageComponent = (props) => {
3753
3760
  return React__default['default'].createElement(React__default['default'].Fragment, null);
3754
3761
  }
3755
3762
  else if (isEditing) {
3756
- 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* () {
3757
3764
  props.onUpdateMessage &&
3758
3765
  props.message.messageId &&
3759
3766
  (yield props.onUpdateMessage(props.message.messageId, text, metadata, options));
@@ -3852,7 +3859,7 @@ const getParticipantsWhoHaveReadMessage = (message, readReceiptsBySenderId) => {
3852
3859
 
3853
3860
  // Copyright (c) Microsoft Corporation.
3854
3861
  // Licensed under the MIT license.
3855
- var __awaiter$t = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3862
+ var __awaiter$v = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
3856
3863
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3857
3864
  return new (P || (P = Promise))(function (resolve, reject) {
3858
3865
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -4079,7 +4086,7 @@ const MessageThread = (props) => {
4079
4086
  setChatMessagesInitialized(chatMessagesInitialized);
4080
4087
  };
4081
4088
  // we try to only send those message status if user is scrolled to the bottom.
4082
- 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* () {
4083
4090
  if (!isAtBottomOfScrollRef.current ||
4084
4091
  !document.hasFocus() ||
4085
4092
  !messagesRef.current ||
@@ -4130,7 +4137,7 @@ const MessageThread = (props) => {
4130
4137
  setIsAtBottomOfScrollRef(atBottom);
4131
4138
  }, [scrollToBottom, sendMessageStatusIfAtBottom]);
4132
4139
  // Infinite scrolling + threadInitialize function
4133
- 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* () {
4134
4141
  if (chatScrollDivRef.current && !isLoadingChatMessagesRef.current) {
4135
4142
  if (onLoadPreviousChatMessages) {
4136
4143
  isLoadingChatMessagesRef.current = true;
@@ -6921,7 +6928,7 @@ const DevicesButton = (props) => {
6921
6928
 
6922
6929
  // Copyright (c) Microsoft Corporation.
6923
6930
  // Licensed under the MIT license.
6924
- var __awaiter$s = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
6931
+ var __awaiter$u = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
6925
6932
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
6926
6933
  return new (P || (P = Promise))(function (resolve, reject) {
6927
6934
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -6959,7 +6966,7 @@ const CameraButton = (props) => {
6959
6966
  const toggleAnnouncerString = React.useCallback((isCameraOn) => {
6960
6967
  setAnnouncerString(!isCameraOn ? strings.cameraActionTurnedOffAnnouncement : strings.cameraActionTurnedOnAnnouncement);
6961
6968
  }, [strings.cameraActionTurnedOffAnnouncement, strings.cameraActionTurnedOnAnnouncement]);
6962
- 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* () {
6963
6970
  // Throttle click on camera, need to await onToggleCamera then allow another click
6964
6971
  if (onToggleCamera) {
6965
6972
  setWaitForCamera(true);
@@ -7091,7 +7098,7 @@ const lightThemeCallButtonStyles = {
7091
7098
 
7092
7099
  // Copyright (c) Microsoft Corporation.
7093
7100
  // Licensed under the MIT license.
7094
- var __awaiter$r = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
7101
+ var __awaiter$t = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
7095
7102
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
7096
7103
  return new (P || (P = Promise))(function (resolve, reject) {
7097
7104
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -7132,7 +7139,7 @@ const MicrophoneButton = (props) => {
7132
7139
  const toggleAnnouncerString = React.useCallback((isMicOn) => {
7133
7140
  setAnnouncerString(!isMicOn ? strings.microphoneActionTurnedOffAnnouncement : strings.microphoneActionTurnedOnAnnouncement);
7134
7141
  }, [strings.microphoneActionTurnedOffAnnouncement, strings.microphoneActionTurnedOnAnnouncement]);
7135
- 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* () {
7136
7143
  if (onToggleMicrophone) {
7137
7144
  try {
7138
7145
  yield onToggleMicrophone();
@@ -7263,10 +7270,6 @@ const DomainPermissions = (props) => {
7263
7270
  /* @conditional-compile-remove(call-readiness) */
7264
7271
  return React__default['default'].createElement(DomainPermissionsContainer, Object.assign({}, props, { strings: props.strings ? props.strings : locale }));
7265
7272
  };
7266
- /* @conditional-compile-remove(call-readiness) */
7267
- const isValidString = (string) => {
7268
- return !!string && string.length > 0;
7269
- };
7270
7273
 
7271
7274
  // Copyright (c) Microsoft Corporation.
7272
7275
  /**
@@ -8128,7 +8131,7 @@ function useLongPress(onClick, onLongPress, isMobile) {
8128
8131
 
8129
8132
  // Copyright (c) Microsoft Corporation.
8130
8133
  // Licensed under the MIT license.
8131
- var __awaiter$q = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
8134
+ var __awaiter$s = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
8132
8135
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8133
8136
  return new (P || (P = Promise))(function (resolve, reject) {
8134
8137
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -8169,10 +8172,10 @@ const DialpadButton = (props) => {
8169
8172
  var _a, _b, _c, _d;
8170
8173
  const theme = react.useTheme();
8171
8174
  const { digit, index, onClick, onLongPress, isMobile = false } = props;
8172
- 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* () {
8173
8176
  onClick(digit, index);
8174
8177
  }), [digit, index, onClick]);
8175
- 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* () {
8176
8179
  onLongPress(digit, index);
8177
8180
  }), [digit, index, onLongPress]);
8178
8181
  const { handlers } = useLongPress(clickFunction, longPressFunction, isMobile);
@@ -8478,7 +8481,7 @@ const showErrorBar = (errorType, devicePermissionErrorBar, networkErrorBar) => {
8478
8481
  * @internal
8479
8482
  */
8480
8483
  const _DevicePermissionDropdown = (props) => {
8481
- const { icon, askDevicePermission, constrain, strings, options, styles } = props;
8484
+ const { icon, askDevicePermission, onClick, constrain, strings, options, styles } = props;
8482
8485
  const onRenderPlaceholder = () => {
8483
8486
  return (React__default['default'].createElement(react.Stack, { horizontal: true, verticalAlign: "center" },
8484
8487
  icon,
@@ -8487,10 +8490,11 @@ const _DevicePermissionDropdown = (props) => {
8487
8490
  const onRenderCaretDown = () => {
8488
8491
  return React__default['default'].createElement(react.Text, null, strings === null || strings === void 0 ? void 0 : strings.actionButtonContent);
8489
8492
  };
8490
- return (React__default['default'].createElement(react.Dropdown, { placeholder: strings === null || strings === void 0 ? void 0 : strings.placeHolderText, label: strings === null || strings === void 0 ? void 0 : strings.label, onRenderPlaceholder: onRenderPlaceholder, onRenderCaretDown: onRenderCaretDown, onClick: () => {
8493
+ return (React__default['default'].createElement(react.Dropdown, { "data-ui-id": 'permission-dropdown', placeholder: strings === null || strings === void 0 ? void 0 : strings.placeHolderText, label: strings === null || strings === void 0 ? void 0 : strings.label, onRenderPlaceholder: onRenderPlaceholder, onRenderCaretDown: onRenderCaretDown, onClick: () => {
8491
8494
  if (askDevicePermission) {
8492
8495
  askDevicePermission(constrain !== null && constrain !== void 0 ? constrain : { video: true, audio: true });
8493
8496
  }
8497
+ onClick === null || onClick === void 0 ? void 0 : onClick();
8494
8498
  }, options: options !== null && options !== void 0 ? options : [], styles: styles }));
8495
8499
  };
8496
8500
 
@@ -8950,7 +8954,7 @@ const findConditionalCompiledSelector = (component) => {
8950
8954
 
8951
8955
  // Copyright (c) Microsoft Corporation.
8952
8956
  // Licensed under the MIT license.
8953
- var __awaiter$p = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
8957
+ var __awaiter$r = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
8954
8958
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8955
8959
  return new (P || (P = Promise))(function (resolve, reject) {
8956
8960
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -8973,35 +8977,35 @@ const createDefaultChatHandlers = memoizeOne__default['default']((chatClient, ch
8973
8977
  let messageIterator = undefined;
8974
8978
  let readReceiptIterator = undefined;
8975
8979
  return {
8976
- 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* () {
8977
8981
  const sendMessageRequest = {
8978
8982
  content,
8979
8983
  senderDisplayName: chatClient.getState().displayName
8980
8984
  };
8981
8985
  yield chatThreadClient.sendMessage(sendMessageRequest, options);
8982
8986
  }),
8983
- 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* () {
8984
8988
  const updatedMetadata = metadata ? Object.assign({}, metadata) : {};
8985
8989
  updatedMetadata['fileSharingMetadata'] = JSON.stringify((options === null || options === void 0 ? void 0 : options.attachedFilesMetadata) || []);
8986
8990
  yield chatThreadClient.updateMessage(messageId, { content, metadata: updatedMetadata });
8987
8991
  }),
8988
- onDeleteMessage: (messageId) => __awaiter$p(void 0, void 0, void 0, function* () {
8992
+ onDeleteMessage: (messageId) => __awaiter$r(void 0, void 0, void 0, function* () {
8989
8993
  yield chatThreadClient.deleteMessage(messageId);
8990
8994
  }),
8991
8995
  // This handler is designed for chatThread to consume
8992
- onMessageSeen: (chatMessageId) => __awaiter$p(void 0, void 0, void 0, function* () {
8996
+ onMessageSeen: (chatMessageId) => __awaiter$r(void 0, void 0, void 0, function* () {
8993
8997
  yield chatThreadClient.sendReadReceipt({ chatMessageId });
8994
8998
  }),
8995
- onTyping: () => __awaiter$p(void 0, void 0, void 0, function* () {
8999
+ onTyping: () => __awaiter$r(void 0, void 0, void 0, function* () {
8996
9000
  yield chatThreadClient.sendTypingNotification();
8997
9001
  }),
8998
- onRemoveParticipant: (userId) => __awaiter$p(void 0, void 0, void 0, function* () {
9002
+ onRemoveParticipant: (userId) => __awaiter$r(void 0, void 0, void 0, function* () {
8999
9003
  yield chatThreadClient.removeParticipant(fromFlatCommunicationIdentifier(userId));
9000
9004
  }),
9001
- updateThreadTopicName: (topicName) => __awaiter$p(void 0, void 0, void 0, function* () {
9005
+ updateThreadTopicName: (topicName) => __awaiter$r(void 0, void 0, void 0, function* () {
9002
9006
  yield chatThreadClient.updateTopic(topicName);
9003
9007
  }),
9004
- onLoadPreviousChatMessages: (messagesToLoad) => __awaiter$p(void 0, void 0, void 0, function* () {
9008
+ onLoadPreviousChatMessages: (messagesToLoad) => __awaiter$r(void 0, void 0, void 0, function* () {
9005
9009
  var _a, _b, _c;
9006
9010
  if (messageIterator === undefined) {
9007
9011
  // Lazy definition so that errors in the method call are reported correctly.
@@ -9703,7 +9707,7 @@ const findSelector = (component) => {
9703
9707
 
9704
9708
  // Copyright (c) Microsoft Corporation.
9705
9709
  // Licensed under the MIT license.
9706
- var __awaiter$o = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
9710
+ var __awaiter$q = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
9707
9711
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9708
9712
  return new (P || (P = Promise))(function (resolve, reject) {
9709
9713
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -9752,13 +9756,13 @@ class ProxyDeviceManager {
9752
9756
  this.selectCamera = (videoDeviceInfo) => {
9753
9757
  this._context.setDeviceManagerSelectedCamera(videoDeviceInfo);
9754
9758
  };
9755
- this.videoDevicesUpdated = () => __awaiter$o(this, void 0, void 0, function* () {
9759
+ this.videoDevicesUpdated = () => __awaiter$q(this, void 0, void 0, function* () {
9756
9760
  // Device Manager always has a camera with '' name if there are no real camera devices available.
9757
9761
  // We don't want to show that in the UI.
9758
9762
  const realCameras = (yield this._deviceManager.getCameras()).filter((c) => !!c.name);
9759
9763
  this._context.setDeviceManagerCameras(dedupeById(realCameras));
9760
9764
  });
9761
- this.audioDevicesUpdated = () => __awaiter$o(this, void 0, void 0, function* () {
9765
+ this.audioDevicesUpdated = () => __awaiter$q(this, void 0, void 0, function* () {
9762
9766
  this._context.setDeviceManagerMicrophones(dedupeById(yield this._deviceManager.getMicrophones()));
9763
9767
  this._context.setDeviceManagerSpeakers(dedupeById(yield this._deviceManager.getSpeakers()));
9764
9768
  });
@@ -9964,7 +9968,7 @@ class CallIdHistory {
9964
9968
 
9965
9969
  // Copyright (c) Microsoft Corporation.
9966
9970
  // Licensed under the MIT license.
9967
- var __awaiter$n = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
9971
+ var __awaiter$p = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
9968
9972
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
9969
9973
  return new (P || (P = Promise))(function (resolve, reject) {
9970
9974
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -10472,7 +10476,7 @@ class CallContext$1 {
10472
10476
  * @throws CallError. Exceptions thrown from `f` are tagged with the failed `target.
10473
10477
  */
10474
10478
  withAsyncErrorTeedToState(action, target) {
10475
- return (...args) => __awaiter$n(this, void 0, void 0, function* () {
10479
+ return (...args) => __awaiter$p(this, void 0, void 0, function* () {
10476
10480
  try {
10477
10481
  return yield action(...args);
10478
10482
  }
@@ -10536,108 +10540,33 @@ const findOldestCallEnded = (calls) => {
10536
10540
 
10537
10541
  // Copyright (c) Microsoft Corporation.
10538
10542
  // Licensed under the MIT license.
10539
- var __awaiter$m = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
10540
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10541
- return new (P || (P = Promise))(function (resolve, reject) {
10542
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
10543
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
10544
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
10545
- step((generator = generator.apply(thisArg, _arguments || [])).next());
10546
- });
10543
+ /**
10544
+ * @private
10545
+ */
10546
+ const isACSCall = (call) => {
10547
+ /* @conditional-compile-remove(teams-identity-support) */
10548
+ return call.kind === 'Call';
10547
10549
  };
10548
- class ProxyCall {
10549
- constructor(context) {
10550
- this._context = context;
10551
- }
10552
- unsubscribe() {
10553
- /** No subscriptions yet. But there will be one for transfer feature soon. */
10554
- }
10555
- get(target, prop) {
10556
- switch (prop) {
10557
- case 'mute': {
10558
- return this._context.withAsyncErrorTeedToState(function (...args) {
10559
- return __awaiter$m(this, void 0, void 0, function* () {
10560
- return yield target.mute(...args);
10561
- });
10562
- }, 'Call.mute');
10563
- }
10564
- case 'unmute': {
10565
- return this._context.withAsyncErrorTeedToState(function (...args) {
10566
- return __awaiter$m(this, void 0, void 0, function* () {
10567
- return yield target.unmute(...args);
10568
- });
10569
- }, 'Call.unmute');
10570
- }
10571
- case 'startVideo': {
10572
- return this._context.withAsyncErrorTeedToState(function (...args) {
10573
- return __awaiter$m(this, void 0, void 0, function* () {
10574
- return yield target.startVideo(...args);
10575
- });
10576
- }, 'Call.startVideo');
10577
- }
10578
- case 'stopVideo': {
10579
- return this._context.withAsyncErrorTeedToState(function (...args) {
10580
- return __awaiter$m(this, void 0, void 0, function* () {
10581
- return yield target.stopVideo(...args);
10582
- });
10583
- }, 'Call.stopVideo');
10584
- }
10585
- case 'startScreenSharing': {
10586
- return this._context.withAsyncErrorTeedToState(function (...args) {
10587
- return __awaiter$m(this, void 0, void 0, function* () {
10588
- return yield target.startScreenSharing(...args);
10589
- });
10590
- }, 'Call.startScreenSharing');
10591
- }
10592
- case 'stopScreenSharing': {
10593
- return this._context.withAsyncErrorTeedToState(function (...args) {
10594
- return __awaiter$m(this, void 0, void 0, function* () {
10595
- return yield target.stopScreenSharing(...args);
10596
- });
10597
- }, 'Call.stopScreenSharing');
10598
- }
10599
- case 'hold': {
10600
- return this._context.withAsyncErrorTeedToState(function (...args) {
10601
- return __awaiter$m(this, void 0, void 0, function* () {
10602
- return yield target.hold(...args);
10603
- });
10604
- }, 'Call.hold');
10605
- }
10606
- case 'resume': {
10607
- return this._context.withAsyncErrorTeedToState(function (...args) {
10608
- return __awaiter$m(this, void 0, void 0, function* () {
10609
- return yield target.resume(...args);
10610
- });
10611
- }, 'Call.resume');
10612
- }
10613
- case 'addParticipant': {
10614
- return this._context.withAsyncErrorTeedToState(function (...args) {
10615
- return __awaiter$m(this, void 0, void 0, function* () {
10616
- return yield target.addParticipant(...args);
10617
- });
10618
- }, 'Call.addParticipant');
10619
- }
10620
- default:
10621
- return Reflect.get(target, prop);
10622
- }
10623
- }
10624
- }
10625
10550
  /**
10626
- * Creates a declarative Call by proxying Call with ProxyCall.
10627
- * This should only be used with CallAgentDeclarative as CallAgentDeclarative will add that
10628
- * call to the context properly (need to have the Call in context to update it - CallAgentDeclarative will add Call to
10629
- * context)
10630
- *
10631
- * @param call - Call from SDK
10632
- * @param context - CallContext from StatefulCallClient
10551
+ * @private
10633
10552
  */
10634
- const callDeclaratify = (call, context) => {
10635
- const proxyCall = new ProxyCall(context);
10636
- Object.defineProperty(call, 'unsubscribe', {
10637
- configurable: false,
10638
- value: () => proxyCall.unsubscribe()
10639
- });
10640
- 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';
10641
10570
  };
10642
10571
 
10643
10572
  // Copyright (c) Microsoft Corporation.
@@ -10695,6 +10624,8 @@ function convertSdkCallToDeclarativeCall(call) {
10695
10624
  });
10696
10625
  return {
10697
10626
  id: call.id,
10627
+ /* @conditional-compile-remove(teams-identity-support) */
10628
+ type: isACSCall(call) ? 'ACS' : 'Teams',
10698
10629
  callerInfo: call.callerInfo,
10699
10630
  state: call.state,
10700
10631
  callEndReason: call.callEndReason,
@@ -10822,7 +10753,7 @@ class RemoteVideoStreamSubscriber {
10822
10753
 
10823
10754
  // Copyright (c) Microsoft Corporation.
10824
10755
  // Licensed under the MIT license.
10825
- var __awaiter$l = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
10756
+ var __awaiter$o = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
10826
10757
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
10827
10758
  return new (P || (P = Promise))(function (resolve, reject) {
10828
10759
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -10832,7 +10763,7 @@ var __awaiter$l = (window && window.__awaiter) || function (thisArg, _arguments,
10832
10763
  });
10833
10764
  };
10834
10765
  function createViewRemoteVideo(context, internalContext, callId, participantId, stream, options) {
10835
- return __awaiter$l(this, void 0, void 0, function* () {
10766
+ return __awaiter$o(this, void 0, void 0, function* () {
10836
10767
  // Render RemoteVideoStream that is part of a Call
10837
10768
  const streamId = stream.id;
10838
10769
  let participantKey;
@@ -10940,7 +10871,7 @@ function createViewRemoteVideo(context, internalContext, callId, participantId,
10940
10871
  });
10941
10872
  }
10942
10873
  function createViewLocalVideo(context, internalContext, callId, options) {
10943
- return __awaiter$l(this, void 0, void 0, function* () {
10874
+ return __awaiter$o(this, void 0, void 0, function* () {
10944
10875
  _logEvent(callingStatefulLogger, {
10945
10876
  name: EventNames.START_LOCAL_STREAM_RENDERING,
10946
10877
  level: 'info',
@@ -11056,7 +10987,7 @@ function createViewLocalVideo(context, internalContext, callId, options) {
11056
10987
  });
11057
10988
  }
11058
10989
  function createViewUnparentedVideo(context, internalContext, stream, options) {
11059
- return __awaiter$l(this, void 0, void 0, function* () {
10990
+ return __awaiter$o(this, void 0, void 0, function* () {
11060
10991
  const renderInfo = internalContext.getUnparentedRenderInfo(stream);
11061
10992
  if (renderInfo && renderInfo.status === 'Rendered') {
11062
10993
  console.warn('Unparented LocalVideoStream is already rendered');
@@ -11700,7 +11631,7 @@ class CallSubscriber {
11700
11631
 
11701
11632
  // Copyright (c) Microsoft Corporation.
11702
11633
  // Licensed under the MIT license.
11703
- var __awaiter$k = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
11634
+ var __awaiter$n = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
11704
11635
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11705
11636
  return new (P || (P = Promise))(function (resolve, reject) {
11706
11637
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -11720,14 +11651,14 @@ class ProxyIncomingCall {
11720
11651
  switch (prop) {
11721
11652
  case 'accept': {
11722
11653
  return this._context.withAsyncErrorTeedToState(function (...args) {
11723
- return __awaiter$k(this, void 0, void 0, function* () {
11654
+ return __awaiter$n(this, void 0, void 0, function* () {
11724
11655
  return yield target.accept(...args);
11725
11656
  });
11726
11657
  }, 'IncomingCall.accept');
11727
11658
  }
11728
11659
  case 'reject': {
11729
11660
  return this._context.withAsyncErrorTeedToState(function (...args) {
11730
- return __awaiter$k(this, void 0, void 0, function* () {
11661
+ return __awaiter$n(this, void 0, void 0, function* () {
11731
11662
  return yield target.reject(...args);
11732
11663
  });
11733
11664
  }, 'IncomingCall.reject');
@@ -11790,22 +11721,11 @@ class IncomingCallSubscriber {
11790
11721
  * updates in the CallAgent and in the contained Calls and RemoteParticipants. When dispose is called it will
11791
11722
  * unsubscribe from all state updates.
11792
11723
  */
11793
- class ProxyCallAgent {
11794
- constructor(callAgent, context, internalContext) {
11795
- this.subscribe = () => {
11796
- this._callAgent.on('callsUpdated', this.callsUpdated);
11797
- this._callAgent.on('incomingCall', this.incomingCall);
11798
- // There could be scenario that when ProxyCallAgent is created that the given CallAgent already has Calls. In this
11799
- // case we need to make sure to subscribe to those already existing Calls.
11800
- for (const call of this._callAgent.calls) {
11801
- this.addCall(call);
11802
- }
11803
- };
11804
- this.unsubscribe = () => {
11805
- this._callAgent.off('callsUpdated', this.callsUpdated);
11806
- this._callAgent.off('incomingCall', this.incomingCall);
11807
- // Unsubscribe is called when CallAgent is disposed. This should mean no more updating of existing call but we don't
11808
- // 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 = () => {
11809
11729
  for (const [_, callSubscriber] of this._callSubscribers.entries()) {
11810
11730
  callSubscriber.unsubscribe();
11811
11731
  }
@@ -11842,7 +11762,7 @@ class ProxyCallAgent {
11842
11762
  this._declarativeCalls.delete(call);
11843
11763
  }
11844
11764
  else {
11845
- removedStatefulCall.push(callDeclaratify(call, this._context));
11765
+ removedStatefulCall.push(this.callDeclaratify(call, this._context));
11846
11766
  }
11847
11767
  }
11848
11768
  for (const externalCallsUpdatedListener of this._externalCallsUpdatedListeners) {
@@ -11880,11 +11800,10 @@ class ProxyCallAgent {
11880
11800
  if (declarativeCall) {
11881
11801
  return declarativeCall;
11882
11802
  }
11883
- const newDeclarativeCall = callDeclaratify(call, this._context);
11803
+ const newDeclarativeCall = this.callDeclaratify(call, this._context);
11884
11804
  this._declarativeCalls.set(call, newDeclarativeCall);
11885
11805
  return newDeclarativeCall;
11886
11806
  };
11887
- this._callAgent = callAgent;
11888
11807
  this._context = context;
11889
11808
  this._internalContext = internalContext;
11890
11809
  this._callSubscribers = new Map();
@@ -11892,20 +11811,21 @@ class ProxyCallAgent {
11892
11811
  this._declarativeIncomingCalls = new Map();
11893
11812
  this._declarativeCalls = new Map();
11894
11813
  this._externalCallsUpdatedListeners = new Set();
11895
- this.subscribe();
11896
11814
  }
11897
- 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) {
11898
11818
  switch (prop) {
11899
11819
  case 'startCall': {
11900
11820
  return this._context.withErrorTeedToState((...args) => {
11901
- const call = target.startCall(...args);
11821
+ const call = this.startCall(target, args);
11902
11822
  this.addCall(call);
11903
11823
  return this.getOrCreateDeclarativeCall(call);
11904
11824
  }, 'CallAgent.startCall');
11905
11825
  }
11906
11826
  case 'join': {
11907
11827
  return this._context.withErrorTeedToState((...args) => {
11908
- const call = target.join(...args);
11828
+ const call = this.joinCall(target, args);
11909
11829
  this.addCall(call);
11910
11830
  return this.getOrCreateDeclarativeCall(call);
11911
11831
  }, 'CallAgent.join');
@@ -11921,7 +11841,7 @@ class ProxyCallAgent {
11921
11841
  this._externalCallsUpdatedListeners.add(listener);
11922
11842
  }
11923
11843
  else {
11924
- target.on(...args);
11844
+ this.agentSubscribe(target, args);
11925
11845
  }
11926
11846
  };
11927
11847
  }
@@ -11933,7 +11853,7 @@ class ProxyCallAgent {
11933
11853
  this._externalCallsUpdatedListeners.delete(listener);
11934
11854
  }
11935
11855
  else {
11936
- target.off(...args);
11856
+ this.agentUnsubscribe(target, args);
11937
11857
  }
11938
11858
  };
11939
11859
  }
@@ -11961,6 +11881,210 @@ class ProxyCallAgent {
11961
11881
  }
11962
11882
  }
11963
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
+ }
11964
12088
  /**
11965
12089
  * Creates a declarative CallAgent by proxying CallAgent with ProxyCallAgent which will track state updates by updating
11966
12090
  * the given context.
@@ -11970,12 +12094,7 @@ class ProxyCallAgent {
11970
12094
  * @param internalContext- InternalCallContext from StatefulCallClient
11971
12095
  */
11972
12096
  const callAgentDeclaratify = (callAgent, context, internalContext) => {
11973
- // Make sure there are no existing call data if creating a new CallAgentDeclarative (if creating a new
11974
- // CallAgentDeclarative after disposing of the hold one will mean context have old call state). TODO: should we stop
11975
- // rendering when the previous callAgent is disposed?
11976
- disposeAllViews(context, internalContext);
11977
- context.clearCallRelatedState();
11978
- internalContext.clearCallRelatedState();
12097
+ clearCallRelatedState(context, internalContext);
11979
12098
  return new Proxy(callAgent, new ProxyCallAgent(callAgent, context, internalContext));
11980
12099
  };
11981
12100
 
@@ -12073,6 +12192,136 @@ class InternalCallContext {
12073
12192
  }
12074
12193
  }
12075
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
+
12076
12325
  // Copyright (c) Microsoft Corporation.
12077
12326
  // Licensed under the MIT license.
12078
12327
  var __awaiter$j = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -12109,6 +12358,19 @@ class ProxyCallClient {
12109
12358
  return this._callAgent;
12110
12359
  }), 'CallClient.createCallAgent');
12111
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
+ }
12112
12374
  case 'getDeviceManager': {
12113
12375
  return this._context.withAsyncErrorTeedToState(() => __awaiter$j(this, void 0, void 0, function* () {
12114
12376
  // As of writing, the SDK always returns the same instance of DeviceManager so we keep a reference of
@@ -17392,7 +17654,7 @@ const ConfigurationpageCameraDropdown = (props) => {
17392
17654
  actionButtonContent: 'Allow'
17393
17655
  };
17394
17656
  /* @conditional-compile-remove(call-readiness) */
17395
- const cameraBlockedDropdown = (React__default['default'].createElement(_DevicePermissionDropdown, Object.assign({ styles: dropDownStyles(theme), constrain: { video: true, audio: false }, strings: devicePermissionDropdownStringsCamera, icon: React__default['default'].createElement(CallCompositeIcon, { iconName: "ControlButtonCameraOn", style: { height: '1.25rem', marginRight: '0.625rem' } }) }, props.dropdownProps)));
17657
+ const cameraBlockedDropdown = (React__default['default'].createElement(_DevicePermissionDropdown, Object.assign({ styles: dropDownStyles(theme), constrain: { video: true, audio: false }, strings: devicePermissionDropdownStringsCamera, icon: React__default['default'].createElement(CallCompositeIcon, { iconName: "ControlButtonCameraOn", style: { height: '1.25rem', marginRight: '0.625rem' } }), onClick: props.onClickEnableDevicePermission }, props.dropdownProps)));
17396
17658
  /* @conditional-compile-remove(call-readiness) */
17397
17659
  if (props.callReadinessOptedIn) {
17398
17660
  return React__default['default'].createElement(React__default['default'].Fragment, null, props.cameraPermissionGranted ? props.cameraGrantedDropdown : cameraBlockedDropdown);
@@ -17413,7 +17675,7 @@ const ConfigurationpageMicDropdown = (props) => {
17413
17675
  actionButtonContent: 'Allow'
17414
17676
  };
17415
17677
  /* @conditional-compile-remove(call-readiness) */
17416
- const microphoneBlockedDropdown = (React__default['default'].createElement(_DevicePermissionDropdown, Object.assign({ styles: dropDownStyles(theme), constrain: { video: false, audio: true }, strings: devicePermissionDropdownStringsMicrophone, icon: React__default['default'].createElement(CallCompositeIcon, { iconName: "ControlButtonMicOn", style: { height: '1.25rem', marginRight: '0.625rem' } }) }, props.dropdownProps)));
17678
+ const microphoneBlockedDropdown = (React__default['default'].createElement(_DevicePermissionDropdown, Object.assign({ styles: dropDownStyles(theme), constrain: { video: false, audio: true }, strings: devicePermissionDropdownStringsMicrophone, icon: React__default['default'].createElement(CallCompositeIcon, { iconName: "ControlButtonMicOn", style: { height: '1.25rem', marginRight: '0.625rem' } }), onClick: props.onClickEnableDevicePermission }, props.dropdownProps)));
17417
17679
  /* @conditional-compile-remove(call-readiness) */
17418
17680
  if (props.callReadinessOptedIn) {
17419
17681
  return React__default['default'].createElement(React__default['default'].Fragment, null,
@@ -17527,7 +17789,9 @@ const LocalDeviceSettings = (props) => {
17527
17789
  /* @conditional-compile-remove(call-readiness) */
17528
17790
  dropdownProps: dropdownProps,
17529
17791
  /* @conditional-compile-remove(call-readiness) */
17530
- callReadinessOptedIn: (_b = props.callReadinessOptedIn) !== null && _b !== void 0 ? _b : false }))),
17792
+ callReadinessOptedIn: (_b = props.callReadinessOptedIn) !== null && _b !== void 0 ? _b : false,
17793
+ /* @conditional-compile-remove(call-readiness) */
17794
+ onClickEnableDevicePermission: props.onClickEnableDevicePermission }))),
17531
17795
  React__default['default'].createElement(react.Stack, null,
17532
17796
  React__default['default'].createElement(react.Label, { id: 'call-composite-local-sound-settings-label', className: react.mergeStyles(dropDownStyles(theme).label), disabled: !micPermissionGranted }, soundLabel),
17533
17797
  React__default['default'].createElement(react.Stack, { "data-ui-id": "call-composite-sound-settings", tokens: mainStackTokens },
@@ -17535,7 +17799,9 @@ const LocalDeviceSettings = (props) => {
17535
17799
  /* @conditional-compile-remove(call-readiness) */
17536
17800
  dropdownProps: dropdownProps,
17537
17801
  /* @conditional-compile-remove(call-readiness) */
17538
- callReadinessOptedIn: (_c = props.callReadinessOptedIn) !== null && _c !== void 0 ? _c : false }),
17802
+ callReadinessOptedIn: (_c = props.callReadinessOptedIn) !== null && _c !== void 0 ? _c : false,
17803
+ /* @conditional-compile-remove(call-readiness) */
17804
+ onClickEnableDevicePermission: props.onClickEnableDevicePermission }),
17539
17805
  React__default['default'].createElement(react.Dropdown, { "aria-labelledby": 'call-composite-local-sound-settings-label', placeholder: defaultPlaceHolder, styles: dropDownStyles(theme), disabled: props.speakers.length === 0, options: getDropDownList(props.speakers), defaultSelectedKey: props.selectedSpeaker ? props.selectedSpeaker.id : defaultDeviceId(props.speakers), onChange: (event, option, index) => {
17540
17806
  props.onSelectSpeaker(props.speakers[index !== null && index !== void 0 ? index : 0]);
17541
17807
  }, onRenderTitle: (props) => onRenderTitle('Speaker', props) })))));
@@ -17891,6 +18157,8 @@ const ConfigurationPage = (props) => {
17891
18157
  // do nothing here
17892
18158
  // only way to dismiss this drawer is clicking on allow access which will leads to device permission prompt
17893
18159
  };
18160
+ /* @conditional-compile-remove(call-readiness) */
18161
+ const [isModalShowing, setIsModalShowing] = React.useState(false);
17894
18162
  return (React__default['default'].createElement(react.Stack, { className: mobileView ? configurationContainerStyleMobile : configurationContainerStyleDesktop },
17895
18163
  React__default['default'].createElement(react.Stack, { styles: bannerNotificationStyles },
17896
18164
  React__default['default'].createElement(ConfigurationpageErrorBar
@@ -17909,6 +18177,17 @@ const ConfigurationPage = (props) => {
17909
18177
  /* @conditional-compile-remove(call-readiness) */
17910
18178
  callReadinessOptedIn: callReadinessOptedIn })),
17911
18179
  /* @conditional-compile-remove(call-readiness) */
18180
+ //show this when clicking on enable camera button or enable mic button on desktop for the first time
18181
+ //does not show if user has already grant mic or camera access
18182
+ !mobileView && !cameraPermissionGranted && !microphonePermissionGranted && callReadinessOptedIn && (React__default['default'].createElement(react.Modal, { isOpen: isModalShowing, isBlocking: false, onDismiss: () => {
18183
+ setIsModalShowing(false);
18184
+ }, overlay: { styles: { root: { background: 'rgba(0,0,0,0.9)' } } } },
18185
+ React__default['default'].createElement(DomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
18186
+ ? () => {
18187
+ onPermissionsTroubleshootingClick(permissionsState);
18188
+ }
18189
+ : undefined }))),
18190
+ /* @conditional-compile-remove(call-readiness) */
17912
18191
  mobileView && isDrawerShowing && callReadinessOptedIn && (React__default['default'].createElement(_DrawerSurface, { onLightDismiss: onLightDismissTriggered, styles: drawerContainerStyles(DRAWER_HIGH_Z_BAND) },
17913
18192
  React__default['default'].createElement(DomainPermissions, { appName: 'app', onTroubleshootingClick: onPermissionsTroubleshootingClick
17914
18193
  ? () => {
@@ -17934,7 +18213,11 @@ const ConfigurationPage = (props) => {
17934
18213
  callDescription),
17935
18214
  React__default['default'].createElement(LocalDeviceSettings, Object.assign({}, options, localDeviceSettingsHandlers, { cameraPermissionGranted: cameraPermissionGranted, microphonePermissionGranted: microphonePermissionGranted,
17936
18215
  /* @conditional-compile-remove(call-readiness) */
17937
- callReadinessOptedIn: callReadinessOptedIn })))),
18216
+ callReadinessOptedIn: callReadinessOptedIn,
18217
+ /* @conditional-compile-remove(call-readiness) */
18218
+ onClickEnableDevicePermission: () => {
18219
+ setIsModalShowing(true);
18220
+ } })))),
17938
18221
  React__default['default'].createElement(react.Stack, { styles: mobileWithPreview ? startCallButtonContainerStyleMobile : startCallButtonContainerStyleDesktop },
17939
18222
  React__default['default'].createElement(StartCallButton, { className: mobileWithPreview ? startCallButtonStyleMobile : undefined, onClick: startCallHandler, disabled: disableStartCallButton }))))));
17940
18223
  };
@@ -18572,7 +18855,7 @@ var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments,
18572
18855
  };
18573
18856
  /** Context of call, which is a centralized context for all state updates */
18574
18857
  class CallContext {
18575
- constructor(clientState, isTeamsCall) {
18858
+ constructor(clientState, isTeamsCall, maxListeners = 50) {
18576
18859
  var _a;
18577
18860
  this.emitter = new EventEmitter.EventEmitter();
18578
18861
  this.state = {
@@ -18586,6 +18869,7 @@ class CallContext {
18586
18869
  isTeamsCall,
18587
18870
  /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId: clientState.alternateCallerId
18588
18871
  };
18872
+ this.emitter.setMaxListeners(maxListeners);
18589
18873
  }
18590
18874
  onStateChange(handler) {
18591
18875
  this.emitter.on('stateChanged', handler);
@@ -20486,9 +20770,10 @@ var __awaiter = (window && window.__awaiter) || function (thisArg, _arguments, P
20486
20770
  };
20487
20771
  /** Context of Call with Chat, which is a centralized context for all state updates */
20488
20772
  class CallWithChatContext {
20489
- constructor(clientState) {
20773
+ constructor(clientState, maxListeners = 50) {
20490
20774
  this.emitter = new EventEmitter.EventEmitter();
20491
20775
  this.state = clientState;
20776
+ this.emitter.setMaxListeners(maxListeners);
20492
20777
  }
20493
20778
  onStateChange(handler) {
20494
20779
  this.emitter.on('stateChanged', handler);