jett.admin.npmpackage 1.0.15 → 1.0.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/dist/index.js CHANGED
@@ -586,6 +586,8 @@ var sidebarlogo_default = "./sidebarlogo-S4TNJORM.webp";
586
586
 
587
587
  // src/sideBar/SideBar.jsx
588
588
  var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) => {
589
+ var _a, _b;
590
+ const [authData, setAuthData] = (0, import_react11.useState)(null);
589
591
  const handleIconRotate = (e, index, additionalKey) => {
590
592
  let dropDownIcon = e.currentTarget.children[2];
591
593
  if (!dropDownIcon) return;
@@ -606,6 +608,28 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
606
608
  optionsContainer.classList.add("max-h-0");
607
609
  }
608
610
  };
611
+ const checkForAuthData = () => {
612
+ const params = new URLSearchParams(window.location.search);
613
+ let authData2 = params.get("authData");
614
+ if (authData2) {
615
+ authData2 = atob(authData2);
616
+ localStorage.setItem("authData", authData2);
617
+ setAuthData(JSON.parse(authData2));
618
+ params.delete("authData");
619
+ const newUrl = window.location.pathname + (params.toString() ? "?" + params.toString() : "");
620
+ window.history.replaceState({}, document.title, newUrl);
621
+ }
622
+ };
623
+ (0, import_react11.useEffect)(() => {
624
+ checkForAuthData();
625
+ }, []);
626
+ (0, import_react11.useEffect)(() => {
627
+ const storedAuthData = localStorage.getItem("authData");
628
+ if (storedAuthData) {
629
+ let parseData = JSON.parse(storedAuthData);
630
+ setAuthData(parseData);
631
+ }
632
+ }, [localStorage.getItem("authData")]);
609
633
  const navItemsLocal = navItems ?? navItemsConstant;
610
634
  const additionalItemsLocal = additionalItems ?? additionalItemsConstant;
611
635
  const sideBarLogoLocal = sideBarLogo ?? sidebarlogo_default;
@@ -632,7 +656,7 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
632
656
  {
633
657
  className: "p-2 rounded-lg hover:bg-gray-100 text-[#3f3f46cc] dark:hover:bg-[#27272a] dark:text-[#f4f4f5cc] font-medium text-sm",
634
658
  onClick: (e) => {
635
- subOption.onClick && options.onClick();
659
+ subOption.onClick && subOption.onClick();
636
660
  }
637
661
  },
638
662
  subOption.label
@@ -643,7 +667,7 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
643
667
  return /* @__PURE__ */ import_react11.default.createElement("div", { key: index, className: "flex items-center gap-3 p-2 hover:bg-[#f3f4f6] dark:hover:bg-[#27272a] dark:text-[#f4f4f5cc] cursor-pointer", onClick: () => item.onClick && item.onClick() }, /* @__PURE__ */ import_react11.default.createElement(item.Icon, { width: 20, height: 20 }), /* @__PURE__ */ import_react11.default.createElement("span", { className: "font-medium text-[#3f3f46cc] dark:text-[#f4f4f5cc]" }, item.label));
644
668
  }))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "mt-auto bg-[#fafafa] dark:bg-transparent sticky bottom-0 pt-2" }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center justify-between p-2 rounded-lg hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] cursor-pointer", onClick: () => {
645
669
  window.location.href = "/profile";
646
- } }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "flex h-full w-full items-center justify-center rounded-full bg-muted" }, username && username.split("")[0])), /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement("p", { className: "font-semibold" }, username), /* @__PURE__ */ import_react11.default.createElement("p", { className: "text-sm text-[#3f3f46cc] dark:text-[#f4f4f5cc]" }, role))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "text-[#18181b] dark:text-[#f4f4f5cc]" }, /* @__PURE__ */ import_react11.default.createElement(import_lucide_react5.LogOut, null)))));
670
+ } }, /* @__PURE__ */ import_react11.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10" }, /* @__PURE__ */ import_react11.default.createElement("span", { className: "flex h-full w-full items-center justify-center rounded-full bg-muted" }, ((_a = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _a.UserName) ? authData.userInfo.UserName.split("")[0] : "A")), /* @__PURE__ */ import_react11.default.createElement("div", null, /* @__PURE__ */ import_react11.default.createElement("p", { className: "font-semibold" }, ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.UserName) ? authData.userInfo.UserName : "Admin User"), /* @__PURE__ */ import_react11.default.createElement("p", { className: "text-sm text-[#3f3f46cc] dark:text-[#f4f4f5cc]" }, role))), /* @__PURE__ */ import_react11.default.createElement("div", { className: "text-[#18181b] dark:text-[#f4f4f5cc]" }, /* @__PURE__ */ import_react11.default.createElement(import_lucide_react5.LogOut, null)))));
647
671
  };
648
672
 
649
673
  // src/RightSheet/RightSheet.jsx
package/dist/index.mjs CHANGED
@@ -393,7 +393,7 @@ var CustomUpload = ({
393
393
 
394
394
  // src/sideBar/SideBar.jsx
395
395
  import { ChevronDown as ChevronDown2, Globe as Globe2, LogOut } from "lucide-react";
396
- import React11 from "react";
396
+ import React11, { useEffect, useState as useState2 } from "react";
397
397
 
398
398
  // ConstantUI.js
399
399
  import { Home, BaggageClaim, Users, Banknote, Globe, TrendingUp, FileText, FileKey2, LifeBuoy, Cog, Building, Handshake, DollarSign } from "lucide-react";
@@ -539,6 +539,8 @@ var sidebarlogo_default = "./sidebarlogo-S4TNJORM.webp";
539
539
 
540
540
  // src/sideBar/SideBar.jsx
541
541
  var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) => {
542
+ var _a, _b;
543
+ const [authData, setAuthData] = useState2(null);
542
544
  const handleIconRotate = (e, index, additionalKey) => {
543
545
  let dropDownIcon = e.currentTarget.children[2];
544
546
  if (!dropDownIcon) return;
@@ -559,6 +561,28 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
559
561
  optionsContainer.classList.add("max-h-0");
560
562
  }
561
563
  };
564
+ const checkForAuthData = () => {
565
+ const params = new URLSearchParams(window.location.search);
566
+ let authData2 = params.get("authData");
567
+ if (authData2) {
568
+ authData2 = atob(authData2);
569
+ localStorage.setItem("authData", authData2);
570
+ setAuthData(JSON.parse(authData2));
571
+ params.delete("authData");
572
+ const newUrl = window.location.pathname + (params.toString() ? "?" + params.toString() : "");
573
+ window.history.replaceState({}, document.title, newUrl);
574
+ }
575
+ };
576
+ useEffect(() => {
577
+ checkForAuthData();
578
+ }, []);
579
+ useEffect(() => {
580
+ const storedAuthData = localStorage.getItem("authData");
581
+ if (storedAuthData) {
582
+ let parseData = JSON.parse(storedAuthData);
583
+ setAuthData(parseData);
584
+ }
585
+ }, [localStorage.getItem("authData")]);
562
586
  const navItemsLocal = navItems ?? navItemsConstant;
563
587
  const additionalItemsLocal = additionalItems ?? additionalItemsConstant;
564
588
  const sideBarLogoLocal = sideBarLogo ?? sidebarlogo_default;
@@ -585,7 +609,7 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
585
609
  {
586
610
  className: "p-2 rounded-lg hover:bg-gray-100 text-[#3f3f46cc] dark:hover:bg-[#27272a] dark:text-[#f4f4f5cc] font-medium text-sm",
587
611
  onClick: (e) => {
588
- subOption.onClick && options.onClick();
612
+ subOption.onClick && subOption.onClick();
589
613
  }
590
614
  },
591
615
  subOption.label
@@ -596,14 +620,14 @@ var AppSideBar = ({ username, role, navItems, additionalItems, sideBarLogo }) =>
596
620
  return /* @__PURE__ */ React11.createElement("div", { key: index, className: "flex items-center gap-3 p-2 hover:bg-[#f3f4f6] dark:hover:bg-[#27272a] dark:text-[#f4f4f5cc] cursor-pointer", onClick: () => item.onClick && item.onClick() }, /* @__PURE__ */ React11.createElement(item.Icon, { width: 20, height: 20 }), /* @__PURE__ */ React11.createElement("span", { className: "font-medium text-[#3f3f46cc] dark:text-[#f4f4f5cc]" }, item.label));
597
621
  }))), /* @__PURE__ */ React11.createElement("div", { className: "mt-auto bg-[#fafafa] dark:bg-transparent sticky bottom-0 pt-2" }, /* @__PURE__ */ React11.createElement("div", { className: "flex items-center justify-between p-2 rounded-lg hover:bg-[#f4f4f5] dark:hover:bg-[#27272a] cursor-pointer", onClick: () => {
598
622
  window.location.href = "/profile";
599
- } }, /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React11.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10" }, /* @__PURE__ */ React11.createElement("span", { className: "flex h-full w-full items-center justify-center rounded-full bg-muted" }, username && username.split("")[0])), /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("p", { className: "font-semibold" }, username), /* @__PURE__ */ React11.createElement("p", { className: "text-sm text-[#3f3f46cc] dark:text-[#f4f4f5cc]" }, role))), /* @__PURE__ */ React11.createElement("div", { className: "text-[#18181b] dark:text-[#f4f4f5cc]" }, /* @__PURE__ */ React11.createElement(LogOut, null)))));
623
+ } }, /* @__PURE__ */ React11.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React11.createElement("span", { className: "relative flex shrink-0 overflow-hidden rounded-full h-10 w-10" }, /* @__PURE__ */ React11.createElement("span", { className: "flex h-full w-full items-center justify-center rounded-full bg-muted" }, ((_a = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _a.UserName) ? authData.userInfo.UserName.split("")[0] : "A")), /* @__PURE__ */ React11.createElement("div", null, /* @__PURE__ */ React11.createElement("p", { className: "font-semibold" }, ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.UserName) ? authData.userInfo.UserName : "Admin User"), /* @__PURE__ */ React11.createElement("p", { className: "text-sm text-[#3f3f46cc] dark:text-[#f4f4f5cc]" }, role))), /* @__PURE__ */ React11.createElement("div", { className: "text-[#18181b] dark:text-[#f4f4f5cc]" }, /* @__PURE__ */ React11.createElement(LogOut, null)))));
600
624
  };
601
625
 
602
626
  // src/RightSheet/RightSheet.jsx
603
- import React12, { useEffect, useState as useState2 } from "react";
627
+ import React12, { useEffect as useEffect2, useState as useState3 } from "react";
604
628
  var RightSheet = ({ open, setOpen, children, callBack }) => {
605
- const [visible, setVisible] = useState2(open);
606
- useEffect(() => {
629
+ const [visible, setVisible] = useState3(open);
630
+ useEffect2(() => {
607
631
  if (open) {
608
632
  document.body.style.overflow = "hidden";
609
633
  setVisible(true);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jett.admin.npmpackage",
3
- "version": "1.0.15",
3
+ "version": "1.0.17",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "exports": {