@equinor/subsurface-app-management 3.1.3 → 3.1.5

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 e}from"react/jsx-runtime";import{useEffect as i}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 r}from"@microsoft/applicationinsights-web";import{getApplicationInsightsInstrumentationKey as s}from"../utils/environment.js";import{l as a}from"../_virtual/lodash.js";const c=new o,m=new n,d=12e5,p=new r({config:{connectionString:s(import.meta.env.VITE_APPLICATION_INSIGHTS_INSTRUMENTATION_KEY),extensions:[c,m],extensionConfig:{[m.identifier]:{autoCapture:!0,dropInvalidEvents:!0}},autoTrackPageVisitTime:!0,enableAutoRouteTracking:!0,sessionRenewalMs:d,sessionExpirationMs:d}});p.loadAppInsights();const l=a.debounce((()=>{p.trackEvent({name:"Resolution",properties:{"Window Resolution":window.innerWidth+"x"+window.innerHeight,"Screen Resolution":screen.width+"x"+screen.height}})}),5e3),w=({children:n})=>(i((()=>(window.addEventListener("load",l),window.addEventListener("resize",l),()=>{window.removeEventListener("resize",l),window.removeEventListener("load",l)})),[]),e(t,{value:c,children:n}));export{w as ApplicationInsightsProvider};
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{getApplicationInsightsConnectionString 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_CONNECTION_STRING),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_CONNECTION_STRING?')}),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: string;
6
+ APPLICATION_INSIGHTS_CONNECTION_STRING?: 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;
13
- export { getApplicationInsightsInstrumentationKey, getConfig, getAppName, getEnvironmentName, getApiUrl, };
12
+ declare const getApplicationInsightsConnectionString: (instrumentationKey: string | undefined) => string | undefined;
13
+ export { getApplicationInsightsConnectionString, getConfig, getAppName, getEnvironmentName, getApiUrl, };
@@ -1 +1 @@
1
- const n=n=>{if(!window._env_)return"";if(void 0===window._env_[n])throw new Error("Missing required environment variable: "+n);return window._env_[n]},r=r=>r||n("NAME"),e=r=>r||n("ENVIRONMENT_NAME"),i=r=>r||n("API_URL"),_=r=>r||n("APPLICATION_INSIGHTS_INSTRUMENTATION_KEY");export{i as getApiUrl,r as getAppName,_ as getApplicationInsightsInstrumentationKey,n as getConfig,e as getEnvironmentName};
1
+ const N=["APPLICATION_INSIGHTS_CONNECTION_STRING"],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_CONNECTION_STRING");export{e as getApiUrl,I as getAppName,r as getApplicationInsightsConnectionString,n as getConfig,_ as getEnvironmentName};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@equinor/subsurface-app-management",
3
- "version": "3.1.3",
3
+ "version": "3.1.5",
4
4
  "description": "React Typescript components/hooks to communicate with equinor/sam",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",