@backstage-community/plugin-analytics-module-matomo 1.9.0 → 1.10.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
@@ -1,5 +1,23 @@
1
1
  ### Dependencies
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ac6e8f9: Backstage version bump to v1.34.1
8
+
9
+ ### Patch Changes
10
+
11
+ - 350250c: Updated dependency `@testing-library/jest-dom` to `6.6.3`.
12
+ - 0f5c451: Updated dependency `prettier` to `3.4.2`.
13
+ - 18f9d9d: Updated dependency `@types/node` to `18.19.68`.
14
+
15
+ ## 1.9.1
16
+
17
+ ### Patch Changes
18
+
19
+ - a6e850f: Updated dependency `msw` to `1.3.5`.
20
+
3
21
  ## 1.9.0
4
22
 
5
23
  ### Minor Changes
@@ -1 +1 @@
1
- {"version":3,"file":"Matomo.esm.js","sources":["../../src/api/Matomo.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n AnalyticsApi,\n AnalyticsEvent,\n ConfigApi,\n analyticsApiRef,\n configApiRef,\n createApiFactory,\n} from '@backstage/core-plugin-api';\n\nimport { loadMatomo } from './loadMatomo';\n\ndeclare const window: Window &\n typeof globalThis & {\n _paq: any[];\n };\n\ntype Options = {\n configApi: ConfigApi;\n};\n\n/**\n * @public\n */\nexport class MatomoAnalytics implements AnalyticsApi {\n private readonly configApi: ConfigApi;\n\n private constructor(options: Options) {\n this.configApi = options.configApi;\n const matomoUrl = this.configApi.getString('app.analytics.matomo.host');\n const matomoSiteId = this.configApi.getNumber(\n 'app.analytics.matomo.siteId',\n );\n loadMatomo(matomoUrl, matomoSiteId);\n }\n\n static fromConfig(config: ConfigApi) {\n return new MatomoAnalytics({ configApi: config });\n }\n\n captureEvent(event: AnalyticsEvent) {\n const { context, action, subject, value } = event;\n // REF: https://github.com/backstage/community-plugins/blob/main/workspaces/analytics/plugins/analytics-module-ga/src/apis/implementations/AnalyticsApi/GoogleAnalytics.ts#L160\n // REF: https://matomo.org/faq/reports/implement-event-tracking-with-matomo/\n window._paq.push([\n 'trackEvent',\n context.extension || 'App',\n action,\n subject,\n value,\n ]);\n }\n}\n\n/**\n * Api factory method for matomo\n * @public\n */\nexport const MatomoAnalyticsApi = createApiFactory({\n api: analyticsApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) => MatomoAnalytics.fromConfig(configApi),\n});\n"],"names":[],"mappings":";;;AAsCO,MAAM,eAAwC,CAAA;AAAA,EAClC,SAAA,CAAA;AAAA,EAET,YAAY,OAAkB,EAAA;AACpC,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA,CAAA;AACzB,IAAA,MAAM,SAAY,GAAA,IAAA,CAAK,SAAU,CAAA,SAAA,CAAU,2BAA2B,CAAA,CAAA;AACtE,IAAM,MAAA,YAAA,GAAe,KAAK,SAAU,CAAA,SAAA;AAAA,MAClC,6BAAA;AAAA,KACF,CAAA;AACA,IAAA,UAAA,CAAW,WAAW,YAAY,CAAA,CAAA;AAAA,GACpC;AAAA,EAEA,OAAO,WAAW,MAAmB,EAAA;AACnC,IAAA,OAAO,IAAI,eAAA,CAAgB,EAAE,SAAA,EAAW,QAAQ,CAAA,CAAA;AAAA,GAClD;AAAA,EAEA,aAAa,KAAuB,EAAA;AAClC,IAAA,MAAM,EAAE,OAAA,EAAS,MAAQ,EAAA,OAAA,EAAS,OAAU,GAAA,KAAA,CAAA;AAG5C,IAAA,MAAA,CAAO,KAAK,IAAK,CAAA;AAAA,MACf,YAAA;AAAA,MACA,QAAQ,SAAa,IAAA,KAAA;AAAA,MACrB,MAAA;AAAA,MACA,OAAA;AAAA,MACA,KAAA;AAAA,KACD,CAAA,CAAA;AAAA,GACH;AACF,CAAA;AAMO,MAAM,qBAAqB,gBAAiB,CAAA;AAAA,EACjD,GAAK,EAAA,eAAA;AAAA,EACL,IAAA,EAAM,EAAE,SAAA,EAAW,YAAa,EAAA;AAAA,EAChC,SAAS,CAAC,EAAE,WAAgB,KAAA,eAAA,CAAgB,WAAW,SAAS,CAAA;AAClE,CAAC;;;;"}
1
+ {"version":3,"file":"Matomo.esm.js","sources":["../../src/api/Matomo.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport {\n AnalyticsApi,\n AnalyticsEvent,\n ConfigApi,\n analyticsApiRef,\n configApiRef,\n createApiFactory,\n} from '@backstage/core-plugin-api';\n\nimport { loadMatomo } from './loadMatomo';\n\ndeclare const window: Window &\n typeof globalThis & {\n _paq: any[];\n };\n\ntype Options = {\n configApi: ConfigApi;\n};\n\n/**\n * @public\n */\nexport class MatomoAnalytics implements AnalyticsApi {\n private readonly configApi: ConfigApi;\n\n private constructor(options: Options) {\n this.configApi = options.configApi;\n const matomoUrl = this.configApi.getString('app.analytics.matomo.host');\n const matomoSiteId = this.configApi.getNumber(\n 'app.analytics.matomo.siteId',\n );\n loadMatomo(matomoUrl, matomoSiteId);\n }\n\n static fromConfig(config: ConfigApi) {\n return new MatomoAnalytics({ configApi: config });\n }\n\n captureEvent(event: AnalyticsEvent) {\n const { context, action, subject, value } = event;\n // REF: https://github.com/backstage/community-plugins/blob/main/workspaces/analytics/plugins/analytics-module-ga/src/apis/implementations/AnalyticsApi/GoogleAnalytics.ts#L160\n // REF: https://matomo.org/faq/reports/implement-event-tracking-with-matomo/\n window._paq.push([\n 'trackEvent',\n context.extension || 'App',\n action,\n subject,\n value,\n ]);\n }\n}\n\n/**\n * Api factory method for matomo\n * @public\n */\nexport const MatomoAnalyticsApi = createApiFactory({\n api: analyticsApiRef,\n deps: { configApi: configApiRef },\n factory: ({ configApi }) => MatomoAnalytics.fromConfig(configApi),\n});\n"],"names":[],"mappings":";;;AAsCO,MAAM,eAAwC,CAAA;AAAA,EAClC,SAAA;AAAA,EAET,YAAY,OAAkB,EAAA;AACpC,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,SAAA;AACzB,IAAA,MAAM,SAAY,GAAA,IAAA,CAAK,SAAU,CAAA,SAAA,CAAU,2BAA2B,CAAA;AACtE,IAAM,MAAA,YAAA,GAAe,KAAK,SAAU,CAAA,SAAA;AAAA,MAClC;AAAA,KACF;AACA,IAAA,UAAA,CAAW,WAAW,YAAY,CAAA;AAAA;AACpC,EAEA,OAAO,WAAW,MAAmB,EAAA;AACnC,IAAA,OAAO,IAAI,eAAA,CAAgB,EAAE,SAAA,EAAW,QAAQ,CAAA;AAAA;AAClD,EAEA,aAAa,KAAuB,EAAA;AAClC,IAAA,MAAM,EAAE,OAAA,EAAS,MAAQ,EAAA,OAAA,EAAS,OAAU,GAAA,KAAA;AAG5C,IAAA,MAAA,CAAO,KAAK,IAAK,CAAA;AAAA,MACf,YAAA;AAAA,MACA,QAAQ,SAAa,IAAA,KAAA;AAAA,MACrB,MAAA;AAAA,MACA,OAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA;AAEL;AAMO,MAAM,qBAAqB,gBAAiB,CAAA;AAAA,EACjD,GAAK,EAAA,eAAA;AAAA,EACL,IAAA,EAAM,EAAE,SAAA,EAAW,YAAa,EAAA;AAAA,EAChC,SAAS,CAAC,EAAE,WAAgB,KAAA,eAAA,CAAgB,WAAW,SAAS;AAClE,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadMatomo.esm.js","sources":["../../src/api/loadMatomo.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nlet isInitialized = false;\nexport const loadMatomo = (matomoUrl: string, siteId: number) => {\n /* Only initialize matomo tracker if it's not loaded */\n if (isInitialized) return;\n\n const _paq = ((window as any)._paq = (window as any)._paq || []);\n /* tracker methods like \"setCustomDimension\" should be called before \"trackPageView\" */\n _paq.push(['trackPageView']);\n _paq.push(['enableLinkTracking']);\n (() => {\n const u = `//${matomoUrl}/`;\n _paq.push(['setTrackerUrl', `${u}matomo.php`]);\n _paq.push(['setSiteId', siteId]);\n const d = document;\n const g = d.createElement('script');\n const s = d.getElementsByTagName('script')[0];\n g.async = true;\n g.src = `${u}matomo.js`;\n s.parentNode?.insertBefore(g, s);\n })();\n\n isInitialized = true;\n};\n"],"names":[],"mappings":"AAeA,IAAI,aAAgB,GAAA,KAAA,CAAA;AACP,MAAA,UAAA,GAAa,CAAC,SAAA,EAAmB,MAAmB,KAAA;AAE/D,EAAA,IAAI,aAAe,EAAA,OAAA;AAEnB,EAAA,MAAM,IAAS,GAAA,MAAA,CAAe,IAAQ,GAAA,MAAA,CAAe,QAAQ,EAAC,CAAA;AAE9D,EAAK,IAAA,CAAA,IAAA,CAAK,CAAC,eAAe,CAAC,CAAA,CAAA;AAC3B,EAAK,IAAA,CAAA,IAAA,CAAK,CAAC,oBAAoB,CAAC,CAAA,CAAA;AAChC,EAAA,CAAC,MAAM;AACL,IAAM,MAAA,CAAA,GAAI,KAAK,SAAS,CAAA,CAAA,CAAA,CAAA;AACxB,IAAA,IAAA,CAAK,KAAK,CAAC,eAAA,EAAiB,CAAG,EAAA,CAAC,YAAY,CAAC,CAAA,CAAA;AAC7C,IAAA,IAAA,CAAK,IAAK,CAAA,CAAC,WAAa,EAAA,MAAM,CAAC,CAAA,CAAA;AAC/B,IAAA,MAAM,CAAI,GAAA,QAAA,CAAA;AACV,IAAM,MAAA,CAAA,GAAI,CAAE,CAAA,aAAA,CAAc,QAAQ,CAAA,CAAA;AAClC,IAAA,MAAM,CAAI,GAAA,CAAA,CAAE,oBAAqB,CAAA,QAAQ,EAAE,CAAC,CAAA,CAAA;AAC5C,IAAA,CAAA,CAAE,KAAQ,GAAA,IAAA,CAAA;AACV,IAAE,CAAA,CAAA,GAAA,GAAM,GAAG,CAAC,CAAA,SAAA,CAAA,CAAA;AACZ,IAAE,CAAA,CAAA,UAAA,EAAY,YAAa,CAAA,CAAA,EAAG,CAAC,CAAA,CAAA;AAAA,GAC9B,GAAA,CAAA;AAEH,EAAgB,aAAA,GAAA,IAAA,CAAA;AAClB;;;;"}
1
+ {"version":3,"file":"loadMatomo.esm.js","sources":["../../src/api/loadMatomo.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nlet isInitialized = false;\nexport const loadMatomo = (matomoUrl: string, siteId: number) => {\n /* Only initialize matomo tracker if it's not loaded */\n if (isInitialized) return;\n\n const _paq = ((window as any)._paq = (window as any)._paq || []);\n /* tracker methods like \"setCustomDimension\" should be called before \"trackPageView\" */\n _paq.push(['trackPageView']);\n _paq.push(['enableLinkTracking']);\n (() => {\n const u = `//${matomoUrl}/`;\n _paq.push(['setTrackerUrl', `${u}matomo.php`]);\n _paq.push(['setSiteId', siteId]);\n const d = document;\n const g = d.createElement('script');\n const s = d.getElementsByTagName('script')[0];\n g.async = true;\n g.src = `${u}matomo.js`;\n s.parentNode?.insertBefore(g, s);\n })();\n\n isInitialized = true;\n};\n"],"names":[],"mappings":"AAeA,IAAI,aAAgB,GAAA,KAAA;AACP,MAAA,UAAA,GAAa,CAAC,SAAA,EAAmB,MAAmB,KAAA;AAE/D,EAAA,IAAI,aAAe,EAAA;AAEnB,EAAA,MAAM,IAAS,GAAA,MAAA,CAAe,IAAQ,GAAA,MAAA,CAAe,QAAQ,EAAC;AAE9D,EAAK,IAAA,CAAA,IAAA,CAAK,CAAC,eAAe,CAAC,CAAA;AAC3B,EAAK,IAAA,CAAA,IAAA,CAAK,CAAC,oBAAoB,CAAC,CAAA;AAChC,EAAA,CAAC,MAAM;AACL,IAAM,MAAA,CAAA,GAAI,KAAK,SAAS,CAAA,CAAA,CAAA;AACxB,IAAA,IAAA,CAAK,KAAK,CAAC,eAAA,EAAiB,CAAG,EAAA,CAAC,YAAY,CAAC,CAAA;AAC7C,IAAA,IAAA,CAAK,IAAK,CAAA,CAAC,WAAa,EAAA,MAAM,CAAC,CAAA;AAC/B,IAAA,MAAM,CAAI,GAAA,QAAA;AACV,IAAM,MAAA,CAAA,GAAI,CAAE,CAAA,aAAA,CAAc,QAAQ,CAAA;AAClC,IAAA,MAAM,CAAI,GAAA,CAAA,CAAE,oBAAqB,CAAA,QAAQ,EAAE,CAAC,CAAA;AAC5C,IAAA,CAAA,CAAE,KAAQ,GAAA,IAAA;AACV,IAAE,CAAA,CAAA,GAAA,GAAM,GAAG,CAAC,CAAA,SAAA,CAAA;AACZ,IAAE,CAAA,CAAA,UAAA,EAAY,YAAa,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,GAC9B,GAAA;AAEH,EAAgB,aAAA,GAAA,IAAA;AAClB;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
2
2
  import { AnalyticsApi, ConfigApi, AnalyticsEvent } from '@backstage/core-plugin-api';
3
- import * as _backstage_config from '@backstage/config';
3
+ import * as _backstage_config_index from '@backstage/config/index';
4
4
 
5
5
  /** @public */
6
6
  declare const analyticsModuleMatomoPlugin: _backstage_core_plugin_api.BackstagePlugin<{}, {}, {}>;
@@ -19,7 +19,7 @@ declare class MatomoAnalytics implements AnalyticsApi {
19
19
  * @public
20
20
  */
21
21
  declare const MatomoAnalyticsApi: _backstage_core_plugin_api.ApiFactory<AnalyticsApi, MatomoAnalytics, {
22
- configApi: _backstage_config.Config;
22
+ configApi: _backstage_config_index.Config;
23
23
  }>;
24
24
 
25
25
  export { MatomoAnalytics, MatomoAnalyticsApi, analyticsModuleMatomoPlugin };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createPlugin } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const analyticsModuleMatomoPlugin = createPlugin({\n id: 'analytics-module-matomo',\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,8BAA8B,YAAa,CAAA;AAAA,EACtD,EAAI,EAAA,yBAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2024 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { createPlugin } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const analyticsModuleMatomoPlugin = createPlugin({\n id: 'analytics-module-matomo',\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,8BAA8B,YAAa,CAAA;AAAA,EACtD,EAAI,EAAA;AACN,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-analytics-module-matomo",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "main": "dist/index.esm.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -34,22 +34,22 @@
34
34
  "directory": "workspaces/analytics/plugins/analytics-module-matomo"
35
35
  },
36
36
  "dependencies": {
37
- "@backstage/core-plugin-api": "^1.10.0"
37
+ "@backstage/core-plugin-api": "^1.10.2"
38
38
  },
39
39
  "peerDependencies": {
40
40
  "react": "^16.13.1 || ^17.0.0 || ^18.0.0"
41
41
  },
42
42
  "devDependencies": {
43
- "@backstage/cli": "0.28.2",
44
- "@backstage/core-app-api": "1.15.1",
45
- "@backstage/core-components": "^0.15.1",
46
- "@backstage/dev-utils": "1.1.2",
43
+ "@backstage/cli": "^0.29.4",
44
+ "@backstage/core-app-api": "^1.15.3",
45
+ "@backstage/core-components": "^0.16.2",
46
+ "@backstage/dev-utils": "^1.1.5",
47
47
  "@redhat-developer/red-hat-developer-hub-theme": "0.4.0",
48
- "@testing-library/jest-dom": "6.4.8",
49
- "@types/node": "18.19.33",
48
+ "@testing-library/jest-dom": "6.6.3",
49
+ "@types/node": "18.19.68",
50
50
  "cross-fetch": "4.0.0",
51
- "msw": "1.3.3",
52
- "prettier": "3.3.3"
51
+ "msw": "1.3.5",
52
+ "prettier": "3.4.2"
53
53
  },
54
54
  "files": [
55
55
  "dist",
@@ -67,5 +67,12 @@
67
67
  "support:tech-preview",
68
68
  "lifecycle:active"
69
69
  ],
70
+ "typesVersions": {
71
+ "*": {
72
+ "index": [
73
+ "dist/index.d.ts"
74
+ ]
75
+ }
76
+ },
70
77
  "module": "./dist/index.esm.js"
71
78
  }