VlocityDCOfferConfig

VlocityDCOfferConfig

vlocity-dc-offer-config is a web component that is used to display and configure an offer.

Features
1.Display Offer
2.Configure Offer

Constructor

new VlocityDCOfferConfig()

Properties:
Name Type Description
productUrl String url for the offer.
Example
Sample Usage -

Include the component in your template simply by adding vlocity-dc-offer-config custom tag

<vlocity-dc-offer-config .productUrl="${this.getProductUrl(this.page)}"</vlocity-dc-offer-config>


| Attribute Name    | Type Expected                                                                   | Required |
|-------------------|---------------------------------------------------------------------------------|----------|
| productUrl        | It expects a url in string format                                               | required |

--------------------------------------------------------------------------------------------------------------------------------------
 KEY INFO -

 events fired :
               | Event Name                       | Description                                             |
               |----------------------------------|---------------------------------------------------------|
               | vlocity-dc-route-navigation      | Event triggered when routing to addons or cart page     |


 events registered :

               | Event Name                       | Event source component                                                                                             | Callback Function      |
               |----------------------------------|--------------------------------------------------------------------------------------------------------------------|------------------------|
               |                                  | Mutiple Event Sources:                                                                                             |                        |
               |                                  |      | Component Name                        | Description                                         |               |                        |
               | vlocity-dc-configure-offer       |      |---------------------------------------|-----------------------------------------------------|               | configureOffer()       |
               |                                  |      | vlocity-dc-offer-attribute-config     | Event triggered on selection of offer config        |               |                        |
               |                                  |      | vlocity-dc-offer-color-config         |                                                     |               |                        |
               |                                  |      | vlocity-dc-offer-input-config         |                                                     |               |                        |
               |                                  |                                              |                                                                     |                        |
               | vlocity-dc-color-selected        | vlocity-dc-offer-color-config                | Event triggered on color attribute selection                        | updateColorAttribute() |
               |                                  |                                              |                                                                     |                        |
               | vlocity-dc-promo-list-updated    | vlocity-dc-promotion-list                    | Event triggered when list of change of available promotion list     | setPromoList()         |



 Dependency - vlocity-dc-offer-config is an independent component and have no dependency on parent component.

               | Parent Component | Expected Children Components       |
               |------------------|------------------------------------|
               |                  | vlocity-dc-toast                   |
               |  none            | vlocity-dc-media-viewer            |
               |                  | vlocity-dc-offer-config-details    |
               |                  | vlocity-dc-offer-group-sections    |

Sample with slots -

<vlocity-dc-offer-config>
   <span slot="{slot_name}">
     Custom HTML elements goes here
   </span>
</vlocity-dc-offer-config>

List of available slots -

| Slot names               | Dynamic     | Description                 | Impact                |
|--------------------------|-------------|-----------------------------------------------------|
| dc-add-to-cart-btn       | -           | Wrapper for button          | Replaces button       |

Extends

  • LitElement

Members

(static, readonly) properties

Properties that will be available in the binding system
Properties:
Name Type Description
offer OfferObject offer object
loading Boolean boolean value to show and hide loader
showToast Boolean boolean value to show and hide toast messages.

Methods

(async, static) addToCart()

Adding offer bundle to cart using SDK function addToCart() with basketAction = "AddAfterConfig"

(static) addToCartGetInput()

This function is used to get addToCart input object

(static) addToCartHandleFailure(error)

This function is used to handle addToCart failure
Parameters:
Name Type Description
error object Error Object from SDK call.

(static) addToCartPostHook(response)

A custom function to be used by customers for customisation, any custom action after addToCart call is successfull can be written here
Parameters:
Name Type Description
response object SDK Response object.

(static) addToCartPreHook(input)

A custom function to be used by customers for customisation, any custom action prior to addToCart call can be written here
Parameters:
Name Type Description
input object Current Input Object.

(static) addToCartPreSDKCalls()

This function is used to execute any action before addToCart SDK call is made.

(static) addToCartProcessResponse(response)

This function is used to process addToCart response
Parameters:
Name Type Description
response object Response Object from SDK call.

(static) addToCartSDKCall(input)

This function is used to make SDK call for addToCart
Parameters:
Name Type Description
input object Current Input Object.

(async, static) configureOffer()

callback function for event vlocity-dc-configure-offer.

(static) configureOfferGetInput()

This function is used to get getOfferDetails input object

(static) configureOfferHandleFailure(error)

This function is used to handle configureOffer failure
Parameters:
Name Type Description
error object Error Object from SDK call.

(static) configureOfferPostHook(response)

A custom function to be used by customers for customisation, any custom action after configureOffer call is successfull can be written here
Parameters:
Name Type Description
response object SDK Response object.

(static) configureOfferPreHook(input)

A custom function to be used by customers for customisation, any custom action prior to configureOffer call can be written here
Parameters:
Name Type Description
input object Current Input Object.

(static) configureOfferPreSDKCalls()

This function is used to execute any action before configureOffer SDK call is made.

(static) configureOfferProcessResponse(response)

This function is used to process configureOffer response
Parameters:
Name Type Description
response object Response Object from SDK call.

(static) configureOfferSDKCall(input)

This function is used to make SDK call for configureOffer
Parameters:
Name Type Description
input object Current Input Object.

(static) connectedCallback()

Invoked when vlocity-dc-offer-config component is added to the document’s DOM.

(static) filterMediaResourceByColor(selectedColor)

This function filters media resources by color
Parameters:
Name Type Description
selectedColor string device color selected by user.

(async, static) getOfferDetails()

This function get Offer details by calling getOffer method of sdk.

(static) getOfferDetailsGetInput()

This function is used to get getOfferDetails input object

(static) getOfferDetailsHandleFailure(error)

This function is used to handle getOfferDetails failure
Parameters:
Name Type Description
error object Error Object from SDK call.

(static) getOfferDetailsPostHook(response)

A custom function to be used by customers for customisation, any custom action after getOfferDetails call is successfull can be written here
Parameters:
Name Type Description
response object SDK Response object.

(static) getOfferDetailsPreHook(input)

A custom function to be used by customers for customisation, any custom action prior to getOfferDetails call can be written here
Parameters:
Name Type Description
input object Current Input Object.

(static) getOfferDetailsPreSDKCalls()

This function is used to execute any action before getOfferDetails SDK call is made.

(static) getOfferDetailsProcessResponse(response)

This function is used to process getOfferDetails response
Parameters:
Name Type Description
response object Response Object from SDK call.

(static) getOfferDetailsSDKCall(input)

This function is used to make SDK call for getOfferDetails
Parameters:
Name Type Description
input object Current Input Object.

(static) routeToAddons()

Method for routing to addons.

(static) setAttributeValues(offerString)

This function get Offer code and catalog code value.
Parameters:
Name Type Description
offerString String string containing offer code, catalog code values.

(static) updateColorAttribute(result)

callback function for event vlocity-dc-color-selected.
Parameters:
Name Type Description
result ColorSelectedEventResultObject Result on color selected event fire.