diff --git a/.betterer.results b/.betterer.results index fd64c63eea8..aec2e678222 100644 --- a/.betterer.results +++ b/.betterer.results @@ -1320,10 +1320,6 @@ exports[`better eslint`] = { [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"] ], - "public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Unexpected any. Specify a different type.", "1"] - ], "public/app/core/services/echo/backends/analytics/RudderstackBackend.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"], [0, 0, 0, "Unexpected any. Specify a different type.", "1"], diff --git a/public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts b/public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts index 433d4582aff..78db86015cd 100644 --- a/public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts +++ b/public/app/core/services/echo/backends/analytics/ApplicationInsightsBackend.ts @@ -7,8 +7,6 @@ import { PageviewEchoEvent, } from '@grafana/runtime'; -import { loadScript } from '../../utils'; - interface ApplicationInsights { trackPageView: () => void; trackEvent: (event: { name: string; properties?: Record }) => void; @@ -39,10 +37,12 @@ export class ApplicationInsightsBackend implements EchoBackend { - const init = new (window as any).Microsoft.ApplicationInsights.ApplicationInsights(applicationInsightsOpts); - window.applicationInsights = init.loadAppInsights(); - }); + System.import(url) + .then((m) => (m.default ? m.default : m)) + .then(({ ApplicationInsights }) => { + const init = new ApplicationInsights(applicationInsightsOpts); + window.applicationInsights = init.loadAppInsights(); + }); } addEvent = (e: PageviewEchoEvent | InteractionEchoEvent) => {