diff --git a/.changeset/unlucky-peas-wink.md b/.changeset/unlucky-peas-wink.md new file mode 100644 index 0000000000000..9466edf97bd33 --- /dev/null +++ b/.changeset/unlucky-peas-wink.md @@ -0,0 +1,6 @@ +--- +"@rocket.chat/meteor": patch +"@rocket.chat/rest-typings": patch +--- + +Adds deprecation warning on `livechat:sendTranscript` with endpoint replacing it; `livechat/trasncript` diff --git a/apps/meteor/app/livechat/server/methods/sendTranscript.ts b/apps/meteor/app/livechat/server/methods/sendTranscript.ts index 00287fa893275..a891ed156c5fd 100644 --- a/apps/meteor/app/livechat/server/methods/sendTranscript.ts +++ b/apps/meteor/app/livechat/server/methods/sendTranscript.ts @@ -6,6 +6,7 @@ import { Meteor } from 'meteor/meteor'; import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; import { RateLimiter } from '../../../lib/server'; +import { methodDeprecationLogger } from '../../../lib/server/lib/deprecationWarningLogger'; import { sendTranscript } from '../lib/sendTranscript'; declare module '@rocket.chat/ddp-client' { @@ -17,6 +18,7 @@ declare module '@rocket.chat/ddp-client' { Meteor.methods({ async 'livechat:sendTranscript'(token, rid, email, subject) { + methodDeprecationLogger.method('livechat:sendTranscript', '8.0.0', '/v1/livechat/transcript'); check(rid, String); check(email, String); diff --git a/apps/meteor/client/views/room/Header/Omnichannel/QuickActions/hooks/useQuickActions.tsx b/apps/meteor/client/views/room/Header/Omnichannel/QuickActions/hooks/useQuickActions.tsx index ded93aa4741be..cfddce1f57a37 100644 --- a/apps/meteor/client/views/room/Header/Omnichannel/QuickActions/hooks/useQuickActions.tsx +++ b/apps/meteor/client/views/room/Header/Omnichannel/QuickActions/hooks/useQuickActions.tsx @@ -7,7 +7,6 @@ import { usePermission, useRole, useEndpoint, - useMethod, useTranslation, useRouter, useUserSubscription, @@ -107,12 +106,12 @@ export const useQuickActions = (): { } }, [dispatchToastMessage, sendTranscriptPDF, t]); - const sendTranscript = useMethod('livechat:sendTranscript'); + const sendTranscript = useEndpoint('POST', '/v1/livechat/transcript'); const handleSendTranscript = useCallback( async (email: string, subject: string, token: string) => { try { - await sendTranscript(token, rid, email, subject); + await sendTranscript({ token, rid, email, subject }); closeModal(); } catch (error) { dispatchToastMessage({ type: 'error', message: error }); diff --git a/apps/meteor/client/views/room/HeaderV2/Omnichannel/QuickActions/hooks/useQuickActions.tsx b/apps/meteor/client/views/room/HeaderV2/Omnichannel/QuickActions/hooks/useQuickActions.tsx index b454582f062dc..1dc385a480376 100644 --- a/apps/meteor/client/views/room/HeaderV2/Omnichannel/QuickActions/hooks/useQuickActions.tsx +++ b/apps/meteor/client/views/room/HeaderV2/Omnichannel/QuickActions/hooks/useQuickActions.tsx @@ -7,7 +7,6 @@ import { usePermission, useRole, useEndpoint, - useMethod, useTranslation, useRouter, } from '@rocket.chat/ui-contexts'; @@ -105,12 +104,12 @@ export const useQuickActions = (): { } }, [dispatchToastMessage, sendTranscriptPDF, t]); - const sendTranscript = useMethod('livechat:sendTranscript'); + const sendTranscript = useEndpoint('POST', '/v1/livechat/transcript'); const handleSendTranscript = useCallback( async (email: string, subject: string, token: string) => { try { - await sendTranscript(token, rid, email, subject); + await sendTranscript({ token, rid, email, subject }); closeModal(); } catch (error) { dispatchToastMessage({ type: 'error', message: error }); diff --git a/packages/rest-typings/src/v1/omnichannel.ts b/packages/rest-typings/src/v1/omnichannel.ts index e5db53a53a785..702f6f69cbe6f 100644 --- a/packages/rest-typings/src/v1/omnichannel.ts +++ b/packages/rest-typings/src/v1/omnichannel.ts @@ -2282,6 +2282,7 @@ type POSTLivechatTranscriptParams = { rid: string; token: string; email: string; + subject?: string; }; const POSTLivechatTranscriptParamsSchema = { @@ -2296,6 +2297,9 @@ const POSTLivechatTranscriptParamsSchema = { email: { type: 'string', }, + subject: { + type: 'string', + }, }, required: ['rid', 'token', 'email'], additionalProperties: false,