/** * (c) Copyright Ascensio System SIA 2026 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * * @license */ import type { TCreateRoomOptions, TFileInfo, TFilesResponse, TFolderInfo, TFrameConfig, TFrameFilter, THashSettings, TManagerViewMode, TRoomInfo, TRoomsResponse, TUserInfo, TCustomActionsConfig, TFormsSection, TLoginResult, TPersonalSection } from "../types"; /** * Manages a single ONLYOFFICE Apps iframe, handles postMessage communication, * and exposes methods for operating on the embedded ONLYOFFICE Apps UI. * * Instances are created and stored by {@link SDK}. Do not construct directly — * use {@link SDK.init} or any `init*` convenience wrapper. * * :::note * Every method that talks to the frame returns a promise that rejects with an {@link SDKError}: * {@link SDKErrorCode.ApiError} when the portal reports a failure (HTTP status in {@link SDKError.status}), * {@link SDKErrorCode.ModeMismatch} when the current mode has no such method, * {@link SDKErrorCode.Timeout} after {@link TFrameConfig.methodTimeout} and * {@link SDKErrorCode.Disconnected} when the frame is not connected. Two legacy methods differ: * {@link SDKInstance.login} and {@link SDKInstance.createRoom} resolve a portal failure as `{ status, message }`. * A portal older than ONLYOFFICE Apps 4.0 does not flag failures: there every method resolves the portal's * error object instead of rejecting. * ::: * * @example * ```typescript * import { SDK } from '@onlyoffice/docspace-sdk-js'; * * const sdk = new SDK(); * const instance = sdk.initManager({ * frameId: 'ds-frame', * src: 'https://portal.example.com', * }); * * instance.getUserInfo().then((user) => console.log(user)); * ``` */ export declare class SDKInstance { #private; /** The iframe configuration options. See {@link TFrameConfig}. */ config: TFrameConfig; /** @param config - Initial frame configuration. See {@link TFrameConfig}. */ constructor(config: TFrameConfig); private static _loaderCache; private static _iframeTemplate; /** * Marks the frame as loaded: fades out the loader spinner, reveals the iframe, * and fires {@link TFrameEvents.onContentReady}. * * The ONLYOFFICE Apps iframe calls this automatically once its content is ready, so most * integrations never need to. Call it manually to reveal the frame on your own schedule, * for example when the host page shows its own loading overlay. Every call re-applies the * iframe size and visibility and fires {@link TFrameEvents.onContentReady}; the loader is * removed by the first one. * * @example * ```typescript * instance.setIsLoaded(); * ``` * * @example * Reveal the frame from a host-side button instead of waiting for the iframe, then react * to the completion via {@link TFrameEvents.onContentReady}. * ```typescript * const instance = sdk.initManager({ * frameId: 'ds-frame', * src: 'https://portal.example.com', * events: { onContentReady: () => console.log('Frame is visible') }, * }); * * document.getElementById('show-frame').onclick = () => instance.setIsLoaded(); * ``` */ setIsLoaded(): void; /** * Inserts the ONLYOFFICE Apps iframe into the DOM element identified by {@link TFrameConfig.frameId}. * * Merges `config` with {@link defaultConfig} and the instance's stored config, * replaces the target `
` with a container holding the iframe (and an optional loader), * attaches the `message` listener, and registers the instance in the global * `DocSpace.SDK.frames` registry. * * Called automatically by {@link SDK.init}. Call again to reinitialize in-place. * * @param config - Frame configuration. See {@link TFrameConfig}. * @returns The created `