-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Allows multiple emails and phones in edit contact info (#32900)
* feat: get contact data from the new endpoint * feat: allow multiple emails and phone numbers * chore: `ContactManagerInput` to ts * chore: add fields validations
- Loading branch information
1 parent
e87624b
commit b5d9f84
Showing
14 changed files
with
270 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
apps/meteor/client/views/omnichannel/contactInfo/ContactInfo/ContactInfoWithData.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Box } from '@rocket.chat/fuselage'; | ||
import { useEndpoint, usePermission, useTranslation } from '@rocket.chat/ui-contexts'; | ||
import { useQuery } from '@tanstack/react-query'; | ||
import React from 'react'; | ||
|
||
import { ContextualbarSkeleton } from '../../../../components/Contextualbar'; | ||
import ContactInfo from './ContactInfo'; | ||
|
||
type ContactInfoWithDataProps = { | ||
id: string; | ||
onClose: () => void; | ||
}; | ||
|
||
const ContactInfoWithData = ({ id: contactId, onClose }: ContactInfoWithDataProps) => { | ||
const t = useTranslation(); | ||
const canViewCustomFields = usePermission('view-livechat-room-customfields'); | ||
|
||
const getContact = useEndpoint('GET', '/v1/omnichannel/contacts.get'); | ||
const { data, isInitialLoading, isError } = useQuery(['getContactById', contactId], () => getContact({ contactId }), { | ||
enabled: canViewCustomFields && !!contactId, | ||
}); | ||
|
||
if (isInitialLoading) { | ||
return <ContextualbarSkeleton />; | ||
} | ||
|
||
if (isError || !data?.contact) { | ||
return <Box mbs={16}>{t('Contact_not_found')}</Box>; | ||
} | ||
|
||
return <ContactInfo contact={data?.contact} onClose={onClose} />; | ||
}; | ||
|
||
export default ContactInfoWithData; |
1 change: 1 addition & 0 deletions
1
apps/meteor/client/views/omnichannel/contactInfo/ContactInfo/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from './ContactInfoWithData'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.