(
eventName: string,
{
action,
columns,
column,
row,
feedName,
ranking,
count,
clickedHighlight,
highlightIds,
feedMeta,
position,
origin,
}: FeedHighlightsLogEventOptions,
)
| 225 | } |
| 226 | |
| 227 | export function feedHighlightsLogEvent( |
| 228 | eventName: string, |
| 229 | { |
| 230 | action, |
| 231 | columns, |
| 232 | column, |
| 233 | row, |
| 234 | feedName, |
| 235 | ranking, |
| 236 | count, |
| 237 | clickedHighlight, |
| 238 | highlightIds, |
| 239 | feedMeta, |
| 240 | position, |
| 241 | origin, |
| 242 | }: FeedHighlightsLogEventOptions, |
| 243 | ): FeedItemLogEvent { |
| 244 | const clicked = clickedHighlight |
| 245 | ? { |
| 246 | title: clickedHighlight.headline, |
| 247 | url: clickedHighlight.post.commentsPermalink, |
| 248 | postId: clickedHighlight.post.id, |
| 249 | } |
| 250 | : undefined; |
| 251 | |
| 252 | return { |
| 253 | event_name: eventName, |
| 254 | feed_grid_columns: columns, |
| 255 | feed_item_grid_column: column, |
| 256 | feed_item_grid_row: row, |
| 257 | feed_item_meta: feedMeta ?? undefined, |
| 258 | feed_item_target_url: clicked?.url, |
| 259 | feed_item_title: clicked?.title, |
| 260 | target_type: TargetType.HighlightsCard, |
| 261 | extra: JSON.stringify({ |
| 262 | ...feedLogExtra(feedName, ranking, undefined, origin).extra, |
| 263 | ...(action ? { action } : {}), |
| 264 | ...(typeof count === 'number' ? { count } : {}), |
| 265 | ...(typeof position === 'number' ? { position } : {}), |
| 266 | ...(highlightIds?.length ? { highlight_ids: highlightIds } : {}), |
| 267 | ...(clickedHighlight |
| 268 | ? { clicked_highlight_id: clickedHighlight.id } |
| 269 | : {}), |
| 270 | ...(clicked ? { post_id: clicked.postId } : {}), |
| 271 | }), |
| 272 | }; |
| 273 | } |
| 274 | |
| 275 | export interface GetDefaultFeedProps { |
| 276 | hasFiltered?: boolean; |
no test coverage detected