Skip to content
Snippets Groups Projects
Commit ea6c1ede authored by Abhinav Kumar's avatar Abhinav Kumar Committed by Guilherme Gazzo
Browse files

chore!: removed deprecated method livechat:getAnalyticsOverviewData (#33442)

parent ddffa772
No related branches found
No related tags found
No related merge requests found
---
'@rocket.chat/meteor': major
---
Removes deprecated `livechat:getAnalyticsOverviewData` method. Moving forward use the `livechat/analytics/overview` endpoint.
...@@ -21,7 +21,6 @@ import './methods/changeLivechatStatus'; ...@@ -21,7 +21,6 @@ import './methods/changeLivechatStatus';
import './methods/closeRoom'; import './methods/closeRoom';
import './methods/discardTranscript'; import './methods/discardTranscript';
import './methods/getAnalyticsChartData'; import './methods/getAnalyticsChartData';
import './methods/getAnalyticsOverviewData';
import './methods/getNextAgent'; import './methods/getNextAgent';
import './methods/getRoutingConfig'; import './methods/getRoutingConfig';
import './methods/registerGuest'; import './methods/registerGuest';
......
import type { AnalyticsOverviewDataResult } from '@rocket.chat/core-services';
import { OmnichannelAnalytics } from '@rocket.chat/core-services';
import type { ServerMethods } from '@rocket.chat/ddp-client';
import { Users } from '@rocket.chat/models';
import { Meteor } from 'meteor/meteor';
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';
import { settings } from '../../../settings/server';
declare module '@rocket.chat/ddp-client' {
// eslint-disable-next-line @typescript-eslint/naming-convention
interface ServerMethods {
'livechat:getAnalyticsOverviewData'(options: { analyticsOptions: { name: string } }): AnalyticsOverviewDataResult[] | void;
}
}
Meteor.methods<ServerMethods>({
async 'livechat:getAnalyticsOverviewData'(options) {
methodDeprecationLogger.method('livechat:getAnalyticsOverviewData', '7.0.0', ' Use "livechat/analytics/overview" instead.');
const uid = Meteor.userId();
if (!uid || !(await hasPermissionAsync(uid, 'view-livechat-manager'))) {
throw new Meteor.Error('error-not-allowed', 'Not allowed', {
method: 'livechat:getAnalyticsOverviewData',
});
}
if (!options.analyticsOptions?.name) {
return;
}
const user = await Users.findOneById(uid, { projection: { _id: 1, utcOffset: 1, language: 1 } });
const language = user?.language || settings.get('Language') || 'en';
return OmnichannelAnalytics.getAnalyticsOverviewData({
...options,
utcOffset: user?.utcOffset || 0,
language,
});
},
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment