var T=Object.defineProperty;var x=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,W=Object.prototype.propertyIsEnumerable;var f=(a,e,s)=>e in a?T(a,e,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[e]=s,m=(a,e)=>{for(var s in e||(e={}))E.call(e,s)&&f(a,s,e[s]);if(x)for(var s of x(e))W.call(e,s)&&f(a,s,e[s]);return a};import{r as o,j as t}from"./main-333.js";import{_ as r,L as C,b as F}from"./bi.636.93.js";import{B as M}from"./bi.429.767.js";import{T as j,t as _}from"./bi.318.783.js";function H({formID:a,wpCoursewareConf:e,setWPCoursewareConf:s,step:u,nextPage:p,setSnackbar:N,isInfo:d}){const[c,L]=o.useState(!1),[k,y]=o.useState({integrationName:""}),[S,v]=o.useState(!1),[l,h]=o.useState(!1),[z,A]=o.useState(!0),{wpCourseware:n}=_;o.useEffect(()=>()=>{A(!1)},[]);const I=()=>{h("auth"),F({},"wpCourseware_authorize").then(i=>{z&&(i!=null&&i.success&&(L(!0),N({show:!0,msg:r("Connect Successfully","bit-integrations")})),v(!0),h(!1))})},P=i=>{const b=m({},e),g=m({},k);g[i.target.name]="",b[i.target.name]=i.target.value,y(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:[(n==null?void 0:n.youTubeLink)&&t.jsx(j,{title:"WP Courseware",youTubeLink:n==null?void 0:n.youTubeLink}),(n==null?void 0:n.docLink)&&t.jsx(j,{title:"WP Courseware",docLink:n==null?void 0:n.docLink}),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:P,name:"name",value:e.name,type:"text",placeholder:r("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:"×"}),"Please! First Install or Active WP Courseware Plugin"]}),!d&&t.jsxs(t.Fragment,{children:[t.jsxs("button",{onClick:I,className:"btn btcd-btn-lg purple sh-sm flx",type:"button",disabled:c||l,children:[c?r("Connected ✔","bit-integrations"):r("Connect to WP Courseware","bit-integrations"),l&&t.jsx(C,{size:20,clr:"#022217",className:"ml-2"})]}),t.jsx("br",{}),t.jsxs("button",{onClick:()=>p(2),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",disabled:!c,children:[r("Next","bit-integrations"),t.jsx(M,{className:"ml-1 rev-icn"})]})]})]})})}export{H as default};
