@doreamonjs/plugin-analysis 1.8.39 → 1.9.12

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,6 +3,25 @@
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.9.12](https://github.com/doreamonjs/doreamon/compare/v1.9.11...v1.9.12) (2023-08-20)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **plugin-analysis:** umami v2.5.0 use /script.js instead of /umami.js ([07104e6](https://github.com/doreamonjs/doreamon/commit/07104e6f14fd64af0df5122cc74dbb24f5a3c053))
12
+
13
+
14
+
15
+
16
+
17
+ ## [1.9.9](https://github.com/doreamonjs/doreamon/compare/v1.9.8...v1.9.9) (2023-08-19)
18
+
19
+ **Note:** Version bump only for package @doreamonjs/plugin-analysis
20
+
21
+
22
+
23
+
24
+
6
25
  ## [1.8.39](https://github.com/doreamonjs/doreamon/compare/v1.8.38...v1.8.39) (2023-08-04)
7
26
 
8
27
  **Note:** Version bump only for package @doreamonjs/plugin-analysis
package/lib/service.js CHANGED
@@ -91,6 +91,35 @@ class Service {
91
91
  (_a = instance === null || instance === void 0 ? void 0 : instance.track) === null || _a === void 0 ? void 0 : _a.call(instance, event, attributes);
92
92
  },
93
93
  },
94
+ umami: {
95
+ setup: async (config) => {
96
+ if (!(config === null || config === void 0 ? void 0 : config.id) || !(config === null || config === void 0 ? void 0 : config.server)) {
97
+ this.logger.error('umami config server and id are missing');
98
+ return;
99
+ }
100
+ // @TODO attributes need setAttribute(key, value) instead of script[key] = value
101
+ // await doreamon.fs.loadJs(`${config.server}/script.js`, {
102
+ // defer: true,
103
+ // 'data-website-id': config.id,
104
+ // });
105
+ await new Promise((resolve, reject) => {
106
+ const el = document.createElement('script');
107
+ el.async = true;
108
+ el.setAttribute('src', `${config.server}/script.js`);
109
+ el.setAttribute('data-website-id', config.id);
110
+ el.onerror = reject;
111
+ el.onload = function () {
112
+ resolve();
113
+ };
114
+ document.head.appendChild(el);
115
+ });
116
+ return window.umami;
117
+ },
118
+ track: (instance, event, attributes) => {
119
+ var _a;
120
+ (_a = instance === null || instance === void 0 ? void 0 : instance.track) === null || _a === void 0 ? void 0 : _a.call(instance, event, attributes);
121
+ },
122
+ },
94
123
  };
95
124
  }
96
125
  get namespace() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@doreamonjs/plugin-analysis",
3
- "version": "1.8.39",
3
+ "version": "1.9.12",
4
4
  "description": "analysis plugin for doreamonjs",
5
5
  "keywords": [
6
6
  "doreamonjs",
@@ -78,5 +78,5 @@
78
78
  "mixpanel-browser": "^2.45.0",
79
79
  "thinkingdata-browser": "^1.6.0"
80
80
  },
81
- "gitHead": "00c99aa14a17841adc4926b7167970429e8097b1"
81
+ "gitHead": "2a21553619c089ec1eff9d02e4b64963f04d70dc"
82
82
  }