PageSourceSearch

https://vidapeps.com/assets/AccountCompanyStart-CkdKdthi.js

js vidapeps.com collected 2026-10-04 08:09:34 UTC 7,652 bytes, 1 lines download raw bytes

1import{j as e,b as S}from"./vendor-query-CniT1WJL.js";import{f as x,u as z,be as k,F as A,G as F,V as y,L as r,I as o,bf as w,bc as L}from"./index-KjAD5lCC.js";import{u as P,A as T}from"./AddressFormFields-Byy1VLUa.js";import{r as m,L as D}from"./vendor-react-69GsFwrV.js";import{b as E,_ as q,a8 as h,g as R}from"./vendor-ui-Ad3ANzF6.js";import{A as B}from"./AccountNav-CGK2802V.js";import{A as V,b as g}from"./AccountSection-B7Ueu1lP.js";import"./vendor-forms-q6h4WU-p.js";const K=E("relative w-full rounded-lg border px-4 py-3 text-sm [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground [&>svg~*]:pl-7",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),v=m.forwardRef(({className:n,variant:s,...c},d)=>e.jsx("div",{ref:d,role:"alert",className:x(K({variant:s}),n),...c}));v.displayName="Alert";const f=m.forwardRef(({className:n,...s},c)=>e.jsx("h5",{ref:c,className:x("mb-1 font-medium leading-none tracking-tight",n),...s}));f.displayName="AlertTitle";const j=m.forwardRef(({className:n,...s},c)=>e.jsx("div",{ref:c,className:x("text-sm [&_p]:leading-relaxed",n),...s}));j.displayName="AlertDescription";function Q(n){if(n&&typeof n=="object"&&"data"in n){const s=n.data;if(s&&typeof s.error=="string")return s.error}return n instanceof Error&&n.message?n.message:"The company could not be started. Try again."}function J(){const{user:n}=z(),s=S(),c=m.useRef(crypto.randomUUID()),d=P(),[a,N]=m.useState(()=>({organizationName:"",organizationSlug:"",legalName:"",dbaName:"",contactName:[n?.firstName,n?.lastName].filter(Boolean).join(" "),contactEmail:n?.email??"",contactPhone:"",contactTitle:"",line1:"",line2:"",city:"",state:"",zip:"",alsoDefaultShipping:!0})),[p,b]=m.useState(null),l=k();function i(t){N(u=>({...u,...t}))}async function C(t){t.preventDefault(),!l.isPending&&await d.ensureResolvedForSubmit(a)&&l.mutate({data:{idempotencyKey:c.current,organizationName:a.organizationName.trim(),...a.organizationSlug.trim()?{organizationSlug:a.organizationSlug.trim()}:{},...a.legalName.trim()?{legalName:a.legalName.trim()}:{},...a.dbaName.trim()?{dbaName:a.dbaName.trim()}:{},primaryContact:{...a.contactName.trim()?{name:a.contactName.trim()}:{},...a.contactEmail.trim()?{email:a.contactEmail.trim()}:{},...a.contactPhone.trim()?{phone:a.contactPhone.trim()}:{},...a.contactTitle.trim()?{title:a.contactTitle.trim()}:{}},billingAddress:{line1:a.line1.trim(),...a.line2.trim()?{line2:a.line2.trim()}:{},city:a.city.trim(),state:a.state,zip:a.zip.trim(),alsoDefaultShipping:a.alsoDefaultShipping}}},{onSuccess:async u=>{b(u),await s.invalidateQueries({queryKey:L()})}})}return e.jsxs(e.Fragment,{children:[e.jsx(B,{}),e.jsx(A,{className:"pb-10 pt-6 md:pb-14",children:e.jsxs(V,{children:[e.jsxs("header",{className:"mb-5",children:[e.jsx("p",{className:"text-overline uppercase text-primary",children:"Company account"}),e.jsx("h1",{className:"mt-1 font-display text-t1 text-ink",children:"Start a company"}),e.jsx("p",{className:"mt-1 max-w-2xl text-body text-ink-2",children:"Tell us about your business. Vida reviews every new company before quotes, invoices and ordering unlock, and you become its owner."})]}),p?e.jsxs(F,{className:"py-10 text-center","data-testid":"company-start-confirmation",children:[e.jsx(q,{className:"mx-auto size-8 text-primary","aria-hidden":"true"}),e.jsxs("h2",{className:"mt-3 font-display text-t3 text-ink",children:[p.organizationName," was submitted"]}),e.jsxs("p",{className:"mx-auto mt-2 max-w-lg text-sm text-ink-2",children:["Account ",p.accountNumber," is pending approval. Vida is reviewing this company and it will appear in your company switcher. Quotes, invoices and ordering unlock when it is approved."]}),e.jsx("div",{className:"mt-5",children:e.jsx(y,{asChild:!0,children:e.jsx(D,{href:"/account/company",children:"Back to company account"})})})]}):e.jsxs("form",{onSubmit:C,className:"space-y-4",children:[e.jsx(g,{icon:h,title:"Company identity",sub:"The legal and display names that appear on quotes and invoices.",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(r,{htmlFor:"company-start-name",children:"Organization name"}),e.jsx(o,{id:"company-start-name",required:!0,minLength:2,maxLength:120,value:a.organizationName,onChange:t=>i({organizationName:t.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(r,{htmlFor:"company-start-slug",children:"URL slug (optional)"}),e.jsx(o,{id:"company-start-slug",maxLength:64,placeholder:"derived from the name",value:a.organizationSlug,onChange:t=>i({organizationSlug:t.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(r,{htmlFor:"company-start-legal",children:"Legal name (optional)"}),e.jsx(o,{id:"company-start-legal",maxLength:255,placeholder:"defaults to the organization name",value:a.legalName,onChange:t=>i({legalName:t.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(r,{htmlFor:"company-start-dba",children:"DBA (optional)"}),e.jsx(o,{id:"company-start-dba",maxLength:255,value:a.dbaName,onChange:t=>i({dbaName:t.target.value})})]})]})}),e.jsx(g,{icon:h,title:"Primary contact",sub:"Who receives quotes, invoices and order updates. Defaults to you.",children:e.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(r,{htmlFor:"company-start-contact-name",children:"Contact name"}),e.jsx(o,{id:"company-start-contact-name",maxLength:255,value:a.contactName,onChange:t=>i({contactName:t.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(r,{htmlFor:"company-start-contact-email",children:"Contact email"}),e.jsx(o,{id:"company-start-contact-email",type:"email",maxLength:320,value:a.contactEmail,onChange:t=>i({contactEmail:t.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(r,{htmlFor:"company-start-contact-phone",children:"Phone (optional)"}),e.jsx(o,{id:"company-start-contact-phone",maxLength:64,value:a.contactPhone,onChange:t=>i({contactPhone:t.target.value})})]}),e.jsxs("div",{className:"space-y-1.5",children:[e.jsx(r,{htmlFor:"company-start-contact-title",children:"Title (optional)"}),e.jsx(o,{id:"company-start-contact-title",maxLength:255,value:a.contactTitle,onChange:t=>i({contactTitle:t.target.value})})]})]})}),e.jsxs(g,{icon:h,title:"Billing address",sub:"Captured on every issued document exactly as entered here.",children:[e.jsx(T,{value:a,onChange:t=>i({line1:t.line1,line2:t.line2??"",city:t.city,state:t.state,zip:t.zip}),check:d,required:!0,idPrefix:"company-start"}),e.jsxs("label",{className:"mt-3 flex items-center gap-2 text-sm text-ink-2",htmlFor:"company-start-also-shipping",children:[e.jsx(w,{id:"company-start-also-shipping",checked:a.alsoDefaultShipping,onCheckedChange:t=>i({alsoDefaultShipping:t===!0})}),"Also use this as the default shipping address"]})]}),l.isError?e.jsxs(v,{variant:"destructive",children:[e.jsx(f,{children:"The company could not be started"}),e.jsx(j,{children:Q(l.error)})]}):null,e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(y,{type:"submit",disabled:l.isPending,children:l.isPending?e.jsxs(e.Fragment,{children:[e.jsx(R,{className:"size-4 animate-spin","aria-hidden":"true"}),"Submitting..."]}):"Submit for approval"}),e.jsx("p",{className:"text-xs text-ink-3",children:"Submitting again after an error retries safely; it never creates a second company."})]})]})]})})]})}export{J as default};

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.