The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/apps/meteor/client/components/AutoCompleteAgentWithoutExt...

38 lines
1.1 KiB

import { PaginatedSelectFiltered } from '@rocket.chat/fuselage';
import { useDebouncedValue } from '@rocket.chat/fuselage-hooks';
import { memo, useState } from 'react';
import { useAvailableAgentsList } from './Omnichannel/hooks/useAvailableAgentsList';
type AutoCompleteAgentProps = {
value: string;
haveAll?: boolean;
currentExtension?: string;
onChange: (value: string) => void;
};
const AutoCompleteAgentWithoutExtension = ({ value, currentExtension, onChange, ...props }: AutoCompleteAgentProps) => {
const [agentsFilter, setAgentsFilter] = useState<string | number | undefined>('');
const debouncedAgentsFilter = useDebouncedValue(agentsFilter as string, 500);
const { data: agentsItems, fetchNextPage } = useAvailableAgentsList({
filter: debouncedAgentsFilter,
includeExtension: currentExtension,
});
return (
<PaginatedSelectFiltered
{...props}
value={value}
onChange={onChange}
flexShrink={0}
filter={agentsFilter as string | undefined}
setFilter={setAgentsFilter}
options={agentsItems}
endReached={() => fetchNextPage()}
/>
);
};
export default memo(AutoCompleteAgentWithoutExtension);