{"version":3,"names":["sendCustomEvent","component","window","trackEvent","name","EventTypes","COMPONENT_REGISTER","tagName","toLowerCase","componentId","id","environment","version","host","location","err","console","log","add","pipeline","set","config","getBoolean","remove","delete","addComponent","Pipeline.add","removeComponent","Pipeline.remove"],"sources":["src/components/core/global/pipeline.ts","src/components/core/utils/pipeline.ts"],"sourcesContent":["import { EventTypes, environment, version } from './AppInsights/constants';\nimport { WindowGlobal } from '../types/globalTypes';\n\n/**\n * Send custom event to AppInsights\n * @param {string} component The reference to the component\n * @returns {void}\n * @hidden\n */\nconst sendCustomEvent = (component: HTMLElement): void => {\n try {\n (window as WindowGlobal)['AppInsights'].trackEvent(\n {\n name: EventTypes.COMPONENT_REGISTER,\n },\n {\n component: component.tagName.toLowerCase(),\n componentId: component.id,\n environment,\n version,\n host: window.location.host,\n }\n );\n } catch (err) {\n // eslint-disable-next-line no-console\n console.log('[APP INSIGHTS] Could not send event', err);\n }\n};\n\n/**\n * Add the component to the pipeline and send component events to AppInsights\n * @param {HTMLElement} component The component element\n * @returns {void}\n * @hidden\n */\nexport function add(component: HTMLElement): void {\n (window as WindowGlobal)['ArmDesignSystem'].pipeline.set(component.id, component.tagName.toLowerCase());\n\n // Disable sending events to AppInsights during unit tests\n if (!(window as WindowGlobal)['ArmDesignSystem'].config.getBoolean('_isTesting')) {\n sendCustomEvent(component);\n }\n}\n\n/**\n * Remove the component from the pipeline\n * @param {HTMLElement} component The component element\n * @returns {void}\n * @hidden\n */\nexport function remove(component: HTMLElement): void {\n (window as WindowGlobal)['ArmDesignSystem'].pipeline.delete(component.id);\n}\n","import * as Pipeline from '../global/pipeline';\n\n/**\n * Add a component to the ADS pipeline\n * @param {HTMLElement} component The component element\n * @return {void}\n */\nexport const addComponent = (component: HTMLElement): void => {\n Pipeline.add(component);\n};\n\n/**\n * Remove a component from the ADS pipeline\n * @param {HTMLElement} component The component element\n * @return {void}\n */\nexport const removeComponent = (component: HTMLElement): void => {\n Pipeline.remove(component);\n};\n"],"mappings":"kDASA,MAAMA,EAAmBC,IACvB,IACGC,OAAwB,eAAeC,WACtC,CACEC,KAAMC,EAAWC,oBAEnB,CACEL,UAAWA,EAAUM,QAAQC,cAC7BC,YAAaR,EAAUS,GACvBC,cACAC,UACAC,KAAMX,OAAOY,SAASD,M,CAG1B,MAAOE,GAEPC,QAAQC,IAAI,sCAAuCF,E,YAUvCG,EAAIjB,GACjBC,OAAwB,mBAAmBiB,SAASC,IAAInB,EAAUS,GAAIT,EAAUM,QAAQC,eAGzF,IAAMN,OAAwB,mBAAmBmB,OAAOC,WAAW,cAAe,CAChFtB,EAAgBC,E,CAEpB,C,SAQgBsB,EAAOtB,GACpBC,OAAwB,mBAAmBiB,SAASK,OAAOvB,EAAUS,GACxE,C,MC7Cae,EAAgBxB,IAC3ByB,EAAazB,EAAU,E,MAQZ0B,EAAmB1B,IAC9B2B,EAAgB3B,EAAU,S","ignoreList":[]}