UNPKG

@applicaster/zapp-react-native-utils

Version:

Applicaster Zapp React Native utilities package

36 lines (29 loc) 706 B
import { log_debug } from "../logger"; import { postAnalyticEvent } from "../manager"; import { replaceAnalyticsPropsNils, OfflineItemState, downloadsEventForState, } from "./helper"; export const sendDownloadsEvent = ({ item, state, }: { item: ZappEntry; state: OfflineItemState; }) => { const analyticsProps = replaceAnalyticsPropsNils({ id: item?.id, title: item?.title, contentType: item?.content?.type, }); const eventName = downloadsEventForState(state); if (!eventName) { // Ignored event state return; } postAnalyticEvent(eventName, analyticsProps); log_debug(`sendOnNavItemClickEvent: send event: ${eventName}`, { analyticsProps, }); };