nucleus-core-ts 0.8.107 → 0.8.109
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fe/components/VerificationFlowPage/components/FlowNode.d.ts +15 -0
- package/dist/fe/components/VerificationFlowPage/components/FlowNode.js +111 -0
- package/dist/fe/components/VerificationFlowPage/components/NodePropertiesPanel.d.ts +11 -0
- package/dist/fe/components/VerificationFlowPage/components/NodePropertiesPanel.js +309 -0
- package/dist/fe/components/VerificationFlowPage/components/PendingTab.d.ts +10 -0
- package/dist/fe/components/VerificationFlowPage/components/PendingTab.js +157 -0
- package/dist/fe/components/VerificationFlowPage/components/VerificationFlowPage.d.ts +5 -0
- package/dist/fe/components/VerificationFlowPage/components/VerificationFlowPage.js +694 -0
- package/dist/fe/components/VerificationFlowPage/index.d.ts +9 -0
- package/dist/fe/components/VerificationFlowPage/index.js +6 -0
- package/dist/fe/components/VerificationFlowPage/store/index.d.ts +26 -0
- package/dist/fe/components/VerificationFlowPage/store/index.js +85 -0
- package/dist/fe/components/VerificationFlowPage/theme/index.d.ts +99 -0
- package/dist/fe/components/VerificationFlowPage/theme/index.js +138 -0
- package/dist/fe/components/VerificationFlowPage/types/index.d.ts +114 -0
- package/dist/fe/components/VerificationFlowPage/types/index.js +1 -0
- package/dist/fe/index.d.ts +2 -0
- package/dist/fe/index.js +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
interface FlowNodeData {
|
|
3
|
+
label: string;
|
|
4
|
+
description: string;
|
|
5
|
+
nodeType: string;
|
|
6
|
+
stepOrder: number;
|
|
7
|
+
decision: string;
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
[key: string]: unknown;
|
|
10
|
+
}
|
|
11
|
+
export declare function FlowNode({ data }: {
|
|
12
|
+
data: FlowNodeData;
|
|
13
|
+
}): ReactElement;
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=FlowNode.d.ts.map
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { Handle, Position } from "@xyflow/react";
|
|
4
|
+
import { cn } from "../../../utils/cn";
|
|
5
|
+
import { verificationFlowPageTheme } from "../theme";
|
|
6
|
+
const StepIcon = ({ className })=>/*#__PURE__*/ _jsxs("svg", {
|
|
7
|
+
className: className,
|
|
8
|
+
fill: "none",
|
|
9
|
+
viewBox: "0 0 24 24",
|
|
10
|
+
stroke: "currentColor",
|
|
11
|
+
children: [
|
|
12
|
+
/*#__PURE__*/ _jsx("title", {
|
|
13
|
+
children: "Step"
|
|
14
|
+
}),
|
|
15
|
+
/*#__PURE__*/ _jsx("path", {
|
|
16
|
+
strokeLinecap: "round",
|
|
17
|
+
strokeLinejoin: "round",
|
|
18
|
+
strokeWidth: 2,
|
|
19
|
+
d: "M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"
|
|
20
|
+
})
|
|
21
|
+
]
|
|
22
|
+
});
|
|
23
|
+
const VerifierIcon = ({ className })=>/*#__PURE__*/ _jsxs("svg", {
|
|
24
|
+
className: className,
|
|
25
|
+
fill: "none",
|
|
26
|
+
viewBox: "0 0 24 24",
|
|
27
|
+
stroke: "currentColor",
|
|
28
|
+
children: [
|
|
29
|
+
/*#__PURE__*/ _jsx("title", {
|
|
30
|
+
children: "Verifier"
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ _jsx("path", {
|
|
33
|
+
strokeLinecap: "round",
|
|
34
|
+
strokeLinejoin: "round",
|
|
35
|
+
strokeWidth: 2,
|
|
36
|
+
d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z"
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
});
|
|
40
|
+
const NotificationIcon = ({ className })=>/*#__PURE__*/ _jsxs("svg", {
|
|
41
|
+
className: className,
|
|
42
|
+
fill: "none",
|
|
43
|
+
viewBox: "0 0 24 24",
|
|
44
|
+
stroke: "currentColor",
|
|
45
|
+
children: [
|
|
46
|
+
/*#__PURE__*/ _jsx("title", {
|
|
47
|
+
children: "Notification"
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ _jsx("path", {
|
|
50
|
+
strokeLinecap: "round",
|
|
51
|
+
strokeLinejoin: "round",
|
|
52
|
+
strokeWidth: 2,
|
|
53
|
+
d: "M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9"
|
|
54
|
+
})
|
|
55
|
+
]
|
|
56
|
+
});
|
|
57
|
+
const iconMap = {
|
|
58
|
+
step: StepIcon,
|
|
59
|
+
verifier: VerifierIcon,
|
|
60
|
+
notification: NotificationIcon
|
|
61
|
+
};
|
|
62
|
+
export function FlowNode({ data }) {
|
|
63
|
+
const theme = verificationFlowPageTheme;
|
|
64
|
+
const nodeType = data.nodeType || "step";
|
|
65
|
+
const colorKey = nodeType;
|
|
66
|
+
const colors = colorKey in theme.node ? theme.node[colorKey] : theme.node.step;
|
|
67
|
+
const decision = data.decision;
|
|
68
|
+
const isActive = data.isActive;
|
|
69
|
+
const Icon = iconMap[nodeType] || StepIcon;
|
|
70
|
+
const badgeKey = decision || (isActive ? "active" : "");
|
|
71
|
+
const badgeClass = badgeKey in theme.node.badge ? theme.node.badge[badgeKey] : "";
|
|
72
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
73
|
+
className: cn(theme.node.base, colors.border, colors.bg, isActive && !decision ? theme.node.activeRing : ""),
|
|
74
|
+
children: [
|
|
75
|
+
/*#__PURE__*/ _jsx(Handle, {
|
|
76
|
+
type: "target",
|
|
77
|
+
position: Position.Top,
|
|
78
|
+
className: theme.node.handle
|
|
79
|
+
}),
|
|
80
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
81
|
+
className: "flex items-center gap-2 mb-1",
|
|
82
|
+
children: [
|
|
83
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
84
|
+
className: cn("w-4 h-4", colors.icon)
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ _jsx("span", {
|
|
87
|
+
className: theme.node.typeLabel,
|
|
88
|
+
children: nodeType
|
|
89
|
+
}),
|
|
90
|
+
badgeClass && /*#__PURE__*/ _jsx("span", {
|
|
91
|
+
className: cn("ml-auto text-[10px] font-bold px-1.5 py-0.5 rounded-full", badgeClass),
|
|
92
|
+
children: decision || "active"
|
|
93
|
+
})
|
|
94
|
+
]
|
|
95
|
+
}),
|
|
96
|
+
/*#__PURE__*/ _jsx("p", {
|
|
97
|
+
className: theme.node.nameLabel,
|
|
98
|
+
children: data.label || `Step ${data.stepOrder}`
|
|
99
|
+
}),
|
|
100
|
+
data.description ? /*#__PURE__*/ _jsx("p", {
|
|
101
|
+
className: theme.node.description,
|
|
102
|
+
children: String(data.description)
|
|
103
|
+
}) : null,
|
|
104
|
+
/*#__PURE__*/ _jsx(Handle, {
|
|
105
|
+
type: "source",
|
|
106
|
+
position: Position.Bottom,
|
|
107
|
+
className: theme.node.handle
|
|
108
|
+
})
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Node } from "@xyflow/react";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
3
|
+
interface NodePropertiesPanelProps {
|
|
4
|
+
node: Node;
|
|
5
|
+
onUpdate: (nodeId: string, data: Record<string, unknown>) => void;
|
|
6
|
+
onDelete: (nodeId: string) => void;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function NodePropertiesPanel({ node, onUpdate, onDelete, onClose, }: NodePropertiesPanelProps): ReactElement;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=NodePropertiesPanel.d.ts.map
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
export function NodePropertiesPanel({ node, onUpdate, onDelete, onClose }) {
|
|
4
|
+
const data = node.data;
|
|
5
|
+
const nodeType = String(data.nodeType || "step");
|
|
6
|
+
const inputClass = "w-full rounded-lg border border-zinc-200 dark:border-zinc-700 bg-white dark:bg-zinc-800 px-3 py-2 text-sm text-zinc-900 dark:text-white outline-none focus:ring-2 focus:ring-blue-500";
|
|
7
|
+
const labelClass = "block text-xs font-medium text-zinc-500 dark:text-zinc-400 mb-1";
|
|
8
|
+
const sectionClass = "space-y-3";
|
|
9
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
10
|
+
className: "absolute top-0 right-0 h-full w-80 bg-white dark:bg-zinc-900 border-l border-zinc-200 dark:border-zinc-800 shadow-2xl z-20 flex flex-col",
|
|
11
|
+
children: [
|
|
12
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
13
|
+
className: "flex items-center justify-between px-4 py-3 border-b border-zinc-200 dark:border-zinc-800",
|
|
14
|
+
children: [
|
|
15
|
+
/*#__PURE__*/ _jsx("h3", {
|
|
16
|
+
className: "text-sm font-semibold text-zinc-900 dark:text-white",
|
|
17
|
+
children: "Node Properties"
|
|
18
|
+
}),
|
|
19
|
+
/*#__PURE__*/ _jsx("button", {
|
|
20
|
+
type: "button",
|
|
21
|
+
onClick: onClose,
|
|
22
|
+
className: "text-zinc-400 hover:text-zinc-600 dark:hover:text-zinc-300 transition-colors",
|
|
23
|
+
children: /*#__PURE__*/ _jsxs("svg", {
|
|
24
|
+
className: "w-5 h-5",
|
|
25
|
+
fill: "none",
|
|
26
|
+
viewBox: "0 0 24 24",
|
|
27
|
+
stroke: "currentColor",
|
|
28
|
+
children: [
|
|
29
|
+
/*#__PURE__*/ _jsx("title", {
|
|
30
|
+
children: "Close"
|
|
31
|
+
}),
|
|
32
|
+
/*#__PURE__*/ _jsx("path", {
|
|
33
|
+
strokeLinecap: "round",
|
|
34
|
+
strokeLinejoin: "round",
|
|
35
|
+
strokeWidth: 2,
|
|
36
|
+
d: "M6 18L18 6M6 6l12 12"
|
|
37
|
+
})
|
|
38
|
+
]
|
|
39
|
+
})
|
|
40
|
+
})
|
|
41
|
+
]
|
|
42
|
+
}),
|
|
43
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
44
|
+
className: "flex-1 overflow-auto p-4 space-y-5",
|
|
45
|
+
children: [
|
|
46
|
+
/*#__PURE__*/ _jsx("div", {
|
|
47
|
+
className: sectionClass,
|
|
48
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
49
|
+
children: [
|
|
50
|
+
/*#__PURE__*/ _jsx("label", {
|
|
51
|
+
htmlFor: `node-type-${node.id}`,
|
|
52
|
+
className: labelClass,
|
|
53
|
+
children: "Type"
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
56
|
+
id: `node-type-${node.id}`,
|
|
57
|
+
className: inputClass,
|
|
58
|
+
value: nodeType,
|
|
59
|
+
onChange: (e)=>onUpdate(node.id, {
|
|
60
|
+
...data,
|
|
61
|
+
nodeType: e.target.value
|
|
62
|
+
}),
|
|
63
|
+
children: [
|
|
64
|
+
/*#__PURE__*/ _jsx("option", {
|
|
65
|
+
value: "step",
|
|
66
|
+
children: "Step"
|
|
67
|
+
}),
|
|
68
|
+
/*#__PURE__*/ _jsx("option", {
|
|
69
|
+
value: "verifier",
|
|
70
|
+
children: "Verifier"
|
|
71
|
+
}),
|
|
72
|
+
/*#__PURE__*/ _jsx("option", {
|
|
73
|
+
value: "notification",
|
|
74
|
+
children: "Notification"
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
})
|
|
80
|
+
}),
|
|
81
|
+
/*#__PURE__*/ _jsx("div", {
|
|
82
|
+
className: sectionClass,
|
|
83
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
84
|
+
children: [
|
|
85
|
+
/*#__PURE__*/ _jsx("label", {
|
|
86
|
+
htmlFor: `node-name-${node.id}`,
|
|
87
|
+
className: labelClass,
|
|
88
|
+
children: "Name"
|
|
89
|
+
}),
|
|
90
|
+
/*#__PURE__*/ _jsx("input", {
|
|
91
|
+
id: `node-name-${node.id}`,
|
|
92
|
+
type: "text",
|
|
93
|
+
className: inputClass,
|
|
94
|
+
value: String(data.label || ""),
|
|
95
|
+
onChange: (e)=>onUpdate(node.id, {
|
|
96
|
+
...data,
|
|
97
|
+
label: e.target.value
|
|
98
|
+
}),
|
|
99
|
+
placeholder: "Node name"
|
|
100
|
+
})
|
|
101
|
+
]
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
/*#__PURE__*/ _jsx("div", {
|
|
105
|
+
className: sectionClass,
|
|
106
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
107
|
+
children: [
|
|
108
|
+
/*#__PURE__*/ _jsx("label", {
|
|
109
|
+
htmlFor: `node-desc-${node.id}`,
|
|
110
|
+
className: labelClass,
|
|
111
|
+
children: "Description"
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ _jsx("textarea", {
|
|
114
|
+
id: `node-desc-${node.id}`,
|
|
115
|
+
className: `${inputClass} resize-none`,
|
|
116
|
+
rows: 3,
|
|
117
|
+
value: String(data.description || ""),
|
|
118
|
+
onChange: (e)=>onUpdate(node.id, {
|
|
119
|
+
...data,
|
|
120
|
+
description: e.target.value
|
|
121
|
+
}),
|
|
122
|
+
placeholder: "Node description"
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
})
|
|
126
|
+
}),
|
|
127
|
+
/*#__PURE__*/ _jsx("div", {
|
|
128
|
+
className: sectionClass,
|
|
129
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
130
|
+
children: [
|
|
131
|
+
/*#__PURE__*/ _jsx("label", {
|
|
132
|
+
htmlFor: `node-order-${node.id}`,
|
|
133
|
+
className: labelClass,
|
|
134
|
+
children: "Step Order"
|
|
135
|
+
}),
|
|
136
|
+
/*#__PURE__*/ _jsx("input", {
|
|
137
|
+
id: `node-order-${node.id}`,
|
|
138
|
+
type: "number",
|
|
139
|
+
className: inputClass,
|
|
140
|
+
value: Number(data.stepOrder || 0),
|
|
141
|
+
onChange: (e)=>onUpdate(node.id, {
|
|
142
|
+
...data,
|
|
143
|
+
stepOrder: Number.parseInt(e.target.value, 10) || 0
|
|
144
|
+
}),
|
|
145
|
+
min: 0
|
|
146
|
+
})
|
|
147
|
+
]
|
|
148
|
+
})
|
|
149
|
+
}),
|
|
150
|
+
nodeType === "verifier" && /*#__PURE__*/ _jsxs("div", {
|
|
151
|
+
className: sectionClass,
|
|
152
|
+
children: [
|
|
153
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
154
|
+
children: [
|
|
155
|
+
/*#__PURE__*/ _jsx("label", {
|
|
156
|
+
htmlFor: `node-vtype-${node.id}`,
|
|
157
|
+
className: labelClass,
|
|
158
|
+
children: "Verifier Type"
|
|
159
|
+
}),
|
|
160
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
161
|
+
id: `node-vtype-${node.id}`,
|
|
162
|
+
className: inputClass,
|
|
163
|
+
value: String(data.verifierType || "role"),
|
|
164
|
+
onChange: (e)=>onUpdate(node.id, {
|
|
165
|
+
...data,
|
|
166
|
+
verifierType: e.target.value
|
|
167
|
+
}),
|
|
168
|
+
children: [
|
|
169
|
+
/*#__PURE__*/ _jsx("option", {
|
|
170
|
+
value: "role",
|
|
171
|
+
children: "Role"
|
|
172
|
+
}),
|
|
173
|
+
/*#__PURE__*/ _jsx("option", {
|
|
174
|
+
value: "user",
|
|
175
|
+
children: "Specific User"
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
})
|
|
179
|
+
]
|
|
180
|
+
}),
|
|
181
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
182
|
+
children: [
|
|
183
|
+
/*#__PURE__*/ _jsx("label", {
|
|
184
|
+
htmlFor: `node-vval-${node.id}`,
|
|
185
|
+
className: labelClass,
|
|
186
|
+
children: String(data.verifierType || "role") === "role" ? "Role Name" : "User ID"
|
|
187
|
+
}),
|
|
188
|
+
/*#__PURE__*/ _jsx("input", {
|
|
189
|
+
id: `node-vval-${node.id}`,
|
|
190
|
+
type: "text",
|
|
191
|
+
className: inputClass,
|
|
192
|
+
value: String(data.verifierValue || ""),
|
|
193
|
+
onChange: (e)=>onUpdate(node.id, {
|
|
194
|
+
...data,
|
|
195
|
+
verifierValue: e.target.value
|
|
196
|
+
}),
|
|
197
|
+
placeholder: String(data.verifierType || "role") === "role" ? "e.g. manager" : "e.g. user-uuid"
|
|
198
|
+
})
|
|
199
|
+
]
|
|
200
|
+
}),
|
|
201
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
202
|
+
className: "flex items-center gap-2",
|
|
203
|
+
children: [
|
|
204
|
+
/*#__PURE__*/ _jsx("input", {
|
|
205
|
+
type: "checkbox",
|
|
206
|
+
id: `node-sig-${node.id}`,
|
|
207
|
+
checked: Boolean(data.requireSignature),
|
|
208
|
+
onChange: (e)=>onUpdate(node.id, {
|
|
209
|
+
...data,
|
|
210
|
+
requireSignature: e.target.checked
|
|
211
|
+
}),
|
|
212
|
+
className: "rounded border-zinc-300 dark:border-zinc-600"
|
|
213
|
+
}),
|
|
214
|
+
/*#__PURE__*/ _jsx("label", {
|
|
215
|
+
htmlFor: `node-sig-${node.id}`,
|
|
216
|
+
className: "text-xs text-zinc-700 dark:text-zinc-300",
|
|
217
|
+
children: "Require Signature"
|
|
218
|
+
})
|
|
219
|
+
]
|
|
220
|
+
})
|
|
221
|
+
]
|
|
222
|
+
}),
|
|
223
|
+
nodeType === "notification" && /*#__PURE__*/ _jsxs("div", {
|
|
224
|
+
className: sectionClass,
|
|
225
|
+
children: [
|
|
226
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
227
|
+
children: [
|
|
228
|
+
/*#__PURE__*/ _jsx("label", {
|
|
229
|
+
htmlFor: `node-channel-${node.id}`,
|
|
230
|
+
className: labelClass,
|
|
231
|
+
children: "Channel"
|
|
232
|
+
}),
|
|
233
|
+
/*#__PURE__*/ _jsxs("select", {
|
|
234
|
+
id: `node-channel-${node.id}`,
|
|
235
|
+
className: inputClass,
|
|
236
|
+
value: String(data.channel || "portal"),
|
|
237
|
+
onChange: (e)=>onUpdate(node.id, {
|
|
238
|
+
...data,
|
|
239
|
+
channel: e.target.value
|
|
240
|
+
}),
|
|
241
|
+
children: [
|
|
242
|
+
/*#__PURE__*/ _jsx("option", {
|
|
243
|
+
value: "portal",
|
|
244
|
+
children: "Portal"
|
|
245
|
+
}),
|
|
246
|
+
/*#__PURE__*/ _jsx("option", {
|
|
247
|
+
value: "email",
|
|
248
|
+
children: "Email"
|
|
249
|
+
}),
|
|
250
|
+
/*#__PURE__*/ _jsx("option", {
|
|
251
|
+
value: "both",
|
|
252
|
+
children: "Email + Portal"
|
|
253
|
+
})
|
|
254
|
+
]
|
|
255
|
+
})
|
|
256
|
+
]
|
|
257
|
+
}),
|
|
258
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
259
|
+
children: [
|
|
260
|
+
/*#__PURE__*/ _jsx("label", {
|
|
261
|
+
htmlFor: `node-tpl-${node.id}`,
|
|
262
|
+
className: labelClass,
|
|
263
|
+
children: "Template"
|
|
264
|
+
}),
|
|
265
|
+
/*#__PURE__*/ _jsx("input", {
|
|
266
|
+
id: `node-tpl-${node.id}`,
|
|
267
|
+
type: "text",
|
|
268
|
+
className: inputClass,
|
|
269
|
+
value: String(data.template || ""),
|
|
270
|
+
onChange: (e)=>onUpdate(node.id, {
|
|
271
|
+
...data,
|
|
272
|
+
template: e.target.value
|
|
273
|
+
}),
|
|
274
|
+
placeholder: "Notification template"
|
|
275
|
+
})
|
|
276
|
+
]
|
|
277
|
+
})
|
|
278
|
+
]
|
|
279
|
+
}),
|
|
280
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
281
|
+
className: "flex items-center gap-2 text-xs text-zinc-400 dark:text-zinc-500 pt-2 border-t border-zinc-100 dark:border-zinc-800",
|
|
282
|
+
children: [
|
|
283
|
+
/*#__PURE__*/ _jsx("span", {
|
|
284
|
+
children: "Position:"
|
|
285
|
+
}),
|
|
286
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
287
|
+
children: [
|
|
288
|
+
"x: ",
|
|
289
|
+
Math.round(node.position.x),
|
|
290
|
+
", y: ",
|
|
291
|
+
Math.round(node.position.y)
|
|
292
|
+
]
|
|
293
|
+
})
|
|
294
|
+
]
|
|
295
|
+
})
|
|
296
|
+
]
|
|
297
|
+
}),
|
|
298
|
+
/*#__PURE__*/ _jsx("div", {
|
|
299
|
+
className: "px-4 py-3 border-t border-zinc-200 dark:border-zinc-800",
|
|
300
|
+
children: /*#__PURE__*/ _jsx("button", {
|
|
301
|
+
type: "button",
|
|
302
|
+
onClick: ()=>onDelete(node.id),
|
|
303
|
+
className: "w-full rounded-lg bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 px-3 py-2 text-xs font-medium text-red-600 dark:text-red-400 hover:bg-red-100 dark:hover:bg-red-900/30 transition-colors",
|
|
304
|
+
children: "Delete Node"
|
|
305
|
+
})
|
|
306
|
+
})
|
|
307
|
+
]
|
|
308
|
+
});
|
|
309
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactElement } from "react";
|
|
2
|
+
import type { VerificationDecideAction, VerificationPendingAction } from "../types";
|
|
3
|
+
interface PendingTabProps {
|
|
4
|
+
pendingAction: VerificationPendingAction;
|
|
5
|
+
decideAction: VerificationDecideAction;
|
|
6
|
+
onDecisionMade?: (entityName: string, entityId: string) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare function PendingTab({ pendingAction, decideAction, onDecisionMade, }: PendingTabProps): ReactElement;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=PendingTab.d.ts.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useEffectEvent } from "react";
|
|
4
|
+
import { useVerificationFlowStore } from "../store";
|
|
5
|
+
import { verificationFlowPageTheme } from "../theme";
|
|
6
|
+
export function PendingTab({ pendingAction, decideAction, onDecisionMade }) {
|
|
7
|
+
const theme = verificationFlowPageTheme;
|
|
8
|
+
const store = useVerificationFlowStore();
|
|
9
|
+
const loadPending = useEffectEvent(()=>{
|
|
10
|
+
store.setLoadingPending(true);
|
|
11
|
+
pendingAction.start({
|
|
12
|
+
payload: undefined,
|
|
13
|
+
onAfterHandle: (res)=>{
|
|
14
|
+
const data = res.data;
|
|
15
|
+
store.setPendingItems(data ?? []);
|
|
16
|
+
store.setLoadingPending(false);
|
|
17
|
+
},
|
|
18
|
+
onErrorHandle: ()=>{
|
|
19
|
+
store.setLoadingPending(false);
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
useEffect(()=>{
|
|
24
|
+
loadPending();
|
|
25
|
+
}, []);
|
|
26
|
+
const handleDecide = useEffectEvent((item, decision)=>{
|
|
27
|
+
decideAction.start({
|
|
28
|
+
payload: {
|
|
29
|
+
entity_name: item.entity_name,
|
|
30
|
+
entity_id: item.entity_id,
|
|
31
|
+
decision,
|
|
32
|
+
reason: store.decisionReason || undefined
|
|
33
|
+
},
|
|
34
|
+
onAfterHandle: ()=>{
|
|
35
|
+
store.setDecidingId(null);
|
|
36
|
+
store.setDecisionReason("");
|
|
37
|
+
onDecisionMade?.(item.entity_name, item.entity_id);
|
|
38
|
+
loadPending();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
if (store.isLoadingPending) {
|
|
43
|
+
return /*#__PURE__*/ _jsx("div", {
|
|
44
|
+
className: "flex items-center justify-center py-20",
|
|
45
|
+
children: /*#__PURE__*/ _jsx("div", {
|
|
46
|
+
className: theme.loading.spinner
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
if (store.pendingItems.length === 0) {
|
|
51
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
52
|
+
className: theme.pending.empty.container,
|
|
53
|
+
children: [
|
|
54
|
+
/*#__PURE__*/ _jsxs("svg", {
|
|
55
|
+
className: theme.pending.empty.icon,
|
|
56
|
+
fill: "none",
|
|
57
|
+
viewBox: "0 0 24 24",
|
|
58
|
+
stroke: "currentColor",
|
|
59
|
+
children: [
|
|
60
|
+
/*#__PURE__*/ _jsx("title", {
|
|
61
|
+
children: "No pending items"
|
|
62
|
+
}),
|
|
63
|
+
/*#__PURE__*/ _jsx("path", {
|
|
64
|
+
strokeLinecap: "round",
|
|
65
|
+
strokeLinejoin: "round",
|
|
66
|
+
strokeWidth: 1,
|
|
67
|
+
d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
}),
|
|
71
|
+
/*#__PURE__*/ _jsx("p", {
|
|
72
|
+
className: theme.pending.empty.text,
|
|
73
|
+
children: "No pending verifications"
|
|
74
|
+
})
|
|
75
|
+
]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
79
|
+
className: theme.pending.container,
|
|
80
|
+
children: [
|
|
81
|
+
/*#__PURE__*/ _jsxs("h2", {
|
|
82
|
+
className: theme.pending.title,
|
|
83
|
+
children: [
|
|
84
|
+
"Pending Approvals (",
|
|
85
|
+
store.pendingItems.length,
|
|
86
|
+
")"
|
|
87
|
+
]
|
|
88
|
+
}),
|
|
89
|
+
store.pendingItems.map((item)=>/*#__PURE__*/ _jsx("div", {
|
|
90
|
+
className: theme.pending.card.container,
|
|
91
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
92
|
+
className: "flex items-center justify-between",
|
|
93
|
+
children: [
|
|
94
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
95
|
+
children: [
|
|
96
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
97
|
+
className: theme.pending.card.title,
|
|
98
|
+
children: [
|
|
99
|
+
item.flow_name,
|
|
100
|
+
" — Step ",
|
|
101
|
+
item.step_order
|
|
102
|
+
]
|
|
103
|
+
}),
|
|
104
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
105
|
+
className: theme.pending.card.subtitle,
|
|
106
|
+
children: [
|
|
107
|
+
item.entity_name,
|
|
108
|
+
"/",
|
|
109
|
+
item.entity_id
|
|
110
|
+
]
|
|
111
|
+
})
|
|
112
|
+
]
|
|
113
|
+
}),
|
|
114
|
+
store.decidingId === item.instance_id ? /*#__PURE__*/ _jsxs("div", {
|
|
115
|
+
className: theme.pending.card.actions,
|
|
116
|
+
children: [
|
|
117
|
+
/*#__PURE__*/ _jsx("input", {
|
|
118
|
+
type: "text",
|
|
119
|
+
placeholder: "Reason (optional)",
|
|
120
|
+
value: store.decisionReason,
|
|
121
|
+
onChange: (e)=>store.setDecisionReason(e.target.value),
|
|
122
|
+
className: theme.pending.input
|
|
123
|
+
}),
|
|
124
|
+
/*#__PURE__*/ _jsx("button", {
|
|
125
|
+
type: "button",
|
|
126
|
+
onClick: ()=>handleDecide(item, "approved"),
|
|
127
|
+
className: theme.pending.approveButton,
|
|
128
|
+
children: "Approve"
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ _jsx("button", {
|
|
131
|
+
type: "button",
|
|
132
|
+
onClick: ()=>handleDecide(item, "rejected"),
|
|
133
|
+
className: theme.pending.rejectButton,
|
|
134
|
+
children: "Reject"
|
|
135
|
+
}),
|
|
136
|
+
/*#__PURE__*/ _jsx("button", {
|
|
137
|
+
type: "button",
|
|
138
|
+
onClick: ()=>{
|
|
139
|
+
store.setDecidingId(null);
|
|
140
|
+
store.setDecisionReason("");
|
|
141
|
+
},
|
|
142
|
+
className: theme.pending.cancelButton,
|
|
143
|
+
children: "Cancel"
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
}) : /*#__PURE__*/ _jsx("button", {
|
|
147
|
+
type: "button",
|
|
148
|
+
onClick: ()=>store.setDecidingId(item.instance_id),
|
|
149
|
+
className: theme.pending.reviewButton,
|
|
150
|
+
children: "Review"
|
|
151
|
+
})
|
|
152
|
+
]
|
|
153
|
+
})
|
|
154
|
+
}, `${item.instance_id}-${item.step_order}`))
|
|
155
|
+
]
|
|
156
|
+
});
|
|
157
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import "@xyflow/react/dist/style.css";
|
|
2
|
+
import type { ReactElement } from "react";
|
|
3
|
+
import type { VerificationFlowPageProps } from "../types";
|
|
4
|
+
export declare function VerificationFlowPage({ entityName, title, subtitle, flowListAction, flowGetAction, flowSaveAction, pendingAction, decideAction, onFlowSelected, onDecisionMade, showPending, className, }: VerificationFlowPageProps): ReactElement;
|
|
5
|
+
//# sourceMappingURL=VerificationFlowPage.d.ts.map
|