contentoh-components-library 21.4.15 → 21.4.17
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 +1 -5
- package/.env.production +1 -3
- package/dist/components/atoms/Avatar/index.js +2 -3
- 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 -7
- package/dist/components/atoms/CheckBox/styles.js +1 -1
- package/dist/components/atoms/InputFormatter/styles.js +1 -1
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +11 -68
- package/dist/components/molecules/TagAndInput/index.js +1 -1
- package/dist/components/organisms/Chat/Chat.stories.js +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 +197 -350
- 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/Modal/styles.js +1 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +120 -88
- package/dist/components/pages/ProviderProductEdition/index.js +200 -216
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +52 -56
- package/dist/components/pages/RetailerProductEdition/index.js +300 -318
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
- package/dist/index.js +52 -247
- package/package.json +1 -4
- package/src/components/atoms/Avatar/index.js +2 -8
- 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 +1 -4
- package/src/components/atoms/CheckBox/styles.js +0 -2
- package/src/components/atoms/InputFormatter/styles.js +1 -2
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +6 -52
- package/src/components/molecules/TagAndInput/index.js +8 -10
- package/src/components/organisms/Chat/Chat.stories.js +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 +12 -88
- 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/Modal/styles.js +1 -4
- package/src/components/organisms/OrderDetail/utils/Table/utils.js +16 -6
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +127 -95
- package/src/components/pages/ProviderProductEdition/index.js +129 -135
- package/src/components/pages/ProviderProductEdition/styles.js +1 -5
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +52 -55
- package/src/components/pages/RetailerProductEdition/index.js +136 -124
- package/src/components/pages/RetailerProductEdition/styles.js +0 -4
- package/src/components/pages/RetailerProductEdition/utils.js +0 -37
- package/src/index.js +0 -16
- package/dist/assets/fonts/roboto/LICENSE.txt +0 -202
- package/src/components/atoms/ImageCarousel/ImgeSlider.stories.js +0 -76
- package/src/components/atoms/ImageCarousel/index.js +0 -103
- package/src/components/atoms/ImageCarousel/styles.js +0 -79
- package/src/components/atoms/PercentTag/PercentTag.stories.js +0 -7
- package/src/components/atoms/PercentTag/index.js +0 -9
- package/src/components/atoms/PercentTag/styles.js +0 -69
- package/src/components/atoms/RatingStars/RatingStars.stories.js +0 -10
- package/src/components/atoms/RatingStars/index.js +0 -31
- package/src/components/atoms/RatingStars/styles.js +0 -28
- package/src/components/atoms/RetailerCatalog/RetailerCatalog.stories.js +0 -36
- package/src/components/atoms/RetailerCatalog/index.js +0 -49
- package/src/components/atoms/RetailerCatalog/styles.js +0 -30
- package/src/components/atoms/RetailerOption/RetailerOption.stories.js +0 -15
- package/src/components/atoms/RetailerOption/index.js +0 -53
- package/src/components/atoms/RetailerOption/styles.js +0 -41
- package/src/components/atoms/RetailersList/RetailersList.stories.js +0 -33
- package/src/components/atoms/RetailersList/index.js +0 -20
- package/src/components/atoms/RetailersList/styles.js +0 -19
- package/src/components/atoms/UserCatalog/UserCatalog.stories.js +0 -67
- package/src/components/atoms/UserCatalog/index.js +0 -100
- package/src/components/atoms/UserCatalog/styles.js +0 -24
- package/src/components/atoms/UserOption/UserOption.stories.js +0 -25
- package/src/components/atoms/UserOption/index.js +0 -95
- package/src/components/atoms/UserOption/styles.js +0 -61
- package/src/components/atoms/UserSelector/UserSelector.stories.js +0 -25
- package/src/components/atoms/UserSelector/index.js +0 -86
- package/src/components/atoms/UserSelector/styles.js +0 -55
- package/src/components/molecules/GridItem/GridItem.stories.js +0 -126
- package/src/components/molecules/GridItem/index.js +0 -105
- package/src/components/molecules/GridItem/styles.js +0 -104
- package/src/components/molecules/HeaderItem/ColumnItem.js +0 -9
- package/src/components/molecules/HeaderItem/HeaderItem.stories.js +0 -24
- package/src/components/molecules/HeaderItem/index.js +0 -26
- package/src/components/molecules/HeaderItem/styles.js +0 -27
- package/src/components/molecules/RowItem/ColumnItem.js +0 -9
- package/src/components/molecules/RowItem/RowItem.stories.js +0 -5660
- package/src/components/molecules/RowItem/index.js +0 -45
- package/src/components/molecules/RowItem/styles.js +0 -40
- 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/GridProducts/GridProducts.stories.js +0 -5485
- package/src/components/organisms/GridProducts/index.js +0 -50
- package/src/components/organisms/GridProducts/styles.js +0 -14
- package/src/components/organisms/GridProducts/utils.js +0 -111
- package/src/components/organisms/PanelLayout/PanelLayout.stories.js +0 -63
- package/src/components/organisms/PanelLayout/index.js +0 -11
- package/src/components/organisms/PanelLayout/styles.js +0 -33
- 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
|
|
|
@@ -500,20 +426,20 @@ var ContentChat = function ContentChat(props) {
|
|
|
500
426
|
currentUser: encodeURIComponent(JSON.stringify(dataUser)),
|
|
501
427
|
currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
|
|
502
428
|
};
|
|
503
|
-
|
|
429
|
+
_context3.next = 5;
|
|
504
430
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
|
|
505
431
|
Authorization: (_dataChat$currentUser4 = dataChat.currentUser) === null || _dataChat$currentUser4 === void 0 ? void 0 : _dataChat$currentUser4.token
|
|
506
432
|
});
|
|
507
433
|
|
|
508
434
|
case 5:
|
|
509
|
-
response =
|
|
435
|
+
response = _context3.sent;
|
|
510
436
|
// programar update en 20s
|
|
511
437
|
setStartUpdate(function (prev) {
|
|
512
438
|
return prev + 1;
|
|
513
439
|
});
|
|
514
440
|
|
|
515
441
|
if (response.body) {
|
|
516
|
-
|
|
442
|
+
_context3.next = 11;
|
|
517
443
|
break;
|
|
518
444
|
}
|
|
519
445
|
|
|
@@ -524,7 +450,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
524
450
|
errorDetail: response.errorDetail
|
|
525
451
|
});
|
|
526
452
|
setIsLoading(false);
|
|
527
|
-
return
|
|
453
|
+
return _context3.abrupt("return");
|
|
528
454
|
|
|
529
455
|
case 11:
|
|
530
456
|
// success
|
|
@@ -542,14 +468,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
542
468
|
|
|
543
469
|
case 16:
|
|
544
470
|
case "end":
|
|
545
|
-
return
|
|
471
|
+
return _context3.stop();
|
|
546
472
|
}
|
|
547
473
|
}
|
|
548
|
-
},
|
|
474
|
+
}, _callee3);
|
|
549
475
|
}));
|
|
550
476
|
|
|
551
477
|
return function getInitialTicket() {
|
|
552
|
-
return
|
|
478
|
+
return _ref3.apply(this, arguments);
|
|
553
479
|
};
|
|
554
480
|
}();
|
|
555
481
|
/*=======================================================================
|
|
@@ -558,11 +484,11 @@ var ContentChat = function ContentChat(props) {
|
|
|
558
484
|
|
|
559
485
|
|
|
560
486
|
var getLoadMoreMerchantProduct = /*#__PURE__*/function () {
|
|
561
|
-
var
|
|
487
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
562
488
|
var date, paramsQuery, response, newSingleChat;
|
|
563
|
-
return _regenerator.default.wrap(function
|
|
489
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
564
490
|
while (1) {
|
|
565
|
-
switch (
|
|
491
|
+
switch (_context4.prev = _context4.next) {
|
|
566
492
|
case 0:
|
|
567
493
|
clearTimeout(processUpdateID); // finalizamos el temporizador
|
|
568
494
|
|
|
@@ -573,18 +499,18 @@ var ContentChat = function ContentChat(props) {
|
|
|
573
499
|
version: JSON.stringify(dataChat.version),
|
|
574
500
|
date: encodeURIComponent(date)
|
|
575
501
|
};
|
|
576
|
-
|
|
502
|
+
_context4.next = 5;
|
|
577
503
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
|
|
578
504
|
|
|
579
505
|
case 5:
|
|
580
|
-
response =
|
|
506
|
+
response = _context4.sent;
|
|
581
507
|
|
|
582
508
|
if (response.body) {
|
|
583
|
-
|
|
509
|
+
_context4.next = 8;
|
|
584
510
|
break;
|
|
585
511
|
}
|
|
586
512
|
|
|
587
|
-
return
|
|
513
|
+
return _context4.abrupt("return", {
|
|
588
514
|
title: response.message,
|
|
589
515
|
message: response.errorDetail
|
|
590
516
|
});
|
|
@@ -601,23 +527,23 @@ var ContentChat = function ContentChat(props) {
|
|
|
601
527
|
|
|
602
528
|
case 13:
|
|
603
529
|
case "end":
|
|
604
|
-
return
|
|
530
|
+
return _context4.stop();
|
|
605
531
|
}
|
|
606
532
|
}
|
|
607
|
-
},
|
|
533
|
+
}, _callee4);
|
|
608
534
|
}));
|
|
609
535
|
|
|
610
536
|
return function getLoadMoreMerchantProduct() {
|
|
611
|
-
return
|
|
537
|
+
return _ref4.apply(this, arguments);
|
|
612
538
|
};
|
|
613
539
|
}();
|
|
614
540
|
|
|
615
541
|
var getLoadMoreOrderProduct = /*#__PURE__*/function () {
|
|
616
|
-
var
|
|
542
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
617
543
|
var company, date, paramsQuery, response;
|
|
618
|
-
return _regenerator.default.wrap(function
|
|
544
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
619
545
|
while (1) {
|
|
620
|
-
switch (
|
|
546
|
+
switch (_context5.prev = _context5.next) {
|
|
621
547
|
case 0:
|
|
622
548
|
clearTimeout(processUpdateID); // finalizamos el temporizador
|
|
623
549
|
|
|
@@ -632,18 +558,18 @@ var ContentChat = function ContentChat(props) {
|
|
|
632
558
|
date: encodeURIComponent(date),
|
|
633
559
|
othersCompanyId: JSON.stringify([activeCompanyId])
|
|
634
560
|
};
|
|
635
|
-
|
|
561
|
+
_context5.next = 6;
|
|
636
562
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
|
|
637
563
|
|
|
638
564
|
case 6:
|
|
639
|
-
response =
|
|
565
|
+
response = _context5.sent;
|
|
640
566
|
|
|
641
567
|
if (response.body) {
|
|
642
|
-
|
|
568
|
+
_context5.next = 9;
|
|
643
569
|
break;
|
|
644
570
|
}
|
|
645
571
|
|
|
646
|
-
return
|
|
572
|
+
return _context5.abrupt("return", {
|
|
647
573
|
title: response.message,
|
|
648
574
|
message: response.errorDetail
|
|
649
575
|
});
|
|
@@ -661,26 +587,26 @@ var ContentChat = function ContentChat(props) {
|
|
|
661
587
|
|
|
662
588
|
case 13:
|
|
663
589
|
case "end":
|
|
664
|
-
return
|
|
590
|
+
return _context5.stop();
|
|
665
591
|
}
|
|
666
592
|
}
|
|
667
|
-
},
|
|
593
|
+
}, _callee5);
|
|
668
594
|
}));
|
|
669
595
|
|
|
670
596
|
return function getLoadMoreOrderProduct() {
|
|
671
|
-
return
|
|
597
|
+
return _ref5.apply(this, arguments);
|
|
672
598
|
};
|
|
673
599
|
}(); // este GET obtiene la lista de compañoas con las que se puede chatear
|
|
674
600
|
|
|
675
601
|
|
|
676
602
|
var getLoadMoreTicket = /*#__PURE__*/function () {
|
|
677
|
-
var
|
|
603
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
678
604
|
var _dataChat$currentUser5, _dataChat$currentUser6, _dataChat$currentUser7, _dataChat$currentUser8;
|
|
679
605
|
|
|
680
606
|
var date, dataUser, paramsQuery, response, newSingleChat;
|
|
681
|
-
return _regenerator.default.wrap(function
|
|
607
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
682
608
|
while (1) {
|
|
683
|
-
switch (
|
|
609
|
+
switch (_context6.prev = _context6.next) {
|
|
684
610
|
case 0:
|
|
685
611
|
stopUpdate(); // finalizamos el temporizador
|
|
686
612
|
|
|
@@ -697,24 +623,24 @@ var ContentChat = function ContentChat(props) {
|
|
|
697
623
|
currentUser: (0, _utils.encodeUriJson)(dataUser),
|
|
698
624
|
currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
|
|
699
625
|
};
|
|
700
|
-
|
|
626
|
+
_context6.next = 6;
|
|
701
627
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
|
|
702
628
|
Authorization: (_dataChat$currentUser8 = dataChat.currentUser) === null || _dataChat$currentUser8 === void 0 ? void 0 : _dataChat$currentUser8.token
|
|
703
629
|
});
|
|
704
630
|
|
|
705
631
|
case 6:
|
|
706
|
-
response =
|
|
632
|
+
response = _context6.sent;
|
|
707
633
|
//programar update en 20s
|
|
708
634
|
setStartUpdate(function (prev) {
|
|
709
635
|
return prev + 1;
|
|
710
636
|
});
|
|
711
637
|
|
|
712
638
|
if (response.body) {
|
|
713
|
-
|
|
639
|
+
_context6.next = 10;
|
|
714
640
|
break;
|
|
715
641
|
}
|
|
716
642
|
|
|
717
|
-
return
|
|
643
|
+
return _context6.abrupt("return", {
|
|
718
644
|
title: response.message,
|
|
719
645
|
message: response.errorDetail
|
|
720
646
|
});
|
|
@@ -731,14 +657,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
731
657
|
|
|
732
658
|
case 15:
|
|
733
659
|
case "end":
|
|
734
|
-
return
|
|
660
|
+
return _context6.stop();
|
|
735
661
|
}
|
|
736
662
|
}
|
|
737
|
-
},
|
|
663
|
+
}, _callee6);
|
|
738
664
|
}));
|
|
739
665
|
|
|
740
666
|
return function getLoadMoreTicket() {
|
|
741
|
-
return
|
|
667
|
+
return _ref6.apply(this, arguments);
|
|
742
668
|
};
|
|
743
669
|
}();
|
|
744
670
|
/*=======================================================================
|
|
@@ -747,18 +673,18 @@ var ContentChat = function ContentChat(props) {
|
|
|
747
673
|
|
|
748
674
|
|
|
749
675
|
var getUpdateLatestMerchantProduct = /*#__PURE__*/function () {
|
|
750
|
-
var
|
|
676
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
751
677
|
var fromUpdate,
|
|
752
678
|
paramsQuery,
|
|
753
679
|
paramsHeaders,
|
|
754
680
|
response,
|
|
755
681
|
newSingleChat,
|
|
756
|
-
|
|
757
|
-
return _regenerator.default.wrap(function
|
|
682
|
+
_args7 = arguments;
|
|
683
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
758
684
|
while (1) {
|
|
759
|
-
switch (
|
|
685
|
+
switch (_context7.prev = _context7.next) {
|
|
760
686
|
case 0:
|
|
761
|
-
fromUpdate =
|
|
687
|
+
fromUpdate = _args7.length > 0 && _args7[0] !== undefined ? _args7[0] : false;
|
|
762
688
|
paramsQuery = {
|
|
763
689
|
getType: "updateLatest",
|
|
764
690
|
id: JSON.stringify(dataChat.id),
|
|
@@ -768,14 +694,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
768
694
|
paramsHeaders = {
|
|
769
695
|
Authorization: dataChat.userToken
|
|
770
696
|
};
|
|
771
|
-
|
|
697
|
+
_context7.next = 5;
|
|
772
698
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery, paramsHeaders);
|
|
773
699
|
|
|
774
700
|
case 5:
|
|
775
|
-
response =
|
|
701
|
+
response = _context7.sent;
|
|
776
702
|
|
|
777
703
|
if (response.body) {
|
|
778
|
-
|
|
704
|
+
_context7.next = 9;
|
|
779
705
|
break;
|
|
780
706
|
}
|
|
781
707
|
|
|
@@ -783,7 +709,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
783
709
|
message: response.message,
|
|
784
710
|
errorDetail: response.errorDetail
|
|
785
711
|
});
|
|
786
|
-
return
|
|
712
|
+
return _context7.abrupt("return");
|
|
787
713
|
|
|
788
714
|
case 9:
|
|
789
715
|
// success
|
|
@@ -800,29 +726,29 @@ var ContentChat = function ContentChat(props) {
|
|
|
800
726
|
|
|
801
727
|
case 15:
|
|
802
728
|
case "end":
|
|
803
|
-
return
|
|
729
|
+
return _context7.stop();
|
|
804
730
|
}
|
|
805
731
|
}
|
|
806
|
-
},
|
|
732
|
+
}, _callee7);
|
|
807
733
|
}));
|
|
808
734
|
|
|
809
735
|
return function getUpdateLatestMerchantProduct() {
|
|
810
|
-
return
|
|
736
|
+
return _ref7.apply(this, arguments);
|
|
811
737
|
};
|
|
812
738
|
}();
|
|
813
739
|
|
|
814
740
|
var getUpdateLatestOrderProduct = /*#__PURE__*/function () {
|
|
815
|
-
var
|
|
741
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
816
742
|
var fromUpdate,
|
|
817
743
|
paramsQuery,
|
|
818
744
|
response,
|
|
819
745
|
companiesList,
|
|
820
|
-
|
|
821
|
-
return _regenerator.default.wrap(function
|
|
746
|
+
_args8 = arguments;
|
|
747
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
822
748
|
while (1) {
|
|
823
|
-
switch (
|
|
749
|
+
switch (_context8.prev = _context8.next) {
|
|
824
750
|
case 0:
|
|
825
|
-
fromUpdate =
|
|
751
|
+
fromUpdate = _args8.length > 0 && _args8[0] !== undefined ? _args8[0] : false;
|
|
826
752
|
paramsQuery = {
|
|
827
753
|
getType: "updateLatest",
|
|
828
754
|
id: JSON.stringify(dataChat.id),
|
|
@@ -834,14 +760,14 @@ var ContentChat = function ContentChat(props) {
|
|
|
834
760
|
othersCompanyId: encodeURIComponent(JSON.stringify(Object.keys(companies))),
|
|
835
761
|
date: encodeURIComponent(lastUpdateDate)
|
|
836
762
|
};
|
|
837
|
-
|
|
763
|
+
_context8.next = 4;
|
|
838
764
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsQuery);
|
|
839
765
|
|
|
840
766
|
case 4:
|
|
841
|
-
response =
|
|
767
|
+
response = _context8.sent;
|
|
842
768
|
|
|
843
769
|
if (response.body) {
|
|
844
|
-
|
|
770
|
+
_context8.next = 8;
|
|
845
771
|
break;
|
|
846
772
|
}
|
|
847
773
|
|
|
@@ -849,7 +775,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
849
775
|
message: response.message,
|
|
850
776
|
errorDetail: response.errorDetail
|
|
851
777
|
});
|
|
852
|
-
return
|
|
778
|
+
return _context8.abrupt("return");
|
|
853
779
|
|
|
854
780
|
case 8:
|
|
855
781
|
// success
|
|
@@ -910,19 +836,19 @@ var ContentChat = function ContentChat(props) {
|
|
|
910
836
|
|
|
911
837
|
case 10:
|
|
912
838
|
case "end":
|
|
913
|
-
return
|
|
839
|
+
return _context8.stop();
|
|
914
840
|
}
|
|
915
841
|
}
|
|
916
|
-
},
|
|
842
|
+
}, _callee8);
|
|
917
843
|
}));
|
|
918
844
|
|
|
919
845
|
return function getUpdateLatestOrderProduct() {
|
|
920
|
-
return
|
|
846
|
+
return _ref8.apply(this, arguments);
|
|
921
847
|
};
|
|
922
848
|
}();
|
|
923
849
|
|
|
924
850
|
var getUpdateLatestTicket = /*#__PURE__*/function () {
|
|
925
|
-
var
|
|
851
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
926
852
|
var _dataChat$currentUser9, _dataChat$currentUser10, _dataChat$currentUser11, _dataChat$currentUser12;
|
|
927
853
|
|
|
928
854
|
var fromUpdate,
|
|
@@ -930,19 +856,19 @@ var ContentChat = function ContentChat(props) {
|
|
|
930
856
|
paramsQuery,
|
|
931
857
|
response,
|
|
932
858
|
newSingleChat,
|
|
933
|
-
|
|
934
|
-
return _regenerator.default.wrap(function
|
|
859
|
+
_args9 = arguments;
|
|
860
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
935
861
|
while (1) {
|
|
936
|
-
switch (
|
|
862
|
+
switch (_context9.prev = _context9.next) {
|
|
937
863
|
case 0:
|
|
938
|
-
fromUpdate =
|
|
864
|
+
fromUpdate = _args9.length > 0 && _args9[0] !== undefined ? _args9[0] : false;
|
|
939
865
|
|
|
940
866
|
if (!(singleChat.statusChat === "closed")) {
|
|
941
|
-
|
|
867
|
+
_context9.next = 3;
|
|
942
868
|
break;
|
|
943
869
|
}
|
|
944
870
|
|
|
945
|
-
return
|
|
871
|
+
return _context9.abrupt("return");
|
|
946
872
|
|
|
947
873
|
case 3:
|
|
948
874
|
dataUser = {
|
|
@@ -957,20 +883,20 @@ var ContentChat = function ContentChat(props) {
|
|
|
957
883
|
currentUser: (0, _utils.encodeUriJson)(dataUser),
|
|
958
884
|
currentItemsFront: (0, _utils.encodeUriJson)(getItemsIdSingleChat())
|
|
959
885
|
};
|
|
960
|
-
|
|
886
|
+
_context9.next = 7;
|
|
961
887
|
return (0, _handle_http.fetchGET)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsQuery, {
|
|
962
888
|
Authorization: (_dataChat$currentUser12 = dataChat.currentUser) === null || _dataChat$currentUser12 === void 0 ? void 0 : _dataChat$currentUser12.token
|
|
963
889
|
});
|
|
964
890
|
|
|
965
891
|
case 7:
|
|
966
|
-
response =
|
|
892
|
+
response = _context9.sent;
|
|
967
893
|
//programar update en 20s
|
|
968
894
|
setStartUpdate(function (prev) {
|
|
969
895
|
return prev + 1;
|
|
970
896
|
});
|
|
971
897
|
|
|
972
898
|
if (response.body) {
|
|
973
|
-
|
|
899
|
+
_context9.next = 13;
|
|
974
900
|
break;
|
|
975
901
|
}
|
|
976
902
|
|
|
@@ -992,7 +918,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
992
918
|
message: response.message,
|
|
993
919
|
errorDetail: response.errorDetail
|
|
994
920
|
});
|
|
995
|
-
return
|
|
921
|
+
return _context9.abrupt("return");
|
|
996
922
|
|
|
997
923
|
case 13:
|
|
998
924
|
// limpiar error update
|
|
@@ -1006,11 +932,11 @@ var ContentChat = function ContentChat(props) {
|
|
|
1006
932
|
updateAllUsers(response.body.users); // actualizar los items del chat
|
|
1007
933
|
|
|
1008
934
|
if (!(response.body.items.length === 0)) {
|
|
1009
|
-
|
|
935
|
+
_context9.next = 18;
|
|
1010
936
|
break;
|
|
1011
937
|
}
|
|
1012
938
|
|
|
1013
|
-
return
|
|
939
|
+
return _context9.abrupt("return");
|
|
1014
940
|
|
|
1015
941
|
case 18:
|
|
1016
942
|
newSingleChat = (0, _objectSpread3.default)({}, singleChat);
|
|
@@ -1020,230 +946,215 @@ var ContentChat = function ContentChat(props) {
|
|
|
1020
946
|
|
|
1021
947
|
case 22:
|
|
1022
948
|
case "end":
|
|
1023
|
-
return
|
|
949
|
+
return _context9.stop();
|
|
1024
950
|
}
|
|
1025
951
|
}
|
|
1026
|
-
},
|
|
952
|
+
}, _callee9);
|
|
1027
953
|
}));
|
|
1028
954
|
|
|
1029
955
|
return function getUpdateLatestTicket() {
|
|
1030
|
-
return
|
|
956
|
+
return _ref9.apply(this, arguments);
|
|
1031
957
|
};
|
|
1032
958
|
}();
|
|
1033
959
|
/*=======================================================================
|
|
1034
|
-
FUNCION QUE EJECUTA EL MICROSERVICIO CREATE-ITEM
|
|
960
|
+
FUNCION QUE EJECUTA EL MICROSERVICIO CREATE-ITEM
|
|
1035
961
|
Este metodo recibe los items que queremos agregar al chat.
|
|
1036
962
|
requiere:
|
|
1037
|
-
=> items: [ { type , value } , ... ]
|
|
963
|
+
=> items: [ { type , value } , ... ]
|
|
1038
964
|
NOTA: si se quiere agregar un mensaje mandar un array con un object
|
|
1039
|
-
example: [ {
|
|
1040
|
-
type: "message" ,
|
|
1041
|
-
value: "mi mensaje"
|
|
965
|
+
example: [ {
|
|
966
|
+
type: "message" ,
|
|
967
|
+
value: "mi mensaje"
|
|
1042
968
|
} ]
|
|
1043
969
|
======================================================================= */
|
|
1044
970
|
|
|
1045
971
|
|
|
1046
972
|
var createItemsChat = /*#__PURE__*/function () {
|
|
1047
|
-
var
|
|
973
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10() {
|
|
1048
974
|
var items,
|
|
1049
975
|
_iterator,
|
|
1050
976
|
_step,
|
|
1051
977
|
item,
|
|
1052
978
|
errorCreate,
|
|
1053
|
-
|
|
979
|
+
_args10 = arguments;
|
|
1054
980
|
|
|
1055
|
-
return _regenerator.default.wrap(function
|
|
981
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1056
982
|
while (1) {
|
|
1057
|
-
switch (
|
|
983
|
+
switch (_context10.prev = _context10.next) {
|
|
1058
984
|
case 0:
|
|
1059
|
-
items =
|
|
985
|
+
items = _args10.length > 0 && _args10[0] !== undefined ? _args10[0] : [];
|
|
1060
986
|
|
|
1061
987
|
if (!(items.length === 0)) {
|
|
1062
|
-
|
|
988
|
+
_context10.next = 3;
|
|
1063
989
|
break;
|
|
1064
990
|
}
|
|
1065
991
|
|
|
1066
|
-
return
|
|
992
|
+
return _context10.abrupt("return", {
|
|
1067
993
|
message: "No se especifico ningun mensaje, imagen o archivo nuevo " + "que se quiera enviar al chat",
|
|
1068
994
|
errorDetail: "Reporta esto a TI"
|
|
1069
995
|
});
|
|
1070
996
|
|
|
1071
997
|
case 3:
|
|
1072
998
|
_iterator = (0, _createForOfIteratorHelper2.default)(items);
|
|
1073
|
-
|
|
999
|
+
_context10.prev = 4;
|
|
1074
1000
|
|
|
1075
1001
|
_iterator.s();
|
|
1076
1002
|
|
|
1077
1003
|
case 6:
|
|
1078
1004
|
if ((_step = _iterator.n()).done) {
|
|
1079
|
-
|
|
1005
|
+
_context10.next = 14;
|
|
1080
1006
|
break;
|
|
1081
1007
|
}
|
|
1082
1008
|
|
|
1083
1009
|
item = _step.value;
|
|
1084
1010
|
|
|
1085
1011
|
if (["message", "img", "file"].includes(item.type)) {
|
|
1086
|
-
|
|
1012
|
+
_context10.next = 10;
|
|
1087
1013
|
break;
|
|
1088
1014
|
}
|
|
1089
1015
|
|
|
1090
|
-
return
|
|
1016
|
+
return _context10.abrupt("return", {
|
|
1091
1017
|
message: "Uno de los elementos que se quiere enviar al chat " + "no es un tipo valido \"".concat(item.type, "\""),
|
|
1092
1018
|
errorDetail: "Reporta esto a TI"
|
|
1093
1019
|
});
|
|
1094
1020
|
|
|
1095
1021
|
case 10:
|
|
1096
1022
|
if (!(0, _utils.isStringEmpty)(item.value)) {
|
|
1097
|
-
|
|
1023
|
+
_context10.next = 12;
|
|
1098
1024
|
break;
|
|
1099
1025
|
}
|
|
1100
1026
|
|
|
1101
|
-
return
|
|
1027
|
+
return _context10.abrupt("return", {
|
|
1102
1028
|
message: "Uno de los elementos que se quiere enviar al chat " + "contiene un valor vacio",
|
|
1103
1029
|
errorDetail: "Reporta esto a TI"
|
|
1104
1030
|
});
|
|
1105
1031
|
|
|
1106
1032
|
case 12:
|
|
1107
|
-
|
|
1033
|
+
_context10.next = 6;
|
|
1108
1034
|
break;
|
|
1109
1035
|
|
|
1110
1036
|
case 14:
|
|
1111
|
-
|
|
1037
|
+
_context10.next = 19;
|
|
1112
1038
|
break;
|
|
1113
1039
|
|
|
1114
1040
|
case 16:
|
|
1115
|
-
|
|
1116
|
-
|
|
1041
|
+
_context10.prev = 16;
|
|
1042
|
+
_context10.t0 = _context10["catch"](4);
|
|
1117
1043
|
|
|
1118
|
-
_iterator.e(
|
|
1044
|
+
_iterator.e(_context10.t0);
|
|
1119
1045
|
|
|
1120
1046
|
case 19:
|
|
1121
|
-
|
|
1047
|
+
_context10.prev = 19;
|
|
1122
1048
|
|
|
1123
1049
|
_iterator.f();
|
|
1124
1050
|
|
|
1125
|
-
return
|
|
1051
|
+
return _context10.finish(19);
|
|
1126
1052
|
|
|
1127
1053
|
case 22:
|
|
1128
1054
|
stopUpdate(); // finalizamos el temporizador
|
|
1129
1055
|
// enviar items a la BD
|
|
1130
1056
|
|
|
1131
1057
|
if (!(chatType === "merchant_product")) {
|
|
1132
|
-
|
|
1058
|
+
_context10.next = 29;
|
|
1133
1059
|
break;
|
|
1134
1060
|
}
|
|
1135
1061
|
|
|
1136
|
-
|
|
1062
|
+
_context10.next = 26;
|
|
1137
1063
|
return createItemsMerchantProduct(items);
|
|
1138
1064
|
|
|
1139
1065
|
case 26:
|
|
1140
|
-
errorCreate =
|
|
1141
|
-
|
|
1066
|
+
errorCreate = _context10.sent;
|
|
1067
|
+
_context10.next = 38;
|
|
1142
1068
|
break;
|
|
1143
1069
|
|
|
1144
1070
|
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
1071
|
if (!(chatType === "order_product")) {
|
|
1160
|
-
|
|
1072
|
+
_context10.next = 35;
|
|
1161
1073
|
break;
|
|
1162
1074
|
}
|
|
1163
1075
|
|
|
1164
|
-
|
|
1076
|
+
_context10.next = 32;
|
|
1165
1077
|
return createItemsOrderProduct(items);
|
|
1166
1078
|
|
|
1167
|
-
case
|
|
1168
|
-
errorCreate =
|
|
1169
|
-
|
|
1079
|
+
case 32:
|
|
1080
|
+
errorCreate = _context10.sent;
|
|
1081
|
+
_context10.next = 38;
|
|
1170
1082
|
break;
|
|
1171
1083
|
|
|
1172
|
-
case
|
|
1173
|
-
|
|
1084
|
+
case 35:
|
|
1085
|
+
_context10.next = 37;
|
|
1174
1086
|
return createItemsTicket(items);
|
|
1175
1087
|
|
|
1176
|
-
case
|
|
1177
|
-
errorCreate =
|
|
1088
|
+
case 37:
|
|
1089
|
+
errorCreate = _context10.sent;
|
|
1178
1090
|
|
|
1179
|
-
case
|
|
1180
|
-
if (!
|
|
1181
|
-
|
|
1091
|
+
case 38:
|
|
1092
|
+
if (!(chatType === "merchant_product")) {
|
|
1093
|
+
_context10.next = 43;
|
|
1182
1094
|
break;
|
|
1183
1095
|
}
|
|
1184
1096
|
|
|
1185
|
-
|
|
1097
|
+
_context10.next = 41;
|
|
1186
1098
|
return getUpdateLatestMerchantProduct();
|
|
1187
1099
|
|
|
1188
|
-
case
|
|
1189
|
-
|
|
1100
|
+
case 41:
|
|
1101
|
+
_context10.next = 50;
|
|
1190
1102
|
break;
|
|
1191
1103
|
|
|
1192
|
-
case
|
|
1104
|
+
case 43:
|
|
1193
1105
|
if (!(chatType === "order_product")) {
|
|
1194
|
-
|
|
1106
|
+
_context10.next = 48;
|
|
1195
1107
|
break;
|
|
1196
1108
|
}
|
|
1197
1109
|
|
|
1198
|
-
|
|
1110
|
+
_context10.next = 46;
|
|
1199
1111
|
return getUpdateLatestOrderProduct();
|
|
1200
1112
|
|
|
1201
|
-
case
|
|
1202
|
-
|
|
1113
|
+
case 46:
|
|
1114
|
+
_context10.next = 50;
|
|
1203
1115
|
break;
|
|
1204
1116
|
|
|
1205
|
-
case
|
|
1206
|
-
|
|
1117
|
+
case 48:
|
|
1118
|
+
_context10.next = 50;
|
|
1207
1119
|
return getUpdateLatestTicket();
|
|
1208
1120
|
|
|
1209
|
-
case
|
|
1121
|
+
case 50:
|
|
1210
1122
|
if (!errorCreate) {
|
|
1211
|
-
|
|
1123
|
+
_context10.next = 52;
|
|
1212
1124
|
break;
|
|
1213
1125
|
}
|
|
1214
1126
|
|
|
1215
|
-
return
|
|
1127
|
+
return _context10.abrupt("return", errorCreate);
|
|
1216
1128
|
|
|
1217
|
-
case
|
|
1129
|
+
case 52:
|
|
1218
1130
|
case "end":
|
|
1219
|
-
return
|
|
1131
|
+
return _context10.stop();
|
|
1220
1132
|
}
|
|
1221
1133
|
}
|
|
1222
|
-
},
|
|
1134
|
+
}, _callee10, null, [[4, 16, 19, 22]]);
|
|
1223
1135
|
}));
|
|
1224
1136
|
|
|
1225
1137
|
return function createItemsChat() {
|
|
1226
|
-
return
|
|
1138
|
+
return _ref10.apply(this, arguments);
|
|
1227
1139
|
};
|
|
1228
1140
|
}();
|
|
1229
1141
|
|
|
1230
1142
|
var createItemsMerchantProduct = /*#__PURE__*/function () {
|
|
1231
|
-
var
|
|
1143
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1232
1144
|
var items,
|
|
1233
1145
|
id,
|
|
1234
1146
|
version,
|
|
1235
|
-
orderId,
|
|
1236
1147
|
retailerId,
|
|
1237
1148
|
paramsBody,
|
|
1238
1149
|
paramsHeaders,
|
|
1239
1150
|
response,
|
|
1240
|
-
|
|
1241
|
-
return _regenerator.default.wrap(function
|
|
1151
|
+
_args11 = arguments;
|
|
1152
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1242
1153
|
while (1) {
|
|
1243
|
-
switch (
|
|
1154
|
+
switch (_context11.prev = _context11.next) {
|
|
1244
1155
|
case 0:
|
|
1245
|
-
items =
|
|
1246
|
-
id = dataChat.id, version = dataChat.version
|
|
1156
|
+
items = _args11.length > 0 && _args11[0] !== undefined ? _args11[0] : [];
|
|
1157
|
+
id = dataChat.id, version = dataChat.version;
|
|
1247
1158
|
retailerId = activeRetailer.id;
|
|
1248
1159
|
paramsBody = {
|
|
1249
1160
|
id: id,
|
|
@@ -1251,110 +1162,50 @@ var ContentChat = function ContentChat(props) {
|
|
|
1251
1162
|
items: items,
|
|
1252
1163
|
retailerId: retailerId
|
|
1253
1164
|
};
|
|
1254
|
-
if (chatType === "product_status") paramsBody["orderId"] = orderId;
|
|
1255
1165
|
paramsHeaders = {
|
|
1256
1166
|
Authorization: dataChat.userToken
|
|
1257
1167
|
};
|
|
1258
|
-
|
|
1168
|
+
_context11.next = 7;
|
|
1259
1169
|
return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody, paramsHeaders);
|
|
1260
1170
|
|
|
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
1171
|
case 7:
|
|
1321
|
-
response =
|
|
1172
|
+
response = _context11.sent;
|
|
1322
1173
|
|
|
1323
1174
|
if (response.body) {
|
|
1324
|
-
|
|
1175
|
+
_context11.next = 10;
|
|
1325
1176
|
break;
|
|
1326
1177
|
}
|
|
1327
1178
|
|
|
1328
|
-
return
|
|
1179
|
+
return _context11.abrupt("return", {
|
|
1329
1180
|
message: response.message,
|
|
1330
1181
|
errorDetail: response.errorDetail
|
|
1331
1182
|
});
|
|
1332
1183
|
|
|
1333
1184
|
case 10:
|
|
1334
1185
|
case "end":
|
|
1335
|
-
return
|
|
1186
|
+
return _context11.stop();
|
|
1336
1187
|
}
|
|
1337
1188
|
}
|
|
1338
|
-
},
|
|
1189
|
+
}, _callee11);
|
|
1339
1190
|
}));
|
|
1340
1191
|
|
|
1341
|
-
return function
|
|
1342
|
-
return
|
|
1192
|
+
return function createItemsMerchantProduct() {
|
|
1193
|
+
return _ref11.apply(this, arguments);
|
|
1343
1194
|
};
|
|
1344
1195
|
}();
|
|
1345
1196
|
|
|
1346
1197
|
var createItemsOrderProduct = /*#__PURE__*/function () {
|
|
1347
|
-
var
|
|
1198
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1348
1199
|
var items,
|
|
1349
1200
|
paramsBody,
|
|
1350
1201
|
paramsHeaders,
|
|
1351
1202
|
response,
|
|
1352
|
-
|
|
1353
|
-
return _regenerator.default.wrap(function
|
|
1203
|
+
_args12 = arguments;
|
|
1204
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1354
1205
|
while (1) {
|
|
1355
|
-
switch (
|
|
1206
|
+
switch (_context12.prev = _context12.next) {
|
|
1356
1207
|
case 0:
|
|
1357
|
-
items =
|
|
1208
|
+
items = _args12.length > 0 && _args12[0] !== undefined ? _args12[0] : [];
|
|
1358
1209
|
paramsBody = {
|
|
1359
1210
|
id: dataChat.id,
|
|
1360
1211
|
version: currentArticle.version,
|
|
@@ -1365,47 +1216,47 @@ var ContentChat = function ContentChat(props) {
|
|
|
1365
1216
|
paramsHeaders = {
|
|
1366
1217
|
Authorization: dataChat.userToken
|
|
1367
1218
|
};
|
|
1368
|
-
|
|
1219
|
+
_context12.next = 5;
|
|
1369
1220
|
return (0, _handle_http.fetchPOST)(process.env.REACT_APP_PRODUCTS_CHAT_ENDPOINT, paramsBody, paramsHeaders);
|
|
1370
1221
|
|
|
1371
1222
|
case 5:
|
|
1372
|
-
response =
|
|
1223
|
+
response = _context12.sent;
|
|
1373
1224
|
|
|
1374
1225
|
if (response.body) {
|
|
1375
|
-
|
|
1226
|
+
_context12.next = 8;
|
|
1376
1227
|
break;
|
|
1377
1228
|
}
|
|
1378
1229
|
|
|
1379
|
-
return
|
|
1230
|
+
return _context12.abrupt("return", {
|
|
1380
1231
|
message: response.message,
|
|
1381
1232
|
errorDetail: response.errorDetail
|
|
1382
1233
|
});
|
|
1383
1234
|
|
|
1384
1235
|
case 8:
|
|
1385
1236
|
case "end":
|
|
1386
|
-
return
|
|
1237
|
+
return _context12.stop();
|
|
1387
1238
|
}
|
|
1388
1239
|
}
|
|
1389
|
-
},
|
|
1240
|
+
}, _callee12);
|
|
1390
1241
|
}));
|
|
1391
1242
|
|
|
1392
1243
|
return function createItemsOrderProduct() {
|
|
1393
|
-
return
|
|
1244
|
+
return _ref12.apply(this, arguments);
|
|
1394
1245
|
};
|
|
1395
1246
|
}();
|
|
1396
1247
|
|
|
1397
1248
|
var createItemsTicket = /*#__PURE__*/function () {
|
|
1398
|
-
var
|
|
1249
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1399
1250
|
var items,
|
|
1400
1251
|
paramsBody,
|
|
1401
1252
|
paramsHeaders,
|
|
1402
1253
|
response,
|
|
1403
|
-
|
|
1404
|
-
return _regenerator.default.wrap(function
|
|
1254
|
+
_args13 = arguments;
|
|
1255
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1405
1256
|
while (1) {
|
|
1406
|
-
switch (
|
|
1257
|
+
switch (_context13.prev = _context13.next) {
|
|
1407
1258
|
case 0:
|
|
1408
|
-
items =
|
|
1259
|
+
items = _args13.length > 0 && _args13[0] !== undefined ? _args13[0] : [];
|
|
1409
1260
|
paramsBody = {
|
|
1410
1261
|
id: JSON.stringify(dataChat.id),
|
|
1411
1262
|
userId: JSON.stringify(dataChat.currentUser.id),
|
|
@@ -1414,32 +1265,32 @@ var ContentChat = function ContentChat(props) {
|
|
|
1414
1265
|
paramsHeaders = {
|
|
1415
1266
|
Authorization: dataChat.userToken
|
|
1416
1267
|
};
|
|
1417
|
-
|
|
1268
|
+
_context13.next = 5;
|
|
1418
1269
|
return (0, _handle_http.fetchPOST)(process.env.REACT_APP_TICKETS_CHAT_ENDPOINT, paramsBody, paramsHeaders);
|
|
1419
1270
|
|
|
1420
1271
|
case 5:
|
|
1421
|
-
response =
|
|
1272
|
+
response = _context13.sent;
|
|
1422
1273
|
|
|
1423
1274
|
if (response.body) {
|
|
1424
|
-
|
|
1275
|
+
_context13.next = 8;
|
|
1425
1276
|
break;
|
|
1426
1277
|
}
|
|
1427
1278
|
|
|
1428
|
-
return
|
|
1279
|
+
return _context13.abrupt("return", {
|
|
1429
1280
|
message: response.message,
|
|
1430
1281
|
errorDetail: response.errorDetail
|
|
1431
1282
|
});
|
|
1432
1283
|
|
|
1433
1284
|
case 8:
|
|
1434
1285
|
case "end":
|
|
1435
|
-
return
|
|
1286
|
+
return _context13.stop();
|
|
1436
1287
|
}
|
|
1437
1288
|
}
|
|
1438
|
-
},
|
|
1289
|
+
}, _callee13);
|
|
1439
1290
|
}));
|
|
1440
1291
|
|
|
1441
1292
|
return function createItemsTicket() {
|
|
1442
|
-
return
|
|
1293
|
+
return _ref13.apply(this, arguments);
|
|
1443
1294
|
};
|
|
1444
1295
|
}();
|
|
1445
1296
|
/*=======================================================================
|
|
@@ -1448,7 +1299,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1448
1299
|
|
|
1449
1300
|
|
|
1450
1301
|
var isSingleChat = function isSingleChat() {
|
|
1451
|
-
if (chatType === "merchant_product" || chatType === "ticket"
|
|
1302
|
+
if (chatType === "merchant_product" || chatType === "ticket") {
|
|
1452
1303
|
return true;
|
|
1453
1304
|
}
|
|
1454
1305
|
|
|
@@ -1570,7 +1421,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1570
1421
|
var items;
|
|
1571
1422
|
var enabledLoadMore;
|
|
1572
1423
|
|
|
1573
|
-
if (["merchant_product", "ticket"
|
|
1424
|
+
if (["merchant_product", "ticket"].includes(chatType)) {
|
|
1574
1425
|
items = singleChat.items;
|
|
1575
1426
|
enabledLoadMore = singleChat.enabledLoadMore;
|
|
1576
1427
|
} // ORDER_PRODUCT
|
|
@@ -1611,7 +1462,7 @@ var ContentChat = function ContentChat(props) {
|
|
|
1611
1462
|
chatType: chatType,
|
|
1612
1463
|
activeCompanyId: activeCompanyId,
|
|
1613
1464
|
ticketCompany: ticketCompany,
|
|
1614
|
-
currentUser: ["merchant_product", "order_product"
|
|
1465
|
+
currentUser: ["merchant_product", "order_product"].includes(chatType) ? currentUser : dataChat.currentUser,
|
|
1615
1466
|
onClickBtnLoadMore: chatType === "merchant_product" ? getLoadMoreMerchantProduct : chatType === "order_product" ? getLoadMoreOrderProduct : getLoadMoreTicket
|
|
1616
1467
|
});
|
|
1617
1468
|
} else {
|
|
@@ -1640,10 +1491,6 @@ var ContentChat = function ContentChat(props) {
|
|
|
1640
1491
|
version: currentArticle.version
|
|
1641
1492
|
} : chatType === "ticket" ? {
|
|
1642
1493
|
id: dataChat.id
|
|
1643
|
-
} : chatType === "product_status" ? {
|
|
1644
|
-
id: dataChat.id,
|
|
1645
|
-
version: dataChat.version,
|
|
1646
|
-
retailerId: dataChat.retailerId
|
|
1647
1494
|
} : undefined,
|
|
1648
1495
|
chatCompany: getChatCompany(),
|
|
1649
1496
|
statusChat: chatType === "order_product" ? (_getChatCompany = getChatCompany()) === null || _getChatCompany === void 0 ? void 0 : _getChatCompany.statusChat : chatType === "ticket" ? singleChat.statusChat : undefined,
|