@optifye/dashboard-core 6.12.36 → 6.12.37
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 +14 -26
- package/dist/index.mjs +14 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59613,17 +59613,10 @@ var getRoutePathAndQuery = (asPath) => {
|
|
|
59613
59613
|
queryString: window.location.search.startsWith("?") ? window.location.search.slice(1) : window.location.search
|
|
59614
59614
|
};
|
|
59615
59615
|
};
|
|
59616
|
-
var
|
|
59617
|
-
const { path, queryString: queryString2 } = getRoutePathAndQuery(asPath);
|
|
59618
|
-
if (path === "/leaderboard") return true;
|
|
59619
|
-
if (path !== "/kpis") return false;
|
|
59620
|
-
return new URLSearchParams(queryString2).get("tab") === "leaderboard";
|
|
59621
|
-
};
|
|
59622
|
-
var isAuthRoute = (asPath) => {
|
|
59616
|
+
var isActiveToastSurface = (asPath) => {
|
|
59623
59617
|
const { path } = getRoutePathAndQuery(asPath);
|
|
59624
|
-
return path === "/
|
|
59618
|
+
return path === "/" || path === "/live-monitor";
|
|
59625
59619
|
};
|
|
59626
|
-
var isSuppressedRoute = (asPath) => isLeaderboardRoute(asPath) || isAuthRoute(asPath);
|
|
59627
59620
|
var getLocalQaSimulationMode = (asPath) => {
|
|
59628
59621
|
if (typeof window === "undefined") return null;
|
|
59629
59622
|
if (process.env.NODE_ENV === "production") return null;
|
|
@@ -59878,8 +59871,8 @@ var LineOvertakeNotificationManager = ({
|
|
|
59878
59871
|
const [visibleLines, setVisibleLines] = React146.useState([]);
|
|
59879
59872
|
const [linesLoaded, setLinesLoaded] = React146.useState(false);
|
|
59880
59873
|
const [notificationEvents, setNotificationEvents] = React146.useState([]);
|
|
59881
|
-
const
|
|
59882
|
-
const qaSimulationMode = getLocalQaSimulationMode(router$1.asPath);
|
|
59874
|
+
const isOnActiveToastSurface = isActiveToastSurface(router$1.asPath);
|
|
59875
|
+
const qaSimulationMode = isOnActiveToastSurface ? getLocalQaSimulationMode(router$1.asPath) : null;
|
|
59883
59876
|
const qaSimulationEnabled = Boolean(qaSimulationMode);
|
|
59884
59877
|
const realRoleMode = resolveRoleMode(user?.role_level || user?.role);
|
|
59885
59878
|
const roleMode = qaSimulationEnabled ? "optifye" : realRoleMode;
|
|
@@ -59949,27 +59942,22 @@ var LineOvertakeNotificationManager = ({
|
|
|
59949
59942
|
]
|
|
59950
59943
|
);
|
|
59951
59944
|
React146.useEffect(() => {
|
|
59945
|
+
if (!isOnActiveToastSurface) return;
|
|
59946
|
+
if (scopeKeyRef.current === scopeKey) return;
|
|
59952
59947
|
previousSnapshotRef.current = null;
|
|
59953
59948
|
notificationEventsRef.current = [];
|
|
59954
59949
|
setNotificationEvents([]);
|
|
59955
59950
|
scopeKeyRef.current = scopeKey;
|
|
59956
|
-
}, [scopeKey]);
|
|
59951
|
+
}, [isOnActiveToastSurface, scopeKey]);
|
|
59957
59952
|
React146.useEffect(() => {
|
|
59958
|
-
if (
|
|
59959
|
-
previousSnapshotRef.current = null;
|
|
59953
|
+
if (isOnActiveToastSurface) return;
|
|
59960
59954
|
notificationEventsRef.current = [];
|
|
59961
59955
|
setNotificationEvents([]);
|
|
59962
|
-
|
|
59963
|
-
setLinesLoaded(false);
|
|
59964
|
-
}, [isOnSuppressedRoute]);
|
|
59956
|
+
}, [isOnActiveToastSurface]);
|
|
59965
59957
|
React146.useEffect(() => {
|
|
59966
59958
|
let cancelled = false;
|
|
59967
59959
|
const loadLines = async () => {
|
|
59968
|
-
if (
|
|
59969
|
-
setVisibleLines([]);
|
|
59970
|
-
setLinesLoaded(false);
|
|
59971
|
-
return;
|
|
59972
|
-
}
|
|
59960
|
+
if (!isOnActiveToastSurface) return;
|
|
59973
59961
|
if (qaSimulationEnabled) {
|
|
59974
59962
|
setVisibleLines(QA_SIMULATED_LINES);
|
|
59975
59963
|
setLinesLoaded(true);
|
|
@@ -60004,7 +59992,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60004
59992
|
return () => {
|
|
60005
59993
|
cancelled = true;
|
|
60006
59994
|
};
|
|
60007
|
-
}, [companyId,
|
|
59995
|
+
}, [companyId, isOnActiveToastSurface, qaSimulationEnabled, roleMode, supabase]);
|
|
60008
59996
|
const openLeaderboard = React146.useCallback(() => {
|
|
60009
59997
|
notificationEventsRef.current = [];
|
|
60010
59998
|
setNotificationEvents([]);
|
|
@@ -60050,7 +60038,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60050
60038
|
});
|
|
60051
60039
|
}, [dedupeScopeKey]);
|
|
60052
60040
|
const pollLeaderboard = React146.useCallback(async () => {
|
|
60053
|
-
if (
|
|
60041
|
+
if (!isOnActiveToastSurface) return;
|
|
60054
60042
|
if (qaSimulationEnabled) {
|
|
60055
60043
|
if (pollInFlightRef.current) return;
|
|
60056
60044
|
pollInFlightRef.current = true;
|
|
@@ -60109,7 +60097,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60109
60097
|
companyId,
|
|
60110
60098
|
currentShift.date,
|
|
60111
60099
|
currentShift.shiftId,
|
|
60112
|
-
|
|
60100
|
+
isOnActiveToastSurface,
|
|
60113
60101
|
linesLoaded,
|
|
60114
60102
|
qaSimulationEnabled,
|
|
60115
60103
|
qaSimulationMode,
|
|
@@ -60131,7 +60119,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60131
60119
|
window.clearInterval(intervalId);
|
|
60132
60120
|
};
|
|
60133
60121
|
}, [pollIntervalMs, pollLeaderboard]);
|
|
60134
|
-
if (
|
|
60122
|
+
if (!isOnActiveToastSurface) return null;
|
|
60135
60123
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
60136
60124
|
LineOvertakeNotificationPopup,
|
|
60137
60125
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -59584,17 +59584,10 @@ var getRoutePathAndQuery = (asPath) => {
|
|
|
59584
59584
|
queryString: window.location.search.startsWith("?") ? window.location.search.slice(1) : window.location.search
|
|
59585
59585
|
};
|
|
59586
59586
|
};
|
|
59587
|
-
var
|
|
59588
|
-
const { path, queryString: queryString2 } = getRoutePathAndQuery(asPath);
|
|
59589
|
-
if (path === "/leaderboard") return true;
|
|
59590
|
-
if (path !== "/kpis") return false;
|
|
59591
|
-
return new URLSearchParams(queryString2).get("tab") === "leaderboard";
|
|
59592
|
-
};
|
|
59593
|
-
var isAuthRoute = (asPath) => {
|
|
59587
|
+
var isActiveToastSurface = (asPath) => {
|
|
59594
59588
|
const { path } = getRoutePathAndQuery(asPath);
|
|
59595
|
-
return path === "/
|
|
59589
|
+
return path === "/" || path === "/live-monitor";
|
|
59596
59590
|
};
|
|
59597
|
-
var isSuppressedRoute = (asPath) => isLeaderboardRoute(asPath) || isAuthRoute(asPath);
|
|
59598
59591
|
var getLocalQaSimulationMode = (asPath) => {
|
|
59599
59592
|
if (typeof window === "undefined") return null;
|
|
59600
59593
|
if (process.env.NODE_ENV === "production") return null;
|
|
@@ -59849,8 +59842,8 @@ var LineOvertakeNotificationManager = ({
|
|
|
59849
59842
|
const [visibleLines, setVisibleLines] = useState([]);
|
|
59850
59843
|
const [linesLoaded, setLinesLoaded] = useState(false);
|
|
59851
59844
|
const [notificationEvents, setNotificationEvents] = useState([]);
|
|
59852
|
-
const
|
|
59853
|
-
const qaSimulationMode = getLocalQaSimulationMode(router.asPath);
|
|
59845
|
+
const isOnActiveToastSurface = isActiveToastSurface(router.asPath);
|
|
59846
|
+
const qaSimulationMode = isOnActiveToastSurface ? getLocalQaSimulationMode(router.asPath) : null;
|
|
59854
59847
|
const qaSimulationEnabled = Boolean(qaSimulationMode);
|
|
59855
59848
|
const realRoleMode = resolveRoleMode(user?.role_level || user?.role);
|
|
59856
59849
|
const roleMode = qaSimulationEnabled ? "optifye" : realRoleMode;
|
|
@@ -59920,27 +59913,22 @@ var LineOvertakeNotificationManager = ({
|
|
|
59920
59913
|
]
|
|
59921
59914
|
);
|
|
59922
59915
|
useEffect(() => {
|
|
59916
|
+
if (!isOnActiveToastSurface) return;
|
|
59917
|
+
if (scopeKeyRef.current === scopeKey) return;
|
|
59923
59918
|
previousSnapshotRef.current = null;
|
|
59924
59919
|
notificationEventsRef.current = [];
|
|
59925
59920
|
setNotificationEvents([]);
|
|
59926
59921
|
scopeKeyRef.current = scopeKey;
|
|
59927
|
-
}, [scopeKey]);
|
|
59922
|
+
}, [isOnActiveToastSurface, scopeKey]);
|
|
59928
59923
|
useEffect(() => {
|
|
59929
|
-
if (
|
|
59930
|
-
previousSnapshotRef.current = null;
|
|
59924
|
+
if (isOnActiveToastSurface) return;
|
|
59931
59925
|
notificationEventsRef.current = [];
|
|
59932
59926
|
setNotificationEvents([]);
|
|
59933
|
-
|
|
59934
|
-
setLinesLoaded(false);
|
|
59935
|
-
}, [isOnSuppressedRoute]);
|
|
59927
|
+
}, [isOnActiveToastSurface]);
|
|
59936
59928
|
useEffect(() => {
|
|
59937
59929
|
let cancelled = false;
|
|
59938
59930
|
const loadLines = async () => {
|
|
59939
|
-
if (
|
|
59940
|
-
setVisibleLines([]);
|
|
59941
|
-
setLinesLoaded(false);
|
|
59942
|
-
return;
|
|
59943
|
-
}
|
|
59931
|
+
if (!isOnActiveToastSurface) return;
|
|
59944
59932
|
if (qaSimulationEnabled) {
|
|
59945
59933
|
setVisibleLines(QA_SIMULATED_LINES);
|
|
59946
59934
|
setLinesLoaded(true);
|
|
@@ -59975,7 +59963,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
59975
59963
|
return () => {
|
|
59976
59964
|
cancelled = true;
|
|
59977
59965
|
};
|
|
59978
|
-
}, [companyId,
|
|
59966
|
+
}, [companyId, isOnActiveToastSurface, qaSimulationEnabled, roleMode, supabase]);
|
|
59979
59967
|
const openLeaderboard = useCallback(() => {
|
|
59980
59968
|
notificationEventsRef.current = [];
|
|
59981
59969
|
setNotificationEvents([]);
|
|
@@ -60021,7 +60009,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60021
60009
|
});
|
|
60022
60010
|
}, [dedupeScopeKey]);
|
|
60023
60011
|
const pollLeaderboard = useCallback(async () => {
|
|
60024
|
-
if (
|
|
60012
|
+
if (!isOnActiveToastSurface) return;
|
|
60025
60013
|
if (qaSimulationEnabled) {
|
|
60026
60014
|
if (pollInFlightRef.current) return;
|
|
60027
60015
|
pollInFlightRef.current = true;
|
|
@@ -60080,7 +60068,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60080
60068
|
companyId,
|
|
60081
60069
|
currentShift.date,
|
|
60082
60070
|
currentShift.shiftId,
|
|
60083
|
-
|
|
60071
|
+
isOnActiveToastSurface,
|
|
60084
60072
|
linesLoaded,
|
|
60085
60073
|
qaSimulationEnabled,
|
|
60086
60074
|
qaSimulationMode,
|
|
@@ -60102,7 +60090,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60102
60090
|
window.clearInterval(intervalId);
|
|
60103
60091
|
};
|
|
60104
60092
|
}, [pollIntervalMs, pollLeaderboard]);
|
|
60105
|
-
if (
|
|
60093
|
+
if (!isOnActiveToastSurface) return null;
|
|
60106
60094
|
return /* @__PURE__ */ jsx(
|
|
60107
60095
|
LineOvertakeNotificationPopup,
|
|
60108
60096
|
{
|