diff --git a/src/assets/images/icons/SideDrawer/KnowledgeBaseIcon.tsx b/src/assets/images/icons/SideDrawer/KnowledgeBaseIcon.tsx index 9731673c6..1c3f83f2b 100644 --- a/src/assets/images/icons/SideDrawer/KnowledgeBaseIcon.tsx +++ b/src/assets/images/icons/SideDrawer/KnowledgeBaseIcon.tsx @@ -1,12 +1,5 @@ const SvgComponent = ({ color }: { color: string }) => ( - + diff --git a/src/assets/images/icons/SideDrawer/SettingsIcon.tsx b/src/assets/images/icons/SideDrawer/SettingsIcon.tsx index c14ce4bd1..5a7d7f7bd 100644 --- a/src/assets/images/icons/SideDrawer/SettingsIcon.tsx +++ b/src/assets/images/icons/SideDrawer/SettingsIcon.tsx @@ -1,12 +1,6 @@ const SvgComponent = ({ color }: { color: string }) => ( - + diff --git a/src/assets/images/icons/SideDrawer/TagIcon.tsx b/src/assets/images/icons/SideDrawer/TagIcon.tsx index 843a25fca..928a67bc8 100644 --- a/src/assets/images/icons/SideDrawer/TagIcon.tsx +++ b/src/assets/images/icons/SideDrawer/TagIcon.tsx @@ -6,10 +6,7 @@ const SvgComponent = ({ color }: { color: string }) => ( d="M2.26 2.26c-.02.307-.038.647-.052 1.007-.058 1.477-.05 3.16.111 4.434l7.899 7.899 5.382-5.382L7.7 2.319c-1.272-.162-2.957-.17-4.434-.11-.36.014-.699.032-1.008.05ZM.284.284C.18.385-.248 5.25.201 8.255c.048.32.206.608.434.837l8.43 8.43a1.633 1.633 0 0 0 2.306 0l6.15-6.15a1.63 1.63 0 0 0 0-2.308L9.092.635A1.502 1.502 0 0 0 8.255.2C5.25-.247.385.18.285.285Z" clipRule="evenodd" /> - + ); export default SvgComponent; diff --git a/src/common/RichEditor.tsx b/src/common/RichEditor.tsx index dae00eb01..c45b71947 100644 --- a/src/common/RichEditor.tsx +++ b/src/common/RichEditor.tsx @@ -5,8 +5,7 @@ import { UrlMatcher } from 'interweave-autolink'; import { $createParagraphNode, $createTextNode, $getRoot } from 'lexical'; // Indicates how to replace different parts of the text from WhatsApp to HTML. -const regexForLink = - /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)/gi; +const regexForLink = /https?:\/\/(www\.)?[-a-zA-Z0-9@:%._+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)/gi; export const handleFormatterEvents = (event: KeyboardEvent) => { if ((event.ctrlKey || event.metaKey) && event.code === 'KeyB') { @@ -130,9 +129,7 @@ export const WhatsAppTemplateButton = (text: string) => { const buttonsStr = text.substring(isTemplateButtonsPresent); const templateStr = buttonsStr.split('|'); - const buttons = templateStr - .map((val: string) => val && val.trim().slice(1, -1)) - .filter((a) => a); + const buttons = templateStr.map((val: string) => val && val.trim().slice(1, -1)).filter((a) => a); // Checking if template type is call to action or quick reply diff --git a/src/common/constants.ts b/src/common/constants.ts index ccfd899d3..cfe9e7cb7 100644 --- a/src/common/constants.ts +++ b/src/common/constants.ts @@ -23,8 +23,7 @@ export const SIMULATOR_CONTACT = '9876543210'; export const FLOW_STATUS_PUBLISHED = 'published'; export const SIMULATOR_NUMBER_START = '9876543210'; export const GUPSHUP_ENTERPRISE_SHORTCODE = 'gupshup_enterprise'; -export const VALID_URL_REGEX = - 'https?://(www.)?[-a-zA-Z0-9@:%._+~#=]{2,256}.[a-z]{2,4}([-a-zA-Z0-9@:%_+.~#?&/=]*)'; +export const VALID_URL_REGEX = 'https?://(www.)?[-a-zA-Z0-9@:%._+~#=]{2,256}.[a-z]{2,4}([-a-zA-Z0-9@:%_+.~#?&/=]*)'; // to find variables in message export const pattern = /[^{}]+(?=})/g; @@ -131,12 +130,7 @@ export const GROUP_COLLECTION_SEARCH_QUERY_VARIABLES = { }, }; -export const setVariables = ( - filter: any = {}, - limit: any = null, - offset: number = 0, - order: string = 'ASC' -) => ({ +export const setVariables = (filter: any = {}, limit: any = null, offset: number = 0, order: string = 'ASC') => ({ filter, opts: { limit, @@ -248,12 +242,7 @@ export const yupPasswordValidation = (t: any) => export const WA_GROUPS_COLLECTION = 'WA'; export const CONTACTS_COLLECTION = 'WABA'; -export const getVariables = ( - contactOptions: any, - messageOptions: any, - variables: any, - groups?: boolean -) => { +export const getVariables = (contactOptions: any, messageOptions: any, variables: any, groups?: boolean) => { const contactVariable: string = groups ? 'waGroupOpts' : 'contactOpts'; const messageVariable: string = groups ? 'waMessageOpts' : 'messageOpts'; return { diff --git a/src/common/responsive.ts b/src/common/responsive.ts index 9692b22d3..a602fc277 100644 --- a/src/common/responsive.ts +++ b/src/common/responsive.ts @@ -8,8 +8,6 @@ export const showMessages = () => { export const showChats = () => { if (window.innerWidth < 768) { document.querySelector('.chatMessages')?.setAttribute('style', 'display: none '); - document - .querySelector('.ChatConversations') - ?.setAttribute('style', 'display: block !important'); + document.querySelector('.ChatConversations')?.setAttribute('style', 'display: block !important'); } }; diff --git a/src/common/utils.ts b/src/common/utils.ts index fa8d349a9..bb69f3103 100644 --- a/src/common/utils.ts +++ b/src/common/utils.ts @@ -15,8 +15,7 @@ import { CONTACT_FRAGMENT } from 'graphql/mutations/Chat'; import { SIMULATOR_NUMBER_START, STANDARD_DATE_TIME_FORMAT } from './constants'; import { setNotification } from './notification'; -export const isSimulator = (phone: string) => - phone ? phone.startsWith(SIMULATOR_NUMBER_START) : false; +export const isSimulator = (phone: string) => (phone ? phone.startsWith(SIMULATOR_NUMBER_START) : false); export const getObject = (arr: any, data: any) => { const result: any = []; @@ -43,11 +42,7 @@ export { parseText as parseTextMethod }; const validateMediaMethod = (URL: string, attachmentType: string, allowStickers: boolean = true) => new Promise((resolve) => { // check if stickers are allowed instead of image, if not then return early - if ( - !allowStickers && - attachmentType === 'IMAGE' && - URL.slice(-5).toLocaleLowerCase() === '.webp' - ) { + if (!allowStickers && attachmentType === 'IMAGE' && URL.slice(-5).toLocaleLowerCase() === '.webp') { resolve({ data: { is_valid: false, @@ -58,12 +53,9 @@ const validateMediaMethod = (URL: string, attachmentType: string, allowStickers: const encodedUrl = encodeURIComponent(URL); axios - .get( - `${FLOW_EDITOR_API}validate-media?url=${encodedUrl}&type=${attachmentType.toLowerCase()}`, - { - headers: { authorization: getAuthSession('access_token') }, - } - ) + .get(`${FLOW_EDITOR_API}validate-media?url=${encodedUrl}&type=${attachmentType.toLowerCase()}`, { + headers: { authorization: getAuthSession('access_token') }, + }) .then((response: any) => { resolve(response); }) @@ -95,8 +87,7 @@ const checkSessionValidityMethod = async () => { export { checkSessionValidityMethod as checkSessionValidity }; // function to get the random number with min and max -export const randomIntFromInterval = (min: number, max: number) => - Math.floor(Math.random() * (max - min + 1) + min); +export const randomIntFromInterval = (min: number, max: number) => Math.floor(Math.random() * (max - min + 1) + min); export const copyToClipboardMethod = (text: string) => { if (text) { @@ -222,12 +213,8 @@ export const getAddOrRemoveRoleIds = (roles: any, payload: any) => { const initialSelectedRoles = roles.map((role: any) => role.id); const payloadRoleIds = payload.roles.map((role: any) => role.id); - let addRoleIds = payloadRoleIds.filter( - (selectedRoles: any) => !initialSelectedRoles.includes(selectedRoles) - ); - const deleteRoleIds = initialSelectedRoles.filter( - (roleId: any) => !payloadRoleIds.includes(roleId) - ); + let addRoleIds = payloadRoleIds.filter((selectedRoles: any) => !initialSelectedRoles.includes(selectedRoles)); + const deleteRoleIds = initialSelectedRoles.filter((roleId: any) => !payloadRoleIds.includes(roleId)); if (checkDynamicRole()) { const userRoles = getUserSession('roles').map((role: any) => role.id); diff --git a/src/components/UI/DialogBox/DialogBox.test.tsx b/src/components/UI/DialogBox/DialogBox.test.tsx index 3567ed50c..a15a41b5b 100644 --- a/src/components/UI/DialogBox/DialogBox.test.tsx +++ b/src/components/UI/DialogBox/DialogBox.test.tsx @@ -16,12 +16,7 @@ const dialogBox = ( it('should not display dialog box if open is false', () => { const { queryByTestId } = render( - + ); expect(queryByTestId('dialogBox')).toBe(null); @@ -46,12 +41,7 @@ it('should check if callback method is called when confirm button is clicked', ( it('Dialogbox with no ok and cancel buttons', () => { const { container } = render( - + ); expect(container).toBeInTheDocument(); }); diff --git a/src/components/UI/DialogBox/DialogBox.tsx b/src/components/UI/DialogBox/DialogBox.tsx index 7156b585b..2b005a06b 100644 --- a/src/components/UI/DialogBox/DialogBox.tsx +++ b/src/components/UI/DialogBox/DialogBox.tsx @@ -54,12 +54,7 @@ export const DialogBox = ({ let cancelButtonDisplay = null; if (!skipCancel) { cancelButtonDisplay = ( -
- + {placeholder && ( {placeholder} @@ -69,9 +65,7 @@ export const Dropdown = ({ {form && form.errors[field.name] && form.touched[field.name] ? ( {form.errors[field.name]} ) : null} - {helperText ? ( - {helperText} - ) : null} + {helperText ? {helperText} : null}
); diff --git a/src/components/UI/Form/EmojiInput/Editor.test.tsx b/src/components/UI/Form/EmojiInput/Editor.test.tsx index 5ede9f184..59a2e7af7 100644 --- a/src/components/UI/Form/EmojiInput/Editor.test.tsx +++ b/src/components/UI/Form/EmojiInput/Editor.test.tsx @@ -25,11 +25,7 @@ vi.mock('lexical-beautiful-mentions', async (importOriginal) => { const wrapper = ( - {} }} - placeholder={''} - onChange={handleChange} - /> + {} }} placeholder={''} onChange={handleChange} /> ); diff --git a/src/components/UI/Form/EmojiInput/Editor.tsx b/src/components/UI/Form/EmojiInput/Editor.tsx index c5c1b8259..4d49fb2b6 100644 --- a/src/components/UI/Form/EmojiInput/Editor.tsx +++ b/src/components/UI/Form/EmojiInput/Editor.tsx @@ -2,13 +2,7 @@ import styles from './Editor.module.css'; import { forwardRef, useEffect } from 'react'; import { PlainTextPlugin } from '@lexical/react/LexicalPlainTextPlugin'; import { ContentEditable } from '@lexical/react/LexicalContentEditable'; -import { - $getSelection, - $createTextNode, - $getRoot, - KEY_DOWN_COMMAND, - COMMAND_PRIORITY_LOW, -} from 'lexical'; +import { $getSelection, $createTextNode, $getRoot, KEY_DOWN_COMMAND, COMMAND_PRIORITY_LOW } from 'lexical'; import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin'; import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext'; import LexicalErrorBoundary from '@lexical/react/LexicalErrorBoundary'; @@ -118,26 +112,17 @@ export const Editor = ({ disabled = false, ...props }: EditorProps) => { {form && form.errors[field.name] && form.touched[field.name] ? ( {form.errors[field.name]} ) : null} - {props.helperText && ( - {props.helperText} - )} + {props.helperText && {props.helperText}} ); }; -const CustomMenu = forwardRef( - ({ open, loading, ...props }, ref) =>