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