snapshot of https://github.com/RocketChat/Rocket.Chat.git (develop, 2026-09-16; blobs > 131072B omitted)
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Code scanning - action / CodeQL-Build (push) Failing after 2s
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Some checks failed
Create issues from TODOs / todos (push) Failing after 3s
Close inactive issues / close-issues (push) Has been cancelled
Deploy GitHub Pages / deploy-preview (push) Has been cancelled
CI / ⚙️ Variables Setup (push) Has been cancelled
CI / ⚙️ Test Guard (push) Has been cancelled
CI / 🚀 Notify external services - draft (push) Has been cancelled
CI / 📦 Build Packages (push) Has been cancelled
CI / 📦 Meteor Build (coverage) (push) Has been cancelled
CI / 📦 Meteor Build (production) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [account-service presence-service omnichannel-transcript-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [authorization-service queue-worker-service ddp-streamer-service], fips) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Build Docker (amd64, [rocketchat], fips) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [account-service presence-service omnichannel-transcript-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [authorization-service queue-worker-service ddp-streamer-service], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], ${{ (github.event_name != 'release' && github.ref != 'refs/heads/develop') && 'coverage' || 'production' }}) (push) Has been cancelled
CI / 🚢 Build Docker (arm64, [rocketchat], coverage) (push) Has been cancelled
CI / 🚢 Publish Docker Images (ghcr.io) (push) Has been cancelled
CI / 📦 Track Image Sizes (push) Has been cancelled
CI / 🔎 Code Check - Action Lint (push) Has been cancelled
CI / 🔎 Code Check (push) Has been cancelled
CI / 🔨 Test Storybook (push) Has been cancelled
CI / 🔨 Test Unit (push) Has been cancelled
CI / 🔨 Test API (CE) (push) Has been cancelled
CI / 🔨 Test API Livechat (CE) (push) Has been cancelled
CI / 🔨 Test UI (CE) (push) Has been cancelled
CI / 🔨 Test API (EE) (push) Has been cancelled
CI / 🔨 Test API Livechat (EE) (push) Has been cancelled
CI / 🔨 Test API Apps (deno-runtime - EE) (push) Has been cancelled
CI / 🔨 Test UI (EE) (push) Has been cancelled
CI / 🔨 Test API (FIPS) (push) Has been cancelled
CI / 🔨 Test API Livechat (FIPS) (push) Has been cancelled
CI / 🔨 Test UI (FIPS) (push) Has been cancelled
CI / 🔨 Test Federation Matrix (push) Has been cancelled
CI / 📊 Report Coverage (push) Has been cancelled
CI / ✅ Tests Done (push) Has been cancelled
CI / 🚀 Publish build assets (push) Has been cancelled
CI / 🚀 Publish Docker Images (DockerHub) (push) Has been cancelled
CI / 🚀 Notify external services (push) Has been cancelled
CI / Update Version Durability (push) Has been cancelled
Release / Release (push) Has been cancelled
Code scanning - action / CodeQL-Build (push) Failing after 2s
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
This commit is contained in:
55
packages/message-types/src/MessageTypes.spec.ts
Normal file
55
packages/message-types/src/MessageTypes.spec.ts
Normal file
@@ -0,0 +1,55 @@
|
||||
import type { IMessage, MessageTypesValues } from '@rocket.chat/core-typings';
|
||||
|
||||
import { MessageTypes } from './MessageTypes';
|
||||
|
||||
let messageTypes: MessageTypes;
|
||||
const baseMessage: IMessage = {
|
||||
rid: 'roomId',
|
||||
msg: 'message',
|
||||
ts: new Date(),
|
||||
u: { _id: 'userId', username: 'user' },
|
||||
} as IMessage;
|
||||
|
||||
beforeEach(() => {
|
||||
messageTypes = new MessageTypes();
|
||||
});
|
||||
|
||||
it('should register and retrieve a message type', () => {
|
||||
const type = {
|
||||
id: 'e2e' as MessageTypesValues,
|
||||
system: true,
|
||||
text: () => 'Test message',
|
||||
};
|
||||
messageTypes.registerType(type);
|
||||
const result = messageTypes.getType({ ...baseMessage, t: 'e2e' });
|
||||
expect(result).toEqual(type);
|
||||
});
|
||||
|
||||
it('should return undefined for unknown type', () => {
|
||||
const result = messageTypes.getType({ ...baseMessage, t: undefined });
|
||||
expect(result).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should identify system messages', () => {
|
||||
const type = {
|
||||
id: 'e2e' as MessageTypesValues,
|
||||
system: true,
|
||||
text: () => 'System message',
|
||||
};
|
||||
messageTypes.registerType(type);
|
||||
expect(messageTypes.isSystemMessage({ ...baseMessage, t: 'e2e' })).toBe(true);
|
||||
});
|
||||
|
||||
it('should identify non-system messages', () => {
|
||||
const type = {
|
||||
id: 'uj' as MessageTypesValues,
|
||||
system: false,
|
||||
text: () => 'User message',
|
||||
};
|
||||
messageTypes.registerType(type);
|
||||
expect(messageTypes.isSystemMessage({ ...baseMessage, t: 'uj' })).toBe(false);
|
||||
});
|
||||
|
||||
it('should return false for isSystemMessage if type is not registered', () => {
|
||||
expect(messageTypes.isSystemMessage({ ...baseMessage, t: undefined })).toBe(false);
|
||||
});
|
||||
28
packages/message-types/src/MessageTypes.ts
Normal file
28
packages/message-types/src/MessageTypes.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import type { MessageTypesValues, IMessage } from '@rocket.chat/core-typings';
|
||||
import type { TFunction } from 'i18next';
|
||||
|
||||
type MessageTypeTextOptions = {
|
||||
capitalize?: boolean;
|
||||
};
|
||||
|
||||
type MessageType = {
|
||||
readonly id: MessageTypesValues;
|
||||
readonly system: boolean;
|
||||
readonly text: (t: TFunction, message: IMessage, options?: MessageTypeTextOptions) => string;
|
||||
};
|
||||
|
||||
export class MessageTypes {
|
||||
private types = new Map<MessageTypesValues, MessageType>();
|
||||
|
||||
registerType(options: MessageType): void {
|
||||
this.types.set(options.id, options);
|
||||
}
|
||||
|
||||
getType(message: Pick<IMessage, 't'>): MessageType | undefined {
|
||||
return message.t ? this.types.get(message.t) : undefined;
|
||||
}
|
||||
|
||||
isSystemMessage(message: Pick<IMessage, 't'>): boolean {
|
||||
return this.getType(message)?.system ?? false;
|
||||
}
|
||||
}
|
||||
16
packages/message-types/src/index.ts
Normal file
16
packages/message-types/src/index.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import { MessageTypes } from './MessageTypes';
|
||||
import registerCommonTypes from './registrations/common';
|
||||
import registerE2EEETypes from './registrations/e2ee';
|
||||
import registerLivechatTypes from './registrations/livechat';
|
||||
import registerOmnichannelTypes from './registrations/omnichannel';
|
||||
import registerVideoconfTypes from './registrations/videoconf';
|
||||
|
||||
const instance = new MessageTypes();
|
||||
|
||||
registerCommonTypes(instance);
|
||||
registerLivechatTypes(instance);
|
||||
registerOmnichannelTypes(instance);
|
||||
registerE2EEETypes(instance);
|
||||
registerVideoconfTypes(instance);
|
||||
|
||||
export { instance as MessageTypes };
|
||||
233
packages/message-types/src/registrations/common.ts
Normal file
233
packages/message-types/src/registrations/common.ts
Normal file
@@ -0,0 +1,233 @@
|
||||
import type { MessageTypes } from '../MessageTypes';
|
||||
|
||||
export default (instance: MessageTypes) => {
|
||||
instance.registerType({
|
||||
id: 'uj',
|
||||
system: true,
|
||||
text: (t, message) => t('User_joined_the_channel', { user: message.u.username }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'ul',
|
||||
system: true,
|
||||
text: (t) => t('User_left_this_channel'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'r',
|
||||
system: true,
|
||||
text: (t, message) => t('Room_name_changed_to', { room_name: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'au',
|
||||
system: true,
|
||||
text: (t, message) => t('User_added_to', { user_added: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'ui',
|
||||
system: true,
|
||||
text: (t, message) => t('User_invited_to_room', { user_invited: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'uir',
|
||||
system: true,
|
||||
text: (t) => t('User_rejected_invitation_to_room'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'added-user-to-team',
|
||||
system: true,
|
||||
text: (t, message) => t('Added__username__to_this_team', { user_added: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'ru',
|
||||
system: true,
|
||||
text: (t, message) => t('User_has_been_removed', { user_removed: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'removed-user-from-team',
|
||||
system: true,
|
||||
text: (t, message) => t('Removed__username__from_the_team', { user_removed: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'ult',
|
||||
system: true,
|
||||
text: (t) => t('User_left_this_team'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'user-converted-to-team',
|
||||
system: true,
|
||||
text: (t, message) => t('Converted__roomName__to_a_team', { roomName: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'user-converted-to-channel',
|
||||
system: true,
|
||||
text: (t, message) => t('Converted__roomName__to_a_channel', { roomName: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'user-removed-room-from-team',
|
||||
system: true,
|
||||
text: (t, message) => t('Removed__roomName__from_the_team', { roomName: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'user-deleted-room-from-team',
|
||||
system: true,
|
||||
text: (t, message) => t('Deleted__roomName__room', { roomName: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'user-added-room-to-team',
|
||||
system: true,
|
||||
text: (t, message) => t('added__roomName__to_this_team', { roomName: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'ujt',
|
||||
system: true,
|
||||
text: (t, message) => t('User_joined_the_team', { user: message.u.username }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'ut',
|
||||
system: true,
|
||||
text: (t, message) => t('User_joined_the_conversation', { user: message.u.username }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'wm',
|
||||
system: true,
|
||||
text: (t, message) => t('Welcome', { user: message.u.username }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'rm',
|
||||
system: true,
|
||||
text: (t, _, options) => (options?.capitalize ? t('Message_removed') : t('message_removed')),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'user-muted',
|
||||
system: true,
|
||||
text: (t, message) => t('User_has_been_muted', { user_muted: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'user-unmuted',
|
||||
system: true,
|
||||
text: (t, message) => t('User_has_been_unmuted', { user_unmuted: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'user-banned',
|
||||
system: true,
|
||||
text: (t, message) => t('User_has_been_banned', { user_banned: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'user-unbanned',
|
||||
system: true,
|
||||
text: (t, message) => t('User_has_been_unbanned', { user_unbanned: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'subscription-role-added',
|
||||
system: true,
|
||||
text: (t, message) => t('set__username__as__role_', { username: message.msg, role: message.role ?? '' }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'subscription-role-removed',
|
||||
system: true,
|
||||
text: (t, message) => t('removed__username__as__role_', { username: message.msg, role: message.role ?? '' }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room-archived',
|
||||
system: true,
|
||||
text: (t) => t('This_room_has_been_archived'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room-unarchived',
|
||||
system: true,
|
||||
text: (t) => t('This_room_has_been_unarchived'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room-removed-read-only',
|
||||
system: true,
|
||||
text: (t) => t('room_removed_read_only_permission'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room-set-read-only',
|
||||
system: true,
|
||||
text: (t) => t('room_set_read_only_permission'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room-allowed-reacting',
|
||||
system: true,
|
||||
text: (t) => t('room_allowed_reactions'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room-disallowed-reacting',
|
||||
system: true,
|
||||
text: (t) => t('room_disallowed_reactions'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room_changed_privacy',
|
||||
system: true,
|
||||
text: (t, message) => t('room_changed_type', { room_type: t(message.msg) }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room_changed_topic',
|
||||
system: true,
|
||||
text: (t, message) => t('room_changed_topic_to', { room_topic: message.msg || `(${t('None').toLowerCase()})` }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room_changed_avatar',
|
||||
system: true,
|
||||
text: (t) => t('room_avatar_changed'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room_changed_announcement',
|
||||
system: true,
|
||||
text: (t, message) =>
|
||||
t('changed_room_announcement_to__room_announcement_', { room_announcement: message.msg || `(${t('None').toLowerCase()})` }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room_changed_description',
|
||||
system: true,
|
||||
text: (t, message) =>
|
||||
t('changed_room_description_to__room_description_', { room_description: message.msg || `(${t('None').toLowerCase()})` }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'message_pinned',
|
||||
system: true,
|
||||
text: (t) => t('Pinned_a_message'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'abac-removed-user-from-room',
|
||||
system: true,
|
||||
text: (t) => t('abac_removed_user_from_the_room'),
|
||||
});
|
||||
};
|
||||
21
packages/message-types/src/registrations/e2ee.ts
Normal file
21
packages/message-types/src/registrations/e2ee.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import type { MessageTypes } from '../MessageTypes';
|
||||
|
||||
export default (instance: MessageTypes) => {
|
||||
instance.registerType({
|
||||
id: 'room_e2e_enabled',
|
||||
system: true,
|
||||
text: (t) => t('Enabled_E2E_Encryption_for_this_room'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'room_e2e_disabled',
|
||||
system: true,
|
||||
text: (t) => t('Disabled_E2E_Encryption_for_this_room'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'message_pinned_e2e',
|
||||
system: true,
|
||||
text: (t) => t('Pinned_a_message'),
|
||||
});
|
||||
};
|
||||
119
packages/message-types/src/registrations/livechat.ts
Normal file
119
packages/message-types/src/registrations/livechat.ts
Normal file
@@ -0,0 +1,119 @@
|
||||
import type { IOmnichannelSystemMessage } from '@rocket.chat/core-typings';
|
||||
|
||||
import type { MessageTypes } from '../MessageTypes';
|
||||
|
||||
export default (instance: MessageTypes) => {
|
||||
instance.registerType({
|
||||
id: 'livechat-started',
|
||||
system: true,
|
||||
text: (t) => t('Chat_started'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'livechat-close',
|
||||
system: true,
|
||||
text: (t, message) => t('Conversation_closed', { comment: message.msg }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'livechat_video_call',
|
||||
system: true,
|
||||
text: (t) => t('New_videocall_request'),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'livechat_navigation_history',
|
||||
system: true,
|
||||
text: (t, message: IOmnichannelSystemMessage) =>
|
||||
t('New_visitor_navigation', {
|
||||
history: message.navigation
|
||||
? `${(message.navigation.page.title ? `${message.navigation.page.title} - ` : '') + message.navigation.page.location.href}`
|
||||
: '',
|
||||
}),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'livechat_transfer_history',
|
||||
system: true,
|
||||
text: (t, message: IOmnichannelSystemMessage) => {
|
||||
if (!message.transferData) {
|
||||
return t('New_chat_transfer', { transfer: '' });
|
||||
}
|
||||
|
||||
const { comment } = message.transferData;
|
||||
const commentLabel = comment && comment !== '' ? '_with_a_comment' : '';
|
||||
const from =
|
||||
message.transferData.transferredBy && (message.transferData.transferredBy.name || message.transferData.transferredBy.username);
|
||||
const transferTypes = {
|
||||
agent: (): string =>
|
||||
t(`Livechat_transfer_to_agent${commentLabel}`, {
|
||||
from,
|
||||
to: message?.transferData?.transferredTo?.name || message?.transferData?.transferredTo?.username || '',
|
||||
...(comment && { comment }),
|
||||
}),
|
||||
department: (): string =>
|
||||
t(`Livechat_transfer_to_department${commentLabel}`, {
|
||||
from,
|
||||
to: message?.transferData?.nextDepartment?.name || '',
|
||||
...(comment && { comment }),
|
||||
}),
|
||||
queue: (): string =>
|
||||
t(`Livechat_transfer_return_to_the_queue${commentLabel}`, {
|
||||
from,
|
||||
...(comment && { comment }),
|
||||
}),
|
||||
autoTransferUnansweredChatsToAgent: (): string =>
|
||||
t('Livechat_transfer_to_agent_auto_transfer_unanswered_chat', {
|
||||
from,
|
||||
to: message?.transferData?.transferredTo?.name || message?.transferData?.transferredTo?.username || '',
|
||||
duration: comment,
|
||||
}),
|
||||
autoTransferUnansweredChatsToQueue: (): string =>
|
||||
t('Livechat_transfer_return_to_the_queue_auto_transfer_unanswered_chat', {
|
||||
from,
|
||||
duration: comment,
|
||||
}),
|
||||
};
|
||||
return t('New_chat_transfer', { transfer: transferTypes[message.transferData.scope]() });
|
||||
},
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'livechat_transfer_history_fallback',
|
||||
system: true,
|
||||
text: (t, message: any) => {
|
||||
if (!message.transferData) {
|
||||
return t('New_chat_transfer_fallback', { fallback: 'SHOULD_NEVER_HAPPEN' });
|
||||
}
|
||||
const from = message.transferData.prevDepartment;
|
||||
const to = message.transferData.department.name;
|
||||
|
||||
return t('New_chat_transfer_fallback', { fallback: t('Livechat_transfer_failed_fallback', { from, to }) });
|
||||
},
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'livechat_transcript_history',
|
||||
system: true,
|
||||
text: (t, message: IOmnichannelSystemMessage) => {
|
||||
if (!message.requestData) {
|
||||
return t('Livechat_chat_transcript_sent', { transcript: '' });
|
||||
}
|
||||
|
||||
const { requestData: { type, visitor, user } = { type: 'user' } } = message;
|
||||
const requestTypes = {
|
||||
visitor: (): string =>
|
||||
t('Livechat_visitor_transcript_request', {
|
||||
guest: visitor?.name || visitor?.username || '',
|
||||
}),
|
||||
user: (): string =>
|
||||
t('Livechat_user_sent_chat_transcript_to_visitor', {
|
||||
agent: user?.name || user?.username || '',
|
||||
guest: visitor?.name || visitor?.username || '',
|
||||
}),
|
||||
};
|
||||
|
||||
return t('Livechat_chat_transcript_sent', { transcript: requestTypes[type]() });
|
||||
},
|
||||
});
|
||||
};
|
||||
63
packages/message-types/src/registrations/omnichannel.ts
Normal file
63
packages/message-types/src/registrations/omnichannel.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import type { IOmnichannelSystemMessage } from '@rocket.chat/core-typings';
|
||||
|
||||
import type { MessageTypes } from '../MessageTypes';
|
||||
|
||||
export default (instance: MessageTypes) => {
|
||||
instance.registerType({
|
||||
id: 'omnichannel_placed_chat_on_hold',
|
||||
system: true,
|
||||
text: (t, message: IOmnichannelSystemMessage) =>
|
||||
t('Omnichannel_placed_chat_on_hold', { comment: message.comment ? message.comment : t('No_comment_provided') }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'omnichannel_on_hold_chat_resumed',
|
||||
system: true,
|
||||
text: (t, message: IOmnichannelSystemMessage) =>
|
||||
t('Omnichannel_on_hold_chat_resumed', { comment: message.comment ? message.comment : t('No_comment_provided') }),
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'omnichannel_priority_change_history',
|
||||
system: true,
|
||||
text: (t, message) => {
|
||||
if (!message.priorityData) {
|
||||
return t('omnichannel_priority_change_history', {
|
||||
user: t('Unknown_User'),
|
||||
priority: t('Without_priority'),
|
||||
});
|
||||
}
|
||||
const {
|
||||
definedBy: { username },
|
||||
priority: { name = null, i18n } = {},
|
||||
} = message.priorityData;
|
||||
|
||||
return t('omnichannel_priority_change_history', {
|
||||
user: username || t('Unknown_User'),
|
||||
priority: name || (i18n && t(i18n)) || t('Unprioritized'),
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
instance.registerType({
|
||||
id: 'omnichannel_sla_change_history',
|
||||
system: true,
|
||||
text: (t, message) => {
|
||||
if (!message.slaData) {
|
||||
return t('omnichannel_sla_change_history', {
|
||||
user: t('Unknown_User'),
|
||||
priority: t('Without_SLA'),
|
||||
});
|
||||
}
|
||||
const {
|
||||
definedBy: { username },
|
||||
sla: { name = null } = {},
|
||||
} = message.slaData;
|
||||
|
||||
return t('omnichannel_sla_change_history', {
|
||||
user: username || t('Unknown_User'),
|
||||
sla: name || t('Without_SLA'),
|
||||
});
|
||||
},
|
||||
});
|
||||
};
|
||||
9
packages/message-types/src/registrations/videoconf.ts
Normal file
9
packages/message-types/src/registrations/videoconf.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
import type { MessageTypes } from '../MessageTypes';
|
||||
|
||||
export default (instance: MessageTypes) => {
|
||||
instance.registerType({
|
||||
id: 'videoconf',
|
||||
system: false,
|
||||
text: (t) => t('Video_Conference'),
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user