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,CAAC9B,IAAKrC,EAAMoD,eAAgBhD,QAP7BC,IACjBA,EAAE0C,iBACFS,GAAeD,IAAgBA,GAAY,EAKyBjB,IAAI,KACnEiB,IACGhC,EAAAA,EAAAA,KAAA,OAAKO,UAAU,iBAAgBL,UAC3BF,EAAAA,EAAAA,KAAA,QAAMgB,wBAAyB,CAAEC,OAAQxC,EAAMmD,sBAEpD,C","sources":["webpack:///./React/Components/Shared/FinancialCalculator/ListingCalculatorCurrencyLink.jsx","webpack:///./React/Components/Shared/FinancialCalculator/ListingLenderDisclaimer.jsx"],"sourcesContent":["import ListingLenderDisclaimer from '@Components/Shared/FinancialCalculator/ListingLenderDisclaimer';\r\nimport { getDistinct, sandhillsRequest } from '@Components/Utilities/SandhillsUtility';\r\nimport atoms from '@Components/Utilities/SandhillsAtoms';\r\nimport { useRecoilValue } from 'recoil';\r\nimport translator from '@Components/Utilities/Translator';\r\n\r\nconst ListingCalculatorCurrencyLink = (props) => {\r\n    const routes = useRecoilValue(atoms.routes);\r\n\r\n    const onClick = (e) => {\r\n        sandhillsRequest({\r\n            url: routes.SaveAction,\r\n            method: 'post',\r\n            data: {\r\n                'email': '',\r\n                'actionName': 'purchaseToday',\r\n                'manufacturers': [props.ManufacturerName],\r\n                'models': [props.Model],\r\n                'listingTypes': props.ListingTypes,\r\n                'categoryIDs': getDistinct([props.CategoryId, props.AltCategoryId]),\r\n                'listingIDs': [props.Id],\r\n                'conditions': [props.Condition]\r\n            },\r\n            errorHandling: {\r\n                useConsole: false,\r\n                useAlert: false\r\n            }\r\n        });\r\n\r\n        props.OpenCalculator(e);\r\n    };\r\n\r\n    return (\r\n        <>\r\n            {(props.Widgets.ShowFinancialCalculator || props.Widgets.LenderDisclaimer) &&\r\n                <div className={props.Widgets.WidgetClass + (props.Widgets.MonthlyFinanceCurrencyUrl ? ' purchase-today-link' : '')}>\r\n                    {props.Widgets.ShowFinancialCalculator &&\r\n                        <>\r\n                            {props.Widgets.MonthlyFinanceCurrencyUrl && !props.Widgets.ShowLenderWidget ?\r\n                                <a className='fin-calc' target='_blank' onClick={onClick} href={props.Widgets.MonthlyFinanceCurrencyUrl}>\r\n                                    {props.Widgets.MonthlyFinanceCurrencyUrl ? (props.Widgets.LenderImageURL && <img src={props.Widgets.LenderImageURL} alt=\"\" />) : <i className='fas fa-calculator'></i>}\r\n                                    <span dangerouslySetInnerHTML={{ __html: props.Widgets.FinanceCalculatorDisplayText }}></span>\r\n                                    <span className='visually-hidden'>({translator.translate('sandhills.opensinanewtab')})</span>\r\n                                </a>\r\n                                :\r\n                            <p className='fin-calc' role='button' tabIndex='0' onKeyDown={(e) => { if (e.key === \"Enter\" || e.key === ' ') { e.preventDefault(); onClick(); }}} onClick={onClick}>\r\n                                    {props.Widgets.MonthlyFinanceCurrencyUrl ? (props.Widgets.LenderImageURL && <img src={props.Widgets.LenderImageURL} alt=\"\" />) : <i className='fas fa-calculator'></i>}\r\n                                    <span dangerouslySetInnerHTML={{ __html: props.Widgets.FinanceCalculatorDisplayText }}></span>\r\n                                </p>\r\n                            }\r\n                        </>\r\n                    }\r\n                    {props.Widgets.LenderDisclaimer && props.Widgets.LenderDisclaimerIcon && props.Widgets.ShowMonthlyFinanceRatesOnListings && !props.Widgets.ShowLenderWidget &&\r\n                        <ListingLenderDisclaimer\r\n                            disclaimerText={props.Widgets.LenderDisclaimer}\r\n                            disclaimerIcon={props.Widgets.LenderDisclaimerIcon}\r\n                        />}\r\n                </div>\r\n            }\r\n        </>\r\n    );\r\n};\r\n\r\nexport default ListingCalculatorCurrencyLink;","import { useState, useRef, useEffect } from 'react';\r\nimport { LazyLoadImage } from 'react-lazy-load-image-component';\r\n\r\nconst ListingLenderDisclaimer = (props) => {\r\n    const lenderRef = useRef(null);\r\n    const [showToolTip, setShowToolTip] = useState(false);\r\n\r\n    useEffect(() => {\r\n        document.addEventListener('click', handleOutsideClick, { capture: true });\r\n        return () => {\r\n            document.removeEventListener('click', handleOutsideClick, { capture: true });\r\n        };\r\n    }, []);\r\n\r\n    const handleOutsideClick = (e) => {\r\n        if ((lenderRef.current && !lenderRef.current.contains(e.target))) {\r\n            setShowToolTip(false);\r\n        }\r\n    };\r\n\r\n    const handleClick = (e) => {\r\n        e.preventDefault();\r\n        setShowToolTip(showToolTip => !showToolTip)\r\n    };\r\n\r\n    return (\r\n        <span className='lender-info' ref={lenderRef}>\r\n            <LazyLoadImage src={props.disclaimerIcon} onClick={handleClick} alt='' />\r\n            {showToolTip &&\r\n                <div className='lender-tooltip'>\r\n                    <span dangerouslySetInnerHTML={{ __html: props.disclaimerText }} />\r\n                </div>}\r\n        </span>\r\n    );\r\n};\r\n\r\nexport default ListingLenderDisclaimer;"],"names":["props","routes","useRecoilValue","atoms","onClick","e","sandhillsRequest","url","SaveAction","method","data","ManufacturerName","Model","ListingTypes","getDistinct","CategoryId","AltCategoryId","Id","Condition","errorHandling","useConsole","useAlert","OpenCalculator","_jsx","_Fragment","children","Widgets","ShowFinancialCalculator","LenderDisclaimer","_jsxs","className","WidgetClass","MonthlyFinanceCurrencyUrl","ShowLenderWidget","target","href","LenderImageURL","src","alt","dangerouslySetInnerHTML","__html","FinanceCalculatorDisplayText","translator","role","tabIndex","onKeyDown","key","preventDefault","LenderDisclaimerIcon","ShowMonthlyFinanceRatesOnListings","ListingLenderDisclaimer","disclaimerText","disclaimerIcon","lenderRef","useRef","showToolTip","setShowToolTip","useState","useEffect","document","addEventListener","handleOutsideClick","capture","removeEventListener","current","contains","ref","LazyLoadImage"],"sourceRoot":""}