import * as OpenFin from '../../../../OpenFin'; import { Channel as ChannelV1, SystemChannel } from './fdc3v1'; import type { Listener } from 'fdc3v2/src/api/Listener'; import type { AppIntent } from 'fdc3v2/src/api/AppIntent'; import type { ImplementationMetadata } from 'fdc3v2/src/api/ImplementationMetadata'; import type { ContextMetadata } from 'fdc3v2/src/api/ContextMetadata'; import type { AppIdentifier } from 'fdc3v2/src/api/AppIdentifier'; import type { AppMetadata } from 'fdc3v2/src/api/AppMetadata'; import type { DisplayMetadata } from 'fdc3v2/src/api/DisplayMetadata'; export type { Listener } from 'fdc3v2/src/api/Listener'; export type { AppIntent } from 'fdc3v2/src/api/AppIntent'; export type { ImplementationMetadata } from 'fdc3v2/src/api/ImplementationMetadata'; export type { ContextMetadata } from 'fdc3v2/src/api/ContextMetadata'; export type { AppIdentifier } from 'fdc3v2/src/api/AppIdentifier'; export type { AppMetadata } from 'fdc3v2/src/api/AppMetadata'; export type { DisplayMetadata } from 'fdc3v2/src/api/DisplayMetadata'; export type ContextHandler = (context: Context, metadata?: ContextMetadata) => void; export type IntentHandler = (context: Context, metadata?: ContextMetadata) => Promise | void; export type IntentResult = Context | Channel | PrivateChannel; export interface Context { id?: { [key: string]: string; }; name?: string; type: string; contextMetadata?: ContextMetadata; metadata?: any; } export interface Intent { name: string; context: Context; metadata: OpenFin.IntentMetadata; } export interface IntentResolution { source: AppIdentifier; intent: string; version?: string; getResult(): Promise; } export interface Channel { readonly id: string; readonly type: 'user' | 'app' | 'private'; readonly displayMetadata?: DisplayMetadata; broadcast(context: Context): Promise; getCurrentContext(contextType?: string): Promise; addContextListener(contextType: string | null, handler: ContextHandler): Listener & Promise; } export type PrivateChannel = Omit & { addContextListener(contextType: string | null, handler: ContextHandler): Promise; onAddContextListener(handler: (contextType?: string) => void): Listener; onUnsubscribe(handler: (contextType?: string) => void): Listener; onDisconnect(handler: () => void): Listener; disconnect(): void; }; export interface DesktopAgent { open(app: AppIdentifier, context?: Context): Promise; findIntent(intent: string, context?: Context, resultType?: string): Promise; findIntentsByContext(context: Context, resultType?: string): Promise>; findInstances(app: AppIdentifier): Promise>; broadcast(context: Context): Promise; raiseIntent(intent: string, context: Context, app?: AppIdentifier): Promise; raiseIntentForContext(context: Context, app?: AppIdentifier): Promise; addIntentListener(intent: string, handler: IntentHandler): Promise; addContextListener(contextType: string | null, handler: ContextHandler): Promise; getUserChannels(): Promise>; joinUserChannel(channelId: string): Promise; getOrCreateChannel(channelId: string): Promise; createPrivateChannel(): Promise; getCurrentChannel(): Promise; leaveCurrentChannel(): Promise; getInfo(): Promise; getAppMetadata(app: AppIdentifier): Promise; getSystemChannels(): Promise>; joinChannel(channelId: string): Promise; }