export let instance: any; /* eslint-disable */ function inject() { const intercomSettings = {}; (function() { let w: any = window; let ic: any = w.Intercom; if (typeof ic === 'function') { ic('reattach_activator'); ic('update', intercomSettings); } else { let d = document; let i = function() { (i as any).c(arguments); }; (i as any).q = []; (i as any).c = function(args: any) { (i as any).q.push(args); }; w.Intercom = i; instance = i; // @ts-ignore function l() { let s = d.createElement('script'); s.type = 'text/javascript'; s.async = true; s.src = `https://widget.intercom.io/widget/${process.env.INTERCOM_ID}`; let x = d.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x); } if (w.attachEvent) { w.attachEvent('onload', l); } else { w.addEventListener('load', l, false); } } })(); } /* tslint:enable */ export function getInstance(): any { if (typeof instance === 'function') { return instance; } return null; } export function initialize(): void { if (!process.env.INTERCOM_ID) { return; } inject(); const Intercom = getInstance(); if (typeof Intercom === 'function') { Intercom('boot', { app_id: process.env.INTERCOM_ID }); } }