import { PrivacyDataTags } from "../../../telemetry/TraceLogging";
import { Theme } from "@fluentui/react";
import { CustomTheme } from "../../appTheme";
import { DashboardViewType, UserSignInStatus } from "../../externalApi/externalApiTypes";
import { UserInfo } from "../../webUXApi/userInfoApi";
import { signInType } from "../widgetApis/AuthenticatorApi";
export declare type ApiName = "settings" | "status" | "visibility" | "authenticator" | "lifecycle" | "properties" | "sizes" | "interactions" | "preview" | "innerfocus";
declare let widgetApiVersion: number;
export default widgetApiVersion;
export interface IWidgetInstance {
    readonly widgetDefinitionId: string;
    readonly widgetId: string;
    readonly instanceId: number;
    readonly widgetInstanceId: string;
    readonly indexedDBInstanceId: number;
    accountId: string;
    tryGetApi<T>(apiName: ApiName, minVersion: number, targetVersion: number): T | null;
}
export interface IWidgetStatus {
    showLastUpdated(date: Date): void;
    hideLastUpdated(): void;
    widgetReady(): void;
    widgetError(message: string): void;
    widgetSignIn(signInButtonClicked: () => void): void;
    widgetSignInSuccessful(): void;
}
export declare type WidgetSettingsEvent = "onShowSettingsStart" | "onShowSettingsEnd" | "onHideSettingsStart" | "onHideSettingsEnd";
export interface IWidgetSettings {
    showSettings(): void;
    hideSettings(): void;
    addEventListener(listener: (eventName: WidgetSettingsEvent) => void): void;
    removeEventListener(listener: (eventName: WidgetSettingsEvent) => void): void;
}
export interface IWidgetAuthenticator {
    getProperty(name: string): Promise<string | undefined>;
    getToken(clientId: string, scope: string, resource: string, apiVersion: string): Promise<string>;
}
export declare type WidgetVisibilityEvent = "visible" | "notvisible";
export interface IWidgetVisibility {
    addEventListener(listener: (eventName: WidgetVisibilityEvent) => Promise<void>): void;
    removeEventListener(listener: (eventName: WidgetVisibilityEvent) => Promise<void>): void;
    isVisible(): boolean;
}
export declare type WidgetLifecycleEvent = "resumed" | "contentrefresh" | "suspending" | "removing";
export declare type WidgetComponentEvent = "themechanged" | "gettheme" | "triggeraction";
export interface IWidgetLifecycle {
    addEventListener(listener: (eventName: WidgetLifecycleEvent) => Promise<void>): void;
    removeEventListener(listener: (eventName: WidgetLifecycleEvent) => Promise<void>): void;
}
export declare type WidgetProperty = "sessionId" | "title" | "attribution" | "hostVersion" | "animationsEnabled" | "advancedEffectsEnabled" | "autohideScrollbars" | "colorMode" | "accentColor" | "region" | "activationUrl" | "widgetIconUri" | "displayLocale" | "offline" | "position" | "column" | "accentColorRamp";
export interface IWidgetProperties {
    title: string;
    attribution: string;
    activationUrl: string | null;
    getProperty(name: WidgetProperty): any;
    addPropertyChangeListener(listener: (name: WidgetProperty) => void): void;
    removePropertyChangeListener(listener: (name: WidgetProperty) => void): void;
}
export declare type WidgetSizeEvent = "onSizeChangeStart" | "onSizeChangeEnd";
export declare type WidgetSize = "large" | "medium" | "small";
export interface IWidgetSize {
    getSize(): WidgetSize;
    addEventListener(listener: (eventName: WidgetSizeEvent, size: WidgetSize) => void): void;
    removeEventListener(listener: (eventName: WidgetSizeEvent) => void): void;
}
export declare type WidgetInteractionEvent = "titleInteracted" | "settingsInteracted" | "widgetPositionUpdated";
export interface IWidgetInteractions {
    addEventListener(listener: (eventName: WidgetInteractionEvent) => void): void;
    removeEventListener(listener: (eventName: WidgetInteractionEvent) => void): void;
}
export declare type WidgetView = "halfView" | "fullView";
export declare type ViewChangedEvent = "viewChanged";
export interface IViewChanged {
    getView(): WidgetView;
    addEventListener(listener: (eventName: ViewChangedEvent) => void): void;
    removeEventListener(listener: (eventName: ViewChangedEvent) => void): void;
}
export interface IWidgetFrame {
    widgetInstance: IWidgetInstance;
    onVisibleStateChanged(isVisible: boolean): void;
}
export interface IWidgetRenderer {
    renderWidget(location: HTMLElement, widgetId: string, instanceId: number, size?: WidgetSize, isPromoted?: boolean, boardView?: string): Promise<IWidgetFrame | null>;
}
export interface IWidgetVelocity {
    isFeatureEnabled(feature: WidgetVelocityFeature): boolean;
}
export declare type WidgetVelocityFeature = "Feature_3PAEP" | "Feature_3pPlatformFeeds" | "Feature_AEPEvolvedNotifications" | "Feature_AEPBadgeIdsPayload" | "Feature_AllowMultiInstanceWidgets" | "Feature_AppServiceAdaptiveCardHostApi" | "Feature_AugmentedEntryPoint" | "Feature_AugmentedEntryPointBadging" | "Feature_AuthApiV5" | "Feature_AvoidRenderWhileHidden" | "Feature_BoardsLite" | "Feature_CacheWidgetRegistrations" | "Feature_Disable1PNotificationsOnDMADevices" | "Feature_DMA1POptimization" | "Feature_DMADisableAnnouncementsAndBadges" | "Feature_DMAEdgeUninstall" | "Feature_DMARestrictDataSharing" | "Feature_DMARestrictDiagnosticData" | "Feature_DynamicFeed" | "Feature_ExpandedView" | "Feature_FeedsBackgroundTask" | "Feature_FeedsRotation" | "Feature_FullPageWebXT" | "Feature_HeaderStorageApi" | "Feature_MultiAccount" | "Feature_PinMigration" | "Feature_PinWidgetsFlyout" | "Feature_PlatformFeeds" | "Feature_PreDownloadInitializer" | "Feature_PrefetchBackgroundTaskFeeds" | "Feature_PrefetchPCS" | "Feature_PrefetchFeedContent" | "Feature_ProtocolLaunchCommandAPI" | "Feature_RemoveDefaultInstances" | "Feature_ReauthRequiredUser" | "Feature_SignedOutUser" | "Feature_SettingsFeedCustomization" | "Feature_Unify1SCall" | "Feature_WebWidgetPrototype" | "Feature_WidgetHeaderUpdates" | "Feature_XamlWidgetPicker" | "Feature_CTAOfflinePage" | "Feature_Ruby" | "Feature_InlineExperiment" | "Feature_DashboardSettingsBroker" | "Feature_AddReclaimCodeSupport" | "Feature_SupportScoobeInDashboardSettingsBroker" | "Feature_FixReclaimCode";
export declare type WidgetComponentConfig = {
    elementName: string;
    src: string;
};
export declare type WidgetModelAuth = "AAD" | "MSA" | "NONE";
export interface IWidgetModelRegistration {
    id: string;
    appId: string;
    providerId: string;
    isPlatformWidget: boolean;
    icon: string;
    title: string;
    maxInstances: number;
    supportedAuth: Array<WidgetModelAuth>;
    supportedSizes: Array<WidgetSize>;
    preferredSize: WidgetSize;
}
export interface IWidgetModelPinPreference {
    id: string;
    widgetDefinitionId: string;
    instanceId: number;
    size: WidgetSize;
    column: number;
    position: number;
}
export declare type WidgetModelEvent = "widgetAdded" | "widgetHidden" | "widgetRemoved" | "registrationChange" | "widgetInnerFocus";
export declare type WidgetRegistrationEvent = "added" | "removed" | "changed";
export interface IWidgetModel {
    getWidgetRegistrations(): Promise<Array<IWidgetModelRegistration>>;
    getWidgetRegistration(id: string): Promise<IWidgetModelRegistration | undefined>;
    addRegistrationListener(listener: (eventname: WidgetRegistrationEvent, registrationIds: string[]) => void): void;
    removeRegistrationListener(listener: (eventname: WidgetRegistrationEvent, registrationIds: string[]) => void): void;
    getUserPinnedPreferences(): Promise<Array<IWidgetModelPinPreference>>;
    createPinPreference(id: string, instanceId?: number): void;
    removePinPreference(id: string, instanceId: number): void;
    setPinnedWidgetSize(id: string, instanceId: number, size: WidgetSize): void;
    onVisibleStateChanged(id: string, instanceId: number, isVisible: boolean): Promise<void>;
    addEventListener(listener: (eventName: WidgetModelEvent, widgetInstance: [string, number, string, string]) => void): void;
    removeEventListener(listener: (eventName: WidgetModelEvent, widgetInstance: [string, number, string, string]) => void): void;
}
export interface FeedNotification {
    feedId: string;
    feedProviderId: string;
    id: string;
}
export interface IFeedProviderModelRegistration {
    appId: string;
    settingsUri: string;
    description: string;
    displayName: string;
    id: string;
    icon: string;
}
export interface IFeedModelRegistration {
    appId: string;
    contentUri: string;
    description: string;
    displayName: string;
    id: string;
    providerIcon: string;
    providerId: string;
    missedNotifications: Array<FeedNotification>;
    notifications: boolean;
}
export interface IFeedModelRuntime {
    customQueryParams: string;
}
export declare type FeedModelEvent = "added" | "removed" | "changed" | "listChanged" | "missedNotificationsChanged";
export declare type FeedProviderModelEvent = "added" | "removed" | "changed";
export interface IFeedModel {
    getEnabledFeedsAsync(): Promise<Array<IFeedModelRegistration>>;
    getEnabledFeeds(): Array<IFeedModelRegistration>;
    getFeedProviderRegistrationAsync(feedDefinitionId: string): Promise<IFeedProviderModelRegistration | undefined>;
    getFeedProviderRegistration(feedDefinitionId: string): IFeedProviderModelRegistration | undefined;
    getFeedRegistrationAsync(feedDefinitionId: string): Promise<IFeedModelRegistration | undefined>;
    getFeedRegistration(feedDefinitionId: string): IFeedModelRegistration | undefined;
    setSelectedFeedPivot(id: string): void;
    getSelectedFeedPivotAsync(): Promise<string | undefined>;
    getSelectedFeedPivot(): string | undefined;
    addFeedEventListener(listener: (eventName: FeedModelEvent, eventData: string[]) => void): void;
    removeFeedEventListener(listener: (eventName: FeedModelEvent, eventData: string[]) => void): void;
    addFeedProviderEventListener(listener: (eventName: FeedProviderModelEvent, feedProviderDefinitionId: string) => void): void;
    removeFeedProviderEventListener(listener: (eventName: FeedProviderModelEvent, feedProviderDefinitionId: string) => void): void;
}
export declare type PositionSource = "Cellular" | "Satellite" | "WiFi" | "IPAddress" | "Unknown" | "Default" | "Obfuscated";
export interface IGeocoordinate {
    readonly latitude: number;
    readonly longitude: number;
    readonly accuracy: number;
    readonly positionSource: PositionSource;
    readonly timestamp: string;
}
export declare type GeolocationEvent = "positionChanged";
export interface IGeolocationApi {
    initialize(): Promise<void>;
    getLocation(): Promise<IGeocoordinate>;
    addEventListener(listener: (eventName: GeolocationEvent, location: IGeocoordinate) => void): void;
    removeEventListener(listener: (eventName: GeolocationEvent, location: IGeocoordinate) => void): void;
}
export declare type WidgetModelApiName = "model" | "renderer" | "velocity" | "geolocation" | "telemetry" | "signals" | "authenticator" | "viewchanged" | "dmapolicyevaluator" | "feedsmodel" | "packagestate" | "commands";
export declare const enum WidgetAction {
    ProfileClicked = 0,
    AddButtonClicked = 1,
    UriLaunch = 2,
    DiscoverWidgets = 3
}
export interface IWidgetModelApiFactory {
    tryGetApi<T>(apiName: WidgetModelApiName, minVersion: number, targetVersion: number): T | null;
}
export declare const enum ClickType {
    header = 0,
    content = 1,
    moreOptions = 2
}
export declare const enum PageInteractionType {
    WidgetPicker = 0,
    ProfilePicture = 1,
    Expanded = 2,
    Collapsed = 3,
    Refresh = 4,
    Home = 5,
    Video = 6,
    Shopping = 7,
    Play = 8
}
export declare const enum SettingsType {
    resize = 0,
    customize = 1,
    unpin = 2,
    hide = 3,
    pin = 4,
    other = 5
}
export interface IWidgetAction {
    boardView?: string;
    widgetItem?: IWidgetItem;
    clickAction?: IClickAction;
    settingsAction?: ISettingsAction;
}
export interface ISettingsAction {
    settingsType?: SettingsType;
    oldSize?: WidgetSize;
    newSize?: WidgetSize;
}
export interface IClickAction {
    clickType?: ClickType;
    actionType?: string;
}
export interface IWidgetList {
    widgetItems?: IWidgetItem[];
}
export interface IWidgetItem {
    appId?: string;
    boardView?: string;
    providerId?: string;
    widgetId?: string;
    widgetInstanceId?: string;
    isPinned?: boolean;
    isPeregrine?: boolean;
    widgetDefinitionId?: string;
    isPlatform?: boolean;
    widgetState?: WidgetState;
    widgetStateReason?: WidgetStateTrigger;
}
export interface IWidgetLayoutUpdated {
    boardView?: string;
    trigger?: WidgetStateTrigger;
    layoutUpdateSucceeded?: boolean;
    widgetList?: IWidgetList;
}
export interface IFeedItem {
    appId: string;
    providerId: string;
    isPeregrine: boolean;
    isPlatform: boolean;
}
export interface IFeedAction {
    feedItem: IFeedItem;
    clickAction?: IClickAction;
}
export declare type WidgetState = "Error" | "Normal" | "Loading" | "Unknown";
export declare type WidgetStateTrigger = "DragDrop" | "WidgetPinned" | "WidgetUnPinned" | "WidgetHidden" | "WidgetUnHidden" | "InitialLayout" | "Resize";
export declare type BoardHiddenReason = "close" | "nav";
export interface IBoardAction {
    boardView: string;
    durationInMiliseconds: number;
    durationInMilisecondsFromRender: number;
    hiddenReason?: BoardHiddenReason;
    prevBoardView?: string;
    source?: BoardsInteractionType;
}
export declare const enum BoardsInteractionType {
    BoardScrolled = 0,
    NavBarClicked = 1,
    BoardButtonClicked = 2,
    SettingsButtonClicked = 3,
    DashboardShown = 4,
    DashboardHidden = 5,
    BoardContentViewed = 6,
    StartPersonalizationPageInteracted = 7
}
export declare const enum StartPersonalizationPageInteractionType {
    signIn = 0,
    signOut = 1,
    search = 2,
    follow = 3,
    unfollow = 4,
    viewProfile = 5,
    block = 6,
    unblock = 7
}
export interface StartPersonalizationAction {
    pageInteractionType: StartPersonalizationPageInteractionType;
    contentId?: string;
    source: string;
}
export interface IWidgetSignal {
    name: string;
    signalType: string;
    payload: string;
}
export interface IWidgetSignalApi {
    sendSignal(signal: IWidgetSignal): void;
}
export interface IWidgetPreview {
    sendContent(payload: string, widgetId: string, instanceId: number): Promise<void>;
}
export interface IWidgetInnerFocus {
    innerFrameTookFocus(): void;
}
export interface IWidgetModule {
    defineWidget(config: WidgetComponentConfig): void;
}
export interface IWidgetTelemetryEvent {
    actionType?: string;
    behavior?: string | number;
    contentType?: string | number;
    headline?: string | null;
    instanceId?: number;
    lineage?: string;
    name?: string;
    objectName?: string;
    pageName?: string;
    pageType?: string;
    product?: string;
    vertical?: string;
    widgetId?: string;
}
export declare const enum AppErrorSeverity {
    Alert = 0,
    NoAlert = 1,
    HighImpact = 2,
    Critical = 3
}
export declare type ErrorEventType = "MS.News.Web.AppError";
export interface IWidgetErrorTelemetryEvent {
    name: ErrorEventType;
    widgetId: string;
    instanceId: string;
    errorMessage: string;
    errorCustomMessage?: string | undefined;
    errorSeverity: AppErrorSeverity;
}
export declare type PerformanceEventType = "TTVR";
export interface IWidgetPerformanceEvent {
    name: PerformanceEventType;
    widgetId: string;
    instanceId: string;
    elapsedTimeInMs: number;
    timeStamp: number;
    customMessage?: string | undefined;
}
export interface IWidgetTelemetryApi {
    sendTelemetryEvent(event: IWidgetErrorTelemetryEvent | IWidgetTelemetryEvent): void;
    sendPerformanceEvent(event: IWidgetPerformanceEvent): void;
    markPerfEvent(eventName: string, level?: PrivacyDataTags, payload?: any): void;
}
export declare type AuthenticatorEventType = "identitystatuschanged" | "reauthrequiredstatuschanged";
export interface IAuthenticator {
    initialize(): Promise<void>;
    addEventListener(listener: Function): void;
    removeEventListener(listener: Function): void;
    getAccountIdsAsync(): Promise<Array<string>>;
    getDefaultAccountIdAsync(): Promise<string>;
    getSecondaryAccountIdAsync(): Promise<string>;
    isMSAAccountAsync(accountId: string): Promise<boolean>;
    isAADAccountAsync(accountId: string): Promise<boolean>;
    getAccountPictureAsync(accountId: string): Promise<string>;
    getAccountPropertyAsync(accountId: string, name: string): Promise<string>;
    getAccountTokenAsync(accountId: string, clientId: string, scope: string, resource: string, apiVersion: string, requestSource: string): Promise<{
        token: string;
        errorResult: number;
        interactionRequired: boolean;
        errorMessage: string;
    }>;
    setSignInStatus(status: UserSignInStatus): Promise<void>;
    getReauthRequiredStatusAsync(): Promise<boolean>;
    verifyAccountAsync(entrypoint: string): Promise<void>;
    signInUserAsync(entrypoint: signInType): Promise<void>;
    isUserSignedInAsync(): Promise<boolean>;
    signOutUserAsync(entrypoint: string): Promise<void>;
    getSignInType(clientId: string): Promise<number>;
    getSignInTargetAccountId(): Promise<string>;
    getSignedInAccount(clientId: string): Promise<string>;
    signOutAccount(clientId: string): Promise<void>;
    getAccountPickedTokenAsync(msaClientId: string, aadClientId: string, msaScope: string, aadScope: string, msaResource: string, aadResource: string, apiVersion: string, requestSource: string): Promise<{
        token: string;
        errorResult: number;
        interactionRequired: boolean;
        errorMessage: string;
    }>;
}
export interface IRotationalPreview {
    relatedCardId?: number;
    previewType?: string;
    widgetDefinitionId?: string;
    isRotationalPreview?: boolean;
}
export interface IPreviewInfo {
    relatedCardId?: number;
    previewType?: string;
    widgetDefinitionId?: string;
    isRotationalPreview?: boolean;
    debugId?: string;
    previewSource?: string;
    previewId?: string;
    feedProviderId?: string;
    feedId?: string;
}
export declare enum WidgetForceRefreshUnify1SCallVerb {
    modifyUrl = "modifyUrl",
    refresh = "refresh"
}
export declare enum RefreshContentTaskStatus {
    Failed = 0,
    Succeed = 1,
    Running = 2
}
export declare type ForceRefreshContentCallback = (status: RefreshContentTaskStatus) => void;
export interface IWidgetShellFeeds {
    tryGetFeedsContent(): Promise<string>;
    tryGetBackgroundTaskStatus(): Promise<number>;
    invalidateFeedsCache(): Promise<number>;
    getRotationalPreviewIds(): Promise<IRotationalPreview>;
    getCurrentFeedsServiceActivityID(): Promise<string>;
    getCurrentDefaultPreviewContent(): Promise<string>;
    getCurrentPreviewInTaskbar(): Promise<IPreviewInfo>;
    getTaskbarSettingChangedInfo(): Promise<string>;
    isCurrentFeedsStaticFallback(): Promise<boolean>;
    refreshFeedsContentAsync(verb: WidgetForceRefreshUnify1SCallVerb, data: string): Promise<RefreshContentTaskStatus>;
}
export interface IWidgetBadge {
    getAepBadgeState(): Promise<boolean>;
    getAepBadgeId(): Promise<string>;
    getAepMissedBadgeIds(): Promise<Array<string>>;
    getAepMissedBadgeIdsPayload(): Promise<Array<string>>;
    getAepPayloadContentType(): Promise<string>;
}
export interface IWidgetLocaleTime {
    getCurrentShortUserTime(): Promise<string>;
}
export interface IWidgetWindowView {
    getViewState(): Promise<DashboardViewType>;
    requestChangeView(isExtended: boolean): Promise<void>;
}
export interface IWidgetWindowPin {
    isPinWidgetsFlyout(): Promise<boolean>;
    setPinWidgetsFlyout(isPinWidgetsFlyout: boolean): Promise<void>;
}
export interface IWidgetUserInfo {
    getUserInfo(): Promise<UserInfo>;
}
export interface IWidgetComponentApi {
    getTheme(): Theme & CustomTheme;
    triggerAction(source: WidgetAction): void;
    addEventListener(eventName: WidgetComponentEvent, listener: (data?: any) => any): void;
    removeEventListener(eventName: WidgetComponentEvent, listener: (data?: any) => any): void;
}
/**
 * Prong2 Cache module background task status enums
 */
export declare const BackgroundTaskStatus: {
    readonly Disabled: "0";
    readonly Running: "1";
    readonly Suspended: "2";
};
export declare type BackgroundTaskStatusType = typeof BackgroundTaskStatus[keyof typeof BackgroundTaskStatus];
export declare type PackageStateEvent = "packagestateupdated";
export declare type PackageType = "Microsoft.MicrosoftEdge.Stable_8wekyb3d8bbwe";
export interface IPackageStateApi {
    addEventListener(listener: Function): void;
    removeEventListener(listener: Function): void;
    isPackageInstalled(pfn: PackageType): Promise<boolean>;
}
export interface IDMAPolicyEvaluatorApi {
    isWidgetsRestrictedDataSharingEnabled(): Promise<boolean>;
    isWidgetsRestrictedThirdPartyDataSharingEnabled(): Promise<boolean>;
    isWidgetsFirstPartyExperienceOptimizationEnabled(): Promise<boolean>;
}
export interface IWidgetPinningApi {
    getUserSettingsAsync(storageKey: string): Promise<string>;
    setUserSettingsAsync(storageKey: string, widgetPinnedInfo: string): void;
    isMigrationCompleteAsync(storageKey: string): Promise<boolean>;
}
export interface ICommandDetails {
    name?: string;
    params?: string;
}
export declare type CommandReceivedEvent = "commandsReceived";
export interface ICommandApi {
    addEventListener(listener: (eventName: CommandReceivedEvent, commandDetails: ICommandDetails) => void): void;
    removeEventListener(listener: (eventName: CommandReceivedEvent, commandDetails: ICommandDetails) => void): void;
    getCommandDetailsAsync(): Promise<ICommandDetails | null>;
}
export declare type DefaultStorageContainer = "WIDGET_PINS_CONTAINER";
export interface IHeaderStorageApi {
    deleteContainerAsync(storageContainer: string): Promise<void>;
    deleteHeaderAsync(storageContainer: string, storageKey: string): Promise<void>;
    isMigrationCompleteAsync(storageKey: string): Promise<boolean>;
    getHeaderInfoAsync(storageContainer: string, storageKey: string): Promise<string>;
    getAllHeadersInfoAsync(storageContainer: string): Promise<string>;
    setHeaderInfoAsync(storageContainer: string, storageKey: string, value: string): Promise<void>;
}
