Default constructor. Alwyas use getInstance() instead of default contructor to get an instance of the SDK.
DigitalCommerceSDK Config to initialize this SDK.
This is the account Id once user login in.
Identifier of cart if it exists. This will be populated after addToCart() is called.
This is addToBasket response.
The UserContext used for this SDK.
The offer code of the offer that is being configured at the moment.
The datasource connection used by this SDK.
This is the filtered list containing promotions and products.
Flag to indicate whether user already loggedIn
Map of offers that has been selected for configuration. This map stores the state of the configured offers.
This is the offers list containing promotions and products.
parsed cart item response.
loggedIn user email
Private singleton instance of this SDK. There should always be only 1 instance.
Customers can override their custom anonymous URL using apiURL
Customers can set the anonymous URL auth token using authToken
getter method for namespace. Provides the salesforce org namespace
setter method for namespace. Set custom namespace
Customers can override secureServerRequestCredentials value using secureServerRequestCredentials()
Customers can override their custom checkout node server URL using secureServerUrl()
Cache the selected offer in memory so that user can retrieve it at later point of time for configuration and add to cart. The selected offer JSON and its offer code will be cached by SDK.
Save an offer to the Basket.
addToCart SDK call posthook method.
Convert asset to the basket.
assetToBasket SDK call posthook method.
Authenticate the user.
authenticateUser SDK call posthook method.
Checkout the cart items that user has configured in the cart.
API PATH: /v3/carts
Create a default CheckoutCartInput object.
checkoutCart SDK call posthook method.
Create a default AddToCartInput object.
Create a default AssetToBasketInput object.
Create a default AuthenticateUserInput object.
Create a default GetAWSTokenInput object.
Create a default GetItemsInCartInput object.
Create a default GetOfferInput object.
Create a default createGetOffersInput object.
Create a default SaveCartInput object.
Create a default signOutUserPostHook object.
Create a default SubmitOrderInput object.
Create a default UpdateBillingDetailsInput object.
Create a default UpdateItemsInCartInput object.
Create a default ValidateOfferInput object.
ValidateOfferInput default ValidateOfferInput.
Delete a selected offer from SDK cache. If the offer exists, it will be deleted from SDK cache. Otherwise, it will do nothing.
to be deleted.
fetch AWS authorisation token. developer can call this function to fetch AWS authorisation token.
a Promise with access_token.
fetchAWSAuthToken SDK call posthook method.
Find the selected offer array index for the given offer code.
to find the selected offer.
the index of the offer if existed. Otherwise, returns -1.
Fires an event to listeners.
Name of the event to fire.
Name of the event to fire.
Payload of the event to fire.
Get all the selected offer from SDK cache.
Promise with all selected offerConfigurations.
Returns a filtered list of products and promotions.
Get the basket details.
getItemsInCart SDK call posthook method.
Returns offer and its details.
getOffer SDK call posthook method.
Returns a list of offers.
getOffers SDK call posthook method.
Returns promotions for all products or for an associated to product.
Find the selected offer array index for the given offer code.
to find the selected offer.
the index of the offer if existed. Otherwise, returns -1.
Returns the offer for given code that are being configured. Undefined if offer not exists.
offer code of the selected offer in memory to be retrieved.
boolean value to return parsed response or original response
Returns a API call response.
Invoke an action returning from previous API call.
Returns a API call response.
Method to parse cart response
Method to parse offer response
Method to parse offers response
Registers a callback for an event
Name of the event to listen for.
Contains callback function.
Saves the cart by creating an order for the given basket key.
saveCart SDK call posthook method.
SignOut the user from secure server.
SignOut user SDK call posthook method.
Create and submit the order as a final step of the checkout process.
saveCart SDK call posthook method.
Unregisters a callback for an event
Name of the event to unregister from.
Contains callback function.
Update user account biiling and shipping details.
updateBillingDetails SDK call posthook method.
Contains the list of offerConfigurations to be updated in cart.
updateItemsInCart SDK call posthook method.
Validate an offer. After configuring the offer by setting attributes' values, adding/removing child product, updating quantity, developer can call this function to validate the offer.
a Promise with validated offer JSON.
validateOffer SDK call posthook method.
Returns the version number of SDK.
Returns SDK version number as string
Create a DigitalCommerceSDKConfig object that consists of a UserContext and a DataSourceService for anonymous user.
Configuration object to instantiate SDK.
Create a DigitalCommerceSDKConfig object that consists of a UserContext and a DataSourceService for login user.
optional
Configuration object to instantiate SDK.
Adds all the enumerable string keyed function properties of a source
object to the sdk prototype.
.extend
should only be used to add new methods and it won't override the existing methods.
Note: If the property already exists, it will be not be added.
Custom functions which are being extended should have proper namespaces to avoid issues during upgrades. When Vlocity releases new changes it won't impact if unique namespaces are used.
Example: myCompanyOrFeatureMethodName
The object of functions
Get a singleton instance of this SDK.
SDK instance.
Adds all the enumerable string keyed function properties of a source object to the sdk prototype.
.override
method should only be used to override the existing methods and should only be used in rare cases.
Overriding the existing or default methods may cause unintended consequences and may also impact during upgrades.
Please be cautious while using this
The object of functions
Generated using TypeDoc
Digital Commerce Facade to interact with Vlocity Digital Commercee functionality.
The Digital Commerce SDK is a JavaScript library that abstracts and simplifies the use of Digital Commerce API REST calls.
The SDK provides error checking and validates parameters before submitting them to the Digital Commerce APIs, ensuring that calls to the APIs are well formatted and complete. In some cases, the SDK invokes more than one API to complete a request.
Using the SDK ensures that errors are detected before API calls are made, ensuring that Vlocity data structure rules are enforced and that data is not written incorrectly to the Vlocity cart or to the product database.Using the SDK reduces UI development efforts by consolidating common application and business logic to use the Digital Commerce APIs.
SDK can be shared by different applicationsuser interfaces. SDK, like any Vlocity SDK, can be extended and overrided to customized implementations.
109.0.0