import { InitializationData } from "./types"; import { IRteParam } from "./RTE/types"; import { PluginDefinition, PluginBuilder } from "./rtePlugin"; import UiLocation from "./uiLocation"; /** * Class to initialize the App on Contentstack UI. * Import Contentstack App SDK and then call ContentstackAppSDK.init in your code base * * @example Custom Field UI Location * ContentstackAppSDK.init().then(function (sdk) { * const customField = sdk.location.CustomField; * }) * @example Dashboard UI Location * ContentstackAppSDK.init().then(function (sdk) { * const dashboardUILocation = sdk.location.DashboardWidget; * }) * @return {Promise} A promise object which will be resolved with an instance of the {@link UiLocation} class. * @hideconstructor */ declare class ContentstackAppSDK { /** * A static variable that stores the instance of {@link UiLocation} class after initialization */ static _uiLocation: UiLocation; /** * Initializes the App SDK and returns an instance of {@link UiLocation} class */ static init(): Promise; /** * Registers RTE plugins with the Contentstack platform. * This method is the primary entry point for defining and registering custom RTE plugins * built using the PluginBuilder pattern. It returns a function that the Contentstack * platform will invoke at runtime, providing the necessary context. * * @example * // In your plugin's entry file (e.g., src/index.ts): * import ContentstackAppSDK, { PluginBuilder } from '@contentstack/app-sdk'; * * const MyCustomPlugin = new PluginBuilder("my-plugin-id") * .title("My Plugin") * .icon() * .elementType("block") * .display("toolbar") * .render(()=>{return }) * .on("exec", (rte: IRteParam) => { * // Access SDK via rte.sdk if needed: * const sdk = rte.sdk; * // ... plugin execution logic ... * }) * .build(); * * export default ContentstackAppSDK.registerRTEPlugins( * MyCustomPlugin * ); * * @param {...PluginDefinition} pluginDefinitions - One or more plugin definitions created using the `PluginBuilder`. * Each `PluginDefinition` describes the plugin's configuration, callbacks, and any child plugins. * @returns {Promise<{ __isPluginBuilder__: boolean; version: string; plugins: (context: RTEContext, rte: IRteParam) => Promise<{ [key: string]: RTEPlugin; }>; }>} * A Promise that resolves to an object containing: * - `__isPluginBuilder__`: A boolean flag indicating this is a builder-based plugin export. * - `version`: The version of the SDK that registered the plugins. * - `plugins`: An asynchronous function. This function is designed to be invoked by the * Contentstack platform loader, providing the `context` (initialization data) and * the `rte` instance. When called, it materializes and returns a map of the * registered `RTEPlugin` instances, keyed by their IDs. */ static registerRTEPlugins(...pluginDefinitions: PluginDefinition[]): Promise<{ __isPluginBuilder__: boolean; version: string; plugins: (context: InitializationData, rte: IRteParam) => Promise<{ [key: string]: import("./RTE").RTEPlugin; }>; }>; /** * Version of Contentstack App SDK. */ static get SDK_VERSION(): string; } export default ContentstackAppSDK; export { PluginBuilder }; //# sourceMappingURL=index.d.ts.map