@burdenoff/microfe-workflows 2026.1125.4 → 2026.1125.6

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/README.md CHANGED
@@ -75,6 +75,27 @@ preloadWorkflowsRoute(window.location.pathname, '/workflows');
75
75
  Once a page other than the builder has settled, the routes warm the builder's
76
76
  code in an idle period, so opening a workflow does not wait for it.
77
77
 
78
+ While the module is mounted, resting the pointer on a link to a Workflows page
79
+ (80 ms) or focusing it with the keyboard starts that page's code, and for a
80
+ workflow link also the builder's read, which the SDK hands to the builder when
81
+ it opens (`installWorkflowsLinkPreload`). A read whose link the person leaves
82
+ without pressing it is discarded, so a later click never opens a definition
83
+ read before an edit. One document listener covers the
84
+ shell's sidebar as well as links inside the pages. A shell can install the same
85
+ listener from `./route-preload` to cover links shown before the module mounts:
86
+
87
+ ```ts
88
+ import { installWorkflowsLinkPreload } from '@burdenoff/microfe-workflows/route-preload';
89
+
90
+ const uninstall = installWorkflowsLinkPreload({ basePath: '/workflows' });
91
+ ```
92
+
93
+ The provider needs a workspace token before it renders the pages: every
94
+ Workflows field is workspace-scoped, and the workspace gateway takes a user's
95
+ workspace only from a verified workspace token, never from `x-workspace-id`
96
+ alone. A refreshed token only replaces the token in the SDK config; it does not
97
+ reset the SDK clients or reload the node palette.
98
+
78
99
  The main entry exports `WorkflowsRoot`, the redirect rules, the plugin, the
79
100
  route table and the module's config and translations. It no longer re-exports
80
101
  SDK components, hooks or pages: a static re-export from the SDK's main barrel
@@ -1,62 +1,64 @@
1
1
  import { useWorkflowsTranslation as e } from "./i18n.js";
2
2
  import { WORKFLOW_PERMISSIONS as t } from "./constants/permissions.js";
3
3
  import { RouteTransition as n } from "./components/RouteTransition.js";
4
- import { routesBase as r, scheduleWorkflowPagePreload as i, workflowsRoutePage as a } from "./routePreload.js";
5
- import { Suspense as o, lazy as s, useEffect as ee } from "react";
6
- import { AccessDenied as c, PermissionGate as l } from "@burdenoff/fe-libs/shared/components";
7
- import { AccessGate as u, GlassCard as d, RouteSkeleton as f, SectionLoader as p, useLoadingSystem as m } from "@burdenoff/fe-libs/ui";
8
- import { useFluidGridsFlagsSettled as h, useSelfHostedWorkersEnabled as g } from "@burdenoff/fluidgrids-fe-sdk/workflow-host";
9
- import { jsx as _, jsxs as v } from "react/jsx-runtime";
10
- import { Navigate as y, Route as b, Routes as x, useLocation as S, useParams as C } from "react-router";
11
- import { AiStudioPage as w, ApprovalInboxPage as T, DataSinkDashboardPage as E, DataTablesPage as D, ErrorAnalyticsPage as O, ExecutionDetailPage as k, ExecutionsListPage as A, HistoryPage as j, InsightsPage as M, NodesPage as N, RunnersPage as P, SettingsPage as F, TaskQueuesPage as te, TemplatePreview as I, TemplatesPage as L, VariablesPage as R, WorkflowBuilderPage as z, WorkflowSearchRedirect as B, WorkflowsList as V } from "@burdenoff/fluidgrids-fe-sdk/workflow-pages";
12
- import { useNavigationV2 as H } from "@burdenoff/fluidgrids-fe-sdk/navigation-v2";
13
- import { WorkflowPageTwin as U, hasWorkflowPageTwin as W } from "@burdenoff/fluidgrids-fe-sdk/page-twins";
4
+ import { routesBase as r, scheduleWorkflowPagePreload as ee, workflowsRoutePage as i } from "./routePreload.js";
5
+ import { useWorkflowsLinkPreload as a } from "./useWorkflowsLinkPreload.js";
6
+ import { useOptionalWorkflowsContext as o } from "./providers/WorkflowsProvider.js";
7
+ import { Suspense as s, lazy as c, useEffect as l } from "react";
8
+ import { AccessDenied as u, PermissionGate as d } from "@burdenoff/fe-libs/shared/components";
9
+ import { AccessGate as f, GlassCard as p, RouteSkeleton as m, SectionLoader as h, useLoadingSystem as g } from "@burdenoff/fe-libs/ui";
10
+ import { useFluidGridsFlagsSettled as _, useSelfHostedWorkersEnabled as v } from "@burdenoff/fluidgrids-fe-sdk/workflow-host";
11
+ import { jsx as y, jsxs as b } from "react/jsx-runtime";
12
+ import { Navigate as x, Route as S, Routes as C, useLocation as w, useParams as T } from "react-router";
13
+ import { AiStudioPage as E, ApprovalInboxPage as D, DataSinkDashboardPage as O, DataTablesPage as k, ErrorAnalyticsPage as A, ExecutionDetailPage as j, ExecutionsListPage as M, HistoryPage as N, InsightsPage as P, NodesPage as F, RunnersPage as I, SettingsPage as L, TaskQueuesPage as R, TemplatePreview as z, TemplatesPage as te, VariablesPage as B, WorkflowBuilderPage as V, WorkflowSearchRedirect as H, WorkflowsList as U } from "@burdenoff/fluidgrids-fe-sdk/workflow-pages";
14
+ import { useNavigationV2 as W } from "@burdenoff/fluidgrids-fe-sdk/navigation-v2";
15
+ import { WorkflowPageTwin as G, hasWorkflowPageTwin as K } from "@burdenoff/fluidgrids-fe-sdk/page-twins";
14
16
  // src/WorkflowsRoutes.tsx
15
- var G = s(async () => ({ default: (await import("./rulePages.js")).RuleSetsPage })), K = s(async () => ({ default: (await import("./rulePages.js")).RuleBuilderPage }));
16
- function q() {
17
- let { pathname: e } = S();
18
- return r(e, C()["*"] ?? "");
17
+ var q = c(async () => ({ default: (await import("./rulePages.js")).RuleSetsPage })), J = c(async () => ({ default: (await import("./rulePages.js")).RuleBuilderPage }));
18
+ function Y() {
19
+ let { pathname: e } = w();
20
+ return r(e, T()["*"] ?? "");
19
21
  }
20
- function J() {
21
- let e = m(), t = q(), { pathname: n } = S();
22
- return e ? /* @__PURE__ */ _(Y, { page: a(n, t) }) : /* @__PURE__ */ _(X, {});
22
+ function X() {
23
+ let e = g(), t = Y(), { pathname: n } = w();
24
+ return e ? /* @__PURE__ */ y(Z, { page: i(n, t) }) : /* @__PURE__ */ y(Q, {});
23
25
  }
24
- function Y({ page: t }) {
26
+ function Z({ page: t }) {
25
27
  let n = e();
26
- return W(t) ? /* @__PURE__ */ _(f, {
28
+ return K(t) ? /* @__PURE__ */ y(m, {
27
29
  label: n("workflows.routes.loading.ariaLabel", "Loading workflow page"),
28
- children: /* @__PURE__ */ _(U, { page: t })
29
- }) : /* @__PURE__ */ _(p, {
30
+ children: /* @__PURE__ */ y(G, { page: t })
31
+ }) : /* @__PURE__ */ y(h, {
30
32
  route: !0,
31
33
  label: n("workflows.routes.loading.message", "Loading workflow page...")
32
34
  });
33
35
  }
34
- function X() {
36
+ function Q() {
35
37
  let t = e();
36
- return /* @__PURE__ */ v("div", {
38
+ return /* @__PURE__ */ b("div", {
37
39
  className: "mx-auto flex w-full max-w-6xl flex-col gap-6 px-4 py-6 sm:px-6",
38
40
  role: "status",
39
41
  "aria-live": "polite",
40
42
  "aria-busy": "true",
41
43
  "aria-label": t("workflows.routes.loading.ariaLabel", "Loading workflow page"),
42
44
  children: [
43
- /* @__PURE__ */ v("div", {
45
+ /* @__PURE__ */ b("div", {
44
46
  className: "flex flex-col gap-3",
45
- children: [/* @__PURE__ */ _("div", { className: "h-7 w-48 rounded-md bg-muted/60 motion-safe:animate-vc-shimmer" }), /* @__PURE__ */ _("div", { className: "h-4 w-72 max-w-full rounded bg-muted/40 motion-safe:animate-vc-shimmer" })]
47
+ children: [/* @__PURE__ */ y("div", { className: "h-7 w-48 rounded-md bg-muted/60 motion-safe:animate-vc-shimmer" }), /* @__PURE__ */ y("div", { className: "h-4 w-72 max-w-full rounded bg-muted/40 motion-safe:animate-vc-shimmer" })]
46
48
  }),
47
- /* @__PURE__ */ _("div", {
49
+ /* @__PURE__ */ y("div", {
48
50
  className: "grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",
49
51
  children: [
50
52
  0,
51
53
  1,
52
54
  2
53
- ].map((e) => /* @__PURE__ */ v(d, {
55
+ ].map((e) => /* @__PURE__ */ b(p, {
54
56
  treatment: "metric",
55
57
  className: "flex flex-col gap-3 border-border-seam p-5",
56
- children: [/* @__PURE__ */ _("div", { className: "h-3 w-20 rounded bg-muted/50 motion-safe:animate-vc-shimmer" }), /* @__PURE__ */ _("div", { className: "h-8 w-24 rounded-md bg-muted/60 motion-safe:animate-vc-shimmer" })]
58
+ children: [/* @__PURE__ */ y("div", { className: "h-3 w-20 rounded bg-muted/50 motion-safe:animate-vc-shimmer" }), /* @__PURE__ */ y("div", { className: "h-8 w-24 rounded-md bg-muted/60 motion-safe:animate-vc-shimmer" })]
57
59
  }, e))
58
60
  }),
59
- /* @__PURE__ */ _(d, {
61
+ /* @__PURE__ */ y(p, {
60
62
  treatment: "glass",
61
63
  className: "flex flex-col gap-4 border-border-seam p-6",
62
64
  children: [
@@ -64,249 +66,256 @@ function X() {
64
66
  1,
65
67
  2,
66
68
  3
67
- ].map((e) => /* @__PURE__ */ v("div", {
69
+ ].map((e) => /* @__PURE__ */ b("div", {
68
70
  className: "flex items-center gap-4",
69
- children: [/* @__PURE__ */ _("div", { className: "h-10 w-10 shrink-0 rounded-full bg-muted/50 motion-safe:animate-vc-shimmer" }), /* @__PURE__ */ v("div", {
71
+ children: [/* @__PURE__ */ y("div", { className: "h-10 w-10 shrink-0 rounded-full bg-muted/50 motion-safe:animate-vc-shimmer" }), /* @__PURE__ */ b("div", {
70
72
  className: "flex flex-1 flex-col gap-2",
71
- children: [/* @__PURE__ */ _("div", { className: "h-4 w-1/3 rounded bg-muted/50 motion-safe:animate-vc-shimmer" }), /* @__PURE__ */ _("div", { className: "h-3 w-2/3 rounded bg-muted/30 motion-safe:animate-vc-shimmer" })]
73
+ children: [/* @__PURE__ */ y("div", { className: "h-4 w-1/3 rounded bg-muted/50 motion-safe:animate-vc-shimmer" }), /* @__PURE__ */ y("div", { className: "h-3 w-2/3 rounded bg-muted/30 motion-safe:animate-vc-shimmer" })]
72
74
  })]
73
75
  }, e))
74
76
  }),
75
- /* @__PURE__ */ _("p", {
77
+ /* @__PURE__ */ y("p", {
76
78
  className: "text-center text-sm text-text-secondary",
77
79
  children: t("workflows.routes.loading.message", "Loading workflow page...")
78
80
  })
79
81
  ]
80
82
  });
81
83
  }
82
- function Z() {
83
- let { runId: e } = C();
84
- return /* @__PURE__ */ _(y, {
84
+ function ne() {
85
+ let { runId: e } = T();
86
+ return /* @__PURE__ */ y(x, {
85
87
  to: `../runs/${e}`,
86
88
  replace: !0
87
89
  });
88
90
  }
89
- function Q() {
90
- let { pathname: e } = S(), t = C()["*"] ?? "", n = t && e.endsWith(t) ? e.slice(0, -t.length) : e, r = n.endsWith("/") ? n : `${n}/`;
91
- return /* @__PURE__ */ _(y, {
91
+ function re() {
92
+ let { pathname: e } = w(), t = T()["*"] ?? "", n = t && e.endsWith(t) ? e.slice(0, -t.length) : e, r = n.endsWith("/") ? n : `${n}/`;
93
+ return /* @__PURE__ */ y(x, {
92
94
  to: `${r}list`,
93
95
  replace: !0
94
96
  });
95
97
  }
96
- function ne() {
97
- let e = g(), n = h();
98
- return !e && !n ? /* @__PURE__ */ _(J, {}) : e ? /* @__PURE__ */ _(l, {
98
+ function ie() {
99
+ let e = v(), n = _();
100
+ return !e && !n ? /* @__PURE__ */ y(X, {}) : e ? /* @__PURE__ */ y(d, {
99
101
  permission: t.TASK_QUEUE_READ,
100
- fallback: /* @__PURE__ */ _(c, {}),
101
- children: /* @__PURE__ */ _(te, {})
102
- }) : /* @__PURE__ */ _(y, {
102
+ fallback: /* @__PURE__ */ y(u, {}),
103
+ children: /* @__PURE__ */ y(R, {})
104
+ }) : /* @__PURE__ */ y(x, {
103
105
  to: "../list",
104
106
  replace: !0
105
107
  });
106
108
  }
107
109
  function $({ perWorkflow: e }) {
108
- return H() ? /* @__PURE__ */ _(l, {
110
+ return W() ? /* @__PURE__ */ y(d, {
109
111
  permission: e ? t.WORKFLOW_READ : t.SYSTEM_CONFIG_READ,
110
- fallback: /* @__PURE__ */ _(re, { perWorkflow: e }),
111
- children: /* @__PURE__ */ _(F, {})
112
- }) : /* @__PURE__ */ _(l, {
112
+ fallback: /* @__PURE__ */ y(ae, { perWorkflow: e }),
113
+ children: /* @__PURE__ */ y(L, {})
114
+ }) : /* @__PURE__ */ y(d, {
113
115
  permission: t.SYSTEM_CONFIG_READ,
114
- fallback: /* @__PURE__ */ _(c, {}),
115
- children: /* @__PURE__ */ _(F, {})
116
+ fallback: /* @__PURE__ */ y(u, {}),
117
+ children: /* @__PURE__ */ y(L, {})
116
118
  });
117
119
  }
118
- function re({ perWorkflow: t }) {
120
+ function ae({ perWorkflow: t }) {
119
121
  let n = e();
120
- return /* @__PURE__ */ _(u, {
122
+ return /* @__PURE__ */ y(f, {
121
123
  message: t ? n("workflows.routes.settingsAccess.workflowMessage", "You need access to workflows to see these settings") : n("workflows.routes.settingsAccess.workspaceMessage", "You need access to the workspace settings"),
122
124
  granterHint: n("workflows.routes.settingsAccess.granterHint", "A workspace admin can give you access.")
123
125
  });
124
126
  }
125
- function ie() {
126
- let { pathname: e } = S(), t = q(), n = a(e, t) === "WorkflowBuilderPage";
127
- ee(() => {
128
- if (!n) return i("WorkflowBuilderPage");
127
+ function oe() {
128
+ let { pathname: e } = w(), t = Y(), n = i(e, t) === "WorkflowBuilderPage";
129
+ l(() => {
130
+ if (!n) return ee("WorkflowBuilderPage");
129
131
  }, [n]);
130
132
  }
131
- function ae() {
132
- return ie(), /* @__PURE__ */ _(o, {
133
- fallback: /* @__PURE__ */ _(J, {}),
134
- children: /* @__PURE__ */ v(x, { children: [
135
- /* @__PURE__ */ _(b, {
133
+ function se() {
134
+ let e = Y(), t = o();
135
+ a(e, {
136
+ workspaceId: t?.workspaceId,
137
+ workspaceToken: t?.workspaceToken
138
+ });
139
+ }
140
+ function ce() {
141
+ return oe(), se(), /* @__PURE__ */ y(s, {
142
+ fallback: /* @__PURE__ */ y(X, {}),
143
+ children: /* @__PURE__ */ b(C, { children: [
144
+ /* @__PURE__ */ y(S, {
136
145
  index: !0,
137
- element: /* @__PURE__ */ _(y, {
146
+ element: /* @__PURE__ */ y(x, {
138
147
  to: "list",
139
148
  replace: !0
140
149
  })
141
150
  }),
142
- /* @__PURE__ */ _(b, {
151
+ /* @__PURE__ */ y(S, {
143
152
  path: "list",
144
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(V, {}) })
153
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(U, {}) })
145
154
  }),
146
- /* @__PURE__ */ _(b, {
155
+ /* @__PURE__ */ y(S, {
147
156
  path: "new",
148
- element: /* @__PURE__ */ _(n, {
157
+ element: /* @__PURE__ */ y(n, {
149
158
  kind: "canvas",
150
- children: /* @__PURE__ */ _(z, {})
159
+ children: /* @__PURE__ */ y(V, {})
151
160
  })
152
161
  }),
153
- /* @__PURE__ */ _(b, {
162
+ /* @__PURE__ */ y(S, {
154
163
  path: "workflow/:id/:version",
155
- element: /* @__PURE__ */ _(n, {
164
+ element: /* @__PURE__ */ y(n, {
156
165
  kind: "canvas",
157
- children: /* @__PURE__ */ _(z, {})
166
+ children: /* @__PURE__ */ y(V, {})
158
167
  })
159
168
  }),
160
- /* @__PURE__ */ _(b, {
169
+ /* @__PURE__ */ y(S, {
161
170
  path: "builder",
162
- element: /* @__PURE__ */ _(y, {
171
+ element: /* @__PURE__ */ y(x, {
163
172
  to: "../new",
164
173
  replace: !0
165
174
  })
166
175
  }),
167
- /* @__PURE__ */ _(b, {
176
+ /* @__PURE__ */ y(S, {
168
177
  path: "builder/:id/:version",
169
- element: /* @__PURE__ */ _(n, {
178
+ element: /* @__PURE__ */ y(n, {
170
179
  kind: "canvas",
171
- children: /* @__PURE__ */ _(z, {})
180
+ children: /* @__PURE__ */ y(V, {})
172
181
  })
173
182
  }),
174
- /* @__PURE__ */ _(b, {
183
+ /* @__PURE__ */ y(S, {
175
184
  path: "resolve/:id",
176
- element: /* @__PURE__ */ _(B, {})
185
+ element: /* @__PURE__ */ y(H, {})
177
186
  }),
178
- /* @__PURE__ */ _(b, {
187
+ /* @__PURE__ */ y(S, {
179
188
  path: "runs",
180
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(A, {}) })
189
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(M, {}) })
181
190
  }),
182
- /* @__PURE__ */ _(b, {
191
+ /* @__PURE__ */ y(S, {
183
192
  path: "runs/:runId",
184
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(k, {}) })
193
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(j, {}) })
185
194
  }),
186
- /* @__PURE__ */ _(b, {
195
+ /* @__PURE__ */ y(S, {
187
196
  path: "ai-studio",
188
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(w, {}) })
197
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(E, {}) })
189
198
  }),
190
- /* @__PURE__ */ _(b, {
199
+ /* @__PURE__ */ y(S, {
191
200
  path: "insights",
192
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(M, {}) })
201
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(P, {}) })
193
202
  }),
194
- /* @__PURE__ */ _(b, {
203
+ /* @__PURE__ */ y(S, {
195
204
  path: "insights/errors",
196
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(O, {}) })
205
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(A, {}) })
197
206
  }),
198
- /* @__PURE__ */ _(b, {
207
+ /* @__PURE__ */ y(S, {
199
208
  path: "data-sinks",
200
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(E, {}) })
209
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(O, {}) })
201
210
  }),
202
- /* @__PURE__ */ _(b, {
211
+ /* @__PURE__ */ y(S, {
203
212
  path: "data-tables",
204
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(D, {}) })
213
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(k, {}) })
205
214
  }),
206
- /* @__PURE__ */ _(b, {
215
+ /* @__PURE__ */ y(S, {
207
216
  path: "rules",
208
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(l, {
217
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(d, {
209
218
  permission: t.WORKFLOW_READ,
210
- fallback: /* @__PURE__ */ _(c, {}),
211
- children: /* @__PURE__ */ _(G, {})
219
+ fallback: /* @__PURE__ */ y(u, {}),
220
+ children: /* @__PURE__ */ y(q, {})
212
221
  }) })
213
222
  }),
214
- /* @__PURE__ */ _(b, {
223
+ /* @__PURE__ */ y(S, {
215
224
  path: "rules/:ruleSetId",
216
- element: /* @__PURE__ */ _(n, {
225
+ element: /* @__PURE__ */ y(n, {
217
226
  kind: "canvas",
218
- children: /* @__PURE__ */ _(l, {
227
+ children: /* @__PURE__ */ y(d, {
219
228
  permission: t.WORKFLOW_READ,
220
- fallback: /* @__PURE__ */ _(c, {}),
221
- children: /* @__PURE__ */ _(K, {})
229
+ fallback: /* @__PURE__ */ y(u, {}),
230
+ children: /* @__PURE__ */ y(J, {})
222
231
  })
223
232
  })
224
233
  }),
225
- /* @__PURE__ */ _(b, {
234
+ /* @__PURE__ */ y(S, {
226
235
  path: "approvals",
227
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(l, {
236
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(d, {
228
237
  permission: t.WORKFLOW_RUN_READ,
229
- fallback: /* @__PURE__ */ _(c, {}),
230
- children: /* @__PURE__ */ _(T, {})
238
+ fallback: /* @__PURE__ */ y(u, {}),
239
+ children: /* @__PURE__ */ y(D, {})
231
240
  }) })
232
241
  }),
233
- /* @__PURE__ */ _(b, {
242
+ /* @__PURE__ */ y(S, {
234
243
  path: "history",
235
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(j, {}) })
244
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(N, {}) })
236
245
  }),
237
- /* @__PURE__ */ _(b, {
246
+ /* @__PURE__ */ y(S, {
238
247
  path: "templates",
239
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(L, {}) })
248
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(te, {}) })
240
249
  }),
241
- /* @__PURE__ */ _(b, {
250
+ /* @__PURE__ */ y(S, {
242
251
  path: "templates/:productId/preview",
243
- element: /* @__PURE__ */ _(n, {
252
+ element: /* @__PURE__ */ y(n, {
244
253
  kind: "canvas",
245
- children: /* @__PURE__ */ _(I, {})
254
+ children: /* @__PURE__ */ y(z, {})
246
255
  })
247
256
  }),
248
- /* @__PURE__ */ _(b, {
257
+ /* @__PURE__ */ y(S, {
249
258
  path: "nodes",
250
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(N, {}) })
259
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(F, {}) })
251
260
  }),
252
- /* @__PURE__ */ _(b, {
261
+ /* @__PURE__ */ y(S, {
253
262
  path: "settings",
254
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _($, { perWorkflow: !1 }) })
263
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y($, { perWorkflow: !1 }) })
255
264
  }),
256
- /* @__PURE__ */ _(b, {
265
+ /* @__PURE__ */ y(S, {
257
266
  path: "settings/:workflowKey",
258
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _($, { perWorkflow: !0 }) })
267
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y($, { perWorkflow: !0 }) })
259
268
  }),
260
- /* @__PURE__ */ _(b, {
269
+ /* @__PURE__ */ y(S, {
261
270
  path: "variables",
262
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(l, {
271
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(d, {
263
272
  permission: t.VARIABLE_READ,
264
- fallback: /* @__PURE__ */ _(c, {}),
265
- children: /* @__PURE__ */ _(R, {})
273
+ fallback: /* @__PURE__ */ y(u, {}),
274
+ children: /* @__PURE__ */ y(B, {})
266
275
  }) })
267
276
  }),
268
- /* @__PURE__ */ _(b, {
277
+ /* @__PURE__ */ y(S, {
269
278
  path: "runners",
270
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(l, {
279
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(d, {
271
280
  permission: t.SANDBOX_READ,
272
- fallback: /* @__PURE__ */ _(c, {}),
273
- children: /* @__PURE__ */ _(P, {})
281
+ fallback: /* @__PURE__ */ y(u, {}),
282
+ children: /* @__PURE__ */ y(I, {})
274
283
  }) })
275
284
  }),
276
- /* @__PURE__ */ _(b, {
285
+ /* @__PURE__ */ y(S, {
277
286
  path: "task-queues",
278
- element: /* @__PURE__ */ _(n, { children: /* @__PURE__ */ _(ne, {}) })
287
+ element: /* @__PURE__ */ y(n, { children: /* @__PURE__ */ y(ie, {}) })
279
288
  }),
280
- /* @__PURE__ */ _(b, {
289
+ /* @__PURE__ */ y(S, {
281
290
  path: "executions",
282
- element: /* @__PURE__ */ _(y, {
291
+ element: /* @__PURE__ */ y(x, {
283
292
  to: "../runs",
284
293
  replace: !0
285
294
  })
286
295
  }),
287
- /* @__PURE__ */ _(b, {
296
+ /* @__PURE__ */ y(S, {
288
297
  path: "executions/:runId",
289
- element: /* @__PURE__ */ _(Z, {})
298
+ element: /* @__PURE__ */ y(ne, {})
290
299
  }),
291
- /* @__PURE__ */ _(b, {
300
+ /* @__PURE__ */ y(S, {
292
301
  path: "credentials",
293
- element: /* @__PURE__ */ _(y, {
302
+ element: /* @__PURE__ */ y(x, {
294
303
  to: "/integrations/connections",
295
304
  replace: !0
296
305
  })
297
306
  }),
298
- /* @__PURE__ */ _(b, {
307
+ /* @__PURE__ */ y(S, {
299
308
  path: "oauth/callback",
300
- element: /* @__PURE__ */ _(y, {
309
+ element: /* @__PURE__ */ y(x, {
301
310
  to: "/integrations/connections",
302
311
  replace: !0
303
312
  })
304
313
  }),
305
- /* @__PURE__ */ _(b, {
314
+ /* @__PURE__ */ y(S, {
306
315
  path: "*",
307
- element: /* @__PURE__ */ _(Q, {})
316
+ element: /* @__PURE__ */ y(re, {})
308
317
  })
309
318
  ] })
310
319
  });
311
320
  }
312
- export { ae as WorkflowsRoutes };
321
+ export { ce as WorkflowsRoutes };
package/dist/index.d.ts CHANGED
@@ -3,7 +3,8 @@ export type { WorkflowsRootProps } from './WorkflowsRoot';
3
3
  export { workflowsSwitchRedirectRules } from './switchRedirectRules';
4
4
  export { fluidGridsPlugin, createFluidGridsPlugin, FLUIDGRIDS_PLUGIN_ID, FLUIDGRIDS_PLUGIN_COMMANDS, FLUIDGRIDS_ASSISTANT_TOGGLE_EVENT, } from './plugin';
5
5
  export type { FluidGridsPluginOptions } from './plugin';
6
- export { WORKFLOWS_ROUTE_PAGES, workflowsRoutePage, preloadWorkflowsRoute, scheduleWorkflowPagePreload, } from './routePreload';
6
+ export { WORKFLOWS_ROUTE_PAGES, workflowsRoutePage, preloadWorkflowsRoute, scheduleWorkflowPagePreload, installWorkflowsLinkPreload, WORKFLOWS_LINK_HOVER_DELAY_MS, } from './routePreload';
7
+ export type { WorkflowsLinkPreloadOptions } from './routePreload';
7
8
  export { config, setWorkflowsConfig, resetWorkflowsConfig } from './config';
8
9
  export type { WorkflowsConfig } from './config';
9
10
  export { enTranslations } from './translations/en';
@@ -4,3 +4,8 @@ export declare function WorkflowsProvider({ children, ...props }: WorkflowsRootP
4
4
  children: ReactNode;
5
5
  }): React.JSX.Element;
6
6
  export declare function useWorkflowsContext(): WorkflowsRootProps;
7
+ /**
8
+ * The provider's props, or null outside a `WorkflowsProvider` (the routes'
9
+ * own tests render them without one).
10
+ */
11
+ export declare function useOptionalWorkflowsContext(): WorkflowsRootProps | null;
@@ -2,28 +2,28 @@ import { setWorkflowsConfig as e } from "../config/index.js";
2
2
  import { useWorkflowsTranslation as t } from "../i18n.js";
3
3
  import { WorkspaceRequiredGuidance as n } from "./WorkspaceRequiredGuidance.js";
4
4
  import { ManagedAiAuthorityBridge as r } from "./ManagedAiAuthorityBridge.js";
5
- import { createContext as i, useEffect as a, useState as o, useSyncExternalStore as s } from "react";
6
- import { GlassCard as c } from "@burdenoff/fe-libs/ui";
7
- import { FluidGridsPermissionsProvider as l, FluidGridsTranslationProvider as u, refreshNodeRegistry as d, resetFluidGridsClient as f, resetFluidGridsConfig as p, resetFluidGridsExecutionState as m, resetGlobalStoreClient as h, setFluidGridsClient as g, setFluidGridsConfig as _, setGlobalStoreClient as v } from "@burdenoff/fluidgrids-fe-sdk/workflow-host";
8
- import { useGatewayClient as y } from "@burdenoff/fe-libs/shared/graphql";
9
- import { PermissionProvider as b, usePermissions as x } from "@burdenoff/fe-libs/shared/providers/shell";
10
- import { jsx as S, jsxs as C } from "react/jsx-runtime";
5
+ import { createContext as i, useContext as a, useEffect as o, useRef as s, useState as c, useSyncExternalStore as l } from "react";
6
+ import { GlassCard as u } from "@burdenoff/fe-libs/ui";
7
+ import { FluidGridsPermissionsProvider as d, FluidGridsTranslationProvider as f, refreshNodeRegistry as p, resetFluidGridsClient as m, resetFluidGridsConfig as h, resetFluidGridsExecutionState as g, resetGlobalStoreClient as _, setFluidGridsClient as v, setFluidGridsConfig as y, setGlobalStoreClient as b } from "@burdenoff/fluidgrids-fe-sdk/workflow-host";
8
+ import { useGatewayClient as x } from "@burdenoff/fe-libs/shared/graphql";
9
+ import { PermissionProvider as S, usePermissions as C } from "@burdenoff/fe-libs/shared/providers/shell";
10
+ import { jsx as w, jsxs as T } from "react/jsx-runtime";
11
11
  // src/providers/WorkflowsProvider.tsx
12
- var w = i(null);
13
- function T({ children: e }) {
14
- let { hasPermission: t, isLoading: n } = x();
15
- return /* @__PURE__ */ S(l, {
12
+ var E = i(null);
13
+ function D({ children: e }) {
14
+ let { hasPermission: t, isLoading: n } = C();
15
+ return /* @__PURE__ */ w(d, {
16
16
  hasPermission: t,
17
17
  isLoading: n,
18
18
  children: e
19
19
  });
20
20
  }
21
- function E(e) {
21
+ function O(e) {
22
22
  let t = e.endsWith("/") ? e.slice(0, -1) : e;
23
23
  return t.endsWith("/graphql") ? t : `${t}/workspaces/graphql`;
24
24
  }
25
- function D({ children: i, ...l }) {
26
- let x = t(), D = y("workspace"), O = y("global"), [k] = o(() => {
25
+ function k({ children: i, ...a }) {
26
+ let d = t(), C = x("workspace"), k = x("global"), [A] = c(() => {
27
27
  let e = !1, t = /* @__PURE__ */ new Set();
28
28
  return {
29
29
  subscribe: (e) => (t.add(e), () => {
@@ -35,85 +35,108 @@ function D({ children: i, ...l }) {
35
35
  for (let e of t) e();
36
36
  }
37
37
  };
38
- }), A = s(k.subscribe, k.snapshot, () => !1);
39
- a(() => (m(), m), []);
40
- let j = l.builderTimings?.enabled, M = l.builderTimings?.sampleRate;
41
- return a(() => {
42
- if (!l.apiGatewayUrl || !l.productId || !l.workspaceId || !l.workspaceToken || !D || !O) return;
43
- let t = l.apiGatewayUrl.replace(/\/+$/, "");
38
+ }), j = l(A.subscribe, A.snapshot, () => !1);
39
+ o(() => (g(), g), []);
40
+ let M = a.builderTimings?.enabled, N = a.builderTimings?.sampleRate, P = s({
41
+ authToken: a.authToken,
42
+ workspaceToken: a.workspaceToken
43
+ });
44
+ o(() => {
45
+ P.current = {
46
+ authToken: a.authToken,
47
+ workspaceToken: a.workspaceToken
48
+ };
49
+ }, [a.authToken, a.workspaceToken]);
50
+ let F = s(null), I = !!a.workspaceToken;
51
+ return o(() => {
52
+ if (!a.apiGatewayUrl || !a.productId || !a.workspaceId || !I || !C || !k) return;
53
+ let { authToken: t, workspaceToken: n } = P.current, r = a.apiGatewayUrl.replace(/\/+$/, "");
44
54
  e({
45
- workflowSvcUrl: E(t),
46
- apiGatewayUrl: t
55
+ workflowSvcUrl: O(r),
56
+ apiGatewayUrl: r
47
57
  });
48
- let n = j === void 0 && M === void 0 ? void 0 : {
49
- enabled: j,
50
- sampleRate: M
51
- }, r = l.callbacks?.onWorkflowSaved;
52
- return _({
53
- apiGatewayUrl: t,
54
- authToken: l.authToken,
55
- workspaceToken: l.workspaceToken,
56
- workspaceId: l.workspaceId,
57
- tenantId: l.tenantId,
58
- productId: l.productId,
59
- productName: l.productName,
60
- onWorkflowSaved: r,
61
- builderTimings: n,
62
- devportalBasePath: l.devportalBasePath
63
- }), g(D), v(O), d().catch((e) => {
58
+ let i = M === void 0 && N === void 0 ? void 0 : {
59
+ enabled: M,
60
+ sampleRate: N
61
+ }, o = a.callbacks?.onWorkflowSaved;
62
+ return y({
63
+ apiGatewayUrl: r,
64
+ authToken: t,
65
+ workspaceToken: n,
66
+ workspaceId: a.workspaceId,
67
+ tenantId: a.tenantId,
68
+ productId: a.productId,
69
+ productName: a.productName,
70
+ onWorkflowSaved: o,
71
+ builderTimings: i,
72
+ devportalBasePath: a.devportalBasePath
73
+ }), v(C), b(k), p().catch((e) => {
64
74
  console.warn("[Workflows] Could not refresh installed nodes", e);
65
- }), k.set(!0), () => {
66
- k.set(!1), f(), h(), p();
75
+ }), F.current = {
76
+ authToken: t,
77
+ workspaceToken: n
78
+ }, A.set(!0), () => {
79
+ F.current = null, A.set(!1), m(), _(), h();
67
80
  };
68
81
  }, [
82
+ A,
83
+ C,
69
84
  k,
70
- D,
71
- O,
72
- l.apiGatewayUrl,
73
- l.authToken,
74
- l.workspaceToken,
75
- l.workspaceId,
76
- l.tenantId,
77
- l.productId,
78
- l.productName,
79
- l.callbacks,
80
- j,
85
+ a.apiGatewayUrl,
86
+ I,
87
+ a.workspaceId,
88
+ a.tenantId,
89
+ a.productId,
90
+ a.productName,
91
+ a.callbacks,
81
92
  M,
82
- l.devportalBasePath
83
- ]), l.workspaceId ? !A || !l.workspaceToken || !l.productId ? /* @__PURE__ */ C("div", {
93
+ N,
94
+ a.devportalBasePath
95
+ ]), o(() => {
96
+ let e = F.current;
97
+ if (e === null || !a.workspaceToken) return;
98
+ let t = {
99
+ authToken: a.authToken,
100
+ workspaceToken: a.workspaceToken
101
+ };
102
+ (e.authToken !== t.authToken || e.workspaceToken !== t.workspaceToken) && (F.current = t, y(t));
103
+ }, [a.authToken, a.workspaceToken]), a.workspaceId ? !j || !a.workspaceToken || !a.productId ? /* @__PURE__ */ T("div", {
84
104
  className: "mx-auto flex h-full min-h-[60vh] w-full max-w-md flex-col items-center justify-center gap-4 px-4 py-10 text-center",
85
105
  role: "status",
86
106
  "aria-live": "polite",
87
107
  "aria-busy": "true",
88
- "aria-label": x("workflows.provider.loading.ariaLabel", "Loading workflows"),
89
- children: [/* @__PURE__ */ C(c, {
108
+ "aria-label": d("workflows.provider.loading.ariaLabel", "Loading workflows"),
109
+ children: [/* @__PURE__ */ T(u, {
90
110
  treatment: "glass",
91
111
  className: "flex w-full flex-col items-center gap-4 border-border-seam p-6",
92
112
  children: [
93
- /* @__PURE__ */ S("div", { className: "h-12 w-12 rounded-full bg-muted/60 motion-safe:animate-vc-shimmer" }),
94
- /* @__PURE__ */ S("div", { className: "h-4 w-40 rounded bg-muted/50 motion-safe:animate-vc-shimmer" }),
95
- /* @__PURE__ */ S("div", { className: "h-3 w-56 max-w-full rounded bg-muted/30 motion-safe:animate-vc-shimmer" })
113
+ /* @__PURE__ */ w("div", { className: "h-12 w-12 rounded-full bg-muted/60 motion-safe:animate-vc-shimmer" }),
114
+ /* @__PURE__ */ w("div", { className: "h-4 w-40 rounded bg-muted/50 motion-safe:animate-vc-shimmer" }),
115
+ /* @__PURE__ */ w("div", { className: "h-3 w-56 max-w-full rounded bg-muted/30 motion-safe:animate-vc-shimmer" })
96
116
  ]
97
- }), /* @__PURE__ */ S("p", {
117
+ }), /* @__PURE__ */ w("p", {
98
118
  className: "text-sm text-text-secondary",
99
- children: x("workflows.provider.loading.message", "Connecting workflows...")
119
+ children: d("workflows.provider.loading.message", "Connecting workflows...")
100
120
  })]
101
- }) : /* @__PURE__ */ S(w.Provider, {
102
- value: l,
103
- children: /* @__PURE__ */ S(r, {
104
- ...l,
105
- children: /* @__PURE__ */ S(u, {
106
- t: x,
107
- children: /* @__PURE__ */ S(b, {
108
- scopeId: l.workspaceId ?? null,
121
+ }) : /* @__PURE__ */ w(E.Provider, {
122
+ value: a,
123
+ children: /* @__PURE__ */ w(r, {
124
+ ...a,
125
+ children: /* @__PURE__ */ w(f, {
126
+ t: d,
127
+ children: /* @__PURE__ */ w(S, {
128
+ scopeId: a.workspaceId ?? null,
109
129
  gateway: "workspace",
110
- children: /* @__PURE__ */ S(T, { children: i })
130
+ children: /* @__PURE__ */ w(D, { children: i })
111
131
  })
112
132
  })
113
133
  })
114
- }) : /* @__PURE__ */ S(n, {
115
- basePath: l.basePath,
116
- navigate: l.navigate
134
+ }) : /* @__PURE__ */ w(n, {
135
+ basePath: a.basePath,
136
+ navigate: a.navigate
117
137
  });
118
138
  }
119
- export { D as WorkflowsProvider };
139
+ function A() {
140
+ return a(E);
141
+ }
142
+ export { k as WorkflowsProvider, A as useOptionalWorkflowsContext };
@@ -1,4 +1,5 @@
1
1
  import { WorkflowPageName } from '@burdenoff/fluidgrids-fe-sdk/workflow-pages';
2
+ import { WorkflowBuilderRoute } from '@burdenoff/fluidgrids-fe-sdk/workflow-route';
2
3
  /**
3
4
  * Which FluidGrids page each Workflows route renders (BOFF-11826).
4
5
  *
@@ -44,6 +45,53 @@ export declare function scheduleWorkflowPagePreload(page: WorkflowPageName, { se
44
45
  settleMs?: number | undefined;
45
46
  idleTimeoutMs?: number | undefined;
46
47
  }): () => void;
48
+ /**
49
+ * How long the pointer has to rest on a Workflows link before its page starts
50
+ * loading. Long enough that sweeping the pointer across the sidebar starts
51
+ * nothing, short enough to win most of the ~200-300 ms between hover and click.
52
+ */
53
+ export declare const WORKFLOWS_LINK_HOVER_DELAY_MS = 80;
54
+ export interface WorkflowsLinkPreloadOptions {
55
+ /** Where the shell mounts `WorkflowsRoot` (default `/workflows`). */
56
+ basePath?: string;
57
+ /** See {@link WORKFLOWS_LINK_HOVER_DELAY_MS}. */
58
+ hoverDelayMs?: number;
59
+ /**
60
+ * Starts the builder's read for a workflow link (the builder's page
61
+ * operation, handed over through `@burdenoff/fluidgrids-fe-sdk/workflow-route`).
62
+ * Omitted, a builder link starts only the builder's code.
63
+ */
64
+ prefetchBuilderData?: (route: WorkflowBuilderRoute) => void;
65
+ /**
66
+ * Drops the builder reads started for a link the person then left without
67
+ * opening it (`clearPrefetchedWorkflowsForBuilder` from
68
+ * `@burdenoff/fluidgrids-fe-sdk/workflow-route`). A read is handed to the
69
+ * builder for up to 15 s after it starts, so without this a read started by
70
+ * a passing hover could be handed over after the workflow was edited and
71
+ * saved in the meantime, and the builder would open the older definition.
72
+ */
73
+ discardBuilderData?: () => void;
74
+ /** Where to listen (default `document`); tests pass their own. */
75
+ root?: Pick<Document, 'addEventListener' | 'removeEventListener'>;
76
+ }
77
+ /**
78
+ * Starts a Workflows page when the person shows they are about to open it
79
+ * (BOFF-16427, LH-04): when the pointer rests on a link to it, or the link
80
+ * takes keyboard focus. The page's code starts, and for a workflow link the
81
+ * builder's read too, so the click opens a page whose code (and data) are
82
+ * already on the way instead of starting both on click.
83
+ *
84
+ * One listener on the document covers every link, wherever it is rendered:
85
+ * the shell's sidebar, the Workflows pages, the command palette. Links to
86
+ * other modules, other sites and new tabs are ignored. Returns a function
87
+ * that removes the listeners.
88
+ *
89
+ * A builder read lives only as long as the intent that started it: when the
90
+ * pointer leaves the link, or focus moves off it, without the link having been
91
+ * pressed or activated, the read is discarded (`discardBuilderData`), so a
92
+ * click much later never opens a definition read before an edit.
93
+ */
94
+ export declare function installWorkflowsLinkPreload({ basePath, hoverDelayMs, prefetchBuilderData, discardBuilderData, root, }?: WorkflowsLinkPreloadOptions): () => void;
47
95
  /**
48
96
  * The address without the splat's segments. Counted, not compared as text: React Router decodes
49
97
  * the splat (`run 1`) while the pathname stays encoded (`run%201`).
@@ -1,7 +1,8 @@
1
1
  import { matchPath as e } from "react-router";
2
2
  import { preloadWorkflowPage as t } from "@burdenoff/fluidgrids-fe-sdk/workflow-pages";
3
+ import { matchWorkflowBuilderRoute as n } from "@burdenoff/fluidgrids-fe-sdk/workflow-route";
3
4
  // src/routePreload.ts
4
- var n = [
5
+ var r = [
5
6
  ["list", "WorkflowsList"],
6
7
  ["new", "WorkflowBuilderPage"],
7
8
  ["workflow/:id/:version", "WorkflowBuilderPage"],
@@ -25,47 +26,105 @@ var n = [
25
26
  ["runners", "RunnersPage"],
26
27
  ["task-queues", "TaskQueuesPage"]
27
28
  ];
28
- function r(t, r = "/workflows") {
29
- let i = r.replace(/\/+$/, "");
29
+ function i(t, n = "/workflows") {
30
+ let i = n.replace(/\/+$/, "");
30
31
  if (t !== i && !t.startsWith(`${i}/`)) return null;
31
32
  let a = t.slice(i.length).replace(/^\/+/, "").replace(/\/+$/, "");
32
33
  if (a === "") return "WorkflowsList";
33
- for (let [t, r] of n) if (e({
34
+ for (let [t, n] of r) if (e({
34
35
  path: `/${t}`,
35
36
  end: !0
36
- }, `/${a}`)) return r;
37
+ }, `/${a}`)) return n;
37
38
  return null;
38
39
  }
39
- function i(e, n = "/workflows") {
40
- let i = r(e, n);
41
- return i && t(i), i;
40
+ function a(e, n = "/workflows") {
41
+ let r = i(e, n);
42
+ return r && t(r), r;
42
43
  }
43
- var a = 3e3;
44
- function o(e, { settleMs: n = a, idleTimeoutMs: r = 1e4 } = {}) {
44
+ var o = 3e3;
45
+ function s(e, { settleMs: n = o, idleTimeoutMs: r = 1e4 } = {}) {
45
46
  if (typeof window > "u" || typeof document > "u") return () => {};
46
- let i = !1, o = () => {}, s = () => {
47
+ let i = !1, a = () => {}, s = () => {
47
48
  i || t(e);
48
49
  }, c = () => {
49
50
  if (i) return;
50
51
  if (typeof window.requestIdleCallback == "function") {
51
52
  let e = window.requestIdleCallback(s, { timeout: r });
52
- o = () => window.cancelIdleCallback(e);
53
+ a = () => window.cancelIdleCallback(e);
53
54
  return;
54
55
  }
55
56
  let e = setTimeout(s, 0);
56
- o = () => clearTimeout(e);
57
+ a = () => clearTimeout(e);
57
58
  }, l = () => {
58
59
  if (i) return;
59
60
  let e = setTimeout(c, n);
60
- o = () => clearTimeout(e);
61
+ a = () => clearTimeout(e);
61
62
  };
62
- return document.readyState === "complete" ? l() : (window.addEventListener("load", l, { once: !0 }), o = () => window.removeEventListener("load", l)), () => {
63
- i = !0, o();
63
+ return document.readyState === "complete" ? l() : (window.addEventListener("load", l, { once: !0 }), a = () => window.removeEventListener("load", l)), () => {
64
+ i = !0, a();
64
65
  };
65
66
  }
66
- function s(e, t) {
67
+ var c = 80;
68
+ function l(e) {
69
+ if (typeof Element > "u" || !(e instanceof Element)) return null;
70
+ let t = e.closest("a[href]");
71
+ if (!t || t.getAttribute("target") === "_blank" || t.hasAttribute("download")) return null;
72
+ try {
73
+ let e = new URL(t.getAttribute("href") ?? "", window.location.href);
74
+ return e.origin === window.location.origin ? {
75
+ anchor: t,
76
+ pathname: e.pathname
77
+ } : null;
78
+ } catch {
79
+ return null;
80
+ }
81
+ }
82
+ function u({ basePath: e = "/workflows", hoverDelayMs: t = 80, prefetchBuilderData: r, discardBuilderData: o, root: s = typeof document > "u" ? void 0 : document } = {}) {
83
+ if (!s || typeof window > "u") return () => {};
84
+ let c = null, u = null, d = () => {
85
+ let e = u;
86
+ u = null, e && !e.activated && o?.();
87
+ }, f = ({ anchor: t, pathname: i }) => {
88
+ if (a(i, e) !== "WorkflowBuilderPage" || !r) return;
89
+ let o = n(i, e);
90
+ o && (u && u.anchor !== t && d(), u ||= {
91
+ anchor: t,
92
+ activated: !1
93
+ }, r(o));
94
+ }, p = () => {
95
+ c && clearTimeout(c.timer), c = null;
96
+ }, m = (e) => {
97
+ if (!u || !(e.target instanceof Node) || !u.anchor.contains(e.target)) return;
98
+ let t = e.relatedTarget;
99
+ t instanceof Node && u.anchor.contains(t) || d();
100
+ }, h = (e) => {
101
+ (e.type !== "keydown" || e.key === "Enter") && u && e.target instanceof Node && u.anchor.contains(e.target) && (u.activated = !0);
102
+ }, g = (n) => {
103
+ let r = l(n.target);
104
+ if (!r || i(r.pathname, e) === null || c?.anchor === r.anchor) return;
105
+ p();
106
+ let a = setTimeout(() => {
107
+ c = null, f(r);
108
+ }, t);
109
+ c = {
110
+ anchor: r.anchor,
111
+ timer: a
112
+ };
113
+ }, _ = (e) => {
114
+ if (m(e), !c) return;
115
+ let t = e.relatedTarget;
116
+ t instanceof Node && c.anchor.contains(t) || p();
117
+ }, v = (e) => {
118
+ let t = l(e.target);
119
+ t && f(t);
120
+ }, y = { capture: !0 };
121
+ return s.addEventListener("pointerover", g), s.addEventListener("pointerout", _), s.addEventListener("focusin", v), s.addEventListener("focusout", m), s.addEventListener("pointerdown", h, y), s.addEventListener("click", h, y), s.addEventListener("keydown", h, y), () => {
122
+ p(), u = null, s.removeEventListener("pointerover", g), s.removeEventListener("pointerout", _), s.removeEventListener("focusin", v), s.removeEventListener("focusout", m), s.removeEventListener("pointerdown", h, y), s.removeEventListener("click", h, y), s.removeEventListener("keydown", h, y);
123
+ };
124
+ }
125
+ function d(e, t) {
67
126
  if (!t) return e;
68
127
  let n = e.split("/"), r = t.replace(/\/+$/, "").split("/").length, i = +!!e.endsWith("/"), a = n.length - r - i;
69
128
  return a > 0 ? `${n.slice(0, a).join("/")}/` : e;
70
129
  }
71
- export { n as WORKFLOWS_ROUTE_PAGES, a as WORKFLOW_PAGE_SETTLE_MS, i as preloadWorkflowsRoute, s as routesBase, o as scheduleWorkflowPagePreload, r as workflowsRoutePage };
130
+ export { c as WORKFLOWS_LINK_HOVER_DELAY_MS, r as WORKFLOWS_ROUTE_PAGES, o as WORKFLOW_PAGE_SETTLE_MS, u as installWorkflowsLinkPreload, a as preloadWorkflowsRoute, d as routesBase, s as scheduleWorkflowPagePreload, i as workflowsRoutePage };
@@ -23,6 +23,8 @@ export declare const mockState: {
23
23
  }>;
24
24
  /** Every page a component under test started loading early, in call order. */
25
25
  preloads: string[];
26
+ /** Every `graphqlFetch` call (its options), in call order. */
27
+ graphqlFetches: Array<Record<string, unknown>>;
26
28
  };
27
29
  export declare const SDK_PAGES: readonly ["AiStudioPage", "ApprovalInboxPage", "DataSinkDashboardPage", "DataTablesPage", "ErrorAnalyticsPage", "ExecutionsListPage", "ExecutionDetailPage", "HistoryPage", "InsightsPage", "NodesPage", "RunnersPage", "SettingsPage", "TaskQueuesPage", "TemplatesPage", "TemplatePreview", "VariablesPage", "WorkflowBuilderPage", "WorkflowSearchRedirect", "WorkflowsList"];
28
30
  export declare function installModuleMocks(): Promise<void>;
@@ -0,0 +1,28 @@
1
+ import { WorkflowRouteRequest } from '@burdenoff/fluidgrids-fe-sdk/workflow-route';
2
+ export interface WorkflowsLinkPreloadAuthority {
3
+ /** The active workspace. */
4
+ workspaceId?: string;
5
+ /** The workspace token the host holds for it. */
6
+ workspaceToken?: string;
7
+ }
8
+ /**
9
+ * The builder's read for a hovered or focused workflow link, sent the way the
10
+ * FluidGrids shell sends it at boot (fluidgrids-app `workflowRouteStart.ts`):
11
+ * through fe-libs' `graphqlFetch` with the person's own tokens, so the
12
+ * gateway's `@rbac` and the workspace boundary decide exactly as they do for
13
+ * the builder. It goes out on its own request at once, and it is best effort:
14
+ * it never refreshes the session or reports an error, because a read that
15
+ * fails is not handed over and the builder then sends its own.
16
+ */
17
+ export declare function workflowsLinkRequest(workspaceId: string, workspaceToken: string): WorkflowRouteRequest;
18
+ /**
19
+ * Starts a Workflows page's code, and for a workflow link the builder's read,
20
+ * when the person rests the pointer on a link to it or focuses the link
21
+ * (BOFF-16427, LH-04; see `installWorkflowsLinkPreload`).
22
+ *
23
+ * @param basePath where the Workflows routes are mounted (e.g. `/workflows/`).
24
+ * @param authority the workspace and token the builder's read is sent with,
25
+ * read when a link is hovered so a refreshed token is used without
26
+ * reinstalling the listeners.
27
+ */
28
+ export declare function useWorkflowsLinkPreload(basePath: string, authority: WorkflowsLinkPreloadAuthority): void;
@@ -0,0 +1,43 @@
1
+ import { installWorkflowsLinkPreload as e } from "./routePreload.js";
2
+ import { useEffect as t, useRef as n } from "react";
3
+ import { graphqlFetch as r } from "@burdenoff/fe-libs/shared/graphql";
4
+ import { clearPrefetchedWorkflowsForBuilder as i, prefetchWorkflowForBuilder as a } from "@burdenoff/fluidgrids-fe-sdk/workflow-route";
5
+ // src/useWorkflowsLinkPreload.ts
6
+ function o(e, t) {
7
+ return ({ operationName: n, query: i, variables: a }) => r({
8
+ gateway: "workspace",
9
+ operationName: n,
10
+ query: i,
11
+ variables: a,
12
+ workspaceId: e,
13
+ workspaceToken: t,
14
+ batch: !1,
15
+ responseCache: "no-store",
16
+ skipAuthRetry: !0,
17
+ suppressGlobalErrorEvent: !0
18
+ });
19
+ }
20
+ function s(r, s) {
21
+ let { workspaceId: c, workspaceToken: l } = s, u = n({
22
+ workspaceId: c,
23
+ workspaceToken: l
24
+ });
25
+ t(() => {
26
+ u.current = {
27
+ workspaceId: c,
28
+ workspaceToken: l
29
+ };
30
+ }, [c, l]), t(() => e({
31
+ basePath: r,
32
+ prefetchBuilderData: (e) => {
33
+ let t = u.current;
34
+ t.workspaceId && t.workspaceToken && a({
35
+ ...e,
36
+ workspaceId: t.workspaceId,
37
+ request: o(t.workspaceId, t.workspaceToken)
38
+ });
39
+ },
40
+ discardBuilderData: i
41
+ }), [r]);
42
+ }
43
+ export { s as useWorkflowsLinkPreload, o as workflowsLinkRequest };
package/dist/workflows.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { WorkflowsRoot as e } from "./WorkflowsRoot.js";
2
2
  import { workflowsSwitchRedirectRules as t } from "./switchRedirectRules.js";
3
3
  import { FLUIDGRIDS_ASSISTANT_TOGGLE_EVENT as n, FLUIDGRIDS_PLUGIN_COMMANDS as r, FLUIDGRIDS_PLUGIN_ID as i, createFluidGridsPlugin as a, fluidGridsPlugin as o } from "./plugin.js";
4
- import { WORKFLOWS_ROUTE_PAGES as s, preloadWorkflowsRoute as c, scheduleWorkflowPagePreload as l, workflowsRoutePage as u } from "./routePreload.js";
5
- import { config as d, resetWorkflowsConfig as f, setWorkflowsConfig as p } from "./config/index.js";
6
- import { enTranslations as m } from "./translations/en.js";
7
- export { n as FLUIDGRIDS_ASSISTANT_TOGGLE_EVENT, r as FLUIDGRIDS_PLUGIN_COMMANDS, i as FLUIDGRIDS_PLUGIN_ID, s as WORKFLOWS_ROUTE_PAGES, e as WorkflowsRoot, d as config, a as createFluidGridsPlugin, m as enTranslations, o as fluidGridsPlugin, c as preloadWorkflowsRoute, f as resetWorkflowsConfig, l as scheduleWorkflowPagePreload, p as setWorkflowsConfig, u as workflowsRoutePage, t as workflowsSwitchRedirectRules };
4
+ import { WORKFLOWS_LINK_HOVER_DELAY_MS as s, WORKFLOWS_ROUTE_PAGES as c, installWorkflowsLinkPreload as l, preloadWorkflowsRoute as u, scheduleWorkflowPagePreload as d, workflowsRoutePage as f } from "./routePreload.js";
5
+ import { config as p, resetWorkflowsConfig as m, setWorkflowsConfig as h } from "./config/index.js";
6
+ import { enTranslations as g } from "./translations/en.js";
7
+ export { n as FLUIDGRIDS_ASSISTANT_TOGGLE_EVENT, r as FLUIDGRIDS_PLUGIN_COMMANDS, i as FLUIDGRIDS_PLUGIN_ID, s as WORKFLOWS_LINK_HOVER_DELAY_MS, c as WORKFLOWS_ROUTE_PAGES, e as WorkflowsRoot, p as config, a as createFluidGridsPlugin, g as enTranslations, o as fluidGridsPlugin, l as installWorkflowsLinkPreload, u as preloadWorkflowsRoute, m as resetWorkflowsConfig, d as scheduleWorkflowPagePreload, h as setWorkflowsConfig, f as workflowsRoutePage, t as workflowsSwitchRedirectRules };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/microfe-workflows",
3
- "version": "2026.1125.4",
3
+ "version": "2026.1125.6",
4
4
  "description": "Workflows microfrontend for Burdenoff products - thin shell over @burdenoff/fluidgrids-fe-sdk",
5
5
  "type": "module",
6
6
  "exports": {
@@ -55,7 +55,7 @@
55
55
  "react-router": "^8.5.1"
56
56
  },
57
57
  "devDependencies": {
58
- "@burdenoff/fluidgrids-fe-sdk": "2026.1125.3",
58
+ "@burdenoff/fluidgrids-fe-sdk": "2026.1125.21",
59
59
  "@burdenoff/toolchain": "2026.1107.14",
60
60
  "@types/bun": "^1.4.4",
61
61
  "@types/node": "^24.19.2",
@@ -75,7 +75,7 @@
75
75
  "vite": "8.3.5"
76
76
  },
77
77
  "peerDependencies": {
78
- "@burdenoff/fluidgrids-fe-sdk": "2026.1125.3",
78
+ "@burdenoff/fluidgrids-fe-sdk": "2026.1125.21",
79
79
  "framer-motion": "^12.0.0",
80
80
  "react": "^19.0.0",
81
81
  "react-dom": "^19.0.0"