@azure/communication-react 1.4.2-alpha-202211090017.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.
Files changed (29) hide show
  1. package/dist/communication-react.d.ts +23 -10
  2. package/dist/dist-cjs/communication-react/index.js +77 -23
  3. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  5. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  6. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js +1 -1
  7. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js.map +1 -1
  8. package/dist/dist-esm/react-components/src/theming/icons.d.ts +1 -1
  9. package/dist/dist-esm/react-components/src/theming/icons.js +3 -3
  10. package/dist/dist-esm/react-components/src/theming/icons.js.map +1 -1
  11. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +0 -7
  12. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js +2 -2
  13. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  14. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +19 -3
  15. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +24 -12
  16. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  17. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +7 -0
  18. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  19. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js +12 -2
  20. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/ConfigurationPage.js.map +1 -1
  21. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +8 -0
  22. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +26 -0
  23. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  24. package/dist/dist-esm/react-composites/src/composites/common/BaseComposite.js +10 -1
  25. package/dist/dist-esm/react-composites/src/composites/common/BaseComposite.js.map +1 -1
  26. package/dist/dist-esm/react-composites/src/composites/common/icons.d.ts +1 -1
  27. package/dist/dist-esm/react-composites/src/composites/common/icons.js +2 -2
  28. package/dist/dist-esm/react-composites/src/composites/common/icons.js.map +1 -1
  29. package/package.json +8 -8
@@ -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
@@ -4336,7 +4349,7 @@ export declare const DEFAULT_COMPONENT_ICONS: {
4336
4349
  SendBoxSend: JSX.Element;
4337
4350
  SendBoxSendHovered: JSX.Element;
4338
4351
  VideoTileMicOff: JSX.Element;
4339
- BackSpace: JSX.Element;
4352
+ DialpadBackspace: JSX.Element;
4340
4353
  DomainPermissionsSparkle: JSX.Element;
4341
4354
  DomainPermissionCamera: JSX.Element;
4342
4355
  DomainPermissionMic: JSX.Element;
@@ -4431,7 +4444,7 @@ export declare const DEFAULT_COMPOSITE_ICONS: {
4431
4444
  HoldCallContextualMenuItem: JSX.Element;
4432
4445
  HoldCallButton: JSX.Element;
4433
4446
  ResumeCall: JSX.Element;
4434
- BackSpace: JSX.Element;
4447
+ DialpadBackspace: JSX.Element;
4435
4448
  DomainPermissionsSparkle: JSX.Element;
4436
4449
  DomainPermissionCamera: JSX.Element;
4437
4450
  DomainPermissionMic: JSX.Element;
@@ -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-202211090017.0';
205
+ var telemetryVersion = '1.4.2-alpha-202211110018.0';
206
206
 
207
207
  // Copyright (c) Microsoft Corporation.
208
208
  /**
@@ -2147,7 +2147,7 @@ const DEFAULT_COMPONENT_ICONS = {
2147
2147
  SendBoxSendHovered: React__default['default'].createElement(reactIcons.Send20Filled, null),
2148
2148
  VideoTileMicOff: React__default['default'].createElement(reactIcons.MicOff16Filled, null),
2149
2149
  /* @conditional-compile-remove(dialpad) */ /* @conditional-compile-remove(PSTN-calls) */
2150
- BackSpace: React__default['default'].createElement(reactIcons.Backspace20Regular, null),
2150
+ DialpadBackspace: React__default['default'].createElement(reactIcons.Backspace20Regular, null),
2151
2151
  /* @conditional-compile-remove(call-readiness) */
2152
2152
  DomainPermissionsSparkle: React__default['default'].createElement(DomainPermissionSparkle20Filled, null),
2153
2153
  /* @conditional-compile-remove(call-readiness) */
@@ -8347,7 +8347,7 @@ const DialpadContainer = (props) => {
8347
8347
  setText(e.target.value);
8348
8348
  }, placeholder: props.strings.placeholderText, "data-test-id": "dialpad-input", onRenderSuffix: () => {
8349
8349
  var _a;
8350
- return (React__default['default'].createElement(React__default['default'].Fragment, null, showDeleteButton && plainTextValue.length !== 0 && (React__default['default'].createElement(react.IconButton, { ariaLabel: props.strings.deleteButtonAriaLabel, onClick: deleteNumbers, styles: react.concatStyleSets(iconButtonStyles(theme), (_a = props.styles) === null || _a === void 0 ? void 0 : _a.deleteIcon), iconProps: { iconName: 'BackSpace' } }))));
8350
+ return (React__default['default'].createElement(React__default['default'].Fragment, null, showDeleteButton && plainTextValue.length !== 0 && (React__default['default'].createElement(react.IconButton, { ariaLabel: props.strings.deleteButtonAriaLabel, onClick: deleteNumbers, styles: react.concatStyleSets(iconButtonStyles(theme), (_a = props.styles) === null || _a === void 0 ? void 0 : _a.deleteIcon), iconProps: { iconName: 'DialpadBackspace' } }))));
8351
8351
  } }),
8352
8352
  React__default['default'].createElement(react.FocusZone, null, dialPadButtonsDefault.map((rows, rowIndex) => {
8353
8353
  return (React__default['default'].createElement(react.Stack, { horizontal: true, key: `row_${rowIndex}`, horizontalAlign: "stretch" }, rows.map((button, columnIndex) => (React__default['default'].createElement(DialpadButton, { key: `button_${columnIndex}`,
@@ -13613,8 +13613,8 @@ const coffeeIconStyle = {
13613
13613
  * @public
13614
13614
  */
13615
13615
  const COMPOSITE_ONLY_ICONS = {
13616
- ChevronLeft: React__default['default'].createElement(react.FontIcon, { iconName: "ChevronLeft" }),
13617
- Link: React__default['default'].createElement(react.FontIcon, { iconName: "Link" }),
13616
+ ChevronLeft: undefined,
13617
+ Link: undefined,
13618
13618
  LobbyScreenConnectingToCall: React__default['default'].createElement(CoffeeIcon, null),
13619
13619
  LobbyScreenWaitingToBeAdmitted: React__default['default'].createElement(CoffeeIcon, null),
13620
13620
  LocalDeviceSettingsCamera: React__default['default'].createElement(reactIcons.Video20Filled, null),
@@ -14582,11 +14582,20 @@ const BaseProvider = (props) => {
14582
14582
  if (alreadyWrapped) {
14583
14583
  return React__default['default'].createElement(React__default['default'].Fragment, null, props.children);
14584
14584
  }
14585
+ /**
14586
+ * Before registering fluent icons, we should check DEFAULT_COMPOSITE_ICONS and strip out the key value pairs where value is undefined
14587
+ */
14588
+ const iconsToRegister = {};
14589
+ Object.entries(DEFAULT_COMPOSITE_ICONS).forEach(([key, value]) => {
14590
+ if (value) {
14591
+ iconsToRegister[key] = value;
14592
+ }
14593
+ });
14585
14594
  /**
14586
14595
  * We register the default icon mappings merged with custom icons provided through props
14587
14596
  * to ensure all icons render correctly.
14588
14597
  */
14589
- react.registerIcons({ icons: Object.assign(Object.assign({}, DEFAULT_COMPOSITE_ICONS), props.icons) });
14598
+ react.registerIcons({ icons: Object.assign(Object.assign({}, iconsToRegister), props.icons) });
14590
14599
  // we use Customizer to override default LayerHost injected to <body />
14591
14600
  // which stop polluting global dom tree and increase compatibility with react-full-screen
14592
14601
  const CompositeElement = (React__default['default'].createElement(FluentThemeProvider, { fluentTheme: fluentTheme, rtl: rtl },
@@ -15551,6 +15560,32 @@ const isDisabled$2 = (option) => {
15551
15560
  }
15552
15561
  return option.disabled;
15553
15562
  };
15563
+ /* @conditional-compile-remove(call-readiness) */
15564
+ /**
15565
+ *
15566
+ * This function uses permission API to determine if device permission state is granted, prompt or denied
15567
+ * @returns whether device permission state is granted, prompt or denied
15568
+ * If permission API is not supported on this browser, do nothing and log out error
15569
+ * @private
15570
+ */
15571
+ const getDevicePermissionState = (setVideoState, setAudioState) => {
15572
+ navigator.permissions
15573
+ .query({ name: 'camera' })
15574
+ .then((result) => {
15575
+ setVideoState(result.state);
15576
+ })
15577
+ .catch((error) => {
15578
+ console.log(error);
15579
+ });
15580
+ navigator.permissions
15581
+ .query({ name: 'microphone' })
15582
+ .then((result) => {
15583
+ setAudioState(result.state);
15584
+ })
15585
+ .catch((error) => {
15586
+ console.log(error);
15587
+ });
15588
+ };
15554
15589
 
15555
15590
  // Copyright (c) Microsoft Corporation.
15556
15591
  // Licensed under the MIT license.
@@ -18215,6 +18250,13 @@ const ConfigurationPage = (props) => {
18215
18250
  const options = useAdaptedSelector(getSelector$1(DevicesButton));
18216
18251
  const localDeviceSettingsHandlers = useHandlers();
18217
18252
  const { video: cameraPermissionGranted, audio: microphonePermissionGranted } = useSelector$1(devicePermissionSelector);
18253
+ /* @conditional-compile-remove(call-readiness) */
18254
+ // use permission API to get video and audio permission state
18255
+ const [videoState, setVideoState] = React.useState(undefined);
18256
+ /* @conditional-compile-remove(call-readiness) */
18257
+ const [audioState, setAudioState] = React.useState(undefined);
18258
+ /* @conditional-compile-remove(call-readiness) */
18259
+ getDevicePermissionState(setVideoState, setAudioState);
18218
18260
  let errorBarProps = usePropsFor$1(ErrorBar);
18219
18261
  const adapter = useAdapter();
18220
18262
  const deviceState = adapter.getState().devices;
@@ -18251,8 +18293,9 @@ const ConfigurationPage = (props) => {
18251
18293
  mobileWithPreview = mobileWithPreview && rolePermissions.cameraButton;
18252
18294
  /* @conditional-compile-remove(call-readiness) */
18253
18295
  const permissionsState = {
18254
- camera: cameraPermissionGranted ? 'granted' : 'denied',
18255
- microphone: microphonePermissionGranted ? 'granted' : 'denied'
18296
+ // fall back to using cameraPermissionGranted and microphonePermissionGranted if permission API is not supported
18297
+ camera: videoState !== null && videoState !== void 0 ? videoState : (cameraPermissionGranted ? 'granted' : 'denied'),
18298
+ microphone: audioState !== null && audioState !== void 0 ? audioState : (microphonePermissionGranted ? 'granted' : 'denied')
18256
18299
  };
18257
18300
  /* @conditional-compile-remove(call-readiness) */
18258
18301
  const networkErrors = errorBarProps.activeErrorMessages.filter((message) => message.type === 'callNetworkQualityLow');
@@ -18806,9 +18849,9 @@ const MainScreen = (props) => {
18806
18849
  * @public
18807
18850
  */
18808
18851
  const CallComposite = (props) => {
18809
- const { adapter, callInvitationUrl, onFetchAvatarPersonaData, onFetchParticipantMenuItems, options, formFactor = 'desktop',
18852
+ const { adapter, callInvitationUrl, onFetchAvatarPersonaData, onFetchParticipantMenuItems, options, formFactor = 'desktop' } = props;
18810
18853
  /* @conditional-compile-remove(rooms) */
18811
- roleHint } = props;
18854
+ const roleHint = adapter.getState().roleHint;
18812
18855
  React.useEffect(() => {
18813
18856
  (() => __awaiter$5(void 0, void 0, void 0, function* () {
18814
18857
  var _a;
@@ -18963,8 +19006,8 @@ var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments,
18963
19006
  };
18964
19007
  /** Context of call, which is a centralized context for all state updates */
18965
19008
  class CallContext {
18966
- constructor(clientState, isTeamsCall, maxListeners = 50) {
18967
- var _a;
19009
+ constructor(clientState, isTeamsCall, options) {
19010
+ var _a, _b;
18968
19011
  this.emitter = new EventEmitter.EventEmitter();
18969
19012
  this.state = {
18970
19013
  isLocalPreviewMicrophoneEnabled: false,
@@ -18975,9 +19018,10 @@ class CallContext {
18975
19018
  page: 'configuration',
18976
19019
  latestErrors: clientState.latestErrors,
18977
19020
  isTeamsCall,
18978
- /* @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
18979
19023
  };
18980
- this.emitter.setMaxListeners(maxListeners);
19024
+ this.emitter.setMaxListeners((_b = options === null || options === void 0 ? void 0 : options.maxListeners) !== null && _b !== void 0 ? _b : 50);
18981
19025
  }
18982
19026
  onStateChange(handler) {
18983
19027
  this.emitter.on('stateChanged', handler);
@@ -19042,7 +19086,8 @@ const findLatestEndedCall = (calls) => {
19042
19086
  * @private
19043
19087
  */
19044
19088
  class AzureCommunicationCallAdapter {
19045
- constructor(callClient, locator, callAgent, deviceManager) {
19089
+ constructor(callClient, locator, callAgent, deviceManager,
19090
+ /* @conditional-compile-remove(rooms) */ options) {
19046
19091
  this.participantSubscribers = new Map();
19047
19092
  this.emitter = new EventEmitter.EventEmitter();
19048
19093
  this.isMyMutedChanged = () => {
@@ -19058,7 +19103,8 @@ class AzureCommunicationCallAdapter {
19058
19103
  this.locator = locator;
19059
19104
  this.deviceManager = deviceManager;
19060
19105
  const isTeamsMeeting = 'meetingLink' in this.locator;
19061
- this.context = new CallContext(callClient.getState(), isTeamsMeeting);
19106
+ this.context = new CallContext(callClient.getState(), isTeamsMeeting,
19107
+ /* @conditional-compile-remove(rooms) */ options);
19062
19108
  this.context.onCallEnded((endCallData) => this.emitter.emit('callEnded', endCallData));
19063
19109
  const onStateChange = (clientState) => {
19064
19110
  var _a;
@@ -19506,7 +19552,8 @@ class AzureCommunicationCallAdapter {
19506
19552
  * @public
19507
19553
  */
19508
19554
  const createAzureCommunicationCallAdapter = ({ userId, displayName, credential, locator,
19509
- /* @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* () {
19510
19557
  const callClient = createStatefulCallClient({
19511
19558
  userId,
19512
19559
  /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId
@@ -19514,7 +19561,8 @@ const createAzureCommunicationCallAdapter = ({ userId, displayName, credential,
19514
19561
  const callAgent = yield callClient.createCallAgent(credential, {
19515
19562
  displayName
19516
19563
  });
19517
- const adapter = createAzureCommunicationCallAdapterFromClient(callClient, callAgent, locator);
19564
+ const adapter = createAzureCommunicationCallAdapterFromClient(callClient, callAgent, locator,
19565
+ /* @conditional-compile-remove(rooms) */ options);
19518
19566
  return adapter;
19519
19567
  });
19520
19568
  /**
@@ -19551,7 +19599,9 @@ afterCreate,
19551
19599
  * This is useful for clean up tasks, e.g., leaving any ongoing calls.
19552
19600
  */
19553
19601
  beforeDispose) => {
19554
- 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;
19555
19605
  // State update needed to rerender the parent component when a new adapter is created.
19556
19606
  const [adapter, setAdapter] = React.useState(undefined);
19557
19607
  // Ref needed for cleanup to access the old adapter created asynchronously.
@@ -19586,7 +19636,8 @@ beforeDispose) => {
19586
19636
  displayName,
19587
19637
  locator,
19588
19638
  userId,
19589
- /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId
19639
+ /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
19640
+ /* @conditional-compile-remove(rooms) */ options
19590
19641
  });
19591
19642
  if (afterCreateRef.current) {
19592
19643
  newAdapter = yield afterCreateRef.current(newAdapter);
@@ -19604,7 +19655,8 @@ beforeDispose) => {
19604
19655
  credential,
19605
19656
  displayName,
19606
19657
  locator,
19607
- userId
19658
+ userId,
19659
+ /* @conditional-compile-remove(PSTN-calls) */ options
19608
19660
  ]);
19609
19661
  // Dispose any existing adapter when the component unmounts.
19610
19662
  React.useEffect(() => {
@@ -19630,9 +19682,11 @@ beforeDispose) => {
19630
19682
  *
19631
19683
  * @public
19632
19684
  */
19633
- 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* () {
19634
19687
  const deviceManager = (yield callClient.getDeviceManager());
19635
- return new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager);
19688
+ /* @conditional-compile-remove(rooms) */
19689
+ return new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager, options);
19636
19690
  });
19637
19691
  const isCallError = (e) => {
19638
19692
  return e['target'] !== undefined && e['innerError'] !== undefined;