PluginProbe
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder / V_3.0.0
Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder vV_3.0.0
3.3.1 V-3.3.0 3.2.2 3.2.1 3.2.0 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 V3.0.3 V3.0.2 -3.0.1 V_3.0.0 1.1.1 1.1.8 1.2 1.3 1.4 1.4.18 1.5.2 1.9 2.0 2.10.0 2.10.1 All 138 releases
bit-form / assets / bf-507-88.js

bf-507-88.js in Bit Form – Contact Form, Payment Forms, Multi Step Forms, Calculator & Custom Form Builder V_3.0.0, at assets/bf-507-88.js

2 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 var U=Object.defineProperty;var C=Object.getOwnPropertySymbols;var E=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var F=(i,e,t)=>e in i?U(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,h=(i,e)=>{for(var t in e||(e={}))E.call(e,t)&&F(i,t,e[t]);if(C)for(var t of C(e))M.call(e,t)&&F(i,t,e[t]);return i};import{_ as c,ac as N,$ as j,c as _,z as q,cb as S,u as P,F as T,r as b,j as l,C as $}from"./main-294.js";import{t as z}from"./bf-582-82.js";import{a4 as O,a5 as L,a6 as V}from"./bf-813-81.js";const ee=(i,e,t,d,o,s,a,r,m)=>{let n=h({},e);if(a){const f=h({},r);f[i.target.name]="",m(h({},f))}switch(n[i.target.name]=i.target.value,i.target.name){case"listId":n=W(n,d,t,o,s);break}t(h({},n))},te=i=>!((i!=null&&i.address_field?i.address_field.filter(t=>!t.formField&&t.mailChimpAddressField&&t.required):[]).length>0),W=(i,e,t,d,o)=>{var a,r;const s=q(i);return s.field_map=[{formField:"",mailChimpField:""}],(r=(a=s==null?void 0:s.default)==null?void 0:a.fields)!=null&&r[i.listId]||(H(e,s,t,d,o),J(e,s,t,d,o)),s},ae=(i,e,t,d,o)=>{d(!0);const s={formID:i,clientId:e.clientId,clientSecret:e.clientSecret,tokenDetails:e.tokenDetails};_(s,"bitforms_mChimp_refresh_audience").then(a=>{if(a&&a.success){const r=h({},e);r.default||(r.default={}),a.data.audiencelist&&(r.default.audiencelist=a.data.audiencelist),a.data.tokenDetails&&(r.tokenDetails=a.data.tokenDetails),o({show:!0,msg:c("Audience list refreshed")}),t(h({},r))}else a&&a.data&&a.data.data||!a.success&&typeof a.data=="string"?o({show:!0,msg:S(c("Audience list refresh failed Cause: %s. please try again"),a.data.data||a.data)}):o({show:!0,msg:c("Audience list failed. please try again")});d(!1)}).catch(()=>d(!1))},H=(i,e,t,d,o)=>{d(!0);const s={formID:i,clientId:e.clientId,clientSecret:e.clientSecret,tokenDetails:e.tokenDetails,listId:e.listId};_(s,"bitforms_mChimp_refresh_tags").then(a=>{if(a&&a.success){const r=h({},e);a.data.audienceTags&&(r.default.audienceTags=a.data.audienceTags),o({show:!0,msg:c("Audience tags refreshed")}),t(h({},r))}else a&&a.data&&a.data.data||!a.success&&typeof a.data=="string"?o({show:!0,msg:S(c("Audience tags refresh failed Cause: %s. please try again"),a.data.data||a.data)}):o({show:!0,msg:c("Audience tags failed. please try again")});d(!1)}).catch(()=>d(!1))},J=(i,e,t,d,o)=>{const{listId:s}=e;if(!s)return;d(!0);const a={formID:i,listId:s,clientId:e.clientId,clientSecret:e.clientSecret,tokenDetails:e.tokenDetails};_(a,"bitforms_mChimp_refresh_fields").then(r=>{if(r&&r.success){const m=h({},e);r.data.audienceField&&(m.default.fields||(m.default.fields={}),m.default.fields[s]=r.data.audienceField),r.data.tokenDetails&&(m.tokenDetails=r.data.tokenDetails),o({show:!0,msg:c("Fields refreshed")}),t(h({},m))}else o({show:!0,msg:c("Fields refresh failed. please try again")});d(!1)}).catch(()=>d(!1))},ie=i=>{const e={},d=window.location.href.replace(`${window.opener.location.href}`,"").split("&");d&&d.forEach(o=>{const s=o.split("=");s[1]&&(e[s[0]]=s[1])}),localStorage.setItem(`__bitforms_${i}`,JSON.stringify(e)),window.close()},B=(i,e,t,d,o,s,a,r)=>{if(!t.clientId||!t.clientSecret){o({clientId:t.clientId?"":c("Client ID cann't be empty"),clientSecret:t.clientSecret?"":c("Secret key cann't be empty")});return}a(!0);const m=N(j),n=`https://login.mailchimp.com/oauth2/authorize?client_id=${t.clientId}&state=${encodeURIComponent(window.location.href)}/redirect&redirect_uri=${encodeURIComponent(m.oAuthRedirectURL)}&response_type=code`,f=window.open(n,i,"width=400,height=609,toolbar=off"),x=setInterval(()=>{if(f.closed){clearInterval(x);let p={},g=!1;const w=localStorage.getItem(`__bitforms_${i}`);if(w&&(g=!0,p=JSON.parse(w),localStorage.removeItem(`__bitforms_${i}`),p.code.search("#"))){const[u]=p.code.split("#");p.code=u}if(!p.code||p.error||!p||!g){const u=p.error?`Cause: ${p.error}`:"";r({show:!0,msg:`${c("Authorization failed")} ${u}. ${c("please try again")}`}),a(!1)}else{const u=h({},t);u.accountServer=p["accounts-server"],G(e,p,u,d,s,a,r)}}},500)},G=(i,e,t,d,o,s,a)=>{const r=N(j),m=h({},e);m.clientId=t.clientId,m.clientSecret=t.clientSecret,m.redirectURI=r.oAuthRedirectURL,_(m,`bitforms_${i}_generate_token`).then(n=>n).then(n=>{if(n&&n.success){const f=h({},t);f.tokenDetails=n.data,d(f),O(f),o(!0),a({show:!0,msg:c("Authorized Successfully")})}else n&&n.data&&n.data.data||!n.success&&typeof n.data=="string"?a({show:!0,msg:`${c("Authorization failed Cause:")}${n.data.data||n.data}. ${c("please try again")}`}):a({show:!0,msg:c("Authorization failed. please try again")});s(!1)})},se=i=>!((i.field_map?i.field_map.filter(t=>!t.formField&&!t.mailChimpField):[]).length>0);function K({formID:i,sheetConf:e,setSheetConf:t,step:d,setstep:o,isLoading:s,setisLoading:a,setSnackbar:r,redirectLocation:m,isInfo:n,allIntegURL:f,authorizedAction:x}){const p=P(j);T();const{siteURL:g,oAuthRedirectURL:w}=p,[u,D]=b.useState(!1),[y,R]=b.useState({dataCenter:"",clientId:"",clientSecret:""}),A=I=>{const k=h({},e),v=h({},y);v[I.target.name]="",k[I.target.name]=I.target.value,R(v),t(k)};return b.useEffect(()=>{u&&x()},[u]),l.jsxs(l.Fragment,{children:[l.jsx(L,{title:z.mailChimp.title,youTubeLink:z.mailChimp.link}),l.jsxs("div",{className:"btcd-stp-page",style:{width:900,height:"100%"},children:[l.jsx("div",{className:"mt-3",children:l.jsx("b",{children:c("Authorize App Name:")})}),l.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:A,name:"name",value:e.name,type:"text",placeholder:c("Authorize App Name..."),disabled:n}),l.jsx("div",{className:"mt-3",children:l.jsx("b",{children:c("Homepage URL:")})}),l.jsx($,{value:g,className:"field-key-cpy w-6 ml-0",readOnly:n}),l.jsx("div",{className:"mt-3",children:l.jsx("b",{children:c("Authorized Redirect URIs:")})}),l.jsx($,{value:m||`${w}`,className:"field-key-cpy w-6 ml-0",readOnly:n}),l.jsxs("small",{className:"d-blk mt-5",children:[c("To get Client ID and SECRET , Please Visit")," ",l.jsx("a",{className:"btcd-link",href:"https://us7.admin.mailchimp.com/account/oauth2/",target:"_blank",rel:"noreferrer",children:c("Mail Chimp API Console")})]}),l.jsx("div",{className:"mt-3",children:l.jsx("b",{children:c("Client id:")})}),l.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:A,name:"clientId",value:e.clientId,type:"text",placeholder:c("Client id..."),disabled:n}),l.jsx("div",{style:{color:"red",fontSize:"15px"},children:y.clientId}),l.jsx("div",{className:"mt-3",children:l.jsx("b",{children:c("Client secret:")})}),l.jsx("input",{className:"btcd-paper-inp w-6 mt-1",onChange:A,name:"clientSecret",value:e.clientSecret,type:"text",placeholder:c("Client secret..."),disabled:n}),l.jsx("div",{style:{color:"red",fontSize:"15px"},children:y.clientSecret}),!n&&l.jsxs(l.Fragment,{children:[l.jsx(V,{isAuthorized:u,isLoading:s,handleAuthorize:()=>B("mailChimp","mChimp",e,t,R,D,a,r)}),l.jsx("br",{})]})]})]})}var re=Object.freeze({__proto__:null,default:K});export{K as M,H as a,se as b,te as c,re as d,ee as h,ae as r,ie as s};
2