@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.
- package/dist/{WorkflowBuilder-GFFW5WSB.js → WorkflowBuilder-XZPLGBCS.js} +5 -5
- package/dist/{WorkflowBuilder-GFFW5WSB.js.map → WorkflowBuilder-XZPLGBCS.js.map} +1 -1
- package/dist/{WorkflowsList-ZBMSG2WP.js → WorkflowsList-J6IDS3SR.js} +4 -4
- package/dist/{WorkflowsList-ZBMSG2WP.js.map → WorkflowsList-J6IDS3SR.js.map} +1 -1
- package/dist/{chunk-HY7K7SLI.js → chunk-3RWKQIV4.js} +957 -53
- package/dist/chunk-3RWKQIV4.js.map +1 -0
- package/dist/chunk-I3WUYESA.js +668 -0
- package/dist/chunk-I3WUYESA.js.map +1 -0
- package/dist/{chunk-YAADZDGX.js → chunk-K4U4WX4R.js} +3 -3
- package/dist/{chunk-YAADZDGX.js.map → chunk-K4U4WX4R.js.map} +1 -1
- package/dist/{chunk-77Y5WTBD.js → chunk-SU6UYGRW.js} +4 -4
- package/dist/{chunk-77Y5WTBD.js.map → chunk-SU6UYGRW.js.map} +1 -1
- package/dist/{chunk-TOFLHYUQ.js → chunk-TKUCCNEO.js} +4 -4
- package/dist/{chunk-TOFLHYUQ.js.map → chunk-TKUCCNEO.js.map} +1 -1
- package/dist/{chunk-YH2QC6D6.js → chunk-Y4AM4RTD.js} +4 -4
- package/dist/{chunk-YH2QC6D6.js.map → chunk-Y4AM4RTD.js.map} +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -10
- package/dist/templates.js +3 -3
- package/dist/{workflow-builder-JKkdIJoP.d.ts → workflow-builder-BNWKK8C7.d.ts} +53 -2
- package/dist/workflow-builder.d.ts +1 -1
- package/dist/workflow-builder.js +4 -4
- package/dist/workflows-list.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-HY7K7SLI.js.map +0 -1
- package/dist/chunk-KT72XMAB.js +0 -379
- package/dist/chunk-KT72XMAB.js.map +0 -1
|
@@ -0,0 +1,668 @@
|
|
|
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 HISTORY_LIMIT = 100;
|
|
10
|
+
var CLONE_OFFSET = 48;
|
|
11
|
+
function cloneValue(value) {
|
|
12
|
+
try {
|
|
13
|
+
return structuredClone(value);
|
|
14
|
+
} catch {
|
|
15
|
+
return JSON.parse(JSON.stringify(value));
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
var TAGS = [
|
|
19
|
+
{ value: "marketing", label: "Marketing", color: "#ef4444" },
|
|
20
|
+
{ value: "support", label: "Support", color: "#ef4444" },
|
|
21
|
+
{ value: "lead", label: "Lead", color: "#eab308" },
|
|
22
|
+
{ value: "new", label: "New", color: "#22c55e" }
|
|
23
|
+
];
|
|
24
|
+
var INITIAL_EXECUTION = {
|
|
25
|
+
isExecuting: false,
|
|
26
|
+
executingNodeId: null,
|
|
27
|
+
currentRunId: null,
|
|
28
|
+
logs: [],
|
|
29
|
+
selectedLogId: null,
|
|
30
|
+
panelExpanded: false,
|
|
31
|
+
nodeStatuses: {},
|
|
32
|
+
nodeItemCounts: {}
|
|
33
|
+
};
|
|
34
|
+
var INITIAL_HISTORY = { past: [], future: [] };
|
|
35
|
+
var useFlowStore = create()((set, get) => {
|
|
36
|
+
let lastCheckpointKind = null;
|
|
37
|
+
let lastCheckpointAt = 0;
|
|
38
|
+
function pushCheckpoint(kind, coalesce) {
|
|
39
|
+
const now = Date.now();
|
|
40
|
+
const isCoalesced = coalesce && kind === lastCheckpointKind && now - lastCheckpointAt < 800;
|
|
41
|
+
if (!isCoalesced) {
|
|
42
|
+
const state = get();
|
|
43
|
+
const snapshot = {
|
|
44
|
+
nodes: cloneValue(state.workflow.nodes),
|
|
45
|
+
edges: cloneValue(state.workflow.edges)
|
|
46
|
+
};
|
|
47
|
+
set((s) => ({
|
|
48
|
+
history: {
|
|
49
|
+
past: [...s.history.past, snapshot].slice(-HISTORY_LIMIT),
|
|
50
|
+
future: []
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
} else if (get().history.future.length > 0) {
|
|
54
|
+
set((s) => ({ history: { ...s.history, future: [] } }));
|
|
55
|
+
}
|
|
56
|
+
lastCheckpointKind = kind;
|
|
57
|
+
lastCheckpointAt = now;
|
|
58
|
+
}
|
|
59
|
+
function resetCoalescing() {
|
|
60
|
+
lastCheckpointKind = null;
|
|
61
|
+
lastCheckpointAt = 0;
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
tags: TAGS,
|
|
65
|
+
history: { ...INITIAL_HISTORY },
|
|
66
|
+
workflow: {
|
|
67
|
+
id: nanoid(),
|
|
68
|
+
workflowKey: "",
|
|
69
|
+
name: "",
|
|
70
|
+
version: "",
|
|
71
|
+
alias: "",
|
|
72
|
+
edges: [],
|
|
73
|
+
nodes: [],
|
|
74
|
+
ndv: null,
|
|
75
|
+
quickConfig: null,
|
|
76
|
+
pendingConnection: null,
|
|
77
|
+
renamingNodeId: null,
|
|
78
|
+
sidebar: {
|
|
79
|
+
active: "none",
|
|
80
|
+
panels: {
|
|
81
|
+
nodeProperties: {
|
|
82
|
+
selectedNode: null
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
},
|
|
87
|
+
execution: { ...INITIAL_EXECUTION },
|
|
88
|
+
actions: {
|
|
89
|
+
saveWorkflow: () => {
|
|
90
|
+
const { workflow } = get();
|
|
91
|
+
const { id, name, version, alias, dbId, status, nodes, edges } = workflow;
|
|
92
|
+
set({ workflow });
|
|
93
|
+
return { id, name, version, alias, dbId, status, nodes, edges };
|
|
94
|
+
},
|
|
95
|
+
setWorkflow: (workflow) => {
|
|
96
|
+
set((state) => ({
|
|
97
|
+
workflow: {
|
|
98
|
+
...state.workflow,
|
|
99
|
+
...workflow
|
|
100
|
+
}
|
|
101
|
+
}));
|
|
102
|
+
},
|
|
103
|
+
resetWorkflow: () => {
|
|
104
|
+
resetCoalescing();
|
|
105
|
+
set(() => ({
|
|
106
|
+
workflow: {
|
|
107
|
+
id: nanoid(),
|
|
108
|
+
workflowKey: "",
|
|
109
|
+
name: "",
|
|
110
|
+
version: "",
|
|
111
|
+
alias: "",
|
|
112
|
+
dbId: void 0,
|
|
113
|
+
status: void 0,
|
|
114
|
+
edges: [],
|
|
115
|
+
nodes: [],
|
|
116
|
+
ndv: null,
|
|
117
|
+
quickConfig: null,
|
|
118
|
+
pendingConnection: null,
|
|
119
|
+
renamingNodeId: null,
|
|
120
|
+
sidebar: {
|
|
121
|
+
active: "none",
|
|
122
|
+
panels: {
|
|
123
|
+
nodeProperties: {
|
|
124
|
+
selectedNode: null
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
},
|
|
129
|
+
// Wipe run state too — resetWorkflow fires when the builder loads a
|
|
130
|
+
// (different) workflow, so the previous workflow's logs must not carry
|
|
131
|
+
// over into this one's Logs panel.
|
|
132
|
+
execution: { ...INITIAL_EXECUTION },
|
|
133
|
+
// A freshly loaded workflow must not be undo-able back to empty —
|
|
134
|
+
// undo/redo only ever applies within the currently open workflow.
|
|
135
|
+
history: { ...INITIAL_HISTORY }
|
|
136
|
+
}));
|
|
137
|
+
},
|
|
138
|
+
history: {
|
|
139
|
+
undo: () => {
|
|
140
|
+
const { past, future } = get().history;
|
|
141
|
+
const previous = past[past.length - 1];
|
|
142
|
+
if (!previous) return;
|
|
143
|
+
const { nodes, edges } = get().workflow;
|
|
144
|
+
const current = {
|
|
145
|
+
nodes: cloneValue(nodes),
|
|
146
|
+
edges: cloneValue(edges)
|
|
147
|
+
};
|
|
148
|
+
resetCoalescing();
|
|
149
|
+
set((s) => ({
|
|
150
|
+
workflow: {
|
|
151
|
+
...s.workflow,
|
|
152
|
+
nodes: previous.nodes,
|
|
153
|
+
edges: previous.edges
|
|
154
|
+
},
|
|
155
|
+
history: {
|
|
156
|
+
past: past.slice(0, -1),
|
|
157
|
+
future: [current, ...future].slice(0, HISTORY_LIMIT)
|
|
158
|
+
}
|
|
159
|
+
}));
|
|
160
|
+
},
|
|
161
|
+
redo: () => {
|
|
162
|
+
const { past, future } = get().history;
|
|
163
|
+
const next = future[0];
|
|
164
|
+
if (!next) return;
|
|
165
|
+
const { nodes, edges } = get().workflow;
|
|
166
|
+
const current = {
|
|
167
|
+
nodes: cloneValue(nodes),
|
|
168
|
+
edges: cloneValue(edges)
|
|
169
|
+
};
|
|
170
|
+
resetCoalescing();
|
|
171
|
+
set((s) => ({
|
|
172
|
+
workflow: {
|
|
173
|
+
...s.workflow,
|
|
174
|
+
nodes: next.nodes,
|
|
175
|
+
edges: next.edges
|
|
176
|
+
},
|
|
177
|
+
history: {
|
|
178
|
+
past: [...past, current].slice(-HISTORY_LIMIT),
|
|
179
|
+
future: future.slice(1)
|
|
180
|
+
}
|
|
181
|
+
}));
|
|
182
|
+
},
|
|
183
|
+
clear: () => {
|
|
184
|
+
resetCoalescing();
|
|
185
|
+
set({ history: { ...INITIAL_HISTORY } });
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
ndv: {
|
|
189
|
+
// Opening the full NDV supersedes the floating quick-config panel — the
|
|
190
|
+
// two edit the same node data, so only one should be visible at a time.
|
|
191
|
+
open: (node) => set((state) => ({
|
|
192
|
+
workflow: { ...state.workflow, ndv: node, quickConfig: null }
|
|
193
|
+
})),
|
|
194
|
+
close: () => set((state) => ({
|
|
195
|
+
workflow: { ...state.workflow, ndv: null }
|
|
196
|
+
}))
|
|
197
|
+
},
|
|
198
|
+
quickConfig: {
|
|
199
|
+
open: (node) => set((state) => ({
|
|
200
|
+
workflow: { ...state.workflow, quickConfig: node }
|
|
201
|
+
})),
|
|
202
|
+
close: () => set((state) => ({
|
|
203
|
+
workflow: { ...state.workflow, quickConfig: null }
|
|
204
|
+
}))
|
|
205
|
+
},
|
|
206
|
+
pendingConnection: {
|
|
207
|
+
start: (connection) => set((state) => ({
|
|
208
|
+
workflow: {
|
|
209
|
+
...state.workflow,
|
|
210
|
+
pendingConnection: connection,
|
|
211
|
+
sidebar: { ...state.workflow.sidebar, active: "store-browse" }
|
|
212
|
+
}
|
|
213
|
+
})),
|
|
214
|
+
clear: () => set((state) => ({
|
|
215
|
+
workflow: { ...state.workflow, pendingConnection: null }
|
|
216
|
+
}))
|
|
217
|
+
},
|
|
218
|
+
sidebar: {
|
|
219
|
+
// Leaving the store panel abandons any armed "+" attach mode — the
|
|
220
|
+
// pending handle would otherwise silently capture a later insert.
|
|
221
|
+
setActivePanel: (panel) => set((state) => ({
|
|
222
|
+
workflow: {
|
|
223
|
+
...state.workflow,
|
|
224
|
+
sidebar: { ...state.workflow.sidebar, active: panel },
|
|
225
|
+
...panel !== "store-browse" ? { pendingConnection: null } : {}
|
|
226
|
+
}
|
|
227
|
+
})),
|
|
228
|
+
showNodePropertiesOf: (node) => {
|
|
229
|
+
set((state) => ({
|
|
230
|
+
workflow: {
|
|
231
|
+
...state.workflow,
|
|
232
|
+
pendingConnection: null,
|
|
233
|
+
sidebar: {
|
|
234
|
+
...state.workflow.sidebar,
|
|
235
|
+
active: "node-properties",
|
|
236
|
+
panels: {
|
|
237
|
+
...state.workflow.sidebar.panels,
|
|
238
|
+
nodeProperties: {
|
|
239
|
+
...state.workflow.sidebar.panels.nodeProperties,
|
|
240
|
+
selectedNode: node
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}));
|
|
246
|
+
},
|
|
247
|
+
panels: {
|
|
248
|
+
nodeProperties: {
|
|
249
|
+
setSelectedNode: (node) => set((state) => ({
|
|
250
|
+
workflow: {
|
|
251
|
+
...state.workflow,
|
|
252
|
+
sidebar: {
|
|
253
|
+
...state.workflow.sidebar,
|
|
254
|
+
panels: {
|
|
255
|
+
...state.workflow.sidebar.panels,
|
|
256
|
+
nodeProperties: {
|
|
257
|
+
...state.workflow.sidebar.panels.nodeProperties,
|
|
258
|
+
selectedNode: node
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}))
|
|
264
|
+
},
|
|
265
|
+
tags: {
|
|
266
|
+
setTags: (tags) => set({ tags }),
|
|
267
|
+
createTag: (tag) => set((state) => ({
|
|
268
|
+
tags: [...state.tags, tag]
|
|
269
|
+
})),
|
|
270
|
+
updateTag: (tag, newTag) => set((state) => ({
|
|
271
|
+
tags: state.tags.map(
|
|
272
|
+
(f) => f.value === tag.value ? newTag : f
|
|
273
|
+
)
|
|
274
|
+
})),
|
|
275
|
+
deleteTag: (tag) => set((state) => ({
|
|
276
|
+
tags: state.tags.filter((f) => f.value !== tag.value)
|
|
277
|
+
}))
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
nodes: {
|
|
282
|
+
onNodesChange: (changes) => {
|
|
283
|
+
const removedIds = new Set(
|
|
284
|
+
changes.filter(
|
|
285
|
+
(c) => c.type === "remove"
|
|
286
|
+
).map((c) => c.id)
|
|
287
|
+
);
|
|
288
|
+
if (removedIds.size > 0) {
|
|
289
|
+
const stillPresent = get().workflow.nodes.some(
|
|
290
|
+
(n) => removedIds.has(n.id)
|
|
291
|
+
);
|
|
292
|
+
if (stillPresent) pushCheckpoint("nodes:remove", false);
|
|
293
|
+
} else {
|
|
294
|
+
const finishedDragIds = changes.filter(
|
|
295
|
+
(c) => c.type === "position" && c.dragging === false
|
|
296
|
+
);
|
|
297
|
+
const actuallyMoved = finishedDragIds.some((c) => {
|
|
298
|
+
const current = get().workflow.nodes.find((n) => n.id === c.id);
|
|
299
|
+
return current && c.position && (current.position.x !== c.position.x || current.position.y !== c.position.y);
|
|
300
|
+
});
|
|
301
|
+
if (actuallyMoved) pushCheckpoint("nodes:move", false);
|
|
302
|
+
}
|
|
303
|
+
set(
|
|
304
|
+
(state) => produce(state, (draft) => {
|
|
305
|
+
const updatedNodes = applyNodeChanges(
|
|
306
|
+
changes,
|
|
307
|
+
draft.workflow.nodes
|
|
308
|
+
);
|
|
309
|
+
draft.workflow.nodes = updatedNodes;
|
|
310
|
+
})
|
|
311
|
+
);
|
|
312
|
+
},
|
|
313
|
+
setNodes: (nodes, opts) => {
|
|
314
|
+
if (!opts?.skipHistory) {
|
|
315
|
+
pushCheckpoint(
|
|
316
|
+
opts?.historyKind ?? "nodes:set",
|
|
317
|
+
!!opts?.historyKind
|
|
318
|
+
);
|
|
319
|
+
}
|
|
320
|
+
set({ workflow: { ...get().workflow, nodes } });
|
|
321
|
+
},
|
|
322
|
+
deleteNode: (node) => {
|
|
323
|
+
const exists = get().workflow.nodes.some((n) => n.id === node.id);
|
|
324
|
+
if (exists) pushCheckpoint("nodes:delete", false);
|
|
325
|
+
set((state) => ({
|
|
326
|
+
workflow: {
|
|
327
|
+
...state.workflow,
|
|
328
|
+
nodes: state.workflow.nodes.filter((n) => n.id !== node.id),
|
|
329
|
+
// Drop any UI state pointing at the removed node.
|
|
330
|
+
...state.workflow.quickConfig?.nodeId === node.id ? { quickConfig: null } : {},
|
|
331
|
+
...state.workflow.pendingConnection?.nodeId === node.id ? { pendingConnection: null } : {}
|
|
332
|
+
}
|
|
333
|
+
}));
|
|
334
|
+
},
|
|
335
|
+
deleteNodes: (nodes) => {
|
|
336
|
+
const ids = new Set(nodes.map((n) => n.id));
|
|
337
|
+
if (ids.size === 0) return;
|
|
338
|
+
const anyExist = get().workflow.nodes.some((n) => ids.has(n.id));
|
|
339
|
+
if (anyExist) pushCheckpoint("nodes:delete", false);
|
|
340
|
+
set((state) => ({
|
|
341
|
+
workflow: {
|
|
342
|
+
...state.workflow,
|
|
343
|
+
nodes: state.workflow.nodes.filter((n) => !ids.has(n.id)),
|
|
344
|
+
edges: state.workflow.edges.filter(
|
|
345
|
+
(e) => !ids.has(e.source) && !ids.has(e.target)
|
|
346
|
+
),
|
|
347
|
+
...state.workflow.quickConfig && ids.has(state.workflow.quickConfig.nodeId) ? { quickConfig: null } : {},
|
|
348
|
+
...state.workflow.pendingConnection && ids.has(state.workflow.pendingConnection.nodeId) ? { pendingConnection: null } : {}
|
|
349
|
+
}
|
|
350
|
+
}));
|
|
351
|
+
},
|
|
352
|
+
duplicateNodes: (nodeIds) => {
|
|
353
|
+
const { nodes, edges } = get().workflow;
|
|
354
|
+
const idSet = new Set(nodeIds);
|
|
355
|
+
const selected = nodes.filter((n) => idSet.has(n.id));
|
|
356
|
+
if (selected.length === 0) return;
|
|
357
|
+
pushCheckpoint("nodes:duplicate", false);
|
|
358
|
+
const idMap = /* @__PURE__ */ new Map();
|
|
359
|
+
const clones = selected.map((n) => {
|
|
360
|
+
const newId = nanoid();
|
|
361
|
+
idMap.set(n.id, newId);
|
|
362
|
+
const cloned = cloneValue(n);
|
|
363
|
+
return {
|
|
364
|
+
...cloned,
|
|
365
|
+
id: newId,
|
|
366
|
+
position: {
|
|
367
|
+
x: cloned.position.x + CLONE_OFFSET,
|
|
368
|
+
y: cloned.position.y + CLONE_OFFSET
|
|
369
|
+
},
|
|
370
|
+
selected: true
|
|
371
|
+
};
|
|
372
|
+
});
|
|
373
|
+
const clonedEdges = edges.filter((e) => idMap.has(e.source) && idMap.has(e.target)).map((e) => {
|
|
374
|
+
const cloned = cloneValue(e);
|
|
375
|
+
return {
|
|
376
|
+
...cloned,
|
|
377
|
+
id: nanoid(),
|
|
378
|
+
source: idMap.get(e.source),
|
|
379
|
+
target: idMap.get(e.target),
|
|
380
|
+
selected: false
|
|
381
|
+
};
|
|
382
|
+
});
|
|
383
|
+
set((state) => ({
|
|
384
|
+
workflow: {
|
|
385
|
+
...state.workflow,
|
|
386
|
+
nodes: [
|
|
387
|
+
...state.workflow.nodes.map(
|
|
388
|
+
(n) => idSet.has(n.id) ? { ...n, selected: false } : n
|
|
389
|
+
),
|
|
390
|
+
...clones
|
|
391
|
+
],
|
|
392
|
+
edges: [...state.workflow.edges, ...clonedEdges]
|
|
393
|
+
}
|
|
394
|
+
}));
|
|
395
|
+
},
|
|
396
|
+
pasteNodes: (payload) => {
|
|
397
|
+
const pasteNodesIn = payload.nodes ?? [];
|
|
398
|
+
if (pasteNodesIn.length === 0) return;
|
|
399
|
+
pushCheckpoint("nodes:paste", false);
|
|
400
|
+
const idMap = /* @__PURE__ */ new Map();
|
|
401
|
+
const clones = pasteNodesIn.map((n) => {
|
|
402
|
+
const newId = nanoid();
|
|
403
|
+
idMap.set(n.id, newId);
|
|
404
|
+
const cloned = cloneValue(n);
|
|
405
|
+
return {
|
|
406
|
+
...cloned,
|
|
407
|
+
id: newId,
|
|
408
|
+
position: {
|
|
409
|
+
x: (cloned.position?.x ?? 0) + CLONE_OFFSET,
|
|
410
|
+
y: (cloned.position?.y ?? 0) + CLONE_OFFSET
|
|
411
|
+
},
|
|
412
|
+
selected: true
|
|
413
|
+
};
|
|
414
|
+
});
|
|
415
|
+
const clonedEdges = (payload.edges ?? []).filter((e) => idMap.has(e.source) && idMap.has(e.target)).map((e) => {
|
|
416
|
+
const cloned = cloneValue(e);
|
|
417
|
+
return {
|
|
418
|
+
...cloned,
|
|
419
|
+
id: nanoid(),
|
|
420
|
+
source: idMap.get(e.source),
|
|
421
|
+
target: idMap.get(e.target),
|
|
422
|
+
selected: false
|
|
423
|
+
};
|
|
424
|
+
});
|
|
425
|
+
set((state) => ({
|
|
426
|
+
workflow: {
|
|
427
|
+
...state.workflow,
|
|
428
|
+
nodes: [
|
|
429
|
+
...state.workflow.nodes.map((n) => ({ ...n, selected: false })),
|
|
430
|
+
...clones
|
|
431
|
+
],
|
|
432
|
+
edges: [...state.workflow.edges, ...clonedEdges]
|
|
433
|
+
}
|
|
434
|
+
}));
|
|
435
|
+
},
|
|
436
|
+
toggleDisabled: (nodeId) => {
|
|
437
|
+
pushCheckpoint("nodes:disable", false);
|
|
438
|
+
set((state) => ({
|
|
439
|
+
workflow: {
|
|
440
|
+
...state.workflow,
|
|
441
|
+
nodes: state.workflow.nodes.map((n) => {
|
|
442
|
+
if (n.id !== nodeId) return n;
|
|
443
|
+
const data = n.data ?? {};
|
|
444
|
+
return {
|
|
445
|
+
...n,
|
|
446
|
+
data: { ...data, disabled: !(data.disabled === true) }
|
|
447
|
+
};
|
|
448
|
+
})
|
|
449
|
+
}
|
|
450
|
+
}));
|
|
451
|
+
},
|
|
452
|
+
renameNode: (nodeId, label) => {
|
|
453
|
+
pushCheckpoint("nodes:rename", false);
|
|
454
|
+
set((state) => ({
|
|
455
|
+
workflow: {
|
|
456
|
+
...state.workflow,
|
|
457
|
+
nodes: state.workflow.nodes.map(
|
|
458
|
+
(n) => n.id === nodeId ? { ...n, data: { ...n.data ?? {}, label } } : n
|
|
459
|
+
),
|
|
460
|
+
renamingNodeId: null
|
|
461
|
+
}
|
|
462
|
+
}));
|
|
463
|
+
},
|
|
464
|
+
startRename: (nodeId) => {
|
|
465
|
+
set((state) => ({
|
|
466
|
+
workflow: { ...state.workflow, renamingNodeId: nodeId }
|
|
467
|
+
}));
|
|
468
|
+
},
|
|
469
|
+
endRename: () => {
|
|
470
|
+
set((state) => ({
|
|
471
|
+
workflow: { ...state.workflow, renamingNodeId: null }
|
|
472
|
+
}));
|
|
473
|
+
}
|
|
474
|
+
},
|
|
475
|
+
edges: {
|
|
476
|
+
onEdgesChange: (changes) => {
|
|
477
|
+
const removedIds = new Set(
|
|
478
|
+
changes.filter(
|
|
479
|
+
(c) => c.type === "remove"
|
|
480
|
+
).map((c) => c.id)
|
|
481
|
+
);
|
|
482
|
+
if (removedIds.size > 0) {
|
|
483
|
+
const stillPresent = get().workflow.edges.some(
|
|
484
|
+
(e) => removedIds.has(e.id)
|
|
485
|
+
);
|
|
486
|
+
if (stillPresent) pushCheckpoint("edges:remove", false);
|
|
487
|
+
}
|
|
488
|
+
set(
|
|
489
|
+
(state) => produce(state, (draft) => {
|
|
490
|
+
const updatedEdges = applyEdgeChanges(
|
|
491
|
+
changes,
|
|
492
|
+
draft.workflow.edges
|
|
493
|
+
);
|
|
494
|
+
draft.workflow.edges = updatedEdges;
|
|
495
|
+
})
|
|
496
|
+
);
|
|
497
|
+
},
|
|
498
|
+
onConnect: (connection) => {
|
|
499
|
+
pushCheckpoint("edges:connect", false);
|
|
500
|
+
const edge = {
|
|
501
|
+
...connection,
|
|
502
|
+
id: nanoid(),
|
|
503
|
+
type: "deletable"
|
|
504
|
+
};
|
|
505
|
+
set({
|
|
506
|
+
workflow: {
|
|
507
|
+
...get().workflow,
|
|
508
|
+
edges: addEdge(edge, get().workflow.edges)
|
|
509
|
+
}
|
|
510
|
+
});
|
|
511
|
+
},
|
|
512
|
+
setEdges: (edges, opts) => {
|
|
513
|
+
if (!opts?.skipHistory) {
|
|
514
|
+
pushCheckpoint(
|
|
515
|
+
opts?.historyKind ?? "edges:set",
|
|
516
|
+
!!opts?.historyKind
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
set({ workflow: { ...get().workflow, edges } });
|
|
520
|
+
},
|
|
521
|
+
deleteEdge: (edge) => {
|
|
522
|
+
const exists = get().workflow.edges.some((e) => e.id === edge.id);
|
|
523
|
+
if (exists) pushCheckpoint("edges:delete", false);
|
|
524
|
+
set((state) => ({
|
|
525
|
+
workflow: {
|
|
526
|
+
...state.workflow,
|
|
527
|
+
edges: state.workflow.edges.filter((e) => e.id !== edge.id)
|
|
528
|
+
}
|
|
529
|
+
}));
|
|
530
|
+
}
|
|
531
|
+
},
|
|
532
|
+
execution: {
|
|
533
|
+
startExecution: (nodeId, runId) => {
|
|
534
|
+
set((state) => ({
|
|
535
|
+
execution: {
|
|
536
|
+
...state.execution,
|
|
537
|
+
isExecuting: true,
|
|
538
|
+
executingNodeId: nodeId,
|
|
539
|
+
currentRunId: runId,
|
|
540
|
+
panelExpanded: true,
|
|
541
|
+
nodeStatuses: {
|
|
542
|
+
...state.execution.nodeStatuses,
|
|
543
|
+
[nodeId]: "running"
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}));
|
|
547
|
+
},
|
|
548
|
+
addLog: (log) => {
|
|
549
|
+
set((state) => ({
|
|
550
|
+
execution: {
|
|
551
|
+
...state.execution,
|
|
552
|
+
logs: [...state.execution.logs, log],
|
|
553
|
+
selectedLogId: log.id
|
|
554
|
+
}
|
|
555
|
+
}));
|
|
556
|
+
},
|
|
557
|
+
updateLog: (logId, updates) => {
|
|
558
|
+
set((state) => ({
|
|
559
|
+
execution: {
|
|
560
|
+
...state.execution,
|
|
561
|
+
logs: state.execution.logs.map(
|
|
562
|
+
(log) => log.id === logId ? { ...log, ...updates } : log
|
|
563
|
+
)
|
|
564
|
+
}
|
|
565
|
+
}));
|
|
566
|
+
},
|
|
567
|
+
setNodeStatus: (nodeId, status) => {
|
|
568
|
+
set((state) => ({
|
|
569
|
+
execution: {
|
|
570
|
+
...state.execution,
|
|
571
|
+
nodeStatuses: {
|
|
572
|
+
...state.execution.nodeStatuses,
|
|
573
|
+
[nodeId]: status
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}));
|
|
577
|
+
},
|
|
578
|
+
setNodeItemCount: (nodeId, count) => {
|
|
579
|
+
set((state) => ({
|
|
580
|
+
execution: {
|
|
581
|
+
...state.execution,
|
|
582
|
+
nodeItemCounts: {
|
|
583
|
+
...state.execution.nodeItemCounts,
|
|
584
|
+
[nodeId]: count
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}));
|
|
588
|
+
},
|
|
589
|
+
selectLog: (logId) => {
|
|
590
|
+
set((state) => ({
|
|
591
|
+
execution: {
|
|
592
|
+
...state.execution,
|
|
593
|
+
selectedLogId: logId
|
|
594
|
+
}
|
|
595
|
+
}));
|
|
596
|
+
},
|
|
597
|
+
togglePanel: () => {
|
|
598
|
+
set((state) => ({
|
|
599
|
+
execution: {
|
|
600
|
+
...state.execution,
|
|
601
|
+
panelExpanded: !state.execution.panelExpanded
|
|
602
|
+
}
|
|
603
|
+
}));
|
|
604
|
+
},
|
|
605
|
+
clearLogs: () => {
|
|
606
|
+
set((state) => ({
|
|
607
|
+
execution: {
|
|
608
|
+
...state.execution,
|
|
609
|
+
logs: [],
|
|
610
|
+
selectedLogId: null,
|
|
611
|
+
nodeStatuses: {},
|
|
612
|
+
nodeItemCounts: {}
|
|
613
|
+
}
|
|
614
|
+
}));
|
|
615
|
+
},
|
|
616
|
+
completeExecution: () => {
|
|
617
|
+
set((state) => ({
|
|
618
|
+
execution: {
|
|
619
|
+
...state.execution,
|
|
620
|
+
isExecuting: false,
|
|
621
|
+
executingNodeId: null
|
|
622
|
+
}
|
|
623
|
+
}));
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
};
|
|
628
|
+
});
|
|
629
|
+
if (typeof window !== "undefined" && import.meta.env?.DEV) {
|
|
630
|
+
window.__fgFlowStore = useFlowStore;
|
|
631
|
+
}
|
|
632
|
+
function QuotaExhaustedDialog({
|
|
633
|
+
open,
|
|
634
|
+
onOpenChange,
|
|
635
|
+
onUpgrade,
|
|
636
|
+
title,
|
|
637
|
+
description
|
|
638
|
+
}) {
|
|
639
|
+
const tr = useTr();
|
|
640
|
+
const resolvedTitle = title ?? tr(
|
|
641
|
+
"fluidgrids.components.quotaExhaustedDialog.title",
|
|
642
|
+
"Workflow Limit Reached"
|
|
643
|
+
);
|
|
644
|
+
const resolvedDescription = description ?? tr(
|
|
645
|
+
"fluidgrids.components.quotaExhaustedDialog.description",
|
|
646
|
+
"You've reached the workflow limit for your plan. Upgrade your plan to create more workflows."
|
|
647
|
+
);
|
|
648
|
+
return /* @__PURE__ */ jsx(AlertDialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
|
|
649
|
+
/* @__PURE__ */ jsxs(AlertDialogHeader, { children: [
|
|
650
|
+
/* @__PURE__ */ jsx(AlertDialogTitle, { children: resolvedTitle }),
|
|
651
|
+
/* @__PURE__ */ jsx(AlertDialogDescription, { children: resolvedDescription })
|
|
652
|
+
] }),
|
|
653
|
+
/* @__PURE__ */ jsxs(AlertDialogFooter, { children: [
|
|
654
|
+
/* @__PURE__ */ jsx(AlertDialogCancel, { children: tr(
|
|
655
|
+
"fluidgrids.components.quotaExhaustedDialog.dismiss",
|
|
656
|
+
"Dismiss"
|
|
657
|
+
) }),
|
|
658
|
+
/* @__PURE__ */ jsx(AlertDialogAction, { onClick: onUpgrade, children: tr(
|
|
659
|
+
"fluidgrids.components.quotaExhaustedDialog.viewBilling",
|
|
660
|
+
"View Billing"
|
|
661
|
+
) })
|
|
662
|
+
] })
|
|
663
|
+
] }) });
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
export { QuotaExhaustedDialog, useFlowStore };
|
|
667
|
+
//# sourceMappingURL=chunk-I3WUYESA.js.map
|
|
668
|
+
//# sourceMappingURL=chunk-I3WUYESA.js.map
|