jett.admin.npmpackage 1.0.97 → 1.0.99

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
@@ -53,7 +53,6 @@
53
53
  --text-base--line-height: calc(1.5 / 1);
54
54
  --text-lg: 1.125rem;
55
55
  --text-lg--line-height: calc(1.75 / 1.125);
56
- --font-weight-normal: 400;
57
56
  --font-weight-medium: 500;
58
57
  --font-weight-semibold: 600;
59
58
  --radius-sm: 0.25rem;
@@ -778,15 +777,6 @@
778
777
  font-size: var(--text-xs);
779
778
  line-height: var(--tw-leading, var(--text-xs--line-height));
780
779
  }
781
- .\!text-\[14px\] {
782
- font-size: 14px !important;
783
- }
784
- .\!text-\[15px\] {
785
- font-size: 15px !important;
786
- }
787
- .\!text-\[16px\] {
788
- font-size: 16px !important;
789
- }
790
780
  .text-\[12px\] {
791
781
  font-size: 12px;
792
782
  }
@@ -804,18 +794,6 @@
804
794
  --tw-leading: calc(var(--spacing) * 6);
805
795
  line-height: calc(var(--spacing) * 6);
806
796
  }
807
- .\!font-medium {
808
- --tw-font-weight: var(--font-weight-medium) !important;
809
- font-weight: var(--font-weight-medium) !important;
810
- }
811
- .\!font-normal {
812
- --tw-font-weight: var(--font-weight-normal) !important;
813
- font-weight: var(--font-weight-normal) !important;
814
- }
815
- .\!font-semibold {
816
- --tw-font-weight: var(--font-weight-semibold) !important;
817
- font-weight: var(--font-weight-semibold) !important;
818
- }
819
797
  .font-\[500\] {
820
798
  --tw-font-weight: 500;
821
799
  font-weight: 500;
@@ -832,11 +810,8 @@
832
810
  --tw-font-weight: var(--font-weight-semibold);
833
811
  font-weight: var(--font-weight-semibold);
834
812
  }
835
- .\!text-\[\#000\] {
836
- color: #000 !important;
837
- }
838
- .\!text-\[\#3f3f46cc\] {
839
- color: #3f3f46cc !important;
813
+ .text-\[\#000\] {
814
+ color: #000;
840
815
  }
841
816
  .text-\[\#3f3f46cc\] {
842
817
  color: #3f3f46cc;
@@ -1313,9 +1288,6 @@
1313
1288
  }
1314
1289
  }
1315
1290
  }
1316
- body {
1317
- font-family: "Inter", sans-serif;
1318
- }
1319
1291
  @layer utilities {
1320
1292
  .scrollbar-hide {
1321
1293
  scrollbar-width: none;
package/dist/index.js CHANGED
@@ -455,6 +455,33 @@ var navItemsConstant = [
455
455
  },
456
456
  isDropDown: false
457
457
  },
458
+ {
459
+ Icon: import_lucide_react4.Globe,
460
+ label: "TMC Ecosystem",
461
+ onClick: () => {
462
+ },
463
+ isDropDown: true,
464
+ options: [
465
+ {
466
+ label: "Markets",
467
+ onClick: () => {
468
+ window.location.href = "/market/";
469
+ }
470
+ },
471
+ {
472
+ label: "Users",
473
+ onClick: () => {
474
+ window.location.href = `/users/users?role=admin&auth=${encodedAuthData}`;
475
+ }
476
+ },
477
+ {
478
+ label: "Supplier Ecosystem",
479
+ onClick: () => {
480
+ window.location.href = "/supplier/";
481
+ }
482
+ }
483
+ ]
484
+ },
458
485
  {
459
486
  Icon: import_lucide_react4.Building,
460
487
  label: "Consumer Ecosystem",
@@ -474,51 +501,43 @@ var navItemsConstant = [
474
501
  }
475
502
  },
476
503
  {
477
- label: "Users",
504
+ label: "Booking History",
478
505
  onClick: () => {
479
- window.location.href = "/orgselector/?path=users";
506
+ window.location.href = "/finance/bookingHistory/";
480
507
  }
481
508
  },
482
509
  {
483
- label: "Tags (Consumer Variables)",
510
+ label: "Reports",
484
511
  onClick: () => {
485
- window.location.href = "/orgselector/?path=tag";
512
+ window.open("https://viz.jett.travel", "_blank");
486
513
  }
487
514
  },
488
515
  {
489
- label: "Special Request",
516
+ label: "Users",
490
517
  onClick: () => {
491
- window.location.href = "/orgselector/?path=special-requests";
518
+ window.location.href = "/users/users";
492
519
  }
493
520
  },
494
521
  {
495
- label: "Support Tickets (Coming Soon)",
496
- isDisabled: true
497
- // onClick: () => {},
498
- }
499
- ],
500
- isDropDown: true
501
- },
502
- {
503
- Icon: import_lucide_react4.Banknote,
504
- label: "Finance",
505
- onClick: () => {
506
- },
507
- isDropDown: true,
508
- options: [
522
+ label: "Tags",
523
+ onClick: () => {
524
+ window.location.href = "/orgselector/?path=tag";
525
+ }
526
+ },
509
527
  {
510
- label: "Credit Management",
528
+ label: "Payment Ledger",
511
529
  onClick: () => {
512
530
  window.location.href = "/finance/paymentsLedger/";
513
531
  }
514
532
  },
515
533
  {
516
- label: "Booking & Invoices",
534
+ label: "Special Request",
517
535
  onClick: () => {
518
- window.location.href = "/finance/bookingHistory/";
536
+ window.location.href = "/orgselector/?path=special-requests";
519
537
  }
520
538
  }
521
- ]
539
+ ],
540
+ isDropDown: true
522
541
  },
523
542
  {
524
543
  Icon: import_lucide_react4.DollarSign,
@@ -528,7 +547,7 @@ var navItemsConstant = [
528
547
  isDropDown: true,
529
548
  options: [
530
549
  {
531
- label: "Pricing Engine",
550
+ label: "Pricing Policy",
532
551
  onClick: () => {
533
552
  window.location.href = "/orgselector/?path=pricing-policy";
534
553
  }
@@ -544,43 +563,18 @@ var navItemsConstant = [
544
563
  onClick: () => {
545
564
  window.location.href = "/orgselector/?path=voucher";
546
565
  }
547
- }
548
- ]
549
- },
550
- {
551
- Icon: import_lucide_react4.Handshake,
552
- label: "Supplier Ecosystem",
553
- onClick: () => {
554
- },
555
- isDropDown: true,
556
- options: [
557
- {
558
- label: "Suppliers List",
559
- onClick: () => {
560
- window.location.href = "/supplier/";
561
- }
562
566
  },
563
567
  {
564
568
  label: "Supplier Deals",
565
569
  onClick: () => {
566
570
  window.location.href = "/supplierdeals/";
567
571
  }
568
- }
569
- ]
570
- },
571
- {
572
- Icon: import_lucide_react4.BarChart3,
573
- label: "Reports",
574
- onClick: () => {
575
- },
576
- isDropDown: true,
577
- options: [
572
+ },
578
573
  {
579
- label: "Reports (Coming Soon)",
580
- isDisabled: true
581
- // onClick: () => {
582
- // window.open("https://viz.jett.travel", "_blank");
583
- // },
574
+ label: "Invoices",
575
+ onClick: () => {
576
+ window.location.href = "/finance/invoices/";
577
+ }
584
578
  }
585
579
  ]
586
580
  },
@@ -596,23 +590,6 @@ var navItemsConstant = [
596
590
  onClick: () => {
597
591
  window.location.href = "/whitelabel/";
598
592
  }
599
- },
600
- {
601
- label: "Markets",
602
- onClick: () => {
603
- window.location.href = "/market/";
604
- }
605
- },
606
- {
607
- label: "Users",
608
- onClick: () => {
609
- window.location.href = `/users/users?role=admin&auth=${encodedAuthData}`;
610
- }
611
- },
612
- {
613
- label: "Reports Configurations (Coming Soon)",
614
- isDisabled: true
615
- // onClick: () => {},
616
593
  }
617
594
  ]
618
595
  }
@@ -818,119 +795,31 @@ var AppSideBar = ({
818
795
  const extractUrlFromOnClick = (onClick) => {
819
796
  if (!onClick || typeof onClick !== "function") return null;
820
797
  const funcString = onClick.toString();
821
- let match = funcString.match(/window\.location\.href\s*=\s*`([^`]+)`/);
822
- if (!match) {
823
- match = funcString.match(/window\.location\.href\s*=\s*["']([^"']+)["']/);
824
- }
798
+ const match = funcString.match(/window\.location\.href\s*=\s*["']([^"']+)["']/);
825
799
  if (match && match[1]) {
826
800
  try {
827
801
  if (match[1].startsWith("http://") || match[1].startsWith("https://")) {
828
802
  const url = new URL(match[1]);
829
- return {
830
- pathname: url.pathname,
831
- search: url.search,
832
- fullPath: url.pathname + url.search
833
- };
803
+ return url.pathname;
834
804
  }
835
805
  if (match[1].startsWith("/")) {
836
806
  const url = new URL(match[1], window.location.origin);
837
- return {
838
- pathname: url.pathname,
839
- search: url.search,
840
- fullPath: url.pathname + url.search
841
- };
807
+ return url.pathname;
842
808
  }
843
809
  return null;
844
810
  } catch {
845
- const pathMatch = match[1].match(/^([^?]+)(\?.*)?$/);
846
- if (pathMatch) {
847
- return {
848
- pathname: pathMatch[1],
849
- search: pathMatch[2] || "",
850
- fullPath: match[1]
851
- };
852
- }
853
- return null;
811
+ const pathMatch = match[1].match(/^([^?]+)/);
812
+ return pathMatch ? pathMatch[1] : null;
854
813
  }
855
814
  }
856
815
  return null;
857
816
  };
858
- const currentUrlMatches = (menuUrlData, currentPath, currentSearch) => {
859
- if (!menuUrlData || !currentPath) return false;
860
- const normalizedMenuPath = menuUrlData.pathname.replace(/\/$/, "") || "/";
817
+ const currentPathMatches = (menuUrl, currentPath) => {
818
+ if (!menuUrl || !currentPath) return false;
819
+ const normalizedMenuUrl = menuUrl.replace(/\/$/, "") || "/";
861
820
  const normalizedCurrentPath = currentPath.replace(/\/$/, "") || "/";
862
- if (normalizedMenuPath === "/users/users" && normalizedCurrentPath === "/users/users") {
863
- const menuParams = new URLSearchParams(menuUrlData.search);
864
- const currentParams = new URLSearchParams(currentSearch);
865
- const menuRole = menuParams.get("role");
866
- const currentRole = currentParams.get("role");
867
- if (menuRole && currentRole) {
868
- return menuRole === currentRole;
869
- }
870
- if (menuRole && !currentRole || !menuRole && currentRole) {
871
- return false;
872
- }
873
- return true;
874
- }
875
- if (normalizedMenuPath === "/corporate" && normalizedCurrentPath.startsWith("/org/organizations")) {
876
- return true;
877
- }
878
- if (normalizedMenuPath === "/trips") {
879
- if (normalizedCurrentPath.startsWith("/tripdetails") || normalizedCurrentPath.startsWith("/offline")) {
880
- return true;
881
- }
882
- }
883
- if (normalizedMenuPath === "/orgselector" && menuUrlData.search) {
884
- const menuPathParam = new URLSearchParams(menuUrlData.search).get("path");
885
- if (menuPathParam) {
886
- const pathRouteMap = {
887
- "offer": "/offer/offer",
888
- "voucher": "/voucher/voucher",
889
- "tag": "/tags/tags",
890
- "special-requests": "/corporate/special-requests",
891
- "pricing-policy": "/policies/pricing-policy",
892
- "users": "/users/users"
893
- // Consumer Ecosystem Users (no role param)
894
- };
895
- const expectedRoute = pathRouteMap[menuPathParam];
896
- if (expectedRoute) {
897
- if (normalizedCurrentPath === expectedRoute || normalizedCurrentPath.startsWith(expectedRoute + "/")) {
898
- if (menuPathParam === "users") {
899
- const currentParams = new URLSearchParams(currentSearch);
900
- const currentRole = currentParams.get("role");
901
- return currentRole !== "admin";
902
- }
903
- return true;
904
- }
905
- }
906
- }
907
- if (normalizedCurrentPath === "/orgselector") {
908
- const menuPathParam2 = new URLSearchParams(menuUrlData.search).get("path");
909
- const currentPathParam = new URLSearchParams(currentSearch).get("path");
910
- if (menuPathParam2 && currentPathParam) {
911
- return menuPathParam2 === currentPathParam;
912
- }
913
- }
914
- }
915
- if (normalizedMenuPath === normalizedCurrentPath) {
916
- if (menuUrlData.search) {
917
- const menuParams = new URLSearchParams(menuUrlData.search);
918
- const currentParams = new URLSearchParams(currentSearch);
919
- for (const [key, value] of menuParams.entries()) {
920
- if (key === "auth") {
921
- continue;
922
- }
923
- if (currentParams.get(key) !== value) {
924
- return false;
925
- }
926
- }
927
- return true;
928
- }
929
- return true;
930
- }
931
- if (normalizedCurrentPath.startsWith(normalizedMenuPath + "/")) {
932
- return true;
933
- }
821
+ if (normalizedMenuUrl === normalizedCurrentPath) return true;
822
+ if (normalizedCurrentPath.startsWith(normalizedMenuUrl + "/")) return true;
934
823
  return false;
935
824
  };
936
825
  const navItemsLocal = navItems ?? navItemsConstant;
@@ -938,28 +827,27 @@ var AppSideBar = ({
938
827
  const sideBarLogoLocal = sideBarLogo ?? logo_white_default;
939
828
  const detectAndSetActiveMenu = (0, import_react12.useCallback)(() => {
940
829
  const currentPath = window.location.pathname;
941
- const currentSearch = window.location.search;
942
830
  const newOpenMenus = /* @__PURE__ */ new Set();
943
831
  let foundActivePath = null;
944
832
  navItemsLocal.forEach((item, index) => {
945
833
  if (!item.isDropDown && item.onClick && typeof item.onClick === "function") {
946
- const itemUrlData = extractUrlFromOnClick(item.onClick);
947
- if (itemUrlData && currentUrlMatches(itemUrlData, currentPath, currentSearch)) {
834
+ const itemUrl = extractUrlFromOnClick(item.onClick);
835
+ if (itemUrl && currentPathMatches(itemUrl, currentPath)) {
948
836
  foundActivePath = `menu-${index}`;
949
837
  }
950
838
  }
951
839
  if (item.options && item.options.length > 0) {
952
840
  item.options.forEach((option, optionsIndex) => {
953
841
  if (option.onClick && typeof option.onClick === "function") {
954
- const optionUrlData = extractUrlFromOnClick(option.onClick);
955
- if (optionUrlData && currentUrlMatches(optionUrlData, currentPath, currentSearch)) {
842
+ const optionUrl = extractUrlFromOnClick(option.onClick);
843
+ if (optionUrl && currentPathMatches(optionUrl, currentPath)) {
956
844
  const menuKey = `menu-${index}`;
957
845
  newOpenMenus.add(menuKey);
958
846
  foundActivePath = `menu-${index}-option-${optionsIndex}`;
959
847
  if (option.options && option.options.length > 0) {
960
848
  option.options.forEach((subOption, subIndex) => {
961
- const subOptionUrlData = extractUrlFromOnClick(subOption.onClick);
962
- if (subOptionUrlData && currentUrlMatches(subOptionUrlData, currentPath, currentSearch)) {
849
+ const subOptionUrl = extractUrlFromOnClick(subOption.onClick);
850
+ if (subOptionUrl && currentPathMatches(subOptionUrl, currentPath)) {
963
851
  const subMenuKey = `menu-${index}-option-${optionsIndex}`;
964
852
  newOpenMenus.add(subMenuKey);
965
853
  foundActivePath = `menu-${index}-option-${optionsIndex}-sub-${subOption.label}`;
@@ -976,38 +864,18 @@ var AppSideBar = ({
976
864
  setActiveMenuPath(foundActivePath);
977
865
  }
978
866
  }, [navItemsLocal]);
979
- const [currentUrl, setCurrentUrl] = (0, import_react12.useState)(
980
- () => window.location.pathname + window.location.search
981
- );
982
867
  (0, import_react12.useEffect)(() => {
983
868
  detectAndSetActiveMenu();
984
- setCurrentUrl(window.location.pathname + window.location.search);
985
869
  }, [detectAndSetActiveMenu]);
986
870
  (0, import_react12.useEffect)(() => {
987
- let lastUrl = window.location.pathname + window.location.search;
988
871
  const handleLocationChange = () => {
989
- const newUrl = window.location.pathname + window.location.search;
990
- if (newUrl !== lastUrl) {
991
- lastUrl = newUrl;
992
- setCurrentUrl(newUrl);
993
- detectAndSetActiveMenu();
994
- }
872
+ detectAndSetActiveMenu();
995
873
  };
996
874
  window.addEventListener("popstate", handleLocationChange);
997
- const checkInterval = setInterval(() => {
998
- const newUrl = window.location.pathname + window.location.search;
999
- if (newUrl !== lastUrl) {
1000
- handleLocationChange();
1001
- }
1002
- }, 250);
1003
875
  return () => {
1004
876
  window.removeEventListener("popstate", handleLocationChange);
1005
- clearInterval(checkInterval);
1006
877
  };
1007
878
  }, [detectAndSetActiveMenu]);
1008
- (0, import_react12.useEffect)(() => {
1009
- detectAndSetActiveMenu();
1010
- }, [currentUrl, detectAndSetActiveMenu]);
1011
879
  const toggleMobileMenu = () => {
1012
880
  setIsMobileMenuOpen(!isMobileMenuOpen);
1013
881
  };
@@ -1064,7 +932,7 @@ var AppSideBar = ({
1064
932
  onClick: (e) => handleMenuClick(item, index, e)
1065
933
  },
1066
934
  /* @__PURE__ */ import_react12.default.createElement("div", { className: "text-primary" }, /* @__PURE__ */ import_react12.default.createElement(item.Icon, { width: 20, height: 20 })),
1067
- /* @__PURE__ */ import_react12.default.createElement("span", { className: "!font-medium !text-[16px] !text-[#000] dark:text-[#f4f4f5cc]" }, item.label),
935
+ /* @__PURE__ */ import_react12.default.createElement("span", { className: "font-medium text-base text-[#000] dark:text-[#f4f4f5cc]" }, item.label),
1068
936
  item.isDropDown && /* @__PURE__ */ import_react12.default.createElement("div", { className: `ml-auto transition-all delay-75 ${isOpen ? "rotate-180" : ""}` }, /* @__PURE__ */ import_react12.default.createElement(import_lucide_react6.ChevronDown, { width: 20, height: 20, className: "text-gray-500 dark:text-gray-400" }))
1069
937
  ), item.options && item.options.length > 0 && /* @__PURE__ */ import_react12.default.createElement(
1070
938
  "div",
@@ -1082,7 +950,7 @@ var AppSideBar = ({
1082
950
  onClick: (e) => handleSubMenuClick(options, optionsIndex, index, e)
1083
951
  },
1084
952
  /* @__PURE__ */ import_react12.default.createElement("div", null),
1085
- /* @__PURE__ */ import_react12.default.createElement("span", { className: "!font-medium !text-[15px] !text-[#3f3f46cc] dark:text-[#a1a1aa]" }, options.label),
953
+ /* @__PURE__ */ import_react12.default.createElement("span", { className: "font-medium text-base text-[#3f3f46cc] dark:text-[#a1a1aa]" }, options.label),
1086
954
  options.isDropDown && /* @__PURE__ */ import_react12.default.createElement(
1087
955
  "div",
1088
956
  {
@@ -1119,7 +987,7 @@ var AppSideBar = ({
1119
987
  window.location.href = "/profile";
1120
988
  }
1121
989
  },
1122
- /* @__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)))
990
+ /* @__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 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" }, ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.UserName) ? authData.userInfo.UserName : "Admin User"), /* @__PURE__ */ import_react12.default.createElement("p", { className: "text-sm dark:text-[#f4f4f5cc]" }, role)))
1123
991
  ))
1124
992
  ));
1125
993
  };
package/dist/index.mjs CHANGED
@@ -393,7 +393,7 @@ var CustomUpload = ({
393
393
  // src/sideBar/SideBar.jsx
394
394
  import {
395
395
  ChevronDown as ChevronDown3,
396
- Globe,
396
+ Globe as Globe2,
397
397
  LogOut,
398
398
  Menu,
399
399
  X
@@ -403,13 +403,18 @@ import React12, { useEffect, useState as useState3, useCallback } from "react";
403
403
  // ConstantUI.js
404
404
  import {
405
405
  Home,
406
+ BaggageClaim,
407
+ Users,
406
408
  Banknote,
409
+ Globe,
410
+ TrendingUp,
411
+ FileText,
412
+ FileKey2,
407
413
  LifeBuoy,
408
414
  Cog,
409
415
  Building,
410
416
  Handshake,
411
- DollarSign,
412
- BarChart3
417
+ DollarSign
413
418
  } from "lucide-react";
414
419
  var encodedAuthData = localStorage.getItem("encodedAuthData");
415
420
  var navItemsConstant = [
@@ -421,6 +426,33 @@ var navItemsConstant = [
421
426
  },
422
427
  isDropDown: false
423
428
  },
429
+ {
430
+ Icon: Globe,
431
+ label: "TMC Ecosystem",
432
+ onClick: () => {
433
+ },
434
+ isDropDown: true,
435
+ options: [
436
+ {
437
+ label: "Markets",
438
+ onClick: () => {
439
+ window.location.href = "/market/";
440
+ }
441
+ },
442
+ {
443
+ label: "Users",
444
+ onClick: () => {
445
+ window.location.href = `/users/users?role=admin&auth=${encodedAuthData}`;
446
+ }
447
+ },
448
+ {
449
+ label: "Supplier Ecosystem",
450
+ onClick: () => {
451
+ window.location.href = "/supplier/";
452
+ }
453
+ }
454
+ ]
455
+ },
424
456
  {
425
457
  Icon: Building,
426
458
  label: "Consumer Ecosystem",
@@ -440,51 +472,43 @@ var navItemsConstant = [
440
472
  }
441
473
  },
442
474
  {
443
- label: "Users",
475
+ label: "Booking History",
444
476
  onClick: () => {
445
- window.location.href = "/orgselector/?path=users";
477
+ window.location.href = "/finance/bookingHistory/";
446
478
  }
447
479
  },
448
480
  {
449
- label: "Tags (Consumer Variables)",
481
+ label: "Reports",
450
482
  onClick: () => {
451
- window.location.href = "/orgselector/?path=tag";
483
+ window.open("https://viz.jett.travel", "_blank");
452
484
  }
453
485
  },
454
486
  {
455
- label: "Special Request",
487
+ label: "Users",
456
488
  onClick: () => {
457
- window.location.href = "/orgselector/?path=special-requests";
489
+ window.location.href = "/users/users";
458
490
  }
459
491
  },
460
492
  {
461
- label: "Support Tickets (Coming Soon)",
462
- isDisabled: true
463
- // onClick: () => {},
464
- }
465
- ],
466
- isDropDown: true
467
- },
468
- {
469
- Icon: Banknote,
470
- label: "Finance",
471
- onClick: () => {
472
- },
473
- isDropDown: true,
474
- options: [
493
+ label: "Tags",
494
+ onClick: () => {
495
+ window.location.href = "/orgselector/?path=tag";
496
+ }
497
+ },
475
498
  {
476
- label: "Credit Management",
499
+ label: "Payment Ledger",
477
500
  onClick: () => {
478
501
  window.location.href = "/finance/paymentsLedger/";
479
502
  }
480
503
  },
481
504
  {
482
- label: "Booking & Invoices",
505
+ label: "Special Request",
483
506
  onClick: () => {
484
- window.location.href = "/finance/bookingHistory/";
507
+ window.location.href = "/orgselector/?path=special-requests";
485
508
  }
486
509
  }
487
- ]
510
+ ],
511
+ isDropDown: true
488
512
  },
489
513
  {
490
514
  Icon: DollarSign,
@@ -494,7 +518,7 @@ var navItemsConstant = [
494
518
  isDropDown: true,
495
519
  options: [
496
520
  {
497
- label: "Pricing Engine",
521
+ label: "Pricing Policy",
498
522
  onClick: () => {
499
523
  window.location.href = "/orgselector/?path=pricing-policy";
500
524
  }
@@ -510,43 +534,18 @@ var navItemsConstant = [
510
534
  onClick: () => {
511
535
  window.location.href = "/orgselector/?path=voucher";
512
536
  }
513
- }
514
- ]
515
- },
516
- {
517
- Icon: Handshake,
518
- label: "Supplier Ecosystem",
519
- onClick: () => {
520
- },
521
- isDropDown: true,
522
- options: [
523
- {
524
- label: "Suppliers List",
525
- onClick: () => {
526
- window.location.href = "/supplier/";
527
- }
528
537
  },
529
538
  {
530
539
  label: "Supplier Deals",
531
540
  onClick: () => {
532
541
  window.location.href = "/supplierdeals/";
533
542
  }
534
- }
535
- ]
536
- },
537
- {
538
- Icon: BarChart3,
539
- label: "Reports",
540
- onClick: () => {
541
- },
542
- isDropDown: true,
543
- options: [
543
+ },
544
544
  {
545
- label: "Reports (Coming Soon)",
546
- isDisabled: true
547
- // onClick: () => {
548
- // window.open("https://viz.jett.travel", "_blank");
549
- // },
545
+ label: "Invoices",
546
+ onClick: () => {
547
+ window.location.href = "/finance/invoices/";
548
+ }
550
549
  }
551
550
  ]
552
551
  },
@@ -562,23 +561,6 @@ var navItemsConstant = [
562
561
  onClick: () => {
563
562
  window.location.href = "/whitelabel/";
564
563
  }
565
- },
566
- {
567
- label: "Markets",
568
- onClick: () => {
569
- window.location.href = "/market/";
570
- }
571
- },
572
- {
573
- label: "Users",
574
- onClick: () => {
575
- window.location.href = `/users/users?role=admin&auth=${encodedAuthData}`;
576
- }
577
- },
578
- {
579
- label: "Reports Configurations (Coming Soon)",
580
- isDisabled: true
581
- // onClick: () => {},
582
564
  }
583
565
  ]
584
566
  }
@@ -784,119 +766,31 @@ var AppSideBar = ({
784
766
  const extractUrlFromOnClick = (onClick) => {
785
767
  if (!onClick || typeof onClick !== "function") return null;
786
768
  const funcString = onClick.toString();
787
- let match = funcString.match(/window\.location\.href\s*=\s*`([^`]+)`/);
788
- if (!match) {
789
- match = funcString.match(/window\.location\.href\s*=\s*["']([^"']+)["']/);
790
- }
769
+ const match = funcString.match(/window\.location\.href\s*=\s*["']([^"']+)["']/);
791
770
  if (match && match[1]) {
792
771
  try {
793
772
  if (match[1].startsWith("http://") || match[1].startsWith("https://")) {
794
773
  const url = new URL(match[1]);
795
- return {
796
- pathname: url.pathname,
797
- search: url.search,
798
- fullPath: url.pathname + url.search
799
- };
774
+ return url.pathname;
800
775
  }
801
776
  if (match[1].startsWith("/")) {
802
777
  const url = new URL(match[1], window.location.origin);
803
- return {
804
- pathname: url.pathname,
805
- search: url.search,
806
- fullPath: url.pathname + url.search
807
- };
778
+ return url.pathname;
808
779
  }
809
780
  return null;
810
781
  } catch {
811
- const pathMatch = match[1].match(/^([^?]+)(\?.*)?$/);
812
- if (pathMatch) {
813
- return {
814
- pathname: pathMatch[1],
815
- search: pathMatch[2] || "",
816
- fullPath: match[1]
817
- };
818
- }
819
- return null;
782
+ const pathMatch = match[1].match(/^([^?]+)/);
783
+ return pathMatch ? pathMatch[1] : null;
820
784
  }
821
785
  }
822
786
  return null;
823
787
  };
824
- const currentUrlMatches = (menuUrlData, currentPath, currentSearch) => {
825
- if (!menuUrlData || !currentPath) return false;
826
- const normalizedMenuPath = menuUrlData.pathname.replace(/\/$/, "") || "/";
788
+ const currentPathMatches = (menuUrl, currentPath) => {
789
+ if (!menuUrl || !currentPath) return false;
790
+ const normalizedMenuUrl = menuUrl.replace(/\/$/, "") || "/";
827
791
  const normalizedCurrentPath = currentPath.replace(/\/$/, "") || "/";
828
- if (normalizedMenuPath === "/users/users" && normalizedCurrentPath === "/users/users") {
829
- const menuParams = new URLSearchParams(menuUrlData.search);
830
- const currentParams = new URLSearchParams(currentSearch);
831
- const menuRole = menuParams.get("role");
832
- const currentRole = currentParams.get("role");
833
- if (menuRole && currentRole) {
834
- return menuRole === currentRole;
835
- }
836
- if (menuRole && !currentRole || !menuRole && currentRole) {
837
- return false;
838
- }
839
- return true;
840
- }
841
- if (normalizedMenuPath === "/corporate" && normalizedCurrentPath.startsWith("/org/organizations")) {
842
- return true;
843
- }
844
- if (normalizedMenuPath === "/trips") {
845
- if (normalizedCurrentPath.startsWith("/tripdetails") || normalizedCurrentPath.startsWith("/offline")) {
846
- return true;
847
- }
848
- }
849
- if (normalizedMenuPath === "/orgselector" && menuUrlData.search) {
850
- const menuPathParam = new URLSearchParams(menuUrlData.search).get("path");
851
- if (menuPathParam) {
852
- const pathRouteMap = {
853
- "offer": "/offer/offer",
854
- "voucher": "/voucher/voucher",
855
- "tag": "/tags/tags",
856
- "special-requests": "/corporate/special-requests",
857
- "pricing-policy": "/policies/pricing-policy",
858
- "users": "/users/users"
859
- // Consumer Ecosystem Users (no role param)
860
- };
861
- const expectedRoute = pathRouteMap[menuPathParam];
862
- if (expectedRoute) {
863
- if (normalizedCurrentPath === expectedRoute || normalizedCurrentPath.startsWith(expectedRoute + "/")) {
864
- if (menuPathParam === "users") {
865
- const currentParams = new URLSearchParams(currentSearch);
866
- const currentRole = currentParams.get("role");
867
- return currentRole !== "admin";
868
- }
869
- return true;
870
- }
871
- }
872
- }
873
- if (normalizedCurrentPath === "/orgselector") {
874
- const menuPathParam2 = new URLSearchParams(menuUrlData.search).get("path");
875
- const currentPathParam = new URLSearchParams(currentSearch).get("path");
876
- if (menuPathParam2 && currentPathParam) {
877
- return menuPathParam2 === currentPathParam;
878
- }
879
- }
880
- }
881
- if (normalizedMenuPath === normalizedCurrentPath) {
882
- if (menuUrlData.search) {
883
- const menuParams = new URLSearchParams(menuUrlData.search);
884
- const currentParams = new URLSearchParams(currentSearch);
885
- for (const [key, value] of menuParams.entries()) {
886
- if (key === "auth") {
887
- continue;
888
- }
889
- if (currentParams.get(key) !== value) {
890
- return false;
891
- }
892
- }
893
- return true;
894
- }
895
- return true;
896
- }
897
- if (normalizedCurrentPath.startsWith(normalizedMenuPath + "/")) {
898
- return true;
899
- }
792
+ if (normalizedMenuUrl === normalizedCurrentPath) return true;
793
+ if (normalizedCurrentPath.startsWith(normalizedMenuUrl + "/")) return true;
900
794
  return false;
901
795
  };
902
796
  const navItemsLocal = navItems ?? navItemsConstant;
@@ -904,28 +798,27 @@ var AppSideBar = ({
904
798
  const sideBarLogoLocal = sideBarLogo ?? logo_white_default;
905
799
  const detectAndSetActiveMenu = useCallback(() => {
906
800
  const currentPath = window.location.pathname;
907
- const currentSearch = window.location.search;
908
801
  const newOpenMenus = /* @__PURE__ */ new Set();
909
802
  let foundActivePath = null;
910
803
  navItemsLocal.forEach((item, index) => {
911
804
  if (!item.isDropDown && item.onClick && typeof item.onClick === "function") {
912
- const itemUrlData = extractUrlFromOnClick(item.onClick);
913
- if (itemUrlData && currentUrlMatches(itemUrlData, currentPath, currentSearch)) {
805
+ const itemUrl = extractUrlFromOnClick(item.onClick);
806
+ if (itemUrl && currentPathMatches(itemUrl, currentPath)) {
914
807
  foundActivePath = `menu-${index}`;
915
808
  }
916
809
  }
917
810
  if (item.options && item.options.length > 0) {
918
811
  item.options.forEach((option, optionsIndex) => {
919
812
  if (option.onClick && typeof option.onClick === "function") {
920
- const optionUrlData = extractUrlFromOnClick(option.onClick);
921
- if (optionUrlData && currentUrlMatches(optionUrlData, currentPath, currentSearch)) {
813
+ const optionUrl = extractUrlFromOnClick(option.onClick);
814
+ if (optionUrl && currentPathMatches(optionUrl, currentPath)) {
922
815
  const menuKey = `menu-${index}`;
923
816
  newOpenMenus.add(menuKey);
924
817
  foundActivePath = `menu-${index}-option-${optionsIndex}`;
925
818
  if (option.options && option.options.length > 0) {
926
819
  option.options.forEach((subOption, subIndex) => {
927
- const subOptionUrlData = extractUrlFromOnClick(subOption.onClick);
928
- if (subOptionUrlData && currentUrlMatches(subOptionUrlData, currentPath, currentSearch)) {
820
+ const subOptionUrl = extractUrlFromOnClick(subOption.onClick);
821
+ if (subOptionUrl && currentPathMatches(subOptionUrl, currentPath)) {
929
822
  const subMenuKey = `menu-${index}-option-${optionsIndex}`;
930
823
  newOpenMenus.add(subMenuKey);
931
824
  foundActivePath = `menu-${index}-option-${optionsIndex}-sub-${subOption.label}`;
@@ -942,38 +835,18 @@ var AppSideBar = ({
942
835
  setActiveMenuPath(foundActivePath);
943
836
  }
944
837
  }, [navItemsLocal]);
945
- const [currentUrl, setCurrentUrl] = useState3(
946
- () => window.location.pathname + window.location.search
947
- );
948
838
  useEffect(() => {
949
839
  detectAndSetActiveMenu();
950
- setCurrentUrl(window.location.pathname + window.location.search);
951
840
  }, [detectAndSetActiveMenu]);
952
841
  useEffect(() => {
953
- let lastUrl = window.location.pathname + window.location.search;
954
842
  const handleLocationChange = () => {
955
- const newUrl = window.location.pathname + window.location.search;
956
- if (newUrl !== lastUrl) {
957
- lastUrl = newUrl;
958
- setCurrentUrl(newUrl);
959
- detectAndSetActiveMenu();
960
- }
843
+ detectAndSetActiveMenu();
961
844
  };
962
845
  window.addEventListener("popstate", handleLocationChange);
963
- const checkInterval = setInterval(() => {
964
- const newUrl = window.location.pathname + window.location.search;
965
- if (newUrl !== lastUrl) {
966
- handleLocationChange();
967
- }
968
- }, 250);
969
846
  return () => {
970
847
  window.removeEventListener("popstate", handleLocationChange);
971
- clearInterval(checkInterval);
972
848
  };
973
849
  }, [detectAndSetActiveMenu]);
974
- useEffect(() => {
975
- detectAndSetActiveMenu();
976
- }, [currentUrl, detectAndSetActiveMenu]);
977
850
  const toggleMobileMenu = () => {
978
851
  setIsMobileMenuOpen(!isMobileMenuOpen);
979
852
  };
@@ -1030,7 +903,7 @@ var AppSideBar = ({
1030
903
  onClick: (e) => handleMenuClick(item, index, e)
1031
904
  },
1032
905
  /* @__PURE__ */ React12.createElement("div", { className: "text-primary" }, /* @__PURE__ */ React12.createElement(item.Icon, { width: 20, height: 20 })),
1033
- /* @__PURE__ */ React12.createElement("span", { className: "!font-medium !text-[16px] !text-[#000] dark:text-[#f4f4f5cc]" }, item.label),
906
+ /* @__PURE__ */ React12.createElement("span", { className: "font-medium text-base text-[#000] dark:text-[#f4f4f5cc]" }, item.label),
1034
907
  item.isDropDown && /* @__PURE__ */ React12.createElement("div", { className: `ml-auto transition-all delay-75 ${isOpen ? "rotate-180" : ""}` }, /* @__PURE__ */ React12.createElement(ChevronDown3, { width: 20, height: 20, className: "text-gray-500 dark:text-gray-400" }))
1035
908
  ), item.options && item.options.length > 0 && /* @__PURE__ */ React12.createElement(
1036
909
  "div",
@@ -1048,7 +921,7 @@ var AppSideBar = ({
1048
921
  onClick: (e) => handleSubMenuClick(options, optionsIndex, index, e)
1049
922
  },
1050
923
  /* @__PURE__ */ React12.createElement("div", null),
1051
- /* @__PURE__ */ React12.createElement("span", { className: "!font-medium !text-[15px] !text-[#3f3f46cc] dark:text-[#a1a1aa]" }, options.label),
924
+ /* @__PURE__ */ React12.createElement("span", { className: "font-medium text-base text-[#3f3f46cc] dark:text-[#a1a1aa]" }, options.label),
1052
925
  options.isDropDown && /* @__PURE__ */ React12.createElement(
1053
926
  "div",
1054
927
  {
@@ -1085,7 +958,7 @@ var AppSideBar = ({
1085
958
  window.location.href = "/profile";
1086
959
  }
1087
960
  },
1088
- /* @__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)))
961
+ /* @__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 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" }, ((_b = authData == null ? void 0 : authData.userInfo) == null ? void 0 : _b.UserName) ? authData.userInfo.UserName : "Admin User"), /* @__PURE__ */ React12.createElement("p", { className: "text-sm dark:text-[#f4f4f5cc]" }, role)))
1089
962
  ))
1090
963
  ));
1091
964
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jett.admin.npmpackage",
3
- "version": "1.0.97",
3
+ "version": "1.0.99",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "exports": {