VlocityDCOfferAddons

VlocityDCOfferAddons

vlocity-dc-offer-addons is a component that contains offer addons.

Constructor

new VlocityDCOfferAddons()

Properties:
Name Type Description
isRecurring Boolean price type is recurring or one time.
currentPlanGroup OfferProductGroupObject current plan group
nextplanBtn Boolean boolean value to show and hide next plan button
loading Boolean boolean value to show and hide loader
productGroups Array.<OfferProductGroupObject> array of offer group object.
errorMessage String error message
showToast Boolean boolean value to show and hide toast message
cartContextKey String unique cart context key
Example
Sample Usage -

Include the component in your template simply by adding vlocity-dc-offer-addons custom tag and passing offerCode and catalogCode as attributes.
<vlocity-dc-offer-addons offerCode="${"iPhoneX"}" catalogCode="${"Phones"}" isRecurring=false> </vlocity-dc-offer-addons>

Note : If catalogCode and offerCode passed via URL, then no need to pass via attributes.
--------------------------------------------------------------------------------------------------------------------------------------
 KEY INFO -

 events fired : vlocity-dc-add-to-cart, vlocity-dc-route-navigation and vlocity-dc-refresh-offer-groups

 events registered :

 | Event Name                          | Event source component             | Callback Function      | Description                                                        |
 |-------------------------------------|------------------------------------|------------------------|--------------------------------------------------------------------|
 | vlocity-dc-save-child-offers        | vlocity-dc-offer-group-selection   | saveChildOffer()       | Event triggered to save Configured offer                           |
 | vlocity-dc-event-source-basket      | vlocity-dc-edit-modal              | setEventSource()       | Event triggered to set event source                                |
 | vlocity-dc-promo-list-updated       | vlocity-dc-promotion-list          | setPromoList()         |Event triggered when list of change of available promotion list     |


 Dependency - vlocity-dc-offer-addons is an independenet component that has no dependency on parent component.

               | Parent Component | Expected Child Component      |
               |------------------|-------------------------------|
               | none             | vlocity-dc-offer-group        |

 Sample with slots -

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

List of available slots -

| Slot names                    | Dynamic     | Description                  | Impact               |
|-------------------------------|-------------|------------------------------|----------------------|
| dc-offer-addons-wrapper       | -           | Wrapper for template         | Replaces DOM         |
| dc-addons-next-btn            | -           | Button container             | Replaces DOM         |

Extends

  • LitElement

Members

(static, readonly) properties

Properties that will be available in the binding system
Properties:
Name Type Description
isRecurring Boolean price type is recurring or one time.
currentPlanGroup OfferProductGroupObject current plan group
nextplanBtn Boolean boolean value to show and hide next plan button
loading Boolean boolean value to show and hide loader
productGroups Array.<OfferProductGroupObject> array of offer group object.
errorMessage String error message
showToast Boolean boolean value to show and hide toast message
cartContextKey String unique cart context key

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.

(static) connectedCallback()

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

(async, static) getOfferDetails()

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

(static) getOfferDetailsGetInput(catalogCode, childOffer)

This function is used to get getOfferDetails input object
Parameters:
Name Type Description
catalogCode object An object containing current catalog.
childOffer OfferObject offer to be validated.

(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(childOffer)

This function is used to execute any action before getOfferDetails SDK call is made.
Parameters:
Name Type Description
childOffer OfferObject offer to be validated.

(static) getOfferDetailsProcessResponse(response)

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

(static) getOfferDetailsSDKCall(invokeActionInput)

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

(static) nextPlan()

Invoked on click of next plan button.

(static) refreshProductGroups()

This function refreshes offer groups by firing vlocity-dc-refresh-offer-groups event.

(static) routeToShoppingCart()

Invoked on click of Add To Basket button.

(async, static) saveChildOffer(childOffer)

callback function for event vlocity-dc-save-child-offers.
Parameters:
Name Type Description
childOffer OfferObject offer to be validated.

(static) saveChildOfferGetInput(childOffer)

This function is used to get saveChildOffer input object
Parameters:
Name Type Description
childOffer OfferObject offer to be validated.

(static) saveChildOfferHandleFailure(error, childOffer)

This function is used to handle saveChildOffer failure
Parameters:
Name Type Description
error object Error Object from SDK call.
childOffer OfferObject offer to be validated.

(static) saveChildOfferPostHook(response)

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

(static) saveChildOfferPreHook(input)

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

(static) saveChildOfferPreSDKCalls(childOffer)

This function is used to execute any action before saveChildOffer SDK call is made.
Parameters:
Name Type Description
childOffer OfferObject offer to be validated.

(static) saveChildOfferProcessResponse(response)

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

(static) saveChildOfferSDKCall(input)

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

(static) setAttributeValues()

This function set Offer code and catalog code value.

(static) setSelectedProduct(data)

callback function for event vlocity-dc-selected-offer.
Parameters:
Name Type Description
data ConfiguredOfferObject configured offer.