configuration

This module controls the configuration api.

Methods

(static) addProduct(attrs)

Add a product

Parameters:
Name Type Description
attrs Product

(static) applyPreset(presetIdOrName, opts)

Apply the given preset

Parameters:
Name Type Description
presetIdOrName String

id or name of the preset.

opts Object
Properties
Name Type Description
id String

Optional id of the configurator node

(static) deleteProduct(handle)

Delete a product

Parameters:
Name Type Description
handle String

(static) getAttribute(idOrName, opts)

Returns the given attribute

Parameters:
Name Type Description
idOrName String

id or name of the attribute

opts Object
Properties
Name Type Description
id String

Optional id of the configurator node

(static) getAttributes(opts)

Returns the list of attributes.

Parameters:
Name Type Description
opts Object
Properties
Name Type Description
id String

Optional id of the configurator node

(static) getAttributesByType(type, opts)

Returns the list of attributes of given type

Parameters:
Name Type Description
type String

type of the attributes to filter

opts Object
Properties
Name Type Description
id String

Optional id of the configurator node

(static) getBOM()

Returns the bill of materials for a configured scene(s).

(static) getConfiguration(optsnullable)

Returns the active configuration.

Parameters:
Name Type Attributes Description
opts Object <nullable>
Properties
Name Type Attributes Description
id String <nullable>

Optional id of the configurator node

(static) getEvent(idOrName, opts)

Returns the given event

Parameters:
Name Type Description
idOrName String

id or name of the event

opts Object
Properties
Name Type Description
id String

Optional id of the configurator node

(static) getForm(idOrName, opts)

Return the form with given idOrName. If idOrName === true, then return a form with all attributes.

Parameters:
Name Type Description
idOrName String

id or name of the form

opts Object
Properties
Name Type Description
id String

Optional id of the configurator node

(static) getForms(opts)

Returns the list of forms

Parameters:
Name Type Description
opts Object
Properties
Name Type Description
id String

Optional id of the configurator node

all String

Return all the forms, top level and children

(static) getPresets(opts)

Returns the list of presets

Parameters:
Name Type Description
opts Object
Properties
Name Type Description
id String

Optional id of the configurator node

(static) getProduct(handle)

Returns the product

Parameters:
Name Type Description
handle String

(static) getProducts()

Returns the products as an array of objects

(static) getProductTour()

Returns the active product tour.

(static) initConfiguration(attrs)

Init the configuration of a form. This is the sync version which sets the configuration immediately;

Parameters:
Name Type Description
attrs Object
Properties
Name Type Description
id String

Scene id

form String

The configurator form to use

(static) initConfigurator(options)

Initialize the configurator for a scene. This is the sync version which immediately sets the configuration.

Parameters:
Name Type Description
options Object
Properties
Name Type Description
id String

The node id of the configurator

form String

The configurator form to use

configuration Object

Initial configuration

el String
preset String

(static) onChange(fn)

Register a listener that gets called when a configuration is changed. This listener will be called after the configuration actions have been run, but before the next render, so other changes can be made during the same frame. Arguments to the handler function are (attribute, value).

Parameters:
Name Type Description
fn function

(static) setConfiguration(configuration, opts)

Set the configuration.

Parameters:
Name Type Description
configuration Object

attribute 'name' as key, with attribute value as values.

opts Object
Properties
Name Type Description
id String

Optional id of the configurator node

Example
configuration.setConfiguration({ Size: 'Medium', ProductColor: '#ff0000' });

(static) setProduct(attrs)

Update a product

Parameters:
Name Type Description
attrs Product

(inner) initConfigurationAsync(attrs)

Init the configuration of a form. This is the async version which waits for the config script before setting the configuration.

Parameters:
Name Type Description
attrs Object
Properties
Name Type Description
id String

Scene id

form String

The configurator form to use

(inner) initConfiguratorAsync(options)

Initialize the configurator for a scene. This is the async version which waits for the config script to execute before setting the configuration.

Parameters:
Name Type Description
options Object
Properties
Name Type Description
id String

The node id of the configurator

form String

The configurator form to use

configuration Object

Initial configuration

el String
preset String