contentoh-components-library 21.3.68 → 21.3.69

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 (82) hide show
  1. package/.env.development +4 -0
  2. package/.env.production +3 -0
  3. package/dist/components/atoms/ButtonV2/styles.js +1 -1
  4. package/dist/components/atoms/Card/index.js +47 -7
  5. package/dist/components/atoms/Card/styles.js +3 -1
  6. package/dist/components/atoms/CheckBox/index.js +4 -2
  7. package/dist/components/atoms/InputFormatter/styles.js +1 -1
  8. package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
  9. package/dist/components/molecules/HeaderTop/index.js +68 -11
  10. package/dist/components/molecules/StripeCardForm/StripeCardForm.stories.js +31 -0
  11. package/dist/components/molecules/StripeCardForm/index.js +81 -0
  12. package/dist/components/molecules/StripeCardForm/paymentForm.js +187 -0
  13. package/dist/components/molecules/StripeCardForm/styles.js +24 -0
  14. package/dist/components/molecules/StripeCardSelector/CardSelector.stories.js +30 -0
  15. package/dist/components/molecules/StripeCardSelector/index.js +103 -0
  16. package/dist/components/molecules/StripeCardSelector/styles.js +19 -0
  17. package/dist/components/molecules/StripeCardSelector/utils.js +56 -0
  18. package/dist/components/molecules/TabsMenu/index.js +128 -13
  19. package/dist/components/molecules/TagAndInput/index.js +1 -1
  20. package/dist/components/organisms/Chat/Chat.stories.js +21 -1
  21. package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
  22. package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
  23. package/dist/components/organisms/Chat/ContentChat/index.js +343 -191
  24. package/dist/components/organisms/Chat/Footer/index.js +48 -39
  25. package/dist/components/organisms/Chat/index.js +48 -3
  26. package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
  27. package/dist/components/organisms/FullTabsMenu/index.js +27 -2
  28. package/dist/components/organisms/ImageDataTable/index.js +2 -0
  29. package/dist/components/organisms/Modal/styles.js +1 -1
  30. package/dist/components/organisms/SideModal/index.js +11 -0
  31. package/dist/components/organisms/SideModal/styles.js +1 -1
  32. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +171 -96
  33. package/dist/components/pages/ProviderProductEdition/index.js +226 -184
  34. package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
  35. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +40 -28
  36. package/dist/components/pages/RetailerProductEdition/index.js +298 -273
  37. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  38. package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
  39. package/dist/index.js +51 -12
  40. package/package.json +1 -1
  41. package/src/components/atoms/ButtonV2/styles.js +1 -1
  42. package/src/components/atoms/Card/index.js +35 -2
  43. package/src/components/atoms/Card/styles.js +41 -5
  44. package/src/components/atoms/CheckBox/index.js +2 -0
  45. package/src/components/atoms/InputFormatter/styles.js +2 -1
  46. package/src/components/molecules/AvatarAndValidation/index.js +1 -1
  47. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  48. package/src/components/molecules/GalleryElement/index.js +5 -0
  49. package/src/components/molecules/HeaderTop/index.js +52 -6
  50. package/src/components/molecules/StripeCardForm/StripeCardForm.stories.js +13 -0
  51. package/src/components/molecules/StripeCardForm/index.js +33 -0
  52. package/src/components/molecules/StripeCardForm/paymentForm.js +121 -0
  53. package/src/components/molecules/StripeCardForm/styles.js +72 -0
  54. package/src/components/molecules/StripeCardSelector/CardSelector.stories.js +12 -0
  55. package/src/components/molecules/StripeCardSelector/index.js +42 -0
  56. package/src/components/molecules/StripeCardSelector/styles.js +4 -0
  57. package/src/components/molecules/StripeCardSelector/utils.js +17 -0
  58. package/src/components/molecules/TabsMenu/index.js +126 -3
  59. package/src/components/molecules/TagAndInput/index.js +12 -8
  60. package/src/components/organisms/Chat/Chat.stories.js +21 -0
  61. package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
  62. package/src/components/organisms/Chat/ContainerItems/styles.js +10 -2
  63. package/src/components/organisms/Chat/ContentChat/index.js +81 -6
  64. package/src/components/organisms/Chat/Footer/index.js +11 -0
  65. package/src/components/organisms/Chat/index.js +47 -3
  66. package/src/components/organisms/FullProductNameHeader/index.js +1 -1
  67. package/src/components/organisms/FullTabsMenu/index.js +28 -1
  68. package/src/components/organisms/ImageDataTable/index.js +3 -0
  69. package/src/components/organisms/InputGroup/index.js +4 -1
  70. package/src/components/organisms/Modal/styles.js +4 -1
  71. package/src/components/organisms/SideModal/SideModal.stories.js +23 -0
  72. package/src/components/organisms/SideModal/index.js +50 -0
  73. package/src/components/organisms/SideModal/styles.js +30 -0
  74. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +181 -98
  75. package/src/components/pages/ProviderProductEdition/index.js +163 -133
  76. package/src/components/pages/ProviderProductEdition/styles.js +5 -1
  77. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +38 -26
  78. package/src/components/pages/RetailerProductEdition/index.js +142 -135
  79. package/src/components/pages/RetailerProductEdition/styles.js +4 -0
  80. package/src/components/pages/RetailerProductEdition/utils.js +37 -0
  81. package/src/index.js +3 -0
  82. package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
@@ -0,0 +1,121 @@
1
+ import { useState } from "react";
2
+ import { PaymentFormContainer } from "./styles";
3
+ import {
4
+ useStripe,
5
+ useElements,
6
+ CardNumberElement,
7
+ CardExpiryElement,
8
+ CardCvcElement,
9
+ } from "@stripe/react-stripe-js";
10
+ import { useEffect } from "react";
11
+
12
+ export const PaymentForm = ({
13
+ labelForm = "Pago con tarjeta",
14
+ setToken,
15
+ setCard,
16
+ }) => {
17
+ const stripe = useStripe();
18
+ const elements = useElements();
19
+ const [cardName, setCardName] = useState("");
20
+ const [valuesComplete, setValuesComplete] = useState({
21
+ name: false,
22
+ number: false,
23
+ cvc: false,
24
+ exp: false,
25
+ });
26
+
27
+ const handleIputChange = (event, key) => {
28
+ const temp = { ...valuesComplete };
29
+ if (key === "name") {
30
+ temp[key] = event?.length;
31
+ setValuesComplete(temp);
32
+ } else {
33
+ temp[key] = event.complete;
34
+ setValuesComplete(temp);
35
+ }
36
+ };
37
+
38
+ /**
39
+ * Este método crea un nuevo token que será enviado a la bd para generar una nueva tarjeta
40
+ */
41
+ const createToken = async () => {
42
+ /* isNew values
43
+ 1: is new
44
+ 0: use card existing
45
+ -1: use other payment metoh */
46
+ let token = "";
47
+ token = await stripe.createToken(elements.getElement(CardNumberElement));
48
+
49
+ const { error, paymentMethod } = await stripe.createPaymentMethod({
50
+ type: "card",
51
+ card: elements.getElement(CardNumberElement),
52
+ billing_details: {
53
+ name: cardName,
54
+ },
55
+ });
56
+
57
+ try {
58
+ if (token.token) {
59
+ token = token.token.id;
60
+ } else {
61
+ setModalErrorCard(true);
62
+ setMsj(token.error.message);
63
+ }
64
+
65
+ paymentMethod.isNew = true;
66
+ setToken && setToken(token);
67
+ setCard && setCard(paymentMethod);
68
+ } catch (err) {
69
+ console.log(err, error);
70
+ }
71
+ };
72
+
73
+ useEffect(() => {
74
+ const valuesArray = Object.values(valuesComplete);
75
+ const allValuesComplete = valuesArray?.every((val) => val);
76
+
77
+ allValuesComplete ? createToken() : "le falta algo oiga";
78
+ }, [valuesComplete]);
79
+
80
+ const handleCardNameChange = (event) => {
81
+ handleIputChange(event.target.value, "name");
82
+ setCardName(event.target.value);
83
+ };
84
+
85
+ return (
86
+ <PaymentFormContainer>
87
+ <h2>{labelForm}</h2>
88
+ <div className="card-fields">
89
+ <div className="element card-name">
90
+ <label>Nombre en la tarjeta</label>
91
+ <input
92
+ className="card-input"
93
+ value={cardName}
94
+ onChange={handleCardNameChange}
95
+ />
96
+ </div>
97
+ <div className="element card-number">
98
+ <label>No. de tarjeta</label>
99
+ <CardNumberElement
100
+ className="card-input"
101
+ onChange={(e) => handleIputChange(e, "number")}
102
+ />
103
+ </div>
104
+ <div className="element expiration-date">
105
+ <label>Fecha de expiración</label>
106
+ <CardExpiryElement
107
+ className="card-input"
108
+ onChange={(e) => handleIputChange(e, "exp")}
109
+ />
110
+ </div>
111
+ <div className="element cvc-code ">
112
+ <label>CVC</label>
113
+ <CardCvcElement
114
+ className="card-input"
115
+ onChange={(e) => handleIputChange(e, "cvc")}
116
+ />
117
+ </div>
118
+ </div>
119
+ </PaymentFormContainer>
120
+ );
121
+ };
@@ -0,0 +1,72 @@
1
+ import styled from "styled-components";
2
+ import { FontFamily } from "../../../global-files/variables";
3
+
4
+ export const Container = styled.div``;
5
+
6
+ export const PaymentFormContainer = styled.form`
7
+ padding: 20px;
8
+ border: 1px solid #f0f0f0;
9
+
10
+ h2 {
11
+ font-size: 15px;
12
+ line-height: 20px;
13
+ color: #262626;
14
+ font-family: ${FontFamily.Lato};
15
+
16
+ & + * {
17
+ margin-top: 10px;
18
+ }
19
+ }
20
+
21
+ .card-fields {
22
+ display: flex;
23
+ flex-wrap: wrap;
24
+ gap: 10px;
25
+ .element {
26
+ display: flex;
27
+ align-items: center;
28
+
29
+ label {
30
+ color: #808080;
31
+ font-family: ${FontFamily.Lato};
32
+ font-size: 12px;
33
+ display: flex;
34
+
35
+ & + * {
36
+ margin-left: 6px;
37
+ }
38
+ }
39
+
40
+ .card-input {
41
+ border: 1px solid #f0f0f0 !important;
42
+ border-radius: 5px;
43
+ padding: 3px;
44
+ font-family: ${FontFamily.Lato};
45
+ font-size: 12px;
46
+ flex: 1;
47
+ }
48
+
49
+ &.card-name {
50
+ flex: 1 0 100%;
51
+ label + * {
52
+ margin-left: 6px;
53
+ }
54
+ }
55
+
56
+ &.card-number {
57
+ flex: 1 0 100%;
58
+ label + * {
59
+ margin-left: 43px;
60
+ }
61
+ }
62
+
63
+ &.expiration-date,
64
+ &.cvc-code {
65
+ flex: 1 1 49%;
66
+ label + * {
67
+ margin-left: 9px;
68
+ }
69
+ }
70
+ }
71
+ }
72
+ `;
@@ -0,0 +1,12 @@
1
+ import { CardSelector } from ".";
2
+
3
+ export default {
4
+ title: "Components/molecules/CardSelector",
5
+ component: CardSelector,
6
+ };
7
+
8
+ const Template = (args) => <CardSelector {...args} />;
9
+ export const C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aRoxCJ8ezm-wBZgUTpcD3VFuynUICbODKKHUfxVdKdVoAM6GGE6ymSbO7-0C7ZumoWEqaZ22BF4G1H-JvLkR-tL5iqXa2N-QCnNoteFmHstBfH6Sp5UZhPav1VBEGRmwdFfUnC-Xc-aNeIFwgWCXMsOXFWbbmWeh0uNF-Btu-QEJ7VkCu4pbElqHWJKBYLCx1zqDBrKrsrNxyvQlxsJ9NSOae8Q",
12
+ };
@@ -0,0 +1,42 @@
1
+ import { useState, useEffect } from "react";
2
+ import { Container } from "./styles";
3
+ import { loadStripe } from "@stripe/stripe-js";
4
+ import { Elements } from "@stripe/react-stripe-js";
5
+ import { getAllCards } from "./utils";
6
+ import { Card } from "../../atoms/Card";
7
+ import { Loading } from "../../atoms/Loading";
8
+ const stripeApiKey = loadStripe(`${process.env.REACT_APP_KEY_STRIPE}`);
9
+
10
+ export const CardSelector = ({ jwt, setCard }) => {
11
+ const [stripeLoaded, setStripeLoaded] = useState(false);
12
+ const [cards, setCards] = useState([]);
13
+ const [selectedCard, setSelectedCard] = useState("");
14
+
15
+ const loadStripeJS = async () => {
16
+ await stripeApiKey;
17
+ setStripeLoaded(true);
18
+ const cardsResponse = await getAllCards(jwt);
19
+ setCards(cardsResponse);
20
+ };
21
+ useEffect(() => {
22
+ loadStripeJS();
23
+ }, []);
24
+
25
+ return stripeLoaded ? (
26
+ <Container>
27
+ <Elements stripe={stripeApiKey}>
28
+ {cards.map((card) => (
29
+ <Card
30
+ key={card.id}
31
+ card={card}
32
+ selectedCard={selectedCard}
33
+ setSelectedCard={setSelectedCard}
34
+ setCard={setCard}
35
+ />
36
+ ))}
37
+ </Elements>
38
+ </Container>
39
+ ) : (
40
+ <Loading />
41
+ );
42
+ };
@@ -0,0 +1,4 @@
1
+ import styled from "styled-components";
2
+ import { PaymentFormContainer } from "../StripeCardForm/styles";
3
+
4
+ export const Container = styled(PaymentFormContainer)``;
@@ -0,0 +1,17 @@
1
+ import axios from "axios";
2
+
3
+ export const getAllCards = async (jwt) => {
4
+ try {
5
+ const response = await axios({
6
+ method: "get",
7
+ url: `${process.env.REACT_APP_CARDS_ENDPOINT}`,
8
+ headers: {
9
+ Authorization: jwt,
10
+ },
11
+ });
12
+ const stripeCards = JSON.parse(response.data.body).data;
13
+ return stripeCards;
14
+ } catch (error) {
15
+ console.log(error);
16
+ }
17
+ };
@@ -2,33 +2,156 @@ import { Container } from "./styles";
2
2
  import { TabSection } from "../../atoms/TabSection";
3
3
  import { useEffect, useState } from "react";
4
4
 
5
+
6
+ import { Modal } from "../../organisms/Modal";
7
+ import { ButtonV2 } from "../../atoms/ButtonV2";
8
+
9
+
5
10
  export const TabsMenu = ({
6
11
  tabsSections = {},
7
12
  setImagesSection,
8
13
  setActiveTab,
14
+ activeTab,
15
+
16
+ desc,
17
+ setDesc,
18
+ fich,
19
+ setFich,
20
+ imag,
21
+ setImag,
22
+ updatedDescriptions,
23
+ updatedDatasheets,
24
+ selectedImages,
25
+ setUpdatedDescriptions,
26
+ setUpdatedDatasheets,
27
+ setSelectedImages
9
28
  }) => {
10
29
  const [sections, setSections] = useState(tabsSections);
11
30
 
31
+
32
+ const [modal, setModal] = useState(false)
33
+ const [isFirstExecution, setIsFirstExecution] = useState(true)
34
+ const [detectaTab, setDetectaTab] = useState('')
35
+ const [cancelAccept, setCancelAccept] = useState('')
36
+ const [llave, setLlave] = useState('')
37
+ const [objeto, setObjeto] = useState()
38
+
39
+
40
+
41
+
12
42
  const activeSection = (key, array = {}) => {
13
43
  let tempArray = {};
14
44
  setImagesSection(key === "Imágenes");
15
45
  Object.keys(array).forEach((section) => {
16
46
  tempArray[section] = section === key;
17
- if (section === key) setActiveTab(key);
47
+ if (section === key) {
48
+
49
+ setUpdatedDatasheets([])
50
+ setUpdatedDescriptions([])
51
+ setSelectedImages([])
52
+ setDesc([])
53
+ setFich([])
54
+ setImag([])
55
+ return setActiveTab(key)
56
+ };
18
57
  });
19
58
  setSections(tempArray);
20
59
  };
21
60
 
61
+
62
+
63
+
64
+ //! ==========================================Daniel===========================================
65
+ {/*=============================================================================
66
+ UseEffect para poder recolectar la info
67
+ ==============================================================================*/}
68
+
69
+ useEffect(() => {
70
+ if (cancelAccept==='Aceptar' & llave!==''){
71
+ setCancelAccept('')
72
+ setModal(false)
73
+ activeSection(llave, objeto)
74
+ } else if (cancelAccept==='Cancelar' & llave!=='') {
75
+ setModal(false)
76
+ setCancelAccept('')
77
+ }
78
+ },[cancelAccept])
79
+
80
+
81
+
82
+ function detectClickFunction (e,key,sections) {
83
+
84
+
85
+ const targetIsTheCurrentTab = e.target.innerHTML === activeTab;
86
+ const descriptionsWereUpdated = updatedDescriptions.length > 0;
87
+ const datasheetWereUpdated = updatedDatasheets.length > 0;
88
+ const imagesWereUpdated = selectedImages.length > 0;
89
+ const dataWereUpdated = descriptionsWereUpdated || datasheetWereUpdated || imagesWereUpdated;
90
+
91
+ if (!targetIsTheCurrentTab && !dataWereUpdated ){
92
+ setLlave(key)
93
+ setObjeto(sections)
94
+ activeSection(key, sections)
95
+ }
96
+ else if(!targetIsTheCurrentTab && dataWereUpdated ){
97
+ setModal(true)
98
+ setLlave(key)
99
+ setObjeto(sections)
100
+
101
+
102
+ }
103
+ }
104
+
105
+
106
+
107
+
108
+ //! ==========================================Daniel===========================================
109
+
110
+
22
111
  return (
112
+ <>
113
+ {/* //! ==========================================Daniel=========================================== */ }
114
+ {/*=============================================================================
115
+ Llamado al componente para poder renderizar la alerta
116
+ ==============================================================================*/}
117
+ {activeTab && <Modal
118
+ show={modal}
119
+ title='Cambios sin Guardar'
120
+ message= 'Estás cambiando de vista y aun no guardas cambios ¿Estás seguro?'
121
+ buttons={ [
122
+ <ButtonV2
123
+ key={"btn-Cancelar"}
124
+ type={"white"}
125
+ label={"Cancelar"}
126
+ size={12}
127
+ onClick={(event) => setCancelAccept(event.target.textContent)}
128
+ />,
129
+ <ButtonV2
130
+ key={"btn-Aceptar"}
131
+ type={"pink"}
132
+ label={"Aceptar"}
133
+ size={12}
134
+ onClick={(event) => setCancelAccept(event.target.textContent)}
135
+ />,
136
+ ]}
137
+ />
138
+ }
139
+ {/*=============================================================================
140
+ Llamado al componente para poder renderizar la alerta
141
+ ==============================================================================*/}
142
+ {/* //! ==========================================Daniel=========================================== */ }
23
143
  <Container>
24
144
  {Object.keys(sections).map((key, index) => (
25
145
  <TabSection
26
146
  key={index}
27
147
  label={key}
28
148
  active={sections[key]}
29
- onClick={() => activeSection(key, sections)}
149
+ onClick={(e)=>{
150
+ detectClickFunction (e, key, sections)
151
+ }}
30
152
  />
31
153
  ))}
32
154
  </Container>
155
+ </>
33
156
  );
34
- };
157
+ };
@@ -32,20 +32,23 @@ export const TagAndInput = ({
32
32
  showTooltip,
33
33
  auditClass,
34
34
  }) => {
35
+
35
36
  return (
36
37
  <Container
37
38
  inputType={inputType}
38
39
  className={"input-container"}
39
40
  key={`generalTagInput-${inputType}`}
40
41
  >
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>
42
+ {label?.length && (
43
+ <div className="title-container">
44
+ <ScreenHeader
45
+ text={label}
46
+ headerType={"input-name-header"}
47
+ color={color}
48
+ />
49
+ {showTooltip && <span className="tooltip">{label}</span>}
50
+ </div>
51
+ )}
49
52
  <GeneralInput
50
53
  inputId={inputId}
51
54
  inputType={inputType}
@@ -73,4 +76,5 @@ export const TagAndInput = ({
73
76
  />
74
77
  </Container>
75
78
  );
79
+
76
80
  };
@@ -162,3 +162,24 @@ 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
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Q2FnSYYed9sEvAxGh_B44aIgWeDteQGeGdYhsm6rUcxgkrskywZJp9FW5VgYXuDcC5NpvomMMRy_v95UV897JzCHl__sK2Z9ahm0eczVN3tAc0GbKnlN96ZrGTQ_nmNHbuMDPQBPXH5HXZQ",
179
+ currentUser: {
180
+ id: 37,
181
+ companyId: 2,
182
+ isUserTech: false,
183
+ },
184
+ },
185
+ };
@@ -22,6 +22,7 @@ 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";
25
26
  import { isUserTech } from "../../../../global-files/handle_userTech";
26
27
  import { container } from "aws-amplify";
27
28
 
@@ -55,7 +56,10 @@ export const ContainerItems = (props) => {
55
56
 
56
57
  useEffect(() => {
57
58
  if (!items) return;
58
- if (["merchant_product", "order_product"].includes(chatType)) renderItems();
59
+ if (
60
+ ["merchant_product", "order_product", "product_status"].includes(chatType)
61
+ )
62
+ renderItems();
59
63
  else if (chatType === "ticket") renderItemsTicket();
60
64
  else setCustomItems([]);
61
65
  }, [items]);
@@ -130,6 +134,16 @@ export const ContainerItems = (props) => {
130
134
  return <label className="item-statusTicket">{item.value}</label>;
131
135
  };
132
136
 
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
+
133
147
  const renderStatusTicketNeutral = (item) => {
134
148
  return (
135
149
  <Tooltip
@@ -304,7 +318,7 @@ export const ContainerItems = (props) => {
304
318
  >
305
319
  <li
306
320
  className={
307
- (ownMessage ? "own-message " : "") +
321
+ (ownMessage && item.type !== "status" ? "own-message " : "") +
308
322
  (lastUserId === item.userId ? "sameUser" : "")
309
323
  }
310
324
  >
@@ -339,6 +353,8 @@ export const ContainerItems = (props) => {
339
353
  ? renderComment(item)
340
354
  : item.type === "img"
341
355
  ? renderImg(item)
356
+ : item.type === "status"
357
+ ? renderStatusItem(item)
342
358
  : item.type === "file"
343
359
  ? renderFile(item, ownMessage)
344
360
  : item.type === "statusTicket" &&
@@ -158,7 +158,8 @@ export const Container = styled.div`
158
158
  .item-message,
159
159
  .item-comment,
160
160
  .item-file,
161
- .item-statusTicket {
161
+ .item-statusTicket,
162
+ .item-statusItem {
162
163
  border-radius: 10px;
163
164
  padding: 10px;
164
165
  font-family: ${FontFamily.RobotoRegular}, sans-serif;
@@ -173,10 +174,17 @@ export const Container = styled.div`
173
174
  .item-file {
174
175
  background-color: #8386ee;
175
176
  }
176
- .item-statusTicket {
177
+ .item-statusTicket,
178
+ .item-statusItem {
177
179
  background-color: #85bc5b;
178
180
  }
179
181
 
182
+ .item-statusItem {
183
+ display: flex;
184
+ gap: 3px;
185
+ align-items: center;
186
+ }
187
+
180
188
  .item-message {
181
189
  &.different-company {
182
190
  border: 1px solid #e33aa9;