jett.admin.npmpackage 2.0.31 → 2.0.32

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
@@ -843,6 +843,30 @@ var encryptForSwitchProfile = (plainText) => {
843
843
  };
844
844
 
845
845
  // src/utils/switchProfileApi.js
846
+ var PROFILE_SWITCH_FLAG_KEY = "jett_profile_switch_done";
847
+ var hasSwitchedProfileThisSession = () => {
848
+ try {
849
+ return typeof localStorage !== "undefined" && localStorage.getItem(PROFILE_SWITCH_FLAG_KEY) === "true";
850
+ } catch {
851
+ return false;
852
+ }
853
+ };
854
+ var markProfileSwitched = () => {
855
+ try {
856
+ if (typeof localStorage !== "undefined") {
857
+ localStorage.setItem(PROFILE_SWITCH_FLAG_KEY, "true");
858
+ }
859
+ } catch {
860
+ }
861
+ };
862
+ var clearProfileSwitchFlag = () => {
863
+ try {
864
+ if (typeof localStorage !== "undefined") {
865
+ localStorage.removeItem(PROFILE_SWITCH_FLAG_KEY);
866
+ }
867
+ } catch {
868
+ }
869
+ };
846
870
  var buildRequestContext = () => ({
847
871
  UserAgent: typeof navigator !== "undefined" ? navigator.userAgent : "Mozilla/5.0",
848
872
  TrackingId: crypto.randomUUID(),
@@ -852,6 +876,7 @@ var buildRequestContext = () => ({
852
876
  // Client IP cannot be retrieved from browser
853
877
  });
854
878
  var switchProfile = async (profile) => {
879
+ markProfileSwitched();
855
880
  const encryptedRequest = encryptForSwitchProfile(
856
881
  JSON.stringify({
857
882
  ProfileToken: profile.ProfileToken,
@@ -1189,6 +1214,7 @@ var AppSideBar = ({
1189
1214
  }
1190
1215
  }, []);
1191
1216
  (0, import_react14.useEffect)(() => {
1217
+ if (hasSwitchedProfileThisSession()) return;
1192
1218
  const jettIdData = getJettIdCookieData();
1193
1219
  const allProfiles = getProfilesFromJettIdCookie(true);
1194
1220
  if (allProfiles.length <= 1) return;
@@ -1573,6 +1599,7 @@ var AppSideBar = ({
1573
1599
  },
1574
1600
  onLogout: () => {
1575
1601
  setIsSwitchProfileOpen(false);
1602
+ clearProfileSwitchFlag();
1576
1603
  if (onLogout) {
1577
1604
  onLogout();
1578
1605
  } else {
package/dist/index.mjs CHANGED
@@ -809,6 +809,30 @@ var encryptForSwitchProfile = (plainText) => {
809
809
  };
810
810
 
811
811
  // src/utils/switchProfileApi.js
812
+ var PROFILE_SWITCH_FLAG_KEY = "jett_profile_switch_done";
813
+ var hasSwitchedProfileThisSession = () => {
814
+ try {
815
+ return typeof localStorage !== "undefined" && localStorage.getItem(PROFILE_SWITCH_FLAG_KEY) === "true";
816
+ } catch {
817
+ return false;
818
+ }
819
+ };
820
+ var markProfileSwitched = () => {
821
+ try {
822
+ if (typeof localStorage !== "undefined") {
823
+ localStorage.setItem(PROFILE_SWITCH_FLAG_KEY, "true");
824
+ }
825
+ } catch {
826
+ }
827
+ };
828
+ var clearProfileSwitchFlag = () => {
829
+ try {
830
+ if (typeof localStorage !== "undefined") {
831
+ localStorage.removeItem(PROFILE_SWITCH_FLAG_KEY);
832
+ }
833
+ } catch {
834
+ }
835
+ };
812
836
  var buildRequestContext = () => ({
813
837
  UserAgent: typeof navigator !== "undefined" ? navigator.userAgent : "Mozilla/5.0",
814
838
  TrackingId: crypto.randomUUID(),
@@ -818,6 +842,7 @@ var buildRequestContext = () => ({
818
842
  // Client IP cannot be retrieved from browser
819
843
  });
820
844
  var switchProfile = async (profile) => {
845
+ markProfileSwitched();
821
846
  const encryptedRequest = encryptForSwitchProfile(
822
847
  JSON.stringify({
823
848
  ProfileToken: profile.ProfileToken,
@@ -1155,6 +1180,7 @@ var AppSideBar = ({
1155
1180
  }
1156
1181
  }, []);
1157
1182
  useEffect2(() => {
1183
+ if (hasSwitchedProfileThisSession()) return;
1158
1184
  const jettIdData = getJettIdCookieData();
1159
1185
  const allProfiles = getProfilesFromJettIdCookie(true);
1160
1186
  if (allProfiles.length <= 1) return;
@@ -1539,6 +1565,7 @@ var AppSideBar = ({
1539
1565
  },
1540
1566
  onLogout: () => {
1541
1567
  setIsSwitchProfileOpen(false);
1568
+ clearProfileSwitchFlag();
1542
1569
  if (onLogout) {
1543
1570
  onLogout();
1544
1571
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jett.admin.npmpackage",
3
- "version": "2.0.31",
3
+ "version": "2.0.32",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/index.mjs",
6
6
  "exports": {