@optifye/dashboard-core 6.12.25 → 6.12.26

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.d.mts CHANGED
@@ -7507,7 +7507,7 @@ interface PieChartProps {
7507
7507
  }
7508
7508
  declare const PieChart: React__default.FC<PieChartProps>;
7509
7509
 
7510
- type UptimeStatus = 'active' | 'idle' | 'unknown';
7510
+ type UptimeStatus = 'active' | 'idle' | 'unknown' | 'break';
7511
7511
  interface UptimePoint {
7512
7512
  minuteIndex: number;
7513
7513
  timeLabel: string;
@@ -7534,6 +7534,7 @@ interface HourlyUptimeChartProps {
7534
7534
  shiftDate?: string | null;
7535
7535
  timezone?: string | null;
7536
7536
  elapsedMinutes?: number | null;
7537
+ shiftBreaks?: Break[] | null;
7537
7538
  className?: string;
7538
7539
  }
7539
7540
  declare const HourlyUptimeChart: React__default.NamedExoticComponent<HourlyUptimeChartProps>;
@@ -8067,6 +8068,7 @@ declare const LineMonthlyPdfGenerator: React__default.FC<LineMonthlyPdfGenerator
8067
8068
  interface LineWhatsAppShareProps {
8068
8069
  lineInfo: LineInfo;
8069
8070
  className?: string;
8071
+ shiftBreaks?: Break[];
8070
8072
  }
8071
8073
  declare const LineWhatsAppShareButton: React__default.FC<LineWhatsAppShareProps>;
8072
8074
 
@@ -8289,6 +8291,7 @@ declare const WorkspaceMonthlyHistory: React__default.FC<WorkspaceMonthlyHistory
8289
8291
  interface WorkspaceWhatsAppShareProps {
8290
8292
  workspace: WorkspaceDetailedMetrics;
8291
8293
  className?: string;
8294
+ shiftBreaks?: Break[];
8292
8295
  }
8293
8296
  declare const WorkspaceWhatsAppShareButton: React__default.FC<WorkspaceWhatsAppShareProps>;
8294
8297
 
package/dist/index.d.ts CHANGED
@@ -7507,7 +7507,7 @@ interface PieChartProps {
7507
7507
  }
7508
7508
  declare const PieChart: React__default.FC<PieChartProps>;
7509
7509
 
7510
- type UptimeStatus = 'active' | 'idle' | 'unknown';
7510
+ type UptimeStatus = 'active' | 'idle' | 'unknown' | 'break';
7511
7511
  interface UptimePoint {
7512
7512
  minuteIndex: number;
7513
7513
  timeLabel: string;
@@ -7534,6 +7534,7 @@ interface HourlyUptimeChartProps {
7534
7534
  shiftDate?: string | null;
7535
7535
  timezone?: string | null;
7536
7536
  elapsedMinutes?: number | null;
7537
+ shiftBreaks?: Break[] | null;
7537
7538
  className?: string;
7538
7539
  }
7539
7540
  declare const HourlyUptimeChart: React__default.NamedExoticComponent<HourlyUptimeChartProps>;
@@ -8067,6 +8068,7 @@ declare const LineMonthlyPdfGenerator: React__default.FC<LineMonthlyPdfGenerator
8067
8068
  interface LineWhatsAppShareProps {
8068
8069
  lineInfo: LineInfo;
8069
8070
  className?: string;
8071
+ shiftBreaks?: Break[];
8070
8072
  }
8071
8073
  declare const LineWhatsAppShareButton: React__default.FC<LineWhatsAppShareProps>;
8072
8074
 
@@ -8289,6 +8291,7 @@ declare const WorkspaceMonthlyHistory: React__default.FC<WorkspaceMonthlyHistory
8289
8291
  interface WorkspaceWhatsAppShareProps {
8290
8292
  workspace: WorkspaceDetailedMetrics;
8291
8293
  className?: string;
8294
+ shiftBreaks?: Break[];
8292
8295
  }
8293
8296
  declare const WorkspaceWhatsAppShareButton: React__default.FC<WorkspaceWhatsAppShareProps>;
8294
8297
 
package/dist/index.js CHANGED
@@ -36146,6 +36146,37 @@ var interpretIdleValue = (value) => {
36146
36146
  if (value === "x" || value === null || value === void 0) return "unknown";
36147
36147
  return "unknown";
36148
36148
  };
36149
+ var timeToMinutes = (value) => {
36150
+ const parsed = parseTime(value);
36151
+ if (!parsed) return null;
36152
+ return parsed.hour * 60 + parsed.minute;
36153
+ };
36154
+ var normalizeBreaksOnShiftTimeline2 = (shiftStart, shiftBreaks) => {
36155
+ const shiftStartMinutes = timeToMinutes(shiftStart);
36156
+ if (shiftStartMinutes === null || !Array.isArray(shiftBreaks)) {
36157
+ return [];
36158
+ }
36159
+ return shiftBreaks.flatMap((entry) => {
36160
+ const startRaw = timeToMinutes(entry?.startTime ?? entry?.start);
36161
+ const endRaw = timeToMinutes(entry?.endTime ?? entry?.end);
36162
+ if (startRaw === null || endRaw === null) return [];
36163
+ let start = startRaw;
36164
+ let end = endRaw;
36165
+ if (end <= start) {
36166
+ end += 24 * 60;
36167
+ }
36168
+ if (start < shiftStartMinutes) {
36169
+ start += 24 * 60;
36170
+ end += 24 * 60;
36171
+ }
36172
+ return [{ start, end }];
36173
+ });
36174
+ };
36175
+ var isBreakMinute = (minuteIndex, shiftStartMinutes, normalizedBreaks) => {
36176
+ if (!normalizedBreaks.length) return false;
36177
+ const absoluteMinute = shiftStartMinutes + minuteIndex;
36178
+ return normalizedBreaks.some((entry) => entry.start <= absoluteMinute && absoluteMinute < entry.end);
36179
+ };
36149
36180
  var getShiftDurationMinutes = (shiftStart, shiftEnd) => {
36150
36181
  const start = parseTime(shiftStart);
36151
36182
  const end = parseTime(shiftEnd);
@@ -36156,6 +36187,29 @@ var getShiftDurationMinutes = (shiftStart, shiftEnd) => {
36156
36187
  }
36157
36188
  return duration > 0 ? duration : null;
36158
36189
  };
36190
+ var getBreakExcludedShiftMinutes = ({
36191
+ shiftStart,
36192
+ shiftEnd,
36193
+ elapsedMinutes,
36194
+ shiftBreaks
36195
+ }) => {
36196
+ const shiftMinutes = getShiftDurationMinutes(shiftStart, shiftEnd);
36197
+ if (shiftMinutes === null) return null;
36198
+ const elapsedLimit = Number.isFinite(elapsedMinutes) ? Math.min(Math.max(Math.floor(elapsedMinutes ?? 0), 0), shiftMinutes) : shiftMinutes;
36199
+ if (elapsedLimit <= 0) return 0;
36200
+ const startTime = parseTime(shiftStart);
36201
+ if (!startTime) return elapsedLimit;
36202
+ const shiftStartMinutes = startTime.hour * 60 + startTime.minute;
36203
+ const normalizedBreaks = normalizeBreaksOnShiftTimeline2(shiftStart, shiftBreaks);
36204
+ if (!normalizedBreaks.length) return elapsedLimit;
36205
+ let workingMinutes = 0;
36206
+ for (let minuteIndex = 0; minuteIndex < elapsedLimit; minuteIndex += 1) {
36207
+ if (!isBreakMinute(minuteIndex, shiftStartMinutes, normalizedBreaks)) {
36208
+ workingMinutes += 1;
36209
+ }
36210
+ }
36211
+ return workingMinutes;
36212
+ };
36159
36213
  var getShiftElapsedMinutes = ({
36160
36214
  shiftStart,
36161
36215
  shiftEnd,
@@ -36220,7 +36274,8 @@ var buildUptimeSeries = ({
36220
36274
  shiftEnd,
36221
36275
  shiftDate,
36222
36276
  timezone,
36223
- elapsedMinutes
36277
+ elapsedMinutes,
36278
+ shiftBreaks
36224
36279
  }) => {
36225
36280
  const normalizedIdle = normalizeIdleTimeHourly(idleTimeHourly || {});
36226
36281
  const hasIdleData = Object.keys(normalizedIdle).length > 0;
@@ -36275,6 +36330,8 @@ var buildUptimeSeries = ({
36275
36330
  const points = [];
36276
36331
  let activeMinutes = 0;
36277
36332
  let idleMinutes = 0;
36333
+ const shiftStartMinutes = startTime.hour * 60 + startTime.minute;
36334
+ const normalizedBreaks = normalizeBreaksOnShiftTimeline2(shiftStart, shiftBreaks);
36278
36335
  for (let minuteIndex = 0; minuteIndex < shiftMinutes; minuteIndex += 1) {
36279
36336
  const minuteDate = dateFns.addMinutes(shiftStartDate, minuteIndex);
36280
36337
  const timeLabel = dateFnsTz.formatInTimeZone(minuteDate, timezone, "h:mm a");
@@ -36287,6 +36344,15 @@ var buildUptimeSeries = ({
36287
36344
  });
36288
36345
  continue;
36289
36346
  }
36347
+ if (isBreakMinute(minuteIndex, shiftStartMinutes, normalizedBreaks)) {
36348
+ points.push({
36349
+ minuteIndex,
36350
+ timeLabel,
36351
+ uptime: null,
36352
+ status: "break"
36353
+ });
36354
+ continue;
36355
+ }
36290
36356
  const hourKey = dateFnsTz.formatInTimeZone(minuteDate, timezone, "H");
36291
36357
  const minuteKey = Number.parseInt(dateFnsTz.formatInTimeZone(minuteDate, timezone, "m"), 10);
36292
36358
  const hourBucket = normalizedIdle[hourKey] || [];
@@ -39447,6 +39513,7 @@ var HourlyUptimeChartComponent = ({
39447
39513
  shiftDate,
39448
39514
  timezone,
39449
39515
  elapsedMinutes,
39516
+ shiftBreaks,
39450
39517
  className = ""
39451
39518
  }) => {
39452
39519
  const containerRef = React144__namespace.default.useRef(null);
@@ -39458,8 +39525,9 @@ var HourlyUptimeChartComponent = ({
39458
39525
  shiftEnd,
39459
39526
  shiftDate,
39460
39527
  timezone,
39461
- elapsedMinutes
39462
- }), [idleTimeHourly, shiftStart, shiftEnd, shiftDate, timezone, elapsedMinutes]);
39528
+ elapsedMinutes,
39529
+ shiftBreaks
39530
+ }), [idleTimeHourly, shiftStart, shiftEnd, shiftDate, timezone, elapsedMinutes, shiftBreaks]);
39463
39531
  const hasAggregateData = Boolean(hourlyAggregates && hourlyAggregates.length > 0);
39464
39532
  const shiftStartTime = React144__namespace.default.useMemo(
39465
39533
  () => getTimeFromTimeString(shiftStart),
@@ -51651,7 +51719,8 @@ var LineMonthlyPdfGenerator = ({
51651
51719
  };
51652
51720
  var LineWhatsAppShareButton = ({
51653
51721
  lineInfo,
51654
- className
51722
+ className,
51723
+ shiftBreaks = []
51655
51724
  }) => {
51656
51725
  const handleShare = () => {
51657
51726
  trackCoreEvent("Line WhatsApp Share Clicked", {
@@ -51665,7 +51734,8 @@ var LineWhatsAppShareButton = ({
51665
51734
  shiftStart: lineInfo.metrics.shift_start,
51666
51735
  shiftEnd: lineInfo.metrics.shift_end,
51667
51736
  shiftDate: lineInfo.date,
51668
- timezone: "Asia/Kolkata"
51737
+ timezone: "Asia/Kolkata",
51738
+ shiftBreaks
51669
51739
  }) : null;
51670
51740
  const efficiencyValue = Number.isFinite(lineInfo.metrics.avg_efficiency) ? Number(lineInfo.metrics.avg_efficiency) : null;
51671
51741
  const utilization = efficiencyValue !== null ? efficiencyValue : uptimeSeries && uptimeSeries.availableMinutes > 0 ? uptimeSeries.activeMinutes / uptimeSeries.availableMinutes * 100 : 0;
@@ -51834,16 +51904,24 @@ var LinePdfGenerator = ({
51834
51904
  shiftStart,
51835
51905
  shiftEnd,
51836
51906
  shiftDate,
51837
- timezone: effectiveUptimeTimezone
51907
+ timezone: effectiveUptimeTimezone,
51908
+ shiftBreaks
51838
51909
  });
51839
51910
  let activeMinutes = uptimeSeries.activeMinutes;
51840
51911
  let idleMinutes = uptimeSeries.idleMinutes;
51841
51912
  let availableMinutes = uptimeSeries.availableMinutes;
51842
51913
  let hasData = uptimeSeries.hasData;
51843
- if (!hasData) {
51914
+ const hasIdleHourlyPayload = Boolean(
51915
+ workspace.idle_time_hourly && typeof workspace.idle_time_hourly === "object" && Object.keys(workspace.idle_time_hourly).length > 0
51916
+ );
51917
+ if (!hasData && !hasIdleHourlyPayload) {
51844
51918
  const idleTimeValue = workspace.idle_time;
51845
51919
  const hasIdleTimeValue = Number.isFinite(idleTimeValue);
51846
- const fallbackDuration = shiftDurationMinutes;
51920
+ const fallbackDuration = getBreakExcludedShiftMinutes({
51921
+ shiftStart,
51922
+ shiftEnd,
51923
+ shiftBreaks
51924
+ }) ?? shiftDurationMinutes;
51847
51925
  if (hasIdleTimeValue && idleTimeValue > 0 && fallbackDuration > 0) {
51848
51926
  const idleFromAggregate = Math.min(Math.max(Number(idleTimeValue) / 60, 0), fallbackDuration);
51849
51927
  idleMinutes = idleFromAggregate;
@@ -51915,7 +51993,8 @@ var LinePdfGenerator = ({
51915
51993
  shiftStart: lineShiftStart,
51916
51994
  shiftEnd: lineShiftEnd,
51917
51995
  shiftDate: lineInfo.date,
51918
- timezone: effectiveUptimeTimezone
51996
+ timezone: effectiveUptimeTimezone,
51997
+ shiftBreaks
51919
51998
  });
51920
51999
  hourlyData = buildHourlyFromSeries(lineUptimeSeries);
51921
52000
  }
@@ -53854,7 +53933,8 @@ var WorkspaceMonthlyHistory = ({
53854
53933
  };
53855
53934
  var WorkspaceWhatsAppShareButton = ({
53856
53935
  workspace,
53857
- className
53936
+ className,
53937
+ shiftBreaks = []
53858
53938
  }) => {
53859
53939
  const handleShare = () => {
53860
53940
  trackCoreEvent("Workspace WhatsApp Share Clicked", {
@@ -53870,7 +53950,11 @@ var WorkspaceWhatsAppShareButton = ({
53870
53950
  timeZone: "Asia/Kolkata"
53871
53951
  });
53872
53952
  const isUptimeMode = workspace.monitoring_mode === "uptime";
53873
- const shiftMinutes = getShiftDurationMinutes(workspace.shift_start, workspace.shift_end);
53953
+ const shiftMinutes = getBreakExcludedShiftMinutes({
53954
+ shiftStart: workspace.shift_start,
53955
+ shiftEnd: workspace.shift_end,
53956
+ shiftBreaks
53957
+ }) ?? getShiftDurationMinutes(workspace.shift_start, workspace.shift_end);
53874
53958
  const shiftSeconds = shiftMinutes ? shiftMinutes * 60 : 0;
53875
53959
  const idleSeconds = Math.max(workspace.idle_time || 0, 0);
53876
53960
  const clampedIdleSeconds = shiftSeconds > 0 ? Math.min(idleSeconds, shiftSeconds) : idleSeconds;
@@ -53960,7 +54044,11 @@ var WorkspacePdfGenerator = ({
53960
54044
  try {
53961
54045
  const isUptimeMode = workspace.monitoring_mode === "uptime";
53962
54046
  const isAssemblyCycleMode = !isUptimeMode && shouldUseAssemblyCycleTimeLayout(workspace);
53963
- const shiftMinutes = getShiftDurationMinutes(workspace.shift_start, workspace.shift_end);
54047
+ const shiftMinutes = getBreakExcludedShiftMinutes({
54048
+ shiftStart: workspace.shift_start,
54049
+ shiftEnd: workspace.shift_end,
54050
+ shiftBreaks
54051
+ }) ?? getShiftDurationMinutes(workspace.shift_start, workspace.shift_end);
53964
54052
  const shiftSeconds = shiftMinutes ? shiftMinutes * 60 : 0;
53965
54053
  const idleSeconds = Math.max(workspace.idle_time || 0, 0);
53966
54054
  const clampedIdleSeconds = shiftSeconds > 0 ? Math.min(idleSeconds, shiftSeconds) : idleSeconds;
@@ -54130,7 +54218,8 @@ var WorkspacePdfGenerator = ({
54130
54218
  shiftStart: workspace.shift_start,
54131
54219
  shiftEnd: workspace.shift_end,
54132
54220
  shiftDate: workspace.date,
54133
- timezone: reportTimezone
54221
+ timezone: reportTimezone,
54222
+ shiftBreaks
54134
54223
  }) : null;
54135
54224
  const hourlyUptime = uptimeSeries?.points?.length ? Array.from({ length: Math.ceil(uptimeSeries.shiftMinutes / 60) }, (_, index) => {
54136
54225
  const start = index * 60;
@@ -67925,6 +68014,7 @@ var UptimeBottomSection = React144.memo(({
67925
68014
  shiftDate,
67926
68015
  timezone,
67927
68016
  elapsedMinutes,
68017
+ shiftBreaks,
67928
68018
  urlDate,
67929
68019
  urlShift,
67930
68020
  navigate
@@ -68012,7 +68102,8 @@ var UptimeBottomSection = React144.memo(({
68012
68102
  shiftEnd,
68013
68103
  shiftDate,
68014
68104
  timezone,
68015
- elapsedMinutes
68105
+ elapsedMinutes,
68106
+ shiftBreaks
68016
68107
  }
68017
68108
  ) })
68018
68109
  ] })
@@ -68330,7 +68421,8 @@ var KPIDetailView = ({
68330
68421
  shiftStart: resolvedShiftStart || void 0,
68331
68422
  shiftEnd: resolvedShiftEnd || void 0,
68332
68423
  shiftDate: metric.date,
68333
- timezone: configuredTimezone
68424
+ timezone: configuredTimezone,
68425
+ shiftBreaks: shiftConfig?.shifts?.find((shift) => shift.shiftId === metric.shift_id)?.breaks || []
68334
68426
  }) : null;
68335
68427
  const idleTimeSeconds = isUptimeMode ? hasBackendUptimeSeconds ? metricIdleTimeSeconds ?? 0 : (uptimeSeries2?.idleMinutes || 0) * 60 : 0;
68336
68428
  const activeTimeSeconds = isUptimeMode ? hasBackendUptimeSeconds ? metricActiveTimeSeconds ?? 0 : (uptimeSeries2?.activeMinutes || 0) * 60 : 0;
@@ -68510,6 +68602,10 @@ var KPIDetailView = ({
68510
68602
  end: chartMetrics.shift_end || fallback.end
68511
68603
  };
68512
68604
  }, [chartMetrics?.shift_start, chartMetrics?.shift_end, chartMetrics?.shift_id, resolveShiftTimes]);
68605
+ const resolvedShiftBreaks = React144.useMemo(
68606
+ () => shiftConfig?.shifts?.find((shift) => shift.shiftId === chartMetrics?.shift_id)?.breaks || [],
68607
+ [shiftConfig?.shifts, chartMetrics?.shift_id]
68608
+ );
68513
68609
  const lineSkuBreakdown = React144.useMemo(
68514
68610
  () => resolvedLineInfo?.metrics.sku_breakdown ?? [],
68515
68611
  [resolvedLineInfo]
@@ -68643,7 +68739,8 @@ var KPIDetailView = ({
68643
68739
  shiftEnd: null,
68644
68740
  shiftDate: null,
68645
68741
  timezone: configuredTimezone,
68646
- elapsedMinutes: null
68742
+ elapsedMinutes: null,
68743
+ shiftBreaks: resolvedShiftBreaks
68647
68744
  });
68648
68745
  }
68649
68746
  return buildUptimeSeries({
@@ -68652,9 +68749,10 @@ var KPIDetailView = ({
68652
68749
  shiftEnd: resolvedShiftTimes.end,
68653
68750
  shiftDate: chartMetrics.date,
68654
68751
  timezone: configuredTimezone,
68655
- elapsedMinutes: elapsedShiftMinutes
68752
+ elapsedMinutes: elapsedShiftMinutes,
68753
+ shiftBreaks: resolvedShiftBreaks
68656
68754
  });
68657
- }, [chartMetrics, resolvedShiftTimes.start, resolvedShiftTimes.end, configuredTimezone, elapsedShiftMinutes]);
68755
+ }, [chartMetrics, resolvedShiftTimes.start, resolvedShiftTimes.end, configuredTimezone, elapsedShiftMinutes, resolvedShiftBreaks]);
68658
68756
  const lineUtilizationFromLine = React144.useMemo(() => {
68659
68757
  const efficiencyValue = Number.isFinite(chartMetrics?.avg_efficiency) ? Number(chartMetrics?.avg_efficiency) : null;
68660
68758
  if (efficiencyValue !== null) return efficiencyValue;
@@ -68681,7 +68779,8 @@ var KPIDetailView = ({
68681
68779
  shiftEnd,
68682
68780
  shiftDate,
68683
68781
  timezone: configuredTimezone,
68684
- elapsedMinutes: workspaceElapsedMinutes
68782
+ elapsedMinutes: workspaceElapsedMinutes,
68783
+ shiftBreaks: resolvedShiftBreaks
68685
68784
  });
68686
68785
  let activeMinutes = uptimeSeries2.activeMinutes;
68687
68786
  let idleMinutes = uptimeSeries2.idleMinutes;
@@ -68693,7 +68792,12 @@ var KPIDetailView = ({
68693
68792
  );
68694
68793
  const idleTimeValue = workspace.idle_time;
68695
68794
  const hasIdleTimeValue = Number.isFinite(idleTimeValue);
68696
- const fallbackDuration = workspaceElapsedMinutes ?? shiftMinutes;
68795
+ const fallbackDuration = getBreakExcludedShiftMinutes({
68796
+ shiftStart,
68797
+ shiftEnd,
68798
+ elapsedMinutes: workspaceElapsedMinutes,
68799
+ shiftBreaks: resolvedShiftBreaks
68800
+ }) ?? workspaceElapsedMinutes ?? shiftMinutes;
68697
68801
  if (!hasIdleHourlyPayload && hasIdleTimeValue && idleTimeValue > 0 && fallbackDuration > 0) {
68698
68802
  const idleSeconds = Number(idleTimeValue);
68699
68803
  const idleFromAggregate = Math.min(Math.max(idleSeconds / 60, 0), fallbackDuration);
@@ -68723,7 +68827,8 @@ var KPIDetailView = ({
68723
68827
  resolvedShiftTimes.end,
68724
68828
  chartMetrics?.date,
68725
68829
  configuredTimezone,
68726
- isCurrentShiftView
68830
+ isCurrentShiftView,
68831
+ resolvedShiftBreaks
68727
68832
  ]);
68728
68833
  const lineUptimeStats = React144.useMemo(() => {
68729
68834
  if (!isUptimeMode) {
@@ -69410,6 +69515,7 @@ var KPIDetailView = ({
69410
69515
  shiftDate: chartMetrics?.date,
69411
69516
  timezone: configuredTimezone,
69412
69517
  elapsedMinutes: elapsedShiftMinutes,
69518
+ shiftBreaks: resolvedShiftBreaks,
69413
69519
  urlDate,
69414
69520
  urlShift,
69415
69521
  navigate
@@ -69524,6 +69630,7 @@ var KPIDetailView = ({
69524
69630
  shiftDate: chartMetrics?.date,
69525
69631
  timezone: configuredTimezone,
69526
69632
  elapsedMinutes: elapsedShiftMinutes,
69633
+ shiftBreaks: resolvedShiftBreaks,
69527
69634
  urlDate,
69528
69635
  urlShift,
69529
69636
  navigate
@@ -77009,6 +77116,10 @@ var WorkspaceDetailView = ({
77009
77116
  timezone
77010
77117
  });
77011
77118
  }, [isCurrentShiftView, workspace?.shift_start, workspace?.shift_end, idleClipDate, timezone]);
77119
+ const workspaceShiftBreaks = React144.useMemo(
77120
+ () => shiftConfig?.shifts?.find((shift2) => shift2.shiftId === workspace?.shift_id)?.breaks || [],
77121
+ [shiftConfig?.shifts, workspace?.shift_id]
77122
+ );
77012
77123
  const uptimeSeries = React144.useMemo(
77013
77124
  () => buildUptimeSeries({
77014
77125
  idleTimeHourly: workspace?.idle_time_hourly,
@@ -77016,17 +77127,26 @@ var WorkspaceDetailView = ({
77016
77127
  shiftEnd: workspace?.shift_end,
77017
77128
  shiftDate: idleClipDate,
77018
77129
  timezone,
77019
- elapsedMinutes: elapsedShiftMinutes
77130
+ elapsedMinutes: elapsedShiftMinutes,
77131
+ shiftBreaks: workspaceShiftBreaks
77020
77132
  }),
77021
- [workspace?.idle_time_hourly, workspace?.shift_start, workspace?.shift_end, idleClipDate, timezone, elapsedShiftMinutes]
77133
+ [workspace?.idle_time_hourly, workspace?.shift_start, workspace?.shift_end, idleClipDate, timezone, elapsedShiftMinutes, workspaceShiftBreaks]
77022
77134
  );
77023
77135
  const uptimePieData = React144.useMemo(() => {
77024
77136
  if (!isUptimeMode) return [];
77025
77137
  let activeMinutes = uptimeSeries.activeMinutes;
77026
77138
  let idleMinutes = uptimeSeries.idleMinutes;
77027
77139
  let totalMinutes = uptimeSeries.availableMinutes;
77028
- const fallbackDuration = elapsedShiftMinutes ?? shiftDurationMinutes;
77029
- if (!uptimeSeries.hasData && fallbackDuration !== null && fallbackDuration !== void 0) {
77140
+ const fallbackDuration = getBreakExcludedShiftMinutes({
77141
+ shiftStart: workspace?.shift_start,
77142
+ shiftEnd: workspace?.shift_end,
77143
+ elapsedMinutes: elapsedShiftMinutes,
77144
+ shiftBreaks: workspaceShiftBreaks
77145
+ }) ?? elapsedShiftMinutes ?? shiftDurationMinutes;
77146
+ const hasIdleHourlyPayload = Boolean(
77147
+ workspace?.idle_time_hourly && typeof workspace.idle_time_hourly === "object" && Object.keys(workspace.idle_time_hourly).length > 0
77148
+ );
77149
+ if (!uptimeSeries.hasData && !hasIdleHourlyPayload && fallbackDuration !== null && fallbackDuration !== void 0) {
77030
77150
  const idleSeconds = Number(workspace?.idle_time || 0);
77031
77151
  const idleFromAggregate = Math.min(Math.max(Math.round(idleSeconds / 60), 0), fallbackDuration);
77032
77152
  const activeFromAggregate = Math.max(fallbackDuration - idleFromAggregate, 0);
@@ -77039,7 +77159,7 @@ var WorkspaceDetailView = ({
77039
77159
  { name: "Productive", value: activeMinutes },
77040
77160
  { name: "Idle", value: idleMinutes }
77041
77161
  ];
77042
- }, [isUptimeMode, uptimeSeries, shiftDurationMinutes, elapsedShiftMinutes, workspace?.idle_time]);
77162
+ }, [isUptimeMode, uptimeSeries, shiftDurationMinutes, elapsedShiftMinutes, workspace?.idle_time, workspace?.shift_start, workspace?.shift_end, workspaceShiftBreaks]);
77043
77163
  const overviewTabLabel = isUptimeMode ? "Utilization" : "Efficiency";
77044
77164
  const idleClipFetchEnabled = Boolean(
77045
77165
  workspaceId && idleClipDate && idleClipShiftId !== void 0 && activeTab === "overview" && idleTimeVlmEnabled && isOutputLayout
@@ -77518,7 +77638,8 @@ var WorkspaceDetailView = ({
77518
77638
  shiftEnd: workspace.shift_end,
77519
77639
  shiftDate: idleClipDate,
77520
77640
  timezone,
77521
- elapsedMinutes: elapsedShiftMinutes
77641
+ elapsedMinutes: elapsedShiftMinutes,
77642
+ shiftBreaks: workspaceShiftBreaks
77522
77643
  }
77523
77644
  ) : isAssemblyCycleLayout ? shouldShowCycleTimeUnavailableState ? cycleTimeUnavailableView : shouldShowCycleTimeChart ? /* @__PURE__ */ jsxRuntime.jsx(
77524
77645
  CycleTimeOverTimeChart,
@@ -77671,7 +77792,8 @@ var WorkspaceDetailView = ({
77671
77792
  shiftEnd: workspace.shift_end,
77672
77793
  shiftDate: idleClipDate,
77673
77794
  timezone,
77674
- elapsedMinutes: elapsedShiftMinutes
77795
+ elapsedMinutes: elapsedShiftMinutes,
77796
+ shiftBreaks: workspaceShiftBreaks
77675
77797
  }
77676
77798
  ) : isAssemblyCycleLayout ? shouldShowCycleTimeUnavailableState ? cycleTimeUnavailableView : shouldShowCycleTimeChart ? /* @__PURE__ */ jsxRuntime.jsx(
77677
77799
  CycleTimeOverTimeChart,
package/dist/index.mjs CHANGED
@@ -36117,6 +36117,37 @@ var interpretIdleValue = (value) => {
36117
36117
  if (value === "x" || value === null || value === void 0) return "unknown";
36118
36118
  return "unknown";
36119
36119
  };
36120
+ var timeToMinutes = (value) => {
36121
+ const parsed = parseTime(value);
36122
+ if (!parsed) return null;
36123
+ return parsed.hour * 60 + parsed.minute;
36124
+ };
36125
+ var normalizeBreaksOnShiftTimeline2 = (shiftStart, shiftBreaks) => {
36126
+ const shiftStartMinutes = timeToMinutes(shiftStart);
36127
+ if (shiftStartMinutes === null || !Array.isArray(shiftBreaks)) {
36128
+ return [];
36129
+ }
36130
+ return shiftBreaks.flatMap((entry) => {
36131
+ const startRaw = timeToMinutes(entry?.startTime ?? entry?.start);
36132
+ const endRaw = timeToMinutes(entry?.endTime ?? entry?.end);
36133
+ if (startRaw === null || endRaw === null) return [];
36134
+ let start = startRaw;
36135
+ let end = endRaw;
36136
+ if (end <= start) {
36137
+ end += 24 * 60;
36138
+ }
36139
+ if (start < shiftStartMinutes) {
36140
+ start += 24 * 60;
36141
+ end += 24 * 60;
36142
+ }
36143
+ return [{ start, end }];
36144
+ });
36145
+ };
36146
+ var isBreakMinute = (minuteIndex, shiftStartMinutes, normalizedBreaks) => {
36147
+ if (!normalizedBreaks.length) return false;
36148
+ const absoluteMinute = shiftStartMinutes + minuteIndex;
36149
+ return normalizedBreaks.some((entry) => entry.start <= absoluteMinute && absoluteMinute < entry.end);
36150
+ };
36120
36151
  var getShiftDurationMinutes = (shiftStart, shiftEnd) => {
36121
36152
  const start = parseTime(shiftStart);
36122
36153
  const end = parseTime(shiftEnd);
@@ -36127,6 +36158,29 @@ var getShiftDurationMinutes = (shiftStart, shiftEnd) => {
36127
36158
  }
36128
36159
  return duration > 0 ? duration : null;
36129
36160
  };
36161
+ var getBreakExcludedShiftMinutes = ({
36162
+ shiftStart,
36163
+ shiftEnd,
36164
+ elapsedMinutes,
36165
+ shiftBreaks
36166
+ }) => {
36167
+ const shiftMinutes = getShiftDurationMinutes(shiftStart, shiftEnd);
36168
+ if (shiftMinutes === null) return null;
36169
+ const elapsedLimit = Number.isFinite(elapsedMinutes) ? Math.min(Math.max(Math.floor(elapsedMinutes ?? 0), 0), shiftMinutes) : shiftMinutes;
36170
+ if (elapsedLimit <= 0) return 0;
36171
+ const startTime = parseTime(shiftStart);
36172
+ if (!startTime) return elapsedLimit;
36173
+ const shiftStartMinutes = startTime.hour * 60 + startTime.minute;
36174
+ const normalizedBreaks = normalizeBreaksOnShiftTimeline2(shiftStart, shiftBreaks);
36175
+ if (!normalizedBreaks.length) return elapsedLimit;
36176
+ let workingMinutes = 0;
36177
+ for (let minuteIndex = 0; minuteIndex < elapsedLimit; minuteIndex += 1) {
36178
+ if (!isBreakMinute(minuteIndex, shiftStartMinutes, normalizedBreaks)) {
36179
+ workingMinutes += 1;
36180
+ }
36181
+ }
36182
+ return workingMinutes;
36183
+ };
36130
36184
  var getShiftElapsedMinutes = ({
36131
36185
  shiftStart,
36132
36186
  shiftEnd,
@@ -36191,7 +36245,8 @@ var buildUptimeSeries = ({
36191
36245
  shiftEnd,
36192
36246
  shiftDate,
36193
36247
  timezone,
36194
- elapsedMinutes
36248
+ elapsedMinutes,
36249
+ shiftBreaks
36195
36250
  }) => {
36196
36251
  const normalizedIdle = normalizeIdleTimeHourly(idleTimeHourly || {});
36197
36252
  const hasIdleData = Object.keys(normalizedIdle).length > 0;
@@ -36246,6 +36301,8 @@ var buildUptimeSeries = ({
36246
36301
  const points = [];
36247
36302
  let activeMinutes = 0;
36248
36303
  let idleMinutes = 0;
36304
+ const shiftStartMinutes = startTime.hour * 60 + startTime.minute;
36305
+ const normalizedBreaks = normalizeBreaksOnShiftTimeline2(shiftStart, shiftBreaks);
36249
36306
  for (let minuteIndex = 0; minuteIndex < shiftMinutes; minuteIndex += 1) {
36250
36307
  const minuteDate = addMinutes(shiftStartDate, minuteIndex);
36251
36308
  const timeLabel = formatInTimeZone(minuteDate, timezone, "h:mm a");
@@ -36258,6 +36315,15 @@ var buildUptimeSeries = ({
36258
36315
  });
36259
36316
  continue;
36260
36317
  }
36318
+ if (isBreakMinute(minuteIndex, shiftStartMinutes, normalizedBreaks)) {
36319
+ points.push({
36320
+ minuteIndex,
36321
+ timeLabel,
36322
+ uptime: null,
36323
+ status: "break"
36324
+ });
36325
+ continue;
36326
+ }
36261
36327
  const hourKey = formatInTimeZone(minuteDate, timezone, "H");
36262
36328
  const minuteKey = Number.parseInt(formatInTimeZone(minuteDate, timezone, "m"), 10);
36263
36329
  const hourBucket = normalizedIdle[hourKey] || [];
@@ -39418,6 +39484,7 @@ var HourlyUptimeChartComponent = ({
39418
39484
  shiftDate,
39419
39485
  timezone,
39420
39486
  elapsedMinutes,
39487
+ shiftBreaks,
39421
39488
  className = ""
39422
39489
  }) => {
39423
39490
  const containerRef = React144__default.useRef(null);
@@ -39429,8 +39496,9 @@ var HourlyUptimeChartComponent = ({
39429
39496
  shiftEnd,
39430
39497
  shiftDate,
39431
39498
  timezone,
39432
- elapsedMinutes
39433
- }), [idleTimeHourly, shiftStart, shiftEnd, shiftDate, timezone, elapsedMinutes]);
39499
+ elapsedMinutes,
39500
+ shiftBreaks
39501
+ }), [idleTimeHourly, shiftStart, shiftEnd, shiftDate, timezone, elapsedMinutes, shiftBreaks]);
39434
39502
  const hasAggregateData = Boolean(hourlyAggregates && hourlyAggregates.length > 0);
39435
39503
  const shiftStartTime = React144__default.useMemo(
39436
39504
  () => getTimeFromTimeString(shiftStart),
@@ -51622,7 +51690,8 @@ var LineMonthlyPdfGenerator = ({
51622
51690
  };
51623
51691
  var LineWhatsAppShareButton = ({
51624
51692
  lineInfo,
51625
- className
51693
+ className,
51694
+ shiftBreaks = []
51626
51695
  }) => {
51627
51696
  const handleShare = () => {
51628
51697
  trackCoreEvent("Line WhatsApp Share Clicked", {
@@ -51636,7 +51705,8 @@ var LineWhatsAppShareButton = ({
51636
51705
  shiftStart: lineInfo.metrics.shift_start,
51637
51706
  shiftEnd: lineInfo.metrics.shift_end,
51638
51707
  shiftDate: lineInfo.date,
51639
- timezone: "Asia/Kolkata"
51708
+ timezone: "Asia/Kolkata",
51709
+ shiftBreaks
51640
51710
  }) : null;
51641
51711
  const efficiencyValue = Number.isFinite(lineInfo.metrics.avg_efficiency) ? Number(lineInfo.metrics.avg_efficiency) : null;
51642
51712
  const utilization = efficiencyValue !== null ? efficiencyValue : uptimeSeries && uptimeSeries.availableMinutes > 0 ? uptimeSeries.activeMinutes / uptimeSeries.availableMinutes * 100 : 0;
@@ -51805,16 +51875,24 @@ var LinePdfGenerator = ({
51805
51875
  shiftStart,
51806
51876
  shiftEnd,
51807
51877
  shiftDate,
51808
- timezone: effectiveUptimeTimezone
51878
+ timezone: effectiveUptimeTimezone,
51879
+ shiftBreaks
51809
51880
  });
51810
51881
  let activeMinutes = uptimeSeries.activeMinutes;
51811
51882
  let idleMinutes = uptimeSeries.idleMinutes;
51812
51883
  let availableMinutes = uptimeSeries.availableMinutes;
51813
51884
  let hasData = uptimeSeries.hasData;
51814
- if (!hasData) {
51885
+ const hasIdleHourlyPayload = Boolean(
51886
+ workspace.idle_time_hourly && typeof workspace.idle_time_hourly === "object" && Object.keys(workspace.idle_time_hourly).length > 0
51887
+ );
51888
+ if (!hasData && !hasIdleHourlyPayload) {
51815
51889
  const idleTimeValue = workspace.idle_time;
51816
51890
  const hasIdleTimeValue = Number.isFinite(idleTimeValue);
51817
- const fallbackDuration = shiftDurationMinutes;
51891
+ const fallbackDuration = getBreakExcludedShiftMinutes({
51892
+ shiftStart,
51893
+ shiftEnd,
51894
+ shiftBreaks
51895
+ }) ?? shiftDurationMinutes;
51818
51896
  if (hasIdleTimeValue && idleTimeValue > 0 && fallbackDuration > 0) {
51819
51897
  const idleFromAggregate = Math.min(Math.max(Number(idleTimeValue) / 60, 0), fallbackDuration);
51820
51898
  idleMinutes = idleFromAggregate;
@@ -51886,7 +51964,8 @@ var LinePdfGenerator = ({
51886
51964
  shiftStart: lineShiftStart,
51887
51965
  shiftEnd: lineShiftEnd,
51888
51966
  shiftDate: lineInfo.date,
51889
- timezone: effectiveUptimeTimezone
51967
+ timezone: effectiveUptimeTimezone,
51968
+ shiftBreaks
51890
51969
  });
51891
51970
  hourlyData = buildHourlyFromSeries(lineUptimeSeries);
51892
51971
  }
@@ -53825,7 +53904,8 @@ var WorkspaceMonthlyHistory = ({
53825
53904
  };
53826
53905
  var WorkspaceWhatsAppShareButton = ({
53827
53906
  workspace,
53828
- className
53907
+ className,
53908
+ shiftBreaks = []
53829
53909
  }) => {
53830
53910
  const handleShare = () => {
53831
53911
  trackCoreEvent("Workspace WhatsApp Share Clicked", {
@@ -53841,7 +53921,11 @@ var WorkspaceWhatsAppShareButton = ({
53841
53921
  timeZone: "Asia/Kolkata"
53842
53922
  });
53843
53923
  const isUptimeMode = workspace.monitoring_mode === "uptime";
53844
- const shiftMinutes = getShiftDurationMinutes(workspace.shift_start, workspace.shift_end);
53924
+ const shiftMinutes = getBreakExcludedShiftMinutes({
53925
+ shiftStart: workspace.shift_start,
53926
+ shiftEnd: workspace.shift_end,
53927
+ shiftBreaks
53928
+ }) ?? getShiftDurationMinutes(workspace.shift_start, workspace.shift_end);
53845
53929
  const shiftSeconds = shiftMinutes ? shiftMinutes * 60 : 0;
53846
53930
  const idleSeconds = Math.max(workspace.idle_time || 0, 0);
53847
53931
  const clampedIdleSeconds = shiftSeconds > 0 ? Math.min(idleSeconds, shiftSeconds) : idleSeconds;
@@ -53931,7 +54015,11 @@ var WorkspacePdfGenerator = ({
53931
54015
  try {
53932
54016
  const isUptimeMode = workspace.monitoring_mode === "uptime";
53933
54017
  const isAssemblyCycleMode = !isUptimeMode && shouldUseAssemblyCycleTimeLayout(workspace);
53934
- const shiftMinutes = getShiftDurationMinutes(workspace.shift_start, workspace.shift_end);
54018
+ const shiftMinutes = getBreakExcludedShiftMinutes({
54019
+ shiftStart: workspace.shift_start,
54020
+ shiftEnd: workspace.shift_end,
54021
+ shiftBreaks
54022
+ }) ?? getShiftDurationMinutes(workspace.shift_start, workspace.shift_end);
53935
54023
  const shiftSeconds = shiftMinutes ? shiftMinutes * 60 : 0;
53936
54024
  const idleSeconds = Math.max(workspace.idle_time || 0, 0);
53937
54025
  const clampedIdleSeconds = shiftSeconds > 0 ? Math.min(idleSeconds, shiftSeconds) : idleSeconds;
@@ -54101,7 +54189,8 @@ var WorkspacePdfGenerator = ({
54101
54189
  shiftStart: workspace.shift_start,
54102
54190
  shiftEnd: workspace.shift_end,
54103
54191
  shiftDate: workspace.date,
54104
- timezone: reportTimezone
54192
+ timezone: reportTimezone,
54193
+ shiftBreaks
54105
54194
  }) : null;
54106
54195
  const hourlyUptime = uptimeSeries?.points?.length ? Array.from({ length: Math.ceil(uptimeSeries.shiftMinutes / 60) }, (_, index) => {
54107
54196
  const start = index * 60;
@@ -67896,6 +67985,7 @@ var UptimeBottomSection = memo$1(({
67896
67985
  shiftDate,
67897
67986
  timezone,
67898
67987
  elapsedMinutes,
67988
+ shiftBreaks,
67899
67989
  urlDate,
67900
67990
  urlShift,
67901
67991
  navigate
@@ -67983,7 +68073,8 @@ var UptimeBottomSection = memo$1(({
67983
68073
  shiftEnd,
67984
68074
  shiftDate,
67985
68075
  timezone,
67986
- elapsedMinutes
68076
+ elapsedMinutes,
68077
+ shiftBreaks
67987
68078
  }
67988
68079
  ) })
67989
68080
  ] })
@@ -68301,7 +68392,8 @@ var KPIDetailView = ({
68301
68392
  shiftStart: resolvedShiftStart || void 0,
68302
68393
  shiftEnd: resolvedShiftEnd || void 0,
68303
68394
  shiftDate: metric.date,
68304
- timezone: configuredTimezone
68395
+ timezone: configuredTimezone,
68396
+ shiftBreaks: shiftConfig?.shifts?.find((shift) => shift.shiftId === metric.shift_id)?.breaks || []
68305
68397
  }) : null;
68306
68398
  const idleTimeSeconds = isUptimeMode ? hasBackendUptimeSeconds ? metricIdleTimeSeconds ?? 0 : (uptimeSeries2?.idleMinutes || 0) * 60 : 0;
68307
68399
  const activeTimeSeconds = isUptimeMode ? hasBackendUptimeSeconds ? metricActiveTimeSeconds ?? 0 : (uptimeSeries2?.activeMinutes || 0) * 60 : 0;
@@ -68481,6 +68573,10 @@ var KPIDetailView = ({
68481
68573
  end: chartMetrics.shift_end || fallback.end
68482
68574
  };
68483
68575
  }, [chartMetrics?.shift_start, chartMetrics?.shift_end, chartMetrics?.shift_id, resolveShiftTimes]);
68576
+ const resolvedShiftBreaks = useMemo(
68577
+ () => shiftConfig?.shifts?.find((shift) => shift.shiftId === chartMetrics?.shift_id)?.breaks || [],
68578
+ [shiftConfig?.shifts, chartMetrics?.shift_id]
68579
+ );
68484
68580
  const lineSkuBreakdown = useMemo(
68485
68581
  () => resolvedLineInfo?.metrics.sku_breakdown ?? [],
68486
68582
  [resolvedLineInfo]
@@ -68614,7 +68710,8 @@ var KPIDetailView = ({
68614
68710
  shiftEnd: null,
68615
68711
  shiftDate: null,
68616
68712
  timezone: configuredTimezone,
68617
- elapsedMinutes: null
68713
+ elapsedMinutes: null,
68714
+ shiftBreaks: resolvedShiftBreaks
68618
68715
  });
68619
68716
  }
68620
68717
  return buildUptimeSeries({
@@ -68623,9 +68720,10 @@ var KPIDetailView = ({
68623
68720
  shiftEnd: resolvedShiftTimes.end,
68624
68721
  shiftDate: chartMetrics.date,
68625
68722
  timezone: configuredTimezone,
68626
- elapsedMinutes: elapsedShiftMinutes
68723
+ elapsedMinutes: elapsedShiftMinutes,
68724
+ shiftBreaks: resolvedShiftBreaks
68627
68725
  });
68628
- }, [chartMetrics, resolvedShiftTimes.start, resolvedShiftTimes.end, configuredTimezone, elapsedShiftMinutes]);
68726
+ }, [chartMetrics, resolvedShiftTimes.start, resolvedShiftTimes.end, configuredTimezone, elapsedShiftMinutes, resolvedShiftBreaks]);
68629
68727
  const lineUtilizationFromLine = useMemo(() => {
68630
68728
  const efficiencyValue = Number.isFinite(chartMetrics?.avg_efficiency) ? Number(chartMetrics?.avg_efficiency) : null;
68631
68729
  if (efficiencyValue !== null) return efficiencyValue;
@@ -68652,7 +68750,8 @@ var KPIDetailView = ({
68652
68750
  shiftEnd,
68653
68751
  shiftDate,
68654
68752
  timezone: configuredTimezone,
68655
- elapsedMinutes: workspaceElapsedMinutes
68753
+ elapsedMinutes: workspaceElapsedMinutes,
68754
+ shiftBreaks: resolvedShiftBreaks
68656
68755
  });
68657
68756
  let activeMinutes = uptimeSeries2.activeMinutes;
68658
68757
  let idleMinutes = uptimeSeries2.idleMinutes;
@@ -68664,7 +68763,12 @@ var KPIDetailView = ({
68664
68763
  );
68665
68764
  const idleTimeValue = workspace.idle_time;
68666
68765
  const hasIdleTimeValue = Number.isFinite(idleTimeValue);
68667
- const fallbackDuration = workspaceElapsedMinutes ?? shiftMinutes;
68766
+ const fallbackDuration = getBreakExcludedShiftMinutes({
68767
+ shiftStart,
68768
+ shiftEnd,
68769
+ elapsedMinutes: workspaceElapsedMinutes,
68770
+ shiftBreaks: resolvedShiftBreaks
68771
+ }) ?? workspaceElapsedMinutes ?? shiftMinutes;
68668
68772
  if (!hasIdleHourlyPayload && hasIdleTimeValue && idleTimeValue > 0 && fallbackDuration > 0) {
68669
68773
  const idleSeconds = Number(idleTimeValue);
68670
68774
  const idleFromAggregate = Math.min(Math.max(idleSeconds / 60, 0), fallbackDuration);
@@ -68694,7 +68798,8 @@ var KPIDetailView = ({
68694
68798
  resolvedShiftTimes.end,
68695
68799
  chartMetrics?.date,
68696
68800
  configuredTimezone,
68697
- isCurrentShiftView
68801
+ isCurrentShiftView,
68802
+ resolvedShiftBreaks
68698
68803
  ]);
68699
68804
  const lineUptimeStats = useMemo(() => {
68700
68805
  if (!isUptimeMode) {
@@ -69381,6 +69486,7 @@ var KPIDetailView = ({
69381
69486
  shiftDate: chartMetrics?.date,
69382
69487
  timezone: configuredTimezone,
69383
69488
  elapsedMinutes: elapsedShiftMinutes,
69489
+ shiftBreaks: resolvedShiftBreaks,
69384
69490
  urlDate,
69385
69491
  urlShift,
69386
69492
  navigate
@@ -69495,6 +69601,7 @@ var KPIDetailView = ({
69495
69601
  shiftDate: chartMetrics?.date,
69496
69602
  timezone: configuredTimezone,
69497
69603
  elapsedMinutes: elapsedShiftMinutes,
69604
+ shiftBreaks: resolvedShiftBreaks,
69498
69605
  urlDate,
69499
69606
  urlShift,
69500
69607
  navigate
@@ -76980,6 +77087,10 @@ var WorkspaceDetailView = ({
76980
77087
  timezone
76981
77088
  });
76982
77089
  }, [isCurrentShiftView, workspace?.shift_start, workspace?.shift_end, idleClipDate, timezone]);
77090
+ const workspaceShiftBreaks = useMemo(
77091
+ () => shiftConfig?.shifts?.find((shift2) => shift2.shiftId === workspace?.shift_id)?.breaks || [],
77092
+ [shiftConfig?.shifts, workspace?.shift_id]
77093
+ );
76983
77094
  const uptimeSeries = useMemo(
76984
77095
  () => buildUptimeSeries({
76985
77096
  idleTimeHourly: workspace?.idle_time_hourly,
@@ -76987,17 +77098,26 @@ var WorkspaceDetailView = ({
76987
77098
  shiftEnd: workspace?.shift_end,
76988
77099
  shiftDate: idleClipDate,
76989
77100
  timezone,
76990
- elapsedMinutes: elapsedShiftMinutes
77101
+ elapsedMinutes: elapsedShiftMinutes,
77102
+ shiftBreaks: workspaceShiftBreaks
76991
77103
  }),
76992
- [workspace?.idle_time_hourly, workspace?.shift_start, workspace?.shift_end, idleClipDate, timezone, elapsedShiftMinutes]
77104
+ [workspace?.idle_time_hourly, workspace?.shift_start, workspace?.shift_end, idleClipDate, timezone, elapsedShiftMinutes, workspaceShiftBreaks]
76993
77105
  );
76994
77106
  const uptimePieData = useMemo(() => {
76995
77107
  if (!isUptimeMode) return [];
76996
77108
  let activeMinutes = uptimeSeries.activeMinutes;
76997
77109
  let idleMinutes = uptimeSeries.idleMinutes;
76998
77110
  let totalMinutes = uptimeSeries.availableMinutes;
76999
- const fallbackDuration = elapsedShiftMinutes ?? shiftDurationMinutes;
77000
- if (!uptimeSeries.hasData && fallbackDuration !== null && fallbackDuration !== void 0) {
77111
+ const fallbackDuration = getBreakExcludedShiftMinutes({
77112
+ shiftStart: workspace?.shift_start,
77113
+ shiftEnd: workspace?.shift_end,
77114
+ elapsedMinutes: elapsedShiftMinutes,
77115
+ shiftBreaks: workspaceShiftBreaks
77116
+ }) ?? elapsedShiftMinutes ?? shiftDurationMinutes;
77117
+ const hasIdleHourlyPayload = Boolean(
77118
+ workspace?.idle_time_hourly && typeof workspace.idle_time_hourly === "object" && Object.keys(workspace.idle_time_hourly).length > 0
77119
+ );
77120
+ if (!uptimeSeries.hasData && !hasIdleHourlyPayload && fallbackDuration !== null && fallbackDuration !== void 0) {
77001
77121
  const idleSeconds = Number(workspace?.idle_time || 0);
77002
77122
  const idleFromAggregate = Math.min(Math.max(Math.round(idleSeconds / 60), 0), fallbackDuration);
77003
77123
  const activeFromAggregate = Math.max(fallbackDuration - idleFromAggregate, 0);
@@ -77010,7 +77130,7 @@ var WorkspaceDetailView = ({
77010
77130
  { name: "Productive", value: activeMinutes },
77011
77131
  { name: "Idle", value: idleMinutes }
77012
77132
  ];
77013
- }, [isUptimeMode, uptimeSeries, shiftDurationMinutes, elapsedShiftMinutes, workspace?.idle_time]);
77133
+ }, [isUptimeMode, uptimeSeries, shiftDurationMinutes, elapsedShiftMinutes, workspace?.idle_time, workspace?.shift_start, workspace?.shift_end, workspaceShiftBreaks]);
77014
77134
  const overviewTabLabel = isUptimeMode ? "Utilization" : "Efficiency";
77015
77135
  const idleClipFetchEnabled = Boolean(
77016
77136
  workspaceId && idleClipDate && idleClipShiftId !== void 0 && activeTab === "overview" && idleTimeVlmEnabled && isOutputLayout
@@ -77489,7 +77609,8 @@ var WorkspaceDetailView = ({
77489
77609
  shiftEnd: workspace.shift_end,
77490
77610
  shiftDate: idleClipDate,
77491
77611
  timezone,
77492
- elapsedMinutes: elapsedShiftMinutes
77612
+ elapsedMinutes: elapsedShiftMinutes,
77613
+ shiftBreaks: workspaceShiftBreaks
77493
77614
  }
77494
77615
  ) : isAssemblyCycleLayout ? shouldShowCycleTimeUnavailableState ? cycleTimeUnavailableView : shouldShowCycleTimeChart ? /* @__PURE__ */ jsx(
77495
77616
  CycleTimeOverTimeChart,
@@ -77642,7 +77763,8 @@ var WorkspaceDetailView = ({
77642
77763
  shiftEnd: workspace.shift_end,
77643
77764
  shiftDate: idleClipDate,
77644
77765
  timezone,
77645
- elapsedMinutes: elapsedShiftMinutes
77766
+ elapsedMinutes: elapsedShiftMinutes,
77767
+ shiftBreaks: workspaceShiftBreaks
77646
77768
  }
77647
77769
  ) : isAssemblyCycleLayout ? shouldShowCycleTimeUnavailableState ? cycleTimeUnavailableView : shouldShowCycleTimeChart ? /* @__PURE__ */ jsx(
77648
77770
  CycleTimeOverTimeChart,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optifye/dashboard-core",
3
- "version": "6.12.25",
3
+ "version": "6.12.26",
4
4
  "description": "Reusable UI & logic for Optifye dashboard",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",