(()=>{"use strict";const e=window.React,t=window.wp.i18n,o=window.wp.components,l=window.jfb.components,r=window.jfb.actions,n=window.wp.primitives,a=(0,e.createElement)(n.SVG,{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},(0,e.createElement)(n.Path,{d:"M20.8 10.7l-4.3-4.3-1.1 1.1 4.3 4.3c.1.1.1.3 0 .4l-4.3 4.3 1.1 1.1 4.3-4.3c.7-.8.7-1.9 0-2.6zM4.2 11.8l4.3-4.3-1-1-4.3 4.3c-.7.7-.7 1.8 0 2.5l4.3 4.3 1.1-1.1-4.3-4.3c-.2-.1-.2-.3-.1-.4z"})),i={type:"call_hook",label:(0,t.__)("Call Hook","jet-form-builder"),edit:function({settings:n,onChangeSettingObj:a}){return(0,e.createElement)(o.Flex,{direction:"column"},(0,e.createElement)(l.RowControl,null,({id:o})=>(0,e.createElement)(r.ValidatorProvider,{isSupported:()=>!0},({hasError:r,setShowError:i})=>(0,e.createElement)(e.Fragment,null,(0,e.createElement)(l.RequiredLabel,{htmlFor:o},(0,t.__)("Hook Name","jet-form-builder")),(0,e.createElement)(l.RowControlEnd,{hasError:r},(0,e.createElement)(l.StyledTextControl,{id:o,value:n.hook_name,onChange:e=>a({hook_name:e.toLowerCase().replace(/[^\w\-]/g,"")}),onBlur:()=>i(!0)}))))),(0,e.createElement)(l.WideLine,null),(0,e.createElement)("div",{className:"jet-call-hook-instruction"},(0,t.__)("Called hook names:","jet-form-builder"),(0,e.createElement)("ul",null,(0,e.createElement)("li",null,(0,e.createElement)("code",null,"jet-form-builder/custom-action/",n.hook_name)," - ",(0,t.__)("WP action. Perform a hook without an ability to validate form,","jet-form-builder")),(0,e.createElement)("li",null,(0,e.createElement)("code",null,"jet-form-builder/custom-filter/",n.hook_name)," - ",(0,t.__)("WP filter. Perform a hook with an ability to validate form. Allows to return error message.","jet-form-builder"))),(0,t.__)("Hook arguments:","jet-form-builder"),(0,e.createElement)("ul",null,(0,e.createElement)("li",null,(0,e.createElement)("code",null,"$result")," - ",(0,t.__)("only for WP filter. Hook execution result,","jet-form-builder")),(0,e.createElement)("li",null,(0,e.createElement)("code",null,"$request")," - ",(0,t.__)("array with submitted form data,","jet-form-builder")),(0,e.createElement)("li",null,(0,e.createElement)("code",null,"$action_handler")," - ",(0,t.__)("action handler object, allows to manage actions data and to throws error status:","jet-form-builder"),(0,e.createElement)("code",null,"throw new Action_Exception( 'failed')")))))},icon:a,docHref:"https://jetformbuilder.com/features/call-hook/",category:"advanced",validators:[({settings:e})=>!e?.hook_name&&{type:"empty",property:"hook_name"}]};(0,r.registerAction)(i)})();