var C=Object.defineProperty,I=Object.defineProperties;var M=Object.getOwnPropertyDescriptors;var f=Object.getOwnPropertySymbols;var P=Object.prototype.hasOwnProperty,E=Object.prototype.propertyIsEnumerable;var j=(n,s,a)=>s in n?C(n,s,{enumerable:!0,configurable:!0,writable:!0,value:a}):n[s]=a,p=(n,s)=>{for(var a in s||(s={}))P.call(s,a)&&j(n,a,s[a]);if(f)for(var a of f(s))E.call(s,a)&&j(n,a,s[a]);return n},v=(n,s)=>I(n,M(s));import{h as y,$ as B,k as w,f as z,i as D,g as H,j as e,_ as o}from"./main.2.9.0.js";import{u as K,b as g}from"./react-router.DMwpH23k.js";import"./CopyIcn.CEA_lFLo.js";import{S as q,C as G,s as J}from"./Integrations.DL8wqGct.js";import{a9 as O,y as Q}from"./Note.NSUdvR3c.js";import{c as k,g as V}from"./ProUtilHelpers.CHf_DzPf.js";import{S as W}from"./SnackMsg.DYSD96P4.js";import{b as X}from"./Table.BfF8RYFZ.js";import{T as Y}from"./TutorialLink.CFG7bS5c.js";import{g as F,i as Z,a as ee,r as te,U as ie,C as se,R as ae,c as ne}from"./UserMetaField.DPhVCG7I.js";import"./react-vendor.P7K3d6op.js";import"./index.DpWdl9V1.js";import"./TagifyInput.KPPRQJ1B.js";import"./lodash.DCvQBX3r.js";function we({allIntegURL:n}){var x,_;const s=K(),[a,d]=g.useState({show:!1}),[u,N]=g.useState(!1),[h,A]=y(B),{isPro:b}=w(z),m=w(D),[t,c]=y(H);g.useEffect(()=>{var l,r;const i=p({},t);i.action_type||(i.action_type="new_user"),(r=(l=i==null?void 0:i.user_map)==null?void 0:l[0])!=null&&r.userField||(i.user_map=F(i.action_type)),c(i)},[]);const R=i=>{const l=i||"new_user";c(r=>v(p({},r),{action_type:l,user_map:F(l)}))},S=Z(t==null?void 0:t.action_type),U=ee((t==null?void 0:t.action_type)||"new_user"),L=()=>{if(!t.action_type){d({show:!0,msg:o("Please select action type","bit-integrations")});return}if(t.action_type==="new_user"&&!t.user_role){d({show:!0,msg:o("User Role can't be empty","bit-integrations")});return}if(!ne(t)&&t.action_type!=="updated_user"){d({show:!0,msg:o("Please map mandatory fields","bit-integrations")});return}J({flow:h,setFlow:A,allIntegURL:n,conf:t,navigate:s,edit:1,setIsLoading:N,setSnackbar:d})},$=(i,l)=>{const r=p({},t);l?r.condition.action_behavior=i:r.condition.action_behavior="",c(r)},T=i=>{i.target.value&&R(i.target.value)};return e.jsxs("div",{style:{width:900},children:[e.jsx(W,{snack:a,setSnackbar:d}),e.jsx(Y,{linkKey:"registration"}),e.jsx("br",{}),e.jsx("br",{}),e.jsx(q,{entity:h.triggered_entity,setSnackbar:d}),e.jsxs("div",{className:"flx mt-3",children:[e.jsx("div",{className:"wdt-200 d-in-b",children:e.jsx("b",{children:o("Action type","bit-integrations")})}),e.jsxs("select",{className:"btcd-paper-inp w-5",value:(t==null?void 0:t.action_type)||"new_user",onChange:T,children:[e.jsx("option",{value:"",children:o("Select Action","bit-integrations")}),te.map(i=>e.jsx("option",{value:i.value,disabled:!k(b,i.is_pro),children:k(b,i.is_pro)?i.label:V(i.label)},i.value))]})]}),e.jsx("br",{}),e.jsx("br",{}),e.jsxs("div",{children:[e.jsx(ie,{formFields:m,userConf:t,setUserConf:c,userFields:U}),e.jsx("br",{})]}),S&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{children:[e.jsx(se,{formFields:m,userConf:t,setUserConf:c}),e.jsx("br",{})]}),e.jsx("div",{className:"mt-4",children:e.jsx("b",{className:"wdt-100",children:o("Utilities","bit-integrations")})}),e.jsx("div",{className:"btcd-hr mt-1"}),e.jsx(ae,{userConf:t,setUserConf:c}),e.jsx("br",{}),e.jsx(O,{note:(t==null?void 0:t.action_type)==="updated_user"?oe:re})]}),(t==null?void 0:t.condition)&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flx",children:e.jsx(X,{onChange:i=>$(i.target.value,i.target.checked),checked:((x=t==null?void 0:t.condition)==null?void 0:x.action_behavior)==="cond",className:"wdt-200 mt-4 mr-2",value:"cond",title:o("Conditional Logics","bit_integration")})}),e.jsx("br",{}),((_=t==null?void 0:t.condition)==null?void 0:_.action_behavior)==="cond"&&e.jsx(G,{formFields:m,dataConf:t,setDataConf:c})]}),e.jsxs("button",{className:"btn f-left btcd-btn-lg purple sh-sm flx",type:"button",onClick:L,disabled:u,children:[o("Update","bit-integrations"),u&&e.jsx(Q,{size:20,clr:"#022217",className:"ml-2"})]})]})}const oe=`
  <ul>
  <li>${o("The user must be logged in when updating profile","bit-integrations")}</li>
  <li>${o("The user cannot change the value of the username field when updating the user profile.","bit-integrations")}</li>
     
  </ul>`,re=`
  <ul>
  <li>${o("If the Username and Password fields are blank then the user will take the value of the email field as the field and the password will be auto-generated.","bit-integrations")}</li>  
  </ul>`;export{we as default};
