Changelog
The list of changes for the ONLYOFFICE Apps Embed SDK (docspace-sdk-js).
Version 2.2.0
Upgrading from 2.1.0
- Most method calls now reject instead of resolving when the portal reports a failure (
SDKErrorCode.ApiError) — onlylogin()/createRoom()keep resolving a (now sanitized){ status, message }. Code that checkedresult.status/result.erroron other methods needs to move to.catch(). - The SDK only accepts frame messages from the exact origin of
src— asrcthat redirects to a different origin or scheme on load leaves the frame silently stuck, with no error of its own. See Quickstart. - Stricter TypeScript types:
modeis aTFrameMode(not any string),editorCustomization.uiThemeis aTheme, andexecuteInEditor()'s callback is(editor, asc, data?). JavaScript callers are unaffected. createRoom()takes its settings as aTCreateRoomOptionsobject; the positional arguments from 2.1 (quota,tags, …) still work but are deprecated.package.jsondeclares anexportsmap — only the package's documented entry points and./dist/*stay importable; other deep imports (e.g.@onlyoffice/docspace-sdk-js/dist/api.js) are no longer resolvable.engines.nodeis>=18.
Added
- Added Uploader mode
- Added Forms mode
- Added Chat mode
- Added Personal mode
- Added OAuth authentication:
getToken/accessToken/tokenExpiresAt, proactive token refresh, theonAuthErrorevent (four error codes), andlogin()/logout()rejecting withSDKErrorCode.ModeMismatchin OAuth mode - Added the OAuth bootstrap fields
providerName,inviteKey,emplType, anduidfor automatic sign-in/sign-up in Forms, Chat, and Personal mode - Added custom actions in Manager, Personal, and Forms mode — context menu items for files, folders, and rooms, plus create-menu items, set via
customActionsorsetCustomActions() - Added
onGetExternalData/onSetExternalData: the frame asks the host for integrator-defined data and pushes it back - Added the
stylesUrlconfig field — see also Appearance and language - Added
headerOffset/headerHeight(header layout overrides in Forms, Chat, and Personal mode) andopenEditorInSameTab(where a file opens from the list in Forms and Personal mode whenonEditorOpenisn't set) - Added
filter.groupIdfor pinning the room list to one room group in Manager mode - Added the
onFilterSearchevent (Personal and Public room mode) - Added
RoomType— the room types accepted bycreateRoom()— andRoomType.Private, the end-to-end-encrypted type returned bygetRooms()/onSelectCallbackbut not accepted bycreateRoom() - Added
createRoom()'soptionsargument (TCreateRoomOptions: storage quota, tags, accent color, cover image, VDR indexing and download restrictions) - Added
SDKErrorandSDKErrorCodefor structured method-call errors, and themethodTimeoutconfig field — see Method-call errors - Added the
navigateSection(),setCustomActions(), andupload()instance methods — see Forms mode and Personal mode for usage examples - Added the
onNavigate,onUploadSuccess,onUploadError,onCustomAction,onContentReady,onNoAccess,onNotFound,onEditorOpen,onGetExternalData, andonSetExternalDataevents — see also Events and callbacks - Added an optional
codeargument tologin()for two-factor sign-in — see Two-factor authentication - Added named exports of the whole public API from the package root (
SDK,SDKInstance,SDKError,SDKErrorCode, every enum, and everyT*type) — previously onlySDKwas available, as the default export - Added
TInitConfig, the parameter type of theinit*()wrappers — aTFrameConfigwithout themodefield each wrapper already sets, for strict TypeScript callers
Changed
- Mode-guarded methods (
navigateSection(),setCustomActions(),upload(), and any method the current mode has no handler for) reject withSDKErrorCode.ModeMismatchinstead of throwing synchronously or resolving with a plain string setConfig()now takes aPartial<TFrameConfig>and merges it into the stored config — a call without every field no longer resets the rest to their defaults- Personal mode: the frame URL no longer carries
showMenu,infoPanelVisible, ordownloadToEvent(the frame doesn't read them there);initPersonal()no longer forcesshowMenu/infoPanelVisibletotrue. Personal mode has no navigation menu — switch sections withnavigateSection()only getRooms()sendssearchandcountunder the names the portal's rooms filter actually readseditorCustomization.uiThemetakes aThemevalue ("Base","Dark","System")createFile(),createFolder(),addTagsToRoom(), andremoveTagsFromRoom()accept numeric IDs, the type the data methods returnonSelectCallback,onEditorOpen, andonFileManagerClickare now typed with their real payloads instead of a bareobjectlogin()returnsPromise<TLoginResult>instead ofPromise<object>, and documents that the portal forwards onlyemailandpasswordHashand always requests a persistent sessiondestroyFrame()documents that it's synchronous, rejects any pending method calls withSDKErrorCode.Disconnected, and leaves the frame ready for an immediate re-init*— see Destroy framesetIsLoaded()is documented as a public method again: it reveals the frame and firesonContentReady, and can be called by the host to take over the loading hand-off — see Mark iframe as loaded
Deprecated
buttonColorandviewAs— ONLYOFFICE Apps client 4.0 does not read them. CallsetListView()afteronAppReadyto change the layout insteadintegrationUrl— ONLYOFFICE Apps client 4.0 does not read it
Fixed
- Error replies from portals that don't flag failures as such are sanitized (
config/request/stackstripped) before the promise resolves — a failedlogin()no longer exposes the password hash to the host page executeInEditor()'s callback is called with three arguments —(editor, asc, data), not(editor, data)— the previous type letwindow.Ascland in thedataparameter- Personal mode now propagates
providerName,inviteKey,emplType, anduidto the iframe URL, matching Forms and Chat - Restored the missing
withReloadoption forsetConfig() - A
getTokenthat rejects is answered to the frame with an empty token reply, so the frame fails fast instead of waiting out its own timeout dist/api.jsno longer throws at load whendocument.currentScriptisnull(a module script, orapi.jsbundled into another file)- A trailing slash in
srcno longer produces a doubled slash in the iframe URL or the CSP request - Messages from another window at the portal's origin (a popup, a second frame) are ignored — only the instance's own iframe drives it
- A method called while the iframe is missing rejects with
SDKErrorCode.Disconnectedinstead of hanging upload()matchesonUploadSuccess/onUploadErrorto each file by a per-fileuploadId, so two files with the same name no longer resolve each other's promise
Version 2.1.0
- Added the
onFileManagerClickevent - Fixed: restored the default
showHeadervalue in the config
Version 2.0.0
- Added Public room mode
- Added the
noLoaderconfig field — see also Hiding UI elements and frame layout - Added an Index column to the
viewTableColumnsparameter of the default config - Added the
onEditorOpenevent - Added the
executeInEditor()instance method - Added server-side rendering (SSR) support
Version 1.1.0
- First release