Socket
Socket
Sign inDemoInstall

@bufferapp/analyze-csv-export

Package Overview
Dependencies
Maintainers
24
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bufferapp/analyze-csv-export - npm Package Compare versions

Comparing version 0.90.0 to 0.91.0

coverage/clover.xml

13

middleware.js

@@ -0,1 +1,3 @@

import { actions as analyticsActions } from '@bufferapp/analytics-middleware';
import { getNumOfDaysForDateRange, getRouteElements } from '@bufferapp/analyze-shared-components/utils';
import { actionTypes, actions } from './reducer';

@@ -6,5 +8,14 @@ import generateCSVsFromCharts from './lib/generateCSVFromChart';

export default store => next => (action) => { // eslint-disable-line no-unused-vars
const { exportToCSV, date } = store.getState();
const { exportToCSV, date, router } = store.getState();
const routeElements = getRouteElements(router);
switch (action.type) {
case actionTypes.EXPORT_TO_CSV_START:
store.dispatch(analyticsActions.trackEvent('Page Exported', {
days: getNumOfDaysForDateRange(date),
exportType: 'csv',
name: routeElements.name,
channel: routeElements.channel,
}));
return generateCSVsFromCharts(exportToCSV.charts, date)

@@ -11,0 +22,0 @@ .then((csvs) => {

/* eslint-disable import/first */
import { actions as analyticsActions } from '@bufferapp/analytics-middleware';
import middleware from './middleware';

@@ -62,2 +63,6 @@ import { actions, actionTypes } from './reducer';

exportToCSV: {},
date: {
startDate: '10/06/2017',
endDate: '10/16/2017',
},
};

@@ -90,3 +95,41 @@ const csvs = ['a csv', 'another csv'];

});
it('should track csv exports with analytics-middleware', () => {
analyticsActions.trackEvent = jest.fn();
const action = {
type: actionTypes.EXPORT_TO_CSV_START,
};
const state = {
exportToCSV: {
charts: ['a chart', 'another chart'],
},
date: {
startDate: '10/06/2017',
endDate: '10/16/2017',
},
router: {
location: {
pathname: '/twitter/overview/56e0448e36e5e4b85080630e',
},
},
};
generateCSVFromChart.mockReturnValue(Promise.resolve());
middleware({
getState: () => state,
dispatch: jest.fn(),
})(next)(action);
expect(analyticsActions.trackEvent)
.toHaveBeenCalledWith('Page Exported', {
channel: 'twitter',
days: 11,
exportType: 'csv',
name: 'overview',
});
expect(next).toHaveBeenCalledWith(action);
});
});
});

4

package.json
{
"name": "@bufferapp/analyze-csv-export",
"version": "0.90.0",
"version": "0.91.0",
"description": "CSV export button",

@@ -40,3 +40,3 @@ "main": "index.js",

},
"gitHead": "30546516d8a70da4b6fc3ad4e87803379f29c793"
"gitHead": "66a972adf6404e6fa6814a1a0594ce8f0005ef85"
}
SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc