var j=Object.defineProperty;var g=Object.getOwnPropertySymbols;var N=Object.prototype.hasOwnProperty,S=Object.prototype.propertyIsEnumerable;var f=(o,e,a)=>e in o?j(o,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):o[e]=a,d=(o,e)=>{for(var a in e||(e={}))N.call(e,a)&&f(o,a,e[a]);if(g)for(var a of g(e))S.call(e,a)&&f(o,a,e[a]);return o};import{_ as t,j as i}from"./main.2.8.1.js";import{u as q,h as w,d as r}from"./react-router-dom.9mCuUg3q.js";import"./Note.BeM7sN-p.js";import{S as G}from"./SnackMsg.S8DrwLlT.js";import{S as I}from"./Steps.1hz7v9Vj.js";import{s as _}from"./GoogleIntegrationHelpers.BGadhjz3.js";import{I as A,s as F}from"./Integrations.D2bgBas2.js";import L from"./GoogleContactsAuthorization.DE9NmshA.js";import{c as E}from"./GoogleContactsCommonFunc.Bmub4y1Z.js";import{G as z}from"./GoogleContactsIntegLayout.DYCsRiNI.js";import"./CopyIcn.3gZpHton.js";import"./Table.DAL7rcPQ.js";import"./index.wO-AxluA.js";import"./tutorialLinks.kMkIDzcD.js";import"./TutorialLink.BAFX--T3.js";import"./TagifyInput.Cu0YIRbG.js";import"./tagify.YxUZd8Ix.js";function tt({formFields:o,setFlow:e,flow:a,allIntegURL:k}){const y=q(),{flowID:p}=w(),[l,b]=r.useState(!1),[n,u]=r.useState(1),[h,c]=r.useState({show:!1}),x=[{key:"1",label:t("Create a contact","bit-integrations")},{key:"2",label:t("Update a contact","bit-integrations")}],C=[{key:"phoneNumber",label:t("Phone Number","bit-integrations"),required:!0},{key:"name",label:t("First Name","bit-integrations"),required:!0},{key:"lastName",label:t("Last Name","bit-integrations"),required:!0},{key:"biographies",label:t("Biographies","bit-integrations"),required:!1},{key:"nickname",label:t("Nickname","bit-integrations"),required:!1},{key:"city",label:t("City","bit-integrations"),required:!1},{key:"country",label:t("Country","bit-integrations"),required:!1},{key:"locations",label:t("Locations","bit-integrations"),required:!1},{key:"email",label:t("Email","bit-integrations"),required:!1},{key:"occupation",label:t("Occupation","bit-integrations"),required:!1},{key:"organization",label:t("Organization","bit-integrations"),required:!1}],[s,m]=r.useState({name:"Google Contacts",type:"Google Contacts",mainAction:"",clientId:"",clientSecret:"",field_map:[{formField:"",googleContactsFormField:""}],default:C,allActions:x,actions:{}});r.useEffect(()=>{window.opener&&_("googleContacts")},[]);const v=()=>{F({flow:a,setFlow:e,allIntegURL:k,conf:s,navigate:y,setIsLoading:b,setSnackbar:c})};return i.jsxs("div",{children:[i.jsx(G,{snack:h,setSnackbar:c}),i.jsx("div",{className:"txt-center mt-2",children:i.jsx(I,{step:3,active:n})}),i.jsx(L,{flowID:p,googleContactsConf:s,setGoogleContactsConf:m,step:n,setStep:u,isLoading:l,setIsLoading:b,setSnackbar:c}),i.jsx("div",{className:"btcd-stp-page",style:d({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:i.jsx(z,{flowID:p,formFields:o,googleContactsConf:s,setGoogleContactsConf:m})}),i.jsx(A,{step:n,saveConfig:()=>v(),isLoading:l,dataConf:s,setDataConf:m,formFields:o}),i.jsx("div",{className:"btcd-stp-page",style:d({},n===2&&{width:900,height:"auto",overflow:"visible"}),children:i.jsxs("button",{onClick:()=>u(3),disabled:!E(s==null?void 0:s.field_map)||s.mainAction===""||l,className:"btn ml-auto btcd-btn-lg purple sh-sm flx",type:"button",children:[t("Next","bit-integrations"),i.jsx("div",{className:"btcd-icn icn-arrow_back rev-icn d-in-b"})]})})]})}export{tt as default};
