new VdsClient(service_urlnon-null, in_settingsopt)
VdsClient provides a layer of abstraction between GUI code and session-/protocol-handling.
The configurator system is stateful. Session state is shared between server and client, this is a source of complexity and can hopefully be removed at some point in the future. VdsClient provides synchronization of session state between server and client by centralizing management of the shared state inside this class.
Member functions are stateful if the member function name begins with "session". Other member functions are state- and session-less and can be called at any time, in any order.
Most session dependent functions also require a loaded configuration. Preconditions should be documented for each member function in this class.
The configurator system can be simplified as the following three phases: A. The user finds the configurator application on the web or in the showroom. B. The user choose and change the product components (called items) until the user is satisfied or leaved the application. C. The user saves the configuration for a later time or choose to place an order or request a sales contact for the built configuration.
Technical usage example 1, Starting a new configuration session and interacting with the user. (Step-by-step example of phase B):
- Construct an instance of spv.vds.Client
- Call sessionInit
- Call getIntroPage to retrieve the available start configurations
- Generate images for the start configurations using getConfigImage
- Display the available start configuration images to the user using the appropriate techniques for the GUI implementation.
- The user chooses a start configuration
- Send that start configuration to sessionLoadConfig
- On success, call sessionGetRootMenuItems and sessionGetImage
- Populate the GUI root menu with menu items and wait for the image response
- On image success, load and display the configuration image
- The user makes a choice about which menu to open
- Call sessionToggleItem for the user chosen MenuItem (both menus and product components are MenuItems)
- On success, call sessionGetStateUpdate to populate the currently open menu with menu items.
- The user clicks an item in the currently open menu, send that MenuItem to sessionToggleItem and handle response.
- On success, update the currently open menu with new MenuItems (most menu items will usually be unchanged, but some may change state and some may disappear while others may be added). Call sessionGetImage to get the new configuration image and wait for response.
- On image success, load and display the configuration image
- The user clicks a new item and the sessionToggleItem cycle continues until the user closes the application or decides to place an order for the built configuration. (this step is customized action for each configurator application, eg. cars and bathroom products require different types of shopping cart solutions)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
service_url |
string
|
||
in_settings |
spv.ds.DsClientSettings
|
<optional> |
Extends
Members
Methods
(static) requestServiceInfo(service_group_id, on_success, on_failure)
Requests a specific service from a load balancing relay service and returns the url via the on_success callback.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
service_group_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
(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) constructSuggestion(goal_resolver) → {spv.ds.Suggestion}
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
goal_resolver |
spv.ds.impl.GoalStateResolver
|
Returns:
- Type:
-
spv.ds.Suggestion
(protected) constructSuggestions(goal_resolvers) → {Array.<spv.ds.Suggestion>}
Convert state resolvers to suggestions for user presentation and bind each suggestion to a .activate function to allow hiding of implemention.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
goal_resolvers |
Array.<spv.ds.impl.GoalStateResolver>
|
Returns:
- Type:
-
Array.<spv.ds.Suggestion>
(protected) errorHandler(on_failure) → {function}
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
getAllCars(model_id, on_success, on_failure)
Returns the PNO12s of all our cars from the database.
Preconditions: None.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
model_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
getBuildInfo(on_success, on_failure)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
getCampaigns(feed_id, on_success, on_failure)
Requests available campaigns using the related feed id.
Each campaign item will be test loaded in the configurator server to verify its correctness in combination with the available content data before returning the results to the client. See documentation for spv.vds.CapmaignCollection for more information.
Preconditions: None.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
feed_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
getConfigImage(conf, img_params, on_success, on_failure)
Requests an image for a serialized configuration.
Preconditions: None.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
conf |
spv.ds.Config
|
|
img_params |
spv.ds.ImageParams
|
|
on_success |
function
|
|
on_failure |
function
|
getFreshConfigs(limit, scale_width, scale_height, on_success, on_failure)
Requests the most recently built car configurations.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
limit |
number
|
Max number of configs in result |
scale_width |
number
|
|
scale_height |
number
|
|
on_success |
function
|
|
on_failure |
function
|
getIntroPage(on_success, on_failure)
Requests the "Intro page" data including available start-configurations, typically one config for each car model.
Preconditions: None.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
getItemResources(item_ids, resource_keys, category, model, language, model_group, on_success, on_failure)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item_ids |
Array.<string>
|
|
resource_keys |
Array.<string>
|
|
category |
string
|
|
model |
string
|
|
language |
string
|
|
model_group |
string
|
|
on_success |
function
|
|
on_failure |
function
|
getLanguage() → {string}
- Inherited From:
- Source:
Returns:
- Type:
-
string
getReadMore(item_id, model, category, on_success, on_failure)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item_id |
string
|
|
model |
string
|
|
category |
string
|
|
on_success |
function
|
|
on_failure |
function
|
getRetailers(on_success, on_failure)
Requests all available retailers
Preconditions: None.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
getSessionId() → {string}
Get the session id or throw if null
- Inherited From:
- Source:
Returns:
- Type:
-
string
getSpecification(config, price_localization_id, on_success, on_failure)
Get the VolvoCarSpec for a config.
Preconditions: None.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
config |
spv.ds.Config
|
|
price_localization_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
username |
string
|
|
on_success |
function
|
|
on_failure |
function
|
publicConfigV2Load(public_config_id, on_success, on_failure, on_coc)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
public_config_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
|
on_coc |
function
|
(optional) |
publicConfigV2Save(description, config_storage_aux, on_success, on_failure)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
description |
string
|
|
config_storage_aux |
Object.<string, string>
|
|
on_success |
function
|
|
on_failure |
function
|
resetPassword(token, new_password, on_success, on_failure)
Resets user password.
Token is retrieved via email, sent by sessionSendResetPasswordMail.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
token |
string
|
|
new_password |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionAddGuiGroupSubscriptions(group_ids, on_success, on_failure)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
group_ids |
Array.<string>
|
|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
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. |
sessionAttemptSetPriceMode(price_mode, send_update, on_success, on_failure)
Preconditions: Initialized session. Setting price mode can potentially require changing the configuration since there can be introduced new items and rules applicable only to this price mode and current configuration might become invalid. This method attempts to set a new price mode and can activate the mode directly or return back suggestions that should be applied to the configuration to make it valid and/or any optional changes that were required in the current price mode but will become optional in the new price mode.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
price_mode |
spv.vds.VdsPriceMode
|
|
send_update |
spv.vds.SendBopUpdateFlag
|
|
on_success |
function
|
TODO: Use static typing! |
on_failure |
function
|
(protected) sessionAutomaticHeartbeat(on_heartbeat, on_failure)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_heartbeat |
function
|
|
on_failure |
function
|
sessionCareSendCustomerOrder(retid_delivery, retid_sales, customer_first_name, customer_last_name, customer_street_address, customer_city, customer_postal_code, customer_phone, customer_email, redirect, attachment, on_success, on_failure)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
retid_delivery |
string
|
|
retid_sales |
string
|
|
customer_first_name |
string
|
|
customer_last_name |
string
|
|
customer_street_address |
string
|
|
customer_city |
string
|
|
customer_postal_code |
string
|
|
customer_phone |
string
|
|
customer_email |
string
|
|
redirect |
boolean
|
|
attachment |
boolean
|
|
on_success |
function
|
|
on_failure |
function
|
sessionCareSendCustomerOrderUrl() → {string}
Generate the a URL to send customer order form data.
- Source:
Returns:
- Type:
-
string
sessionClearGuiGroupSubscriptions(on_success, on_failure)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionCreateUser(user_name, password, on_success, on_failure, languageopt)
Create a new user in the user database.
May not be required to create a user, depending on backend settings.
- Inherited From:
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
user_name |
string
|
||
password |
string
|
||
on_success |
function
|
||
on_failure |
function
|
||
language |
string
|
<optional> |
sessionDisableCCPrices()
TODO: Write documentation with type annotations.
- Source:
sessionDisablePrivateLeasing(on_success, on_failure)
Disables private leasing financing mode for the current session.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionEnableCCPrices()
TODO: Write documentation with type annotations.
- Source:
sessionEnablePrivateLeasing(on_success, on_failure)
Enables private leasing financing mode for the current session.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
Callback taking the generated pdf url |
on_failure |
function
|
sessionGenerateRetailerHtmlForPdf(template_name, retailer_id, on_success, on_failure)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
template_name |
string
|
|
retailer_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
(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>
sessionGetCampaignText(item_id) → {string}
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item_id |
string
|
Returns:
- Type:
-
string
sessionGetCCInfo(on_success, on_failure)
Gets the current company cars information for the active configuration.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionGetCCItemInfo(item_idnon-null, on_success, on_failure)
Gets the current company cars information for a MenuItem.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionGetConfig(encoding, on_success, on_failure)
Requests the current session config
Available encodings are: "" : internal encoding, only for debug
Preconditions: Initialized session, loaded config.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
encoding |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionGetConfigNames(on_success, on_failure)
Get the saved configs for the logged in user
Preconditions: Initialized session, logged in user.
- Inherited From:
- Source:
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
|
sessionGetConfigQuickInfo(config_name, on_success, on_failure)
Get some quick info about a saved configuration, such as model name and engine.
Preconditions: Initialized session
- Source:
Parameters:
Name | Type | Description |
---|---|---|
config_name |
string
|
|
on_success |
function
|
A callback taking a Loan info object |
on_failure |
function
|
sessionGetCurrentPriceMode(on_success, on_failure)
Preconditions: Initialized session.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionGetFacebookShareData(on_success, on_failure)
Requests the text, images etc used for facebook sharing.
Preconditions: Initialized session, loaded configuration.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionGetFlexImage(input, on_success, on_failure)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
input |
spv.ds.FlexImageParameters
|
|
on_success |
function
|
|
on_failure |
function
|
sessionGetFreshConfigs(limit, scale_width, scale_height, on_success, on_failure)
Requests the most recently built car configurations.
- Inherited From:
- Deprecated:
- Yes
- Source:
Parameters:
Name | Type | Description |
---|---|---|
limit |
number
|
Max number of configs in result |
scale_width |
number
|
|
scale_height |
number
|
|
on_success |
function
|
|
on_failure |
function
|
sessionGetImage(img_params, on_success, on_failure)
Builds an image for the current configuration state in this session.
Preconditions: Initialized session, loaded configuration.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
img_params |
spv.ds.ImageParams
|
|
on_success |
function
|
|
on_failure |
function
|
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>
sessionGetInitialConsequenceOfChange(on_success, on_failure)
To be called after loading a config to retrieve the potential changes made during loading.
A stored configuration may no longer be possible to load with the exact specification. For instance, an option may have been removed since the configuration was first built. The system will try to adapt it to the current logic, in which case you'll use this method to present the user with the changes made by the system.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item_ids |
Array.<string>
|
|
on_success |
function
|
|
on_failure |
function
|
sessionGetLeasingParams(on_success, on_failure)
Get the current session leasing parameters
Preconditions: Initialized session
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionGetLoan(on_success, on_failure)
Get the current loan parameters and calculation result
Preconditions: Initialized session
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
A callback taking a Loan info object |
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item_id |
string
|
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.
- Inherited From:
- Source:
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
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item_id |
string
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
model_id |
string
|
<optional> |
Returns:
- Type:
-
spv.ds.Disclaimer
sessionGetModelFeatures(on_success, on_failure)
Gets model features for the active configuration.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionGetPresentationStructure(filter_name, query, on_success, on_failure)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
filter_name |
string
|
|
query |
spv.ds.PresentationStructureQuery
|
|
on_success |
function
|
|
on_failure |
function
|
sessionGetPrivateLeaseInfo(on_success, on_failure)
Gets the current private lease information for the active configuration.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionGetPrivateLeaseItemInfo(item_idnon-null, on_success, on_failure)
Gets the current private leasing information for a MenuItem.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item_id |
string
|
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.
- Inherited From:
- Source:
Returns:
sessionGetSummary(on_success, on_failure)
Get the summary for the current session and configuration
Preconditions: Initialized session, loaded configuration.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
config_name |
string
|
|
img_params |
spv.ds.ImageParams
|
|
on_success |
function
|
|
on_failure |
function
|
sessionGetUserConsents(session_id, on_success, on_failure)
Gets a users GDPR consents from a session id. Used when existing user logs in.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
session_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionGetVolvoItemInfo(item_idnon-null, on_success, on_failure)
Gets volvo item info for a MenuItem.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
item_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionHasLoggedInUser(on_success, on_failure)
Check with backend if the session has a logged in user.
Preconditions: Initialized session.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
menu_query |
string
|
|
readmore_mode |
spv.ds.ipprot_nova.input.BopReadMoreMode
|
|
on_success |
function
|
|
on_failure |
function
|
sessionLoadConfig(config, on_success, on_failure)
Loads a configuration into the current session and replaces to current configuration state.
Preconditions: Initialized session.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
config |
spv.ds.Config
|
|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
config_name |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionLoadConfigMemorizeAll(config, on_success, on_failure)
Loads a configuration into the current session and replaces to current configuration state.
Preconditions: Initialized session.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
config |
spv.ds.Config
|
|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
public_config_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
user_name |
string
|
||
password_or_success |
string
|
function
|
||
success_or_failure |
function
|
function
|
||
failure |
function
|
<optional> |
sessionLogout(on_success, on_failure)
Logout the user from the session.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionRemoveConfigByName(config_name, on_success, on_failure)
Remove a saved configuration for the logged in user
Preconditions: Initialized session, logged in user.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
config_name |
string
|
Name retrieved by sessionGetConfigNames |
on_success |
function
|
|
on_failure |
function
|
sessionResetLoan(send_update, on_success, on_failure)
Resets the loan parameters used for private loan calculations
Preconditions: Initialized session.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
send_update |
spv.vds.SendBopUpdateFlag
|
|
on_success |
function
|
|
on_failure |
function
|
sessionResume(session_id, on_success, on_failure)
Initialize with existing session. Used instead of sessionInit.
Preconditions: Client not initialized.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
session_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
config_name |
string
|
|
allow_overwrite |
boolean
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSendCustomerMailAndTacdis(customer_first_name, customer_surname, customer_email, customer_phone, preferred_contact_time, preferred_contact_media, want_quote, want_newsletter, mail_link_url, retailer_id, contract_id, employee_id, on_success, on_failure)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
customer_first_name |
string
|
|
customer_surname |
string
|
|
customer_email |
string
|
|
customer_phone |
string
|
|
preferred_contact_time |
string
|
|
preferred_contact_media |
string
|
|
want_quote |
boolean
|
|
want_newsletter |
boolean
|
|
mail_link_url |
string
|
|
retailer_id |
string
|
|
contract_id |
string
|
|
employee_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSendHeartBeat(on_success, on_failure)
Call this function to keep the session alive
Preconditions: Initialized session.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionSendMailToCustomer(customer_email, want_newsletter, want_summary_pdf, mail_link_url, on_success, on_failure)
Sends a volvo retailer newsletter and/or summary mail to the customer.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
customer_email |
string
|
|
want_newsletter |
boolean
|
|
want_summary_pdf |
boolean
|
|
mail_link_url |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSendMailToCustomerAndRetailer(customer_first_name, customer_surname, customer_email, customer_phone, preferred_contact_time, preferred_contact_media, want_newsletter, want_summary_pdf, retailer_id, mail_link_url, contract_id, employee_id, sales_rep_mail, on_success, on_failure)
Sends a volvo retailer newsletter and/or summary mail to the customer and retailer.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
customer_first_name |
string
|
|
customer_surname |
string
|
|
customer_email |
string
|
|
customer_phone |
string
|
|
preferred_contact_time |
string
|
|
preferred_contact_media |
string
|
|
want_newsletter |
boolean
|
|
want_summary_pdf |
boolean
|
|
retailer_id |
string
|
|
mail_link_url |
string
|
|
contract_id |
string
|
|
employee_id |
string
|
|
sales_rep_mail |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSendResetPasswordMail(password_form_url, user_name, language, on_success, on_failure)
Precondition: Initialized session
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
password_form_url |
string
|
|
user_name |
string
|
|
language |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSendToTacdis(customer_first_name, customer_surname, customer_email, customer_phone, retailer_id, on_success, on_failure)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
customer_first_name |
string
|
|
customer_surname |
string
|
|
customer_email |
string
|
|
customer_phone |
string
|
|
retailer_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSendVolvoCareMailToRetailer(customer_first_name, customer_surname, customer_address, customer_zipcode, customer_city, customer_email, customer_phone, skype_name, preferred_contact_media, free_text, retailer_id, mail_link_url, on_success, on_failure)
Sends a volvo care mail to retailer.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
customer_first_name |
string
|
|
customer_surname |
string
|
|
customer_address |
string
|
|
customer_zipcode |
number
|
|
customer_city |
string
|
|
customer_email |
string
|
|
customer_phone |
string
|
|
skype_name |
string
|
|
preferred_contact_media |
string
|
|
free_text |
string
|
|
retailer_id |
string
|
|
mail_link_url |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSetAccessoryMode(on_success, on_failure)
Sets the mode to AccessoryMode (as opposed to the default build-a-car mode)
Preconditions: Initialized session.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionSetLoan(down_payment, interest_rate, number_of_months, send_update, on_success, on_failure)
Sets the loan parameters used for private loan calculations
Preconditions: Initialized session.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
down_payment |
number
|
|
interest_rate |
number
|
|
number_of_months |
number
|
|
send_update |
spv.vds.SendBopUpdateFlag
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSetPriceLocalization(price_localization_id, on_success, on_failure)
Choose which collection of price rules to use for the current session
Preconditions: Initialized session.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
price_localization_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSetPriceMode(price_mode, send_update, optional_items, on_success, on_failure)
Preconditions: Initialized session.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
price_mode |
spv.vds.VdsPriceMode
|
|
send_update |
spv.vds.SendBopUpdateFlag
|
|
optional_items |
Array.<string>
|
Items that the user have chosen to trigger with the new price mode that should be deactivated. |
on_success |
function
|
|
on_failure |
function
|
sessionSetRetailerBusinessGroup(business_group_retailer_id, on_success, on_failure)
Sets retailer business group id and retailer mode for the current session.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
business_group_retailer_id |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSetUserConsent(user_id, consent_id, consent_text, on_success, on_failure)
Sets a users GDPR consent in the user database.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
user_id |
number
|
|
consent_id |
string
|
|
consent_text |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSetUserConsentSession(session_id, consent_id, consent_text, on_success, on_failure)
Sets a users GDPR consent from session id in the user database.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
session_id |
string
|
|
consent_id |
string
|
|
consent_text |
string
|
|
on_success |
function
|
|
on_failure |
function
|
sessionSetVolvoFilter(filter_key, on_success, on_failure)
Sets the product filter (used in company car scheme mode, for example)
Preconditions: Initialized session.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
filter_key |
string
|
|
on_success |
function
|
|
on_failure |
function
|
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.
- Inherited From:
- Source:
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. |
(protected) sessionUpdateBop(on_success, on_failure)
Requests a fresh bop and stores the new state in the client.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
sessionUpdateCCInputParams(params, send_update, on_success, on_failure)
Updates the given parameters for Company Cars pricing.
This method always return the current company car parameter state. You may pass an empty object to retrieve the available parameters and their current value. The value are default initialized. You're only required to send the changed paramaters. Unmentioned parameters will not change. The input parameters are passed as a flat Object, basically a dictionary, with the parameter names and values.
The names and types for each parameter can be found in the CCInputParam array returned by this function.
Warning: This function may potentially generate very long URL queries if jsonp is activated for the client.
Preconditions: sessionEnableCCPrices must be called before using this method.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
params |
Object.<string, Object>
|
TODO: Use static typing! |
send_update |
spv.vds.SendBopUpdateFlag
|
|
on_success |
function
|
|
on_failure |
function
|
sessionUpdateLeasingParams(driving_distance, duration, send_update, on_success, on_failure)
Update leasing parameters and get the updated leasing output
Preconditions: Initialized session
- Source:
Parameters:
Name | Type | Description |
---|---|---|
driving_distance |
number
|
|
duration |
number
|
|
send_update |
spv.vds.SendBopUpdateFlag
|
|
on_success |
function
|
|
on_failure |
function
|
setLanguage(language, on_success, on_failure)
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
language |
string
|
|
on_success |
function
|
|
on_failure |
function
|
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. )
- Inherited From:
- Source:
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
|
stopAutomaticHeartbeat()
- Inherited From:
- Source:
userConfigV2ChangeName(session_id, user_config_id, new_name, on_success, on_failure)
Preconditions: Initialized session.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
session_id |
string
|
|
user_config_id |
number
|
|
new_name |
string
|
|
on_success |
function
|
|
on_failure |
function
|
userConfigV2Delete(config_id, on_success, on_failure)
Preconditions: Initialized session.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
config_id |
number
|
|
on_success |
function
|
|
on_failure |
function
|
userConfigV2List(on_success, on_failure)
Preconditions: Initialized session.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
on_success |
function
|
|
on_failure |
function
|
userConfigV2Load(config_id, on_success, on_failure, on_coc)
Preconditions: Initialized session.
The callback on_coc is optional. If provided, it will be called independently of on_success and on_failure. I.e. if there is coc and the load was successful, both on_success and on_coc will be called.
- Inherited From:
- Source:
Parameters:
Name | Type | Description |
---|---|---|
config_id |
number
|
|
on_success |
function
|
|
on_failure |
function
|
|
on_coc |
function
|
(optional) |
userConfigV2Save(config_id, config_description, user_config_aux, config_storage_aux, on_success, on_failure)
Preconditions: Initialized session.
- Inherited From:
- Source:
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
|
userConfigV2SaveAs(config_name, config_description, user_config_aux, config_storage_aux, on_success, on_failure)
Preconditions: Initialized session.
- Inherited From:
- Source:
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
|