jett.admin.npmpackage 2.0.4 → 2.0.5

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.css CHANGED
@@ -1279,11 +1279,6 @@
1279
1279
  color: var(--color-red-100);
1280
1280
  }
1281
1281
  }
1282
- .dark\:text-red-400 {
1283
- &:where(.dark, .dark *) {
1284
- color: var(--color-red-400);
1285
- }
1286
- }
1287
1282
  .dark\:text-white {
1288
1283
  &:where(.dark, .dark *) {
1289
1284
  color: var(--color-white);
package/dist/index.js CHANGED
@@ -627,9 +627,6 @@ var additionalItemsConstant = [
627
627
  }
628
628
  ];
629
629
 
630
- // src/assests/logo/logo-white.svg
631
- var logo_white_default = "./logo-white-RYMEJOWI.svg";
632
-
633
630
  // src/sideBar/SideBar.jsx
634
631
  var import_js_cookie = __toESM(require("js-cookie"));
635
632
 
@@ -720,6 +717,54 @@ var CustomSelect = ({
720
717
  );
721
718
  };
722
719
 
720
+ // src/utils/cookieHelpers.js
721
+ var JETT_ID_COOKIE_NAME = "jett-id";
722
+ function getCookie(name) {
723
+ if (typeof document === "undefined" || !document.cookie) return null;
724
+ const match = document.cookie.match(
725
+ new RegExp("(^|\\s)" + name + "=([^;]+)")
726
+ );
727
+ return match ? decodeURIComponent(match[2].trim()) : null;
728
+ }
729
+ function decodeBase64(value) {
730
+ try {
731
+ let base64 = value.replace(/-/g, "+").replace(/_/g, "/");
732
+ const pad = base64.length % 4;
733
+ if (pad) base64 += "=".repeat(4 - pad);
734
+ return atob(base64);
735
+ } catch {
736
+ return "";
737
+ }
738
+ }
739
+ function getJettIdCookieData() {
740
+ const raw = getCookie(JETT_ID_COOKIE_NAME);
741
+ if (!raw) return null;
742
+ try {
743
+ const decoded = decodeBase64(raw);
744
+ if (!decoded) return null;
745
+ const data = JSON.parse(decoded);
746
+ return data && typeof data === "object" ? data : null;
747
+ } catch {
748
+ return null;
749
+ }
750
+ }
751
+ function getLogoFromJettIdCookie() {
752
+ const data = getJettIdCookieData();
753
+ if (!(data == null ? void 0 : data.CDNBasePath)) return null;
754
+ const logoPath = (data.OrgLogo || data.TmcLogo || "").trim();
755
+ if (!logoPath) return null;
756
+ return {
757
+ logoPath,
758
+ CDNBasePath: data.CDNBasePath
759
+ };
760
+ }
761
+ function buildLogoUrl(CDNBasePath, logoPath) {
762
+ const base = (CDNBasePath || "").replace(/\/$/, "");
763
+ const path = (logoPath || "").replace(/^\//, "");
764
+ if (!base || !path) return "";
765
+ return `${base}/${path}`;
766
+ }
767
+
723
768
  // src/sideBar/SideBar.jsx
724
769
  var AppSideBar = ({
725
770
  username,
@@ -728,7 +773,7 @@ var AppSideBar = ({
728
773
  additionalItems,
729
774
  sideBarLogo
730
775
  }) => {
731
- var _a, _b;
776
+ var _a, _b, _c, _d;
732
777
  const [authData, setAuthData] = (0, import_react12.useState)(null);
733
778
  const [selectedCountry, setSelectedCountry] = (0, import_react12.useState)("dubai");
734
779
  const [isMobileMenuOpen, setIsMobileMenuOpen] = (0, import_react12.useState)(false);
@@ -947,7 +992,13 @@ var AppSideBar = ({
947
992
  };
948
993
  const navItemsLocal = navItems ?? navItemsConstant;
949
994
  const additionalItemsLocal = additionalItems ?? additionalItemsConstant;
950
- const sideBarLogoLocal = sideBarLogo ?? logo_white_default;
995
+ const logoFromCookie = getLogoFromJettIdCookie();
996
+ const logoUrlFromCookie = logoFromCookie ? buildLogoUrl(logoFromCookie.CDNBasePath, logoFromCookie.logoPath) : null;
997
+ const logoUrlFromUserInfo = ((_a = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _a.CDNBasePath) && ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.OrgLogo) ? buildLogoUrl(
998
+ authData.userInfo.CDNBasePath,
999
+ authData.userInfo.OrgLogo
1000
+ ) : null;
1001
+ const sideBarLogoLocal = sideBarLogo ?? logoUrlFromCookie ?? logoUrlFromUserInfo ?? null;
951
1002
  const detectAndSetActiveMenu = (0, import_react12.useCallback)(() => {
952
1003
  const currentPath = window.location.pathname;
953
1004
  const currentSearch = window.location.search;
@@ -1034,10 +1085,10 @@ var AppSideBar = ({
1034
1085
  "aria-label": "Toggle menu"
1035
1086
  },
1036
1087
  isMobileMenuOpen ? /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.X, { className: "w-6 h-6 text-gray-700 dark:text-[#f4f4f5cc]" }) : /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.Menu, { className: "w-6 h-6 text-gray-700 dark:text-[#f4f4f5cc]" })
1037
- ), /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex-1 flex justify-center" }, sideBarLogo && /* @__PURE__ */ import_react12.default.createElement(
1088
+ ), /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex-1 flex justify-center" }, sideBarLogoLocal && /* @__PURE__ */ import_react12.default.createElement(
1038
1089
  "img",
1039
1090
  {
1040
- src: sideBarLogo,
1091
+ src: sideBarLogoLocal,
1041
1092
  alt: "sidebarLogo",
1042
1093
  width: 108,
1043
1094
  height: 40,
@@ -1054,10 +1105,10 @@ var AppSideBar = ({
1054
1105
  {
1055
1106
  className: `fixed top-0 left-0 md:relative w-[320px] transition-all ease-in-out delay-100 bg-white dark:bg-[#18181b] border-r border-gray-200 dark:border-[#303036] flex flex-col p-4 pt-20 md:pt-4 h-full max-h-[100vh] xs:max-md:z-40 md:max-lg:w-[280px] ${isMobileMenuOpen ? "translate-x-0" : "-translate-x-full md:translate-x-0"}`
1056
1107
  },
1057
- /* @__PURE__ */ import_react12.default.createElement("div", { className: "p-2 mb-2 hidden md:block" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center justify-center w-full h-[60px] mb-2" }, sideBarLogo && /* @__PURE__ */ import_react12.default.createElement(
1108
+ /* @__PURE__ */ import_react12.default.createElement("div", { className: "p-2 mb-2 hidden md:block" }, /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center justify-center w-full h-[60px] mb-2" }, sideBarLogoLocal && /* @__PURE__ */ import_react12.default.createElement(
1058
1109
  "img",
1059
1110
  {
1060
- src: sideBarLogo,
1111
+ src: sideBarLogoLocal,
1061
1112
  alt: "sidebarLogo",
1062
1113
  width: 108,
1063
1114
  height: 40,
@@ -1138,7 +1189,7 @@ var AppSideBar = ({
1138
1189
  window.location.href = "/profile";
1139
1190
  }
1140
1191
  },
1141
- /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "relative flex shrink-0 overflow-hidden dark:bg-[#27272a] rounded-full h-10 w-10" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "flex h-full w-full items-center justify-center !text-[16px] !font-normal border border-gray-200 dark:border-[#303036] rounded-full bg-muted dark:text-white" }, ((_a = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _a.UserName) ? authData.userInfo.UserName.split("")[0] : "A")), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("p", { className: "!font-semibold dark:text-white !text-[16px]" }, ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.UserName) ? authData.userInfo.UserName : "Admin"), /* @__PURE__ */ import_react12.default.createElement("p", { className: "!text-[14px] !font-normal dark:text-[#f4f4f5cc]" }, role)))
1192
+ /* @__PURE__ */ import_react12.default.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "relative flex shrink-0 overflow-hidden dark:bg-[#27272a] rounded-full h-10 w-10" }, /* @__PURE__ */ import_react12.default.createElement("span", { className: "flex h-full w-full items-center justify-center !text-[16px] !font-normal border border-gray-200 dark:border-[#303036] rounded-full bg-muted dark:text-white" }, ((_c = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _c.UserName) ? authData.userInfo.UserName.split("")[0] : "A")), /* @__PURE__ */ import_react12.default.createElement("div", null, /* @__PURE__ */ import_react12.default.createElement("p", { className: "!font-semibold dark:text-white !text-[16px]" }, ((_d = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _d.UserName) ? authData.userInfo.UserName : "Admin"), /* @__PURE__ */ import_react12.default.createElement("p", { className: "!text-[14px] !font-normal dark:text-[#f4f4f5cc]" }, role)))
1142
1193
  ))
1143
1194
  ));
1144
1195
  };
package/dist/index.mjs CHANGED
@@ -594,9 +594,6 @@ var additionalItemsConstant = [
594
594
  }
595
595
  ];
596
596
 
597
- // src/assests/logo/logo-white.svg
598
- var logo_white_default = "./logo-white-RYMEJOWI.svg";
599
-
600
597
  // src/sideBar/SideBar.jsx
601
598
  import Cookies from "js-cookie";
602
599
 
@@ -687,6 +684,54 @@ var CustomSelect = ({
687
684
  );
688
685
  };
689
686
 
687
+ // src/utils/cookieHelpers.js
688
+ var JETT_ID_COOKIE_NAME = "jett-id";
689
+ function getCookie(name) {
690
+ if (typeof document === "undefined" || !document.cookie) return null;
691
+ const match = document.cookie.match(
692
+ new RegExp("(^|\\s)" + name + "=([^;]+)")
693
+ );
694
+ return match ? decodeURIComponent(match[2].trim()) : null;
695
+ }
696
+ function decodeBase64(value) {
697
+ try {
698
+ let base64 = value.replace(/-/g, "+").replace(/_/g, "/");
699
+ const pad = base64.length % 4;
700
+ if (pad) base64 += "=".repeat(4 - pad);
701
+ return atob(base64);
702
+ } catch {
703
+ return "";
704
+ }
705
+ }
706
+ function getJettIdCookieData() {
707
+ const raw = getCookie(JETT_ID_COOKIE_NAME);
708
+ if (!raw) return null;
709
+ try {
710
+ const decoded = decodeBase64(raw);
711
+ if (!decoded) return null;
712
+ const data = JSON.parse(decoded);
713
+ return data && typeof data === "object" ? data : null;
714
+ } catch {
715
+ return null;
716
+ }
717
+ }
718
+ function getLogoFromJettIdCookie() {
719
+ const data = getJettIdCookieData();
720
+ if (!(data == null ? void 0 : data.CDNBasePath)) return null;
721
+ const logoPath = (data.OrgLogo || data.TmcLogo || "").trim();
722
+ if (!logoPath) return null;
723
+ return {
724
+ logoPath,
725
+ CDNBasePath: data.CDNBasePath
726
+ };
727
+ }
728
+ function buildLogoUrl(CDNBasePath, logoPath) {
729
+ const base = (CDNBasePath || "").replace(/\/$/, "");
730
+ const path = (logoPath || "").replace(/^\//, "");
731
+ if (!base || !path) return "";
732
+ return `${base}/${path}`;
733
+ }
734
+
690
735
  // src/sideBar/SideBar.jsx
691
736
  var AppSideBar = ({
692
737
  username,
@@ -695,7 +740,7 @@ var AppSideBar = ({
695
740
  additionalItems,
696
741
  sideBarLogo
697
742
  }) => {
698
- var _a, _b;
743
+ var _a, _b, _c, _d;
699
744
  const [authData, setAuthData] = useState3(null);
700
745
  const [selectedCountry, setSelectedCountry] = useState3("dubai");
701
746
  const [isMobileMenuOpen, setIsMobileMenuOpen] = useState3(false);
@@ -914,7 +959,13 @@ var AppSideBar = ({
914
959
  };
915
960
  const navItemsLocal = navItems ?? navItemsConstant;
916
961
  const additionalItemsLocal = additionalItems ?? additionalItemsConstant;
917
- const sideBarLogoLocal = sideBarLogo ?? logo_white_default;
962
+ const logoFromCookie = getLogoFromJettIdCookie();
963
+ const logoUrlFromCookie = logoFromCookie ? buildLogoUrl(logoFromCookie.CDNBasePath, logoFromCookie.logoPath) : null;
964
+ const logoUrlFromUserInfo = ((_a = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _a.CDNBasePath) && ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.OrgLogo) ? buildLogoUrl(
965
+ authData.userInfo.CDNBasePath,
966
+ authData.userInfo.OrgLogo
967
+ ) : null;
968
+ const sideBarLogoLocal = sideBarLogo ?? logoUrlFromCookie ?? logoUrlFromUserInfo ?? null;
918
969
  const detectAndSetActiveMenu = useCallback(() => {
919
970
  const currentPath = window.location.pathname;
920
971
  const currentSearch = window.location.search;
@@ -1001,10 +1052,10 @@ var AppSideBar = ({
1001
1052
  "aria-label": "Toggle menu"
1002
1053
  },
1003
1054
  isMobileMenuOpen ? /* @__PURE__ */ React12.createElement(X, { className: "w-6 h-6 text-gray-700 dark:text-[#f4f4f5cc]" }) : /* @__PURE__ */ React12.createElement(Menu, { className: "w-6 h-6 text-gray-700 dark:text-[#f4f4f5cc]" })
1004
- ), /* @__PURE__ */ React12.createElement("div", { className: "flex-1 flex justify-center" }, sideBarLogo && /* @__PURE__ */ React12.createElement(
1055
+ ), /* @__PURE__ */ React12.createElement("div", { className: "flex-1 flex justify-center" }, sideBarLogoLocal && /* @__PURE__ */ React12.createElement(
1005
1056
  "img",
1006
1057
  {
1007
- src: sideBarLogo,
1058
+ src: sideBarLogoLocal,
1008
1059
  alt: "sidebarLogo",
1009
1060
  width: 108,
1010
1061
  height: 40,
@@ -1021,10 +1072,10 @@ var AppSideBar = ({
1021
1072
  {
1022
1073
  className: `fixed top-0 left-0 md:relative w-[320px] transition-all ease-in-out delay-100 bg-white dark:bg-[#18181b] border-r border-gray-200 dark:border-[#303036] flex flex-col p-4 pt-20 md:pt-4 h-full max-h-[100vh] xs:max-md:z-40 md:max-lg:w-[280px] ${isMobileMenuOpen ? "translate-x-0" : "-translate-x-full md:translate-x-0"}`
1023
1074
  },
1024
- /* @__PURE__ */ React12.createElement("div", { className: "p-2 mb-2 hidden md:block" }, /* @__PURE__ */ React12.createElement("div", { className: "flex items-center justify-center w-full h-[60px] mb-2" }, sideBarLogo && /* @__PURE__ */ React12.createElement(
1075
+ /* @__PURE__ */ React12.createElement("div", { className: "p-2 mb-2 hidden md:block" }, /* @__PURE__ */ React12.createElement("div", { className: "flex items-center justify-center w-full h-[60px] mb-2" }, sideBarLogoLocal && /* @__PURE__ */ React12.createElement(
1025
1076
  "img",
1026
1077
  {
1027
- src: sideBarLogo,
1078
+ src: sideBarLogoLocal,
1028
1079
  alt: "sidebarLogo",
1029
1080
  width: 108,
1030
1081
  height: 40,
@@ -1105,7 +1156,7 @@ var AppSideBar = ({
1105
1156
  window.location.href = "/profile";
1106
1157
  }
1107
1158
  },
1108
- /* @__PURE__ */ React12.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React12.createElement("span", { className: "relative flex shrink-0 overflow-hidden dark:bg-[#27272a] rounded-full h-10 w-10" }, /* @__PURE__ */ React12.createElement("span", { className: "flex h-full w-full items-center justify-center !text-[16px] !font-normal border border-gray-200 dark:border-[#303036] rounded-full bg-muted dark:text-white" }, ((_a = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _a.UserName) ? authData.userInfo.UserName.split("")[0] : "A")), /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement("p", { className: "!font-semibold dark:text-white !text-[16px]" }, ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.UserName) ? authData.userInfo.UserName : "Admin"), /* @__PURE__ */ React12.createElement("p", { className: "!text-[14px] !font-normal dark:text-[#f4f4f5cc]" }, role)))
1159
+ /* @__PURE__ */ React12.createElement("div", { className: "flex items-center gap-3" }, /* @__PURE__ */ React12.createElement("span", { className: "relative flex shrink-0 overflow-hidden dark:bg-[#27272a] rounded-full h-10 w-10" }, /* @__PURE__ */ React12.createElement("span", { className: "flex h-full w-full items-center justify-center !text-[16px] !font-normal border border-gray-200 dark:border-[#303036] rounded-full bg-muted dark:text-white" }, ((_c = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _c.UserName) ? authData.userInfo.UserName.split("")[0] : "A")), /* @__PURE__ */ React12.createElement("div", null, /* @__PURE__ */ React12.createElement("p", { className: "!font-semibold dark:text-white !text-[16px]" }, ((_d = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _d.UserName) ? authData.userInfo.UserName : "Admin"), /* @__PURE__ */ React12.createElement("p", { className: "!text-[14px] !font-normal dark:text-[#f4f4f5cc]" }, role)))
1109
1160
  ))
1110
1161
  ));
1111
1162
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jett.admin.npmpackage",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "exports": {