MCPcopy Create free account
hub / github.com/dailydotdev/apps / useFetchAd

Function useFetchAd

packages/shared/src/features/monetization/useFetchAd.ts:19–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19export const useFetchAd = (): UseFetchAds => {
20 const boostsEnabled = useFeature(featurePostBoostAds);
21 const consent = useAdMacroContext(true) ?? undefined;
22
23 const fetchAdQuery: UseFetchAds['fetchAd'] = useCallback(
24 ({ active, placement = AdPlacement.Feed }) => {
25 return fetchAdByPlacement(
26 resolveAdFetchOptions({
27 placement,
28 active,
29 boostsEnabled,
30 consent,
31 }),
32 );
33 },
34 [boostsEnabled, consent],
35 );
36
37 return {
38 fetchAd: fetchAdQuery,
39 };
40};

Callers 2

useFeedFunction · 0.90
useAutoRotatingAdsFunction · 0.90

Calls 4

useFeatureFunction · 0.90
useAdMacroContextFunction · 0.90
fetchAdByPlacementFunction · 0.90
resolveAdFetchOptionsFunction · 0.90

Tested by

no test coverage detected