@nexrender/core 1.46.0 → 1.46.3
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/package.json +2 -3
- package/src/helpers/analytics.js +8 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nexrender/core",
|
|
3
|
-
"version": "1.46.
|
|
3
|
+
"version": "1.46.3",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"author": "Inlife",
|
|
6
6
|
"homepage": "https://www.nexrender.com",
|
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
"mime-types": "^2.1.29",
|
|
20
20
|
"mkdirp": "^1.0.4",
|
|
21
21
|
"nanoid": "^3.2.0",
|
|
22
|
-
"posthog-node": "^3.1.1",
|
|
23
22
|
"requireg": "^0.2.1",
|
|
24
23
|
"rimraf": "^3.0.2",
|
|
25
24
|
"systeminformation": "^5.18.3"
|
|
@@ -36,5 +35,5 @@
|
|
|
36
35
|
"publishConfig": {
|
|
37
36
|
"access": "public"
|
|
38
37
|
},
|
|
39
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "91da069a48124f19d7199ff9260319c9e630a2c0"
|
|
40
39
|
}
|
package/src/helpers/analytics.js
CHANGED
|
@@ -5,7 +5,6 @@ const crypto = require('crypto')
|
|
|
5
5
|
|
|
6
6
|
const si = require('systeminformation')
|
|
7
7
|
const { nanoid } = require('nanoid')
|
|
8
|
-
const {PostHog} = require('posthog-node')
|
|
9
8
|
const childProcess = require('child_process')
|
|
10
9
|
|
|
11
10
|
const { version } = require('../../package.json')
|
|
@@ -15,13 +14,6 @@ const hash = (data, salt) => crypto
|
|
|
15
14
|
.update(data)
|
|
16
15
|
.digest('hex');
|
|
17
16
|
|
|
18
|
-
const analyticsPublicKey = 'phc_AWcZMlCOqHJiFyFKSoxT9WSrRkdKDFxpiFn8Ww0ZMHu';
|
|
19
|
-
const analytics = new PostHog(analyticsPublicKey, {
|
|
20
|
-
host: 'https://eu.posthog.com',
|
|
21
|
-
flushAt: 1,
|
|
22
|
-
flushInterval: 0,
|
|
23
|
-
disableGeoip: true,
|
|
24
|
-
});
|
|
25
17
|
|
|
26
18
|
/**
|
|
27
19
|
* A helper function to force syncronous tracking
|
|
@@ -32,7 +24,7 @@ const analytics = new PostHog(analyticsPublicKey, {
|
|
|
32
24
|
*/
|
|
33
25
|
const forceSyncRequest = (settings, event, properties) => {
|
|
34
26
|
const args = JSON.stringify({settings, event, properties})
|
|
35
|
-
|
|
27
|
+
childProcess.fork(__filename, ['child', args], {
|
|
36
28
|
stdio: 'ignore',
|
|
37
29
|
})
|
|
38
30
|
}
|
|
@@ -51,7 +43,7 @@ let cache = {
|
|
|
51
43
|
* @param {*} properties
|
|
52
44
|
* @returns {Promise<void>}
|
|
53
45
|
*/
|
|
54
|
-
const track = async (settings, event, properties = {}
|
|
46
|
+
const track = async (settings, event, properties = {}) => {
|
|
55
47
|
// if (isRemote) console.log('tracking', event, properties, settings)
|
|
56
48
|
|
|
57
49
|
if (settings.noAnalytics === true) return;
|
|
@@ -186,13 +178,16 @@ const track = async (settings, event, properties = {}, isRemote) => {
|
|
|
186
178
|
|
|
187
179
|
// console.log('tracking event:', params)
|
|
188
180
|
|
|
189
|
-
|
|
190
|
-
|
|
181
|
+
|
|
182
|
+
// removed posthog for now
|
|
183
|
+
params.foo = 1;
|
|
184
|
+
// analytics.capture(params);
|
|
185
|
+
// await analytics.flush();
|
|
191
186
|
}
|
|
192
187
|
|
|
193
188
|
if (process.argv[2] === 'child') {
|
|
194
189
|
const args = JSON.parse(process.argv[3])
|
|
195
|
-
track(args.settings, args.event, args.properties
|
|
190
|
+
track(args.settings, args.event, args.properties)
|
|
196
191
|
.then(() => {})
|
|
197
192
|
}
|
|
198
193
|
|