@object-ui/plugin-workflow 3.0.2 → 3.1.0

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.
@@ -1,6 +1,7 @@
1
- (function(N,S){typeof exports=="object"&&typeof module<"u"?S(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react")):typeof define=="function"&&define.amd?define(["exports","@object-ui/core","react","@object-ui/components","lucide-react"],S):(N=typeof globalThis<"u"?globalThis:N||self,S(N.ObjectUIPluginWorkflow={},N.ObjectUICore,N.React,N.ObjectUIComponents,N.lucideReact))})(this,(function(N,S,j,a,d){"use strict";var I={exports:{}},R={};var J;function te(){if(J)return R;J=1;var g=Symbol.for("react.transitional.element"),C=Symbol.for("react.fragment");function n(y,l,m){var b=null;if(m!==void 0&&(b=""+m),l.key!==void 0&&(b=""+l.key),"key"in l){m={};for(var v in l)v!=="key"&&(m[v]=l[v])}else m=l;return l=m.ref,{$$typeof:g,type:y,key:b,ref:l!==void 0?l:null,props:m}}return R.Fragment=C,R.jsx=n,R.jsxs=n,R}var O={};var X;function le(){return X||(X=1,process.env.NODE_ENV!=="production"&&(function(){function g(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===ce?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case P:return"Fragment";case D:return"Profiler";case U:return"StrictMode";case h:return"Suspense";case p:return"SuspenseList";case de:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case Y:return"Portal";case r:return s.displayName||"Context";case F:return(s._context.displayName||"Context")+".Consumer";case i:var t=s.render;return s=s.displayName,s||(s=t.displayName||t.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case B:return t=s.displayName||null,t!==null?t:g(s.type)||"Memo";case M:t=s._payload,s=s._init;try{return g(s(t))}catch{}}return null}function C(s){return""+s}function n(s){try{C(s);var t=!1}catch{t=!0}if(t){t=console;var u=t.error,x=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return u.call(t,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",x),C(s)}}function y(s){if(s===P)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===M)return"<...>";try{var t=g(s);return t?"<"+t+">":"<...>"}catch{return"<...>"}}function l(){var s=z.A;return s===null?null:s.getOwner()}function m(){return Error("react-stack-top-frame")}function b(s){if($.call(s,"key")){var t=Object.getOwnPropertyDescriptor(s,"key").get;if(t&&t.isReactWarning)return!1}return s.key!==void 0}function v(s,t){function u(){K||(K=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",t))}u.isReactWarning=!0,Object.defineProperty(s,"key",{get:u,configurable:!0})}function _(){var s=g(this.type);return ee[s]||(ee[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function k(s,t,u,x,L,H){var f=u.ref;return s={$$typeof:T,type:s,key:t,props:u,_owner:x},(f!==void 0?f:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:_}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:L}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:H}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function o(s,t,u,x,L,H){var f=t.children;if(f!==void 0)if(x)if(ue(f)){for(x=0;x<f.length;x++)E(f[x]);Object.freeze&&Object.freeze(f)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else E(f);if($.call(t,"key")){f=g(s);var A=Object.keys(t).filter(function(me){return me!=="key"});x=0<A.length?"{key: someKey, "+A.join(": ..., ")+": ...}":"{key: someKey}",ae[f+x]||(A=0<A.length?"{"+A.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
1
+ (function(L,Y){typeof exports=="object"&&typeof module<"u"?Y(exports,require("@object-ui/core"),require("react"),require("@object-ui/components"),require("lucide-react"),require("clsx"),require("tailwind-merge")):typeof define=="function"&&define.amd?define(["exports","@object-ui/core","react","@object-ui/components","lucide-react","clsx","tailwind-merge"],Y):(L=typeof globalThis<"u"?globalThis:L||self,Y(L.ObjectUIPluginWorkflow={},L.ObjectUICore,L.React,L.ObjectUIComponents,L.lucideReact,L.clsx,L.tailwindMerge))})(this,(function(L,Y,h,a,o,Be,Re){"use strict";var de={exports:{}},se={};var ve;function Ve(){if(ve)return se;ve=1;var n=Symbol.for("react.transitional.element"),u=Symbol.for("react.fragment");function l(x,d,t){var m=null;if(t!==void 0&&(m=""+t),d.key!==void 0&&(m=""+d.key),"key"in d){t={};for(var f in d)f!=="key"&&(t[f]=d[f])}else t=d;return d=t.ref,{$$typeof:n,type:x,key:m,ref:d!==void 0?d:null,props:t}}return se.Fragment=u,se.jsx=l,se.jsxs=l,se}var te={};var ye;function Fe(){return ye||(ye=1,process.env.NODE_ENV!=="production"&&(function(){function n(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===M?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case c:return"Fragment";case _:return"Profiler";case v:return"StrictMode";case P:return"Suspense";case B:return"SuspenseList";case E:return"Activity"}if(typeof s=="object")switch(typeof s.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),s.$$typeof){case $:return"Portal";case r:return s.displayName||"Context";case T:return(s._context.displayName||"Context")+".Consumer";case b:var g=s.render;return s=s.displayName,s||(s=g.displayName||g.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case ee:return g=s.displayName||null,g!==null?g:n(s.type)||"Memo";case y:g=s._payload,s=s._init;try{return n(s(g))}catch{}}return null}function u(s){return""+s}function l(s){try{u(s);var g=!1}catch{g=!0}if(g){g=console;var C=g.error,A=typeof Symbol=="function"&&Symbol.toStringTag&&s[Symbol.toStringTag]||s.constructor.name||"Object";return C.call(g,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",A),u(s)}}function x(s){if(s===c)return"<>";if(typeof s=="object"&&s!==null&&s.$$typeof===y)return"<...>";try{var g=n(s);return g?"<"+g+">":"<...>"}catch{return"<...>"}}function d(){var s=U.A;return s===null?null:s.getOwner()}function t(){return Error("react-stack-top-frame")}function m(s){if(F.call(s,"key")){var g=Object.getOwnPropertyDescriptor(s,"key").get;if(g&&g.isReactWarning)return!1}return s.key!==void 0}function f(s,g){function C(){Z||(Z=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",g))}C.isReactWarning=!0,Object.defineProperty(s,"key",{get:C,configurable:!0})}function D(){var s=n(this.type);return z[s]||(z[s]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),s=this.props.ref,s!==void 0?s:null}function O(s,g,C,A,W,K){var k=C.ref;return s={$$typeof:R,type:s,key:g,props:C,_owner:A},(k!==void 0?k:null)!==null?Object.defineProperty(s,"ref",{enumerable:!1,get:D}):Object.defineProperty(s,"ref",{enumerable:!1,value:null}),s._store={},Object.defineProperty(s._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(s,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(s,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:W}),Object.defineProperty(s,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:K}),Object.freeze&&(Object.freeze(s.props),Object.freeze(s)),s}function j(s,g,C,A,W,K){var k=g.children;if(k!==void 0)if(A)if(X(k)){for(A=0;A<k.length;A++)S(k[A]);Object.freeze&&Object.freeze(k)}else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else S(k);if(F.call(g,"key")){k=n(s);var G=Object.keys(g).filter(function(ce){return ce!=="key"});A=0<G.length?"{key: someKey, "+G.join(": ..., ")+": ...}":"{key: someKey}",ue[k+A]||(G=0<G.length?"{"+G.join(": ..., ")+": ...}":"{}",console.error(`A props object containing a "key" prop is being spread into JSX:
2
2
  let props = %s;
3
3
  <%s {...props} />
4
4
  React keys must be passed directly to JSX without using spread:
5
5
  let props = %s;
6
- <%s key={someKey} {...props} />`,x,f,A,f),ae[f+x]=!0)}if(f=null,u!==void 0&&(n(u),f=""+u),b(t)&&(n(t.key),f=""+t.key),"key"in t){u={};for(var G in t)G!=="key"&&(u[G]=t[G])}else u=t;return f&&v(u,typeof s=="function"?s.displayName||s.name||"Unknown":s),k(s,f,u,l(),L,H)}function E(s){w(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===M&&(s._payload.status==="fulfilled"?w(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function w(s){return typeof s=="object"&&s!==null&&s.$$typeof===T}var c=j,T=Symbol.for("react.transitional.element"),Y=Symbol.for("react.portal"),P=Symbol.for("react.fragment"),U=Symbol.for("react.strict_mode"),D=Symbol.for("react.profiler"),F=Symbol.for("react.consumer"),r=Symbol.for("react.context"),i=Symbol.for("react.forward_ref"),h=Symbol.for("react.suspense"),p=Symbol.for("react.suspense_list"),B=Symbol.for("react.memo"),M=Symbol.for("react.lazy"),de=Symbol.for("react.activity"),ce=Symbol.for("react.client.reference"),z=c.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=Object.prototype.hasOwnProperty,ue=Array.isArray,V=console.createTask?console.createTask:function(){return null};c={react_stack_bottom_frame:function(s){return s()}};var K,ee={},se=c.react_stack_bottom_frame.bind(c,m)(),re=V(y(m)),ae={};O.Fragment=P,O.jsx=function(s,t,u){var x=1e4>z.recentlyCreatedOwnerStacks++;return o(s,t,u,!1,x?Error("react-stack-top-frame"):se,x?V(y(s)):re)},O.jsxs=function(s,t,u){var x=1e4>z.recentlyCreatedOwnerStacks++;return o(s,t,u,!0,x?Error("react-stack-top-frame"):se,x?V(y(s)):re)}})()),O}var q;function ne(){return q||(q=1,process.env.NODE_ENV==="production"?I.exports=te():I.exports=le()),I.exports}var e=ne();const W={start:e.jsx(d.Play,{className:"h-4 w-4 text-green-500"}),end:e.jsx(d.CheckCircle,{className:"h-4 w-4 text-red-500"}),task:e.jsx(d.Circle,{className:"h-4 w-4 text-blue-500"}),approval:e.jsx(d.Users,{className:"h-4 w-4 text-purple-500"}),condition:e.jsx(d.GitBranch,{className:"h-4 w-4 text-orange-500"}),parallel:e.jsx(d.ArrowRight,{className:"h-4 w-4 text-teal-500"}),delay:e.jsx(d.Clock,{className:"h-4 w-4 text-gray-500"}),notification:e.jsx(d.Bell,{className:"h-4 w-4 text-yellow-500"}),script:e.jsx(d.Code,{className:"h-4 w-4 text-indigo-500"})},ie={start:"border-green-300 bg-green-50",end:"border-red-300 bg-red-50",task:"border-blue-300 bg-blue-50",approval:"border-purple-300 bg-purple-50",condition:"border-orange-300 bg-orange-50",parallel:"border-teal-300 bg-teal-50",delay:"border-gray-300 bg-gray-50",notification:"border-yellow-300 bg-yellow-50",script:"border-indigo-300 bg-indigo-50"},oe={draft:{variant:"secondary",label:"Draft"},active:{variant:"default",label:"Active"},paused:{variant:"outline",label:"Paused"},completed:{variant:"default",label:"Completed"},cancelled:{variant:"destructive",label:"Cancelled"}},Q=({schema:g})=>{const{workflow:C,readOnly:n=!1,showToolbar:y=!0}=g,[l,m]=j.useState(C||{type:"workflow",title:"New Workflow",status:"draft",nodes:[{id:"start-1",type:"start",label:"Start",position:{x:100,y:100}},{id:"end-1",type:"end",label:"End",position:{x:100,y:400}}],edges:[],variables:[]}),[b,v]=j.useState(null),[_,k]=j.useState(null),o=j.useMemo(()=>l.nodes.find(r=>r.id===b),[l.nodes,b]),E=j.useCallback(r=>{if(n)return;const i=`${r}-${Date.now()}`,h={id:i,type:r,label:`New ${r.charAt(0).toUpperCase()+r.slice(1)}`,position:{x:200,y:(l.nodes.length+1)*80}};m(p=>({...p,nodes:[...p.nodes,h]})),v(i)},[n,l.nodes.length]),w=j.useCallback((r,i)=>{n||m(h=>({...h,nodes:h.nodes.map(p=>p.id===r?{...p,...i}:p)}))},[n]),c=j.useCallback(r=>{n||(m(i=>({...i,nodes:i.nodes.filter(h=>h.id!==r),edges:i.edges.filter(h=>h.source!==r&&h.target!==r)})),b===r&&v(null))},[n,b]),T=j.useCallback((r,i)=>{if(n)return;const p={id:`edge-${Date.now()}`,source:r,target:i};m(B=>({...B,edges:[...B.edges,p]}))},[n]),Y=j.useCallback(r=>{n||(m(i=>({...i,edges:i.edges.filter(h=>h.id!==r)})),_===r&&k(null))},[n,_]),P=()=>{console.log("Saving workflow:",l),g.onSave},U=()=>{m(r=>({...r,status:"active"})),console.log("Publishing workflow"),g.onPublish},D=oe[l.status||"draft"],F=["task","approval","condition","parallel","delay","notification","script"];return e.jsxs("div",{className:"space-y-4",children:[y&&e.jsxs("div",{className:"flex items-center justify-between gap-2 p-4 bg-card rounded-lg border",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{children:e.jsx(a.Input,{value:l.title||"",onChange:r=>m(i=>({...i,title:r.target.value})),className:"text-lg font-semibold border-none p-0 h-auto focus-visible:ring-0",readOnly:n,placeholder:"Workflow Title"})}),e.jsx(a.Badge,{variant:D.variant,children:D.label})]}),!n&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a.Button,{variant:"outline",size:"sm",onClick:P,children:[e.jsx(d.Save,{className:"h-4 w-4 mr-2"}),"Save"]}),e.jsxs(a.Button,{size:"sm",onClick:U,disabled:l.status==="active",children:[e.jsx(d.Play,{className:"h-4 w-4 mr-2"}),"Publish"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-4",children:[!n&&e.jsxs(a.Card,{className:"lg:col-span-1",children:[e.jsx(a.CardHeader,{children:e.jsx(a.CardTitle,{className:"text-sm",children:"Add Node"})}),e.jsx(a.CardContent,{className:"space-y-2",children:F.map(r=>e.jsxs("button",{onClick:()=>E(r),className:"w-full flex items-center gap-2 p-2 rounded-md border hover:bg-muted/50 transition-colors text-sm",children:[W[r],e.jsx("span",{className:"capitalize",children:r})]},r))})]}),e.jsxs(a.Card,{className:n?"lg:col-span-3":"lg:col-span-2",children:[e.jsx(a.CardHeader,{children:e.jsxs(a.CardTitle,{className:"text-sm flex items-center gap-2",children:[e.jsx(d.GitBranch,{className:"h-4 w-4"}),"Workflow Flow"]})}),e.jsx(a.CardContent,{children:e.jsxs("div",{className:"space-y-2",children:[l.nodes.map(r=>e.jsxs("div",{onClick:()=>{v(r.id),k(null)},className:`flex items-center justify-between p-3 rounded-lg border-2 cursor-pointer transition-all ${ie[r.type]} ${b===r.id?"ring-2 ring-primary shadow-md":"hover:shadow-sm"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[W[r.type],e.jsx("span",{className:"font-medium text-sm",children:r.label}),e.jsxs("span",{className:"text-xs text-muted-foreground capitalize",children:["(",r.type,")"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[l.edges.filter(i=>i.source===r.id).length>0&&e.jsxs(a.Badge,{variant:"outline",className:"text-xs",children:[l.edges.filter(i=>i.source===r.id).length," out"]}),!n&&r.type!=="start"&&r.type!=="end"&&e.jsx(a.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-500 hover:text-red-700",onClick:i=>{i.stopPropagation(),c(r.id)},children:e.jsx(d.Trash2,{className:"h-3 w-3"})})]})]},r.id)),l.edges.length>0&&e.jsxs("div",{className:"mt-4 pt-4 border-t",children:[e.jsx(a.Label,{className:"text-xs text-muted-foreground mb-2 block",children:"Connections"}),l.edges.map(r=>{const i=l.nodes.find(p=>p.id===r.source),h=l.nodes.find(p=>p.id===r.target);return e.jsxs("div",{className:"flex items-center gap-2 p-2 text-sm",children:[e.jsx("span",{children:i?.label||r.source}),e.jsx(d.ArrowRight,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{children:h?.label||r.target}),r.label&&e.jsx(a.Badge,{variant:"outline",className:"text-xs",children:r.label}),!n&&e.jsx(a.Button,{size:"sm",variant:"ghost",className:"h-5 w-5 p-0 ml-auto text-red-500",onClick:()=>Y(r.id),children:e.jsx(d.Trash2,{className:"h-3 w-3"})})]},r.id)})]}),!n&&l.nodes.length>=2&&e.jsxs("div",{className:"mt-4 pt-4 border-t",children:[e.jsx(a.Label,{className:"text-xs text-muted-foreground mb-2 block",children:"Quick Connect"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("select",{id:"edge-source",className:"border rounded-md p-1.5 text-sm bg-background",children:[e.jsx("option",{value:"",children:"From..."}),l.nodes.filter(r=>r.type!=="end").map(r=>e.jsx("option",{value:r.id,children:r.label},r.id))]}),e.jsxs("select",{id:"edge-target",className:"border rounded-md p-1.5 text-sm bg-background",children:[e.jsx("option",{value:"",children:"To..."}),l.nodes.filter(r=>r.type!=="start").map(r=>e.jsx("option",{value:r.id,children:r.label},r.id))]})]}),e.jsxs(a.Button,{size:"sm",variant:"outline",className:"mt-2 w-full",onClick:()=>{const r=document.getElementById("edge-source")?.value,i=document.getElementById("edge-target")?.value;r&&i&&r!==i&&T(r,i)},children:[e.jsx(d.Plus,{className:"h-3 w-3 mr-1"}),"Connect"]})]})]})})]}),e.jsxs(a.Card,{className:"lg:col-span-1",children:[e.jsx(a.CardHeader,{children:e.jsxs(a.CardTitle,{className:"text-sm flex items-center gap-2",children:[e.jsx(d.Settings,{className:"h-4 w-4"}),"Properties"]})}),e.jsx(a.CardContent,{children:o?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Label"}),e.jsx(a.Input,{value:o.label,onChange:r=>w(o.id,{label:r.target.value}),className:"h-8 text-sm",readOnly:n})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Type"}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-md bg-muted text-sm",children:[W[o.type],e.jsx("span",{className:"capitalize",children:o.type})]})]}),o.description!==void 0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Description"}),e.jsx(a.Input,{value:o.description||"",onChange:r=>w(o.id,{description:r.target.value}),className:"h-8 text-sm",readOnly:n})]}),(o.type==="approval"||o.type==="task")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Assignee"}),e.jsx(a.Input,{value:o.assignee||"",onChange:r=>w(o.id,{assignee:r.target.value}),className:"h-8 text-sm",placeholder:"User, role, or expression",readOnly:n})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Assignee Type"}),e.jsxs("select",{className:"w-full border rounded-md h-8 text-sm px-2 bg-background",value:o.assigneeType||"user",onChange:r=>w(o.id,{assigneeType:r.target.value}),disabled:n,children:[e.jsx("option",{value:"user",children:"User"}),e.jsx("option",{value:"role",children:"Role"}),e.jsx("option",{value:"group",children:"Group"}),e.jsx("option",{value:"expression",children:"Expression"})]})]})]}),o.type==="delay"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Timeout (minutes)"}),e.jsx(a.Input,{type:"number",value:o.timeout||60,onChange:r=>w(o.id,{timeout:Number(r.target.value)}),className:"h-8 text-sm",readOnly:n})]}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-2",children:["ID: ",o.id]})]}):e.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"Select a node to edit its properties"})})]})]})]})},Z=({schema:g})=>{const{currentNodeId:C,approvalRule:n,history:y=[],data:l,showHistory:m=!0,showComments:b=!0}=g,[v,_]=j.useState(""),[k,o]=j.useState(!1),E=c=>{o(!0),console.log(`Approval action: ${c}`,{currentNodeId:C,comment:v,data:l}),setTimeout(()=>{o(!1),_("")},500)},w=c=>{switch(c){case"approve":case"approved":return e.jsx(a.Badge,{variant:"default",className:"bg-green-500",children:"Approved"});case"reject":case"rejected":return e.jsx(a.Badge,{variant:"destructive",children:"Rejected"});case"reassign":case"reassigned":return e.jsx(a.Badge,{variant:"secondary",children:"Reassigned"});case"comment":return e.jsx(a.Badge,{variant:"outline",children:"Comment"});case"escalate":case"escalated":return e.jsx(a.Badge,{variant:"secondary",className:"bg-orange-500 text-white",children:"Escalated"});default:return e.jsx(a.Badge,{variant:"outline",children:c})}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(a.Card,{children:[e.jsx(a.CardHeader,{children:e.jsxs(a.CardTitle,{className:"flex items-center gap-2",children:[e.jsx(d.Clock,{className:"h-5 w-5"}),"Pending Approval",n&&e.jsxs(a.Badge,{variant:"outline",className:"ml-2",children:[n.type==="any"&&"Any approver",n.type==="all"&&"All must approve",n.type==="majority"&&"Majority approval",n.type==="sequential"&&"Sequential"]})]})}),e.jsxs(a.CardContent,{className:"space-y-4",children:[l&&Object.keys(l).length>0&&e.jsxs("div",{className:"p-3 bg-muted/50 rounded-lg",children:[e.jsx(a.Label,{className:"text-xs text-muted-foreground mb-2 block",children:"Request Details"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(l).slice(0,6).map(([c,T])=>e.jsxs("div",{className:"text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[c,": "]}),e.jsx("span",{className:"font-medium",children:String(T)})]},c))})]}),b&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(a.Label,{className:"flex items-center gap-2 text-sm",children:[e.jsx(d.MessageSquare,{className:"h-4 w-4"}),"Comment"]}),e.jsx(a.Input,{value:v,onChange:c=>_(c.target.value),placeholder:"Add a comment (optional)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a.Button,{onClick:()=>E("approve"),disabled:k,className:"bg-green-600 hover:bg-green-700",children:[e.jsx(d.Check,{className:"h-4 w-4 mr-2"}),"Approve"]}),e.jsxs(a.Button,{variant:"destructive",onClick:()=>E("reject"),disabled:k,children:[e.jsx(d.X,{className:"h-4 w-4 mr-2"}),"Reject"]}),e.jsxs(a.Button,{variant:"outline",onClick:()=>E("reassign"),disabled:k,children:[e.jsx(d.RefreshCw,{className:"h-4 w-4 mr-2"}),"Reassign"]})]})]})]}),m&&y.length>0&&e.jsxs(a.Card,{children:[e.jsx(a.CardHeader,{children:e.jsx(a.CardTitle,{className:"text-sm",children:"Approval History"})}),e.jsx(a.CardContent,{children:e.jsx("div",{className:"space-y-3",children:y.map((c,T)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx(d.User,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm",children:c.actorName||c.actor}),w(c.action),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(c.timestamp).toLocaleString()})]}),c.comment&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:c.comment})]})]},T))})})]}),m&&y.length===0&&e.jsx(a.Card,{children:e.jsx(a.CardContent,{className:"p-6 text-center text-muted-foreground text-sm",children:"No approval history yet"})})]})};S.ComponentRegistry.register("workflow-designer",Q,{label:"Workflow Designer",category:"Enterprise",inputs:[{name:"workflow",type:"code",label:"Initial Workflow Definition"},{name:"readOnly",type:"boolean",label:"Read Only",defaultValue:!1},{name:"showToolbar",type:"boolean",label:"Show Toolbar",defaultValue:!0},{name:"showMinimap",type:"boolean",label:"Show Minimap",defaultValue:!1}]}),S.ComponentRegistry.register("approval-process",Z,{label:"Approval Process",category:"Enterprise",inputs:[{name:"workflowId",type:"string",label:"Workflow ID"},{name:"instanceId",type:"string",label:"Instance ID"},{name:"currentNodeId",type:"string",label:"Current Node ID"},{name:"approvalRule",type:"code",label:"Approval Rule"},{name:"history",type:"code",label:"History"},{name:"showHistory",type:"boolean",label:"Show History",defaultValue:!0},{name:"showComments",type:"boolean",label:"Show Comments",defaultValue:!0}]}),N.ApprovalProcess=Z,N.WorkflowDesigner=Q,Object.defineProperty(N,Symbol.toStringTag,{value:"Module"})}));
6
+ <%s key={someKey} {...props} />`,A,k,G,k),ue[k+A]=!0)}if(k=null,C!==void 0&&(l(C),k=""+C),m(g)&&(l(g.key),k=""+g.key),"key"in g){C={};for(var ne in g)ne!=="key"&&(C[ne]=g[ne])}else C=g;return k&&f(C,typeof s=="function"?s.displayName||s.name||"Unknown":s),O(s,k,C,d(),W,K)}function S(s){w(s)?s._store&&(s._store.validated=1):typeof s=="object"&&s!==null&&s.$$typeof===y&&(s._payload.status==="fulfilled"?w(s._payload.value)&&s._payload.value._store&&(s._payload.value._store.validated=1):s._store&&(s._store.validated=1))}function w(s){return typeof s=="object"&&s!==null&&s.$$typeof===R}var N=h,R=Symbol.for("react.transitional.element"),$=Symbol.for("react.portal"),c=Symbol.for("react.fragment"),v=Symbol.for("react.strict_mode"),_=Symbol.for("react.profiler"),T=Symbol.for("react.consumer"),r=Symbol.for("react.context"),b=Symbol.for("react.forward_ref"),P=Symbol.for("react.suspense"),B=Symbol.for("react.suspense_list"),ee=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),E=Symbol.for("react.activity"),M=Symbol.for("react.client.reference"),U=N.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,F=Object.prototype.hasOwnProperty,X=Array.isArray,H=console.createTask?console.createTask:function(){return null};N={react_stack_bottom_frame:function(s){return s()}};var Z,z={},J=N.react_stack_bottom_frame.bind(N,t)(),ae=H(x(t)),ue={};te.Fragment=c,te.jsx=function(s,g,C){var A=1e4>U.recentlyCreatedOwnerStacks++;return j(s,g,C,!1,A?Error("react-stack-top-frame"):J,A?H(x(s)):ae)},te.jsxs=function(s,g,C){var A=1e4>U.recentlyCreatedOwnerStacks++;return j(s,g,C,!0,A?Error("react-stack-top-frame"):J,A?H(x(s)):ae)}})()),te}var we;function Me(){return we||(we=1,process.env.NODE_ENV==="production"?de.exports=Ve():de.exports=Fe()),de.exports}var e=Me();const ge={start:e.jsx(o.Play,{className:"h-4 w-4 text-green-500"}),end:e.jsx(o.CheckCircle,{className:"h-4 w-4 text-red-500"}),task:e.jsx(o.Circle,{className:"h-4 w-4 text-blue-500"}),approval:e.jsx(o.Users,{className:"h-4 w-4 text-purple-500"}),condition:e.jsx(o.GitBranch,{className:"h-4 w-4 text-orange-500"}),parallel:e.jsx(o.ArrowRight,{className:"h-4 w-4 text-teal-500"}),delay:e.jsx(o.Clock,{className:"h-4 w-4 text-gray-500"}),notification:e.jsx(o.Bell,{className:"h-4 w-4 text-yellow-500"}),script:e.jsx(o.Code,{className:"h-4 w-4 text-indigo-500"})},Ye={start:"border-green-300 bg-green-50",end:"border-red-300 bg-red-50",task:"border-blue-300 bg-blue-50",approval:"border-purple-300 bg-purple-50",condition:"border-orange-300 bg-orange-50",parallel:"border-teal-300 bg-teal-50",delay:"border-gray-300 bg-gray-50",notification:"border-yellow-300 bg-yellow-50",script:"border-indigo-300 bg-indigo-50"},Ue={draft:{variant:"secondary",label:"Draft"},active:{variant:"default",label:"Active"},paused:{variant:"outline",label:"Paused"},completed:{variant:"default",label:"Completed"},cancelled:{variant:"destructive",label:"Cancelled"}},Ce=({schema:n})=>{const{workflow:u,readOnly:l=!1,showToolbar:x=!0}=n,[d,t]=h.useState(u||{type:"workflow",title:"New Workflow",status:"draft",nodes:[{id:"start-1",type:"start",label:"Start",position:{x:100,y:100}},{id:"end-1",type:"end",label:"End",position:{x:100,y:400}}],edges:[],variables:[]}),[m,f]=h.useState(null),[D,O]=h.useState(null),j=h.useMemo(()=>d.nodes.find(r=>r.id===m),[d.nodes,m]),S=h.useCallback(r=>{if(l)return;const b=`${r}-${Date.now()}`,P={id:b,type:r,label:`New ${r.charAt(0).toUpperCase()+r.slice(1)}`,position:{x:200,y:(d.nodes.length+1)*80}};t(B=>({...B,nodes:[...B.nodes,P]})),f(b)},[l,d.nodes.length]),w=h.useCallback((r,b)=>{l||t(P=>({...P,nodes:P.nodes.map(B=>B.id===r?{...B,...b}:B)}))},[l]),N=h.useCallback(r=>{l||(t(b=>({...b,nodes:b.nodes.filter(P=>P.id!==r),edges:b.edges.filter(P=>P.source!==r&&P.target!==r)})),m===r&&f(null))},[l,m]),R=h.useCallback((r,b)=>{if(l)return;const B={id:`edge-${Date.now()}`,source:r,target:b};t(ee=>({...ee,edges:[...ee.edges,B]}))},[l]),$=h.useCallback(r=>{l||(t(b=>({...b,edges:b.edges.filter(P=>P.id!==r)})),D===r&&O(null))},[l,D]),c=()=>{console.log("Saving workflow:",d),n.onSave},v=()=>{t(r=>({...r,status:"active"})),console.log("Publishing workflow"),n.onPublish},_=Ue[d.status||"draft"],T=["task","approval","condition","parallel","delay","notification","script"];return e.jsxs("div",{className:"space-y-4",children:[x&&e.jsxs("div",{className:"flex items-center justify-between gap-2 p-4 bg-card rounded-lg border",children:[e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{children:e.jsx(a.Input,{value:d.title||"",onChange:r=>t(b=>({...b,title:r.target.value})),className:"text-lg font-semibold border-none p-0 h-auto focus-visible:ring-0",readOnly:l,placeholder:"Workflow Title"})}),e.jsx(a.Badge,{variant:_.variant,children:_.label})]}),!l&&e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a.Button,{variant:"outline",size:"sm",onClick:c,children:[e.jsx(o.Save,{className:"h-4 w-4 mr-2"}),"Save"]}),e.jsxs(a.Button,{size:"sm",onClick:v,disabled:d.status==="active",children:[e.jsx(o.Play,{className:"h-4 w-4 mr-2"}),"Publish"]})]})]}),e.jsxs("div",{className:"grid grid-cols-1 lg:grid-cols-4 gap-4",children:[!l&&e.jsxs(a.Card,{className:"lg:col-span-1",children:[e.jsx(a.CardHeader,{children:e.jsx(a.CardTitle,{className:"text-sm",children:"Add Node"})}),e.jsx(a.CardContent,{className:"space-y-2",children:T.map(r=>e.jsxs("button",{onClick:()=>S(r),className:"w-full flex items-center gap-2 p-2 rounded-md border hover:bg-muted/50 transition-colors text-sm",children:[ge[r],e.jsx("span",{className:"capitalize",children:r})]},r))})]}),e.jsxs(a.Card,{className:l?"lg:col-span-3":"lg:col-span-2",children:[e.jsx(a.CardHeader,{children:e.jsxs(a.CardTitle,{className:"text-sm flex items-center gap-2",children:[e.jsx(o.GitBranch,{className:"h-4 w-4"}),"Workflow Flow"]})}),e.jsx(a.CardContent,{children:e.jsxs("div",{className:"space-y-2",children:[d.nodes.map(r=>e.jsxs("div",{onClick:()=>{f(r.id),O(null)},className:`flex items-center justify-between p-3 rounded-lg border-2 cursor-pointer transition-all ${Ye[r.type]} ${m===r.id?"ring-2 ring-primary shadow-md":"hover:shadow-sm"}`,children:[e.jsxs("div",{className:"flex items-center gap-2",children:[ge[r.type],e.jsx("span",{className:"font-medium text-sm",children:r.label}),e.jsxs("span",{className:"text-xs text-muted-foreground capitalize",children:["(",r.type,")"]})]}),e.jsxs("div",{className:"flex items-center gap-1",children:[d.edges.filter(b=>b.source===r.id).length>0&&e.jsxs(a.Badge,{variant:"outline",className:"text-xs",children:[d.edges.filter(b=>b.source===r.id).length," out"]}),!l&&r.type!=="start"&&r.type!=="end"&&e.jsx(a.Button,{size:"sm",variant:"ghost",className:"h-6 w-6 p-0 text-red-500 hover:text-red-700",onClick:b=>{b.stopPropagation(),N(r.id)},children:e.jsx(o.Trash2,{className:"h-3 w-3"})})]})]},r.id)),d.edges.length>0&&e.jsxs("div",{className:"mt-4 pt-4 border-t",children:[e.jsx(a.Label,{className:"text-xs text-muted-foreground mb-2 block",children:"Connections"}),d.edges.map(r=>{const b=d.nodes.find(B=>B.id===r.source),P=d.nodes.find(B=>B.id===r.target);return e.jsxs("div",{className:"flex items-center gap-2 p-2 text-sm",children:[e.jsx("span",{children:b?.label||r.source}),e.jsx(o.ArrowRight,{className:"h-3 w-3 text-muted-foreground"}),e.jsx("span",{children:P?.label||r.target}),r.label&&e.jsx(a.Badge,{variant:"outline",className:"text-xs",children:r.label}),!l&&e.jsx(a.Button,{size:"sm",variant:"ghost",className:"h-5 w-5 p-0 ml-auto text-red-500",onClick:()=>$(r.id),children:e.jsx(o.Trash2,{className:"h-3 w-3"})})]},r.id)})]}),!l&&d.nodes.length>=2&&e.jsxs("div",{className:"mt-4 pt-4 border-t",children:[e.jsx(a.Label,{className:"text-xs text-muted-foreground mb-2 block",children:"Quick Connect"}),e.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[e.jsxs("select",{id:"edge-source",className:"border rounded-md p-1.5 text-sm bg-background",children:[e.jsx("option",{value:"",children:"From..."}),d.nodes.filter(r=>r.type!=="end").map(r=>e.jsx("option",{value:r.id,children:r.label},r.id))]}),e.jsxs("select",{id:"edge-target",className:"border rounded-md p-1.5 text-sm bg-background",children:[e.jsx("option",{value:"",children:"To..."}),d.nodes.filter(r=>r.type!=="start").map(r=>e.jsx("option",{value:r.id,children:r.label},r.id))]})]}),e.jsxs(a.Button,{size:"sm",variant:"outline",className:"mt-2 w-full",onClick:()=>{const r=document.getElementById("edge-source")?.value,b=document.getElementById("edge-target")?.value;r&&b&&r!==b&&R(r,b)},children:[e.jsx(o.Plus,{className:"h-3 w-3 mr-1"}),"Connect"]})]})]})})]}),e.jsxs(a.Card,{className:"lg:col-span-1",children:[e.jsx(a.CardHeader,{children:e.jsxs(a.CardTitle,{className:"text-sm flex items-center gap-2",children:[e.jsx(o.Settings,{className:"h-4 w-4"}),"Properties"]})}),e.jsx(a.CardContent,{children:j?e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Label"}),e.jsx(a.Input,{value:j.label,onChange:r=>w(j.id,{label:r.target.value}),className:"h-8 text-sm",readOnly:l})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Type"}),e.jsxs("div",{className:"flex items-center gap-2 p-2 rounded-md bg-muted text-sm",children:[ge[j.type],e.jsx("span",{className:"capitalize",children:j.type})]})]}),j.description!==void 0&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Description"}),e.jsx(a.Input,{value:j.description||"",onChange:r=>w(j.id,{description:r.target.value}),className:"h-8 text-sm",readOnly:l})]}),(j.type==="approval"||j.type==="task")&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Assignee"}),e.jsx(a.Input,{value:j.assignee||"",onChange:r=>w(j.id,{assignee:r.target.value}),className:"h-8 text-sm",placeholder:"User, role, or expression",readOnly:l})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Assignee Type"}),e.jsxs("select",{className:"w-full border rounded-md h-8 text-sm px-2 bg-background",value:j.assigneeType||"user",onChange:r=>w(j.id,{assigneeType:r.target.value}),disabled:l,children:[e.jsx("option",{value:"user",children:"User"}),e.jsx("option",{value:"role",children:"Role"}),e.jsx("option",{value:"group",children:"Group"}),e.jsx("option",{value:"expression",children:"Expression"})]})]})]}),j.type==="delay"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Timeout (minutes)"}),e.jsx(a.Input,{type:"number",value:j.timeout||60,onChange:r=>w(j.id,{timeout:Number(r.target.value)}),className:"h-8 text-sm",readOnly:l})]}),e.jsxs("div",{className:"text-xs text-muted-foreground mt-2",children:["ID: ",j.id]})]}):e.jsx("div",{className:"text-sm text-muted-foreground text-center py-8",children:"Select a node to edit its properties"})})]})]})]})},ke=({schema:n})=>{const{currentNodeId:u,approvalRule:l,history:x=[],data:d,showHistory:t=!0,showComments:m=!0}=n,[f,D]=h.useState(""),[O,j]=h.useState(!1),S=N=>{j(!0),console.log(`Approval action: ${N}`,{currentNodeId:u,comment:f,data:d}),setTimeout(()=>{j(!1),D("")},500)},w=N=>{switch(N){case"approve":case"approved":return e.jsx(a.Badge,{variant:"default",className:"bg-green-500",children:"Approved"});case"reject":case"rejected":return e.jsx(a.Badge,{variant:"destructive",children:"Rejected"});case"reassign":case"reassigned":return e.jsx(a.Badge,{variant:"secondary",children:"Reassigned"});case"comment":return e.jsx(a.Badge,{variant:"outline",children:"Comment"});case"escalate":case"escalated":return e.jsx(a.Badge,{variant:"secondary",className:"bg-orange-500 text-white",children:"Escalated"});default:return e.jsx(a.Badge,{variant:"outline",children:N})}};return e.jsxs("div",{className:"space-y-4",children:[e.jsxs(a.Card,{children:[e.jsx(a.CardHeader,{children:e.jsxs(a.CardTitle,{className:"flex items-center gap-2",children:[e.jsx(o.Clock,{className:"h-5 w-5"}),"Pending Approval",l&&e.jsxs(a.Badge,{variant:"outline",className:"ml-2",children:[l.type==="any"&&"Any approver",l.type==="all"&&"All must approve",l.type==="majority"&&"Majority approval",l.type==="sequential"&&"Sequential"]})]})}),e.jsxs(a.CardContent,{className:"space-y-4",children:[d&&Object.keys(d).length>0&&e.jsxs("div",{className:"p-3 bg-muted/50 rounded-lg",children:[e.jsx(a.Label,{className:"text-xs text-muted-foreground mb-2 block",children:"Request Details"}),e.jsx("div",{className:"grid grid-cols-2 gap-2",children:Object.entries(d).slice(0,6).map(([N,R])=>e.jsxs("div",{className:"text-sm",children:[e.jsxs("span",{className:"text-muted-foreground",children:[N,": "]}),e.jsx("span",{className:"font-medium",children:String(R)})]},N))})]}),m&&e.jsxs("div",{className:"space-y-2",children:[e.jsxs(a.Label,{className:"flex items-center gap-2 text-sm",children:[e.jsx(o.MessageSquare,{className:"h-4 w-4"}),"Comment"]}),e.jsx(a.Input,{value:f,onChange:N=>D(N.target.value),placeholder:"Add a comment (optional)"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(a.Button,{onClick:()=>S("approve"),disabled:O,className:"bg-green-600 hover:bg-green-700",children:[e.jsx(o.Check,{className:"h-4 w-4 mr-2"}),"Approve"]}),e.jsxs(a.Button,{variant:"destructive",onClick:()=>S("reject"),disabled:O,children:[e.jsx(o.X,{className:"h-4 w-4 mr-2"}),"Reject"]}),e.jsxs(a.Button,{variant:"outline",onClick:()=>S("reassign"),disabled:O,children:[e.jsx(o.RefreshCw,{className:"h-4 w-4 mr-2"}),"Reassign"]})]})]})]}),t&&x.length>0&&e.jsxs(a.Card,{children:[e.jsx(a.CardHeader,{children:e.jsx(a.CardTitle,{className:"text-sm",children:"Approval History"})}),e.jsx(a.CardContent,{children:e.jsx("div",{className:"space-y-3",children:x.map((N,R)=>e.jsxs("div",{className:"flex items-start gap-3 p-3 rounded-lg border",children:[e.jsx("div",{className:"mt-0.5",children:e.jsx(o.User,{className:"h-4 w-4 text-muted-foreground"})}),e.jsxs("div",{className:"flex-1 min-w-0",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"font-medium text-sm",children:N.actorName||N.actor}),w(N.action),e.jsx("span",{className:"text-xs text-muted-foreground",children:new Date(N.timestamp).toLocaleString()})]}),N.comment&&e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:N.comment})]})]},R))})})]}),t&&x.length===0&&e.jsx(a.Card,{children:e.jsx(a.CardContent,{className:"p-6 text-center text-muted-foreground text-sm",children:"No approval history yet"})})]})},Se={record_created:"Record Created",record_updated:"Record Updated",record_deleted:"Record Deleted",field_changed:"Field Changed",scheduled:"Scheduled"},Te={send_email:"Send Email",update_field:"Update Field",create_record:"Create Record",delete_record:"Delete Record",webhook:"Webhook",notification:"Notification"},He={send_email:e.jsx(o.Mail,{className:"h-4 w-4"}),update_field:e.jsx(o.FileEdit,{className:"h-4 w-4"}),create_record:e.jsx(o.Plus,{className:"h-4 w-4"}),delete_record:e.jsx(o.Trash2,{className:"h-4 w-4"}),webhook:e.jsx(o.Globe,{className:"h-4 w-4"}),notification:e.jsx(o.Bell,{className:"h-4 w-4"})},Ee={equals:"Equals",not_equals:"Not Equals",contains:"Contains",greater_than:"Greater Than",less_than:"Less Than"},ze=()=>({id:`auto-${Date.now()}`,name:"",description:"",enabled:!0,trigger:{type:"record_created"},actions:[],createdAt:new Date().toISOString()}),le=({label:n,value:u,placeholder:l,onChange:x})=>e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:n}),e.jsx(a.Input,{value:u,onChange:d=>x(d.target.value),placeholder:l})]}),_e=({automation:n,objects:u=[],onSave:l,onCancel:x,className:d})=>{const[t,m]=h.useState(n??ze()),f=h.useCallback(c=>{m(v=>({...v,trigger:{...v.trigger,...c}}))},[]),D=h.useCallback(()=>{m(c=>({...c,actions:[...c.actions,{type:"send_email",params:{}}]}))},[]),O=h.useCallback((c,v)=>{m(_=>({..._,actions:_.actions.map((T,r)=>r===c?{...T,...v}:T)}))},[]),j=h.useCallback(c=>{m(v=>({...v,actions:v.actions.filter((_,T)=>T!==c)}))},[]),S=t.trigger.type!=="scheduled",w=t.trigger.type==="field_changed",N=t.trigger.type==="scheduled",R=u.find(c=>c.name===t.trigger.objectName)?.fields,$=(c,v)=>{const _=(T,r)=>O(v,{params:{...c.params,[T]:r}});switch(c.type){case"send_email":return e.jsxs(e.Fragment,{children:[e.jsx(le,{label:"To",value:c.params.to??"",placeholder:"Recipient email",onChange:T=>_("to",T)}),e.jsx(le,{label:"Subject",value:c.params.subject??"",placeholder:"Email subject",onChange:T=>_("subject",T)})]});case"webhook":return e.jsx(le,{label:"URL",value:c.params.url??"",placeholder:"https://...",onChange:T=>_("url",T)});case"notification":return e.jsx(le,{label:"Message",value:c.params.message??"",placeholder:"Notification message",onChange:T=>_("message",T)});case"update_field":case"create_record":case"delete_record":return e.jsx(le,{label:"Target Object",value:c.params.objectName??"",placeholder:"Object name",onChange:T=>_("objectName",T)});default:return null}};return e.jsxs("div",{className:d??"space-y-4",children:[e.jsxs(a.Card,{children:[e.jsx(a.CardHeader,{children:e.jsxs(a.CardTitle,{className:"flex items-center gap-2 text-sm",children:[e.jsx(o.Zap,{className:"h-4 w-4 text-yellow-500"}),"Trigger"]})}),e.jsxs(a.CardContent,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Trigger Type"}),e.jsxs(a.Select,{value:t.trigger.type,onValueChange:c=>f({type:c}),children:[e.jsx(a.SelectTrigger,{children:e.jsx(a.SelectValue,{placeholder:"Select trigger type"})}),e.jsx(a.SelectContent,{children:Object.keys(Se).map(c=>e.jsx(a.SelectItem,{value:c,children:Se[c]},c))})]})]}),S&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Object"}),u.length>0?e.jsxs(a.Select,{value:t.trigger.objectName??"",onValueChange:c=>f({objectName:c}),children:[e.jsx(a.SelectTrigger,{children:e.jsx(a.SelectValue,{placeholder:"Select object"})}),e.jsx(a.SelectContent,{children:u.map(c=>e.jsx(a.SelectItem,{value:c.name,children:c.label},c.name))})]}):e.jsx(a.Input,{value:t.trigger.objectName??"",onChange:c=>f({objectName:c.target.value}),placeholder:"Object name"})]}),w&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Field"}),R?e.jsxs(a.Select,{value:t.trigger.fieldName??"",onValueChange:c=>f({fieldName:c}),children:[e.jsx(a.SelectTrigger,{children:e.jsx(a.SelectValue,{placeholder:"Select field"})}),e.jsx(a.SelectContent,{children:Object.keys(R).map(c=>e.jsx(a.SelectItem,{value:c,children:c},c))})]}):e.jsx(a.Input,{value:t.trigger.fieldName??"",onChange:c=>f({fieldName:c.target.value}),placeholder:"Field name"})]}),N&&e.jsxs("div",{className:"space-y-1",children:[e.jsxs(a.Label,{className:"text-xs flex items-center gap-1",children:[e.jsx(o.Clock,{className:"h-3 w-3"})," Cron Schedule"]}),e.jsx(a.Input,{value:t.trigger.schedule??"",onChange:c=>f({schedule:c.target.value}),placeholder:"e.g. 0 9 * * 1-5"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Condition (optional)"}),e.jsx(a.Input,{value:t.trigger.condition??"",onChange:c=>f({condition:c.target.value}),placeholder:'e.g. ${data.status === "active"}'})]}),e.jsx(a.Separator,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx(a.Label,{className:"text-xs font-medium",children:"Conditional Trigger (optional)"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Run only when a field matches a specific value."}),e.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Field"}),R?e.jsxs(a.Select,{value:t.trigger.conditionField??"",onValueChange:c=>f({conditionField:c}),children:[e.jsx(a.SelectTrigger,{children:e.jsx(a.SelectValue,{placeholder:"Field"})}),e.jsx(a.SelectContent,{children:Object.keys(R).map(c=>e.jsx(a.SelectItem,{value:c,children:c},c))})]}):e.jsx(a.Input,{value:t.trigger.conditionField??"",onChange:c=>f({conditionField:c.target.value}),placeholder:"e.g. status"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Operator"}),e.jsxs(a.Select,{value:t.trigger.conditionOperator??"equals",onValueChange:c=>f({conditionOperator:c}),children:[e.jsx(a.SelectTrigger,{children:e.jsx(a.SelectValue,{placeholder:"Operator"})}),e.jsx(a.SelectContent,{children:Object.keys(Ee).map(c=>e.jsx(a.SelectItem,{value:c,children:Ee[c]},c))})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Value"}),e.jsx(a.Input,{value:t.trigger.conditionValue??"",onChange:c=>f({conditionValue:c.target.value}),placeholder:"e.g. urgent"})]})]})]})]})]}),e.jsxs(a.Card,{children:[e.jsx(a.CardHeader,{children:e.jsxs(a.CardTitle,{className:"flex items-center gap-2 text-sm",children:[e.jsx(o.Settings,{className:"h-4 w-4"})," Actions",e.jsx(a.Badge,{variant:"secondary",className:"ml-auto",children:t.actions.length})]})}),e.jsxs(a.CardContent,{className:"space-y-3",children:[t.actions.length>1&&e.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[e.jsx(a.Label,{className:"text-xs",children:"Execution"}),e.jsxs(a.Select,{value:t.executionMode??"sequential",onValueChange:c=>m(v=>({...v,executionMode:c})),children:[e.jsx(a.SelectTrigger,{className:"h-7 w-36",children:e.jsx(a.SelectValue,{})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"sequential",children:"Sequential"}),e.jsx(a.SelectItem,{value:"parallel",children:"Parallel"})]})]})]}),t.actions.map((c,v)=>e.jsxs("div",{className:"rounded-lg border p-3 space-y-3",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[He[c.type],e.jsx("span",{className:"text-sm font-medium",children:t.actions.length>1&&(t.executionMode??"sequential")==="sequential"?`Step ${v+1}`:`Action ${v+1}`}),v>0&&t.actions.length>1&&(t.executionMode??"sequential")==="sequential"&&e.jsx(a.Badge,{variant:"outline",className:"text-[10px] px-1",children:"then"})]}),e.jsx(a.Button,{size:"sm",variant:"ghost",className:"h-7 w-7 p-0 text-red-500 hover:text-red-700",onClick:()=>j(v),children:e.jsx(o.Trash2,{className:"h-4 w-4"})})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Action Type"}),e.jsxs(a.Select,{value:c.type,onValueChange:_=>O(v,{type:_,params:{}}),children:[e.jsx(a.SelectTrigger,{children:e.jsx(a.SelectValue,{})}),e.jsx(a.SelectContent,{children:Object.keys(Te).map(_=>e.jsx(a.SelectItem,{value:_,children:Te[_]},_))})]})]}),$(c,v)]},v)),e.jsxs(a.Button,{variant:"outline",size:"sm",className:"w-full",onClick:D,children:[e.jsx(o.Plus,{className:"h-4 w-4 mr-2"})," Add Action"]})]})]}),e.jsxs(a.Card,{children:[e.jsx(a.CardHeader,{children:e.jsx(a.CardTitle,{className:"text-sm",children:"Summary"})}),e.jsxs(a.CardContent,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Name"}),e.jsx(a.Input,{value:t.name,onChange:c=>m(v=>({...v,name:c.target.value})),placeholder:"Automation name"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Description"}),e.jsx(a.Input,{value:t.description??"",onChange:c=>m(v=>({...v,description:c.target.value})),placeholder:"Optional description"})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(a.Label,{className:"text-sm",children:"Enabled"}),e.jsx(a.Switch,{checked:t.enabled,onCheckedChange:c=>m(v=>({...v,enabled:c}))})]}),e.jsx(a.Separator,{}),e.jsxs("div",{className:"flex items-center gap-2 justify-end",children:[x&&e.jsx(a.Button,{variant:"outline",size:"sm",onClick:x,children:"Cancel"}),e.jsxs(a.Button,{size:"sm",onClick:()=>l?.(t),children:[e.jsx(o.Zap,{className:"h-4 w-4 mr-2"})," Save Automation"]})]})]})]})]})},We={success:"default",failure:"destructive",running:"secondary",pending:"outline"},Ge={success:"Success",failure:"Failed",running:"Running",pending:"Pending"};function Xe(n,u){if(!u)return"—";const l=new Date(u).getTime()-new Date(n).getTime();if(l<1e3)return`${l}ms`;const x=Math.floor(l/1e3);if(x<60)return`${x}s`;const d=Math.floor(x/60),t=x%60;return`${d}m ${t}s`}const Ae=({runs:n=[],className:u})=>e.jsxs(a.Card,{className:u,children:[e.jsx(a.CardHeader,{children:e.jsxs(a.CardTitle,{className:"flex items-center gap-2 text-sm",children:[e.jsx(o.Clock,{className:"h-4 w-4"}),"Automation Run History",e.jsx(a.Badge,{variant:"outline",className:"ml-auto",children:n.length})]})}),e.jsx(a.CardContent,{children:n.length===0?e.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No automation runs yet"}):e.jsx("div",{className:"space-y-2",children:n.map(l=>e.jsxs("div",{className:"flex items-start gap-3 rounded-lg border p-3",children:[e.jsx(a.Badge,{variant:We[l.status],children:Ge[l.status]}),e.jsxs("div",{className:"flex-1 min-w-0 space-y-1",children:[e.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[e.jsx("span",{className:"text-sm font-medium",children:l.automationName}),l.triggerEvent&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:["— ",l.triggerEvent]})]}),e.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[e.jsx("span",{children:new Date(l.startedAt).toLocaleString()}),e.jsxs("span",{children:["Duration: ",Xe(l.startedAt,l.completedAt)]})]}),l.status==="failure"&&l.error&&e.jsx("p",{className:"text-xs text-red-600 mt-1",children:l.error})]})]},l.id))})})]});function pe(...n){return Re.twMerge(Be.clsx(n))}const Pe=130,re=52,ie={start:"Start",end:"End",task:"Task",user_task:"User Task",service_task:"Service Task",script_task:"Script Task",approval:"Approval",condition:"Condition",parallel_gateway:"Parallel Gateway",join_gateway:"Join Gateway",boundary_event:"Boundary Event",delay:"Delay",notification:"Notification",webhook:"Webhook"},Oe={start:e.jsx(o.Play,{className:"h-3.5 w-3.5 text-green-500"}),end:e.jsx(o.Square,{className:"h-3.5 w-3.5 text-red-500"}),task:e.jsx(o.CheckCircle,{className:"h-3.5 w-3.5 text-blue-500"}),user_task:e.jsx(o.Users,{className:"h-3.5 w-3.5 text-blue-600"}),service_task:e.jsx(o.Settings,{className:"h-3.5 w-3.5 text-blue-400"}),script_task:e.jsx(o.Code,{className:"h-3.5 w-3.5 text-indigo-500"}),approval:e.jsx(o.Users,{className:"h-3.5 w-3.5 text-purple-500"}),condition:e.jsx(o.GitBranch,{className:"h-3.5 w-3.5 text-orange-500"}),parallel_gateway:e.jsx(o.GitBranch,{className:"h-3.5 w-3.5 text-teal-500"}),join_gateway:e.jsx(o.GitMerge,{className:"h-3.5 w-3.5 text-teal-600"}),boundary_event:e.jsx(o.AlertCircle,{className:"h-3.5 w-3.5 text-amber-500"}),delay:e.jsx(o.Clock,{className:"h-3.5 w-3.5 text-gray-500"}),notification:e.jsx(o.Bell,{className:"h-3.5 w-3.5 text-yellow-500"}),webhook:e.jsx(o.Globe,{className:"h-3.5 w-3.5 text-cyan-500"})},Ze={start:"border-green-400 bg-green-50 dark:bg-green-950",end:"border-red-400 bg-red-50 dark:bg-red-950",task:"border-blue-300 bg-blue-50 dark:bg-blue-950",user_task:"border-blue-400 bg-blue-50 dark:bg-blue-950",service_task:"border-blue-200 bg-slate-50 dark:bg-slate-900",script_task:"border-indigo-300 bg-indigo-50 dark:bg-indigo-950",approval:"border-purple-400 bg-purple-50 dark:bg-purple-950",condition:"border-orange-400 bg-orange-50 dark:bg-orange-950",parallel_gateway:"border-teal-400 bg-teal-50 dark:bg-teal-950",join_gateway:"border-teal-500 bg-teal-50 dark:bg-teal-950",boundary_event:"border-amber-400 bg-amber-50 dark:bg-amber-950 border-dashed",delay:"border-gray-400 bg-gray-50 dark:bg-gray-900",notification:"border-yellow-400 bg-yellow-50 dark:bg-yellow-950",webhook:"border-cyan-400 bg-cyan-50 dark:bg-cyan-950"},Je={pending:{color:"text-muted-foreground",icon:e.jsx(o.Clock,{className:"h-3 w-3"})},running:{color:"text-blue-500",icon:e.jsx(o.Loader2,{className:"h-3 w-3 animate-spin"})},completed:{color:"text-green-500",icon:e.jsx(o.CheckCircle,{className:"h-3 w-3"})},failed:{color:"text-red-500",icon:e.jsx(o.AlertCircle,{className:"h-3 w-3"})},skipped:{color:"text-gray-400",icon:e.jsx(o.SkipForward,{className:"h-3 w-3"})}},Ke=["task","user_task","service_task","script_task","approval","condition","parallel_gateway","join_gateway","boundary_event","delay","notification","webhook"],Qe={allow:"Allow (run concurrently)",forbid:"Forbid (skip new)",replace:"Replace (cancel existing)",queue:"Queue (run after current)"},Ie={condition:"Condition",manual:"Manual",webhook:"Webhook",timer:"Timer",signal:"Signal"},qe=()=>[{id:"start-1",type:"start",label:"Start",position:{x:80,y:200}},{id:"end-1",type:"end",label:"End",position:{x:500,y:200}}],$e=()=>[];function ea(n){const[u,l]=h.useState([n]),[x,d]=h.useState(0),t=u[x],m=h.useCallback(S=>{l(w=>[...w.slice(0,x+1),S]),d(w=>w+1)},[x]),f=h.useCallback(()=>{d(S=>Math.max(0,S-1))},[]),D=h.useCallback(()=>{l(S=>(d(w=>Math.min(S.length-1,w+1)),S))},[]),O=x>0,j=x<u.length-1;return{current:t,push:m,undo:f,redo:D,canUndo:O,canRedo:j}}function aa(n,u,l){const x=[],d=["boundary_event"];n.forEach(m=>{d.includes(m.type)&&x.push(`Node "${m.label}" (${m.type}) has limited BPMN mapping.`)});const t=['<?xml version="1.0" encoding="UTF-8"?>','<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"',' xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"',' targetNamespace="http://objectui.org/bpmn">',` <process id="process-1" name="${l}" isExecutable="true">`,...n.map(m=>` <${sa(m.type)} id="${m.id}" name="${m.label}" />`),...u.map(m=>` <sequenceFlow ${[`id="${m.id}"`,`sourceRef="${m.source}"`,`targetRef="${m.target}"`,m.condition?`conditionExpression="${m.condition}"`:""].filter(Boolean).join(" ")} />`)," </process>","</definitions>"].join(`
7
+ `);return{success:!0,nodeCount:n.length,edgeCount:u.length,warnings:x.length?x:void 0,bpmnXml:t}}function sa(n){return{start:"startEvent",end:"endEvent",task:"task",user_task:"userTask",service_task:"serviceTask",script_task:"scriptTask",approval:"userTask",condition:"exclusiveGateway",parallel_gateway:"parallelGateway",join_gateway:"parallelGateway",boundary_event:"boundaryEvent",delay:"intermediateCatchEvent",notification:"sendTask",webhook:"serviceTask"}[n]??"task"}function ta(n,u){const l=n.position.x+Pe,x=n.position.y+re/2,d=u.position.x,t=u.position.y+re/2,m=(l+d)/2;return{d:`M ${l} ${x} C ${m} ${x}, ${m} ${t}, ${d} ${t}`,labelX:m,labelY:(x+t)/2-8}}const la=({node:n,isSelected:u,isConnectSource:l,connectMode:x,readOnly:d,showExecutionOverlay:t,onSelect:m,onDelete:f,onDragStart:D,onPortClick:O})=>{const j=n.executionStatus,S=j?Je[j]:null;return e.jsxs("div",{className:"absolute select-none",style:{left:n.position.x,top:n.position.y},draggable:!d&&!x,onDragStart:w=>D(w,n.id),onClick:w=>m(n.id,w.shiftKey),role:"group","aria-label":n.label,children:[e.jsxs("div",{className:pe("flex items-center gap-2 border-2 rounded px-3 py-2 min-h-[52px] transition-shadow cursor-pointer",Ze[n.type],u&&"ring-2 ring-primary shadow-md",l&&"ring-2 ring-blue-400 shadow-lg",x&&!l&&"cursor-crosshair",t&&j==="running"&&"ring-2 ring-blue-400",t&&j==="failed"&&"ring-2 ring-red-400",t&&j==="completed"&&"ring-2 ring-green-400"),style:{width:Pe,minHeight:re},children:[e.jsx("span",{className:"shrink-0",children:Oe[n.type]}),e.jsx("span",{className:"text-xs font-medium leading-tight flex-1 truncate",children:n.label}),t&&S&&e.jsx("span",{className:pe("shrink-0",S.color),children:S.icon})]}),!d&&(u||x)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"absolute w-3 h-3 rounded-full bg-primary border-2 border-background shadow cursor-crosshair",style:{right:-6,top:re/2-6},title:"Connect from this node",onClick:w=>{w.stopPropagation(),O(n.id)}}),e.jsx("div",{className:"absolute w-3 h-3 rounded-full bg-muted-foreground border-2 border-background shadow cursor-crosshair",style:{left:-6,top:re/2-6},title:"Connect to this node",onClick:w=>{w.stopPropagation(),O(n.id)}})]}),!d&&u&&!x&&e.jsx("button",{className:"absolute -top-2 -right-2 p-0.5 rounded-full bg-destructive text-destructive-foreground shadow",onClick:w=>{w.stopPropagation(),f(n.id)},"aria-label":`Delete node ${n.label}`,children:e.jsx(o.Trash2,{className:"h-3 w-3"})})]})},ra=({node:n,edge:u,readOnly:l,onNodeChange:x,onEdgeChange:d})=>!n&&!u?e.jsx("div",{className:"p-4 text-sm text-muted-foreground",children:"Select a node or edge to edit its properties."}):n?e.jsxs("div",{className:"p-3 space-y-3 overflow-y-auto",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Node Properties"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Label"}),e.jsx(a.Input,{value:n.label,onChange:t=>x({...n,label:t.target.value}),disabled:l,className:"h-7 text-xs"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Type"}),e.jsxs(a.Select,{value:n.type,onValueChange:t=>x({...n,type:t}),disabled:l,children:[e.jsx(a.SelectTrigger,{className:"h-7 text-xs",children:e.jsx(a.SelectValue,{})}),e.jsx(a.SelectContent,{children:Object.keys(ie).map(t=>e.jsx(a.SelectItem,{value:t,className:"text-xs",children:ie[t]},t))})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Description"}),e.jsx(a.Input,{value:n.description??"",onChange:t=>x({...n,description:t.target.value}),disabled:l,className:"h-7 text-xs",placeholder:"Optional description"})]}),["task","user_task","service_task","script_task","delay","webhook"].includes(n.type)&&e.jsxs(e.Fragment,{children:[e.jsx(a.Separator,{}),e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Executor"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Executor Type"}),e.jsx(a.Input,{value:n.executor?.type??"",onChange:t=>x({...n,executor:{...n.executor,type:t.target.value}}),disabled:l,className:"h-7 text-xs",placeholder:"e.g. http, script, email"})]}),n.type==="delay"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Wait Event Type"}),e.jsxs(a.Select,{value:n.executor?.waitEventConfig?.eventType??"timer",onValueChange:t=>x({...n,executor:{...n.executor,type:n.executor?.type??"wait",waitEventConfig:{...n.executor?.waitEventConfig,eventType:t}}}),disabled:l,children:[e.jsx(a.SelectTrigger,{className:"h-7 text-xs",children:e.jsx(a.SelectValue,{})}),e.jsx(a.SelectContent,{children:Object.keys(Ie).map(t=>e.jsx(a.SelectItem,{value:t,className:"text-xs",children:Ie[t]},t))})]})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Timeout (ms)"}),e.jsx(a.Input,{type:"number",value:n.executor?.timeoutMs??"",onChange:t=>x({...n,executor:{...n.executor,type:n.executor?.type??"",timeoutMs:t.target.value?Number(t.target.value):void 0}}),disabled:l,className:"h-7 text-xs",placeholder:"e.g. 30000"})]})]}),n.type==="boundary_event"&&e.jsxs(e.Fragment,{children:[e.jsx(a.Separator,{}),e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Boundary Config"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Attached To Node ID"}),e.jsx(a.Input,{value:n.boundaryConfig?.attachedToNodeId??"",onChange:t=>x({...n,boundaryConfig:{...n.boundaryConfig,attachedToNodeId:t.target.value,eventType:n.boundaryConfig?.eventType??"error"}}),disabled:l,className:"h-7 text-xs",placeholder:"Host node id"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Event Type"}),e.jsxs(a.Select,{value:n.boundaryConfig?.eventType??"error",onValueChange:t=>x({...n,boundaryConfig:{...n.boundaryConfig,attachedToNodeId:n.boundaryConfig?.attachedToNodeId??"",eventType:t}}),disabled:l,children:[e.jsx(a.SelectTrigger,{className:"h-7 text-xs",children:e.jsx(a.SelectValue,{})}),e.jsx(a.SelectContent,{children:["error","timer","message","signal","compensation"].map(t=>e.jsx(a.SelectItem,{value:t,className:"text-xs capitalize",children:t},t))})]})]})]})]}):u?e.jsxs("div",{className:"p-3 space-y-3 overflow-y-auto",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Edge Properties"}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Label"}),e.jsx(a.Input,{value:u.label??"",onChange:t=>d({...u,label:t.target.value}),disabled:l,className:"h-7 text-xs"})]}),e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Type"}),e.jsxs(a.Select,{value:u.type??"default",onValueChange:t=>d({...u,type:t}),disabled:l,children:[e.jsx(a.SelectTrigger,{className:"h-7 text-xs",children:e.jsx(a.SelectValue,{})}),e.jsxs(a.SelectContent,{children:[e.jsx(a.SelectItem,{value:"default",className:"text-xs",children:"Default"}),e.jsx(a.SelectItem,{value:"conditional",className:"text-xs",children:"Conditional"}),e.jsx(a.SelectItem,{value:"timeout",className:"text-xs",children:"Timeout"})]})]})]}),u.type==="conditional"&&e.jsxs("div",{className:"space-y-1",children:[e.jsx(a.Label,{className:"text-xs",children:"Condition Expression"}),e.jsx(a.Input,{value:u.condition??"",onChange:t=>d({...u,condition:t.target.value}),disabled:l,className:"h-7 text-xs font-mono",placeholder:"e.g. status === 'approved'"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("input",{type:"checkbox",id:"edge-isDefault",checked:u.isDefault??!1,onChange:t=>d({...u,isDefault:t.target.checked}),disabled:l,className:"h-3.5 w-3.5"}),e.jsx(a.Label,{htmlFor:"edge-isDefault",className:"text-xs",children:"Default edge (isDefault)"})]})]}):null,ia=({versions:n})=>e.jsxs("div",{className:"p-3 space-y-2",children:[e.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Version History"}),n.length===0&&e.jsx("p",{className:"text-xs text-muted-foreground",children:"No version history available."}),e.jsx("div",{className:"space-y-1.5",children:n.map(u=>e.jsxs("div",{className:pe("rounded border p-2 text-xs",u.isCurrent?"border-primary bg-primary/5":"border-border bg-muted/30"),children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("span",{className:"font-medium",children:["v",u.version]}),u.isCurrent&&e.jsx(a.Badge,{variant:"default",className:"text-[10px] h-4",children:"Current"})]}),u.changeNote&&e.jsx("p",{className:"text-muted-foreground mt-0.5",children:u.changeNote}),e.jsxs("p",{className:"text-muted-foreground mt-0.5",children:[u.author&&e.jsxs(e.Fragment,{children:[u.author," · "]}),new Date(u.createdAt).toLocaleDateString()]})]},u.version))})]}),De=({schema:n,onSave:u})=>{const{readOnly:l=!1,showToolbar:x=!0,showMinimap:d=!1,showVersionHistory:t=!1,showExecutionOverlay:m=!1,executionSteps:f=[],versionHistory:D=[],concurrencyPolicy:O,title:j="New Flow",description:S="",status:w="draft"}=n,[N,R]=h.useState(j),[$,c]=h.useState(S),v=n.nodes??qe(),_=n.edges??$e(),{current:T,push:r,undo:b,redo:P,canUndo:B,canRedo:ee}=ea({nodes:v,edges:_}),y=T.nodes,E=T.edges,[M,U]=h.useState(null),[F,X]=h.useState(null),[H,Z]=h.useState(!1),[z,J]=h.useState(null),[ae,ue]=h.useState(!0),[s,g]=h.useState(t),[C,A]=h.useState(null),[W,K]=h.useState(1),k=h.useRef(null),G=h.useMemo(()=>y.find(i=>i.id===M)??null,[y,M]),ne=h.useMemo(()=>E.find(i=>i.id===F)??null,[E,F]),ce=h.useMemo(()=>{if(!m||f.length===0)return y;const i=new Map(f.map(p=>[p.nodeId,p.status]));return y.map(p=>i.has(p.id)?{...p,executionStatus:i.get(p.id)}:p)},[y,m,f]),na=h.useCallback(i=>{if(l)return;const I={id:`${i}-${Date.now()}`,type:i,label:ie[i],position:{x:200,y:80+y.length*70}};r({nodes:[...y,I],edges:E})},[l,y,E,r]),je=h.useCallback(i=>{if(l)return;const p=y.filter(V=>V.id!==i),I=E.filter(V=>V.source!==i&&V.target!==i);r({nodes:p,edges:I}),M===i&&U(null)},[l,y,E,r,M]),ca=h.useCallback(i=>{l||r({nodes:y.map(p=>p.id===i.id?i:p),edges:E})},[l,y,E,r]),Le=h.useCallback(i=>{l||(r({nodes:y,edges:E.filter(p=>p.id!==i)}),F===i&&X(null))},[l,y,E,r,F]),oa=h.useCallback(i=>{l||r({nodes:y,edges:E.map(p=>p.id===i.id?i:p)})},[l,y,E,r]),da=h.useCallback(i=>{if(!l){if(!H){Z(!0),J(i);return}if(z&&z!==i){const I={id:`edge-${Date.now()}`,source:z,target:i};r({nodes:y,edges:[...E,I]})}Z(!1),J(null)}},[l,H,z,y,E,r]),xe=h.useRef(null),Q=h.useRef(null),ua=h.useCallback((i,p)=>{xe.current=p;const I=y.find(V=>V.id===p);I&&(Q.current={mouseX:i.clientX,mouseY:i.clientY,nodeX:I.position.x,nodeY:I.position.y}),i.dataTransfer.effectAllowed="move"},[y]),xa=h.useCallback(i=>{if(i.preventDefault(),!xe.current||!Q.current||!k.current)return;k.current.getBoundingClientRect();const p=(i.clientX-Q.current.mouseX)/W,I=(i.clientY-Q.current.mouseY)/W,V=Math.max(0,Q.current.nodeX+p),he=Math.max(0,Q.current.nodeY+I),me=xe.current;r({nodes:y.map(q=>q.id===me?{...q,position:{x:V,y:he}}:q),edges:E}),xe.current=null,Q.current=null},[y,E,r,W]),ha=h.useCallback(()=>{const i=aa(y,E,N);A(i);const p=new Blob([i.bpmnXml??""],{type:"application/xml"}),I=URL.createObjectURL(p),V=document.createElement("a");V.href=I,V.download=`${N.replace(/\s+/g,"-").toLowerCase()}.bpmn`,V.click(),URL.revokeObjectURL(I)},[y,E,N]),fe=h.useCallback(()=>{u?.(y,E)},[y,E,u]),ma=h.useCallback(i=>{const p=i.ctrlKey||i.metaKey;if(p&&i.key==="z"&&!i.shiftKey){i.preventDefault(),b();return}if(p&&(i.key==="y"||i.key==="z"&&i.shiftKey)){i.preventDefault(),P();return}if(p&&i.key==="s"){i.preventDefault(),fe();return}i.key==="Escape"&&(Z(!1),J(null),U(null),X(null)),(i.key==="Delete"||i.key==="Backspace")&&(M?je(M):F&&Le(F))},[b,P,fe,M,F,je,Le]);return e.jsxs(a.Card,{className:"flex flex-col h-full min-h-[600px] outline-none",tabIndex:0,onKeyDown:ma,children:[e.jsx(a.CardHeader,{className:"py-2 px-4 border-b flex-shrink-0",children:e.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[e.jsx(o.Zap,{className:"h-4 w-4 text-primary shrink-0"}),e.jsx(a.CardTitle,{className:"text-sm font-semibold",children:l?e.jsx("span",{children:N}):e.jsx(a.Input,{value:N,onChange:i=>R(i.target.value),className:"h-6 text-sm font-semibold border-0 p-0 focus-visible:ring-0 bg-transparent","aria-label":"Flow title"})}),e.jsx(a.Badge,{variant:"outline",className:"text-xs capitalize",children:w}),O&&e.jsx(a.Badge,{variant:"secondary",className:"text-xs",children:Qe[O]}),e.jsxs("div",{className:"ml-auto flex items-center gap-1",children:[!l&&e.jsxs(e.Fragment,{children:[e.jsx(a.Button,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:b,disabled:!B,title:"Undo (Ctrl+Z)",children:e.jsx(o.Undo2,{className:"h-4 w-4"})}),e.jsx(a.Button,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:P,disabled:!ee,title:"Redo (Ctrl+Y)",children:e.jsx(o.Redo2,{className:"h-4 w-4"})}),e.jsx(a.Separator,{orientation:"vertical",className:"h-5 mx-1"})]}),e.jsx(a.Button,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>K(i=>Math.min(2,i+.1)),title:"Zoom in",children:e.jsx(o.ZoomIn,{className:"h-4 w-4"})}),e.jsx(a.Button,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>K(1),title:"Reset zoom",children:e.jsx(o.RotateCcw,{className:"h-4 w-4"})}),e.jsx(a.Button,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>K(i=>Math.max(.3,i-.1)),title:"Zoom out",children:e.jsx(o.ZoomOut,{className:"h-4 w-4"})}),e.jsx(a.Separator,{orientation:"vertical",className:"h-5 mx-1"}),D.length>0&&e.jsx(a.Button,{size:"icon",variant:s?"secondary":"ghost",className:"h-7 w-7",onClick:()=>g(i=>!i),title:"Version history",children:e.jsx(o.History,{className:"h-4 w-4"})}),e.jsx(a.Button,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:ha,title:"Export BPMN",children:e.jsx(o.Download,{className:"h-4 w-4"})}),!l&&e.jsxs(e.Fragment,{children:[e.jsx(a.Button,{size:"icon",variant:"ghost",className:"h-7 w-7",title:"Import BPMN (drag & drop)",children:e.jsx(o.Upload,{className:"h-4 w-4"})}),e.jsxs(a.Button,{size:"sm",variant:"default",className:"h-7 text-xs gap-1",onClick:fe,title:"Save (Ctrl+S)",children:[e.jsx(o.Save,{className:"h-3.5 w-3.5"})," Save"]})]}),e.jsx(a.Button,{size:"icon",variant:"ghost",className:"h-7 w-7",onClick:()=>ue(i=>!i),title:ae?"Hide properties":"Show properties",children:ae?e.jsx(o.PanelRightClose,{className:"h-4 w-4"}):e.jsx(o.PanelRightOpen,{className:"h-4 w-4"})})]})]})}),e.jsxs(a.CardContent,{className:"flex flex-1 p-0 overflow-hidden",children:[x&&!l&&e.jsxs("div",{className:"w-36 border-r bg-muted/30 flex-shrink-0 overflow-y-auto py-2 px-2",children:[e.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-2 px-1",children:"Add Node"}),e.jsx("div",{className:"space-y-1",children:Ke.map(i=>e.jsxs("button",{className:"w-full flex items-center gap-2 text-xs px-2 py-1.5 rounded hover:bg-muted transition-colors text-left",onClick:()=>na(i),title:`Add ${ie[i]}`,children:[Oe[i],e.jsx("span",{className:"truncate",children:ie[i]})]},i))}),H&&e.jsxs(e.Fragment,{children:[e.jsx(a.Separator,{className:"my-2"}),e.jsxs("div",{className:"px-1",children:[e.jsx("p",{className:"text-[10px] text-blue-600 font-medium",children:"Connect mode"}),e.jsx("p",{className:"text-[10px] text-muted-foreground",children:"Click a target node port to connect."}),e.jsx(a.Button,{size:"sm",variant:"outline",className:"h-6 text-xs mt-1 w-full",onClick:()=>{Z(!1),J(null)},children:"Cancel"})]})]})]}),e.jsx("div",{className:"flex-1 overflow-auto relative bg-dot-pattern",children:e.jsxs("div",{ref:k,className:"relative",style:{width:1200,height:700,transform:`scale(${W})`,transformOrigin:"top left"},onDrop:xa,onDragOver:i=>i.preventDefault(),onClick:i=>{i.target===k.current&&(U(null),X(null))},children:[e.jsxs("svg",{className:"absolute inset-0 pointer-events-none",width:1200,height:700,style:{overflow:"visible"},children:[e.jsxs("defs",{children:[e.jsx("marker",{id:"fd-arrowhead",markerWidth:"10",markerHeight:"7",refX:"9",refY:"3.5",orient:"auto",children:e.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"hsl(var(--foreground) / 0.5)"})}),e.jsx("marker",{id:"fd-arrowhead-selected",markerWidth:"10",markerHeight:"7",refX:"9",refY:"3.5",orient:"auto",children:e.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"hsl(var(--primary))"})}),e.jsx("marker",{id:"fd-arrowhead-conditional",markerWidth:"10",markerHeight:"7",refX:"9",refY:"3.5",orient:"auto",children:e.jsx("polygon",{points:"0 0, 10 3.5, 0 7",fill:"hsl(var(--foreground) / 0.6)"})})]}),E.map(i=>{const p=ce.find(oe=>oe.id===i.source),I=ce.find(oe=>oe.id===i.target);if(!p||!I)return null;const{d:V,labelX:he,labelY:me}=ta(p,I),q=i.id===F,be=i.type==="conditional",Ne=i.isDefault;return e.jsxs("g",{className:"pointer-events-auto cursor-pointer",onClick:oe=>{oe.stopPropagation(),X(i.id),U(null)},children:[e.jsx("path",{d:V,fill:"none",stroke:q?"hsl(var(--primary))":be?"hsl(var(--foreground) / 0.6)":"hsl(var(--foreground) / 0.4)",strokeWidth:q?2.5:2,strokeDasharray:be?"6 3":Ne?"3 3":void 0,markerEnd:`url(#fd-arrowhead${q?"-selected":be?"-conditional":""})`}),(i.label||Ne)&&e.jsx("text",{x:he,y:me,textAnchor:"middle",className:"text-[10px] fill-muted-foreground",style:{fontSize:10},children:i.label??(Ne?"(default)":"")}),i.condition&&e.jsx("text",{x:he,y:me+12,textAnchor:"middle",className:"text-[9px] fill-orange-500",style:{fontSize:9},children:i.condition.length>24?i.condition.slice(0,24)+"…":i.condition}),e.jsx("path",{d:V,fill:"none",stroke:"transparent",strokeWidth:12})]},i.id)})]}),ce.map(i=>e.jsx(la,{node:i,isSelected:M===i.id,isConnectSource:z===i.id,connectMode:H,readOnly:l,showExecutionOverlay:m,onSelect:(p,I)=>{I||X(null),U(p)},onDelete:je,onDragStart:ua,onPortClick:da},i.id)),H&&z&&e.jsxs("div",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 bg-blue-600 text-white text-xs px-3 py-1.5 rounded shadow-lg pointer-events-none",children:[e.jsx(o.Link,{className:"h-3 w-3 inline mr-1"}),"Click a node port to complete the connection — Esc to cancel"]}),y.length===0&&e.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-muted-foreground text-sm",children:"No nodes yet. Use the toolbar to add nodes."})]})}),s&&D.length>0&&e.jsx("div",{className:"w-48 border-l bg-background flex-shrink-0 overflow-y-auto",children:e.jsx(ia,{versions:D})}),ae&&e.jsxs("div",{className:"w-52 border-l bg-background flex-shrink-0 overflow-y-auto",children:[e.jsx(ra,{node:G,edge:ne,readOnly:l,onNodeChange:ca,onEdgeChange:oa}),C&&e.jsxs("div",{className:"p-3 border-t",children:[e.jsx("p",{className:"text-[10px] font-semibold text-muted-foreground uppercase tracking-wide mb-1",children:"BPMN Export"}),e.jsx(a.Badge,{variant:C.success?"default":"destructive",className:"text-[10px]",children:C.success?`Exported ${C.nodeCount} nodes`:"Export failed"}),C.warnings?.map((i,p)=>e.jsx("p",{className:"text-[10px] text-amber-600 mt-0.5",children:i},p))]})]})]})]})};Y.ComponentRegistry.register("workflow-designer",Ce,{label:"Workflow Designer",category:"Enterprise",inputs:[{name:"workflow",type:"code",label:"Initial Workflow Definition"},{name:"readOnly",type:"boolean",label:"Read Only",defaultValue:!1},{name:"showToolbar",type:"boolean",label:"Show Toolbar",defaultValue:!0},{name:"showMinimap",type:"boolean",label:"Show Minimap",defaultValue:!1}]}),Y.ComponentRegistry.register("approval-process",ke,{label:"Approval Process",category:"Enterprise",inputs:[{name:"workflowId",type:"string",label:"Workflow ID"},{name:"instanceId",type:"string",label:"Instance ID"},{name:"currentNodeId",type:"string",label:"Current Node ID"},{name:"approvalRule",type:"code",label:"Approval Rule"},{name:"history",type:"code",label:"History"},{name:"showHistory",type:"boolean",label:"Show History",defaultValue:!0},{name:"showComments",type:"boolean",label:"Show Comments",defaultValue:!0}]}),Y.ComponentRegistry.register("automation-builder",_e,{label:"Automation Builder",category:"Enterprise",inputs:[{name:"automation",type:"code",label:"Automation Definition"},{name:"objects",type:"code",label:"Available Objects"}]}),Y.ComponentRegistry.register("automation-run-history",Ae,{label:"Automation Run History",category:"Enterprise",inputs:[{name:"runs",type:"code",label:"Run History"}]}),Y.ComponentRegistry.register("flow-designer",De,{label:"Flow Designer",category:"Enterprise",inputs:[{name:"nodes",type:"code",label:"Flow Nodes"},{name:"edges",type:"code",label:"Flow Edges"},{name:"title",type:"string",label:"Flow Title"},{name:"readOnly",type:"boolean",label:"Read Only",defaultValue:!1},{name:"showToolbar",type:"boolean",label:"Show Toolbar",defaultValue:!0},{name:"showMinimap",type:"boolean",label:"Show Minimap",defaultValue:!1},{name:"showVersionHistory",type:"boolean",label:"Show Version History",defaultValue:!1},{name:"showExecutionOverlay",type:"boolean",label:"Show Execution Overlay",defaultValue:!1},{name:"concurrencyPolicy",type:"string",label:"Concurrency Policy"},{name:"versionHistory",type:"code",label:"Version History"},{name:"executionSteps",type:"code",label:"Execution Steps"}]}),L.ApprovalProcess=ke,L.AutomationBuilder=_e,L.AutomationRunHistory=Ae,L.FlowDesigner=De,L.WorkflowDesigner=Ce,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,44 @@
1
+ import { default as React } from 'react';
2
+ export interface TriggerConfig {
3
+ type: 'record_created' | 'record_updated' | 'record_deleted' | 'field_changed' | 'scheduled';
4
+ objectName?: string;
5
+ fieldName?: string;
6
+ schedule?: string;
7
+ condition?: string;
8
+ conditionField?: string;
9
+ conditionOperator?: 'equals' | 'not_equals' | 'contains' | 'greater_than' | 'less_than';
10
+ conditionValue?: string;
11
+ }
12
+ export interface ActionConfig {
13
+ type: 'send_email' | 'update_field' | 'create_record' | 'delete_record' | 'webhook' | 'notification';
14
+ params: Record<string, any>;
15
+ }
16
+ export interface AutomationDefinition {
17
+ id: string;
18
+ name: string;
19
+ description?: string;
20
+ enabled: boolean;
21
+ trigger: TriggerConfig;
22
+ actions: ActionConfig[];
23
+ /** Execution mode: 'sequential' runs actions in order, 'parallel' runs all simultaneously. @default 'sequential' */
24
+ executionMode?: 'sequential' | 'parallel';
25
+ createdAt: string;
26
+ lastRunAt?: string;
27
+ }
28
+ export interface AutomationBuilderProps {
29
+ automation?: AutomationDefinition;
30
+ objects?: Array<{
31
+ name: string;
32
+ label: string;
33
+ fields?: Record<string, any>;
34
+ }>;
35
+ onSave?: (automation: AutomationDefinition) => void;
36
+ onCancel?: () => void;
37
+ className?: string;
38
+ }
39
+ /**
40
+ * AutomationBuilder - Trigger-Action pipeline configuration UI
41
+ * Lets users configure automations with trigger selection, action configuration,
42
+ * and metadata (name, description, enable/disable).
43
+ */
44
+ export declare const AutomationBuilder: React.FC<AutomationBuilderProps>;
@@ -0,0 +1,20 @@
1
+ import { default as React } from 'react';
2
+ export interface AutomationRun {
3
+ id: string;
4
+ automationId: string;
5
+ automationName: string;
6
+ status: 'success' | 'failure' | 'running' | 'pending';
7
+ startedAt: string;
8
+ completedAt?: string;
9
+ triggerEvent?: string;
10
+ error?: string;
11
+ }
12
+ export interface AutomationRunHistoryProps {
13
+ runs?: AutomationRun[];
14
+ className?: string;
15
+ }
16
+ /**
17
+ * AutomationRunHistory - Displays a list of past automation executions
18
+ * Shows status, automation name, trigger event, timing, and errors.
19
+ */
20
+ export declare const AutomationRunHistory: React.FC<AutomationRunHistoryProps>;
@@ -0,0 +1,12 @@
1
+ import { default as React } from 'react';
2
+ import { FlowDesignerSchema, FlowNode, FlowEdge } from '../../types/src';
3
+ export interface FlowDesignerProps {
4
+ schema: FlowDesignerSchema;
5
+ /** Called when user clicks save */
6
+ onSave?: (nodes: FlowNode[], edges: FlowEdge[]) => void;
7
+ }
8
+ /**
9
+ * FlowDesigner — canvas-based flow editor with spec v3.0.9 node types,
10
+ * conditional edges, BPMN export, and execution monitoring overlay.
11
+ */
12
+ export declare const FlowDesigner: React.FC<FlowDesignerProps>;
@@ -1,3 +1,9 @@
1
1
  import { WorkflowDesigner } from './WorkflowDesigner';
2
2
  import { ApprovalProcess } from './ApprovalProcess';
3
- export { WorkflowDesigner, ApprovalProcess };
3
+ import { AutomationBuilder } from './AutomationBuilder';
4
+ import { AutomationRunHistory } from './AutomationRunHistory';
5
+ import { FlowDesigner } from './FlowDesigner';
6
+ export { WorkflowDesigner, ApprovalProcess, AutomationBuilder, AutomationRunHistory, FlowDesigner };
7
+ export type { AutomationDefinition, AutomationBuilderProps, TriggerConfig, ActionConfig } from './AutomationBuilder';
8
+ export type { AutomationRun, AutomationRunHistoryProps } from './AutomationRunHistory';
9
+ export type { FlowDesignerProps } from './FlowDesigner';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@object-ui/plugin-workflow",
3
- "version": "3.0.2",
3
+ "version": "3.1.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.umd.cjs",
6
6
  "module": "dist/index.js",
@@ -17,20 +17,20 @@
17
17
  ],
18
18
  "peerDependencies": {
19
19
  "react": "^18.0.0 || ^19.0.0",
20
- "react-dom": "^18.0.0 || ^19.0.0",
21
- "@object-ui/components": "3.0.2",
22
- "@object-ui/core": "3.0.2",
23
- "@object-ui/react": "3.0.2",
24
- "@object-ui/types": "3.0.2"
20
+ "react-dom": "^18.0.0 || ^19.0.0"
25
21
  },
26
22
  "dependencies": {
27
23
  "clsx": "^2.1.1",
28
- "lucide-react": "^0.344.0",
29
- "tailwind-merge": "^2.6.1"
24
+ "lucide-react": "^0.576.0",
25
+ "tailwind-merge": "^3.5.0",
26
+ "@object-ui/components": "3.1.0",
27
+ "@object-ui/core": "3.1.0",
28
+ "@object-ui/react": "3.1.0",
29
+ "@object-ui/types": "3.1.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@types/node": "^25.2.3",
33
- "@types/react": "19.2.13",
32
+ "@types/node": "^25.3.3",
33
+ "@types/react": "19.2.14",
34
34
  "@types/react-dom": "19.2.3",
35
35
  "@vitejs/plugin-react": "^5.1.4",
36
36
  "vite": "^7.3.1",