Wix.Settings

addComponent

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:

Copy

Parameters:

NameTypeDescription
options (required)ObjectOptions for this method
options.copyStyleBooleanTo 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.styleIdStringID 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.widgetObjectDetails about the widget and where to add it
options.widget.widgetId (required)StringID of the widget, as specified in the Dev Center
options.widget.allPagesBooleanTrue 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.wixPageIdStringID 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.pageObjectDetails about the page component. Make sure that you allow users to add your page component more than once.
options.page.titleStringThe 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)StringID of the page component, as specified in the Developers Center
options.page.isHiddenBooleantrue if this is a hidden page. Default is false.
onSuccess (required)FunctionReceives the widget's compId
onFailureFunctionReceives the error if the operation failed. WIDGET](#1470038924639-675076e3-d3bd), PAGE

WIDGET EXAMPLE

Copy

PAGE EXAMPLE

Copy

closeWindow

Closes the settings/modal endpoint.

SDK Version: SDK 1.83.0+
Editor Version: New Editor
Components: Settings Panel, Settings Modal

Syntax:

Copy

Parameters:

NameTypeDescription
optionsObjectOptions 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.customObject/ String/ Boolean/ NumberA custom parameter

Example:

Copy

getCurrentPageAnchors

Retrieves the anchors on the current page.

SDK Version: SDK 1.62.0+
Editor Version: New Editor

Syntax:

Copy

Parameters:

NameTypeDescription
callback (required)FunctionCallback 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:

NameTypeDescription
idStringThe anchor ID
titleStringThe anchor title.

Note: If there are no anchors on the current page, returns just one default anchor – the top of the page.

Example:

Copy

getCurrentPageId

Returns the page ID of the current page.

SDK Version: SDK 1.86.0+
Editor Version: New Editor
Components: Settings Panel, Settings Modal

Syntax:

Copy

Parameters:

NameTypeDescription
callback (required)FunctionCallback function to receive the pageId

Example:

Copy

getDashboardAppUrl

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:

Copy

Parameters:

|Name |Type |Description|
|---|---|---| 
|callback (required)|Function|A callback function to receive the URL of the app in the dashboard|

Example:

Copy

getSiteInfo

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:

Copy

Parameters:

NameTypeDescription
callback (required)FunctionCallback function to receive the site info 

Value passed to callback:

json Object containing the site info:

NameTypeDescription
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”).
pageTitleOnlyStringThe name of the page - without the site title (e.g., “Animal Shirt”).
referrer String The referrer header of the HTTP request 
siteDescriptionString The description of the site that is used for SEO 
siteKeywordsString 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:

Copy

getSiteMap

Returns all items in the site structure, including:

  • Items in the site’s menu – pages (including subpages), links, and menu headers.
  • Hidden pages – pages that are in the site, but not in the site menu. For example, a “Thank You” page that’s shown only after a site visitor makes a purchase.

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:

Copy

Parameters:

NameTypeDescription
callback (required)FunctionCallback 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.

NameTypeDescription
typeStringType 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.
pageIdStringThe 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.
titleStringThe item title
hiddenBooleanReturns true if this page is hidden
isHomePageBooleanReturns true if this page is the site's home page
urlStringURL of this item
subPagesArray [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:

Copy

Example:

Copy

getStateUrl

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:

Copy

Parameters:

NameTypeDescription
sectionId (required)StringID of the Page component, as specified in the Developers Center
state (required)StringState of the app’s internal page - for example, ‘product1
callback (required)FunctionCallback function to receive the full URL of the page, including the app state

Example:

Copy

getWindowPlacement

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:

Copy

Parameters:

NameTypeDescription
compId (required)StringComponent ID of the fixed-position widget
callback (required)FunctionA callback function that gets the component placement

Example:

Copy

Note:
Use this for fixed-position widgets only – otherwise, an error will be thrown.

isApplicationInstalled

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:

Copy

Parameters:

NameTypeDescription
appDefinitionId (required)StringApp ID, as specified in the Devevelopers Center
callback (required)FunctionCallback 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:

  • true if the app is installed
  • false if the app isn’t installed

Example:

Copy

isComponentInstalled

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:

Copy

Parameters:

NameTypeDescription
componentId (required)StringID of the component, as specified in the Developers Center
callback (required)FunctionFunction 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:

  • true if the component is installed
  • false if the component isn’t installed

Example:

Copy

isFullWidth

Indicates if the user extended the component to full width.

SDK Version: SDK 1.65.0+
Editor Version: New Editor

Syntax:

Copy

Parameters:

NameTypeDescription
callback (required)FunctionFunction 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:

Copy

openBillingPage

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:

Copy

Example:

Copy

openLinkPanel

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:

  1. Call this method when a user is adding a link in your app. Users will be able to link to an anchor on their site, an external link, and more.
  2. Save the return object. This method returns a link data object – save the object on your database, without changing it in any way.
  3. Use the return object to navigate to the link target. In the live site/preview, use the Wix.navigateTo method to navigate to the link target.
  4. Use the return object the next time you call openLinkPanel. This will open the panel with the current link settings displayed.

Note:
Want to learn more? To see how the link panel works inside the Wix Editor, check out this video.

Syntax:

Copy

Parameters:

NameTypeDescription
optionsObjectOptions for this method
options.linkObjectIf 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)FunctionFunction called when the user clicks Done in the link settings panel, and returns an object containing the selected link data callback signature: function(linkData) {}
onCancelFunctionFunction 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:

  • To navigate to the link target in the live site/preview (use the Wix.navigateTo method)
  • The next time you open the link panel with the user’s settings.

Here’s an example of a link object for a page:

Copy

Example:

Copy

openMediaDialog

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:

Copy

Warning:
Use the Wix.Utils.Media.get* methods each time you access the media item, to prevent broken links.

Parameters:

NameTypeDescription
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.SWFType 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)Booleantrue if the user selected more than one item. false if the user selected only one item.
onSuccess (required)FunctionCallback function to pass metadata about this media item
onCancelFunctionCallback 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:

Copy

openModal

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:

  • The modal is a runtime widget, so it’s not part of the site structure.
  • The modal is a singleton – every new modal closes the previous one.
  • Users can close the modal by clicking the lightbox or pressing the close button. You can close the modal by calling Wix.Settings.closeWindow from within the modal iframe.

Syntax:

Copy

Breaking change for the openModal method

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:

  1. Remove bareUI from Wix.Settings.openModal.
  2. Now that the modal style changed, we recommend adding a title and changing your design if needed.

Parameters:

NameTypeDescription
url (required)StringURL of the modal iframe
width (required)Number/ StringWidth of the modal. In pixels: Enter a number (for example, 400), In percent: Enter a string (for example, ‘70%’)
height (required)Number/ StringHeight of the modal. In pixels: Enter a number (for example, 400), In percent: Enter a string (for example, ‘70%’)
titleStringThe title of the modal
onCloseFunctionOnClose callback function

Example:

Copy

openReviewInfo

Opens your app’s Reviews tab as a modal within the Wix Editor.

SDK Version: SDK 1.65.0+
Editor Version: New Editor

Syntax:

Copy

Example:

Copy

openSiteMembersSettingsDialog

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:

Copy

Example:

Copy

refreshApp

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:

  • The change only affects one of your app’s components. In this case, use refreshAppByCompIds instead.
  • The user made a small change in your app – like customized text. In this case, use the triggerSettingsUpdatedEvent instead.

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:

Copy

Parameters:

NameTypeDescription
queryParamsObjectA map of custom query parameters that should be added to the iframe URL 

Example:

Copy

refreshAppByCompIds

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:

  • The change affects all of your app’s components. In this case, use refreshApp instead.
  • The user made a small change in your app. In this case, use the triggerSettingsUpdatedEvent instead.

Syntax:

Copy

Parameters:

NameTypeDescription
compIds (required)ArrayAn array of the app component ids that should be refreshed 
queryParams ObjectA map of custom query parameters that should be added to the iframe URL

Example`

Copy

resizeComponent

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:

Copy

Parameters:

NameTypeDescription
options (required)ObjectSpecify width and/or height (you must specify at least one)
options.widthNumberSize in pixels, for example: 450. If you don’t provide a value, the width remains the same.
options.heightNumberSize in pixels, for example: 450. If you don’t provide a value, the height remains the same.
onSuccess (required)FunctionCallback function to receive the new component size
onFailureFunctionCallback 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:

Copy

revalidateSession

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:

Copy

Parameters:

NameTypeDescription
onSuccess (required)FunctionReceives a newly-signed and encoded app instance
onFailure FunctionCallback function in case the session isn't secure

Example:

Copy

setFullWidth

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:

Copy

Parameters:

NameTypeDescription
fullWidth (required)BooleanSet 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.
optionsBooleanOptions for this method
options.marginsObjectWhen 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)FunctionCallback function that’s fired when the component is set to full-width successfully
onFailureFunctionCallback function that’s fired when the component can’t be set to full-width (for example, a fixed-position widget)
Copy

setWindowPlacement

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:

  1. Wix.WindowPlacement.TOP_LEFT
  2. Wix.WindowPlacement.TOP_CENTER
  3. Wix.WindowPlacement.TOP_RIGHT
  4. Wix.WindowPlacement.CENTER_RIGHT
  5. Wix.WindowPlacement.CENTER_LEFT
  6. Wix.WindowPlacement.BOTTOM_LEFT
  7. Wix.WindowPlacement.BOTTOM_CENTER
  8. Wix.WindowPlacement.BOTTOM_RIGHT

Syntax:

Copy

Parameters:

NameTypeDescription
compId (required)StringComponent id to change window placement to
placement (required)Wix.WindowPlacement New placement for the widget window 
verticalMarginNumberVertical offset from the window placement, between -2 to 2 
horizontalMarginNumberHorizontal offset from the window placement, between -2 to 2

Example:

Copy

triggerSettingsUpdatedEvent

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:

Copy

Parameters:

NameTypeDescription
message (required)Object A custom json which will be passed to the component as the event data
compIdStringA 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:

Copy

Deprecated

getSitePages

SDK Version: Deprecated

Note:
Now that this method is deprecated, use the getSiteMap method instead.

A page can be:

  • An item in the site’s menu – a page, subpage, external link, link to a page anchor, or menu header.
  • A hidden page/subpage – these pages are part of the site, but they’re not part of the site menu. For example, a “Thank You” page that’s shown only after a site visitor makes a purchase.

Parameters:

NameTypeDescription
optionsObjectOptions for this method
callback (required)FunctionA 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:

NameTypeDescription
idStringThe 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.
titleStringThe title of the page/subpage
hideBooleanReturns true if this page/subpage is hidden
isHomePageBooleanReturns true if this page/subpage is the site's home page
subPagesArray [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:

Copy

getStyleParams

SDK Version: Deprecated

Retrieves the style parameters from the hosting Wix platform. The parameters includes colors numbers, booleans.

Parameters:

NameTypeDescription
callback (required)FunctionA callback function to receive the style parameters 

Example:

Copy
Did this help?