PageSourceSearch

https://workspace.sarv.com/assets/order-U8i-L5P_.js

js sarv.com collected 2026-09-24 19:35:09 UTC 50,868 bytes, 4 lines download raw bytes

1import{j as e,P as g,r as h}from"./react-CRjXmzdu.js";import{u as bt}from"./redux-Dts5QXDw.js";import{a as ft}from"./react-query-Cwaq9TKo.js";import{F as br,G as jt,H as wt,I as St,J as vt,K as Ct,r as V,g as Pt,i as zt,d as re,a as Ie,L as Ar,a3 as kt,a1 as ue,a4 as fr,a5 as jr,a6 as It,a7 as At,w as ae,a8 as Nt,p as pe}from"./index-De75rBSf.js";import{C as wr}from"./customModal-05N-qTVU.js";import{a as Nr,u as Ft}from"./router-BDpR9Pxq.js";import{g as Z,s as Fr}from"./localStorage-BHNW5tUk.js";import{d as Sr}from"./razorpay-ByxvYY9g.js";import{F as Wt,b as Wr,C as Ye,a as Dt,c as L,d as Rt,u as Tt,o as Mt}from"./forms-mfHO6aZq.js";import{aP as Dr,aQ as Rr,aS as Bt,K as Ae,bs as c,ax as M,as as Et,b8 as Ut,aC as qt,aD as vr,T as n,f as _t,bt as m,a as U,an as xe,H as Le,aO as $e,G as $,bu as Cr,I as le,bv as Ge,bw as Ve,bx as Oe,by as Qe,bz as He,bA as Je,V as X,s as Lt,C as $t,bB as Gt}from"./mui-CNr6W-ty.js";import"./iconify-BNxKwMGw.js";import"./vendor-IdvdfVCJ.js";import"./lodash-CpjO0APP.js";import"./ui-utils-DqNXFlDe.js";import"./http-3ukMoIbY.js";import"./date-utils-Cj6NCtA4.js";import"./sanitize-RB1-lMRI.js";import"./validation-B8dh9o27.js";import"./i18n-89tvej9L.js";import"./emotion-CfcNTy1E.js";import"./firebase-UICncsdF.js";const Vt=()=>new URLSearchParams(Nr().search);function Tr({children:l,onSubmit:a,methods:y}){return e.jsx(Wt,{...y,children:e.jsx("form",{onSubmit:a,children:l})})}Tr.propTypes={children:g.node,methods:g.object,onSubmit:g.func};function Mr({name:l,helperText:a,checkBoxSize:y="medium",...p}){const{control:P}=Wr();return e.jsx(Ye,{name:l,control:P,render:({field:A,fieldState:{error:S}})=>e.jsxs("div",{children:[e.jsx(Dr,{control:e.jsx(Rr,{...A,checked:A.value,size:y}),...p}),(!!S||a)&&e.jsx(Bt,{error:!!S,children:S?S?.message:a})]})})}Mr.propTypes={helperText:g.string,name:g.string,checkBoxSize:g.string};g.string,g.string,g.string,g.array,g.bool,g.number,g.object;function G({name:l,control:a,helperText:y,type:p,size:P="large",placeholder:A,sanitize:S=!0,validate:T=!0,validationOptions:q,trim:v=!1,...N}){const z=Wr()?.control,_=a||z,x=(u,D)=>{if(!S||!u)return u;try{switch(D){case"email":return vt(u);case"url":return St(u);case"tel":return wt(u);case"number":return jt(u);case"password":return br(u,{trim:v});default:return br(u,{trim:v})}}catch(O){return console.error(`Sanitization error for ${D}:`,O),u}},I=u=>{if(!T||!u||typeof u!="string")return!0;const D={checkSQL:!0,checkCommand:p!=="url",checkXSS:!0,checkPath:!1},O=q?{...D,...q}:D,f=Ct(u,O);return f.isValid?!0:(V(f.error||"Invalid input detected. Please check your input."),!1)};return e.jsx(Ye,{name:l,control:_,render:({field:u,fieldState:{error:D}})=>e.jsx(Ae,{...u,fullWidth:!0,type:p,value:p==="number"&&u.value===0?"":u.value,onChange:O=>{const f=O.target.value;if(I(f))if(p==="number"){const ce=x(f,"number");u.onChange(Number(ce))}else{const ce=x(f,p);u.onChange(ce)}},error:!!D,helperText:D?D?.message:y,size:P,placeholder:A,...N})})}G.propTypes={helperText:g.object,name:g.string,type:g.string,control:g.object,size:g.string,placeholder:g.string,sanitize:g.bool,validate:g.bool,validationOptions:g.object,trim:g.bool};const Pr=new Ar("contactus form"),zr=/^[a-zA-Z0-9\s,./#&'():-]*$/,Ze=h.forwardRef(({handleBillingAddress:l,onContinueToPayment:a,onValidationError:y},p)=>{const P=Dt().shape({name:L().trim().required("Name is required."),email:L().test("is-eai-email","Please enter a valid email address",x=>!x||/^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(x)).required("Email is required"),mobile:L().matches(/^\d+$/,"Mobile number must contain only digits").min(10,"Mobile number must be at least 10 digits").max(15,"Mobile number can't exceed 15 digits").required("Mobile Number is required"),streetAddress1:L().trim().matches(zr,"Address contains invalid characters").required("House number and street name is required"),streetAddress2:L().trim().matches(zr,"Address contains invalid characters").optional(),pincode:L().trim().required("Zip/Postal is required"),city:L().trim().required("City is required"),state:L().trim().required("State is required"),company:Rt(),companyName:L().when("company",{is:!0,then:x=>x.required("Company name is required"),otherwise:x=>x.optional()}),companySize:L().when("company",{is:!0,then:x=>x.required("Company Size is required"),otherwise:x=>x.optional()}),gstNumber:L().trim().optional()}),A=Tt({resolver:Mt(P),defaultValues:{userType:"individual",company:!1}
1}),{handleSubmit:S,control:T,watch:q,reset:v}=A;h.useImperativeHandle(p,()=>({submit:()=>{S(N,y)()}})),h.useEffect(()=>{(async()=>{try{const I=await Ie("getUserBillingDetails",{_t:Date.now()});if(I?.billingDetails){const{billingDetails:u}=I;v({name:u.fullName||"",email:u.email||"",mobile:u.phone||"",streetAddress1:u.address||"",city:u.city||"",state:u.state||"",pincode:u.zipCode||"",company:!!u.company,companyName:u.company||"",companySize:u.companySize||"",gstNumber:u.gstNumber||"",userType:"individual"})}}catch(I){Pr.error("Error fetching billing details:",I)}})()},[v]);const N=async x=>{try{if(!Pt("billingAddress",3,6e4)){const u=zt("billingAddress");V(`Too many attempts. Please try again in ${u}.`);return}const I={fullName:x.name,email:x.email,phone:x.mobile,address:x.streetAddress1,city:x.city,state:x.state,zipCode:x.pincode,country:"India",company:x.company?x.companyName:"",companySize:x.company?x.companySize:"",gstNumber:x.gstNumber||""};await re("saveUserBillingDetails",{billingDetails:I}),await Ie("getUserBillingDetails",{_t:Date.now()}),l(x),a&&a(x)}catch(I){Pr.error(I),V(I?.message||"Failed to save billing details")}},z=["Andhra Pradesh","Arunachal Pradesh","Assam","Bihar","Chhattisgarh","Goa","Gujarat","Haryana","Himachal Pradesh","Jharkhand","Karnataka","Kerala","Madhya Pradesh","Maharashtra","Manipur","Meghalaya","Mizoram","Nagaland","Odisha","Punjab","Rajasthan","Sikkim","Tamil Nadu","Telangana","Tripura","Uttar Pradesh","Uttarakhand","West Bengal"],_=q();return e.jsx(c,{width:"100%",sx:{overflow:"hidden",p:2},children:e.jsx(Tr,{methods:A,onSubmit:S(N),children:e.jsxs(M,{container:!0,spacing:3,children:[e.jsx(M,{item:!0,xs:12,children:e.jsx(G,{name:"name",label:"Full Name",placeholder:"Enter your name",size:"small",InputLabelProps:{shrink:!0},sx:{"& .MuiInputBase-input":{padding:"12px 14px"}}})}),e.jsx(M,{item:!0,xs:12,md:6,children:e.jsx(G,{name:"email",label:"Email Address",placeholder:"Enter your email address",size:"small",InputLabelProps:{shrink:!0},sx:{"& .MuiInputBase-input":{padding:"12px 14px"}}})}),e.jsx(M,{item:!0,xs:12,md:6,children:e.jsx(G,{name:"mobile",label:"Mobile Number",placeholder:"Enter your contact number",size:"small",inputProps:{inputMode:"numeric",pattern:"[0-9]*",maxLength:15},onInput:x=>{x.target.value=x.target.value.replace(/\D/g,"").slice(0,15)},InputLabelProps:{shrink:!0},sx:{"& .MuiInputBase-input":{padding:"12px 14px"}}})}),e.jsx(M,{item:!0,xs:12,children:e.jsx(G,{name:"streetAddress1",label:"House number and street name",placeholder:"Enter your address",size:"small",InputLabelProps:{shrink:!0},sx:{"& .MuiInputBase-input":{padding:"12px 14px"}}})}),e.jsx(M,{item:!0,xs:12,children:e.jsx(G,{name:"streetAddress2",label:"Apartment, suite, unit, etc. (optional)",placeholder:"Enter your full address",size:"small",InputLabelProps:{shrink:!0},sx:{"& .MuiInputBase-input":{padding:"12px 14px"}}})}),e.jsx(M,{item:!0,xs:12,md:4,children:e.jsx(Ye,{name:"state",control:T,defaultValue:"",rules:{required:"State is required"},render:({field:x,fieldState:I})=>e.jsxs(Et,{sx:{"& .MuiInputBase-input":{padding:"12px 14px"}},fullWidth:!0,size:"small",error:!!I.error,children:[e.jsx(Ut,{id:"state-label",shrink:!0,children:"State"}),e.jsxs(qt,{labelId:"state-label",label:"State",...x,displayEmpty:!0,renderValue:u=>u.length===0?e.jsx(n,{color:"text.secondary",children:"Select your state"}):u,children:[e.jsx(vr,{value:"",disabled:!0,children:e.jsx("em",{children:"Select your state"})}),z.map(u=>e.jsx(vr,{value:u,children:u},u))]}),I.error?.message&&e.jsx(n,{variant:"caption",color:"error",sx:{marginLeft:"14px",marginTop:"4px"},children:I.error.message})]})})}),e.jsx(M,{item:!0,xs:12,md:4,children:e.jsx(G,{name:"city",label:"City",placeholder:"Enter your city name",size:"small",InputLabelProps:{shrink:!0},sx:{"& .MuiInputBase-input":{padding:"12px 14px"}}})}),e.jsx(M,{item:!0,xs:12,md:4,children:e.jsx(G,{name:"pincode",label:"Zip/Postal",placeholder:"Enter your zip code",size:"small",InputLabelProps:{shrink:!0},sx:{"& .MuiInputBase-input":{padding:"12px 14px"}}})}),e.jsx(M,{item:!0,xs:12,children:e.jsx(Mr,{name:"company",label:"This is Business Account"})}),_?.company&&e.jsxs(e.Fragment,{children:[e.jsx(M,{item:!0,xs:12,md:6,children:e.jsx(G,{name:"companyName",label:"Company Name",placeholder:"Enter your company name",size:"small",InputLabelProps:{shrink:!0},sx:{"& .MuiInputBase-input":{padding:"12px 14px"}}})}),e.jsx(M,{item:!0,xs:12,md:6,children:e.jsx(G,{name:"companySize",label:"Company Size",placeholder:"Enter your members size",size:"small",InputLabelProps:{shrink:!0},sx:{"& .MuiInputBase-input":{padding:"12px 14px"}}})}),e.jsx(M,{item:!0,xs:12,children:e.jsx(G,{name:"gstNumber",label:"GST Number (Optional)",placeholder:"Enter your GST number",size:"small",InputLabelProps:{shrink:!0},sx:{"& .MuiInputBase-input":{padding:"12px 14px"}}})})]}),e.jsx(M,{item:!0,xs:12})]})})})});Ze.displayName="BillingAddress";Ze.propTypes={handleBillingAddress:g.func,onContinueToPayment:g.func,onValidationError:g.func};const kr=Lt("div")(({theme:l,$showChromeSpacing:a=!0})=>({backgroundColor:l.palette.background.default,display:"flex",justifyContent:"flex-start",alignItems:"center",flexDirection:"column",gap:"14px",padding:a?"48px 0px 0px 72px":"0px",height:"100%",overflow:"hidden",[l.breakpoints.down("sm")]:{padding:a?"70px 14px 74px 14px":"0px",height:"auto"}})),te=new Ar("order"),Br=l=>{const a=Math.max(1,Number(l?.minUser)||1),y=Math.max(a,Number(l?.maxUser)||1e3),p=l?.isTrialPlan?Math.max(y,1e3):y;return{minUsers:a,maxUsers:p}},Ir=(l,a)=>{const{minUsers:y,maxUsers:p}=Br(l),P=Number.parseInt(a,10);return Number.isNaN(P)?y:Math.min(Math.max(P,y),p)},ke=l=>{if(!l)return"--";const a=new Date(l);return Number.isNaN(a.getTime())?"--":new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short"}).format(a)},Ot=(l,a="INR")=>
1{const y=Number(l||0);try{return new Intl.NumberFormat(void 0,{style:"currency",currency:a,maximumFractionDigits:2}).format(y)}catch(p){return te.error("Failed to format renewal currency",p),`${a} ${y.toFixed(2)}`}},Qt=l=>l?String(l).split(/[_\s-]+/).filter(Boolean).map(a=>a.charAt(0).toUpperCase()+a.slice(1)).join(" "):"Pending",ee=(l,a="monthly")=>{const y=Number(l?.price||l?.priceMonthly||0),p=Number(a==="annual"||a==="yearly"?l?.yearly_discount||l?.yearlyDiscount||0:a==="quarterly"?l?.quarterlyDiscount||0:l?.monthly_discount||l?.monthlyDiscount||0);return Number((y*(1-p/100)).toFixed(2))},Ht=()=>{try{const l=new URLSearchParams(window.location.search).get("planData");if(!l)return null;const a=JSON.parse(decodeURIComponent(escape(atob(decodeURIComponent(l)))));return!Array.isArray(a)||!a.length?null:(Fr("planDetails",a),a)}catch{return null}},Jt=(l=[])=>(Array.isArray(l)?l:[]).map(a=>{const y=!!(a?.isTrialPlan||a?.promotionalPlan),p=Math.max(1,Number(a?.users||1)),P=Number(a?.priceMonthly??a?.price??0),A=Number(a?.priceQuarterly??(P>0?Number((P*(1-Number(a?.quarterlyDiscount||0)/100)*3).toFixed(2)):0)),S=Number(a?.priceAnnually??(P>0?Number((P*(1-Number(a?.yearly_discount||0)/100)*12).toFixed(2)):0)),q=Number((({annual:S,yearly:S,quarterly:A,monthly:P}[a?.subsType]??P)*p).toFixed(2)),v=Number(a?.actualPrice),N=Number.isFinite(v)&&(y?v>=0:v>0)?v:y?0:q;return{...a,users:p,priceMonthly:P,priceQuarterly:A,priceAnnually:S,actualPrice:N}}),Kt=async()=>{try{const l=JSON.stringify(["AM"]),{dashboardDeatils:{AM:a}}=await Ie("consoleDetails",{methods:l});return a?.email||""}catch(l){return te.error("Failed to fetch assignee email",l),""}},Ke=({qty:l,min:a,max:y,onCommit:p,sx:P})=>{const[A,S]=h.useState(String(l)),T=h.useRef(!1);h.useEffect(()=>{S(String(l)),T.current=!1},[l]);const q=N=>{const z=N.target.value;if(z===""){S(z),T.current=!1;return}const _=parseInt(z,10);if(!isNaN(_)){if(_>y){T.current||(V(`Maximum allowed is ${y}`),T.current=!0);return}T.current=!1,S(z),p(_)}},v=()=>{let N=parseInt(A,10);(isNaN(N)||N<a)&&(N=a),N>y&&(N=y),S(String(N)),p(N)};return e.jsx(Ae,{size:"small",type:"number",value:A,onChange:q,onBlur:v,inputProps:{min:a,max:y},sx:P})};
1Ke.propTypes={qty:g.number.isRequired,min:g.number.isRequired,max:g.number.isRequired,onCommit:g.func.isRequired,sx:g.object};const Yt=({isOnboarding:l=!1,standalone:a=!1})=>{const y=ft(),p=_t(),P=Nr(),A=Jt(Ht()||Z("planDetails")||[]),S=h.useRef(),T=a&&!At(),q=!a||T,[v,N]=h.useState([]),[z,_]=h.useState({}),[x,I]=h.useState(Z("onboardingFlow")?.active?"checkout":"product"),[u,D]=h.useState(!1),[O]=h.useState(18),[f,ce]=h.useState(A),[Xe]=h.useState("online"),[J,Er]=h.useState({}),[me,er]=h.useState(""),[F,he]=h.useState(null),[rr,tr]=h.useState(!1),[ge,ye]=h.useState(null),[Y,Q]=h.useState(!1),[Ur,be]=h.useState(!1),[Ne,fe]=h.useState(""),ne=Vt(),qr=ne.get("product"),je=bt(r=>r.workspace.workspaceDetails),B=Ft(),oe=ne.get("renewPlanId")||P?.state?.renewalPlanId||"",we=!!oe,[W,nr]=h.useState(null),[Fe,or]=h.useState(!1),ir=async()=>{if(oe)try{or(!0);const r=await It("planApi",`${oe}/status`);nr(r?.data||null)}catch(r){te.error("Failed to fetch renewal status",r),V(r?.message||"Failed to load renewal details")}finally{or(!1)}},sr=()=>{f.some(t=>t.promotionalPlan)&&y.invalidateQueries({queryKey:["workspaceProducts"]}),Z("onboardingFlow")?.active?(pe("Plan assigned successfully."),window.location.href=`${ae()}/onboarding`):qr?(be(!1),pe("Plan assigned successfully."),window.location.href=`/admin${ae()}?section=domain_setup`):(be(!1),D(!0))},ar=async r=>{be(!0),D(!0);try{await re("verifyPayment",r),sr()}catch(t){be(!1),D(!1),Q(!1),te.error(t),V(t?.message||"Payment verification failed. Please contact support if the amount was deducted.")}},_r=async()=>{if(oe)try{Q(!0);const r=await Nt("planApi",`${oe}/renew/checkout`,{}),{order:t,renewal:i}=r?.data||{};if(!t?.id)throw new Error("Unable to create renewal checkout");nr(s=>({...s||{},renewalPreview:i})),await Sr({order:t},ar)}catch(r){te.error("Renewal payment failed",r),V(r?.message||"Failed to start renewal checkout"),Q(!1)}};h.useEffect(()=>{ir()},[oe]);function lr(r=!1){const t=Object.entries(z).find(([s,d])=>d>0&&v.some(b=>b.plan_id===s));let i;if(t){const[s,d]=t,b=v.find(R=>R.plan_id===s)||f.find(R=>R.planId===s),C=f.find(R=>R.planId===s)?.subsType||o?.subsType||"monthly",j=ee(b,C);i={planId:s,storage:d,price:j*d}}return f.map(({planId:s,productId:d,name:b,productName:C,subsType:j,slabId:R,credit:k,users:w,storage:Ue,actualPrice:ze,priceMonthly:ct,isTrialPlan:dt,promotionalPlan:yr,fixedUsers:ut,isAddon:se,selectedVariantId:pt},xt)=>{const qe=se?z[s]||w||0:w,mt=se?v.find(yt=>yt.plan_id===s):null,ht=se?ee(mt||{priceMonthly:ct},j)||Number(((w||0)>0?ze/w:ze)||0):ze,gt=se?ht*qe:ze,_e={planId:s,selectedVariantId:pt,productId:d,planName:b,productName:C,slabId:R,credit:k,subsType:j,users:qe,price:gt,recurring:r,isTrialPlan:dt||yr,promotionalPlan:!!yr,fixedUsers:!!ut,isAddon:!!se,storage:Ue};return se&&(_e.storage=qe),xt===0&&i&&!H&&(_e.addon=i),_e})}const We=(r={})=>{const t=f.find(i=>!i?.isAddon)||f[0]||{};return{...r,planId:t?.planId||"",planVer:t?.planVer||1,licensesRequested:Number(t?.users||1),billingCycle:(()=>{const i=t?.subsType;return i==="annual"||i==="yearly"?"yearly":i==="quarterly"?"quarterly":"monthly"})(),selectedVariantId:t?.selectedVariantId||t?.planId||"",storageGb:Number(t?.storageGb??t?.storage??0),workspaceLinks:je?.workSpaceId?[{orgId:je.workSpaceId}]:[]}},Lr=async()=>{if(!me.trim())return V("Please enter a promo code");try{tr(!0);const r=lr(!1),t=await re("validatePromoCode",{promoCode:me.trim(),orderPlanDetails:r,billingAddress:J,workspaceId:je?.workSpaceId});he(t?.data||null),ye({severity:"success",message:t?.message||"Promo code applied successfully."})}catch(r){he(null),ye({severity:"error",message:r?.message||"Failed to apply promo code"}),V(r?.message||"Failed to apply promo code")}finally{tr(!1)}},$r=()=>{er(""),he(null),ye(null)};h.useEffect(()=>{!F&&!ge||(he(null),ye(null))},[f,z]);const De=async()=>{try{D(!1),D(!1);const r=Te(),t=de,s=lr(!1);if(Q(!0),Xe==="quotation"){const b=(await re("createOrder",{...We({amount:t,orderPlanDetails:s,billingAddress:J,workspaceId:je?.workSpaceId,paymentMode:Xe,promoCode:F?.promoCode,pricingPreview:F})}))?.data||"",C={formData:{name:J.name,email:J.email,phone:J.mobile,formId:3,requirement:b,label:"Quotation Created",type:"individual"}},j=await Kt();j&&j.trim().length&&(C.formData.assignee=[j]),await re("leads",C),pe("saved sucessfully");const R=Z("onboardingFlow");setTimeout(()=>{R?.active?B(`${ae()}/onboarding`,{replace:!0}):B("/",{replace:!0})},1e3)}else if(r<=0&&(f.some(d=>d.isTrialPlan)||f.some(d=>d.promotionalPlan))){const{message:d}=await re("createOrder",{...We({orderPlanDetails:s,wallet:!1,billingAddress:J,total:0,isTrialPlan:!0,promoCode:F?.promoCode,pricingPreview:F})});f.some(C=>C.promotionalPlan)&&y.invalidateQueries({queryKey:["workspaceProducts"]}),Z("onboardingFlow")?.active?(pe("Plan assigned successfully."),window.location.href=`/admin${ae()}?section=domain_setup`):(pe(d),setTimeout(()=>{B(`${ae()}/onboarding`,{replace:!0})},1e3))}else{const d=await re("createOrder",{...We({amount:t,orderPlanDetails:s,billingAddress:J,promoCode:F?.promoCode,pricingPreview:F})}),{order:b={},gatewayRequired:C=!0,data:{gatewayRequired:j}={}}=d||{};
1!(j??C)||b?.status==="paid"?sr():await Sr({order:{id:b?.id}},ar)}Q(!1)}catch(r){return te.error(r),Q(!1),V(r?.message||"Payment processing failed")}},Gr=(r,t)=>Number((r*t).toFixed(2)),Vr={monthly:"Monthly Subscription",quarterly:"Quarterly Subscription",annual:"Annual Subscription",yearly:"Annual Subscription"},Re=(r,t)=>{ce(i=>i.map(s=>{if(s?.planId!==r)return s;const d=Ir(s,t),b=s?.subsType==="annual"||s?.subsType==="yearly"?Number(s?.priceAnnually||0):s?.subsType==="quarterly"?Number(s?.priceQuarterly||0):Number(s?.priceMonthly||0),C=Gr(d,b);return{...s,users:d,actualPrice:C}}))},Or=(r,t,i)=>{const s=f.find(d=>d?.planId===i);s&&Re(i,(s.users||0)+1)},Qr=(r,t,i)=>{const s=f.find(d=>d?.planId===i);s&&Re(i,(s.users||0)-1)},[Hr]=h.useState(0),[Jr]=h.useState(0),E=r=>(r||0).toLocaleString("en-IN",{style:"currency",currency:"INR",minimumFractionDigits:0,maximumFractionDigits:2}),Te=()=>{let r=0;f.forEach(({actualPrice:i,isAddon:s})=>{s||(r=r+i)}),r+=Hr*4,r+=Jr*4;const t=(f.find(i=>i.productName!=="Voice")||f[0])?.subsType;return v.forEach(i=>{const s=z[i.plan_id]||0;s>0&&(r+=ee(i,t)*s)}),Number(r.toFixed(2))},Kr=r=>{const t=Number(r?.subsType==="annual"&&r?.yearly_discount||0),i=Number(r?.actualPrice||0);if(t<=0||t>=100||i<=0)return 0;const s=i/(1-t/100);return Number((s-i).toFixed(2))},Me=f.reduce((r,t)=>t.isAddon?r:r+Kr(t),0),Yr=()=>Number((Te()+Me).toFixed(2)),Se=Te(),cr=Number(F?.eligibleSubtotal??Se),Zr=Number(F?.discountAmount??0),Xr=Number(F?.subtotalAfterDiscount??Se),et=Number(F?.gstAmount??Se*(O/100)),de=Number(F?.finalAmount??kt(Se,O)),rt=()=>{localStorage.removeItem("REACT_QUERY_OFFLINE_CACHE"),y.removeQueries({queryKey:["workspaceProducts"]}),Gt(),B("/myPlans",{state:{activeTab:2}})},dr=()=>e.jsxs(m,{sx:{mt:2,mb:2,p:2,borderRadius:"10px",bgcolor:"background.paper",border:"1px solid",borderColor:F?"primary.light":"divider"},children:[e.jsx(n,{variant:"subtitle2",sx:{color:"grey.1100",fontSize:"14px",mb:1},children:"Promo Code"}),e.jsxs(c,{direction:{xs:"column",sm:"row"},spacing:1.25,alignItems:{sm:"flex-start"},children:[e.jsx(Ae,{size:"small",fullWidth:!0,placeholder:"Enter promo code",value:me,onChange:r=>er(r.target.value.toUpperCase())}),e.jsx($,{variant:"contained",onClick:Lr,disabled:rr||!me.trim(),sx:{minWidth:{sm:96},whiteSpace:"nowrap",bgcolor:"primary.main",color:"common.white","&:hover":{bgcolor:"primary.dark"},"&.Mui-disabled":{bgcolor:"action.disabledBackground",color:"text.disabled"}},children:rr?"Applying...":"Apply"}),F?e.jsx($,{variant:"outlined",color:"inherit",onClick:$r,sx:{minWidth:{sm:88}},children:"Clear"}):null]}),ge?.message?e.jsx(Le,{severity:ge.severity||"info",sx:{mt:1.5},children:ge.message}):null]}),ur=({showAnnualDiscount:r=!1})=>e.jsxs(c,{spacing:2,mb:2,children:[e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:r?"Subtotal":"Eligible Subtotal"}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:E(r?Yr():cr)})]}),r&&Me>0?e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsxs(c,{direction:"row",spacing:1,alignItems:"center",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Annual Discount"}),e.jsxs(m,{sx:{bgcolor:"primary.main",color:"white",borderRadius:"4px",px:.5,fontSize:"10px",fontWeight:700},children:["Save ",o.yearly_discount,"%"]})]}),e.jsxs(n,{variant:"body2",fontWeight:600,color:"error.main",children:["- ",E(Me)]})]}):null,r?e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Eligible Subtotal"}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:E(cr)})]}):null,F?e.jsxs(e.Fragment,{children:[e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsxs(c,{direction:"row",alignItems:"center",spacing:.75,children:[e.jsxs(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:["Promo Discount (",F.promoCode,")"]}),F.discountPercent>0&&e.jsxs(m,{sx:{bgcolor:"success.main",color:"white",borderRadius:"4px",px:.5,fontSize:"10px",fontWeight:700},children:["Save ",F.discountPercent,"%"]})]}),e.jsxs(n,{variant:"body2",fontWeight:600,color:"error.main",children:["- ",E(Zr)]})]}),e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Subtotal After Promo"}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:E(Xr)})]})]}):null,e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsxs(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:["GST (",O,"%)"]}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:E(et)})]})]}),tt=e.jsx(m,{sx:{display:"flex",flexDirection:"column",gap:"10px",justifyContent:"center",alignItems:"center",minHeight:"180px"},children:Ur?e.jsxs(e.Fragment,{children:[e.jsx($t,{size:48,sx:{my:1}}),e.jsx(n,{sx:{fontSize:"16px",fontWeight:500,color:"text.secondary"},children:"Verifying your payment..."})]}):e.jsxs(e.Fragment,{children:[e.jsxs("svg",{version:"1.1",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 130.2 130.2",width:"90px",children:[e.jsx("circle",{className:"path circle",fill:"none",stroke:"#089b2a",strokeWidth:"6",strokeMiterlimit:"10",cx:"65.1",cy:"65.1",r:"62.1"}),e.jsx("polyline",{className:"path check",fill:"none",stroke:"#089b2a",strokeWidth:"6",strokeLinecap:"round",strokeMiterlimit:"10",points:"100.2,40.2 51.5,88.8 29.8,67.5 "})]}),e.jsx(n,{sx:{fontSize:"24px",fontWeight:600},children:"Congratulations!"}),e.jsx($,{onClick:rt,variant:"contained",sx:{boxShadow:"none",minWidth:"300px",mt:"10px"},children:"Back to Plans"})]})});h.useEffect(()=>{!Array.isArray(A)||!A.length||Fr("planDetails",A)},[]),h.useEffect(()=>{(async()=>{try{const{data:t=[]}=await Ie("planDetails"),i=[];t.forEach(d=>
1{(d.plans||[]).forEach(b=>{(d.product_id==="addon"||b.product_id==="addon")&&i.push({...b,productName:d.product_name||b.plan_name,productDescription:d.description||""})})}),N(i);const s=(Z("planDetails")||[]).find(d=>d.isAddon);if(s&&H){const d=i.find(C=>C.plan_id===s.planId),b=s.users||d?.limits?.min||1;_({[s.planId]:b}),ie(!0)}}catch(t){te.error("Failed to fetch addon plans",t)}})()},[]);const K=(r,t)=>{_(i=>({...i,[r]:t}))},nt=(r,t,i=1)=>{_(s=>{const d={...s};return t?d[r]=i:delete d[r],d})};h.useEffect(()=>{l||we?I("checkout"):ne.get("page")?I(ne.get("page")):B("?page=product",{replace:!0})},[B,ne,l,we]);const Be=()=>{Z("onboardingFlow")?.active?B(`${ae()}/onboarding`):B(we?"/myPlans":"/"),D(!1)},ot=()=>{B("/"),D(!1)},[ve,Ce]=h.useState(!0),[pr,ie]=h.useState(!1),o=f.find(r=>r.productName!=="Voice")||f[0],H=f.some(r=>r.isAddon),xr=H&&o&&z[o.planId]||0,it=H&&o?ee(o,o.subsType)*xr:0,mr=!!o?.isTrialPlan,st=!!o?.fixedUsers,Pe=!!o&&!o?.promotionalPlan,{minUsers:Ee,maxUsers:hr}=Br(o);o&&!H&&f.length===1&&!o?.isTrialPlan&&!o?.promotionalPlan&&Object.keys(z).length===0&&["monthly","quarterly","annual","yearly"].includes(o?.subsType),h.useEffect(()=>{o?.users!==void 0&&o?.users!==null?fe(String(o.users)):fe("")},[o?.planId,o?.users]);const at=r=>{if(!Pe||!o?.planId)return;const t=r.target.value;/^\d*$/.test(t)&&fe(t)},gr=()=>{if(!o?.planId)return;const t=Ir(o,Ne===""?Ee:Ne);fe(String(t)),Re(o.planId,t)},lt=r=>{r.key==="Enter"&&(r.preventDefault(),gr())};if(we){const r=W?.renewalPreview||{},t=Ot(r?.amount,r?.currency||"INR");W?.isExpired||W?.canRenew;let i="renewal_locked";W?.status?i=W.status:W?.isExpired?i="expired":W?.canRenew&&(i="ready_to_renew");const s=Qt(i),d=[{icon:"solar:calendar-mark-line-duotone",label:"Current expiry",value:ke(r?.currentExpiryDate)},{icon:"solar:calendar-add-line-duotone",label:"New expiry",value:ke(r?.newExpiryDate)},{icon:"solar:users-group-rounded-line-duotone",label:"Seats covered",value:r?.seats??W?.purchased_licenses??"
1--"},{icon:"solar:shield-check-line-duotone",label:"Plan status",value:s}];W?.isExpired,W?.isExpired,`${r?.seats??W?.purchased_licenses??"--"}`,r?.currency;const b=e.jsxs(c,{spacing:2.5,alignItems:"center",sx:{textAlign:"center"},children:[e.jsx(m,{sx:{width:64,height:64,borderRadius:"50%",display:"grid",placeItems:"center",bgcolor:j=>U(j.palette.success.main,.12)},children:e.jsx(ue,{icon:"solar:check-circle-bold",width:40,sx:{color:"success.main"}})}),e.jsxs(m,{children:[e.jsx(n,{variant:"h5",sx:{fontWeight:800,mb:.5},children:"Plan Renewed Successfully!"}),e.jsx(n,{variant:"body2",color:"text.secondary",children:"Your payment has been received and your entitlement has been extended."})]}),e.jsxs(m,{sx:{width:"100%",borderRadius:"14px",border:"1px solid",borderColor:"divider",overflow:"hidden"},children:[e.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:2,py:1.5},children:[e.jsx(n,{variant:"body2",color:"text.secondary",children:"Previous expiry"}),e.jsx(n,{variant:"body2",sx:{fontWeight:600},children:ke(r?.currentExpiryDate)})]}),e.jsxs(m,{sx:{display:"flex",justifyContent:"space-between",alignItems:"center",px:2,py:1.5,bgcolor:j=>U(j.palette.success.main,.08),borderTop:"1px solid",borderColor:"divider"},children:[e.jsx(n,{variant:"body2",sx:{fontWeight:600},children:"New expiry"}),e.jsx(n,{variant:"subtitle2",sx:{fontWeight:800,color:"success.main"},children:ke(r?.newExpiryDate)})]})]}),t&&e.jsxs(n,{variant:"body2",color:"text.secondary",children:["Payment of"," ",e.jsx(m,{component:"strong",sx:{color:"text.primary"},children:t})," ","was successfully processed for this renewal."]})]}),C=e.jsxs(e.Fragment,{children:[e.jsx($,{onClick:Be,sx:{height:36,px:2.5,borderRadius:"8px",fontWeight:500,fontSize:"0.875rem",color:"text.secondary",bgcolor:"action.hover","&:hover":{bgcolor:"action.selected"}},children:"View Plan Details"}),e.jsx($,{variant:"contained",onClick:ot,sx:{height:36,px:2.5,borderRadius:"8px",fontWeight:600,fontSize:"0.875rem",boxShadow:"none","&:hover":{boxShadow:"none"}},children:"Go to Dashboard"})]});return e.jsxs(e.Fragment,{children:[T&&e.jsxs(e.Fragment,{children:[e.jsx(fr,{}),e.jsx(jr,{})]}),e.jsxs(kr,{$showChromeSpacing:q,children:[e.jsx(wr,{open:u,title:"Renewal Success",description:b,footer:C,close:()=>Be()}),e.jsx(xe,{sx:{width:"100%",maxWidth:"1000px",borderRadius:"24px",border:"1px solid",borderColor:U(p.palette.primary.main,.12),background:`
2              radial-gradient(circle at top right, ${U(p.palette.primary.main,.14)}, transparent 28%),
3              linear-gradient(180deg, ${U(p.palette.primary.light,.08)} 0%, ${p.palette.background.paper} 38%)
4            `,boxShadow:`0 24px 60px ${U(p.palette.common.black,.08)}`,overflow:"hidden"},children:e.jsxs(m,{sx:{p:{xs:3,md:4},display:"flex",flexDirection:"column",gap:3},children:[W?.message&&e.jsx(Le,{severity:W?.isExpired?"warning":"info",sx:{borderRadius:"16px",px:2,py:1},children:W.message}),e.jsxs(m,{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",gap:4,children:[e.jsx(m,{gridColumn:{xs:"span 12",md:"span 7"},children:e.jsxs(c,{spacing:3,children:[e.jsxs(m,{children:[e.jsx($e,{label:"Renewal Checkout",color:W?.isExpired?"error":"primary",size:"small",sx:{mb:2,fontWeight:700}}),e.jsxs(n,{variant:"h3",sx:{fontWeight:800,mb:1,letterSpacing:"-0.02em"},children:["Renew ",W?.planName||"your plan"]}),e.jsx(n,{color:"text.secondary",sx:{fontSize:"16px",lineHeight:1.6},children:"Complete your renewal to extend your entitlement. Your assigned seats and plan features will remain unchanged."})]}),e.jsx(m,{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:2,children:d.map(j=>e.jsx(m,{sx:{p:2,borderRadius:"16px",bgcolor:U(p.palette.primary.main,.04),border:"1px solid",borderColor:U(p.palette.primary.main,.1)},children:e.jsxs(c,{direction:"row",spacing:1.5,alignItems:"center",children:[e.jsx(ue,{icon:j.icon,width:24,sx:{color:"primary.main"}}),e.jsxs(m,{children:[e.jsx(n,{variant:"caption",color:"text.secondary",sx:{display:"block",textTransform:"uppercase",fontWeight:600,letterSpacing:"0.05em"},children:j.label}),e.jsx(n,{variant:"subtitle2",sx:{fontWeight:700},children:j.value})]})]})},j.label))})]})}),e.jsx(m,{gridColumn:{xs:"span 12",md:"span 5"},children:e.jsx(xe,{sx:{p:{xs:3,md:4},borderRadius:"22px",border:"1px solid",borderColor:U(p.palette.primary.main,.16),boxShadow:"none",backgroundColor:U(p.palette.background.paper,.94),height:"100%",display:"flex",flexDirection:"column"},children:e.jsxs(c,{spacing:3,sx:{flexGrow:1},p:2,children:[e.jsx(n,{variant:"h6",sx:{fontWeight:700},children:"Order Summary"}),e.jsxs(m,{sx:{p:3,borderRadius:"20px",bgcolor:U(p.palette.primary.main,.08),border:"1px dashed",borderColor:U(p.palette.primary.main,.2)},children:[e.jsx(n,{variant:"body2",color:"text.secondary",sx:{fontWeight:600,mb:.5},children:"Total Due"}),e.jsx(n,{variant:"h3",sx:{fontWeight:800,color:"primary.dark"},children:t})]}),!W?.canRenew&&e.jsx(Le,{severity:"warning",sx:{borderRadius:"14px"},children:"Renewal is currently unavailable for this plan."}),e.jsxs(c,{spacing:1.5,sx:{mt:"auto",pt:2},children:[e.jsx($,{variant:"contained",size:"large",onClick:_r,disabled:Fe||Y||!W?.canRenew,sx:{py:1.5,borderRadius:"12px",fontSize:"16px",fontWeight:700},children:Y?"Processing...":"Proceed to Payment"}),e.jsx($,{variant:"outlined",size:"large",onClick:ir,disabled:Fe||Y,sx:{py:1.5,borderRadius:"12px",fontWeight:600},children:Fe?"Refreshing...":"Refresh Status"}),e.jsx($,{variant:"text",size:"large",onClick:()=>B("/myPlans"),sx:{fontWeight:600},children:"Cancel & Return"})]})]})})})]})]})})]})]})}return e.jsxs(e.Fragment,{children:[T&&e.jsxs(e.Fragment,{children:[e.jsx(fr,{}),e.jsx(jr,{})]}),e.jsxs(kr,{$showChromeSpacing:q,style:l?{height:"auto",padding:0,border:"1px solid #dcdfe4",borderRadius:"6px",overflow:"hidden"}:{},children:[e.jsx(wr,{open:u,title:"Checkout",description:tt,close:()=>Be()}),e.jsxs(m,{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",gap:4,sx:{borderColor:"divider",overflow:"auto"},children:[e.jsx(m,{gridColumn:{xs:"span 12",md:"span 7"},children:e.jsxs(c,{spacing:0,sx:{p:2},children:[!l&&e.jsx($,{onClick:()=>{const r=ne.get("from")||P.state?.from;B(r||-1)},startIcon:e.jsx(ue,{icon:"solar:arrow-left-linear",width:20,sx:{color:"primary.main"}}),sx:{color:"primary.main",fontWeight:600,textTransform:"none",alignSelf:"flex-start",mb:1,"&:hover":{bgcolor:"action.hover"}},children:"Back"}),!mr&&H&&v.length>0&&(()=>{const r=f.find(w=>w.isAddon);if(!r)return null;const t=v.find(w=>w.plan_id===r.planId);if(!t)return null;const i=z[t.plan_id]||0,s=i>0,d=!!t.limits,b=t.limits?.min||1,C=t.limits?.max||100,j=t.limits?.unit||"units",R=ee(t,o?.subsType),k=R*i;return e.jsxs(m,{sx:{mb:2},children:[e.jsx(n,{variant:"h6",sx:{fontWeight:400,fontSize:"18px",color:"primary.main",mb:2,px:2},children:"Your Selected Add-on"}),e.jsxs(xe,{sx:{border:"1.5px solid",borderColor:s?"primary.main":"divider",borderRadius:"12px",boxShadow:s?"0 2px 12px rgba(0,97,242,0.12)":"none",overflow:"hidden",transition:"all 0.25s ease",bgcolor:"background.paper"},children:[e.jsxs(m,{sx:{px:2,py:1.5,bgcolor:w=>w.palette.mode==="dark"?"rgba(87,157,255,0.12)":"#EBF3FF",borderBottom:w=>`1px solid ${w.palette.mode==="dark"?"rgba(87,157,255,0.2)":"#D0E4FF"}`,display:"flex",alignItems:"center",justifyContent:"space-between"},children:[e.jsxs(c,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(n,{variant:"subtitle2",fontWeight:700,sx:{fontSize:"15px",color:"primary.main"},children:t.plan_name}),e.jsx($e,{label:"Selected",size:"small",sx:{height:20,fontSize:"10px",fontWeight:700,bgcolor:"primary.main",color:"#fff",borderRadius:"6px"}})]}),e.jsxs(n,{variant:"body2",fontWeight:700,sx:{color:"primary.main",fontSize:"14px",whiteSpace:"nowrap"}
4,children:["₹",R.toLocaleString("en-IN"),"/",j]})]}),t.productDescription&&e.jsx(m,{sx:{px:2.5,pt:1},children:e.jsx(n,{variant:"caption",sx:{color:"text.secondary",fontSize:"12px"},children:t.productDescription})}),e.jsxs(m,{sx:{px:2.5,py:2},children:[e.jsxs(c,{direction:"row",alignItems:"center",justifyContent:"space-between",mb:1,children:[e.jsx(n,{variant:"body2",sx:{color:"text.primary",fontSize:"13px",fontWeight:500},children:"Select Amount"}),e.jsxs(n,{variant:"body2",fontWeight:700,sx:{color:"primary.main",fontSize:"13px"},children:[i," ",j," — ₹",k.toLocaleString("en-IN")]})]}),d?e.jsxs(c,{direction:"row",alignItems:"center",spacing:2,children:[e.jsx(n,{variant:"caption",sx:{color:"text.disabled",minWidth:24},children:b}),e.jsx(Cr,{value:i,min:b,max:C,onChange:(w,Ue)=>K(t.plan_id,Ue),size:"small",sx:{flex:1,color:"primary.main","& .MuiSlider-thumb":{width:18,height:18,bgcolor:"primary.main",boxShadow:"0 0 0 4px rgba(0,97,242,0.16)"},"& .MuiSlider-track":{bgcolor:"primary.main",border:"none"},"& .MuiSlider-rail":{bgcolor:w=>w.palette.mode==="dark"?"rgba(87,157,255,0.15)":"#D0E4FF"}}}),e.jsx(n,{variant:"caption",sx:{color:"text.disabled",minWidth:30},children:C}),e.jsx(Ke,{qty:i,min:b,max:C,onCommit:w=>K(t.plan_id,w),sx:{width:72,"& .MuiInputBase-input":{textAlign:"center",fontWeight:700,color:"primary.main"},"& .MuiOutlinedInput-root":{borderRadius:"8px","& fieldset":{borderColor:"primary.main"}}}})]}):e.jsxs(c,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(le,{onClick:()=>K(t.plan_id,i-1),disabled:i<=1,size:"small",sx:{border:"1px solid",borderColor:w=>i<=1?w.palette.divider:w.palette.primary.main,color:w=>i<=1?w.palette.text.disabled:w.palette.primary.main,borderRadius:"8px",width:36,height:36},children:e.jsx(Ge,{fontSize:"small"})}),e.jsx(n,{variant:"h6",sx:{fontWeight:700,minWidth:40,textAlign:"center",color:"primary.main"},children:i}),e.jsx(le,{onClick:()=>K(t.plan_id,i+1),size:"small",sx:{border:"1px solid",borderColor:"primary.main",color:"primary.main",borderRadius:"8px",width:36,height:36},children:e.jsx(Ve,{fontSize:"small"})})]})]})]})]})})(),!H&&!o?.promotionalPlan&&e.jsxs(e.Fragment,{children:[e.jsxs(Oe,{disableGutters:!0,expanded:ve,onChange:(r,t)=>{Ce(t),t&&ie(!1)},sx:{boxShadow:"none !important",bgcolor:"background.paper","&.Mui-expanded":{boxShadow:"none !important"},"&::before":{display:"none"}},children:[e.jsx(Qe,{expandIcon:e.jsx(He,{}),sx:{px:2,bgcolor:"background.paper"},children:e.jsx(n,{variant:"h6",color:ve?"primary":"grey.700",sx:{fontWeight:500,fontSize:"18px"},children:"Add Add-ons"})}),e.jsx(Je,{sx:{bgcolor:"background.paper",mt:"-10px"},children:o&&e.jsx(xe,{sx:{p:2.5,border:"1px solid",borderColor:"grey.200",bgcolor:"background.paper",borderRadius:"8px",boxShadow:"none"},children:e.jsx(m,{display:"grid",gridTemplateColumns:"repeat(12, 1fr)",gap:2,alignItems:"center",children:e.jsxs(m,{gridColumn:{xs:"span 12",md:"span 5"},children:[e.jsx(n,{variant:"subtitle2",align:"center",gutterBottom:!0,sx:{color:"grey.1000"},children:"Number of Users"}),e.jsxs(c,{direction:"row",alignItems:"center",justifyContent:"center",spacing:2,sx:{mt:2},children:[e.jsx(le,{onClick:r=>Qr(r,o.name,o.planId),disabled:o.users<=Ee||!Pe,sx:{border:"1px solid",borderColor:"divider",borderRadius:"8px",width:48,height:48},children:e.jsx(Ge,{})}),e.jsx(Ae,{size:"small",type:"text",value:Ne,onChange:at,onBlur:gr,onKeyDown:lt,disabled:!Pe,inputProps:{inputMode:"numeric",pattern:"[0-9]*",min:Ee,max:hr,"aria-label":"Number of users"},sx:{width:96,"& .MuiInputBase-input":{textAlign:"center",fontWeight:700,fontSize:"1.5rem",color:"primary.dark",py:1},"& .MuiOutlinedInput-root":{borderRadius:"10px"}}}),e.jsx(le,{onClick:r=>Or(r,o.name,o.planId),disabled:o.users>=hr||!Pe,sx:{border:"1px solid",borderColor:"divider",borderRadius:"8px",width:48,height:48},children:e.jsx(Ve,{})})]})]})})})})]}),!mr&&v.length>0&&!st&&!o?.promotionalPlan&&e.jsxs(Oe,{disableGutters:!0,defaultExpanded:!0,sx:{boxShadow:"none !important",bgcolor:"background.paper","&.Mui-expanded":{boxShadow:"none !important"},"&::before":{display:"none"}},children:[e.jsx(Qe,{expandIcon:e.jsx(He,{}),sx:{px:2,bgcolor:"background.paper"},children:e.jsx(n,{variant:"h6",sx:{fontWeight:500,fontSize:"18px",color:"grey.700"},children:"Available Add-ons"})}),e.jsx(Je,{sx:{bgcolor:"background.paper",mt:"-10px"},children:e.jsx(c,{spacing:2,children:v.map(r=>{const t=z[r.plan_id]||0,i=t>0,s=!!r.limits,d=r.limits?.min||1,b=r.limits?.max||100,C=r.limits?.unit||"units",j=ee(r,o?.subsType),R=j*t;return e.jsxs(xe,{sx:{border:"1.5px solid",borderColor:i?"primary.main":"divider",borderRadius:"12px",boxShadow:i?"0 2px 12px rgba(0,97,242,0.12)":"none",overflow:"hidden",transition:"all 0.25s ease",bgcolor:"background.paper"},children:[e.jsxs(m,{sx:{px:2,py:1.5,bgcolor:k=>i?k.palette.mode==="dark"?"rgba(87,157,255,0.12)":"#EBF3FF":"background.neutral",borderBottom:k=>`1px solid ${k.palette.mode==="dark"?"rgba(87,157,255,0.15)":i?"#D0E4FF":"#F0F0F0"}`,display:"flex",alignItems:"center",justifyContent:"space-between"}
4,children:[e.jsx(Dr,{sx:{m:0},control:e.jsx(Rr,{checked:i,onChange:k=>nt(r.plan_id,k.target.checked,d),sx:{color:"text.disabled","&.Mui-checked":{color:"primary.main"},p:.5,mr:1}}),label:e.jsxs(c,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(n,{variant:"subtitle2",fontWeight:700,sx:{fontSize:"15px",color:i?"primary.main":"text.primary"},children:r.plan_name}),i&&e.jsx($e,{label:"Active",size:"small",sx:{height:20,fontSize:"10px",fontWeight:700,bgcolor:"primary.main",color:"#fff",borderRadius:"6px"}})]})}),e.jsxs(n,{variant:"body2",fontWeight:700,sx:{color:i?"primary.main":"text.secondary",fontSize:"14px",whiteSpace:"nowrap"},children:["₹",j.toLocaleString("en-IN"),"/",C]})]}),r.productDescription&&e.jsx(m,{sx:{px:2.5,pt:1},children:e.jsx(n,{variant:"caption",sx:{color:"text.secondary",fontSize:"12px"},children:r.productDescription})}),i&&e.jsxs(m,{sx:{px:2.5,py:2},children:[e.jsxs(c,{direction:"row",alignItems:"center",justifyContent:"space-between",mb:1,children:[e.jsx(n,{variant:"body2",sx:{color:"text.primary",fontSize:"13px",fontWeight:500},children:"Select Amount"}),e.jsxs(n,{variant:"body2",fontWeight:700,sx:{color:"primary.main",fontSize:"13px"},children:[t," ",C," — ₹",R.toLocaleString("en-IN")]})]}),s?e.jsxs(c,{direction:"row",alignItems:"center",spacing:2,children:[e.jsx(n,{variant:"caption",sx:{color:"text.disabled",minWidth:24},children:d}),e.jsx(Cr,{value:t,min:d,max:b,onChange:(k,w)=>K(r.plan_id,w),size:"small",sx:{flex:1,color:"primary.main","& .MuiSlider-thumb":{width:18,height:18,bgcolor:"primary.main",boxShadow:"0 0 0 4px rgba(0,97,242,0.16)"},"& .MuiSlider-track":{bgcolor:"primary.main",border:"none"},"& .MuiSlider-rail":{bgcolor:k=>k.palette.mode==="dark"?"rgba(87,157,255,0.15)":"#D0E4FF"}}}),e.jsx(n,{variant:"caption",sx:{color:"text.disabled",minWidth:30},children:b}),e.jsx(Ke,{qty:t,min:d,max:b,onCommit:k=>K(r.plan_id,k),sx:{width:72,"& .MuiInputBase-input":{textAlign:"center",fontWeight:700,color:"primary.main"},"& .MuiOutlinedInput-root":{borderRadius:"8px","& fieldset":{borderColor:"primary.main"}}}})]}):e.jsxs(c,{direction:"row",alignItems:"center",spacing:1,children:[e.jsx(le,{onClick:()=>K(r.plan_id,t-1),disabled:t<=1,size:"small",sx:{border:"1px solid",borderColor:k=>t<=1?k.palette.divider:k.palette.primary.main,color:k=>t<=1?k.palette.text.disabled:k.palette.primary.main,borderRadius:"8px",width:36,height:36},children:e.jsx(Ge,{fontSize:"small"})}),e.jsx(n,{variant:"h6",sx:{fontWeight:700,minWidth:40,textAlign:"center",color:"primary.main"},children:t}),e.jsx(le,{onClick:()=>K(r.plan_id,t+1),size:"small",sx:{border:"1px solid",borderColor:"primary.main",color:"primary.main",borderRadius:"8px",width:36,height:36},children:e.jsx(Ve,{fontSize:"small"})})]})]})]},r.plan_id)})})})]})]}),e.jsxs(Oe,{disableGutters:!0,expanded:pr,onChange:(r,t)=>{ie(t),t&&Ce(!1)},sx:{boxShadow:"none !important",bgcolor:"background.paper","&.Mui-expanded":{boxShadow:"none !important",backgroundColor:"background.paper"},"&::before":{display:"none"}},children:[e.jsx(Qe,{sx:{px:2},expandIcon:e.jsx(He,{}),children:e.jsx(n,{variant:"h6",color:pr?"primary":"grey.700",sx:{fontWeight:500,fontSize:"18px"},children:"Billing Address"})}),e.jsx(Je,{sx:{px:0,mt:"-20px"},children:e.jsx(Ze,{billingAddress:J,handleBillingAddress:Er,isOnboarding:l,onContinueToPayment:()=>De(),onValidationError:()=>{ie(!0),Q(!1)},ref:S})})]})]})}),e.jsx(m,{gridColumn:{xs:"span 12",md:"span 5"},children:e.jsxs(m,{className:"order-summary",sx:{bgcolor:r=>r.palette.mode==="dark"?"#22272b":"primary.100",height:"100%",p:"20px"},children:[e.jsx(n,{variant:"h6",color:"primary",gutterBottom:!0,children:"Order Summary"}),H&&e.jsxs(e.Fragment,{children:[e.jsx(n,{variant:"subtitle2",sx:{color:"grey.800",fontSize:"14px"},gutterBottom:!0,children:"Add-on Plan"}),e.jsx(X,{}),e.jsxs(c,{direction:"row",justifyContent:"space-between",alignItems:"baseline",mb:2,mt:"15px",children:[e.jsx(n,{variant:"h5",fontWeight:700,sx:{color:"grey.1100",fontSize:"16px"},children:o.name||o.plan_name}),e.jsx(n,{variant:"h4",fontWeight:700,sx:{color:"grey.1100",fontSize:"16px"},children:E(it)})]}),e.jsxs(c,{spacing:2,mb:4,children:[o.limits?.unit&&e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Unit"}),e.jsxs(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:[xr||o.limits?.min||1," ",o.limits.unit]})]}),o.limits?.storage&&e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Storage"}),e.jsxs(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:[o.limits.storage," GB"]})]}),o.productName&&e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Product"}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:o.productName})]})]}),e.jsx(X,{sx:{mb:2}}),dr(),ur({showAnnualDiscount:!0}),e.jsxs(c,{direction:"row",justifyContent:"space-between",mb:4,children:[e.jsx(n,{variant:"h6",fontWeight:700,sx:{color:"grey.1100",fontSize:"16px"},children:"Total"}),e.jsx(n,{variant:"h5",fontWeight:700,sx:{color:"grey.1100",fontSize:"16px"},children:E(de)})]}),e.jsx(X,{sx:{mb:2}}),e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsxs(n,{variant:"body2",fontWeight:600,sx:{color:"grey.1100",fontSize:"16px"},children:["Total"," ",(()=>{const r=o.subsType;return r==="annual"||r==="yearly"?"Annually":r==="quarterly"?"Quarterly":"Monthly"})()," ","Bill"]}),e.jsx(n,{variant:"body1",fontWeight:700,sx:{color:"grey.1100",fontSize:"16px"},children:E(de)})]}),e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"caption",color:"text.secondary",sx:{color:"grey.800",fontSize:"14px"},children:"Next Billing Cycle"}),e.jsx(n,{variant:"caption",color:"text.secondary",sx:{color:"grey.800",fontSize:"14px"},children:(()=>{const r=new Date;if(o?.isTrialPlan)r.setDate(r.getDate()+15);else{const i=o.subsType,s=i==="annual"||i==="yearly"?12:i==="quarterly"?3:1;r.setMonth(r.getMonth()+s)}return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`})()})]}),e.jsx(m,{sx:{mt:3},children:e.jsx($,{fullWidth:!0,size:"large",loading:Y,onClick:()=>
4{if(ve){Ce(!1),ie(!0);return}Y||(Q(!0),S.current?S.current.submit():De())},variant:"contained",color:"primary",sx:{py:1.5,fontSize:"16px",fontWeight:600,textTransform:"none",borderRadius:"8px"},endIcon:e.jsx(ue,{icon:"icon-park-outline:check-one"}),children:"Continue to Payment"})})]}),!H&&o&&e.jsxs(e.Fragment,{children:[e.jsx(n,{variant:"subtitle2",sx:{color:"grey.800",fontSize:"14px"},gutterBottom:!0,children:"Plan Name"}),e.jsx(X,{}),e.jsxs(c,{direction:"row",justifyContent:"space-between",alignItems:"baseline",mb:4,mt:"15px",children:[e.jsx(n,{variant:"h5",fontWeight:700,sx:{color:"grey.1100",fontSize:"16px"},children:o.planName||o.name||""}),e.jsx(n,{variant:"h4",fontWeight:700,sx:{color:"grey.1100",fontSize:"16px"},children:E(o.actualPrice)})]}),e.jsxs(c,{spacing:2,mb:4,children:[e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Billing"}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:Vr?.[o.subsType]||"Annual"})]}),e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"User(s)"}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:o.users})]}),o.storagePerUser&&e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Storage per User"}),e.jsxs(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:[o.storagePerUser," GB"]})]}),o.storage&&e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Storage"}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:o.storagePerUser?`${o.storagePerUser} GB/user (Total ${o.storagePerUser*o.users} GB)`:`${o.storage} GB`})]}),e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"API Calls"}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:o.apiCalls||o.api_calls?`${o.apiCalls||o.api_calls}/user/month`:"Unlimited"})]}),e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Team Size"}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:o.teamSize||o.team_size||"Unlimited"})]}),e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Contacts"}),e.jsx(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:o.contacts||"Unlimited"})]}),(()=>{const r=o.archiveStorageGb??o.archive_storage??o.archiveStorage??null,t=o.attachmentLimitMb??o.attachment_limit??o.attachmentLimit??null;return e.jsxs(e.Fragment,{children:[r!=null&&r>0&&e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Archive Storage"}),e.jsxs(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:[r," GB"]})]}),t!=null&&t>0&&e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:"Attachment Limit"}),e.jsxs(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"},children:[t," MB"]})]})]})})()]}),v.filter(r=>(z[r.plan_id]||0)>0).length>0&&e.jsxs(e.Fragment,{children:[e.jsx(X,{sx:{my:2}}),e.jsx(n,{variant:"subtitle2",sx:{color:"grey.800",fontSize:"14px",mb:1},children:"Add-ons"}),e.jsx(c,{spacing:1,mb:2,children:v.filter(r=>(z[r.plan_id]||0)>0).map(r=>{const t=z[r.plan_id],i=ee(r,o?.subsType)*t,s=r.limits?.unit?` ${r.limits.unit}`:"";return e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsxs(n,{variant:"body2",sx:{color:"grey.800",fontSize:"14px"},children:[r.plan_name," × ",t,s]}),e.jsxs(n,{variant:"body2",fontWeight:600,sx:{color:"grey.800",fontSize:"14px"}
4,children:["₹",i.toLocaleString("en-IN")]})]},r.plan_id)})})]}),e.jsx(X,{sx:{mb:2}}),dr(),ur({showAnnualDiscount:!0}),e.jsxs(c,{direction:"row",justifyContent:"space-between",mb:4,children:[e.jsx(n,{variant:"h6",fontWeight:700,sx:{color:"grey.1100",fontSize:"16px"},children:"Total"}),e.jsx(n,{variant:"h5",fontWeight:700,sx:{color:"grey.1100",fontSize:"16px"},children:E(de)})]}),e.jsx(X,{sx:{mb:2}}),e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsxs(n,{variant:"body2",fontWeight:600,sx:{color:"grey.1100",fontSize:"16px"},children:["Total"," ",(()=>{const r=o.subsType;return r==="annual"||r==="yearly"?"Annually":r==="quarterly"?"Quarterly":"Monthly"})()," ","Bill"]}),e.jsx(n,{variant:"body1",fontWeight:700,sx:{color:"grey.1100",fontSize:"16px"},children:E(de)})]}),e.jsxs(c,{direction:"row",justifyContent:"space-between",children:[e.jsx(n,{variant:"caption",color:"text.secondary",sx:{color:"grey.800",fontSize:"14px"},children:"Next Billing Cycle"}),e.jsx(n,{variant:"caption",color:"text.secondary",sx:{color:"grey.800",fontSize:"14px"},children:(()=>{const r=new Date;if(o?.isTrialPlan)r.setDate(r.getDate()+15);else{const i=o.subsType,s=i==="annual"||i==="yearly"?12:i==="quarterly"?3:1;r.setMonth(r.getMonth()+s)}return`${["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"][r.getMonth()]} ${r.getDate()}, ${r.getFullYear()}`})()})]}),e.jsx(m,{sx:{mt:3},children:e.jsx($,{fullWidth:!0,size:"large",loading:Y,onClick:()=>{if(ve){Ce(!1),ie(!0);return}Y||(Q(!0),S.current?S.current.submit():De())},variant:"contained",color:"primary",sx:{fontSize:"16px",fontWeight:600,textTransform:"none",borderRadius:"8px"},endIcon:e.jsx(ue,{icon:"icon-park-outline:check-one"}),children:"Continue to Payment"})})]})]})})]})]})]})};
4Yt.propTypes={isOnboarding:g.bool,standalone:g.bool};export{Yt 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.