Skip to content

Commit

Permalink
Added new properties originalCallerInfo and dialedEntityInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
MSJohnnyLee committed Sep 27, 2024
1 parent e80ae3e commit d3158fb
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 12 deletions.
2 changes: 1 addition & 1 deletion apps/teams-test-app/e2e-test-data/meeting.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"type": "callResponse",
"boxSelector": "#box_getMeetingDetailsVerbose",
"expectedAlertValue": "getMeetingDetails called with shouldGetVerboseDetails: true",
"expectedTestAppValue": "{\"details\":{\"scheduledStartTime\":\"testStartTime\",\"joinUrl\":\"testJoinUrl\",\"type\":\"oneOnOneCall\",\"originalCaller\":{\"phoneNumber\":\"testCallerPhoneNumber\",\"email\":\"testCallerEmail\"},\"dialedEntity\":{\"phoneNumber\":\"testCalleePhoneNumber\",\"email\":\"testCalleeEmail\"},\"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
51 changes: 46 additions & 5 deletions packages/teams-js/src/public/meeting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export namespace meeting {
/**
* Email of a VoIP caller
*/
email?: string;
email?: EmailAddress;
}

/**
Expand All @@ -118,22 +118,44 @@ export namespace meeting {
*/
export interface ICallDetails extends IMeetingOrCallDetailsBase<CallType> {
/**
* @deprecated please use {@link ICallDetails.originalCallerInfo} instead
*
* @hidden
* originalCaller object
* Phone number of a PSTN caller or email of a VoIP caller
*/
originalCaller?: ICallParticipantIdentifiers;
originalCaller?: string;

/**
* @hidden
* dialedEntity object
* 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;

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

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

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

/**
* Represents a validated email.
*
* @hidden
* Hide from docs.
*/
export class EmailAddress {
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 @@ -682,7 +723,7 @@ export namespace meeting {

if (
(response.details?.type == CallType.GroupCall || response.details?.type == CallType.OneOnOneCall) &&
!response.details.originalCaller
!response.details.originalCallerInfo
) {
throw new Error(ErrorCode.NOT_SUPPORTED_ON_PLATFORM.toString());
}
Expand Down
12 changes: 6 additions & 6 deletions packages/teams-js/test/public/meeting.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,9 +277,9 @@ 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: {
phoneNumber: 'testCallerPhoneNumber',
email: 'testCallerEmail',
originalCallerInfo: {
phoneNumber: '1234567890',
email: new meeting.EmailAddress('[email protected]'),
},
};
const organizer: meeting.IOrganizer = {
Expand Down Expand Up @@ -630,9 +630,9 @@ 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: {
phoneNumber: 'testCallerPhoneNumber',
email: 'testCallerEmail',
originalCallerInfo: {
phoneNumber: '1234567890',
email: new meeting.EmailAddress('[email protected]'),
},
};
const organizer: meeting.IOrganizer = {
Expand Down

0 comments on commit d3158fb

Please sign in to comment.