@snokam/application-insights 1.2.19-alpha.0 → 1.3.0

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.
package/CHANGELOG.md CHANGED
@@ -3,153 +3,110 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [1.2.18](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.17...@snokam/application-insights@1.2.18) (2025-05-30)
7
-
6
+ # 1.3.0 (2026-08-18)
8
7
 
9
8
  ### Bug Fixes
10
9
 
11
- * update all deps ([d3183ec](https://github.com/snokam/components/commit/d3183eca3678a2b9f7df52a6e91e7e6ea7e27967))
12
- * update storybook and all texts ([7158e03](https://github.com/snokam/components/commit/7158e03996e82cb95aac309663bbdd5c331c5579))
10
+ - **deps:** close all 128 Dependabot alerts, upgrade across majors, consolidate the catalog ([#2028](https://github.com/snokam/components/issues/2028)) ([1b16dd5](https://github.com/snokam/components/commit/1b16dd5370f5685d290aa72b45bcbe81baa122c9)), closes [#816](https://github.com/snokam/components/issues/816)
11
+ - **security:** upgrade all dependencies and fix Dependabot alerts ([c462d7f](https://github.com/snokam/components/commit/c462d7f975451c490726177e0fd9c588a90953bd))
12
+ - update all dependencies to latest ([8aff44e](https://github.com/snokam/components/commit/8aff44ec72f8a17f2f9d1f527f5c3ae89c3ccaef))
13
13
 
14
+ ### Features
14
15
 
16
+ - migrate all 16 frontend apps from Pages Router to App Router ([#681](https://github.com/snokam/components/issues/681)) ([3b0cd1c](https://github.com/snokam/components/commit/3b0cd1c0c28abc2684e9c07d42264afe3d19cc8c))
17
+ - monomono repo ([b1dec79](https://github.com/snokam/components/commit/b1dec79c4a96f51150398da11b69c0e397c1aec1))
18
+ - multi-business platform — secret persistence, integration checks, feature flags ([#1556](https://github.com/snokam/components/issues/1556)) ([990de8f](https://github.com/snokam/components/commit/990de8f2044a619de641d8066d40d503ab390070)), closes [#70](https://github.com/snokam/components/issues/70) [#71](https://github.com/snokam/components/issues/71) [#69](https://github.com/snokam/components/issues/69)
15
19
 
20
+ ## [1.2.19](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.19-alpha.0...@snokam/application-insights@1.2.19) (2025-06-02)
16
21
 
22
+ **Note:** Version bump only for package @snokam/application-insights
17
23
 
18
- ## [1.2.17](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.16...@snokam/application-insights@1.2.17) (2025-03-10)
24
+ ## [1.2.19-alpha.0](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.18...@snokam/application-insights@1.2.19-alpha.0) (2025-05-31)
19
25
 
26
+ **Note:** Version bump only for package @snokam/application-insights
20
27
 
21
- ### Bug Fixes
28
+ ## [1.2.18](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.17...@snokam/application-insights@1.2.18) (2025-05-30)
22
29
 
23
- * upgrade all deps ([dfe05ac](https://github.com/snokam/components/commit/dfe05acb1ff7564e050405d4ee01dd12a7237641))
30
+ ### Bug Fixes
24
31
 
32
+ - update all deps ([d3183ec](https://github.com/snokam/components/commit/d3183eca3678a2b9f7df52a6e91e7e6ea7e27967))
33
+ - update storybook and all texts ([7158e03](https://github.com/snokam/components/commit/7158e03996e82cb95aac309663bbdd5c331c5579))
25
34
 
35
+ ## [1.2.17](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.16...@snokam/application-insights@1.2.17) (2025-03-10)
26
36
 
37
+ ### Bug Fixes
27
38
 
39
+ - upgrade all deps ([dfe05ac](https://github.com/snokam/components/commit/dfe05acb1ff7564e050405d4ee01dd12a7237641))
28
40
 
29
41
  ## [1.2.16](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.15...@snokam/application-insights@1.2.16) (2025-02-28)
30
42
 
31
-
32
43
  ### Bug Fixes
33
44
 
34
- * revert to use router ([fe1c008](https://github.com/snokam/components/commit/fe1c008f81c75c95a5a761d37e1012184e355716))
35
-
36
-
37
-
38
-
45
+ - revert to use router ([fe1c008](https://github.com/snokam/components/commit/fe1c008f81c75c95a5a761d37e1012184e355716))
39
46
 
40
47
  ## [1.2.15](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.14...@snokam/application-insights@1.2.15) (2025-02-28)
41
48
 
42
-
43
49
  ### Bug Fixes
44
50
 
45
- * add null check on router ([f0378b1](https://github.com/snokam/components/commit/f0378b15c7ee9ca9bc3623830a09ce9c26c60de7))
46
- * null check ([6eca652](https://github.com/snokam/components/commit/6eca652608206287b4d3888241437a36fa41f40c))
47
-
48
-
49
-
50
-
51
+ - add null check on router ([f0378b1](https://github.com/snokam/components/commit/f0378b15c7ee9ca9bc3623830a09ce9c26c60de7))
52
+ - null check ([6eca652](https://github.com/snokam/components/commit/6eca652608206287b4d3888241437a36fa41f40c))
51
53
 
52
54
  ## [1.2.14](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.13...@snokam/application-insights@1.2.14) (2025-02-28)
53
55
 
54
-
55
56
  ### Bug Fixes
56
57
 
57
- * add null check ([aefdf5f](https://github.com/snokam/components/commit/aefdf5fa39abcc3ff7a0301b6755181c0ffe344c))
58
-
59
-
60
-
61
-
58
+ - add null check ([aefdf5f](https://github.com/snokam/components/commit/aefdf5fa39abcc3ff7a0301b6755181c0ffe344c))
62
59
 
63
60
  ## [1.2.13](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.12...@snokam/application-insights@1.2.13) (2025-02-28)
64
61
 
65
-
66
62
  ### Bug Fixes
67
63
 
68
- * use compat router ([517435f](https://github.com/snokam/components/commit/517435f5dc0549ec52ff85af813fc8863c231f3f))
69
-
70
-
71
-
72
-
64
+ - use compat router ([517435f](https://github.com/snokam/components/commit/517435f5dc0549ec52ff85af813fc8863c231f3f))
73
65
 
74
66
  ## [1.2.12](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.11...@snokam/application-insights@1.2.12) (2025-02-15)
75
67
 
76
68
  **Note:** Version bump only for package @snokam/application-insights
77
69
 
78
-
79
-
80
-
81
-
82
70
  ## [1.2.11](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.10...@snokam/application-insights@1.2.11) (2025-02-15)
83
71
 
84
-
85
72
  ### Bug Fixes
86
73
 
87
- * remove rootDir concept ([c7e1cc4](https://github.com/snokam/components/commit/c7e1cc456965a50592044e3150b2a4daec551083))
88
- * update deps ([caa80b4](https://github.com/snokam/components/commit/caa80b42e50c20f936bbfc29f05b0ba9a17e9b0e))
89
-
90
-
91
-
92
-
74
+ - remove rootDir concept ([c7e1cc4](https://github.com/snokam/components/commit/c7e1cc456965a50592044e3150b2a4daec551083))
75
+ - update deps ([caa80b4](https://github.com/snokam/components/commit/caa80b42e50c20f936bbfc29f05b0ba9a17e9b0e))
93
76
 
94
77
  ## [1.2.10](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.9...@snokam/application-insights@1.2.10) (2025-02-03)
95
78
 
96
-
97
79
  ### Bug Fixes
98
80
 
99
- * restructure whole project ([225825e](https://github.com/snokam/components/commit/225825e4a0447131c7ceebb65cd92b69f33aab2b))
100
-
101
-
102
-
103
-
81
+ - restructure whole project ([225825e](https://github.com/snokam/components/commit/225825e4a0447131c7ceebb65cd92b69f33aab2b))
104
82
 
105
83
  ## [1.2.9](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.8...@snokam/application-insights@1.2.9) (2024-12-04)
106
84
 
107
-
108
85
  ### Bug Fixes
109
86
 
110
- * allow any next version ([a185787](https://github.com/snokam/components/commit/a185787786cd8a2564d0c7170008911f61415fa4))
111
- * deploy new packages with peer dep update ([290a502](https://github.com/snokam/components/commit/290a5028930327c27cce670f75d4db09e5673323))
112
-
113
-
114
-
115
-
87
+ - allow any next version ([a185787](https://github.com/snokam/components/commit/a185787786cd8a2564d0c7170008911f61415fa4))
88
+ - deploy new packages with peer dep update ([290a502](https://github.com/snokam/components/commit/290a5028930327c27cce670f75d4db09e5673323))
116
89
 
117
90
  ## [1.2.8](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.7...@snokam/application-insights@1.2.8) (2024-10-31)
118
91
 
119
-
120
92
  ### Bug Fixes
121
93
 
122
- * simplify check ([271ca71](https://github.com/snokam/components/commit/271ca71c27be891a76a553e7315629add3618700))
123
-
124
-
125
-
126
-
94
+ - simplify check ([271ca71](https://github.com/snokam/components/commit/271ca71c27be891a76a553e7315629add3618700))
127
95
 
128
96
  ## [1.2.7](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.6...@snokam/application-insights@1.2.7) (2024-10-31)
129
97
 
130
-
131
98
  ### Bug Fixes
132
99
 
133
- * filter out video telemetry ([b8f4db1](https://github.com/snokam/components/commit/b8f4db15505f1d4eaa5fd7cdbde6a38bba1bf9fd))
134
-
135
-
136
-
137
-
100
+ - filter out video telemetry ([b8f4db1](https://github.com/snokam/components/commit/b8f4db15505f1d4eaa5fd7cdbde6a38bba1bf9fd))
138
101
 
139
102
  ## [1.2.6](https://github.com/snokam/components/compare/@snokam/application-insights@1.2.5...@snokam/application-insights@1.2.6) (2024-10-31)
140
103
 
141
-
142
104
  ### Bug Fixes
143
105
 
144
- * adjust insights ([0c82e75](https://github.com/snokam/components/commit/0c82e75d8b9485aa1b2a5c995a62ac5216a8fb9d))
145
-
146
-
147
-
148
-
106
+ - adjust insights ([0c82e75](https://github.com/snokam/components/commit/0c82e75d8b9485aa1b2a5c995a62ac5216a8fb9d))
149
107
 
150
108
  ## 1.2.5 (2024-10-31)
151
109
 
152
-
153
110
  ### Bug Fixes
154
111
 
155
- * initial commit for @snokam/application-insights ([335ec5f](https://github.com/snokam/components/commit/335ec5f58092291138e687b03d87543c3b844c9f))
112
+ - initial commit for @snokam/application-insights ([335ec5f](https://github.com/snokam/components/commit/335ec5f58092291138e687b03d87543c3b844c9f))
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@snokam/application-insights",
3
3
  "description": "Snøkam core components",
4
- "version": "1.2.19-alpha.0",
5
- "main": "lib/index.js",
6
- "typings": "lib/index.d.ts",
4
+ "version": "1.3.0",
5
+ "main": "src/index.tsx",
6
+ "types": "src/index.tsx",
7
7
  "files": [
8
- "lib",
8
+ "src",
9
9
  "package.json",
10
10
  "CHANGELOG.md"
11
11
  ],
@@ -14,24 +14,30 @@
14
14
  "url": "ssh://git@github.com:snokam/components.git",
15
15
  "directory": "@snokam/core"
16
16
  },
17
- "scripts": {
18
- "start": "webpack --watch --config=../../../webpack/webpack.dev.js",
19
- "build": "webpack --config=../../../webpack/webpack.prod.js",
20
- "build:doc": "webpack --config=../../../webpack/webpack.dev.js",
21
- "clean": "rm -rf lib"
22
- },
23
17
  "publishConfig": {
24
18
  "access": "public"
25
19
  },
26
20
  "dependencies": {
27
- "@microsoft/applicationinsights-react-js": "^19.3.6",
28
- "@microsoft/applicationinsights-web": "^3.3.8",
21
+ "@microsoft/applicationinsights-react-js": "^19.4.1",
22
+ "@microsoft/applicationinsights-web": "^3.4.3",
29
23
  "history": "^5.3.0"
30
24
  },
31
25
  "peerDependencies": {
32
- "next": "*",
33
- "react": "*",
34
- "react-dom": "*"
26
+ "next": "16.2.11",
27
+ "react": "19.2.8",
28
+ "react-dom": "19.2.8"
29
+ },
30
+ "devDependencies": {
31
+ "@types/react": "^19.2.17",
32
+ "@types/react-dom": "^19.2.3"
35
33
  },
36
- "gitHead": "b1067178012623210577b0bdc6d67717aee2b98e"
37
- }
34
+ "exports": {
35
+ ".": "./src/index.tsx",
36
+ "./page-router": "./src/page-router.tsx",
37
+ "./app-router": "./src/app-router.tsx",
38
+ "./server": "./src/server.ts"
39
+ },
40
+ "scripts": {
41
+ "lint": "eslint ."
42
+ }
43
+ }
@@ -0,0 +1,80 @@
1
+ import { useRouter } from "next/router";
2
+ import { ReactNode, useEffect, useRef } from "react";
3
+ import { createBrowserHistory } from "history";
4
+ import {
5
+ AppInsightsContext,
6
+ ReactPlugin,
7
+ } from "@microsoft/applicationinsights-react-js";
8
+ import {
9
+ ApplicationInsights,
10
+ IConfig,
11
+ IConfiguration,
12
+ ITelemetryPlugin,
13
+ } from "@microsoft/applicationinsights-web";
14
+
15
+ export interface ProviderProps {
16
+ children: ReactNode;
17
+ config: IConfiguration & IConfig;
18
+ }
19
+
20
+ export const Provider = ({ children, config }: ProviderProps) => {
21
+ const router = useRouter();
22
+ const reactPluginRef = useRef<ReactPlugin>(new ReactPlugin());
23
+ const appInsightsRef = useRef<ApplicationInsights | null>(null);
24
+
25
+ const events = router?.events;
26
+ const isBrowser = typeof window !== "undefined";
27
+ const browserHistory = isBrowser ? createBrowserHistory() : undefined;
28
+
29
+ useEffect(() => {
30
+ if (!appInsightsRef.current) {
31
+ appInsightsRef.current = new ApplicationInsights({
32
+ config: {
33
+ maxBatchSizeInBytes: 10000,
34
+ maxBatchInterval: 15000,
35
+ enableAutoRouteTracking: true,
36
+ extensions: [reactPluginRef.current as unknown as ITelemetryPlugin],
37
+ extensionConfig: {
38
+ [reactPluginRef.current.identifier]: { history: browserHistory },
39
+ },
40
+ ...config,
41
+ },
42
+ });
43
+
44
+ appInsightsRef.current.loadAppInsights();
45
+
46
+ appInsightsRef.current.addTelemetryInitializer((envelope) => {
47
+ const baseType = envelope.baseType || "";
48
+ const telemetryItem = envelope.baseData || {};
49
+ const target = telemetryItem.target || "";
50
+ const isDependencyData = baseType === "RemoteDependencyData";
51
+
52
+ const isVideo =
53
+ target.includes("mux.com") || target.includes("litix.io");
54
+
55
+ if (isDependencyData && isVideo) {
56
+ return false;
57
+ }
58
+ });
59
+ }
60
+ }, [config]);
61
+
62
+ useEffect(() => {
63
+ const handleRouteChange = (url: string) => {
64
+ appInsightsRef.current?.trackPageView({ name: url });
65
+ };
66
+
67
+ events?.on("routeChangeComplete", handleRouteChange);
68
+ return () => {
69
+ events?.off("routeChangeComplete", handleRouteChange);
70
+ };
71
+ }, [events]);
72
+
73
+ return (
74
+ <AppInsightsContext.Provider value={reactPluginRef.current}>
75
+ {children}
76
+ </AppInsightsContext.Provider>
77
+ );
78
+ };
79
+
80
+ export default Provider;
@@ -0,0 +1,89 @@
1
+ "use client";
2
+
3
+ import { usePathname, useSearchParams } from "next/navigation";
4
+ import { ReactNode, Suspense, useEffect, useRef } from "react";
5
+ import { createBrowserHistory } from "history";
6
+ import {
7
+ AppInsightsContext,
8
+ ReactPlugin,
9
+ } from "@microsoft/applicationinsights-react-js";
10
+ import {
11
+ ApplicationInsights,
12
+ IConfig,
13
+ IConfiguration,
14
+ ITelemetryPlugin,
15
+ } from "@microsoft/applicationinsights-web";
16
+
17
+ export interface ProviderProps {
18
+ children: ReactNode;
19
+ config: IConfiguration & IConfig;
20
+ }
21
+
22
+ function AppRouterProvider({ children, config }: ProviderProps) {
23
+ return (
24
+ <Suspense fallback={<>{children}</>}>
25
+ <AppRouterProviderInner config={config}>
26
+ {children}
27
+ </AppRouterProviderInner>
28
+ </Suspense>
29
+ );
30
+ }
31
+
32
+ function AppRouterProviderInner({ children, config }: ProviderProps) {
33
+ const pathname = usePathname();
34
+ const searchParams = useSearchParams();
35
+ const reactPluginRef = useRef<ReactPlugin>(new ReactPlugin());
36
+ const appInsightsRef = useRef<ApplicationInsights | null>(null);
37
+
38
+ const isBrowser = typeof window !== "undefined";
39
+ const browserHistory = isBrowser ? createBrowserHistory() : undefined;
40
+
41
+ useEffect(() => {
42
+ if (!appInsightsRef.current) {
43
+ appInsightsRef.current = new ApplicationInsights({
44
+ config: {
45
+ maxBatchSizeInBytes: 10000,
46
+ maxBatchInterval: 15000,
47
+ enableAutoRouteTracking: true,
48
+ extensions: [reactPluginRef.current as unknown as ITelemetryPlugin],
49
+ extensionConfig: {
50
+ [reactPluginRef.current.identifier]: { history: browserHistory },
51
+ },
52
+ ...config,
53
+ },
54
+ });
55
+
56
+ appInsightsRef.current.loadAppInsights();
57
+
58
+ appInsightsRef.current.addTelemetryInitializer((envelope) => {
59
+ const baseType = envelope.baseType || "";
60
+ const telemetryItem = envelope.baseData || {};
61
+ const target = telemetryItem.target || "";
62
+ const isDependencyData = baseType === "RemoteDependencyData";
63
+
64
+ const isVideo =
65
+ target.includes("mux.com") || target.includes("litix.io");
66
+
67
+ if (isDependencyData && isVideo) {
68
+ return false;
69
+ }
70
+ });
71
+ }
72
+ }, [config, browserHistory]);
73
+
74
+ useEffect(() => {
75
+ if (appInsightsRef.current) {
76
+ const url =
77
+ pathname + (searchParams?.toString() ? `?${searchParams}` : "");
78
+ appInsightsRef.current.trackPageView({ name: url });
79
+ }
80
+ }, [pathname, searchParams]);
81
+
82
+ return (
83
+ <AppInsightsContext.Provider value={reactPluginRef.current}>
84
+ {children}
85
+ </AppInsightsContext.Provider>
86
+ );
87
+ }
88
+
89
+ export default { Provider: AppRouterProvider };
package/src/index.tsx ADDED
@@ -0,0 +1,2 @@
1
+ import { Provider } from "./Provider";
2
+ export default { Provider };
@@ -0,0 +1,2 @@
1
+ import { Provider } from "./Provider";
2
+ export default { Provider };
package/src/server.ts ADDED
@@ -0,0 +1,33 @@
1
+ type ErrorRequest = {
2
+ path?: string;
3
+ method?: string;
4
+ headers?: Record<string, string | undefined>;
5
+ };
6
+
7
+ type ErrorContext = {
8
+ routerKind?: string;
9
+ routePath?: string;
10
+ routeType?: string;
11
+ renderSource?: string;
12
+ revalidateReason?: string;
13
+ };
14
+
15
+ export function onRequestError(
16
+ error: unknown,
17
+ request: ErrorRequest,
18
+ context: ErrorContext
19
+ ) {
20
+ const host =
21
+ request.headers?.["x-forwarded-host"] ?? request.headers?.["host"];
22
+ const detail = {
23
+ host,
24
+ method: request.method,
25
+ path: request.path,
26
+ routePath: context.routePath,
27
+ routeType: context.routeType,
28
+ renderSource: context.renderSource,
29
+ message: error instanceof Error ? error.message : String(error),
30
+ stack: error instanceof Error ? error.stack : undefined,
31
+ };
32
+ console.error("[server-error]", JSON.stringify(detail));
33
+ }
package/lib/Provider.d.ts DELETED
@@ -1,8 +0,0 @@
1
- import { ReactNode } from "react";
2
- import { IConfig, IConfiguration } from "@microsoft/applicationinsights-web";
3
- export interface ProviderProps {
4
- children: ReactNode;
5
- config: IConfiguration & IConfig;
6
- }
7
- export declare const Provider: ({ children, config }: ProviderProps) => import("react/jsx-runtime").JSX.Element;
8
- export default Provider;
package/lib/Provider.js DELETED
@@ -1,2 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{Provider:()=>c,default:()=>a});const r=require("react/jsx-runtime"),n=require("next/router"),o=require("react"),i=require("history"),u=require("@microsoft/applicationinsights-react-js"),s=require("@microsoft/applicationinsights-web"),c=({children:e,config:t})=>{const c=(0,n.useRouter)(),a=(0,o.useRef)(!1),l=(0,o.useRef)(new u.ReactPlugin),f=(0,o.useRef)(null),d=null==c?void 0:c.events,p="undefined"!=typeof window?(0,i.createBrowserHistory)():void 0;return(0,o.useEffect)((()=>{f.current||(f.current=new s.ApplicationInsights({config:Object.assign({maxBatchSizeInBytes:1e4,maxBatchInterval:15e3,enableAutoRouteTracking:!0,extensions:[l.current],extensionConfig:{[l.current.identifier]:{history:p}}},t)}),f.current.loadAppInsights(),f.current.addTelemetryInitializer((e=>{const t=e.baseType||"",r=(e.baseData||{}).target||"",n="RemoteDependencyData"===t,o=r.includes("mux.com")||r.includes("litix.io");if(n&&o)return!1})),a.current=!0)}),[t]),(0,o.useEffect)((()=>{const e=e=>{var t;null===(t=f.current)||void 0===t||t.trackPageView({name:e})};return null==d||d.on("routeChangeComplete",e),()=>{null==d||d.off("routeChangeComplete",e)}}),[d]),(0,r.jsx)(u.AppInsightsContext.Provider,{value:l.current,children:e})},a=c;return t})()));
2
- //# sourceMappingURL=Provider.js.map
@@ -1 +0,0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AAY,CAACf,EAAeS,SAAUO,gBAAiB,CAC3J,CAAChB,EAAeS,QAAQQ,YAAa,CAAEC,QAASd,KAC/CT,KAGbO,EAAeO,QAAQU,kBAEvBjB,EAAeO,QAAQW,yBAAyBC,IAC5C,MAAMC,EAAWD,EAASC,UAAY,GAEhCC,GADgBF,EAASG,UAAY,CAAC,GACfD,QAAU,GACjCE,EAAgC,yBAAbH,EAEnBI,EAAUH,EAAOI,SAAS,YAAcJ,EAAOI,SAAS,YAC9D,GAAIF,GAAoBC,EACpB,OAAO,CACX,IAEJ5B,EAAoBW,SAAU,EAClC,GACD,CAACd,KACJ,IAAAa,YAAU,KACN,MAAMoB,EAAqBC,IACvB,IAAIC,EAC8B,QAAjCA,EAAK5B,EAAeO,eAA4B,IAAPqB,GAAyBA,EAAGC,cAAc,CAAEC,KAAMH,GAAM,EAGtG,OADA1B,SAAgDA,EAAO8B,GAAG,sBAAuBL,GAC1E,KACHzB,SAAgDA,EAAO+B,IAAI,sBAAuBN,EAAkB,CACvG,GACF,CAACzB,KACI,SAAK,EAAAgC,mBAAmB1C,SAAU,CAAEF,MAAOS,EAAeS,QAASf,SAAUA,GAAY,EAErG,I","sources":["webpack://snokam/webpack/universalModuleDefinition","webpack://snokam/webpack/bootstrap","webpack://snokam/webpack/runtime/define property getters","webpack://snokam/webpack/runtime/hasOwnProperty shorthand","webpack://snokam/webpack/runtime/make namespace object","webpack://snokam/external commonjs \"react/jsx-runtime\"","webpack://snokam/external commonjs \"next/router\"","webpack://snokam/external commonjs \"react\"","webpack://snokam/external commonjs \"history\"","webpack://snokam/external commonjs \"@microsoft/applicationinsights-react-js\"","webpack://snokam/external commonjs \"@microsoft/applicationinsights-web\"","webpack://snokam/./src/Provider.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react/jsx-runtime\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"next/router\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"history\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@microsoft/applicationinsights-react-js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@microsoft/applicationinsights-web\");","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useRouter } from \"next/router\";\nimport { useEffect, useRef } from \"react\";\nimport { createBrowserHistory } from \"history\";\nimport { AppInsightsContext, ReactPlugin, } from \"@microsoft/applicationinsights-react-js\";\nimport { ApplicationInsights, } from \"@microsoft/applicationinsights-web\";\nexport const Provider = ({ children, config }) => {\n const router = useRouter();\n const isAppInsightsLoaded = useRef(false);\n const reactPluginRef = useRef(new ReactPlugin());\n const appInsightsRef = useRef(null);\n const events = router === null || router === void 0 ? void 0 : router.events;\n const isBrowser = typeof window !== \"undefined\";\n const browserHistory = isBrowser ? createBrowserHistory() : undefined;\n useEffect(() => {\n if (!appInsightsRef.current) {\n appInsightsRef.current = new ApplicationInsights({\n config: Object.assign({ maxBatchSizeInBytes: 10000, maxBatchInterval: 15000, enableAutoRouteTracking: true, extensions: [reactPluginRef.current], extensionConfig: {\n [reactPluginRef.current.identifier]: { history: browserHistory },\n } }, config),\n });\n // Load Application Insights\n appInsightsRef.current.loadAppInsights();\n // Filter out telemetry from specific domains\n appInsightsRef.current.addTelemetryInitializer((envelope) => {\n const baseType = envelope.baseType || \"\";\n const telemetryItem = envelope.baseData || {};\n const target = telemetryItem.target || \"\";\n const isDependencyData = baseType === \"RemoteDependencyData\";\n // Video chunk telemetry\n const isVideo = target.includes(\"mux.com\") || target.includes(\"litix.io\");\n if (isDependencyData && isVideo) {\n return false;\n }\n });\n isAppInsightsLoaded.current = true;\n }\n }, [config]);\n useEffect(() => {\n const handleRouteChange = (url) => {\n var _a;\n (_a = appInsightsRef.current) === null || _a === void 0 ? void 0 : _a.trackPageView({ name: url });\n };\n events === null || events === void 0 ? void 0 : events.on(\"routeChangeComplete\", handleRouteChange);\n return () => {\n events === null || events === void 0 ? void 0 : events.off(\"routeChangeComplete\", handleRouteChange);\n };\n }, [events]);\n return (_jsx(AppInsightsContext.Provider, { value: reactPluginRef.current, children: children }));\n};\nexport default Provider;\n"],"names":["root","factory","exports","module","define","amd","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","require","Provider","children","config","router","useRouter","isAppInsightsLoaded","useRef","reactPluginRef","ReactPlugin","appInsightsRef","events","browserHistory","window","createBrowserHistory","undefined","useEffect","current","ApplicationInsights","assign","maxBatchSizeInBytes","maxBatchInterval","enableAutoRouteTracking","extensions","extensionConfig","identifier","history","loadAppInsights","addTelemetryInitializer","envelope","baseType","target","baseData","isDependencyData","isVideo","includes","handleRouteChange","url","_a","trackPageView","name","on","off","AppInsightsContext"],"sourceRoot":""}
package/lib/index.d.ts DELETED
@@ -1,4 +0,0 @@
1
- declare const _default: {
2
- Provider: ({ children, config }: import("./Provider").ProviderProps) => import("react/jsx-runtime").JSX.Element;
3
- };
4
- export default _default;
package/lib/index.js DELETED
@@ -1,2 +0,0 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.snokam=t():e.snokam=t()}(this,(()=>(()=>{"use strict";var e={172:(e,t,r)=>{r.d(t,{Provider:()=>c});const n=require("react/jsx-runtime"),o=require("next/router"),i=require("react"),u=require("history"),s=require("@microsoft/applicationinsights-react-js"),a=require("@microsoft/applicationinsights-web"),c=({children:e,config:t})=>{const r=(0,o.useRouter)(),c=(0,i.useRef)(!1),l=(0,i.useRef)(new s.ReactPlugin),d=(0,i.useRef)(null),f=null==r?void 0:r.events,p="undefined"!=typeof window?(0,u.createBrowserHistory)():void 0;return(0,i.useEffect)((()=>{d.current||(d.current=new a.ApplicationInsights({config:Object.assign({maxBatchSizeInBytes:1e4,maxBatchInterval:15e3,enableAutoRouteTracking:!0,extensions:[l.current],extensionConfig:{[l.current.identifier]:{history:p}}},t)}),d.current.loadAppInsights(),d.current.addTelemetryInitializer((e=>{const t=e.baseType||"",r=(e.baseData||{}).target||"",n="RemoteDependencyData"===t,o=r.includes("mux.com")||r.includes("litix.io");if(n&&o)return!1})),c.current=!0)}),[t]),(0,i.useEffect)((()=>{const e=e=>{var t;null===(t=d.current)||void 0===t||t.trackPageView({name:e})};return null==f||f.on("routeChangeComplete",e),()=>{null==f||f.off("routeChangeComplete",e)}}),[f]),(0,n.jsx)(s.AppInsightsContext.Provider,{value:l.current,children:e})}}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n](i,i.exports,r),i.exports}r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};r.r(n),r.d(n,{default:()=>o});const o={Provider:r(172).Provider};return n})()));
2
- //# sourceMappingURL=index.js.map
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","mappings":"CAAA,SAA2CA,EAAMC,GAC1B,iBAAZC,SAA0C,iBAAXC,OACxCA,OAAOD,QAAUD,IACQ,mBAAXG,QAAyBA,OAAOC,IAC9CD,OAAO,GAAIH,GACe,iBAAZC,QACdA,QAAgB,OAAID,IAEpBD,EAAa,OAAIC,GAClB,CATD,CASGK,MAAM,I,gECTT,MAAM,EAA+BC,QAAQ,qBCAvC,EAA+BA,QAAQ,eCAvC,EAA+BA,QAAQ,SCAvC,EAA+BA,QAAQ,WCAvC,EAA+BA,QAAQ,2CCAvC,EAA+BA,QAAQ,sCCMhCC,EAAW,EAAGC,WAAUC,aACjC,MAAMC,GAAS,IAAAC,aACTC,GAAsB,IAAAC,SAAO,GAC7BC,GAAiB,IAAAD,QAAO,IAAI,EAAAE,aAC5BC,GAAiB,IAAAH,QAAO,MACxBI,EAASP,aAAuC,EAASA,EAAOO,OAEhEC,EAD8B,oBAAXC,QACU,IAAAC,6BAAyBC,EAmC5D,OAlCA,IAAAC,YAAU,KACDN,EAAeO,UAChBP,EAAeO,QAAU,IAAI,EAAAC,oBAAoB,CAC7Cf,OAAQgB,OAAOC,OAAO,CAAEC,oBAAqB,IAAOC,iBAAkB,KAAOC,yBAAyB,EAAMC,WAAY,CAAChB,EAAeS,SAAUQ,gBAAiB,CAC3J,CAACjB,EAAeS,QAAQS,YAAa,CAAEC,QAASf,KAC/CT,KAGbO,EAAeO,QAAQW,kBAEvBlB,EAAeO,QAAQY,yBAAyBC,IAC5C,MAAMC,EAAWD,EAASC,UAAY,GAEhCC,GADgBF,EAASG,UAAY,CAAC,GACfD,QAAU,GACjCE,EAAgC,yBAAbH,EAEnBI,EAAUH,EAAOI,SAAS,YAAcJ,EAAOI,SAAS,YAC9D,G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\"","webpack://snokam/external commonjs \"next/router\"","webpack://snokam/external commonjs \"react\"","webpack://snokam/external commonjs \"history\"","webpack://snokam/external commonjs \"@microsoft/applicationinsights-react-js\"","webpack://snokam/external commonjs \"@microsoft/applicationinsights-web\"","webpack://snokam/./src/Provider.tsx","webpack://snokam/webpack/bootstrap","webpack://snokam/webpack/runtime/define property getters","webpack://snokam/webpack/runtime/hasOwnProperty shorthand","webpack://snokam/webpack/runtime/make namespace object","webpack://snokam/./src/index.tsx"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"snokam\"] = factory();\n\telse\n\t\troot[\"snokam\"] = factory();\n})(this, () => {\nreturn ","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react/jsx-runtime\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"next/router\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"react\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"history\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@microsoft/applicationinsights-react-js\");","const __WEBPACK_NAMESPACE_OBJECT__ = require(\"@microsoft/applicationinsights-web\");","import { jsx as _jsx } from \"react/jsx-runtime\";\nimport { useRouter } from \"next/router\";\nimport { useEffect, useRef } from \"react\";\nimport { createBrowserHistory } from \"history\";\nimport { AppInsightsContext, ReactPlugin, } from \"@microsoft/applicationinsights-react-js\";\nimport { ApplicationInsights, } from \"@microsoft/applicationinsights-web\";\nexport const Provider = ({ children, config }) => {\n const router = useRouter();\n const isAppInsightsLoaded = useRef(false);\n const reactPluginRef = useRef(new ReactPlugin());\n const appInsightsRef = useRef(null);\n const events = router === null || router === void 0 ? void 0 : router.events;\n const isBrowser = typeof window !== \"undefined\";\n const browserHistory = isBrowser ? createBrowserHistory() : undefined;\n useEffect(() => {\n if (!appInsightsRef.current) {\n appInsightsRef.current = new ApplicationInsights({\n config: Object.assign({ maxBatchSizeInBytes: 10000, maxBatchInterval: 15000, enableAutoRouteTracking: true, extensions: [reactPluginRef.current], extensionConfig: {\n [reactPluginRef.current.identifier]: { history: browserHistory },\n } }, config),\n });\n // Load Application Insights\n appInsightsRef.current.loadAppInsights();\n // Filter out telemetry from specific domains\n appInsightsRef.current.addTelemetryInitializer((envelope) => {\n const baseType = envelope.baseType || \"\";\n const telemetryItem = envelope.baseData || {};\n const target = telemetryItem.target || \"\";\n const isDependencyData = baseType === \"RemoteDependencyData\";\n // Video chunk telemetry\n const isVideo = target.includes(\"mux.com\") || target.includes(\"litix.io\");\n if (isDependencyData && isVideo) {\n return false;\n }\n });\n isAppInsightsLoaded.current = true;\n }\n }, [config]);\n useEffect(() => {\n const handleRouteChange = (url) => {\n var _a;\n (_a = appInsightsRef.current) === null || _a === void 0 ? void 0 : _a.trackPageView({ name: url });\n };\n events === null || events === void 0 ? void 0 : events.on(\"routeChangeComplete\", handleRouteChange);\n return () => {\n events === null || events === void 0 ? void 0 : events.off(\"routeChangeComplete\", handleRouteChange);\n };\n }, [events]);\n return (_jsx(AppInsightsContext.Provider, { value: reactPluginRef.current, children: children }));\n};\nexport default Provider;\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","import { Provider } from \"./Provider\";\nexport default { Provider };\n"],"names":["root","factory","exports","module","define","amd","this","require","Provider","children","config","router","useRouter","isAppInsightsLoaded","useRef","reactPluginRef","ReactPlugin","appInsightsRef","events","browserHistory","window","createBrowserHistory","undefined","useEffect","current","ApplicationInsights","Object","assign","maxBatchSizeInBytes","maxBatchInterval","enableAutoRouteTracking","extensions","extensionConfig","identifier","history","loadAppInsights","addTelemetryInitializer","envelope","baseType","target","baseData","isDependencyData","isVideo","includes","handleRouteChange","url","_a","trackPageView","name","on","off","AppInsightsContext","value","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","d","definition","key","o","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag"],"sourceRoot":""}