var E=Object.defineProperty;var b=Object.getOwnPropertySymbols;var V=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var h=(a,s,e)=>s in a?E(a,s,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[s]=e,u=(a,s)=>{for(var e in s||(s={}))V.call(s,e)&&h(a,e,s[e]);if(b)for(var e of b(s))F.call(s,e)&&h(a,e,s[e]);return a};import{j as t,_ as m}from"./main.2.8.1.js";import{g as I,u as _,d as l}from"./react-router-dom.9mCuUg3q.js";import{S as M}from"./SnackMsg.S8DrwLlT.js";import{S as $}from"./Steps.1hz7v9Vj.js";import{g as q}from"./Integrations.D2bgBas2.js";import{c as z,C as A}from"./CustomFunctionHelper.Bj3p7Rid.js";import B from"./CustomFuncEditor.BR9L61Su.js";import{T as P}from"./TutorialLink.BAFX--T3.js";import{t as R}from"./tutorialLinks.kMkIDzcD.js";import{z as U}from"./Note.BeM7sN-p.js";import"./Table.DAL7rcPQ.js";import"./CopyIcn.3gZpHton.js";import"./index.wO-AxluA.js";var f,x;function D(){if(x)return f;x=1;function a(){const s=["a","b","c","d","e","f","0","1","2","3","4","5","6","7","8","9"];let e=[];for(let n=0;n<36;n++)n===8||n===13||n===18||n===23?e[n]="-":e[n]=s[Math.ceil(Math.random()*s.length-1)];return e.join("")}return f=a,f}var H=D(),K=I(H);const rt=({formFields:a,setFlow:s,flow:e,allIntegURL:n})=>{const v=_(),[d,j]=l.useState(1),[N,y]=l.useState(!1),[r,C]=l.useState({}),[S,k]=l.useState({show:!1}),w=K(),{customAction:o}=R,[i,p]=l.useState({name:"Custom Action",type:"CustomAction",randomFileName:w,defaultValue:`<?php if (!defined('ABSPATH')) {exit;} 
    
  function yourFunctionName($trigger){
    $trigger['yourKey'];
    //write here your custom function
  }  
  yourFunctionName($trigger);`,value:""});l.useEffect(()=>{const c=u({},i);delete c.isValid,p(u({},c))},[i==null?void 0:i.value]);const L=()=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),j(2)},T=c=>{const g=u({},i);g[c.target.name]=c.target.value,p(g)};return t.jsxs("div",{children:[t.jsx(M,{snack:S,setSnackbar:k}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx($,{step:2,active:d})}),t.jsxs("div",{className:"btcd-stp-page",style:u({},d===1&&{width:"70%",height:"auto",overflow:"visible"}),children:[o==null?void 0:o.youTubeLink,t.jsx(P,{title:"Custom Action",docLink:o==null?void 0:o.docLink}),t.jsxs("div",{className:"d-flx my-3",children:[t.jsx("div",{className:"wdt-200 d-in-b mt-3",children:t.jsx("b",{children:m("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp mt-1",onChange:T,name:"name",value:i.name,type:"text",placeholder:m("Integration Name...","bit-integrations")})]}),t.jsx(B,{customActionConf:i,setCustomActionConf:p,formFields:a}),t.jsxs("button",{onClick:()=>z(i,p,r,C),disabled:!i.value||(r==null?void 0:r.validate),className:"btn f-left btcd-btn-lg purple sh-sm flx mt-5",type:"button",children:[i!=null&&i.isValid?m("Validated ✔","bit-integrations"):m("Validated","bit-integrations"),(r==null?void 0:r.validate)&&t.jsx(U,{size:"20",clr:"#022217",className:"ml-2"})]}),t.jsxs("button",{onClick:()=>L(),disabled:!i.isValid,className:"btn f-right btcd-btn-lg purple sh-sm flx mt-5",type:"button",children:[m("Next","bit-integrations"),"  ",t.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.jsx("div",{className:"btcd-stp-page",style:{width:d===2&&"100%",height:d===2&&"auto"},children:t.jsx(A,{step:d,saveConfig:()=>q(e,s,n,i,v,"","",y),isLoading:N})})]})};export{rt as default};
