Wix.Dashboard

closeWindow

Closes the modal endpoint.

SDK Version: SDK 1.27.0+
Display: Dashboard, Modal

Syntax:

Copy
1
closeWindow(\[message\])

Parameters:

NameTypeDescription
messageObjectA custom message to pass to the calling endpoint’s onClose callback function

Example:

Copy
1
var message = {"reason": "button-clicked"};
2
Wix.Dashboard.closeWindow(message);

getEditorUrl

Retrieves a URL for the app in the Editor. If your app is installed on more than one page, the first page that contains your app will be opened. If the user didn’t install the Site component yet, this will return a URL to the Wix Editor that will open the App Market with your app in pending.

SDK Version: SDK 1.33.0+
Display: Dashboard

Syntax:

Copy
1
getEditorUrl(callback)

Note:
This is only relevant for apps that have both a site component and a dashboard component.

Parameters:

NameTypeDescription
callback (required)FunctionCallback function to receive the URL that directs users to the app in the Wix Editor

Value passed to callback: The URL that directs users to the app in the Wix Editor. Note that:

  • If your app is installed on more than one page, the URL directs to the first page that contains your app.
  • If the user didn’t install the Site component yet, the URL directs to the App Market in the Wix Editor, with your app in pending.

Example:

Copy
1
Wix.Dashboard.getEditorUrl(function(url) {
2
//Editor url as a callback parameter
3
});

getProducts

Returns a json with pricing information for all of your app’s packages – premium plans and in-app purchase packages.

SDK Version: SDK 1.72.0+
Display: Dashboard

Syntax:

Copy
1
getProducts(onSuccess, \[onError\])

Parameters:

NameTypeDescription
onSuccess (required)FunctionA callback function to receive the pricing information
onErrorFunctionA callback function for when an error occurs

Example:

Copy
1
Wix.Dashboard.getProducts(OnSuccess, OnError);
2
3
//Here is an example of the response
4
"packages": [
5
{
6
"id": "Premium1",
7
"name": "Comments Premium Package",
8
"price": "4.95",
9
"is_active": true,
10
"freeMonth": true,
11
"currencyCode": "USD",
12
"currencySymbol": "US$"
13
"monthly": {
14
"price": "4.95",
15
“Link”: "https://premium.wix.com/wix/api/tpaStartPurchase?appInstanceId=aaa-bbb&appDefinitionId=a1a2a-b3b4b&paymentCycle=MONTHLY&vendorProductId=package1"
16
},
17
"yearly": {
18
"price": "3.97",
19
“Link”: "https://premium.wix.com/wix/api/tpaStartPurchase?appInstanceId=aaa-bbb&appDefinitionId=a1a2a-b3b4b&paymentCycle=YEARLY&vendorProductId=package2"
20
},
21
"oneTime": {
22
"price": "5.99",
23
“Link”: "https://premium.wix.com/wix/api/tpaStartPurchase?appInstanceId=aaa-bbb&appDefinitionId=a1a2a-b3b4b&paymentCycle=ONE_TIME&vendorProductId=package3"
24
},
25
"bestSellingFeature": "",
26
"discountPercent": 20
27
}
28
]

getSiteViewUrl

Retrieves the live site’s base URL.

SDK Version: SDK 1.74.0+
Display: Dashboard

Syntax:

Copy
1
getSiteViewUrl(onSuccess)

Parameters:

NameTypeDescription
onSuccess (required)FunctionA callback function to receive the base url object

Value passed to callback:

An object with the base URL of the live site. For example: {base : “http://www.wix.com”}

Example:

Copy
1
var onSuccess = function(data) {
2
// do something with base url
3
};
4
5
Wix.Dashboard.getSiteViewUrl(onSuccess);

openBillingPage

Allows the app to open the Wix billing page.

SDK Version: SDK 1.27.0+
Display: Dashboard

Syntax:

Copy
1
openBillingPage( )

Example:

Copy
1
Wix.Dashboard.openBillingPage();

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.27.0+
Display: Dashboard

Once the user selects a media item, a callback function returns 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.

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

Syntax:

Copy
1
openMediaDialog(mediaType, multiSelect, onSuccess, \[onCancel\])

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
1
Wix.Dashboard.openMediaDialog(Wix.Settings.MediaType.IMAGE, false,
2
function(data) {
3
let imageurl = Wix.Utils.Media.getImageUrl(data.relativeUri);
4
}
5
);

openModal

Opens a lightbox-style modal window over your app in the Wix Dashboard. You can only open this modal from the Wix Dashboard.

SDK Version: SDK 1.27.0+
Display: Dashboard

Here’s how the modal works:

  • 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.closeWindow from within the modal iframe.

Syntax:

Copy
1
openModal(url, width, height, \[onClose\], \[theme\])

Parameters:

NameTypeDescription
url (required)StringURL of the modal iframe
width (required)NumberWidth of the modal, in pixels (for example, 400)
height (required)NumberHeight of the modal, in pixels (for example, 400)
onCloseFunctionOnClose callback function
themeWix.ThemeThe style of the modal: Wix.Theme.DEFAULT - has the regular modal look & feel - border, shadow, close button. Wix.Theme.BARE - a simple modal with no border, close button, shadow, etc.

Example:

Copy
1
var onClose = function(message) { console.log("modal closed", message); }
2
3
Wix.Dashboard.openModal("https://static.parastorage.com/services/js-sdk/1.90.0/HTML/modal.HTML", 400, 400, onClose);

pushState

Enables AJAX style Page apps to inform the Wix platform about a change in the app internal state. The new state will be reflected in the site/page URL. Once you call the pushState method, the browser’s top window URL will change the ‘app-state’ path part to the new state you provide with the pushState method (similar to the browser history API). Read more about deep linking for a full explanation.

SDK Version: SDK 1.35.0+ Display: Dashboard

Syntax:

Copy
1
pushState(state)

Parameters:

NameTypeDescription
state (required)StringThe new app's state to push into the dashboard history stack

Example:

Copy
1
Wix.Dashboard.pushState("app-state");

revalidateSession

Verifies that the session is secure. If the session is secure, this method returns a newly-signed app instance.

SDK Version: SDK 1.52.0+
Display: Dashboard

Use this method before displaying sensitive information or performing an action that requires a secure session.

Syntax:

Copy
1
revalidateSession(onSuccess, \[onFailure\])

Parameters:

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

Example:

Copy
1
Wix.Dashboard.revalidateSession(
2
function(instanceData){
3
//handle success use-case
4
},
5
function(error){
6
//Handle error use-case
7
}
8
);

Deprecated

openModal

Opens a lightbox-style modal window over your app in the Wix Dashboard. You can only open this modal from the Wix Dashboard.

SDK Version: Deprecated
Display: Dashboard

Here’s how the modal works:

  • 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.closeWindow from within the modal iframe.

Syntax:

Copy
1
openModal(url, width, height, \[onClose\], \[theme\])

Parameters:

NameTypeDescription
url (required)StringURL of the modal iframe
width (required)NumberWidth of the modal, in pixels (for example, 400)
height (required)NumberHeight of the modal, in pixels (for example, 400)
onCloseFunctionOnClose callback function
themeWix.ThemeThe style of the modal: Wix.Theme.DEFAULT - has the regular modal look & feel - border, shadow, close button. Wix.Theme.BARE - a simple modal with no border, close button, shadow, etc.

Example:

Copy
1
var onClose = function(message) { console.log("modal closed", message); }
2
3
Wix.Dashboard.openModal("https://static.parastorage.com/services/js-sdk/1.90.0/HTML/modal.HTML", 400, 400, onClose);

setHeight (height)

SDK Version: Deprecated

Requests the hosting Wix platform to change the iframe’s height inside the side dashboard

Parameters:

NameTypeDescription
height (required)NumberThe window's new height

Example:

Copy
1
Wix.Dashboard.setHeight(height);
Was this helpful?
Yes
No