contentoh-components-library 21.3.11 → 21.3.13
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/ButtonFileChooser/index.js +25 -33
- package/dist/components/atoms/ImagePreview/index.js +0 -14
- package/dist/components/atoms/ProgressBar/index.js +6 -36
- package/dist/components/atoms/ProgressBar/styles.js +3 -11
- package/dist/components/molecules/ButtonDownloadFile/index.js +2 -2
- 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/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/organisms/FullProductNameHeader/index.js +0 -1
- package/dist/components/pages/Dashboard/index.js +21 -13
- 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 +86 -60
- package/dist/components/pages/RetailerProductEdition/index.js +12 -13
- package/dist/global-files/fonts.css +0 -6
- package/dist/global-files/handle_http.js +7 -9
- package/dist/global-files/utils.js +3 -9
- 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/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/Dashboard/index.js +37 -31
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +49 -67
- package/src/components/pages/ProviderProductEdition/index.js +7 -16
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +85 -62
- package/src/components/pages/RetailerProductEdition/index.js +10 -12
- package/src/global-files/fonts.css +0 -6
- package/src/global-files/variables.js +0 -2
- package/src/index.js +0 -17
- 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 -69
- 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 -191
- 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 -111
- 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 -550
- 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 -947
- 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 -669
- 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 -231
- package/src/global-files/handle_userTech.js +0 -7
- package/src/global-files/utils.js +0 -322
|
@@ -165,7 +165,6 @@ var ContentChat = function ContentChat(props) {
|
|
|
165
165
|
|
|
166
166
|
(0, _react.useEffect)(function () {
|
|
167
167
|
return function () {
|
|
168
|
-
console.log("componente chat desmontado");
|
|
169
168
|
if (processUpdateID !== undefined) clearTimeout(processUpdateID);
|
|
170
169
|
};
|
|
171
170
|
}, []); // al cargar el componente
|
|
@@ -192,9 +191,8 @@ var ContentChat = function ContentChat(props) {
|
|
|
192
191
|
(0, _react.useEffect)(function () {
|
|
193
192
|
//return; -- descomentarizar para hacer pruebas sin update
|
|
194
193
|
if (startUpdate == 0) return;
|
|
195
|
-
console.log("START UPDATE en 5s");
|
|
196
194
|
var processID = setTimeout(function () {
|
|
197
|
-
console.log("update");
|
|
195
|
+
console.log("update chat execute");
|
|
198
196
|
setRunUpdate(function (prev) {
|
|
199
197
|
return prev + 1;
|
|
200
198
|
});
|
|
@@ -256,7 +254,6 @@ var ContentChat = function ContentChat(props) {
|
|
|
256
254
|
|
|
257
255
|
case 9:
|
|
258
256
|
// success
|
|
259
|
-
console.log(response.body);
|
|
260
257
|
setCurrentUser({
|
|
261
258
|
id: response.body.data.currentUserId,
|
|
262
259
|
companyId: response.body.data.currentCompanyId
|
|
@@ -272,7 +269,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
272
269
|
});
|
|
273
270
|
setIsLoading(false);
|
|
274
271
|
|
|
275
|
-
case
|
|
272
|
+
case 15:
|
|
276
273
|
case "end":
|
|
277
274
|
return _context.stop();
|
|
278
275
|
}
|
|
@@ -329,7 +326,6 @@ var ContentChat = function ContentChat(props) {
|
|
|
329
326
|
|
|
330
327
|
case 11:
|
|
331
328
|
// success
|
|
332
|
-
console.log(response.body);
|
|
333
329
|
setCurrentUser({
|
|
334
330
|
id: response.body.data.currentUserId,
|
|
335
331
|
companyId: response.body.data.currentCompanyId
|
|
@@ -360,9 +356,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
360
356
|
|
|
361
357
|
if (!companyActive && companiesIdList.length) {
|
|
362
358
|
companyActive = Number(companiesIdList[0]);
|
|
363
|
-
}
|
|
364
|
-
//console.log("companyActive: ", companyActive);
|
|
365
|
-
|
|
359
|
+
}
|
|
366
360
|
|
|
367
361
|
setCompanies(companiesList);
|
|
368
362
|
if (companyActive) setActiveCompanyId(companyActive);
|
|
@@ -371,7 +365,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
371
365
|
});
|
|
372
366
|
setIsLoading(false);
|
|
373
367
|
|
|
374
|
-
case
|
|
368
|
+
case 23:
|
|
375
369
|
case "end":
|
|
376
370
|
return _context2.stop();
|
|
377
371
|
}
|
|
@@ -393,7 +387,6 @@ var ContentChat = function ContentChat(props) {
|
|
|
393
387
|
while (1) {
|
|
394
388
|
switch (_context3.prev = _context3.next) {
|
|
395
389
|
case 0:
|
|
396
|
-
console.log("\n======== INITIAL chat =======");
|
|
397
390
|
stopUpdate(); // finalizamos el temporizador
|
|
398
391
|
|
|
399
392
|
dataUser = {
|
|
@@ -401,27 +394,18 @@ var ContentChat = function ContentChat(props) {
|
|
|
401
394
|
companyId: (_dataChat$currentUser2 = dataChat.currentUser) === null || _dataChat$currentUser2 === void 0 ? void 0 : _dataChat$currentUser2.companyId,
|
|
402
395
|
isUserTech: (_dataChat$currentUser3 = dataChat.currentUser) === null || _dataChat$currentUser3 === void 0 ? void 0 : _dataChat$currentUser3.isUserTech
|
|
403
396
|
};
|
|
404
|
-
/*
|
|
405
|
-
console.log("values send query:", {
|
|
406
|
-
id: dataChat.id,
|
|
407
|
-
getType: "initial",
|
|
408
|
-
currentUser: dataUser,
|
|
409
|
-
currentItemsFront: getItemsIdSingleChat(),
|
|
410
|
-
});
|
|
411
|
-
*/
|
|
412
|
-
|
|
413
397
|
paramsQuery = {
|
|
414
398
|
id: JSON.stringify(dataChat.id),
|
|
415
399
|
getType: "initial",
|
|
416
400
|
currentUser: (0, _utils.encodeUriJson)(dataUser),
|
|
417
401
|
currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
|
|
418
402
|
};
|
|
419
|
-
_context3.next =
|
|
403
|
+
_context3.next = 5;
|
|
420
404
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
|
|
421
405
|
Authorization: (_dataChat$currentUser4 = dataChat.currentUser) === null || _dataChat$currentUser4 === void 0 ? void 0 : _dataChat$currentUser4.token
|
|
422
406
|
});
|
|
423
407
|
|
|
424
|
-
case
|
|
408
|
+
case 5:
|
|
425
409
|
response = _context3.sent;
|
|
426
410
|
// programar update en 20s
|
|
427
411
|
setStartUpdate(function (prev) {
|
|
@@ -429,7 +413,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
429
413
|
});
|
|
430
414
|
|
|
431
415
|
if (response.body) {
|
|
432
|
-
_context3.next =
|
|
416
|
+
_context3.next = 11;
|
|
433
417
|
break;
|
|
434
418
|
}
|
|
435
419
|
|
|
@@ -442,9 +426,8 @@ var ContentChat = function ContentChat(props) {
|
|
|
442
426
|
setIsLoading(false);
|
|
443
427
|
return _context3.abrupt("return");
|
|
444
428
|
|
|
445
|
-
case
|
|
429
|
+
case 11:
|
|
446
430
|
// success
|
|
447
|
-
console.log("response initial:", response.body);
|
|
448
431
|
setLastUpdateDate(response.body.data.lastUpdateDate);
|
|
449
432
|
setAllUsers(response.body.users);
|
|
450
433
|
setSingleChat({
|
|
@@ -457,7 +440,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
457
440
|
});
|
|
458
441
|
setIsLoading(false);
|
|
459
442
|
|
|
460
|
-
case
|
|
443
|
+
case 16:
|
|
461
444
|
case "end":
|
|
462
445
|
return _context3.stop();
|
|
463
446
|
}
|
|
@@ -508,8 +491,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
508
491
|
|
|
509
492
|
case 8:
|
|
510
493
|
// success
|
|
511
|
-
|
|
512
|
-
|
|
494
|
+
// actualizar la lista de los users
|
|
513
495
|
updateAllUsers(response.body.users); // actualizar los items del chat
|
|
514
496
|
|
|
515
497
|
newSingleChat = (0, _objectSpread3.default)({}, singleChat);
|
|
@@ -517,7 +499,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
517
499
|
newSingleChat.enabledLoadMore = response.body.items.length === 50;
|
|
518
500
|
setSingleChat(newSingleChat);
|
|
519
501
|
|
|
520
|
-
case
|
|
502
|
+
case 13:
|
|
521
503
|
case "end":
|
|
522
504
|
return _context4.stop();
|
|
523
505
|
}
|
|
@@ -568,8 +550,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
568
550
|
|
|
569
551
|
case 9:
|
|
570
552
|
// success
|
|
571
|
-
|
|
572
|
-
|
|
553
|
+
// actualizar la lista de los users
|
|
573
554
|
updateAllUsers(response.body.users); // actualizar los items del chat y la lista de users
|
|
574
555
|
|
|
575
556
|
company.items = addOldItemsChat(company.items, response.body.items);
|
|
@@ -578,7 +559,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
578
559
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, activeCompanyId, company));
|
|
579
560
|
});
|
|
580
561
|
|
|
581
|
-
case
|
|
562
|
+
case 13:
|
|
582
563
|
case "end":
|
|
583
564
|
return _context5.stop();
|
|
584
565
|
}
|
|
@@ -601,7 +582,6 @@ var ContentChat = function ContentChat(props) {
|
|
|
601
582
|
while (1) {
|
|
602
583
|
switch (_context6.prev = _context6.next) {
|
|
603
584
|
case 0:
|
|
604
|
-
console.log("\n======== LOAD MORE chat =======");
|
|
605
585
|
stopUpdate(); // finalizamos el temporizador
|
|
606
586
|
|
|
607
587
|
date = singleChat.items[singleChat.items.length - 1].date;
|
|
@@ -617,12 +597,12 @@ var ContentChat = function ContentChat(props) {
|
|
|
617
597
|
currentUser: (0, _utils.encodeUriJson)(dataUser),
|
|
618
598
|
currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
|
|
619
599
|
};
|
|
620
|
-
_context6.next =
|
|
600
|
+
_context6.next = 6;
|
|
621
601
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
|
|
622
602
|
Authorization: (_dataChat$currentUser8 = dataChat.currentUser) === null || _dataChat$currentUser8 === void 0 ? void 0 : _dataChat$currentUser8.token
|
|
623
603
|
});
|
|
624
604
|
|
|
625
|
-
case
|
|
605
|
+
case 6:
|
|
626
606
|
response = _context6.sent;
|
|
627
607
|
//programar update en 20s
|
|
628
608
|
setStartUpdate(function (prev) {
|
|
@@ -630,7 +610,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
630
610
|
});
|
|
631
611
|
|
|
632
612
|
if (response.body) {
|
|
633
|
-
_context6.next =
|
|
613
|
+
_context6.next = 10;
|
|
634
614
|
break;
|
|
635
615
|
}
|
|
636
616
|
|
|
@@ -639,10 +619,9 @@ var ContentChat = function ContentChat(props) {
|
|
|
639
619
|
message: response.errorDetail
|
|
640
620
|
});
|
|
641
621
|
|
|
642
|
-
case
|
|
622
|
+
case 10:
|
|
643
623
|
// success
|
|
644
|
-
|
|
645
|
-
|
|
624
|
+
// actualizar la lista de los users
|
|
646
625
|
updateAllUsers(response.body.users); // actualizar los items del chat
|
|
647
626
|
|
|
648
627
|
newSingleChat = (0, _objectSpread3.default)({}, singleChat);
|
|
@@ -650,7 +629,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
650
629
|
newSingleChat.enabledLoadMore = response.body.items.length === 50;
|
|
651
630
|
setSingleChat(newSingleChat);
|
|
652
631
|
|
|
653
|
-
case
|
|
632
|
+
case 15:
|
|
654
633
|
case "end":
|
|
655
634
|
return _context6.stop();
|
|
656
635
|
}
|
|
@@ -674,21 +653,20 @@ var ContentChat = function ContentChat(props) {
|
|
|
674
653
|
while (1) {
|
|
675
654
|
switch (_context7.prev = _context7.next) {
|
|
676
655
|
case 0:
|
|
677
|
-
console.log(lastUpdateDate);
|
|
678
656
|
paramsQuery = {
|
|
679
657
|
getType: "updateLatest",
|
|
680
658
|
id: JSON.stringify(dataChat.id),
|
|
681
659
|
version: JSON.stringify(dataChat.version),
|
|
682
660
|
date: encodeURIComponent(lastUpdateDate)
|
|
683
661
|
};
|
|
684
|
-
_context7.next =
|
|
662
|
+
_context7.next = 3;
|
|
685
663
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
|
|
686
664
|
|
|
687
|
-
case
|
|
665
|
+
case 3:
|
|
688
666
|
response = _context7.sent;
|
|
689
667
|
|
|
690
668
|
if (response.body) {
|
|
691
|
-
_context7.next =
|
|
669
|
+
_context7.next = 7;
|
|
692
670
|
break;
|
|
693
671
|
}
|
|
694
672
|
|
|
@@ -698,9 +676,8 @@ var ContentChat = function ContentChat(props) {
|
|
|
698
676
|
});
|
|
699
677
|
return _context7.abrupt("return");
|
|
700
678
|
|
|
701
|
-
case
|
|
679
|
+
case 7:
|
|
702
680
|
// success
|
|
703
|
-
console.log(response.body);
|
|
704
681
|
setLastUpdateDate(response.body.data.lastUpdateDate); // actualizar la lista de los users
|
|
705
682
|
|
|
706
683
|
updateAllUsers(response.body.users); // actualizar los items del chat
|
|
@@ -709,7 +686,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
709
686
|
newSingleChat.items = addNewItemsChat(newSingleChat.items, response.body.items);
|
|
710
687
|
setSingleChat(newSingleChat);
|
|
711
688
|
|
|
712
|
-
case
|
|
689
|
+
case 12:
|
|
713
690
|
case "end":
|
|
714
691
|
return _context7.stop();
|
|
715
692
|
}
|
|
@@ -729,7 +706,6 @@ var ContentChat = function ContentChat(props) {
|
|
|
729
706
|
while (1) {
|
|
730
707
|
switch (_context8.prev = _context8.next) {
|
|
731
708
|
case 0:
|
|
732
|
-
console.log(lastUpdateDate);
|
|
733
709
|
paramsQuery = {
|
|
734
710
|
getType: "updateLatest",
|
|
735
711
|
id: JSON.stringify(dataChat.id),
|
|
@@ -741,14 +717,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
741
717
|
othersCompanyId: encodeURIComponent(JSON.stringify(Object.keys(companies))),
|
|
742
718
|
date: encodeURIComponent(lastUpdateDate)
|
|
743
719
|
};
|
|
744
|
-
_context8.next =
|
|
720
|
+
_context8.next = 3;
|
|
745
721
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
|
|
746
722
|
|
|
747
|
-
case
|
|
723
|
+
case 3:
|
|
748
724
|
response = _context8.sent;
|
|
749
725
|
|
|
750
726
|
if (response.body) {
|
|
751
|
-
_context8.next =
|
|
727
|
+
_context8.next = 7;
|
|
752
728
|
break;
|
|
753
729
|
}
|
|
754
730
|
|
|
@@ -758,10 +734,9 @@ var ContentChat = function ContentChat(props) {
|
|
|
758
734
|
});
|
|
759
735
|
return _context8.abrupt("return");
|
|
760
736
|
|
|
761
|
-
case
|
|
737
|
+
case 7:
|
|
762
738
|
// success
|
|
763
|
-
|
|
764
|
-
|
|
739
|
+
// cuando cambie la lista de chats por un cambio de version o estatus
|
|
765
740
|
if (response.body.data.status) {
|
|
766
741
|
setIsLoading(true);
|
|
767
742
|
setTimeout(function () {
|
|
@@ -791,9 +766,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
791
766
|
|
|
792
767
|
if (!companyActive && companiesIdList.length) {
|
|
793
768
|
companyActive = Number(companiesIdList[0]);
|
|
794
|
-
}
|
|
795
|
-
//console.log("new companyActive: ", companyActive);
|
|
796
|
-
|
|
769
|
+
}
|
|
797
770
|
|
|
798
771
|
setCompanies(companiesList);
|
|
799
772
|
if (companyActive) setActiveCompanyId(companyActive);
|
|
@@ -811,12 +784,11 @@ var ContentChat = function ContentChat(props) {
|
|
|
811
784
|
companiesList = (0, _objectSpread3.default)({}, companies);
|
|
812
785
|
Object.keys(response.body.companies).forEach(function (companyId) {
|
|
813
786
|
companiesList[companyId].items = addNewItemsChat(companiesList[companyId].items, response.body.companies[companyId].items);
|
|
814
|
-
});
|
|
815
|
-
|
|
787
|
+
});
|
|
816
788
|
setCompanies(companiesList);
|
|
817
789
|
}
|
|
818
790
|
|
|
819
|
-
case
|
|
791
|
+
case 8:
|
|
820
792
|
case "end":
|
|
821
793
|
return _context8.stop();
|
|
822
794
|
}
|
|
@@ -838,23 +810,11 @@ var ContentChat = function ContentChat(props) {
|
|
|
838
810
|
while (1) {
|
|
839
811
|
switch (_context9.prev = _context9.next) {
|
|
840
812
|
case 0:
|
|
841
|
-
console.log("\n======== UPDATE chat =======");
|
|
842
|
-
console.log("lastUpdate:", lastUpdateDate);
|
|
843
813
|
dataUser = {
|
|
844
814
|
id: (_dataChat$currentUser9 = dataChat.currentUser) === null || _dataChat$currentUser9 === void 0 ? void 0 : _dataChat$currentUser9.id,
|
|
845
815
|
companyId: (_dataChat$currentUser10 = dataChat.currentUser) === null || _dataChat$currentUser10 === void 0 ? void 0 : _dataChat$currentUser10.companyId,
|
|
846
816
|
isUserTech: (_dataChat$currentUser11 = dataChat.currentUser) === null || _dataChat$currentUser11 === void 0 ? void 0 : _dataChat$currentUser11.isUserTech
|
|
847
817
|
};
|
|
848
|
-
/*
|
|
849
|
-
console.log("values send query:", {
|
|
850
|
-
id: dataChat.id,
|
|
851
|
-
getType: "updateLatest",
|
|
852
|
-
date: lastUpdateDate,
|
|
853
|
-
currentUser: dataUser,
|
|
854
|
-
currentItemsFront: getItemsIdSingleChat(),
|
|
855
|
-
});
|
|
856
|
-
*/
|
|
857
|
-
|
|
858
818
|
paramsQuery = {
|
|
859
819
|
id: JSON.stringify(dataChat.id),
|
|
860
820
|
getType: "updateLatest",
|
|
@@ -862,12 +822,12 @@ var ContentChat = function ContentChat(props) {
|
|
|
862
822
|
currentUser: (0, _utils.encodeUriJson)(dataUser),
|
|
863
823
|
currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
|
|
864
824
|
};
|
|
865
|
-
_context9.next =
|
|
825
|
+
_context9.next = 4;
|
|
866
826
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
|
|
867
827
|
Authorization: (_dataChat$currentUser12 = dataChat.currentUser) === null || _dataChat$currentUser12 === void 0 ? void 0 : _dataChat$currentUser12.token
|
|
868
828
|
});
|
|
869
829
|
|
|
870
|
-
case
|
|
830
|
+
case 4:
|
|
871
831
|
response = _context9.sent;
|
|
872
832
|
//programar update en 20s
|
|
873
833
|
setStartUpdate(function (prev) {
|
|
@@ -875,7 +835,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
875
835
|
});
|
|
876
836
|
|
|
877
837
|
if (response.body) {
|
|
878
|
-
_context9.next =
|
|
838
|
+
_context9.next = 10;
|
|
879
839
|
break;
|
|
880
840
|
}
|
|
881
841
|
|
|
@@ -899,12 +859,11 @@ var ContentChat = function ContentChat(props) {
|
|
|
899
859
|
});
|
|
900
860
|
return _context9.abrupt("return");
|
|
901
861
|
|
|
902
|
-
case
|
|
862
|
+
case 10:
|
|
903
863
|
// limpiar error update
|
|
904
864
|
if (errorUpdate.startDate) {
|
|
905
865
|
setErrorUpdate({});
|
|
906
866
|
} // success
|
|
907
|
-
//console.log("response update:", response.body);
|
|
908
867
|
|
|
909
868
|
|
|
910
869
|
setLastUpdateDate(response.body.data.lastUpdateDate); // actualizar la lista de los users
|
|
@@ -916,7 +875,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
916
875
|
newSingleChat.statusChat = response.body.data.statusChat;
|
|
917
876
|
setSingleChat(newSingleChat);
|
|
918
877
|
|
|
919
|
-
case
|
|
878
|
+
case 17:
|
|
920
879
|
case "end":
|
|
921
880
|
return _context9.stop();
|
|
922
881
|
}
|
|
@@ -1023,84 +982,82 @@ var ContentChat = function ContentChat(props) {
|
|
|
1023
982
|
return _context10.finish(19);
|
|
1024
983
|
|
|
1025
984
|
case 22:
|
|
1026
|
-
console.log("======= create items ========");
|
|
1027
|
-
console.log("items a enviar:", items);
|
|
1028
985
|
stopUpdate(); // finalizamos el temporizador
|
|
1029
986
|
// enviar items a la BD
|
|
1030
987
|
|
|
1031
988
|
if (!(chatType === "merchant_product")) {
|
|
1032
|
-
_context10.next =
|
|
989
|
+
_context10.next = 29;
|
|
1033
990
|
break;
|
|
1034
991
|
}
|
|
1035
992
|
|
|
1036
|
-
_context10.next =
|
|
993
|
+
_context10.next = 26;
|
|
1037
994
|
return createItemsMerchantProduct(items);
|
|
1038
995
|
|
|
1039
|
-
case
|
|
996
|
+
case 26:
|
|
1040
997
|
errorCreate = _context10.sent;
|
|
1041
|
-
_context10.next =
|
|
998
|
+
_context10.next = 38;
|
|
1042
999
|
break;
|
|
1043
1000
|
|
|
1044
|
-
case
|
|
1001
|
+
case 29:
|
|
1045
1002
|
if (!(chatType === "order_product")) {
|
|
1046
|
-
_context10.next =
|
|
1003
|
+
_context10.next = 35;
|
|
1047
1004
|
break;
|
|
1048
1005
|
}
|
|
1049
1006
|
|
|
1050
|
-
_context10.next =
|
|
1007
|
+
_context10.next = 32;
|
|
1051
1008
|
return createItemsOrderProduct(items);
|
|
1052
1009
|
|
|
1053
|
-
case
|
|
1010
|
+
case 32:
|
|
1054
1011
|
errorCreate = _context10.sent;
|
|
1055
|
-
_context10.next =
|
|
1012
|
+
_context10.next = 38;
|
|
1056
1013
|
break;
|
|
1057
1014
|
|
|
1058
|
-
case
|
|
1059
|
-
_context10.next =
|
|
1015
|
+
case 35:
|
|
1016
|
+
_context10.next = 37;
|
|
1060
1017
|
return createItemsTicket(items);
|
|
1061
1018
|
|
|
1062
|
-
case
|
|
1019
|
+
case 37:
|
|
1063
1020
|
errorCreate = _context10.sent;
|
|
1064
1021
|
|
|
1065
|
-
case
|
|
1022
|
+
case 38:
|
|
1066
1023
|
if (!(chatType === "merchant_product")) {
|
|
1067
|
-
_context10.next =
|
|
1024
|
+
_context10.next = 43;
|
|
1068
1025
|
break;
|
|
1069
1026
|
}
|
|
1070
1027
|
|
|
1071
|
-
_context10.next =
|
|
1028
|
+
_context10.next = 41;
|
|
1072
1029
|
return getUpdateLatestMerchantProduct();
|
|
1073
1030
|
|
|
1074
|
-
case
|
|
1075
|
-
_context10.next =
|
|
1031
|
+
case 41:
|
|
1032
|
+
_context10.next = 50;
|
|
1076
1033
|
break;
|
|
1077
1034
|
|
|
1078
|
-
case
|
|
1035
|
+
case 43:
|
|
1079
1036
|
if (!(chatType === "order_product")) {
|
|
1080
|
-
_context10.next =
|
|
1037
|
+
_context10.next = 48;
|
|
1081
1038
|
break;
|
|
1082
1039
|
}
|
|
1083
1040
|
|
|
1084
|
-
_context10.next =
|
|
1041
|
+
_context10.next = 46;
|
|
1085
1042
|
return getUpdateLatestOrderProduct();
|
|
1086
1043
|
|
|
1087
|
-
case
|
|
1088
|
-
_context10.next =
|
|
1044
|
+
case 46:
|
|
1045
|
+
_context10.next = 50;
|
|
1089
1046
|
break;
|
|
1090
1047
|
|
|
1091
|
-
case
|
|
1092
|
-
_context10.next =
|
|
1048
|
+
case 48:
|
|
1049
|
+
_context10.next = 50;
|
|
1093
1050
|
return getUpdateLatestTicket();
|
|
1094
1051
|
|
|
1095
|
-
case
|
|
1052
|
+
case 50:
|
|
1096
1053
|
if (!errorCreate) {
|
|
1097
|
-
_context10.next =
|
|
1054
|
+
_context10.next = 52;
|
|
1098
1055
|
break;
|
|
1099
1056
|
}
|
|
1100
1057
|
|
|
1101
1058
|
return _context10.abrupt("return", errorCreate);
|
|
1102
1059
|
|
|
1103
|
-
case
|
|
1060
|
+
case 52:
|
|
1104
1061
|
case "end":
|
|
1105
1062
|
return _context10.stop();
|
|
1106
1063
|
}
|
|
@@ -1124,21 +1081,20 @@ var ContentChat = function ContentChat(props) {
|
|
|
1124
1081
|
switch (_context11.prev = _context11.next) {
|
|
1125
1082
|
case 0:
|
|
1126
1083
|
items = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : [];
|
|
1127
|
-
console.log("create items merchants");
|
|
1128
1084
|
paramsBody = {
|
|
1129
1085
|
id: JSON.stringify(dataChat.id),
|
|
1130
1086
|
version: JSON.stringify(dataChat.version),
|
|
1131
1087
|
userId: JSON.stringify(currentUser.id),
|
|
1132
1088
|
items: JSON.stringify(items)
|
|
1133
1089
|
};
|
|
1134
|
-
_context11.next =
|
|
1090
|
+
_context11.next = 4;
|
|
1135
1091
|
return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody);
|
|
1136
1092
|
|
|
1137
|
-
case
|
|
1093
|
+
case 4:
|
|
1138
1094
|
response = _context11.sent;
|
|
1139
1095
|
|
|
1140
1096
|
if (response.body) {
|
|
1141
|
-
_context11.next =
|
|
1097
|
+
_context11.next = 7;
|
|
1142
1098
|
break;
|
|
1143
1099
|
}
|
|
1144
1100
|
|
|
@@ -1147,7 +1103,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1147
1103
|
errorDetail: response.errorDetail
|
|
1148
1104
|
});
|
|
1149
1105
|
|
|
1150
|
-
case
|
|
1106
|
+
case 7:
|
|
1151
1107
|
case "end":
|
|
1152
1108
|
return _context11.stop();
|
|
1153
1109
|
}
|
|
@@ -1171,7 +1127,6 @@ var ContentChat = function ContentChat(props) {
|
|
|
1171
1127
|
switch (_context12.prev = _context12.next) {
|
|
1172
1128
|
case 0:
|
|
1173
1129
|
items = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : [];
|
|
1174
|
-
console.log("create items order");
|
|
1175
1130
|
paramsBody = {
|
|
1176
1131
|
id: JSON.stringify(dataChat.id),
|
|
1177
1132
|
version: JSON.stringify(currentArticle.version),
|
|
@@ -1181,15 +1136,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
1181
1136
|
sentCompanyId: JSON.stringify(currentUser.companyId),
|
|
1182
1137
|
receivedCompanyId: JSON.stringify(activeCompanyId)
|
|
1183
1138
|
};
|
|
1184
|
-
|
|
1185
|
-
_context12.next = 6;
|
|
1139
|
+
_context12.next = 4;
|
|
1186
1140
|
return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody);
|
|
1187
1141
|
|
|
1188
|
-
case
|
|
1142
|
+
case 4:
|
|
1189
1143
|
response = _context12.sent;
|
|
1190
1144
|
|
|
1191
1145
|
if (response.body) {
|
|
1192
|
-
_context12.next =
|
|
1146
|
+
_context12.next = 7;
|
|
1193
1147
|
break;
|
|
1194
1148
|
}
|
|
1195
1149
|
|
|
@@ -1198,7 +1152,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1198
1152
|
errorDetail: response.errorDetail
|
|
1199
1153
|
});
|
|
1200
1154
|
|
|
1201
|
-
case
|
|
1155
|
+
case 7:
|
|
1202
1156
|
case "end":
|
|
1203
1157
|
return _context12.stop();
|
|
1204
1158
|
}
|
|
@@ -1307,8 +1261,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1307
1261
|
items.push(item);
|
|
1308
1262
|
itemsId[item.id] = true;
|
|
1309
1263
|
}
|
|
1310
|
-
});
|
|
1311
|
-
|
|
1264
|
+
});
|
|
1312
1265
|
return items;
|
|
1313
1266
|
};
|
|
1314
1267
|
|
|
@@ -1316,18 +1269,16 @@ var ContentChat = function ContentChat(props) {
|
|
|
1316
1269
|
var currentItems = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1317
1270
|
var newItems = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
1318
1271
|
var items = currentItems.slice();
|
|
1319
|
-
var itemsId = {
|
|
1320
|
-
|
|
1321
|
-
itemsId[item.id] = true;
|
|
1272
|
+
var itemsId = items.map(function (item) {
|
|
1273
|
+
return item.id;
|
|
1322
1274
|
});
|
|
1323
1275
|
|
|
1324
1276
|
for (var i = newItems.length - 1; i >= 0; i--) {
|
|
1325
|
-
if (!itemsId
|
|
1326
|
-
items.
|
|
1327
|
-
itemsId
|
|
1277
|
+
if (!itemsId.includes(newItems[i].id)) {
|
|
1278
|
+
items.push(newItems[i]);
|
|
1279
|
+
itemsId.push(newItems[i].id);
|
|
1328
1280
|
}
|
|
1329
|
-
}
|
|
1330
|
-
|
|
1281
|
+
}
|
|
1331
1282
|
|
|
1332
1283
|
return items;
|
|
1333
1284
|
};
|
|
@@ -1339,8 +1290,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1339
1290
|
if (!currentUsers[userId]) {
|
|
1340
1291
|
currentUsers[userId] = newUsers[userId];
|
|
1341
1292
|
}
|
|
1342
|
-
});
|
|
1343
|
-
|
|
1293
|
+
});
|
|
1344
1294
|
setAllUsers(currentUsers);
|
|
1345
1295
|
};
|
|
1346
1296
|
|
|
@@ -1378,7 +1328,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1378
1328
|
var items;
|
|
1379
1329
|
var enabledLoadMore;
|
|
1380
1330
|
|
|
1381
|
-
if (
|
|
1331
|
+
if (["merchant_product", "ticket"].includes(chatType)) {
|
|
1382
1332
|
items = singleChat.items;
|
|
1383
1333
|
enabledLoadMore = singleChat.enabledLoadMore;
|
|
1384
1334
|
} // ORDER_PRODUCT
|