@snokam/application-insights 1.2.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## 1.2.5 (2024-10-31)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * initial commit for @snokam/application-insights ([335ec5f](https://github.com/snokam/components/commit/335ec5f58092291138e687b03d87543c3b844c9f))
@@ -0,0 +1,8 @@
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;
@@ -0,0 +1,2 @@
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:()=>s});const r=require("react/jsx-runtime"),n=require("next/router"),o=require("react"),i=require("@microsoft/applicationinsights-react-js"),u=require("@microsoft/applicationinsights-web"),c=({children:e,config:t})=>{const c=(0,n.useRouter)(),s=(0,o.useRef)(null),a=(0,o.useRef)(null);return s.current||(s.current=new i.ReactPlugin),a.current||(a.current=new u.ApplicationInsights({config:Object.assign({maxBatchSizeInBytes:1e4,maxBatchInterval:15e3,enableAutoRouteTracking:!0,extensions:[s.current]},t)})),(0,o.useEffect)((()=>{var e;null===(e=a.current)||void 0===e||e.loadAppInsights();const t=e=>{var t;null===(t=a.current)||void 0===t||t.trackPageView({name:e})};return c.events.on("routeChangeComplete",t),()=>{c.events.off("routeChangeComplete",t)}}),[c.events]),(0,r.jsx)(i.AppInsightsContext.Provider,{value:s.current,children:e})},s=c;return t})()));
2
+ //# sourceMappingURL=Provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Provider.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,mBCRT,IAAIC,EAAsB,CCA1BA,EAAwB,CAACL,EAASM,KACjC,IAAI,IAAIC,KAAOD,EACXD,EAAoBG,EAAEF,EAAYC,KAASF,EAAoBG,EAAER,EAASO,IAC5EE,OAAOC,eAAeV,EAASO,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,IAE1E,ECNDF,EAAwB,CAACQ,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFT,EAAyBL,IACH,oBAAXkB,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeV,EAASkB,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeV,EAAS,aAAc,CAAEoB,OAAO,GAAO,G,kDCL9D,MAAM,EAA+BC,QAAQ,qBCAvC,EAA+BA,QAAQ,eCAvC,EAA+BA,QAAQ,SCAvC,EAA+BA,QAAQ,2CCAvC,EAA+BA,QAAQ,sCCKhCC,EAAW,EAAGC,WAAUC,aACjC,MAAMC,GAAS,IAAAC,aACTC,GAAiB,IAAAC,QAAO,MACxBC,GAAiB,IAAAD,QAAO,MAqB9B,OApBKD,EAAeG,UAChBH,EAAeG,QAAU,IAAI,EAAAC,aAE5BF,EAAeC,UAChBD,EAAeC,QAAU,IAAI,EAAAE,oBAAoB,CAC7CR,OAAQf,OAAOwB,OAAO,CAAEC,oBAAqB,IAAOC,iBAAkB,KAAOC,yBAAyB,EAAMC,WAAY,CAACV,EAAeG,UAAYN,OAG5J,IAAAc,YAAU,KACN,IAAIC,EAC8B,QAAjCA,EAAKV,EAAeC,eAA4B,IAAPS,GAAyBA,EAAGC,kBACtE,MAAMC,EAAqBC,IACvB,IAAIH,EAC8B,QAAjCA,EAAKV,EAAeC,eAA4B,IAAPS,GAAyBA,EAAGI,cAAc,CAAEC,KAAMF,GAAM,EAGtG,OADAjB,EAAOoB,OAAOC,GAAG,sBAAuBL,GACjC,KACHhB,EAAOoB,OAAOE,IAAI,sBAAuBN,EAAkB,CAC9D,GACF,CAAChB,EAAOoB,UACH,SAAK,EAAAG,mBAAmB1B,SAAU,CAAEF,MAAOO,EAAeG,QAASP,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 \"@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(\"@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 { AppInsightsContext, ReactPlugin, } from \"@microsoft/applicationinsights-react-js\";\nimport { ApplicationInsights, } from \"@microsoft/applicationinsights-web\";\nexport const Provider = ({ children, config }) => {\n const router = useRouter();\n const reactPluginRef = useRef(null);\n const appInsightsRef = useRef(null);\n if (!reactPluginRef.current) {\n reactPluginRef.current = new ReactPlugin();\n }\n if (!appInsightsRef.current) {\n appInsightsRef.current = new ApplicationInsights({\n config: Object.assign({ maxBatchSizeInBytes: 10000, maxBatchInterval: 15000, enableAutoRouteTracking: true, extensions: [reactPluginRef.current] }, config),\n });\n }\n useEffect(() => {\n var _a;\n (_a = appInsightsRef.current) === null || _a === void 0 ? void 0 : _a.loadAppInsights();\n const handleRouteChange = (url) => {\n var _a;\n (_a = appInsightsRef.current) === null || _a === void 0 ? void 0 : _a.trackPageView({ name: url });\n };\n router.events.on(\"routeChangeComplete\", handleRouteChange);\n return () => {\n router.events.off(\"routeChangeComplete\", handleRouteChange);\n };\n }, [router.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","reactPluginRef","useRef","appInsightsRef","current","ReactPlugin","ApplicationInsights","assign","maxBatchSizeInBytes","maxBatchInterval","enableAutoRouteTracking","extensions","useEffect","_a","loadAppInsights","handleRouteChange","url","trackPageView","name","events","on","off","AppInsightsContext"],"sourceRoot":""}
package/lib/index.d.ts ADDED
@@ -0,0 +1,4 @@
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 ADDED
@@ -0,0 +1,2 @@
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={662:(e,t,r)=>{r.d(t,{Provider:()=>c});const n=require("react/jsx-runtime"),o=require("next/router"),i=require("react"),u=require("@microsoft/applicationinsights-react-js"),s=require("@microsoft/applicationinsights-web"),c=({children:e,config:t})=>{const r=(0,o.useRouter)(),c=(0,i.useRef)(null),a=(0,i.useRef)(null);return c.current||(c.current=new u.ReactPlugin),a.current||(a.current=new s.ApplicationInsights({config:Object.assign({maxBatchSizeInBytes:1e4,maxBatchInterval:15e3,enableAutoRouteTracking:!0,extensions:[c.current]},t)})),(0,i.useEffect)((()=>{var e;null===(e=a.current)||void 0===e||e.loadAppInsights();const t=e=>{var t;null===(t=a.current)||void 0===t||t.trackPageView({name:e})};return r.events.on("routeChangeComplete",t),()=>{r.events.off("routeChangeComplete",t)}}),[r.events]),(0,n.jsx)(u.AppInsightsContext.Provider,{value:c.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(662).Provider};return n})()));
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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,2CCAvC,EAA+BA,QAAQ,sCCKhCC,EAAW,EAAGC,WAAUC,aACjC,MAAMC,GAAS,IAAAC,aACTC,GAAiB,IAAAC,QAAO,MACxBC,GAAiB,IAAAD,QAAO,MAqB9B,OApBKD,EAAeG,UAChBH,EAAeG,QAAU,IAAI,EAAAC,aAE5BF,EAAeC,UAChBD,EAAeC,QAAU,IAAI,EAAAE,oBAAoB,CAC7CR,OAAQS,OAAOC,OAAO,CAAEC,oBAAqB,IAAOC,iBAAkB,KAAOC,yBAAyB,EAAMC,WAAY,CAACX,EAAeG,UAAYN,OAG5J,IAAAe,YAAU,KACN,IAAIC,EAC8B,QAAjCA,EAAKX,EAAeC,eAA4B,IAAPU,GAAyBA,EAAGC,kBACtE,MAAMC,EAAqBC,IACvB,IAAIH,EAC8B,QAAjCA,EAAKX,EAAeC,eAA4B,IAAPU,GAAyBA,EAAGI,cAAc,CAAEC,KAAMF,GAAM,EAGtG,OADAlB,EAAOqB,OAAOC,GAAG,sBAAuBL,GACjC,KACHjB,EAAOqB,OAAOE,IAAI,sBAAuBN,EAAkB,CAC9D,GACF,CAACjB,EAAOqB,UACH,SAAK,EAAAG,mBAAmB3B,SAAU,CAAE4B,MAAOvB,EAAeG,QAASP,SAAUA,GAAY,C,GC5BjG4B,EAA2B,CAAC,EAGhC,SAASC,EAAoBC,GAE5B,IAAIC,EAAeH,EAAyBE,GAC5C,QAAqBE,IAAjBD,EACH,OAAOA,EAAatC,QAGrB,IAAIC,EAASkC,EAAyBE,GAAY,CAGjDrC,QAAS,CAAC,GAOX,OAHAwC,EAAoBH,GAAUpC,EAAQA,EAAOD,QAASoC,GAG/CnC,EAAOD,OACf,CCrBAoC,EAAoBK,EAAI,CAACzC,EAAS0C,KACjC,IAAI,IAAIC,KAAOD,EACXN,EAAoBQ,EAAEF,EAAYC,KAASP,EAAoBQ,EAAE5C,EAAS2C,IAC5E1B,OAAO4B,eAAe7C,EAAS2C,EAAK,CAAEG,YAAY,EAAMC,IAAKL,EAAWC,IAE1E,ECNDP,EAAoBQ,EAAI,CAACI,EAAKC,IAAUhC,OAAOiC,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFb,EAAoBiB,EAAKrD,IACH,oBAAXsD,QAA0BA,OAAOC,aAC1CtC,OAAO4B,eAAe7C,EAASsD,OAAOC,YAAa,CAAErB,MAAO,WAE7DjB,OAAO4B,eAAe7C,EAAS,aAAc,CAAEkC,OAAO,GAAO,E,uCCJ9D,SAAiB5B,S,OAAQ,U","sources":["webpack://snokam/webpack/universalModuleDefinition","webpack://snokam/external commonjs \"react/jsx-runtime\"","webpack://snokam/external commonjs \"next/router\"","webpack://snokam/external commonjs \"react\"","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(\"@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 { AppInsightsContext, ReactPlugin, } from \"@microsoft/applicationinsights-react-js\";\nimport { ApplicationInsights, } from \"@microsoft/applicationinsights-web\";\nexport const Provider = ({ children, config }) => {\n const router = useRouter();\n const reactPluginRef = useRef(null);\n const appInsightsRef = useRef(null);\n if (!reactPluginRef.current) {\n reactPluginRef.current = new ReactPlugin();\n }\n if (!appInsightsRef.current) {\n appInsightsRef.current = new ApplicationInsights({\n config: Object.assign({ maxBatchSizeInBytes: 10000, maxBatchInterval: 15000, enableAutoRouteTracking: true, extensions: [reactPluginRef.current] }, config),\n });\n }\n useEffect(() => {\n var _a;\n (_a = appInsightsRef.current) === null || _a === void 0 ? void 0 : _a.loadAppInsights();\n const handleRouteChange = (url) => {\n var _a;\n (_a = appInsightsRef.current) === null || _a === void 0 ? void 0 : _a.trackPageView({ name: url });\n };\n router.events.on(\"routeChangeComplete\", handleRouteChange);\n return () => {\n router.events.off(\"routeChangeComplete\", handleRouteChange);\n };\n }, [router.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","reactPluginRef","useRef","appInsightsRef","current","ReactPlugin","ApplicationInsights","Object","assign","maxBatchSizeInBytes","maxBatchInterval","enableAutoRouteTracking","extensions","useEffect","_a","loadAppInsights","handleRouteChange","url","trackPageView","name","events","on","off","AppInsightsContext","value","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","d","definition","key","o","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag"],"sourceRoot":""}
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "name": "@snokam/application-insights",
3
+ "description": "Snøkam core components",
4
+ "version": "1.2.5",
5
+ "main": "lib/index.js",
6
+ "typings": "lib/index.d.ts",
7
+ "files": [
8
+ "lib",
9
+ "package.json",
10
+ "CHANGELOG.md"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "ssh://git@github.com:snokam/components.git",
15
+ "directory": "@snokam/core"
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
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "dependencies": {
27
+ "@microsoft/applicationinsights-react-js": "^17.3.3",
28
+ "@microsoft/applicationinsights-web": "^3.3.4",
29
+ "history": "^5.3.0"
30
+ },
31
+ "peerDependencies": {
32
+ "next": "^14.0.0",
33
+ "react": "^18.0.0",
34
+ "react-dom": "^18.0.0"
35
+ },
36
+ "gitHead": "552879a7efe5597151d52bc2e49b49f64c4f266c"
37
+ }