@azure/communication-react 1.4.3-alpha-202212220013.0 → 1.4.3-alpha-202301040014.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 (19) hide show
  1. package/dist/communication-react.d.ts +45 -33
  2. package/dist/dist-cjs/communication-react/index.js +61 -36
  3. package/dist/dist-cjs/communication-react/index.js.map +1 -1
  4. package/dist/dist-esm/acs-ui-common/src/identifier.js +1 -1
  5. package/dist/dist-esm/acs-ui-common/src/identifier.js.map +1 -1
  6. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js +1 -1
  7. package/dist/dist-esm/acs-ui-common/src/telemetryVersion.js.map +1 -1
  8. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.d.ts +2 -1
  9. package/dist/dist-esm/calling-stateful-client/src/StatefulCallClient.js.map +1 -1
  10. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.d.ts +15 -5
  11. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js +56 -31
  12. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/AzureCommunicationCallAdapter.js.map +1 -1
  13. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.d.ts +2 -1
  14. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js +1 -1
  15. package/dist/dist-esm/react-composites/src/composites/CallComposite/adapter/index.js.map +1 -1
  16. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.d.ts +2 -2
  17. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js +1 -1
  18. package/dist/dist-esm/react-composites/src/composites/CallComposite/index.js.map +1 -1
  19. package/package.json +8 -8
@@ -65,6 +65,7 @@ import { LatestMediaDiagnostics } from '@azure/communication-calling';
65
65
  import { LatestNetworkDiagnostics } from '@azure/communication-calling';
66
66
  import type { MediaDiagnosticChangedEventArgs } from '@azure/communication-calling';
67
67
  import { MediaStreamType } from '@azure/communication-calling';
68
+ import { MicrosoftTeamsUserIdentifier } from '@azure/communication-common';
68
69
  import { MicrosoftTeamsUserKind } from '@azure/communication-common';
69
70
  import type { NetworkDiagnosticChangedEventArgs } from '@azure/communication-calling';
70
71
  import { PartialTheme } from '@fluentui/react';
@@ -4151,7 +4152,7 @@ export declare interface ControlBarProps {
4151
4152
  *
4152
4153
  * @public
4153
4154
  */
4154
- export declare const createAzureCommunicationCallAdapter: ({ userId, displayName, credential, locator, alternateCallerId, options }: AzureCommunicationCallAdapterArgs) => Promise<CallAdapter>;
4155
+ export declare const createAzureCommunicationCallAdapter: ({ userId, displayName, credential, locator, alternateCallerId }: AzureCommunicationCallAdapterArgs) => Promise<CallAdapter>;
4155
4156
 
4156
4157
  /**
4157
4158
  * Create a {@link CallAdapter} using the provided {@link StatefulCallClient}.
@@ -4200,21 +4201,6 @@ export declare const createAzureCommunicationChatAdapter: ({ endpoint: endpointU
4200
4201
  */
4201
4202
  export declare const createAzureCommunicationChatAdapterFromClient: (chatClient: StatefulChatClient, chatThreadClient: ChatThreadClient) => Promise<ChatAdapter>;
4202
4203
 
4203
- /**
4204
- * @beta
4205
- */
4206
- export declare const createAzureCommunicationTeamsCallAdapter: ({ userId, credential, locator, alternateCallerId }: AzureCommunicationCallAdapterArgs) => Promise<TeamsCallAdapter>;
4207
-
4208
- /**
4209
- * Create a {@link TeamsCallAdapter} using the provided {@link StatefulCallClient}.
4210
- *
4211
- * Useful if you want to keep a reference to {@link StatefulCallClient}.
4212
- * Consider using {@link createAzureCommunicationCallAdapter} for a simpler API.
4213
- *
4214
- * @beta
4215
- */
4216
- export declare const createAzureCommunicationTeamsCallAdapterFromClient: (callClient: StatefulCallClient, callAgent: TeamsCallAgent, locator: CallAdapterLocator) => Promise<TeamsCallAdapter>;
4217
-
4218
4204
  /**
4219
4205
  * Create the default implementation of {@link CallingHandlers} for teams call.
4220
4206
  *
@@ -4272,6 +4258,21 @@ export declare const createStatefulCallClient: (args: StatefulCallClientArgs, op
4272
4258
  */
4273
4259
  export declare const createStatefulChatClient: (args: StatefulChatClientArgs, options?: StatefulChatClientOptions | undefined) => StatefulChatClient;
4274
4260
 
4261
+ /**
4262
+ * @beta
4263
+ */
4264
+ export declare const createTeamsCallAdapter: ({ userId, credential, locator }: TeamsCallAdapterArgs) => Promise<TeamsCallAdapter>;
4265
+
4266
+ /**
4267
+ * Create a {@link TeamsCallAdapter} using the provided {@link StatefulCallClient}.
4268
+ *
4269
+ * Useful if you want to keep a reference to {@link StatefulCallClient}.
4270
+ * Consider using {@link createAzureCommunicationCallAdapter} for a simpler API.
4271
+ *
4272
+ * @beta
4273
+ */
4274
+ export declare const createTeamsCallAdapterFromClient: (callClient: StatefulCallClient, callAgent: TeamsCallAgent, locator: CallAdapterLocator) => Promise<TeamsCallAdapter>;
4275
+
4275
4276
  /**
4276
4277
  * Object returned after creating a local or remote VideoStream.
4277
4278
  * This contains helper functions to manipulate the render of the stream.
@@ -7440,7 +7441,7 @@ export declare type StatefulCallClientArgs = {
7440
7441
  * UserId from SDK. This is provided for developer convenience to easily access the userId from the
7441
7442
  * state. It is not used by StatefulCallClient.
7442
7443
  */
7443
- userId: CommunicationUserIdentifier;
7444
+ userId: CommunicationUserIdentifier | /* @conditional-compile-remove(teams-identity-support) */ MicrosoftTeamsUserIdentifier;
7444
7445
  /**
7445
7446
  * A phone number in E.164 format that will be used to represent the callers identity. This number is required
7446
7447
  * to start a PSTN call.
@@ -7619,6 +7620,17 @@ export declare interface TeamsCallAdapter extends CommonCallAdapter {
7619
7620
  startCall(participants: CommunicationIdentifier[], options?: StartCallOptions): TeamsCall | undefined;
7620
7621
  }
7621
7622
 
7623
+ /**
7624
+ * Arguments for creating the Azure Communication Services implementation of {@link TeamsCallAdapter}.
7625
+ *
7626
+ * @beta
7627
+ */
7628
+ export declare type TeamsCallAdapterArgs = {
7629
+ userId: MicrosoftTeamsUserIdentifier;
7630
+ credential: CommunicationTokenCredential;
7631
+ locator: TeamsMeetingLinkLocator;
7632
+ };
7633
+
7622
7634
  /**
7623
7635
  * Object containing all the teams call handlers required for calling components.
7624
7636
  *
@@ -7970,22 +7982,6 @@ export declare const useAzureCommunicationCallWithChatAdapter: (args: Partial<Az
7970
7982
  */
7971
7983
  export declare const useAzureCommunicationChatAdapter: (args: Partial<AzureCommunicationChatAdapterArgs>, afterCreate?: ((adapter: ChatAdapter) => Promise<ChatAdapter>) | undefined, beforeDispose?: ((adapter: ChatAdapter) => Promise<void>) | undefined) => ChatAdapter | undefined;
7972
7984
 
7973
- /**
7974
- * A custom React hook to simplify the creation of {@link TeamsCallAdapter}.
7975
- *
7976
- * Similar to {@link createTeamsAzureCommunicationCallAdapter}, but takes care of asynchronous
7977
- * creation of the adapter internally.
7978
- *
7979
- * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
7980
- * as they are created. The adapter is only created when all arguments are defined.
7981
- *
7982
- * Note that you must memoize the arguments to avoid recreating adapter on each render.
7983
- * See storybook for typical usage examples.
7984
- *
7985
- * @beta
7986
- */
7987
- export declare const useAzureCommunicationTeamsCallAdapter: (args: Partial<AzureCommunicationCallAdapterArgs>, afterCreate?: ((adapter: TeamsCallAdapter) => Promise<TeamsCallAdapter>) | undefined, beforeDispose?: ((adapter: TeamsCallAdapter) => Promise<void>) | undefined) => TeamsCallAdapter | undefined;
7988
-
7989
7985
  /**
7990
7986
  * Hook to obtain {@link @azure/communication-calling#Call} from the provider.
7991
7987
  *
@@ -8096,6 +8092,22 @@ export declare const useSelector: <ParamT extends Selector | undefined>(selector
8096
8092
  */
8097
8093
  export declare const useTeamsCall: () => undefined | /* @conditional-compile-remove(teams-identity-support) */ TeamsCall;
8098
8094
 
8095
+ /**
8096
+ * A custom React hook to simplify the creation of {@link TeamsCallAdapter}.
8097
+ *
8098
+ * Similar to {@link createTeamsAzureCommunicationCallAdapter}, but takes care of asynchronous
8099
+ * creation of the adapter internally.
8100
+ *
8101
+ * Allows arguments to be undefined so that you can respect the rule-of-hooks and pass in arguments
8102
+ * as they are created. The adapter is only created when all arguments are defined.
8103
+ *
8104
+ * Note that you must memoize the arguments to avoid recreating adapter on each render.
8105
+ * See storybook for typical usage examples.
8106
+ *
8107
+ * @beta
8108
+ */
8109
+ export declare const useTeamsCallAdapter: (args: Partial<TeamsCallAdapterArgs>, afterCreate?: ((adapter: TeamsCallAdapter) => Promise<TeamsCallAdapter>) | undefined, beforeDispose?: ((adapter: TeamsCallAdapter) => Promise<void>) | undefined) => TeamsCallAdapter | undefined;
8110
+
8099
8111
  /**
8100
8112
  * Hook to obtain {@link @azure/communication-calling#TeamsCallAgent} from the provider.
8101
8113
  *
@@ -127,7 +127,7 @@ const COMMUNICATION_USER_PREFIX = '8:acs:';
127
127
  const PHONE_NUMBER_PREFIX = '4:';
128
128
  const TEAMS_DOD_PREFIX = '8:dod:';
129
129
  const TEAMS_GCCH_PREFIX = '8:gcch:';
130
- const TEAMS_USER_PREFIX = '8:origid:';
130
+ const TEAMS_USER_PREFIX = '8:orgid:';
131
131
  const TEAMS_VISITOR_PREFIX = '8:teamsvisitor:';
132
132
  /**
133
133
  * A string representation of a {@link @azure/communication-common#CommunicationIdentifier}.
@@ -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.3-alpha-202212220013.0';
205
+ var telemetryVersion = '1.4.3-alpha-202301040014.0';
206
206
 
207
207
  // Copyright (c) Microsoft Corporation.
208
208
  /**
@@ -20973,8 +20973,7 @@ class AzureCommunicationCallAdapter {
20973
20973
  * @public
20974
20974
  */
20975
20975
  const createAzureCommunicationCallAdapter = ({ userId, displayName, credential, locator,
20976
- /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
20977
- /* @conditional-compile-remove(rooms) */ options }) => __awaiter$4(void 0, void 0, void 0, function* () {
20976
+ /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId }) => __awaiter$4(void 0, void 0, void 0, function* () {
20978
20977
  if (!isValidIdentifier(userId)) {
20979
20978
  throw new Error('Invalid identifier. Please provide valid identifier object.');
20980
20979
  }
@@ -20985,33 +20984,33 @@ const createAzureCommunicationCallAdapter = ({ userId, displayName, credential,
20985
20984
  const callAgent = yield callClient.createCallAgent(credential, {
20986
20985
  displayName
20987
20986
  });
20988
- const adapter = createAzureCommunicationCallAdapterFromClient(callClient, callAgent, locator,
20989
- /* @conditional-compile-remove(rooms) */ options);
20987
+ const adapter = createAzureCommunicationCallAdapterFromClient(callClient, callAgent, locator);
20990
20988
  return adapter;
20991
20989
  });
20992
20990
  /* @conditional-compile-remove(teams-identity-support) */
20993
20991
  /**
20994
20992
  * @beta
20995
20993
  */
20996
- const createAzureCommunicationTeamsCallAdapter = ({ userId, credential, locator,
20997
- /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId }) => __awaiter$4(void 0, void 0, void 0, function* () {
20994
+ const createTeamsCallAdapter = ({ userId, credential, locator }) => __awaiter$4(void 0, void 0, void 0, function* () {
20998
20995
  const callClient = createStatefulCallClient({
20999
- userId,
21000
- /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId
20996
+ userId
21001
20997
  });
21002
20998
  const callAgent = yield callClient.createTeamsCallAgent(credential, {
21003
20999
  undefined
21004
21000
  });
21005
- const adapter = createAzureCommunicationTeamsCallAdapterFromClient(callClient, callAgent, locator);
21001
+ const adapter = createTeamsCallAdapterFromClient(callClient, callAgent, locator);
21006
21002
  return adapter;
21007
21003
  });
21008
21004
  /**
21009
21005
  * @private
21010
21006
  */
21011
- const useAzureCommunicationCallAdapterGeneric = (args, createAzureCommunicationCallAdapter, afterCreate, beforeDispose) => {
21012
- const { credential, displayName, locator, userId,
21013
- /*@conditional-compile-remove(PSTN-calls) */ alternateCallerId,
21014
- /*@conditional-compile-remove(rooms) */ options } = args;
21007
+ const useAzureCommunicationCallAdapterGeneric = (args, afterCreate, beforeDispose, adapterKind = 'AzureCommunication') => {
21008
+ const { credential, locator, userId } = args;
21009
+ const displayName = 'displayName' in args ? args.displayName : undefined;
21010
+ /* @conditional-compile-remove(PSTN-calls) */
21011
+ const alternateCallerId = 'alternateCallerId' in args ? args.alternateCallerId : undefined;
21012
+ /* @conditional-compile-remove(rooms) */
21013
+ const options = 'options' in args ? args.options : undefined;
21015
21014
  // State update needed to rerender the parent component when a new adapter is created.
21016
21015
  const [adapter, setAdapter] = React.useState(undefined);
21017
21016
  // Ref needed for cleanup to access the old adapter created asynchronously.
@@ -21025,7 +21024,10 @@ const useAzureCommunicationCallAdapterGeneric = (args, createAzureCommunicationC
21025
21024
  afterCreateRef.current = afterCreate;
21026
21025
  beforeDisposeRef.current = beforeDispose;
21027
21026
  React.useEffect(() => {
21028
- if (!credential || !displayName || !locator || !userId) {
21027
+ if (!credential || !locator || !userId) {
21028
+ return;
21029
+ }
21030
+ if (adapterKind === 'AzureCommunication' && !displayName) {
21029
21031
  return;
21030
21032
  }
21031
21033
  (() => __awaiter$4(void 0, void 0, void 0, function* () {
@@ -21041,14 +21043,35 @@ const useAzureCommunicationCallAdapterGeneric = (args, createAzureCommunicationC
21041
21043
  adapterRef.current.dispose();
21042
21044
  adapterRef.current = undefined;
21043
21045
  }
21044
- let newAdapter = yield createAzureCommunicationCallAdapter({
21045
- credential,
21046
- displayName,
21047
- locator,
21048
- userId,
21049
- /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
21050
- /* @conditional-compile-remove(rooms) */ options
21051
- });
21046
+ let newAdapter = undefined;
21047
+ if (adapterKind === 'AzureCommunication') {
21048
+ // This is just the type check to ensure that displayName is defined.
21049
+ if (!displayName) {
21050
+ throw new Error('Unreachable code, displayName already checked above.');
21051
+ }
21052
+ newAdapter = (yield createAzureCommunicationCallAdapter({
21053
+ credential,
21054
+ displayName: displayName,
21055
+ locator,
21056
+ userId: userId,
21057
+ /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
21058
+ /* @conditional-compile-remove(rooms) */ options
21059
+ }));
21060
+ }
21061
+ else if (adapterKind === 'Teams') {
21062
+ /* @conditional-compile-remove(teams-identity-support) */
21063
+ newAdapter = (yield createTeamsCallAdapter({
21064
+ credential,
21065
+ locator: locator,
21066
+ userId: userId
21067
+ }));
21068
+ }
21069
+ else {
21070
+ throw new Error('Unreachable code, unknown adapterKind');
21071
+ }
21072
+ if (!newAdapter) {
21073
+ throw Error('Unreachable code! Get undefined adapter');
21074
+ }
21052
21075
  if (afterCreateRef.current) {
21053
21076
  newAdapter = yield afterCreateRef.current(newAdapter);
21054
21077
  }
@@ -21060,14 +21083,16 @@ const useAzureCommunicationCallAdapterGeneric = (args, createAzureCommunicationC
21060
21083
  [
21061
21084
  adapterRef,
21062
21085
  afterCreateRef,
21063
- /* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
21064
21086
  beforeDisposeRef,
21065
- createAzureCommunicationCallAdapter,
21066
21087
  credential,
21067
- displayName,
21068
21088
  locator,
21069
- /* @conditional-compile-remove(rooms) */ options,
21070
- userId
21089
+ adapterKind,
21090
+ userId,
21091
+ displayName,
21092
+ /* @conditional-compile-remove(PSTN-calls) */
21093
+ alternateCallerId,
21094
+ /* @conditional-compile-remove(rooms) */
21095
+ options
21071
21096
  ]);
21072
21097
  // Dispose any existing adapter when the component unmounts.
21073
21098
  React.useEffect(() => {
@@ -21119,7 +21144,7 @@ afterCreate,
21119
21144
  * This is useful for clean up tasks, e.g., leaving any ongoing calls.
21120
21145
  */
21121
21146
  beforeDispose) => {
21122
- return useAzureCommunicationCallAdapterGeneric(args, createAzureCommunicationCallAdapter, afterCreate, beforeDispose);
21147
+ return useAzureCommunicationCallAdapterGeneric(args, afterCreate, beforeDispose, 'AzureCommunication');
21123
21148
  };
21124
21149
  /* @conditional-compile-remove(teams-identity-support) */
21125
21150
  /**
@@ -21136,7 +21161,7 @@ beforeDispose) => {
21136
21161
  *
21137
21162
  * @beta
21138
21163
  */
21139
- const useAzureCommunicationTeamsCallAdapter = (
21164
+ const useTeamsCallAdapter = (
21140
21165
  /**
21141
21166
  * Arguments to be passed to {@link createAzureCommunicationCallAdapter}.
21142
21167
  *
@@ -21156,7 +21181,7 @@ afterCreate,
21156
21181
  * This is useful for clean up tasks, e.g., leaving any ongoing calls.
21157
21182
  */
21158
21183
  beforeDispose) => {
21159
- return useAzureCommunicationCallAdapterGeneric(args, createAzureCommunicationTeamsCallAdapter, afterCreate, beforeDispose);
21184
+ return useAzureCommunicationCallAdapterGeneric(args, afterCreate, beforeDispose, 'Teams');
21160
21185
  };
21161
21186
  /**
21162
21187
  * Create a {@link CallAdapter} using the provided {@link StatefulCallClient}.
@@ -21182,7 +21207,7 @@ const createAzureCommunicationCallAdapterFromClient = (callClient, callAgent, lo
21182
21207
  *
21183
21208
  * @beta
21184
21209
  */
21185
- const createAzureCommunicationTeamsCallAdapterFromClient = (callClient, callAgent, locator) => __awaiter$4(void 0, void 0, void 0, function* () {
21210
+ const createTeamsCallAdapterFromClient = (callClient, callAgent, locator) => __awaiter$4(void 0, void 0, void 0, function* () {
21186
21211
  const deviceManager = (yield callClient.getDeviceManager());
21187
21212
  /* @conditional-compile-remove(unsupported-browser) */
21188
21213
  yield callClient.feature(communicationCalling.Features.DebugInfo).getEnvironmentInfo();
@@ -23261,13 +23286,13 @@ exports.createAzureCommunicationCallWithChatAdapter = createAzureCommunicationCa
23261
23286
  exports.createAzureCommunicationCallWithChatAdapterFromClients = createAzureCommunicationCallWithChatAdapterFromClients;
23262
23287
  exports.createAzureCommunicationChatAdapter = createAzureCommunicationChatAdapter;
23263
23288
  exports.createAzureCommunicationChatAdapterFromClient = createAzureCommunicationChatAdapterFromClient;
23264
- exports.createAzureCommunicationTeamsCallAdapter = createAzureCommunicationTeamsCallAdapter;
23265
- exports.createAzureCommunicationTeamsCallAdapterFromClient = createAzureCommunicationTeamsCallAdapterFromClient;
23266
23289
  exports.createDefaultCallingHandlers = createDefaultCallingHandlers;
23267
23290
  exports.createDefaultChatHandlers = createDefaultChatHandlers;
23268
23291
  exports.createDefaultTeamsCallingHandlers = createDefaultTeamsCallingHandlers;
23269
23292
  exports.createStatefulCallClient = createStatefulCallClient;
23270
23293
  exports.createStatefulChatClient = createStatefulChatClient;
23294
+ exports.createTeamsCallAdapter = createTeamsCallAdapter;
23295
+ exports.createTeamsCallAdapterFromClient = createTeamsCallAdapterFromClient;
23271
23296
  exports.darkTheme = darkTheme;
23272
23297
  exports.fromFlatCommunicationIdentifier = fromFlatCommunicationIdentifier;
23273
23298
  exports.getCallingSelector = getSelector$1;
@@ -23277,7 +23302,6 @@ exports.toFlatCommunicationIdentifier = toFlatCommunicationIdentifier;
23277
23302
  exports.useAzureCommunicationCallAdapter = useAzureCommunicationCallAdapter;
23278
23303
  exports.useAzureCommunicationCallWithChatAdapter = useAzureCommunicationCallWithChatAdapter;
23279
23304
  exports.useAzureCommunicationChatAdapter = useAzureCommunicationChatAdapter;
23280
- exports.useAzureCommunicationTeamsCallAdapter = useAzureCommunicationTeamsCallAdapter;
23281
23305
  exports.useCall = useCall;
23282
23306
  exports.useCallAgent = useCallAgent;
23283
23307
  exports.useCallClient = useCallClient;
@@ -23287,6 +23311,7 @@ exports.useDeviceManager = useDeviceManager;
23287
23311
  exports.usePropsFor = usePropsFor;
23288
23312
  exports.useSelector = useSelector;
23289
23313
  exports.useTeamsCall = useTeamsCall;
23314
+ exports.useTeamsCallAdapter = useTeamsCallAdapter;
23290
23315
  exports.useTeamsCallAgent = useTeamsCallAgent;
23291
23316
  exports.useTheme = useTheme;
23292
23317
  //# sourceMappingURL=index.js.map