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 getMeetingDetailsVerbose Interface #2489

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
4 changes: 2 additions & 2 deletions apps/teams-test-app/e2e-test-data/meeting.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
},
{
"title": "getMeetingDetailsVerbose API Call - Success",
"version": ">2.22.0",
TrevorJoelHarris marked this conversation as resolved.
Show resolved Hide resolved
"version": ">2.28.0",
"type": "callResponse",
"boxSelector": "#box_getMeetingDetailsVerbose",
"expectedAlertValue": "getMeetingDetails called with shouldGetVerboseDetails: true",
"expectedTestAppValue": "{\"details\":{\"scheduledStartTime\":\"testStartTime\",\"joinUrl\":\"testJoinUrl\",\"type\":\"oneOnOneCall\",\"originalCaller\":\"testCallerId\",\"dialedEntity\":\"testDnis\",\"trackingId\":\"testTrackingId\"},\"conversation\":{\"id\":\"testConversationId\"},\"organizer\":{\"id\":\"testOrganizerId\",\"tenantId\":\"testTenantId\"}}"
"expectedTestAppValue": "{\"details\":{\"scheduledStartTime\":\"testStartTime\",\"joinUrl\":\"testJoinUrl\",\"type\":\"oneOnOneCall\",\"originalCallerInfo\":{\"phoneNumber\":\"1234567890\",\"email\":{\"val\":\"[email protected]\"}},\"dialedEntityInfo\":{\"phoneNumber\":\"1234567890\",\"email\":{\"val\":\"[email protected]\"}},\"trackingId\":\"testTrackingId\",\"callId\":\"testCallId\"},\"conversation\":{\"id\":\"testConversationId\"},\"organizer\":{\"id\":\"testOrganizerId\",\"tenantId\":\"testTenantId\"}}"
},
{
"title": "getAuthenticationTokenForAnonymousUser API Call - Success",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "Added three properties to `ICallDetails`, `originalCallerInfo`, `dialedEntityInfo`, and `callId`, created a new type `ICallParticipantIdentifiers`, and deprecated the `originalCaller` and `dialedEntity` properties",
"packageName": "@microsoft/teams-js",
"email": "[email protected]",
"dependentChangeType": "patch"
}
60 changes: 59 additions & 1 deletion packages/teams-js/src/public/meeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,29 +94,68 @@ export namespace meeting {
type?: T;
}

/**
* @hidden
* Hide from docs
* Data structure to represent call participant identifiers
*/
interface ICallParticipantIdentifiers {
/**
* Phone number of a PSTN caller
*/
phoneNumber?: string;
TrevorJoelHarris marked this conversation as resolved.
Show resolved Hide resolved

/**
* Email of a VoIP caller
*/
email?: EmailAddress;
}

/**
* @hidden
* Hide from docs
* Data structure to represent call details
*/
export interface ICallDetails extends IMeetingOrCallDetailsBase<CallType> {
/**
* @deprecated please use {@link ICallDetails.originalCallerInfo} instead
*
* @hidden
* Phone number of a PSTN caller or email of a VoIP caller
*/
originalCaller?: string;

/**
* @hidden
* Object representing the original caller
*/
originalCallerInfo?: ICallParticipantIdentifiers;

/**
* @deprecated please use {@link ICallDetails.dialedEntityInfo} instead
*
* @hidden
* Phone number of a PSTN callee or email of a VoIP callee
*/
dialedEntity?: never;

/**
* @hidden
* Object representing the entity the caller dialed
*/
dialedEntityInfo?: never;
TrevorJoelHarris marked this conversation as resolved.
Show resolved Hide resolved

/**
* @hidden
* Tracking identifier for grouping related calls
*/
trackingId?: never;

/**
* @hidden
* Identifier for the current call
*/
callId?: never;
}

/**
Expand Down Expand Up @@ -538,6 +577,25 @@ export namespace meeting {
ScreenShare = 'ScreenShare',
}

/**
* Represents a validated email.
*
* @hidden
* Hide from docs.
*/
export class EmailAddress {
TrevorJoelHarris marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you could put this in its own file (emailAddress.ts) in this folder I would really appreciate it. Same for the unit tests being in their own test file. I'd really like us to start using classes like this in other capabilities as well, so moving this to its own file will make it easier to find and share.

If you do this, remember to add the class to the index.ts file (look for where the appId.ts file is referenced for an example)

public constructor(private readonly val: string) {
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
if (!emailRegex.test(this.val)) {
throw new Error('Input email address does not have the correct format.');
}
}

public toString(): string {
return this.val;
}
}

/**
* Allows an app to get the incoming audio speaker setting for the meeting user.
* To learn more, visit https://aka.ms/teamsjs/getIncomingClientAudioState
Expand Down Expand Up @@ -665,7 +723,7 @@ export namespace meeting {

if (
(response.details?.type == CallType.GroupCall || response.details?.type == CallType.OneOnOneCall) &&
!response.details.originalCaller
!response.details.originalCallerInfo
TrevorJoelHarris marked this conversation as resolved.
Show resolved Hide resolved
) {
throw new Error(ErrorCode.NOT_SUPPORTED_ON_PLATFORM.toString());
}
Expand Down
10 changes: 8 additions & 2 deletions packages/teams-js/test/public/meeting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,10 @@ describe('meeting', () => {
'https://teams.microsoft.com/l/meetup-join/19%3ameeting_qwertyuiop[phgfdsasdfghjkjbvcxcvbnmyt1234567890!@#$%^&*(%40thread.v2/0?context=%7b%22Tid%22%3a%2272f988bf-86f1-41af-91ab-2d7cd011db47%22%2c%22Oid%22%3a%226b33ac33-85ae-4995-be29-1d38a77aa8e3%22%7d',
type: meeting.CallType.OneOnOneCall,
// Verbose details
originalCaller: 'testCallerId',
originalCallerInfo: {
phoneNumber: '1234567890',
email: new meeting.EmailAddress('[email protected]'),
},
};
const organizer: meeting.IOrganizer = {
id: '8:orgid:6b33ac33-85ae-4995-be29-1d38a77aa8e3',
Expand Down Expand Up @@ -627,7 +630,10 @@ describe('meeting', () => {
'https://teams.microsoft.com/l/meetup-join/19%3ameeting_qwertyuiop[phgfdsasdfghjkjbvcxcvbnmyt1234567890!@#$%^&*(%40thread.v2/0?context=%7b%22Tid%22%3a%2272f988bf-86f1-41af-91ab-2d7cd011db47%22%2c%22Oid%22%3a%226b33ac33-85ae-4995-be29-1d38a77aa8e3%22%7d',
type: meeting.CallType.OneOnOneCall,
// Verbose details
originalCaller: 'testCallerId',
originalCallerInfo: {
phoneNumber: '1234567890',
email: new meeting.EmailAddress('[email protected]'),
},
};
const organizer: meeting.IOrganizer = {
id: '8:orgid:6b33ac33-85ae-4995-be29-1d38a77aa8e3',
Expand Down
Loading