Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update storybook #4343

Merged
merged 39 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
5bb94f5
cherry pick code for client
rzdor Mar 26, 2024
920564b
call composite for meetingid
rzdor Mar 26, 2024
3e4703d
review
rzdor Mar 26, 2024
a1d1af1
review build
rzdor Mar 26, 2024
2e48d7e
build review
rzdor Mar 26, 2024
14c6b13
Update storybook
rzdor Mar 26, 2024
f1a52ee
fix build
rzdor Mar 26, 2024
4baba6f
fix build
rzdor Mar 26, 2024
d69bf89
update samples
rzdor Mar 26, 2024
f72a3a6
build review
rzdor Mar 27, 2024
9fc9d0b
Update home page
rzdor Mar 27, 2024
d5de0da
Merge branch 'main' into ruslanz/meeting-id-samples
rzdor Mar 27, 2024
a380e4f
Merge branch 'main' into ruslanz/meeting-id-samples
rzdor Mar 28, 2024
efae338
Code review
rzdor Mar 28, 2024
afa0b97
fix build
rzdor Mar 28, 2024
2bd61b6
fix build
rzdor Mar 28, 2024
8cafad2
code review
rzdor Apr 4, 2024
6e1c176
update home page
rzdor Apr 4, 2024
3ff3b86
Merge branch 'main' into ruslanz/meeting-id-samples
rzdor Apr 4, 2024
c397857
fix mege
rzdor Apr 4, 2024
9265a40
Merge branch 'main' into ruslanz/meeting-id-samples
rzdor Apr 4, 2024
51da760
Update graph api info
rzdor Apr 5, 2024
c11473b
Move teams interop to concepts
rzdor Apr 10, 2024
98e5ef7
Update join meeting pages
rzdor Apr 11, 2024
f05d6b4
review
rzdor Apr 11, 2024
e23488c
clean up
rzdor Apr 11, 2024
2f95dfb
Ruslanz/meeting id samples with set (#4484)
rzdor Apr 19, 2024
688d1ec
Merge branch 'main' into ruslanz/meeting-id-samples
rzdor Apr 22, 2024
026903d
merge clanges
rzdor Apr 22, 2024
d0247d7
update dispose
rzdor Apr 22, 2024
af48d90
update dispose
rzdor Apr 22, 2024
fbb840d
Remove tag
rzdor Apr 22, 2024
e2c7cc4
Merge branch 'ruslanz/meeting-id-samples' into ruslanz/meeting-id-sto…
rzdor Apr 22, 2024
d17ee35
Merge branch 'main' into ruslanz/meeting-id-storybook
rzdor Apr 25, 2024
4b66691
Merge branch 'main' into ruslanz/meeting-id-storybook
rzdor Apr 26, 2024
151e02d
Merge branch 'main' into ruslanz/meeting-id-storybook
rzdor Apr 26, 2024
f8de3df
import sort
rzdor Apr 26, 2024
23c4217
Merge branch 'main' into ruslanz/meeting-id-storybook
rzdor Apr 29, 2024
56006a7
Merge branch 'main' into ruslanz/meeting-id-storybook
rzdor Apr 29, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions common/config/babel/features.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ module.exports = {
'spotlight',
// Feature for tracking beta start call identifier
'start-call-beta',
// Join meeting with meetingId and passcode
'meeting-id',
// Image overlay theme
'image-overlay-theme',
// Close captions feature for ACS calls
Expand Down Expand Up @@ -106,6 +108,8 @@ module.exports = {
'rich-text-editor',
// Feature for spotlight
'spotlight',
// Join meeting with meetingId and passcode
'meeting-id',
// Close captions feature for ACS calls
"acs-close-captions",
],
Expand Down
20 changes: 20 additions & 0 deletions packages/calling-stateful-client/src/CallAgentDeclarative.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,26 @@ describe('declarative call agent', () => {
expect(Object.keys(context.getState().calls).length).toBe(1);
});

test('should update state with new call when join to meeting is invoked', () => {
const mockCallAgent = new MockCallAgent();
const context = new CallContext({ kind: 'communicationUser', communicationUserId: '' });
const internalContext = new InternalCallContext();
expect(Object.keys(context.getState().calls).length).toBe(0);
const declarativeCallAgent = callAgentDeclaratify(mockCallAgent, context, internalContext);
declarativeCallAgent.join({ meetingId: '123', passcode: 'qwe' });
expect(Object.keys(context.getState().calls).length).toBe(1);
});

test('should update state with new call when join to meeting and without passcode is invoked', () => {
const mockCallAgent = new MockCallAgent();
const context = new CallContext({ kind: 'communicationUser', communicationUserId: '' });
const internalContext = new InternalCallContext();
expect(Object.keys(context.getState().calls).length).toBe(0);
const declarativeCallAgent = callAgentDeclaratify(mockCallAgent, context, internalContext);
declarativeCallAgent.join({ meetingId: '123' });
expect(Object.keys(context.getState().calls).length).toBe(1);
});

test('should move call to callEnded when call is removed and add endTime', async () => {
const mockCallAgent = new MockCallAgent();
const context = new CallContext({ kind: 'communicationUser', communicationUserId: '' });
Expand Down
7 changes: 7 additions & 0 deletions packages/calling-stateful-client/src/CallClientState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import {
ScalingMode,
VideoDeviceInfo
} from '@azure/communication-calling';
/* @conditional-compile-remove(meeting-id) */
import { CallInfo, TeamsCallInfo } from '@azure/communication-calling';
/* @conditional-compile-remove(capabilities) */
import { CapabilitiesChangeInfo, ParticipantCapabilities } from '@azure/communication-calling';
/* @conditional-compile-remove(close-captions) */
Expand Down Expand Up @@ -632,6 +634,11 @@ export interface CallState {
* Proxy of {@link @azure/communication-calling#SpotlightCallFeature}.
*/
spotlight?: SpotlightCallFeatureState;
/* @conditional-compile-remove(meeting-id) */
/**
* Proxy of {@link @azure/communication-calling#Call.info}.
*/
info?: CallInfo | TeamsCallInfo;
}

/* @conditional-compile-remove(call-transfer) */
Expand Down
2 changes: 2 additions & 0 deletions packages/calling-stateful-client/src/CallContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ export class CallContext {
existingCall.captionsFeature.currentSpokenLanguage = call.captionsFeature.currentSpokenLanguage;
/* @conditional-compile-remove(close-captions) */
existingCall.captionsFeature.currentCaptionLanguage = call.captionsFeature.currentCaptionLanguage;
/* @conditional-compile-remove(meeting-id) */
existingCall.info = call.info;
} else {
draft.calls[latestCallId] = call;
}
Expand Down
8 changes: 6 additions & 2 deletions packages/calling-stateful-client/src/Converter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ import {
/* @conditional-compile-remove(close-captions) */
import { CaptionsInfo } from './CallClientState';

/* @conditional-compile-remove(teams-identity-support) */
/* @conditional-compile-remove(teams-identity-support) */ /* @conditional-compile-remove(meeting-id) */
import { _isACSCall } from './TypeGuards';
/* @conditional-compile-remove(meeting-id) */
import { _isTeamsCall } from './TypeGuards';
import { CallCommon, IncomingCallCommon } from './BetaToStableTypes';

import { Features } from '@azure/communication-calling';
Expand Down Expand Up @@ -161,7 +163,9 @@ export function convertSdkCallToDeclarativeCall(call: CallCommon): CallState {
},
/* @conditional-compile-remove(hide-attendee-name) */
// TODO: Replace this once the SDK supports hide attendee name
hideAttendeeNames: false
hideAttendeeNames: false,
/* @conditional-compile-remove(meeting-id) */
info: _isACSCall(call) ? call.info : _isTeamsCall(call) ? call.info : undefined
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { CallClientOptions } from '@azure/communication-calling';
import { CallDirection } from '@azure/communication-calling';
import { CallEndReason } from '@azure/communication-calling';
import { CallerInfo } from '@azure/communication-calling';
import { CallInfo } from '@azure/communication-calling';
import { CallKind } from '@azure/communication-calling';
import { CallState as CallState_2 } from '@azure/communication-calling';
import { CallSurvey } from '@azure/communication-calling';
Expand Down Expand Up @@ -91,6 +92,8 @@ import { StartCallOptions } from '@azure/communication-calling';
import { StartCaptionsOptions } from '@azure/communication-calling';
import { TeamsCall } from '@azure/communication-calling';
import { TeamsCallAgent } from '@azure/communication-calling';
import { TeamsCallInfo } from '@azure/communication-calling';
import { TeamsMeetingIdLocator } from '@azure/communication-calling';
import { TeamsMeetingLinkLocator } from '@azure/communication-calling';
import { Theme } from '@fluentui/react';
import { TransferEventArgs } from '@azure/communication-calling';
Expand Down Expand Up @@ -192,7 +195,7 @@ export type AzureCommunicationCallWithChatAdapterArgs = {
userId: CommunicationUserIdentifier;
displayName: string;
credential: CommunicationTokenCredential;
locator: CallAndChatLocator | TeamsMeetingLinkLocator;
locator: CallAndChatLocator | TeamsMeetingLinkLocator | /** @conditional-compile-remove(meeting-id) */ TeamsMeetingIdLocator;
alternateCallerId?: string;
callAdapterOptions?: AzureCommunicationCallAdapterOptions;
};
Expand Down Expand Up @@ -413,7 +416,7 @@ export interface CallAdapterDeviceManagement {
}

// @public
export type CallAdapterLocator = TeamsMeetingLinkLocator | GroupCallLocator | RoomCallLocator | /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator;
export type CallAdapterLocator = TeamsMeetingLinkLocator | GroupCallLocator | RoomCallLocator | /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator | /* @conditional-compile-remove(meeting-id) */ TeamsMeetingIdLocator;

// @public
export type CallAdapterState = CallAdapterUiState & CallAdapterClientState;
Expand Down Expand Up @@ -726,6 +729,7 @@ export interface CallCompositeStrings {
failedToJoinTeamsMeetingReasonAccessDeniedMoreDetails?: string;
failedToJoinTeamsMeetingReasonAccessDeniedTitle: string;
holdScreenLabel: string;
invalidMeetingIdentifier: string;
inviteToRoomRemovedDetails?: string;
inviteToRoomRemovedTitle: string;
learnMore: string;
Expand Down Expand Up @@ -959,6 +963,7 @@ export interface CallState {
endTime: Date | undefined;
hideAttendeeNames?: boolean;
id: string;
info?: CallInfo | TeamsCallInfo;
isMuted: boolean;
isScreenSharingOn: boolean;
kind: CallKind;
Expand Down Expand Up @@ -4264,7 +4269,7 @@ export interface TeamsCallAdapter extends CommonCallAdapter {
export type TeamsCallAdapterArgs = {
userId: MicrosoftTeamsUserIdentifier;
credential: CommunicationTokenCredential;
locator: TeamsMeetingLinkLocator | /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator;
locator: TeamsMeetingLinkLocator | /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator | /* @conditional-compile-remove(meeting-id) */ TeamsMeetingIdLocator;
options?: TeamsAdapterOptions;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -829,4 +829,9 @@ export interface CallCompositeStrings {
* Tooltip for button to exit spotlight
*/
exitSpotlightButtonTooltip: string;
/* @conditional-compile-remove(meeting-id) */
/**
* Error message when the meeting identifier or passcode is invalid
*/
invalidMeetingIdentifier: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import {
} from '@azure/communication-calling';
/* @conditional-compile-remove(spotlight) */
import { SpotlightedParticipant } from '@azure/communication-calling';
/* @conditional-compile-remove(meeting-id) */
import { TeamsMeetingIdLocator } from '@azure/communication-calling';
/* @conditional-compile-remove(reaction) */
import { Reaction } from '@azure/communication-calling';
/* @conditional-compile-remove(close-captions) */
Expand Down Expand Up @@ -405,7 +407,9 @@ export class AzureCommunicationCallAdapter<AgentType extends CallAgent | BetaTea
? (locatorOrTargetCalless as CallAdapterLocator)
: undefined;
this.deviceManager = deviceManager;
const isTeamsMeeting = this.locator ? 'meetingLink' in this.locator : false;
const isTeamsMeeting = this.locator
? 'meetingLink' in this.locator || /* @conditional-compile-remove(meeting-id) */ 'meetingId' in this.locator
: false;

const isRoomsCall = this.locator ? 'roomId' in this.locator : false;

Expand Down Expand Up @@ -653,21 +657,38 @@ export class AzureCommunicationCallAdapter<AgentType extends CallAgent | BetaTea

private _joinCall(audioOptions: AudioOptions, videoOptions: VideoOptions): CallTypeOf<AgentType> {
const isTeamsMeeting = this.locator ? 'meetingLink' in this.locator : false;
/* @conditional-compile-remove(meeting-id) */
const isTeamsMeetingId = this.locator ? 'meetingId' in this.locator : false;
const isRoomsCall = this.locator ? 'roomId' in this.locator : false;

/* @conditional-compile-remove(teams-identity-support) */
if (_isTeamsCallAgent(this.callAgent)) {
if (!isTeamsMeeting) {
throw new Error('Locator not supported by TeamsCallAgent');
if (isTeamsMeeting) {
return this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {
audioOptions,
videoOptions
}) as CallTypeOf<AgentType>;
}
/* @conditional-compile-remove(meeting-id) */
if (isTeamsMeetingId) {
return this.callAgent.join(this.locator as TeamsMeetingIdLocator, {
audioOptions,
videoOptions
}) as CallTypeOf<AgentType>;
}
throw new Error('Locator not supported by TeamsCallAgent');
}

if (isTeamsMeeting) {
return this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {
audioOptions,
videoOptions
}) as CallTypeOf<AgentType>;
}
if (isTeamsMeeting) {
return this.callAgent.join(this.locator as TeamsMeetingLinkLocator, {

/* @conditional-compile-remove(meeting-id) */
if (isTeamsMeetingId) {
return this.callAgent.join(this.locator as TeamsMeetingIdLocator, {
audioOptions,
videoOptions
}) as CallTypeOf<AgentType>;
Expand Down Expand Up @@ -1380,7 +1401,8 @@ export type CallAdapterLocator =
| TeamsMeetingLinkLocator
| GroupCallLocator
| RoomCallLocator
| /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator;
| /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator
| /* @conditional-compile-remove(meeting-id) */ TeamsMeetingIdLocator;

/**
* Common optional parameters to create {@link AzureCommunicationCallAdapter} or {@link TeamsCallAdapter}
Expand Down Expand Up @@ -1490,7 +1512,8 @@ export type TeamsCallAdapterArgs = {
credential: CommunicationTokenCredential;
locator:
| TeamsMeetingLinkLocator
| /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator;
| /* @conditional-compile-remove(teams-adhoc-call) */ /* @conditional-compile-remove(PSTN-calls) */ CallParticipantsLocator
| /* @conditional-compile-remove(meeting-id) */ TeamsMeetingIdLocator;
/**
* Optional parameters for the {@link TeamsCallAdapter} created
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const ACCESS_DENIED_TEAMS_MEETING_SUB_CODE = 5854;
const REMOTE_PSTN_USER_HUNG_UP = 560000;
const REMOVED_FROM_CALL_SUB_CODES = [5000, 5300, REMOTE_PSTN_USER_HUNG_UP];
const CALL_REJECTED_CODE = 603;
/* @conditional-compile-remove(meeting-id) */
const INVALID_MEETING_IDENTIFIER = 5751;
/** @private */
export const ROOM_NOT_FOUND_SUB_CODE = 5732;
/** @private */
Expand Down Expand Up @@ -227,6 +229,16 @@ export const getEndedCallPageProps = (
}
break;
}
/* @conditional-compile-remove(meeting-id) */
switch (endedCall?.callEndReason?.subCode) {
case INVALID_MEETING_IDENTIFIER:
if (locale.strings.call.callRejectedTitle) {
title = locale.strings.call.callRejectedTitle;
moreDetails = locale.strings.call.invalidMeetingIdentifier;
disableStartCallButton = true;
}
break;
}
return { title, moreDetails, disableStartCallButton, iconName };
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,28 @@ describe('Adapter is created as expected', () => {
const adapter = await createAzureCommunicationCallWithChatAdapterFromClients(args);
expect(adapter).toBeDefined();
});

/* @conditional-compile-remove(meeting-id) */
it('when creating a new adapter from stateful client with meeting id', async () => {
const mockCallClient = new MockCallClient() as unknown as StatefulCallClient;
const mockCallAgent = new MockCallAgent();
const locator = { meetingId: '123', passcode: 'qwe' };
const statefulChatClient = createStatefulChatClientMock(new StubChatThreadClient());
const threadClient = statefulChatClient.getChatThreadClient('threadId');
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
const options = { credential: stubCommunicationTokenCredential() };
const args = {
callClient: mockCallClient,
callAgent: mockCallAgent,
callLocator: locator,
chatClient: statefulChatClient,
chatThreadClient: threadClient,
/* @conditional-compile-remove(teams-inline-images-and-file-sharing) */
options: options
};
const adapter = await createAzureCommunicationCallWithChatAdapterFromClients(args);
expect(adapter).toBeDefined();
});
});
/**
* Stub implementation of CommunicationTokenCredential
Expand Down