@trii/components 2.0.39 → 2.0.43

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.
Files changed (22) hide show
  1. package/dist/cjs/index.js +245 -114
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/EditContactModal/EditContactModal.d.ts +2 -1
  4. package/dist/cjs/types/components/EditContactModal/components/Header/Header.d.ts +8 -2
  5. package/dist/cjs/types/components/EditContactModal/components/Header/components/ContactName/ContactName.d.ts +12 -0
  6. package/dist/cjs/types/components/EditContactModal/components/Header/components/index.d.ts +1 -0
  7. package/dist/cjs/types/components/EditContactModal/context/NavigateContext.d.ts +9 -0
  8. package/dist/cjs/types/components/EditContactModal/shared/EntityInfoLabel/components/SelectBusinessLabel/SelectBusinessLabel.d.ts +7 -0
  9. package/dist/cjs/types/components/EditContactModal/shared/EntityInfoLabel/components/SelectBusinessLabel/index.d.ts +1 -0
  10. package/dist/cjs/types/components/EditContactModal/shared/EntityInfoLabel/components/index.d.ts +1 -0
  11. package/dist/esm/index.js +246 -115
  12. package/dist/esm/index.js.map +1 -1
  13. package/dist/esm/types/components/EditContactModal/EditContactModal.d.ts +2 -1
  14. package/dist/esm/types/components/EditContactModal/components/Header/Header.d.ts +8 -2
  15. package/dist/esm/types/components/EditContactModal/components/Header/components/ContactName/ContactName.d.ts +12 -0
  16. package/dist/esm/types/components/EditContactModal/components/Header/components/index.d.ts +1 -0
  17. package/dist/esm/types/components/EditContactModal/context/NavigateContext.d.ts +9 -0
  18. package/dist/esm/types/components/EditContactModal/shared/EntityInfoLabel/components/SelectBusinessLabel/SelectBusinessLabel.d.ts +7 -0
  19. package/dist/esm/types/components/EditContactModal/shared/EntityInfoLabel/components/SelectBusinessLabel/index.d.ts +1 -0
  20. package/dist/esm/types/components/EditContactModal/shared/EntityInfoLabel/components/index.d.ts +1 -0
  21. package/dist/index.d.ts +2 -1
  22. package/package.json +1 -1
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$2 = material.styled(material.Box)({
9219
+ const StyledBox$3 = 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$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: {
9260
+ 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: {
9253
9261
  whiteSpace: 'nowrap',
9254
9262
  textOverflow: 'ellipsis',
9255
9263
  overflow: 'hidden',
@@ -15396,22 +15404,20 @@ default_1$e = Label.default = (0, _createSvgIcon$d.default)( /*#__PURE__*/(0, _j
15396
15404
  d: "M17.63 5.84C17.27 5.33 16.67 5 16 5L5 5.01C3.9 5.01 3 5.9 3 7v10c0 1.1.9 1.99 2 1.99L16 19c.67 0 1.27-.33 1.63-.84L22 12z"
15397
15405
  }), 'Label');
15398
15406
 
15399
- const noop$3 = (key) => key;
15400
- const TranslationContext = React$1.createContext(noop$3);
15407
+ const noop$4 = (key) => key;
15408
+ const TranslationContext = React$1.createContext(noop$4);
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 = () => {
15406
15413
  const t = React$1.useContext(TranslationContext);
15407
15414
  if (!t) {
15408
15415
  console.warn('[useTranslationContext] using noop, context value is falsy');
15409
- return noop$3;
15416
+ return noop$4;
15410
15417
  }
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 = {};
@@ -19675,7 +19755,7 @@ Transition.propTypes = process.env.NODE_ENV !== "production" ? {
19675
19755
  onExited: PropTypes.func
19676
19756
  } : {}; // Name the function so it is clearer in the documentation
19677
19757
 
19678
- function noop$2() {}
19758
+ function noop$3() {}
19679
19759
 
19680
19760
  Transition.defaultProps = {
19681
19761
  in: false,
@@ -19684,12 +19764,12 @@ Transition.defaultProps = {
19684
19764
  appear: false,
19685
19765
  enter: true,
19686
19766
  exit: true,
19687
- onEnter: noop$2,
19688
- onEntering: noop$2,
19689
- onEntered: noop$2,
19690
- onExit: noop$2,
19691
- onExiting: noop$2,
19692
- onExited: noop$2
19767
+ onEnter: noop$3,
19768
+ onEntering: noop$3,
19769
+ onEntered: noop$3,
19770
+ onExit: noop$3,
19771
+ onExiting: noop$3,
19772
+ onExited: noop$3
19693
19773
  };
19694
19774
  Transition.UNMOUNTED = UNMOUNTED;
19695
19775
  Transition.EXITED = EXITED;
@@ -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;
@@ -32670,7 +32744,7 @@ const PickersDayFiller = styled$3('div', {
32670
32744
  opacity: 0,
32671
32745
  pointerEvents: 'none'
32672
32746
  }));
32673
- const noop$1 = () => {};
32747
+ const noop$2 = () => {};
32674
32748
  const PickersDayRaw = /*#__PURE__*/React__namespace.forwardRef(function PickersDay(inProps, forwardedRef) {
32675
32749
  const props = useThemeProps({
32676
32750
  props: inProps,
@@ -32683,11 +32757,11 @@ const PickersDayRaw = /*#__PURE__*/React__namespace.forwardRef(function PickersD
32683
32757
  isAnimating,
32684
32758
  onClick,
32685
32759
  onDaySelect,
32686
- onFocus = noop$1,
32687
- onBlur = noop$1,
32688
- onKeyDown = noop$1,
32689
- onMouseDown = noop$1,
32690
- onMouseEnter = noop$1,
32760
+ onFocus = noop$2,
32761
+ onBlur = noop$2,
32762
+ onKeyDown = noop$2,
32763
+ onMouseDown = noop$2,
32764
+ onMouseEnter = noop$2,
32691
32765
  children,
32692
32766
  day,
32693
32767
  selected,
@@ -43182,7 +43256,7 @@ const _excluded$y = ["enableAccessibleFieldDOMStructure"],
43182
43256
  _excluded6 = ["ownerState"],
43183
43257
  _excluded7 = ["ownerState"],
43184
43258
  _excluded8 = ["InputProps", "inputProps"];
43185
- const noop = () => {};
43259
+ const noop$1 = () => {};
43186
43260
  const cleanFieldResponse = _ref => {
43187
43261
  let {
43188
43262
  enableAccessibleFieldDOMStructure
@@ -43199,7 +43273,7 @@ const cleanFieldResponse = _ref => {
43199
43273
  openPickerAriaLabel
43200
43274
  } = fieldResponse,
43201
43275
  other = _objectWithoutPropertiesLoose(fieldResponse, _excluded2$6);
43202
- const mergedInputProps = major >= 6 && other?.slotProps?.input ? mergeSlotProps$1(other?.slotProps?.input, InputProps) : noop;
43276
+ const mergedInputProps = major >= 6 && other?.slotProps?.input ? mergeSlotProps$1(other?.slotProps?.input, InputProps) : noop$1;
43203
43277
  return {
43204
43278
  clearable,
43205
43279
  onClear,
@@ -43234,8 +43308,8 @@ const cleanFieldResponse = _ref => {
43234
43308
  openPickerAriaLabel
43235
43309
  } = fieldResponse,
43236
43310
  other = _objectWithoutPropertiesLoose(fieldResponse, _excluded3);
43237
- const mergedInputProps = major >= 6 && other?.slotProps?.input ? mergeSlotProps$1(other?.slotProps?.input, InputProps) : noop;
43238
- const mergedHtmlInputProps = major >= 6 && other?.slotProps?.htmlInput ? mergeSlotProps$1(other?.slotProps?.htmlInput, inputProps) : noop;
43311
+ const mergedInputProps = major >= 6 && other?.slotProps?.input ? mergeSlotProps$1(other?.slotProps?.input, InputProps) : noop$1;
43312
+ const mergedHtmlInputProps = major >= 6 && other?.slotProps?.htmlInput ? mergeSlotProps$1(other?.slotProps?.htmlInput, inputProps) : noop$1;
43239
43313
  return {
43240
43314
  clearable,
43241
43315
  onClear,
@@ -52453,9 +52527,59 @@ default_1$8 = Cancel.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _
52453
52527
  d: "M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2m5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12z"
52454
52528
  }), 'Cancel');
52455
52529
 
52530
+ const noop = () => { };
52531
+ const NavigateContext = React$1.createContext(noop);
52532
+ const NavigateProvider = ({ navigate, children }) => {
52533
+ return jsxRuntimeExports.jsx(NavigateContext.Provider, { value: navigate, children: children });
52534
+ };
52535
+ const useNavigateContext = () => {
52536
+ const navigate = React$1.useContext(NavigateContext);
52537
+ if (!navigate) {
52538
+ console.warn('[useNavigateContext] using noop, context value is falsy');
52539
+ return noop;
52540
+ }
52541
+ return navigate;
52542
+ };
52543
+
52544
+ function SelectBusinessLabel({ value, displayValue, businessId }) {
52545
+ const api = useEditContactApi();
52546
+ const navigate = useNavigateContext();
52547
+ const [businessData, setBusinessData] = React$1.useState(null);
52548
+ const userImage = useImage({
52549
+ initialImageUrl: businessData?.imageUrl,
52550
+ entityType: 'business',
52551
+ entityId: businessId,
52552
+ });
52553
+ const [anchorEl, setAnchorEl] = React$1.useState(null);
52554
+ const [isLoadingData, setIsLoadingData] = React$1.useState(false);
52555
+ const handleOpenInfoPopover = async (event) => {
52556
+ // Store the target element before any async operations
52557
+ const targetElement = event.currentTarget;
52558
+ setIsLoadingData(true);
52559
+ if (!api) {
52560
+ console.error('API is null');
52561
+ return;
52562
+ }
52563
+ const response = await api.fetchContact({ contactId: businessId });
52564
+ if (response && isBusiness(response)) {
52565
+ setBusinessData(response);
52566
+ }
52567
+ setIsLoadingData(false);
52568
+ if (!targetElement) {
52569
+ console.error('Target element is null');
52570
+ return;
52571
+ }
52572
+ setAnchorEl(targetElement);
52573
+ };
52574
+ return (jsxRuntimeExports.jsxs(material.Box, { display: "flex", alignItems: "center", children: [jsxRuntimeExports.jsx(material.Typography, { onClick: handleOpenInfoPopover, fontWeight: '600', sx: {
52575
+ padding: 1,
52576
+ cursor: 'pointer',
52577
+ }, color: (theme) => theme.palette.text.primary, children: displayValue || (typeof value === 'string' && value) || '-' }), businessData && (jsxRuntimeExports.jsx(ContactInfoPopup, { contactData: businessData, open: Boolean(anchorEl), anchorEl: anchorEl, onClose: () => setAnchorEl(null), navigate: navigate, avatarImgUrl: userImage.imageUrl })), isLoadingData && (jsxRuntimeExports.jsx(material.Box, { display: "flex", alignItems: "center", justifyContent: "center", p: 1, children: jsxRuntimeExports.jsx(material.CircularProgress, { size: 20 }) }))] }));
52578
+ }
52579
+
52456
52580
  const isUserInfo = (option) => 'email' in option;
52457
52581
  const isContactBirthdayProps = (p) => p.entityType === 'contact' && p.inputType === 'birthday';
52458
- const StyledIconButton$2 = material.styled(material.IconButton)({
52582
+ const StyledIconButton$3 = material.styled(material.IconButton)({
52459
52583
  opacity: 0,
52460
52584
  transition: 'opacity 0.3s ease-in-out',
52461
52585
  '& .MuiSvgIcon-root': {
@@ -52471,7 +52595,7 @@ const StyledSaveCancelButton$1 = material.styled(material.IconButton)({
52471
52595
  },
52472
52596
  });
52473
52597
  const EntityInfoLabel = (props) => {
52474
- const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated, } = props;
52598
+ const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated } = props;
52475
52599
  const t = useTranslationContext();
52476
52600
  const inputType = props.inputType ?? 'text';
52477
52601
  const [isEditing, setIsEditing] = React$1.useState(false);
@@ -52585,9 +52709,12 @@ const EntityInfoLabel = (props) => {
52585
52709
  '&:hover .edit-icon': {
52586
52710
  opacity: 1,
52587
52711
  },
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'
52712
+ }, 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('conversations.contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(material.MenuItem, { value: option.id, children: props.entityType === 'contact'
52589
52713
  ? 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) || '-' })) })] }));
52714
+ : 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 &&
52715
+ props.entityType === 'contact' &&
52716
+ inputType === 'selectBusiness' &&
52717
+ props.businessId ? (jsxRuntimeExports.jsx(SelectBusinessLabel, { value: value, displayValue: displayValue, businessId: props.businessId })) : (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
52718
  };
52592
52719
 
52593
52720
  const ContactInfoLabel = (props) => {
@@ -54393,7 +54520,7 @@ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat })
54393
54520
  }, value: value || initDates, onChange: (newValue) => handleChange(newValue), format: dateFormat }) }) }));
54394
54521
  };
54395
54522
 
54396
- const StyledIconButton$1 = material.styled(material.IconButton)(() => ({
54523
+ const StyledIconButton$2 = material.styled(material.IconButton)(() => ({
54397
54524
  opacity: 0,
54398
54525
  transition: 'opacity 0.3s ease-in-out',
54399
54526
  '& .MuiSvgIcon-root': {
@@ -54595,7 +54722,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54595
54722
  else
54596
54723
  return (jsxRuntimeExports.jsx(CustomPropertyInput, { type: type, nameKey: nameKey, value: value, onChange: handleInputChange }));
54597
54724
  };
54598
- 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)
54725
+ 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)
54599
54726
  ? property.type === Contacts.ContactField_type.DATERANGE
54600
54727
  ? (() => {
54601
54728
  if (typeof property.value === 'string') {
@@ -54721,9 +54848,9 @@ const ContactGeneral = (props) => {
54721
54848
  }
54722
54849
  return age;
54723
54850
  };
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) => ({
54851
+ 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
54852
  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) => ({
54853
+ }), 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
54854
  birthDate: value,
54728
54855
  }), 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
54856
  };
@@ -54798,9 +54925,9 @@ const BusinessGeneral = (props) => {
54798
54925
  controller.abort();
54799
54926
  };
54800
54927
  }, [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) => ({
54928
+ 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
54929
  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)))] }) }));
54930
+ }), 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
54931
  };
54805
54932
 
54806
54933
  const General = (props) => {
@@ -54828,7 +54955,7 @@ const useEditModal = () => {
54828
54955
  return { isOpen, title, openModal, closeModal };
54829
54956
  };
54830
54957
 
54831
- const StyledBox$1 = styled$1(material.Box)(({ theme }) => ({
54958
+ const StyledBox$2 = styled$1(material.Box)(({ theme }) => ({
54832
54959
  display: 'flex',
54833
54960
  alignItems: 'flex-start',
54834
54961
  justifyContent: 'space-between',
@@ -54895,7 +55022,7 @@ const ContactMethodItem = ({ item }) => {
54895
55022
  const { imageUrl } = useImage({
54896
55023
  initialImageUrl: avatarUrlWithoutAccess,
54897
55024
  });
54898
- 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: {
55025
+ 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: {
54899
55026
  marginTop: '-10px',
54900
55027
  marginLeft: '5px',
54901
55028
  fontSize: '10px',
@@ -56155,7 +56282,7 @@ const formatPhoneForDisplay = (number) => {
56155
56282
  }
56156
56283
  };
56157
56284
 
56158
- const StyledIconButton = styled$1(material.IconButton)(({ theme }) => ({
56285
+ const StyledIconButton$1 = styled$1(material.IconButton)(({ theme }) => ({
56159
56286
  padding: theme.spacing(0.5),
56160
56287
  marginTop: '-5px',
56161
56288
  }));
@@ -56164,7 +56291,7 @@ const StyledLocalPhoneIcon = styled$1(default_1$7)(({ theme }) => ({
56164
56291
  width: 16,
56165
56292
  color: theme.palette.secondary.main
56166
56293
  }));
56167
- const StyledBox = styled$1(material.Box)(({ theme }) => ({
56294
+ const StyledBox$1 = styled$1(material.Box)(({ theme }) => ({
56168
56295
  display: 'flex',
56169
56296
  alignItems: 'flex-start',
56170
56297
  justifyContent: 'space-between',
@@ -56227,7 +56354,7 @@ const ContactMethodPhoneItem = ({ item }) => {
56227
56354
  window.dispatchEvent(event);
56228
56355
  };
56229
56356
  const formattedPhone = React$1.useMemo(() => formatPhoneForDisplay(item.address || ''), [item.address]);
56230
- 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: {
56357
+ 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: {
56231
56358
  display: 'flex',
56232
56359
  alignItems: 'center',
56233
56360
  justifyContent: 'flex-end',
@@ -56238,8 +56365,42 @@ const ContactMethodPhoneItem = ({ item }) => {
56238
56365
  } })) }) }) })] }) }));
56239
56366
  };
56240
56367
 
56368
+ const StyledBox = material.styled(material.Box)(({ theme }) => ({
56369
+ display: 'flex',
56370
+ flexDirection: 'column',
56371
+ padding: theme.spacing(1, 0, 2, 0),
56372
+ width: '100%',
56373
+ gap: theme.spacing(1),
56374
+ '&:hover .edit-icon': {
56375
+ opacity: 1,
56376
+ },
56377
+ }));
56378
+ const StyledTypography = material.styled(material.Typography)(({}) => ({
56379
+ letterSpacing: -0.5,
56380
+ fontSize: 14,
56381
+ fontWeight: 600,
56382
+ }));
56383
+ const HeaderBox = material.styled(material.Box)(({}) => ({
56384
+ display: 'flex',
56385
+ alignItems: 'center',
56386
+ }));
56387
+ const MethodItemsBox = material.styled(material.Box)(({ theme }) => ({
56388
+ display: 'flex',
56389
+ flexDirection: 'column',
56390
+ gap: theme.spacing(1),
56391
+ width: '100%',
56392
+ }));
56393
+ const StyledIconButton = material.styled(material.IconButton)({
56394
+ opacity: 0,
56395
+ transition: 'opacity 0.3s ease-in-out',
56396
+ '& .MuiSvgIcon-root': {
56397
+ width: '0.8em',
56398
+ height: '0.8em',
56399
+ },
56400
+ marginLeft: '15px',
56401
+ });
56241
56402
  const ContactMethod = ({ title, methodItems, isPhone, handleEdit, owner }) => {
56242
- 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) => {
56403
+ return (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", sx: { color: (theme) => theme.palette.secondary.main } }) })] }), jsxRuntimeExports.jsx(MethodItemsBox, { children: methodItems.map((item, index) => {
56243
56404
  if (isPhone) {
56244
56405
  return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56245
56406
  }
@@ -56959,7 +57120,7 @@ const ContactInformation = ({ ownerData }) => {
56959
57120
  const contactMethods = [
56960
57121
  {
56961
57122
  key: 'phones',
56962
- title: t('contactDetails.phones'),
57123
+ title: t('conversations.contactDetails.phones'),
56963
57124
  items: phones,
56964
57125
  isPhone: true,
56965
57126
  modalTitle: 'Phones',
@@ -57015,7 +57176,7 @@ const ContactInformation = ({ ownerData }) => {
57015
57176
  visible: true,
57016
57177
  },
57017
57178
  ];
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
57179
+ 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
57180
  .filter((method) => method.visible)
57020
57181
  .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
57182
  };
@@ -57028,47 +57189,18 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntity
57028
57189
  onEntityUpdated,
57029
57190
  };
57030
57191
  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
- }) })] })) }) }));
57192
+ const AddressGroup = ({ addressNumber, title, }) => (jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 rounded-xl p-4", children: [jsxRuntimeExports.jsx(material.Typography, { variant: "h6", 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) => ({
57193
+ [addressNumber]: { street: value },
57194
+ }), minWidth: "100%" }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.city'), value: entityData[addressNumber]?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57195
+ [addressNumber]: { city: value },
57196
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.state'), value: entityData[addressNumber]?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57197
+ [addressNumber]: { state: value },
57198
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.postcode'), value: entityData[addressNumber]?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57199
+ [addressNumber]: { zipcode: value },
57200
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.country'), value: entityData[addressNumber]?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57201
+ [addressNumber]: { country: value },
57202
+ }), minWidth: "100%" })] })] }));
57203
+ return (jsxRuntimeExports.jsx(Section, { title: t('conversations.contactDetails.addressInformation'), children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [jsxRuntimeExports.jsx(AddressGroup, { addressNumber: "address1", title: t('conversations.contactDetails.primaryAddress') }), jsxRuntimeExports.jsx(AddressGroup, { addressNumber: "address2", title: t('conversations.contactDetails.secondaryAddress') })] }) }));
57072
57204
  };
57073
57205
 
57074
57206
  const useEntityUpdateSync = ({ entity, setEntity }) => {
@@ -57176,13 +57308,12 @@ const useModalCloseHandler = ({ onClose }) => {
57176
57308
  return handleClose;
57177
57309
  };
57178
57310
 
57179
- const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t }) => {
57311
+ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, navigate, }) => {
57180
57312
  const api = React$1.useMemo(() => {
57181
57313
  if (!baseUrl || !spaceId)
57182
57314
  return null;
57183
57315
  return createEditContactApi(baseUrl, spaceId);
57184
57316
  }, [baseUrl, spaceId]);
57185
- console.log('[EditContactModal] t fn:', t?.name || 'anonymous', t);
57186
57317
  const { state, selectors, actions } = useEditContactModalController({
57187
57318
  open,
57188
57319
  baseUrl,
@@ -57233,20 +57364,20 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t })
57233
57364
  overflow: 'hidden',
57234
57365
  };
57235
57366
  const mergedSx = Array.isArray(sx) ? [baseSx, ...sx] : sx ? [baseSx, sx] : baseSx;
57236
- return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, children: jsxRuntimeExports.jsx(TranslationProvider, { t: t, children: jsxRuntimeExports.jsx(material.Modal, { open: open, onClose: handleClose, closeAfterTransition: true, slots: { backdrop: material.Backdrop }, slotProps: { backdrop: { timeout: 200 } }, children: jsxRuntimeExports.jsx(material.Fade, { in: open, timeout: 200, children: jsxRuntimeExports.jsx(material.Box, { sx: mergedSx, children: state.isLoading && !state.contactData ? (jsxRuntimeExports.jsx(material.Box, { sx: {
57237
- display: 'flex',
57238
- justifyContent: 'center',
57239
- alignItems: 'center',
57240
- minHeight: 220,
57241
- }, 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
- 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' ||
57244
- selectors.contactType === 'business'
57245
- ? selectors.contactType
57246
- : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
57247
- selectors.contactType === 'business'
57248
- ? selectors.contactType
57249
- : 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsx(ContactInformation, { ownerData: state.contactData })] })] }) }), jsxRuntimeExports.jsx(material.Fade, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: jsxRuntimeExports.jsx(TagsEditor, { value: draftLabels, options: selectors.labels, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags }) }) })] }) })) : null }) }) }) }) }));
57367
+ return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, children: jsxRuntimeExports.jsx(TranslationProvider, { t: t, children: jsxRuntimeExports.jsx(NavigateProvider, { navigate: navigate, children: jsxRuntimeExports.jsx(material.Modal, { open: open, onClose: handleClose, closeAfterTransition: true, slots: { backdrop: material.Backdrop }, slotProps: { backdrop: { timeout: 200 } }, children: jsxRuntimeExports.jsx(material.Fade, { in: open, timeout: 200, children: jsxRuntimeExports.jsx(material.Box, { sx: mergedSx, children: state.isLoading && !state.contactData ? (jsxRuntimeExports.jsx(material.Box, { sx: {
57368
+ display: 'flex',
57369
+ justifyContent: 'center',
57370
+ alignItems: 'center',
57371
+ minHeight: 220,
57372
+ }, 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: () => {
57373
+ setView('tags');
57374
+ }, 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' ||
57375
+ selectors.contactType === 'business'
57376
+ ? selectors.contactType
57377
+ : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
57378
+ selectors.contactType === 'business'
57379
+ ? selectors.contactType
57380
+ : 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsx(ContactInformation, { ownerData: state.contactData })] })] }) }), jsxRuntimeExports.jsx(material.Fade, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: jsxRuntimeExports.jsx(TagsEditor, { value: draftLabels, options: selectors.labels, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags }) }) })] }) })) : null }) }) }) }) }) }));
57250
57381
  };
57251
57382
 
57252
57383
  exports.ContactInfoPopup = ContactInfoPopup;