Link Search Menu Expand Document

Controller API

Use initializeSpaazaElements() to set up the controller and mount components. Returns Promise<SpaazaController>.

InitOptions

Property Type Required Description
target string Yes CSS selector (e.g., '#spaaza-elements')
config SpaazaConfig Yes API and authentication configuration
pageName string No Page name to load (default: "home")
campaignId number No Campaign ID. Activates the detail view.
voucherId number No Voucher ID. Activates the detail view.
businessId number No Filter page content by store. From user.home_store.home_store_id.
componentBaseUrl string No Base URL for web component bundles
customZones CustomZonesOptions No Custom zones for voucher and membercard display. See Custom Zones.
handlerOverrides object No Disable automatic handling for specific operations. See Handler Overrides.

SpaazaConfig

Property Type Required Description
origin string Yes API origin (https://api.spaaza.com production, https://apistage0.spaaza.com staging)
auth.sessionKey string Yes Session key from login
auth.userID string Yes User ID from login
auth.myPriceAppHost string Yes Your Spaaza app hostname (e.g., yourapp.spaaza.com)

Controller Methods

The controller returned by initializeSpaazaElements() provides:

Method Description
parseImageLink(imageLink) Parse image_link string. See parseImageLink() for the full return-value table.
refresh() Refresh current view (re-fetches data)
const controller = await initializeSpaazaElements({ ... });

// Refresh current view
await controller.refresh();