1import{j as e,P as $,B as h,T as m,g as x,ak as I,S as R,a as O,A as P,b as E}from"./vendor-mui-DS9kNsJl.js";import{u as C,a as d}from"./vendor-i18n-CcQdkrxB.js";import{h as B}from"./navigation-nSCj0HaH.js";import{u as F,aw as H,an as K,r as L}from"./App-Cx8cc-so.js";import{u as M}from"./useErrorToast-DqqrKyk2.js";import{t as V}from"./rentOrder-D1JabBGo.js";import{k as G}from"./titledOrder-u75Wu9MU.js";import{C as J}from"./CheckRounded-DrNwjEeW.js";import{R as U}from"./RocketLaunchRounded-B72-Z9as.js";import{A as X}from"./AddCircleOutlineRounded-BfLIMjlR.js";import{S as q}from"./SpaceDashboardOutlined-D9Ahhyqw.js";import{W as Q}from"./WizardSupportSection-B9L2aHM9.js";import{p as Y}from"./main-Dx-_wTTe.js";import{s as Z}from"./account-BDEThrst.js";import{a as ee,u as re}from"./vendor-react-BYWuhvJQ.js";import"./PhoneField-C93JXCIT.js";import"./index-BU3Z37K5.js";import"./vendor-dompurify-DdwdxIb1.js";import"./vendor-query-DAPtKPOb.js";import"./MailOutlineRounded-BOJWqo6D.js";import"./ArrowForwardRounded-k_gXpX7L.js";const se=I` 2 0% { transform: scale(0.4); opacity: 0; } 3 60% { transform: scale(1.18); opacity: 1; } 4 100% { transform: scale(1); opacity: 1; } 5`,te=I` 6 0% { transform: scale(0.6); opacity: 0.6; } 7 100% { transform: scale(1.4); opacity: 0; } 8`;function oe(){const{t}=C();return e.jsxs($,{elevation:0,sx:r=>({p:{xs:4,md:6},borderRadius:2,textAlign:"center",background:`linear-gradient(160deg, ${x(r.palette.success.main,.06)} 0%, ${x(r.palette.primary.main,.04)} 100%)`,border:`1px solid ${x(r.palette.success.main,.18)}`,position:"relative",overflow:"hidden"}),children:[e.jsxs(h,{sx:r=>({position:"relative",width:88,height:88,mx:"auto",mb:2,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:"50%",bgcolor:r.palette.success.main,color:r.palette.common.white,animation:`${se} 0.6s cubic-bezier(.2,.8,.2,1) both`}),children:[e.jsx(J,{sx:{fontSize:52}}),e.jsx(h,{"aria-hidden":!0,sx:r=>({position:"absolute",inset:0,borderRadius:"50%",border:`4px solid ${r.palette.success.main}`,animation:`${te} 1.6s ease-out 0.4s 1 forwards`})})]}),e.jsx(m,{variant:"eyebrow",sx:r=>({color:r.palette.success.main}),children:t("orders.pages.order_success.hero.eyebrow")}),e.jsx(m,{variant:"h4",sx:{mt:1,mb:1.5},children:t("orders.pages.order_success.hero.headline")}),e.jsx(m,{variant:"body1",color:"text.secondary",sx:{maxWidth:540,mx:"auto"},children:t("orders.pages.order_success.hero.subline")})]})}function ae({dashboardHref:t,restartHref:r,restartLabel:f,onRestartClick:_}){const{t:a}=C();return e.jsx($,{elevation:0,sx:n=>({p:{xs:3,md:4},borderRadius:2,background:`linear-gradient(160deg, ${x(n.palette.primary.main,.06)} 0%, ${x(n.palette.secondary.main,.04)} 100%)`,border:`1px solid ${x(n.palette.primary.main,.18)}`}),children:e.jsxs(R,{direction:{xs:"column",md:"row"},spacing:{xs:2.5,md:3},alignItems:{xs:"flex-start",md:"center"},children:[e.jsx(h,{sx:n=>({width:72,height:72,display:"inline-flex",alignItems:"center",justifyContent:"center",borderRadius:1,bgcolor:x(n.palette.primary.main,.12),color:n.palette.primary.main,flexShrink:0}),children:e.jsx(U,{sx:{fontSize:40}})}),e.jsxs(h,{sx:{flex:1,minWidth:0},children:[e.jsx(m,{variant:"eyebrow",sx:n=>({color:n.palette.primary.main}),children:a("orders.pages.order_success.next_steps.eyebrow")}),e.jsx(m,{variant:"h5",sx:{mt:.5,mb:.5,fontWeight:600},children:a("orders.pages.order_success.next_steps.title")}),e.jsx(m,{variant:"body2",color:"text.secondary",children:a("orders.pages.order_success.next_steps.subline")})]}),e.jsxs(R,{direction:{xs:"column",sm:"row",md:"column"},spacing:1.5,sx:{width:{xs:"100%",sm:"auto"},flexShrink:0},children:[e.jsx(O,{variant:"contained",size:"large",href:r,onClick:_,startIcon:e.jsx(X,{}),children:f}),e.jsx(O,{variant:"outlined",size:"large",href:t,startIcon:e.jsx(q,{}),children:a("orders.pages.order_success.next_steps.dashboard_label")})]})]})})}const ne=["passwords_do_not_match","initial_password_already_changed","social_auth_user_has_no_local_password"];function k(t){return ne.includes(t)}function ie({onSuccess:t}){const{t:r}
8=C(),[f,_]=d.useState(""),[a,n]=d.useState(""),[s,y]=d.useState(!1),[c,g]=d.useState({});function b(o){return k(o)?r(`orders.pages.order_success.password_form.errors.${o}`):o}function S(o){const i=o?.body,l=Y(i);if(l){const p={};if(l.password1?.length&&(p.password1=b(l.password1[0])),l.password2?.length&&(p.password2=b(l.password2[0])),p.password1||p.password2)return p}const u=i&&typeof i=="object"&&"detail"in i?String(i.detail):null;return u&&k(u)?{form:b(u)}:{form:r("orders.pages.order_success.password_form.errors.generic")}}async function j(o){if(o.preventDefault(),!s){if(f!==a){g({password2:r("orders.pages.order_success.password_form.errors.passwords_do_not_match")});return}y(!0),g({});try{await Z({password1:f,password2:a}),t()}catch(i){g(S(i)),y(!1)}}}return e.jsxs(h,{component:"form",onSubmit:j,noValidate:!0,sx:o=>({p:{xs:3,md:4},borderRadius:1,border:`1px solid ${o.palette.divider}`,bgcolor:"background.paper"}),children:[e.jsx(m,{variant:"h6",component:"h2",sx:{mb:.5},children:r("orders.pages.order_success.password_form.title")}),e.jsx(m,{variant:"body2",color:"text.secondary",sx:{mb:3},children:r("orders.pages.order_success.password_form.subtitle")}),c.form&&e.jsx(P,{severity:"error",sx:{mb:2},children:c.form}),e.jsxs(R,{spacing:2,children:[e.jsx(E,{type:"password",label:r("orders.pages.order_success.password_form.password1_label"),value:f,onChange:o=>_(o.target.value),error:!!c.password1,helperText:c.password1,autoComplete:"new-password",fullWidth:!0}),e.jsx(E,{type:"password",label:r("orders.pages.order_success.password_form.password2_label"),value:a,onChange:o=>n(o.target.value),error:!!c.password2,helperText:c.password2,autoComplete:"new-password",fullWidth:!0}),e.jsx(O,{type:"submit",variant:"contained",size:"large",disabled:s,children:r(s?"orders.pages.order_success.password_form.submitting":"orders.pages.order_success.password_form.submit")})]})]})}const de="order-success-context";function ce(){const t=document.getElementById(de)?.textContent;if(!t)return null;try{return JSON.parse(t)}catch{return null}}const T={invoice:{href:"/auftrag/rechnung/",labelKey:"restart_label_invoice",create:K},rent:{href:"/auftrag/miete/",labelKey:"restart_label_rent",create:V},titled:{href:"/auftrag/titel/",labelKey:"restart_label_titled",create:G}},A="/account/",le="/connect/rechnung-einreichen";function $e({variant:t="orders"}){const{t:r}=C();F(r("orders.pages.order_success.document_title"));const f=ee(),_=re(),a=f.state?.orderSuccessContext??null,[n]=d.use
8State(()=>{const w=ce(),v=a!=null&&w!=null&&a.order.uuid===w.order.uuid;return{context:a??w,entryMode:a&&!v?"soft":"full"}}),{context:s,entryMode:y}=n,[c,g]=d.useState(!1),[b,S]=d.useState(!1),j=M(),[o,i]=d.useState(!1),l=d.useRef(!1);if(d.useEffect(()=>{if(!l.current){if(l.current=!0,!s){t==="integration"?_("/connect/",{replace:!0}):B(A);return}H({order_uuid:s.order.uuid,company_uuid:s.company.uuid,is_new_customer:s.is_new_customer,is_soft_conversion:s.is_soft_conversion,order_flow_type:s.order.order_flow_type,entry_mode:y,...s.customer_data_hashed})}},[]),!s)return null;const u=!c&&s.user.is_authenticated&&!s.user.initial_password_changed&&!s.user.has_social_auth,p=t==="integration"?{href:le,label:r("orders.pages.order_success.next_steps.restart_label_integration")}:{href:T[s.order.order_flow_type].href,label:r(`orders.pages.order_success.next_steps.${T[s.order.order_flow_type].labelKey}`)},N=A;function D(){g(!0),s?.company.source_campaign==="sdbundle"&&S(!0)}function z(w){if(w.preventDefault(),o||!s)return;i(!0);const v=T[s.order.order_flow_type];(async()=>{try{await v.create(),_(v.href)}catch(W){j.show(L(W,r("common.shared.errors.save_failed"))),i(!1)}})()}return e.jsxs(h,{sx:{px:{xs:2,md:3},pt:{xs:2,md:3},pb:{xs:8,md:12}},children:[e.jsxs(R,{className:"paywise-stagger",spacing:{xs:3,md:4},sx:u?{maxWidth:640,mx:"auto",width:"100%"}:void 0,children:[e.jsx(oe,{}),b&&!u&&e.jsx(P,{severity:"success",onClose:()=>S(!1),children:r("orders.pages.order_success.password_form.sdbundle_snackbar")}),u?e.jsx(ie,{onSuccess:D}):e.jsx(ae,{dashboardHref:N,restartHref:p.href,restartLabel:p.label,onRestartClick:t==="orders"?z:void 0}),!u&&e.jsx(Q,{sx:{mt:0}})]}),j.element]})}export{$e 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.