Function: hydrateAds()
hydrateAds<
T>(ads,fetcher,matcher,identity,options?):Promise<HydratedAds<T>>
Defined in: hydration/hydrateAds.ts:39
Enriches ads already fetched, as by getRawAds, with their products:
the sponsored products and the Stories' products, in one fetcher call.
Both come with the same advertisement (event URLs and parameters) and,
when found, product. Sponsored products the fetcher doesn't find go to
failed, as in getHydratedAds. Stories are all kept, in their order,
each under story as the ad server sent it: those not found (link
Stories included) come without product.
Calls the fetcher only when there is a product to find. A fetcher
failure rejects, and so does the signal aborting, even when the fetcher
ignores it: the caller decides what to show without the products, for
example the ads as getRawAds returned them.
Type Parameters
T
T extends object
Parameters
ads
Ads to hydrate, as getRawAds returns them.
fetcher
Function to fetch product details from given offers.
matcher
Function to match products with offers.
identity
Identity passed to the fetcher, as in the ad request.
options?
Request options for the fetcher, such as a signal to cancel it.
Returns
Promise<HydratedAds<T>>
The ads with their products.