1import{a as w,b as D,r as m,j as e,$ as ie,T as a,ad as P,I as u,k,a7 as oe,a0 as le,ar as ce,M as V,F as de,a8 as M,V as me,B as v,U as ue,S as he,as as xe,ab as pe,e as fe,Q as ge,at as ye,l as j,P as H,c as S,au as ve,av as be,q as E,s as _,aw as q,w as je,ax as we,C as Ne,H as Ce}from"./index-Dayw3-GA.js";import{S as N}from"./Switch-C0V8cSYs.js";import{O as Se,F as Y,i as ke}from"./buster-sad-DV7Ey9X8.js";import{p as Ae}from"./pbCloneDeep-DGyRx7Le.js";import"./virtualExposes-LPRSDCRG.js";import"./virtual_mf-REMOTE_ENTRY_ID___mfe_internal__buster__assets35968757485_remoteEntry_js-BpKdap8h.js";import"./preload-helper-B-fPAXoJ.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},t=new s.Error().stack;t&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[t]="6bbccae2-c516-4923-bd0d-c3b051a97af6",s._sentryDebugIdIdentifier="sentry-dbid-6bbccae2-c516-4923-bd0d-c3b051a97af6")}catch{}})();function Ue(s,t){return[...s?[(l=>l?{id:l.id,name:l.name,displayName:l.displayName,notifyUsage:l.notifyUsage}:void 0)(s)]:[],...t??[]].filter(Boolean)}const Le=({setImportantError:s})=>{const{t}=w(),{currentOrg:d,orgs:p}=D(),l=Ue(d,p),[c,n]=m.useState(l);function r(f,h){n((g=[])=>g.map(x=>x.name===h?{...x,notifyUsage:f}:x))}return e.jsxs(ie,{className:"mb-2",children:[e.jsxs("div",{className:"mb-2 flex flex-wrap justify-between gap-2",children:[e.jsx(a,{variant:"heading",size:"M",component:"h3",children:t("Workspace notifications")}),e.jsx(P,{variant:"highlight",content:t("Use these toggles for workspace notifications. For phantom notifications, visit each Phantom's settings to manage them individually"),placement:"top",children:e.jsx(u,{className:"mr-1 text-icon-primary",name:"lightInfoCircle"})})]}),c.map(f=>e.jsx(Ee,{org:f,setImportantError:s,onChange:h=>r(h,f.name)}
1,f.id))]})},Ee=({onChange:s,org:t,setImportantError:d})=>{const p=k(Se),{t:l}=w(),{user:c}=D(),[n,r]=m.useState();async function f(h){const g=h.target.checked,x=h.target.dataset.orgName;if(!(!x||!c?.id))try{await p.save({name:x},{userId:c?.id,notifyUsage:g}),s(g),r({text:l("Settings saved"),orgName:x})}catch(b){oe(b)||(console.error("Could not save org user",b),le({level:"error",message:ce(b).message??"Could not save org user",exception:b}),d(!0))}}return m.useEffect(()=>{let h;return n?.text&&(h=setTimeout(()=>{r(void 0)},3e3)),()=>clearTimeout(h)},[n?.text]),e.jsxs("div",{className:"mb-2 flex",children:[e.jsx("div",{className:"mr-3 flex space-x-3",children:e.jsx("span",{className:"flex items-center",children:e.jsx(P,{visible:!!n&&n?.orgName===t?.name,variant:"highlight",content:n?.text??"",children:e.jsx("span",{children:e.jsx(N,{variant:"normal",id:`notification-checkbox-${t?.name}`,name:"notifyUsage",checked:t.notifyUsage??!1,onChange:f,"data-org-name":t?.name,onBlur:()=>r(void 0)})})})})}),e.jsx(a,{variant:"body",size:"L",component:"label",className:"break-all",children:t?.displayName})]})};function Me({onConfirm:s,onClose:t,accountDeletionUnhandledErrorMessage:d=null,isLoading:p=!1,analyticsId:l="accountDeletion"}){const{t:c}=w(),[n,r]=m.useState(!1);return e.jsx(V,{open:!0,onClose:t,size:"M",variant:"fullImageHeader",headerBackground:"highlight-muted",parentAnalyticsId:`${l}Modal`,illustration:e.jsx(Y,{className:"h-20 w-20"}),align:{content:"center",buttons:"right"},hasMaxHeight:!1,title:e.jsx(a,{className:"text-heading-primary",variant:"heading",component:"h3",size:"M",children:c("Are you sure? This action is irreversible.")}),primaryAction:{label:c("Permanently delete"),onClick:s,isLoading:p,analyticsId:`${l}ConfirmAction`,variant:"dangerPrimary",isDisabled:!n,startIcon:e.jsx(u,{name:"lightTrashAlt"}),errorMessage:d},secondaryAction:{label:c("Cancel"),onClick:t,analyticsId:`${l}CancelAction`,variant:"secondary"},ignoreOutsideClick:!0,children:e.jsxs("div",{className:"mt-4 flex flex-col gap-4",children:[e.jsx("div",{className:"flex flex-col gap-4 text-center",children:e.jsx(a,{variant:"body",size:"XL",component:"p",className:"text-heading-primary",children:e.jsx(de,{i18nKey:"<1>This action is irreversible and will permanently delete all your personal data and account information.</1> Do not proceed if any issue remains unresolved, as Support will lose access to such data once deletion is confirmed. Account deletion requires ending all active subscriptions. Access to the service will end immediately, and any unused paid periods are forfeited without refund, except as permitted under our <2>refund policy</2>. Certain limited information may be retained for legal or administrative reasons as per Article 12.3 of GDPR. By confirming, you understand that deleting your account is your own choice and that your subscription will end as part of this process.",components:{1:e.jsx("strong",{}),2:e.jsx(M,{as:"anchor",variant:"primary-xl",href:"https://support.phantombuster.com/hc/en-us/articles/14947032957842-PhantomBuster-Refund-Policy",target:"_blank",rel:"noopener noreferrer",className:"underline",analyticsid:`${l}RefundPolicyLink`})}})})}),e.jsx("div",{className:"flex w-full flex-row items-start gap-2",children:e.jsx(me,{id:"confirmAccountDeletion",name:"confirmAccountDeletion",label:c("I confirm that deleting my account will immediately end my subscription and permanently erase my personal data and account information, except for data retained for legal or administrative reasons."),onChange:f=>r(f.target.checked),analyticsid:`${l}ConfirmationCheckbox`,required:!0})})]})})}function De({accountDeletionPreconditionError:s,onClose:t,onRetry:d,accountDeletionUnhandledErrorMessage:p=null,isLoading:l=!1,analyticsId:c="accountDeletionErrors"}){const{t:n}=w();return e.jsx(V,{open:!0,onClose:t,size:"M",variant:"fullImageHeader",headerBackground:"highlight-muted",parentAnalyticsId:`${c}Modal`,illustration:e.jsx(Y,{className:"h-20 w-20"}),align:{content:"left",buttons:"right"},hasMaxHeight:!1,title:e.jsx(a,{className:"text-heading-primary",variant:"heading",component:"h3",size:"M",children:n("First, let us check if you're good to go...")}),primaryAction:{label:n("Retry"),onClick:d,analyticsId:`${c}RetryAction`,variant:"primary",startIcon:e.jsx(u,{name:"lightSync"}),isLoading:l,errorMessage:p},secondaryAction:{label:n("Cancel"),onClick:t,analyticsId:`${c}CancelAction`,variant:"secondary"},ignoreOutsideClick:!0,children:s.details.errorKey==="workspaceHasMultipleUsers"?e.jsxs("div",{className:"mt-4 flex flex-row gap-2",children:[e.jsx("div",{className:"flex flex-col",children:e.jsx(u,{name:"lightExclamationCircle",className:"mt-1 h-5.5 w-5.5 shrink-0 rounded-full bg-error-light text-icon-error"})}),e.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx(a,{variant:"body",
1size:"L",component:"p",className:"text-body-primary",bold:!0,children:s.details.nonOwnerUsersCount?n("You still have {{count}} members in the workspace {{orgName}}",{count:s.details.nonOwnerUsersCount,orgName:s.details.orgs[0].name}):n("You still have members in the workspace {{orgName}}",{orgName:s.details.orgs[0].name})}),e.jsx(a,{variant:"body",size:"L",component:"p",className:"text-body-primary",children:n("PhantomBuster canât delete your account if you have members in a workspace you own. Remove all members from the workspace before deleting your account")})]}),e.jsx(v,{type:"button",startIcon:e.jsx(u,{name:"lightArrowUpRightFromSquare"}),variant:"secondary",onClick:()=>{window.open(`/${s.details.orgs[0].slug}/workspace-settings#users?autoExpandFirstNonOwner=true`,"_blank")},analyticsid:`${c}RedirectToMembers`,className:"self-start",children:n("Remove users from the workspace")})]})]}):s.details.errorKey==="workspaceHasActiveSubscription"?e.jsxs("div",{className:"mt-4 flex flex-row gap-2",children:[e.jsx("div",{className:"flex flex-col",children:e.jsx(u,{name:"lightExclamationCircle",className:"mt-1 h-5.5 w-5.5 shrink-0 rounded-full bg-error-light text-icon-error"})}),e.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx(a,{variant:"body",size:"L",component:"p",className:"text-body-primary",bold:!0,children:n("Active subscription")}),e.jsx(a,{variant:"body",size:"L",component:"p",className:"text-body-primary",children:n("You still have an active subscription. Please cancel your subscription before deleting your account.")})]}),e.jsx(v,{type:"button",startIcon:e.jsx(u,{name:"lightArrowUpRightFromSquare"}),variant:"secondary",onClick:()=>{window.open(`/${s.details.orgs[0].slug}/billing`,"_blank")},analyticsid:`${c}RedirectToSubscriptions`,className:"self-start",children:n("Manage subscription")})]})]}):e.jsx(e.Fragment,{children:s.details.orgs.map(r=>e.jsxs("div",{className:"mt-4 flex flex-row gap-2",children:[e.jsx("div",{className:"flex flex-col",children:e.jsx(u,{name:"lightExclamationCircle",className:"mt-1 h-5.5 w-5.5 shrink-0 rounded-full bg-error-light text-icon-error"})}),e.jsxs("div",{className:"flex flex-col gap-2 text-left",children:[e.jsxs("div",{className:"flex flex-col text-left",children:[e.jsx(a,{variant:"body",size:"L",component:"p",className:"text-body-primary",bold:!0,children:n("You're still a member of the shared workspace {{orgName}}",{orgName:r.name})}),e.jsx(a,{variant:"body",size:"L",component:"p",className:"text-body-primary",children:n("PhantomBuster can't delete your account if you're still a member of a shared workspace. Leave all shared workspaces you've been invited to, and delete any shared workspaces you've created before deleting your account.")})]}),e.jsx(v,{type:"button",startIcon:e.jsx(u,{name:"lightArrowUpRightFromSquare"}),variant:"secondary",onClick:()=>{window.open(`/${r.slug}/workspace-settings#users`,"_blank")},analyticsid:`${c}RedirectToMembers`,className:"self-start",children:n("Leave shared workspace")})]})]},r.slug))})})}function Pe(){const{t:s}=w(),t=D(),{refetchCurrentUser:d}=je(),p=k(ue),l=k(he),c=k(xe),n=pe("chat"),r=Ae(t.user),[f,h]=m.useState(!1),[g,x]=m.useState(null),[b,I]=m.useState(!1),[z,W]=m.useState(!0),[T,X]=m.useState(!0),[K,A]=m.useState(!1),[B,R]=m.useState(!1),[O,F]=m.useState(null),[$,C]=m.useState(null);async function G(i){i.preventDefault(),h(!0);try{const o=new FormData(i.currentTarget),y=new Set(r?.enabledExperiments??[]);o.get("betaFeatures")!==null?y.add("seeBetaPhantoms"):y.delete("seeBetaPhantoms"),o.get("chatSettings")!==null?y.add("advancedChat"):y.delete("advancedChat"),await p.updateMe({firstName:o.get("firstName"),lastName:o.get("lastName"),phone:o.get("phone"),company:o.get("company"),job:o.get("job"),newsletter:o.get("newsletter")!==null,developerMode:o.get("developerMode")!==null,enabledExperiments:[...y]}),await d(),x(null),I(!0)}catch(o){if(o instanceof E)return;console.error("Could not update user",o),x(o instanceof _?o.message:"Network Error")}finally{h(!1)}}async function Q(){if(window.confirm(s("Are you sure? You are about to end your active PhantomBuster sessions. You'll have to log in again to access your PhantomBuster account.")))try{await l.logoutFromAll(),await d()}catch(i){if(i instanceof E)return;console.error("Could not logout user",i),x(i instanceof _?i.message:"Network Error")}}function J(){W(i=>!i)}function Z(){X(i=>!i)}function ee(){x(null),I(!1)}function se(){A(!0)}function U(){A(!1),F(null),C(null)}function ae(i,o){const y=we(i.name),ne=typeof i.planShouldCancelAt=="number"&&i.planShouldCancelAt>Date.now(),re=o.details.errorKey==="workspaceHasActiveSubscription"&&o.details.orgs.length===1;return y&&ne&&re}async function te(i){try{return await c.terminateSubscriptionPendingCancellation({id:i}
1,{reason:"Account deletion by user"}),L()}catch(o){console.error("Could not terminate personal org's subscription pending cancellation",o),q(o)&&C(o.message)}}async function L(){try{R(!0),await p.deleteMe(),U(),window.location.href="/login?deleted=account"}catch(i){if(i instanceof E)return;if(console.error("Could not delete account",i),C(null),ke(i)){if(t.currentOrg&&ae(t.currentOrg,i))return te(t.currentOrg.id);A(!1),F(i)}else q(i)&&C(i.message)}finally{R(!1)}}return r?e.jsxs("form",{className:"flex flex-col rounded-1.5 bg-base p-4 shadow-modal",onSubmit:G,children:[e.jsxs("div",{className:"flex flex-col space-y-2",children:[e.jsx(a,{variant:"heading",component:"h2",size:"M",children:s("Login information")}),e.jsxs("div",{className:"flex flex-col space-y-2 sm:flex-row sm:space-x-2 sm:space-y-0",children:[e.jsxs("div",{className:"flex grow flex-col space-y-1",children:[e.jsx("div",{className:"grow",children:e.jsx(j,{label:s("Email"),name:"email",defaultValue:r.email,required:!0,disabled:!0})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(M,{as:"Link",analyticsid:"userSettingsChangeEmailBtn",to:H.changeEmail,children:s("Change email address")})})]}),e.jsxs("div",{className:"flex grow flex-col space-y-1",children:[e.jsx("div",{className:"grow",children:e.jsx(j,{label:s("Password"),name:"password",defaultValue:"*".repeat(8),type:"password",required:!0,disabled:!0,endIcon:"lightChevronDown"})}),e.jsx("div",{className:"flex justify-end",children:e.jsx(M,{as:"Link",analyticsid:"userSettingsChangePasswordBtn",to:H.changePassword,children:s("Change password")})})]})]})]}),e.jsxs("div",{className:"mt-4 flex flex-col sm:mt-4.5",children:[e.jsx(a,{variant:"heading",component:"h2",size:"M",children:s("General information")}),e.jsxs("div",{className:"mt-2 flex flex-col space-y-2 sm:flex-row sm:space-x-2 sm:space-y-0",children:[e.jsx("div",{className:"grow",children:e.jsx(j,{label:s("First name"),name:"firstName",placeholder:s("First name"),defaultValue:r.firstName,required:!0})}),e.jsx("div",{className:"grow",children:e.jsx(j,{label:s("Last name"),name:"lastName",placeholder:s("Last name"),defaultValue:r.lastName,required:!0})})]}),e.jsxs("div",{className:"mt-2 flex flex-col space-y-2 sm:flex-row sm:space-x-2 sm:space-y-0",children:[e.jsx("div",{className:"grow",children:e.jsx(j,{label:s("Phone number"),name:"phone",placeholder:s("Phone number"),defaultValue:r.phone||""})}),e.jsx("div",{className:"grow",children:e.jsx(j,{label:s("Company"),name:"company",placeholder:s("Company"),defaultValue:r.company||""})})]})]}),e.jsxs("div",{className:"mt-4 flex flex-col items-start",children:[e.jsxs("div",{className:"flex cursor-pointer select-none",onClick:J,analyticsid:"userSettingsAdvancedSettingsToggle",analyticsval1:r.id,children:[e.jsx(a,{variant:"heading",component:"span",size:"S",children:s("Advanced settings")}),e.jsx(u,{className:S("ml-1.5 text-icon-l text-icon-primary transition-transform",!z&&"rotate-180"),name:"solidAngleDown"})]}),e.jsxs("div",{className:S("mt-3 flex w-full flex-col space-y-2 transition-all",z&&"hidden"),children:[e.jsxs("div",{className:"flex items-center gap-2 rounded-1.5 border border-primary p-2",children:[e.jsx(N,{variant:"normal",name:"developerMode",id:"developer-mode-switch",defaultChecked:r?.developerMode??!1}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsx(a,{variant:"heading",component:"h3",size:"XS",children:s("Developer mode")}),e.jsx(a,{variant:"body",size:"L",component:"span",className:"text-body-secondary",children:s("Add advanced, developer-specific options across the website.")})]})]}),e.jsxs("div",{className:"flex items-center gap-2 rounded-1.5 border border-primary p-2",children:[e.jsx(N,{variant:"normal",name:"newsletter",id:"newsletter-switch",defaultChecked:r?.newsletter??!1}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsx(a,{variant:"heading",component:"h3",size:"XS",children:s("New feature email update")}),e.jsx(a,{variant:"body",size:"L",component:"span",className:"text-body-secondary",children:s("Stay up-to-date with our latest Phantoms & features. We promise not to spam you: your email will not be shared with any third party.")})]})]}),e.jsxs("div",{className:"flex items-center gap-2 rounded-1.5 border border-primary p-2",children:[e.jsx(N,{variant:"normal",name:"betaFeatures",id:"beta-features-switch",defaultChecked:!!r?.enabledExperiments?.includes("seeBetaPhantoms")}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsx(a,{variant:"heading",component:"h3",size:"XS",children:s("Beta features")}
1),e.jsx(a,{variant:"body",size:"L",component:"span",className:"text-body-secondary",children:s("See beta Phantoms, workflows and other exciting new features PhantomBuster is working on.")})]})]}),n&&e.jsxs("div",{className:"flex items-center gap-2 rounded-1.5 border border-primary p-2",children:[e.jsx(N,{variant:"normal",name:"chatSettings",id:"chat-settings-switch",defaultChecked:!!r?.enabledExperiments?.includes("advancedChat")}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[e.jsx(a,{variant:"heading",component:"h3",size:"XS",children:s("Chat settings")}),e.jsx(a,{variant:"body",size:"L",component:"span",className:"text-body-secondary",children:s("Enable custom AI chat instructions for you and your workspace.")})]})]})]})]}),e.jsxs("div",{className:"mt-4 flex flex-col items-start",children:[e.jsxs("div",{className:"flex cursor-pointer select-none",onClick:Z,analyticsid:"userSettingsActionsToggle",children:[e.jsx(a,{variant:"heading",component:"span",size:"S",children:s("Actions")}),e.jsx(u,{className:S("ml-1.5 text-icon-l text-icon-primary transition-transform",!T&&"rotate-180"),name:"solidAngleDown"})]}),e.jsxs("div",{className:S("mt-3 flex w-full flex-col space-y-2 transition-all",T&&"hidden"),children:[r.isEmailValidated&&e.jsxs("div",{className:"flex items-center justify-between rounded-1.5 border border-primary p-3",children:[e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx(a,{variant:"heading",component:"h3",size:"S",children:s("Create a new workspace")}),e.jsx(a,{variant:"body",size:"L",component:"span",className:"text-body-secondary",children:s("Create a new workspace to share with your team.")})]}),e.jsx(v,{type:"button",analyticsid:"userSettingsCreateOrgLink",variant:"primary",onClick:()=>ve.open(be,{}),startIcon:e.jsx(u,{name:"lightPlus"}),children:s("New workspace")})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-1.5 border border-primary p-3",children:[e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx(a,{variant:"heading",component:"h3",size:"S",children:s("Log out from all sessions")}),e.jsx(a,{variant:"body",size:"L",component:"span",className:"text-body-secondary",children:s("Log out your PhantomBuster account of all active sessions.")})]}),e.jsx(v,{type:"button",analyticsid:"userSettingsLogoutSessionsBtn",onClick:Q,variant:"danger",startIcon:e.jsx(u,{name:"lightLinkSlash"}),children:s("Log out")})]}),e.jsxs("div",{className:"flex items-center justify-between rounded-1.5 border border-primary p-3",children:[e.jsxs("div",{className:"flex flex-col space-y-1",children:[e.jsx(a,{variant:"heading",component:"h3",size:"S",children:s("Delete your account")}),e.jsxs(a,{variant:"body",size:"L",component:"span",className:"text-body-secondary",children:[s("Delete all your leads, data and account info permanently")," (",e.jsx("a",{href:"https://support.phantombuster.com/hc/en-us/articles/360017550480-How-to-Delete-your-PhantomBuster-Account-or-Workspaces",target:"_blank",rel:"noopener noreferrer",analyticsid:"userSettingsDeleteAccountLearnMoreLink",className:"text-heading-highlight",children:s("view details")}),")."]})]}),e.jsx(v,{type:"button",analyticsid:"userSettingsDeleteAccountBtn",onClick:se,variant:"danger",startIcon:e.jsx(u,{name:"lightTrashCan"}),children:s("Delete")})]})]}),K&&e.jsx(Me,{analyticsId:"userSettingsDeleteAccountConfirmation",onConfirm:L,onClose:U,isLoading:B,accountDeletionUnhandledErrorMessage:$}),O&&e.jsx(De,{analyticsId:"userSettingsDeleteAccountError",onRetry:L,onClose:U,accountDeletionPreconditionError:O,isLoading:B,accountDeletionUnhandledErrorMessage:$})]}),e.jsx("div",{className:"mt-4 flex flex-col space-y-1 sm:flex-row sm:justify-end sm:space-x-2 sm:space-y-0",children:e.jsx(P,{variant:g?"error":"highlight",content:g??s("Settings updated"),placement:"top",visible:!!g||b,hideOnClick:!0,onHidden:ee,children:e.jsx(v,{type:"submit",analyticsid:"userSettingsSubmitBtn",isLoading:f,variant:"primary",children:s("Save settings")})})})]}):e.jsx(fe,{to:ge({returnTo:ye()})})}function $e(){const{t:s}=w(),[t,d]=m.useState(!1);return t?e.jsx(Ne,{}):e.jsxs("div",{className:"container relative",children:[e.jsx(Ce,{title:s("User settings")}),e.jsx(a,{variant:"heading",component:"h1",size:"L",children:s("User settings")}),e.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:mt-4 xl:flex-row",children:[e.jsx("div",{className:"flex-[3_3_0%]",children:e.jsx(Pe,{})}),e.jsx("div",{className:"flex-[2_2_0%]",children:e.jsx(Le,{setImportantError:d})})]})]})}export{$e as default}; 2//# sourceMappingURL=index-pa_XP14c.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.