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SAASC,iBAAiB,+BAA+B,GAAG2G,YAAYJ,GAGxExG,SAAS+B,KAAK6E,YAAYJ,GAK1BF,IACAA,EAAiBI,MAAMC,OAAS,QAChChB,GAAa7E,UAAUC,IAAI,WAG/ByF,EAAS3C,iBAAiB,SAAS,IAAMiC,OAAO/B,EAAE4B,GAAaI,QAAQ,UACvE,IAAIH,GAAYb,SAAQrD,GAAUA,EAAOmC,iBAAiB,QAASgC,KACnEH,GAAmB7B,iBAAiB,SAAS,IAAMiC,OAAO/B,EAAE4B,GAAaI,QAAQ,SAAQ,IAI7FhC,EAAE4B,GAAaY,GAAG,mBAAmB,KACjC,IAAIC,EAAWxG,SAAS4D,eAAe,YACvC4C,GAAUK,SAEV,IAAIjB,GAAYb,SAAQrD,GAAUA,EAAOoF,oBAAoB,QAASjB,KAGlES,IACAA,EAAiBI,MAAMC,OAAS,IAChChB,GAAa7E,UAAU+F,OAAO,UAClC,IAIJf,OAAO/B,EAAE4B,GAAaY,GAAG,oBAAoB,KACzCxC,EAAE,+BAA+BgD,OAAOjD,GAAMgC,OAAO/B,EAAE4B,GAAaI,QAAQ,SAAWD,OAAOkB,SAAQ,IAS1G,MAAMC,EAAiBC,KAAS,KAC5B,MAAMC,EAAerB,OAAOsB,YAAc,EAE1C,IADoBtB,OAAOuB,aAAerH,SAASsH,gBAAgBC,WACjDJ,EAMd,MAH2B,oBAAfjD,aAA8BsD,EAAAA,EAAAA,mBAAkBxH,UAE5DsG,EAAiBxF,UAAUC,IAAI,WACxB+E,OAAOgB,oBAAoB,SAAUG,EAChD,GACD,KAEHnB,OAAOjC,iBAAiB,SAAUoD,GAElCA,GACJ,CAnTIQ,EACJ,CAmWAC,E","sources":["webpack://vaneckweb/../Static/au/js/insights/src/override/expandable-menu/share-menu.js","webpack://vaneckweb/../Static/au/js/insights/src/override/expandable-menu/expandable-nav.js"],"sourcesContent":["export function renderShareMenu() {\r\n //generate the mailto link.\r\n //Get the title -- most probably the H1 of the page.\r\n const pageTitle = document.querySelectorAll(\"h1\")[0]?.textContent ?? \"\";\r\n const URLencodedpageTitle = encodeURI(pageTitle);\r\n //Get the current location\r\n const currentURL = document.location.href;\r\n const mailToLink = `mailto:?subject=Learn%20more%20about%20${URLencodedpageTitle}&body=${currentURL}`;\r\n\r\n //LinkedInLink\r\n const linkedInLink = `https://www.linkedin.com/cws/share?url=${currentURL}`;\r\n //TwitterLink\r\n const twitterLink = `https://twitter.com/intent/tweet?text=${URLencodedpageTitle}&url=${currentURL}`;\r\n const facebookLink = `https://www.facebook.com/sharer.php?u=${currentURL}`;\r\n\r\n return `
\r\n \r\n \r\n
\r\n
    \r\n
  • \r\n \r\n Share Page\r\n \r\n This link opens in a new window.\r\n \r\n
\r\n \r\n
  • \r\n \r\n ${getSVG(\"linkedin\")}\r\n LinkedIn\r\n \r\n This link opens in a new window.\r\n \r\n \r\n
  • \r\n
  • \r\n \r\n ${getSVG(\"twitter\")}\r\n Twitter\r\n \r\n This link opens in a new window.\r\n \r\n \r\n
  • \r\n
  • \r\n \r\n ${getSVG(\"facebook\")}\r\n Facebook\r\n \r\n This link opens in a new window.\r\n \r\n \r\n
  • \r\n
  • \r\n \r\n ${getSVG(\"email\")}\r\n Email\r\n \r\n This link opens in a new window.\r\n \r\n \r\n
  • \r\n \r\n
    \r\n \r\n \r\n \r\n `;\r\n\r\n}\r\n\r\n/**\r\n * Get's the svg based on the SVG name.\r\n * @param {string} name\r\n * @returns\r\n */\r\nexport function getSVG(name) {\r\n let markup = \"\";\r\n switch (name) {\r\n case \"linkedin\":\r\n markup = `\r\n LinkedIn\r\n \r\n `;\r\n break;\r\n case \"facebook\":\r\n markup = `\r\n Facebook\r\n \r\n `;\r\n break;\r\n case \"twitter\":\r\n markup = `\r\n Twitter\r\n \r\n `;\r\n break;\r\n case \"email\":\r\n markup = `\r\n Email\r\n \r\n `;\r\n }\r\n\r\n return markup;\r\n}\r\n","/* This is the exandable menu component which is **REWRITTEN** based on original React code, since we cannot reuse TS code here. */\r\n\r\nimport { renderShareMenu } from \"./share-menu\";\r\nimport debounce from \"lodash/debounce\";\r\n\r\nimport { loadZenDeskScript } from \"../lazy-scripts\";\r\n\r\nlet expanded = true;\r\nlet queuedFunctions = [];\r\nasync function init() {\r\n //get the parent element to render\r\n const parentElement = document.getElementsByTagName(\"ve-expandablemenu\")[0];\r\n\r\n //Do nothing if the utility menu itself is not there.\r\n if (typeof parentElement === \"undefined\") return;\r\n\r\n //update the invest button text\r\n await processInvestAndSubscribeLink(parentElement);\r\n await updateLinksForInsightsFunds(parentElement);\r\n\r\n const expandableMenu = renderExpandableMenu({});\r\n parentElement.innerHTML = expandableMenu;\r\n bindEventListeners();\r\n}\r\n\r\n//The base blocks, each of these blocks represents one of the square blocks.\r\nlet squareBlocks = [\r\n //{\r\n // name: \"Explore More\",\r\n // attributes: {\r\n // id: \"expand-close-button\"\r\n // },\r\n // gtmAttribute: \"sidenav-openclose\",\r\n // expandable: true,\r\n // expandedLabel: \"Close\",\r\n // icon: `/globalassets/home/us/common/icons/explore-more.svg`,\r\n // expandedIcon: `/globalassets/home/us/common/icons/close.svg`,\r\n //},\r\n {\r\n name: \"Invest\",\r\n attributes: {\r\n id: \"sidebar-invest-button\"\r\n },\r\n gtmAttribute: \"sidenav-invest\",\r\n icon: `/globalassets/home/us/common/icons/invest-now-icon.svg`,\r\n type: \"invest\",\r\n },\r\n {\r\n name: \"Share\",\r\n gtmAttribute: \"sidenav-share\",\r\n attributes: {\r\n id: \"share-widget-button\",\r\n },\r\n icon: `/globalassets/home/us/common/icons/share.svg`,\r\n childItem: renderShareMenu,\r\n },\r\n {\r\n name: \"Insights\",\r\n gtmAttribute: \"sidebar-insights-button\",\r\n icon: `/globalassets/home/us/common/icons/insights.svg`,\r\n type: \"insights\",\r\n },\r\n {\r\n name: \"Subscribe\",\r\n gtmAttribute: \"sidenav-subscribe\",\r\n attributes: {\r\n id: \"subscribe-widget-button\",\r\n },\r\n icon: `/globalassets/home/us/common/icons/subscribe.svg`,\r\n type: \"subscribe\",\r\n link: \"/subscribe\"\r\n },\r\n //{\r\n // name: \"Funds\",\r\n // gtmAttribute: \"sidenav-funds\",\r\n // icon: `/globalassets/home/us/common/icons/funds.svg`,\r\n // type: \"funds\",\r\n //},\r\n {\r\n name: \"Help\",\r\n attributes: {\r\n id: \"sidebar-help-button\"\r\n },\r\n gtmAttribute: \"sidebar-help\",\r\n icon: `/globalassets/home/us/common/icons/help-icon.svg`,\r\n childItem: function () {\r\n //Add a class to the back-to-top button to anchor it back to the bottom of the screen.\r\n const bttButton = document.querySelectorAll(\".scroll-to-top.back-to-top.btn\");\r\n if (!bttButton || !bttButton.length || bttButton.length == 0) return \"\";\r\n bttButton[0].classList.add(\"anchored-to-bottom\");\r\n return \"\";\r\n }\r\n },\r\n];\r\n\r\nfunction processInvestAndSubscribeLink(expandableMenuTag) {\r\n\r\n const deleteBlock = (blockName) => squareBlocks.splice(blockName, 1); //remove if no link\r\n\r\n const investBlockIndex = squareBlocks.findIndex((x) => x.type == \"invest\");\r\n\r\n //check if the link exists and then update the button, if not remove the button\r\n (function () {\r\n //get the linkcontent from the page\r\n const linkContentMarkup = document.querySelectorAll(\"ve-secondarynavcontent ve-linkcontent\");\r\n if (linkContentMarkup.length == 0) return deleteBlock(investBlockIndex);\r\n\r\n const button = linkContentMarkup[0].querySelector(\"button[data-toggle=modal]\");\r\n if (!button) return deleteBlock(investBlockIndex);\r\n\r\n const buttonText = button.innerHTML;\r\n squareBlocks[investBlockIndex].name = buttonText;\r\n\r\n })();\r\n\r\n const subscribeBlockIndex = squareBlocks.findIndex((x) => x.type == \"subscribe\");\r\n const isAuFundPage = document.body.classList.contains(\"au-portfolio-page\");\r\n if (isAuFundPage) {\r\n deleteBlock(subscribeBlockIndex);\r\n }\r\n\r\n}\r\n\r\nasync function updateLinksForInsightsFunds(expandableMenuTag) {\r\n /**\r\n * Overrides are not implemented but useful later if someone wants to override the link for a specific page.\r\n */\r\n\r\n //get the override insights link if available\r\n let insightsLink = document.getElementsByTagName(\"ve-insightslink\")?.item(0)?.innerHTML ?? \"\";\r\n let insightsLinkTarget = \"_self\";\r\n\r\n //Update the insights link if available.\r\n const insightsBlockIndex = squareBlocks.findIndex((x) => x.type == \"insights\");\r\n if (insightsLink === \"\") {\r\n squareBlocks.splice(insightsBlockIndex, 1); //remove if no link\r\n } else {\r\n squareBlocks[insightsBlockIndex].link = insightsLink;\r\n squareBlocks[insightsBlockIndex].target = insightsLinkTarget;\r\n }\r\n}\r\n\r\nfunction renderExpandableMenu() {\r\n const visibleClass = \"\"; //was a react state before, set initial now = not visible;\r\n return `
    \r\n
    \r\n ${renderBlocks(squareBlocks, expanded)}\r\n
    \r\n
    `;\r\n}\r\n\r\n/**\r\n * Takes in an array of blocks representing the intial state and renders it.\r\n * @param {any} blocks\r\n */\r\nfunction renderBlocks(blocks, expanded = true) {\r\n //iterate through blocks and build markup array.\r\n return blocks.reduce((prev, block) => {\r\n //block.expandable = if the block can be used to expand/shrink the menu. i.e. if it is the main block used to toggle between the expanded and contracted states.\r\n const hideClass = block.expandable || expanded ? \"show\" : \"\"; //main block is always shown\r\n const canBeHiddenClass = !block.expandable ? \"can-be-hidden\" : \"\"; //denotes that the block can be hidden in the contracted state\r\n\r\n const text = expanded && block.expandable ? block.expandedLabel : block.name;\r\n const toggleText = !expanded && block.expandable ? block.expandedLabel : block.name;\r\n\r\n const childItem = block.childItem ?? false;\r\n const activeClass = expanded && block.expandable ? \"opened\" : \"\";\r\n\r\n const icon = (expanded && block.expandable ? block.expandedIcon : block.icon) ?? \"\";\r\n const toggleIcon = (!expanded && block.expandable ? block.expandedIcon : block.icon) ?? \"\";\r\n\r\n const childMarkup = typeof childItem === \"function\" ? childItem() : \"\";\r\n\r\n const idAttr = block.attributes?.id ? `id=\"${block.attributes.id}\"` : \"\";\r\n const gtmAttr = block.gtmAttribute ? `data-ve-gtm=\"${block.gtmAttribute}\"` : \"\";\r\n\r\n\r\n const blockInnerMarkup = `\r\n
    ${text} Icon
    \r\n
    ${text}
    \r\n ${childMarkup}`;\r\n\r\n if (block.link) {\r\n return prev + `${blockInnerMarkup}`;\r\n }\r\n return prev + blockInnerMarkup;\r\n }, \"\");\r\n}\r\n\r\nasync function bindEventListeners() {\r\n\r\n //Invest button -- this should trigger the invest modal.\r\n const button = document.getElementById(\"sidebar-invest-button\");\r\n button && button.addEventListener(\"click\", e => $(\"#id-how-to-buy-etf-modal\").modal());\r\n\r\n //Help button\r\n await bindHelpButton();\r\n\r\n //hide and show the menu when toggle button is clicked.\r\n const toggleBlocks = document.querySelectorAll(\".expandable-nav__block:not(.can-be-hidden)\");\r\n toggleBlocks.forEach((x) => x.addEventListener(\"click\", toggleExpanded));\r\n function toggleExpanded(e) {\r\n\r\n //get all items that can be hidden\r\n const hidables = Array.from(document.getElementsByClassName(\"can-be-hidden\"));\r\n\r\n //toggle the class\r\n hidables.forEach((x) => x.classList.toggle(\"show\"));\r\n\r\n //flip any expandable items's icon and text\r\n //get unhidable items\r\n toggleBlocks.forEach((x) => {\r\n //flip the text, if available.\r\n const textElement = x.querySelectorAll(\".expandable-nav__text\")?.item(0);\r\n if (textElement) {\r\n const label = textElement.dataset.expandableLabel;\r\n if (label && label != \"\") {\r\n textElement.dataset.expandableLabel = textElement.textContent;\r\n textElement.textContent = label;\r\n }\r\n }\r\n\r\n //flip the icon, if available.\r\n const iconElement = x.querySelectorAll(\".expandable-nav__block-icon img\")?.item(0);\r\n if (iconElement) {\r\n const label = iconElement.dataset.expandableSrc;\r\n if (label && label != \"\") {\r\n iconElement.dataset.expandableSrc = iconElement.attributes.getNamedItem(\"src\").value;\r\n iconElement.setAttribute(\"src\", label);\r\n }\r\n }\r\n });\r\n\r\n //set Global State;\r\n expanded = !expanded;\r\n }\r\n\r\n //Events for the share widget\r\n const expandCloseButton = document.querySelectorAll(\".expandable-nav #expand-close-button\").item(0);\r\n const shareWidget = document.querySelectorAll(\".expandable-nav #share-widget-button\").item(0);\r\n const subscribeWidget = document.querySelectorAll(\".expandable-nav #subscribe-widget-button\").item(0);\r\n const allButtons = document.querySelectorAll(\".expandable-nav .expandable-nav__block\");\r\n\r\n //hidelistner\r\n const hideListener = e => window.$(shareWidget).popover(\"hide\");\r\n\r\n //To trigger the share popover.\r\n window.$(shareWidget).popover({\r\n content: window.$(\".expandable-nav #share-widget-popover-content\"),\r\n container: window.$(\".expandable-nav .expandable-nav__blocks\"),\r\n title: \"\",\r\n html: true,\r\n placement: \"left\",\r\n trigger: \"click\",\r\n });\r\n\r\n //ref for the parent container for the share popover\r\n const expandableNavRef = document.querySelectorAll(\".expandable-nav .expandable-nav__blocks\").item(0).parentElement;\r\n //show a backdrop when the popover is triggered.\r\n window.$(shareWidget).on(\"show.bs.popover\", () => {\r\n let backdrop = document.createElement(\"div\");\r\n backdrop.id = \"backdrop\";\r\n backdrop.classList.add(\"modal-backdrop\", \"in\", \"show\");\r\n backdrop.style.zIndex = \"10000\";\r\n\r\n //For very old layouts, z-index issues need to be fixed.\r\n if (document.querySelectorAll(\".mainWrapper > .container-m\").length > 0) {\r\n document.querySelectorAll(\".mainWrapper > .container-m\")[0].appendChild(backdrop);\r\n }\r\n else {\r\n document.body.appendChild(backdrop);\r\n }\r\n\r\n\r\n //adjust the z-index of the menu so it is infront of the backdrop.\r\n if (expandableNavRef) {\r\n expandableNavRef.style.zIndex = \"10100\";\r\n shareWidget?.classList.add(\"active\");\r\n }\r\n //hide the popover when the user clicks the backdrop or other blocks.\r\n backdrop.addEventListener(\"click\", () => window.$(shareWidget).popover(\"hide\"));\r\n [...allButtons].forEach(button => button.addEventListener(\"click\", hideListener));\r\n expandCloseButton?.addEventListener(\"click\", () => window.$(shareWidget).popover(\"hide\"))\r\n });\r\n\r\n //remove the backdrop when the popover is hidden.\r\n $(shareWidget).on(\"hide.bs.popover\", () => {\r\n let backdrop = document.getElementById(\"backdrop\");\r\n backdrop?.remove();\r\n\r\n [...allButtons].forEach(button => button.removeEventListener(\"click\", hideListener));\r\n\r\n //adjust the Expandable Nav so the z-index is back.\r\n if (expandableNavRef) {\r\n expandableNavRef.style.zIndex = \"0\";\r\n shareWidget?.classList.remove(\"active\");\r\n }\r\n });\r\n\r\n //print listener\r\n window.$(shareWidget).on(\"shown.bs.popover\", () => {\r\n $(\".share-widget__action.print\").click((e) => window.$(shareWidget).popover(\"hide\") && window.print());\r\n });\r\n\r\n //subscribe click event\r\n /* window.$(subscribeWidget).click((e) => {\r\n return window.$(\"#default-state-utility-menu\").modal(\"show\");\r\n });*/\r\n\r\n //Scroll listener to only show it below the fold.\r\n const scrollListener = debounce(() => {\r\n const heightOffset = window.innerHeight / 4;\r\n const ScrolledTop = window.pageYOffset || document.documentElement.scrollTop\r\n if (ScrolledTop > heightOffset) {\r\n\r\n //Load zendesk scripts when user scrolls\r\n if (typeof (zEACLoaded) == \"undefined\") { loadZenDeskScript(document); }\r\n\r\n expandableNavRef.classList.add(\"visible\");\r\n return window.removeEventListener(\"scroll\", scrollListener);\r\n }\r\n }, 100);\r\n\r\n window.addEventListener(\"scroll\", scrollListener);\r\n\r\n scrollListener(); //trigger it once anyway, incase the page is already scrolled down.\r\n}\r\n\r\nasync function bindHelpButton() {\r\n const addClickListener = () => {\r\n\r\n //script is loaded but the widget is still not loaded, wait 100.\r\n if (typeof (zEACLoaded) == \"undefined\" || typeof (zE.hide) == \"undefined\") return setTimeout(addClickListener, 100);\r\n\r\n //hide the current button\r\n zE.hide()\r\n\r\n //add listerner to the tab button\r\n const helpButton = document.getElementById(\"sidebar-help-button\")\r\n helpButton.addEventListener(\"click\", e => {\r\n zE.show(); zE('webWidget', 'open');\r\n })\r\n\r\n zE('webWidget:on', 'close', function () {\r\n //hide the current button\r\n zE.hide()\r\n });\r\n }\r\n\r\n if (typeof (zEACLoaded) != \"undefined\") return addClickListener();\r\n //listen for the script load event and then add the click listener\r\n document.addEventListener(\"lazyScriptLoaded\", e => {\r\n if (e.detail.scriptName && e.detail.scriptName === \"ze-snippet\") return addClickListener();\r\n })\r\n}\r\n\r\nasync function getFundPageLinks({ pageID, ticker, categoryID }) {\r\n const response = await fetchBlockData({\r\n url: `/main/portfoliopage/getussidelinks/?ticker=${ticker ?? \"\"}&contentId=${pageID}&categoryId=${categoryID ?? \"\"}`,\r\n });\r\n return await response;\r\n}\r\n\r\nasync function fetchBlockData({ url }) {\r\n try {\r\n const request = await fetch(url);\r\n const response = await request.json();\r\n console.log(response);\r\n return response;\r\n } catch (err) {\r\n console.log(`Error while fetching expandable nav data! URL: ${url}`);\r\n throw new Error(err);\r\n }\r\n}\r\n\r\ninit();\r\n"],"names":["getSVG","name","markup","expanded","squareBlocks","attributes","id","gtmAttribute","icon","type","childItem","pageTitle","document","querySelectorAll","textContent","URLencodedpageTitle","encodeURI","currentURL","location","href","mailToLink","twitterLink","facebookLink","link","bttButton","length","classList","add","async","parentElement","getElementsByTagName","deleteBlock","blockName","splice","investBlockIndex","findIndex","x","linkContentMarkup","button","querySelector","buttonText","innerHTML","subscribeBlockIndex","body","contains","processInvestAndSubscribeLink","insightsLink","item","insightsBlockIndex","target","updateLinksForInsightsFunds","expandableMenu","blocks","arguments","undefined","reduce","prev","block","hideClass","expandable","canBeHiddenClass","text","expandedLabel","toggleText","activeClass","expandedIcon","toggleIcon","childMarkup","idAttr","gtmAttr","blockInnerMarkup","renderBlocks","getElementById","addEventListener","e","$","modal","addClickListener","zEACLoaded","zE","hide","setTimeout","show","detail","scriptName","bindHelpButton","toggleBlocks","toggleExpanded","Array","from","getElementsByClassName","forEach","toggle","textElement","label","dataset","expandableLabel","iconElement","expandableSrc","getNamedItem","value","setAttribute","expandCloseButton","shareWidget","allButtons","hideListener","window","popover","content","container","title","html","placement","trigger","expandableNavRef","on","backdrop","createElement","style","zIndex","appendChild","remove","removeEventListener","click","print","scrollListener","debounce","heightOffset","innerHeight","pageYOffset","documentElement","scrollTop","loadZenDeskScript","bindEventListeners","init"],"sourceRoot":""}