@microsoft/teams-js
Version:
Microsoft Client SDK for building app for Microsoft hosts
523 lines (522 loc) • 13.4 kB
TypeScript
/**
* @hidden
*
* Interface for content data
*
* @internal
* Limited to Microsoft-internal use
*/
export declare enum ContentItemType {
EMAIL = "email",
TEXT = "text",
MEDIA = "media",
CALENDAR_INVITE = "calendarInvite",
WEB_PAGE = "webPage",
MIXED = "mixed",
TEAMS = "teams",
FILE = "file"
}
/**
* @hidden
*
* Common properties for all email content types
*
* @internal
* Limited to Microsoft-internal use
*/
export interface BaseEmailContent {
subject?: string;
body?: string;
sender?: string;
recipients?: string[];
cc?: string[];
bcc?: string[];
attachments?: string[];
renderedHtml?: string;
}
/**
* @hidden
*
* Interface for server email content (must have id, receivedTime, sentTime)
*
* @internal
* Limited to Microsoft-internal use
*/
export interface ServerEmailContent extends BaseEmailContent {
id: string;
receivedTime?: Date;
sentTime?: Date;
}
/**
* @hidden
*
* Interface for draft email content (no id, times optional)
*
* @internal
* Limited to Microsoft-internal use
*/
export interface DraftEmailContent extends BaseEmailContent {
responseToEmailId?: string;
savedTime?: Date;
composeType?: 'new' | 'reply' | 'replyAll' | 'forward';
}
export type EmailContent = ServerEmailContent | DraftEmailContent;
/**
* @hidden
*
* Interface for email content data
*
* @internal
* Limited to Microsoft-internal use
*/
export interface CalendarInviteContent {
id: string;
title?: string;
startTime?: Date;
endTime?: Date;
location?: string;
meetingParameters?: string;
attendees?: string[];
organizer?: string;
body?: string;
attachments?: string[];
}
/**
* @hidden
*
* Interface for web page content data
*
* @internal
* Limited to Microsoft-internal use
*/
export interface WebPageContent {
id?: string;
url: string;
title?: string;
data?: string;
description_for_model?: string;
description?: string;
faviconUrl?: string;
}
/**
* @hidden
*
* Interface for user selected content data
*
* @internal
* Limited to Microsoft-internal use
*/
export interface TextSelection {
content: string;
source?: EmailContent | WebPageContent | CalendarInviteContent | TeamsContent | FileContent;
}
/**
* @hidden
*
* Interface for image media content
*
* @internal
* Limited to Microsoft-internal use
*/
export interface ImageContent {
url: string;
width?: number;
height?: number;
fileSize?: number;
format?: string;
thumbnailUrl?: string;
}
/**
* @hidden
*
* Interface for audio media content
*
* @internal
* Limited to Microsoft-internal use
*/
export interface AudioContent {
url: string;
duration?: number;
fileSize?: number;
format?: string;
transcript?: string;
}
/**
* @hidden
*
* Interface for video media content
*
* @internal
* Limited to Microsoft-internal use
*/
export interface VideoContent {
url: string;
width?: number;
height?: number;
duration?: number;
fileSize?: number;
format?: string;
thumbnailUrl?: string;
transcript?: string;
}
/**
* @hidden
*
* Enum for media selection types
*
* @internal
* Limited to Microsoft-internal use
*/
export declare enum MediaSelectionType {
IMAGE = "image",
AUDIO = "audio",
VIDEO = "video"
}
/**
* @hidden
*
* Interface for media selection
*
* @internal
* Limited to Microsoft-internal use
*/
export interface MediaSelection {
type: MediaSelectionType;
altText?: string;
content: ImageContent | AudioContent | VideoContent;
source?: EmailContent | WebPageContent | CalendarInviteContent | TeamsContent | FileContent;
}
/**
* @hidden
*
* Interface representing the context of a Microsoft Teams chat.
* Contains identifying information for a specific Teams chat session.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface TeamsChatContext {
chatId: string;
}
/**
* @hidden
*
* Interface representing the context of a Microsoft Teams channel.
* Contains identifying information for a specific Teams channel and related content.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface TeamsChannelContext {
channelId: string;
teamId: string;
channelName?: string;
postId?: string;
replyChainId?: string;
clientConversationId?: string;
}
/**
* @hidden
*
* Interface representing the context of a Microsoft Teams meeting.
* Contains configuration and identifying information for Teams meeting sessions including Copilot features.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface TeamsMeetingContext {
callId: string;
threadId: string;
organizerId: string;
messageId?: string;
groupId?: string;
sessionType?: TeamsSessionType;
vroomId?: string;
iCalUid?: string;
conversationId?: string;
locale?: string;
disableHistory?: boolean;
Dimensions?: TeamsDimension[];
UtteranceInfo?: TeamsUtteranceInfo;
copilotMode?: CopilotMode;
transcriptState?: TranscriptState;
enableMeetingCopilotResponseHandoff?: boolean;
enableCopilotResponseCopyRestriction?: boolean;
enableMeetingCopilotVisualInsights?: boolean;
enableMeetingCopilotCitation?: boolean;
}
/**
* @hidden
*
* Enum representing different types of Teams session contexts.
* Defines the various meeting and chat session types within Microsoft Teams.
*
* @internal
* Limited to Microsoft-internal use
*/
export declare enum TeamsSessionType {
Private = "Private",
Shared = "Shared",
Recap = "Recap",
RecapCall = "RecapCall",
PrivateViewCall = "PrivateViewCall",
Chat = "Chat",
Compose = "Compose"
}
/**
* @hidden
*
* Interface for telemetry dimension data used in analytics and reporting.
* Contains dimension name-value pairs for categorizing telemetry data.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface TeamsDimension {
DimensionName: TeamsDimensionName;
DimensionValue: string;
}
/**
* @hidden
*
* Enum defining telemetry dimension names for categorizing analytics data.
* Used to specify the type of dimension being tracked in telemetry systems.
*
* @internal
* Limited to Microsoft-internal use
*/
export declare enum TeamsDimensionName {
ClientDeviceType = "ClientDeviceType",
ClientRing = "ClientRing",
ClientScenarioName = "ClientScenarioName"
}
/**
* @hidden
*
* Interface for utterance identification information used in conversation tracking.
* Contains unique identifiers for individual utterances in chat or meeting contexts.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface TeamsUtteranceInfo {
utteranceId?: string;
}
/**
* @hidden
*
* Enum defining different Copilot operational modes.
* Specifies whether Copilot is enabled and how it should function in Teams contexts.
*
* @internal
* Limited to Microsoft-internal use
*/
export declare enum CopilotMode {
Enabled = "enabled",
Disabled = "disabled",
EnabledWithTranscript = "enabledWithTranscript"
}
/**
* @hidden
*
* Enum defining different transcript states for meeting recordings.
* Indicates the current status of transcript generation and availability.
*
* @internal
* Limited to Microsoft-internal use
*/
export declare enum TranscriptState {
NotStarted = "notStarted",
Active = "active",
Inactive = "inactive",
UnknownFutureValue = "unknownFutureValue"
}
/**
* @hidden
*
* Enum defining the context types for Teams-related content.
* Specifies whether the content is from a chat, channel, meeting, or meeting chat.
*
* @internal
* Limited to Microsoft-internal use
*/
export declare enum TeamsContextType {
Chat = "Chat",
Channel = "Channel",
Meeting = "Meeting",
MeetingChat = "MeetingChat"
}
/**
* @hidden
*
* Interface for Teams-related content data including app information and context.
* Contains metadata about Teams applications and their execution contexts.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface TeamsContent {
appName?: string;
appVersion?: string;
appPlatform?: string;
appRingInfo?: string;
contextType: TeamsContextType;
chatContext?: TeamsChatContext;
channelContext?: TeamsChannelContext;
meetingContext?: TeamsMeetingContext;
}
/**
* @hidden
*
* Interface for file content data including URLs and metadata.
* Represents file attachments and documents referenced in content.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface FileContent {
fileUrl?: string;
}
/**
* @hidden
*
* Interface for a catch all type content data
*
* @internal
* Limited to Microsoft-internal use
*/
export interface MixedContent {
emails?: EmailContent[];
texts?: TextSelection[];
media?: (ImageContent | AudioContent | VideoContent)[];
calendarInvites?: CalendarInviteContent[];
webPages?: WebPageContent[];
files?: FileContent[];
otherContent?: Array<Record<string, unknown>> | undefined;
}
/**
* @hidden
*
* Interface for content data we get from hub
*
* @internal
* Limited to Microsoft-internal use
*/
export type ContentItem = EmailContent | TextSelection | MediaSelection | CalendarInviteContent | WebPageContent | TeamsContent | FileContent | MixedContent;
/**
* @hidden
*
* The Content interface represents the content data structure used in the side panel.
* It si the payload received by the copilot app from the hub.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface Content {
userAction?: string;
contentType: ContentItemType.CALENDAR_INVITE | ContentItemType.EMAIL | ContentItemType.MEDIA | ContentItemType.TEXT | ContentItemType.TEAMS | ContentItemType.FILE | ContentItemType.WEB_PAGE | ContentItemType.MIXED;
formCode?: string;
contentItems: ContentItem[];
metadata?: string;
description?: string;
error_code?: string;
status?: string;
}
/**
* @hidden
*
* The ContentRequest interface represents the request params sent to the hub to fetch content.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface ContentRequest {
/**
* @deprecated Use the index signature `[key: string]: unknown` instead to pass custom properties.
*/
localEndpointInfo?: string;
[key: string]: unknown;
}
/**
* @hidden
*
* The UserConsentRequest interface represents the request params sent to the hub to get user consent.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface UserConsentRequest {
[key: string]: unknown;
}
/**
* @hidden
*
* Interface for the response context used during user consent pre-checks.
* Contains information about the user's consent status and whether to show the consent card.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface PreCheckContextResponse {
error_code?: string;
status?: string;
user_consent: UserConsent;
show_consent_card: boolean;
}
/**
* @hidden
*
* Enum representing possible user consent states.
*
* @internal
* Limited to Microsoft-internal use
*/
export declare enum UserConsent {
Accepted = "accepted",
NotAccepted = "not_accepted"
}
/**
* @hidden
*
* Type for user action handler functions that receive content data.
*
* @internal
* Limited to Microsoft-internal use
*/
export declare enum SidePanelErrorCode {
ConsentNotAccepted = "consent_not_accepted",
PageContentBlockedPolicy = "page_content_blocked_policy",
PageContentBlockedDlp = "page_content_blocked_dlp",
PageContentTypeNotSupportedYet = "page_content_type_not_supported_yet",
PageContentSizeNotSupported = "page_content_size_not_supported",
PageContextChanged = "page_context_changed",
PageContentExtractionFailed = "page_content_extraction_failed",
PageContentSizeNotSupportedPDF = "page_content_size_not_supported_pdf",
NotSupportedOnPlatform = "not_supported_on_platform",
OtherError = "other_error"
}
/**
* @hidden
*
* Interface for errors related to side panel operations.
* Contains an error code and an optional message.
*
* @internal
* Limited to Microsoft-internal use
*/
export interface SidePanelError {
errorCode: SidePanelErrorCode;
message?: string;
}
/**
* @hidden
* @beta
* Implementation of the SidePanelError interface.
* This class extends the built-in Error class and includes an error code.
* It is used to represent errors that occur during side panel operations.
* The error code can be one of the SidePanelErrorCode values or a general ErrorCode.
*/
export declare class SidePanelErrorImpl extends Error implements SidePanelError {
errorCode: SidePanelErrorCode;
constructor(errorCode: SidePanelErrorCode, message?: string);
}