@equinor/subsurface-app-management 3.1.3 → 3.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as i}from"react/jsx-runtime";import{useEffect as e}from"react";import{ClickAnalyticsPlugin as n}from"@microsoft/applicationinsights-clickanalytics-js";import{ReactPlugin as o,AppInsightsContext as t}from"@microsoft/applicationinsights-react-js";import{ApplicationInsights as s}from"@microsoft/applicationinsights-web";import{getApplicationInsightsInstrumentationKey as r}from"../utils/environment.js";import{l as a}from"../_virtual/lodash.js";const d=new o,c=new n,p=12e5,m=r(import.meta.env.VITE_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY),l=m?new s({config:{connectionString:m,extensions:[d,c],extensionConfig:{[c.identifier]:{autoCapture:!0,dropInvalidEvents:!0}},autoTrackPageVisitTime:!0,enableAutoRouteTracking:!0,sessionRenewalMs:p,sessionExpirationMs:p}}):void 0;l?.loadAppInsights();const w=a.debounce((()=>{l?l.trackEvent({name:"Resolution",properties:{"Window Resolution":window.innerWidth+"x"+window.innerHeight,"Screen Resolution":screen.width+"x"+screen.height}}):console.warn('[SAM]: ApplicationInsightsProvider - "appInsights" is undefined, did you set APPLICATION_INSIGHTS_INSTRUMENTATION_KEY?')}),5e3),I=({children:n})=>(e((()=>(window.addEventListener("load",w),window.addEventListener("resize",w),()=>{window.removeEventListener("resize",w),window.removeEventListener("load",w)})),[]),i(t,{value:d,children:n}));export{I as ApplicationInsightsProvider};
|
|
@@ -3,11 +3,11 @@ interface EnvVariables {
|
|
|
3
3
|
NAME: string;
|
|
4
4
|
ENVIRONMENT_NAME: string;
|
|
5
5
|
API_URL: string;
|
|
6
|
-
APPLICATION_INSIGHTS_INSTRUMENTATION_KEY
|
|
6
|
+
APPLICATION_INSIGHTS_INSTRUMENTATION_KEY?: string;
|
|
7
7
|
}
|
|
8
8
|
declare const getConfig: <T extends keyof EnvVariables>(param: T) => "" | EnvVariables[T];
|
|
9
9
|
declare const getAppName: (appName: string | undefined) => string;
|
|
10
10
|
declare const getEnvironmentName: (environmentName: string | EnvironmentType | undefined) => EnvironmentType;
|
|
11
11
|
declare const getApiUrl: (apiUrl: string | undefined) => string;
|
|
12
|
-
declare const getApplicationInsightsInstrumentationKey: (instrumentationKey: string | undefined) => string;
|
|
12
|
+
declare const getApplicationInsightsInstrumentationKey: (instrumentationKey: string | undefined) => string | undefined;
|
|
13
13
|
export { getApplicationInsightsInstrumentationKey, getConfig, getAppName, getEnvironmentName, getApiUrl, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const n=
|
|
1
|
+
const n=["APPLICATION_INSIGHTS_INSTRUMENTATION_KEY"],N=N=>{if(!window._env_)return"";if(void 0===window._env_[N]&&!n.includes(N))throw new Error("Missing required environment variable: "+N);return window._env_[N]},I=n=>n||N("NAME"),_=n=>n||N("ENVIRONMENT_NAME"),e=n=>n||N("API_URL"),r=n=>n||N("APPLICATION_INSIGHTS_INSTRUMENTATION_KEY");export{e as getApiUrl,I as getAppName,r as getApplicationInsightsInstrumentationKey,N as getConfig,_ as getEnvironmentName};
|