ConfiguratorContext
The ConfiguratorContext class is a wrapper around the Elfsquad configurator API. The class contains methods to start visualize configurations.
constructor(_options)
Initializes a new instance with the provided options.
Method parameters
The options that are used to configure the context.
getConfigurationModels(languageIso?)
Retrieve the available configuration models, categories & languages for the current showroom & user.
Method parameters
the language iso will be used for setting feature texts in the DTO.
Returns (Promise<ConfigurationModels>)
DTO containing the configuration models, categories & languages.
newConfiguration(name, language, preview, includeSearchbarResults)
Start a new configuration with the provided feature model id, feature model name or configuration code.
Method parameters
The feature model id, feature model name or configuration code.
The language to start the configuration in.
Whether the configuration should be started in preview mode.
Whether results in display type searchbar should be included or not.
Returns (Promise<Configuration>)
The new configuration.
openConfiguration(configurationId, includeSearchbarResults)
Open an existing configuration with the provided configuration id or configuration code.
Method parameters
The configuration id or configuration code.
Whether results in display type searchbar should be included or not.
Returns (Promise<Configuration>)
The opened configuration.
getSettings(language)
Retrieve the settings for the current showroom.
Method parameters
The language is used for retrieving localized texts.
Returns (Promise<Settings>)
The settings for the current showroom & user.
getLayout2d(configurationId, stepId)
Retrieve the 2D layout for a coniguration. The 2dlayout can be used for visualizing the configuration in a 2D view.
Method parameters
The configuration id. If not provided, the root configuration id will be used.
The step id.
Returns (Promise<Layout2d[]>)
The 2D layout for the configuration.
getLayout3d(configurationId)
Retrieve the 3D layout for a coniguration. The 3dlayout can be used for visualizing the configuration in a 3D view.
Method parameters
The configuration id. If not provided, the root configuration id will be used.
Returns (Promise<Layout3d[]>)
The 3D layout for the configuration.
getLinkedConfigurationOverview()
Retrieve the linked configuration overview for the current root configuration. This overview can be used to display a navigator for the linked configurations.
Returns (Promise<LinkedConfigurationOverview>)
The linked configuration overview for the current root configuration.
getOverview(configurationId)
Retrieve the overview for the current configuration. The overview can be used to display a summary of the configuration, for example on the checkout page.
Method parameters
The configuration id. If not provided, the root configuration id will be used.
Returns (Promise<OverviewGroups[]>)
The overview for the configuration.
onUpdate(f)
Registers a callback function that will be called whenever a configuration is updated.
Method parameters
The callback function that will be registered.
requestQuote(quotationRequest)
Request a quote for the current root configuration. This endpoint should be used when anonymous users want to request a quote.
Method parameters
The quotation request.
addToQuotation(quotationId, configurationIds)
Add the current configuration to a quotation. This endpoint should be used when a user is logged in and wants to add a configuration to a quotation.
Method parameters
The quotation id.
The configuration ids. If not provided, the root configuration id will be used.
_get(url)
Method parameters
Returns (Promise<Response>)
_put(url, object)
Method parameters
Returns (Promise<Response>)
_updateConfiguration(configuration)
Method parameters
Configuration
The Configuration class is returned by the ConfiguratorContext and is used for managing the configuration state updating the configuration.
constructor(configuratorContext, data)
Method parameters
updateRequirement(featureModelNodeId, isSelection, value, ignoreConflicts, includeSearchbarResults)
Updates a requirement on the this configuration. This can be used to (de)select a feature or set a value on a feature.
Method parameters
The id of the feature model node to update
Whether the feature should be selected or not
The value to set on the feature
If ture, the API will try to automatically resolve conflicts.
If true, the API will include results in the display type searchbar.
Returns (Promise<void>)
A promise that resolves when the requirement has been updated
updateText(featureModelNodeId, textValue)
Updates the text value of a feature on this configuration.
Method parameters
The id of the feature model node to update
The text value to set on the feature
Returns (Promise<void>)
A promise that resolves when the text value has been updated
updateImage(featureModelNodeId, textValue)
Updates the image value of a feature on this configuration.
Method parameters
The id of the feature model node to update
The image value to set on the feature
Returns (Promise<void>)
A promise that resolves when the image value has been updated
updateName(name, linkedConfigurationId)
Updates the name of this or a linked configuration.
Method parameters
The new name of the configuration
The id of the linked configuration to update
Returns (Promise<void>)
A promise that resolves when the name has been updated
updateCardinality(parentNodeId, cardinality)
Updates the cardinality of a linked configuration.
Method parameters
The id of the parent node of the linked configuration
The new cardinality of the linked configuration
Returns (Promise<void>)
A promise that resolves when the cardinality has been updated
changeLanguage(languageIso)
Changes the language of this configuration.
Method parameters
The ISO code of the language to change to
Returns (Promise<void>)
A promise that resolves when the language has been changed successfully
getStepImage(stepId, size, background)
Retrieves a rendered image of a step in this configuration.
Method parameters
The id of the step to render
The size of the image to render
Whether to render the background or not
Returns (Promise<Blob>)
A promise that resolves with the rendered image
getPdf()
Retrieves the PDF document for this configuration.
Returns (Promise<Blob>)
A promise that resolves with the PDF document