Socket
Socket
Sign inDemoInstall

@bufferapp/analytics-middleware

Package Overview
Dependencies
2
Maintainers
35
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.76.0 to 1.76.1

22

middleware.js

@@ -5,2 +5,20 @@ import { BufferTracker } from '@bufferapp/buffer-tracking-browser-ts'

export default store => next => (action) => { // eslint-disable-line no-unused-vars
let organizationId = null;
const state = store.getState();
// This is used to get the organizationId from the user context exposed by the App-Shell
if (
window.__userData &&
window.__userData.data &&
window.__userData.data.account &&
window.__userData.data.account.currentOrganization &&
window.__userData.data.account.currentOrganization.id
) {
organizationId = window.__userData.data.account.currentOrganization.id;
} else if (
state.profiles &&
state.profiles.organizationId
) {
organizationId = store.getState().profiles.organizationId
}
switch (action.type) {

@@ -12,3 +30,3 @@ case actionTypes.TRACK_EVENT:

product: window.PRODUCT_TRACKING_KEY,
organizationId: store.getState().profiles.organizationId
organizationId,
})

@@ -22,3 +40,3 @@ }

product: window.PRODUCT_TRACKING_KEY,
organizationId: store.getState().profiles.organizationId
organizationId,
})

@@ -25,0 +43,0 @@ }

@@ -73,2 +73,27 @@ import { BufferTracker } from '@bufferapp/buffer-tracking-browser-ts'

});
it('should push an event with the organizationId from the account Object', () => {
window.__userData = {
data: {
account: {
currentOrganization: {
id: 'fooOrgGlobal',
},
},
},
}
const action = {
type: actionTypes.PAGE_CHANGE,
payload: {
bar: 'bar',
},
};
middleware(store)(next)(action);
expect(BufferTracker.pageViewed)
.toHaveBeenCalledWith({
bar: 'bar',
product: 'analyze',
organizationId: 'fooOrgGlobal',
});
});
});

2

package.json
{
"name": "@bufferapp/analytics-middleware",
"version": "1.76.0",
"version": "1.76.1",
"description": "Analyze Demographic Data Store",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc