Restructure omni services and add Chatwoot research snapshot
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import fromUnixTime from 'date-fns/fromUnixTime';
|
||||
import format from 'date-fns/format';
|
||||
|
||||
export const downloadCsvFile = (fileName, content) => {
|
||||
const contentType = 'data:text/csv;charset=utf-8;';
|
||||
const blob = new Blob([content], { type: contentType });
|
||||
const url = URL.createObjectURL(blob);
|
||||
|
||||
const link = document.createElement('a');
|
||||
link.setAttribute('download', fileName);
|
||||
link.setAttribute('href', url);
|
||||
link.click();
|
||||
return link;
|
||||
};
|
||||
|
||||
export const generateFileName = ({ type, to, businessHours = false }) => {
|
||||
let name = `${type}-report-${format(fromUnixTime(to), 'dd-MM-yyyy')}`;
|
||||
if (businessHours) {
|
||||
name = `${name}-business-hours`;
|
||||
}
|
||||
return `${name}.csv`;
|
||||
};
|
||||
Reference in New Issue
Block a user