1import{bR as x,O as b,Q as f,b0 as g,aA as C,aJ as h,cj as j,bS as v,aF as M,a8 as N,j as e,ar as a,cH as c,cI as l,aN as A,aE as S}from"./index-Ozl4GyvN.js";import{F as o}from"./formattedDate.component-D5vmG1PI.js";import{P as w}from"./pageHeadline.component-CUy7vhIi.js";import{u as P,n as y,c as B,P as D}from"./app.component-CSz9esQu.js";const F=x("\n mutation subscriptionCancelActiveSubscriptionMutation($input: CancelActiveSubscriptionMutationInput!) {\n cancelActiveSubscription(input: $input) {\n subscriptionSchedule {\n ...subscriptionActiveSubscriptionFragment\n id\n }\n }\n }\n"),L=()=>{const i=b(),{toast:t}=f(),s=g(),r=C(),{data:n}=P(),u=i.formatMessage({defaultMessage:"You will be moved to free plan with the next billing period",id:"Cancel subscription / Success message"}),[d,{loading:p}]=h(F,{onCompleted:()=>{t({description:u}),j.refetchQueries({include:["CommonQuery","stripeSubscriptionQuery"]}),v("subscription","cancel"),s(r(M.subscription.index))},onError:m=>N(m)});return{handleCancel:()=>{n&&d({variables:{input:{tenantId:n.id}}})},cancelLoading:p}},T=()=>{const{activeSubscription:i}=y(),{activeSubscriptionRenewalDate:t,activeSubscriptionPlan:s}=B(i),{handleCancel:r,cancelLoading:n}=L();return i?e.jsxs(D,{className:"flex space-y-4 flex-col",children:[e.jsx(w,{header:e.jsx(a,{defaultMessage:"Current plan info",id:"Cancel subscription / Current plan header"}),hasBackButton:!0,subheader:e.jsx(a,{defaultMessage:"Details about your current plan",id:"Cancel subscription / Current plan label"})}),e.jsxs(c,{className:"flex flex-row",children:[e.jsx(a,{defaultMessage:"Active plan: ",id:"Cancel subscription / Active plan"}),e.jsx(l,{className:"ml-1",children:s==null?void 0:s.name})]}),e.jsxs(c,{className:"flex flex-row mt-0",children:[e.jsx(a,{defaultMessage:"Active plan price:",id:"Cancel subscription / Active plan price"}),e.jsxs(l,{className:"ml-1",children:[s==null?void 0:s.finalPrice.toFixed(2)," PLN netto"]})]}),t&&e.jsxs(c,{className:"flex flex-row",children:[e.jsx(a,{defaultMessage:"Next renewal / expiry: ",id:"Cancel subscription / Next renewal"}),e.jsx(l,{className:"ml-1",children:e.jsx(o,{value:t})})]}),t&&e.jsx(c,{className:"mt-4",children:e.jsx(a,{defaultMessage:"Your subscription will remain active until {date}.",id:"Cancel subscription / remain active note",values:{date:e.jsx(o,{value:t})}})}),e.jsx(A,{className:"w-fit mt-6",onClick:r,disabled:n,icon:n&&e.jsx(S,{icon:"heroicons:arrow-path",className:"animate-spin",size:20}),children:n?e.jsx(a,{defaultMessage:"Processing...",id:"Cancel subscription / Button loading"}):e.jsx(a,{defaultMessage:"Cancel subscription",id:"Cancel subscription / Button label"})})]}):null};export{T 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.