var I=Object.defineProperty;var g=Object.getOwnPropertySymbols;var k=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var p=(a,e,s)=>e in a?I(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s,l=(a,e)=>{for(var s in e||(e={}))k.call(e,s)&&p(a,s,e[s]);if(g)for(var s of g(e))E.call(e,s)&&p(a,s,e[s]);return a};import{j as t,_ as r,s as P,b as F}from"./main.2.9.0.js";import{b as i}from"./react-router.DMwpH23k.js";import{y as L}from"./Note.NSUdvR3c.js";import{B as M}from"./BackIcn._8Wofmn2.js";import{T as _}from"./TutorialLink.CFG7bS5c.js";import"./react-vendor.P7K3d6op.js";import"./CopyIcn.CEA_lFLo.js";function H({formID:a,wpCoursewareConf:e,setWPCoursewareConf:s,step:m,nextPage:f,setSnackbar:x,isInfo:u}){const[o,j]=i.useState(!1),[N,w]=i.useState({integrationName:""}),[C,y]=i.useState(!1),[c,d]=i.useState(!1),[S,v]=i.useState(!0);i.useEffect(()=>()=>{v(!1)},[]);const z=()=>{d("auth"),F({},"wpCourseware_authorize").then(n=>{S&&(n!=null&&n.success&&(j(!0),x({show:!0,msg:r("Connect Successfully","bit-integrations")})),y(!0),d(!1))})},A=n=>{const h=l({},e),b=l({},N);b[n.target.name]="",h[n.target.name]=n.target.value,w(b),s(h)};return t.jsx(t.Fragment,{children:t.jsxs("div",{className:"btcd-stp-page",style:{width:m===1&&900,height:m===1&&"auto"},children:[t.jsx(_,{linkKey:"wpCourseware"}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:r("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-5 mt-1",onChange:A,name:"name",value:e.name,type:"text",placeholder:r("Integration Name...","bit-integrations"),disabled:u}),C&&!o&&!c&&t.jsxs("div",{className:"flx mt-4",style:{color:"red"},children:[t.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),P(r("Please! First Install or Active %s Plugin","bit-integrations"),"WP Courseware")]}),!u&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:z,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:o||c,children:[o?r("Connected ✔","bit-integrations"):r("Connect to WP Courseware","bit-integrations"),c&&t.jsx(L,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>f(2),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!o,children:[r("Next","bit-integrations"),t.jsx(M,{className:"ml-1 rev-icn"})]})]})]})})}export{H as default};
