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

Function resolveAdFetchOptions

packages/shared/src/lib/ads.ts:65–92  ·  view source on GitHub ↗
({
  placement = AdPlacement.Feed,
  active,
  boostsEnabled = false,
}: {
  placement?: AdPlacement;
  active?: boolean;
  boostsEnabled?: boolean;
})

Source from the content-addressed store, hash-verified

63};
64
65export const resolveAdFetchOptions = ({
66 placement = AdPlacement.Feed,
67 active,
68 boostsEnabled = false,
69}: {
70 placement?: AdPlacement;
71 active?: boolean;
72 boostsEnabled?: boolean;
73}): FetchAdByPlacementOptions => {
74 switch (placement) {
75 case AdPlacement.PostComment:
76 return { placement };
77 case AdPlacement.SquadDirectory:
78 return {
79 placement,
80 allowSquadBoost: true,
81 };
82 case AdPlacement.PostSidebar:
83 case AdPlacement.Feed:
84 default:
85 return {
86 placement,
87 active,
88 allowPostBoost: boostsEnabled,
89 allowSquadBoost: boostsEnabled,
90 };
91 }
92};
93
94export const fetchAdByPlacement = async ({
95 placement,

Callers 3

ads.spec.tsFile · 0.90
useAdQueryFunction · 0.90
useFetchAdFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected