Skip to content

Commit b74ab6f

Browse files
chore: Adds deprecation warning on livechat:sendTranscript (RocketChat#36986)
1 parent c15a47e commit b74ab6f

5 files changed

Lines changed: 16 additions & 6 deletions

File tree

.changeset/unlucky-peas-wink.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@rocket.chat/meteor": patch
3+
"@rocket.chat/rest-typings": patch
4+
---
5+
6+
Adds deprecation warning on `livechat:sendTranscript` with endpoint replacing it; `livechat/trasncript`

apps/meteor/app/livechat/server/methods/sendTranscript.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Meteor } from 'meteor/meteor';
66

77
import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission';
88
import { RateLimiter } from '../../../lib/server';
9+
import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger';
910
import { sendTranscript } from '../lib/sendTranscript';
1011

1112
declare module '@rocket.chat/ddp-client' {
@@ -17,6 +18,7 @@ declare module '@rocket.chat/ddp-client' {
1718

1819
Meteor.methods<ServerMethods>({
1920
async 'livechat:sendTranscript'(token, rid, email, subject) {
21+
methodDeprecationLogger.method('livechat:sendTranscript', '8.0.0', '/v1/livechat/transcript');
2022
check(rid, String);
2123
check(email, String);
2224

apps/meteor/client/views/room/Header/Omnichannel/QuickActions/hooks/useQuickActions.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
usePermission,
88
useRole,
99
useEndpoint,
10-
useMethod,
1110
useTranslation,
1211
useRouter,
1312
useUserSubscription,
@@ -107,12 +106,12 @@ export const useQuickActions = (): {
107106
}
108107
}, [dispatchToastMessage, sendTranscriptPDF, t]);
109108

110-
const sendTranscript = useMethod('livechat:sendTranscript');
109+
const sendTranscript = useEndpoint('POST', '/v1/livechat/transcript');
111110

112111
const handleSendTranscript = useCallback(
113112
async (email: string, subject: string, token: string) => {
114113
try {
115-
await sendTranscript(token, rid, email, subject);
114+
await sendTranscript({ token, rid, email, subject });
116115
closeModal();
117116
} catch (error) {
118117
dispatchToastMessage({ type: 'error', message: error });

apps/meteor/client/views/room/HeaderV2/Omnichannel/QuickActions/hooks/useQuickActions.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
usePermission,
88
useRole,
99
useEndpoint,
10-
useMethod,
1110
useTranslation,
1211
useRouter,
1312
} from '@rocket.chat/ui-contexts';
@@ -105,12 +104,12 @@ export const useQuickActions = (): {
105104
}
106105
}, [dispatchToastMessage, sendTranscriptPDF, t]);
107106

108-
const sendTranscript = useMethod('livechat:sendTranscript');
107+
const sendTranscript = useEndpoint('POST', '/v1/livechat/transcript');
109108

110109
const handleSendTranscript = useCallback(
111110
async (email: string, subject: string, token: string) => {
112111
try {
113-
await sendTranscript(token, rid, email, subject);
112+
await sendTranscript({ token, rid, email, subject });
114113
closeModal();
115114
} catch (error) {
116115
dispatchToastMessage({ type: 'error', message: error });

packages/rest-typings/src/v1/omnichannel.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2324,6 +2324,7 @@ type POSTLivechatTranscriptParams = {
23242324
rid: string;
23252325
token: string;
23262326
email: string;
2327+
subject?: string;
23272328
};
23282329

23292330
const POSTLivechatTranscriptParamsSchema = {
@@ -2338,6 +2339,9 @@ const POSTLivechatTranscriptParamsSchema = {
23382339
email: {
23392340
type: 'string',
23402341
},
2342+
subject: {
2343+
type: 'string',
2344+
},
23412345
},
23422346
required: ['rid', 'token', 'email'],
23432347
additionalProperties: false,

0 commit comments

Comments
 (0)