contentoh-components-library 21.3.18 → 21.3.19
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.
- package/.env.development +0 -5
- package/dist/assets/images/generalButton/closeIcon.svg +2 -2
- package/dist/components/atoms/GeneralInput/index.js +14 -1
- package/dist/components/atoms/ProgressBar/index.js +6 -36
- package/dist/components/atoms/ProgressBar/styles.js +3 -11
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +22 -21
- package/dist/components/molecules/CustomSelect/SelectItem.js +1 -10
- package/dist/components/molecules/HeaderTop/index.js +6 -23
- package/dist/components/molecules/HeaderTop/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +4 -6
- package/dist/components/organisms/FullProductNameHeader/index.js +0 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +50 -65
- package/dist/components/pages/ProviderProductEdition/index.js +11 -15
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +44 -36
- package/dist/components/pages/RetailerProductEdition/index.js +12 -13
- package/dist/global-files/data.js +23 -18
- package/dist/global-files/fonts.css +0 -6
- package/dist/global-files/variables.js +0 -2
- package/dist/index.js +46 -267
- package/package.json +1 -12
- package/src/assets/images/generalButton/closeIcon.svg +2 -2
- package/src/components/atoms/GeneralInput/index.js +10 -0
- package/src/components/atoms/ProgressBar/index.js +5 -40
- package/src/components/atoms/ProgressBar/styles.js +0 -24
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +12 -20
- package/src/components/molecules/CustomSelect/SelectItem.js +0 -7
- package/src/components/molecules/HeaderTop/index.js +8 -29
- package/src/components/molecules/HeaderTop/styles.js +0 -4
- package/src/components/molecules/ProductNameHeader/index.js +2 -7
- package/src/components/organisms/FullProductNameHeader/index.js +0 -1
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +49 -67
- package/src/components/pages/ProviderProductEdition/index.js +9 -16
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +46 -36
- package/src/components/pages/RetailerProductEdition/index.js +10 -14
- package/src/global-files/data.js +23 -18
- package/src/global-files/fonts.css +0 -6
- package/src/global-files/variables.js +0 -2
- package/src/index.js +0 -17
- package/dist/assets/images/customSelect/starIcon.svg +0 -14
- package/dist/assets/images/defaultImages/Spinner.gif +0 -0
- package/dist/assets/images/defaultImages/notFound.svg +0 -124
- package/dist/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -72
- package/dist/components/atoms/ButtonFileChooser/index.js +0 -110
- package/dist/components/atoms/ButtonFileChooser/styles.js +0 -20
- package/dist/components/atoms/ButtonV2/ButtonV2.stories.js +0 -66
- package/dist/components/atoms/ButtonV2/index.js +0 -110
- package/dist/components/atoms/ButtonV2/styles.js +0 -53
- package/dist/components/atoms/CustomIcon/CustomIcon.stories.js +0 -50
- package/dist/components/atoms/CustomIcon/index.js +0 -40
- package/dist/components/atoms/CustomIcon/styles.js +0 -33
- package/dist/components/atoms/IconFile/IconFile.stories.js +0 -48
- package/dist/components/atoms/IconFile/index.js +0 -249
- package/dist/components/atoms/IconFile/styles.js +0 -23
- package/dist/components/atoms/Image/Image.stories.js +0 -73
- package/dist/components/atoms/Image/index.js +0 -76
- package/dist/components/atoms/Image/styles.js +0 -43
- package/dist/components/atoms/ImageLink/ImageLink.stories.js +0 -63
- package/dist/components/atoms/ImageLink/index.js +0 -77
- package/dist/components/atoms/ImageLink/styles.js +0 -40
- package/dist/components/atoms/ImagePreview/ImagePreview.stories.js +0 -70
- package/dist/components/atoms/ImagePreview/index.js +0 -208
- package/dist/components/atoms/ImagePreview/styles.js +0 -44
- package/dist/components/atoms/InputText/InputText.stories.js +0 -60
- package/dist/components/atoms/InputText/index.js +0 -66
- package/dist/components/atoms/InputText/styles.js +0 -32
- package/dist/components/atoms/NotFound/NotFound.stories.js +0 -36
- package/dist/components/atoms/NotFound/index.js +0 -75
- package/dist/components/atoms/NotFound/styles.js +0 -20
- package/dist/components/atoms/SelectItemV2/SelectItemV2.stories.js +0 -45
- package/dist/components/atoms/SelectItemV2/index.js +0 -57
- package/dist/components/atoms/SelectItemV2/styles.js +0 -30
- package/dist/components/atoms/Tooltip/Tooltip.stories.js +0 -66
- package/dist/components/atoms/Tooltip/index.js +0 -72
- package/dist/components/atoms/Tooltip/styles.js +0 -20
- package/dist/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -66
- package/dist/components/molecules/ButtonDownloadFile/index.js +0 -179
- package/dist/components/molecules/ButtonDownloadFile/styles.js +0 -23
- package/dist/components/molecules/Dropdown/Dropdown.stories.js +0 -98
- package/dist/components/molecules/Dropdown/index.js +0 -150
- package/dist/components/molecules/Dropdown/styles.js +0 -26
- package/dist/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -82
- package/dist/components/molecules/ImageTooltip/index.js +0 -85
- package/dist/components/molecules/ImageTooltip/styles.js +0 -33
- package/dist/components/molecules/SelectV2/SelectV2.stories.js +0 -120
- package/dist/components/molecules/SelectV2/index.js +0 -306
- package/dist/components/molecules/SelectV2/styles.js +0 -42
- package/dist/components/molecules/SelectV2/test.js +0 -95
- package/dist/components/molecules/SelectV2/test.stories.js +0 -27
- package/dist/components/organisms/Chat/Chat.stories.js +0 -160
- package/dist/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -83
- package/dist/components/organisms/Chat/ChatLists/index.js +0 -160
- package/dist/components/organisms/Chat/ChatLists/styles.js +0 -29
- package/dist/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -176
- package/dist/components/organisms/Chat/ContainerItems/index.js +0 -537
- package/dist/components/organisms/Chat/ContainerItems/styles.js +0 -20
- package/dist/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -142
- package/dist/components/organisms/Chat/ContentChat/index.js +0 -1429
- package/dist/components/organisms/Chat/ContentChat/styles.js +0 -20
- package/dist/components/organisms/Chat/Footer/Footer.stories.js +0 -43
- package/dist/components/organisms/Chat/Footer/index.js +0 -976
- package/dist/components/organisms/Chat/Footer/styles.js +0 -32
- package/dist/components/organisms/Chat/Header/Header.stories.js +0 -96
- package/dist/components/organisms/Chat/Header/index.js +0 -84
- package/dist/components/organisms/Chat/Header/styles.js +0 -20
- package/dist/components/organisms/Chat/index.js +0 -253
- package/dist/components/organisms/Chat/styles.js +0 -29
- package/dist/components/organisms/Modal/Modal.stories.js +0 -66
- package/dist/components/organisms/Modal/index.js +0 -95
- package/dist/components/organisms/Modal/styles.js +0 -20
- package/dist/components/organisms/RangeCalendar/RangeCalendar.stories.js +0 -33
- package/dist/components/organisms/RangeCalendar/index.js +0 -149
- package/dist/components/organisms/RangeCalendar/styles.js +0 -27
- package/dist/global-files/handle_http.js +0 -381
- package/dist/global-files/handle_userTech.js +0 -20
- package/dist/global-files/utils.js +0 -514
- package/src/assets/images/customSelect/starIcon.svg +0 -14
- package/src/assets/images/defaultImages/Spinner.gif +0 -0
- package/src/assets/images/defaultImages/notFound.svg +0 -124
- package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +0 -47
- package/src/components/atoms/ButtonFileChooser/index.js +0 -68
- package/src/components/atoms/ButtonFileChooser/styles.js +0 -4
- package/src/components/atoms/ButtonV2/ButtonV2.stories.js +0 -53
- package/src/components/atoms/ButtonV2/index.js +0 -85
- package/src/components/atoms/ButtonV2/styles.js +0 -217
- package/src/components/atoms/CustomIcon/CustomIcon.stories.js +0 -36
- package/src/components/atoms/CustomIcon/index.js +0 -41
- package/src/components/atoms/CustomIcon/styles.js +0 -85
- package/src/components/atoms/IconFile/IconFile.stories.js +0 -35
- package/src/components/atoms/IconFile/index.js +0 -119
- package/src/components/atoms/IconFile/styles.js +0 -67
- package/src/components/atoms/Image/Image.stories.js +0 -51
- package/src/components/atoms/Image/index.js +0 -55
- package/src/components/atoms/Image/styles.js +0 -34
- package/src/components/atoms/ImageLink/ImageLink.stories.js +0 -43
- package/src/components/atoms/ImageLink/index.js +0 -57
- package/src/components/atoms/ImageLink/styles.js +0 -30
- package/src/components/atoms/ImagePreview/ImagePreview.stories.js +0 -52
- package/src/components/atoms/ImagePreview/index.js +0 -178
- package/src/components/atoms/ImagePreview/styles.js +0 -77
- package/src/components/atoms/InputText/InputText.stories.js +0 -39
- package/src/components/atoms/InputText/index.js +0 -61
- package/src/components/atoms/InputText/styles.js +0 -89
- package/src/components/atoms/NotFound/NotFound.stories.js +0 -19
- package/src/components/atoms/NotFound/index.js +0 -52
- package/src/components/atoms/NotFound/styles.js +0 -55
- package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +0 -26
- package/src/components/atoms/SelectItemV2/index.js +0 -61
- package/src/components/atoms/SelectItemV2/styles.js +0 -90
- package/src/components/atoms/Tooltip/Tooltip.stories.js +0 -51
- package/src/components/atoms/Tooltip/index.js +0 -59
- package/src/components/atoms/Tooltip/styles.js +0 -42
- package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +0 -54
- package/src/components/molecules/ButtonDownloadFile/index.js +0 -109
- package/src/components/molecules/ButtonDownloadFile/styles.js +0 -66
- package/src/components/molecules/Dropdown/Dropdown.stories.js +0 -103
- package/src/components/molecules/Dropdown/index.js +0 -150
- package/src/components/molecules/Dropdown/styles.js +0 -75
- package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +0 -68
- package/src/components/molecules/ImageTooltip/index.js +0 -63
- package/src/components/molecules/ImageTooltip/styles.js +0 -18
- package/src/components/molecules/SelectV2/SelectV2.stories.js +0 -115
- package/src/components/molecules/SelectV2/index.js +0 -357
- package/src/components/molecules/SelectV2/styles.js +0 -105
- package/src/components/molecules/SelectV2/test.js +0 -61
- package/src/components/molecules/SelectV2/test.stories.js +0 -10
- package/src/components/organisms/Chat/Chat.stories.js +0 -147
- package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +0 -65
- package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
- package/src/components/organisms/Chat/ChatLists/index.js +0 -141
- package/src/components/organisms/Chat/ChatLists/styles.js +0 -162
- package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +0 -142
- package/src/components/organisms/Chat/ContainerItems/index.js +0 -512
- package/src/components/organisms/Chat/ContainerItems/styles.js +0 -328
- package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +0 -102
- package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
- package/src/components/organisms/Chat/ContentChat/index.js +0 -897
- package/src/components/organisms/Chat/ContentChat/styles.js +0 -41
- package/src/components/organisms/Chat/Footer/Footer.stories.js +0 -22
- package/src/components/organisms/Chat/Footer/index.js +0 -661
- package/src/components/organisms/Chat/Footer/styles.js +0 -286
- package/src/components/organisms/Chat/Header/Header.stories.js +0 -66
- package/src/components/organisms/Chat/Header/index.js +0 -94
- package/src/components/organisms/Chat/Header/styles.js +0 -49
- package/src/components/organisms/Chat/index.js +0 -235
- package/src/components/organisms/Chat/styles.js +0 -42
- package/src/components/organisms/Modal/Modal.stories.js +0 -55
- package/src/components/organisms/Modal/index.js +0 -97
- package/src/components/organisms/Modal/styles.js +0 -103
- package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +0 -16
- package/src/components/organisms/RangeCalendar/index.js +0 -121
- package/src/components/organisms/RangeCalendar/styles.js +0 -883
- package/src/global-files/handle_http.js +0 -225
- package/src/global-files/handle_userTech.js +0 -7
- package/src/global-files/utils.js +0 -330
|
@@ -1,976 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.Footer = void 0;
|
|
9
|
-
|
|
10
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
-
|
|
12
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
13
|
-
|
|
14
|
-
var _createForOfIteratorHelper2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/createForOfIteratorHelper"));
|
|
15
|
-
|
|
16
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
17
|
-
|
|
18
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
19
|
-
|
|
20
|
-
var _styles = require("./styles");
|
|
21
|
-
|
|
22
|
-
var _react = require("react");
|
|
23
|
-
|
|
24
|
-
var _awsSdk = _interopRequireDefault(require("aws-sdk"));
|
|
25
|
-
|
|
26
|
-
var _uuid = require("uuid");
|
|
27
|
-
|
|
28
|
-
var _Image = require("../../../atoms/Image");
|
|
29
|
-
|
|
30
|
-
var _ImageTooltip = require("../../../molecules/ImageTooltip");
|
|
31
|
-
|
|
32
|
-
var _freeSolidSvgIcons = require("@fortawesome/free-solid-svg-icons");
|
|
33
|
-
|
|
34
|
-
var _CustomIcon = require("../../../atoms/CustomIcon");
|
|
35
|
-
|
|
36
|
-
var _ButtonV = require("../../../atoms/ButtonV2");
|
|
37
|
-
|
|
38
|
-
var _IconFile = require("../../../atoms/IconFile");
|
|
39
|
-
|
|
40
|
-
var _Modal = require("../../Modal");
|
|
41
|
-
|
|
42
|
-
var _Tooltip = require("../../../atoms/Tooltip");
|
|
43
|
-
|
|
44
|
-
var _material = require("@mui/material");
|
|
45
|
-
|
|
46
|
-
var _ButtonFileChooser = require("../../../atoms/ButtonFileChooser");
|
|
47
|
-
|
|
48
|
-
var _react2 = require("swiper/react");
|
|
49
|
-
|
|
50
|
-
require("swiper/swiper.min.css");
|
|
51
|
-
|
|
52
|
-
var _swiper = require("swiper");
|
|
53
|
-
|
|
54
|
-
var _utils = require("../../../../global-files/utils");
|
|
55
|
-
|
|
56
|
-
var _InputText = require("../../../atoms/InputText");
|
|
57
|
-
|
|
58
|
-
var _jsxRuntime = require("react/jsx-runtime");
|
|
59
|
-
|
|
60
|
-
// carrousel
|
|
61
|
-
//import "swiper/modules/free-mode/free-mode.min.css";
|
|
62
|
-
var S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
|
|
63
|
-
var REGION = "us-east-1";
|
|
64
|
-
|
|
65
|
-
_awsSdk.default.config.update({
|
|
66
|
-
accessKeyId: process.env.REACT_APP_KEY_UPLOAD_TO_S3,
|
|
67
|
-
secretAccessKey: process.env.REACT_APP_ACCESS_KEY_UPLOAD_TO_S3
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
var myBucket = new _awsSdk.default.S3({
|
|
71
|
-
params: {
|
|
72
|
-
Bucket: S3_BUCKET
|
|
73
|
-
},
|
|
74
|
-
region: REGION
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
var Footer = function Footer(props) {
|
|
78
|
-
var chatType = props.chatType,
|
|
79
|
-
dataChat = props.dataChat,
|
|
80
|
-
statusChat = props.statusChat,
|
|
81
|
-
messageDisabled = props.messageDisabled,
|
|
82
|
-
createItemsChat = props.createItemsChat,
|
|
83
|
-
errorUpdate = props.errorUpdate;
|
|
84
|
-
|
|
85
|
-
var _useState = (0, _react.useState)(""),
|
|
86
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
87
|
-
valueInputMessage = _useState2[0],
|
|
88
|
-
setValueInputMessage = _useState2[1];
|
|
89
|
-
|
|
90
|
-
var _useState3 = (0, _react.useState)([]),
|
|
91
|
-
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
92
|
-
filesPreview = _useState4[0],
|
|
93
|
-
setFilesPreview = _useState4[1];
|
|
94
|
-
|
|
95
|
-
var _useState5 = (0, _react.useState)([]),
|
|
96
|
-
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
97
|
-
filesJsxPreview = _useState6[0],
|
|
98
|
-
setFilesJsxPreview = _useState6[1];
|
|
99
|
-
|
|
100
|
-
var _useState7 = (0, _react.useState)(false),
|
|
101
|
-
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
102
|
-
btnSendFilesLoading = _useState8[0],
|
|
103
|
-
setBtnSendFilesLoading = _useState8[1];
|
|
104
|
-
|
|
105
|
-
var _useState9 = (0, _react.useState)(false),
|
|
106
|
-
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
107
|
-
btnSendMessageLoading = _useState10[0],
|
|
108
|
-
setBtnSendMessageLoading = _useState10[1];
|
|
109
|
-
|
|
110
|
-
var _useState11 = (0, _react.useState)(false),
|
|
111
|
-
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
112
|
-
btnChooserFileDisabled = _useState12[0],
|
|
113
|
-
setBtnChooserFileDisabled = _useState12[1];
|
|
114
|
-
|
|
115
|
-
var _useState13 = (0, _react.useState)(false),
|
|
116
|
-
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
117
|
-
inputMessageDisabled = _useState14[0],
|
|
118
|
-
setInputMessageDisabled = _useState14[1];
|
|
119
|
-
|
|
120
|
-
var _useState15 = (0, _react.useState)(false),
|
|
121
|
-
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
122
|
-
openPreview = _useState16[0],
|
|
123
|
-
setOpenPreview = _useState16[1];
|
|
124
|
-
|
|
125
|
-
var _useState17 = (0, _react.useState)(false),
|
|
126
|
-
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
127
|
-
toggleFocusInputMessage = _useState18[0],
|
|
128
|
-
setToggleFocusInputMessage = _useState18[1];
|
|
129
|
-
|
|
130
|
-
var _useState19 = (0, _react.useState)({
|
|
131
|
-
show: false,
|
|
132
|
-
fileName: ""
|
|
133
|
-
}),
|
|
134
|
-
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
135
|
-
tooltipFileName = _useState20[0],
|
|
136
|
-
setTooltipFileName = _useState20[1];
|
|
137
|
-
|
|
138
|
-
var _useState21 = (0, _react.useState)({
|
|
139
|
-
show: false,
|
|
140
|
-
title: "",
|
|
141
|
-
message: "",
|
|
142
|
-
errorInputMessage: false
|
|
143
|
-
}),
|
|
144
|
-
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
145
|
-
modalAlert = _useState22[0],
|
|
146
|
-
setModalAlert = _useState22[1];
|
|
147
|
-
|
|
148
|
-
var containerRef = (0, _react.useRef)();
|
|
149
|
-
var refInputTextMessage = (0, _react.useRef)();
|
|
150
|
-
(0, _react.useEffect)(function () {
|
|
151
|
-
setTooltipFileName({
|
|
152
|
-
show: false,
|
|
153
|
-
fileName: ""
|
|
154
|
-
});
|
|
155
|
-
renderFilesPreview();
|
|
156
|
-
}, [filesPreview]);
|
|
157
|
-
(0, _react.useEffect)(function () {
|
|
158
|
-
if (filesJsxPreview.length) setOpenPreview(true);else setOpenPreview(false);
|
|
159
|
-
}, [filesJsxPreview]);
|
|
160
|
-
(0, _react.useEffect)(function () {
|
|
161
|
-
refInputTextMessage.current && refInputTextMessage.current.focus();
|
|
162
|
-
}, [toggleFocusInputMessage]);
|
|
163
|
-
|
|
164
|
-
var sendFilesPreview = /*#__PURE__*/function () {
|
|
165
|
-
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
166
|
-
var files, customFiles, fileUploadRequests, _iterator, _step, file, errorMessage, fullBase64, dataBuffer, fileKey, today, paramsCreate, responseAWS, items, index, _file, valueItem, imgSize, responseError, failedFiles, errorDetailFiles;
|
|
167
|
-
|
|
168
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
169
|
-
while (1) {
|
|
170
|
-
switch (_context.prev = _context.next) {
|
|
171
|
-
case 0:
|
|
172
|
-
if (!createItemsChat) {
|
|
173
|
-
_context.next = 87;
|
|
174
|
-
break;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
files = filesPreview.slice();
|
|
178
|
-
|
|
179
|
-
if (files.length) {
|
|
180
|
-
_context.next = 5;
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
setModalAlert({
|
|
185
|
-
show: true,
|
|
186
|
-
title: "No hay ningun archivo o imagen seleccionado para enviar",
|
|
187
|
-
message: "Por favor, cargue los archivos o imagenes que quiera enviar al chat",
|
|
188
|
-
errorInputMessage: false
|
|
189
|
-
});
|
|
190
|
-
return _context.abrupt("return");
|
|
191
|
-
|
|
192
|
-
case 5:
|
|
193
|
-
disableSecondaryContainer(true); // subir archivos a AWS
|
|
194
|
-
|
|
195
|
-
customFiles = [];
|
|
196
|
-
_context.prev = 7;
|
|
197
|
-
fileUploadRequests = [];
|
|
198
|
-
_iterator = (0, _createForOfIteratorHelper2.default)(files);
|
|
199
|
-
_context.prev = 10;
|
|
200
|
-
|
|
201
|
-
_iterator.s();
|
|
202
|
-
|
|
203
|
-
case 12:
|
|
204
|
-
if ((_step = _iterator.n()).done) {
|
|
205
|
-
_context.next = 39;
|
|
206
|
-
break;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
file = _step.value;
|
|
210
|
-
errorMessage = void 0; // obtener base64
|
|
211
|
-
|
|
212
|
-
_context.next = 17;
|
|
213
|
-
return (0, _utils.getBase64)(file);
|
|
214
|
-
|
|
215
|
-
case 17:
|
|
216
|
-
fullBase64 = _context.sent;
|
|
217
|
-
|
|
218
|
-
if (!fullBase64) {
|
|
219
|
-
errorMessage = "No se pudo decodificar el archivo o imagen";
|
|
220
|
-
} // obtener buffer
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
dataBuffer = void 0;
|
|
224
|
-
if (!errorMessage) dataBuffer = (0, _utils.getDataBuffer)((0, _utils.getDataBase64)(fullBase64));
|
|
225
|
-
|
|
226
|
-
if (!dataBuffer) {
|
|
227
|
-
errorMessage = "No se pudo decodificar el archivo o imagen";
|
|
228
|
-
} // obtener la key
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
fileKey = "chat/";
|
|
232
|
-
_context.t0 = chatType;
|
|
233
|
-
_context.next = _context.t0 === "merchant_product" ? 26 : _context.t0 === "order_product" ? 28 : _context.t0 === "ticket" ? 30 : 32;
|
|
234
|
-
break;
|
|
235
|
-
|
|
236
|
-
case 26:
|
|
237
|
-
if ((0, _utils.isValidNaturalNumber)(dataChat === null || dataChat === void 0 ? void 0 : dataChat.id) && (0, _utils.isValidNaturalNumber)(dataChat === null || dataChat === void 0 ? void 0 : dataChat.version)) {
|
|
238
|
-
fileKey += "merchantArticle/".concat(dataChat.id, "-").concat(dataChat.version, "/");
|
|
239
|
-
} else {
|
|
240
|
-
errorMessage = "El ID o la version del producto no es valido";
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
return _context.abrupt("break", 33);
|
|
244
|
-
|
|
245
|
-
case 28:
|
|
246
|
-
if ((0, _utils.isValidNaturalNumber)(dataChat === null || dataChat === void 0 ? void 0 : dataChat.id) && (0, _utils.isValidNaturalNumber)(dataChat === null || dataChat === void 0 ? void 0 : dataChat.version)) {
|
|
247
|
-
fileKey += "orderArticle/".concat(dataChat.id, "-").concat(dataChat.version, "/");
|
|
248
|
-
} else {
|
|
249
|
-
errorMessage = "El ID o la version del producto no es valido";
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
return _context.abrupt("break", 33);
|
|
253
|
-
|
|
254
|
-
case 30:
|
|
255
|
-
if ((0, _utils.isValidNaturalNumber)(dataChat === null || dataChat === void 0 ? void 0 : dataChat.id)) {
|
|
256
|
-
fileKey += "ticket/".concat(dataChat.id, "/");
|
|
257
|
-
} else {
|
|
258
|
-
errorMessage = "El ID del ticket no es valido";
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
return _context.abrupt("break", 33);
|
|
262
|
-
|
|
263
|
-
case 32:
|
|
264
|
-
errorMessage = "El tipo de chat no se especifico de manera correcta";
|
|
265
|
-
|
|
266
|
-
case 33:
|
|
267
|
-
if (!errorMessage) {
|
|
268
|
-
today = new Date();
|
|
269
|
-
fileKey += "".concat((0, _uuid.v4)(), "-").concat(today.getTime(), ".").concat((0, _utils.getFileExtension)(file.name));
|
|
270
|
-
} else {
|
|
271
|
-
fileKey = undefined;
|
|
272
|
-
} // enviar file a AWS
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
customFiles.push({
|
|
276
|
-
itemType: file.type.split("/")[0] == "image" ? "img" : "file",
|
|
277
|
-
key: fileKey,
|
|
278
|
-
errorOwn: errorMessage
|
|
279
|
-
});
|
|
280
|
-
paramsCreate = {
|
|
281
|
-
ACL: "public-read",
|
|
282
|
-
Body: dataBuffer,
|
|
283
|
-
Bucket: S3_BUCKET,
|
|
284
|
-
Key: fileKey
|
|
285
|
-
};
|
|
286
|
-
fileUploadRequests.push(myBucket.putObject(paramsCreate).promise());
|
|
287
|
-
|
|
288
|
-
case 37:
|
|
289
|
-
_context.next = 12;
|
|
290
|
-
break;
|
|
291
|
-
|
|
292
|
-
case 39:
|
|
293
|
-
_context.next = 44;
|
|
294
|
-
break;
|
|
295
|
-
|
|
296
|
-
case 41:
|
|
297
|
-
_context.prev = 41;
|
|
298
|
-
_context.t1 = _context["catch"](10);
|
|
299
|
-
|
|
300
|
-
_iterator.e(_context.t1);
|
|
301
|
-
|
|
302
|
-
case 44:
|
|
303
|
-
_context.prev = 44;
|
|
304
|
-
|
|
305
|
-
_iterator.f();
|
|
306
|
-
|
|
307
|
-
return _context.finish(44);
|
|
308
|
-
|
|
309
|
-
case 47:
|
|
310
|
-
_context.next = 49;
|
|
311
|
-
return Promise.allSettled(fileUploadRequests);
|
|
312
|
-
|
|
313
|
-
case 49:
|
|
314
|
-
responseAWS = _context.sent;
|
|
315
|
-
responseAWS.forEach(function (responseFile, index) {
|
|
316
|
-
if (responseFile.status === "rejected") {
|
|
317
|
-
customFiles[index].errorAWS = responseFile.reason.message;
|
|
318
|
-
customFiles[index].uploaded = false;
|
|
319
|
-
} else {
|
|
320
|
-
customFiles[index].uploaded = true;
|
|
321
|
-
}
|
|
322
|
-
});
|
|
323
|
-
_context.next = 58;
|
|
324
|
-
break;
|
|
325
|
-
|
|
326
|
-
case 53:
|
|
327
|
-
_context.prev = 53;
|
|
328
|
-
_context.t2 = _context["catch"](7);
|
|
329
|
-
disableSecondaryContainer(false);
|
|
330
|
-
setModalAlert({
|
|
331
|
-
show: true,
|
|
332
|
-
title: "hubo un problema al subir los archivos al chat",
|
|
333
|
-
message: "".concat(_context.t2.message, "\n Reporta esto a TI"),
|
|
334
|
-
errorInputMessage: false
|
|
335
|
-
});
|
|
336
|
-
return _context.abrupt("return");
|
|
337
|
-
|
|
338
|
-
case 58:
|
|
339
|
-
// obtener las keys de los files subidos
|
|
340
|
-
items = [];
|
|
341
|
-
index = 0;
|
|
342
|
-
|
|
343
|
-
case 60:
|
|
344
|
-
if (!(index < customFiles.length)) {
|
|
345
|
-
_context.next = 73;
|
|
346
|
-
break;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
_file = customFiles[index];
|
|
350
|
-
|
|
351
|
-
if (!_file.uploaded) {
|
|
352
|
-
_context.next = 70;
|
|
353
|
-
break;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
valueItem = {
|
|
357
|
-
key: _file.key,
|
|
358
|
-
name: files[index].name
|
|
359
|
-
}; // caso imagen -> obtener width y height
|
|
360
|
-
|
|
361
|
-
if (!(_file.itemType === "img")) {
|
|
362
|
-
_context.next = 69;
|
|
363
|
-
break;
|
|
364
|
-
}
|
|
365
|
-
|
|
366
|
-
_context.next = 67;
|
|
367
|
-
return (0, _utils.getImageSize)(files[index]);
|
|
368
|
-
|
|
369
|
-
case 67:
|
|
370
|
-
imgSize = _context.sent;
|
|
371
|
-
|
|
372
|
-
if (imgSize) {
|
|
373
|
-
valueItem.width = imgSize.width;
|
|
374
|
-
valueItem.height = imgSize.height;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
case 69:
|
|
378
|
-
items.push({
|
|
379
|
-
type: _file.itemType,
|
|
380
|
-
value: JSON.stringify(valueItem)
|
|
381
|
-
});
|
|
382
|
-
|
|
383
|
-
case 70:
|
|
384
|
-
index++;
|
|
385
|
-
_context.next = 60;
|
|
386
|
-
break;
|
|
387
|
-
|
|
388
|
-
case 73:
|
|
389
|
-
if (!items.length) {
|
|
390
|
-
_context.next = 81;
|
|
391
|
-
break;
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
_context.next = 76;
|
|
395
|
-
return createItemsChat(items);
|
|
396
|
-
|
|
397
|
-
case 76:
|
|
398
|
-
responseError = _context.sent;
|
|
399
|
-
|
|
400
|
-
if (!responseError) {
|
|
401
|
-
_context.next = 81;
|
|
402
|
-
break;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
setModalAlert({
|
|
406
|
-
show: true,
|
|
407
|
-
title: responseError.message,
|
|
408
|
-
message: responseError.errorDetail,
|
|
409
|
-
errorInputMessage: false
|
|
410
|
-
});
|
|
411
|
-
disableSecondaryContainer(false);
|
|
412
|
-
return _context.abrupt("return");
|
|
413
|
-
|
|
414
|
-
case 81:
|
|
415
|
-
// obtener los errores de los files no subidos a AWS
|
|
416
|
-
failedFiles = [];
|
|
417
|
-
errorDetailFiles = "";
|
|
418
|
-
customFiles.forEach(function (file, index) {
|
|
419
|
-
if (!file.uploaded) {
|
|
420
|
-
if (failedFiles.length === 0) {
|
|
421
|
-
errorDetailFiles = "".concat(files[index].name, ":\n Error: ").concat(file.errorOwn ? file.errorOwn : file.errorAWS);
|
|
422
|
-
} else {
|
|
423
|
-
errorDetailFiles += "\n\n".concat(files[index].name, ":\n Error: ").concat(file.errorOwn ? file.errorOwn : file.errorAWS);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
failedFiles.push(files[index]);
|
|
427
|
-
}
|
|
428
|
-
});
|
|
429
|
-
|
|
430
|
-
if (failedFiles.length) {
|
|
431
|
-
setModalAlert({
|
|
432
|
-
show: true,
|
|
433
|
-
title: "".concat(failedFiles.length, "/").concat(files.length, " archivos no fueron enviados al chat"),
|
|
434
|
-
message: errorDetailFiles,
|
|
435
|
-
errorInputMessage: false
|
|
436
|
-
});
|
|
437
|
-
} // actualizar filesPreview
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
disableSecondaryContainer(false);
|
|
441
|
-
setFilesPreview(failedFiles);
|
|
442
|
-
|
|
443
|
-
case 87:
|
|
444
|
-
case "end":
|
|
445
|
-
return _context.stop();
|
|
446
|
-
}
|
|
447
|
-
}
|
|
448
|
-
}, _callee, null, [[7, 53], [10, 41, 44, 47]]);
|
|
449
|
-
}));
|
|
450
|
-
|
|
451
|
-
return function sendFilesPreview() {
|
|
452
|
-
return _ref.apply(this, arguments);
|
|
453
|
-
};
|
|
454
|
-
}();
|
|
455
|
-
|
|
456
|
-
var sendMessage = /*#__PURE__*/function () {
|
|
457
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
458
|
-
var responseError;
|
|
459
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
460
|
-
while (1) {
|
|
461
|
-
switch (_context2.prev = _context2.next) {
|
|
462
|
-
case 0:
|
|
463
|
-
if (!createItemsChat) {
|
|
464
|
-
_context2.next = 15;
|
|
465
|
-
break;
|
|
466
|
-
}
|
|
467
|
-
|
|
468
|
-
if (!(0, _utils.isStringEmpty)(valueInputMessage)) {
|
|
469
|
-
_context2.next = 5;
|
|
470
|
-
break;
|
|
471
|
-
}
|
|
472
|
-
|
|
473
|
-
setValueInputMessage("");
|
|
474
|
-
setModalAlert({
|
|
475
|
-
show: true,
|
|
476
|
-
title: "mensaje vacío",
|
|
477
|
-
message: "Por favor, especifica el mensaje que quieres enviar al chat",
|
|
478
|
-
errorInputMessage: true
|
|
479
|
-
});
|
|
480
|
-
return _context2.abrupt("return");
|
|
481
|
-
|
|
482
|
-
case 5:
|
|
483
|
-
setBtnSendMessageLoading(true);
|
|
484
|
-
setBtnChooserFileDisabled(true);
|
|
485
|
-
setInputMessageDisabled(true);
|
|
486
|
-
_context2.next = 10;
|
|
487
|
-
return createItemsChat([{
|
|
488
|
-
type: "message",
|
|
489
|
-
value: valueInputMessage.trim()
|
|
490
|
-
}]);
|
|
491
|
-
|
|
492
|
-
case 10:
|
|
493
|
-
responseError = _context2.sent;
|
|
494
|
-
setInputMessageDisabled(false);
|
|
495
|
-
setBtnSendMessageLoading(false);
|
|
496
|
-
setBtnChooserFileDisabled(false);
|
|
497
|
-
|
|
498
|
-
if (responseError) {
|
|
499
|
-
setModalAlert({
|
|
500
|
-
show: true,
|
|
501
|
-
title: responseError.message,
|
|
502
|
-
message: responseError.errorDetail,
|
|
503
|
-
errorInputMessage: true
|
|
504
|
-
});
|
|
505
|
-
} else {
|
|
506
|
-
setValueInputMessage("");
|
|
507
|
-
setToggleFocusInputMessage(function (prev) {
|
|
508
|
-
return !prev;
|
|
509
|
-
});
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
case 15:
|
|
513
|
-
case "end":
|
|
514
|
-
return _context2.stop();
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}, _callee2);
|
|
518
|
-
}));
|
|
519
|
-
|
|
520
|
-
return function sendMessage() {
|
|
521
|
-
return _ref2.apply(this, arguments);
|
|
522
|
-
};
|
|
523
|
-
}();
|
|
524
|
-
|
|
525
|
-
var disableSecondaryContainer = function disableSecondaryContainer() {
|
|
526
|
-
var disabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
527
|
-
setBtnSendFilesLoading(disabled);
|
|
528
|
-
setBtnChooserFileDisabled(disabled);
|
|
529
|
-
setOpenPreview(!disabled);
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
var deleteFile = /*#__PURE__*/function () {
|
|
533
|
-
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(index) {
|
|
534
|
-
var newFiles;
|
|
535
|
-
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
536
|
-
while (1) {
|
|
537
|
-
switch (_context3.prev = _context3.next) {
|
|
538
|
-
case 0:
|
|
539
|
-
newFiles = filesPreview.slice();
|
|
540
|
-
newFiles.splice(index, 1);
|
|
541
|
-
setFilesPreview(newFiles);
|
|
542
|
-
|
|
543
|
-
case 3:
|
|
544
|
-
case "end":
|
|
545
|
-
return _context3.stop();
|
|
546
|
-
}
|
|
547
|
-
}
|
|
548
|
-
}, _callee3);
|
|
549
|
-
}));
|
|
550
|
-
|
|
551
|
-
return function deleteFile(_x) {
|
|
552
|
-
return _ref3.apply(this, arguments);
|
|
553
|
-
};
|
|
554
|
-
}();
|
|
555
|
-
|
|
556
|
-
var renderFilesPreview = /*#__PURE__*/function () {
|
|
557
|
-
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
558
|
-
var jsxFiles, _loop, index;
|
|
559
|
-
|
|
560
|
-
return _regenerator.default.wrap(function _callee5$(_context6) {
|
|
561
|
-
while (1) {
|
|
562
|
-
switch (_context6.prev = _context6.next) {
|
|
563
|
-
case 0:
|
|
564
|
-
jsxFiles = [];
|
|
565
|
-
_loop = /*#__PURE__*/_regenerator.default.mark(function _loop(index) {
|
|
566
|
-
var _file$type;
|
|
567
|
-
|
|
568
|
-
var file, fileType, base64;
|
|
569
|
-
return _regenerator.default.wrap(function _loop$(_context5) {
|
|
570
|
-
while (1) {
|
|
571
|
-
switch (_context5.prev = _context5.next) {
|
|
572
|
-
case 0:
|
|
573
|
-
file = filesPreview[index];
|
|
574
|
-
fileType = (_file$type = file.type) === null || _file$type === void 0 ? void 0 : _file$type.split("/")[0];
|
|
575
|
-
_context5.next = 4;
|
|
576
|
-
return (0, _utils.getBase64)(file);
|
|
577
|
-
|
|
578
|
-
case 4:
|
|
579
|
-
base64 = _context5.sent;
|
|
580
|
-
jsxFiles.push( /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.SwiperSlide, {
|
|
581
|
-
className: "item-carrousel",
|
|
582
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ContainerItemCarrousel, {
|
|
583
|
-
children: [fileType === "image" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Image.Image, {
|
|
584
|
-
width: "100%",
|
|
585
|
-
className: "container-img",
|
|
586
|
-
sizeLoading: 40,
|
|
587
|
-
colorLoading: undefined,
|
|
588
|
-
src: base64,
|
|
589
|
-
componentDefault: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomIcon.CustomIcon, {
|
|
590
|
-
className: "icon-img",
|
|
591
|
-
size: 60,
|
|
592
|
-
icon: _freeSolidSvgIcons.faImage,
|
|
593
|
-
type: "pink",
|
|
594
|
-
transparent: true
|
|
595
|
-
})
|
|
596
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_IconFile.IconFile, {
|
|
597
|
-
transparent: true,
|
|
598
|
-
size: 60,
|
|
599
|
-
ext: (0, _utils.getFileExtension)(file.name)
|
|
600
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
601
|
-
className: "container-delete",
|
|
602
|
-
onMouseEnter: function onMouseEnter() {
|
|
603
|
-
setTooltipFileName({
|
|
604
|
-
show: true,
|
|
605
|
-
fileName: file.name
|
|
606
|
-
});
|
|
607
|
-
},
|
|
608
|
-
onMouseLeave: function onMouseLeave() {
|
|
609
|
-
setTooltipFileName({
|
|
610
|
-
show: false,
|
|
611
|
-
fileName: ""
|
|
612
|
-
});
|
|
613
|
-
},
|
|
614
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
615
|
-
className: "btn-delete",
|
|
616
|
-
type: "white",
|
|
617
|
-
label: "Eliminar",
|
|
618
|
-
size: 8,
|
|
619
|
-
borderType: "oval",
|
|
620
|
-
icon: _freeSolidSvgIcons.faTrash,
|
|
621
|
-
isLoading: undefined,
|
|
622
|
-
onClick: /*#__PURE__*/function () {
|
|
623
|
-
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4(event) {
|
|
624
|
-
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
625
|
-
while (1) {
|
|
626
|
-
switch (_context4.prev = _context4.next) {
|
|
627
|
-
case 0:
|
|
628
|
-
deleteFile(index);
|
|
629
|
-
|
|
630
|
-
case 1:
|
|
631
|
-
case "end":
|
|
632
|
-
return _context4.stop();
|
|
633
|
-
}
|
|
634
|
-
}
|
|
635
|
-
}, _callee4);
|
|
636
|
-
}));
|
|
637
|
-
|
|
638
|
-
return function (_x2) {
|
|
639
|
-
return _ref5.apply(this, arguments);
|
|
640
|
-
};
|
|
641
|
-
}()
|
|
642
|
-
})
|
|
643
|
-
})]
|
|
644
|
-
})
|
|
645
|
-
}, "item-" + index));
|
|
646
|
-
|
|
647
|
-
case 6:
|
|
648
|
-
case "end":
|
|
649
|
-
return _context5.stop();
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
}, _loop);
|
|
653
|
-
});
|
|
654
|
-
index = 0;
|
|
655
|
-
|
|
656
|
-
case 3:
|
|
657
|
-
if (!(index < filesPreview.length)) {
|
|
658
|
-
_context6.next = 8;
|
|
659
|
-
break;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
return _context6.delegateYield(_loop(index), "t0", 5);
|
|
663
|
-
|
|
664
|
-
case 5:
|
|
665
|
-
index++;
|
|
666
|
-
_context6.next = 3;
|
|
667
|
-
break;
|
|
668
|
-
|
|
669
|
-
case 8:
|
|
670
|
-
setFilesJsxPreview(jsxFiles);
|
|
671
|
-
|
|
672
|
-
case 9:
|
|
673
|
-
case "end":
|
|
674
|
-
return _context6.stop();
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
}, _callee5);
|
|
678
|
-
}));
|
|
679
|
-
|
|
680
|
-
return function renderFilesPreview() {
|
|
681
|
-
return _ref4.apply(this, arguments);
|
|
682
|
-
};
|
|
683
|
-
}();
|
|
684
|
-
|
|
685
|
-
var onChangeFiles = /*#__PURE__*/function () {
|
|
686
|
-
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6(selectedFiles) {
|
|
687
|
-
var newFiles;
|
|
688
|
-
return _regenerator.default.wrap(function _callee6$(_context7) {
|
|
689
|
-
while (1) {
|
|
690
|
-
switch (_context7.prev = _context7.next) {
|
|
691
|
-
case 0:
|
|
692
|
-
newFiles = filesPreview.slice();
|
|
693
|
-
newFiles = newFiles.concat(selectedFiles);
|
|
694
|
-
setFilesPreview(newFiles);
|
|
695
|
-
|
|
696
|
-
case 3:
|
|
697
|
-
case "end":
|
|
698
|
-
return _context7.stop();
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
|
-
}, _callee6);
|
|
702
|
-
}));
|
|
703
|
-
|
|
704
|
-
return function onChangeFiles(_x3) {
|
|
705
|
-
return _ref6.apply(this, arguments);
|
|
706
|
-
};
|
|
707
|
-
}();
|
|
708
|
-
|
|
709
|
-
var getErrorUpdate = function getErrorUpdate() {
|
|
710
|
-
if (errorUpdate !== null && errorUpdate !== void 0 && errorUpdate.startDate) {
|
|
711
|
-
var errorDetail = "Ultima actualización hace ";
|
|
712
|
-
|
|
713
|
-
if (errorUpdate !== null && errorUpdate !== void 0 && errorUpdate.lastDate) {
|
|
714
|
-
var msDif = errorUpdate.lastDate.getTime() - errorUpdate.startDate.getTime();
|
|
715
|
-
var minutes = Math.floor(msDif / 60000);
|
|
716
|
-
var hours = Math.floor(minutes / 60);
|
|
717
|
-
|
|
718
|
-
if (hours === 0) {
|
|
719
|
-
if (minutes === 0) errorDetail += "menos de 1 minuto";else if (minutes === 1) errorDetail += "1 minuto";else errorDetail += minutes + " minutos";
|
|
720
|
-
} else {
|
|
721
|
-
if (hours === 1) errorDetail += "1 hora con ";else errorDetail += hours + " horas con ";
|
|
722
|
-
if (minutes === 0) errorDetail += "menos de 1 minuto";else if (minutes === 1) errorDetail += "1 minuto";else errorDetail += minutes + " minutos";
|
|
723
|
-
}
|
|
724
|
-
} else {
|
|
725
|
-
errorDetail += "menos de 1 minuto";
|
|
726
|
-
} // retornar el icono
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.Tooltip, {
|
|
730
|
-
componentTooltip: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
731
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
732
|
-
className: "label-title",
|
|
733
|
-
children: "Chat desactualizado"
|
|
734
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
735
|
-
className: "label-detail",
|
|
736
|
-
children: errorDetail
|
|
737
|
-
})]
|
|
738
|
-
}),
|
|
739
|
-
className: "container-ErrorUpdate",
|
|
740
|
-
classNameTooltip: "tooltipErrorUpdate",
|
|
741
|
-
position: "topCenter",
|
|
742
|
-
addArrow: false,
|
|
743
|
-
transitionType: "zoom",
|
|
744
|
-
followCursor: false,
|
|
745
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomIcon.CustomIcon, {
|
|
746
|
-
className: "icon-errorUpdate",
|
|
747
|
-
size: 15,
|
|
748
|
-
icon: _freeSolidSvgIcons.faExclamationTriangle,
|
|
749
|
-
type: "pink",
|
|
750
|
-
transparent: true
|
|
751
|
-
})
|
|
752
|
-
});
|
|
753
|
-
} else {
|
|
754
|
-
return null;
|
|
755
|
-
}
|
|
756
|
-
};
|
|
757
|
-
|
|
758
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
759
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
760
|
-
ref: containerRef,
|
|
761
|
-
children: statusChat === "closed" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
762
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
763
|
-
className: "container-chatDisabled",
|
|
764
|
-
children: [getErrorUpdate(), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
765
|
-
className: "label-chatDisabled",
|
|
766
|
-
children: messageDisabled
|
|
767
|
-
})]
|
|
768
|
-
})
|
|
769
|
-
}) : filesJsxPreview.length === 0 ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
770
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ContainerMain, {
|
|
771
|
-
children: [getErrorUpdate(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputText.InputText, {
|
|
772
|
-
className: "input-itemMessage",
|
|
773
|
-
type: "gray",
|
|
774
|
-
transparent: true,
|
|
775
|
-
size: 13,
|
|
776
|
-
placeHolder: "Escribe aqu\xED...",
|
|
777
|
-
multiline: true,
|
|
778
|
-
maxRows: 5,
|
|
779
|
-
minRows: 1,
|
|
780
|
-
disabled: inputMessageDisabled,
|
|
781
|
-
text: valueInputMessage,
|
|
782
|
-
onChangeText: function onChangeText(newValue) {
|
|
783
|
-
return setValueInputMessage(newValue);
|
|
784
|
-
},
|
|
785
|
-
onEnter: /*#__PURE__*/function () {
|
|
786
|
-
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(event) {
|
|
787
|
-
return _regenerator.default.wrap(function _callee7$(_context8) {
|
|
788
|
-
while (1) {
|
|
789
|
-
switch (_context8.prev = _context8.next) {
|
|
790
|
-
case 0:
|
|
791
|
-
_context8.next = 2;
|
|
792
|
-
return sendMessage();
|
|
793
|
-
|
|
794
|
-
case 2:
|
|
795
|
-
return _context8.abrupt("return", _context8.sent);
|
|
796
|
-
|
|
797
|
-
case 3:
|
|
798
|
-
case "end":
|
|
799
|
-
return _context8.stop();
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
}, _callee7);
|
|
803
|
-
}));
|
|
804
|
-
|
|
805
|
-
return function (_x4) {
|
|
806
|
-
return _ref7.apply(this, arguments);
|
|
807
|
-
};
|
|
808
|
-
}(),
|
|
809
|
-
refInputText: refInputTextMessage
|
|
810
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonFileChooser.ButtonFileChooser, {
|
|
811
|
-
className: "btn-chooserFiles",
|
|
812
|
-
type: "gray",
|
|
813
|
-
transparent: true,
|
|
814
|
-
size: 18,
|
|
815
|
-
disabled: btnChooserFileDisabled,
|
|
816
|
-
showIcon: true,
|
|
817
|
-
multipleFiles: true,
|
|
818
|
-
onChangeFiles: onChangeFiles
|
|
819
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
820
|
-
className: "btn-sendMessage",
|
|
821
|
-
type: "pink",
|
|
822
|
-
size: 10,
|
|
823
|
-
borderType: "circle",
|
|
824
|
-
icon: _freeSolidSvgIcons.faArrowUp,
|
|
825
|
-
isLoading: btnSendMessageLoading,
|
|
826
|
-
onClick: /*#__PURE__*/function () {
|
|
827
|
-
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8(event) {
|
|
828
|
-
return _regenerator.default.wrap(function _callee8$(_context9) {
|
|
829
|
-
while (1) {
|
|
830
|
-
switch (_context9.prev = _context9.next) {
|
|
831
|
-
case 0:
|
|
832
|
-
_context9.next = 2;
|
|
833
|
-
return sendMessage();
|
|
834
|
-
|
|
835
|
-
case 2:
|
|
836
|
-
case "end":
|
|
837
|
-
return _context9.stop();
|
|
838
|
-
}
|
|
839
|
-
}
|
|
840
|
-
}, _callee8);
|
|
841
|
-
}));
|
|
842
|
-
|
|
843
|
-
return function (_x5) {
|
|
844
|
-
return _ref8.apply(this, arguments);
|
|
845
|
-
};
|
|
846
|
-
}()
|
|
847
|
-
})]
|
|
848
|
-
})
|
|
849
|
-
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
850
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
851
|
-
open: openPreview,
|
|
852
|
-
placement: "top-start",
|
|
853
|
-
arrow: false,
|
|
854
|
-
componentsProps: {
|
|
855
|
-
popper: {
|
|
856
|
-
className: "tooltip-previewFiles",
|
|
857
|
-
disablePortal: true
|
|
858
|
-
},
|
|
859
|
-
transition: {
|
|
860
|
-
timeout: 300
|
|
861
|
-
}
|
|
862
|
-
},
|
|
863
|
-
title: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
864
|
-
open: tooltipFileName.show,
|
|
865
|
-
placement: "top",
|
|
866
|
-
arrow: false,
|
|
867
|
-
followCursor: true,
|
|
868
|
-
TransitionComponent: _material.Fade,
|
|
869
|
-
componentsProps: {
|
|
870
|
-
popper: {
|
|
871
|
-
className: "tooltip-previewFileName",
|
|
872
|
-
disablePortal: true
|
|
873
|
-
},
|
|
874
|
-
transition: {
|
|
875
|
-
timeout: 300
|
|
876
|
-
}
|
|
877
|
-
},
|
|
878
|
-
title: /*#__PURE__*/(0, _jsxRuntime.jsx)("label", {
|
|
879
|
-
children: tooltipFileName.fileName
|
|
880
|
-
}),
|
|
881
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
882
|
-
className: "container-carrouselFiles",
|
|
883
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Swiper, {
|
|
884
|
-
spaceBetween: 5,
|
|
885
|
-
slidesPerView: "auto",
|
|
886
|
-
freeMode: true,
|
|
887
|
-
mousewheel: true,
|
|
888
|
-
keyboard: true,
|
|
889
|
-
modules: [_swiper.Mousewheel, _swiper.Keyboard, _swiper.FreeMode],
|
|
890
|
-
className: "carrousel-files",
|
|
891
|
-
children: filesJsxPreview
|
|
892
|
-
})
|
|
893
|
-
})
|
|
894
|
-
}),
|
|
895
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ContainerSecondary, {
|
|
896
|
-
children: [getErrorUpdate(), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Slide, {
|
|
897
|
-
direction: "left",
|
|
898
|
-
in: true,
|
|
899
|
-
timeout: 500,
|
|
900
|
-
container: containerRef.current,
|
|
901
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
902
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonFileChooser.ButtonFileChooser, {
|
|
903
|
-
className: "btn-chooserFiles",
|
|
904
|
-
type: "gray",
|
|
905
|
-
size: 17,
|
|
906
|
-
borderType: "circle",
|
|
907
|
-
showIcon: true,
|
|
908
|
-
disabled: btnChooserFileDisabled,
|
|
909
|
-
multipleFiles: true,
|
|
910
|
-
onChangeFiles: onChangeFiles
|
|
911
|
-
})
|
|
912
|
-
})
|
|
913
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Slide, {
|
|
914
|
-
direction: "up",
|
|
915
|
-
in: true,
|
|
916
|
-
timeout: 500,
|
|
917
|
-
container: containerRef.current,
|
|
918
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
919
|
-
className: "slide-btnSendFiles",
|
|
920
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
921
|
-
className: "btn-sendFiles",
|
|
922
|
-
type: "pink",
|
|
923
|
-
label: "Enviar archivos",
|
|
924
|
-
size: 12,
|
|
925
|
-
borderType: "oval",
|
|
926
|
-
loading: btnSendFilesLoading,
|
|
927
|
-
isLoading: btnSendFilesLoading,
|
|
928
|
-
onClick: /*#__PURE__*/function () {
|
|
929
|
-
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(event) {
|
|
930
|
-
return _regenerator.default.wrap(function _callee9$(_context10) {
|
|
931
|
-
while (1) {
|
|
932
|
-
switch (_context10.prev = _context10.next) {
|
|
933
|
-
case 0:
|
|
934
|
-
_context10.next = 2;
|
|
935
|
-
return sendFilesPreview();
|
|
936
|
-
|
|
937
|
-
case 2:
|
|
938
|
-
case "end":
|
|
939
|
-
return _context10.stop();
|
|
940
|
-
}
|
|
941
|
-
}
|
|
942
|
-
}, _callee9);
|
|
943
|
-
}));
|
|
944
|
-
|
|
945
|
-
return function (_x6) {
|
|
946
|
-
return _ref9.apply(this, arguments);
|
|
947
|
-
};
|
|
948
|
-
}()
|
|
949
|
-
})
|
|
950
|
-
})
|
|
951
|
-
})]
|
|
952
|
-
})
|
|
953
|
-
})
|
|
954
|
-
})
|
|
955
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
|
|
956
|
-
className: "container-modalAlert",
|
|
957
|
-
show: modalAlert.show,
|
|
958
|
-
title: modalAlert.title,
|
|
959
|
-
message: modalAlert.message,
|
|
960
|
-
icon: "info",
|
|
961
|
-
onClickBtnDefault: function onClickBtnDefault(event) {
|
|
962
|
-
setModalAlert(function (prev) {
|
|
963
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, prev), {}, {
|
|
964
|
-
show: false,
|
|
965
|
-
errorInputMessage: false
|
|
966
|
-
});
|
|
967
|
-
});
|
|
968
|
-
setToggleFocusInputMessage(function (prev) {
|
|
969
|
-
return !prev;
|
|
970
|
-
});
|
|
971
|
-
}
|
|
972
|
-
})]
|
|
973
|
-
});
|
|
974
|
-
};
|
|
975
|
-
|
|
976
|
-
exports.Footer = Footer;
|