@armco/analytics 0.0.7 → 0.0.9

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/dist/analytics.js CHANGED
@@ -126,7 +126,7 @@ function enrichEventData(data) {
126
126
  user && (data.user = user);
127
127
  }
128
128
  }
129
- function validateEvent(data) {
129
+ function isMalformedEvent(data) {
130
130
  return !data || !data.eventType;
131
131
  }
132
132
  export function sendBulkData(data, callback) {
@@ -147,7 +147,7 @@ function sendAnalyticsData(data) {
147
147
  headers: {
148
148
  'Content-Type': 'application/json',
149
149
  },
150
- body: { event: JSON.stringify(data) },
150
+ body: JSON.stringify({ event: data }),
151
151
  };
152
152
  if (apiKey) {
153
153
  options.headers.Authorization = `Bearer ${apiKey}`;
@@ -199,7 +199,7 @@ function trackEvent(event, data) {
199
199
  else {
200
200
  data = event;
201
201
  }
202
- if (!validateEvent(data)) {
202
+ if (isMalformedEvent(data)) {
203
203
  console.error("Attempting to send empty event, or event missing eventType, failing send...");
204
204
  return;
205
205
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@armco/analytics",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "Browser Based Analytics interceptor for configured events",
5
5
  "main": "index.js",
6
6
  "type": "module",