@burdenoff/fluidgrids-fe-sdk 2026.1028.16 → 2026.1028.17
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 +22 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1828,6 +1828,14 @@ function useDecideToolApproval() {
|
|
|
1828
1828
|
);
|
|
1829
1829
|
return { decide, decideAll, loading, error };
|
|
1830
1830
|
}
|
|
1831
|
+
|
|
1832
|
+
// src/modules/tool-approval/utils/timeout.ts
|
|
1833
|
+
function getToolApprovalTimeoutState(timeoutAt, nowMs = Date.now()) {
|
|
1834
|
+
if (!timeoutAt) return "NONE";
|
|
1835
|
+
const timeoutMs = Date.parse(timeoutAt);
|
|
1836
|
+
if (!Number.isFinite(timeoutMs)) return "NONE";
|
|
1837
|
+
return timeoutMs <= nowMs ? "DUE" : "ACTIVE";
|
|
1838
|
+
}
|
|
1831
1839
|
function formatArgs(argsJson) {
|
|
1832
1840
|
try {
|
|
1833
1841
|
return JSON.stringify(JSON.parse(argsJson), null, 2);
|
|
@@ -1907,6 +1915,14 @@ function RequestCard({ request, onDecided }) {
|
|
|
1907
1915
|
const tr = useTr();
|
|
1908
1916
|
const { decideAll, loading } = useDecideToolApproval();
|
|
1909
1917
|
const [showReject, setShowReject] = useState(false);
|
|
1918
|
+
const [nowMs, setNowMs] = useState(() => Date.now());
|
|
1919
|
+
const timeoutState = getToolApprovalTimeoutState(request.timeoutAt, nowMs);
|
|
1920
|
+
const timeoutDue = timeoutState === "DUE";
|
|
1921
|
+
useEffect(() => {
|
|
1922
|
+
if (timeoutState !== "ACTIVE") return;
|
|
1923
|
+
const interval = setInterval(() => setNowMs(Date.now()), 1e3);
|
|
1924
|
+
return () => clearInterval(interval);
|
|
1925
|
+
}, [timeoutState]);
|
|
1910
1926
|
const handleDecide = async (decision, reason) => {
|
|
1911
1927
|
try {
|
|
1912
1928
|
await decideAll(request, decision, reason);
|
|
@@ -1961,7 +1977,10 @@ function RequestCard({ request, onDecided }) {
|
|
|
1961
1977
|
tr("fluidgrids.toolApproval.requestedAt", "Requested {{when}}", {
|
|
1962
1978
|
when: timeAgo(request.requestedAt, tr)
|
|
1963
1979
|
}),
|
|
1964
|
-
request.timeoutAt && ` \xB7 ${tr(
|
|
1980
|
+
request.timeoutAt && timeoutDue ? ` \xB7 ${tr(
|
|
1981
|
+
"fluidgrids.toolApproval.timeoutDue",
|
|
1982
|
+
"timeout reached; automatic decision pending"
|
|
1983
|
+
)}` : request.timeoutAt && ` \xB7 ${tr(
|
|
1965
1984
|
"fluidgrids.toolApproval.autoResolvesAt",
|
|
1966
1985
|
"auto-resolves at {{time}}",
|
|
1967
1986
|
{
|
|
@@ -1998,7 +2017,7 @@ function RequestCard({ request, onDecided }) {
|
|
|
1998
2017
|
{
|
|
1999
2018
|
"data-agent": "confirm",
|
|
2000
2019
|
size: "sm",
|
|
2001
|
-
disabled: loading,
|
|
2020
|
+
disabled: loading || timeoutDue,
|
|
2002
2021
|
onClick: () => handleDecide("APPROVED"),
|
|
2003
2022
|
"data-testid": "tool-approval-approve",
|
|
2004
2023
|
children: [
|
|
@@ -2012,7 +2031,7 @@ function RequestCard({ request, onDecided }) {
|
|
|
2012
2031
|
{
|
|
2013
2032
|
size: "sm",
|
|
2014
2033
|
variant: "destructive",
|
|
2015
|
-
disabled: loading,
|
|
2034
|
+
disabled: loading || timeoutDue,
|
|
2016
2035
|
onClick: () => setShowReject(true),
|
|
2017
2036
|
"data-testid": "tool-approval-reject",
|
|
2018
2037
|
children: [
|