{"version":3,"sources":["webpack://@verndale/toolkit/./src/js/modules/alert.js"],"names":[],"mappings":"6KAEA,MAAM,SAAe,KAAU,CAC7B,eAAgB,CACd,KAAK,SAAS,CAChB,MAEM,WAAU,CACd,GAAI,CAEA,KAAM,GAAW,KAAM,MADH,OAAM,GAAG,KAAK,GAAG,QAAQ,eAAe,GAC/B,KAAK,EAClC,KAAK,UAAY,EACjB,KAAK,YAAY,CACrB,MAAC,CACG,KAAK,UAAY,CAAC,EAClB,KAAK,GAAG,OAAO,CACnB,CACF,CAEA,aAAa,CACX,KAAM,GAAe,KAAK,UAAU,IAAI,GACf;AAAA,eACd,EAAG,UAAY,WAAW,EAAG,UAAU,gBAAgB,EAAG,UAAU,UAAY;AAAA;AAAA;AAAA,0BAGrE,EAAG,KAAO;AAAA,mEAC+B,EAAG,KAAK,aAAa,EAAG,KAAK,SAAW;AAAA,8DAC7C,EAAG;AAAA;AAAA,4DAEL,EAAG;AAAA;AAAA,gBAE/C,EAAG,UAAY,IAAM;AAAA,SAGhC,EAAE,KAAK,EAAE,EACV,KAAK,GAAG,UAAY,CACtB,CACF,CAEA,QAAe,C","file":"scripts/563.a1655ce2601ff58104e1.js","sourcesContent":["import { Component } from '@verndale/core';\n\nclass Module extends Component {\n setupDefaults() {\n this.getAlert();\n }\n\n async getAlert(){\n try {\n const alert = await fetch(`${this.el.dataset.alertEndpoint}`)\n const response = await alert.json();\n this.alertList = response;\n this.renderAlert();\n } catch (e){\n this.alertList = []\n this.el.remove();\n }\n }\n\n renderAlert(){\n const alertElement = this.alertList.map(el => {\n const alertContent = `\n <${el.AlertLink ? `a href=\"${el.AlertLink.Url}\" target=\"${el.AlertLink.Target}\"` : 'div'} class=\"alert-banner\">\n
\n
\n ${el.Icon ? `\n \"${el.Icon.Alt}\"/` : ''}\n ${el.PrimaryCopy}\n
\n ${el.SecondaryCopy}\n
\n \n `;\n return alertContent\n }).join('')\n this.el.innerHTML = alertElement\n }\n}\n\nexport default Module;\n"],"sourceRoot":""}