1import{aF as i,aE as He,aR as Ee,aC as t,aG as D,aN as We,b9 as Ge,aH as Ke,cu as $e,aP as V,aQ as qe,b5 as Ye,cv as Qe,aD as ze,cj as Je,cw as Xe,bx as Ze,bV as et,by as b,c8 as K,bL as $,bK as fe,cx as me,cy as q,cz as tt,cf as ot,cs as at,cA as st,cm as it,c3 as nt,cB as lt,aV as rt,cC as dt,cD as ct,cE as E,bp as y,cF as A,cG as M,bi as ut,a_ as pt,cH as ft,cI as mt,cJ as Et,cK as gt,cL as At,cM as x,cN as h,cO as w}from"./index-BzJG125e.js";import{w as Dt}from"./withNav-CN5Eud0W.js";import{g as It,s as Pt,r as Lt,u as St,a as Tt,b as xt,c as ht,d as wt}from"./edit-profile-CMlm62jS.js";import{C as bt,D as yt}from"./delete-item-popup-DLiZNWga.js";import{d as Ct}from"./Settings-CObbd8iB.js";import{L as Ot}from"./LtLabelledSwitch-BFB154mx.js";import{A as Rt}from"./ArrowBack-BxYZKy9Q.js";import{u as kt}from"./useDismissableAlert-B4MZQIO_.js";import{d as vt}from"./aws-D25WchR8.js";import{u as Ft}from"./useChangeRequestedFields-SIXgSxJ1.js";import{g as _t}from"./fileTemplates-BmJ3HBuk.js";import{S as Mt}from"./Share-D9Lb88LI.js";import{V as Vt}from"./Visibility-FC735HUp.js";import"./LtTooltipText-DNJv5vzf.js";import"./Switch-o8G9A4xC.js";import"./CloseOutlined-BeOmGDTS.js";try{let g=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},o=new g.Error().stack;o&&(g._sentryDebugIds=g._sentryDebugIds||{},g._sentryDebugIds[o]="0527ae7a-c411-4e9f-9744-2fc27b02cf25",g._sentryDebugIdIdentifier="sentry-dbid-0527ae7a-c411-4e9f-9744-2fc27b02cf25")}catch{}const jt=({account:g,onSave:o,isLoading:C,onBackClick:P,profileDesign:f})=>{const[a,j]=i.useState({autoVCardDownload:g.autoVCardDownload||!1}),{t:r}=He(),{setIsUnsaved:n}=Ee();return t.jsxs(D,{display:"flex",flexDirection:"column",height:"100%",children:[t.jsxs(D,{px:2,py:.5,display:"flex",alignItems:"center",children:[t.jsx(We,{sx:{mr:2},onClick:P,children:t.jsx(Rt,{})}),r("profileSettings")]}),t.jsx(Ge,{}),t.jsxs(D,{flex:1,display:"flex",flexDirection:"column",children:[t.jsxs(D,{p:3,pr:5,children:[t.jsx(Ot,{fullWidth:!0,label:r("updateProfile.autoVCardDownload.title"),helperText:r("updateProfile.autoVCardDownload.helperText"),value:!!(f!=null&&f.autoVCardDownload||a!=null&&a.autoVCardDownload),onChange:()=>{j({...a,autoVCardDownload:!a.autoVCardDownload}),n(!0)},disabled:f==null?void 0:f.autoVCardDownload}),(f==null?void 0:f.autoVCardDownload)&&t.jsx(Ke,{severity:"info",sx:{mt:2},children:r("autoVCardDownloadGloballyActive")})]}),t.jsx(D,{flex:1}),t.jsx($e,{saveAction:{loading:C,onClick:()=>o(a)},onCancel:()=>P(),position:"sticky"})]})]})},Bt=()=>{var ne,le,re,de,ce,ue,pe;const{notifyInfo:g}=qe(),{t:o,activeLanguage:C}=Ye(),{notifyError:P,notifySuccess:f}=Qe(),{getAccessTokenSilently:a,logout:j}=ze(),{profileDesign:r}=Je(),{editRights:n}=Xe(),{isFeatureAllowed:Y}=Ze(),c=et(),ge=b(e=>e.editProfile.isLoading),Ae=b(e=>e.editProfile.linkTypes),l=b(e=>e.account),O=b(e=>e.account.links?e.account.links.sort((s,m)=>(s.order||0)-(m.order||0)):[]),Q=b(e=>e.editProfile.apiResponse),[De,Ie]=i.useState(!1),[Pe,R]=i.useState(!1),[u,B]=i.useState(),[Le,k]=i.useState(!1),[N,z]=i.useState(""),[Se,v]=i.useState(!1),{setIsUnsaved:Te}=Ee(),{changeRequestedFields:d}=Ft(),{config:L}=K($.REQUIRES_APPROVAL_LINK_TYPES),{config:J,loading:xe}=K($.DEFAULT_LINKS),{config:X,loading:he}=K($.DEFAULT_FILES);i.useEffect(()=>{window.scrollTo(0,0)},[]),i.useEffect(()=>{var e;(e=l.theme)!=null&&e.id&&c(It(a))},[l,c,a]);const we=e=>{B(e),R(!0)},Z=()=>{R(!1),z("link"),k(!0)},be=()=>{Q&&Q.isSuccess===!0&&De===!1&&(R(!1),Ie(!0),k(!1),c(wt()))},ye=i.useMemo(()=>(O==null?void 0:O.reduce((e,s)=>(s.order||0)>e?s.order||0:e,-1))||0,[O]),ee=n.allowSingleUserLinkTemplateSelection&&Y(fe.DATA_TEMPLATES),Ce=ee&&n.linkEditMode===me.DISALLOW,[Oe,Re]=i.useState([]),F=n.allowSingleUserFileTemplateSelection&&Y(fe.DATA_TEMPLATES),ke=F&&n.fileEditMode===q.DISALLOW;i.useEffect(()=>{F&&_t(a).then(Re).catch(()=>{})},[F,a]);const[p,ve]=i.useState(null),[Fe,_e]=i.useState(!0),te=i.useCallback((e=_e)=>{l.username&&(e(!0),tt(l.username,C,{includeEmptyBoxes:!0}).then(s=>{const{status:m,name:I,profile:T}=s;m===200&&I==="profile"&&ve(T),e(!1)}).catch(()=>e(!1)))},[l.username,C]);i.useEffect(()=>{l&&te()},[l,te]);const[Me,oe]=i.useState(!1),Ve=async e=>{oe(!0);try{await ft(e,a),c({type:mt.COMMON.UPDATEFIELD,field:"autoVCardDownload",value:e.autoVCardDownload}),Te(!1),v(!1),f(o("saved"))}catch(s){console.error(s),P(o("unexpectedError"))}finally{oe(!1)}},ae=i.useMemo(()=>[{icon:t.jsx(Ct,{}),label:o("profileSettings"),onClick:()=>v(!0)},{icon:t.jsx(ot,{}),label:o("shareProfile.text"),to:V.SHARE_PROFILE},{icon:t.jsx(at,{}),label:o("myCards"),to:V.NFC_CARDS}],[o]),je=r.autoVCardDownload||l.autoVCardDownload,U=((ne=p==null?void 0:p.forward)==null?void 0:ne.url)&&!((le=p==null?void 0:p.forward)!=null&&le.isVCard),Be=U?o("publicProfile.profileForced",{url:(re=p==null?void 0:p.forward)==null?void 0:re.url}):r.autoVCardDownload?o("publicProfile.profileForcedVCardGlobal"):l.autoVCardDownload?o("publicProfile.profileForcedVCard"):"",{AlertElement:se}=kt({title:o(U?"redirectionActivated":"vcardDownloadEnabled"),body:Be,useLocalStorage:!1,variant:"filled"}),H=i.useMemo(()=>t.jsx(st,{iconButtonProps:{"aria-label":o("ariaOpenSettings"),"aria-haspopup":"menu"},menuItems:ae}),[o,ae]),Ne=i.useMemo(()=>[{mobileOnly:!0,element:H}],[H]);it(Ne);const W=nt(),{openDialogIfUnsaved:ie}=lt(),[Ue,_]=i.useState(!1),S=async(e,s,m,I)=>{_(!0);try{(await Et(a,e||"",s,m)).data.isSuccess&&(await c(gt(a)),I==null||I()),await c(At(a,()=>j(),!0))}catch{P(o("error.uploadingImage"))}_(!1)},G=async(e,s,m,I)=>{_(!0);try{let T;e?T=await vt(`${s}/${l.username}`,e,a,s):T="",await S(T,s,m,I)}catch{P(o("error.uploadingImage"))}_(!1)};return t.jsxs(t.Fragment,{children:[t.jsx(rt,{sx:{pt:0,px:0},bottomActionBar:{customActionsPost:[{text:o("shareProfile.text"),asAnchor:V.SHARE_PROFILE,variant:"outlined",color:"primary",startIcon:t.jsx(Mt,{})},{text:o("preview"),asAnchor:`/${l.username}`,variant:"contained",startIcon:t.jsx(Vt,{}),"aria-label":o("ariaPreviewProfile")}]},children:!p&&Fe||xe||he?t.jsx(dt,{}):p?t.jsxs(D,{position:"relative",children:[(je||U)&&se&&t.jsx(D,{width:W?"70%":"100%",m:"auto",px:1,py:1,children:se}),t.jsx(ct,{profile:p,renderFooter:!1,suppressLeadGenPopupFlow:!0,onContactFormSubmit:async()=>(g(o("onlyPreview")),!0),editProps:{bannerImageEditProps:{approvalRequired:n.bannerImageEditMode===E.ON_APPROVAL,customElement:d!=null&&d.includes("bannerImage")?t.jsx(y,{sx:{ml:1,bgcolor:"white"},variant:"outlined",label:o("changeRequested"),color:"warning"}):void 0,account:l,profileDesign:r,editRightAllowed:n.bannerImageEditMode!==E.DISALLOW,onUpdateByFile:e=>G(e,"banner",A.DEFINED,()=>{x(a,w.PROFILE_EDIT,{type:h.BANNER})}
1),onUpdateByUrl:e=>S(e,"banner",A.DEFINED,()=>{x(a,w.PROFILE_EDIT,{type:h.BANNER})}),onResetToDefault:()=>S(null,"banner",A.DEFAULT)},profileImageEditProps:{approvalRequired:n.profileImageEditMode===E.ON_APPROVAL,customElement:d!=null&&d.includes("profileImage")?t.jsx(y,{sx:{ml:1},variant:"outlined",label:o("changeRequested"),color:"warning"}):void 0,account:l,profileDesign:r,editRightAllowed:n.profileImageEditMode!==E.DISALLOW,onUpdateByFile:e=>G(e,"profile",A.DEFINED,()=>{x(a,w.PROFILE_EDIT,{type:h.PROFILE_PICTURE})}),onResetToDefault:()=>S(null,"profile",A.DEFAULT)},logoImageEditProps:{approvalRequired:n.logoImageEditMode===E.ON_APPROVAL,customElement:d!=null&&d.includes("logoHeader")?t.jsx(y,{sx:{ml:1},variant:"outlined",label:o("changeRequested"),color:"warning"}):void 0,account:l,profileDesign:r,editRightAllowed:n.logoImageEditMode!==E.DISALLOW,onUpdateByFile:e=>G(e,"logoHeader",A.DEFINED,()=>{x(a,w.PROFILE_EDIT,{type:h.LOGO})}),onUpdateByUrl:e=>S(e,"logoHeader",A.DEFINED,()=>{x(a,w.PROFILE_EDIT,{type:h.LOGO})}),onResetToDefault:()=>S(null,"logoHeader",A.DEFAULT)},customBioTextEditProps:{isEdit:!0,editRightAllowed:n.detailsEditMode!==E.DISALLOW},contactDetailsBoxEditProps:{isEdit:!0,editRightAllowed:n.detailsEditMode!==E.DISALLOW},linksBoxEditProps:{labelAction:d!=null&&d.includes("link")?t.jsx(y,{sx:{ml:1},variant:"outlined",label:o("changeRequested"),color:"warning"}):void 0,linkTypes:Ae,linkTemplates:(de=l.theme)==null?void 0:de.themeLinkTypes.reduce((e,s)=>[...e,...s.linkTemplates||[]],[]),templateSelectionAllowed:ee,forceTemplateSelection:Ce,editRightAllowed:n.linkEditMode!==me.DISALLOW,onAdd:async e=>{c(Pt({...e,id:0,order:ye+10},a,s=>{x(a,w.PROFILE_EDIT,{type:h.LINK_ADD},null,s)}))},links:l.links||[],standardLinksBefore:r.themeLinksPosition===M.BEFORE?J||[]:void 0,standardLinksAfter:r.themeLinksPosition===M.AFTER?J||[]:void 0,genericWebsiteColor:r.genericWebsiteColor,defaultLinkId:l.defaultLinkId,onReorder:e=>c(Lt(e.map((s,m)=>({...s,order:10*m})),a)),onToggleDisplay:(e,s)=>c(St(e,s,a)),onToggleDefault:(e,s)=>c(Tt(e,l,s,a)),onDelete:e=>{B(e),Z()},onEdit:e=>we(e)},filesBoxEditProps:{editRightAllowed:n.fileEditMode!==q.DISALLOW,templateSelectionAllowed:F,forceTemplateSelection:ke,fileTemplates:Oe,requiresApproval:n.fileEditMode===q.ON_APPROVAL,labelAction:d!=null&&d.includes("file")?t.jsx(y,{sx:{ml:1},variant:"outlined",label:o("changeRequested"),color:"warning"}):void 0,files:l.files,standardFilesBefore:r.themeFilesPosition===M.BEFORE?X||[]:void 0,standardFilesAfter:r.themeFilesPosition===M.AFTER?X||[]:void 0,onReorder:e=>c(xt(e.map((s,m)=>({...s,order:10*m})),a)),onDelete:e=>{B(e),z("file"),k(!0)},onToggleDisplay:(e,s)=>c(ht(e,s,a)),genericFileBoxColor:r.fileBoxColor}}}),W&&t.jsx(D,{position:"absolute",top:"0.5rem",right:"0.5rem",children:H})]}):"Error"}),be(),Pe&&t.jsx(bt,{onCloseClick:()=>R(!1),onBackClick:()=>{},onDeleteClick:()=>Z(),item:u,mode:(ce=u==null?void 0:u.linkType)==null?void 0:ce.mode,genericWebsiteColor:r.genericWebsiteColor,requiresApproval:n.linkEditMode===E.ON_APPROVAL||(L==null?void 0:L.includes(((ue=u==null?void 0:u.linkType)==null?void 0:ue.uniqueId)||""))}),Le&&u&&t.jsx(yt,{onCloseClick:()=>k(!1),item:u,mode:N,requiresApproval:N==="link"?n.linkEditMode===E.ON_APPROVAL||(L==null?void 0:L.includes(((pe=u==null?void 0:u.linkType)==null?void 0:pe.uniqueId)||"")):N==="file"?n.fileEditMode===E.ON_APPROVAL:void 0}),(ge||Ue)&&t.jsx(ut,{}),t.jsx(pt,{PaperProps:{sx:{width:W?"75rem":"100%"}},open:!!Se,anchor:"right",onClose:()=>ie(()=>v(!1)),children:t.jsx(jt,{account:l,isLoading:Me,onBackClick:()=>ie(()=>v(!1)),onSave:Ve,profileDesign:r})})]})},oo=Dt(Bt,{tTitle:"editProfile"},{activeScreen:V.EDITPROFILE});export{oo as default}; 2//# sourceMappingURL=index-BLCLj72a.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.