(
eventName: string,
{
action,
columns,
column,
row,
feedName,
ranking,
count,
clickedHighlight,
clickedPost,
highlightIds,
postIds,
feedMeta,
position,
origin,
}: FeedHighlightsLogEventOptions,
)
| 205 | } |
| 206 | |
| 207 | export function feedHighlightsLogEvent( |
| 208 | eventName: string, |
| 209 | { |
| 210 | action, |
| 211 | columns, |
| 212 | column, |
| 213 | row, |
| 214 | feedName, |
| 215 | ranking, |
| 216 | count, |
| 217 | clickedHighlight, |
| 218 | clickedPost, |
| 219 | highlightIds, |
| 220 | postIds, |
| 221 | feedMeta, |
| 222 | position, |
| 223 | origin, |
| 224 | }: FeedHighlightsLogEventOptions, |
| 225 | ): FeedItemLogEvent { |
| 226 | const clicked = clickedHighlight |
| 227 | ? { |
| 228 | title: clickedHighlight.headline, |
| 229 | url: clickedHighlight.post.commentsPermalink, |
| 230 | postId: clickedHighlight.post.id, |
| 231 | } |
| 232 | : clickedPost && { |
| 233 | title: clickedPost.title, |
| 234 | url: clickedPost.permalink, |
| 235 | postId: clickedPost.id, |
| 236 | }; |
| 237 | |
| 238 | return { |
| 239 | event_name: eventName, |
| 240 | feed_grid_columns: columns, |
| 241 | feed_item_grid_column: column, |
| 242 | feed_item_grid_row: row, |
| 243 | feed_item_meta: feedMeta ?? undefined, |
| 244 | feed_item_target_url: clicked?.url, |
| 245 | feed_item_title: clicked?.title, |
| 246 | target_type: TargetType.HighlightsCard, |
| 247 | extra: JSON.stringify({ |
| 248 | ...feedLogExtra(feedName, ranking, undefined, origin).extra, |
| 249 | ...(action ? { action } : {}), |
| 250 | ...(typeof count === 'number' ? { count } : {}), |
| 251 | ...(typeof position === 'number' ? { position } : {}), |
| 252 | ...(highlightIds?.length ? { highlight_ids: highlightIds } : {}), |
| 253 | ...(postIds?.length ? { post_ids: postIds } : {}), |
| 254 | ...(clickedHighlight |
| 255 | ? { clicked_highlight_id: clickedHighlight.id } |
| 256 | : {}), |
| 257 | ...(clicked ? { post_id: clicked.postId } : {}), |
| 258 | }), |
| 259 | }; |
| 260 | } |
| 261 | |
| 262 | export interface GetDefaultFeedProps { |
| 263 | hasFiltered?: boolean; |
no test coverage detected