@bjsdistribution/dms-client-return 0.0.90 → 0.0.91

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.
@@ -5,7 +5,7 @@ import { Select, notification, Skeleton, Empty, DatePicker, Input as Input$2 } f
5
5
  import { useAtom, atom } from 'jotai';
6
6
  import { format, isValid } from 'date-fns';
7
7
  import { atomWithReducer } from 'jotai/utils';
8
- import { useApiHook, Checkbox as Checkbox$1, AntTable, Alert, AntModal, Label as Label$j, Input as Input$1, TextArea, FormSection, displayValueOrNA as displayValueOrNA$1, dropdownStyles, SelectDropdown, RadioButtonGroup as RadioButtonGroup$1, Switch, useAxios, Button, getBaseEndpoint, formatDateTime, SectionHeader, CrossIcon, AntSelect, CustomRating, CancelationModal, CancelAndCompleteAction, filterDropdownStyles, BackgroundModal as BackgroundModal$1, FlagAlert, ViewIcon } from '@bjsdistribution/dms-component-library';
8
+ import { useApiHook, Checkbox as Checkbox$1, AntTable, Alert, AntModal, Label as Label$j, Input as Input$1, TextArea, FormSection, displayValueOrNA as displayValueOrNA$1, dropdownStyles, SelectDropdown, RadioButtonGroup as RadioButtonGroup$1, Switch, useAxios, Button, formatDateTime, SectionHeader, CrossIcon, AntSelect, CustomRating, CancelationModal, CancelAndCompleteAction, filterDropdownStyles, BackgroundModal as BackgroundModal$1, FlagAlert, ViewIcon } from '@bjsdistribution/dms-component-library';
9
9
  import dayjs from 'dayjs';
10
10
  import 'react-datepicker/dist/react-datepicker.css';
11
11
  import { useReactTable, getCoreRowModel, getSortedRowModel, flexRender } from '@tanstack/react-table';
@@ -2008,17 +2008,6 @@ var DefectsData = [{
2008
2008
  date: '6/11/2024 11:26:05 AM',
2009
2009
  images: ''
2010
2010
  }];
2011
- var getCookie = function getCookie(name) {
2012
- var value = "; " + document.cookie;
2013
- var parts = value.split("; " + name + "=");
2014
- if (parts.length === 2) {
2015
- var lastPart = parts.pop();
2016
- if (lastPart !== undefined) {
2017
- return lastPart.split(';').shift() || null;
2018
- }
2019
- }
2020
- return null;
2021
- };
2022
2011
  var handleKeyDown = function handleKeyDown(e) {
2023
2012
  // Allowed keys: numbers (0-9), '.', '-', '+'
2024
2013
  var allowedKeys = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '.', '-', '+', 'ArrowLeft', 'ArrowRight'];
@@ -5487,7 +5476,6 @@ function AddNote() {
5487
5476
  var location = useLocation();
5488
5477
  var pathname = location.pathname;
5489
5478
  var orderIdLocaation = pathname.split('/')[1];
5490
- var ssoToken = getCookie('id_token');
5491
5479
  var _usemoduleIds = usemoduleIds(),
5492
5480
  moduleIds = _usemoduleIds[0];
5493
5481
  var _useGlobalStateHitAud = useGlobalStateHitAuditLog(),
@@ -5495,12 +5483,17 @@ function AddNote() {
5495
5483
  var _useSelectedData = useSelectedData(),
5496
5484
  selected = _useSelectedData[0];
5497
5485
  // Save New Note
5486
+ var _useAxios = useAxios({
5487
+ endpoint: "/audit_logs/orders/",
5488
+ method: 'POST'
5489
+ }),
5490
+ callAuditLogs = _useAxios.fetchData;
5498
5491
  var _useState2 = useState(null),
5499
5492
  notificationData = _useState2[0],
5500
5493
  setNotificationData = _useState2[1];
5501
5494
  var saveNote = /*#__PURE__*/function () {
5502
5495
  var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
5503
- var endpoint, payload, response;
5496
+ var payload, response;
5504
5497
  return _regeneratorRuntime().wrap(function _callee$(_context) {
5505
5498
  while (1) switch (_context.prev = _context.next) {
5506
5499
  case 0:
@@ -5511,7 +5504,6 @@ function AddNote() {
5511
5504
  }
5512
5505
  return _context.abrupt("return");
5513
5506
  case 3:
5514
- endpoint = getBaseEndpoint() + "/audit_logs/orders/";
5515
5507
  payload = {
5516
5508
  audit_logs: [{
5517
5509
  parent_object_id: orderId || orderIdLocaation,
@@ -5524,47 +5516,41 @@ function AddNote() {
5524
5516
  manual: 1,
5525
5517
  is_private: selected
5526
5518
  }]
5527
- }; //to change
5528
- _context.prev = 5;
5529
- _context.next = 8;
5530
- return fetch(endpoint, {
5531
- method: 'POST',
5532
- headers: {
5533
- 'Content-Type': 'application/json',
5534
- Authorization: "Bearer " + ssoToken
5535
- },
5536
- body: JSON.stringify(payload)
5519
+ };
5520
+ _context.prev = 4;
5521
+ _context.next = 7;
5522
+ return callAuditLogs({
5523
+ payload: payload
5537
5524
  });
5538
- case 8:
5525
+ case 7:
5539
5526
  response = _context.sent;
5540
- // setNoteLoadingStore(false);
5541
- if (response.ok) {
5527
+ if (response.code == 200 && response != null && response.data) {
5542
5528
  notification.success({
5543
5529
  message: 'Success',
5544
- description: 'Note saved successfully.'
5530
+ description: "" + (response == null ? void 0 : response.message)
5545
5531
  });
5546
5532
  setNoteText('');
5547
5533
  setRecallAuditLog(true);
5548
5534
  } else {
5549
5535
  notification.error({
5550
5536
  message: 'Error',
5551
- description: 'Failed to save note.'
5537
+ description: "" + (response == null ? void 0 : response.error)
5552
5538
  });
5553
5539
  }
5554
- _context.next = 15;
5540
+ _context.next = 14;
5555
5541
  break;
5556
- case 12:
5557
- _context.prev = 12;
5558
- _context.t0 = _context["catch"](5);
5542
+ case 11:
5543
+ _context.prev = 11;
5544
+ _context.t0 = _context["catch"](4);
5559
5545
  notification.error({
5560
5546
  message: 'Error',
5561
5547
  description: 'Failed to save note due to an error.'
5562
5548
  });
5563
- case 15:
5549
+ case 14:
5564
5550
  case "end":
5565
5551
  return _context.stop();
5566
5552
  }
5567
- }, _callee, null, [[5, 12]]);
5553
+ }, _callee, null, [[4, 11]]);
5568
5554
  }));
5569
5555
  return function saveNote() {
5570
5556
  return _ref.apply(this, arguments);
@@ -6797,10 +6783,6 @@ var reminderData = /*#__PURE__*/atom([]);
6797
6783
  var resolvedModalPayload = /*#__PURE__*/atom(resolvedValue);
6798
6784
  var routeDetails = /*#__PURE__*/atom({});
6799
6785
  var orderNotifyCount = /*#__PURE__*/atom(0);
6800
- var taskLoading = /*#__PURE__*/atom(true);
6801
- function useTaskLoading() {
6802
- return useAtom(taskLoading);
6803
- }
6804
6786
  var initialConfirmOrderErrValues = {
6805
6787
  homeContactError: '',
6806
6788
  workContactError: '',
@@ -11590,7 +11572,7 @@ var NotifyFlag = function NotifyFlag() {
11590
11572
  }));
11591
11573
  };
11592
11574
 
11593
- var _templateObject$2e, _templateObject2$1D, _templateObject3$V, _templateObject4$w, _templateObject5$m, _templateObject6$c, _templateObject7$c, _templateObject8$a, _templateObject9$6, _templateObject10$4, _templateObject11$4, _templateObject12$2;
11575
+ var _templateObject$2e, _templateObject2$1D, _templateObject3$V, _templateObject4$w, _templateObject5$m, _templateObject6$c, _templateObject7$c, _templateObject8$a, _templateObject9$6;
11594
11576
  function Notification() {
11595
11577
  var _OrderData$order_rout;
11596
11578
  var _useTabType = useTabType(),
@@ -11603,8 +11585,7 @@ function Notification() {
11603
11585
  var _useNotificationData = useNotificationData(),
11604
11586
  notificationData = _useNotificationData[0],
11605
11587
  setNotififcationData = _useNotificationData[1];
11606
- var _useTaskLoading = useTaskLoading(),
11607
- flagLoading = _useTaskLoading[0];
11588
+ // const [flagLoading] = useTaskLoading();
11608
11589
  var _useReminderNotiData = useReminderNotiData(),
11609
11590
  reminderData = _useReminderNotiData[0],
11610
11591
  setReminderData = _useReminderNotiData[1];
@@ -11756,7 +11737,7 @@ function Notification() {
11756
11737
  onClick: function onClick() {
11757
11738
  return handleTabChange('closed');
11758
11739
  }
11759
- }, "Closed", React.createElement(ClosedCount, null, totalClosedCount)))), flagLoading ? React.createElement(Loader, null, React.createElement(Spinner, null), React.createElement(Text$9, null, "Fetching Notifications...")) : notificationData.length > 0 || reminderData.length > 0 || OrderData ? React.createElement(TabsWrapper, null, React.createElement(Tabs, {
11740
+ }, "Closed", React.createElement(ClosedCount, null, totalClosedCount)))), notificationData.length > 0 || reminderData.length > 0 || OrderData ? React.createElement(TabsWrapper, null, React.createElement(Tabs, {
11760
11741
  activeNotifications: activeNotifications,
11761
11742
  closedNotifications: closedNotifications,
11762
11743
  activeReminders: activeReminders,
@@ -11766,21 +11747,41 @@ function Notification() {
11766
11747
  })) : 'No Notifications Found'));
11767
11748
  }
11768
11749
  var Container$1a = /*#__PURE__*/styled.div(_templateObject$2e || (_templateObject$2e = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 20px;\n padding: 10px;\n border-bottom: 1px solid #ccc;\n"])));
11769
- var Loader = /*#__PURE__*/styled.div(_templateObject2$1D || (_templateObject2$1D = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n align-items: center;\n justify-content: center;\n display: flex;\n flex-direction: column;\n gap: 10px;\n"])));
11770
- var Spinner = /*#__PURE__*/styled.div(_templateObject3$V || (_templateObject3$V = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border: 4px solid rgba(0, 0, 0, 0.1);\n border-left-color: #3a3630;\n border-radius: 50%;\n width: 40px;\n height: 40px;\n animation: spin 1s linear infinite;\n\n @keyframes spin {\n 0% {\n transform: rotate(0deg);\n }\n 100% {\n transform: rotate(360deg);\n }\n }\n"])));
11771
- var FlagContainer = /*#__PURE__*/styled.div(_templateObject4$w || (_templateObject4$w = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 8px;\n background-color: #3a3630;\n border-radius: 10px;\n"])));
11772
- var TabsData = /*#__PURE__*/styled.div(_templateObject5$m || (_templateObject5$m = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 20px;\n padding: 10px;\n"])));
11773
- var ActiveCount = /*#__PURE__*/styled.div(_templateObject6$c || (_templateObject6$c = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #ffffff;\n padding: 1px 5px;\n background-color: #6396e5;\n border-radius: 6px;\n"])));
11774
- var ClosedCount = /*#__PURE__*/styled.div(_templateObject7$c || (_templateObject7$c = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #ffffff;\n padding: 1px 5px;\n background-color: #e95252;\n border-radius: 6px;\n"])));
11775
- var StyledTab = /*#__PURE__*/styled.div(_templateObject8$a || (_templateObject8$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 5px;\n cursor: pointer;\n color: ", ";\n border-bottom: ", ";\n transition: border-bottom 0.3s ease;\n font-family: 'Roboto', sans-serif;\n padding-bottom: 5px;\n align-items: center;\n"])), function (props) {
11750
+ // const Loader = styled.div`
11751
+ // align-items: center;
11752
+ // justify-content: center;
11753
+ // display: flex;
11754
+ // flex-direction: column;
11755
+ // gap: 10px;
11756
+ // `;
11757
+ // const Spinner = styled.div`
11758
+ // border: 4px solid rgba(0, 0, 0, 0.1);
11759
+ // border-left-color: #3a3630;
11760
+ // border-radius: 50%;
11761
+ // width: 40px;
11762
+ // height: 40px;
11763
+ // animation: spin 1s linear infinite;
11764
+ // @keyframes spin {
11765
+ // 0% {
11766
+ // transform: rotate(0deg);
11767
+ // }
11768
+ // 100% {
11769
+ // transform: rotate(360deg);
11770
+ // }
11771
+ // }
11772
+ // `;
11773
+ var FlagContainer = /*#__PURE__*/styled.div(_templateObject2$1D || (_templateObject2$1D = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n padding: 8px;\n background-color: #3a3630;\n border-radius: 10px;\n"])));
11774
+ var TabsData = /*#__PURE__*/styled.div(_templateObject3$V || (_templateObject3$V = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n align-items: center;\n gap: 20px;\n padding: 10px;\n"])));
11775
+ var ActiveCount = /*#__PURE__*/styled.div(_templateObject4$w || (_templateObject4$w = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #ffffff;\n padding: 1px 5px;\n background-color: #6396e5;\n border-radius: 6px;\n"])));
11776
+ var ClosedCount = /*#__PURE__*/styled.div(_templateObject5$m || (_templateObject5$m = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: #ffffff;\n padding: 1px 5px;\n background-color: #e95252;\n border-radius: 6px;\n"])));
11777
+ var StyledTab = /*#__PURE__*/styled.div(_templateObject6$c || (_templateObject6$c = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n gap: 5px;\n cursor: pointer;\n color: ", ";\n border-bottom: ", ";\n transition: border-bottom 0.3s ease;\n font-family: 'Roboto', sans-serif;\n padding-bottom: 5px;\n align-items: center;\n"])), function (props) {
11776
11778
  return props.active ? '#3a3630' : '#AEA9A1';
11777
11779
  }, function (props) {
11778
11780
  return props.active ? '2px solid #feba30' : '2px solid #eeeeee';
11779
11781
  });
11780
- var Section$1 = /*#__PURE__*/styled.div(_templateObject9$6 || (_templateObject9$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 14px;\n background: #ffffff;\n border-radius: 12px;\n padding: 10px;\n box-shadow: 0px 4px 30px 0px rgba(46, 45, 116, 0.05);\n border: 1px solid #e0e0e0;\n"])));
11781
- var Label$i = /*#__PURE__*/styled(SectionHeader)(_templateObject10$4 || (_templateObject10$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-bottom: 1px solid #ccc;\n font-family: 'Roboto', sans-serif;\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px; /* 150% */\n text-transform: uppercase;\n"])));
11782
- var TabsWrapper = /*#__PURE__*/styled.div(_templateObject11$4 || (_templateObject11$4 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n /* min-height: 200px; */\n max-height: 250px;\n overflow-y: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n\n &:hover {\n scrollbar-width: thin;\n }\n\n &::-webkit-scrollbar {\n width: 0;\n }\n\n &:hover::-webkit-scrollbar {\n width: 8px;\n }\n\n &::-webkit-scrollbar-thumb {\n background-color: rgba(0, 0, 0, 0.5);\n }\n"])));
11783
- var Text$9 = /*#__PURE__*/styled.div(_templateObject12$2 || (_templateObject12$2 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n color: var(--tonal-brown-651, #6a7378);\n font-family: Lato;\n font-size: 13px;\n font-style: normal;\n font-weight: 600;\n"])));
11782
+ var Section$1 = /*#__PURE__*/styled.div(_templateObject7$c || (_templateObject7$c = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: flex;\n flex-direction: column;\n gap: 14px;\n background: #ffffff;\n border-radius: 12px;\n padding: 10px;\n box-shadow: 0px 4px 30px 0px rgba(46, 45, 116, 0.05);\n border: 1px solid #e0e0e0;\n"])));
11783
+ var Label$i = /*#__PURE__*/styled(SectionHeader)(_templateObject8$a || (_templateObject8$a = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n border-bottom: 1px solid #ccc;\n font-family: 'Roboto', sans-serif;\n font-size: 16px;\n font-style: normal;\n font-weight: 500;\n line-height: 24px; /* 150% */\n text-transform: uppercase;\n"])));
11784
+ var TabsWrapper = /*#__PURE__*/styled.div(_templateObject9$6 || (_templateObject9$6 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n /* min-height: 200px; */\n max-height: 250px;\n overflow-y: auto;\n scrollbar-width: none;\n -ms-overflow-style: none;\n\n &:hover {\n scrollbar-width: thin;\n }\n\n &::-webkit-scrollbar {\n width: 0;\n }\n\n &:hover::-webkit-scrollbar {\n width: 8px;\n }\n\n &::-webkit-scrollbar-thumb {\n background-color: rgba(0, 0, 0, 0.5);\n }\n"])));
11784
11785
 
11785
11786
  var _templateObject$2f;
11786
11787
  function CollapsedContent$2() {