@trii/components 2.0.35 → 2.0.39

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 +1197 -320
  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 -2
  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 +1199 -322
  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 -2
  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$2 = 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$2, { children: jsxRuntimeExports.jsxs(InfoContainer, { children: [jsxRuntimeExports.jsx(IconBox, { children: icon }), jsxRuntimeExports.jsxs(AddressContainer, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: contact.address, arrow: true, placement: "top", children: jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", fontWeight: "semi-bold", fontSize: 14, color: "text.primary", sx: {
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,57 @@ 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
+ console.log('[TranslationProvider] t fn:', t?.name || 'anonymous', t);
15403
+ return jsxRuntimeExports.jsx(TranslationContext.Provider, { value: t, children: children });
15404
+ };
15405
+ const useTranslationContext = () => {
15406
+ const t = React$1.useContext(TranslationContext);
15407
+ if (!t) {
15408
+ console.warn('[useTranslationContext] using noop, context value is falsy');
15409
+ return noop$3;
15410
+ }
15411
+ return (...args) => {
15412
+ const [key, ...rest] = args;
15413
+ const result = t(key, ...rest);
15414
+ console.log('[useTranslationContext] key:', key, 'args:', rest, 'result:', result);
15415
+ return result;
15416
+ };
15417
+ };
15418
+
15419
+ const Tags = ({ tags, onEditTags }) => {
15420
+ const t = useTranslationContext();
15406
15421
  const [anchorEl, setAnchorEl] = React$1.useState(null);
15407
15422
  const safeTags = React$1.useMemo(() => tags ?? [], [tags]);
15408
15423
  const MAX_VISIBLE = 4;
@@ -15446,7 +15461,7 @@ const Tags = ({ tags, t, onEditTags }) => {
15446
15461
  bgcolor: 'action.hover',
15447
15462
  color: 'text.primary',
15448
15463
  },
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: {
15464
+ }, 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
15465
  borderRadius: 999,
15451
15466
  maxWidth: 160,
15452
15467
  '& .MuiChip-label': {
@@ -15458,35 +15473,36 @@ const Tags = ({ tags, t, onEditTags }) => {
15458
15473
 
15459
15474
  var Delete = {};
15460
15475
 
15461
- var _interopRequireDefault$5 = interopRequireDefaultExports;
15476
+ var _interopRequireDefault$c = interopRequireDefaultExports;
15462
15477
  Object.defineProperty(Delete, "__esModule", {
15463
15478
  value: true
15464
15479
  });
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", {
15480
+ var default_1$d = Delete.default = void 0;
15481
+ var _createSvgIcon$c = _interopRequireDefault$c(requireCreateSvgIcon());
15482
+ var _jsxRuntime$c = jsxRuntimeExports;
15483
+ default_1$d = Delete.default = (0, _createSvgIcon$c.default)( /*#__PURE__*/(0, _jsxRuntime$c.jsx)("path", {
15469
15484
  d: "M6 19c0 1.1.9 2 2 2h8c1.1 0 2-.9 2-2V7H6zM19 4h-3.5l-1-1h-5l-1 1H5v2h14z"
15470
15485
  }), 'Delete');
15471
15486
 
15472
15487
  var PhotoCamera = {};
15473
15488
 
15474
- var _interopRequireDefault$4 = interopRequireDefaultExports;
15489
+ var _interopRequireDefault$b = interopRequireDefaultExports;
15475
15490
  Object.defineProperty(PhotoCamera, "__esModule", {
15476
15491
  value: true
15477
15492
  });
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", {
15493
+ var default_1$c = PhotoCamera.default = void 0;
15494
+ var _createSvgIcon$b = _interopRequireDefault$b(requireCreateSvgIcon());
15495
+ var _jsxRuntime$b = jsxRuntimeExports;
15496
+ default_1$c = PhotoCamera.default = (0, _createSvgIcon$b.default)([/*#__PURE__*/(0, _jsxRuntime$b.jsx)("circle", {
15482
15497
  cx: "12",
15483
15498
  cy: "12",
15484
15499
  r: "3.2"
15485
- }, "0"), /*#__PURE__*/(0, _jsxRuntime$4.jsx)("path", {
15500
+ }, "0"), /*#__PURE__*/(0, _jsxRuntime$b.jsx)("path", {
15486
15501
  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
15502
  }, "1")], 'PhotoCamera');
15488
15503
 
15489
- const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading, isDeleting, t, }) => {
15504
+ const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading, isDeleting, }) => {
15505
+ const t = useTranslationContext();
15490
15506
  return (jsxRuntimeExports.jsxs(material.Box, { sx: {
15491
15507
  width: 60,
15492
15508
  height: 60,
@@ -15515,11 +15531,11 @@ const AvatarWithActions = ({ src, alt, onError, onUpload, onDelete, isUploading,
15515
15531
  color: 'common.white',
15516
15532
  bgcolor: 'rgba(0, 0, 0, 0.25)',
15517
15533
  '&: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: {
15534
+ }, 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
15535
  color: 'common.white',
15520
15536
  bgcolor: 'rgba(0, 0, 0, 0.25)',
15521
15537
  '&:hover': { bgcolor: 'rgba(0, 0, 0, 0.35)' },
15522
- }, children: jsxRuntimeExports.jsx(default_1$6, { fontSize: "small" }) })] })] }));
15538
+ }, children: jsxRuntimeExports.jsx(default_1$d, { fontSize: "small" }) })] })] }));
15523
15539
  };
15524
15540
 
15525
15541
  const HeaderContainer = material.styled(material.Box)({
@@ -15537,34 +15553,34 @@ const ContactName = material.styled(material.Typography)({
15537
15553
  maxWidth: 360,
15538
15554
  textAlign: 'center',
15539
15555
  });
15540
- const Header = ({ imgUrl, displayName, onError, tags, t, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
15556
+ const Header = ({ imgUrl, displayName, onError, tags, onEditTags, onUploadPhoto, onPhotoFileChange, photoInputRef, isUploadingPhoto, onDeletePhoto, isDeletingPhoto, }) => {
15541
15557
  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 })] }));
15558
+ 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
15559
  };
15544
15560
 
15545
15561
  var ArrowBack = {};
15546
15562
 
15547
- var _interopRequireDefault$3 = interopRequireDefaultExports;
15563
+ var _interopRequireDefault$a = interopRequireDefaultExports;
15548
15564
  Object.defineProperty(ArrowBack, "__esModule", {
15549
15565
  value: true
15550
15566
  });
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", {
15567
+ var default_1$b = ArrowBack.default = void 0;
15568
+ var _createSvgIcon$a = _interopRequireDefault$a(requireCreateSvgIcon());
15569
+ var _jsxRuntime$a = jsxRuntimeExports;
15570
+ default_1$b = ArrowBack.default = (0, _createSvgIcon$a.default)( /*#__PURE__*/(0, _jsxRuntime$a.jsx)("path", {
15555
15571
  d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20z"
15556
15572
  }), 'ArrowBack');
15557
15573
 
15558
15574
  var Save = {};
15559
15575
 
15560
- var _interopRequireDefault$2 = interopRequireDefaultExports;
15576
+ var _interopRequireDefault$9 = interopRequireDefaultExports;
15561
15577
  Object.defineProperty(Save, "__esModule", {
15562
15578
  value: true
15563
15579
  });
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", {
15580
+ var default_1$a = Save.default = void 0;
15581
+ var _createSvgIcon$9 = _interopRequireDefault$9(requireCreateSvgIcon());
15582
+ var _jsxRuntime$9 = jsxRuntimeExports;
15583
+ default_1$a = Save.default = (0, _createSvgIcon$9.default)( /*#__PURE__*/(0, _jsxRuntime$9.jsx)("path", {
15568
15584
  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
15585
  }), 'Save');
15570
15586
 
@@ -15573,11 +15589,11 @@ var useThemeWithoutDefault = {};
15573
15589
  Object.defineProperty(useThemeWithoutDefault, "__esModule", {
15574
15590
  value: true
15575
15591
  });
15576
- var default_1$2 = useThemeWithoutDefault.default = void 0;
15577
- var React = _interopRequireWildcard(React$1);
15592
+ var default_1$9 = useThemeWithoutDefault.default = void 0;
15593
+ var React = _interopRequireWildcard$1(React$1);
15578
15594
  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; }
15595
+ 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); }
15596
+ 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
15597
  function isObjectEmpty$2(obj) {
15582
15598
  return Object.keys(obj).length === 0;
15583
15599
  }
@@ -15585,7 +15601,7 @@ function useTheme$3(defaultTheme = null) {
15585
15601
  const contextTheme = React.useContext(_styledEngine.ThemeContext);
15586
15602
  return !contextTheme || isObjectEmpty$2(contextTheme) ? defaultTheme : contextTheme;
15587
15603
  }
15588
- default_1$2 = useThemeWithoutDefault.default = useTheme$3;
15604
+ default_1$9 = useThemeWithoutDefault.default = useTheme$3;
15589
15605
 
15590
15606
  var top = 'top';
15591
15607
  var bottom = 'bottom';
@@ -18502,7 +18518,7 @@ const getSideFromDirection = direction => {
18502
18518
  'column-reverse': 'Bottom'
18503
18519
  }[direction];
18504
18520
  };
18505
- const style = ({
18521
+ const style$3 = ({
18506
18522
  ownerState,
18507
18523
  theme
18508
18524
  }) => {
@@ -18579,7 +18595,7 @@ function createStack(options = {}) {
18579
18595
  };
18580
18596
  return composeClasses$2(slots, slot => generateUtilityClass$2(componentName, slot), {});
18581
18597
  };
18582
- const StackRoot = createStyledComponent(style);
18598
+ const StackRoot = createStyledComponent(style$3);
18583
18599
  const Stack = /*#__PURE__*/React__namespace.forwardRef(function Grid(inProps, ref) {
18584
18600
  const themeProps = useThemeProps(inProps);
18585
18601
  const props = extendSxProp(themeProps); // `color` type conflicts with html color attribute.
@@ -18672,7 +18688,7 @@ const PopperRoot = styled$3(BasePopper, {
18672
18688
  */
18673
18689
  const Popper = /*#__PURE__*/React__namespace.forwardRef(function Popper(inProps, ref) {
18674
18690
  var _slots$root;
18675
- const theme = default_1$2();
18691
+ const theme = default_1$9();
18676
18692
  const props = useDefaultProps({
18677
18693
  props: inProps,
18678
18694
  name: 'MuiPopper'
@@ -24574,7 +24590,8 @@ const PAGE_SIZE = 20;
24574
24590
  const AutocompletePopper = styled$3(MuiPopper)(({ theme }) => ({
24575
24591
  zIndex: theme.zIndex.modal + 1,
24576
24592
  }));
24577
- const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, t }) => {
24593
+ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving }) => {
24594
+ const t = useTranslationContext();
24578
24595
  const [searchValue, setSearchValue] = React$1.useState('');
24579
24596
  const [limit, setLimit] = React$1.useState(PAGE_SIZE);
24580
24597
  const safeOptions = React$1.useMemo(() => options ?? [], [options]);
@@ -24589,7 +24606,7 @@ const TagsEditor = ({ value, options, onChange, onBack, onSave, isSaving, t }) =
24589
24606
  if (nearBottom)
24590
24607
  setLimit((l) => l + PAGE_SIZE);
24591
24608
  };
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: {
24609
+ 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
24610
  onScroll: onListboxScroll,
24594
24611
  sx: { maxHeight: 280, overflowY: 'auto' },
24595
24612
  }, noOptionsText: t('global.noOptions'), sx: { width: '100%' } })] }));
@@ -25373,10 +25390,10 @@ class WebChatChannel {
25373
25390
  }
25374
25391
  WebChat.WebChatChannel = WebChatChannel;
25375
25392
 
25376
- var WhatsApp = {};
25393
+ var WhatsApp$1 = {};
25377
25394
 
25378
- Object.defineProperty(WhatsApp, "__esModule", { value: true });
25379
- WhatsApp.WhatsAppConfig = WhatsApp.WhatsAppConectionType = void 0;
25395
+ Object.defineProperty(WhatsApp$1, "__esModule", { value: true });
25396
+ WhatsApp$1.WhatsAppConfig = WhatsApp$1.WhatsAppConectionType = void 0;
25380
25397
  var WhatsAppConectionType;
25381
25398
  (function (WhatsAppConectionType) {
25382
25399
  // NULL = 0,
@@ -25384,21 +25401,21 @@ var WhatsAppConectionType;
25384
25401
  // TWILIO = 2,
25385
25402
  // DIALOG360 = 6,
25386
25403
  WhatsAppConectionType[WhatsAppConectionType["CLOUDAPI"] = 7] = "CLOUDAPI";
25387
- })(WhatsAppConectionType || (WhatsApp.WhatsAppConectionType = WhatsAppConectionType = {}));
25404
+ })(WhatsAppConectionType || (WhatsApp$1.WhatsAppConectionType = WhatsAppConectionType = {}));
25388
25405
  class WhatsAppConfig {
25389
25406
  }
25390
- WhatsApp.WhatsAppConfig = WhatsAppConfig;
25407
+ WhatsApp$1.WhatsAppConfig = WhatsAppConfig;
25391
25408
 
25392
- var RCS = {};
25409
+ var RCS$1 = {};
25393
25410
 
25394
- Object.defineProperty(RCS, "__esModule", { value: true });
25395
- RCS.RCSServiceAccount = RCS.RCSConfig = void 0;
25411
+ Object.defineProperty(RCS$1, "__esModule", { value: true });
25412
+ RCS$1.RCSServiceAccount = RCS$1.RCSConfig = void 0;
25396
25413
  class RCSConfig {
25397
25414
  }
25398
- RCS.RCSConfig = RCSConfig;
25415
+ RCS$1.RCSConfig = RCSConfig;
25399
25416
  class RCSServiceAccount {
25400
25417
  }
25401
- RCS.RCSServiceAccount = RCSServiceAccount;
25418
+ RCS$1.RCSServiceAccount = RCSServiceAccount;
25402
25419
 
25403
25420
  (function (exports) {
25404
25421
  var __createBinding = (commonjsGlobal && commonjsGlobal.__createBinding) || (Object.create ? (function(o, m, k, k2) {
@@ -25429,8 +25446,8 @@ RCS.RCSServiceAccount = RCSServiceAccount;
25429
25446
  __exportStar(Sip, exports);
25430
25447
  __exportStar(Sms, exports);
25431
25448
  __exportStar(WebChat, exports);
25432
- __exportStar(WhatsApp, exports);
25433
- __exportStar(RCS, exports);
25449
+ __exportStar(WhatsApp$1, exports);
25450
+ __exportStar(RCS$1, exports);
25434
25451
  } (Channels));
25435
25452
 
25436
25453
  // Unique ID creation requires a high quality random # generator. In the browser we therefore
@@ -26325,6 +26342,20 @@ const resolveUserLabel = ({ userId, users, currentUser, }) => {
26325
26342
  return fromUsers?.name?.trim() || fromUsers?.email || null;
26326
26343
  };
26327
26344
 
26345
+ const Section = ({ title, children }) => {
26346
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: {
26347
+ border: '1px solid',
26348
+ borderColor: 'divider',
26349
+ borderRadius: 2,
26350
+ p: 2,
26351
+ mb: 2,
26352
+ }, children: [jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle1", sx: { fontWeight: 600 }, children: title }), jsxRuntimeExports.jsx(material.Divider, { sx: { my: 1.5 } }), children] }));
26353
+ };
26354
+
26355
+ const SectionContent = ({ children, ...boxProps }) => {
26356
+ return (jsxRuntimeExports.jsx(material.Box, { display: "grid", gridTemplateColumns: { xs: '1fr', md: 'repeat(2, minmax(0, 1fr))' }, gap: 2, ...boxProps, children: children }));
26357
+ };
26358
+
26328
26359
  var weekOfYear = {exports: {}};
26329
26360
 
26330
26361
  (function (module, exports) {
@@ -52411,20 +52442,20 @@ const DateSelect = ({ birthDate, setBirthDate, dateFormat }) => {
52411
52442
 
52412
52443
  var Cancel = {};
52413
52444
 
52414
- var _interopRequireDefault$1 = interopRequireDefaultExports;
52445
+ var _interopRequireDefault$8 = interopRequireDefaultExports;
52415
52446
  Object.defineProperty(Cancel, "__esModule", {
52416
52447
  value: true
52417
52448
  });
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", {
52449
+ var default_1$8 = Cancel.default = void 0;
52450
+ var _createSvgIcon$8 = _interopRequireDefault$8(requireCreateSvgIcon());
52451
+ var _jsxRuntime$8 = jsxRuntimeExports;
52452
+ default_1$8 = Cancel.default = (0, _createSvgIcon$8.default)( /*#__PURE__*/(0, _jsxRuntime$8.jsx)("path", {
52422
52453
  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
52454
  }), 'Cancel');
52424
52455
 
52425
52456
  const isUserInfo = (option) => 'email' in option;
52426
52457
  const isContactBirthdayProps = (p) => p.entityType === 'contact' && p.inputType === 'birthday';
52427
- const StyledIconButton$1 = material.styled(material.IconButton)({
52458
+ const StyledIconButton$2 = material.styled(material.IconButton)({
52428
52459
  opacity: 0,
52429
52460
  transition: 'opacity 0.3s ease-in-out',
52430
52461
  '& .MuiSvgIcon-root': {
@@ -52441,6 +52472,7 @@ const StyledSaveCancelButton$1 = material.styled(material.IconButton)({
52441
52472
  });
52442
52473
  const EntityInfoLabel = (props) => {
52443
52474
  const { title, value, isNotEditable, displayValue, baseUrl, spaceId, minWidth, onEntityUpdated, } = props;
52475
+ const t = useTranslationContext();
52444
52476
  const inputType = props.inputType ?? 'text';
52445
52477
  const [isEditing, setIsEditing] = React$1.useState(false);
52446
52478
  const [isSaving, setIsSaving] = React$1.useState(false);
@@ -52553,18 +52585,18 @@ const EntityInfoLabel = (props) => {
52553
52585
  '&:hover .edit-icon': {
52554
52586
  opacity: 1,
52555
52587
  },
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'
52588
+ }, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: '25px', children: [jsxRuntimeExports.jsx(material.Typography, { letterSpacing: -0.5, fontWeight: '600', alignSelf: 'center', flexGrow: isEditing ? 1 : 0, color: (theme) => theme.palette.text.primary, children: title }), isNotEditable ? null : isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton$1, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$2, { className: "edit-icon", size: "small", onClick: handleEditClick, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(material.Box, { width: isEditing ? '100%' : '50%', position: "relative", children: isEditing && inputType === 'text' ? (jsxRuntimeExports.jsx(material.TextField, { value: textValue, onChange: handleInputChange, variant: "standard", size: "small", sx: { width: '100%' } })) : isEditing && (inputType === 'select' || inputType === 'selectMembers') ? (jsxRuntimeExports.jsxs(material.Select, { value: selectValue, onChange: handleSelectChange, variant: "standard", size: "small", sx: { width: '100%' }, children: [props.entityType === 'contact' ? (jsxRuntimeExports.jsx(material.MenuItem, { value: "", children: t('contactDetails.contactInfo.emptySelection') })) : null, options.map((option, index) => (jsxRuntimeExports.jsx(material.MenuItem, { value: option.id, children: props.entityType === 'contact'
52557
52589
  ? option.name?.trim() || (isUserInfo(option) ? option.email : '') || 'Sin nombre'
52558
52590
  : 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
52591
  };
52560
52592
 
52561
52593
  const ContactInfoLabel = (props) => {
52562
- const { title, value, isNotEditable, options = [], displayValue, constructUpdateObject, businessId, baseUrl, spaceId, contactId, t, onEntityUpdated, } = props;
52594
+ const { title, value, isNotEditable, options = [], displayValue, constructUpdateObject, businessId, baseUrl, spaceId, contactId, onEntityUpdated, } = props;
52563
52595
  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 }));
52596
+ 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
52597
  }
52566
52598
  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 }));
52599
+ 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
52600
  };
52569
52601
 
52570
52602
  const CustomPropertyInput = ({ nameKey, value, onChange, type, }) => {
@@ -52622,7 +52654,8 @@ const CustomPropertyDatePicker = ({ value, handleChange, dateFormat }) => {
52622
52654
  } }) }) }));
52623
52655
  };
52624
52656
 
52625
- const CustomPropertyOptionsSelect = ({ handleChange, value, options, t }) => {
52657
+ const CustomPropertyOptionsSelect = ({ handleChange, value, options }) => {
52658
+ const t = useTranslationContext();
52626
52659
  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
52660
  };
52628
52661
 
@@ -54320,7 +54353,8 @@ MultiInputTimeRangeField.propTypes = {
54320
54353
  value: PropTypes.arrayOf(PropTypes.object)
54321
54354
  };
54322
54355
 
54323
- const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat, t, }) => {
54356
+ const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat }) => {
54357
+ const t = useTranslationContext();
54324
54358
  const initDates = [
54325
54359
  dayjs().set('hour', 0).set('minute', 0),
54326
54360
  dayjs().set('hour', 0).set('minute', 0),
@@ -54328,9 +54362,7 @@ const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat, t,
54328
54362
  const timeFormat = userTimeFormat === '24' ? 'HH:mm' : 'hh:mm';
54329
54363
  return (jsxRuntimeExports.jsx(LocalizationProvider, { dateAdapter: AdapterDayjs, children: jsxRuntimeExports.jsx(Box$1, { sx: { overflow: 'visible', paddingTop: '0px' }, children: jsxRuntimeExports.jsx(MultiInputTimeRangeField, { slotProps: {
54330
54364
  textField: ({ position }) => ({
54331
- label: position === 'start'
54332
- ? t('contactEdit.from')
54333
- : t('contactEdit.to'),
54365
+ label: position === 'start' ? t('contactEdit.from') : t('contactEdit.to'),
54334
54366
  size: 'small',
54335
54367
  variant: 'standard',
54336
54368
  inputProps: {
@@ -54340,7 +54372,8 @@ const CustomPropertyTimeRangePicker = ({ value, handleChange, userTimeFormat, t,
54340
54372
  }, value: value ? value : initDates, onChange: (newValue) => handleChange(newValue), format: timeFormat }) }) }));
54341
54373
  };
54342
54374
 
54343
- const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat, t }) => {
54375
+ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat }) => {
54376
+ const t = useTranslationContext();
54344
54377
  // Default date range if value is null
54345
54378
  const initDates = [dayjs(), dayjs()];
54346
54379
  // Determina el formato dinámico
@@ -54360,7 +54393,7 @@ const CustomPropertyDateRangePicker = ({ value, handleChange, userDateFormat, t
54360
54393
  }, value: value || initDates, onChange: (newValue) => handleChange(newValue), format: dateFormat }) }) }));
54361
54394
  };
54362
54395
 
54363
- const StyledIconButton = material.styled(material.IconButton)(() => ({
54396
+ const StyledIconButton$1 = material.styled(material.IconButton)(() => ({
54364
54397
  opacity: 0,
54365
54398
  transition: 'opacity 0.3s ease-in-out',
54366
54399
  '& .MuiSvgIcon-root': {
@@ -54400,7 +54433,7 @@ const FieldValue = material.styled(material.Typography)(({ theme }) => ({
54400
54433
  overflow: 'auto',
54401
54434
  whiteSpace: 'break-spaces',
54402
54435
  }));
54403
- const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, customContactFields, userTrii, baseUrl, spaceId, t, onEntityUpdated, }) => {
54436
+ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, customContactFields, userTrii, baseUrl, spaceId, onEntityUpdated, }) => {
54404
54437
  const { customProperties } = entity.field;
54405
54438
  const { setCustomProperties } = entity.action;
54406
54439
  const [isEditing, setIsEditing] = React$1.useState(false);
@@ -54440,8 +54473,7 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54440
54473
  if (!entityId)
54441
54474
  return;
54442
54475
  setIsSaving(true);
54443
- const current = customProperties.find((p) => p.nameKey === property.nameKey) ||
54444
- property;
54476
+ const current = customProperties.find((p) => p.nameKey === property.nameKey) || property;
54445
54477
  const { nameKey, value } = current;
54446
54478
  // Definición del campo (si existe)
54447
54479
  const fieldDef = customContactFields.find((f) => f.nameKey === nameKey);
@@ -54552,25 +54584,18 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54552
54584
  : null, handleChange: (newValue) => handleInputChange(nameKey, newValue), userTimeFormat: userTimeFormat }));
54553
54585
  else if (type === Contacts.ContactField_type.DATERANGE)
54554
54586
  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 }));
54587
+ ? [dayjs(value.split(' - ')[0]), dayjs(value.split(' - ')[1])]
54588
+ : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userDateFormat: userDateFormat }));
54560
54589
  else if (type === Contacts.ContactField_type.TIMERANGE)
54561
54590
  return (jsxRuntimeExports.jsx(CustomPropertyTimeRangePicker, { value: Array.isArray(value) && value.length === 2
54562
54591
  ? [dayjs(value[0]), dayjs(value[1])]
54563
- : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userTimeFormat: userTimeFormat, t: t }));
54592
+ : null, handleChange: (newValue) => handleInputChange(nameKey, [newValue[0]?.toDate?.(), newValue[1]?.toDate?.()]), userTimeFormat: userTimeFormat }));
54564
54593
  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 }));
54594
+ return (jsxRuntimeExports.jsx(CustomPropertyOptionsSelect, { value: typeof value === 'string' ? value : '', handleChange: (newValue) => handleInputChange(nameKey, newValue), options: customContactFields.find((field) => field.nameKey === nameKey)?.typeOptions ?? [] }));
54566
54595
  else
54567
54596
  return (jsxRuntimeExports.jsx(CustomPropertyInput, { type: type, nameKey: nameKey, value: value, onChange: handleInputChange }));
54568
54597
  };
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)
54598
+ return (jsxRuntimeExports.jsxs(ContactBox, { className: `fadein ${property.type === Contacts.ContactField_type.LONGTEXT ? 'contacts-col-12' : 'contacts-col-5'}`, children: [jsxRuntimeExports.jsxs(material.Box, { display: "flex", position: "relative", minHeight: "25px", children: [jsxRuntimeExports.jsx(FieldName, { flexGrow: isEditing ? 1 : 0, children: getPropertyName(property.nameKey) }), isEditing ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleSave, children: isSaving ? jsxRuntimeExports.jsx(material.CircularProgress, { size: 24 }) : jsxRuntimeExports.jsx(default_1$a, {}) }), jsxRuntimeExports.jsx(StyledSaveCancelButton, { size: "small", onClick: handleCancel, children: jsxRuntimeExports.jsx(default_1$8, {}) })] })) : (jsxRuntimeExports.jsx(StyledIconButton$1, { className: "edit-icon", size: "small", onClick: toggleEdit, children: jsxRuntimeExports.jsx(default_1$f, {}) }))] }), jsxRuntimeExports.jsx(material.Box, { width: isEditing || property.type === Contacts.ContactField_type.LONGTEXT ? '100%' : '50%', position: "relative", children: isEditing ? (EditField()) : (jsxRuntimeExports.jsx(FieldValue, { children: hasValue(property?.value)
54574
54599
  ? property.type === Contacts.ContactField_type.DATERANGE
54575
54600
  ? (() => {
54576
54601
  if (typeof property.value === 'string') {
@@ -54619,7 +54644,8 @@ const EntityCustomFieldLabel = ({ property, entity, entityType, entityId, custom
54619
54644
  };
54620
54645
 
54621
54646
  const ContactGeneral = (props) => {
54622
- const { dateFormat, entityData, customContactFields, baseUrl, spaceId, t, currentUser, onEntityUpdated } = props;
54647
+ const { dateFormat, entityData, customContactFields, baseUrl, spaceId, currentUser, onEntityUpdated, } = props;
54648
+ const t = useTranslationContext();
54623
54649
  const { entityType, editEntity } = useEditEntity();
54624
54650
  const api = useEditContactApi();
54625
54651
  if (entityType !== 'contact') {
@@ -54697,9 +54723,9 @@ const ContactGeneral = (props) => {
54697
54723
  };
54698
54724
  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
54725
  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) => ({
54726
+ }), 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
54727
  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)))] }) }));
54728
+ }), 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
54729
  };
54704
54730
 
54705
54731
  const BusinessInfoLabel = ({ title, value, isNotEditable, inputType = 'text', options = [], displayValue, constructUpdateObject, baseUrl, spaceId, businessId, onEntityUpdated, }) => {
@@ -54707,7 +54733,8 @@ const BusinessInfoLabel = ({ title, value, isNotEditable, inputType = 'text', op
54707
54733
  };
54708
54734
 
54709
54735
  const BusinessGeneral = (props) => {
54710
- const { entityData, customContactFields, baseUrl, spaceId, t, currentUser, onEntityUpdated } = props;
54736
+ const t = useTranslationContext();
54737
+ const { entityData, customContactFields, baseUrl, spaceId, currentUser, onEntityUpdated } = props;
54711
54738
  const { entityType, editEntity } = useEditEntity();
54712
54739
  const api = useEditContactApi();
54713
54740
  if (entityType !== 'business') {
@@ -54773,7 +54800,7 @@ const BusinessGeneral = (props) => {
54773
54800
  }, [api, entityData, users, currentUser]);
54774
54801
  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
54802
  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)))] }) }));
54803
+ }), 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
54804
  };
54778
54805
 
54779
54806
  const General = (props) => {
@@ -54786,7 +54813,22 @@ const General = (props) => {
54786
54813
  return normalizedEntityType === 'contact' ? (jsxRuntimeExports.jsx(ContactGeneral, { ...props, entityData: entityData, entityType: "contact" })) : (jsxRuntimeExports.jsx(BusinessGeneral, { ...props, entityData: entityData, entityType: "business" }));
54787
54814
  };
54788
54815
 
54789
- styled$1(material.Box)(({ theme }) => ({
54816
+ // useModal.ts
54817
+ const useEditModal = () => {
54818
+ const [isOpen, setIsOpen] = React$1.useState(false);
54819
+ const [title, setTitle] = React$1.useState('');
54820
+ const openModal = (title) => {
54821
+ setTitle(title);
54822
+ setIsOpen(true);
54823
+ };
54824
+ const closeModal = () => {
54825
+ setIsOpen(false);
54826
+ setTitle(''); // Clear the title when the modal closes
54827
+ };
54828
+ return { isOpen, title, openModal, closeModal };
54829
+ };
54830
+
54831
+ const StyledBox$1 = styled$1(material.Box)(({ theme }) => ({
54790
54832
  display: 'flex',
54791
54833
  alignItems: 'flex-start',
54792
54834
  justifyContent: 'space-between',
@@ -54799,19 +54841,19 @@ styled$1(material.Box)(({ theme }) => ({
54799
54841
  minHeight: '50px',
54800
54842
  position: 'relative',
54801
54843
  }));
54802
- styled$1(material.Box)(({ theme }) => ({
54844
+ const LeftSection$1 = styled$1(material.Box)(({ theme }) => ({
54803
54845
  display: 'flex',
54804
54846
  alignItems: 'flex-start',
54805
54847
  gap: theme.spacing(1),
54806
54848
  overflow: 'hidden',
54807
54849
  maxWidth: '80%',
54808
54850
  }));
54809
- styled$1(material.Box)(({ theme }) => ({
54851
+ const RightSection$1 = styled$1(material.Box)(({ theme }) => ({
54810
54852
  display: 'flex',
54811
54853
  alignItems: 'center',
54812
54854
  gap: theme.spacing(1),
54813
54855
  }));
54814
- styled$1(material.Box)(({ theme }) => ({
54856
+ const ContactDetails$1 = styled$1(material.Box)(({ theme }) => ({
54815
54857
  display: 'flex',
54816
54858
  flexDirection: 'column',
54817
54859
  alignItems: 'flex-start',
@@ -54821,7 +54863,7 @@ styled$1(material.Box)(({ theme }) => ({
54821
54863
  flexWrap: 'wrap',
54822
54864
  marginTop: '-5px',
54823
54865
  }));
54824
- styled$1(material.Avatar)(({}) => ({
54866
+ const AvatarWrapper = styled$1(material.Avatar)(({}) => ({
54825
54867
  width: 32,
54826
54868
  height: 32,
54827
54869
  cursor: 'pointer',
@@ -54833,32 +54875,51 @@ const EllipsisText$1 = styled$1(material.Box)(({}) => ({
54833
54875
  overflow: 'hidden',
54834
54876
  textOverflow: 'ellipsis',
54835
54877
  }));
54836
- styled$1(EllipsisText$1)(({ theme }) => ({
54878
+ const NoteText$1 = styled$1(EllipsisText$1)(({ theme }) => ({
54837
54879
  fontSize: 12,
54838
54880
  color: theme.palette.text.secondary,
54839
54881
  position: 'absolute',
54840
54882
  bottom: 0,
54841
54883
  maxWidth: '70%',
54842
54884
  }));
54843
- styled$1(EllipsisText$1)(({}) => ({
54885
+ const PhoneText$1 = styled$1(EllipsisText$1)(({}) => ({
54844
54886
  fontSize: 14,
54845
54887
  fontWeight: 500,
54846
54888
  }));
54847
- styled$1(EllipsisText$1)(({}) => ({
54889
+ const ProfileNameText = styled$1(EllipsisText$1)(({}) => ({
54848
54890
  fontSize: 14,
54849
54891
  fontWeight: 500,
54850
54892
  }));
54893
+ const ContactMethodItem = ({ item }) => {
54894
+ const avatarUrlWithoutAccess = item.profileUrl;
54895
+ const { imageUrl } = useImage({
54896
+ initialImageUrl: avatarUrlWithoutAccess,
54897
+ });
54898
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox$1, { children: [jsxRuntimeExports.jsx(LeftSection$1, { children: jsxRuntimeExports.jsxs(ContactDetails$1, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: item.address || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText$1, { children: item.address }) }), jsxRuntimeExports.jsx(material.Tooltip, { title: item.profileName || '', arrow: true, children: jsxRuntimeExports.jsx(ProfileNameText, { sx: {
54899
+ marginTop: '-10px',
54900
+ marginLeft: '5px',
54901
+ fontSize: '10px',
54902
+ }, 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: {
54903
+ display: 'flex',
54904
+ alignItems: 'center',
54905
+ justifyContent: 'flex-end',
54906
+ }, children: jsxRuntimeExports.jsx(material.IconButton, { size: "small", sx: { marginTop: '-5px', padding: 0 }, children: item.isFavorite ? (jsxRuntimeExports.jsx(Star, { sx: {
54907
+ color: '#fcac34',
54908
+ } })) : (jsxRuntimeExports.jsx(StarBorder, { sx: {
54909
+ color: '#fcac34',
54910
+ } })) }) })] })] }) }));
54911
+ };
54851
54912
 
54852
54913
  var LocalPhone = {};
54853
54914
 
54854
- var _interopRequireDefault = interopRequireDefaultExports;
54915
+ var _interopRequireDefault$7 = interopRequireDefaultExports;
54855
54916
  Object.defineProperty(LocalPhone, "__esModule", {
54856
54917
  value: true
54857
54918
  });
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", {
54919
+ var default_1$7 = LocalPhone.default = void 0;
54920
+ var _createSvgIcon$7 = _interopRequireDefault$7(requireCreateSvgIcon());
54921
+ var _jsxRuntime$7 = jsxRuntimeExports;
54922
+ default_1$7 = LocalPhone.default = (0, _createSvgIcon$7.default)( /*#__PURE__*/(0, _jsxRuntime$7.jsx)("path", {
54862
54923
  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
54924
  }), 'LocalPhone');
54864
54925
 
@@ -56072,18 +56133,38 @@ goog.TRUSTED_TYPES_POLICY_NAME="goog";goog.identity_=function(a){return a};
56072
56133
 
56073
56134
  var libphonenumberExports = libphonenumber.exports;
56074
56135
 
56075
- libphonenumberExports.PhoneNumberUtil.getInstance();
56136
+ const phoneUtil = libphonenumberExports.PhoneNumberUtil.getInstance();
56137
+ /**
56138
+ * Returns a user-friendly display format for a sanitized phone number.
56139
+ * Always uses INTERNATIONAL format, e.g. "+54 358 402 2664"
56140
+ */
56141
+ const formatPhoneForDisplay = (number) => {
56142
+ if (!number || !number.trim())
56143
+ return number;
56144
+ try {
56145
+ const parsed = phoneUtil.parse(number, undefined);
56146
+ if (!phoneUtil.isValidNumber(parsed)) {
56147
+ // If not valid, just return as-is
56148
+ return number;
56149
+ }
56150
+ // Always use INTERNATIONAL format
56151
+ return phoneUtil.format(parsed, libphonenumberExports.PhoneNumberFormat.INTERNATIONAL);
56152
+ }
56153
+ catch (e) {
56154
+ return number;
56155
+ }
56156
+ };
56076
56157
 
56077
- styled$1(material.IconButton)(({ theme }) => ({
56158
+ const StyledIconButton = styled$1(material.IconButton)(({ theme }) => ({
56078
56159
  padding: theme.spacing(0.5),
56079
56160
  marginTop: '-5px',
56080
56161
  }));
56081
- styled$1(default_1)(({ theme }) => ({
56162
+ const StyledLocalPhoneIcon = styled$1(default_1$7)(({ theme }) => ({
56082
56163
  height: 16,
56083
56164
  width: 16,
56084
56165
  color: theme.palette.secondary.main
56085
56166
  }));
56086
- styled$1(material.Box)(({ theme }) => ({
56167
+ const StyledBox = styled$1(material.Box)(({ theme }) => ({
56087
56168
  display: 'flex',
56088
56169
  alignItems: 'flex-start',
56089
56170
  justifyContent: 'space-between',
@@ -56096,18 +56177,18 @@ styled$1(material.Box)(({ theme }) => ({
56096
56177
  minHeight: '50px',
56097
56178
  position: 'relative',
56098
56179
  }));
56099
- styled$1(material.Box)(({ theme }) => ({
56180
+ const LeftSection = styled$1(material.Box)(({ theme }) => ({
56100
56181
  display: 'flex',
56101
56182
  alignItems: 'flex-start',
56102
56183
  gap: theme.spacing(1),
56103
56184
  maxWidth: '80%',
56104
56185
  }));
56105
- styled$1(material.Box)(({ theme }) => ({
56186
+ const RightSection = styled$1(material.Box)(({ theme }) => ({
56106
56187
  display: 'flex',
56107
56188
  alignItems: 'center',
56108
56189
  gap: theme.spacing(1),
56109
56190
  }));
56110
- styled$1(material.Box)(({ theme }) => ({
56191
+ const ContactDetails = styled$1(material.Box)(({ theme }) => ({
56111
56192
  display: 'flex',
56112
56193
  flexDirection: 'column',
56113
56194
  alignItems: 'flex-start',
@@ -56124,54 +56205,702 @@ const EllipsisText = styled$1(material.Box)(({}) => ({
56124
56205
  overflow: 'hidden',
56125
56206
  textOverflow: 'ellipsis',
56126
56207
  }));
56127
- styled$1(EllipsisText)(({ theme }) => ({
56208
+ const NoteText = styled$1(EllipsisText)(({ theme }) => ({
56128
56209
  fontSize: 12,
56129
56210
  color: theme.palette.text.secondary,
56130
56211
  position: 'absolute',
56131
56212
  bottom: 0,
56132
56213
  maxWidth: '70%',
56133
56214
  }));
56134
- styled$1(EllipsisText)(({}) => ({
56215
+ const PhoneText = styled$1(EllipsisText)(({}) => ({
56135
56216
  fontSize: 14,
56136
56217
  fontWeight: 500,
56137
56218
  }));
56219
+ const ContactMethodPhoneItem = ({ item }) => {
56220
+ const handleCallContact = () => {
56221
+ const contactPhone = item.address;
56222
+ if (!contactPhone)
56223
+ return;
56224
+ const event = new CustomEvent('call-contact-header', {
56225
+ detail: { phoneAddress: contactPhone },
56226
+ });
56227
+ window.dispatchEvent(event);
56228
+ };
56229
+ const formattedPhone = React$1.useMemo(() => formatPhoneForDisplay(item.address || ''), [item.address]);
56230
+ return (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsxs(StyledBox, { children: [jsxRuntimeExports.jsxs(LeftSection, { children: [jsxRuntimeExports.jsx(StyledIconButton, { onClick: handleCallContact, color: "primary", size: "small", children: jsxRuntimeExports.jsx(StyledLocalPhoneIcon, {}) }), jsxRuntimeExports.jsxs(ContactDetails, { children: [jsxRuntimeExports.jsx(material.Tooltip, { title: formattedPhone || '', arrow: true, children: jsxRuntimeExports.jsx(PhoneText, { children: formattedPhone }) }), jsxRuntimeExports.jsx(material.Tooltip, { title: item.note || '', arrow: true, children: jsxRuntimeExports.jsx(NoteText, { children: item.note }) })] })] }), jsxRuntimeExports.jsx(RightSection, { children: jsxRuntimeExports.jsx(material.Box, { sx: {
56231
+ display: 'flex',
56232
+ alignItems: 'center',
56233
+ justifyContent: 'flex-end',
56234
+ }, children: jsxRuntimeExports.jsx(material.IconButton, { size: "small", sx: { marginTop: '-5px', padding: 0 }, children: item.isFavorite ? (jsxRuntimeExports.jsx(Star, { sx: {
56235
+ color: '#fcac34',
56236
+ } })) : (jsxRuntimeExports.jsx(StarBorder, { sx: {
56237
+ color: '#fcac34',
56238
+ } })) }) }) })] }) }));
56239
+ };
56240
+
56241
+ const ContactMethod = ({ title, methodItems, isPhone, handleEdit, owner }) => {
56242
+ return (jsxRuntimeExports.jsxs("div", { className: "w-full rounded-xl border border-gray-200 bg-white/60 p-3 shadow-sm transition hover:-translate-y-0.5 hover:shadow-md", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [jsxRuntimeExports.jsx("p", { className: "text-sm font-semibold text-gray-800", children: title }), jsxRuntimeExports.jsx(material.IconButton, { "aria-label": `Edit ${title}`, size: "small", onClick: handleEdit, className: "edit-icon text-gray-500 transition hover:text-gray-800", children: jsxRuntimeExports.jsx(default_1$f, { fontSize: "small" }) })] }), jsxRuntimeExports.jsx("div", { className: "mt-3 space-y-2", children: methodItems.map((item, index) => {
56243
+ if (isPhone) {
56244
+ return jsxRuntimeExports.jsx(ContactMethodPhoneItem, { item: item }, index);
56245
+ }
56246
+ return jsxRuntimeExports.jsx(ContactMethodItem, { item: item, owner: owner }, index);
56247
+ }) })] }));
56248
+ };
56138
56249
 
56139
- styled$1(material.Box)(({ theme }) => ({
56140
- display: 'flex',
56141
- flexDirection: 'column',
56142
- padding: theme.spacing(1, 0, 2, 0),
56143
- width: '100%',
56144
- gap: theme.spacing(1),
56145
- '&:hover .edit-icon': {
56146
- opacity: 1,
56250
+ const SubsectionHeader = ({ title }) => {
56251
+ return (jsxRuntimeExports.jsx(material.Box, { children: jsxRuntimeExports.jsx(material.Typography, { variant: "subtitle2", children: title }) }));
56252
+ };
56253
+
56254
+ const subsectionHeaderWithButtonStyle = {
56255
+ container: {
56256
+ display: 'flex',
56257
+ justifyContent: 'space-between',
56258
+ alignItems: 'center'
56147
56259
  },
56148
- }));
56149
- styled$1(material.Typography)(({ theme }) => ({
56150
- letterSpacing: -0.5,
56151
- fontSize: 14,
56152
- fontWeight: 600,
56153
- }));
56154
- styled$1(material.Box)(({ theme }) => ({
56155
- display: 'flex',
56156
- alignItems: 'center',
56157
- }));
56158
- styled$1(material.Box)(({ theme }) => ({
56159
- display: 'flex',
56160
- flexDirection: 'column',
56161
- gap: theme.spacing(1),
56162
- width: '100%',
56163
- }));
56164
- styled$1(material.IconButton)({
56165
- opacity: 0,
56166
- transition: 'opacity 0.3s ease-in-out',
56167
- '& .MuiSvgIcon-root': {
56168
- width: '0.8em',
56169
- height: '0.8em',
56260
+ };
56261
+
56262
+ var Add = {};
56263
+
56264
+ var _interopRequireDefault$6 = interopRequireDefaultExports;
56265
+ Object.defineProperty(Add, "__esModule", {
56266
+ value: true
56267
+ });
56268
+ var default_1$6 = Add.default = void 0;
56269
+ var _createSvgIcon$6 = _interopRequireDefault$6(requireCreateSvgIcon());
56270
+ var _jsxRuntime$6 = jsxRuntimeExports;
56271
+ default_1$6 = Add.default = (0, _createSvgIcon$6.default)( /*#__PURE__*/(0, _jsxRuntime$6.jsx)("path", {
56272
+ d: "M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6z"
56273
+ }), 'Add');
56274
+
56275
+ const SubsectionHeaderWithButton = ({ title, handleAdd }) => {
56276
+ const t = useTranslationContext();
56277
+ console.log('[SubsectionHeaderWithButton] title:', title, 't fn:', t?.name || 'anonymous');
56278
+ 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: t('global.add') })] }));
56279
+ };
56280
+
56281
+ const informationItemContainerStyle = {
56282
+ container: {
56283
+ border: '1px solid lightgray',
56284
+ borderRadius: 1,
56285
+ p: 2,
56286
+ width: '100%',
56287
+ display: 'flex',
56288
+ flexDirection: 'column',
56289
+ gap: 1,
56170
56290
  },
56171
- marginLeft: '15px',
56291
+ };
56292
+
56293
+ const InformationItemContainer = ({ children }) => {
56294
+ return jsxRuntimeExports.jsx(material.Box, { sx: informationItemContainerStyle.container, children: children });
56295
+ };
56296
+
56297
+ const noteDeleteButtonStyle = {
56298
+ container: {
56299
+ display: 'flex',
56300
+ width: '50%',
56301
+ alignItems: 'center',
56302
+ justifyContent: 'end'
56303
+ },
56304
+ noteTextField: {
56305
+ width: '100%',
56306
+ marginRight: '15px'
56307
+ },
56308
+ };
56309
+
56310
+ var MoreVert = {};
56311
+
56312
+ var _interopRequireDefault$5 = interopRequireDefaultExports;
56313
+ Object.defineProperty(MoreVert, "__esModule", {
56314
+ value: true
56315
+ });
56316
+ var default_1$5 = MoreVert.default = void 0;
56317
+ var _createSvgIcon$5 = _interopRequireDefault$5(requireCreateSvgIcon());
56318
+ var _jsxRuntime$5 = jsxRuntimeExports;
56319
+ default_1$5 = MoreVert.default = (0, _createSvgIcon$5.default)( /*#__PURE__*/(0, _jsxRuntime$5.jsx)("path", {
56320
+ 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"
56321
+ }), 'MoreVert');
56322
+
56323
+ var WhatsApp = {};
56324
+
56325
+ var _interopRequireDefault$4 = interopRequireDefaultExports;
56326
+ Object.defineProperty(WhatsApp, "__esModule", {
56327
+ value: true
56328
+ });
56329
+ var default_1$4 = WhatsApp.default = void 0;
56330
+ _interopRequireWildcard(React$1);
56331
+ var _createSvgIcon$4 = _interopRequireDefault$4(requireCreateSvgIcon());
56332
+ var _jsxRuntime$4 = jsxRuntimeExports;
56333
+ 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); }
56334
+ 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; }
56335
+ default_1$4 = WhatsApp.default = (0, _createSvgIcon$4.default)( /*#__PURE__*/(0, _jsxRuntime$4.jsx)("path", {
56336
+ 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"
56337
+ }), 'WhatsApp');
56338
+
56339
+ var Mms = {};
56340
+
56341
+ var _interopRequireDefault$3 = interopRequireDefaultExports;
56342
+ Object.defineProperty(Mms, "__esModule", {
56343
+ value: true
56344
+ });
56345
+ var default_1$3 = Mms.default = void 0;
56346
+ var _createSvgIcon$3 = _interopRequireDefault$3(requireCreateSvgIcon());
56347
+ var _jsxRuntime$3 = jsxRuntimeExports;
56348
+ default_1$3 = Mms.default = (0, _createSvgIcon$3.default)( /*#__PURE__*/(0, _jsxRuntime$3.jsx)("path", {
56349
+ 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"
56350
+ }), 'Mms');
56351
+
56352
+ const OptionsMenu = ({ onDelete, addressData, handleLinkAccountSave, checked, onCheckContactAddress, }) => {
56353
+ const t = useTranslationContext();
56354
+ const [anchorEl, setAnchorEl] = React$1.useState(null);
56355
+ const open = Boolean(anchorEl);
56356
+ const { channelType, address } = addressData;
56357
+ const [verifying, setVerifying] = React$1.useState(false);
56358
+ const [verificationResult, setVerificationResult] = React$1.useState(null);
56359
+ const [modalOpen, setModalOpen] = React$1.useState(false);
56360
+ const handleClick = (event) => {
56361
+ setAnchorEl(event.currentTarget);
56362
+ };
56363
+ const handleClose = () => {
56364
+ setAnchorEl(null);
56365
+ };
56366
+ const handleModalClose = () => {
56367
+ setModalOpen(false);
56368
+ };
56369
+ const handleDelete = () => {
56370
+ onDelete();
56371
+ handleClose();
56372
+ };
56373
+ const handleCheckWA = async () => {
56374
+ setVerifying(true);
56375
+ try {
56376
+ if (!onCheckContactAddress) {
56377
+ return;
56378
+ }
56379
+ const result = await onCheckContactAddress(13);
56380
+ if (!result) {
56381
+ return;
56382
+ }
56383
+ setVerificationResult(result);
56384
+ setModalOpen(true);
56385
+ }
56386
+ catch (error) {
56387
+ console.error('Error verifying WhatsApp account:', error);
56388
+ }
56389
+ finally {
56390
+ setVerifying(false);
56391
+ }
56392
+ handleClose();
56393
+ };
56394
+ const handleCheckRCS = async () => {
56395
+ setVerifying(true);
56396
+ try {
56397
+ if (!onCheckContactAddress) {
56398
+ return;
56399
+ }
56400
+ const result = await onCheckContactAddress(21);
56401
+ if (!result) {
56402
+ return;
56403
+ }
56404
+ setVerificationResult(result);
56405
+ setModalOpen(true);
56406
+ }
56407
+ catch (error) {
56408
+ console.error('Error verifying RCS account:', error);
56409
+ }
56410
+ finally {
56411
+ setVerifying(false);
56412
+ }
56413
+ handleClose();
56414
+ };
56415
+ const handleLinkAccount = async () => {
56416
+ await handleLinkAccountSave();
56417
+ setModalOpen(false);
56418
+ };
56419
+ 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: {
56420
+ 'aria-labelledby': 'basic-button',
56421
+ }, 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: {
56422
+ position: 'absolute',
56423
+ top: '50%',
56424
+ left: '50%',
56425
+ transform: 'translate(-50%, -50%)',
56426
+ width: 400,
56427
+ boxShadow: 24,
56428
+ p: 4,
56429
+ backgroundColor: (theme) => theme.palette.background.default,
56430
+ }, 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') })] })) }) })] }));
56431
+ };
56432
+
56433
+ const NoteDeleteButton = (props) => {
56434
+ const t = useTranslationContext();
56435
+ const api = useEditContactApi();
56436
+ const { editEntity, entityId: entityIdFromContext } = useEditEntity();
56437
+ const [isSaving, setIsSaving] = React$1.useState(false);
56438
+ const checked = props.checked ?? true;
56439
+ const entityId = props.entityId ?? entityIdFromContext;
56440
+ const { note, channelType, id, address } = props.addressData;
56441
+ const addressIsSaved = !props.addressData.hasOwnProperty('isSaved');
56442
+ const replaceAddress = props.replaceAddress ?? editEntity.action.replaceAddress;
56443
+ const addWhatsappVerified = props.addWhatsappVerified ||
56444
+ (typeof editEntity.action?.addWhatsappVerified === 'function'
56445
+ ? editEntity.action.addWhatsappVerified
56446
+ : undefined);
56447
+ const handleSetAddress = async (type) => {
56448
+ if (!api)
56449
+ return null;
56450
+ if (!entityId)
56451
+ return null;
56452
+ const newAddress = await api.setContactAddress({
56453
+ data: {
56454
+ address,
56455
+ contactId: entityId,
56456
+ type,
56457
+ },
56458
+ });
56459
+ replaceAddress(id, newAddress);
56460
+ return newAddress;
56461
+ };
56462
+ const handleUpdateAddress = async () => {
56463
+ if (!api)
56464
+ return;
56465
+ if (!entityId)
56466
+ return;
56467
+ const updated = await api.updateContactAddress({
56468
+ data: {
56469
+ contactAddressId: id,
56470
+ contactId: entityId,
56471
+ note: note ?? '',
56472
+ },
56473
+ });
56474
+ replaceAddress(id, updated);
56475
+ };
56476
+ const handleSave = async () => {
56477
+ setIsSaving(true);
56478
+ if (addressIsSaved) {
56479
+ await handleUpdateAddress();
56480
+ setIsSaving(false);
56481
+ }
56482
+ else {
56483
+ const newAddress = await handleSetAddress(channelType);
56484
+ if (newAddress)
56485
+ setIsSaving(false);
56486
+ }
56487
+ };
56488
+ const handleLinkAccountSave = async () => {
56489
+ setIsSaving(true);
56490
+ const newAddress = await handleSetAddress(13);
56491
+ if (newAddress && addWhatsappVerified) {
56492
+ addWhatsappVerified(newAddress);
56493
+ }
56494
+ if (newAddress)
56495
+ setIsSaving(false);
56496
+ };
56497
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: {
56498
+ ...noteDeleteButtonStyle.container,
56499
+ }, 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: {
56500
+ shrink: true,
56501
+ }, 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) => {
56502
+ if (!api)
56503
+ return null;
56504
+ try {
56505
+ return await api.checkContactAddress({
56506
+ data: {
56507
+ address,
56508
+ type,
56509
+ },
56510
+ });
56511
+ }
56512
+ catch {
56513
+ return null;
56514
+ }
56515
+ } })] }));
56516
+ };
56517
+
56518
+ const informationItemInputsContainerStyle = {
56519
+ container: {
56520
+ display: 'flex',
56521
+ gap: '100px',
56522
+ alignItems: 'center',
56523
+ },
56524
+ };
56525
+
56526
+ const InformationItemInputsContainer = ({ children }) => {
56527
+ return jsxRuntimeExports.jsx(material.Box, { sx: informationItemInputsContainerStyle.container, children: children });
56528
+ };
56529
+
56530
+ const subsectionBodyContainerStyle = {
56531
+ container: {
56532
+ width: '100%',
56533
+ borderRadius: 1,
56534
+ px: 1.5,
56535
+ py: 2,
56536
+ display: 'flex',
56537
+ flexDirection: 'column',
56538
+ gap: 2,
56539
+ overflow: 'auto',
56540
+ maxHeight: 'calc(100vh - 250px)',
56541
+ },
56542
+ };
56543
+
56544
+ const SubsectionBodyContainer = ({ children }) => {
56545
+ return (jsxRuntimeExports.jsx(material.Box, { sx: {
56546
+ ...subsectionBodyContainerStyle.container,
56547
+ }, children: children }));
56548
+ };
56549
+
56550
+ var CheckRounded = {};
56551
+
56552
+ var _interopRequireDefault$2 = interopRequireDefaultExports;
56553
+ Object.defineProperty(CheckRounded, "__esModule", {
56554
+ value: true
56555
+ });
56556
+ var default_1$2 = CheckRounded.default = void 0;
56557
+ var _createSvgIcon$2 = _interopRequireDefault$2(requireCreateSvgIcon());
56558
+ var _jsxRuntime$2 = jsxRuntimeExports;
56559
+ default_1$2 = CheckRounded.default = (0, _createSvgIcon$2.default)( /*#__PURE__*/(0, _jsxRuntime$2.jsx)("path", {
56560
+ 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"
56561
+ }), 'CheckRounded');
56562
+
56563
+ var CloseRounded = {};
56564
+
56565
+ var _interopRequireDefault$1 = interopRequireDefaultExports;
56566
+ Object.defineProperty(CloseRounded, "__esModule", {
56567
+ value: true
56568
+ });
56569
+ var default_1$1 = CloseRounded.default = void 0;
56570
+ var _createSvgIcon$1 = _interopRequireDefault$1(requireCreateSvgIcon());
56571
+ var _jsxRuntime$1 = jsxRuntimeExports;
56572
+ default_1$1 = CloseRounded.default = (0, _createSvgIcon$1.default)( /*#__PURE__*/(0, _jsxRuntime$1.jsx)("path", {
56573
+ 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"
56574
+ }), 'CloseRounded');
56575
+
56576
+ const Adornment = ({ status }) => {
56577
+ switch (status) {
56578
+ case 'idle':
56579
+ return null;
56580
+ case 'loading':
56581
+ return jsxRuntimeExports.jsx(CircularProgress$1, { size: 20 });
56582
+ case 'available':
56583
+ return jsxRuntimeExports.jsx(default_1$2, { style: { height: 27, width: 27 }, color: "success" });
56584
+ case 'unavailable':
56585
+ return jsxRuntimeExports.jsx(default_1$1, { style: { height: 27, width: 27 }, color: "error" });
56586
+ default:
56587
+ return null;
56588
+ }
56589
+ };
56590
+
56591
+ const StatusAdornment = ({ status, text }) => {
56592
+ const textAdornment = text ? (jsxRuntimeExports.jsx(Typography$1, { marginRight: 0.5, children: text })) : null;
56593
+ 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 }) })] }));
56594
+ };
56595
+
56596
+ const imsStyle = {
56597
+ code: {
56598
+ width: '60%',
56599
+ color: 'gray',
56600
+ },
56601
+ };
56602
+
56603
+ const Ims = ({ data, editEntity }) => {
56604
+ const editActions = editEntity.action;
56605
+ 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 })] }) }));
56606
+ };
56607
+
56608
+ const Body$4 = ({ IMSs, editEntity }) => {
56609
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { children: IMSs?.map((ims) => (jsxRuntimeExports.jsx(Ims, { data: ims, editEntity: editEntity }, ims.id))) }));
56610
+ };
56611
+
56612
+ const InformationSocialNetworkItem = ({ editEntity, title, IMSs }) => {
56613
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeader, { title: title }), jsxRuntimeExports.jsx(Body$4, { IMSs: IMSs, editEntity: editEntity })] }));
56614
+ };
56615
+
56616
+ const style$2 = {
56617
+ addressField: {
56618
+ // width: '35%',
56619
+ },
56620
+ };
56621
+
56622
+ const AddressInput = ({ data, onChange, setWarnings }) => {
56623
+ const { id, channelType, address } = data;
56624
+ const t = useTranslationContext();
56625
+ const api = useEditContactApi();
56626
+ const [adornmentStatus, setAdornmentStatus] = React$1.useState('idle');
56627
+ const [lastSearch, setLastSearch] = React$1.useState(address);
56628
+ const addressIsSaved = !data.hasOwnProperty('isSaved');
56629
+ React$1.useEffect(() => {
56630
+ let timer = setTimeout(async () => {
56631
+ if (address !== '' && address !== lastSearch) {
56632
+ if (!api) {
56633
+ return;
56634
+ }
56635
+ setAdornmentStatus('loading');
56636
+ setLastSearch(address);
56637
+ const checkContactAddressData = {
56638
+ address,
56639
+ type: channelType,
56640
+ };
56641
+ try {
56642
+ const response = await api.checkContactAddress({ data: checkContactAddressData });
56643
+ const { success, warnings } = response;
56644
+ setWarnings(warnings);
56645
+ success ? setAdornmentStatus('available') : setAdornmentStatus('unavailable');
56646
+ }
56647
+ catch {
56648
+ setWarnings([]);
56649
+ setAdornmentStatus('unavailable');
56650
+ }
56651
+ }
56652
+ }, 1700);
56653
+ return () => clearTimeout(timer);
56654
+ }, [api, data, address, channelType, lastSearch, setWarnings]);
56655
+ 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
56656
+ ? t
56657
+ ? t('global.number')
56658
+ : 'Number'
56659
+ : t
56660
+ ? t('global.email')
56661
+ : 'Email', value: address, onChange: (e) => {
56662
+ onChange(e, id, channelType);
56663
+ }, variant: "outlined", fullWidth: true, InputLabelProps: {
56664
+ shrink: true,
56665
+ }, className: "contacts-smallInput", InputProps: {
56666
+ endAdornment: (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(StatusAdornment, { status: adornmentStatus }) })),
56667
+ } }) }));
56668
+ };
56669
+
56670
+ const style$1 = {
56671
+ addressField: {
56672
+ // width: '35%',
56673
+ },
56674
+ };
56675
+
56676
+ const PhoneInput = ({ data, onChange, setWarnings }) => {
56677
+ const api = useEditContactApi();
56678
+ const t = useTranslationContext();
56679
+ const { id, channelType, address } = data;
56680
+ const [adornmentStatus, setAdornmentStatus] = React$1.useState('idle');
56681
+ const [lastSearch, setLastSearch] = React$1.useState(address);
56682
+ const addressIsSaved = !data.hasOwnProperty('isSaved');
56683
+ React$1.useEffect(() => {
56684
+ let timer = setTimeout(async () => {
56685
+ if (address !== '' && address !== lastSearch) {
56686
+ if (!api) {
56687
+ return;
56688
+ }
56689
+ setAdornmentStatus('loading');
56690
+ setLastSearch(address);
56691
+ const checkContactAddressData = {
56692
+ address,
56693
+ type: channelType,
56694
+ };
56695
+ try {
56696
+ const { success, warnings } = await api.checkContactAddress({
56697
+ data: checkContactAddressData,
56698
+ });
56699
+ setWarnings(warnings);
56700
+ success ? setAdornmentStatus('available') : setAdornmentStatus('unavailable');
56701
+ }
56702
+ catch {
56703
+ setWarnings([]);
56704
+ setAdornmentStatus('unavailable');
56705
+ }
56706
+ }
56707
+ }, 1700);
56708
+ return () => clearTimeout(timer);
56709
+ // eslint-disable-next-line react-hooks/exhaustive-deps
56710
+ }, [data]);
56711
+ 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) => {
56712
+ onChange(e, id, channelType);
56713
+ }, variant: "outlined", fullWidth: true, InputLabelProps: {
56714
+ shrink: true,
56715
+ }, className: "contacts-smallInput", InputProps: {
56716
+ endAdornment: (jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: jsxRuntimeExports.jsx(StatusAdornment, { status: adornmentStatus }) })),
56717
+ } }) }));
56718
+ };
56719
+
56720
+ const style = {
56721
+ secondaryContainer: {
56722
+ display: 'flex',
56723
+ alignItems: 'baseline',
56724
+ height: '100%',
56725
+ gap: 0.5,
56726
+ },
56727
+ icon: { height: 15 },
56728
+ chip: {
56729
+ borderRadius: '6px',
56730
+ height: '22px'
56731
+ }
56732
+ };
56733
+
56734
+ var Warning$1 = {};
56735
+
56736
+ var _interopRequireDefault = interopRequireDefaultExports;
56737
+ Object.defineProperty(Warning$1, "__esModule", {
56738
+ value: true
56172
56739
  });
56740
+ var default_1 = Warning$1.default = void 0;
56741
+ var _createSvgIcon = _interopRequireDefault(requireCreateSvgIcon());
56742
+ var _jsxRuntime = jsxRuntimeExports;
56743
+ default_1 = Warning$1.default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", {
56744
+ d: "M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z"
56745
+ }), 'Warning');
56746
+
56747
+ const Warning = ({ text }) => {
56748
+ 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' }) }) }));
56749
+ };
56750
+
56751
+ const WarningsDisplay = ({ warnings }) => {
56752
+ const t = useTranslationContext();
56753
+ 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))) }) }));
56754
+ };
56755
+
56756
+ const phoneStyle = {
56757
+ numberCountryContainer: {
56758
+ display: 'flex',
56759
+ justifyContent: 'flex-start',
56760
+ width: '50%',
56761
+ },
56762
+ warningMessage: {
56763
+ // position: "absolute",
56764
+ // bottom: "-30px",
56765
+ marginTop: "10px"
56766
+ },
56767
+ adressInputBox: {
56768
+ position: "relative",
56769
+ width: "45%"
56770
+ }
56771
+ };
56772
+
56773
+ const Phone = ({ data }) => {
56774
+ const mode = 'edit';
56775
+ const { editEntity } = useEditEntity();
56776
+ const editEntityActions = editEntity.action;
56777
+ const editEntityState = editEntity.state;
56778
+ const [warnings, setWarnings] = React$1.useState([]);
56779
+ const [checked, setChecked] = React$1.useState(true);
56780
+ React$1.useEffect(() => {
56781
+ setChecked(warnings.length === 0 && (data.address ?? '') !== '');
56782
+ }, [warnings, data.address]);
56783
+ 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 })] }) }));
56784
+ };
56785
+
56786
+ const Body$3 = ({ phoneNumbers }) => {
56787
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: phoneNumbers?.map((phone) => (jsxRuntimeExports.jsx(Phone, { data: phone }, phone.id))) }));
56788
+ };
56789
+
56790
+ const Phones = ({ phoneNumbers, handleAdd }) => {
56791
+ const t = useTranslationContext();
56792
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: t('global.phones') }), jsxRuntimeExports.jsx(Body$3, { phoneNumbers: phoneNumbers })] }));
56793
+ };
56794
+
56795
+ const mailStyle$2 = {
56796
+ emailField: {
56797
+ width: '60%',
56798
+ },
56799
+ numberCountryContainer: {
56800
+ display: 'flex',
56801
+ justifyContent: 'flex-start',
56802
+ width: '50%',
56803
+ },
56804
+ warningMessage: {
56805
+ position: "absolute",
56806
+ bottom: "-30px"
56807
+ },
56808
+ adressInputBox: {
56809
+ position: "relative",
56810
+ width: "60%"
56811
+ }
56812
+ };
56813
+
56814
+ const Mail = ({ data }) => {
56815
+ const mode = 'edit';
56816
+ const { editEntity } = useEditEntity();
56817
+ const editEntityActions = editEntity.action;
56818
+ const editEntityState = editEntity.state;
56819
+ const [warnings, setWarnings] = React$1.useState([]);
56820
+ 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 })] }));
56821
+ };
56822
+
56823
+ const Body$2 = ({ emails }) => {
56824
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: emails?.map((email) => (jsxRuntimeExports.jsx(Mail, { data: email }, email.id))) }));
56825
+ };
56826
+
56827
+ const Mails = ({ emails, handleAdd }) => {
56828
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: 'Emails' }), jsxRuntimeExports.jsx(Body$2, { emails: emails })] }));
56829
+ };
56830
+
56831
+ const mailStyle$1 = {
56832
+ emailField: {
56833
+ width: '60%',
56834
+ },
56835
+ numberCountryContainer: {
56836
+ display: 'flex',
56837
+ justifyContent: 'flex-start',
56838
+ width: '50%',
56839
+ },
56840
+ warningMessage: {
56841
+ position: "absolute",
56842
+ bottom: "-30px"
56843
+ },
56844
+ adressInputBox: {
56845
+ position: "relative",
56846
+ width: "60%"
56847
+ }
56848
+ };
56849
+
56850
+ const Whatsapp = ({ data }) => {
56851
+ const mode = 'edit';
56852
+ const { editEntity } = useEditEntity();
56853
+ const editEntityActions = editEntity.action;
56854
+ const editEntityState = editEntity.state;
56855
+ const [warnings, setWarnings] = React$1.useState([]);
56856
+ 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 })] }));
56857
+ };
56858
+
56859
+ const Body$1 = ({ whatsapps }) => {
56860
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: whatsapps?.map((whatsapp) => (jsxRuntimeExports.jsx(Whatsapp, { data: whatsapp }, whatsapp.id))) }));
56861
+ };
56862
+
56863
+ const Whatsapps = ({ whatsapps, handleAdd }) => {
56864
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: 'WhatsApp' }), jsxRuntimeExports.jsx(Body$1, { whatsapps: whatsapps })] }));
56865
+ };
56866
+
56867
+ const mailStyle = {
56868
+ emailField: {
56869
+ width: '60%',
56870
+ },
56871
+ numberCountryContainer: {
56872
+ display: 'flex',
56873
+ justifyContent: 'flex-start',
56874
+ width: '50%',
56875
+ },
56876
+ warningMessage: {
56877
+ position: "absolute",
56878
+ bottom: "-30px"
56879
+ },
56880
+ adressInputBox: {
56881
+ position: "relative",
56882
+ width: "60%"
56883
+ }
56884
+ };
56885
+
56886
+ const RCS = ({ data }) => {
56887
+ const mode = 'edit';
56888
+ const { editEntity } = useEditEntity();
56889
+ const editEntityActions = editEntity.action;
56890
+ const editEntityState = editEntity.state;
56891
+ const [warnings, setWarnings] = React$1.useState([]);
56892
+ 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 })] }));
56893
+ };
56894
+
56895
+ const Body = ({ RCSs }) => {
56896
+ return (jsxRuntimeExports.jsx(SubsectionBodyContainer, { variant: "large", children: RCSs?.map((data) => (jsxRuntimeExports.jsx(RCS, { data: data }, data.id))) }));
56897
+ };
56898
+
56899
+ const RCSs = ({ RCSs, handleAdd }) => {
56900
+ return (jsxRuntimeExports.jsxs(material.Box, { sx: { width: '100%' }, children: [jsxRuntimeExports.jsx(SubsectionHeaderWithButton, { handleAdd: handleAdd, title: 'RCS' }), jsxRuntimeExports.jsx(Body, { RCSs: RCSs })] }));
56901
+ };
56173
56902
 
56174
- styled$1(material.Box)(({ theme }) => ({
56903
+ const StyledModalContent = styled$1(material.Box)(({ theme }) => ({
56175
56904
  position: 'absolute',
56176
56905
  top: '50%',
56177
56906
  left: '50%',
@@ -56181,35 +56910,143 @@ styled$1(material.Box)(({ theme }) => ({
56181
56910
  padding: theme.spacing(4),
56182
56911
  borderRadius: theme.shape.borderRadius,
56183
56912
  }));
56913
+ const EditModal = ({ open, onClose, title }) => {
56914
+ const t = useTranslationContext();
56915
+ const { editEntity } = useEditEntity();
56916
+ const { emails, phoneNumbers, imsWhatsapp, imsRCS } = editEntity.field;
56917
+ const { addEmail, addPhone, addWhatsapp, resetToInitialContactInformation, addRCS } = editEntity.action;
56918
+ function handleClose() {
56919
+ onClose();
56920
+ resetToInitialContactInformation();
56921
+ }
56922
+ const renderContent = () => {
56923
+ switch (title) {
56924
+ case 'Phones':
56925
+ return jsxRuntimeExports.jsx(Phones, { handleAdd: addPhone, phoneNumbers: phoneNumbers });
56926
+ case 'Emails':
56927
+ return jsxRuntimeExports.jsx(Mails, { handleAdd: addEmail, emails: emails });
56928
+ case 'Whatsapp':
56929
+ return jsxRuntimeExports.jsx(Whatsapps, { handleAdd: addWhatsapp, whatsapps: imsWhatsapp });
56930
+ case 'RCS':
56931
+ return jsxRuntimeExports.jsx(RCSs, { handleAdd: addRCS, RCSs: imsRCS });
56932
+ case 'Facebook':
56933
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Facebook', IMSs: editEntity.field.imsFacebooks, editEntity: editEntity }));
56934
+ case 'Webchat':
56935
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Webchat', IMSs: editEntity.field.imsWebchats, editEntity: editEntity }));
56936
+ case 'Instagram':
56937
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Instagram', IMSs: editEntity.field.imsInstagrams, editEntity: editEntity }));
56938
+ case 'Mercado libre':
56939
+ return (jsxRuntimeExports.jsx(InformationSocialNetworkItem, { title: 'Mercado Libre', IMSs: editEntity.field.imsMercadolibre, editEntity: editEntity }));
56940
+ default:
56941
+ return jsxRuntimeExports.jsx(material.Typography, { children: "No information available for this section." });
56942
+ }
56943
+ };
56944
+ 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') }) })] }) }));
56945
+ };
56946
+
56947
+ const ContactInformation = ({ ownerData }) => {
56948
+ const { isOpen, title, openModal, closeModal } = useEditModal();
56949
+ const { editEntity } = useEditEntity();
56950
+ const t = useTranslationContext();
56951
+ const phones = editEntity.field.phoneNumbers;
56952
+ const emails = editEntity.field.emails;
56953
+ const facebook = editEntity.field.imsFacebooks;
56954
+ const whatsapp = editEntity.field.imsWhatsapp;
56955
+ const mercadolibre = editEntity.field.imsMercadolibre;
56956
+ const webchat = editEntity.field.imsWebchats;
56957
+ const instagram = editEntity.field.imsInstagrams;
56958
+ const rcs = editEntity.field.imsRCS;
56959
+ const contactMethods = [
56960
+ {
56961
+ key: 'phones',
56962
+ title: t('contactDetails.phones'),
56963
+ items: phones,
56964
+ isPhone: true,
56965
+ modalTitle: 'Phones',
56966
+ visible: true,
56967
+ },
56968
+ {
56969
+ key: 'emails',
56970
+ title: 'Emails',
56971
+ items: emails,
56972
+ modalTitle: 'Emails',
56973
+ visible: true,
56974
+ },
56975
+ {
56976
+ key: 'facebook',
56977
+ title: 'Facebook',
56978
+ items: facebook,
56979
+ modalTitle: 'Facebook',
56980
+ visible: true,
56981
+ },
56982
+ {
56983
+ key: 'whatsapp',
56984
+ title: 'Whatsapp',
56985
+ items: whatsapp,
56986
+ modalTitle: 'Whatsapp',
56987
+ visible: true,
56988
+ },
56989
+ {
56990
+ key: 'rcs',
56991
+ title: 'RCS',
56992
+ items: rcs,
56993
+ modalTitle: 'RCS',
56994
+ visible: rcs.length > 0,
56995
+ },
56996
+ {
56997
+ key: 'mercado-libre',
56998
+ title: 'Mercado libre',
56999
+ items: mercadolibre,
57000
+ modalTitle: 'Mercado libre',
57001
+ visible: true,
57002
+ },
57003
+ {
57004
+ key: 'webchat',
57005
+ title: 'Webchat',
57006
+ items: webchat,
57007
+ modalTitle: 'Webchat',
57008
+ visible: true,
57009
+ },
57010
+ {
57011
+ key: 'instagram',
57012
+ title: 'Instagram',
57013
+ items: instagram,
57014
+ modalTitle: 'Instagram',
57015
+ visible: true,
57016
+ },
57017
+ ];
57018
+ return (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Section, { title: t('contactDetails.contactInformation'), children: jsxRuntimeExports.jsx(SectionContent, { children: jsxRuntimeExports.jsx("div", { className: "grid grid-cols-1 gap-3", children: contactMethods
57019
+ .filter((method) => method.visible)
57020
+ .map((method) => (jsxRuntimeExports.jsx(ContactMethod, { handleEdit: () => openModal(method.modalTitle), title: method.title, methodItems: method.items, isPhone: method.isPhone, owner: ownerData }, method.key))) }) }) }), jsxRuntimeExports.jsx(EditModal, { open: isOpen, onClose: closeModal, title: title })] }));
57021
+ };
56184
57022
 
56185
- const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, t, onEntityUpdated, }) => {
57023
+ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, onEntityUpdated, }) => {
56186
57024
  const commonProps = {
56187
57025
  baseUrl,
56188
57026
  spaceId,
56189
57027
  entityId: String(entityData.id),
56190
57028
  onEntityUpdated,
56191
57029
  };
56192
- const maybeTitle = t('contactDetails.addressInformation');
56193
- 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) => ({
57030
+ const t = useTranslationContext();
57031
+ return (jsxRuntimeExports.jsx(Section, { title: t('contactDetails.addressInformation'), children: jsxRuntimeExports.jsx(SectionContent, { children: entityType === 'contact' ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.street'), value: entityData.address1?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56195
57032
  address1: { street: value },
56196
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
57033
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherStreet'), value: entityData.address2?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56197
57034
  address2: { street: value },
56198
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57035
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.city'), value: entityData.address1?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
56199
57036
  address1: { city: value },
56200
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
57037
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCity'), value: entityData.address2?.city ?? '', ...commonProps, constructUpdateObject: (value) => ({
56201
57038
  address2: { city: value },
56202
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57039
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.state'), value: entityData.address1?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
56203
57040
  address1: { state: value },
56204
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
57041
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherState'), value: entityData.address2?.state ?? '', ...commonProps, constructUpdateObject: (value) => ({
56205
57042
  address2: { state: value },
56206
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57043
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.postcode'), value: entityData.address1?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
56207
57044
  address1: { zipcode: value },
56208
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
57045
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherPostcode'), value: entityData.address2?.zipcode ?? '', ...commonProps, constructUpdateObject: (value) => ({
56209
57046
  address2: { zipcode: value },
56210
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57047
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.country'), value: entityData.address1?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
56211
57048
  address1: { country: value },
56212
- }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", t: t, title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
57049
+ }) }), jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "contact", title: t('contactDetails.anotherCountry'), value: entityData.address2?.country ?? '', ...commonProps, constructUpdateObject: (value) => ({
56213
57050
  address2: { country: value },
56214
57051
  }) })] })) : (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(EntityInfoLabel, { entityType: "business", title: t('contactDetails.street'), value: entityData.address1?.street ?? '', ...commonProps, constructUpdateObject: (value) => ({
56215
57052
  address1: { street: value },
@@ -56234,100 +57071,97 @@ const AddressInformation = ({ entityType, entityData, baseUrl, spaceId, t, onEnt
56234
57071
  }) })] })) }) }));
56235
57072
  };
56236
57073
 
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");
57074
+ const useEntityUpdateSync = ({ entity, setEntity }) => {
57075
+ const handleEntityUpdated = React$1.useCallback((update) => {
57076
+ if (!update || typeof update !== 'object') {
57077
+ return;
57078
+ }
57079
+ const updateObj = update;
57080
+ if ('id' in updateObj) {
57081
+ // Full entity replacement
57082
+ setEntity(update);
57083
+ return;
57084
+ }
57085
+ if (!entity) {
57086
+ return;
57087
+ }
57088
+ // Shallow merge partial updates into existing entity
57089
+ const merged = { ...entity, ...updateObj };
57090
+ setEntity(merged);
57091
+ }, [entity, setEntity]);
57092
+ return handleEntityUpdated;
57093
+ };
57094
+
57095
+ const useTagsEditorController = ({ open, baseUrl, spaceId, contactData, contactType, labels, selectedTags, onTagsUpdated, }) => {
57096
+ const [view, setView] = React$1.useState('main');
56250
57097
  const [draftLabels, setDraftLabels] = React$1.useState([]);
56251
57098
  const [tagsEditorInitialized, setTagsEditorInitialized] = React$1.useState(false);
56252
- const [isSavingTags, setIsSavingTags] = React$1.useState(false);
56253
- const resetModalState = React$1.useCallback(() => {
57099
+ const [isSaving, setIsSaving] = React$1.useState(false);
57100
+ const reset = React$1.useCallback(() => {
56254
57101
  setView('main');
56255
57102
  setDraftLabels([]);
56256
57103
  setTagsEditorInitialized(false);
56257
- setIsSavingTags(false);
57104
+ setIsSaving(false);
56258
57105
  }, []);
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
57106
  React$1.useEffect(() => {
56282
57107
  if (!open) {
56283
- resetModalState();
57108
+ reset();
56284
57109
  }
56285
- }, [open, resetModalState]);
56286
- const handleSaveTags = async () => {
56287
- if (isSavingTags)
57110
+ }, [open, reset]);
57111
+ React$1.useEffect(() => {
57112
+ if (view !== 'tags') {
57113
+ setTagsEditorInitialized(false);
56288
57114
  return;
56289
- if (!baseUrl)
57115
+ }
57116
+ if (tagsEditorInitialized)
56290
57117
  return;
56291
- if (!spaceId)
57118
+ if (!labels.length)
56292
57119
  return;
56293
- if (!state.contactData)
57120
+ const selectedTagIds = new Set(selectedTags.map((t) => String(t.id)));
57121
+ const initialDraft = labels.filter((l) => selectedTagIds.has(String(l?.id)));
57122
+ setDraftLabels(initialDraft);
57123
+ setTagsEditorInitialized(true);
57124
+ }, [view, tagsEditorInitialized, labels, selectedTags]);
57125
+ const handleSaveTags = React$1.useCallback(async () => {
57126
+ if (isSaving)
56294
57127
  return;
56295
- if (selectors.contactType !== 'business' && selectors.contactType !== 'contact')
57128
+ if (!baseUrl || !spaceId)
57129
+ return;
57130
+ if (!contactData)
57131
+ return;
57132
+ if (contactType !== 'contact' && contactType !== 'business')
56296
57133
  return;
56297
57134
  const tags = draftLabels
56298
57135
  .filter((l) => l?.id && l?.name)
56299
57136
  .map((l) => ({ id: String(l.id), name: String(l.name) }));
56300
- setIsSavingTags(true);
57137
+ setIsSaving(true);
56301
57138
  try {
56302
57139
  await updateEntity({
56303
57140
  baseUrl,
56304
57141
  spaceId,
56305
- entityType: selectors.contactType,
56306
- entityId: String(state.contactData.id),
57142
+ entityType: contactType,
57143
+ entityId: String(contactData.id),
56307
57144
  body: { tags },
56308
57145
  });
56309
- actions.setContactData({ ...state.contactData, tags });
57146
+ onTagsUpdated(tags);
56310
57147
  setView('main');
56311
57148
  }
56312
57149
  finally {
56313
- setIsSavingTags(false);
57150
+ setIsSaving(false);
56314
57151
  }
57152
+ }, [isSaving, baseUrl, spaceId, contactData, contactType, draftLabels, onTagsUpdated]);
57153
+ return {
57154
+ view,
57155
+ setView,
57156
+ draftLabels,
57157
+ setDraftLabels,
57158
+ isSaving,
57159
+ handleSaveTags,
56315
57160
  };
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) => {
57161
+ };
57162
+
57163
+ const useModalCloseHandler = ({ onClose }) => {
57164
+ const handleClose = React$1.useCallback((event, reason) => {
56331
57165
  if (reason === 'escapeKeyDown') {
56332
57166
  const maybeEvent = event;
56333
57167
  if (typeof maybeEvent?.stopPropagation === 'function') {
@@ -56338,7 +57172,52 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }
56338
57172
  }
56339
57173
  }
56340
57174
  onClose();
56341
- };
57175
+ }, [onClose]);
57176
+ return handleClose;
57177
+ };
57178
+
57179
+ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t }) => {
57180
+ const api = React$1.useMemo(() => {
57181
+ if (!baseUrl || !spaceId)
57182
+ return null;
57183
+ return createEditContactApi(baseUrl, spaceId);
57184
+ }, [baseUrl, spaceId]);
57185
+ console.log('[EditContactModal] t fn:', t?.name || 'anonymous', t);
57186
+ const { state, selectors, actions } = useEditContactModalController({
57187
+ open,
57188
+ baseUrl,
57189
+ spaceId,
57190
+ contactId,
57191
+ });
57192
+ const handleEntityUpdated = useEntityUpdateSync({
57193
+ entity: state.contactData,
57194
+ setEntity: (next) => actions.setContactData(next ?? undefined),
57195
+ });
57196
+ const { view, setView, draftLabels, setDraftLabels, isSaving: isSavingTags, handleSaveTags, } = useTagsEditorController({
57197
+ open,
57198
+ baseUrl,
57199
+ spaceId,
57200
+ contactData: state.contactData,
57201
+ contactType: selectors.contactType,
57202
+ labels: selectors.labels,
57203
+ selectedTags: selectors.tags,
57204
+ onTagsUpdated: (tags) => {
57205
+ if (!state.contactData)
57206
+ return;
57207
+ actions.setContactData({ ...state.contactData, tags });
57208
+ },
57209
+ });
57210
+ const image = useImage({
57211
+ baseUrl,
57212
+ spaceId,
57213
+ entityType: selectors.contactType === 'business' || selectors.contactType === 'contact'
57214
+ ? selectors.contactType
57215
+ : undefined,
57216
+ entityId: state.contactData ? String(state.contactData.id) : undefined,
57217
+ initialImageUrl: state.contactData?.imageUrl,
57218
+ onEntityUpdated: handleEntityUpdated,
57219
+ });
57220
+ const handleClose = useModalCloseHandler({ onClose });
56342
57221
  const baseSx = {
56343
57222
  position: 'absolute',
56344
57223
  top: '50%',
@@ -56353,23 +57232,21 @@ const EditContactModal = ({ open, onClose, baseUrl, spaceId, contactId, sx, t, }
56353
57232
  p: 3,
56354
57233
  overflow: 'hidden',
56355
57234
  };
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 }) }) }) }));
57235
+ const mergedSx = Array.isArray(sx) ? [baseSx, ...sx] : sx ? [baseSx, sx] : baseSx;
57236
+ 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: {
57237
+ display: 'flex',
57238
+ justifyContent: 'center',
57239
+ alignItems: 'center',
57240
+ minHeight: 220,
57241
+ }, 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: () => {
57242
+ setView('tags');
57243
+ }, 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' ||
57244
+ selectors.contactType === 'business'
57245
+ ? selectors.contactType
57246
+ : 'contact', entityData: state.contactData, customContactFields: selectors.contactFields, baseUrl: baseUrl, spaceId: spaceId, onEntityUpdated: handleEntityUpdated, currentUser: selectors.userTrii }), jsxRuntimeExports.jsx(AddressInformation, { entityType: selectors.contactType === 'contact' ||
57247
+ selectors.contactType === 'business'
57248
+ ? selectors.contactType
57249
+ : '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
57250
  };
56374
57251
 
56375
57252
  exports.ContactInfoPopup = ContactInfoPopup;