contentoh-components-library 21.3.66 → 21.3.67

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 (50) hide show
  1. package/.env.development +0 -2
  2. package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
  3. package/dist/components/atoms/ButtonV2/styles.js +1 -1
  4. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  5. package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
  6. package/dist/components/molecules/HeaderTop/index.js +11 -68
  7. package/dist/components/molecules/TagAndInput/index.js +1 -1
  8. package/dist/components/organisms/Chat/Chat.stories.js +1 -21
  9. package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
  10. package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
  11. package/dist/components/organisms/Chat/ContentChat/index.js +191 -343
  12. package/dist/components/organisms/Chat/Footer/index.js +39 -48
  13. package/dist/components/organisms/Chat/index.js +3 -48
  14. package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
  15. package/dist/components/organisms/Modal/styles.js +1 -1
  16. package/dist/components/organisms/SideModal/index.js +0 -11
  17. package/dist/components/organisms/SideModal/styles.js +1 -1
  18. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +127 -172
  19. package/dist/components/pages/ProviderProductEdition/index.js +175 -188
  20. package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
  21. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +28 -40
  22. package/dist/components/pages/RetailerProductEdition/index.js +273 -265
  23. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  24. package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
  25. package/dist/index.js +0 -13
  26. package/package.json +1 -1
  27. package/src/components/atoms/ButtonV2/styles.js +1 -1
  28. package/src/components/atoms/InputFormatter/styles.js +1 -2
  29. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  30. package/src/components/molecules/HeaderTop/index.js +6 -52
  31. package/src/components/molecules/TagAndInput/index.js +8 -10
  32. package/src/components/organisms/Chat/Chat.stories.js +0 -21
  33. package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
  34. package/src/components/organisms/Chat/ContainerItems/styles.js +2 -10
  35. package/src/components/organisms/Chat/ContentChat/index.js +6 -81
  36. package/src/components/organisms/Chat/Footer/index.js +0 -11
  37. package/src/components/organisms/Chat/index.js +3 -47
  38. package/src/components/organisms/FullProductNameHeader/index.js +1 -1
  39. package/src/components/organisms/Modal/styles.js +1 -4
  40. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +130 -177
  41. package/src/components/pages/ProviderProductEdition/index.js +129 -132
  42. package/src/components/pages/ProviderProductEdition/styles.js +1 -5
  43. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +26 -38
  44. package/src/components/pages/RetailerProductEdition/index.js +135 -109
  45. package/src/components/pages/RetailerProductEdition/styles.js +0 -4
  46. package/src/components/pages/RetailerProductEdition/utils.js +0 -37
  47. package/src/index.js +0 -1
  48. package/src/components/organisms/SideModal/SideModal.stories.js +0 -23
  49. package/src/components/organisms/SideModal/index.js +0 -50
  50. package/src/components/organisms/SideModal/styles.js +0 -30
@@ -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 flex: 1;\n overflow: auto;\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: calc(100% - 341px);\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 width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\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 .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n }\n }\n #modal-message-box {\n width: 400px;\n height: 100px;\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 flex: 1;\n overflow: auto;\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: calc(100% - 341px);\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 width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\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 .general-button-disabled {\n width: fit-content;\n min-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,18 +5,14 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.translateService = exports.sendMessage = exports.getInputsData = exports.getAuditVersion = exports.createMessage = void 0;
8
+ exports.getInputsData = exports.getAuditVersion = void 0;
9
9
 
10
10
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
11
 
12
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
13
-
14
12
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
15
13
 
16
14
  var _axios = _interopRequireDefault(require("axios"));
17
15
 
18
- var _handle_http = require("../../../global-files/handle_http");
19
-
20
16
  var getAuditVersion = /*#__PURE__*/function () {
21
17
  var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(articleId, setState, token) {
22
18
  var auditResponse;
@@ -68,59 +64,4 @@ var getInputsData = function getInputsData(services, activeRetailer, setDatashee
68
64
  }
69
65
  };
70
66
 
71
- exports.getInputsData = getInputsData;
72
-
73
- var translateService = function translateService(tab) {
74
- switch (tab) {
75
- case "description":
76
- case "Descripción":
77
- return "Descripciones";
78
-
79
- case "datasheet":
80
- case "Ficha técnica":
81
- return "Fichas técnicas";
82
-
83
- case "images":
84
- case "Imágenes":
85
- return "Imágenes";
86
- }
87
- };
88
-
89
- exports.translateService = translateService;
90
-
91
- var createMessage = function createMessage(retailers, idRetailer, oldStatus, newStatus, service) {
92
- var _ref2 = (retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (ret) {
93
- return ret.id === idRetailer;
94
- })) || [],
95
- _ref3 = (0, _slicedToArray2.default)(_ref2, 1),
96
- retailer = _ref3[0];
97
-
98
- return "".concat(translateService(service), " de ").concat(retailer.name, " |").concat(oldStatus, "| a |").concat(newStatus);
99
- };
100
-
101
- exports.createMessage = createMessage;
102
-
103
- var sendMessage = /*#__PURE__*/function () {
104
- var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(data) {
105
- var paramsBody, paramsHeader;
106
- return _regenerator.default.wrap(function _callee2$(_context2) {
107
- while (1) {
108
- switch (_context2.prev = _context2.next) {
109
- case 0:
110
- paramsBody = data.paramsBody, paramsHeader = data.paramsHeader;
111
- return _context2.abrupt("return", (0, _handle_http.fetchPOST)(process.env.REACT_APP_CREATE_MESSAGES, paramsBody, paramsHeader));
112
-
113
- case 2:
114
- case "end":
115
- return _context2.stop();
116
- }
117
- }
118
- }, _callee2);
119
- }));
120
-
121
- return function sendMessage(_x4) {
122
- return _ref4.apply(this, arguments);
123
- };
124
- }();
125
-
126
- exports.sendMessage = sendMessage;
67
+ exports.getInputsData = getInputsData;
package/dist/index.js CHANGED
@@ -992,19 +992,6 @@ Object.keys(_TableResizable).forEach(function (key) {
992
992
  });
993
993
  });
994
994
 
995
- var _index74 = require("./components/organisms/SideModal/index");
996
-
997
- Object.keys(_index74).forEach(function (key) {
998
- if (key === "default" || key === "__esModule") return;
999
- if (key in exports && exports[key] === _index74[key]) return;
1000
- Object.defineProperty(exports, key, {
1001
- enumerable: true,
1002
- get: function get() {
1003
- return _index74[key];
1004
- }
1005
- });
1006
- });
1007
-
1008
995
  var _ChangePasswordLogin = require("./components/pages/ChangePasswordLogin");
1009
996
 
1010
997
  Object.keys(_ChangePasswordLogin).forEach(function (key) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.3.66",
3
+ "version": "21.3.67",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -94,7 +94,7 @@ export const Container = styled.div`
94
94
  }
95
95
  &.pink {
96
96
  background-color: #e33aa9;
97
- color: white;
97
+ color: red;
98
98
  border-color: #e33aa9;
99
99
  &:hover {
100
100
  background-color: #b42983;
@@ -37,6 +37,5 @@ export const Container = styled.div`
37
37
  font-family: ${FontFamily.AvenirNext};
38
38
  color: ${GlobalColors.deep_gray};
39
39
  text-align: right;
40
- margin-top: 5px;
41
40
  }
42
- `;
41
+ `;
@@ -27,7 +27,7 @@ export const CarouselImagesLogin = ({
27
27
  img2.src = images[i];
28
28
  const circulo_actual = Array.from(circulos).find((el) => el.id === i);
29
29
  Array.from(circulos).forEach((cir) => cir.classList.remove("resaltado"));
30
- circulo_actual?.classList.add("resaltado");
30
+ circulo_actual.classList.add("resaltado");
31
31
  img1.classList.add("right");
32
32
  img2.classList.add("active");
33
33
  i++;
@@ -4,13 +4,10 @@ import { Button } from "../../atoms/GeneralButton/index";
4
4
  import { useEffect, useRef } from "react";
5
5
  import { Chat } from "../../organisms/Chat";
6
6
  import auditIcon from "../../../../src/assets/images/generalButton/Icono AB.svg";
7
- import { useState } from "react";
8
- import { render } from "@testing-library/react";
9
7
 
10
8
  export const HeaderTop = ({
11
9
  setHeaderTop,
12
10
  withChat,
13
- chatType,
14
11
  productSelected,
15
12
  token,
16
13
  auditableVersion,
@@ -19,51 +16,16 @@ export const HeaderTop = ({
19
16
  activeRetailer,
20
17
  }) => {
21
18
  const headerTop = useRef();
22
- const [chat, setChat] = useState(null);
23
- const [chatData, setChatData] = useState(null);
24
-
25
- useEffect(() => {
26
- if (activeRetailer.id && productSelected && token.length) {
27
- setChatData({
28
- id: productSelected?.article?.id_article || productSelected?.id_article,
29
- version: productSelected?.version,
30
- retailerId: activeRetailer?.id,
31
- status: productSelected?.status,
32
- userToken: token,
33
- });
34
- }
35
- }, [activeRetailer, productSelected, token]);
36
-
37
- useEffect(() => {
38
- if (chatType) renderChat(chatType);
39
- }, [chatData, chatType]);
40
19
 
41
20
  useEffect(() => {
42
21
  setHeaderTop && setHeaderTop(headerTop.current.clientHeight);
43
22
  }, []);
44
23
 
45
- const renderChat = (chatType) => {
46
- switch (chatType) {
47
- case "product_status":
48
- chatData &&
49
- setChat(
50
- <Chat
51
- chatType="product_status"
52
- chatContainerType="popUp"
53
- chatData={{
54
- id: chatData?.id,
55
- version: chatData?.version,
56
- retailerId: chatData?.retailerId,
57
- status: chatData?.status,
58
- userToken: chatData?.userToken,
59
- }}
60
- size={18}
61
- activeRetailer={activeRetailer}
62
- />
63
- );
64
- break;
65
- default:
66
- setChat(
24
+ return (
25
+ <Container ref={headerTop}>
26
+ <ScreenHeader text="Edición de producto" />
27
+ <div className="buttons-container">
28
+ {withChat && (
67
29
  <Chat
68
30
  chatType="merchant_product"
69
31
  chatContainerType="popUp"
@@ -75,16 +37,8 @@ export const HeaderTop = ({
75
37
  size={18}
76
38
  activeRetailer={activeRetailer}
77
39
  />
78
- );
79
- break;
80
- }
81
- };
40
+ )}
82
41
 
83
- return (
84
- <Container ref={headerTop}>
85
- <ScreenHeader text="Edición de producto" />
86
- <div className="buttons-container">
87
- {withChat && chat}
88
42
  {isAuditor && auditableVersion && (
89
43
  <Button
90
44
  buttonType="general-white-button circular-button"
@@ -38,16 +38,14 @@ export const TagAndInput = ({
38
38
  className={"input-container"}
39
39
  key={`generalTagInput-${inputType}`}
40
40
  >
41
- {label?.length && (
42
- <div className="title-container">
43
- <ScreenHeader
44
- text={label}
45
- headerType={"input-name-header"}
46
- color={color}
47
- />
48
- {showTooltip && <span className="tooltip">{label}</span>}
49
- </div>
50
- )}
41
+ <div className="title-container">
42
+ <ScreenHeader
43
+ text={label}
44
+ headerType={"input-name-header"}
45
+ color={color}
46
+ />
47
+ {showTooltip && <span className="tooltip">{label}</span>}
48
+ </div>
51
49
  <GeneralInput
52
50
  inputId={inputId}
53
51
  inputType={inputType}
@@ -162,24 +162,3 @@ chatTicket_userTECH.args = {
162
162
  },
163
163
  classNameContainerFixed: "chatTicket",
164
164
  };
165
-
166
- // ejemplo del chat para los cambios de status del producto.
167
- export const chatProduct_status = Template.bind({});
168
- chatProduct_status.args = {
169
- chatType: "product_status",
170
- chatContainerType: "popUp",
171
- chatData: {
172
- id: 37414,
173
- version: 7,
174
- retailerId: 70,
175
- status: "AA",
176
- orderId: 15189,
177
- userToken:
178
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJhOWFhMDQ4Zi05YzRjLTQxODMtYWUzMS03OWVjNjBhY2NjZGYiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4MzU4ODM4OSwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4MzU5MTk4OSwiaWF0IjoxNjgzNTg4Mzg5LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.k9FQfRR02XC3WWfOzWhrbJGmp69AmCHJEIrgtXKhIwC69trdphSm1AKkZnDJMsEdkpUgjF_zAOsa_xYRxO6goXy7WXVc_p7N-yFHlkhZrRyn3LEFKaLzD8vVqlWx4kgfSERm7KhI1AxPmrA-lw8eF6Axvqn3PvuszAw89_WhPOcnOt8vU0MxAVhLgS8oM6vyHFmHEHWQ2FnSYYed9sEvAxGh_B44aIgWeDteQGeGdYhsm6rUcxgkrskywZJp9FW5VgYXuDcC5NpvomMMRy_v95UV897JzCHl__sK2Z9ahm0eczVN3tAc0GbKnlN96ZrGTQ_nmNHbuMDPQBPXH5HXZQ",
179
- currentUser: {
180
- id: 37,
181
- companyId: 2,
182
- isUserTech: false,
183
- },
184
- },
185
- };
@@ -22,7 +22,6 @@ import { Tooltip } from "../../../atoms/Tooltip";
22
22
  import { Slide, Zoom } from "@mui/material";
23
23
  import { useRef } from "react";
24
24
  import { ImagePreview } from "../../../atoms/ImagePreview";
25
- import { Status } from "../../../atoms/Status";
26
25
  import { isUserTech } from "../../../../global-files/handle_userTech";
27
26
  import { container } from "aws-amplify";
28
27
 
@@ -56,10 +55,7 @@ export const ContainerItems = (props) => {
56
55
 
57
56
  useEffect(() => {
58
57
  if (!items) return;
59
- if (
60
- ["merchant_product", "order_product", "product_status"].includes(chatType)
61
- )
62
- renderItems();
58
+ if (["merchant_product", "order_product"].includes(chatType)) renderItems();
63
59
  else if (chatType === "ticket") renderItemsTicket();
64
60
  else setCustomItems([]);
65
61
  }, [items]);
@@ -134,16 +130,6 @@ export const ContainerItems = (props) => {
134
130
  return <label className="item-statusTicket">{item.value}</label>;
135
131
  };
136
132
 
137
- const renderStatusItem = (item) => {
138
- const splitText = item.value.split("|");
139
- let message = [];
140
- splitText.forEach((text, i) => {
141
- if (i === 1 || i === 3) message.push(<Status statusType={text} />);
142
- else message.push(text);
143
- });
144
- return <label className="item-statusItem">{message}</label>;
145
- };
146
-
147
133
  const renderStatusTicketNeutral = (item) => {
148
134
  return (
149
135
  <Tooltip
@@ -318,7 +304,7 @@ export const ContainerItems = (props) => {
318
304
  >
319
305
  <li
320
306
  className={
321
- (ownMessage && item.type !== "status" ? "own-message " : "") +
307
+ (ownMessage ? "own-message " : "") +
322
308
  (lastUserId === item.userId ? "sameUser" : "")
323
309
  }
324
310
  >
@@ -353,8 +339,6 @@ export const ContainerItems = (props) => {
353
339
  ? renderComment(item)
354
340
  : item.type === "img"
355
341
  ? renderImg(item)
356
- : item.type === "status"
357
- ? renderStatusItem(item)
358
342
  : item.type === "file"
359
343
  ? renderFile(item, ownMessage)
360
344
  : item.type === "statusTicket" &&
@@ -158,8 +158,7 @@ export const Container = styled.div`
158
158
  .item-message,
159
159
  .item-comment,
160
160
  .item-file,
161
- .item-statusTicket,
162
- .item-statusItem {
161
+ .item-statusTicket {
163
162
  border-radius: 10px;
164
163
  padding: 10px;
165
164
  font-family: ${FontFamily.RobotoRegular}, sans-serif;
@@ -174,17 +173,10 @@ export const Container = styled.div`
174
173
  .item-file {
175
174
  background-color: #8386ee;
176
175
  }
177
- .item-statusTicket,
178
- .item-statusItem {
176
+ .item-statusTicket {
179
177
  background-color: #85bc5b;
180
178
  }
181
179
 
182
- .item-statusItem {
183
- display: flex;
184
- gap: 3px;
185
- align-items: center;
186
- }
187
-
188
180
  .item-message {
189
181
  &.different-company {
190
182
  border: 1px solid #e33aa9;
@@ -100,7 +100,6 @@ export const ContentChat = (props) => {
100
100
  }
101
101
  if (chatType === "merchant_product") getInitialMerchantProduct();
102
102
  else if (chatType === "order_product") getInitialOrderProduct();
103
- else if (chatType === "product_status") getInitialProductStatus();
104
103
  else getInitialTicket();
105
104
  }
106
105
  if (!showPopUpChat) {
@@ -127,8 +126,6 @@ export const ContentChat = (props) => {
127
126
  } else if (chatType === "order_product") {
128
127
  if (companies) getUpdateLatestOrderProduct(true);
129
128
  else getInitialOrderProduct();
130
- } else if (chatType === "product_status") {
131
- getInitialProductStatus();
132
129
  } else {
133
130
  if (singleChat.items) getUpdateLatestTicket(true);
134
131
  else getInitialTicket();
@@ -138,47 +135,6 @@ export const ContentChat = (props) => {
138
135
  /*=======================================================================
139
136
  PETICION GET INICIAL SEGUN EL TIPO DE CHAT
140
137
  ======================================================================= */
141
- const getInitialProductStatus = async () => {
142
- const paramsQuery = {
143
- articleData: {
144
- articleId: JSON.stringify(dataChat.id),
145
- version: JSON.stringify(dataChat.version),
146
- retailerId: JSON.stringify(dataChat.retailerId),
147
- status: dataChat.status,
148
- },
149
- };
150
- const paramsHeaders = { Authorization: dataChat.userToken };
151
- const response = await fetchGET(
152
- process.env.REACT_APP_READ_MESSAGES,
153
- paramsQuery,
154
- paramsHeaders
155
- );
156
- if (!response.body) {
157
- setErrorChat({
158
- existError: true,
159
- code: 400,
160
- message: response.message,
161
- errorDetail: response.errorDetail,
162
- });
163
- setIsLoading(false);
164
- return;
165
- }
166
- // success
167
- setStartUpdate((prev) => prev + 1);
168
- setCurrentUser({
169
- id: response.body.data.currentUserId,
170
- companyId: response.body.data.currentCompanyId,
171
- });
172
- setLastUpdateDate(response.body.data.lastUpdateDate);
173
- setAllUsers(response.body.users);
174
- setSingleChat({
175
- items: response.body.items,
176
- enabledLoadMore: response.body.items.length === 50,
177
- });
178
- setErrorChat({ existError: false });
179
- setIsLoading(false);
180
- };
181
-
182
138
  const getInitialMerchantProduct = async () => {
183
139
  const paramsQuery = {
184
140
  getType: "initial",
@@ -653,14 +609,12 @@ export const ContentChat = (props) => {
653
609
  // enviar items a la BD
654
610
  if (chatType === "merchant_product") {
655
611
  errorCreate = await createItemsMerchantProduct(items);
656
- } else if (chatType === "product_status") {
657
- errorCreate = await createItemsProductStatus(items);
658
612
  } else if (chatType === "order_product") {
659
613
  errorCreate = await createItemsOrderProduct(items);
660
614
  } else errorCreate = await createItemsTicket(items);
661
615
 
662
616
  // actualizar chat para que aparezcan los items enviados
663
- if (["merchant_product", "product_status"].includes(chatType)) {
617
+ if (chatType === "merchant_product") {
664
618
  await getUpdateLatestMerchantProduct();
665
619
  } else if (chatType === "order_product") {
666
620
  await getUpdateLatestOrderProduct();
@@ -673,10 +627,9 @@ export const ContentChat = (props) => {
673
627
  };
674
628
 
675
629
  const createItemsMerchantProduct = async (items = []) => {
676
- const { id, version, orderId } = dataChat;
630
+ const { id, version } = dataChat;
677
631
  const { id: retailerId } = activeRetailer;
678
632
  const paramsBody = { id, version, items, retailerId };
679
- if (chatType === "product_status") paramsBody["orderId"] = orderId;
680
633
  const paramsHeaders = { Authorization: dataChat.userToken };
681
634
  const response = await fetchPOST(
682
635
  process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT,
@@ -690,23 +643,6 @@ export const ContentChat = (props) => {
690
643
  };
691
644
  }
692
645
  };
693
- const createItemsProductStatus = async (items = []) => {
694
- const { id, version, orderId, status } = dataChat;
695
- const { id: retailerId } = activeRetailer;
696
- const paramsBody = { id, version, items, retailerId, orderId, status };
697
- const paramsHeaders = { Authorization: dataChat.userToken };
698
- const response = await fetchPOST(
699
- process.env.REACT_APP_CREATE_MESSAGES,
700
- paramsBody,
701
- paramsHeaders
702
- );
703
- if (!response.body) {
704
- return {
705
- message: response.message,
706
- errorDetail: response.errorDetail,
707
- };
708
- }
709
- };
710
646
 
711
647
  const createItemsOrderProduct = async (items = []) => {
712
648
  const paramsBody = {
@@ -754,11 +690,7 @@ export const ContentChat = (props) => {
754
690
  SECCION DE FUNCIONES
755
691
  ======================================================================= */
756
692
  const isSingleChat = () => {
757
- if (
758
- chatType === "merchant_product" ||
759
- chatType === "ticket" ||
760
- chatType === "product_status"
761
- ) {
693
+ if (chatType === "merchant_product" || chatType === "ticket") {
762
694
  return true;
763
695
  }
764
696
  if (companies && Object.keys(companies).length < 2) return true;
@@ -869,7 +801,7 @@ export const ContentChat = (props) => {
869
801
  // mostrar chat?
870
802
  let items;
871
803
  let enabledLoadMore;
872
- if (["merchant_product", "ticket", "product_status"].includes(chatType)) {
804
+ if (["merchant_product", "ticket"].includes(chatType)) {
873
805
  items = singleChat.items;
874
806
  enabledLoadMore = singleChat.enabledLoadMore;
875
807
  }
@@ -911,9 +843,7 @@ export const ContentChat = (props) => {
911
843
  activeCompanyId={activeCompanyId}
912
844
  ticketCompany={ticketCompany}
913
845
  currentUser={
914
- ["merchant_product", "order_product", "product_status"].includes(
915
- chatType
916
- )
846
+ ["merchant_product", "order_product"].includes(chatType)
917
847
  ? currentUser
918
848
  : dataChat.currentUser
919
849
  }
@@ -952,12 +882,6 @@ export const ContentChat = (props) => {
952
882
  ? { id: dataChat.id, version: currentArticle.version }
953
883
  : chatType === "ticket"
954
884
  ? { id: dataChat.id }
955
- : chatType === "product_status"
956
- ? {
957
- id: dataChat.id,
958
- version: dataChat.version,
959
- retailerId: dataChat.retailerId,
960
- }
961
885
  : undefined
962
886
  }
963
887
  chatCompany={getChatCompany()}
@@ -1000,6 +924,7 @@ export const ContentChat = (props) => {
1000
924
  }}
1001
925
  />
1002
926
  )}
927
+
1003
928
  {/* body */}
1004
929
  {renderBodyChat()}
1005
930
  </Container>
@@ -169,17 +169,6 @@ export const Footer = (props) => {
169
169
  errorMessage = "El ID del ticket no es valido";
170
170
  }
171
171
  break;
172
- case "product_status":
173
- if (
174
- isValidNaturalNumber(dataChat?.id) &&
175
- isValidNaturalNumber(dataChat?.version) &&
176
- isValidNaturalNumber(dataChat?.retailerId)
177
- ) {
178
- fileKey += `productStatus/${dataChat.id}-${dataChat?.version}-${dataChat?.retailerId}/`;
179
- } else {
180
- errorMessage = "El ID del ticket no es valido";
181
- }
182
- break;
183
172
 
184
173
  default:
185
174
  errorMessage =
@@ -24,7 +24,7 @@ export const Chat = (props) => {
24
24
  const [showPopUpChat, setShowPopUpChat] = useState(false);
25
25
  const [data, setData] = useState();
26
26
 
27
- const { ticketCompany, retailerId } = chatData || {};
27
+ const { ticketCompany } = chatData || {};
28
28
 
29
29
  useEffect(() => {
30
30
  switch (chatType) {
@@ -37,9 +37,6 @@ export const Chat = (props) => {
37
37
  case "ticket":
38
38
  validateChatTicket();
39
39
  break;
40
- case "product_status":
41
- validateProductStatus();
42
- break;
43
40
  default:
44
41
  setData({
45
42
  code: 404,
@@ -49,45 +46,6 @@ export const Chat = (props) => {
49
46
  }
50
47
  }, [chatType]);
51
48
 
52
- const validateProductStatus = () => {
53
- const {
54
- userToken, // string
55
- id, // number
56
- version,
57
- retailerId, // number
58
- status,
59
- orderId,
60
- } = chatData;
61
-
62
- if (!isValidGeneral(userToken, id)) return;
63
-
64
- // validar el ID de la cadena asociada al producto en la OT
65
- if (!isValidNaturalNumber(retailerId)) {
66
- setDataError("La cadena relacionada al producto no es válida");
67
- return;
68
- }
69
-
70
- // validar el ID de la version asociada al producto en la OT
71
- if (!isValidNaturalNumber(version)) {
72
- setDataError("La versión del producto no es válida");
73
- return;
74
- }
75
-
76
- if (orderId && !isValidNaturalNumber(orderId)) {
77
- setDataError("La orden del producto no es válida");
78
- return;
79
- }
80
-
81
- setData({
82
- userToken,
83
- id,
84
- version,
85
- retailerId,
86
- orderId,
87
- status,
88
- });
89
- };
90
-
91
49
  const isValidGeneral = (userToken, id) => {
92
50
  // validar token del user
93
51
  if (isStringEmpty(userToken)) {
@@ -111,8 +69,6 @@ export const Chat = (props) => {
111
69
  retailerId, // number
112
70
  } = chatData;
113
71
 
114
- console.log(chatData, "chatData");
115
-
116
72
  if (!isValidGeneral(userToken, id)) return;
117
73
 
118
74
  // validar el ID de la OT en donde se encuentra el producto
@@ -241,7 +197,7 @@ export const Chat = (props) => {
241
197
  dataChat={data}
242
198
  showBtnClose={false}
243
199
  ticketCompany={ticketCompany}
244
- activeRetailer={props.activeRetailer || { id: retailerId }}
200
+ activeRetailer={props.activeRetailer}
245
201
  />
246
202
  </ContainerFixed>
247
203
  );
@@ -274,7 +230,7 @@ export const Chat = (props) => {
274
230
  onClickBtnClose={() => {
275
231
  setShowPopUpChat(false);
276
232
  }}
277
- activeRetailer={props.activeRetailer || { id: retailerId }}
233
+ activeRetailer={props.activeRetailer}
278
234
  />
279
235
  </ContainerPopUp>
280
236
  </Slide>
@@ -23,7 +23,7 @@ export const FullProductNameHeader = ({
23
23
  useEffect(() => {
24
24
  const rtls = headerData?.retailers || headerData?.retailersAvailable;
25
25
  servicesData &&
26
- rtls?.forEach((rt) => {
26
+ rtls.forEach((rt) => {
27
27
  const element = [];
28
28
  servicesData.forEach((sd) => {
29
29
  if (sd.id_retailer === rt.id) {