@ravti/analytics
Advanced tools
Comparing version 21.5.2-rc4b0 to 21.5.2-rc4b1
"use strict"; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
@@ -326,6 +328,22 @@ | ||
metadata = _ref4.metadata; | ||
console.debug("LogRocket noop: track called", { | ||
key: key, | ||
metadata: metadata | ||
}); | ||
try { | ||
var eventString = JSON.stringify({ | ||
key: key, | ||
metadata: metadata | ||
}, null, 2); | ||
LogRocket.track(eventString); | ||
} catch (err) { | ||
// Let the console know but swallow the error so that we don't halt | ||
// execution b/c we couldn't represent the payload as a JSON string | ||
// | ||
// https://docs.logrocket.com/reference#track | ||
console.warn("Error while trying to track the event \"".concat(key, "\" to LogRocket"), err); | ||
if (typeof key === "string" || key instanceof String) { | ||
LogRocket.track(key); | ||
} else { | ||
console.debug("Could not track event to LogRocket with type ".concat(_typeof(key))); | ||
} | ||
} | ||
} | ||
@@ -345,2 +363,14 @@ }]); | ||
_createClass(RavtiAnalytics, null, [{ | ||
key: "reduxMiddlware", | ||
value: function reduxMiddlware() { | ||
// If we ever need to add more middlewares for analytical purposes we can | ||
// do this here... this at least sets the stage for us to have this | ||
// consolidated in one place... also, in the future, we could consider | ||
// using some of the sanitation features in the LogRocket middleware | ||
// stuff... | ||
// | ||
// https://docs.logrocket.com/reference#redux-logging | ||
return LogRocket.reduxMiddleware(); | ||
} | ||
}, { | ||
key: "start", | ||
@@ -347,0 +377,0 @@ value: function start(user, userType) { |
{ | ||
"name": "@ravti/analytics", | ||
"version": "21.5.2-rc4b0", | ||
"version": "21.5.2-rc4b1", | ||
"description": "Ravti analytics", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
16764
454