@azure/communication-react 1.3.3-alpha-202208200013.0 → 1.3.3-alpha-202208230020.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 (28) hide show
  1. package/dist/communication-react.d.ts +11 -3
  2. package/dist/dist-cjs/communication-react/index.js +85 -22
  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/ParticipantList.js +13 -6
  7. package/dist/dist-esm/react-components/src/components/ParticipantList.js.map +1 -1
  8. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +22 -6
  9. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  10. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +16 -4
  11. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js +10 -1
  12. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  13. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +1 -1
  14. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  15. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js +17 -5
  16. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallArrangement.js.map +1 -1
  17. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.d.ts +2 -0
  18. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js +12 -0
  19. package/dist/dist-esm/react-composites/src/composites/CallComposite/utils/Utils.js.map +1 -1
  20. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js +1 -1
  21. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js.map +1 -1
  22. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js +4 -2
  23. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js.map +1 -1
  24. package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.js +1 -1
  25. package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.js.map +1 -1
  26. package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.styles.js +4 -2
  27. package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.styles.js.map +1 -1
  28. package/package.json +8 -8
@@ -361,6 +361,16 @@ export declare interface BaseCustomStyles {
361
361
  export declare interface CallAdapter extends AdapterState<CallAdapterState>, Disposable, CallAdapterCallManagement, CallAdapterDeviceManagement, CallAdapterSubscribers {
362
362
  }
363
363
 
364
+ /**
365
+ * Payload for {@link CallEndedListener} containing details on the ended call.
366
+ *
367
+ * @public
368
+ */
369
+ export declare type CallAdapterCallEndedEvent = {
370
+ callId?: string;
371
+ callEndReason?: CallEndReason;
372
+ };
373
+
364
374
  /**
365
375
  * Functionality for managing the current call.
366
376
  *
@@ -1333,9 +1343,7 @@ export declare type CallControlOptions = {
1333
1343
  *
1334
1344
  * @public
1335
1345
  */
1336
- export declare type CallEndedListener = (event: {
1337
- callId: string;
1338
- }) => void;
1346
+ export declare type CallEndedListener = (event: CallAdapterCallEndedEvent) => void;
1339
1347
 
1340
1348
  /**
1341
1349
  * Error thrown from failed stateful API methods.
@@ -192,7 +192,7 @@ const fromFlatCommunicationIdentifier = (id) => {
192
192
  // Copyright (c) Microsoft Corporation.
193
193
  // Licensed under the MIT license.
194
194
  // GENERATED FILE. DO NOT EDIT MANUALLY.
195
- var telemetryVersion = '1.3.3-alpha-202208200013.0';
195
+ var telemetryVersion = '1.3.3-alpha-202208230020.0';
196
196
 
197
197
  // Copyright (c) Microsoft Corporation.
198
198
  /**
@@ -4589,14 +4589,14 @@ const getParticipantsForDefaultRender = (participants, excludeMe, myUserId) => {
4589
4589
  * @public
4590
4590
  */
4591
4591
  const ParticipantList = (props) => {
4592
- var _a, _b;
4592
+ var _a, _b, _c, _d;
4593
4593
  const { excludeMe = false, myUserId, participants, onRemoveParticipant, onRenderAvatar, onRenderParticipant, onFetchParticipantMenuItems, showParticipantOverflowTooltip } = props;
4594
4594
  const ids = useIdentifiers();
4595
4595
  const strings = useLocale$1().strings.participantItem;
4596
4596
  const displayedParticipants = React.useMemo(() => {
4597
4597
  return onRenderParticipant ? participants : getParticipantsForDefaultRender(participants, excludeMe, myUserId);
4598
4598
  }, [participants, excludeMe, myUserId, onRenderParticipant]);
4599
- const createParticipantMenuItems = (participant) => {
4599
+ const createParticipantMenuItems = React.useCallback((participant) => {
4600
4600
  var _a, _b;
4601
4601
  let menuItems = [];
4602
4602
  let disabled = !participant.isRemovable;
@@ -4620,9 +4620,16 @@ const ParticipantList = (props) => {
4620
4620
  menuItems = onFetchParticipantMenuItems(participant.userId, myUserId, menuItems);
4621
4621
  }
4622
4622
  return menuItems;
4623
- };
4624
- const participantItemStyles = react.merge(participantListItemStyle, (_a = props.styles) === null || _a === void 0 ? void 0 : _a.participantItemStyles);
4625
- return (React__default['default'].createElement(react.Stack, { "data-ui-id": ids.participantList, className: react.mergeStyles(participantListStyle$1, (_b = props.styles) === null || _b === void 0 ? void 0 : _b.root) }, displayedParticipants.map((participant) => onRenderParticipant
4623
+ }, [
4624
+ ids.participantListRemoveParticipantButton,
4625
+ myUserId,
4626
+ onFetchParticipantMenuItems,
4627
+ onRemoveParticipant,
4628
+ (_b = (_a = props.styles) === null || _a === void 0 ? void 0 : _a.participantItemStyles) === null || _b === void 0 ? void 0 : _b.participantSubMenuItemsStyles,
4629
+ strings.removeButtonLabel
4630
+ ]);
4631
+ const participantItemStyles = React.useMemo(() => { var _a; return react.merge(participantListItemStyle, (_a = props.styles) === null || _a === void 0 ? void 0 : _a.participantItemStyles); }, [(_c = props.styles) === null || _c === void 0 ? void 0 : _c.participantItemStyles]);
4632
+ return (React__default['default'].createElement(react.Stack, { "data-ui-id": ids.participantList, className: react.mergeStyles(participantListStyle$1, (_d = props.styles) === null || _d === void 0 ? void 0 : _d.root) }, displayedParticipants.map((participant) => onRenderParticipant
4626
4633
  ? onRenderParticipant(participant)
4627
4634
  : onRenderParticipantDefault(participant, strings, myUserId, onRenderAvatar, createParticipantMenuItems, participantItemStyles, props.onParticipantClick, showParticipantOverflowTooltip))));
4628
4635
  };
@@ -14347,6 +14354,19 @@ const adaptCompositeState = (compositeState) => {
14347
14354
  compositeState.latestErrors, compositeState.displayName);
14348
14355
  };
14349
14356
 
14357
+ // Copyright (c) Microsoft Corporation.
14358
+ // Licensed under the MIT license.
14359
+ /**
14360
+ * Subset of CallCompositePages that represent an end call state.
14361
+ * @private
14362
+ */
14363
+ const END_CALL_PAGES = [
14364
+ 'accessDeniedTeamsMeeting',
14365
+ 'joinCallFailedDueToNoNetwork',
14366
+ 'leftCall',
14367
+ 'removedFromCall'
14368
+ ];
14369
+
14350
14370
  // Copyright (c) Microsoft Corporation.
14351
14371
  const ACCESS_DENIED_TEAMS_MEETING_SUB_CODE = 5854;
14352
14372
  const REMOVED_FROM_CALL_SUB_CODES = [5000, 5300];
@@ -14462,6 +14482,17 @@ const getCallCompositePage = (call, previousCall) => {
14462
14482
  // No call state - show starting page (configuration)
14463
14483
  return 'configuration';
14464
14484
  };
14485
+ /** @private */
14486
+ const IsCallEndedPage = (
14487
+ /**
14488
+ * Explicitly listing the pages of this function intentionally.
14489
+ * This protects against adding a new composite page that should be marked as an callEndedPage.
14490
+ * EndCallPages are used to trigger onCallEnded events so this could easily be missed.
14491
+ * When you add a new composite page this will throw a compiler error. If this new page is an
14492
+ * EndCallPage ensure you update the END_CALL_PAGES. Afterwards update the `page` parameter
14493
+ * type below to allow your new page, i.e. add `| <your new page>
14494
+ */
14495
+ page) => END_CALL_PAGES.includes(page);
14465
14496
  /**
14466
14497
  * Creates a new call control options object and sets the correct values for disabling
14467
14498
  * the buttons provided in the `disabledControls` array.
@@ -14944,9 +14975,11 @@ const themedDialpadStyle$1 = (isMobile, theme) => ({
14944
14975
  field: {
14945
14976
  backgroundColor: theme.palette.white,
14946
14977
  fontSize: theme.fonts.large.fontSize,
14947
- padding: '1.063rem 0.5rem',
14978
+ padding: '0 0.5rem ',
14948
14979
  textAlign: 'center',
14949
- paddingTop: 0
14980
+ ':active': {
14981
+ padding: '0 0.5rem'
14982
+ }
14950
14983
  }
14951
14984
  },
14952
14985
  primaryContent: {
@@ -15016,7 +15049,7 @@ const SendDtmfDialpad = (props) => {
15016
15049
  return (React__default['default'].createElement(React__default['default'].Fragment, null, React__default['default'].createElement(react.Modal, { titleAriaId: strings.dialpadModalAriaLabel, isOpen: showDialpad, onDismiss: onDismissTriggered, isBlocking: true, styles: dialpadModalStyle },
15017
15050
  React__default['default'].createElement(react.Stack, { horizontal: true, horizontalAlign: "end", verticalAlign: "center" },
15018
15051
  React__default['default'].createElement(react.IconButton, { iconProps: { iconName: 'Cancel' }, ariaLabel: strings.dialpadCloseModalButtonAriaLabel, onClick: onDismissTriggered, style: { color: theme.palette.black } })),
15019
- React__default['default'].createElement(react.Stack, null,
15052
+ React__default['default'].createElement(react.Stack, { style: { overflow: 'hidden' } },
15020
15053
  React__default['default'].createElement(Dialpad, Object.assign({ styles: dialpadStyle }, dialpadProps, { showDeleteButton: false, strings: strings }))))));
15021
15054
  };
15022
15055
 
@@ -15616,9 +15649,11 @@ const themedDialpadStyle = (isMobile, theme) => ({
15616
15649
  field: {
15617
15650
  backgroundColor: theme.palette.white,
15618
15651
  fontSize: theme.fonts.large.fontSize,
15619
- padding: '1.063rem 0.5rem',
15652
+ padding: '0 0.5rem',
15620
15653
  textAlign: isMobile ? 'center' : 'left',
15621
- paddingTop: 0
15654
+ ':active': {
15655
+ padding: '0 0.5rem'
15656
+ }
15622
15657
  }
15623
15658
  },
15624
15659
  primaryContent: {
@@ -15680,7 +15715,7 @@ const CallingDialpad = (props) => {
15680
15715
  React__default['default'].createElement(react.Stack, { horizontal: true, horizontalAlign: "space-between", verticalAlign: "center" },
15681
15716
  React__default['default'].createElement(react.Text, null, strings.dialpadModalTitle),
15682
15717
  React__default['default'].createElement(react.IconButton, { iconProps: { iconName: 'Cancel' }, ariaLabel: strings.dialpadCloseModalButtonAriaLabel, onClick: onDismissTriggered, style: { color: theme.palette.black } })),
15683
- React__default['default'].createElement(react.Stack, null, dialpadComponent()))));
15718
+ React__default['default'].createElement(react.Stack, { style: { overflow: 'hidden' } }, dialpadComponent()))));
15684
15719
  };
15685
15720
  function DialpadStartCallIconTrampoline() {
15686
15721
  /* @conditional-compile-remove(PSTN-calls) */
@@ -16141,7 +16176,7 @@ const textStyle = (theme) => {
16141
16176
  * @private
16142
16177
  */
16143
16178
  const CallArrangement = (props) => {
16144
- var _a;
16179
+ var _a, _b;
16145
16180
  const containerClassName = React.useMemo(() => {
16146
16181
  return props.mobileView ? containerStyleMobile : containerStyleDesktop;
16147
16182
  }, [props.mobileView]);
@@ -16188,13 +16223,25 @@ const CallArrangement = (props) => {
16188
16223
  return callCompositeContainerCSS;
16189
16224
  };
16190
16225
  /* @conditional-compile-remove(one-to-n-calling) */
16191
- const callPaneContent = () => {
16226
+ const callPaneContent = React.useCallback(() => {
16192
16227
  var _a;
16193
- if (adapter && _isInCall(callStatus)) {
16228
+ if (adapter && _isInCall(callStatus) && activePane === 'people') {
16194
16229
  return (React__default['default'].createElement(CallPane, { callAdapter: adapter, onClose: closePane, onFetchAvatarPersonaData: props.onFetchAvatarPersonaData, onFetchParticipantMenuItems: (_a = props.callControlProps) === null || _a === void 0 ? void 0 : _a.onFetchParticipantMenuItems, onPeopleButtonClicked: showShowPeopleTabHeaderButton$1(props.callControlProps.options) ? selectPeople : undefined, modalLayerHostId: props.modalLayerHostId, activePane: activePane, mobileView: props.mobileView, inviteLink: props.callControlProps.callInvitationURL }));
16195
16230
  }
16196
16231
  return React__default['default'].createElement(React__default['default'].Fragment, null);
16197
- };
16232
+ }, [
16233
+ activePane,
16234
+ adapter,
16235
+ callStatus,
16236
+ closePane,
16237
+ props.callControlProps.callInvitationURL,
16238
+ (_a = props.callControlProps) === null || _a === void 0 ? void 0 : _a.onFetchParticipantMenuItems,
16239
+ props.callControlProps.options,
16240
+ props.mobileView,
16241
+ props.modalLayerHostId,
16242
+ props.onFetchAvatarPersonaData,
16243
+ selectPeople
16244
+ ]);
16198
16245
  return (React__default['default'].createElement("div", { ref: containerRef, className: react.mergeStyles(containerDivStyles) },
16199
16246
  React__default['default'].createElement(react.Stack, { verticalFill: true, horizontalAlign: "stretch", className: containerClassName, "data-ui-id": props.dataUiId },
16200
16247
  React__default['default'].createElement(react.Stack, { horizontal: true, grow: true },
@@ -16207,7 +16254,7 @@ const CallArrangement = (props) => {
16207
16254
  React__default['default'].createElement(react.Stack.Item, { grow: true, style: callCompositeContainerFlex() },
16208
16255
  React__default['default'].createElement(react.Stack.Item, { styles: callGalleryStyles, grow: true }, props.onRenderGalleryContent && (React__default['default'].createElement(react.Stack, { verticalFill: true, styles: mediaGalleryContainerStyles }, props.onRenderGalleryContent())))),
16209
16256
  callPaneContent()),
16210
- ((_a = props.callControlProps) === null || _a === void 0 ? void 0 : _a.options) !== false &&
16257
+ ((_b = props.callControlProps) === null || _b === void 0 ? void 0 : _b.options) !== false &&
16211
16258
  /* @conditional-compile-remove(one-to-n-calling) */ !isMobileWithActivePane && (React__default['default'].createElement(react.Stack.Item, { className: callControlsContainerStyles },
16212
16259
  React__default['default'].createElement(CallControls, Object.assign({}, props.callControlProps, { containerWidth: containerWidth, containerHeight: containerHeight, isMobile: props.mobileView,
16213
16260
  /* @conditional-compile-remove(one-to-n-calling) */
@@ -17481,11 +17528,29 @@ class CallContext {
17481
17528
  setCurrentCallId(callId) {
17482
17529
  this.callId = callId;
17483
17530
  }
17531
+ onCallEnded(handler) {
17532
+ this.emitter.on('callEnded', handler);
17533
+ }
17534
+ offCallEnded(handler) {
17535
+ this.emitter.off('callEnded', handler);
17536
+ }
17484
17537
  updateClientState(clientState) {
17485
- var _a;
17538
+ var _a, _b, _c;
17486
17539
  const call = this.callId ? clientState.calls[this.callId] : undefined;
17487
17540
  const latestEndedCall = findLatestEndedCall(clientState.callsEnded);
17488
- this.setState(Object.assign(Object.assign({}, this.state), { userId: clientState.userId, displayName: (_a = clientState.callAgent) === null || _a === void 0 ? void 0 : _a.displayName, call, page: getCallCompositePage(call, latestEndedCall), endedCall: latestEndedCall, devices: clientState.deviceManager, latestErrors: clientState.latestErrors }));
17541
+ // As the state is transitioning to a new state, trigger appropriate callback events.
17542
+ const oldPage = this.state.page;
17543
+ const newPage = getCallCompositePage(call, latestEndedCall);
17544
+ if (!IsCallEndedPage(oldPage) && IsCallEndedPage(newPage)) {
17545
+ this.emitter.emit('callEnded', {
17546
+ callId: this.callId,
17547
+ callEndedCode: (_a = latestEndedCall === null || latestEndedCall === void 0 ? void 0 : latestEndedCall.callEndReason) === null || _a === void 0 ? void 0 : _a.code,
17548
+ callEndedSubCode: (_b = latestEndedCall === null || latestEndedCall === void 0 ? void 0 : latestEndedCall.callEndReason) === null || _b === void 0 ? void 0 : _b.subCode
17549
+ });
17550
+ }
17551
+ if (this.state.page) {
17552
+ this.setState(Object.assign(Object.assign({}, this.state), { userId: clientState.userId, displayName: (_c = clientState.callAgent) === null || _c === void 0 ? void 0 : _c.displayName, call, page: newPage, endedCall: latestEndedCall, devices: clientState.deviceManager, latestErrors: clientState.latestErrors }));
17553
+ }
17489
17554
  }
17490
17555
  }
17491
17556
  const findLatestEndedCall = (calls) => {
@@ -17523,6 +17588,7 @@ class AzureCommunicationCallAdapter {
17523
17588
  this.deviceManager = deviceManager;
17524
17589
  const isTeamsMeeting = 'meetingLink' in this.locator;
17525
17590
  this.context = new CallContext(callClient.getState(), isTeamsMeeting);
17591
+ this.context.onCallEnded((endCallData) => this.emitter.emit('callEnded', endCallData));
17526
17592
  const onStateChange = (clientState) => {
17527
17593
  var _a;
17528
17594
  // unsubscribe when the instance gets disposed
@@ -17695,9 +17761,7 @@ class AzureCommunicationCallAdapter {
17695
17761
  });
17696
17762
  }
17697
17763
  leaveCall() {
17698
- var _a;
17699
17764
  return __awaiter$4(this, void 0, void 0, function* () {
17700
- const callId = (_a = this.call) === null || _a === void 0 ? void 0 : _a.id;
17701
17765
  yield this.handlers.onHangUp();
17702
17766
  this.unsubscribeCallEvents();
17703
17767
  this.call = undefined;
@@ -17707,7 +17771,6 @@ class AzureCommunicationCallAdapter {
17707
17771
  this.context.updateClientState(this.callClient.getState());
17708
17772
  this.stopCamera();
17709
17773
  this.mute();
17710
- this.emitter.emit('callEnded', { callId });
17711
17774
  });
17712
17775
  }
17713
17776
  setCamera(device, options) {