@optifye/dashboard-core 6.12.35 → 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 +15 -22
- package/dist/index.mjs +15 -22
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -59613,11 +59613,9 @@ 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
|
|
59618
|
-
|
|
59619
|
-
if (path !== "/kpis") return false;
|
|
59620
|
-
return new URLSearchParams(queryString2).get("tab") === "leaderboard";
|
|
59616
|
+
var isActiveToastSurface = (asPath) => {
|
|
59617
|
+
const { path } = getRoutePathAndQuery(asPath);
|
|
59618
|
+
return path === "/" || path === "/live-monitor";
|
|
59621
59619
|
};
|
|
59622
59620
|
var getLocalQaSimulationMode = (asPath) => {
|
|
59623
59621
|
if (typeof window === "undefined") return null;
|
|
@@ -59873,8 +59871,8 @@ var LineOvertakeNotificationManager = ({
|
|
|
59873
59871
|
const [visibleLines, setVisibleLines] = React146.useState([]);
|
|
59874
59872
|
const [linesLoaded, setLinesLoaded] = React146.useState(false);
|
|
59875
59873
|
const [notificationEvents, setNotificationEvents] = React146.useState([]);
|
|
59876
|
-
const
|
|
59877
|
-
const qaSimulationMode = getLocalQaSimulationMode(router$1.asPath);
|
|
59874
|
+
const isOnActiveToastSurface = isActiveToastSurface(router$1.asPath);
|
|
59875
|
+
const qaSimulationMode = isOnActiveToastSurface ? getLocalQaSimulationMode(router$1.asPath) : null;
|
|
59878
59876
|
const qaSimulationEnabled = Boolean(qaSimulationMode);
|
|
59879
59877
|
const realRoleMode = resolveRoleMode(user?.role_level || user?.role);
|
|
59880
59878
|
const roleMode = qaSimulationEnabled ? "optifye" : realRoleMode;
|
|
@@ -59944,27 +59942,22 @@ var LineOvertakeNotificationManager = ({
|
|
|
59944
59942
|
]
|
|
59945
59943
|
);
|
|
59946
59944
|
React146.useEffect(() => {
|
|
59945
|
+
if (!isOnActiveToastSurface) return;
|
|
59946
|
+
if (scopeKeyRef.current === scopeKey) return;
|
|
59947
59947
|
previousSnapshotRef.current = null;
|
|
59948
59948
|
notificationEventsRef.current = [];
|
|
59949
59949
|
setNotificationEvents([]);
|
|
59950
59950
|
scopeKeyRef.current = scopeKey;
|
|
59951
|
-
}, [scopeKey]);
|
|
59951
|
+
}, [isOnActiveToastSurface, scopeKey]);
|
|
59952
59952
|
React146.useEffect(() => {
|
|
59953
|
-
if (
|
|
59954
|
-
previousSnapshotRef.current = null;
|
|
59953
|
+
if (isOnActiveToastSurface) return;
|
|
59955
59954
|
notificationEventsRef.current = [];
|
|
59956
59955
|
setNotificationEvents([]);
|
|
59957
|
-
|
|
59958
|
-
setLinesLoaded(false);
|
|
59959
|
-
}, [isOnLeaderboardRoute]);
|
|
59956
|
+
}, [isOnActiveToastSurface]);
|
|
59960
59957
|
React146.useEffect(() => {
|
|
59961
59958
|
let cancelled = false;
|
|
59962
59959
|
const loadLines = async () => {
|
|
59963
|
-
if (
|
|
59964
|
-
setVisibleLines([]);
|
|
59965
|
-
setLinesLoaded(false);
|
|
59966
|
-
return;
|
|
59967
|
-
}
|
|
59960
|
+
if (!isOnActiveToastSurface) return;
|
|
59968
59961
|
if (qaSimulationEnabled) {
|
|
59969
59962
|
setVisibleLines(QA_SIMULATED_LINES);
|
|
59970
59963
|
setLinesLoaded(true);
|
|
@@ -59999,7 +59992,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
59999
59992
|
return () => {
|
|
60000
59993
|
cancelled = true;
|
|
60001
59994
|
};
|
|
60002
|
-
}, [companyId,
|
|
59995
|
+
}, [companyId, isOnActiveToastSurface, qaSimulationEnabled, roleMode, supabase]);
|
|
60003
59996
|
const openLeaderboard = React146.useCallback(() => {
|
|
60004
59997
|
notificationEventsRef.current = [];
|
|
60005
59998
|
setNotificationEvents([]);
|
|
@@ -60045,7 +60038,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60045
60038
|
});
|
|
60046
60039
|
}, [dedupeScopeKey]);
|
|
60047
60040
|
const pollLeaderboard = React146.useCallback(async () => {
|
|
60048
|
-
if (
|
|
60041
|
+
if (!isOnActiveToastSurface) return;
|
|
60049
60042
|
if (qaSimulationEnabled) {
|
|
60050
60043
|
if (pollInFlightRef.current) return;
|
|
60051
60044
|
pollInFlightRef.current = true;
|
|
@@ -60104,7 +60097,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60104
60097
|
companyId,
|
|
60105
60098
|
currentShift.date,
|
|
60106
60099
|
currentShift.shiftId,
|
|
60107
|
-
|
|
60100
|
+
isOnActiveToastSurface,
|
|
60108
60101
|
linesLoaded,
|
|
60109
60102
|
qaSimulationEnabled,
|
|
60110
60103
|
qaSimulationMode,
|
|
@@ -60126,7 +60119,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60126
60119
|
window.clearInterval(intervalId);
|
|
60127
60120
|
};
|
|
60128
60121
|
}, [pollIntervalMs, pollLeaderboard]);
|
|
60129
|
-
if (
|
|
60122
|
+
if (!isOnActiveToastSurface) return null;
|
|
60130
60123
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
60131
60124
|
LineOvertakeNotificationPopup,
|
|
60132
60125
|
{
|
package/dist/index.mjs
CHANGED
|
@@ -59584,11 +59584,9 @@ 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
|
|
59589
|
-
|
|
59590
|
-
if (path !== "/kpis") return false;
|
|
59591
|
-
return new URLSearchParams(queryString2).get("tab") === "leaderboard";
|
|
59587
|
+
var isActiveToastSurface = (asPath) => {
|
|
59588
|
+
const { path } = getRoutePathAndQuery(asPath);
|
|
59589
|
+
return path === "/" || path === "/live-monitor";
|
|
59592
59590
|
};
|
|
59593
59591
|
var getLocalQaSimulationMode = (asPath) => {
|
|
59594
59592
|
if (typeof window === "undefined") return null;
|
|
@@ -59844,8 +59842,8 @@ var LineOvertakeNotificationManager = ({
|
|
|
59844
59842
|
const [visibleLines, setVisibleLines] = useState([]);
|
|
59845
59843
|
const [linesLoaded, setLinesLoaded] = useState(false);
|
|
59846
59844
|
const [notificationEvents, setNotificationEvents] = useState([]);
|
|
59847
|
-
const
|
|
59848
|
-
const qaSimulationMode = getLocalQaSimulationMode(router.asPath);
|
|
59845
|
+
const isOnActiveToastSurface = isActiveToastSurface(router.asPath);
|
|
59846
|
+
const qaSimulationMode = isOnActiveToastSurface ? getLocalQaSimulationMode(router.asPath) : null;
|
|
59849
59847
|
const qaSimulationEnabled = Boolean(qaSimulationMode);
|
|
59850
59848
|
const realRoleMode = resolveRoleMode(user?.role_level || user?.role);
|
|
59851
59849
|
const roleMode = qaSimulationEnabled ? "optifye" : realRoleMode;
|
|
@@ -59915,27 +59913,22 @@ var LineOvertakeNotificationManager = ({
|
|
|
59915
59913
|
]
|
|
59916
59914
|
);
|
|
59917
59915
|
useEffect(() => {
|
|
59916
|
+
if (!isOnActiveToastSurface) return;
|
|
59917
|
+
if (scopeKeyRef.current === scopeKey) return;
|
|
59918
59918
|
previousSnapshotRef.current = null;
|
|
59919
59919
|
notificationEventsRef.current = [];
|
|
59920
59920
|
setNotificationEvents([]);
|
|
59921
59921
|
scopeKeyRef.current = scopeKey;
|
|
59922
|
-
}, [scopeKey]);
|
|
59922
|
+
}, [isOnActiveToastSurface, scopeKey]);
|
|
59923
59923
|
useEffect(() => {
|
|
59924
|
-
if (
|
|
59925
|
-
previousSnapshotRef.current = null;
|
|
59924
|
+
if (isOnActiveToastSurface) return;
|
|
59926
59925
|
notificationEventsRef.current = [];
|
|
59927
59926
|
setNotificationEvents([]);
|
|
59928
|
-
|
|
59929
|
-
setLinesLoaded(false);
|
|
59930
|
-
}, [isOnLeaderboardRoute]);
|
|
59927
|
+
}, [isOnActiveToastSurface]);
|
|
59931
59928
|
useEffect(() => {
|
|
59932
59929
|
let cancelled = false;
|
|
59933
59930
|
const loadLines = async () => {
|
|
59934
|
-
if (
|
|
59935
|
-
setVisibleLines([]);
|
|
59936
|
-
setLinesLoaded(false);
|
|
59937
|
-
return;
|
|
59938
|
-
}
|
|
59931
|
+
if (!isOnActiveToastSurface) return;
|
|
59939
59932
|
if (qaSimulationEnabled) {
|
|
59940
59933
|
setVisibleLines(QA_SIMULATED_LINES);
|
|
59941
59934
|
setLinesLoaded(true);
|
|
@@ -59970,7 +59963,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
59970
59963
|
return () => {
|
|
59971
59964
|
cancelled = true;
|
|
59972
59965
|
};
|
|
59973
|
-
}, [companyId,
|
|
59966
|
+
}, [companyId, isOnActiveToastSurface, qaSimulationEnabled, roleMode, supabase]);
|
|
59974
59967
|
const openLeaderboard = useCallback(() => {
|
|
59975
59968
|
notificationEventsRef.current = [];
|
|
59976
59969
|
setNotificationEvents([]);
|
|
@@ -60016,7 +60009,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60016
60009
|
});
|
|
60017
60010
|
}, [dedupeScopeKey]);
|
|
60018
60011
|
const pollLeaderboard = useCallback(async () => {
|
|
60019
|
-
if (
|
|
60012
|
+
if (!isOnActiveToastSurface) return;
|
|
60020
60013
|
if (qaSimulationEnabled) {
|
|
60021
60014
|
if (pollInFlightRef.current) return;
|
|
60022
60015
|
pollInFlightRef.current = true;
|
|
@@ -60075,7 +60068,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60075
60068
|
companyId,
|
|
60076
60069
|
currentShift.date,
|
|
60077
60070
|
currentShift.shiftId,
|
|
60078
|
-
|
|
60071
|
+
isOnActiveToastSurface,
|
|
60079
60072
|
linesLoaded,
|
|
60080
60073
|
qaSimulationEnabled,
|
|
60081
60074
|
qaSimulationMode,
|
|
@@ -60097,7 +60090,7 @@ var LineOvertakeNotificationManager = ({
|
|
|
60097
60090
|
window.clearInterval(intervalId);
|
|
60098
60091
|
};
|
|
60099
60092
|
}, [pollIntervalMs, pollLeaderboard]);
|
|
60100
|
-
if (
|
|
60093
|
+
if (!isOnActiveToastSurface) return null;
|
|
60101
60094
|
return /* @__PURE__ */ jsx(
|
|
60102
60095
|
LineOvertakeNotificationPopup,
|
|
60103
60096
|
{
|