Web SDK Comparison Guide
Miro Web SDK Comparison Guide: v1 -> v2
If your app currently uses the Miro Web SDK v1, it’s time to plan your migration to v2. The Miro Developer Platform 2.0 has reworked and improved the Web SDK, focusing on performance and reliability, as well as the developer experience. This document outlines the changes in certain data objects and how those objects relate to others. For a complete map of each v1 endpoint to its v2 counterpart, be sure to check out the reference guide.
Widgets / Items
In the Miro Web SDK v1, the widget
endpoint was polymorphic – meaning that one endpoint was used to represent all potential widget types. The structure of the call would differ depending on what type of widget you were creating or updating. In the v2 SDK, we have replaced this with an independent constructor for each widget (now called "item") type.
The new constructors should feel familiar to you, as they were designed to mostly follow the structure of the type-specific payloads of the previous board.widgets.create()
call. There are two examples below, and for a full map of v1 endpoint calls to their v2 equivalents, please see the reference guide.
v1 Create Widget call | v2 Equivalent |
---|---|
Create an Image
| Create an Image
|
Create a Shape
| Create a Shape
|
The sync()
function
sync()
functionIn the v2 Web SDK, we have introduced a new method for each object type –sync()
. This method will refresh the content of an object without needing to refresh the entire Miro board. For example, if you are programmatically updating the description of a specific card, you would call card.sync()
at the end of the update call so that the refreshed data is immediately available for a user. To learn more about the sync()
function and see several examples of its usage, check out this guide.
Modals
The Miro UI has evolved significantly since the creation of the v1 Web SDK. When building the v2 SDK, we decided to rethink the way we expose extension points. The goal is to create consistency for the user experience so that all web applications feel like a natural extension of the Miro product, and all apps have an intuitive pattern.
Unfortunately, this means that some options that were available to developers in v1 are no longer available in v2, such as the bottom panel and the left sidebar. As of today, we provide developers with two options: the app panel (also known as the left panel) and the pop-up modal.
- The app panel ("Panel") should be used for the majority of your application's interactions, and can be extended to provide multiple views for the user, depending on the context of your app.
- The pop-up modal ("Modal") steals the focus of the browser window, and should be used for more visually-intensive user interactions (such as scrolling through their third-party data, or configuring settings and customizations, etc.).
If you have a use case that relies on certain extension points, we'd like to hear about it. There are several feature requests already noted on our roadmap, and we encourage you to add your votes and subscribe to future updates. You’re also welcome to raise any questions or concerns in our developer Discord or on our community forum.
Additional changes
Several changes were made to improve the developer experience or to introduce consistency between the Web SDK and REST API. These changes include:
- With v2, authentication is now handled automatically when a user clicks on an app icon, meaning developers no longer need to explicitly invoke an authorization flow.
- App names and app icons will now be managed in App Settings. There is no longer a programmatic way to update either the App Name or the App Icon.
- Some endpoints in the v1 SDK were designed to support Enterprise accounts, such as
account.get()
. These have been removed from the v2 Web SDK, and any Enterprise-based changes should be managed through the REST API. - Experimental features or methods can be previewed in the experimental
miro.board.experimental
namespace.
An example - Converting Sticky Notes to Shapes
As an example of the changes that may be required when migrating your own app from v1 to v2, we have included the following example, which shows a side-by-side comparison of the Sticky Note to Shape conversion sample app. The full JavaScript source from both the v1 sample app and the v2 sample app is displayed below, along with a description of each affected piece of the v1 sample code.
v1 Change | ||
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|