contentoh-components-library 21.1.83 → 21.1.86

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.
@@ -13,6 +13,8 @@ var _styles = require("./styles");
13
13
 
14
14
  var _react = require("react");
15
15
 
16
+ var _customHooks = require("../../../global-files/customHooks");
17
+
16
18
  var _jsxRuntime = require("react/jsx-runtime");
17
19
 
18
20
  var SliderToolTip = function SliderToolTip(_ref) {
@@ -21,23 +23,10 @@ var SliderToolTip = function SliderToolTip(_ref) {
21
23
  iconSize = _ref.iconSize,
22
24
  slidePosition = _ref.slidePosition;
23
25
 
24
- var _useState = (0, _react.useState)(false),
25
- _useState2 = (0, _slicedToArray2.default)(_useState, 2),
26
- showMenu = _useState2[0],
27
- setShowMenu = _useState2[1];
28
-
29
- var closeMenu = function closeMenu(e) {
30
- if (!e.target.closest("#div-slider") && showMenu) {
31
- document.removeEventListener("click", closeMenu, false);
32
- setShowMenu(false);
33
- }
34
- };
35
-
36
- (0, _react.useEffect)(function () {
37
- if (showMenu) {
38
- document.addEventListener("click", closeMenu, false);
39
- }
40
- }, [showMenu]);
26
+ var _useCloseModal = (0, _customHooks.useCloseModal)("div-slider"),
27
+ _useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
28
+ showMenu = _useCloseModal2[0],
29
+ setShowMenu = _useCloseModal2[1];
41
30
 
42
31
  var color = function color(id) {
43
32
  for (var i = 1; i <= slidefront.length; i++) {
@@ -62,11 +51,9 @@ var SliderToolTip = function SliderToolTip(_ref) {
62
51
  alt: "info icon",
63
52
  className: iconSize,
64
53
  onClick: function onClick(e) {
65
- setShowMenu(!showMenu);
66
-
67
- if (showMenu) {
68
- document.removeEventListener("click", closeMenu, false);
69
- }
54
+ e.stopPropagation();
55
+ e.preventDefault();
56
+ setShowMenu(true);
70
57
  }
71
58
  }), showMenu && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Slider, {
72
59
  id: "div-slider",
@@ -92,7 +79,6 @@ var SliderToolTip = function SliderToolTip(_ref) {
92
79
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
93
80
  id: "button-slide",
94
81
  onClick: function onClick(e) {
95
- document.removeEventListener("click", closeMenu, false);
96
82
  setShowMenu(false);
97
83
  },
98
84
  children: "Cerrar"
@@ -13,9 +13,9 @@ var Status = function Status(_ref) {
13
13
  var statusType = _ref.statusType,
14
14
  ovalForm = _ref.ovalForm;
15
15
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
16
- className: "status-".concat(statusType.replace(/\/.*/, ""), " ").concat(ovalForm && "oval-form"),
16
+ className: "status-".concat(statusType === null || statusType === void 0 ? void 0 : statusType.replace(/\/.*/, ""), " ").concat(ovalForm && "oval-form"),
17
17
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
18
- children: statusType
18
+ children: statusType !== null && statusType !== void 0 ? statusType : 'NS'
19
19
  })
20
20
  });
21
21
  };
@@ -146,7 +146,10 @@ var StatusAsignationInfo = function StatusAsignationInfo(_ref) {
146
146
  imageType: "small-image",
147
147
  image: (0, _data.getProfilePicture)(assignation.id, 20, 20),
148
148
  altText: "user profile image",
149
- onClick: function onClick() {
149
+ onClick: function onClick(e) {
150
+ e.preventDefault();
151
+ e.stopPropagation();
152
+ console.log(e.target);
150
153
  setShowAsignationPanel(true);
151
154
  setAssignationType(assignation === null || assignation === void 0 ? void 0 : assignation.collaboratorType);
152
155
  }
@@ -348,8 +348,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
348
348
  setIcon = _useState40[1];
349
349
 
350
350
  var _useState41 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
351
- _useState42 = (0, _slicedToArray2.default)(_useState41, 1),
352
- version = _useState42[0];
351
+ _useState42 = (0, _slicedToArray2.default)(_useState41, 2),
352
+ version = _useState42[0],
353
+ setVersion = _useState42[1];
353
354
 
354
355
  var _useState43 = (0, _react.useState)({}),
355
356
  _useState44 = (0, _slicedToArray2.default)(_useState43, 1),
@@ -474,10 +475,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
474
475
  showCreateVersion = _useState82[0],
475
476
  setShowCreateVersion = _useState82[1];
476
477
 
477
- var _closeModals = (0, _customHooks.closeModals)("version-selector"),
478
- _closeModals2 = (0, _slicedToArray2.default)(_closeModals, 2),
479
- showVersionSelector = _closeModals2[0],
480
- setShowVersionSelector = _closeModals2[1];
478
+ var _useCloseModal = (0, _customHooks.useCloseModal)("version-selector"),
479
+ _useCloseModal2 = (0, _slicedToArray2.default)(_useCloseModal, 2),
480
+ showVersionSelector = _useCloseModal2[0],
481
+ setShowVersionSelector = _useCloseModal2[1];
481
482
 
482
483
  (0, _react.useEffect)(function () {
483
484
  checkAll && setSelectedImages(images.values);
@@ -1765,7 +1766,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1765
1766
  }
1766
1767
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
1767
1768
  tabsSections: tabsSections,
1768
- status: activeRetailer.id && retailerStatus ? retailerStatus[activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id][getConcept(activeTab)] || "NS" : "-",
1769
+ status: activeRetailer.id ? retailerStatus[activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id][getConcept(activeTab)] || "NS" : "-",
1769
1770
  activeTab: activeTab,
1770
1771
  setActiveTab: setActiveTab,
1771
1772
  setImageLayout: setImageLayout,
@@ -1791,7 +1791,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1791
1791
  default:
1792
1792
  break;
1793
1793
  }
1794
- }
1794
+ },
1795
+ canAssign: ![7, 8].includes(user.id_role)
1795
1796
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1796
1797
  className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
1797
1798
  children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.1.83",
3
+ "version": "21.1.86",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -1,5 +1,6 @@
1
1
  import { Container, Slider } from "./styles";
2
2
  import { useEffect, useState } from "react";
3
+ import { useCloseModal } from "../../../global-files/customHooks";
3
4
 
4
5
  export const SliderToolTip = ({
5
6
  infoIcon,
@@ -7,19 +8,8 @@ export const SliderToolTip = ({
7
8
  iconSize,
8
9
  slidePosition,
9
10
  }) => {
10
- const [showMenu, setShowMenu] = useState(false);
11
-
12
- const closeMenu = (e) => {
13
- if (!e.target.closest("#div-slider") && showMenu) {
14
- document.removeEventListener("click", closeMenu, false);
15
- setShowMenu(false);
16
- }
17
- };
18
- useEffect(() => {
19
- if (showMenu) {
20
- document.addEventListener("click", closeMenu, false);
21
- }
22
- }, [showMenu]);
11
+ const [showMenu, setShowMenu] = useCloseModal("div-slider");
12
+
23
13
  const color = (id) => {
24
14
  for (let i = 1; i <= slidefront.length; i++) {
25
15
  if (id === `slidea${i}`) {
@@ -43,10 +33,9 @@ export const SliderToolTip = ({
43
33
  alt="info icon"
44
34
  className={iconSize}
45
35
  onClick={(e) => {
46
- setShowMenu(!showMenu);
47
- if (showMenu) {
48
- document.removeEventListener("click", closeMenu, false);
49
- }
36
+ e.stopPropagation();
37
+ e.preventDefault();
38
+ setShowMenu(true);
50
39
  }}
51
40
  />
52
41
  {showMenu && (
@@ -73,11 +62,6 @@ export const SliderToolTip = ({
73
62
  <button
74
63
  id="button-slide"
75
64
  onClick={(e) => {
76
- document.removeEventListener(
77
- "click",
78
- closeMenu,
79
- false
80
- );
81
65
  setShowMenu(false);
82
66
  }}
83
67
  >
@@ -3,11 +3,11 @@ import { Container } from "./styles";
3
3
  export const Status = ({ statusType, ovalForm }) => {
4
4
  return (
5
5
  <Container
6
- className={`status-${statusType.replace(/\/.*/, "")} ${
6
+ className={`status-${statusType?.replace(/\/.*/, "")} ${
7
7
  ovalForm && "oval-form"
8
8
  }`}
9
9
  >
10
- <p>{statusType}</p>
10
+ <p>{statusType ?? 'NS'}</p>
11
11
  </Container>
12
12
  );
13
13
  };
@@ -122,7 +122,10 @@ export const StatusAsignationInfo = ({
122
122
  imageType={"small-image"}
123
123
  image={getProfilePicture(assignation.id, 20, 20)}
124
124
  altText="user profile image"
125
- onClick={() => {
125
+ onClick={(e) => {
126
+ e.preventDefault();
127
+ e.stopPropagation();
128
+ console.log(e.target);
126
129
  setShowAsignationPanel(true);
127
130
  setAssignationType(assignation?.collaboratorType);
128
131
  }}
@@ -41,7 +41,7 @@ import Slide1_3 from "../../../assets/images/sliderToolTip/slide3.svg";
41
41
  import Slide1_4 from "../../../assets/images/sliderToolTip/slide4.svg";
42
42
  import Slide1_5 from "../../../assets/images/sliderToolTip/slide5.svg";
43
43
  import { VersionSelector } from "../../organisms/VersionSelector";
44
- import { closeModals } from "../../../global-files/customHooks";
44
+ import { useCloseModal } from "../../../global-files/customHooks";
45
45
  import { CreateVersion } from "../../organisms/CreateVersion";
46
46
 
47
47
  const reducerImages = (state, action) => {
@@ -164,7 +164,7 @@ export const ProviderProductEdition = ({
164
164
  : productToEdit
165
165
  );
166
166
  const [icon, setIcon] = useState(null);
167
- const [version] = useState(product?.version);
167
+ const [version, setVersion] = useState(product?.version);
168
168
  const [comments] = useState({});
169
169
  const [comment, setComment] = useState("");
170
170
  const [crossComment, setCrossComment] = useState(false);
@@ -211,7 +211,7 @@ export const ProviderProductEdition = ({
211
211
  );
212
212
  const [showCreateVersion, setShowCreateVersion] = useState(false);
213
213
  const [showVersionSelector, setShowVersionSelector] =
214
- closeModals("version-selector");
214
+ useCloseModal("version-selector");
215
215
 
216
216
  useEffect(() => {
217
217
  checkAll && setSelectedImages(images.values);
@@ -1170,7 +1170,7 @@ export const ProviderProductEdition = ({
1170
1170
  <FullTabsMenu
1171
1171
  tabsSections={tabsSections}
1172
1172
  status={
1173
- activeRetailer.id && retailerStatus
1173
+ activeRetailer.id
1174
1174
  ? retailerStatus[activeRetailer?.id][getConcept(activeTab)] ||
1175
1175
  "NS"
1176
1176
  : "-"
@@ -1267,6 +1267,7 @@ export const RetailerProductEdition = ({
1267
1267
  break;
1268
1268
  }
1269
1269
  }}
1270
+ canAssign={![7, 8].includes(user.id_role)}
1270
1271
  />
1271
1272
  <div
1272
1273
  className={