@uipath/apollo-react 3.44.0 → 3.44.2-pr255.af80ea0

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 (121) hide show
  1. package/dist/canvas/components/StageNode/CrossStageTaskDrag.stories.cjs +581 -0
  2. package/dist/canvas/components/StageNode/CrossStageTaskDrag.stories.d.ts +6 -0
  3. package/dist/canvas/components/StageNode/CrossStageTaskDrag.stories.d.ts.map +1 -0
  4. package/dist/canvas/components/StageNode/CrossStageTaskDrag.stories.js +544 -0
  5. package/dist/canvas/components/StageNode/DropPlaceholder.cjs +106 -0
  6. package/dist/canvas/components/StageNode/DropPlaceholder.d.ts +10 -0
  7. package/dist/canvas/components/StageNode/DropPlaceholder.d.ts.map +1 -0
  8. package/dist/canvas/components/StageNode/DropPlaceholder.js +72 -0
  9. package/dist/canvas/components/StageNode/StageNode.cjs +334 -389
  10. package/dist/canvas/components/StageNode/StageNode.d.ts.map +1 -1
  11. package/dist/canvas/components/StageNode/StageNode.js +336 -391
  12. package/dist/canvas/components/StageNode/StageNode.stories.cjs +1910 -1416
  13. package/dist/canvas/components/StageNode/StageNode.stories.d.ts +1 -1
  14. package/dist/canvas/components/StageNode/StageNode.stories.d.ts.map +1 -1
  15. package/dist/canvas/components/StageNode/StageNode.stories.js +1906 -1412
  16. package/dist/canvas/components/StageNode/StageNode.styles.cjs +1 -1
  17. package/dist/canvas/components/StageNode/StageNode.styles.js +1 -1
  18. package/dist/canvas/components/StageNode/StageNode.types.d.ts +26 -10
  19. package/dist/canvas/components/StageNode/StageNode.types.d.ts.map +1 -1
  20. package/dist/canvas/components/StageNode/StageNodeTaskUtilities.cjs +10 -5
  21. package/dist/canvas/components/StageNode/StageNodeTaskUtilities.d.ts +2 -1
  22. package/dist/canvas/components/StageNode/StageNodeTaskUtilities.d.ts.map +1 -1
  23. package/dist/canvas/components/StageNode/StageNodeTaskUtilities.js +6 -4
  24. package/dist/canvas/components/StageNode/TaskMenu.cjs +11 -43
  25. package/dist/canvas/components/StageNode/TaskMenu.d.ts +1 -6
  26. package/dist/canvas/components/StageNode/TaskMenu.d.ts.map +1 -1
  27. package/dist/canvas/components/StageNode/TaskMenu.js +13 -35
  28. package/dist/canvas/components/StageNode/index.cjs +17 -3
  29. package/dist/canvas/components/StageNode/index.d.ts +4 -1
  30. package/dist/canvas/components/StageNode/index.d.ts.map +1 -1
  31. package/dist/canvas/components/StageNode/index.js +3 -1
  32. package/dist/canvas/components/TaskNode/PlaceholderTaskNode.cjs +51 -0
  33. package/dist/canvas/components/TaskNode/PlaceholderTaskNode.d.ts +8 -0
  34. package/dist/canvas/components/TaskNode/PlaceholderTaskNode.d.ts.map +1 -0
  35. package/dist/canvas/components/TaskNode/PlaceholderTaskNode.js +17 -0
  36. package/dist/canvas/components/TaskNode/TaskNode.cjs +235 -0
  37. package/dist/canvas/components/TaskNode/TaskNode.d.ts +11 -0
  38. package/dist/canvas/components/TaskNode/TaskNode.d.ts.map +1 -0
  39. package/dist/canvas/components/TaskNode/TaskNode.js +198 -0
  40. package/dist/canvas/components/TaskNode/TaskNode.stories.cjs +558 -0
  41. package/dist/canvas/components/TaskNode/TaskNode.stories.d.ts +8 -0
  42. package/dist/canvas/components/TaskNode/TaskNode.stories.d.ts.map +1 -0
  43. package/dist/canvas/components/TaskNode/TaskNode.stories.js +515 -0
  44. package/dist/canvas/components/TaskNode/TaskNode.types.d.ts +40 -0
  45. package/dist/canvas/components/TaskNode/TaskNode.types.d.ts.map +1 -0
  46. package/dist/canvas/components/TaskNode/TaskNodeContext.cjs +86 -0
  47. package/dist/canvas/components/TaskNode/TaskNodeContext.d.ts +24 -0
  48. package/dist/canvas/components/TaskNode/TaskNodeContext.d.ts.map +1 -0
  49. package/dist/canvas/components/TaskNode/TaskNodeContext.js +40 -0
  50. package/dist/canvas/components/TaskNode/index.cjs +82 -0
  51. package/dist/canvas/components/TaskNode/index.d.ts +8 -0
  52. package/dist/canvas/components/TaskNode/index.d.ts.map +1 -0
  53. package/dist/canvas/components/TaskNode/index.js +6 -0
  54. package/dist/canvas/components/TaskNode/taskReorderUtils.cjs +206 -0
  55. package/dist/canvas/components/TaskNode/taskReorderUtils.d.ts +23 -0
  56. package/dist/canvas/components/TaskNode/taskReorderUtils.d.ts.map +1 -0
  57. package/dist/canvas/components/TaskNode/taskReorderUtils.js +154 -0
  58. package/dist/canvas/components/TaskNode/useTaskPositions.cjs +153 -0
  59. package/dist/canvas/components/TaskNode/useTaskPositions.d.ts +29 -0
  60. package/dist/canvas/components/TaskNode/useTaskPositions.d.ts.map +1 -0
  61. package/dist/canvas/components/TaskNode/useTaskPositions.js +110 -0
  62. package/dist/canvas/core/TaskTypeRegistry.cjs +132 -0
  63. package/dist/canvas/core/TaskTypeRegistry.d.ts +18 -0
  64. package/dist/canvas/core/TaskTypeRegistry.d.ts.map +1 -0
  65. package/dist/canvas/core/TaskTypeRegistry.js +98 -0
  66. package/dist/canvas/core/index.cjs +21 -3
  67. package/dist/canvas/core/index.d.ts +2 -0
  68. package/dist/canvas/core/index.d.ts.map +1 -1
  69. package/dist/canvas/core/index.js +2 -0
  70. package/dist/canvas/core/useTaskTypeRegistry.cjs +82 -0
  71. package/dist/canvas/core/useTaskTypeRegistry.d.ts +13 -0
  72. package/dist/canvas/core/useTaskTypeRegistry.d.ts.map +1 -0
  73. package/dist/canvas/core/useTaskTypeRegistry.js +33 -0
  74. package/dist/canvas/hooks/CrossStageDragContext.cjs +45 -0
  75. package/dist/canvas/hooks/CrossStageDragContext.d.ts +8 -0
  76. package/dist/canvas/hooks/CrossStageDragContext.d.ts.map +1 -0
  77. package/dist/canvas/hooks/CrossStageDragContext.js +8 -0
  78. package/dist/canvas/hooks/calculateTaskDropPosition.cjs +253 -0
  79. package/dist/canvas/hooks/calculateTaskDropPosition.d.ts +11 -0
  80. package/dist/canvas/hooks/calculateTaskDropPosition.d.ts.map +1 -0
  81. package/dist/canvas/hooks/calculateTaskDropPosition.js +216 -0
  82. package/dist/canvas/hooks/index.cjs +57 -30
  83. package/dist/canvas/hooks/index.d.ts +3 -0
  84. package/dist/canvas/hooks/index.d.ts.map +1 -1
  85. package/dist/canvas/hooks/index.js +3 -0
  86. package/dist/canvas/hooks/useCrossStageTaskDrag.cjs +346 -0
  87. package/dist/canvas/hooks/useCrossStageTaskDrag.d.ts +44 -0
  88. package/dist/canvas/hooks/useCrossStageTaskDrag.d.ts.map +1 -0
  89. package/dist/canvas/hooks/useCrossStageTaskDrag.js +312 -0
  90. package/dist/canvas/hooks/useTaskCopyPaste.cjs +155 -0
  91. package/dist/canvas/hooks/useTaskCopyPaste.d.ts +34 -0
  92. package/dist/canvas/hooks/useTaskCopyPaste.d.ts.map +1 -0
  93. package/dist/canvas/hooks/useTaskCopyPaste.js +121 -0
  94. package/dist/canvas/schema/index.cjs +12 -3
  95. package/dist/canvas/schema/index.d.ts +1 -0
  96. package/dist/canvas/schema/index.d.ts.map +1 -1
  97. package/dist/canvas/schema/index.js +1 -0
  98. package/dist/canvas/schema/task-definition/index.cjs +60 -0
  99. package/dist/canvas/schema/task-definition/index.d.ts +2 -0
  100. package/dist/canvas/schema/task-definition/index.d.ts.map +1 -0
  101. package/dist/canvas/schema/task-definition/index.js +1 -0
  102. package/dist/canvas/schema/task-definition/task-manifest.cjs +78 -0
  103. package/dist/canvas/schema/task-definition/task-manifest.d.ts +43 -0
  104. package/dist/canvas/schema/task-definition/task-manifest.d.ts.map +1 -0
  105. package/dist/canvas/schema/task-definition/task-manifest.js +29 -0
  106. package/dist/material/components/ap-sankey-diagram/ApSankeyDiagram.cjs +44 -21
  107. package/dist/material/components/ap-sankey-diagram/ApSankeyDiagram.d.ts.map +1 -1
  108. package/dist/material/components/ap-sankey-diagram/ApSankeyDiagram.js +44 -21
  109. package/package.json +3 -3
  110. package/dist/canvas/components/StageNode/DraggableTask.cjs +0 -271
  111. package/dist/canvas/components/StageNode/DraggableTask.d.ts +0 -4
  112. package/dist/canvas/components/StageNode/DraggableTask.d.ts.map +0 -1
  113. package/dist/canvas/components/StageNode/DraggableTask.js +0 -234
  114. package/dist/canvas/components/StageNode/DraggableTask.types.d.ts +0 -20
  115. package/dist/canvas/components/StageNode/DraggableTask.types.d.ts.map +0 -1
  116. package/dist/canvas/components/StageNode/StageNode.utils.cjs +0 -164
  117. package/dist/canvas/components/StageNode/StageNode.utils.d.ts +0 -19
  118. package/dist/canvas/components/StageNode/StageNode.utils.d.ts.map +0 -1
  119. package/dist/canvas/components/StageNode/StageNode.utils.js +0 -121
  120. /package/dist/canvas/components/{StageNode/DraggableTask.types.cjs → TaskNode/TaskNode.types.cjs} +0 -0
  121. /package/dist/canvas/components/{StageNode/DraggableTask.types.js → TaskNode/TaskNode.types.js} +0 -0
@@ -1,1114 +1,1354 @@
1
1
  import { jsx, jsxs } from "react/jsx-runtime";
2
- import { ConnectionMode, Panel, ReactFlowProvider, addEdge, useEdgesState, useNodesState } from "../../xyflow/react.js";
2
+ import { ConnectionMode, Panel, ReactFlowProvider, addEdge, applyNodeChanges, useEdgesState, useNodesState } from "../../xyflow/react.js";
3
3
  import { ApButton, ApMenu } from "../../../material/components/index.js";
4
- import { useCallback, useMemo, useState } from "react";
4
+ import { useCallback, useEffect, useMemo, useRef, useState } from "react";
5
+ import { CrossStageDragProvider } from "../../hooks/CrossStageDragContext.js";
6
+ import { useCrossStageTaskDrag } from "../../hooks/useCrossStageTaskDrag.js";
7
+ import { useTaskCopyPaste } from "../../hooks/useTaskCopyPaste.js";
5
8
  import { DefaultCanvasTranslations } from "../../types.js";
6
- import { createGroupModificationHandlers, getHandlerForModificationType } from "../../utils/GroupModificationUtils.js";
9
+ import { GroupModificationType, createGroupModificationHandlers, getHandlerForModificationType } from "../../utils/GroupModificationUtils.js";
7
10
  import { BaseCanvas } from "../BaseCanvas/index.js";
8
11
  import { CanvasPositionControls } from "../CanvasPositionControls.js";
9
12
  import { TaskIcon, TaskItemTypeValues } from "../TaskIcon/index.js";
13
+ import { PlaceholderTaskNode } from "../TaskNode/PlaceholderTaskNode.js";
14
+ import { TaskNode } from "../TaskNode/TaskNode.js";
15
+ import { insertTaskAtPosition, moveTaskBetweenStages, moveTaskWithinStage } from "../TaskNode/taskReorderUtils.js";
16
+ import { calculateTaskPositions } from "../TaskNode/useTaskPositions.js";
10
17
  import { StageConnectionEdge } from "./StageConnectionEdge.js";
11
18
  import { StageEdge } from "./StageEdge.js";
12
19
  import { StageNode } from "./StageNode.js";
20
+ import { getContextMenuItems } from "./StageNodeTaskUtilities.js";
13
21
  const meta = {
14
22
  title: 'Canvas/StageNode',
15
23
  component: StageNode,
16
24
  parameters: {
17
25
  layout: 'fullscreen'
18
- },
19
- decorators: [
20
- (Story, context)=>{
21
- if (context.parameters?.useCustomRender) return /*#__PURE__*/ jsx(Story, {});
22
- const StageNodeWrapper = (props)=>/*#__PURE__*/ jsx(StageNode, {
23
- ...props,
24
- ...props.data
25
- });
26
- const initialNodes = context.parameters?.nodes || [
27
- {
28
- id: '1',
29
- type: 'stage',
30
- position: {
31
- x: 250,
32
- y: 100
33
- },
34
- data: {
35
- stageDetails: context.args.stageDetails,
36
- execution: context.args.execution,
37
- addTaskLabel: context.args.addTaskLabel,
38
- menuItems: context.args.menuItems,
39
- onTaskAdd: context.args.onTaskAdd,
40
- onTaskClick: context.args.onTaskClick
41
- }
42
- }
43
- ];
44
- const initialEdges = context.parameters?.edges || [];
45
- const [nodes, _setNodes, onNodesChange] = useNodesState(initialNodes);
46
- const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
47
- const onConnect = useCallback((connection)=>{
48
- setEdges((eds)=>addEdge(connection, eds));
49
- }, [
50
- setEdges
51
- ]);
52
- const nodeTypes = useMemo(()=>({
53
- stage: StageNodeWrapper
54
- }), [
55
- StageNodeWrapper
56
- ]);
57
- const edgeTypes = useMemo(()=>({
58
- stage: StageEdge
59
- }), []);
60
- const defaultEdgeOptions = useMemo(()=>({
61
- type: 'stage'
62
- }), []);
63
- return /*#__PURE__*/ jsx("div", {
64
- style: {
65
- width: '100vw',
66
- height: '100vh'
67
- },
68
- children: /*#__PURE__*/ jsx(ReactFlowProvider, {
69
- children: /*#__PURE__*/ jsx(BaseCanvas, {
70
- nodes: nodes,
71
- edges: edges,
72
- onNodesChange: onNodesChange,
73
- onEdgesChange: onEdgesChange,
74
- onConnect: onConnect,
75
- nodeTypes: nodeTypes,
76
- edgeTypes: edgeTypes,
77
- mode: "design",
78
- connectionMode: ConnectionMode.Strict,
79
- defaultEdgeOptions: defaultEdgeOptions,
80
- connectionLineComponent: StageConnectionEdge,
81
- elevateEdgesOnSelect: true,
82
- children: /*#__PURE__*/ jsx(Panel, {
83
- position: "bottom-right",
84
- children: /*#__PURE__*/ jsx(CanvasPositionControls, {
85
- translations: DefaultCanvasTranslations
86
- })
87
- })
88
- })
89
- })
90
- });
91
- }
92
- ],
93
- args: {
94
- stageDetails: {
95
- label: 'Default Stage',
96
- tasks: []
97
- }
98
- },
99
- argTypes: {
100
- addTaskLabel: {
101
- control: 'text',
102
- description: 'Label for the add process button',
103
- defaultValue: 'Add process'
104
- }
105
26
  }
106
27
  };
107
28
  const StageNode_stories = meta;
108
- const ProcessIcon = ()=>/*#__PURE__*/ jsxs("svg", {
109
- viewBox: "0 0 24 24",
110
- fill: "none",
111
- stroke: "currentColor",
112
- strokeWidth: "1.5",
113
- children: [
114
- /*#__PURE__*/ jsx("rect", {
115
- x: "3",
116
- y: "3",
117
- width: "7",
118
- height: "7",
119
- rx: "1"
120
- }),
121
- /*#__PURE__*/ jsx("rect", {
122
- x: "14",
123
- y: "3",
124
- width: "7",
125
- height: "7",
126
- rx: "1"
127
- }),
128
- /*#__PURE__*/ jsx("rect", {
129
- x: "3",
130
- y: "14",
131
- width: "7",
132
- height: "7",
133
- rx: "1"
134
- }),
135
- /*#__PURE__*/ jsx("rect", {
136
- x: "14",
137
- y: "14",
138
- width: "7",
139
- height: "7",
140
- rx: "1"
141
- })
142
- ]
29
+ const StageNodeWrapper = (props)=>/*#__PURE__*/ jsx(StageNode, {
30
+ ...props,
31
+ ...props.data
143
32
  });
144
- const VerificationIcon = ()=>/*#__PURE__*/ jsxs("svg", {
145
- viewBox: "0 0 24 24",
146
- fill: "none",
147
- stroke: "currentColor",
148
- strokeWidth: "1.5",
149
- children: [
150
- /*#__PURE__*/ jsx("path", {
151
- d: "M9 11L12 14L20 6"
152
- }),
153
- /*#__PURE__*/ jsx("path", {
154
- d: "M20 12V18C20 19.1046 19.1046 20 18 20H6C4.89543 20 4 19.1046 4 18V6C4 4.89543 4.89543 4 6 4H13"
155
- })
156
- ]
33
+ const TaskNodeWrapper = (props)=>/*#__PURE__*/ jsx(TaskNode, {
34
+ ...props
157
35
  });
158
- const DocumentIcon = ()=>/*#__PURE__*/ jsxs("svg", {
159
- viewBox: "0 0 24 24",
160
- fill: "none",
161
- stroke: "currentColor",
162
- strokeWidth: "1.5",
163
- children: [
164
- /*#__PURE__*/ jsx("path", {
165
- d: "M14 2H6C4.9 2 4 2.9 4 4V20C20 21.1 4.9 22 6 22H18C19.1 22 20 21.1 20 20V8L14 2Z"
166
- }),
167
- /*#__PURE__*/ jsx("path", {
168
- d: "M14 2V8H20"
169
- }),
170
- /*#__PURE__*/ jsx("path", {
171
- d: "M8 12H16"
172
- }),
173
- /*#__PURE__*/ jsx("path", {
174
- d: "M8 16H16"
175
- })
176
- ]
36
+ function mergeNodes(prevNodes, computedNodes) {
37
+ const computedMap = new Map(computedNodes.map((n)=>[
38
+ n.id,
39
+ n
40
+ ]));
41
+ const prevIds = new Set(prevNodes.map((n)=>n.id));
42
+ const computedIds = new Set(computedNodes.map((n)=>n.id));
43
+ const merged = prevNodes.filter((n)=>computedIds.has(n.id)).map((n)=>{
44
+ const source = computedMap.get(n.id);
45
+ if (!source) return n;
46
+ return {
47
+ ...n,
48
+ data: source.data,
49
+ style: source.style,
50
+ position: source.position
51
+ };
177
52
  });
178
- const sampleTasks = [
179
- [
180
- {
181
- id: 'liability_check',
182
- label: 'Liability Check',
183
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
184
- }
185
- ],
186
- [
187
- {
188
- id: 'credit_review',
189
- label: 'Credit Review',
190
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
191
- }
192
- ],
193
- [
194
- {
195
- id: 'address_verification',
196
- label: 'Address Verification and a really long label that might wrap',
197
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
198
- },
199
- {
200
- id: 'property_verification',
201
- label: 'Property Verification',
202
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
203
- }
204
- ],
205
- [
206
- {
207
- id: 'processing_review',
208
- label: 'Processing Review',
209
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
210
- }
211
- ]
212
- ];
213
- const Default = {
214
- name: 'Default',
215
- parameters: {
216
- nodes: [
217
- {
218
- id: '0',
219
- type: 'stage',
53
+ for (const node of computedNodes)if (!prevIds.has(node.id)) merged.push(node);
54
+ return merged;
55
+ }
56
+ function createTaskNodes({ stageId, taskIds, tasks, stageWidth, onTaskClick, onTaskSelect, stageExecution, enableCrossStage, onGroupModification, onRequestReplaceTask }) {
57
+ const positions = calculateTaskPositions(taskIds, stageWidth, tasks, stageExecution);
58
+ const nodes = [];
59
+ taskIds.forEach((group, groupIndex)=>{
60
+ group.forEach((taskId, taskIndex)=>{
61
+ const taskInfo = tasks[taskId];
62
+ if (!taskInfo) return;
63
+ const position = positions.get(taskId);
64
+ if (!position) return;
65
+ const prevGroup = groupIndex > 0 ? taskIds[groupIndex - 1] : void 0;
66
+ const nextGroup = groupIndex < taskIds.length - 1 ? taskIds[groupIndex + 1] : void 0;
67
+ const contextMenuItems = onGroupModification ? getContextMenuItems(group.length > 1, groupIndex, taskIds.length, taskIndex, group.length, void 0 !== prevGroup && prevGroup.length > 1, void 0 !== nextGroup && nextGroup.length > 1, onGroupModification, onRequestReplaceTask) : taskInfo.contextMenuItems;
68
+ const node = {
69
+ id: taskId,
70
+ type: 'task',
71
+ parentId: stageId,
220
72
  position: {
221
- x: 48,
222
- y: 96
73
+ x: position.x,
74
+ y: position.y
223
75
  },
224
- width: 304,
76
+ width: position.width,
225
77
  data: {
226
- stageDetails: {
227
- label: 'Application',
228
- tasks: []
229
- },
230
- execution: {
231
- stageStatus: {
232
- duration: 'SLA: None'
233
- }
234
- },
235
- onTaskAdd: ()=>{
236
- window.alert('Add task functionality - this would open a dialog to add a new task');
237
- }
78
+ taskType: taskInfo.taskType,
79
+ label: taskInfo.label,
80
+ iconElement: taskInfo.icon,
81
+ groupIndex,
82
+ taskIndex,
83
+ execution: taskInfo.execution,
84
+ onTaskClick,
85
+ onTaskSelect,
86
+ width: position.width,
87
+ contextMenuItems
238
88
  }
239
- },
240
- {
241
- id: '1',
89
+ };
90
+ if (!enableCrossStage) node.extent = 'parent';
91
+ nodes.push(node);
92
+ });
93
+ });
94
+ return nodes;
95
+ }
96
+ const InteractiveStageCanvas = ({ stages: initialStages, tasks: initialTasks, edges: initialEdges = [], showInstructions = true, onTaskAdd, onAddTaskFromToolbox, taskOptions, enableTaskMenu = true, enableReplaceTask = true })=>{
97
+ const [stageTaskIds, setStageTaskIds] = useState(Object.fromEntries(initialStages.map((s)=>[
98
+ s.id,
99
+ s.taskIds
100
+ ])));
101
+ const [tasks, setTasks] = useState(initialTasks);
102
+ const [selectedTaskId, setSelectedTaskId] = useState(null);
103
+ const [actionLog, setActionLog] = useState('');
104
+ const [replaceTargets, setReplaceTargets] = useState({});
105
+ const handleTaskReplace = useCallback((stageId)=>(newTask, groupIndex, taskIndex)=>{
106
+ setActionLog(`Replace task at stage ${stageId}, group ${groupIndex}, task ${taskIndex} with "${newTask.name}"`);
107
+ const newTaskId = `replaced-${Date.now()}`;
108
+ const IconComp = newTask.icon?.Component;
109
+ setTasks((prev)=>({
110
+ ...prev,
111
+ [newTaskId]: {
112
+ label: newTask.name,
113
+ taskType: newTask.data?.taskType || 'uipath.case-management.process',
114
+ icon: IconComp ? /*#__PURE__*/ jsx(IconComp, {}) : /*#__PURE__*/ jsx(TaskIcon, {
115
+ type: TaskItemTypeValues.AgenticProcess,
116
+ size: "sm"
117
+ })
118
+ }
119
+ }));
120
+ setStageTaskIds((prev)=>{
121
+ const currentTaskIds = [
122
+ ...prev[stageId] || []
123
+ ].map((group)=>[
124
+ ...group
125
+ ]);
126
+ const targetGroup = currentTaskIds[groupIndex];
127
+ if (targetGroup && void 0 !== targetGroup[taskIndex]) targetGroup[taskIndex] = newTaskId;
128
+ return {
129
+ ...prev,
130
+ [stageId]: currentTaskIds
131
+ };
132
+ });
133
+ }, []);
134
+ const stageNodes = useMemo(()=>initialStages.map((stage)=>({
135
+ id: stage.id,
242
136
  type: 'stage',
243
- position: {
244
- x: 400,
245
- y: 96
137
+ position: stage.position,
138
+ style: {
139
+ width: stage.width || 304
246
140
  },
247
- width: 304,
248
141
  data: {
142
+ nodeType: 'case-management:Stage',
249
143
  stageDetails: {
250
- label: 'Processing with a really really really long label that might wrap',
251
- tasks: sampleTasks,
252
- sla: '1h',
253
- slaBreached: false,
254
- escalation: '1h',
255
- escalationsTriggered: false
144
+ label: stage.label,
145
+ taskIds: stageTaskIds[stage.id] || [],
146
+ isException: stage.isException,
147
+ isReadOnly: stage.isReadOnly
256
148
  },
257
- execution: {
258
- stageStatus: {
259
- duration: 'SLA: None'
260
- }
261
- },
262
- onAddTaskFromToolbox: (taskItem)=>{
263
- window.alert(`Add task (${taskItem.data.type}) - this would open a panel to configure the new task`);
149
+ execution: stage.execution,
150
+ onTaskClick: (taskId)=>{
151
+ setSelectedTaskId(taskId);
152
+ setActionLog(`Selected: ${taskId}`);
264
153
  },
265
- taskOptions: sampleTasks.flat().map((task)=>({
266
- id: task.id,
267
- name: task.label,
268
- icon: {
269
- Component: ()=>task.icon
270
- },
271
- data: {
272
- type: task.id
154
+ onTaskAdd,
155
+ onAddTaskFromToolbox,
156
+ taskOptions,
157
+ ...enableReplaceTask && !stage.isReadOnly ? {
158
+ onReplaceTaskFromToolbox: handleTaskReplace(stage.id),
159
+ replaceTaskTarget: replaceTargets[stage.id] ?? null,
160
+ onReplaceTaskTargetChange: (target)=>setReplaceTargets((prev)=>({
161
+ ...prev,
162
+ [stage.id]: target
163
+ }))
164
+ } : {}
165
+ }
166
+ })), [
167
+ initialStages,
168
+ stageTaskIds,
169
+ onTaskAdd,
170
+ onAddTaskFromToolbox,
171
+ taskOptions,
172
+ enableReplaceTask,
173
+ handleTaskReplace,
174
+ replaceTargets
175
+ ]);
176
+ const handleGroupModification = useCallback((stageId)=>(type, groupIndex, taskIndex)=>{
177
+ setActionLog(`Group modification: ${type} at stage ${stageId}, group ${groupIndex}, task ${taskIndex}`);
178
+ setStageTaskIds((prev)=>{
179
+ const currentTaskIds = [
180
+ ...prev[stageId] || []
181
+ ].map((group)=>[
182
+ ...group
183
+ ]);
184
+ const currentGroup = currentTaskIds[groupIndex];
185
+ if (!currentGroup) return prev;
186
+ switch(type){
187
+ case GroupModificationType.TASK_GROUP_UP:
188
+ if (groupIndex > 0) {
189
+ const taskId = currentGroup[taskIndex];
190
+ if (!taskId) break;
191
+ currentGroup.splice(taskIndex, 1);
192
+ if (0 === currentGroup.length) currentTaskIds.splice(groupIndex, 1);
193
+ currentTaskIds.splice(groupIndex - 1, 0, [
194
+ taskId
195
+ ]);
196
+ }
197
+ break;
198
+ case GroupModificationType.TASK_GROUP_DOWN:
199
+ if (groupIndex < currentTaskIds.length - 1) {
200
+ const taskId = currentGroup[taskIndex];
201
+ if (!taskId) break;
202
+ currentGroup.splice(taskIndex, 1);
203
+ if (0 === currentGroup.length) {
204
+ currentTaskIds.splice(groupIndex, 1);
205
+ currentTaskIds.splice(groupIndex + 1, 0, [
206
+ taskId
207
+ ]);
208
+ } else currentTaskIds.splice(groupIndex + 2, 0, [
209
+ taskId
210
+ ]);
211
+ }
212
+ break;
213
+ case GroupModificationType.MERGE_GROUP_UP:
214
+ if (groupIndex > 0) {
215
+ const taskId = currentGroup[taskIndex];
216
+ if (!taskId) break;
217
+ currentGroup.splice(taskIndex, 1);
218
+ if (0 === currentGroup.length) currentTaskIds.splice(groupIndex, 1);
219
+ currentTaskIds[groupIndex - 1]?.push(taskId);
220
+ }
221
+ break;
222
+ case GroupModificationType.MERGE_GROUP_DOWN:
223
+ if (groupIndex < currentTaskIds.length - 1) {
224
+ const taskId = currentGroup[taskIndex];
225
+ if (!taskId) break;
226
+ currentGroup.splice(taskIndex, 1);
227
+ const wasEmpty = 0 === currentGroup.length;
228
+ if (wasEmpty) currentTaskIds.splice(groupIndex, 1);
229
+ const nextGroupIndex = wasEmpty ? groupIndex : groupIndex + 1;
230
+ currentTaskIds[nextGroupIndex]?.push(taskId);
231
+ }
232
+ break;
233
+ case GroupModificationType.UNGROUP_ALL_TASKS:
234
+ currentTaskIds.splice(groupIndex, 1, ...currentGroup.map((id)=>[
235
+ id
236
+ ]));
237
+ break;
238
+ case GroupModificationType.SPLIT_GROUP:
239
+ {
240
+ const taskId = currentGroup[taskIndex];
241
+ if (!taskId) break;
242
+ currentGroup.splice(taskIndex, 1);
243
+ currentTaskIds.splice(groupIndex + 1, 0, [
244
+ taskId
245
+ ]);
246
+ break;
247
+ }
248
+ case GroupModificationType.REMOVE_GROUP:
249
+ currentTaskIds.splice(groupIndex, 1);
250
+ break;
251
+ case GroupModificationType.REMOVE_TASK:
252
+ currentGroup.splice(taskIndex, 1);
253
+ if (0 === currentGroup.length) currentTaskIds.splice(groupIndex, 1);
254
+ break;
255
+ }
256
+ return {
257
+ ...prev,
258
+ [stageId]: currentTaskIds
259
+ };
260
+ });
261
+ }, []);
262
+ const taskNodes = useMemo(()=>{
263
+ const allTaskNodes = [];
264
+ initialStages.forEach((stage)=>{
265
+ const stageTaskIdsArr = stageTaskIds[stage.id] || [];
266
+ const nodes = createTaskNodes({
267
+ stageId: stage.id,
268
+ taskIds: stageTaskIdsArr,
269
+ tasks,
270
+ stageWidth: stage.width || 304,
271
+ onTaskClick: (taskId)=>{
272
+ setSelectedTaskId(taskId);
273
+ setActionLog(`Selected: ${taskId}`);
274
+ },
275
+ onTaskSelect: setSelectedTaskId,
276
+ stageExecution: stage.execution?.stageStatus,
277
+ enableCrossStage: true,
278
+ onGroupModification: enableTaskMenu && !stage.isReadOnly ? handleGroupModification(stage.id) : void 0,
279
+ onRequestReplaceTask: enableReplaceTask && !stage.isReadOnly ? (groupIndex, taskIndex)=>setReplaceTargets((prev)=>({
280
+ ...prev,
281
+ [stage.id]: {
282
+ groupIndex,
283
+ taskIndex
273
284
  }
274
- }))
285
+ })) : ()=>{}
286
+ });
287
+ allTaskNodes.push(...nodes);
288
+ });
289
+ return allTaskNodes;
290
+ }, [
291
+ initialStages,
292
+ stageTaskIds,
293
+ tasks,
294
+ enableTaskMenu,
295
+ enableReplaceTask,
296
+ handleGroupModification
297
+ ]);
298
+ const allNodes = useMemo(()=>[
299
+ ...stageNodes,
300
+ ...taskNodes
301
+ ], [
302
+ stageNodes,
303
+ taskNodes
304
+ ]);
305
+ const [nodes, setNodes, onNodesChange] = useNodesState(allNodes);
306
+ const [edges, setEdges, onEdgesChange] = useEdgesState(initialEdges);
307
+ useEffect(()=>{
308
+ setNodes((prev)=>mergeNodes(prev, allNodes));
309
+ }, [
310
+ allNodes,
311
+ setNodes
312
+ ]);
313
+ const onConnect = useCallback((connection)=>{
314
+ setEdges((eds)=>addEdge({
315
+ ...connection,
316
+ type: 'stage'
317
+ }, eds));
318
+ }, [
319
+ setEdges
320
+ ]);
321
+ const nodeTypes = useMemo(()=>({
322
+ stage: StageNodeWrapper,
323
+ task: TaskNodeWrapper,
324
+ placeholder: (props)=>/*#__PURE__*/ jsx(PlaceholderTaskNode, {
325
+ ...props
326
+ })
327
+ }), []);
328
+ const edgeTypes = useMemo(()=>({
329
+ stage: StageEdge
330
+ }), []);
331
+ const handleTaskReorder = useCallback((params)=>{
332
+ const { taskId, stageId, position } = params;
333
+ const depthLabel = position.isParallel ? 'parallel' : 'sequential';
334
+ setActionLog(`Reordered ${taskId} to group ${position.groupIndex} (${depthLabel})`);
335
+ setStageTaskIds((prev)=>{
336
+ const currentTaskIds = prev[stageId || ''] || [];
337
+ const newTaskIds = moveTaskWithinStage(currentTaskIds, taskId, position);
338
+ return {
339
+ ...prev,
340
+ [stageId || '']: newTaskIds
341
+ };
342
+ });
343
+ }, []);
344
+ const handleTaskMove = useCallback((params)=>{
345
+ const { taskId, sourceStageId, targetStageId, position } = params;
346
+ setActionLog(`Moved ${taskId} from ${sourceStageId} to ${targetStageId} at group ${position.groupIndex}${position.isParallel ? ' (parallel)' : ''}`);
347
+ const taskInfo = tasks[taskId];
348
+ if (!taskInfo) return;
349
+ setStageTaskIds((prev)=>{
350
+ const sourceTaskIds = prev[sourceStageId] || [];
351
+ const targetTaskIds = prev[targetStageId] || [];
352
+ const { sourceTaskIds: newSourceTaskIds, targetTaskIds: newTargetTaskIds } = moveTaskBetweenStages(sourceTaskIds, targetTaskIds, taskId, position);
353
+ return {
354
+ ...prev,
355
+ [sourceStageId]: newSourceTaskIds,
356
+ [targetStageId]: newTargetTaskIds
357
+ };
358
+ });
359
+ }, [
360
+ tasks
361
+ ]);
362
+ const handleTaskCopy = useCallback((params)=>{
363
+ const { taskId, newTaskId, targetStageId, position } = params;
364
+ setActionLog(`Copied ${taskId} to ${newTaskId} in ${targetStageId} at group ${position.groupIndex}${position.isParallel ? ' (parallel)' : ''}`);
365
+ const taskInfo = tasks[taskId];
366
+ if (!taskInfo) return;
367
+ setTasks((prev)=>({
368
+ ...prev,
369
+ [newTaskId]: {
370
+ ...taskInfo,
371
+ label: `${taskInfo.label} (Copy)`
275
372
  }
276
- }
277
- ]
278
- },
279
- args: {}
373
+ }));
374
+ setStageTaskIds((prev)=>{
375
+ const targetTaskIds = prev[targetStageId] || [];
376
+ const newTargetTaskIds = insertTaskAtPosition(targetTaskIds, newTaskId, position);
377
+ return {
378
+ ...prev,
379
+ [targetStageId]: newTargetTaskIds
380
+ };
381
+ });
382
+ }, [
383
+ tasks
384
+ ]);
385
+ const handleTaskPaste = useCallback((params)=>{
386
+ const { newTaskId, originalData, targetStageId } = params;
387
+ setActionLog(`Pasted as ${newTaskId}`);
388
+ setTasks((prev)=>({
389
+ ...prev,
390
+ [newTaskId]: {
391
+ label: `${originalData.label} (Copy)`,
392
+ taskType: originalData.taskType,
393
+ icon: originalData.iconElement ?? /*#__PURE__*/ jsx(TaskIcon, {
394
+ type: TaskItemTypeValues.AgenticProcess,
395
+ size: "sm"
396
+ }),
397
+ execution: originalData.execution
398
+ }
399
+ }));
400
+ setStageTaskIds((prev)=>({
401
+ ...prev,
402
+ [targetStageId]: [
403
+ ...prev[targetStageId] || [],
404
+ [
405
+ newTaskId
406
+ ]
407
+ ]
408
+ }));
409
+ }, []);
410
+ return /*#__PURE__*/ jsx(ReactFlowProvider, {
411
+ children: /*#__PURE__*/ jsx(InteractiveCanvasInner, {
412
+ nodes: nodes,
413
+ edges: edges,
414
+ onNodesChange: onNodesChange,
415
+ onEdgesChange: onEdgesChange,
416
+ onConnect: onConnect,
417
+ nodeTypes: nodeTypes,
418
+ edgeTypes: edgeTypes,
419
+ onTaskReorder: handleTaskReorder,
420
+ onTaskMove: handleTaskMove,
421
+ onTaskCopy: handleTaskCopy,
422
+ onTaskPaste: handleTaskPaste,
423
+ selectedTaskId: selectedTaskId,
424
+ stageTaskIds: stageTaskIds,
425
+ actionLog: actionLog,
426
+ showInstructions: showInstructions
427
+ })
428
+ });
280
429
  };
281
- const WithTaskIcons = {
282
- name: 'With Task Icons',
283
- parameters: {
284
- nodes: [
285
- {
286
- id: '1',
287
- type: 'stage',
288
- position: {
289
- x: 48,
290
- y: 96
291
- },
292
- width: 304,
293
- data: {
294
- stageDetails: {
295
- label: 'Task Icons Demo',
296
- tasks: [
297
- [
298
- {
299
- id: 'human-task',
300
- label: 'Human in the Loop',
301
- icon: /*#__PURE__*/ jsx(TaskIcon, {
302
- type: TaskItemTypeValues.User,
303
- size: "sm"
304
- })
305
- }
306
- ],
307
- [
308
- {
309
- id: 'agent-task',
310
- label: 'Agent Task',
311
- icon: /*#__PURE__*/ jsx(TaskIcon, {
312
- type: TaskItemTypeValues.Agent,
313
- size: "sm"
314
- })
315
- },
316
- {
317
- id: 'external-agent-task',
318
- label: 'External Agent',
319
- icon: /*#__PURE__*/ jsx(TaskIcon, {
320
- type: TaskItemTypeValues.ExternalAgent,
321
- size: "sm"
322
- })
323
- }
324
- ],
325
- [
326
- {
327
- id: 'rpa-task',
328
- label: 'RPA Automation',
329
- icon: /*#__PURE__*/ jsx(TaskIcon, {
330
- type: TaskItemTypeValues.Automation,
331
- size: "sm"
332
- })
333
- },
334
- {
335
- id: 'api-task',
336
- label: 'API Automation',
337
- icon: /*#__PURE__*/ jsx(TaskIcon, {
338
- type: TaskItemTypeValues.ApiAutomation,
339
- size: "sm"
340
- })
341
- }
342
- ],
343
- [
344
- {
345
- id: 'process-task',
346
- label: 'Agentic Process',
347
- icon: /*#__PURE__*/ jsx(TaskIcon, {
348
- type: TaskItemTypeValues.AgenticProcess,
349
- size: "sm"
350
- })
430
+ const InteractiveCanvasInner = ({ nodes, edges, onNodesChange, onEdgesChange, onConnect, nodeTypes, edgeTypes, onTaskReorder, onTaskMove, onTaskCopy, onTaskPaste, selectedTaskId, stageTaskIds, actionLog, showInstructions })=>{
431
+ const { dragState, handlers } = useCrossStageTaskDrag({
432
+ onTaskReorder,
433
+ onTaskMove,
434
+ onTaskCopy
435
+ });
436
+ const selectedTaskStageId = useMemo(()=>{
437
+ if (!selectedTaskId) return null;
438
+ for (const [stageId, taskIds] of Object.entries(stageTaskIds))if (taskIds.flat().includes(selectedTaskId)) return stageId;
439
+ return null;
440
+ }, [
441
+ selectedTaskId,
442
+ stageTaskIds
443
+ ]);
444
+ useTaskCopyPaste({
445
+ onTaskPaste
446
+ }, {
447
+ selectedTaskId,
448
+ targetStageId: selectedTaskStageId || '',
449
+ targetTaskIds: stageTaskIds[selectedTaskStageId || ''] || [],
450
+ enabled: !!selectedTaskId
451
+ });
452
+ return /*#__PURE__*/ jsx(CrossStageDragProvider, {
453
+ value: {
454
+ dragState
455
+ },
456
+ children: /*#__PURE__*/ jsxs(BaseCanvas, {
457
+ nodes: nodes,
458
+ edges: edges,
459
+ onNodesChange: onNodesChange,
460
+ onEdgesChange: onEdgesChange,
461
+ onConnect: onConnect,
462
+ nodeTypes: nodeTypes,
463
+ edgeTypes: edgeTypes,
464
+ mode: "design",
465
+ connectionMode: ConnectionMode.Strict,
466
+ defaultEdgeOptions: {
467
+ type: 'stage'
468
+ },
469
+ connectionLineComponent: StageConnectionEdge,
470
+ elevateEdgesOnSelect: true,
471
+ onNodeDragStart: handlers.onNodeDragStart,
472
+ onNodeDrag: handlers.onNodeDrag,
473
+ onNodeDragStop: handlers.onNodeDragStop,
474
+ fitView: true,
475
+ children: [
476
+ /*#__PURE__*/ jsx(Panel, {
477
+ position: "bottom-right",
478
+ children: /*#__PURE__*/ jsx(CanvasPositionControls, {
479
+ translations: DefaultCanvasTranslations
480
+ })
481
+ }),
482
+ showInstructions && /*#__PURE__*/ jsx(Panel, {
483
+ position: "bottom-left",
484
+ children: /*#__PURE__*/ jsxs("div", {
485
+ style: {
486
+ background: 'var(--uix-palette-surface-paper)',
487
+ padding: '8px 16px',
488
+ borderRadius: '4px',
489
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)',
490
+ maxWidth: '300px'
491
+ },
492
+ children: [
493
+ /*#__PURE__*/ jsx("strong", {
494
+ children: "Instructions:"
495
+ }),
496
+ /*#__PURE__*/ jsxs("ul", {
497
+ style: {
498
+ margin: '8px 0',
499
+ paddingLeft: '16px',
500
+ fontSize: '12px'
351
501
  },
352
- {
353
- id: 'connector-task',
354
- label: 'Connector',
355
- icon: /*#__PURE__*/ jsx(TaskIcon, {
356
- type: TaskItemTypeValues.Connector,
357
- size: "sm"
502
+ children: [
503
+ /*#__PURE__*/ jsx("li", {
504
+ children: "Click a task to select it"
505
+ }),
506
+ /*#__PURE__*/ jsx("li", {
507
+ children: "Drag tasks to reorder"
508
+ }),
509
+ /*#__PURE__*/ jsx("li", {
510
+ children: "Ctrl/Cmd+C to copy selected task"
511
+ }),
512
+ /*#__PURE__*/ jsx("li", {
513
+ children: "Ctrl/Cmd+V to paste task"
358
514
  })
359
- }
360
- ],
361
- [
362
- {
363
- id: 'timer-task',
364
- label: 'Timer',
365
- icon: /*#__PURE__*/ jsx(TaskIcon, {
366
- type: TaskItemTypeValues.Timer,
367
- size: "sm"
368
- })
369
- }
370
- ]
515
+ ]
516
+ })
371
517
  ]
372
- }
373
- }
374
- }
375
- ]
376
- },
377
- args: {}
518
+ })
519
+ }),
520
+ actionLog && /*#__PURE__*/ jsx(Panel, {
521
+ position: "top-left",
522
+ children: /*#__PURE__*/ jsx("div", {
523
+ style: {
524
+ background: 'var(--uix-palette-surface-paper)',
525
+ padding: '8px 16px',
526
+ borderRadius: '4px',
527
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)'
528
+ },
529
+ children: actionLog
530
+ })
531
+ })
532
+ ]
533
+ })
534
+ });
378
535
  };
379
- const ExecutionStatus = {
380
- name: 'Execution Status',
381
- parameters: {
382
- nodes: [
383
- {
384
- id: '0',
385
- type: 'stage',
386
- position: {
387
- x: 48,
388
- y: 96
389
- },
390
- width: 304,
391
- data: {
392
- stageDetails: {
393
- sla: '1h',
394
- slaBreached: false,
395
- escalation: '1h',
396
- escalationsTriggered: false,
536
+ const Default = {
537
+ render: ()=>{
538
+ const tasks = {};
539
+ return /*#__PURE__*/ jsx("div", {
540
+ style: {
541
+ width: '100vw',
542
+ height: '100vh'
543
+ },
544
+ children: /*#__PURE__*/ jsx(InteractiveStageCanvas, {
545
+ stages: [
546
+ {
547
+ id: 'stage-1',
397
548
  label: 'Application',
398
- isReadOnly: true,
399
- tasks: [
400
- [
401
- {
402
- id: '1',
403
- label: 'KYC and AML Checks',
404
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
405
- }
406
- ],
407
- [
408
- {
409
- id: '2',
410
- label: 'Document Verification is going to be very very really long',
411
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
412
- }
413
- ]
414
- ]
549
+ taskIds: [],
550
+ position: {
551
+ x: 48,
552
+ y: 96
553
+ },
554
+ width: 304
415
555
  },
416
- execution: {
417
- stageStatus: {
418
- status: 'Completed',
419
- duration: 'SLA: 4h'
556
+ {
557
+ id: 'stage-2',
558
+ label: 'Processing with a really really really long label that might wrap',
559
+ taskIds: [],
560
+ position: {
561
+ x: 400,
562
+ y: 96
420
563
  },
421
- taskStatus: {
422
- 1: {
423
- status: 'Completed',
424
- label: 'KYC and AML Checks',
425
- duration: '2h 15m'
426
- },
427
- 2: {
428
- status: 'Completed',
429
- label: 'Document Verification',
430
- duration: '1h 45m'
431
- }
432
- }
564
+ width: 304
433
565
  }
434
- }
566
+ ],
567
+ tasks: tasks,
568
+ showInstructions: false,
569
+ onTaskAdd: ()=>window.alert('Add task functionality')
570
+ })
571
+ });
572
+ }
573
+ };
574
+ const WithTaskIcons = {
575
+ render: ()=>{
576
+ const tasks = {
577
+ 'agent-task': {
578
+ label: 'Agent Task',
579
+ taskType: 'uipath.case-management.agent',
580
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
581
+ type: TaskItemTypeValues.Agent,
582
+ size: "sm"
583
+ })
435
584
  },
436
- {
437
- id: '1',
438
- type: 'stage',
439
- position: {
440
- x: 400,
441
- y: 96
442
- },
443
- width: 304,
444
- data: {
445
- stageDetails: {
446
- sla: '1h',
447
- slaBreached: true,
448
- escalation: '1h',
449
- escalationsTriggered: true,
450
- label: 'Processing',
451
- isReadOnly: true,
452
- tasks: [
585
+ 'rpa-task': {
586
+ label: 'RPA Automation',
587
+ taskType: 'uipath.case-management.rpa',
588
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
589
+ type: TaskItemTypeValues.Automation,
590
+ size: "sm"
591
+ })
592
+ },
593
+ 'api-task': {
594
+ label: 'API Automation',
595
+ taskType: 'uipath.case-management.api-workflow',
596
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
597
+ type: TaskItemTypeValues.ApiAutomation,
598
+ size: "sm"
599
+ })
600
+ },
601
+ 'human-task': {
602
+ label: 'Human in the Loop',
603
+ taskType: 'uipath.case-management.run-human-action',
604
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
605
+ type: TaskItemTypeValues.User,
606
+ size: "sm"
607
+ })
608
+ },
609
+ 'process-task': {
610
+ label: 'Agentic Process',
611
+ taskType: 'uipath.case-management.process',
612
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
613
+ type: TaskItemTypeValues.AgenticProcess,
614
+ size: "sm"
615
+ })
616
+ }
617
+ };
618
+ return /*#__PURE__*/ jsx("div", {
619
+ style: {
620
+ width: '100vw',
621
+ height: '100vh'
622
+ },
623
+ children: /*#__PURE__*/ jsx(InteractiveStageCanvas, {
624
+ stages: [
625
+ {
626
+ id: 'stage-1',
627
+ label: 'Task Icons Demo',
628
+ taskIds: [
453
629
  [
454
- {
455
- id: '1',
456
- label: 'Liability Check',
457
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
458
- }
630
+ 'agent-task'
459
631
  ],
460
632
  [
461
- {
462
- id: '2',
463
- label: 'Credit Review',
464
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
465
- }
633
+ 'rpa-task'
466
634
  ],
467
635
  [
468
- {
469
- id: '3',
470
- label: 'Address Verification',
471
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
472
- },
473
- {
474
- id: '4',
475
- label: 'Property Verification',
476
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
477
- }
636
+ 'api-task'
637
+ ],
638
+ [
639
+ 'human-task'
478
640
  ],
479
641
  [
480
- {
481
- id: '5',
482
- label: 'Processing Review',
483
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
484
- }
642
+ 'process-task'
485
643
  ]
486
644
  ],
487
- selectedTasks: [
488
- '2'
489
- ]
490
- },
491
- execution: {
492
- stageStatus: {
493
- status: 'Completed',
494
- duration: 'SLA: 6h 15m'
645
+ position: {
646
+ x: 48,
647
+ y: 96
495
648
  },
496
- taskStatus: {
497
- 1: {
498
- status: 'Completed',
499
- label: 'Liability Check',
500
- duration: '1h 30m',
501
- retryDuration: '25m',
502
- badge: 'Reworked',
503
- badgeStatus: 'error',
504
- retryCount: 2
505
- },
506
- 2: {
507
- status: 'Completed',
508
- label: 'Credit Review',
509
- duration: '1h 30m',
510
- retryDuration: '32m',
511
- badge: 'Reworked',
512
- retryCount: 1
513
- },
514
- 3: {
515
- status: 'Completed',
516
- label: 'Address Verification',
517
- duration: '30m'
518
- },
519
- 4: {
520
- status: 'Completed',
521
- label: 'Property Verification',
522
- duration: '1h 30m',
523
- retryDuration: '1h 5m',
524
- badge: 'Reworked',
525
- retryCount: 3
526
- },
527
- 5: {
528
- status: 'Completed',
529
- label: 'Processing Review',
530
- duration: '1h 15m'
531
- }
532
- }
649
+ width: 304
533
650
  }
651
+ ],
652
+ tasks: tasks
653
+ })
654
+ });
655
+ }
656
+ };
657
+ const ExecutionStatus = {
658
+ render: ()=>{
659
+ const tasks = {
660
+ 's1-task-1': {
661
+ label: 'KYC and AML Checks',
662
+ taskType: 'uipath.case-management.rpa',
663
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
664
+ type: TaskItemTypeValues.Automation,
665
+ size: "sm"
666
+ }),
667
+ execution: {
668
+ status: 'Completed',
669
+ duration: '2h 15m'
534
670
  }
535
671
  },
536
- {
537
- id: '2',
538
- type: 'stage',
539
- position: {
540
- x: 752,
541
- y: 96
542
- },
543
- width: 304,
544
- data: {
545
- stageDetails: {
546
- label: 'Underwriting',
547
- isReadOnly: true,
548
- tasks: [
549
- [
550
- {
551
- id: '1',
552
- label: 'Report Ordering',
553
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
554
- }
555
- ],
556
- [
557
- {
558
- id: '2',
559
- label: 'Underwriting Verification',
560
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
561
- }
562
- ]
563
- ]
564
- },
565
- onTaskClick: (id)=>window.alert(`Task clicked: ${id}`),
566
- execution: {
567
- stageStatus: {
568
- status: 'InProgress',
569
- label: 'In progress',
570
- duration: 'SLA: 2h 15m'
571
- },
572
- taskStatus: {
573
- 1: {
574
- status: 'Completed',
575
- label: 'Report Ordering',
576
- duration: '2h 15m'
577
- },
578
- 2: {
579
- status: 'InProgress',
580
- label: 'Underwriting Verification'
581
- }
582
- }
583
- }
672
+ 's1-task-2': {
673
+ label: 'Document Verification is going to be very very really long',
674
+ taskType: 'uipath.case-management.process',
675
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
676
+ type: TaskItemTypeValues.AgenticProcess,
677
+ size: "sm"
678
+ }),
679
+ execution: {
680
+ status: 'Completed',
681
+ duration: '1h 45m'
584
682
  }
585
683
  },
586
- {
587
- id: '3',
588
- type: 'stage',
589
- position: {
590
- x: 1104,
591
- y: 96
592
- },
593
- width: 304,
594
- data: {
595
- stageDetails: {
596
- label: 'Closing',
597
- isReadOnly: true,
598
- tasks: [
599
- [
600
- {
601
- id: '1',
602
- label: 'Loan Packet Creation',
603
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
604
- }
605
- ],
606
- [
607
- {
608
- id: '2',
609
- label: 'Customer Signing',
610
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
611
- }
612
- ],
613
- [
614
- {
615
- id: '3',
616
- label: 'Generate Audit Report',
617
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
618
- }
619
- ]
620
- ]
621
- },
622
- execution: {
623
- stageStatus: {
624
- status: 'NotExecuted',
625
- label: 'Not started'
626
- },
627
- taskStatus: {}
628
- }
684
+ 's2-task-1': {
685
+ label: 'Liability Check',
686
+ taskType: 'uipath.case-management.rpa',
687
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
688
+ type: TaskItemTypeValues.Automation,
689
+ size: "sm"
690
+ }),
691
+ execution: {
692
+ status: 'Completed',
693
+ duration: '1h 30m',
694
+ retryDuration: '25m',
695
+ badge: 'Reworked',
696
+ badgeStatus: 'error',
697
+ retryCount: 2
629
698
  }
630
699
  },
631
- {
632
- id: '4',
633
- type: 'stage',
634
- position: {
635
- x: 1104,
636
- y: 400
637
- },
638
- width: 304,
639
- data: {
640
- stageDetails: {
641
- label: 'Rejected',
642
- isException: true,
643
- isReadOnly: true,
644
- tasks: [
645
- [
646
- {
647
- id: '1',
648
- label: 'Customer Notification',
649
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
650
- }
651
- ],
652
- [
653
- {
654
- id: '2',
655
- label: 'Generate Audit Report',
656
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
657
- }
658
- ]
659
- ]
660
- },
661
- execution: {
662
- stageStatus: {
663
- status: 'NotExecuted',
664
- label: 'Not started'
665
- },
666
- taskStatus: {}
667
- }
700
+ 's2-task-2': {
701
+ label: 'Credit Review',
702
+ taskType: 'uipath.case-management.process',
703
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
704
+ type: TaskItemTypeValues.AgenticProcess,
705
+ size: "sm"
706
+ }),
707
+ execution: {
708
+ status: 'Completed',
709
+ duration: '1h 30m',
710
+ retryDuration: '32m',
711
+ badge: 'Reworked',
712
+ retryCount: 1
713
+ }
714
+ },
715
+ 's2-task-3': {
716
+ label: 'Address Verification',
717
+ taskType: 'uipath.case-management.rpa',
718
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
719
+ type: TaskItemTypeValues.Automation,
720
+ size: "sm"
721
+ }),
722
+ execution: {
723
+ status: 'Completed',
724
+ duration: '30m'
725
+ }
726
+ },
727
+ 's2-task-4': {
728
+ label: 'Property Verification',
729
+ taskType: 'uipath.case-management.rpa',
730
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
731
+ type: TaskItemTypeValues.Automation,
732
+ size: "sm"
733
+ }),
734
+ execution: {
735
+ status: 'Completed',
736
+ duration: '1h 30m',
737
+ retryDuration: '1h 5m',
738
+ badge: 'Reworked',
739
+ retryCount: 3
740
+ }
741
+ },
742
+ 's2-task-5': {
743
+ label: 'Processing Review',
744
+ taskType: 'uipath.case-management.agent',
745
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
746
+ type: TaskItemTypeValues.Agent,
747
+ size: "sm"
748
+ }),
749
+ execution: {
750
+ status: 'Completed',
751
+ duration: '1h 15m'
752
+ }
753
+ },
754
+ 's3-task-1': {
755
+ label: 'Report Ordering',
756
+ taskType: 'uipath.case-management.process',
757
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
758
+ type: TaskItemTypeValues.AgenticProcess,
759
+ size: "sm"
760
+ }),
761
+ execution: {
762
+ status: 'Completed',
763
+ duration: '2h 15m'
764
+ }
765
+ },
766
+ 's3-task-2': {
767
+ label: 'Underwriting Verification',
768
+ taskType: 'uipath.case-management.rpa',
769
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
770
+ type: TaskItemTypeValues.Automation,
771
+ size: "sm"
772
+ }),
773
+ execution: {
774
+ status: 'InProgress'
775
+ }
776
+ },
777
+ 's4-task-1': {
778
+ label: 'Loan Packet Creation',
779
+ taskType: 'uipath.case-management.process',
780
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
781
+ type: TaskItemTypeValues.AgenticProcess,
782
+ size: "sm"
783
+ }),
784
+ execution: {
785
+ status: 'NotExecuted'
786
+ }
787
+ },
788
+ 's4-task-2': {
789
+ label: 'Customer Signing',
790
+ taskType: 'uipath.case-management.run-human-action',
791
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
792
+ type: TaskItemTypeValues.User,
793
+ size: "sm"
794
+ }),
795
+ execution: {
796
+ status: 'NotExecuted'
797
+ }
798
+ },
799
+ 's4-task-3': {
800
+ label: 'Generate Audit Report',
801
+ taskType: 'uipath.case-management.process',
802
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
803
+ type: TaskItemTypeValues.AgenticProcess,
804
+ size: "sm"
805
+ }),
806
+ execution: {
807
+ status: 'NotExecuted'
808
+ }
809
+ },
810
+ 'rejected-task-1': {
811
+ label: 'Customer Notification',
812
+ taskType: 'uipath.case-management.agent',
813
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
814
+ type: TaskItemTypeValues.Agent,
815
+ size: "sm"
816
+ }),
817
+ execution: {
818
+ status: 'NotExecuted'
819
+ }
820
+ },
821
+ 'rejected-task-2': {
822
+ label: 'Generate Audit Report',
823
+ taskType: 'uipath.case-management.process',
824
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
825
+ type: TaskItemTypeValues.AgenticProcess,
826
+ size: "sm"
827
+ }),
828
+ execution: {
829
+ status: 'NotExecuted'
668
830
  }
669
831
  }
670
- ],
671
- edges: [
832
+ };
833
+ const edges = [
672
834
  {
673
835
  id: 'e1',
674
836
  type: 'stage',
675
- source: '0',
676
- sourceHandle: '0____source____right',
677
- target: '1',
678
- targetHandle: '1____target____left'
837
+ source: 'stage-1',
838
+ sourceHandle: 'stage-1____source____right',
839
+ target: 'stage-2',
840
+ targetHandle: 'stage-2____target____left'
679
841
  },
680
842
  {
681
843
  id: 'e2',
682
844
  type: 'stage',
683
- source: '1',
684
- sourceHandle: '1____source____right',
685
- target: '2',
686
- targetHandle: '2____target____left'
845
+ source: 'stage-2',
846
+ sourceHandle: 'stage-2____source____right',
847
+ target: 'stage-3',
848
+ targetHandle: 'stage-3____target____left'
687
849
  },
688
850
  {
689
851
  id: 'e3',
690
852
  type: 'stage',
691
- source: '2',
692
- sourceHandle: '2____source____right',
693
- target: '3',
694
- targetHandle: '3____target____left'
853
+ source: 'stage-3',
854
+ sourceHandle: 'stage-3____source____right',
855
+ target: 'stage-4',
856
+ targetHandle: 'stage-4____target____left'
695
857
  }
696
- ]
697
- },
698
- args: {}
699
- };
700
- const InteractiveTaskManagement = {
701
- name: 'Interactive Task Management',
702
- parameters: {
703
- nodes: [
704
- {
705
- id: 'design-stage',
706
- type: 'stage',
707
- position: {
708
- x: 48,
709
- y: 96
710
- },
711
- width: 352,
712
- data: {
713
- stageDetails: {
714
- label: 'Design Mode - Editable',
715
- tasks: [
716
- [
717
- {
718
- id: '1',
719
- label: 'Initial Task',
720
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
721
- }
722
- ],
723
- [
724
- {
725
- id: '2',
726
- label: 'Credit Review with a very long label that will be truncated and show tooltip',
727
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
728
- }
729
- ],
858
+ ];
859
+ return /*#__PURE__*/ jsx("div", {
860
+ style: {
861
+ width: '100vw',
862
+ height: '100vh'
863
+ },
864
+ children: /*#__PURE__*/ jsx(InteractiveStageCanvas, {
865
+ stages: [
866
+ {
867
+ id: 'stage-1',
868
+ label: 'Application',
869
+ taskIds: [
730
870
  [
731
- {
732
- id: '3',
733
- label: 'Address Verification',
734
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
735
- },
736
- {
737
- id: '4',
738
- label: 'Property Verification with Long Name',
739
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
740
- },
741
- {
742
- id: '5',
743
- label: 'Background Check',
744
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
745
- }
871
+ 's1-task-1'
746
872
  ],
747
873
  [
748
- {
749
- id: '6',
750
- label: "Final Review Task with Extended Description",
751
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
752
- }
874
+ 's1-task-2'
753
875
  ]
754
- ]
755
- },
756
- onTaskClick: (taskId)=>{
757
- window.alert(`Task clicked: ${taskId}`);
758
- },
759
- onTaskRemove: (groupIndex, taskIndex)=>{
760
- window.alert(`Task removal requested!\nGroup: ${groupIndex}\nTask: ${taskIndex}\n\nIn a real app, this would remove the task from the data.`);
761
- },
762
- onTaskAdd: ()=>{
763
- window.alert('Add task functionality - this would open a dialog to add a new task');
764
- }
765
- }
766
- },
767
- {
768
- id: 'execution-stage',
769
- type: 'stage',
770
- position: {
771
- x: 448,
772
- y: 96
773
- },
774
- width: 352,
775
- data: {
776
- stageDetails: {
777
- label: 'Execution Mode - Read Only',
876
+ ],
877
+ position: {
878
+ x: 48,
879
+ y: 96
880
+ },
881
+ width: 304,
778
882
  isReadOnly: true,
779
- tasks: [
883
+ execution: {
884
+ stageStatus: {
885
+ status: 'Completed',
886
+ duration: 'SLA: 4h'
887
+ },
888
+ taskStatus: {}
889
+ }
890
+ },
891
+ {
892
+ id: 'stage-2',
893
+ label: 'Processing',
894
+ taskIds: [
780
895
  [
781
- {
782
- id: '1',
783
- label: 'Task with execution status and very long name that will be truncated',
784
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
785
- }
896
+ 's2-task-1'
786
897
  ],
787
898
  [
788
- {
789
- id: '2',
790
- label: 'Credit Review Processing',
791
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
792
- }
899
+ 's2-task-2'
793
900
  ],
794
901
  [
795
- {
796
- id: '3',
797
- label: 'Parallel Address Verification Task',
798
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
799
- },
800
- {
801
- id: '4',
802
- label: 'Parallel Property Verification with Extended Name',
803
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
804
- }
902
+ 's2-task-3',
903
+ 's2-task-4'
805
904
  ],
806
905
  [
807
- {
808
- id: '5',
809
- label: 'Final Review and Approval Process',
810
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
811
- }
906
+ 's2-task-5'
812
907
  ]
813
- ]
814
- },
815
- execution: {
816
- stageStatus: {
817
- status: 'InProgress',
818
- label: 'In progress',
819
- duration: '2h 15m'
908
+ ],
909
+ position: {
910
+ x: 400,
911
+ y: 96
820
912
  },
821
- taskStatus: {
822
- 1: {
823
- status: 'Completed',
824
- duration: '30m',
825
- badge: 'Completed',
826
- badgeStatus: 'info'
827
- },
828
- 2: {
829
- status: 'InProgress',
830
- duration: '1h 15m',
831
- retryDuration: '15m',
832
- badge: 'Retry',
833
- badgeStatus: 'warning',
834
- retryCount: 2
835
- },
836
- 3: {
913
+ width: 304,
914
+ isReadOnly: true,
915
+ execution: {
916
+ stageStatus: {
837
917
  status: 'Completed',
838
- duration: '45m'
918
+ duration: 'SLA: 6h 15m'
839
919
  },
840
- 4: {
841
- status: 'Failed',
842
- duration: '20m',
843
- retryDuration: '10m',
844
- badge: 'Error',
845
- badgeStatus: 'error',
846
- retryCount: 1
847
- },
848
- 5: {
849
- status: 'NotExecuted'
850
- }
920
+ taskStatus: {}
851
921
  }
852
922
  },
853
- onTaskClick: (taskId)=>{
854
- window.alert(`Task clicked: ${taskId} (execution mode - read only)`);
855
- }
856
- }
857
- }
858
- ]
859
- },
860
- args: {}
861
- };
862
- const LoanProcessingWorkflow = {
863
- name: 'Loan Processing Workflow',
864
- parameters: {
865
- nodes: [
866
- {
867
- id: 'application',
868
- type: 'stage',
869
- position: {
870
- x: 48,
871
- y: 96
872
- },
873
- width: 304,
874
- data: {
875
- stageDetails: {
876
- label: 'Application',
877
- tasks: [
923
+ {
924
+ id: 'stage-3',
925
+ label: 'Underwriting',
926
+ taskIds: [
878
927
  [
879
- {
880
- id: '1',
881
- label: 'KYC and AML Checks',
882
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
883
- }
928
+ 's3-task-1'
884
929
  ],
885
930
  [
886
- {
887
- id: '2',
888
- label: 'Document Verification',
889
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
890
- }
931
+ 's3-task-2'
891
932
  ]
892
933
  ],
893
- selectedTasks: [
894
- '1'
895
- ]
896
- }
897
- }
898
- },
899
- {
900
- id: 'processing',
901
- type: 'stage',
902
- position: {
903
- x: 448,
904
- y: 96
905
- },
906
- width: 304,
907
- data: {
908
- stageDetails: {
909
- label: 'Processing',
910
- tasks: [
934
+ position: {
935
+ x: 752,
936
+ y: 96
937
+ },
938
+ width: 304,
939
+ isReadOnly: true,
940
+ execution: {
941
+ stageStatus: {
942
+ status: 'InProgress',
943
+ label: 'In progress',
944
+ duration: 'SLA: 2h 15m'
945
+ },
946
+ taskStatus: {}
947
+ }
948
+ },
949
+ {
950
+ id: 'stage-4',
951
+ label: 'Closing',
952
+ taskIds: [
911
953
  [
912
- {
913
- id: '1',
914
- label: 'Liability Check',
915
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
916
- }
954
+ 's4-task-1'
917
955
  ],
918
956
  [
919
- {
920
- id: '2',
921
- label: 'Credit Review',
922
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
923
- }
957
+ 's4-task-2'
924
958
  ],
925
959
  [
926
- {
927
- id: '3',
928
- label: 'Address Verification',
929
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
930
- },
931
- {
932
- id: '4',
933
- label: 'Property Verification',
934
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
935
- }
960
+ 's4-task-3'
961
+ ]
962
+ ],
963
+ position: {
964
+ x: 1104,
965
+ y: 96
966
+ },
967
+ width: 304,
968
+ isReadOnly: true,
969
+ execution: {
970
+ stageStatus: {
971
+ status: 'NotExecuted',
972
+ label: 'Not started'
973
+ },
974
+ taskStatus: {}
975
+ }
976
+ },
977
+ {
978
+ id: 'rejected',
979
+ label: 'Rejected',
980
+ taskIds: [
981
+ [
982
+ 'rejected-task-1'
936
983
  ],
937
984
  [
938
- {
939
- id: '5',
940
- label: 'Processing Review',
941
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
942
- }
985
+ 'rejected-task-2'
943
986
  ]
944
987
  ],
945
- selectedTasks: [
946
- '4'
947
- ]
988
+ position: {
989
+ x: 1104,
990
+ y: 400
991
+ },
992
+ width: 304,
993
+ isException: true,
994
+ isReadOnly: true,
995
+ execution: {
996
+ stageStatus: {
997
+ status: 'NotExecuted',
998
+ label: 'Not started'
999
+ },
1000
+ taskStatus: {}
1001
+ }
948
1002
  }
1003
+ ],
1004
+ tasks: tasks,
1005
+ edges: edges,
1006
+ showInstructions: false
1007
+ })
1008
+ });
1009
+ }
1010
+ };
1011
+ const InteractiveTaskManagement = {
1012
+ render: ()=>{
1013
+ const tasks = {
1014
+ 'task-1': {
1015
+ label: 'Initial Task',
1016
+ taskType: 'uipath.case-management.rpa',
1017
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1018
+ type: TaskItemTypeValues.Automation,
1019
+ size: "sm"
1020
+ })
1021
+ },
1022
+ 'task-2': {
1023
+ label: 'Credit Review with a very long label that will be truncated and show tooltip',
1024
+ taskType: 'uipath.case-management.process',
1025
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1026
+ type: TaskItemTypeValues.AgenticProcess,
1027
+ size: "sm"
1028
+ })
1029
+ },
1030
+ 'task-3': {
1031
+ label: 'Address Verification',
1032
+ taskType: 'uipath.case-management.rpa',
1033
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1034
+ type: TaskItemTypeValues.Automation,
1035
+ size: "sm"
1036
+ })
1037
+ },
1038
+ 'task-4': {
1039
+ label: 'Property Verification with Long Name',
1040
+ taskType: 'uipath.case-management.rpa',
1041
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1042
+ type: TaskItemTypeValues.Automation,
1043
+ size: "sm"
1044
+ })
1045
+ },
1046
+ 'task-5': {
1047
+ label: 'Background Check',
1048
+ taskType: 'uipath.case-management.agent',
1049
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1050
+ type: TaskItemTypeValues.Agent,
1051
+ size: "sm"
1052
+ })
1053
+ },
1054
+ 'task-6': {
1055
+ label: "Final Review Task with Extended Description",
1056
+ taskType: 'uipath.case-management.agent',
1057
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1058
+ type: TaskItemTypeValues.Agent,
1059
+ size: "sm"
1060
+ })
1061
+ },
1062
+ 'exec-task-1': {
1063
+ label: 'Task with execution status and very long name that will be truncated',
1064
+ taskType: 'uipath.case-management.rpa',
1065
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1066
+ type: TaskItemTypeValues.Automation,
1067
+ size: "sm"
1068
+ }),
1069
+ execution: {
1070
+ status: 'Completed',
1071
+ duration: '30m',
1072
+ badge: 'Completed',
1073
+ badgeStatus: 'info'
949
1074
  }
950
1075
  },
951
- {
952
- id: 'underwriting',
953
- type: 'stage',
954
- position: {
955
- x: 848,
956
- y: 96
957
- },
958
- width: 304,
959
- data: {
960
- stageDetails: {
961
- label: 'Underwriting',
962
- tasks: [
963
- [
964
- {
965
- id: '1',
966
- label: 'Report Ordering',
967
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
968
- }
969
- ],
970
- [
971
- {
972
- id: '2',
973
- label: 'Underwriting Verification',
974
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
975
- }
976
- ]
977
- ]
978
- }
1076
+ 'exec-task-2': {
1077
+ label: 'Credit Review Processing',
1078
+ taskType: 'uipath.case-management.process',
1079
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1080
+ type: TaskItemTypeValues.AgenticProcess,
1081
+ size: "sm"
1082
+ }),
1083
+ execution: {
1084
+ status: 'InProgress',
1085
+ duration: '1h 15m',
1086
+ retryDuration: '15m',
1087
+ badge: 'Retry',
1088
+ badgeStatus: 'warning',
1089
+ retryCount: 2
979
1090
  }
980
1091
  },
981
- {
982
- id: 'closing',
983
- type: 'stage',
984
- position: {
985
- x: 1248,
986
- y: 96
987
- },
988
- width: 304,
989
- data: {
990
- stageDetails: {
991
- label: 'Closing',
992
- tasks: [
1092
+ 'exec-task-3': {
1093
+ label: 'Parallel Address Verification Task',
1094
+ taskType: 'uipath.case-management.rpa',
1095
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1096
+ type: TaskItemTypeValues.Automation,
1097
+ size: "sm"
1098
+ }),
1099
+ execution: {
1100
+ status: 'Completed',
1101
+ duration: '45m'
1102
+ }
1103
+ },
1104
+ 'exec-task-4': {
1105
+ label: 'Parallel Property Verification with Extended Name',
1106
+ taskType: 'uipath.case-management.rpa',
1107
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1108
+ type: TaskItemTypeValues.Automation,
1109
+ size: "sm"
1110
+ }),
1111
+ execution: {
1112
+ status: 'Failed',
1113
+ duration: '20m',
1114
+ retryDuration: '10m',
1115
+ badge: 'Error',
1116
+ badgeStatus: 'error',
1117
+ retryCount: 1
1118
+ }
1119
+ },
1120
+ 'exec-task-5': {
1121
+ label: 'Final Review and Approval Process',
1122
+ taskType: 'uipath.case-management.agent',
1123
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1124
+ type: TaskItemTypeValues.Agent,
1125
+ size: "sm"
1126
+ }),
1127
+ execution: {
1128
+ status: 'NotExecuted'
1129
+ }
1130
+ }
1131
+ };
1132
+ return /*#__PURE__*/ jsx("div", {
1133
+ style: {
1134
+ width: '100vw',
1135
+ height: '100vh'
1136
+ },
1137
+ children: /*#__PURE__*/ jsx(InteractiveStageCanvas, {
1138
+ stages: [
1139
+ {
1140
+ id: 'design-stage',
1141
+ label: 'Design Mode - Editable',
1142
+ taskIds: [
993
1143
  [
994
- {
995
- id: '1',
996
- label: 'Loan Packet Creation',
997
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
998
- }
1144
+ 'task-1'
999
1145
  ],
1000
1146
  [
1001
- {
1002
- id: '2',
1003
- label: 'Customer Signing',
1004
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
1005
- }
1147
+ 'task-2'
1006
1148
  ],
1007
1149
  [
1008
- {
1009
- id: '3',
1010
- label: 'Generate Audit Report',
1011
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
1012
- }
1013
- ]
1014
- ]
1015
- }
1016
- }
1017
- },
1018
- {
1019
- id: 'funding',
1020
- type: 'stage',
1021
- position: {
1022
- x: 1648,
1023
- y: 96
1024
- },
1025
- width: 304,
1026
- data: {
1027
- stageDetails: {
1028
- label: 'Funding',
1029
- tasks: [
1030
- [
1031
- {
1032
- id: '1',
1033
- label: 'Disperse Loan',
1034
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
1035
- }
1150
+ 'task-3',
1151
+ 'task-4',
1152
+ 'task-5'
1036
1153
  ],
1037
1154
  [
1038
- {
1039
- id: '2',
1040
- label: 'Generate Audit Report',
1041
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
1042
- }
1155
+ 'task-6'
1043
1156
  ]
1044
- ]
1045
- }
1046
- }
1047
- },
1048
- {
1049
- id: 'rejected',
1050
- type: 'stage',
1051
- position: {
1052
- x: 1248,
1053
- y: 400
1054
- },
1055
- width: 304,
1056
- data: {
1057
- stageDetails: {
1058
- label: 'Rejected',
1059
- isException: true,
1060
- tasks: [
1157
+ ],
1158
+ position: {
1159
+ x: 48,
1160
+ y: 96
1161
+ },
1162
+ width: 352
1163
+ },
1164
+ {
1165
+ id: 'execution-stage',
1166
+ label: 'Execution Mode - Read Only',
1167
+ taskIds: [
1061
1168
  [
1062
- {
1063
- id: '1',
1064
- label: 'Customer Notification',
1065
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
1066
- }
1169
+ 'exec-task-1'
1067
1170
  ],
1068
1171
  [
1069
- {
1070
- id: '2',
1071
- label: 'Generate Audit Report',
1072
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
1073
- }
1074
- ]
1075
- ]
1076
- }
1077
- }
1078
- },
1079
- {
1080
- id: 'withdrawn',
1081
- type: 'stage',
1082
- position: {
1083
- x: 448,
1084
- y: 608
1085
- },
1086
- width: 304,
1087
- data: {
1088
- stageDetails: {
1089
- label: 'Withdrawn',
1090
- isException: true,
1091
- tasks: [
1172
+ 'exec-task-2'
1173
+ ],
1092
1174
  [
1093
- {
1094
- id: '1',
1095
- label: 'Customer Notification',
1096
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
1097
- }
1175
+ 'exec-task-3',
1176
+ 'exec-task-4'
1098
1177
  ],
1099
1178
  [
1100
- {
1101
- id: '2',
1102
- label: 'Generate Audit Report',
1103
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
1104
- }
1179
+ 'exec-task-5'
1105
1180
  ]
1106
- ]
1181
+ ],
1182
+ position: {
1183
+ x: 448,
1184
+ y: 96
1185
+ },
1186
+ width: 352,
1187
+ isReadOnly: true,
1188
+ execution: {
1189
+ stageStatus: {
1190
+ status: 'InProgress',
1191
+ label: 'In progress',
1192
+ duration: '2h 15m'
1193
+ },
1194
+ taskStatus: {}
1195
+ }
1107
1196
  }
1108
- }
1197
+ ],
1198
+ tasks: tasks
1199
+ })
1200
+ });
1201
+ }
1202
+ };
1203
+ const LoanProcessingWorkflow = {
1204
+ render: ()=>{
1205
+ const tasks = {
1206
+ 'app-task-1': {
1207
+ label: 'KYC and AML Checks',
1208
+ taskType: 'uipath.case-management.rpa',
1209
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1210
+ type: TaskItemTypeValues.Automation,
1211
+ size: "sm"
1212
+ })
1213
+ },
1214
+ 'app-task-2': {
1215
+ label: 'Document Verification',
1216
+ taskType: 'uipath.case-management.process',
1217
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1218
+ type: TaskItemTypeValues.AgenticProcess,
1219
+ size: "sm"
1220
+ })
1221
+ },
1222
+ 'proc-task-1': {
1223
+ label: 'Liability Check',
1224
+ taskType: 'uipath.case-management.rpa',
1225
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1226
+ type: TaskItemTypeValues.Automation,
1227
+ size: "sm"
1228
+ })
1229
+ },
1230
+ 'proc-task-2': {
1231
+ label: 'Credit Review',
1232
+ taskType: 'uipath.case-management.process',
1233
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1234
+ type: TaskItemTypeValues.AgenticProcess,
1235
+ size: "sm"
1236
+ })
1237
+ },
1238
+ 'proc-task-3': {
1239
+ label: 'Address Verification',
1240
+ taskType: 'uipath.case-management.rpa',
1241
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1242
+ type: TaskItemTypeValues.Automation,
1243
+ size: "sm"
1244
+ })
1245
+ },
1246
+ 'proc-task-4': {
1247
+ label: 'Property Verification',
1248
+ taskType: 'uipath.case-management.rpa',
1249
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1250
+ type: TaskItemTypeValues.Automation,
1251
+ size: "sm"
1252
+ })
1253
+ },
1254
+ 'proc-task-5': {
1255
+ label: 'Processing Review',
1256
+ taskType: 'uipath.case-management.agent',
1257
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1258
+ type: TaskItemTypeValues.Agent,
1259
+ size: "sm"
1260
+ })
1261
+ },
1262
+ 'uw-task-1': {
1263
+ label: 'Report Ordering',
1264
+ taskType: 'uipath.case-management.process',
1265
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1266
+ type: TaskItemTypeValues.AgenticProcess,
1267
+ size: "sm"
1268
+ })
1269
+ },
1270
+ 'uw-task-2': {
1271
+ label: 'Underwriting Verification',
1272
+ taskType: 'uipath.case-management.rpa',
1273
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1274
+ type: TaskItemTypeValues.Automation,
1275
+ size: "sm"
1276
+ })
1277
+ },
1278
+ 'close-task-1': {
1279
+ label: 'Loan Packet Creation',
1280
+ taskType: 'uipath.case-management.process',
1281
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1282
+ type: TaskItemTypeValues.AgenticProcess,
1283
+ size: "sm"
1284
+ })
1285
+ },
1286
+ 'close-task-2': {
1287
+ label: 'Customer Signing',
1288
+ taskType: 'uipath.case-management.run-human-action',
1289
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1290
+ type: TaskItemTypeValues.User,
1291
+ size: "sm"
1292
+ })
1293
+ },
1294
+ 'close-task-3': {
1295
+ label: 'Generate Audit Report',
1296
+ taskType: 'uipath.case-management.process',
1297
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1298
+ type: TaskItemTypeValues.AgenticProcess,
1299
+ size: "sm"
1300
+ })
1301
+ },
1302
+ 'fund-task-1': {
1303
+ label: 'Disperse Loan',
1304
+ taskType: 'uipath.case-management.agent',
1305
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1306
+ type: TaskItemTypeValues.Agent,
1307
+ size: "sm"
1308
+ })
1309
+ },
1310
+ 'fund-task-2': {
1311
+ label: 'Generate Audit Report',
1312
+ taskType: 'uipath.case-management.process',
1313
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1314
+ type: TaskItemTypeValues.AgenticProcess,
1315
+ size: "sm"
1316
+ })
1317
+ },
1318
+ 'reject-task-1': {
1319
+ label: 'Customer Notification',
1320
+ taskType: 'uipath.case-management.agent',
1321
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1322
+ type: TaskItemTypeValues.Agent,
1323
+ size: "sm"
1324
+ })
1325
+ },
1326
+ 'reject-task-2': {
1327
+ label: 'Generate Audit Report',
1328
+ taskType: 'uipath.case-management.process',
1329
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1330
+ type: TaskItemTypeValues.AgenticProcess,
1331
+ size: "sm"
1332
+ })
1333
+ },
1334
+ 'withdraw-task-1': {
1335
+ label: 'Customer Notification',
1336
+ taskType: 'uipath.case-management.agent',
1337
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1338
+ type: TaskItemTypeValues.Agent,
1339
+ size: "sm"
1340
+ })
1341
+ },
1342
+ 'withdraw-task-2': {
1343
+ label: 'Generate Audit Report',
1344
+ taskType: 'uipath.case-management.process',
1345
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1346
+ type: TaskItemTypeValues.AgenticProcess,
1347
+ size: "sm"
1348
+ })
1109
1349
  }
1110
- ],
1111
- edges: [
1350
+ };
1351
+ const edges = [
1112
1352
  {
1113
1353
  id: 'e1',
1114
1354
  type: 'stage',
@@ -1141,394 +1381,580 @@ const LoanProcessingWorkflow = {
1141
1381
  target: 'funding',
1142
1382
  targetHandle: 'funding____target____left'
1143
1383
  }
1144
- ]
1145
- },
1146
- args: {}
1147
- };
1148
- const initialTasks = [
1149
- [
1150
- {
1151
- id: 'task-1',
1152
- label: 'KYC Verification',
1153
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
1154
- }
1155
- ],
1156
- [
1157
- {
1158
- id: 'task-2',
1159
- label: 'Document Review',
1160
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
1161
- },
1162
- {
1163
- id: 'task-6',
1164
- label: 'Credit Check',
1165
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
1166
- }
1167
- ],
1168
- [
1169
- {
1170
- id: 'task-3',
1171
- label: 'Address Check',
1172
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
1173
- },
1174
- {
1175
- id: 'task-4',
1176
- label: 'Property Check',
1177
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
1178
- }
1179
- ],
1180
- [
1181
- {
1182
- id: 'task-5',
1183
- label: 'Final Approval',
1184
- icon: /*#__PURE__*/ jsx(ProcessIcon, {})
1185
- }
1186
- ]
1187
- ];
1188
- const DraggableTaskReorderingStory = ()=>{
1189
- const StageNodeWrapper = useMemo(()=>function(props) {
1190
- return /*#__PURE__*/ jsx(StageNode, {
1191
- ...props,
1192
- ...props.data
1193
- });
1194
- }, []);
1195
- const nodeTypes = useMemo(()=>({
1196
- stage: StageNodeWrapper
1197
- }), [
1198
- StageNodeWrapper
1199
- ]);
1200
- const edgeTypes = useMemo(()=>({
1201
- stage: StageEdge
1202
- }), []);
1203
- const [nodes, setNodes, onNodesChange] = useNodesState([
1204
- {
1205
- id: 'reorder-stage',
1206
- type: 'stage',
1207
- position: {
1208
- x: 320,
1209
- y: 96
1384
+ ];
1385
+ return /*#__PURE__*/ jsx("div", {
1386
+ style: {
1387
+ width: '100vw',
1388
+ height: '100vh'
1210
1389
  },
1211
- data: {
1212
- stageDetails: {
1213
- label: 'Drag to Reorder Tasks',
1214
- tasks: initialTasks
1215
- },
1216
- onTaskClick: (taskId)=>console.log('Task clicked:', taskId)
1217
- }
1218
- }
1219
- ]);
1220
- const [edges, setEdges, onEdgesChange] = useEdgesState([]);
1221
- const handleTaskReorder = useCallback((reorderedTasks)=>{
1222
- setNodes((nds)=>nds.map((node)=>'reorder-stage' === node.id ? {
1223
- ...node,
1224
- data: {
1225
- ...node.data,
1226
- stageDetails: {
1227
- ...node.data.stageDetails,
1228
- tasks: reorderedTasks
1229
- }
1230
- }
1231
- } : node));
1232
- }, [
1233
- setNodes
1234
- ]);
1235
- const nodesWithHandler = useMemo(()=>nodes.map((node)=>({
1236
- ...node,
1237
- data: {
1238
- ...node.data,
1239
- onTaskReorder: handleTaskReorder
1240
- }
1241
- })), [
1242
- nodes,
1243
- handleTaskReorder
1244
- ]);
1245
- const onConnect = useCallback((connection)=>setEdges((eds)=>addEdge(connection, eds)), [
1246
- setEdges
1247
- ]);
1248
- return /*#__PURE__*/ jsx("div", {
1249
- style: {
1250
- width: '100vw',
1251
- height: '100vh'
1252
- },
1253
- children: /*#__PURE__*/ jsx(ReactFlowProvider, {
1254
- children: /*#__PURE__*/ jsx(BaseCanvas, {
1255
- nodes: nodesWithHandler,
1256
- edges: edges,
1257
- onNodesChange: onNodesChange,
1258
- onEdgesChange: onEdgesChange,
1259
- onConnect: onConnect,
1260
- nodeTypes: nodeTypes,
1261
- edgeTypes: edgeTypes,
1262
- mode: "design",
1263
- connectionMode: ConnectionMode.Strict,
1264
- defaultEdgeOptions: {
1265
- type: 'stage'
1266
- },
1267
- connectionLineComponent: StageConnectionEdge,
1268
- elevateEdgesOnSelect: true,
1269
- defaultViewport: {
1270
- x: 0,
1271
- y: 0,
1272
- zoom: 1.5
1273
- },
1274
- children: /*#__PURE__*/ jsx(Panel, {
1275
- position: "bottom-right",
1276
- children: /*#__PURE__*/ jsx(CanvasPositionControls, {
1277
- translations: DefaultCanvasTranslations
1278
- })
1390
+ children: /*#__PURE__*/ jsx(InteractiveStageCanvas, {
1391
+ stages: [
1392
+ {
1393
+ id: 'application',
1394
+ label: 'Application',
1395
+ taskIds: [
1396
+ [
1397
+ 'app-task-1'
1398
+ ],
1399
+ [
1400
+ 'app-task-2'
1401
+ ]
1402
+ ],
1403
+ position: {
1404
+ x: 48,
1405
+ y: 96
1406
+ },
1407
+ width: 304
1408
+ },
1409
+ {
1410
+ id: 'processing',
1411
+ label: 'Processing',
1412
+ taskIds: [
1413
+ [
1414
+ 'proc-task-1'
1415
+ ],
1416
+ [
1417
+ 'proc-task-2'
1418
+ ],
1419
+ [
1420
+ 'proc-task-3',
1421
+ 'proc-task-4'
1422
+ ],
1423
+ [
1424
+ 'proc-task-5'
1425
+ ]
1426
+ ],
1427
+ position: {
1428
+ x: 448,
1429
+ y: 96
1430
+ },
1431
+ width: 304
1432
+ },
1433
+ {
1434
+ id: 'underwriting',
1435
+ label: 'Underwriting',
1436
+ taskIds: [
1437
+ [
1438
+ 'uw-task-1'
1439
+ ],
1440
+ [
1441
+ 'uw-task-2'
1442
+ ]
1443
+ ],
1444
+ position: {
1445
+ x: 848,
1446
+ y: 96
1447
+ },
1448
+ width: 304
1449
+ },
1450
+ {
1451
+ id: 'closing',
1452
+ label: 'Closing',
1453
+ taskIds: [
1454
+ [
1455
+ 'close-task-1'
1456
+ ],
1457
+ [
1458
+ 'close-task-2'
1459
+ ],
1460
+ [
1461
+ 'close-task-3'
1462
+ ]
1463
+ ],
1464
+ position: {
1465
+ x: 1248,
1466
+ y: 96
1467
+ },
1468
+ width: 304
1469
+ },
1470
+ {
1471
+ id: 'funding',
1472
+ label: 'Funding',
1473
+ taskIds: [
1474
+ [
1475
+ 'fund-task-1'
1476
+ ],
1477
+ [
1478
+ 'fund-task-2'
1479
+ ]
1480
+ ],
1481
+ position: {
1482
+ x: 1648,
1483
+ y: 96
1484
+ },
1485
+ width: 304
1486
+ },
1487
+ {
1488
+ id: 'rejected',
1489
+ label: 'Rejected',
1490
+ taskIds: [
1491
+ [
1492
+ 'reject-task-1'
1493
+ ],
1494
+ [
1495
+ 'reject-task-2'
1496
+ ]
1497
+ ],
1498
+ position: {
1499
+ x: 1248,
1500
+ y: 400
1501
+ },
1502
+ width: 304,
1503
+ isException: true
1504
+ },
1505
+ {
1506
+ id: 'withdrawn',
1507
+ label: 'Withdrawn',
1508
+ taskIds: [
1509
+ [
1510
+ 'withdraw-task-1'
1511
+ ],
1512
+ [
1513
+ 'withdraw-task-2'
1514
+ ]
1515
+ ],
1516
+ position: {
1517
+ x: 448,
1518
+ y: 608
1519
+ },
1520
+ width: 304,
1521
+ isException: true
1522
+ }
1523
+ ],
1524
+ tasks: tasks,
1525
+ edges: edges
1526
+ })
1527
+ });
1528
+ }
1529
+ };
1530
+ const WithTaskMenu = {
1531
+ render: ()=>{
1532
+ const tasks = {
1533
+ 'task-1': {
1534
+ label: 'Initial Review',
1535
+ taskType: 'uipath.case-management.process',
1536
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1537
+ type: TaskItemTypeValues.AgenticProcess,
1538
+ size: "sm"
1539
+ })
1540
+ },
1541
+ 'task-2': {
1542
+ label: 'Document Verification',
1543
+ taskType: 'uipath.case-management.rpa',
1544
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1545
+ type: TaskItemTypeValues.Automation,
1546
+ size: "sm"
1547
+ })
1548
+ },
1549
+ 'task-3': {
1550
+ label: 'Address Check',
1551
+ taskType: 'uipath.case-management.rpa',
1552
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1553
+ type: TaskItemTypeValues.Automation,
1554
+ size: "sm"
1555
+ })
1556
+ },
1557
+ 'task-4': {
1558
+ label: 'Background Check',
1559
+ taskType: 'uipath.case-management.agent',
1560
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1561
+ type: TaskItemTypeValues.Agent,
1562
+ size: "sm"
1563
+ })
1564
+ },
1565
+ 'task-5': {
1566
+ label: 'Credit Check',
1567
+ taskType: 'uipath.case-management.rpa',
1568
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1569
+ type: TaskItemTypeValues.Automation,
1570
+ size: "sm"
1279
1571
  })
1572
+ },
1573
+ 'task-6': {
1574
+ label: 'Final Approval',
1575
+ taskType: 'uipath.case-management.run-human-action',
1576
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1577
+ type: TaskItemTypeValues.User,
1578
+ size: "sm"
1579
+ })
1580
+ }
1581
+ };
1582
+ return /*#__PURE__*/ jsx("div", {
1583
+ style: {
1584
+ width: '100vw',
1585
+ height: '100vh'
1586
+ },
1587
+ children: /*#__PURE__*/ jsx(InteractiveStageCanvas, {
1588
+ stages: [
1589
+ {
1590
+ id: 'stage-1',
1591
+ label: 'Task Menu Demo',
1592
+ taskIds: [
1593
+ [
1594
+ 'task-1'
1595
+ ],
1596
+ [
1597
+ 'task-2'
1598
+ ],
1599
+ [
1600
+ 'task-3',
1601
+ 'task-4',
1602
+ 'task-5'
1603
+ ],
1604
+ [
1605
+ 'task-6'
1606
+ ]
1607
+ ],
1608
+ position: {
1609
+ x: 48,
1610
+ y: 96
1611
+ },
1612
+ width: 304
1613
+ }
1614
+ ],
1615
+ tasks: tasks
1280
1616
  })
1281
- })
1282
- });
1617
+ });
1618
+ }
1283
1619
  };
1284
- const DraggableTaskReordering = {
1285
- name: 'Draggable Task Reordering',
1286
- parameters: {
1287
- useCustomRender: true
1620
+ const addReplaceInitialTasks = {
1621
+ 'task-1': {
1622
+ label: 'Initial Review',
1623
+ taskType: 'uipath.case-management.process',
1624
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1625
+ type: TaskItemTypeValues.AgenticProcess,
1626
+ size: "sm"
1627
+ })
1628
+ },
1629
+ 'task-2': {
1630
+ label: 'Document Verification',
1631
+ taskType: 'uipath.case-management.rpa',
1632
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1633
+ type: TaskItemTypeValues.Automation,
1634
+ size: "sm"
1635
+ })
1636
+ },
1637
+ 'task-3': {
1638
+ label: 'Address Check',
1639
+ taskType: 'uipath.case-management.rpa',
1640
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1641
+ type: TaskItemTypeValues.Automation,
1642
+ size: "sm"
1643
+ })
1644
+ },
1645
+ 'task-4': {
1646
+ label: 'Background Check',
1647
+ taskType: 'uipath.case-management.agent',
1648
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1649
+ type: TaskItemTypeValues.Agent,
1650
+ size: "sm"
1651
+ })
1288
1652
  },
1289
- render: ()=>/*#__PURE__*/ jsx(DraggableTaskReorderingStory, {}),
1290
- args: {}
1653
+ 'task-5': {
1654
+ label: 'Final Approval',
1655
+ taskType: 'uipath.case-management.run-human-action',
1656
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
1657
+ type: TaskItemTypeValues.User,
1658
+ size: "sm"
1659
+ })
1660
+ }
1291
1661
  };
1292
- const initialTasksForAddReplace = [
1293
- [
1294
- {
1295
- id: 'task-1',
1296
- label: 'Initial Verification',
1297
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
1298
- }
1299
- ],
1300
- [
1301
- {
1302
- id: 'task-2',
1303
- label: 'Document Review',
1304
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
1305
- }
1306
- ]
1307
- ];
1308
- const availableTaskOptions = [
1662
+ const addReplaceTaskOptions = [
1309
1663
  {
1310
- id: 'verification-task',
1311
- name: 'Verification task',
1312
- icon: {
1313
- Component: ()=>/*#__PURE__*/ jsx(VerificationIcon, {})
1314
- },
1664
+ id: 'opt-agent',
1665
+ name: 'Agent Task',
1315
1666
  data: {
1316
- type: 'verification'
1667
+ taskType: 'uipath.case-management.agent'
1668
+ },
1669
+ icon: {
1670
+ Component: ()=>/*#__PURE__*/ jsx(TaskIcon, {
1671
+ type: TaskItemTypeValues.Agent,
1672
+ size: "sm"
1673
+ })
1317
1674
  }
1318
1675
  },
1319
1676
  {
1320
- id: 'document-task',
1321
- name: 'Document task',
1322
- icon: {
1323
- Component: ()=>/*#__PURE__*/ jsx(DocumentIcon, {})
1324
- },
1677
+ id: 'opt-automation',
1678
+ name: 'RPA Automation',
1325
1679
  data: {
1326
- type: 'document'
1680
+ taskType: 'uipath.case-management.rpa'
1681
+ },
1682
+ icon: {
1683
+ Component: ()=>/*#__PURE__*/ jsx(TaskIcon, {
1684
+ type: TaskItemTypeValues.Automation,
1685
+ size: "sm"
1686
+ })
1327
1687
  }
1328
1688
  },
1329
1689
  {
1330
- id: 'process-task',
1331
- name: 'Process task',
1332
- icon: {
1333
- Component: ()=>/*#__PURE__*/ jsx(ProcessIcon, {})
1334
- },
1690
+ id: 'opt-api',
1691
+ name: 'API Automation',
1335
1692
  data: {
1336
- type: 'process'
1693
+ taskType: 'uipath.case-management.api-workflow'
1694
+ },
1695
+ icon: {
1696
+ Component: ()=>/*#__PURE__*/ jsx(TaskIcon, {
1697
+ type: TaskItemTypeValues.ApiAutomation,
1698
+ size: "sm"
1699
+ })
1337
1700
  }
1338
1701
  },
1339
1702
  {
1340
- id: 'credit-check',
1341
- name: 'Credit check',
1342
- icon: {
1343
- Component: ()=>/*#__PURE__*/ jsx(VerificationIcon, {})
1344
- },
1703
+ id: 'opt-human',
1704
+ name: 'Human in the Loop',
1345
1705
  data: {
1346
- type: 'credit'
1706
+ taskType: 'uipath.case-management.run-human-action'
1707
+ },
1708
+ icon: {
1709
+ Component: ()=>/*#__PURE__*/ jsx(TaskIcon, {
1710
+ type: TaskItemTypeValues.User,
1711
+ size: "sm"
1712
+ })
1347
1713
  }
1348
1714
  },
1349
1715
  {
1350
- id: 'address-verification',
1351
- name: 'Address verification',
1352
- icon: {
1353
- Component: ()=>/*#__PURE__*/ jsx(VerificationIcon, {})
1354
- },
1716
+ id: 'opt-process',
1717
+ name: 'Agentic Process',
1355
1718
  data: {
1356
- type: 'address'
1719
+ taskType: 'uipath.case-management.process'
1720
+ },
1721
+ icon: {
1722
+ Component: ()=>/*#__PURE__*/ jsx(TaskIcon, {
1723
+ type: TaskItemTypeValues.AgenticProcess,
1724
+ size: "sm"
1725
+ })
1357
1726
  }
1358
1727
  }
1359
1728
  ];
1360
1729
  const AddAndReplaceTasksStory = ()=>{
1361
- const StageNodeWrapper = useMemo(()=>function(props) {
1362
- return /*#__PURE__*/ jsx(StageNode, {
1363
- ...props,
1364
- ...props.data
1365
- });
1366
- }, []);
1367
- const nodeTypes = useMemo(()=>({
1368
- stage: StageNodeWrapper
1369
- }), [
1370
- StageNodeWrapper
1371
- ]);
1372
- const edgeTypes = useMemo(()=>({
1373
- stage: StageEdge
1374
- }), []);
1730
+ const stageId = 'stage-1';
1731
+ const [stageTaskIds, setStageTaskIds] = useState({
1732
+ [stageId]: [
1733
+ [
1734
+ 'task-1'
1735
+ ],
1736
+ [
1737
+ 'task-2'
1738
+ ],
1739
+ [
1740
+ 'task-3',
1741
+ 'task-4'
1742
+ ],
1743
+ [
1744
+ 'task-5'
1745
+ ]
1746
+ ]
1747
+ });
1748
+ const [allTasks, setAllTasks] = useState(addReplaceInitialTasks);
1749
+ const [selectedTaskId, setSelectedTaskId] = useState(null);
1750
+ const [actionLog, setActionLog] = useState('');
1375
1751
  const [pendingReplaceTask, setPendingReplaceTask] = useState();
1376
- const [selectedTaskId, setSelectedTaskId] = useState();
1377
1752
  const [menuAnchorEl, setMenuAnchorEl] = useState(null);
1378
- const [nodesState, setNodes, onNodesChange] = useNodesState([
1379
- {
1380
- id: 'add-replace-stage',
1381
- type: 'stage',
1382
- position: {
1383
- x: 320,
1384
- y: 96
1385
- },
1386
- data: {
1387
- stageDetails: {
1388
- label: 'Add, Replace, and Group Tasks',
1389
- tasks: initialTasksForAddReplace
1390
- },
1391
- taskOptions: availableTaskOptions
1392
- }
1393
- }
1394
- ]);
1395
- const [edges, setEdges, onEdgesChange] = useEdgesState([]);
1396
- const handleAddTask = useCallback((taskItem)=>{
1397
- const newTask = {
1398
- id: `${taskItem.id}-${Date.now()}`,
1399
- label: taskItem.name,
1400
- icon: taskItem.icon?.Component ? /*#__PURE__*/ jsx(taskItem.icon.Component, {}) : void 0
1401
- };
1402
- setNodes((prevNodes)=>prevNodes.map((node)=>'add-replace-stage' === node.id ? {
1403
- ...node,
1404
- data: {
1405
- ...node.data,
1406
- stageDetails: {
1407
- ...node.data.stageDetails,
1408
- tasks: [
1409
- ...node.data.stageDetails.tasks,
1410
- [
1411
- newTask
1412
- ]
1413
- ]
1414
- }
1415
- }
1416
- } : node));
1753
+ const handleAddTaskFromToolbox = useCallback((taskItem)=>{
1754
+ const newTaskId = `added-${Date.now()}`;
1755
+ const IconComp = taskItem.icon?.Component;
1756
+ setAllTasks((prev)=>({
1757
+ ...prev,
1758
+ [newTaskId]: {
1759
+ label: taskItem.name,
1760
+ taskType: taskItem.data?.taskType || 'uipath.case-management.process',
1761
+ icon: IconComp ? /*#__PURE__*/ jsx(IconComp, {}) : /*#__PURE__*/ jsx(TaskIcon, {
1762
+ type: TaskItemTypeValues.AgenticProcess,
1763
+ size: "sm"
1764
+ })
1765
+ }
1766
+ }));
1767
+ setStageTaskIds((prev)=>({
1768
+ ...prev,
1769
+ [stageId]: [
1770
+ ...prev[stageId] || [],
1771
+ [
1772
+ newTaskId
1773
+ ]
1774
+ ]
1775
+ }));
1776
+ setActionLog(`Added task: ${taskItem.name}`);
1417
1777
  }, [
1418
- setNodes
1778
+ stageId
1419
1779
  ]);
1420
- const handleReplaceTask = useCallback((taskItem, groupIndex, taskIndex)=>{
1421
- if (groupIndex < 0 || taskIndex < 0) return;
1422
- const listItem = taskItem;
1423
- const replacedTask = {
1424
- id: `${listItem.id}-replaced-${Date.now()}`,
1425
- label: listItem.name,
1426
- icon: listItem.icon?.Component ? /*#__PURE__*/ jsx(listItem.icon.Component, {}) : void 0
1427
- };
1428
- setNodes((prevNodes)=>prevNodes.map((node)=>{
1429
- if ('add-replace-stage' !== node.id) return node;
1430
- const prevTasks = node.data.stageDetails.tasks;
1431
- if (groupIndex >= prevTasks.length) return node;
1432
- const currentGroup = prevTasks[groupIndex];
1433
- if (!currentGroup || taskIndex >= currentGroup.length) return node;
1434
- const updatedTasks = prevTasks.map((group, gIdx)=>{
1435
- if (gIdx === groupIndex) return group.map((task, tIdx)=>tIdx === taskIndex ? replacedTask : task);
1436
- return group;
1437
- });
1438
- return {
1439
- ...node,
1440
- data: {
1441
- ...node.data,
1442
- stageDetails: {
1443
- ...node.data.stageDetails,
1444
- tasks: updatedTasks
1445
- }
1446
- }
1447
- };
1780
+ const handleReplaceTask = useCallback((newTask, groupIndex, taskIndex)=>{
1781
+ const newTaskId = `replaced-${Date.now()}`;
1782
+ const IconComp = newTask.icon?.Component;
1783
+ setAllTasks((prev)=>({
1784
+ ...prev,
1785
+ [newTaskId]: {
1786
+ label: newTask.name,
1787
+ taskType: newTask.data?.taskType || 'uipath.case-management.process',
1788
+ icon: IconComp ? /*#__PURE__*/ jsx(IconComp, {}) : /*#__PURE__*/ jsx(TaskIcon, {
1789
+ type: TaskItemTypeValues.AgenticProcess,
1790
+ size: "sm"
1791
+ })
1792
+ }
1448
1793
  }));
1794
+ setStageTaskIds((prev)=>{
1795
+ const currentTaskIds = [
1796
+ ...prev[stageId] || []
1797
+ ].map((group)=>[
1798
+ ...group
1799
+ ]);
1800
+ const targetGroup = currentTaskIds[groupIndex];
1801
+ if (targetGroup && void 0 !== targetGroup[taskIndex]) targetGroup[taskIndex] = newTaskId;
1802
+ return {
1803
+ ...prev,
1804
+ [stageId]: currentTaskIds
1805
+ };
1806
+ });
1449
1807
  setPendingReplaceTask(void 0);
1808
+ setActionLog(`Replaced task at group ${groupIndex}, task ${taskIndex} with "${newTask.name}"`);
1450
1809
  }, [
1451
- setNodes
1810
+ stageId
1452
1811
  ]);
1453
- const groupModificationHandlers = useMemo(()=>createGroupModificationHandlers(), []);
1454
- const handleTaskGroupModification = useCallback((groupModificationType, groupIndex, taskIndex)=>{
1455
- const handler = getHandlerForModificationType(groupModificationHandlers, groupModificationType);
1456
- setNodes((prevNodes)=>prevNodes.map((node)=>{
1457
- if ('add-replace-stage' !== node.id) return node;
1458
- const prevTasks = node.data.stageDetails.tasks;
1459
- const updatedTasks = handler(prevTasks, groupIndex, taskIndex);
1460
- return {
1461
- ...node,
1462
- data: {
1463
- ...node.data,
1464
- stageDetails: {
1465
- ...node.data.stageDetails,
1466
- tasks: updatedTasks
1467
- }
1468
- }
1469
- };
1470
- }));
1812
+ const handleGroupModification = useCallback((type, groupIndex, taskIndex)=>{
1813
+ setActionLog(`Group modification: ${type} at group ${groupIndex}, task ${taskIndex}`);
1814
+ setStageTaskIds((prev)=>{
1815
+ const handler = getHandlerForModificationType(createGroupModificationHandlers(), type);
1816
+ const currentTaskIds = (prev[stageId] || []).map((group)=>[
1817
+ ...group
1818
+ ]);
1819
+ const updatedTaskIds = handler(currentTaskIds, groupIndex, taskIndex);
1820
+ return {
1821
+ ...prev,
1822
+ [stageId]: updatedTaskIds
1823
+ };
1824
+ });
1471
1825
  }, [
1472
- groupModificationHandlers,
1473
- setNodes
1826
+ stageId
1474
1827
  ]);
1475
- const handleTaskClick = useCallback((taskId)=>{
1476
- setSelectedTaskId(taskId);
1477
- }, []);
1478
- const currentTasks = nodesState.find((n)=>'add-replace-stage' === n.id)?.data.stageDetails.tasks || [];
1479
- const taskMenuItems = useMemo(()=>currentTasks.flatMap((group, groupIndex)=>group.map((task, taskIndex)=>({
1480
- title: task.label,
1828
+ const currentTaskIds = stageTaskIds[stageId] || [];
1829
+ const taskMenuItems = useMemo(()=>currentTaskIds.flatMap((group, groupIndex)=>group.map((taskId, taskIndex)=>{
1830
+ const taskInfo = allTasks[taskId];
1831
+ return {
1832
+ title: taskInfo?.label || taskId,
1481
1833
  variant: 'item',
1482
- startIcon: task.icon,
1834
+ startIcon: taskInfo?.icon,
1483
1835
  onClick: ()=>{
1484
- setSelectedTaskId(task.id);
1836
+ setSelectedTaskId(taskId);
1485
1837
  setPendingReplaceTask({
1486
1838
  groupIndex,
1487
1839
  taskIndex
1488
1840
  });
1489
1841
  setMenuAnchorEl(null);
1490
1842
  }
1491
- }))), [
1492
- currentTasks
1843
+ };
1844
+ })), [
1845
+ currentTaskIds,
1846
+ allTasks
1493
1847
  ]);
1494
- const nodesWithMetadata = useMemo(()=>nodesState.map((node)=>'add-replace-stage' === node.id ? {
1495
- ...node,
1848
+ const replaceButtonLabel = useMemo(()=>{
1849
+ if (pendingReplaceTask) {
1850
+ const taskId = currentTaskIds[pendingReplaceTask.groupIndex]?.[pendingReplaceTask.taskIndex];
1851
+ const taskInfo = taskId ? allTasks[taskId] : void 0;
1852
+ if (taskInfo) return `Replacing: ${taskInfo.label}`;
1853
+ }
1854
+ return 'Replace Task';
1855
+ }, [
1856
+ pendingReplaceTask,
1857
+ currentTaskIds,
1858
+ allTasks
1859
+ ]);
1860
+ const stageNodes = useMemo(()=>[
1861
+ {
1862
+ id: stageId,
1863
+ type: 'stage',
1864
+ position: {
1865
+ x: 48,
1866
+ y: 96
1867
+ },
1868
+ style: {
1869
+ width: 304
1870
+ },
1496
1871
  data: {
1497
- ...node.data,
1498
- pendingReplaceTask: pendingReplaceTask,
1872
+ nodeType: 'case-management:Stage',
1499
1873
  stageDetails: {
1500
- ...node.data.stageDetails,
1874
+ label: 'Add, Replace & Group Tasks',
1875
+ taskIds: stageTaskIds[stageId] || [],
1501
1876
  selectedTasks: selectedTaskId ? [
1502
1877
  selectedTaskId
1503
1878
  ] : void 0
1504
1879
  },
1505
- onAddTaskFromToolbox: handleAddTask,
1880
+ pendingReplaceTask,
1881
+ taskOptions: addReplaceTaskOptions,
1882
+ onAddTaskFromToolbox: handleAddTaskFromToolbox,
1506
1883
  onReplaceTaskFromToolbox: handleReplaceTask,
1507
- onTaskGroupModification: handleTaskGroupModification,
1508
- onTaskClick: handleTaskClick
1884
+ onTaskClick: (taskId)=>{
1885
+ setSelectedTaskId(taskId);
1886
+ setActionLog(`Selected: ${taskId}`);
1887
+ }
1509
1888
  }
1510
- } : node), [
1511
- nodesState,
1512
- pendingReplaceTask,
1889
+ }
1890
+ ], [
1891
+ stageTaskIds,
1513
1892
  selectedTaskId,
1514
- handleAddTask,
1515
- handleReplaceTask,
1516
- handleTaskGroupModification,
1517
- handleTaskClick
1893
+ pendingReplaceTask,
1894
+ handleAddTaskFromToolbox,
1895
+ handleReplaceTask
1518
1896
  ]);
1519
- const onConnect = useCallback((connection)=>setEdges((eds)=>addEdge(connection, eds)), [
1520
- setEdges
1897
+ const taskNodes = useMemo(()=>createTaskNodes({
1898
+ stageId,
1899
+ taskIds: stageTaskIds[stageId] || [],
1900
+ tasks: allTasks,
1901
+ stageWidth: 304,
1902
+ onTaskClick: (taskId)=>{
1903
+ setSelectedTaskId(taskId);
1904
+ setActionLog(`Selected: ${taskId}`);
1905
+ },
1906
+ onTaskSelect: setSelectedTaskId,
1907
+ enableCrossStage: false,
1908
+ onGroupModification: handleGroupModification,
1909
+ onRequestReplaceTask: (groupIndex, taskIndex)=>{
1910
+ setPendingReplaceTask({
1911
+ groupIndex,
1912
+ taskIndex
1913
+ });
1914
+ }
1915
+ }), [
1916
+ stageTaskIds,
1917
+ allTasks,
1918
+ handleGroupModification
1521
1919
  ]);
1522
- const replaceButtonLabel = useMemo(()=>{
1523
- if (pendingReplaceTask) {
1524
- const taskBeingReplaced = currentTasks[pendingReplaceTask.groupIndex]?.[pendingReplaceTask.taskIndex];
1525
- if (taskBeingReplaced) return `Replacing Task: ${taskBeingReplaced.label}`;
1526
- }
1527
- return 'Replace Task';
1920
+ const allNodes = useMemo(()=>[
1921
+ ...stageNodes,
1922
+ ...taskNodes
1923
+ ], [
1924
+ stageNodes,
1925
+ taskNodes
1926
+ ]);
1927
+ const allNodesRef = useRef(allNodes);
1928
+ allNodesRef.current = allNodes;
1929
+ const [nodes, setNodes] = useState(allNodes);
1930
+ const [edges, setEdges, onEdgesChange] = useEdgesState([]);
1931
+ useEffect(()=>{
1932
+ setNodes((prev)=>mergeNodes(prev, allNodes));
1528
1933
  }, [
1529
- pendingReplaceTask,
1530
- currentTasks
1934
+ allNodes
1531
1935
  ]);
1936
+ const onNodesChange = useCallback((changes)=>{
1937
+ setNodes((nds)=>{
1938
+ const updated = applyNodeChanges(changes, nds);
1939
+ return mergeNodes(updated, allNodesRef.current);
1940
+ });
1941
+ }, []);
1942
+ const onConnect = useCallback((connection)=>setEdges((eds)=>addEdge({
1943
+ ...connection,
1944
+ type: 'stage'
1945
+ }, eds)), [
1946
+ setEdges
1947
+ ]);
1948
+ const nodeTypes = useMemo(()=>({
1949
+ stage: StageNodeWrapper,
1950
+ task: TaskNodeWrapper,
1951
+ placeholder: (props)=>/*#__PURE__*/ jsx(PlaceholderTaskNode, {
1952
+ ...props
1953
+ })
1954
+ }), []);
1955
+ const edgeTypes = useMemo(()=>({
1956
+ stage: StageEdge
1957
+ }), []);
1532
1958
  return /*#__PURE__*/ jsx("div", {
1533
1959
  style: {
1534
1960
  width: '100vw',
@@ -1536,7 +1962,7 @@ const AddAndReplaceTasksStory = ()=>{
1536
1962
  },
1537
1963
  children: /*#__PURE__*/ jsx(ReactFlowProvider, {
1538
1964
  children: /*#__PURE__*/ jsxs(BaseCanvas, {
1539
- nodes: nodesWithMetadata,
1965
+ nodes: nodes,
1540
1966
  edges: edges,
1541
1967
  onNodesChange: onNodesChange,
1542
1968
  onEdgesChange: onEdgesChange,
@@ -1562,9 +1988,7 @@ const AddAndReplaceTasksStory = ()=>{
1562
1988
  /*#__PURE__*/ jsx(ApButton, {
1563
1989
  variant: "primary",
1564
1990
  label: replaceButtonLabel,
1565
- onClick: (e)=>{
1566
- setMenuAnchorEl(e.currentTarget);
1567
- }
1991
+ onClick: (e)=>setMenuAnchorEl(e.currentTarget)
1568
1992
  }),
1569
1993
  /*#__PURE__*/ jsx(ApMenu, {
1570
1994
  isOpen: Boolean(menuAnchorEl),
@@ -1580,6 +2004,18 @@ const AddAndReplaceTasksStory = ()=>{
1580
2004
  children: /*#__PURE__*/ jsx(CanvasPositionControls, {
1581
2005
  translations: DefaultCanvasTranslations
1582
2006
  })
2007
+ }),
2008
+ actionLog && /*#__PURE__*/ jsx(Panel, {
2009
+ position: "top-left",
2010
+ children: /*#__PURE__*/ jsx("div", {
2011
+ style: {
2012
+ background: 'var(--uix-palette-surface-paper)',
2013
+ padding: '8px 16px',
2014
+ borderRadius: '4px',
2015
+ boxShadow: '0 2px 4px rgba(0,0,0,0.1)'
2016
+ },
2017
+ children: actionLog
2018
+ })
1583
2019
  })
1584
2020
  ]
1585
2021
  })
@@ -1588,110 +2024,172 @@ const AddAndReplaceTasksStory = ()=>{
1588
2024
  };
1589
2025
  const AddAndReplaceTasks = {
1590
2026
  name: 'Add, Replace, and Group Tasks',
1591
- parameters: {
1592
- useCustomRender: true
2027
+ render: ()=>/*#__PURE__*/ jsx(AddAndReplaceTasksStory, {})
2028
+ };
2029
+ const loadingStoryStages = [
2030
+ {
2031
+ id: 'empty-stage',
2032
+ label: 'Empty Stage (click +)',
2033
+ position: {
2034
+ x: 48,
2035
+ y: 96
2036
+ },
2037
+ width: 304
2038
+ },
2039
+ {
2040
+ id: 'tasks-stage',
2041
+ label: 'With Tasks (click +)',
2042
+ position: {
2043
+ x: 400,
2044
+ y: 96
2045
+ },
2046
+ width: 304
2047
+ }
2048
+ ];
2049
+ const loadingStoryInitialTaskIds = {
2050
+ 'empty-stage': [],
2051
+ 'tasks-stage': [
2052
+ [
2053
+ 'task-1'
2054
+ ],
2055
+ [
2056
+ 'task-2'
2057
+ ]
2058
+ ]
2059
+ };
2060
+ const loadingStoryInitialTasks = {
2061
+ 'task-1': {
2062
+ label: 'Existing Task',
2063
+ taskType: 'uipath.case-management.rpa',
2064
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
2065
+ type: TaskItemTypeValues.Automation,
2066
+ size: "sm"
2067
+ })
1593
2068
  },
1594
- render: ()=>/*#__PURE__*/ jsx(AddAndReplaceTasksStory, {}),
1595
- args: {}
2069
+ 'task-2': {
2070
+ label: 'Another Task',
2071
+ taskType: 'uipath.case-management.process',
2072
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
2073
+ type: TaskItemTypeValues.AgenticProcess,
2074
+ size: "sm"
2075
+ })
2076
+ }
1596
2077
  };
1597
2078
  const AddTaskLoadingStory = ()=>{
1598
- const StageNodeWrapper = useMemo(()=>function(props) {
1599
- return /*#__PURE__*/ jsx(StageNode, {
1600
- ...props,
1601
- ...props.data
1602
- });
1603
- }, []);
1604
- const nodeTypes = useMemo(()=>({
1605
- stage: StageNodeWrapper
1606
- }), [
1607
- StageNodeWrapper
1608
- ]);
1609
- const edgeTypes = useMemo(()=>({
1610
- stage: StageEdge
1611
- }), []);
1612
- const initialNodes = useMemo(()=>[
1613
- {
1614
- id: 'loading-stage-empty',
1615
- type: 'stage',
1616
- position: {
1617
- x: 48,
1618
- y: 96
1619
- },
1620
- width: 304,
1621
- data: {
1622
- stageDetails: {
1623
- label: 'Empty Stage (click +)',
1624
- tasks: []
1625
- },
1626
- addTaskLoading: false
1627
- }
1628
- },
1629
- {
1630
- id: 'loading-stage-with-tasks',
2079
+ const [loadingStages, setLoadingStages] = useState({});
2080
+ const [stageTaskIds, setStageTaskIds] = useState(loadingStoryInitialTaskIds);
2081
+ const [allTasks, setAllTasks] = useState(loadingStoryInitialTasks);
2082
+ const handleTaskAdd = useCallback((stageIdToLoad)=>{
2083
+ setLoadingStages((prev)=>({
2084
+ ...prev,
2085
+ [stageIdToLoad]: true
2086
+ }));
2087
+ setTimeout(()=>{
2088
+ const newTaskId = `new-task-${Date.now()}`;
2089
+ setAllTasks((prev)=>({
2090
+ ...prev,
2091
+ [newTaskId]: {
2092
+ label: 'New Task',
2093
+ taskType: 'uipath.case-management.agent',
2094
+ icon: /*#__PURE__*/ jsx(TaskIcon, {
2095
+ type: TaskItemTypeValues.Agent,
2096
+ size: "sm"
2097
+ })
2098
+ }
2099
+ }));
2100
+ setStageTaskIds((prev)=>({
2101
+ ...prev,
2102
+ [stageIdToLoad]: [
2103
+ ...prev[stageIdToLoad] || [],
2104
+ [
2105
+ newTaskId
2106
+ ]
2107
+ ]
2108
+ }));
2109
+ setLoadingStages((prev)=>({
2110
+ ...prev,
2111
+ [stageIdToLoad]: false
2112
+ }));
2113
+ }, 3000);
2114
+ }, []);
2115
+ const stageNodes = useMemo(()=>loadingStoryStages.map((stage)=>({
2116
+ id: stage.id,
1631
2117
  type: 'stage',
1632
- position: {
1633
- x: 400,
1634
- y: 96
2118
+ position: stage.position,
2119
+ style: {
2120
+ width: stage.width
1635
2121
  },
1636
- width: 304,
1637
2122
  data: {
2123
+ nodeType: 'case-management:Stage',
1638
2124
  stageDetails: {
1639
- label: 'With Tasks (click +)',
1640
- tasks: [
1641
- [
1642
- {
1643
- id: 'task-1',
1644
- label: 'Existing Task',
1645
- icon: /*#__PURE__*/ jsx(VerificationIcon, {})
1646
- }
1647
- ],
1648
- [
1649
- {
1650
- id: 'task-2',
1651
- label: 'Another Task',
1652
- icon: /*#__PURE__*/ jsx(DocumentIcon, {})
1653
- }
1654
- ]
1655
- ]
2125
+ label: stage.label,
2126
+ taskIds: stageTaskIds[stage.id] || []
1656
2127
  },
1657
- addTaskLoading: false
2128
+ addTaskLoading: loadingStages[stage.id] || false,
2129
+ onTaskAdd: ()=>handleTaskAdd(stage.id)
1658
2130
  }
1659
- }
1660
- ], []);
1661
- const [nodesState, setNodes, onNodesChange] = useNodesState(initialNodes);
1662
- const [edges, setEdges, onEdgesChange] = useEdgesState([]);
1663
- const setNodeLoading = useCallback((nodeId, loading)=>{
1664
- setNodes((nds)=>nds.map((node)=>node.id === nodeId ? {
1665
- ...node,
1666
- data: {
1667
- ...node.data,
1668
- addTaskLoading: loading
1669
- }
1670
- } : node));
1671
- }, [
1672
- setNodes
2131
+ })), [
2132
+ stageTaskIds,
2133
+ loadingStages,
2134
+ handleTaskAdd
1673
2135
  ]);
1674
- const handleTaskAddForNode = useCallback((nodeId)=>{
1675
- setNodeLoading(nodeId, true);
1676
- setTimeout(()=>{
1677
- setNodeLoading(nodeId, false);
1678
- }, 3000);
2136
+ const taskNodes = useMemo(()=>{
2137
+ const allTaskNodes = [];
2138
+ for (const stage of loadingStoryStages){
2139
+ const ids = stageTaskIds[stage.id] || [];
2140
+ const nodes = createTaskNodes({
2141
+ stageId: stage.id,
2142
+ taskIds: ids,
2143
+ tasks: allTasks,
2144
+ stageWidth: stage.width,
2145
+ enableCrossStage: false,
2146
+ onRequestReplaceTask: ()=>{}
2147
+ });
2148
+ allTaskNodes.push(...nodes);
2149
+ }
2150
+ return allTaskNodes;
1679
2151
  }, [
1680
- setNodeLoading
2152
+ stageTaskIds,
2153
+ allTasks
1681
2154
  ]);
1682
- const nodesWithHandler = useMemo(()=>nodesState.map((node)=>({
1683
- ...node,
1684
- data: {
1685
- ...node.data,
1686
- onTaskAdd: ()=>handleTaskAddForNode(node.id)
1687
- }
1688
- })), [
1689
- nodesState,
1690
- handleTaskAddForNode
2155
+ const allNodes = useMemo(()=>[
2156
+ ...stageNodes,
2157
+ ...taskNodes
2158
+ ], [
2159
+ stageNodes,
2160
+ taskNodes
1691
2161
  ]);
1692
- const onConnect = useCallback((connection)=>setEdges((eds)=>addEdge(connection, eds)), [
2162
+ const allNodesRef = useRef(allNodes);
2163
+ allNodesRef.current = allNodes;
2164
+ const [nodes, setNodes] = useState(allNodes);
2165
+ const [edges, setEdges, onEdgesChange] = useEdgesState([]);
2166
+ useEffect(()=>{
2167
+ setNodes((prev)=>mergeNodes(prev, allNodes));
2168
+ }, [
2169
+ allNodes
2170
+ ]);
2171
+ const onNodesChange = useCallback((changes)=>{
2172
+ setNodes((nds)=>{
2173
+ const updated = applyNodeChanges(changes, nds);
2174
+ return mergeNodes(updated, allNodesRef.current);
2175
+ });
2176
+ }, []);
2177
+ const onConnect = useCallback((connection)=>setEdges((eds)=>addEdge({
2178
+ ...connection,
2179
+ type: 'stage'
2180
+ }, eds)), [
1693
2181
  setEdges
1694
2182
  ]);
2183
+ const nodeTypes = useMemo(()=>({
2184
+ stage: StageNodeWrapper,
2185
+ task: TaskNodeWrapper,
2186
+ placeholder: (props)=>/*#__PURE__*/ jsx(PlaceholderTaskNode, {
2187
+ ...props
2188
+ })
2189
+ }), []);
2190
+ const edgeTypes = useMemo(()=>({
2191
+ stage: StageEdge
2192
+ }), []);
1695
2193
  return /*#__PURE__*/ jsx("div", {
1696
2194
  style: {
1697
2195
  width: '100vw',
@@ -1699,7 +2197,7 @@ const AddTaskLoadingStory = ()=>{
1699
2197
  },
1700
2198
  children: /*#__PURE__*/ jsx(ReactFlowProvider, {
1701
2199
  children: /*#__PURE__*/ jsx(BaseCanvas, {
1702
- nodes: nodesWithHandler,
2200
+ nodes: nodes,
1703
2201
  edges: edges,
1704
2202
  onNodesChange: onNodesChange,
1705
2203
  onEdgesChange: onEdgesChange,
@@ -1730,10 +2228,6 @@ const AddTaskLoadingStory = ()=>{
1730
2228
  };
1731
2229
  const AddTaskLoading = {
1732
2230
  name: 'Add Task Loading State',
1733
- parameters: {
1734
- useCustomRender: true
1735
- },
1736
- render: ()=>/*#__PURE__*/ jsx(AddTaskLoadingStory, {}),
1737
- args: {}
2231
+ render: ()=>/*#__PURE__*/ jsx(AddTaskLoadingStory, {})
1738
2232
  };
1739
- export { AddAndReplaceTasks, AddTaskLoading, Default, DraggableTaskReordering, ExecutionStatus, InteractiveTaskManagement, LoanProcessingWorkflow, WithTaskIcons, StageNode_stories as default };
2233
+ export { AddAndReplaceTasks, AddTaskLoading, Default, ExecutionStatus, InteractiveTaskManagement, LoanProcessingWorkflow, WithTaskIcons, WithTaskMenu, StageNode_stories as default };