contentoh-components-library 11.0.0 → 12.0.0

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 (33) hide show
  1. package/.env.development +12 -10
  2. package/.env.production +2 -0
  3. package/dist/components/atoms/AsignationOption/index.js +1 -1
  4. package/dist/components/atoms/AsignationOption/styles.js +1 -1
  5. package/dist/components/atoms/Commentary/index.js +3 -1
  6. package/dist/components/atoms/Commentary/styles.js +4 -1
  7. package/dist/components/atoms/GeneralInput/index.js +2 -2
  8. package/dist/components/molecules/StatusAsignationInfo/index.js +21 -10
  9. package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
  10. package/dist/components/molecules/TableHeader/index.js +6 -2
  11. package/dist/components/organisms/FullTabsMenu/index.js +7 -4
  12. package/dist/components/organisms/ImageDataTable/index.js +6 -2
  13. package/dist/components/organisms/ProductImageModal/index.js +0 -3
  14. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +1 -0
  15. package/dist/components/pages/RetailerProductEdition/index.js +421 -146
  16. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  17. package/dist/global-files/data.js +51 -4
  18. package/package.json +1 -1
  19. package/src/components/atoms/AsignationOption/index.js +1 -1
  20. package/src/components/atoms/AsignationOption/styles.js +6 -0
  21. package/src/components/atoms/Commentary/index.js +2 -2
  22. package/src/components/atoms/Commentary/styles.js +1 -0
  23. package/src/components/atoms/GeneralInput/index.js +12 -6
  24. package/src/components/molecules/StatusAsignationInfo/index.js +38 -24
  25. package/src/components/molecules/StatusAsignationInfo/styles.js +8 -2
  26. package/src/components/molecules/TableHeader/index.js +9 -1
  27. package/src/components/organisms/FullTabsMenu/index.js +6 -3
  28. package/src/components/organisms/ImageDataTable/index.js +4 -0
  29. package/src/components/organisms/ProductImageModal/index.js +0 -4
  30. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -0
  31. package/src/components/pages/RetailerProductEdition/index.js +194 -54
  32. package/src/components/pages/RetailerProductEdition/styles.js +4 -0
  33. package/src/global-files/data.js +29 -2
@@ -13,7 +13,7 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
14
  var _templateObject;
15
15
 
16
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: 100%;\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n max-width: 201px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button {\n width: 201px;\n height: 40px;\n }\n }\n }\n }\n }\n }\n .container {\n width: 100%;\n height: 100%;\n .dropzone {\n height: 100%;\n width: 100%;\n }\n }\n"])), function (_ref) {
16
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: 100%;\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n max-width: 201px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button {\n width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n }\n }\n .container {\n width: 100%;\n height: 100%;\n .dropzone {\n height: 100%;\n width: 100%;\n }\n }\n"])), function (_ref) {
17
17
  var headerTop = _ref.headerTop;
18
18
  return headerTop;
19
19
  });
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.getRetailerServices = exports.getProfilePicture = exports.getPercentage = exports.getImage = void 0;
8
+ exports.getRetailerServices = exports.getProfilePicture = exports.getPercentage = exports.getImage = exports.fetchUsers = void 0;
9
9
 
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
 
@@ -33,7 +33,6 @@ var getRetailerServices = /*#__PURE__*/function () {
33
33
 
34
34
  case 2:
35
35
  responseArray = _context.sent;
36
- console.log(JSON.parse(responseArray[0].data.body).data);
37
36
  datasheets = JSON.parse(responseArray[0].data.body).data;
38
37
  descriptions = JSON.parse(responseArray[1].data.body).data;
39
38
  images = JSON.parse(responseArray[2].data.body).data;
@@ -45,7 +44,7 @@ var getRetailerServices = /*#__PURE__*/function () {
45
44
  });
46
45
  return _context.abrupt("return", [datasheets, descriptions, images]);
47
46
 
48
- case 9:
47
+ case 8:
49
48
  case "end":
50
49
  return _context.stop();
51
50
  }
@@ -216,4 +215,52 @@ var getProfilePicture = function getProfilePicture(userId, width, height) {
216
215
  }
217
216
  };
218
217
 
219
- exports.getProfilePicture = getProfilePicture;
218
+ exports.getProfilePicture = getProfilePicture;
219
+
220
+ var fetchUsers = /*#__PURE__*/function () {
221
+ var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(auth) {
222
+ var usersPromises, usersGroups, header, usersResponse;
223
+ return _regenerator.default.wrap(function _callee4$(_context4) {
224
+ while (1) {
225
+ switch (_context4.prev = _context4.next) {
226
+ case 0:
227
+ usersPromises = [];
228
+ usersGroups = [];
229
+ header = {
230
+ headers: {
231
+ Authorization: auth
232
+ }
233
+ };
234
+ /**
235
+ * 7 will fetch all text specialists
236
+ * 8 will fetch all img specialists
237
+ * 4 will fetch all text facilitators
238
+ * 5 will fetch all img facilitators
239
+ * 6 will fetch all auditors
240
+ */
241
+
242
+ usersPromises.push(_axios.default.get("".concat(process.env.REACT_APP_USER_ENDPOINT, "?fetchRole=7"), header), _axios.default.get("".concat(process.env.REACT_APP_USER_ENDPOINT, "?fetchRole=8"), header), _axios.default.get("".concat(process.env.REACT_APP_USER_ENDPOINT, "?fetchRole=4"), header), _axios.default.get("".concat(process.env.REACT_APP_USER_ENDPOINT, "?fetchRole=5"), header), _axios.default.get("".concat(process.env.REACT_APP_USER_ENDPOINT, "?fetchRole=6"), header));
243
+ _context4.next = 6;
244
+ return Promise.all(usersPromises);
245
+
246
+ case 6:
247
+ usersResponse = _context4.sent;
248
+ usersResponse.forEach(function (item, i) {
249
+ usersGroups.push(item.data.data);
250
+ });
251
+ return _context4.abrupt("return", usersGroups);
252
+
253
+ case 9:
254
+ case "end":
255
+ return _context4.stop();
256
+ }
257
+ }
258
+ }, _callee4);
259
+ }));
260
+
261
+ return function fetchUsers(_x4) {
262
+ return _ref4.apply(this, arguments);
263
+ };
264
+ }();
265
+
266
+ exports.fetchUsers = fetchUsers;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "11.0.0",
3
+ "version": "12.0.0",
4
4
  "dependencies": {
5
5
  "@babel/runtime": "^7.17.2",
6
6
  "@storybook/addon-postcss": "^2.0.0",
@@ -30,7 +30,7 @@ export const AsignationOption = ({
30
30
  <Container onClick={onClick}>
31
31
  <Avatar
32
32
  imageType={imageType}
33
- image={profileImage?.image}
33
+ image={profileImage}
34
34
  altText={"profile image"}
35
35
  />
36
36
  <div className="labels-container">
@@ -6,6 +6,8 @@ export const Container = styled.div`
6
6
  width: fit-content;
7
7
  align-items: center;
8
8
  cursor: pointer;
9
+ border-radius: 3px;
10
+ padding: 5px;
9
11
 
10
12
  .profile-image,
11
13
  .medium-image {
@@ -45,6 +47,10 @@ export const Container = styled.div`
45
47
  border: none;
46
48
  }
47
49
 
50
+ &:hover {
51
+ background-color: ${GlobalColors.s3};
52
+ }
53
+
48
54
  & + * {
49
55
  margin-top: 10px;
50
56
  }
@@ -1,8 +1,8 @@
1
1
  import { Container } from "./styles";
2
2
 
3
- export const Commentary = ({ comment }) => {
3
+ export const Commentary = ({ comment, reviewed }) => {
4
4
  return (
5
- <Container>
5
+ <Container reviewed={reviewed}>
6
6
  <p>{comment}</p>
7
7
  </Container>
8
8
  );
@@ -11,5 +11,6 @@ export const Container = styled.div`
11
11
  font-size: 12px;
12
12
  line-height: 15px;
13
13
  color: ${GlobalColors.s4};
14
+ text-decoration: ${({ reviewed }) => (reviewed ? "line-through" : "none")};
14
15
  }
15
16
  `;
@@ -28,16 +28,22 @@ export const GeneralInput = ({
28
28
 
29
29
  const onHandleChange = (e) => {
30
30
  setTextValue(({ value }) => (value = e.target.value));
31
- addTextAreaToArray(e.target.value, updatedDatasheets, setUpdatedDatasheets);
31
+ updatedDatasheets &&
32
+ addTextAreaToArray(
33
+ e.target.value,
34
+ updatedDatasheets,
35
+ setUpdatedDatasheets
36
+ );
32
37
  };
33
38
 
34
39
  const onHandleTextAreaChange = (e) => {
35
40
  setTextValue(({ value }) => (value = e.target.value));
36
- addTextAreaToArray(
37
- e.target.value,
38
- updatedDescriptions,
39
- setUpdatedDescriptions
40
- );
41
+ updatedDatasheets &&
42
+ addTextAreaToArray(
43
+ e.target.value,
44
+ updatedDescriptions,
45
+ setUpdatedDescriptions
46
+ );
41
47
  };
42
48
 
43
49
  useEffect(() => {
@@ -19,10 +19,13 @@ export const StatusAsignationInfo = ({
19
19
  saveDescriptions,
20
20
  updateImages,
21
21
  assignationsImages,
22
+ setAssignation,
23
+ isRetailer,
22
24
  id = "default-id",
23
25
  }) => {
24
26
  const [showAsignationPanel, setShowAsignationPanel] = useState(false);
25
27
  const [layout, setLayout] = useState(true);
28
+ const [assignationType, setAssignationType] = useState("facilitator");
26
29
 
27
30
  const closeAsignations = (e) => {
28
31
  if (!e.target.closest("#default-id") && showAsignationPanel) {
@@ -77,14 +80,15 @@ export const StatusAsignationInfo = ({
77
80
  )}
78
81
  <StatusTag statusType={status} ovalForm={true} />
79
82
  <div className="assignations-container">
80
- {assignationsImages?.map((assignation, index) => (
83
+ {assignationsImages?.assignations?.map((assignation, index) => (
81
84
  <Avatar
82
- key={index + "-" + assignation}
85
+ key={index + "-" + assignation.id}
83
86
  imageType={"small-image"}
84
- image={getProfilePicture(assignation, 20, 20)}
87
+ image={getProfilePicture(assignation.id, 20, 20)}
85
88
  altText="user profile image"
86
89
  onClick={() => {
87
90
  setShowAsignationPanel(true);
91
+ setAssignationType(assignation?.collaboratorType);
88
92
  }}
89
93
  />
90
94
  ))}
@@ -108,31 +112,41 @@ export const StatusAsignationInfo = ({
108
112
  </div>
109
113
  </div>
110
114
  <div className="asignations-list">
111
- {asignationsList !== undefined ? (
112
- asignationsList.map((asigantion, index) => (
113
- <AsignationOption
114
- profileImage={asignation.image}
115
- asignationType={asignation.asignationType}
116
- name={asignation.name}
117
- team={asigantion.team}
118
- />
119
- ))
115
+ {assignationsImages?.collaborators !== undefined ? (
116
+ assignationsImages?.collaborators[assignationType]?.map(
117
+ (asignation, index) => (
118
+ <AsignationOption
119
+ key={index + "-" + asignation.name}
120
+ profileImage={getProfilePicture(
121
+ asignation?.id_user,
122
+ 40,
123
+ 40
124
+ )}
125
+ onClick={() => {
126
+ setAssignation(assignationType, asignation?.id_user);
127
+ }}
128
+ name={asignation.name}
129
+ />
130
+ )
131
+ )
120
132
  ) : (
121
133
  <p className="no-asignations">Sin personas para asignar</p>
122
134
  )}
123
135
  </div>
124
- <div className="default-asignations-list">
125
- <AsignationOption
126
- asignationType={"provider"}
127
- name={"Solicitar a"}
128
- team={"Proveedor"}
129
- />
130
- <AsignationOption
131
- asignationType={"team"}
132
- name={"Solicitar a"}
133
- team={"Content-oh!"}
134
- />
135
- </div>
136
+ {isRetailer === 0 && (
137
+ <div className="default-asignations-list">
138
+ <AsignationOption
139
+ asignationType={"provider"}
140
+ name={"Solicitar a"}
141
+ team={"Proveedor"}
142
+ />
143
+ <AsignationOption
144
+ asignationType={"team"}
145
+ name={"Solicitar a"}
146
+ team={"Content-oh!"}
147
+ />
148
+ </div>
149
+ )}
136
150
  </div>
137
151
  )}
138
152
  </Container>
@@ -18,6 +18,7 @@ export const Container = styled.div`
18
18
 
19
19
  .assignations-container {
20
20
  display: flex;
21
+ cursor: pointer;
21
22
  }
22
23
 
23
24
  .asignation-panel {
@@ -26,10 +27,11 @@ export const Container = styled.div`
26
27
  box-sizing: border-box;
27
28
  box-shadow: 0px 2px 5px rgba(0, 0, 0, 0.25);
28
29
  border-radius: 4px;
29
- padding: 10px;
30
+ padding: 10px 8px;
30
31
  position: absolute;
31
32
  top: calc(100% + 10px);
32
33
  right: 0;
34
+ z-index: 10;
33
35
 
34
36
  .asignation-header {
35
37
  display: flex;
@@ -57,7 +59,6 @@ export const Container = styled.div`
57
59
 
58
60
  .asignations-list {
59
61
  min-height: 40px;
60
- border-bottom: 1px solid ${GlobalColors.s3};
61
62
 
62
63
  .no-asignations {
63
64
  padding: 5px;
@@ -70,7 +71,12 @@ export const Container = styled.div`
70
71
 
71
72
  & + * {
72
73
  margin-top: 10px;
74
+ border-top: 1px solid ${GlobalColors.s3};
73
75
  }
74
76
  }
77
+
78
+ .default-asignations-list {
79
+ padding-top: 10px;
80
+ }
75
81
  }
76
82
  `;
@@ -3,7 +3,13 @@ import { ScreenHeader } from "../../atoms/ScreenHeader";
3
3
  import { StatusAsignationInfo } from "../StatusAsignationInfo";
4
4
  import { GlobalColors } from "../../../global-files/variables";
5
5
 
6
- export const TableHeader = ({ imagesStatus, activeImage, assignationsImages }) => {
6
+ export const TableHeader = ({
7
+ imagesStatus,
8
+ activeImage,
9
+ assignationsImages,
10
+ setAssignation,
11
+ isRetailer,
12
+ }) => {
7
13
  return (
8
14
  <Container>
9
15
  <ScreenHeader
@@ -14,6 +20,8 @@ export const TableHeader = ({ imagesStatus, activeImage, assignationsImages }) =
14
20
  <StatusAsignationInfo
15
21
  status={imagesStatus}
16
22
  assignationsImages={assignationsImages}
23
+ setAssignation={setAssignation}
24
+ isRetailer={isRetailer}
17
25
  />
18
26
  </Container>
19
27
  );
@@ -13,10 +13,11 @@ export const FullTabsMenu = ({
13
13
  saveDatasheets,
14
14
  saveDescriptions,
15
15
  updateImages,
16
- assignations,
16
+ assig,
17
+ setAssignation,
18
+ isRetailer,
17
19
  }) => {
18
20
  const [imagesSection, setImagesSection] = useState(false);
19
- //console.log(status);
20
21
 
21
22
  return (
22
23
  <Container>
@@ -34,7 +35,9 @@ export const FullTabsMenu = ({
34
35
  saveDatasheets={saveDatasheets}
35
36
  saveDescriptions={saveDescriptions}
36
37
  updateImages={updateImages}
37
- assignationsImages={assignations[activeTab]}
38
+ assignationsImages={assig}
39
+ setAssignation={setAssignation}
40
+ isRetailer={isRetailer}
38
41
  />
39
42
  </Container>
40
43
  );
@@ -12,6 +12,8 @@ export const ImageDataTable = ({
12
12
  setImages,
13
13
  assignationsImages,
14
14
  imagesStatus,
15
+ setAssignation,
16
+ isRetailer,
15
17
  }) => {
16
18
  return (
17
19
  <Container darkMode={darkMode}>
@@ -19,6 +21,8 @@ export const ImageDataTable = ({
19
21
  imagesStatus={imagesStatus}
20
22
  activeImage={activeImage}
21
23
  assignationsImages={assignationsImages}
24
+ setAssignation={setAssignation}
25
+ isRetailer={isRetailer}
22
26
  />
23
27
  <Row>
24
28
  <ScreenHeader headerType={"table-row-text"} text="Tipo de toma" />
@@ -37,10 +37,6 @@ export const ProductImageModal = ({
37
37
  }
38
38
  }, [showValidationPanel]);
39
39
 
40
- useEffect(() => {
41
- console.log(images?.values[activeImage]);
42
- }, [activeImage]);
43
-
44
40
  return (
45
41
  <Container>
46
42
  <div className="modal-container">
@@ -43,6 +43,8 @@ RetailerProductEditionDefault.args = {
43
43
  "Ficha técnica": false,
44
44
  Imágenes: false,
45
45
  },
46
+ token:
47
+ "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjp0cnVlLCJjb2duaXRvOnVzZXJuYW1lIjoiYzk0YTczMDUtOTM2NS00NmZmLWE0MjMtNGI0YmMzYjhiMTgwIiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6ODk4NjcwMjMyODA3OnJvbGVcL2NvbnRlbnRvaC1kZXYtdXMtZWFzdC0xLWxhbWJkYVJvbGUiXSwiYXVkIjoiNWFjOHRwZ3M2Z2JzcTEzZnJ2cnBpZWVwNDAiLCJldmVudF9pZCI6IjU2M2I0NTFlLTVhZDQtNGMzNy1iNjIzLTc3NjMwM2Y3YjJiNSIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjQ4NzYwODcwLCJuYW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjQ4NzY0NDcwLCJpYXQiOjE2NDg3NjA4NzAsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.Y2gmN-9KDeYyvvSJOzKJUP-WL8O4AmZhdLnfHxSB_9lAXQFns6uJUbX1nzE75cuqeQ3NeiNZy4hu8y5Y7hckPuQFy01nY3OoY3SfD06W0SciNz0txNSR7oN6KH_c_9FOwQiQ0mnOs9udo9nDM4faFFUuu9UD6RMVfeLW1gfZmtyc3lfmy6YO6feJcS3opSSQpXH4Mgh415fXFjbyz344ssd5nl7Onyh8jq5i-LAex3OPXhKzjrBnDRpGg3BQPIfpsquGZNKBiWqyos--CuohFBeyevMLGoKOcU-Ga-zIdEfonTtDVRe6CQLgOZJ2xTPdswlzRPby1gFoZjNebeeRVw",
46
48
  articleId: 238,
47
49
  category: 846,
48
50
  version: 2,