import React from 'react'; import { connect } from 'react-redux'; import { withRouter } from 'react-router-dom'; import { sessions as sessionsRoute, assist as assistRoute, liveSession as liveSessionRoute, withSiteId } from 'App/routes'; import { Icon, BackLink, Link } from 'UI'; import { toggleFavorite, setSessionPath } from 'Duck/sessions'; import cn from 'classnames'; import { connectPlayer, toggleEvents } from 'Player'; import SessionMetaList from 'Shared/SessionItem/SessionMetaList'; import UserCard from './EventsBlock/UserCard'; import Tabs from 'Components/Session/Tabs'; import stl from './playerBlockHeader.module.css'; import AssistActions from '../Assist/components/AssistActions'; import AssistTabs from '../Assist/components/AssistTabs'; const SESSIONS_ROUTE = sessionsRoute(); const ASSIST_ROUTE = assistRoute(); @connectPlayer( (state) => ({ width: state.width, height: state.height, live: state.live, loading: state.cssLoading || state.messagesLoading, showEvents: state.showEvents, }), { toggleEvents } ) @connect( (state, props) => { const isAssist = window.location.pathname.includes('/assist/'); const session = state.getIn(['sessions', 'current']); return { isAssist, session, sessionPath: state.getIn(['sessions', 'sessionPath']), loading: state.getIn(['sessions', 'toggleFavoriteRequest', 'loading']), disabled: state.getIn(['components', 'targetDefiner', 'inspectorMode']) || props.loading, local: state.getIn(['sessions', 'timezone']), funnelRef: state.getIn(['funnels', 'navRef']), siteId: state.getIn(['site', 'siteId']), metaList: state.getIn(['customFields', 'list']).map((i) => i.key), closedLive: !!state.getIn(['sessions', 'errors']) || (isAssist && !session.live), }; }, { toggleFavorite, setSessionPath, } ) @withRouter export default class PlayerBlockHeader extends React.PureComponent { state = { hideBack: false, }; componentDidMount() { const { location } = this.props; const queryParams = new URLSearchParams(location.search); this.setState({ hideBack: queryParams.has('iframe') && queryParams.get('iframe') === 'true' }); } getDimension = (width, height) => { return width && height ? (