DCOffersList

DCOffersList

DCOffersList is a base class which is extended by all lightning web components .

DCOffersList methods
1. getSDKInstance - Method to get digital commerce SDK instance.
2. fetchOffers - Method to get all the offers.
3. scrollDown - Method to enable smmoth scroll ater getting offers.
4. updateOSData - Method to update OS data.
5. activateGrid - Method to switch to grid view.
6. activateList - Method to switch to list view.
7. loadMore - Method to support pagination to get next set of records.
Features
1. Render the offerList.
2. Allow switching between listView and gridView.

Constructor

new DCOffersList()

Properties:
Name Type Description
pageSize String page size for each call to get offers.
catalogCode String current catalog code.
Example
Sample Usage -

 Include the component in your template by adding <c-dc-offers-list> custom tag

 <c-dc-offers-list page-size=3 catalog-code={catalogCode}></c-dc-offers-list>


 KEY INFO -
 events fired : vlocity-dc-router

               | Event Name                       | Description                                |
               |----------------------------------|--------------------------------------------|
               | vlocity-dc-router                | Event triggered when routing to addons     |

 Events registered :

    | Event Name                     | Event source component          | Callback Function      | Description                                |
    |--------------------------------|---------------------------------|------------------------|--------------------------------------------|
    | vlocity-dc-offer-selected      | c-dc-offer-grid-view            | getOfferDetails()      | Event triggered on selecting an offer      |
    |                                | c-dc-offer-list-view            |                        |                                            |
    | vlocity-dc-filter-list-updated | c-dc-filter                     | refreshOfferList()     | Event triggered on change of filters       |

 Dependency - c-dc-offers-list is a container component which contains offer list view and grid view.

Sample with slots -

<c-dc-offers-list>
   <span slot="{slot_name}">
     Custom HTML elements goes here
   </span>
</c-dc-offers-list>

List of available slots -

| Slot names                      | Dynamic     | Description                  | Impact               |
|---------------------------------|-------------|------------------------------|----------------------|
| dc-offer-list-switch-wrapper    | -           | Wrapper for template         | Replaces DOM         |

Extends

Methods

(static) activateGrid()

Method to switch to grid view.

(static) activateList()

Method to switch to list view.

(async, static) fetchOffers(catalogCode)

Method to get all the offers.
Parameters:
Name Type Description
catalogCode string : Current Catalog code

(static) fetchOffersGetInput(catalogCode)

Method to get fetchOffers input object
Parameters:
Name Type Description
catalogCode string : Current Catalog code

(static) fetchOffersHandleFailure(error)

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

(static) fetchOffersPostHook(response)

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

(static) fetchOffersPreHook(input)

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

(static) fetchOffersPreSDKCalls()

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

(static) fetchOffersProcessResponse(response)

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

(static) fetchOffersSDKCall(input)

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

(static) getOfferDetails(evt)

This function is event handler and it is triggered when user clicks on offer.
It fires vlocity-dc-router events.
Parameters:
Name Type Description
evt Object DOM Event

(static) getSDKInstance()

Method to get digital commerce SDK instance.

(static) getTranslationLabels()

Method to get digital commerce translations.

(static) loadMore()

Method to support pagination to get next set of records.

(static) scrollDown()

Method to enable smmoth scroll ater getting offers.

(static) updateOSData()

Method to update OS data.