@azure/communication-react 1.4.2-alpha-202211100016.0 → 1.4.2-alpha-202211110018.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.
@@ -260,6 +260,17 @@ export declare type AzureCommunicationCallAdapterArgs = {
260
260
  credential: CommunicationTokenCredential;
261
261
  locator: CallAdapterLocator;
262
262
  alternateCallerId?: string;
263
+ /**
264
+ * Optional parameters for the {@link AzureCommunicationCallAdapter} created
265
+ */
266
+ options?: {
267
+ /**
268
+ * Use this to hint the role of the user when the role is not available before a Rooms call is started. This value
269
+ * should be obtained using the Rooms API. This role will determine permissions in the configuration page of the
270
+ * {@link CallComposite}. The true role of the user will be synced with ACS services when a Rooms call starts.
271
+ */
272
+ roleHint?: Role;
273
+ };
263
274
  };
264
275
 
265
276
  /**
@@ -665,6 +676,12 @@ export declare type CallAdapterClientState = {
665
676
  * Azure communications Phone number to make PSTN calls with.
666
677
  */
667
678
  alternateCallerId?: string;
679
+ /**
680
+ * Use this to hint the role of the user when the role is not available before a Rooms call is started. This value
681
+ * should be obtained using the Rooms API. This role will determine permissions in the configuration page of the
682
+ * {@link CallComposite}. The true role of the user will be synced with ACS services when a Rooms call starts.
683
+ */
684
+ roleHint?: Role;
668
685
  };
669
686
 
670
687
  /**
@@ -1196,12 +1213,6 @@ export declare interface CallCompositeProps extends BaseCompositeProps<CallCompo
1196
1213
  * Flags to enable/disable or customize UI elements of the {@link CallComposite}.
1197
1214
  */
1198
1215
  options?: CallCompositeOptions;
1199
- /**
1200
- * Set the role to enable/disable capacities. This property should be properly set for Rooms calls. The role of a
1201
- * user for a room can be obtained using the Rooms API. The role of the user will be synced with ACS services when
1202
- * a Rooms call starts.
1203
- */
1204
- roleHint?: Role;
1205
1216
  }
1206
1217
 
1207
1218
  /**
@@ -3947,7 +3958,7 @@ export declare interface ControlBarProps {
3947
3958
  *
3948
3959
  * @public
3949
3960
  */
3950
- export declare const createAzureCommunicationCallAdapter: ({ userId, displayName, credential, locator, alternateCallerId }: AzureCommunicationCallAdapterArgs) => Promise<CallAdapter>;
3961
+ export declare const createAzureCommunicationCallAdapter: ({ userId, displayName, credential, locator, alternateCallerId, options }: AzureCommunicationCallAdapterArgs) => Promise<CallAdapter>;
3951
3962
 
3952
3963
  /**
3953
3964
  * Create a {@link CallAdapter} using the provided {@link StatefulCallClient}.
@@ -3957,7 +3968,9 @@ export declare const createAzureCommunicationCallAdapter: ({ userId, displayName
3957
3968
  *
3958
3969
  * @public
3959
3970
  */
3960
- export declare const createAzureCommunicationCallAdapterFromClient: (callClient: StatefulCallClient, callAgent: CallAgent, locator: CallAdapterLocator) => Promise<CallAdapter>;
3971
+ export declare const createAzureCommunicationCallAdapterFromClient: (callClient: StatefulCallClient, callAgent: CallAgent, locator: CallAdapterLocator, options?: {
3972
+ roleHint?: Role;
3973
+ }) => Promise<CallAdapter>;
3961
3974
 
3962
3975
  /**
3963
3976
  * Create a CallWithChatAdapter backed by Azure Communication services
@@ -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-202211100016.0';
205
+ var telemetryVersion = '1.4.2-alpha-202211110018.0';
206
206
 
207
207
  // Copyright (c) Microsoft Corporation.
208
208
  /**
@@ -18849,9 +18849,9 @@ const MainScreen = (props) => {
18849
18849
  * @public
18850
18850
  */
18851
18851
  const CallComposite = (props) => {
18852
- const { adapter, callInvitationUrl, onFetchAvatarPersonaData, onFetchParticipantMenuItems, options, formFactor = 'desktop',
18852
+ const { adapter, callInvitationUrl, onFetchAvatarPersonaData, onFetchParticipantMenuItems, options, formFactor = 'desktop' } = props;
18853
18853
  /* @conditional-compile-remove(rooms) */
18854
- roleHint } = props;
18854
+ const roleHint = adapter.getState().roleHint;
18855
18855
  React.useEffect(() => {
18856
18856
  (() => __awaiter$5(void 0, void 0, void 0, function* () {
18857
18857
  var _a;
@@ -19006,8 +19006,8 @@ var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments,
19006
19006
  };
19007
19007
  /** Context of call, which is a centralized context for all state updates */
19008
19008
  class CallContext {
19009
- constructor(clientState, isTeamsCall, maxListeners = 50) {
19010
- var _a;
19009
+ constructor(clientState, isTeamsCall, options) {
19010
+ var _a, _b;
19011
19011
  this.emitter = new EventEmitter.EventEmitter();
19012
19012
  this.state = {
19013
19013
  isLocalPreviewMicrophoneEnabled: false,
@@ -19018,9 +19018,10 @@ class CallContext {
19018
19018
  page: 'configuration',
19019
19019
  latestErrors: clientState.latestErrors,
19020
19020
  isTeamsCall,
19021
- /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId: clientState.alternateCallerId
19021
+ /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId: clientState.alternateCallerId,
19022
+ /* @conditional-compile-remove(rooms) */ roleHint: options === null || options === void 0 ? void 0 : options.roleHint
19022
19023
  };
19023
- this.emitter.setMaxListeners(maxListeners);
19024
+ this.emitter.setMaxListeners((_b = options === null || options === void 0 ? void 0 : options.maxListeners) !== null && _b !== void 0 ? _b : 50);
19024
19025
  }
19025
19026
  onStateChange(handler) {
19026
19027
  this.emitter.on('stateChanged', handler);
@@ -19085,7 +19086,8 @@ const findLatestEndedCall = (calls) => {
19085
19086
  * @private
19086
19087
  */
19087
19088
  class AzureCommunicationCallAdapter {
19088
- constructor(callClient, locator, callAgent, deviceManager) {
19089
+ constructor(callClient, locator, callAgent, deviceManager,
19090
+ /* @conditional-compile-remove(rooms) */ options) {
19089
19091
  this.participantSubscribers = new Map();
19090
19092
  this.emitter = new EventEmitter.EventEmitter();
19091
19093
  this.isMyMutedChanged = () => {
@@ -19101,7 +19103,8 @@ class AzureCommunicationCallAdapter {
19101
19103
  this.locator = locator;
19102
19104
  this.deviceManager = deviceManager;
19103
19105
  const isTeamsMeeting = 'meetingLink' in this.locator;
19104
- this.context = new CallContext(callClient.getState(), isTeamsMeeting);
19106
+ this.context = new CallContext(callClient.getState(), isTeamsMeeting,
19107
+ /* @conditional-compile-remove(rooms) */ options);
19105
19108
  this.context.onCallEnded((endCallData) => this.emitter.emit('callEnded', endCallData));
19106
19109
  const onStateChange = (clientState) => {
19107
19110
  var _a;
@@ -19549,7 +19552,8 @@ class AzureCommunicationCallAdapter {
19549
19552
  * @public
19550
19553
  */
19551
19554
  const createAzureCommunicationCallAdapter = ({ userId, displayName, credential, locator,
19552
- /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId }) => __awaiter$4(void 0, void 0, void 0, function* () {
19555
+ /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
19556
+ /* @conditional-compile-remove(rooms) */ options }) => __awaiter$4(void 0, void 0, void 0, function* () {
19553
19557
  const callClient = createStatefulCallClient({
19554
19558
  userId,
19555
19559
  /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId
@@ -19557,7 +19561,8 @@ const createAzureCommunicationCallAdapter = ({ userId, displayName, credential,
19557
19561
  const callAgent = yield callClient.createCallAgent(credential, {
19558
19562
  displayName
19559
19563
  });
19560
- const adapter = createAzureCommunicationCallAdapterFromClient(callClient, callAgent, locator);
19564
+ const adapter = createAzureCommunicationCallAdapterFromClient(callClient, callAgent, locator,
19565
+ /* @conditional-compile-remove(rooms) */ options);
19561
19566
  return adapter;
19562
19567
  });
19563
19568
  /**
@@ -19594,7 +19599,9 @@ afterCreate,
19594
19599
  * This is useful for clean up tasks, e.g., leaving any ongoing calls.
19595
19600
  */
19596
19601
  beforeDispose) => {
19597
- const { credential, displayName, locator, userId, /*@conditional-compile-remove(PSTN-calls) */ alternateCallerId } = args;
19602
+ const { credential, displayName, locator, userId,
19603
+ /*@conditional-compile-remove(PSTN-calls) */ alternateCallerId,
19604
+ /*@conditional-compile-remove(rooms) */ options } = args;
19598
19605
  // State update needed to rerender the parent component when a new adapter is created.
19599
19606
  const [adapter, setAdapter] = React.useState(undefined);
19600
19607
  // Ref needed for cleanup to access the old adapter created asynchronously.
@@ -19629,7 +19636,8 @@ beforeDispose) => {
19629
19636
  displayName,
19630
19637
  locator,
19631
19638
  userId,
19632
- /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId
19639
+ /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
19640
+ /* @conditional-compile-remove(rooms) */ options
19633
19641
  });
19634
19642
  if (afterCreateRef.current) {
19635
19643
  newAdapter = yield afterCreateRef.current(newAdapter);
@@ -19647,7 +19655,8 @@ beforeDispose) => {
19647
19655
  credential,
19648
19656
  displayName,
19649
19657
  locator,
19650
- userId
19658
+ userId,
19659
+ /* @conditional-compile-remove(PSTN-calls) */ options
19651
19660
  ]);
19652
19661
  // Dispose any existing adapter when the component unmounts.
19653
19662
  React.useEffect(() => {
@@ -19673,9 +19682,11 @@ beforeDispose) => {
19673
19682
  *
19674
19683
  * @public
19675
19684
  */
19676
- const createAzureCommunicationCallAdapterFromClient = (callClient, callAgent, locator) => __awaiter$4(void 0, void 0, void 0, function* () {
19685
+ const createAzureCommunicationCallAdapterFromClient = (callClient, callAgent, locator,
19686
+ /* @conditional-compile-remove(rooms) */ options) => __awaiter$4(void 0, void 0, void 0, function* () {
19677
19687
  const deviceManager = (yield callClient.getDeviceManager());
19678
- return new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager);
19688
+ /* @conditional-compile-remove(rooms) */
19689
+ return new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager, options);
19679
19690
  });
19680
19691
  const isCallError = (e) => {
19681
19692
  return e['target'] !== undefined && e['innerError'] !== undefined;