@azure/communication-react 1.11.1-alpha-202401070014 → 1.11.1-alpha-202401100012

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 (31) hide show
  1. package/dist/communication-react.d.ts +35 -10
  2. package/dist/dist-cjs/communication-react/index.js +25 -46
  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/chat-stateful-client/src/index.d.ts +2 -1
  7. package/dist/dist-esm/chat-stateful-client/src/index.js +1 -0
  8. package/dist/dist-esm/chat-stateful-client/src/index.js.map +1 -1
  9. package/dist/dist-esm/react-components/src/components/ChatMessage/ChatMessageContent.js.map +1 -1
  10. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.d.ts +32 -7
  11. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js +11 -31
  12. package/dist/dist-esm/react-components/src/components/Dialpad/Dialpad.js.map +1 -1
  13. package/dist/dist-esm/react-components/src/components/FileDownloadCards.js.map +1 -1
  14. package/dist/dist-esm/react-components/src/components/styles/v8StyleShim.d.ts +2 -2
  15. package/dist/dist-esm/react-components/src/components/styles/v8StyleShim.js.map +1 -1
  16. package/dist/dist-esm/react-components/src/theming/generateTheme.js +5 -1
  17. package/dist/dist-esm/react-components/src/theming/generateTheme.js.map +1 -1
  18. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.d.ts +1 -1
  19. package/dist/dist-esm/react-composites/src/composites/CallComposite/Strings.js.map +1 -1
  20. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +10 -1
  21. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  22. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +4 -3
  23. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  24. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/NotificationIcon.js +1 -1
  25. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/NotificationIcon.js.map +1 -1
  26. package/dist/dist-esm/react-composites/src/composites/CallWithChatComposite/ChatButton/useUnreadMessagesTracker.js.map +1 -1
  27. package/dist/dist-esm/react-composites/src/composites/ChatComposite/ChatScreen.js.map +1 -1
  28. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js +7 -16
  29. package/dist/dist-esm/react-composites/src/composites/ChatComposite/adapter/AzureCommunicationChatAdapter.js.map +1 -1
  30. package/dist/dist-esm/react-composites/src/composites/common/BaseComposite.js.map +1 -1
  31. package/package.json +2 -2
@@ -2303,7 +2303,7 @@ export declare interface CallCompositeStrings {
2303
2303
  /**
2304
2304
  * String for title when the call is rejected by the callee
2305
2305
  */
2306
- callRejectedTitle: string;
2306
+ callRejectedTitle?: string;
2307
2307
  /**
2308
2308
  * String for more details when the call is rejected by the callee
2309
2309
  */
@@ -2448,7 +2448,7 @@ export declare type CallingHandlersOptions = {
2448
2448
  export declare type CallingReturnProps<Component extends (props: any) => JSX.Element> = GetCallingSelector<Component> extends (state: CallClientState, props: any) => any ? ReturnType<GetCallingSelector<Component>> & Common<CallingHandlers, Parameters<Component>[0]> : never;
2449
2449
 
2450
2450
  /**
2451
- * @beta
2451
+ * @public
2452
2452
  * Type for representing a set of sounds to use for different calling events
2453
2453
  */
2454
2454
  export declare type CallingSounds = {
@@ -6419,21 +6419,46 @@ export declare const Dialpad: (props: DialpadProps) => JSX.Element;
6419
6419
  */
6420
6420
  export declare interface DialpadProps {
6421
6421
  strings?: DialpadStrings;
6422
- /** function to send dtmf tones on button click */
6422
+ /**
6423
+ * function to send dtmf tones on button click
6424
+ */
6423
6425
  onSendDtmfTone?: (dtmfTone: DtmfTone) => Promise<void>;
6424
- /** Callback for dialpad button behavior*/
6426
+ /**
6427
+ * Callback for dialpad button behavior
6428
+ */
6425
6429
  onClickDialpadButton?: (buttonValue: string, buttonIndex: number) => void;
6426
- /** set dialpad textfield content */
6430
+ /**
6431
+ * set dialpad textfield content
6432
+ */
6427
6433
  textFieldValue?: string;
6428
- /** on change function for text field, provides an unformatted plain text*/
6434
+ /**
6435
+ * on change function for text field, provides an unformatted plain text
6436
+ */
6429
6437
  onChange?: (input: string) => void;
6430
- /** boolean input to determine when to show/hide delete button, default true */
6438
+ /**
6439
+ * flag to determine when to show/hide delete button, default true
6440
+ */
6431
6441
  showDeleteButton?: boolean;
6432
- /** boolean input to determine if dialpad is in mobile view, default false */
6442
+ /**
6443
+ * flag to determine if dialpad is in mobile view, default false
6444
+ */
6433
6445
  isMobile?: boolean;
6446
+ /**
6447
+ * Styles for customizing the dialpad component
6448
+ */
6434
6449
  styles?: DialpadStyles;
6435
- /** Disables DTMF sounds when dialpad buttons are pressed. the actual tones are still sent to the call. */
6450
+ /**
6451
+ * Disables DTMF sounds when dialpad buttons are pressed. the actual
6452
+ * tones are still sent to the call.
6453
+ */
6436
6454
  disableDtmfPlayback?: boolean;
6455
+ /**
6456
+ * Enable the ability to edit the number in the text box.
6457
+ * This mode is for when dailing someone to call to that the user can edit the number before calling if needed.
6458
+ * @default false
6459
+ *
6460
+ */
6461
+ enableInputEditing?: boolean;
6437
6462
  }
6438
6463
 
6439
6464
  /**
@@ -9365,7 +9390,7 @@ export declare interface SitePermissionsStyles extends BaseCustomStyles {
9365
9390
  }
9366
9391
 
9367
9392
  /**
9368
- * @beta
9393
+ * @public
9369
9394
  * Type for representing a custom sound to use for a calling event
9370
9395
  */
9371
9396
  export declare type SoundEffect = {
@@ -170,7 +170,7 @@ function getDefaultExportFromCjs (x) {
170
170
  // Copyright (c) Microsoft Corporation.
171
171
  // Licensed under the MIT License.
172
172
  // GENERATED FILE. DO NOT EDIT MANUALLY.
173
- var telemetryVersion = '1.11.1-alpha-202401070014';
173
+ var telemetryVersion = '1.11.1-alpha-202401100012';
174
174
 
175
175
 
176
176
  var telemetryVersion$1 = /*@__PURE__*/getDefaultExportFromCjs(telemetryVersion);
@@ -17946,12 +17946,8 @@ const DtmfTones = [
17946
17946
  const DialpadButton = (props) => {
17947
17947
  var _a, _b, _c, _d;
17948
17948
  const theme = react.useTheme();
17949
- const { digit, index, onClick, onLongPress, isMobile = false,
17950
- /* @conditional-compile-remove(dtmf-dialer) */ dtmfToneAudioContext,
17951
- /* @conditional-compile-remove(dtmf-dialer) */ disableDtmfPlayback } = props;
17952
- /* @conditional-compile-remove(dtmf-dialer) */
17949
+ const { digit, index, onClick, onLongPress, isMobile = false, dtmfToneAudioContext, disableDtmfPlayback } = props;
17953
17950
  const [buttonPressed, setButtonPressed] = React.useState(false);
17954
- /* @conditional-compile-remove(dtmf-dialer) */
17955
17951
  const dtmfToneSound = React.useRef(new Tone(dtmfToneAudioContext, dtmfFrequencies[digit].f1, dtmfFrequencies[digit].f2));
17956
17952
  const useLongPressProps = React.useMemo(() => ({
17957
17953
  onClick: () => __awaiter$s(void 0, void 0, void 0, function* () {
@@ -17964,7 +17960,6 @@ const DialpadButton = (props) => {
17964
17960
  }), [digit, index, isMobile, onClick, onLongPress]);
17965
17961
  const longPressHandlers = useLongPress(useLongPressProps);
17966
17962
  return (React.createElement(react.DefaultButton, Object.assign({ "data-test-id": `dialpad-button-${props.index}`, styles: react.concatStyleSets(buttonStyles$1(), (_a = props.styles) === null || _a === void 0 ? void 0 : _a.button) }, longPressHandlers, { onKeyDown: (e) => {
17967
- /* @conditional-compile-remove(dtmf-dialer) */
17968
17963
  if ((e.key === 'Enter' || e.key === ' ') && !buttonPressed) {
17969
17964
  if (!disableDtmfPlayback) {
17970
17965
  dtmfToneSound.current.play();
@@ -17975,7 +17970,6 @@ const DialpadButton = (props) => {
17975
17970
  }
17976
17971
  longPressHandlers.onKeyDown();
17977
17972
  }, onKeyUp: (e) => {
17978
- /* @conditional-compile-remove(dtmf-dialer) */
17979
17973
  if ((e.key === 'Enter' || e.key === ' ') && buttonPressed) {
17980
17974
  dtmfToneSound.current.stop();
17981
17975
  longPressHandlers.onKeyUp();
@@ -17983,26 +17977,21 @@ const DialpadButton = (props) => {
17983
17977
  }
17984
17978
  longPressHandlers.onKeyUp();
17985
17979
  }, onMouseDown: () => {
17986
- /* @conditional-compile-remove(dtmf-dialer) */
17987
17980
  if (!disableDtmfPlayback) {
17988
17981
  dtmfToneSound.current.play();
17989
17982
  }
17990
17983
  longPressHandlers.onMouseDown();
17991
17984
  }, onMouseUp: () => {
17992
- /* @conditional-compile-remove(dtmf-dialer) */
17993
17985
  dtmfToneSound.current.stop();
17994
17986
  longPressHandlers.onMouseUp();
17995
17987
  }, onMouseLeave: () => {
17996
- /* @conditional-compile-remove(dtmf-dialer) */
17997
17988
  dtmfToneSound.current.stop();
17998
17989
  }, onTouchStart: () => {
17999
- /* @conditional-compile-remove(dtmf-dialer) */
18000
17990
  if (!disableDtmfPlayback) {
18001
17991
  dtmfToneSound.current.play();
18002
17992
  }
18003
17993
  longPressHandlers.onTouchStart();
18004
17994
  }, onTouchEnd: () => {
18005
- /* @conditional-compile-remove(dtmf-dialer) */
18006
17995
  dtmfToneSound.current.stop();
18007
17996
  longPressHandlers.onTouchEnd();
18008
17997
  } }),
@@ -18013,9 +18002,8 @@ const DialpadButton = (props) => {
18013
18002
  const DialpadContainer = (props) => {
18014
18003
  var _a, _b;
18015
18004
  const theme = react.useTheme();
18016
- const { onSendDtmfTone, onClickDialpadButton, textFieldValue, onChange, showDeleteButton = true, isMobile = false } = props;
18005
+ const { onSendDtmfTone, onClickDialpadButton, textFieldValue, onChange, showDeleteButton = true, isMobile = false, disableDtmfPlayback, enableInputEditing } = props;
18017
18006
  const [plainTextValue, setPlainTextValue] = React.useState(textFieldValue !== null && textFieldValue !== void 0 ? textFieldValue : '');
18018
- /* @conditional-compile-remove(dtmf-dialer) */
18019
18007
  const dtmfToneAudioContext = React.useRef(new AudioContext());
18020
18008
  React.useEffect(() => {
18021
18009
  if (onChange) {
@@ -18059,18 +18047,16 @@ const DialpadContainer = (props) => {
18059
18047
  setText(modifiedInput);
18060
18048
  };
18061
18049
  return (React.createElement("div", { className: react.mergeStyles(containerStyles$3(theme), (_a = props.styles) === null || _a === void 0 ? void 0 : _a.root), "data-test-id": "dialpadContainer", "data-ui-id": "dialpadContainer" },
18062
- React.createElement(react.TextField, { styles: react.concatStyleSets(textFieldStyles(theme), (_b = props.styles) === null || _b === void 0 ? void 0 : _b.textField), value: textFieldValue ? textFieldValue : formatPhoneNumber(plainTextValue),
18050
+ React.createElement(react.TextField, { styles: react.concatStyleSets(textFieldStyles(theme), (_b = props.styles) === null || _b === void 0 ? void 0 : _b.textField), value: textFieldValue ? textFieldValue : enableInputEditing ? formatPhoneNumber(plainTextValue) : plainTextValue,
18063
18051
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
18064
18052
  onChange: (e) => {
18065
- setText(e.target.value);
18066
- },
18067
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
18068
- onClick: (e) => {
18069
- const input = e.target;
18070
- const end = input.value.length;
18071
- // Move focus to end of input field
18072
- input.setSelectionRange(end, end);
18073
- input.focus();
18053
+ if (enableInputEditing) {
18054
+ setText(e.target.value);
18055
+ }
18056
+ }, onClick: (e) => {
18057
+ if (!enableInputEditing) {
18058
+ e.preventDefault();
18059
+ }
18074
18060
  }, placeholder: props.strings.placeholderText, "data-test-id": "dialpad-input", onRenderSuffix: () => {
18075
18061
  var _a;
18076
18062
  return (React.createElement(React.Fragment, null, showDeleteButton && plainTextValue.length !== 0 && (React.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' } }))));
@@ -18094,11 +18080,7 @@ const DialpadContainer = (props) => {
18094
18080
  then use this index to locate the corresponding dtmf tones
18095
18081
  DtmfTones[index]
18096
18082
  */
18097
- index: columnIndex + rowIndex * rows.length, digit: button.digit, letter: button.letter, styles: props.styles, onClick: onClickDialpad, onLongPress: onLongPressDialpad, isMobile: isMobile,
18098
- /* @conditional-compile-remove(dtmf-dialer) */
18099
- dtmfToneAudioContext: dtmfToneAudioContext.current,
18100
- /* @conditional-compile-remove(dtmf-dialer) */
18101
- disableDtmfPlayback: props.disableDtmfPlayback })))));
18083
+ index: columnIndex + rowIndex * rows.length, digit: button.digit, letter: button.letter, styles: props.styles, onClick: onClickDialpad, onLongPress: onLongPressDialpad, isMobile: isMobile, dtmfToneAudioContext: dtmfToneAudioContext.current, disableDtmfPlayback: disableDtmfPlayback })))));
18102
18084
  }))));
18103
18085
  };
18104
18086
  /**
@@ -22821,17 +22803,11 @@ class AzureCommunicationChatAdapter {
22821
22803
  return __awaiter$k(this, void 0, void 0, function* () {
22822
22804
  return this.asyncTeeErrorToEventEmitter(() => __awaiter$k(this, void 0, void 0, function* () {
22823
22805
  if (this.credential === undefined) {
22824
- const e = new Error();
22825
- e['target'] = 'ChatThreadClient.getMessage';
22826
- e['innerError'] = new Error('AccessToken is null');
22827
- throw e;
22806
+ throw new ChatError('ChatThreadClient.getMessage', new Error('AccessToken is null'));
22828
22807
  }
22829
22808
  const accessToken = yield this.credential.getToken();
22830
22809
  if (!accessToken) {
22831
- const e = new Error();
22832
- e['target'] = 'ChatThreadClient.getMessage';
22833
- e['innerError'] = new Error('AccessToken is null');
22834
- throw e;
22810
+ throw new ChatError('ChatThreadClient.getMessage', new Error('AccessToken is null'));
22835
22811
  }
22836
22812
  return this.downloadAuthenticatedFile(accessToken.token, options);
22837
22813
  }));
@@ -22847,10 +22823,7 @@ class AzureCommunicationChatAdapter {
22847
22823
  return yield fetch(url, { headers });
22848
22824
  }
22849
22825
  catch (err) {
22850
- const e = new Error();
22851
- e['target'] = 'ChatThreadClient.getMessage';
22852
- e['innerError'] = err;
22853
- throw e;
22826
+ throw new ChatError('ChatThreadClient.getMessage', err);
22854
22827
  }
22855
22828
  });
22856
22829
  }
@@ -22963,10 +22936,10 @@ const convertEventToChatMessage = (event) => {
22963
22936
  };
22964
22937
  };
22965
22938
  const isChatMessageEditedEvent = (event) => {
22966
- return event['editedOn'] !== undefined;
22939
+ return 'editedOn' in event;
22967
22940
  };
22968
22941
  const isChatMessageDeletedEvent = (event) => {
22969
- return event['deletedOn'] !== undefined;
22942
+ return 'deletedOn' in event;
22970
22943
  };
22971
22944
  // only text/html message type will be received from event
22972
22945
  const convertEventType = (type) => {
@@ -23119,7 +23092,7 @@ function createAzureCommunicationChatAdapterFromClient(chatClient, chatThreadCli
23119
23092
  });
23120
23093
  }
23121
23094
  const isChatError = (e) => {
23122
- return e['target'] !== undefined && e['innerError'] !== undefined;
23095
+ return 'target' in e && e['target'] !== undefined && 'innerError' in e && e['innerError'] !== undefined;
23123
23096
  };
23124
23097
 
23125
23098
  // Copyright (c) Microsoft Corporation.
@@ -32895,6 +32868,9 @@ class AzureCommunicationCallAdapter {
32895
32868
  const createAzureCommunicationCallAdapter = ({ userId, displayName, credential, locator,
32896
32869
  /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
32897
32870
  /* @conditional-compile-remove(video-background-effects) */ options }) => __awaiter$5(void 0, void 0, void 0, function* () {
32871
+ if (communicationCommon.isMicrosoftTeamsUserIdentifier(userId)) {
32872
+ throw new Error('Microsoft Teams user identifier is not supported by AzureCommunicationCallAdapter. Instead use TeamsCallAdapter.');
32873
+ }
32898
32874
  return _createAzureCommunicationCallAdapterInner({
32899
32875
  userId,
32900
32876
  displayName,
@@ -32934,6 +32910,9 @@ const _createAzureCommunicationCallAdapterInner = ({ userId, displayName, creden
32934
32910
  * @beta
32935
32911
  */
32936
32912
  const createTeamsCallAdapter = ({ userId, credential, locator, options }) => __awaiter$5(void 0, void 0, void 0, function* () {
32913
+ if (communicationCommon.isCommunicationUserIdentifier(userId)) {
32914
+ throw new Error('Communication User identifier is not supported by TeamsCallAdapter, please use our AzureCommunicationCallAdapter.');
32915
+ }
32937
32916
  const callClient = _createStatefulCallClientInner({
32938
32917
  userId
32939
32918
  }, undefined, 'Call');
@@ -33580,7 +33559,7 @@ const NotificationIcon = (props) => {
33580
33559
  }
33581
33560
  else {
33582
33561
  const textNumberOfMessages = numberOfMessages < 9 ? numberOfMessages : '9+';
33583
- return (React.createElement(react.Text, { role: 'status', "aria-label": textNumberOfMessages + label, styles: notificationTextStyles(theme) }, textNumberOfMessages));
33562
+ return (React.createElement(react.Text, { role: 'status', "aria-label": textNumberOfMessages + (label !== null && label !== void 0 ? label : ''), styles: notificationTextStyles(theme) }, textNumberOfMessages));
33584
33563
  }
33585
33564
  };
33586
33565
  return (React.createElement(react.Stack, { "data-ui-id": "call-with-chat-composite-chat-button-unread-icon", horizontalAlign: "center", verticalAlign: "center", styles: notificationIconContainerStyles(theme) },