contentoh-components-library 21.3.34 → 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.
@@ -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,6 +204,10 @@ 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 () {
@@ -1192,9 +1204,7 @@ var ContentChat = function ContentChat(props) {
1192
1204
  id: dataChat.id,
1193
1205
  version: currentArticle.version,
1194
1206
  items: items,
1195
- orderId: dataChat.orderId,
1196
- sentCompanyId: currentUser.companyId,
1197
- receivedCompanyId: activeCompanyId
1207
+ orderId: dataChat.orderId
1198
1208
  };
1199
1209
  paramsHeaders = {
1200
1210
  Authorization: dataChat.userToken
@@ -1373,13 +1383,6 @@ var ContentChat = function ContentChat(props) {
1373
1383
  setAllUsers(currentUsers);
1374
1384
  };
1375
1385
 
1376
- var stopUpdate = function stopUpdate() {
1377
- if (processUpdateID !== undefined) {
1378
- clearTimeout(processUpdateID);
1379
- setProcessUpdateID(undefined);
1380
- }
1381
- };
1382
-
1383
1386
  var renderBodyChat = function renderBodyChat() {
1384
1387
  if (isLoading) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {});
1385
1388
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.3.34",
3
+ "version": "21.3.35",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -75,9 +75,17 @@ export const ContentChat = (props) => {
75
75
  if (processUpdateID !== undefined) clearTimeout(processUpdateID);
76
76
  };
77
77
  }, []);
78
+
79
+ const stopUpdate = () => {
80
+ if (processUpdateID !== undefined) {
81
+ clearTimeout(processUpdateID);
82
+ setProcessUpdateID(undefined);
83
+ }
84
+ };
85
+
78
86
  // al cargar el componente
79
87
  useEffect(() => {
80
- if (dataChat) {
88
+ if (dataChat && showPopUpChat) {
81
89
  stopUpdate();
82
90
  if (dataChat.code) {
83
91
  setErrorChat({
@@ -93,6 +101,9 @@ export const ContentChat = (props) => {
93
101
  else if (chatType === "order_product") getInitialOrderProduct();
94
102
  else getInitialTicket();
95
103
  }
104
+ if (!showPopUpChat) {
105
+ stopUpdate();
106
+ }
96
107
  }, [dataChat, showPopUpChat]);
97
108
 
98
109
  // comenzar temporizador del update de 20s
@@ -637,8 +648,6 @@ export const ContentChat = (props) => {
637
648
  version: currentArticle.version,
638
649
  items,
639
650
  orderId: dataChat.orderId,
640
- sentCompanyId: currentUser.companyId,
641
- receivedCompanyId: activeCompanyId,
642
651
  };
643
652
  const paramsHeaders = { Authorization: dataChat.userToken };
644
653
  const response = await fetchPOST(
@@ -762,13 +771,6 @@ export const ContentChat = (props) => {
762
771
  setAllUsers(currentUsers);
763
772
  };
764
773
 
765
- const stopUpdate = () => {
766
- if (processUpdateID !== undefined) {
767
- clearTimeout(processUpdateID);
768
- setProcessUpdateID(undefined);
769
- }
770
- };
771
-
772
774
  const renderBodyChat = () => {
773
775
  if (isLoading) return <Loading />;
774
776
  if (errorChat.existError) {
@@ -1,5 +1,5 @@
1
1
  import styled from "styled-components";
2
- import { GlobalColors, FontFamily } from "../../../../global-files/variables";
2
+ import { FontFamily } from "../../../../global-files/variables";
3
3
 
4
4
  export const Container = styled.div`
5
5
  width: 100%;