Commerce Cloud also provides a mechanism for programmatically determining the response filter key to pass in a REST call, allowing you to avoid hard coding it into the widget itself. The programmatic mechanism for determining which response filter key to pass in a REST request has several parts:
A context object that is instantiated in the widget’s JavaScript file.
A filter map that is defined in an application-level JavaScript file.
The
CCStoreConfiguation
library.
The context object contains the data required for locating the correct response filter key in the filter map. The widget instantiates the context object with the necessary data and then passes it to the CCStoreConfiguration
library’s getFilterToUse()
method, which locates the correct response filter key in the filter map and returns it to the widget.