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