@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/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React$1 from 'react';
2
2
  import React__default, { useCallback, useEffect, createContext, useContext, useState, useMemo, Children, isValidElement, cloneElement, useRef } from 'react';
3
- import { styled as styled$5, Box as Box$2, IconButton as IconButton$2, Avatar, Typography as Typography$2, CircularProgress as CircularProgress$2, Tooltip, Chip as Chip$2, Popper as Popper$2, ClickAwayListener, CardContent, Stack as Stack$2, Popover as Popover$2, Autocomplete, TextField as TextField$1, Divider, Select as Select$2, MenuItem as MenuItem$2, FormControl as FormControl$2, Button as Button$2, Menu as Menu$2, ListItemIcon, ListItemText, Modal as Modal$2, Grid, Backdrop as Backdrop$2, Fade as Fade$2 } from '@mui/material';
3
+ import { styled as styled$5, Box as Box$2, IconButton as IconButton$2, Avatar, Typography as Typography$2, CircularProgress as CircularProgress$2, Tooltip, Chip as Chip$2, Popper as Popper$2, ClickAwayListener, CardContent, Stack as Stack$2, Popover as Popover$2, TextField as TextField$1, Autocomplete, Divider, Select as Select$2, MenuItem as MenuItem$2, FormControl as FormControl$2, Button as Button$2, Menu as Menu$2, ListItemIcon, ListItemText, Modal as Modal$2, Grid, Backdrop as Backdrop$2, Fade as Fade$2 } from '@mui/material';
4
4
  import { withEmotionCache, ThemeContext, CacheProvider, Global, css, keyframes } from '@emotion/react';
5
5
  import * as ReactDOM from 'react-dom';
6
6
  import ReactDOM__default from 'react-dom';
@@ -8998,6 +8998,10 @@ var utils = /*#__PURE__*/Object.freeze({
8998
8998
  useIsFocusVisible: useIsFocusVisible
8999
8999
  });
9000
9000
 
9001
+ var Edit$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9002
+ d: "M3 17.25V21h3.75L17.81 9.94l-3.75-3.75zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75z"
9003
+ }), 'Edit');
9004
+
9001
9005
  var Email$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9002
9006
  d: "M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2m0 4-8 5-8-5V6l8 5 8-5z"
9003
9007
  }), 'Email');
@@ -9020,6 +9024,10 @@ var PhoneEnabled = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9020
9024
  d: "m17.38 10.79-2.2-2.2c-.28-.28-.36-.67-.25-1.02.37-1.12.57-2.32.57-3.57 0-.55.45-1 1-1H20c.55 0 1 .45 1 1 0 9.39-7.61 17-17 17-.55 0-1-.45-1-1v-3.49c0-.55.45-1 1-1 1.24 0 2.45-.2 3.57-.57.35-.12.75-.03 1.02.24l2.2 2.2c2.83-1.45 5.15-3.76 6.59-6.59"
9021
9025
  }), 'PhoneEnabled');
9022
9026
 
9027
+ var Save$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9028
+ d: "M17 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V7zm-5 16c-1.66 0-3-1.34-3-3s1.34-3 3-3 3 1.34 3 3-1.34 3-3 3m3-10H5V5h10z"
9029
+ }), 'Save');
9030
+
9023
9031
  var Star = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9024
9032
  d: "M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"
9025
9033
  }), 'Star');
@@ -9188,7 +9196,7 @@ const TitleBox = styled$5(Box$2)({
9188
9196
  width: '100%',
9189
9197
  borderBottom: `1px solid lightgray`,
9190
9198
  });
9191
- const StyledBox$2 = styled$5(Box$2)({
9199
+ const StyledBox$3 = styled$5(Box$2)({
9192
9200
  display: 'flex',
9193
9201
  alignItems: 'center',
9194
9202
  justifyContent: 'space-between',
@@ -9229,7 +9237,7 @@ const NoteText$2 = styled$5(Typography$2)({
9229
9237
  left: 40,
9230
9238
  });
9231
9239
  const ContactMethod$1 = ({ icon, contactList, title, showTitle = true, }) => {
9232
- const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox$2, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
9240
+ const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox$3, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
9233
9241
  whiteSpace: 'nowrap',
9234
9242
  textOverflow: 'ellipsis',
9235
9243
  overflow: 'hidden',
@@ -15376,22 +15384,20 @@ default_1$e = Label.default = (0, _createSvgIcon$d.default)( /*#__PURE__*/(0, _j
15376
15384
  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"
15377
15385
  }), 'Label');
15378
15386
 
15379
- const noop$3 = (key) => key;
15380
- const TranslationContext = createContext(noop$3);
15387
+ const noop$4 = (key) => key;
15388
+ const TranslationContext = createContext(noop$4);
15381
15389
  const TranslationProvider = ({ t, children }) => {
15382
- console.log('[TranslationProvider] t fn:', t?.name || 'anonymous', t);
15383
15390
  return jsxRuntimeExports.jsx(TranslationContext.Provider, { value: t, children: children });
15384
15391
  };
15385
15392
  const useTranslationContext = () => {
15386
15393
  const t = useContext(TranslationContext);
15387
15394
  if (!t) {
15388
15395
  console.warn('[useTranslationContext] using noop, context value is falsy');
15389
- return noop$3;
15396
+ return noop$4;
15390
15397
  }
15391
15398
  return (...args) => {
15392
15399
  const [key, ...rest] = args;
15393
15400
  const result = t(key, ...rest);
15394
- console.log('[useTranslationContext] key:', key, 'args:', rest, 'result:', result);
15395
15401
  return result;
15396
15402
  };
15397
15403
  };
@@ -15451,6 +15457,87 @@ const Tags = ({ tags, onEditTags }) => {
15451
15457
  } }, tag.id))) })] }) })] }));
15452
15458
  };
15453
15459
 
15460
+ const EditContactApiContext = createContext(null);
15461
+ const EditContactApiProvider = EditContactApiContext.Provider;
15462
+ const useEditContactApi = () => {
15463
+ return useContext(EditContactApiContext);
15464
+ };
15465
+
15466
+ const NameText = styled$5(Typography$2)({
15467
+ whiteSpace: 'nowrap',
15468
+ overflow: 'hidden',
15469
+ textOverflow: 'ellipsis',
15470
+ maxWidth: 360,
15471
+ textAlign: 'center',
15472
+ });
15473
+ const NameWrapper = styled$5(Box$2)({
15474
+ display: 'flex',
15475
+ alignItems: 'center',
15476
+ justifyContent: 'center',
15477
+ gap: '8px',
15478
+ width: '100%',
15479
+ '&:hover .edit-icon': {
15480
+ opacity: 1,
15481
+ visibility: 'visible',
15482
+ },
15483
+ });
15484
+ const EditButton = styled$5(IconButton$2)({
15485
+ opacity: 0,
15486
+ visibility: 'hidden',
15487
+ transition: 'all 0.2s',
15488
+ });
15489
+ const ContactName = ({ displayName, contactType, firstName, lastName, name, entityId, onEntityUpdated, }) => {
15490
+ const api = useEditContactApi();
15491
+ const [isEditing, setIsEditing] = useState(false);
15492
+ const [loading, setLoading] = useState(false);
15493
+ const [values, setValues] = useState({
15494
+ firstName: firstName || '',
15495
+ lastName: lastName || '',
15496
+ name: name || '',
15497
+ });
15498
+ useEffect(() => {
15499
+ setValues({
15500
+ firstName: firstName || '',
15501
+ lastName: lastName || '',
15502
+ name: name || '',
15503
+ });
15504
+ }, [firstName, lastName, name]);
15505
+ const handleSave = async () => {
15506
+ if (!api || !entityId || !contactType || contactType === 'unknown')
15507
+ return;
15508
+ setLoading(true);
15509
+ try {
15510
+ let body = {};
15511
+ if (contactType === 'contact') {
15512
+ body = { firstName: values.firstName, lastName: values.lastName };
15513
+ }
15514
+ else if (contactType === 'business') {
15515
+ body = { name: values.name };
15516
+ }
15517
+ const updated = await api.updateEntity({
15518
+ entityType: contactType,
15519
+ entityId,
15520
+ body,
15521
+ });
15522
+ if (updated && onEntityUpdated) {
15523
+ onEntityUpdated(updated);
15524
+ }
15525
+ setIsEditing(false);
15526
+ }
15527
+ catch (err) {
15528
+ console.error('Failed to update name', err);
15529
+ }
15530
+ finally {
15531
+ setLoading(false);
15532
+ }
15533
+ };
15534
+ const showEdit = contactType === 'contact' || contactType === 'business';
15535
+ if (isEditing) {
15536
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: { display: 'flex', alignItems: 'center', gap: 1, mt: 1 }, children: [contactType === 'contact' ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(TextField$1, { value: values.firstName, onChange: (e) => setValues({ ...values, firstName: e.target.value }), size: "small", placeholder: "First Name", sx: { width: 140 } }), jsxRuntimeExports.jsx(TextField$1, { value: values.lastName, onChange: (e) => setValues({ ...values, lastName: e.target.value }), size: "small", placeholder: "Last Name", sx: { width: 140 } })] })) : (jsxRuntimeExports.jsx(TextField$1, { value: values.name, onChange: (e) => setValues({ ...values, name: e.target.value }), size: "small", placeholder: "Name", sx: { width: 280 } })), jsxRuntimeExports.jsx(IconButton$2, { onClick: handleSave, disabled: loading, color: "primary", children: loading ? jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) : jsxRuntimeExports.jsx(Save$1, {}) })] }));
15537
+ }
15538
+ return (jsxRuntimeExports.jsxs(NameWrapper, { children: [jsxRuntimeExports.jsx(NameText, { variant: "h6", title: displayName, children: displayName }), showEdit && (jsxRuntimeExports.jsx(EditButton, { size: "small", onClick: () => setIsEditing(true), className: "edit-icon", children: jsxRuntimeExports.jsx(Edit$1, { fontSize: "small" }) }))] }));
15539
+ };
15540
+
15454
15541
  var Delete = {};
15455
15542
 
15456
15543
  var _interopRequireDefault$c = interopRequireDefaultExports;
@@ -15526,16 +15613,9 @@ const HeaderContainer = styled$5(Box$2)({
15526
15613
  marginBottom: '20px',
15527
15614
  position: 'relative',
15528
15615
  });
15529
- const ContactName = styled$5(Typography$2)({
15530
- whiteSpace: 'nowrap',
15531
- overflow: 'hidden',
15532
- textOverflow: 'ellipsis',
15533
- maxWidth: 360,
15534
- textAlign: 'center',
15535
- });
15536
- const Header = ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
15616
+ const Header = ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, contactType, firstName, lastName, name, entityId, onEntityUpdated, }) => {
15537
15617
  const avatarAlt = `Avatar for ${displayName}`;
15538
- return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsx("input", { ref: photoInputRef, type: "file", accept: "image/*", onChange: onPhotoFileChange, style: { display: 'none' } }), jsxRuntimeExports.jsx(AvatarWithActions, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')), onUpload: onUploadPhoto, isUploading: isUploadingPhoto, onDelete: onDeletePhoto, isDeleting: isDeletingPhoto }), jsxRuntimeExports.jsx(ContactName, { variant: "h6", title: displayName, children: displayName }), jsxRuntimeExports.jsx(Tags, { tags: tags, onEditTags: onEditTags })] }));
15618
+ return (jsxRuntimeExports.jsxs(HeaderContainer, { children: [jsxRuntimeExports.jsx("input", { ref: photoInputRef, type: "file", accept: "image/*", onChange: onPhotoFileChange, style: { display: 'none' } }), jsxRuntimeExports.jsx(AvatarWithActions, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')), onUpload: onUploadPhoto, isUploading: isUploadingPhoto, onDelete: onDeletePhoto, isDeleting: isDeletingPhoto }), jsxRuntimeExports.jsx(ContactName, { displayName: displayName, contactType: contactType, firstName: firstName, lastName: lastName, name: name, entityId: entityId, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(Tags, { tags: tags, onEditTags: onEditTags })] }));
15539
15619
  };
15540
15620
 
15541
15621
  var ArrowBack = {};
@@ -19655,7 +19735,7 @@ Transition.propTypes = process.env.NODE_ENV !== "production" ? {
19655
19735
  onExited: PropTypes.func
19656
19736
  } : {}; // Name the function so it is clearer in the documentation
19657
19737
 
19658
- function noop$2() {}
19738
+ function noop$3() {}
19659
19739
 
19660
19740
  Transition.defaultProps = {
19661
19741
  in: false,
@@ -19664,12 +19744,12 @@ Transition.defaultProps = {
19664
19744
  appear: false,
19665
19745
  enter: true,
19666
19746
  exit: true,
19667
- onEnter: noop$2,
19668
- onEntering: noop$2,
19669
- onEntered: noop$2,
19670
- onExit: noop$2,
19671
- onExiting: noop$2,
19672
- onExited: noop$2
19747
+ onEnter: noop$3,
19748
+ onEntering: noop$3,
19749
+ onEntered: noop$3,
19750
+ onExit: noop$3,
19751
+ onExiting: noop$3,
19752
+ onExited: noop$3
19673
19753
  };
19674
19754
  Transition.UNMOUNTED = UNMOUNTED;
19675
19755
  Transition.EXITED = EXITED;
@@ -26306,12 +26386,6 @@ const useEditEntity = () => {
26306
26386
  return ctx;
26307
26387
  };
26308
26388
 
26309
- const EditContactApiContext = createContext(null);
26310
- const EditContactApiProvider = EditContactApiContext.Provider;
26311
- const useEditContactApi = () => {
26312
- return useContext(EditContactApiContext);
26313
- };
26314
-
26315
26389
  const resolveUserLabel = ({ userId, users, currentUser, }) => {
26316
26390
  if (!userId)
26317
26391
  return null;
@@ -32650,7 +32724,7 @@ const PickersDayFiller = styled$3('div', {
32650
32724
  opacity: 0,
32651
32725
  pointerEvents: 'none'
32652
32726
  }));
32653
- const noop$1 = () => {};
32727
+ const noop$2 = () => {};
32654
32728
  const PickersDayRaw = /*#__PURE__*/React$1.forwardRef(function PickersDay(inProps, forwardedRef) {
32655
32729
  const props = useThemeProps({
32656
32730
  props: inProps,
@@ -32663,11 +32737,11 @@ const PickersDayRaw = /*#__PURE__*/React$1.forwardRef(function PickersDay(inProp
32663
32737
  isAnimating,
32664
32738
  onClick,
32665
32739
  onDaySelect,
32666
- onFocus = noop$1,
32667
- onBlur = noop$1,
32668
- onKeyDown = noop$1,
32669
- onMouseDown = noop$1,
32670
- onMouseEnter = noop$1,
32740
+ onFocus = noop$2,
32741
+ onBlur = noop$2,
32742
+ onKeyDown = noop$2,
32743
+ onMouseDown = noop$2,
32744
+ onMouseEnter = noop$2,
32671
32745
  children,
32672
32746
  day,
32673
32747
  selected,
@@ -43162,7 +43236,7 @@ const _excluded$y = ["enableAccessibleFieldDOMStructure"],
43162
43236
  _excluded6 = ["ownerState"],
43163
43237
  _excluded7 = ["ownerState"],
43164
43238
  _excluded8 = ["InputProps", "inputProps"];
43165
- const noop = () => {};
43239
+ const noop$1 = () => {};
43166
43240
  const cleanFieldResponse = _ref => {
43167
43241
  let {
43168
43242
  enableAccessibleFieldDOMStructure
@@ -43179,7 +43253,7 @@ const cleanFieldResponse = _ref => {
43179
43253
  openPickerAriaLabel
43180
43254
  } = fieldResponse,
43181
43255
  other = _objectWithoutPropertiesLoose(fieldResponse, _excluded2$6);
43182
- const mergedInputProps = major >= 6 && other?.slotProps?.input ? mergeSlotProps$1(other?.slotProps?.input, InputProps) : noop;
43256
+ const mergedInputProps = major >= 6 && other?.slotProps?.input ? mergeSlotProps$1(other?.slotProps?.input, InputProps) : noop$1;
43183
43257
  return {
43184
43258
  clearable,
43185
43259
  onClear,
@@ -43214,8 +43288,8 @@ const cleanFieldResponse = _ref => {
43214
43288
  openPickerAriaLabel
43215
43289
  } = fieldResponse,
43216
43290
  other = _objectWithoutPropertiesLoose(fieldResponse, _excluded3);
43217
- const mergedInputProps = major >= 6 && other?.slotProps?.input ? mergeSlotProps$1(other?.slotProps?.input, InputProps) : noop;
43218
- const mergedHtmlInputProps = major >= 6 && other?.slotProps?.htmlInput ? mergeSlotProps$1(other?.slotProps?.htmlInput, inputProps) : noop;
43291
+ const mergedInputProps = major >= 6 && other?.slotProps?.input ? mergeSlotProps$1(other?.slotProps?.input, InputProps) : noop$1;
43292
+ const mergedHtmlInputProps = major >= 6 && other?.slotProps?.htmlInput ? mergeSlotProps$1(other?.slotProps?.htmlInput, inputProps) : noop$1;
43219
43293
  return {
43220
43294
  clearable,
43221
43295
  onClear,
@@ -52433,9 +52507,59 @@ default_1$8 = Cancel.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _
52433
52507
  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"
52434
52508
  }), 'Cancel');
52435
52509
 
52510
+ const noop = () => { };
52511
+ const NavigateContext = createContext(noop);
52512
+ const NavigateProvider = ({ navigate, children }) => {
52513
+ return jsxRuntimeExports.jsx(NavigateContext.Provider, { value: navigate, children: children });
52514
+ };
52515
+ const useNavigateContext = () => {
52516
+ const navigate = useContext(NavigateContext);
52517
+ if (!navigate) {
52518
+ console.warn('[useNavigateContext] using noop, context value is falsy');
52519
+ return noop;
52520
+ }
52521
+ return navigate;
52522
+ };
52523
+
52524
+ function SelectBusinessLabel({ value, displayValue, businessId }) {
52525
+ const api = useEditContactApi();
52526
+ const navigate = useNavigateContext();
52527
+ const [businessData, setBusinessData] = useState(null);
52528
+ const userImage = useImage({
52529
+ initialImageUrl: businessData?.imageUrl,
52530
+ entityType: 'business',
52531
+ entityId: businessId,
52532
+ });
52533
+ const [anchorEl, setAnchorEl] = useState(null);
52534
+ const [isLoadingData, setIsLoadingData] = useState(false);
52535
+ const handleOpenInfoPopover = async (event) => {
52536
+ // Store the target element before any async operations
52537
+ const targetElement = event.currentTarget;
52538
+ setIsLoadingData(true);
52539
+ if (!api) {
52540
+ console.error('API is null');
52541
+ return;
52542
+ }
52543
+ const response = await api.fetchContact({ contactId: businessId });
52544
+ if (response && isBusiness(response)) {
52545
+ setBusinessData(response);
52546
+ }
52547
+ setIsLoadingData(false);
52548
+ if (!targetElement) {
52549
+ console.error('Target element is null');
52550
+ return;
52551
+ }
52552
+ setAnchorEl(targetElement);
52553
+ };
52554
+ return (jsxRuntimeExports.jsxs(Box$2, { display: "flex", alignItems: "center", children: [jsxRuntimeExports.jsx(Typography$2, { onClick: handleOpenInfoPopover, fontWeight: '600', sx: {
52555
+ padding: 1,
52556
+ cursor: 'pointer',
52557
+ }, 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(Box$2, { display: "flex", alignItems: "center", justifyContent: "center", p: 1, children: jsxRuntimeExports.jsx(CircularProgress$2, { size: 20 }) }))] }));
52558
+ }
52559
+
52436
52560
  const isUserInfo = (option) => 'email' in option;
52437
52561
  const isContactBirthdayProps = (p) => p.entityType === 'contact' && p.inputType === 'birthday';
52438
- const StyledIconButton$2 = styled$5(IconButton$2)({
52562
+ const StyledIconButton$3 = styled$5(IconButton$2)({
52439
52563
  opacity: 0,
52440
52564
  transition: 'opacity 0.3s ease-in-out',
52441
52565
  '& .MuiSvgIcon-root': {
@@ -52451,7 +52575,7 @@ const StyledSaveCancelButton$1 = styled$5(IconButton$2)({
52451
52575
  },
52452
52576
  });
52453
52577
  const EntityInfoLabel = (props) => {
52454
- const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated, } = props;
52578
+ const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated } = props;
52455
52579
  const t = useTranslationContext();
52456
52580
  const inputType = props.inputType ?? 'text';
52457
52581
  const [isEditing, setIsEditing] = useState(false);
@@ -52565,9 +52689,12 @@ const EntityInfoLabel = (props) => {
52565
52689
  '&:hover .edit-icon': {
52566
52690
  opacity: 1,
52567
52691
  },
52568
- }, children: [jsxRuntimeExports.jsxs(Box$2, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(Typography$2, { letterSpacing: -0.5, fontWeight: '600', alignSelf: 'center', flexGrow: isEditing ? 1 : 0, color: (theme) => theme.palette.text.primary, children: title }), isNotEditable ? null : isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$2, { className: "edit-icon", size: "small", onClick: handleEditClick, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(Box$2, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(TextField$1, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(Select$2, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(MenuItem$2, { value: "", children: t('contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(MenuItem$2, { value: option.id, children: props.entityType === 'contact'
52692
+ }, children: [jsxRuntimeExports.jsxs(Box$2, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(Typography$2, { letterSpacing: -0.5, fontWeight: '600', alignSelf: 'center', flexGrow: isEditing ? 1 : 0, color: (theme) => theme.palette.text.primary, children: title }), isNotEditable ? null : isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$3, { className: "edit-icon", size: "small", onClick: handleEditClick, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(Box$2, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(TextField$1, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(Select$2, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(MenuItem$2, { value: "", children: t('conversations.contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(MenuItem$2, { value: option.id, children: props.entityType === 'contact'
52569
52693
  ? option.name?.trim() || (isUserInfo(option) ? option.email : '') || 'Sin nombre'
52570
- : option.name?.trim() || option.email || 'Sin nombre' }, index)))] })) : isEditing && isContactBirthdayProps(props) ? (jsxRuntimeExports.jsx(DateSelect, { birthDate: props.contact.field.birthDate, setBirthDate: props.contact.action.setBirthDate, dateFormat: props.dateFormat })) : !isEditing && props.entityType === 'contact' && inputType === 'selectBusiness' && props.businessId ? (jsxRuntimeExports.jsx(Box$2, { display: "flex", alignItems: "center", children: "Popover" })) : (jsxRuntimeExports.jsx(Typography$2, { fontWeight: '400', sx: { padding: '2.5px 14px 8.5px 0px' }, color: (theme) => theme.palette.text.primary, children: displayValue || (typeof value === 'string' && value) || '-' })) })] }));
52694
+ : 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 &&
52695
+ props.entityType === 'contact' &&
52696
+ inputType === 'selectBusiness' &&
52697
+ props.businessId ? (jsxRuntimeExports.jsx(SelectBusinessLabel, { value: value, displayValue: displayValue, businessId: props.businessId })) : (jsxRuntimeExports.jsx(Typography$2, { fontWeight: '400', sx: { padding: '2.5px 14px 8.5px 0px' }, color: (theme) => theme.palette.text.primary, children: displayValue || (typeof value === 'string' && value) || '-' })) })] }));
52571
52698
  };
52572
52699
 
52573
52700
  const ContactInfoLabel = (props) => {
@@ -54373,7 +54500,7 @@ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat })
54373
54500
  }, value: value || initDates, onChange: (newValue) => handleChange(newValue), format: dateFormat }) }) }));
54374
54501
  };
54375
54502
 
54376
- const StyledIconButton$1 = styled$5(IconButton$2)(() => ({
54503
+ const StyledIconButton$2 = styled$5(IconButton$2)(() => ({
54377
54504
  opacity: 0,
54378
54505
  transition: 'opacity 0.3s ease-in-out',
54379
54506
  '& .MuiSvgIcon-root': {
@@ -54575,7 +54702,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54575
54702
  else
54576
54703
  return (jsxRuntimeExports.jsx(CustomPropertyInput, { type: type, nameKey: nameKey, value: value, onChange: handleInputChange }));
54577
54704
  };
54578
- return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT ? 'contacts-col-12' : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(Box$2, { display: "flex", position: "relative", minHeight: "25px", children: [jsxRuntimeExports.jsx(FieldName, { flexGrow: isEditing ? 1 : 0, children: getPropertyName(property.nameKey) }), isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$1, { className: "edit-icon", size: "small", onClick: toggleEdit, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(Box$2, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT ? '100%' : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
54705
+ return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT ? 'contacts-col-12' : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(Box$2, { display: "flex", position: "relative", minHeight: "25px", children: [jsxRuntimeExports.jsx(FieldName, { flexGrow: isEditing ? 1 : 0, children: getPropertyName(property.nameKey) }), isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$2, { className: "edit-icon", size: "small", onClick: toggleEdit, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(Box$2, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT ? '100%' : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
54579
54706
  ? property.type === Contacts.ContactField_type.DATERANGE
54580
54707
  ? (() => {
54581
54708
  if (typeof property.value === 'string') {
@@ -54701,9 +54828,9 @@ const ContactGeneral = (props) => {
54701
54828
  }
54702
54829
  return age;
54703
54830
  };
54704
- 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) => ({
54831
+ 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) => ({
54705
54832
  owner: typeof value === 'string' ? value : '',
54706
- }), 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) => ({
54833
+ }), 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) => ({
54707
54834
  birthDate: value,
54708
54835
  }), 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)))] }) }));
54709
54836
  };
@@ -54778,9 +54905,9 @@ const BusinessGeneral = (props) => {
54778
54905
  controller.abort();
54779
54906
  };
54780
54907
  }, [api, entityData, users, currentUser]);
54781
- 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) => ({
54908
+ 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) => ({
54782
54909
  owner: typeof value === 'string' ? value : '',
54783
- }), 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)))] }) }));
54910
+ }), 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)))] }) }));
54784
54911
  };
54785
54912
 
54786
54913
  const General = (props) => {
@@ -54808,7 +54935,7 @@ const useEditModal = () => {
54808
54935
  return { isOpen, title, openModal, closeModal };
54809
54936
  };
54810
54937
 
54811
- const StyledBox$1 = styled$1(Box$2)(({ theme }) => ({
54938
+ const StyledBox$2 = styled$1(Box$2)(({ theme }) => ({
54812
54939
  display: 'flex',
54813
54940
  alignItems: 'flex-start',
54814
54941
  justifyContent: 'space-between',
@@ -54875,7 +55002,7 @@ const ContactMethodItem = ({ item }) => {
54875
55002
  const { imageUrl } = useImage({
54876
55003
  initialImageUrl: avatarUrlWithoutAccess,
54877
55004
  });
54878
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$1, { children: [jsxRuntimeExports.jsx(LeftSection$1, { children: jsxRuntimeExports.jsxs(ContactDetails$1, { children: [jsxRuntimeExports.jsx(Tooltip, { title: item.address || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText$1, { children: item.address }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.profileName || '', arrow: true, children: jsxRuntimeExports.jsx(ProfileNameText, { sx: {
55005
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$2, { children: [jsxRuntimeExports.jsx(LeftSection$1, { children: jsxRuntimeExports.jsxs(ContactDetails$1, { children: [jsxRuntimeExports.jsx(Tooltip, { title: item.address || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText$1, { children: item.address }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.profileName || '', arrow: true, children: jsxRuntimeExports.jsx(ProfileNameText, { sx: {
54879
55006
  marginTop: '-10px',
54880
55007
  marginLeft: '5px',
54881
55008
  fontSize: '10px',
@@ -56135,7 +56262,7 @@ const formatPhoneForDisplay = (number) => {
56135
56262
  }
56136
56263
  };
56137
56264
 
56138
- const StyledIconButton = styled$1(IconButton$2)(({ theme }) => ({
56265
+ const StyledIconButton$1 = styled$1(IconButton$2)(({ theme }) => ({
56139
56266
  padding: theme.spacing(0.5),
56140
56267
  marginTop: '-5px',
56141
56268
  }));
@@ -56144,7 +56271,7 @@ const StyledLocalPhoneIcon = styled$1(default_1$7)(({ theme }) => ({
56144
56271
  width: 16,
56145
56272
  color: theme.palette.secondary.main
56146
56273
  }));
56147
- const StyledBox = styled$1(Box$2)(({ theme }) => ({
56274
+ const StyledBox$1 = styled$1(Box$2)(({ theme }) => ({
56148
56275
  display: 'flex',
56149
56276
  alignItems: 'flex-start',
56150
56277
  justifyContent: 'space-between',
@@ -56207,7 +56334,7 @@ const ContactMethodPhoneItem = ({ item }) => {
56207
56334
  window.dispatchEvent(event);
56208
56335
  };
56209
56336
  const formattedPhone = useMemo(() => formatPhoneForDisplay(item.address || ''), [item.address]);
56210
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox, { children: [jsxRuntimeExports.jsxs(LeftSection, { children: [jsxRuntimeExports.jsx(StyledIconButton, { onClick: handleCallContact, color: "primary", size: "small", children: jsxRuntimeExports.jsx(StyledLocalPhoneIcon, {}) }), jsxRuntimeExports.jsxs(ContactDetails, { children: [jsxRuntimeExports.jsx(Tooltip, { title: formattedPhone || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText, { children: formattedPhone }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText, { children: item.note }) })] })] }), jsxRuntimeExports.jsx(RightSection, { children: jsxRuntimeExports.jsx(Box$2, { sx: {
56337
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$1, { children: [jsxRuntimeExports.jsxs(LeftSection, { children: [jsxRuntimeExports.jsx(StyledIconButton$1, { onClick: handleCallContact, color: "primary", size: "small", children: jsxRuntimeExports.jsx(StyledLocalPhoneIcon, {}) }), jsxRuntimeExports.jsxs(ContactDetails, { children: [jsxRuntimeExports.jsx(Tooltip, { title: formattedPhone || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText, { children: formattedPhone }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText, { children: item.note }) })] })] }), jsxRuntimeExports.jsx(RightSection, { children: jsxRuntimeExports.jsx(Box$2, { sx: {
56211
56338
  display: 'flex',
56212
56339
  alignItems: 'center',
56213
56340
  justifyContent: 'flex-end',
@@ -56218,8 +56345,42 @@ const ContactMethodPhoneItem = ({ item }) => {
56218
56345
  } })) }) }) })] }) }));
56219
56346
  };
56220
56347
 
56348
+ const StyledBox = styled$5(Box$2)(({ theme }) => ({
56349
+ display: 'flex',
56350
+ flexDirection: 'column',
56351
+ padding: theme.spacing(1, 0, 2, 0),
56352
+ width: '100%',
56353
+ gap: theme.spacing(1),
56354
+ '&:hover .edit-icon': {
56355
+ opacity: 1,
56356
+ },
56357
+ }));
56358
+ const StyledTypography = styled$5(Typography$2)(({}) => ({
56359
+ letterSpacing: -0.5,
56360
+ fontSize: 14,
56361
+ fontWeight: 600,
56362
+ }));
56363
+ const HeaderBox = styled$5(Box$2)(({}) => ({
56364
+ display: 'flex',
56365
+ alignItems: 'center',
56366
+ }));
56367
+ const MethodItemsBox = styled$5(Box$2)(({ theme }) => ({
56368
+ display: 'flex',
56369
+ flexDirection: 'column',
56370
+ gap: theme.spacing(1),
56371
+ width: '100%',
56372
+ }));
56373
+ const StyledIconButton = styled$5(IconButton$2)({
56374
+ opacity: 0,
56375
+ transition: 'opacity 0.3s ease-in-out',
56376
+ '& .MuiSvgIcon-root': {
56377
+ width: '0.8em',
56378
+ height: '0.8em',
56379
+ },
56380
+ marginLeft: '15px',
56381
+ });
56221
56382
  const ContactMethod = ({ title, methodItems, isPhone, handleEdit, owner }) => {
56222
- return (jsxRuntimeExports.jsxs("div", { className: "w-full rounded-xl border border-gray-200 bg-white/60 p-3 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsxRuntimeExports.jsx("p", { className: "text-sm font-semibold text-gray-800", children: title }), jsxRuntimeExports.jsx(IconButton$2, { "aria-label": `Edit ${title}`, size: "small", onClick: handleEdit, className: "edit-icon text-gray-500 transition hover:text-gray-800", children: jsxRuntimeExports.jsx(default_1$f, { fontSize: "small" }) })] }), jsxRuntimeExports.jsx("div", { className: "mt-3 space-y-2", children: methodItems.map((item, index) => {
56383
+ 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) => {
56223
56384
  if (isPhone) {
56224
56385
  return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56225
56386
  }
@@ -56939,7 +57100,7 @@ const ContactInformation = ({ ownerData }) => {
56939
57100
  const contactMethods = [
56940
57101
  {
56941
57102
  key: 'phones',
56942
- title: t('contactDetails.phones'),
57103
+ title: t('conversations.contactDetails.phones'),
56943
57104
  items: phones,
56944
57105
  isPhone: true,
56945
57106
  modalTitle: 'Phones',
@@ -56995,7 +57156,7 @@ const ContactInformation = ({ ownerData }) => {
56995
57156
  visible: true,
56996
57157
  },
56997
57158
  ];
56998
- 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
57159
+ 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
56999
57160
  .filter((method) => method.visible)
57000
57161
  .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 })] }));
57001
57162
  };
@@ -57008,47 +57169,18 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntity
57008
57169
  onEntityUpdated,
57009
57170
  };
57010
57171
  const t = useTranslationContext();
57011
- 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) => ({
57012
- address1: { street: value },
57013
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
57014
- address2: { street: value },
57015
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57016
- address1: { city: value },
57017
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57018
- address2: { city: value },
57019
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57020
- address1: { state: value },
57021
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57022
- address2: { state: value },
57023
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57024
- address1: { zipcode: value },
57025
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57026
- address2: { zipcode: value },
57027
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57028
- address1: { country: value },
57029
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57030
- address2: { country: value },
57031
- }) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.street'), value: entityData.address1?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
57032
- address1: { street: value },
57033
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
57034
- address2: { street: value },
57035
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57036
- address1: { city: value },
57037
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57038
- address2: { city: value },
57039
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57040
- address1: { state: value },
57041
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57042
- address2: { state: value },
57043
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57044
- address1: { zipcode: value },
57045
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57046
- address2: { zipcode: value },
57047
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57048
- address1: { country: value },
57049
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57050
- address2: { country: value },
57051
- }) })] })) }) }));
57172
+ const AddressGroup = ({ addressNumber, title, }) => (jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 rounded-xl p-4", children: [jsxRuntimeExports.jsx(Typography$2, { 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) => ({
57173
+ [addressNumber]: { street: value },
57174
+ }), minWidth: "100%" }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.city'), value: entityData[addressNumber]?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57175
+ [addressNumber]: { city: value },
57176
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.state'), value: entityData[addressNumber]?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57177
+ [addressNumber]: { state: value },
57178
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.postcode'), value: entityData[addressNumber]?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57179
+ [addressNumber]: { zipcode: value },
57180
+ }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.country'), value: entityData[addressNumber]?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57181
+ [addressNumber]: { country: value },
57182
+ }), minWidth: "100%" })] })] }));
57183
+ 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') })] }) }));
57052
57184
  };
57053
57185
 
57054
57186
  const useEntityUpdateSync = ({ entity, setEntity }) => {
@@ -57156,13 +57288,12 @@ const useModalCloseHandler = ({ onClose }) => {
57156
57288
  return handleClose;
57157
57289
  };
57158
57290
 
57159
- const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t }) => {
57291
+ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, navigate, }) => {
57160
57292
  const api = useMemo(() => {
57161
57293
  if (!baseUrl || !spaceId)
57162
57294
  return null;
57163
57295
  return createEditContactApi(baseUrl, spaceId);
57164
57296
  }, [baseUrl, spaceId]);
57165
- console.log('[EditContactModal] t fn:', t?.name || 'anonymous', t);
57166
57297
  const { state, selectors, actions } = useEditContactModalController({
57167
57298
  open,
57168
57299
  baseUrl,
@@ -57213,20 +57344,20 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t })
57213
57344
  overflow: 'hidden',
57214
57345
  };
57215
57346
  const mergedSx = Array.isArray(sx) ? [baseSx, ...sx] : sx ? [baseSx, sx] : baseSx;
57216
- return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, children: jsxRuntimeExports.jsx(TranslationProvider, { t: t, children: jsxRuntimeExports.jsx(Modal$2, { open: open, onClose: handleClose, closeAfterTransition: true, slots: { backdrop: Backdrop$2 }, slotProps: { backdrop: { timeout: 200 } }, children: jsxRuntimeExports.jsx(Fade$2, { in: open, timeout: 200, children: jsxRuntimeExports.jsx(Box$2, { sx: mergedSx, children: state.isLoading && !state.contactData ? (jsxRuntimeExports.jsx(Box$2, { sx: {
57217
- display: 'flex',
57218
- justifyContent: 'center',
57219
- alignItems: 'center',
57220
- minHeight: 220,
57221
- }, children: jsxRuntimeExports.jsx(CircularProgress$2, {}) })) : state.error ? (jsxRuntimeExports.jsx(Box$2, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsx(EditEntityProvider, { entityType: selectors.contactType === 'business' ? 'business' : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, children: jsxRuntimeExports.jsxs(Box$2, { sx: { position: 'relative', height: '100%' }, children: [jsxRuntimeExports.jsx(Fade$2, { in: view === 'main', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsxs(Box$2, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Header, { imgUrl: image.imageUrl, displayName: selectors.displayName, tags: selectors.tags, onEditTags: () => {
57222
- setView('tags');
57223
- }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting }), jsxRuntimeExports.jsxs(Box$2, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' ||
57224
- selectors.contactType === 'business'
57225
- ? selectors.contactType
57226
- : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
57227
- selectors.contactType === 'business'
57228
- ? selectors.contactType
57229
- : 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsx(ContactInformation, { ownerData: state.contactData })] })] }) }), jsxRuntimeExports.jsx(Fade$2, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(Box$2, { 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 }) }) }) }) }));
57347
+ return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, children: jsxRuntimeExports.jsx(TranslationProvider, { t: t, children: jsxRuntimeExports.jsx(NavigateProvider, { navigate: navigate, children: jsxRuntimeExports.jsx(Modal$2, { open: open, onClose: handleClose, closeAfterTransition: true, slots: { backdrop: Backdrop$2 }, slotProps: { backdrop: { timeout: 200 } }, children: jsxRuntimeExports.jsx(Fade$2, { in: open, timeout: 200, children: jsxRuntimeExports.jsx(Box$2, { sx: mergedSx, children: state.isLoading && !state.contactData ? (jsxRuntimeExports.jsx(Box$2, { sx: {
57348
+ display: 'flex',
57349
+ justifyContent: 'center',
57350
+ alignItems: 'center',
57351
+ minHeight: 220,
57352
+ }, children: jsxRuntimeExports.jsx(CircularProgress$2, {}) })) : state.error ? (jsxRuntimeExports.jsx(Box$2, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsx(EditEntityProvider, { entityType: selectors.contactType === 'business' ? 'business' : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, children: jsxRuntimeExports.jsxs(Box$2, { sx: { position: 'relative', height: '100%' }, children: [jsxRuntimeExports.jsx(Fade$2, { in: view === 'main', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsxs(Box$2, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Header, { imgUrl: image.imageUrl, displayName: selectors.displayName, tags: selectors.tags, onEditTags: () => {
57353
+ setView('tags');
57354
+ }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting, contactType: selectors.contactType, entityId: state.contactData?.id, firstName: selectors.isContact ? state.contactData.firstName : undefined, lastName: selectors.isContact ? state.contactData.lastName : undefined, name: selectors.isBusiness ? state.contactData.name : undefined, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsxs(Box$2, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' ||
57355
+ selectors.contactType === 'business'
57356
+ ? selectors.contactType
57357
+ : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
57358
+ selectors.contactType === 'business'
57359
+ ? selectors.contactType
57360
+ : 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsx(ContactInformation, { ownerData: state.contactData })] })] }) }), jsxRuntimeExports.jsx(Fade$2, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(Box$2, { 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 }) }) }) }) }) }));
57230
57361
  };
57231
57362
 
57232
57363
  export { ContactInfoPopup, EditContactModal };