@burdenoff/fluidgrids-fe-sdk 2026.918.2 → 2026.922.2

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.
Files changed (27) hide show
  1. package/dist/{WorkflowBuilder-GFFW5WSB.js → WorkflowBuilder-XZPLGBCS.js} +5 -5
  2. package/dist/{WorkflowBuilder-GFFW5WSB.js.map → WorkflowBuilder-XZPLGBCS.js.map} +1 -1
  3. package/dist/{WorkflowsList-ZBMSG2WP.js → WorkflowsList-J6IDS3SR.js} +4 -4
  4. package/dist/{WorkflowsList-ZBMSG2WP.js.map → WorkflowsList-J6IDS3SR.js.map} +1 -1
  5. package/dist/{chunk-HY7K7SLI.js → chunk-3RWKQIV4.js} +957 -53
  6. package/dist/chunk-3RWKQIV4.js.map +1 -0
  7. package/dist/chunk-I3WUYESA.js +668 -0
  8. package/dist/chunk-I3WUYESA.js.map +1 -0
  9. package/dist/{chunk-YAADZDGX.js → chunk-K4U4WX4R.js} +3 -3
  10. package/dist/{chunk-YAADZDGX.js.map → chunk-K4U4WX4R.js.map} +1 -1
  11. package/dist/{chunk-77Y5WTBD.js → chunk-SU6UYGRW.js} +4 -4
  12. package/dist/{chunk-77Y5WTBD.js.map → chunk-SU6UYGRW.js.map} +1 -1
  13. package/dist/{chunk-TOFLHYUQ.js → chunk-TKUCCNEO.js} +4 -4
  14. package/dist/{chunk-TOFLHYUQ.js.map → chunk-TKUCCNEO.js.map} +1 -1
  15. package/dist/{chunk-YH2QC6D6.js → chunk-Y4AM4RTD.js} +4 -4
  16. package/dist/{chunk-YH2QC6D6.js.map → chunk-Y4AM4RTD.js.map} +1 -1
  17. package/dist/index.d.ts +2 -2
  18. package/dist/index.js +10 -10
  19. package/dist/templates.js +3 -3
  20. package/dist/{workflow-builder-JKkdIJoP.d.ts → workflow-builder-BNWKK8C7.d.ts} +53 -2
  21. package/dist/workflow-builder.d.ts +1 -1
  22. package/dist/workflow-builder.js +4 -4
  23. package/dist/workflows-list.js +2 -2
  24. package/package.json +1 -1
  25. package/dist/chunk-HY7K7SLI.js.map +0 -1
  26. package/dist/chunk-KT72XMAB.js +0 -379
  27. package/dist/chunk-KT72XMAB.js.map +0 -1
@@ -1,379 +0,0 @@
1
- import { useTr } from './chunk-7YWBH2A5.js';
2
- import { nanoid } from 'nanoid/non-secure';
3
- import { addEdge, applyEdgeChanges, applyNodeChanges } from '@xyflow/react';
4
- import { create } from 'zustand';
5
- import { produce } from 'immer';
6
- import { AlertDialog, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogCancel, AlertDialogAction } from '@burdenoff/fe-libs/ui';
7
- import { jsx, jsxs } from 'react/jsx-runtime';
8
-
9
- var TAGS = [
10
- { value: "marketing", label: "Marketing", color: "#ef4444" },
11
- { value: "support", label: "Support", color: "#ef4444" },
12
- { value: "lead", label: "Lead", color: "#eab308" },
13
- { value: "new", label: "New", color: "#22c55e" }
14
- ];
15
- var INITIAL_EXECUTION = {
16
- isExecuting: false,
17
- executingNodeId: null,
18
- currentRunId: null,
19
- logs: [],
20
- selectedLogId: null,
21
- panelExpanded: false,
22
- nodeStatuses: {},
23
- nodeItemCounts: {}
24
- };
25
- var useFlowStore = create()((set, get) => ({
26
- tags: TAGS,
27
- workflow: {
28
- id: nanoid(),
29
- workflowKey: "",
30
- name: "",
31
- version: "",
32
- alias: "",
33
- edges: [],
34
- nodes: [],
35
- ndv: null,
36
- quickConfig: null,
37
- pendingConnection: null,
38
- sidebar: {
39
- active: "none",
40
- panels: {
41
- nodeProperties: {
42
- selectedNode: null
43
- }
44
- }
45
- }
46
- },
47
- execution: { ...INITIAL_EXECUTION },
48
- actions: {
49
- saveWorkflow: () => {
50
- const { workflow } = get();
51
- const { id, name, version, alias, dbId, status, nodes, edges } = workflow;
52
- set({ workflow });
53
- return { id, name, version, alias, dbId, status, nodes, edges };
54
- },
55
- setWorkflow: (workflow) => {
56
- set((state) => ({
57
- workflow: {
58
- ...state.workflow,
59
- ...workflow
60
- }
61
- }));
62
- },
63
- resetWorkflow: () => {
64
- set(() => ({
65
- workflow: {
66
- id: nanoid(),
67
- workflowKey: "",
68
- name: "",
69
- version: "",
70
- alias: "",
71
- dbId: void 0,
72
- status: void 0,
73
- edges: [],
74
- nodes: [],
75
- ndv: null,
76
- quickConfig: null,
77
- pendingConnection: null,
78
- sidebar: {
79
- active: "none",
80
- panels: {
81
- nodeProperties: {
82
- selectedNode: null
83
- }
84
- }
85
- }
86
- },
87
- // Wipe run state too — resetWorkflow fires when the builder loads a
88
- // (different) workflow, so the previous workflow's logs must not carry
89
- // over into this one's Logs panel.
90
- execution: { ...INITIAL_EXECUTION }
91
- }));
92
- },
93
- ndv: {
94
- // Opening the full NDV supersedes the floating quick-config panel — the
95
- // two edit the same node data, so only one should be visible at a time.
96
- open: (node) => set((state) => ({
97
- workflow: { ...state.workflow, ndv: node, quickConfig: null }
98
- })),
99
- close: () => set((state) => ({
100
- workflow: { ...state.workflow, ndv: null }
101
- }))
102
- },
103
- quickConfig: {
104
- open: (node) => set((state) => ({
105
- workflow: { ...state.workflow, quickConfig: node }
106
- })),
107
- close: () => set((state) => ({
108
- workflow: { ...state.workflow, quickConfig: null }
109
- }))
110
- },
111
- pendingConnection: {
112
- start: (connection) => set((state) => ({
113
- workflow: {
114
- ...state.workflow,
115
- pendingConnection: connection,
116
- sidebar: { ...state.workflow.sidebar, active: "store-browse" }
117
- }
118
- })),
119
- clear: () => set((state) => ({
120
- workflow: { ...state.workflow, pendingConnection: null }
121
- }))
122
- },
123
- sidebar: {
124
- // Leaving the store panel abandons any armed "+" attach mode — the
125
- // pending handle would otherwise silently capture a later insert.
126
- setActivePanel: (panel) => set((state) => ({
127
- workflow: {
128
- ...state.workflow,
129
- sidebar: { ...state.workflow.sidebar, active: panel },
130
- ...panel !== "store-browse" ? { pendingConnection: null } : {}
131
- }
132
- })),
133
- showNodePropertiesOf: (node) => {
134
- set((state) => ({
135
- workflow: {
136
- ...state.workflow,
137
- pendingConnection: null,
138
- sidebar: {
139
- ...state.workflow.sidebar,
140
- active: "node-properties",
141
- panels: {
142
- ...state.workflow.sidebar.panels,
143
- nodeProperties: {
144
- ...state.workflow.sidebar.panels.nodeProperties,
145
- selectedNode: node
146
- }
147
- }
148
- }
149
- }
150
- }));
151
- },
152
- panels: {
153
- nodeProperties: {
154
- setSelectedNode: (node) => set((state) => ({
155
- workflow: {
156
- ...state.workflow,
157
- sidebar: {
158
- ...state.workflow.sidebar,
159
- panels: {
160
- ...state.workflow.sidebar.panels,
161
- nodeProperties: {
162
- ...state.workflow.sidebar.panels.nodeProperties,
163
- selectedNode: node
164
- }
165
- }
166
- }
167
- }
168
- }))
169
- },
170
- tags: {
171
- setTags: (tags) => set({ tags }),
172
- createTag: (tag) => set((state) => ({
173
- tags: [...state.tags, tag]
174
- })),
175
- updateTag: (tag, newTag) => set((state) => ({
176
- tags: state.tags.map((f) => f.value === tag.value ? newTag : f)
177
- })),
178
- deleteTag: (tag) => set((state) => ({
179
- tags: state.tags.filter((f) => f.value !== tag.value)
180
- }))
181
- }
182
- }
183
- },
184
- nodes: {
185
- onNodesChange: (changes) => {
186
- set(
187
- (state) => produce(state, (draft) => {
188
- const updatedNodes = applyNodeChanges(
189
- changes,
190
- draft.workflow.nodes
191
- );
192
- draft.workflow.nodes = updatedNodes;
193
- })
194
- );
195
- },
196
- setNodes: (nodes) => {
197
- set({ workflow: { ...get().workflow, nodes } });
198
- },
199
- deleteNode: (node) => {
200
- set((state) => ({
201
- workflow: {
202
- ...state.workflow,
203
- nodes: state.workflow.nodes.filter((n) => n.id !== node.id),
204
- // Drop any UI state pointing at the removed node.
205
- ...state.workflow.quickConfig?.nodeId === node.id ? { quickConfig: null } : {},
206
- ...state.workflow.pendingConnection?.nodeId === node.id ? { pendingConnection: null } : {}
207
- }
208
- }));
209
- }
210
- },
211
- edges: {
212
- onEdgesChange: (changes) => {
213
- set(
214
- (state) => produce(state, (draft) => {
215
- const updatedEdges = applyEdgeChanges(
216
- changes,
217
- draft.workflow.edges
218
- );
219
- draft.workflow.edges = updatedEdges;
220
- })
221
- );
222
- },
223
- onConnect: (connection) => {
224
- const edge = { ...connection, id: nanoid(), type: "deletable" };
225
- set({
226
- workflow: {
227
- ...get().workflow,
228
- edges: addEdge(edge, get().workflow.edges)
229
- }
230
- });
231
- },
232
- setEdges: (edges) => {
233
- set({ workflow: { ...get().workflow, edges } });
234
- },
235
- deleteEdge: (edge) => {
236
- set((state) => ({
237
- workflow: {
238
- ...state.workflow,
239
- edges: state.workflow.edges.filter((e) => e.id !== edge.id)
240
- }
241
- }));
242
- }
243
- },
244
- execution: {
245
- startExecution: (nodeId, runId) => {
246
- set((state) => ({
247
- execution: {
248
- ...state.execution,
249
- isExecuting: true,
250
- executingNodeId: nodeId,
251
- currentRunId: runId,
252
- panelExpanded: true,
253
- nodeStatuses: {
254
- ...state.execution.nodeStatuses,
255
- [nodeId]: "running"
256
- }
257
- }
258
- }));
259
- },
260
- addLog: (log) => {
261
- set((state) => ({
262
- execution: {
263
- ...state.execution,
264
- logs: [...state.execution.logs, log],
265
- selectedLogId: log.id
266
- }
267
- }));
268
- },
269
- updateLog: (logId, updates) => {
270
- set((state) => ({
271
- execution: {
272
- ...state.execution,
273
- logs: state.execution.logs.map(
274
- (log) => log.id === logId ? { ...log, ...updates } : log
275
- )
276
- }
277
- }));
278
- },
279
- setNodeStatus: (nodeId, status) => {
280
- set((state) => ({
281
- execution: {
282
- ...state.execution,
283
- nodeStatuses: {
284
- ...state.execution.nodeStatuses,
285
- [nodeId]: status
286
- }
287
- }
288
- }));
289
- },
290
- setNodeItemCount: (nodeId, count) => {
291
- set((state) => ({
292
- execution: {
293
- ...state.execution,
294
- nodeItemCounts: {
295
- ...state.execution.nodeItemCounts,
296
- [nodeId]: count
297
- }
298
- }
299
- }));
300
- },
301
- selectLog: (logId) => {
302
- set((state) => ({
303
- execution: {
304
- ...state.execution,
305
- selectedLogId: logId
306
- }
307
- }));
308
- },
309
- togglePanel: () => {
310
- set((state) => ({
311
- execution: {
312
- ...state.execution,
313
- panelExpanded: !state.execution.panelExpanded
314
- }
315
- }));
316
- },
317
- clearLogs: () => {
318
- set((state) => ({
319
- execution: {
320
- ...state.execution,
321
- logs: [],
322
- selectedLogId: null,
323
- nodeStatuses: {},
324
- nodeItemCounts: {}
325
- }
326
- }));
327
- },
328
- completeExecution: () => {
329
- set((state) => ({
330
- execution: {
331
- ...state.execution,
332
- isExecuting: false,
333
- executingNodeId: null
334
- }
335
- }));
336
- }
337
- }
338
- }
339
- }));
340
- if (typeof window !== "undefined" && import.meta.env?.DEV) {
341
- window.__fgFlowStore = useFlowStore;
342
- }
343
- function QuotaExhaustedDialog({
344
- open,
345
- onOpenChange,
346
- onUpgrade,
347
- title,
348
- description
349
- }) {
350
- const tr = useTr();
351
- const resolvedTitle = title ?? tr(
352
- "fluidgrids.components.quotaExhaustedDialog.title",
353
- "Workflow Limit Reached"
354
- );
355
- const resolvedDescription = description ?? tr(
356
- "fluidgrids.components.quotaExhaustedDialog.description",
357
- "You've reached the workflow limit for your plan. Upgrade your plan to create more workflows."
358
- );
359
- return /* @__PURE__ */ jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
360
- /* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
361
- /* @__PURE__ */ jsx(AlertDialogTitle, { children: resolvedTitle }),
362
- /* @__PURE__ */ jsx(AlertDialogDescription, { children: resolvedDescription })
363
- ] }),
364
- /* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
365
- /* @__PURE__ */ jsx(AlertDialogCancel, { children: tr(
366
- "fluidgrids.components.quotaExhaustedDialog.dismiss",
367
- "Dismiss"
368
- ) }),
369
- /* @__PURE__ */ jsx(AlertDialogAction, { onClick: onUpgrade, children: tr(
370
- "fluidgrids.components.quotaExhaustedDialog.viewBilling",
371
- "View Billing"
372
- ) })
373
- ] })
374
- ] }) });
375
- }
376
-
377
- export { QuotaExhaustedDialog, useFlowStore };
378
- //# sourceMappingURL=chunk-KT72XMAB.js.map
379
- //# sourceMappingURL=chunk-KT72XMAB.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/builder/stores/flow-store.ts","../src/components/shared/QuotaExhaustedDialog.tsx"],"names":[],"mappings":";;;;;;;;AA2KA,IAAM,IAAA,GAAc;AAAA,EAClB,EAAE,KAAA,EAAO,WAAA,EAAa,KAAA,EAAO,WAAA,EAAa,OAAO,SAAA,EAAU;AAAA,EAC3D,EAAE,KAAA,EAAO,SAAA,EAAW,KAAA,EAAO,SAAA,EAAW,OAAO,SAAA,EAAU;AAAA,EACvD,EAAE,KAAA,EAAO,MAAA,EAAQ,KAAA,EAAO,MAAA,EAAQ,OAAO,SAAA,EAAU;AAAA,EACjD,EAAE,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,KAAA,EAAO,OAAO,SAAA;AACvC,CAAA;AAQA,IAAM,iBAAA,GAAoC;AAAA,EACxC,WAAA,EAAa,KAAA;AAAA,EACb,eAAA,EAAiB,IAAA;AAAA,EACjB,YAAA,EAAc,IAAA;AAAA,EACd,MAAM,EAAC;AAAA,EACP,aAAA,EAAe,IAAA;AAAA,EACf,aAAA,EAAe,KAAA;AAAA,EACf,cAAc,EAAC;AAAA,EACf,gBAAgB;AAClB,CAAA;AAEO,IAAM,YAAA,GAAe,MAAA,EAAmB,CAAE,CAAC,KAAK,GAAA,MAAS;AAAA,EAC9D,IAAA,EAAM,IAAA;AAAA,EACN,QAAA,EAAU;AAAA,IACR,IAAI,MAAA,EAAO;AAAA,IACX,WAAA,EAAa,EAAA;AAAA,IACb,IAAA,EAAM,EAAA;AAAA,IACN,OAAA,EAAS,EAAA;AAAA,IACT,KAAA,EAAO,EAAA;AAAA,IACP,OAAO,EAAC;AAAA,IACR,OAAO,EAAC;AAAA,IACR,GAAA,EAAK,IAAA;AAAA,IACL,WAAA,EAAa,IAAA;AAAA,IACb,iBAAA,EAAmB,IAAA;AAAA,IACnB,OAA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;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAAA,EAA8B;AAC5B,EAAA,MAAM,KAAK,KAAA,EAAM;AAGjB,EAAA,MAAM,gBACJ,KAAA,IACA,EAAA;AAAA,IACE,kDAAA;AAAA,IACA;AAAA,GACF;AACF,EAAA,MAAM,sBACJ,WAAA,IACA,EAAA;AAAA,IACE,wDAAA;AAAA,IACA;AAAA,GACF;AAEF,EAAA,uBACE,GAAA,CAAC,WAAA,EAAA,EAAY,IAAA,EAAY,YAAA,EACvB,+BAAC,kBAAA,EAAA,EACC,QAAA,EAAA;AAAA,oBAAA,IAAA,CAAC,iBAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,oBAAkB,QAAA,EAAA,aAAA,EAAc,CAAA;AAAA,sBACjC,GAAA,CAAC,0BAAwB,QAAA,EAAA,mBAAA,EAAoB;AAAA,KAAA,EAC/C,CAAA;AAAA,yBACC,iBAAA,EAAA,EACC,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,iBAAA,EAAA,EACE,QAAA,EAAA,EAAA;AAAA,QACC,oDAAA;AAAA,QACA;AAAA,OACF,EACF,CAAA;AAAA,sBACA,GAAA,CAAC,iBAAA,EAAA,EAAkB,OAAA,EAAS,SAAA,EACzB,QAAA,EAAA,EAAA;AAAA,QACC,wDAAA;AAAA,QACA;AAAA,OACF,EACF;AAAA,KAAA,EACF;AAAA,GAAA,EACF,CAAA,EACF,CAAA;AAEJ","file":"chunk-KT72XMAB.js","sourcesContent":["import { nanoid } from \"nanoid/non-secure\";\nimport {\n addEdge,\n applyEdgeChanges,\n applyNodeChanges,\n type Connection,\n type Edge,\n type EdgeChange,\n type Node,\n type NodeChange,\n} from \"@xyflow/react\";\nimport { create } from \"zustand\";\nimport { produce } from \"immer\";\nimport type {\n ExtendedNodeType,\n EdgeCondition,\n EdgeMapping,\n} from \"../../types/node\";\nimport type { Tag } from \"../../types/workflow\";\nimport type { ExecutionLog } from \"../../types/execution\";\n\n// Node execution state for visual display\nexport interface NodeExecutionState {\n status: \"idle\" | \"running\" | \"success\" | \"error\";\n itemCount?: number;\n error?: string;\n}\n\n// Execution state for step execution feature\ninterface ExecutionState {\n isExecuting: boolean;\n executingNodeId: string | null;\n currentRunId: string | null;\n logs: ExecutionLog[];\n selectedLogId: string | null;\n panelExpanded: boolean;\n nodeStatuses: Record<string, \"idle\" | \"running\" | \"success\" | \"error\">;\n nodeItemCounts: Record<string, number>;\n}\n\ninterface CustomEdgeProps extends Edge {\n condition?: EdgeCondition;\n mapping?: EdgeMapping;\n}\n\ninterface State {\n nodes: Node[];\n edges: CustomEdgeProps[];\n /** Node currently open in the n8n-style 3-pane Node Detail View modal. */\n ndv?: { nodeId: string; type: ExtendedNodeType } | null;\n /**\n * Node currently open in the single-click floating quick-config panel\n * (Make-style, attached beside the node). The panel derives its own screen\n * position from the node's live rect, so no anchor is stored here.\n */\n quickConfig?: {\n nodeId: string;\n type: ExtendedNodeType;\n } | null;\n /**\n * Source handle awaiting attachment via the Node Store (the n8n-style \"+\"\n * button on an output handle). While set, clicking an operation in the\n * store panel creates the node and wires it to this handle.\n */\n pendingConnection?: { nodeId: string; handleId: string } | null;\n sidebar: {\n active: \"node-properties\" | \"store-browse\" | \"none\";\n panels: {\n nodeProperties: {\n selectedNode: { id: string; type: ExtendedNodeType } | null | undefined;\n };\n };\n };\n}\n\ninterface Actions {\n actions: {\n saveWorkflow: () => {\n id: string;\n name: string;\n version: string;\n alias?: string;\n dbId?: string;\n status?: string;\n nodes: Node[];\n edges: Edge[];\n };\n setWorkflow: (workflow: Partial<IFlowState[\"workflow\"]>) => void;\n resetWorkflow: () => void;\n nodes: {\n onNodesChange: (changes: NodeChange[]) => void;\n setNodes: (nodes: Node[]) => void;\n deleteNode: (node: Node) => void;\n };\n edges: {\n onEdgesChange: (changes: EdgeChange[]) => void;\n onConnect: (connection: Connection) => void;\n setEdges: (edges: Edge[]) => void;\n deleteEdge: (edge: Edge) => void;\n };\n ndv: {\n open: (node: { nodeId: string; type: ExtendedNodeType }) => void;\n close: () => void;\n };\n quickConfig: {\n open: (node: { nodeId: string; type: ExtendedNodeType }) => void;\n close: () => void;\n };\n pendingConnection: {\n /** Arm attach mode for a source handle and open the Node Store panel. */\n start: (connection: { nodeId: string; handleId: string }) => void;\n clear: () => void;\n };\n sidebar: {\n setActivePanel: (\n panel: \"node-properties\" | \"store-browse\" | \"none\",\n ) => void;\n showNodePropertiesOf: (node: {\n id: string;\n type: ExtendedNodeType;\n block?: string;\n }) => void;\n panels: {\n nodeProperties: {\n setSelectedNode: (\n node: { id: string; type: ExtendedNodeType } | undefined | null,\n ) => void;\n };\n tags: {\n setTags: (tags: Tag[]) => void;\n createTag: (tag: Tag) => void;\n deleteTag: (tag: Tag) => void;\n updateTag: (tag: Tag, newTag: Tag) => void;\n };\n };\n };\n };\n}\n\nexport interface IFlowState {\n tags: Tag[];\n workflow: {\n id: string;\n workflowKey: string;\n name: string;\n version: string;\n alias?: string;\n /** Database row ID (used for updateWorkflowDefinition) */\n dbId?: string;\n /** Current workflow status: DRAFT | ACTIVE | ARCHIVED | DEPRECATED */\n status?: string;\n } & State;\n execution: ExecutionState;\n actions: Actions[\"actions\"] & {\n execution: {\n startExecution: (nodeId: string, runId: string) => void;\n addLog: (log: ExecutionLog) => void;\n updateLog: (logId: string, updates: Partial<ExecutionLog>) => void;\n setNodeStatus: (\n nodeId: string,\n status: \"idle\" | \"running\" | \"success\" | \"error\",\n ) => void;\n setNodeItemCount: (nodeId: string, count: number) => void;\n selectLog: (logId: string | null) => void;\n togglePanel: () => void;\n clearLogs: () => void;\n completeExecution: () => void;\n };\n };\n}\n\nconst TAGS: Tag[] = [\n { value: \"marketing\", label: \"Marketing\", color: \"#ef4444\" },\n { value: \"support\", label: \"Support\", color: \"#ef4444\" },\n { value: \"lead\", label: \"Lead\", color: \"#eab308\" },\n { value: \"new\", label: \"New\", color: \"#22c55e\" },\n];\n\n/**\n * Pristine execution state. The `execution` slice is global (one run at a\n * time), so it MUST be reset whenever a different workflow is loaded —\n * otherwise the previous workflow's run logs leak into the next workflow's\n * Logs panel. Shared by the store initializer and `resetWorkflow`.\n */\nconst INITIAL_EXECUTION: ExecutionState = {\n isExecuting: false,\n executingNodeId: null,\n currentRunId: null,\n logs: [],\n selectedLogId: null,\n panelExpanded: false,\n nodeStatuses: {},\n nodeItemCounts: {},\n};\n\nexport const useFlowStore = create<IFlowState>()((set, get) => ({\n tags: TAGS,\n workflow: {\n id: nanoid(),\n workflowKey: \"\",\n name: \"\",\n version: \"\",\n alias: \"\",\n edges: [],\n nodes: [],\n ndv: null,\n quickConfig: null,\n pendingConnection: null,\n sidebar: {\n active: \"none\",\n panels: {\n nodeProperties: {\n selectedNode: null,\n },\n },\n },\n },\n execution: { ...INITIAL_EXECUTION },\n actions: {\n saveWorkflow: () => {\n const { workflow } = get();\n const { id, name, version, alias, dbId, status, nodes, edges } = workflow;\n set({ workflow });\n return { id, name, version, alias, dbId, status, nodes, edges };\n },\n setWorkflow: (workflow: Partial<IFlowState[\"workflow\"]>) => {\n set((state) => ({\n workflow: {\n ...state.workflow,\n ...workflow,\n },\n }));\n },\n resetWorkflow: () => {\n set(() => ({\n workflow: {\n id: nanoid(),\n workflowKey: \"\",\n name: \"\",\n version: \"\",\n alias: \"\",\n dbId: undefined,\n status: undefined,\n edges: [],\n nodes: [],\n ndv: null,\n quickConfig: null,\n pendingConnection: null,\n sidebar: {\n active: \"none\",\n panels: {\n nodeProperties: {\n selectedNode: null,\n },\n },\n },\n },\n // Wipe run state too — resetWorkflow fires when the builder loads a\n // (different) workflow, so the previous workflow's logs must not carry\n // over into this one's Logs panel.\n execution: { ...INITIAL_EXECUTION },\n }));\n },\n ndv: {\n // Opening the full NDV supersedes the floating quick-config panel — the\n // two edit the same node data, so only one should be visible at a time.\n open: (node: { nodeId: string; type: ExtendedNodeType }) =>\n set((state) => ({\n workflow: { ...state.workflow, ndv: node, quickConfig: null },\n })),\n close: () =>\n set((state) => ({\n workflow: { ...state.workflow, ndv: null },\n })),\n },\n quickConfig: {\n open: (node: { nodeId: string; type: ExtendedNodeType }) =>\n set((state) => ({\n workflow: { ...state.workflow, quickConfig: node },\n })),\n close: () =>\n set((state) => ({\n workflow: { ...state.workflow, quickConfig: null },\n })),\n },\n pendingConnection: {\n start: (connection: { nodeId: string; handleId: string }) =>\n set((state) => ({\n workflow: {\n ...state.workflow,\n pendingConnection: connection,\n sidebar: { ...state.workflow.sidebar, active: \"store-browse\" },\n },\n })),\n clear: () =>\n set((state) => ({\n workflow: { ...state.workflow, pendingConnection: null },\n })),\n },\n sidebar: {\n // Leaving the store panel abandons any armed \"+\" attach mode — the\n // pending handle would otherwise silently capture a later insert.\n setActivePanel: (panel: \"node-properties\" | \"store-browse\" | \"none\") =>\n set((state) => ({\n workflow: {\n ...state.workflow,\n sidebar: { ...state.workflow.sidebar, active: panel },\n ...(panel !== \"store-browse\" ? { pendingConnection: null } : {}),\n },\n })),\n showNodePropertiesOf: (node: { id: string; type: ExtendedNodeType }) => {\n set((state) => ({\n workflow: {\n ...state.workflow,\n pendingConnection: null,\n sidebar: {\n ...state.workflow.sidebar,\n active: \"node-properties\",\n panels: {\n ...state.workflow.sidebar.panels,\n nodeProperties: {\n ...state.workflow.sidebar.panels.nodeProperties,\n selectedNode: node,\n },\n },\n },\n },\n }));\n },\n panels: {\n nodeProperties: {\n setSelectedNode: (\n node: { id: string; type: ExtendedNodeType } | undefined | null,\n ) =>\n set((state) => ({\n workflow: {\n ...state.workflow,\n sidebar: {\n ...state.workflow.sidebar,\n panels: {\n ...state.workflow.sidebar.panels,\n nodeProperties: {\n ...state.workflow.sidebar.panels.nodeProperties,\n selectedNode: node,\n },\n },\n },\n },\n })),\n },\n tags: {\n setTags: (tags: Tag[]) => set({ tags }),\n createTag: (tag: Tag) =>\n set((state) => ({\n tags: [...state.tags, tag],\n })),\n updateTag: (tag: Tag, newTag: Tag) =>\n set((state) => ({\n tags: state.tags.map((f) => (f.value === tag.value ? newTag : f)),\n })),\n deleteTag: (tag: Tag) =>\n set((state) => ({\n tags: state.tags.filter((f) => f.value !== tag.value),\n })),\n },\n },\n },\n nodes: {\n onNodesChange: (changes) => {\n set((state) =>\n produce(state, (draft) => {\n const updatedNodes = applyNodeChanges(\n changes,\n draft.workflow.nodes,\n );\n draft.workflow.nodes = updatedNodes;\n }),\n );\n },\n setNodes: (nodes) => {\n set({ workflow: { ...get().workflow, nodes } });\n },\n deleteNode: (node: Node) => {\n set((state) => ({\n workflow: {\n ...state.workflow,\n nodes: state.workflow.nodes.filter((n) => n.id !== node.id),\n // Drop any UI state pointing at the removed node.\n ...(state.workflow.quickConfig?.nodeId === node.id\n ? { quickConfig: null }\n : {}),\n ...(state.workflow.pendingConnection?.nodeId === node.id\n ? { pendingConnection: null }\n : {}),\n },\n }));\n },\n },\n edges: {\n onEdgesChange: (changes) => {\n set((state) =>\n produce(state, (draft) => {\n const updatedEdges = applyEdgeChanges(\n changes,\n draft.workflow.edges,\n );\n draft.workflow.edges = updatedEdges;\n }),\n );\n },\n onConnect: (connection) => {\n const edge = { ...connection, id: nanoid(), type: \"deletable\" } as Edge;\n set({\n workflow: {\n ...get().workflow,\n edges: addEdge(edge, get().workflow.edges),\n },\n });\n },\n setEdges: (edges) => {\n set({ workflow: { ...get().workflow, edges } });\n },\n deleteEdge: (edge: Edge) => {\n set((state) => ({\n workflow: {\n ...state.workflow,\n edges: state.workflow.edges.filter((e) => e.id !== edge.id),\n },\n }));\n },\n },\n execution: {\n startExecution: (nodeId: string, runId: string) => {\n set((state) => ({\n execution: {\n ...state.execution,\n isExecuting: true,\n executingNodeId: nodeId,\n currentRunId: runId,\n panelExpanded: true,\n nodeStatuses: {\n ...state.execution.nodeStatuses,\n [nodeId]: \"running\",\n },\n },\n }));\n },\n addLog: (log: ExecutionLog) => {\n set((state) => ({\n execution: {\n ...state.execution,\n logs: [...state.execution.logs, log],\n selectedLogId: log.id,\n },\n }));\n },\n updateLog: (logId: string, updates: Partial<ExecutionLog>) => {\n set((state) => ({\n execution: {\n ...state.execution,\n logs: state.execution.logs.map((log) =>\n log.id === logId ? { ...log, ...updates } : log,\n ),\n },\n }));\n },\n setNodeStatus: (\n nodeId: string,\n status: \"idle\" | \"running\" | \"success\" | \"error\",\n ) => {\n set((state) => ({\n execution: {\n ...state.execution,\n nodeStatuses: {\n ...state.execution.nodeStatuses,\n [nodeId]: status,\n },\n },\n }));\n },\n setNodeItemCount: (nodeId: string, count: number) => {\n set((state) => ({\n execution: {\n ...state.execution,\n nodeItemCounts: {\n ...state.execution.nodeItemCounts,\n [nodeId]: count,\n },\n },\n }));\n },\n selectLog: (logId: string | null) => {\n set((state) => ({\n execution: {\n ...state.execution,\n selectedLogId: logId,\n },\n }));\n },\n togglePanel: () => {\n set((state) => ({\n execution: {\n ...state.execution,\n panelExpanded: !state.execution.panelExpanded,\n },\n }));\n },\n clearLogs: () => {\n set((state) => ({\n execution: {\n ...state.execution,\n logs: [],\n selectedLogId: null,\n nodeStatuses: {},\n nodeItemCounts: {},\n },\n }));\n },\n completeExecution: () => {\n set((state) => ({\n execution: {\n ...state.execution,\n isExecuting: false,\n executingNodeId: null,\n },\n }));\n },\n },\n },\n}));\n\n// Dev-only debug handle so the store can be inspected/driven from the browser\n// console or automated tests. No-op in production builds.\nif (typeof window !== \"undefined\" && import.meta.env?.DEV) {\n (window as unknown as Record<string, unknown>).__fgFlowStore = useFlowStore;\n}\n","import {\n AlertDialog,\n AlertDialogAction,\n AlertDialogCancel,\n AlertDialogContent,\n AlertDialogDescription,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogTitle,\n} from \"@burdenoff/fe-libs/ui\";\nimport { useTr } from \"../../hooks/useTr\";\n\ninterface QuotaExhaustedDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Called when the user clicks \"View Billing\". */\n onUpgrade: () => void;\n title?: string;\n description?: string;\n}\n\n/**\n * Alert shown when a workflow-creating action (save/duplicate/import) is\n * rejected with `QUOTA_EXHAUSTED` for `fluidgrids.workflows.count`. Mirrors\n * the \"Folder Limit Reached\" dialog in microfe-files' BrowserPage.tsx, built\n * on the same `AlertDialog` primitives already used elsewhere in this SDK\n * (see card-workflow.tsx's delete-confirmation dialog).\n */\nexport function QuotaExhaustedDialog({\n open,\n onOpenChange,\n onUpgrade,\n title,\n description,\n}: QuotaExhaustedDialogProps) {\n const tr = useTr();\n // Defaults are resolved here rather than as default parameter values so the\n // copy can go through `tr()` — a hook cannot be called in a parameter list.\n const resolvedTitle =\n title ??\n tr(\n \"fluidgrids.components.quotaExhaustedDialog.title\",\n \"Workflow Limit Reached\",\n );\n const resolvedDescription =\n description ??\n tr(\n \"fluidgrids.components.quotaExhaustedDialog.description\",\n \"You've reached the workflow limit for your plan. Upgrade your plan to create more workflows.\",\n );\n\n return (\n <AlertDialog open={open} onOpenChange={onOpenChange}>\n <AlertDialogContent>\n <AlertDialogHeader>\n <AlertDialogTitle>{resolvedTitle}</AlertDialogTitle>\n <AlertDialogDescription>{resolvedDescription}</AlertDialogDescription>\n </AlertDialogHeader>\n <AlertDialogFooter>\n <AlertDialogCancel>\n {tr(\n \"fluidgrids.components.quotaExhaustedDialog.dismiss\",\n \"Dismiss\",\n )}\n </AlertDialogCancel>\n <AlertDialogAction onClick={onUpgrade}>\n {tr(\n \"fluidgrids.components.quotaExhaustedDialog.viewBilling\",\n \"View Billing\",\n )}\n </AlertDialogAction>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialog>\n );\n}\n"]}