BldsClient

BldsClient

new BldsClient(service_url, in_settingsopt)

Parameters:
Name Type Attributes Description
service_url string
in_settings spv.ds.DsClientSettings <optional>
Source:

Extends

Members

(protected) _protocol :spv.ds.impl.IDsProtocol

Type:
Inherited From:
Source:

(protected) _session_state :spv.ds.impl.SessionState

Type:
Inherited From:
Source:

(inner, non-null) settings :spv.ds.DsClientSettings

Type:
Source:

Methods

(static) extractArticleNumberFromAux(item_aux_obj) → {Object.<string, string>}

Parameters:
Name Type Description
item_aux_obj Object
Source:
Returns:
Type
Object.<string, string>

(protected) assertInitializedSession()

Throw exception if session is not initialized.

Inherited From:
Source:

(protected) assertInitializedSessionWithConfig()

Throw exception if session is not initialized or is missing a configuration.

Inherited From:
Source:

constructDefaultImageParams() → {spv.ds.ImageParams}

Create a ImageParams instance with default values, however, defaults are likely not good enough for most contexts.

Preconditions: None.

Inherited From:
Source:
Returns:
Type
spv.ds.ImageParams

(protected) constructFailureWrapperForQueue(wrap_me) → {function}

Constructs the standard failure callback wrapper for queued session requests

Parameters:
Name Type Description
wrap_me function

The outer failure handler to wrap

Inherited From:
Source:
Returns:
Type
function

(protected) errorHandler(on_failure) → {function}

Parameters:
Name Type Description
on_failure function
Inherited From:
Source:
Returns:
Type
function

generatePublicConfig(on_success, on_failure)

Save the current configuration for the logged in user as a public config. The generated name is returned as a string to the on_success function.

Preconditions: Initialized session, loaded configuration, logged in user.

Parameters:
Name Type Description
on_success function
on_failure function
Inherited From:
Source:

getConfigImage(conf, img_params, on_success, on_failure)

Requests an image for a serialized configuration.

Preconditions: None.

Parameters:
Name Type Description
conf spv.ds.Config
img_params spv.ds.ImageParams
on_success function
on_failure function
Inherited From:
Source:

getFreshConfigs(limit, scale_width, scale_height, on_success, on_failure)

Requests the most recently built car configurations.

Parameters:
Name Type Description
limit number

Max number of configs in result

scale_width number
scale_height number
on_success function
on_failure function
Inherited From:
Source:

getIntroPage(on_success, on_failure)

Requests the "Intro page" data including available start-configurations, typically one config for each car model.

Preconditions: None.

Parameters:
Name Type Description
on_success function
on_failure function
Inherited From:
Source:

getItemResources(item_ids, category, model, language, on_success, on_failure)

Parameters:
Name Type Description
item_ids Array.<string>
category string
model string
language string
on_success function
on_failure function
Inherited From:
Source:

getLanguage() → {string}

Inherited From:
Source:
Returns:
Type
string

getReadMore(item_id, model, category, on_success, on_failure)

Parameters:
Name Type Description
item_id string
model string
category string
on_success function
on_failure function
Inherited From:
Source:

getSessionId() → {string}

Get the session id or throw if null

Inherited From:
Source:
Returns:
Type
string

getUserConfigList(username, on_success, on_failure)

Gets all configurations stored in the database by the given username. This is a heavy operation and is included here for utility purposes.

Parameters:
Name Type Description
username string
on_success function
on_failure function
Inherited From:
Source:

publicConfigV2Load(public_config_id, on_success, on_failure)

Parameters:
Name Type Description
public_config_id string
on_success function
on_failure function
Inherited From:
Source:

publicConfigV2Save(description, config_storage_aux, on_success, on_failure)

Parameters:
Name Type Description
description string
config_storage_aux Object.<string, string>
on_success function
on_failure function
Inherited From:
Source:

resetPassword(token, new_password, on_success, on_failure)

Resets user password.

Token is retrieved via email, sent by sessionSendResetPasswordMail.

Parameters:
Name Type Description
token string
new_password string
on_success function
on_failure function
Inherited From:
Source:

sessionAddGuiGroupSubscriptions(group_ids, on_success, on_failure)

Parameters:
Name Type Description
group_ids Array.<string>
on_success function
on_failure function
Inherited From:
Source:

sessionApplySuggestion(suggestion, on_success, on_failure)

Apply a configuration change suggestion on the current configuration.

Preconditions: Initialized session, loaded configuration, caller code has a valid instance of spv.ds.Suggestion retrieved by calling sessionToggleItem, no requests that modify the session configuration has been dispatched between suggestion construction and the call to this function.

Parameters:
Name Type Description
suggestion spv.ds.Suggestion

The suggestion to be applied to the current configuration.

on_success function

Called when the suggestion has been successfully applied.

on_failure function

Called on any kind of failure.

Inherited From:
Source:

(protected) sessionAutomaticHeartbeat(on_heartbeat, on_failure)

Parameters:
Name Type Description
on_heartbeat function
on_failure function
Inherited From:
Source:

sessionCheckForArticleNumber(item_id) → {Object.<string, string>}

Makes a lookup for the given item id to see if it has an article number. An object is returned with {state: somestate, value: thearticlenumber}. Possible state values: "FOUND": An article number was found and is returned in the value field. "NO_AUX_DATA": There's no additional data for this item, what so ever. "NO_SPECIFIC_AUX_DATA": There's no Blds specific aux data for this item. "NO_ARTNO_AUX_DATA": It has Blds aux data, but no article number in it.

Only if state === "FOUND" will the value contain a string with the article number. .value will be undefined in all other cases.

Parameters:
Name Type Description
item_id string
Source:
Returns:
Type
Object.<string, string>

sessionClearGuiGroupSubscriptions(on_success, on_failure)

Parameters:
Name Type Description
on_success function
on_failure function
Inherited From:
Source:

sessionCreateUser(user_name, password, on_success, on_failure)

Create a new user in the user database.

May not be required to create a user, depending on backend settings.

Parameters:
Name Type Description
user_name string
password string
on_success function
on_failure function
Inherited From:
Source:

(protected) sessionDequeueNextRequest()

Session requests that require synchronization must use this function This function is not allowed to throw exceptions.

Inherited From:
Source:

(protected) sessionEnqueueRequest(request)

Session requests that require synchronization must use this function

Parameters:
Name Type Description
request function
Inherited From:
Source:

sessionGeneratePdf(on_success, on_failure)

Create a pdf using current session state and returns the pdf url through a callback if a pdf was generated successfully.

Preconditions: Initialized session, loaded configuration.

Parameters:
Name Type Description
on_success function

Callback taking the generated pdf url

on_failure function
Inherited From:
Source:

sessionGetArticleNumber(item_id) → (nullable) {string}

Gets the article number for an item or null if it doesn't have one.

Parameters:
Name Type Description
item_id string
Source:
Returns:
Type
string

(protected) sessionGetAuxiliaryData() → {Object.<string, Object>}

Returns the auxiliary data arriving with the latest bop.

Preconditions: Initialized session, loaded configuration.

Inherited From:
Source:
Returns:
Type
Object.<string, Object>

sessionGetConfig(encoding, on_success, on_failure)

Requests the current session config

Available encodings are: "" : internal encoding, only for debug

Preconditions: Initialized session, loaded config.

Parameters:
Name Type Description
encoding string
on_success function
on_failure function
Inherited From:
Source:

sessionGetConfigNames(on_success, on_failure)

Get the saved configs for the logged in user

Preconditions: Initialized session, logged in user.

Parameters:
Name Type Description
on_success function

A callback taking an array of names of saved configurations. The configuration names can be used to remove or load configs for the logged in user by sessionRemoveConfigByName and sessionLoadConfigByName.

on_failure function
Inherited From:
Source:

sessionGetCurrentConfig() → {spv.ds.Config}

Gets the current configuration.

Preconditions: Initialized session, loaded configuration. This requires the CurrentConfigAuxPlugin to work.

Source:
Returns:
Type
spv.ds.Config

sessionGetFacebookShareData(on_success, on_failure)

Requests the text, images etc used for facebook sharing.

Preconditions: Initialized session, loaded configuration.

Parameters:
Name Type Description
on_success function
on_failure function
Inherited From:
Source:

sessionGetFreshConfigs(limit, scale_width, scale_height, on_success, on_failure)

Requests the most recently built car configurations.

Parameters:
Name Type Description
limit number

Max number of configs in result

scale_width number
scale_height number
on_success function
on_failure function
Inherited From:
Deprecated:
  • Yes
Source:

sessionGetImage(img_params, on_success, on_failure)

Builds an image for the current configuration state in this session.

Preconditions: Initialized session, loaded configuration.

Parameters:
Name Type Description
img_params spv.ds.ImageParams
on_success function
on_failure function
Inherited From:
Source:

sessionGetImageSerieInfos() → {Array.<spv.ds.ImageSerieInfo>}

Get image serie info for the current configuration

Preconditions: Initialized session, loaded configuration.

Inherited From:
Source:
Returns:
Type
Array.<spv.ds.ImageSerieInfo>

sessionGetIntroDisclaimer() → {spv.ds.Disclaimer}

Gets the disclaimer to be displayed when the configurator is started.

Inherited From:
Source:
Returns:
Type
spv.ds.Disclaimer

sessionGetItemInfo(item_ids, on_success, on_failure)

Get complete item info for items by item id

Preconditions: Initialized session, loaded configuration.

Parameters:
Name Type Description
item_ids Array.<string>
on_success function
on_failure function
Inherited From:
Source:

sessionGetItemSummaryArticleNumber(item_summary) → (nullable) {string}

Parameters:
Name Type Description
item_summary spv.ds.ItemSummary
Source:
Returns:
Type
string

sessionGetLongText(item_id) → {string}

Get 'long_text' text for item_id or empty string on failure

Texts are configuration dependent. In practice updating texts is only needed after loading a configuration, not when simply toggling an item in the configuration.

Preconditions: Initialized session, loaded configuration.

Parameters:
Name Type Description
item_id string
Inherited From:
Source:
Returns:
Type
string

sessionGetMediaKit(serie_index, frame_index, file_type, separate_background, separate_shadow, all_frames, use_hd, image_width, image_height, on_success, on_failure)

Gets an URL to a zipfile containing the images.

Parameters:
Name Type Description
serie_index number
frame_index number
file_type string
separate_background boolean
separate_shadow boolean
all_frames boolean
use_hd boolean
image_width number
image_height number
on_success function
on_failure function
Inherited From:
Source:

sessionGetMediumText(item_id) → {string}

Get 'medium_text' text for item_id or empty string on failure

Texts are configuration dependent. In practice updating texts is only needed after loading a configuration, not when simply toggling an item in the configuration.

Preconditions: Initialized session, loaded configuration.

Parameters:
Name Type Description
item_id string
Inherited From:
Source:
Returns:
Type
string

sessionGetModelDisclaimer(model_idopt) → {spv.ds.Disclaimer}

Get the disclaimer specific for a model.

If no model id is passed, it'll default to the active configuration's model.

Parameters:
Name Type Attributes Description
model_id string <optional>
Inherited From:
Source:
Returns:
Type
spv.ds.Disclaimer

sessionGetPresentationStructure(filter_name, query, on_success, on_failure)

Parameters:
Name Type Description
filter_name string
query spv.ds.PresentationStructureQuery
on_success function
on_failure function
Inherited From:
Source:

sessionGetRootMenuItems() → {Array.<spv.ds.MenuItem>}

Get the root menu items for the current configuration

Preconditions: Initialized session, loaded config.

Inherited From:
Source:
Returns:
Type
Array.<spv.ds.MenuItem>

sessionGetShortText(item_id) → {string}

Get 'short_text' text for item_id or empty string on failure

Texts are configuration dependent. In practice updating texts is only needed after loading a configuration, not when simply toggling an item in the configuration.

Preconditions: Initialized session, loaded configuration.

Parameters:
Name Type Description
item_id string
Inherited From:
Source:
Returns:
Type
string

sessionGetStateUpdate() → {spv.ds.SessionStateUpdate}

Get the last state update. Call this function on successful load of configs or on successful sessionToggleItem.

Preconditions: Initialized session, loaded configuration.

Overrides:
Source:
Returns:
Type
spv.ds.SessionStateUpdate

sessionGetSummary(on_success, on_failure)

Get the summary for the current session and configuration

Preconditions: Initialized session, loaded configuration.

Parameters:
Name Type Description
on_success function
on_failure function
Overrides:
Source:

sessionGetSummaryArticleNumbers(summary) → {Array.<string>}

Finds the article number for the items in a summary. Use BldsClient.sessionGetSummary() to fetch the configuration's summary.

Parameters:
Name Type Description
summary spv.ds.Summary
Source:
Returns:
Type
Array.<string>

sessionGetUrlSettings() → {spv.ds.UrlSettings}

Get base urls needed for most HTTP GET paths to images

Preconditions: Initialized session.

Inherited From:
Source:
Returns:
Type
spv.ds.UrlSettings

sessionGetUserConfigImage(config_name, img_params, on_success, on_failure)

Requests an image for a saved configuration

Preconditions: Initialized session, logged in user.

Parameters:
Name Type Description
config_name string
img_params spv.ds.ImageParams
on_success function
on_failure function
Inherited From:
Source:

sessionHasLoggedInUser(on_success, on_failure)

Check with backend if the session has a logged in user.

Preconditions: Initialized session.

Parameters:
Name Type Description
on_success function
on_failure function
Inherited From:
Source:

sessionInit(menu_query, readmore_mode, on_success, on_failure)

Initialize session. This must be called before calling any other member function with "session". For most other session calls a configuration needs to be loaded as well.

This is not done in the constructor in order to allow state-/session-less calls without initializing a session.

Preconditions: None.

Parameters:
Name Type Description
menu_query string
readmore_mode spv.ds.ipprot_nova.input.BopReadMoreMode
on_success function
on_failure function
Overrides:
Source:

sessionLoadConfig(config, on_success, on_failure)

Loads a configuration into the current session and replaces to current configuration state.

Preconditions: Initialized session.

Parameters:
Name Type Description
config spv.ds.Config
on_success function
on_failure function
Inherited From:
Source:

sessionLoadConfigByName(config_name, on_success, on_failure)

Loads a configuration into the current session and replaces to current configuration state. The config is referenced by it's name retrieved from sessionGetConfigNames.

Preconditions: Initialized session, logged in user.

Parameters:
Name Type Description
config_name string
on_success function
on_failure function
Inherited From:
Source:

sessionLoadPublicConfig(public_config_id, on_success, on_failure)

Loads a configuration from the "public" database into the current session replacing the current configuration state.

"Public Configs" are anonymous configurations saved without any user information that can be loaded by a unique key.

Preconditions: Initialized session.

Parameters:
Name Type Description
public_config_id string
on_success function
on_failure function
Inherited From:
Source:

sessionLogin(user_name, password_or_success, success_or_failure, failureopt)

User login Password may be required depending on backend settings.

May create the user if it doesn't exist, depending on backend settings.

success and failure callbacks are always at the end.

sessionLogin( session_id, name, password, success, failure ); sessionLogin( session_id, name, success, failure );

Preconditions: Initialized session.

Parameters:
Name Type Attributes Description
user_name string
password_or_success string | function
success_or_failure function | function
failure function <optional>
Inherited From:
Source:

sessionLogout(on_success, on_failure)

Logout the user from the session.

Parameters:
Name Type Description
on_success function
on_failure function
Inherited From:
Source:

sessionRemoveConfigByName(config_name, on_success, on_failure)

Remove a saved configuration for the logged in user

Preconditions: Initialized session, logged in user.

Parameters:
Name Type Description
config_name string

Name retrieved by sessionGetConfigNames

on_success function
on_failure function
Inherited From:
Source:

(protected) sessionResetRequestQueue()

Resets session request queue

Inherited From:
Source:

sessionResume(session_id, on_success, on_failure)

Initialize with existing session. Used instead of sessionInit.

Preconditions: Client not initialized.

Parameters:
Name Type Description
session_id string
on_success function
on_failure function
Inherited From:
Source:

sessionSaveConfigByName(config_name, allow_overwrite, on_success, on_failure)

Save the current configuration for the logged in user

Preconditions: Initialized session, loaded configuration, logged in user.

Parameters:
Name Type Description
config_name string
allow_overwrite boolean
on_success function
on_failure function
Inherited From:
Source:

sessionSendHeartBeat(on_success, on_failure)

Call this function to keep the session alive

Preconditions: Initialized session.

Parameters:
Name Type Description
on_success function
on_failure function
Inherited From:
Source:

sessionSendResetPasswordMail(password_form_url, user_name, language, on_success, on_failure)

Precondition: Initialized session

Parameters:
Name Type Description
password_form_url string
user_name string
language string
on_success function
on_failure function
Inherited From:
Source:

sessionSetPriceLocalization(price_localization_id, on_success, on_failure)

Choose which collection of price rules to use for the current session

Preconditions: Initialized session.

Parameters:
Name Type Description
price_localization_id string
on_success function
on_failure function
Inherited From:
Source:

sessionToggleItem(menu_item, on_success, on_suggestions, on_failure)

Try to change item state for one item in the current configuration. An item has two states, On or Off, eg. an item is part of the current configuration or it is not. The result of this operation can only be determined by the server. Any call to this function may result in suggestions being returned through the callback on_suggestions. If suggestions

Use DsClient.setLanguage in order to specify language. Leaving it undefined will cause the backend to resolve a preferred instead.

Preconditions: Initialized session, loaded configuration, caller code has a valid instance of spv.ds.MenuItem.

Parameters:
Name Type Description
menu_item spv.ds.MenuItem

Menu item to toggle on or off. User code should not modify or construct instances of MenuItem, only pass MenuItem instances returned by this class.

on_success function

Will be called on toggle success if toggle has no important side effects. Caller code should call sessionGetStateUpdate on this object to get the latest session state update.

on_suggestions function

Will be called if item toggle has important side effects or if relevant alternative configuration states has been found.

on_failure function

Called on any kind of failure.

Overrides:
Source:

(protected) sessionUpdateBop(on_success, on_failure)

Requests a fresh bop and stores the new state in the client.

Parameters:
Name Type Description
on_success function
on_failure function
Inherited From:
Source:

setLanguage(language, on_success, on_failure)

Parameters:
Name Type Description
language string
on_success function
on_failure function
Inherited From:
Source:

startAutomaticHeartbeat(interval, on_heartbeat, on_failure)

Starts the automatic heartbeat for the session. Don't forget to call stopAutomaticHeartbeat if you attempt to destroy or replace the DsClient object. If you don't, there'll be an orphaned DsClient object heartbeating forever. (Well, until the browser session ends. )

Parameters:
Name Type Description
interval number

How often the heartbeat is triggered, in milliseconds.

on_heartbeat function

This callback is called for every heartbeat.

on_failure function
Inherited From:
Source:

stopAutomaticHeartbeat()

Inherited From:
Source:

userConfigV2Delete(config_id, on_success, on_failure)

Preconditions: Initialized session.

Parameters:
Name Type Description
config_id number
on_success function
on_failure function
Inherited From:
Source:

userConfigV2List(on_success, on_failure)

Preconditions: Initialized session.

Parameters:
Name Type Description
on_success function
on_failure function
Inherited From:
Source:

userConfigV2Load(config_id, on_success, on_failure)

Preconditions: Initialized session.

Parameters:
Name Type Description
config_id number
on_success function
on_failure function
Inherited From:
Source:

userConfigV2Save(config_id, config_description, user_config_aux, config_storage_aux, on_success, on_failure)

Preconditions: Initialized session.

Parameters:
Name Type Description
config_id number
config_description string
user_config_aux Object.<string, string>
config_storage_aux Object.<string, string>
on_success function
on_failure function
Inherited From:
Source:

userConfigV2SaveAs(config_name, config_description, user_config_aux, config_storage_aux, on_success, on_failure)

Preconditions: Initialized session.

Parameters:
Name Type Description
config_name string
config_description string
user_config_aux Object.<string, string>
config_storage_aux Object.<string, string>
on_success function
on_failure function
Inherited From:
Source: