diff --git a/apps/meteor/client/components/Omnichannel/hooks/useAgentsList.ts b/apps/meteor/client/components/Omnichannel/hooks/useAgentsList.ts index 630ba5f0116d..41dd4a485d92 100644 --- a/apps/meteor/client/components/Omnichannel/hooks/useAgentsList.ts +++ b/apps/meteor/client/components/Omnichannel/hooks/useAgentsList.ts @@ -37,7 +37,7 @@ export const useAgentsList = ( }, [options, reload]); const fetchData = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { users: agents, total } = await getAgents({ ...(text && { text }), ...(excludeId && { excludeId }), diff --git a/apps/meteor/client/components/Omnichannel/hooks/useAvailableAgentsList.ts b/apps/meteor/client/components/Omnichannel/hooks/useAvailableAgentsList.ts index f0ee99e153cc..e56032e66292 100644 --- a/apps/meteor/client/components/Omnichannel/hooks/useAvailableAgentsList.ts +++ b/apps/meteor/client/components/Omnichannel/hooks/useAvailableAgentsList.ts @@ -29,7 +29,7 @@ export const useAvailableAgentsList = ( }, [options, reload]); const fetchData = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { agents, total } = await getAgents({ ...(options.text && { text: options.text }), ...(options.includeExtension && { includeExtension: options.includeExtension }), diff --git a/apps/meteor/client/components/Omnichannel/hooks/useDepartmentsList.ts b/apps/meteor/client/components/Omnichannel/hooks/useDepartmentsList.ts index ac658e799ed6..58fa65e42809 100644 --- a/apps/meteor/client/components/Omnichannel/hooks/useDepartmentsList.ts +++ b/apps/meteor/client/components/Omnichannel/hooks/useDepartmentsList.ts @@ -40,7 +40,7 @@ export const useDepartmentsList = ( }, [options, reload]); const fetchData = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { departments, total } = await getDepartments({ onlyMyDepartments: `${!!options.onlyMyDepartments}`, text: options.filter, diff --git a/apps/meteor/client/components/Omnichannel/modals/ForwardChatModal.tsx b/apps/meteor/client/components/Omnichannel/modals/ForwardChatModal.tsx index bf85728cd0ee..b28339843817 100644 --- a/apps/meteor/client/components/Omnichannel/modals/ForwardChatModal.tsx +++ b/apps/meteor/client/components/Omnichannel/modals/ForwardChatModal.tsx @@ -24,16 +24,19 @@ import { AsyncStatePhase } from '../../../hooks/useAsyncState'; import AutoCompleteAgent from '../../AutoCompleteAgent'; import { useDepartmentsList } from '../hooks/useDepartmentsList'; -const ForwardChatModal = ({ - onForward, - onCancel, - room, - ...props -}: { +type ForwardChatModalFormData = { + comment: string; + department: string; + username: string; +}; + +type ForwardChatModalProps = { onForward: (departmentId?: string, userId?: string, comment?: string) => Promise; onCancel: () => void; room: IOmnichannelRoom; -}): ReactElement => { +}; + +const ForwardChatModal = ({ onForward, onCancel, room, ...props }: ForwardChatModalProps): ReactElement => { const { t } = useTranslation(); const getUserData = useEndpoint('GET', '/v1/users.info'); const idleAgentsAllowedForForwarding = useSetting('Livechat_enabled_when_agent_idle', true); @@ -46,7 +49,7 @@ const ForwardChatModal = ({ setValue, watch, formState: { isSubmitting }, - } = useForm(); + } = useForm(); useEffect(() => { setFocus('comment'); @@ -73,7 +76,7 @@ const ForwardChatModal = ({ ); const onSubmit = useCallback( - async ({ department: departmentId, username, comment }) => { + async ({ department: departmentId, username, comment }: ForwardChatModalFormData) => { let uid; if (username) { diff --git a/apps/meteor/client/components/avatar/UserAvatarEditor/UserAvatarEditor.tsx b/apps/meteor/client/components/avatar/UserAvatarEditor/UserAvatarEditor.tsx index 1535446b1bd8..971b817b75f5 100644 --- a/apps/meteor/client/components/avatar/UserAvatarEditor/UserAvatarEditor.tsx +++ b/apps/meteor/client/components/avatar/UserAvatarEditor/UserAvatarEditor.tsx @@ -32,7 +32,7 @@ function UserAvatarEditor({ currentUsername, username, setAvatarObj, name, disab const dispatchToastMessage = useToastMessageDispatch(); const setUploadedPreview = useCallback( - async (file, avatarObj) => { + async (file: File, avatarObj: AvatarObject) => { setAvatarObj(avatarObj); try { const dataURL = await readFileAsDataURL(file); diff --git a/apps/meteor/client/hooks/useRoomsList.ts b/apps/meteor/client/hooks/useRoomsList.ts index 66582d3b62f2..6dfed72f6eee 100644 --- a/apps/meteor/client/hooks/useRoomsList.ts +++ b/apps/meteor/client/hooks/useRoomsList.ts @@ -33,7 +33,7 @@ export const useRoomsList = ( }, [options, reload]); const fetchData = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { items: rooms, total } = await getRooms({ selector: JSON.stringify({ name: options.text || '' }), offset: start, diff --git a/apps/meteor/client/hooks/useTagsList.ts b/apps/meteor/client/hooks/useTagsList.ts index 9ca827331d42..5857193b9677 100644 --- a/apps/meteor/client/hooks/useTagsList.ts +++ b/apps/meteor/client/hooks/useTagsList.ts @@ -32,7 +32,7 @@ export const useTagsList = (options: TagsListOptions): UseTagsListResult => { }, [options, reload]); const fetchData = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { tags, total } = await getTags({ text: filter, offset: start, diff --git a/apps/meteor/client/omnichannel/cannedResponses/CannedResponseEdit.tsx b/apps/meteor/client/omnichannel/cannedResponses/CannedResponseEdit.tsx index b5f63dcaaaf2..b4b0ef40ba99 100644 --- a/apps/meteor/client/omnichannel/cannedResponses/CannedResponseEdit.tsx +++ b/apps/meteor/client/omnichannel/cannedResponses/CannedResponseEdit.tsx @@ -10,6 +10,15 @@ import CannedResponseForm from './components/cannedResponseForm'; import { useRemoveCannedResponse } from './useRemoveCannedResponse'; import { Page, PageHeader, PageScrollableContentWithShadow, PageFooter } from '../../components/Page'; +type CannedResponseEditFormData = { + _id: string; + shortcut: string; + text: string; + tags: string[]; + scope: string; + departmentId: string; +}; + type CannedResponseEditProps = { cannedResponseData?: Serialized; departmentData?: Serialized; @@ -32,7 +41,7 @@ const CannedResponseEdit = ({ cannedResponseData }: CannedResponseEditProps) => const saveCannedResponse = useEndpoint('POST', '/v1/canned-responses'); - const methods = useForm({ defaultValues: getInitialData(cannedResponseData) }); + const methods = useForm({ defaultValues: getInitialData(cannedResponseData) }); const { handleSubmit, @@ -43,10 +52,9 @@ const CannedResponseEdit = ({ cannedResponseData }: CannedResponseEditProps) => const handleDelete = useRemoveCannedResponse(); const handleSave = useCallback( - async ({ departmentId, ...data }) => { + async ({ departmentId, ...data }: CannedResponseEditFormData) => { try { await saveCannedResponse({ - _id: cannedResponseData?._id, ...data, ...(departmentId && { departmentId }), }); diff --git a/apps/meteor/client/omnichannel/cannedResponses/modals/CreateCannedResponse/CreateCannedResponseModal.tsx b/apps/meteor/client/omnichannel/cannedResponses/modals/CreateCannedResponse/CreateCannedResponseModal.tsx index 33c54616e1e5..59fcfb4547b8 100644 --- a/apps/meteor/client/omnichannel/cannedResponses/modals/CreateCannedResponse/CreateCannedResponseModal.tsx +++ b/apps/meteor/client/omnichannel/cannedResponses/modals/CreateCannedResponse/CreateCannedResponseModal.tsx @@ -8,6 +8,18 @@ import { useTranslation } from 'react-i18next'; import GenericModal from '../../../../components/GenericModal'; import CannedResponseForm from '../../components/cannedResponseForm'; +type CreateCannedResponseModalFormData = { + _id: string; + shortcut: string; + text: string; + tags: { + label: string; + value: string; + }[]; + scope: string; + departmentId: string; +}; + const getInitialData = ( cannedResponseData: (IOmnichannelCannedResponse & { departmentName: ILivechatDepartment['name'] }) | undefined, ) => ({ @@ -22,19 +34,17 @@ const getInitialData = ( departmentId: cannedResponseData?.departmentId || '', }); -const CreateCannedResponseModal = ({ - cannedResponseData, - onClose, - reloadCannedList, -}: { +type CreateCannedResponseModalProps = { cannedResponseData?: IOmnichannelCannedResponse & { departmentName: ILivechatDepartment['name'] }; onClose: () => void; reloadCannedList: () => void; -}) => { +}; + +const CreateCannedResponseModal = ({ cannedResponseData, onClose, reloadCannedList }: CreateCannedResponseModalProps) => { const { t } = useTranslation(); const dispatchToastMessage = useToastMessageDispatch(); - const methods = useForm({ defaultValues: getInitialData(cannedResponseData) }); + const methods = useForm({ defaultValues: getInitialData(cannedResponseData) }); const { handleSubmit, formState: { isDirty }, @@ -43,10 +53,9 @@ const CreateCannedResponseModal = ({ const saveCannedResponse = useEndpoint('POST', '/v1/canned-responses'); const handleCreate = useCallback( - async ({ departmentId, ...data }) => { + async ({ departmentId, ...data }: CreateCannedResponseModalFormData) => { try { await saveCannedResponse({ - _id: cannedResponseData?._id, ...data, ...(departmentId && { departmentId }), }); diff --git a/apps/meteor/client/omnichannel/hooks/useCannedResponseList.ts b/apps/meteor/client/omnichannel/hooks/useCannedResponseList.ts index 6e02f302e3e1..f3901f921cf8 100644 --- a/apps/meteor/client/omnichannel/hooks/useCannedResponseList.ts +++ b/apps/meteor/client/omnichannel/hooks/useCannedResponseList.ts @@ -30,7 +30,7 @@ export const useCannedResponseList = ( const getDepartments = useEndpoint('GET', '/v1/livechat/department'); const fetchData = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { cannedResponses, total } = await getCannedResponses({ ...(options.filter && { text: options.filter }), ...(options.type && ['global', 'user'].find((option) => option === options.type) && { scope: options.type }), diff --git a/apps/meteor/client/providers/CallProvider/CallProvider.tsx b/apps/meteor/client/providers/CallProvider/CallProvider.tsx index 02d508e544a2..bef0549272c1 100644 --- a/apps/meteor/client/providers/CallProvider/CallProvider.tsx +++ b/apps/meteor/client/providers/CallProvider/CallProvider.tsx @@ -76,7 +76,12 @@ export const CallProvider = ({ children }: CallProviderProps) => { const voipSounds = useVoipSounds(); const closeRoom = useCallback( - async (data = {}): Promise => { + async ( + data: { + comment?: string; + tags?: string[]; + } = {}, + ): Promise => { roomInfo && (await voipCloseRoomEndpoint({ rid: roomInfo.rid, diff --git a/apps/meteor/client/providers/SettingsProvider.tsx b/apps/meteor/client/providers/SettingsProvider.tsx index e48af97ee398..b426b283c74a 100644 --- a/apps/meteor/client/providers/SettingsProvider.tsx +++ b/apps/meteor/client/providers/SettingsProvider.tsx @@ -91,30 +91,19 @@ const SettingsProvider = ({ children, privileged = false }: SettingsProviderProp const queryClient = useQueryClient(); - // FIXME: This is a temporary solution to invalidate queries when settings change - const settingsChangeCallback = useCallback( - (changes: { _id: string }[]): void => { + const saveSettings = useMethod('saveSettings'); + const dispatch = useCallback( + async (changes: Partial[]) => { + // FIXME: This is a temporary solution to invalidate queries when settings change changes.forEach((val) => { - switch (val._id) { - case 'Enterprise_License': - queryClient.invalidateQueries({ queryKey: ['licenses'] }); - break; - - default: - break; + if (val._id === 'Enterprise_License') { + queryClient.invalidateQueries({ queryKey: ['licenses'] }); } }); - }, - [queryClient], - ); - const saveSettings = useMethod('saveSettings'); - const dispatch = useCallback( - async (changes) => { - settingsChangeCallback(changes); - await saveSettings(changes); + await saveSettings(changes as Pick[]); }, - [saveSettings, settingsChangeCallback], + [queryClient, saveSettings], ); const contextValue = useMemo( diff --git a/apps/meteor/client/views/account/preferences/PreferencesMyDataSection.tsx b/apps/meteor/client/views/account/preferences/PreferencesMyDataSection.tsx index 00b1d0301eba..53e91211a49d 100644 --- a/apps/meteor/client/views/account/preferences/PreferencesMyDataSection.tsx +++ b/apps/meteor/client/views/account/preferences/PreferencesMyDataSection.tsx @@ -13,7 +13,7 @@ const PreferencesMyDataSection = () => { const requestDataDownload = useMethod('requestDataDownload'); const downloadData = useCallback( - async (fullExport) => { + async (fullExport: boolean) => { try { const result = await requestDataDownload({ fullExport }); if (result.requested) { diff --git a/apps/meteor/client/views/account/security/TwoFactorTOTP.tsx b/apps/meteor/client/views/account/security/TwoFactorTOTP.tsx index 7ada0c88a6f0..cc282c2ba64e 100644 --- a/apps/meteor/client/views/account/security/TwoFactorTOTP.tsx +++ b/apps/meteor/client/views/account/security/TwoFactorTOTP.tsx @@ -1,7 +1,7 @@ import { Box, Button, TextInput, Margins } from '@rocket.chat/fuselage'; import { useSafely } from '@rocket.chat/fuselage-hooks'; import { useSetModal, useToastMessageDispatch, useUser, useMethod } from '@rocket.chat/ui-contexts'; -import type { ReactElement, ComponentProps } from 'react'; +import type { ReactElement, ComponentPropsWithoutRef } from 'react'; import { useState, useCallback, useEffect } from 'react'; import { useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; @@ -11,7 +11,13 @@ import BackupCodesModal from './BackupCodesModal'; import TextCopy from '../../../components/TextCopy'; import TwoFactorTotpModal from '../../../components/TwoFactorModal/TwoFactorTotpModal'; -const TwoFactorTOTP = (props: ComponentProps): ReactElement => { +type TwoFactorTOTPFormData = { + authCode: string; +}; + +type TwoFactorTOTPProps = ComponentPropsWithoutRef; + +const TwoFactorTOTP = (props: TwoFactorTOTPProps): ReactElement => { const { t } = useTranslation(); const dispatchToastMessage = useToastMessageDispatch(); const user = useUser(); @@ -28,7 +34,7 @@ const TwoFactorTOTP = (props: ComponentProps): ReactElement => { const [totpSecret, setTotpSecret] = useSafely(useState()); const [codesRemaining, setCodesRemaining] = useSafely(useState(0)); - const { register, handleSubmit } = useForm({ defaultValues: { authCode: '' } }); + const { register, handleSubmit } = useForm({ defaultValues: { authCode: '' } }); const totpEnabled = user?.services?.totp?.enabled; @@ -78,7 +84,7 @@ const TwoFactorTOTP = (props: ComponentProps): ReactElement => { }, [closeModal, disableTotpFn, dispatchToastMessage, setModal, t]); const handleVerifyCode = useCallback( - async ({ authCode }) => { + async ({ authCode }: TwoFactorTOTPFormData) => { try { const result = await verifyCodeFn(authCode); diff --git a/apps/meteor/client/views/account/tokens/AccountTokensTable/AddToken.tsx b/apps/meteor/client/views/account/tokens/AccountTokensTable/AddToken.tsx index b5cd7764f51c..a4d6ef483ca5 100644 --- a/apps/meteor/client/views/account/tokens/AccountTokensTable/AddToken.tsx +++ b/apps/meteor/client/views/account/tokens/AccountTokensTable/AddToken.tsx @@ -1,14 +1,22 @@ import type { SelectOption } from '@rocket.chat/fuselage'; import { Box, TextInput, Button, Margins, Select } from '@rocket.chat/fuselage'; import { useSetModal, useToastMessageDispatch, useUserId, useMethod } from '@rocket.chat/ui-contexts'; -import type { ReactElement } from 'react'; import { useCallback, useMemo, useEffect } from 'react'; import { Controller, useForm } from 'react-hook-form'; import { useTranslation } from 'react-i18next'; import GenericModal from '../../../../components/GenericModal'; -const AddToken = ({ reload }: { reload: () => void }): ReactElement => { +type AddTokenFormData = { + name: string; + bypassTwoFactor: string; +}; + +type AddTokenProps = { + reload: () => void; +}; + +const AddToken = ({ reload }: AddTokenProps) => { const { t } = useTranslation(); const userId = useUserId(); const setModal = useSetModal(); @@ -23,7 +31,7 @@ const AddToken = ({ reload }: { reload: () => void }): ReactElement => { handleSubmit, control, formState: { isSubmitted, submitCount }, - } = useForm({ defaultValues: initialValues }); + } = useForm({ defaultValues: initialValues }); const twoFactorAuthOptions: SelectOption[] = useMemo( () => [ @@ -34,7 +42,7 @@ const AddToken = ({ reload }: { reload: () => void }): ReactElement => { ); const handleAddToken = useCallback( - async ({ name: tokenName, bypassTwoFactor }) => { + async ({ name: tokenName, bypassTwoFactor }: AddTokenFormData) => { try { const token = await createTokenFn({ tokenName, bypassTwoFactor: bypassTwoFactor === 'bypass' }); diff --git a/apps/meteor/client/views/admin/customEmoji/AddCustomEmoji.tsx b/apps/meteor/client/views/admin/customEmoji/AddCustomEmoji.tsx index 5f22238a1c2a..bf423e53cf99 100644 --- a/apps/meteor/client/views/admin/customEmoji/AddCustomEmoji.tsx +++ b/apps/meteor/client/views/admin/customEmoji/AddCustomEmoji.tsx @@ -21,7 +21,7 @@ const AddCustomEmoji = ({ close, onChange, ...props }: AddCustomEmojiProps): Rea const [errors, setErrors] = useState({ name: false, emoji: false, aliases: false }); const setEmojiPreview = useCallback( - async (file) => { + async (file: Blob) => { setEmojiFile(file); setNewEmojiPreview(URL.createObjectURL(file)); setErrors((prevState) => ({ ...prevState, emoji: false })); diff --git a/apps/meteor/client/views/admin/customSounds/AddCustomSound.tsx b/apps/meteor/client/views/admin/customSounds/AddCustomSound.tsx index 2d5e392d4ff7..71d1495c1f70 100644 --- a/apps/meteor/client/views/admin/customSounds/AddCustomSound.tsx +++ b/apps/meteor/client/views/admin/customSounds/AddCustomSound.tsx @@ -31,7 +31,8 @@ const AddCustomSound = ({ goToNew, close, onChange, ...props }: AddCustomSoundPr const [clickUpload] = useSingleFileInput(handleChangeFile, 'audio/mp3'); const saveAction = useCallback( - async (name, soundFile): Promise => { + // FIXME + async (name: string, soundFile: any) => { const soundData = createSoundData(soundFile, name); const validation = validate(soundData, soundFile) as Array[0]>; diff --git a/apps/meteor/client/views/admin/customSounds/EditSound.tsx b/apps/meteor/client/views/admin/customSounds/EditSound.tsx index f98ddd5ae8ff..beeb0d0be163 100644 --- a/apps/meteor/client/views/admin/customSounds/EditSound.tsx +++ b/apps/meteor/client/views/admin/customSounds/EditSound.tsx @@ -53,7 +53,8 @@ function EditSound({ close, onChange, data, ...props }: EditSoundProps): ReactEl const hasUnsavedChanges = useMemo(() => previousName !== name || previousSound !== sound, [name, previousName, previousSound, sound]); const saveAction = useCallback( - async (sound) => { + // FIXME + async (sound: any) => { const soundData = createSoundData(sound, name, { previousName, previousSound, _id, extension: sound.extension }); const validation = validate(soundData, sound); if (validation.length === 0) { diff --git a/apps/meteor/client/views/admin/customUserStatus/CustomUserStatusForm.tsx b/apps/meteor/client/views/admin/customUserStatus/CustomUserStatusForm.tsx index 29adabce787d..99de03d6f975 100644 --- a/apps/meteor/client/views/admin/customUserStatus/CustomUserStatusForm.tsx +++ b/apps/meteor/client/views/admin/customUserStatus/CustomUserStatusForm.tsx @@ -10,6 +10,11 @@ import { useForm, Controller } from 'react-hook-form'; import { ContextualbarScrollableContent, ContextualbarFooter } from '../../../components/Contextualbar'; import GenericModal from '../../../components/GenericModal'; +type CustomUserStatusFormFormData = { + name: string; + statusType: string; +}; + type CustomUserStatusFormProps = { onClose: () => void; onReload: () => void; @@ -18,7 +23,7 @@ type CustomUserStatusFormProps = { const CustomUserStatusForm = ({ onClose, onReload, status }: CustomUserStatusFormProps): ReactElement => { const t = useTranslation(); - const { _id, name, statusType } = status || {}; + const { _id } = status || {}; const setModal = useSetModal(); const route = useRoute('user-status'); const dispatchToastMessage = useToastMessageDispatch(); @@ -29,18 +34,23 @@ const CustomUserStatusForm = ({ onClose, onReload, status }: CustomUserStatusFor control, handleSubmit, formState: { errors }, - } = useForm({ + } = useForm({ defaultValues: { name: status?.name ?? '', statusType: status?.statusType ?? '' }, mode: 'all', }); - const saveStatus = useEndpoint('POST', _id ? '/v1/custom-user-status.update' : '/v1/custom-user-status.create'); + const createStatus = useEndpoint('POST', '/v1/custom-user-status.create'); + const updateStatus = useEndpoint('POST', '/v1/custom-user-status.update'); const deleteStatus = useEndpoint('POST', '/v1/custom-user-status.delete'); const handleSave = useCallback( - async (data) => { + async (data: CustomUserStatusFormFormData) => { try { - await saveStatus({ _id, name, statusType, ...data }); + if (status?._id) { + await updateStatus({ _id: status?._id, ...data }); + } else { + await createStatus({ ...data }); + } dispatchToastMessage({ type: 'success', @@ -53,7 +63,7 @@ const CustomUserStatusForm = ({ onClose, onReload, status }: CustomUserStatusFor dispatchToastMessage({ type: 'error', message: error }); } }, - [saveStatus, _id, name, statusType, route, dispatchToastMessage, t, onReload], + [status?._id, dispatchToastMessage, t, onReload, route, updateStatus, createStatus], ); const handleDeleteStatus = useCallback(() => { @@ -63,7 +73,7 @@ const CustomUserStatusForm = ({ onClose, onReload, status }: CustomUserStatusFor const handleDelete = async (): Promise => { try { - await deleteStatus({ customUserStatusId: _id || '' }); + await deleteStatus({ customUserStatusId: status?._id ?? '' }); dispatchToastMessage({ type: 'success', message: t('Custom_User_Status_Has_Been_Deleted') }); onReload(); route.push({}); @@ -79,7 +89,7 @@ const CustomUserStatusForm = ({ onClose, onReload, status }: CustomUserStatusFor {t('Custom_User_Status_Delete_Warning')} , ); - }, [_id, route, deleteStatus, dispatchToastMessage, onReload, setModal, t]); + }, [status?._id, route, deleteStatus, dispatchToastMessage, onReload, setModal, t]); const presenceOptions: SelectOption[] = [ ['online', t('Online')], diff --git a/apps/meteor/client/views/admin/integrations/incoming/EditIncomingWebhook.tsx b/apps/meteor/client/views/admin/integrations/incoming/EditIncomingWebhook.tsx index cd25f75d265f..c23c61d892e2 100644 --- a/apps/meteor/client/views/admin/integrations/incoming/EditIncomingWebhook.tsx +++ b/apps/meteor/client/views/admin/integrations/incoming/EditIncomingWebhook.tsx @@ -12,7 +12,21 @@ import { useCreateIntegration } from '../hooks/useCreateIntegration'; import { useDeleteIntegration } from '../hooks/useDeleteIntegration'; import { useUpdateIntegration } from '../hooks/useUpdateIntegration'; -const getInitialValue = (webhookData: Serialized | undefined) => ({ +type EditIncomingWebhookFormData = { + enabled: boolean; + channel: string; + username: string; + name: string; + alias: string; + avatar: string; + emoji: string; + scriptEnabled: boolean; + scriptEngine: 'isolated-vm'; + overrideDestinationChannelEnabled: boolean; + script: string; +}; + +const getInitialValue = (webhookData: Serialized | undefined): EditIncomingWebhookFormData => ({ enabled: webhookData?.enabled ?? true, channel: webhookData?.channel.join(', ') ?? '', username: webhookData?.username ?? '', @@ -28,7 +42,11 @@ const getInitialValue = (webhookData: Serialized | undefin const INCOMING_TYPE = 'webhook-incoming'; -const EditIncomingWebhook = ({ webhookData }: { webhookData?: Serialized }) => { +type EditIncomingWebhookProps = { + webhookData?: Serialized; +}; + +const EditIncomingWebhook = ({ webhookData }: EditIncomingWebhookProps) => { const t = useTranslation(); const router = useRouter(); const setModal = useSetModal(); @@ -38,7 +56,7 @@ const EditIncomingWebhook = ({ webhookData }: { webhookData?: Serialized({ mode: 'onBlur', values: getInitialValue(webhookData) }); const { reset, @@ -63,7 +81,7 @@ const EditIncomingWebhook = ({ webhookData }: { webhookData?: Serialized { + async (formValues: EditIncomingWebhookFormData) => { if (webhookData?._id) { return updateIntegration.mutate({ integrationId: webhookData?._id, type: INCOMING_TYPE, ...formValues }); } diff --git a/apps/meteor/client/views/admin/integrations/outgoing/EditOutgoingWebhook.tsx b/apps/meteor/client/views/admin/integrations/outgoing/EditOutgoingWebhook.tsx index aa1556ac5eba..b15f6b554253 100644 --- a/apps/meteor/client/views/admin/integrations/outgoing/EditOutgoingWebhook.tsx +++ b/apps/meteor/client/views/admin/integrations/outgoing/EditOutgoingWebhook.tsx @@ -1,4 +1,4 @@ -import type { IOutgoingIntegration, Serialized } from '@rocket.chat/core-typings'; +import type { IOutgoingIntegration, OutgoingIntegrationEvent, Serialized } from '@rocket.chat/core-typings'; import { Button, ButtonGroup, Tabs, TabsItem } from '@rocket.chat/fuselage'; import { useUniqueId } from '@rocket.chat/fuselage-hooks'; import { useSetModal, useTranslation, useRouter, useRouteParameter } from '@rocket.chat/ui-contexts'; @@ -13,7 +13,31 @@ import { useCreateIntegration } from '../hooks/useCreateIntegration'; import { useDeleteIntegration } from '../hooks/useDeleteIntegration'; import { useUpdateIntegration } from '../hooks/useUpdateIntegration'; -const getInitialValue = (webhookData: Serialized | undefined, defaultToken: string) => ({ +type EditOutgoingWebhookFormData = { + enabled: boolean; + impersonateUser: boolean; + event: OutgoingIntegrationEvent; + urls: string; + token: string; + triggerWords: string; + targetRoom: string; + channel: string; + username: string; + name: string; + alias: string; + avatar: string; + emoji: string; + scriptEnabled: boolean; + scriptEngine: 'isolated-vm'; + script: string; + retryFailedCalls: boolean; + retryCount: number; + retryDelay: string; + triggerWordAnywhere: boolean; + runOnEdits: boolean; +}; + +const getInitialValue = (webhookData: Serialized | undefined, defaultToken: string): EditOutgoingWebhookFormData => ({ enabled: webhookData?.enabled ?? true, impersonateUser: webhookData?.impersonateUser ?? false, event: webhookData?.event ?? 'sendMessage', @@ -39,7 +63,11 @@ const getInitialValue = (webhookData: Serialized | undefin const OUTGOING_TYPE = 'webhook-outgoing'; -const EditOutgoingWebhook = ({ webhookData }: { webhookData?: Serialized }) => { +type EditOutgoingWebhookProps = { + webhookData?: Serialized; +}; + +const EditOutgoingWebhook = ({ webhookData }: EditOutgoingWebhookProps) => { const t = useTranslation(); const setModal = useSetModal(); const router = useRouter(); @@ -48,7 +76,7 @@ const EditOutgoingWebhook = ({ webhookData }: { webhookData?: Serialized({ mode: 'onBlur', values: getInitialValue(webhookData, defaultToken) }); const { reset, handleSubmit, @@ -75,7 +103,7 @@ const EditOutgoingWebhook = ({ webhookData }: { webhookData?: Serialized { + async (formValues: EditOutgoingWebhookFormData) => { if (webhookData?._id) { return updateIntegration.mutate({ type: OUTGOING_TYPE, diff --git a/apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx b/apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx index f9c69d22f90b..5f7265c1b2fb 100644 --- a/apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx +++ b/apps/meteor/client/views/admin/users/UsersTable/UsersTableFilters.tsx @@ -21,9 +21,9 @@ const UsersTableFilters = ({ roleData, setUsersFilters }: UsersTableFiltersProps const [text, setText] = useState(''); const handleSearchTextChange = useCallback( - ({ target: { value } }) => { - setText(value); - setUsersFilters({ text: value, roles: selectedRoles }); + (event: FormEvent) => { + setText(event.currentTarget.value); + setUsersFilters({ text: event.currentTarget.value, roles: selectedRoles }); }, [selectedRoles, setUsersFilters], ); diff --git a/apps/meteor/client/views/hooks/useDepartmentsByUnitsList.ts b/apps/meteor/client/views/hooks/useDepartmentsByUnitsList.ts index e6cffadaaa0b..29016c4d9b97 100644 --- a/apps/meteor/client/views/hooks/useDepartmentsByUnitsList.ts +++ b/apps/meteor/client/views/hooks/useDepartmentsByUnitsList.ts @@ -30,7 +30,7 @@ export const useDepartmentsByUnitsList = ( }, [options, reload]); const fetchData = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { departments, total } = await getDepartments({ text: options.filter, offset: start, diff --git a/apps/meteor/client/views/hooks/useMonitorsList.ts b/apps/meteor/client/views/hooks/useMonitorsList.ts index 512b49d49d8e..068e6d8a3910 100644 --- a/apps/meteor/client/views/hooks/useMonitorsList.ts +++ b/apps/meteor/client/views/hooks/useMonitorsList.ts @@ -28,7 +28,7 @@ export const useMonitorsList = ( }, [options, reload]); const fetchData = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { monitors, total } = await getMonitors({ text: options.filter, offset: start, diff --git a/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPage.tsx b/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPage.tsx index c32ba7ccd76a..4570d4abeb43 100644 --- a/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPage.tsx +++ b/apps/meteor/client/views/marketplace/AppDetailsPage/AppDetailsPage.tsx @@ -1,5 +1,5 @@ import type { ISetting } from '@rocket.chat/apps-engine/definition/settings'; -import type { App } from '@rocket.chat/core-typings'; +import type { App, SettingValue } from '@rocket.chat/core-typings'; import { Button, ButtonGroup, Box } from '@rocket.chat/fuselage'; import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; import { useTranslation, useRouteParameter, useToastMessageDispatch, usePermission, useRouter } from '@rocket.chat/ui-contexts'; @@ -21,7 +21,13 @@ import AppSettings from './tabs/AppSettings'; import { AppClientOrchestratorInstance } from '../../../apps/orchestrator'; import { Page, PageFooter, PageHeader, PageScrollableContentWithShadow } from '../../../components/Page'; -const AppDetailsPage = ({ id }: { id: App['id'] }): ReactElement => { +type AppDetailsPageFormData = Record; + +type AppDetailsPageProps = { + id: App['id']; +}; + +const AppDetailsPage = ({ id }: AppDetailsPageProps): ReactElement => { const t = useTranslation(); const router = useRouter(); const dispatchToastMessage = useToastMessageDispatch(); @@ -46,7 +52,7 @@ const AppDetailsPage = ({ id }: { id: App['id'] }): ReactElement => { const isSecurityVisible = Boolean(privacyPolicySummary || permissions || tosLink || privacyLink); const saveAppSettings = useCallback( - async (data) => { + async (data: AppDetailsPageFormData) => { try { await AppClientOrchestratorInstance.setAppSettings( id, @@ -64,11 +70,14 @@ const AppDetailsPage = ({ id }: { id: App['id'] }): ReactElement => { [dispatchToastMessage, id, name, settings], ); - const reducedSettings = useMemo(() => { - return Object.values(settings || {}).reduce((ret, { id, value, packageValue }) => ({ ...ret, [id]: value ?? packageValue }), {}); + const reducedSettings = useMemo((): AppDetailsPageFormData => { + return Object.values(settings || {}).reduce( + (ret: AppDetailsPageFormData, { id, value, packageValue }) => ({ ...ret, [id]: value ?? packageValue }), + {}, + ); }, [settings]); - const methods = useForm({ values: reducedSettings }); + const methods = useForm({ values: reducedSettings }); const { handleSubmit, reset, diff --git a/apps/meteor/client/views/marketplace/hooks/useAppMenu.tsx b/apps/meteor/client/views/marketplace/hooks/useAppMenu.tsx index 61470b8a454a..2bdbb2fd4aec 100644 --- a/apps/meteor/client/views/marketplace/hooks/useAppMenu.tsx +++ b/apps/meteor/client/views/marketplace/hooks/useAppMenu.tsx @@ -1,5 +1,5 @@ import { AppStatus } from '@rocket.chat/apps-engine/definition/AppStatus'; -import type { App } from '@rocket.chat/core-typings'; +import type { App, AppPermission } from '@rocket.chat/core-typings'; import { Box, Icon } from '@rocket.chat/fuselage'; import { useSetModal, @@ -95,7 +95,7 @@ export const useAppMenu = (app: App, isAppDetailsPage: boolean) => { const marketplaceActions = useMarketplaceActions(); const installationSuccess = useCallback( - async (action: Actions | '', permissionsGranted) => { + async (action: Actions | '', permissionsGranted?: AppPermission[]) => { if (action) { if (action === 'request') { setRequestedEndUser(true); diff --git a/apps/meteor/client/views/marketplace/hooks/useOpenIncompatibleModal.tsx b/apps/meteor/client/views/marketplace/hooks/useOpenIncompatibleModal.tsx index 842e8b0da384..755d5a363cbf 100644 --- a/apps/meteor/client/views/marketplace/hooks/useOpenIncompatibleModal.tsx +++ b/apps/meteor/client/views/marketplace/hooks/useOpenIncompatibleModal.tsx @@ -1,3 +1,4 @@ +import type { App } from '@rocket.chat/core-typings'; import { useSetModal } from '@rocket.chat/ui-contexts'; import { useCallback } from 'react'; @@ -15,7 +16,7 @@ export const useOpenIncompatibleModal = () => { } return useCallback( - async (app, actionName, cancelAction) => { + async (app: App, actionName: string, cancelAction: () => void) => { const handleCancel = () => { setModal(null); cancelAction(); diff --git a/apps/meteor/client/views/omnichannel/contactHistory/MessageList/useHistoryMessageList.ts b/apps/meteor/client/views/omnichannel/contactHistory/MessageList/useHistoryMessageList.ts index ba450cda05e3..4b1a9fbbd13d 100644 --- a/apps/meteor/client/views/omnichannel/contactHistory/MessageList/useHistoryMessageList.ts +++ b/apps/meteor/client/views/omnichannel/contactHistory/MessageList/useHistoryMessageList.ts @@ -31,7 +31,7 @@ export const useHistoryMessageList = ( }, [options, reload]); const fetchMessages = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { messages, total } = await getMessages({ ...(options.filter && { searchTerm: options.filter }), offset: start, diff --git a/apps/meteor/client/views/omnichannel/directory/chats/ChatInfo/RoomEdit/RoomEdit.tsx b/apps/meteor/client/views/omnichannel/directory/chats/ChatInfo/RoomEdit/RoomEdit.tsx index b16e73228513..0e884e2f65a9 100644 --- a/apps/meteor/client/views/omnichannel/directory/chats/ChatInfo/RoomEdit/RoomEdit.tsx +++ b/apps/meteor/client/views/omnichannel/directory/chats/ChatInfo/RoomEdit/RoomEdit.tsx @@ -15,6 +15,14 @@ import { FormSkeleton } from '../../../components/FormSkeleton'; import { useCustomFieldsMetadata } from '../../../hooks/useCustomFieldsMetadata'; import { useSlaPolicies } from '../../../hooks/useSlaPolicies'; +type RoomEditFormData = { + topic: string; + tags: string[]; + livechatData: any; + slaId: string; + priorityId: string; +}; + type RoomEditProps = { room: Serialized; visitor: Serialized; @@ -30,7 +38,7 @@ const ROOM_INTIAL_VALUE = { slaId: '', }; -const getInitialValuesRoom = (room: Serialized) => { +const getInitialValuesRoom = (room: Serialized): RoomEditFormData => { const { topic, tags, livechatData, slaId, priorityId } = room ?? ROOM_INTIAL_VALUE; return { @@ -62,7 +70,7 @@ function RoomEdit({ room, visitor, reload, reloadInfo, onClose }: RoomEditProps) control, formState: { isDirty: isFormDirty, isValid: isFormValid, isSubmitting }, handleSubmit, - } = useForm({ + } = useForm({ mode: 'onChange', defaultValues: getInitialValuesRoom(room), }); @@ -72,7 +80,7 @@ function RoomEdit({ room, visitor, reload, reloadInfo, onClose }: RoomEditProps) const { field: priorityIdField } = useController({ control, name: 'priorityId' }); const handleSave = useCallback( - async (data) => { + async (data: RoomEditFormData) => { if (!isFormValid) { return; } diff --git a/apps/meteor/client/views/room/ImageGallery/hooks/useImagesList.ts b/apps/meteor/client/views/room/ImageGallery/hooks/useImagesList.ts index 886393dd0494..ed2f81575f7a 100644 --- a/apps/meteor/client/views/room/ImageGallery/hooks/useImagesList.ts +++ b/apps/meteor/client/views/room/ImageGallery/hooks/useImagesList.ts @@ -34,7 +34,7 @@ export const useImagesList = ( const getFiles = useEndpoint('GET', apiEndPoint); const fetchMessages = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { files, total } = await getFiles({ roomId: options.roomId, startingFromId: options.startingFromId, diff --git a/apps/meteor/client/views/room/contextualBar/Discussions/useDiscussionsList.ts b/apps/meteor/client/views/room/contextualBar/Discussions/useDiscussionsList.ts index a84405db4384..d747c97c3428 100644 --- a/apps/meteor/client/views/room/contextualBar/Discussions/useDiscussionsList.ts +++ b/apps/meteor/client/views/room/contextualBar/Discussions/useDiscussionsList.ts @@ -25,7 +25,7 @@ export const useDiscussionsList = ( const getDiscussions = useEndpoint('GET', '/v1/chat.getDiscussions'); const fetchMessages = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { messages, total } = await getDiscussions({ roomId: options.rid, text: options.text, diff --git a/apps/meteor/client/views/room/contextualBar/RoomFiles/hooks/useFilesList.ts b/apps/meteor/client/views/room/contextualBar/RoomFiles/hooks/useFilesList.ts index 25bd59d002f7..3cf4a5dd4869 100644 --- a/apps/meteor/client/views/room/contextualBar/RoomFiles/hooks/useFilesList.ts +++ b/apps/meteor/client/views/room/contextualBar/RoomFiles/hooks/useFilesList.ts @@ -47,7 +47,7 @@ export const useFilesList = ( const getFiles = useEndpoint('GET', apiEndPoint); const fetchMessages = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { files, total } = await getFiles({ roomId: options.rid, offset: start, diff --git a/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadsList.ts b/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadsList.ts index 90c04fb607fa..cf9c32980f01 100644 --- a/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadsList.ts +++ b/apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadsList.ts @@ -21,7 +21,7 @@ export const useThreadsList = ( const getThreadsList = useEndpoint('GET', '/v1/chat.getThreadsList'); const fetchMessages = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { threads, total } = await getThreadsList({ rid: options.rid, type: options.type, diff --git a/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfList/useVideoConfList.ts b/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfList/useVideoConfList.ts index ce9d991dd3f7..3ed6914ff97d 100644 --- a/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfList/useVideoConfList.ts +++ b/apps/meteor/client/views/room/contextualBar/VideoConference/VideoConfList/useVideoConfList.ts @@ -23,7 +23,7 @@ export const useVideoConfList = (options: { }, [options, reload]); const fetchData = useCallback( - async (_start, _end) => { + async (_start: number, _end: number) => { const { data, total } = await getVideoConfs({ roomId: options.roomId, }); diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeLeaderAction.ts b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeLeaderAction.ts index feee1e61832f..354f8ae70b52 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeLeaderAction.ts +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeLeaderAction.ts @@ -9,7 +9,7 @@ import { useToastMessageDispatch, } from '@rocket.chat/ui-contexts'; import { useMutation } from '@tanstack/react-query'; -import { useCallback, useMemo } from 'react'; +import { useMemo } from 'react'; import { getRoomDirectives } from '../../../lib/getRoomDirectives'; import { useUserHasRoomRole } from '../../useUserHasRoomRole'; @@ -40,14 +40,11 @@ export const useChangeLeaderAction = (user: Pick, rid const toggleLeaderEndpoint = useEndpoint('POST', getEndpoint(room.t, isLeader)); const toggleOwnerMutation = useMutation({ - mutationFn: useCallback( - async ({ roomId, userId }) => { - await toggleLeaderEndpoint({ roomId, userId }); + mutationFn: async ({ roomId, userId }: { roomId: string; userId: string }) => { + await toggleLeaderEndpoint({ roomId, userId }); - return t(isLeader ? 'removed__username__as__role_' : 'set__username__as__role_', { username, role: 'leader' }); - }, - [t, isLeader, toggleLeaderEndpoint, username], - ), + return t(isLeader ? 'removed__username__as__role_' : 'set__username__as__role_', { username, role: 'leader' }); + }, onSuccess: (message) => { dispatchToastMessage({ type: 'success', message }); }, diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx index 594f2800a15a..c5e3b5c6000d 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeModeratorAction.tsx @@ -71,20 +71,14 @@ export const useChangeModeratorAction = (user: Pick, const toggleModeratorEndpoint = useEndpoint('POST', getEndpoint(room.t, isModerator)); const toggleModerator = useMutation({ - mutationFn: useCallback( - async ({ roomId, userId }) => { - await toggleModeratorEndpoint({ roomId, userId }); - - return t( - isModerator ? 'User__username__removed_from__room_name__moderators' : 'User__username__is_now_a_moderator_of__room_name_', - { - username: user.username, - room_name: roomName, - }, - ); - }, - [toggleModeratorEndpoint, t, isModerator, user.username, roomName], - ), + mutationFn: async ({ roomId, userId }: { roomId: string; userId: string }) => { + await toggleModeratorEndpoint({ roomId, userId }); + + return t(isModerator ? 'User__username__removed_from__room_name__moderators' : 'User__username__is_now_a_moderator_of__room_name_', { + username: user.username, + room_name: roomName, + }); + }, onSuccess: (message) => { dispatchToastMessage({ type: 'success', message }); }, diff --git a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx index a247fc7d0047..9a0f78110c8f 100644 --- a/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx +++ b/apps/meteor/client/views/room/hooks/useUserInfoActions/actions/useChangeOwnerAction.tsx @@ -70,17 +70,14 @@ export const useChangeOwnerAction = (user: Pick, rid: const toggleOwnerEndpoint = useEndpoint('POST', getEndpoint(room.t, isOwner)); const toggleOwnerMutation = useMutation({ - mutationFn: useCallback( - async ({ roomId, userId }) => { - await toggleOwnerEndpoint({ roomId, userId }); - - return t(isOwner ? 'User__username__removed_from__room_name__owners' : 'User__username__is_now_an_owner_of__room_name_', { - username, - room_name: roomName, - }); - }, - [toggleOwnerEndpoint, t, isOwner, username, roomName], - ), + mutationFn: async ({ roomId, userId }: { roomId: string; userId: string }) => { + await toggleOwnerEndpoint({ roomId, userId }); + + return t(isOwner ? 'User__username__removed_from__room_name__owners' : 'User__username__is_now_an_owner_of__room_name_', { + username, + room_name: roomName, + }); + }, onSuccess: (message) => { dispatchToastMessage({ type: 'success', message }); }, diff --git a/apps/meteor/client/views/setupWizard/providers/SetupWizardProvider.tsx b/apps/meteor/client/views/setupWizard/providers/SetupWizardProvider.tsx index de333dec3914..e5b2134ff585 100644 --- a/apps/meteor/client/views/setupWizard/providers/SetupWizardProvider.tsx +++ b/apps/meteor/client/views/setupWizard/providers/SetupWizardProvider.tsx @@ -70,7 +70,17 @@ const SetupWizardProvider = ({ children }: { children: ReactElement }): ReactEle ); const registerAdminUser = useCallback( - async ({ fullname, username, email, password }): Promise => { + async ({ + fullname, + username, + email, + password, + }: { + fullname: string; + username: string; + email: string; + password: string; + }): Promise => { await registerUser({ name: fullname, username, email, pass: password }); void callbacks.run('userRegistered', {}); @@ -97,7 +107,7 @@ const SetupWizardProvider = ({ children }: { children: ReactElement }): ReactEle ); const saveAgreementData = useCallback( - async (agreement): Promise => { + async (agreement: boolean): Promise => { await dispatchSettings([ { _id: 'Cloud_Service_Agree_PrivacyTerms', diff --git a/apps/meteor/client/views/teams/contextualBar/channels/AddExistingModal/AddExistingModal.tsx b/apps/meteor/client/views/teams/contextualBar/channels/AddExistingModal/AddExistingModal.tsx index bcb83fb4cfa6..182aca5ee7c8 100644 --- a/apps/meteor/client/views/teams/contextualBar/channels/AddExistingModal/AddExistingModal.tsx +++ b/apps/meteor/client/views/teams/contextualBar/channels/AddExistingModal/AddExistingModal.tsx @@ -6,6 +6,10 @@ import { useTranslation } from 'react-i18next'; import RoomsAvailableForTeamsAutoComplete from './RoomsAvailableForTeamsAutoComplete'; +type AddExistingModalFormData = { + rooms: string[]; +}; + type AddExistingModalProps = { teamId: string; onClose: () => void; @@ -22,10 +26,10 @@ const AddExistingModal = ({ teamId, onClose, reload }: AddExistingModalProps) => control, formState: { isDirty }, handleSubmit, - } = useForm({ defaultValues: { rooms: [] } }); + } = useForm({ defaultValues: { rooms: [] } }); const handleAddChannels = useCallback( - async ({ rooms }) => { + async ({ rooms }: AddExistingModalFormData) => { try { await addRoomEndpoint({ rooms, diff --git a/apps/meteor/client/views/teams/contextualBar/channels/hooks/useTeamsChannelList.ts b/apps/meteor/client/views/teams/contextualBar/channels/hooks/useTeamsChannelList.ts index 43fc7c2db1a6..e18c455dfa09 100644 --- a/apps/meteor/client/views/teams/contextualBar/channels/hooks/useTeamsChannelList.ts +++ b/apps/meteor/client/views/teams/contextualBar/channels/hooks/useTeamsChannelList.ts @@ -31,7 +31,7 @@ export const useTeamsChannelList = ( }, [options, reload]); const fetchData = useCallback( - async (start, end) => { + async (start: number, end: number) => { const { rooms, total } = await apiEndPoint({ teamId: options.teamId, offset: start, @@ -47,7 +47,7 @@ export const useTeamsChannelList = ( _updatedAt: new Date(_updatedAt), ...(lastMessage && { lastMessage: mapMessageFromApi(lastMessage) }), ...(webRtcCallStartTime && { webRtcCallStartTime: new Date(webRtcCallStartTime) }), - ...(usersWaitingForE2EKeys && usersWaitingForE2EKeys.map(({ userId, ts }) => ({ userId, ts: new Date(ts) }))), + ...usersWaitingForE2EKeys?.map(({ userId, ts }) => ({ userId, ts: new Date(ts) })), ...room, })), itemCount: total, diff --git a/apps/meteor/package.json b/apps/meteor/package.json index a3905332f202..c902bed0e830 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -139,8 +139,8 @@ "@types/proxy-from-env": "^1.0.4", "@types/proxyquire": "^1.3.31", "@types/psl": "^1.1.3", - "@types/react": "~17.0.80", - "@types/react-dom": "~17.0.25", + "@types/react": "~17.0.83", + "@types/react-dom": "~17.0.26", "@types/sanitize-html": "^2.13.0", "@types/semver": "^7.5.8", "@types/sharp": "^0.32.0", diff --git a/apps/uikit-playground/package.json b/apps/uikit-playground/package.json index faf20592b821..a135350f615e 100644 --- a/apps/uikit-playground/package.json +++ b/apps/uikit-playground/package.json @@ -42,9 +42,9 @@ }, "devDependencies": { "@types/lodash": "~4.17.13", - "@types/react": "~17.0.80", + "@types/react": "~17.0.83", "@types/react-beautiful-dnd": "^13.1.8", - "@types/react-dom": "~17.0.25", + "@types/react-dom": "~17.0.26", "@typescript-eslint/eslint-plugin": "~5.60.1", "@typescript-eslint/parser": "~5.60.1", "@vitejs/plugin-react": "^4.3.3", diff --git a/ee/packages/pdf-worker/package.json b/ee/packages/pdf-worker/package.json index fa252b5292c4..3adfe259eb18 100644 --- a/ee/packages/pdf-worker/package.json +++ b/ee/packages/pdf-worker/package.json @@ -36,8 +36,8 @@ "@testing-library/react": "~16.0.1", "@types/emojione": "^2.2.9", "@types/jest": "~29.5.14", - "@types/react": "~17.0.80", - "@types/react-dom": "~17.0.25", + "@types/react": "~17.0.83", + "@types/react-dom": "~17.0.26", "buffer": "~6.0.3", "eslint": "~8.45.0", "jest": "~29.7.0", diff --git a/ee/packages/ui-theming/package.json b/ee/packages/ui-theming/package.json index 65aa842ba39c..2b2996f508bd 100644 --- a/ee/packages/ui-theming/package.json +++ b/ee/packages/ui-theming/package.json @@ -8,7 +8,7 @@ "@rocket.chat/fuselage-hooks": "^0.34.0", "@rocket.chat/icons": "~0.39.0", "@rocket.chat/ui-contexts": "workspace:~", - "@types/react": "~17.0.80", + "@types/react": "~17.0.83", "eslint": "~8.45.0", "eslint-plugin-anti-trojan-source": "~1.1.1", "eslint-plugin-react": "~7.37.2", diff --git a/packages/fuselage-ui-kit/package.json b/packages/fuselage-ui-kit/package.json index a71c300b7e71..4365c2419040 100644 --- a/packages/fuselage-ui-kit/package.json +++ b/packages/fuselage-ui-kit/package.json @@ -74,8 +74,8 @@ "@tanstack/react-query": "patch:@tanstack/react-query@npm%3A5.60.5#~/.yarn/patches/@tanstack-react-query-npm-5.60.5-04c500b172.patch", "@testing-library/react": "~16.0.1", "@testing-library/user-event": "~14.5.2", - "@types/react": "~17.0.80", - "@types/react-dom": "~17.0.25", + "@types/react": "~17.0.83", + "@types/react-dom": "~17.0.26", "babel-loader": "~9.2.1", "cross-env": "^7.0.3", "eslint": "~8.45.0", diff --git a/packages/gazzodown/package.json b/packages/gazzodown/package.json index c63a256bc054..c764be413ef2 100644 --- a/packages/gazzodown/package.json +++ b/packages/gazzodown/package.json @@ -49,8 +49,8 @@ "@types/dompurify": "^3.0.5", "@types/jest": "~29.5.14", "@types/katex": "~0.16.7", - "@types/react": "~17.0.80", - "@types/react-dom": "~17.0.25", + "@types/react": "~17.0.83", + "@types/react-dom": "~17.0.26", "@typescript-eslint/eslint-plugin": "~5.60.1", "@typescript-eslint/parser": "~5.60.1", "babel-loader": "^9.2.1", diff --git a/packages/rest-typings/src/v1/customUserStatus.ts b/packages/rest-typings/src/v1/customUserStatus.ts index 495079d5e73f..cf3e6801be17 100644 --- a/packages/rest-typings/src/v1/customUserStatus.ts +++ b/packages/rest-typings/src/v1/customUserStatus.ts @@ -59,7 +59,7 @@ export type CustomUserStatusEndpoints = { POST: (params: { customUserStatusId: string }) => void; }; '/v1/custom-user-status.update': { - POST: (params: { id: string; name?: string; statusType?: string }) => { + POST: (params: { _id: string; name?: string; statusType?: string }) => { customUserStatus: ICustomUserStatus; }; }; diff --git a/packages/ui-avatar/package.json b/packages/ui-avatar/package.json index c4a216d909dd..729dddd395ac 100644 --- a/packages/ui-avatar/package.json +++ b/packages/ui-avatar/package.json @@ -6,8 +6,8 @@ "@babel/core": "~7.26.0", "@rocket.chat/fuselage": "^0.60.0", "@rocket.chat/ui-contexts": "workspace:^", - "@types/react": "~17.0.80", - "@types/react-dom": "~17.0.25", + "@types/react": "~17.0.83", + "@types/react-dom": "~17.0.26", "eslint": "~8.45.0", "eslint-plugin-react": "~7.37.2", "eslint-plugin-react-hooks": "~5.0.0", diff --git a/packages/ui-client/package.json b/packages/ui-client/package.json index 6d139d408c3f..5cd9edba4c6f 100644 --- a/packages/ui-client/package.json +++ b/packages/ui-client/package.json @@ -39,8 +39,8 @@ "@storybook/react-webpack5": "^8.4.4", "@testing-library/react": "~16.0.1", "@types/jest": "~29.5.14", - "@types/react": "~17.0.80", - "@types/react-dom": "~17.0.25", + "@types/react": "~17.0.83", + "@types/react-dom": "~17.0.26", "eslint": "~8.45.0", "eslint-plugin-anti-trojan-source": "~1.1.1", "eslint-plugin-react": "~7.37.2", diff --git a/packages/ui-composer/package.json b/packages/ui-composer/package.json index 09566acc7518..8a801be3ab70 100644 --- a/packages/ui-composer/package.json +++ b/packages/ui-composer/package.json @@ -30,8 +30,8 @@ "@storybook/addon-webpack5-compiler-babel": "^3.0.3", "@storybook/react": "^8.4.4", "@storybook/react-webpack5": "^8.4.4", - "@types/react": "~17.0.80", - "@types/react-dom": "~17.0.25", + "@types/react": "~17.0.83", + "@types/react-dom": "~17.0.26", "eslint": "~8.45.0", "eslint-plugin-react": "~7.37.2", "eslint-plugin-react-hooks": "~5.0.0", diff --git a/packages/ui-contexts/package.json b/packages/ui-contexts/package.json index 7e3570a9c3d5..30673af54734 100644 --- a/packages/ui-contexts/package.json +++ b/packages/ui-contexts/package.json @@ -9,8 +9,8 @@ "@rocket.chat/fuselage-hooks": "^0.34.0", "@rocket.chat/i18n": "workspace:~", "@rocket.chat/rest-typings": "workspace:^", - "@types/react": "~17.0.80", - "@types/react-dom": "~17.0.25", + "@types/react": "~17.0.83", + "@types/react-dom": "~17.0.26", "@types/use-sync-external-store": "^0.0.6", "eslint": "~8.45.0", "eslint-plugin-react-hooks": "^5.0.0", diff --git a/packages/ui-video-conf/package.json b/packages/ui-video-conf/package.json index 6d674de22c4a..52c05de4e922 100644 --- a/packages/ui-video-conf/package.json +++ b/packages/ui-video-conf/package.json @@ -41,7 +41,7 @@ "@storybook/react-webpack5": "^8.4.4", "@types/jest": "~29.5.14", "@types/jest-axe": "~3.5.9", - "@types/react": "~17.0.80", + "@types/react": "~17.0.83", "eslint": "~8.45.0", "eslint-plugin-react": "~7.37.2", "eslint-plugin-react-hooks": "~5.0.0", diff --git a/packages/ui-voip/package.json b/packages/ui-voip/package.json index a9bf7dcaa563..f3ac6996ebaf 100644 --- a/packages/ui-voip/package.json +++ b/packages/ui-voip/package.json @@ -49,8 +49,8 @@ "@testing-library/user-event": "~14.5.2", "@types/jest": "~29.5.14", "@types/jest-axe": "~3.5.9", - "@types/react": "~17.0.80", - "@types/react-dom": "~17.0.25", + "@types/react": "~17.0.83", + "@types/react-dom": "~17.0.26", "eslint": "~8.45.0", "eslint-plugin-react": "~7.37.2", "eslint-plugin-react-hooks": "~5.0.0", diff --git a/packages/web-ui-registration/package.json b/packages/web-ui-registration/package.json index d833208e8b89..af57996e3934 100644 --- a/packages/web-ui-registration/package.json +++ b/packages/web-ui-registration/package.json @@ -36,7 +36,7 @@ "@storybook/theming": "^8.4.4", "@tanstack/react-query": "patch:@tanstack/react-query@npm%3A5.60.5#~/.yarn/patches/@tanstack-react-query-npm-5.60.5-04c500b172.patch", "@testing-library/react": "~16.0.1", - "@types/react": "~17.0.80", + "@types/react": "~17.0.83", "babel-loader": "~9.2.1", "eslint": "~8.45.0", "react": "~17.0.2", diff --git a/yarn.lock b/yarn.lock index cc569d59c4b6..4ee56852ed20 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7876,8 +7876,8 @@ __metadata: "@tanstack/react-query": "patch:@tanstack/react-query@npm%3A5.60.5#~/.yarn/patches/@tanstack-react-query-npm-5.60.5-04c500b172.patch" "@testing-library/react": "npm:~16.0.1" "@testing-library/user-event": "npm:~14.5.2" - "@types/react": "npm:~17.0.80" - "@types/react-dom": "npm:~17.0.25" + "@types/react": "npm:~17.0.83" + "@types/react-dom": "npm:~17.0.26" babel-loader: "npm:~9.2.1" cross-env: "npm:^7.0.3" eslint: "npm:~8.45.0" @@ -7963,8 +7963,8 @@ __metadata: "@types/dompurify": "npm:^3.0.5" "@types/jest": "npm:~29.5.14" "@types/katex": "npm:~0.16.7" - "@types/react": "npm:~17.0.80" - "@types/react-dom": "npm:~17.0.25" + "@types/react": "npm:~17.0.83" + "@types/react-dom": "npm:~17.0.26" "@typescript-eslint/eslint-plugin": "npm:~5.60.1" "@typescript-eslint/parser": "npm:~5.60.1" babel-loader: "npm:^9.2.1" @@ -8425,8 +8425,8 @@ __metadata: "@types/proxy-from-env": "npm:^1.0.4" "@types/proxyquire": "npm:^1.3.31" "@types/psl": "npm:^1.1.3" - "@types/react": "npm:~17.0.80" - "@types/react-dom": "npm:~17.0.25" + "@types/react": "npm:~17.0.83" + "@types/react-dom": "npm:~17.0.26" "@types/sanitize-html": "npm:^2.13.0" "@types/semver": "npm:^7.5.8" "@types/sharp": "npm:^0.32.0" @@ -8870,8 +8870,8 @@ __metadata: "@testing-library/react": "npm:~16.0.1" "@types/emojione": "npm:^2.2.9" "@types/jest": "npm:~29.5.14" - "@types/react": "npm:~17.0.80" - "@types/react-dom": "npm:~17.0.25" + "@types/react": "npm:~17.0.83" + "@types/react-dom": "npm:~17.0.26" buffer: "npm:~6.0.3" emoji-assets: "npm:^7.0.1" emoji-toolkit: "npm:^7.0.1" @@ -9223,8 +9223,8 @@ __metadata: "@babel/core": "npm:~7.26.0" "@rocket.chat/fuselage": "npm:^0.60.0" "@rocket.chat/ui-contexts": "workspace:^" - "@types/react": "npm:~17.0.80" - "@types/react-dom": "npm:~17.0.25" + "@types/react": "npm:~17.0.83" + "@types/react-dom": "npm:~17.0.26" eslint: "npm:~8.45.0" eslint-plugin-react: "npm:~7.37.2" eslint-plugin-react-hooks: "npm:~5.0.0" @@ -9264,8 +9264,8 @@ __metadata: "@storybook/react-webpack5": "npm:^8.4.4" "@testing-library/react": "npm:~16.0.1" "@types/jest": "npm:~29.5.14" - "@types/react": "npm:~17.0.80" - "@types/react-dom": "npm:~17.0.25" + "@types/react": "npm:~17.0.83" + "@types/react-dom": "npm:~17.0.26" eslint: "npm:~8.45.0" eslint-plugin-anti-trojan-source: "npm:~1.1.1" eslint-plugin-react: "npm:~7.37.2" @@ -9307,8 +9307,8 @@ __metadata: "@storybook/addon-webpack5-compiler-babel": "npm:^3.0.3" "@storybook/react": "npm:^8.4.4" "@storybook/react-webpack5": "npm:^8.4.4" - "@types/react": "npm:~17.0.80" - "@types/react-dom": "npm:~17.0.25" + "@types/react": "npm:~17.0.83" + "@types/react-dom": "npm:~17.0.26" eslint: "npm:~8.45.0" eslint-plugin-react: "npm:~7.37.2" eslint-plugin-react-hooks: "npm:~5.0.0" @@ -9337,8 +9337,8 @@ __metadata: "@rocket.chat/i18n": "workspace:~" "@rocket.chat/password-policies": "workspace:^" "@rocket.chat/rest-typings": "workspace:^" - "@types/react": "npm:~17.0.80" - "@types/react-dom": "npm:~17.0.25" + "@types/react": "npm:~17.0.83" + "@types/react-dom": "npm:~17.0.26" "@types/use-sync-external-store": "npm:^0.0.6" eslint: "npm:~8.45.0" eslint-plugin-react-hooks: "npm:^5.0.0" @@ -9396,7 +9396,7 @@ __metadata: "@rocket.chat/fuselage-hooks": "npm:^0.34.0" "@rocket.chat/icons": "npm:~0.39.0" "@rocket.chat/ui-contexts": "workspace:~" - "@types/react": "npm:~17.0.80" + "@types/react": "npm:~17.0.83" eslint: "npm:~8.45.0" eslint-plugin-anti-trojan-source: "npm:~1.1.1" eslint-plugin-react: "npm:~7.37.2" @@ -9439,7 +9439,7 @@ __metadata: "@storybook/react-webpack5": "npm:^8.4.4" "@types/jest": "npm:~29.5.14" "@types/jest-axe": "npm:~3.5.9" - "@types/react": "npm:~17.0.80" + "@types/react": "npm:~17.0.83" eslint: "npm:~8.45.0" eslint-plugin-react: "npm:~7.37.2" eslint-plugin-react-hooks: "npm:~5.0.0" @@ -9493,8 +9493,8 @@ __metadata: "@testing-library/user-event": "npm:~14.5.2" "@types/jest": "npm:~29.5.14" "@types/jest-axe": "npm:~3.5.9" - "@types/react": "npm:~17.0.80" - "@types/react-dom": "npm:~17.0.25" + "@types/react": "npm:~17.0.83" + "@types/react-dom": "npm:~17.0.26" eslint: "npm:~8.45.0" eslint-plugin-react: "npm:~7.37.2" eslint-plugin-react-hooks: "npm:~5.0.0" @@ -9542,9 +9542,9 @@ __metadata: "@rocket.chat/ui-avatar": "workspace:^" "@rocket.chat/ui-contexts": "workspace:~" "@types/lodash": "npm:~4.17.13" - "@types/react": "npm:~17.0.80" + "@types/react": "npm:~17.0.83" "@types/react-beautiful-dnd": "npm:^13.1.8" - "@types/react-dom": "npm:~17.0.25" + "@types/react-dom": "npm:~17.0.26" "@typescript-eslint/eslint-plugin": "npm:~5.60.1" "@typescript-eslint/parser": "npm:~5.60.1" "@vitejs/plugin-react": "npm:^4.3.3" @@ -9590,7 +9590,7 @@ __metadata: "@storybook/theming": "npm:^8.4.4" "@tanstack/react-query": "patch:@tanstack/react-query@npm%3A5.60.5#~/.yarn/patches/@tanstack-react-query-npm-5.60.5-04c500b172.patch" "@testing-library/react": "npm:~16.0.1" - "@types/react": "npm:~17.0.80" + "@types/react": "npm:~17.0.83" babel-loader: "npm:~9.2.1" eslint: "npm:~8.45.0" react: "npm:~17.0.2" @@ -12315,12 +12315,12 @@ __metadata: languageName: node linkType: hard -"@types/react-dom@npm:~17.0.25": - version: 17.0.25 - resolution: "@types/react-dom@npm:17.0.25" - dependencies: - "@types/react": "npm:^17" - checksum: 10/5854802aee0f23436e086b179360e93ac6db3387339f7e9359a786245a36bff5e4c36ff380e9ddb3c7c02d720a3bc9cbb3a3433906ecb4b48482f6e5462d1d22 +"@types/react-dom@npm:~17.0.26": + version: 17.0.26 + resolution: "@types/react-dom@npm:17.0.26" + peerDependencies: + "@types/react": ^17.0.0 + checksum: 10/86be1faf019b58f2b470a037c291c9c9efa5cf8b3927bfec436d83b12dd7a6a0369554c567c4ca8b59e1ee341b835c1b272cd0340628cbbea75ec43168858e5b languageName: node linkType: hard @@ -12336,7 +12336,7 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:^17, @types/react@npm:~17.0.80": +"@types/react@npm:*": version: 17.0.80 resolution: "@types/react@npm:17.0.80" dependencies: @@ -12347,6 +12347,17 @@ __metadata: languageName: node linkType: hard +"@types/react@npm:~17.0.83": + version: 17.0.83 + resolution: "@types/react@npm:17.0.83" + dependencies: + "@types/prop-types": "npm:*" + "@types/scheduler": "npm:^0.16" + csstype: "npm:^3.0.2" + checksum: 10/0abf5c8ccf8ee03e28ff7cd077e7759f4a65c4694a23f6a2b6574e2ea2a3a8e7f6d6a5802e847454091a006d4b4ebc8a485ada74fbfc3cf19c7221171b1538ab + languageName: node + linkType: hard + "@types/readdir-glob@npm:*": version: 1.1.1 resolution: "@types/readdir-glob@npm:1.1.1"