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