:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(workflows): improve editor configuration panel (#95994)
Ben Whitee8e4f990ab5f
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex dec928e1c0b0..18a052d046b2 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -361,17 +361,17 @@ snapshots:components-currencydropdown--currency-dropdown-story--light:hash: v1.k794b7964.cf1bfb2ab4acaa1a053d7964d8bbc2a356fd3e927b47bbb80469230c7ae8b7d4.TUxSw7ch7Iwn8kEcWO0_Yi0XhOHosR5J4nbLixw2rpAcomponents-cyclotron-job-inputs--slack-fully-scoped--dark:- hash: v1.k794b7964.6b6600488927bbc94b6119dc8a21b54cbc0fe761f00895302a4ffefb511a232e.bFlPCqbnurnWbgMJhocUIlVsoYJmJc1psMBdEBGlk74+ hash: v1.k794b7964.32c5a6c96ac58fa9796a15145905ef63d838c3feee4fb49224ce04ea09b3a746.PudtzmvWJqAkb6CGrJYFRN872nI6DtZKMmDy5i_Qvuccomponents-cyclotron-job-inputs--slack-fully-scoped--light:- hash: v1.k794b7964.09c6b6060ccce1f0b0a49bb46a765200b5f68d8fdb61f39a18edae4b3d21b540.MvepyS3jqjmSn57ZsxLmzfXAWToxK17vDYihdF9C7sU+ hash: v1.k794b7964.91174bce75ee1fd6fe9a730d1b32a925c679d1efeab9730f4f532a0029b3b788.JMo9gAN9ujlnkzXv6f8jXXIPQCnuCATUIvmt3mKOz6Ycomponents-cyclotron-job-inputs--slack-missing-optional-scope--dark:- hash: v1.k794b7964.e1d728f9adfdbda45275626876d376e2ae98c00186201f683628413badc3057c.rhwyg4RHd41vvfGl97Oh6I06VUC-DdT6fjd12qqiT4M+ hash: v1.k794b7964.a898fba15e91eb2d0e07108aa74ed6ab734a626887252ca0ca47fe35444a2b0d.NsoLQ0lWFBVrOATav3SLLatlUblJW7RUPc3t64_TPpUcomponents-cyclotron-job-inputs--slack-missing-optional-scope--light:- hash: v1.k794b7964.1241f841266fed8307e644949d4fa6317253e930c2ad315fa3c71d816bdff7b1.7QmLkiKC8l2Fjhy9YLCjfb3AQJCggwx1d6NO7Ei-e0M+ hash: v1.k794b7964.b49f9771b1f408090c164bd4e33bb9784a3426d3e14a26026433714d5da52abf.1UPMeXQxGq-TMJAHLdAV0KxVGMv1hq-v-IhngNhiZ0Ucomponents-cyclotron-job-inputs--slack-missing-required-scope--dark:- hash: v1.k794b7964.632486ff7aefa1b8f51da6d5a7c2bc638f494a7b5db9c736b187ec89de6ced23.YVHF9x8aZnG5RuygbYdVOrYm1iMEKxV--fMovqtHbXs+ hash: v1.k794b7964.7ea1be07d335a8c65b0c5a4c252200eb377f1025a8ffbf8764d71289af4e3a21.3iQHKKdSMowyAXrfGe6gsVDkDysU0awgjkAJzF5QS1Mcomponents-cyclotron-job-inputs--slack-missing-required-scope--light:- hash: v1.k794b7964.23aac2138e1992b6185127ac270c052a26a3661e6fd74b0687b4f1c7202a1bb7.P5NQ0GHxctH-r9RzeyctpASV3TfIMOXhhyIOlK1pKsw+ hash: v1.k794b7964.286bc56fded6e2964f1d252b963165cb5d3c451025544b1097cb55ce9c112514.JbZjHr0YX3Fsbz5roSzcZB5c1ZtwVtHUsPsKVSaC0Zocomponents-date-picker--clearable--dark:hash: v1.k794b7964.b7266885dd76d695e18fd842cc560821d4e8ced76555b06fc8bcab144c621883.IgiHE2iUIHF7K8Vk42p9fnmWZhjXpb0j7EW1bGnsIEQcomponents-date-picker--clearable--light:@@ -5812,6 +5812,66 @@ snapshots:hash: v1.k794b7964.d553cecf3e544087316e1687404c8e2b3a6c19f618a05e09880e60e656054f23.hNkLLb04XLyd-PQJa59WwPhgRAxMbW5fSDzCnowJKBsproducts-workflows-customerioimportmodal--step-4-track-not-configured--light:hash: v1.k794b7964.0954891b73cdc0b1bce1275fa11a5fa4af2055b83b518bce82f3fde886097659.mgEq2W8sZg7x-vt8z2EpwEHPBGRzPI1GWtn-9tu-46o+ products-workflows-editor-configuration-panel--build--dark:+ hash: v1.k794b7964.6a3a36479e35b8bbaf372cb2dd57294057c194cfd1bb775cb6768643aea59847.FNZpZtUWTFG5zmQsJSRSUbtrsKygyth8_0FX_XdG8WA+ products-workflows-editor-configuration-panel--build--light:+ hash: v1.k794b7964.905239fe74addd7193db04313fae18a0c2f5591ff8d7140338b1bad229d7db8e.2Vd6rHRkdUNu8CsIO-BLe6rqrkuwPRGWIexIma9HyE0+ products-workflows-editor-configuration-panel--build-palette--dark:+ hash: v1.k794b7964.3068ced5ff38e16c729b66f333023f90f8a5b14f9ad13c6b877f3080f1730736.AtL5g22RJZPiX90k6O3D-0da2DtdPLMg-NQNKJ4Ficw+ products-workflows-editor-configuration-panel--build-palette--light:+ hash: v1.k794b7964.ec28f7c380ae5e13b96257d733150e4cde8443dfab152e8d92f3c730c05cc52f.DeHnuPIJ3F_CEIwi_6ECbRYd7uPKPj-6ZlKj5_KSCqg+ products-workflows-editor-configuration-panel--cohort-branch--dark:+ hash: v1.k794b7964.330ad940d732b05530ad6c6d1c1ce0c26149b857bd20cc214cbe7209fccee415.WtGoxeyoXxBu5AkOrj4CPxgMTsI2gwqi63gvoimPHqI+ products-workflows-editor-configuration-panel--cohort-branch--light:+ hash: v1.k794b7964.72a2c1f5905bd969e2179a030ce399b3a8ff3c3e23546adb3f2c4129077f4227.RfaimUSHlUpwmK7W_t_H6ZlEthxtdSQr6W_oJyU8gZg+ products-workflows-editor-configuration-panel--conditional-branch--dark:+ hash: v1.k794b7964.d4b0b279073ea581caf96a8bbc8c8d338a5ec1c7419172612f5dfcb8a35dc20b.-U4fPTAIryjtGBV2kTcfuM2W8u3rvFGzoeGCOnBo40c+ products-workflows-editor-configuration-panel--conditional-branch--light:+ hash: v1.k794b7964.37849e4c1f80f5aeadaef15e594e0412d41873851a658f8f43943c7996fe52fd.DQulw_YGBM8n0wQKd1rHWDNIOasvltY5UU2wPOMbezw+ products-workflows-editor-configuration-panel--logs--dark:+ hash: v1.k794b7964.beabe0c2c69154a7e7b8e5709226f710bbb707c7a2a96ea3b908e7b5348ad177.l8BzDM-8b8Z6jYzADnoiRggNuU02m3lgVa6vtNm2VOw+ products-workflows-editor-configuration-panel--logs--light:+ hash: v1.k794b7964.e2ae4d6a508b7cfdbc09c3843e1e7c7caedcbe5902ce7f7f81631eefd48b821b.1eE_3Zo-nzcr7dE2fP4A2qr7ajX485FGAN-2208Z-Sg+ products-workflows-editor-configuration-panel--metrics--dark:+ hash: v1.k794b7964.4eb61af73d79487b1b0d1c10b0f082d8093843922622ff24ae2b8f2b6eb2306d.kHaOuT84uzvGJnQ69XZxOeCDw_A0SN2elIYBF0JTPCc+ products-workflows-editor-configuration-panel--metrics--light:+ hash: v1.k794b7964.609fbe2b979a5be98bcbc013a33fea41aa0c114e1aa1ac2d9a11e01f27b7fda5.SPwPLnrmhsRpBj9Bl_s4OyLAm7bV1rlJPgaB6ZwnXAo+ products-workflows-editor-configuration-panel--test--dark:+ hash: v1.k794b7964.a005c215d18dd3b4a91651f9bc62a17ca6cc6d4ab07ca9708ebe62d76e8ccd5c.Ediq2wIVv_iK0b1q9d4R4iEvzQWpsPK1YaE5_KRciZQ+ products-workflows-editor-configuration-panel--test--light:+ hash: v1.k794b7964.324443ca3dfa6d45f269a44f666d446169faf32d27d79ce8185412da262bc7ab.bisWMQlMS56hK2z2NzlvALn30r5FtH9mIi38xWAkW4A+ products-workflows-editor-configuration-panel--variables--dark:+ hash: v1.k794b7964.c936a553b0ecd3a1a7cd478e4848cb6ad5d3c7c566e7c47aca7c164b663ce106.PFeB3oTy3Wr4fmTcYgVv56Ur35h7UpA9BOFeO-8Y63s+ products-workflows-editor-configuration-panel--variables--light:+ hash: v1.k794b7964.e755c7e47cc53fab702c298414df2ab452bbe7f0182475888e8d6a6614174142.NrDxyc4ZMWe9aaXccP1uyLnJoFvt5gp5UDi4IObWHJ4+ products-workflows-editor-configuration-panel--webhook--dark:+ hash: v1.k794b7964.b82ad29d913ba8dd1ed9bdf4df2b4173527e69ec4d444f3c37ff233a8fe7fdcd.pSZZNRGDOxD-xO0LCo1XiJXH0X5yBCuvLB_44Q21ZXs+ products-workflows-editor-configuration-panel--webhook--light:+ hash: v1.k794b7964.57bca0d67317055160426c969f4f9c63a850a2240cda64b141e035c87dc8198a.zdBd3SBBJtGX85QCOFUw2WFRK-SoocCeTjtu__zuhVQ+ products-workflows-editor-graph--add-on-promotion-emails--dark:+ hash: v1.k794b7964.4e05cc89e810a0658cc3a95ad89ad3818b663f032294a768bf31dd45f255e229.wkYlcGi9vkdpW7HMrEMsxh4gMxH0ZiJSHwidbTkxC7A+ products-workflows-editor-graph--add-on-promotion-emails--light:+ hash: v1.k794b7964.0df096512fda16f0d1fa1ebfed25fd9df287e7cf273d7bd56a93b3d5a316b2eb.0Td6CXL_NV0F9bNlH2sKu6FEJ3bi-WFQMYYeSV3LBY8+ products-workflows-editor-graph--customer-onboarding-and-retention--dark:+ hash: v1.k794b7964.3191c1984e08a93b2b41186d743c5a7488306da8caac823a858b8b3009e8e249.tarfXhWwpkEO50Lg4xl-tg04f2F4DdHi_urFckZ3mLE+ products-workflows-editor-graph--customer-onboarding-and-retention--light:+ hash: v1.k794b7964.314cf434a29589c34e750ddf718b290c72d20bc3286c17592aafc3f830654453.Lnspo02g4g3NLYVjNtw1Mk_FF0y8FI0er4k7ZPGVlCg+ products-workflows-editor-graph--new-workflow--dark:+ hash: v1.k794b7964.7ba2d7e983927e8e8375e47d0c949b93943fd66aae376f98e125d683dd4ffd99.YZb3PzvlCIEGiDRA-lVQffhm1K7TV_CXi-VCWJpzbLc+ products-workflows-editor-graph--new-workflow--light:+ hash: v1.k794b7964.a4626c7c6687ecfce8b18483f3023e63d6fea340afe537c77ac3b54b9806ec7a.yLmzRxJrZgQVkxgPOef_FH4ALnTa2GGJYnO-5Hxodn0+ products-workflows-editor-graph--pending-ticket-cleanup--dark:+ hash: v1.k794b7964.50a685ff409fb1d3bb91bcca26cc519dbac7448245365e0fb83395ce34373116.RXLJNJWCGBCN2FsWZkjCZMOaglz9nNSYEbyPcTXWzec+ products-workflows-editor-graph--pending-ticket-cleanup--light:+ hash: v1.k794b7964.4af1b3ca8104f959250ec3c225c86ef68f36009ce8a0fc4569356e9e8491ff7b.PVlHcgjmjoOtUTvUiSfkcjhxoaWESCG0-iNbC-nm_2g+ products-workflows-editor-graph--renewal-window-alerts--dark:+ hash: v1.k794b7964.e262932c316a84d6e05ad90bae8c5cedc77bdb9d5b39804aa6b48ebcc0603581._vvGJVTaEGD2tI4GdyktkuUZ2mXbWetsfgJ9m_Z0QQY+ products-workflows-editor-graph--renewal-window-alerts--light:+ hash: v1.k794b7964.fab81e2858c6ee5f4f670f1d274901a1346302f174bc933d8ab098c124cf5555.ORDicecK-aPejsEHWHeQZimUJ2B0P6wBOM12IsLwC54+ products-workflows-editor-graph--support-sla-routing--dark:+ hash: v1.k794b7964.7c60c3d139d5b5dabbd7fb974f621f135149176f1c86184aed079c6deaef414e.AkijMDM4cBxIWBu4E8V7VThp1fwVqHJcfVB24fcGK0Y+ products-workflows-editor-graph--support-sla-routing--light:+ hash: v1.k794b7964.96264d77ca9e5d4897c48f8552d051ab6a414675e9a5d62b1878c40955e60a12.veQ0qlbkuVu45XgikLqMm6GhiTqaU-iYLBAUuvq-W_oproducts-workflows-reputation--domain-withheld-from-caller--dark:hash: v1.k794b7964.b37b29c7894aedb7ca34c4976577e3aaed60f5e81a99d29c427ad4d5eeaf16ce.p2UYtjwRYsZEy_dF6JZTqzYZC8PD-WIUSALXCQGdpjMproducts-workflows-reputation--domain-withheld-from-caller--light:@@ -7409,13 +7469,13 @@ snapshots:scenes-app-hogfunctions-destination--backfills-with-data--light:hash: v1.k794b7964.f971c9b24daa779751f4ca9c4a58a6d640b1f1dc482c989521b5aed68d07f5ee.MRVlqmTBTYcUbMQypG59y05w-tbxT3zVWBzTz0rPUF4scenes-app-hogfunctions-destination--configuration--dark:- hash: v1.k794b7964.2bcff54f9ad6358506cae8685b866588768a6bf3b12e1206b44e12117af66b74.x8785_1cTWDDTOKUZ6bo_aaCdCmZqaw7gMW6Z-1UP_Y+ hash: v1.k794b7964.223508b013da38920173df823399295182e439a8de39e9f8cfd6992351bfc271.V6Wsz9TlPhAX9JZY3lkQYY7GTH5mYojAeoNt2cWdTooscenes-app-hogfunctions-destination--configuration--light:- hash: v1.k794b7964.017e810f0318afd1c39d5cd1c6aa5940e90b4ff3c973fea41bdf97d18e990c0a.wJQCOhdVG5nS7tEsBg8jhn7KTQ3zJ0PYP_ufsrJGy4o+ hash: v1.k794b7964.90552c2f27ea69c80e19de0938bdb788247b88d84e5cc9e24e03a3754c21205d.5Qr5PUJCjfkn63QYBaLbRJJA097ATMp04-j4h11IL5Escenes-app-hogfunctions-destination--configuration-with-templating-warning--dark:- hash: v1.k794b7964.793141fe3d94b1fc2cbf718756a6cb44ab776174a97e321234e27850b146b9ba.OjefoswkkLvUsu435xadckHvuPxGVLgweiuoodY5xoY+ hash: v1.k794b7964.48b8ad56d53c7d94f11a38ffbbc427f28749e20a9b4c45db44ab31d38f5c802c.5kCX5H6hoaQnvoT0X2xQyUfuHz63GBN2N4zLGDE7zTkscenes-app-hogfunctions-destination--configuration-with-templating-warning--light:- hash: v1.k794b7964.98b862f4cb9ecf895257d7fc7ad7b65e9c3a08dc5a25411c06d734c86889c8b9.aKGEVkwwOS7j02ELp_ad65_LC2FN1XlQ1shJO9olgRs+ hash: v1.k794b7964.89b85f293e81075f29d75ecb3d2113edc0e558737de3db7a289734eb1d8d10b1.vQFy8PlG2IBmyBFZZ7fOoOwYORYo31hbv03jo8HbeWMscenes-app-hogfunctions-destination--runs-empty--dark:hash: v1.k794b7964.9338d457e2d64f5a491115541fa681db1c44ab049531d9eec24d58fa056a31f0.mhgFOxcURq4YcXhnV16BaRPW4OAZ5mFkUBgjhDazfhgscenes-app-hogfunctions-destination--runs-empty--light:@@ -8341,9 +8401,9 @@ snapshots:scenes-app-notebooks-widget-views--survey-views--light:hash: v1.k794b7964.3dad7f9ff2bafb766aae416a754bb9830773e886993739e75339d6dc75d668d0.PlGQ57dwA4jzdVj-lXAcqVCY0YxNXkT0w0ZZrvYmI0Yscenes-app-notebooks-widget-views--workflow-views--dark:- hash: v1.k794b7964.6c3b6ef52b19223903911867b010844352f5b4883d92766cf163f4db558b8419.ZjLDs3scIHzDzzSGNQ8eFZe3n4pHXvxzJ0VhDjJmnxQ+ hash: v1.k794b7964.f0925e7e3630c4ad91250fa7060c55e5dbf94841a847b5fb1b07a874121d6d70.1WP3_PNV_1ly9tJEzXnuVWY5eP_Rg2WWkL9_YJ8kcf8scenes-app-notebooks-widget-views--workflow-views--light:- hash: v1.k794b7964.064edb23945005b5c823d536379fd2452ec6869b4261b3fad548d7a2ee60ee35.ri6wAnXDlZHcjYG-JjdKjkFiSRtHzZq_XwQQ4hvqthY+ hash: v1.k794b7964.10374665f60a6264239ae1efe6726c42611f17b391286ad09f29d752d96d4e70.vNLXzmHiA_B3gCYXQ6nD5NFPUtrveq1WK8WHjde4s6kscenes-app-oauth-authorize--all-scopes-optional--dark:hash: v1.k794b7964.a03d00f6626add00255abe8fa712c056cecbf929f724284de20cf6e936a96fbe.cCaJ_N0193dGvxNreYfm9ltl9zmGo4r3-9-vKCX7TwQscenes-app-oauth-authorize--all-scopes-optional--light:@@ -9141,21 +9201,21 @@ snapshots:scenes-app-surveys--surveys-list--light:hash: v1.k794b7964.cf5d73f8325b5294303cd755262266b76376caf5d2181dc8fdb7d52bbbf45ca4.j1dVq5PZXR13I9Zx2LZMfuZ23EghxOvikpJ8affvZgYscenes-app-surveys-surveyresponsekeysreference--discord--dark:- hash: v1.k794b7964.e838d7a7be567a6699af309c1bc51c6a785eec57fad43fb6bfcf11c3552e11ae.p63PN2zY4GcsfbvIyvhy4FuxqxvDpB-iRGH3rAGMVa0+ hash: v1.k794b7964.063f83726b1d84f510c11aa2c2543e9ea3545264a5e267746c48aeca4b7b3a5e.QLAOZARJh9raPvuS6k6hypF11ZLIRw7xwQJH7UEUNb0scenes-app-surveys-surveyresponsekeysreference--discord--light:- hash: v1.k794b7964.a4feae941d475c67c4c5b7812aaacb4e30d27625cdaabf768aa6ad03e3bcacd0.Jed53h2ZmCEa8_w_mRKa6Mo6I1WhTHvFOC-nAHCtRMw+ hash: v1.k794b7964.51dd0ba62cb17c44f7a1562a978cb21936cf3d332ec79984bde790b0988985bd.tFaqx15WU0PChVRdRgC2P17J2IHsLRSiaBqrAG2aWPcscenes-app-surveys-surveyresponsekeysreference--microsoft-teams--dark:- hash: v1.k794b7964.c5d10116e71df6e055e46895262bdd64613de75b49a914a647f8b499aea1d514.Od8_105Ifyf99GJAyf46-o5dRg3ijT18pvZAiAHIAmQ+ hash: v1.k794b7964.b21a23db6e00352f23ada212adba422cb860afcad9b47c1f5a8aef6d7e8e5ed2.EF-ewe3pK0JcHkDaBz5wceGA_NaEgAblnorHaZ9ljdsscenes-app-surveys-surveyresponsekeysreference--microsoft-teams--light:- hash: v1.k794b7964.5802f49b465f16ff4a7aed1a62630f9e819ca8d58fa27765fe11713aed0bc063.0dVstXErA7bB2KeKSRtHKMI53cifZWRuBUIPjW1CMgQ+ hash: v1.k794b7964.e547a3f9c13ed2572b2ce7fe722c4969de3ddc8e0c177b9d5eb1bafb017ffdda.OIyAyKB5E3tEPJnUUeSE5A4irhZNc8_at3gqk1NPzrsscenes-app-surveys-surveyresponsekeysreference--slack--dark:- hash: v1.k794b7964.289666e695e09b95dc35deb2a8f2171cc743a37a62a5b78b04aae6085bb65ccd.aPcl_6XoL9phMkL5VwuTRZdDgUB-AuuNWEDacNkPSHE+ hash: v1.k794b7964.da82ea52bfaad32baaadd2b2dff67199092a9f82d971d1be883d43fa597faed7.1EnQNOS0sRY6lH0h8CLcy73UlSrWWIf9mxylVbqIMw4scenes-app-surveys-surveyresponsekeysreference--slack--light:- hash: v1.k794b7964.2abfd2d26e26fbf28873c3f73c6953eceb8cad34c476437cd01fbb53902e825b.LmLxQZyECr3qvQOgRSV4p-x3PAl4_WQ0dOaGF45hNY4+ hash: v1.k794b7964.6c59a7b8c08111b749a2698eb7bd506596c28f261f838ae90abb537942b4b08f.odEWmBrNrB-8CVTaa1ghSyQAa2IZlQneQ1pBNqtE8p8scenes-app-surveys-surveyresponsekeysreference--webhook--dark:- hash: v1.k794b7964.77756df88375db077db0cab89072ecde78bc9f4dddc2902522914789709473a7.jeV_5jxogQcflTArm0snEBzFpFYE0tVWEJtzZP4x2ME+ hash: v1.k794b7964.1234ce11c2b03ff3e0a4a41eda4da0c033361aaa0a4ae31d00f2ee966a216270.6jMMIFd43bSq7kmGgVrwQOlvv2XXBE4ciOdoBFUjqSMscenes-app-surveys-surveyresponsekeysreference--webhook--light:- hash: v1.k794b7964.6cd0cfc5275afb494c4fd479d8cfc045b61c21403edc5d967dd7a6b0a95ea4c6.3SHmed00NzWos23UqElIz7GB8Ip0D3B3-HNFTSuMRqw+ hash: v1.k794b7964.c2676130771cba15a3b1cd5b9c511f42fce4d3345f761a1c112e8f12ca1dfcc0.N4q5DAtNnKGEGrtCJv-vQYe5KOhn7D9Ocu6IRBkp9yEscenes-app-tasks--empty--dark:hash: v1.k794b7964.d112f05471a711379792d3010c0c6471fe0c24765510d4b9f00ebd1f858e4016.6JBRci6NsHBPP7tehgmjAOGfr8AMPqfwMs8Mc8DWWzAscenes-app-tasks--empty--light:diff --git a/frontend/src/lib/components/CyclotronJob/CyclotronJobInputs.tsx b/frontend/src/lib/components/CyclotronJob/CyclotronJobInputs.tsxindex df72137ff37c..e8f9aa2182db 100644--- a/frontend/src/lib/components/CyclotronJob/CyclotronJobInputs.tsx+++ b/frontend/src/lib/components/CyclotronJob/CyclotronJobInputs.tsx@@ -164,27 +164,29 @@ export function CyclotronJobInputs({}}><SortableContext disabled={!showSource} items={inputSchemaIds} strategy={verticalListSortingStrategy}>- {configuration.inputs_schema- ?.filter((i: CyclotronJobInputSchemaType) => !i.hidden)- .map((schema: CyclotronJobInputSchemaType) => {- return (- <CyclotronJobInputWithSchema- key={schema.key}- schema={schema}- configuration={configuration}- parentConfiguration={parentConfiguration}- onInputSchemaChange={onInputSchemaChange}- onInputChange={onInputChange}- showSource={showSource}- sampleGlobalsWithInputs={sampleGlobalsWithInputs}- errors={errors}- warnings={warnings}- emailFieldErrors={emailFieldErrors}- emailLiveChanges={emailLiveChanges}- emailSaveIndicator={emailSaveIndicator}- />- )- })}+ <div className="flex flex-col gap-3">+ {configuration.inputs_schema+ ?.filter((i: CyclotronJobInputSchemaType) => !i.hidden)+ .map((schema: CyclotronJobInputSchemaType) => {+ return (+ <CyclotronJobInputWithSchema+ key={schema.key}+ schema={schema}+ configuration={configuration}+ parentConfiguration={parentConfiguration}+ onInputSchemaChange={onInputSchemaChange}+ onInputChange={onInputChange}+ showSource={showSource}+ sampleGlobalsWithInputs={sampleGlobalsWithInputs}+ errors={errors}+ warnings={warnings}+ emailFieldErrors={emailFieldErrors}+ emailLiveChanges={emailLiveChanges}+ emailSaveIndicator={emailSaveIndicator}+ />+ )+ })}+ </div></SortableContext></DndContext></>@@ -983,6 +985,7 @@ function CyclotronJobInputWithSchema({>{!editing ? (<LemonField.Pure+ className="gap-1"error={error}help={<>diff --git a/products/workflows/frontend/Workflows/hogflows/editor/graph/HogFlowGraphEditor.stories.tsx b/products/workflows/frontend/Workflows/hogflows/editor/graph/HogFlowGraphEditor.stories.tsxnew file mode 100644index 000000000000..e5e34510bfb3--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/editor/graph/HogFlowGraphEditor.stories.tsx@@ -0,0 +1,53 @@+import type { Meta, StoryFn } from '@storybook/react'+import { BindLogic, useValues } from 'kea'++import { SpinnerOverlay } from '@posthog/lemon-ui'++import { workflowLogic } from '../../../workflowLogic'+import { HogFlowEditor } from '../../HogFlowEditor'+import {+ CUSTOMER_ONBOARDING_AND_RETENTION_WORKFLOW_ID,+ workflowEditorStoryDecorator,+} from '../workflowEditorStoryFixtures'++const meta: Meta<typeof HogFlowEditor> = {+ title: 'Products/Workflows/Editor/Graph',+ component: HogFlowEditor,+ parameters: {+ layout: 'fullscreen',+ testOptions: {+ waitForLoadersToDisappear: true,+ waitForSelector: '[data-attr=workflow-editor]',+ viewport: { width: 1600, height: 1000 },+ },+ },+ decorators: [workflowEditorStoryDecorator],+}+export default meta++const WorkflowStory = ({ id }: { id: string }): JSX.Element => (+ <BindLogic logic={workflowLogic} props={{ id }}>+ <div className="h-screen [&>div]:!h-full [&>div]:!max-h-none">+ <StorybookWorkflow />+ </div>+ </BindLogic>+)++function StorybookWorkflow(): JSX.Element {+ const { originalWorkflow } = useValues(workflowLogic)++ return (+ <div className="flex h-full flex-col">+ {originalWorkflow ? <HogFlowEditor key={originalWorkflow.id} /> : <SpinnerOverlay />}+ </div>+ )+}++export const NewWorkflow: StoryFn = () => <WorkflowStory id="new" />+export const CustomerOnboardingAndRetention: StoryFn = () => (+ <WorkflowStory id={CUSTOMER_ONBOARDING_AND_RETENTION_WORKFLOW_ID} />+)+export const SupportSlaRouting: StoryFn = () => <WorkflowStory id="example-support-sla-routing" />+export const RenewalWindowAlerts: StoryFn = () => <WorkflowStory id="example-renewal-window-alerts" />+export const PendingTicketCleanup: StoryFn = () => <WorkflowStory id="example-pending-ticket-cleanup" />+export const AddOnPromotionEmails: StoryFn = () => <WorkflowStory id="example-add-on-promotion-emails" />diff --git a/products/workflows/frontend/Workflows/hogflows/editor/workflowEditorStoryFixtures.ts b/products/workflows/frontend/Workflows/hogflows/editor/workflowEditorStoryFixtures.tsnew file mode 100644index 000000000000..6f4970bf31c6--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/editor/workflowEditorStoryFixtures.ts@@ -0,0 +1,323 @@+import { mswDecorator } from '~/mocks/browser'++import { NEW_WORKFLOW } from '../../workflowLogic'+import { EXAMPLE_WORKFLOWS } from '../tree/exampleWorkflows'+import type { HogFlow, HogFlowAction } from '../types'++export const CUSTOMER_ONBOARDING_AND_RETENTION_WORKFLOW_ID = 'storybook-complex-workflow'+export const CUSTOMER_ONBOARDING_AND_RETENTION_WORKFLOW: HogFlow = {+ id: CUSTOMER_ONBOARDING_AND_RETENTION_WORKFLOW_ID,+ team_id: 1,+ version: 7,+ name: 'Customer onboarding and retention',+ description: 'Routes new accounts by stage and follows up when activation stalls.',+ status: 'draft',+ trigger: {+ type: 'event',+ filters: {+ events: [{ id: 'account_created', name: 'Account created', type: 'events' }],+ properties: [],+ actions: [],+ },+ },+ conversion: { window_minutes: 10080, filters: [] },+ exit_condition: 'exit_only_at_end',+ variables: [+ { key: 'account_stage', type: 'string', label: 'Account stage', default: 'new' },+ { key: 'follow_up_count', type: 'number', label: 'Follow-up count', default: 0 },+ ],+ actions: [+ {+ id: 'trigger',+ type: 'trigger',+ name: 'Account created',+ description: 'Starts when a new account is created.',+ config: {+ type: 'event',+ filters: {+ events: [{ id: 'account_created', name: 'Account created', type: 'events' }],+ properties: [],+ actions: [],+ },+ },+ },+ {+ id: 'route-by-stage',+ type: 'conditional_branch',+ name: 'Route by customer stage',+ description: 'Choose a path based on the current account stage.',+ config: {+ conditions: [+ {+ name: 'Paid account',+ filters: {+ properties: [{ key: 'account_stage', value: ['paid'], operator: 'exact', type: 'person' }],+ },+ },+ {+ name: 'Trial account',+ filters: {+ properties: [{ key: 'account_stage', value: ['trial'], operator: 'exact', type: 'person' }],+ },+ },+ {+ name: 'At-risk account',+ filters: {+ properties: [+ { key: 'account_stage', value: ['at_risk'], operator: 'exact', type: 'person' },+ ],+ },+ },+ ],+ },+ },+ {+ id: 'notify-account-team',+ type: 'function',+ name: 'Notify account team',+ description: 'Send the paid account to the account team.',+ config: {+ template_id: 'template-slack',+ inputs: {+ slack_workspace: { value: 1 },+ channel: { value: '#account-updates' },+ text: { value: 'A paid account was created for {person.properties.email}.', templating: 'hog' },+ },+ },+ },+ {+ id: 'wait-for-business-hours',+ type: 'wait_until_time_window',+ name: 'Wait for business hours',+ description: 'Continue on a weekday between 09:00 and 17:00 UTC.',+ config: { timezone: 'UTC', day: 'weekday', time: ['09:00', '17:00'] },+ },+ {+ id: 'choose-onboarding-path',+ type: 'random_cohort_branch',+ name: 'Choose onboarding path',+ description: 'Split trial accounts between two onboarding paths.',+ config: {+ cohorts: [+ { name: 'Guided onboarding', percentage: 60 },+ { name: 'Self-serve onboarding', percentage: 30 },+ ],+ },+ },+ {+ id: 'create-onboarding-task',+ type: 'function',+ name: 'Create onboarding task',+ description: 'Create a task for the guided onboarding path.',+ config: {+ template_id: 'template-webhook',+ inputs: {+ url: { value: 'https://example.com/hooks/onboarding' },+ method: { value: 'POST' },+ body: { value: { account_id: '{person.id}', path: 'guided' }, templating: 'hog' },+ },+ },+ },+ {+ id: 'wait-one-day',+ type: 'delay',+ name: 'Wait one day',+ description: 'Give the self-serve path time to activate.',+ config: { delay_duration: '1d' },+ },+ {+ id: 'send-self-serve-reminder',+ type: 'function',+ name: 'Send self-serve reminder',+ description: 'Request a reminder from the messaging service.',+ config: {+ template_id: 'template-webhook',+ inputs: {+ url: { value: 'https://example.com/hooks/reminders' },+ method: { value: 'POST' },+ body: { value: { account_id: '{person.id}', reminder: 'activation' }, templating: 'hog' },+ },+ },+ },+ {+ id: 'hold-control-group',+ type: 'delay',+ name: 'Hold control group',+ description: 'Wait before measuring the control group.',+ config: { delay_duration: '3d' },+ },+ {+ id: 'wait-for-activation',+ type: 'wait_until_condition',+ name: 'Wait for activation',+ description: 'Continue when the account activates or after seven days.',+ config: {+ condition: {+ name: 'Product activated',+ filters: { events: [{ id: 'product_activated', name: 'Product activated', type: 'events' }] },+ },+ max_wait_duration: '7d',+ },+ },+ {+ id: 'share-activation',+ type: 'function',+ name: 'Share activation',+ description: 'Notify the retention team that activation completed.',+ config: {+ template_id: 'template-slack',+ inputs: {+ slack_workspace: { value: 1 },+ channel: { value: '#retention-updates' },+ text: { value: 'Account {person.id} activated.', templating: 'hog' },+ },+ },+ },+ {+ id: 'create-follow-up-task',+ type: 'function',+ name: 'Create follow-up task',+ description: 'Create a task when activation does not complete.',+ config: {+ template_id: 'template-webhook',+ inputs: {+ url: { value: 'https://example.com/hooks/follow-up' },+ method: { value: 'POST' },+ body: { value: { account_id: '{person.id}', reason: 'activation_timeout' }, templating: 'hog' },+ },+ },+ },+ {+ id: 'send-activation-outcome',+ type: 'function',+ name: 'Send activation outcome',+ description: 'Record whether the account activated or needs a follow-up.',+ config: {+ template_id: 'template-webhook',+ inputs: {+ url: { value: 'https://example.com/hooks/activation-outcomes' },+ method: { value: 'POST' },+ body: { value: { account_id: '{person.id}' }, templating: 'hog' },+ },+ },+ },+ {+ id: 'record-self-serve-account',+ type: 'function',+ name: 'Record self-serve account',+ description: 'Record accounts that do not match a managed stage.',+ config: {+ template_id: 'template-webhook',+ inputs: {+ url: { value: 'https://example.com/hooks/self-serve' },+ method: { value: 'POST' },+ body: { value: { account_id: '{person.id}', path: 'self_serve' }, templating: 'hog' },+ },+ },+ },+ {+ id: 'pause-before-summary',+ type: 'delay',+ name: 'Pause before summary',+ description: 'Wait 30 seconds before recording the final outcome.',+ config: { delay_duration: '30s' },+ },+ {+ id: 'record-workflow-outcome',+ type: 'function',+ name: 'Record workflow outcome',+ description: 'Send the completed route to the example endpoint.',+ config: {+ template_id: 'template-webhook',+ inputs: {+ url: { value: 'https://example.com/hooks/outcomes' },+ method: { value: 'POST' },+ body: { value: { account_id: '{person.id}', status: 'complete' }, templating: 'hog' },+ },+ },+ },+ {+ id: 'exit',+ type: 'exit',+ name: 'End workflow',+ description: 'The account has completed its onboarding route.',+ config: { reason: 'Onboarding route completed' },+ },+ ] as HogFlowAction[],+ edges: [+ { from: 'trigger', to: 'route-by-stage', type: 'continue' },+ { from: 'route-by-stage', to: 'notify-account-team', type: 'branch', index: 0 },+ { from: 'notify-account-team', to: 'wait-for-business-hours', type: 'continue' },+ { from: 'wait-for-business-hours', to: 'pause-before-summary', type: 'continue' },+ { from: 'route-by-stage', to: 'choose-onboarding-path', type: 'branch', index: 1 },+ { from: 'choose-onboarding-path', to: 'create-onboarding-task', type: 'branch', index: 0 },+ { from: 'create-onboarding-task', to: 'pause-before-summary', type: 'continue' },+ { from: 'choose-onboarding-path', to: 'wait-one-day', type: 'branch', index: 1 },+ { from: 'wait-one-day', to: 'send-self-serve-reminder', type: 'continue' },+ { from: 'send-self-serve-reminder', to: 'pause-before-summary', type: 'continue' },+ { from: 'choose-onboarding-path', to: 'hold-control-group', type: 'continue' },+ { from: 'hold-control-group', to: 'pause-before-summary', type: 'continue' },+ { from: 'route-by-stage', to: 'wait-for-activation', type: 'branch', index: 2 },+ { from: 'wait-for-activation', to: 'share-activation', type: 'branch', index: 0 },+ { from: 'share-activation', to: 'send-activation-outcome', type: 'continue' },+ { from: 'wait-for-activation', to: 'create-follow-up-task', type: 'continue' },+ { from: 'create-follow-up-task', to: 'send-activation-outcome', type: 'continue' },+ { from: 'send-activation-outcome', to: 'pause-before-summary', type: 'continue' },+ { from: 'route-by-stage', to: 'record-self-serve-account', type: 'continue' },+ { from: 'record-self-serve-account', to: 'pause-before-summary', type: 'continue' },+ { from: 'pause-before-summary', to: 'record-workflow-outcome', type: 'continue' },+ { from: 'record-workflow-outcome', to: 'exit', type: 'continue' },+ ],+ created_at: '2026-09-04T12:00:00.000Z',+ updated_at: '2026-09-04T12:00:00.000Z',+}++const PICKABLE_WORKFLOWS: Record<string, HogFlow> = {+ [CUSTOMER_ONBOARDING_AND_RETENTION_WORKFLOW_ID]: CUSTOMER_ONBOARDING_AND_RETENTION_WORKFLOW,+ ...EXAMPLE_WORKFLOWS,+}++export const workflowEditorStoryDecorator = mswDecorator({+ get: {+ // nosemgrep: no-environments-api-urls-frontend -- api.hogFlows has not migrated to generated project routes.+ '/api/environments/:team_id/hog_flows/:id/': ({ params }) => [+ 200,+ PICKABLE_WORKFLOWS[String(params.id)] ?? CUSTOMER_ONBOARDING_AND_RETENTION_WORKFLOW,+ ],+ // nosemgrep: no-environments-api-urls-frontend -- api.messaging has not migrated to generated project routes.+ '/api/environments/:team_id/messaging_categories': { count: 0, results: [] },+ },+ patch: {+ // nosemgrep: no-environments-api-urls-frontend -- api.hogFlows has not migrated to generated project routes.+ '/api/environments/:team_id/hog_flows/:id/': async ({ request, params }) => [+ 200,+ {+ ...(PICKABLE_WORKFLOWS[String(params.id)] ?? CUSTOMER_ONBOARDING_AND_RETENTION_WORKFLOW),+ ...((await request.json()) as Partial<HogFlow>),+ updated_at: '2026-09-04T12:01:00.000Z',+ },+ ],+ },+ post: {+ // nosemgrep: no-environments-api-urls-frontend -- api.hogFlows has not migrated to generated project routes.+ '/api/environments/:team_id/hog_flows/': async ({ request }) => [+ 201,+ {+ ...NEW_WORKFLOW,+ ...((await request.json()) as Partial<HogFlow>),+ id: 'storybook-new-workflow',+ team_id: 1,+ created_at: '2026-09-04T12:01:00.000Z',+ updated_at: '2026-09-04T12:01:00.000Z',+ },+ ],+ // nosemgrep: no-environments-api-urls-frontend -- api.hogFlows has not migrated to generated project routes.+ '/api/environments/:team_id/hog_flows/user_blast_radius/': {+ affected: 240,+ total: 1200,+ limit: 100000,+ dedupe_key: null,+ confirm_token: 'storybook-confirm-token',+ },+ },+})diff --git a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsxindex 7438487d6e97..b5f0897997b9 100644--- a/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx+++ b/products/workflows/frontend/Workflows/hogflows/hogFlowEditorLogic.tsx@@ -137,6 +137,7 @@ export function computeMoveEdges(export const HOG_FLOW_EDITOR_MODES = ['build', 'variables', 'test', 'metrics', 'logs'] as constexport type HogFlowEditorMode = (typeof HOG_FLOW_EDITOR_MODES)[number]+export const HOG_FLOW_EDITOR_DEFAULT_PANEL_WIDTH = 592export type HogFlowEditorActionMetrics = {actionId: stringsucceeded: number@@ -178,6 +179,7 @@ export interface hogFlowEditorLogicValues {nodeToBeAdded: CreateActionType | HogFlowActionNode | nullnodes: HogFlowActionNode[]nodesById: Record<string, HogFlowActionNode>+ panelWidth: number | nullreactFlowInstance: ReactFlowInstance<Node, Edge> | nullreactFlowWrapper: RefObject<HTMLDivElement> | nullselectedNode: HogFlowActionNode | null@@ -1932,6 +1934,9 @@ export interface hogFlowEditorLogicActions {clearAnimatingEdgePair: () => {value: true}+ clearPanelWidth: () => {+ value: true+ }copyNodeToHighlightedDropzone: () => {value: true}@@ -2024,6 +2029,9 @@ export interface hogFlowEditorLogicActions {setNodesRaw: (nodes: HogFlowActionNode[]) => {nodes: HogFlowActionNode[]}+ setPanelWidth: (panelWidth: number) => {+ panelWidth: number+ }setReactFlowInstance: (reactFlowInstance: ReactFlowInstance<Node, Edge>) => {reactFlowInstance: ReactFlowInstance<Node, Edge>}@@ -2116,6 +2124,8 @@ export const hogFlowEditorLogic = kea<hogFlowEditorLogicType>([setNodeToBeAdded: (nodeToBeAdded: CreateActionType | HogFlowActionNode | null) => ({ nodeToBeAdded }),setHighlightedDropzoneNodeId: (highlightedDropzoneNodeId: string | null) => ({ highlightedDropzoneNodeId }),setMode: (mode: HogFlowEditorMode) => ({ mode }),+ setPanelWidth: (panelWidth: number) => ({ panelWidth }),+ clearPanelWidth: true,setAnimatingEdgePair: (from: string, to: string) => ({ from, to }),clearAnimatingEdgePair: true,startCopyingNode: (node: HogFlowActionNode) => ({ node }),@@ -2139,6 +2149,14 @@ export const hogFlowEditorLogic = kea<hogFlowEditorLogicType>([setMode: (_, { mode }) => mode,},],+ panelWidth: [+ null as number | null,+ { persist: true, storageKey: 'hogFlowEditorPanelWidth' },+ {+ setPanelWidth: (_, { panelWidth }) => panelWidth,+ clearPanelWidth: () => null,+ },+ ],nodes: [[] as HogFlowActionNode[],{@@ -2799,10 +2817,9 @@ export const hogFlowEditorLogic = kea<hogFlowEditorLogicType>([if (!reactFlowWrapper?.current || !reactFlowInstance) {return}- // This is a rough estimate which we could improve by getting from the actual panel- const PANEL_WIDTH = 580// Get the width of the wrapperconst wrapperWidth = reactFlowWrapper.current.getBoundingClientRect()?.width ?? 0+ const panelWidth = Math.min(values.panelWidth ?? HOG_FLOW_EDITOR_DEFAULT_PANEL_WIDTH, wrapperWidth)// Get the width of the thing we are going to fit to the viewconst nodesWidth =reactFlowInstance.getNodesBounds(values.selectedNode ? [values.selectedNode] : values.nodes)@@ -2811,7 +2828,7 @@ export const hogFlowEditorLogic = kea<hogFlowEditorLogicType>([const nodesWidthAdjusted = nodesWidth * reactFlowInstance.getZoom()// Calculate the padding right to fit the panel width to the wrapper width// Looks complicated but its basically the difference between the wrapper width and the nodes width adjusted for the zoom factor- const paddingRight = wrapperWidth - nodesWidthAdjusted / 2 - (wrapperWidth - PANEL_WIDTH) / 2+ const paddingRight = wrapperWidth - nodesWidthAdjusted / 2 - (wrapperWidth - panelWidth) / 2reactFlowInstance.fitView({padding: {diff --git a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanel.stories.tsx b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanel.stories.tsxnew file mode 100644index 000000000000..0ae45e8f57a7--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanel.stories.tsx@@ -0,0 +1,204 @@+import type { Meta, StoryFn } from '@storybook/react'+import { ReactFlowProvider } from '@xyflow/react'+import { BindLogic, useActions, useValues } from 'kea'+import { useEffect } from 'react'++import { mswDecorator } from '~/mocks/browser'++import { NEW_WORKFLOW, WorkflowLogicProps, workflowLogic } from '../../workflowLogic'+import { hogFlowEditorLogic, HogFlowEditorMode } from '../hogFlowEditorLogic'+import type { HogFlow, HogFlowAction } from '../types'+import { HogFlowEditorPanel } from './HogFlowEditorPanel'++const LOGIC_PROPS: WorkflowLogicProps = { id: 'storybook-configuration-panel' }++const PANEL_WORKFLOW: HogFlow = {+ ...NEW_WORKFLOW,+ id: LOGIC_PROPS.id!,+ name: 'Configuration panel examples',+ variables: [+ { type: 'string', key: 'account_owner', label: 'Account owner', default: '' },+ { type: 'number', key: 'trial_days', label: 'Trial days', default: 14 },+ ...Array.from({ length: 22 }, (_, index) => ({+ type: 'string' as const,+ key: `workflow_value_${index + 1}`,+ label: `Workflow value ${index + 1}`,+ default: '',+ })),+ ],+ actions: [+ {+ id: 'trigger',+ type: 'trigger',+ name: 'New account created',+ description: 'Start when a new account is created.',+ config: { type: 'event', filters: {} },+ },+ {+ id: 'delay',+ type: 'delay',+ name: 'Wait for activation',+ description: 'Give the account time to activate.',+ config: { delay_duration: '1d' },+ },+ {+ id: 'webhook',+ type: 'function',+ name: 'Send activation webhook',+ description: 'Send the activation event to an example endpoint.',+ config: {+ template_id: 'template-webhook',+ inputs: {+ url: { value: 'https://example.com/hooks/activation' },+ method: { value: 'POST' },+ body: { value: { account_id: '{person.id}', event: '{event.event}' }, templating: 'hog' },+ },+ },+ },+ {+ id: 'conditional',+ type: 'conditional_branch',+ name: 'Route by account stage',+ description: 'Choose a path based on the account stage.',+ config: {+ conditions: [+ {+ name: 'Paid account',+ filters: {+ properties: [{ key: 'account_stage', value: ['paid'], operator: 'exact', type: 'person' }],+ },+ },+ { name: 'Trial account', filters: {} },+ ],+ },+ },+ {+ id: 'cohort',+ type: 'random_cohort_branch',+ name: 'Choose onboarding path',+ description: 'Split accounts between two onboarding paths.',+ config: {+ cohorts: [+ { name: 'Guided onboarding', percentage: 60 },+ { name: 'Self-serve onboarding', percentage: 40 },+ ],+ },+ },+ {+ id: 'exit',+ type: 'exit',+ name: 'Exit workflow',+ description: 'The account completed the workflow.',+ config: { reason: 'Completed' },+ },+ ] as HogFlowAction[],+ edges: [+ { from: 'trigger', to: 'delay', type: 'continue' },+ { from: 'delay', to: 'webhook', type: 'continue' },+ { from: 'webhook', to: 'conditional', type: 'continue' },+ { from: 'conditional', to: 'cohort', type: 'branch', index: 0 },+ { from: 'conditional', to: 'exit', type: 'branch', index: 1 },+ { from: 'conditional', to: 'exit', type: 'continue' },+ { from: 'cohort', to: 'exit', type: 'branch', index: 0 },+ { from: 'cohort', to: 'exit', type: 'branch', index: 1 },+ { from: 'cohort', to: 'exit', type: 'continue' },+ ],+}++type PanelStoryProps = {+ mode: HogFlowEditorMode+ selectedNodeId: string | null+}++const meta: Meta<typeof HogFlowEditorPanel> = {+ title: 'Products/Workflows/Editor/Configuration panel',+ component: HogFlowEditorPanel,+ parameters: {+ layout: 'fullscreen',+ },+ decorators: [+ mswDecorator({+ get: {+ '/api/environments/:team_id/hog_flows/:id/': PANEL_WORKFLOW,+ '/api/environments/:team_id/messaging_categories': { count: 0, results: [] },+ },+ patch: {+ '/api/environments/:team_id/hog_flows/:id/': async ({ request }) => [+ 200,+ { ...PANEL_WORKFLOW, ...((await request.json()) as Partial<HogFlow>) },+ ],+ },+ post: {+ '/api/environments/:team_id/hog_flows/user_blast_radius/': {+ affected: 240,+ total: 1200,+ limit: 100000,+ dedupe_key: null,+ confirm_token: 'storybook-confirm-token',+ },+ },+ }),+ ],+}+export default meta++function PanelStory({ mode, selectedNodeId }: PanelStoryProps): JSX.Element {+ const { originalWorkflow } = useValues(workflowLogic(LOGIC_PROPS))+ const { nodes } = useValues(hogFlowEditorLogic(LOGIC_PROPS))+ const { setWorkflowValues } = useActions(workflowLogic(LOGIC_PROPS))+ const { setMode, setSelectedNodeId } = useActions(hogFlowEditorLogic(LOGIC_PROPS))++ useEffect(() => {+ if (originalWorkflow) {+ setWorkflowValues(PANEL_WORKFLOW)+ setMode(mode)+ }+ }, [mode, originalWorkflow, setMode, setWorkflowValues])++ useEffect(() => {+ if (selectedNodeId === null || nodes.some((node) => node.id === selectedNodeId)) {+ setSelectedNodeId(selectedNodeId)+ }+ }, [nodes, selectedNodeId, setSelectedNodeId])++ return (+ <ReactFlowProvider>+ <BindLogic logic={workflowLogic} props={LOGIC_PROPS}>+ <BindLogic logic={hogFlowEditorLogic} props={LOGIC_PROPS}>+ <div className="relative h-screen w-[37rem] overflow-hidden bg-surface-primary">+ <HogFlowEditorPanel />+ </div>+ </BindLogic>+ </BindLogic>+ </ReactFlowProvider>+ )+}++const Template: StoryFn<PanelStoryProps> = (args) => <PanelStory {...args} />++export const Build: StoryFn<PanelStoryProps> = Template.bind({})+Build.args = { mode: 'build', selectedNodeId: 'delay' }++export const BuildPalette: StoryFn<PanelStoryProps> = Template.bind({})+BuildPalette.args = { mode: 'build', selectedNodeId: null }++export const Webhook: StoryFn<PanelStoryProps> = Template.bind({})+Webhook.args = { mode: 'build', selectedNodeId: 'webhook' }++export const ConditionalBranch: StoryFn<PanelStoryProps> = Template.bind({})+ConditionalBranch.args = { mode: 'build', selectedNodeId: 'conditional' }++export const CohortBranch: StoryFn<PanelStoryProps> = Template.bind({})+CohortBranch.args = { mode: 'build', selectedNodeId: 'cohort' }++export const Variables: StoryFn<PanelStoryProps> = Template.bind({})+Variables.args = { mode: 'variables', selectedNodeId: null }++export const Test: StoryFn<PanelStoryProps> = Template.bind({})+Test.args = { mode: 'test', selectedNodeId: 'delay' }++export const Metrics: StoryFn<PanelStoryProps> = Template.bind({})+Metrics.args = { mode: 'metrics', selectedNodeId: 'delay' }++export const Logs: StoryFn<PanelStoryProps> = Template.bind({})+Logs.args = { mode: 'logs', selectedNodeId: 'delay' }diff --git a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanel.tsx b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanel.tsxindex 5052827d8efe..f050deefd584 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanel.tsx+++ b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanel.tsx@@ -1,27 +1,30 @@-import { useReactFlow } from '@xyflow/react'import clsx from 'clsx'import { useActions, useValues } from 'kea'-import { IconArrowLeft, IconTrash } from '@posthog/icons'-import { LemonBadge, LemonButton, LemonTab, LemonTabs, Tooltip } from '@posthog/lemon-ui'+import { IconArrowLeft } from '@posthog/icons'+import { LemonBadge, LemonButton, LemonTab, LemonTabs } from '@posthog/lemon-ui'import { capitalizeFirstLetter } from 'lib/utils/strings'-import { workflowLogic } from '../../workflowLogic'-import { HOG_FLOW_EDITOR_MODES, HogFlowEditorMode, hogFlowEditorLogic } from '../hogFlowEditorLogic'-import { useHogFlowStep } from '../steps/HogFlowSteps'+import {+ HOG_FLOW_EDITOR_DEFAULT_PANEL_WIDTH,+ HOG_FLOW_EDITOR_MODES,+ HogFlowEditorMode,+ hogFlowEditorLogic,+} from '../hogFlowEditorLogic'import { HogFlowEditorPanelBuild } from './HogFlowEditorPanelBuild'import { HogFlowEditorPanelBuildDetail } from './HogFlowEditorPanelBuildDetail'import { HogFlowEditorPanelLogs } from './HogFlowEditorPanelLogs'import { HogFlowEditorPanelMetrics } from './HogFlowEditorPanelMetrics'+import { HogFlowEditorPanelResizeHandle } from './HogFlowEditorPanelResizeHandle'+import { HogFlowEditorPanelSelectedStep } from './HogFlowEditorPanelSelectedStep'import { HogFlowEditorPanelVariables } from './HogFlowEditorPanelVariables'import { EmailActionTestContent } from './testing/HogFlowEditorNotificationPanelTest'import { HogFlowEditorPanelTest } from './testing/HogFlowEditorPanelTest'export function HogFlowEditorPanel(): JSX.Element | null {- const { selectedNode, mode, selectedNodeCanBeDeleted, workflow } = useValues(hogFlowEditorLogic)- const { setMode, setSelectedNodeId } = useActions(hogFlowEditorLogic)- const { deleteElements } = useReactFlow()+ const { panelWidth, selectedNode, mode, workflow } = useValues(hogFlowEditorLogic)+ const { clearPanelWidth, setMode, setPanelWidth, setSelectedNodeId } = useActions(hogFlowEditorLogic)const variablesCount = workflow?.variables?.length || 0@@ -30,31 +33,30 @@ export function HogFlowEditorPanel(): JSX.Element | null {<>{capitalizeFirstLetter(mode)}{mode === 'variables' && variablesCount > 0 && (- <span className="ml-1 text-muted">({variablesCount})</span>+ <LemonBadge.Number+ count={variablesCount}+ maxDigits={2}+ size="small"+ status="muted"+ className="ml-1"+ />)}</>),key: mode,}))- const width = mode !== 'build' ? '37rem' : selectedNode ? '37rem' : '25rem'-- const Step = useHogFlowStep(selectedNode?.data)- const { actionValidationErrorsById } = useValues(workflowLogic)- const validationResult = actionValidationErrorsById[selectedNode?.id ?? '']-return (<div- className="absolute flex flex-col m-0 p-2 overflow-hidden transition-[width] max-h-full right-0 justify-end"- style={{ width }}+ className="absolute right-0 flex max-h-full max-w-full flex-col justify-end overflow-hidden p-2"+ style={{ width: panelWidth ?? HOG_FLOW_EDITOR_DEFAULT_PANEL_WIDTH }}>- <div- className="relative flex flex-col rounded-md overflow-hidden bg-surface-primary max-h-full z-10"- style={{- border: '1px solid var(--border)',- boxShadow: '0 3px 0 var(--border)',- }}- >+ <HogFlowEditorPanelResizeHandle+ width={panelWidth ?? HOG_FLOW_EDITOR_DEFAULT_PANEL_WIDTH}+ onResize={setPanelWidth}+ onReset={clearPanelWidth}+ />+ <div className="relative z-10 flex max-h-full flex-col overflow-hidden rounded-md border bg-surface-primary shadow-[0_3px_0_var(--border)]"><div className="flex gap-2 border-b items-center"><divclassName={clsx(@@ -78,38 +80,11 @@ export function HogFlowEditorPanel(): JSX.Element | null {barClassName="-mb-px "/></div>-- {selectedNode && (- <span className="flex gap-1 items-center font-medium rounded-md mr-3 min-w-0">- <span className="text-lg">{Step?.icon}</span>- <Tooltip title={selectedNode.data.name}>- <span className="font-semibold truncate">{selectedNode.data.name}</span>- </Tooltip>- {validationResult?.valid === false && (- <Tooltip title="Some fields need attention">- <div>- <LemonBadge status="warning" size="small" content="!" />- </div>- </Tooltip>- )}- {selectedNode.deletable && (- <LemonButton- size="small"- status="danger"- icon={<IconTrash />}- onClick={() => {- void deleteElements({ nodes: [selectedNode] })- setSelectedNodeId(null)- }}- disabledReason={- selectedNodeCanBeDeleted ? undefined : 'Clean up branching steps first'- }- />- )}- </span>- )}</div>+ {selectedNode && ['build', 'metrics', 'test', 'logs'].includes(mode) && (+ <HogFlowEditorPanelSelectedStep />+ )}{mode === 'build' && (<>{!selectedNode ? <HogFlowEditorPanelBuild /> : <HogFlowEditorPanelBuildDetail />}</>)}diff --git a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuild.tsx b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuild.tsxindex 71f8d7103a7a..ef92fc7a1823 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuild.tsx+++ b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuild.tsx@@ -1,8 +1,8 @@import { useActions, useValues } from 'kea'-import { Fragment, useEffect, useState } from 'react'+import { useEffect, useRef, useState } from 'react'-import { IconDrag } from '@posthog/icons'-import { LemonButton, LemonDivider, LemonDropdown, LemonInput, LemonTag, SpinnerOverlay } from '@posthog/lemon-ui'+import { IconDrag, IconEllipsis } from '@posthog/icons'+import { LemonButton, LemonDropdown, LemonInput, LemonTag, SpinnerOverlay } from '@posthog/lemon-ui'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { hogFunctionTemplateListLogic } from 'scenes/hog-functions/list/hogFunctionTemplateListLogic'@@ -18,7 +18,9 @@ import '../registry'import { FEATURE_FLAGS } from 'lib/constants'import { PERSON_DEPENDENT_ACTION_TYPES, workflowLogic } from '../../workflowLogic'+import { NODE_HEIGHT, NODE_WIDTH } from '../react_flow_utils/constants'import { getRegisteredActionNodeCategories } from '../registry/actions/actionNodeRegistry'+import { StepView } from '../steps/components/StepView'import { useHogFlowStep } from '../steps/HogFlowSteps'import { DEFAULT_DELAY_DURATION, getDelayDescription } from '../steps/stepDelayLogic'import { HogFlowAction } from '../types'@@ -187,20 +189,31 @@ const TEMPLATE_IDS_AT_TOP_LEVEL: string[] = [function HogFlowEditorToolbarNode({action,- onDragStart: onDragStartProp,children,}: {action: CreateActionType- onDragStart?: (event: React.DragEvent) => voidchildren?: React.ReactNode}): JSX.Element | null {const { setNodeToBeAdded } = useActions(hogFlowEditorLogic)+ const dragPreviewRef = useRef<HTMLDivElement>(null)const onDragStart = (event: React.DragEvent): void => {setNodeToBeAdded(action)event.dataTransfer.setData('application/reactflow', action.type)event.dataTransfer.effectAllowed = 'move'- onDragStartProp?.(event)+ if (dragPreviewRef.current) {+ const dragPreview = dragPreviewRef.current.cloneNode(true) as HTMLDivElement+ dragPreview.classList.remove('invisible')+ dragPreview.style.position = 'fixed'+ dragPreview.style.left = '0'+ dragPreview.style.top = '0'+ dragPreview.style.width = `${NODE_WIDTH * 1.5}px`+ dragPreview.style.height = `${NODE_HEIGHT * 1.5}px`+ dragPreview.style.transform = 'translate(-101%, -101%)'+ document.body.appendChild(dragPreview)+ event.dataTransfer.setDragImage(dragPreview, (NODE_WIDTH * 3) / 4, (NODE_HEIGHT * 3) / 4)+ window.setTimeout(() => dragPreview.remove())+ }}const step = useHogFlowStep(action as HogFlowAction)@@ -210,15 +223,35 @@ function HogFlowEditorToolbarNode({}return (- <div draggable onDragStart={onDragStart}>- <LemonButton- icon={<span style={{ color: step.color }}>{step.icon}</span>}- sideIcon={<IconDrag />}- fullWidth- >- {children ?? action.name}- </LemonButton>- </div>+ <>+ <div draggable onDragStart={onDragStart}>+ <LemonButton+ icon={<span style={{ color: step.color }}>{step.icon}</span>}+ sideIcon={<IconDrag />}+ fullWidth+ >+ {children ?? action.name}+ </LemonButton>+ </div>+ <div ref={dragPreviewRef} className="pointer-events-none absolute invisible" aria-hidden="true">+ <div className="origin-top-left scale-150">+ <StepView+ action={{ ...action, id: `drag-preview-${action.type}-${action.name}` } as HogFlowAction}+ />+ </div>+ </div>+ </>+ )+}++function HogFlowEditorToolbarSection({ title, children }: { title: string; children: React.ReactNode }): JSX.Element {+ return (+ <section className="flex flex-col border-t first:border-t-0">+ <div className="border-b px-3 py-2 text-xxs font-semibold uppercase tracking-wide text-secondary">+ {title}+ </div>+ <div className="flex flex-col gap-1.5 p-2">{children}</div>+ </section>)}@@ -302,7 +335,7 @@ function HogFunctionTemplatesChooser(): JSX.Element {</div>}>- <LemonButton fullWidth onClick={() => setPopoverOpen(!popoverOpen)}>+ <LemonButton icon={<IconEllipsis />} fullWidth onClick={() => setPopoverOpen(!popoverOpen)}>More</LemonButton></LemonDropdown>@@ -327,78 +360,69 @@ export function HogFlowEditorPanelBuild(): JSX.Element {const logicNodes = hideIfRowScoped(LOGIC_NODES_TO_SHOW)return (- <div className="flex overflow-y-auto flex-col gap-px p-2" data-attr="workflow-add-action">- <span className="flex gap-2 text-sm font-semibold mt-2 items-center">- Dispatch <LemonDivider className="flex-1" />- </span>- {ACTION_NODES_TO_SHOW.map((node, index) => (- <HogFlowEditorToolbarNode key={`${node.type}-${index}`} action={node} />- ))}- {featureFlags[FEATURE_FLAGS.WORKFLOWS_PUSH_NOTIFICATIONS] && (- <HogFlowEditorToolbarNode key="push-notifications" action={PUSH_NOTIFICATION_ACTION_NODE}>- <span className="inline-flex items-center gap-1.5">- {PUSH_NOTIFICATION_ACTION_NODE.name}- <LemonTag type="completion">Beta</LemonTag>- </span>- </HogFlowEditorToolbarNode>- )}- {featureFlags[FEATURE_FLAGS.WORKFLOW_AI_TASK_ACTION] && (- <HogFlowEditorToolbarNode key="ai-task" action={AI_TASK_ACTION_NODE}>- <span className="inline-flex items-center gap-1.5">- {AI_TASK_ACTION_NODE.name}- <LemonTag type="completion">Beta</LemonTag>- </span>- </HogFlowEditorToolbarNode>- )}- {/* Scouts belong to the project's main environment, and the server refuses the step elsewhere.- Require currentTeam explicitly: while it's still loading, both sides of the id comparison are- undefined, which would otherwise pass. */}- {featureFlags[FEATURE_FLAGS.WORKFLOW_RUN_SCOUT_ACTION] &&- !!currentTeam &&- currentTeam.id === currentTeam.project_id && (- <HogFlowEditorToolbarNode key="run-scout" action={RUN_SCOUT_ACTION_NODE}>+ <div className="flex flex-col overflow-y-auto" data-attr="workflow-add-action">+ <HogFlowEditorToolbarSection title="Dispatch">+ {ACTION_NODES_TO_SHOW.map((node, index) => (+ <HogFlowEditorToolbarNode key={`${node.type}-${index}`} action={node} />+ ))}+ {featureFlags[FEATURE_FLAGS.WORKFLOWS_PUSH_NOTIFICATIONS] && (+ <HogFlowEditorToolbarNode key="push-notifications" action={PUSH_NOTIFICATION_ACTION_NODE}><span className="inline-flex items-center gap-1.5">- {RUN_SCOUT_ACTION_NODE.name}+ {PUSH_NOTIFICATION_ACTION_NODE.name}<LemonTag type="completion">Beta</LemonTag></span></HogFlowEditorToolbarNode>)}- <HogFunctionTemplatesChooser />-- <span className="flex gap-2 text-sm font-semibold mt-2 items-center">- Delays <LemonDivider className="flex-1" />- </span>- {delayNodes.map((action, index) => (- <HogFlowEditorToolbarNode key={`${action.type}-${index}`} action={action} />- ))}+ {featureFlags[FEATURE_FLAGS.WORKFLOW_AI_TASK_ACTION] && (+ <HogFlowEditorToolbarNode key="ai-task" action={AI_TASK_ACTION_NODE}>+ <span className="inline-flex items-center gap-1.5">+ {AI_TASK_ACTION_NODE.name}+ <LemonTag type="completion">Beta</LemonTag>+ </span>+ </HogFlowEditorToolbarNode>+ )}+ {/* Scouts belong to the project's main environment, and the server refuses the step elsewhere.+ Require currentTeam explicitly: while it's still loading, both sides of the id comparison are+ undefined, which would otherwise pass. */}+ {featureFlags[FEATURE_FLAGS.WORKFLOW_RUN_SCOUT_ACTION] &&+ !!currentTeam &&+ currentTeam.id === currentTeam.project_id && (+ <HogFlowEditorToolbarNode key="run-scout" action={RUN_SCOUT_ACTION_NODE}>+ <span className="inline-flex items-center gap-1.5">+ {RUN_SCOUT_ACTION_NODE.name}+ <LemonTag type="completion">Beta</LemonTag>+ </span>+ </HogFlowEditorToolbarNode>+ )}+ <HogFunctionTemplatesChooser />+ </HogFlowEditorToolbarSection>++ <HogFlowEditorToolbarSection title="Delays">+ {delayNodes.map((action, index) => (+ <HogFlowEditorToolbarNode key={`${action.type}-${index}`} action={action} />+ ))}+ </HogFlowEditorToolbarSection>{logicNodes.length > 0 && (- <>- <span className="flex gap-2 text-sm font-semibold mt-2 items-center">- Audience split <LemonDivider className="flex-1" />- </span>+ <HogFlowEditorToolbarSection title="Audience split">{logicNodes.map((action, index) => (<HogFlowEditorToolbarNode key={`${action.type}-${index}`} action={action} />))}- </>+ </HogFlowEditorToolbarSection>)}- <span className="flex gap-2 text-sm font-semibold mt-2 items-center">- PostHog actions <LemonDivider className="flex-1" />- </span>- {POSTHOG_NODES_TO_SHOW.map((action, index) => (- <HogFlowEditorToolbarNode key={`${action.type}-${index}`} action={action} />- ))}+ <HogFlowEditorToolbarSection title="PostHog actions">+ {POSTHOG_NODES_TO_SHOW.map((action, index) => (+ <HogFlowEditorToolbarNode key={`${action.type}-${index}`} action={action} />+ ))}+ </HogFlowEditorToolbarSection>{registeredCategories.map((cat) => (- <Fragment key={cat.label}>- <span className="flex gap-2 text-sm font-semibold mt-2 items-center">- {cat.label} <LemonDivider className="flex-1" />- </span>+ <HogFlowEditorToolbarSection key={cat.label} title={cat.label}>{cat.nodes.map((action, index) => (<HogFlowEditorToolbarNode key={`${action.type}-${index}`} action={action} />))}- </Fragment>+ </HogFlowEditorToolbarSection>))}</div>)diff --git a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuildDetail.tsx b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuildDetail.tsxindex 342e14d37322..bae3dd6c6694 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuildDetail.tsx+++ b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelBuildDetail.tsx@@ -12,9 +12,9 @@ import {LemonLabel,LemonSelect,LemonSwitch,+ LemonTag,} from '@posthog/lemon-ui'-import { EditableField } from 'lib/components/EditableField/EditableField'import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'import { LemonField } from 'lib/lemon-ui/LemonField/LemonField'import { urls } from 'scenes/urls'@@ -27,7 +27,7 @@ import { workflowLogic } from '../../workflowLogic'import { HogFlowPropertyFilters } from '../filters/HogFlowFilters'import { hogFlowEditorLogic } from '../hogFlowEditorLogic'import { useHogFlowStep } from '../steps/HogFlowSteps'-import { isEmailAction, isOptOutEligibleAction, isScheduleTrigger } from '../steps/types'+import { isEmailAction, isOptOutEligibleAction } from '../steps/types'import type { HogFlowAction } from '../types'import { hogFlowOutputMappingLogic } from './hogFlowOutputMappingLogic'import { OutputTestResultTree } from './OutputTestResultTree'@@ -76,49 +76,13 @@ export function HogFlowEditorPanelBuildDetail(): JSX.Element | null {const hideFiltersPanel = isBranchingStep && !hasLegacyBranchingFiltersreturn (- <div className="flex flex-col h-full overflow-hidden">+ <div className="flex min-h-0 flex-1 flex-col overflow-hidden"><ScrollableShadowsdirection="vertical"className="flex-1 min-h-0"innerClassName="flex flex-col gap-2 p-3"styledScrollbars>- <div className="flex flex-col gap-1">- <EditableField- name="step-name"- value={action.name}- onSave={(value) => {- const trimmed = value.trim()- if (trimmed) {- setWorkflowAction(action.id, { ...action, name: trimmed })- }- }}- placeholder="Step name"- minLength={1}- saveOnBlur- clickToEdit- compactButtons- compactIcon- className="font-semibold text-base"- data-attr="workflow-step-name"- />- {!isScheduleTrigger(action) && (- <EditableField- name="step-description"- value={action.description || ''}- onSave={(value) => setWorkflowAction(action.id, { ...action, description: value.trim() })}- placeholder="Add a description (optional)"- multiline- saveOnBlur- clickToEdit- compactButtons- compactIcon- className="text-sm text-secondary"- data-attr="workflow-step-description"- />- )}- </div>- <LemonDivider className="my-2" /><ErrorBoundary exceptionProps={{ feature: 'workflow-step-config' }}>{Step?.renderConfiguration(selectedNode)}</ErrorBoundary>@@ -430,7 +394,17 @@ export function HogFlowEditorPanelBuildDetail(): JSX.Element | null {]),{key: 'on_error',- header: <span className="flex-1">Error handling</span>,+ header: (+ <>+ <span className="flex-1">Error handling</span>+ <LemonTag+ size="small"+ type={action.on_error === 'continue' ? 'success' : 'danger'}+ >+ {action.on_error === 'continue' ? 'Continue on error' : 'Exit on error'}+ </LemonTag>+ </>+ ),content: (<div><p>diff --git a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelResizeHandle.tsx b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelResizeHandle.tsxnew file mode 100644index 000000000000..b9a6d318322c--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelResizeHandle.tsx@@ -0,0 +1,97 @@+import { useEffect, useRef, useState } from 'react'+import type { PointerEvent as ReactPointerEvent } from 'react'++const MIN_PANEL_WIDTH = 400+const MAX_PANEL_WIDTH = 800++export interface HogFlowEditorPanelResizeHandleProps {+ width: number+ onResize: (width: number) => void+ onReset: () => void+}++export function HogFlowEditorPanelResizeHandle({+ width,+ onResize,+ onReset,+}: HogFlowEditorPanelResizeHandleProps): JSX.Element {+ const startX = useRef(0)+ const startWidth = useRef(width)+ const handleRef = useRef<HTMLButtonElement>(null)+ const [maxWidth, setMaxWidth] = useState(MAX_PANEL_WIDTH)++ const minWidth = Math.min(MIN_PANEL_WIDTH, maxWidth)+ const clampWidth = (nextWidth: number, widthLimit = maxWidth): number =>+ Math.min(Math.max(nextWidth, Math.min(MIN_PANEL_WIDTH, widthLimit)), widthLimit)+ const visibleWidth = clampWidth(width)++ useEffect(() => {+ const container = handleRef.current?.parentElement?.parentElement+ if (!container) {+ return+ }++ const updateMaxWidth = (): void =>+ setMaxWidth(Math.min(MAX_PANEL_WIDTH, container.getBoundingClientRect().width))+ const observer = new ResizeObserver(updateMaxWidth)+ updateMaxWidth()+ observer.observe(container)+ return () => observer.disconnect()+ }, [])++ const startResize = (event: ReactPointerEvent<HTMLButtonElement>): void => {+ if (event.button !== 0) {+ return+ }++ event.preventDefault()+ event.stopPropagation()+ startX.current = event.clientX+ const widthLimit = Math.min(+ MAX_PANEL_WIDTH,+ event.currentTarget.parentElement?.parentElement?.getBoundingClientRect().width ?? MAX_PANEL_WIDTH+ )+ setMaxWidth(widthLimit)+ startWidth.current = clampWidth(width, widthLimit)+ event.currentTarget.setPointerCapture(event.pointerId)+ }++ const resize = (event: ReactPointerEvent<HTMLButtonElement>): void => {+ if (!event.currentTarget.hasPointerCapture(event.pointerId)) {+ return+ }++ onResize(clampWidth(startWidth.current + startX.current - event.clientX))+ }++ return (+ <button+ type="button"+ aria-label="Resize workflow editor panel"+ aria-orientation="vertical"+ ref={handleRef}+ aria-valuenow={visibleWidth}+ aria-valuemin={minWidth}+ aria-valuemax={maxWidth}+ className="group absolute top-4 bottom-4 left-0 z-20 w-3 cursor-ew-resize border-0 bg-transparent p-0 opacity-0 transition-opacity hover:opacity-100 focus-visible:opacity-100"+ onPointerDown={startResize}+ onPointerMove={resize}+ onDoubleClick={onReset}+ onKeyDown={(event) => {+ if (event.key === 'ArrowLeft') {+ event.preventDefault()+ onResize(clampWidth(visibleWidth + 10))+ } else if (event.key === 'ArrowRight') {+ event.preventDefault()+ onResize(clampWidth(visibleWidth - 10))+ } else if (event.key === 'Enter' || event.key === ' ') {+ event.preventDefault()+ onReset()+ }+ }}+ data-attr="workflow-editor-panel-resize-handle"+ >+ <span className="absolute inset-y-0 left-2 w-px bg-border-primary opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100" />+ </button>+ )+}diff --git a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelSelectedStep.tsx b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelSelectedStep.tsxnew file mode 100644index 000000000000..cce16d616410--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelSelectedStep.tsx@@ -0,0 +1,96 @@+import { useActions, useValues } from 'kea'++import { IconTrash } from '@posthog/icons'+import { LemonBadge, LemonButton, Tooltip } from '@posthog/lemon-ui'++import { EditableField } from 'lib/components/EditableField/EditableField'++import { workflowLogic } from '../../workflowLogic'+import { hogFlowEditorLogic } from '../hogFlowEditorLogic'+import { useHogFlowStep } from '../steps/HogFlowSteps'+import { isScheduleTrigger } from '../steps/types'++export function HogFlowEditorPanelSelectedStep(): JSX.Element | null {+ const { selectedNode, selectedNodeCanBeDeleted } = useValues(hogFlowEditorLogic)+ const { actionValidationErrorsById } = useValues(workflowLogic)+ const { onNodesDelete, setWorkflowAction, setSelectedNodeId } = useActions(hogFlowEditorLogic)+ const Step = useHogFlowStep(selectedNode?.data)++ if (!selectedNode) {+ return null+ }++ const action = selectedNode.data+ const validationResult = actionValidationErrorsById[action.id]+ const hasValidationIssue =+ validationResult?.valid === false || Object.keys(validationResult?.warnings ?? {}).length > 0++ return (+ <div className="relative z-10 flex shrink-0 items-start gap-2 border-b bg-surface-primary p-2">+ <span+ className="flex size-10 shrink-0 items-center justify-center rounded text-xl"+ style={{+ backgroundColor: Step?.color ? `${Step.color}20` : 'var(--border)',+ color: Step?.color || 'var(--text-secondary)',+ }}+ >+ {Step?.icon}+ </span>+ <div className="flex min-w-0 flex-1 flex-col gap-0.5">+ <EditableField+ name="step-name"+ value={action.name}+ onSave={(value) => {+ const trimmed = value.trim()+ if (trimmed) {+ setWorkflowAction(action.id, { ...action, name: trimmed })+ }+ }}+ placeholder="Step name"+ minLength={1}+ saveOnBlur+ clickToEdit+ compactButtons+ compactIcon+ className="text-sm font-semibold"+ data-attr="workflow-step-name"+ />+ {!isScheduleTrigger(action) && (+ <EditableField+ name="step-description"+ value={action.description || ''}+ onSave={(value) => setWorkflowAction(action.id, { ...action, description: value.trim() })}+ placeholder="Add a description (optional)"+ multiline+ saveOnBlur+ clickToEdit+ compactButtons+ compactIcon+ className="text-xs text-secondary"+ data-attr="workflow-step-description"+ />+ )}+ </div>+ {selectedNode.deletable && (+ <LemonButton+ className="shrink-0"+ size="small"+ status="danger"+ icon={<IconTrash />}+ onClick={() => {+ onNodesDelete([selectedNode])+ setSelectedNodeId(null)+ }}+ disabledReason={selectedNodeCanBeDeleted ? undefined : 'Clean up branching steps first'}+ />+ )}+ {hasValidationIssue && (+ <Tooltip title="Some fields need attention">+ <span className={`absolute top-2 ${selectedNode.deletable ? 'right-12' : 'right-2'}`}>+ <LemonBadge status="warning" size="small" content="!" />+ </span>+ </Tooltip>+ )}+ </div>+ )+}diff --git a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelVariables.tsx b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelVariables.tsxindex 9eef8fea7b6f..9d067dfe2179 100644--- a/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelVariables.tsx+++ b/products/workflows/frontend/Workflows/hogflows/panel/HogFlowEditorPanelVariables.tsx@@ -1,7 +1,8 @@import { useActions, useValues } from 'kea'+import { useState } from 'react'-import { IconCode, IconCopy, IconPlus, IconX } from '@posthog/icons'-import { LemonButton, LemonDialog, LemonInput, LemonLabel, lemonToast } from '@posthog/lemon-ui'+import { IconPlus, IconX } from '@posthog/icons'+import { LemonButton, LemonCollapse, LemonDivider, LemonInput } from '@posthog/lemon-ui'import { ScrollableShadows } from 'lib/components/ScrollableShadows/ScrollableShadows'import { LemonField } from 'lib/lemon-ui/LemonField/LemonField'@@ -11,6 +12,10 @@ import { hogFlowEditorLogic } from '../hogFlowEditorLogic'export function HogFlowEditorPanelVariables(): JSX.Element | null {const { workflow } = useValues(hogFlowEditorLogic)const { setWorkflowInfo } = useActions(hogFlowEditorLogic)+ const [hoveredVariableIndex, setHoveredVariableIndex] = useState<number | null>(null)+ const [editingVariableIndex, setEditingVariableIndex] = useState<number | null>(null)+ const [deletingVariableIndex, setDeletingVariableIndex] = useState<number | null>(null)+ const [variableKeyDraft, setVariableKeyDraft] = useState('')const addNewVariable = (): void => {const newVariableName = `VARIABLE_${(workflow?.variables?.length || 0) + 1}`@@ -24,130 +29,171 @@ export function HogFlowEditorPanelVariables(): JSX.Element | null {}const editVariableKey = (idx: number, key: string): void => {- const updatedVariables = [...(workflow?.variables || [])]const sanitizedKey = key.replace(/\s+/g, '_')- updatedVariables[idx].key = sanitizedKey- updatedVariables[idx].label = sanitizedKeysetWorkflowInfo({- variables: updatedVariables,+ variables: (workflow?.variables || []).map((variable, index) =>+ index === idx ? { ...variable, key: sanitizedKey, label: sanitizedKey } : variable+ ),})}const editVariableDefaultValue = (idx: number, defaultValue: string): void => {- const updatedVariables = [...(workflow?.variables || [])]- updatedVariables[idx].default = defaultValuesetWorkflowInfo({- variables: updatedVariables,+ variables: (workflow?.variables || []).map((variable, index) =>+ index === idx ? { ...variable, default: defaultValue } : variable+ ),})}+ const showVariableKeyInput = (idx: number, key: string): void => {+ setHoveredVariableIndex(idx)+ if (editingVariableIndex === null) {+ setVariableKeyDraft(key)+ }+ }++ const finishEditingVariableKey = (idx: number): void => {+ editVariableKey(idx, variableKeyDraft)+ setEditingVariableIndex(null)+ setHoveredVariableIndex(null)+ }+const deleteVariable = (idx: number): void => {- LemonDialog.open({- title: 'Delete variable',- description: `Are you sure you want to delete the variable "${workflow.variables?.[idx]?.key}"?`,- primaryButton: {- children: 'Delete',- status: 'danger',- onClick: () => {- const newVariables = [...(workflow?.variables || [])]- newVariables.splice(idx, 1)- setWorkflowInfo({ variables: newVariables })- },- },- secondaryButton: { children: 'Cancel' },- })+ const newVariables = [...(workflow?.variables || [])]+ newVariables.splice(idx, 1)+ setWorkflowInfo({ variables: newVariables })+ setDeletingVariableIndex(null)}return (- <div className="flex flex-col h-full overflow-hidden m-2">- <LemonLabel- info={- <span>- These variables can be used by actions and conditions in this workflow. Use{' '}- <code>{`{ variable_name }`}</code> to reference a variable in an action or condition. You can- also set variables using the result of an action by selecting a node and configuring the "Output- variable" section.- </span>- }- >- <IconCode className="text-lg" /> Workflow variables- </LemonLabel>-+ <div className="flex h-full flex-col overflow-hidden"><ScrollableShadowsdirection="vertical"className="flex-1 min-h-0"- innerClassName="flex flex-col gap-1.5 py-2"+ innerClassName="flex flex-col"styledScrollbars>- {workflow.variables && workflow.variables.length > 0 && (- <div className="w-full flex gap-2 px-0.5 text-xs font-medium text-secondary">- <span className="w-1/4 shrink-0">Key</span>- <span className="w-1/4 shrink-0">Default</span>- <span className="flex-1 min-w-0">Usage</span>- <span className="w-5 shrink-0" />- </div>- )}-{workflow.variables?.map((variable, idx) => (- <div key={`${workflow.id}_${idx}`} className="w-full flex items-center gap-2">- <LemonField.Pure className="w-1/4 shrink-0">- <LemonInput- size="small"- type="text"- value={variable.key}- placeholder="Unique name"- onChange={(key) => {- editVariableKey(idx, key)- }}- />- </LemonField.Pure>- <LemonField.Pure className="w-1/4 shrink-0">- <LemonInput- size="small"- type="text"- value={workflow?.variables?.[idx]?.default || ''}- placeholder="Default value"- onChange={(defaultValue) => {- editVariableDefaultValue(idx, defaultValue)- }}- />- </LemonField.Pure>- <span className="group relative flex-1 min-w-0">- <code className="w-full py-1 bg-primary-alt-highlight-secondary rounded-sm text-center text-xs truncate block">- {`{ variables.${variable.key} }`}- </code>- <span className="absolute top-0 right-0 z-10 p-px opacity-0 transition-opacity group-hover:opacity-100">+ <div key={`${workflow.id}_${idx}`} className="flex items-center gap-2 border-b px-3 py-2">+ {deletingVariableIndex === idx ? (+ <div className="flex min-w-0 flex-1 items-center justify-between gap-2 text-sm">+ <span>+ Delete <code className="font-mono">{variable.key}</code>?+ </span>+ <div className="flex shrink-0 gap-1">+ <LemonButton+ size="small"+ type="secondary"+ status="danger"+ onClick={() => deleteVariable(idx)}+ >+ Delete+ </LemonButton>+ <LemonButton+ size="small"+ type="tertiary"+ onClick={() => setDeletingVariableIndex(null)}+ >+ Cancel+ </LemonButton>+ </div>+ </div>+ ) : (+ <>+ <div+ className="min-w-0 flex-1"+ onMouseEnter={() => showVariableKeyInput(idx, variable.key)}+ onMouseLeave={() => {+ if (hoveredVariableIndex === idx && editingVariableIndex !== idx) {+ setHoveredVariableIndex(null)+ }+ }}+ >+ {editingVariableIndex === idx ||+ (editingVariableIndex === null && hoveredVariableIndex === idx) ? (+ <LemonInput+ className="font-mono text-xs"+ size="small"+ type="text"+ value={variableKeyDraft}+ placeholder="Unique name"+ aria-label="Variable key"+ autoFocus={editingVariableIndex === idx}+ prefix={<code className="text-xs text-secondary">{'{{ variables.'}</code>}+ suffix={<code className="text-xs text-secondary">{' }}'}</code>}+ onChange={setVariableKeyDraft}+ onFocus={() => setEditingVariableIndex(idx)}+ onBlur={() => finishEditingVariableKey(idx)}+ onPressEnter={(event) => event.currentTarget.blur()}+ />+ ) : (+ <button+ type="button"+ className="block w-full truncate rounded-sm bg-primary-alt-highlight-secondary px-2 py-1.5 text-left text-xs hover:bg-primary-alt-highlight"+ onClick={() => {+ showVariableKeyInput(idx, variable.key)+ setEditingVariableIndex(idx)+ }}+ >+ <code>{`{{ variables.${variable.key} }}`}</code>+ </button>+ )}+ </div>+ <LemonField.Pure className="w-2/5 shrink-0">+ <LemonInput+ size="small"+ type="text"+ value={String(variable.default ?? '')}+ placeholder="Default value"+ onChange={(defaultValue) => editVariableDefaultValue(idx, defaultValue)}+ />+ </LemonField.Pure><LemonButtonsize="small"- icon={<IconCopy />}- className="bg-white/80"- onClick={(e) => {- e.stopPropagation()- void navigator.clipboard.writeText(`{{ variables.${variable.key} }}`)- lemonToast.success('Copied to clipboard')+ type="tertiary"+ icon={<IconX />}+ tooltip="Delete variable"+ aria-label={`Delete ${variable.key || 'variable'}`}+ onClick={() => {+ setHoveredVariableIndex(null)+ setEditingVariableIndex(null)+ setDeletingVariableIndex(idx)}}/>- </span>- </span>- <LemonButton- size="small"- icon={<IconX />}- onClick={() => {- deleteVariable(idx)- }}- />+ </>+ )}</div>))}- <LemonButton- icon={<IconPlus />}- type="secondary"- size="small"- className="self-start"- onClick={addNewVariable}- >+ </ScrollableShadows>+ <div className="shrink-0 px-3 py-2">+ <LemonButton icon={<IconPlus />} type="secondary" size="small" onClick={addNewVariable}>New variable</LemonButton>- </ScrollableShadows>+ </div>++ <LemonDivider className="my-0 shrink-0" />+ <LemonCollapse+ embedded+ className="shrink-0"+ panels={[+ {+ key: 'variable-usage',+ header: <span className="flex-1">How to use variables</span>,+ content: (+ <div className="flex flex-col gap-3 text-sm text-secondary">+ <p>+ Use a variable reference in any action input or condition. For example, enter{' '}+ <code>{`{{ variables.account_owner }}`}</code> as an input value.+ </p>+ <p>+ To save a step result into a variable, select the step and use its{' '}+ <strong>Output variables</strong> section.+ </p>+ </div>+ ),+ },+ ]}+ /></div>)}diff --git a/products/workflows/frontend/Workflows/hogflows/steps/HogFlowBranchNameInput.scss b/products/workflows/frontend/Workflows/hogflows/steps/HogFlowBranchNameInput.scssnew file mode 100644index 000000000000..4724ff65e0f3--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/steps/HogFlowBranchNameInput.scss@@ -0,0 +1,11 @@+.HogFlowBranchNameInput {+ .LemonInput {+ background-color: transparent;+ border-color: transparent;++ &:hover:not([aria-disabled='true']),+ &.LemonInput--focused:not([aria-disabled='true']) {+ border-color: var(--color-border-primary) !important;+ }+ }+}diff --git a/products/workflows/frontend/Workflows/hogflows/steps/HogFlowBranchNameInput.tsx b/products/workflows/frontend/Workflows/hogflows/steps/HogFlowBranchNameInput.tsxnew file mode 100644index 000000000000..344b67f507c2--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/steps/HogFlowBranchNameInput.tsx@@ -0,0 +1,30 @@+import './HogFlowBranchNameInput.scss'++import { LemonInput } from 'lib/lemon-ui/LemonInput'++export function HogFlowBranchNameInput({+ value,+ onChange,+ placeholder,+ ariaLabel,+}: {+ value: string | undefined+ onChange: (value: string) => void+ placeholder: string+ ariaLabel: string+}): JSX.Element {+ return (+ <div className="HogFlowBranchNameInput min-w-0 flex-1">+ <LemonInput+ value={value || ''}+ onChange={onChange}+ placeholder={placeholder}+ size="small"+ transparentBackground+ className="min-w-0"+ aria-label={ariaLabel}+ data-attr="workflow-panel-select-branch"+ />+ </div>+ )+}diff --git a/products/workflows/frontend/Workflows/hogflows/steps/StepConditionalBranch.tsx b/products/workflows/frontend/Workflows/hogflows/steps/StepConditionalBranch.tsxindex c6b4e29c7915..ede6f7d41320 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/StepConditionalBranch.tsx+++ b/products/workflows/frontend/Workflows/hogflows/steps/StepConditionalBranch.tsx@@ -6,9 +6,6 @@ import { IconPlus, IconX } from '@posthog/icons'import { Spinner, Tooltip } from '@posthog/lemon-ui'import { LemonButton } from 'lib/lemon-ui/LemonButton'-import { LemonField } from 'lib/lemon-ui/LemonField'-import { LemonInput } from 'lib/lemon-ui/LemonInput'-import { LemonLabel } from 'lib/lemon-ui/LemonLabel'import { humanFriendlyNumber } from 'lib/utils/numbers'import { HogFlowPropertyFilters } from '../filters/HogFlowFilters'@@ -16,6 +13,7 @@ import { hogFlowEditorLogic } from '../hogFlowEditorLogic'import { HogFlow, HogFlowAction } from '../types'import { batchTriggerLogic } from './batchTriggerLogic'import { StepSchemaErrors } from './components/StepSchemaErrors'+import { HogFlowBranchNameInput } from './HogFlowBranchNameInput'import { getBranchRemovalDisabledReason, isCountableCondition, removeBranchEdge, useDebouncedNameInputs } from './utils'type ConditionFilters = Extract<@@ -133,56 +131,54 @@ export function StepConditionalBranchConfiguration({}return (- <>+ <div><StepSchemaErrors />- {conditions.map((condition, index) => (- <div key={index} className="flex flex-col gap-2 p-2 rounded border">- <div className="flex justify-between items-center gap-2">- <div className="flex items-center gap-2 min-w-0">- <LemonLabel>Condition {index + 1}</LemonLabel>- {isCountableCondition(condition.filters) && (- <ConditionAudienceEstimate- actionId={action.id}- index={index}- filters={condition.filters}+ <div className="flex flex-col gap-3">+ {conditions.map((condition, index) => (+ <div key={index} className="flex flex-col gap-2 p-2 rounded border">+ <div className="flex justify-between items-center gap-2">+ <div className="flex flex-1 items-center gap-2 min-w-0">+ <HogFlowBranchNameInput+ value={localConditionNames[index]}+ onChange={(value) => handleNameChange(index, value)}+ placeholder={`Condition ${index + 1}`}+ ariaLabel={`Condition ${index + 1} name`}/>- )}+ {isCountableCondition(condition.filters) && (+ <ConditionAudienceEstimate+ actionId={action.id}+ index={index}+ filters={condition.filters}+ />+ )}+ </div>+ <LemonButton+ size="xsmall"+ icon={<IconX />}+ onClick={() => removeCondition(index)}+ disabledReason={getBranchRemovalDisabledReason(branchEdges, index, edgesByActionId)}+ /></div>- <LemonButton- size="xsmall"- icon={<IconX />}- onClick={() => removeCondition(index)}- disabledReason={getBranchRemovalDisabledReason(branchEdges, index, edgesByActionId)}- />- </div>- <HogFlowPropertyFilters- filtersKey={`condition-branch-condition-${action.id}-${index}`}- filters={condition.filters ?? {}}- setFilters={(filters) =>- setConditions(- conditions.map((condition, i) =>- i === index ? { ...condition, filters: filters ?? {} } : condition+ <HogFlowPropertyFilters+ filtersKey={`condition-branch-condition-${action.id}-${index}`}+ filters={condition.filters ?? {}}+ setFilters={(filters) =>+ setConditions(+ conditions.map((condition, i) =>+ i === index ? { ...condition, filters: filters ?? {} } : condition+ ))- )- }- typeKey={`workflow-trigger-${index}`}- />-- <LemonField.Pure label="Condition name (optional)">- <LemonInput- value={localConditionNames[index] || ''}- onChange={(value) => handleNameChange(index, value)}- placeholder={`If condition #${index + 1} matches`}- size="small"+ }+ typeKey={`workflow-trigger-${index}`}/>- </LemonField.Pure>- </div>- ))}+ </div>+ ))}+ </div><LemonButton type="secondary" icon={<IconPlus />} onClick={() => addCondition()} className="mt-2">Add condition</LemonButton>- </>+ </div>)}diff --git a/products/workflows/frontend/Workflows/hogflows/steps/StepRandomCohortBranch.tsx b/products/workflows/frontend/Workflows/hogflows/steps/StepRandomCohortBranch.tsxindex 681da15915fd..b7ae9c91b231 100644--- a/products/workflows/frontend/Workflows/hogflows/steps/StepRandomCohortBranch.tsx+++ b/products/workflows/frontend/Workflows/hogflows/steps/StepRandomCohortBranch.tsx@@ -5,12 +5,11 @@ import { useMemo, useState } from 'react'import { IconBalance, IconPlus, IconX } from '@posthog/icons'import { LemonButton } from 'lib/lemon-ui/LemonButton'-import { LemonInput } from 'lib/lemon-ui/LemonInput'-import { LemonLabel } from 'lib/lemon-ui/LemonLabel'import { hogFlowEditorLogic } from '../hogFlowEditorLogic'import { HogFlow, HogFlowAction } from '../types'import { StepSchemaErrors } from './components/StepSchemaErrors'+import { HogFlowBranchNameInput } from './HogFlowBranchNameInput'import {cohortPercentagesAddUp,normalizeCohortPercentages,@@ -124,23 +123,21 @@ export function StepRandomCohortBranchConfiguration({const shortfall = 100 - totalPercentagereturn (- <>+ <div className="flex flex-col gap-3"><StepSchemaErrors />{cohorts.map((cohort, index) => (<div key={index} className="flex flex-col gap-2 p-2 rounded border">- <div className="flex justify-between items-center">- <LemonLabel>Cohort {index + 1}</LemonLabel>+ <div className="flex justify-between items-center gap-2">+ <HogFlowBranchNameInput+ value={localCohortNames[index]}+ onChange={(value) => handleNameChange(index, value)}+ placeholder={`Cohort ${index + 1}`}+ ariaLabel={`Cohort ${index + 1} name`}+ /><LemonButton size="xsmall" icon={<IconX />} onClick={() => removeCohort(index)} /></div>- <LemonInput- value={localCohortNames[index] || ''}- onChange={(value) => handleNameChange(index, value)}- placeholder={`Cohort #${index + 1}`}- size="small"- />-<div className="flex items-center gap-2"><inputtype="number"@@ -173,6 +170,6 @@ export function StepRandomCohortBranchConfiguration({<IconBalance /></LemonButton></div>- </>+ </div>)}diff --git a/products/workflows/frontend/Workflows/hogflows/tree/exampleWorkflows.ts b/products/workflows/frontend/Workflows/hogflows/tree/exampleWorkflows.tsnew file mode 100644index 000000000000..7e866fb44de7--- /dev/null+++ b/products/workflows/frontend/Workflows/hogflows/tree/exampleWorkflows.ts@@ -0,0 +1,736 @@+import type { HogFlow, HogFlowAction } from '../types'++type Edge = HogFlow['edges'][number]++const BASE: Omit<HogFlow, 'id' | 'name' | 'description' | 'trigger' | 'actions' | 'edges' | 'variables'> = {+ team_id: 1,+ version: 4,+ status: 'active',+ exit_condition: 'exit_only_at_end',+ created_at: '2026-09-01T09:00:00.000Z',+ updated_at: '2026-09-04T12:00:00.000Z',+}++const eventTrigger = (id: string, name: string): HogFlow['trigger'] => ({+ type: 'event',+ filters: { events: [{ id, name, type: 'events' }], properties: [], actions: [] },+})++const input = (value: unknown, order: number): { order: number; value: unknown; templating: 'hog' } => ({+ order,+ value,+ templating: 'hog',+})++const variableCondition = (+ name: string,+ key: string,+ value: string | string[]+): { name: string; filters: { properties: any[] } } => ({+ name,+ filters: { properties: [{ key, type: 'workflow_variable', value, operator: 'exact' }] },+})++const groupCondition = (+ name: string,+ key: string,+ value: string+): { name: string; filters: { properties: any[] } } => ({+ name,+ filters: { properties: [{ key, type: 'group', value, operator: 'exact', group_type_index: 0 }] },+})++const exitAction = (reason: string): HogFlowAction =>+ ({ id: 'exit_node', type: 'exit', name: 'Exit', description: '', config: { reason } }) as HogFlowAction++const getTicket = (id: string, name: string, description: string): HogFlowAction =>+ ({+ id,+ type: 'function',+ name,+ description,+ config: {+ template_id: 'template-posthog-get-ticket',+ inputs: { ticket_id: input('{event.properties.ticket_id}', 0) },+ },+ }) as HogFlowAction++const emailAction = (id: string, name: string, subject: string, preheader: string, body: string): HogFlowAction =>+ ({+ id,+ type: 'function_email',+ name,+ description: '',+ config: {+ template_id: 'template-email',+ message_category_id: '019a0000-0000-0000-0000-000000000001',+ message_category_type: 'marketing',+ inputs: {+ email: {+ order: 0,+ templating: 'liquid',+ value: {+ to: { name: '', email: '{{ person.properties.email }}' },+ from: { integrationId: 1 },+ subject,+ preheader,+ html: `<html><body><h1>${subject}</h1><p>${body}</p></body></html>`,+ text: body,+ },+ },+ },+ },+ }) as HogFlowAction++const setPersonProperty = (id: string, name: string, sentLabel: string): HogFlowAction =>+ ({+ id,+ type: 'function',+ name,+ description: 'Set properties of a person in PostHog.',+ config: {+ template_id: 'template-posthog-capture',+ inputs: {+ distinct_id: input('{event.distinct_id}', 0),+ set_properties: input(+ {+ workflow_emails_sent: `{arrayPushBack(person.properties.workflow_emails_sent ?? [], '${sentLabel}')}`,+ },+ 1+ ),+ set_once_properties: input({}, 2),+ },+ },+ }) as HogFlowAction++const slackAction = (id: string, name: string, text: string): HogFlowAction =>+ ({+ id,+ type: 'function',+ name,+ description: '',+ config: {+ template_id: 'template-slack',+ inputs: {+ slack_workspace: input(1, 0),+ channel: input('#alerts-example', 1),+ icon_emoji: input(':hedgehog:', 2),+ username: input('PostHog', 3),+ text: input(text, 4),+ },+ },+ }) as HogFlowAction++/**+ * Support SLA routing — walks a customer through segment checks and then a nine-way plan branch,+ * with a "is a tighter SLA already set?" guard in front of every write. 43 nodes, 79 edges.+ */+const supportSlaRouting = (): HogFlow => {+ const actions: HogFlowAction[] = []+ const edges: Edge[] = []++ const updateTicket = (id: string, name: string, tag: string, amount: number): HogFlowAction =>+ ({+ id,+ type: 'function',+ name,+ description: `Add the ${tag} tag and set a ${amount} hour SLA`,+ config: {+ template_id: 'template-posthog-update-ticket',+ inputs: {+ ticket_id: input('{event.properties.ticket_id}', 0),+ sla_amount: input(String(amount), 1),+ sla_unit: input('hour', 2),+ sla_business_hours: input(+ {+ days: ['monday', 'tuesday', 'wednesday', 'thursday', 'friday'],+ time: ['09:00', '17:00'],+ timezone: 'UTC',+ },+ 3+ ),+ tags: input([tag], 4),+ tags_mode: input('add', 5),+ },+ },+ }) as HogFlowAction++ // Every SLA write sits behind a guard that exits when the ticket already has a tighter deadline.+ const guardedWrite = (key: string, label: string, tag: string, hours: number): string => {+ const guardId = `guard_${key}`+ const writeId = `set_sla_${key}`+ actions.push({+ id: guardId,+ type: 'conditional_branch',+ name: `${label} SLA guard`,+ description: 'Skip the write when the existing SLA is already tighter.',+ config: { conditions: [variableCondition('Existing SLA is tighter', 'ticket_sla_is_tighter', ['true'])] },+ } as HogFlowAction)+ actions.push(updateTicket(writeId, `${label} ticket`, tag, hours))+ edges.push({ from: guardId, to: 'exit_node', type: 'branch', index: 0 })+ edges.push({ from: guardId, to: writeId, type: 'continue' })+ edges.push({ from: writeId, to: 'exit_node', type: 'continue' })+ return guardId+ }++ actions.push({+ id: 'trigger_node',+ type: 'trigger',+ name: 'Response from the customer',+ description: 'New response received',+ config: eventTrigger('$conversation_message_received', 'Ticket message received'),+ } as HogFlowAction)+ actions.push(getTicket('get_ticket', 'Get ticket', 'Load the ticket so its tags and SLA are available.'))+ actions.push({+ id: 'check_exclusions',+ type: 'conditional_branch',+ name: 'Check for exclusions',+ description: 'Skip tickets from the excluded channel, the excluded inboxes, or a new ticket.',+ config: {+ conditions: [+ variableCondition('From the excluded channel', 'ticket_slack_channel_id', 'C00EXAMPLE1'),+ variableCondition('Sent to shop@', 'ticket_email_to', ['[email protected]']),+ variableCondition('Sent to abuse@', 'ticket_email_to', ['[email protected]']),+ variableCondition('Ticket status is new', 'ticket_status', ['new']),+ ],+ },+ } as HogFlowAction)+ edges.push({ from: 'trigger_node', to: 'get_ticket', type: 'continue' })+ edges.push({ from: 'get_ticket', to: 'check_exclusions', type: 'continue' })+ for (const index of [0, 1, 2, 3]) {+ edges.push({ from: 'check_exclusions', to: 'exit_node', type: 'branch', index })+ }++ // Segments are checked one after another, each falling through to the next.+ const segments = [+ {+ key: 'top-accounts',+ label: 'Top accounts',+ tag: 'segment_top_accounts',+ hours: 2,+ property: 'is_top_account',+ },+ { key: 'churn-risk', label: 'Churn risk', tag: 'segment_churn_risk', hours: 2, property: 'is_churn_risk' },+ { key: 'onboarding', label: 'Onboarding', tag: 'segment_onboarding', hours: 8, property: 'is_onboarding' },+ ]+ let fallthroughFrom = 'check_exclusions'+ for (const segment of segments) {+ const checkId = `check_${segment.key}`+ actions.push({+ id: checkId,+ type: 'conditional_branch',+ name: `Check if ${segment.label.toLowerCase()}`,+ description: '',+ config: { conditions: [groupCondition(segment.label, segment.property, 'true')] },+ } as HogFlowAction)+ edges.push({ from: fallthroughFrom, to: checkId, type: 'continue' })+ const guardId = guardedWrite(segment.key, segment.label, segment.tag, segment.hours)+ edges.push({ from: checkId, to: guardId, type: 'branch', index: 0 })+ fallthroughFrom = checkId+ }++ const plans = [+ { key: 'enterprise', label: 'Enterprise', tag: 'plan_enterprise', hours: 4 },+ { key: 'enterprise-managed', label: 'Enterprise (managed)', tag: 'plan_enterprise_managed', hours: 4 },+ { key: 'scale', label: 'Scale', tag: 'plan_scale', hours: 16 },+ { key: 'growth', label: 'Growth', tag: 'plan_growth', hours: 32 },+ { key: 'teams', label: 'Teams', tag: 'plan_teams', hours: 16 },+ { key: 'paid', label: 'Paid', tag: 'plan_paid', hours: 32 },+ { key: 'free', label: 'Free', tag: 'plan_free', hours: 48 },+ { key: 'startup', label: 'Startup', tag: 'plan_startup', hours: 32 },+ { key: 'accelerator', label: 'Accelerator', tag: 'plan_accelerator', hours: 16 },+ ]+ actions.push({+ id: 'check_plan',+ type: 'conditional_branch',+ name: 'Check billing plan',+ description: 'Check the billing plan for every customer that matched no segment.',+ config: { conditions: plans.map((plan) => groupCondition(plan.label, 'billing_plan', plan.key)) },+ } as HogFlowAction)+ edges.push({ from: fallthroughFrom, to: 'check_plan', type: 'continue' })+ plans.forEach((plan, index) => {+ const guardId = guardedWrite(plan.key, plan.label, plan.tag, plan.hours)+ edges.push({ from: 'check_plan', to: guardId, type: 'branch', index })+ })++ actions.push({+ id: 'check_shared_channel',+ type: 'conditional_branch',+ name: 'Check shared channel',+ description: 'Customers with a shared channel get a default SLA instead of an alert.',+ config: {+ conditions: [+ variableCondition('Has a shared Slack channel', 'ticket_channel_kind', ['slack']),+ variableCondition('Has a shared Teams channel', 'ticket_channel_kind', ['teams']),+ ],+ },+ } as HogFlowAction)+ edges.push({ from: 'check_plan', to: 'check_shared_channel', type: 'continue' })+ edges.push({+ from: 'check_shared_channel',+ to: guardedWrite('slack-default', 'Shared Slack channel default', 'channel_slack_default', 16),+ type: 'branch',+ index: 0,+ })+ edges.push({+ from: 'check_shared_channel',+ to: guardedWrite('teams-default', 'Shared Teams channel default', 'channel_teams_default', 16),+ type: 'branch',+ index: 1,+ })++ actions.push({+ id: 'check_contact_route',+ type: 'conditional_branch',+ name: 'Check the page or inbox the reply came from',+ description: '',+ config: {+ conditions: [+ variableCondition('Replied from /login', 'ticket_page', ['/login']),+ variableCondition('Replied from /signup', 'ticket_page', ['/signup']),+ variableCondition('Emailed billing@', 'ticket_email_to', ['[email protected]']),+ ],+ },+ } as HogFlowAction)+ edges.push({ from: 'check_shared_channel', to: 'check_contact_route', type: 'continue' })+ const loginGuard = guardedWrite('login-default', 'Login default', 'unknown_login_default', 8)+ const billingGuard = guardedWrite('billing-default', 'Billing default', 'unknown_billing_default', 32)+ edges.push({ from: 'check_contact_route', to: loginGuard, type: 'branch', index: 0 })+ edges.push({ from: 'check_contact_route', to: loginGuard, type: 'branch', index: 1 })+ edges.push({ from: 'check_contact_route', to: billingGuard, type: 'branch', index: 2 })++ actions.push(+ slackAction(+ 'alert_unmatched',+ 'Alert the support channel',+ 'A ticket matched no segment, plan, or channel and needs triage by hand.'+ )+ )+ edges.push({ from: 'check_contact_route', to: 'alert_unmatched', type: 'continue' })+ edges.push({ from: 'alert_unmatched', to: 'exit_node', type: 'continue' })+ actions.push(exitAction('Default exit'))++ return {+ ...BASE,+ id: 'example-support-sla-routing',+ name: 'Support SLA routing by segment and plan',+ description:+ 'Runs when a customer replies to a ticket. Checks segments in priority order, then the billing plan, and sets a response-time SLA plus a matching tag. Every write is guarded so a tighter existing SLA is never overwritten.',+ trigger: eventTrigger('$conversation_message_received', 'Ticket message received'),+ variables: [+ { key: 'ticket_status', type: 'string', label: 'Status', default: '' },+ { key: 'ticket_priority', type: 'string', label: 'Priority', default: '' },+ { key: 'ticket_number', type: 'string', label: 'Number', default: '' },+ { key: 'ticket_subject', type: 'string', label: 'Subject', default: '' },+ { key: 'ticket_email_to', type: 'string', label: 'Sent to', default: '' },+ { key: 'ticket_page', type: 'string', label: 'Page', default: '' },+ { key: 'ticket_slack_channel_id', type: 'string', label: 'Slack channel', default: '' },+ { key: 'ticket_channel_kind', type: 'string', label: 'Channel kind', default: '' },+ { key: 'ticket_sla_due_at', type: 'string', label: 'SLA due at', default: '' },+ { key: 'ticket_sla_is_tighter', type: 'string', label: 'Existing SLA is tighter', default: '' },+ ],+ actions,+ edges,+ }+}++/**+ * Renewal alerting — a short gate chain that fans out into seven mutually exclusive Slack pings.+ * 15 nodes, 25 edges.+ */+const renewalWindowAlerts = (): HogFlow => {+ const pings = [+ {+ id: 'ping_renewal_over',+ name: 'Ping: credit runs out early',+ text: 'Credit runs out before the renewal date.',+ },+ {+ id: 'ping_renewal_under',+ name: 'Ping: credit left at renewal',+ text: 'Credit is left over at the renewal date.',+ },+ { id: 'ping_renewal_on12', name: 'Ping: on track, 12 month', text: 'On track on a 12 month contract.' },+ {+ id: 'ping_renewal_multi',+ name: 'Ping: on track, multi-year',+ text: 'On track on a multi-year contract that is ending.',+ },+ {+ id: 'ping_instalment_over',+ name: 'Ping: gap before the instalment',+ text: 'Credit runs out before the next instalment.',+ },+ {+ id: 'ping_instalment_under',+ name: 'Ping: credit left at the instalment',+ text: 'Credit is left over at the next instalment.',+ },+ {+ id: 'ping_instalment_on',+ name: 'Ping: instalment on track',+ text: 'Usage is on track for the next instalment.',+ },+ ]++ const actions: HogFlowAction[] = [+ {+ id: 'trigger_node',+ type: 'trigger',+ name: 'Contract phase becomes renewal window',+ description: '',+ config: eventTrigger('$account_custom_property_changed', 'Account custom property changed'),+ } as HogFlowAction,+ {+ id: 'get_account',+ type: 'function',+ name: 'Fetch the account',+ description: 'Loads the account so the message can name the managing team.',+ on_error: 'continue',+ output_variable: { key: 'account' },+ config: {+ template_id: 'template-posthog-get-account',+ inputs: { external_id: input('{event.properties.account_external_id}', 0) },+ },+ } as HogFlowAction,+ {+ id: 'gate_managed',+ type: 'conditional_branch',+ name: 'Account has a managing team?',+ description: '',+ config: { conditions: [groupCondition('Has a managing team', 'account_team', 'set')] },+ } as HogFlowAction,+ {+ id: 'gate_signed',+ type: 'conditional_branch',+ name: 'Renewal already signed?',+ description: '',+ config: { conditions: [groupCondition('Already signed', 'renewal_signed', 'true')] },+ } as HogFlowAction,+ {+ id: 'branch_next_event',+ type: 'conditional_branch',+ name: 'Next event: instalment or contract end?',+ description: '',+ config: {+ conditions: [+ groupCondition('Next instalment', 'next_contract_event', 'instalment'),+ groupCondition('Contract end', 'next_contract_event', 'contract_end'),+ ],+ },+ } as HogFlowAction,+ {+ id: 'band_renewal',+ type: 'conditional_branch',+ name: 'Renewal: usage band and term',+ description: '',+ config: {+ conditions: [+ groupCondition('Runs out early', 'usage_band', 'over'),+ groupCondition('Credit left over', 'usage_band', 'under'),+ groupCondition('On track, 12 month', 'usage_band', 'on_track_12'),+ groupCondition('On track, multi-year', 'usage_band', 'on_track_multi'),+ ],+ },+ } as HogFlowAction,+ {+ id: 'band_instalment',+ type: 'conditional_branch',+ name: 'Instalment: usage band',+ description: '',+ config: {+ conditions: [+ groupCondition('Runs out early', 'usage_band', 'over'),+ groupCondition('Credit left over', 'usage_band', 'under'),+ groupCondition('On track', 'usage_band', 'on_track'),+ ],+ },+ } as HogFlowAction,+ ...pings.map((ping) => slackAction(ping.id, ping.name, ping.text)),+ exitAction('Done'),+ ]++ const edges: Edge[] = [+ { from: 'trigger_node', to: 'get_account', type: 'continue' },+ { from: 'get_account', to: 'gate_managed', type: 'continue' },+ { from: 'gate_managed', to: 'gate_signed', type: 'branch', index: 0 },+ { from: 'gate_managed', to: 'exit_node', type: 'continue' },+ { from: 'gate_signed', to: 'exit_node', type: 'branch', index: 0 },+ { from: 'gate_signed', to: 'branch_next_event', type: 'continue' },+ { from: 'branch_next_event', to: 'band_instalment', type: 'branch', index: 0 },+ { from: 'branch_next_event', to: 'band_renewal', type: 'branch', index: 1 },+ { from: 'branch_next_event', to: 'exit_node', type: 'continue' },+ { from: 'band_renewal', to: 'ping_renewal_over', type: 'branch', index: 0 },+ { from: 'band_renewal', to: 'ping_renewal_under', type: 'branch', index: 1 },+ { from: 'band_renewal', to: 'ping_renewal_on12', type: 'branch', index: 2 },+ { from: 'band_renewal', to: 'ping_renewal_multi', type: 'branch', index: 3 },+ { from: 'band_renewal', to: 'exit_node', type: 'continue' },+ { from: 'band_instalment', to: 'ping_instalment_over', type: 'branch', index: 0 },+ { from: 'band_instalment', to: 'ping_instalment_under', type: 'branch', index: 1 },+ { from: 'band_instalment', to: 'ping_instalment_on', type: 'branch', index: 2 },+ { from: 'band_instalment', to: 'exit_node', type: 'continue' },+ ...pings.map((ping): Edge => ({ from: ping.id, to: 'exit_node', type: 'continue' })),+ ]++ return {+ ...BASE,+ id: 'example-renewal-window-alerts',+ name: 'Renewal window alerts',+ description:+ 'Pings the account owner when a contract enters its renewal window. Skips signed renewals, then routes by the next contract event and the usage band to one of seven messages.',+ trigger: eventTrigger('$account_custom_property_changed', 'Account custom property changed'),+ variables: [],+ actions,+ edges,+ }+}++/**+ * Pending ticket cleanup — long, mostly linear, with three delays and a re-check before each send.+ * 15 nodes, 21 edges.+ */+const pendingTicketCleanup = (): HogFlow => {+ const actions: HogFlowAction[] = [+ {+ id: 'trigger_node',+ type: 'trigger',+ name: 'Ticket becomes pending',+ description: '',+ config: eventTrigger('$conversation_ticket_status_changed', 'Ticket status changed'),+ } as HogFlowAction,+ {+ id: 'delay_five_days',+ type: 'delay',+ name: 'Wait five days',+ description: '',+ config: { delay_duration: '5d' },+ } as HogFlowAction,+ getTicket('get_ticket', 'Get ticket', 'Load the ticket before deciding whether to warn.'),+ {+ id: 'check_exclusions',+ type: 'conditional_branch',+ name: 'Check for exclusions',+ description: '',+ config: {+ conditions: [+ variableCondition('From the excluded channel', 'ticket_slack_channel_id', 'C00EXAMPLE1'),+ variableCondition('Sent to shop@', 'ticket_email_to', ['[email protected]']),+ variableCondition('Sent to abuse@', 'ticket_email_to', ['[email protected]']),+ variableCondition('Excluded from reporting', 'ticket_tags', ['exclude_from_reporting']),+ ],+ },+ } as HogFlowAction,+ {+ id: 'check_pending',+ type: 'conditional_branch',+ name: 'Still pending?',+ description: '',+ config: { conditions: [variableCondition('Still pending', 'ticket_status', ['pending'])] },+ } as HogFlowAction,+ emailAction(+ 'email_warning',+ 'Warning email',+ 'We will close this ticket soon',+ 'Reply to keep it open',+ 'We have not heard back for five days. Reply and we will pick this up again.'+ ),+ {+ id: 'delay_two_days',+ type: 'delay',+ name: 'Wait two days',+ description: '',+ config: { delay_duration: '2d' },+ } as HogFlowAction,+ getTicket('get_ticket_again', 'Get ticket again', 'Re-read the ticket after the warning.'),+ {+ id: 'check_pending_again',+ type: 'conditional_branch',+ name: 'Still pending after the warning?',+ description: '',+ config: { conditions: [variableCondition('Still pending', 'ticket_status', ['pending'])] },+ } as HogFlowAction,+ {+ id: 'resolve_ticket',+ type: 'function',+ name: 'Resolve the ticket',+ description: '',+ config: {+ template_id: 'template-posthog-update-ticket',+ inputs: {+ ticket_id: input('{event.properties.ticket_id}', 0),+ status: input('resolved', 1),+ tags_mode: input('add', 2),+ },+ },+ } as HogFlowAction,+ {+ id: 'delay_one_day',+ type: 'delay',+ name: 'Wait 24 hours',+ description: '',+ config: { delay_duration: '1d' },+ } as HogFlowAction,+ getTicket('recheck_ticket', 'Re-check the ticket', 'Only survey tickets that are still resolved.'),+ {+ id: 'check_resolved',+ type: 'conditional_branch',+ name: 'Still resolved?',+ description: '',+ config: { conditions: [variableCondition('Still resolved', 'ticket_status', ['resolved'])] },+ } as HogFlowAction,+ emailAction(+ 'email_survey',+ 'Satisfaction survey',+ 'How did we do?',+ 'One question, one click',+ 'Your ticket is closed. Tell us how the support went.'+ ),+ exitAction('Default exit'),+ ]++ const edges: Edge[] = [+ { from: 'trigger_node', to: 'delay_five_days', type: 'continue' },+ { from: 'delay_five_days', to: 'get_ticket', type: 'continue' },+ { from: 'get_ticket', to: 'check_exclusions', type: 'continue' },+ { from: 'check_exclusions', to: 'exit_node', type: 'branch', index: 0 },+ { from: 'check_exclusions', to: 'exit_node', type: 'branch', index: 1 },+ { from: 'check_exclusions', to: 'exit_node', type: 'branch', index: 2 },+ { from: 'check_exclusions', to: 'exit_node', type: 'branch', index: 3 },+ { from: 'check_exclusions', to: 'check_pending', type: 'continue' },+ { from: 'check_pending', to: 'email_warning', type: 'branch', index: 0 },+ { from: 'check_pending', to: 'exit_node', type: 'continue' },+ { from: 'email_warning', to: 'delay_two_days', type: 'continue' },+ { from: 'delay_two_days', to: 'get_ticket_again', type: 'continue' },+ { from: 'get_ticket_again', to: 'check_pending_again', type: 'continue' },+ { from: 'check_pending_again', to: 'resolve_ticket', type: 'branch', index: 0 },+ { from: 'check_pending_again', to: 'exit_node', type: 'continue' },+ { from: 'resolve_ticket', to: 'delay_one_day', type: 'continue' },+ { from: 'delay_one_day', to: 'recheck_ticket', type: 'continue' },+ { from: 'recheck_ticket', to: 'check_resolved', type: 'continue' },+ { from: 'check_resolved', to: 'email_survey', type: 'branch', index: 0 },+ { from: 'check_resolved', to: 'exit_node', type: 'continue' },+ { from: 'email_survey', to: 'exit_node', type: 'continue' },+ ]++ return {+ ...BASE,+ id: 'example-pending-ticket-cleanup',+ name: 'Close tickets that stay pending',+ description:+ 'Warns on day five, closes the ticket on day seven if nobody replied, then sends a satisfaction survey a day later when the ticket is still closed.',+ trigger: eventTrigger('$conversation_ticket_status_changed', 'Ticket status changed'),+ variables: [+ { key: 'ticket_status', type: 'string', label: 'Status', default: '' },+ { key: 'ticket_email_to', type: 'string', label: 'Sent to', default: '' },+ { key: 'ticket_tags', type: 'string', label: 'Tags', default: '' },+ { key: 'ticket_slack_channel_id', type: 'string', label: 'Slack channel', default: '' },+ ],+ actions,+ edges,+ }+}++/**+ * Add-on promotion — a wide email split where each send is followed by its own person-property write.+ * 14 nodes, 19 edges.+ */+const addOnPromotionEmails = (): HogFlow => {+ const paths = [+ { key: 'seat_growth', subject: 'Your team is growing', label: 'Seat growth' },+ { key: 'flag_usage', subject: 'You are running a lot of flags', label: 'Flag usage' },+ { key: 'project_count', subject: 'Time for another project?', label: 'Project count' },+ { key: 'follow_up_a', subject: 'One more thing about add-ons', label: 'Follow-up A' },+ { key: 'follow_up_b', subject: 'A different angle on add-ons', label: 'Follow-up B' },+ ]++ const emailId = (key: string): string => `email_${key}`+ const writeId = (key: string): string => `record_${key}`++ const actions: HogFlowAction[] = [+ {+ id: 'trigger_node',+ type: 'trigger',+ name: 'No add-on and revenue above the threshold',+ description: '',+ config: eventTrigger('organization usage report', 'Organization usage report'),+ } as HogFlowAction,+ {+ id: 'branch_signal',+ type: 'conditional_branch',+ name: 'Which growth signal fired?',+ description: '',+ config: {+ conditions: [+ groupCondition('Seat growth', 'growth_signal', 'seats'),+ groupCondition('Flag usage', 'growth_signal', 'flags'),+ groupCondition('Project count', 'growth_signal', 'projects'),+ groupCondition('Nothing specific', 'growth_signal', 'generic'),+ ],+ },+ } as HogFlowAction,+ {+ id: 'branch_second_email',+ type: 'conditional_branch',+ name: 'Send a second email?',+ description: '',+ config: {+ conditions: [+ groupCondition('First follow-up', 'follow_up_stage', 'first'),+ groupCondition('Second follow-up', 'follow_up_stage', 'second'),+ ],+ },+ } as HogFlowAction,+ ...paths.flatMap((path) => [+ emailAction(+ emailId(path.key),+ path.label,+ path.subject,+ 'A quick look at what the add-ons do',+ 'Here is what the Growth and Scale add-ons change for a workspace your size.'+ ),+ setPersonProperty(writeId(path.key), 'Update person property', path.subject),+ ]),+ exitAction('Default exit'),+ ]++ const edges: Edge[] = [+ { from: 'trigger_node', to: 'branch_signal', type: 'continue' },+ { from: 'branch_signal', to: emailId('seat_growth'), type: 'branch', index: 0 },+ { from: 'branch_signal', to: emailId('flag_usage'), type: 'branch', index: 1 },+ { from: 'branch_signal', to: emailId('project_count'), type: 'branch', index: 2 },+ { from: 'branch_signal', to: 'branch_second_email', type: 'branch', index: 3 },+ { from: 'branch_signal', to: 'exit_node', type: 'continue' },+ { from: 'branch_second_email', to: emailId('follow_up_a'), type: 'branch', index: 0 },+ { from: 'branch_second_email', to: emailId('follow_up_b'), type: 'branch', index: 1 },+ { from: 'branch_second_email', to: 'exit_node', type: 'continue' },+ ...paths.flatMap((path): Edge[] => [+ { from: emailId(path.key), to: writeId(path.key), type: 'continue' },+ { from: writeId(path.key), to: 'exit_node', type: 'continue' },+ ]),+ ]++ return {+ ...BASE,+ id: 'example-add-on-promotion-emails',+ name: 'Promote add-ons from a growth signal',+ description:+ 'Splits on which growth signal fired, sends the matching email, and records the send on the person so the same email never goes out twice.',+ trigger: eventTrigger('organization usage report', 'Organization usage report'),+ variables: [{ key: 'growth_signal', type: 'string', label: 'Growth signal', default: '' }],+ actions,+ edges,+ }+}++/**+ * Redacted stand-ins for the busiest workflows running in production, matched node for node and+ * edge for edge. Names, filters, channels, addresses, and email bodies are invented.+ */+export const EXAMPLE_WORKFLOWS: Record<string, HogFlow> = Object.fromEntries(+ [supportSlaRouting(), renewalWindowAlerts(), pendingTicketCleanup(), addOnPromotionEmails()].map((flow) => [+ flow.id,+ flow,+ ])+)++export const EXAMPLE_WORKFLOW_IDS = Object.keys(EXAMPLE_WORKFLOWS)