contact.phone_number.toLowerCase().includes(searchTerm.toLowerCase()) ||
- contact.first_name?.toLowerCase().includes(searchTerm.toLowerCase()) ||
- contact.last_name?.toLowerCase().includes(searchTerm.toLowerCase()) ||
+ contact.firstname?.toLowerCase().includes(searchTerm.toLowerCase()) ||
+ contact.lastname?.toLowerCase().includes(searchTerm.toLowerCase()) ||
contact.nickname?.toLowerCase().includes(searchTerm.toLowerCase())
);
const formatContactDisplay = (contact) => {
const phone = contact.phone_number || 'No phone';
const name =
- [contact.first_name, contact.last_name].filter(Boolean).join(' ') ||
+ [contact.firstname, contact.lastname].filter(Boolean).join(' ') ||
'Unnamed';
const nickname = contact.nickname ? `"${contact.nickname}"` : '';
@@ -117,7 +117,7 @@ function ViewContact({ selectedContact, onSelectedContact }) {
onClick={() => onSelectedContact(contact)}
>
- {contact.first_name?.[0]?.toUpperCase() || '?'}
+ {contact.firstname?.[0]?.toUpperCase() || '?'}
@@ -131,7 +131,7 @@ function ViewContact({ selectedContact, onSelectedContact }) {
)}
- {[contact.first_name, contact.last_name]
+ {[contact.firstname, contact.lastname]
.filter(Boolean)
.join(' ') || 'Unnamed Contact'}
diff --git a/src/components/ViewContactWizard/useViewContactWizard.js b/src/components/ViewContactWizard/useViewContactWizard.js
index f9ed86a..c23848f 100644
--- a/src/components/ViewContactWizard/useViewContactWizard.js
+++ b/src/components/ViewContactWizard/useViewContactWizard.js
@@ -21,13 +21,13 @@ const useViewContactWizard = () => {
case 'modify':
if (!state.contactDetails) return false;
if (
- !state.contactDetails.first_name ||
- state.contactDetails.first_name.trim() === ''
+ !state.contactDetails.firstname ||
+ state.contactDetails.firstname.trim() === ''
) {
return false;
} else if (
- !state.contactDetails.last_name ||
- state.contactDetails.last_name.trim() === ''
+ !state.contactDetails.lastname ||
+ state.contactDetails.lastname.trim() === ''
) {
return false;
} else {
@@ -61,8 +61,8 @@ const useViewContactWizard = () => {
? null
: {
id: contactId,
- first_name: contact.first_name,
- last_name: contact.last_name,
+ firstname: contact.firstname,
+ lastname: contact.lastname,
phone_number: contact.phone_number,
user_id: contact.user_id,
nickname: contact.nickname || '',
@@ -90,8 +90,8 @@ const useViewContactWizard = () => {
step: nextStepValue,
submissionError: null,
contactDetails: {
- first_name: prev.selectedContact.first_name || '',
- last_name: prev.selectedContact.last_name || '',
+ firstname: prev.selectedContact.firstname || '',
+ lastname: prev.selectedContact.lastname || '',
nickname: prev.selectedContact.nickname || '',
phone_number: prev.selectedContact.phone_number || '',
id: prev.selectedContact.id,
@@ -139,10 +139,10 @@ const useViewContactWizard = () => {
console.log('Contact details to update: ', state.contactDetails);
let reqBody = new UpdateContactNamesRequest();
- reqBody.first_name = state.contactDetails.first_name;
- reqBody.last_name = state.contactDetails.last_name;
+ reqBody.firstname = state.contactDetails.firstname;
+ reqBody.lastname = state.contactDetails.lastname;
reqBody.nickname = state.contactDetails.nickname || ''; // Send empty string if no nickname
- reqBody.contact_id = state.selectedContact.id;
+ reqBody.id = state.selectedContact.id;
reqBody.user_id = userId;
const response = await contactApi.updateContactNames(