contentoh-components-library 21.3.66 → 21.3.67
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 -2
- package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
- package/dist/components/atoms/ButtonV2/styles.js +1 -1
- package/dist/components/atoms/InputFormatter/styles.js +1 -1
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +11 -68
- package/dist/components/molecules/TagAndInput/index.js +1 -1
- package/dist/components/organisms/Chat/Chat.stories.js +1 -21
- package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +191 -343
- package/dist/components/organisms/Chat/Footer/index.js +39 -48
- package/dist/components/organisms/Chat/index.js +3 -48
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/organisms/Modal/styles.js +1 -1
- package/dist/components/organisms/SideModal/index.js +0 -11
- package/dist/components/organisms/SideModal/styles.js +1 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +127 -172
- package/dist/components/pages/ProviderProductEdition/index.js +175 -188
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +28 -40
- package/dist/components/pages/RetailerProductEdition/index.js +273 -265
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
- package/dist/index.js +0 -13
- package/package.json +1 -1
- package/src/components/atoms/ButtonV2/styles.js +1 -1
- package/src/components/atoms/InputFormatter/styles.js +1 -2
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +6 -52
- package/src/components/molecules/TagAndInput/index.js +8 -10
- package/src/components/organisms/Chat/Chat.stories.js +0 -21
- package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
- package/src/components/organisms/Chat/ContainerItems/styles.js +2 -10
- package/src/components/organisms/Chat/ContentChat/index.js +6 -81
- package/src/components/organisms/Chat/Footer/index.js +0 -11
- package/src/components/organisms/Chat/index.js +3 -47
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/Modal/styles.js +1 -4
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +130 -177
- package/src/components/pages/ProviderProductEdition/index.js +129 -132
- package/src/components/pages/ProviderProductEdition/styles.js +1 -5
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +26 -38
- package/src/components/pages/RetailerProductEdition/index.js +135 -109
- package/src/components/pages/RetailerProductEdition/styles.js +0 -4
- package/src/components/pages/RetailerProductEdition/utils.js +0 -37
- package/src/index.js +0 -1
- package/src/components/organisms/SideModal/SideModal.stories.js +0 -23
- package/src/components/organisms/SideModal/index.js +0 -50
- package/src/components/organisms/SideModal/styles.js +0 -30
|
@@ -203,7 +203,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
203
203
|
return;
|
|
204
204
|
}
|
|
205
205
|
|
|
206
|
-
if (chatType === "merchant_product") getInitialMerchantProduct();else if (chatType === "order_product") getInitialOrderProduct();else
|
|
206
|
+
if (chatType === "merchant_product") getInitialMerchantProduct();else if (chatType === "order_product") getInitialOrderProduct();else getInitialTicket();
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
if (!showPopUpChat) {
|
|
@@ -230,8 +230,6 @@ var ContentChat = function ContentChat(props) {
|
|
|
230
230
|
if (singleChat.items) getUpdateLatestMerchantProduct(true);else getInitialMerchantProduct();
|
|
231
231
|
} else if (chatType === "order_product") {
|
|
232
232
|
if (companies) getUpdateLatestOrderProduct(true);else getInitialOrderProduct();
|
|
233
|
-
} else if (chatType === "product_status") {
|
|
234
|
-
getInitialProductStatus();
|
|
235
233
|
} else {
|
|
236
234
|
if (singleChat.items) getUpdateLatestTicket(true);else getInitialTicket();
|
|
237
235
|
}
|
|
@@ -240,7 +238,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
240
238
|
PETICION GET INICIAL SEGUN EL TIPO DE CHAT
|
|
241
239
|
======================================================================= */
|
|
242
240
|
|
|
243
|
-
var
|
|
241
|
+
var getInitialMerchantProduct = /*#__PURE__*/function () {
|
|
244
242
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
245
243
|
var paramsQuery, paramsHeaders, response;
|
|
246
244
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
@@ -248,18 +246,15 @@ var ContentChat = function ContentChat(props) {
|
|
|
248
246
|
switch (_context.prev = _context.next) {
|
|
249
247
|
case 0:
|
|
250
248
|
paramsQuery = {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
retailerId: JSON.stringify(dataChat.retailerId),
|
|
255
|
-
status: dataChat.status
|
|
256
|
-
}
|
|
249
|
+
getType: "initial",
|
|
250
|
+
id: JSON.stringify(dataChat.id),
|
|
251
|
+
version: JSON.stringify(dataChat.version)
|
|
257
252
|
};
|
|
258
253
|
paramsHeaders = {
|
|
259
254
|
Authorization: dataChat.userToken
|
|
260
255
|
};
|
|
261
256
|
_context.next = 4;
|
|
262
|
-
return (0, _handle_http.fetchGET)(process.env.
|
|
257
|
+
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery, paramsHeaders);
|
|
263
258
|
|
|
264
259
|
case 4:
|
|
265
260
|
response = _context.sent;
|
|
@@ -306,86 +301,18 @@ var ContentChat = function ContentChat(props) {
|
|
|
306
301
|
}, _callee);
|
|
307
302
|
}));
|
|
308
303
|
|
|
309
|
-
return function getInitialProductStatus() {
|
|
310
|
-
return _ref.apply(this, arguments);
|
|
311
|
-
};
|
|
312
|
-
}();
|
|
313
|
-
|
|
314
|
-
var getInitialMerchantProduct = /*#__PURE__*/function () {
|
|
315
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
316
|
-
var paramsQuery, paramsHeaders, response;
|
|
317
|
-
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
318
|
-
while (1) {
|
|
319
|
-
switch (_context2.prev = _context2.next) {
|
|
320
|
-
case 0:
|
|
321
|
-
paramsQuery = {
|
|
322
|
-
getType: "initial",
|
|
323
|
-
id: JSON.stringify(dataChat.id),
|
|
324
|
-
version: JSON.stringify(dataChat.version)
|
|
325
|
-
};
|
|
326
|
-
paramsHeaders = {
|
|
327
|
-
Authorization: dataChat.userToken
|
|
328
|
-
};
|
|
329
|
-
_context2.next = 4;
|
|
330
|
-
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery, paramsHeaders);
|
|
331
|
-
|
|
332
|
-
case 4:
|
|
333
|
-
response = _context2.sent;
|
|
334
|
-
|
|
335
|
-
if (response.body) {
|
|
336
|
-
_context2.next = 9;
|
|
337
|
-
break;
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
setErrorChat({
|
|
341
|
-
existError: true,
|
|
342
|
-
code: 400,
|
|
343
|
-
message: response.message,
|
|
344
|
-
errorDetail: response.errorDetail
|
|
345
|
-
});
|
|
346
|
-
setIsLoading(false);
|
|
347
|
-
return _context2.abrupt("return");
|
|
348
|
-
|
|
349
|
-
case 9:
|
|
350
|
-
// success
|
|
351
|
-
setStartUpdate(function (prev) {
|
|
352
|
-
return prev + 1;
|
|
353
|
-
});
|
|
354
|
-
setCurrentUser({
|
|
355
|
-
id: response.body.data.currentUserId,
|
|
356
|
-
companyId: response.body.data.currentCompanyId
|
|
357
|
-
});
|
|
358
|
-
setLastUpdateDate(response.body.data.lastUpdateDate);
|
|
359
|
-
setAllUsers(response.body.users);
|
|
360
|
-
setSingleChat({
|
|
361
|
-
items: response.body.items,
|
|
362
|
-
enabledLoadMore: response.body.items.length === 50
|
|
363
|
-
});
|
|
364
|
-
setErrorChat({
|
|
365
|
-
existError: false
|
|
366
|
-
});
|
|
367
|
-
setIsLoading(false);
|
|
368
|
-
|
|
369
|
-
case 16:
|
|
370
|
-
case "end":
|
|
371
|
-
return _context2.stop();
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
}, _callee2);
|
|
375
|
-
}));
|
|
376
|
-
|
|
377
304
|
return function getInitialMerchantProduct() {
|
|
378
|
-
return
|
|
305
|
+
return _ref.apply(this, arguments);
|
|
379
306
|
};
|
|
380
307
|
}();
|
|
381
308
|
|
|
382
309
|
var getInitialOrderProduct = /*#__PURE__*/function () {
|
|
383
|
-
var
|
|
310
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
384
311
|
var paramsQuery, paramsHeaders, response, companiesList, companiesIdList, companyActive, _i, _companiesIdList, companyId;
|
|
385
312
|
|
|
386
|
-
return _regenerator.default.wrap(function
|
|
313
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
387
314
|
while (1) {
|
|
388
|
-
switch (
|
|
315
|
+
switch (_context2.prev = _context2.next) {
|
|
389
316
|
case 0:
|
|
390
317
|
clearTimeout(processUpdateID); // finalizamos el temporizador
|
|
391
318
|
|
|
@@ -398,17 +325,17 @@ var ContentChat = function ContentChat(props) {
|
|
|
398
325
|
paramsHeaders = {
|
|
399
326
|
Authorization: dataChat.userToken
|
|
400
327
|
};
|
|
401
|
-
|
|
328
|
+
_context2.next = 5;
|
|
402
329
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery, paramsHeaders);
|
|
403
330
|
|
|
404
331
|
case 5:
|
|
405
|
-
response =
|
|
332
|
+
response = _context2.sent;
|
|
406
333
|
setStartUpdate(function (prev) {
|
|
407
334
|
return prev + 1;
|
|
408
335
|
}); // TEMPORAL
|
|
409
336
|
|
|
410
337
|
if (response.body) {
|
|
411
|
-
|
|
338
|
+
_context2.next = 11;
|
|
412
339
|
break;
|
|
413
340
|
}
|
|
414
341
|
|
|
@@ -419,7 +346,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
419
346
|
errorDetail: response.errorDetail
|
|
420
347
|
});
|
|
421
348
|
setIsLoading(false);
|
|
422
|
-
return
|
|
349
|
+
return _context2.abrupt("return");
|
|
423
350
|
|
|
424
351
|
case 11:
|
|
425
352
|
// success
|
|
@@ -464,25 +391,25 @@ var ContentChat = function ContentChat(props) {
|
|
|
464
391
|
|
|
465
392
|
case 23:
|
|
466
393
|
case "end":
|
|
467
|
-
return
|
|
394
|
+
return _context2.stop();
|
|
468
395
|
}
|
|
469
396
|
}
|
|
470
|
-
},
|
|
397
|
+
}, _callee2);
|
|
471
398
|
}));
|
|
472
399
|
|
|
473
400
|
return function getInitialOrderProduct() {
|
|
474
|
-
return
|
|
401
|
+
return _ref2.apply(this, arguments);
|
|
475
402
|
};
|
|
476
403
|
}();
|
|
477
404
|
|
|
478
405
|
var getInitialTicket = /*#__PURE__*/function () {
|
|
479
|
-
var
|
|
406
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
480
407
|
var _dataChat$currentUser, _dataChat$currentUser2, _dataChat$currentUser3, _dataChat$currentUser4;
|
|
481
408
|
|
|
482
409
|
var dataUser, paramsQuery, response;
|
|
483
|
-
return _regenerator.default.wrap(function
|
|
410
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
484
411
|
while (1) {
|
|
485
|
-
switch (
|
|
412
|
+
switch (_context3.prev = _context3.next) {
|
|
486
413
|
case 0:
|
|
487
414
|
stopUpdate(); // finalizamos el temporizador
|
|
488
415
|
|
|
@@ -497,20 +424,20 @@ var ContentChat = function ContentChat(props) {
|
|
|
497
424
|
currentUser: (0, _utils.encodeUriJson)(dataUser),
|
|
498
425
|
currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
|
|
499
426
|
};
|
|
500
|
-
|
|
427
|
+
_context3.next = 5;
|
|
501
428
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
|
|
502
429
|
Authorization: (_dataChat$currentUser4 = dataChat.currentUser) === null || _dataChat$currentUser4 === void 0 ? void 0 : _dataChat$currentUser4.token
|
|
503
430
|
});
|
|
504
431
|
|
|
505
432
|
case 5:
|
|
506
|
-
response =
|
|
433
|
+
response = _context3.sent;
|
|
507
434
|
// programar update en 20s
|
|
508
435
|
setStartUpdate(function (prev) {
|
|
509
436
|
return prev + 1;
|
|
510
437
|
});
|
|
511
438
|
|
|
512
439
|
if (response.body) {
|
|
513
|
-
|
|
440
|
+
_context3.next = 11;
|
|
514
441
|
break;
|
|
515
442
|
}
|
|
516
443
|
|
|
@@ -521,7 +448,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
521
448
|
errorDetail: response.errorDetail
|
|
522
449
|
});
|
|
523
450
|
setIsLoading(false);
|
|
524
|
-
return
|
|
451
|
+
return _context3.abrupt("return");
|
|
525
452
|
|
|
526
453
|
case 11:
|
|
527
454
|
// success
|
|
@@ -539,14 +466,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
539
466
|
|
|
540
467
|
case 16:
|
|
541
468
|
case "end":
|
|
542
|
-
return
|
|
469
|
+
return _context3.stop();
|
|
543
470
|
}
|
|
544
471
|
}
|
|
545
|
-
},
|
|
472
|
+
}, _callee3);
|
|
546
473
|
}));
|
|
547
474
|
|
|
548
475
|
return function getInitialTicket() {
|
|
549
|
-
return
|
|
476
|
+
return _ref3.apply(this, arguments);
|
|
550
477
|
};
|
|
551
478
|
}();
|
|
552
479
|
/*=======================================================================
|
|
@@ -555,11 +482,11 @@ var ContentChat = function ContentChat(props) {
|
|
|
555
482
|
|
|
556
483
|
|
|
557
484
|
var getLoadMoreMerchantProduct = /*#__PURE__*/function () {
|
|
558
|
-
var
|
|
485
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
559
486
|
var date, paramsQuery, response, newSingleChat;
|
|
560
|
-
return _regenerator.default.wrap(function
|
|
487
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
561
488
|
while (1) {
|
|
562
|
-
switch (
|
|
489
|
+
switch (_context4.prev = _context4.next) {
|
|
563
490
|
case 0:
|
|
564
491
|
clearTimeout(processUpdateID); // finalizamos el temporizador
|
|
565
492
|
|
|
@@ -570,18 +497,18 @@ var ContentChat = function ContentChat(props) {
|
|
|
570
497
|
version: JSON.stringify(dataChat.version),
|
|
571
498
|
date: encodeURIComponent(date)
|
|
572
499
|
};
|
|
573
|
-
|
|
500
|
+
_context4.next = 5;
|
|
574
501
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
|
|
575
502
|
|
|
576
503
|
case 5:
|
|
577
|
-
response =
|
|
504
|
+
response = _context4.sent;
|
|
578
505
|
|
|
579
506
|
if (response.body) {
|
|
580
|
-
|
|
507
|
+
_context4.next = 8;
|
|
581
508
|
break;
|
|
582
509
|
}
|
|
583
510
|
|
|
584
|
-
return
|
|
511
|
+
return _context4.abrupt("return", {
|
|
585
512
|
title: response.message,
|
|
586
513
|
message: response.errorDetail
|
|
587
514
|
});
|
|
@@ -598,23 +525,23 @@ var ContentChat = function ContentChat(props) {
|
|
|
598
525
|
|
|
599
526
|
case 13:
|
|
600
527
|
case "end":
|
|
601
|
-
return
|
|
528
|
+
return _context4.stop();
|
|
602
529
|
}
|
|
603
530
|
}
|
|
604
|
-
},
|
|
531
|
+
}, _callee4);
|
|
605
532
|
}));
|
|
606
533
|
|
|
607
534
|
return function getLoadMoreMerchantProduct() {
|
|
608
|
-
return
|
|
535
|
+
return _ref4.apply(this, arguments);
|
|
609
536
|
};
|
|
610
537
|
}();
|
|
611
538
|
|
|
612
539
|
var getLoadMoreOrderProduct = /*#__PURE__*/function () {
|
|
613
|
-
var
|
|
540
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
614
541
|
var company, date, paramsQuery, response;
|
|
615
|
-
return _regenerator.default.wrap(function
|
|
542
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
616
543
|
while (1) {
|
|
617
|
-
switch (
|
|
544
|
+
switch (_context5.prev = _context5.next) {
|
|
618
545
|
case 0:
|
|
619
546
|
clearTimeout(processUpdateID); // finalizamos el temporizador
|
|
620
547
|
|
|
@@ -629,18 +556,18 @@ var ContentChat = function ContentChat(props) {
|
|
|
629
556
|
date: encodeURIComponent(date),
|
|
630
557
|
othersCompanyId: JSON.stringify([activeCompanyId])
|
|
631
558
|
};
|
|
632
|
-
|
|
559
|
+
_context5.next = 6;
|
|
633
560
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
|
|
634
561
|
|
|
635
562
|
case 6:
|
|
636
|
-
response =
|
|
563
|
+
response = _context5.sent;
|
|
637
564
|
|
|
638
565
|
if (response.body) {
|
|
639
|
-
|
|
566
|
+
_context5.next = 9;
|
|
640
567
|
break;
|
|
641
568
|
}
|
|
642
569
|
|
|
643
|
-
return
|
|
570
|
+
return _context5.abrupt("return", {
|
|
644
571
|
title: response.message,
|
|
645
572
|
message: response.errorDetail
|
|
646
573
|
});
|
|
@@ -658,26 +585,26 @@ var ContentChat = function ContentChat(props) {
|
|
|
658
585
|
|
|
659
586
|
case 13:
|
|
660
587
|
case "end":
|
|
661
|
-
return
|
|
588
|
+
return _context5.stop();
|
|
662
589
|
}
|
|
663
590
|
}
|
|
664
|
-
},
|
|
591
|
+
}, _callee5);
|
|
665
592
|
}));
|
|
666
593
|
|
|
667
594
|
return function getLoadMoreOrderProduct() {
|
|
668
|
-
return
|
|
595
|
+
return _ref5.apply(this, arguments);
|
|
669
596
|
};
|
|
670
597
|
}(); // este GET obtiene la lista de compañoas con las que se puede chatear
|
|
671
598
|
|
|
672
599
|
|
|
673
600
|
var getLoadMoreTicket = /*#__PURE__*/function () {
|
|
674
|
-
var
|
|
601
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
675
602
|
var _dataChat$currentUser5, _dataChat$currentUser6, _dataChat$currentUser7, _dataChat$currentUser8;
|
|
676
603
|
|
|
677
604
|
var date, dataUser, paramsQuery, response, newSingleChat;
|
|
678
|
-
return _regenerator.default.wrap(function
|
|
605
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
679
606
|
while (1) {
|
|
680
|
-
switch (
|
|
607
|
+
switch (_context6.prev = _context6.next) {
|
|
681
608
|
case 0:
|
|
682
609
|
stopUpdate(); // finalizamos el temporizador
|
|
683
610
|
|
|
@@ -694,24 +621,24 @@ var ContentChat = function ContentChat(props) {
|
|
|
694
621
|
currentUser: (0, _utils.encodeUriJson)(dataUser),
|
|
695
622
|
currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
|
|
696
623
|
};
|
|
697
|
-
|
|
624
|
+
_context6.next = 6;
|
|
698
625
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
|
|
699
626
|
Authorization: (_dataChat$currentUser8 = dataChat.currentUser) === null || _dataChat$currentUser8 === void 0 ? void 0 : _dataChat$currentUser8.token
|
|
700
627
|
});
|
|
701
628
|
|
|
702
629
|
case 6:
|
|
703
|
-
response =
|
|
630
|
+
response = _context6.sent;
|
|
704
631
|
//programar update en 20s
|
|
705
632
|
setStartUpdate(function (prev) {
|
|
706
633
|
return prev + 1;
|
|
707
634
|
});
|
|
708
635
|
|
|
709
636
|
if (response.body) {
|
|
710
|
-
|
|
637
|
+
_context6.next = 10;
|
|
711
638
|
break;
|
|
712
639
|
}
|
|
713
640
|
|
|
714
|
-
return
|
|
641
|
+
return _context6.abrupt("return", {
|
|
715
642
|
title: response.message,
|
|
716
643
|
message: response.errorDetail
|
|
717
644
|
});
|
|
@@ -728,14 +655,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
728
655
|
|
|
729
656
|
case 15:
|
|
730
657
|
case "end":
|
|
731
|
-
return
|
|
658
|
+
return _context6.stop();
|
|
732
659
|
}
|
|
733
660
|
}
|
|
734
|
-
},
|
|
661
|
+
}, _callee6);
|
|
735
662
|
}));
|
|
736
663
|
|
|
737
664
|
return function getLoadMoreTicket() {
|
|
738
|
-
return
|
|
665
|
+
return _ref6.apply(this, arguments);
|
|
739
666
|
};
|
|
740
667
|
}();
|
|
741
668
|
/*=======================================================================
|
|
@@ -744,18 +671,18 @@ var ContentChat = function ContentChat(props) {
|
|
|
744
671
|
|
|
745
672
|
|
|
746
673
|
var getUpdateLatestMerchantProduct = /*#__PURE__*/function () {
|
|
747
|
-
var
|
|
674
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
748
675
|
var fromUpdate,
|
|
749
676
|
paramsQuery,
|
|
750
677
|
paramsHeaders,
|
|
751
678
|
response,
|
|
752
679
|
newSingleChat,
|
|
753
|
-
|
|
754
|
-
return _regenerator.default.wrap(function
|
|
680
|
+
_args7 = arguments;
|
|
681
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
755
682
|
while (1) {
|
|
756
|
-
switch (
|
|
683
|
+
switch (_context7.prev = _context7.next) {
|
|
757
684
|
case 0:
|
|
758
|
-
fromUpdate =
|
|
685
|
+
fromUpdate = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
|
|
759
686
|
paramsQuery = {
|
|
760
687
|
getType: "updateLatest",
|
|
761
688
|
id: JSON.stringify(dataChat.id),
|
|
@@ -765,14 +692,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
765
692
|
paramsHeaders = {
|
|
766
693
|
Authorization: dataChat.userToken
|
|
767
694
|
};
|
|
768
|
-
|
|
695
|
+
_context7.next = 5;
|
|
769
696
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery, paramsHeaders);
|
|
770
697
|
|
|
771
698
|
case 5:
|
|
772
|
-
response =
|
|
699
|
+
response = _context7.sent;
|
|
773
700
|
|
|
774
701
|
if (response.body) {
|
|
775
|
-
|
|
702
|
+
_context7.next = 9;
|
|
776
703
|
break;
|
|
777
704
|
}
|
|
778
705
|
|
|
@@ -780,7 +707,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
780
707
|
message: response.message,
|
|
781
708
|
errorDetail: response.errorDetail
|
|
782
709
|
});
|
|
783
|
-
return
|
|
710
|
+
return _context7.abrupt("return");
|
|
784
711
|
|
|
785
712
|
case 9:
|
|
786
713
|
// success
|
|
@@ -797,29 +724,29 @@ var ContentChat = function ContentChat(props) {
|
|
|
797
724
|
|
|
798
725
|
case 15:
|
|
799
726
|
case "end":
|
|
800
|
-
return
|
|
727
|
+
return _context7.stop();
|
|
801
728
|
}
|
|
802
729
|
}
|
|
803
|
-
},
|
|
730
|
+
}, _callee7);
|
|
804
731
|
}));
|
|
805
732
|
|
|
806
733
|
return function getUpdateLatestMerchantProduct() {
|
|
807
|
-
return
|
|
734
|
+
return _ref7.apply(this, arguments);
|
|
808
735
|
};
|
|
809
736
|
}();
|
|
810
737
|
|
|
811
738
|
var getUpdateLatestOrderProduct = /*#__PURE__*/function () {
|
|
812
|
-
var
|
|
739
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
813
740
|
var fromUpdate,
|
|
814
741
|
paramsQuery,
|
|
815
742
|
response,
|
|
816
743
|
companiesList,
|
|
817
|
-
|
|
818
|
-
return _regenerator.default.wrap(function
|
|
744
|
+
_args8 = arguments;
|
|
745
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
819
746
|
while (1) {
|
|
820
|
-
switch (
|
|
747
|
+
switch (_context8.prev = _context8.next) {
|
|
821
748
|
case 0:
|
|
822
|
-
fromUpdate =
|
|
749
|
+
fromUpdate = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : false;
|
|
823
750
|
paramsQuery = {
|
|
824
751
|
getType: "updateLatest",
|
|
825
752
|
id: JSON.stringify(dataChat.id),
|
|
@@ -831,14 +758,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
831
758
|
othersCompanyId: encodeURIComponent(JSON.stringify(Object.keys(companies))),
|
|
832
759
|
date: encodeURIComponent(lastUpdateDate)
|
|
833
760
|
};
|
|
834
|
-
|
|
761
|
+
_context8.next = 4;
|
|
835
762
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
|
|
836
763
|
|
|
837
764
|
case 4:
|
|
838
|
-
response =
|
|
765
|
+
response = _context8.sent;
|
|
839
766
|
|
|
840
767
|
if (response.body) {
|
|
841
|
-
|
|
768
|
+
_context8.next = 8;
|
|
842
769
|
break;
|
|
843
770
|
}
|
|
844
771
|
|
|
@@ -846,7 +773,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
846
773
|
message: response.message,
|
|
847
774
|
errorDetail: response.errorDetail
|
|
848
775
|
});
|
|
849
|
-
return
|
|
776
|
+
return _context8.abrupt("return");
|
|
850
777
|
|
|
851
778
|
case 8:
|
|
852
779
|
// success
|
|
@@ -907,19 +834,19 @@ var ContentChat = function ContentChat(props) {
|
|
|
907
834
|
|
|
908
835
|
case 10:
|
|
909
836
|
case "end":
|
|
910
|
-
return
|
|
837
|
+
return _context8.stop();
|
|
911
838
|
}
|
|
912
839
|
}
|
|
913
|
-
},
|
|
840
|
+
}, _callee8);
|
|
914
841
|
}));
|
|
915
842
|
|
|
916
843
|
return function getUpdateLatestOrderProduct() {
|
|
917
|
-
return
|
|
844
|
+
return _ref8.apply(this, arguments);
|
|
918
845
|
};
|
|
919
846
|
}();
|
|
920
847
|
|
|
921
848
|
var getUpdateLatestTicket = /*#__PURE__*/function () {
|
|
922
|
-
var
|
|
849
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
923
850
|
var _dataChat$currentUser9, _dataChat$currentUser10, _dataChat$currentUser11, _dataChat$currentUser12;
|
|
924
851
|
|
|
925
852
|
var fromUpdate,
|
|
@@ -927,19 +854,19 @@ var ContentChat = function ContentChat(props) {
|
|
|
927
854
|
paramsQuery,
|
|
928
855
|
response,
|
|
929
856
|
newSingleChat,
|
|
930
|
-
|
|
931
|
-
return _regenerator.default.wrap(function
|
|
857
|
+
_args9 = arguments;
|
|
858
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
932
859
|
while (1) {
|
|
933
|
-
switch (
|
|
860
|
+
switch (_context9.prev = _context9.next) {
|
|
934
861
|
case 0:
|
|
935
|
-
fromUpdate =
|
|
862
|
+
fromUpdate = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : false;
|
|
936
863
|
|
|
937
864
|
if (!(singleChat.statusChat === "closed")) {
|
|
938
|
-
|
|
865
|
+
_context9.next = 3;
|
|
939
866
|
break;
|
|
940
867
|
}
|
|
941
868
|
|
|
942
|
-
return
|
|
869
|
+
return _context9.abrupt("return");
|
|
943
870
|
|
|
944
871
|
case 3:
|
|
945
872
|
dataUser = {
|
|
@@ -954,20 +881,20 @@ var ContentChat = function ContentChat(props) {
|
|
|
954
881
|
currentUser: (0, _utils.encodeUriJson)(dataUser),
|
|
955
882
|
currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
|
|
956
883
|
};
|
|
957
|
-
|
|
884
|
+
_context9.next = 7;
|
|
958
885
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
|
|
959
886
|
Authorization: (_dataChat$currentUser12 = dataChat.currentUser) === null || _dataChat$currentUser12 === void 0 ? void 0 : _dataChat$currentUser12.token
|
|
960
887
|
});
|
|
961
888
|
|
|
962
889
|
case 7:
|
|
963
|
-
response =
|
|
890
|
+
response = _context9.sent;
|
|
964
891
|
//programar update en 20s
|
|
965
892
|
setStartUpdate(function (prev) {
|
|
966
893
|
return prev + 1;
|
|
967
894
|
});
|
|
968
895
|
|
|
969
896
|
if (response.body) {
|
|
970
|
-
|
|
897
|
+
_context9.next = 13;
|
|
971
898
|
break;
|
|
972
899
|
}
|
|
973
900
|
|
|
@@ -989,7 +916,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
989
916
|
message: response.message,
|
|
990
917
|
errorDetail: response.errorDetail
|
|
991
918
|
});
|
|
992
|
-
return
|
|
919
|
+
return _context9.abrupt("return");
|
|
993
920
|
|
|
994
921
|
case 13:
|
|
995
922
|
// limpiar error update
|
|
@@ -1003,11 +930,11 @@ var ContentChat = function ContentChat(props) {
|
|
|
1003
930
|
updateAllUsers(response.body.users); // actualizar los items del chat
|
|
1004
931
|
|
|
1005
932
|
if (!(response.body.items.length === 0)) {
|
|
1006
|
-
|
|
933
|
+
_context9.next = 18;
|
|
1007
934
|
break;
|
|
1008
935
|
}
|
|
1009
936
|
|
|
1010
|
-
return
|
|
937
|
+
return _context9.abrupt("return");
|
|
1011
938
|
|
|
1012
939
|
case 18:
|
|
1013
940
|
newSingleChat = (0, _objectSpread3.default)({}, singleChat);
|
|
@@ -1017,14 +944,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
1017
944
|
|
|
1018
945
|
case 22:
|
|
1019
946
|
case "end":
|
|
1020
|
-
return
|
|
947
|
+
return _context9.stop();
|
|
1021
948
|
}
|
|
1022
949
|
}
|
|
1023
|
-
},
|
|
950
|
+
}, _callee9);
|
|
1024
951
|
}));
|
|
1025
952
|
|
|
1026
953
|
return function getUpdateLatestTicket() {
|
|
1027
|
-
return
|
|
954
|
+
return _ref9.apply(this, arguments);
|
|
1028
955
|
};
|
|
1029
956
|
}();
|
|
1030
957
|
/*=======================================================================
|
|
@@ -1041,206 +968,191 @@ var ContentChat = function ContentChat(props) {
|
|
|
1041
968
|
|
|
1042
969
|
|
|
1043
970
|
var createItemsChat = /*#__PURE__*/function () {
|
|
1044
|
-
var
|
|
971
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
1045
972
|
var items,
|
|
1046
973
|
_iterator,
|
|
1047
974
|
_step,
|
|
1048
975
|
item,
|
|
1049
976
|
errorCreate,
|
|
1050
|
-
|
|
977
|
+
_args10 = arguments;
|
|
1051
978
|
|
|
1052
|
-
return _regenerator.default.wrap(function
|
|
979
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1053
980
|
while (1) {
|
|
1054
|
-
switch (
|
|
981
|
+
switch (_context10.prev = _context10.next) {
|
|
1055
982
|
case 0:
|
|
1056
|
-
items =
|
|
983
|
+
items = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : [];
|
|
1057
984
|
|
|
1058
985
|
if (!(items.length === 0)) {
|
|
1059
|
-
|
|
986
|
+
_context10.next = 3;
|
|
1060
987
|
break;
|
|
1061
988
|
}
|
|
1062
989
|
|
|
1063
|
-
return
|
|
990
|
+
return _context10.abrupt("return", {
|
|
1064
991
|
message: "No se especifico ningun mensaje, imagen o archivo nuevo " + "que se quiera enviar al chat",
|
|
1065
992
|
errorDetail: "Reporta esto a TI"
|
|
1066
993
|
});
|
|
1067
994
|
|
|
1068
995
|
case 3:
|
|
1069
996
|
_iterator = (0, _createForOfIteratorHelper2.default)(items);
|
|
1070
|
-
|
|
997
|
+
_context10.prev = 4;
|
|
1071
998
|
|
|
1072
999
|
_iterator.s();
|
|
1073
1000
|
|
|
1074
1001
|
case 6:
|
|
1075
1002
|
if ((_step = _iterator.n()).done) {
|
|
1076
|
-
|
|
1003
|
+
_context10.next = 14;
|
|
1077
1004
|
break;
|
|
1078
1005
|
}
|
|
1079
1006
|
|
|
1080
1007
|
item = _step.value;
|
|
1081
1008
|
|
|
1082
1009
|
if (["message", "img", "file"].includes(item.type)) {
|
|
1083
|
-
|
|
1010
|
+
_context10.next = 10;
|
|
1084
1011
|
break;
|
|
1085
1012
|
}
|
|
1086
1013
|
|
|
1087
|
-
return
|
|
1014
|
+
return _context10.abrupt("return", {
|
|
1088
1015
|
message: "Uno de los elementos que se quiere enviar al chat " + "no es un tipo valido \"".concat(item.type, "\""),
|
|
1089
1016
|
errorDetail: "Reporta esto a TI"
|
|
1090
1017
|
});
|
|
1091
1018
|
|
|
1092
1019
|
case 10:
|
|
1093
1020
|
if (!(0, _utils.isStringEmpty)(item.value)) {
|
|
1094
|
-
|
|
1021
|
+
_context10.next = 12;
|
|
1095
1022
|
break;
|
|
1096
1023
|
}
|
|
1097
1024
|
|
|
1098
|
-
return
|
|
1025
|
+
return _context10.abrupt("return", {
|
|
1099
1026
|
message: "Uno de los elementos que se quiere enviar al chat " + "contiene un valor vacio",
|
|
1100
1027
|
errorDetail: "Reporta esto a TI"
|
|
1101
1028
|
});
|
|
1102
1029
|
|
|
1103
1030
|
case 12:
|
|
1104
|
-
|
|
1031
|
+
_context10.next = 6;
|
|
1105
1032
|
break;
|
|
1106
1033
|
|
|
1107
1034
|
case 14:
|
|
1108
|
-
|
|
1035
|
+
_context10.next = 19;
|
|
1109
1036
|
break;
|
|
1110
1037
|
|
|
1111
1038
|
case 16:
|
|
1112
|
-
|
|
1113
|
-
|
|
1039
|
+
_context10.prev = 16;
|
|
1040
|
+
_context10.t0 = _context10["catch"](4);
|
|
1114
1041
|
|
|
1115
|
-
_iterator.e(
|
|
1042
|
+
_iterator.e(_context10.t0);
|
|
1116
1043
|
|
|
1117
1044
|
case 19:
|
|
1118
|
-
|
|
1045
|
+
_context10.prev = 19;
|
|
1119
1046
|
|
|
1120
1047
|
_iterator.f();
|
|
1121
1048
|
|
|
1122
|
-
return
|
|
1049
|
+
return _context10.finish(19);
|
|
1123
1050
|
|
|
1124
1051
|
case 22:
|
|
1125
1052
|
stopUpdate(); // finalizamos el temporizador
|
|
1126
1053
|
// enviar items a la BD
|
|
1127
1054
|
|
|
1128
1055
|
if (!(chatType === "merchant_product")) {
|
|
1129
|
-
|
|
1056
|
+
_context10.next = 29;
|
|
1130
1057
|
break;
|
|
1131
1058
|
}
|
|
1132
1059
|
|
|
1133
|
-
|
|
1060
|
+
_context10.next = 26;
|
|
1134
1061
|
return createItemsMerchantProduct(items);
|
|
1135
1062
|
|
|
1136
1063
|
case 26:
|
|
1137
|
-
errorCreate =
|
|
1138
|
-
|
|
1064
|
+
errorCreate = _context10.sent;
|
|
1065
|
+
_context10.next = 38;
|
|
1139
1066
|
break;
|
|
1140
1067
|
|
|
1141
1068
|
case 29:
|
|
1142
|
-
if (!(chatType === "product_status")) {
|
|
1143
|
-
_context11.next = 35;
|
|
1144
|
-
break;
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
_context11.next = 32;
|
|
1148
|
-
return createItemsProductStatus(items);
|
|
1149
|
-
|
|
1150
|
-
case 32:
|
|
1151
|
-
errorCreate = _context11.sent;
|
|
1152
|
-
_context11.next = 44;
|
|
1153
|
-
break;
|
|
1154
|
-
|
|
1155
|
-
case 35:
|
|
1156
1069
|
if (!(chatType === "order_product")) {
|
|
1157
|
-
|
|
1070
|
+
_context10.next = 35;
|
|
1158
1071
|
break;
|
|
1159
1072
|
}
|
|
1160
1073
|
|
|
1161
|
-
|
|
1074
|
+
_context10.next = 32;
|
|
1162
1075
|
return createItemsOrderProduct(items);
|
|
1163
1076
|
|
|
1164
|
-
case
|
|
1165
|
-
errorCreate =
|
|
1166
|
-
|
|
1077
|
+
case 32:
|
|
1078
|
+
errorCreate = _context10.sent;
|
|
1079
|
+
_context10.next = 38;
|
|
1167
1080
|
break;
|
|
1168
1081
|
|
|
1169
|
-
case
|
|
1170
|
-
|
|
1082
|
+
case 35:
|
|
1083
|
+
_context10.next = 37;
|
|
1171
1084
|
return createItemsTicket(items);
|
|
1172
1085
|
|
|
1173
|
-
case
|
|
1174
|
-
errorCreate =
|
|
1086
|
+
case 37:
|
|
1087
|
+
errorCreate = _context10.sent;
|
|
1175
1088
|
|
|
1176
|
-
case
|
|
1177
|
-
if (!
|
|
1178
|
-
|
|
1089
|
+
case 38:
|
|
1090
|
+
if (!(chatType === "merchant_product")) {
|
|
1091
|
+
_context10.next = 43;
|
|
1179
1092
|
break;
|
|
1180
1093
|
}
|
|
1181
1094
|
|
|
1182
|
-
|
|
1095
|
+
_context10.next = 41;
|
|
1183
1096
|
return getUpdateLatestMerchantProduct();
|
|
1184
1097
|
|
|
1185
|
-
case
|
|
1186
|
-
|
|
1098
|
+
case 41:
|
|
1099
|
+
_context10.next = 50;
|
|
1187
1100
|
break;
|
|
1188
1101
|
|
|
1189
|
-
case
|
|
1102
|
+
case 43:
|
|
1190
1103
|
if (!(chatType === "order_product")) {
|
|
1191
|
-
|
|
1104
|
+
_context10.next = 48;
|
|
1192
1105
|
break;
|
|
1193
1106
|
}
|
|
1194
1107
|
|
|
1195
|
-
|
|
1108
|
+
_context10.next = 46;
|
|
1196
1109
|
return getUpdateLatestOrderProduct();
|
|
1197
1110
|
|
|
1198
|
-
case
|
|
1199
|
-
|
|
1111
|
+
case 46:
|
|
1112
|
+
_context10.next = 50;
|
|
1200
1113
|
break;
|
|
1201
1114
|
|
|
1202
|
-
case
|
|
1203
|
-
|
|
1115
|
+
case 48:
|
|
1116
|
+
_context10.next = 50;
|
|
1204
1117
|
return getUpdateLatestTicket();
|
|
1205
1118
|
|
|
1206
|
-
case
|
|
1119
|
+
case 50:
|
|
1207
1120
|
if (!errorCreate) {
|
|
1208
|
-
|
|
1121
|
+
_context10.next = 52;
|
|
1209
1122
|
break;
|
|
1210
1123
|
}
|
|
1211
1124
|
|
|
1212
|
-
return
|
|
1125
|
+
return _context10.abrupt("return", errorCreate);
|
|
1213
1126
|
|
|
1214
|
-
case
|
|
1127
|
+
case 52:
|
|
1215
1128
|
case "end":
|
|
1216
|
-
return
|
|
1129
|
+
return _context10.stop();
|
|
1217
1130
|
}
|
|
1218
1131
|
}
|
|
1219
|
-
},
|
|
1132
|
+
}, _callee10, null, [[4, 16, 19, 22]]);
|
|
1220
1133
|
}));
|
|
1221
1134
|
|
|
1222
1135
|
return function createItemsChat() {
|
|
1223
|
-
return
|
|
1136
|
+
return _ref10.apply(this, arguments);
|
|
1224
1137
|
};
|
|
1225
1138
|
}();
|
|
1226
1139
|
|
|
1227
1140
|
var createItemsMerchantProduct = /*#__PURE__*/function () {
|
|
1228
|
-
var
|
|
1141
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1229
1142
|
var items,
|
|
1230
1143
|
id,
|
|
1231
1144
|
version,
|
|
1232
|
-
orderId,
|
|
1233
1145
|
retailerId,
|
|
1234
1146
|
paramsBody,
|
|
1235
1147
|
paramsHeaders,
|
|
1236
1148
|
response,
|
|
1237
|
-
|
|
1238
|
-
return _regenerator.default.wrap(function
|
|
1149
|
+
_args11 = arguments;
|
|
1150
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1239
1151
|
while (1) {
|
|
1240
|
-
switch (
|
|
1152
|
+
switch (_context11.prev = _context11.next) {
|
|
1241
1153
|
case 0:
|
|
1242
|
-
items =
|
|
1243
|
-
id = dataChat.id, version = dataChat.version
|
|
1154
|
+
items = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : [];
|
|
1155
|
+
id = dataChat.id, version = dataChat.version;
|
|
1244
1156
|
retailerId = activeRetailer.id;
|
|
1245
1157
|
paramsBody = {
|
|
1246
1158
|
id: id,
|
|
@@ -1248,110 +1160,50 @@ var ContentChat = function ContentChat(props) {
|
|
|
1248
1160
|
items: items,
|
|
1249
1161
|
retailerId: retailerId
|
|
1250
1162
|
};
|
|
1251
|
-
if (chatType === "product_status") paramsBody["orderId"] = orderId;
|
|
1252
1163
|
paramsHeaders = {
|
|
1253
1164
|
Authorization: dataChat.userToken
|
|
1254
1165
|
};
|
|
1255
|
-
|
|
1166
|
+
_context11.next = 7;
|
|
1256
1167
|
return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody, paramsHeaders);
|
|
1257
1168
|
|
|
1258
|
-
case 8:
|
|
1259
|
-
response = _context12.sent;
|
|
1260
|
-
|
|
1261
|
-
if (response.body) {
|
|
1262
|
-
_context12.next = 11;
|
|
1263
|
-
break;
|
|
1264
|
-
}
|
|
1265
|
-
|
|
1266
|
-
return _context12.abrupt("return", {
|
|
1267
|
-
message: response.message,
|
|
1268
|
-
errorDetail: response.errorDetail
|
|
1269
|
-
});
|
|
1270
|
-
|
|
1271
|
-
case 11:
|
|
1272
|
-
case "end":
|
|
1273
|
-
return _context12.stop();
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
}, _callee12);
|
|
1277
|
-
}));
|
|
1278
|
-
|
|
1279
|
-
return function createItemsMerchantProduct() {
|
|
1280
|
-
return _ref12.apply(this, arguments);
|
|
1281
|
-
};
|
|
1282
|
-
}();
|
|
1283
|
-
|
|
1284
|
-
var createItemsProductStatus = /*#__PURE__*/function () {
|
|
1285
|
-
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1286
|
-
var items,
|
|
1287
|
-
id,
|
|
1288
|
-
version,
|
|
1289
|
-
orderId,
|
|
1290
|
-
status,
|
|
1291
|
-
retailerId,
|
|
1292
|
-
paramsBody,
|
|
1293
|
-
paramsHeaders,
|
|
1294
|
-
response,
|
|
1295
|
-
_args13 = arguments;
|
|
1296
|
-
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1297
|
-
while (1) {
|
|
1298
|
-
switch (_context13.prev = _context13.next) {
|
|
1299
|
-
case 0:
|
|
1300
|
-
items = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : [];
|
|
1301
|
-
id = dataChat.id, version = dataChat.version, orderId = dataChat.orderId, status = dataChat.status;
|
|
1302
|
-
retailerId = activeRetailer.id;
|
|
1303
|
-
paramsBody = {
|
|
1304
|
-
id: id,
|
|
1305
|
-
version: version,
|
|
1306
|
-
items: items,
|
|
1307
|
-
retailerId: retailerId,
|
|
1308
|
-
orderId: orderId,
|
|
1309
|
-
status: status
|
|
1310
|
-
};
|
|
1311
|
-
paramsHeaders = {
|
|
1312
|
-
Authorization: dataChat.userToken
|
|
1313
|
-
};
|
|
1314
|
-
_context13.next = 7;
|
|
1315
|
-
return (0, _handle_http.fetchPOST)(process.env.REACT_APP_CREATE_MESSAGES, paramsBody, paramsHeaders);
|
|
1316
|
-
|
|
1317
1169
|
case 7:
|
|
1318
|
-
response =
|
|
1170
|
+
response = _context11.sent;
|
|
1319
1171
|
|
|
1320
1172
|
if (response.body) {
|
|
1321
|
-
|
|
1173
|
+
_context11.next = 10;
|
|
1322
1174
|
break;
|
|
1323
1175
|
}
|
|
1324
1176
|
|
|
1325
|
-
return
|
|
1177
|
+
return _context11.abrupt("return", {
|
|
1326
1178
|
message: response.message,
|
|
1327
1179
|
errorDetail: response.errorDetail
|
|
1328
1180
|
});
|
|
1329
1181
|
|
|
1330
1182
|
case 10:
|
|
1331
1183
|
case "end":
|
|
1332
|
-
return
|
|
1184
|
+
return _context11.stop();
|
|
1333
1185
|
}
|
|
1334
1186
|
}
|
|
1335
|
-
},
|
|
1187
|
+
}, _callee11);
|
|
1336
1188
|
}));
|
|
1337
1189
|
|
|
1338
|
-
return function
|
|
1339
|
-
return
|
|
1190
|
+
return function createItemsMerchantProduct() {
|
|
1191
|
+
return _ref11.apply(this, arguments);
|
|
1340
1192
|
};
|
|
1341
1193
|
}();
|
|
1342
1194
|
|
|
1343
1195
|
var createItemsOrderProduct = /*#__PURE__*/function () {
|
|
1344
|
-
var
|
|
1196
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1345
1197
|
var items,
|
|
1346
1198
|
paramsBody,
|
|
1347
1199
|
paramsHeaders,
|
|
1348
1200
|
response,
|
|
1349
|
-
|
|
1350
|
-
return _regenerator.default.wrap(function
|
|
1201
|
+
_args12 = arguments;
|
|
1202
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1351
1203
|
while (1) {
|
|
1352
|
-
switch (
|
|
1204
|
+
switch (_context12.prev = _context12.next) {
|
|
1353
1205
|
case 0:
|
|
1354
|
-
items =
|
|
1206
|
+
items = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : [];
|
|
1355
1207
|
paramsBody = {
|
|
1356
1208
|
id: dataChat.id,
|
|
1357
1209
|
version: currentArticle.version,
|
|
@@ -1362,47 +1214,47 @@ var ContentChat = function ContentChat(props) {
|
|
|
1362
1214
|
paramsHeaders = {
|
|
1363
1215
|
Authorization: dataChat.userToken
|
|
1364
1216
|
};
|
|
1365
|
-
|
|
1217
|
+
_context12.next = 5;
|
|
1366
1218
|
return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody, paramsHeaders);
|
|
1367
1219
|
|
|
1368
1220
|
case 5:
|
|
1369
|
-
response =
|
|
1221
|
+
response = _context12.sent;
|
|
1370
1222
|
|
|
1371
1223
|
if (response.body) {
|
|
1372
|
-
|
|
1224
|
+
_context12.next = 8;
|
|
1373
1225
|
break;
|
|
1374
1226
|
}
|
|
1375
1227
|
|
|
1376
|
-
return
|
|
1228
|
+
return _context12.abrupt("return", {
|
|
1377
1229
|
message: response.message,
|
|
1378
1230
|
errorDetail: response.errorDetail
|
|
1379
1231
|
});
|
|
1380
1232
|
|
|
1381
1233
|
case 8:
|
|
1382
1234
|
case "end":
|
|
1383
|
-
return
|
|
1235
|
+
return _context12.stop();
|
|
1384
1236
|
}
|
|
1385
1237
|
}
|
|
1386
|
-
},
|
|
1238
|
+
}, _callee12);
|
|
1387
1239
|
}));
|
|
1388
1240
|
|
|
1389
1241
|
return function createItemsOrderProduct() {
|
|
1390
|
-
return
|
|
1242
|
+
return _ref12.apply(this, arguments);
|
|
1391
1243
|
};
|
|
1392
1244
|
}();
|
|
1393
1245
|
|
|
1394
1246
|
var createItemsTicket = /*#__PURE__*/function () {
|
|
1395
|
-
var
|
|
1247
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1396
1248
|
var items,
|
|
1397
1249
|
paramsBody,
|
|
1398
1250
|
paramsHeaders,
|
|
1399
1251
|
response,
|
|
1400
|
-
|
|
1401
|
-
return _regenerator.default.wrap(function
|
|
1252
|
+
_args13 = arguments;
|
|
1253
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1402
1254
|
while (1) {
|
|
1403
|
-
switch (
|
|
1255
|
+
switch (_context13.prev = _context13.next) {
|
|
1404
1256
|
case 0:
|
|
1405
|
-
items =
|
|
1257
|
+
items = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : [];
|
|
1406
1258
|
paramsBody = {
|
|
1407
1259
|
id: JSON.stringify(dataChat.id),
|
|
1408
1260
|
userId: JSON.stringify(dataChat.currentUser.id),
|
|
@@ -1411,32 +1263,32 @@ var ContentChat = function ContentChat(props) {
|
|
|
1411
1263
|
paramsHeaders = {
|
|
1412
1264
|
Authorization: dataChat.userToken
|
|
1413
1265
|
};
|
|
1414
|
-
|
|
1266
|
+
_context13.next = 5;
|
|
1415
1267
|
return (0, _handle_http.fetchPOST)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsBody, paramsHeaders);
|
|
1416
1268
|
|
|
1417
1269
|
case 5:
|
|
1418
|
-
response =
|
|
1270
|
+
response = _context13.sent;
|
|
1419
1271
|
|
|
1420
1272
|
if (response.body) {
|
|
1421
|
-
|
|
1273
|
+
_context13.next = 8;
|
|
1422
1274
|
break;
|
|
1423
1275
|
}
|
|
1424
1276
|
|
|
1425
|
-
return
|
|
1277
|
+
return _context13.abrupt("return", {
|
|
1426
1278
|
message: response.message,
|
|
1427
1279
|
errorDetail: response.errorDetail
|
|
1428
1280
|
});
|
|
1429
1281
|
|
|
1430
1282
|
case 8:
|
|
1431
1283
|
case "end":
|
|
1432
|
-
return
|
|
1284
|
+
return _context13.stop();
|
|
1433
1285
|
}
|
|
1434
1286
|
}
|
|
1435
|
-
},
|
|
1287
|
+
}, _callee13);
|
|
1436
1288
|
}));
|
|
1437
1289
|
|
|
1438
1290
|
return function createItemsTicket() {
|
|
1439
|
-
return
|
|
1291
|
+
return _ref13.apply(this, arguments);
|
|
1440
1292
|
};
|
|
1441
1293
|
}();
|
|
1442
1294
|
/*=======================================================================
|
|
@@ -1445,7 +1297,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1445
1297
|
|
|
1446
1298
|
|
|
1447
1299
|
var isSingleChat = function isSingleChat() {
|
|
1448
|
-
if (chatType === "merchant_product" || chatType === "ticket"
|
|
1300
|
+
if (chatType === "merchant_product" || chatType === "ticket") {
|
|
1449
1301
|
return true;
|
|
1450
1302
|
}
|
|
1451
1303
|
|
|
@@ -1563,7 +1415,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1563
1415
|
var items;
|
|
1564
1416
|
var enabledLoadMore;
|
|
1565
1417
|
|
|
1566
|
-
if (["merchant_product", "ticket"
|
|
1418
|
+
if (["merchant_product", "ticket"].includes(chatType)) {
|
|
1567
1419
|
items = singleChat.items;
|
|
1568
1420
|
enabledLoadMore = singleChat.enabledLoadMore;
|
|
1569
1421
|
} // ORDER_PRODUCT
|
|
@@ -1604,7 +1456,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1604
1456
|
chatType: chatType,
|
|
1605
1457
|
activeCompanyId: activeCompanyId,
|
|
1606
1458
|
ticketCompany: ticketCompany,
|
|
1607
|
-
currentUser: ["merchant_product", "order_product"
|
|
1459
|
+
currentUser: ["merchant_product", "order_product"].includes(chatType) ? currentUser : dataChat.currentUser,
|
|
1608
1460
|
onClickBtnLoadMore: chatType === "merchant_product" ? getLoadMoreMerchantProduct : chatType === "order_product" ? getLoadMoreOrderProduct : getLoadMoreTicket
|
|
1609
1461
|
});
|
|
1610
1462
|
} else {
|
|
@@ -1633,10 +1485,6 @@ var ContentChat = function ContentChat(props) {
|
|
|
1633
1485
|
version: currentArticle.version
|
|
1634
1486
|
} : chatType === "ticket" ? {
|
|
1635
1487
|
id: dataChat.id
|
|
1636
|
-
} : chatType === "product_status" ? {
|
|
1637
|
-
id: dataChat.id,
|
|
1638
|
-
version: dataChat.version,
|
|
1639
|
-
retailerId: dataChat.retailerId
|
|
1640
1488
|
} : undefined,
|
|
1641
1489
|
chatCompany: getChatCompany(),
|
|
1642
1490
|
statusChat: chatType === "order_product" ? (_getChatCompany = getChatCompany()) === null || _getChatCompany === void 0 ? void 0 : _getChatCompany.statusChat : chatType === "ticket" ? singleChat.statusChat : undefined,
|