@optifye/dashboard-core 6.0.2 → 6.0.3

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 CHANGED
@@ -893,17 +893,18 @@ var dashboardService = {
893
893
  const queryShiftId = shiftProp !== void 0 ? shiftProp : currentShiftResult.shiftId;
894
894
  try {
895
895
  if (lineIdToQuery === factoryViewId) {
896
- if (!defaultLineId || !secondaryLineId || !companyId) {
897
- throw new Error("Factory View requires defaultLineId, secondaryLineId, and companyId to be configured.");
896
+ if (!defaultLineId || !companyId) {
897
+ throw new Error("Factory View requires at least defaultLineId and companyId to be configured.");
898
898
  }
899
899
  const { data: line1Data, error: line1Error } = await supabase.from(linesTable).select("id, line_name, factory_id, factories!lines_factory_id_fkey(factory_name), company_id, companies!lines_company_id_fkey(company_name:name)").eq("id", defaultLineId).single();
900
900
  if (line1Error) throw line1Error;
901
901
  if (!line1Data) {
902
902
  throw new Error(`Default line ${defaultLineId} for Factory View not found.`);
903
903
  }
904
- const { data: metricsData, error: metricsError2 } = await supabase.from(lineMetricsTable).select("*").in("line_id", [defaultLineId, secondaryLineId]).eq("shift_id", queryShiftId).eq("date", queryDate);
904
+ const lineIdsToQuery = [defaultLineId, secondaryLineId].filter((id3) => id3 !== void 0 && id3 !== null);
905
+ const { data: metricsData, error: metricsError2 } = await supabase.from(lineMetricsTable).select("*").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate);
905
906
  if (metricsError2) throw metricsError2;
906
- const { data: performanceData2, error: performanceError2 } = await supabase.from(metricsTable).select("efficiency").in("line_id", [defaultLineId, secondaryLineId]).eq("shift_id", queryShiftId).eq("date", queryDate);
907
+ const { data: performanceData2, error: performanceError2 } = await supabase.from(metricsTable).select("efficiency").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate);
907
908
  if (performanceError2) throw performanceError2;
908
909
  const underperformingCount2 = performanceData2?.filter((w) => w.efficiency >= 10 && w.efficiency < 70).length || 0;
909
910
  const totalValidWorkspaces2 = performanceData2?.filter((w) => w.efficiency >= 10).length || 0;
@@ -21483,7 +21484,7 @@ function parseS3Uri(s3Uri, sopCategories) {
21483
21484
  break;
21484
21485
  case "long_cycle_time":
21485
21486
  severity = "high";
21486
- type = "bottleneck";
21487
+ type = "long_cycle_time";
21487
21488
  description = "Long Cycle Time Detected";
21488
21489
  break;
21489
21490
  case "best_cycle_time":
@@ -21527,7 +21528,7 @@ function parseS3Uri(s3Uri, sopCategories) {
21527
21528
  severity = "low";
21528
21529
  description = "Best Cycle Time Performance";
21529
21530
  } else if (normalizedViolationType.includes("long") && normalizedViolationType.includes("cycle")) {
21530
- type = "bottleneck";
21531
+ type = "long_cycle_time";
21531
21532
  severity = "high";
21532
21533
  description = "Long Cycle Time Detected";
21533
21534
  } else if (normalizedViolationType.includes("cycle") && (normalizedViolationType.includes("completion") || normalizedViolationType.includes("complete"))) {
@@ -22076,6 +22077,7 @@ var BottlenecksContent = ({
22076
22077
  const firstWorstCycle = videos.find((v) => v.type === "worst_cycle_time");
22077
22078
  const firstSOPDeviation = videos.find((v) => v.type === "missing_quality_check");
22078
22079
  const firstCycleCompletion = videos.find((v) => v.type === "cycle_completions");
22080
+ const firstLongCycleTime = videos.find((v) => v.type === "long_cycle_time");
22079
22081
  preloadVideosUrl2([
22080
22082
  firstHigh?.src,
22081
22083
  firstMed?.src,
@@ -22084,7 +22086,8 @@ var BottlenecksContent = ({
22084
22086
  firstBestCycle?.src,
22085
22087
  firstWorstCycle?.src,
22086
22088
  firstSOPDeviation?.src,
22087
- firstCycleCompletion?.src
22089
+ firstCycleCompletion?.src,
22090
+ firstLongCycleTime?.src
22088
22091
  ].filter(Boolean));
22089
22092
  }
22090
22093
  setAllVideos(videos);
@@ -22110,7 +22113,7 @@ var BottlenecksContent = ({
22110
22113
  if (activeFilter === "worst_cycle_time") return video.type === "worst_cycle_time";
22111
22114
  if (activeFilter === "cycle_completions") return video.type === "cycle_completions";
22112
22115
  if (activeFilter === "long_cycle_time") {
22113
- return video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time");
22116
+ return video.type === "long_cycle_time";
22114
22117
  }
22115
22118
  return video.type === "bottleneck" && video.severity === activeFilter;
22116
22119
  });
@@ -22128,11 +22131,6 @@ var BottlenecksContent = ({
22128
22131
  const selectedCategory = sopCategories.find((cat) => cat.id === activeFilter);
22129
22132
  if (selectedCategory) {
22130
22133
  filtered = allVideos.filter((video) => video.type === selectedCategory.id);
22131
- if (selectedCategory.id === "long_cycle_time") {
22132
- filtered = allVideos.filter(
22133
- (video) => video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time")
22134
- );
22135
- }
22136
22134
  }
22137
22135
  } else {
22138
22136
  if (activeFilter === "low_value") {
@@ -22146,9 +22144,7 @@ var BottlenecksContent = ({
22146
22144
  } else if (activeFilter === "cycle_completions") {
22147
22145
  filtered = allVideos.filter((video) => video.type === "cycle_completions");
22148
22146
  } else if (activeFilter === "long_cycle_time") {
22149
- filtered = allVideos.filter(
22150
- (video) => video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time")
22151
- );
22147
+ filtered = allVideos.filter((video) => video.type === "long_cycle_time");
22152
22148
  } else {
22153
22149
  filtered = allVideos.filter((video) => video.type === "bottleneck" && video.severity === activeFilter);
22154
22150
  }
@@ -22435,13 +22431,7 @@ var BottlenecksContent = ({
22435
22431
  const counts = { total: allVideos.length };
22436
22432
  if (sopCategories && sopCategories.length > 0) {
22437
22433
  sopCategories.forEach((category) => {
22438
- if (category.id === "long_cycle_time") {
22439
- counts[category.id] = allVideos.filter(
22440
- (video) => video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time")
22441
- ).length;
22442
- } else {
22443
- counts[category.id] = allVideos.filter((video) => video.type === category.id).length;
22444
- }
22434
+ counts[category.id] = allVideos.filter((video) => video.type === category.id).length;
22445
22435
  });
22446
22436
  } else {
22447
22437
  counts.bottlenecks = allVideos.filter((video) => video.type === "bottleneck").length;
@@ -22452,9 +22442,7 @@ var BottlenecksContent = ({
22452
22442
  counts.sopDeviations = allVideos.filter((video) => video.type === "missing_quality_check").length;
22453
22443
  counts.bestCycleTimes = allVideos.filter((video) => video.type === "best_cycle_time").length;
22454
22444
  counts.worstCycleTimes = allVideos.filter((video) => video.type === "worst_cycle_time").length;
22455
- counts.longCycleTimes = allVideos.filter(
22456
- (video) => video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time")
22457
- ).length;
22445
+ counts.longCycleTimes = allVideos.filter((video) => video.type === "long_cycle_time").length;
22458
22446
  counts.cycleCompletions = allVideos.filter((video) => video.type === "cycle_completions").length;
22459
22447
  }
22460
22448
  return counts;
package/dist/index.mjs CHANGED
@@ -864,17 +864,18 @@ var dashboardService = {
864
864
  const queryShiftId = shiftProp !== void 0 ? shiftProp : currentShiftResult.shiftId;
865
865
  try {
866
866
  if (lineIdToQuery === factoryViewId) {
867
- if (!defaultLineId || !secondaryLineId || !companyId) {
868
- throw new Error("Factory View requires defaultLineId, secondaryLineId, and companyId to be configured.");
867
+ if (!defaultLineId || !companyId) {
868
+ throw new Error("Factory View requires at least defaultLineId and companyId to be configured.");
869
869
  }
870
870
  const { data: line1Data, error: line1Error } = await supabase.from(linesTable).select("id, line_name, factory_id, factories!lines_factory_id_fkey(factory_name), company_id, companies!lines_company_id_fkey(company_name:name)").eq("id", defaultLineId).single();
871
871
  if (line1Error) throw line1Error;
872
872
  if (!line1Data) {
873
873
  throw new Error(`Default line ${defaultLineId} for Factory View not found.`);
874
874
  }
875
- const { data: metricsData, error: metricsError2 } = await supabase.from(lineMetricsTable).select("*").in("line_id", [defaultLineId, secondaryLineId]).eq("shift_id", queryShiftId).eq("date", queryDate);
875
+ const lineIdsToQuery = [defaultLineId, secondaryLineId].filter((id3) => id3 !== void 0 && id3 !== null);
876
+ const { data: metricsData, error: metricsError2 } = await supabase.from(lineMetricsTable).select("*").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate);
876
877
  if (metricsError2) throw metricsError2;
877
- const { data: performanceData2, error: performanceError2 } = await supabase.from(metricsTable).select("efficiency").in("line_id", [defaultLineId, secondaryLineId]).eq("shift_id", queryShiftId).eq("date", queryDate);
878
+ const { data: performanceData2, error: performanceError2 } = await supabase.from(metricsTable).select("efficiency").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate);
878
879
  if (performanceError2) throw performanceError2;
879
880
  const underperformingCount2 = performanceData2?.filter((w) => w.efficiency >= 10 && w.efficiency < 70).length || 0;
880
881
  const totalValidWorkspaces2 = performanceData2?.filter((w) => w.efficiency >= 10).length || 0;
@@ -21454,7 +21455,7 @@ function parseS3Uri(s3Uri, sopCategories) {
21454
21455
  break;
21455
21456
  case "long_cycle_time":
21456
21457
  severity = "high";
21457
- type = "bottleneck";
21458
+ type = "long_cycle_time";
21458
21459
  description = "Long Cycle Time Detected";
21459
21460
  break;
21460
21461
  case "best_cycle_time":
@@ -21498,7 +21499,7 @@ function parseS3Uri(s3Uri, sopCategories) {
21498
21499
  severity = "low";
21499
21500
  description = "Best Cycle Time Performance";
21500
21501
  } else if (normalizedViolationType.includes("long") && normalizedViolationType.includes("cycle")) {
21501
- type = "bottleneck";
21502
+ type = "long_cycle_time";
21502
21503
  severity = "high";
21503
21504
  description = "Long Cycle Time Detected";
21504
21505
  } else if (normalizedViolationType.includes("cycle") && (normalizedViolationType.includes("completion") || normalizedViolationType.includes("complete"))) {
@@ -22047,6 +22048,7 @@ var BottlenecksContent = ({
22047
22048
  const firstWorstCycle = videos.find((v) => v.type === "worst_cycle_time");
22048
22049
  const firstSOPDeviation = videos.find((v) => v.type === "missing_quality_check");
22049
22050
  const firstCycleCompletion = videos.find((v) => v.type === "cycle_completions");
22051
+ const firstLongCycleTime = videos.find((v) => v.type === "long_cycle_time");
22050
22052
  preloadVideosUrl2([
22051
22053
  firstHigh?.src,
22052
22054
  firstMed?.src,
@@ -22055,7 +22057,8 @@ var BottlenecksContent = ({
22055
22057
  firstBestCycle?.src,
22056
22058
  firstWorstCycle?.src,
22057
22059
  firstSOPDeviation?.src,
22058
- firstCycleCompletion?.src
22060
+ firstCycleCompletion?.src,
22061
+ firstLongCycleTime?.src
22059
22062
  ].filter(Boolean));
22060
22063
  }
22061
22064
  setAllVideos(videos);
@@ -22081,7 +22084,7 @@ var BottlenecksContent = ({
22081
22084
  if (activeFilter === "worst_cycle_time") return video.type === "worst_cycle_time";
22082
22085
  if (activeFilter === "cycle_completions") return video.type === "cycle_completions";
22083
22086
  if (activeFilter === "long_cycle_time") {
22084
- return video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time");
22087
+ return video.type === "long_cycle_time";
22085
22088
  }
22086
22089
  return video.type === "bottleneck" && video.severity === activeFilter;
22087
22090
  });
@@ -22099,11 +22102,6 @@ var BottlenecksContent = ({
22099
22102
  const selectedCategory = sopCategories.find((cat) => cat.id === activeFilter);
22100
22103
  if (selectedCategory) {
22101
22104
  filtered = allVideos.filter((video) => video.type === selectedCategory.id);
22102
- if (selectedCategory.id === "long_cycle_time") {
22103
- filtered = allVideos.filter(
22104
- (video) => video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time")
22105
- );
22106
- }
22107
22105
  }
22108
22106
  } else {
22109
22107
  if (activeFilter === "low_value") {
@@ -22117,9 +22115,7 @@ var BottlenecksContent = ({
22117
22115
  } else if (activeFilter === "cycle_completions") {
22118
22116
  filtered = allVideos.filter((video) => video.type === "cycle_completions");
22119
22117
  } else if (activeFilter === "long_cycle_time") {
22120
- filtered = allVideos.filter(
22121
- (video) => video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time")
22122
- );
22118
+ filtered = allVideos.filter((video) => video.type === "long_cycle_time");
22123
22119
  } else {
22124
22120
  filtered = allVideos.filter((video) => video.type === "bottleneck" && video.severity === activeFilter);
22125
22121
  }
@@ -22406,13 +22402,7 @@ var BottlenecksContent = ({
22406
22402
  const counts = { total: allVideos.length };
22407
22403
  if (sopCategories && sopCategories.length > 0) {
22408
22404
  sopCategories.forEach((category) => {
22409
- if (category.id === "long_cycle_time") {
22410
- counts[category.id] = allVideos.filter(
22411
- (video) => video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time")
22412
- ).length;
22413
- } else {
22414
- counts[category.id] = allVideos.filter((video) => video.type === category.id).length;
22415
- }
22405
+ counts[category.id] = allVideos.filter((video) => video.type === category.id).length;
22416
22406
  });
22417
22407
  } else {
22418
22408
  counts.bottlenecks = allVideos.filter((video) => video.type === "bottleneck").length;
@@ -22423,9 +22413,7 @@ var BottlenecksContent = ({
22423
22413
  counts.sopDeviations = allVideos.filter((video) => video.type === "missing_quality_check").length;
22424
22414
  counts.bestCycleTimes = allVideos.filter((video) => video.type === "best_cycle_time").length;
22425
22415
  counts.worstCycleTimes = allVideos.filter((video) => video.type === "worst_cycle_time").length;
22426
- counts.longCycleTimes = allVideos.filter(
22427
- (video) => video.type === "bottleneck" && video.description.toLowerCase().includes("cycle time")
22428
- ).length;
22416
+ counts.longCycleTimes = allVideos.filter((video) => video.type === "long_cycle_time").length;
22429
22417
  counts.cycleCompletions = allVideos.filter((video) => video.type === "cycle_completions").length;
22430
22418
  }
22431
22419
  return counts;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optifye/dashboard-core",
3
- "version": "6.0.2",
3
+ "version": "6.0.3",
4
4
  "description": "Reusable UI & logic for Optifye dashboard",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",