| 1 |
"use strict";(self.webpackChunk_bitforms=self.webpackChunk_bitforms||[]).push([[9421],{1078:(e,t,a)=>{a.d(t,{Rx:()=>n,hQ:()=>o,P_:()=>d});var i=a(7462),r=a(160),s=a(9492),l=a(5637),n=function(e,t,a,r,s,l,n,o){var d=(0,i.Z)({},t),c=e.target.name;""!==e.target.value?d[c]=e.target.value:delete d[c],a((0,i.Z)({},d))},o=function(e,t,a){var n;void 0===e&&(e=null);var o={formID:e,id:null!=(n=t.id)?n:null,apiKey:t.apiKey,apiSecret:t.apiSecret,tokenDetails:t.tokenDetails},d=(0,s.Z)(o,"bitforms_dropbox_get_all_folders").then((function(e){if(e&&e.success){var r=(0,i.Z)({},t);return e.data.dropboxFoldersList&&(r.foldersList=e.data.dropboxFoldersList,r.tokenDetails=e.data.tokenDetails),a(r),"Dropbox Folders List refreshed successfully"}return"Dropbox Folders List refresh failed. please try again"}));r.ZP.promise(d,{success:function(e){return e},error:(0,l.__)("Error Occurred","bitform"),loading:(0,l.__)("Loading Dropbox Folders List...","bitform")})},d=function(e,t,a,n){if(e.accessCode&&e.apiKey&&e.apiSecret){n(!0);var o={apiKey:e.apiKey,apiSecret:e.apiSecret,accessCode:e.accessCode};(0,s.Z)(o,"bitforms_dropbox_authorization").then((function(s){if(s&&s.success){var o=(0,i.Z)({},e);o.tokenDetails=s.data,t(o),a(!0),r.ZP.success((0,l.__)("Authorized Successfully","bitform"))}else s&&s.data&&s.data.data||!s.success&&"string"===typeof s.data?r.ZP.error(""+(0,l.__)("Authorization failed Cause: ","bitform")+(s.data.data||s.data)+". "+(0,l.__)("please try again","bitform")):r.ZP.error((0,l.__)("Authorization failed. please try again","bitform"));n(!1)}))}else r.ZP.error((0,l.__)("Dropbox ApiKey, ApiSecret & Access Code can't be empty","bitform"))}},5363:(e,t,a)=>{a.d(t,{Z:()=>m});var i=a(5637),r=a(7462),s=a(3921),l=a(5893);function n(e){var t,a=e.dropboxConf,n=e.setDropboxConf;return(0,l.jsx)("div",{className:"pos-rel d-flx w-8",children:(0,l.jsx)(s.Z,{checked:(null==(t=a.actions)?void 0:t.delete_from_wp)||!1,onChange:function(e){return function(e,t){var i=(0,r.Z)({},a);"deleteFile"===t&&(e.target.checked?i.actions.delete_from_wp=!0:delete i.actions.delete_from_wp),n((0,r.Z)({},i))}(e,"deleteFile")},className:"mt-4 mr-2",value:"delete_from_wp",title:(0,i.__)("Delete File From Wordpress","bitform"),subTitle:(0,i.__)("Delete file from Wordpress after upload in Dropbox","bitform")})})}var o=a(1078),d=function(e,t,a){var i=(0,r.Z)({},t);i.field_map.splice(e,0,{}),a((0,r.Z)({},i))};function c(e){var t=e.i,a=e.formFields,s=e.field,n=e.dropboxConf,o=e.setDropboxConf,c=function(e,t){var a=(0,r.Z)({},n);a.field_map[t][e.target.name]=e.target.value,o((0,r.Z)({},a))};return(0,l.jsx)("div",{className:"flx mt-2 mr-1",children:(0,l.jsxs)("div",{className:"pos-rel flx",children:[(0,l.jsxs)("div",{className:"flx integ-fld-wrp",children:[(0,l.jsxs)("select",{className:"btcd-paper-inp mr-2",name:"formField",value:s.formField||"",onChange:function(e){return c(e,t)},children:[(0,l.jsx)("option",{value:"",children:(0,i.__)("Select Field","bitform")}),null==a?void 0:a.filter((function(e){return"file-up"===e.type})).map((function(e){return(0,l.jsx)("option",{value:e.key,children:e.name},"ff-rm-"+e.key)}))]}),(0,l.jsxs)("select",{className:"btcd-paper-inp",name:"dropboxFormField",value:s.dropboxFormField,onChange:function(e){return c(e,t)},children:[(0,l.jsx)("option",{value:"",children:(0,i.__)("Select Folder","bitform")}),n.foldersList.map((function(e){var t=e.name,a=e.lower_path;return(0,l.jsx)("option",{value:a,children:t},a)}))]})]}),(0,l.jsx)("button",{onClick:function(){return d(t,n,o)},className:"icn-btn sh-sm ml-2 mr-1",type:"button",children:"+"}),(0,l.jsx)("button",{onClick:function(){return function(e,t,a){var i=(0,r.Z)({},t);i.field_map.length>1&&i.field_map.splice(e,1),a((0,r.Z)({},i))}(t,n,o)},className:"icn-btn sh-sm ml-1",type:"button","aria-label":"btn",children:(0,l.jsx)("span",{className:"btcd-icn icn-trash-2"})})]})})}function m(e){var t=e.formID,a=e.formFields,r=e.dropboxConf,s=e.setDropboxConf;e.isLoading,e.setIsLoading;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsxs)("div",{className:"mt-5",children:[(0,l.jsx)("b",{className:"wdt-100",children:(0,i.__)("Field Map","bitform")}),(0,l.jsx)("button",{onClick:function(){return(0,o.hQ)(t,r,s)},className:"icn-btn sh-sm ml-2 mr-2 tooltip",style:{"--tooltip-txt":"'"+(0,i.__)("Fetch All Dropbox Folders","bitform")+"'"},type:"button",children:"↻"})]}),(0,l.jsx)("div",{className:"btcd-hr mt-1"}),(0,l.jsxs)("div",{className:"flx flx-around mt-2 mb-1",children:[(0,l.jsx)("div",{className:"txt-dp",children:(0,l.jsx)("b",{children:(0,i.__)("File Input","bitform")})}),(0,l.jsx)("div",{className:"txt-dp",children:(0,l.jsx)("b",{children:(0,i.__)("Dropbox Folder","bitform")})})]}),null==r?void 0:r.field_map.map((function(e,t){return(0,l.jsx)(c,{i:t,field:e,formFields:a,dropboxConf:r,setDropboxConf:s},"rp-m-"+(t+9))})),(0,l.jsx)("div",{className:"txt-center mt-2",style:{marginRight:85},children:(0,l.jsx)("button",{onClick:function(){return d(r.field_map.length,r,s)},className:"icn-btn sh-sm",type:"button",children:"+"})}),(0,l.jsx)("br",{}),(0,l.jsx)("br",{}),(0,l.jsx)("div",{className:"mt-4",children:(0,l.jsx)("b",{className:"wdt-100",children:(0,i.__)("Actions","bitform")})}),(0,l.jsx)("div",{className:"btcd-hr mt-1"}),(0,l.jsx)(n,{dropboxConf:r,setDropboxConf:s})]})}},9421:(e,t,a)=>{a.r(t),a.d(t,{default:()=>p});var i=a(7462),r=a(7294),s=a(5256),l=a(5637),n=a(5001),o=a(4383),d=a(5813),c=a(1078),m=a(5363),f=a(5893);const p=function(e){var t=e.allIntegURL,a=e.formFields,p=e.integrations,u=e.setIntegration,b=(0,s.k6)(),_=(0,s.UO)(),x=_.id,h=_.formID,v=(0,r.useState)((0,i.Z)({},p[x])),g=v[0],j=v[1],Z=(0,r.useState)(!1),N=Z[0],y=Z[1],C=(0,r.useState)({show:!1}),F=C[0],w=C[1];return(0,f.jsxs)("div",{style:{width:900},children:[(0,f.jsx)(n.Z,{snack:F,setSnackbar:w}),(0,f.jsxs)("div",{className:"flx mt-3",children:[(0,f.jsx)("b",{className:"wdt-200 d-in-b",children:(0,l.__)("Integration Name:","bitform")}),(0,f.jsx)("input",{className:"btcd-paper-inp w-5",onChange:function(e){return(0,c.Rx)(e,g,j)},name:"name",value:g.name,type:"text",placeholder:(0,l.__)("Integration Name...","bitform")})]}),(0,f.jsx)("br",{}),(0,f.jsx)("br",{}),(0,f.jsx)(m.Z,{formID:h,formFields:a,dropboxConf:g,setDropboxConf:j,isLoading:N,setIsLoading:y}),(0,f.jsx)(d.Z,{edit:!0,saveConfig:function(){(0,o.Mm)(p,u,t,g,b,x,1)},disabled:g.field_map.length<1,isLoading:N}),(0,f.jsx)("br",{})]})}},4383:(e,t,a)=>{a.d(t,{Mm:()=>r,WK:()=>s,FP:()=>l,T5:()=>n,wX:()=>o,mG:()=>d});var i=a(7462),r=(a(5637),a(9492),function(e,t,a,r,s,l,n){var o=[].concat(e);if(n)o[l]=(0,i.Z)({},e[l],r),o.push({editItegration:!0}),t([].concat(o)),s.push(a);else{var d=[].concat(o);d.push(r),d.push({newItegration:!0}),t(d),s.push(a)}}),s=function(e){var t={},a=window.location.href.replace(window.opener.location.href+"/redirect","").split("&");a&&a.forEach((function(e){var a=e.split("=");a[1]&&(t[a[0]]=a[1])})),localStorage.setItem("__bitforms_"+e,JSON.stringify(t)),window.close()},l=function(e,t,a,r,s){var l=(0,i.Z)({},t);s?r?l.relatedlists[s-1].upload_field_map.splice(e,0,{}):l.relatedlists[s-1].field_map.splice(e,0,{}):r?l.upload_field_map.splice(e,0,{}):l.field_map.splice(e,0,{}),a((0,i.Z)({},l))},n=function(e,t,a,r,s){var l=(0,i.Z)({},t);s?r?l.relatedlists[s-1].upload_field_map.length>1&&l.relatedlists[s-1].upload_field_map.splice(e,1):l.relatedlists[s-1].field_map.length>1&&l.relatedlists[s-1].field_map.splice(e,1):r?l.upload_field_map.length>1&&l.upload_field_map.splice(e,1):l.field_map.length>1&&l.field_map.splice(e,1),a((0,i.Z)({},l))},o=function(e,t,a,r,s,l){var n=(0,i.Z)({},a);l?s?n.relatedlists[l-1].upload_field_map[t][e.target.name]=e.target.value:n.relatedlists[l-1].field_map[t][e.target.name]=e.target.value:s?n.upload_field_map[t][e.target.name]=e.target.value:n.field_map[t][e.target.name]=e.target.value,"custom"===e.target.value&&(l?n.relatedlists[l-1].field_map[t].customValue="":n.field_map[t].customValue=""),r((0,i.Z)({},n))},d=function(e,t,a,r,s){var l=(0,i.Z)({},a);s?l.relatedlists[s-1].field_map[t].customValue=e.target.value:l.field_map[t].customValue=e.target.value,r((0,i.Z)({},l))}},5813:(e,t,a)=>{a.d(t,{Z:()=>s});var i=a(5637),r=a(5893);function s(e){var t=e.step,a=e.saveConfig,s=e.edit,l=e.disabled;return s?(0,r.jsx)("div",{className:"txt-center w-9 mt-3",children:(0,r.jsx)("button",{onClick:a,id:"secondary-update-btn",className:"btn btcd-btn-lg green sh-sm flx",type:"button",disabled:l,children:(0,i.__)("Save","bitform")})}):(0,r.jsxs)("div",{className:"btcd-stp-page txt-center",style:{width:3===t&&"90%",height:3===t&&"100%"},children:[(0,r.jsx)("h2",{className:"ml-3",children:(0,i.__)("Successfully Integrated","bitform")}),(0,r.jsxs)("button",{onClick:a,id:"secondary-update-btn",className:"btn btcd-btn-lg green sh-sm",type:"button",children:[(0,i.__)("Finish & Save ","bitform")," ✔"]})]})}}}]); |