Allows users to install add-ons in your app, directly from the App Settings panel. Users are then directed to the page where the component was added.
SDK Version: SDK 1.92.0+
Editor Version: New Editor
Components: Settings Panel, Settings Modal
Use this method for add-ons that aren’t added automatically when users install your app, or to allow users to add a page component again. Note that for page components, you need to first allow users to add your page component more than once.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
options (required) | Object | Options for this method |
options.copyStyle | Boolean | To copy the style from another component in your app, set true. You can copy the style as follows: To copy the style of the calling component, leave styleId empty. To copy the style of another component in your app, enter its styleId below. |
options.styleId | String | ID of the style to copy. Make sure copyStyle is set to true. If the styleId is invalid, no style will be copied. |
options.componentType (required) | "WIDGET" or "PAGE" | Type of component to add |
options.widget | Object | Details about the widget and where to add it |
options.widget.widgetId (required) | String | ID of the widget, as specified in the Dev Center |
options.widget.allPages | Boolean | True if the user is adding the widget to all pages. Default is False. If the value is True and you also specify the wixPageId (below), then allPages takes precedence and the component is added to all pages. |
options.widget.wixPageId | String | ID of the page where the user is adding the widget. If a value is given and the value of allPages (above) is True, then allPages takes precedence and the component is added to all pages. The user is directed to this page once the widget is added. |
options.page | Object | Details about the page component. Make sure that you allow users to add your page component more than once. |
options.page.title | String | The title of the page. If undefined, uses the component name defined in the Developers Center. Title is limited to 40 characters, and cannot include ‘<’ or ’>’ characters. |
options.page.pageId (required) | String | ID of the page component, as specified in the Developers Center |
options.page.isHidden | Boolean | true if this is a hidden page. Default is false. |
onSuccess (required) | Function | Receives the widget's compId |
onFailure | Function | Receives the error if the operation failed. WIDGET](#1470038924639-675076e3-d3bd), PAGE |
WIDGET EXAMPLE
PAGE EXAMPLE
Closes the settings/modal endpoint.
SDK Version: SDK 1.83.0+
Editor Version: New Editor
Components: Settings Panel, Settings Modal
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
options | Object | Options for this method. Note: The options object is only passed to the opener's onClose callback function if you're closing the modal (target: 'MODAL') - refer to Wix.Settings.openModal. |
options.target | ‘SETTINGS’, ‘MODAL’, ‘ALL’ | Specifies the endpoint to close: ‘SETTINGS’ - closes the settings endpoint. ‘MODAL’ (default) - closes the settings modal and passes the options object to the opener's onClose callback function (refer to Wix.Settings.openModal). ‘ALL’ - closes both the settings and the settings modal. |
options.custom | Object/ String/ Boolean/ Number | A custom parameter |
Example:
Retrieves the anchors on the current page.
SDK Version: SDK 1.62.0+
Editor Version: New Editor
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive an array of anchors (unordered) |
Value passed to callback:
An array of unordered objects.
Each object represents an anchor on the current page, and contains the following properties:
Name | Type | Description |
---|---|---|
id | String | The anchor ID |
title | String | The anchor title. |
Note: If there are no anchors on the current page, returns just one default anchor – the top of the page.
Example:
Returns the page ID of the current page.
SDK Version: SDK 1.86.0+
Editor Version: New Editor
Components: Settings Panel, Settings Modal
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive the pageId |
Example:
Retrieves the URL of your app’s Dashboard component within the user’s site (the URL is fully qualified). Use this URL to direct the user from the App Settings to your app’s Dashboard component.
SDK Version: SDK 1.32.0+
Editor Version: New Editor, Old Editor
Components: Multicomponent Apps
To open your Dashboard as a modal in the Wix Editor, use Wix.Settings.openModal.
Important:
To open your Dashboard component, add an href attribute with the Dashboard URL. Don’t use window.open – if you use window.open in a callback of an asynchronistic call, the browser blocks the window from opening.
Syntax:
Parameters:
|Name |Type |Description|
|---|---|---|
|callback (required)|Function|A callback function to receive the URL of the app in the dashboard|
Example:
Retrieves information about the host site in which the app is shown.
SDK Version: SDK 1.12.0+
Editor Version: New Editor, Old Editor
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive the site info |
Value passed to callback:
json Object containing the site info:
Name | Type | Description |
---|---|---|
baseUrl | String | Base url of the current site, for example: http://user.wix.com/site-name, http://www.domain.com |
pageTitle | String | The page title that is used for SEO. This title includes both the site and page title (e.g., “My Store - Animal Shirt”). |
pageTitleOnly | String | The name of the page - without the site title (e.g., “Animal Shirt”). |
referrer | String | The referrer header of the HTTP request |
siteDescription | String | The description of the site that is used for SEO |
siteKeywords | String | The keywords which are related to the site and are used for SEO |
siteTitle | String | The title of the site that is used for SEO |
url | String | The URL (taken from the location.href property). The URL includes the internal site state, for example: http://user.wixsite.com/site-name/pageTitle http://www.domain.com/pageTitle . Returns the site URL only when using getSiteInfo in the live site and preview mode. When using it in Editor mode, returns the Editor URL. |
Example:
Returns all items in the site structure, including:
SDK Version: SDK 1.81.0+
Editor Version: New Editor
Components: Settings Panel
Note:
Use this method instead of getSitePages, which is now deprecated.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Callback function to receive the site structure |
Value passed to callback:
An array of objects, where each object represents an item in the site structure.
Warning:
To use this object later (for example, if you want to navigate to a link on the user’s site), save this object in your database as is – don’t change it in any way.
Each object contains data about the item. The data sent depends on the item – check out our examples below.
Name | Type | Description |
---|---|---|
type | String | Type of link the item represents - for example ‘PageLink’ or ‘AnchorLink’. The data returned depends on the item - for example, an ‘AnchorLink’ object will include the anchorName and anchorDataId properties. Check out our examples below. |
pageId | String | The page ID. Note: If the user added a page anchor to the site’s menu, then this method returns an object for the anchor - so there might be multiple objects with the same page ID. |
title | String | The item title |
hidden | Boolean | Returns true if this page is hidden |
isHomePage | Boolean | Returns true if this page is the site's home page |
url | String | URL of this item |
subPages | Array [objects] | (Page objects only) If the page has subpages, returns an ordered set of subpages. Each subpage object contains more information about the subpage (id, title, hide, isHomePage, url). |
Here’s an example of an array passed to the callback:
Example:
This method returns the full URL of one of your internal pages on the live site, including the app’s state.
For example: mysite.com/my-store-app/product1.
As you can see, the URL includes the app state.
SDK Version: SDK 1.69.0+
Editor Version: New Editor
Use this method if you have a page component and you need the URL of an internal page.
Note:
This method won’t work if the user didn’t save the site since installing your app (you’ll get an error in the response).
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
sectionId (required) | String | ID of the Page component, as specified in the Developers Center |
state (required) | String | State of the app’s internal page - for example, ‘product1’ |
callback (required) | Function | Callback function to receive the full URL of the page, including the app state |
Example:
Gets the position of a fixed position widget in an editing session. Read more about position placement in the Editor.
SDK Version: SDK 1.19.0+
Editor Version: New Editor, Old Editor
Components: Settings Panel (for Fixed-Position Widgets only), Settings Modal (for Fixed-Position Widgets only)
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
compId (required) | String | Component ID of the fixed-position widget |
callback (required) | Function | A callback function that gets the component placement |
Example:
Note:
Use this for fixed-position widgets only – otherwise, an error will be thrown.
Allows you to check if another one of your apps is installed.
SDK Version: SDK 1.83.0+
Editor Version: New Editor
Components: Settings Panel, Settings Modal
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
appDefinitionId (required) | String | App ID, as specified in the Devevelopers Center |
callback (required) | Function | Callback function that receives a boolean indicating if the app is installed in the site: function(isInstalled) {} |
Value passed to callback:
A boolean indicating if the app is installed or not:
Example:
This method is for multicomponent apps. Use it to check if one of your app’s components is installed in the user’s site.
SDK Version: SDK 1.74.0+
Editor Version: New Editor
Components: Settings Panel
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
componentId (required) | String | ID of the component, as specified in the Developers Center |
callback (required) | Function | Function that receives a boolean indicating if the component is installed in the site |
Value passed to callback:
A boolean indicating if the component is installed or not:
Example:
Indicates if the user extended the component to full width.
SDK Version: SDK 1.65.0+
Editor Version: New Editor
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | Function that receives a boolean indicating if the app is set to full-width |
Value passed to callback:
A boolean indicating if the component is set to full-width:
true if the component is set to full-width
false if the component isn’t set to full-width
Example:
Opens the Wix billing page from the settings panel in a modal window.
SDK Version: SDK 1.16.0+
Editor Version: New Editor, Old Editor
Syntax:
Example:
This method opens the Editor’s link settings panel, where users can add a link to content in your app (an image, text, etc.).
SDK Version: SDK 1.81.0+
Editor Version: New Editor
Components: Settings Panel
How to use this method:
Note:
Want to learn more? To see how the link panel works inside the Wix Editor, check out this video.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
options | Object | Options for this method |
options.link | Object | If the user is editing an existing link, add the link data object we returned the last time you called this method. This opens the panel with the current link settings displayed. |
onSuccess (required) | Function | Function called when the user clicks Done in the link settings panel, and returns an object containing the selected link data callback signature: function(linkData) {} |
onCancel | Function | Function called when the user clicks Cancel in the link settings panel. |
Value passed to callback:
A link object with information about this link.
Warning:
Save this object in your database as is – don’t change it in any way.
Here’s when to use the link object object:
Here’s an example of a link object for a page:
Example:
This method opens the Wix Media Manager, which allows users to choose an existing item from the Wix media galleries or upload a new file.
SDK Version: SDK 1.17.0+
Editor Version: New Editor, Old Editor
Once the user selects a media item, a callback function retrieves a metadata descriptor with details about it.
To access the media item, use one of the Wix.Utils.Media.get* methods to construct the item’s full URL. You’ll need the item’s relativeUri, which is returned in the callback function.
Syntax:
Warning:
Use the Wix.Utils.Media.get* methods each time you access the media item, to prevent broken links.
Parameters:
Name | Type | Description |
---|---|---|
mediaType (required) | Wix.Settings.MediaType.IMAGE, Wix.Settings.MediaType.BACKGROUND, Wix.Settings.MediaType.AUDIO, Wix.Settings.MediaType.SECURE_MUSIC, Wix.Settings.MediaType.DOCUMENT, Wix.Settings.MediaType.SWF | Type of media item the user is selecting: * IMAGE (photo/image) * BACKGROUND (background image) * AUDIO (mp3 file up to 50MB) * SECURE_MUSIC (high quality audio up to 360MB) * DOCUMENT * SWF |
multiSelect (required) | Boolean | true if the user selected more than one item. false if the user selected only one item. |
onSuccess (required) | Function | Callback function to pass metadata about this media item |
onCancel | Function | Callback function called when the user cancels |
Value passed to onSuccess callback:
An object or an array of objects (for multiple media items).
Each object contains metadata about a specific media item.
Example:
Opens a lightbox-style modal window over the Wix editor. You can only open this modal from the settings endpoint.
SDK Version: SDK 1.41.0+
Editor Version: New Editor, Old Editor
Here’s how the modal works:
Syntax:
We’ve deprecated the bareUI parameter, which means that the modal now has a header, border, shadow, etc. If your app is using the bareUI parameter:
Parameters:
Name | Type | Description |
---|---|---|
url (required) | String | URL of the modal iframe |
width (required) | Number/ String | Width of the modal. In pixels: Enter a number (for example, 400), In percent: Enter a string (for example, ‘70%’) |
height (required) | Number/ String | Height of the modal. In pixels: Enter a number (for example, 400), In percent: Enter a string (for example, ‘70%’) |
title | String | The title of the modal |
onClose | Function | OnClose callback function |
Example:
Opens your app’s Reviews tab as a modal within the Wix Editor.
SDK Version: SDK 1.65.0+
Editor Version: New Editor
Syntax:
Example:
Opens the settings for the Wix’s site members component, directly from your app. This method first closes all other open dialogs or panels in the editor.
SDK Version: SDK 1.74.0+
Editor Version: New Editor
Components: Settings Panel
This method is relevant for apps that require site visitors to log in as members of the site.
Syntax:
Example:
Reloads the app. Use this method when the user makes a change that affects the entire app – and it requires server-side rendering. For example, when the user connects an account.
SDK Version: SDK 1.12.0+
Editor Version: New Editor, Old Editor
Don’t use this method when:
This method accepts a single optional argument, an object. Each of the object’s properties will translate into a query parameter in the iframe URL.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
queryParams | Object | A map of custom query parameters that should be added to the iframe URL |
Example:
Reloads the component. Use this method when the user makes a change that requires server-side rendering, and this change only affects specific components.
SDK Version: SDK 1.12.0+
Editor Version: New Editor, Old Editor
Don’t use this method when:
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
compIds (required) | Array | An array of the app component ids that should be refreshed |
queryParams | Object | A map of custom query parameters that should be added to the iframe URL |
Example`
Sets the width and/or height of a component, displaying it over other components in the page.
SDK Version: SDK 1.45.0+
Editor Version: New Editor
Components: Settings Panel (for Widgets/Pages only)
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
options (required) | Object | Specify width and/or height (you must specify at least one) |
options.width | Number | Size in pixels, for example: 450. If you don’t provide a value, the width remains the same. |
options.height | Number | Size in pixels, for example: 450. If you don’t provide a value, the height remains the same. |
onSuccess (required) | Function | Callback function to receive the new component size |
onFailure | Function | Callback function to receive the error details. An error occurs when no value is provided for width and height (you must give a value for at least one). |
Example:
Verifies that the session is secure. If the session is secure, this method retrieves a newly-signed app instance.
SDK Version: SDK 1.47.0+
Editor Version: New Editor
Use this method before displaying sensitive information or performing an action that requires a secure session.
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
onSuccess (required) | Function | Receives a newly-signed and encoded app instance |
onFailure | Function | Callback function in case the session isn't secure |
Example:
Sets the widget/page component to the full-width of the browser.
SDK Version: SDK 1.81.0+
Editor Version: New Editor
Components: Settings Panel (for Widgets/Pages only)
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
fullWidth (required) | Boolean | Set the width:. Enter true to set the component to full width, enter false to reset the component to the width you defined in the Developers Center. |
options | Boolean | Options for this method |
options.margins | Object | When the component is set to full width, you can define margins on the left and right sides of the component. For example: {left: "200px", right: "200px"}. Enter the value in px (default) - number of pixels to leave as a margin, or % - percentage of the viewport to leave as a margin. If you don’t specify a unit, we use px. You can specify different units for the left and right sides: {left: "5%", right: "200px"} |
onSuccess (required) | Function | Callback function that’s fired when the component is set to full-width successfully |
onFailure | Function | Callback function that’s fired when the component can’t be set to full-width (for example, a fixed-position widget) |
Sets the placement for fixed position widgets in an editing session.
SDK Version: SDK 1.19.0+
Editor Version: New Editor, Old Editor
Component: Settings Panel (for Fixed-Position Widgets only)
A position placement is a predefined set of locations where a popup will be placed. The position placement is defined under Wix.WindowPlacement and can have the following values:
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
compId (required) | String | Component id to change window placement to |
placement (required) | Wix.WindowPlacement | New placement for the widget window |
verticalMargin | Number | Vertical offset from the window placement, between -2 to 2 |
horizontalMargin | Number | Horizontal offset from the window placement, between -2 to 2 |
Example:
Triggers a Wix.Events.SETTINGS_UPDATED event in a component iframe. It should be used in an editing session when a developer wants to reflect editing changes but avoid refresh/reload of the component’s iframe.
SDK Version: SDK 1.17.0+
Editor Version: New Editor, Old Editor
Syntax:
Parameters:
Name | Type | Description |
---|---|---|
message (required) | Object | A custom json which will be passed to the component as the event data |
compId | String | A component ID the developer wants to trigger the event for. The most obvious compId is Utils.getOrigCompId(). If no compId is given all components that registered to Wix.Events.SETTINGS_UPDATED will receive the event. |
Example:
SDK Version: Deprecated
Note:
Now that this method is deprecated, use the getSiteMap method instead.
A page can be:
Parameters:
Name | Type | Description |
---|---|---|
options | Object | Options for this method |
callback (required) | Function | A callback function to receive the site structure |
Value passed to callback:
An array of objects, where each object represents a page in the site.
The objects are ordered according to the site’s structure shown in the Pages menu of the Wix Editor. If a page has subpages, they are returned as an array of objects nested inside the page object.
Each page/subpage object contains the following properties:
Name | Type | Description |
---|---|---|
id | String | The page/subpage ID. If the user added a page anchor to the site’s menu, then this method returns an object for the anchor - so there might be multiple objects with the same page ID. |
title | String | The title of the page/subpage |
hide | Boolean | Returns true if this page/subpage is hidden |
isHomePage | Boolean | Returns true if this page/subpage is the site's home page |
subPages | Array [objects] | (Page objects only) If the page has subPages, returns an ordered set of subpages. Each subpage object contains more information about the subpage (id, title, hide, isHomePage, url). |
Example:
SDK Version: Deprecated
Retrieves the style parameters from the hosting Wix platform. The parameters includes colors numbers, booleans.
Parameters:
Name | Type | Description |
---|---|---|
callback (required) | Function | A callback function to receive the style parameters |
Example: