diff --git a/apps/meteor/app/api/server/lib/users.ts b/apps/meteor/app/api/server/lib/users.ts index 38edb4fa5cd4..8fed9e4e2155 100644 --- a/apps/meteor/app/api/server/lib/users.ts +++ b/apps/meteor/app/api/server/lib/users.ts @@ -1,28 +1,24 @@ import { escapeRegExp } from '@rocket.chat/string-helpers'; import type { IUser } from '@rocket.chat/core-typings'; import type { Filter } from 'mongodb'; -import { Users } from '@rocket.chat/models'; +import { Users, Subscriptions } from '@rocket.chat/models'; import type { Mongo } from 'meteor/mongo'; import { hasPermissionAsync } from '../../../authorization/server/functions/hasPermission'; +import { settings } from '../../../settings/server'; type UserAutoComplete = Required>; + export async function findUsersToAutocomplete({ uid, selector, }: { uid: string; - selector: { - exceptions: string[]; - conditions: Filter; - term: string; - }; + selector: { exceptions: Required['username'][]; conditions: Filter; term: string }; }): Promise<{ items: UserAutoComplete[]; }> { - if (!(await hasPermissionAsync(uid, 'view-outside-room'))) { - return { items: [] }; - } + const searchFields = settings.get('Accounts_SearchFields').trim().split(','); const exceptions = selector.exceptions || []; const conditions = selector.conditions || {}; const options = { @@ -39,6 +35,20 @@ export async function findUsersToAutocomplete({ limit: 10, }; + // Search on DMs first, to list known users before others. + const contacts = await Subscriptions.findConnectedUsersExcept(uid, selector.term, exceptions, searchFields, conditions, 10, 'd'); + if (contacts.length >= options.limit) { + return { items: contacts as UserAutoComplete[] }; + } + + options.limit -= contacts.length; + contacts.forEach(({ username }) => exceptions.push(username)); + + if (!(await hasPermissionAsync(uid, 'view-outside-room'))) { + const users = await Subscriptions.findConnectedUsersExcept(uid, selector.term, exceptions, searchFields, conditions, 10); + return { items: contacts.concat(users) as UserAutoComplete[] }; + } + const users = await Users.findActiveByUsernameOrNameRegexWithExceptionsAndConditions( new RegExp(escapeRegExp(selector.term), 'i'), exceptions, @@ -47,7 +57,7 @@ export async function findUsersToAutocomplete({ ).toArray(); return { - items: users, + items: (contacts as UserAutoComplete[]).concat(users), }; } diff --git a/apps/meteor/app/api/server/v1/users.ts b/apps/meteor/app/api/server/v1/users.ts index 858881ae7f76..3ee5698eb842 100644 --- a/apps/meteor/app/api/server/v1/users.ts +++ b/apps/meteor/app/api/server/v1/users.ts @@ -18,6 +18,7 @@ import { Match, check } from 'meteor/check'; import { TAPi18n } from 'meteor/rocketchat:tap-i18n'; import type { IExportOperation, IPersonalAccessToken, IUser } from '@rocket.chat/core-typings'; import { Users as UsersRaw } from '@rocket.chat/models'; +import type { Filter } from 'mongodb'; import { Users, Subscriptions } from '../../../models/server'; import { hasPermission } from '../../../authorization/server'; @@ -815,11 +816,22 @@ API.v1.addRoute( { authRequired: true, validateParams: isUsersAutocompleteProps }, { async get() { - const { selector } = this.queryParams; + const { selector: selectorRaw } = this.queryParams; + + const selector: { exceptions: Required['username'][]; conditions: Filter; term: string } = JSON.parse(selectorRaw); + + try { + if (selector?.conditions && !isValidQuery(selector.conditions, ['*'], ['$or', '$and'])) { + throw new Error('error-invalid-query'); + } + } catch (e) { + return API.v1.failure(e); + } + return API.v1.success( await findUsersToAutocomplete({ uid: this.userId, - selector: JSON.parse(selector), + selector, }), ); }, diff --git a/apps/meteor/app/ui/client/views/app/lib/getCommonRoomEvents.ts b/apps/meteor/app/ui/client/views/app/lib/getCommonRoomEvents.ts index 7c49c0cf8777..00ee5312c7cd 100644 --- a/apps/meteor/app/ui/client/views/app/lib/getCommonRoomEvents.ts +++ b/apps/meteor/app/ui/client/views/app/lib/getCommonRoomEvents.ts @@ -333,7 +333,7 @@ function handleMentionLinkClick(event: JQuery.ClickEvent, template: CommonRoomTe } } -export const getCommonRoomEvents = () => ({ +export const getCommonRoomEvents = (useLegacyMessageTemplate = true) => ({ ...createMessageTouchEvents(), 'click [data-message-action]': handleMessageActionButtonClick, 'click .js-follow-thread': handleFollowThreadButtonClick, @@ -345,5 +345,5 @@ export const getCommonRoomEvents = () => ({ 'click .js-actionButton-respondWithQuotedMessage': handleRespondWithQuotedMessageActionButtonClick, 'click .js-actionButton-sendMessage': handleSendMessageActionButtonClick, 'click .message-actions__menu': handleMessageActionMenuClick, - 'click .mention-link': handleMentionLinkClick, + ...(useLegacyMessageTemplate && { 'click .mention-link': handleMentionLinkClick }), }); diff --git a/apps/meteor/client/components/message/Metrics/Discussion.tsx b/apps/meteor/client/components/message/Metrics/Discussion.tsx index d375030f371c..41b6cbb8e165 100644 --- a/apps/meteor/client/components/message/Metrics/Discussion.tsx +++ b/apps/meteor/client/components/message/Metrics/Discussion.tsx @@ -1,6 +1,6 @@ import { Message } from '@rocket.chat/fuselage'; import { useTranslation } from '@rocket.chat/ui-contexts'; -import React, { FC } from 'react'; +import React, { FC, UIEvent } from 'react'; import { useTimeAgo } from '../../../hooks/useTimeAgo'; import { useBlockRendered } from '../hooks/useBlockRendered'; @@ -8,7 +8,7 @@ import { useBlockRendered } from '../hooks/useBlockRendered'; type DicussionOptions = { drid: string; rid: string; - openDiscussion: () => void; + openDiscussion: (event: UIEvent) => void; count: number; lm?: Date; }; diff --git a/apps/meteor/client/views/blocks/MessageBlock.js b/apps/meteor/client/views/blocks/MessageBlock.js index 965a0d9b3957..1b9c194350ca 100644 --- a/apps/meteor/client/views/blocks/MessageBlock.js +++ b/apps/meteor/client/views/blocks/MessageBlock.js @@ -1,21 +1,12 @@ import { UIKitIncomingInteractionContainerType } from '@rocket.chat/apps-engine/definition/uikit/UIKitIncomingInteractionContainer'; -import { useMutableCallback } from '@rocket.chat/fuselage-hooks'; import { UiKitMessage, UiKitComponent, kitContext, messageParser } from '@rocket.chat/fuselage-ui-kit'; import React from 'react'; import * as ActionManager from '../../../app/ui-message/client/ActionManager'; import { useBlockRendered } from '../../components/message/hooks/useBlockRendered'; -import { - useVideoConfJoinCall, - useVideoConfSetPreferences, - useVideoConfIsCalling, - useVideoConfIsRinging, - useVideoConfDispatchOutgoing, -} from '../../contexts/VideoConfContext'; -import { VideoConfManager } from '../../lib/VideoConfManager'; +import { useVideoConfJoinCall, useVideoConfSetPreferences } from '../../contexts/VideoConfContext'; import { renderMessageBody } from '../../lib/utils/renderMessageBody'; import './textParsers'; -import { useVideoConfWarning } from '../room/contextualBar/VideoConference/useVideoConfWarning'; // TODO: move this to fuselage-ui-kit itself const mrkdwn = ({ text } = {}) => text && ; @@ -25,36 +16,14 @@ function MessageBlock({ mid: _mid, rid, blocks, appId }) { const { ref, className } = useBlockRendered(); const joinCall = useVideoConfJoinCall(); const setPreferences = useVideoConfSetPreferences(); - const isCalling = useVideoConfIsCalling(); - const isRinging = useVideoConfIsRinging(); - const dispatchWarning = useVideoConfWarning(); - const dispatchPopup = useVideoConfDispatchOutgoing(); - - const handleOpenVideoConf = useMutableCallback(async (rid) => { - if (isCalling || isRinging) { - return; - } - - try { - await VideoConfManager.loadCapabilities(); - dispatchPopup({ rid }); - } catch (error) { - dispatchWarning(error.error); - } - }); const context = { action: ({ actionId, value, blockId, mid = _mid, appId }, event) => { - if (appId === 'videoconf-core') { + if (appId === 'videoconf-core' && actionId === 'join') { event.preventDefault(); setPreferences({ mic: true, cam: false }); - if (actionId === 'join') { - return joinCall(blockId); - } - - if (actionId === 'callBack') { - return handleOpenVideoConf(blockId); - } + joinCall(blockId); + return; } ActionManager.triggerBlockAction({ diff --git a/apps/meteor/client/views/omnichannel/queueList/hooks/useQuery.ts b/apps/meteor/client/views/omnichannel/queueList/hooks/useQuery.ts index 76a5fe26dfcb..9d296e31991c 100644 --- a/apps/meteor/client/views/omnichannel/queueList/hooks/useQuery.ts +++ b/apps/meteor/client/views/omnichannel/queueList/hooks/useQuery.ts @@ -25,7 +25,7 @@ export const useQuery: useQueryType = ({ servedBy, status, departmentId, itemsPe useMemo(() => { const query: { agentId?: string; - includeOflineAgents?: 'true' | 'false'; + includeOfflineAgents?: 'true' | 'false'; departmentId?: string; sort: string; count: number; @@ -39,7 +39,7 @@ export const useQuery: useQueryType = ({ servedBy, status, departmentId, itemsPe }; if (status !== 'online') { - query.includeOflineAgents = 'true'; + query.includeOfflineAgents = 'true'; } if (servedBy) { query.agentId = servedBy; diff --git a/apps/meteor/client/views/room/MessageList/components/MessageContentBody.tsx b/apps/meteor/client/views/room/MessageList/components/MessageContentBody.tsx index 6a30b8f8fa3c..2e666792f352 100644 --- a/apps/meteor/client/views/room/MessageList/components/MessageContentBody.tsx +++ b/apps/meteor/client/views/room/MessageList/components/MessageContentBody.tsx @@ -3,9 +3,12 @@ import { Box, MessageBody } from '@rocket.chat/fuselage'; import colors from '@rocket.chat/fuselage-tokens/colors'; import { MarkupInteractionContext, Markup, UserMention, ChannelMention } from '@rocket.chat/gazzodown'; import { escapeRegExp } from '@rocket.chat/string-helpers'; -import React, { ReactElement, useCallback, useMemo } from 'react'; +import { useLayout } from '@rocket.chat/ui-contexts'; +import { FlowRouter } from 'meteor/kadira:flow-router'; +import React, { ReactElement, UIEvent, useCallback, useMemo } from 'react'; import { emoji } from '../../../../../app/emoji/client'; +import { fireGlobalEvent } from '../../../../lib/utils/fireGlobalEvent'; import { useMessageActions } from '../../contexts/MessageContext'; import { useMessageListHighlights } from '../contexts/MessageListContext'; import { MessageWithMdEnforced } from '../lib/parseMessageTextToAstMarkdown'; @@ -61,14 +64,33 @@ const MessageContentBody = ({ mentions, channels, md }: MessageContentBodyProps) return; } - return openUserCard(username); + return (event: UIEvent): void => { + event.stopPropagation(); + openUserCard(username)(event); + }; }, [openUserCard], ); const resolveChannelMention = useCallback((mention: string) => channels?.find(({ name }) => name === mention), [channels]); - const onChannelMentionClick = useCallback(({ _id: rid }: ChannelMention) => openRoom(rid), [openRoom]); + const { isEmbedded } = useLayout(); + + const onChannelMentionClick = useCallback( + ({ _id: rid }: ChannelMention) => + (event: UIEvent): void => { + if (isEmbedded) { + fireGlobalEvent('click-mention-link', { + path: FlowRouter.path('channel', { name: rid }), + channel: rid, + }); + } + + event.stopPropagation(); + openRoom(rid)(event); + }, + [isEmbedded, openRoom], + ); // TODO: this style should go to Fuselage repository const messageBodyAdditionalStyles = css` diff --git a/apps/meteor/client/views/room/components/body/RoomBody.tsx b/apps/meteor/client/views/room/components/body/RoomBody.tsx index d8c4f7c1d2aa..7ce0d4fa656a 100644 --- a/apps/meteor/client/views/room/components/body/RoomBody.tsx +++ b/apps/meteor/client/views/room/components/body/RoomBody.tsx @@ -63,7 +63,7 @@ const RoomBody = (): ReactElement => { const hideFlexTab = useUserPreference('hideFlexTab'); const hideUsernames = useUserPreference('hideUsernames'); const displayAvatars = useUserPreference('displayAvatars'); - const useLegacyMessageTemplate = useUserPreference('useLegacyMessageTemplate'); + const useLegacyMessageTemplate = useUserPreference('useLegacyMessageTemplate') ?? false; const viewMode = useUserPreference('messageViewMode'); const wrapperRef = useRef(null); @@ -329,7 +329,7 @@ const RoomBody = (): ReactElement => { } const messageEvents: Record void> = { - ...getCommonRoomEvents(), + ...getCommonRoomEvents(useLegacyMessageTemplate), 'click .toggle-hidden'(event: JQuery.ClickEvent) { const mid = event.target.dataset.message; if (mid) document.getElementById(mid)?.classList.toggle('message--ignored'); @@ -361,7 +361,7 @@ const RoomBody = (): ReactElement => { $(messageList).off(event, selector, listener); } }; - }, [room._id, sendToBottomIfNecessary, toolbox]); + }, [room._id, sendToBottomIfNecessary, toolbox, useLegacyMessageTemplate]); useEffect(() => { const wrapper = wrapperRef.current; diff --git a/apps/meteor/client/views/room/components/body/composer/ComposerOmnichannel/ComposerOmnichannelOnHold.tsx b/apps/meteor/client/views/room/components/body/composer/ComposerOmnichannel/ComposerOmnichannelOnHold.tsx index a0fde3c58745..f8c749979033 100644 --- a/apps/meteor/client/views/room/components/body/composer/ComposerOmnichannel/ComposerOmnichannelOnHold.tsx +++ b/apps/meteor/client/views/room/components/body/composer/ComposerOmnichannel/ComposerOmnichannelOnHold.tsx @@ -12,7 +12,9 @@ export const ComposerOmnichannelOnHold = (): ReactElement => {
{t('chat_on_hold_due_to_inactivity')} - => resume(room._id)}>{t('Resume')} + => resume(room._id, { clientAction: true })}> + {t('Resume')} +
); diff --git a/apps/meteor/client/views/room/contexts/MessageContext.ts b/apps/meteor/client/views/room/contexts/MessageContext.ts index b5edcced81ca..3a31fae2094a 100644 --- a/apps/meteor/client/views/room/contexts/MessageContext.ts +++ b/apps/meteor/client/views/room/contexts/MessageContext.ts @@ -22,7 +22,7 @@ export type MessageContextValue = { oembedEnabled: boolean; actions: { openUserCard: (username: string) => (e: UIEvent) => void; - openRoom: (id: string) => () => void; + openRoom: (id: string) => (event: UIEvent) => void; openThread: (tmid: string, jump?: string) => (e: MouseEvent) => void; runActionLink: (message: IMessage) => (action: string) => () => void; replyBroadcast: (message: IMessage) => void; diff --git a/apps/meteor/package.json b/apps/meteor/package.json index cd26881d8dcf..0d50c3493ab3 100644 --- a/apps/meteor/package.json +++ b/apps/meteor/package.json @@ -60,11 +60,11 @@ "email": "support@rocket.chat" }, "devDependencies": { - "@babel/core": "^7.18.13", + "@babel/core": "^7.18.9", "@babel/eslint-parser": "^7.18.9", "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", "@babel/plugin-proposal-optional-chaining": "^7.18.9", - "@babel/preset-env": "^7.18.10", + "@babel/preset-env": "^7.18.9", "@babel/preset-react": "^7.18.6", "@babel/register": "^7.18.9", "@faker-js/faker": "^6.3.1", @@ -126,7 +126,7 @@ "@types/prometheus-gc-stats": "^0.6.2", "@types/proxyquire": "^1.3.28", "@types/psl": "^1.1.0", - "@types/react": "~17.0.48", + "@types/react": "~17.0.47", "@types/react-dom": "~17.0.17", "@types/rewire": "^2.5.28", "@types/semver": "^7.3.10", @@ -154,7 +154,7 @@ "chai-spies": "^1.0.0", "cross-env": "^7.0.3", "emojione-assets": "^4.5.0", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-prettier": "^4.2.1", @@ -212,7 +212,7 @@ "@rocket.chat/fuselage-polyfills": "next", "@rocket.chat/fuselage-toastbar": "next", "@rocket.chat/fuselage-tokens": "next", - "@rocket.chat/fuselage-ui-kit": "workspace:^", + "@rocket.chat/fuselage-ui-kit": "next", "@rocket.chat/gazzodown": "workspace:^", "@rocket.chat/icons": "next", "@rocket.chat/layout": "next", diff --git a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json index fd1c2a8de6e3..965b5b33848e 100644 --- a/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json +++ b/apps/meteor/packages/rocketchat-i18n/i18n/en.i18n.json @@ -766,7 +766,6 @@ "By_author": "By __author__", "cache_cleared": "Cache cleared", "Call": "Call", - "Call_back": "Call back", "Calling": "Calling", "Call_Center": "Voice Channel", "Call_Center_Description": "Configure Rocket.Chat's voice channels", @@ -783,9 +782,7 @@ "Call_number_enterprise_only": "Call number (Enterprise Edition only)", "call-management": "Call Management", "call-management_description": "Permission to start a meeting", - "Call_ongoing": "Call ongoing", "Call_unavailable_for_federation": "Call is unavailable for Federated rooms", - "Call_was_not_answered": "Call was not answered", "Caller": "Caller", "Caller_Id": "Caller ID", "Cam_on": "Cam On", @@ -5239,7 +5236,6 @@ "VoIP_Toggle": "Enable/Disable VoIP", "Chat_opened_by_visitor": "Chat opened by the visitor", "Wait_activation_warning": "Before you can login, your account must be manually activated by an administrator.", - "Waiting_for_answer": "Waiting for answer", "Waiting_queue": "Waiting queue", "Waiting_queue_message": "Waiting queue message", "Waiting_queue_message_description": "Message that will be displayed to the visitors when they get in the queue", diff --git a/apps/meteor/server/lib/spotlight.js b/apps/meteor/server/lib/spotlight.js index 125feab8b422..ea645cba673b 100644 --- a/apps/meteor/server/lib/spotlight.js +++ b/apps/meteor/server/lib/spotlight.js @@ -102,7 +102,7 @@ export class Spotlight { users.push( ...Promise.await( - SubscriptionsRaw.findConnectedUsersExcept(userId, text, usernames, searchFields, options.limit || 5, roomType, match), + SubscriptionsRaw.findConnectedUsersExcept(userId, text, usernames, searchFields, {}, options.limit || 5, roomType, match), { readPreference: options.readPreference, }, diff --git a/apps/meteor/server/models/raw/Subscriptions.ts b/apps/meteor/server/models/raw/Subscriptions.ts index 82ac9dd6adcf..8eaf599754eb 100644 --- a/apps/meteor/server/models/raw/Subscriptions.ts +++ b/apps/meteor/server/models/raw/Subscriptions.ts @@ -256,6 +256,7 @@ export class SubscriptionsRaw extends BaseRaw implements ISubscri searchTerm: string, exceptions: string[], searchFields: string[], + extraConditions: Filter, limit: number, roomType?: ISubscription['t'], { startsWith = false, endsWith = false }: { startsWith?: string | false; endsWith?: string | false } = {}, @@ -319,6 +320,7 @@ export class SubscriptionsRaw extends BaseRaw implements ISubscri { $match: { $expr: { $eq: ['$_id', '$$id'] }, + ...extraConditions, active: true, username: { $exists: true, diff --git a/apps/meteor/server/models/raw/VideoConference.ts b/apps/meteor/server/models/raw/VideoConference.ts index 4185ed2da507..96d6cc7f3111 100644 --- a/apps/meteor/server/models/raw/VideoConference.ts +++ b/apps/meteor/server/models/raw/VideoConference.ts @@ -189,10 +189,7 @@ export class VideoConferenceRaw extends BaseRaw implements IVid }); } - public async addUserById( - callId: string, - user: Required> & { ts?: Date }, - ): Promise { + public async addUserById(callId: string, user: Pick & { ts?: Date }): Promise { await this.updateOneById(callId, { $addToSet: { users: { diff --git a/apps/meteor/server/modules/listeners/listeners.module.ts b/apps/meteor/server/modules/listeners/listeners.module.ts index 0f546ac8d506..75ca7aa7a587 100644 --- a/apps/meteor/server/modules/listeners/listeners.module.ts +++ b/apps/meteor/server/modules/listeners/listeners.module.ts @@ -130,12 +130,6 @@ export class ListenersModule { notifications.streamRoomMessage.emitWithoutBroadcast(message.rid, message); }); - service.onEvent('message.update', ({ message }) => { - if (message.rid) { - notifications.streamRoomMessage.emitWithoutBroadcast(message.rid, message); - } - }); - service.onEvent('watch.subscriptions', ({ clientAction, subscription }) => { if (!subscription.u?._id) { return; diff --git a/apps/meteor/server/sdk/lib/Events.ts b/apps/meteor/server/sdk/lib/Events.ts index 07872ed14fe5..6b4336d6d70c 100644 --- a/apps/meteor/server/sdk/lib/Events.ts +++ b/apps/meteor/server/sdk/lib/Events.ts @@ -22,7 +22,6 @@ import type { IWebdavAccount, ICustomSound, VoipEventDataSignature, - AtLeast, UserStatus, } from '@rocket.chat/core-typings'; @@ -137,5 +136,4 @@ export type EventSignatures = { 'call.callerhangup'(userId: string, data: { roomId: string }): void; 'watch.pbxevents'(data: { clientAction: ClientAction; data: Partial; id: string }): void; 'connector.statuschanged'(enabled: boolean): void; - 'message.update'(data: { message: AtLeast }): void; }; diff --git a/apps/meteor/server/services/omnichannel-voip/service.ts b/apps/meteor/server/services/omnichannel-voip/service.ts index 66e6705a6f8f..19de573d24a0 100644 --- a/apps/meteor/server/services/omnichannel-voip/service.ts +++ b/apps/meteor/server/services/omnichannel-voip/service.ts @@ -115,9 +115,16 @@ export class OmnichannelVoipService extends ServiceClassInternal implements IOmn */ // Use latest queue caller join event + const numericPhone = guest?.phone?.[0]?.phoneNumber.replace(/\D/g, ''); const callStartPbxEvent = await PbxEvents.findOne( { - phone: guest?.phone?.[0]?.phoneNumber, + $or: [ + { + phone: numericPhone, // Incoming calls will have phone number (connectedlinenum) without any symbol + }, + { phone: `*${numericPhone}` }, // Outgoing calls will have phone number (connectedlinenum) with * prefix + { phone: `+${numericPhone}` }, // Just in case + ], event: { $in: ['QueueCallerJoin', 'DialEnd', 'DialState'], }, diff --git a/apps/meteor/server/services/video-conference/service.ts b/apps/meteor/server/services/video-conference/service.ts index c11b775b288b..0808e685ba51 100644 --- a/apps/meteor/server/services/video-conference/service.ts +++ b/apps/meteor/server/services/video-conference/service.ts @@ -23,7 +23,7 @@ import { isGroupVideoConference, isLivechatVideoConference, } from '@rocket.chat/core-typings'; -import type { MessageSurfaceLayout } from '@rocket.chat/ui-kit'; +import type { MessageSurfaceLayout, ContextBlock } from '@rocket.chat/ui-kit'; import type { AppVideoConfProviderManager } from '@rocket.chat/apps-engine/server/managers'; import { TAPi18n } from 'meteor/rocketchat:tap-i18n'; import type { PaginatedResult } from '@rocket.chat/rest-typings'; @@ -34,6 +34,7 @@ import { ServiceClassInternal } from '../../sdk/types/ServiceClass'; import { Apps } from '../../../app/apps/server'; import { sendMessage } from '../../../app/lib/server/functions/sendMessage'; import { settings } from '../../../app/settings/server'; +import { getURL } from '../../../app/utils/server'; import { videoConfProviders } from '../../lib/videoConfProviders'; import { videoConfTypes } from '../../lib/videoConfTypes'; import { updateCounter } from '../../../app/statistics/server/functions/updateStatsCounter'; @@ -146,7 +147,10 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf } if (call.messages.started) { - this.updateVideoConfMessage(call.messages.started); + const name = + (settings.get('UI_Use_Real_Name') ? call.createdBy.name : call.createdBy.username) || call.createdBy.username || ''; + const text = TAPi18n.__('video_direct_missed', { username: name }); + await Messages.setBlocksById(call.messages.started, [this.buildMessageBlock(text)]); } await VideoConferenceModel.setDataById(callId, { @@ -233,8 +237,8 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf throw new Error('Invalid User'); } - const user = await Users.findOneById>>(userId, { - projection: { username: 1, name: 1, avatarETag: 1 }, + const user = await Users.findOneById>>(userId, { + projection: { username: 1, name: 1 }, }); if (!user) { throw new Error('Invalid User'); @@ -244,7 +248,6 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf _id: user._id, username: user.username, name: user.name, - avatarETag: user.avatarETag, ts: ts || new Date(), }); } @@ -369,13 +372,6 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf return true; } - private async updateVideoConfMessage(messageId: IMessage['_id']): Promise { - const message = await Messages.findOneById(messageId); - if (message) { - api.broadcast('message.update', { message }); - } - } - private async endCall(callId: VideoConference['_id']): Promise { const call = await this.getUnfiltered(callId); if (!call) { @@ -384,11 +380,12 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf await VideoConferenceModel.setDataById(call._id, { endedAt: new Date(), status: VideoConferenceStatus.ENDED }); if (call.messages?.started) { - this.updateVideoConfMessage(call.messages.started); + await this.removeJoinButton(call.messages.started); } - if (call.type === 'direct') { - return this.endDirectCall(call); + switch (call.type) { + case 'direct': + return this.endDirectCall(call); } } @@ -399,6 +396,16 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf } await VideoConferenceModel.setDataById(call._id, { endedAt: new Date(), status: VideoConferenceStatus.EXPIRED }); + if (call.messages?.started) { + return this.removeJoinButton(call.messages.started); + } + } + + private async removeJoinButton(messageId: IMessage['_id']): Promise { + await Messages.removeVideoConfJoinButton(messageId); + + const text = TAPi18n.__('Conference_call_has_ended'); + await Messages.addBlocksById(messageId, [this.buildMessageBlock(text)]); } private async endDirectCall(call: IDirectVideoConference): Promise { @@ -436,21 +443,66 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf return videoConfTypes.getTypeForRoom(room, allowRinging); } - private async createMessage(call: VideoConference, createdBy?: IUser, customBlocks?: IMessage['blocks']): Promise { + private async createMessage( + rid: IRoom['_id'], + providerName: string, + extraData: Partial = {}, + createdBy?: IUser, + ): Promise { const record = { msg: '', groupable: false, - blocks: customBlocks || [this.buildVideoConfBlock(call._id)], + ...extraData, }; - const room = await Rooms.findOneById(call.rid); - const appId = videoConfProviders.getProviderAppId(call.providerName); + const room = await Rooms.findOneById(rid); + const appId = videoConfProviders.getProviderAppId(providerName); const user = createdBy || (appId && (await Users.findOneByAppId(appId))) || (await Users.findOneById('rocket.cat')); const message = sendMessage(user, record, room, false); return message._id; } + private async createDirectCallMessage(call: IDirectVideoConference, user: IUser): Promise { + const username = (settings.get('UI_Use_Real_Name') ? user.name : user.username) || user.username || ''; + const text = TAPi18n.__('video_direct_calling', { + username, + }); + + return this.createMessage( + call.rid, + call.providerName, + { + blocks: [this.buildMessageBlock(text), this.buildJoinButtonBlock(call._id)], + }, + user, + ); + } + + private async createGroupCallMessage(call: IGroupVideoConference, user: IUser, useAppUser = true): Promise { + const username = (settings.get('UI_Use_Real_Name') ? user.name : user.username) || user.username || ''; + const text = TAPi18n.__(useAppUser ? 'video_conference_started_by' : 'video_conference_started', { + conference: call.title || '', + username, + }); + + return this.createMessage( + call.rid, + call.providerName, + { + blocks: [ + this.buildMessageBlock(text), + this.buildJoinButtonBlock(call._id, call.title), + { + type: 'context', + elements: [], + }, + ], + } as Partial, + useAppUser ? undefined : user, + ); + } + private async validateProvider(providerName: string): Promise { const manager = await this.getProviderManager(); const configured = await manager.isFullyConfigured(providerName).catch(() => false); @@ -493,37 +545,35 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf username, }); - return this.createMessage(call, user, [ - this.buildMessageBlock(text), + return this.createMessage( + call.rid, + call.providerName, { - type: 'actions', - appId: 'videoconf-core', - blockId: call._id, - elements: [ + blocks: [ + this.buildMessageBlock(text), { + type: 'actions', appId: 'videoconf-core', blockId: call._id, - actionId: 'joinLivechat', - type: 'button', - text: { - type: 'plain_text', - text: TAPi18n.__('Join_call'), - emoji: true, - }, - url, + elements: [ + { + appId: 'videoconf-core', + blockId: call._id, + actionId: 'joinLivechat', + type: 'button', + text: { + type: 'plain_text', + text: TAPi18n.__('Join_call'), + emoji: true, + }, + url, + }, + ], }, ], }, - ]); - } - - private buildVideoConfBlock(callId: string): MessageSurfaceLayout[number] { - return { - type: 'video_conf', - blockId: callId, - callId, - appId: 'videoconf-core', - }; + user, + ); } private buildMessageBlock(text: string): MessageSurfaceLayout[number] { @@ -537,6 +587,27 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf }; } + private buildJoinButtonBlock(callId: string, title = ''): MessageSurfaceLayout[number] { + return { + type: 'actions', + appId: 'videoconf-core', + elements: [ + { + appId: 'videoconf-core', + blockId: callId, + actionId: 'join', + value: title, + type: 'button', + text: { + type: 'plain_text', + text: TAPi18n.__('Join_call'), + emoji: true, + }, + }, + ], + }; + } + private async startDirect( providerName: string, user: IUser, @@ -567,8 +638,7 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf const url = await this.generateNewUrl(call); VideoConferenceModel.setUrlById(callId, url); - const messageId = await this.createMessage(call, user); - + const messageId = await this.createDirectCallMessage(call, user); VideoConferenceModel.setMessageById(callId, 'started', messageId); // After 40 seconds if the status is still "calling", we cancel the call automatically. @@ -630,7 +700,7 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf call.url = url; - const messageId = await this.createMessage(call, useAppUser ? undefined : user); + const messageId = await this.createGroupCallMessage(call, user, useAppUser); VideoConferenceModel.setMessageById(callId, 'started', messageId); if (call.ringing) { @@ -662,7 +732,6 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf const joinUrl = await this.getUrl(call); const messageId = await this.createLivechatMessage(call, user, joinUrl); - await VideoConferenceModel.setMessageById(callId, 'started', messageId); return { @@ -800,7 +869,7 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf private async addUserToCall( call: Optional, - { _id, username, name, avatarETag, ts }: AtLeast, '_id' | 'username' | 'name' | 'avatarETag'> & { ts?: Date }, + { _id, username, name, avatarETag, ts }: AtLeast & { ts?: Date }, ): Promise { if (call.users.find((user) => user._id === _id)) { return; @@ -808,13 +877,64 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf await VideoConferenceModel.addUserById(call._id, { _id, username, name, avatarETag, ts }); - if (call.type === 'direct') { - return this.updateDirectCall(call as IDirectVideoConference, _id); + switch (call.type) { + case 'videoconference': + return this.updateGroupCallMessage(call as IGroupVideoConference, { _id, username, name }); + case 'direct': + return this.updateDirectCall(call as IDirectVideoConference, _id); } } private async addAnonymousUser(call: Optional): Promise { await VideoConferenceModel.increaseAnonymousCount(call._id); + + if (!call.messages.started) { + return; + } + + const imageUrl = getURL(`/avatar/@a`, { cdn: false, full: true }); + return this.addAvatarToCallMessage(call.messages.started, imageUrl, TAPi18n.__('Anonymous')); + } + + private async addAvatarToCallMessage(messageId: IMessage['_id'], imageUrl: string, altText: string): Promise { + const message = await Messages.findOneById>(messageId, { projection: { blocks: 1 } }); + if (!message) { + return; + } + + const blocks = message.blocks || []; + + const avatarsBlock = (blocks.find((block) => block.type === 'context') || { type: 'context', elements: [] }) as ContextBlock; + if (!blocks.includes(avatarsBlock)) { + blocks.push(avatarsBlock); + } + + if (avatarsBlock.elements.find((el) => el.type === 'image' && el.imageUrl === imageUrl)) { + return; + } + + avatarsBlock.elements = [ + ...avatarsBlock.elements, + { + type: 'image', + imageUrl, + altText, + }, + ]; + + await Messages.setBlocksById(message._id, blocks); + } + + private async updateGroupCallMessage( + call: Optional, + user: Pick, + ): Promise { + if (!call.messages.started || !user.username) { + return; + } + const imageUrl = getURL(`/avatar/${user.username}`, { cdn: false, full: true }); + + return this.addAvatarToCallMessage(call.messages.started, imageUrl, user.name || user.username); } private async updateDirectCall(call: IDirectVideoConference, newUserId: IUser['_id']): Promise { @@ -835,7 +955,10 @@ export class VideoConfService extends ServiceClassInternal implements IVideoConf await VideoConferenceModel.setStatusById(call._id, VideoConferenceStatus.STARTED); if (call.messages.started) { - this.updateVideoConfMessage(call.messages.started); + const username = + (settings.get('UI_Use_Real_Name') ? call.createdBy.name : call.createdBy.username) || call.createdBy.username || ''; + const text = TAPi18n.__('video_direct_started', { username }); + await Messages.setBlocksById(call.messages.started, [this.buildMessageBlock(text), this.buildJoinButtonBlock(call._id)]); } } } diff --git a/apps/meteor/server/services/voip/connector/asterisk/ami/ContinuousMonitor.ts b/apps/meteor/server/services/voip/connector/asterisk/ami/ContinuousMonitor.ts index 91345e0935dd..2aef44cd957a 100644 --- a/apps/meteor/server/services/voip/connector/asterisk/ami/ContinuousMonitor.ts +++ b/apps/meteor/server/services/voip/connector/asterisk/ami/ContinuousMonitor.ts @@ -268,7 +268,7 @@ export class ContinuousMonitor extends Command { return; } - if (event.dialstatus.toLowerCase() !== 'answer' && event.dialstatus.toLowerCase() !== 'ringing') { + if (!['answer', 'ringing'].includes(event.dialstatus.toLowerCase())) { this.logger.warn(`Received unexpected event ${event.event} dialstatus = ${event.dialstatus}`); return; } @@ -283,7 +283,7 @@ export class ContinuousMonitor extends Command { uniqueId: `${event.event}-${event.calleridnum}-${event.channel}-${event.destchannel}-${event.uniqueid}`, event: event.event, ts: new Date(), - phone: event?.connectedlinenum, + phone: event?.connectedlinenum.replace(/\D/g, ''), // Remove all non-numeric characters callUniqueId: event.uniqueid, callUniqueIdFallback: event.linkedid, agentExtension: event.calleridnum, diff --git a/apps/meteor/tests/end-to-end/api/01-users.js b/apps/meteor/tests/end-to-end/api/01-users.js index ec49e2bf7bc2..0a3360214db4 100644 --- a/apps/meteor/tests/end-to-end/api/01-users.js +++ b/apps/meteor/tests/end-to-end/api/01-users.js @@ -28,7 +28,7 @@ function createTestUser() { request .post(api('users.create')) .set(credentials) - .send({ email, name: username, username, password }) + .send({ email, name: username, username, password, joinDefaultChannels: false }) .end((err, res) => resolve(res.body.user)); }); } @@ -65,6 +65,20 @@ function deleteTestUser(user) { }); } +async function createChannel(userCredentials, name) { + const res = await request.post(api('channels.create')).set(userCredentials).send({ + name, + }); + + return res.body.channel._id; +} + +async function joinChannel(userCredentials, roomId) { + return request.post(api('channels.join')).set(userCredentials).send({ + roomId, + }); +} + describe('[Users]', function () { this.retries(0); @@ -3092,11 +3106,35 @@ describe('[Users]', function () { }); describe('[/users.autocomplete]', () => { - it('should return an empty list when the user does not have the necessary permission', (done) => { - updatePermission('view-outside-room', []).then(() => { + after(() => { + updatePermission('view-outside-room', ['admin', 'owner', 'moderator', 'user']); + }); + + describe('[without permission]', () => { + let user; + let userCredentials; + let user2; + let user2Credentials; + let roomId; + + this.timeout(20000); + + before(async () => { + user = await createTestUser(); + user2 = await createTestUser(); + + userCredentials = await loginTestUser(user); + user2Credentials = await loginTestUser(user2); + + await updatePermission('view-outside-room', []); + + roomId = await createChannel(userCredentials, `channel.autocomplete.${Date.now()}`); + }); + + it('should return an empty list when the user does not have any subscription', (done) => { request .get(api('users.autocomplete?selector={}')) - .set(credentials) + .set(userCredentials) .expect('Content-Type', 'application/json') .expect(200) .expect((res) => { @@ -3105,33 +3143,108 @@ describe('[Users]', function () { }) .end(done); }); + + it('should return users that are subscribed to the same rooms as the requester', async () => { + await joinChannel(user2Credentials, roomId); + + request + .get(api('users.autocomplete?selector={}')) + .set(userCredentials) + .expect('Content-Type', 'application/json') + .expect(200) + .expect((res) => { + expect(res.body).to.have.property('success', true); + expect(res.body).to.have.property('items').and.to.be.an('array').with.lengthOf(1); + }); + }); }); - it('should return an error when the required parameter "selector" is not provided', (done) => { - updatePermission('view-outside-room', ['admin', 'user']).then(() => { + + describe('[with permission]', () => { + before(() => { + updatePermission('view-outside-room', ['admin', 'user']); + }); + + it('should return an error when the required parameter "selector" is not provided', () => { request .get(api('users.autocomplete')) .set(credentials) .query({}) .expect('Content-Type', 'application/json') .expect(400) + .expect((res) => { + expect(res.body).to.have.property('success', false); + }); + }); + it('should return the users to fill auto complete', (done) => { + request + .get(api('users.autocomplete?selector={}')) + .set(credentials) + .expect('Content-Type', 'application/json') + .expect(200) + .expect((res) => { + expect(res.body).to.have.property('success', true); + expect(res.body).to.have.property('items').and.to.be.an('array'); + }) + .end(done); + }); + + it('should filter results when using allowed operators', (done) => { + request + .get(api('users.autocomplete')) + .set(credentials) + .query({ + selector: JSON.stringify({ + conditions: { + $and: [ + { + active: false, + }, + { + status: 'online', + }, + ], + }, + }), + }) + .expect('Content-Type', 'application/json') + .expect(200) + .expect((res) => { + expect(res.body).to.have.property('success', true); + expect(res.body).to.have.property('items').and.to.be.an('array').with.lengthOf(0); + }) + .end(done); + }); + + it('should return an error when using forbidden operators', (done) => { + request + .get(api('users.autocomplete')) + .set(credentials) + .query({ + selector: JSON.stringify({ + conditions: { + $nor: [ + { + username: { + $exists: false, + }, + }, + { + status: { + $exists: false, + }, + }, + ], + }, + }), + }) + .expect('Content-Type', 'application/json') + .expect(400) .expect((res) => { expect(res.body).to.have.property('success', false); }) .end(done); }); }); - it('should return the users to fill auto complete', (done) => { - request - .get(api('users.autocomplete?selector={}')) - .set(credentials) - .expect('Content-Type', 'application/json') - .expect(200) - .expect((res) => { - expect(res.body).to.have.property('success', true); - expect(res.body).to.have.property('items').and.to.be.an('array'); - }) - .end(done); - }); }); describe('[/users.getStatus]', () => { diff --git a/ee/apps/ddp-streamer/package.json b/ee/apps/ddp-streamer/package.json index 5f429eed551c..2cdb260f523d 100644 --- a/ee/apps/ddp-streamer/package.json +++ b/ee/apps/ddp-streamer/package.json @@ -47,7 +47,7 @@ "@types/sharp": "^0.30.4", "@types/uuid": "^8.3.4", "@types/ws": "^8.5.3", - "eslint": "^8.22.0", + "eslint": "^8.21.0", "pino-pretty": "^7.6.1", "ts-node": "^10.9.1", "typescript": "~4.5.5" diff --git a/packages/agenda/package.json b/packages/agenda/package.json index e2a0613c8048..5ca16adef570 100644 --- a/packages/agenda/package.json +++ b/packages/agenda/package.json @@ -14,7 +14,7 @@ "devDependencies": { "@types/debug": "^4", "@types/jest": "^27.4.1", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "jest": "^27.5.1", "ts-jest": "^27.1.4", "typescript": "~4.5.5" diff --git a/packages/api-client/package.json b/packages/api-client/package.json index f9c9b1466a5d..98f63afd69ab 100644 --- a/packages/api-client/package.json +++ b/packages/api-client/package.json @@ -5,7 +5,7 @@ "devDependencies": { "@types/jest": "^27.4.1", "@types/strict-uri-encode": "^2.0.0", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "jest": "^27.5.1", "ts-jest": "^27.1.5", "typescript": "~4.5.5" diff --git a/packages/cas-validate/package.json b/packages/cas-validate/package.json index 22cc27646cd7..c8f23b455c7a 100644 --- a/packages/cas-validate/package.json +++ b/packages/cas-validate/package.json @@ -5,7 +5,7 @@ "private": true, "devDependencies": { "@types/jest": "^27.4.1", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "jest": "^27.5.1", "ts-jest": "^27.1.4", "typescript": "~4.5.5" diff --git a/packages/core-typings/package.json b/packages/core-typings/package.json index 27ae9d5549cf..7faf5cf4e293 100644 --- a/packages/core-typings/package.json +++ b/packages/core-typings/package.json @@ -4,7 +4,7 @@ "private": true, "devDependencies": { "@rocket.chat/eslint-config": "workspace:^", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "mongodb": "^4.3.1", "prettier": "^2.7.1", "typescript": "~4.5.5" diff --git a/packages/core-typings/src/IVideoConference.ts b/packages/core-typings/src/IVideoConference.ts index ce6297c00cdf..a4c0b5713471 100644 --- a/packages/core-typings/src/IVideoConference.ts +++ b/packages/core-typings/src/IVideoConference.ts @@ -31,7 +31,7 @@ export type LivechatInstructions = { export type VideoConferenceType = DirectCallInstructions['type'] | ConferenceInstructions['type'] | LivechatInstructions['type']; -export interface IVideoConferenceUser extends Pick, '_id' | 'username' | 'name' | 'avatarETag'> { +export interface IVideoConferenceUser extends Pick { ts: Date; } diff --git a/packages/eslint-config/package.json b/packages/eslint-config/package.json index 2e028655e6a1..cc850fdaa0b5 100644 --- a/packages/eslint-config/package.json +++ b/packages/eslint-config/package.json @@ -7,7 +7,7 @@ "@types/prettier": "^2.6.3", "@typescript-eslint/eslint-plugin": "^5.30.7", "@typescript-eslint/parser": "^5.30.7", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "eslint-config-prettier": "^8.5.0", "eslint-plugin-anti-trojan-source": "^1.1.0", "eslint-plugin-import": "^2.26.0", diff --git a/packages/favicon/package.json b/packages/favicon/package.json index a50c9aca6d8b..7dba2d92dad3 100644 --- a/packages/favicon/package.json +++ b/packages/favicon/package.json @@ -3,7 +3,7 @@ "version": "0.0.1", "private": true, "devDependencies": { - "eslint": "^8.22.0", + "eslint": "^8.20.0", "typescript": "~4.5.5" }, "scripts": { diff --git a/packages/fuselage-ui-kit/package.json b/packages/fuselage-ui-kit/package.json index d11639351bf6..b89ffc23b272 100644 --- a/packages/fuselage-ui-kit/package.json +++ b/packages/fuselage-ui-kit/package.json @@ -38,20 +38,13 @@ "bump-next": "bump-next" }, "peerDependencies": { - "@rocket.chat/apps-engine": "*", - "@rocket.chat/eslint-config": "*", "@rocket.chat/fuselage": "*", "@rocket.chat/fuselage-hooks": "*", "@rocket.chat/fuselage-polyfills": "*", "@rocket.chat/icons": "*", - "@rocket.chat/prettier-config": "*", "@rocket.chat/styled": "*", - "@rocket.chat/ui-contexts": "*", - "@rocket.chat/ui-kit": "*", - "@rocket.chat/ui-video-conf": "*", - "@tanstack/react-query": "*", - "react": "*", - "react-dom": "*" + "react": "^17.0.2", + "react-dom": "^17.0.2" }, "devDependencies": { "@rocket.chat/apps-engine": "~1.30.0", @@ -62,9 +55,6 @@ "@rocket.chat/icons": "next", "@rocket.chat/prettier-config": "next", "@rocket.chat/styled": "next", - "@rocket.chat/ui-contexts": "workspace:^", - "@rocket.chat/ui-kit": "next", - "@rocket.chat/ui-video-conf": "workspace:^", "@storybook/addon-essentials": "~6.5.10", "@storybook/addons": "~6.5.10", "@storybook/builder-webpack5": "~6.5.10", @@ -72,20 +62,23 @@ "@storybook/react": "~6.5.10", "@storybook/source-loader": "~6.5.10", "@storybook/theming": "~6.5.10", - "@tanstack/react-query": "^4.2.1", - "@types/react": "~17.0.48", - "@types/react-dom": "~17.0.17", + "@types/react": "~17.0.39", + "@types/react-dom": "^17.0.11", "babel-loader": "~8.2.3", "cross-env": "^7.0.3", - "eslint": "~8.22.0", + "eslint": "~8.8.0", "lint-staged": "~12.3.3", "normalize.css": "^8.0.1", "npm-run-all": "^4.1.5", "prettier": "~2.5.1", + "react": "^17.0.2", "react-dom": "^17.0.2", "rimraf": "^3.0.2", - "tslib": "^2.3.1", "typescript": "~4.3.5", "webpack": "~5.68.0" + }, + "dependencies": { + "@rocket.chat/ui-kit": "next", + "tslib": "^2.3.1" } } diff --git a/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/VideoConferenceBlock.tsx b/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/VideoConferenceBlock.tsx deleted file mode 100644 index d62d613dcd1e..000000000000 --- a/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/VideoConferenceBlock.tsx +++ /dev/null @@ -1,183 +0,0 @@ -import type * as UiKit from '@rocket.chat/ui-kit'; -import { useTranslation, useUserAvatarPath } from '@rocket.chat/ui-contexts'; -import { Avatar } from '@rocket.chat/fuselage'; -import { - VideoConfMessageSkeleton, - VideoConfMessage, - VideoConfMessageRow, - VideoConfMessageIcon, - VideoConfMessageText, - VideoConfMessageFooter, - VideoConfMessageAction, - VideoConfMessageUserStack, - VideoConfMessageFooterText, -} from '@rocket.chat/ui-video-conf'; -import type { MouseEventHandler, ReactElement } from 'react'; -import React, { useContext, memo } from 'react'; - -import { useSurfaceType } from '../../contexts/SurfaceContext'; -import type { BlockProps } from '../../utils/BlockProps'; -import { useVideoConfDataStream } from './hooks/useVideoConfDataStream'; -import { kitContext } from '../..'; - -type VideoConferenceBlockProps = BlockProps; - -const MAX_USERS = 6; - -const VideoConferenceBlock = ({ - block, -}: VideoConferenceBlockProps): ReactElement => { - const t = useTranslation(); - const { callId, appId = 'videoconf-core' } = block; - const surfaceType = useSurfaceType(); - - const { action, viewId, rid } = useContext(kitContext); - - if (surfaceType !== 'message') { - return <>; - } - - if (!callId || !rid) { - return <>; - } - - const getUserAvatarPath = useUserAvatarPath(); - const result = useVideoConfDataStream({ rid, callId }); - - const joinHandler: MouseEventHandler = (e): void => { - action( - { - blockId: block.blockId || '', - appId, - actionId: 'join', - value: block.blockId || '', - viewId, - }, - e - ); - }; - - const callAgainHandler: MouseEventHandler = (e): void => { - action( - { - blockId: rid || '', - appId, - actionId: 'callBack', - value: rid || '', - viewId, - }, - e - ); - }; - - if (result.isSuccess) { - const { data } = result; - - if ('endedAt' in data) { - return ( - - - - {t('Call_ended')} - - - {data.type === 'direct' && ( - <> - - {t('Call_back')} - - - {t('Call_was_not_answered')} - - - )} - {data.type !== 'direct' && - (data.users.length ? ( - <> - - {data.users.map(({ username }, index) => - data.users.length <= MAX_USERS ? ( - - ) : ( - <> - ) - )} - - - {data.users.length > 6 - ? `+ ${MAX_USERS - data.users.length} ${t('Joined')}` - : t('Joined')} - - - ) : ( - - {t('Call_was_not_answered')} - - ))} - - - ); - } - - if (data.type === 'direct' && data.status === 0) { - return ( - - - - {t('Calling')} - - - - {t('Join')} - - - {t('Waiting_for_answer')} - - - - ); - } - - return ( - - - - {t('Call_ongoing')} - - - - {t('Join')} - - - {data.users.map(({ username }, index) => - data.users.length <= MAX_USERS ? ( - - ) : ( - <> - ) - )} - - - {data.users.length > 6 - ? `+ ${MAX_USERS - data.users.length} ${t('Joined')}` - : t('Joined')} - - - - ); - } - - return ; -}; - -export default memo(VideoConferenceBlock); diff --git a/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/hooks/useVideoConfData.ts b/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/hooks/useVideoConfData.ts deleted file mode 100644 index ddbc08616988..000000000000 --- a/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/hooks/useVideoConfData.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { useQuery } from '@tanstack/react-query'; -import { useEndpoint } from '@rocket.chat/ui-contexts'; - -export const useVideoConfData = ({ callId }: { callId: string }) => { - const videoConf = useEndpoint('GET', '/v1/video-conference.info'); - - return useQuery(['video-conference', callId], () => videoConf({ callId }), { - staleTime: Infinity, - refetchOnWindowFocus: false, - // refetchOnMount: false, - }); -}; diff --git a/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/hooks/useVideoConfDataStream.ts b/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/hooks/useVideoConfDataStream.ts deleted file mode 100644 index d6a77b9d044e..000000000000 --- a/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/hooks/useVideoConfDataStream.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { useStream } from '@rocket.chat/ui-contexts'; -import { Emitter } from '@rocket.chat/emitter'; -import { useCallback, useEffect } from 'react'; -import { useQueryClient } from '@tanstack/react-query'; - -import { useVideoConfData } from './useVideoConfData'; - -const ee = new Emitter>(); - -const events = new Map void>(); - -const useStreamBySubPath = ( - streamer: ReturnType, - subpath: string, - callback: () => void -) => { - useEffect(() => { - if (!ee.has(subpath)) { - events.set( - subpath, - streamer(subpath, () => { - ee.emit(subpath); - }) - ); - } - - return () => { - if (!ee.has(subpath)) { - events.delete(subpath); - } - }; - }, [streamer, subpath, callback]); - - useEffect(() => { - ee.on(subpath, callback); - - return () => { - ee.off(subpath, callback); - }; - }, [callback, subpath]); -}; - -export const useVideoConfDataStream = ({ - rid, - callId, -}: { - rid: string; - callId: string; -}) => { - const queryClient = useQueryClient(); - const subpath = `${rid}/${callId}`; - - const subscribeNotifyRoom = useStream('notify-room'); - - useStreamBySubPath( - subscribeNotifyRoom, - subpath, - useCallback(() => { - queryClient.invalidateQueries(['video-conference', callId]); - }, [subpath]) - ); - return useVideoConfData({ callId }); -}; diff --git a/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/index.tsx b/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/index.tsx deleted file mode 100644 index bbd942c7d3fe..000000000000 --- a/packages/fuselage-ui-kit/src/blocks/VideoConferenceBlock/index.tsx +++ /dev/null @@ -1,3 +0,0 @@ -import VideoConferenceBlock from './VideoConferenceBlock'; - -export default VideoConferenceBlock; diff --git a/packages/fuselage-ui-kit/src/contexts/kitContext.ts b/packages/fuselage-ui-kit/src/contexts/kitContext.ts index 6eebb8cea7a6..b0cb4141b161 100644 --- a/packages/fuselage-ui-kit/src/contexts/kitContext.ts +++ b/packages/fuselage-ui-kit/src/contexts/kitContext.ts @@ -23,7 +23,6 @@ type UiKitContext = { errors?: Record; values: Record; viewId?: string; - rid?: string; }; export const defaultContext = { diff --git a/packages/fuselage-ui-kit/src/surfaces/FuselageSurfaceRenderer.tsx b/packages/fuselage-ui-kit/src/surfaces/FuselageSurfaceRenderer.tsx index fe2e61ee590f..f548f63ac675 100644 --- a/packages/fuselage-ui-kit/src/surfaces/FuselageSurfaceRenderer.tsx +++ b/packages/fuselage-ui-kit/src/surfaces/FuselageSurfaceRenderer.tsx @@ -18,23 +18,17 @@ import OverflowElement from '../elements/OverflowElement'; import PlainTextInputElement from '../elements/PlainTextInputElement'; import StaticSelectElement from '../elements/StaticSelectElement'; -type FuselageSurfaceRendererProps = ConstructorParameters< - typeof UiKit.SurfaceRenderer ->[0]; - export class FuselageSurfaceRenderer extends UiKit.SurfaceRenderer { - public constructor(allowedBlocks?: FuselageSurfaceRendererProps) { - super( - allowedBlocks || [ - 'actions', - 'context', - 'divider', - 'image', - 'input', - 'section', - 'preview', - ] - ); + public constructor() { + super([ + 'actions', + 'context', + 'divider', + 'image', + 'input', + 'section', + 'preview', + ]); } public plain_text( diff --git a/packages/fuselage-ui-kit/src/surfaces/MessageSurfaceRenderer.tsx b/packages/fuselage-ui-kit/src/surfaces/MessageSurfaceRenderer.tsx deleted file mode 100644 index 6d83d774a9ed..000000000000 --- a/packages/fuselage-ui-kit/src/surfaces/MessageSurfaceRenderer.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import * as UiKit from '@rocket.chat/ui-kit'; -import type { ReactElement } from 'react'; -import React from 'react'; - -import VideoConferenceBlock from '../blocks/VideoConferenceBlock/VideoConferenceBlock'; -import { FuselageSurfaceRenderer } from './FuselageSurfaceRenderer'; - -export class FuselageMessageSurfaceRenderer extends FuselageSurfaceRenderer { - public constructor() { - super([ - 'actions', - 'context', - 'divider', - 'image', - 'input', - 'section', - 'preview', - 'video_conf', - ]); - } - - video_conf( - block: UiKit.VideoConferenceBlock, - context: UiKit.BlockContext, - index: number - ): ReactElement | null { - if (context === UiKit.BlockContext.BLOCK) { - return ( - - ); - } - - return null; - } -} diff --git a/packages/fuselage-ui-kit/src/surfaces/index.ts b/packages/fuselage-ui-kit/src/surfaces/index.ts index 49eff1a923a5..dd2918343590 100644 --- a/packages/fuselage-ui-kit/src/surfaces/index.ts +++ b/packages/fuselage-ui-kit/src/surfaces/index.ts @@ -3,11 +3,10 @@ import { FuselageSurfaceRenderer } from './FuselageSurfaceRenderer'; import MessageSurface from './MessageSurface'; import ModalSurface from './ModalSurface'; import { createSurfaceRenderer } from './createSurfaceRenderer'; -import { FuselageMessageSurfaceRenderer } from './MessageSurfaceRenderer'; // export const attachmentParser = new FuselageSurfaceRenderer(); export const bannerParser = new FuselageSurfaceRenderer(); -export const messageParser = new FuselageMessageSurfaceRenderer(); +export const messageParser = new FuselageSurfaceRenderer(); export const modalParser = new FuselageSurfaceRenderer(); // export const UiKitAttachment = createSurfaceRenderer(AttachmentSurface, attachmentParser); diff --git a/packages/gazzodown/package.json b/packages/gazzodown/package.json index 1e5569f1bc2b..b1e9ce93dfb4 100644 --- a/packages/gazzodown/package.json +++ b/packages/gazzodown/package.json @@ -3,10 +3,11 @@ "version": "0.0.1", "private": true, "devDependencies": { - "@babel/core": "~7.18.13", + "@babel/core": "^7.18.9", "@mdx-js/react": "^1.6.22", "@rocket.chat/core-typings": "workspace:^", "@rocket.chat/css-in-js": "next", + "@rocket.chat/fuselage": "next", "@rocket.chat/fuselage-tokens": "next", "@rocket.chat/message-parser": "next", "@rocket.chat/styled": "next", @@ -26,13 +27,13 @@ "@types/babel__core": "^7", "@types/jest": "^27.4.1", "@types/katex": "~0", - "@types/react": "~17.0.48", - "@types/react-dom": "~17.0.17", + "@types/react": "^17.0.47", + "@types/react-dom": "^18", "@types/testing-library__jest-dom": "^5", "@typescript-eslint/eslint-plugin": "^5.30.7", "@typescript-eslint/parser": "^5.30.7", "babel-loader": "^8.2.5", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "eslint-plugin-anti-trojan-source": "^1.1.0", "eslint-plugin-react": "^7.30.1", "eslint-plugin-react-hooks": "^4.6.0", @@ -60,16 +61,16 @@ "/dist" ], "peerDependencies": { - "@rocket.chat/core-typings": "*", + "@rocket.chat/core-typings": "workspace:^", "@rocket.chat/css-in-js": "*", "@rocket.chat/fuselage": "*", "@rocket.chat/fuselage-tokens": "*", "@rocket.chat/message-parser": "*", "@rocket.chat/styled": "*", - "@rocket.chat/ui-client": "*", - "@rocket.chat/ui-contexts": "*", + "@rocket.chat/ui-client": "workspace:^", + "@rocket.chat/ui-contexts": "workspace:^", "katex": "*", - "react": "*" + "react": "~17.0.2" }, "dependencies": { "highlight.js": "^11.5.1", diff --git a/packages/livechat/package.json b/packages/livechat/package.json index bf9f8e56a3c9..d87419d46587 100644 --- a/packages/livechat/package.json +++ b/packages/livechat/package.json @@ -24,7 +24,7 @@ }, "devDependencies": { "@babel/eslint-parser": "^7.18.9", - "@babel/preset-env": "^7.18.10", + "@babel/preset-env": "^7.18.9", "@rocket.chat/eslint-config": "^0.4.0", "@rocket.chat/fuselage-tokens": "next", "@rocket.chat/logo": "next", @@ -36,6 +36,7 @@ "@storybook/addon-viewport": "~6.5.10", "@storybook/react": "~6.5.10", "@storybook/theming": "~6.5.10", + "@types/react-dom": "^17.0.17", "autoprefixer": "^9.8.8", "babel-loader": "^8.1.0", "babel-plugin-jsx-pragmatic": "^1.0.2", @@ -43,7 +44,7 @@ "css-loader": "^4.3.0", "cssnano": "^4.1.11", "desvg-loader": "^0.1.0", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "eslint-plugin-import": "^2.26.0", "eslint-plugin-react": "^7.30.1", "eslint-plugin-react-hooks": "^4.6.0", diff --git a/packages/livechat/src/components/Messages/MessageList/index.js b/packages/livechat/src/components/Messages/MessageList/index.js index f7ab458c017f..7ac2dbf60ab8 100644 --- a/packages/livechat/src/components/Messages/MessageList/index.js +++ b/packages/livechat/src/components/Messages/MessageList/index.js @@ -101,9 +101,7 @@ export class MessageList extends MemoizedComponent { isVideoConfMessage(message) { return Boolean( - message.blocks - ?.find(({ appId, type }) => appId === 'videoconf-core' && type === 'actions') - ?.elements?.find(({ actionId }) => actionId === 'joinLivechat'), + message.blocks?.find(({ appId }) => appId === 'videoconf-core')?.elements?.find(({ actionId }) => actionId === 'joinLivechat'), ); } @@ -139,7 +137,7 @@ export class MessageList extends MemoizedComponent { } const videoConfJoinBlock = message.blocks - ?.find(({ appId, type }) => appId === 'videoconf-core' && type === 'actions') + ?.find(({ appId }) => appId === 'videoconf-core') ?.elements?.find(({ actionId }) => actionId === 'joinLivechat'); if (videoConfJoinBlock) { // If the call is not accepted yet, don't render the message. diff --git a/packages/livechat/src/lib/room.js b/packages/livechat/src/lib/room.js index 3cfd8918234a..858df335671f 100644 --- a/packages/livechat/src/lib/room.js +++ b/packages/livechat/src/lib/room.js @@ -35,9 +35,7 @@ export const closeChat = async ({ transcriptRequested } = {}) => { }; const getVideoConfMessageData = (message) => - message.blocks - ?.find(({ appId, type }) => appId === 'videoconf-core' && type === 'actions') - ?.elements?.find(({ actionId }) => actionId === 'joinLivechat'); + message.blocks?.find(({ appId }) => appId === 'videoconf-core')?.elements?.find(({ actionId }) => actionId === 'joinLivechat'); const isVideoCallMessage = (message) => { if (message.t === constants.webRTCCallStartedMessageType) { diff --git a/packages/model-typings/package.json b/packages/model-typings/package.json index 024d295148f9..55516d3bb65c 100644 --- a/packages/model-typings/package.json +++ b/packages/model-typings/package.json @@ -5,7 +5,7 @@ "devDependencies": { "@types/jest": "^27.4.1", "@types/node-rsa": "^1.1.1", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "jest": "^27.5.1", "mongodb": "^4.3.1", "ts-jest": "^27.1.5", diff --git a/packages/model-typings/src/models/ISubscriptionsModel.ts b/packages/model-typings/src/models/ISubscriptionsModel.ts index 63702bc8b107..0809f9361a73 100644 --- a/packages/model-typings/src/models/ISubscriptionsModel.ts +++ b/packages/model-typings/src/models/ISubscriptionsModel.ts @@ -1,4 +1,4 @@ -import type { FindOptions, FindCursor, UpdateResult, DeleteResult, Document, AggregateOptions } from 'mongodb'; +import type { FindOptions, FindCursor, UpdateResult, DeleteResult, Document, AggregateOptions, Filter } from 'mongodb'; import type { ISubscription, IRole, IUser, IRoom, RoomType, SpotlightUser } from '@rocket.chat/core-typings'; import type { IBaseModel } from './IBaseModel'; @@ -64,6 +64,7 @@ export interface ISubscriptionsModel extends IBaseModel { searchTerm: string, exceptions: string[], searchFields: string[], + extraConditions: Filter, limit: number, roomType?: ISubscription['t'], { startsWith, endsWith }?: { startsWith?: string | false; endsWith?: string | false }, diff --git a/packages/model-typings/src/models/IVideoConferenceModel.ts b/packages/model-typings/src/models/IVideoConferenceModel.ts index e0a1090eb5ca..d1cfbcd919be 100644 --- a/packages/model-typings/src/models/IVideoConferenceModel.ts +++ b/packages/model-typings/src/models/IVideoConferenceModel.ts @@ -54,7 +54,7 @@ export interface IVideoConferenceModel extends IBaseModel { setProviderDataById(callId: string, providerData: Record | undefined): Promise; - addUserById(callId: string, user: Required> & { ts?: Date }): Promise; + addUserById(callId: string, user: Pick & { ts?: Date }): Promise; setMessageById(callId: string, messageType: keyof VideoConference['messages'], messageId: string): Promise; diff --git a/packages/models/package.json b/packages/models/package.json index 6c6773d02ce0..77846eb64251 100644 --- a/packages/models/package.json +++ b/packages/models/package.json @@ -4,7 +4,7 @@ "private": true, "devDependencies": { "@types/jest": "^27.4.1", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "jest": "^27.5.1", "ts-jest": "^27.1.5", "typescript": "~4.5.5" diff --git a/packages/node-poplib/package.json b/packages/node-poplib/package.json index 792fc9f6f30d..eac15f26ef19 100644 --- a/packages/node-poplib/package.json +++ b/packages/node-poplib/package.json @@ -4,7 +4,7 @@ "private": true, "devDependencies": { "@types/jest": "^27.4.1", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "jest": "^27.5.1", "ts-jest": "^27.1.4", "typescript": "~4.5.5" diff --git a/packages/rest-typings/package.json b/packages/rest-typings/package.json index 603c229976c2..0b8648c0d62a 100644 --- a/packages/rest-typings/package.json +++ b/packages/rest-typings/package.json @@ -5,7 +5,7 @@ "devDependencies": { "@rocket.chat/eslint-config": "workspace:^", "@types/jest": "^27.4.1", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "jest": "^27.5.1", "mongodb": "^4.3.1", "ts-jest": "^27.1.5", diff --git a/packages/ui-client/package.json b/packages/ui-client/package.json index 39aaa9d9cb66..ce17f2da0d98 100644 --- a/packages/ui-client/package.json +++ b/packages/ui-client/package.json @@ -3,7 +3,6 @@ "version": "0.0.1", "private": true, "devDependencies": { - "@babel/core": "~7.18.13", "@rocket.chat/css-in-js": "next", "@rocket.chat/fuselage": "next", "@rocket.chat/fuselage-hooks": "next", @@ -19,12 +18,10 @@ "@storybook/manager-webpack4": "~6.5.10", "@storybook/react": "~6.5.10", "@storybook/testing-library": "~0.0.13", - "@types/babel__core": "^7", "@types/jest": "^27.4.1", "@types/postcss-url": "^10", - "@types/react": "~17.0.48", - "@types/react-dom": "~17.0.17", - "eslint": "^8.22.0", + "@types/react": "~17.0.47", + "eslint": "^8.20.0", "eslint-plugin-anti-trojan-source": "^1.1.0", "eslint-plugin-react": "^7.30.1", "eslint-plugin-react-hooks": "^4.6.0", @@ -59,7 +56,6 @@ "@rocket.chat/fuselage": "*", "@rocket.chat/fuselage-hooks": "*", "@rocket.chat/icons": "*", - "@rocket.chat/ui-contexts": "*", "react": "~17.0.2" } } diff --git a/packages/ui-contexts/package.json b/packages/ui-contexts/package.json index 7bfd1f95fdc0..7858794225dc 100644 --- a/packages/ui-contexts/package.json +++ b/packages/ui-contexts/package.json @@ -8,10 +8,9 @@ "@rocket.chat/fuselage-hooks": "next", "@rocket.chat/rest-typings": "workspace:^", "@types/jest": "^27.4.1", - "@types/react": "~17.0.48", - "@types/react-dom": "~17.0.17", + "@types/react": "^17.0.47", "@types/use-sync-external-store": "^0.0.3", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "jest": "^27.5.1", "mongodb": "^4.3.1", "react": "~17.0.2", diff --git a/packages/ui-contexts/src/ServerContext/methods.ts b/packages/ui-contexts/src/ServerContext/methods.ts index 4009cf947e1e..d3073fc4c6e3 100644 --- a/packages/ui-contexts/src/ServerContext/methods.ts +++ b/packages/ui-contexts/src/ServerContext/methods.ts @@ -227,7 +227,7 @@ export interface ServerMethods { 'livechat:changeLivechatStatus': (params?: void | { status?: string; agentId?: string }) => unknown; 'livechat:saveAgentInfo': (_id: string, agentData: unknown, agentDepartments: unknown) => unknown; 'livechat:takeInquiry': (inquiryId: string, options?: { clientAction: boolean; forwardingToDepartment?: boolean }) => unknown; - 'livechat:resumeOnHold': (roomId: string) => unknown; + 'livechat:resumeOnHold': (roomId: string, options?: { clientAction: boolean }) => unknown; 'autoTranslate.getProviderUiMetadata': () => Record; 'autoTranslate.getSupportedLanguages': (language: string) => ISupportedLanguage[]; 'spotlight': ( diff --git a/packages/ui-video-conf/.eslintrc.json b/packages/ui-video-conf/.eslintrc.json index 07037ccf0bc8..1859ff825f63 100644 --- a/packages/ui-video-conf/.eslintrc.json +++ b/packages/ui-video-conf/.eslintrc.json @@ -5,8 +5,7 @@ "@rocket.chat/eslint-config/original", "prettier", "plugin:anti-trojan-source/recommended", - "plugin:react/jsx-runtime", - "plugin:storybook/recommended" + "plugin:react/jsx-runtime" ], "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint", "react", "react-hooks", "prettier"], @@ -64,13 +63,5 @@ "version": "detect" } }, - "ignorePatterns": ["**/dist"], - "overrides": [ - { - "files": ["*.stories.tsx"], - "rules": { - "react/no-multi-comp": "off" - } - } - ] + "ignorePatterns": ["**/dist"] } diff --git a/packages/ui-video-conf/.storybook/main.js b/packages/ui-video-conf/.storybook/main.js deleted file mode 100644 index 4b6ae93751aa..000000000000 --- a/packages/ui-video-conf/.storybook/main.js +++ /dev/null @@ -1,12 +0,0 @@ -module.exports = { - "stories": [ - "../src/**/*.stories.mdx", - "../src/**/*.stories.@(js|jsx|ts|tsx)" - ], - "addons": [ - "@storybook/addon-links", - "@storybook/addon-essentials", - "@storybook/addon-interactions" - ], - "framework": "@storybook/react" -} diff --git a/packages/ui-video-conf/.storybook/preview.js b/packages/ui-video-conf/.storybook/preview.js deleted file mode 100644 index abd704f79510..000000000000 --- a/packages/ui-video-conf/.storybook/preview.js +++ /dev/null @@ -1,25 +0,0 @@ -import '../../../apps/meteor/app/theme/client/main.css'; -import 'highlight.js/styles/github.css'; - -export const parameters = { - actions: { argTypesRegex: "^on[A-Z].*" }, - controls: { - matchers: { - color: /(background|color)$/i, - date: /Date$/, - }, - }, -} - -export const decorators = [ - (Story) => ( -
- - -
- ) -]; diff --git a/packages/ui-video-conf/package.json b/packages/ui-video-conf/package.json index 4603e2340abd..7bab37906fa0 100644 --- a/packages/ui-video-conf/package.json +++ b/packages/ui-video-conf/package.json @@ -3,26 +3,15 @@ "version": "0.0.1", "private": true, "devDependencies": { - "@babel/core": "~7.18.13", "@rocket.chat/css-in-js": "next", "@rocket.chat/eslint-config": "workspace:^", "@rocket.chat/fuselage": "next", "@rocket.chat/fuselage-hooks": "next", - "@rocket.chat/icons": "next", "@rocket.chat/styled": "next", - "@storybook/addon-actions": "~6.5.10", - "@storybook/addon-docs": "~6.5.10", - "@storybook/addon-essentials": "~6.5.10", - "@storybook/builder-webpack4": "~6.5.10", - "@storybook/manager-webpack4": "~6.5.10", - "@storybook/react": "~6.5.10", - "@storybook/testing-library": "~0.0.13", - "@types/babel__core": "^7", "@types/jest": "^27.4.1", - "eslint": "^8.22.0", + "eslint": "^8.20.0", "eslint-plugin-react": "^7.30.1", "eslint-plugin-react-hooks": "^4.6.0", - "eslint-plugin-storybook": "^0.6.4", "jest": "^27.5.1", "ts-jest": "^27.1.4", "typescript": "~4.5.5" @@ -31,7 +20,6 @@ "@rocket.chat/css-in-js": "*", "@rocket.chat/fuselage": "*", "@rocket.chat/fuselage-hooks": "*", - "@rocket.chat/icons": "*", "@rocket.chat/styled": "*", "react": "^17.0.2", "react-dom": "^17.0.2" @@ -41,15 +29,11 @@ "eslint:fix": "eslint --ext .js,.jsx,.ts,.tsx . --fix", "jest": "jest", "build": "tsc -p tsconfig.json", - "storybook": "start-storybook -p 6006", "dev": "tsc -p tsconfig.json --watch --preserveWatchOutput" }, "main": "./dist/index.js", "typings": "./dist/index.d.ts", "files": [ "/dist" - ], - "dependencies": { - "@rocket.chat/emitter": "next" - } + ] } diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessage.stories.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessage.stories.tsx deleted file mode 100644 index b253f28d9496..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessage.stories.tsx +++ /dev/null @@ -1,110 +0,0 @@ -import { MessageDivider, Message, Avatar, Box } from '@rocket.chat/fuselage'; -import type { ComponentMeta, ComponentStory } from '@storybook/react'; -import type { ReactElement } from 'react'; - -import '@rocket.chat/icons/dist/rocketchat.css'; -import { VideoConfMessage, VideoConfMessageIcon, VideoConfMessageRow, VideoConfMessageText } from '.'; -import VideoConfMessageAction from './VideoConfMessageAction'; -import VideoConfMessageFooter from './VideoConfMessageFooter'; -import VideoConfMessageFooterText from './VideoConfMessageFooterText'; -import VideoConfMessageSkeleton from './VideoConfMessageSkeleton'; -import VideoConfMessageUserStack from './VideoConfMessageUserStack'; - -export default { - title: 'Components/VideoConfMessage', - component: VideoConfMessage, - decorators: [ - (Story): ReactElement => ( - - May, 24, 2020 - - - - - - - Haylie George - @haylie.george - Admin - User - Owner - 12:00 PM - - - - - - - - ), - ], -} as ComponentMeta; - -const avatarUrl = - 'data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjL/wAARCAAoACgDASIAAhEBAxEB/8QAGwAAAgIDAQAAAAAAAAAAAAAAAAcEBgIDBQj/xAAuEAACAQQAAwcEAQUAAAAAAAABAgMABAUREiExBhMUIkFRYQcWcYGhFTJSgpH/xAAYAQADAQEAAAAAAAAAAAAAAAACAwQBAP/EAB4RAAIBBQEBAQAAAAAAAAAAAAABAgMREiExE0HR/9oADAMBAAIRAxEAPwBuXuIkhBuMe5ib/AHQP49q4L3mLitryTLTSpOiHQI5k/HzXa/qbFOEudVTu1dumWvcTaNCZYZ7vU6g6LxqjOU/24dfs1Ouh9FnkMpd3Reeyx83hAxZZEhkdV9/MBrX71WGPvJcqrJBGveKATtuXXqNU0pu02bTHXD/AGvJAluyxxRd6F4x00o+NdKoVrjbzJdvVe1t5cVLc2ck8qjnohgpPtz2v7G6JtPQ2VJwjlcw+37mchpnK6GtIuv5NFWeTsLNPvxWTvpfjvOEfwKKzEVkSct2vscS/BIzSN0YRkeX81UpPqO8masJETu7OOccY4dswYFQeftv096XV5knuJGdm2T1+agvMXj8jEaHX905QihabvcbuS7X566mLWLwSY8PuRnk/u4eZ0deTl71Ef6hY+0yM88TzeNZY4luYwpVYyduOfrvhPTnr0pXSX9y5mCsyJMdyxxvwq599em+taItqCSNc90ChvZRUruUcT0JiO18Elpk7t8v41LWzacxkBSuvjQ/FFJayjDWrCTepAQ2vUH0oo/Jk3ovpwJJeVCP5CN+lFFaaMqy+nAyuChvrTI2kN9JAsi2ZOy4IBHMnkSCP+iqBexSWdxLazoUljJVlPUH2oorkV10pRc7b1zXb/hZOzuJvM86QWEXeELxOzHSIPcmiiiunVlF2RNTpRkrs//Z'; - -export const CallingDM: ComponentStory = () => ( - - - - Calling... - - - Join - Waiting for answer - - -); - -export const CallEndedDM: ComponentStory = () => ( - - - - Call ended - - - Call Back - Call was not answered - - -); - -export const CallOngoing: ComponentStory = () => ( - - - - Call ongoing - - - Join - - {Array(3) - .fill('') - .map((_, index) => ( - - ))} - - Joined - - -); - -export const CallEnded: ComponentStory = () => ( - - - - Call ended - - - - {Array(3) - .fill('') - .map((_, index) => ( - - ))} - - - -); - -export const Loading: ComponentStory = () => ; diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessage.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessage.tsx deleted file mode 100644 index 0aae5a21ee59..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessage.tsx +++ /dev/null @@ -1,8 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import type { ReactElement } from 'react'; - -const VideoConfMessage = ({ ...props }): ReactElement => ( - -); - -export default VideoConfMessage; diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageAction.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageAction.tsx deleted file mode 100644 index 49e662833e05..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageAction.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { Box, Button } from '@rocket.chat/fuselage'; -import type { AllHTMLAttributes, ReactElement, ReactNode } from 'react'; - -const VideoConfMessageAction = ({ - children, - primary, - ...props -}: { children: ReactNode; primary?: boolean } & Omit, 'is'>): ReactElement => ( - - - -); -export default VideoConfMessageAction; diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageFooter.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageFooter.tsx deleted file mode 100644 index 1adfc10820b0..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageFooter.tsx +++ /dev/null @@ -1,14 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import type { ReactElement, ReactNode } from 'react'; - -import VideoConfMessageRow from './VideoConfMessageRow'; - -const VideoConfMessageFooter = ({ children, ...props }: { children: ReactNode }): ReactElement => ( - - - {children} - - -); - -export default VideoConfMessageFooter; diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageFooterText.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageFooterText.tsx deleted file mode 100644 index 975df374ff01..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageFooterText.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import type { ReactElement, ReactNode } from 'react'; - -const VideoConfMessageFooterText = ({ children }: { children: ReactNode }): ReactElement => ( - - {children} - -); -export default VideoConfMessageFooterText; diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageIcon.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageIcon.tsx deleted file mode 100644 index 7cec0601e773..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageIcon.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import { Box, Icon } from '@rocket.chat/fuselage'; -import type { ReactElement, ComponentProps } from 'react'; - -type VideoConfMessageIconProps = { - variant?: keyof typeof styles; -}; - -const styles = { - ended: { - icon: 'phone-off', - color: 'neutral-700', - backgroundColor: 'neutral-400', - }, - incoming: { - icon: 'phone-in', - color: 'primary-600', - backgroundColor: 'primary-200', - }, - outgoing: { - icon: 'phone', - color: 'success-800', - backgroundColor: 'success-200', - }, -} as const; - -const VideoConfMessageIcon = ({ variant = 'ended' }: VideoConfMessageIconProps): ReactElement => ( - - - -); - -export default VideoConfMessageIcon; diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageRow.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageRow.tsx deleted file mode 100644 index b9dd67814f8c..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageRow.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import type { ReactElement } from 'react'; - -const VideoConfMessageRow = ({ ...props }): ReactElement => ; - -export default VideoConfMessageRow; diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageSkeleton.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageSkeleton.tsx deleted file mode 100644 index 18134774eb5e..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageSkeleton.tsx +++ /dev/null @@ -1,18 +0,0 @@ -import { Skeleton } from '@rocket.chat/fuselage'; -import type { ReactElement } from 'react'; - -import VideoConfMessage from './VideoConfMessage'; -import VideoConfMessageRow from './VideoConfMessageRow'; - -const VideoConfMessageSkeleton = (): ReactElement => ( - - - - - - - - -); - -export default VideoConfMessageSkeleton; diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageText.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageText.tsx deleted file mode 100644 index d0cfc3eafced..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageText.tsx +++ /dev/null @@ -1,6 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import type { ReactElement, ComponentProps } from 'react'; - -const VideoConfMessageText = ({ ...props }: ComponentProps): ReactElement => ; - -export default VideoConfMessageText; diff --git a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageUserStack.tsx b/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageUserStack.tsx deleted file mode 100644 index c555ddb5dc93..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/VideoConfMessageUserStack.tsx +++ /dev/null @@ -1,16 +0,0 @@ -import { Box } from '@rocket.chat/fuselage'; -import { Children, ReactElement } from 'react'; - -const VideoConfMessageUserStack = ({ children }: { children: ReactElement | ReactElement[] }): ReactElement => ( - - - {Children.map(Children.toArray(children), (child, index) => ( - - {child} - - ))} - - -); - -export default VideoConfMessageUserStack; diff --git a/packages/ui-video-conf/src/VideoConfMessage/index.ts b/packages/ui-video-conf/src/VideoConfMessage/index.ts deleted file mode 100644 index a76957e92b20..000000000000 --- a/packages/ui-video-conf/src/VideoConfMessage/index.ts +++ /dev/null @@ -1,21 +0,0 @@ -import VideoConfMessage from './VideoConfMessage'; -import VideoConfMessageAction from './VideoConfMessageAction'; -import VideoConfMessageFooter from './VideoConfMessageFooter'; -import VideoConfMessageFooterText from './VideoConfMessageFooterText'; -import VideoConfMessageIcon from './VideoConfMessageIcon'; -import VideoConfMessageRow from './VideoConfMessageRow'; -import VideoConfMessageSkeleton from './VideoConfMessageSkeleton'; -import VideoConfMessageText from './VideoConfMessageText'; -import VideoConfMessageUserStack from './VideoConfMessageUserStack'; - -export { - VideoConfMessage, - VideoConfMessageIcon, - VideoConfMessageRow, - VideoConfMessageText, - VideoConfMessageSkeleton, - VideoConfMessageFooter, - VideoConfMessageAction, - VideoConfMessageUserStack, - VideoConfMessageFooterText, -}; diff --git a/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.tsx b/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.tsx index be567f494697..3f93b1a278b1 100644 --- a/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.tsx +++ b/packages/ui-video-conf/src/VideoConfPopup/VideoConfPopup.tsx @@ -22,7 +22,7 @@ const VideoConfPopup = forwardRef(function VideoConfPopup( ): ReactElement { return ( - + {children} diff --git a/packages/ui-video-conf/src/index.ts b/packages/ui-video-conf/src/index.ts index d331731d0f44..e7244b55b214 100644 --- a/packages/ui-video-conf/src/index.ts +++ b/packages/ui-video-conf/src/index.ts @@ -1,7 +1,6 @@ import VideoConfButton from './VideoConfButton'; import VideoConfController from './VideoConfController'; -export * from './VideoConfMessage'; export * from './VideoConfPopup'; export * from './hooks'; export { VideoConfButton, VideoConfController }; diff --git a/yarn.lock b/yarn.lock index 782c95397b14..9275f5dbbcee 100644 --- a/yarn.lock +++ b/yarn.lock @@ -84,7 +84,7 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:^7.1.0, @babel/core@npm:^7.11.6, @babel/core@npm:^7.12.10, @babel/core@npm:^7.12.3, @babel/core@npm:^7.18.13, @babel/core@npm:^7.19.1, @babel/core@npm:^7.7.2, @babel/core@npm:^7.7.5, @babel/core@npm:^7.8.0": +"@babel/core@npm:^7.1.0, @babel/core@npm:^7.11.6, @babel/core@npm:^7.12.10, @babel/core@npm:^7.12.3, @babel/core@npm:^7.18.9, @babel/core@npm:^7.19.1, @babel/core@npm:^7.7.2, @babel/core@npm:^7.7.5, @babel/core@npm:^7.8.0": version: 7.19.1 resolution: "@babel/core@npm:7.19.1" dependencies: @@ -1422,7 +1422,7 @@ __metadata: languageName: node linkType: hard -"@babel/preset-env@npm:^7.12.11, @babel/preset-env@npm:^7.18.10, @babel/preset-env@npm:^7.19.1": +"@babel/preset-env@npm:^7.12.11, @babel/preset-env@npm:^7.18.9, @babel/preset-env@npm:^7.19.1": version: 7.19.1 resolution: "@babel/preset-env@npm:7.19.1" dependencies: @@ -1977,7 +1977,7 @@ __metadata: languageName: node linkType: hard -"@eslint/eslintrc@npm:^1.3.0, @eslint/eslintrc@npm:^1.3.2": +"@eslint/eslintrc@npm:^1.0.5, @eslint/eslintrc@npm:^1.3.2": version: 1.3.2 resolution: "@eslint/eslintrc@npm:1.3.2" dependencies: @@ -2123,6 +2123,17 @@ __metadata: languageName: node linkType: hard +"@humanwhocodes/config-array@npm:^0.10.5": + version: 0.10.5 + resolution: "@humanwhocodes/config-array@npm:0.10.5" + dependencies: + "@humanwhocodes/object-schema": ^1.2.1 + debug: ^4.1.1 + minimatch: ^3.0.4 + checksum: af4fa2633c57414be22ddba0a072cc611ef9a07104542fa24bde918a0153b89b6e08ca6a20ccc9079de6079e219e2406e38414d1b662db8bb59a3ba9d6eee6e3 + languageName: node + linkType: hard + "@humanwhocodes/config-array@npm:^0.5.0": version: 0.5.0 resolution: "@humanwhocodes/config-array@npm:0.5.0" @@ -2134,6 +2145,17 @@ __metadata: languageName: node linkType: hard +"@humanwhocodes/config-array@npm:^0.9.2": + version: 0.9.5 + resolution: "@humanwhocodes/config-array@npm:0.9.5" + dependencies: + "@humanwhocodes/object-schema": ^1.2.1 + debug: ^4.1.1 + minimatch: ^3.0.4 + checksum: 8ba6281bc0590f6c6eadeefc14244b5a3e3f5903445aadd1a32099ed80e753037674026ce1b3c945ab93561bea5eb29e3c5bff67060e230c295595ba517a3492 + languageName: node + linkType: hard + "@humanwhocodes/gitignore-to-minimatch@npm:^1.0.2": version: 1.0.2 resolution: "@humanwhocodes/gitignore-to-minimatch@npm:1.0.2" @@ -4958,7 +4980,7 @@ __metadata: cron: ~1.8.0 date.js: ~0.3.3 debug: ~4.1.1 - eslint: ^8.22.0 + eslint: ^8.20.0 human-interval: ^2.0.0 jest: ^27.5.1 moment-timezone: ~0.5.27 @@ -4976,7 +4998,7 @@ __metadata: "@rocket.chat/rest-typings": "workspace:^" "@types/jest": ^27.4.1 "@types/strict-uri-encode": ^2.0.0 - eslint: ^8.22.0 + eslint: ^8.20.0 filter-obj: ^3.0.0 jest: ^27.5.1 query-string: ^7.1.1 @@ -5065,7 +5087,7 @@ __metadata: dependencies: "@types/jest": ^27.4.1 cheerio: 1.0.0-rc.10 - eslint: ^8.22.0 + eslint: ^8.20.0 jest: ^27.5.1 ts-jest: ^27.1.4 typescript: ~4.5.5 @@ -5081,7 +5103,7 @@ __metadata: "@rocket.chat/icons": next "@rocket.chat/message-parser": next "@rocket.chat/ui-kit": next - eslint: ^8.22.0 + eslint: ^8.20.0 mongodb: ^4.3.1 prettier: ^2.7.1 typescript: ~4.5.5 @@ -5132,7 +5154,7 @@ __metadata: "@types/ws": ^8.5.3 colorette: ^1.4.0 ejson: ^2.2.2 - eslint: ^8.22.0 + eslint: ^8.21.0 eventemitter3: ^4.0.7 fibers: ^5.0.3 jaeger-client: ^3.19.0 @@ -5178,7 +5200,7 @@ __metadata: "@types/prettier": ^2.6.3 "@typescript-eslint/eslint-plugin": ^5.30.7 "@typescript-eslint/parser": ^5.30.7 - eslint: ^8.22.0 + eslint: ^8.20.0 eslint-config-prettier: ^8.5.0 eslint-plugin-anti-trojan-source: ^1.1.0 eslint-plugin-import: ^2.26.0 @@ -5192,7 +5214,7 @@ __metadata: version: 0.0.0-use.local resolution: "@rocket.chat/favicon@workspace:packages/favicon" dependencies: - eslint: ^8.22.0 + eslint: ^8.20.0 typescript: ~4.5.5 languageName: unknown linkType: soft @@ -5304,7 +5326,25 @@ __metadata: languageName: node linkType: hard -"@rocket.chat/fuselage-ui-kit@workspace:^, @rocket.chat/fuselage-ui-kit@workspace:packages/fuselage-ui-kit": +"@rocket.chat/fuselage-ui-kit@npm:next": + version: 0.32.0-dev.104 + resolution: "@rocket.chat/fuselage-ui-kit@npm:0.32.0-dev.104" + dependencies: + "@rocket.chat/ui-kit": ~0.32.0-dev.89 + tslib: ^2.3.1 + peerDependencies: + "@rocket.chat/fuselage": "*" + "@rocket.chat/fuselage-hooks": "*" + "@rocket.chat/fuselage-polyfills": "*" + "@rocket.chat/icons": "*" + "@rocket.chat/styled": "*" + react: ^17.0.2 + react-dom: ^17.0.2 + checksum: a83fb2f2d88bde7128de931ee26a60e2b3b332bf666b6195c72a7222f6b61130f7afd692f63dbfc80562c64295ca6bc47050d7a2dc62a1b7fb1c492b0c554af1 + languageName: node + linkType: hard + +"@rocket.chat/fuselage-ui-kit@workspace:packages/fuselage-ui-kit": version: 0.0.0-use.local resolution: "@rocket.chat/fuselage-ui-kit@workspace:packages/fuselage-ui-kit" dependencies: @@ -5316,9 +5356,7 @@ __metadata: "@rocket.chat/icons": next "@rocket.chat/prettier-config": next "@rocket.chat/styled": next - "@rocket.chat/ui-contexts": "workspace:^" "@rocket.chat/ui-kit": next - "@rocket.chat/ui-video-conf": "workspace:^" "@storybook/addon-essentials": ~6.5.10 "@storybook/addons": ~6.5.10 "@storybook/builder-webpack5": ~6.5.10 @@ -5326,36 +5364,29 @@ __metadata: "@storybook/react": ~6.5.10 "@storybook/source-loader": ~6.5.10 "@storybook/theming": ~6.5.10 - "@tanstack/react-query": ^4.2.1 - "@types/react": ~17.0.48 - "@types/react-dom": ~17.0.17 + "@types/react": ~17.0.39 + "@types/react-dom": ^17.0.11 babel-loader: ~8.2.3 cross-env: ^7.0.3 - eslint: ~8.22.0 + eslint: ~8.8.0 lint-staged: ~12.3.3 normalize.css: ^8.0.1 npm-run-all: ^4.1.5 prettier: ~2.5.1 + react: ^17.0.2 react-dom: ^17.0.2 rimraf: ^3.0.2 tslib: ^2.3.1 typescript: ~4.3.5 webpack: ~5.68.0 peerDependencies: - "@rocket.chat/apps-engine": "*" - "@rocket.chat/eslint-config": "*" "@rocket.chat/fuselage": "*" "@rocket.chat/fuselage-hooks": "*" "@rocket.chat/fuselage-polyfills": "*" "@rocket.chat/icons": "*" - "@rocket.chat/prettier-config": "*" "@rocket.chat/styled": "*" - "@rocket.chat/ui-contexts": "*" - "@rocket.chat/ui-kit": "*" - "@rocket.chat/ui-video-conf": "*" - "@tanstack/react-query": "*" - react: "*" - react-dom: "*" + react: ^17.0.2 + react-dom: ^17.0.2 languageName: unknown linkType: soft @@ -5385,10 +5416,11 @@ __metadata: version: 0.0.0-use.local resolution: "@rocket.chat/gazzodown@workspace:packages/gazzodown" dependencies: - "@babel/core": ~7.18.13 + "@babel/core": ^7.18.9 "@mdx-js/react": ^1.6.22 "@rocket.chat/core-typings": "workspace:^" "@rocket.chat/css-in-js": next + "@rocket.chat/fuselage": next "@rocket.chat/fuselage-tokens": next "@rocket.chat/message-parser": next "@rocket.chat/styled": next @@ -5408,13 +5440,13 @@ __metadata: "@types/babel__core": ^7 "@types/jest": ^27.4.1 "@types/katex": ~0 - "@types/react": ~17.0.48 - "@types/react-dom": ~17.0.17 + "@types/react": ^17.0.47 + "@types/react-dom": ^18 "@types/testing-library__jest-dom": ^5 "@typescript-eslint/eslint-plugin": ^5.30.7 "@typescript-eslint/parser": ^5.30.7 babel-loader: ^8.2.5 - eslint: ^8.22.0 + eslint: ^8.20.0 eslint-plugin-anti-trojan-source: ^1.1.0 eslint-plugin-react: ^7.30.1 eslint-plugin-react-hooks: ^4.6.0 @@ -5428,16 +5460,16 @@ __metadata: ts-jest: ^27.1.4 typescript: ~4.5.5 peerDependencies: - "@rocket.chat/core-typings": "*" + "@rocket.chat/core-typings": "workspace:^" "@rocket.chat/css-in-js": "*" "@rocket.chat/fuselage": "*" "@rocket.chat/fuselage-tokens": "*" "@rocket.chat/message-parser": "*" "@rocket.chat/styled": "*" - "@rocket.chat/ui-client": "*" - "@rocket.chat/ui-contexts": "*" + "@rocket.chat/ui-client": "workspace:^" + "@rocket.chat/ui-contexts": "workspace:^" katex: "*" - react: "*" + react: ~17.0.2 languageName: unknown linkType: soft @@ -5465,7 +5497,7 @@ __metadata: resolution: "@rocket.chat/livechat@workspace:packages/livechat" dependencies: "@babel/eslint-parser": ^7.18.9 - "@babel/preset-env": ^7.18.10 + "@babel/preset-env": ^7.18.9 "@rocket.chat/eslint-config": ^0.4.0 "@rocket.chat/fuselage-tokens": next "@rocket.chat/logo": next @@ -5479,6 +5511,7 @@ __metadata: "@storybook/addon-viewport": ~6.5.10 "@storybook/react": ~6.5.10 "@storybook/theming": ~6.5.10 + "@types/react-dom": ^17.0.17 autoprefixer: ^9.8.8 babel-loader: ^8.1.0 babel-plugin-jsx-pragmatic: ^1.0.2 @@ -5490,7 +5523,7 @@ __metadata: date-fns: ^2.15.0 desvg-loader: ^0.1.0 emoji-mart: ^3.0.1 - eslint: ^8.22.0 + eslint: ^8.20.0 eslint-plugin-import: ^2.26.0 eslint-plugin-react: ^7.30.1 eslint-plugin-react-hooks: ^4.6.0 @@ -5574,11 +5607,11 @@ __metadata: version: 0.0.0-use.local resolution: "@rocket.chat/meteor@workspace:apps/meteor" dependencies: - "@babel/core": ^7.18.13 + "@babel/core": ^7.18.9 "@babel/eslint-parser": ^7.18.9 "@babel/plugin-proposal-nullish-coalescing-operator": ^7.18.6 "@babel/plugin-proposal-optional-chaining": ^7.18.9 - "@babel/preset-env": ^7.18.10 + "@babel/preset-env": ^7.18.9 "@babel/preset-react": ^7.18.6 "@babel/register": ^7.18.9 "@babel/runtime": ^7.18.9 @@ -5607,7 +5640,7 @@ __metadata: "@rocket.chat/fuselage-polyfills": next "@rocket.chat/fuselage-toastbar": next "@rocket.chat/fuselage-tokens": next - "@rocket.chat/fuselage-ui-kit": "workspace:^" + "@rocket.chat/fuselage-ui-kit": next "@rocket.chat/gazzodown": "workspace:^" "@rocket.chat/icons": next "@rocket.chat/layout": next @@ -5691,7 +5724,7 @@ __metadata: "@types/proxy-from-env": ^1.0.1 "@types/proxyquire": ^1.3.28 "@types/psl": ^1.1.0 - "@types/react": ~17.0.48 + "@types/react": ~17.0.47 "@types/react-dom": ~17.0.17 "@types/rewire": ^2.5.28 "@types/semver": ^7.3.10 @@ -5754,7 +5787,7 @@ __metadata: emailreplyparser: ^0.0.5 emojione: ^4.5.0 emojione-assets: ^4.5.0 - eslint: ^8.22.0 + eslint: ^8.20.0 eslint-config-prettier: ^8.5.0 eslint-plugin-anti-trojan-source: ^1.1.0 eslint-plugin-import: ^2.26.0 @@ -5905,7 +5938,7 @@ __metadata: "@rocket.chat/core-typings": "workspace:^" "@types/jest": ^27.4.1 "@types/node-rsa": ^1.1.1 - eslint: ^8.22.0 + eslint: ^8.20.0 jest: ^27.5.1 mongodb: ^4.3.1 ts-jest: ^27.1.5 @@ -5919,7 +5952,7 @@ __metadata: dependencies: "@rocket.chat/model-typings": "workspace:^" "@types/jest": ^27.4.1 - eslint: ^8.22.0 + eslint: ^8.20.0 jest: ^27.5.1 ts-jest: ^27.1.5 typescript: ~4.5.5 @@ -5962,7 +5995,7 @@ __metadata: resolution: "@rocket.chat/poplib@workspace:packages/node-poplib" dependencies: "@types/jest": ^27.4.1 - eslint: ^8.22.0 + eslint: ^8.20.0 jest: ^27.5.1 ts-jest: ^27.1.4 typescript: ~4.5.5 @@ -6038,7 +6071,7 @@ __metadata: "@rocket.chat/ui-kit": next "@types/jest": ^27.4.1 ajv: ^8.11.0 - eslint: ^8.22.0 + eslint: ^8.20.0 jest: ^27.5.1 mongodb: ^4.3.1 ts-jest: ^27.1.5 @@ -6123,7 +6156,6 @@ __metadata: version: 0.0.0-use.local resolution: "@rocket.chat/ui-client@workspace:packages/ui-client" dependencies: - "@babel/core": ~7.18.13 "@rocket.chat/css-in-js": next "@rocket.chat/fuselage": next "@rocket.chat/fuselage-hooks": next @@ -6139,12 +6171,10 @@ __metadata: "@storybook/manager-webpack4": ~6.5.10 "@storybook/react": ~6.5.10 "@storybook/testing-library": ~0.0.13 - "@types/babel__core": ^7 "@types/jest": ^27.4.1 "@types/postcss-url": ^10 - "@types/react": ~17.0.48 - "@types/react-dom": ~17.0.17 - eslint: ^8.22.0 + "@types/react": ~17.0.47 + eslint: ^8.20.0 eslint-plugin-anti-trojan-source: ^1.1.0 eslint-plugin-react: ^7.30.1 eslint-plugin-react-hooks: ^4.6.0 @@ -6165,7 +6195,6 @@ __metadata: "@rocket.chat/fuselage": "*" "@rocket.chat/fuselage-hooks": "*" "@rocket.chat/icons": "*" - "@rocket.chat/ui-contexts": "*" react: ~17.0.2 languageName: unknown linkType: soft @@ -6211,10 +6240,9 @@ __metadata: "@rocket.chat/fuselage-hooks": next "@rocket.chat/rest-typings": "workspace:^" "@types/jest": ^27.4.1 - "@types/react": ~17.0.48 - "@types/react-dom": ~17.0.17 + "@types/react": ^17.0.47 "@types/use-sync-external-store": ^0.0.3 - eslint: ^8.22.0 + eslint: ^8.20.0 jest: ^27.5.1 mongodb: ^4.3.1 react: ~17.0.2 @@ -6238,31 +6266,26 @@ __metadata: languageName: node linkType: hard +"@rocket.chat/ui-kit@npm:~0.32.0-dev.89": + version: 0.32.0-dev.89 + resolution: "@rocket.chat/ui-kit@npm:0.32.0-dev.89" + checksum: 20255ca3b62e288d98eb454375c91c0a494e6e27357f33a61357d6708e8dffdce815c746da03dffef3fc21e04c26ecd53e720a82332f33a532e28a1ac5ac60f4 + languageName: node + linkType: hard + "@rocket.chat/ui-video-conf@workspace:^, @rocket.chat/ui-video-conf@workspace:packages/ui-video-conf": version: 0.0.0-use.local resolution: "@rocket.chat/ui-video-conf@workspace:packages/ui-video-conf" dependencies: - "@babel/core": ~7.18.13 "@rocket.chat/css-in-js": next - "@rocket.chat/emitter": next "@rocket.chat/eslint-config": "workspace:^" "@rocket.chat/fuselage": next "@rocket.chat/fuselage-hooks": next - "@rocket.chat/icons": next "@rocket.chat/styled": next - "@storybook/addon-actions": ~6.5.10 - "@storybook/addon-docs": ~6.5.10 - "@storybook/addon-essentials": ~6.5.10 - "@storybook/builder-webpack4": ~6.5.10 - "@storybook/manager-webpack4": ~6.5.10 - "@storybook/react": ~6.5.10 - "@storybook/testing-library": ~0.0.13 - "@types/babel__core": ^7 "@types/jest": ^27.4.1 - eslint: ^8.22.0 + eslint: ^8.20.0 eslint-plugin-react: ^7.30.1 eslint-plugin-react-hooks: ^4.6.0 - eslint-plugin-storybook: ^0.6.4 jest: ^27.5.1 ts-jest: ^27.1.4 typescript: ~4.5.5 @@ -6270,7 +6293,6 @@ __metadata: "@rocket.chat/css-in-js": "*" "@rocket.chat/fuselage": "*" "@rocket.chat/fuselage-hooks": "*" - "@rocket.chat/icons": "*" "@rocket.chat/styled": "*" react: ^17.0.2 react-dom: ^17.0.2 @@ -8130,7 +8152,7 @@ __metadata: languageName: node linkType: hard -"@tanstack/react-query@npm:^4.0.10, @tanstack/react-query@npm:^4.2.1": +"@tanstack/react-query@npm:^4.0.10": version: 4.2.1 resolution: "@tanstack/react-query@npm:4.2.1" dependencies: @@ -9158,7 +9180,7 @@ __metadata: languageName: node linkType: hard -"@types/react-dom@npm:<18.0.0, @types/react-dom@npm:~17.0.17": +"@types/react-dom@npm:<18.0.0, @types/react-dom@npm:^17.0.11, @types/react-dom@npm:^17.0.17, @types/react-dom@npm:~17.0.17": version: 17.0.17 resolution: "@types/react-dom@npm:17.0.17" dependencies: @@ -9167,7 +9189,16 @@ __metadata: languageName: node linkType: hard -"@types/react@npm:*, @types/react@npm:^17, @types/react@npm:~17.0.48": +"@types/react-dom@npm:^18": + version: 18.0.6 + resolution: "@types/react-dom@npm:18.0.6" + dependencies: + "@types/react": "*" + checksum: db571047af1a567631758700b9f7d143e566df939cfe5fbf7535347cc0c726a1cdbb5e3f8566d076e54cf708b6c1166689de194a9ba09ee35efc9e1d45911685 + languageName: node + linkType: hard + +"@types/react@npm:*, @types/react@npm:^17": version: 17.0.48 resolution: "@types/react@npm:17.0.48" dependencies: @@ -9178,6 +9209,17 @@ __metadata: languageName: node linkType: hard +"@types/react@npm:^17.0.47, @types/react@npm:~17.0.39, @types/react@npm:~17.0.47": + version: 17.0.50 + resolution: "@types/react@npm:17.0.50" + dependencies: + "@types/prop-types": "*" + "@types/scheduler": "*" + csstype: ^3.0.2 + checksum: b5629dff7c2f3e9fcba95a19b2b3bfd78d7cacc33ba5fc26413dba653d34afcac3b93ddabe563e8062382688a1eac7db68e93739bb8e712d27637a03aaafbbb8 + languageName: node + linkType: hard + "@types/responselike@npm:^1.0.0": version: 1.0.0 resolution: "@types/responselike@npm:1.0.0" @@ -16315,7 +16357,7 @@ __metadata: languageName: node linkType: hard -"eslint-scope@npm:^7.1.1": +"eslint-scope@npm:^7.1.0, eslint-scope@npm:^7.1.1": version: 7.1.1 resolution: "eslint-scope@npm:7.1.1" dependencies: @@ -16359,7 +16401,7 @@ __metadata: languageName: node linkType: hard -"eslint-visitor-keys@npm:^3.3.0": +"eslint-visitor-keys@npm:^3.2.0, eslint-visitor-keys@npm:^3.3.0": version: 3.3.0 resolution: "eslint-visitor-keys@npm:3.3.0" checksum: d59e68a7c5a6d0146526b0eec16ce87fbf97fe46b8281e0d41384224375c4e52f5ffb9e16d48f4ea50785cde93f766b0c898e31ab89978d88b0e1720fbfb7808 @@ -16416,12 +16458,12 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^8.21.0, eslint@npm:^8.22.0": - version: 8.23.1 - resolution: "eslint@npm:8.23.1" +"eslint@npm:^8.20.0": + version: 8.24.0 + resolution: "eslint@npm:8.24.0" dependencies: "@eslint/eslintrc": ^1.3.2 - "@humanwhocodes/config-array": ^0.10.4 + "@humanwhocodes/config-array": ^0.10.5 "@humanwhocodes/gitignore-to-minimatch": ^1.0.2 "@humanwhocodes/module-importer": ^1.0.1 ajv: ^6.10.0 @@ -16461,17 +16503,18 @@ __metadata: text-table: ^0.2.0 bin: eslint: bin/eslint.js - checksum: a727e15492786a03b438bcf021db49f715680679846a7b8d79b98ad34576f2a570404ffe882d3c3e26f6359bff7277ef11fae5614bfe8629adb653f20d018c71 + checksum: ca293ce7116599b742d7ab4d43db469beec22f40dd272092d809498be3cff3a7c567769f9763bdf6799aac13dd53447b93a99629b7b54092783046eb57eaced6 languageName: node linkType: hard -"eslint@npm:~8.22.0": - version: 8.22.0 - resolution: "eslint@npm:8.22.0" +"eslint@npm:^8.21.0, eslint@npm:^8.22.0": + version: 8.23.1 + resolution: "eslint@npm:8.23.1" dependencies: - "@eslint/eslintrc": ^1.3.0 + "@eslint/eslintrc": ^1.3.2 "@humanwhocodes/config-array": ^0.10.4 "@humanwhocodes/gitignore-to-minimatch": ^1.0.2 + "@humanwhocodes/module-importer": ^1.0.1 ajv: ^6.10.0 chalk: ^4.0.0 cross-spawn: ^7.0.2 @@ -16481,13 +16524,12 @@ __metadata: eslint-scope: ^7.1.1 eslint-utils: ^3.0.0 eslint-visitor-keys: ^3.3.0 - espree: ^9.3.3 + espree: ^9.4.0 esquery: ^1.4.0 esutils: ^2.0.2 fast-deep-equal: ^3.1.3 file-entry-cache: ^6.0.1 find-up: ^5.0.0 - functional-red-black-tree: ^1.0.1 glob-parent: ^6.0.1 globals: ^13.15.0 globby: ^11.1.0 @@ -16496,6 +16538,7 @@ __metadata: import-fresh: ^3.0.0 imurmurhash: ^0.1.4 is-glob: ^4.0.0 + js-sdsl: ^4.1.4 js-yaml: ^4.1.0 json-stable-stringify-without-jsonify: ^1.0.1 levn: ^0.4.1 @@ -16507,10 +16550,54 @@ __metadata: strip-ansi: ^6.0.1 strip-json-comments: ^3.1.0 text-table: ^0.2.0 + bin: + eslint: bin/eslint.js + checksum: a727e15492786a03b438bcf021db49f715680679846a7b8d79b98ad34576f2a570404ffe882d3c3e26f6359bff7277ef11fae5614bfe8629adb653f20d018c71 + languageName: node + linkType: hard + +"eslint@npm:~8.8.0": + version: 8.8.0 + resolution: "eslint@npm:8.8.0" + dependencies: + "@eslint/eslintrc": ^1.0.5 + "@humanwhocodes/config-array": ^0.9.2 + ajv: ^6.10.0 + chalk: ^4.0.0 + cross-spawn: ^7.0.2 + debug: ^4.3.2 + doctrine: ^3.0.0 + escape-string-regexp: ^4.0.0 + eslint-scope: ^7.1.0 + eslint-utils: ^3.0.0 + eslint-visitor-keys: ^3.2.0 + espree: ^9.3.0 + esquery: ^1.4.0 + esutils: ^2.0.2 + fast-deep-equal: ^3.1.3 + file-entry-cache: ^6.0.1 + functional-red-black-tree: ^1.0.1 + glob-parent: ^6.0.1 + globals: ^13.6.0 + ignore: ^5.2.0 + import-fresh: ^3.0.0 + imurmurhash: ^0.1.4 + is-glob: ^4.0.0 + js-yaml: ^4.1.0 + json-stable-stringify-without-jsonify: ^1.0.1 + levn: ^0.4.1 + lodash.merge: ^4.6.2 + minimatch: ^3.0.4 + natural-compare: ^1.4.0 + optionator: ^0.9.1 + regexpp: ^3.2.0 + strip-ansi: ^6.0.1 + strip-json-comments: ^3.1.0 + text-table: ^0.2.0 v8-compile-cache: ^2.0.3 bin: eslint: bin/eslint.js - checksum: 2d84a7a2207138cdb250759b047fdb05a57fede7f87b7a039d9370edba7f26e23a873a208becfd4b2c9e4b5499029f3fc3b9318da3290e693d25c39084119c80 + checksum: 41a7e85bf84cf9f2d758ef3e8d08020a39a2836703728b59535684681349bd021c2c6e24174462b844a914870d707d2151e0371198899d957b444de91adaa435 languageName: node linkType: hard @@ -16525,7 +16612,7 @@ __metadata: languageName: node linkType: hard -"espree@npm:^9.3.3, espree@npm:^9.4.0": +"espree@npm:^9.3.0, espree@npm:^9.4.0": version: 9.4.0 resolution: "espree@npm:9.4.0" dependencies: @@ -29353,7 +29440,7 @@ __metadata: languageName: node linkType: hard -"react@npm:~17.0.2": +"react@npm:^17.0.2, react@npm:~17.0.2": version: 17.0.2 resolution: "react@npm:17.0.2" dependencies: