@trii/components 2.0.41 → 2.0.44

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.
@@ -7,6 +7,7 @@ export interface Props {
7
7
  contactId?: string;
8
8
  t: (key: string) => string;
9
9
  sx?: SxProps<Theme>;
10
+ navigate: (path: string) => void;
10
11
  }
11
- declare const EditContactModal: ({ open, onClose, baseUrl, spaceId, contactId, sx, t }: Props) => import("react/jsx-runtime").JSX.Element;
12
+ declare const EditContactModal: ({ open, onClose, baseUrl, spaceId, contactId, sx, t, navigate, }: Props) => import("react/jsx-runtime").JSX.Element;
12
13
  export default EditContactModal;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from 'react';
2
+ export type NavigateFn = (path: string) => void;
3
+ interface NavigateProviderProps {
4
+ navigate: NavigateFn;
5
+ children: ReactNode;
6
+ }
7
+ export declare const NavigateProvider: ({ navigate, children }: NavigateProviderProps) => import("react/jsx-runtime").JSX.Element;
8
+ export declare const useNavigateContext: () => NavigateFn;
9
+ export {};
@@ -0,0 +1,7 @@
1
+ type Props = {
2
+ value: string;
3
+ displayValue: string;
4
+ businessId: string;
5
+ };
6
+ declare function SelectBusinessLabel({ value, displayValue, businessId }: Props): import("react/jsx-runtime").JSX.Element;
7
+ export default SelectBusinessLabel;
@@ -0,0 +1 @@
1
+ export { default } from './SelectBusinessLabel';
@@ -0,0 +1 @@
1
+ export { default as SelectBusinessLabel } from './SelectBusinessLabel';
package/dist/esm/index.js CHANGED
@@ -9196,7 +9196,7 @@ const TitleBox = styled$5(Box$2)({
9196
9196
  width: '100%',
9197
9197
  borderBottom: `1px solid lightgray`,
9198
9198
  });
9199
- const StyledBox$2 = styled$5(Box$2)({
9199
+ const StyledBox$3 = styled$5(Box$2)({
9200
9200
  display: 'flex',
9201
9201
  alignItems: 'center',
9202
9202
  justifyContent: 'space-between',
@@ -9237,7 +9237,7 @@ const NoteText$2 = styled$5(Typography$2)({
9237
9237
  left: 40,
9238
9238
  });
9239
9239
  const ContactMethod$1 = ({ icon, contactList, title, showTitle = true, }) => {
9240
- const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox$2, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
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: {
9241
9241
  whiteSpace: 'nowrap',
9242
9242
  textOverflow: 'ellipsis',
9243
9243
  overflow: 'hidden',
@@ -15384,8 +15384,8 @@ default_1$e = Label.default = (0, _createSvgIcon$d.default)( /*#__PURE__*/(0, _j
15384
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"
15385
15385
  }), 'Label');
15386
15386
 
15387
- const noop$3 = (key) => key;
15388
- const TranslationContext = createContext(noop$3);
15387
+ const noop$4 = (key) => key;
15388
+ const TranslationContext = createContext(noop$4);
15389
15389
  const TranslationProvider = ({ t, children }) => {
15390
15390
  return jsxRuntimeExports.jsx(TranslationContext.Provider, { value: t, children: children });
15391
15391
  };
@@ -15393,7 +15393,7 @@ const useTranslationContext = () => {
15393
15393
  const t = useContext(TranslationContext);
15394
15394
  if (!t) {
15395
15395
  console.warn('[useTranslationContext] using noop, context value is falsy');
15396
- return noop$3;
15396
+ return noop$4;
15397
15397
  }
15398
15398
  return (...args) => {
15399
15399
  const [key, ...rest] = args;
@@ -19735,7 +19735,7 @@ Transition.propTypes = process.env.NODE_ENV !== "production" ? {
19735
19735
  onExited: PropTypes.func
19736
19736
  } : {}; // Name the function so it is clearer in the documentation
19737
19737
 
19738
- function noop$2() {}
19738
+ function noop$3() {}
19739
19739
 
19740
19740
  Transition.defaultProps = {
19741
19741
  in: false,
@@ -19744,12 +19744,12 @@ Transition.defaultProps = {
19744
19744
  appear: false,
19745
19745
  enter: true,
19746
19746
  exit: true,
19747
- onEnter: noop$2,
19748
- onEntering: noop$2,
19749
- onEntered: noop$2,
19750
- onExit: noop$2,
19751
- onExiting: noop$2,
19752
- 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
19753
19753
  };
19754
19754
  Transition.UNMOUNTED = UNMOUNTED;
19755
19755
  Transition.EXITED = EXITED;
@@ -32724,7 +32724,7 @@ const PickersDayFiller = styled$3('div', {
32724
32724
  opacity: 0,
32725
32725
  pointerEvents: 'none'
32726
32726
  }));
32727
- const noop$1 = () => {};
32727
+ const noop$2 = () => {};
32728
32728
  const PickersDayRaw = /*#__PURE__*/React$1.forwardRef(function PickersDay(inProps, forwardedRef) {
32729
32729
  const props = useThemeProps({
32730
32730
  props: inProps,
@@ -32737,11 +32737,11 @@ const PickersDayRaw = /*#__PURE__*/React$1.forwardRef(function PickersDay(inProp
32737
32737
  isAnimating,
32738
32738
  onClick,
32739
32739
  onDaySelect,
32740
- onFocus = noop$1,
32741
- onBlur = noop$1,
32742
- onKeyDown = noop$1,
32743
- onMouseDown = noop$1,
32744
- onMouseEnter = noop$1,
32740
+ onFocus = noop$2,
32741
+ onBlur = noop$2,
32742
+ onKeyDown = noop$2,
32743
+ onMouseDown = noop$2,
32744
+ onMouseEnter = noop$2,
32745
32745
  children,
32746
32746
  day,
32747
32747
  selected,
@@ -43236,7 +43236,7 @@ const _excluded$y = ["enableAccessibleFieldDOMStructure"],
43236
43236
  _excluded6 = ["ownerState"],
43237
43237
  _excluded7 = ["ownerState"],
43238
43238
  _excluded8 = ["InputProps", "inputProps"];
43239
- const noop = () => {};
43239
+ const noop$1 = () => {};
43240
43240
  const cleanFieldResponse = _ref => {
43241
43241
  let {
43242
43242
  enableAccessibleFieldDOMStructure
@@ -43253,7 +43253,7 @@ const cleanFieldResponse = _ref => {
43253
43253
  openPickerAriaLabel
43254
43254
  } = fieldResponse,
43255
43255
  other = _objectWithoutPropertiesLoose(fieldResponse, _excluded2$6);
43256
- 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;
43257
43257
  return {
43258
43258
  clearable,
43259
43259
  onClear,
@@ -43288,8 +43288,8 @@ const cleanFieldResponse = _ref => {
43288
43288
  openPickerAriaLabel
43289
43289
  } = fieldResponse,
43290
43290
  other = _objectWithoutPropertiesLoose(fieldResponse, _excluded3);
43291
- const mergedInputProps = major >= 6 && other?.slotProps?.input ? mergeSlotProps$1(other?.slotProps?.input, InputProps) : noop;
43292
- 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;
43293
43293
  return {
43294
43294
  clearable,
43295
43295
  onClear,
@@ -52507,9 +52507,59 @@ default_1$8 = Cancel.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _
52507
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"
52508
52508
  }), 'Cancel');
52509
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
+
52510
52560
  const isUserInfo = (option) => 'email' in option;
52511
52561
  const isContactBirthdayProps = (p) => p.entityType === 'contact' && p.inputType === 'birthday';
52512
- const StyledIconButton$2 = styled$5(IconButton$2)({
52562
+ const StyledIconButton$3 = styled$5(IconButton$2)({
52513
52563
  opacity: 0,
52514
52564
  transition: 'opacity 0.3s ease-in-out',
52515
52565
  '& .MuiSvgIcon-root': {
@@ -52639,12 +52689,12 @@ const EntityInfoLabel = (props) => {
52639
52689
  '&:hover .edit-icon': {
52640
52690
  opacity: 1,
52641
52691
  },
52642
- }, children: [jsxRuntimeExports.jsxs(Box$2, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(Typography$2, { letterSpacing: -0.5, fontWeight: '600', alignSelf: 'center', flexGrow: isEditing ? 1 : 0, color: (theme) => theme.palette.text.primary, children: title }), isNotEditable ? null : isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$2, { className: "edit-icon", size: "small", onClick: handleEditClick, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(Box$2, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(TextField$1, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(Select$2, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(MenuItem$2, { value: "", children: t('conversations.contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(MenuItem$2, { value: option.id, children: props.entityType === 'contact'
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'
52643
52693
  ? option.name?.trim() || (isUserInfo(option) ? option.email : '') || 'Sin nombre'
52644
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 &&
52645
52695
  props.entityType === 'contact' &&
52646
52696
  inputType === 'selectBusiness' &&
52647
- props.businessId ? (jsxRuntimeExports.jsx(Box$2, { display: "flex", alignItems: "center", children: "Popover" })) : (jsxRuntimeExports.jsx(Typography$2, { fontWeight: '400', sx: { padding: '2.5px 14px 8.5px 0px' }, color: (theme) => theme.palette.text.primary, children: displayValue || (typeof value === 'string' && value) || '-' })) })] }));
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) || '-' })) })] }));
52648
52698
  };
52649
52699
 
52650
52700
  const ContactInfoLabel = (props) => {
@@ -54450,7 +54500,7 @@ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat })
54450
54500
  }, value: value || initDates, onChange: (newValue) => handleChange(newValue), format: dateFormat }) }) }));
54451
54501
  };
54452
54502
 
54453
- const StyledIconButton$1 = styled$5(IconButton$2)(() => ({
54503
+ const StyledIconButton$2 = styled$5(IconButton$2)(() => ({
54454
54504
  opacity: 0,
54455
54505
  transition: 'opacity 0.3s ease-in-out',
54456
54506
  '& .MuiSvgIcon-root': {
@@ -54652,7 +54702,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54652
54702
  else
54653
54703
  return (jsxRuntimeExports.jsx(CustomPropertyInput, { type: type, nameKey: nameKey, value: value, onChange: handleInputChange }));
54654
54704
  };
54655
- return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT ? 'contacts-col-12' : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(Box$2, { display: "flex", position: "relative", minHeight: "25px", children: [jsxRuntimeExports.jsx(FieldName, { flexGrow: isEditing ? 1 : 0, children: getPropertyName(property.nameKey) }), isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$1, { className: "edit-icon", size: "small", onClick: toggleEdit, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(Box$2, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT ? '100%' : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
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)
54656
54706
  ? property.type === Contacts.ContactField_type.DATERANGE
54657
54707
  ? (() => {
54658
54708
  if (typeof property.value === 'string') {
@@ -54885,7 +54935,7 @@ const useEditModal = () => {
54885
54935
  return { isOpen, title, openModal, closeModal };
54886
54936
  };
54887
54937
 
54888
- const StyledBox$1 = styled$1(Box$2)(({ theme }) => ({
54938
+ const StyledBox$2 = styled$1(Box$2)(({ theme }) => ({
54889
54939
  display: 'flex',
54890
54940
  alignItems: 'flex-start',
54891
54941
  justifyContent: 'space-between',
@@ -54952,7 +55002,7 @@ const ContactMethodItem = ({ item }) => {
54952
55002
  const { imageUrl } = useImage({
54953
55003
  initialImageUrl: avatarUrlWithoutAccess,
54954
55004
  });
54955
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$1, { children: [jsxRuntimeExports.jsx(LeftSection$1, { children: jsxRuntimeExports.jsxs(ContactDetails$1, { children: [jsxRuntimeExports.jsx(Tooltip, { title: item.address || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText$1, { children: item.address }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.profileName || '', arrow: true, children: jsxRuntimeExports.jsx(ProfileNameText, { sx: {
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: {
54956
55006
  marginTop: '-10px',
54957
55007
  marginLeft: '5px',
54958
55008
  fontSize: '10px',
@@ -56212,7 +56262,7 @@ const formatPhoneForDisplay = (number) => {
56212
56262
  }
56213
56263
  };
56214
56264
 
56215
- const StyledIconButton = styled$1(IconButton$2)(({ theme }) => ({
56265
+ const StyledIconButton$1 = styled$1(IconButton$2)(({ theme }) => ({
56216
56266
  padding: theme.spacing(0.5),
56217
56267
  marginTop: '-5px',
56218
56268
  }));
@@ -56221,7 +56271,7 @@ const StyledLocalPhoneIcon = styled$1(default_1$7)(({ theme }) => ({
56221
56271
  width: 16,
56222
56272
  color: theme.palette.secondary.main
56223
56273
  }));
56224
- const StyledBox = styled$1(Box$2)(({ theme }) => ({
56274
+ const StyledBox$1 = styled$1(Box$2)(({ theme }) => ({
56225
56275
  display: 'flex',
56226
56276
  alignItems: 'flex-start',
56227
56277
  justifyContent: 'space-between',
@@ -56284,7 +56334,7 @@ const ContactMethodPhoneItem = ({ item }) => {
56284
56334
  window.dispatchEvent(event);
56285
56335
  };
56286
56336
  const formattedPhone = useMemo(() => formatPhoneForDisplay(item.address || ''), [item.address]);
56287
- return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox, { children: [jsxRuntimeExports.jsxs(LeftSection, { children: [jsxRuntimeExports.jsx(StyledIconButton, { onClick: handleCallContact, color: "primary", size: "small", children: jsxRuntimeExports.jsx(StyledLocalPhoneIcon, {}) }), jsxRuntimeExports.jsxs(ContactDetails, { children: [jsxRuntimeExports.jsx(Tooltip, { title: formattedPhone || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText, { children: formattedPhone }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText, { children: item.note }) })] })] }), jsxRuntimeExports.jsx(RightSection, { children: jsxRuntimeExports.jsx(Box$2, { sx: {
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: {
56288
56338
  display: 'flex',
56289
56339
  alignItems: 'center',
56290
56340
  justifyContent: 'flex-end',
@@ -56295,8 +56345,42 @@ const ContactMethodPhoneItem = ({ item }) => {
56295
56345
  } })) }) }) })] }) }));
56296
56346
  };
56297
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
+ });
56298
56382
  const ContactMethod = ({ title, methodItems, isPhone, handleEdit, owner }) => {
56299
- return (jsxRuntimeExports.jsxs("div", { className: "w-full rounded-xl border border-gray-200 bg-white/60 p-3 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsxRuntimeExports.jsx("p", { className: "text-sm font-semibold text-gray-800", children: title }), jsxRuntimeExports.jsx(IconButton$2, { "aria-label": `Edit ${title}`, size: "small", onClick: handleEdit, className: "edit-icon text-gray-500 transition hover:text-gray-800", children: jsxRuntimeExports.jsx(default_1$f, { fontSize: "small" }) })] }), jsxRuntimeExports.jsx("div", { className: "mt-3 space-y-2", children: methodItems.map((item, index) => {
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) => {
56300
56384
  if (isPhone) {
56301
56385
  return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56302
56386
  }
@@ -57072,9 +57156,9 @@ const ContactInformation = ({ ownerData }) => {
57072
57156
  visible: true,
57073
57157
  },
57074
57158
  ];
57075
- return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Section, { title: t('conversations.contactDetails.contactInformation'), children: jsxRuntimeExports.jsx(SectionContent, { children: jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-3", children: contactMethods
57076
- .filter((method) => method.visible)
57077
- .map((method) => (jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal(method.modalTitle), title: method.title, methodItems: method.items, isPhone: method.isPhone, owner: ownerData }, method.key))) }) }) }), jsxRuntimeExports.jsx(EditModal, { open: isOpen, onClose: closeModal, title: title })] }));
57159
+ return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Section, { title: t('conversations.contactDetails.contactInformation'), children: jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-3", children: contactMethods
57160
+ .filter((method) => method.visible)
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 })] }));
57078
57162
  };
57079
57163
 
57080
57164
  const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntityUpdated, }) => {
@@ -57085,7 +57169,7 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntity
57085
57169
  onEntityUpdated,
57086
57170
  };
57087
57171
  const t = useTranslationContext();
57088
- const AddressGroup = ({ addressNumber, title, }) => (jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4 rounded-xl border border-gray-100 bg-gray-50/50 p-4", children: [jsxRuntimeExports.jsx("h4", { className: "text-sm font-semibold text-gray-700", children: title }), jsxRuntimeExports.jsxs("div", { className: "grid grid-cols-2 gap-x-4 gap-y-3", children: [jsxRuntimeExports.jsx("div", { className: "col-span-2", children: jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.street'), value: entityData[addressNumber]?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
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) => ({
57089
57173
  [addressNumber]: { street: value },
57090
57174
  }), minWidth: "100%" }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.city'), value: entityData[addressNumber]?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57091
57175
  [addressNumber]: { city: value },
@@ -57096,7 +57180,7 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntity
57096
57180
  }), minWidth: "100%" }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: entityType, title: t('conversations.contactDetails.country'), value: entityData[addressNumber]?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57097
57181
  [addressNumber]: { country: value },
57098
57182
  }), minWidth: "100%" })] })] }));
57099
- return (jsxRuntimeExports.jsx(Section, { title: t('conversations.contactDetails.addressInformation'), children: jsxRuntimeExports.jsx(SectionContent, { children: jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-4", children: [jsxRuntimeExports.jsx(AddressGroup, { addressNumber: "address1", title: t('conversations.contactDetails.primaryAddress') || 'Primary Address' }), jsxRuntimeExports.jsx(AddressGroup, { addressNumber: "address2", title: t('conversations.contactDetails.secondaryAddress') || 'Secondary Address' })] }) }) }));
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') })] }) }));
57100
57184
  };
57101
57185
 
57102
57186
  const useEntityUpdateSync = ({ entity, setEntity }) => {
@@ -57204,7 +57288,7 @@ const useModalCloseHandler = ({ onClose }) => {
57204
57288
  return handleClose;
57205
57289
  };
57206
57290
 
57207
- const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t }) => {
57291
+ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, navigate, }) => {
57208
57292
  const api = useMemo(() => {
57209
57293
  if (!baseUrl || !spaceId)
57210
57294
  return null;
@@ -57260,20 +57344,20 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t })
57260
57344
  overflow: 'hidden',
57261
57345
  };
57262
57346
  const mergedSx = Array.isArray(sx) ? [baseSx, ...sx] : sx ? [baseSx, sx] : baseSx;
57263
- 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: {
57264
- display: 'flex',
57265
- justifyContent: 'center',
57266
- alignItems: 'center',
57267
- minHeight: 220,
57268
- }, children: jsxRuntimeExports.jsx(CircularProgress$2, {}) })) : state.error ? (jsxRuntimeExports.jsx(Box$2, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsx(EditEntityProvider, { entityType: selectors.contactType === 'business' ? 'business' : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, children: jsxRuntimeExports.jsxs(Box$2, { sx: { position: 'relative', height: '100%' }, children: [jsxRuntimeExports.jsx(Fade$2, { in: view === 'main', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsxs(Box$2, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Header, { imgUrl: image.imageUrl, displayName: selectors.displayName, tags: selectors.tags, onEditTags: () => {
57269
- setView('tags');
57270
- }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting, contactType: selectors.contactType, entityId: state.contactData?.id, firstName: selectors.isContact ? state.contactData.firstName : undefined, lastName: selectors.isContact ? state.contactData.lastName : undefined, name: selectors.isBusiness ? state.contactData.name : undefined, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsxs(Box$2, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' ||
57271
- selectors.contactType === 'business'
57272
- ? selectors.contactType
57273
- : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
57274
- selectors.contactType === 'business'
57275
- ? selectors.contactType
57276
- : '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 }) }) }) }) }) }));
57277
57361
  };
57278
57362
 
57279
57363
  export { ContactInfoPopup, EditContactModal };