import type { AppClientManager } from '@rocket.chat/apps/dist/client/AppClientManager'; import type { IPermission } from '@rocket.chat/apps-engine/definition/permissions/IPermission'; import type { ISetting } from '@rocket.chat/apps-engine/definition/settings'; import type { Serialized } from '@rocket.chat/core-typings'; import { createContext } from 'react'; import type { IAppExternalURL } from '../definitions/IAppExternalURL'; import type { ICategory } from '../definitions/ICategory'; import type { App } from '../views/marketplace/types'; export interface IAppsOrchestrator { load(): Promise; getAppClientManager(): AppClientManager; handleError(error: unknown): void; getInstalledApps(): Promise; getAppsFromMarketplace(isAdminUser?: boolean): Promise<{ apps: App[]; error?: unknown }>; getAppsOnBundle(bundleId: string): Promise; getApp(appId: string): Promise; setAppSettings(appId: string, settings: ISetting[]): Promise; installApp(appId: string, version: string, permissionsGranted?: IPermission[]): Promise; updateApp(appId: string, version: string, permissionsGranted?: IPermission[]): Promise; buildExternalUrl(appId: string, purchaseType?: 'buy' | 'subscription', details?: boolean): Promise; buildExternalAppRequest(appId: string): Promise<{ url: string }>; buildIncompatibleExternalUrl(appId: string, appVersion: string, action: string): Promise; getCategories(): Promise>; } type AppsContextValue = IAppsOrchestrator | undefined; export const AppsContext = createContext(undefined);