diff --git a/wix-dashboard/wix-dashboard.service.json b/wix-dashboard/wix-dashboard.service.json index e8a642d5d4..acfde64aaf 100644 --- a/wix-dashboard/wix-dashboard.service.json +++ b/wix-dashboard/wix-dashboard.service.json @@ -24,15 +24,85 @@ "```js", "import { } from 'wix-dashboard';", "```", + "", "## Before you begin", - "It's important to note that the Wix Dashboard API can only be used in code running on dashboard pages. The functions in this API don't work in backend code or on any other pages on your site." ], + "It's important to note that the Wix Dashboard API can only be used in code running on dashboard pages. The functions in this API don't work in backend code or on any other pages on your site.", + "", + "## Dashboard permissions", + "", + "When you call Wix APIs from your dashboard page code, you need to keep in mind which permissions are available to your code. These permissions are different for dashboard pages created in the Editor and pages created with Wix Blocks.", + "", + "### Pages created in the Editor", + "", + "Permissions for code running on dashboard pages created in the Editor are scoped to the currently logged-in user. This means that if your code makes calls to APIs that the user does not have permissions to access, those calls will fail.", + "", + "For example, your dashboard page code may make a call to the [`stores` API](https://dev.wix.com/docs/velo/api-reference/wix-stores-v2/products/introduction) to add products to the site's store. However, if the user accessing the page has a [role](https://support.wix.com/en/article/roles-permissions-overview) that doesn't allow adding products, those API calls will fail.", + "", + "", + "### Pages created with Wix Blocks", + "", + "Dashboard pages created with Wix Blocks are always part of an [app](https://dev.wix.com/docs/build-an-app/develop-your-app/frameworks/wix-blocks/getting-started-with-blocks/welcome-to-wix-blocks). The code on these pages can access APIs with the permissions of the currently logged-in user, but only if the app has also been granted those permissions.", + "", + "![Dashboard Permissions](../assets/images/dashboard-permissions.png)", + "", + "For example, if your app has permissions to add products to a store, but the current user does not, your app will not be able to use the [`stores` API](https://dev.wix.com/docs/velo/api-reference/wix-stores-v2/products/introduction) to add products to the store. Conversely, if the current user has permissions to add products to a store, but your app does not, your app will not be able to add products to the store. The only way your app can add products to a store is if both your app and the current user have permissions to do so." ], "links": [], "examples": [], "extra": { } }, "properties": [], "operations": - [ { "name": "closeModal", + [ { "name": "addSitePlugin", + "labels": + [ "new" ], + "nameParams": [], + "params": + [ { "name": "pluginId", + "type": "string", + "doc": "ID of the site plugin, which you can find in your app's site plugin extension in the Wix Dev Center." }, + { "name": "options", + "type": "wix-dashboard.AddSitePluginOptions", + "doc": "Options to use when adding a site plugin." } ], + "ret": + { "type": + { "name": "Promise", + "typeParams": + [ "void" ] }, + "doc": "Fulfilled - when the plugin is added to the site." }, + "locations": + [ { "lineno": 1, + "filename": "sitePlugins.js" } ], + "docs": + { "summary": "
\n\n__Important:__\n\nThis API is in [Developer Preview](https://www.wix.com/velo/reference/api-overview/developer-preview) and is subject to change. \n\n
\n\nAdds a site plugin to a slot within an app created by Wix.", + "description": + [ "> This function can only be used in page code files for dashboard pages created in the [Wix editor](https://support.wix.com/en/article/velo-working-with-dashboard-pages) or with [Wix Blocks](https://support.wix.com/en/article/wix-blocks-creating-and-managing-blocks-dashboard-pages).", + "", + "The `addSitePlugin()` function returns a Promise that resolves when the plugin is added to the site.", + "", + "> **Note:** To use this function, Your app must have a site plugin extension. Learn more about [site plugins](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/site-plugins/about-site-plugin-extensions)." ], + "links": [], + "examples": + [ { "title": "Add a site plugin", + "body": + [ "import { addSitePlugin } from 'wix-dashboard';", + "", + "// ...", + "", + "const pluginId = '975bffb7-3c04-42cc-9840-3d48c24e73d5';", + "const pluginPlacement = {", + " appDefinitionId: '13d21c63-b5ec-5912-8397-c3a5ddb27a97',", + " widgetId: 'a91a0543-d4bd-4e6b-b315-9410aa27bcde',", + " slotId: 'slot1',", + "};", + "", + "addSitePlugin(pluginId, { placement: pluginPlacement });" ], + "extra": + { } } ], + "extra": + { } }, + "extra": + { } }, + { "name": "closeModal", "labels": [], "nameParams": [], "params": @@ -386,8 +456,7 @@ "extra": { } }, { "name": "setPageTitle", - "labels": - [ "changed" ], + "labels": [], "nameParams": [], "params": [ { "name": "pageTitle", @@ -591,7 +660,25 @@ "extra": { } } ], "messages": - [ { "name": "Archive", + [ { "name": "AddSitePluginOptions", + "locations": + [ { "lineno": 30, + "filename": "sitePlugins.js" } ], + "docs": + { "summary": "An object representing the options to use when adding a site plugin.", + "links": [], + "examples": [], + "extra": + { } }, + "members": + [ { "name": "placement", + "type": "wix-dashboard.PluginPlacement", + "doc": "Information about the slot in which you want to add the plugin. Learn more about the [slots that are available on Wix app pages](https://dev.wix.com/docs/build-apps/develop-your-app/extensions/site-extensions/site-plugins/supported-wix-app-pages/about-slots)." } ], + "extra": + { }, + "labels": + [ "new" ] }, + { "name": "Archive", "locations": [ { "lineno": 90, "filename": "openMediaManager.js" } ], @@ -1024,6 +1111,30 @@ "extra": { }, "labels": [] }, + { "name": "PluginPlacement", + "locations": + [ { "lineno": 37, + "filename": "sitePlugins.js" } ], + "docs": + { "summary": "An object representing a slot in which to add a plugin.", + "links": [], + "examples": [], + "extra": + { } }, + "members": + [ { "name": "appDefinitionId", + "type": "string", + "doc": "ID of the Wix app." }, + { "name": "widgetId", + "type": "string", + "doc": "ID of the host widget." }, + { "name": "slotId", + "type": "string", + "doc": "ID of the slot." } ], + "extra": + { }, + "labels": + [ "new" ] }, { "name": "Serializable", "locations": [ { "lineno": 39,