@azure/communication-react 1.4.2-alpha-202211230015.0 → 1.5.1-alpha-202211250013.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 (44) hide show
  1. package/dist/communication-react.d.ts +154 -23
  2. package/dist/dist-cjs/communication-react/index.js +168 -53
  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/ErrorBar.d.ts +10 -0
  7. package/dist/dist-esm/react-components/src/components/ErrorBar.js +5 -2
  8. package/dist/dist-esm/react-components/src/components/ErrorBar.js.map +1 -1
  9. package/dist/dist-esm/react-components/src/components/MessageThread.js +7 -11
  10. package/dist/dist-esm/react-components/src/components/MessageThread.js.map +1 -1
  11. package/dist/dist-esm/react-components/src/components/utils.d.ts +1 -1
  12. package/dist/dist-esm/react-components/src/components/utils.js +5 -1
  13. package/dist/dist-esm/react-components/src/components/utils.js.map +1 -1
  14. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.d.ts +2 -2
  15. package/dist/dist-esm/react-composites/src/composites/CallComposite/CallComposite.js.map +1 -1
  16. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +39 -7
  17. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +125 -37
  18. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  19. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.d.ts +115 -27
  20. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapter.js.map +1 -1
  21. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapterProvider.d.ts +3 -3
  22. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/CallAdapterProvider.js.map +1 -1
  23. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/DiagnosticsForwarder.d.ts +2 -2
  24. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/DiagnosticsForwarder.js.map +1 -1
  25. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.d.ts +15 -0
  26. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.js +23 -0
  27. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/createHandlers.js.map +1 -0
  28. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +3 -1
  29. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js +2 -0
  30. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  31. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallPane.d.ts +2 -2
  32. package/dist/dist-esm/react-composites/src/composites/CallComposite/components/CallPane.js.map +1 -1
  33. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.d.ts +2 -2
  34. package/dist/dist-esm/react-composites/src/composites/CallComposite/hooks/useHandlers.js.map +1 -1
  35. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +3 -1
  36. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js +2 -0
  37. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  38. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js +3 -1
  39. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/CallPage.js.map +1 -1
  40. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js +3 -1
  41. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/HoldPage.js.map +1 -1
  42. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js +3 -1
  43. package/dist/dist-esm/react-composites/src/composites/CallComposite/pages/LobbyPage.js.map +1 -1
  44. package/package.json +8 -8
@@ -524,11 +524,33 @@ export declare interface BrowserPermissionDeniedStyles extends BaseCustomStyles
524
524
  }
525
525
 
526
526
  /**
527
- * {@link CallComposite} Adapter interface.
527
+ * An Adapter interface specific for Azure Communication identity which extends {@link CommonCallAdapter}.
528
528
  *
529
529
  * @public
530
530
  */
531
- export declare interface CallAdapter extends AdapterState<CallAdapterState>, Disposable, CallAdapterCallManagement, CallAdapterDeviceManagement, CallAdapterSubscribers {
531
+ export declare interface CallAdapter extends CommonCallAdapter {
532
+ /**
533
+ * Join the call with microphone initially on/off.
534
+ *
535
+ * @param microphoneOn - Whether microphone is initially enabled
536
+ *
537
+ * @public
538
+ */
539
+ joinCall(microphoneOn?: boolean): Call | undefined;
540
+ /**
541
+ * Start the call.
542
+ *
543
+ * @param participants - An array of participant ids to join
544
+ *
545
+ * @public
546
+ */
547
+ startCall(participants: string[], options?: StartCallOptions): Call | undefined;
548
+ /**
549
+ * Start the call.
550
+ * @param participants - An array of {@link @azure/communication-common#CommunicationIdentifier} to be called
551
+ * @beta
552
+ */
553
+ startCall(participants: CommunicationIdentifier[], options?: StartCallOptions): Call | undefined;
532
554
  }
533
555
 
534
556
  /**
@@ -541,11 +563,11 @@ export declare type CallAdapterCallEndedEvent = {
541
563
  };
542
564
 
543
565
  /**
544
- * Functionality for managing the current call.
545
- *
566
+ * Functionality for managing the current call or start a new call
567
+ * @deprecated CallAdapter interface will be flatten, consider using CallAdapter directly
546
568
  * @public
547
569
  */
548
- export declare interface CallAdapterCallManagement {
570
+ export declare interface CallAdapterCallManagement extends CallAdapterCallOperations {
549
571
  /**
550
572
  * Join the call with microphone initially on/off.
551
573
  *
@@ -554,6 +576,28 @@ export declare interface CallAdapterCallManagement {
554
576
  * @public
555
577
  */
556
578
  joinCall(microphoneOn?: boolean): Call | undefined;
579
+ /**
580
+ * Start the call.
581
+ *
582
+ * @param participants - An array of participant ids to join
583
+ *
584
+ * @public
585
+ */
586
+ startCall(participants: string[], options?: StartCallOptions): Call | undefined;
587
+ /**
588
+ * Start the call.
589
+ * @param participants - An array of {@link @azure/communication-common#CommunicationIdentifier} to be called
590
+ * @beta
591
+ */
592
+ startCall(participants: CommunicationIdentifier[], options?: StartCallOptions): Call | undefined;
593
+ }
594
+
595
+ /**
596
+ * Functionality for managing the current call.
597
+ *
598
+ * @public
599
+ */
600
+ export declare interface CallAdapterCallOperations {
557
601
  /**
558
602
  * Leave the call
559
603
  *
@@ -590,20 +634,6 @@ export declare interface CallAdapterCallManagement {
590
634
  * @public
591
635
  */
592
636
  unmute(): Promise<void>;
593
- /**
594
- * Start the call.
595
- *
596
- * @param participants - An array of participant ids to join
597
- *
598
- * @public
599
- */
600
- startCall(participants: string[], options?: StartCallOptions): Call | undefined;
601
- /**
602
- * Start the call.
603
- * @param participants - An array of {@link @azure/communication-common#CommunicationIdentifier} to be called
604
- * @beta
605
- */
606
- startCall(participants: CommunicationIdentifier[], options?: StartCallOptions): Call | undefined;
607
637
  /**
608
638
  * Start sharing the screen during a call.
609
639
  *
@@ -682,7 +712,7 @@ export declare interface CallAdapterCallManagement {
682
712
  }
683
713
 
684
714
  /**
685
- * {@link CallAdapter} state inferred from Azure Communication Services backend.
715
+ * {@link CommonCallAdapter} state inferred from Azure Communication Services backend.
686
716
  *
687
717
  * @public
688
718
  */
@@ -814,7 +844,7 @@ export declare type CallAdapterOptionalFeatures = {
814
844
  };
815
845
 
816
846
  /**
817
- * {@link CallAdapter} state.
847
+ * {@link CommonCallAdapter} state.
818
848
  *
819
849
  * @public
820
850
  */
@@ -939,7 +969,7 @@ export declare interface CallAdapterSubscribers {
939
969
  }
940
970
 
941
971
  /**
942
- * {@link CallAdapter} state for pure UI purposes.
972
+ * {@link CommonCallAdapter} state for pure UI purposes.
943
973
  *
944
974
  * @public
945
975
  */
@@ -1246,7 +1276,7 @@ export declare interface CallCompositeProps extends BaseCompositeProps<CallCompo
1246
1276
  * An adapter provides logic and data to the composite.
1247
1277
  * Composite can also be controlled using the adapter.
1248
1278
  */
1249
- adapter: CallAdapter;
1279
+ adapter: CommonCallAdapter;
1250
1280
  /**
1251
1281
  * Optimizes the composite form factor for either desktop or mobile.
1252
1282
  * @remarks `mobile` is currently only optimized for Portrait mode on mobile devices and does not support landscape.
@@ -3440,6 +3470,36 @@ export declare type ClientState = CallClientState & ChatClientState;
3440
3470
  */
3441
3471
  export declare type Common<A, B> = Pick<A, CommonProperties<A, B>>;
3442
3472
 
3473
+ /**
3474
+ * {@link CallComposite} Adapter interface.
3475
+ *
3476
+ * @public
3477
+ */
3478
+ export declare interface CommonCallAdapter extends AdapterState<CallAdapterState>, Disposable, CallAdapterCallOperations, CallAdapterDeviceManagement, CallAdapterSubscribers {
3479
+ /**
3480
+ * Join the call with microphone initially on/off.
3481
+ *
3482
+ * @param microphoneOn - Whether microphone is initially enabled
3483
+ *
3484
+ * @public
3485
+ */
3486
+ joinCall(microphoneOn?: boolean): void;
3487
+ /**
3488
+ * Start the call.
3489
+ *
3490
+ * @param participants - An array of participant ids to join
3491
+ *
3492
+ * @public
3493
+ */
3494
+ startCall(participants: string[], options?: StartCallOptions): void;
3495
+ /**
3496
+ * Start the call.
3497
+ * @param participants - An array of {@link @azure/communication-common#CommunicationIdentifier} to be called
3498
+ * @beta
3499
+ */
3500
+ startCall(participants: CommunicationIdentifier[], options?: StartCallOptions): void;
3501
+ }
3502
+
3443
3503
  /**
3444
3504
  * Object containing all the handlers required for calling components.
3445
3505
  *
@@ -4070,6 +4130,21 @@ export declare const createAzureCommunicationChatAdapter: ({ endpoint: endpointU
4070
4130
  */
4071
4131
  export declare const createAzureCommunicationChatAdapterFromClient: (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) => Promise<ChatAdapter>;
4072
4132
 
4133
+ /**
4134
+ * @beta
4135
+ */
4136
+ export declare const createAzureCommunicationTeamsCallAdapter: ({ userId, credential, locator, alternateCallerId }: AzureCommunicationCallAdapterArgs) => Promise<TeamsCallAdapter>;
4137
+
4138
+ /**
4139
+ * Create a {@link TeamsCallAdapter} using the provided {@link StatefulCallClient}.
4140
+ *
4141
+ * Useful if you want to keep a reference to {@link StatefulCallClient}.
4142
+ * Consider using {@link createAzureCommunicationCallAdapter} for a simpler API.
4143
+ *
4144
+ * @beta
4145
+ */
4146
+ export declare const createAzureCommunicationTeamsCallAdapterFromClient: (callClient: StatefulCallClient, callAgent: TeamsCallAgent, locator: CallAdapterLocator) => Promise<TeamsCallAdapter>;
4147
+
4073
4148
  /**
4074
4149
  * Create the default implementation of {@link CallingHandlers} for teams call.
4075
4150
  *
@@ -5041,6 +5116,16 @@ export declare interface ErrorBarProps extends IMessageBarProps {
5041
5116
  * Currently active errors.
5042
5117
  */
5043
5118
  activeErrorMessages: ActiveErrorMessage[];
5119
+ /**
5120
+ * If set, errors with {@link ActiveErrorMessage.timestamp} older than the time this component is mounted
5121
+ * are not shown.
5122
+ *
5123
+ * This is useful when using the {@link ErrorBar} with a stateful client that handles more than one call
5124
+ * or chat thread. Set this prop to ignore errors from previous call or chat.
5125
+ *
5126
+ * @defaultValue false
5127
+ */
5128
+ ignorePremountErrors?: boolean;
5044
5129
  }
5045
5130
 
5046
5131
  /**
@@ -7488,6 +7573,36 @@ export declare interface SystemMessageCommon extends MessageCommon {
7488
7573
  iconName: string;
7489
7574
  }
7490
7575
 
7576
+ /**
7577
+ * An Adapter interface specific for Teams identity which extends {@link CommonCallAdapter}.
7578
+ *
7579
+ * @beta
7580
+ */
7581
+ export declare interface TeamsCallAdapter extends CommonCallAdapter {
7582
+ /**
7583
+ * Join the call with microphone initially on/off.
7584
+ *
7585
+ * @param microphoneOn - Whether microphone is initially enabled
7586
+ *
7587
+ * @beta
7588
+ */
7589
+ joinCall(microphoneOn?: boolean): TeamsCall | undefined;
7590
+ /**
7591
+ * Start the call.
7592
+ *
7593
+ * @param participants - An array of participant ids to join
7594
+ *
7595
+ * @beta
7596
+ */
7597
+ startCall(participants: string[], options?: StartCallOptions): TeamsCall | undefined;
7598
+ /**
7599
+ * Start the call.
7600
+ * @param participants - An array of {@link @azure/communication-common#CommunicationIdentifier} to be called
7601
+ * @beta
7602
+ */
7603
+ startCall(participants: CommunicationIdentifier[], options?: StartCallOptions): TeamsCall | undefined;
7604
+ }
7605
+
7491
7606
  /**
7492
7607
  * Object containing all the teams call handlers required for calling components.
7493
7608
  *
@@ -7768,6 +7883,22 @@ export declare const useAzureCommunicationCallWithChatAdapter: (args: Partial<Az
7768
7883
  */
7769
7884
  export declare const useAzureCommunicationChatAdapter: (args: Partial<AzureCommunicationChatAdapterArgs>, afterCreate?: ((adapter: ChatAdapter) => Promise<ChatAdapter>) | undefined, beforeDispose?: ((adapter: ChatAdapter) => Promise<void>) | undefined) => ChatAdapter | undefined;
7770
7885
 
7886
+ /**
7887
+ * A custom React hook to simplify the creation of {@link TeamsCallAdapter}.
7888
+ *
7889
+ * Similar to {@link createTeamsAzureCommunicationCallAdapter}, but takes care of asynchronous
7890
+ * creation of the adapter internally.
7891
+ *
7892
+ * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
7893
+ * as they are created. The adapter is only created when all arguments are defined.
7894
+ *
7895
+ * Note that you must memoize the arguments to avoid recreating adapter on each render.
7896
+ * See storybook for typical usage examples.
7897
+ *
7898
+ * @beta
7899
+ */
7900
+ export declare const useAzureCommunicationTeamsCallAdapter: (args: Partial<AzureCommunicationCallAdapterArgs>, afterCreate?: ((adapter: TeamsCallAdapter) => Promise<TeamsCallAdapter>) | undefined, beforeDispose?: ((adapter: TeamsCallAdapter) => Promise<void>) | undefined) => TeamsCallAdapter | undefined;
7901
+
7771
7902
  /**
7772
7903
  * Hook to obtain {@link @azure/communication-calling#Call} from the provider.
7773
7904
  *
@@ -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-202211230015.0';
205
+ var telemetryVersion = '1.5.1-alpha-202211250013.0';
206
206
 
207
207
  // Copyright (c) Microsoft Corporation.
208
208
  /**
@@ -4333,12 +4333,16 @@ const dropDismissalsForInactiveErrors = (activeErrorMessages, dismissedErrors) =
4333
4333
  * @param dismissedErrors
4334
4334
  * @returns ActiveErrorMessage[]
4335
4335
  */
4336
- const errorsToShow = (activeErrorMessages, dismissedErrors) => {
4336
+ const errorsToShow = (activeErrorMessages, dismissedErrors, mountTimestamp) => {
4337
4337
  const dismissed = new Map();
4338
4338
  for (const error of dismissedErrors) {
4339
4339
  dismissed.set(error.type, error);
4340
4340
  }
4341
4341
  return activeErrorMessages.filter((error) => {
4342
+ if (mountTimestamp && error.timestamp && mountTimestamp > error.timestamp) {
4343
+ // Error has a timestamp and it is older than when the component was mounted.
4344
+ return false;
4345
+ }
4342
4346
  const dismissal = dismissed.get(error.type);
4343
4347
  if (!dismissal) {
4344
4348
  // This error was never dismissed.
@@ -4447,11 +4451,14 @@ const ErrorBar = (props) => {
4447
4451
  var _a;
4448
4452
  const localeStrings = useLocale$1().strings.errorBar;
4449
4453
  const strings = (_a = props.strings) !== null && _a !== void 0 ? _a : localeStrings;
4454
+ // Timestamp for when this comopnent is first mounted.
4455
+ // Never updated through the lifecycle of this component.
4456
+ const mountTimestamp = React.useRef(new Date(Date.now()));
4450
4457
  const [dismissedErrors, setDismissedErrors] = React.useState([]);
4451
4458
  // dropDismissalsForInactiveErrors only returns a new object if `dismissedErrors` actually changes.
4452
4459
  // Without this behaviour, this `useEffect` block would cause a render loop.
4453
4460
  React.useEffect(() => setDismissedErrors(dropDismissalsForInactiveErrors(props.activeErrorMessages, dismissedErrors)), [props.activeErrorMessages, dismissedErrors]);
4454
- const toShow = errorsToShow(props.activeErrorMessages, dismissedErrors);
4461
+ const toShow = errorsToShow(props.activeErrorMessages, dismissedErrors, props.ignorePremountErrors ? mountTimestamp.current : undefined);
4455
4462
  return (React__default['default'].createElement(react.Stack, { "data-ui-id": "error-bar-stack" }, toShow.map((error) => (React__default['default'].createElement(react.MessageBar, Object.assign({}, props, { styles: {
4456
4463
  innerText: {
4457
4464
  paddingTop: messageBarType(error.type) === 5 ? '0.15rem' : '0.1rem',
@@ -7081,11 +7088,13 @@ const MessageThread = (props) => {
7081
7088
  }, [scrollToBottom, sendMessageStatusIfAtBottom]);
7082
7089
  // Infinite scrolling + threadInitialize function
7083
7090
  const fetchNewMessageWhenAtTop = React.useCallback(() => __awaiter$m(void 0, void 0, void 0, function* () {
7084
- if (chatScrollDivRef.current && !isLoadingChatMessagesRef.current) {
7091
+ if (!isLoadingChatMessagesRef.current) {
7085
7092
  if (onLoadPreviousChatMessages) {
7086
7093
  isLoadingChatMessagesRef.current = true;
7087
7094
  // Fetch message until scrollTop reach the threshold for fetching new message
7088
- while (!isAllChatMessagesLoadedRef.current && chatScrollDivRef.current.scrollTop <= 500) {
7095
+ while (!isAllChatMessagesLoadedRef.current &&
7096
+ chatScrollDivRef.current &&
7097
+ chatScrollDivRef.current.scrollTop <= 500) {
7089
7098
  isAllChatMessagesLoadedRef.current = yield onLoadPreviousChatMessages(numberOfChatMessagesToReload);
7090
7099
  yield delay(200);
7091
7100
  }
@@ -7093,12 +7102,6 @@ const MessageThread = (props) => {
7093
7102
  }
7094
7103
  }
7095
7104
  }), [numberOfChatMessagesToReload, onLoadPreviousChatMessages]);
7096
- const handleInfiniteScroll = React.useCallback(() => {
7097
- if (!chatScrollDivRef.current) {
7098
- return;
7099
- }
7100
- fetchNewMessageWhenAtTop();
7101
- }, [fetchNewMessageWhenAtTop]);
7102
7105
  // The below 2 of useEffects are design for fixing infinite scrolling problem
7103
7106
  // Scrolling element will behave differently when scrollTop = 0(it sticks at the top)
7104
7107
  // we need to get previousTop before it prepend contents
@@ -7136,12 +7139,12 @@ const MessageThread = (props) => {
7136
7139
  React.useEffect(() => {
7137
7140
  const chatScrollDiv = chatScrollDivRef.current;
7138
7141
  chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.addEventListener('scroll', handleScrollToTheBottom);
7139
- chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.addEventListener('scroll', handleInfiniteScroll);
7142
+ chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.addEventListener('scroll', fetchNewMessageWhenAtTop);
7140
7143
  return () => {
7141
7144
  chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.removeEventListener('scroll', handleScrollToTheBottom);
7142
- chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.removeEventListener('scroll', handleInfiniteScroll);
7145
+ chatScrollDiv === null || chatScrollDiv === void 0 ? void 0 : chatScrollDiv.removeEventListener('scroll', fetchNewMessageWhenAtTop);
7143
7146
  };
7144
- }, [handleInfiniteScroll, handleScrollToTheBottom]);
7147
+ }, [fetchNewMessageWhenAtTop, handleScrollToTheBottom]);
7145
7148
  /**
7146
7149
  * ClientHeight controls the number of messages to render. However ClientHeight will not be initialized after the
7147
7150
  * first render (not sure but I guess Fluent is updating it in hook which is after render maybe?) so we need to
@@ -17976,7 +17979,9 @@ const CallPage = (props) => {
17976
17979
  const strings = useLocale().strings.call;
17977
17980
  // Reduce the controls shown when mobile view is enabled.
17978
17981
  const callControlOptions = mobileView ? reduceCallControlsForMobile(options === null || options === void 0 ? void 0 : options.callControls) : options === null || options === void 0 ? void 0 : options.callControls;
17979
- return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: Object.assign(Object.assign({}, complianceBannerProps), { strings }), errorBarProps: (options === null || options === void 0 ? void 0 : options.errorBar) !== false && Object.assign({}, errorBarProps), mutedNotificationProps: mutedNotificationProps, callControlProps: {
17982
+ return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: Object.assign(Object.assign({}, complianceBannerProps), { strings }),
17983
+ // Ignore errors from before current call. This avoids old errors from showing up when a user re-joins a call.
17984
+ errorBarProps: (options === null || options === void 0 ? void 0 : options.errorBar) !== false && Object.assign(Object.assign({}, errorBarProps), { ignorePremountErrors: true }), mutedNotificationProps: mutedNotificationProps, callControlProps: {
17980
17985
  callInvitationURL: callInvitationURL,
17981
17986
  onFetchParticipantMenuItems: onFetchParticipantMenuItems,
17982
17987
  options: callControlOptions,
@@ -18914,7 +18919,9 @@ const LobbyPage = (props) => {
18914
18919
  ? reduceCallControlsForMobile((_b = props.options) === null || _b === void 0 ? void 0 : _b.callControls)
18915
18920
  : (_c = props.options) === null || _c === void 0 ? void 0 : _c.callControls;
18916
18921
  callControlOptions = disableCallControls(callControlOptions, ['screenShareButton', 'participantsButton']);
18917
- return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: { strings }, errorBarProps: ((_d = props.options) === null || _d === void 0 ? void 0 : _d.errorBar) !== false && Object.assign({}, errorBarProps), callControlProps: {
18922
+ return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: { strings },
18923
+ // Ignore errors from before current call. This avoids old errors from showing up when a user re-joins a call.
18924
+ errorBarProps: ((_d = props.options) === null || _d === void 0 ? void 0 : _d.errorBar) !== false && Object.assign(Object.assign({}, errorBarProps), { ignorePremountErrors: true }), callControlProps: {
18918
18925
  options: callControlOptions,
18919
18926
  increaseFlyoutItemSize: props.mobileView
18920
18927
  }, mobileView: props.mobileView,
@@ -19147,7 +19154,9 @@ const HoldPage = (props) => {
19147
19154
  /* @conditional-compile-remove(one-to-n-calling) */
19148
19155
  'holdButton'
19149
19156
  ]);
19150
- return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: { strings }, errorBarProps: ((_c = props.options) === null || _c === void 0 ? void 0 : _c.errorBar) !== false && Object.assign({}, errorBarProps), callControlProps: {
19157
+ return (React__default['default'].createElement(CallArrangement, { complianceBannerProps: { strings },
19158
+ // Ignore errors from before current call. This avoids old errors from showing up when a user re-joins a call.
19159
+ errorBarProps: ((_c = props.options) === null || _c === void 0 ? void 0 : _c.errorBar) !== false && Object.assign(Object.assign({}, errorBarProps), { ignorePremountErrors: true }), callControlProps: {
19151
19160
  options: callControlOptions,
19152
19161
  increaseFlyoutItemSize: props.mobileView
19153
19162
  }, mobileView: props.mobileView,
@@ -19406,6 +19415,24 @@ class DiagnosticsForwarder {
19406
19415
  }
19407
19416
  }
19408
19417
 
19418
+ // Copyright (c) Microsoft Corporation.
19419
+ /**
19420
+ * @private
19421
+ *
19422
+ * This is used to create correct handler for generic agent type
19423
+ */
19424
+ const createHandlers = (callClient, callAgent, deviceManager, call) => {
19425
+ // Call can be either undefined or ACS Call
19426
+ if (_isACSCallAgent(callAgent) && (!call || (call && _isACSCall(call)))) {
19427
+ return createDefaultCallingHandlers(callClient, callAgent, deviceManager, call);
19428
+ }
19429
+ /* @conditional-compile-remove(teams-identity-support) */
19430
+ if (_isTeamsCallAgent(callAgent) && (!call || (call && _isTeamsCall(call)))) {
19431
+ return createDefaultTeamsCallingHandlers(callClient, callAgent, deviceManager, call);
19432
+ }
19433
+ throw new Error('Unhandled agent type');
19434
+ };
19435
+
19409
19436
  // Copyright (c) Microsoft Corporation.
19410
19437
  // Licensed under the MIT license.
19411
19438
  var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@@ -19541,7 +19568,7 @@ class AzureCommunicationCallAdapter {
19541
19568
  }
19542
19569
  this.context.updateClientState(clientState);
19543
19570
  };
19544
- this.handlers = createDefaultCallingHandlers(callClient, callAgent, deviceManager, undefined);
19571
+ this.handlers = createHandlers(callClient, callAgent, deviceManager, undefined);
19545
19572
  this.onClientStateChange = onStateChange;
19546
19573
  this.subscribeDeviceManagerEvents();
19547
19574
  this.callClient.onStateChange(onStateChange);
@@ -19659,6 +19686,16 @@ class AzureCommunicationCallAdapter {
19659
19686
  const isTeamsMeeting = 'meetingLink' in this.locator;
19660
19687
  /* @conditional-compile-remove(rooms) */
19661
19688
  const isRoomsCall = 'roomId' in this.locator;
19689
+ /* @conditional-compile-remove(teams-identity-support) */
19690
+ if (_isTeamsCallAgent(this.callAgent)) {
19691
+ if (!isTeamsMeeting) {
19692
+ throw new Error('Locator not supported by TeamsCallAgent');
19693
+ }
19694
+ return this.callAgent.join(this.locator, {
19695
+ audioOptions,
19696
+ videoOptions
19697
+ });
19698
+ }
19662
19699
  if (isTeamsMeeting) {
19663
19700
  return this.callAgent.join(this.locator, {
19664
19701
  audioOptions,
@@ -19701,7 +19738,7 @@ class AzureCommunicationCallAdapter {
19701
19738
  return __awaiter$4(this, void 0, void 0, function* () {
19702
19739
  yield this.handlers.onHangUp(forEveryone);
19703
19740
  this.unsubscribeCallEvents();
19704
- this.handlers = createDefaultCallingHandlers(this.callClient, this.callAgent, this.deviceManager, undefined);
19741
+ this.handlers = createHandlers(this.callClient, this.callAgent, this.deviceManager, undefined);
19705
19742
  // We set the adapter.call object to undefined immediately when a call is ended.
19706
19743
  // We do not set the context.callId to undefined because it is a part of the immutable data flow loop.
19707
19744
  this.call = undefined;
@@ -19815,14 +19852,14 @@ class AzureCommunicationCallAdapter {
19815
19852
  throw new Error('Unable to start call.');
19816
19853
  }
19817
19854
  this.processNewCall(call);
19818
- return this.call;
19855
+ return call;
19819
19856
  }
19820
19857
  processNewCall(call) {
19821
19858
  this.call = call;
19822
19859
  this.context.setCurrentCallId(call.id);
19823
19860
  // Resync state after callId is set
19824
19861
  this.context.updateClientState(this.callClient.getState());
19825
- this.handlers = createDefaultCallingHandlers(this.callClient, this.callAgent, this.deviceManager, this.call);
19862
+ this.handlers = createHandlers(this.callClient, this.callAgent, this.deviceManager, this.call);
19826
19863
  this.subscribeCallEvents();
19827
19864
  }
19828
19865
  removeParticipant(userId) {
@@ -19983,40 +20020,26 @@ const createAzureCommunicationCallAdapter = ({ userId, displayName, credential,
19983
20020
  /* @conditional-compile-remove(rooms) */ options);
19984
20021
  return adapter;
19985
20022
  });
20023
+ /* @conditional-compile-remove(teams-identity-support) */
19986
20024
  /**
19987
- * A custom React hook to simplify the creation of {@link CallAdapter}.
19988
- *
19989
- * Similar to {@link createAzureCommunicationCallAdapter}, but takes care of asynchronous
19990
- * creation of the adapter internally.
19991
- *
19992
- * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
19993
- * as they are created. The adapter is only created when all arguments are defined.
19994
- *
19995
- * Note that you must memoize the arguments to avoid recreating adapter on each render.
19996
- * See storybook for typical usage examples.
19997
- *
19998
- * @public
19999
- */
20000
- const useAzureCommunicationCallAdapter = (
20001
- /**
20002
- * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.
20003
- *
20004
- * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
20005
- * as they are created. The adapter is only created when all arguments are defined.
20006
- */
20007
- args,
20008
- /**
20009
- * Optional callback to modify the adapter once it is created.
20010
- *
20011
- * If set, must return the modified adapter.
20025
+ * @beta
20012
20026
  */
20013
- afterCreate,
20027
+ const createAzureCommunicationTeamsCallAdapter = ({ userId, credential, locator,
20028
+ /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId }) => __awaiter$4(void 0, void 0, void 0, function* () {
20029
+ const callClient = createStatefulCallClient({
20030
+ userId,
20031
+ /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId
20032
+ });
20033
+ const callAgent = yield callClient.createTeamsCallAgent(credential, {
20034
+ undefined
20035
+ });
20036
+ const adapter = createAzureCommunicationTeamsCallAdapterFromClient(callClient, callAgent, locator);
20037
+ return adapter;
20038
+ });
20014
20039
  /**
20015
- * Optional callback called before the adapter is disposed.
20016
- *
20017
- * This is useful for clean up tasks, e.g., leaving any ongoing calls.
20040
+ * @private
20018
20041
  */
20019
- beforeDispose) => {
20042
+ const useAzureCommunicationCallAdapterGeneric = (args, createAzureCommunicationCallAdapter, afterCreate, beforeDispose) => {
20020
20043
  const { credential, displayName, locator, userId,
20021
20044
  /*@conditional-compile-remove(PSTN-calls) */ alternateCallerId,
20022
20045
  /*@conditional-compile-remove(rooms) */ options } = args;
@@ -20070,11 +20093,12 @@ beforeDispose) => {
20070
20093
  afterCreateRef,
20071
20094
  /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
20072
20095
  beforeDisposeRef,
20096
+ createAzureCommunicationCallAdapter,
20073
20097
  credential,
20074
20098
  displayName,
20075
20099
  locator,
20076
- userId,
20077
- /* @conditional-compile-remove(PSTN-calls) */ options
20100
+ /* @conditional-compile-remove(rooms) */ options,
20101
+ userId
20078
20102
  ]);
20079
20103
  // Dispose any existing adapter when the component unmounts.
20080
20104
  React.useEffect(() => {
@@ -20092,6 +20116,79 @@ beforeDispose) => {
20092
20116
  }, []);
20093
20117
  return adapter;
20094
20118
  };
20119
+ /**
20120
+ * A custom React hook to simplify the creation of {@link CallAdapter}.
20121
+ *
20122
+ * Similar to {@link createAzureCommunicationCallAdapter}, but takes care of asynchronous
20123
+ * creation of the adapter internally.
20124
+ *
20125
+ * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
20126
+ * as they are created. The adapter is only created when all arguments are defined.
20127
+ *
20128
+ * Note that you must memoize the arguments to avoid recreating adapter on each render.
20129
+ * See storybook for typical usage examples.
20130
+ *
20131
+ * @public
20132
+ */
20133
+ const useAzureCommunicationCallAdapter = (
20134
+ /**
20135
+ * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.
20136
+ *
20137
+ * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
20138
+ * as they are created. The adapter is only created when all arguments are defined.
20139
+ */
20140
+ args,
20141
+ /**
20142
+ * Optional callback to modify the adapter once it is created.
20143
+ *
20144
+ * If set, must return the modified adapter.
20145
+ */
20146
+ afterCreate,
20147
+ /**
20148
+ * Optional callback called before the adapter is disposed.
20149
+ *
20150
+ * This is useful for clean up tasks, e.g., leaving any ongoing calls.
20151
+ */
20152
+ beforeDispose) => {
20153
+ return useAzureCommunicationCallAdapterGeneric(args, createAzureCommunicationCallAdapter, afterCreate, beforeDispose);
20154
+ };
20155
+ /* @conditional-compile-remove(teams-identity-support) */
20156
+ /**
20157
+ * A custom React hook to simplify the creation of {@link TeamsCallAdapter}.
20158
+ *
20159
+ * Similar to {@link createTeamsAzureCommunicationCallAdapter}, but takes care of asynchronous
20160
+ * creation of the adapter internally.
20161
+ *
20162
+ * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
20163
+ * as they are created. The adapter is only created when all arguments are defined.
20164
+ *
20165
+ * Note that you must memoize the arguments to avoid recreating adapter on each render.
20166
+ * See storybook for typical usage examples.
20167
+ *
20168
+ * @beta
20169
+ */
20170
+ const useAzureCommunicationTeamsCallAdapter = (
20171
+ /**
20172
+ * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.
20173
+ *
20174
+ * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
20175
+ * as they are created. The adapter is only created when all arguments are defined.
20176
+ */
20177
+ args,
20178
+ /**
20179
+ * Optional callback to modify the adapter once it is created.
20180
+ *
20181
+ * If set, must return the modified adapter.
20182
+ */
20183
+ afterCreate,
20184
+ /**
20185
+ * Optional callback called before the adapter is disposed.
20186
+ *
20187
+ * This is useful for clean up tasks, e.g., leaving any ongoing calls.
20188
+ */
20189
+ beforeDispose) => {
20190
+ return useAzureCommunicationCallAdapterGeneric(args, createAzureCommunicationTeamsCallAdapter, afterCreate, beforeDispose);
20191
+ };
20095
20192
  /**
20096
20193
  * Create a {@link CallAdapter} using the provided {@link StatefulCallClient}.
20097
20194
  *
@@ -20107,6 +20204,21 @@ const createAzureCommunicationCallAdapterFromClient = (callClient, callAgent, lo
20107
20204
  return new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager,
20108
20205
  /* @conditional-compile-remove(rooms) */ options);
20109
20206
  });
20207
+ /* @conditional-compile-remove(teams-identity-support) */
20208
+ /**
20209
+ * Create a {@link TeamsCallAdapter} using the provided {@link StatefulCallClient}.
20210
+ *
20211
+ * Useful if you want to keep a reference to {@link StatefulCallClient}.
20212
+ * Consider using {@link createAzureCommunicationCallAdapter} for a simpler API.
20213
+ *
20214
+ * @beta
20215
+ */
20216
+ const createAzureCommunicationTeamsCallAdapterFromClient = (callClient, callAgent, locator) => __awaiter$4(void 0, void 0, void 0, function* () {
20217
+ const deviceManager = (yield callClient.getDeviceManager());
20218
+ /* @conditional-compile-remove(unsupported-browser) */
20219
+ yield callClient.feature(communicationCalling.Features.DebugInfo).getEnvironmentInfo();
20220
+ return new AzureCommunicationCallAdapter(callClient, locator, callAgent, deviceManager);
20221
+ });
20110
20222
  const isCallError = (e) => {
20111
20223
  return e['target'] !== undefined && e['innerError'] !== undefined;
20112
20224
  };
@@ -22118,6 +22230,8 @@ exports.createAzureCommunicationCallWithChatAdapter = createAzureCommunicationCa
22118
22230
  exports.createAzureCommunicationCallWithChatAdapterFromClients = createAzureCommunicationCallWithChatAdapterFromClients;
22119
22231
  exports.createAzureCommunicationChatAdapter = createAzureCommunicationChatAdapter;
22120
22232
  exports.createAzureCommunicationChatAdapterFromClient = createAzureCommunicationChatAdapterFromClient;
22233
+ exports.createAzureCommunicationTeamsCallAdapter = createAzureCommunicationTeamsCallAdapter;
22234
+ exports.createAzureCommunicationTeamsCallAdapterFromClient = createAzureCommunicationTeamsCallAdapterFromClient;
22121
22235
  exports.createDefaultCallingHandlers = createDefaultCallingHandlers;
22122
22236
  exports.createDefaultChatHandlers = createDefaultChatHandlers;
22123
22237
  exports.createDefaultTeamsCallingHandlers = createDefaultTeamsCallingHandlers;
@@ -22132,6 +22246,7 @@ exports.toFlatCommunicationIdentifier = toFlatCommunicationIdentifier;
22132
22246
  exports.useAzureCommunicationCallAdapter = useAzureCommunicationCallAdapter;
22133
22247
  exports.useAzureCommunicationCallWithChatAdapter = useAzureCommunicationCallWithChatAdapter;
22134
22248
  exports.useAzureCommunicationChatAdapter = useAzureCommunicationChatAdapter;
22249
+ exports.useAzureCommunicationTeamsCallAdapter = useAzureCommunicationTeamsCallAdapter;
22135
22250
  exports.useCall = useCall;
22136
22251
  exports.useCallAgent = useCallAgent;
22137
22252
  exports.useCallClient = useCallClient;