contentoh-components-library 21.3.33 → 21.3.35

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 (36) hide show
  1. package/dist/components/atoms/CustomSelectItem/index.js +1 -1
  2. package/dist/components/atoms/InputText/index.js +1 -1
  3. package/dist/components/atoms/ProductPercentCard/index.js +1 -1
  4. package/dist/components/atoms/Select/index.js +1 -1
  5. package/dist/components/molecules/ButtonDownloadFile/index.js +1 -1
  6. package/dist/components/molecules/CarouselImagesLogin/index.js +2 -2
  7. package/dist/components/molecules/ImageTooltip/index.js +7 -21
  8. package/dist/components/molecules/ProductNameHeader/index.js +0 -1
  9. package/dist/components/molecules/SelectV2/index.js +1 -1
  10. package/dist/components/organisms/Chat/Chat.stories.js +6 -5
  11. package/dist/components/organisms/Chat/ChatLists/index.js +2 -2
  12. package/dist/components/organisms/Chat/ContentChat/index.js +97 -58
  13. package/dist/components/organisms/Chat/Footer/index.js +21 -22
  14. package/dist/components/organisms/Chat/index.js +1 -1
  15. package/dist/components/organisms/FullProductNameHeader/index.js +7 -1
  16. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +9 -6
  17. package/dist/global-files/handle_http.js +33 -31
  18. package/package.json +1 -1
  19. package/src/components/atoms/CustomSelectItem/index.js +2 -1
  20. package/src/components/atoms/InputText/index.js +1 -1
  21. package/src/components/atoms/ProductPercentCard/index.js +2 -2
  22. package/src/components/atoms/Select/index.js +1 -1
  23. package/src/components/molecules/ButtonDownloadFile/index.js +1 -1
  24. package/src/components/molecules/CarouselImagesLogin/index.js +2 -2
  25. package/src/components/molecules/ImageTooltip/index.js +7 -17
  26. package/src/components/molecules/ProductNameHeader/index.js +0 -1
  27. package/src/components/molecules/SelectV2/index.js +1 -1
  28. package/src/components/organisms/Chat/Chat.stories.js +5 -4
  29. package/src/components/organisms/Chat/ChatLists/index.js +2 -2
  30. package/src/components/organisms/Chat/ContentChat/index.js +45 -36
  31. package/src/components/organisms/Chat/ContentChat/styles.js +1 -1
  32. package/src/components/organisms/Chat/Footer/index.js +4 -8
  33. package/src/components/organisms/Chat/index.js +1 -1
  34. package/src/components/organisms/FullProductNameHeader/index.js +8 -3
  35. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +11 -5
  36. package/src/global-files/handle_http.js +11 -13
@@ -55,7 +55,7 @@ var CustomSelectItem = function CustomSelectItem(_ref) {
55
55
  var oneDimensionArray = function oneDimensionArray(arr) {
56
56
  var array = [];
57
57
  arr.forEach(function (element) {
58
- if ((0, _typeof2.default)(element) == "object") array.push.apply(array, (0, _toConsumableArray2.default)(oneDimensionArray(element)));else array.push(element);
58
+ if ((0, _typeof2.default)(element) === "object") array.push.apply(array, (0, _toConsumableArray2.default)(oneDimensionArray(element)));else array.push(element);
59
59
  });
60
60
  return array;
61
61
  };
@@ -53,7 +53,7 @@ var InputText = function InputText(props) {
53
53
  return onChangeText && onChangeText(event.target.value);
54
54
  },
55
55
  onKeyDown: function onKeyDown(event) {
56
- if (event.key == "Enter" && !event.shiftKey) {
56
+ if (event.key === "Enter" && !event.shiftKey) {
57
57
  event.preventDefault();
58
58
  onEnter && onEnter(event);
59
59
  }
@@ -36,7 +36,7 @@ var ProductPercentCard = function ProductPercentCard(_ref) {
36
36
  alt: ""
37
37
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
38
38
  className: "span",
39
- children: [percent == "NaN" ? 0 : percent, "%"]
39
+ children: [percent === "NaN" ? 0 : percent, "%"]
40
40
  })]
41
41
  })]
42
42
  });
@@ -28,7 +28,7 @@ function Select(props) {
28
28
  ,
29
29
  value: item.value ? item.value : item // selected={
30
30
  // item.value
31
- // ? item.value == props.valueSelected && "selected"
31
+ // ? item.value === props.valueSelected && "selected"
32
32
  // : item === props.valueSelected && "selected"
33
33
  // }
34
34
  ,
@@ -74,7 +74,7 @@ var ButtonDownloadFile = function ButtonDownloadFile(props) {
74
74
  case 4:
75
75
  responseFile = _context.sent;
76
76
 
77
- if (!(responseFile.status != 200)) {
77
+ if (!(responseFile.status !== 200)) {
78
78
  _context.next = 9;
79
79
  break;
80
80
  }
@@ -42,7 +42,7 @@ var CarouselImagesLogin = function CarouselImagesLogin(_ref) {
42
42
  var slideshow = function slideshow() {
43
43
  img2.src = images[i];
44
44
  var circulo_actual = Array.from(circulos).find(function (el) {
45
- return el.id == i;
45
+ return el.id === i;
46
46
  });
47
47
  Array.from(circulos).forEach(function (cir) {
48
48
  return cir.classList.remove("resaltado");
@@ -52,7 +52,7 @@ var CarouselImagesLogin = function CarouselImagesLogin(_ref) {
52
52
  img2.classList.add("active");
53
53
  i++;
54
54
 
55
- if (i == images.length) {
55
+ if (i === images.length) {
56
56
  i = 0;
57
57
  }
58
58
 
@@ -23,7 +23,6 @@ var _jsxRuntime = require("react/jsx-runtime");
23
23
 
24
24
  var ImageTooltip = function ImageTooltip(props) {
25
25
  var className = props.className,
26
- width = props.width,
27
26
  sizeLoading = props.sizeLoading,
28
27
  colorLoading = props.colorLoading,
29
28
  classNameLoading = props.classNameLoading,
@@ -39,19 +38,6 @@ var ImageTooltip = function ImageTooltip(props) {
39
38
  imgLoad = _useState2[0],
40
39
  setImgLoad = _useState2[1];
41
40
 
42
- var _useState3 = (0, _react.useState)(false),
43
- _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
44
- loading = _useState4[0],
45
- setLoading = _useState4[1];
46
- /* solo para hacer pruebas en modo dev
47
- useEffect(() => {
48
- setTimeout(() => {
49
- setLoading(false);
50
- }, 5000);
51
- }, []);
52
- */
53
-
54
-
55
41
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_Tooltip.Tooltip, {
56
42
  position: position !== null && position !== void 0 ? position : "topCenter",
57
43
  addArrow: false,
@@ -59,8 +45,8 @@ var ImageTooltip = function ImageTooltip(props) {
59
45
  followCursor: false,
60
46
  className: className,
61
47
  classNameTooltip: classNameTooltip,
62
- componentTooltip: imgLoad !== undefined && !loading && componentTooltip,
63
- children: [src && (imgLoad === undefined || loading) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ContainerLoading, {
48
+ componentTooltip: imgLoad !== undefined && componentTooltip,
49
+ children: [src && imgLoad === undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ContainerLoading, {
64
50
  className: classNameLoading,
65
51
  sizeLoading: sizeLoading,
66
52
  colorLoading: colorLoading,
@@ -68,16 +54,16 @@ var ImageTooltip = function ImageTooltip(props) {
68
54
  pulse: true,
69
55
  icon: _freeSolidSvgIcons.faSpinner
70
56
  })
71
- }), (!src || imgLoad === false && !loading) && componentDefault, /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Img, {
57
+ }), (!src || imgLoad === false) && componentDefault, /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Img, {
72
58
  className: classNameImg,
73
- src: src,
74
- onLoad: function onLoad(event) {
59
+ src: "".concat(src, "?").concat(new Date().getMilliseconds()),
60
+ onLoad: function onLoad() {
75
61
  return setImgLoad(true);
76
62
  },
77
- onError: function onError(event) {
63
+ onError: function onError() {
78
64
  return setImgLoad(false);
79
65
  },
80
- show: imgLoad === true && !loading
66
+ show: imgLoad === true
81
67
  })]
82
68
  });
83
69
  };
@@ -20,7 +20,6 @@ var _jsxRuntime = require("react/jsx-runtime");
20
20
  var ProductNameHeader = function ProductNameHeader(_ref) {
21
21
  var productName = _ref.productName,
22
22
  statusType = _ref.statusType,
23
- percent = _ref.percent,
24
23
  priority = _ref.priority,
25
24
  date = _ref.date,
26
25
  percentRequired = _ref.percentRequired;
@@ -158,7 +158,7 @@ var SelectV2 = function SelectV2(props) {
158
158
  for (_iterator.s(); !(_step = _iterator.n()).done;) {
159
159
  var item = _step.value;
160
160
 
161
- if (item.value == selectedItemsCopy[0]) {
161
+ if (item.value === selectedItemsCopy[0]) {
162
162
  labelItem = item.label;
163
163
  break;
164
164
  }
@@ -149,14 +149,15 @@ chatTicket_userTECH.args = {
149
149
  chatContainerType: "fixed",
150
150
  chatData: {
151
151
  id: 130,
152
- ticketOwnerUserId: 49,
153
- ticketCompany: 817,
154
- statusTicket: "IN_PROGRESS",
152
+ ticketOwnerUserId: 194,
153
+ ticketCompany: undefined,
154
+ statusTicket: "PENDING",
155
155
  currentUser: {
156
- token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI5M2FkOTM5Yy04MzJjLTQ4NWItOWUzMS0yN2MxNzBjMDk1NWEiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY2OTY2MjU5MiwibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2Njk2NjYxOTIsImlhdCI6MTY2OTY2MjU5MiwiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.hhdlQk-ljHpyZPRoG02YcvPow8jpm9coZfmEuZ29vIVX7bX5k05Ss3FkaT0dYNr2qEvqZHHqH61oJvx4xr2i6z2c3xEZxyJZFR-Cc_skhH0UwGXbCH9up5PW1aipY5rL45E42R7GKSGmB5Z-B7vxe2NcL-ZojYZkXNZ7Gx_lM8Vpq-XsFLJ4nCJlH7vx9D4SkREN3lLfYIIgqNrxJ_wqfqvcqexwRJfnr76ZqCuDR4dTWsES2Lf5D8Wa_wkQAjQNdzP7ai28l9fRyCSwkTxvamdJkx7p-tssOL5pAnCsKkD22UN-09c1bhuGrgfKWUV4awbptfjvHS7TSq0bWiv4gQ",
156
+ token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJlYTRlZmQ1Zi1mYTg4LTRjNDEtYTM3Ny02MWVkNmY0YTMyOTciLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4MDA1Njg2NSwibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2ODAwNjA0NjUsImlhdCI6MTY4MDA1Njg2NSwiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.oRuv3LkdvctEMUjmeGw0-XefzV_Aoh1O2hFMik4RxpkkCUeP1O7AjA7lJI6sgoqa9Nwa2fCPRXk6ufi84UbgxGEgkupQmAvXTHQCw_uwCUVAZitlNGXSBl-VSisMuXSnckxdZQ1MvLV5BgLmiw4mu6HxKDN-Uw0xc7yL_yDtGu3NWxoO0Cm2zbej8jYLE9DV9wG297bjfzVQ7hzpEfEcB52I5Tg6nF2VDTx-8_m4mVVrpisbV5uBoYokbFyyOFVLZzUU7Je5uHukscHS5dje9IMTY8DE5S8xUWJubHjf_ktcy7Y2-F2cG5dI5oSdrBNU-wNNW5-OtRLgclSJLmbPCw",
157
157
  id: 28,
158
158
  companyId: 1,
159
159
  isUserTech: true
160
160
  }
161
- }
161
+ },
162
+ classNameContainerFixed: "chatTicket"
162
163
  };
@@ -80,14 +80,14 @@ var ChatLists = function ChatLists(props) {
80
80
  })]
81
81
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
82
82
  className: "container-indicators",
83
- children: currentCompanyId == companyId && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
83
+ children: currentCompanyId === companyId && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
84
84
  className: "label-ownCompany",
85
85
  children: "Interno"
86
86
  })
87
87
  })]
88
88
  }, "itemChat-" + companyId); // checar si es chat abierto
89
89
 
90
- if (company.statusChat == "closed") jsxClosedChats.push(itemChat);else jsxOpenChats.push(itemChat);
90
+ if (company.statusChat === "closed") jsxClosedChats.push(itemChat);else jsxOpenChats.push(itemChat);
91
91
  };
92
92
 
93
93
  for (var _i = 0, _Object$keys = Object.keys(companies); _i < _Object$keys.length; _i++) {
@@ -177,10 +177,18 @@ var ContentChat = function ContentChat(props) {
177
177
  return function () {
178
178
  if (processUpdateID !== undefined) clearTimeout(processUpdateID);
179
179
  };
180
- }, []); // al cargar el componente
180
+ }, []);
181
+
182
+ var stopUpdate = function stopUpdate() {
183
+ if (processUpdateID !== undefined) {
184
+ clearTimeout(processUpdateID);
185
+ setProcessUpdateID(undefined);
186
+ }
187
+ }; // al cargar el componente
188
+
181
189
 
182
190
  (0, _react.useEffect)(function () {
183
- if (dataChat) {
191
+ if (dataChat && showPopUpChat) {
184
192
  stopUpdate();
185
193
 
186
194
  if (dataChat.code) {
@@ -196,11 +204,15 @@ var ContentChat = function ContentChat(props) {
196
204
 
197
205
  if (chatType === "merchant_product") getInitialMerchantProduct();else if (chatType === "order_product") getInitialOrderProduct();else getInitialTicket();
198
206
  }
207
+
208
+ if (!showPopUpChat) {
209
+ stopUpdate();
210
+ }
199
211
  }, [dataChat, showPopUpChat]); // comenzar temporizador del update de 20s
200
212
 
201
213
  (0, _react.useEffect)(function () {
202
- //return; -- descomentarizar para hacer pruebas sin update
203
- if (startUpdate == 0) return;
214
+ // return; // -- descomentarizar para hacer pruebas sin update
215
+ if (startUpdate === 0) return;
204
216
  var processID = setTimeout(function () {
205
217
  setRunUpdate(function (prev) {
206
218
  return prev + 1;
@@ -214,9 +226,9 @@ var ContentChat = function ContentChat(props) {
214
226
 
215
227
  (0, _react.useEffect)(function () {
216
228
  if (chatType === "merchant_product") {
217
- if (singleChat.items) getUpdateLatestMerchantProduct();else getInitialMerchantProduct();
229
+ if (singleChat.items) getUpdateLatestMerchantProduct(true);else getInitialMerchantProduct();
218
230
  } else if (chatType === "order_product") {
219
- if (companies) getUpdateLatestOrderProduct();else getInitialOrderProduct();
231
+ if (companies) getUpdateLatestOrderProduct(true);else getInitialOrderProduct();
220
232
  } else {
221
233
  if (singleChat.items) getUpdateLatestTicket(true);else getInitialTicket();
222
234
  }
@@ -262,6 +274,9 @@ var ContentChat = function ContentChat(props) {
262
274
 
263
275
  case 9:
264
276
  // success
277
+ setStartUpdate(function (prev) {
278
+ return prev + 1;
279
+ });
265
280
  setCurrentUser({
266
281
  id: response.body.data.currentUserId,
267
282
  companyId: response.body.data.currentCompanyId
@@ -277,7 +292,7 @@ var ContentChat = function ContentChat(props) {
277
292
  });
278
293
  setIsLoading(false);
279
294
 
280
- case 15:
295
+ case 16:
281
296
  case "end":
282
297
  return _context.stop();
283
298
  }
@@ -656,25 +671,34 @@ var ContentChat = function ContentChat(props) {
656
671
 
657
672
  var getUpdateLatestMerchantProduct = /*#__PURE__*/function () {
658
673
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
659
- var paramsQuery, response, newSingleChat;
674
+ var fromUpdate,
675
+ paramsQuery,
676
+ paramsHeaders,
677
+ response,
678
+ newSingleChat,
679
+ _args7 = arguments;
660
680
  return _regenerator.default.wrap(function _callee7$(_context7) {
661
681
  while (1) {
662
682
  switch (_context7.prev = _context7.next) {
663
683
  case 0:
684
+ fromUpdate = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
664
685
  paramsQuery = {
665
686
  getType: "updateLatest",
666
687
  id: JSON.stringify(dataChat.id),
667
688
  version: JSON.stringify(dataChat.version),
668
689
  date: encodeURIComponent(lastUpdateDate)
669
690
  };
670
- _context7.next = 3;
671
- return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
691
+ paramsHeaders = {
692
+ Authorization: dataChat.userToken
693
+ };
694
+ _context7.next = 5;
695
+ return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery, paramsHeaders);
672
696
 
673
- case 3:
697
+ case 5:
674
698
  response = _context7.sent;
675
699
 
676
700
  if (response.body) {
677
- _context7.next = 7;
701
+ _context7.next = 9;
678
702
  break;
679
703
  }
680
704
 
@@ -684,17 +708,20 @@ var ContentChat = function ContentChat(props) {
684
708
  });
685
709
  return _context7.abrupt("return");
686
710
 
687
- case 7:
711
+ case 9:
688
712
  // success
713
+ setStartUpdate(function (prev) {
714
+ return prev + 1;
715
+ });
689
716
  setLastUpdateDate(response.body.data.lastUpdateDate); // actualizar la lista de los users
690
717
 
691
718
  updateAllUsers(response.body.users); // actualizar los items del chat
692
719
 
693
720
  newSingleChat = (0, _objectSpread3.default)({}, singleChat);
694
- newSingleChat.items = addNewItemsChat(newSingleChat.items, response.body.items);
721
+ newSingleChat.items = addNewItemsChat(newSingleChat.items, response.body.items, fromUpdate);
695
722
  setSingleChat(newSingleChat);
696
723
 
697
- case 12:
724
+ case 15:
698
725
  case "end":
699
726
  return _context7.stop();
700
727
  }
@@ -709,11 +736,16 @@ var ContentChat = function ContentChat(props) {
709
736
 
710
737
  var getUpdateLatestOrderProduct = /*#__PURE__*/function () {
711
738
  var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
712
- var paramsQuery, response, companiesList;
739
+ var fromUpdate,
740
+ paramsQuery,
741
+ response,
742
+ companiesList,
743
+ _args8 = arguments;
713
744
  return _regenerator.default.wrap(function _callee8$(_context8) {
714
745
  while (1) {
715
746
  switch (_context8.prev = _context8.next) {
716
747
  case 0:
748
+ fromUpdate = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : false;
717
749
  paramsQuery = {
718
750
  getType: "updateLatest",
719
751
  id: JSON.stringify(dataChat.id),
@@ -725,14 +757,14 @@ var ContentChat = function ContentChat(props) {
725
757
  othersCompanyId: encodeURIComponent(JSON.stringify(Object.keys(companies))),
726
758
  date: encodeURIComponent(lastUpdateDate)
727
759
  };
728
- _context8.next = 3;
760
+ _context8.next = 4;
729
761
  return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
730
762
 
731
- case 3:
763
+ case 4:
732
764
  response = _context8.sent;
733
765
 
734
766
  if (response.body) {
735
- _context8.next = 7;
767
+ _context8.next = 8;
736
768
  break;
737
769
  }
738
770
 
@@ -742,9 +774,12 @@ var ContentChat = function ContentChat(props) {
742
774
  });
743
775
  return _context8.abrupt("return");
744
776
 
745
- case 7:
777
+ case 8:
746
778
  // success
747
- // cuando cambie la lista de chats por un cambio de version o estatus
779
+ setStartUpdate(function (prev) {
780
+ return prev + 1;
781
+ }); // cuando cambie la lista de chats por un cambio de version o estatus
782
+
748
783
  if (response.body.data.status) {
749
784
  setIsLoading(true);
750
785
  setTimeout(function () {
@@ -791,12 +826,12 @@ var ContentChat = function ContentChat(props) {
791
826
 
792
827
  companiesList = (0, _objectSpread3.default)({}, companies);
793
828
  Object.keys(response.body.companies).forEach(function (companyId) {
794
- companiesList[companyId].items = addNewItemsChat(companiesList[companyId].items, response.body.companies[companyId].items);
829
+ companiesList[companyId].items = addNewItemsChat(companiesList[companyId].items, response.body.companies[companyId].items, fromUpdate);
795
830
  });
796
831
  setCompanies(companiesList);
797
832
  }
798
833
 
799
- case 8:
834
+ case 10:
800
835
  case "end":
801
836
  return _context8.stop();
802
837
  }
@@ -1104,7 +1139,10 @@ var ContentChat = function ContentChat(props) {
1104
1139
  var createItemsMerchantProduct = /*#__PURE__*/function () {
1105
1140
  var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
1106
1141
  var items,
1142
+ id,
1143
+ version,
1107
1144
  paramsBody,
1145
+ paramsHeaders,
1108
1146
  response,
1109
1147
  _args11 = arguments;
1110
1148
  return _regenerator.default.wrap(function _callee11$(_context11) {
@@ -1112,20 +1150,23 @@ var ContentChat = function ContentChat(props) {
1112
1150
  switch (_context11.prev = _context11.next) {
1113
1151
  case 0:
1114
1152
  items = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : [];
1153
+ id = dataChat.id, version = dataChat.version;
1115
1154
  paramsBody = {
1116
- id: JSON.stringify(dataChat.id),
1117
- version: JSON.stringify(dataChat.version),
1118
- userId: JSON.stringify(currentUser.id),
1119
- items: JSON.stringify(items)
1155
+ id: id,
1156
+ version: version,
1157
+ items: items
1158
+ };
1159
+ paramsHeaders = {
1160
+ Authorization: dataChat.userToken
1120
1161
  };
1121
- _context11.next = 4;
1122
- return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody);
1162
+ _context11.next = 6;
1163
+ return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody, paramsHeaders);
1123
1164
 
1124
- case 4:
1165
+ case 6:
1125
1166
  response = _context11.sent;
1126
1167
 
1127
1168
  if (response.body) {
1128
- _context11.next = 7;
1169
+ _context11.next = 9;
1129
1170
  break;
1130
1171
  }
1131
1172
 
@@ -1134,7 +1175,7 @@ var ContentChat = function ContentChat(props) {
1134
1175
  errorDetail: response.errorDetail
1135
1176
  });
1136
1177
 
1137
- case 7:
1178
+ case 9:
1138
1179
  case "end":
1139
1180
  return _context11.stop();
1140
1181
  }
@@ -1151,6 +1192,7 @@ var ContentChat = function ContentChat(props) {
1151
1192
  var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
1152
1193
  var items,
1153
1194
  paramsBody,
1195
+ paramsHeaders,
1154
1196
  response,
1155
1197
  _args12 = arguments;
1156
1198
  return _regenerator.default.wrap(function _callee12$(_context12) {
@@ -1159,22 +1201,22 @@ var ContentChat = function ContentChat(props) {
1159
1201
  case 0:
1160
1202
  items = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : [];
1161
1203
  paramsBody = {
1162
- id: JSON.stringify(dataChat.id),
1163
- version: JSON.stringify(currentArticle.version),
1164
- userId: JSON.stringify(currentUser.id),
1165
- items: JSON.stringify(items),
1166
- orderId: JSON.stringify(dataChat.orderId),
1167
- sentCompanyId: JSON.stringify(currentUser.companyId),
1168
- receivedCompanyId: JSON.stringify(activeCompanyId)
1204
+ id: dataChat.id,
1205
+ version: currentArticle.version,
1206
+ items: items,
1207
+ orderId: dataChat.orderId
1208
+ };
1209
+ paramsHeaders = {
1210
+ Authorization: dataChat.userToken
1169
1211
  };
1170
- _context12.next = 4;
1171
- return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody);
1212
+ _context12.next = 5;
1213
+ return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody, paramsHeaders);
1172
1214
 
1173
- case 4:
1215
+ case 5:
1174
1216
  response = _context12.sent;
1175
1217
 
1176
1218
  if (response.body) {
1177
- _context12.next = 7;
1219
+ _context12.next = 8;
1178
1220
  break;
1179
1221
  }
1180
1222
 
@@ -1183,7 +1225,7 @@ var ContentChat = function ContentChat(props) {
1183
1225
  errorDetail: response.errorDetail
1184
1226
  });
1185
1227
 
1186
- case 7:
1228
+ case 8:
1187
1229
  case "end":
1188
1230
  return _context12.stop();
1189
1231
  }
@@ -1200,6 +1242,7 @@ var ContentChat = function ContentChat(props) {
1200
1242
  var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
1201
1243
  var items,
1202
1244
  paramsBody,
1245
+ paramsHeaders,
1203
1246
  response,
1204
1247
  _args13 = arguments;
1205
1248
  return _regenerator.default.wrap(function _callee13$(_context13) {
@@ -1212,14 +1255,17 @@ var ContentChat = function ContentChat(props) {
1212
1255
  userId: JSON.stringify(dataChat.currentUser.id),
1213
1256
  items: JSON.stringify(items)
1214
1257
  };
1215
- _context13.next = 4;
1216
- return (0, _handle_http.fetchPOST)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsBody);
1258
+ paramsHeaders = {
1259
+ Authorization: dataChat.userToken
1260
+ };
1261
+ _context13.next = 5;
1262
+ return (0, _handle_http.fetchPOST)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsBody, paramsHeaders);
1217
1263
 
1218
- case 4:
1264
+ case 5:
1219
1265
  response = _context13.sent;
1220
1266
 
1221
1267
  if (response.body) {
1222
- _context13.next = 7;
1268
+ _context13.next = 8;
1223
1269
  break;
1224
1270
  }
1225
1271
 
@@ -1228,7 +1274,7 @@ var ContentChat = function ContentChat(props) {
1228
1274
  errorDetail: response.errorDetail
1229
1275
  });
1230
1276
 
1231
- case 7:
1277
+ case 8:
1232
1278
  case "end":
1233
1279
  return _context13.stop();
1234
1280
  }
@@ -1320,8 +1366,8 @@ var ContentChat = function ContentChat(props) {
1320
1366
  }
1321
1367
 
1322
1368
  return Object.values(itemsId).sort(function (a, b) {
1323
- if (a.id < b.id) return 1;
1324
- if (a.id > b.id) return -1;
1369
+ if (a.id > b.id) return 1;
1370
+ if (a.id < b.id) return -1;
1325
1371
  return 0;
1326
1372
  });
1327
1373
  };
@@ -1337,13 +1383,6 @@ var ContentChat = function ContentChat(props) {
1337
1383
  setAllUsers(currentUsers);
1338
1384
  };
1339
1385
 
1340
- var stopUpdate = function stopUpdate() {
1341
- if (processUpdateID !== undefined) {
1342
- clearTimeout(processUpdateID);
1343
- setProcessUpdateID(undefined);
1344
- }
1345
- };
1346
-
1347
1386
  var renderBodyChat = function renderBodyChat() {
1348
1387
  if (isLoading) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {});
1349
1388