@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/cjs/index.js CHANGED
@@ -6380,7 +6380,7 @@ function getStyleValue$1(themeMapping, transform, propValueFinal, userValue = pr
6380
6380
  }
6381
6381
  return value;
6382
6382
  }
6383
- function style$2(options) {
6383
+ function style$5(options) {
6384
6384
  const {
6385
6385
  prop,
6386
6386
  cssProperty = options.prop,
@@ -6541,12 +6541,12 @@ function resolveCssProperty(props, keys, prop, transformer) {
6541
6541
  const propValue = props[prop];
6542
6542
  return handleBreakpoints(props, propValue, styleFromPropValue);
6543
6543
  }
6544
- function style$1(props, keys) {
6544
+ function style$4(props, keys) {
6545
6545
  const transformer = createUnarySpacing(props.theme);
6546
6546
  return Object.keys(props).map(prop => resolveCssProperty(props, keys, prop, transformer)).reduce(merge, {});
6547
6547
  }
6548
6548
  function margin(props) {
6549
- return style$1(props, marginKeys);
6549
+ return style$4(props, marginKeys);
6550
6550
  }
6551
6551
  margin.propTypes = process.env.NODE_ENV !== 'production' ? marginKeys.reduce((obj, key) => {
6552
6552
  obj[key] = responsivePropType$1;
@@ -6554,7 +6554,7 @@ margin.propTypes = process.env.NODE_ENV !== 'production' ? marginKeys.reduce((ob
6554
6554
  }, {}) : {};
6555
6555
  margin.filterProps = marginKeys;
6556
6556
  function padding(props) {
6557
- return style$1(props, paddingKeys);
6557
+ return style$4(props, paddingKeys);
6558
6558
  }
6559
6559
  padding.propTypes = process.env.NODE_ENV !== 'production' ? paddingKeys.reduce((obj, key) => {
6560
6560
  obj[key] = responsivePropType$1;
@@ -6627,7 +6627,7 @@ function borderTransform(value) {
6627
6627
  return `${value}px solid`;
6628
6628
  }
6629
6629
  function createBorderStyle(prop, transform) {
6630
- return style$2({
6630
+ return style$5({
6631
6631
  prop,
6632
6632
  themeKey: 'borders',
6633
6633
  transform
@@ -6714,31 +6714,31 @@ rowGap.propTypes = process.env.NODE_ENV !== 'production' ? {
6714
6714
  rowGap: responsivePropType$1
6715
6715
  } : {};
6716
6716
  rowGap.filterProps = ['rowGap'];
6717
- const gridColumn = style$2({
6717
+ const gridColumn = style$5({
6718
6718
  prop: 'gridColumn'
6719
6719
  });
6720
- const gridRow = style$2({
6720
+ const gridRow = style$5({
6721
6721
  prop: 'gridRow'
6722
6722
  });
6723
- const gridAutoFlow = style$2({
6723
+ const gridAutoFlow = style$5({
6724
6724
  prop: 'gridAutoFlow'
6725
6725
  });
6726
- const gridAutoColumns = style$2({
6726
+ const gridAutoColumns = style$5({
6727
6727
  prop: 'gridAutoColumns'
6728
6728
  });
6729
- const gridAutoRows = style$2({
6729
+ const gridAutoRows = style$5({
6730
6730
  prop: 'gridAutoRows'
6731
6731
  });
6732
- const gridTemplateColumns = style$2({
6732
+ const gridTemplateColumns = style$5({
6733
6733
  prop: 'gridTemplateColumns'
6734
6734
  });
6735
- const gridTemplateRows = style$2({
6735
+ const gridTemplateRows = style$5({
6736
6736
  prop: 'gridTemplateRows'
6737
6737
  });
6738
- const gridTemplateAreas = style$2({
6738
+ const gridTemplateAreas = style$5({
6739
6739
  prop: 'gridTemplateAreas'
6740
6740
  });
6741
- const gridArea = style$2({
6741
+ const gridArea = style$5({
6742
6742
  prop: 'gridArea'
6743
6743
  });
6744
6744
  compose(gap, columnGap, rowGap, gridColumn, gridRow, gridAutoFlow, gridAutoColumns, gridAutoRows, gridTemplateColumns, gridTemplateRows, gridTemplateAreas, gridArea);
@@ -6749,18 +6749,18 @@ function paletteTransform(value, userValue) {
6749
6749
  }
6750
6750
  return value;
6751
6751
  }
6752
- const color = style$2({
6752
+ const color = style$5({
6753
6753
  prop: 'color',
6754
6754
  themeKey: 'palette',
6755
6755
  transform: paletteTransform
6756
6756
  });
6757
- const bgcolor = style$2({
6757
+ const bgcolor = style$5({
6758
6758
  prop: 'bgcolor',
6759
6759
  cssProperty: 'backgroundColor',
6760
6760
  themeKey: 'palette',
6761
6761
  transform: paletteTransform
6762
6762
  });
6763
- const backgroundColor = style$2({
6763
+ const backgroundColor = style$5({
6764
6764
  prop: 'backgroundColor',
6765
6765
  themeKey: 'palette',
6766
6766
  transform: paletteTransform
@@ -6770,7 +6770,7 @@ compose(color, bgcolor, backgroundColor);
6770
6770
  function sizingTransform(value) {
6771
6771
  return value <= 1 && value !== 0 ? `${value * 100}%` : value;
6772
6772
  }
6773
- const width = style$2({
6773
+ const width = style$5({
6774
6774
  prop: 'width',
6775
6775
  transform: sizingTransform
6776
6776
  });
@@ -6798,33 +6798,33 @@ const maxWidth = props => {
6798
6798
  return null;
6799
6799
  };
6800
6800
  maxWidth.filterProps = ['maxWidth'];
6801
- const minWidth = style$2({
6801
+ const minWidth = style$5({
6802
6802
  prop: 'minWidth',
6803
6803
  transform: sizingTransform
6804
6804
  });
6805
- const height = style$2({
6805
+ const height = style$5({
6806
6806
  prop: 'height',
6807
6807
  transform: sizingTransform
6808
6808
  });
6809
- const maxHeight = style$2({
6809
+ const maxHeight = style$5({
6810
6810
  prop: 'maxHeight',
6811
6811
  transform: sizingTransform
6812
6812
  });
6813
- const minHeight = style$2({
6813
+ const minHeight = style$5({
6814
6814
  prop: 'minHeight',
6815
6815
  transform: sizingTransform
6816
6816
  });
6817
- style$2({
6817
+ style$5({
6818
6818
  prop: 'size',
6819
6819
  cssProperty: 'width',
6820
6820
  transform: sizingTransform
6821
6821
  });
6822
- style$2({
6822
+ style$5({
6823
6823
  prop: 'size',
6824
6824
  cssProperty: 'height',
6825
6825
  transform: sizingTransform
6826
6826
  });
6827
- const boxSizing = style$2({
6827
+ const boxSizing = style$5({
6828
6828
  prop: 'boxSizing'
6829
6829
  });
6830
6830
  compose(width, maxWidth, minWidth, height, maxHeight, minHeight, boxSizing);
@@ -7419,27 +7419,27 @@ var styleFunctionSx = /*#__PURE__*/Object.freeze({
7419
7419
 
7420
7420
  var require$$8 = /*@__PURE__*/getAugmentedNamespace(styleFunctionSx);
7421
7421
 
7422
- var _interopRequireDefault$b = interopRequireDefaultExports;
7422
+ var _interopRequireDefault$i = interopRequireDefaultExports;
7423
7423
  Object.defineProperty(createStyled$3, "__esModule", {
7424
7424
  value: true
7425
7425
  });
7426
7426
  var _default = createStyled$3.default = createStyled$1;
7427
7427
  var shouldForwardProp_1 = createStyled$3.shouldForwardProp = shouldForwardProp$1;
7428
7428
  createStyled$3.systemDefaultTheme = void 0;
7429
- var _extends2 = _interopRequireDefault$b(require_extends());
7430
- var _objectWithoutPropertiesLoose2 = _interopRequireDefault$b(requireObjectWithoutPropertiesLoose());
7431
- var _styledEngine$1 = _interopRequireWildcard$1(require$$1$1);
7429
+ var _extends2 = _interopRequireDefault$i(require_extends());
7430
+ var _objectWithoutPropertiesLoose2 = _interopRequireDefault$i(requireObjectWithoutPropertiesLoose());
7431
+ var _styledEngine$1 = _interopRequireWildcard$2(require$$1$1);
7432
7432
  var _deepmerge = require$$4;
7433
- var _capitalize = _interopRequireDefault$b(require$$5);
7434
- var _getDisplayName = _interopRequireDefault$b(require$$6);
7435
- var _createTheme = _interopRequireDefault$b(require$$7);
7436
- var _styleFunctionSx = _interopRequireDefault$b(require$$8);
7433
+ var _capitalize = _interopRequireDefault$i(require$$5);
7434
+ var _getDisplayName = _interopRequireDefault$i(require$$6);
7435
+ var _createTheme = _interopRequireDefault$i(require$$7);
7436
+ var _styleFunctionSx = _interopRequireDefault$i(require$$8);
7437
7437
  const _excluded$1v = ["ownerState"],
7438
7438
  _excluded2$d = ["variants"],
7439
7439
  _excluded3$4 = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"];
7440
7440
  /* eslint-disable no-underscore-dangle */
7441
- 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); }
7442
- 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; }
7441
+ 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); }
7442
+ 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; }
7443
7443
  function isEmpty$3(obj) {
7444
7444
  return Object.keys(obj).length === 0;
7445
7445
  }
@@ -7703,7 +7703,7 @@ var require$$1 = /*@__PURE__*/getAugmentedNamespace(formatMuiErrorMessage$1);
7703
7703
 
7704
7704
  var require$$2 = /*@__PURE__*/getAugmentedNamespace(clamp);
7705
7705
 
7706
- var _interopRequireDefault$a = interopRequireDefaultExports;
7706
+ var _interopRequireDefault$h = interopRequireDefaultExports;
7707
7707
  Object.defineProperty(colorManipulator, "__esModule", {
7708
7708
  value: true
7709
7709
  });
@@ -7725,8 +7725,8 @@ colorManipulator.private_safeEmphasize = private_safeEmphasize;
7725
7725
  colorManipulator.private_safeLighten = private_safeLighten;
7726
7726
  colorManipulator.recomposeColor = recomposeColor$1;
7727
7727
  colorManipulator.rgbToHex = rgbToHex;
7728
- var _formatMuiErrorMessage2 = _interopRequireDefault$a(require$$1);
7729
- var _clamp = _interopRequireDefault$a(require$$2);
7728
+ var _formatMuiErrorMessage2 = _interopRequireDefault$h(require$$1);
7729
+ var _clamp = _interopRequireDefault$h(require$$2);
7730
7730
  /* eslint-disable @typescript-eslint/naming-convention */
7731
7731
 
7732
7732
  /**
@@ -9040,11 +9040,19 @@ var PhoneEnabled = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9040
9040
  d: "m17.38 10.79-2.2-2.2c-.28-.28-.36-.67-.25-1.02.37-1.12.57-2.32.57-3.57 0-.55.45-1 1-1H20c.55 0 1 .45 1 1 0 9.39-7.61 17-17 17-.55 0-1-.45-1-1v-3.49c0-.55.45-1 1-1 1.24 0 2.45-.2 3.57-.57.35-.12.75-.03 1.02.24l2.2 2.2c2.83-1.45 5.15-3.76 6.59-6.59"
9041
9041
  }), 'PhoneEnabled');
9042
9042
 
9043
+ var Star = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9044
+ d: "M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"
9045
+ }), 'Star');
9046
+
9047
+ var StarBorder = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9048
+ 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"
9049
+ }), 'StarBorder');
9050
+
9043
9051
  var ThreeP = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9044
9052
  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"
9045
9053
  }), 'ThreeP');
9046
9054
 
9047
- var WhatsApp$1 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9055
+ var WhatsApp$2 = createSvgIcon$1( /*#__PURE__*/jsxRuntimeExports.jsx("path", {
9048
9056
  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"
9049
9057
  }), 'WhatsApp');
9050
9058
 
@@ -9076,27 +9084,27 @@ function requireCreateSvgIcon () {
9076
9084
  return createSvgIcon;
9077
9085
  }
9078
9086
 
9079
- var _interopRequireDefault$9 = interopRequireDefaultExports;
9087
+ var _interopRequireDefault$g = interopRequireDefaultExports;
9080
9088
  Object.defineProperty(ArrowForward, "__esModule", {
9081
9089
  value: true
9082
9090
  });
9083
- var default_1$a = ArrowForward.default = void 0;
9084
- var _createSvgIcon$9 = _interopRequireDefault$9(requireCreateSvgIcon());
9085
- var _jsxRuntime$9 = jsxRuntimeExports;
9086
- default_1$a = ArrowForward.default = (0, _createSvgIcon$9.default)( /*#__PURE__*/(0, _jsxRuntime$9.jsx)("path", {
9091
+ var default_1$h = ArrowForward.default = void 0;
9092
+ var _createSvgIcon$g = _interopRequireDefault$g(requireCreateSvgIcon());
9093
+ var _jsxRuntime$g = jsxRuntimeExports;
9094
+ default_1$h = ArrowForward.default = (0, _createSvgIcon$g.default)( /*#__PURE__*/(0, _jsxRuntime$g.jsx)("path", {
9087
9095
  d: "m12 4-1.41 1.41L16.17 11H4v2h12.17l-5.58 5.59L12 20l8-8z"
9088
9096
  }), 'ArrowForward');
9089
9097
 
9090
9098
  var Message = {};
9091
9099
 
9092
- var _interopRequireDefault$8 = interopRequireDefaultExports;
9100
+ var _interopRequireDefault$f = interopRequireDefaultExports;
9093
9101
  Object.defineProperty(Message, "__esModule", {
9094
9102
  value: true
9095
9103
  });
9096
- var default_1$9 = Message.default = void 0;
9097
- var _createSvgIcon$8 = _interopRequireDefault$8(requireCreateSvgIcon());
9098
- var _jsxRuntime$8 = jsxRuntimeExports;
9099
- default_1$9 = Message.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _jsxRuntime$8.jsx)("path", {
9104
+ var default_1$g = Message.default = void 0;
9105
+ var _createSvgIcon$f = _interopRequireDefault$f(requireCreateSvgIcon());
9106
+ var _jsxRuntime$f = jsxRuntimeExports;
9107
+ default_1$g = Message.default = (0, _createSvgIcon$f.default)( /*#__PURE__*/(0, _jsxRuntime$f.jsx)("path", {
9100
9108
  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"
9101
9109
  }), 'Message');
9102
9110
 
@@ -9176,7 +9184,7 @@ const Header$1 = ({ imgUrl, name, contactId, navigate, isLoading = false, onErro
9176
9184
  handleNavigateToContacts(e);
9177
9185
  onClose();
9178
9186
  }
9179
- }, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$a, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
9187
+ }, disabled: !contactId, "aria-label": "View contact details", children: jsxRuntimeExports.jsx(default_1$h, { fontSize: "small" }) }), jsxRuntimeExports.jsx(SmallIconButton, { color: "info", size: "small", onClick: (e) => {
9180
9188
  handleNavigateToConversations(e);
9181
9189
  onClose();
9182
9190
  }, onMouseDown: (e) => {
@@ -9185,7 +9193,7 @@ const Header$1 = ({ imgUrl, name, contactId, navigate, isLoading = false, onErro
9185
9193
  handleNavigateToConversations(e);
9186
9194
  onClose();
9187
9195
  }
9188
- }, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1$9, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(material.CircularProgress, { 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 })] }));
9196
+ }, "aria-label": "Go to conversations", children: jsxRuntimeExports.jsx(default_1$g, { fontSize: "small" }) })] }), isLoading ? (jsxRuntimeExports.jsx(LoadingContainer, { children: jsxRuntimeExports.jsx(material.CircularProgress, { 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 })] }));
9189
9197
  };
9190
9198
 
9191
9199
  const Container$1 = material.styled(material.Box)({
@@ -9200,7 +9208,7 @@ const TitleBox = material.styled(material.Box)({
9200
9208
  width: '100%',
9201
9209
  borderBottom: `1px solid lightgray`,
9202
9210
  });
9203
- const StyledBox = material.styled(material.Box)({
9211
+ const StyledBox$3 = material.styled(material.Box)({
9204
9212
  display: 'flex',
9205
9213
  alignItems: 'center',
9206
9214
  justifyContent: 'space-between',
@@ -9231,7 +9239,7 @@ const AddressContainer = material.styled(material.Box)({
9231
9239
  height: '50px',
9232
9240
  maxWidth: '90%',
9233
9241
  });
9234
- const NoteText = material.styled(material.Typography)({
9242
+ const NoteText$2 = material.styled(material.Typography)({
9235
9243
  whiteSpace: 'nowrap',
9236
9244
  textOverflow: 'ellipsis',
9237
9245
  overflow: 'hidden',
@@ -9240,13 +9248,13 @@ const NoteText = material.styled(material.Typography)({
9240
9248
  bottom: 16,
9241
9249
  left: 40,
9242
9250
  });
9243
- const ContactMethod = ({ icon, contactList, title, showTitle = true, }) => {
9244
- const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
9251
+ const ContactMethod$1 = ({ icon, contactList, title, showTitle = true, }) => {
9252
+ const renderContactInfo = (contact) => (jsxRuntimeExports.jsx(StyledBox$3, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
9245
9253
  whiteSpace: 'nowrap',
9246
9254
  textOverflow: 'ellipsis',
9247
9255
  overflow: 'hidden',
9248
9256
  cursor: 'default',
9249
- }, children: contact.address }) }), contact.profileName && (jsxRuntimeExports.jsx(material.Typography, { 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));
9257
+ }, children: contact.address }) }), contact.profileName && (jsxRuntimeExports.jsx(material.Typography, { 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));
9250
9258
  return (jsxRuntimeExports.jsxs(Container$1, { children: [showTitle && (jsxRuntimeExports.jsx(TitleBox, { children: jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", fontWeight: "bold", gutterBottom: true, mt: 2, children: title }) })), contactList?.map(renderContactInfo)] }));
9251
9259
  };
9252
9260
 
@@ -15325,7 +15333,7 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
15325
15333
  showTitle: true,
15326
15334
  },
15327
15335
  {
15328
- icon: jsxRuntimeExports.jsx(WhatsApp$1, { fontSize: "small" }),
15336
+ icon: jsxRuntimeExports.jsx(WhatsApp$2, { fontSize: "small" }),
15329
15337
  title: 'IM',
15330
15338
  contactList: contactData?.ims_whatsapp || [],
15331
15339
  showTitle: true,
@@ -15359,50 +15367,47 @@ const ContactInfoPopup = ({ open, anchorEl, onClose, contactData, avatarImgUrl,
15359
15367
  window.removeEventListener('keydown', handleKeyDown);
15360
15368
  };
15361
15369
  }, [open, onClose]);
15362
- return (jsxRuntimeExports.jsx(material.Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(material.ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(material.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') })] }) }) }) }));
15363
- };
15364
-
15365
- const Section = ({ title, children }) => {
15366
- return (jsxRuntimeExports.jsxs(material.Box, { sx: {
15367
- border: '1px solid',
15368
- borderColor: 'divider',
15369
- borderRadius: 2,
15370
- p: 2,
15371
- mb: 2,
15372
- }, children: [jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", sx: { fontWeight: 600 }, children: title }), jsxRuntimeExports.jsx(material.Divider, { sx: { my: 1.5 } }), children] }));
15373
- };
15374
-
15375
- const SectionContent = ({ children, ...boxProps }) => {
15376
- return (jsxRuntimeExports.jsx(material.Box, { display: "grid", gridTemplateColumns: { xs: '1fr', md: 'repeat(2, minmax(0, 1fr))' }, gap: 2, ...boxProps, children: children }));
15370
+ return (jsxRuntimeExports.jsx(material.Popper, { sx: { zIndex: 1300 }, open: open, anchorEl: anchorEl, placement: "bottom-start", "data-popper-child": "true", children: jsxRuntimeExports.jsx(material.ClickAwayListener, { onClickAway: onClose, children: jsxRuntimeExports.jsx(PopupContainer, { children: jsxRuntimeExports.jsxs(material.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') })] }) }) }) }));
15377
15371
  };
15378
15372
 
15379
15373
  var Edit = {};
15380
15374
 
15381
- var _interopRequireDefault$7 = interopRequireDefaultExports;
15375
+ var _interopRequireDefault$e = interopRequireDefaultExports;
15382
15376
  Object.defineProperty(Edit, "__esModule", {
15383
15377
  value: true
15384
15378
  });
15385
- var default_1$8 = Edit.default = void 0;
15386
- var _createSvgIcon$7 = _interopRequireDefault$7(requireCreateSvgIcon());
15387
- var _jsxRuntime$7 = jsxRuntimeExports;
15388
- default_1$8 = Edit.default = (0, _createSvgIcon$7.default)( /*#__PURE__*/(0, _jsxRuntime$7.jsx)("path", {
15379
+ var default_1$f = Edit.default = void 0;
15380
+ var _createSvgIcon$e = _interopRequireDefault$e(requireCreateSvgIcon());
15381
+ var _jsxRuntime$e = jsxRuntimeExports;
15382
+ default_1$f = Edit.default = (0, _createSvgIcon$e.default)( /*#__PURE__*/(0, _jsxRuntime$e.jsx)("path", {
15389
15383
  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"
15390
15384
  }), 'Edit');
15391
15385
 
15392
15386
  var Label = {};
15393
15387
 
15394
- var _interopRequireDefault$6 = interopRequireDefaultExports;
15388
+ var _interopRequireDefault$d = interopRequireDefaultExports;
15395
15389
  Object.defineProperty(Label, "__esModule", {
15396
15390
  value: true
15397
15391
  });
15398
- var default_1$7 = Label.default = void 0;
15399
- var _createSvgIcon$6 = _interopRequireDefault$6(requireCreateSvgIcon());
15400
- var _jsxRuntime$6 = jsxRuntimeExports;
15401
- default_1$7 = Label.default = (0, _createSvgIcon$6.default)( /*#__PURE__*/(0, _jsxRuntime$6.jsx)("path", {
15392
+ var default_1$e = Label.default = void 0;
15393
+ var _createSvgIcon$d = _interopRequireDefault$d(requireCreateSvgIcon());
15394
+ var _jsxRuntime$d = jsxRuntimeExports;
15395
+ default_1$e = Label.default = (0, _createSvgIcon$d.default)( /*#__PURE__*/(0, _jsxRuntime$d.jsx)("path", {
15402
15396
  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"
15403
15397
  }), 'Label');
15404
15398
 
15405
- const Tags = ({ tags, t, onEditTags }) => {
15399
+ const noop$3 = (key) => key;
15400
+ const TranslationContext = React$1.createContext(noop$3);
15401
+ const TranslationProvider = ({ t, children }) => {
15402
+ return jsxRuntimeExports.jsx(TranslationContext.Provider, { value: t, children: children });
15403
+ };
15404
+ const useTranslationContext = () => {
15405
+ const t = React$1.useContext(TranslationContext);
15406
+ return t || noop$3;
15407
+ };
15408
+
15409
+ const Tags = ({ tags, onEditTags }) => {
15410
+ const t = useTranslationContext();
15406
15411
  const [anchorEl, setAnchorEl] = React$1.useState(null);
15407
15412
  const safeTags = React$1.useMemo(() => tags ?? [], [tags]);
15408
15413
  const MAX_VISIBLE = 4;
@@ -15446,7 +15451,7 @@ const Tags = ({ tags, t, onEditTags }) => {
15446
15451
  bgcolor: 'action.hover',
15447
15452
  color: 'text.primary',
15448
15453
  },
15449
- }, children: safeTags.length ? (jsxRuntimeExports.jsx(default_1$8, { fontSize: "small" })) : (jsxRuntimeExports.jsx(default_1$7, { fontSize: "small" })) })] }), jsxRuntimeExports.jsx(material.Popover, { open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, transformOrigin: { vertical: 'top', horizontal: 'center' }, children: jsxRuntimeExports.jsxs(material.Box, { sx: { p: 1.5, maxWidth: 320, maxHeight: 240, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: t('tags') }), jsxRuntimeExports.jsx(material.Stack, { direction: "row", spacing: 1, useFlexGap: true, flexWrap: "wrap", children: safeTags.map((tag) => (jsxRuntimeExports.jsx(material.Chip, { label: tag.name, size: "small", variant: "outlined", sx: {
15454
+ }, children: safeTags.length ? (jsxRuntimeExports.jsx(default_1$f, { fontSize: "small" })) : (jsxRuntimeExports.jsx(default_1$e, { fontSize: "small" })) })] }), jsxRuntimeExports.jsx(material.Popover, { open: open, anchorEl: anchorEl, onClose: handleClose, anchorOrigin: { vertical: 'bottom', horizontal: 'center' }, transformOrigin: { vertical: 'top', horizontal: 'center' }, children: jsxRuntimeExports.jsxs(material.Box, { sx: { p: 1.5, maxWidth: 320, maxHeight: 240, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle2", sx: { mb: 1 }, children: t('tags') }), jsxRuntimeExports.jsx(material.Stack, { direction: "row", spacing: 1, useFlexGap: true, flexWrap: "wrap", children: safeTags.map((tag) => (jsxRuntimeExports.jsx(material.Chip, { label: tag.name, size: "small", variant: "outlined", sx: {
15450
15455
  borderRadius: 999,
15451
15456
  maxWidth: 160,
15452
15457
  '& .MuiChip-label': {
@@ -15458,35 +15463,36 @@ const Tags = ({ tags, t, onEditTags }) => {
15458
15463
 
15459
15464
  var Delete = {};
15460
15465
 
15461
- var _interopRequireDefault$5 = interopRequireDefaultExports;
15466
+ var _interopRequireDefault$c = interopRequireDefaultExports;
15462
15467
  Object.defineProperty(Delete, "__esModule", {
15463
15468
  value: true
15464
15469
  });
15465
- var default_1$6 = Delete.default = void 0;
15466
- var _createSvgIcon$5 = _interopRequireDefault$5(requireCreateSvgIcon());
15467
- var _jsxRuntime$5 = jsxRuntimeExports;
15468
- default_1$6 = Delete.default = (0, _createSvgIcon$5.default)( /*#__PURE__*/(0, _jsxRuntime$5.jsx)("path", {
15470
+ var default_1$d = Delete.default = void 0;
15471
+ var _createSvgIcon$c = _interopRequireDefault$c(requireCreateSvgIcon());
15472
+ var _jsxRuntime$c = jsxRuntimeExports;
15473
+ default_1$d = Delete.default = (0, _createSvgIcon$c.default)( /*#__PURE__*/(0, _jsxRuntime$c.jsx)("path", {
15469
15474
  d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"
15470
15475
  }), 'Delete');
15471
15476
 
15472
15477
  var PhotoCamera = {};
15473
15478
 
15474
- var _interopRequireDefault$4 = interopRequireDefaultExports;
15479
+ var _interopRequireDefault$b = interopRequireDefaultExports;
15475
15480
  Object.defineProperty(PhotoCamera, "__esModule", {
15476
15481
  value: true
15477
15482
  });
15478
- var default_1$5 = PhotoCamera.default = void 0;
15479
- var _createSvgIcon$4 = _interopRequireDefault$4(requireCreateSvgIcon());
15480
- var _jsxRuntime$4 = jsxRuntimeExports;
15481
- default_1$5 = PhotoCamera.default = (0, _createSvgIcon$4.default)([/*#__PURE__*/(0, _jsxRuntime$4.jsx)("circle", {
15483
+ var default_1$c = PhotoCamera.default = void 0;
15484
+ var _createSvgIcon$b = _interopRequireDefault$b(requireCreateSvgIcon());
15485
+ var _jsxRuntime$b = jsxRuntimeExports;
15486
+ default_1$c = PhotoCamera.default = (0, _createSvgIcon$b.default)([/*#__PURE__*/(0, _jsxRuntime$b.jsx)("circle", {
15482
15487
  cx: "12",
15483
15488
  cy: "12",
15484
15489
  r: "3.2"
15485
- }, "0"), /*#__PURE__*/(0, _jsxRuntime$4.jsx)("path", {
15490
+ }, "0"), /*#__PURE__*/(0, _jsxRuntime$b.jsx)("path", {
15486
15491
  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"
15487
15492
  }, "1")], 'PhotoCamera');
15488
15493
 
15489
- const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading, isDeleting, t, }) => {
15494
+ const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading, isDeleting, }) => {
15495
+ const t = useTranslationContext();
15490
15496
  return (jsxRuntimeExports.jsxs(material.Box, { sx: {
15491
15497
  width: 60,
15492
15498
  height: 60,
@@ -15515,11 +15521,11 @@ const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading,
15515
15521
  color: 'common.white',
15516
15522
  bgcolor: 'rgba(0, 0, 0, 0.25)',
15517
15523
  '&:hover': { bgcolor: 'rgba(0, 0, 0, 0.35)' },
15518
- }, children: jsxRuntimeExports.jsx(default_1$5, { fontSize: "small" }) }), jsxRuntimeExports.jsx(material.IconButton, { size: "small", "aria-label": t('avatar.delete'), onClick: onDelete, disabled: Boolean(isDeleting), sx: {
15524
+ }, children: jsxRuntimeExports.jsx(default_1$c, { fontSize: "small" }) }), jsxRuntimeExports.jsx(material.IconButton, { size: "small", "aria-label": t('avatar.delete'), onClick: onDelete, disabled: Boolean(isDeleting), sx: {
15519
15525
  color: 'common.white',
15520
15526
  bgcolor: 'rgba(0, 0, 0, 0.25)',
15521
15527
  '&:hover': { bgcolor: 'rgba(0, 0, 0, 0.35)' },
15522
- }, children: jsxRuntimeExports.jsx(default_1$6, { fontSize: "small" }) })] })] }));
15528
+ }, children: jsxRuntimeExports.jsx(default_1$d, { fontSize: "small" }) })] })] }));
15523
15529
  };
15524
15530
 
15525
15531
  const HeaderContainer = material.styled(material.Box)({
@@ -15537,34 +15543,34 @@ const ContactName = material.styled(material.Typography)({
15537
15543
  maxWidth: 360,
15538
15544
  textAlign: 'center',
15539
15545
  });
15540
- const Header = ({ imgUrl, displayName, onError, tags, t, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
15546
+ const Header = ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
15541
15547
  const avatarAlt = `Avatar for ${displayName}`;
15542
- 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 })] }));
15548
+ 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 })] }));
15543
15549
  };
15544
15550
 
15545
15551
  var ArrowBack = {};
15546
15552
 
15547
- var _interopRequireDefault$3 = interopRequireDefaultExports;
15553
+ var _interopRequireDefault$a = interopRequireDefaultExports;
15548
15554
  Object.defineProperty(ArrowBack, "__esModule", {
15549
15555
  value: true
15550
15556
  });
15551
- var default_1$4 = ArrowBack.default = void 0;
15552
- var _createSvgIcon$3 = _interopRequireDefault$3(requireCreateSvgIcon());
15553
- var _jsxRuntime$3 = jsxRuntimeExports;
15554
- default_1$4 = ArrowBack.default = (0, _createSvgIcon$3.default)( /*#__PURE__*/(0, _jsxRuntime$3.jsx)("path", {
15557
+ var default_1$b = ArrowBack.default = void 0;
15558
+ var _createSvgIcon$a = _interopRequireDefault$a(requireCreateSvgIcon());
15559
+ var _jsxRuntime$a = jsxRuntimeExports;
15560
+ default_1$b = ArrowBack.default = (0, _createSvgIcon$a.default)( /*#__PURE__*/(0, _jsxRuntime$a.jsx)("path", {
15555
15561
  d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"
15556
15562
  }), 'ArrowBack');
15557
15563
 
15558
15564
  var Save = {};
15559
15565
 
15560
- var _interopRequireDefault$2 = interopRequireDefaultExports;
15566
+ var _interopRequireDefault$9 = interopRequireDefaultExports;
15561
15567
  Object.defineProperty(Save, "__esModule", {
15562
15568
  value: true
15563
15569
  });
15564
- var default_1$3 = Save.default = void 0;
15565
- var _createSvgIcon$2 = _interopRequireDefault$2(requireCreateSvgIcon());
15566
- var _jsxRuntime$2 = jsxRuntimeExports;
15567
- default_1$3 = Save.default = (0, _createSvgIcon$2.default)( /*#__PURE__*/(0, _jsxRuntime$2.jsx)("path", {
15570
+ var default_1$a = Save.default = void 0;
15571
+ var _createSvgIcon$9 = _interopRequireDefault$9(requireCreateSvgIcon());
15572
+ var _jsxRuntime$9 = jsxRuntimeExports;
15573
+ default_1$a = Save.default = (0, _createSvgIcon$9.default)( /*#__PURE__*/(0, _jsxRuntime$9.jsx)("path", {
15568
15574
  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"
15569
15575
  }), 'Save');
15570
15576
 
@@ -15573,11 +15579,11 @@ var useThemeWithoutDefault = {};
15573
15579
  Object.defineProperty(useThemeWithoutDefault, "__esModule", {
15574
15580
  value: true
15575
15581
  });
15576
- var default_1$2 = useThemeWithoutDefault.default = void 0;
15577
- var React = _interopRequireWildcard(React$1);
15582
+ var default_1$9 = useThemeWithoutDefault.default = void 0;
15583
+ var React = _interopRequireWildcard$1(React$1);
15578
15584
  var _styledEngine = require$$1$1;
15579
- 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); }
15580
- 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; }
15585
+ 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); }
15586
+ 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; }
15581
15587
  function isObjectEmpty$2(obj) {
15582
15588
  return Object.keys(obj).length === 0;
15583
15589
  }
@@ -15585,7 +15591,7 @@ function useTheme$3(defaultTheme = null) {
15585
15591
  const contextTheme = React.useContext(_styledEngine.ThemeContext);
15586
15592
  return !contextTheme || isObjectEmpty$2(contextTheme) ? defaultTheme : contextTheme;
15587
15593
  }
15588
- default_1$2 = useThemeWithoutDefault.default = useTheme$3;
15594
+ default_1$9 = useThemeWithoutDefault.default = useTheme$3;
15589
15595
 
15590
15596
  var top = 'top';
15591
15597
  var bottom = 'bottom';
@@ -18502,7 +18508,7 @@ const getSideFromDirection = direction => {
18502
18508
  'column-reverse': 'Bottom'
18503
18509
  }[direction];
18504
18510
  };
18505
- const style = ({
18511
+ const style$3 = ({
18506
18512
  ownerState,
18507
18513
  theme
18508
18514
  }) => {
@@ -18579,7 +18585,7 @@ function createStack(options = {}) {
18579
18585
  };
18580
18586
  return composeClasses$2(slots, slot => generateUtilityClass$2(componentName, slot), {});
18581
18587
  };
18582
- const StackRoot = createStyledComponent(style);
18588
+ const StackRoot = createStyledComponent(style$3);
18583
18589
  const Stack = /*#__PURE__*/React__namespace.forwardRef(function Grid(inProps, ref) {
18584
18590
  const themeProps = useThemeProps(inProps);
18585
18591
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
@@ -18672,7 +18678,7 @@ const PopperRoot = styled$3(BasePopper, {
18672
18678
  */
18673
18679
  const Popper = /*#__PURE__*/React__namespace.forwardRef(function Popper(inProps, ref) {
18674
18680
  var _slots$root;
18675
- const theme = default_1$2();
18681
+ const theme = default_1$9();
18676
18682
  const props = useDefaultProps({
18677
18683
  props: inProps,
18678
18684
  name: 'MuiPopper'
@@ -24574,7 +24580,8 @@ const PAGE_SIZE = 20;
24574
24580
  const AutocompletePopper = styled$3(MuiPopper)(({ theme }) => ({
24575
24581
  zIndex: theme.zIndex.modal + 1,
24576
24582
  }));
24577
- const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, t }) => {
24583
+ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving }) => {
24584
+ const t = useTranslationContext();
24578
24585
  const [searchValue, setSearchValue] = React$1.useState('');
24579
24586
  const [limit, setLimit] = React$1.useState(PAGE_SIZE);
24580
24587
  const safeOptions = React$1.useMemo(() => options ?? [], [options]);
@@ -24589,7 +24596,7 @@ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, t }) =
24589
24596
  if (nearBottom)
24590
24597
  setLimit((l) => l + PAGE_SIZE);
24591
24598
  };
24592
- return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(material.Stack, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 2 }, children: [jsxRuntimeExports.jsx(material.IconButton, { size: "small", onClick: onBack, "aria-label": t('global.back'), disabled: isSaving, children: jsxRuntimeExports.jsx(default_1$4, { fontSize: "small" }) }), jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", children: t('tags') }), jsxRuntimeExports.jsx(material.Box, { 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(material.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(material.Chip, { label: option.name ?? '', ...getTagProps({ index }) }))), size: "small", renderInput: (params) => jsxRuntimeExports.jsx(material.TextField, { ...params, size: "small" }), ListboxProps: {
24599
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsxs(material.Stack, { direction: "row", alignItems: "center", spacing: 1, sx: { mb: 2 }, children: [jsxRuntimeExports.jsx(material.IconButton, { size: "small", onClick: onBack, "aria-label": t('global.back'), disabled: isSaving, children: jsxRuntimeExports.jsx(default_1$b, { fontSize: "small" }) }), jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", children: t('tags') }), jsxRuntimeExports.jsx(material.Box, { 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(material.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(material.Chip, { label: option.name ?? '', ...getTagProps({ index }) }))), size: "small", renderInput: (params) => jsxRuntimeExports.jsx(material.TextField, { ...params, size: "small" }), ListboxProps: {
24593
24600
  onScroll: onListboxScroll,
24594
24601
  sx: { maxHeight: 280, overflowY: 'auto' },
24595
24602
  }, noOptionsText: t('global.noOptions'), sx: { width: '100%' } })] }));
@@ -25373,10 +25380,10 @@ class WebChatChannel {
25373
25380
  }
25374
25381
  WebChat.WebChatChannel = WebChatChannel;
25375
25382
 
25376
- var WhatsApp = {};
25383
+ var WhatsApp$1 = {};
25377
25384
 
25378
- Object.defineProperty(WhatsApp, "__esModule", { value: true });
25379
- WhatsApp.WhatsAppConfig = WhatsApp.WhatsAppConectionType = void 0;
25385
+ Object.defineProperty(WhatsApp$1, "__esModule", { value: true });
25386
+ WhatsApp$1.WhatsAppConfig = WhatsApp$1.WhatsAppConectionType = void 0;
25380
25387
  var WhatsAppConectionType;
25381
25388
  (function (WhatsAppConectionType) {
25382
25389
  // NULL = 0,
@@ -25384,21 +25391,21 @@ var WhatsAppConectionType;
25384
25391
  // TWILIO = 2,
25385
25392
  // DIALOG360 = 6,
25386
25393
  WhatsAppConectionType[WhatsAppConectionType["CLOUDAPI"] = 7] = "CLOUDAPI";
25387
- })(WhatsAppConectionType || (WhatsApp.WhatsAppConectionType = WhatsAppConectionType = {}));
25394
+ })(WhatsAppConectionType || (WhatsApp$1.WhatsAppConectionType = WhatsAppConectionType = {}));
25388
25395
  class WhatsAppConfig {
25389
25396
  }
25390
- WhatsApp.WhatsAppConfig = WhatsAppConfig;
25397
+ WhatsApp$1.WhatsAppConfig = WhatsAppConfig;
25391
25398
 
25392
- var RCS = {};
25399
+ var RCS$1 = {};
25393
25400
 
25394
- Object.defineProperty(RCS, "__esModule", { value: true });
25395
- RCS.RCSServiceAccount = RCS.RCSConfig = void 0;
25401
+ Object.defineProperty(RCS$1, "__esModule", { value: true });
25402
+ RCS$1.RCSServiceAccount = RCS$1.RCSConfig = void 0;
25396
25403
  class RCSConfig {
25397
25404
  }
25398
- RCS.RCSConfig = RCSConfig;
25405
+ RCS$1.RCSConfig = RCSConfig;
25399
25406
  class RCSServiceAccount {
25400
25407
  }
25401
- RCS.RCSServiceAccount = RCSServiceAccount;
25408
+ RCS$1.RCSServiceAccount = RCSServiceAccount;
25402
25409
 
25403
25410
  (function (exports) {
25404
25411
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -25429,8 +25436,8 @@ RCS.RCSServiceAccount = RCSServiceAccount;
25429
25436
  __exportStar(Sip, exports);
25430
25437
  __exportStar(Sms, exports);
25431
25438
  __exportStar(WebChat, exports);
25432
- __exportStar(WhatsApp, exports);
25433
- __exportStar(RCS, exports);
25439
+ __exportStar(WhatsApp$1, exports);
25440
+ __exportStar(RCS$1, exports);
25434
25441
  } (Channels));
25435
25442
 
25436
25443
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
@@ -26325,6 +26332,20 @@ const resolveUserLabel = ({ userId, users, currentUser, }) => {
26325
26332
  return fromUsers?.name?.trim() || fromUsers?.email || null;
26326
26333
  };
26327
26334
 
26335
+ const Section = ({ title, children }) => {
26336
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: {
26337
+ border: '1px solid',
26338
+ borderColor: 'divider',
26339
+ borderRadius: 2,
26340
+ p: 2,
26341
+ mb: 2,
26342
+ }, children: [jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", sx: { fontWeight: 600 }, children: title }), jsxRuntimeExports.jsx(material.Divider, { sx: { my: 1.5 } }), children] }));
26343
+ };
26344
+
26345
+ const SectionContent = ({ children, ...boxProps }) => {
26346
+ return (jsxRuntimeExports.jsx(material.Box, { display: "grid", gridTemplateColumns: { xs: '1fr', md: 'repeat(2, minmax(0, 1fr))' }, gap: 2, ...boxProps, children: children }));
26347
+ };
26348
+
26328
26349
  var weekOfYear = {exports: {}};
26329
26350
 
26330
26351
  (function (module, exports) {
@@ -52411,20 +52432,20 @@ const DateSelect = ({ birthDate, setBirthDate, dateFormat }) => {
52411
52432
 
52412
52433
  var Cancel = {};
52413
52434
 
52414
- var _interopRequireDefault$1 = interopRequireDefaultExports;
52435
+ var _interopRequireDefault$8 = interopRequireDefaultExports;
52415
52436
  Object.defineProperty(Cancel, "__esModule", {
52416
52437
  value: true
52417
52438
  });
52418
- var default_1$1 = Cancel.default = void 0;
52419
- var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
52420
- var _jsxRuntime$1 = jsxRuntimeExports;
52421
- default_1$1 = Cancel.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
52439
+ var default_1$8 = Cancel.default = void 0;
52440
+ var _createSvgIcon$8 = _interopRequireDefault$8(requireCreateSvgIcon());
52441
+ var _jsxRuntime$8 = jsxRuntimeExports;
52442
+ default_1$8 = Cancel.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _jsxRuntime$8.jsx)("path", {
52422
52443
  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"
52423
52444
  }), 'Cancel');
52424
52445
 
52425
52446
  const isUserInfo = (option) => 'email' in option;
52426
52447
  const isContactBirthdayProps = (p) => p.entityType === 'contact' && p.inputType === 'birthday';
52427
- const StyledIconButton$1 = material.styled(material.IconButton)({
52448
+ const StyledIconButton$3 = material.styled(material.IconButton)({
52428
52449
  opacity: 0,
52429
52450
  transition: 'opacity 0.3s ease-in-out',
52430
52451
  '& .MuiSvgIcon-root': {
@@ -52441,6 +52462,7 @@ const StyledSaveCancelButton$1 = material.styled(material.IconButton)({
52441
52462
  });
52442
52463
  const EntityInfoLabel = (props) => {
52443
52464
  const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated, } = props;
52465
+ const t = useTranslationContext();
52444
52466
  const inputType = props.inputType ?? 'text';
52445
52467
  const [isEditing, setIsEditing] = React$1.useState(false);
52446
52468
  const [isSaving, setIsSaving] = React$1.useState(false);
@@ -52553,18 +52575,18 @@ const EntityInfoLabel = (props) => {
52553
52575
  '&:hover .edit-icon': {
52554
52576
  opacity: 1,
52555
52577
  },
52556
- }, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(material.Typography, { letterSpacing: -0.5, fontWeight: '600', alignSelf: 'center', flexGrow: isEditing ? 1 : 0, color: (theme) => theme.palette.text.primary, children: title }), isNotEditable ? null : isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$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(material.Box, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(material.TextField, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(material.Select, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(material.MenuItem, { value: "", children: props.t('contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(material.MenuItem, { value: option.id, children: props.entityType === 'contact'
52578
+ }, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(material.Typography, { letterSpacing: -0.5, fontWeight: '600', alignSelf: 'center', flexGrow: isEditing ? 1 : 0, color: (theme) => theme.palette.text.primary, children: title }), isNotEditable ? null : isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$3, { className: "edit-icon", size: "small", onClick: handleEditClick, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(material.Box, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(material.TextField, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(material.Select, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(material.MenuItem, { value: "", children: t('contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(material.MenuItem, { value: option.id, children: props.entityType === 'contact'
52557
52579
  ? option.name?.trim() || (isUserInfo(option) ? option.email : '') || 'Sin nombre'
52558
52580
  : option.name?.trim() || option.email || 'Sin nombre' }, index)))] })) : isEditing && isContactBirthdayProps(props) ? (jsxRuntimeExports.jsx(DateSelect, { birthDate: props.contact.field.birthDate, setBirthDate: props.contact.action.setBirthDate, dateFormat: props.dateFormat })) : !isEditing && props.entityType === 'contact' && inputType === 'selectBusiness' && props.businessId ? (jsxRuntimeExports.jsx(material.Box, { display: "flex", alignItems: "center", children: "Popover" })) : (jsxRuntimeExports.jsx(material.Typography, { fontWeight: '400', sx: { padding: '2.5px 14px 8.5px 0px' }, color: (theme) => theme.palette.text.primary, children: displayValue || (typeof value === 'string' && value) || '-' })) })] }));
52559
52581
  };
52560
52582
 
52561
52583
  const ContactInfoLabel = (props) => {
52562
- const { title, value, isNotEditable, options = [], displayValue, constructUpdateObject, businessId, baseUrl, spaceId, contactId, t, onEntityUpdated, } = props;
52584
+ const { title, value, isNotEditable, options = [], displayValue, constructUpdateObject, businessId, baseUrl, spaceId, contactId, onEntityUpdated, } = props;
52563
52585
  if (props.inputType === 'birthday') {
52564
- 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 }));
52586
+ 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 }));
52565
52587
  }
52566
52588
  const inputType = props.inputType ?? 'text';
52567
- 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 }));
52589
+ 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 }));
52568
52590
  };
52569
52591
 
52570
52592
  const CustomPropertyInput = ({ nameKey, value, onChange, type, }) => {
@@ -52622,7 +52644,8 @@ const CustomPropertyDatePicker = ({ value, handleChange, dateFormat }) => {
52622
52644
  } }) }) }));
52623
52645
  };
52624
52646
 
52625
- const CustomPropertyOptionsSelect = ({ handleChange, value, options, t }) => {
52647
+ const CustomPropertyOptionsSelect = ({ handleChange, value, options }) => {
52648
+ const t = useTranslationContext();
52626
52649
  return (jsxRuntimeExports.jsx(material.FormControl, { className: "fadein", sx: { width: '100%' }, children: jsxRuntimeExports.jsxs(material.Select, { value: value, onChange: (e) => handleChange(e.target.value), size: "small", variant: "standard", children: [jsxRuntimeExports.jsx(material.MenuItem, { value: "", children: t('global.noValue') }), options.map((option, i) => (jsxRuntimeExports.jsx(material.MenuItem, { value: option, children: option }, i)))] }) }));
52627
52650
  };
52628
52651
 
@@ -54320,7 +54343,8 @@ MultiInputTimeRangeField.propTypes = {
54320
54343
  value: PropTypes.arrayOf(PropTypes.object)
54321
54344
  };
54322
54345
 
54323
- const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat, t, }) => {
54346
+ const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat }) => {
54347
+ const t = useTranslationContext();
54324
54348
  const initDates = [
54325
54349
  dayjs().set('hour', 0).set('minute', 0),
54326
54350
  dayjs().set('hour', 0).set('minute', 0),
@@ -54328,9 +54352,7 @@ const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat, t,
54328
54352
  const timeFormat = userTimeFormat === '24' ? 'HH:mm' : 'hh:mm';
54329
54353
  return (jsxRuntimeExports.jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: jsxRuntimeExports.jsx(Box$1, { sx: { overflow: 'visible', paddingTop: '0px' }, children: jsxRuntimeExports.jsx(MultiInputTimeRangeField, { slotProps: {
54330
54354
  textField: ({ position }) => ({
54331
- label: position === 'start'
54332
- ? t('contactEdit.from')
54333
- : t('contactEdit.to'),
54355
+ label: position === 'start' ? t('contactEdit.from') : t('contactEdit.to'),
54334
54356
  size: 'small',
54335
54357
  variant: 'standard',
54336
54358
  inputProps: {
@@ -54340,7 +54362,8 @@ const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat, t,
54340
54362
  }, value: value ? value : initDates, onChange: (newValue) => handleChange(newValue), format: timeFormat }) }) }));
54341
54363
  };
54342
54364
 
54343
- const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat, t }) => {
54365
+ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat }) => {
54366
+ const t = useTranslationContext();
54344
54367
  // Default date range if value is null
54345
54368
  const initDates = [dayjs(), dayjs()];
54346
54369
  // Determina el formato dinámico
@@ -54360,7 +54383,7 @@ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat, t
54360
54383
  }, value: value || initDates, onChange: (newValue) => handleChange(newValue), format: dateFormat }) }) }));
54361
54384
  };
54362
54385
 
54363
- const StyledIconButton = material.styled(material.IconButton)(() => ({
54386
+ const StyledIconButton$2 = material.styled(material.IconButton)(() => ({
54364
54387
  opacity: 0,
54365
54388
  transition: 'opacity 0.3s ease-in-out',
54366
54389
  '& .MuiSvgIcon-root': {
@@ -54400,7 +54423,7 @@ const FieldValue = material.styled(material.Typography)(({ theme }) => ({
54400
54423
  overflow: 'auto',
54401
54424
  whiteSpace: 'break-spaces',
54402
54425
  }));
54403
- const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, customContactFields, userTrii, baseUrl, spaceId, t, onEntityUpdated, }) => {
54426
+ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, customContactFields, userTrii, baseUrl, spaceId, onEntityUpdated, }) => {
54404
54427
  const { customProperties } = entity.field;
54405
54428
  const { setCustomProperties } = entity.action;
54406
54429
  const [isEditing, setIsEditing] = React$1.useState(false);
@@ -54440,8 +54463,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54440
54463
  if (!entityId)
54441
54464
  return;
54442
54465
  setIsSaving(true);
54443
- const current = customProperties.find((p) => p.nameKey === property.nameKey) ||
54444
- property;
54466
+ const current = customProperties.find((p) => p.nameKey === property.nameKey) || property;
54445
54467
  const { nameKey, value } = current;
54446
54468
  // Definición del campo (si existe)
54447
54469
  const fieldDef = customContactFields.find((f) => f.nameKey === nameKey);
@@ -54552,25 +54574,18 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54552
54574
  : null, handleChange: (newValue) => handleInputChange(nameKey, newValue), userTimeFormat: userTimeFormat }));
54553
54575
  else if (type === Contacts.ContactField_type.DATERANGE)
54554
54576
  return (jsxRuntimeExports.jsx(CustomPropertyDateRangePicker, { value: value && typeof value === 'string' && value.includes(' - ')
54555
- ? [
54556
- dayjs(value.split(' - ')[0]),
54557
- dayjs(value.split(' - ')[1]),
54558
- ]
54559
- : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userDateFormat: userDateFormat, t: t }));
54577
+ ? [dayjs(value.split(' - ')[0]), dayjs(value.split(' - ')[1])]
54578
+ : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userDateFormat: userDateFormat }));
54560
54579
  else if (type === Contacts.ContactField_type.TIMERANGE)
54561
54580
  return (jsxRuntimeExports.jsx(CustomPropertyTimeRangePicker, { value: Array.isArray(value) && value.length === 2
54562
54581
  ? [dayjs(value[0]), dayjs(value[1])]
54563
- : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userTimeFormat: userTimeFormat, t: t }));
54582
+ : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userTimeFormat: userTimeFormat }));
54564
54583
  else if (type === Contacts.ContactField_type.OPTIONS)
54565
- return (jsxRuntimeExports.jsx(CustomPropertyOptionsSelect, { value: typeof value === 'string' ? value : '', handleChange: (newValue) => handleInputChange(nameKey, newValue), options: customContactFields.find((field) => field.nameKey === nameKey)?.typeOptions ?? [], t: t }));
54584
+ return (jsxRuntimeExports.jsx(CustomPropertyOptionsSelect, { value: typeof value === 'string' ? value : '', handleChange: (newValue) => handleInputChange(nameKey, newValue), options: customContactFields.find((field) => field.nameKey === nameKey)?.typeOptions ?? [] }));
54566
54585
  else
54567
54586
  return (jsxRuntimeExports.jsx(CustomPropertyInput, { type: type, nameKey: nameKey, value: value, onChange: handleInputChange }));
54568
54587
  };
54569
- return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT
54570
- ? 'contacts-col-12'
54571
- : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: "25px", children: [jsxRuntimeExports.jsx(FieldName, { flexGrow: isEditing ? 1 : 0, children: getPropertyName(property.nameKey) }), isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$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(material.Box, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT
54572
- ? '100%'
54573
- : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
54588
+ return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT ? 'contacts-col-12' : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: "25px", children: [jsxRuntimeExports.jsx(FieldName, { flexGrow: isEditing ? 1 : 0, children: getPropertyName(property.nameKey) }), isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$2, { className: "edit-icon", size: "small", onClick: toggleEdit, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(material.Box, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT ? '100%' : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
54574
54589
  ? property.type === Contacts.ContactField_type.DATERANGE
54575
54590
  ? (() => {
54576
54591
  if (typeof property.value === 'string') {
@@ -54619,7 +54634,8 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54619
54634
  };
54620
54635
 
54621
54636
  const ContactGeneral = (props) => {
54622
- const { dateFormat, entityData, customContactFields, baseUrl, spaceId, t, currentUser, onEntityUpdated } = props;
54637
+ const { dateFormat, entityData, customContactFields, baseUrl, spaceId, currentUser, onEntityUpdated, } = props;
54638
+ const t = useTranslationContext();
54623
54639
  const { entityType, editEntity } = useEditEntity();
54624
54640
  const api = useEditContactApi();
54625
54641
  if (entityType !== 'contact') {
@@ -54697,9 +54713,9 @@ const ContactGeneral = (props) => {
54697
54713
  };
54698
54714
  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) => ({
54699
54715
  owner: typeof value === 'string' ? value : '',
54700
- }), 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) => ({
54716
+ }), 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) => ({
54701
54717
  birthDate: value,
54702
- }), 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)))] }) }));
54718
+ }), 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)))] }) }));
54703
54719
  };
54704
54720
 
54705
54721
  const BusinessInfoLabel = ({ title, value, isNotEditable, inputType = 'text', options = [], displayValue, constructUpdateObject, baseUrl, spaceId, businessId, onEntityUpdated, }) => {
@@ -54707,7 +54723,8 @@ const BusinessInfoLabel = ({ title, value, isNotEditable, inputType = 'text', op
54707
54723
  };
54708
54724
 
54709
54725
  const BusinessGeneral = (props) => {
54710
- const { entityData, customContactFields, baseUrl, spaceId, t, currentUser, onEntityUpdated } = props;
54726
+ const t = useTranslationContext();
54727
+ const { entityData, customContactFields, baseUrl, spaceId, currentUser, onEntityUpdated } = props;
54711
54728
  const { entityType, editEntity } = useEditEntity();
54712
54729
  const api = useEditContactApi();
54713
54730
  if (entityType !== 'business') {
@@ -54773,7 +54790,7 @@ const BusinessGeneral = (props) => {
54773
54790
  }, [api, entityData, users, currentUser]);
54774
54791
  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) => ({
54775
54792
  owner: typeof value === 'string' ? value : '',
54776
- }), 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)))] }) }));
54793
+ }), 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)))] }) }));
54777
54794
  };
54778
54795
 
54779
54796
  const General = (props) => {
@@ -54786,7 +54803,22 @@ const General = (props) => {
54786
54803
  return normalizedEntityType === 'contact' ? (jsxRuntimeExports.jsx(ContactGeneral, { ...props, entityData: entityData, entityType: "contact" })) : (jsxRuntimeExports.jsx(BusinessGeneral, { ...props, entityData: entityData, entityType: "business" }));
54787
54804
  };
54788
54805
 
54789
- styled$1(material.Box)(({ theme }) => ({
54806
+ // useModal.ts
54807
+ const useEditModal = () => {
54808
+ const [isOpen, setIsOpen] = React$1.useState(false);
54809
+ const [title, setTitle] = React$1.useState('');
54810
+ const openModal = (title) => {
54811
+ setTitle(title);
54812
+ setIsOpen(true);
54813
+ };
54814
+ const closeModal = () => {
54815
+ setIsOpen(false);
54816
+ setTitle(''); // Clear the title when the modal closes
54817
+ };
54818
+ return { isOpen, title, openModal, closeModal };
54819
+ };
54820
+
54821
+ const StyledBox$2 = styled$1(material.Box)(({ theme }) => ({
54790
54822
  display: 'flex',
54791
54823
  alignItems: 'flex-start',
54792
54824
  justifyContent: 'space-between',
@@ -54799,19 +54831,19 @@ styled$1(material.Box)(({ theme }) => ({
54799
54831
  minHeight: '50px',
54800
54832
  position: 'relative',
54801
54833
  }));
54802
- styled$1(material.Box)(({ theme }) => ({
54834
+ const LeftSection$1 = styled$1(material.Box)(({ theme }) => ({
54803
54835
  display: 'flex',
54804
54836
  alignItems: 'flex-start',
54805
54837
  gap: theme.spacing(1),
54806
54838
  overflow: 'hidden',
54807
54839
  maxWidth: '80%',
54808
54840
  }));
54809
- styled$1(material.Box)(({ theme }) => ({
54841
+ const RightSection$1 = styled$1(material.Box)(({ theme }) => ({
54810
54842
  display: 'flex',
54811
54843
  alignItems: 'center',
54812
54844
  gap: theme.spacing(1),
54813
54845
  }));
54814
- styled$1(material.Box)(({ theme }) => ({
54846
+ const ContactDetails$1 = styled$1(material.Box)(({ theme }) => ({
54815
54847
  display: 'flex',
54816
54848
  flexDirection: 'column',
54817
54849
  alignItems: 'flex-start',
@@ -54821,7 +54853,7 @@ styled$1(material.Box)(({ theme }) => ({
54821
54853
  flexWrap: 'wrap',
54822
54854
  marginTop: '-5px',
54823
54855
  }));
54824
- styled$1(material.Avatar)(({}) => ({
54856
+ const AvatarWrapper = styled$1(material.Avatar)(({}) => ({
54825
54857
  width: 32,
54826
54858
  height: 32,
54827
54859
  cursor: 'pointer',
@@ -54833,32 +54865,51 @@ const EllipsisText$1 = styled$1(material.Box)(({}) => ({
54833
54865
  overflow: 'hidden',
54834
54866
  textOverflow: 'ellipsis',
54835
54867
  }));
54836
- styled$1(EllipsisText$1)(({ theme }) => ({
54868
+ const NoteText$1 = styled$1(EllipsisText$1)(({ theme }) => ({
54837
54869
  fontSize: 12,
54838
54870
  color: theme.palette.text.secondary,
54839
54871
  position: 'absolute',
54840
54872
  bottom: 0,
54841
54873
  maxWidth: '70%',
54842
54874
  }));
54843
- styled$1(EllipsisText$1)(({}) => ({
54875
+ const PhoneText$1 = styled$1(EllipsisText$1)(({}) => ({
54844
54876
  fontSize: 14,
54845
54877
  fontWeight: 500,
54846
54878
  }));
54847
- styled$1(EllipsisText$1)(({}) => ({
54879
+ const ProfileNameText = styled$1(EllipsisText$1)(({}) => ({
54848
54880
  fontSize: 14,
54849
54881
  fontWeight: 500,
54850
54882
  }));
54883
+ const ContactMethodItem = ({ item }) => {
54884
+ const avatarUrlWithoutAccess = item.profileUrl;
54885
+ const { imageUrl } = useImage({
54886
+ initialImageUrl: avatarUrlWithoutAccess,
54887
+ });
54888
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$2, { children: [jsxRuntimeExports.jsx(LeftSection$1, { children: jsxRuntimeExports.jsxs(ContactDetails$1, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: item.address || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText$1, { children: item.address }) }), jsxRuntimeExports.jsx(material.Tooltip, { title: item.profileName || '', arrow: true, children: jsxRuntimeExports.jsx(ProfileNameText, { sx: {
54889
+ marginTop: '-10px',
54890
+ marginLeft: '5px',
54891
+ fontSize: '10px',
54892
+ }, children: item.profileName }) }), jsxRuntimeExports.jsx(material.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(material.Box, { sx: {
54893
+ display: 'flex',
54894
+ alignItems: 'center',
54895
+ justifyContent: 'flex-end',
54896
+ }, children: jsxRuntimeExports.jsx(material.IconButton, { size: "small", sx: { marginTop: '-5px', padding: 0 }, children: item.isFavorite ? (jsxRuntimeExports.jsx(Star, { sx: {
54897
+ color: '#fcac34',
54898
+ } })) : (jsxRuntimeExports.jsx(StarBorder, { sx: {
54899
+ color: '#fcac34',
54900
+ } })) }) })] })] }) }));
54901
+ };
54851
54902
 
54852
54903
  var LocalPhone = {};
54853
54904
 
54854
- var _interopRequireDefault = interopRequireDefaultExports;
54905
+ var _interopRequireDefault$7 = interopRequireDefaultExports;
54855
54906
  Object.defineProperty(LocalPhone, "__esModule", {
54856
54907
  value: true
54857
54908
  });
54858
- var default_1 = LocalPhone.default = void 0;
54859
- var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
54860
- var _jsxRuntime = jsxRuntimeExports;
54861
- default_1 = LocalPhone.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
54909
+ var default_1$7 = LocalPhone.default = void 0;
54910
+ var _createSvgIcon$7 = _interopRequireDefault$7(requireCreateSvgIcon());
54911
+ var _jsxRuntime$7 = jsxRuntimeExports;
54912
+ default_1$7 = LocalPhone.default = (0, _createSvgIcon$7.default)( /*#__PURE__*/(0, _jsxRuntime$7.jsx)("path", {
54862
54913
  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"
54863
54914
  }), 'LocalPhone');
54864
54915
 
@@ -56072,18 +56123,38 @@ goog.TRUSTED_TYPES_POLICY_NAME="goog";goog.identity_=function(a){return a};
56072
56123
 
56073
56124
  var libphonenumberExports = libphonenumber.exports;
56074
56125
 
56075
- libphonenumberExports.PhoneNumberUtil.getInstance();
56126
+ const phoneUtil = libphonenumberExports.PhoneNumberUtil.getInstance();
56127
+ /**
56128
+ * Returns a user-friendly display format for a sanitized phone number.
56129
+ * Always uses INTERNATIONAL format, e.g. "+54 358 402 2664"
56130
+ */
56131
+ const formatPhoneForDisplay = (number) => {
56132
+ if (!number || !number.trim())
56133
+ return number;
56134
+ try {
56135
+ const parsed = phoneUtil.parse(number, undefined);
56136
+ if (!phoneUtil.isValidNumber(parsed)) {
56137
+ // If not valid, just return as-is
56138
+ return number;
56139
+ }
56140
+ // Always use INTERNATIONAL format
56141
+ return phoneUtil.format(parsed, libphonenumberExports.PhoneNumberFormat.INTERNATIONAL);
56142
+ }
56143
+ catch (e) {
56144
+ return number;
56145
+ }
56146
+ };
56076
56147
 
56077
- styled$1(material.IconButton)(({ theme }) => ({
56148
+ const StyledIconButton$1 = styled$1(material.IconButton)(({ theme }) => ({
56078
56149
  padding: theme.spacing(0.5),
56079
56150
  marginTop: '-5px',
56080
56151
  }));
56081
- styled$1(default_1)(({ theme }) => ({
56152
+ const StyledLocalPhoneIcon = styled$1(default_1$7)(({ theme }) => ({
56082
56153
  height: 16,
56083
56154
  width: 16,
56084
56155
  color: theme.palette.secondary.main
56085
56156
  }));
56086
- styled$1(material.Box)(({ theme }) => ({
56157
+ const StyledBox$1 = styled$1(material.Box)(({ theme }) => ({
56087
56158
  display: 'flex',
56088
56159
  alignItems: 'flex-start',
56089
56160
  justifyContent: 'space-between',
@@ -56096,18 +56167,18 @@ styled$1(material.Box)(({ theme }) => ({
56096
56167
  minHeight: '50px',
56097
56168
  position: 'relative',
56098
56169
  }));
56099
- styled$1(material.Box)(({ theme }) => ({
56170
+ const LeftSection = styled$1(material.Box)(({ theme }) => ({
56100
56171
  display: 'flex',
56101
56172
  alignItems: 'flex-start',
56102
56173
  gap: theme.spacing(1),
56103
56174
  maxWidth: '80%',
56104
56175
  }));
56105
- styled$1(material.Box)(({ theme }) => ({
56176
+ const RightSection = styled$1(material.Box)(({ theme }) => ({
56106
56177
  display: 'flex',
56107
56178
  alignItems: 'center',
56108
56179
  gap: theme.spacing(1),
56109
56180
  }));
56110
- styled$1(material.Box)(({ theme }) => ({
56181
+ const ContactDetails = styled$1(material.Box)(({ theme }) => ({
56111
56182
  display: 'flex',
56112
56183
  flexDirection: 'column',
56113
56184
  alignItems: 'flex-start',
@@ -56124,19 +56195,40 @@ const EllipsisText = styled$1(material.Box)(({}) => ({
56124
56195
  overflow: 'hidden',
56125
56196
  textOverflow: 'ellipsis',
56126
56197
  }));
56127
- styled$1(EllipsisText)(({ theme }) => ({
56198
+ const NoteText = styled$1(EllipsisText)(({ theme }) => ({
56128
56199
  fontSize: 12,
56129
56200
  color: theme.palette.text.secondary,
56130
56201
  position: 'absolute',
56131
56202
  bottom: 0,
56132
56203
  maxWidth: '70%',
56133
56204
  }));
56134
- styled$1(EllipsisText)(({}) => ({
56205
+ const PhoneText = styled$1(EllipsisText)(({}) => ({
56135
56206
  fontSize: 14,
56136
56207
  fontWeight: 500,
56137
56208
  }));
56209
+ const ContactMethodPhoneItem = ({ item }) => {
56210
+ const handleCallContact = () => {
56211
+ const contactPhone = item.address;
56212
+ if (!contactPhone)
56213
+ return;
56214
+ const event = new CustomEvent('call-contact-header', {
56215
+ detail: { phoneAddress: contactPhone },
56216
+ });
56217
+ window.dispatchEvent(event);
56218
+ };
56219
+ const formattedPhone = React$1.useMemo(() => formatPhoneForDisplay(item.address || ''), [item.address]);
56220
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$1, { children: [jsxRuntimeExports.jsxs(LeftSection, { children: [jsxRuntimeExports.jsx(StyledIconButton$1, { onClick: handleCallContact, color: "primary", size: "small", children: jsxRuntimeExports.jsx(StyledLocalPhoneIcon, {}) }), jsxRuntimeExports.jsxs(ContactDetails, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: formattedPhone || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText, { children: formattedPhone }) }), jsxRuntimeExports.jsx(material.Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText, { children: item.note }) })] })] }), jsxRuntimeExports.jsx(RightSection, { children: jsxRuntimeExports.jsx(material.Box, { sx: {
56221
+ display: 'flex',
56222
+ alignItems: 'center',
56223
+ justifyContent: 'flex-end',
56224
+ }, children: jsxRuntimeExports.jsx(material.IconButton, { size: "small", sx: { marginTop: '-5px', padding: 0 }, children: item.isFavorite ? (jsxRuntimeExports.jsx(Star, { sx: {
56225
+ color: '#fcac34',
56226
+ } })) : (jsxRuntimeExports.jsx(StarBorder, { sx: {
56227
+ color: '#fcac34',
56228
+ } })) }) }) })] }) }));
56229
+ };
56138
56230
 
56139
- styled$1(material.Box)(({ theme }) => ({
56231
+ const StyledBox = styled$1(material.Box)(({ theme }) => ({
56140
56232
  display: 'flex',
56141
56233
  flexDirection: 'column',
56142
56234
  padding: theme.spacing(1, 0, 2, 0),
@@ -56146,22 +56238,22 @@ styled$1(material.Box)(({ theme }) => ({
56146
56238
  opacity: 1,
56147
56239
  },
56148
56240
  }));
56149
- styled$1(material.Typography)(({ theme }) => ({
56241
+ const StyledTypography = styled$1(material.Typography)(({}) => ({
56150
56242
  letterSpacing: -0.5,
56151
56243
  fontSize: 14,
56152
56244
  fontWeight: 600,
56153
56245
  }));
56154
- styled$1(material.Box)(({ theme }) => ({
56246
+ const HeaderBox = styled$1(material.Box)(({}) => ({
56155
56247
  display: 'flex',
56156
56248
  alignItems: 'center',
56157
56249
  }));
56158
- styled$1(material.Box)(({ theme }) => ({
56250
+ const MethodItemsBox = styled$1(material.Box)(({ theme }) => ({
56159
56251
  display: 'flex',
56160
56252
  flexDirection: 'column',
56161
56253
  gap: theme.spacing(1),
56162
56254
  width: '100%',
56163
56255
  }));
56164
- styled$1(material.IconButton)({
56256
+ const StyledIconButton = styled$1(material.IconButton)({
56165
56257
  opacity: 0,
56166
56258
  transition: 'opacity 0.3s ease-in-out',
56167
56259
  '& .MuiSvgIcon-root': {
@@ -56170,8 +56262,669 @@ styled$1(material.IconButton)({
56170
56262
  },
56171
56263
  marginLeft: '15px',
56172
56264
  });
56265
+ const ContactMethod = ({ title, methodItems, isPhone, handleEdit, owner }) => {
56266
+ 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) => {
56267
+ if (isPhone) {
56268
+ return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56269
+ }
56270
+ return jsxRuntimeExports.jsx(ContactMethodItem, { item: item, owner: owner }, index);
56271
+ }) })] }) }));
56272
+ };
56273
+
56274
+ const SubsectionHeader = ({ title }) => {
56275
+ return (jsxRuntimeExports.jsx(material.Box, { children: jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle2", children: title }) }));
56276
+ };
56277
+
56278
+ const subsectionHeaderWithButtonStyle = {
56279
+ container: {
56280
+ display: 'flex',
56281
+ justifyContent: 'space-between',
56282
+ alignItems: 'center'
56283
+ },
56284
+ };
56285
+
56286
+ var Add = {};
56287
+
56288
+ var _interopRequireDefault$6 = interopRequireDefaultExports;
56289
+ Object.defineProperty(Add, "__esModule", {
56290
+ value: true
56291
+ });
56292
+ var default_1$6 = Add.default = void 0;
56293
+ var _createSvgIcon$6 = _interopRequireDefault$6(requireCreateSvgIcon());
56294
+ var _jsxRuntime$6 = jsxRuntimeExports;
56295
+ default_1$6 = Add.default = (0, _createSvgIcon$6.default)( /*#__PURE__*/(0, _jsxRuntime$6.jsx)("path", {
56296
+ d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"
56297
+ }), 'Add');
56298
+
56299
+ const SubsectionHeaderWithButton = ({ title, handleAdd, t }) => {
56300
+ const tFromContext = useTranslationContext();
56301
+ const translate = t || tFromContext;
56302
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: subsectionHeaderWithButtonStyle.container, children: [jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle2", children: title }), jsxRuntimeExports.jsx(material.Button, { onClick: handleAdd, size: "small", startIcon: jsxRuntimeExports.jsx(default_1$6, {}), variant: "text", color: "primary", children: translate('global.add') })] }));
56303
+ };
56304
+
56305
+ const informationItemContainerStyle = {
56306
+ container: {
56307
+ border: '1px solid lightgray',
56308
+ borderRadius: 1,
56309
+ p: 2,
56310
+ width: '100%',
56311
+ display: 'flex',
56312
+ flexDirection: 'column',
56313
+ gap: 1,
56314
+ },
56315
+ };
56316
+
56317
+ const InformationItemContainer = ({ children }) => {
56318
+ return jsxRuntimeExports.jsx(material.Box, { sx: informationItemContainerStyle.container, children: children });
56319
+ };
56320
+
56321
+ const noteDeleteButtonStyle = {
56322
+ container: {
56323
+ display: 'flex',
56324
+ width: '50%',
56325
+ alignItems: 'center',
56326
+ justifyContent: 'end'
56327
+ },
56328
+ noteTextField: {
56329
+ width: '100%',
56330
+ marginRight: '15px'
56331
+ },
56332
+ };
56333
+
56334
+ var MoreVert = {};
56335
+
56336
+ var _interopRequireDefault$5 = interopRequireDefaultExports;
56337
+ Object.defineProperty(MoreVert, "__esModule", {
56338
+ value: true
56339
+ });
56340
+ var default_1$5 = MoreVert.default = void 0;
56341
+ var _createSvgIcon$5 = _interopRequireDefault$5(requireCreateSvgIcon());
56342
+ var _jsxRuntime$5 = jsxRuntimeExports;
56343
+ default_1$5 = MoreVert.default = (0, _createSvgIcon$5.default)( /*#__PURE__*/(0, _jsxRuntime$5.jsx)("path", {
56344
+ 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"
56345
+ }), 'MoreVert');
56346
+
56347
+ var WhatsApp = {};
56348
+
56349
+ var _interopRequireDefault$4 = interopRequireDefaultExports;
56350
+ Object.defineProperty(WhatsApp, "__esModule", {
56351
+ value: true
56352
+ });
56353
+ var default_1$4 = WhatsApp.default = void 0;
56354
+ _interopRequireWildcard(React$1);
56355
+ var _createSvgIcon$4 = _interopRequireDefault$4(requireCreateSvgIcon());
56356
+ var _jsxRuntime$4 = jsxRuntimeExports;
56357
+ 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); }
56358
+ 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; }
56359
+ default_1$4 = WhatsApp.default = (0, _createSvgIcon$4.default)( /*#__PURE__*/(0, _jsxRuntime$4.jsx)("path", {
56360
+ 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"
56361
+ }), 'WhatsApp');
56362
+
56363
+ var Mms = {};
56364
+
56365
+ var _interopRequireDefault$3 = interopRequireDefaultExports;
56366
+ Object.defineProperty(Mms, "__esModule", {
56367
+ value: true
56368
+ });
56369
+ var default_1$3 = Mms.default = void 0;
56370
+ var _createSvgIcon$3 = _interopRequireDefault$3(requireCreateSvgIcon());
56371
+ var _jsxRuntime$3 = jsxRuntimeExports;
56372
+ default_1$3 = Mms.default = (0, _createSvgIcon$3.default)( /*#__PURE__*/(0, _jsxRuntime$3.jsx)("path", {
56373
+ 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"
56374
+ }), 'Mms');
56375
+
56376
+ const OptionsMenu = ({ onDelete, addressData, handleLinkAccountSave, checked, onCheckContactAddress, }) => {
56377
+ const t = useTranslationContext();
56378
+ const [anchorEl, setAnchorEl] = React$1.useState(null);
56379
+ const open = Boolean(anchorEl);
56380
+ const { channelType, address } = addressData;
56381
+ const [verifying, setVerifying] = React$1.useState(false);
56382
+ const [verificationResult, setVerificationResult] = React$1.useState(null);
56383
+ const [modalOpen, setModalOpen] = React$1.useState(false);
56384
+ const handleClick = (event) => {
56385
+ setAnchorEl(event.currentTarget);
56386
+ };
56387
+ const handleClose = () => {
56388
+ setAnchorEl(null);
56389
+ };
56390
+ const handleModalClose = () => {
56391
+ setModalOpen(false);
56392
+ };
56393
+ const handleDelete = () => {
56394
+ onDelete();
56395
+ handleClose();
56396
+ };
56397
+ const handleCheckWA = async () => {
56398
+ setVerifying(true);
56399
+ try {
56400
+ if (!onCheckContactAddress) {
56401
+ return;
56402
+ }
56403
+ const result = await onCheckContactAddress(13);
56404
+ if (!result) {
56405
+ return;
56406
+ }
56407
+ setVerificationResult(result);
56408
+ setModalOpen(true);
56409
+ }
56410
+ catch (error) {
56411
+ console.error('Error verifying WhatsApp account:', error);
56412
+ }
56413
+ finally {
56414
+ setVerifying(false);
56415
+ }
56416
+ handleClose();
56417
+ };
56418
+ const handleCheckRCS = async () => {
56419
+ setVerifying(true);
56420
+ try {
56421
+ if (!onCheckContactAddress) {
56422
+ return;
56423
+ }
56424
+ const result = await onCheckContactAddress(21);
56425
+ if (!result) {
56426
+ return;
56427
+ }
56428
+ setVerificationResult(result);
56429
+ setModalOpen(true);
56430
+ }
56431
+ catch (error) {
56432
+ console.error('Error verifying RCS account:', error);
56433
+ }
56434
+ finally {
56435
+ setVerifying(false);
56436
+ }
56437
+ handleClose();
56438
+ };
56439
+ const handleLinkAccount = async () => {
56440
+ await handleLinkAccountSave();
56441
+ setModalOpen(false);
56442
+ };
56443
+ return (jsxRuntimeExports.jsxs(material.Box, { children: [jsxRuntimeExports.jsx(material.IconButton, { "aria-controls": open ? 'basic-menu' : undefined, "aria-haspopup": "true", "aria-expanded": open ? 'true' : undefined, onClick: handleClick, children: jsxRuntimeExports.jsx(default_1$5, {}) }), jsxRuntimeExports.jsxs(material.Menu, { id: "basic-menu", anchorEl: anchorEl, open: open, onClose: handleClose, MenuListProps: {
56444
+ 'aria-labelledby': 'basic-button',
56445
+ }, children: [jsxRuntimeExports.jsxs(material.MenuItem, { onClick: handleDelete, children: [jsxRuntimeExports.jsx(material.ListItemIcon, { children: jsxRuntimeExports.jsx(default_1$d, { color: "error" }) }), jsxRuntimeExports.jsx(material.ListItemText, { children: t('global.delete') })] }), channelType === 5 && (jsxRuntimeExports.jsxs(material.MenuItem, { onClick: handleCheckWA, disabled: !checked, children: [jsxRuntimeExports.jsx(material.ListItemIcon, { children: verifying ? (jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 })) : (jsxRuntimeExports.jsx(default_1$4, { sx: { color: 'green' } })) }), jsxRuntimeExports.jsx(material.ListItemText, { children: t('optionsMenu.verifyWspAccount') })] })), channelType === 21 && (jsxRuntimeExports.jsxs(material.MenuItem, { onClick: handleCheckRCS, disabled: !checked, children: [jsxRuntimeExports.jsx(material.ListItemIcon, { children: verifying ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$3, {}) }), jsxRuntimeExports.jsx(material.ListItemText, { children: t('optionsMenu.verifyRCSAccount') })] }))] }), jsxRuntimeExports.jsx(material.Modal, { open: modalOpen, onClose: handleModalClose, "aria-labelledby": "modal-modal-title", "aria-describedby": "modal-modal-description", children: jsxRuntimeExports.jsx(material.Box, { sx: {
56446
+ position: 'absolute',
56447
+ top: '50%',
56448
+ left: '50%',
56449
+ transform: 'translate(-50%, -50%)',
56450
+ width: 400,
56451
+ boxShadow: 24,
56452
+ p: 4,
56453
+ backgroundColor: (theme) => theme.palette.background.default,
56454
+ }, children: verificationResult?.success ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsxs(material.Typography, { id: "modal-modal-title", variant: "h6", component: "h2", children: [t('optionsMenu.wspAccountFound'), " ", address] }), jsxRuntimeExports.jsx(material.Typography, { id: "modal-modal-description", sx: { mt: 2 }, children: t('optionsMenu.wantToLinkContact') }), jsxRuntimeExports.jsxs(material.Box, { sx: { marginTop: '10px' }, children: [jsxRuntimeExports.jsx(material.Button, { onClick: handleLinkAccount, color: "primary", children: t('optionsMenu.yesLink') }), jsxRuntimeExports.jsx(material.Button, { onClick: handleModalClose, color: "secondary", children: "No" })] })] })) : (jsxRuntimeExports.jsxs(material.Box, { sx: { position: 'relative' }, children: [jsxRuntimeExports.jsxs(material.Typography, { id: "modal-modal-title", variant: "h6", component: "h2", children: [t('optionsMenu.noWspAccountFound'), " ", address] }), jsxRuntimeExports.jsx(material.Button, { onClick: handleModalClose, color: "secondary", sx: { position: 'absolute', bottom: -25, right: 0 }, children: t('global.cancel') })] })) }) })] }));
56455
+ };
56456
+
56457
+ const NoteDeleteButton = (props) => {
56458
+ const t = useTranslationContext();
56459
+ const api = useEditContactApi();
56460
+ const { editEntity, entityId: entityIdFromContext } = useEditEntity();
56461
+ const [isSaving, setIsSaving] = React$1.useState(false);
56462
+ const checked = props.checked ?? true;
56463
+ const entityId = props.entityId ?? entityIdFromContext;
56464
+ const { note, channelType, id, address } = props.addressData;
56465
+ const addressIsSaved = !props.addressData.hasOwnProperty('isSaved');
56466
+ const replaceAddress = props.replaceAddress ?? editEntity.action.replaceAddress;
56467
+ const addWhatsappVerified = props.addWhatsappVerified ||
56468
+ (typeof editEntity.action?.addWhatsappVerified === 'function'
56469
+ ? editEntity.action.addWhatsappVerified
56470
+ : undefined);
56471
+ const handleSetAddress = async (type) => {
56472
+ if (!api)
56473
+ return null;
56474
+ if (!entityId)
56475
+ return null;
56476
+ const newAddress = await api.setContactAddress({
56477
+ data: {
56478
+ address,
56479
+ contactId: entityId,
56480
+ type,
56481
+ },
56482
+ });
56483
+ replaceAddress(id, newAddress);
56484
+ return newAddress;
56485
+ };
56486
+ const handleUpdateAddress = async () => {
56487
+ if (!api)
56488
+ return;
56489
+ if (!entityId)
56490
+ return;
56491
+ const updated = await api.updateContactAddress({
56492
+ data: {
56493
+ contactAddressId: id,
56494
+ contactId: entityId,
56495
+ note: note ?? '',
56496
+ },
56497
+ });
56498
+ replaceAddress(id, updated);
56499
+ };
56500
+ const handleSave = async () => {
56501
+ setIsSaving(true);
56502
+ if (addressIsSaved) {
56503
+ await handleUpdateAddress();
56504
+ setIsSaving(false);
56505
+ }
56506
+ else {
56507
+ const newAddress = await handleSetAddress(channelType);
56508
+ if (newAddress)
56509
+ setIsSaving(false);
56510
+ }
56511
+ };
56512
+ const handleLinkAccountSave = async () => {
56513
+ setIsSaving(true);
56514
+ const newAddress = await handleSetAddress(13);
56515
+ if (newAddress && addWhatsappVerified) {
56516
+ addWhatsappVerified(newAddress);
56517
+ }
56518
+ if (newAddress)
56519
+ setIsSaving(false);
56520
+ };
56521
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: {
56522
+ ...noteDeleteButtonStyle.container,
56523
+ }, children: [addressIsSaved && (jsxRuntimeExports.jsx(material.TextField, { size: "small", label: t('global.note'), variant: "outlined", onChange: (e) => props.handleNoteFieldChange(e, id, channelType), value: note, fullWidth: true, InputLabelProps: {
56524
+ shrink: true,
56525
+ }, className: "contacts-smallInput", sx: noteDeleteButtonStyle.noteTextField })), jsxRuntimeExports.jsx(material.IconButton, { onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { 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) => {
56526
+ if (!api)
56527
+ return null;
56528
+ try {
56529
+ return await api.checkContactAddress({
56530
+ data: {
56531
+ address,
56532
+ type,
56533
+ },
56534
+ });
56535
+ }
56536
+ catch {
56537
+ return null;
56538
+ }
56539
+ } })] }));
56540
+ };
56541
+
56542
+ const informationItemInputsContainerStyle = {
56543
+ container: {
56544
+ display: 'flex',
56545
+ gap: '100px',
56546
+ alignItems: 'center',
56547
+ },
56548
+ };
56549
+
56550
+ const InformationItemInputsContainer = ({ children }) => {
56551
+ return jsxRuntimeExports.jsx(material.Box, { sx: informationItemInputsContainerStyle.container, children: children });
56552
+ };
56553
+
56554
+ const subsectionBodyContainerStyle = {
56555
+ container: {
56556
+ width: '100%',
56557
+ borderRadius: 1,
56558
+ px: 1.5,
56559
+ py: 2,
56560
+ display: 'flex',
56561
+ flexDirection: 'column',
56562
+ gap: 2,
56563
+ overflow: 'auto',
56564
+ maxHeight: 'calc(100vh - 250px)',
56565
+ },
56566
+ };
56567
+
56568
+ const SubsectionBodyContainer = ({ children }) => {
56569
+ return (jsxRuntimeExports.jsx(material.Box, { sx: {
56570
+ ...subsectionBodyContainerStyle.container,
56571
+ }, children: children }));
56572
+ };
56573
+
56574
+ var CheckRounded = {};
56575
+
56576
+ var _interopRequireDefault$2 = interopRequireDefaultExports;
56577
+ Object.defineProperty(CheckRounded, "__esModule", {
56578
+ value: true
56579
+ });
56580
+ var default_1$2 = CheckRounded.default = void 0;
56581
+ var _createSvgIcon$2 = _interopRequireDefault$2(requireCreateSvgIcon());
56582
+ var _jsxRuntime$2 = jsxRuntimeExports;
56583
+ default_1$2 = CheckRounded.default = (0, _createSvgIcon$2.default)( /*#__PURE__*/(0, _jsxRuntime$2.jsx)("path", {
56584
+ 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"
56585
+ }), 'CheckRounded');
56586
+
56587
+ var CloseRounded = {};
56588
+
56589
+ var _interopRequireDefault$1 = interopRequireDefaultExports;
56590
+ Object.defineProperty(CloseRounded, "__esModule", {
56591
+ value: true
56592
+ });
56593
+ var default_1$1 = CloseRounded.default = void 0;
56594
+ var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
56595
+ var _jsxRuntime$1 = jsxRuntimeExports;
56596
+ default_1$1 = CloseRounded.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
56597
+ 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"
56598
+ }), 'CloseRounded');
56599
+
56600
+ const Adornment = ({ status }) => {
56601
+ switch (status) {
56602
+ case 'idle':
56603
+ return null;
56604
+ case 'loading':
56605
+ return jsxRuntimeExports.jsx(CircularProgress$1, { size: 20 });
56606
+ case 'available':
56607
+ return jsxRuntimeExports.jsx(default_1$2, { style: { height: 27, width: 27 }, color: "success" });
56608
+ case 'unavailable':
56609
+ return jsxRuntimeExports.jsx(default_1$1, { style: { height: 27, width: 27 }, color: "error" });
56610
+ default:
56611
+ return null;
56612
+ }
56613
+ };
56173
56614
 
56174
- styled$1(material.Box)(({ theme }) => ({
56615
+ const StatusAdornment = ({ status, text }) => {
56616
+ const textAdornment = text ? (jsxRuntimeExports.jsx(Typography$1, { marginRight: 0.5, children: text })) : null;
56617
+ 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 }) })] }));
56618
+ };
56619
+
56620
+ const imsStyle = {
56621
+ code: {
56622
+ width: '60%',
56623
+ color: 'gray',
56624
+ },
56625
+ };
56626
+
56627
+ const Ims = ({ data, editEntity }) => {
56628
+ const editActions = editEntity.action;
56629
+ return (jsxRuntimeExports.jsx(InformationItemContainer, { children: jsxRuntimeExports.jsxs(InformationItemInputsContainer, { children: [jsxRuntimeExports.jsx(material.Typography, { sx: imsStyle.code, variant: "body2", children: data.address }), jsxRuntimeExports.jsx(NoteDeleteButton, { addressData: data, handleNoteFieldChange: editActions.handleNoteFieldChange, handleDeleteAddress: editActions.handleDeleteAddress })] }) }));
56630
+ };
56631
+
56632
+ const Body$4 = ({ IMSs, editEntity }) => {
56633
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { children: IMSs?.map((ims) => (jsxRuntimeExports.jsx(Ims, { data: ims, editEntity: editEntity }, ims.id))) }));
56634
+ };
56635
+
56636
+ const InformationSocialNetworkItem = ({ editEntity, title, IMSs }) => {
56637
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeader, { title: title }), jsxRuntimeExports.jsx(Body$4, { IMSs: IMSs, editEntity: editEntity })] }));
56638
+ };
56639
+
56640
+ const style$2 = {
56641
+ addressField: {
56642
+ // width: '35%',
56643
+ },
56644
+ };
56645
+
56646
+ const AddressInput = ({ data, onChange, setWarnings }) => {
56647
+ const { id, channelType, address } = data;
56648
+ const t = useTranslationContext();
56649
+ const api = useEditContactApi();
56650
+ const [adornmentStatus, setAdornmentStatus] = React$1.useState('idle');
56651
+ const [lastSearch, setLastSearch] = React$1.useState(address);
56652
+ const addressIsSaved = !data.hasOwnProperty('isSaved');
56653
+ React$1.useEffect(() => {
56654
+ let timer = setTimeout(async () => {
56655
+ if (address !== '' && address !== lastSearch) {
56656
+ if (!api) {
56657
+ return;
56658
+ }
56659
+ setAdornmentStatus('loading');
56660
+ setLastSearch(address);
56661
+ const checkContactAddressData = {
56662
+ address,
56663
+ type: channelType,
56664
+ };
56665
+ try {
56666
+ const response = await api.checkContactAddress({ data: checkContactAddressData });
56667
+ const { success, warnings } = response;
56668
+ setWarnings(warnings);
56669
+ success ? setAdornmentStatus('available') : setAdornmentStatus('unavailable');
56670
+ }
56671
+ catch {
56672
+ setWarnings([]);
56673
+ setAdornmentStatus('unavailable');
56674
+ }
56675
+ }
56676
+ }, 1700);
56677
+ return () => clearTimeout(timer);
56678
+ }, [api, data, address, channelType, lastSearch, setWarnings]);
56679
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(material.TextField, { disabled: addressIsSaved, sx: style$2.addressField, size: "small", label: channelType === Channels.ChannelType.WHATSAPP || channelType === Channels.ChannelType.RCS
56680
+ ? t
56681
+ ? t('global.number')
56682
+ : 'Number'
56683
+ : t
56684
+ ? t('global.email')
56685
+ : 'Email', value: address, onChange: (e) => {
56686
+ onChange(e, id, channelType);
56687
+ }, variant: "outlined", fullWidth: true, InputLabelProps: {
56688
+ shrink: true,
56689
+ }, className: "contacts-smallInput", InputProps: {
56690
+ endAdornment: (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(StatusAdornment, { status: adornmentStatus }) })),
56691
+ } }) }));
56692
+ };
56693
+
56694
+ const style$1 = {
56695
+ addressField: {
56696
+ // width: '35%',
56697
+ },
56698
+ };
56699
+
56700
+ const PhoneInput = ({ data, onChange, setWarnings }) => {
56701
+ const api = useEditContactApi();
56702
+ const t = useTranslationContext();
56703
+ const { id, channelType, address } = data;
56704
+ const [adornmentStatus, setAdornmentStatus] = React$1.useState('idle');
56705
+ const [lastSearch, setLastSearch] = React$1.useState(address);
56706
+ const addressIsSaved = !data.hasOwnProperty('isSaved');
56707
+ React$1.useEffect(() => {
56708
+ let timer = setTimeout(async () => {
56709
+ if (address !== '' && address !== lastSearch) {
56710
+ if (!api) {
56711
+ return;
56712
+ }
56713
+ setAdornmentStatus('loading');
56714
+ setLastSearch(address);
56715
+ const checkContactAddressData = {
56716
+ address,
56717
+ type: channelType,
56718
+ };
56719
+ try {
56720
+ const { success, warnings } = await api.checkContactAddress({
56721
+ data: checkContactAddressData,
56722
+ });
56723
+ setWarnings(warnings);
56724
+ success ? setAdornmentStatus('available') : setAdornmentStatus('unavailable');
56725
+ }
56726
+ catch {
56727
+ setWarnings([]);
56728
+ setAdornmentStatus('unavailable');
56729
+ }
56730
+ }
56731
+ }, 1700);
56732
+ return () => clearTimeout(timer);
56733
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56734
+ }, [data]);
56735
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(material.TextField, { disabled: addressIsSaved, sx: style$1.addressField, size: "small", label: t('global.number'), value: address, onChange: (e) => {
56736
+ onChange(e, id, channelType);
56737
+ }, variant: "outlined", fullWidth: true, InputLabelProps: {
56738
+ shrink: true,
56739
+ }, className: "contacts-smallInput", InputProps: {
56740
+ endAdornment: (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(StatusAdornment, { status: adornmentStatus }) })),
56741
+ } }) }));
56742
+ };
56743
+
56744
+ const style = {
56745
+ secondaryContainer: {
56746
+ display: 'flex',
56747
+ alignItems: 'baseline',
56748
+ height: '100%',
56749
+ gap: 0.5,
56750
+ },
56751
+ icon: { height: 15 },
56752
+ chip: {
56753
+ borderRadius: '6px',
56754
+ height: '22px'
56755
+ }
56756
+ };
56757
+
56758
+ var Warning$1 = {};
56759
+
56760
+ var _interopRequireDefault = interopRequireDefaultExports;
56761
+ Object.defineProperty(Warning$1, "__esModule", {
56762
+ value: true
56763
+ });
56764
+ var default_1 = Warning$1.default = void 0;
56765
+ var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
56766
+ var _jsxRuntime = jsxRuntimeExports;
56767
+ default_1 = Warning$1.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
56768
+ d: "M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"
56769
+ }), 'Warning');
56770
+
56771
+ const Warning = ({ text }) => {
56772
+ return (jsxRuntimeExports.jsx(material.Grid, { item: true, children: jsxRuntimeExports.jsx(material.Box, { 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' }) }) }));
56773
+ };
56774
+
56775
+ const WarningsDisplay = ({ warnings }) => {
56776
+ const t = useTranslationContext();
56777
+ return (jsxRuntimeExports.jsx(material.Box, { children: jsxRuntimeExports.jsx(material.Grid, { container: true, children: warnings?.map((warning, i) => (jsxRuntimeExports.jsx(Warning, { text: t(`contactAddressError.${warning}`) }, i))) }) }));
56778
+ };
56779
+
56780
+ const phoneStyle = {
56781
+ numberCountryContainer: {
56782
+ display: 'flex',
56783
+ justifyContent: 'flex-start',
56784
+ width: '50%',
56785
+ },
56786
+ warningMessage: {
56787
+ // position: "absolute",
56788
+ // bottom: "-30px",
56789
+ marginTop: "10px"
56790
+ },
56791
+ adressInputBox: {
56792
+ position: "relative",
56793
+ width: "45%"
56794
+ }
56795
+ };
56796
+
56797
+ const Phone = ({ data }) => {
56798
+ const mode = 'edit';
56799
+ const { editEntity } = useEditEntity();
56800
+ const editEntityActions = editEntity.action;
56801
+ const editEntityState = editEntity.state;
56802
+ const [warnings, setWarnings] = React$1.useState([]);
56803
+ const [checked, setChecked] = React$1.useState(true);
56804
+ React$1.useEffect(() => {
56805
+ setChecked(warnings.length === 0 && (data.address ?? '') !== '');
56806
+ }, [warnings, data.address]);
56807
+ return (jsxRuntimeExports.jsx(InformationItemContainer, { children: jsxRuntimeExports.jsxs(InformationItemInputsContainer, { children: [jsxRuntimeExports.jsxs(material.Box, { 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 })] }) }));
56808
+ };
56809
+
56810
+ const Body$3 = ({ phoneNumbers }) => {
56811
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: phoneNumbers?.map((phone) => (jsxRuntimeExports.jsx(Phone, { data: phone }, phone.id))) }));
56812
+ };
56813
+
56814
+ const Phones = ({ phoneNumbers, handleAdd }) => {
56815
+ const t = useTranslationContext();
56816
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: t('global.phones') }), jsxRuntimeExports.jsx(Body$3, { phoneNumbers: phoneNumbers })] }));
56817
+ };
56818
+
56819
+ const mailStyle$2 = {
56820
+ emailField: {
56821
+ width: '60%',
56822
+ },
56823
+ numberCountryContainer: {
56824
+ display: 'flex',
56825
+ justifyContent: 'flex-start',
56826
+ width: '50%',
56827
+ },
56828
+ warningMessage: {
56829
+ position: "absolute",
56830
+ bottom: "-30px"
56831
+ },
56832
+ adressInputBox: {
56833
+ position: "relative",
56834
+ width: "60%"
56835
+ }
56836
+ };
56837
+
56838
+ const Mail = ({ data }) => {
56839
+ const mode = 'edit';
56840
+ const { editEntity } = useEditEntity();
56841
+ const editEntityActions = editEntity.action;
56842
+ const editEntityState = editEntity.state;
56843
+ const [warnings, setWarnings] = React$1.useState([]);
56844
+ return (jsxRuntimeExports.jsxs(InformationItemContainer, { children: [jsxRuntimeExports.jsxs(InformationItemInputsContainer, { children: [jsxRuntimeExports.jsx(material.Box, { sx: mailStyle$2.numberCountryContainer, children: jsxRuntimeExports.jsx(material.Box, { 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 })] }));
56845
+ };
56846
+
56847
+ const Body$2 = ({ emails }) => {
56848
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: emails?.map((email) => (jsxRuntimeExports.jsx(Mail, { data: email }, email.id))) }));
56849
+ };
56850
+
56851
+ const Mails = ({ emails, handleAdd }) => {
56852
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: 'Emails' }), jsxRuntimeExports.jsx(Body$2, { emails: emails })] }));
56853
+ };
56854
+
56855
+ const mailStyle$1 = {
56856
+ emailField: {
56857
+ width: '60%',
56858
+ },
56859
+ numberCountryContainer: {
56860
+ display: 'flex',
56861
+ justifyContent: 'flex-start',
56862
+ width: '50%',
56863
+ },
56864
+ warningMessage: {
56865
+ position: "absolute",
56866
+ bottom: "-30px"
56867
+ },
56868
+ adressInputBox: {
56869
+ position: "relative",
56870
+ width: "60%"
56871
+ }
56872
+ };
56873
+
56874
+ const Whatsapp = ({ data }) => {
56875
+ const mode = 'edit';
56876
+ const { editEntity } = useEditEntity();
56877
+ const editEntityActions = editEntity.action;
56878
+ const editEntityState = editEntity.state;
56879
+ const [warnings, setWarnings] = React$1.useState([]);
56880
+ return (jsxRuntimeExports.jsxs(InformationItemContainer, { children: [jsxRuntimeExports.jsxs(InformationItemInputsContainer, { children: [jsxRuntimeExports.jsx(material.Box, { sx: mailStyle$1.numberCountryContainer, children: jsxRuntimeExports.jsx(material.Box, { 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 })] }));
56881
+ };
56882
+
56883
+ const Body$1 = ({ whatsapps }) => {
56884
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: whatsapps?.map((whatsapp) => (jsxRuntimeExports.jsx(Whatsapp, { data: whatsapp }, whatsapp.id))) }));
56885
+ };
56886
+
56887
+ const Whatsapps = ({ whatsapps, handleAdd }) => {
56888
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: 'WhatsApp' }), jsxRuntimeExports.jsx(Body$1, { whatsapps: whatsapps })] }));
56889
+ };
56890
+
56891
+ const mailStyle = {
56892
+ emailField: {
56893
+ width: '60%',
56894
+ },
56895
+ numberCountryContainer: {
56896
+ display: 'flex',
56897
+ justifyContent: 'flex-start',
56898
+ width: '50%',
56899
+ },
56900
+ warningMessage: {
56901
+ position: "absolute",
56902
+ bottom: "-30px"
56903
+ },
56904
+ adressInputBox: {
56905
+ position: "relative",
56906
+ width: "60%"
56907
+ }
56908
+ };
56909
+
56910
+ const RCS = ({ data }) => {
56911
+ const mode = 'edit';
56912
+ const { editEntity } = useEditEntity();
56913
+ const editEntityActions = editEntity.action;
56914
+ const editEntityState = editEntity.state;
56915
+ const [warnings, setWarnings] = React$1.useState([]);
56916
+ return (jsxRuntimeExports.jsxs(InformationItemContainer, { children: [jsxRuntimeExports.jsxs(InformationItemInputsContainer, { children: [jsxRuntimeExports.jsx(material.Box, { sx: mailStyle.numberCountryContainer, children: jsxRuntimeExports.jsx(material.Box, { 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 })] }));
56917
+ };
56918
+
56919
+ const Body = ({ RCSs }) => {
56920
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: RCSs?.map((data) => (jsxRuntimeExports.jsx(RCS, { data: data }, data.id))) }));
56921
+ };
56922
+
56923
+ const RCSs = ({ RCSs, handleAdd }) => {
56924
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: 'RCS' }), jsxRuntimeExports.jsx(Body, { RCSs: RCSs })] }));
56925
+ };
56926
+
56927
+ const StyledModalContent = styled$1(material.Box)(({ theme }) => ({
56175
56928
  position: 'absolute',
56176
56929
  top: '50%',
56177
56930
  left: '50%',
@@ -56181,35 +56934,84 @@ styled$1(material.Box)(({ theme }) => ({
56181
56934
  padding: theme.spacing(4),
56182
56935
  borderRadius: theme.shape.borderRadius,
56183
56936
  }));
56937
+ const EditModal = ({ open, onClose, title }) => {
56938
+ const t = useTranslationContext();
56939
+ const { editEntity } = useEditEntity();
56940
+ const { emails, phoneNumbers, imsWhatsapp, imsRCS } = editEntity.field;
56941
+ const { addEmail, addPhone, addWhatsapp, resetToInitialContactInformation, addRCS } = editEntity.action;
56942
+ function handleClose() {
56943
+ onClose();
56944
+ resetToInitialContactInformation();
56945
+ }
56946
+ const renderContent = () => {
56947
+ switch (title) {
56948
+ case 'Phones':
56949
+ return jsxRuntimeExports.jsx(Phones, { handleAdd: addPhone, phoneNumbers: phoneNumbers });
56950
+ case 'Emails':
56951
+ return jsxRuntimeExports.jsx(Mails, { handleAdd: addEmail, emails: emails });
56952
+ case 'Whatsapp':
56953
+ return jsxRuntimeExports.jsx(Whatsapps, { handleAdd: addWhatsapp, whatsapps: imsWhatsapp });
56954
+ case 'RCS':
56955
+ return jsxRuntimeExports.jsx(RCSs, { handleAdd: addRCS, RCSs: imsRCS });
56956
+ case 'Facebook':
56957
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Facebook', IMSs: editEntity.field.imsFacebooks, editEntity: editEntity }));
56958
+ case 'Webchat':
56959
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Webchat', IMSs: editEntity.field.imsWebchats, editEntity: editEntity }));
56960
+ case 'Instagram':
56961
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Instagram', IMSs: editEntity.field.imsInstagrams, editEntity: editEntity }));
56962
+ case 'Mercado libre':
56963
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Mercado Libre', IMSs: editEntity.field.imsMercadolibre, editEntity: editEntity }));
56964
+ default:
56965
+ return jsxRuntimeExports.jsx(material.Typography, { children: "No information available for this section." });
56966
+ }
56967
+ };
56968
+ return (jsxRuntimeExports.jsx(material.Modal, { open: open, onClose: onClose, children: jsxRuntimeExports.jsxs(StyledModalContent, { children: [renderContent(), jsxRuntimeExports.jsx(material.Box, { mt: 2, display: 'flex', justifyContent: 'flex-end', children: jsxRuntimeExports.jsx(material.Button, { variant: "contained", color: "primary", onClick: handleClose, children: t('global.close') }) })] }) }));
56969
+ };
56970
+
56971
+ const ContactInformation = ({ ownerData }) => {
56972
+ const { isOpen, title, openModal, closeModal } = useEditModal();
56973
+ const { editEntity } = useEditEntity();
56974
+ const t = useTranslationContext();
56975
+ const phones = editEntity.field.phoneNumbers;
56976
+ const emails = editEntity.field.emails;
56977
+ const facebook = editEntity.field.imsFacebooks;
56978
+ const whatsapp = editEntity.field.imsWhatsapp;
56979
+ const mercadolibre = editEntity.field.imsMercadolibre;
56980
+ const webchat = editEntity.field.imsWebchats;
56981
+ const instagram = editEntity.field.imsInstagrams;
56982
+ const rcs = editEntity.field.imsRCS;
56983
+ 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 })] }));
56984
+ };
56184
56985
 
56185
- const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, t, onEntityUpdated, }) => {
56986
+ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntityUpdated, }) => {
56186
56987
  const commonProps = {
56187
56988
  baseUrl,
56188
56989
  spaceId,
56189
56990
  entityId: String(entityData.id),
56190
56991
  onEntityUpdated,
56191
56992
  };
56993
+ const t = useTranslationContext();
56192
56994
  const maybeTitle = t('contactDetails.addressInformation');
56193
56995
  const sectionTitle = maybeTitle === 'contactDetails.addressInformation' ? 'Address Information' : maybeTitle;
56194
- 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) => ({
56996
+ 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) => ({
56195
56997
  address1: { street: value },
56196
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56998
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56197
56999
  address2: { street: value },
56198
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57000
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
56199
57001
  address1: { city: value },
56200
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57002
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
56201
57003
  address2: { city: value },
56202
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57004
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
56203
57005
  address1: { state: value },
56204
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57006
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
56205
57007
  address2: { state: value },
56206
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57008
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
56207
57009
  address1: { zipcode: value },
56208
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57010
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
56209
57011
  address2: { zipcode: value },
56210
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57012
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
56211
57013
  address1: { country: value },
56212
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57014
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
56213
57015
  address2: { country: value },
56214
57016
  }) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.street'), value: entityData.address1?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56215
57017
  address1: { street: value },
@@ -56234,100 +57036,97 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, t, onEnt
56234
57036
  }) })] })) }) }));
56235
57037
  };
56236
57038
 
56237
- const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }) => {
56238
- const api = React$1.useMemo(() => {
56239
- if (!baseUrl || !spaceId)
56240
- return null;
56241
- return createEditContactApi(baseUrl, spaceId);
56242
- }, [baseUrl, spaceId]);
56243
- const { state, selectors, actions } = useEditContactModalController({
56244
- open,
56245
- baseUrl,
56246
- spaceId,
56247
- contactId,
56248
- });
56249
- const [view, setView] = React$1.useState("main");
57039
+ const useEntityUpdateSync = ({ entity, setEntity }) => {
57040
+ const handleEntityUpdated = React$1.useCallback((update) => {
57041
+ if (!update || typeof update !== 'object') {
57042
+ return;
57043
+ }
57044
+ const updateObj = update;
57045
+ if ('id' in updateObj) {
57046
+ // Full entity replacement
57047
+ setEntity(update);
57048
+ return;
57049
+ }
57050
+ if (!entity) {
57051
+ return;
57052
+ }
57053
+ // Shallow merge partial updates into existing entity
57054
+ const merged = { ...entity, ...updateObj };
57055
+ setEntity(merged);
57056
+ }, [entity, setEntity]);
57057
+ return handleEntityUpdated;
57058
+ };
57059
+
57060
+ const useTagsEditorController = ({ open, baseUrl, spaceId, contactData, contactType, labels, selectedTags, onTagsUpdated, }) => {
57061
+ const [view, setView] = React$1.useState('main');
56250
57062
  const [draftLabels, setDraftLabels] = React$1.useState([]);
56251
57063
  const [tagsEditorInitialized, setTagsEditorInitialized] = React$1.useState(false);
56252
- const [isSavingTags, setIsSavingTags] = React$1.useState(false);
56253
- const resetModalState = React$1.useCallback(() => {
57064
+ const [isSaving, setIsSaving] = React$1.useState(false);
57065
+ const reset = React$1.useCallback(() => {
56254
57066
  setView('main');
56255
57067
  setDraftLabels([]);
56256
57068
  setTagsEditorInitialized(false);
56257
- setIsSavingTags(false);
57069
+ setIsSaving(false);
56258
57070
  }, []);
56259
- const handleEntityUpdated = React$1.useCallback((entity) => {
56260
- if (!entity || typeof entity !== 'object')
56261
- return;
56262
- const hasId = 'id' in entity;
56263
- if (hasId) {
56264
- actions.setContactData(entity);
56265
- return;
56266
- }
56267
- if (state.contactData) {
56268
- actions.setContactData({ ...state.contactData, ...entity });
56269
- }
56270
- }, [actions, state.contactData]);
56271
- const image = useImage({
56272
- baseUrl,
56273
- spaceId,
56274
- entityType: selectors.contactType === 'business' || selectors.contactType === 'contact'
56275
- ? selectors.contactType
56276
- : undefined,
56277
- entityId: state.contactData ? String(state.contactData.id) : undefined,
56278
- initialImageUrl: state.contactData?.imageUrl,
56279
- onEntityUpdated: handleEntityUpdated,
56280
- });
56281
57071
  React$1.useEffect(() => {
56282
57072
  if (!open) {
56283
- resetModalState();
57073
+ reset();
57074
+ }
57075
+ }, [open, reset]);
57076
+ React$1.useEffect(() => {
57077
+ if (view !== 'tags') {
57078
+ setTagsEditorInitialized(false);
57079
+ return;
56284
57080
  }
56285
- }, [open, resetModalState]);
56286
- const handleSaveTags = async () => {
56287
- if (isSavingTags)
57081
+ if (tagsEditorInitialized)
56288
57082
  return;
56289
- if (!baseUrl)
57083
+ if (!labels.length)
56290
57084
  return;
56291
- if (!spaceId)
57085
+ const selectedTagIds = new Set(selectedTags.map((t) => String(t.id)));
57086
+ const initialDraft = labels.filter((l) => selectedTagIds.has(String(l?.id)));
57087
+ setDraftLabels(initialDraft);
57088
+ setTagsEditorInitialized(true);
57089
+ }, [view, tagsEditorInitialized, labels, selectedTags]);
57090
+ const handleSaveTags = React$1.useCallback(async () => {
57091
+ if (isSaving)
56292
57092
  return;
56293
- if (!state.contactData)
57093
+ if (!baseUrl || !spaceId)
57094
+ return;
57095
+ if (!contactData)
56294
57096
  return;
56295
- if (selectors.contactType !== 'business' && selectors.contactType !== 'contact')
57097
+ if (contactType !== 'contact' && contactType !== 'business')
56296
57098
  return;
56297
57099
  const tags = draftLabels
56298
57100
  .filter((l) => l?.id && l?.name)
56299
57101
  .map((l) => ({ id: String(l.id), name: String(l.name) }));
56300
- setIsSavingTags(true);
57102
+ setIsSaving(true);
56301
57103
  try {
56302
57104
  await updateEntity({
56303
57105
  baseUrl,
56304
57106
  spaceId,
56305
- entityType: selectors.contactType,
56306
- entityId: String(state.contactData.id),
57107
+ entityType: contactType,
57108
+ entityId: String(contactData.id),
56307
57109
  body: { tags },
56308
57110
  });
56309
- actions.setContactData({ ...state.contactData, tags });
57111
+ onTagsUpdated(tags);
56310
57112
  setView('main');
56311
57113
  }
56312
57114
  finally {
56313
- setIsSavingTags(false);
57115
+ setIsSaving(false);
56314
57116
  }
57117
+ }, [isSaving, baseUrl, spaceId, contactData, contactType, draftLabels, onTagsUpdated]);
57118
+ return {
57119
+ view,
57120
+ setView,
57121
+ draftLabels,
57122
+ setDraftLabels,
57123
+ isSaving,
57124
+ handleSaveTags,
56315
57125
  };
56316
- React$1.useEffect(() => {
56317
- if (view !== 'tags') {
56318
- setTagsEditorInitialized(false);
56319
- return;
56320
- }
56321
- if (tagsEditorInitialized)
56322
- return;
56323
- if (!selectors.labels.length)
56324
- return;
56325
- const selectedTagIds = new Set(selectors.tags.map((t) => String(t.id)));
56326
- const initialSelectedLabels = selectors.labels.filter((l) => selectedTagIds.has(String(l?.id)));
56327
- setDraftLabels(initialSelectedLabels);
56328
- setTagsEditorInitialized(true);
56329
- }, [view, tagsEditorInitialized, selectors.labels, selectors.tags]);
56330
- const handleClose = (event, reason) => {
57126
+ };
57127
+
57128
+ const useModalCloseHandler = ({ onClose }) => {
57129
+ const handleClose = React$1.useCallback((event, reason) => {
56331
57130
  if (reason === 'escapeKeyDown') {
56332
57131
  const maybeEvent = event;
56333
57132
  if (typeof maybeEvent?.stopPropagation === 'function') {
@@ -56338,7 +57137,51 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }
56338
57137
  }
56339
57138
  }
56340
57139
  onClose();
56341
- };
57140
+ }, [onClose]);
57141
+ return handleClose;
57142
+ };
57143
+
57144
+ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t }) => {
57145
+ const api = React$1.useMemo(() => {
57146
+ if (!baseUrl || !spaceId)
57147
+ return null;
57148
+ return createEditContactApi(baseUrl, spaceId);
57149
+ }, [baseUrl, spaceId]);
57150
+ const { state, selectors, actions } = useEditContactModalController({
57151
+ open,
57152
+ baseUrl,
57153
+ spaceId,
57154
+ contactId,
57155
+ });
57156
+ const handleEntityUpdated = useEntityUpdateSync({
57157
+ entity: state.contactData,
57158
+ setEntity: (next) => actions.setContactData(next ?? undefined),
57159
+ });
57160
+ const { view, setView, draftLabels, setDraftLabels, isSaving: isSavingTags, handleSaveTags, } = useTagsEditorController({
57161
+ open,
57162
+ baseUrl,
57163
+ spaceId,
57164
+ contactData: state.contactData,
57165
+ contactType: selectors.contactType,
57166
+ labels: selectors.labels,
57167
+ selectedTags: selectors.tags,
57168
+ onTagsUpdated: (tags) => {
57169
+ if (!state.contactData)
57170
+ return;
57171
+ actions.setContactData({ ...state.contactData, tags });
57172
+ },
57173
+ });
57174
+ const image = useImage({
57175
+ baseUrl,
57176
+ spaceId,
57177
+ entityType: selectors.contactType === 'business' || selectors.contactType === 'contact'
57178
+ ? selectors.contactType
57179
+ : undefined,
57180
+ entityId: state.contactData ? String(state.contactData.id) : undefined,
57181
+ initialImageUrl: state.contactData?.imageUrl,
57182
+ onEntityUpdated: handleEntityUpdated,
57183
+ });
57184
+ const handleClose = useModalCloseHandler({ onClose });
56342
57185
  const baseSx = {
56343
57186
  position: 'absolute',
56344
57187
  top: '50%',
@@ -56353,23 +57196,21 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }
56353
57196
  p: 3,
56354
57197
  overflow: 'hidden',
56355
57198
  };
56356
- const mergedSx = Array.isArray(sx)
56357
- ? [baseSx, ...sx]
56358
- : sx
56359
- ? [baseSx, sx]
56360
- : baseSx;
56361
- return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, children: jsxRuntimeExports.jsx(material.Modal, { open: open, onClose: handleClose, closeAfterTransition: true, slots: { backdrop: material.Backdrop }, slotProps: { backdrop: { timeout: 200 } }, children: jsxRuntimeExports.jsx(material.Fade, { in: open, timeout: 200, children: jsxRuntimeExports.jsx(material.Box, { sx: mergedSx, children: state.isLoading && !state.contactData ? (jsxRuntimeExports.jsx(material.Box, { sx: {
56362
- display: 'flex',
56363
- justifyContent: 'center',
56364
- alignItems: 'center',
56365
- minHeight: 220,
56366
- }, children: jsxRuntimeExports.jsx(material.CircularProgress, {}) })) : state.error ? (jsxRuntimeExports.jsx(material.Box, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsx(EditEntityProvider, { entityType: selectors.contactType === 'business' ? 'business' : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, children: jsxRuntimeExports.jsxs(material.Box, { sx: { position: 'relative', height: '100%' }, children: [jsxRuntimeExports.jsx(material.Fade, { in: view === 'main', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsxs(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Header, { imgUrl: image.imageUrl, displayName: selectors.displayName, tags: selectors.tags, t: t, onEditTags: () => {
56367
- setView('tags');
56368
- }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting }), jsxRuntimeExports.jsxs(material.Box, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' || selectors.contactType === 'business'
56369
- ? selectors.contactType
56370
- : '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'
56371
- ? selectors.contactType
56372
- : 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, t: t }), jsxRuntimeExports.jsx(Section, { title: "Contact Information", children: "C" })] })] }) }), jsxRuntimeExports.jsx(material.Fade, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: jsxRuntimeExports.jsx(TagsEditor, { value: draftLabels, options: selectors.labels, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags, t: t }) }) })] }) })) : null }) }) }) }));
57199
+ const mergedSx = Array.isArray(sx) ? [baseSx, ...sx] : sx ? [baseSx, sx] : baseSx;
57200
+ return (jsxRuntimeExports.jsx(EditContactApiProvider, { value: api, children: jsxRuntimeExports.jsx(TranslationProvider, { t: t, children: jsxRuntimeExports.jsx(material.Modal, { open: open, onClose: handleClose, closeAfterTransition: true, slots: { backdrop: material.Backdrop }, slotProps: { backdrop: { timeout: 200 } }, children: jsxRuntimeExports.jsx(material.Fade, { in: open, timeout: 200, children: jsxRuntimeExports.jsx(material.Box, { sx: mergedSx, children: state.isLoading && !state.contactData ? (jsxRuntimeExports.jsx(material.Box, { sx: {
57201
+ display: 'flex',
57202
+ justifyContent: 'center',
57203
+ alignItems: 'center',
57204
+ minHeight: 220,
57205
+ }, children: jsxRuntimeExports.jsx(material.CircularProgress, {}) })) : state.error ? (jsxRuntimeExports.jsx(material.Box, { sx: { mb: 2 }, children: "Failed to load contact" })) : state.contactData ? (jsxRuntimeExports.jsx(EditEntityProvider, { entityType: selectors.contactType === 'business' ? 'business' : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, children: jsxRuntimeExports.jsxs(material.Box, { sx: { position: 'relative', height: '100%' }, children: [jsxRuntimeExports.jsx(material.Fade, { in: view === 'main', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsxs(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: [jsxRuntimeExports.jsx(Header, { imgUrl: image.imageUrl, displayName: selectors.displayName, tags: selectors.tags, onEditTags: () => {
57206
+ setView('tags');
57207
+ }, onUploadPhoto: image.action.uploadImage, onPhotoFileChange: image.inputAtributes.onChange, photoInputRef: image.inputAtributes.ref, isUploadingPhoto: image.isUploading, onDeletePhoto: image.action.deleteImage, isDeletingPhoto: image.isDeleting }), jsxRuntimeExports.jsxs(material.Box, { sx: { px: 1, pb: 2 }, children: [jsxRuntimeExports.jsx(General, { dateFormat: selectors.userTrii?.regCon_dateFormat || 'MM/dd/yyyy', entityType: selectors.contactType === 'contact' ||
57208
+ selectors.contactType === 'business'
57209
+ ? selectors.contactType
57210
+ : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
57211
+ selectors.contactType === 'business'
57212
+ ? selectors.contactType
57213
+ : 'contact', entityData: state.contactData, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated }), jsxRuntimeExports.jsx(ContactInformation, { ownerData: state.contactData })] })] }) }), jsxRuntimeExports.jsx(material.Fade, { in: view === 'tags', timeout: 200, mountOnEnter: true, unmountOnExit: true, children: jsxRuntimeExports.jsx(material.Box, { sx: { pt: 0.5, position: 'absolute', inset: 0, overflowY: 'auto' }, children: jsxRuntimeExports.jsx(TagsEditor, { value: draftLabels, options: selectors.labels, onChange: setDraftLabels, onBack: () => setView('main'), onSave: handleSaveTags, isSaving: isSavingTags }) }) })] }) })) : null }) }) }) }) }));
56373
57214
  };
56374
57215
 
56375
57216
  exports.ContactInfoPopup = ContactInfoPopup;