@azure/communication-react 1.3.3-alpha-202208270015.0 → 1.3.3-alpha-202208310017.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 (33) hide show
  1. package/dist/communication-react.d.ts +4 -2
  2. package/dist/dist-cjs/communication-react/index.js +59 -45
  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.d.ts +4 -2
  7. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js +19 -23
  8. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js.map +1 -1
  9. package/dist/dist-esm/react-components/src/components/styles/Dialpad.styles.d.ts +2 -2
  10. package/dist/dist-esm/react-components/src/components/styles/Dialpad.styles.js +2 -2
  11. package/dist/dist-esm/react-components/src/components/styles/Dialpad.styles.js.map +1 -1
  12. package/dist/dist-esm/react-components/src/components/utils/useLongPress.d.ts +1 -1
  13. package/dist/dist-esm/react-components/src/components/utils/useLongPress.js +8 -1
  14. package/dist/dist-esm/react-components/src/components/utils/useLongPress.js.map +1 -1
  15. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js +18 -11
  16. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallControls.js.map +1 -1
  17. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js +4 -2
  18. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatComposite.js.map +1 -1
  19. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatControlBar.d.ts +1 -1
  20. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/CallWithChatControlBar.js.map +1 -1
  21. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/PreparedMoreDrawer.d.ts +1 -1
  22. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/PreparedMoreDrawer.js.map +1 -1
  23. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/components/MoreDrawer.js +1 -0
  24. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/components/MoreDrawer.js.map +1 -1
  25. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js +1 -1
  26. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.js.map +1 -1
  27. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js +1 -2
  28. package/dist/dist-esm/react-composites/src/composites/common/CallingDialpad.styles.js.map +1 -1
  29. package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.js +7 -3
  30. package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.js.map +1 -1
  31. package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.styles.js +1 -1
  32. package/dist/dist-esm/react-composites/src/composites/common/SendDtmfDialpad.styles.js.map +1 -1
  33. package/package.json +8 -8
@@ -4237,6 +4237,8 @@ export declare interface DialpadProps {
4237
4237
  onChange?: (input: string) => void;
4238
4238
  /** boolean input to determine when to show/hide delete button, default true */
4239
4239
  showDeleteButton?: boolean;
4240
+ /** boolean input to determine if dialpad is in mobile view, default false */
4241
+ isMobile?: boolean;
4240
4242
  styles?: DialpadStyles;
4241
4243
  }
4242
4244
 
@@ -4259,8 +4261,8 @@ export declare interface DialpadStyles {
4259
4261
  root?: IStyle;
4260
4262
  button?: IButtonStyles;
4261
4263
  textField?: Partial<ITextFieldStyles>;
4262
- primaryContent?: IStyle;
4263
- secondaryContent?: IStyle;
4264
+ digit?: IStyle;
4265
+ letter?: IStyle;
4264
4266
  deleteIcon?: IButtonStyles;
4265
4267
  }
4266
4268
 
@@ -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-202208270015.0';
195
+ var telemetryVersion = '1.3.3-alpha-202208310017.0';
196
196
 
197
197
  // Copyright (c) Microsoft Corporation.
198
198
  /**
@@ -7722,7 +7722,7 @@ const buttonStyles = (theme) => ({
7722
7722
  /**
7723
7723
  * @private
7724
7724
  */
7725
- const primaryContentStyles = (theme) => {
7725
+ const digitStyles = (theme) => {
7726
7726
  return {
7727
7727
  fontSize: '1.25rem',
7728
7728
  fontWeight: theme.fonts.medium.fontWeight,
@@ -7758,7 +7758,7 @@ const textFieldStyles = (theme) => ({
7758
7758
  /**
7759
7759
  * @private
7760
7760
  */
7761
- const secondaryContentStyles = (theme) => {
7761
+ const letterStyles = (theme) => {
7762
7762
  return {
7763
7763
  fontSize: '0.625rem',
7764
7764
  color: `${theme.palette.neutralSecondary}`,
@@ -7824,7 +7824,7 @@ const formatPhoneNumber = (phoneNumber) => {
7824
7824
  /**
7825
7825
  * @private
7826
7826
  */
7827
- function useLongPress(onClick, onLongPress) {
7827
+ function useLongPress(onClick, onLongPress, isMobile) {
7828
7828
  const timerRef = React.useRef();
7829
7829
  const [isLongPress, setIsLongPress] = React.useState(false);
7830
7830
  const [action, setAction] = React.useState(false);
@@ -7835,6 +7835,10 @@ function useLongPress(onClick, onLongPress) {
7835
7835
  }, 500);
7836
7836
  }
7837
7837
  function handleOnClick() {
7838
+ // when it's mobile use ontouchstart and ontouchend to fire onclick and onlongpress event
7839
+ if (isMobile) {
7840
+ return;
7841
+ }
7838
7842
  onClick();
7839
7843
  if (isLongPress) {
7840
7844
  onLongPress();
@@ -7861,6 +7865,9 @@ function useLongPress(onClick, onLongPress) {
7861
7865
  startPressTimer();
7862
7866
  }
7863
7867
  function handleOnTouchEnd() {
7868
+ if (isMobile) {
7869
+ isLongPress ? onLongPress() : onClick();
7870
+ }
7864
7871
  timerRef.current && clearTimeout(timerRef.current);
7865
7872
  }
7866
7873
  return {
@@ -7888,22 +7895,18 @@ var __awaiter$p = (window && window.__awaiter) || function (thisArg, _arguments,
7888
7895
  });
7889
7896
  };
7890
7897
  const dialPadButtonsDefault = [
7898
+ [{ digit: '1' }, { digit: '2', letter: 'ABC' }, { digit: '3', letter: 'DEF' }],
7891
7899
  [
7892
- { primaryContent: '1' },
7893
- { primaryContent: '2', secondaryContent: 'ABC' },
7894
- { primaryContent: '3', secondaryContent: 'DEF' }
7900
+ { digit: '4', letter: 'GHI' },
7901
+ { digit: '5', letter: 'JKL' },
7902
+ { digit: '6', letter: 'MNO' }
7895
7903
  ],
7896
7904
  [
7897
- { primaryContent: '4', secondaryContent: 'GHI' },
7898
- { primaryContent: '5', secondaryContent: 'JKL' },
7899
- { primaryContent: '6', secondaryContent: 'MNO' }
7905
+ { digit: '7', letter: 'PQRS' },
7906
+ { digit: '8', letter: 'TUV' },
7907
+ { digit: '9', letter: 'WXYZ' }
7900
7908
  ],
7901
- [
7902
- { primaryContent: '7', secondaryContent: 'PQRS' },
7903
- { primaryContent: '8', secondaryContent: 'TUV' },
7904
- { primaryContent: '9', secondaryContent: 'WXYZ' }
7905
- ],
7906
- [{ primaryContent: '*' }, { primaryContent: '0', secondaryContent: '+' }, { primaryContent: '#' }]
7909
+ [{ digit: '*' }, { digit: '0', letter: '+' }, { digit: '#' }]
7907
7910
  ];
7908
7911
  const DtmfTones = [
7909
7912
  'Num1',
@@ -7922,23 +7925,23 @@ const DtmfTones = [
7922
7925
  const DialpadButton = (props) => {
7923
7926
  var _a, _b, _c, _d;
7924
7927
  const theme = react.useTheme();
7925
- const { primaryContent, index, onClick, onLongPress } = props;
7928
+ const { digit, index, onClick, onLongPress, isMobile = false } = props;
7926
7929
  const clickFunction = React.useCallback(() => __awaiter$p(void 0, void 0, void 0, function* () {
7927
- onClick(primaryContent, index);
7928
- }), [primaryContent, index, onClick]);
7930
+ onClick(digit, index);
7931
+ }), [digit, index, onClick]);
7929
7932
  const longPressFunction = React.useCallback(() => __awaiter$p(void 0, void 0, void 0, function* () {
7930
- onLongPress(primaryContent, index);
7931
- }), [primaryContent, index, onLongPress]);
7932
- const { handlers } = useLongPress(clickFunction, longPressFunction);
7933
+ onLongPress(digit, index);
7934
+ }), [digit, index, onLongPress]);
7935
+ const { handlers } = useLongPress(clickFunction, longPressFunction, isMobile);
7933
7936
  return (React__default['default'].createElement(react.DefaultButton, Object.assign({ "data-test-id": `dialpad-button-${props.index}`, styles: react.concatStyleSets(buttonStyles(), (_a = props.styles) === null || _a === void 0 ? void 0 : _a.button) }, handlers),
7934
7937
  React__default['default'].createElement(react.Stack, null,
7935
- React__default['default'].createElement(react.Text, { className: react.mergeStyles(primaryContentStyles(theme), (_b = props.styles) === null || _b === void 0 ? void 0 : _b.primaryContent) }, props.primaryContent),
7936
- React__default['default'].createElement(react.Text, { className: react.mergeStyles(secondaryContentStyles(theme), (_c = props.styles) === null || _c === void 0 ? void 0 : _c.secondaryContent) }, (_d = props.secondaryContent) !== null && _d !== void 0 ? _d : ' '))));
7938
+ React__default['default'].createElement(react.Text, { className: react.mergeStyles(digitStyles(theme), (_b = props.styles) === null || _b === void 0 ? void 0 : _b.digit) }, props.digit),
7939
+ React__default['default'].createElement(react.Text, { className: react.mergeStyles(letterStyles(theme), (_c = props.styles) === null || _c === void 0 ? void 0 : _c.letter) }, (_d = props.letter) !== null && _d !== void 0 ? _d : ' '))));
7937
7940
  };
7938
7941
  const DialpadContainer = (props) => {
7939
7942
  var _a, _b;
7940
7943
  const theme = react.useTheme();
7941
- const { onSendDtmfTone, onClickDialpadButton, textFieldValue, onChange, showDeleteButton = true } = props;
7944
+ const { onSendDtmfTone, onClickDialpadButton, textFieldValue, onChange, showDeleteButton = true, isMobile = false } = props;
7942
7945
  const [plainTextValue, setPlainTextValue] = React.useState(textFieldValue !== null && textFieldValue !== void 0 ? textFieldValue : '');
7943
7946
  React.useEffect(() => {
7944
7947
  if (onChange) {
@@ -8009,7 +8012,7 @@ const DialpadContainer = (props) => {
8009
8012
  then use this index to locate the corresponding dtmf tones
8010
8013
  DtmfTones[index]
8011
8014
  */
8012
- index: columnIndex + rowIndex * rows.length, primaryContent: button.primaryContent, secondaryContent: button.secondaryContent, styles: props.styles, onClick: onClickDialpad, onLongPress: onLongPressDialpad })))));
8015
+ index: columnIndex + rowIndex * rows.length, digit: button.digit, letter: button.letter, styles: props.styles, onClick: onClickDialpad, onLongPress: onLongPressDialpad, isMobile: isMobile })))));
8013
8016
  }))));
8014
8017
  };
8015
8018
  /**
@@ -15067,7 +15070,7 @@ const themedDialpadStyle$1 = (isMobile, theme) => ({
15067
15070
  }
15068
15071
  }
15069
15072
  },
15070
- primaryContent: {
15073
+ digit: {
15071
15074
  color: theme.palette.themeDarkAlt
15072
15075
  }
15073
15076
  });
@@ -15123,19 +15126,23 @@ const SendDtmfDialpad = (props) => {
15123
15126
  const onDismissTriggered = () => {
15124
15127
  onDismissDialpad();
15125
15128
  };
15129
+ const [textFieldValue, setTextFieldValue] = React.useState();
15130
+ const onChange = (input) => {
15131
+ setTextFieldValue(input);
15132
+ };
15126
15133
  const dialpadModalStyle = React.useMemo(() => themeddialpadModalStyle$1(theme), [theme]);
15127
15134
  const dialpadStyle = React.useMemo(() => themedDialpadStyle$1(isMobile, theme), [theme, isMobile]);
15128
15135
  if (isMobile) {
15129
15136
  return (React__default['default'].createElement(react.Stack, null, showDialpad && (React__default['default'].createElement(react.Stack, { styles: drawerContainerStyles$1 },
15130
15137
  React__default['default'].createElement(_DrawerSurface, { onLightDismiss: onDismissTriggered },
15131
15138
  React__default['default'].createElement(react.Stack, { style: { padding: '1rem' } },
15132
- React__default['default'].createElement(Dialpad, Object.assign({ styles: dialpadStyle }, dialpadProps, { showDeleteButton: false, strings: strings }))))))));
15139
+ React__default['default'].createElement(Dialpad, Object.assign({ styles: dialpadStyle }, dialpadProps, { showDeleteButton: false, textFieldValue: textFieldValue, onChange: onChange, strings: strings, isMobile: isMobile }))))))));
15133
15140
  }
15134
15141
  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 },
15135
15142
  React__default['default'].createElement(react.Stack, { horizontal: true, horizontalAlign: "end", verticalAlign: "center" },
15136
15143
  React__default['default'].createElement(react.IconButton, { iconProps: { iconName: 'Cancel' }, ariaLabel: strings.dialpadCloseModalButtonAriaLabel, onClick: onDismissTriggered, style: { color: theme.palette.black } })),
15137
15144
  React__default['default'].createElement(react.Stack, { style: { overflow: 'hidden' } },
15138
- React__default['default'].createElement(Dialpad, Object.assign({ styles: dialpadStyle }, dialpadProps, { showDeleteButton: false, strings: strings }))))));
15145
+ React__default['default'].createElement(Dialpad, Object.assign({ styles: dialpadStyle }, dialpadProps, { textFieldValue: textFieldValue, onChange: onChange, showDeleteButton: false, strings: strings, isMobile: isMobile }))))));
15139
15146
  };
15140
15147
 
15141
15148
  // Copyright (c) Microsoft Corporation.
@@ -15167,6 +15174,8 @@ const CallControls = (props) => {
15167
15174
  }), [localeStrings]);
15168
15175
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
15169
15176
  const holdButtonProps = usePropsFor$1(HoldButton);
15177
+ /* @conditional-compile-remove(PSTN-calls) */
15178
+ const alternateCallerId = useAdapter().getState().alternateCallerId;
15170
15179
  /* @conditional-compile-remove(one-to-n-calling) */ /* @conditional-compile-remove(PSTN-calls) */
15171
15180
  const moreButtonContextualMenuItems = () => {
15172
15181
  const items = [];
@@ -15200,17 +15209,20 @@ const CallControls = (props) => {
15200
15209
  ['data-ui-id']: 'hold-button'
15201
15210
  });
15202
15211
  /* @conditional-compile-remove(PSTN-calls) */
15203
- items.push({
15204
- key: 'showDialpadKey',
15205
- text: localeStrings.strings.call.openDtmfDialpadLabel,
15206
- onClick: () => {
15207
- setShowDialpad(true);
15208
- },
15209
- iconProps: { iconName: 'PeoplePaneOpenDialpad', styles: { root: { lineHeight: 0 } } },
15210
- itemProps: {
15211
- styles: buttonFlyoutIncreasedSizeStyles
15212
- }
15213
- });
15212
+ // dtmf tone sending only works for 1:1 PSTN call
15213
+ if (alternateCallerId) {
15214
+ items.push({
15215
+ key: 'showDialpadKey',
15216
+ text: localeStrings.strings.call.openDtmfDialpadLabel,
15217
+ onClick: () => {
15218
+ setShowDialpad(true);
15219
+ },
15220
+ iconProps: { iconName: 'PeoplePaneOpenDialpad', styles: { root: { lineHeight: 0 } } },
15221
+ itemProps: {
15222
+ styles: buttonFlyoutIncreasedSizeStyles
15223
+ }
15224
+ });
15225
+ }
15214
15226
  return items;
15215
15227
  };
15216
15228
  /* @conditional-compile-remove(PSTN-calls) */
@@ -15735,14 +15747,13 @@ const themedDialpadStyle = (isMobile, theme) => ({
15735
15747
  backgroundColor: theme.palette.white,
15736
15748
  fontSize: theme.fonts.large.fontSize,
15737
15749
  padding: '0 0.5rem',
15738
- direction: 'rtl',
15739
15750
  textAlign: isMobile ? 'center' : 'left',
15740
15751
  ':active': {
15741
15752
  padding: '0 0.5rem'
15742
15753
  }
15743
15754
  }
15744
15755
  },
15745
- primaryContent: {
15756
+ digit: {
15746
15757
  color: theme.palette.themeDarkAlt
15747
15758
  }
15748
15759
  });
@@ -15789,7 +15800,7 @@ const CallingDialpad = (props) => {
15789
15800
  const callButtonStyle = React.useMemo(() => themedCallButtonStyle(theme), [theme]);
15790
15801
  const dialpadComponent = () => {
15791
15802
  return (React__default['default'].createElement(React__default['default'].Fragment, null,
15792
- React__default['default'].createElement(Dialpad, { styles: dialpadStyle, onChange: setTextFieldInput }),
15803
+ React__default['default'].createElement(Dialpad, { styles: dialpadStyle, onChange: setTextFieldInput, isMobile: isMobile }),
15793
15804
  React__default['default'].createElement(react.PrimaryButton, { text: strings.dialpadStartCallButtonLabel, onRenderIcon: () => DialpadStartCallIconTrampoline(), onClick: onClickCall, styles: callButtonStyle, disabled: textFieldInput === '' })));
15794
15805
  };
15795
15806
  if (isMobile) {
@@ -19072,6 +19083,7 @@ const MoreDrawer = (props) => {
19072
19083
  });
19073
19084
  }
19074
19085
  /*@conditional-compile-remove(PSTN-calls) */
19086
+ // dtmf tone sending only works for 1:1 PSTN call
19075
19087
  if (drawerSelectionOptions !== false && isEnabled(drawerSelectionOptions === null || drawerSelectionOptions === void 0 ? void 0 : drawerSelectionOptions.peopleButton) && props.onClickShowDialpad) {
19076
19088
  drawerMenuItems.push({
19077
19089
  itemKey: 'showDialpadKey',
@@ -19314,6 +19326,8 @@ const CallWithChatScreen = (props) => {
19314
19326
  dialpadCloseModalButtonAriaLabel: callWithChatStrings.dialpadCloseModalButtonAriaLabel,
19315
19327
  placeholderText: callWithChatStrings.dtmfDialpadPlaceHolderText
19316
19328
  }), [callWithChatStrings]);
19329
+ /* @conditional-compile-remove(PSTN-calls) */
19330
+ const alternateCallerId = callAdapter.getState().alternateCallerId;
19317
19331
  return (React__default['default'].createElement("div", { ref: containerRef, className: react.mergeStyles(containerDivStyles) },
19318
19332
  React__default['default'].createElement(react.Stack, { verticalFill: true, grow: true, styles: compositeOuterContainerStyles, id: compositeParentDivId },
19319
19333
  React__default['default'].createElement(react.Stack, { horizontal: true, grow: true },
@@ -19330,13 +19344,13 @@ const CallWithChatScreen = (props) => {
19330
19344
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
19331
19345
  disableButtonsForHoldScreen: isInLocalHold, callControls: props.callControls, containerHeight: containerHeight, containerWidth: containerWidth,
19332
19346
  /* @conditional-compile-remove(PSTN-calls) */
19333
- onClickShowDialpad: onClickShowDialpad })))),
19347
+ onClickShowDialpad: alternateCallerId ? onClickShowDialpad : undefined })))),
19334
19348
  showControlBar && showDrawer && (React__default['default'].createElement(ChatAdapterProvider, { adapter: chatProps.adapter },
19335
19349
  React__default['default'].createElement(CallAdapterProvider, { adapter: callAdapter },
19336
19350
  React__default['default'].createElement(react.Stack, { styles: drawerContainerStyles$1 },
19337
19351
  React__default['default'].createElement(PreparedMoreDrawer, { callControls: props.callControls, onLightDismiss: closeDrawer, onPeopleButtonClicked: onMoreDrawerPeopleClicked,
19338
19352
  /* @conditional-compile-remove(PSTN-calls) */
19339
- onClickShowDialpad: onClickShowDialpad,
19353
+ onClickShowDialpad: alternateCallerId ? onClickShowDialpad : undefined,
19340
19354
  /* @conditional-compile-remove(PSTN-calls) */ /* @conditional-compile-remove(one-to-n-calling) */
19341
19355
  disableButtonsForHoldScreen: isInLocalHold }))))),
19342
19356
  /* @conditional-compile-remove(PSTN-calls) */