contentoh-components-library 21.3.28 → 21.3.30

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 (122) hide show
  1. package/.env.development +0 -3
  2. package/.env.production +3 -2
  3. package/dist/assets/images/generalButton/closeIcon.svg +2 -2
  4. package/dist/components/atoms/ProgressBar/index.js +6 -36
  5. package/dist/components/atoms/ProgressBar/styles.js +3 -11
  6. package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +22 -21
  7. package/dist/components/molecules/CustomSelect/SelectItem.js +1 -10
  8. package/dist/components/molecules/GalleryElement/index.js +1 -1
  9. package/dist/components/molecules/HeaderTop/styles.js +1 -1
  10. package/dist/components/molecules/ProductNameHeader/index.js +4 -6
  11. package/dist/components/organisms/Chat/ContainerItems/index.js +13 -2
  12. package/dist/components/organisms/FullProductNameHeader/index.js +0 -1
  13. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +50 -65
  14. package/dist/components/pages/ProviderProductEdition/index.js +11 -17
  15. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +41 -73
  16. package/dist/components/pages/RetailerProductEdition/index.js +14 -19
  17. package/dist/components/pages/RetailerProductEdition/utils.js +1 -1
  18. package/dist/global-files/data.js +23 -18
  19. package/dist/global-files/fonts.css +0 -6
  20. package/dist/global-files/variables.js +0 -2
  21. package/dist/index.js +46 -267
  22. package/package.json +1 -13
  23. package/src/assets/images/generalButton/closeIcon.svg +2 -2
  24. package/src/components/atoms/ProgressBar/index.js +5 -40
  25. package/src/components/atoms/ProgressBar/styles.js +0 -24
  26. package/src/components/molecules/CustomSelect/CustomSelect.stories.js +12 -20
  27. package/src/components/molecules/CustomSelect/SelectItem.js +0 -7
  28. package/src/components/molecules/GalleryElement/index.js +1 -1
  29. package/src/components/molecules/HeaderTop/styles.js +2 -5
  30. package/src/components/molecules/ProductNameHeader/index.js +2 -7
  31. package/src/components/organisms/FullProductNameHeader/index.js +0 -1
  32. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +49 -67
  33. package/src/components/pages/ProviderProductEdition/index.js +9 -16
  34. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +41 -78
  35. package/src/components/pages/RetailerProductEdition/index.js +20 -18
  36. package/src/components/pages/RetailerProductEdition/utils.js +1 -2
  37. package/src/global-files/data.js +23 -18
  38. package/src/global-files/fonts.css +0 -6
  39. package/src/global-files/variables.js +0 -2
  40. package/src/index.js +0 -17
  41. package/src/assets/images/customSelect/starIcon.svg +0 -14
  42. package/src/assets/images/defaultImages/Spinner.gif +0 -0
  43. package/src/assets/images/defaultImages/notFound.svg +0 -124
  44. package/src/assets/sounds/newMessage.mp3 +0 -0
  45. package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -47
  46. package/src/components/atoms/ButtonFileChooser/index.js +0 -68
  47. package/src/components/atoms/ButtonFileChooser/styles.js +0 -4
  48. package/src/components/atoms/ButtonV2/ButtonV2.stories.js +0 -53
  49. package/src/components/atoms/ButtonV2/index.js +0 -85
  50. package/src/components/atoms/ButtonV2/styles.js +0 -217
  51. package/src/components/atoms/CustomIcon/CustomIcon.stories.js +0 -36
  52. package/src/components/atoms/CustomIcon/index.js +0 -41
  53. package/src/components/atoms/CustomIcon/styles.js +0 -85
  54. package/src/components/atoms/IconFile/IconFile.stories.js +0 -35
  55. package/src/components/atoms/IconFile/index.js +0 -119
  56. package/src/components/atoms/IconFile/styles.js +0 -67
  57. package/src/components/atoms/Image/Image.stories.js +0 -51
  58. package/src/components/atoms/Image/index.js +0 -55
  59. package/src/components/atoms/Image/styles.js +0 -34
  60. package/src/components/atoms/ImageLink/ImageLink.stories.js +0 -43
  61. package/src/components/atoms/ImageLink/index.js +0 -57
  62. package/src/components/atoms/ImageLink/styles.js +0 -30
  63. package/src/components/atoms/ImagePreview/ImagePreview.stories.js +0 -52
  64. package/src/components/atoms/ImagePreview/index.js +0 -178
  65. package/src/components/atoms/ImagePreview/styles.js +0 -77
  66. package/src/components/atoms/InputText/InputText.stories.js +0 -39
  67. package/src/components/atoms/InputText/index.js +0 -61
  68. package/src/components/atoms/InputText/styles.js +0 -89
  69. package/src/components/atoms/NotFound/NotFound.stories.js +0 -19
  70. package/src/components/atoms/NotFound/index.js +0 -52
  71. package/src/components/atoms/NotFound/styles.js +0 -55
  72. package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +0 -26
  73. package/src/components/atoms/SelectItemV2/index.js +0 -61
  74. package/src/components/atoms/SelectItemV2/styles.js +0 -90
  75. package/src/components/atoms/Tooltip/Tooltip.stories.js +0 -51
  76. package/src/components/atoms/Tooltip/index.js +0 -59
  77. package/src/components/atoms/Tooltip/styles.js +0 -42
  78. package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -54
  79. package/src/components/molecules/ButtonDownloadFile/index.js +0 -109
  80. package/src/components/molecules/ButtonDownloadFile/styles.js +0 -66
  81. package/src/components/molecules/Dropdown/Dropdown.stories.js +0 -103
  82. package/src/components/molecules/Dropdown/index.js +0 -150
  83. package/src/components/molecules/Dropdown/styles.js +0 -75
  84. package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -68
  85. package/src/components/molecules/ImageTooltip/index.js +0 -63
  86. package/src/components/molecules/ImageTooltip/styles.js +0 -18
  87. package/src/components/molecules/SelectV2/SelectV2.stories.js +0 -115
  88. package/src/components/molecules/SelectV2/index.js +0 -357
  89. package/src/components/molecules/SelectV2/styles.js +0 -105
  90. package/src/components/molecules/SelectV2/test.js +0 -60
  91. package/src/components/molecules/SelectV2/test.stories.js +0 -10
  92. package/src/components/organisms/Chat/Chat.stories.js +0 -149
  93. package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -65
  94. package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
  95. package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
  96. package/src/components/organisms/Chat/ChatLists/index.js +0 -141
  97. package/src/components/organisms/Chat/ChatLists/styles.js +0 -162
  98. package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -142
  99. package/src/components/organisms/Chat/ContainerItems/index.js +0 -513
  100. package/src/components/organisms/Chat/ContainerItems/styles.js +0 -348
  101. package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -102
  102. package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
  103. package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
  104. package/src/components/organisms/Chat/ContentChat/index.js +0 -922
  105. package/src/components/organisms/Chat/ContentChat/styles.js +0 -41
  106. package/src/components/organisms/Chat/Footer/Footer.stories.js +0 -22
  107. package/src/components/organisms/Chat/Footer/index.js +0 -661
  108. package/src/components/organisms/Chat/Footer/styles.js +0 -286
  109. package/src/components/organisms/Chat/Header/Header.stories.js +0 -66
  110. package/src/components/organisms/Chat/Header/index.js +0 -93
  111. package/src/components/organisms/Chat/Header/styles.js +0 -49
  112. package/src/components/organisms/Chat/index.js +0 -238
  113. package/src/components/organisms/Chat/styles.js +0 -42
  114. package/src/components/organisms/Modal/Modal.stories.js +0 -55
  115. package/src/components/organisms/Modal/index.js +0 -97
  116. package/src/components/organisms/Modal/styles.js +0 -103
  117. package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +0 -16
  118. package/src/components/organisms/RangeCalendar/index.js +0 -121
  119. package/src/components/organisms/RangeCalendar/styles.js +0 -883
  120. package/src/global-files/handle_http.js +0 -225
  121. package/src/global-files/handle_userTech.js +0 -7
  122. package/src/global-files/utils.js +0 -330
@@ -1,661 +0,0 @@
1
- import {
2
- Container,
3
- ContainerItemCarrousel,
4
- ContainerMain,
5
- ContainerSecondary,
6
- ContainerTooltipFileName,
7
- } from "./styles";
8
- import { useEffect, useState, useRef } from "react";
9
- import AWS from "aws-sdk";
10
- import { v4 as uuidv4 } from "uuid";
11
- import { Image as CustomImage } from "../../../atoms/Image";
12
- import { ImageTooltip } from "../../../molecules/ImageTooltip";
13
- import {
14
- faArrowUp as IconSend,
15
- faImage as IconImage,
16
- faTrash as IconDelete,
17
- faExclamationTriangle as IconWarning,
18
- } from "@fortawesome/free-solid-svg-icons";
19
- import { CustomIcon } from "../../../atoms/CustomIcon";
20
- import { ButtonV2 } from "../../../atoms/ButtonV2";
21
- import { IconFile } from "../../../atoms/IconFile";
22
- import { Modal } from "../../Modal";
23
- import { Tooltip } from "../../../atoms/Tooltip";
24
- import { Fade, Tooltip as TooltipMUI, Zoom } from "@mui/material";
25
- import { ButtonFileChooser } from "../../../atoms/ButtonFileChooser";
26
- import { Slide } from "@mui/material";
27
- // carrousel
28
- import { Swiper, SwiperSlide } from "swiper/react";
29
- import "swiper/swiper.min.css";
30
- //import "swiper/modules/free-mode/free-mode.min.css";
31
- import { FreeMode, Mousewheel, Keyboard } from "swiper";
32
- import {
33
- getBase64,
34
- getDataBase64,
35
- getDataBuffer,
36
- getFileExtension,
37
- getFileName,
38
- getImageSize,
39
- isStringEmpty,
40
- isValidNaturalNumber,
41
- } from "../../../../global-files/utils";
42
- import { InputText } from "../../../atoms/InputText";
43
-
44
- const S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
45
- const REGION = "us-east-1";
46
-
47
- AWS.config.update({
48
- accessKeyId: process.env.REACT_APP_KUTS3,
49
- secretAccessKey: process.env.REACT_APP_AKUTS3,
50
- });
51
-
52
- const myBucket = new AWS.S3({
53
- params: { Bucket: S3_BUCKET },
54
- region: REGION,
55
- });
56
-
57
- export const Footer = (props) => {
58
- const {
59
- chatType, // "merchant_product" | "order_product" | "ticket"
60
- dataChat /* {
61
- caso ticket: { id }
62
- case merchant_product: { id , version }
63
- case order_product: { id , version }
64
- } */,
65
- statusChat, // string
66
- messageDisabled, // string
67
- createItemsChat, // (items) => {}
68
- errorUpdate, // { startDate , lastDate }
69
- } = props;
70
- const [valueInputMessage, setValueInputMessage] = useState("");
71
- const [filesPreview, setFilesPreview] = useState([]);
72
- const [filesJsxPreview, setFilesJsxPreview] = useState([]);
73
- const [btnSendFilesLoading, setBtnSendFilesLoading] = useState(false);
74
- const [btnSendMessageLoading, setBtnSendMessageLoading] = useState(false);
75
- const [btnChooserFileDisabled, setBtnChooserFileDisabled] = useState(false);
76
- const [inputMessageDisabled, setInputMessageDisabled] = useState(false);
77
- const [openPreview, setOpenPreview] = useState(false);
78
- const [toggleFocusInputMessage, setToggleFocusInputMessage] = useState(false);
79
- const [tooltipFileName, setTooltipFileName] = useState({
80
- show: false,
81
- fileName: "",
82
- });
83
- const [modalAlert, setModalAlert] = useState({
84
- show: false,
85
- title: "",
86
- message: "",
87
- errorInputMessage: false,
88
- });
89
- const containerRef = useRef();
90
- const refInputTextMessage = useRef();
91
-
92
- useEffect(() => {
93
- setTooltipFileName({
94
- show: false,
95
- fileName: "",
96
- });
97
- renderFilesPreview();
98
- }, [filesPreview]);
99
-
100
- useEffect(() => {
101
- if (filesJsxPreview.length) setOpenPreview(true);
102
- else setOpenPreview(false);
103
- }, [filesJsxPreview]);
104
-
105
- useEffect(() => {
106
- refInputTextMessage.current && refInputTextMessage.current.focus();
107
- }, [toggleFocusInputMessage]);
108
-
109
- const sendFilesPreview = async () => {
110
- if (createItemsChat) {
111
- const files = filesPreview.slice();
112
- if (!files.length) {
113
- setModalAlert({
114
- show: true,
115
- title: "No hay ningun archivo o imagen seleccionado para enviar",
116
- message:
117
- "Por favor, cargue los archivos o imagenes que quiera enviar al chat",
118
- errorInputMessage: false,
119
- });
120
- return;
121
- }
122
- disableSecondaryContainer(true);
123
-
124
- // subir archivos a AWS
125
- const customFiles = [];
126
- try {
127
- const fileUploadRequests = [];
128
- for (const file of files) {
129
- let errorMessage;
130
- // obtener base64
131
- const fullBase64 = await getBase64(file);
132
- if (!fullBase64) {
133
- errorMessage = "No se pudo decodificar el archivo o imagen";
134
- }
135
- // obtener buffer
136
- let dataBuffer;
137
- if (!errorMessage)
138
- dataBuffer = getDataBuffer(getDataBase64(fullBase64));
139
- if (!dataBuffer) {
140
- errorMessage = "No se pudo decodificar el archivo o imagen";
141
- }
142
- // obtener la key
143
- let fileKey = "chat/";
144
- switch (chatType) {
145
- case "merchant_product":
146
- if (
147
- isValidNaturalNumber(dataChat?.id) &&
148
- isValidNaturalNumber(dataChat?.version)
149
- ) {
150
- fileKey += `merchantArticle/${dataChat.id}-${dataChat.version}/`;
151
- } else {
152
- errorMessage = "El ID o la version del producto no es valido";
153
- }
154
- break;
155
-
156
- case "order_product":
157
- if (
158
- isValidNaturalNumber(dataChat?.id) &&
159
- isValidNaturalNumber(dataChat?.version)
160
- ) {
161
- fileKey += `orderArticle/${dataChat.id}-${dataChat.version}/`;
162
- } else {
163
- errorMessage = "El ID o la version del producto no es valido";
164
- }
165
- break;
166
-
167
- case "ticket":
168
- if (isValidNaturalNumber(dataChat?.id)) {
169
- fileKey += `ticket/${dataChat.id}/`;
170
- } else {
171
- errorMessage = "El ID del ticket no es valido";
172
- }
173
- break;
174
-
175
- default:
176
- errorMessage =
177
- "El tipo de chat no se especifico de manera correcta";
178
- }
179
- if (!errorMessage) {
180
- const today = new Date();
181
- fileKey += `${uuidv4()}-${today.getTime()}.${getFileExtension(
182
- file.name
183
- )}`;
184
- } else {
185
- fileKey = undefined;
186
- }
187
- // enviar file a AWS
188
- customFiles.push({
189
- itemType: file.type.split("/")[0] == "image" ? "img" : "file",
190
- key: fileKey,
191
- errorOwn: errorMessage,
192
- });
193
- const paramsCreate = {
194
- ACL: "public-read",
195
- Body: dataBuffer,
196
- Bucket: S3_BUCKET,
197
- Key: fileKey,
198
- };
199
- fileUploadRequests.push(myBucket.putObject(paramsCreate).promise());
200
- }
201
- const responseAWS = await Promise.allSettled(fileUploadRequests);
202
- responseAWS.forEach((responseFile, index) => {
203
- if (responseFile.status === "rejected") {
204
- customFiles[index].errorAWS = responseFile.reason.message;
205
- customFiles[index].uploaded = false;
206
- } else {
207
- customFiles[index].uploaded = true;
208
- }
209
- });
210
- } catch (err) {
211
- disableSecondaryContainer(false);
212
- setModalAlert({
213
- show: true,
214
- title: "hubo un problema al subir los archivos al chat",
215
- message: `${err.message}
216
- Reporta esto a TI`,
217
- errorInputMessage: false,
218
- });
219
- return;
220
- }
221
-
222
- // obtener las keys de los files subidos
223
- const items = [];
224
- for (let index = 0; index < customFiles.length; index++) {
225
- const file = customFiles[index];
226
- if (file.uploaded) {
227
- const valueItem = {
228
- key: file.key,
229
- name: files[index].name,
230
- };
231
- // caso imagen -> obtener width y height
232
- if (file.itemType === "img") {
233
- const imgSize = await getImageSize(files[index]);
234
- if (imgSize) {
235
- valueItem.width = imgSize.width;
236
- valueItem.height = imgSize.height;
237
- }
238
- }
239
- items.push({
240
- type: file.itemType,
241
- value: JSON.stringify(valueItem),
242
- });
243
- }
244
- }
245
-
246
- // enviar los archivos subidos en AWS a la BD
247
- if (items.length) {
248
- const responseError = await createItemsChat(items);
249
- // cuando ningun archivo se guardo en la BD
250
- if (responseError) {
251
- setModalAlert({
252
- show: true,
253
- title: responseError.message,
254
- message: responseError.errorDetail,
255
- errorInputMessage: false,
256
- });
257
- disableSecondaryContainer(false);
258
- return;
259
- }
260
- }
261
-
262
- // obtener los errores de los files no subidos a AWS
263
- const failedFiles = [];
264
- let errorDetailFiles = "";
265
- customFiles.forEach((file, index) => {
266
- if (!file.uploaded) {
267
- if (failedFiles.length === 0) {
268
- errorDetailFiles = `${files[index].name}:
269
- Error: ${file.errorOwn ? file.errorOwn : file.errorAWS}`;
270
- } else {
271
- errorDetailFiles += `${"\n\n"}${files[index].name}:
272
- Error: ${file.errorOwn ? file.errorOwn : file.errorAWS}`;
273
- }
274
- failedFiles.push(files[index]);
275
- }
276
- });
277
- if (failedFiles.length) {
278
- setModalAlert({
279
- show: true,
280
- title: `${failedFiles.length}/${files.length} archivos no fueron enviados al chat`,
281
- message: errorDetailFiles,
282
- errorInputMessage: false,
283
- });
284
- }
285
- // actualizar filesPreview
286
- disableSecondaryContainer(false);
287
- setFilesPreview(failedFiles);
288
- }
289
-
290
- /*
291
- if (file.type.split("/")[0] === "image") {
292
- if (arrayIMG.data.ext[0] === "svg") {
293
- handlerCreateItem("file", params.Key);
294
- } else handlerCreateItem("img", params.Key);
295
- } else if (
296
- file.type.split("/")[0] === "application" ||
297
- file.type.split("/")[0] === "text"
298
- ) {
299
- handlerCreateItem("file", params.Key);
300
- }
301
- */
302
- };
303
-
304
- const sendMessage = async () => {
305
- if (createItemsChat) {
306
- if (isStringEmpty(valueInputMessage)) {
307
- setValueInputMessage("");
308
- setModalAlert({
309
- show: true,
310
- title: "mensaje vacío",
311
- message:
312
- "Por favor, especifica el mensaje que quieres enviar al chat",
313
- errorInputMessage: true,
314
- });
315
- return;
316
- }
317
- setBtnSendMessageLoading(true);
318
- setBtnChooserFileDisabled(true);
319
- setInputMessageDisabled(true);
320
- const responseError = await createItemsChat([
321
- {
322
- type: "message",
323
- value: valueInputMessage.trim(),
324
- },
325
- ]);
326
- setInputMessageDisabled(false);
327
- setBtnSendMessageLoading(false);
328
- setBtnChooserFileDisabled(false);
329
- if (responseError) {
330
- setModalAlert({
331
- show: true,
332
- title: responseError.message,
333
- message: responseError.errorDetail,
334
- errorInputMessage: true,
335
- });
336
- } else {
337
- setValueInputMessage("");
338
- setToggleFocusInputMessage((prev) => !prev);
339
- }
340
- }
341
- };
342
-
343
- const disableSecondaryContainer = (disabled = false) => {
344
- setBtnSendFilesLoading(disabled);
345
- setBtnChooserFileDisabled(disabled);
346
- setOpenPreview(!disabled);
347
- };
348
-
349
- const deleteFile = async (index) => {
350
- let newFiles = filesPreview.slice();
351
- newFiles.splice(index, 1);
352
- setFilesPreview(newFiles);
353
- };
354
-
355
- const renderFilesPreview = async () => {
356
- const jsxFiles = [];
357
- for (let index = 0; index < filesPreview.length; index++) {
358
- const file = filesPreview[index];
359
- const fileType = file.type?.split("/")[0];
360
- const base64 = await getBase64(file);
361
- jsxFiles.push(
362
- <SwiperSlide className="item-carrousel" key={"item-" + index}>
363
- <ContainerItemCarrousel>
364
- {fileType === "image" ? (
365
- <CustomImage
366
- width={"100%"}
367
- className={"container-img"}
368
- sizeLoading={40}
369
- colorLoading={undefined}
370
- src={base64}
371
- componentDefault={
372
- <CustomIcon
373
- className="icon-img"
374
- size={60}
375
- icon={IconImage}
376
- type={"pink"}
377
- transparent
378
- />
379
- }
380
- />
381
- ) : (
382
- <IconFile
383
- transparent
384
- size={60}
385
- ext={getFileExtension(file.name)}
386
- />
387
- )}
388
-
389
- <div
390
- className="container-delete"
391
- onMouseEnter={() => {
392
- setTooltipFileName({
393
- show: true,
394
- fileName: file.name,
395
- });
396
- }}
397
- onMouseLeave={() => {
398
- setTooltipFileName({
399
- show: false,
400
- fileName: "",
401
- });
402
- }}
403
- >
404
- <ButtonV2
405
- className="btn-delete"
406
- type={"white"}
407
- label={"Eliminar"}
408
- size={8}
409
- borderType={"oval"}
410
- icon={IconDelete}
411
- isLoading={undefined}
412
- onClick={async (event) => {
413
- deleteFile(index);
414
- }}
415
- />
416
- </div>
417
- </ContainerItemCarrousel>
418
- </SwiperSlide>
419
- );
420
- }
421
- setFilesJsxPreview(jsxFiles);
422
- };
423
-
424
- const onChangeFiles = async (selectedFiles) => {
425
- let newFiles = filesPreview.slice();
426
- newFiles = newFiles.concat(selectedFiles);
427
- setFilesPreview(newFiles);
428
- };
429
-
430
- const getErrorUpdate = () => {
431
- if (errorUpdate?.startDate) {
432
- let errorDetail = "Ultima actualización hace ";
433
- if (errorUpdate?.lastDate) {
434
- let msDif =
435
- errorUpdate.lastDate.getTime() - errorUpdate.startDate.getTime();
436
- const minutes = Math.floor(msDif / 60000);
437
- const hours = Math.floor(minutes / 60);
438
- if (hours === 0) {
439
- if (minutes === 0) errorDetail += "menos de 1 minuto";
440
- else if (minutes === 1) errorDetail += "1 minuto";
441
- else errorDetail += minutes + " minutos";
442
- } else {
443
- if (hours === 1) errorDetail += "1 hora con ";
444
- else errorDetail += hours + " horas con ";
445
-
446
- if (minutes === 0) errorDetail += "menos de 1 minuto";
447
- else if (minutes === 1) errorDetail += "1 minuto";
448
- else errorDetail += minutes + " minutos";
449
- }
450
- } else {
451
- errorDetail += "menos de 1 minuto";
452
- }
453
- // retornar el icono
454
- return (
455
- <Tooltip
456
- componentTooltip={
457
- <div>
458
- <label className="label-title">Chat desactualizado</label>
459
- <label className="label-detail">{errorDetail}</label>
460
- </div>
461
- }
462
- className="container-ErrorUpdate"
463
- classNameTooltip="tooltipErrorUpdate"
464
- position={"topCenter"}
465
- addArrow={false}
466
- transitionType={"zoom"}
467
- followCursor={false}
468
- >
469
- <CustomIcon
470
- className="icon-errorUpdate"
471
- size={15}
472
- icon={IconWarning}
473
- type={"pink"}
474
- transparent
475
- />
476
- </Tooltip>
477
- );
478
- } else {
479
- return null;
480
- }
481
- };
482
-
483
- return (
484
- <>
485
- <Container ref={containerRef}>
486
- {statusChat === "closed" ? (
487
- <>
488
- {/* chat bloqueado */}
489
- <div className="container-chatDisabled">
490
- {/* icono de chat desactualizado */}
491
- {getErrorUpdate()}
492
-
493
- <div className="label-chatDisabled">{messageDisabled}</div>
494
- </div>
495
- </>
496
- ) : filesJsxPreview.length === 0 ? (
497
- <>
498
- {/* container del input y el btn sendTXT */}
499
- <ContainerMain>
500
- {/* icono de chat desactualizado */}
501
- {getErrorUpdate()}
502
-
503
- <InputText
504
- className="input-itemMessage"
505
- type="gray"
506
- transparent
507
- size={13}
508
- placeHolder="Escribe aquí..."
509
- multiline
510
- maxRows={5}
511
- minRows={1}
512
- disabled={inputMessageDisabled}
513
- text={valueInputMessage}
514
- onChangeText={(newValue) => setValueInputMessage(newValue)}
515
- onEnter={async (event) => await sendMessage()}
516
- refInputText={refInputTextMessage}
517
- />
518
-
519
- {/* selector de files */}
520
- <ButtonFileChooser
521
- className="btn-chooserFiles"
522
- type={"gray"}
523
- transparent
524
- size={18}
525
- disabled={btnChooserFileDisabled}
526
- showIcon={true}
527
- multipleFiles={true}
528
- onChangeFiles={onChangeFiles}
529
- />
530
-
531
- {/* boton send message */}
532
- <ButtonV2
533
- className="btn-sendMessage"
534
- type={"pink"}
535
- size={10}
536
- borderType={"circle"}
537
- icon={IconSend}
538
- isLoading={btnSendMessageLoading}
539
- onClick={async (event) => {
540
- await sendMessage();
541
- }}
542
- />
543
- </ContainerMain>
544
- </>
545
- ) : (
546
- <>
547
- {/* container para el modo previewFiles */}
548
- <TooltipMUI
549
- open={openPreview}
550
- placement={"top-start"}
551
- arrow={false}
552
- componentsProps={{
553
- popper: {
554
- className: "tooltip-previewFiles",
555
- disablePortal: true,
556
- },
557
- transition: { timeout: 300 },
558
- }}
559
- title={
560
- <TooltipMUI
561
- open={tooltipFileName.show}
562
- placement={"top"}
563
- arrow={false}
564
- followCursor={true}
565
- TransitionComponent={Fade}
566
- componentsProps={{
567
- popper: {
568
- className: "tooltip-previewFileName",
569
- disablePortal: true,
570
- },
571
- transition: { timeout: 300 },
572
- }}
573
- title={<label>{tooltipFileName.fileName}</label>}
574
- >
575
- <div className="container-carrouselFiles">
576
- <Swiper
577
- spaceBetween={5}
578
- slidesPerView={"auto"}
579
- freeMode
580
- mousewheel
581
- keyboard
582
- modules={[Mousewheel, Keyboard, FreeMode]}
583
- className="carrousel-files"
584
- >
585
- {filesJsxPreview}
586
- </Swiper>
587
- </div>
588
- </TooltipMUI>
589
- }
590
- >
591
- <ContainerSecondary>
592
- {/* icono de chat desactualizado */}
593
- {getErrorUpdate()}
594
-
595
- {/* selector de files */}
596
- <Slide
597
- direction={"left"}
598
- in={true}
599
- timeout={500}
600
- container={containerRef.current}
601
- >
602
- <div>
603
- <ButtonFileChooser
604
- className={"btn-chooserFiles"}
605
- type={"gray"}
606
- size={17}
607
- borderType="circle"
608
- showIcon={true}
609
- disabled={btnChooserFileDisabled}
610
- multipleFiles={true}
611
- onChangeFiles={onChangeFiles}
612
- />
613
- </div>
614
- </Slide>
615
-
616
- {/* boton send files */}
617
- <Slide
618
- direction={"up"}
619
- in={true}
620
- timeout={500}
621
- container={containerRef.current}
622
- >
623
- <div className="slide-btnSendFiles">
624
- <ButtonV2
625
- className="btn-sendFiles"
626
- type={"pink"}
627
- label={"Enviar archivos"}
628
- size={12}
629
- borderType={"oval"}
630
- loading={btnSendFilesLoading}
631
- isLoading={btnSendFilesLoading}
632
- onClick={async (event) => {
633
- await sendFilesPreview();
634
- }}
635
- />
636
- </div>
637
- </Slide>
638
- </ContainerSecondary>
639
- </TooltipMUI>
640
- </>
641
- )}
642
- </Container>
643
-
644
- <Modal
645
- className="container-modalAlert"
646
- show={modalAlert.show}
647
- title={modalAlert.title}
648
- message={modalAlert.message}
649
- icon={"info"}
650
- onClickBtnDefault={(event) => {
651
- setModalAlert((prev) => ({
652
- ...prev,
653
- show: false,
654
- errorInputMessage: false,
655
- }));
656
- setToggleFocusInputMessage((prev) => !prev);
657
- }}
658
- />
659
- </>
660
- );
661
- };