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
Auto-close duplicate issues / auto-close-duplicates (push) Failing after 1s
Code scanning - action / CodeQL-Build (push) Failing after 1s

This commit is contained in:
upstream-mirror
2026-09-16 01:21:02 +05:00
commit 30810eecd7
10161 changed files with 987110 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
import { useQuery } from '@tanstack/react-query';
import { omnichannelQueryKeys } from '../../../../lib/queryKeys';
import { useCustomFieldsQuery } from '../../hooks/useCustomFieldsQuery';
import { formatCustomFieldsMetadata } from '../utils/formatCustomFieldsMetadata';
type UseCustomFieldsMetadataOptions = {
enabled?: boolean;
scope: 'visitor' | 'room';
};
export const useCustomFieldsMetadata = ({ enabled = true, scope }: UseCustomFieldsMetadataOptions) => {
const { data, isSuccess } = useCustomFieldsQuery();
return useQuery({
queryKey: omnichannelQueryKeys.livechat.customFieldsMetadata(scope),
queryFn: async () => formatCustomFieldsMetadata(data?.customFields, scope),
enabled: enabled && isSuccess,
});
};

View File

@@ -0,0 +1,13 @@
import type { OperationResult } from '@rocket.chat/rest-typings';
import { useEndpoint } from '@rocket.chat/ui-contexts';
import type { UseQueryResult } from '@tanstack/react-query';
import { useQuery } from '@tanstack/react-query';
export const useDepartmentInfo = (departmentId: string): UseQueryResult<OperationResult<'GET', '/v1/livechat/department/:_id'>> => {
const deptInfo = useEndpoint('GET', `/v1/livechat/department/:_id`, { _id: departmentId });
return useQuery({
queryKey: ['livechat/department', departmentId],
queryFn: () => deptInfo({}),
});
};

View File

@@ -0,0 +1,45 @@
import type { PaginatedMultiSelectOption } from '@rocket.chat/fuselage';
import type { TranslationKey } from '@rocket.chat/ui-contexts';
import { useTranslation } from 'react-i18next';
import { useFormatDate } from '../../../../hooks/useFormatDate';
import type { ChatsFiltersQuery } from '../contexts/ChatsContext';
const statusTextMap: { [key: string]: TranslationKey } = {
all: 'All',
closed: 'Closed',
opened: 'Room_Status_Open',
onhold: 'On_Hold_Chats',
queued: 'Queued',
};
export const useDisplayFilters = (filtersQuery: ChatsFiltersQuery) => {
const { t } = useTranslation();
const formatDate = useFormatDate();
const { guest, servedBy, status, department, from, to, tags, units, ...customFields } = filtersQuery;
const displayCustomFields = Object.entries(customFields).reduce(
(acc, [key, value]) => {
acc[key] = value ? `${key}: ${value}` : undefined;
return acc;
},
{} as { [key: string]: string | undefined },
);
return {
from: from !== '' ? `${t('From')}: ${formatDate(from)}` : undefined,
to: to !== '' ? `${t('To')}: ${formatDate(to)}` : undefined,
guest: guest !== '' ? `${t('Text')}: ${guest}` : undefined,
servedBy: servedBy.length ? `${t('Served_By')}: ${parseMultiSelect(servedBy)}` : undefined,
department: department.length ? `${t('Department')}: ${parseMultiSelect(department)}` : undefined,
status: status !== 'all' ? `${t('Status')}: ${t(statusTextMap[status])}` : undefined,
tags: tags.length > 0 ? `${t('Tags')}: ${tags.map((tag) => tag.label).join(', ')}` : undefined,
units: units?.length ? `${t('Units')}: ${parseMultiSelect(units)}` : undefined,
...displayCustomFields,
};
};
const parseMultiSelect = (data: PaginatedMultiSelectOption[]) => {
return data.map((a) => (a.label as string).split(' (')[0]).join(', ');
};

View File

@@ -0,0 +1,34 @@
import type { RouteParameters, SearchParameters } from '@rocket.chat/ui-contexts';
import { useRouter } from '@rocket.chat/ui-contexts';
import { useCallback } from 'react';
export const useOmnichannelDirectoryRouter = () => {
const router = useRouter();
const routeName = router.getRouteName();
const validRoutes = routeName === 'omnichannel-directory' || routeName === 'omnichannel-current-chats';
const handleNavigate = useCallback(
(params?: RouteParameters, search?: SearchParameters) => {
if (!routeName || !validRoutes) {
return;
}
return router.navigate({ name: routeName, params, search });
},
[validRoutes, routeName, router],
);
const getDirectoryRouteName = useCallback(() => {
if (!routeName || !validRoutes) {
return undefined;
}
return routeName;
}, [routeName, validRoutes]);
return {
...router,
navigate: handleNavigate,
getRouteName: getDirectoryRouteName,
};
};

View File

@@ -0,0 +1,8 @@
import type { IOmnichannelRoom, IRoom, Serialized } from '@rocket.chat/core-typings';
import { useRoomInfoEndpoint } from '../../../../hooks/useRoomInfoEndpoint';
export const useOmnichannelRoomInfo = (rid: IRoom['_id']) =>
useRoomInfoEndpoint(rid, {
select: (data) => (data.room as Serialized<IOmnichannelRoom>) ?? null,
});

View File

@@ -0,0 +1,15 @@
import { useEndpoint } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';
import { useOmnichannelPriorities } from '../../hooks/useOmnichannelPriorities';
export const usePriorityInfo = (priorityId: string) => {
const { enabled } = useOmnichannelPriorities();
const getPriority = useEndpoint('GET', `/v1/livechat/priorities/:priorityId`, { priorityId });
return useQuery({
queryKey: ['/v1/livechat/priorities', priorityId],
queryFn: () => getPriority(),
gcTime: 0,
enabled,
});
};

View File

@@ -0,0 +1,14 @@
import { useEndpoint } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';
import { useHasLicenseModule } from '../../../../hooks/useHasLicenseModule';
export const useSlaInfo = (slaId: string) => {
const { data: isEnterprise = false } = useHasLicenseModule('livechat-enterprise');
const getSLA = useEndpoint('GET', '/v1/livechat/sla/:slaId', { slaId });
return useQuery({
queryKey: ['/v1/livechat/sla/:slaId', slaId],
queryFn: () => getSLA(),
enabled: isEnterprise && !!slaId,
});
};

View File

@@ -0,0 +1,21 @@
import { useEndpoint } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';
import { millisecondsToMinutes } from 'date-fns';
import { useHasLicenseModule } from '../../../../hooks/useHasLicenseModule';
export const useSlaPolicies = () => {
const { data: isEnterprise = false } = useHasLicenseModule('livechat-enterprise');
const getSlaPolicies = useEndpoint('GET', '/v1/livechat/sla');
const { data: { sla } = {}, ...props } = useQuery({
queryKey: ['/v1/livechat/sla'],
queryFn: () => getSlaPolicies({}),
staleTime: millisecondsToMinutes(10),
enabled: isEnterprise,
});
return {
data: sla,
...props,
};
};

View File

@@ -0,0 +1,13 @@
import { useEndpoint } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';
export const useVisitorInfo = (visitorId: string, { enabled = true, gcTime = 0 } = {}) => {
const getVisitorInfo = useEndpoint('GET', '/v1/livechat/visitors.info');
const { data: { visitor } = {}, ...props } = useQuery({
queryKey: ['/v1/livechat/visitors.info', visitorId],
queryFn: () => getVisitorInfo({ visitorId }),
enabled,
gcTime,
});
return { data: visitor, ...props };
};