@optifye/dashboard-core 6.11.11 → 6.11.12

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
@@ -8266,6 +8266,7 @@ interface VideoCardProps {
8266
8266
  useRAF?: boolean;
8267
8267
  className?: string;
8268
8268
  compact?: boolean;
8269
+ displayMinuteBucket?: number;
8269
8270
  displayName?: string;
8270
8271
  lastSeenLabel?: string;
8271
8272
  onMouseEnter?: () => void;
package/dist/index.d.ts CHANGED
@@ -8266,6 +8266,7 @@ interface VideoCardProps {
8266
8266
  useRAF?: boolean;
8267
8267
  className?: string;
8268
8268
  compact?: boolean;
8269
+ displayMinuteBucket?: number;
8269
8270
  displayName?: string;
8270
8271
  lastSeenLabel?: string;
8271
8272
  onMouseEnter?: () => void;
package/dist/index.js CHANGED
@@ -33563,8 +33563,47 @@ var getVideoGridMetricValue = (workspace) => {
33563
33563
  return workspace.efficiency;
33564
33564
  };
33565
33565
  var hasIncomingWipMapping = (workspace) => Boolean(workspace.incoming_wip_buffer_name);
33566
+ var getVideoGridBaseColorState = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => getEfficiencyColor(getVideoGridMetricValue(workspace), legend);
33567
+ var isLowWipGreenOverride = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => {
33568
+ if (!hasAssemblyRecentFlow(workspace)) {
33569
+ return false;
33570
+ }
33571
+ if (getVideoGridBaseColorState(workspace, legend) !== "red") {
33572
+ return false;
33573
+ }
33574
+ if (!hasIncomingWipMapping(workspace)) {
33575
+ return false;
33576
+ }
33577
+ return isFiniteNumber2(workspace.incoming_wip_current) && workspace.incoming_wip_current <= 1;
33578
+ };
33579
+ var toMinuteBucket = (minuteBucket) => Number.isFinite(minuteBucket) ? Math.floor(minuteBucket) : Math.floor(Date.now() / 6e4);
33580
+ var getEffectiveFlowMinuteBucket = (workspace) => {
33581
+ const effectiveAt = workspace.recent_flow_effective_end_at;
33582
+ if (!effectiveAt) {
33583
+ return void 0;
33584
+ }
33585
+ const timestamp = Date.parse(effectiveAt);
33586
+ if (!Number.isFinite(timestamp)) {
33587
+ return void 0;
33588
+ }
33589
+ return Math.floor(timestamp / 6e4);
33590
+ };
33591
+ var hashWorkspaceKey = (workspace) => {
33592
+ const workspaceKey = workspace.workspace_uuid || workspace.workspace_name || "unknown";
33593
+ let hash = 0;
33594
+ for (let index = 0; index < workspaceKey.length; index += 1) {
33595
+ hash = (hash * 31 + workspaceKey.charCodeAt(index)) % 2147483647;
33596
+ }
33597
+ return hash;
33598
+ };
33599
+ var getSyntheticLowWipDisplayValue = (workspace, minuteBucket) => {
33600
+ const bucket = getEffectiveFlowMinuteBucket(workspace) ?? toMinuteBucket(minuteBucket);
33601
+ const offset = (hashWorkspaceKey(workspace) % 11 + bucket % 11 + 11) % 11;
33602
+ return 100 + offset;
33603
+ };
33604
+ var getVideoGridDisplayValue = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND, minuteBucket) => isLowWipGreenOverride(workspace, legend) ? getSyntheticLowWipDisplayValue(workspace, minuteBucket) : getVideoGridMetricValue(workspace);
33566
33605
  var getVideoGridColorState = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => {
33567
- const baseColor = getEfficiencyColor(getVideoGridMetricValue(workspace), legend);
33606
+ const baseColor = getVideoGridBaseColorState(workspace, legend);
33568
33607
  if (!hasAssemblyRecentFlow(workspace)) {
33569
33608
  return baseColor;
33570
33609
  }
@@ -33577,7 +33616,7 @@ var getVideoGridColorState = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) =>
33577
33616
  if (!isFiniteNumber2(workspace.incoming_wip_current)) {
33578
33617
  return "neutral";
33579
33618
  }
33580
- if (workspace.incoming_wip_current <= 1) {
33619
+ if (isLowWipGreenOverride(workspace, legend)) {
33581
33620
  return "green";
33582
33621
  }
33583
33622
  return baseColor;
@@ -33618,6 +33657,7 @@ var VideoCard = React141__namespace.default.memo(({
33618
33657
  useRAF = true,
33619
33658
  className = "",
33620
33659
  compact = false,
33660
+ displayMinuteBucket,
33621
33661
  displayName,
33622
33662
  lastSeenLabel,
33623
33663
  onMouseEnter,
@@ -33638,8 +33678,9 @@ var VideoCard = React141__namespace.default.memo(({
33638
33678
  const lastSeenText = lastSeenLabel || "Unknown";
33639
33679
  const workspaceDisplayName = displayName || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
33640
33680
  const videoGridMetricValue = getVideoGridMetricValue(workspace);
33681
+ const videoGridDisplayValue = getVideoGridDisplayValue(workspace, effectiveLegend, displayMinuteBucket);
33641
33682
  const videoGridColorState = getVideoGridColorState(workspace, effectiveLegend);
33642
- const badgeTitle = hasAssemblyRecentFlow(workspace) ? `Flow ${Math.round(videoGridMetricValue)}%` : `Efficiency ${Math.round(videoGridMetricValue)}%`;
33683
+ const badgeTitle = hasAssemblyRecentFlow(workspace) ? `Flow ${Math.round(videoGridDisplayValue)}%` : `Efficiency ${Math.round(videoGridDisplayValue)}%`;
33643
33684
  const efficiencyOverlayClass = videoGridColorState === "green" ? "bg-[#00D654]/25" : videoGridColorState === "yellow" ? "bg-[#FFD700]/30" : videoGridColorState === "red" ? "bg-[#FF2D0A]/30" : "bg-transparent";
33644
33685
  const efficiencyBarClass = videoGridColorState === "green" ? "bg-[#00AB45]" : videoGridColorState === "yellow" ? "bg-[#FFB020]" : videoGridColorState === "red" ? "bg-[#E34329]" : "bg-gray-500/70";
33645
33686
  const efficiencyStatus = videoGridColorState === "green" ? "High" : videoGridColorState === "yellow" ? "Medium" : videoGridColorState === "red" ? "Low" : "Neutral";
@@ -33718,10 +33759,11 @@ var VideoCard = React141__namespace.default.memo(({
33718
33759
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: `absolute ${compact ? "top-1 right-1" : "top-2 right-2"} z-30`, children: /* @__PURE__ */ jsxRuntime.jsx(
33719
33760
  "div",
33720
33761
  {
33762
+ "data-testid": "video-card-metric-badge",
33721
33763
  className: `bg-black/70 backdrop-blur-sm rounded ${compact ? "px-1.5 py-1" : "px-2 py-1"} text-white border border-white/10`,
33722
33764
  title: badgeTitle,
33723
33765
  children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `${compact ? "text-[10px]" : "text-xs"} font-semibold`, children: [
33724
- Math.round(videoGridMetricValue),
33766
+ Math.round(videoGridDisplayValue),
33725
33767
  "%"
33726
33768
  ] })
33727
33769
  }
@@ -33729,6 +33771,7 @@ var VideoCard = React141__namespace.default.memo(({
33729
33771
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: `absolute bottom-0 left-0 right-0 ${compact ? "h-0.5" : "h-1"} bg-black/50 z-30`, children: /* @__PURE__ */ jsxRuntime.jsx(
33730
33772
  "div",
33731
33773
  {
33774
+ "data-testid": "video-card-metric-bar",
33732
33775
  className: `h-full ${efficiencyBarClass} transition-all duration-500`,
33733
33776
  style: { width: `${Math.min(100, videoGridMetricValue)}%` }
33734
33777
  }
@@ -33779,6 +33822,9 @@ var VideoCard = React141__namespace.default.memo(({
33779
33822
  if (prevProps.compact !== nextProps.compact) {
33780
33823
  return false;
33781
33824
  }
33825
+ if (prevProps.displayMinuteBucket !== nextProps.displayMinuteBucket) {
33826
+ return false;
33827
+ }
33782
33828
  if (prevProps.hlsUrl !== nextProps.hlsUrl || prevProps.shouldPlay !== nextProps.shouldPlay) {
33783
33829
  return false;
33784
33830
  }
@@ -34062,6 +34108,7 @@ var VideoGridView = React141__namespace.default.memo(({
34062
34108
  stream_source: isR2Stream ? "r2" : "media_config"
34063
34109
  });
34064
34110
  }, []);
34111
+ const displayMinuteBucket = Math.floor(Date.now() / 6e4);
34065
34112
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `relative overflow-hidden h-full w-full ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { ref: containerRef, className: "h-full w-full p-3 sm:p-2", children: /* @__PURE__ */ jsxRuntime.jsx(
34066
34113
  "div",
34067
34114
  {
@@ -34151,6 +34198,7 @@ var VideoGridView = React141__namespace.default.memo(({
34151
34198
  ),
34152
34199
  lastSeenLabel: card.lastSeenLabel,
34153
34200
  useRAF: effectiveUseRAF,
34201
+ displayMinuteBucket,
34154
34202
  compact: !selectedLine,
34155
34203
  onMouseEnter: onWorkspaceHover ? () => onWorkspaceHover(card.workspaceId) : void 0,
34156
34204
  onMouseLeave: onWorkspaceHoverEnd ? () => onWorkspaceHoverEnd(card.workspaceId) : void 0
package/dist/index.mjs CHANGED
@@ -33534,8 +33534,47 @@ var getVideoGridMetricValue = (workspace) => {
33534
33534
  return workspace.efficiency;
33535
33535
  };
33536
33536
  var hasIncomingWipMapping = (workspace) => Boolean(workspace.incoming_wip_buffer_name);
33537
+ var getVideoGridBaseColorState = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => getEfficiencyColor(getVideoGridMetricValue(workspace), legend);
33538
+ var isLowWipGreenOverride = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => {
33539
+ if (!hasAssemblyRecentFlow(workspace)) {
33540
+ return false;
33541
+ }
33542
+ if (getVideoGridBaseColorState(workspace, legend) !== "red") {
33543
+ return false;
33544
+ }
33545
+ if (!hasIncomingWipMapping(workspace)) {
33546
+ return false;
33547
+ }
33548
+ return isFiniteNumber2(workspace.incoming_wip_current) && workspace.incoming_wip_current <= 1;
33549
+ };
33550
+ var toMinuteBucket = (minuteBucket) => Number.isFinite(minuteBucket) ? Math.floor(minuteBucket) : Math.floor(Date.now() / 6e4);
33551
+ var getEffectiveFlowMinuteBucket = (workspace) => {
33552
+ const effectiveAt = workspace.recent_flow_effective_end_at;
33553
+ if (!effectiveAt) {
33554
+ return void 0;
33555
+ }
33556
+ const timestamp = Date.parse(effectiveAt);
33557
+ if (!Number.isFinite(timestamp)) {
33558
+ return void 0;
33559
+ }
33560
+ return Math.floor(timestamp / 6e4);
33561
+ };
33562
+ var hashWorkspaceKey = (workspace) => {
33563
+ const workspaceKey = workspace.workspace_uuid || workspace.workspace_name || "unknown";
33564
+ let hash = 0;
33565
+ for (let index = 0; index < workspaceKey.length; index += 1) {
33566
+ hash = (hash * 31 + workspaceKey.charCodeAt(index)) % 2147483647;
33567
+ }
33568
+ return hash;
33569
+ };
33570
+ var getSyntheticLowWipDisplayValue = (workspace, minuteBucket) => {
33571
+ const bucket = getEffectiveFlowMinuteBucket(workspace) ?? toMinuteBucket(minuteBucket);
33572
+ const offset = (hashWorkspaceKey(workspace) % 11 + bucket % 11 + 11) % 11;
33573
+ return 100 + offset;
33574
+ };
33575
+ var getVideoGridDisplayValue = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND, minuteBucket) => isLowWipGreenOverride(workspace, legend) ? getSyntheticLowWipDisplayValue(workspace, minuteBucket) : getVideoGridMetricValue(workspace);
33537
33576
  var getVideoGridColorState = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) => {
33538
- const baseColor = getEfficiencyColor(getVideoGridMetricValue(workspace), legend);
33577
+ const baseColor = getVideoGridBaseColorState(workspace, legend);
33539
33578
  if (!hasAssemblyRecentFlow(workspace)) {
33540
33579
  return baseColor;
33541
33580
  }
@@ -33548,7 +33587,7 @@ var getVideoGridColorState = (workspace, legend = DEFAULT_EFFICIENCY_LEGEND) =>
33548
33587
  if (!isFiniteNumber2(workspace.incoming_wip_current)) {
33549
33588
  return "neutral";
33550
33589
  }
33551
- if (workspace.incoming_wip_current <= 1) {
33590
+ if (isLowWipGreenOverride(workspace, legend)) {
33552
33591
  return "green";
33553
33592
  }
33554
33593
  return baseColor;
@@ -33589,6 +33628,7 @@ var VideoCard = React141__default.memo(({
33589
33628
  useRAF = true,
33590
33629
  className = "",
33591
33630
  compact = false,
33631
+ displayMinuteBucket,
33592
33632
  displayName,
33593
33633
  lastSeenLabel,
33594
33634
  onMouseEnter,
@@ -33609,8 +33649,9 @@ var VideoCard = React141__default.memo(({
33609
33649
  const lastSeenText = lastSeenLabel || "Unknown";
33610
33650
  const workspaceDisplayName = displayName || getWorkspaceDisplayName(workspace.workspace_name, workspace.line_id);
33611
33651
  const videoGridMetricValue = getVideoGridMetricValue(workspace);
33652
+ const videoGridDisplayValue = getVideoGridDisplayValue(workspace, effectiveLegend, displayMinuteBucket);
33612
33653
  const videoGridColorState = getVideoGridColorState(workspace, effectiveLegend);
33613
- const badgeTitle = hasAssemblyRecentFlow(workspace) ? `Flow ${Math.round(videoGridMetricValue)}%` : `Efficiency ${Math.round(videoGridMetricValue)}%`;
33654
+ const badgeTitle = hasAssemblyRecentFlow(workspace) ? `Flow ${Math.round(videoGridDisplayValue)}%` : `Efficiency ${Math.round(videoGridDisplayValue)}%`;
33614
33655
  const efficiencyOverlayClass = videoGridColorState === "green" ? "bg-[#00D654]/25" : videoGridColorState === "yellow" ? "bg-[#FFD700]/30" : videoGridColorState === "red" ? "bg-[#FF2D0A]/30" : "bg-transparent";
33615
33656
  const efficiencyBarClass = videoGridColorState === "green" ? "bg-[#00AB45]" : videoGridColorState === "yellow" ? "bg-[#FFB020]" : videoGridColorState === "red" ? "bg-[#E34329]" : "bg-gray-500/70";
33616
33657
  const efficiencyStatus = videoGridColorState === "green" ? "High" : videoGridColorState === "yellow" ? "Medium" : videoGridColorState === "red" ? "Low" : "Neutral";
@@ -33689,10 +33730,11 @@ var VideoCard = React141__default.memo(({
33689
33730
  /* @__PURE__ */ jsx("div", { className: `absolute ${compact ? "top-1 right-1" : "top-2 right-2"} z-30`, children: /* @__PURE__ */ jsx(
33690
33731
  "div",
33691
33732
  {
33733
+ "data-testid": "video-card-metric-badge",
33692
33734
  className: `bg-black/70 backdrop-blur-sm rounded ${compact ? "px-1.5 py-1" : "px-2 py-1"} text-white border border-white/10`,
33693
33735
  title: badgeTitle,
33694
33736
  children: /* @__PURE__ */ jsxs("span", { className: `${compact ? "text-[10px]" : "text-xs"} font-semibold`, children: [
33695
- Math.round(videoGridMetricValue),
33737
+ Math.round(videoGridDisplayValue),
33696
33738
  "%"
33697
33739
  ] })
33698
33740
  }
@@ -33700,6 +33742,7 @@ var VideoCard = React141__default.memo(({
33700
33742
  /* @__PURE__ */ jsx("div", { className: `absolute bottom-0 left-0 right-0 ${compact ? "h-0.5" : "h-1"} bg-black/50 z-30`, children: /* @__PURE__ */ jsx(
33701
33743
  "div",
33702
33744
  {
33745
+ "data-testid": "video-card-metric-bar",
33703
33746
  className: `h-full ${efficiencyBarClass} transition-all duration-500`,
33704
33747
  style: { width: `${Math.min(100, videoGridMetricValue)}%` }
33705
33748
  }
@@ -33750,6 +33793,9 @@ var VideoCard = React141__default.memo(({
33750
33793
  if (prevProps.compact !== nextProps.compact) {
33751
33794
  return false;
33752
33795
  }
33796
+ if (prevProps.displayMinuteBucket !== nextProps.displayMinuteBucket) {
33797
+ return false;
33798
+ }
33753
33799
  if (prevProps.hlsUrl !== nextProps.hlsUrl || prevProps.shouldPlay !== nextProps.shouldPlay) {
33754
33800
  return false;
33755
33801
  }
@@ -34033,6 +34079,7 @@ var VideoGridView = React141__default.memo(({
34033
34079
  stream_source: isR2Stream ? "r2" : "media_config"
34034
34080
  });
34035
34081
  }, []);
34082
+ const displayMinuteBucket = Math.floor(Date.now() / 6e4);
34036
34083
  return /* @__PURE__ */ jsx("div", { className: `relative overflow-hidden h-full w-full ${className}`, children: /* @__PURE__ */ jsx("div", { ref: containerRef, className: "h-full w-full p-3 sm:p-2", children: /* @__PURE__ */ jsx(
34037
34084
  "div",
34038
34085
  {
@@ -34122,6 +34169,7 @@ var VideoGridView = React141__default.memo(({
34122
34169
  ),
34123
34170
  lastSeenLabel: card.lastSeenLabel,
34124
34171
  useRAF: effectiveUseRAF,
34172
+ displayMinuteBucket,
34125
34173
  compact: !selectedLine,
34126
34174
  onMouseEnter: onWorkspaceHover ? () => onWorkspaceHover(card.workspaceId) : void 0,
34127
34175
  onMouseLeave: onWorkspaceHoverEnd ? () => onWorkspaceHoverEnd(card.workspaceId) : void 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optifye/dashboard-core",
3
- "version": "6.11.11",
3
+ "version": "6.11.12",
4
4
  "description": "Reusable UI & logic for Optifye dashboard",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",