contentoh-components-library 21.3.81 → 21.3.83

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 (71) hide show
  1. package/.env.development +0 -5
  2. package/.env.production +0 -3
  3. package/dist/components/atoms/ButtonV2/styles.js +1 -1
  4. package/dist/components/atoms/Card/index.js +5 -46
  5. package/dist/components/atoms/Card/styles.js +1 -3
  6. package/dist/components/atoms/CheckBox/index.js +2 -4
  7. package/dist/components/atoms/GeneralInput/index.js +20 -24
  8. package/dist/components/atoms/InputFormatter/index.js +16 -14
  9. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  10. package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
  11. package/dist/components/molecules/HeaderTop/index.js +11 -68
  12. package/dist/components/molecules/TabsMenu/index.js +48 -22
  13. package/dist/components/molecules/TagAndInput/index.js +3 -1
  14. package/dist/components/organisms/Chat/Chat.stories.js +1 -21
  15. package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
  16. package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
  17. package/dist/components/organisms/Chat/ContentChat/index.js +200 -348
  18. package/dist/components/organisms/Chat/Footer/index.js +39 -48
  19. package/dist/components/organisms/Chat/index.js +3 -48
  20. package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
  21. package/dist/components/organisms/FullTabsMenu/index.js +12 -2
  22. package/dist/components/organisms/Modal/styles.js +1 -1
  23. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +96 -171
  24. package/dist/components/pages/ProviderProductEdition/index.js +196 -189
  25. package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
  26. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +28 -40
  27. package/dist/components/pages/RetailerProductEdition/index.js +290 -262
  28. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  29. package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
  30. package/dist/index.js +12 -51
  31. package/package.json +1 -3
  32. package/src/components/atoms/ButtonV2/styles.js +1 -1
  33. package/src/components/atoms/Card/index.js +2 -35
  34. package/src/components/atoms/Card/styles.js +5 -41
  35. package/src/components/atoms/CheckBox/index.js +0 -2
  36. package/src/components/atoms/GeneralInput/index.js +21 -20
  37. package/src/components/atoms/InputFormatter/index.js +18 -14
  38. package/src/components/atoms/InputFormatter/styles.js +1 -2
  39. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  40. package/src/components/molecules/HeaderTop/index.js +6 -52
  41. package/src/components/molecules/TabsMenu/index.js +88 -65
  42. package/src/components/molecules/TagAndInput/index.js +12 -10
  43. package/src/components/organisms/Chat/Chat.stories.js +0 -21
  44. package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
  45. package/src/components/organisms/Chat/ContainerItems/styles.js +2 -10
  46. package/src/components/organisms/Chat/ContentChat/index.js +15 -86
  47. package/src/components/organisms/Chat/Footer/index.js +0 -11
  48. package/src/components/organisms/Chat/index.js +3 -47
  49. package/src/components/organisms/FullProductNameHeader/index.js +1 -1
  50. package/src/components/organisms/FullTabsMenu/index.js +16 -4
  51. package/src/components/organisms/Modal/styles.js +1 -4
  52. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +98 -181
  53. package/src/components/pages/ProviderProductEdition/index.js +142 -134
  54. package/src/components/pages/ProviderProductEdition/styles.js +1 -5
  55. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +26 -38
  56. package/src/components/pages/RetailerProductEdition/index.js +148 -111
  57. package/src/components/pages/RetailerProductEdition/styles.js +0 -4
  58. package/src/components/pages/RetailerProductEdition/utils.js +0 -37
  59. package/src/index.js +0 -3
  60. package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
  61. package/src/components/molecules/StripeCardForm/StripeCardForm.stories.js +0 -13
  62. package/src/components/molecules/StripeCardForm/index.js +0 -42
  63. package/src/components/molecules/StripeCardForm/paymentForm.js +0 -124
  64. package/src/components/molecules/StripeCardForm/styles.js +0 -73
  65. package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +0 -12
  66. package/src/components/molecules/StripeCardSelector/index.js +0 -44
  67. package/src/components/molecules/StripeCardSelector/styles.js +0 -4
  68. package/src/components/molecules/StripeCardSelector/utils.js +0 -17
  69. package/src/components/organisms/SideModal/SideModal.stories.js +0 -23
  70. package/src/components/organisms/SideModal/index.js +0 -50
  71. package/src/components/organisms/SideModal/styles.js +0 -30
@@ -2,103 +2,126 @@ import { Container } from "./styles";
2
2
  import { TabSection } from "../../atoms/TabSection";
3
3
  import { useEffect, useState } from "react";
4
4
 
5
+
5
6
  import { Modal } from "../../organisms/Modal";
6
7
  import { ButtonV2 } from "../../atoms/ButtonV2";
7
8
 
9
+
8
10
  export const TabsMenu = ({
9
11
  tabsSections = {},
10
12
  setImagesSection,
11
13
  setActiveTab,
12
14
  activeTab,
15
+ desc,
16
+ setDesc,
17
+ fich,
18
+ setFich,
19
+ imag,
20
+ setImag,
13
21
  updatedDescriptions,
14
22
  updatedDatasheets,
15
- images,
23
+ selectedImages,
24
+ setUpdatedDescriptions,
25
+ setUpdatedDatasheets,
26
+ setSelectedImages
16
27
  }) => {
17
28
  const [sections, setSections] = useState(tabsSections);
18
29
 
19
- const [modal, setModal] = useState(false);
20
- const [cancelAccept, setCancelAccept] = useState("");
21
- const [llave, setLlave] = useState("");
22
- const [objeto, setObjeto] = useState();
30
+
31
+ const [modal, setModal] = useState(false)
32
+ const [isFirstExecution, setIsFirstExecution] = useState(true)
33
+ const [detectaTab, setDetectaTab] = useState('')
34
+ const [cancelAccept, setCancelAccept] = useState('')
35
+ const [llave, setLlave] = useState('')
36
+ const [objeto, setObjeto] = useState()
37
+
23
38
 
24
39
  const activeSection = (key, array = {}) => {
25
40
  let tempArray = {};
26
41
  setImagesSection(key === "Imágenes");
27
42
  Object.keys(array).forEach((section) => {
28
43
  tempArray[section] = section === key;
29
- if (section === key) return setActiveTab(key);
44
+ if (section === key) {
45
+ setUpdatedDatasheets([])
46
+ setUpdatedDescriptions([])
47
+ setSelectedImages([])
48
+ setDesc([])
49
+ setFich([])
50
+ setImag([])
51
+ return setActiveTab(key)
52
+ };
30
53
  });
31
54
  setSections(tempArray);
32
55
  };
33
56
 
34
- useEffect(() => {
35
- if ((cancelAccept === "Aceptar") & (llave !== "")) {
36
- setCancelAccept("");
37
- setModal(false);
38
- activeSection(llave, objeto);
39
- } else if ((cancelAccept === "Cancelar") & (llave !== "")) {
40
- setModal(false);
41
- setCancelAccept("");
42
- }
43
- }, [cancelAccept]);
57
+ useEffect(() => {
58
+ if (cancelAccept==='Aceptar' & llave!==''){
59
+ setCancelAccept('')
60
+ setModal(false)
61
+ activeSection(llave, objeto)
62
+ } else if (cancelAccept==='Cancelar' & llave!=='') {
63
+ setModal(false)
64
+ setCancelAccept('')
65
+ }
66
+ },[cancelAccept])
44
67
 
45
- const detectClickFunction = (e, key, sections) => {
68
+ function detectClickFunction (e,key,sections) {
46
69
  const targetIsTheCurrentTab = e.target.innerHTML === activeTab;
47
70
  const descriptionsWereUpdated = updatedDescriptions.length > 0;
48
71
  const datasheetWereUpdated = updatedDatasheets.length > 0;
49
- const imagesWereUpdated = images?.values?.filter((f) => !f.id)?.length > 0;
50
- const dataWereUpdated =
51
- descriptionsWereUpdated || datasheetWereUpdated || imagesWereUpdated;
72
+ const imagesWereUpdated = selectedImages.length > 0;
73
+ const dataWereUpdated = descriptionsWereUpdated || datasheetWereUpdated || imagesWereUpdated;
74
+
75
+ if (!targetIsTheCurrentTab && !dataWereUpdated ){
76
+ setLlave(key)
77
+ setObjeto(sections)
78
+ activeSection(key, sections)
79
+ }
80
+ else if(!targetIsTheCurrentTab && dataWereUpdated ){
81
+ setModal(true)
82
+ setLlave(key)
83
+ setObjeto(sections)
52
84
 
53
- if (!targetIsTheCurrentTab && !dataWereUpdated) {
54
- setLlave(key);
55
- setObjeto(sections);
56
- activeSection(key, sections);
57
- } else if (!targetIsTheCurrentTab && dataWereUpdated) {
58
- setModal(true);
59
- setLlave(key);
60
- setObjeto(sections);
61
- }
62
- };
63
85
 
86
+ }
87
+ }
64
88
  return (
65
89
  <>
66
- {activeTab && (
67
- <Modal
68
- show={modal}
69
- title="Cambios sin Guardar"
70
- message="Estás cambiando de vista y aun no guardas cambios ¿Estás seguro?"
71
- buttons={[
72
- <ButtonV2
73
- key={"btn-Cancelar"}
74
- type={"white"}
75
- label={"Cancelar"}
76
- size={12}
77
- onClick={(event) => setCancelAccept(event.target.textContent)}
78
- />,
79
- <ButtonV2
80
- key={"btn-Aceptar"}
81
- type={"pink"}
82
- label={"Aceptar"}
83
- size={12}
84
- onClick={(event) => setCancelAccept(event.target.textContent)}
85
- />,
86
- ]}
87
- />
88
- )}
90
+ {activeTab && <Modal
91
+ show={modal}
92
+ title='Cambios sin Guardar'
93
+ message= 'Estás cambiando de vista y aun no guardas cambios ¿Estás seguro?'
94
+ buttons={ [
95
+ <ButtonV2
96
+ key={"btn-Cancelar"}
97
+ type={"white"}
98
+ label={"Cancelar"}
99
+ size={12}
100
+ onClick={(event) => setCancelAccept(event.target.textContent)}
101
+ />,
102
+ <ButtonV2
103
+ key={"btn-Aceptar"}
104
+ type={"pink"}
105
+ label={"Aceptar"}
106
+ size={12}
107
+ onClick={(event) => setCancelAccept(event.target.textContent)}
108
+ />,
109
+ ]}
110
+ />
111
+ }
89
112
 
90
- <Container>
91
- {Object.keys(sections).map((key, index) => (
92
- <TabSection
93
- key={index}
94
- label={key}
95
- active={sections[key]}
96
- onClick={(e) => {
97
- detectClickFunction(e, key, sections);
98
- }}
99
- />
100
- ))}
101
- </Container>
113
+ <Container>
114
+ {Object.keys(sections).map((key, index) => (
115
+ <TabSection
116
+ key={index}
117
+ label={key}
118
+ active={sections[key]}
119
+ onClick={(e)=>{
120
+ detectClickFunction (e, key, sections)
121
+ }}
122
+ />
123
+ ))}
124
+ </Container>
102
125
  </>
103
126
  );
104
127
  };
@@ -1,6 +1,8 @@
1
1
  import { Container } from "./styles";
2
2
  import { ScreenHeader } from "../../atoms/ScreenHeader/index";
3
3
  import { GeneralInput } from "../../atoms/GeneralInput/index";
4
+ import { useEffect } from "react";
5
+ import { useState } from "react";
4
6
 
5
7
  export const TagAndInput = ({
6
8
  inputType,
@@ -30,22 +32,21 @@ export const TagAndInput = ({
30
32
  showTooltip,
31
33
  auditClass,
32
34
  }) => {
35
+
33
36
  return (
34
37
  <Container
35
38
  inputType={inputType}
36
39
  className={"input-container"}
37
40
  key={`generalTagInput-${inputType}`}
38
41
  >
39
- {label?.length && (
40
- <div className="title-container">
41
- <ScreenHeader
42
- text={label}
43
- headerType={"input-name-header"}
44
- color={color}
45
- />
46
- {showTooltip && <span className="tooltip">{label}</span>}
47
- </div>
48
- )}
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>
49
50
  <GeneralInput
50
51
  inputId={inputId}
51
52
  inputType={inputType}
@@ -73,4 +74,5 @@ export const TagAndInput = ({
73
74
  />
74
75
  </Container>
75
76
  );
77
+
76
78
  };
@@ -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;
@@ -825,11 +757,15 @@ export const ContentChat = (props) => {
825
757
  setPlaySound(false);
826
758
  }, 5000);
827
759
  }
828
- return Object.values(itemsId).sort((a, b) => {
829
- if (a.id > b.id) return 1;
830
- if (a.id < b.id) return -1;
831
- return 0;
832
- });
760
+ if (chatType !== "ticket") {
761
+ return Object.values(itemsId).sort((a, b) => {
762
+ if (a.id > b.id) return 1;
763
+ if (a.id < b.id) return -1;
764
+ return 0;
765
+ });
766
+ } else {
767
+ return Object.values(itemsId).reverse();
768
+ }
833
769
  };
834
770
 
835
771
  const updateAllUsers = (newUsers = {}) => {
@@ -869,7 +805,7 @@ export const ContentChat = (props) => {
869
805
  // mostrar chat?
870
806
  let items;
871
807
  let enabledLoadMore;
872
- if (["merchant_product", "ticket", "product_status"].includes(chatType)) {
808
+ if (["merchant_product", "ticket"].includes(chatType)) {
873
809
  items = singleChat.items;
874
810
  enabledLoadMore = singleChat.enabledLoadMore;
875
811
  }
@@ -911,9 +847,7 @@ export const ContentChat = (props) => {
911
847
  activeCompanyId={activeCompanyId}
912
848
  ticketCompany={ticketCompany}
913
849
  currentUser={
914
- ["merchant_product", "order_product", "product_status"].includes(
915
- chatType
916
- )
850
+ ["merchant_product", "order_product"].includes(chatType)
917
851
  ? currentUser
918
852
  : dataChat.currentUser
919
853
  }
@@ -952,12 +886,6 @@ export const ContentChat = (props) => {
952
886
  ? { id: dataChat.id, version: currentArticle.version }
953
887
  : chatType === "ticket"
954
888
  ? { id: dataChat.id }
955
- : chatType === "product_status"
956
- ? {
957
- id: dataChat.id,
958
- version: dataChat.version,
959
- retailerId: dataChat.retailerId,
960
- }
961
889
  : undefined
962
890
  }
963
891
  chatCompany={getChatCompany()}
@@ -1000,6 +928,7 @@ export const ContentChat = (props) => {
1000
928
  }}
1001
929
  />
1002
930
  )}
931
+
1003
932
  {/* body */}
1004
933
  {renderBodyChat()}
1005
934
  </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) {