contentoh-components-library 21.3.45 → 21.3.46

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.
package/.env.development CHANGED
@@ -24,6 +24,8 @@ REACT_APP_PENDING_INVITATIONS=https://fc069ovhuk.execute-api.us-east-1.amazonaws
24
24
  REACT_APP_PRODUCTS_CHAT_ENDPOINT=https://fc069ovhuk.execute-api.us-east-1.amazonaws.com/dev/products-chat
25
25
  REACT_APP_TICKETS_CHAT_ENDPOINT=https://ocqbzaa4a2.execute-api.us-east-1.amazonaws.com/dev/ticket-chat
26
26
  REACT_APP_GET_AUDIT=https://fc069ovhuk.execute-api.us-east-1.amazonaws.com/dev/version-manager
27
+ REACT_APP_READ_MESSAGES=https://fc069ovhuk.execute-api.us-east-1.amazonaws.com/dev/read-messages
28
+ REACT_APP_CREATE_MESSAGES=https://fc069ovhuk.execute-api.us-east-1.amazonaws.com/dev/create-messages
27
29
 
28
30
  REACT_APP_IMAGES_ENDPOINT=https://content-management-images.s3.amazonaws.com
29
31
  REACT_APP_IMAGES_BUCKET=content-management-images
@@ -7,6 +7,8 @@ Object.defineProperty(exports, "__esModule", {
7
7
  });
8
8
  exports.HeaderTop = void 0;
9
9
 
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
11
+
10
12
  var _styles = require("./styles");
11
13
 
12
14
  var _index = require("../../atoms/ScreenHeader/index");
@@ -19,11 +21,14 @@ var _Chat = require("../../organisms/Chat");
19
21
 
20
22
  var _IconoAB = _interopRequireDefault(require("../../../../src/assets/images/generalButton/Icono AB.svg"));
21
23
 
24
+ var _react2 = require("@testing-library/react");
25
+
22
26
  var _jsxRuntime = require("react/jsx-runtime");
23
27
 
24
28
  var HeaderTop = function HeaderTop(_ref) {
25
29
  var setHeaderTop = _ref.setHeaderTop,
26
30
  withChat = _ref.withChat,
31
+ chatType = _ref.chatType,
27
32
  productSelected = _ref.productSelected,
28
33
  token = _ref.token,
29
34
  auditableVersion = _ref.auditableVersion,
@@ -31,26 +36,78 @@ var HeaderTop = function HeaderTop(_ref) {
31
36
  isAuditor = _ref.isAuditor,
32
37
  activeRetailer = _ref.activeRetailer;
33
38
  var headerTop = (0, _react.useRef)();
39
+
40
+ var _useState = (0, _react.useState)(null),
41
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
42
+ chat = _useState2[0],
43
+ setChat = _useState2[1];
44
+
45
+ var _useState3 = (0, _react.useState)(null),
46
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
47
+ chatData = _useState4[0],
48
+ setChatData = _useState4[1];
49
+
50
+ (0, _react.useEffect)(function () {
51
+ if (activeRetailer.id && productSelected && token.length) {
52
+ var _productSelected$arti;
53
+
54
+ setChatData({
55
+ id: (productSelected === null || productSelected === void 0 ? void 0 : (_productSelected$arti = productSelected.article) === null || _productSelected$arti === void 0 ? void 0 : _productSelected$arti.id_article) || (productSelected === null || productSelected === void 0 ? void 0 : productSelected.id_article),
56
+ version: productSelected === null || productSelected === void 0 ? void 0 : productSelected.version,
57
+ retailerId: activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id,
58
+ status: productSelected === null || productSelected === void 0 ? void 0 : productSelected.status,
59
+ userToken: token
60
+ });
61
+ }
62
+ }, [activeRetailer, productSelected, token]);
63
+ (0, _react.useEffect)(function () {
64
+ if (chatType) renderChat(chatType);
65
+ }, [chatData, chatType]);
34
66
  (0, _react.useEffect)(function () {
35
67
  setHeaderTop && setHeaderTop(headerTop.current.clientHeight);
36
68
  }, []);
69
+
70
+ var renderChat = function renderChat(chatType) {
71
+ switch (chatType) {
72
+ case "product_status":
73
+ chatData && setChat( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chat.Chat, {
74
+ chatType: "product_status",
75
+ chatContainerType: "popUp",
76
+ chatData: {
77
+ id: chatData === null || chatData === void 0 ? void 0 : chatData.id,
78
+ version: chatData === null || chatData === void 0 ? void 0 : chatData.version,
79
+ retailerId: chatData === null || chatData === void 0 ? void 0 : chatData.retailerId,
80
+ status: chatData === null || chatData === void 0 ? void 0 : chatData.status,
81
+ userToken: chatData === null || chatData === void 0 ? void 0 : chatData.userToken
82
+ },
83
+ size: 18,
84
+ activeRetailer: activeRetailer
85
+ }));
86
+ break;
87
+
88
+ default:
89
+ setChat( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chat.Chat, {
90
+ chatType: "merchant_product",
91
+ chatContainerType: "popUp",
92
+ chatData: {
93
+ userToken: token,
94
+ id: productSelected.id_article,
95
+ version: productSelected.version
96
+ },
97
+ size: 18,
98
+ activeRetailer: activeRetailer
99
+ }));
100
+ break;
101
+ }
102
+ };
103
+
37
104
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
38
105
  ref: headerTop,
39
106
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
40
107
  text: "Edici\xF3n de producto"
41
108
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
42
109
  className: "buttons-container",
43
- children: [withChat && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chat.Chat, {
44
- chatType: "merchant_product",
45
- chatContainerType: "popUp",
46
- chatData: {
47
- userToken: token,
48
- id: productSelected.id_article,
49
- version: productSelected.version
50
- },
51
- size: 18,
52
- activeRetailer: activeRetailer
53
- }), isAuditor && auditableVersion && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Button, {
110
+ children: [withChat && chat, isAuditor && auditableVersion && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.Button, {
54
111
  buttonType: "general-white-button circular-button",
55
112
  onClick: function onClick() {
56
113
  setCompare(function (current) {
@@ -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.default = exports.chatTicket_userTECH = exports.chatTicket_userNORMAL = exports.chatPROV_orderProduct = exports.chatFAB_orderProduct_user49 = exports.chatFAB_orderProduct_user37 = exports.chatCAD_orderProduct = exports.chatCAD_merchantsProductProvider = exports.chatCAD_merchantsProduct = void 0;
8
+ exports.default = exports.chatTicket_userTECH = exports.chatTicket_userNORMAL = exports.chatProduct_status = exports.chatPROV_orderProduct = exports.chatFAB_orderProduct_user49 = exports.chatFAB_orderProduct_user37 = exports.chatCAD_orderProduct = exports.chatCAD_merchantsProductProvider = exports.chatCAD_merchantsProduct = void 0;
9
9
 
10
10
  var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
11
 
@@ -172,4 +172,24 @@ chatTicket_userTECH.args = {
172
172
  }
173
173
  },
174
174
  classNameContainerFixed: "chatTicket"
175
+ }; // ejemplo del chat para los cambios de status del producto.
176
+
177
+ var chatProduct_status = Template.bind({});
178
+ exports.chatProduct_status = chatProduct_status;
179
+ chatProduct_status.args = {
180
+ chatType: "product_status",
181
+ chatContainerType: "popUp",
182
+ chatData: {
183
+ id: 37414,
184
+ version: 7,
185
+ retailerId: 70,
186
+ status: "AA",
187
+ orderId: 15189,
188
+ userToken: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJhOWFhMDQ4Zi05YzRjLTQxODMtYWUzMS03OWVjNjBhY2NjZGYiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4MzU4ODM4OSwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4MzU5MTk4OSwiaWF0IjoxNjgzNTg4Mzg5LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.k9FQfRR02XC3WWfOzWhrbJGmp69AmCHJEIrgtXKhIwC69trdphSm1AKkZnDJMsEdkpUgjF_zAOsa_xYRxO6goXy7WXVc_p7N-yFHlkhZrRyn3LEFKaLzD8vVqlWx4kgfSERm7KhI1AxPmrA-lw8eF6Axvqn3PvuszAw89_WhPOcnOt8vU0MxAVhLgS8oM6vyHFmHEHWQ2FnSYYed9sEvAxGh_B44aIgWeDteQGeGdYhsm6rUcxgkrskywZJp9FW5VgYXuDcC5NpvomMMRy_v95UV897JzCHl__sK2Z9ahm0eczVN3tAc0GbKnlN96ZrGTQ_nmNHbuMDPQBPXH5HXZQ",
189
+ currentUser: {
190
+ id: 37,
191
+ companyId: 2,
192
+ isUserTech: false
193
+ }
194
+ }
175
195
  };
@@ -87,7 +87,7 @@ var ContainerItems = function ContainerItems(props) {
87
87
  var containerItems = (0, _react.useRef)(null);
88
88
  (0, _react.useEffect)(function () {
89
89
  if (!items) return;
90
- if (["merchant_product", "order_product"].includes(chatType)) renderItems();else if (chatType === "ticket") renderItemsTicket();else setCustomItems([]);
90
+ if (["merchant_product", "order_product", "product_status"].includes(chatType)) renderItems();else if (chatType === "ticket") renderItemsTicket();else setCustomItems([]);
91
91
  }, [items]);
92
92
  (0, _react.useEffect)(function () {
93
93
  var containerScroll = document.getElementById("ulItems");