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,kDAGpC,IAAIuG,MAAMF,E,CAEpB,CAtCAf,OAAOY,UAAY7C,SAASC,qBAAqB,eAAe,IAAIC,UACpE+B,OAAOa,SAAW9C,SAASC,qBAAqB,cAAc,IAAIC,UAClE+B,OAAOK,iBAAmBtC,SAASC,qBAAqB,uBAAuB,IAAIC,UACnF+B,OAAOM,0BAA4BvC,SAASC,qBAAqB,gCAAgC,IAAIC,UACrG+B,OAAOO,aAAexC,SAASC,qBAAqB,qBAAqB,IAAIC,UAC7E+B,OAAOQ,YAAczC,SAASC,qBAAqB,mBAAmB,IAAIC,S","sources":["webpack://vaneckreact/./FundPagesEU/Components/HistoPricesBlock/HistoPricesInner.tsx","webpack://vaneckreact/./FundPagesEU/Components/HistoPricesBlock/HistoPricesBlock.tsx","webpack://vaneckreact/./FundPagesEU/Components/HistoPricesBlock/useHistoPricesBlock.tsx","webpack://vaneckreact/./FundPages/core/customHooks/useAutoScollUp.tsx","webpack://vaneckreact/./FundPages/services/fetchDataService.tsx"],"sourcesContent":["import React, { useState, useEffect } from \"react\";\r\nimport { FundTableTitle, FundTableWithoutTitle, HeaderProperties, TableColumn, TableProperties } from \"../../../FundPages/Components/CommonBlocks/FundTable\";\r\n\r\nexport interface HistoPricesBlocKOptions {\r\n markup: JSX.Element | string | null;\r\n header?: HeaderProperties | null;\r\n cssClass: string;\r\n tableData: any | null;\r\n}\r\n\r\nexport function HistoPricesInner({ markup, header, cssClass, tableData }: HistoPricesBlocKOptions) {\r\n if (markup || (tableData && !tableData.prices)) return <></>;\r\n return (\r\n <div className={`prices-table ${cssClass}`}>\r\n <FundTableTitle headerData={header} />\r\n <FETable tableData={tableData} />\r\n </div>\r\n );\r\n}\r\n\r\nfunction FETable({ tableData }: { tableData: any }) {\r\n const [navState, setNavState] = useState(\"nc\");\r\n const [tableInfo, setTableInfo] = useState<TableProperties>()\r\n\r\n useEffect(() => {\r\n const navDailyChange = tableData.prices.NavDailyChangeValue;\r\n const navState = navDailyChange == 0 ? \"nc\" : navDailyChange > 0 ? \"up\" : \"down\";\r\n\r\n setNavState(navState);\r\n\r\n const TableInformation = MapTableData(tableData, navState)\r\n setTableInfo({tableColumns: TableInformation.tableColumns, tableRows: TableInformation.tableRows})\r\n }, [tableData]);\r\n\r\n const MapTableData = (tableData: any, navState: string) => {\r\n //to generate the markup for the nav change top item\r\n const NavChangeItemOne =\r\n tableData.prices.NavDailyChangeValue != null ? (\r\n `\r\n <img style=\"border-width:0px;\" src=\"/static/images/arrow_${navState}.gif\"/>\r\n ${tableData.prices.NavDailyChange} / ${tableData.prices.NavDailyChangePercentage}\r\n `\r\n ) : (\r\n <></>\r\n );\r\n\r\n const tableColumns: TableColumn[] = tableData.columns.map(\r\n (column: any, i: number) => {\r\n return { css: \"\", value: column.headerText?.Key ?? column.headerText };\r\n }\r\n );\r\n //defined the table rows as arrays inside an array\r\n const tableRows = [\r\n [\r\n { css: \"\", value: tableData.prices.DisplayTicker },\r\n {\r\n css: \"\",\r\n value:\r\n tableData.currencyName\r\n },\r\n {\r\n css: \"\",\r\n value:\r\n tableData.prices.NavCurrent\r\n },\r\n { css: \"\", value: NavChangeItemOne },\r\n {\r\n css: \"\",\r\n value:\r\n tableData.prices.NAVYTDPerc,\r\n },\r\n {\r\n css: \"\",\r\n value:\r\n `<a data-ve-gtm=\"fund-document\" href=\"${tableData.DownloadUrl}\" class=\"icon_docs icon_ex\" target=${tableData.DownloadUrlTarget}></a>\r\n <a data-ve-gtm=\"chart-item\" class=\"icon_docs icon_graf\" href=${tableData.ChartUrl} target=${tableData.ChartUrlTarget}></a>`,\r\n },\r\n { css: \"\", value: tableData.prices.GrossExpenseRatio },\r\n ],\r\n ];\r\n return { tableColumns, tableRows };\r\n };\r\n\r\n\r\n return (\r\n <FundTableWithoutTitle tableData={tableInfo}/>\r\n );\r\n}\r\n","import \"./HistoPricesBlock.scss\";\r\nimport React, { useState } from \"react\";\r\nimport useAutoScrollUp from \"../../../FundPages/core/customHooks/useAutoScollUp\";\r\nimport { HistoPricesInner } from \"./HistoPricesInner\";\r\nimport { useHistoPricesBlock } from \"./useHistoPricesBlock\";\r\n\r\nexport interface HistoPricesBlockInterface extends ComponentInterface {};\r\n\r\nexport default function HistoPricesBlock(props: HistoPricesBlockInterface) {\r\n const element = props.rootElement;\r\n const blockID = element.dataset.blockid as unknown as number;\r\n const pageID = element.dataset.pageid as unknown as number;\r\n const template = element.dataset.template;\r\n\r\n const [markup, setMarkup] = useState(<div className=\"component-loading\">Loading Data...</div>);\r\n useAutoScrollUp(element);\r\n\r\n if (isNaN(blockID)) return <p>Error: BlockID not found.</p>;\r\n\r\n const [header, cssClass, tableData] = useHistoPricesBlock({\r\n blockID: blockID,\r\n pageID: pageID,\r\n setMarkup: setMarkup\r\n });\r\n\r\n return (\r\n <>\r\n {markup}\r\n <HistoPricesInner markup={markup} header={header} cssClass={cssClass} tableData={tableData}></HistoPricesInner>\r\n </>\r\n );\r\n}\r\n","import { HeaderProperties } from \"../../../FundPages/Components/CommonBlocks/FundTable\";\r\nimport { useState, useEffect, useMemo } from \"react\";\r\nimport { fetchBlockData } from \"../../../FundPages/services/fetchDataService\";\r\n\r\ninterface IHistoPricesProps {\r\n blockID: Number,\r\n pageID: Number,\r\n setMarkup: Function\r\n}\r\n\r\ninterface IColumnData {\r\n HeaderText: null | {\r\n Key: string\r\n },\r\n ColumnName: string,\r\n}\r\n\r\n/**\r\n * Custom hook to get and process the required data for the HistoPricesBlock.\r\n */\r\nexport function useHistoPricesBlock(props: IHistoPricesProps): ([header: HeaderProperties|null, cssClass: string, tableData: object|null])\r\n{\r\n const { blockID, pageID, setMarkup } = props;\r\n const [header, setHeader] = useState<HeaderProperties|null>(null);\r\n const [tableData, setTableData] = useState<object|null>(null);\r\n const [cssClass, setCssClass] = useState<string>(\"\");\r\n const ticker = useMemo(() => document.getElementsByTagName(\"ve-fundticker\")[0]?.innerHTML, []);\r\n\r\n useEffect(\r\n function () {\r\n (async () => {\r\n const response = await fetchBlockData({\r\n url: `/Main/HistoPricesBlock/GetContent/?blockid=${blockID}&pageid=${pageID}${ticker ? \"&ticker=\" + ticker : \"\"}`,\r\n isJson: true,\r\n setMarkup: setMarkup\r\n });\r\n setHeader( prevHeader => {\r\n return {\r\n title: response.data.Title,\r\n asOfDateText: response.data.AsOfDateText,\r\n asOfDate: response.data.AsOfDate,\r\n ticker: ticker,\r\n }\r\n });\r\n\r\n const columns = response.data.Columns.map((col: IColumnData) => {\r\n return {\r\n headerText: col.HeaderText,\r\n columnName: col.ColumnName,\r\n };\r\n });\r\n\r\n setTableData({\r\n columns: columns,\r\n prices: response.data.PricesViewModel,\r\n currencyName: response.data.CurrencyName,\r\n ChartUrl: response.data.ChartUrl,\r\n ChartUrlTarget: response.data.ChartUrlTarget,\r\n DownloadUrl: response.data.DownloadUrl,\r\n DownloadUrlTarget: response.data.DownloadUrlTarget\r\n });\r\n setMarkup(false);\r\n setCssClass(response.data.CssClass);\r\n })().catch(() => console.error(`An error occured while loading block: ${blockID}`));\r\n },\r\n [blockID]\r\n );\r\n\r\n return [header, cssClass, tableData];\r\n}\r\n","import { useState, useEffect, useLayoutEffect } from \"react\";\r\n\r\n/**\r\n * When a component is rendered above the viewport, it results in the current scroll position being offset by the height difference.\r\n * This custom hook will adjust for the height of the component before every paint.\r\n * @param {HTMLElement} element\r\n */\r\nfunction useAutoScrollUp(element: HTMLElement) {\r\n const [height, setHeight] = useState(0);\r\n\r\n useEffect(() => {\r\n element && setHeight(element.getBoundingClientRect()?.height);\r\n }, [element]);\r\n\r\n useLayoutEffect(() => {\r\n if (!element || !height) return;\r\n const elemBoundingRect = element.getBoundingClientRect();\r\n const newHeight = elemBoundingRect.height;\r\n const heightIncrease = newHeight - height;\r\n\r\n //compensate scrolling only if elem above viewport (scrolling up)\r\n if (elemBoundingRect.top < 50) {\r\n window.scrollBy(0, heightIncrease);\r\n }\r\n\r\n setHeight((height) => height + heightIncrease);\r\n });\r\n}\r\n\r\nexport default useAutoScrollUp;","import React from \"react\";\r\n\r\nexport interface FetchBlockDataInterface {\r\n url: string,\r\n isJson?: Boolean,\r\n setMarkup?: Function | null\r\n}\r\n\r\ndeclare global {\r\n interface Window {\r\n reactlang: string | null | undefined;\r\n reactctr: string | null | undefined;\r\n isapiepieditmode: string | null | undefined;\r\n isapilatestversionpreview: string | null | undefined;\r\n epiprojectid: string | null | undefined;\r\n contextmode: string | null | undefined;\r\n }\r\n}\r\n\r\nwindow.reactlang = document.getElementsByTagName(\"ve-language\")[0]?.innerHTML;\r\nwindow.reactctr = document.getElementsByTagName(\"ve-country\")[0]?.innerHTML;\r\nwindow.isapiepieditmode = document.getElementsByTagName(\"ve-is-epi-edit-mode\")[0]?.innerHTML;\r\nwindow.isapilatestversionpreview = document.getElementsByTagName(\"ve-is-latest-version-preview\")[0]?.innerHTML;\r\nwindow.epiprojectid = document.getElementsByTagName(\"ve-epi-project-id\")[0]?.innerHTML;\r\nwindow.contextmode = document.getElementsByTagName(\"ve-context-mode\")[0]?.innerHTML;\r\n\r\n/**\r\n * Fetches data for a given API endpoint. Expects any get parameters to be encoded in the url.\r\n * If JSON is expected, returns the JSON object. If not returns the result object.\r\n * @param {FetchBlockDataInterface} options\r\n * @returns {any|Response}\r\n */\r\nexport async function fetchBlockData({ url, isJson = true, setMarkup = null }: FetchBlockDataInterface): Promise<any | Response> {\r\n\r\n try {\r\n let additionalParams = window.isapiepieditmode || window.isapilatestversionpreview\r\n ? `&epieditmode=${window.isapiepieditmode}&latest=${window.isapilatestversionpreview}`\r\n : '';\r\n if(window.epiprojectid){\r\n additionalParams += `&epiprojects=${window.epiprojectid}`;\r\n }\r\n if(window.contextmode){\r\n additionalParams += `&contextmode=${window.contextmode}`;\r\n }\r\n const request = await fetch(`${url}${url.indexOf('?') !== -1 ? '&' : '?'}reactlang=${window.reactlang}&reactctr=${window.reactctr}${additionalParams}`);\r\n const response: Response|any = isJson ? await request.json() : request;\r\n \r\n return response;\r\n } catch (err) {\r\n console.log(`Error while fetching block data! URL: ${url}`);\r\n\r\n typeof (setMarkup) === \"function\" && setMarkup(\r\n <div className=\"component-load-failed\">An error occured when loading data.</div>\r\n );\r\n\r\n throw new Error(err as string);\r\n }\r\n}"],"names":["HistoPricesInner","markup","header","cssClass","tableData","prices","className","FundTable","headerData","FETable","navState","setNavState","useState","tableInfo","setTableInfo","useEffect","navDailyChange","NavDailyChangeValue","TableInformation","MapTableData","tableColumns","tableRows","NavChangeItemOne","NavDailyChange","NavDailyChangePercentage","columns","map","column","i","css","value","headerText","Key","DisplayTicker","currencyName","NavCurrent","NAVYTDPerc","DownloadUrl","DownloadUrlTarget","ChartUrl","ChartUrlTarget","GrossExpenseRatio","HistoPricesBlock","props","element","rootElement","blockID","dataset","blockid","pageID","pageid","setMarkup","template","isNaN","setHeader","setTableData","setCssClass","ticker","useMemo","document","getElementsByTagName","innerHTML","response","url","isJson","prevHeader","title","data","Title","asOfDateText","AsOfDateText","asOfDate","AsOfDate","Columns","col","HeaderText","columnName","ColumnName","PricesViewModel","CurrencyName","CssClass","catch","console","error","useHistoPricesBlock","height","setHeight","getBoundingClientRect","useLayoutEffect","elemBoundingRect","heightIncrease","top","window","scrollBy","async","fetchBlockData","additionalParams","isapiepieditmode","isapilatestversionpreview","epiprojectid","contextmode","request","fetch","indexOf","reactlang","reactctr","json","err","log","Error"],"sourceRoot":""}