@optifye/dashboard-core 6.0.6 → 6.0.7

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
@@ -378,24 +378,6 @@ function createMemoizedFunction(fn, getCacheKey) {
378
378
  return result;
379
379
  };
380
380
  }
381
- var memoizedEfficiencyFilter = createMemoizedFunction(
382
- (data, minEfficiency, maxEfficiency) => {
383
- return data.filter((item) => {
384
- const eff = item.efficiency ?? 0;
385
- return eff >= minEfficiency && (maxEfficiency === void 0 || eff < maxEfficiency);
386
- });
387
- },
388
- (data, min, max = void 0) => `${data.length}-${min}-${max}`
389
- );
390
- var memoizedAverageEfficiency = createMemoizedFunction(
391
- (data, minThreshold = 10) => {
392
- const validItems = data.filter((item) => (item.efficiency ?? 0) >= minThreshold);
393
- if (validItems.length === 0) return 0;
394
- const sum = validItems.reduce((acc, item) => acc + (item.efficiency ?? 0), 0);
395
- return sum / validItems.length;
396
- },
397
- (data, threshold) => `${data.length}-${threshold}`
398
- );
399
381
  var memoizedOutputArrayAggregation = createMemoizedFunction(
400
382
  (arrays) => {
401
383
  if (arrays.length === 0) return [];
@@ -606,7 +588,7 @@ var dashboardService = {
606
588
  const lineMetricsTable = getTable2(dbConfig, "lineMetrics");
607
589
  const companyId = entityConfig.companyId;
608
590
  const metricsTablePrefixStr = getMetricsTablePrefix();
609
- const metricsTable = `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
591
+ `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
610
592
  const configuredLineIds = getConfiguredLineIds(entityConfig);
611
593
  const defaultLineId = configuredLineIds[0];
612
594
  const factoryViewId = entityConfig.factoryViewId ?? "factory";
@@ -617,7 +599,7 @@ var dashboardService = {
617
599
  if (!isValidFactoryViewConfiguration(entityConfig) || !companyId) {
618
600
  throw new Error("Factory View requires at least one configured line and companyId to be configured.");
619
601
  }
620
- const [lineResult, metricsResult, performanceResult] = await Promise.all([
602
+ const [lineResult, metricsResult] = await Promise.all([
621
603
  // Get Line 1's info for general factory details
622
604
  supabase.from(linesTable).select(`
623
605
  id,
@@ -628,28 +610,29 @@ var dashboardService = {
628
610
  companies!lines_company_id_fkey(company_name:name)
629
611
  `).eq("id", defaultLineId).maybeSingle(),
630
612
  // Get metrics from line_metrics table for all configured lines
631
- supabase.from(lineMetricsTable).select("*").in("line_id", configuredLineIds).eq("shift_id", shiftId).eq("date", date),
632
- // Get performance data from the dynamic metrics table for all configured lines
633
- supabase.from(metricsTable).select("efficiency").in("line_id", configuredLineIds).eq("shift_id", shiftId).eq("date", date)
613
+ supabase.from(lineMetricsTable).select("*").in("line_id", configuredLineIds).eq("shift_id", shiftId).eq("date", date)
634
614
  ]);
635
615
  if (lineResult.error) throw lineResult.error;
636
616
  if (!lineResult.data) throw new Error(`Configured default line (${defaultLineId}) not found`);
637
617
  if (metricsResult.error) throw metricsResult.error;
638
- if (performanceResult.error) throw performanceResult.error;
639
618
  const lineData2 = lineResult.data;
640
619
  const metricsData = metricsResult.data;
641
- const performanceData2 = performanceResult.data;
642
- const underperformingWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10, 70);
643
- const validWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10);
644
- const underperformingCount2 = underperformingWorkspaces2.length;
645
- validWorkspaces2.length;
646
620
  const combinedMetrics = (metricsData || []).reduce((acc, m) => {
647
- acc.avg_efficiency += m.efficiency ?? 0;
648
621
  acc.current_output += m.current_output ?? 0;
649
622
  acc.ideal_output += m.ideal_output ?? m.line_threshold ?? 0;
623
+ acc.total_workspaces += m.total_workspaces ?? 0;
624
+ acc.underperforming_workspaces += m.underperforming_workspaces ?? 0;
625
+ acc.weightedEfficiencySum += (m.avg_efficiency ?? 0) * (m.total_workspaces ?? 0);
650
626
  return acc;
651
- }, { avg_efficiency: 0, current_output: 0, ideal_output: 0 });
627
+ }, {
628
+ current_output: 0,
629
+ ideal_output: 0,
630
+ total_workspaces: 0,
631
+ underperforming_workspaces: 0,
632
+ weightedEfficiencySum: 0
633
+ });
652
634
  metricsData?.length || 1;
635
+ const avgEfficiency = combinedMetrics.total_workspaces > 0 ? combinedMetrics.weightedEfficiencySum / combinedMetrics.total_workspaces : 0;
653
636
  return {
654
637
  line_id: factoryViewId,
655
638
  // Use configured factory view ID
@@ -662,15 +645,13 @@ var dashboardService = {
662
645
  shift_id: shiftId,
663
646
  date,
664
647
  metrics: {
665
- avg_efficiency: memoizedAverageEfficiency(performanceData2 || [], 10),
666
- // Use memoized calculation for efficiency
648
+ avg_efficiency: avgEfficiency,
667
649
  avg_cycle_time: 0,
668
650
  // Needs calculation logic if required for factory view
669
651
  current_output: combinedMetrics.current_output,
670
652
  ideal_output: combinedMetrics.ideal_output,
671
- total_workspaces: 0,
672
- // SRC ALIGNMENT: Use hardcoded 44 for factory view total_workspaces
673
- underperforming_workspaces: underperformingCount2,
653
+ total_workspaces: combinedMetrics.total_workspaces || 0,
654
+ underperforming_workspaces: combinedMetrics.underperforming_workspaces,
674
655
  underperforming_workspace_names: [],
675
656
  // Populate if needed
676
657
  underperforming_workspace_uuids: [],
@@ -704,13 +685,6 @@ var dashboardService = {
704
685
  } catch (err) {
705
686
  console.error(`Error fetching line metrics for ${lineId}:`, err);
706
687
  }
707
- const { data: performanceData, error: performanceError } = await supabase.from(metricsTable).select("efficiency").eq("line_id", lineId).eq("shift_id", shiftId).eq("date", date);
708
- if (performanceError) throw performanceError;
709
- const underperformingWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10, 70);
710
- const validWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10);
711
- const underperformingCount = underperformingWorkspaces.length;
712
- validWorkspaces.length;
713
- const avgEfficiencyFromPerf = memoizedAverageEfficiency(performanceData || [], 10);
714
688
  const useFallbackMetrics = !metricsFromDb;
715
689
  let metricsForReturn;
716
690
  if (useFallbackMetrics) {
@@ -720,7 +694,7 @@ var dashboardService = {
720
694
  current_output: 0,
721
695
  ideal_output: 0,
722
696
  total_workspaces: 42,
723
- underperforming_workspaces: underperformingCount,
697
+ underperforming_workspaces: 0,
724
698
  underperforming_workspace_names: [],
725
699
  underperforming_workspace_uuids: [],
726
700
  output_array: [],
@@ -733,12 +707,12 @@ var dashboardService = {
733
707
  };
734
708
  } else {
735
709
  metricsForReturn = {
736
- avg_efficiency: metricsFromDb.efficiency ?? avgEfficiencyFromPerf,
710
+ avg_efficiency: metricsFromDb.avg_efficiency ?? 0,
737
711
  avg_cycle_time: metricsFromDb.avg_cycle_time || 0,
738
712
  current_output: metricsFromDb.current_output || 0,
739
713
  ideal_output: metricsFromDb.ideal_output || metricsFromDb.line_threshold || 0,
740
714
  total_workspaces: metricsFromDb.total_workspaces ?? workspaceConfig.totalWorkspaces ?? 42,
741
- underperforming_workspaces: underperformingCount,
715
+ underperforming_workspaces: metricsFromDb.underperforming_workspaces ?? 0,
742
716
  underperforming_workspace_names: metricsFromDb.underperforming_workspace_names || [],
743
717
  underperforming_workspace_uuids: metricsFromDb.underperforming_workspace_uuids || [],
744
718
  output_array: metricsFromDb.output_array || [],
@@ -749,9 +723,6 @@ var dashboardService = {
749
723
  last_updated: metricsFromDb.last_updated || (/* @__PURE__ */ new Date()).toISOString(),
750
724
  poorest_performing_workspaces: metricsFromDb.poorest_performing_workspaces || []
751
725
  };
752
- if (metricsFromDb.efficiency === null || metricsFromDb.efficiency === void 0) {
753
- metricsForReturn.avg_efficiency = avgEfficiencyFromPerf;
754
- }
755
726
  }
756
727
  return {
757
728
  line_id: lineData.id,
@@ -1014,7 +985,7 @@ var dashboardService = {
1014
985
  const lineMetricsTable = getTable2(dbConfig, "lineMetrics");
1015
986
  const companyId = entityConfig.companyId;
1016
987
  const metricsTablePrefixStr = getMetricsTablePrefix();
1017
- const metricsTable = `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
988
+ `${metricsTablePrefixStr}_${companyId ? companyId.replace(/-/g, "_") : "unknown_company"}`;
1018
989
  const configuredLineIds = getConfiguredLineIds(entityConfig);
1019
990
  const defaultLineId = configuredLineIds[0];
1020
991
  const factoryViewId = entityConfig.factoryViewId ?? "factory";
@@ -1029,25 +1000,17 @@ var dashboardService = {
1029
1000
  throw new Error("Factory View requires at least one configured line and companyId to be configured.");
1030
1001
  }
1031
1002
  const lineIdsToQuery = configuredLineIds;
1032
- const [line1Result, metricsResult2, performanceResult2] = await Promise.all([
1003
+ const [line1Result, metricsResult2] = await Promise.all([
1033
1004
  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(),
1034
- supabase.from(lineMetricsTable).select("*").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate),
1035
- supabase.from(metricsTable).select("efficiency").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
1005
+ supabase.from(lineMetricsTable).select("*").in("line_id", lineIdsToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
1036
1006
  ]);
1037
1007
  if (line1Result.error) throw line1Result.error;
1038
1008
  if (!line1Result.data) {
1039
1009
  throw new Error(`Default line ${defaultLineId} for Factory View not found.`);
1040
1010
  }
1041
1011
  if (metricsResult2.error) throw metricsResult2.error;
1042
- if (performanceResult2.error) throw performanceResult2.error;
1043
1012
  const line1Data = line1Result.data;
1044
1013
  const metricsData = metricsResult2.data;
1045
- const performanceData2 = performanceResult2.data;
1046
- const underperformingWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10, 70);
1047
- const validWorkspaces2 = memoizedEfficiencyFilter(performanceData2 || [], 10);
1048
- const underperformingCount2 = underperformingWorkspaces2.length;
1049
- const totalValidWorkspaces2 = validWorkspaces2.length;
1050
- const avgEfficiencyFromPerf2 = memoizedAverageEfficiency(performanceData2 || [], 10);
1051
1014
  const initialAccumulator = {
1052
1015
  avg_cycle_time: 0,
1053
1016
  current_output: 0,
@@ -1055,6 +1018,10 @@ var dashboardService = {
1055
1018
  line_threshold: 0,
1056
1019
  threshold_pph: 0,
1057
1020
  total_workspaces: 0,
1021
+ underperforming_workspaces: 0,
1022
+ weightedEfficiencySum: 0,
1023
+ underperforming_workspace_names: [],
1024
+ underperforming_workspace_uuids: [],
1058
1025
  output_array: [],
1059
1026
  outputArrays: []
1060
1027
  };
@@ -1065,13 +1032,21 @@ var dashboardService = {
1065
1032
  acc.line_threshold += m.line_threshold ?? 0;
1066
1033
  acc.threshold_pph += m.threshold_pph ?? 0;
1067
1034
  acc.total_workspaces += m.total_workspaces ?? 0;
1035
+ acc.underperforming_workspaces += m.underperforming_workspaces ?? 0;
1036
+ acc.weightedEfficiencySum += (m.avg_efficiency ?? 0) * (m.total_workspaces ?? 0);
1037
+ if (m.underperforming_workspace_names) {
1038
+ acc.underperforming_workspace_names.push(...m.underperforming_workspace_names);
1039
+ }
1040
+ if (m.underperforming_workspace_uuids) {
1041
+ acc.underperforming_workspace_uuids.push(...m.underperforming_workspace_uuids);
1042
+ }
1068
1043
  if (m.output_array && m.output_array.length > 0) {
1069
1044
  acc.outputArrays.push(m.output_array);
1070
1045
  }
1071
1046
  return acc;
1072
1047
  }, initialAccumulator);
1073
1048
  const numLines = Math.max(metricsData?.length || 0, 1);
1074
- const avgEfficiencyFromLineMetrics = (metricsData?.reduce((sum, m) => sum + (m.avg_efficiency || 0), 0) || 0) / numLines;
1049
+ const avgEfficiency = combinedMetricsData.total_workspaces > 0 ? combinedMetricsData.weightedEfficiencySum / combinedMetricsData.total_workspaces : 0;
1075
1050
  return {
1076
1051
  line_id: factoryViewId,
1077
1052
  line_name: "Factory View",
@@ -1082,22 +1057,20 @@ var dashboardService = {
1082
1057
  date: queryDate,
1083
1058
  shift_id: queryShiftId,
1084
1059
  metrics: {
1085
- avg_efficiency: avgEfficiencyFromPerf2 > 0 ? avgEfficiencyFromPerf2 : avgEfficiencyFromLineMetrics,
1086
- // Use performance data first, fallback to line metrics
1060
+ avg_efficiency: avgEfficiency,
1087
1061
  avg_cycle_time: combinedMetricsData.avg_cycle_time / numLines,
1088
1062
  current_output: combinedMetricsData.current_output,
1089
1063
  ideal_output: combinedMetricsData.ideal_output,
1090
1064
  total_workspaces: combinedMetricsData.total_workspaces || 0,
1091
- // Use combined or default
1092
- underperforming_workspaces: underperformingCount2,
1065
+ underperforming_workspaces: combinedMetricsData.underperforming_workspaces,
1093
1066
  line_threshold: combinedMetricsData.line_threshold,
1094
1067
  threshold_pph: combinedMetricsData.threshold_pph / numLines,
1095
1068
  shift_start: metricsData?.[0]?.shift_start || shiftConfig.dayShift?.startTime || "06:00",
1096
1069
  shift_end: metricsData?.[0]?.shift_end || shiftConfig.dayShift?.endTime || "18:00",
1097
1070
  last_updated: (/* @__PURE__ */ new Date()).toISOString(),
1098
1071
  output_array: combinedMetricsData.outputArrays.length > 0 ? memoizedOutputArrayAggregation(combinedMetricsData.outputArrays) : [],
1099
- underperforming_workspace_names: [],
1100
- underperforming_workspace_uuids: [],
1072
+ underperforming_workspace_names: combinedMetricsData.underperforming_workspace_names,
1073
+ underperforming_workspace_uuids: combinedMetricsData.underperforming_workspace_uuids,
1101
1074
  poorest_performing_workspaces: []
1102
1075
  }
1103
1076
  };
@@ -1105,25 +1078,17 @@ var dashboardService = {
1105
1078
  if (!companyId) {
1106
1079
  throw new Error("Company ID must be configured for detailed line requests.");
1107
1080
  }
1108
- const [lineResult, metricsResult, performanceResult] = await Promise.all([
1081
+ const [lineResult, metricsResult] = await Promise.all([
1109
1082
  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", lineIdToQuery).single(),
1110
- supabase.from(lineMetricsTable).select("*").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate).maybeSingle(),
1111
- supabase.from(metricsTable).select("efficiency").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate)
1083
+ supabase.from(lineMetricsTable).select("*").eq("line_id", lineIdToQuery).eq("shift_id", queryShiftId).eq("date", queryDate).maybeSingle()
1112
1084
  ]);
1113
1085
  if (lineResult.error) throw lineResult.error;
1114
1086
  if (!lineResult.data) {
1115
1087
  throw new Error(`Line ${lineIdToQuery} not found.`);
1116
1088
  }
1117
1089
  if (metricsResult.error) throw metricsResult.error;
1118
- if (performanceResult.error) throw performanceResult.error;
1119
1090
  const lineData = lineResult.data;
1120
1091
  const metrics2 = metricsResult.data;
1121
- const performanceData = performanceResult.data;
1122
- const underperformingWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10, 70);
1123
- const validWorkspaces = memoizedEfficiencyFilter(performanceData || [], 10);
1124
- const underperformingCount = underperformingWorkspaces.length;
1125
- const totalValidWorkspaces = validWorkspaces.length;
1126
- const avgEfficiencyFromPerf = memoizedAverageEfficiency(performanceData || [], 10);
1127
1092
  return {
1128
1093
  line_id: lineData.id,
1129
1094
  line_name: lineData.line_name,
@@ -1134,13 +1099,12 @@ var dashboardService = {
1134
1099
  date: queryDate,
1135
1100
  shift_id: queryShiftId,
1136
1101
  metrics: {
1137
- avg_efficiency: avgEfficiencyFromPerf > 0 ? avgEfficiencyFromPerf : metrics2?.avg_efficiency ?? 0,
1138
- // Use performance data first, fallback to line metrics
1102
+ avg_efficiency: metrics2?.avg_efficiency ?? 0,
1139
1103
  avg_cycle_time: metrics2?.avg_cycle_time || 0,
1140
1104
  current_output: metrics2?.current_output || 0,
1141
1105
  ideal_output: metrics2?.ideal_output || metrics2?.line_threshold || 0,
1142
1106
  total_workspaces: metrics2?.total_workspaces ?? workspaceConfig.totalWorkspaces ?? 42,
1143
- underperforming_workspaces: underperformingCount,
1107
+ underperforming_workspaces: metrics2?.underperforming_workspaces ?? 0,
1144
1108
  line_threshold: metrics2?.line_threshold || 0,
1145
1109
  threshold_pph: metrics2?.threshold_pph || 0,
1146
1110
  shift_start: metrics2?.shift_start || shiftConfig.dayShift?.startTime || "06:00",
@@ -2025,14 +1989,17 @@ var authOTPService = {
2025
1989
  const { error } = await supabase.auth.signInWithOtp({
2026
1990
  email,
2027
1991
  options: {
2028
- shouldCreateUser: true,
2029
- // Creates user if doesn't exist
1992
+ shouldCreateUser: false,
1993
+ // Only allow existing users to log in
2030
1994
  emailRedirectTo: void 0
2031
1995
  // Disable magic link redirect
2032
1996
  }
2033
1997
  });
2034
1998
  if (error) {
2035
1999
  console.error("Error sending OTP:", error);
2000
+ if (error.message.toLowerCase().includes("signups not allowed") || error.message.toLowerCase().includes("signup") || error.message.toLowerCase().includes("not allowed")) {
2001
+ error.message = "You don't have an account with us. Please contact the Optifye team for more details.";
2002
+ }
2036
2003
  }
2037
2004
  return { error };
2038
2005
  },
@@ -16771,25 +16738,40 @@ var createMotionComponent = /* @__PURE__ */ createMotionComponentFactory({
16771
16738
 
16772
16739
  // ../../node_modules/framer-motion/dist/es/render/components/motion/proxy.mjs
16773
16740
  var motion = /* @__PURE__ */ createDOMMotionComponentProxy(createMotionComponent);
16774
- var LoadingSpinner = ({
16741
+ var OptifyeLogoLoader = ({
16775
16742
  size = "md",
16776
16743
  message,
16777
16744
  className
16778
16745
  }) => {
16779
16746
  const sizeClasses = {
16780
- sm: "w-5 h-5",
16781
- md: "w-8 h-8",
16782
- lg: "w-12 h-12"
16747
+ sm: "w-10",
16748
+ // 40px
16749
+ md: "w-16",
16750
+ // 64px
16751
+ lg: "w-24"
16752
+ // 96px
16783
16753
  };
16784
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `flex flex-col items-center justify-center p-4 ${className || ""}`, children: [
16785
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${sizeClasses[size]} animate-spin`, children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "w-full h-full text-[var(--primary-DEFAULT)]", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
16786
- /* @__PURE__ */ jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
16787
- /* @__PURE__ */ jsxRuntime.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
16788
- ] }) }),
16789
- message && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 text-gray-600 text-sm font-medium", children: message })
16790
- ] });
16754
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16755
+ "div",
16756
+ {
16757
+ role: "status",
16758
+ "aria-label": "Loading",
16759
+ className: `flex flex-col items-center justify-center p-4 ${className || ""}`.trim(),
16760
+ children: [
16761
+ /* @__PURE__ */ jsxRuntime.jsx(
16762
+ "img",
16763
+ {
16764
+ src: "/optifye-logo.png",
16765
+ alt: "Optifye Logo",
16766
+ className: `${sizeClasses[size]} h-auto animate-pulse select-none pointer-events-none`
16767
+ }
16768
+ ),
16769
+ message && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-3 text-gray-600 text-sm font-medium text-center", children: message })
16770
+ ]
16771
+ }
16772
+ );
16791
16773
  };
16792
- var LoadingSpinner_default = LoadingSpinner;
16774
+ var OptifyeLogoLoader_default = OptifyeLogoLoader;
16793
16775
  var LoadingPage = ({
16794
16776
  message = "Loading Dashboard...",
16795
16777
  subMessage = "Please wait while we prepare your data",
@@ -16803,29 +16785,17 @@ var LoadingPage = ({
16803
16785
  return () => clearTimeout(timeout);
16804
16786
  }, [message]);
16805
16787
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex h-full w-full items-center justify-center bg-slate-50 ${className || ""}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center space-y-6 text-center", children: [
16806
- /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size: "lg", message: void 0 }),
16807
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
16808
- /* @__PURE__ */ jsxRuntime.jsx(
16809
- motion.h3,
16810
- {
16811
- className: "text-xl font-semibold text-gray-800",
16812
- initial: { opacity: 0, y: 10 },
16813
- animate: { opacity: 1, y: 0 },
16814
- transition: { delay: 0.1, duration: 0.3 },
16815
- children: message
16816
- }
16817
- ),
16818
- subMessage && /* @__PURE__ */ jsxRuntime.jsx(
16819
- motion.p,
16820
- {
16821
- className: "mt-2 text-base text-gray-600",
16822
- initial: { opacity: 0 },
16823
- animate: { opacity: 1 },
16824
- transition: { delay: 0.2, duration: 0.3 },
16825
- children: subMessage
16826
- }
16827
- )
16828
- ] })
16788
+ /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "lg", message }),
16789
+ subMessage && /* @__PURE__ */ jsxRuntime.jsx(
16790
+ motion.p,
16791
+ {
16792
+ className: "mt-2 text-base text-gray-600",
16793
+ initial: { opacity: 0 },
16794
+ animate: { opacity: 1 },
16795
+ transition: { delay: 0.2, duration: 0.3 },
16796
+ children: subMessage
16797
+ }
16798
+ )
16829
16799
  ] }) });
16830
16800
  };
16831
16801
  var LoadingPage_default = LoadingPage;
@@ -18670,7 +18640,7 @@ var VideoGridView = React19__namespace.default.memo(({
18670
18640
  }, [cropping]);
18671
18641
  const veryLowEfficiencyWorkspaces = React19.useMemo(() => {
18672
18642
  return new Set(
18673
- workspaces.filter((w) => w.efficiency < 50 && w.efficiency >= 10).map((w) => w.workspace_name)
18643
+ workspaces.filter((w) => w.efficiency < 50 && w.efficiency >= 10).map((w) => `${w.line_id}_${w.workspace_name}`)
18674
18644
  );
18675
18645
  }, [workspaces]);
18676
18646
  const filteredWorkspaces = React19.useMemo(() => {
@@ -18806,7 +18776,7 @@ var VideoGridView = React19__namespace.default.memo(({
18806
18776
  }).map((workspace) => {
18807
18777
  const workspaceId = workspace.workspace_uuid || workspace.workspace_name;
18808
18778
  const isVisible = visibleWorkspaces.has(workspaceId);
18809
- const isVeryLowEfficiency = veryLowEfficiencyWorkspaces.has(workspace.workspace_name);
18779
+ const isVeryLowEfficiency = veryLowEfficiencyWorkspaces.has(`${workspace.line_id}_${workspace.workspace_name}`);
18810
18780
  const workspaceCropping = getWorkspaceCropping(workspace.workspace_name);
18811
18781
  return /* @__PURE__ */ jsxRuntime.jsx(
18812
18782
  "div",
@@ -19976,20 +19946,23 @@ var LineHistoryCalendar = ({
19976
19946
  } else {
19977
19947
  calendar.push({
19978
19948
  date: currentDate,
19979
- dayShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0 },
19980
- nightShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0 }
19949
+ dayShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0, hasData: false },
19950
+ nightShift: { avg_efficiency: 0, underperforming_workspaces: 0, total_workspaces: 0, hasData: false }
19981
19951
  });
19982
19952
  }
19983
19953
  }
19984
19954
  return calendar;
19985
19955
  }, [data, month, year, configuredTimezone]);
19986
- const getPerformanceColor = (efficiency, date) => {
19956
+ const hasRealData = (shift) => {
19957
+ if (shift.hasData !== void 0) return shift.hasData;
19958
+ return shift.total_workspaces > 0 || shift.avg_efficiency > 0 || shift.underperforming_workspaces > 0;
19959
+ };
19960
+ const getPerformanceColor = (efficiency, date, hasData) => {
19987
19961
  const istNow = todayInZone;
19988
19962
  const nowString = `${istNow.getFullYear()}-${String(istNow.getMonth() + 1).padStart(2, "0")}-${String(istNow.getDate()).padStart(2, "0")}`;
19989
19963
  const dateString = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
19990
- if (date.getDay() === 0) return "bg-gray-300 dark:bg-gray-600";
19991
19964
  if (dateString > nowString) return "bg-gray-200 dark:bg-gray-700";
19992
- if (efficiency < 10) return "bg-gray-300 dark:bg-gray-600";
19965
+ if (!hasData) return "bg-gray-300 dark:bg-gray-600";
19993
19966
  return efficiency >= 75 ? "bg-green-500 dark:bg-green-600" : "bg-red-500 dark:bg-red-600";
19994
19967
  };
19995
19968
  const isCurrentDate = (date) => {
@@ -20008,7 +19981,7 @@ var LineHistoryCalendar = ({
20008
19981
  const istNow = todayInZone;
20009
19982
  const nowString = `${istNow.getFullYear()}-${String(istNow.getMonth() + 1).padStart(2, "0")}-${String(istNow.getDate()).padStart(2, "0")}`;
20010
19983
  const dateString = `${date.getFullYear()}-${String(date.getMonth() + 1).padStart(2, "0")}-${String(date.getDate()).padStart(2, "0")}`;
20011
- if (dateString > nowString || date.getDay() === 0) return null;
19984
+ if (dateString > nowString) return null;
20012
19985
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-black/80 rounded-lg p-2 text-white opacity-0 group-hover:opacity-100 transition-opacity", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs space-y-1", children: [
20013
19986
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
20014
19987
  "Efficiency: ",
@@ -20029,14 +20002,14 @@ var LineHistoryCalendar = ({
20029
20002
  if (!shiftData) return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full border border-gray-100 dark:border-gray-700 rounded-lg bg-gray-50 dark:bg-gray-800" });
20030
20003
  const isToday = isCurrentDate(day.date instanceof Date ? day.date : new Date(day.date));
20031
20004
  const isFuture = isFutureDate(day.date instanceof Date ? day.date : new Date(day.date));
20032
- const isInactive = (shiftData.avg_efficiency || 0) < 10;
20005
+ const hasData = hasRealData(shiftData);
20033
20006
  const dateObj = day.date instanceof Date ? day.date : new Date(day.date);
20034
20007
  return /* @__PURE__ */ jsxRuntime.jsx(
20035
20008
  "div",
20036
20009
  {
20037
- className: `group h-full ${isFuture || isInactive ? "cursor-not-allowed" : "cursor-pointer hover:opacity-90"}`,
20010
+ className: `group h-full ${isFuture || !hasData ? "cursor-not-allowed" : "cursor-pointer hover:opacity-90"}`,
20038
20011
  onClick: () => {
20039
- if (!isFuture && !isInactive) {
20012
+ if (!isFuture && hasData) {
20040
20013
  const dateObj2 = day.date instanceof Date ? day.date : new Date(day.date);
20041
20014
  const year2 = dateObj2.getFullYear();
20042
20015
  const month2 = String(dateObj2.getMonth() + 1).padStart(2, "0");
@@ -20061,15 +20034,15 @@ var LineHistoryCalendar = ({
20061
20034
  }
20062
20035
  },
20063
20036
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `
20064
- ${getPerformanceColor(shiftData.avg_efficiency || 0, dateObj)}
20037
+ ${getPerformanceColor(shiftData.avg_efficiency || 0, dateObj, hasData)}
20065
20038
  rounded-lg h-full p-2 relative
20066
20039
  ${isToday ? "ring-2 ring-blue-500 dark:ring-blue-400 ring-offset-2 dark:ring-offset-gray-800 shadow-md" : ""}
20067
20040
  `, children: [
20068
20041
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: `
20069
- text-base font-medium text-white flex items-center
20042
+ text-base font-medium ${hasData ? "text-white" : "text-gray-500"} flex items-center
20070
20043
  ${isToday ? "bg-blue-500 dark:bg-blue-600 rounded-full w-7 h-7 justify-center" : ""}
20071
20044
  `, children: dateObj.getDate() }),
20072
- !isFuture && !isInactive && renderStats(shiftData, dateObj)
20045
+ !isFuture && hasData && renderStats(shiftData, dateObj)
20073
20046
  ] })
20074
20047
  }
20075
20048
  );
@@ -21167,6 +21140,10 @@ var WorkspaceHistoryCalendar = ({
21167
21140
  const { dateTimeConfig } = useDashboardConfig();
21168
21141
  const configuredTimezone = dateTimeConfig?.defaultTimezone || "Asia/Kolkata";
21169
21142
  const [animationComplete, setAnimationComplete] = React19.useState(false);
21143
+ const hasRealData = (shift) => {
21144
+ if (shift.hasData !== void 0) return shift.hasData;
21145
+ return shift.efficiency > 0 || shift.output > 0 || shift.cycleTime > 0 || shift.pph > 0 || shift.idealOutput > 0 || shift.idleTime > 0;
21146
+ };
21170
21147
  React19.useEffect(() => {
21171
21148
  setAnimationComplete(false);
21172
21149
  const timer = setTimeout(() => {
@@ -21219,10 +21196,14 @@ var WorkspaceHistoryCalendar = ({
21219
21196
  istNow.setHours(0, 0, 0, 0);
21220
21197
  const compareDate = new Date(date);
21221
21198
  compareDate.setHours(0, 0, 0, 0);
21222
- if (date.getDay() === 0 || compareDate > istNow) {
21199
+ if (compareDate > istNow) {
21223
21200
  return [];
21224
21201
  }
21225
- return [day.dayShift, day.nightShift];
21202
+ const shiftData = selectedShift === "day" ? day.dayShift : day.nightShift;
21203
+ if (hasRealData(shiftData)) {
21204
+ return [shiftData];
21205
+ }
21206
+ return [];
21226
21207
  });
21227
21208
  if (validShifts.length === 0) return null;
21228
21209
  const badShiftsCount = validShifts.filter((shift) => shift.efficiency < 75).length;
@@ -21235,7 +21216,7 @@ var WorkspaceHistoryCalendar = ({
21235
21216
  badDaysCount: badShiftsCount,
21236
21217
  totalDays: validShifts.length
21237
21218
  };
21238
- }, [data, month, year, configuredTimezone]);
21219
+ }, [data, month, year, configuredTimezone, selectedShift]);
21239
21220
  const handleDayClick = React19.useCallback((day, shift) => {
21240
21221
  if (!day || isFutureDate(day.date)) return;
21241
21222
  const year2 = day.date.getFullYear();
@@ -21274,13 +21255,13 @@ var WorkspaceHistoryCalendar = ({
21274
21255
  compareDate.setHours(0, 0, 0, 0);
21275
21256
  return compareDate > istNow;
21276
21257
  }, [configuredTimezone]);
21277
- const getPerformanceColor = React19.useCallback((efficiency, date) => {
21258
+ const getPerformanceColor = React19.useCallback((efficiency, date, hasData) => {
21278
21259
  const istNow = getTimeInZoneAsDate(configuredTimezone);
21279
21260
  istNow.setHours(0, 0, 0, 0);
21280
21261
  const compareDate = dateFnsTz.toZonedTime(date, configuredTimezone);
21281
21262
  compareDate.setHours(0, 0, 0, 0);
21282
- if (compareDate.getDay() === 0) return "bg-gray-300";
21283
21263
  if (compareDate > istNow) return "bg-gray-200";
21264
+ if (!hasData) return "bg-gray-300";
21284
21265
  if (efficiency >= 80) return "bg-[#00AB45]/90";
21285
21266
  if (efficiency >= 70) return "bg-[#FFB020]/90";
21286
21267
  return "bg-[#E34329]/90";
@@ -21289,7 +21270,7 @@ var WorkspaceHistoryCalendar = ({
21289
21270
  const istNow = getTimeInZoneAsDate(configuredTimezone);
21290
21271
  const compareDate = dateFnsTz.toZonedTime(date, configuredTimezone);
21291
21272
  compareDate.setHours(0, 0, 0, 0);
21292
- if (compareDate > istNow || compareDate.getDay() === 0) return null;
21273
+ if (compareDate > istNow || !hasRealData(shift)) return null;
21293
21274
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 bg-black/80 rounded-lg p-2 text-white opacity-0 group-hover:opacity-100 transition-all duration-200 ease-in-out", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-xs space-y-1", children: [
21294
21275
  /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
21295
21276
  "Efficiency: ",
@@ -21341,25 +21322,26 @@ var WorkspaceHistoryCalendar = ({
21341
21322
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `h-full border border-gray-200 rounded-lg ${bgColor} ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} cursor-not-allowed opacity-60`, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-2", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `text-base font-medium ${textColor} ${isToday ? "text-blue-500" : ""}`, children: dayNumber }) }) });
21342
21323
  }
21343
21324
  const shiftData = selectedShift === "day" ? day.dayShift : day.nightShift;
21325
+ const hasData = hasRealData(shiftData);
21344
21326
  return /* @__PURE__ */ jsxRuntime.jsx(
21345
21327
  "div",
21346
21328
  {
21347
- className: `group h-full ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} ${!isFuture && animationComplete ? "cursor-pointer hover:opacity-90 hover:scale-105" : "cursor-not-allowed"}`,
21348
- onClick: () => !isFuture && handleDayClick(day, selectedShift),
21329
+ className: `group h-full ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} ${!isFuture && hasData && animationComplete ? "cursor-pointer hover:opacity-90 hover:scale-105" : "cursor-not-allowed"}`,
21330
+ onClick: () => !isFuture && hasData && handleDayClick(day, selectedShift),
21349
21331
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `
21350
- ${getPerformanceColor(shiftData.efficiency, day.date)}
21332
+ ${getPerformanceColor(shiftData.efficiency, day.date, hasData)}
21351
21333
  rounded-lg h-full p-2 relative ${animationComplete ? "transition-all duration-300 ease-in-out" : ""} shadow-sm
21352
21334
  ${isToday ? "ring-2 ring-blue-500 ring-offset-2 shadow-md" : ""}
21353
21335
  `, children: [
21354
21336
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: `
21355
- text-base font-medium text-white flex items-center ${animationComplete ? "transition-all duration-300 ease-in-out" : ""}
21337
+ text-base font-medium ${hasData ? "text-white" : "text-gray-500"} flex items-center ${animationComplete ? "transition-all duration-300 ease-in-out" : ""}
21356
21338
  ${isToday ? "bg-blue-500 rounded-full w-7 h-7 justify-center" : ""}
21357
21339
  `, children: day.date.getDate() }),
21358
- !isFuture && animationComplete && renderStats(shiftData, day.date)
21340
+ !isFuture && hasData && animationComplete && renderStats(shiftData, day.date)
21359
21341
  ] })
21360
21342
  }
21361
21343
  );
21362
- }, [selectedShift, isCurrentDate, isFutureDate, getPerformanceColor, handleDayClick, year, month, configuredTimezone, animationComplete]);
21344
+ }, [selectedShift, isCurrentDate, isFutureDate, getPerformanceColor, handleDayClick, year, month, configuredTimezone, animationComplete, hasRealData]);
21363
21345
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `calendar-wrapper space-y-6 ${className || ""} ${animationComplete ? "animation-complete" : ""}`, children: [
21364
21346
  /* @__PURE__ */ jsxRuntime.jsx("style", { dangerouslySetInnerHTML: { __html: styles } }),
21365
21347
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex gap-1 border border-gray-200 rounded-lg p-1 bg-gray-50", children: [
@@ -21397,7 +21379,10 @@ var WorkspaceHistoryCalendar = ({
21397
21379
  ] }),
21398
21380
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "calendar-container bg-white rounded-xl shadow-sm border border-gray-100 p-6 transition-all duration-200 ease-in-out", children: [
21399
21381
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-6", children: [
21400
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "font-semibold text-gray-900 text-lg", children: "Monthly Summary" }),
21382
+ /* @__PURE__ */ jsxRuntime.jsxs("h3", { className: "font-semibold text-gray-900 text-lg", children: [
21383
+ "Monthly Summary - ",
21384
+ selectedShift === "day" ? "Day Shift" : "Night Shift"
21385
+ ] }),
21401
21386
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 mt-1", children: "Overview of monthly performance metrics" })
21402
21387
  ] }),
21403
21388
  monthlyMetrics ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "grid grid-cols-1 gap-4", children: [
@@ -22133,10 +22118,7 @@ var LoadingOverlay = ({
22133
22118
  className: `fixed inset-0 z-[100] flex items-center justify-center bg-black/30 backdrop-blur-sm ${className || ""}`,
22134
22119
  "aria-modal": "true",
22135
22120
  role: "dialog",
22136
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center space-y-3 rounded-lg bg-white p-8 shadow-xl", children: [
22137
- /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size: "md" }),
22138
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-base font-medium text-gray-700", children: message })
22139
- ] })
22121
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-col items-center space-y-3 rounded-lg bg-white p-8 shadow-xl", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message }) })
22140
22122
  }
22141
22123
  );
22142
22124
  };
@@ -22961,20 +22943,6 @@ var S3ClipsService = class {
22961
22943
  return videos;
22962
22944
  }
22963
22945
  };
22964
- var LoadingSpinner2 = ({
22965
- size = "md",
22966
- message = "Loading..."
22967
- }) => {
22968
- const sizeClasses = {
22969
- sm: "w-4 h-4",
22970
- md: "w-6 h-6",
22971
- lg: "w-8 h-8"
22972
- };
22973
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center justify-center", children: [
22974
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${sizeClasses[size]} border-2 border-t-blue-500 border-r-blue-500 border-b-gray-200 border-l-gray-200 rounded-full animate-spin mb-2` }),
22975
- message && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-gray-600 text-sm", children: message })
22976
- ] });
22977
- };
22978
22946
  var BottlenecksContent = ({
22979
22947
  workspaceId,
22980
22948
  workspaceName,
@@ -23493,7 +23461,7 @@ var BottlenecksContent = ({
23493
23461
  ] });
23494
23462
  }
23495
23463
  if (isLoading && allVideos.length === 0) {
23496
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow p-4 flex items-center justify-center h-[calc(100vh-12rem)]", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner2, { size: "lg", message: "Loading clips..." }) });
23464
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-grow p-4 flex items-center justify-center h-[calc(100vh-12rem)]", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "lg", message: "Loading clips..." }) });
23497
23465
  }
23498
23466
  if (error) {
23499
23467
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-grow p-4 flex flex-col items-center justify-center h-[calc(100vh-12rem)] text-center", children: [
@@ -23671,7 +23639,7 @@ var BottlenecksContent = ({
23671
23639
  }
23672
23640
  )
23673
23641
  ] }),
23674
- isLoading && allVideos.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner2, { size: "md", message: "Loading clips..." }) }) : allVideos.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center p-8", children: [
23642
+ isLoading && allVideos.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading clips..." }) }) : allVideos.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center h-[calc(100%-4rem)]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center p-8", children: [
23675
23643
  /* @__PURE__ */ jsxRuntime.jsx("svg", { className: "w-16 h-16 text-gray-300 mx-auto mb-4", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) }),
23676
23644
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-xl font-medium text-gray-700 mb-2", children: "No Clips Found" }),
23677
23645
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-gray-500", children: "There were no video clips found for this workspace today." })
@@ -25361,11 +25329,8 @@ var LoadingState = ({
25361
25329
  className = ""
25362
25330
  }) => {
25363
25331
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `flex h-full w-full items-center justify-center bg-gray-50/50 ${className}`, children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center space-y-4 text-center", children: [
25364
- /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size }),
25365
- /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
25366
- /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-medium text-gray-900", children: message }),
25367
- subMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-gray-600", children: subMessage })
25368
- ] })
25332
+ /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size, message }),
25333
+ subMessage && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-1 text-sm text-gray-600", children: subMessage })
25369
25334
  ] }) });
25370
25335
  };
25371
25336
  var LoadingSkeleton = ({
@@ -25392,10 +25357,7 @@ var LoadingSkeleton = ({
25392
25357
  /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-6 w-1/3" }),
25393
25358
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative", children: [
25394
25359
  /* @__PURE__ */ jsxRuntime.jsx(Skeleton, { className: "h-64 w-full" }),
25395
- showLoadingIndicator && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white/80 rounded-lg p-3 shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "animate-spin h-6 w-6 text-blue-500", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
25396
- /* @__PURE__ */ jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
25397
- /* @__PURE__ */ jsxRuntime.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
25398
- ] }) }) })
25360
+ showLoadingIndicator && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white/80 rounded-lg p-3 shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm" }) }) })
25399
25361
  ] })
25400
25362
  ] });
25401
25363
  case "table":
@@ -25446,10 +25408,7 @@ var LoadingInline = ({
25446
25408
  size = "sm",
25447
25409
  className = ""
25448
25410
  }) => {
25449
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `inline-flex items-center space-x-2 ${className}`, children: [
25450
- /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size }),
25451
- message && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm text-gray-600", children: message })
25452
- ] });
25411
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: `inline-flex items-center space-x-2 ${className}`, children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size, message }) });
25453
25412
  };
25454
25413
  var DEFAULT_HLS_CONFIG = {
25455
25414
  maxBufferLength: 15,
@@ -25678,7 +25637,7 @@ var ThreadSidebar = ({
25678
25637
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Chat History" }),
25679
25638
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-500 mt-1", children: "Your previous conversations" })
25680
25639
  ] }),
25681
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto min-h-0", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center p-8", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size: "sm" }) }) : threads.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-gray-500 text-sm", children: "No conversations yet" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2", children: threads.map((thread) => /* @__PURE__ */ jsxRuntime.jsxs(
25640
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 overflow-y-auto min-h-0", children: isLoading ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center p-8", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm" }) }) : threads.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "p-4 text-center text-gray-500 text-sm", children: "No conversations yet" }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "py-2", children: threads.map((thread) => /* @__PURE__ */ jsxRuntime.jsxs(
25682
25641
  "div",
25683
25642
  {
25684
25643
  onClick: () => onSelectThread(thread.id),
@@ -25689,7 +25648,7 @@ var ThreadSidebar = ({
25689
25648
  /* @__PURE__ */ jsxRuntime.jsx("h3", { className: `text-sm font-medium truncate ${activeThreadId === thread.id ? "text-blue-900" : "text-gray-900"}`, children: thread.title || "Untitled Chat" }),
25690
25649
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: `text-xs mt-0.5 ${activeThreadId === thread.id ? "text-blue-700" : "text-gray-500"}`, children: formatDate(thread.created_at) })
25691
25650
  ] }),
25692
- deletingId === thread.id ? /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size: "sm", className: "flex-shrink-0" }) : /* @__PURE__ */ jsxRuntime.jsx(
25651
+ deletingId === thread.id ? /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm", className: "flex-shrink-0" }) : /* @__PURE__ */ jsxRuntime.jsx(
25693
25652
  "button",
25694
25653
  {
25695
25654
  onClick: (e) => handleDelete(e, thread.id),
@@ -27450,7 +27409,13 @@ var AIAgentView = () => {
27450
27409
  {
27451
27410
  className: `relative px-5 py-4 rounded-2xl shadow-sm ${message.role === "user" ? "bg-blue-600 text-white max-w-[85%] ml-auto" : "bg-white border border-gray-200/80 max-w-full"}`,
27452
27411
  children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${message.role === "user" ? "text-white" : "text-gray-800"}`, children: [
27453
- message.role === "assistant" ? renderAssistantContent(message.content) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap leading-relaxed", children: message.content }),
27412
+ message.role === "assistant" ? message.id === -1 ? /* @__PURE__ */ jsxRuntime.jsx(
27413
+ "div",
27414
+ {
27415
+ className: "formatted-content",
27416
+ dangerouslySetInnerHTML: { __html: formatMessage(message.content) }
27417
+ }
27418
+ ) : renderAssistantContent(message.content) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap leading-relaxed", children: message.content }),
27454
27419
  message.id === -1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-0.5 h-4 bg-gray-400 animate-pulse ml-0.5" })
27455
27420
  ] })
27456
27421
  }
@@ -27480,7 +27445,13 @@ var AIAgentView = () => {
27480
27445
  className: `relative px-5 py-4 rounded-2xl shadow-sm ${message.role === "user" ? "bg-blue-600 text-white max-w-[85%] ml-auto" : "bg-white border border-gray-200/80 max-w-full"}`,
27481
27446
  children: [
27482
27447
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${message.role === "user" ? "text-white" : "text-gray-800"}`, children: [
27483
- message.role === "assistant" ? renderAssistantContent(message.content) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap leading-relaxed", children: message.content }),
27448
+ message.role === "assistant" ? message.id === -1 ? /* @__PURE__ */ jsxRuntime.jsx(
27449
+ "div",
27450
+ {
27451
+ className: "formatted-content",
27452
+ dangerouslySetInnerHTML: { __html: formatMessage(message.content) }
27453
+ }
27454
+ ) : renderAssistantContent(message.content) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: "whitespace-pre-wrap leading-relaxed", children: message.content }),
27484
27455
  message.id === -1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "inline-block w-0.5 h-4 bg-gray-400 animate-pulse ml-0.5" })
27485
27456
  ] }),
27486
27457
  message.role === "assistant" && message.id !== -1 && /* @__PURE__ */ jsxRuntime.jsx(
@@ -28502,7 +28473,7 @@ var HelpView = ({
28502
28473
  disabled: isSubmitting,
28503
28474
  className: "px-4 py-2 bg-blue-600 hover:bg-blue-700 text-white font-medium rounded-lg transition-all duration-200 disabled:opacity-50 disabled:cursor-not-allowed flex items-center gap-2 shadow-sm text-sm",
28504
28475
  children: isSubmitting ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
28505
- /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { className: "h-4 w-4" }),
28476
+ /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm" }),
28506
28477
  "Submitting..."
28507
28478
  ] }) : "Submit Ticket"
28508
28479
  }
@@ -28687,7 +28658,7 @@ function HomeView({
28687
28658
  ) }) }),
28688
28659
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 overflow-y-auto sm:overflow-hidden relative", children: [
28689
28660
  lineSelectorComponent && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute right-3 top-2 sm:right-6 sm:top-3 z-30", children: lineSelectorComponent }),
28690
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full sm:h-full min-h-[calc(100vh-80px)] sm:min-h-0", children: isDataLoading && hasInitialDataLoaded && memoizedWorkspaceMetrics.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 sm:px-6 lg:px-8 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSkeleton, { type: "workspace-card", count: 8, className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4" }) }) : memoizedWorkspaceMetrics.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
28661
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-full sm:h-full min-h-[calc(100vh-80px)] sm:min-h-0", children: isDataLoading || !hasInitialDataLoaded ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 sm:px-6 lg:px-8 py-4", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSkeleton, { type: "workspace-card", count: 8, className: "grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-4" }) }) : memoizedWorkspaceMetrics.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
28691
28662
  motion.div,
28692
28663
  {
28693
28664
  initial: { opacity: 0, scale: 0.98 },
@@ -30314,7 +30285,7 @@ var ProfileView = () => {
30314
30285
  }
30315
30286
  };
30316
30287
  if (authLoading || loading) {
30317
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size: "lg" }) });
30288
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "lg" }) });
30318
30289
  }
30319
30290
  if (!user) {
30320
30291
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center justify-center min-h-screen", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "text-center", children: [
@@ -30471,7 +30442,7 @@ var ProfileView = () => {
30471
30442
  ] })
30472
30443
  ] }),
30473
30444
  isEditing && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mt-6 flex gap-3", children: /* @__PURE__ */ jsxRuntime.jsx(Button2, { variant: "outline", onClick: handleSaveProfile, disabled: loading, children: loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
30474
- /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size: "sm", className: "mr-2" }),
30445
+ /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm", className: "mr-2" }),
30475
30446
  "Saving..."
30476
30447
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
30477
30448
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "h-4 w-4 mr-2" }),
@@ -30535,7 +30506,7 @@ var ProfileView = () => {
30535
30506
  disabled: loading,
30536
30507
  className: "flex items-center gap-2 text-red-600 hover:text-red-700 border-red-200 hover:border-red-300",
30537
30508
  children: loading ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
30538
- /* @__PURE__ */ jsxRuntime.jsx(LoadingSpinner_default, { size: "sm", className: "mr-2" }),
30509
+ /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm", className: "mr-2" }),
30539
30510
  "Signing out..."
30540
30511
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
30541
30512
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.LogOut, { className: "h-4 w-4" }),
@@ -31982,7 +31953,7 @@ var SKUList = ({
31982
31953
  }) => {
31983
31954
  if (isLoading) {
31984
31955
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white rounded-xl shadow-sm border border-gray-200 p-8", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex justify-center items-center", children: [
31985
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600" }),
31956
+ /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md" }),
31986
31957
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: "ml-3 text-gray-600", children: "Loading SKUs..." })
31987
31958
  ] }) });
31988
31959
  }
@@ -32068,7 +32039,7 @@ var TargetsViewUI = ({
32068
32039
  skuRequired = false
32069
32040
  }) => {
32070
32041
  if (isLoading) {
32071
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-screen bg-gray-50", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-8 h-8 animate-spin text-blue-600" }) }) });
32042
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex h-screen bg-gray-50", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "lg", message: "Loading targets..." }) }) });
32072
32043
  }
32073
32044
  return /* @__PURE__ */ jsxRuntime.jsxs("main", { className: "min-h-screen flex-1 bg-gray-50", children: [
32074
32045
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white px-8 py-6 shadow-sm border-b border-gray-200/80", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between relative", children: [
@@ -32170,7 +32141,7 @@ var TargetsViewUI = ({
32170
32141
  className: `ml-6 inline-flex items-center px-4 py-2 text-sm font-medium rounded-lg transition-all duration-200
32171
32142
  ${savingLines[lineId] ? "bg-gray-100 text-gray-400 cursor-not-allowed" : "bg-blue-600 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"}`,
32172
32143
  children: savingLines[lineId] ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
32173
- /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Loader2, { className: "w-4 h-4 mr-2 animate-spin" }),
32144
+ /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "sm", className: "mr-2" }),
32174
32145
  "Saving..."
32175
32146
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
32176
32147
  /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Save, { className: "w-4 h-4 mr-2" }),
@@ -33308,13 +33279,7 @@ var WorkspaceDetailView = ({
33308
33279
  ] }) }, i)) }),
33309
33280
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white rounded-lg p-6 shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "animate-pulse", children: [
33310
33281
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-6 w-40 bg-gray-200 rounded mb-4" }),
33311
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-64 bg-gray-100 rounded relative overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "bg-white/80 rounded-lg p-4 shadow-sm", children: [
33312
- /* @__PURE__ */ jsxRuntime.jsxs("svg", { className: "animate-spin h-8 w-8 text-blue-500", xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
33313
- /* @__PURE__ */ jsxRuntime.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
33314
- /* @__PURE__ */ jsxRuntime.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
33315
- ] }),
33316
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm text-gray-600 mt-2", children: "Loading chart data..." })
33317
- ] }) }) })
33282
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "h-64 bg-gray-100 rounded relative overflow-hidden", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "bg-white/80 rounded-lg p-4 shadow-sm", children: /* @__PURE__ */ jsxRuntime.jsx(OptifyeLogoLoader_default, { size: "md", message: "Loading chart data..." }) }) }) })
33318
33283
  ] }) })
33319
33284
  ] })
33320
33285
  ] })
@@ -34208,7 +34173,6 @@ exports.LoadingInline = LoadingInline;
34208
34173
  exports.LoadingOverlay = LoadingOverlay_default;
34209
34174
  exports.LoadingPage = LoadingPage_default;
34210
34175
  exports.LoadingSkeleton = LoadingSkeleton;
34211
- exports.LoadingSpinner = LoadingSpinner_default;
34212
34176
  exports.LoadingState = LoadingState;
34213
34177
  exports.LoginPage = LoginPage;
34214
34178
  exports.LoginView = LoginView_default;
@@ -34216,6 +34180,7 @@ exports.MainLayout = MainLayout;
34216
34180
  exports.MetricCard = MetricCard_default;
34217
34181
  exports.NoWorkspaceData = NoWorkspaceData;
34218
34182
  exports.OptifyeAgentClient = OptifyeAgentClient;
34183
+ exports.OptifyeLogoLoader = OptifyeLogoLoader_default;
34219
34184
  exports.OutputProgressChart = OutputProgressChart;
34220
34185
  exports.PageHeader = PageHeader;
34221
34186
  exports.PieChart = PieChart4;