@optifye/dashboard-core 6.11.45 → 6.11.47
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 +57 -34
- package/dist/index.mjs +57 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37655,6 +37655,7 @@ var buildPrefetchedExplorerMetadata = (activeFilter, metadataCategoryId, categor
|
|
|
37655
37655
|
[activeFilter]: categoryMetadata
|
|
37656
37656
|
};
|
|
37657
37657
|
};
|
|
37658
|
+
var shouldDeferClipPlayerRender = (cropLoading, workspaceCrop) => cropLoading && workspaceCrop === null;
|
|
37658
37659
|
var getSecondsBetweenTimestamps = (startTime, endTime) => {
|
|
37659
37660
|
const startDate = parseTimestamp(startTime);
|
|
37660
37661
|
const endDate = parseTimestamp(endTime);
|
|
@@ -42786,7 +42787,7 @@ var BottlenecksContent = ({
|
|
|
42786
42787
|
const isEffectiveShiftReady = Boolean(effectiveShift && effectiveDate);
|
|
42787
42788
|
const effectiveDateString = effectiveDate || "";
|
|
42788
42789
|
const effectiveShiftId = effectiveShift ?? "";
|
|
42789
|
-
const { crop: workspaceCrop} = useWorkspaceCrop(workspaceId);
|
|
42790
|
+
const { crop: workspaceCrop, isLoading: cropLoading } = useWorkspaceCrop(workspaceId);
|
|
42790
42791
|
const { metrics: fetchedWorkspaceMetrics } = useWorkspaceDetailedMetrics(
|
|
42791
42792
|
workspaceId,
|
|
42792
42793
|
date,
|
|
@@ -42835,6 +42836,8 @@ var BottlenecksContent = ({
|
|
|
42835
42836
|
const [pendingVideo, setPendingVideo] = React143.useState(null);
|
|
42836
42837
|
const [isVideoBuffering, setIsVideoBuffering] = React143.useState(false);
|
|
42837
42838
|
const [isInitialLoading, setIsInitialLoading] = React143.useState(false);
|
|
42839
|
+
const shouldDeferPlayerRenderForCrop = shouldDeferClipPlayerRender(cropLoading, workspaceCrop);
|
|
42840
|
+
const showBlockingVideoLoader = shouldDeferPlayerRenderForCrop || isTransitioning || isVideoBuffering && isInitialLoading;
|
|
42838
42841
|
const [isShareLoading, setIsShareLoading] = React143.useState(false);
|
|
42839
42842
|
const [isShareCopied, setIsShareCopied] = React143.useState(false);
|
|
42840
42843
|
const shareCopiedTimeoutRef = React143.useRef(null);
|
|
@@ -44574,7 +44577,7 @@ var BottlenecksContent = ({
|
|
|
44574
44577
|
opacity: isTransitioning ? 0 : 1,
|
|
44575
44578
|
transition: "opacity 0.1s ease-in-out"
|
|
44576
44579
|
},
|
|
44577
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
44580
|
+
children: !shouldDeferPlayerRenderForCrop && /* @__PURE__ */ jsxRuntime.jsx(
|
|
44578
44581
|
CroppedVideoPlayer,
|
|
44579
44582
|
{
|
|
44580
44583
|
ref: videoRef,
|
|
@@ -44605,8 +44608,8 @@ var BottlenecksContent = ({
|
|
|
44605
44608
|
)
|
|
44606
44609
|
}
|
|
44607
44610
|
),
|
|
44608
|
-
|
|
44609
|
-
!isTransitioning && isVideoBuffering && !isInitialLoading && !error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black/60", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
44611
|
+
showBlockingVideoLoader && !error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
44612
|
+
!shouldDeferPlayerRenderForCrop && !isTransitioning && isVideoBuffering && !isInitialLoading && !error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black/60", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
44610
44613
|
error && error.type === "retrying" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-40 flex items-center justify-center bg-black/60", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
|
|
44611
44614
|
/* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md" }),
|
|
44612
44615
|
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-white text-sm mt-4 font-medium", children: error.message })
|
|
@@ -44999,7 +45002,7 @@ var BottlenecksContent = ({
|
|
|
44999
45002
|
opacity: isTransitioning ? 0 : 1,
|
|
45000
45003
|
transition: "opacity 0.1s ease-in-out"
|
|
45001
45004
|
},
|
|
45002
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
45005
|
+
children: !shouldDeferPlayerRenderForCrop && /* @__PURE__ */ jsxRuntime.jsx(
|
|
45003
45006
|
CroppedVideoPlayer,
|
|
45004
45007
|
{
|
|
45005
45008
|
ref: videoRef,
|
|
@@ -45030,8 +45033,8 @@ var BottlenecksContent = ({
|
|
|
45030
45033
|
)
|
|
45031
45034
|
}
|
|
45032
45035
|
),
|
|
45033
|
-
|
|
45034
|
-
!isTransitioning && isVideoBuffering && !isInitialLoading && !error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black/60", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
45036
|
+
showBlockingVideoLoader && !error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
45037
|
+
!shouldDeferPlayerRenderForCrop && !isTransitioning && isVideoBuffering && !isInitialLoading && !error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black/60", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
45035
45038
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-black/70 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 z-10", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between text-white", children: [
|
|
45036
45039
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
45037
45040
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium", children: "Speed:" }),
|
|
@@ -60957,6 +60960,7 @@ var useLiveMonitorBootstrap = ({
|
|
|
60957
60960
|
[normalizedLineIds]
|
|
60958
60961
|
);
|
|
60959
60962
|
const [state, setState] = React143.useState(() => createEmptyState());
|
|
60963
|
+
const [rawState, setRawState] = React143.useState(null);
|
|
60960
60964
|
const [isLoading, setIsLoading] = React143.useState(false);
|
|
60961
60965
|
const [error, setError] = React143.useState(null);
|
|
60962
60966
|
const activeRequestIdRef = React143.useRef(0);
|
|
@@ -60987,62 +60991,80 @@ var useLiveMonitorBootstrap = ({
|
|
|
60987
60991
|
if (requestId !== activeRequestIdRef.current) {
|
|
60988
60992
|
return;
|
|
60989
60993
|
}
|
|
60994
|
+
setRawState({
|
|
60995
|
+
requestKey,
|
|
60996
|
+
normalizedLineIds,
|
|
60997
|
+
response
|
|
60998
|
+
});
|
|
60999
|
+
} catch (fetchError) {
|
|
61000
|
+
if (requestId !== activeRequestIdRef.current) {
|
|
61001
|
+
return;
|
|
61002
|
+
}
|
|
61003
|
+
setError(fetchError instanceof Error ? fetchError : new Error("Failed to load live monitor bootstrap"));
|
|
61004
|
+
} finally {
|
|
61005
|
+
if (requestId === activeRequestIdRef.current) {
|
|
61006
|
+
setIsLoading(false);
|
|
61007
|
+
}
|
|
61008
|
+
}
|
|
61009
|
+
}, [
|
|
61010
|
+
enabled,
|
|
61011
|
+
supabase,
|
|
61012
|
+
resolvedCompanyId,
|
|
61013
|
+
normalizedLineIds,
|
|
61014
|
+
requestKey
|
|
61015
|
+
]);
|
|
61016
|
+
React143.useEffect(() => {
|
|
61017
|
+
if (!enabled || !rawState || !resolvedCompanyId) {
|
|
61018
|
+
return;
|
|
61019
|
+
}
|
|
61020
|
+
try {
|
|
60990
61021
|
const workspaceMetrics = transformMonitorWorkspaceMetrics({
|
|
60991
|
-
rows: response.workspace_metrics || [],
|
|
61022
|
+
rows: rawState.response.workspace_metrics || [],
|
|
60992
61023
|
companyId: resolvedCompanyId,
|
|
60993
61024
|
workspaceConfig: effectiveWorkspaceConfig,
|
|
60994
61025
|
appTimezone: effectiveTimezone,
|
|
60995
|
-
lineMetrics: response.line_metrics || [],
|
|
61026
|
+
lineMetrics: rawState.response.line_metrics || [],
|
|
60996
61027
|
resolveShiftConfig: (lineId) => lineShiftConfigs?.get(lineId) || fallbackShiftConfig,
|
|
60997
61028
|
shouldOverrideShiftType: (lineId) => Boolean(lineShiftConfigs?.get(lineId)),
|
|
60998
61029
|
fallbackShiftConfig
|
|
60999
61030
|
});
|
|
61000
|
-
const activeBreaks = transformActiveBreaks(response.active_breaks_by_line);
|
|
61001
|
-
const metadata = normalizeMetadata(response.metadata);
|
|
61031
|
+
const activeBreaks = transformActiveBreaks(rawState.response.active_breaks_by_line);
|
|
61032
|
+
const metadata = normalizeMetadata(rawState.response.metadata);
|
|
61002
61033
|
const workspaceIds = workspaceMetrics.map((metric) => metric.workspace_uuid).filter((workspaceId) => Boolean(workspaceId));
|
|
61003
|
-
const videoStreamsByWorkspaceId = response.video_streams_by_workspace_id || {};
|
|
61034
|
+
const videoStreamsByWorkspaceId = rawState.response.video_streams_by_workspace_id || {};
|
|
61004
61035
|
if (metadata.idleTimeVlmByLine) {
|
|
61005
61036
|
hydrateFromBackend(metadata.idleTimeVlmByLine);
|
|
61006
61037
|
}
|
|
61007
61038
|
workspaceService.primeWorkspaceVideoStreamsCache({
|
|
61008
61039
|
streams: videoStreamsByWorkspaceId,
|
|
61009
61040
|
workspaceIds,
|
|
61010
|
-
lineIds: normalizedLineIds
|
|
61041
|
+
lineIds: rawState.normalizedLineIds
|
|
61011
61042
|
});
|
|
61012
61043
|
setState({
|
|
61013
|
-
requestKey,
|
|
61014
|
-
resolvedScope: response.resolved_scope || [],
|
|
61015
|
-
scopeKey: response.scope_key || null,
|
|
61016
|
-
lines: response.lines || [],
|
|
61044
|
+
requestKey: rawState.requestKey,
|
|
61045
|
+
resolvedScope: rawState.response.resolved_scope || [],
|
|
61046
|
+
scopeKey: rawState.response.scope_key || null,
|
|
61047
|
+
lines: rawState.response.lines || [],
|
|
61017
61048
|
workspaceMetrics,
|
|
61018
|
-
lineMetrics: response.line_metrics || [],
|
|
61019
|
-
kpiTrend: response.kpi_trend || null,
|
|
61049
|
+
lineMetrics: rawState.response.line_metrics || [],
|
|
61050
|
+
kpiTrend: rawState.response.kpi_trend || null,
|
|
61020
61051
|
activeBreaks,
|
|
61021
61052
|
videoStreamsByWorkspaceId,
|
|
61022
|
-
efficiencyLegend: response.efficiency_legend || null,
|
|
61053
|
+
efficiencyLegend: rawState.response.efficiency_legend || null,
|
|
61023
61054
|
metadata
|
|
61024
61055
|
});
|
|
61025
|
-
} catch (
|
|
61026
|
-
|
|
61027
|
-
return;
|
|
61028
|
-
}
|
|
61029
|
-
setError(fetchError instanceof Error ? fetchError : new Error("Failed to load live monitor bootstrap"));
|
|
61030
|
-
} finally {
|
|
61031
|
-
if (requestId === activeRequestIdRef.current) {
|
|
61032
|
-
setIsLoading(false);
|
|
61033
|
-
}
|
|
61056
|
+
} catch (processingError) {
|
|
61057
|
+
setError(processingError instanceof Error ? processingError : new Error("Failed to process live monitor bootstrap"));
|
|
61034
61058
|
}
|
|
61035
61059
|
}, [
|
|
61036
61060
|
enabled,
|
|
61037
|
-
|
|
61061
|
+
rawState,
|
|
61038
61062
|
resolvedCompanyId,
|
|
61039
|
-
normalizedLineIds,
|
|
61040
|
-
requestKey,
|
|
61041
|
-
hydrateFromBackend,
|
|
61042
61063
|
effectiveWorkspaceConfig,
|
|
61043
61064
|
effectiveTimezone,
|
|
61044
61065
|
lineShiftConfigs,
|
|
61045
|
-
fallbackShiftConfig
|
|
61066
|
+
fallbackShiftConfig,
|
|
61067
|
+
hydrateFromBackend
|
|
61046
61068
|
]);
|
|
61047
61069
|
React143.useEffect(() => {
|
|
61048
61070
|
if (!enabled) {
|
|
@@ -61051,6 +61073,7 @@ var useLiveMonitorBootstrap = ({
|
|
|
61051
61073
|
}
|
|
61052
61074
|
if (!resolvedCompanyId || normalizedLineIds.length === 0 || !supabase) {
|
|
61053
61075
|
setState(createEmptyState());
|
|
61076
|
+
setRawState(null);
|
|
61054
61077
|
setIsLoading(false);
|
|
61055
61078
|
setError(null);
|
|
61056
61079
|
return;
|
package/dist/index.mjs
CHANGED
|
@@ -37626,6 +37626,7 @@ var buildPrefetchedExplorerMetadata = (activeFilter, metadataCategoryId, categor
|
|
|
37626
37626
|
[activeFilter]: categoryMetadata
|
|
37627
37627
|
};
|
|
37628
37628
|
};
|
|
37629
|
+
var shouldDeferClipPlayerRender = (cropLoading, workspaceCrop) => cropLoading && workspaceCrop === null;
|
|
37629
37630
|
var getSecondsBetweenTimestamps = (startTime, endTime) => {
|
|
37630
37631
|
const startDate = parseTimestamp(startTime);
|
|
37631
37632
|
const endDate = parseTimestamp(endTime);
|
|
@@ -42757,7 +42758,7 @@ var BottlenecksContent = ({
|
|
|
42757
42758
|
const isEffectiveShiftReady = Boolean(effectiveShift && effectiveDate);
|
|
42758
42759
|
const effectiveDateString = effectiveDate || "";
|
|
42759
42760
|
const effectiveShiftId = effectiveShift ?? "";
|
|
42760
|
-
const { crop: workspaceCrop} = useWorkspaceCrop(workspaceId);
|
|
42761
|
+
const { crop: workspaceCrop, isLoading: cropLoading } = useWorkspaceCrop(workspaceId);
|
|
42761
42762
|
const { metrics: fetchedWorkspaceMetrics } = useWorkspaceDetailedMetrics(
|
|
42762
42763
|
workspaceId,
|
|
42763
42764
|
date,
|
|
@@ -42806,6 +42807,8 @@ var BottlenecksContent = ({
|
|
|
42806
42807
|
const [pendingVideo, setPendingVideo] = useState(null);
|
|
42807
42808
|
const [isVideoBuffering, setIsVideoBuffering] = useState(false);
|
|
42808
42809
|
const [isInitialLoading, setIsInitialLoading] = useState(false);
|
|
42810
|
+
const shouldDeferPlayerRenderForCrop = shouldDeferClipPlayerRender(cropLoading, workspaceCrop);
|
|
42811
|
+
const showBlockingVideoLoader = shouldDeferPlayerRenderForCrop || isTransitioning || isVideoBuffering && isInitialLoading;
|
|
42809
42812
|
const [isShareLoading, setIsShareLoading] = useState(false);
|
|
42810
42813
|
const [isShareCopied, setIsShareCopied] = useState(false);
|
|
42811
42814
|
const shareCopiedTimeoutRef = useRef(null);
|
|
@@ -44545,7 +44548,7 @@ var BottlenecksContent = ({
|
|
|
44545
44548
|
opacity: isTransitioning ? 0 : 1,
|
|
44546
44549
|
transition: "opacity 0.1s ease-in-out"
|
|
44547
44550
|
},
|
|
44548
|
-
children: /* @__PURE__ */ jsx(
|
|
44551
|
+
children: !shouldDeferPlayerRenderForCrop && /* @__PURE__ */ jsx(
|
|
44549
44552
|
CroppedVideoPlayer,
|
|
44550
44553
|
{
|
|
44551
44554
|
ref: videoRef,
|
|
@@ -44576,8 +44579,8 @@ var BottlenecksContent = ({
|
|
|
44576
44579
|
)
|
|
44577
44580
|
}
|
|
44578
44581
|
),
|
|
44579
|
-
|
|
44580
|
-
!isTransitioning && isVideoBuffering && !isInitialLoading && !error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black/60", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
44582
|
+
showBlockingVideoLoader && !error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
44583
|
+
!shouldDeferPlayerRenderForCrop && !isTransitioning && isVideoBuffering && !isInitialLoading && !error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black/60", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
44581
44584
|
error && error.type === "retrying" && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-40 flex items-center justify-center bg-black/60", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
44582
44585
|
/* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md" }),
|
|
44583
44586
|
/* @__PURE__ */ jsx("p", { className: "text-white text-sm mt-4 font-medium", children: error.message })
|
|
@@ -44970,7 +44973,7 @@ var BottlenecksContent = ({
|
|
|
44970
44973
|
opacity: isTransitioning ? 0 : 1,
|
|
44971
44974
|
transition: "opacity 0.1s ease-in-out"
|
|
44972
44975
|
},
|
|
44973
|
-
children: /* @__PURE__ */ jsx(
|
|
44976
|
+
children: !shouldDeferPlayerRenderForCrop && /* @__PURE__ */ jsx(
|
|
44974
44977
|
CroppedVideoPlayer,
|
|
44975
44978
|
{
|
|
44976
44979
|
ref: videoRef,
|
|
@@ -45001,8 +45004,8 @@ var BottlenecksContent = ({
|
|
|
45001
45004
|
)
|
|
45002
45005
|
}
|
|
45003
45006
|
),
|
|
45004
|
-
|
|
45005
|
-
!isTransitioning && isVideoBuffering && !isInitialLoading && !error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black/60", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
45007
|
+
showBlockingVideoLoader && !error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
45008
|
+
!shouldDeferPlayerRenderForCrop && !isTransitioning && isVideoBuffering && !isInitialLoading && !error && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 z-30 flex items-center justify-center bg-black/60", children: /* @__PURE__ */ jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading video..." }) }),
|
|
45006
45009
|
/* @__PURE__ */ jsx("div", { className: "absolute bottom-0 left-0 right-0 p-4 bg-gradient-to-t from-black/70 to-transparent opacity-0 group-hover:opacity-100 transition-opacity duration-300 z-10", children: /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between text-white", children: [
|
|
45007
45010
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
45008
45011
|
/* @__PURE__ */ jsx("span", { className: "text-sm font-medium", children: "Speed:" }),
|
|
@@ -60928,6 +60931,7 @@ var useLiveMonitorBootstrap = ({
|
|
|
60928
60931
|
[normalizedLineIds]
|
|
60929
60932
|
);
|
|
60930
60933
|
const [state, setState] = useState(() => createEmptyState());
|
|
60934
|
+
const [rawState, setRawState] = useState(null);
|
|
60931
60935
|
const [isLoading, setIsLoading] = useState(false);
|
|
60932
60936
|
const [error, setError] = useState(null);
|
|
60933
60937
|
const activeRequestIdRef = useRef(0);
|
|
@@ -60958,62 +60962,80 @@ var useLiveMonitorBootstrap = ({
|
|
|
60958
60962
|
if (requestId !== activeRequestIdRef.current) {
|
|
60959
60963
|
return;
|
|
60960
60964
|
}
|
|
60965
|
+
setRawState({
|
|
60966
|
+
requestKey,
|
|
60967
|
+
normalizedLineIds,
|
|
60968
|
+
response
|
|
60969
|
+
});
|
|
60970
|
+
} catch (fetchError) {
|
|
60971
|
+
if (requestId !== activeRequestIdRef.current) {
|
|
60972
|
+
return;
|
|
60973
|
+
}
|
|
60974
|
+
setError(fetchError instanceof Error ? fetchError : new Error("Failed to load live monitor bootstrap"));
|
|
60975
|
+
} finally {
|
|
60976
|
+
if (requestId === activeRequestIdRef.current) {
|
|
60977
|
+
setIsLoading(false);
|
|
60978
|
+
}
|
|
60979
|
+
}
|
|
60980
|
+
}, [
|
|
60981
|
+
enabled,
|
|
60982
|
+
supabase,
|
|
60983
|
+
resolvedCompanyId,
|
|
60984
|
+
normalizedLineIds,
|
|
60985
|
+
requestKey
|
|
60986
|
+
]);
|
|
60987
|
+
useEffect(() => {
|
|
60988
|
+
if (!enabled || !rawState || !resolvedCompanyId) {
|
|
60989
|
+
return;
|
|
60990
|
+
}
|
|
60991
|
+
try {
|
|
60961
60992
|
const workspaceMetrics = transformMonitorWorkspaceMetrics({
|
|
60962
|
-
rows: response.workspace_metrics || [],
|
|
60993
|
+
rows: rawState.response.workspace_metrics || [],
|
|
60963
60994
|
companyId: resolvedCompanyId,
|
|
60964
60995
|
workspaceConfig: effectiveWorkspaceConfig,
|
|
60965
60996
|
appTimezone: effectiveTimezone,
|
|
60966
|
-
lineMetrics: response.line_metrics || [],
|
|
60997
|
+
lineMetrics: rawState.response.line_metrics || [],
|
|
60967
60998
|
resolveShiftConfig: (lineId) => lineShiftConfigs?.get(lineId) || fallbackShiftConfig,
|
|
60968
60999
|
shouldOverrideShiftType: (lineId) => Boolean(lineShiftConfigs?.get(lineId)),
|
|
60969
61000
|
fallbackShiftConfig
|
|
60970
61001
|
});
|
|
60971
|
-
const activeBreaks = transformActiveBreaks(response.active_breaks_by_line);
|
|
60972
|
-
const metadata = normalizeMetadata(response.metadata);
|
|
61002
|
+
const activeBreaks = transformActiveBreaks(rawState.response.active_breaks_by_line);
|
|
61003
|
+
const metadata = normalizeMetadata(rawState.response.metadata);
|
|
60973
61004
|
const workspaceIds = workspaceMetrics.map((metric) => metric.workspace_uuid).filter((workspaceId) => Boolean(workspaceId));
|
|
60974
|
-
const videoStreamsByWorkspaceId = response.video_streams_by_workspace_id || {};
|
|
61005
|
+
const videoStreamsByWorkspaceId = rawState.response.video_streams_by_workspace_id || {};
|
|
60975
61006
|
if (metadata.idleTimeVlmByLine) {
|
|
60976
61007
|
hydrateFromBackend(metadata.idleTimeVlmByLine);
|
|
60977
61008
|
}
|
|
60978
61009
|
workspaceService.primeWorkspaceVideoStreamsCache({
|
|
60979
61010
|
streams: videoStreamsByWorkspaceId,
|
|
60980
61011
|
workspaceIds,
|
|
60981
|
-
lineIds: normalizedLineIds
|
|
61012
|
+
lineIds: rawState.normalizedLineIds
|
|
60982
61013
|
});
|
|
60983
61014
|
setState({
|
|
60984
|
-
requestKey,
|
|
60985
|
-
resolvedScope: response.resolved_scope || [],
|
|
60986
|
-
scopeKey: response.scope_key || null,
|
|
60987
|
-
lines: response.lines || [],
|
|
61015
|
+
requestKey: rawState.requestKey,
|
|
61016
|
+
resolvedScope: rawState.response.resolved_scope || [],
|
|
61017
|
+
scopeKey: rawState.response.scope_key || null,
|
|
61018
|
+
lines: rawState.response.lines || [],
|
|
60988
61019
|
workspaceMetrics,
|
|
60989
|
-
lineMetrics: response.line_metrics || [],
|
|
60990
|
-
kpiTrend: response.kpi_trend || null,
|
|
61020
|
+
lineMetrics: rawState.response.line_metrics || [],
|
|
61021
|
+
kpiTrend: rawState.response.kpi_trend || null,
|
|
60991
61022
|
activeBreaks,
|
|
60992
61023
|
videoStreamsByWorkspaceId,
|
|
60993
|
-
efficiencyLegend: response.efficiency_legend || null,
|
|
61024
|
+
efficiencyLegend: rawState.response.efficiency_legend || null,
|
|
60994
61025
|
metadata
|
|
60995
61026
|
});
|
|
60996
|
-
} catch (
|
|
60997
|
-
|
|
60998
|
-
return;
|
|
60999
|
-
}
|
|
61000
|
-
setError(fetchError instanceof Error ? fetchError : new Error("Failed to load live monitor bootstrap"));
|
|
61001
|
-
} finally {
|
|
61002
|
-
if (requestId === activeRequestIdRef.current) {
|
|
61003
|
-
setIsLoading(false);
|
|
61004
|
-
}
|
|
61027
|
+
} catch (processingError) {
|
|
61028
|
+
setError(processingError instanceof Error ? processingError : new Error("Failed to process live monitor bootstrap"));
|
|
61005
61029
|
}
|
|
61006
61030
|
}, [
|
|
61007
61031
|
enabled,
|
|
61008
|
-
|
|
61032
|
+
rawState,
|
|
61009
61033
|
resolvedCompanyId,
|
|
61010
|
-
normalizedLineIds,
|
|
61011
|
-
requestKey,
|
|
61012
|
-
hydrateFromBackend,
|
|
61013
61034
|
effectiveWorkspaceConfig,
|
|
61014
61035
|
effectiveTimezone,
|
|
61015
61036
|
lineShiftConfigs,
|
|
61016
|
-
fallbackShiftConfig
|
|
61037
|
+
fallbackShiftConfig,
|
|
61038
|
+
hydrateFromBackend
|
|
61017
61039
|
]);
|
|
61018
61040
|
useEffect(() => {
|
|
61019
61041
|
if (!enabled) {
|
|
@@ -61022,6 +61044,7 @@ var useLiveMonitorBootstrap = ({
|
|
|
61022
61044
|
}
|
|
61023
61045
|
if (!resolvedCompanyId || normalizedLineIds.length === 0 || !supabase) {
|
|
61024
61046
|
setState(createEmptyState());
|
|
61047
|
+
setRawState(null);
|
|
61025
61048
|
setIsLoading(false);
|
|
61026
61049
|
setError(null);
|
|
61027
61050
|
return;
|