@bjsdistribution/dms-client-return 0.0.53 → 0.0.55

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.
@@ -751,9 +751,9 @@ var returnDataAtom = /*#__PURE__*/atom([]);
751
751
  function useReturnData() {
752
752
  return useAtom(returnDataAtom);
753
753
  }
754
- var apiCalling = /*#__PURE__*/atom(false);
755
- function useApiCalling() {
756
- return useAtom(apiCalling);
754
+ var apiUpdateCalling = /*#__PURE__*/atom(false);
755
+ function useUpdateApiCall() {
756
+ return useAtom(apiUpdateCalling);
757
757
  }
758
758
  var liveRecalling = /*#__PURE__*/atom(false);
759
759
  //re api call of live status
@@ -2380,6 +2380,8 @@ var Container$s = /*#__PURE__*/styled.div(_templateObject3$c || (_templateObject
2380
2380
  function useUpdateOrder() {
2381
2381
  var controller;
2382
2382
  var ssoToken = getCookie('id_token');
2383
+ var _useUpdateApiCall = useUpdateApiCall(),
2384
+ setCallApi = _useUpdateApiCall[1]; //single detail
2383
2385
  var update = /*#__PURE__*/function () {
2384
2386
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
2385
2387
  var endpoint, signal, requestOptions, response, json;
@@ -2422,9 +2424,10 @@ function useUpdateOrder() {
2422
2424
  message: 'Success',
2423
2425
  description: 'Order has been updated.'
2424
2426
  });
2427
+ setCallApi(true);
2425
2428
  return _context.abrupt("return", json);
2426
- case 18:
2427
- _context.prev = 18;
2429
+ case 19:
2430
+ _context.prev = 19;
2428
2431
  _context.t0 = _context["catch"](4);
2429
2432
  // setLoading(false);
2430
2433
  // console.log(err, 'error');
@@ -2432,14 +2435,14 @@ function useUpdateOrder() {
2432
2435
  message: 'Error',
2433
2436
  description: "" + _context.t0 || 'An error has occurred. Please try again later.'
2434
2437
  });
2435
- case 21:
2436
- _context.prev = 21;
2437
- return _context.finish(21);
2438
- case 23:
2438
+ case 22:
2439
+ _context.prev = 22;
2440
+ return _context.finish(22);
2441
+ case 24:
2439
2442
  case "end":
2440
2443
  return _context.stop();
2441
2444
  }
2442
- }, _callee, null, [[4, 18, 21, 23]]);
2445
+ }, _callee, null, [[4, 19, 22, 24]]);
2443
2446
  }));
2444
2447
  return function update(_x) {
2445
2448
  return _ref.apply(this, arguments);
@@ -2462,8 +2465,8 @@ function OrderDetailsFooter() {
2462
2465
  var _useAtom = useAtom(errorAtom),
2463
2466
  errorState = _useAtom[0];
2464
2467
  // const [, setLogsCallAPi] = useLogsCallAPi();
2465
- var _useApiCalling = useApiCalling(),
2466
- setCallApi = _useApiCalling[1]; //single detail
2468
+ var _useUpdateApiCall = useUpdateApiCall(),
2469
+ setCallApi = _useUpdateApiCall[1]; //single detail
2467
2470
  // const [, setNoteLoadingStore] = UseNotesLoading();
2468
2471
  var errorFound = function errorFound() {
2469
2472
  var isError = errorState.w3wError.length > 0 || errorState.emailError.length > 0 || errorState.homeContactError.length > 0 || errorState.workCOntanctError.length > 0 || errorState.mobileError.length > 0 || errorState.postCodeError.length > 0;
@@ -2494,12 +2497,12 @@ function OrderDetailsFooter() {
2494
2497
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2495
2498
  while (1) switch (_context.prev = _context.next) {
2496
2499
  case 0:
2497
- setCallApi(true);
2498
2500
  payload = compareOrderDetailsStates(prevOrderDetails, orderDetails);
2499
- _context.next = 4;
2501
+ _context.next = 3;
2500
2502
  return updateOrder([payload]);
2501
- case 4:
2503
+ case 3:
2502
2504
  response = _context.sent;
2505
+ setCallApi(false);
2503
2506
  // setLogsCallAPi(prev => !prev);
2504
2507
  if (response && (response == null || (_response$data = response.data) == null ? void 0 : _response$data.length) > 0) {
2505
2508
  setOrderDetails(response == null ? void 0 : response.data[0]);
@@ -3118,7 +3121,7 @@ function useGetEventNotes() {
3118
3121
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3119
3122
  while (1) switch (_context.prev = _context.next) {
3120
3123
  case 0:
3121
- endpoint = getBaseEndpoint() + "events/get/event_information/"; // setLoading(true);
3124
+ endpoint = getBaseEndpoint() + "/events/get/event_information/"; // setLoading(true);
3122
3125
  _context.prev = 1;
3123
3126
  headers = {
3124
3127
  accept: 'application/json',
@@ -8473,8 +8476,8 @@ function OrderView() {
8473
8476
  var paths = splitPath(location.pathname);
8474
8477
  var _useLocationOptions = useLocationOptions(),
8475
8478
  setLocationOptions = _useLocationOptions[1];
8476
- var _useApiCalling = useApiCalling(),
8477
- apiCalling = _useApiCalling[0];
8479
+ var _useUpdateApiCall = useUpdateApiCall(),
8480
+ apiCalling = _useUpdateApiCall[0];
8478
8481
  var _useOrderProductsReso = useOrderProductsResources(),
8479
8482
  orderResources = _useOrderProductsReso[0],
8480
8483
  setOrderResources = _useOrderProductsReso[1];
@@ -8534,11 +8537,8 @@ function OrderView() {
8534
8537
  }
8535
8538
  }, [orderId, liveRecalling]);
8536
8539
  useEffect(function () {
8537
- if (apiCalling) {
8538
- orderUpdate(true);
8539
- } else {
8540
- orderUpdate(false);
8541
- }
8540
+ orderUpdate(true);
8541
+ apiCalling ? orderUpdate(true) : orderUpdate(false);
8542
8542
  }, [apiCalling]);
8543
8543
  useEffect(function () {
8544
8544
  if (paths.length > 1) {
@@ -9442,19 +9442,24 @@ var displayValueOrNA = function displayValueOrNA(value) {
9442
9442
 
9443
9443
  var optionsPrint = [{
9444
9444
  icon: 'runSheet',
9445
- label: 'Print Runsheet'
9445
+ label: 'Print Runsheet',
9446
+ type: 'runsheet_url'
9446
9447
  }, {
9447
9448
  icon: 'loadSheet',
9448
- label: 'Print Loadsheet'
9449
+ label: 'Print Loadsheet',
9450
+ type: 'loadsheet_url'
9449
9451
  }, {
9450
9452
  icon: 'deliveryLables',
9451
- label: 'Print Delivery Labels'
9453
+ label: 'Print Delivery Labels',
9454
+ type: 'delivery_label_url'
9452
9455
  }, {
9453
9456
  icon: 'customerLables',
9454
- label: 'Print Customer Labels'
9457
+ label: 'Print Customer Labels',
9458
+ type: 'customer_label_url'
9455
9459
  }, {
9456
9460
  icon: 'collectionLables',
9457
- label: 'Print Collection Labels'
9461
+ label: 'Print Return Labels',
9462
+ type: 'return_label_url'
9458
9463
  }];
9459
9464
  var optionsForReturnPrint = [{
9460
9465
  icon: 'deliveryLables',
@@ -10334,25 +10339,24 @@ function LoadIcon() {
10334
10339
  var _templateObject$1_, _templateObject2$1v;
10335
10340
  var PrintDropDown = function PrintDropDown(_ref) {
10336
10341
  var legacyProductId = _ref.legacyProductId;
10337
- var downloadFiles = function downloadFiles(label) {
10338
- var url = legacyProductId == null ? void 0 : legacyProductId[label.replace('Print ', '').toLowerCase().replace(' ', '_') + "_url"];
10342
+ var downloadFiles = function downloadFiles(type) {
10343
+ var url;
10344
+ if (type) {
10345
+ url = legacyProductId[type];
10346
+ }
10339
10347
  if (url) {
10340
10348
  window.open(url, '_blank');
10341
10349
  } else {
10342
- console.log('URL not available for', label);
10350
+ console.log('URL not available for', type);
10343
10351
  }
10344
10352
  };
10345
- var isOptionDisabled = function isOptionDisabled(label) {
10346
- var url = legacyProductId == null ? void 0 : legacyProductId[label.replace('Print ', '').toLowerCase().replace(' ', '_') + "_url"];
10347
- return !url;
10348
- };
10349
- return React.createElement(OptionsList$1, null, optionsPrint.map(function (item, index) {
10353
+ return React.createElement(OptionsList$1, null, optionsPrint == null ? void 0 : optionsPrint.map(function (item, index) {
10350
10354
  var IconComponent = PrintIconMap[item.icon];
10351
- var isDisabled = isOptionDisabled(item.label);
10355
+ var isDisabled = !legacyProductId[item.type];
10352
10356
  return React.createElement(OptionsListLi$1, {
10353
10357
  key: index,
10354
10358
  onClick: function onClick() {
10355
- return !isDisabled && downloadFiles(item.label);
10359
+ return !isDisabled && downloadFiles(item.type);
10356
10360
  },
10357
10361
  disabled: isDisabled
10358
10362
  }, IconComponent && React.createElement(IconComponent, null), item.label);
@@ -10677,10 +10681,10 @@ var OrderTable = function OrderTable(_ref) {
10677
10681
  onClick: function onClick() {
10678
10682
  return OpenDropDown(index);
10679
10683
  }
10680
- }, React.createElement(PrinterIcon, null), React.createElement(DownIcon, null), printToogle == index && React.createElement("div", {
10684
+ }, React.createElement(PrinterIcon, null), React.createElement(DownIcon, null), printToogle === index && React.createElement("div", {
10681
10685
  ref: dropdownRef
10682
10686
  }, React.createElement(PrintDropDown, {
10683
- legacyProductId: item.id
10687
+ legacyProductId: item
10684
10688
  })))), React.createElement("li", {
10685
10689
  className: "downloadcontainer"
10686
10690
  }, React.createElement(LoadIcon, null)))));