@trii/components 2.0.35 → 2.0.38

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 (92) hide show
  1. package/dist/cjs/index.js +1133 -292
  2. package/dist/cjs/index.js.map +1 -1
  3. package/dist/cjs/types/components/EditContactModal/EditContactModal.d.ts +2 -2
  4. package/dist/cjs/types/components/EditContactModal/components/Header/Header.d.ts +1 -2
  5. package/dist/cjs/types/components/EditContactModal/components/Header/components/AvatarWithActions/AvatarWithActions.d.ts +1 -2
  6. package/dist/cjs/types/components/EditContactModal/components/Header/components/Tags/Tags.d.ts +1 -2
  7. package/dist/cjs/types/components/EditContactModal/components/Section/AddressInformation/AddressInformation.d.ts +1 -2
  8. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/ContactInformation.d.ts +2 -11
  9. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/EditModal.d.ts +0 -1
  10. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Mails/Mails.d.ts +1 -2
  11. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Mails/components/Body/Body.d.ts +1 -2
  12. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Mails/components/Body/components/Mail/Mail.d.ts +1 -2
  13. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Phones/Phones.d.ts +1 -2
  14. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Phones/components/Body/Body.d.ts +1 -2
  15. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Phones/components/Body/components/Phone/Phone.d.ts +1 -2
  16. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Phones/components/Body/components/Phone/components/CountrySelect/CountrySelect.d.ts +1 -4
  17. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Phones/components/Body/components/Phone/components/OptionsMenu/OptionsMenu.d.ts +1 -2
  18. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/RCSs/RCSs.d.ts +1 -2
  19. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/RCSs/components/Body/Body.d.ts +1 -2
  20. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/RCSs/components/Body/components/RCS/RCS.d.ts +1 -2
  21. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Whatsapps/Whatsapps.d.ts +1 -2
  22. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Whatsapps/components/Body/Body.d.ts +1 -2
  23. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Whatsapps/components/Body/components/Whatsapp/Whatsapp.d.ts +1 -2
  24. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/AddressInput/AddressInput.d.ts +1 -2
  25. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/InformationSocialNetworkItem/InformationSocialNetworkItem.d.ts +1 -2
  26. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/InformationSocialNetworkItem/components/Body/Body.d.ts +1 -2
  27. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/InformationSocialNetworkItem/components/Body/components/Ims/Ims.d.ts +1 -2
  28. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/PhoneInput/PhoneInput.d.ts +1 -2
  29. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/SubsectionHeaderWithButton/SubsectionHeaderWithButton.d.ts +1 -1
  30. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/WarningsDisplay/WarningsDisplay.d.ts +1 -2
  31. package/dist/cjs/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/shared/NoteDeleteButton/NoteDeleteButton.d.ts +0 -1
  32. package/dist/cjs/types/components/EditContactModal/components/Section/General/General.d.ts +0 -1
  33. package/dist/cjs/types/components/EditContactModal/components/Section/General/components/BusinessGeneral.d.ts +2 -2
  34. package/dist/cjs/types/components/EditContactModal/components/Section/General/components/ContactGeneral.d.ts +2 -2
  35. package/dist/cjs/types/components/EditContactModal/components/TagsEditor/TagsEditor.d.ts +1 -2
  36. package/dist/cjs/types/components/EditContactModal/context/TranslationContext.d.ts +9 -0
  37. package/dist/cjs/types/components/EditContactModal/hooks/useEntityUpdateSync.d.ts +8 -0
  38. package/dist/cjs/types/components/EditContactModal/hooks/useModalCloseHandler.d.ts +6 -0
  39. package/dist/cjs/types/components/EditContactModal/hooks/useTagsEditorController.d.ts +23 -0
  40. package/dist/cjs/types/components/EditContactModal/shared/ContactInfoLabel/ContactInfoLabel.d.ts +0 -1
  41. package/dist/cjs/types/components/EditContactModal/shared/EntityCustomFieldLabel/EntityCustomFieldLabel.d.ts +1 -2
  42. package/dist/cjs/types/components/EditContactModal/shared/EntityCustomFieldLabel/components/CustomPropertyDateRangePicker/CustomPropertyDateRangePicker.d.ts +1 -2
  43. package/dist/cjs/types/components/EditContactModal/shared/EntityCustomFieldLabel/components/CustomPropertyOptionSelect/CustomPropertyOptionsSelect.d.ts +1 -2
  44. package/dist/cjs/types/components/EditContactModal/shared/EntityCustomFieldLabel/components/CustomPropertyTimeRangePicker/CustomPropertyTimeRangePicker.d.ts +1 -2
  45. package/dist/cjs/types/components/EditContactModal/shared/EntityInfoLabel/EntityInfoLabel.d.ts +0 -1
  46. package/dist/esm/index.js +1135 -294
  47. package/dist/esm/index.js.map +1 -1
  48. package/dist/esm/types/components/EditContactModal/EditContactModal.d.ts +2 -2
  49. package/dist/esm/types/components/EditContactModal/components/Header/Header.d.ts +1 -2
  50. package/dist/esm/types/components/EditContactModal/components/Header/components/AvatarWithActions/AvatarWithActions.d.ts +1 -2
  51. package/dist/esm/types/components/EditContactModal/components/Header/components/Tags/Tags.d.ts +1 -2
  52. package/dist/esm/types/components/EditContactModal/components/Section/AddressInformation/AddressInformation.d.ts +1 -2
  53. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/ContactInformation.d.ts +2 -11
  54. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/EditModal.d.ts +0 -1
  55. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Mails/Mails.d.ts +1 -2
  56. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Mails/components/Body/Body.d.ts +1 -2
  57. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Mails/components/Body/components/Mail/Mail.d.ts +1 -2
  58. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Phones/Phones.d.ts +1 -2
  59. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Phones/components/Body/Body.d.ts +1 -2
  60. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Phones/components/Body/components/Phone/Phone.d.ts +1 -2
  61. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Phones/components/Body/components/Phone/components/CountrySelect/CountrySelect.d.ts +1 -4
  62. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Phones/components/Body/components/Phone/components/OptionsMenu/OptionsMenu.d.ts +1 -2
  63. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/RCSs/RCSs.d.ts +1 -2
  64. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/RCSs/components/Body/Body.d.ts +1 -2
  65. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/RCSs/components/Body/components/RCS/RCS.d.ts +1 -2
  66. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Whatsapps/Whatsapps.d.ts +1 -2
  67. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Whatsapps/components/Body/Body.d.ts +1 -2
  68. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/components/Whatsapps/components/Body/components/Whatsapp/Whatsapp.d.ts +1 -2
  69. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/AddressInput/AddressInput.d.ts +1 -2
  70. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/InformationSocialNetworkItem/InformationSocialNetworkItem.d.ts +1 -2
  71. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/InformationSocialNetworkItem/components/Body/Body.d.ts +1 -2
  72. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/InformationSocialNetworkItem/components/Body/components/Ims/Ims.d.ts +1 -2
  73. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/PhoneInput/PhoneInput.d.ts +1 -2
  74. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/SubsectionHeaderWithButton/SubsectionHeaderWithButton.d.ts +1 -1
  75. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/layout/WarningsDisplay/WarningsDisplay.d.ts +1 -2
  76. package/dist/esm/types/components/EditContactModal/components/Section/ContactInformation/components/EditModal/shared/NoteDeleteButton/NoteDeleteButton.d.ts +0 -1
  77. package/dist/esm/types/components/EditContactModal/components/Section/General/General.d.ts +0 -1
  78. package/dist/esm/types/components/EditContactModal/components/Section/General/components/BusinessGeneral.d.ts +2 -2
  79. package/dist/esm/types/components/EditContactModal/components/Section/General/components/ContactGeneral.d.ts +2 -2
  80. package/dist/esm/types/components/EditContactModal/components/TagsEditor/TagsEditor.d.ts +1 -2
  81. package/dist/esm/types/components/EditContactModal/context/TranslationContext.d.ts +9 -0
  82. package/dist/esm/types/components/EditContactModal/hooks/useEntityUpdateSync.d.ts +8 -0
  83. package/dist/esm/types/components/EditContactModal/hooks/useModalCloseHandler.d.ts +6 -0
  84. package/dist/esm/types/components/EditContactModal/hooks/useTagsEditorController.d.ts +23 -0
  85. package/dist/esm/types/components/EditContactModal/shared/ContactInfoLabel/ContactInfoLabel.d.ts +0 -1
  86. package/dist/esm/types/components/EditContactModal/shared/EntityCustomFieldLabel/EntityCustomFieldLabel.d.ts +1 -2
  87. package/dist/esm/types/components/EditContactModal/shared/EntityCustomFieldLabel/components/CustomPropertyDateRangePicker/CustomPropertyDateRangePicker.d.ts +1 -2
  88. package/dist/esm/types/components/EditContactModal/shared/EntityCustomFieldLabel/components/CustomPropertyOptionSelect/CustomPropertyOptionsSelect.d.ts +1 -2
  89. package/dist/esm/types/components/EditContactModal/shared/EntityCustomFieldLabel/components/CustomPropertyTimeRangePicker/CustomPropertyTimeRangePicker.d.ts +1 -2
  90. package/dist/esm/types/components/EditContactModal/shared/EntityInfoLabel/EntityInfoLabel.d.ts +0 -1
  91. package/dist/index.d.ts +4 -4
  92. package/package.json +11 -1
package/dist/esm/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as React$1 from 'react';
2
- import React__default, { useCallback, useEffect, useState, useMemo, Children, isValidElement, cloneElement, useRef, createContext, useContext } 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, Divider, Stack as Stack$2, Popover as Popover$2, Autocomplete, TextField as TextField$1, Select as Select$2, MenuItem as MenuItem$2, FormControl as FormControl$2, Modal as Modal$2, Backdrop as Backdrop$2, Fade as Fade$2 } from '@mui/material';
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';
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';
@@ -6360,7 +6360,7 @@ function getStyleValue$1(themeMapping, transform, propValueFinal, userValue = pr
6360
6360
  }
6361
6361
  return value;
6362
6362
  }
6363
- function style$2(options) {
6363
+ function style$5(options) {
6364
6364
  const {
6365
6365
  prop,
6366
6366
  cssProperty = options.prop,
@@ -6521,12 +6521,12 @@ function resolveCssProperty(props, keys, prop, transformer) {
6521
6521
  const propValue = props[prop];
6522
6522
  return handleBreakpoints(props, propValue, styleFromPropValue);
6523
6523
  }
6524
- function style$1(props, keys) {
6524
+ function style$4(props, keys) {
6525
6525
  const transformer = createUnarySpacing(props.theme);
6526
6526
  return Object.keys(props).map(prop => resolveCssProperty(props, keys, prop, transformer)).reduce(merge, {});
6527
6527
  }
6528
6528
  function margin(props) {
6529
- return style$1(props, marginKeys);
6529
+ return style$4(props, marginKeys);
6530
6530
  }
6531
6531
  margin.propTypes = process.env.NODE_ENV !== 'production' ? marginKeys.reduce((obj, key) => {
6532
6532
  obj[key] = responsivePropType$1;
@@ -6534,7 +6534,7 @@ margin.propTypes = process.env.NODE_ENV !== 'production' ? marginKeys.reduce((ob
6534
6534
  }, {}) : {};
6535
6535
  margin.filterProps = marginKeys;
6536
6536
  function padding(props) {
6537
- return style$1(props, paddingKeys);
6537
+ return style$4(props, paddingKeys);
6538
6538
  }
6539
6539
  padding.propTypes = process.env.NODE_ENV !== 'production' ? paddingKeys.reduce((obj, key) => {
6540
6540
  obj[key] = responsivePropType$1;
@@ -6607,7 +6607,7 @@ function borderTransform(value) {
6607
6607
  return `${value}px solid`;
6608
6608
  }
6609
6609
  function createBorderStyle(prop, transform) {
6610
- return style$2({
6610
+ return style$5({
6611
6611
  prop,
6612
6612
  themeKey: 'borders',
6613
6613
  transform
@@ -6694,31 +6694,31 @@ rowGap.propTypes = process.env.NODE_ENV !== 'production' ? {
6694
6694
  rowGap: responsivePropType$1
6695
6695
  } : {};
6696
6696
  rowGap.filterProps = ['rowGap'];
6697
- const gridColumn = style$2({
6697
+ const gridColumn = style$5({
6698
6698
  prop: 'gridColumn'
6699
6699
  });
6700
- const gridRow = style$2({
6700
+ const gridRow = style$5({
6701
6701
  prop: 'gridRow'
6702
6702
  });
6703
- const gridAutoFlow = style$2({
6703
+ const gridAutoFlow = style$5({
6704
6704
  prop: 'gridAutoFlow'
6705
6705
  });
6706
- const gridAutoColumns = style$2({
6706
+ const gridAutoColumns = style$5({
6707
6707
  prop: 'gridAutoColumns'
6708
6708
  });
6709
- const gridAutoRows = style$2({
6709
+ const gridAutoRows = style$5({
6710
6710
  prop: 'gridAutoRows'
6711
6711
  });
6712
- const gridTemplateColumns = style$2({
6712
+ const gridTemplateColumns = style$5({
6713
6713
  prop: 'gridTemplateColumns'
6714
6714
  });
6715
- const gridTemplateRows = style$2({
6715
+ const gridTemplateRows = style$5({
6716
6716
  prop: 'gridTemplateRows'
6717
6717
  });
6718
- const gridTemplateAreas = style$2({
6718
+ const gridTemplateAreas = style$5({
6719
6719
  prop: 'gridTemplateAreas'
6720
6720
  });
6721
- const gridArea = style$2({
6721
+ const gridArea = style$5({
6722
6722
  prop: 'gridArea'
6723
6723
  });
6724
6724
  compose(gap, columnGap, rowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);
@@ -6729,18 +6729,18 @@ function paletteTransform(value, userValue) {
6729
6729
  }
6730
6730
  return value;
6731
6731
  }
6732
- const color = style$2({
6732
+ const color = style$5({
6733
6733
  prop: 'color',
6734
6734
  themeKey: 'palette',
6735
6735
  transform: paletteTransform
6736
6736
  });
6737
- const bgcolor = style$2({
6737
+ const bgcolor = style$5({
6738
6738
  prop: 'bgcolor',
6739
6739
  cssProperty: 'backgroundColor',
6740
6740
  themeKey: 'palette',
6741
6741
  transform: paletteTransform
6742
6742
  });
6743
- const backgroundColor = style$2({
6743
+ const backgroundColor = style$5({
6744
6744
  prop: 'backgroundColor',
6745
6745
  themeKey: 'palette',
6746
6746
  transform: paletteTransform
@@ -6750,7 +6750,7 @@ compose(color, bgcolor, backgroundColor);
6750
6750
  function sizingTransform(value) {
6751
6751
  return value <= 1 && value !== 0 ? `${value * 100}%` : value;
6752
6752
  }
6753
- const width = style$2({
6753
+ const width = style$5({
6754
6754
  prop: 'width',
6755
6755
  transform: sizingTransform
6756
6756
  });
@@ -6778,33 +6778,33 @@ const maxWidth = props => {
6778
6778
  return null;
6779
6779
  };
6780
6780
  maxWidth.filterProps = ['maxWidth'];
6781
- const minWidth = style$2({
6781
+ const minWidth = style$5({
6782
6782
  prop: 'minWidth',
6783
6783
  transform: sizingTransform
6784
6784
  });
6785
- const height = style$2({
6785
+ const height = style$5({
6786
6786
  prop: 'height',
6787
6787
  transform: sizingTransform
6788
6788
  });
6789
- const maxHeight = style$2({
6789
+ const maxHeight = style$5({
6790
6790
  prop: 'maxHeight',
6791
6791
  transform: sizingTransform
6792
6792
  });
6793
- const minHeight = style$2({
6793
+ const minHeight = style$5({
6794
6794
  prop: 'minHeight',
6795
6795
  transform: sizingTransform
6796
6796
  });
6797
- style$2({
6797
+ style$5({
6798
6798
  prop: 'size',
6799
6799
  cssProperty: 'width',
6800
6800
  transform: sizingTransform
6801
6801
  });
6802
- style$2({
6802
+ style$5({
6803
6803
  prop: 'size',
6804
6804
  cssProperty: 'height',
6805
6805
  transform: sizingTransform
6806
6806
  });
6807
- const boxSizing = style$2({
6807
+ const boxSizing = style$5({
6808
6808
  prop: 'boxSizing'
6809
6809
  });
6810
6810
  compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);
@@ -7399,27 +7399,27 @@ var styleFunctionSx = /*#__PURE__*/Object.freeze({
7399
7399
 
7400
7400
  var require$$8 = /*@__PURE__*/getAugmentedNamespace(styleFunctionSx);
7401
7401
 
7402
- var _interopRequireDefault$b = interopRequireDefaultExports;
7402
+ var _interopRequireDefault$i = interopRequireDefaultExports;
7403
7403
  Object.defineProperty(createStyled$3, "__esModule", {
7404
7404
  value: true
7405
7405
  });
7406
7406
  var _default = createStyled$3.default = createStyled$1;
7407
7407
  var shouldForwardProp_1 = createStyled$3.shouldForwardProp = shouldForwardProp$1;
7408
7408
  createStyled$3.systemDefaultTheme = void 0;
7409
- var _extends2 = _interopRequireDefault$b(require_extends());
7410
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault$b(requireObjectWithoutPropertiesLoose());
7411
- var _styledEngine$1 = _interopRequireWildcard$1(require$$1$1);
7409
+ var _extends2 = _interopRequireDefault$i(require_extends());
7410
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault$i(requireObjectWithoutPropertiesLoose());
7411
+ var _styledEngine$1 = _interopRequireWildcard$2(require$$1$1);
7412
7412
  var _deepmerge = require$$4;
7413
- var _capitalize = _interopRequireDefault$b(require$$5);
7414
- var _getDisplayName = _interopRequireDefault$b(require$$6);
7415
- var _createTheme = _interopRequireDefault$b(require$$7);
7416
- var _styleFunctionSx = _interopRequireDefault$b(require$$8);
7413
+ var _capitalize = _interopRequireDefault$i(require$$5);
7414
+ var _getDisplayName = _interopRequireDefault$i(require$$6);
7415
+ var _createTheme = _interopRequireDefault$i(require$$7);
7416
+ var _styleFunctionSx = _interopRequireDefault$i(require$$8);
7417
7417
  const _excluded$1v = ["ownerState"],
7418
7418
  _excluded2$d = ["variants"],
7419
7419
  _excluded3$4 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
7420
7420
  /* eslint-disable no-underscore-dangle */
7421
- function _getRequireWildcardCache$1(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache$1 = function (e) { return e ? t : r; })(e); }
7422
- function _interopRequireWildcard$1(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache$1(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
7421
+ function _getRequireWildcardCache$2(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache$2 = function (e) { return e ? t : r; })(e); }
7422
+ function _interopRequireWildcard$2(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache$2(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
7423
7423
  function isEmpty$3(obj) {
7424
7424
  return Object.keys(obj).length === 0;
7425
7425
  }
@@ -7683,7 +7683,7 @@ var require$$1 = /*@__PURE__*/getAugmentedNamespace(formatMuiErrorMessage$1);
7683
7683
 
7684
7684
  var require$$2 = /*@__PURE__*/getAugmentedNamespace(clamp);
7685
7685
 
7686
- var _interopRequireDefault$a = interopRequireDefaultExports;
7686
+ var _interopRequireDefault$h = interopRequireDefaultExports;
7687
7687
  Object.defineProperty(colorManipulator, "__esModule", {
7688
7688
  value: true
7689
7689
  });
@@ -7705,8 +7705,8 @@ colorManipulator.private_safeEmphasize = private_safeEmphasize;
7705
7705
  colorManipulator.private_safeLighten = private_safeLighten;
7706
7706
  colorManipulator.recomposeColor = recomposeColor$1;
7707
7707
  colorManipulator.rgbToHex = rgbToHex;
7708
- var _formatMuiErrorMessage2 = _interopRequireDefault$a(require$$1);
7709
- var _clamp = _interopRequireDefault$a(require$$2);
7708
+ var _formatMuiErrorMessage2 = _interopRequireDefault$h(require$$1);
7709
+ var _clamp = _interopRequireDefault$h(require$$2);
7710
7710
  /* eslint-disable @typescript-eslint/naming-convention */
7711
7711
 
7712
7712
  /**
@@ -9020,11 +9020,19 @@ var PhoneEnabled = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9020
9020
  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
9021
  }), 'PhoneEnabled');
9022
9022
 
9023
+ var Star = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9024
+ 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
+ }), 'Star');
9026
+
9027
+ var StarBorder = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9028
+ d: "m22 9.24-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28z"
9029
+ }), 'StarBorder');
9030
+
9023
9031
  var ThreeP = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9024
9032
  d: "M20 2H4.01c-1.1 0-2 .9-2 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-8 4c1.1 0 2 .9 2 2s-.9 2-2 2-2-.9-2-2 .9-2 2-2m4 8H8v-.57c0-.81.48-1.53 1.22-1.85.85-.37 1.79-.58 2.78-.58.99 0 1.93.21 2.78.58.74.32 1.22 1.04 1.22 1.85z"
9025
9033
  }), 'ThreeP');
9026
9034
 
9027
- var WhatsApp$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9035
+ var WhatsApp$2 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9028
9036
  d: "M16.75 13.96c.25.13.41.2.46.3.06.11.04.61-.21 1.18-.2.56-1.24 1.1-1.7 1.12-.46.02-.47.36-2.96-.73-2.49-1.09-3.99-3.75-4.11-3.92-.12-.17-.96-1.38-.92-2.61.05-1.22.69-1.8.95-2.04.24-.26.51-.29.68-.26h.47c.15 0 .36-.06.55.45l.69 1.87c.06.13.1.28.01.44l-.27.41-.39.42c-.12.12-.26.25-.12.5.12.26.62 1.09 1.32 1.78.91.88 1.71 1.17 1.95 1.3.24.14.39.12.54-.04l.81-.94c.19-.25.35-.19.58-.11l1.67.88M12 2a10 10 0 0 1 10 10 10 10 0 0 1-10 10c-1.97 0-3.8-.57-5.35-1.55L2 22l1.55-4.65A9.969 9.969 0 0 1 2 12 10 10 0 0 1 12 2m0 2a8 8 0 0 0-8 8c0 1.72.54 3.31 1.46 4.61L4.5 19.5l2.89-.96A7.95 7.95 0 0 0 12 20a8 8 0 0 0 8-8 8 8 0 0 0-8-8z"
9029
9037
  }), 'WhatsApp');
9030
9038
 
@@ -9056,27 +9064,27 @@ function requireCreateSvgIcon () {
9056
9064
  return createSvgIcon;
9057
9065
  }
9058
9066
 
9059
- var _interopRequireDefault$9 = interopRequireDefaultExports;
9067
+ var _interopRequireDefault$g = interopRequireDefaultExports;
9060
9068
  Object.defineProperty(ArrowForward, "__esModule", {
9061
9069
  value: true
9062
9070
  });
9063
- var default_1$a = ArrowForward.default = void 0;
9064
- var _createSvgIcon$9 = _interopRequireDefault$9(requireCreateSvgIcon());
9065
- var _jsxRuntime$9 = jsxRuntimeExports;
9066
- default_1$a = ArrowForward.default = (0, _createSvgIcon$9.default)( /*#__PURE__*/(0, _jsxRuntime$9.jsx)("path", {
9071
+ var default_1$h = ArrowForward.default = void 0;
9072
+ var _createSvgIcon$g = _interopRequireDefault$g(requireCreateSvgIcon());
9073
+ var _jsxRuntime$g = jsxRuntimeExports;
9074
+ default_1$h = ArrowForward.default = (0, _createSvgIcon$g.default)( /*#__PURE__*/(0, _jsxRuntime$g.jsx)("path", {
9067
9075
  d: "m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
9068
9076
  }), 'ArrowForward');
9069
9077
 
9070
9078
  var Message = {};
9071
9079
 
9072
- var _interopRequireDefault$8 = interopRequireDefaultExports;
9080
+ var _interopRequireDefault$f = interopRequireDefaultExports;
9073
9081
  Object.defineProperty(Message, "__esModule", {
9074
9082
  value: true
9075
9083
  });
9076
- var default_1$9 = Message.default = void 0;
9077
- var _createSvgIcon$8 = _interopRequireDefault$8(requireCreateSvgIcon());
9078
- var _jsxRuntime$8 = jsxRuntimeExports;
9079
- default_1$9 = Message.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _jsxRuntime$8.jsx)("path", {
9084
+ var default_1$g = Message.default = void 0;
9085
+ var _createSvgIcon$f = _interopRequireDefault$f(requireCreateSvgIcon());
9086
+ var _jsxRuntime$f = jsxRuntimeExports;
9087
+ default_1$g = Message.default = (0, _createSvgIcon$f.default)( /*#__PURE__*/(0, _jsxRuntime$f.jsx)("path", {
9080
9088
  d: "M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2m-2 12H6v-2h12zm0-3H6V9h12zm0-3H6V6h12z"
9081
9089
  }), 'Message');
9082
9090
 
@@ -9156,7 +9164,7 @@ const Header$1 = ({ imgUrl, name, contactId, navigate, isLoading = false, onErro
9156
9164
  handleNavigateToContacts(e);
9157
9165
  onClose();
9158
9166
  }
9159
- }, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$a, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
9167
+ }, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$h, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
9160
9168
  handleNavigateToConversations(e);
9161
9169
  onClose();
9162
9170
  }, onMouseDown: (e) => {
@@ -9165,7 +9173,7 @@ const Header$1 = ({ imgUrl, name, contactId, navigate, isLoading = false, onErro
9165
9173
  handleNavigateToConversations(e);
9166
9174
  onClose();
9167
9175
  }
9168
- }, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1$9, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) })) : (jsxRuntimeExports.jsx(ContactAvatar, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) })), jsxRuntimeExports.jsx(ContactName$1, { variant: "h6", title: displayName, children: displayName })] }));
9176
+ }, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1$g, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) })) : (jsxRuntimeExports.jsx(ContactAvatar, { src: imgUrl, alt: avatarAlt, onError: () => onError?.(new Error('Failed to load avatar')) })), jsxRuntimeExports.jsx(ContactName$1, { variant: "h6", title: displayName, children: displayName })] }));
9169
9177
  };
9170
9178
 
9171
9179
  const Container$1 = styled$5(Box$2)({
@@ -9180,7 +9188,7 @@ const TitleBox = styled$5(Box$2)({
9180
9188
  width: '100%',
9181
9189
  borderBottom: `1px solid lightgray`,
9182
9190
  });
9183
- const StyledBox = styled$5(Box$2)({
9191
+ const StyledBox$3 = styled$5(Box$2)({
9184
9192
  display: 'flex',
9185
9193
  alignItems: 'center',
9186
9194
  justifyContent: 'space-between',
@@ -9211,7 +9219,7 @@ const AddressContainer = styled$5(Box$2)({
9211
9219
  height: '50px',
9212
9220
  maxWidth: '90%',
9213
9221
  });
9214
- const NoteText = styled$5(Typography$2)({
9222
+ const NoteText$2 = styled$5(Typography$2)({
9215
9223
  whiteSpace: 'nowrap',
9216
9224
  textOverflow: 'ellipsis',
9217
9225
  overflow: 'hidden',
@@ -9220,13 +9228,13 @@ const NoteText = styled$5(Typography$2)({
9220
9228
  bottom: 16,
9221
9229
  left: 40,
9222
9230
  });
9223
- const ContactMethod = ({ icon, contactList, title, showTitle = true, }) => {
9224
- const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox, { 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: {
9231
+ const ContactMethod$1 = ({ icon, contactList, title, showTitle = true, }) => {
9232
+ 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: {
9225
9233
  whiteSpace: 'nowrap',
9226
9234
  textOverflow: 'ellipsis',
9227
9235
  overflow: 'hidden',
9228
9236
  cursor: 'default',
9229
- }, children: contact.address }) }), contact.profileName && (jsxRuntimeExports.jsx(Typography$2, { variant: "body2", fontSize: 10, color: "text.disabled", sx: { marginLeft: '5px', marginTop: '10px' }, children: contact.profileName }))] }), contact.note && (jsxRuntimeExports.jsx(NoteText, { variant: "body2", fontSize: 12, color: "text.secondary", children: contact.note }))] }) }, contact.id));
9237
+ }, children: contact.address }) }), contact.profileName && (jsxRuntimeExports.jsx(Typography$2, { variant: "body2", fontSize: 10, color: "text.disabled", sx: { marginLeft: '5px', marginTop: '10px' }, children: contact.profileName }))] }), contact.note && (jsxRuntimeExports.jsx(NoteText$2, { variant: "body2", fontSize: 12, color: "text.secondary", children: contact.note }))] }) }, contact.id));
9230
9238
  return (jsxRuntimeExports.jsxs(Container$1, { children: [showTitle && (jsxRuntimeExports.jsx(TitleBox, { children: jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", fontWeight: "bold", gutterBottom: true, mt: 2, children: title }) })), contactList?.map(renderContactInfo)] }));
9231
9239
  };
9232
9240
 
@@ -15305,7 +15313,7 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
15305
15313
  showTitle: true,
15306
15314
  },
15307
15315
  {
15308
- icon: jsxRuntimeExports.jsx(WhatsApp$1, { fontSize: "small" }),
15316
+ icon: jsxRuntimeExports.jsx(WhatsApp$2, { fontSize: "small" }),
15309
15317
  title: 'IM',
15310
15318
  contactList: contactData?.ims_whatsapp || [],
15311
15319
  showTitle: true,
@@ -15339,50 +15347,47 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
15339
15347
  window.removeEventListener('keydown', handleKeyDown);
15340
15348
  };
15341
15349
  }, [open, onClose]);
15342
- return (jsxRuntimeExports.jsx(Popper$2, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(CardContent, { children: [jsxRuntimeExports.jsx(Header$1, { navigate: navigate, contactId: contactData?.id, imgUrl: avatarImgUrl, name: contactData?.name, onClose: onClose, isBusiness: dataIsBusiness }), jsxRuntimeExports.jsx(LabelsSection, { contactData: contactData, title: t('labels') }), dataIsContact && (jsxRuntimeExports.jsx(BusinessSection, { contactData: contactData, title: t('business') })), dataIsBusiness && (jsxRuntimeExports.jsx(MembersSection, { contactData: contactData, title: t('businessMembers'), navigate: navigate })), contactMethods.map((method, index) => (jsxRuntimeExports.jsx(ContactMethod, { icon: method.icon, title: method.title, contactList: method.contactList, showTitle: method.showTitle }, index))), jsxRuntimeExports.jsx(Properties, { properties: contactData?.properties, title: t('properties') })] }) }) }) }));
15343
- };
15344
-
15345
- const Section = ({ title, children }) => {
15346
- return (jsxRuntimeExports.jsxs(Box$2, { sx: {
15347
- border: '1px solid',
15348
- borderColor: 'divider',
15349
- borderRadius: 2,
15350
- p: 2,
15351
- mb: 2,
15352
- }, children: [jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", sx: { fontWeight: 600 }, children: title }), jsxRuntimeExports.jsx(Divider, { sx: { my: 1.5 } }), children] }));
15353
- };
15354
-
15355
- const SectionContent = ({ children, ...boxProps }) => {
15356
- return (jsxRuntimeExports.jsx(Box$2, { display: "grid", gridTemplateColumns: { xs: '1fr', md: 'repeat(2, minmax(0, 1fr))' }, gap: 2, ...boxProps, children: children }));
15350
+ return (jsxRuntimeExports.jsx(Popper$2, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(CardContent, { children: [jsxRuntimeExports.jsx(Header$1, { navigate: navigate, contactId: contactData?.id, imgUrl: avatarImgUrl, name: contactData?.name, onClose: onClose, isBusiness: dataIsBusiness }), jsxRuntimeExports.jsx(LabelsSection, { contactData: contactData, title: t('labels') }), dataIsContact && (jsxRuntimeExports.jsx(BusinessSection, { contactData: contactData, title: t('business') })), dataIsBusiness && (jsxRuntimeExports.jsx(MembersSection, { contactData: contactData, title: t('businessMembers'), navigate: navigate })), contactMethods.map((method, index) => (jsxRuntimeExports.jsx(ContactMethod$1, { icon: method.icon, title: method.title, contactList: method.contactList, showTitle: method.showTitle }, index))), jsxRuntimeExports.jsx(Properties, { properties: contactData?.properties, title: t('properties') })] }) }) }) }));
15357
15351
  };
15358
15352
 
15359
15353
  var Edit = {};
15360
15354
 
15361
- var _interopRequireDefault$7 = interopRequireDefaultExports;
15355
+ var _interopRequireDefault$e = interopRequireDefaultExports;
15362
15356
  Object.defineProperty(Edit, "__esModule", {
15363
15357
  value: true
15364
15358
  });
15365
- var default_1$8 = Edit.default = void 0;
15366
- var _createSvgIcon$7 = _interopRequireDefault$7(requireCreateSvgIcon());
15367
- var _jsxRuntime$7 = jsxRuntimeExports;
15368
- default_1$8 = Edit.default = (0, _createSvgIcon$7.default)( /*#__PURE__*/(0, _jsxRuntime$7.jsx)("path", {
15359
+ var default_1$f = Edit.default = void 0;
15360
+ var _createSvgIcon$e = _interopRequireDefault$e(requireCreateSvgIcon());
15361
+ var _jsxRuntime$e = jsxRuntimeExports;
15362
+ default_1$f = Edit.default = (0, _createSvgIcon$e.default)( /*#__PURE__*/(0, _jsxRuntime$e.jsx)("path", {
15369
15363
  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"
15370
15364
  }), 'Edit');
15371
15365
 
15372
15366
  var Label = {};
15373
15367
 
15374
- var _interopRequireDefault$6 = interopRequireDefaultExports;
15368
+ var _interopRequireDefault$d = interopRequireDefaultExports;
15375
15369
  Object.defineProperty(Label, "__esModule", {
15376
15370
  value: true
15377
15371
  });
15378
- var default_1$7 = Label.default = void 0;
15379
- var _createSvgIcon$6 = _interopRequireDefault$6(requireCreateSvgIcon());
15380
- var _jsxRuntime$6 = jsxRuntimeExports;
15381
- default_1$7 = Label.default = (0, _createSvgIcon$6.default)( /*#__PURE__*/(0, _jsxRuntime$6.jsx)("path", {
15372
+ var default_1$e = Label.default = void 0;
15373
+ var _createSvgIcon$d = _interopRequireDefault$d(requireCreateSvgIcon());
15374
+ var _jsxRuntime$d = jsxRuntimeExports;
15375
+ default_1$e = Label.default = (0, _createSvgIcon$d.default)( /*#__PURE__*/(0, _jsxRuntime$d.jsx)("path", {
15382
15376
  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"
15383
15377
  }), 'Label');
15384
15378
 
15385
- const Tags = ({ tags, t, onEditTags }) => {
15379
+ const noop$3 = (key) => key;
15380
+ const TranslationContext = createContext(noop$3);
15381
+ const TranslationProvider = ({ t, children }) => {
15382
+ return jsxRuntimeExports.jsx(TranslationContext.Provider, { value: t, children: children });
15383
+ };
15384
+ const useTranslationContext = () => {
15385
+ const t = useContext(TranslationContext);
15386
+ return t || noop$3;
15387
+ };
15388
+
15389
+ const Tags = ({ tags, onEditTags }) => {
15390
+ const t = useTranslationContext();
15386
15391
  const [anchorEl, setAnchorEl] = useState(null);
15387
15392
  const safeTags = useMemo(() => tags ?? [], [tags]);
15388
15393
  const MAX_VISIBLE = 4;
@@ -15426,7 +15431,7 @@ const Tags = ({ tags, t, onEditTags }) => {
15426
15431
  bgcolor: 'action.hover',
15427
15432
  color: 'text.primary',
15428
15433
  },
15429
- }, children: safeTags.length ? (jsxRuntimeExports.jsx(default_1$8, { fontSize: "small" })) : (jsxRuntimeExports.jsx(default_1$7, { fontSize: "small" })) })] }), jsxRuntimeExports.jsx(Popover$2, { open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, transformOrigin: { vertical: 'top', horizontal: 'center' }, children: jsxRuntimeExports.jsxs(Box$2, { sx: { p: 1.5, maxWidth: 320, maxHeight: 240, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle2", sx: { mb: 1 }, children: t('tags') }), jsxRuntimeExports.jsx(Stack$2, { direction: "row", spacing: 1, useFlexGap: true, flexWrap: "wrap", children: safeTags.map((tag) => (jsxRuntimeExports.jsx(Chip$2, { label: tag.name, size: "small", variant: "outlined", sx: {
15434
+ }, children: safeTags.length ? (jsxRuntimeExports.jsx(default_1$f, { fontSize: "small" })) : (jsxRuntimeExports.jsx(default_1$e, { fontSize: "small" })) })] }), jsxRuntimeExports.jsx(Popover$2, { open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, transformOrigin: { vertical: 'top', horizontal: 'center' }, children: jsxRuntimeExports.jsxs(Box$2, { sx: { p: 1.5, maxWidth: 320, maxHeight: 240, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle2", sx: { mb: 1 }, children: t('tags') }), jsxRuntimeExports.jsx(Stack$2, { direction: "row", spacing: 1, useFlexGap: true, flexWrap: "wrap", children: safeTags.map((tag) => (jsxRuntimeExports.jsx(Chip$2, { label: tag.name, size: "small", variant: "outlined", sx: {
15430
15435
  borderRadius: 999,
15431
15436
  maxWidth: 160,
15432
15437
  '& .MuiChip-label': {
@@ -15438,35 +15443,36 @@ const Tags = ({ tags, t, onEditTags }) => {
15438
15443
 
15439
15444
  var Delete = {};
15440
15445
 
15441
- var _interopRequireDefault$5 = interopRequireDefaultExports;
15446
+ var _interopRequireDefault$c = interopRequireDefaultExports;
15442
15447
  Object.defineProperty(Delete, "__esModule", {
15443
15448
  value: true
15444
15449
  });
15445
- var default_1$6 = Delete.default = void 0;
15446
- var _createSvgIcon$5 = _interopRequireDefault$5(requireCreateSvgIcon());
15447
- var _jsxRuntime$5 = jsxRuntimeExports;
15448
- default_1$6 = Delete.default = (0, _createSvgIcon$5.default)( /*#__PURE__*/(0, _jsxRuntime$5.jsx)("path", {
15450
+ var default_1$d = Delete.default = void 0;
15451
+ var _createSvgIcon$c = _interopRequireDefault$c(requireCreateSvgIcon());
15452
+ var _jsxRuntime$c = jsxRuntimeExports;
15453
+ default_1$d = Delete.default = (0, _createSvgIcon$c.default)( /*#__PURE__*/(0, _jsxRuntime$c.jsx)("path", {
15449
15454
  d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"
15450
15455
  }), 'Delete');
15451
15456
 
15452
15457
  var PhotoCamera = {};
15453
15458
 
15454
- var _interopRequireDefault$4 = interopRequireDefaultExports;
15459
+ var _interopRequireDefault$b = interopRequireDefaultExports;
15455
15460
  Object.defineProperty(PhotoCamera, "__esModule", {
15456
15461
  value: true
15457
15462
  });
15458
- var default_1$5 = PhotoCamera.default = void 0;
15459
- var _createSvgIcon$4 = _interopRequireDefault$4(requireCreateSvgIcon());
15460
- var _jsxRuntime$4 = jsxRuntimeExports;
15461
- default_1$5 = PhotoCamera.default = (0, _createSvgIcon$4.default)([/*#__PURE__*/(0, _jsxRuntime$4.jsx)("circle", {
15463
+ var default_1$c = PhotoCamera.default = void 0;
15464
+ var _createSvgIcon$b = _interopRequireDefault$b(requireCreateSvgIcon());
15465
+ var _jsxRuntime$b = jsxRuntimeExports;
15466
+ default_1$c = PhotoCamera.default = (0, _createSvgIcon$b.default)([/*#__PURE__*/(0, _jsxRuntime$b.jsx)("circle", {
15462
15467
  cx: "12",
15463
15468
  cy: "12",
15464
15469
  r: "3.2"
15465
- }, "0"), /*#__PURE__*/(0, _jsxRuntime$4.jsx)("path", {
15470
+ }, "0"), /*#__PURE__*/(0, _jsxRuntime$b.jsx)("path", {
15466
15471
  d: "M9 2 7.17 4H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2h-3.17L15 2zm3 15c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5"
15467
15472
  }, "1")], 'PhotoCamera');
15468
15473
 
15469
- const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading, isDeleting, t, }) => {
15474
+ const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading, isDeleting, }) => {
15475
+ const t = useTranslationContext();
15470
15476
  return (jsxRuntimeExports.jsxs(Box$2, { sx: {
15471
15477
  width: 60,
15472
15478
  height: 60,
@@ -15495,11 +15501,11 @@ const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading,
15495
15501
  color: 'common.white',
15496
15502
  bgcolor: 'rgba(0, 0, 0, 0.25)',
15497
15503
  '&:hover': { bgcolor: 'rgba(0, 0, 0, 0.35)' },
15498
- }, children: jsxRuntimeExports.jsx(default_1$5, { fontSize: "small" }) }), jsxRuntimeExports.jsx(IconButton$2, { size: "small", "aria-label": t('avatar.delete'), onClick: onDelete, disabled: Boolean(isDeleting), sx: {
15504
+ }, children: jsxRuntimeExports.jsx(default_1$c, { fontSize: "small" }) }), jsxRuntimeExports.jsx(IconButton$2, { size: "small", "aria-label": t('avatar.delete'), onClick: onDelete, disabled: Boolean(isDeleting), sx: {
15499
15505
  color: 'common.white',
15500
15506
  bgcolor: 'rgba(0, 0, 0, 0.25)',
15501
15507
  '&:hover': { bgcolor: 'rgba(0, 0, 0, 0.35)' },
15502
- }, children: jsxRuntimeExports.jsx(default_1$6, { fontSize: "small" }) })] })] }));
15508
+ }, children: jsxRuntimeExports.jsx(default_1$d, { fontSize: "small" }) })] })] }));
15503
15509
  };
15504
15510
 
15505
15511
  const HeaderContainer = styled$5(Box$2)({
@@ -15517,34 +15523,34 @@ const ContactName = styled$5(Typography$2)({
15517
15523
  maxWidth: 360,
15518
15524
  textAlign: 'center',
15519
15525
  });
15520
- const Header = ({ imgUrl, displayName, onError, tags, t, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
15526
+ const Header = ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
15521
15527
  const avatarAlt = `Avatar for ${displayName}`;
15522
- 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, t: t }), jsxRuntimeExports.jsx(ContactName, { variant: "h6", title: displayName, children: displayName }), jsxRuntimeExports.jsx(Tags, { tags: tags, t: t, onEditTags: onEditTags })] }));
15528
+ 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 })] }));
15523
15529
  };
15524
15530
 
15525
15531
  var ArrowBack = {};
15526
15532
 
15527
- var _interopRequireDefault$3 = interopRequireDefaultExports;
15533
+ var _interopRequireDefault$a = interopRequireDefaultExports;
15528
15534
  Object.defineProperty(ArrowBack, "__esModule", {
15529
15535
  value: true
15530
15536
  });
15531
- var default_1$4 = ArrowBack.default = void 0;
15532
- var _createSvgIcon$3 = _interopRequireDefault$3(requireCreateSvgIcon());
15533
- var _jsxRuntime$3 = jsxRuntimeExports;
15534
- default_1$4 = ArrowBack.default = (0, _createSvgIcon$3.default)( /*#__PURE__*/(0, _jsxRuntime$3.jsx)("path", {
15537
+ var default_1$b = ArrowBack.default = void 0;
15538
+ var _createSvgIcon$a = _interopRequireDefault$a(requireCreateSvgIcon());
15539
+ var _jsxRuntime$a = jsxRuntimeExports;
15540
+ default_1$b = ArrowBack.default = (0, _createSvgIcon$a.default)( /*#__PURE__*/(0, _jsxRuntime$a.jsx)("path", {
15535
15541
  d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"
15536
15542
  }), 'ArrowBack');
15537
15543
 
15538
15544
  var Save = {};
15539
15545
 
15540
- var _interopRequireDefault$2 = interopRequireDefaultExports;
15546
+ var _interopRequireDefault$9 = interopRequireDefaultExports;
15541
15547
  Object.defineProperty(Save, "__esModule", {
15542
15548
  value: true
15543
15549
  });
15544
- var default_1$3 = Save.default = void 0;
15545
- var _createSvgIcon$2 = _interopRequireDefault$2(requireCreateSvgIcon());
15546
- var _jsxRuntime$2 = jsxRuntimeExports;
15547
- default_1$3 = Save.default = (0, _createSvgIcon$2.default)( /*#__PURE__*/(0, _jsxRuntime$2.jsx)("path", {
15550
+ var default_1$a = Save.default = void 0;
15551
+ var _createSvgIcon$9 = _interopRequireDefault$9(requireCreateSvgIcon());
15552
+ var _jsxRuntime$9 = jsxRuntimeExports;
15553
+ default_1$a = Save.default = (0, _createSvgIcon$9.default)( /*#__PURE__*/(0, _jsxRuntime$9.jsx)("path", {
15548
15554
  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"
15549
15555
  }), 'Save');
15550
15556
 
@@ -15553,11 +15559,11 @@ var useThemeWithoutDefault = {};
15553
15559
  Object.defineProperty(useThemeWithoutDefault, "__esModule", {
15554
15560
  value: true
15555
15561
  });
15556
- var default_1$2 = useThemeWithoutDefault.default = void 0;
15557
- var React = _interopRequireWildcard(React__default);
15562
+ var default_1$9 = useThemeWithoutDefault.default = void 0;
15563
+ var React = _interopRequireWildcard$1(React__default);
15558
15564
  var _styledEngine = require$$1$1;
15559
- function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
15560
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15565
+ function _getRequireWildcardCache$1(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache$1 = function (e) { return e ? t : r; })(e); }
15566
+ function _interopRequireWildcard$1(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache$1(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
15561
15567
  function isObjectEmpty$2(obj) {
15562
15568
  return Object.keys(obj).length === 0;
15563
15569
  }
@@ -15565,7 +15571,7 @@ function useTheme$3(defaultTheme = null) {
15565
15571
  const contextTheme = React.useContext(_styledEngine.ThemeContext);
15566
15572
  return !contextTheme || isObjectEmpty$2(contextTheme) ? defaultTheme : contextTheme;
15567
15573
  }
15568
- default_1$2 = useThemeWithoutDefault.default = useTheme$3;
15574
+ default_1$9 = useThemeWithoutDefault.default = useTheme$3;
15569
15575
 
15570
15576
  var top = 'top';
15571
15577
  var bottom = 'bottom';
@@ -18482,7 +18488,7 @@ const getSideFromDirection = direction => {
18482
18488
  'column-reverse': 'Bottom'
18483
18489
  }[direction];
18484
18490
  };
18485
- const style = ({
18491
+ const style$3 = ({
18486
18492
  ownerState,
18487
18493
  theme
18488
18494
  }) => {
@@ -18559,7 +18565,7 @@ function createStack(options = {}) {
18559
18565
  };
18560
18566
  return composeClasses$2(slots, slot => generateUtilityClass$2(componentName, slot), {});
18561
18567
  };
18562
- const StackRoot = createStyledComponent(style);
18568
+ const StackRoot = createStyledComponent(style$3);
18563
18569
  const Stack = /*#__PURE__*/React$1.forwardRef(function Grid(inProps, ref) {
18564
18570
  const themeProps = useThemeProps(inProps);
18565
18571
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
@@ -18652,7 +18658,7 @@ const PopperRoot = styled$3(BasePopper, {
18652
18658
  */
18653
18659
  const Popper = /*#__PURE__*/React$1.forwardRef(function Popper(inProps, ref) {
18654
18660
  var _slots$root;
18655
- const theme = default_1$2();
18661
+ const theme = default_1$9();
18656
18662
  const props = useDefaultProps({
18657
18663
  props: inProps,
18658
18664
  name: 'MuiPopper'
@@ -24554,7 +24560,8 @@ const PAGE_SIZE = 20;
24554
24560
  const AutocompletePopper = styled$3(MuiPopper)(({ theme }) => ({
24555
24561
  zIndex: theme.zIndex.modal + 1,
24556
24562
  }));
24557
- const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, t }) => {
24563
+ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving }) => {
24564
+ const t = useTranslationContext();
24558
24565
  const [searchValue, setSearchValue] = useState('');
24559
24566
  const [limit, setLimit] = useState(PAGE_SIZE);
24560
24567
  const safeOptions = useMemo(() => options ?? [], [options]);
@@ -24569,7 +24576,7 @@ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, t }) =
24569
24576
  if (nearBottom)
24570
24577
  setLimit((l) => l + PAGE_SIZE);
24571
24578
  };
24572
- return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(Stack$2, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 2 }, children: [jsxRuntimeExports.jsx(IconButton$2, { size: "small", onClick: onBack, "aria-label": t('global.back'), disabled: isSaving, children: jsxRuntimeExports.jsx(default_1$4, { fontSize: "small" }) }), jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", children: t('tags') }), jsxRuntimeExports.jsx(Box$2, { sx: { flex: 1 } }), jsxRuntimeExports.jsx(LoadingButton$1, { variant: "contained", size: "small", startIcon: jsxRuntimeExports.jsx(default_1$3, {}), onClick: onSave, loading: isSaving, disabled: isSaving, children: t('global.save') })] }), jsxRuntimeExports.jsx(Autocomplete, { multiple: true, value: value, onChange: (_, newValue) => onChange(newValue), options: visibleOptions, filterOptions: (x) => x, inputValue: searchValue, onInputChange: handleSearchChange, getOptionLabel: (option) => option?.name ?? '', isOptionEqualToValue: (o, v) => String(o?.id) === String(v?.id), PopperComponent: AutocompletePopper, renderOption: (props, option) => (jsxRuntimeExports.jsx("li", { ...props, children: option.name ?? '' })), renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => (jsxRuntimeExports.jsx(Chip$2, { label: option.name ?? '', ...getTagProps({ index }) }))), size: "small", renderInput: (params) => jsxRuntimeExports.jsx(TextField$1, { ...params, size: "small" }), ListboxProps: {
24579
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(Stack$2, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 2 }, children: [jsxRuntimeExports.jsx(IconButton$2, { size: "small", onClick: onBack, "aria-label": t('global.back'), disabled: isSaving, children: jsxRuntimeExports.jsx(default_1$b, { fontSize: "small" }) }), jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", children: t('tags') }), jsxRuntimeExports.jsx(Box$2, { sx: { flex: 1 } }), jsxRuntimeExports.jsx(LoadingButton$1, { variant: "contained", size: "small", startIcon: jsxRuntimeExports.jsx(default_1$a, {}), onClick: onSave, loading: isSaving, disabled: isSaving, children: t('global.save') })] }), jsxRuntimeExports.jsx(Autocomplete, { multiple: true, value: value, onChange: (_, newValue) => onChange(newValue), options: visibleOptions, filterOptions: (x) => x, inputValue: searchValue, onInputChange: handleSearchChange, getOptionLabel: (option) => option?.name ?? '', isOptionEqualToValue: (o, v) => String(o?.id) === String(v?.id), PopperComponent: AutocompletePopper, renderOption: (props, option) => jsxRuntimeExports.jsx("li", { ...props, children: option.name ?? '' }), renderTags: (tagValue, getTagProps) => tagValue.map((option, index) => (jsxRuntimeExports.jsx(Chip$2, { label: option.name ?? '', ...getTagProps({ index }) }))), size: "small", renderInput: (params) => jsxRuntimeExports.jsx(TextField$1, { ...params, size: "small" }), ListboxProps: {
24573
24580
  onScroll: onListboxScroll,
24574
24581
  sx: { maxHeight: 280, overflowY: 'auto' },
24575
24582
  }, noOptionsText: t('global.noOptions'), sx: { width: '100%' } })] }));
@@ -25353,10 +25360,10 @@ class WebChatChannel {
25353
25360
  }
25354
25361
  WebChat.WebChatChannel = WebChatChannel;
25355
25362
 
25356
- var WhatsApp = {};
25363
+ var WhatsApp$1 = {};
25357
25364
 
25358
- Object.defineProperty(WhatsApp, "__esModule", { value: true });
25359
- WhatsApp.WhatsAppConfig = WhatsApp.WhatsAppConectionType = void 0;
25365
+ Object.defineProperty(WhatsApp$1, "__esModule", { value: true });
25366
+ WhatsApp$1.WhatsAppConfig = WhatsApp$1.WhatsAppConectionType = void 0;
25360
25367
  var WhatsAppConectionType;
25361
25368
  (function (WhatsAppConectionType) {
25362
25369
  // NULL = 0,
@@ -25364,21 +25371,21 @@ var WhatsAppConectionType;
25364
25371
  // TWILIO = 2,
25365
25372
  // DIALOG360 = 6,
25366
25373
  WhatsAppConectionType[WhatsAppConectionType["CLOUDAPI"] = 7] = "CLOUDAPI";
25367
- })(WhatsAppConectionType || (WhatsApp.WhatsAppConectionType = WhatsAppConectionType = {}));
25374
+ })(WhatsAppConectionType || (WhatsApp$1.WhatsAppConectionType = WhatsAppConectionType = {}));
25368
25375
  class WhatsAppConfig {
25369
25376
  }
25370
- WhatsApp.WhatsAppConfig = WhatsAppConfig;
25377
+ WhatsApp$1.WhatsAppConfig = WhatsAppConfig;
25371
25378
 
25372
- var RCS = {};
25379
+ var RCS$1 = {};
25373
25380
 
25374
- Object.defineProperty(RCS, "__esModule", { value: true });
25375
- RCS.RCSServiceAccount = RCS.RCSConfig = void 0;
25381
+ Object.defineProperty(RCS$1, "__esModule", { value: true });
25382
+ RCS$1.RCSServiceAccount = RCS$1.RCSConfig = void 0;
25376
25383
  class RCSConfig {
25377
25384
  }
25378
- RCS.RCSConfig = RCSConfig;
25385
+ RCS$1.RCSConfig = RCSConfig;
25379
25386
  class RCSServiceAccount {
25380
25387
  }
25381
- RCS.RCSServiceAccount = RCSServiceAccount;
25388
+ RCS$1.RCSServiceAccount = RCSServiceAccount;
25382
25389
 
25383
25390
  (function (exports) {
25384
25391
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -25409,8 +25416,8 @@ RCS.RCSServiceAccount = RCSServiceAccount;
25409
25416
  __exportStar(Sip, exports);
25410
25417
  __exportStar(Sms, exports);
25411
25418
  __exportStar(WebChat, exports);
25412
- __exportStar(WhatsApp, exports);
25413
- __exportStar(RCS, exports);
25419
+ __exportStar(WhatsApp$1, exports);
25420
+ __exportStar(RCS$1, exports);
25414
25421
  } (Channels));
25415
25422
 
25416
25423
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
@@ -26305,6 +26312,20 @@ const resolveUserLabel = ({ userId, users, currentUser, }) => {
26305
26312
  return fromUsers?.name?.trim() || fromUsers?.email || null;
26306
26313
  };
26307
26314
 
26315
+ const Section = ({ title, children }) => {
26316
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: {
26317
+ border: '1px solid',
26318
+ borderColor: 'divider',
26319
+ borderRadius: 2,
26320
+ p: 2,
26321
+ mb: 2,
26322
+ }, children: [jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle1", sx: { fontWeight: 600 }, children: title }), jsxRuntimeExports.jsx(Divider, { sx: { my: 1.5 } }), children] }));
26323
+ };
26324
+
26325
+ const SectionContent = ({ children, ...boxProps }) => {
26326
+ return (jsxRuntimeExports.jsx(Box$2, { display: "grid", gridTemplateColumns: { xs: '1fr', md: 'repeat(2, minmax(0, 1fr))' }, gap: 2, ...boxProps, children: children }));
26327
+ };
26328
+
26308
26329
  var weekOfYear = {exports: {}};
26309
26330
 
26310
26331
  (function (module, exports) {
@@ -52391,20 +52412,20 @@ const DateSelect = ({ birthDate, setBirthDate, dateFormat }) => {
52391
52412
 
52392
52413
  var Cancel = {};
52393
52414
 
52394
- var _interopRequireDefault$1 = interopRequireDefaultExports;
52415
+ var _interopRequireDefault$8 = interopRequireDefaultExports;
52395
52416
  Object.defineProperty(Cancel, "__esModule", {
52396
52417
  value: true
52397
52418
  });
52398
- var default_1$1 = Cancel.default = void 0;
52399
- var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
52400
- var _jsxRuntime$1 = jsxRuntimeExports;
52401
- default_1$1 = Cancel.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
52419
+ var default_1$8 = Cancel.default = void 0;
52420
+ var _createSvgIcon$8 = _interopRequireDefault$8(requireCreateSvgIcon());
52421
+ var _jsxRuntime$8 = jsxRuntimeExports;
52422
+ default_1$8 = Cancel.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _jsxRuntime$8.jsx)("path", {
52402
52423
  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"
52403
52424
  }), 'Cancel');
52404
52425
 
52405
52426
  const isUserInfo = (option) => 'email' in option;
52406
52427
  const isContactBirthdayProps = (p) => p.entityType === 'contact' && p.inputType === 'birthday';
52407
- const StyledIconButton$1 = styled$5(IconButton$2)({
52428
+ const StyledIconButton$3 = styled$5(IconButton$2)({
52408
52429
  opacity: 0,
52409
52430
  transition: 'opacity 0.3s ease-in-out',
52410
52431
  '& .MuiSvgIcon-root': {
@@ -52421,6 +52442,7 @@ const StyledSaveCancelButton$1 = styled$5(IconButton$2)({
52421
52442
  });
52422
52443
  const EntityInfoLabel = (props) => {
52423
52444
  const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated, } = props;
52445
+ const t = useTranslationContext();
52424
52446
  const inputType = props.inputType ?? 'text';
52425
52447
  const [isEditing, setIsEditing] = useState(false);
52426
52448
  const [isSaving, setIsSaving] = useState(false);
@@ -52533,18 +52555,18 @@ const EntityInfoLabel = (props) => {
52533
52555
  '&:hover .edit-icon': {
52534
52556
  opacity: 1,
52535
52557
  },
52536
- }, 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$3, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$1, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$1, { className: "edit-icon", size: "small", onClick: handleEditClick, children: jsxRuntimeExports.jsx(default_1$8, {}) }))] }), 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: props.t('contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(MenuItem$2, { value: option.id, children: props.entityType === 'contact'
52558
+ }, 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('contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(MenuItem$2, { value: option.id, children: props.entityType === 'contact'
52537
52559
  ? option.name?.trim() || (isUserInfo(option) ? option.email : '') || 'Sin nombre'
52538
52560
  : 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) || '-' })) })] }));
52539
52561
  };
52540
52562
 
52541
52563
  const ContactInfoLabel = (props) => {
52542
- const { title, value, isNotEditable, options = [], displayValue, constructUpdateObject, businessId, baseUrl, spaceId, contactId, t, onEntityUpdated, } = props;
52564
+ const { title, value, isNotEditable, options = [], displayValue, constructUpdateObject, businessId, baseUrl, spaceId, contactId, onEntityUpdated, } = props;
52543
52565
  if (props.inputType === 'birthday') {
52544
- return (jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", entityId: contactId, title: title, value: value, isNotEditable: isNotEditable, inputType: "birthday", options: options, displayValue: displayValue, constructUpdateObject: constructUpdateObject, contact: props.contact, businessId: businessId, baseUrl: baseUrl, spaceId: spaceId, t: t, dateFormat: props.dateFormat, onEntityUpdated: onEntityUpdated }));
52566
+ return (jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", entityId: contactId, title: title, value: value, isNotEditable: isNotEditable, inputType: "birthday", options: options, displayValue: displayValue, constructUpdateObject: constructUpdateObject, contact: props.contact, businessId: businessId, baseUrl: baseUrl, spaceId: spaceId, dateFormat: props.dateFormat, onEntityUpdated: onEntityUpdated }));
52545
52567
  }
52546
52568
  const inputType = props.inputType ?? 'text';
52547
- return (jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", entityId: contactId, title: title, value: value, isNotEditable: isNotEditable, inputType: inputType, options: options, displayValue: displayValue, constructUpdateObject: constructUpdateObject, businessId: businessId, baseUrl: baseUrl, spaceId: spaceId, t: t, onEntityUpdated: onEntityUpdated }));
52569
+ return (jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", entityId: contactId, title: title, value: value, isNotEditable: isNotEditable, inputType: inputType, options: options, displayValue: displayValue, constructUpdateObject: constructUpdateObject, businessId: businessId, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: onEntityUpdated }));
52548
52570
  };
52549
52571
 
52550
52572
  const CustomPropertyInput = ({ nameKey, value, onChange, type, }) => {
@@ -52602,7 +52624,8 @@ const CustomPropertyDatePicker = ({ value, handleChange, dateFormat }) => {
52602
52624
  } }) }) }));
52603
52625
  };
52604
52626
 
52605
- const CustomPropertyOptionsSelect = ({ handleChange, value, options, t }) => {
52627
+ const CustomPropertyOptionsSelect = ({ handleChange, value, options }) => {
52628
+ const t = useTranslationContext();
52606
52629
  return (jsxRuntimeExports.jsx(FormControl$2, { className: "fadein", sx: { width: '100%' }, children: jsxRuntimeExports.jsxs(Select$2, { value: value, onChange: (e) => handleChange(e.target.value), size: "small", variant: "standard", children: [jsxRuntimeExports.jsx(MenuItem$2, { value: "", children: t('global.noValue') }), options.map((option, i) => (jsxRuntimeExports.jsx(MenuItem$2, { value: option, children: option }, i)))] }) }));
52607
52630
  };
52608
52631
 
@@ -54300,7 +54323,8 @@ MultiInputTimeRangeField.propTypes = {
54300
54323
  value: PropTypes.arrayOf(PropTypes.object)
54301
54324
  };
54302
54325
 
54303
- const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat, t, }) => {
54326
+ const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat }) => {
54327
+ const t = useTranslationContext();
54304
54328
  const initDates = [
54305
54329
  dayjs().set('hour', 0).set('minute', 0),
54306
54330
  dayjs().set('hour', 0).set('minute', 0),
@@ -54308,9 +54332,7 @@ const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat, t,
54308
54332
  const timeFormat = userTimeFormat === '24' ? 'HH:mm' : 'hh:mm';
54309
54333
  return (jsxRuntimeExports.jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: jsxRuntimeExports.jsx(Box$1, { sx: { overflow: 'visible', paddingTop: '0px' }, children: jsxRuntimeExports.jsx(MultiInputTimeRangeField, { slotProps: {
54310
54334
  textField: ({ position }) => ({
54311
- label: position === 'start'
54312
- ? t('contactEdit.from')
54313
- : t('contactEdit.to'),
54335
+ label: position === 'start' ? t('contactEdit.from') : t('contactEdit.to'),
54314
54336
  size: 'small',
54315
54337
  variant: 'standard',
54316
54338
  inputProps: {
@@ -54320,7 +54342,8 @@ const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat, t,
54320
54342
  }, value: value ? value : initDates, onChange: (newValue) => handleChange(newValue), format: timeFormat }) }) }));
54321
54343
  };
54322
54344
 
54323
- const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat, t }) => {
54345
+ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat }) => {
54346
+ const t = useTranslationContext();
54324
54347
  // Default date range if value is null
54325
54348
  const initDates = [dayjs(), dayjs()];
54326
54349
  // Determina el formato dinámico
@@ -54340,7 +54363,7 @@ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat, t
54340
54363
  }, value: value || initDates, onChange: (newValue) => handleChange(newValue), format: dateFormat }) }) }));
54341
54364
  };
54342
54365
 
54343
- const StyledIconButton = styled$5(IconButton$2)(() => ({
54366
+ const StyledIconButton$2 = styled$5(IconButton$2)(() => ({
54344
54367
  opacity: 0,
54345
54368
  transition: 'opacity 0.3s ease-in-out',
54346
54369
  '& .MuiSvgIcon-root': {
@@ -54380,7 +54403,7 @@ const FieldValue = styled$5(Typography$2)(({ theme }) => ({
54380
54403
  overflow: 'auto',
54381
54404
  whiteSpace: 'break-spaces',
54382
54405
  }));
54383
- const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, customContactFields, userTrii, baseUrl, spaceId, t, onEntityUpdated, }) => {
54406
+ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, customContactFields, userTrii, baseUrl, spaceId, onEntityUpdated, }) => {
54384
54407
  const { customProperties } = entity.field;
54385
54408
  const { setCustomProperties } = entity.action;
54386
54409
  const [isEditing, setIsEditing] = useState(false);
@@ -54420,8 +54443,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54420
54443
  if (!entityId)
54421
54444
  return;
54422
54445
  setIsSaving(true);
54423
- const current = customProperties.find((p) => p.nameKey === property.nameKey) ||
54424
- property;
54446
+ const current = customProperties.find((p) => p.nameKey === property.nameKey) || property;
54425
54447
  const { nameKey, value } = current;
54426
54448
  // Definición del campo (si existe)
54427
54449
  const fieldDef = customContactFields.find((f) => f.nameKey === nameKey);
@@ -54532,25 +54554,18 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54532
54554
  : null, handleChange: (newValue) => handleInputChange(nameKey, newValue), userTimeFormat: userTimeFormat }));
54533
54555
  else if (type === Contacts.ContactField_type.DATERANGE)
54534
54556
  return (jsxRuntimeExports.jsx(CustomPropertyDateRangePicker, { value: value && typeof value === 'string' && value.includes(' - ')
54535
- ? [
54536
- dayjs(value.split(' - ')[0]),
54537
- dayjs(value.split(' - ')[1]),
54538
- ]
54539
- : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userDateFormat: userDateFormat, t: t }));
54557
+ ? [dayjs(value.split(' - ')[0]), dayjs(value.split(' - ')[1])]
54558
+ : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userDateFormat: userDateFormat }));
54540
54559
  else if (type === Contacts.ContactField_type.TIMERANGE)
54541
54560
  return (jsxRuntimeExports.jsx(CustomPropertyTimeRangePicker, { value: Array.isArray(value) && value.length === 2
54542
54561
  ? [dayjs(value[0]), dayjs(value[1])]
54543
- : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userTimeFormat: userTimeFormat, t: t }));
54562
+ : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userTimeFormat: userTimeFormat }));
54544
54563
  else if (type === Contacts.ContactField_type.OPTIONS)
54545
- return (jsxRuntimeExports.jsx(CustomPropertyOptionsSelect, { value: typeof value === 'string' ? value : '', handleChange: (newValue) => handleInputChange(nameKey, newValue), options: customContactFields.find((field) => field.nameKey === nameKey)?.typeOptions ?? [], t: t }));
54564
+ return (jsxRuntimeExports.jsx(CustomPropertyOptionsSelect, { value: typeof value === 'string' ? value : '', handleChange: (newValue) => handleInputChange(nameKey, newValue), options: customContactFields.find((field) => field.nameKey === nameKey)?.typeOptions ?? [] }));
54546
54565
  else
54547
54566
  return (jsxRuntimeExports.jsx(CustomPropertyInput, { type: type, nameKey: nameKey, value: value, onChange: handleInputChange }));
54548
54567
  };
54549
- return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT
54550
- ? 'contacts-col-12'
54551
- : '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$3, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$1, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton, { className: "edit-icon", size: "small", onClick: toggleEdit, children: jsxRuntimeExports.jsx(default_1$8, {}) }))] }), jsxRuntimeExports.jsx(Box$2, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT
54552
- ? '100%'
54553
- : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
54568
+ 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)
54554
54569
  ? property.type === Contacts.ContactField_type.DATERANGE
54555
54570
  ? (() => {
54556
54571
  if (typeof property.value === 'string') {
@@ -54599,7 +54614,8 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54599
54614
  };
54600
54615
 
54601
54616
  const ContactGeneral = (props) => {
54602
- const { dateFormat, entityData, customContactFields, baseUrl, spaceId, t, currentUser, onEntityUpdated } = props;
54617
+ const { dateFormat, entityData, customContactFields, baseUrl, spaceId, currentUser, onEntityUpdated, } = props;
54618
+ const t = useTranslationContext();
54603
54619
  const { entityType, editEntity } = useEditEntity();
54604
54620
  const api = useEditContactApi();
54605
54621
  if (entityType !== 'contact') {
@@ -54677,9 +54693,9 @@ const ContactGeneral = (props) => {
54677
54693
  };
54678
54694
  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) => ({
54679
54695
  owner: typeof value === 'string' ? value : '',
54680
- }), contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t, 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, t: t, onEntityUpdated: onEntityUpdated }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.createdBy'), value: createdBy || '-', isNotEditable: true, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('contactDetails.modifiedBy'), value: updatedBy || '-', isNotEditable: true, contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t }), jsxRuntimeExports.jsx(ContactInfoLabel, { title: t('global.birthdate'), inputType: "birthday", displayValue: birthDate ? `${dateOnlyString} (${calculateAge(birthDate.toDate())})` : '-', value: birthDate ? birthDate.toISOString() : '', constructUpdateObject: (value) => ({
54696
+ }), 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) => ({
54681
54697
  birthDate: value,
54682
- }), contact: editContact, baseUrl: baseUrl, spaceId: spaceId, contactId: entityData.id, t: t, 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, t: t, onEntityUpdated: onEntityUpdated }, property.nameKey)))] }) }));
54698
+ }), 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)))] }) }));
54683
54699
  };
54684
54700
 
54685
54701
  const BusinessInfoLabel = ({ title, value, isNotEditable, inputType = 'text', options = [], displayValue, constructUpdateObject, baseUrl, spaceId, businessId, onEntityUpdated, }) => {
@@ -54687,7 +54703,8 @@ const BusinessInfoLabel = ({ title, value, isNotEditable, inputType = 'text', op
54687
54703
  };
54688
54704
 
54689
54705
  const BusinessGeneral = (props) => {
54690
- const { entityData, customContactFields, baseUrl, spaceId, t, currentUser, onEntityUpdated } = props;
54706
+ const t = useTranslationContext();
54707
+ const { entityData, customContactFields, baseUrl, spaceId, currentUser, onEntityUpdated } = props;
54691
54708
  const { entityType, editEntity } = useEditEntity();
54692
54709
  const api = useEditContactApi();
54693
54710
  if (entityType !== 'business') {
@@ -54753,7 +54770,7 @@ const BusinessGeneral = (props) => {
54753
54770
  }, [api, entityData, users, currentUser]);
54754
54771
  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) => ({
54755
54772
  owner: typeof value === 'string' ? value : '',
54756
- }), 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, t: t, onEntityUpdated: onEntityUpdated }, property.nameKey)))] }) }));
54773
+ }), 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)))] }) }));
54757
54774
  };
54758
54775
 
54759
54776
  const General = (props) => {
@@ -54766,7 +54783,22 @@ const General = (props) => {
54766
54783
  return normalizedEntityType === 'contact' ? (jsxRuntimeExports.jsx(ContactGeneral, { ...props, entityData: entityData, entityType: "contact" })) : (jsxRuntimeExports.jsx(BusinessGeneral, { ...props, entityData: entityData, entityType: "business" }));
54767
54784
  };
54768
54785
 
54769
- styled$1(Box$2)(({ theme }) => ({
54786
+ // useModal.ts
54787
+ const useEditModal = () => {
54788
+ const [isOpen, setIsOpen] = useState(false);
54789
+ const [title, setTitle] = useState('');
54790
+ const openModal = (title) => {
54791
+ setTitle(title);
54792
+ setIsOpen(true);
54793
+ };
54794
+ const closeModal = () => {
54795
+ setIsOpen(false);
54796
+ setTitle(''); // Clear the title when the modal closes
54797
+ };
54798
+ return { isOpen, title, openModal, closeModal };
54799
+ };
54800
+
54801
+ const StyledBox$2 = styled$1(Box$2)(({ theme }) => ({
54770
54802
  display: 'flex',
54771
54803
  alignItems: 'flex-start',
54772
54804
  justifyContent: 'space-between',
@@ -54779,19 +54811,19 @@ styled$1(Box$2)(({ theme }) => ({
54779
54811
  minHeight: '50px',
54780
54812
  position: 'relative',
54781
54813
  }));
54782
- styled$1(Box$2)(({ theme }) => ({
54814
+ const LeftSection$1 = styled$1(Box$2)(({ theme }) => ({
54783
54815
  display: 'flex',
54784
54816
  alignItems: 'flex-start',
54785
54817
  gap: theme.spacing(1),
54786
54818
  overflow: 'hidden',
54787
54819
  maxWidth: '80%',
54788
54820
  }));
54789
- styled$1(Box$2)(({ theme }) => ({
54821
+ const RightSection$1 = styled$1(Box$2)(({ theme }) => ({
54790
54822
  display: 'flex',
54791
54823
  alignItems: 'center',
54792
54824
  gap: theme.spacing(1),
54793
54825
  }));
54794
- styled$1(Box$2)(({ theme }) => ({
54826
+ const ContactDetails$1 = styled$1(Box$2)(({ theme }) => ({
54795
54827
  display: 'flex',
54796
54828
  flexDirection: 'column',
54797
54829
  alignItems: 'flex-start',
@@ -54801,7 +54833,7 @@ styled$1(Box$2)(({ theme }) => ({
54801
54833
  flexWrap: 'wrap',
54802
54834
  marginTop: '-5px',
54803
54835
  }));
54804
- styled$1(Avatar)(({}) => ({
54836
+ const AvatarWrapper = styled$1(Avatar)(({}) => ({
54805
54837
  width: 32,
54806
54838
  height: 32,
54807
54839
  cursor: 'pointer',
@@ -54813,32 +54845,51 @@ const EllipsisText$1 = styled$1(Box$2)(({}) => ({
54813
54845
  overflow: 'hidden',
54814
54846
  textOverflow: 'ellipsis',
54815
54847
  }));
54816
- styled$1(EllipsisText$1)(({ theme }) => ({
54848
+ const NoteText$1 = styled$1(EllipsisText$1)(({ theme }) => ({
54817
54849
  fontSize: 12,
54818
54850
  color: theme.palette.text.secondary,
54819
54851
  position: 'absolute',
54820
54852
  bottom: 0,
54821
54853
  maxWidth: '70%',
54822
54854
  }));
54823
- styled$1(EllipsisText$1)(({}) => ({
54855
+ const PhoneText$1 = styled$1(EllipsisText$1)(({}) => ({
54824
54856
  fontSize: 14,
54825
54857
  fontWeight: 500,
54826
54858
  }));
54827
- styled$1(EllipsisText$1)(({}) => ({
54859
+ const ProfileNameText = styled$1(EllipsisText$1)(({}) => ({
54828
54860
  fontSize: 14,
54829
54861
  fontWeight: 500,
54830
54862
  }));
54863
+ const ContactMethodItem = ({ item }) => {
54864
+ const avatarUrlWithoutAccess = item.profileUrl;
54865
+ const { imageUrl } = useImage({
54866
+ initialImageUrl: avatarUrlWithoutAccess,
54867
+ });
54868
+ 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: {
54869
+ marginTop: '-10px',
54870
+ marginLeft: '5px',
54871
+ fontSize: '10px',
54872
+ }, children: item.profileName }) }), jsxRuntimeExports.jsx(Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText$1, { children: item.note }) })] }) }), jsxRuntimeExports.jsxs(RightSection$1, { children: [avatarUrlWithoutAccess !== '' && (jsxRuntimeExports.jsx(AvatarWrapper, { src: imageUrl, alt: item.profileName, style: { cursor: 'pointer' }, children: item?.profileName?.charAt(0).toUpperCase() })), jsxRuntimeExports.jsx(Box$2, { sx: {
54873
+ display: 'flex',
54874
+ alignItems: 'center',
54875
+ justifyContent: 'flex-end',
54876
+ }, children: jsxRuntimeExports.jsx(IconButton$2, { size: "small", sx: { marginTop: '-5px', padding: 0 }, children: item.isFavorite ? (jsxRuntimeExports.jsx(Star, { sx: {
54877
+ color: '#fcac34',
54878
+ } })) : (jsxRuntimeExports.jsx(StarBorder, { sx: {
54879
+ color: '#fcac34',
54880
+ } })) }) })] })] }) }));
54881
+ };
54831
54882
 
54832
54883
  var LocalPhone = {};
54833
54884
 
54834
- var _interopRequireDefault = interopRequireDefaultExports;
54885
+ var _interopRequireDefault$7 = interopRequireDefaultExports;
54835
54886
  Object.defineProperty(LocalPhone, "__esModule", {
54836
54887
  value: true
54837
54888
  });
54838
- var default_1 = LocalPhone.default = void 0;
54839
- var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
54840
- var _jsxRuntime = jsxRuntimeExports;
54841
- default_1 = LocalPhone.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
54889
+ var default_1$7 = LocalPhone.default = void 0;
54890
+ var _createSvgIcon$7 = _interopRequireDefault$7(requireCreateSvgIcon());
54891
+ var _jsxRuntime$7 = jsxRuntimeExports;
54892
+ default_1$7 = LocalPhone.default = (0, _createSvgIcon$7.default)( /*#__PURE__*/(0, _jsxRuntime$7.jsx)("path", {
54842
54893
  d: "M6.62 10.79c1.44 2.83 3.76 5.14 6.59 6.59l2.2-2.2c.27-.27.67-.36 1.02-.24 1.12.37 2.33.57 3.57.57.55 0 1 .45 1 1V20c0 .55-.45 1-1 1-9.39 0-17-7.61-17-17 0-.55.45-1 1-1h3.5c.55 0 1 .45 1 1 0 1.25.2 2.45.57 3.57.11.35.03.74-.25 1.02z"
54843
54894
  }), 'LocalPhone');
54844
54895
 
@@ -56052,18 +56103,38 @@ goog.TRUSTED_TYPES_POLICY_NAME="goog";goog.identity_=function(a){return a};
56052
56103
 
56053
56104
  var libphonenumberExports = libphonenumber.exports;
56054
56105
 
56055
- libphonenumberExports.PhoneNumberUtil.getInstance();
56106
+ const phoneUtil = libphonenumberExports.PhoneNumberUtil.getInstance();
56107
+ /**
56108
+ * Returns a user-friendly display format for a sanitized phone number.
56109
+ * Always uses INTERNATIONAL format, e.g. "+54 358 402 2664"
56110
+ */
56111
+ const formatPhoneForDisplay = (number) => {
56112
+ if (!number || !number.trim())
56113
+ return number;
56114
+ try {
56115
+ const parsed = phoneUtil.parse(number, undefined);
56116
+ if (!phoneUtil.isValidNumber(parsed)) {
56117
+ // If not valid, just return as-is
56118
+ return number;
56119
+ }
56120
+ // Always use INTERNATIONAL format
56121
+ return phoneUtil.format(parsed, libphonenumberExports.PhoneNumberFormat.INTERNATIONAL);
56122
+ }
56123
+ catch (e) {
56124
+ return number;
56125
+ }
56126
+ };
56056
56127
 
56057
- styled$1(IconButton$2)(({ theme }) => ({
56128
+ const StyledIconButton$1 = styled$1(IconButton$2)(({ theme }) => ({
56058
56129
  padding: theme.spacing(0.5),
56059
56130
  marginTop: '-5px',
56060
56131
  }));
56061
- styled$1(default_1)(({ theme }) => ({
56132
+ const StyledLocalPhoneIcon = styled$1(default_1$7)(({ theme }) => ({
56062
56133
  height: 16,
56063
56134
  width: 16,
56064
56135
  color: theme.palette.secondary.main
56065
56136
  }));
56066
- styled$1(Box$2)(({ theme }) => ({
56137
+ const StyledBox$1 = styled$1(Box$2)(({ theme }) => ({
56067
56138
  display: 'flex',
56068
56139
  alignItems: 'flex-start',
56069
56140
  justifyContent: 'space-between',
@@ -56076,18 +56147,18 @@ styled$1(Box$2)(({ theme }) => ({
56076
56147
  minHeight: '50px',
56077
56148
  position: 'relative',
56078
56149
  }));
56079
- styled$1(Box$2)(({ theme }) => ({
56150
+ const LeftSection = styled$1(Box$2)(({ theme }) => ({
56080
56151
  display: 'flex',
56081
56152
  alignItems: 'flex-start',
56082
56153
  gap: theme.spacing(1),
56083
56154
  maxWidth: '80%',
56084
56155
  }));
56085
- styled$1(Box$2)(({ theme }) => ({
56156
+ const RightSection = styled$1(Box$2)(({ theme }) => ({
56086
56157
  display: 'flex',
56087
56158
  alignItems: 'center',
56088
56159
  gap: theme.spacing(1),
56089
56160
  }));
56090
- styled$1(Box$2)(({ theme }) => ({
56161
+ const ContactDetails = styled$1(Box$2)(({ theme }) => ({
56091
56162
  display: 'flex',
56092
56163
  flexDirection: 'column',
56093
56164
  alignItems: 'flex-start',
@@ -56104,19 +56175,40 @@ const EllipsisText = styled$1(Box$2)(({}) => ({
56104
56175
  overflow: 'hidden',
56105
56176
  textOverflow: 'ellipsis',
56106
56177
  }));
56107
- styled$1(EllipsisText)(({ theme }) => ({
56178
+ const NoteText = styled$1(EllipsisText)(({ theme }) => ({
56108
56179
  fontSize: 12,
56109
56180
  color: theme.palette.text.secondary,
56110
56181
  position: 'absolute',
56111
56182
  bottom: 0,
56112
56183
  maxWidth: '70%',
56113
56184
  }));
56114
- styled$1(EllipsisText)(({}) => ({
56185
+ const PhoneText = styled$1(EllipsisText)(({}) => ({
56115
56186
  fontSize: 14,
56116
56187
  fontWeight: 500,
56117
56188
  }));
56189
+ const ContactMethodPhoneItem = ({ item }) => {
56190
+ const handleCallContact = () => {
56191
+ const contactPhone = item.address;
56192
+ if (!contactPhone)
56193
+ return;
56194
+ const event = new CustomEvent('call-contact-header', {
56195
+ detail: { phoneAddress: contactPhone },
56196
+ });
56197
+ window.dispatchEvent(event);
56198
+ };
56199
+ const formattedPhone = useMemo(() => formatPhoneForDisplay(item.address || ''), [item.address]);
56200
+ 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: {
56201
+ display: 'flex',
56202
+ alignItems: 'center',
56203
+ justifyContent: 'flex-end',
56204
+ }, children: jsxRuntimeExports.jsx(IconButton$2, { size: "small", sx: { marginTop: '-5px', padding: 0 }, children: item.isFavorite ? (jsxRuntimeExports.jsx(Star, { sx: {
56205
+ color: '#fcac34',
56206
+ } })) : (jsxRuntimeExports.jsx(StarBorder, { sx: {
56207
+ color: '#fcac34',
56208
+ } })) }) }) })] }) }));
56209
+ };
56118
56210
 
56119
- styled$1(Box$2)(({ theme }) => ({
56211
+ const StyledBox = styled$1(Box$2)(({ theme }) => ({
56120
56212
  display: 'flex',
56121
56213
  flexDirection: 'column',
56122
56214
  padding: theme.spacing(1, 0, 2, 0),
@@ -56126,22 +56218,22 @@ styled$1(Box$2)(({ theme }) => ({
56126
56218
  opacity: 1,
56127
56219
  },
56128
56220
  }));
56129
- styled$1(Typography$2)(({ theme }) => ({
56221
+ const StyledTypography = styled$1(Typography$2)(({}) => ({
56130
56222
  letterSpacing: -0.5,
56131
56223
  fontSize: 14,
56132
56224
  fontWeight: 600,
56133
56225
  }));
56134
- styled$1(Box$2)(({ theme }) => ({
56226
+ const HeaderBox = styled$1(Box$2)(({}) => ({
56135
56227
  display: 'flex',
56136
56228
  alignItems: 'center',
56137
56229
  }));
56138
- styled$1(Box$2)(({ theme }) => ({
56230
+ const MethodItemsBox = styled$1(Box$2)(({ theme }) => ({
56139
56231
  display: 'flex',
56140
56232
  flexDirection: 'column',
56141
56233
  gap: theme.spacing(1),
56142
56234
  width: '100%',
56143
56235
  }));
56144
- styled$1(IconButton$2)({
56236
+ const StyledIconButton = styled$1(IconButton$2)({
56145
56237
  opacity: 0,
56146
56238
  transition: 'opacity 0.3s ease-in-out',
56147
56239
  '& .MuiSvgIcon-root': {
@@ -56150,8 +56242,669 @@ styled$1(IconButton$2)({
56150
56242
  },
56151
56243
  marginLeft: '15px',
56152
56244
  });
56245
+ const ContactMethod = ({ title, methodItems, isPhone, handleEdit, owner }) => {
56246
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: 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" }) })] }), jsxRuntimeExports.jsx(MethodItemsBox, { children: methodItems.map((item, index) => {
56247
+ if (isPhone) {
56248
+ return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56249
+ }
56250
+ return jsxRuntimeExports.jsx(ContactMethodItem, { item: item, owner: owner }, index);
56251
+ }) })] }) }));
56252
+ };
56253
+
56254
+ const SubsectionHeader = ({ title }) => {
56255
+ return (jsxRuntimeExports.jsx(Box$2, { children: jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle2", children: title }) }));
56256
+ };
56257
+
56258
+ const subsectionHeaderWithButtonStyle = {
56259
+ container: {
56260
+ display: 'flex',
56261
+ justifyContent: 'space-between',
56262
+ alignItems: 'center'
56263
+ },
56264
+ };
56265
+
56266
+ var Add = {};
56267
+
56268
+ var _interopRequireDefault$6 = interopRequireDefaultExports;
56269
+ Object.defineProperty(Add, "__esModule", {
56270
+ value: true
56271
+ });
56272
+ var default_1$6 = Add.default = void 0;
56273
+ var _createSvgIcon$6 = _interopRequireDefault$6(requireCreateSvgIcon());
56274
+ var _jsxRuntime$6 = jsxRuntimeExports;
56275
+ default_1$6 = Add.default = (0, _createSvgIcon$6.default)( /*#__PURE__*/(0, _jsxRuntime$6.jsx)("path", {
56276
+ d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"
56277
+ }), 'Add');
56278
+
56279
+ const SubsectionHeaderWithButton = ({ title, handleAdd, t }) => {
56280
+ const tFromContext = useTranslationContext();
56281
+ const translate = t || tFromContext;
56282
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: subsectionHeaderWithButtonStyle.container, children: [jsxRuntimeExports.jsx(Typography$2, { variant: "subtitle2", children: title }), jsxRuntimeExports.jsx(Button$2, { onClick: handleAdd, size: "small", startIcon: jsxRuntimeExports.jsx(default_1$6, {}), variant: "text", color: "primary", children: translate('global.add') })] }));
56283
+ };
56284
+
56285
+ const informationItemContainerStyle = {
56286
+ container: {
56287
+ border: '1px solid lightgray',
56288
+ borderRadius: 1,
56289
+ p: 2,
56290
+ width: '100%',
56291
+ display: 'flex',
56292
+ flexDirection: 'column',
56293
+ gap: 1,
56294
+ },
56295
+ };
56296
+
56297
+ const InformationItemContainer = ({ children }) => {
56298
+ return jsxRuntimeExports.jsx(Box$2, { sx: informationItemContainerStyle.container, children: children });
56299
+ };
56300
+
56301
+ const noteDeleteButtonStyle = {
56302
+ container: {
56303
+ display: 'flex',
56304
+ width: '50%',
56305
+ alignItems: 'center',
56306
+ justifyContent: 'end'
56307
+ },
56308
+ noteTextField: {
56309
+ width: '100%',
56310
+ marginRight: '15px'
56311
+ },
56312
+ };
56313
+
56314
+ var MoreVert = {};
56315
+
56316
+ var _interopRequireDefault$5 = interopRequireDefaultExports;
56317
+ Object.defineProperty(MoreVert, "__esModule", {
56318
+ value: true
56319
+ });
56320
+ var default_1$5 = MoreVert.default = void 0;
56321
+ var _createSvgIcon$5 = _interopRequireDefault$5(requireCreateSvgIcon());
56322
+ var _jsxRuntime$5 = jsxRuntimeExports;
56323
+ default_1$5 = MoreVert.default = (0, _createSvgIcon$5.default)( /*#__PURE__*/(0, _jsxRuntime$5.jsx)("path", {
56324
+ d: "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2m0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2m0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2"
56325
+ }), 'MoreVert');
56326
+
56327
+ var WhatsApp = {};
56328
+
56329
+ var _interopRequireDefault$4 = interopRequireDefaultExports;
56330
+ Object.defineProperty(WhatsApp, "__esModule", {
56331
+ value: true
56332
+ });
56333
+ var default_1$4 = WhatsApp.default = void 0;
56334
+ _interopRequireWildcard(React__default);
56335
+ var _createSvgIcon$4 = _interopRequireDefault$4(requireCreateSvgIcon());
56336
+ var _jsxRuntime$4 = jsxRuntimeExports;
56337
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
56338
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
56339
+ default_1$4 = WhatsApp.default = (0, _createSvgIcon$4.default)( /*#__PURE__*/(0, _jsxRuntime$4.jsx)("path", {
56340
+ d: "M16.75 13.96c.25.13.41.2.46.3.06.11.04.61-.21 1.18-.2.56-1.24 1.1-1.7 1.12-.46.02-.47.36-2.96-.73-2.49-1.09-3.99-3.75-4.11-3.92-.12-.17-.96-1.38-.92-2.61.05-1.22.69-1.8.95-2.04.24-.26.51-.29.68-.26h.47c.15 0 .36-.06.55.45l.69 1.87c.06.13.1.28.01.44l-.27.41-.39.42c-.12.12-.26.25-.12.5.12.26.62 1.09 1.32 1.78.91.88 1.71 1.17 1.95 1.3.24.14.39.12.54-.04l.81-.94c.19-.25.35-.19.58-.11l1.67.88M12 2a10 10 0 0 1 10 10 10 10 0 0 1-10 10c-1.97 0-3.8-.57-5.35-1.55L2 22l1.55-4.65A9.969 9.969 0 0 1 2 12 10 10 0 0 1 12 2m0 2a8 8 0 0 0-8 8c0 1.72.54 3.31 1.46 4.61L4.5 19.5l2.89-.96A7.95 7.95 0 0 0 12 20a8 8 0 0 0 8-8 8 8 0 0 0-8-8z"
56341
+ }), 'WhatsApp');
56342
+
56343
+ var Mms = {};
56344
+
56345
+ var _interopRequireDefault$3 = interopRequireDefaultExports;
56346
+ Object.defineProperty(Mms, "__esModule", {
56347
+ value: true
56348
+ });
56349
+ var default_1$3 = Mms.default = void 0;
56350
+ var _createSvgIcon$3 = _interopRequireDefault$3(requireCreateSvgIcon());
56351
+ var _jsxRuntime$3 = jsxRuntimeExports;
56352
+ default_1$3 = Mms.default = (0, _createSvgIcon$3.default)( /*#__PURE__*/(0, _jsxRuntime$3.jsx)("path", {
56353
+ d: "M20 2H4c-1.1 0-1.99.9-1.99 2L2 22l4-4h14c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2M5 14l3.5-4.5 2.5 3.01L14.5 8l4.5 6z"
56354
+ }), 'Mms');
56355
+
56356
+ const OptionsMenu = ({ onDelete, addressData, handleLinkAccountSave, checked, onCheckContactAddress, }) => {
56357
+ const t = useTranslationContext();
56358
+ const [anchorEl, setAnchorEl] = useState(null);
56359
+ const open = Boolean(anchorEl);
56360
+ const { channelType, address } = addressData;
56361
+ const [verifying, setVerifying] = useState(false);
56362
+ const [verificationResult, setVerificationResult] = useState(null);
56363
+ const [modalOpen, setModalOpen] = useState(false);
56364
+ const handleClick = (event) => {
56365
+ setAnchorEl(event.currentTarget);
56366
+ };
56367
+ const handleClose = () => {
56368
+ setAnchorEl(null);
56369
+ };
56370
+ const handleModalClose = () => {
56371
+ setModalOpen(false);
56372
+ };
56373
+ const handleDelete = () => {
56374
+ onDelete();
56375
+ handleClose();
56376
+ };
56377
+ const handleCheckWA = async () => {
56378
+ setVerifying(true);
56379
+ try {
56380
+ if (!onCheckContactAddress) {
56381
+ return;
56382
+ }
56383
+ const result = await onCheckContactAddress(13);
56384
+ if (!result) {
56385
+ return;
56386
+ }
56387
+ setVerificationResult(result);
56388
+ setModalOpen(true);
56389
+ }
56390
+ catch (error) {
56391
+ console.error('Error verifying WhatsApp account:', error);
56392
+ }
56393
+ finally {
56394
+ setVerifying(false);
56395
+ }
56396
+ handleClose();
56397
+ };
56398
+ const handleCheckRCS = async () => {
56399
+ setVerifying(true);
56400
+ try {
56401
+ if (!onCheckContactAddress) {
56402
+ return;
56403
+ }
56404
+ const result = await onCheckContactAddress(21);
56405
+ if (!result) {
56406
+ return;
56407
+ }
56408
+ setVerificationResult(result);
56409
+ setModalOpen(true);
56410
+ }
56411
+ catch (error) {
56412
+ console.error('Error verifying RCS account:', error);
56413
+ }
56414
+ finally {
56415
+ setVerifying(false);
56416
+ }
56417
+ handleClose();
56418
+ };
56419
+ const handleLinkAccount = async () => {
56420
+ await handleLinkAccountSave();
56421
+ setModalOpen(false);
56422
+ };
56423
+ return (jsxRuntimeExports.jsxs(Box$2, { children: [jsxRuntimeExports.jsx(IconButton$2, { "aria-controls": open ? 'basic-menu' : undefined, "aria-haspopup": "true", "aria-expanded": open ? 'true' : undefined, onClick: handleClick, children: jsxRuntimeExports.jsx(default_1$5, {}) }), jsxRuntimeExports.jsxs(Menu$2, { id: "basic-menu", anchorEl: anchorEl, open: open, onClose: handleClose, MenuListProps: {
56424
+ 'aria-labelledby': 'basic-button',
56425
+ }, children: [jsxRuntimeExports.jsxs(MenuItem$2, { onClick: handleDelete, children: [jsxRuntimeExports.jsx(ListItemIcon, { children: jsxRuntimeExports.jsx(default_1$d, { color: "error" }) }), jsxRuntimeExports.jsx(ListItemText, { children: t('global.delete') })] }), channelType === 5 && (jsxRuntimeExports.jsxs(MenuItem$2, { onClick: handleCheckWA, disabled: !checked, children: [jsxRuntimeExports.jsx(ListItemIcon, { children: verifying ? (jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 })) : (jsxRuntimeExports.jsx(default_1$4, { sx: { color: 'green' } })) }), jsxRuntimeExports.jsx(ListItemText, { children: t('optionsMenu.verifyWspAccount') })] })), channelType === 21 && (jsxRuntimeExports.jsxs(MenuItem$2, { onClick: handleCheckRCS, disabled: !checked, children: [jsxRuntimeExports.jsx(ListItemIcon, { children: verifying ? jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) : jsxRuntimeExports.jsx(default_1$3, {}) }), jsxRuntimeExports.jsx(ListItemText, { children: t('optionsMenu.verifyRCSAccount') })] }))] }), jsxRuntimeExports.jsx(Modal$2, { open: modalOpen, onClose: handleModalClose, "aria-labelledby": "modal-modal-title", "aria-describedby": "modal-modal-description", children: jsxRuntimeExports.jsx(Box$2, { sx: {
56426
+ position: 'absolute',
56427
+ top: '50%',
56428
+ left: '50%',
56429
+ transform: 'translate(-50%, -50%)',
56430
+ width: 400,
56431
+ boxShadow: 24,
56432
+ p: 4,
56433
+ backgroundColor: (theme) => theme.palette.background.default,
56434
+ }, children: verificationResult?.success ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(Typography$2, { id: "modal-modal-title", variant: "h6", component: "h2", children: [t('optionsMenu.wspAccountFound'), " ", address] }), jsxRuntimeExports.jsx(Typography$2, { id: "modal-modal-description", sx: { mt: 2 }, children: t('optionsMenu.wantToLinkContact') }), jsxRuntimeExports.jsxs(Box$2, { sx: { marginTop: '10px' }, children: [jsxRuntimeExports.jsx(Button$2, { onClick: handleLinkAccount, color: "primary", children: t('optionsMenu.yesLink') }), jsxRuntimeExports.jsx(Button$2, { onClick: handleModalClose, color: "secondary", children: "No" })] })] })) : (jsxRuntimeExports.jsxs(Box$2, { sx: { position: 'relative' }, children: [jsxRuntimeExports.jsxs(Typography$2, { id: "modal-modal-title", variant: "h6", component: "h2", children: [t('optionsMenu.noWspAccountFound'), " ", address] }), jsxRuntimeExports.jsx(Button$2, { onClick: handleModalClose, color: "secondary", sx: { position: 'absolute', bottom: -25, right: 0 }, children: t('global.cancel') })] })) }) })] }));
56435
+ };
56436
+
56437
+ const NoteDeleteButton = (props) => {
56438
+ const t = useTranslationContext();
56439
+ const api = useEditContactApi();
56440
+ const { editEntity, entityId: entityIdFromContext } = useEditEntity();
56441
+ const [isSaving, setIsSaving] = useState(false);
56442
+ const checked = props.checked ?? true;
56443
+ const entityId = props.entityId ?? entityIdFromContext;
56444
+ const { note, channelType, id, address } = props.addressData;
56445
+ const addressIsSaved = !props.addressData.hasOwnProperty('isSaved');
56446
+ const replaceAddress = props.replaceAddress ?? editEntity.action.replaceAddress;
56447
+ const addWhatsappVerified = props.addWhatsappVerified ||
56448
+ (typeof editEntity.action?.addWhatsappVerified === 'function'
56449
+ ? editEntity.action.addWhatsappVerified
56450
+ : undefined);
56451
+ const handleSetAddress = async (type) => {
56452
+ if (!api)
56453
+ return null;
56454
+ if (!entityId)
56455
+ return null;
56456
+ const newAddress = await api.setContactAddress({
56457
+ data: {
56458
+ address,
56459
+ contactId: entityId,
56460
+ type,
56461
+ },
56462
+ });
56463
+ replaceAddress(id, newAddress);
56464
+ return newAddress;
56465
+ };
56466
+ const handleUpdateAddress = async () => {
56467
+ if (!api)
56468
+ return;
56469
+ if (!entityId)
56470
+ return;
56471
+ const updated = await api.updateContactAddress({
56472
+ data: {
56473
+ contactAddressId: id,
56474
+ contactId: entityId,
56475
+ note: note ?? '',
56476
+ },
56477
+ });
56478
+ replaceAddress(id, updated);
56479
+ };
56480
+ const handleSave = async () => {
56481
+ setIsSaving(true);
56482
+ if (addressIsSaved) {
56483
+ await handleUpdateAddress();
56484
+ setIsSaving(false);
56485
+ }
56486
+ else {
56487
+ const newAddress = await handleSetAddress(channelType);
56488
+ if (newAddress)
56489
+ setIsSaving(false);
56490
+ }
56491
+ };
56492
+ const handleLinkAccountSave = async () => {
56493
+ setIsSaving(true);
56494
+ const newAddress = await handleSetAddress(13);
56495
+ if (newAddress && addWhatsappVerified) {
56496
+ addWhatsappVerified(newAddress);
56497
+ }
56498
+ if (newAddress)
56499
+ setIsSaving(false);
56500
+ };
56501
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: {
56502
+ ...noteDeleteButtonStyle.container,
56503
+ }, children: [addressIsSaved && (jsxRuntimeExports.jsx(TextField$1, { size: "small", label: t('global.note'), variant: "outlined", onChange: (e) => props.handleNoteFieldChange(e, id, channelType), value: note, fullWidth: true, InputLabelProps: {
56504
+ shrink: true,
56505
+ }, className: "contacts-smallInput", sx: noteDeleteButtonStyle.noteTextField })), jsxRuntimeExports.jsx(IconButton$2, { onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(CircularProgress$2, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, { color: "primary" }) }), jsxRuntimeExports.jsx(OptionsMenu, { onDelete: () => props.handleDeleteAddress(id, channelType), addressData: props.addressData, handleLinkAccountSave: handleLinkAccountSave, checked: checked && !isSaving, onCheckContactAddress: async (type) => {
56506
+ if (!api)
56507
+ return null;
56508
+ try {
56509
+ return await api.checkContactAddress({
56510
+ data: {
56511
+ address,
56512
+ type,
56513
+ },
56514
+ });
56515
+ }
56516
+ catch {
56517
+ return null;
56518
+ }
56519
+ } })] }));
56520
+ };
56521
+
56522
+ const informationItemInputsContainerStyle = {
56523
+ container: {
56524
+ display: 'flex',
56525
+ gap: '100px',
56526
+ alignItems: 'center',
56527
+ },
56528
+ };
56529
+
56530
+ const InformationItemInputsContainer = ({ children }) => {
56531
+ return jsxRuntimeExports.jsx(Box$2, { sx: informationItemInputsContainerStyle.container, children: children });
56532
+ };
56533
+
56534
+ const subsectionBodyContainerStyle = {
56535
+ container: {
56536
+ width: '100%',
56537
+ borderRadius: 1,
56538
+ px: 1.5,
56539
+ py: 2,
56540
+ display: 'flex',
56541
+ flexDirection: 'column',
56542
+ gap: 2,
56543
+ overflow: 'auto',
56544
+ maxHeight: 'calc(100vh - 250px)',
56545
+ },
56546
+ };
56547
+
56548
+ const SubsectionBodyContainer = ({ children }) => {
56549
+ return (jsxRuntimeExports.jsx(Box$2, { sx: {
56550
+ ...subsectionBodyContainerStyle.container,
56551
+ }, children: children }));
56552
+ };
56553
+
56554
+ var CheckRounded = {};
56555
+
56556
+ var _interopRequireDefault$2 = interopRequireDefaultExports;
56557
+ Object.defineProperty(CheckRounded, "__esModule", {
56558
+ value: true
56559
+ });
56560
+ var default_1$2 = CheckRounded.default = void 0;
56561
+ var _createSvgIcon$2 = _interopRequireDefault$2(requireCreateSvgIcon());
56562
+ var _jsxRuntime$2 = jsxRuntimeExports;
56563
+ default_1$2 = CheckRounded.default = (0, _createSvgIcon$2.default)( /*#__PURE__*/(0, _jsxRuntime$2.jsx)("path", {
56564
+ d: "M9 16.17 5.53 12.7a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41l4.18 4.18c.39.39 1.02.39 1.41 0L20.29 7.71c.39-.39.39-1.02 0-1.41a.9959.9959 0 0 0-1.41 0z"
56565
+ }), 'CheckRounded');
56566
+
56567
+ var CloseRounded = {};
56568
+
56569
+ var _interopRequireDefault$1 = interopRequireDefaultExports;
56570
+ Object.defineProperty(CloseRounded, "__esModule", {
56571
+ value: true
56572
+ });
56573
+ var default_1$1 = CloseRounded.default = void 0;
56574
+ var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
56575
+ var _jsxRuntime$1 = jsxRuntimeExports;
56576
+ default_1$1 = CloseRounded.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
56577
+ d: "M18.3 5.71a.9959.9959 0 0 0-1.41 0L12 10.59 7.11 5.7a.9959.9959 0 0 0-1.41 0c-.39.39-.39 1.02 0 1.41L10.59 12 5.7 16.89c-.39.39-.39 1.02 0 1.41.39.39 1.02.39 1.41 0L12 13.41l4.89 4.89c.39.39 1.02.39 1.41 0 .39-.39.39-1.02 0-1.41L13.41 12l4.89-4.89c.38-.38.38-1.02 0-1.4"
56578
+ }), 'CloseRounded');
56579
+
56580
+ const Adornment = ({ status }) => {
56581
+ switch (status) {
56582
+ case 'idle':
56583
+ return null;
56584
+ case 'loading':
56585
+ return jsxRuntimeExports.jsx(CircularProgress$1, { size: 20 });
56586
+ case 'available':
56587
+ return jsxRuntimeExports.jsx(default_1$2, { style: { height: 27, width: 27 }, color: "success" });
56588
+ case 'unavailable':
56589
+ return jsxRuntimeExports.jsx(default_1$1, { style: { height: 27, width: 27 }, color: "error" });
56590
+ default:
56591
+ return null;
56592
+ }
56593
+ };
56153
56594
 
56154
- styled$1(Box$2)(({ theme }) => ({
56595
+ const StatusAdornment = ({ status, text }) => {
56596
+ const textAdornment = text ? (jsxRuntimeExports.jsx(Typography$1, { marginRight: 0.5, children: text })) : null;
56597
+ return (jsxRuntimeExports.jsxs(InputAdornment$1, { position: "end", children: [textAdornment, jsxRuntimeExports.jsx("div", { style: { width: 30, display: 'flex', justifyContent: 'center' }, children: jsxRuntimeExports.jsx(Adornment, { status: status }) })] }));
56598
+ };
56599
+
56600
+ const imsStyle = {
56601
+ code: {
56602
+ width: '60%',
56603
+ color: 'gray',
56604
+ },
56605
+ };
56606
+
56607
+ const Ims = ({ data, editEntity }) => {
56608
+ const editActions = editEntity.action;
56609
+ return (jsxRuntimeExports.jsx(InformationItemContainer, { children: jsxRuntimeExports.jsxs(InformationItemInputsContainer, { children: [jsxRuntimeExports.jsx(Typography$2, { sx: imsStyle.code, variant: "body2", children: data.address }), jsxRuntimeExports.jsx(NoteDeleteButton, { addressData: data, handleNoteFieldChange: editActions.handleNoteFieldChange, handleDeleteAddress: editActions.handleDeleteAddress })] }) }));
56610
+ };
56611
+
56612
+ const Body$4 = ({ IMSs, editEntity }) => {
56613
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { children: IMSs?.map((ims) => (jsxRuntimeExports.jsx(Ims, { data: ims, editEntity: editEntity }, ims.id))) }));
56614
+ };
56615
+
56616
+ const InformationSocialNetworkItem = ({ editEntity, title, IMSs }) => {
56617
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeader, { title: title }), jsxRuntimeExports.jsx(Body$4, { IMSs: IMSs, editEntity: editEntity })] }));
56618
+ };
56619
+
56620
+ const style$2 = {
56621
+ addressField: {
56622
+ // width: '35%',
56623
+ },
56624
+ };
56625
+
56626
+ const AddressInput = ({ data, onChange, setWarnings }) => {
56627
+ const { id, channelType, address } = data;
56628
+ const t = useTranslationContext();
56629
+ const api = useEditContactApi();
56630
+ const [adornmentStatus, setAdornmentStatus] = useState('idle');
56631
+ const [lastSearch, setLastSearch] = useState(address);
56632
+ const addressIsSaved = !data.hasOwnProperty('isSaved');
56633
+ useEffect(() => {
56634
+ let timer = setTimeout(async () => {
56635
+ if (address !== '' && address !== lastSearch) {
56636
+ if (!api) {
56637
+ return;
56638
+ }
56639
+ setAdornmentStatus('loading');
56640
+ setLastSearch(address);
56641
+ const checkContactAddressData = {
56642
+ address,
56643
+ type: channelType,
56644
+ };
56645
+ try {
56646
+ const response = await api.checkContactAddress({ data: checkContactAddressData });
56647
+ const { success, warnings } = response;
56648
+ setWarnings(warnings);
56649
+ success ? setAdornmentStatus('available') : setAdornmentStatus('unavailable');
56650
+ }
56651
+ catch {
56652
+ setWarnings([]);
56653
+ setAdornmentStatus('unavailable');
56654
+ }
56655
+ }
56656
+ }, 1700);
56657
+ return () => clearTimeout(timer);
56658
+ }, [api, data, address, channelType, lastSearch, setWarnings]);
56659
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(TextField$1, { disabled: addressIsSaved, sx: style$2.addressField, size: "small", label: channelType === Channels.ChannelType.WHATSAPP || channelType === Channels.ChannelType.RCS
56660
+ ? t
56661
+ ? t('global.number')
56662
+ : 'Number'
56663
+ : t
56664
+ ? t('global.email')
56665
+ : 'Email', value: address, onChange: (e) => {
56666
+ onChange(e, id, channelType);
56667
+ }, variant: "outlined", fullWidth: true, InputLabelProps: {
56668
+ shrink: true,
56669
+ }, className: "contacts-smallInput", InputProps: {
56670
+ endAdornment: (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(StatusAdornment, { status: adornmentStatus }) })),
56671
+ } }) }));
56672
+ };
56673
+
56674
+ const style$1 = {
56675
+ addressField: {
56676
+ // width: '35%',
56677
+ },
56678
+ };
56679
+
56680
+ const PhoneInput = ({ data, onChange, setWarnings }) => {
56681
+ const api = useEditContactApi();
56682
+ const t = useTranslationContext();
56683
+ const { id, channelType, address } = data;
56684
+ const [adornmentStatus, setAdornmentStatus] = useState('idle');
56685
+ const [lastSearch, setLastSearch] = useState(address);
56686
+ const addressIsSaved = !data.hasOwnProperty('isSaved');
56687
+ useEffect(() => {
56688
+ let timer = setTimeout(async () => {
56689
+ if (address !== '' && address !== lastSearch) {
56690
+ if (!api) {
56691
+ return;
56692
+ }
56693
+ setAdornmentStatus('loading');
56694
+ setLastSearch(address);
56695
+ const checkContactAddressData = {
56696
+ address,
56697
+ type: channelType,
56698
+ };
56699
+ try {
56700
+ const { success, warnings } = await api.checkContactAddress({
56701
+ data: checkContactAddressData,
56702
+ });
56703
+ setWarnings(warnings);
56704
+ success ? setAdornmentStatus('available') : setAdornmentStatus('unavailable');
56705
+ }
56706
+ catch {
56707
+ setWarnings([]);
56708
+ setAdornmentStatus('unavailable');
56709
+ }
56710
+ }
56711
+ }, 1700);
56712
+ return () => clearTimeout(timer);
56713
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56714
+ }, [data]);
56715
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(TextField$1, { disabled: addressIsSaved, sx: style$1.addressField, size: "small", label: t('global.number'), value: address, onChange: (e) => {
56716
+ onChange(e, id, channelType);
56717
+ }, variant: "outlined", fullWidth: true, InputLabelProps: {
56718
+ shrink: true,
56719
+ }, className: "contacts-smallInput", InputProps: {
56720
+ endAdornment: (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(StatusAdornment, { status: adornmentStatus }) })),
56721
+ } }) }));
56722
+ };
56723
+
56724
+ const style = {
56725
+ secondaryContainer: {
56726
+ display: 'flex',
56727
+ alignItems: 'baseline',
56728
+ height: '100%',
56729
+ gap: 0.5,
56730
+ },
56731
+ icon: { height: 15 },
56732
+ chip: {
56733
+ borderRadius: '6px',
56734
+ height: '22px'
56735
+ }
56736
+ };
56737
+
56738
+ var Warning$1 = {};
56739
+
56740
+ var _interopRequireDefault = interopRequireDefaultExports;
56741
+ Object.defineProperty(Warning$1, "__esModule", {
56742
+ value: true
56743
+ });
56744
+ var default_1 = Warning$1.default = void 0;
56745
+ var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
56746
+ var _jsxRuntime = jsxRuntimeExports;
56747
+ default_1 = Warning$1.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
56748
+ d: "M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"
56749
+ }), 'Warning');
56750
+
56751
+ const Warning = ({ text }) => {
56752
+ return (jsxRuntimeExports.jsx(Grid, { item: true, children: jsxRuntimeExports.jsx(Box$2, { sx: style.secondaryContainer, children: jsxRuntimeExports.jsx(Chip$1, { icon: jsxRuntimeExports.jsx(default_1, { sx: style.icon }), sx: style.chip, label: text, color: "error", variant: 'outlined' }) }) }));
56753
+ };
56754
+
56755
+ const WarningsDisplay = ({ warnings }) => {
56756
+ const t = useTranslationContext();
56757
+ return (jsxRuntimeExports.jsx(Box$2, { children: jsxRuntimeExports.jsx(Grid, { container: true, children: warnings?.map((warning, i) => (jsxRuntimeExports.jsx(Warning, { text: t(`contactAddressError.${warning}`) }, i))) }) }));
56758
+ };
56759
+
56760
+ const phoneStyle = {
56761
+ numberCountryContainer: {
56762
+ display: 'flex',
56763
+ justifyContent: 'flex-start',
56764
+ width: '50%',
56765
+ },
56766
+ warningMessage: {
56767
+ // position: "absolute",
56768
+ // bottom: "-30px",
56769
+ marginTop: "10px"
56770
+ },
56771
+ adressInputBox: {
56772
+ position: "relative",
56773
+ width: "45%"
56774
+ }
56775
+ };
56776
+
56777
+ const Phone = ({ data }) => {
56778
+ const mode = 'edit';
56779
+ const { editEntity } = useEditEntity();
56780
+ const editEntityActions = editEntity.action;
56781
+ const editEntityState = editEntity.state;
56782
+ const [warnings, setWarnings] = useState([]);
56783
+ const [checked, setChecked] = useState(true);
56784
+ useEffect(() => {
56785
+ setChecked(warnings.length === 0 && (data.address ?? '') !== '');
56786
+ }, [warnings, data.address]);
56787
+ return (jsxRuntimeExports.jsx(InformationItemContainer, { children: jsxRuntimeExports.jsxs(InformationItemInputsContainer, { children: [jsxRuntimeExports.jsxs(Box$2, { sx: { ...phoneStyle.numberCountryContainer, flexDirection: 'column' }, children: [jsxRuntimeExports.jsx(PhoneInput, { data: data, setWarnings: setWarnings, onChange: editEntityActions.handleAddressFieldChange }), warnings.length > 0 && jsxRuntimeExports.jsx(WarningsDisplay, { warnings: warnings })] }), jsxRuntimeExports.jsx(NoteDeleteButton, { mode: mode, addressData: data, handleNoteFieldChange: editEntityActions.handleNoteFieldChange, handleDeleteAddress: editEntityActions.handleDeleteAddress, isDeletingAddress: editEntityState.isDeletingAddress, replaceAddress: editEntityActions.replaceAddress, addWhatsappVerified: editEntityActions.addWhatsappVerified, checked: checked })] }) }));
56788
+ };
56789
+
56790
+ const Body$3 = ({ phoneNumbers }) => {
56791
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: phoneNumbers?.map((phone) => (jsxRuntimeExports.jsx(Phone, { data: phone }, phone.id))) }));
56792
+ };
56793
+
56794
+ const Phones = ({ phoneNumbers, handleAdd }) => {
56795
+ const t = useTranslationContext();
56796
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: t('global.phones') }), jsxRuntimeExports.jsx(Body$3, { phoneNumbers: phoneNumbers })] }));
56797
+ };
56798
+
56799
+ const mailStyle$2 = {
56800
+ emailField: {
56801
+ width: '60%',
56802
+ },
56803
+ numberCountryContainer: {
56804
+ display: 'flex',
56805
+ justifyContent: 'flex-start',
56806
+ width: '50%',
56807
+ },
56808
+ warningMessage: {
56809
+ position: "absolute",
56810
+ bottom: "-30px"
56811
+ },
56812
+ adressInputBox: {
56813
+ position: "relative",
56814
+ width: "60%"
56815
+ }
56816
+ };
56817
+
56818
+ const Mail = ({ data }) => {
56819
+ const mode = 'edit';
56820
+ const { editEntity } = useEditEntity();
56821
+ const editEntityActions = editEntity.action;
56822
+ const editEntityState = editEntity.state;
56823
+ const [warnings, setWarnings] = useState([]);
56824
+ return (jsxRuntimeExports.jsxs(InformationItemContainer, { children: [jsxRuntimeExports.jsxs(InformationItemInputsContainer, { children: [jsxRuntimeExports.jsx(Box$2, { sx: mailStyle$2.numberCountryContainer, children: jsxRuntimeExports.jsx(Box$2, { sx: mailStyle$2.adressInputBox, children: jsxRuntimeExports.jsx(AddressInput, { data: data, setWarnings: setWarnings, onChange: editEntityActions.handleAddressFieldChange }) }) }), jsxRuntimeExports.jsx(NoteDeleteButton, { mode: mode, addressData: data, handleNoteFieldChange: editEntityActions.handleNoteFieldChange, handleDeleteAddress: editEntityActions.handleDeleteAddress, isDeletingAddress: editEntityState.isDeletingAddress, replaceAddress: editEntityActions.replaceAddress })] }), warnings.length > 0 && jsxRuntimeExports.jsx(WarningsDisplay, { warnings: warnings })] }));
56825
+ };
56826
+
56827
+ const Body$2 = ({ emails }) => {
56828
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: emails?.map((email) => (jsxRuntimeExports.jsx(Mail, { data: email }, email.id))) }));
56829
+ };
56830
+
56831
+ const Mails = ({ emails, handleAdd }) => {
56832
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: 'Emails' }), jsxRuntimeExports.jsx(Body$2, { emails: emails })] }));
56833
+ };
56834
+
56835
+ const mailStyle$1 = {
56836
+ emailField: {
56837
+ width: '60%',
56838
+ },
56839
+ numberCountryContainer: {
56840
+ display: 'flex',
56841
+ justifyContent: 'flex-start',
56842
+ width: '50%',
56843
+ },
56844
+ warningMessage: {
56845
+ position: "absolute",
56846
+ bottom: "-30px"
56847
+ },
56848
+ adressInputBox: {
56849
+ position: "relative",
56850
+ width: "60%"
56851
+ }
56852
+ };
56853
+
56854
+ const Whatsapp = ({ data }) => {
56855
+ const mode = 'edit';
56856
+ const { editEntity } = useEditEntity();
56857
+ const editEntityActions = editEntity.action;
56858
+ const editEntityState = editEntity.state;
56859
+ const [warnings, setWarnings] = useState([]);
56860
+ return (jsxRuntimeExports.jsxs(InformationItemContainer, { children: [jsxRuntimeExports.jsxs(InformationItemInputsContainer, { children: [jsxRuntimeExports.jsx(Box$2, { sx: mailStyle$1.numberCountryContainer, children: jsxRuntimeExports.jsx(Box$2, { sx: mailStyle$1.adressInputBox, children: jsxRuntimeExports.jsx(AddressInput, { data: data, setWarnings: setWarnings, onChange: editEntityActions.handleAddressFieldChange }) }) }), jsxRuntimeExports.jsx(NoteDeleteButton, { mode: mode, addressData: data, handleNoteFieldChange: editEntityActions.handleNoteFieldChange, handleDeleteAddress: editEntityActions.handleDeleteAddress, isDeletingAddress: editEntityState.isDeletingAddress, replaceAddress: editEntityActions.replaceAddress })] }), warnings.length > 0 && jsxRuntimeExports.jsx(WarningsDisplay, { warnings: warnings })] }));
56861
+ };
56862
+
56863
+ const Body$1 = ({ whatsapps }) => {
56864
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: whatsapps?.map((whatsapp) => (jsxRuntimeExports.jsx(Whatsapp, { data: whatsapp }, whatsapp.id))) }));
56865
+ };
56866
+
56867
+ const Whatsapps = ({ whatsapps, handleAdd }) => {
56868
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: 'WhatsApp' }), jsxRuntimeExports.jsx(Body$1, { whatsapps: whatsapps })] }));
56869
+ };
56870
+
56871
+ const mailStyle = {
56872
+ emailField: {
56873
+ width: '60%',
56874
+ },
56875
+ numberCountryContainer: {
56876
+ display: 'flex',
56877
+ justifyContent: 'flex-start',
56878
+ width: '50%',
56879
+ },
56880
+ warningMessage: {
56881
+ position: "absolute",
56882
+ bottom: "-30px"
56883
+ },
56884
+ adressInputBox: {
56885
+ position: "relative",
56886
+ width: "60%"
56887
+ }
56888
+ };
56889
+
56890
+ const RCS = ({ data }) => {
56891
+ const mode = 'edit';
56892
+ const { editEntity } = useEditEntity();
56893
+ const editEntityActions = editEntity.action;
56894
+ const editEntityState = editEntity.state;
56895
+ const [warnings, setWarnings] = useState([]);
56896
+ return (jsxRuntimeExports.jsxs(InformationItemContainer, { children: [jsxRuntimeExports.jsxs(InformationItemInputsContainer, { children: [jsxRuntimeExports.jsx(Box$2, { sx: mailStyle.numberCountryContainer, children: jsxRuntimeExports.jsx(Box$2, { sx: mailStyle.adressInputBox, children: jsxRuntimeExports.jsx(AddressInput, { data: data, setWarnings: setWarnings, onChange: editEntityActions.handleAddressFieldChange }) }) }), jsxRuntimeExports.jsx(NoteDeleteButton, { mode: mode, addressData: data, handleNoteFieldChange: editEntityActions.handleNoteFieldChange, handleDeleteAddress: editEntityActions.handleDeleteAddress, isDeletingAddress: editEntityState.isDeletingAddress, replaceAddress: editEntityActions.replaceAddress })] }), warnings.length > 0 && jsxRuntimeExports.jsx(WarningsDisplay, { warnings: warnings })] }));
56897
+ };
56898
+
56899
+ const Body = ({ RCSs }) => {
56900
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: RCSs?.map((data) => (jsxRuntimeExports.jsx(RCS, { data: data }, data.id))) }));
56901
+ };
56902
+
56903
+ const RCSs = ({ RCSs, handleAdd }) => {
56904
+ return (jsxRuntimeExports.jsxs(Box$2, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: 'RCS' }), jsxRuntimeExports.jsx(Body, { RCSs: RCSs })] }));
56905
+ };
56906
+
56907
+ const StyledModalContent = styled$1(Box$2)(({ theme }) => ({
56155
56908
  position: 'absolute',
56156
56909
  top: '50%',
56157
56910
  left: '50%',
@@ -56161,35 +56914,84 @@ styled$1(Box$2)(({ theme }) => ({
56161
56914
  padding: theme.spacing(4),
56162
56915
  borderRadius: theme.shape.borderRadius,
56163
56916
  }));
56917
+ const EditModal = ({ open, onClose, title }) => {
56918
+ const t = useTranslationContext();
56919
+ const { editEntity } = useEditEntity();
56920
+ const { emails, phoneNumbers, imsWhatsapp, imsRCS } = editEntity.field;
56921
+ const { addEmail, addPhone, addWhatsapp, resetToInitialContactInformation, addRCS } = editEntity.action;
56922
+ function handleClose() {
56923
+ onClose();
56924
+ resetToInitialContactInformation();
56925
+ }
56926
+ const renderContent = () => {
56927
+ switch (title) {
56928
+ case 'Phones':
56929
+ return jsxRuntimeExports.jsx(Phones, { handleAdd: addPhone, phoneNumbers: phoneNumbers });
56930
+ case 'Emails':
56931
+ return jsxRuntimeExports.jsx(Mails, { handleAdd: addEmail, emails: emails });
56932
+ case 'Whatsapp':
56933
+ return jsxRuntimeExports.jsx(Whatsapps, { handleAdd: addWhatsapp, whatsapps: imsWhatsapp });
56934
+ case 'RCS':
56935
+ return jsxRuntimeExports.jsx(RCSs, { handleAdd: addRCS, RCSs: imsRCS });
56936
+ case 'Facebook':
56937
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Facebook', IMSs: editEntity.field.imsFacebooks, editEntity: editEntity }));
56938
+ case 'Webchat':
56939
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Webchat', IMSs: editEntity.field.imsWebchats, editEntity: editEntity }));
56940
+ case 'Instagram':
56941
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Instagram', IMSs: editEntity.field.imsInstagrams, editEntity: editEntity }));
56942
+ case 'Mercado libre':
56943
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Mercado Libre', IMSs: editEntity.field.imsMercadolibre, editEntity: editEntity }));
56944
+ default:
56945
+ return jsxRuntimeExports.jsx(Typography$2, { children: "No information available for this section." });
56946
+ }
56947
+ };
56948
+ return (jsxRuntimeExports.jsx(Modal$2, { open: open, onClose: onClose, children: jsxRuntimeExports.jsxs(StyledModalContent, { children: [renderContent(), jsxRuntimeExports.jsx(Box$2, { mt: 2, display: 'flex', justifyContent: 'flex-end', children: jsxRuntimeExports.jsx(Button$2, { variant: "contained", color: "primary", onClick: handleClose, children: t('global.close') }) })] }) }));
56949
+ };
56950
+
56951
+ const ContactInformation = ({ ownerData }) => {
56952
+ const { isOpen, title, openModal, closeModal } = useEditModal();
56953
+ const { editEntity } = useEditEntity();
56954
+ const t = useTranslationContext();
56955
+ const phones = editEntity.field.phoneNumbers;
56956
+ const emails = editEntity.field.emails;
56957
+ const facebook = editEntity.field.imsFacebooks;
56958
+ const whatsapp = editEntity.field.imsWhatsapp;
56959
+ const mercadolibre = editEntity.field.imsMercadolibre;
56960
+ const webchat = editEntity.field.imsWebchats;
56961
+ const instagram = editEntity.field.imsInstagrams;
56962
+ const rcs = editEntity.field.imsRCS;
56963
+ return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Section, { title: "Contact Information", children: jsxRuntimeExports.jsxs(SectionContent, { children: [jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Phones'), title: t('contactDetails.phones'), methodItems: phones, isPhone: true, owner: ownerData }), jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Emails'), title: t('Emails'), methodItems: emails, owner: ownerData }), jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Facebook'), title: t('Facebook'), methodItems: facebook, owner: ownerData }), jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Whatsapp'), title: t('Whatsapp'), methodItems: whatsapp, owner: ownerData }), rcs.length > 0 ? (jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('RCS'), title: t('RCS'), methodItems: rcs, owner: ownerData })) : null, jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Mercado libre'), title: t('Mercado libre'), methodItems: mercadolibre, owner: ownerData }), jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Webchat'), title: t('Webchat'), methodItems: webchat, owner: ownerData }), jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal('Instagram'), title: t('Instagram'), methodItems: instagram, owner: ownerData })] }) }), jsxRuntimeExports.jsx(EditModal, { open: isOpen, onClose: closeModal, title: title })] }));
56964
+ };
56164
56965
 
56165
- const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, t, onEntityUpdated, }) => {
56966
+ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntityUpdated, }) => {
56166
56967
  const commonProps = {
56167
56968
  baseUrl,
56168
56969
  spaceId,
56169
56970
  entityId: String(entityData.id),
56170
56971
  onEntityUpdated,
56171
56972
  };
56973
+ const t = useTranslationContext();
56172
56974
  const maybeTitle = t('contactDetails.addressInformation');
56173
56975
  const sectionTitle = maybeTitle === 'contactDetails.addressInformation' ? 'Address Information' : maybeTitle;
56174
- return (jsxRuntimeExports.jsx(Section, { title: sectionTitle, children: jsxRuntimeExports.jsx(SectionContent, { children: entityType === 'contact' ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.street'), value: entityData.address1?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56976
+ return (jsxRuntimeExports.jsx(Section, { title: sectionTitle, 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) => ({
56175
56977
  address1: { street: value },
56176
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56978
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56177
56979
  address2: { street: value },
56178
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
56980
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
56179
56981
  address1: { city: value },
56180
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
56982
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
56181
56983
  address2: { city: value },
56182
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
56984
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
56183
56985
  address1: { state: value },
56184
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
56986
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
56185
56987
  address2: { state: value },
56186
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
56988
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
56187
56989
  address1: { zipcode: value },
56188
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
56990
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
56189
56991
  address2: { zipcode: value },
56190
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
56992
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
56191
56993
  address1: { country: value },
56192
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
56994
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
56193
56995
  address2: { country: value },
56194
56996
  }) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.street'), value: entityData.address1?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56195
56997
  address1: { street: value },
@@ -56214,100 +57016,97 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, t, onEnt
56214
57016
  }) })] })) }) }));
56215
57017
  };
56216
57018
 
56217
- const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }) => {
56218
- const api = useMemo(() => {
56219
- if (!baseUrl || !spaceId)
56220
- return null;
56221
- return createEditContactApi(baseUrl, spaceId);
56222
- }, [baseUrl, spaceId]);
56223
- const { state, selectors, actions } = useEditContactModalController({
56224
- open,
56225
- baseUrl,
56226
- spaceId,
56227
- contactId,
56228
- });
56229
- const [view, setView] = useState("main");
57019
+ const useEntityUpdateSync = ({ entity, setEntity }) => {
57020
+ const handleEntityUpdated = useCallback((update) => {
57021
+ if (!update || typeof update !== 'object') {
57022
+ return;
57023
+ }
57024
+ const updateObj = update;
57025
+ if ('id' in updateObj) {
57026
+ // Full entity replacement
57027
+ setEntity(update);
57028
+ return;
57029
+ }
57030
+ if (!entity) {
57031
+ return;
57032
+ }
57033
+ // Shallow merge partial updates into existing entity
57034
+ const merged = { ...entity, ...updateObj };
57035
+ setEntity(merged);
57036
+ }, [entity, setEntity]);
57037
+ return handleEntityUpdated;
57038
+ };
57039
+
57040
+ const useTagsEditorController = ({ open, baseUrl, spaceId, contactData, contactType, labels, selectedTags, onTagsUpdated, }) => {
57041
+ const [view, setView] = useState('main');
56230
57042
  const [draftLabels, setDraftLabels] = useState([]);
56231
57043
  const [tagsEditorInitialized, setTagsEditorInitialized] = useState(false);
56232
- const [isSavingTags, setIsSavingTags] = useState(false);
56233
- const resetModalState = useCallback(() => {
57044
+ const [isSaving, setIsSaving] = useState(false);
57045
+ const reset = useCallback(() => {
56234
57046
  setView('main');
56235
57047
  setDraftLabels([]);
56236
57048
  setTagsEditorInitialized(false);
56237
- setIsSavingTags(false);
57049
+ setIsSaving(false);
56238
57050
  }, []);
56239
- const handleEntityUpdated = useCallback((entity) => {
56240
- if (!entity || typeof entity !== 'object')
56241
- return;
56242
- const hasId = 'id' in entity;
56243
- if (hasId) {
56244
- actions.setContactData(entity);
56245
- return;
56246
- }
56247
- if (state.contactData) {
56248
- actions.setContactData({ ...state.contactData, ...entity });
56249
- }
56250
- }, [actions, state.contactData]);
56251
- const image = useImage({
56252
- baseUrl,
56253
- spaceId,
56254
- entityType: selectors.contactType === 'business' || selectors.contactType === 'contact'
56255
- ? selectors.contactType
56256
- : undefined,
56257
- entityId: state.contactData ? String(state.contactData.id) : undefined,
56258
- initialImageUrl: state.contactData?.imageUrl,
56259
- onEntityUpdated: handleEntityUpdated,
56260
- });
56261
57051
  useEffect(() => {
56262
57052
  if (!open) {
56263
- resetModalState();
57053
+ reset();
57054
+ }
57055
+ }, [open, reset]);
57056
+ useEffect(() => {
57057
+ if (view !== 'tags') {
57058
+ setTagsEditorInitialized(false);
57059
+ return;
56264
57060
  }
56265
- }, [open, resetModalState]);
56266
- const handleSaveTags = async () => {
56267
- if (isSavingTags)
57061
+ if (tagsEditorInitialized)
56268
57062
  return;
56269
- if (!baseUrl)
57063
+ if (!labels.length)
56270
57064
  return;
56271
- if (!spaceId)
57065
+ const selectedTagIds = new Set(selectedTags.map((t) => String(t.id)));
57066
+ const initialDraft = labels.filter((l) => selectedTagIds.has(String(l?.id)));
57067
+ setDraftLabels(initialDraft);
57068
+ setTagsEditorInitialized(true);
57069
+ }, [view, tagsEditorInitialized, labels, selectedTags]);
57070
+ const handleSaveTags = useCallback(async () => {
57071
+ if (isSaving)
56272
57072
  return;
56273
- if (!state.contactData)
57073
+ if (!baseUrl || !spaceId)
57074
+ return;
57075
+ if (!contactData)
56274
57076
  return;
56275
- if (selectors.contactType !== 'business' && selectors.contactType !== 'contact')
57077
+ if (contactType !== 'contact' && contactType !== 'business')
56276
57078
  return;
56277
57079
  const tags = draftLabels
56278
57080
  .filter((l) => l?.id && l?.name)
56279
57081
  .map((l) => ({ id: String(l.id), name: String(l.name) }));
56280
- setIsSavingTags(true);
57082
+ setIsSaving(true);
56281
57083
  try {
56282
57084
  await updateEntity({
56283
57085
  baseUrl,
56284
57086
  spaceId,
56285
- entityType: selectors.contactType,
56286
- entityId: String(state.contactData.id),
57087
+ entityType: contactType,
57088
+ entityId: String(contactData.id),
56287
57089
  body: { tags },
56288
57090
  });
56289
- actions.setContactData({ ...state.contactData, tags });
57091
+ onTagsUpdated(tags);
56290
57092
  setView('main');
56291
57093
  }
56292
57094
  finally {
56293
- setIsSavingTags(false);
57095
+ setIsSaving(false);
56294
57096
  }
57097
+ }, [isSaving, baseUrl, spaceId, contactData, contactType, draftLabels, onTagsUpdated]);
57098
+ return {
57099
+ view,
57100
+ setView,
57101
+ draftLabels,
57102
+ setDraftLabels,
57103
+ isSaving,
57104
+ handleSaveTags,
56295
57105
  };
56296
- useEffect(() => {
56297
- if (view !== 'tags') {
56298
- setTagsEditorInitialized(false);
56299
- return;
56300
- }
56301
- if (tagsEditorInitialized)
56302
- return;
56303
- if (!selectors.labels.length)
56304
- return;
56305
- const selectedTagIds = new Set(selectors.tags.map((t) => String(t.id)));
56306
- const initialSelectedLabels = selectors.labels.filter((l) => selectedTagIds.has(String(l?.id)));
56307
- setDraftLabels(initialSelectedLabels);
56308
- setTagsEditorInitialized(true);
56309
- }, [view, tagsEditorInitialized, selectors.labels, selectors.tags]);
56310
- const handleClose = (event, reason) => {
57106
+ };
57107
+
57108
+ const useModalCloseHandler = ({ onClose }) => {
57109
+ const handleClose = useCallback((event, reason) => {
56311
57110
  if (reason === 'escapeKeyDown') {
56312
57111
  const maybeEvent = event;
56313
57112
  if (typeof maybeEvent?.stopPropagation === 'function') {
@@ -56318,7 +57117,51 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }
56318
57117
  }
56319
57118
  }
56320
57119
  onClose();
56321
- };
57120
+ }, [onClose]);
57121
+ return handleClose;
57122
+ };
57123
+
57124
+ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t }) => {
57125
+ const api = useMemo(() => {
57126
+ if (!baseUrl || !spaceId)
57127
+ return null;
57128
+ return createEditContactApi(baseUrl, spaceId);
57129
+ }, [baseUrl, spaceId]);
57130
+ const { state, selectors, actions } = useEditContactModalController({
57131
+ open,
57132
+ baseUrl,
57133
+ spaceId,
57134
+ contactId,
57135
+ });
57136
+ const handleEntityUpdated = useEntityUpdateSync({
57137
+ entity: state.contactData,
57138
+ setEntity: (next) => actions.setContactData(next ?? undefined),
57139
+ });
57140
+ const { view, setView, draftLabels, setDraftLabels, isSaving: isSavingTags, handleSaveTags, } = useTagsEditorController({
57141
+ open,
57142
+ baseUrl,
57143
+ spaceId,
57144
+ contactData: state.contactData,
57145
+ contactType: selectors.contactType,
57146
+ labels: selectors.labels,
57147
+ selectedTags: selectors.tags,
57148
+ onTagsUpdated: (tags) => {
57149
+ if (!state.contactData)
57150
+ return;
57151
+ actions.setContactData({ ...state.contactData, tags });
57152
+ },
57153
+ });
57154
+ const image = useImage({
57155
+ baseUrl,
57156
+ spaceId,
57157
+ entityType: selectors.contactType === 'business' || selectors.contactType === 'contact'
57158
+ ? selectors.contactType
57159
+ : undefined,
57160
+ entityId: state.contactData ? String(state.contactData.id) : undefined,
57161
+ initialImageUrl: state.contactData?.imageUrl,
57162
+ onEntityUpdated: handleEntityUpdated,
57163
+ });
57164
+ const handleClose = useModalCloseHandler({ onClose });
56322
57165
  const baseSx = {
56323
57166
  position: 'absolute',
56324
57167
  top: '50%',
@@ -56333,23 +57176,21 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }
56333
57176
  p: 3,
56334
57177
  overflow: 'hidden',
56335
57178
  };
56336
- const mergedSx = Array.isArray(sx)
56337
- ? [baseSx, ...sx]
56338
- : sx
56339
- ? [baseSx, sx]
56340
- : baseSx;
56341
- return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, 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: {
56342
- display: 'flex',
56343
- justifyContent: 'center',
56344
- alignItems: 'center',
56345
- minHeight: 220,
56346
- }, 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, t: t, onEditTags: () => {
56347
- setView('tags');
56348
- }, 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' || selectors.contactType === 'business'
56349
- ? selectors.contactType
56350
- : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, t: t, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' || selectors.contactType === 'business'
56351
- ? selectors.contactType
56352
- : 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, t: t }), jsxRuntimeExports.jsx(Section, { title: "Contact Information", children: "C" })] })] }) }), 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, t: t }) }) })] }) })) : null }) }) }) }));
57179
+ const mergedSx = Array.isArray(sx) ? [baseSx, ...sx] : sx ? [baseSx, sx] : baseSx;
57180
+ 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: {
57181
+ display: 'flex',
57182
+ justifyContent: 'center',
57183
+ alignItems: 'center',
57184
+ minHeight: 220,
57185
+ }, 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: () => {
57186
+ setView('tags');
57187
+ }, 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' ||
57188
+ selectors.contactType === 'business'
57189
+ ? selectors.contactType
57190
+ : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
57191
+ selectors.contactType === 'business'
57192
+ ? selectors.contactType
57193
+ : '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 }) }) }) }) }));
56353
57194
  };
56354
57195
 
56355
57196
  export { ContactInfoPopup, EditContactModal };