import { ActionHash, AgentPubKey, AppClient, EntryHash } from '@holochain/client'; import { BlockType, AssetInfo, WAL, RenderInfo, BlockName, AppletHash, AppletInfo, AssetLocationAndInfo, OpenWalMode, CreatableType, CreatableName, Hrl, WeaveLocation, FrameNotification, RecordInfo, PeerStatusUpdate, UnsubscribeFunction, GroupPermissionType } from './types'; declare global { interface Window { __WEAVE_API__: WeaveServices; __WEAVE_APPLET_SERVICES__: AppletServices; __WEAVE_RENDER_INFO__: RenderInfo; __WEAVE_PROTOCOL_VERSION__: string; __MOSS_VERSION__: string; __isWe__: boolean | undefined; } } /** * The null hash is used in case a WAL is to address a DNA only, not specific * DHT content */ export declare const NULL_HASH: Uint8Array; /** * * @returns bool: Returns whether this function is being called in a We context. */ export declare const isWeContext: () => true; /** * * @param appletHash Hash of the applet to generate the link for * @param webPrefix Whether to make the link work via web browsers. Default is true. * @returns */ export declare const weaveUrlFromAppletHash: (appletHash: AppletHash, webPrefix?: boolean) => string; export declare function weaveUrlFromWal(wal: WAL, webPrefix?: boolean): string; export declare function weaveUrlToLocation(url: string): WeaveLocation; export declare function weaveUrlToWAL(url: string): WAL; export declare function stringifyHrl(hrl: Hrl): string; export declare function encodeContext(context: any): string; export declare function decodeContext(contextStringified: string): any; export declare const initializeHotReload: () => Promise; export declare class AppletServices { constructor(); /** * Creatables that this Applet offers to be created from a We dialog */ creatables: Record; /** * Render block types that this Applet offers */ blockTypes: Record; /** * Get info about the specified entry of this Applet */ getAssetInfo: (appletClient: AppClient, wal: WAL, recordInfo?: RecordInfo) => Promise; /** * Search in this Applet */ search: (appletClient: AppClient, appletHash: AppletHash, weaveServices: WeaveServices, searchFilter: string) => Promise>; /** * Bind an asset (srcWal) to an asset in your applet (dstWal). */ bindAsset: (appletClient: AppClient, /** * Waeve Asset Locator in the applet requesting the binding */ srcWal: WAL, /** * Weave Asset Locator to which the srcWal should be bound to */ dstWal: WAL, /** * Record location of the dna containing the destination WAL */ dstRecordInfo?: RecordInfo) => Promise; } export interface WeaveServices { /** * * @returns Version of Moss within which this method is being called in */ mossVersion: () => string; /** * Event handler for peer status updates. * * @param callback Callback that gets called if a peer status update event is emitted * @returns */ onPeerStatusUpdate: (callback: (payload: PeerStatusUpdate) => any) => UnsubscribeFunction; /** * Open the main view of the specified Applet * @param appletHash * @returns */ openAppletMain: (appletHash: EntryHash) => Promise; /** * Open the specified block view of the specified Applet * @param appletHash * @param block * @param context * @returns */ openAppletBlock: (appletHash: any, block: string, context: any) => Promise; /** * Open the cross-applet main view of the specified Applet Type. * @param appletBundleId * @returns */ openCrossAppletMain: (appletBundleId: ActionHash) => Promise; /** * Open the specified block view of the specified Applet Type * @param appletBundleId * @param block * @param context * @returns */ openCrossAppletBlock: (appletBundleId: ActionHash, block: string, context: any) => Promise; /** * Open the specified WAL * @param wal * @param context * @returns */ openWal: (wal: WAL, mode?: OpenWalMode) => Promise; /** * Get the group profile of the specified group * @param groupHash * @returns */ groupProfile: (groupHash: any) => Promise; /** * Returns Applet info of the specified Applet * @param appletHash * @returns */ appletInfo: (appletHash: any) => Promise; /** * Gets information about an entry in any other Applet in We * @param wal * @returns */ assetInfo: (wal: WAL) => Promise; /** * Adds the specified HRL to the We-internal clipboard * @param wal * @returns */ walToPocket: (wal: WAL) => Promise; /** * Prompts the user with the search bar and We clipboard to select a WAL. * Returns a WAL as soon as the user has selected a WAL * or undefined if the user cancels the selection process. * @returns */ userSelectWal: () => Promise; /** * Sends notifications to We and depending on user settings and urgency level * further to the operating system. * @param notifications * @returns */ notifyFrame: (notifications: Array) => Promise; /** * Let's the user select a Screen or Window and returns the selected id. Useful * for screen sharing applications. */ userSelectScreen: () => Promise; /** * Request the applet holding the destination WAL (dstWal) to bind the source * WAL (srcWal) to it. * The source WAL must belong to the requesting applet. */ requestBind: (srcWal: WAL, dstWal: WAL) => Promise; /** * Requests to close the containing window. Will only work if the applet is being run in its * own window */ requestClose: () => Promise; /** * Gets the group permission type. May be used to restrict certain actions in the UI. * @returns */ myGroupPermissionType: () => Promise; /** * Gets all the agents that joined the Tool instance of the Tool calling this function * @returns */ appletParticipants: () => Promise; } export declare class WeaveClient implements WeaveServices { get renderInfo(): RenderInfo; private constructor(); static connect(appletServices?: AppletServices): Promise; mossVersion: () => string; onPeerStatusUpdate: (callback: (payload: PeerStatusUpdate) => any) => UnsubscribeFunction; openAppletMain: (appletHash: EntryHash) => Promise; openAppletBlock: (appletHash: any, block: string, context: any) => Promise; openCrossAppletMain: (appletBundleId: ActionHash) => Promise; openCrossAppletBlock: (appletBundleId: ActionHash, block: string, context: any) => Promise; openWal: (wal: WAL, mode?: OpenWalMode) => Promise; groupProfile: (groupHash: any) => Promise; appletInfo: (appletHash: any) => Promise; assetInfo: (wal: WAL) => Promise; walToPocket: (wal: WAL) => Promise; userSelectWal: () => Promise; notifyFrame: (notifications: Array) => Promise; userSelectScreen: () => Promise; requestBind: (srcWal: WAL, dstWal: WAL) => Promise; requestClose: () => Promise; myGroupPermissionType: () => Promise; appletParticipants: () => Promise; }