var buttonNum_YC = "5"; var rowLastDivIDClicked = 1; var idButtonLast="0" function isMobile() { const toMatch = [ /Android/i, /webOS/i, /iPhone/i, /iPad/i, /iPod/i, /BlackBerry/i, /Windows Phone/i ]; return toMatch.some((toMatchItem) => { return navigator.userAgent.match(toMatchItem); }); } function removeImage_0402808407_29816(elCell) { try { var newPreviewSpan = document.getElementById("preview"); newPreviewSpan.parentNode.removeChild(newPreviewSpan); } catch(e) { } } function previewImage_0402808407_29816(elCell, chartWidth, chartHeight) { //if on desktop or (mobile and nochart) if (!isMobile() || (isMobile() && !document.getElementById("TID0402808407").querySelector("#chartContainer"))) { if (typeof chartWidth == 'undefined') { chartWidth=260; } if (typeof chartHeight == 'undefined') { chartHeight=130; } var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); if (chartWidth > w) { chartWidth = w * .8; chartHeight = chartWidth / 2; } try { var backgroundColor = getComputedStyle(document.querySelector('#chartTD')).backgroundColor } catch(e) { var backgroundColor = "#003366" } var newPreviewSpan= document.createElement('span'); newPreviewSpan.id='preview'; newPreviewSpan.className='preview_0402808407_29816'; newPreviewSpan.backgroundColor=backgroundColor newPreviewSpan.style.position="absolute"; newPreviewSpan.style.display="none"; newPreviewSpan.style.padding="2px"; newPreviewSpan.style.margin="auto"; newPreviewSpan.style.zIndex="9999"; newPreviewSpan.innerHTML = "" var body = document.getElementsByTagName("body")[0]; body.parentNode.insertBefore(newPreviewSpan, body); } } function moveImage_0402808407_29816(elCell, chartWidth, chartHeight) { if (typeof chartWidth == 'undefined') { chartWidth=260; } if (typeof chartHeight == 'undefined') { chartHeight=130; } var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); var nTop = event.pageY + 25; var nLeft = event.pageX - chartWidth/2; if (chartWidth > w) { chartWidth = w * .8; chartHeight = chartWidth / 2; } if (nLeft+chartWidth>w) { nLeft=w - chartWidth; } if (nLeft<0) { nLeft=0; } var newPreviewSpan = document.getElementById("preview"); try { newPreviewSpan.style.top=nTop + "px"; newPreviewSpan.style.left=nLeft + "px"; newPreviewSpan.style.display="block"; } catch(e) { } } function resizeWidget_0402808407_29816() { try { widgetChart_0402808407_29816.src=chartURL_0402808407_29816 + "fb.jpg" } catch (e) { } var nMaxColumns = mainDiv_0402808407_29816.children["TableRows"].children['TableHeaderRow'].children.length //var nMaxRows = mainDiv_0402808407_29816.children["TableRows"].children.length; var nMaxRows = nNumRows_0402808407_29816; var divWidth = mainDiv_0402808407_29816.children["TableRows"].offsetWidth; if (bHasCharts_0402808407_29816) { try { var buttonsChart = mainDiv_0402808407_29816.children['chartContainer'].children['timeframeButtons'].children var buttonNum_Wk = 0; var buttonNum_Mo = 1; var buttonNum_Yr = 2; var buttonNum_3Yr = 3; var buttonNum_5Yr = 4; var buttonNum_YC = 5; } catch (e) { } nLastColToShow = nMaxColumns; try { for (var i = 0; i <= mainDiv_0402808407_29816.children.length; i++) { if (mainDiv_0402808407_29816.children[i].className=="chartTDContainer") { var chartDivWidth=mainDiv_0402808407_29816.children[i].offsetWidth; break; } } switch (true) { case (chartDivWidth < 191): buttonsChart[buttonNum_Wk].innerText="Wk"; buttonsChart[buttonNum_Mo].innerText="Mo"; buttonsChart[buttonNum_Yr].innerText="Yr"; buttonsChart[buttonNum_3Yr].innerText="3Yr"; buttonsChart[buttonNum_5Yr].innerText="5Yr"; buttonsChart[buttonNum_YC].innerText="YC"; break; case (chartDivWidth < 250): buttonsChart[buttonNum_Wk].innerText="Week"; buttonsChart[buttonNum_Mo].innerText="Month"; buttonsChart[buttonNum_Yr].innerText="Year"; buttonsChart[buttonNum_3Yr].innerText="3 Year"; buttonsChart[buttonNum_5Yr].innerText="5 Year"; buttonsChart[buttonNum_YC].innerText="Curve"; break; case (chartDivWidth < 400): buttonsChart[buttonNum_Wk].innerText="Week"; buttonsChart[buttonNum_Mo].innerText="Month"; buttonsChart[buttonNum_Yr].innerText="Year"; buttonsChart[buttonNum_3Yr].innerText="3 Yrs"; buttonsChart[buttonNum_5Yr].innerText="5 Yrs"; buttonsChart[buttonNum_YC].innerText="Yield Curve"; break; case (chartDivWidth < 520): buttonsChart[buttonNum_Wk].innerText="Week"; buttonsChart[buttonNum_Mo].innerText="Month"; buttonsChart[buttonNum_Yr].innerText="Year"; buttonsChart[buttonNum_3Yr].innerText="3 Years"; buttonsChart[buttonNum_5Yr].innerText="5 Years"; buttonsChart[buttonNum_YC].innerText="Yield Curve"; break; default: buttonsChart[buttonNum_Wk].innerText="1 Week"; buttonsChart[buttonNum_Mo].innerText="1 Month"; buttonsChart[buttonNum_Yr].innerText="1 Year"; buttonsChart[buttonNum_3Yr].innerText="3 Years"; buttonsChart[buttonNum_5Yr].innerText="5 Years"; buttonsChart[buttonNum_YC].innerText="Yield Curve"; break; } } catch (e) { } } switch (true) { case (divWidth < 150): nLastColToShow = 2; try { widgetChart_0402808407_29816.maxWidth="165px"; } catch (e) { } break; case (divWidth < 250): nLastColToShow = 3; try { widgetChart_0402808407_29816.maxWidth="290px"; } catch (e) { } break; case (divWidth < 350): nLastColToShow = 4; try { widgetChart_0402808407_29816.maxWidth="390px"; } catch (e) { } break; case (divWidth < 450): nLastColToShow = 6; try { widgetChart_0402808407_29816.maxWidth="500px"; } catch (e) { } break; case (divWidth < 550): nLastColToShow = 8; try { widgetChart_0402808407_29816.maxWidth="500px"; } catch (e) { } break; default: try { widgetChart_0402808407_29816.maxWidth="800px"; } catch (e) { } break; } if (bIsResponsive_0402808407_29816) { if (nLastColToShow > nMaxColumns) { nLastColToShow = nMaxColumns } var nForcedColumns=0; //hide/unhide headers/fields for (var i = 1; i <= nMaxColumns; i++) { if (i <= nLastColToShow) { if (nLastColToShow == 3 && i == 3) { if (mainDiv_0402808407_29816.getElementsByClassName("header" + i)[0].classList.contains("nohide")) { nForcedColumns++ } else { try { mainDiv_0402808407_29816.getElementsByClassName("header" + i)[0].style.display='none'; } catch (e) { } for (var f = 0; f < nMaxRows; f++) { try { mainDiv_0402808407_29816.getElementsByClassName("field" + i)[f].style.display='none'; } catch (e) { } } } } else { try { mainDiv_0402808407_29816.getElementsByClassName("header" + i)[0].style.display='inline-block'; } catch (e) { } for (var f = 0; f < nMaxRows; f++) { try { mainDiv_0402808407_29816.getElementsByClassName("field" + i)[f].style.display='inline-block'; } catch (e) { } } } } else { if (nLastColToShow == 3 && i == 4 && nForcedColumns == 0) { try { mainDiv_0402808407_29816.getElementsByClassName("header" + i)[0].style="display: inline-block;"; } catch (e) { } for (var f = 0; f < nMaxRows; f++) { try { mainDiv_0402808407_29816.getElementsByClassName("field" + i)[f].style="display: inline-block;"; } catch (e) { } } } else { try { mainDiv_0402808407_29816.getElementsByClassName("header" + i)[0].style.display='none'; } catch (e) { } for (var f = 0; f < nMaxRows; f++) { try { mainDiv_0402808407_29816.getElementsByClassName("field" + i)[f].style.display='none'; } catch (e) { } } } } } } } function GetChartName(nSelectedButtonID,sChartName_w, sChartName_m, sChartName_y, sChartName_3y, sChartName_5y, sChartName_YC) { var sChartName="0"; switch (nSelectedButtonID){ case "0" : sChartName=sChartName_w; break; case "1" : sChartName=sChartName_m; break; case "2" : sChartName=sChartName_y; break; case "3" : sChartName=sChartName_3y; break; case "4" : sChartName=sChartName_5y; break; case "5" : sChartName=sChartName_YC; break; default : } return sChartName } function LoadThumbnail_0402808407_29816(sChartName_w, sChartName_m, sChartName_y, sChartName_3y, sChartName_5y, sChartName_YC, sChartContainerName, rowDivIDClicked, sSymbolName) { if (document.getElementById("TID0402808407").querySelector("#chartContainer")) { rowLastDivIDClicked=rowDivIDClicked; removeImage_0402808407_29816(); var timeframeButtonsPushed = mainDiv_0402808407_29816.getElementsByClassName("pushed") var nSelectedButtonID=timeframeButtonsPushed[0].id if (nSelectedButtonID==buttonNum_YC) { nSelectedButtonID=idButtonLast; } var nIncrement=-1 do { sChartName=GetChartName(nSelectedButtonID,sChartName_w, sChartName_m, sChartName_y, sChartName_3y, sChartName_5y, sChartName_YC); if (sChartName == "i000000") { nSelectedButtonID=parseInt(nSelectedButtonID); if (nSelectedButtonID==0) { nIncrement=1 } nSelectedButtonID+=nIncrement; nSelectedButtonID="" + nSelectedButtonID + "" } } while (sChartName == "i000000") sChart1Props_0402808407_29816=sChartName_w+"_"+sChartName_m+"_"+sChartName_y+"_"+sChartName_3y+"_"+sChartName_5y+"_"+sChartName_YC asChart1Props_0402808407_29816=sChart1Props_0402808407_29816.split(/_/); sChartSuffix=document.images[sChartContainerName].src.split("."); sChartSuffix=sChartSuffix[sChartSuffix.length-2].substr(sChartSuffix[sChartSuffix.length-2].length-1,1); if (sChartSuffix=="b") { sChartSuffix="fb" } document.images[sChartContainerName].src='https://www.theFinancials.com/Charts/' + chartColor_0402808407_29816 + sChartName + sChartSuffix + '.jpg' document.images[sChartContainerName].alt=sSymbolName; try { // not all charts have Preview enabled document.getElementById("thumbChart_0402808407_29816").setAttribute("data-zoom","https://www.theFinancials.com/Charts/" + chartColor_0402808407_29816 + sChartName + "z.jpg") // document.getElementById("thumbChart_0402808407_29816").href = "https://www.theFinancials.com/Charts/" + chartColor_0402808407_29816 + sChartName + "f.jpg" } catch (e) { } //hide unavailable chart buttons var timeframeButtons = mainDiv_0402808407_29816.getElementsByClassName("timeframeButton") var span_lastVisible=0; var span_firstVisible=-1; var numTimeFrameButtons=timeframeButtons.length var maxGoodButtonID=-1 for (var span = 0; span < numTimeFrameButtons; span++) { if (asChart1Props_0402808407_29816[span]=='i000000') { if (span==nSelectedButtonID) { //currently selected button is hidden var nNewTimeFrameIndex = 0; for (nSelectedButtonID = 0; nSelectedButtonID < timeframeButtons.length; nSelectedButtonID++) { if (asChart1Props_0402808407_29816[nSelectedButtonID]=='i000000') { nNewTimeFrameIndex++ } } ChangeTimeframes_0402808407_29816(sChartImageName_0402808407_29816, nNewTimeFrameIndex) } timeframeButtons[span].style.display = "none"; } else { if (span > maxGoodButtonID && span != buttonNum_YC) { maxGoodButtonID=span } if (bIncludeYieldCurveChart_0402808407_29816 || span != buttonNum_YC) { span_lastVisible=span; timeframeButtons[span].style.display = "inline-block"; timeframeButtons[span_lastVisible].classList.remove('last'); } if (span_firstVisible<0) { span_firstVisible=span; timeframeButtons[span].classList.add('first'); } else { timeframeButtons[span].classList.remove('first'); } } ChangeTimeframes_0402808407_29816(sChartImageName_0402808407_29816, nSelectedButtonID) } timeframeButtons[span_lastVisible].classList.add('last'); //highlight row var rows = mainDiv_0402808407_29816.getElementsByClassName("TableRow") for (var r = 1; r <= rows.length; r++) { if (r == rowDivIDClicked) { if (bIncludeYieldCurveChart_0402808407_29816 && mainDiv_0402808407_29816.getElementsByClassName("pushed")[0].id != buttonNum_YC) { rows[r-1].className += " selected"; } } else { rows[r-1].classList.remove('selected'); } } } return false; } function ChangeTimeframes_0402808407_29816(sChartContainerName,idButton) { sChartSuffix=document.images[sChartContainerName].src.split("."); sChartSuffix=sChartSuffix[sChartSuffix.length-2].substr(sChartSuffix[sChartSuffix.length-2].length-1,1); chartURL_0402808407_29816='https://www.theFinancials.com/charts/' + chartColor_0402808407_29816 + asChart1Props_0402808407_29816[idButton] //+ sChartSuffix + '.jpg' try { // not all charts have Zoom enabled document.getElementById("thumbChart_0402808407_29816").setAttribute("data-zoom","https://www.theFinancials.com/Charts/" + chartColor_0402808407_29816 + asChart1Props_0402808407_29816[idButton] + "z.jpg") // document.getElementById("thumbChart_0402808407_29816").href = chartURL_0402808407_29816 + "f.jpg" } catch (e) { } var timeframeButtons = mainDiv_0402808407_29816.getElementsByClassName("timeframeButton") for (var span = 0; span < timeframeButtons.length; span++) { if (timeframeButtons[span].id==idButton) { timeframeButtons[span].className += " pushed"; } else { timeframeButtons[span].classList.remove("pushed"); } } //de-select all rows is YieldCurve button is selected var rows = mainDiv_0402808407_29816.getElementsByClassName("TableRow") if (idButton==buttonNum_YC) { for (var r = 1; r <= rows.length; r++) { rows[r-1].classList.remove('selected'); } } else { for (var r = 1; r <= rows.length; r++) { if (r == rowLastDivIDClicked) { rows[r-1].className += " selected"; } } } resizeWidget_0402808407_29816(); if (idButton != buttonNum_YC) { idButtonLast=idButton; } return false; } function PopupCenter_0402808407_29816(url) { // Fixes dual-screen position Most browsers Firefox try { var dualScreenLeft = window.parent.screenLeft != undefined ? window.parent.screenLeft : window.parent.screenX; var dualScreenTop = window.parent.screenTop != undefined ? window.parent.screenTop : window.parent.screenY; } catch (e) { } var width = window.parent.innerWidth ? window.parent.innerWidth : parent.document.documentElement.clientWidth ? parent.document.documentElement.clientWidth : screen.width; var height = window.parent.innerHeight ? window.parent.innerHeight : parent.document.documentElement.clientHeight ? parent.document.documentElement.clientHeight : screen.height; var w = 820 var h = 400 var systemZoom = width / screen.availWidth; var left = (width - w) / 2 / systemZoom + dualScreenLeft var top = (height - h) / 2 / systemZoom + dualScreenTop var newWindow = window.open(url, 'theFinancials.com Chart', 'width=' + w / systemZoom + ', height=' + h / systemZoom + ', top=' + top + ', left=' + left + ''); // Puts focus on the newWindow //if (window.focus) newWindow.focus(); } function ZoomThumbnail_0402808407_29816(sthumbChart_0402808407_29816Name,sURL_0402808407_29816,sGetFreeWidgetLink) { if (typeof sGetFreeWidgetLink != 'undefined') { try { top.document.location=sGetFreeWidgetLink; } catch(e) { } } else { if (!sthumbChart_0402808407_29816Name) { var nCurChartID= sURL_0402808407_29816 } else { var nCurChartID= new String(document.images[sthumbChart_0402808407_29816Name].src); var nCurChartIDList=nCurChartID.split('/'); var nCurChartID=nCurChartIDList[nCurChartIDList.length-1]; var nCurChartID=nCurChartID.substring(0,7) + 'z.jpg'; } PopupCenter_0402808407_29816("https://www.theFinancials.com/charts" + chartColor_0402808407_29816 + nCurChartID) } return false; } function GetCSVData(sParnterID) { var sDataFileName=asChart1Props_0402808407_29816[3] + '.csv'; if (sParnterID=='DEM' | sParnterID=='B2C') { alert("The Private Label version of this Widget will download 3 years of Excel-compatible CSV data for the currently-selected item.") } else { top.document.location="//www.theFinancials.com/data/" + sDataFileName; } return false; } function PopupDisclaimer() { try { document.getElementById("DisclaimerPopup").style.display="block"; } catch(e) { var newPreviewSpan= document.createElement('span'); newPreviewSpan.id='DisclaimerPopup'; newPreviewSpan.style.backgroundColor = "#FFFFFF"; newPreviewSpan.style.position="absolute"; newPreviewSpan.style.padding="10px"; newPreviewSpan.style.margin="10px"; newPreviewSpan.style.zIndex="9999"; newPreviewSpan.style.fontFamily="Arial"; newPreviewSpan.style.fontSize="12px"; newPreviewSpan.style.display="block"; var w = Math.max(document.documentElement.clientWidth, window.innerWidth || 0); var h = Math.max(document.documentElement.clientHeight, window.innerHeight || 0); //var nWidthScrollbarAdjustment = 25; var nTop = event.pageY; //var nLeft = event.pageX //var nLeft = event.pageX - 500; newPreviewSpan.style.top=nTop + "px"; newPreviewSpan.innerHTML = "The market data ('Information') contained herein: (i) includes the proprietary information of Chicago Mercantile Exchange Inc. or it's licensors, as applicable ; (ii) may not be copied, sold or further disseminated except as specifically authorized; (iii) does not constitute investment advice; (iv) is provided solely for informational purposes; (v) is not used for any commercial purpose; and (vi) is not warranted to be complete, accurate or timely. You may not develop or create any derivative work or other product that uses, is based on, or is developed in connection with any of the Information (including, without limitation, proprietary data, settlement data or indices) available on this site. In addition to the forgoing, to the fullest extent permitted by law, use of such Information (including associated metadata) in any manner for any machine learning and/or artificial intelligence, including without limitation for the purposes of training, coding, or development of artificial intelligence technologies, tools, or solutions or machine learning language models, or otherwise for the purposes of using or in connection with the use of such technologies, tools, or models to generate any information, material, data, derived works, content, or output, is expressly prohibited." var body = document.getElementsByTagName("body")[0]; body.parentNode.insertBefore(newPreviewSpan, body); } } function RemoveDisclaimer() { try { document.getElementById("DisclaimerPopup").style.display="none"; } catch (e) {} } var bodyExists=document.getElementsByTagName('body') if (bodyExists.length!=0) { var divIDFoud = true; var s = document.getElementById('WID0402808407'); if (!s) { divIDFoud = false;var s = document.getElementsByTagName('script'); var bFound=false; if (s.length==1) { s = s[s.length - 1]; var bFound=true; } else { for(var i=0; i 0 ) { s = s[i] var bFound=true; break; } } if(!bFound) { for(var i=0; i0 || (s[i].src || '').search('www.thefinancials.com/syndicated')>0) { s = s[i]; var bFound=true; break; } } } } if(!bFound) { var s = document.getElementsByTagName('iframe'); for(var i=0; i0 || (s[i].src || '').search('www.thefinancials.com/syndicated')>0) { s = s[i] var bFound=true; break; } } } } } var div = document.createElement('span'); div.hidden=true; div.className='tfcWidget'; div.style.padding=0; div.style.margin=0; div.style.width='100%'; div.id='resizeWidget_0402808407_29816();' div.innerHTML = "\u003chtml lang=\u0027en\u0027\u003e\u003chead\u003e\u003ctitle\u003etheFinancials.com: Live Market Rates\u003c/title\u003e\u003cmeta content=\u0027no-cache\u0027 http-equiv=\u0027pragma\u0027\u003e\u003cmeta content=\u0027text/html; charset=utf-8\u0027 http-equiv=\u0027Content-Type\u0027/\u003e\u003cmeta content=\u00270\u0027 http-equiv=\u0027expires\u0027/\u003e\u003cmeta name=\u0027viewport\u0027 content=\u0027width=device-width, initial-scale=1\u0027 /\u003e\u003clink href=\u0027https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900\u0026family=Merriweather:ital,opsz,wght@0,18..144,300..900;1,18..144,300..900\u0027 rel=\u0027stylesheet\u0027 type=\u0027text/css\u0027\u003e\u003clink href=\u0027https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200\u0026display=block\u0027 rel=\u0027stylesheet\u0027 type=\u0027text/css\u0027\u003e\u003clink href=\u0027https://www.thefinancials.com/Styles/Widget.css?v=20250224232434\u0027 rel=\u0027stylesheet\u0027 type=\u0027text/css\u0027\u003e\u003clink href=\u0027https://www.thefinancials.com/syndicated/BAYPORT/Styles/TID0402808407.css?v=20261026183112\u0027 rel=\u0027stylesheet\u0027 type=\u0027text/css\u0027\u003e\u003clink href=\u0027https://www.thefinancials.com/Styles/Insights.css?v=20261027011317\u0027 rel=\u0027stylesheet\u0027 type=\u0027text/css\u0027\u003e\u003clink href=\u0027https://www.thefinancials.com/syndicated/BAYPORT/Styles/TID0402808407/Custom.css?v=20261026183711\u0027 rel=\u0027stylesheet\u0027 type=\u0027text/css\u0027\u003e\u003c/head\u003e\u003cbody tabIndex=\u00270\u0027 style=\u0027max-width:100%;\u0027\u003e\u003cdiv name=\u00270402808407_29816\u0027 id=\u0027TID0402808407\u0027 class=\u0027widgetContainer tfc-market-insights\u0027 style=\u0027line-height:1;visibility: hidden;\u0027 data-pid=\u0027BAYPORT\u0027 data-wid=\u00270402808407\u0027\u003e\u003cdiv class=\u0027titleContainer\u0027\u003e\u003cdiv class=\u0027Title\u0027\u003e\u003cspan id=\u0027titleText\u0027\u003eLive Market Rates\u003c/span\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\u0027TableRows\u0027 style=\u0027\u0027\u003e\u003cdiv id=\u0027TableHeaderRow\u0027\u003e\u003cdiv class=\u0027widgetTableCell header1 col1\u0027\u003e\u003c/div\u003e\u003cdiv class=\u0027widgetTableCell header2 col2\u0027\u003e27-Oct-26\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\u0027row1\u0027 class=\u0027TableRow odd rowup\u0027 \u003e\u003cdiv class=\u0027widgetTableCell field1 col1\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i011089fb.jpg\u0027 onclick=\u0027return false;\u0027\u003eSOFR\u003c/a\u003e\u003c/div\u003e\u003cdiv class=\u0027widgetTableCell field2 col2 up material-symbols-outlined\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i011089fb.jpg\u0027 onclick=\u0027return false;\u0027\u003e3.92%\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\u0027row2\u0027 class=\u0027TableRow even rowflat\u0027 \u003e\u003cdiv class=\u0027widgetTableCell field1 col1\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i001399fb.jpg\u0027 onclick=\u0027return false;\u0027\u003ePrime Rate\u003c/a\u003e\u003c/div\u003e\u003cdiv class=\u0027widgetTableCell field2 col2 flat material-symbols-outlined\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i001399fb.jpg\u0027 onclick=\u0027return false;\u0027\u003e7.00%\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv class=\u0027Section\u0027 id=\u0027section1\u0027\u003e\u003cdiv class=\u0027sectionBreakRow sectionBreak\u0027\u003eU.S. TREASURY\u003c/div\u003e\u003cdiv id=\u0027row3\u0027 class=\u0027TableRow odd rowdown\u0027 \u003e\u003cdiv class=\u0027widgetTableCell field1 col1\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i003578fb.jpg\u0027 onclick=\u0027return false;\u0027\u003e5-Year\u003c/a\u003e\u003c/div\u003e\u003cdiv class=\u0027widgetTableCell field2 col2 down material-symbols-outlined\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i003578fb.jpg\u0027 onclick=\u0027return false;\u0027\u003e4.81%\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\u0027row4\u0027 class=\u0027TableRow even rowdown\u0027 \u003e\u003cdiv class=\u0027widgetTableCell field1 col1\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i009422fb.jpg\u0027 onclick=\u0027return false;\u0027\u003e7-Year\u003c/a\u003e\u003c/div\u003e\u003cdiv class=\u0027widgetTableCell field2 col2 down material-symbols-outlined\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i009422fb.jpg\u0027 onclick=\u0027return false;\u0027\u003e4.88%\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\u0027row5\u0027 class=\u0027TableRow odd rowdown\u0027 \u003e\u003cdiv class=\u0027widgetTableCell field1 col1\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i003574fb.jpg\u0027 onclick=\u0027return false;\u0027\u003e10-Year\u003c/a\u003e\u003c/div\u003e\u003cdiv class=\u0027widgetTableCell field2 col2 down material-symbols-outlined\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i003574fb.jpg\u0027 onclick=\u0027return false;\u0027\u003e4.97%\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\u0027row6\u0027 class=\u0027TableRow even rowdown\u0027 \u003e\u003cdiv class=\u0027widgetTableCell field1 col1\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i003577fb.jpg\u0027 onclick=\u0027return false;\u0027\u003e30-Year\u003c/a\u003e\u003c/div\u003e\u003cdiv class=\u0027widgetTableCell field2 col2 down material-symbols-outlined\u0027 onmouseover=\u0027previewImage_0402808407_29816(this, 400, 200);\u0027 onmousemove=\u0027moveImage_0402808407_29816(this, 400, 200);\u0027 onmouseout=\u0027removeImage_0402808407_29816(this)\u0027 \u003e\u003ca data-zoom=\u0027https://www.thefinancials.com/charts/i003577fb.jpg\u0027 onclick=\u0027return false;\u0027\u003e5.29%\u003c/a\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\u0027footerLineContainer\u0027\u003e\u003chr noshade=\u0027noshade\u0027 class=\u0027footerLine\u0027\u003e\u003c/div\u003e\u003cdiv id=\u0027TimeStampContainer\u0027\u003e\u003cdiv id=\u0027TimeStamp\u0027\u003eLast Updated 27-Oct-26 12:07 AM ET\u003c/div\u003e\u003c/div\u003e\u003cdiv id=\u0027copyrightContainer\u0027 style=\u0027display: flex !important; order: 99 !important;\u0027\u003e\u003cdiv id=\u0027copyright\u0027 style=\u0027display: inline-block !important;\u0027\u003e\u0026copy; theFinancials.com\u003c/div\u003e\u003c/div\u003e\u003c!-- Insights block inside widgetContainer so launcher anchors correctly --\u003e\r\n\u003cdiv class=\u0027tfc-insights-launcher-container\u0027 style=\u0027opacity:0;\u0027\u003e\r\n \u003cbutton\r\n \r\n class=\u0027tfc-insights-launcher\u0027\r\n type=\u0027button\u0027\r\n aria-label=\u0027Ask Market Insights\u0027\r\n \u003e\r\n \u003cspan class=\u0027insights-text-full\u0027\u003eAsk Market Insights about these rates\u003c/span\u003e\r\n \u003cspan class=\u0027insights-text-short\u0027\u003eAsk Market Insights\u003c/span\u003e\r\n \u003cspan class=\u0027tfc-insights-sparkle\u0027\u003e\u0026#x2726;\u003c/span\u003e\r\n \u003c/button\u003e\r\n\u003c/div\u003e\r\n\r\n\u003cdiv id=\u0027insightsPanel\u0027 class=\u0027insights-panel\u0027\u003e\r\n \u003cdiv class=\u0027insights-header\u0027\u003e\r\n \u003cspan class=\u0027insights-title\u0027\u003e\u003cspan class=\u0027insights-header-sparkle\u0027\u003e\u0026#x2726;\u003c/span\u003eMarket Insights\u003c/span\u003e\r\n\r\n \u003cbutton\r\n id=\u0027insightsClose\u0027\r\n class=\u0027insights-close\u0027\r\n type=\u0027button\u0027\r\n aria-label=\u0027Close insights\u0027\r\n \u003e\r\n \u0026#x00D7;\r\n \u003c/button\u003e\r\n \u003c/div\u003e\r\n\r\n \u003cdiv id=\u0027insightsBody\u0027 class=\u0027insights-body\u0027\u003e\r\n \u003cdiv id=\u0027insightsPrompts\u0027 class=\u0027insights-prompts\u0027\u003e\r\n \u003cdiv class=\u0027insights-prompts-title\u0027\u003eAsk questions like:\u003c/div\u003e\r\n\r\n \u003cdiv\r\n id=\u0027insightsPromptList\u0027\r\n class=\u0027insights-prompt-list\u0027\r\n \u003e\u003cbutton class=\u0027insights-prompt-card\u0027\u003eHow has 7-Year trended over the past year?\u003c/button\u003e\u003cbutton class=\u0027insights-prompt-card\u0027\u003eCompare 7-Year and SOFR over the last 6 months?\u003c/button\u003e\u003cbutton class=\u0027insights-prompt-card\u0027\u003eWhich has been more stable over the last 90 days, 7-Year or SOFR?\u003c/button\u003e\u003cbutton class=\u0027insights-prompt-card\u0027\u003eWho can I contact for more information?\u003c/button\u003e\u003c/div\u003e\r\n \u003c/div\u003e\r\n \u003c/div\u003e\r\n\r\n\u003cdiv class=\u0027insights-footer\u0027\u003e\r\n \u003cdiv class=\u0027insights-row chat-input-wrap\u0027\u003e\r\n \u003cinput id=\u0027insightsInput\u0027 class=\u0027insights-input\u0027 type=\u0027text\u0027 placeholder=\u0027Ask your own question here\u0027 /\u003e\r\n \u003cbutton id=\u0027insightsSend\u0027 class=\u0027insights-send\u0027\u003e\r\n \u003cspan class=\u0027send-arrow\u0027\u003e\u0026#x279C;\u003c/span\u003e\r\n \u003c/button\u003e\r\n \u003c/div\u003e\r\n \u003cdiv class=\u0027insights-disclaimer\u0027\u003ePowered by AI which can make mistakes. \u003ca class=\u0027insights-disclaimer-link\u0027 href=\u0027https://thefinancials.com/privacy-policy/\u0027 target=\u0027_blank\u0027 rel=\u0027noopener noreferrer\u0027\u003ePrivacy Policy\u003c/a\u003e.\u003c/div\u003e\r\n\u003c/div\u003e\r\n\u003c/div\u003e\u003c/div\u003e\u003c/body\u003e\u003c/html\u003e"; try { if (divIDFoud) { s.appendChild(div); } else { s.parentNode.insertBefore(div, s); } } catch(e) { document.body = document.createElement('body'); document.body.innerHTML = div.innerHTML; } var sWidgetID_0402808407_29816='TID0402808407';var mainDiv_0402808407_29816=document.getElementsByName('0402808407_29816')[0];var bHasCharts_0402808407_29816=false;var bIsResponsive_0402808407_29816=false;var nNumRows_0402808407_29816=6;try {window.onresize = resizeWidget_0402808407_29816;window.dispatchEvent(new Event('resize'));var RefererDomain = '';var RefererDomain_Native = '';const API_BASE = "https://agent.thefinancials.com"; const launcher = document.querySelector(".tfc-insights-launcher"); const panel = document.getElementById("insightsPanel"); const closeBtn = document.getElementById("insightsClose"); const bodyEl = document.getElementById("insightsBody"); const promptsEl = document.getElementById("insightsPrompts"); const promptListEl = document.getElementById("insightsPromptList"); const inputEl = document.getElementById("insightsInput"); const sendBtn = document.getElementById("insightsSend"); // Detect iframe embedding (Wix etc.) — panel anchors below the launcher instead of viewport bottom let tfcIsEmbedded; try { tfcIsEmbedded = window.self !== window.top; } catch (e) { tfcIsEmbedded = true; } if (tfcIsEmbedded) document.documentElement.classList.add("tfc-embedded"); function positionPanelForEmbed() { const r = launcher.getBoundingClientRect(); const top = Math.max(8, r.bottom + 8); const avail = window.innerHeight - top - 14; panel.style.top = top + "px"; panel.style.height = Math.max(240, Math.min(600, avail)) + "px"; } const state = { pid: null, wid: null, sessionId: null, sessionToken: null, expiresAt: null, bootstrapping: false }; //5/19/26 setTimeout(() => { const container = document.querySelector(".tfc-insights-launcher-container"); if (!container) return; // hide instantly, no animation container.style.transition = "none"; container.style.opacity = "0"; // force browser to apply opacity 0 container.offsetHeight; // then fade in setTimeout(() => { container.style.transition = "opacity 1.2s ease"; container.style.opacity = "1"; }, 300); }, 1500); // ─── Panel ──────────────────────────────────────────────────────────────────── function openPanel() { if (tfcIsEmbedded) positionPanelForEmbed(); panel.classList.add("open"); launcher.classList.add("active"); if (bodyEl.querySelectorAll(".insights-message").length === 0) { promptsEl.classList.add("visible"); } if (!window.matchMedia("(max-width: 425px)").matches) { inputEl.focus(); } } function closePanel() { panel.classList.remove("open"); launcher.classList.remove("active"); } // ─── Prompt Cards ───────────────────────────────────────────────────────────── function tfcDecodeHtml(str) { const el = document.createElement("textarea"); el.innerHTML = str; return el.value; } function initPromptCards() { const cards = promptListEl.querySelectorAll(".insights-prompt-card"); cards.forEach(btn => { if (btn.dataset.insightsInit) return; btn.dataset.insightsInit = "1"; btn.textContent = tfcDecodeHtml(btn.textContent); btn.addEventListener("click", () => { inputEl.value = btn.textContent; sendMessage(false); }); }); } function hidePromptCards() { promptsEl.classList.remove("visible"); } // ─── Messages ───────────────────────────────────────────────────────────────── function appendMessage(text, role, tableRows) { const div = document.createElement("div"); div.className = `insights-message ${role}`; const textEl = document.createElement("div"); textEl.innerHTML = text || ""; div.appendChild(textEl); if (role === "assistant" && Array.isArray(tableRows) && tableRows.length > 0) { const tableWrap = document.createElement("div"); tableWrap.className = "insights-table-wrap"; const table = document.createElement("table"); table.className = "insights-table"; const thead = document.createElement("thead"); const headRow = document.createElement("tr"); ["Symbol", "Date", "Value"].forEach(label => { const th = document.createElement("th"); th.textContent = label; headRow.appendChild(th); }); thead.appendChild(headRow); table.appendChild(thead); const tbody = document.createElement("tbody"); tableRows.forEach(row => { const tr = document.createElement("tr"); const tdSymbol = document.createElement("td"); tdSymbol.textContent = (row.symbol || "").replace(/<[^>]*>/g, ""); tr.appendChild(tdSymbol); const tdDate = document.createElement("td"); tdDate.textContent = row.date || ""; tr.appendChild(tdDate); const tdValue = document.createElement("td"); tdValue.textContent = row.value || ""; tr.appendChild(tdValue); tbody.appendChild(tr); }); table.appendChild(tbody); tableWrap.appendChild(table); div.appendChild(tableWrap); } bodyEl.appendChild(div); if (role === "user") { div.scrollIntoView(true); } } function appendTypingIndicator() { const div = document.createElement("div"); div.className = "insights-message assistant typing-indicator"; div.innerHTML = ` `; bodyEl.appendChild(div); bodyEl.scrollTop = bodyEl.scrollHeight; return div; } // ─── Widget Context ─────────────────────────────────────────────────────────── function getWidgetContextFromDom() { const container = document.querySelector(".tfc-market-insights"); if (!container) { throw new Error("Market Insights container not found."); } const pid = container.dataset.pid; const wid = container.dataset.wid; if (!pid || !wid) { throw new Error("Missing pid/wid in Market Insights container."); } // Collect WIDs from two sources and union them, so both page layouts work: // 1. The page URL's comma-separated wid param (?wid=AAA,BBB) — authoritative // for embeds that encode multiple widgets in one script URL but render a // single combined container (e.g. Flex widgets). // 2. data-wid on every .tfc-market-insights container in the DOM — for pages // that render each widget as its own container. const widSet = new Set(); // Source 1: URL query string const urlWidParam = new URLSearchParams(window.location.search).get("wid"); if (urlWidParam) { urlWidParam.split(",").map(w => w.trim()).filter(Boolean).forEach(w => widSet.add(w)); } // Source 2: DOM containers document.querySelectorAll(".tfc-market-insights[data-wid]").forEach(c => { if (c.dataset.wid) widSet.add(c.dataset.wid.trim()); }); const allWids = Array.from(widSet); const wids = allWids.length > 1 ? allWids : null; return { pid, wid, wids }; } // ─── Session ────────────────────────────────────────────────────────────────── function hasValidSession() { return !!( state.sessionId && state.sessionToken && state.expiresAt && Date.now() < state.expiresAt ); } async function bootstrapSession(force = false) { if (!force && hasValidSession()) return; if (state.bootstrapping) return; state.bootstrapping = true; try { const { pid, wid, wids } = getWidgetContextFromDom(); const payload = { pid: pid, origin: window.location.origin, pageUrl: window.location.href, referrer: document.referrer || null }; if (wids && wids.length > 1) { payload.wids = wids; } else { payload.wid = wid; } const response = await fetch(`${API_BASE}/api/insights/bootstrap`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(payload) }); const data = await response.json(); if (!response.ok || !data?.success) { throw new Error(data?.error?.message || data?.message || "Unable to start Market Insights."); } state.pid = data.pid || pid; state.wid = data.wid || wid; state.sessionId = data.sessionId; state.sessionToken = data.sessionToken; state.expiresAt = Date.now() + ((data.expiresInSeconds || 0) * 1000); } finally { state.bootstrapping = false; } } // ─── Chat ───────────────────────────────────────────────────────────────────── async function sendMessage(retried = false) { const message = inputEl.value.trim(); if (!message) return; appendMessage(message, "user"); inputEl.value = ""; sendBtn.disabled = true; const typingEl = appendTypingIndicator(); try { await bootstrapSession(false); const response = await fetch(`${API_BASE}/api/insights/chat`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ sessionId: state.sessionId, sessionToken: state.sessionToken, message: message }) }); const data = await response.json(); if (!response.ok) { const code = data?.error?.code || ""; const errorMessage = data?.error?.message || "An error occurred."; if (!retried && code === "INVALID_SESSION") { await bootstrapSession(true); inputEl.value = message; if (bodyEl.lastElementChild?.classList.contains("user")) { bodyEl.removeChild(bodyEl.lastElementChild); } typingEl.remove(); return sendMessage(true); } typingEl.remove(); appendMessage(errorMessage, "assistant"); return; } typingEl.remove(); // External CTA reached by clicking the CTA prompt: show the button only. // Advisory responses still show ctaText above the button. const externalCtaOnly = data.ctaOffered === true && data.ctaMode === "external" && !!data.ctaUrl && data.responseType === "DirectContact" && typeof renderExternalCtaCard === "function"; if (!externalCtaOnly) { appendMessage( data.answer || "No response received.", "assistant", data.tableRows || [] ); } // Trigger CTA card if backend requests it and the card file is loaded. // ctaMode "external" renders a link-out button to the customer's own CTA // page; anything else (including absent) uses the default contact form. const existingCard = bodyEl.querySelector(".contact-card"); if (existingCard) existingCard.remove(); if (data.ctaOffered === true) { let card = null; if (data.ctaMode === "external" && data.ctaUrl) { if (typeof renderExternalCtaCard === "function") { card = renderExternalCtaCard(data.ctaUrl); } } else if (typeof renderContactCard === "function") { card = renderContactCard(); } if (card) { bodyEl.appendChild(card); bodyEl.scrollTop = bodyEl.scrollHeight; } } } catch (err) { typingEl.remove(); console.warn("[Insights] chat request failed:", err); appendMessage("Unable to reach the assistant right now. Please try again in a moment.", "assistant"); } finally { sendBtn.disabled = false; inputEl.focus(); } } // ─── Event Listeners ────────────────────────────────────────────────────────── launcher.addEventListener("click", async () => { openPanel(); try { await bootstrapSession(false); } catch (err) { console.warn("[Insights] bootstrap failed:", err); appendMessage("Unable to start Market Insights. Please try again in a moment.", "assistant"); } }); closeBtn.addEventListener("click", closePanel); sendBtn.addEventListener("click", () => sendMessage(false)); inputEl.addEventListener("keydown", function (e) { if (e.key === "Enter") { e.preventDefault(); sendMessage(false); } }); // ─── Resize: suppress panel transition while dragging ───────────────────────── let resizeTimer; window.addEventListener("resize", () => { document.body.classList.add("insights-no-transition"); clearTimeout(resizeTimer); resizeTimer = setTimeout(() => { document.body.classList.remove("insights-no-transition"); }, 150); }); // ─── Init ───────────────────────────────────────────────────────────────────── (() => { initPromptCards(); const widgetContainer = document.querySelector(".tfc-market-insights"); const titleContainer = widgetContainer?.querySelector(".titleContainer"); // Track title bar height for vertical centering of launcher if (titleContainer) { const ro = new ResizeObserver(() => { widgetContainer.style.setProperty( "--insights-launcher-title-height", `${titleContainer.offsetHeight}px` ); }); ro.observe(titleContainer); } // Offset launcher left of data download button when present const dataButton = widgetContainer?.querySelector("#dataButton"); if (dataButton) { const syncDataButtonWidth = () => { const gap = window.innerWidth > 500 ? 15 : 0; widgetContainer.style.setProperty( "--insights-databutton-width", `${dataButton.offsetWidth + gap}px` ); }; syncDataButtonWidth(); const roDataBtn = new ResizeObserver(syncDataButtonWidth); roDataBtn.observe(dataButton); window.addEventListener("resize", syncDataButtonWidth); } })();// ─── Insights Contact Card ──────────────────────────────────────────────────── // Loaded by Widget.aspx only when AddInsightsContactCard is enabled. // Widget.aspx will replace placeholder text values via transformation // before serving — do not hardcode customer-specific strings here. // requestContactEnabled is redundant since this file only loads when // the feature is on, but included for clarity and future use. // ───────────────────────────────────────────────────────────────────────────── const requestContactEnabled = true; // Widget.aspx: replace with XML value //const requestContactText = "Request Contact"; // Widget.aspx: replace with XML value function renderContactCard() { const card = document.createElement("div"); card.className = "contact-card visible"; const ctaPrompt = document.createElement("div"); ctaPrompt.className = "cta-prompt visible"; const btn = document.createElement("button"); btn.className = "cta-button"; btn.setAttribute("data-insight-setting", "contact-request-button"); btn.textContent = "Request Contact"; const form = document.createElement("div"); form.className = "lead-form"; form.innerHTML = ` Back to chat Name Company Email Phone (optional) Describe what you are looking for (optional) These details will be shared with this site's provider. Privacy Policy. Submit `; ctaPrompt.appendChild(btn); card.appendChild(ctaPrompt); card.appendChild(form); btn.addEventListener("click", () => { fetch(`${API_BASE}/api/insights/cta-click`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ sessionId: state.sessionId, sessionToken: state.sessionToken, ctaMode: "contact" }), keepalive: true }).catch(() => {}); ctaPrompt.classList.remove("visible"); form.classList.add("visible"); form.scrollIntoView({ behavior: "smooth", block: "nearest" }); }); form.querySelector(".lead-back").addEventListener("click", () => { form.classList.remove("visible"); ctaPrompt.classList.add("visible"); }); form.querySelector(".lead-submit").addEventListener("click", async () => { const name = form.querySelector(".lead-name").value.trim(); const company = form.querySelector(".lead-company").value.trim(); const email = form.querySelector(".lead-email").value.trim(); const phone = form.querySelector(".lead-phone").value.trim(); const freeTextField = form.querySelector(".lead-freetextfield").value.trim(); const status = form.querySelector(".lead-status"); if (!name || !company || !email) { status.setAttribute("data-insight-setting", "contact-validation-message"); status.textContent = "Please complete Name, Company, and Email."; return; } status.setAttribute("data-insight-setting", "contact-submitting-message"); status.textContent = "Submitting..."; try { const response = await fetch(`${API_BASE}/api/insights/lead`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ sessionId: state.sessionId, widgetId: state.wid, name, company, email, phone, freeTextField }) }); if (!response.ok) { status.setAttribute("data-insight-setting", "contact-submit-error-message"); status.textContent = "Unable to submit contact request."; return; } status.setAttribute("data-insight-setting", "contact-submit-success-message"); status.textContent = "Thanks — we'll contact you soon!"; form.querySelector(".lead-submit").disabled = true; } catch { status.setAttribute("data-insight-setting", "contact-submit-failed-message"); status.textContent = "Submission failed."; } }); return card; } // ─── External CTA Card ──────────────────────────────────────────────────────── // Rendered instead of the contact form when the backend returns // ctaMode === "external". Opens the customer's own CTA page in a new tab. // Reuses .contact-card / .cta-prompt / .cta-button so existing styling applies // and Insights.js cleanup (bodyEl.querySelector(".contact-card")) catches it. // ───────────────────────────────────────────────────────────────────────────── function renderExternalCtaCard(ctaUrl) { const card = document.createElement("div"); card.className = "contact-card contact-card-external visible"; const ctaPrompt = document.createElement("div"); ctaPrompt.className = "cta-prompt visible"; const btn = document.createElement("button"); btn.className = "cta-button"; btn.setAttribute("data-insight-setting", "external-cta-button"); btn.textContent = "Contact an Advisor"; btn.addEventListener("click", () => { fetch(`${API_BASE}/api/insights/cta-click`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ sessionId: state.sessionId, sessionToken: state.sessionToken, ctaMode: "external" }), keepalive: true }).catch(() => {}); window.open(ctaUrl, "_blank", "noopener,noreferrer"); }); ctaPrompt.appendChild(btn); card.appendChild(ctaPrompt); return card; }setTimeout(function() { var divWidgets = document.getElementsByClassName('widgetContainer'); for (i = 0; i