Skip to content

Commit e5db555

Browse files
[Bugfix] update to use interface (#5836)
* update to use interface * Change files * add comments * update API files
1 parent dc31993 commit e5db555

8 files changed

Lines changed: 229 additions & 70 deletions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "minor",
3+
"area": "improvement",
4+
"workstream": "JSloaders",
5+
"comment": "Update props to extend off the base composite so customers can pass in theme and other options",
6+
"packageName": "@azure/communication-react",
7+
"email": "dmceachern@microsoft.com",
8+
"dependentChangeType": "patch"
9+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"type": "minor",
3+
"area": "improvement",
4+
"workstream": "JSloaders",
5+
"comment": "Update props to extend off the base composite so customers can pass in theme and other options",
6+
"packageName": "@azure/communication-react",
7+
"email": "dmceachern@microsoft.com",
8+
"dependentChangeType": "patch"
9+
}

packages/acs-ui-javascript-loaders/src/callCompositeLoader.ts

Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,38 @@ import { initializeIcons } from '@fluentui/react';
3030
*
3131
* @public
3232
*/
33-
export type CallCompositeLoaderProps = {
33+
export interface CallCompositeLoaderProps extends Partial<BaseCompositeProps<CallCompositeIcons>> {
34+
/**
35+
* UserId for the local user.
36+
*/
3437
userId: CommunicationUserIdentifier;
38+
/**
39+
* CommunicationTokenCredential for the local user.
40+
*/
3541
credential: CommunicationTokenCredential;
42+
/**
43+
* Display name for the local user.
44+
*/
3645
displayName: string;
46+
/**
47+
* locator for the call
48+
*/
3749
locator: CallAdapterLocator;
50+
/**
51+
* Options for the {@link AzureCommunicationCallAdapter}
52+
* This is used to configure the call adapter.
53+
*/
3854
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
55+
/**
56+
* Options for the {@link CallComposite} {@link CallCompositeOptions}
57+
* This is used to configure the call composite.
58+
*/
3959
callCompositeOptions?: CallCompositeOptions;
40-
baseCompositeProps?: BaseCompositeProps<CallCompositeIcons>;
60+
/**
61+
* Device form factor for the composite.
62+
*/
4163
formFactor?: 'mobile' | 'desktop';
42-
};
64+
}
4365

4466
/**
4567
* Loader function for the CallComposite that you can use in your application. This
@@ -60,8 +82,13 @@ export const loadCallComposite = async function (
6082
locator,
6183
callAdapterOptions,
6284
callCompositeOptions,
63-
baseCompositeProps,
64-
formFactor
85+
formFactor,
86+
fluentTheme,
87+
icons,
88+
onFetchAvatarPersonaData,
89+
onFetchParticipantMenuItems,
90+
rtl,
91+
locale
6592
} = loaderArgs;
6693
const adapter = await createAzureCommunicationCallAdapter({
6794
userId,
@@ -78,7 +105,17 @@ export const loadCallComposite = async function (
78105
createRoot(htmlElement).render(
79106
React.createElement(
80107
CallComposite,
81-
{ ...baseCompositeProps, options: callCompositeOptions, adapter, formFactor },
108+
{
109+
options: callCompositeOptions,
110+
adapter,
111+
formFactor,
112+
fluentTheme,
113+
icons,
114+
locale,
115+
onFetchAvatarPersonaData,
116+
onFetchParticipantMenuItems,
117+
rtl
118+
},
82119
null
83120
)
84121
);

packages/acs-ui-javascript-loaders/src/callWithChatCompositeLoader.ts

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,43 @@ import { initializeIcons } from '@fluentui/react';
2929
* - callCompositeOptions: Options for the {@link CallWithChatComposite} {@link CallWithChatCompositeOptions}
3030
* @public
3131
*/
32-
export type CallWithChatCompositeLoaderProps = {
32+
export interface CallWithChatCompositeLoaderProps extends Partial<BaseCompositeProps<CallWithChatCompositeIcons>> {
33+
/**
34+
* UserId for the local user.
35+
*/
3336
userId: CommunicationUserIdentifier;
37+
/**
38+
* CommunicationTokenCredential for the local user.
39+
*/
3440
credential: CommunicationTokenCredential;
41+
/**
42+
* Display name for the local user.
43+
*/
3544
displayName: string;
45+
/**
46+
* Azure communication service endpoint. This used for the token and joining the chat thread.
47+
*/
3648
endpoint: string;
49+
/**
50+
* Locator for the call and the chat thread.
51+
* This is used to join the call and the chat thread.
52+
*/
3753
locator: CallAndChatLocator;
54+
/**
55+
* Options for the {@link AzureCommunicationCallAdapterOptions}
56+
* This is used to configure the call adapter.
57+
*/
3858
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
59+
/**
60+
* Options for the {@link CallWithChatComposite} {@link CallWithChatCompositeOptions}
61+
* This is used to configure the call composite.
62+
*/
3963
callWithChatCompositeOptions?: CallWithChatCompositeOptions;
40-
baseCompositeProps?: BaseCompositeProps<CallWithChatCompositeIcons>;
64+
/**
65+
* Device form factor for the composite.
66+
*/
4167
formFactor?: 'mobile' | 'desktop';
42-
};
68+
}
4369

4470
/**
4571
* Props for the CallWithChatComposite that you can use in your application. This
@@ -61,8 +87,13 @@ export const loadCallWithChatComposite = async function (
6187
locator,
6288
callAdapterOptions,
6389
callWithChatCompositeOptions,
64-
baseCompositeProps,
65-
formFactor
90+
formFactor,
91+
fluentTheme,
92+
locale,
93+
icons,
94+
onFetchAvatarPersonaData,
95+
onFetchParticipantMenuItems,
96+
rtl
6697
} = loaderArgs;
6798
const adapter = await createAzureCommunicationCallWithChatAdapter({
6899
userId,
@@ -80,7 +111,17 @@ export const loadCallWithChatComposite = async function (
80111
createRoot(htmlElement).render(
81112
React.createElement(
82113
CallWithChatComposite,
83-
{ ...baseCompositeProps, options: callWithChatCompositeOptions, adapter, formFactor },
114+
{
115+
options: callWithChatCompositeOptions,
116+
adapter,
117+
formFactor,
118+
fluentTheme,
119+
icons,
120+
locale,
121+
onFetchAvatarPersonaData,
122+
onFetchParticipantMenuItems,
123+
rtl
124+
},
84125
null
85126
)
86127
);

packages/acs-ui-javascript-loaders/src/chatCompositeLoader.ts

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,33 @@ import { initializeIcons } from '@fluentui/react';
2424
* options for the {@link ChatComposite} {@link ChatCompositeOptions}.
2525
* @public
2626
*/
27-
export type ChatCompositeLoaderProps = {
27+
export interface ChatCompositeLoaderProps extends Partial<BaseCompositeProps<ChatCompositeIcons>> {
28+
/**
29+
* UserId for the local user.
30+
*/
2831
userId: CommunicationUserIdentifier;
32+
/**
33+
* CommunicationTokenCredential for the local user.
34+
*/
2935
credential: CommunicationTokenCredential;
36+
/**
37+
* Display name for the local user.
38+
*/
3039
displayName?: string;
40+
/**
41+
* Communication service endpoint. This is used for the token and joining the chat thread.
42+
*/
3143
endpoint: string;
44+
/**
45+
* Communication threadId for the chat thread.
46+
*/
3247
threadId: string;
48+
/**
49+
* Options for the {@link AzureCommunicationChatAdapter}
50+
* This is used to configure the chat adapter.
51+
*/
3352
chatCompositeOptions?: ChatCompositeOptions;
34-
baseCompositeProps?: BaseCompositeProps<ChatCompositeIcons>;
35-
};
53+
}
3654

3755
/**
3856
* Loader function for the ChatComposite that you can use in your application. This
@@ -46,7 +64,20 @@ export const loadChatComposite = async function (
4664
htmlElement: HTMLElement
4765
): Promise<ChatAdapter | undefined> {
4866
initializeIcons();
49-
const { userId, credential, endpoint, threadId, displayName, chatCompositeOptions, baseCompositeProps } = loaderArgs;
67+
const {
68+
userId,
69+
credential,
70+
endpoint,
71+
threadId,
72+
displayName,
73+
chatCompositeOptions,
74+
fluentTheme,
75+
locale,
76+
icons,
77+
onFetchAvatarPersonaData,
78+
onFetchParticipantMenuItems,
79+
rtl
80+
} = loaderArgs;
5081
const adapter = await createAzureCommunicationChatAdapter({
5182
endpoint,
5283
userId,
@@ -60,7 +91,20 @@ export const loadChatComposite = async function (
6091
}
6192

6293
createRoot(htmlElement).render(
63-
React.createElement(ChatComposite, { ...baseCompositeProps, options: chatCompositeOptions, adapter }, null)
94+
React.createElement(
95+
ChatComposite,
96+
{
97+
options: chatCompositeOptions,
98+
adapter,
99+
fluentTheme,
100+
icons,
101+
locale,
102+
onFetchAvatarPersonaData,
103+
onFetchParticipantMenuItems,
104+
rtl
105+
},
106+
null
107+
)
64108
);
65109
return adapter;
66110
};

packages/acs-ui-javascript-loaders/src/outboundCallCompositeLoader.ts

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,40 @@ import { initializeIcons } from '@fluentui/react';
3131
*
3232
* @public
3333
*/
34-
export type OutboundCallCompositeLoaderProps = {
34+
export interface OutboundCallCompositeLoaderProps extends Partial<BaseCompositeProps<CallCompositeIcons>> {
35+
/**
36+
* UserId for the local user.
37+
*/
3538
userId: CommunicationUserIdentifier;
39+
/**
40+
* CommunicationTokenCredential for the local user.
41+
*/
3642
credential: CommunicationTokenCredential;
43+
/**
44+
* Display name for the local user.
45+
*/
3746
displayName: string;
47+
/**
48+
* Participants that will be called.
49+
* This can be a list of either {@link CommunicationUserIdentifier} or string identifiers.
50+
*/
3851
targetCallees: string[] | StartCallIdentifier[];
52+
/**
53+
* Options for the {@link AzureCommunicationCallAdapter}
54+
* This is used to configure the call adapter.
55+
*/
3956
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
40-
baseCompositeProps?: BaseCompositeProps<CallCompositeIcons>;
57+
/**
58+
* Options for the {@link CallComposite} {@link CallCompositeOptions}
59+
* This is used to configure the call composite.
60+
*/
4161
callCompositeOptions?: CallCompositeOptions;
42-
};
62+
/**
63+
* Device form factor for the composite.
64+
* This is used to configure the call composite.
65+
*/
66+
formFactor?: 'mobile' | 'desktop';
67+
}
4368

4469
/**
4570
* Loader function for the OutboundCallComposite that you can use in your application. This

packages/communication-react/review/beta/communication-react.api.md

Lines changed: 22 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -746,16 +746,15 @@ export type CallCompositeIcons = {
746746
};
747747

748748
// @public
749-
export type CallCompositeLoaderProps = {
750-
userId: CommunicationUserIdentifier;
751-
credential: CommunicationTokenCredential;
752-
displayName: string;
753-
locator: CallAdapterLocator;
749+
export interface CallCompositeLoaderProps extends Partial<BaseCompositeProps<CallCompositeIcons>> {
754750
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
755751
callCompositeOptions?: CallCompositeOptions;
756-
baseCompositeProps?: BaseCompositeProps<CallCompositeIcons>;
752+
credential: CommunicationTokenCredential;
753+
displayName: string;
757754
formFactor?: 'mobile' | 'desktop';
758-
};
755+
locator: CallAdapterLocator;
756+
userId: CommunicationUserIdentifier;
757+
}
759758

760759
// @public
761760
export type CallCompositeOptions = {
@@ -1592,17 +1591,16 @@ export type CallWithChatCompositeIcons = {
15921591
};
15931592

15941593
// @public
1595-
export type CallWithChatCompositeLoaderProps = {
1596-
userId: CommunicationUserIdentifier;
1594+
export interface CallWithChatCompositeLoaderProps extends Partial<BaseCompositeProps<CallWithChatCompositeIcons>> {
1595+
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
1596+
callWithChatCompositeOptions?: CallWithChatCompositeOptions;
15971597
credential: CommunicationTokenCredential;
15981598
displayName: string;
15991599
endpoint: string;
1600-
locator: CallAndChatLocator;
1601-
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
1602-
callWithChatCompositeOptions?: CallWithChatCompositeOptions;
1603-
baseCompositeProps?: BaseCompositeProps<CallWithChatCompositeIcons>;
16041600
formFactor?: 'mobile' | 'desktop';
1605-
};
1601+
locator: CallAndChatLocator;
1602+
userId: CommunicationUserIdentifier;
1603+
}
16061604

16071605
// @public
16081606
export type CallWithChatCompositeOptions = {
@@ -2144,15 +2142,14 @@ export type ChatCompositeIcons = {
21442142
};
21452143

21462144
// @public
2147-
export type ChatCompositeLoaderProps = {
2148-
userId: CommunicationUserIdentifier;
2145+
export interface ChatCompositeLoaderProps extends Partial<BaseCompositeProps<ChatCompositeIcons>> {
2146+
chatCompositeOptions?: ChatCompositeOptions;
21492147
credential: CommunicationTokenCredential;
21502148
displayName?: string;
21512149
endpoint: string;
21522150
threadId: string;
2153-
chatCompositeOptions?: ChatCompositeOptions;
2154-
baseCompositeProps?: BaseCompositeProps<ChatCompositeIcons>;
2155-
};
2151+
userId: CommunicationUserIdentifier;
2152+
}
21562153

21572154
// @public
21582155
export type ChatCompositeOptions = {
@@ -4337,15 +4334,15 @@ export interface OptionsDevice {
43374334
}
43384335

43394336
// @public
4340-
export type OutboundCallCompositeLoaderProps = {
4341-
userId: CommunicationUserIdentifier;
4337+
export interface OutboundCallCompositeLoaderProps extends Partial<BaseCompositeProps<CallCompositeIcons>> {
4338+
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
4339+
callCompositeOptions?: CallCompositeOptions;
43424340
credential: CommunicationTokenCredential;
43434341
displayName: string;
4342+
formFactor?: 'mobile' | 'desktop';
43444343
targetCallees: string[] | StartCallIdentifier[];
4345-
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
4346-
baseCompositeProps?: BaseCompositeProps<CallCompositeIcons>;
4347-
callCompositeOptions?: CallCompositeOptions;
4348-
};
4344+
userId: CommunicationUserIdentifier;
4345+
}
43494346

43504347
// @public
43514348
export type OverflowGalleryPosition = 'horizontalBottom' | 'verticalRight' | 'horizontalTop';

0 commit comments

Comments
 (0)