import React from 'react' import { useStore } from 'App/mstore' import { observer } from 'mobx-react-lite' import WebPlayer from 'App/components/Session/WebPlayer' import { connect } from 'react-redux' import { setCustomSession } from 'App/duck/sessions' import { fetchInsights } from 'Duck/sessions'; function ClickMapCard({ setCustomSession, visitedEvents, insights, fetchInsights, insightsFilters, host, }: any) { const { metricStore, dashboardStore } = useStore(); const onMarkerClick = (s: string, innerText: string) => { metricStore.changeClickMapSearch(s, innerText) } React.useEffect(() => { if (metricStore.instance.data.mobsUrl) { setCustomSession(metricStore.instance.data) } }, [metricStore.instance]) React.useEffect(() => { if (visitedEvents.length) { const urlOptions = visitedEvents.map(({ url, host }: any) => ({ label: url, value: url, host })) const url = insightsFilters.url ? insightsFilters.url : host + urlOptions[0].value; const rangeValue = dashboardStore.drillDownPeriod.rangeValue const startDate = dashboardStore.drillDownPeriod.start const endDate = dashboardStore.drillDownPeriod.end fetchInsights({ ...insightsFilters, url, startDate, endDate, rangeValue, clickRage: metricStore.clickMapFilter }) } }, [visitedEvents, metricStore.clickMapFilter]) if (!metricStore.instance.data.mobsUrl || insights.size === 0) { return (