@trii/components 2.0.38 → 2.0.41

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -9018,6 +9018,10 @@ var utils = /*#__PURE__*/Object.freeze({
9018
9018
  useIsFocusVisible: useIsFocusVisible
9019
9019
  });
9020
9020
 
9021
+ var Edit$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9022
+ d: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"
9023
+ }), 'Edit');
9024
+
9021
9025
  var Email$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9022
9026
  d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 4-8 5-8-5V6l8 5 8-5z"
9023
9027
  }), 'Email');
@@ -9040,6 +9044,10 @@ var PhoneEnabled = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9040
9044
  d: "m17.38 10.79-2.2-2.2c-.28-.28-.36-.67-.25-1.02.37-1.12.57-2.32.57-3.57 0-.55.45-1 1-1H20c.55 0 1 .45 1 1 0 9.39-7.61 17-17 17-.55 0-1-.45-1-1v-3.49c0-.55.45-1 1-1 1.24 0 2.45-.2 3.57-.57.35-.12.75-.03 1.02.24l2.2 2.2c2.83-1.45 5.15-3.76 6.59-6.59"
9041
9045
  }), 'PhoneEnabled');
9042
9046
 
9047
+ var Save$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9048
+ d: "M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"
9049
+ }), 'Save');
9050
+
9043
9051
  var Star = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9044
9052
  d: "M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"
9045
9053
  }), 'Star');
@@ -9208,7 +9216,7 @@ const TitleBox = material.styled(material.Box)({
9208
9216
  width: '100%',
9209
9217
  borderBottom: `1px solid lightgray`,
9210
9218
  });
9211
- const StyledBox$3 = material.styled(material.Box)({
9219
+ const StyledBox$2 = material.styled(material.Box)({
9212
9220
  display: 'flex',
9213
9221
  alignItems: 'center',
9214
9222
  justifyContent: 'space-between',
@@ -9249,7 +9257,7 @@ const NoteText$2 = material.styled(material.Typography)({
9249
9257
  left: 40,
9250
9258
  });
9251
9259
  const ContactMethod$1 = ({ icon, contactList, title, showTitle = true, }) => {
9252
- const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox$3, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
9260
+ const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox$2, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
9253
9261
  whiteSpace: 'nowrap',
9254
9262
  textOverflow: 'ellipsis',
9255
9263
  overflow: 'hidden',
@@ -15403,7 +15411,15 @@ const TranslationProvider = ({ t, children }) => {
15403
15411
  };
15404
15412
  const useTranslationContext = () => {
15405
15413
  const t = React$1.useContext(TranslationContext);
15406
- return t || noop$3;
15414
+ if (!t) {
15415
+ console.warn('[useTranslationContext] using noop, context value is falsy');
15416
+ return noop$3;
15417
+ }
15418
+ return (...args) => {
15419
+ const [key, ...rest] = args;
15420
+ const result = t(key, ...rest);
15421
+ return result;
15422
+ };
15407
15423
  };
15408
15424
 
15409
15425
  const Tags = ({ tags, onEditTags }) => {
@@ -15461,6 +15477,87 @@ const Tags = ({ tags, onEditTags }) => {
15461
15477
  } }, tag.id))) })] }) })] }));
15462
15478
  };
15463
15479
 
15480
+ const EditContactApiContext = React$1.createContext(null);
15481
+ const EditContactApiProvider = EditContactApiContext.Provider;
15482
+ const useEditContactApi = () => {
15483
+ return React$1.useContext(EditContactApiContext);
15484
+ };
15485
+
15486
+ const NameText = material.styled(material.Typography)({
15487
+ whiteSpace: 'nowrap',
15488
+ overflow: 'hidden',
15489
+ textOverflow: 'ellipsis',
15490
+ maxWidth: 360,
15491
+ textAlign: 'center',
15492
+ });
15493
+ const NameWrapper = material.styled(material.Box)({
15494
+ display: 'flex',
15495
+ alignItems: 'center',
15496
+ justifyContent: 'center',
15497
+ gap: '8px',
15498
+ width: '100%',
15499
+ '&:hover .edit-icon': {
15500
+ opacity: 1,
15501
+ visibility: 'visible',
15502
+ },
15503
+ });
15504
+ const EditButton = material.styled(material.IconButton)({
15505
+ opacity: 0,
15506
+ visibility: 'hidden',
15507
+ transition: 'all 0.2s',
15508
+ });
15509
+ const ContactName = ({ displayName, contactType, firstName, lastName, name, entityId, onEntityUpdated, }) => {
15510
+ const api = useEditContactApi();
15511
+ const [isEditing, setIsEditing] = React$1.useState(false);
15512
+ const [loading, setLoading] = React$1.useState(false);
15513
+ const [values, setValues] = React$1.useState({
15514
+ firstName: firstName || '',
15515
+ lastName: lastName || '',
15516
+ name: name || '',
15517
+ });
15518
+ React$1.useEffect(() => {
15519
+ setValues({
15520
+ firstName: firstName || '',
15521
+ lastName: lastName || '',
15522
+ name: name || '',
15523
+ });
15524
+ }, [firstName, lastName, name]);
15525
+ const handleSave = async () => {
15526
+ if (!api || !entityId || !contactType || contactType === 'unknown')
15527
+ return;
15528
+ setLoading(true);
15529
+ try {
15530
+ let body = {};
15531
+ if (contactType === 'contact') {
15532
+ body = { firstName: values.firstName, lastName: values.lastName };
15533
+ }
15534
+ else if (contactType === 'business') {
15535
+ body = { name: values.name };
15536
+ }
15537
+ const updated = await api.updateEntity({
15538
+ entityType: contactType,
15539
+ entityId,
15540
+ body,
15541
+ });
15542
+ if (updated && onEntityUpdated) {
15543
+ onEntityUpdated(updated);
15544
+ }
15545
+ setIsEditing(false);
15546
+ }
15547
+ catch (err) {
15548
+ console.error('Failed to update name', err);
15549
+ }
15550
+ finally {
15551
+ setLoading(false);
15552
+ }
15553
+ };
15554
+ const showEdit = contactType === 'contact' || contactType === 'business';
15555
+ if (isEditing) {
15556
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { display: 'flex', alignItems: 'center', gap: 1, mt: 1 }, children: [contactType === 'contact' ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(material.TextField, { value: values.firstName, onChange: (e) => setValues({ ...values, firstName: e.target.value }), size: "small", placeholder: "First Name", sx: { width: 140 } }), jsxRuntimeExports.jsx(material.TextField, { value: values.lastName, onChange: (e) => setValues({ ...values, lastName: e.target.value }), size: "small", placeholder: "Last Name", sx: { width: 140 } })] })) : (jsxRuntimeExports.jsx(material.TextField, { value: values.name, onChange: (e) => setValues({ ...values, name: e.target.value }), size: "small", placeholder: "Name", sx: { width: 280 } })), jsxRuntimeExports.jsx(material.IconButton, { onClick: handleSave, disabled: loading, color: "primary", children: loading ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(Save$1, {}) })] }));
15557
+ }
15558
+ return (jsxRuntimeExports.jsxs(NameWrapper, { children: [jsxRuntimeExports.jsx(NameText, { variant: "h6", title: displayName, children: displayName }), showEdit && (jsxRuntimeExports.jsx(EditButton, { size: "small", onClick: () => setIsEditing(true), className: "edit-icon", children: jsxRuntimeExports.jsx(Edit$1, { fontSize: "small" }) }))] }));
15559
+ };
15560
+
15464
15561
  var Delete = {};
15465
15562
 
15466
15563
  var _interopRequireDefault$c = interopRequireDefaultExports;
@@ -15536,16 +15633,9 @@ const HeaderContainer = material.styled(material.Box)({
15536
15633
  marginBottom: '20px',
15537
15634
  position: 'relative',
15538
15635
  });
15539
- const ContactName = material.styled(material.Typography)({
15540
- whiteSpace: 'nowrap',
15541
- overflow: 'hidden',
15542
- textOverflow: 'ellipsis',
15543
- maxWidth: 360,
15544
- textAlign: 'center',
15545
- });
15546
- const Header = ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
15636
+ const Header = ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, contactType, firstName, lastName, name, entityId, onEntityUpdated, }) => {
15547
15637
  const avatarAlt = `Avatar for ${displayName}`;
15548
- return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsx("input", { ref: photoInputRef, type: "file", accept: "image/*", onChange: onPhotoFileChange, style: { display: 'none' } }), jsxRuntimeExports.jsx(AvatarWithActions, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')), onUpload: onUploadPhoto, isUploading: isUploadingPhoto, onDelete: onDeletePhoto, isDeleting: isDeletingPhoto }), jsxRuntimeExports.jsx(ContactName, { variant: "h6", title: displayName, children: displayName }), jsxRuntimeExports.jsx(Tags, { tags: tags, onEditTags: onEditTags })] }));
15638
+ return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsx("input", { ref: photoInputRef, type: "file", accept: "image/*", onChange: onPhotoFileChange, style: { display: 'none' } }), jsxRuntimeExports.jsx(AvatarWithActions, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')), onUpload: onUploadPhoto, isUploading: isUploadingPhoto, onDelete: onDeletePhoto, isDeleting: isDeletingPhoto }), jsxRuntimeExports.jsx(ContactName, { displayName: displayName, contactType: contactType, firstName: firstName, lastName: lastName, name: name, entityId: entityId, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(Tags, { tags: tags, onEditTags: onEditTags })] }));
15549
15639
  };
15550
15640
 
15551
15641
  var ArrowBack = {};
@@ -26316,12 +26406,6 @@ const useEditEntity = () => {
26316
26406
  return ctx;
26317
26407
  };
26318
26408
 
26319
- const EditContactApiContext = React$1.createContext(null);
26320
- const EditContactApiProvider = EditContactApiContext.Provider;
26321
- const useEditContactApi = () => {
26322
- return React$1.useContext(EditContactApiContext);
26323
- };
26324
-
26325
26409
  const resolveUserLabel = ({ userId, users, currentUser, }) => {
26326
26410
  if (!userId)
26327
26411
  return null;
@@ -52445,7 +52529,7 @@ default_1$8 = Cancel.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _
52445
52529
 
52446
52530
  const isUserInfo = (option) => 'email' in option;
52447
52531
  const isContactBirthdayProps = (p) => p.entityType === 'contact' && p.inputType === 'birthday';
52448
- const StyledIconButton$3 = material.styled(material.IconButton)({
52532
+ const StyledIconButton$2 = material.styled(material.IconButton)({
52449
52533
  opacity: 0,
52450
52534
  transition: 'opacity 0.3s ease-in-out',
52451
52535
  '& .MuiSvgIcon-root': {
@@ -52461,7 +52545,7 @@ const StyledSaveCancelButton$1 = material.styled(material.IconButton)({
52461
52545
  },
52462
52546
  });
52463
52547
  const EntityInfoLabel = (props) => {
52464
- const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated, } = props;
52548
+ const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated } = props;
52465
52549
  const t = useTranslationContext();
52466
52550
  const inputType = props.inputType ?? 'text';
52467
52551
  const [isEditing, setIsEditing] = React$1.useState(false);
@@ -52575,9 +52659,12 @@ const EntityInfoLabel = (props) => {
52575
52659
  '&:hover .edit-icon': {
52576
52660
  opacity: 1,
52577
52661
  },
52578
- }, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(material.Typography, { letterSpacing: -0.5, fontWeight: '600', alignSelf: 'center', flexGrow: isEditing ? 1 : 0, color: (theme) => theme.palette.text.primary, children: title }), isNotEditable ? null : isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$3, { className: "edit-icon", size: "small", onClick: handleEditClick, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(material.Box, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(material.TextField, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(material.Select, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(material.MenuItem, { value: "", children: t('contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(material.MenuItem, { value: option.id, children: props.entityType === 'contact'
52662
+ }, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(material.Typography, { letterSpacing: -0.5, fontWeight: '600', alignSelf: 'center', flexGrow: isEditing ? 1 : 0, color: (theme) => theme.palette.text.primary, children: title }), isNotEditable ? null : isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$2, { className: "edit-icon", size: "small", onClick: handleEditClick, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(material.Box, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(material.TextField, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(material.Select, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(material.MenuItem, { value: "", children: t('conversations.contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(material.MenuItem, { value: option.id, children: props.entityType === 'contact'
52579
52663
  ? option.name?.trim() || (isUserInfo(option) ? option.email : '') || 'Sin nombre'
52580
- : option.name?.trim() || option.email || 'Sin nombre' }, index)))] })) : isEditing && isContactBirthdayProps(props) ? (jsxRuntimeExports.jsx(DateSelect, { birthDate: props.contact.field.birthDate, setBirthDate: props.contact.action.setBirthDate, dateFormat: props.dateFormat })) : !isEditing && props.entityType === 'contact' && inputType === 'selectBusiness' && props.businessId ? (jsxRuntimeExports.jsx(material.Box, { display: "flex", alignItems: "center", children: "Popover" })) : (jsxRuntimeExports.jsx(material.Typography, { fontWeight: '400', sx: { padding: '2.5px 14px 8.5px 0px' }, color: (theme) => theme.palette.text.primary, children: displayValue || (typeof value === 'string' && value) || '-' })) })] }));
52664
+ : option.name?.trim() || option.email || 'Sin nombre' }, index)))] })) : isEditing && isContactBirthdayProps(props) ? (jsxRuntimeExports.jsx(DateSelect, { birthDate: props.contact.field.birthDate, setBirthDate: props.contact.action.setBirthDate, dateFormat: props.dateFormat })) : !isEditing &&
52665
+ props.entityType === 'contact' &&
52666
+ inputType === 'selectBusiness' &&
52667
+ props.businessId ? (jsxRuntimeExports.jsx(material.Box, { display: "flex", alignItems: "center", children: "Popover" })) : (jsxRuntimeExports.jsx(material.Typography, { fontWeight: '400', sx: { padding: '2.5px 14px 8.5px 0px' }, color: (theme) => theme.palette.text.primary, children: displayValue || (typeof value === 'string' && value) || '-' })) })] }));
52581
52668
  };
52582
52669
 
52583
52670
  const ContactInfoLabel = (props) => {
@@ -54383,7 +54470,7 @@ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat })
54383
54470
  }, value: value || initDates, onChange: (newValue) => handleChange(newValue), format: dateFormat }) }) }));
54384
54471
  };
54385
54472
 
54386
- const StyledIconButton$2 = material.styled(material.IconButton)(() => ({
54473
+ const StyledIconButton$1 = material.styled(material.IconButton)(() => ({
54387
54474
  opacity: 0,
54388
54475
  transition: 'opacity 0.3s ease-in-out',
54389
54476
  '& .MuiSvgIcon-root': {
@@ -54585,7 +54672,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54585
54672
  else
54586
54673
  return (jsxRuntimeExports.jsx(CustomPropertyInput, { type: type, nameKey: nameKey, value: value, onChange: handleInputChange }));
54587
54674
  };
54588
- return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT ? 'contacts-col-12' : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: "25px", children: [jsxRuntimeExports.jsx(FieldName, { flexGrow: isEditing ? 1 : 0, children: getPropertyName(property.nameKey) }), isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$2, { className: "edit-icon", size: "small", onClick: toggleEdit, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(material.Box, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT ? '100%' : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
54675
+ return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT ? 'contacts-col-12' : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: "25px", children: [jsxRuntimeExports.jsx(FieldName, { flexGrow: isEditing ? 1 : 0, children: getPropertyName(property.nameKey) }), isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$1, { className: "edit-icon", size: "small", onClick: toggleEdit, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(material.Box, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT ? '100%' : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
54589
54676
  ? property.type === Contacts.ContactField_type.DATERANGE
54590
54677
  ? (() => {
54591
54678
  if (typeof property.value === 'string') {
@@ -54711,9 +54798,9 @@ const ContactGeneral = (props) => {
54711
54798
  }
54712
54799
  return age;
54713
54800
  };
54714
- return (jsxRuntimeExports.jsx(Section, { title: "General", children: jsxRuntimeExports.jsxs(SectionContent, { children: [jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.contactOwner'), displayValue: owner || '-', value: entityData.owner, inputType: "select", options: users, constructUpdateObject: (value) => ({
54801
+ return (jsxRuntimeExports.jsx(Section, { title: "General", children: jsxRuntimeExports.jsxs(SectionContent, { children: [jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('conversations.contactDetails.contactOwner'), displayValue: owner || '-', value: entityData.owner, inputType: "select", options: users, constructUpdateObject: (value) => ({
54715
54802
  owner: typeof value === 'string' ? value : '',
54716
- }), contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.business'), displayValue: entityData.businessName || '-', value: entityData.businessId, inputType: "selectBusiness", businessId: entityData.businessId, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.createdBy'), value: createdBy || '-', isNotEditable: true, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.modifiedBy'), value: updatedBy || '-', isNotEditable: true, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('global.birthdate'), inputType: "birthday", displayValue: birthDate ? `${dateOnlyString} (${calculateAge(birthDate.toDate())})` : '-', value: birthDate ? birthDate.toISOString() : '', constructUpdateObject: (value) => ({
54803
+ }), contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('conversations.contactDetails.business'), displayValue: entityData.businessName || '-', value: entityData.businessId, inputType: "selectBusiness", businessId: entityData.businessId, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('conversations.contactDetails.createdBy'), value: createdBy || '-', isNotEditable: true, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('conversations.contactDetails.modifiedBy'), value: updatedBy || '-', isNotEditable: true, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('global.birthdate'), inputType: "birthday", displayValue: birthDate ? `${dateOnlyString} (${calculateAge(birthDate.toDate())})` : '-', value: birthDate ? birthDate.toISOString() : '', constructUpdateObject: (value) => ({
54717
54804
  birthDate: value,
54718
54805
  }), contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, dateFormat: dateFormat, onEntityUpdated: onEntityUpdated }), editContact.field.customProperties.map((property) => (jsxRuntimeExports.jsx(EntityCustomFieldLabel, { property: property, entity: editContact, entityType: "contact", entityId: String(entityData.id), customContactFields: customContactFields, userTrii: currentUser, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: onEntityUpdated }, property.nameKey)))] }) }));
54719
54806
  };
@@ -54788,9 +54875,9 @@ const BusinessGeneral = (props) => {
54788
54875
  controller.abort();
54789
54876
  };
54790
54877
  }, [api, entityData, users, currentUser]);
54791
- return (jsxRuntimeExports.jsx(Section, { title: "General", children: jsxRuntimeExports.jsxs(SectionContent, { children: [jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('businessDetails.businessOwner'), value: entityData.owner, displayValue: owner || '-', inputType: "select", options: users, constructUpdateObject: (value) => ({
54878
+ return (jsxRuntimeExports.jsx(Section, { title: "General", children: jsxRuntimeExports.jsxs(SectionContent, { children: [jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('conversations.businessDetails.businessOwner'), value: entityData.owner, displayValue: owner || '-', inputType: "select", options: users, constructUpdateObject: (value) => ({
54792
54879
  owner: typeof value === 'string' ? value : '',
54793
- }), baseUrl: baseUrl, spaceId: spaceId, businessId: entityData.id, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('contactDetails.createdBy'), value: createdBy || '-', isNotEditable: true }), jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('contactDetails.modifiedBy'), value: updatedBy || '-', isNotEditable: true }), editBusiness.field.customProperties.map((property) => (jsxRuntimeExports.jsx(EntityCustomFieldLabel, { property: property, entity: editBusiness, entityType: "business", entityId: String(entityData.id), customContactFields: customContactFields, userTrii: currentUser, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: onEntityUpdated }, property.nameKey)))] }) }));
54880
+ }), baseUrl: baseUrl, spaceId: spaceId, businessId: entityData.id, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('conversations.contactDetails.createdBy'), value: createdBy || '-', isNotEditable: true }), jsxRuntimeExports.jsx(BusinessInfoLabel, { title: t('conversations.contactDetails.modifiedBy'), value: updatedBy || '-', isNotEditable: true }), editBusiness.field.customProperties.map((property) => (jsxRuntimeExports.jsx(EntityCustomFieldLabel, { property: property, entity: editBusiness, entityType: "business", entityId: String(entityData.id), customContactFields: customContactFields, userTrii: currentUser, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: onEntityUpdated }, property.nameKey)))] }) }));
54794
54881
  };
54795
54882
 
54796
54883
  const General = (props) => {
@@ -54818,7 +54905,7 @@ const useEditModal = () => {
54818
54905
  return { isOpen, title, openModal, closeModal };
54819
54906
  };
54820
54907
 
54821
- const StyledBox$2 = styled$1(material.Box)(({ theme }) => ({
54908
+ const StyledBox$1 = styled$1(material.Box)(({ theme }) => ({
54822
54909
  display: 'flex',
54823
54910
  alignItems: 'flex-start',
54824
54911
  justifyContent: 'space-between',
@@ -54885,7 +54972,7 @@ const ContactMethodItem = ({ item }) => {
54885
54972
  const { imageUrl } = useImage({
54886
54973
  initialImageUrl: avatarUrlWithoutAccess,
54887
54974
  });
54888
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$2, { children: [jsxRuntimeExports.jsx(LeftSection$1, { children: jsxRuntimeExports.jsxs(ContactDetails$1, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: item.address || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText$1, { children: item.address }) }), jsxRuntimeExports.jsx(material.Tooltip, { title: item.profileName || '', arrow: true, children: jsxRuntimeExports.jsx(ProfileNameText, { sx: {
54975
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$1, { children: [jsxRuntimeExports.jsx(LeftSection$1, { children: jsxRuntimeExports.jsxs(ContactDetails$1, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: item.address || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText$1, { children: item.address }) }), jsxRuntimeExports.jsx(material.Tooltip, { title: item.profileName || '', arrow: true, children: jsxRuntimeExports.jsx(ProfileNameText, { sx: {
54889
54976
  marginTop: '-10px',
54890
54977
  marginLeft: '5px',
54891
54978
  fontSize: '10px',
@@ -56145,7 +56232,7 @@ const formatPhoneForDisplay = (number) => {
56145
56232
  }
56146
56233
  };
56147
56234
 
56148
- const StyledIconButton$1 = styled$1(material.IconButton)(({ theme }) => ({
56235
+ const StyledIconButton = styled$1(material.IconButton)(({ theme }) => ({
56149
56236
  padding: theme.spacing(0.5),
56150
56237
  marginTop: '-5px',
56151
56238
  }));
@@ -56154,7 +56241,7 @@ const StyledLocalPhoneIcon = styled$1(default_1$7)(({ theme }) => ({
56154
56241
  width: 16,
56155
56242
  color: theme.palette.secondary.main
56156
56243
  }));
56157
- const StyledBox$1 = styled$1(material.Box)(({ theme }) => ({
56244
+ const StyledBox = styled$1(material.Box)(({ theme }) => ({
56158
56245
  display: 'flex',
56159
56246
  alignItems: 'flex-start',
56160
56247
  justifyContent: 'space-between',
@@ -56217,7 +56304,7 @@ const ContactMethodPhoneItem = ({ item }) => {
56217
56304
  window.dispatchEvent(event);
56218
56305
  };
56219
56306
  const formattedPhone = React$1.useMemo(() => formatPhoneForDisplay(item.address || ''), [item.address]);
56220
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$1, { children: [jsxRuntimeExports.jsxs(LeftSection, { children: [jsxRuntimeExports.jsx(StyledIconButton$1, { onClick: handleCallContact, color: "primary", size: "small", children: jsxRuntimeExports.jsx(StyledLocalPhoneIcon, {}) }), jsxRuntimeExports.jsxs(ContactDetails, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: formattedPhone || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText, { children: formattedPhone }) }), jsxRuntimeExports.jsx(material.Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText, { children: item.note }) })] })] }), jsxRuntimeExports.jsx(RightSection, { children: jsxRuntimeExports.jsx(material.Box, { sx: {
56307
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox, { children: [jsxRuntimeExports.jsxs(LeftSection, { children: [jsxRuntimeExports.jsx(StyledIconButton, { onClick: handleCallContact, color: "primary", size: "small", children: jsxRuntimeExports.jsx(StyledLocalPhoneIcon, {}) }), jsxRuntimeExports.jsxs(ContactDetails, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: formattedPhone || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText, { children: formattedPhone }) }), jsxRuntimeExports.jsx(material.Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText, { children: item.note }) })] })] }), jsxRuntimeExports.jsx(RightSection, { children: jsxRuntimeExports.jsx(material.Box, { sx: {
56221
56308
  display: 'flex',
56222
56309
  alignItems: 'center',
56223
56310
  justifyContent: 'flex-end',
@@ -56228,47 +56315,13 @@ const ContactMethodPhoneItem = ({ item }) => {
56228
56315
  } })) }) }) })] }) }));
56229
56316
  };
56230
56317
 
56231
- const StyledBox = styled$1(material.Box)(({ theme }) => ({
56232
- display: 'flex',
56233
- flexDirection: 'column',
56234
- padding: theme.spacing(1, 0, 2, 0),
56235
- width: '100%',
56236
- gap: theme.spacing(1),
56237
- '&:hover .edit-icon': {
56238
- opacity: 1,
56239
- },
56240
- }));
56241
- const StyledTypography = styled$1(material.Typography)(({}) => ({
56242
- letterSpacing: -0.5,
56243
- fontSize: 14,
56244
- fontWeight: 600,
56245
- }));
56246
- const HeaderBox = styled$1(material.Box)(({}) => ({
56247
- display: 'flex',
56248
- alignItems: 'center',
56249
- }));
56250
- const MethodItemsBox = styled$1(material.Box)(({ theme }) => ({
56251
- display: 'flex',
56252
- flexDirection: 'column',
56253
- gap: theme.spacing(1),
56254
- width: '100%',
56255
- }));
56256
- const StyledIconButton = styled$1(material.IconButton)({
56257
- opacity: 0,
56258
- transition: 'opacity 0.3s ease-in-out',
56259
- '& .MuiSvgIcon-root': {
56260
- width: '0.8em',
56261
- height: '0.8em',
56262
- },
56263
- marginLeft: '15px',
56264
- });
56265
56318
  const ContactMethod = ({ title, methodItems, isPhone, handleEdit, owner }) => {
56266
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox, { children: [jsxRuntimeExports.jsxs(HeaderBox, { children: [jsxRuntimeExports.jsx(StyledTypography, { children: title }), jsxRuntimeExports.jsx(StyledIconButton, { className: "edit-icon", size: "small", onClick: handleEdit, children: jsxRuntimeExports.jsx(default_1$f, { fontSize: "small" }) })] }), jsxRuntimeExports.jsx(MethodItemsBox, { children: methodItems.map((item, index) => {
56267
- if (isPhone) {
56268
- return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56269
- }
56270
- return jsxRuntimeExports.jsx(ContactMethodItem, { item: item, owner: owner }, index);
56271
- }) })] }) }));
56319
+ return (jsxRuntimeExports.jsxs("div", { className: "w-full rounded-xl border border-gray-200 bg-white/60 p-3 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsxRuntimeExports.jsx("p", { className: "text-sm font-semibold text-gray-800", children: title }), jsxRuntimeExports.jsx(material.IconButton, { "aria-label": `Edit ${title}`, size: "small", onClick: handleEdit, className: "edit-icon text-gray-500 transition hover:text-gray-800", children: jsxRuntimeExports.jsx(default_1$f, { fontSize: "small" }) })] }), jsxRuntimeExports.jsx("div", { className: "mt-3 space-y-2", children: methodItems.map((item, index) => {
56320
+ if (isPhone) {
56321
+ return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56322
+ }
56323
+ return jsxRuntimeExports.jsx(ContactMethodItem, { item: item, owner: owner }, index);
56324
+ }) })] }));
56272
56325
  };
56273
56326
 
56274
56327
  const SubsectionHeader = ({ title }) => {
@@ -56296,10 +56349,10 @@ default_1$6 = Add.default = (0, _createSvgIcon$6.default)( /*#__PURE__*/(0, _jsx
56296
56349
  d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"
56297
56350
  }), 'Add');
56298
56351
 
56299
- const SubsectionHeaderWithButton = ({ title, handleAdd, t }) => {
56300
- const tFromContext = useTranslationContext();
56301
- const translate = t || tFromContext;
56302
- return (jsxRuntimeExports.jsxs(material.Box, { sx: subsectionHeaderWithButtonStyle.container, children: [jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle2", children: title }), jsxRuntimeExports.jsx(material.Button, { onClick: handleAdd, size: "small", startIcon: jsxRuntimeExports.jsx(default_1$6, {}), variant: "text", color: "primary", children: translate('global.add') })] }));
56352
+ const SubsectionHeaderWithButton = ({ title, handleAdd }) => {
56353
+ const t = useTranslationContext();
56354
+ console.log('[SubsectionHeaderWithButton] title:', title, 't fn:', t?.name || 'anonymous');
56355
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: subsectionHeaderWithButtonStyle.container, children: [jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle2", children: title }), jsxRuntimeExports.jsx(material.Button, { onClick: handleAdd, size: "small", startIcon: jsxRuntimeExports.jsx(default_1$6, {}), variant: "text", color: "primary", children: t('global.add') })] }));
56303
56356
  };
56304
56357
 
56305
56358
  const informationItemContainerStyle = {
@@ -56980,7 +57033,68 @@ const ContactInformation = ({ ownerData }) => {
56980
57033
  const webchat = editEntity.field.imsWebchats;
56981
57034
  const instagram = editEntity.field.imsInstagrams;
56982
57035
  const rcs = editEntity.field.imsRCS;
56983
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Section, { title: "Contact Information", children: jsxRuntimeExports.jsxs(SectionContent, { children: [jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Phones'), title: t('contactDetails.phones'), methodItems: phones, isPhone: true, owner: ownerData }), jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Emails'), title: t('Emails'), methodItems: emails, owner: ownerData }), jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Facebook'), title: t('Facebook'), methodItems: facebook, owner: ownerData }), jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Whatsapp'), title: t('Whatsapp'), methodItems: whatsapp, owner: ownerData }), rcs.length > 0 ? (jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('RCS'), title: t('RCS'), methodItems: rcs, owner: ownerData })) : null, jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Mercado libre'), title: t('Mercado libre'), methodItems: mercadolibre, owner: ownerData }), jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Webchat'), title: t('Webchat'), methodItems: webchat, owner: ownerData }), jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Instagram'), title: t('Instagram'), methodItems: instagram, owner: ownerData })] }) }), jsxRuntimeExports.jsx(EditModal, { open: isOpen, onClose: closeModal, title: title })] }));
57036
+ const contactMethods = [
57037
+ {
57038
+ key: 'phones',
57039
+ title: t('conversations.contactDetails.phones'),
57040
+ items: phones,
57041
+ isPhone: true,
57042
+ modalTitle: 'Phones',
57043
+ visible: true,
57044
+ },
57045
+ {
57046
+ key: 'emails',
57047
+ title: 'Emails',
57048
+ items: emails,
57049
+ modalTitle: 'Emails',
57050
+ visible: true,
57051
+ },
57052
+ {
57053
+ key: 'facebook',
57054
+ title: 'Facebook',
57055
+ items: facebook,
57056
+ modalTitle: 'Facebook',
57057
+ visible: true,
57058
+ },
57059
+ {
57060
+ key: 'whatsapp',
57061
+ title: 'Whatsapp',
57062
+ items: whatsapp,
57063
+ modalTitle: 'Whatsapp',
57064
+ visible: true,
57065
+ },
57066
+ {
57067
+ key: 'rcs',
57068
+ title: 'RCS',
57069
+ items: rcs,
57070
+ modalTitle: 'RCS',
57071
+ visible: rcs.length > 0,
57072
+ },
57073
+ {
57074
+ key: 'mercado-libre',
57075
+ title: 'Mercado libre',
57076
+ items: mercadolibre,
57077
+ modalTitle: 'Mercado libre',
57078
+ visible: true,
57079
+ },
57080
+ {
57081
+ key: 'webchat',
57082
+ title: 'Webchat',
57083
+ items: webchat,
57084
+ modalTitle: 'Webchat',
57085
+ visible: true,
57086
+ },
57087
+ {
57088
+ key: 'instagram',
57089
+ title: 'Instagram',
57090
+ items: instagram,
57091
+ modalTitle: 'Instagram',
57092
+ visible: true,
57093
+ },
57094
+ ];
57095
+ return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Section, { title: t('conversations.contactDetails.contactInformation'), children: jsxRuntimeExports.jsx(SectionContent, { children: jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-3", children: contactMethods
57096
+ .filter((method) => method.visible)
57097
+ .map((method) => (jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal(method.modalTitle), title: method.title, methodItems: method.items, isPhone: method.isPhone, owner: ownerData }, method.key))) }) }) }), jsxRuntimeExports.jsx(EditModal, { open: isOpen, onClose: closeModal, title: title })] }));
56984
57098
  };
56985
57099
 
56986
57100
  const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntityUpdated, }) => {
@@ -56991,49 +57105,18 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntity
56991
57105
  onEntityUpdated,
56992
57106
  };
56993
57107
  const t = useTranslationContext();
56994
- const maybeTitle = t('contactDetails.addressInformation');
56995
- const sectionTitle = maybeTitle === 'contactDetails.addressInformation' ? 'Address Information' : maybeTitle;
56996
- return (jsxRuntimeExports.jsx(Section, { title: sectionTitle, children: jsxRuntimeExports.jsx(SectionContent, { children: entityType === 'contact' ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.street'), value: entityData.address1?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56997
- address1: { street: value },
56998
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56999
- address2: { street: value },
57000
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57001
- address1: { city: value },
57002
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57003
- address2: { city: value },
57004
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57005
- address1: { state: value },
57006
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57007
- address2: { state: value },
57008
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57009
- address1: { zipcode: value },
57010
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57011
- address2: { zipcode: value },
57012
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57013
- address1: { country: value },
57014
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57015
- address2: { country: value },
57016
- }) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.street'), value: entityData.address1?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
57017
- address1: { street: value },
57018
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
57019
- address2: { street: value },
57020
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57021
- address1: { city: value },
57022
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57023
- address2: { city: value },
57024
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57025
- address1: { state: value },
57026
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57027
- address2: { state: value },
57028
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57029
- address1: { zipcode: value },
57030
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57031
- address2: { zipcode: value },
57032
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57033
- address1: { country: value },
57034
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57035
- address2: { country: value },
57036
- }) })] })) }) }));
57108
+ const AddressGroup = ({ addressNumber, title, }) => (jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 rounded-xl border border-gray-100 bg-gray-50/50 p-4", children: [jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold text-gray-700", children: title }), jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-3", children: [jsxRuntimeExports.jsx("div", { className: "col-span-2", children: jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.street'), value: entityData[addressNumber]?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
57109
+ [addressNumber]: { street: value },
57110
+ }), minWidth: "100%" }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.city'), value: entityData[addressNumber]?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57111
+ [addressNumber]: { city: value },
57112
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.state'), value: entityData[addressNumber]?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57113
+ [addressNumber]: { state: value },
57114
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.postcode'), value: entityData[addressNumber]?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57115
+ [addressNumber]: { zipcode: value },
57116
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.country'), value: entityData[addressNumber]?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57117
+ [addressNumber]: { country: value },
57118
+ }), minWidth: "100%" })] })] }));
57119
+ return (jsxRuntimeExports.jsx(Section, { title: t('conversations.contactDetails.addressInformation'), children: jsxRuntimeExports.jsx(SectionContent, { children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [jsxRuntimeExports.jsx(AddressGroup, { addressNumber: "address1", title: t('conversations.contactDetails.primaryAddress') || 'Primary Address' }), jsxRuntimeExports.jsx(AddressGroup, { addressNumber: "address2", title: t('conversations.contactDetails.secondaryAddress') || 'Secondary Address' })] }) }) }));
57037
57120
  };
57038
57121
 
57039
57122
  const useEntityUpdateSync = ({ entity, setEntity }) => {
@@ -57204,7 +57287,7 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t })
57204
57287
  minHeight: 220,
57205
57288
  }, children: jsxRuntimeExports.jsx(material.CircularProgress, {}) })) : state.error ? (jsxRuntimeExports.jsx(material.Box, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsx(EditEntityProvider, { entityType: selectors.contactType === 'business' ? 'business' : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, children: jsxRuntimeExports.jsxs(material.Box, { sx: { position: 'relative', height: '100%' }, children: [jsxRuntimeExports.jsx(material.Fade, { in: view === 'main', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsxs(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Header, { imgUrl: image.imageUrl, displayName: selectors.displayName, tags: selectors.tags, onEditTags: () => {
57206
57289
  setView('tags');
57207
- }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting }), jsxRuntimeExports.jsxs(material.Box, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' ||
57290
+ }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting, contactType: selectors.contactType, entityId: state.contactData?.id, firstName: selectors.isContact ? state.contactData.firstName : undefined, lastName: selectors.isContact ? state.contactData.lastName : undefined, name: selectors.isBusiness ? state.contactData.name : undefined, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsxs(material.Box, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' ||
57208
57291
  selectors.contactType === 'business'
57209
57292
  ? selectors.contactType
57210
57293
  : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||