Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test: () => {
const analyticsStream = jest.fn();
const ArticleTopicsWithTracking = withTrackingContext(ArticleTopics, {
trackingObjectName: "Article"
});
const testInstance = TestRenderer.create(
{}}
topics={topicData}
/>
);
const [link] = testInstance.root.findAll(node => node.type === Link);
link.props.onPress("event");
expect(analyticsStream.mock.calls).toMatchSnapshot();
export default Component =>
withTrackEvents(Component, {
analyticsEvents: [
{
actionName: "Pressed",
eventName: "onSaveToMyArticles",
getAttrs: ({ articleId, articleHeadline }) => ({
articleId,
articleHeadline
}),
trackingName: "ArticleSaveToMyArticles"
},
{
actionName: "Pressed",
eventName: "onShareEmail",
getAttrs: ({ articleId, articleHeadline }) => ({
articleId,
articleHeadline
export default Component =>
withTrackEvents(Component, {
analyticsEvents: [
{
actionName: "Pressed",
eventName: "onPress",
getAttrs: ({
tile: {
headline: tileHeadline,
article: { headline, id, shortHeadline, url } = {}
} = {
article: {}
},
tileName
}) => ({
articleHeadline: tileHeadline || shortHeadline || headline,
articleId: id,
articleUrl: url,
accessibilityTraits="button"
style={[styles.text, fontSizeStyle, lineHeightStyle]}
>
{name}
)}
);
};
ArticleTopic.propTypes = topicPropTypes;
export default withTrackEvents(ArticleTopic, {
analyticsEvents: [
{
actionName: "Pressed",
eventName: "onPress",
getAttrs: ({ name, slug }) => ({
name,
slug
}),
trackingName: "TopicLink"
}
]
});
@{handle}
);
};
TwitterLink.propTypes = {
handle: AuthorHead.propTypes.twitter,
onPress: PropTypes.func.isRequired
};
TwitterLink.defaultProps = {
handle: AuthorHead.defaultProps.twitter
};
export default withTrackEvents(AuthorHead, {
analyticsEvents: [
{
eventName: "onTwitterLinkPress",
actionName: "Pressed",
trackingName: "TwitterLink",
getAttrs: (props, eventArgs) => ({
twitterHandle: props.twitter,
url: eventArgs[1] && eventArgs[1].url
})
}
]
});
export default Component =>
withTrackEvents(Component, {
analyticsEvents: [
{
actionName: "Pressed",
eventName: "onTwitterLinkPress",
getAttrs: (props, eventArgs) => ({
twitterHandle: props.twitter,
url: eventArgs[1] && eventArgs[1].url
}),
trackingName: "TwitterLink"
}
]
});
export default Component =>
withTrackEvents(Component, {
analyticsEvents: [
{
actionName: "Pressed",
eventName: "onSave",
getAttrs: ({ articleId, savedStatus }) => ({
articleId,
savedStatus: !savedStatus
}),
trackingName: "ArticleSaveToMyArticles"
}
]
});
export default Component =>
withTrackEvents(Component, {
analyticsEvents: [
{
actionName: "Pressed",
eventName: "onPress",
getAttrs: ({ linkType, url }) => ({
linkType,
linkUrl: url
}),
trackingName: "ArticleLink"
}
]
});
export default Component =>
withTrackEvents(Component, {
analyticsEvents: [
{
actionName: "Pressed",
eventName: "onPress",
getAttrs: ({ id, title, url }) => ({
puzzleId: id,
puzzleTitle: title,
puzzleUrl: url,
tileName: "Puzzle"
}),
trackingName: "Tile"
}
]
});
export default Component =>
withTrackEvents(Component, {
analyticsEvents: [
{
actionName: "Pressed",
eventName: "onPress",
getAttrs: ({ article: { headline, id }, index, length }) => ({
articleHeadline: headline,
articleId: id,
scrollDepth: {
itemNumber: index + 1,
total: length
}
})
}
]
});