Controller events
Controllers may emit a number of events that can be used to detect important changes within a controller or provide some additional data to controllers.
beforeLoadBlueprint
Triggered just before the controller loads a new blueprint.
afterInitializeState
Triggered after the controller had created the initial state vector. .state property can now be used to examine the state.
afterInitializeBlueprint
Triggered after the controller has performed all actions necessary to initialize the product state using a freshly loaded blueprint. .blueprint property can now be used to examine the product blueprint.
afterAssembliesBuilt
Triggered after the root controller has loaded and initialized all other controllers within the assembly.
stateChanged
Triggered whenever the product selected components, personalization, or customization attributes had changed, due to a user selection or a programmatic change.
initializeAvailability
Called after the product blueprint has been loaded, but not completely initialized yet to give the host site a chance to retrieve the inventory levels for blueprint components. These inventory levels may later be used to figure out the component availability and update the state vector.
resolvePromise* After the availability state has been retrieved, the host site must invoke the resolve callback passed as a parameter.
isAvailable
Allows the host site to determine whether the given component is available for customization and selection, e.g. if the component is in stock.
componentComponent to check availability
Return value is expected to be true or false
isAllowed
Allows the host site to determine whether the given component is allowed for customization and selection, e.g. not blocked by any conditions.
componentComponent to check availability
Return value is expected to be true or false
getPrice
Allows the host site to override the default price calculation, and provide a custom price for the component.
componentComponent to calculate a price for
repaint
Triggered whenever the controller state had changed enough that the related product image needs to be refreshed.