@optifye/dashboard-core 4.2.9 → 4.3.4
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 +39 -1
- package/dist/index.d.ts +39 -1
- package/dist/index.js +734 -21
- package/dist/index.mjs +732 -22
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -10,7 +10,7 @@ import Hls2 from 'hls.js';
|
|
|
10
10
|
import useSWR from 'swr';
|
|
11
11
|
import { noop, warning, invariant, progress, secondsToMilliseconds, millisecondsToSeconds, memo as memo$1 } from 'motion-utils';
|
|
12
12
|
import { getValueTransition, hover, press, isPrimaryPointer, GroupPlaybackControls, setDragLock, supportsLinearEasing, attachTimeline, isGenerator, calcGeneratorDuration, isWaapiSupportedEasing, mapEasingToNativeEasing, maxGeneratorDuration, generateLinearEasing, isBezierDefinition } from 'motion-dom';
|
|
13
|
-
import { Bar, LabelList, ResponsiveContainer, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, ReferenceLine, Cell, PieChart, Pie, Legend, LineChart as LineChart$1, Line } from 'recharts';
|
|
13
|
+
import { Bar, LabelList, ResponsiveContainer, BarChart as BarChart$1, CartesianGrid, XAxis, YAxis, Tooltip, ReferenceLine, Cell, PieChart, Pie, Legend, LineChart as LineChart$1, Line, ComposedChart, Area, ScatterChart, Scatter } from 'recharts';
|
|
14
14
|
import { Slot } from '@radix-ui/react-slot';
|
|
15
15
|
import { Camera, ChevronDown, ChevronUp, Check, ShieldCheck, Star, Award, X, Coffee, Plus, Clock, Minus, ArrowDown, ArrowUp, Search, CheckCircle, AlertTriangle, Info, Share2, Download, User, XCircle, ChevronLeft, ChevronRight, AlertCircle, Sun, Moon, MessageSquare, Trash2, ArrowLeft, RefreshCw, Menu, Send, Copy, Edit2, UserCheck, Save, LogOut, Calendar, Settings, LifeBuoy, Loader2, ArrowLeftIcon as ArrowLeftIcon$1, Settings2, CheckCircle2, EyeOff, Eye, Zap, UserCircle } from 'lucide-react';
|
|
16
16
|
import { DayPicker, useNavigation as useNavigation$1 } from 'react-day-picker';
|
|
@@ -2080,28 +2080,42 @@ var AuthProvider = ({ children }) => {
|
|
|
2080
2080
|
id: supabaseUser.id,
|
|
2081
2081
|
email: supabaseUser.email
|
|
2082
2082
|
};
|
|
2083
|
-
if (!
|
|
2083
|
+
if (!supabase) return basicUser;
|
|
2084
2084
|
try {
|
|
2085
2085
|
const timeoutPromise = new Promise(
|
|
2086
2086
|
(_, reject) => setTimeout(() => reject(new Error("Profile fetch timeout")), 5e3)
|
|
2087
2087
|
);
|
|
2088
|
-
const
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2088
|
+
const rolePromise = supabase.from("user_roles").select("role_level").eq("user_id", supabaseUser.id).single();
|
|
2089
|
+
let profilePromise = null;
|
|
2090
|
+
if (userProfileTable) {
|
|
2091
|
+
profilePromise = supabase.from(userProfileTable).select(roleColumn).eq("id", supabaseUser.id).single();
|
|
2092
|
+
}
|
|
2093
|
+
const [roleResult, profileResult] = await Promise.race([
|
|
2094
|
+
Promise.all([
|
|
2095
|
+
rolePromise,
|
|
2096
|
+
profilePromise || Promise.resolve(null)
|
|
2097
|
+
]),
|
|
2098
|
+
timeoutPromise.then(() => {
|
|
2099
|
+
throw new Error("Timeout");
|
|
2100
|
+
})
|
|
2092
2101
|
]);
|
|
2093
|
-
|
|
2094
|
-
|
|
2095
|
-
|
|
2096
|
-
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2102
|
+
let roleLevel = void 0;
|
|
2103
|
+
if (roleResult && !roleResult.error && roleResult.data) {
|
|
2104
|
+
roleLevel = roleResult.data.role_level;
|
|
2105
|
+
} else if (roleResult?.error) {
|
|
2106
|
+
console.log("Error fetching role_level:", roleResult.error.message);
|
|
2107
|
+
}
|
|
2108
|
+
let roleValue = void 0;
|
|
2109
|
+
if (profileResult && !profileResult.error && profileResult.data) {
|
|
2110
|
+
roleValue = profileResult.data[roleColumn];
|
|
2100
2111
|
}
|
|
2101
|
-
|
|
2102
|
-
|
|
2112
|
+
return {
|
|
2113
|
+
...basicUser,
|
|
2114
|
+
role: roleValue,
|
|
2115
|
+
role_level: roleLevel
|
|
2116
|
+
};
|
|
2103
2117
|
} catch (err) {
|
|
2104
|
-
console.error("Error fetching user
|
|
2118
|
+
console.error("Error fetching user details:", err);
|
|
2105
2119
|
return basicUser;
|
|
2106
2120
|
}
|
|
2107
2121
|
}, [supabase, userProfileTable, roleColumn]);
|
|
@@ -2136,7 +2150,8 @@ var AuthProvider = ({ children }) => {
|
|
|
2136
2150
|
email: userDetails.email,
|
|
2137
2151
|
name: userDetails.email,
|
|
2138
2152
|
// using email as the display name for now
|
|
2139
|
-
role: userDetails.role
|
|
2153
|
+
role: userDetails.role,
|
|
2154
|
+
role_level: userDetails.role_level
|
|
2140
2155
|
});
|
|
2141
2156
|
}
|
|
2142
2157
|
}
|
|
@@ -2174,7 +2189,8 @@ var AuthProvider = ({ children }) => {
|
|
|
2174
2189
|
identifyCoreUser(userDetails.id, {
|
|
2175
2190
|
email: userDetails.email,
|
|
2176
2191
|
name: userDetails.email,
|
|
2177
|
-
role: userDetails.role
|
|
2192
|
+
role: userDetails.role,
|
|
2193
|
+
role_level: userDetails.role_level
|
|
2178
2194
|
});
|
|
2179
2195
|
}
|
|
2180
2196
|
}
|
|
@@ -17960,6 +17976,187 @@ var SOPComplianceChart = ({
|
|
|
17960
17976
|
renderLegend()
|
|
17961
17977
|
] });
|
|
17962
17978
|
};
|
|
17979
|
+
var GaugeChart = ({
|
|
17980
|
+
value,
|
|
17981
|
+
min,
|
|
17982
|
+
max,
|
|
17983
|
+
target,
|
|
17984
|
+
label,
|
|
17985
|
+
unit = "",
|
|
17986
|
+
thresholds,
|
|
17987
|
+
className = ""
|
|
17988
|
+
}) => {
|
|
17989
|
+
const normalizedValue = (value - min) / (max - min) * 100;
|
|
17990
|
+
const clampedValue = Math.max(0, Math.min(100, normalizedValue));
|
|
17991
|
+
const data = [
|
|
17992
|
+
{ name: "value", value: clampedValue },
|
|
17993
|
+
{ name: "empty", value: 100 - clampedValue }
|
|
17994
|
+
];
|
|
17995
|
+
const getColor = () => {
|
|
17996
|
+
if (thresholds && thresholds.length > 0) {
|
|
17997
|
+
const sortedThresholds = [...thresholds].sort((a, b) => a.value - b.value);
|
|
17998
|
+
for (let i = sortedThresholds.length - 1; i >= 0; i--) {
|
|
17999
|
+
if (value >= sortedThresholds[i].value) {
|
|
18000
|
+
return sortedThresholds[i].color;
|
|
18001
|
+
}
|
|
18002
|
+
}
|
|
18003
|
+
return sortedThresholds[0].color;
|
|
18004
|
+
}
|
|
18005
|
+
if (clampedValue < 33) return "#ef4444";
|
|
18006
|
+
if (clampedValue < 66) return "#f59e0b";
|
|
18007
|
+
return "#10b981";
|
|
18008
|
+
};
|
|
18009
|
+
const gaugeColor = getColor();
|
|
18010
|
+
const targetAngle = target !== void 0 ? 180 - (target - min) / (max - min) * 180 : null;
|
|
18011
|
+
return /* @__PURE__ */ jsx("div", { className: `relative w-full h-full flex flex-col items-center justify-center ${className}`, children: /* @__PURE__ */ jsxs("div", { className: "relative w-full max-w-[280px] aspect-square", children: [
|
|
18012
|
+
/* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsx(PieChart, { children: /* @__PURE__ */ jsxs(
|
|
18013
|
+
Pie,
|
|
18014
|
+
{
|
|
18015
|
+
data,
|
|
18016
|
+
cx: "50%",
|
|
18017
|
+
cy: "50%",
|
|
18018
|
+
startAngle: 180,
|
|
18019
|
+
endAngle: 0,
|
|
18020
|
+
innerRadius: "65%",
|
|
18021
|
+
outerRadius: "85%",
|
|
18022
|
+
paddingAngle: 0,
|
|
18023
|
+
dataKey: "value",
|
|
18024
|
+
animationBegin: 0,
|
|
18025
|
+
animationDuration: 1e3,
|
|
18026
|
+
animationEasing: "ease-out",
|
|
18027
|
+
children: [
|
|
18028
|
+
/* @__PURE__ */ jsx(Cell, { fill: gaugeColor }),
|
|
18029
|
+
/* @__PURE__ */ jsx(Cell, { fill: "#f3f4f6" })
|
|
18030
|
+
]
|
|
18031
|
+
}
|
|
18032
|
+
) }) }),
|
|
18033
|
+
targetAngle !== null && /* @__PURE__ */ jsx(
|
|
18034
|
+
"div",
|
|
18035
|
+
{
|
|
18036
|
+
className: "absolute top-1/2 left-1/2 w-1 h-[42%] bg-gray-800 origin-bottom",
|
|
18037
|
+
style: {
|
|
18038
|
+
transform: `translate(-50%, -100%) rotate(${targetAngle}deg)`,
|
|
18039
|
+
transition: "transform 0.3s ease-out"
|
|
18040
|
+
},
|
|
18041
|
+
children: /* @__PURE__ */ jsx("div", { className: "absolute -top-1 -left-1.5 w-3 h-3 bg-gray-800 rounded-full" })
|
|
18042
|
+
}
|
|
18043
|
+
),
|
|
18044
|
+
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 flex flex-col items-center justify-center", children: /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
18045
|
+
/* @__PURE__ */ jsxs("div", { className: "text-3xl font-bold text-gray-800", children: [
|
|
18046
|
+
value.toFixed(unit === "%" ? 1 : 0),
|
|
18047
|
+
unit
|
|
18048
|
+
] }),
|
|
18049
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600 mt-1 font-medium", children: label }),
|
|
18050
|
+
target !== void 0 && /* @__PURE__ */ jsxs("div", { className: "text-xs text-gray-500 mt-1", children: [
|
|
18051
|
+
"Target: ",
|
|
18052
|
+
target,
|
|
18053
|
+
unit
|
|
18054
|
+
] })
|
|
18055
|
+
] }) }),
|
|
18056
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-[15%] left-[15%] text-xs text-gray-500", children: [
|
|
18057
|
+
min,
|
|
18058
|
+
unit
|
|
18059
|
+
] }),
|
|
18060
|
+
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-[15%] right-[15%] text-xs text-gray-500", children: [
|
|
18061
|
+
max,
|
|
18062
|
+
unit
|
|
18063
|
+
] })
|
|
18064
|
+
] }) });
|
|
18065
|
+
};
|
|
18066
|
+
var DEFAULT_COLORS = [
|
|
18067
|
+
"#3b82f6",
|
|
18068
|
+
// blue-500
|
|
18069
|
+
"#10b981",
|
|
18070
|
+
// green-500
|
|
18071
|
+
"#f59e0b",
|
|
18072
|
+
// amber-500
|
|
18073
|
+
"#ef4444",
|
|
18074
|
+
// red-500
|
|
18075
|
+
"#8b5cf6",
|
|
18076
|
+
// violet-500
|
|
18077
|
+
"#06b6d4",
|
|
18078
|
+
// cyan-500
|
|
18079
|
+
"#f97316",
|
|
18080
|
+
// orange-500
|
|
18081
|
+
"#6366f1"
|
|
18082
|
+
// indigo-500
|
|
18083
|
+
];
|
|
18084
|
+
var PieChart4 = ({
|
|
18085
|
+
data,
|
|
18086
|
+
className = "",
|
|
18087
|
+
showPercentages = false,
|
|
18088
|
+
colors = DEFAULT_COLORS
|
|
18089
|
+
}) => {
|
|
18090
|
+
const total = data.reduce((sum, entry) => sum + entry.value, 0);
|
|
18091
|
+
const dataWithPercentage = data.map((entry) => ({
|
|
18092
|
+
...entry,
|
|
18093
|
+
percentage: (entry.value / total * 100).toFixed(1)
|
|
18094
|
+
}));
|
|
18095
|
+
const renderCustomLabel = (props) => {
|
|
18096
|
+
if (!showPercentages) return null;
|
|
18097
|
+
const { cx: cx2, cy, midAngle, innerRadius, outerRadius, percentage } = props;
|
|
18098
|
+
const RADIAN = Math.PI / 180;
|
|
18099
|
+
const radius = innerRadius + (outerRadius - innerRadius) * 0.5;
|
|
18100
|
+
const x = cx2 + radius * Math.cos(-midAngle * RADIAN);
|
|
18101
|
+
const y = cy + radius * Math.sin(-midAngle * RADIAN);
|
|
18102
|
+
return /* @__PURE__ */ jsxs(
|
|
18103
|
+
"text",
|
|
18104
|
+
{
|
|
18105
|
+
x,
|
|
18106
|
+
y,
|
|
18107
|
+
fill: "white",
|
|
18108
|
+
textAnchor: x > cx2 ? "start" : "end",
|
|
18109
|
+
dominantBaseline: "central",
|
|
18110
|
+
className: "text-xs font-medium",
|
|
18111
|
+
children: [
|
|
18112
|
+
percentage,
|
|
18113
|
+
"%"
|
|
18114
|
+
]
|
|
18115
|
+
}
|
|
18116
|
+
);
|
|
18117
|
+
};
|
|
18118
|
+
const CustomTooltip = ({ active, payload }) => {
|
|
18119
|
+
if (active && payload && payload.length) {
|
|
18120
|
+
const data2 = payload[0];
|
|
18121
|
+
return /* @__PURE__ */ jsxs("div", { className: "bg-white px-3 py-2 shadow-lg rounded-lg border border-gray-200", children: [
|
|
18122
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-900", children: data2.name }),
|
|
18123
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-gray-600", children: [
|
|
18124
|
+
"Value: ",
|
|
18125
|
+
data2.value,
|
|
18126
|
+
showPercentages && ` (${data2.payload.percentage}%)`
|
|
18127
|
+
] })
|
|
18128
|
+
] });
|
|
18129
|
+
}
|
|
18130
|
+
return null;
|
|
18131
|
+
};
|
|
18132
|
+
return /* @__PURE__ */ jsx("div", { className: `w-full h-full ${className}`, children: /* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: "100%", children: /* @__PURE__ */ jsxs(PieChart, { children: [
|
|
18133
|
+
/* @__PURE__ */ jsx(
|
|
18134
|
+
Pie,
|
|
18135
|
+
{
|
|
18136
|
+
data: dataWithPercentage,
|
|
18137
|
+
cx: "50%",
|
|
18138
|
+
cy: "50%",
|
|
18139
|
+
labelLine: false,
|
|
18140
|
+
label: showPercentages ? renderCustomLabel : void 0,
|
|
18141
|
+
outerRadius: "80%",
|
|
18142
|
+
fill: "#8884d8",
|
|
18143
|
+
dataKey: "value",
|
|
18144
|
+
animationBegin: 0,
|
|
18145
|
+
animationDuration: 800,
|
|
18146
|
+
children: dataWithPercentage.map((entry, index) => /* @__PURE__ */ jsx(Cell, { fill: colors[index % colors.length] }, `cell-${index}`))
|
|
18147
|
+
}
|
|
18148
|
+
),
|
|
18149
|
+
/* @__PURE__ */ jsx(Tooltip, { content: /* @__PURE__ */ jsx(CustomTooltip, {}) }),
|
|
18150
|
+
/* @__PURE__ */ jsx(
|
|
18151
|
+
Legend,
|
|
18152
|
+
{
|
|
18153
|
+
verticalAlign: "bottom",
|
|
18154
|
+
height: 36,
|
|
18155
|
+
formatter: (value) => /* @__PURE__ */ jsx("span", { className: "text-sm", children: value })
|
|
18156
|
+
}
|
|
18157
|
+
)
|
|
18158
|
+
] }) }) });
|
|
18159
|
+
};
|
|
17963
18160
|
var TrendIcon = ({ trend }) => {
|
|
17964
18161
|
if (trend === "up") {
|
|
17965
18162
|
return /* @__PURE__ */ jsx(ArrowUp, { className: "h-4 w-4 text-green-500" });
|
|
@@ -22558,7 +22755,7 @@ var getWorkspaceStyles = (position, isPlaceholder = false) => {
|
|
|
22558
22755
|
${additionalStyles}
|
|
22559
22756
|
${isPlaceholder ? "cursor-default" : ""}`;
|
|
22560
22757
|
};
|
|
22561
|
-
var
|
|
22758
|
+
var Legend6 = () => /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-2 sm:gap-3 bg-white/95 rounded-lg shadow-sm px-2 sm:px-4 py-1 sm:py-1.5 border border-gray-200/60 backdrop-blur-sm text-xs sm:text-sm", children: [
|
|
22562
22759
|
/* @__PURE__ */ jsx("div", { className: "font-medium text-gray-700 hidden sm:block", children: "Efficiency:" }),
|
|
22563
22760
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 sm:gap-4", children: [
|
|
22564
22761
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 sm:gap-2", children: [
|
|
@@ -22696,8 +22893,8 @@ var WorkspaceGrid = React14__default.memo(({
|
|
|
22696
22893
|
const { VideoGridView: VideoGridViewComponent } = useRegistry();
|
|
22697
22894
|
return /* @__PURE__ */ jsxs("div", { className: `relative w-full h-full overflow-hidden ${className}`, children: [
|
|
22698
22895
|
/* @__PURE__ */ jsxs("div", { className: "absolute top-0 left-2 sm:left-4 right-2 sm:right-8 z-20", children: [
|
|
22699
|
-
/* @__PURE__ */ jsx("div", { className: "flex flex-row items-center justify-between py-1 sm:py-1.5 gap-2", children: /* @__PURE__ */ jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx(
|
|
22700
|
-
/* @__PURE__ */ jsx("div", { className: "sm:hidden mt-1", children: /* @__PURE__ */ jsx(
|
|
22896
|
+
/* @__PURE__ */ jsx("div", { className: "flex flex-row items-center justify-between py-1 sm:py-1.5 gap-2", children: /* @__PURE__ */ jsx("div", { className: "hidden sm:block", children: /* @__PURE__ */ jsx(Legend6, {}) }) }),
|
|
22897
|
+
/* @__PURE__ */ jsx("div", { className: "sm:hidden mt-1", children: /* @__PURE__ */ jsx(Legend6, {}) })
|
|
22701
22898
|
] }),
|
|
22702
22899
|
/* @__PURE__ */ jsx("div", { className: "absolute top-10 sm:top-16 left-0 right-0 bottom-0", children: /* @__PURE__ */ jsx(
|
|
22703
22900
|
VideoGridViewComponent,
|
|
@@ -23300,6 +23497,78 @@ var WorkspaceMonthlyDataFetcher = ({
|
|
|
23300
23497
|
}, [workspaceId, selectedMonth, selectedYear, supabase, onDataLoaded, onLoadingChange]);
|
|
23301
23498
|
return null;
|
|
23302
23499
|
};
|
|
23500
|
+
var WorkspaceDisplayNameExample = () => {
|
|
23501
|
+
const { displayNames, loading, error } = useWorkspaceDisplayNames();
|
|
23502
|
+
const { displayName: singleWorkspaceName, loading: singleLoading } = useWorkspaceDisplayName("WS01");
|
|
23503
|
+
const { displayNames: displayNamesMap, loading: mapLoading } = useWorkspaceDisplayNamesMap(["WS01", "WS02", "WS03"]);
|
|
23504
|
+
if (loading) {
|
|
23505
|
+
return /* @__PURE__ */ jsx("div", { className: "p-4", children: "Loading workspace display names..." });
|
|
23506
|
+
}
|
|
23507
|
+
if (error) {
|
|
23508
|
+
return /* @__PURE__ */ jsxs("div", { className: "p-4 text-red-600", children: [
|
|
23509
|
+
"Error loading workspace display names: ",
|
|
23510
|
+
error.message
|
|
23511
|
+
] });
|
|
23512
|
+
}
|
|
23513
|
+
return /* @__PURE__ */ jsxs("div", { className: "p-6 max-w-4xl mx-auto", children: [
|
|
23514
|
+
/* @__PURE__ */ jsx("h2", { className: "text-2xl font-bold mb-6", children: "Workspace Display Names Examples" }),
|
|
23515
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-8", children: [
|
|
23516
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-4", children: "1. All Workspace Display Names" }),
|
|
23517
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-4", children: Object.entries(displayNames).map(([workspaceId, displayName]) => /* @__PURE__ */ jsxs("div", { className: "p-3 border rounded-lg", children: [
|
|
23518
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: workspaceId }),
|
|
23519
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: displayName })
|
|
23520
|
+
] }, workspaceId)) }),
|
|
23521
|
+
/* @__PURE__ */ jsx("div", { className: "mt-4 p-3 bg-gray-50 rounded-lg", children: /* @__PURE__ */ jsxs("p", { className: "text-sm", children: [
|
|
23522
|
+
/* @__PURE__ */ jsx("strong", { children: "Using utility function:" }),
|
|
23523
|
+
` getWorkspaceDisplayName('WS01') = "`,
|
|
23524
|
+
getWorkspaceDisplayName("WS01"),
|
|
23525
|
+
'"'
|
|
23526
|
+
] }) })
|
|
23527
|
+
] }),
|
|
23528
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-8", children: [
|
|
23529
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-4", children: "2. Single Workspace Display Name" }),
|
|
23530
|
+
/* @__PURE__ */ jsx("div", { className: "p-3 border rounded-lg", children: singleLoading ? /* @__PURE__ */ jsx("div", { children: "Loading WS01..." }) : /* @__PURE__ */ jsxs("div", { children: [
|
|
23531
|
+
/* @__PURE__ */ jsx("strong", { children: "WS01:" }),
|
|
23532
|
+
" ",
|
|
23533
|
+
singleWorkspaceName
|
|
23534
|
+
] }) })
|
|
23535
|
+
] }),
|
|
23536
|
+
/* @__PURE__ */ jsxs("div", { className: "mb-8", children: [
|
|
23537
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-4", children: "3. Specific Workspaces Map" }),
|
|
23538
|
+
/* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 md:grid-cols-3 gap-4", children: mapLoading ? /* @__PURE__ */ jsx("div", { children: "Loading specific workspaces..." }) : Object.entries(displayNamesMap).map(([workspaceId, displayName]) => /* @__PURE__ */ jsxs("div", { className: "p-3 border rounded-lg", children: [
|
|
23539
|
+
/* @__PURE__ */ jsx("div", { className: "font-medium", children: workspaceId }),
|
|
23540
|
+
/* @__PURE__ */ jsx("div", { className: "text-sm text-gray-600", children: displayName })
|
|
23541
|
+
] }, workspaceId)) })
|
|
23542
|
+
] }),
|
|
23543
|
+
/* @__PURE__ */ jsxs("div", { className: "mt-8 p-4 bg-blue-50 rounded-lg", children: [
|
|
23544
|
+
/* @__PURE__ */ jsx("h3", { className: "text-lg font-semibold mb-2", children: "Migration Guide" }),
|
|
23545
|
+
/* @__PURE__ */ jsxs("div", { className: "text-sm space-y-2", children: [
|
|
23546
|
+
/* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("strong", { children: "Before (hardcoded):" }) }),
|
|
23547
|
+
/* @__PURE__ */ jsxs("code", { className: "block p-2 bg-gray-100 rounded", children: [
|
|
23548
|
+
"import ",
|
|
23549
|
+
`{getWorkspaceDisplayName}`,
|
|
23550
|
+
" from '@optifye/dashboard-core';",
|
|
23551
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
23552
|
+
"const name = getWorkspaceDisplayName('WS01'); // Synchronous, hardcoded"
|
|
23553
|
+
] }),
|
|
23554
|
+
/* @__PURE__ */ jsx("p", { children: /* @__PURE__ */ jsx("strong", { children: "After (from Supabase):" }) }),
|
|
23555
|
+
/* @__PURE__ */ jsxs("code", { className: "block p-2 bg-gray-100 rounded", children: [
|
|
23556
|
+
"import ",
|
|
23557
|
+
`{useWorkspaceDisplayName}`,
|
|
23558
|
+
" from '@optifye/dashboard-core';",
|
|
23559
|
+
/* @__PURE__ */ jsx("br", {}),
|
|
23560
|
+
"const ",
|
|
23561
|
+
`{displayName, loading}`,
|
|
23562
|
+
" = useWorkspaceDisplayName('WS01'); // Async, from database"
|
|
23563
|
+
] }),
|
|
23564
|
+
/* @__PURE__ */ jsxs("p", { className: "text-blue-700", children: [
|
|
23565
|
+
/* @__PURE__ */ jsx("strong", { children: "Note:" }),
|
|
23566
|
+
" The old synchronous functions are still available as fallbacks and for backward compatibility."
|
|
23567
|
+
] })
|
|
23568
|
+
] })
|
|
23569
|
+
] })
|
|
23570
|
+
] });
|
|
23571
|
+
};
|
|
23303
23572
|
var Breadcrumbs = ({ items }) => {
|
|
23304
23573
|
const navigation = useNavigation();
|
|
23305
23574
|
if (!items || items.length === 0) return null;
|
|
@@ -24745,6 +25014,447 @@ var AIAgentView = () => {
|
|
|
24745
25014
|
});
|
|
24746
25015
|
}
|
|
24747
25016
|
const renderAssistantContent = (content) => {
|
|
25017
|
+
const parseChartPatterns = (text) => {
|
|
25018
|
+
const chartElements = [];
|
|
25019
|
+
let lastIndex = 0;
|
|
25020
|
+
console.log("[DEBUG] Parsing chart patterns from text:", text);
|
|
25021
|
+
const chartRegex = /\[\s*(?:Calling\s+|CALL\s+)?(create_[a-z_]+)\s*\(([\s\S]*?)\)\s*\]/g;
|
|
25022
|
+
let match;
|
|
25023
|
+
const processedIndices = /* @__PURE__ */ new Set();
|
|
25024
|
+
let matchCount = 0;
|
|
25025
|
+
while ((match = chartRegex.exec(text)) !== null) {
|
|
25026
|
+
matchCount++;
|
|
25027
|
+
const startIndex = match.index;
|
|
25028
|
+
const endIndex = startIndex + match[0].length;
|
|
25029
|
+
console.log(`[DEBUG] Found chart pattern #${matchCount}:`, {
|
|
25030
|
+
fullMatch: match[0],
|
|
25031
|
+
chartType: match[1],
|
|
25032
|
+
argsString: match[2],
|
|
25033
|
+
startIndex,
|
|
25034
|
+
endIndex
|
|
25035
|
+
});
|
|
25036
|
+
if (!processedIndices.has(startIndex)) {
|
|
25037
|
+
processedIndices.add(startIndex);
|
|
25038
|
+
if (startIndex > lastIndex) {
|
|
25039
|
+
const beforeText = text.substring(lastIndex, startIndex);
|
|
25040
|
+
chartElements.push(
|
|
25041
|
+
/* @__PURE__ */ jsx(
|
|
25042
|
+
"div",
|
|
25043
|
+
{
|
|
25044
|
+
dangerouslySetInnerHTML: { __html: formatMessage(beforeText) }
|
|
25045
|
+
},
|
|
25046
|
+
`text-${lastIndex}`
|
|
25047
|
+
)
|
|
25048
|
+
);
|
|
25049
|
+
}
|
|
25050
|
+
const chartType = match[1];
|
|
25051
|
+
const argsString = match[2];
|
|
25052
|
+
try {
|
|
25053
|
+
const args = parseChartArguments(argsString);
|
|
25054
|
+
const chartElement = renderChart(chartType, args, startIndex);
|
|
25055
|
+
if (chartElement) {
|
|
25056
|
+
console.log(`[DEBUG] Successfully rendered chart: ${chartType}`);
|
|
25057
|
+
chartElements.push(chartElement);
|
|
25058
|
+
} else {
|
|
25059
|
+
console.warn(`[DEBUG] Chart element was null for type: ${chartType}`);
|
|
25060
|
+
}
|
|
25061
|
+
} catch (error) {
|
|
25062
|
+
console.error(`Failed to parse chart ${chartType}:`, error);
|
|
25063
|
+
chartElements.push(
|
|
25064
|
+
/* @__PURE__ */ jsxs(
|
|
25065
|
+
"div",
|
|
25066
|
+
{
|
|
25067
|
+
className: "text-red-500 text-sm",
|
|
25068
|
+
children: [
|
|
25069
|
+
"Error rendering chart: ",
|
|
25070
|
+
match[0]
|
|
25071
|
+
]
|
|
25072
|
+
},
|
|
25073
|
+
`error-${startIndex}`
|
|
25074
|
+
)
|
|
25075
|
+
);
|
|
25076
|
+
}
|
|
25077
|
+
lastIndex = endIndex;
|
|
25078
|
+
}
|
|
25079
|
+
}
|
|
25080
|
+
console.log(`[DEBUG] Total chart patterns found: ${matchCount}`);
|
|
25081
|
+
if (lastIndex < text.length) {
|
|
25082
|
+
const remainingText = text.substring(lastIndex);
|
|
25083
|
+
chartElements.push(
|
|
25084
|
+
/* @__PURE__ */ jsx(
|
|
25085
|
+
"div",
|
|
25086
|
+
{
|
|
25087
|
+
dangerouslySetInnerHTML: { __html: formatMessage(remainingText) }
|
|
25088
|
+
},
|
|
25089
|
+
`text-${lastIndex}`
|
|
25090
|
+
)
|
|
25091
|
+
);
|
|
25092
|
+
}
|
|
25093
|
+
if (chartElements.length === 1 && lastIndex === 0) {
|
|
25094
|
+
console.log("[DEBUG] No charts found in text, returning null");
|
|
25095
|
+
return null;
|
|
25096
|
+
}
|
|
25097
|
+
console.log(`[DEBUG] Returning ${chartElements.length} chart elements`);
|
|
25098
|
+
return chartElements;
|
|
25099
|
+
};
|
|
25100
|
+
const parseChartArguments = (argsString) => {
|
|
25101
|
+
const args = {};
|
|
25102
|
+
console.log("[DEBUG] Parsing chart arguments:", argsString);
|
|
25103
|
+
const jsonParamRegex = /(\w+)\s*=\s*(\[[\s\S]*?\](?=\s*(?:,|\s*\)|\s*$))|\{[\s\S]*?\}(?=\s*(?:,|\s*\)|\s*$)))/g;
|
|
25104
|
+
let jsonMatch;
|
|
25105
|
+
while ((jsonMatch = jsonParamRegex.exec(argsString)) !== null) {
|
|
25106
|
+
const paramName = jsonMatch[1];
|
|
25107
|
+
const jsonValue = jsonMatch[2];
|
|
25108
|
+
console.log(`[DEBUG] Found JSON parameter: ${paramName} = ${jsonValue}`);
|
|
25109
|
+
try {
|
|
25110
|
+
args[paramName] = JSON.parse(jsonValue);
|
|
25111
|
+
console.log(`[DEBUG] Successfully parsed ${paramName}:`, args[paramName]);
|
|
25112
|
+
argsString = argsString.replace(jsonMatch[0], "");
|
|
25113
|
+
} catch (e) {
|
|
25114
|
+
console.error(`Failed to parse ${paramName} JSON:`, e);
|
|
25115
|
+
console.error(`JSON value that failed:`, jsonValue);
|
|
25116
|
+
}
|
|
25117
|
+
}
|
|
25118
|
+
const argRegex = /(\w+)\s*=\s*("([^"]*)"|'([^']*)'|([^,\s\)]+))/g;
|
|
25119
|
+
let argMatch;
|
|
25120
|
+
while ((argMatch = argRegex.exec(argsString)) !== null) {
|
|
25121
|
+
const key = argMatch[1];
|
|
25122
|
+
const value = argMatch[3] || argMatch[4] || argMatch[5];
|
|
25123
|
+
if (key === "data") continue;
|
|
25124
|
+
if (value === "true" || value === "True") {
|
|
25125
|
+
args[key] = true;
|
|
25126
|
+
} else if (value === "false" || value === "False") {
|
|
25127
|
+
args[key] = false;
|
|
25128
|
+
} else if (value === "null" || value === "None") {
|
|
25129
|
+
args[key] = null;
|
|
25130
|
+
} else if (!isNaN(Number(value)) && value !== "") {
|
|
25131
|
+
args[key] = Number(value);
|
|
25132
|
+
} else {
|
|
25133
|
+
args[key] = value;
|
|
25134
|
+
}
|
|
25135
|
+
}
|
|
25136
|
+
console.log("[DEBUG] Final parsed arguments:", args);
|
|
25137
|
+
return args;
|
|
25138
|
+
};
|
|
25139
|
+
const renderChart = (chartType, args, key) => {
|
|
25140
|
+
console.log(`[DEBUG] Attempting to render chart type: ${chartType}`, args);
|
|
25141
|
+
switch (chartType) {
|
|
25142
|
+
case "create_gauge_chart":
|
|
25143
|
+
console.log("[DEBUG] Rendering gauge chart");
|
|
25144
|
+
return /* @__PURE__ */ jsx("div", { className: "my-6 h-64 w-full flex justify-center", children: /* @__PURE__ */ jsx(
|
|
25145
|
+
GaugeChart,
|
|
25146
|
+
{
|
|
25147
|
+
value: args.value || 0,
|
|
25148
|
+
min: args.min_value || 0,
|
|
25149
|
+
max: args.max_value || 100,
|
|
25150
|
+
target: args.target,
|
|
25151
|
+
label: args.title || "",
|
|
25152
|
+
unit: args.unit || "",
|
|
25153
|
+
thresholds: args.thresholds,
|
|
25154
|
+
className: "w-full max-w-sm"
|
|
25155
|
+
}
|
|
25156
|
+
) }, `gauge-${key}`);
|
|
25157
|
+
case "create_bar_chart":
|
|
25158
|
+
console.log("[DEBUG] Rendering bar chart");
|
|
25159
|
+
if (!args.data || !args.x_field || !args.y_field) {
|
|
25160
|
+
console.error("Bar chart missing required parameters:", { data: !!args.data, x_field: !!args.x_field, y_field: !!args.y_field });
|
|
25161
|
+
return null;
|
|
25162
|
+
}
|
|
25163
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", style: { maxWidth: args.max_width || "100%" }, children: [
|
|
25164
|
+
/* @__PURE__ */ jsx(
|
|
25165
|
+
BarChart,
|
|
25166
|
+
{
|
|
25167
|
+
data: args.data,
|
|
25168
|
+
bars: [{
|
|
25169
|
+
dataKey: args.y_field,
|
|
25170
|
+
fill: args.color || "#3b82f6",
|
|
25171
|
+
labelList: args.show_values
|
|
25172
|
+
}],
|
|
25173
|
+
xAxisDataKey: args.x_field,
|
|
25174
|
+
className: "h-64",
|
|
25175
|
+
showLegend: false
|
|
25176
|
+
}
|
|
25177
|
+
),
|
|
25178
|
+
args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25179
|
+
] }, `bar-${key}`);
|
|
25180
|
+
case "create_line_chart":
|
|
25181
|
+
console.log("[DEBUG] Rendering line chart");
|
|
25182
|
+
if (!args.data || !args.x_field || !args.y_field) {
|
|
25183
|
+
console.error("Line chart missing required parameters:", { data: !!args.data, x_field: !!args.x_field, y_field: !!args.y_field });
|
|
25184
|
+
return null;
|
|
25185
|
+
}
|
|
25186
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", style: {
|
|
25187
|
+
height: args.height || 256,
|
|
25188
|
+
width: args.width || "100%"
|
|
25189
|
+
}, children: [
|
|
25190
|
+
/* @__PURE__ */ jsx(
|
|
25191
|
+
LineChart,
|
|
25192
|
+
{
|
|
25193
|
+
data: args.data,
|
|
25194
|
+
lines: [{
|
|
25195
|
+
dataKey: args.y_field,
|
|
25196
|
+
stroke: "#3b82f6",
|
|
25197
|
+
strokeWidth: 2
|
|
25198
|
+
}],
|
|
25199
|
+
xAxisDataKey: args.x_field,
|
|
25200
|
+
className: "h-full",
|
|
25201
|
+
showLegend: false
|
|
25202
|
+
}
|
|
25203
|
+
),
|
|
25204
|
+
args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25205
|
+
] }, `line-${key}`);
|
|
25206
|
+
case "create_pie_chart":
|
|
25207
|
+
console.log("[DEBUG] Rendering pie chart");
|
|
25208
|
+
if (!args.data || !args.label_field || !args.value_field) {
|
|
25209
|
+
console.error("Pie chart missing required parameters:", { data: !!args.data, label_field: !!args.label_field, value_field: !!args.value_field });
|
|
25210
|
+
console.error("Available args:", Object.keys(args));
|
|
25211
|
+
return null;
|
|
25212
|
+
}
|
|
25213
|
+
const pieData = args.data.map((item) => ({
|
|
25214
|
+
name: item[args.label_field],
|
|
25215
|
+
value: item[args.value_field]
|
|
25216
|
+
}));
|
|
25217
|
+
console.log("[DEBUG] Pie chart data transformed:", pieData);
|
|
25218
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full flex flex-col items-center", children: [
|
|
25219
|
+
args.title && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700 mb-2", children: args.title }),
|
|
25220
|
+
/* @__PURE__ */ jsx("div", { className: "h-64 w-full max-w-md", children: /* @__PURE__ */ jsx(
|
|
25221
|
+
PieChart4,
|
|
25222
|
+
{
|
|
25223
|
+
data: pieData,
|
|
25224
|
+
showPercentages: args.show_percentages || false
|
|
25225
|
+
}
|
|
25226
|
+
) })
|
|
25227
|
+
] }, `pie-${key}`);
|
|
25228
|
+
case "create_comparison_table":
|
|
25229
|
+
console.log("[DEBUG] Rendering comparison table");
|
|
25230
|
+
if (!args.data) {
|
|
25231
|
+
console.error("Comparison table missing required data");
|
|
25232
|
+
return null;
|
|
25233
|
+
}
|
|
25234
|
+
const columns = args.columns || Object.keys(args.data[0] || {});
|
|
25235
|
+
let sortedData = [...args.data];
|
|
25236
|
+
if (args.sort_by && columns.includes(args.sort_by)) {
|
|
25237
|
+
sortedData.sort((a, b) => {
|
|
25238
|
+
const aVal = a[args.sort_by];
|
|
25239
|
+
const bVal = b[args.sort_by];
|
|
25240
|
+
const comparison = aVal > bVal ? 1 : aVal < bVal ? -1 : 0;
|
|
25241
|
+
return args.sort_descending === false ? comparison : -comparison;
|
|
25242
|
+
});
|
|
25243
|
+
}
|
|
25244
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full overflow-x-auto", children: [
|
|
25245
|
+
args.title && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-gray-700 mb-2", children: args.title }),
|
|
25246
|
+
/* @__PURE__ */ jsxs("table", { className: "min-w-full divide-y divide-gray-200", children: [
|
|
25247
|
+
/* @__PURE__ */ jsx("thead", { className: "bg-gray-50", children: /* @__PURE__ */ jsx("tr", { children: columns.map((col) => /* @__PURE__ */ jsx(
|
|
25248
|
+
"th",
|
|
25249
|
+
{
|
|
25250
|
+
className: `px-4 py-2 text-left text-xs font-medium text-gray-500 uppercase tracking-wider ${col === args.highlight_column ? "bg-blue-50" : ""}`,
|
|
25251
|
+
children: col
|
|
25252
|
+
},
|
|
25253
|
+
col
|
|
25254
|
+
)) }) }),
|
|
25255
|
+
/* @__PURE__ */ jsx("tbody", { className: "bg-white divide-y divide-gray-200", children: sortedData.map((row, rowIdx) => /* @__PURE__ */ jsx("tr", { className: rowIdx % 2 === 0 ? "bg-white" : "bg-gray-50", children: columns.map((col) => /* @__PURE__ */ jsx(
|
|
25256
|
+
"td",
|
|
25257
|
+
{
|
|
25258
|
+
className: `px-4 py-2 whitespace-nowrap text-sm ${col === args.highlight_column ? "font-medium text-blue-600 bg-blue-50" : "text-gray-900"}`,
|
|
25259
|
+
children: row[col]
|
|
25260
|
+
},
|
|
25261
|
+
col
|
|
25262
|
+
)) }, rowIdx)) })
|
|
25263
|
+
] })
|
|
25264
|
+
] }, `table-${key}`);
|
|
25265
|
+
case "create_multi_line_chart":
|
|
25266
|
+
console.log("[DEBUG] Rendering multi-line chart");
|
|
25267
|
+
if (!args.data || !args.x_field || !args.y_fields || !args.legend) {
|
|
25268
|
+
console.error("Multi-line chart missing required parameters:", {
|
|
25269
|
+
data: !!args.data,
|
|
25270
|
+
x_field: !!args.x_field,
|
|
25271
|
+
y_fields: !!args.y_fields,
|
|
25272
|
+
legend: !!args.legend
|
|
25273
|
+
});
|
|
25274
|
+
return null;
|
|
25275
|
+
}
|
|
25276
|
+
const colors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
|
|
25277
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
|
|
25278
|
+
/* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(LineChart$1, { data: args.data, children: [
|
|
25279
|
+
/* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25280
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field }),
|
|
25281
|
+
/* @__PURE__ */ jsx(YAxis, {}),
|
|
25282
|
+
/* @__PURE__ */ jsx(Tooltip, {}),
|
|
25283
|
+
/* @__PURE__ */ jsx(Legend, {}),
|
|
25284
|
+
args.y_fields.map((field, index) => /* @__PURE__ */ jsx(
|
|
25285
|
+
Line,
|
|
25286
|
+
{
|
|
25287
|
+
type: "monotone",
|
|
25288
|
+
dataKey: field,
|
|
25289
|
+
stroke: colors[index % colors.length],
|
|
25290
|
+
strokeWidth: 2,
|
|
25291
|
+
name: args.legend[index] || field,
|
|
25292
|
+
dot: { r: 4 },
|
|
25293
|
+
activeDot: { r: 6 }
|
|
25294
|
+
},
|
|
25295
|
+
field
|
|
25296
|
+
))
|
|
25297
|
+
] }) }),
|
|
25298
|
+
args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25299
|
+
] }, `multi-line-${key}`);
|
|
25300
|
+
case "create_stacked_bar_chart":
|
|
25301
|
+
console.log("[DEBUG] Rendering stacked bar chart");
|
|
25302
|
+
if (!args.data || !args.x_field || !args.stack_fields) {
|
|
25303
|
+
console.error("Stacked bar chart missing required parameters:", {
|
|
25304
|
+
data: !!args.data,
|
|
25305
|
+
x_field: !!args.x_field,
|
|
25306
|
+
stack_fields: !!args.stack_fields
|
|
25307
|
+
});
|
|
25308
|
+
return null;
|
|
25309
|
+
}
|
|
25310
|
+
const stackColors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
|
|
25311
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
|
|
25312
|
+
/* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(BarChart$1, { data: args.data, children: [
|
|
25313
|
+
/* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25314
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field }),
|
|
25315
|
+
/* @__PURE__ */ jsx(YAxis, {}),
|
|
25316
|
+
/* @__PURE__ */ jsx(Tooltip, {}),
|
|
25317
|
+
/* @__PURE__ */ jsx(Legend, {}),
|
|
25318
|
+
args.stack_fields.map((field, index) => /* @__PURE__ */ jsx(
|
|
25319
|
+
Bar,
|
|
25320
|
+
{
|
|
25321
|
+
dataKey: field,
|
|
25322
|
+
stackId: "stack",
|
|
25323
|
+
fill: stackColors[index % stackColors.length],
|
|
25324
|
+
name: field
|
|
25325
|
+
},
|
|
25326
|
+
field
|
|
25327
|
+
))
|
|
25328
|
+
] }) }),
|
|
25329
|
+
args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25330
|
+
] }, `stacked-bar-${key}`);
|
|
25331
|
+
case "create_dual_axis_chart":
|
|
25332
|
+
console.log("[DEBUG] Rendering dual-axis chart");
|
|
25333
|
+
if (!args.data || !args.x_field || !args.left_y_field || !args.right_y_field) {
|
|
25334
|
+
console.error("Dual-axis chart missing required parameters:", {
|
|
25335
|
+
data: !!args.data,
|
|
25336
|
+
x_field: !!args.x_field,
|
|
25337
|
+
left_y_field: !!args.left_y_field,
|
|
25338
|
+
right_y_field: !!args.right_y_field
|
|
25339
|
+
});
|
|
25340
|
+
return null;
|
|
25341
|
+
}
|
|
25342
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
|
|
25343
|
+
/* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, children: [
|
|
25344
|
+
/* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25345
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field }),
|
|
25346
|
+
/* @__PURE__ */ jsx(YAxis, { yAxisId: "left", orientation: "left", label: { value: args.left_label || "", angle: -90, position: "insideLeft" } }),
|
|
25347
|
+
/* @__PURE__ */ jsx(YAxis, { yAxisId: "right", orientation: "right", label: { value: args.right_label || "", angle: 90, position: "insideRight" } }),
|
|
25348
|
+
/* @__PURE__ */ jsx(Tooltip, {}),
|
|
25349
|
+
/* @__PURE__ */ jsx(Legend, {}),
|
|
25350
|
+
/* @__PURE__ */ jsx(Bar, { yAxisId: "left", dataKey: args.left_y_field, fill: "#3b82f6", name: args.left_label || args.left_y_field }),
|
|
25351
|
+
/* @__PURE__ */ jsx(Line, { yAxisId: "right", type: "monotone", dataKey: args.right_y_field, stroke: "#ef4444", strokeWidth: 2, name: args.right_label || args.right_y_field })
|
|
25352
|
+
] }) }),
|
|
25353
|
+
args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25354
|
+
] }, `dual-axis-${key}`);
|
|
25355
|
+
case "create_scatter_plot":
|
|
25356
|
+
console.log("[DEBUG] Rendering scatter plot");
|
|
25357
|
+
if (!args.data || !args.x_field || !args.y_field || !args.group_field) {
|
|
25358
|
+
console.error("Scatter plot missing required parameters:", {
|
|
25359
|
+
data: !!args.data,
|
|
25360
|
+
x_field: !!args.x_field,
|
|
25361
|
+
y_field: !!args.y_field,
|
|
25362
|
+
group_field: !!args.group_field
|
|
25363
|
+
});
|
|
25364
|
+
return null;
|
|
25365
|
+
}
|
|
25366
|
+
const groupedData = args.data.reduce((acc, item) => {
|
|
25367
|
+
const group = item[args.group_field];
|
|
25368
|
+
if (!acc[group]) {
|
|
25369
|
+
acc[group] = [];
|
|
25370
|
+
}
|
|
25371
|
+
acc[group].push(item);
|
|
25372
|
+
return acc;
|
|
25373
|
+
}, {});
|
|
25374
|
+
const scatterColors = ["#3b82f6", "#ef4444", "#10b981", "#f59e0b", "#8b5cf6", "#06b6d4", "#84cc16", "#f97316"];
|
|
25375
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
|
|
25376
|
+
/* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(ScatterChart, { children: [
|
|
25377
|
+
/* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25378
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field, type: "number", name: args.x_field }),
|
|
25379
|
+
/* @__PURE__ */ jsx(YAxis, { dataKey: args.y_field, type: "number", name: args.y_field }),
|
|
25380
|
+
/* @__PURE__ */ jsx(Tooltip, { cursor: { strokeDasharray: "3 3" } }),
|
|
25381
|
+
/* @__PURE__ */ jsx(Legend, {}),
|
|
25382
|
+
Object.entries(groupedData).map(([group, data], index) => /* @__PURE__ */ jsx(
|
|
25383
|
+
Scatter,
|
|
25384
|
+
{
|
|
25385
|
+
name: group,
|
|
25386
|
+
data,
|
|
25387
|
+
fill: scatterColors[index % scatterColors.length]
|
|
25388
|
+
},
|
|
25389
|
+
group
|
|
25390
|
+
))
|
|
25391
|
+
] }) }),
|
|
25392
|
+
args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25393
|
+
] }, `scatter-${key}`);
|
|
25394
|
+
case "create_combo_chart":
|
|
25395
|
+
console.log("[DEBUG] Rendering combo chart");
|
|
25396
|
+
if (!args.data || !args.x_field || !args.bar_field || !args.line_field) {
|
|
25397
|
+
console.error("Combo chart missing required parameters:", {
|
|
25398
|
+
data: !!args.data,
|
|
25399
|
+
x_field: !!args.x_field,
|
|
25400
|
+
bar_field: !!args.bar_field,
|
|
25401
|
+
line_field: !!args.line_field
|
|
25402
|
+
});
|
|
25403
|
+
return null;
|
|
25404
|
+
}
|
|
25405
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
|
|
25406
|
+
/* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, children: [
|
|
25407
|
+
/* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25408
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field }),
|
|
25409
|
+
/* @__PURE__ */ jsx(YAxis, { yAxisId: "left", orientation: "left" }),
|
|
25410
|
+
/* @__PURE__ */ jsx(YAxis, { yAxisId: "right", orientation: "right" }),
|
|
25411
|
+
/* @__PURE__ */ jsx(Tooltip, {}),
|
|
25412
|
+
/* @__PURE__ */ jsx(Legend, {}),
|
|
25413
|
+
/* @__PURE__ */ jsx(Bar, { yAxisId: "left", dataKey: args.bar_field, fill: "#3b82f6", name: args.bar_field }),
|
|
25414
|
+
/* @__PURE__ */ jsx(Line, { yAxisId: "right", type: "monotone", dataKey: args.line_field, stroke: "#ef4444", strokeWidth: 2, name: args.line_field })
|
|
25415
|
+
] }) }),
|
|
25416
|
+
args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25417
|
+
] }, `combo-${key}`);
|
|
25418
|
+
case "create_area_chart":
|
|
25419
|
+
console.log("[DEBUG] Rendering area chart");
|
|
25420
|
+
if (!args.data || !args.x_field || !args.y_field) {
|
|
25421
|
+
console.error("Area chart missing required parameters:", {
|
|
25422
|
+
data: !!args.data,
|
|
25423
|
+
x_field: !!args.x_field,
|
|
25424
|
+
y_field: !!args.y_field
|
|
25425
|
+
});
|
|
25426
|
+
return null;
|
|
25427
|
+
}
|
|
25428
|
+
return /* @__PURE__ */ jsxs("div", { className: "my-6 w-full", children: [
|
|
25429
|
+
/* @__PURE__ */ jsx(ResponsiveContainer, { width: "100%", height: 400, children: /* @__PURE__ */ jsxs(ComposedChart, { data: args.data, children: [
|
|
25430
|
+
/* @__PURE__ */ jsx(CartesianGrid, { strokeDasharray: "3 3" }),
|
|
25431
|
+
/* @__PURE__ */ jsx(XAxis, { dataKey: args.x_field }),
|
|
25432
|
+
/* @__PURE__ */ jsx(YAxis, {}),
|
|
25433
|
+
/* @__PURE__ */ jsx(Tooltip, {}),
|
|
25434
|
+
/* @__PURE__ */ jsx(Legend, {}),
|
|
25435
|
+
/* @__PURE__ */ jsx(
|
|
25436
|
+
Area,
|
|
25437
|
+
{
|
|
25438
|
+
type: "monotone",
|
|
25439
|
+
dataKey: args.y_field,
|
|
25440
|
+
stroke: "#3b82f6",
|
|
25441
|
+
fill: args.fill ? "#3b82f6" : "none",
|
|
25442
|
+
fillOpacity: args.fill ? 0.6 : 0,
|
|
25443
|
+
name: args.y_field
|
|
25444
|
+
}
|
|
25445
|
+
)
|
|
25446
|
+
] }) }),
|
|
25447
|
+
args.title && /* @__PURE__ */ jsx("p", { className: "text-center text-sm text-gray-600 mt-2", children: args.title })
|
|
25448
|
+
] }, `area-${key}`);
|
|
25449
|
+
default:
|
|
25450
|
+
console.warn(`Unknown chart type: ${chartType}`);
|
|
25451
|
+
return null;
|
|
25452
|
+
}
|
|
25453
|
+
};
|
|
25454
|
+
const chartContent = parseChartPatterns(content);
|
|
25455
|
+
if (chartContent) {
|
|
25456
|
+
return /* @__PURE__ */ jsx("div", { className: "formatted-content", children: chartContent });
|
|
25457
|
+
}
|
|
24748
25458
|
return /* @__PURE__ */ jsx(
|
|
24749
25459
|
"div",
|
|
24750
25460
|
{
|
|
@@ -30957,4 +31667,4 @@ var S3Service = class {
|
|
|
30957
31667
|
}
|
|
30958
31668
|
};
|
|
30959
31669
|
|
|
30960
|
-
export { ACTION_NAMES, AIAgentView_default as AIAgentView, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedTargetsView, BarChart, BaseHistoryCalendar, BottlenecksContent, BreakNotificationPopup, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_THEME_CONFIG, DEFAULT_VIDEO_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, DashboardHeader, DashboardLayout, DashboardOverridesProvider, DashboardProvider, DateDisplay_default as DateDisplay, DateTimeDisplay, DebugAuth, DebugAuthView_default as DebugAuthView, EmptyStateMessage, FactoryView_default as FactoryView, GridComponentsPlaceholder, Header, HelpView_default as HelpView, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, ISTTimer_default as ISTTimer, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView,
|
|
31670
|
+
export { ACTION_NAMES, AIAgentView_default as AIAgentView, AuthCallback, AuthCallbackView_default as AuthCallbackView, AuthProvider, AuthenticatedFactoryView, AuthenticatedHelpView, AuthenticatedHomeView, AuthenticatedTargetsView, BarChart, BaseHistoryCalendar, BottlenecksContent, BreakNotificationPopup, Card2 as Card, CardContent2 as CardContent, CardDescription2 as CardDescription, CardFooter2 as CardFooter, CardHeader2 as CardHeader, CardTitle2 as CardTitle, CycleTimeChart, CycleTimeOverTimeChart, DEFAULT_ANALYTICS_CONFIG, DEFAULT_AUTH_CONFIG, DEFAULT_CONFIG, DEFAULT_DATABASE_CONFIG, DEFAULT_DATE_TIME_CONFIG, DEFAULT_ENDPOINTS_CONFIG, DEFAULT_ENTITY_CONFIG, DEFAULT_SHIFT_CONFIG, DEFAULT_THEME_CONFIG, DEFAULT_VIDEO_CONFIG, DEFAULT_WORKSPACE_CONFIG, DEFAULT_WORKSPACE_POSITIONS, DashboardHeader, DashboardLayout, DashboardOverridesProvider, DashboardProvider, DateDisplay_default as DateDisplay, DateTimeDisplay, DebugAuth, DebugAuthView_default as DebugAuthView, EmptyStateMessage, FactoryView_default as FactoryView, GaugeChart, GridComponentsPlaceholder, Header, HelpView_default as HelpView, HomeView_default as HomeView, HourlyOutputChart2 as HourlyOutputChart, ISTTimer_default as ISTTimer, KPICard, KPIDetailView_default as KPIDetailView, KPIGrid, KPIHeader, KPISection, KPIsOverviewView_default as KPIsOverviewView, LINE_1_UUID, LargeOutputProgressChart, LeaderboardDetailView_default as LeaderboardDetailView, Legend6 as Legend, LineChart, LineHistoryCalendar, LineMonthlyHistory, LineMonthlyPdfGenerator, LinePdfExportButton, LinePdfGenerator, LineWhatsAppShareButton, LiveTimer, LoadingOverlay_default as LoadingOverlay, LoadingPage_default as LoadingPage, LoadingSpinner_default as LoadingSpinner, LoginPage, LoginView_default as LoginView, MainLayout, MetricCard_default as MetricCard, NoWorkspaceData, OptifyeAgentClient, OutputProgressChart, PageHeader, PieChart4 as PieChart, ProfileView_default as ProfileView, RegistryProvider, S3Service, SOPComplianceChart, SSEChatClient, Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectScrollDownButton, SelectScrollUpButton, SelectSeparator, SelectTrigger, SelectValue, ShiftDisplay_default as ShiftDisplay, ShiftsView_default as ShiftsView, SideNavBar, SingleVideoStream_default as SingleVideoStream, Skeleton, SlackAPI, SupabaseProvider, TargetWorkspaceGrid, TargetsView_default as TargetsView, ThreadSidebar, TimeDisplay_default as TimeDisplay, TimePickerDropdown, VideoCard, VideoGridView, VideoPreloader, WORKSPACE_POSITIONS, WhatsAppShareButton, WorkspaceCard, WorkspaceDetailView_default as WorkspaceDetailView, WorkspaceDisplayNameExample, WorkspaceGrid, WorkspaceGridItem, WorkspaceHistoryCalendar, WorkspaceMetricCards, WorkspaceMonthlyDataFetcher, WorkspaceMonthlyPdfGenerator, WorkspacePdfExportButton, WorkspacePdfGenerator, WorkspaceWhatsAppShareButton, actionService, apiUtils, authCoreService, authOTPService, authRateLimitService, checkRateLimit2 as checkRateLimit, clearAllRateLimits2 as clearAllRateLimits, clearRateLimit2 as clearRateLimit, clearS3VideoCache, clearS3VideoFromCache, clearWorkspaceDisplayNamesCache, cn, createStreamProxyHandler, createSupabaseClient, createThrottledReload, dashboardService, deleteThread, forceRefreshWorkspaceDisplayNames, formatDateInZone, formatDateTimeInZone, formatISTDate, formatIdleTime, formatTimeInZone, fromUrlFriendlyName, getAllThreadMessages, getAllWorkspaceDisplayNamesAsync, getAnonClient, getCameraNumber, getCompanyMetricsTableName, getConfigurableShortWorkspaceDisplayName, getConfigurableWorkspaceDisplayName, getCurrentShift, getCurrentTimeInZone, getDashboardHeaderTimeInZone, getDaysDifferenceInZone, getDefaultCameraStreamUrl, getDefaultTabForWorkspace, getManufacturingInsights, getMetricsTablePrefix, getOperationalDate, getS3SignedUrl, getS3VideoSrc, getShortWorkspaceDisplayName, getShortWorkspaceDisplayNameAsync, getStoredWorkspaceMappings, getThreadMessages, getUserThreads, getUserThreadsPaginated, getWorkspaceDisplayName, getWorkspaceDisplayNameAsync, getWorkspaceDisplayNamesMap, getWorkspaceFromUrl, getWorkspaceNavigationParams, identifyCoreUser, initializeCoreMixpanel, isTransitionPeriod, isValidLineInfoPayload, isValidWorkspaceDetailedMetricsPayload, isValidWorkspaceMetricsPayload, isWorkspaceDisplayNamesLoaded, isWorkspaceDisplayNamesLoading, mergeWithDefaultConfig, optifyeAgentClient, preInitializeWorkspaceDisplayNames, preloadS3Video, preloadS3VideoUrl, preloadS3VideosUrl, preloadVideoUrl, preloadVideosUrl, qualityService, realtimeService, refreshWorkspaceDisplayNames, resetCoreMixpanel, s3VideoPreloader, storeWorkspaceMapping, streamProxyConfig, throttledReloadDashboard, toUrlFriendlyName, trackCoreEvent, trackCorePageView, updateThreadTitle, useActiveBreaks, useAnalyticsConfig, useAuth, useAuthConfig, useComponentOverride, useCustomConfig, useDashboardConfig, useDashboardMetrics, useDatabaseConfig, useDateFormatter, useDateTimeConfig, useEndpointsConfig, useEntityConfig, useFactoryOverviewMetrics, useFeatureFlags, useFormatNumber, useHistoricWorkspaceMetrics, useHlsStream, useHlsStreamWithCropping, useHookOverride, useLeaderboardMetrics, useLineDetailedMetrics, useLineKPIs, useLineMetrics, useLineWorkspaceMetrics, useMessages, useMetrics, useNavigation, useOverrides, usePageOverride, useRealtimeLineMetrics, useRegistry, useShiftConfig, useShifts, useSupabase, useSupabaseClient, useTargets, useTheme, useThemeConfig, useThreads, useVideoConfig, useWorkspaceConfig, useWorkspaceDetailedMetrics, useWorkspaceDisplayName, useWorkspaceDisplayNames, useWorkspaceDisplayNamesMap, useWorkspaceMetrics, useWorkspaceNavigation, useWorkspaceOperators, videoPreloader, whatsappService, withAuth, withRegistry, workspaceService };
|