jett.admin.npmpackage 2.0.25 → 2.0.27

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
@@ -608,11 +608,10 @@ var navItemsConstant = [
608
608
  isDropDown: true,
609
609
  options: [
610
610
  {
611
- label: "Reports (Coming Soon)",
612
- isDisabled: true
613
- // onClick: () => {
614
- // window.open("https://viz.jett.travel", "_blank");
615
- // },
611
+ label: "Reports",
612
+ onClick: () => {
613
+ window.location.href = "/reports/";
614
+ }
616
615
  }
617
616
  ]
618
617
  },
@@ -642,9 +641,10 @@ var navItemsConstant = [
642
641
  }
643
642
  },
644
643
  {
645
- label: "Reports Configurations (Coming Soon)",
646
- isDisabled: true
647
- // onClick: () => {},
644
+ label: "Reports Configurations",
645
+ onClick: () => {
646
+ window.location.href = "/reports/";
647
+ }
648
648
  }
649
649
  ]
650
650
  }
@@ -911,42 +911,12 @@ var SwitchProfileSection = ({
911
911
  const [showLogoutConfirm, setShowLogoutConfirm] = (0, import_react13.useState)(false);
912
912
  const [switchingProfileId, setSwitchingProfileId] = (0, import_react13.useState)(null);
913
913
  const [switchError, setSwitchError] = (0, import_react13.useState)(null);
914
- (0, import_react13.useLayoutEffect)(() => {
915
- if (!open || !(anchorRef == null ? void 0 : anchorRef.current)) return;
916
- const updatePosition = () => {
917
- const rect = anchorRef.current.getBoundingClientRect();
918
- setPosition({
919
- left: rect.right + 2,
920
- bottom: window.innerHeight - rect.bottom
921
- });
922
- };
923
- updatePosition();
924
- window.addEventListener("resize", updatePosition);
925
- window.addEventListener("scroll", updatePosition, true);
926
- return () => {
927
- window.removeEventListener("resize", updatePosition);
928
- window.removeEventListener("scroll", updatePosition, true);
929
- };
930
- }, [open, anchorRef]);
931
- (0, import_react13.useEffect)(() => {
932
- if (!open) setSwitchError(null);
933
- }, [open]);
934
- (0, import_react13.useEffect)(() => {
935
- if (!switchError) return;
936
- const timer = setTimeout(() => setSwitchError(null), 5e3);
937
- return () => clearTimeout(timer);
938
- }, [switchError]);
939
- if (!open && !showLogoutConfirm || typeof document === "undefined") return null;
940
914
  const jettIdData = getJettIdCookieData();
941
915
  const userName = (jettIdData == null ? void 0 : jettIdData.UserName) || "";
942
916
  const userEmail = (jettIdData == null ? void 0 : jettIdData.UserEmail) || "";
943
917
  const currentProfileId = jettIdData == null ? void 0 : jettIdData.ProfileId;
944
918
  const allMarkets = getProfilesFromJettIdCookie(true);
945
919
  const markets = allMarkets.length ? allMarkets : (jettIdData == null ? void 0 : jettIdData.EntityName) ? [{ ProfileId: currentProfileId, EntityName: jettIdData.EntityName }] : [];
946
- const handleConfirmLogout = () => {
947
- setShowLogoutConfirm(false);
948
- onLogout == null ? void 0 : onLogout();
949
- };
950
920
  const buildRequestContext = () => ({
951
921
  UserAgent: typeof navigator !== "undefined" ? navigator.userAgent : "Mozilla/5.0",
952
922
  TrackingId: crypto.randomUUID(),
@@ -995,6 +965,44 @@ var SwitchProfileSection = ({
995
965
  setSwitchingProfileId(null);
996
966
  }
997
967
  };
968
+ (0, import_react13.useLayoutEffect)(() => {
969
+ if (!open || !(anchorRef == null ? void 0 : anchorRef.current)) return;
970
+ const updatePosition = () => {
971
+ const rect = anchorRef.current.getBoundingClientRect();
972
+ setPosition({
973
+ left: rect.right + 2,
974
+ bottom: window.innerHeight - rect.bottom
975
+ });
976
+ };
977
+ updatePosition();
978
+ window.addEventListener("resize", updatePosition);
979
+ window.addEventListener("scroll", updatePosition, true);
980
+ return () => {
981
+ window.removeEventListener("resize", updatePosition);
982
+ window.removeEventListener("scroll", updatePosition, true);
983
+ };
984
+ }, [open, anchorRef]);
985
+ (0, import_react13.useEffect)(() => {
986
+ if (!open) setSwitchError(null);
987
+ }, [open]);
988
+ (0, import_react13.useEffect)(() => {
989
+ if (!switchError) return;
990
+ const timer = setTimeout(() => setSwitchError(null), 5e3);
991
+ return () => clearTimeout(timer);
992
+ }, [switchError]);
993
+ (0, import_react13.useEffect)(() => {
994
+ if (!open || switchingProfileId) return;
995
+ if (allMarkets.length <= 1) return;
996
+ const tmcProfile = allMarkets.find((profile) => profile.Scope === "TMC");
997
+ if (tmcProfile && tmcProfile.ProfileId !== currentProfileId) {
998
+ handleProfileSwitch(tmcProfile);
999
+ }
1000
+ }, [open, allMarkets, currentProfileId, switchingProfileId]);
1001
+ if (!open && !showLogoutConfirm || typeof document === "undefined") return null;
1002
+ const handleConfirmLogout = () => {
1003
+ setShowLogoutConfirm(false);
1004
+ onLogout == null ? void 0 : onLogout();
1005
+ };
998
1006
  return /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, open && (0, import_react_dom2.createPortal)(
999
1007
  /* @__PURE__ */ import_react13.default.createElement(import_react13.default.Fragment, null, /* @__PURE__ */ import_react13.default.createElement("div", { className: "fixed inset-0 z-[9999]", onClick: onClose, id: `${id}-backdrop` }), /* @__PURE__ */ import_react13.default.createElement(
1000
1008
  "div",
package/dist/index.mjs CHANGED
@@ -574,11 +574,10 @@ var navItemsConstant = [
574
574
  isDropDown: true,
575
575
  options: [
576
576
  {
577
- label: "Reports (Coming Soon)",
578
- isDisabled: true
579
- // onClick: () => {
580
- // window.open("https://viz.jett.travel", "_blank");
581
- // },
577
+ label: "Reports",
578
+ onClick: () => {
579
+ window.location.href = "/reports/";
580
+ }
582
581
  }
583
582
  ]
584
583
  },
@@ -608,9 +607,10 @@ var navItemsConstant = [
608
607
  }
609
608
  },
610
609
  {
611
- label: "Reports Configurations (Coming Soon)",
612
- isDisabled: true
613
- // onClick: () => {},
610
+ label: "Reports Configurations",
611
+ onClick: () => {
612
+ window.location.href = "/reports/";
613
+ }
614
614
  }
615
615
  ]
616
616
  }
@@ -877,42 +877,12 @@ var SwitchProfileSection = ({
877
877
  const [showLogoutConfirm, setShowLogoutConfirm] = useState3(false);
878
878
  const [switchingProfileId, setSwitchingProfileId] = useState3(null);
879
879
  const [switchError, setSwitchError] = useState3(null);
880
- useLayoutEffect(() => {
881
- if (!open || !(anchorRef == null ? void 0 : anchorRef.current)) return;
882
- const updatePosition = () => {
883
- const rect = anchorRef.current.getBoundingClientRect();
884
- setPosition({
885
- left: rect.right + 2,
886
- bottom: window.innerHeight - rect.bottom
887
- });
888
- };
889
- updatePosition();
890
- window.addEventListener("resize", updatePosition);
891
- window.addEventListener("scroll", updatePosition, true);
892
- return () => {
893
- window.removeEventListener("resize", updatePosition);
894
- window.removeEventListener("scroll", updatePosition, true);
895
- };
896
- }, [open, anchorRef]);
897
- useEffect(() => {
898
- if (!open) setSwitchError(null);
899
- }, [open]);
900
- useEffect(() => {
901
- if (!switchError) return;
902
- const timer = setTimeout(() => setSwitchError(null), 5e3);
903
- return () => clearTimeout(timer);
904
- }, [switchError]);
905
- if (!open && !showLogoutConfirm || typeof document === "undefined") return null;
906
880
  const jettIdData = getJettIdCookieData();
907
881
  const userName = (jettIdData == null ? void 0 : jettIdData.UserName) || "";
908
882
  const userEmail = (jettIdData == null ? void 0 : jettIdData.UserEmail) || "";
909
883
  const currentProfileId = jettIdData == null ? void 0 : jettIdData.ProfileId;
910
884
  const allMarkets = getProfilesFromJettIdCookie(true);
911
885
  const markets = allMarkets.length ? allMarkets : (jettIdData == null ? void 0 : jettIdData.EntityName) ? [{ ProfileId: currentProfileId, EntityName: jettIdData.EntityName }] : [];
912
- const handleConfirmLogout = () => {
913
- setShowLogoutConfirm(false);
914
- onLogout == null ? void 0 : onLogout();
915
- };
916
886
  const buildRequestContext = () => ({
917
887
  UserAgent: typeof navigator !== "undefined" ? navigator.userAgent : "Mozilla/5.0",
918
888
  TrackingId: crypto.randomUUID(),
@@ -961,6 +931,44 @@ var SwitchProfileSection = ({
961
931
  setSwitchingProfileId(null);
962
932
  }
963
933
  };
934
+ useLayoutEffect(() => {
935
+ if (!open || !(anchorRef == null ? void 0 : anchorRef.current)) return;
936
+ const updatePosition = () => {
937
+ const rect = anchorRef.current.getBoundingClientRect();
938
+ setPosition({
939
+ left: rect.right + 2,
940
+ bottom: window.innerHeight - rect.bottom
941
+ });
942
+ };
943
+ updatePosition();
944
+ window.addEventListener("resize", updatePosition);
945
+ window.addEventListener("scroll", updatePosition, true);
946
+ return () => {
947
+ window.removeEventListener("resize", updatePosition);
948
+ window.removeEventListener("scroll", updatePosition, true);
949
+ };
950
+ }, [open, anchorRef]);
951
+ useEffect(() => {
952
+ if (!open) setSwitchError(null);
953
+ }, [open]);
954
+ useEffect(() => {
955
+ if (!switchError) return;
956
+ const timer = setTimeout(() => setSwitchError(null), 5e3);
957
+ return () => clearTimeout(timer);
958
+ }, [switchError]);
959
+ useEffect(() => {
960
+ if (!open || switchingProfileId) return;
961
+ if (allMarkets.length <= 1) return;
962
+ const tmcProfile = allMarkets.find((profile) => profile.Scope === "TMC");
963
+ if (tmcProfile && tmcProfile.ProfileId !== currentProfileId) {
964
+ handleProfileSwitch(tmcProfile);
965
+ }
966
+ }, [open, allMarkets, currentProfileId, switchingProfileId]);
967
+ if (!open && !showLogoutConfirm || typeof document === "undefined") return null;
968
+ const handleConfirmLogout = () => {
969
+ setShowLogoutConfirm(false);
970
+ onLogout == null ? void 0 : onLogout();
971
+ };
964
972
  return /* @__PURE__ */ React13.createElement(React13.Fragment, null, open && createPortal2(
965
973
  /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement("div", { className: "fixed inset-0 z-[9999]", onClick: onClose, id: `${id}-backdrop` }), /* @__PURE__ */ React13.createElement(
966
974
  "div",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jett.admin.npmpackage",
3
- "version": "2.0.25",
3
+ "version": "2.0.27",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "exports": {