chore: minor deps (#33795)

This commit is contained in:
Guilherme Gazzo 2024-10-29 13:28:49 -03:00 committed by GitHub
parent 9925816155
commit 0b396dcd3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
349 changed files with 3153 additions and 2801 deletions

View File

@ -210,7 +210,7 @@ jobs:
path: |
~/.cache/ms-playwright
# This is the version of Playwright that we are using, if you are willing to upgrade, you should update this.
key: playwright-1.40.1
key: playwright-1.48.2
- name: Install Playwright
if: inputs.type == 'ui' && steps.cache-playwright.outputs.cache-hit != 'true'

View File

@ -12,3 +12,4 @@
!/.storybook/
!/client/.eslintrc.js
!/ee/client/.eslintrc.js
/storybook-static/

View File

@ -1,3 +1,4 @@
app/theme/client/vendor/fontello/css/fontello.css
app/meteor-autocomplete/client/autocomplete.css
app/emoji-emojione/client/*.css
storybook-static

View File

@ -189,10 +189,13 @@ export class APIClass<TBasePath extends string = ''> extends Restivus {
}
public setLimitedCustomFields(customFields: string[]): void {
const nonPublicFieds = customFields.reduce((acc, customField) => {
acc[`customFields.${customField}`] = 0;
return acc;
}, {} as Record<string, any>);
const nonPublicFieds = customFields.reduce(
(acc, customField) => {
acc[`customFields.${customField}`] = 0;
return acc;
},
{} as Record<string, any>,
);
this.limitedUserFieldsToExclude = {
...this.defaultLimitedUserFieldsToExclude,
...nonPublicFieds,

View File

@ -22,7 +22,7 @@ export type FailureResult<T, TStack = undefined, TErrorType = undefined, TErrorD
errorType?: TErrorType;
details?: TErrorDetails;
message?: string;
} & (undefined extends TErrorType ? object : { errorType: TErrorType }) &
} & (undefined extends TErrorType ? object : { errorType: TErrorType }) &
(undefined extends TErrorDetails ? object : { details: TErrorDetails extends string ? unknown : TErrorDetails });
};
@ -130,20 +130,20 @@ export type ActionThis<TMethod extends Method, TPathPattern extends PathPattern,
? TOptions extends { validateParams: ValidateFunction<infer T> }
? T
: TOptions extends { validateParams: { GET: ValidateFunction<infer T> } }
? T
: Partial<OperationParams<TMethod, TPathPattern>> & { offset?: number; count?: number }
? T
: Partial<OperationParams<TMethod, TPathPattern>> & { offset?: number; count?: number }
: Record<string, string>;
// TODO make it unsafe
readonly bodyParams: TMethod extends 'GET'
? Record<string, unknown>
: TOptions extends { validateParams: ValidateFunction<infer T> }
? T
: TOptions extends { validateParams: infer V }
? V extends { [key in TMethod]: ValidateFunction<infer T> }
? T
: Partial<OperationParams<TMethod, TPathPattern>>
: // TODO remove the extra (optionals) params when all the endpoints that use these are typed correctly
Partial<OperationParams<TMethod, TPathPattern>>;
: TOptions extends { validateParams: infer V }
? V extends { [key in TMethod]: ValidateFunction<infer T> }
? T
: Partial<OperationParams<TMethod, TPathPattern>>
: // TODO remove the extra (optionals) params when all the endpoints that use these are typed correctly
Partial<OperationParams<TMethod, TPathPattern>>;
readonly request: Request;
readonly queryOperations: TOptions extends { queryOperations: infer T } ? T : never;
@ -163,18 +163,18 @@ export type ActionThis<TMethod extends Method, TPathPattern extends PathPattern,
user: IUser;
userId: string;
readonly token: string;
}
}
: TOptions extends { authOrAnonRequired: true }
? {
user?: IUser;
userId?: string;
readonly token?: string;
}
: {
user?: IUser | null;
userId?: string | undefined;
readonly token?: string;
});
? {
user?: IUser;
userId?: string;
readonly token?: string;
}
: {
user?: IUser | null;
userId?: string | undefined;
readonly token?: string;
});
export type ResultFor<TMethod extends Method, TPathPattern extends PathPattern> =
| SuccessResult<OperationResult<TMethod, TPathPattern>>

View File

@ -35,7 +35,7 @@ API.v1.addRoute(
? {
update: result,
remove: [],
}
}
: result,
);
},

View File

@ -155,7 +155,7 @@ API.v1.addRoute(
: {
twoFactorCode: userData.typedPassword,
twoFactorMethod: 'password',
};
};
await Meteor.callAsync('saveUserProfile', userData, this.bodyParams.customFields, twoFactorOptions);
@ -512,7 +512,7 @@ API.v1.addRoute(
{
$limit: count,
},
]
]
: [];
const result = await Users.col

View File

@ -67,8 +67,8 @@ export const transformMappedData = async <
-readonly [p in keyof MapType]: MapType[p] extends keyof DataType
? DataType[MapType[p]]
: MapType[p] extends (...args: any[]) => any
? Awaited<ReturnType<MapType[p]>>
: never;
? Awaited<ReturnType<MapType[p]>>
: never;
},
DataType extends Record<string, any>,
MapType extends { [p in string]: string | ((data: DataType) => Promise<unknown>) | ((data: DataType) => unknown) },

View File

@ -34,7 +34,7 @@ export const wrapPromise = <T>(
}
> =>
promise
.then((result) => ({ success: true, result } as const))
.then((result) => ({ success: true, result }) as const)
.catch((error) => ({
success: false,
error,

View File

@ -27,7 +27,10 @@ export class CustomOAuth implements IOAuthProvider {
public responseType: string;
constructor(public readonly name: string, options: OauthConfig) {
constructor(
public readonly name: string,
options: OauthConfig,
) {
this.name = name;
if (!Match.test(this.name, String)) {
throw new Meteor.Error('CustomOAuth: Name is required and must be String');

View File

@ -57,10 +57,13 @@ export const getFederatedRoomData = async (
// Find all subscriptions of this room
const s = await Subscriptions.findByRoomIdWhenUsernameExists(room._id).toArray();
const subscriptions = s.reduce((acc, s) => {
acc[s.u._id] = s;
return acc;
}, {} as { [k: string]: ISubscription });
const subscriptions = s.reduce(
(acc, s) => {
acc[s.u._id] = s;
return acc;
},
{} as { [k: string]: ISubscription },
);
// Get all user ids
const userIds = Object.keys(subscriptions);

View File

@ -384,7 +384,7 @@ export const FileUpload = {
? {
width,
height,
}
}
: undefined,
};

View File

@ -545,13 +545,16 @@ export class SlackImporter extends Importer {
// Process the reactions
if (message.reactions && message.reactions.length > 0) {
newMessage.reactions = message.reactions.reduce((newReactions, reaction) => {
const name = `:${reaction.name}:`;
return {
...newReactions,
...(reaction.users?.length ? { name: { name, users: this._replaceSlackUserIds(reaction.users) } } : {}),
};
}, {} as Required<IImportMessage>['reactions']);
newMessage.reactions = message.reactions.reduce(
(newReactions, reaction) => {
const name = `:${reaction.name}:`;
return {
...newReactions,
...(reaction.users?.length ? { name: { name, users: this._replaceSlackUserIds(reaction.users) } } : {}),
};
},
{} as Required<IImportMessage>['reactions'],
);
}
if (message.type === 'message') {

View File

@ -376,7 +376,7 @@ export class UserConverter extends RecordConverter<IImportUserRecord, UserConver
enabled: true,
changedAt: new Date(),
},
}
}
: {}),
},
} as IUser;

View File

@ -60,7 +60,7 @@ export const updateHistory = async ({
...(userData ? { user: omit(userData, 'services') } : {}),
...(roomData ? { room: roomData } : {}),
},
}
}
: {}),
...(triggerWord ? { triggerWord } : {}),
...(typeof ranPrepareScript !== 'undefined' ? { ranPrepareScript } : {}),

View File

@ -181,7 +181,7 @@ Meteor.methods<ServerMethods>({
script: integration.script,
scriptEnabled: integration.scriptEnabled,
scriptEngine,
}),
}),
...(typeof integration.overrideDestinationChannelEnabled !== 'undefined' && {
overrideDestinationChannelEnabled: integration.overrideDestinationChannelEnabled,
}),

View File

@ -91,7 +91,7 @@ Meteor.methods<ServerMethods>({
scriptEnabled: integration.scriptEnabled,
scriptEngine,
...(integration.scriptCompiled ? { scriptCompiled: integration.scriptCompiled } : { scriptError: integration.scriptError }),
}),
}),
triggerWords: integration.triggerWords,
retryFailedCalls: integration.retryFailedCalls,
retryCount: integration.retryCount,
@ -107,7 +107,7 @@ Meteor.methods<ServerMethods>({
$unset: {
...(integration.scriptCompiled ? { scriptError: 1 as const } : { scriptCompiled: 1 as const }),
},
}),
}),
},
);

View File

@ -67,12 +67,12 @@ export const closeLivechatRoom = async (
requestedBy: user,
},
},
}
}
: {
emailTranscript: {
sendToVisitor: false,
},
}),
}),
}),
};

View File

@ -49,7 +49,7 @@ export async function loadMessageHistory({
hiddenMessageTypes,
options,
showThreadMessages,
).toArray()
).toArray()
: await Messages.findVisibleByRoomIdNotContainingTypes(rid, hiddenMessageTypes, options, showThreadMessages).toArray();
const messages = await normalizeMessagesForUser(records, userId);
let unreadNotLoaded = 0;

View File

@ -127,10 +127,13 @@ export class POP3Helper {
start() {
this.log('POP3 started');
this.running = setInterval(() => {
// get new emails and process
this.POP3 = new POP3Intercepter();
}, Math.max(this.frequency * 60 * 1000, 2 * 60 * 1000));
this.running = setInterval(
() => {
// get new emails and process
this.POP3 = new POP3Intercepter();
},
Math.max(this.frequency * 60 * 1000, 2 * 60 * 1000),
);
}
log(...args) {

View File

@ -89,7 +89,7 @@ Meteor.methods<ServerMethods>({
options,
showThreadMessages,
inclusive,
).toArray()
).toArray()
: await Messages.findVisibleByRoomIdBetweenTimestampsNotContainingTypes(
rid,
oldest,
@ -98,7 +98,7 @@ Meteor.methods<ServerMethods>({
options,
showThreadMessages,
inclusive,
).toArray();
).toArray();
const messages = await normalizeMessagesForUser(records, fromUserId);

View File

@ -31,7 +31,7 @@ export const getSecondsSinceLastAgentResponse = async (room: IOmnichannelRoom, a
const department = room.departmentId
? await LivechatDepartment.findOneById<Pick<ILivechatDepartment, 'businessHourId'>>(room.departmentId, {
projection: { businessHourId: 1 },
})
})
: null;
if (department?.businessHourId) {
const businessHour = await LivechatBusinessHours.findOneById(department.businessHourId);

View File

@ -108,7 +108,7 @@ export async function sendTranscript({
messageType.data
? { ...messageType.data(message), interpolation: { escapeValue: false } }
: { interpolation: { escapeValue: false } },
)}</i>`
)}</i>`
: message.msg;
let filesHTML = '';

View File

@ -77,7 +77,7 @@ Meteor.startup(async () => {
process.env.TEST_MODE === 'true'
? {
debounce: 10,
}
}
: undefined,
);

View File

@ -44,7 +44,7 @@ export const replace = (str: string, data: { [key: string]: unknown } = {}): str
? {
fname: strLeft(String(data.name), ' '),
lname: strRightBack(String(data.name), ' '),
}
}
: {}),
...data,
};

View File

@ -484,14 +484,14 @@ class PushClass {
apn: {
...pick(options.apn, 'category'),
},
}
}
: {}),
...(this.hasGcmOptions(options)
? {
gcm: {
...pick(options.gcm, 'image', 'style'),
},
}
}
: {}),
};

View File

@ -987,7 +987,7 @@ export default class SlackAdapter {
const rocketChannel = await this.rocket.getChannel(slackMessage);
const rocketUser = slackMessage.previous_message.user
? (await this.rocket.findUser(slackMessage.previous_message.user)) ||
(await this.rocket.addUser(slackMessage.previous_message.user))
(await this.rocket.addUser(slackMessage.previous_message.user))
: null;
const rocketMsgObj = {

View File

@ -41,7 +41,7 @@ slashCommands.add({
: await Rooms.findOne({
t: 'd',
usernames: { $all: [user.username, strippedRoom] },
});
});
if (!roomObject) {
void api.broadcast('notify.ephemeralMessage', user._id, message.rid, {
msg: i18n.t('Channel_doesnt_exist', {

View File

@ -326,8 +326,7 @@ export const statistics = {
room: IRoom,
) {
return num + (room.prid ? room.msgs : 0);
},
0);
}, 0);
statistics.totalPrivateGroupMessages =
(await privateGroups.reduce(function _countPrivateGroupMessages(num: number, room: IRoom) {
return num + room.msgs;

View File

@ -48,13 +48,16 @@ class MessageBoxActions {
get(group?: TranslationKey) {
if (!group) {
return [...this.actions.entries()].reduce<Record<TranslationKey, MessageBoxAction[]>>((ret, [group, actions]) => {
const filteredActions = actions.filter((action) => !action.condition || action.condition());
if (filteredActions.length) {
ret[group] = filteredActions;
}
return ret;
}, {} as Record<TranslationKey, MessageBoxAction[]>);
return [...this.actions.entries()].reduce<Record<TranslationKey, MessageBoxAction[]>>(
(ret, [group, actions]) => {
const filteredActions = actions.filter((action) => !action.condition || action.condition());
if (filteredActions.length) {
ret[group] = filteredActions;
}
return ret;
},
{} as Record<TranslationKey, MessageBoxAction[]>,
);
}
return this.actions.get(group)?.filter((action) => !action.condition || action.condition());

View File

@ -24,7 +24,7 @@ type DeepWritable<T> = T extends (...args: any) => any
? T
: {
-readonly [P in keyof T]: DeepWritable<T[P]>;
};
};
export class ChatMessages implements ChatAPI {
public uid: string | null;

View File

@ -20,7 +20,7 @@ export const normalizeMessageFileUpload = async (message: Omit<IMessage, '_updat
? getURL(`${FileUpload.getPath(`${file._id}/${encodeURI(file.name)}`).substring(1)}${jwt ? `?token=${jwt}` : ''}`, {
cdn: false,
full: true,
})
})
: '',
type: file.type,
size: file.size,

View File

@ -6,6 +6,6 @@ export function getWebdavCredentials(account: WebDAVClientOptions): WebDAVClient
: {
username: account.username,
password: account.password,
};
};
return cred;
}

View File

@ -257,7 +257,11 @@ class WebRTCClass {
media: MediaStreamConstraints;
constructor(public selfId: string, public room: string, public autoAccept = false) {
constructor(
public selfId: string,
public room: string,
public autoAccept = false,
) {
this.config = {
iceServers: [],
};

View File

@ -79,7 +79,7 @@ export const useStatusItems = (): GenericMenuItemProps[] => {
</Box>
),
},
]
]
: []),
...(statuses ?? []),
{ id: 'custom-status', icon: 'emoji', content: t('Custom_Status'), onClick: handleCustomStatus, disabled: presenceDisabled },

View File

@ -63,7 +63,7 @@ const AutoCompleteDepartmentMultiple = ({
return;
}
return loadMoreDepartments(start, Math.min(50, departmentsTotal));
}
}
}
renderItem={({ label, ...props }) => (
<CheckOption

View File

@ -3,20 +3,19 @@ import { FeaturePreview, FeaturePreviewOff, FeaturePreviewOn } from '@rocket.cha
import type { ComponentProps } from 'react';
import React, { forwardRef, memo } from 'react';
const ContextualbarContent = forwardRef<HTMLElement, ComponentProps<typeof ContextualbarContentComponent>>(function ContextualbarContent(
props,
ref,
) {
return (
<FeaturePreview feature='newNavigation'>
<FeaturePreviewOff>
<ContextualbarContentComponent ref={ref} {...props} />
</FeaturePreviewOff>
<FeaturePreviewOn>
<ContextualbarV2Content ref={ref} {...props} />
</FeaturePreviewOn>
</FeaturePreview>
);
});
const ContextualbarContent = forwardRef<HTMLElement, ComponentProps<typeof ContextualbarContentComponent>>(
function ContextualbarContent(props, ref) {
return (
<FeaturePreview feature='newNavigation'>
<FeaturePreviewOff>
<ContextualbarContentComponent ref={ref} {...props} />
</FeaturePreviewOff>
<FeaturePreviewOn>
<ContextualbarV2Content ref={ref} {...props} />
</FeaturePreviewOn>
</FeaturePreview>
);
},
);
export default memo(ContextualbarContent);

View File

@ -3,20 +3,19 @@ import { FeaturePreview, FeaturePreviewOff, FeaturePreviewOn } from '@rocket.cha
import type { ComponentProps } from 'react';
import React, { forwardRef, memo } from 'react';
const ContextualbarFooter = forwardRef<HTMLElement, ComponentProps<typeof ContextualbarFooterComponent>>(function ContextualbarFooter(
props,
ref,
) {
return (
<FeaturePreview feature='newNavigation'>
<FeaturePreviewOff>
<ContextualbarFooterComponent ref={ref} {...props} />
</FeaturePreviewOff>
<FeaturePreviewOn>
<ContextualbarV2Footer ref={ref} {...props} />
</FeaturePreviewOn>
</FeaturePreview>
);
});
const ContextualbarFooter = forwardRef<HTMLElement, ComponentProps<typeof ContextualbarFooterComponent>>(
function ContextualbarFooter(props, ref) {
return (
<FeaturePreview feature='newNavigation'>
<FeaturePreviewOff>
<ContextualbarFooterComponent ref={ref} {...props} />
</FeaturePreviewOff>
<FeaturePreviewOn>
<ContextualbarV2Footer ref={ref} {...props} />
</FeaturePreviewOn>
</FeaturePreview>
);
},
);
export default memo(ContextualbarFooter);

View File

@ -3,20 +3,19 @@ import { FeaturePreview, FeaturePreviewOff, FeaturePreviewOn } from '@rocket.cha
import type { ComponentProps } from 'react';
import React, { forwardRef, memo } from 'react';
const ContextualbarSection = forwardRef<HTMLElement, ComponentProps<typeof ContextualbarSectionComponent>>(function ContextualbarSection(
props,
ref,
) {
return (
<FeaturePreview feature='newNavigation'>
<FeaturePreviewOff>
<ContextualbarSectionComponent ref={ref} {...props} />
</FeaturePreviewOff>
<FeaturePreviewOn>
<ContextualbarV2Section ref={ref} {...props} />
</FeaturePreviewOn>
</FeaturePreview>
);
});
const ContextualbarSection = forwardRef<HTMLElement, ComponentProps<typeof ContextualbarSectionComponent>>(
function ContextualbarSection(props, ref) {
return (
<FeaturePreview feature='newNavigation'>
<FeaturePreviewOff>
<ContextualbarSectionComponent ref={ref} {...props} />
</FeaturePreviewOff>
<FeaturePreviewOn>
<ContextualbarV2Section ref={ref} {...props} />
</FeaturePreviewOn>
</FeaturePreview>
);
},
);
export default memo(ContextualbarSection);

View File

@ -8,20 +8,19 @@ import {
import type { ComponentProps } from 'react';
import React, { forwardRef, memo } from 'react';
const HeaderToolbarAction = forwardRef<HTMLButtonElement, ComponentProps<typeof HeaderToolbarActionComponent>>(function HeaderToolbarAction(
props,
ref,
) {
return (
<FeaturePreview feature='newNavigation'>
<FeaturePreviewOff>
<HeaderToolbarActionComponent ref={ref} {...props} />
</FeaturePreviewOff>
<FeaturePreviewOn>
<HeaderV2ToolbarAction ref={ref} {...props} />
</FeaturePreviewOn>
</FeaturePreview>
);
});
const HeaderToolbarAction = forwardRef<HTMLButtonElement, ComponentProps<typeof HeaderToolbarActionComponent>>(
function HeaderToolbarAction(props, ref) {
return (
<FeaturePreview feature='newNavigation'>
<FeaturePreviewOff>
<HeaderToolbarActionComponent ref={ref} {...props} />
</FeaturePreviewOff>
<FeaturePreviewOn>
<HeaderV2ToolbarAction ref={ref} {...props} />
</FeaturePreviewOn>
</FeaturePreview>
);
},
);
export default memo(HeaderToolbarAction);

View File

@ -27,7 +27,7 @@ const PageHeader = ({ children = undefined, title, onClickBack, borderBlockEndCo
is='header'
borderBlockEndWidth='default'
pb={8}
borderBlockEndColor={borderBlockEndColor ?? border ? 'extra-light' : 'transparent'}
borderBlockEndColor={(borderBlockEndColor ?? border) ? 'extra-light' : 'transparent'}
{...props}
>
<Box

View File

@ -51,7 +51,7 @@ const RoomAutoComplete = ({ value, onChange, scope = 'regular', renderRoomIcon,
? result.data.items.map(({ name, fname, _id, avatarETag, t, encrypted }) => ({
value: _id,
label: { name: fname || name, avatarETag, type: t, encrypted },
}))
}))
: [],
[result.data?.items, result.isSuccess],
);

View File

@ -31,7 +31,7 @@ const RoomAutoCompleteMultiple = ({ value, onChange, ...props }: RoomAutoComplet
? result.data.items.map(({ fname, name, _id, avatarETag, t }) => ({
value: _id,
label: { name: fname || name, avatarETag, type: t },
}))
}))
: [],
[result.data?.items, result.isSuccess],
);

View File

@ -14,8 +14,9 @@ export default {
},
} satisfies Meta<typeof ConnectionStatusBar>;
const stateDecorator = (value: ContextType<typeof ConnectionStatusContext>) => (fn: () => ReactElement) =>
<ConnectionStatusContext.Provider value={value}>{fn()}</ConnectionStatusContext.Provider>;
const stateDecorator = (value: ContextType<typeof ConnectionStatusContext>) => (fn: () => ReactElement) => (
<ConnectionStatusContext.Provider value={value}>{fn()}</ConnectionStatusContext.Provider>
);
const Template: StoryFn<typeof ConnectionStatusBar> = () => <ConnectionStatusBar />;

View File

@ -42,7 +42,7 @@ const StatusIndicators = ({ message }: StatusIndicatorsProps): ReactElement => {
: t('Message_has_been_edited_by_at', {
username: message.editedBy.username || '?',
date: formatter(message.editedAt),
})
})
}
/>
)}

View File

@ -10,13 +10,7 @@ type AttachmentsProps = {
};
const Attachments = ({ attachments, id }: AttachmentsProps): ReactElement => {
return (
<>
{attachments?.map((attachment, index) => (
<AttachmentsItem key={index} id={id} attachment={{ ...attachment }} />
))}
</>
);
return <>{attachments?.map((attachment, index) => <AttachmentsItem key={index} id={id} attachment={{ ...attachment }} />)}</>;
};
export default Attachments;

View File

@ -11,12 +11,11 @@ export type MessageListContextValue = {
showRoles: boolean;
showRealName: boolean;
showUsername: boolean;
highlights?:
| {
highlight: string;
regex: RegExp;
urlRegex: RegExp;
}[];
highlights?: {
highlight: string;
regex: RegExp;
urlRegex: RegExp;
}[];
katex?: {
dollarSyntaxEnabled: boolean;
parenthesisSyntaxEnabled: boolean;

View File

@ -38,18 +38,21 @@ const MessageActionMenu = ({ options, onChangeMenuVisibility, context, isMessage
...(option.disabled &&
option?.disabled?.(context) && { tooltip: t('Action_not_available_encrypted_content', { action: t(option.label) }) }),
}))
.reduce((acc, option) => {
const group = option.type ? option.type : '';
const section = acc.find((section: { id: string }) => section.id === group);
if (section) {
section.items.push(option);
return acc;
}
const newSection = { id: group, title: group === 'apps' ? t('Apps') : '', items: [option] };
acc.push(newSection);
.reduce(
(acc, option) => {
const group = option.type ? option.type : '';
const section = acc.find((section: { id: string }) => section.id === group);
if (section) {
section.items.push(option);
return acc;
}
const newSection = { id: group, title: group === 'apps' ? t('Apps') : '', items: [option] };
acc.push(newSection);
return acc;
}, [] as unknown as MessageActionSection[])
return acc;
},
[] as unknown as MessageActionSection[],
)
.map((section) => {
if (section.id !== 'apps') {
return section;

View File

@ -6,10 +6,10 @@ import { useMutation } from '@tanstack/react-query';
type UseEndpointActionOptions<TPathPattern extends PathPattern> = (undefined extends UrlParams<TPathPattern>
? {
keys?: UrlParams<TPathPattern>;
}
}
: {
keys: UrlParams<TPathPattern>;
}) & {
}) & {
successMessage?: string;
};
export function useEndpointAction<TMethod extends Method, TPathPattern extends PathPattern>(

View File

@ -17,10 +17,13 @@ const handleFeaturePreviewEnableQuery = (item: FeaturePreviewProps, _: any, feat
const groupFeaturePreview = (features: FeaturePreviewProps[]) =>
Object.entries(
features.reduce((result, currentValue) => {
(result[currentValue.group] = result[currentValue.group] || []).push(currentValue);
return result;
}, {} as Record<FeaturePreviewProps['group'], FeaturePreviewProps[]>),
features.reduce(
(result, currentValue) => {
(result[currentValue.group] = result[currentValue.group] || []).push(currentValue);
return result;
},
{} as Record<FeaturePreviewProps['group'], FeaturePreviewProps[]>,
),
);
export const useFeaturePreviewEnableQuery = (features: FeaturePreviewProps[]) => {

View File

@ -25,10 +25,10 @@ export const useLicenseLimitsByBehavior = () => {
.map((key) => {
const rule = license.limits[key]
?.filter((limit) => validateWarnLimit(limit.max, limits[key].value ?? 0, limit.behavior))
.reduce<{ max: number; behavior: LicenseBehavior } | null>(
(maxLimit, currentLimit) => (!maxLimit || currentLimit.max > maxLimit.max ? currentLimit : maxLimit),
null,
);
.reduce<{
max: number;
behavior: LicenseBehavior;
} | null>((maxLimit, currentLimit) => (!maxLimit || currentLimit.max > maxLimit.max ? currentLimit : maxLimit), null);
if (!rule) {
return undefined;

View File

@ -49,7 +49,7 @@ export const parseMessageTextToAstMarkdown = <
md:
isE2EEMessage(message) || isOTRMessage(message) || isOTRAckMessage(message) || translated
? textToMessageToken(text, parseOptions)
: msg.md ?? textToMessageToken(text, parseOptions),
: (msg.md ?? textToMessageToken(text, parseOptions)),
...(msg.attachments && {
attachments: parseMessageAttachments(msg.attachments, parseOptions, { autoTranslateLanguage, translated }),
}),
@ -79,12 +79,12 @@ export const parseMessageAttachment = <T extends MessageAttachment>(
if (isFileAttachment(attachment) && attachment.description) {
attachment.descriptionMd = translated
? textToMessageToken(text, parseOptions)
: attachment.descriptionMd ?? textToMessageToken(text, parseOptions);
: (attachment.descriptionMd ?? textToMessageToken(text, parseOptions));
}
return {
...attachment,
md: translated ? textToMessageToken(text, parseOptions) : attachment.md ?? textToMessageToken(text, parseOptions),
md: translated ? textToMessageToken(text, parseOptions) : (attachment.md ?? textToMessageToken(text, parseOptions)),
};
};

View File

@ -111,7 +111,7 @@ export const synchronizeUserData = async (uid: IUser['_id']): Promise<RawUserDat
})),
}),
},
}
}
: {}),
...(cloud
? {
@ -119,7 +119,7 @@ export const synchronizeUserData = async (uid: IUser['_id']): Promise<RawUserDat
...cloud,
expiresAt: new Date(cloud.expiresAt),
},
}
}
: {}),
...(emailCode ? { ...emailCode, expire: new Date(emailCode.expire) } : {}),
...(email2fa ? { email2fa: { ...email2fa, changedAt: new Date(email2fa.changedAt) } } : {}),

View File

@ -43,7 +43,7 @@ const createGetEmojiClassNameAndDataTitle =
? emojiElement.style.backgroundImage
: (Object.fromEntries((emojiElement.getAttribute('style') || '')?.split(';').map((s) => s.split(':'))) as Record<string, string>)[
'background-image'
];
];
return {
'className': emojiElement.getAttribute('class') || '',

View File

@ -91,7 +91,10 @@ export class VoIPUser extends Emitter<VoipEvents> {
return this._userState;
}
constructor(private readonly config: VoIPUserConfiguration, mediaRenderer?: IMediaStreamRenderer) {
constructor(
private readonly config: VoIPUserConfiguration,
mediaRenderer?: IMediaStreamRenderer,
) {
super();
this.mediaStreamRendered = mediaRenderer;
this.networkEmitter = new Emitter<SignalingSocketEvents>();

View File

@ -12,13 +12,12 @@ declare module 'meteor/meteor' {
// eslint-disable-next-line @typescript-eslint/no-namespace
namespace Meteor {
function loginWithGoogle(
options?:
| Meteor.LoginWithExternalServiceOptions & {
loginUrlParameters?: {
include_granted_scopes?: boolean;
hd?: string;
};
},
options?: Meteor.LoginWithExternalServiceOptions & {
loginUrlParameters?: {
include_granted_scopes?: boolean;
hd?: string;
};
},
callback?: LoginCallback,
): void;
}

View File

@ -63,7 +63,7 @@ export const DepartmentForwarding = ({ departmentId, value = [], handler, label
return;
}
loadMoreDepartments(start, Math.min(50, departmentsTotal));
}
}
}
renderItem={({ label, ...props }) => (
<CheckOption

View File

@ -66,9 +66,7 @@ const BusinessHoursTable = () => {
<GenericTable>
<GenericTableHeader>{headers}</GenericTableHeader>
<GenericTableBody>
{data?.businessHours.map((businessHour) => (
<BusinessHoursRow key={businessHour._id} {...businessHour} />
))}
{data?.businessHours.map((businessHour) => <BusinessHoursRow key={businessHour._id} {...businessHour} />)}
</GenericTableBody>
</GenericTable>
<Pagination

View File

@ -37,10 +37,13 @@ const AuthorizationProvider = ({ children }: AuthorizationProviderProps) => {
() =>
Roles.find()
.fetch()
.reduce((ret, obj) => {
ret[obj._id] = obj;
return ret;
}, {} as Record<string, IRole>),
.reduce(
(ret, obj) => {
ret[obj._id] = obj;
return ret;
},
{} as Record<string, IRole>,
),
[],
),
);

View File

@ -57,7 +57,7 @@ const EmojiPickerProvider = ({ children }: { children: ReactNode }): ReactElemen
list: createEmojiList(category.key, null, recentEmojis, setRecentEmojis),
limit: category.key === CUSTOM_CATEGORY ? limit | customItemsLimit : null,
},
}
}
: category,
),
);

View File

@ -191,7 +191,7 @@ const OmnichannelProvider = ({ children }: OmnichannelProviderProps) => {
? {
enabled: true,
queue,
}
}
: { enabled: false },
showOmnichannelQueueLink: showOmnichannelQueueLink && !!agentAvailable,
livechatPriorities,

View File

@ -74,7 +74,7 @@ const SettingsProvider = ({ children, privileged = false }: SettingsProviderProp
? { section: query.section }
: {
$or: [{ section: { $exists: false } }, { section: undefined }],
})),
})),
},
{
sort: {

View File

@ -126,7 +126,9 @@ const useAutoLanguage = () => {
const defaultUserLanguage = browserLanguage || serverLanguage || 'en';
// if the language is supported, if not remove the region
const suggestedLanguage = languages.includes(defaultUserLanguage) ? defaultUserLanguage : defaultUserLanguage.split('-').shift() ?? 'en';
const suggestedLanguage = languages.includes(defaultUserLanguage)
? defaultUserLanguage
: (defaultUserLanguage.split('-').shift() ?? 'en');
// usually that value is set based on the user's config language
const [language] = useLocalStorage('userLanguage', suggestedLanguage);

View File

@ -215,7 +215,7 @@ const RoomMenu = ({
label: { label: t('Hide'), icon: 'eye-off' },
action: handleHide,
},
}),
}),
toggleRead: {
label: { label: isUnread ? t('Mark_read') : t('Mark_unread'), icon: 'flag' },
action: handleToggleRead,
@ -229,7 +229,7 @@ const RoomMenu = ({
},
action: handleToggleFavorite,
},
}
}
: {}),
...(canLeave && {
leaveRoom: {

View File

@ -56,7 +56,7 @@ export const VoipFooter = ({
callerState === 'IN_CALL' || callerState === 'ON_HOLD'
? css`
cursor: pointer;
`
`
: '';
const handleHold = (e: MouseEvent<HTMLButtonElement>): void => {

View File

@ -79,7 +79,7 @@ export const useStatusItems = (): GenericMenuItemProps[] => {
</Box>
),
},
]
]
: []),
...(statuses ?? []),
{ id: 'custom-status', icon: 'emoji', content: t('Custom_Status'), onClick: handleCustomStatus, disabled: presenceDisabled },

View File

@ -225,7 +225,7 @@ const RoomMenu = ({
},
action: handleToggleFavorite,
},
}
}
: {}),
...(canLeave && {
leaveRoom: {

View File

@ -56,7 +56,7 @@ const VoipFooter = ({
callerState === 'IN_CALL' || callerState === 'ON_HOLD'
? css`
cursor: pointer;
`
`
: '';
const handleHold = (e: MouseEvent<HTMLButtonElement>): void => {

View File

@ -19,10 +19,13 @@ const commands = {
}
const newUrl = new URL(`${rtrim(baseURI, '/')}/${ltrim(data.path, '/')}`);
const newParams = Array.from(newUrl.searchParams.entries()).reduce((ret, [key, value]) => {
ret[key] = value;
return ret;
}, {} as Record<string, string>);
const newParams = Array.from(newUrl.searchParams.entries()).reduce(
(ret, [key, value]) => {
ret[key] = value;
return ret;
},
{} as Record<string, string>,
);
const newPath = newUrl.pathname.replace(
new RegExp(`^${escapeRegExp(__meteor_runtime_config__.ROOT_URL_PATH_PREFIX)}`),

View File

@ -23,7 +23,7 @@ const ModalContextMock = ({ children }: ModalContextMockProps): ReactElement =>
},
},
currentModal: context.currentModal,
}
}
: undefined,
[context],
);

View File

@ -45,7 +45,7 @@ type Operations = {
fn: (
params: void extends OperationParams<TMethod, TPathPattern> ? void : OperationParams<TMethod, TPathPattern>,
) => Promise<void extends OperationResult<TMethod, TPathPattern> ? Serialized<OperationResult<TMethod, TPathPattern>> : void>;
}
}
: never
: never
: never

View File

@ -35,7 +35,7 @@ const PreferencesMyDataSection = () => {
const text = result.url
? t('UserDataDownload_CompletedRequestExistedWithLink_Text', {
download_link: result.url,
})
})
: t('UserDataDownload_CompletedRequestExisted_Text');
setModal(

View File

@ -92,9 +92,7 @@ const CustomUserStatus = ({ reload, onClick }: CustomUserStatusProps): ReactElem
</GenericTableHeader>
<GenericTableBody>
{isLoading && <GenericTableLoadingTable headerCells={2} />}
{data?.map((status) => (
<CustomUserStatusRow key={status._id} status={status} onClick={onClick} />
))}
{data?.map((status) => <CustomUserStatusRow key={status._id} status={status} onClick={onClick} />)}
</GenericTableBody>
</GenericTable>
{isFetched && (

View File

@ -32,7 +32,7 @@ export const useChannelsList = ({ period, offset, count }: UseChannelsListOption
...response,
start,
end,
}
}
: undefined;
},
{

View File

@ -25,7 +25,7 @@ export const useMessageOrigins = ({ period }: UseMessageOriginsOptions) => {
...response,
start,
end,
}
}
: undefined;
},
{

View File

@ -25,7 +25,7 @@ export const useMessagesSent = ({ period }: UseMessagesSentOptions) => {
...response,
start,
end,
}
}
: undefined;
},
{

View File

@ -25,7 +25,7 @@ export const useTopFivePopularChannels = ({ period }: UseTopFivePopularChannelsO
...response,
start,
end,
}
}
: undefined;
},
{

View File

@ -24,7 +24,7 @@ export const useActiveUsers = ({ utc }: UseActiveUsersOptions) => {
...response,
start,
end,
}
}
: undefined;
},
{

View File

@ -24,7 +24,7 @@ export const useHourlyChatActivity = ({ displacement, utc }: UseHourlyChatActivi
? {
...response,
day,
}
}
: undefined;
},
{

View File

@ -22,7 +22,7 @@ export const useNewUsers = ({ period, utc }: { period: Period['key']; utc: boole
...response,
start,
end,
}
}
: undefined;
},
{

View File

@ -25,7 +25,7 @@ export const useUsersByTimeOfTheDay = ({ period, utc }: UseUsersByTimeOfTheDayOp
...response,
start,
end,
}
}
: undefined;
},
{

View File

@ -24,7 +24,7 @@ export const useWeeklyChatActivity = ({ displacement, utc }: UseWeeklyChatActivi
? {
...response,
day,
}
}
: undefined;
},
{

View File

@ -180,9 +180,7 @@ function ImportHistoryPage() {
{latestOperations.data
.filter(({ _id }) => !currentOperation.data.valid || currentOperation.data._id !== _id)
// Forcing valid=false as the current API only accept preparation/progress over currentOperation
?.map((operation) => (
<ImportOperationSummary key={operation._id} {...operation} valid={false} small={small} />
))}
?.map((operation) => <ImportOperationSummary key={operation._id} {...operation} valid={false} small={small} />)}
</>
)}
</TableBody>

View File

@ -90,7 +90,7 @@ function ImportOperationSummary({
role: 'link',
action: true,
onClick: handleClick,
}
}
: {};
return (

View File

@ -102,9 +102,7 @@ const UsersInRoleTable = ({ rid, roleId, roleName, description }: UsersInRoleTab
<GenericTable>
<GenericTableHeader>{headers}</GenericTableHeader>
<GenericTableBody>
{users?.map((user) => (
<UsersInRoleTableRow onRemove={handleRemove} key={user?._id} user={user} />
))}
{users?.map((user) => <UsersInRoleTableRow onRemove={handleRemove} key={user?._id} user={user} />)}
</GenericTableBody>
</GenericTable>
<Pagination

View File

@ -134,11 +134,7 @@ const RoomsTable = ({ reload }: { reload: MutableRefObject<() => void> }): React
<>
<GenericTable>
<GenericTableHeader>{headers}</GenericTableHeader>
<GenericTableBody>
{data.rooms?.map((room) => (
<RoomRow key={room._id} room={room} />
))}
</GenericTableBody>
<GenericTableBody>{data.rooms?.map((room) => <RoomRow key={room._id} room={room} />)}</GenericTableBody>
</GenericTable>
<Pagination
divider

View File

@ -86,7 +86,7 @@ const EditableSettingsProvider = ({ children, query = defaultQuery }: EditableSe
? { section: query.section }
: {
$or: [{ section: { $exists: false } }, { section: '' }],
})),
})),
},
{
...('tab' in query &&
@ -94,7 +94,7 @@ const EditableSettingsProvider = ({ children, query = defaultQuery }: EditableSe
? { tab: query.tab }
: {
$or: [{ tab: { $exists: false } }, { tab: '' }],
})),
})),
},
],
},
@ -124,7 +124,7 @@ const EditableSettingsProvider = ({ children, query = defaultQuery }: EditableSe
? { tab }
: {
$or: [{ tab: { $exists: false } }, { tab: '' }],
}),
}),
},
{
fields: {

View File

@ -52,7 +52,7 @@ const UsersTableFilters = ({ roleData, setUsersFilters }: UsersTableFiltersProps
id: role._id,
text: role.description || role.name || role._id,
checked: false,
}))
}))
: []),
],
[roleData],

View File

@ -26,6 +26,6 @@ export const useChangeAdminStatusAction = (userId: IUser['_id'], isAdmin: boolea
icon: 'key',
label: isAdmin ? t('Remove_Admin') : t('Make_Admin'),
action: changeAdminStatus,
}
}
: undefined;
};

View File

@ -48,6 +48,6 @@ export const useChangeUserStatusAction = (userId: IUser['_id'], isActive: boolea
icon: 'user',
label: isActive ? t('Deactivate') : t('Activate'),
action: changeActiveStatus,
}
}
: undefined;
};

View File

@ -69,6 +69,6 @@ export const useDeleteUserAction = (userId: IUser['_id'], onChange: () => void,
icon: 'trash',
label: t('Delete'),
action: confirmDeleteUser,
}
}
: undefined;
};

View File

@ -36,6 +36,6 @@ export const useResetE2EEKeyAction = (userId: IUser['_id']): Action | undefined
icon: 'key',
label: t('Reset_E2E_Key'),
action: confirmResetE2EEKey,
}
}
: undefined;
};

View File

@ -37,6 +37,6 @@ export const useResetTOTPAction = (userId: IUser['_id']): Action | undefined =>
icon: 'key',
label: t('Reset_TOTP'),
action: confirmResetTOTP,
}
}
: undefined;
};

View File

@ -33,6 +33,6 @@ export const useVoipExtensionAction = ({ name, username, extension }: VoipExtens
icon: extension ? 'phone-disabled' : 'phone',
label: extension ? t('Unassign_extension') : t('Assign_extension'),
action: handleExtensionAssignment,
}
}
: undefined;
};

View File

@ -32,6 +32,6 @@ export const useVoipExtensionAction = ({ name, username, extension, enabled }: V
icon: extension ? 'phone-disabled' : 'phone',
label: extension ? t('Unassign_extension') : t('Assign_extension'),
action: handleExtensionAssignment,
}
}
: undefined;
};

View File

@ -116,11 +116,11 @@ const VersionCard = ({ serverInfo }: VersionCardProps): ReactElement => {
danger: true,
icon: 'warning',
label: t('Plan_limits_reached'),
}
}
: {
icon: 'check',
label: t('Operating_withing_plan_limits'),
},
},
(isAirgapped || !versions) && {
icon: 'warning',
label: (
@ -157,12 +157,12 @@ const VersionCard = ({ serverInfo }: VersionCardProps): ReactElement => {
? {
icon: 'check',
label: t('Workspace_registered'),
}
}
: {
danger: true,
icon: 'warning',
label: t('Workspace_not_registered'),
},
},
].filter(Boolean) as VersionActionItem[]
).sort((a) => (a.danger ? -1 : 1));
}, [isOverLimits, t, isAirgapped, versions, versionStatus?.label, versionStatus?.expiration, formatDate, isRegistered]);

View File

@ -167,7 +167,7 @@ const DateRangePicker = ({ value, onChange, ...props }: DateRangePickerProps): R
label: t('Previous_month'),
action: () => dispatch('last-month'),
},
} as const),
}) as const,
[dispatch, t],
);

View File

@ -35,13 +35,7 @@ const AppReleases = ({ id }: { id: App['id'] }): ReactElement => {
<>
<Accordion width='100%' alignSelf='center'>
{isLoading && <AccordionLoading />}
{isFetched && (
<>
{data?.map((release) => (
<AppReleasesItem release={release} key={release.version} />
))}
</>
)}
{isFetched && <>{data?.map((release) => <AppReleasesItem release={release} key={release.version} />)}</>}
</Accordion>
</>
);

View File

@ -30,11 +30,11 @@ const ScreenshotCarousel = ({
opacity: '1',
transitionDuration: '1s',
transform: 'scale(1.08)',
}
}
: {
opacity: '0',
transitionDuration: '1s ease',
};
};
return (
<Box style={screenshotWrapperStyle} key={currentScreenshot.id}>

View File

@ -186,21 +186,21 @@ export const appStatusSpanProps = (
? {
label: 'Enabled*',
tooltipText: t('Grandfathered_app'),
}
}
: {
label: 'Enabled',
};
};
}
return migrated && !isEnterprise
? {
label: 'Disabled*',
tooltipText: t('Grandfathered_app'),
}
}
: {
type: 'warning',
label: 'Disabled',
};
};
}
const isFailed = status && appErroredStatuses.includes(status);

Some files were not shown because too many files have changed in this diff Show More