@optifye/dashboard-core 6.10.41 → 6.10.42

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
@@ -56998,7 +56998,11 @@ var KPIDetailView = ({
56998
56998
  underperforming_workspaces: metric.underperforming_workspaces || 0,
56999
56999
  total_workspaces: metric.total_workspaces || 0,
57000
57000
  output: metric.current_output || 0,
57001
- targetOutput: Number(metric.line_threshold || 0),
57001
+ // LineMonthlyHistory expects `idealOutput` for the red dotted target ReferenceLine.
57002
+ // `line_threshold` comes from `line_metrics` (numeric -> string via PostgREST), so coerce.
57003
+ idealOutput: Number(metric.line_threshold ?? metric.ideal_output ?? 0),
57004
+ // Keep legacy field in case any downstream code still reads it.
57005
+ targetOutput: Number(metric.line_threshold ?? metric.ideal_output ?? 0),
57002
57006
  compliance_percentage: 95 + Math.random() * 5,
57003
57007
  // Mock data: random value between 95-100%
57004
57008
  hasData: isUptimeMode ? availableTimeSeconds > 0 : true,
@@ -65936,8 +65940,8 @@ var TeamManagementView = ({
65936
65940
  }, {});
65937
65941
  }, [usageData, usageDateRange.daysElapsed]);
65938
65942
  const pageTitle = user?.role_level === "optifye" ? "Platform Users" : "Team Management";
65939
- const pageDescription = user?.role_level === "optifye" ? "Manage users across all companies" : user?.role_level === "owner" ? "Manage team members and view their daily usage" : "Manage supervisors in your factory";
65940
- const hasAccess = user ? user.role_level === void 0 || ["optifye", "owner", "plant_head"].includes(user.role_level) : false;
65943
+ const pageDescription = user?.role_level === "optifye" ? "Manage users across all companies" : user?.role_level === "owner" || user?.role_level === "it" ? "Manage team members and view their daily usage" : "Manage supervisors in your factory";
65944
+ const hasAccess = user ? user.role_level === void 0 || ["optifye", "owner", "it", "plant_head"].includes(user.role_level) : false;
65941
65945
  const loadData = React26.useCallback(async () => {
65942
65946
  if (!supabase) {
65943
65947
  setError("Supabase client not available. Please refresh the page.");
@@ -65988,7 +65992,7 @@ var TeamManagementView = ({
65988
65992
  setAvailableFactories(factories || []);
65989
65993
  setAvailableLines(lines);
65990
65994
  console.log("[TeamManagementView] Optifye - Loaded factories:", factories?.length, "lines:", lines?.length, "Sample lines:", lines?.slice(0, 3));
65991
- } else if (user?.role_level === "owner" && companyId) {
65995
+ } else if ((user?.role_level === "owner" || user?.role_level === "it") && companyId) {
65992
65996
  const { data: factories } = await supabase.from("factories").select("id, factory_name, company_id").eq("company_id", companyId).order("factory_name");
65993
65997
  const linesResponse = await fetch(`${backendUrl}/api/lines?company_id=${companyId}`, {
65994
65998
  headers: {
@@ -66003,7 +66007,7 @@ var TeamManagementView = ({
66003
66007
  const lines = linesData.lines || [];
66004
66008
  setAvailableFactories(factories || []);
66005
66009
  setAvailableLines(lines);
66006
- console.log("[TeamManagementView] Owner - Company:", companyId, "Loaded factories:", factories?.length, "lines:", lines?.length);
66010
+ console.log("[TeamManagementView] Owner/IT - Company:", companyId, "Loaded factories:", factories?.length, "lines:", lines?.length);
66007
66011
  } else if (user?.role_level === "plant_head") {
66008
66012
  const plantHeadFactoryIds = user?.properties?.factory_ids || [];
66009
66013
  if (plantHeadFactoryIds.length > 0) {
@@ -66096,7 +66100,8 @@ var TeamManagementView = ({
66096
66100
  }
66097
66101
  }, [supabase, user, entityConfig]);
66098
66102
  React26.useEffect(() => {
66099
- const canLoad = hasAccess && user && (user.role_level === "optifye" || entityConfig?.companyId);
66103
+ const companyId = entityConfig?.companyId || user?.properties?.company_id;
66104
+ const canLoad = hasAccess && user && (user.role_level === "optifye" || !!companyId);
66100
66105
  if (canLoad) {
66101
66106
  loadData();
66102
66107
  } else if (!user) {
@@ -66196,7 +66201,7 @@ var TeamManagementView = ({
66196
66201
  {
66197
66202
  iconType: lucideReact.AlertCircle,
66198
66203
  title: "Access Denied",
66199
- message: "You don't have permission to view this page. Only owners and plant heads can access team management."
66204
+ message: "You don't have permission to view this page. Only owners, IT, plant heads, and Optifye users can access team management."
66200
66205
  }
66201
66206
  ) });
66202
66207
  }
package/dist/index.mjs CHANGED
@@ -56969,7 +56969,11 @@ var KPIDetailView = ({
56969
56969
  underperforming_workspaces: metric.underperforming_workspaces || 0,
56970
56970
  total_workspaces: metric.total_workspaces || 0,
56971
56971
  output: metric.current_output || 0,
56972
- targetOutput: Number(metric.line_threshold || 0),
56972
+ // LineMonthlyHistory expects `idealOutput` for the red dotted target ReferenceLine.
56973
+ // `line_threshold` comes from `line_metrics` (numeric -> string via PostgREST), so coerce.
56974
+ idealOutput: Number(metric.line_threshold ?? metric.ideal_output ?? 0),
56975
+ // Keep legacy field in case any downstream code still reads it.
56976
+ targetOutput: Number(metric.line_threshold ?? metric.ideal_output ?? 0),
56973
56977
  compliance_percentage: 95 + Math.random() * 5,
56974
56978
  // Mock data: random value between 95-100%
56975
56979
  hasData: isUptimeMode ? availableTimeSeconds > 0 : true,
@@ -65907,8 +65911,8 @@ var TeamManagementView = ({
65907
65911
  }, {});
65908
65912
  }, [usageData, usageDateRange.daysElapsed]);
65909
65913
  const pageTitle = user?.role_level === "optifye" ? "Platform Users" : "Team Management";
65910
- const pageDescription = user?.role_level === "optifye" ? "Manage users across all companies" : user?.role_level === "owner" ? "Manage team members and view their daily usage" : "Manage supervisors in your factory";
65911
- const hasAccess = user ? user.role_level === void 0 || ["optifye", "owner", "plant_head"].includes(user.role_level) : false;
65914
+ const pageDescription = user?.role_level === "optifye" ? "Manage users across all companies" : user?.role_level === "owner" || user?.role_level === "it" ? "Manage team members and view their daily usage" : "Manage supervisors in your factory";
65915
+ const hasAccess = user ? user.role_level === void 0 || ["optifye", "owner", "it", "plant_head"].includes(user.role_level) : false;
65912
65916
  const loadData = useCallback(async () => {
65913
65917
  if (!supabase) {
65914
65918
  setError("Supabase client not available. Please refresh the page.");
@@ -65959,7 +65963,7 @@ var TeamManagementView = ({
65959
65963
  setAvailableFactories(factories || []);
65960
65964
  setAvailableLines(lines);
65961
65965
  console.log("[TeamManagementView] Optifye - Loaded factories:", factories?.length, "lines:", lines?.length, "Sample lines:", lines?.slice(0, 3));
65962
- } else if (user?.role_level === "owner" && companyId) {
65966
+ } else if ((user?.role_level === "owner" || user?.role_level === "it") && companyId) {
65963
65967
  const { data: factories } = await supabase.from("factories").select("id, factory_name, company_id").eq("company_id", companyId).order("factory_name");
65964
65968
  const linesResponse = await fetch(`${backendUrl}/api/lines?company_id=${companyId}`, {
65965
65969
  headers: {
@@ -65974,7 +65978,7 @@ var TeamManagementView = ({
65974
65978
  const lines = linesData.lines || [];
65975
65979
  setAvailableFactories(factories || []);
65976
65980
  setAvailableLines(lines);
65977
- console.log("[TeamManagementView] Owner - Company:", companyId, "Loaded factories:", factories?.length, "lines:", lines?.length);
65981
+ console.log("[TeamManagementView] Owner/IT - Company:", companyId, "Loaded factories:", factories?.length, "lines:", lines?.length);
65978
65982
  } else if (user?.role_level === "plant_head") {
65979
65983
  const plantHeadFactoryIds = user?.properties?.factory_ids || [];
65980
65984
  if (plantHeadFactoryIds.length > 0) {
@@ -66067,7 +66071,8 @@ var TeamManagementView = ({
66067
66071
  }
66068
66072
  }, [supabase, user, entityConfig]);
66069
66073
  useEffect(() => {
66070
- const canLoad = hasAccess && user && (user.role_level === "optifye" || entityConfig?.companyId);
66074
+ const companyId = entityConfig?.companyId || user?.properties?.company_id;
66075
+ const canLoad = hasAccess && user && (user.role_level === "optifye" || !!companyId);
66071
66076
  if (canLoad) {
66072
66077
  loadData();
66073
66078
  } else if (!user) {
@@ -66167,7 +66172,7 @@ var TeamManagementView = ({
66167
66172
  {
66168
66173
  iconType: AlertCircle,
66169
66174
  title: "Access Denied",
66170
- message: "You don't have permission to view this page. Only owners and plant heads can access team management."
66175
+ message: "You don't have permission to view this page. Only owners, IT, plant heads, and Optifye users can access team management."
66171
66176
  }
66172
66177
  ) });
66173
66178
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optifye/dashboard-core",
3
- "version": "6.10.41",
3
+ "version": "6.10.42",
4
4
  "description": "Reusable UI & logic for Optifye dashboard",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",