{ "version": 3, "sources": ["../../../../frontend/components/components/leads/LeadResponseNotice.jsx"], "sourcesContent": ["import React, { useState, useEffect } from 'react';\nimport styles from '../../../stylesheets/theme/bootstrap_scope.module.scss';\nimport ConditionalWrapper from \"../../utils/ConditionalWrapper\";\nimport {isMobile, isTablet } from \"react-device-detect\";\nimport ReportThumbnail from \"./ReportThumbnail\";\nimport {autoDownload, parameterize} from \"../../../javascripts/utils\";\n\n// import thumb from '../../../images/reports/thumbnail_bg.png';\n// import triple_thumb from '../../../images/reports/triple_thumbnail_bg.webp';\n\n/** This components accepts an array of reports, containing title, formatted date and url to the pdf. **/\n\nfunction LeadResponseNotice({reports, theme_enabled, user_confirmed, peer_analyst}) {\n\n const backgroundStyle = {\n background: \"url('https://images.peerspot.com/image/upload/q_auto,f_auto/v1654171079/home-page-hero-background_1.jpg') no-repeat center top\",\n backgroundSize: 'cover'\n }\n\n const peerAnalystStyle = {\n maxHeight: (isMobile || isTablet) ? 'auto' : '230px', overflow: 'hidden'\n }\n\n const titleSizingClass = () => {\n if(reports.some((report) => report.title.length >= 80)) return styles['report-title-sm'];\n if(reports.some((report) => report.title.length > 50 && report.title.length < 80)) return styles['report-title-md'];\n }\n\n const BANNER_WIDTH = theme_enabled ? {} : { maxWidth: 'min(100%, 980px)'}\n const REPORT_COUNT = reports.length;\n const MAX_REPORT_THUMBS = 3;\n const TITLE_SIZE_CLASS = titleSizingClass();\n\n useEffect(() => {\n if(user_confirmed && peer_analyst) {\n reports.forEach( (report) => { autoDownload(report.url, `${parameterize(report.title)}.pdf`) });\n }\n }, []);\n\n // These are now preloaded on the page...\n // // preload thumb image\n // const thumbImages = [thumb, triple_thumb];\n // for (const image of thumbImages) {\n // const imageElement = new Image();\n // imageElement.src = image;\n // }\n\n const renderResponse = () => {\n if(user_confirmed) {\n return (\n <>\n {renderHeader(`Thank you for downloading the report${REPORT_COUNT > 1 ? ' bundle' : ''}!`)}\n {renderReportLinks()}\n >\n )\n } else {\n return (\n <>\n {renderHeader('Thank you!')}\n {renderSubHeader(`A link to your ${ REPORT_COUNT > 1 ? 'free research bundle' : 'report'} will be sent to your email shortly.`)}\n >\n )\n }\n }\n\n const renderHeader = (txt) => {\n return (\n