diff --git a/.changeset/forty-pants-roll.md b/.changeset/forty-pants-roll.md new file mode 100644 index 0000000000000..b8eb5424fab65 --- /dev/null +++ b/.changeset/forty-pants-roll.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': major +--- + +Removes deprecated `livechat:getAnalyticsOverviewData` method. Moving forward use the `livechat/analytics/overview` endpoint. diff --git a/apps/meteor/app/livechat/server/index.ts b/apps/meteor/app/livechat/server/index.ts index 90064827e2c64..b21bc048c254f 100644 --- a/apps/meteor/app/livechat/server/index.ts +++ b/apps/meteor/app/livechat/server/index.ts @@ -21,7 +21,6 @@ import './methods/changeLivechatStatus'; import './methods/closeRoom'; import './methods/discardTranscript'; import './methods/getAnalyticsChartData'; -import './methods/getAnalyticsOverviewData'; import './methods/getNextAgent'; import './methods/getRoutingConfig'; import './methods/registerGuest'; diff --git a/apps/meteor/app/livechat/server/methods/getAnalyticsOverviewData.ts b/apps/meteor/app/livechat/server/methods/getAnalyticsOverviewData.ts deleted file mode 100644 index 9f56cfa570693..0000000000000 --- a/apps/meteor/app/livechat/server/methods/getAnalyticsOverviewData.ts +++ /dev/null @@ -1,41 +0,0 @@ -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({ - 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, - }); - }, -});