Widgets

Webapp Reference

Javascript reference

WebApp class 🔗


WebApp

Constructor
WebApp(elementId:String, projectKey:String)

Construct a new Webapp.


Methods
render(isMobile:Boolean)

Render the webapp

setInitialStateToNearbyStores()

Set the webapp to ask for HTML5 location and display nearby stores on load.

setInitialStateToHtmlLocation()

Set the webapp to ask for HTML5 location, center on the position on load.

setInitialStateToCountryLocation()

Set the webapp to center the map on the user’s country.

setInitialStateToDirections(store_id:String, zoom?:Number)

Set the webapp to init with directions from an HTML5 location to a store

setInitialStateToSelectedStore(store_id:String, zoom:Number)

Set the webapp to init with a selected store

listenOn(event:HANDLED_EVENT, listener:Function)

Use this method to register a callback on a webapp event. The listener will be called everytime the event is fired.

listenOnce(event:HANDLED_EVENT, listener:Function)

Use this method to register a callback on a webapp event. The listener will be called only the first time the event is fired.

setI18nConf(i18nConf:I18nConf)

Set the language of the webapp.

setInitialSearch(initialSearch:InitialSearchConf)

Set an initial search to the webapp. It will be automatically geocoded to display stores.

setInitialDataSourceConf(dataSourceConf:DataSourceConf)

Set an initial datasource configuration for the webapp. Use it to display a subset of your data.

setInitialViewport(viewportConf:ViewportConf)

Set an initial Viewport to the webapp

setFullStoreRenderer(fullStoreRenderer:Function)

Sets the store details renderer. This is a function that takes Store data and renders the store details to an Element.

setSummaryStoreRenderer(summaryStoreRenderer:Function)

Sets the store summary renderer. This is a function that takes Store data and renders the store summary to an Element.

setInitialGeocoderOptions(geocoderOptions:GeocoderOptions)

Set the google maps geocoder options.

setInitialDirectionMode(directionMode:Number)

Set the google maps default directions mode.


DataSourceConf object Specification  🔗


{

 base_filter: '(type:"type1" OR type:"type2") AND tag:"tag1"' }
Properties
base_filter Type: String

a filter to display only a part of your stores.


GeocoderOptions object Specification  🔗


Properties
region Type: String

the region code used for biasing geocoding requests.


HANDLED_EVENT object Specification  🔗


Properties
FAVORITED Type: Function

I18nConf object Specification  🔗


Properties
lang Type: String

The language, values available are [fr, en, es, de]

period Type: String

Hour system to display openning hours [‘fr’ (for 24h), ‘en-US’ (for 12h)]

unitSystem Type: Number

The unit system to display distances [0 (Metric), 1 (Imperial)]


InitialSearchConf object Specification  🔗


Properties
text Type: String

The text to geocode


Location object Specification  🔗


Properties
lat Type: Number

the latitude.

lng Type: Number

the longitude.


ViewportConf object Specification  🔗


Properties
initialZoom Type: Number

The initial zoom, should be a value of from this range [0-22]

initialCenter Type: Location

The geographic position of the center of the map