@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.
@@ -26,10 +26,12 @@ export declare const TableData: {
26
26
  alwaysVisible?: undefined;
27
27
  })[];
28
28
  }[];
29
- export declare const optionsPrint: {
29
+ interface PrintOption {
30
30
  icon: string;
31
31
  label: string;
32
- }[];
32
+ type: string;
33
+ }
34
+ export declare const optionsPrint: PrintOption[];
33
35
  export declare const optionsForReturnPrint: {
34
36
  icon: string;
35
37
  label: string;
@@ -104,3 +106,4 @@ export declare const TableData2: {
104
106
  };
105
107
  }[];
106
108
  }[];
109
+ export {};
@@ -110,8 +110,9 @@ export declare function useRouteId(): [number | undefined, (args_0: number | ((p
110
110
  export declare function useGsitOrderId(): [number | undefined, (args_0: number | ((prev: number | undefined) => number | undefined) | undefined) => void];
111
111
  export declare function useOrderProductId(): [number | undefined, (args_0: number | ((prev: number | undefined) => number | undefined) | undefined) => void];
112
112
  export declare function useReturnData(): [any[], (args_0: any[] | ((prev: any[]) => any[])) => void];
113
- export declare function useApiCalling(): [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
113
+ export declare function useUpdateApiCall(): [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
114
114
  export declare function useLiveRecalling(): [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
115
+ export declare function useDeleteRecall(): [boolean, (args_0: boolean | ((prev: boolean) => boolean)) => void];
115
116
  export declare const selectedTabKeyAtom: import("jotai/esm/").PrimitiveAtom<string> & {
116
117
  init: string;
117
118
  };
@@ -759,9 +759,9 @@ var returnDataAtom = /*#__PURE__*/jotai.atom([]);
759
759
  function useReturnData() {
760
760
  return jotai.useAtom(returnDataAtom);
761
761
  }
762
- var apiCalling = /*#__PURE__*/jotai.atom(false);
763
- function useApiCalling() {
764
- return jotai.useAtom(apiCalling);
762
+ var apiUpdateCalling = /*#__PURE__*/jotai.atom(false);
763
+ function useUpdateApiCall() {
764
+ return jotai.useAtom(apiUpdateCalling);
765
765
  }
766
766
  var liveRecalling = /*#__PURE__*/jotai.atom(false);
767
767
  //re api call of live status
@@ -2388,6 +2388,8 @@ var Container$s = /*#__PURE__*/styled__default.div(_templateObject3$c || (_templ
2388
2388
  function useUpdateOrder() {
2389
2389
  var controller;
2390
2390
  var ssoToken = getCookie('id_token');
2391
+ var _useUpdateApiCall = useUpdateApiCall(),
2392
+ setCallApi = _useUpdateApiCall[1]; //single detail
2391
2393
  var update = /*#__PURE__*/function () {
2392
2394
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {
2393
2395
  var endpoint, signal, requestOptions, response, json;
@@ -2430,9 +2432,10 @@ function useUpdateOrder() {
2430
2432
  message: 'Success',
2431
2433
  description: 'Order has been updated.'
2432
2434
  });
2435
+ setCallApi(true);
2433
2436
  return _context.abrupt("return", json);
2434
- case 18:
2435
- _context.prev = 18;
2437
+ case 19:
2438
+ _context.prev = 19;
2436
2439
  _context.t0 = _context["catch"](4);
2437
2440
  // setLoading(false);
2438
2441
  // console.log(err, 'error');
@@ -2440,14 +2443,14 @@ function useUpdateOrder() {
2440
2443
  message: 'Error',
2441
2444
  description: "" + _context.t0 || 'An error has occurred. Please try again later.'
2442
2445
  });
2443
- case 21:
2444
- _context.prev = 21;
2445
- return _context.finish(21);
2446
- case 23:
2446
+ case 22:
2447
+ _context.prev = 22;
2448
+ return _context.finish(22);
2449
+ case 24:
2447
2450
  case "end":
2448
2451
  return _context.stop();
2449
2452
  }
2450
- }, _callee, null, [[4, 18, 21, 23]]);
2453
+ }, _callee, null, [[4, 19, 22, 24]]);
2451
2454
  }));
2452
2455
  return function update(_x) {
2453
2456
  return _ref.apply(this, arguments);
@@ -2470,8 +2473,8 @@ function OrderDetailsFooter() {
2470
2473
  var _useAtom = jotai.useAtom(errorAtom),
2471
2474
  errorState = _useAtom[0];
2472
2475
  // const [, setLogsCallAPi] = useLogsCallAPi();
2473
- var _useApiCalling = useApiCalling(),
2474
- setCallApi = _useApiCalling[1]; //single detail
2476
+ var _useUpdateApiCall = useUpdateApiCall(),
2477
+ setCallApi = _useUpdateApiCall[1]; //single detail
2475
2478
  // const [, setNoteLoadingStore] = UseNotesLoading();
2476
2479
  var errorFound = function errorFound() {
2477
2480
  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;
@@ -2502,12 +2505,12 @@ function OrderDetailsFooter() {
2502
2505
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2503
2506
  while (1) switch (_context.prev = _context.next) {
2504
2507
  case 0:
2505
- setCallApi(true);
2506
2508
  payload = compareOrderDetailsStates(prevOrderDetails, orderDetails);
2507
- _context.next = 4;
2509
+ _context.next = 3;
2508
2510
  return updateOrder([payload]);
2509
- case 4:
2511
+ case 3:
2510
2512
  response = _context.sent;
2513
+ setCallApi(false);
2511
2514
  // setLogsCallAPi(prev => !prev);
2512
2515
  if (response && (response == null || (_response$data = response.data) == null ? void 0 : _response$data.length) > 0) {
2513
2516
  setOrderDetails(response == null ? void 0 : response.data[0]);
@@ -3126,7 +3129,7 @@ function useGetEventNotes() {
3126
3129
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3127
3130
  while (1) switch (_context.prev = _context.next) {
3128
3131
  case 0:
3129
- endpoint = dmsComponentLibrary.getBaseEndpoint() + "events/get/event_information/"; // setLoading(true);
3132
+ endpoint = dmsComponentLibrary.getBaseEndpoint() + "/events/get/event_information/"; // setLoading(true);
3130
3133
  _context.prev = 1;
3131
3134
  headers = {
3132
3135
  accept: 'application/json',
@@ -8481,8 +8484,8 @@ function OrderView() {
8481
8484
  var paths = splitPath(location.pathname);
8482
8485
  var _useLocationOptions = useLocationOptions(),
8483
8486
  setLocationOptions = _useLocationOptions[1];
8484
- var _useApiCalling = useApiCalling(),
8485
- apiCalling = _useApiCalling[0];
8487
+ var _useUpdateApiCall = useUpdateApiCall(),
8488
+ apiCalling = _useUpdateApiCall[0];
8486
8489
  var _useOrderProductsReso = useOrderProductsResources(),
8487
8490
  orderResources = _useOrderProductsReso[0],
8488
8491
  setOrderResources = _useOrderProductsReso[1];
@@ -8542,11 +8545,8 @@ function OrderView() {
8542
8545
  }
8543
8546
  }, [orderId, liveRecalling]);
8544
8547
  React.useEffect(function () {
8545
- if (apiCalling) {
8546
- orderUpdate(true);
8547
- } else {
8548
- orderUpdate(false);
8549
- }
8548
+ orderUpdate(true);
8549
+ apiCalling ? orderUpdate(true) : orderUpdate(false);
8550
8550
  }, [apiCalling]);
8551
8551
  React.useEffect(function () {
8552
8552
  if (paths.length > 1) {
@@ -9450,19 +9450,24 @@ var displayValueOrNA = function displayValueOrNA(value) {
9450
9450
 
9451
9451
  var optionsPrint = [{
9452
9452
  icon: 'runSheet',
9453
- label: 'Print Runsheet'
9453
+ label: 'Print Runsheet',
9454
+ type: 'runsheet_url'
9454
9455
  }, {
9455
9456
  icon: 'loadSheet',
9456
- label: 'Print Loadsheet'
9457
+ label: 'Print Loadsheet',
9458
+ type: 'loadsheet_url'
9457
9459
  }, {
9458
9460
  icon: 'deliveryLables',
9459
- label: 'Print Delivery Labels'
9461
+ label: 'Print Delivery Labels',
9462
+ type: 'delivery_label_url'
9460
9463
  }, {
9461
9464
  icon: 'customerLables',
9462
- label: 'Print Customer Labels'
9465
+ label: 'Print Customer Labels',
9466
+ type: 'customer_label_url'
9463
9467
  }, {
9464
9468
  icon: 'collectionLables',
9465
- label: 'Print Collection Labels'
9469
+ label: 'Print Return Labels',
9470
+ type: 'return_label_url'
9466
9471
  }];
9467
9472
  var optionsForReturnPrint = [{
9468
9473
  icon: 'deliveryLables',
@@ -10342,25 +10347,24 @@ function LoadIcon() {
10342
10347
  var _templateObject$1_, _templateObject2$1v;
10343
10348
  var PrintDropDown = function PrintDropDown(_ref) {
10344
10349
  var legacyProductId = _ref.legacyProductId;
10345
- var downloadFiles = function downloadFiles(label) {
10346
- var url = legacyProductId == null ? void 0 : legacyProductId[label.replace('Print ', '').toLowerCase().replace(' ', '_') + "_url"];
10350
+ var downloadFiles = function downloadFiles(type) {
10351
+ var url;
10352
+ if (type) {
10353
+ url = legacyProductId[type];
10354
+ }
10347
10355
  if (url) {
10348
10356
  window.open(url, '_blank');
10349
10357
  } else {
10350
- console.log('URL not available for', label);
10358
+ console.log('URL not available for', type);
10351
10359
  }
10352
10360
  };
10353
- var isOptionDisabled = function isOptionDisabled(label) {
10354
- var url = legacyProductId == null ? void 0 : legacyProductId[label.replace('Print ', '').toLowerCase().replace(' ', '_') + "_url"];
10355
- return !url;
10356
- };
10357
- return React__default.createElement(OptionsList$1, null, optionsPrint.map(function (item, index) {
10361
+ return React__default.createElement(OptionsList$1, null, optionsPrint == null ? void 0 : optionsPrint.map(function (item, index) {
10358
10362
  var IconComponent = PrintIconMap[item.icon];
10359
- var isDisabled = isOptionDisabled(item.label);
10363
+ var isDisabled = !legacyProductId[item.type];
10360
10364
  return React__default.createElement(OptionsListLi$1, {
10361
10365
  key: index,
10362
10366
  onClick: function onClick() {
10363
- return !isDisabled && downloadFiles(item.label);
10367
+ return !isDisabled && downloadFiles(item.type);
10364
10368
  },
10365
10369
  disabled: isDisabled
10366
10370
  }, IconComponent && React__default.createElement(IconComponent, null), item.label);
@@ -10685,10 +10689,10 @@ var OrderTable = function OrderTable(_ref) {
10685
10689
  onClick: function onClick() {
10686
10690
  return OpenDropDown(index);
10687
10691
  }
10688
- }, React__default.createElement(PrinterIcon, null), React__default.createElement(DownIcon, null), printToogle == index && React__default.createElement("div", {
10692
+ }, React__default.createElement(PrinterIcon, null), React__default.createElement(DownIcon, null), printToogle === index && React__default.createElement("div", {
10689
10693
  ref: dropdownRef
10690
10694
  }, React__default.createElement(PrintDropDown, {
10691
- legacyProductId: item.id
10695
+ legacyProductId: item
10692
10696
  })))), React__default.createElement("li", {
10693
10697
  className: "downloadcontainer"
10694
10698
  }, React__default.createElement(LoadIcon, null)))));