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