import { MessageRequestWithRequiredProperties } from './messageObjects'; import { ApiVersionNumber } from './telemetry'; export declare const nestedAppAuthTelemetryVersionNumber: ApiVersionNumber; /** * @hidden * Enumeration for nested app authentication message event names. * * @internal * Limited to Microsoft-internal use * * @enum {string} * * @property {string} Request - Event name for a nested app authentication request. * @property {string} Response - Event name for a nested app authentication response. */ export declare const enum NestedAppAuthMessageEventNames { Request = "NestedAppAuthRequest", Response = "NestedAppAuthResponse" } /** * @hidden * Interface for a nested app authentication request. * * @internal * Limited to Microsoft-internal use * * @interface * @extends {MessageRequest} * * @property {string} func - The function name, should always be 'nestedAppAuthRequest'. * @property {string} data - data associated with the request, represented as a string. */ export interface NestedAppAuthRequest extends MessageRequestWithRequiredProperties { func: 'nestedAppAuth.execute'; data: string; } /** * @hidden * Interface for parsed data from a nested app authentication message. * * @internal * Limited to Microsoft-internal use * * @interface * @property {NestedAppAuthMessageEventNames} messageType - The type of the nested app authentication message event. */ export interface ParsedNestedAppAuthMessageData { messageType: NestedAppAuthMessageEventNames; } /** * @hidden * Interface for a nested app authentication bridge. * * @internal * Limited to Microsoft-internal use * * @interface * * @property {Function} addEventListener - Function to add an event listener to the bridge. Takes an event name and a callback function as parameters. * @property {Function} postMessage - Function to post a message to the bridge. Takes a message string as a parameter. * @property {Function} removeEventListener - Function to remove an event listener from the bridge. Takes an event name and a callback function as parameters. */ export interface NestedAppAuthBridge { addEventListener: (eventName: string, callback: (response: string) => void) => void; postMessage: (message: string) => void; removeEventListener: (eventName: string, callback: (response: string) => void) => void; } /** * @hidden * Interface for a Window object extended with a nested app authentication bridge. * * @internal * Limited to Microsoft-internal use * * @interface * @extends {Window} * * @property {NestedAppAuthBridge} nestedAppAuthBridge - The nested app authentication bridge associated with the window. */ export interface NestedAuthExtendedWindow extends Window { nestedAppAuthBridge: NestedAppAuthBridge; } /** * @hidden * Type for handlers in a nested app authentication bridge. * * @internal * Limited to Microsoft-internal use * * @typedef {Object} NestedAppAuthBridgeHandlers * * @property {Function} onMessage - Function to handle a message event. Takes a MessageEvent object and a callback function as parameters. The callback function is called when a message is received. * @property {Function} handlePostMessage - Function to handle posting a message. Takes a message string as a parameter. */ type NestedAppAuthBridgeHandlers = { onMessage: (evt: MessageEvent, onMessageReceived: (response: string) => void) => void; sendPostMessage: (message: string, apiVersionTag: string) => void; }; /** * @hidden * Attempt to polyfill the nestedAppAuthBridge object on the given window * * @internal * Limited to Microsoft-internal use */ export declare function tryPolyfillWithNestedAppAuthBridge(clientSupportedSDKVersion: string, window: Window | null, handlers: NestedAppAuthBridgeHandlers): void; export {};