@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.
@@ -1,4 +1,4 @@
1
- import { IContactTag } from '@trii/types/dist/Contacts';
1
+ import { IContactTag, IContact, IBusiness } from '@trii/types/dist/Contacts/contacts';
2
2
  import type { ChangeEvent, RefObject } from 'react';
3
3
  type HeaderProps = {
4
4
  imgUrl?: string;
@@ -12,6 +12,12 @@ type HeaderProps = {
12
12
  isUploadingPhoto: boolean;
13
13
  onDeletePhoto: () => void;
14
14
  isDeletingPhoto: boolean;
15
+ contactType?: 'contact' | 'business' | 'unknown';
16
+ firstName?: string;
17
+ lastName?: string;
18
+ name?: string;
19
+ entityId?: string;
20
+ onEntityUpdated?: (data: IContact | IBusiness) => void;
15
21
  };
16
- declare const Header: ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
22
+ declare const Header: ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, contactType, firstName, lastName, name, entityId, onEntityUpdated, }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
17
23
  export default Header;
@@ -0,0 +1,12 @@
1
+ import { IContact, IBusiness } from '@trii/types/dist/Contacts/contacts';
2
+ export type ContactNameProps = {
3
+ displayName: string;
4
+ contactType?: 'contact' | 'business' | 'unknown';
5
+ firstName?: string;
6
+ lastName?: string;
7
+ name?: string;
8
+ entityId?: string;
9
+ onEntityUpdated?: (data: IContact | IBusiness) => void;
10
+ };
11
+ declare const ContactName: ({ displayName, contactType, firstName, lastName, name, entityId, onEntityUpdated, }: ContactNameProps) => import("react/jsx-runtime").JSX.Element;
12
+ export default ContactName;
@@ -1 +1,2 @@
1
1
  export { default as Tags } from './Tags';
2
+ export { default as ContactName } from './ContactName/ContactName';
@@ -1,7 +1,6 @@
1
1
  type Props = {
2
2
  title: string;
3
3
  handleAdd: () => void;
4
- t?: (key: string) => string;
5
4
  };
6
- declare const SubsectionHeaderWithButton: ({ title, handleAdd, t }: Props) => import("react/jsx-runtime").JSX.Element;
5
+ declare const SubsectionHeaderWithButton: ({ title, handleAdd }: Props) => import("react/jsx-runtime").JSX.Element;
7
6
  export default SubsectionHeaderWithButton;
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { useCallback, useEffect, createContext, useContext, useState, useMemo, Children, isValidElement, cloneElement, useRef } from 'react';
3
- import { styled as styled$5, Box as Box$2, IconButton as IconButton$2, Avatar, Typography as Typography$2, CircularProgress as CircularProgress$2, Tooltip, Chip as Chip$2, Popper as Popper$2, ClickAwayListener, CardContent, Stack as Stack$2, Popover as Popover$2, Autocomplete, TextField as TextField$1, Divider, Select as Select$2, MenuItem as MenuItem$2, FormControl as FormControl$2, Button as Button$2, Menu as Menu$2, ListItemIcon, ListItemText, Modal as Modal$2, Grid, Backdrop as Backdrop$2, Fade as Fade$2 } from '@mui/material';
3
+ import { styled as styled$5, Box as Box$2, IconButton as IconButton$2, Avatar, Typography as Typography$2, CircularProgress as CircularProgress$2, Tooltip, Chip as Chip$2, Popper as Popper$2, ClickAwayListener, CardContent, Stack as Stack$2, Popover as Popover$2, TextField as TextField$1, Autocomplete, Divider, Select as Select$2, MenuItem as MenuItem$2, FormControl as FormControl$2, Button as Button$2, Menu as Menu$2, ListItemIcon, ListItemText, Modal as Modal$2, Grid, Backdrop as Backdrop$2, Fade as Fade$2 } from '@mui/material';
4
4
  import { withEmotionCache, ThemeContext, CacheProvider, Global, css, keyframes } from '@emotion/react';
5
5
  import * as ReactDOM from 'react-dom';
6
6
  import ReactDOM__default from 'react-dom';
@@ -8998,6 +8998,10 @@ var utils = /*#__PURE__*/Object.freeze({
8998
8998
  useIsFocusVisible: useIsFocusVisible
8999
8999
  });
9000
9000
 
9001
+ var Edit$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9002
+ 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"
9003
+ }), 'Edit');
9004
+
9001
9005
  var Email$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9002
9006
  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"
9003
9007
  }), 'Email');
@@ -9020,6 +9024,10 @@ var PhoneEnabled = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9020
9024
  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"
9021
9025
  }), 'PhoneEnabled');
9022
9026
 
9027
+ var Save$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9028
+ 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"
9029
+ }), 'Save');
9030
+
9023
9031
  var Star = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9024
9032
  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"
9025
9033
  }), 'Star');
@@ -9188,7 +9196,7 @@ const TitleBox = styled$5(Box$2)({
9188
9196
  width: '100%',
9189
9197
  borderBottom: `1px solid lightgray`,
9190
9198
  });
9191
- const StyledBox$3 = styled$5(Box$2)({
9199
+ const StyledBox$2 = styled$5(Box$2)({
9192
9200
  display: 'flex',
9193
9201
  alignItems: 'center',
9194
9202
  justifyContent: 'space-between',
@@ -9229,7 +9237,7 @@ const NoteText$2 = styled$5(Typography$2)({
9229
9237
  left: 40,
9230
9238
  });
9231
9239
  const ContactMethod$1 = ({ icon, contactList, title, showTitle = true, }) => {
9232
- const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox$3, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
9240
+ const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox$2, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
9233
9241
  whiteSpace: 'nowrap',
9234
9242
  textOverflow: 'ellipsis',
9235
9243
  overflow: 'hidden',
@@ -15383,7 +15391,15 @@ const TranslationProvider = ({ t, children }) => {
15383
15391
  };
15384
15392
  const useTranslationContext = () => {
15385
15393
  const t = useContext(TranslationContext);
15386
- return t || noop$3;
15394
+ if (!t) {
15395
+ console.warn('[useTranslationContext] using noop, context value is falsy');
15396
+ return noop$3;
15397
+ }
15398
+ return (...args) => {
15399
+ const [key, ...rest] = args;
15400
+ const result = t(key, ...rest);
15401
+ return result;
15402
+ };
15387
15403
  };
15388
15404
 
15389
15405
  const Tags = ({ tags, onEditTags }) => {
@@ -15441,6 +15457,87 @@ const Tags = ({ tags, onEditTags }) => {
15441
15457
  } }, tag.id))) })] }) })] }));
15442
15458
  };
15443
15459
 
15460
+ const EditContactApiContext = createContext(null);
15461
+ const EditContactApiProvider = EditContactApiContext.Provider;
15462
+ const useEditContactApi = () => {
15463
+ return useContext(EditContactApiContext);
15464
+ };
15465
+
15466
+ const NameText = styled$5(Typography$2)({
15467
+ whiteSpace: 'nowrap',
15468
+ overflow: 'hidden',
15469
+ textOverflow: 'ellipsis',
15470
+ maxWidth: 360,
15471
+ textAlign: 'center',
15472
+ });
15473
+ const NameWrapper = styled$5(Box$2)({
15474
+ display: 'flex',
15475
+ alignItems: 'center',
15476
+ justifyContent: 'center',
15477
+ gap: '8px',
15478
+ width: '100%',
15479
+ '&:hover .edit-icon': {
15480
+ opacity: 1,
15481
+ visibility: 'visible',
15482
+ },
15483
+ });
15484
+ const EditButton = styled$5(IconButton$2)({
15485
+ opacity: 0,
15486
+ visibility: 'hidden',
15487
+ transition: 'all 0.2s',
15488
+ });
15489
+ const ContactName = ({ displayName, contactType, firstName, lastName, name, entityId, onEntityUpdated, }) => {
15490
+ const api = useEditContactApi();
15491
+ const [isEditing, setIsEditing] = useState(false);
15492
+ const [loading, setLoading] = useState(false);
15493
+ const [values, setValues] = useState({
15494
+ firstName: firstName || '',
15495
+ lastName: lastName || '',
15496
+ name: name || '',
15497
+ });
15498
+ useEffect(() => {
15499
+ setValues({
15500
+ firstName: firstName || '',
15501
+ lastName: lastName || '',
15502
+ name: name || '',
15503
+ });
15504
+ }, [firstName, lastName, name]);
15505
+ const handleSave = async () => {
15506
+ if (!api || !entityId || !contactType || contactType === 'unknown')
15507
+ return;
15508
+ setLoading(true);
15509
+ try {
15510
+ let body = {};
15511
+ if (contactType === 'contact') {
15512
+ body = { firstName: values.firstName, lastName: values.lastName };
15513
+ }
15514
+ else if (contactType === 'business') {
15515
+ body = { name: values.name };
15516
+ }
15517
+ const updated = await api.updateEntity({
15518
+ entityType: contactType,
15519
+ entityId,
15520
+ body,
15521
+ });
15522
+ if (updated && onEntityUpdated) {
15523
+ onEntityUpdated(updated);
15524
+ }
15525
+ setIsEditing(false);
15526
+ }
15527
+ catch (err) {
15528
+ console.error('Failed to update name', err);
15529
+ }
15530
+ finally {
15531
+ setLoading(false);
15532
+ }
15533
+ };
15534
+ const showEdit = contactType === 'contact' || contactType === 'business';
15535
+ if (isEditing) {
15536
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: { display: 'flex', alignItems: 'center', gap: 1, mt: 1 }, children: [contactType === 'contact' ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField$1, { value: values.firstName, onChange: (e) => setValues({ ...values, firstName: e.target.value }), size: "small", placeholder: "First Name", sx: { width: 140 } }), jsxRuntimeExports.jsx(TextField$1, { value: values.lastName, onChange: (e) => setValues({ ...values, lastName: e.target.value }), size: "small", placeholder: "Last Name", sx: { width: 140 } })] })) : (jsxRuntimeExports.jsx(TextField$1, { value: values.name, onChange: (e) => setValues({ ...values, name: e.target.value }), size: "small", placeholder: "Name", sx: { width: 280 } })), jsxRuntimeExports.jsx(IconButton$2, { onClick: handleSave, disabled: loading, color: "primary", children: loading ? jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) : jsxRuntimeExports.jsx(Save$1, {}) })] }));
15537
+ }
15538
+ 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" }) }))] }));
15539
+ };
15540
+
15444
15541
  var Delete = {};
15445
15542
 
15446
15543
  var _interopRequireDefault$c = interopRequireDefaultExports;
@@ -15516,16 +15613,9 @@ const HeaderContainer = styled$5(Box$2)({
15516
15613
  marginBottom: '20px',
15517
15614
  position: 'relative',
15518
15615
  });
15519
- const ContactName = styled$5(Typography$2)({
15520
- whiteSpace: 'nowrap',
15521
- overflow: 'hidden',
15522
- textOverflow: 'ellipsis',
15523
- maxWidth: 360,
15524
- textAlign: 'center',
15525
- });
15526
- const Header = ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
15616
+ const Header = ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, contactType, firstName, lastName, name, entityId, onEntityUpdated, }) => {
15527
15617
  const avatarAlt = `Avatar for ${displayName}`;
15528
- 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 })] }));
15618
+ 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 })] }));
15529
15619
  };
15530
15620
 
15531
15621
  var ArrowBack = {};
@@ -26296,12 +26386,6 @@ const useEditEntity = () => {
26296
26386
  return ctx;
26297
26387
  };
26298
26388
 
26299
- const EditContactApiContext = createContext(null);
26300
- const EditContactApiProvider = EditContactApiContext.Provider;
26301
- const useEditContactApi = () => {
26302
- return useContext(EditContactApiContext);
26303
- };
26304
-
26305
26389
  const resolveUserLabel = ({ userId, users, currentUser, }) => {
26306
26390
  if (!userId)
26307
26391
  return null;
@@ -52425,7 +52509,7 @@ default_1$8 = Cancel.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _
52425
52509
 
52426
52510
  const isUserInfo = (option) => 'email' in option;
52427
52511
  const isContactBirthdayProps = (p) => p.entityType === 'contact' && p.inputType === 'birthday';
52428
- const StyledIconButton$3 = styled$5(IconButton$2)({
52512
+ const StyledIconButton$2 = styled$5(IconButton$2)({
52429
52513
  opacity: 0,
52430
52514
  transition: 'opacity 0.3s ease-in-out',
52431
52515
  '& .MuiSvgIcon-root': {
@@ -52441,7 +52525,7 @@ const StyledSaveCancelButton$1 = styled$5(IconButton$2)({
52441
52525
  },
52442
52526
  });
52443
52527
  const EntityInfoLabel = (props) => {
52444
- const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated, } = props;
52528
+ const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated } = props;
52445
52529
  const t = useTranslationContext();
52446
52530
  const inputType = props.inputType ?? 'text';
52447
52531
  const [isEditing, setIsEditing] = useState(false);
@@ -52555,9 +52639,12 @@ const EntityInfoLabel = (props) => {
52555
52639
  '&:hover .edit-icon': {
52556
52640
  opacity: 1,
52557
52641
  },
52558
- }, children: [jsxRuntimeExports.jsxs(Box$2, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(Typography$2, { 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(CircularProgress$2, { 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(Box$2, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(TextField$1, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(Select$2, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(MenuItem$2, { value: "", children: t('contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(MenuItem$2, { value: option.id, children: props.entityType === 'contact'
52642
+ }, children: [jsxRuntimeExports.jsxs(Box$2, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(Typography$2, { 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(CircularProgress$2, { 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(Box$2, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(TextField$1, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(Select$2, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(MenuItem$2, { value: "", children: t('conversations.contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(MenuItem$2, { value: option.id, children: props.entityType === 'contact'
52559
52643
  ? option.name?.trim() || (isUserInfo(option) ? option.email : '') || 'Sin nombre'
52560
- : 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(Box$2, { display: "flex", alignItems: "center", children: "Popover" })) : (jsxRuntimeExports.jsx(Typography$2, { fontWeight: '400', sx: { padding: '2.5px 14px 8.5px 0px' }, color: (theme) => theme.palette.text.primary, children: displayValue || (typeof value === 'string' && value) || '-' })) })] }));
52644
+ : 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 &&
52645
+ props.entityType === 'contact' &&
52646
+ inputType === 'selectBusiness' &&
52647
+ props.businessId ? (jsxRuntimeExports.jsx(Box$2, { display: "flex", alignItems: "center", children: "Popover" })) : (jsxRuntimeExports.jsx(Typography$2, { fontWeight: '400', sx: { padding: '2.5px 14px 8.5px 0px' }, color: (theme) => theme.palette.text.primary, children: displayValue || (typeof value === 'string' && value) || '-' })) })] }));
52561
52648
  };
52562
52649
 
52563
52650
  const ContactInfoLabel = (props) => {
@@ -54363,7 +54450,7 @@ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat })
54363
54450
  }, value: value || initDates, onChange: (newValue) => handleChange(newValue), format: dateFormat }) }) }));
54364
54451
  };
54365
54452
 
54366
- const StyledIconButton$2 = styled$5(IconButton$2)(() => ({
54453
+ const StyledIconButton$1 = styled$5(IconButton$2)(() => ({
54367
54454
  opacity: 0,
54368
54455
  transition: 'opacity 0.3s ease-in-out',
54369
54456
  '& .MuiSvgIcon-root': {
@@ -54565,7 +54652,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54565
54652
  else
54566
54653
  return (jsxRuntimeExports.jsx(CustomPropertyInput, { type: type, nameKey: nameKey, value: value, onChange: handleInputChange }));
54567
54654
  };
54568
- return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT ? 'contacts-col-12' : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(Box$2, { 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(CircularProgress$2, { 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(Box$2, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT ? '100%' : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
54655
+ return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT ? 'contacts-col-12' : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(Box$2, { 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(CircularProgress$2, { 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(Box$2, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT ? '100%' : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
54569
54656
  ? property.type === Contacts.ContactField_type.DATERANGE
54570
54657
  ? (() => {
54571
54658
  if (typeof property.value === 'string') {
@@ -54691,9 +54778,9 @@ const ContactGeneral = (props) => {
54691
54778
  }
54692
54779
  return age;
54693
54780
  };
54694
- 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) => ({
54781
+ 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) => ({
54695
54782
  owner: typeof value === 'string' ? value : '',
54696
- }), 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) => ({
54783
+ }), 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) => ({
54697
54784
  birthDate: value,
54698
54785
  }), 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)))] }) }));
54699
54786
  };
@@ -54768,9 +54855,9 @@ const BusinessGeneral = (props) => {
54768
54855
  controller.abort();
54769
54856
  };
54770
54857
  }, [api, entityData, users, currentUser]);
54771
- 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) => ({
54858
+ 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) => ({
54772
54859
  owner: typeof value === 'string' ? value : '',
54773
- }), 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)))] }) }));
54860
+ }), 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)))] }) }));
54774
54861
  };
54775
54862
 
54776
54863
  const General = (props) => {
@@ -54798,7 +54885,7 @@ const useEditModal = () => {
54798
54885
  return { isOpen, title, openModal, closeModal };
54799
54886
  };
54800
54887
 
54801
- const StyledBox$2 = styled$1(Box$2)(({ theme }) => ({
54888
+ const StyledBox$1 = styled$1(Box$2)(({ theme }) => ({
54802
54889
  display: 'flex',
54803
54890
  alignItems: 'flex-start',
54804
54891
  justifyContent: 'space-between',
@@ -54865,7 +54952,7 @@ const ContactMethodItem = ({ item }) => {
54865
54952
  const { imageUrl } = useImage({
54866
54953
  initialImageUrl: avatarUrlWithoutAccess,
54867
54954
  });
54868
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$2, { children: [jsxRuntimeExports.jsx(LeftSection$1, { children: jsxRuntimeExports.jsxs(ContactDetails$1, { children: [jsxRuntimeExports.jsx(Tooltip, { title: item.address || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText$1, { children: item.address }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.profileName || '', arrow: true, children: jsxRuntimeExports.jsx(ProfileNameText, { sx: {
54955
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$1, { children: [jsxRuntimeExports.jsx(LeftSection$1, { children: jsxRuntimeExports.jsxs(ContactDetails$1, { children: [jsxRuntimeExports.jsx(Tooltip, { title: item.address || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText$1, { children: item.address }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.profileName || '', arrow: true, children: jsxRuntimeExports.jsx(ProfileNameText, { sx: {
54869
54956
  marginTop: '-10px',
54870
54957
  marginLeft: '5px',
54871
54958
  fontSize: '10px',
@@ -56125,7 +56212,7 @@ const formatPhoneForDisplay = (number) => {
56125
56212
  }
56126
56213
  };
56127
56214
 
56128
- const StyledIconButton$1 = styled$1(IconButton$2)(({ theme }) => ({
56215
+ const StyledIconButton = styled$1(IconButton$2)(({ theme }) => ({
56129
56216
  padding: theme.spacing(0.5),
56130
56217
  marginTop: '-5px',
56131
56218
  }));
@@ -56134,7 +56221,7 @@ const StyledLocalPhoneIcon = styled$1(default_1$7)(({ theme }) => ({
56134
56221
  width: 16,
56135
56222
  color: theme.palette.secondary.main
56136
56223
  }));
56137
- const StyledBox$1 = styled$1(Box$2)(({ theme }) => ({
56224
+ const StyledBox = styled$1(Box$2)(({ theme }) => ({
56138
56225
  display: 'flex',
56139
56226
  alignItems: 'flex-start',
56140
56227
  justifyContent: 'space-between',
@@ -56197,7 +56284,7 @@ const ContactMethodPhoneItem = ({ item }) => {
56197
56284
  window.dispatchEvent(event);
56198
56285
  };
56199
56286
  const formattedPhone = useMemo(() => formatPhoneForDisplay(item.address || ''), [item.address]);
56200
- 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(Tooltip, { title: formattedPhone || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText, { children: formattedPhone }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText, { children: item.note }) })] })] }), jsxRuntimeExports.jsx(RightSection, { children: jsxRuntimeExports.jsx(Box$2, { sx: {
56287
+ 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(Tooltip, { title: formattedPhone || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText, { children: formattedPhone }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText, { children: item.note }) })] })] }), jsxRuntimeExports.jsx(RightSection, { children: jsxRuntimeExports.jsx(Box$2, { sx: {
56201
56288
  display: 'flex',
56202
56289
  alignItems: 'center',
56203
56290
  justifyContent: 'flex-end',
@@ -56208,47 +56295,13 @@ const ContactMethodPhoneItem = ({ item }) => {
56208
56295
  } })) }) }) })] }) }));
56209
56296
  };
56210
56297
 
56211
- const StyledBox = styled$1(Box$2)(({ theme }) => ({
56212
- display: 'flex',
56213
- flexDirection: 'column',
56214
- padding: theme.spacing(1, 0, 2, 0),
56215
- width: '100%',
56216
- gap: theme.spacing(1),
56217
- '&:hover .edit-icon': {
56218
- opacity: 1,
56219
- },
56220
- }));
56221
- const StyledTypography = styled$1(Typography$2)(({}) => ({
56222
- letterSpacing: -0.5,
56223
- fontSize: 14,
56224
- fontWeight: 600,
56225
- }));
56226
- const HeaderBox = styled$1(Box$2)(({}) => ({
56227
- display: 'flex',
56228
- alignItems: 'center',
56229
- }));
56230
- const MethodItemsBox = styled$1(Box$2)(({ theme }) => ({
56231
- display: 'flex',
56232
- flexDirection: 'column',
56233
- gap: theme.spacing(1),
56234
- width: '100%',
56235
- }));
56236
- const StyledIconButton = styled$1(IconButton$2)({
56237
- opacity: 0,
56238
- transition: 'opacity 0.3s ease-in-out',
56239
- '& .MuiSvgIcon-root': {
56240
- width: '0.8em',
56241
- height: '0.8em',
56242
- },
56243
- marginLeft: '15px',
56244
- });
56245
56298
  const ContactMethod = ({ title, methodItems, isPhone, handleEdit, owner }) => {
56246
- 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) => {
56247
- if (isPhone) {
56248
- return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56249
- }
56250
- return jsxRuntimeExports.jsx(ContactMethodItem, { item: item, owner: owner }, index);
56251
- }) })] }) }));
56299
+ 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(IconButton$2, { "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) => {
56300
+ if (isPhone) {
56301
+ return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56302
+ }
56303
+ return jsxRuntimeExports.jsx(ContactMethodItem, { item: item, owner: owner }, index);
56304
+ }) })] }));
56252
56305
  };
56253
56306
 
56254
56307
  const SubsectionHeader = ({ title }) => {
@@ -56276,10 +56329,10 @@ default_1$6 = Add.default = (0, _createSvgIcon$6.default)( /*#__PURE__*/(0, _jsx
56276
56329
  d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"
56277
56330
  }), 'Add');
56278
56331
 
56279
- const SubsectionHeaderWithButton = ({ title, handleAdd, t }) => {
56280
- const tFromContext = useTranslationContext();
56281
- const translate = t || tFromContext;
56282
- return (jsxRuntimeExports.jsxs(Box$2, { sx: subsectionHeaderWithButtonStyle.container, children: [jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle2", children: title }), jsxRuntimeExports.jsx(Button$2, { onClick: handleAdd, size: "small", startIcon: jsxRuntimeExports.jsx(default_1$6, {}), variant: "text", color: "primary", children: translate('global.add') })] }));
56332
+ const SubsectionHeaderWithButton = ({ title, handleAdd }) => {
56333
+ const t = useTranslationContext();
56334
+ console.log('[SubsectionHeaderWithButton] title:', title, 't fn:', t?.name || 'anonymous');
56335
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: subsectionHeaderWithButtonStyle.container, children: [jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle2", children: title }), jsxRuntimeExports.jsx(Button$2, { onClick: handleAdd, size: "small", startIcon: jsxRuntimeExports.jsx(default_1$6, {}), variant: "text", color: "primary", children: t('global.add') })] }));
56283
56336
  };
56284
56337
 
56285
56338
  const informationItemContainerStyle = {
@@ -56960,7 +57013,68 @@ const ContactInformation = ({ ownerData }) => {
56960
57013
  const webchat = editEntity.field.imsWebchats;
56961
57014
  const instagram = editEntity.field.imsInstagrams;
56962
57015
  const rcs = editEntity.field.imsRCS;
56963
- 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 })] }));
57016
+ const contactMethods = [
57017
+ {
57018
+ key: 'phones',
57019
+ title: t('conversations.contactDetails.phones'),
57020
+ items: phones,
57021
+ isPhone: true,
57022
+ modalTitle: 'Phones',
57023
+ visible: true,
57024
+ },
57025
+ {
57026
+ key: 'emails',
57027
+ title: 'Emails',
57028
+ items: emails,
57029
+ modalTitle: 'Emails',
57030
+ visible: true,
57031
+ },
57032
+ {
57033
+ key: 'facebook',
57034
+ title: 'Facebook',
57035
+ items: facebook,
57036
+ modalTitle: 'Facebook',
57037
+ visible: true,
57038
+ },
57039
+ {
57040
+ key: 'whatsapp',
57041
+ title: 'Whatsapp',
57042
+ items: whatsapp,
57043
+ modalTitle: 'Whatsapp',
57044
+ visible: true,
57045
+ },
57046
+ {
57047
+ key: 'rcs',
57048
+ title: 'RCS',
57049
+ items: rcs,
57050
+ modalTitle: 'RCS',
57051
+ visible: rcs.length > 0,
57052
+ },
57053
+ {
57054
+ key: 'mercado-libre',
57055
+ title: 'Mercado libre',
57056
+ items: mercadolibre,
57057
+ modalTitle: 'Mercado libre',
57058
+ visible: true,
57059
+ },
57060
+ {
57061
+ key: 'webchat',
57062
+ title: 'Webchat',
57063
+ items: webchat,
57064
+ modalTitle: 'Webchat',
57065
+ visible: true,
57066
+ },
57067
+ {
57068
+ key: 'instagram',
57069
+ title: 'Instagram',
57070
+ items: instagram,
57071
+ modalTitle: 'Instagram',
57072
+ visible: true,
57073
+ },
57074
+ ];
57075
+ 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
57076
+ .filter((method) => method.visible)
57077
+ .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 })] }));
56964
57078
  };
56965
57079
 
56966
57080
  const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntityUpdated, }) => {
@@ -56971,49 +57085,18 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntity
56971
57085
  onEntityUpdated,
56972
57086
  };
56973
57087
  const t = useTranslationContext();
56974
- const maybeTitle = t('contactDetails.addressInformation');
56975
- const sectionTitle = maybeTitle === 'contactDetails.addressInformation' ? 'Address Information' : maybeTitle;
56976
- 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) => ({
56977
- address1: { street: value },
56978
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56979
- address2: { street: value },
56980
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
56981
- address1: { city: value },
56982
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
56983
- address2: { city: value },
56984
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
56985
- address1: { state: value },
56986
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
56987
- address2: { state: value },
56988
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
56989
- address1: { zipcode: value },
56990
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
56991
- address2: { zipcode: value },
56992
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
56993
- address1: { country: value },
56994
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
56995
- address2: { country: value },
56996
- }) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.street'), value: entityData.address1?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56997
- address1: { street: value },
56998
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56999
- address2: { street: value },
57000
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57001
- address1: { city: value },
57002
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57003
- address2: { city: value },
57004
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57005
- address1: { state: value },
57006
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57007
- address2: { state: value },
57008
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57009
- address1: { zipcode: value },
57010
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57011
- address2: { zipcode: value },
57012
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57013
- address1: { country: value },
57014
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57015
- address2: { country: value },
57016
- }) })] })) }) }));
57088
+ 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) => ({
57089
+ [addressNumber]: { street: value },
57090
+ }), minWidth: "100%" }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.city'), value: entityData[addressNumber]?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57091
+ [addressNumber]: { city: value },
57092
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.state'), value: entityData[addressNumber]?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57093
+ [addressNumber]: { state: value },
57094
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.postcode'), value: entityData[addressNumber]?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57095
+ [addressNumber]: { zipcode: value },
57096
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.country'), value: entityData[addressNumber]?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57097
+ [addressNumber]: { country: value },
57098
+ }), minWidth: "100%" })] })] }));
57099
+ 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' })] }) }) }));
57017
57100
  };
57018
57101
 
57019
57102
  const useEntityUpdateSync = ({ entity, setEntity }) => {
@@ -57184,7 +57267,7 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t })
57184
57267
  minHeight: 220,
57185
57268
  }, children: jsxRuntimeExports.jsx(CircularProgress$2, {}) })) : state.error ? (jsxRuntimeExports.jsx(Box$2, { 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(Box$2, { sx: { position: 'relative', height: '100%' }, children: [jsxRuntimeExports.jsx(Fade$2, { in: view === 'main', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsxs(Box$2, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Header, { imgUrl: image.imageUrl, displayName: selectors.displayName, tags: selectors.tags, onEditTags: () => {
57186
57269
  setView('tags');
57187
- }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting }), jsxRuntimeExports.jsxs(Box$2, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' ||
57270
+ }, 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(Box$2, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' ||
57188
57271
  selectors.contactType === 'business'
57189
57272
  ? selectors.contactType
57190
57273
  : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||