@webiny/telemetry
Advanced tools
Comparing version 5.14.0 to 5.15.0-beta.0
@@ -6,2 +6,30 @@ # Change Log | ||
# [5.15.0-beta.0](https://github.com/webiny/webiny-js/compare/v5.14.0...v5.15.0-beta.0) (2021-09-16) | ||
### Bug Fixes | ||
* add comment ([61dafeb](https://github.com/webiny/webiny-js/commit/61dafeb08883b1c80033d3164581f56138fee675)) | ||
* correct args passing in `setProperties` function ([2ac0fed](https://github.com/webiny/webiny-js/commit/2ac0fedb8bf760b15686de44523138816e708c36)) | ||
* correct if statements ([1dcdd73](https://github.com/webiny/webiny-js/commit/1dcdd735d89f1918952481a6ae510a60cf113b7f)) | ||
* create utils ([6a24dcf](https://github.com/webiny/webiny-js/commit/6a24dcfb02130a672c1e90794910f8a0549f659d)) | ||
* remove old api folder ([5dce8e2](https://github.com/webiny/webiny-js/commit/5dce8e2c7871fd1e24326e73e3a9459208ce7f75)) | ||
* rename to `extraPayload` ([b5bcda8](https://github.com/webiny/webiny-js/commit/b5bcda88029c003d0c5704a37bff4771b9056d5e)) | ||
* update dependencies ([37f2691](https://github.com/webiny/webiny-js/commit/37f2691f3cb615615a089d977f58a22a8bb21f50)) | ||
* use base `sendEvent` function ([6f93072](https://github.com/webiny/webiny-js/commit/6f9307212e05b98f2a4866002258238b216e0b3b)) | ||
* use built-in isEnabled ([4051257](https://github.com/webiny/webiny-js/commit/4051257c58165dbcc9805283d183583ed0bf7d15)) | ||
* use global-config package ([a678b18](https://github.com/webiny/webiny-js/commit/a678b18d9d760a69eb6badaaf6451acd3c7fb953)) | ||
### Features | ||
* add telemetry getter ([b1a5e8d](https://github.com/webiny/webiny-js/commit/b1a5e8df96b1591266fbd8df90d6689a526da0f3)) | ||
* add utils ([d9be82a](https://github.com/webiny/webiny-js/commit/d9be82a76f5210704c71cd8e191aca698cb0963c)) | ||
* create `sendEvent` function for CLI environment ([d0babff](https://github.com/webiny/webiny-js/commit/d0babffeb1cb3a7a796caa8a25f3f9a2ba9359d7)) | ||
* create base `sendEvent` function ([a764e85](https://github.com/webiny/webiny-js/commit/a764e854c5da0ebcb99038e9b9aaf3184202edc3)) | ||
# [5.14.0](https://github.com/webiny/webiny-js/compare/v5.14.0-beta.0...v5.14.0) (2021-08-30) | ||
@@ -8,0 +36,0 @@ |
{ | ||
"name": "@webiny/telemetry", | ||
"version": "5.14.0", | ||
"main": "index.js", | ||
"version": "5.15.0-beta.0", | ||
"license": "MIT", | ||
"dependencies": { | ||
"@webiny/global-config": "5.15.0-beta.0", | ||
"form-data": "3.0.0", | ||
"load-json-file": "6.2.0", | ||
"node-fetch": "2.6.1" | ||
@@ -15,3 +14,3 @@ }, | ||
}, | ||
"gitHead": "78351b0bdaf25c26d7011d8f35ccf4c0a2419d92" | ||
"gitHead": "baf2dbb8cae1b623b59d20fedc0cd0e11a310ca1" | ||
} |
42
react.js
@@ -1,33 +0,31 @@ | ||
/* eslint-disable */ | ||
const { API_KEY, API_URL } = require("./api"); | ||
const baseSendEvent = require("./sendEvent"); | ||
const setProperties = data => { | ||
sendEvent("$identify", {}, data); | ||
return sendEvent("$identify", data); | ||
}; | ||
const sendEvent = (event, data = {}) => { | ||
if (process.env.REACT_APP_WEBINY_TELEMETRY !== "false") { | ||
data.version = process.env.REACT_APP_WEBINY_VERSION; | ||
if (process.env.REACT_APP_WEBINY_TELEMETRY === "false") { | ||
return; | ||
} | ||
const payload = { | ||
api_key: API_KEY, | ||
distinct_id: process.env.REACT_APP_USER_ID, | ||
event, | ||
properties: event === "$identify" ? {} : data, | ||
$set: event === "$identify" ? data : {}, | ||
timestamp: new Date().toISOString() | ||
let properties = {}; | ||
let extraPayload = {}; | ||
if (event !== "$identify") { | ||
properties = data; | ||
} else { | ||
extraPayload = { | ||
$set: data | ||
}; | ||
} | ||
const formData = new FormData(); | ||
formData.append("data", btoa(JSON.stringify(payload))); | ||
return fetch(API_URL + "/capture/", { | ||
method: "POST", | ||
body: formData | ||
}).catch(() => { | ||
// Ignore errors | ||
}); | ||
} | ||
return baseSendEvent({ | ||
event, | ||
properties, | ||
extraPayload, | ||
user: process.env.REACT_APP_USER_ID, | ||
version: process.env.REACT_APP_WEBINY_VERSION | ||
}); | ||
}; | ||
module.exports = { setProperties, sendEvent }; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10617
104
1
2
+ Added@webiny/global-config@5.15.0-beta.0(transitive)
+ Addeddetect-indent@6.1.0(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedis-plain-obj@2.1.0(transitive)
+ Addedis-typedarray@1.0.0(transitive)
+ Addedmake-dir@3.1.0(transitive)
+ Addedsemver@6.3.1(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsort-keys@4.2.0(transitive)
+ Addedtypedarray-to-buffer@3.1.5(transitive)
+ Addeduuid@8.3.2(transitive)
+ Addedwrite-file-atomic@3.0.3(transitive)
+ Addedwrite-json-file@4.3.0(transitive)
- Removedload-json-file@6.2.0