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