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