@trii/components 2.0.41 → 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.
package/dist/cjs/index.js CHANGED
@@ -9216,7 +9216,7 @@ const TitleBox = material.styled(material.Box)({
9216
9216
  width: '100%',
9217
9217
  borderBottom: `1px solid lightgray`,
9218
9218
  });
9219
- const StyledBox$2 = material.styled(material.Box)({
9219
+ const StyledBox$3 = material.styled(material.Box)({
9220
9220
  display: 'flex',
9221
9221
  alignItems: 'center',
9222
9222
  justifyContent: 'space-between',
@@ -9257,7 +9257,7 @@ const NoteText$2 = material.styled(material.Typography)({
9257
9257
  left: 40,
9258
9258
  });
9259
9259
  const ContactMethod$1 = ({ icon, contactList, title, showTitle = true, }) => {
9260
- const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox$2, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
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: {
9261
9261
  whiteSpace: 'nowrap',
9262
9262
  textOverflow: 'ellipsis',
9263
9263
  overflow: 'hidden',
@@ -15404,8 +15404,8 @@ default_1$e = Label.default = (0, _createSvgIcon$d.default)( /*#__PURE__*/(0, _j
15404
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"
15405
15405
  }), 'Label');
15406
15406
 
15407
- const noop$3 = (key) => key;
15408
- const TranslationContext = React$1.createContext(noop$3);
15407
+ const noop$4 = (key) => key;
15408
+ const TranslationContext = React$1.createContext(noop$4);
15409
15409
  const TranslationProvider = ({ t, children }) => {
15410
15410
  return jsxRuntimeExports.jsx(TranslationContext.Provider, { value: t, children: children });
15411
15411
  };
@@ -15413,7 +15413,7 @@ const useTranslationContext = () => {
15413
15413
  const t = React$1.useContext(TranslationContext);
15414
15414
  if (!t) {
15415
15415
  console.warn('[useTranslationContext] using noop, context value is falsy');
15416
- return noop$3;
15416
+ return noop$4;
15417
15417
  }
15418
15418
  return (...args) => {
15419
15419
  const [key, ...rest] = args;
@@ -19755,7 +19755,7 @@ Transition.propTypes = process.env.NODE_ENV !== "production" ? {
19755
19755
  onExited: PropTypes.func
19756
19756
  } : {}; // Name the function so it is clearer in the documentation
19757
19757
 
19758
- function noop$2() {}
19758
+ function noop$3() {}
19759
19759
 
19760
19760
  Transition.defaultProps = {
19761
19761
  in: false,
@@ -19764,12 +19764,12 @@ Transition.defaultProps = {
19764
19764
  appear: false,
19765
19765
  enter: true,
19766
19766
  exit: true,
19767
- onEnter: noop$2,
19768
- onEntering: noop$2,
19769
- onEntered: noop$2,
19770
- onExit: noop$2,
19771
- onExiting: noop$2,
19772
- 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
19773
19773
  };
19774
19774
  Transition.UNMOUNTED = UNMOUNTED;
19775
19775
  Transition.EXITED = EXITED;
@@ -32744,7 +32744,7 @@ const PickersDayFiller = styled$3('div', {
32744
32744
  opacity: 0,
32745
32745
  pointerEvents: 'none'
32746
32746
  }));
32747
- const noop$1 = () => {};
32747
+ const noop$2 = () => {};
32748
32748
  const PickersDayRaw = /*#__PURE__*/React__namespace.forwardRef(function PickersDay(inProps, forwardedRef) {
32749
32749
  const props = useThemeProps({
32750
32750
  props: inProps,
@@ -32757,11 +32757,11 @@ const PickersDayRaw = /*#__PURE__*/React__namespace.forwardRef(function PickersD
32757
32757
  isAnimating,
32758
32758
  onClick,
32759
32759
  onDaySelect,
32760
- onFocus = noop$1,
32761
- onBlur = noop$1,
32762
- onKeyDown = noop$1,
32763
- onMouseDown = noop$1,
32764
- onMouseEnter = noop$1,
32760
+ onFocus = noop$2,
32761
+ onBlur = noop$2,
32762
+ onKeyDown = noop$2,
32763
+ onMouseDown = noop$2,
32764
+ onMouseEnter = noop$2,
32765
32765
  children,
32766
32766
  day,
32767
32767
  selected,
@@ -43256,7 +43256,7 @@ const _excluded$y = ["enableAccessibleFieldDOMStructure"],
43256
43256
  _excluded6 = ["ownerState"],
43257
43257
  _excluded7 = ["ownerState"],
43258
43258
  _excluded8 = ["InputProps", "inputProps"];
43259
- const noop = () => {};
43259
+ const noop$1 = () => {};
43260
43260
  const cleanFieldResponse = _ref => {
43261
43261
  let {
43262
43262
  enableAccessibleFieldDOMStructure
@@ -43273,7 +43273,7 @@ const cleanFieldResponse = _ref => {
43273
43273
  openPickerAriaLabel
43274
43274
  } = fieldResponse,
43275
43275
  other = _objectWithoutPropertiesLoose(fieldResponse, _excluded2$6);
43276
- 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;
43277
43277
  return {
43278
43278
  clearable,
43279
43279
  onClear,
@@ -43308,8 +43308,8 @@ const cleanFieldResponse = _ref => {
43308
43308
  openPickerAriaLabel
43309
43309
  } = fieldResponse,
43310
43310
  other = _objectWithoutPropertiesLoose(fieldResponse, _excluded3);
43311
- const mergedInputProps = major >= 6 && other?.slotProps?.input ? mergeSlotProps$1(other?.slotProps?.input, InputProps) : noop;
43312
- 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;
43313
43313
  return {
43314
43314
  clearable,
43315
43315
  onClear,
@@ -52527,9 +52527,59 @@ default_1$8 = Cancel.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _
52527
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"
52528
52528
  }), 'Cancel');
52529
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
+
52530
52580
  const isUserInfo = (option) => 'email' in option;
52531
52581
  const isContactBirthdayProps = (p) => p.entityType === 'contact' && p.inputType === 'birthday';
52532
- const StyledIconButton$2 = material.styled(material.IconButton)({
52582
+ const StyledIconButton$3 = material.styled(material.IconButton)({
52533
52583
  opacity: 0,
52534
52584
  transition: 'opacity 0.3s ease-in-out',
52535
52585
  '& .MuiSvgIcon-root': {
@@ -52659,12 +52709,12 @@ const EntityInfoLabel = (props) => {
52659
52709
  '&:hover .edit-icon': {
52660
52710
  opacity: 1,
52661
52711
  },
52662
- }, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(material.Typography, { letterSpacing: -0.5, fontWeight: '600', alignSelf: 'center', flexGrow: isEditing ? 1 : 0, color: (theme) => theme.palette.text.primary, children: title }), isNotEditable ? null : isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$2, { className: "edit-icon", size: "small", onClick: handleEditClick, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(material.Box, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(material.TextField, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(material.Select, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(material.MenuItem, { value: "", children: t('conversations.contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(material.MenuItem, { value: option.id, children: props.entityType === 'contact'
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'
52663
52713
  ? option.name?.trim() || (isUserInfo(option) ? option.email : '') || 'Sin nombre'
52664
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 &&
52665
52715
  props.entityType === 'contact' &&
52666
52716
  inputType === 'selectBusiness' &&
52667
- props.businessId ? (jsxRuntimeExports.jsx(material.Box, { display: "flex", alignItems: "center", children: "Popover" })) : (jsxRuntimeExports.jsx(material.Typography, { fontWeight: '400', sx: { padding: '2.5px 14px 8.5px 0px' }, color: (theme) => theme.palette.text.primary, children: displayValue || (typeof value === 'string' && value) || '-' })) })] }));
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) || '-' })) })] }));
52668
52718
  };
52669
52719
 
52670
52720
  const ContactInfoLabel = (props) => {
@@ -54470,7 +54520,7 @@ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat })
54470
54520
  }, value: value || initDates, onChange: (newValue) => handleChange(newValue), format: dateFormat }) }) }));
54471
54521
  };
54472
54522
 
54473
- const StyledIconButton$1 = material.styled(material.IconButton)(() => ({
54523
+ const StyledIconButton$2 = material.styled(material.IconButton)(() => ({
54474
54524
  opacity: 0,
54475
54525
  transition: 'opacity 0.3s ease-in-out',
54476
54526
  '& .MuiSvgIcon-root': {
@@ -54672,7 +54722,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54672
54722
  else
54673
54723
  return (jsxRuntimeExports.jsx(CustomPropertyInput, { type: type, nameKey: nameKey, value: value, onChange: handleInputChange }));
54674
54724
  };
54675
- return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT ? 'contacts-col-12' : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: "25px", children: [jsxRuntimeExports.jsx(FieldName, { flexGrow: isEditing ? 1 : 0, children: getPropertyName(property.nameKey) }), isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$1, { className: "edit-icon", size: "small", onClick: toggleEdit, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(material.Box, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT ? '100%' : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
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)
54676
54726
  ? property.type === Contacts.ContactField_type.DATERANGE
54677
54727
  ? (() => {
54678
54728
  if (typeof property.value === 'string') {
@@ -54905,7 +54955,7 @@ const useEditModal = () => {
54905
54955
  return { isOpen, title, openModal, closeModal };
54906
54956
  };
54907
54957
 
54908
- const StyledBox$1 = styled$1(material.Box)(({ theme }) => ({
54958
+ const StyledBox$2 = styled$1(material.Box)(({ theme }) => ({
54909
54959
  display: 'flex',
54910
54960
  alignItems: 'flex-start',
54911
54961
  justifyContent: 'space-between',
@@ -54972,7 +55022,7 @@ const ContactMethodItem = ({ item }) => {
54972
55022
  const { imageUrl } = useImage({
54973
55023
  initialImageUrl: avatarUrlWithoutAccess,
54974
55024
  });
54975
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$1, { children: [jsxRuntimeExports.jsx(LeftSection$1, { children: jsxRuntimeExports.jsxs(ContactDetails$1, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: item.address || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText$1, { children: item.address }) }), jsxRuntimeExports.jsx(material.Tooltip, { title: item.profileName || '', arrow: true, children: jsxRuntimeExports.jsx(ProfileNameText, { sx: {
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: {
54976
55026
  marginTop: '-10px',
54977
55027
  marginLeft: '5px',
54978
55028
  fontSize: '10px',
@@ -56232,7 +56282,7 @@ const formatPhoneForDisplay = (number) => {
56232
56282
  }
56233
56283
  };
56234
56284
 
56235
- const StyledIconButton = styled$1(material.IconButton)(({ theme }) => ({
56285
+ const StyledIconButton$1 = styled$1(material.IconButton)(({ theme }) => ({
56236
56286
  padding: theme.spacing(0.5),
56237
56287
  marginTop: '-5px',
56238
56288
  }));
@@ -56241,7 +56291,7 @@ const StyledLocalPhoneIcon = styled$1(default_1$7)(({ theme }) => ({
56241
56291
  width: 16,
56242
56292
  color: theme.palette.secondary.main
56243
56293
  }));
56244
- const StyledBox = styled$1(material.Box)(({ theme }) => ({
56294
+ const StyledBox$1 = styled$1(material.Box)(({ theme }) => ({
56245
56295
  display: 'flex',
56246
56296
  alignItems: 'flex-start',
56247
56297
  justifyContent: 'space-between',
@@ -56304,7 +56354,7 @@ const ContactMethodPhoneItem = ({ item }) => {
56304
56354
  window.dispatchEvent(event);
56305
56355
  };
56306
56356
  const formattedPhone = React$1.useMemo(() => formatPhoneForDisplay(item.address || ''), [item.address]);
56307
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox, { children: [jsxRuntimeExports.jsxs(LeftSection, { children: [jsxRuntimeExports.jsx(StyledIconButton, { onClick: handleCallContact, color: "primary", size: "small", children: jsxRuntimeExports.jsx(StyledLocalPhoneIcon, {}) }), jsxRuntimeExports.jsxs(ContactDetails, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: formattedPhone || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText, { children: formattedPhone }) }), jsxRuntimeExports.jsx(material.Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText, { children: item.note }) })] })] }), jsxRuntimeExports.jsx(RightSection, { children: jsxRuntimeExports.jsx(material.Box, { sx: {
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: {
56308
56358
  display: 'flex',
56309
56359
  alignItems: 'center',
56310
56360
  justifyContent: 'flex-end',
@@ -56315,8 +56365,42 @@ const ContactMethodPhoneItem = ({ item }) => {
56315
56365
  } })) }) }) })] }) }));
56316
56366
  };
56317
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
+ });
56318
56402
  const ContactMethod = ({ title, methodItems, isPhone, handleEdit, owner }) => {
56319
- return (jsxRuntimeExports.jsxs("div", { className: "w-full rounded-xl border border-gray-200 bg-white/60 p-3 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsxRuntimeExports.jsx("p", { className: "text-sm font-semibold text-gray-800", children: title }), jsxRuntimeExports.jsx(material.IconButton, { "aria-label": `Edit ${title}`, size: "small", onClick: handleEdit, className: "edit-icon text-gray-500 transition hover:text-gray-800", children: jsxRuntimeExports.jsx(default_1$f, { fontSize: "small" }) })] }), jsxRuntimeExports.jsx("div", { className: "mt-3 space-y-2", children: methodItems.map((item, index) => {
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) => {
56320
56404
  if (isPhone) {
56321
56405
  return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56322
56406
  }
@@ -57105,7 +57189,7 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntity
57105
57189
  onEntityUpdated,
57106
57190
  };
57107
57191
  const t = useTranslationContext();
57108
- const AddressGroup = ({ addressNumber, title, }) => (jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 rounded-xl border border-gray-100 bg-gray-50/50 p-4", children: [jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold text-gray-700", children: title }), jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-3", children: [jsxRuntimeExports.jsx("div", { className: "col-span-2", children: jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.street'), value: entityData[addressNumber]?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
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) => ({
57109
57193
  [addressNumber]: { street: value },
57110
57194
  }), minWidth: "100%" }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.city'), value: entityData[addressNumber]?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57111
57195
  [addressNumber]: { city: value },
@@ -57116,7 +57200,7 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntity
57116
57200
  }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.country'), value: entityData[addressNumber]?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57117
57201
  [addressNumber]: { country: value },
57118
57202
  }), minWidth: "100%" })] })] }));
57119
- return (jsxRuntimeExports.jsx(Section, { title: t('conversations.contactDetails.addressInformation'), children: jsxRuntimeExports.jsx(SectionContent, { children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [jsxRuntimeExports.jsx(AddressGroup, { addressNumber: "address1", title: t('conversations.contactDetails.primaryAddress') || 'Primary Address' }), jsxRuntimeExports.jsx(AddressGroup, { addressNumber: "address2", title: t('conversations.contactDetails.secondaryAddress') || 'Secondary Address' })] }) }) }));
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') })] }) }));
57120
57204
  };
57121
57205
 
57122
57206
  const useEntityUpdateSync = ({ entity, setEntity }) => {
@@ -57224,7 +57308,7 @@ const useModalCloseHandler = ({ onClose }) => {
57224
57308
  return handleClose;
57225
57309
  };
57226
57310
 
57227
- const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t }) => {
57311
+ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, navigate, }) => {
57228
57312
  const api = React$1.useMemo(() => {
57229
57313
  if (!baseUrl || !spaceId)
57230
57314
  return null;
@@ -57280,20 +57364,20 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t })
57280
57364
  overflow: 'hidden',
57281
57365
  };
57282
57366
  const mergedSx = Array.isArray(sx) ? [baseSx, ...sx] : sx ? [baseSx, sx] : baseSx;
57283
- 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: {
57284
- display: 'flex',
57285
- justifyContent: 'center',
57286
- alignItems: 'center',
57287
- minHeight: 220,
57288
- }, children: jsxRuntimeExports.jsx(material.CircularProgress, {}) })) : state.error ? (jsxRuntimeExports.jsx(material.Box, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsx(EditEntityProvider, { entityType: selectors.contactType === 'business' ? 'business' : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, children: jsxRuntimeExports.jsxs(material.Box, { sx: { position: 'relative', height: '100%' }, children: [jsxRuntimeExports.jsx(material.Fade, { in: view === 'main', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsxs(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Header, { imgUrl: image.imageUrl, displayName: selectors.displayName, tags: selectors.tags, onEditTags: () => {
57289
- setView('tags');
57290
- }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting, contactType: selectors.contactType, entityId: state.contactData?.id, firstName: selectors.isContact ? state.contactData.firstName : undefined, lastName: selectors.isContact ? state.contactData.lastName : undefined, name: selectors.isBusiness ? state.contactData.name : undefined, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsxs(material.Box, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' ||
57291
- selectors.contactType === 'business'
57292
- ? selectors.contactType
57293
- : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
57294
- selectors.contactType === 'business'
57295
- ? selectors.contactType
57296
- : '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 }) }) }) }) }) }));
57297
57381
  };
57298
57382
 
57299
57383
  exports.ContactInfoPopup = ContactInfoPopup;