| 1 |
var C=Object.defineProperty;var b=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,F=Object.prototype.propertyIsEnumerable;var k=(t,a,i)=>a in t?C(t,a,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[a]=i,x=(t,a)=>{for(var i in a||(a={}))P.call(a,i)&&k(t,i,a[i]);if(b)for(var i of b(a))F.call(a,i)&&k(t,i,a[i]);return t};import{F as w,r,j as e,_ as n,L,bu as T,c as E,g as K,S as M}from"./main-762.js";/* empty css */import{t as S}from"./bf-281-48.js";import{T as R}from"./bf-525-114.js";import{A as U}from"./bf-704-110.js";import{s as B}from"./bf-145-47.js";import"./bf-142-115.js";import"./bf-685-46.js";import"./bf-213-54.js";import"./bf-249-69.js";function D({activeCampaingConf:t,setActiveCampaingConf:a,step:i,setstep:A,setSnackbar:y,isInfo:o,isLoading:p,setIsLoading:d,allIntegURL:g,authorizedAction:j}){const f=w(),[c,_]=r.useState(!1),[l,u]=r.useState({name:"",api_key:""}),[z,I]=r.useState(!1),N=()=>{const s=x({},t);if(!s.name||!s.api_key||!s.api_url){u({name:s.name?"":n("Integration name cann't be empty"),api_key:s.api_key?"":n("Access API Key cann't be empty"),api_url:s.api_url?"":n("Access API URL cann't be empty")});return}d("auth");const h={api_key:s.api_key,api_url:s.api_url};E(h,"bitforms_aCampaign_authorize").then(m=>{m!=null&&m.success&&(_(!0),y({show:!0,msg:n("Authorized Successfully")}),B(s),setTimeout(()=>{f(g)},1e3)),I(!0),d(!1)})},v=s=>{const h=x({},t),m=x({},l);m[s.target.name]="",h[s.target.name]=s.target.value,u(m),a(h)};return r.useEffect(()=>{c&&j()},[c]),e.jsxs(e.Fragment,{children:[e.jsx(R,{title:S.activeCampaign.title,youTubeLink:S.activeCampaign.link}),e.jsxs("div",{className:"btcd-stp-page",style:{width:900,height:"100%"},children:[e.jsx("div",{className:"mt-3 wdt-200",children:e.jsx("b",{children:n("Account Name:")})}),e.jsx("input",{"aria-label":"Integration name",className:"btcd-paper-inp w-6 mt-1",onChange:v,name:"name",value:t.name,type:"text",placeholder:n("e.g. Marketing — work account"),disabled:o}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:l.name}),e.jsx("div",{className:"mt-3 wdt-200",children:e.jsx("b",{children:n("Access API URL:")})}),e.jsx("input",{"aria-label":"Access API URL",className:"btcd-paper-inp w-6 mt-1",onChange:v,name:"api_url",value:t.api_url,type:"text",placeholder:n("Access API URL..."),disabled:o}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:l.api_url}),e.jsx("div",{className:"mt-3 wdt-200",children:e.jsx("b",{children:n("Access API Key:")})}),e.jsx("input",{"aria-label":"Access API Key",className:"btcd-paper-inp w-6 mt-1",onChange:v,name:"api_key",value:t.api_key,type:"text",placeholder:n("Access API Key..."),disabled:o}),e.jsx("div",{style:{color:"red",fontSize:"15px"},children:l.api_key}),p==="auth"&&e.jsxs("div",{className:"flx mt-5",children:[e.jsx(L,{size:25,clr:"#022217",className:"mr-2"}),"Checking API Key!!!"]}),z&&!c&&!p&&e.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[e.jsx("span",{className:"mr-2",style:{fontSize:30,marginTop:-5},children:e.jsx(T,{size:"15"})}),"Sorry, API key is invalid"]}),!o&&e.jsxs(e.Fragment,{children:[e.jsx(U,{isAuthorized:c,handleAuthorize:N,isLoading:p}),e.jsx("br",{})]})]})]})}function $({formFields:t,setIntegration:a,integrations:i,allIntegURL:A}){const y=w(),{formID:o}=K(),[p,d]=r.useState(!1),[g,j]=r.useState(1),[f,c]=r.useState({show:!1}),[_,l]=r.useState({name:"Active Campaign API",type:"ActiveCampaign",api_url:"",api_key:"",field_map:[{formField:"",activeCampaignField:""}],actions:{}}),u=()=>{setTimeout(()=>{y(A)},1e3)};return e.jsxs("div",{children:[e.jsx(M,{snack:f,setSnackbar:c}),e.jsx(D,{formID:o,activeCampaingConf:_,setActiveCampaingConf:l,step:g,setstep:j,isLoading:p,setIsLoading:d,setSnackbar:c,allIntegURL:A,authorizedAction:u})]})}export{$ as default}; |