File: /var/www/html/wordpress/wp-content/plugins/bit-integrations/assets/bi.738.337.js
var T=Object.defineProperty;var j=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,k=Object.prototype.propertyIsEnumerable;var L=(a,n,s)=>n in a?T(a,n,{enumerable:!0,configurable:!0,writable:!0,value:s}):a[n]=s,S=(a,n)=>{for(var s in n||(n={}))N.call(n,s)&&L(a,s,n[s]);if(j)for(var s of j(n))k.call(n,s)&&L(a,s,n[s]);return a};import{r as u,j as t,u as y}from"./main-685.js";import{z as C,y as w}from"./bi.451.455.js";import{_ as m,s as I,c as M}from"./bi.878.0.js";import{S as z}from"./bi.674.13.js";import{S as A}from"./bi.347.1012.js";import{I as _,s as B}from"./bi.776.3.js";import{B as E}from"./bi.788.791.js";import{T as v,t as D}from"./bi.703.796.js";import{T as F,h as H}from"./bi.537.797.js";import"./bi.327.9.js";import"./bi.601.11.js";import"./bi.825.14.js";function P({tutorlmsConf:a,setTutorlmsConf:n,step:s,setStep:g,setSnackbar:b}){const[i,c]=u.useState(!1),[o,h]=u.useState(!1),[f,l]=u.useState(!1),{tutorlms:e}=D,d=()=>{h("auth"),M({},"tutor_authorize").then(r=>{r!=null&&r.success&&(c(!0),b({show:!0,msg:m("Connected with Tutor LMS Successfully","bit-integrations")})),h(!1),l(!0)})},x=r=>{const p=w(a);p[r.target.name]=r.target.value,n(p)};return t.jsxs("div",{className:"btcd-stp-page",style:{width:s===1&&900,height:s===1&&"auto"},children:[(e==null?void 0:e.youTubeLink)&&t.jsx(v,{title:"Tutor LMS",youTubeLink:e==null?void 0:e.youTubeLink}),(e==null?void 0:e.docLink)&&t.jsx(v,{title:"Tutor LMS",docLink:e==null?void 0:e.docLink}),t.jsx("div",{className:"mt-3",children:t.jsx("b",{children:m("Integration Name:","bit-integrations")})}),t.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:x,name:"name",value:a.name,type:"text",placeholder:m("Integration Name...","bit-integrations")}),o==="auth"&&t.jsxs("div",{className:"flx mt-5",children:[t.jsx(C,{size:25,clr:"#022217",className:"mr-2"}),"Checking if Tutor LMS is active!!!"]}),f&&!i&&!o&&t.jsxs("div",{className:"flx mt-5",style:{color:"red"},children:[t.jsx("span",{className:"btcd-icn mr-2",style:{fontSize:30,marginTop:-5},children:"×"}),I(m("%s plugin must be activated to integrate with Bit Integrations","bit-integrations"),"Tutor LMS")]}),!i&&t.jsx("button",{onClick:d,className:"btn btcd-btn-lg purple sh-sm flx mt-5",type:"button",children:m("Connect","bit-integrations")}),i&&t.jsxs("button",{onClick:()=>g(2),className:"btn btcd-btn-lg purple sh-sm flx mt-5",type:"button",disabled:!i,children:[m("Next","bit-integrations"),t.jsx(E,{className:"ml-1 rev-icn"})]})]})}function Z({formFields:a,setFlow:n,flow:s,allIntegURL:g}){const b=y(),[i,c]=u.useState(!1),[o,h]=u.useState(1),[f,l]=u.useState({show:!1}),[e,d]=u.useState({name:"Tutor LMS",type:"Tutor Lms",field_map:[{formField:"",tutorField:""}],actions:{},actionData:{}}),x=()=>{c(!0),B({flow:s,setFlow:n,allIntegURL:g,conf:e,navigate:b,setIsLoading:c,setSnackbar:l})},r=p=>{setTimeout(()=>{document.getElementById("btcd-settings-wrp").scrollTop=0},300),h(p)};return t.jsxs("div",{children:[t.jsx(z,{snack:f,setSnackbar:l}),t.jsx("div",{className:"txt-center mt-2",children:t.jsx(A,{step:3,active:o})}),t.jsx(P,{tutorlmsConf:e,setTutorlmsConf:d,step:o,setStep:h,isLoading:i,setIsLoading:c,setSnackbar:l}),t.jsxs("div",{className:"btcd-stp-page",style:S({},o===2&&{width:900,height:"auto",minHeight:o===2&&"260px",overflow:"visible"}),children:[t.jsx(F,{formFields:a,handleInput:p=>H(p,e,d,c,l),tutorlmsConf:e,setTutorlmsConf:d,isLoading:i,setIsLoading:c,setSnackbar:l}),t.jsxs("button",{onClick:()=>r(3),className:"btn f-right btcd-btn-lg purple sh-sm flx",type:"button",children:[m("Next","bit-integrations")," ",t.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})]}),t.jsx(_,{step:o,saveConfig:()=>x(),isLoading:i,dataConf:e,setDataConf:d,formFields:a})]})}export{Z as default};