1import{j as s,r as n}from"./react-vendor-jUbs3Udp.js";import{E as A,g as D,u as k,a as z,C as j}from"./stripe-config-DArKDpyl.js";import{u as T}from"./query-vendor-DSnlNft5.js";import{e as S,b as U,B as $,v as w}from"./BillingDetailsFields-DY5us13R.js";import{e as L,B as R,ap as O}from"./index-gcDjpmFZ.js";import{L as Y}from"./icons-Cjebwm3l.js";import"./index-DfZ-Ig9B.js";import"./collapsible-C0L5KfTJ.js";import"./ui-vendor-DDR7ojRs.js";import"./select-DvkV6m6v.js";(function(){try{var i=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};i.SENTRY_RELEASE={id:"2156d85cf031d709fa1b379f59bedaa6c159aa65"};var r=new i.Error().stack;r&&(i._sentryDebugIds=i._sentryDebugIds||{},i._sentryDebugIds[r]="62595ad5-b15b-4f9f-95aa-9f5e325bc4d7",i._sentryDebugIdIdentifier="sentry-dbid-62595ad5-b15b-4f9f-95aa-9f5e325bc4d7")}catch{}})();function Z(i){return s.jsx(A,{stripe:D(),options:{clientSecret:i.clientSecret,appearance:{theme:"stripe"}},children:s.jsx(F,{...i})})}function F({setupIntentId:i,clientSecret:r,orgName:o,interval:u,total:f}){const l=k(),d=z(),{toast:E}=L(),[c,y]=n.useState(!1),[a,p]=n.useState(()=>S()),[b,g]=n.useState({}),{data:m}=T({queryKey:["/api/v2/auth/user"]});n.useEffect(()=>{const e=m?U(m):S();p(t=>({firstName:t.firstName||e.firstName,lastName:t.lastName||e.lastName,email:t.email||e.email,businessName:t.businessName||e.businessName||o,taxId:t.taxId||e.taxId,address:{line1:t.address.line1||e.address.line1,line2:t.address.line2||e.address.line2,city:t.address.city||e.address.city,state:t.address.state||e.address.state,postalCode:t.address.postalCode||e.address.postalCode,country:t.address.country||e.address.country}}))},[m,o]);const C=async e=>{if(e.preventDefault(),!l||!d)return;const t=w(a);if(g(t),Object.keys(t).length>0)return;const h=d.getElement(j);if(h){y(!0);try{O(i,a);const B=`${a.firstName.trim()} ${a.lastName.trim()}`.trim(),x={line1:a.address.line1.trim()||void 0,line2:a.address.line2.trim()||void 0,city:a.address.city.trim()||void 0,state:a.address.state.trim()||void 0,postal_code:a.address.postalCode.trim()||void 0,country:a.address.country.trim()?a.address.country.trim().toUpperCase():void 0},I=Object.values(x).some(Boolean),{error:v,setupIntent:N}=await l.confirmCardSetup(r,{payment_method:{card:h,billing_details:{name:B||void 0,email:a.email.trim()||void 0,...I?{address:x}:{}}}});if(v)E({title:"Payment failed",description:v.message||"Card was not accepted",variant:"destructive"});else if(N?.status==="succeeded"){const P=new URLSearchParams({confirm:"1",si:N.id,interval:u,value:String(f)}),_=`${window.location.origin}/enterprise/checkout?${P.toString()}`;window.location.assign(_)}}finally{y(!1)}}};return s.jsxs("form",{onSubmit:C,className:"space-y-5",children:[s.jsxs("div",{className:"space-y-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:"Billing details"}),s.jsx($,{value:a,onChange:e=>{p(e),Object.keys(b).length>0&&g(w(e))},errors:b,disabled:c,idPrefix:"enterprise-billing",additionalCollapsible:!0})]}),s.jsxs("div",{className:"space-y-3",children:[s.jsx("h3",{className:"text-sm font-semibold text-slate-900",children:"Card details"}),s.jsx("div",{className:"rounded-md border border-slate-200 bg-white px-3 py-3",children:s.jsx(j,{options:{hidePostalCode:!1,style:{base:{fontSize:"16px",color:"#0f172a","::placeholder":{color:"#94a3b8"}},invalid:{color:"#dc2626"}}}})})]}),s.jsx(R,{type:"submit",className:"w-full bg-gradient-to-r from-purple-600 to-blue-600 hover:from-purple-700 hover:to-blue-700",disabled:!l||!d||c,"data-testid":"button-confirm-payment",children:c?s.jsx(Y,{className:"w-4 h-4 animate-spin"}):"Authorize and create organization"}),s.jsxs("p",{className:"text-sm text-gray-500 text-center",children:[`By clicking "Authorize and create organization," you agree to WhisperAI's`," ",s.jsx("a",{href:"/terms",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400 rounded-sm",children:"Terms of Service"})," ","and"," ",s.jsx("a",{href:"/privacy",target:"_blank",rel:"noopener noreferrer",className:"underline underline-offset-2 hover:text-gray-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-gray-400 rounded-sm",children:"Privacy Policy"})," ","and authorize WhisperAI to charge your selected payment method $",f," today and automatically every ",u==="monthly"?"month":"year"," until canceled. Your subscription starts immediately. You can cancel anytime from your account settings before your next billing date to avoid renewal."]})]})}export{Z 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.