@trii/components 2.0.39 → 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');
@@ -15399,7 +15407,6 @@ default_1$e = Label.default = (0, _createSvgIcon$d.default)( /*#__PURE__*/(0, _j
15399
15407
  const noop$3 = (key) => key;
15400
15408
  const TranslationContext = React$1.createContext(noop$3);
15401
15409
  const TranslationProvider = ({ t, children }) => {
15402
- console.log('[TranslationProvider] t fn:', t?.name || 'anonymous', t);
15403
15410
  return jsxRuntimeExports.jsx(TranslationContext.Provider, { value: t, children: children });
15404
15411
  };
15405
15412
  const useTranslationContext = () => {
@@ -15411,7 +15418,6 @@ const useTranslationContext = () => {
15411
15418
  return (...args) => {
15412
15419
  const [key, ...rest] = args;
15413
15420
  const result = t(key, ...rest);
15414
- console.log('[useTranslationContext] key:', key, 'args:', rest, 'result:', result);
15415
15421
  return result;
15416
15422
  };
15417
15423
  };
@@ -15471,6 +15477,87 @@ const Tags = ({ tags, onEditTags }) => {
15471
15477
  } }, tag.id))) })] }) })] }));
15472
15478
  };
15473
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
+
15474
15561
  var Delete = {};
15475
15562
 
15476
15563
  var _interopRequireDefault$c = interopRequireDefaultExports;
@@ -15546,16 +15633,9 @@ const HeaderContainer = material.styled(material.Box)({
15546
15633
  marginBottom: '20px',
15547
15634
  position: 'relative',
15548
15635
  });
15549
- const ContactName = material.styled(material.Typography)({
15550
- whiteSpace: 'nowrap',
15551
- overflow: 'hidden',
15552
- textOverflow: 'ellipsis',
15553
- maxWidth: 360,
15554
- textAlign: 'center',
15555
- });
15556
- 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, }) => {
15557
15637
  const avatarAlt = `Avatar for ${displayName}`;
15558
- 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 })] }));
15559
15639
  };
15560
15640
 
15561
15641
  var ArrowBack = {};
@@ -26326,12 +26406,6 @@ const useEditEntity = () => {
26326
26406
  return ctx;
26327
26407
  };
26328
26408
 
26329
- const EditContactApiContext = React$1.createContext(null);
26330
- const EditContactApiProvider = EditContactApiContext.Provider;
26331
- const useEditContactApi = () => {
26332
- return React$1.useContext(EditContactApiContext);
26333
- };
26334
-
26335
26409
  const resolveUserLabel = ({ userId, users, currentUser, }) => {
26336
26410
  if (!userId)
26337
26411
  return null;
@@ -52471,7 +52545,7 @@ const StyledSaveCancelButton$1 = material.styled(material.IconButton)({
52471
52545
  },
52472
52546
  });
52473
52547
  const EntityInfoLabel = (props) => {
52474
- const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated, } = props;
52548
+ const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated } = props;
52475
52549
  const t = useTranslationContext();
52476
52550
  const inputType = props.inputType ?? 'text';
52477
52551
  const [isEditing, setIsEditing] = React$1.useState(false);
@@ -52585,9 +52659,12 @@ const EntityInfoLabel = (props) => {
52585
52659
  '&:hover .edit-icon': {
52586
52660
  opacity: 1,
52587
52661
  },
52588
- }, 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('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'
52589
52663
  ? option.name?.trim() || (isUserInfo(option) ? option.email : '') || 'Sin nombre'
52590
- : 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) || '-' })) })] }));
52591
52668
  };
52592
52669
 
52593
52670
  const ContactInfoLabel = (props) => {
@@ -54721,9 +54798,9 @@ const ContactGeneral = (props) => {
54721
54798
  }
54722
54799
  return age;
54723
54800
  };
54724
- 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) => ({
54725
54802
  owner: typeof value === 'string' ? value : '',
54726
- }), 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) => ({
54727
54804
  birthDate: value,
54728
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)))] }) }));
54729
54806
  };
@@ -54798,9 +54875,9 @@ const BusinessGeneral = (props) => {
54798
54875
  controller.abort();
54799
54876
  };
54800
54877
  }, [api, entityData, users, currentUser]);
54801
- 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) => ({
54802
54879
  owner: typeof value === 'string' ? value : '',
54803
- }), 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)))] }) }));
54804
54881
  };
54805
54882
 
54806
54883
  const General = (props) => {
@@ -56959,7 +57036,7 @@ const ContactInformation = ({ ownerData }) => {
56959
57036
  const contactMethods = [
56960
57037
  {
56961
57038
  key: 'phones',
56962
- title: t('contactDetails.phones'),
57039
+ title: t('conversations.contactDetails.phones'),
56963
57040
  items: phones,
56964
57041
  isPhone: true,
56965
57042
  modalTitle: 'Phones',
@@ -57015,7 +57092,7 @@ const ContactInformation = ({ ownerData }) => {
57015
57092
  visible: true,
57016
57093
  },
57017
57094
  ];
57018
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Section, { title: t('contactDetails.contactInformation'), children: jsxRuntimeExports.jsx(SectionContent, { children: jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-3", children: contactMethods
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
57019
57096
  .filter((method) => method.visible)
57020
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 })] }));
57021
57098
  };
@@ -57028,47 +57105,18 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntity
57028
57105
  onEntityUpdated,
57029
57106
  };
57030
57107
  const t = useTranslationContext();
57031
- return (jsxRuntimeExports.jsx(Section, { title: t('contactDetails.addressInformation'), 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) => ({
57032
- address1: { street: value },
57033
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
57034
- address2: { street: value },
57035
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57036
- address1: { city: value },
57037
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57038
- address2: { city: value },
57039
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57040
- address1: { state: value },
57041
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57042
- address2: { state: value },
57043
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57044
- address1: { zipcode: value },
57045
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57046
- address2: { zipcode: value },
57047
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57048
- address1: { country: value },
57049
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57050
- address2: { country: value },
57051
- }) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.street'), value: entityData.address1?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
57052
- address1: { street: value },
57053
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
57054
- address2: { street: value },
57055
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57056
- address1: { city: value },
57057
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57058
- address2: { city: value },
57059
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57060
- address1: { state: value },
57061
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57062
- address2: { state: value },
57063
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57064
- address1: { zipcode: value },
57065
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57066
- address2: { zipcode: value },
57067
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57068
- address1: { country: value },
57069
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57070
- address2: { country: value },
57071
- }) })] })) }) }));
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' })] }) }) }));
57072
57120
  };
57073
57121
 
57074
57122
  const useEntityUpdateSync = ({ entity, setEntity }) => {
@@ -57182,7 +57230,6 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t })
57182
57230
  return null;
57183
57231
  return createEditContactApi(baseUrl, spaceId);
57184
57232
  }, [baseUrl, spaceId]);
57185
- console.log('[EditContactModal] t fn:', t?.name || 'anonymous', t);
57186
57233
  const { state, selectors, actions } = useEditContactModalController({
57187
57234
  open,
57188
57235
  baseUrl,
@@ -57240,7 +57287,7 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t })
57240
57287
  minHeight: 220,
57241
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: () => {
57242
57289
  setView('tags');
57243
- }, 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' ||
57244
57291
  selectors.contactType === 'business'
57245
57292
  ? selectors.contactType
57246
57293
  : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||