contentoh-components-library 21.3.10 → 21.3.12
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/dist/components/atoms/ButtonFileChooser/index.js +25 -33
- package/dist/components/atoms/ImagePreview/index.js +0 -14
- package/dist/components/molecules/ButtonDownloadFile/index.js +2 -2
- package/dist/components/organisms/Chat/ContainerItems/index.js +15 -49
- package/dist/components/organisms/Chat/ContentChat/index.js +81 -131
- package/dist/components/organisms/Chat/Footer/index.js +25 -33
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +3 -3
- package/dist/components/pages/ProviderProductEdition/index.js +2 -2
- package/dist/global-files/handle_http.js +7 -9
- package/dist/global-files/utils.js +3 -9
- package/package.json +1 -1
- package/src/components/atoms/ButtonFileChooser/index.js +1 -2
- package/src/components/atoms/ImagePreview/index.js +0 -13
- package/src/components/molecules/ButtonDownloadFile/index.js +0 -2
- package/src/components/organisms/Chat/ContainerItems/index.js +13 -51
- package/src/components/organisms/Chat/ContentChat/index.js +6 -56
- package/src/components/organisms/Chat/Footer/index.js +0 -8
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +1 -2
- package/src/components/pages/ProviderProductEdition/index.js +1 -1
- package/src/global-files/handle_http.js +0 -6
- package/src/global-files/utils.js +1 -8
|
@@ -55,43 +55,35 @@ var ButtonFileChooser = function ButtonFileChooser(props) {
|
|
|
55
55
|
if (multipleFiles) chooser.multiple = true;
|
|
56
56
|
if (filters) chooser.accept = filters; // "image/*,text/*,application/*"
|
|
57
57
|
|
|
58
|
-
chooser.onchange = /*#__PURE__*/function () {
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
file = _step.value;
|
|
72
|
-
files.push(file);
|
|
73
|
-
}
|
|
74
|
-
} catch (err) {
|
|
75
|
-
_iterator.e(err);
|
|
76
|
-
} finally {
|
|
77
|
-
_iterator.f();
|
|
58
|
+
chooser.onchange = /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
59
|
+
var _iterator, _step, file;
|
|
60
|
+
|
|
61
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
62
|
+
while (1) {
|
|
63
|
+
switch (_context.prev = _context.next) {
|
|
64
|
+
case 0:
|
|
65
|
+
_iterator = (0, _createForOfIteratorHelper2.default)(chooser.files);
|
|
66
|
+
|
|
67
|
+
try {
|
|
68
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
69
|
+
file = _step.value;
|
|
70
|
+
files.push(file);
|
|
78
71
|
}
|
|
72
|
+
} catch (err) {
|
|
73
|
+
_iterator.e(err);
|
|
74
|
+
} finally {
|
|
75
|
+
_iterator.f();
|
|
76
|
+
}
|
|
79
77
|
|
|
80
|
-
|
|
78
|
+
onChangeFiles && onChangeFiles(files);
|
|
81
79
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
80
|
+
case 3:
|
|
81
|
+
case "end":
|
|
82
|
+
return _context.stop();
|
|
86
83
|
}
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
return function (_x) {
|
|
91
|
-
return _ref.apply(this, arguments);
|
|
92
|
-
};
|
|
93
|
-
}();
|
|
94
|
-
|
|
84
|
+
}
|
|
85
|
+
}, _callee);
|
|
86
|
+
}));
|
|
95
87
|
document.body.appendChild(chooser);
|
|
96
88
|
chooser.click();
|
|
97
89
|
document.body.removeChild(chooser);
|
|
@@ -125,20 +125,6 @@ var ImagePreview = function ImagePreview(props) {
|
|
|
125
125
|
link.click();
|
|
126
126
|
document.body.removeChild(link);
|
|
127
127
|
};
|
|
128
|
-
/* solo para hacer pruebas en modo dev
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
setTimeout(() => {
|
|
131
|
-
setLoading(false);
|
|
132
|
-
}, 5000);
|
|
133
|
-
}, []); */
|
|
134
|
-
|
|
135
|
-
/*
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
console.log("imgURL:", imgURL);
|
|
138
|
-
console.log("modalImgURL:", modalImgURL);
|
|
139
|
-
}, []);
|
|
140
|
-
*/
|
|
141
|
-
|
|
142
128
|
|
|
143
129
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
144
130
|
className: className,
|
|
@@ -128,12 +128,12 @@ var ButtonDownloadFile = function ButtonDownloadFile(props) {
|
|
|
128
128
|
borderType: borderType,
|
|
129
129
|
onMouseEnter: function onMouseEnter(event) {
|
|
130
130
|
if (!showDownload) {
|
|
131
|
-
setShowDownload(true);
|
|
131
|
+
setShowDownload(true);
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
onMouseLeave: function onMouseLeave(event) {
|
|
135
135
|
if (!loading) {
|
|
136
|
-
setShowDownload(false);
|
|
136
|
+
setShowDownload(false);
|
|
137
137
|
}
|
|
138
138
|
},
|
|
139
139
|
children: showDownload ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
@@ -81,32 +81,9 @@ var ContainerItems = function ContainerItems(props) {
|
|
|
81
81
|
setModalAlert = _useState8[1];
|
|
82
82
|
|
|
83
83
|
var containerList = (0, _react.useRef)(null);
|
|
84
|
-
/*
|
|
85
|
-
useEffect(() => {
|
|
86
|
-
//console.log("new observer");
|
|
87
|
-
const observer = new MutationObserver((mutationList) => {
|
|
88
|
-
updateScroll();
|
|
89
|
-
});
|
|
90
|
-
const itemsList = document.getElementById("ulItems");
|
|
91
|
-
const observerOptions = {
|
|
92
|
-
attributes: false,
|
|
93
|
-
childList: true,
|
|
94
|
-
subtree: false,
|
|
95
|
-
characterData: false,
|
|
96
|
-
attributeOldValue: false,
|
|
97
|
-
characterDataOldValue: false,
|
|
98
|
-
};
|
|
99
|
-
observer.observe(itemsList, observerOptions);
|
|
100
|
-
return () => {
|
|
101
|
-
observer.disconnect();
|
|
102
|
-
//console.log("remove observer");
|
|
103
|
-
};
|
|
104
|
-
}, [scrollHeight]);
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
84
|
(0, _react.useEffect)(function () {
|
|
108
85
|
if (!items) return;
|
|
109
|
-
if (
|
|
86
|
+
if (["merchant_product", "order_product"].includes(chatType)) renderItems();else if (chatType === "ticket") renderItemsTicket();else setCustomItems([]);
|
|
110
87
|
}, [items]);
|
|
111
88
|
|
|
112
89
|
var updateScroll = function updateScroll() {
|
|
@@ -115,13 +92,6 @@ var ContainerItems = function ContainerItems(props) {
|
|
|
115
92
|
if (containerScroll) {
|
|
116
93
|
var newScrollHeight = containerScroll.scrollHeight + 15;
|
|
117
94
|
var positionScroll = newScrollHeight - scrollHeight;
|
|
118
|
-
/*
|
|
119
|
-
console.log("========");
|
|
120
|
-
console.log("old:", scrollHeight);
|
|
121
|
-
console.log("new:", newScrollHeight);
|
|
122
|
-
console.log("pos:", positionScroll);
|
|
123
|
-
console.log("========");
|
|
124
|
-
*/
|
|
125
95
|
|
|
126
96
|
if (newScrollHeight !== scrollHeight) {
|
|
127
97
|
containerScroll.scrollTop = positionScroll;
|
|
@@ -213,12 +183,10 @@ var ContainerItems = function ContainerItems(props) {
|
|
|
213
183
|
var value = (0, _utils.decodeJSON)(item.value);
|
|
214
184
|
var originalImgURL = "".concat(process.env.REACT_APP_IMAGES_ENDPOINT, "/").concat(value.key); // dimensiones de la imagen a mostrar en el chat
|
|
215
185
|
|
|
216
|
-
var imgHeight = (0, _utils.getResizeImgHeight)((_value$width = value.width) !== null && _value$width !== void 0 ? _value$width : 400, (_value$height = value.height) !== null && _value$height !== void 0 ? _value$height : 400, 400);
|
|
217
|
-
|
|
186
|
+
var imgHeight = (0, _utils.getResizeImgHeight)((_value$width = value.width) !== null && _value$width !== void 0 ? _value$width : 400, (_value$height = value.height) !== null && _value$height !== void 0 ? _value$height : 400, 400);
|
|
218
187
|
var imgURL = (0, _utils.getImageURL)(process.env.REACT_APP_IMAGES_BUCKET, value.key, 400, imgHeight); // dimensiones de la imagen a mostrar en modal full
|
|
219
188
|
|
|
220
|
-
var modalImgHeight = (0, _utils.getResizeImgHeight)((_value$width2 = value.width) !== null && _value$width2 !== void 0 ? _value$width2 : screen.width, (_value$height2 = value.height) !== null && _value$height2 !== void 0 ? _value$height2 : screen.height, screen.width);
|
|
221
|
-
|
|
189
|
+
var modalImgHeight = (0, _utils.getResizeImgHeight)((_value$width2 = value.width) !== null && _value$width2 !== void 0 ? _value$width2 : screen.width, (_value$height2 = value.height) !== null && _value$height2 !== void 0 ? _value$height2 : screen.height, screen.width);
|
|
222
190
|
var modalImgURL = (0, _utils.getImageURL)(process.env.REACT_APP_IMAGES_BUCKET, value.key, screen.width, modalImgHeight);
|
|
223
191
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
224
192
|
className: "item-img",
|
|
@@ -324,7 +292,7 @@ var ContainerItems = function ContainerItems(props) {
|
|
|
324
292
|
timeout: 500,
|
|
325
293
|
container: containerList.current,
|
|
326
294
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("li", {
|
|
327
|
-
className: (ownMessage ? "own-message " : "") + (lastUserId
|
|
295
|
+
className: (ownMessage ? "own-message " : "") + (lastUserId === item.userId ? "sameUser" : ""),
|
|
328
296
|
children: [lastUserId !== item.userId && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageTooltip.ImageTooltip, {
|
|
329
297
|
className: "container-imgUser",
|
|
330
298
|
sizeLoading: 25,
|
|
@@ -377,11 +345,12 @@ var ContainerItems = function ContainerItems(props) {
|
|
|
377
345
|
// manejo de las etiquetas fechas
|
|
378
346
|
if (!date) {
|
|
379
347
|
date = (0, _utils.getFullDate)(new Date(item.date));
|
|
348
|
+
jsxItems.push(renderGrayLabel(date, "itemDate-".concat(countDate++)));
|
|
380
349
|
} else {
|
|
381
350
|
var newDate = (0, _utils.getFullDate)(new Date(item.date));
|
|
382
351
|
|
|
383
352
|
if (newDate !== date) {
|
|
384
|
-
jsxItems.push(renderGrayLabel(
|
|
353
|
+
jsxItems.push(renderGrayLabel(newDate, "itemDate-".concat(countDate++)));
|
|
385
354
|
date = newDate;
|
|
386
355
|
}
|
|
387
356
|
} // elementos que van alineados al centro
|
|
@@ -390,25 +359,25 @@ var ContainerItems = function ContainerItems(props) {
|
|
|
390
359
|
switch (item.type) {
|
|
391
360
|
case "statusArticle":
|
|
392
361
|
jsxItems.push(renderStatusArticle(item.value, "item-".concat(item.id)));
|
|
393
|
-
|
|
362
|
+
break;
|
|
394
363
|
|
|
395
364
|
case "statusService":
|
|
396
365
|
jsxItems.push(renderStatusService(item.value, "item-".concat(item.id)));
|
|
397
|
-
|
|
366
|
+
break;
|
|
398
367
|
} // acomodo del item (left o right)
|
|
399
368
|
|
|
400
369
|
|
|
401
370
|
var ownMessage = false; // CHAT MERCHANT ARTICLE
|
|
402
371
|
|
|
403
372
|
if (chatType === "merchant_product") {
|
|
404
|
-
if (currentUser.companyId
|
|
373
|
+
if (currentUser.companyId === users[item.userId].companyId) {
|
|
405
374
|
ownMessage = true;
|
|
406
375
|
}
|
|
407
376
|
} // CHAT ORDER ARTICLE
|
|
408
377
|
else if (chatType === "order_product") {
|
|
409
|
-
if (currentUser.companyId
|
|
410
|
-
if (activeCompanyId && activeCompanyId
|
|
411
|
-
if (item.userId
|
|
378
|
+
if (currentUser.companyId === users[item.userId].companyId) {
|
|
379
|
+
if (activeCompanyId && activeCompanyId === currentUser.companyId) {
|
|
380
|
+
if (item.userId === currentUser.id) {
|
|
412
381
|
ownMessage = true;
|
|
413
382
|
}
|
|
414
383
|
} else {
|
|
@@ -426,7 +395,6 @@ var ContainerItems = function ContainerItems(props) {
|
|
|
426
395
|
_iterator.f();
|
|
427
396
|
}
|
|
428
397
|
|
|
429
|
-
if (date) jsxItems.push(renderGrayLabel(date, "itemDate-".concat(countDate), "label-date"));
|
|
430
398
|
setCustomItems(jsxItems);
|
|
431
399
|
};
|
|
432
400
|
|
|
@@ -434,8 +402,7 @@ var ContainerItems = function ContainerItems(props) {
|
|
|
434
402
|
var jsxItems = [];
|
|
435
403
|
var date = undefined;
|
|
436
404
|
var countDate = 1;
|
|
437
|
-
var lastUserId = undefined; //
|
|
438
|
-
// recorrido de los items (del mas viejo al mas reciente)
|
|
405
|
+
var lastUserId = undefined; // recorrido de los items (del mas viejo al mas reciente)
|
|
439
406
|
|
|
440
407
|
for (var index = items.length - 1; index >= 0; index--) {
|
|
441
408
|
var item = items[index]; // manejo de las etiquetas fechas
|
|
@@ -472,14 +439,13 @@ var ContainerItems = function ContainerItems(props) {
|
|
|
472
439
|
} // user normal
|
|
473
440
|
else {
|
|
474
441
|
if (!(0, _handle_userTech.isUserTech)(users[item.userId].isUserTech)) {
|
|
475
|
-
if (currentUser.companyId
|
|
442
|
+
if (currentUser.companyId === users[item.userId].companyId) {
|
|
476
443
|
ownMessage = true;
|
|
477
444
|
}
|
|
478
|
-
} else if (currentUser.id
|
|
445
|
+
} else if (currentUser.id === item.userId) {
|
|
479
446
|
ownMessage = true;
|
|
480
447
|
}
|
|
481
448
|
} // renderizar tipo de item
|
|
482
|
-
//console.log(lastUserId + "<>" + item.userId);
|
|
483
449
|
|
|
484
450
|
|
|
485
451
|
jsxItems.push(getUserCreatedItem(ownMessage, item, lastUserId));
|