Type Definitions
This article lists types and data structures used in the Web Components library.
Types and data structures from the FactFinder REST API
These types are already documented in FactFinder and are not covered any further here. Consult your FactFinder documentation for details.
It is also advisable to familiarize yourself with those API terms and explore the REST API. This should help you greatly in finding your way around the FactFinder/Web Components ecosystem.
Explicitly defined data structures
The following are some examples of data types that are explicitly defined by the FactFinder REST API. You will find them in the definitions of responses and POST requests.
POST requests are used for search, navigation, suggest and tracking. Note that Web Components takes care of choosing the correct HTTP method.
SearchParams
NavigationParams
Filter
Result
PredictiveBasketResult
ClickEvent
Pseudo-types derived from the REST API
Pseudo-types are not explicitly defined by the REST API. The names defined here do not appear in the REST API documentation.
Typically, they are a collection of request parameters to GET requests. You can look up their contents in the definitions of the related endpoints. In the Web Components context these parameter lists are translated into the following pseudo-types:
CampaignPageParams
CampaignProductParams
CampaignShoppingCartParams
CompareParams
NavigationCategoryParams
PredictiveBasketParams
RecommendationParams
RecordsParams
SimilarParams
Another pseudo-type is:
FieldRoles
Its fields are not fixed. You configure them in your FactFinder UI.
Types and data structures defined by Web Components
Web Components introduces some types that only live within the Web Components library context. While some may contain data that is relevant to the REST API, others are entirely for operational purposes in the front-end.
Some examples:
SearchOptions
RequestOptions
Subscriber
CancellableSubscriber
RequestInfoSearch
Also, there are a few types that describe behavior:
Required
Optional
Definitions
Required fields or fields that are always present are marked with *.
Subscriber
A function that takes two parameters and does not return anything. It is intended to be used by data consumers.
The first parameter is of type a.
The second parameter is of type b.
Example:
Subscriber CampaignsResult RequestInfoCampaignPage
awill beCampaignsResultbwill beRequestInfoCampaignPage
CancellableSubscriber
A function that takes a parameter of type a and returns a Boolean. It can interrupt the pipeline process when false is returned.
Example:
CancellableSubscriber RequestInfoSearch
awill beRequestInfoSearch
Transformer
A function that takes two parameters and returns a value of the same type as the first parameter. It is used to modify response data before it is dispatched to consumers.
The first parameter is of type a.
The second parameter is of type b.
Return type is a.
Example:
Transformer PredictiveBasketResult RequestInfoPredictiveBasket
awill bePredictiveBasketResultbwill beRequestInfoPredictiveBasketreturntype will bePredictiveBasketResult
RequestOptions
All fields are optional and may be omitted.
SearchOptions
All fields are optional and may be omitted.
NavigationOptions
All fields are optional and may be omitted.
Config
ConfigFFParams
These parameters are sent to FactFinder with all requests that accept them.
All fields may be set to undefined. Doing so will unset the value currently stored in the config state.
ConfigAppConfig
These parameters control the behavior of the Web Components application.
categoryPage is an array of FactFinder REST API Filter objects.
RequestInfo types (search-like requests)
RequestInfoCampaignPage
RequestInfoCampaignProduct
RequestInfoCampaignShoppingCart
RequestInfoCompare
RequestInfoNavigation
RequestInfoNavigationCategory
RequestInfoPredictiveBasket
RequestInfoRecommendation
RequestInfoRecords
RequestInfoSearch
RequestInfoSimilar
RequestInfoSuggest
RequestInfo types (tracking requests)
RequestInfoTrackCartOrCheckout
RequestInfoTrackClick
RequestInfoTrackLandingPageClick
RequestInfoTrackLogin
RequestInfoTrackPredBasketClick
RequestInfoTrackRecommendationClick
Miscellaneous types
ApiKey
An ordinary string.
SessionID
An ordinary string.
SubscriberID
An ordinary string.
NonEmptyArray
An array that must have at least one element of type a.
Example:
NonEmptyArray ClickEvent
All elements must be of type
ClickEvent.
Required and Optional
These two type modifiers appear in parameter lists. If a parameter is marked as Required, it must be provided or an error will occur. A parameter marked as Optional may be omitted.
For example, the signature of the request.search function:
searchParamsmust always be passed.searchOptionscan be omitted.
Origin
The Origin type can by anything. It is used by request invokers to provide information about where the request is coming from to later steps of the request/response pipeline.
If a request is invoked by a Web Components element, the origin will be a reference to the DOM-element that invoked the request. If you invoke requests manually, it will be absent by default, but you are free to set it to whatever value you require.
The origin is helpful to implement behavior depending on where a request originated.
Last updated
Was this helpful?