1import{r as i,j as e,P as c}from"./react-CRjXmzdu.js";import{m as rt,at as Z,au as de,D as J,p as G,a as te,L as me,r as pe,d as lt,g as Fe,i as _e,av as Se,aw as ct,ax as dt}from"./index-CSKv4Qvu.js";import"./vendor-COBpgtl7.js";import{u as ne}from"./i18n-BIJR05_R.js";import{T as be}from"./TablePaginationBar-CcFH5zAf.js";import{k as ye,c9 as pt,ai as xt,P as je,F as we,ca as ht,r as Ce,t as ve,v as ke,w as q,y as Pe,x as N,T as u,bO as le,o as ee,aS as ce,a6 as z,K as $,B as F,s as M,cb as ut,cc as gt,a as Ie,ae as ft,a2 as mt,cd as bt,bK as yt,ce as jt,cf as wt,cg as Te,aw as Ae,aG as De,aH as We,bd as Re,I as Ct,ch as vt,ci as kt,p as Pt,q as St,bx as It}from"./mui-BxdtjvkT.js";import{I as Y}from"./iconify-DtB_gzCW.js";import{d as ge}from"./date-utils-Cj6NCtA4.js";import{u as Ne,e as He,a as Tt}from"./router-BwRsLQU1.js";import{b as At}from"./redux-Dts5QXDw.js";import{C as Dt}from"./customModal-mNYZj1a8.js";import{d as Wt}from"./razorpay-CbIdk-Ni.js";import{S as fe}from"./SecureTextField-BhPVzz9v.js";import"./react-query-BRXozuDR.js";import"./lodash-CpjO0APP.js";import"./ui-utils-DqNXFlDe.js";import"./http-DoGoLSvF.js";import"./sanitize-B6Pz2xYC.js";import"./validation-B8dh9o27.js";import"./emotion-CfcNTy1E.js";import"./firebase-Deeb8HW7.js";const Rt=new me("myPlansSection"),Lt=M(N)(({theme:t})=>({backgroundColor:t.palette.background.paper}));function $e({usersList:t=[],count:w,isListLoading:g,page:C,setPage:W,rowsPerPage:B,setRowsPerPage:b,setLoad:v,calcSize:x=201,onRenewPlan:S}){const{t:s}=ne(),k=[{id:"product",label:s("console.plans.productName"),minWidth:170},{id:"plan_name",label:s("console.plans.planName"),minWidth:170},{id:"planId",label:"Plan ID",minWidth:220},{id:"storagePerLicenseGb",label:"Storage",minWidth:120,align:"center"},{id:"status",label:s("console.plans.status"),minWidth:130,align:"center"},{id:"purchaseDate",label:"Purchase Date",minWidth:170},{id:"expiryDate",label:s("console.plans.expiryDate"),minWidth:170},{id:"purchased_licenses",label:s("console.plans.licence"),minWidth:90,align:"center"},{id:"left_licenses",label:s("console.plans.licenceLeft"),minWidth:100,align:"center"},...rt("plans_action_column")?[{id:"actions",label:s("console.plans.actions"),minWidth:180,align:"center"}]:[]],[I,E]=i.useState(""),[m,T]=i.useState(!1),[o,y]=i.useState(""),[n,l]=i.useState(100),[f,R]=i.useState(""),P=ye(),U=P.palette.background.paper,d=pt(P,{typography:{fontFamily:"'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif"}}),A=(p,h)=>{W(h),v&&v(!0)},K=p=>{b(Number(p.target.value)),W(0),v&&v(!0)},se=async p=>{try{l(100),y(p),T(!0);const{userPassword:h}=await te("fetchPassword",{email:p});E(h),J(h),G(s("console.plans.passwordCopied"));const a=setInterval(()=>{l(r=>r<=0?0:r-10)},1e3);R(a)}catch(h){Rt.error(h),pe(h?.message||"Network error!")}finally{T(!1)}},j=(p,h,a,r)=>{let L="default";return a==="active"?L="success":a==="expiring_soon"?L="warning":r?.isExpired&&(L="error"),e.jsxs(ee,{direction:"row",spacing:1,justifyContent:"center",alignItems:"center",sx:{width:"100%"},children:[e.jsx(ce,{label:Z(a||"inactive"),color:L,size:"small"}),r?.isExpiringSoon&&!r?.isExpired&&e.jsx(ce,{label:s("console.plans.renewSoon"),size:"small",variant:"outlined",color:"warning"})]})},H=(p,h,a,r)=>{const L=r?.startedAt||r?.startDate||r?.start_date||a;if(!L)return"--";const{date:xe,time:ie}=de(L);return e.jsxs(ee,{spacing:.5,children:[e.jsx(u,{variant:"body2",sx:{fontWeight:600},children:xe}),e.jsx(u,{variant:"caption",color:"text.secondary",children:ie})]})},V=(p,h,a,r)=>{if(!a)return"--";const{date:L,time:xe}=de(a);let ie="text.secondary";return r?.isExpired?ie="error.main":r?.isExpiringSoon&&(ie="warning.main"),e.jsxs(ee,{spacing:.5,children:[e.jsx(u,{variant:"body2",sx:{fontWeight:600},children:L}),e.jsx(u,{variant:"caption",color:ie,children:xe})]})},O=(p,h,a,r)=>{const L=a||r?.plan_id||"--";return L==="--"?L:e.jsx(z,{title:s("console.plans.checkToCopy"),children:e.jsx(u,{variant:"body2",sx:{fontFamily:"monospace",cursor:"pointer"},onClick:()=>{J(L),G("Plan ID copied")},children:L})})},ae=(p,h,a,r)=>{const L=a??r?.storagePerLicenseGb??r?.storage??r?.limits?.storageGb??r?.left_storage??null;return L==null||L===""?"--":`${L} GB`},D=(p,h,a,r)=>e.jsx(ee,{direction:"row",spacing:1,justifyContent:"center",alignItems:"center",children:r?.showRenewButton&&(r?.isExpired||r?.isExpiringSoon||r?.status==="expiring_soon")?e.jsx($,{size:"small",variant:"contained",color:"primary",onClick:()=>S?.(r),sx:{backgroundColor:"primary.main",color:"#fff","&:hover":{backgroundColor:"primary.dark"}},children:s("console.plans.renewPlan")}):e.jsx(u,{variant:"body2",color:"text.secondary",children:"--"})}),_=(p,h,a,r)=>a?e.jsxs(F,{sx:{width:"100%",display:"flex",flexDirection:"row",gap:"7px",alignItems:"center",justifyContent:"center"},children:[I&&o===r?.email&&I,e.jsx(z,{title:I&&o===r?.email?s("console.plans.passwordCopiedTooltip"):s("console.plans.copyPassword"),children:e.jsx($,{loading:o===r?.email?m:!1,loadingPosition:"start",size:"small",color:o===r?.email&&I?"success":"primary",sx:{borderRadius:"50%",minWidth:"auto"},onClick:()=>se(r?.email),children:!(o===r?.email&&m)&&e.jsx(Y,{icon:"prime:copy",width:"20px"})})})]}):e.jsx(e.Fragment,{children:"--"}),Je=(p,h,a)=>a?e.jsx(z,{title:s("console.plans.signedUpGoogle"),children:e.jsx(Y,{icon:"heroicons-solid:shield-check",color:P.palette.primary.main,width:"20px"})}):"--",Ke=(p,h,a,r)=>a?e.jsxs(F,{sx:{width:"100%",display:"flex",flexDirection:"row",gap:"7px",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(z,{title:s("console.plans.checkToCopy"),children:e.jsx(u,{variant:"inherit",onClick:()=>{J(a),G(s("console.plans.mobileNumCopied"))},children:a})}),r?.forceVerify?e.jsx(z,{title:s("console.plans.forcefullyVerify"),children:e.jsx(Y,{icon:"mdi:shield",width:"15px",style:{color:P.palette.warning.main}})}):r?.isMobileVerified===1?e.jsx(z,{title:s("console.plans.verifiedLabel"),children:e.jsx(Y,{icon:"bitcoin-icons:verify-filled",width:"20px",style:{color:P.palette.success.main}})}):e.jsx(z,{title:s("console.plans.unverifiedLabel"),children:e.jsx(Y,{icon:"mdi:cross-circle-outline",width:"15px",style:{color:P.palette.error.main}})})]}):"--",Xe=(p,h,a)=>a?e.jsx(z,{title:s("console.plans.checkToCopy"),children:e.jsx(u,{variant:"inherit",onClick:()=>{J(a),G(s("console.plans.userIdCopied"))},children:a})}):"--",Qe=(p,h,a,r)=>a?e.jsxs(F,{sx:{width:"100%",display:"flex",flexDirection:"row",gap:"7px",alignItems:"center",justifyContent:"flex-start"},children:[e.jsx(z,{title:s("console.plans.checkToCopy"),children:e.jsx(u,{variant:"inherit",onClick:()=>{J(a),G(s("console.plans.emailCopied"))},children:a})}),r?.forceVerify?e.jsx(z,{title:s("console.plans.forcefullyVerify"),children:e.jsx(Y,{icon:"mdi:shield",width:"15px",style:{color:P.palette.warning.main}})}):r?.isEmailVerified===1?e.jsx(z,{title:s("console.plans.verifiedLabel"),children:e.jsx(Y,{icon:"bitcoin-icons:verify-filled",width:"20px",style:{color:P.palette.success.main}})}):e.jsx(z,{title:s("console.plans.unverifiedLabel"),children:e.jsx(Y,{icon:"mdi:cross-circle-outline",width:"15px",style:{color:P.palette.error.main}})})]}):"--",Ze=(p,h,a,r)=>a?e.jsx(u,{variant:"body2",children:s("console.plans.manualVerification")}):r?.verified?e.jsx(u,{variant:"body2",children:s("console.plans.selfVerification")}):"--",et=(p,h,a)=>e.jsx(F,{sx:{width:"100%",display:"flex",flexDirection:"row",gap:"7px",alignItems:"center",justifyContent:"flex-start"},children:e.jsx(z,{title:s("console.plans.checkToCopy"),children:e.jsx(u,{variant:"inherit",onClick:()=>{J(a),G(s("console.plans.nameCopied"))},children:Z(a)})})}),tt=(p,h,a)=>e.jsx(F,{sx:{width:"100%",display:"flex",flexDirection:"row",gap:"7px",alignItems:"center",justifyContent:"flex-start"},children:e.jsx(z,{title:s("console.plans.checkToCopy"),children:e.jsx(u,{variant:"inherit",onClick:()=>{J(a),G(s("console.plans.userNameCopied"))},children:Z(a)})})}),nt=(p,h,a)=>Z(a),st=(p,h,a)=>{const{date:r,time:L}=de(a);return`${r}, ${L}`},at=(p,h,a)=>e.jsx(z,{title:a==="l4"?"Admin (L4)":"User (L1)",children:a==="l4"?"L4":"L1"}),it=(p,h,a)=>a!==void 0?a:"--",ot={name:et,userStatus:j,mobile:Ke,email:Qe,userId:Xe,password:_,isGoogleLogin:Je,actions:D,verifiedForcefully:Ze,origin:nt,permission:at,createdAt:st,userName:tt,status:j,purchaseDate:H,expiryDate:V,planId:O,storagePerLicenseGb:ae};return i.useEffect(()=>{n||(clearInterval(f),y(""),R(""),E(""))},[n]),e.jsxs(xt,{theme:d,children:[e.jsx("link",{rel:"stylesheet",href:"https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap"}),e.jsxs(je,{sx:{width:"100%",overflow:"hidden",borderRadius:"0px",boxShadow:"none"},children:[!t.length&&!g?e.jsx(we,{icon:e.jsx(ht,{}),title:s("console.plans.noPlansFound"),description:s("console.plans.noPlansDescription"),sx:{width:"100%",minHeight:260}}):e.jsx(Ce,{sx:{maxHeight:window.innerHeight-x,"&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:P.palette.grey[400],borderRadius:"8px"},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:P.palette.grey[600]},scrollbarWidth:"thin",scrollbarColor:`${P.palette.grey[400]} transparent`},children:e.jsxs(ve,{stickyHeader:!0,"aria-label":"sticky table",size:"small",children:[e.jsx(ke,{sx:{backgroundColor:U,borderTop:"1px solid",borderBottom:"1px solid",borderColor:"divider",wordBreak:"keep-all",whiteSpace:"nowrap"},children:e.jsx(q,{children:k.map(p=>e.jsx(Lt,{align:p.align,style:{minWidth:p.minWidth},sx:{backgroundColor:`${U} !important`},children:p.label},p.id))})}),e.jsxs(Pe,{children:[!g&&!!t.length&&t.map(p=>
1e.jsx(q,{hover:!0,role:"checkbox",tabIndex:-1,children:k.map(h=>{const{id:a}=h,r=p[a];return e.jsx(N,{align:h.align,sx:{color:"grey.800",fontWeight:500},children:h.format&&typeof r=="number"?h.format(r):(ot?.[a]||it)(a,h?.align,p[a],p)},a)})},p.code)),g&&e.jsxs(e.Fragment,{children:[e.jsx(q,{hover:!0,role:"checkbox",tabIndex:-1,children:k.map(p=>{const{id:h}=p;return e.jsx(N,{align:p.align,sx:{color:"grey.300",fontWeight:500},children:e.jsx(u,{component:"div",variant:"body1",sx:{maxWidth:"70%"},children:e.jsx(le,{})},"body1")},h)})}),e.jsx(q,{hover:!0,role:"checkbox",tabIndex:-1,children:k.map(p=>{const{id:h}=p;return e.jsx(N,{align:p.align,sx:{color:"grey.300",fontWeight:500},children:e.jsx(u,{component:"div",variant:"body1",sx:{maxWidth:"70%"},children:e.jsx(le,{})},"body1")},h)})})]})]})]})}),t.length>0&&e.jsx(be,{count:w,page:C,rowsPerPage:B,onPageChange:A,onRowsPerPageChange:K})]})]})}$e.propTypes={usersList:c.array,count:c.number,isListLoading:c.bool,page:c.number,setPage:c.func,rowsPerPage:c.number,setRowsPerPage:c.func,setLoad:c.func,calcSize:c.number,onRenewPlan:c.func};const Bt=M(N)(({theme:t})=>({backgroundColor:t.palette.background.paper})),Le=[{id:"plan_name",label:"Addon Name",minWidth:170},{id:"addon_type",label:"Type",minWidth:120},{id:"storage_capacity",label:"Total Capacity",minWidth:120},{id:"available_capacity",label:"Available Capacity",minWidth:120},{id:"purchaseDate",label:"Purchase Date",minWidth:170}];function Oe({addonsList:t=[],count:w,isListLoading:g,page:C,setPage:W,rowsPerPage:B,setRowsPerPage:b,setLoad:v,calcSize:x=201}){const{t:S}=ne(),k=ye().palette.background.paper,I=(o,y)=>{W(y),v&&v(!0)},E=o=>{b(Number(o.target.value)),W(0),v&&v(!0)},m=(o,y="")=>e.jsxs(u,{variant:"inherit",children:[o," ",y]}),T=o=>{const y=o?.startedAt||o?.startDate||o?.start_date;if(!y)return e.jsx(u,{variant:"inherit",children:"--"});const{date:n,time:l}=de(y);return e.jsxs(ee,{spacing:.5,children:[e.jsx(u,{variant:"body2",sx:{fontWeight:600},children:n}),e.jsx(u,{variant:"caption",color:"text.secondary",children:l})]})};return e.jsxs(je,{sx:{width:"100%",overflow:"hidden",borderRadius:"0px",boxShadow:"none"},children:[!t.length&&!g?e.jsx(we,{icon:e.jsx(ut,{}),title:S("console.plans.noAddonsFound"),description:S("console.plans.noAddonsDescription"),sx:{width:"100%",minHeight:260}}):e.jsx(Ce,{sx:o=>({maxHeight:window.innerHeight-x,"&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:o.palette.grey[400],borderRadius:"8px"},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:o.palette.grey[600]},scrollbarWidth:"thin",scrollbarColor:`${o.palette.grey[400]} transparent`}),children:e.jsxs(ve,{stickyHeader:!0,"aria-label":"sticky table",size:"small",children:[e.jsx(ke,{sx:{backgroundColor:k,borderTop:"1px solid",borderBottom:"1px solid",borderColor:"divider",wordBreak:"keep-all",whiteSpace:"nowrap"},children:e.jsx(q,{children:Le.map(o=>e.jsx(Bt,{align:o.align,style:{minWidth:o.minWidth},sx:{backgroundColor:"transparent !important"},children:o.label},o.id))})}),e.jsxs(Pe,{children:[!g&&!!t.length&&t.map((o,y)=>{const n=o.limits?.unit||"";return e.jsxs(q,{hover:!0,role:"checkbox",tabIndex:-1,children:[e.jsx(N,{sx:{color:"grey.800",fontWeight:500},children:e.jsx(u,{variant:"inherit",children:o.plan_name||"--"})}),e.jsx(N,{sx:{color:"grey.800",fontWeight:500},children:e.jsx(u,{variant:"inherit",sx:{textTransform:"capitalize"},children:o.addon_type||"--"})}),e.jsx(N,{sx:{color:"grey.800",fontWeight:500},children:m(o.storage,n)}),e.jsx(N,{sx:{color:"grey.800",fontWeight:500},children:m(o.left_storage,n)}),e.jsx(N,{sx:{color:"grey.800",fontWeight:500},children:T(o)})]},o.id||y)}),g&&e.jsx(e.Fragment,{children:[...Array(2)].map((o,y)=>e.jsx(q,{hover:!0,role:"checkbox",tabIndex:-1,children:Le.map(n=>e.jsx(N,{align:n.align,sx:{color:"grey.300",fontWeight:500},children:e.jsx(u,{component:"div",variant:"body1",sx:{maxWidth:"70%"},children:e.jsx(le,{})},"body1")},n.id))},`skeleton-${y}`))})]})]})}),t.length>0&&e.jsx(be,{count:w||t.length,page:C,rowsPerPage:B,onPageChange:I,onRowsPerPageChange:E})]})}Oe.propTypes={addonsList:c.array,count:c.number,isListLoading:c.bool,page:c.number,setPage:c.func,rowsPerPage:c.number,setRowsPerPage:c.func,setLoad:c.func,calcSize:c.number};const Et=M("div")(({theme:t})=>{const w=t.palette.mode==="dark",g=w?t.palette.grey[400]:Ie(t.palette.grey[500],.32),C=w?t.palette.grey[500]:Ie(t.palette.grey[500],.5);return{position:"relative",height:"38px",boxSizing:"border-box",display:"flex",alignItems:"center",borderRadius:"8px",border:"1px solid",borderColor:g,"&:hover":{borderColor:C},"&:focus-within":{borderColor:t.palette.primary.main},marginLeft:0,width:"100%",[t.breakpoints.up("sm")]:{width:"auto"}}}),Mt=M("div")(({theme:t})=>({padding:t.spacing(0,2),height:"100%",position:"absolute",pointerEvents:"none",display:"flex",alignItems:"center",justifyContent:"center"})),zt=M(ft)(({theme:t})=>({color:t.palette.grey[700],width:"100%","& .MuiInputBase-input":{padding:0,paddingLeft:`calc(1em + ${t.spacing(4)})`,paddingRight:t.spacing(1),transition:t.transitions.create("width"),width:"100%",[t.breakpoints.up("md")]:{width:"20ch"}}})),qe=({text:t,...w})=>e.jsxs(Et,{children:[e.jsx(Mt,{children:e.jsx(gt,{sx:{color:"grey.500"}})}),e.jsx(zt,{placeholder:t,inputProps:{"aria-label":"search"},...w})]});qe.propTypes={text:c.string};const Ft=t=>({type:"UPDATE_BALANCE",payload:t}),he=new me("AddAmountModal"),Ue=({open:t,setOpen:w,fetchTransActionsList:g})=>{const{t:C}=ne(),[W,B]=i.useState(null),[b,v]=i.useState(!1),x=Ne(),[S]=He(),s=At(),k=S.get("order_id"),I=i.useCallback(async()=>{try{const{balance:n}
1=await te("fetchWalletBalance");s(Ft(parseFloat(n))),g()}catch(n){he.error(n)}},[s,g]),E=()=>{w(!1),x("/settings?tab=transactions",{replace:!0})},m=i.useCallback(async n=>{try{const{message:l}=await lt("verifyPayment",n);G(l),I(),x("/settings?tab=transactions",{replace:!0})}catch(l){he.error(l)}},[I,x]),T=i.useCallback(async n=>{try{v(!0),await Wt({order:{id:n}},m),v(!1),w(!1)}catch(l){he.error(l)}},[m,w]),o=i.useCallback(async()=>{if(!Fe("addWalletAmount",3,6e4)){const l=_e("addWalletAmount");pe(C("console.wallet.tooManyAttempts",{time:l}));return}v(!0);const{order:{id:n}}=await te("createOrder",{amount:W});x(`/settings?tab=transactions&order_id=${n}`)},[W,x,C]);i.useEffect(()=>{k&&T(k)},[k,T]);const y=e.jsxs(F,{sx:{mt:1,display:"flex",flexDirection:"column",gap:"10px",padding:"20px"},children:[e.jsxs(F,{sx:{display:"flex",gap:"6px",flexDirection:"column"},children:[e.jsx(u,{sx:{fontSize:"14px",color:"grey.400"},children:C("console.wallet.addMoneyToWallet")}),e.jsx(fe,{id:"addAmmount",placeholder:C("console.wallet.enterAmount"),type:"number",InputProps:{startAdornment:e.jsx(mt,{position:"start",children:e.jsx(bt,{})})},size:"small",fullWidth:!0,value:W,onChange:n=>B(n.target.value),sanitize:!0,validate:!0,maxLength:10})]}),e.jsxs(F,{sx:{display:"flex",gap:"6px",flexDirection:"row"},children:[e.jsx($,{variant:"outlined",size:"small",onClick:()=>B(n=>Number(n)+1e3),children:"+ 1000"}),e.jsx($,{variant:"outlined",size:"small",onClick:()=>B(n=>Number(n)+3e3),children:"+ 3000"}),e.jsx($,{variant:"outlined",size:"small",onClick:()=>B(n=>Number(n)+5e3),children:"+ 5000"})]}),e.jsx(F,{sx:{display:"flex",flexDirection:"row",mt:"20px",justifyContent:"center"},children:e.jsx($,{variant:"contained",sx:{boxShadow:"none",minWidth:"180px"},disabled:!W,loading:b,onClick:()=>o(),children:C("console.wallet.continue")})})]});return e.jsx(Dt,{open:t,title:C("console.wallet.addAmount"),description:y,close:()=>E()})};
1Ue.propTypes={open:c.bool,setOpen:c.func,fetchTransActionsList:c.func};const ue=M("div")(()=>({display:"flex",flexDirection:"row",justifyContent:"space-between",gap:"10px",width:"100%"})),X=M("div")(()=>({display:"flex",flexDirection:"column",width:"calc(100%/2 - 5px)",gap:"5px"})),Q=M(u)(({theme:t})=>({fontSize:"14px",fontWeight:600,color:t.palette.grey[800]})),re={"& .MuiInputBase-input":{fontSize:"14px"}},Be={...re,"& .MuiPickersSectionList-root, & .MuiPickersInputBase-sectionsContainer":{fontSize:"14px",fontFamily:"inherit"},"& .MuiPickersSectionList-sectionContent, & .MuiPickersInputBase-sectionContent":{fontSize:"14px",fontFamily:"inherit"}},_t=38,Nt=8,Ee={PaperProps:{style:{maxHeight:_t*4.5+Nt,width:"auto"}}};function Me(t,w,g){return{fontWeight:w.indexOf(t)===-1?g.typography.fontWeightRegular:g.typography.fontWeightMedium}}const Ve=({anchorEl:t,open:w,handleClose:g,reset:C,apply:W,isFilterApplied:B})=>{const{t:b}=ne(),v=ye(),[x,S]=i.useState(null),[s,k]=i.useState(null),[I,E]=i.useState(null),[m,T]=i.useState(null),[o,y]=i.useState([]),[n,l]=i.useState([]),f=d=>{const{target:{value:A}}=d;y(typeof A=="string"?A.split(","):A)},R=d=>{const{target:{value:A}}=d;l(A)};i.useEffect(()=>{B||(S(null),k(null),E(""),T(""),y([]),l([]))},[B]);const P=()=>{S(null),k(null),E(""),T(""),y([]),l([]),C()},U=()=>{if(!Fe("walletFilter",5,6e4)){const A=_e("walletFilter");pe(b("console.wallet.tooManyFilterAttempts",{time:A}));return}const d={paymentId:m,orderId:I,status:o,method:n};x&&(d.from=Number(new Date(x))),s&&(d.to=Number(new Date(s))),W(d),g()};return e.jsx(yt,{id:"filter-button",anchorEl:t,open:w,onClose:g,MenuListProps:{"aria-labelledby":"filter-button"},children:e.jsxs(F,{sx:{display:"flex",flexDirection:"column",padding:"20px",gap:"15px"},children:[e.jsx(jt,{dateAdapter:wt,children:e.jsxs(ue,{children:[e.jsxs(X,{children:[e.jsx(Q,{children:b("console.wallet.from")}),e.jsx(Te,{format:"DD/MM/YY",slotProps:{textField:{size:"small",sx:Be}},value:x,onChange:d=>S(d),maxDate:s||void 0})]}),e.jsxs(X,{children:[e.jsx(Q,{children:b("console.wallet.to")}),e.jsx(Te,{format:"DD/MM/YY",slotProps:{textField:{size:"small",sx:Be}},value:s,onChange:d=>k(d),minDate:x||void 0})]})]})}),e.jsxs(ue,{children:[e.jsxs(X,{children:[e.jsx(Q,{children:b("console.wallet.orderIdLabel")}),e.jsx(fe,{size:"small",type:"text",placeholder:b("console.wallet.enterOrderId"),value:I,onChange:d=>E(d.target.value),sanitize:!0,validate:!0,maxLength:100,securityOptions:{checkCommand:!1},sx:re})]}),e.jsxs(X,{children:[e.jsx(Q,{children:b("console.wallet.paymentIdLabel")}),e.jsx(fe,{size:"small",type:"text",placeholder:b("console.wallet.enterPaymentId"),value:m,onChange:d=>T(d.target.value),sanitize:!0,validate:!0,maxLength:100,securityOptions:{checkCommand:!1},sx:re})]})]}),e.jsxs(ue,{children:[e.jsxs(X,{children:[e.jsx(Q,{children:b("console.wallet.status")}),e.jsx(Ae,{children:e.jsx(De,{id:"demo-multiple-chip",multiple:!0,size:"small",value:o,onChange:f,sx:re,displayEmpty:!0,input:e.jsx(Re,{id:"select-multiple-chip"}),renderValue:d=>d.length===0?e.jsx(u,{sx:{fontSize:"14px",color:"text.disabled"},children:"Select Status"}):e.jsx(F,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:d.map(A=>e.jsx(ce,{label:A.charAt(0).toUpperCase()+A.slice(1)},A))}),MenuProps:Ee,children:["captured","failed"].map(d=>e.jsx(We,{value:d,style:Me(d,o,v),children:d.charAt(0).toUpperCase()+d.slice(1)},d))})})]}),e.jsxs(X,{children:[e.jsx(Q,{children:b("console.wallet.method")}),e.jsx(Ae,{children:e.jsx(De,{id:"demo-multiple-chip",multiple:!0,size:"small",value:n,onChange:R,sx:re,displayEmpty:!0,input:e.jsx(Re,{id:"select-multiple-chip"}),renderValue:d=>d.length===0?e.jsx(u,{sx:{fontSize:"14px",color:"text.disabled"},children:"Select Method"}):e.jsx(F,{sx:{display:"flex",flexWrap:"wrap",gap:.5},children:d.map(A=>e.jsx(ce,{label:A.charAt(0).toUpperCase()+A.slice(1)},A))}),MenuProps:Ee,children:["card","netbanking","wallet","emi","upi"].map(d=>e.jsx(We,{value:d,style:Me(d,o,v),children:d.charAt(0).toUpperCase()+d.slice(1)},d))})})]})]}),e.jsxs(F,{sx:{display:"flex",width:"100%",justifyContent:"flex-end",gap:"8px",mt:"10px"},children:[e.jsx($,{variant:"contained",color:"primary",sx:{boxShadow:"none"},onClick:()=>U(),children:b("console.wallet.apply")}),e.jsx($,{variant:"outlined",color:"warning",sx:{boxShadow:"none"},onClick:()=>P(),children:b("console.wallet.resetFilters")}),e.jsx($,{variant:"outlined",sx:{boxShadow:"none"},onClick:()=>g(),children:b("console.wallet.close")})]})]})})};
1Ve.propTypes={anchorEl:c.object,open:c.bool.isRequired,handleClose:c.func.isRequired,reset:c.func.isRequired,apply:c.func.isRequired,isFilterApplied:c.bool.isRequired};const Ht=M("div")(({theme:t})=>({display:"flex",flexDirection:"row",alignItems:"center",gap:"10px",[t.breakpoints.down("sm")]:{flexWrap:"nowrap",gap:"8px"}})),Ge=({findForSearchQuery:t,apply:w,reset:g,search:C,isFilterApplied:W,filterData:B,setFilterData:b,fetchTransActionsList:v})=>{const[x,S]=i.useState(""),[s,k]=i.useState(null),[I,E]=i.useState(!1),m=!!s,[T]=He(),o=l=>{l.key==="Enter"&&t(x)},y=l=>{k(l.currentTarget)},n=()=>{k(null)};return i.useEffect(()=>{S(C)},[C]),i.useEffect(()=>{T.get("payment")&&E(!0)},[T]),e.jsxs(Ht,{children:[e.jsx(F,{sx:{flex:{xs:"1 1 auto",sm:"0 1 auto"},minWidth:0},children:e.jsx(qe,{text:"Search Transactions...",value:x,onChange:l=>S(l.target.value),onKeyDown:o})}),e.jsx($,{variant:"contained",color:"primary",sx:{flexShrink:0,boxShadow:"none",px:2,textTransform:"none",fontSize:"13px"},onClick:()=>t(x),children:"Search"}),e.jsx($,{variant:"outlined",sx:{display:{xs:"none",sm:"inline-flex"},boxShadow:"none",px:2,fontSize:"13px",textTransform:"capitalize"},id:"filter-button","aria-controls":m?"filter-button":void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:y,children:"filters"}
1),e.jsx(Ct,{"aria-label":"filters",sx:{display:{xs:"inline-flex",sm:"none"},flexShrink:0,border:"1px solid",borderColor:"divider",borderRadius:"8px"},id:"filter-button-mobile","aria-controls":m?"filter-button-mobile":void 0,"aria-haspopup":"true","aria-expanded":m?"true":void 0,onClick:y,children:e.jsx(vt,{fontSize:"small"})}),e.jsx(Ve,{anchorEl:s,open:m,handleClose:n,reset:g,apply:w,isFilterApplied:W,filterData:B,setFilterData:b}),e.jsx(Ue,{open:I,setOpen:E,fetchTransActionsList:v})]})};Ge.propTypes={findForSearchQuery:c.func.isRequired,apply:c.func.isRequired,reset:c.func.isRequired,search:c.string.isRequired,isFilterApplied:c.bool.isRequired,filterData:c.object.isRequired,setFilterData:c.func.isRequired,fetchTransActionsList:c.func.isRequired};const $t=M(N)(({theme:t})=>({backgroundColor:t.palette.background.paper,height:"40px",padding:"0 16px",whiteSpace:"nowrap",wordBreak:"keep-all",borderBottom:`1px solid ${t.palette.divider}`,[t.breakpoints.down("sm")]:{padding:"0 12px"}}));function Ye({usersList:t=[],count:w,isListLoading:g,page:C,setPage:W,rowsPerPage:B,setRowsPerPage:b,setLoad:v}){const{t:x}=ne(),S=[{id:"orderId",label:x("console.wallet.orderId"),width:"14%",align:"left"},{id:"paymentId",label:x("console.wallet.paymentId"),width:"14%",align:"left"},{id:"amount",label:x("console.wallet.amount"),width:"14%",align:"left"},{id:"currency",label:x("console.wallet.currency"),width:"14%",align:"left"},{id:"status",label:x("console.wallet.status"),width:"14%",align:"left"},{id:"method",label:x("console.wallet.method"),width:"14%",align:"left"},{id:"createdAt",label:x("console.wallet.createdAt"),width:"14%",align:"left"}],s=(n,l)=>{W(l),v(!0)},k=n=>{b(Number(n.target.value)),W(0),v(!0)},I=(n,l,f)=>e.jsx(F,{sx:{width:"100%",display:"flex",flexDirection:"row",gap:"7px",alignItems:"center",justifyContent:"flex-start"},children:e.jsx(u,{variant:"inherit",children:Z(f)})}),E=(n,l,f)=>e.jsx(F,{sx:{width:"100%",display:"flex",flexDirection:"row",gap:"7px",alignItems:"center",justifyContent:"flex-start"},children:e.jsx(u,{variant:"inherit",children:f==="upi"?"UPI":Z(f)})}),m=(n,l,f)=>f?e.jsx(z,{title:x("console.wallet.checkToCopy"),children:e.jsx(u,{variant:"inherit",onClick:()=>{J(f),G(x("console.wallet.emailCopied"))},children:f})}):"--",T=(n,l,f)=>{const R=ge(f).format("DD/MM/YY"),P=ge(f).format("h:mm a");return e.jsxs(ee,{spacing:.5,children:[e.jsx(u,{variant:"body2",sx:{fontWeight:600},children:R}),e.jsx(u,{variant:"caption",color:"text.secondary",children:P})]})},o=(n,l,f)=>f!==void 0?f:"--",y={email:m,createdAt:T,status:I,method:E};return e.jsxs(je,{sx:{width:"100%",overflow:"hidden",borderRadius:"0px",display:"flex",flexDirection:"column",boxShadow:"none"},children:[!g&&!t.length?e.jsx(we,{icon:e.jsx(kt,{}),title:x("console.wallet.noMoreData"),description:x("console.wallet.noTransactionsDescription"),sx:{width:"100%",minHeight:260}}):e.jsx(Ce,{sx:{maxHeight:window.innerHeight-340,overflowX:"auto"},children:e.jsxs(ve,{stickyHeader:!0,"aria-label":"sticky table",size:"small",children:[e.jsx(ke,{children:e.jsx(q,{sx:{height:"40px"},children:S.map(n=>e.jsx($t,{align:n.align,style:{width:n.width},sx:l=>({borderTop:`1px solid ${l.palette.divider} !important`,borderBottom:`1px solid ${l.palette.divider} !important`,backgroundColor:`${l.palette.background.paper} !important`}),children:n.label},n.id))})}),e.jsxs(Pe,{children:[!g&&!!t.length&&t.map((n,l)=>e.jsx(q,{hover:!0,role:"checkbox",tabIndex:-1,sx:{height:"39px"},children:S.map(f=>{const{id:R}=f,P=n[R];return e.jsx(N,{align:f.align,sx:{color:"grey.600",fontWeight:500,borderBottom:"1px solid",borderColor:"divider",wordBreak:"keep-all",whiteSpace:"nowrap"},children:f.format&&typeof P=="number"?f.format(P):(y?.[R]||o)(R,f?.align,n[R],n,l)},R)})},n.code)),g&&e.jsxs(e.Fragment,{children:[e.jsx(q,{hover:!0,role:"checkbox",tabIndex:-1,sx:{height:"39px"},children:S.map(n=>{const{id:l}=n;return e.jsx(N,{align:n.align,sx:{color:"grey.300",fontWeight:500},children:e.jsx(u,{component:"div",variant:"body1",sx:{maxWidth:"70%"},children:e.jsx(le,{})},"body1")},l)})}),e.jsx(q,{hover:!0,role:"checkbox",tabIndex:-1,sx:{height:"39px",backgroundColor:"grey.200"},children:S.map(n=>{const{id:l}=n;return e.jsx(N,{align:n.align,sx:{color:"grey.300",fontWeight:500},children:e.jsx(u,{component:"div",variant:"body1",sx:{maxWidth:"70%"},children:e.jsx(le,{})},"body1")},l)})})]})]})]})}),t?.length>0&&e.jsx(be,{count:w,page:C,rowsPerPage:B,onPageChange:s,onRowsPerPageChange:k})]})}Ye.propTypes={usersList:c.array,count:c.number.isRequired,isListLoading:c.bool.isRequired,page:c.number.isRequired,setPage:c.func.isRequired,rowsPerPage:c.number.isRequired,setRowsPerPage:c.func.isRequired,setLoad:c.func.isRequired};const Ot=M("div")(({theme:t})=>({backgroundColor:t.palette.background.default,display:"flex",justifyContent:"flex-start",alignItems:"center",flexDirection:"column",height:"100%",overflowY:"scroll",overflow:"hidden",[t.breakpoints.down("sm")]:{height:"auto"}})),qt=M("div")(({theme:t})=>({height:"auto",maxHeight:"calc(100%)",display:"flex",flexDirection:"column",overflow:"hidden",
1width:"100%",[t.breakpoints.down("sm")]:{width:"100%"}})),Ut=M("div")(({theme:t})=>({display:"flex",flexDirection:"column",gap:"10px",padding:"10px 5px 20px 5px",[t.breakpoints.down("sm")]:{alignItems:"flex-start"}})),Vt=M("div")(({theme:t})=>({display:"flex",flexDirection:"row",alignItems:"center",justifyContent:"space-between",gap:"10px",[t.breakpoints.down("sm")]:{flexDirection:"column",alignItems:"flex-start",gap:"10px",flexWrap:"wrap"}})),Gt=M(u)(({theme:t})=>({color:t.palette.text.heading,fontSize:"16px",fontWeight:600,lineHeight:"30px",letterSpacing:0})),Yt=()=>{const{t}=ne(),[w,g]=i.useState(0),[C,W]=i.useState(25),[B,b]=i.useState([]),[v,x]=i.useState(!1),[S,s]=i.useState(0),[k,I]=i.useState([]),[E,m]=i.useState(!1),[T,o]=i.useState(""),[y,n]=i.useState(!1),[l,f]=i.useState({email:"",mobile:"",userId:"",status:null,type:null,permissions:null,from:null,to:null}),R=i.useCallback(async()=>{try{x(!0);const H={skip:C*w,limit:C,...l};T&&(H.search=T);const{count:V=0,result:O=[]}=await te("getTransactionsList",H)||{};b(O),s(V)}catch(j){pe(j?.message||"Network error!")}finally{x(!1)}},[w,C,l,T]),P=j=>{if(o(j),j?.trim()){g(0),m(!0),k.includes("search")||I([{key:"search",value:j}]),n(!1);return}const H=k.filter(V=>V?.key!=="search");I([...H]),b([]),n(!1),g(0),m(!0)};i.useEffect(()=>{E&&(R(),m(!1))},[E,R]);const U=()=>{I([]),o(""),f({status:null,method:null,orderId:"",paymentId:"",from:null,to:null}),n(!1),m(!0)};i.useEffect(()=>{R()},[R]);const d={orderId:"OrderId",paymentId:"PaymentIUd",status:"Status",method:"Method",from:"From",to:"To"},A=j=>["From","To"].includes(j?.key)?ge(j?.value).format("DD/MM/YY"):j?.value,K=j=>{b([]),o(""),n(!0);const H=[];Object.keys(j).forEach(O=>{["status","method"].includes(O)?(j[O]||[]).forEach(ae=>{H.push({key:d[O],value:ae})}):j[O]&&H.push({key:d[O],value:j[O]})}),I(H);const V=JSON.parse(JSON.stringify(j));f(V),g(0),m(!0)},se=()=>{U()};return e.jsx(Ot,{children:e.jsxs(qt,{children:[e.jsxs(Ut,{children:[e.jsxs(Vt,{children:[e.jsx(Gt,{children:t("console.wallet.transactionHistory")}),e.jsx(Ge,{findForSearchQuery:P,fetchTransActionsList:R,apply:K,reset:se,search:T,isFilterApplied:y,filterData:l,setFilterData:f})]}),!!k.length&&e.jsxs(F,{sx:{display:"flex",flexDirection:"row",gap:"6px",alignItems:"center",flexWrap:"wrap"},children:[k.map(j=>e.jsx(z,{title:A(j),children:e.jsx(ce,{label:A(j)||j?.key,variant:"outlined",size:"small"})},`filter-${j.key}-${j.value}`)),e.jsx($,{variant:"outlined",size:"small",color:"warning",onClick:()=>U(),children:t("console.wallet.clearFilter")})]})]}),e.jsx(Ye,{page:w,setPage:g,rowsPerPage:C,setRowsPerPage:W,setLoad:m,usersList:B,count:S,isListLoading:v,fetchTransActionsList:R})]})})},ze=new me("myPlans"),oe=[{key:"licenses",label:"Licenses"},...ct?[{key:"addons",label:"Add-ons"}]:[],...dt?[{key:"transactions",label:"Transactions"}]:[]],Jt=M("div")(({theme:t})=>({backgroundColor:t.palette.background.default,display:"flex",alignItems:"center",flexDirection:"column",padding:"62px 0px 12px 82px",height:"100%",overflowY:"scroll","&::-webkit-scrollbar":{width:"4px"},"&::-webkit-scrollbar-track":{background:"transparent"},"&::-webkit-scrollbar-thumb":{backgroundColor:t.palette.grey[400],borderRadius:"8px"},"&::-webkit-scrollbar-thumb:hover":{backgroundColor:t.palette.grey[600]},scrollbarWidth:"thin",scrollbarColor:`${t.palette.grey[400]} transparent`,[t.breakpoints.down("sm")]:{padding:"62px 14px 14px 14px",height:"100%"}})),Kt=M("div")(({theme:t})=>({height:"auto",maxHeight:"calc(100%)",display:"flex",flexDirection:"column",borderRadius:"8px",border:"1px solid",overflow:"hidden",backgroundColor:t.palette.card.main,borderColor:t.palette.grey[300],alignSelf:"stretch",[t.breakpoints.down("sm")]:{alignSelf:"stretch",maxHeight:"none",flexShrink:0}})),Xt=M("div")(({theme:t})=>({display:"flex",flexDirection:"row",alignItems:"center",padding:"12px",justifyContent:"space-between",borderBottom:`1px solid ${t.palette.divider}`,[t.breakpoints.down("sm")]:{gap:"8px",padding:"8px"}})),Qt=M("div")(()=>({})),wn=()=>{const[t,w]=i.useState([]),[g,C]=i.useState([]),[W,B]=i.useState(!1),[b,v]=i.useState(!1),x=Ne(),S=Tt(),[s,k]=i.useState(()=>S.state?.activeTab??0),[I,E]=i.useState(0),[m,T]=i.useState(0),[o,y]=i.useState(25),[n,l]=i.useState(0),[f,R]=i.useState(0),[P,U]=i.useState(25);i.useEffect(()=>{const D=document.body.style.overflow,_=document.documentElement.style.overflow;return document.body.style.overflow="hidden",document.documentElement.style.overflow="hidden",()=>{document.body.style.overflow=D,document.documentElement.style.overflow=_}},[]);const d=(D,_)=>{k(_)},A=i.useCallback(async()=>{try{B(!0);const{data:D=[],count:_=0}=await te("assignedPlanDetails",{from:m*o,size:o})||{};w(D),E(_)}catch(D){ze.error(D)}finally{B(!1)}},[m,o]),K=i.useCallback(async()=>{try{v(!0);const D=await te("fetchAssignedAddonPlans",{from:f*P})||{},_=D?.data||D?.addon||D?.addons||[];C(Array.isArray(_)?_:[]),l(D?.count??(Array.isArray(_)?_.length:0))}catch(D){ze.error(D)}finally{v(!1)}},[f,P]);i.useEffect(()=>{A()},[A]),i.useEffect(()=>{oe[s]?.key==="addons"&&K()},[s,K]);const se=!1,j="outlined";let H="primary";se?.isExpired&&(H="error");const V=D=>{const _=D?.subId||D?.sub_id||D?.planId||D?.plan_id;_&&x(`/checkout?renewPlanId=${encodeURIComponent(_)}`,{state:{from:`${S.pathname}${S.search}`}})},O=()=>{x("/plans")},ae=t?.length===0&&g?.length===0&&W===!1&&b===!1;return e.jsx(Jt,{children:e.jsxs(Kt,{children:[e.jsxs(Xt,{sx:{pb:0},children:[e.jsx(Pt,{value:s,onChange:d,variant:"scrollable",scrollButtons:"auto",sx:{borderBottom:"none"},children:oe.map(D=>e.jsx(St,{label:D.label},D.key))}),Se&&e.jsx($,{variant:j,color:H,sx:{mb:1,fontWeight:700,minWidth:"148px"},onClick:O,children:"Upgrade Now"})]}),e.jsxs(Qt,{children:[oe[s]?.key==="licenses"&&(ae?e.jsxs(It,{sx:{display:"flex",flexDirection:"column",alignItems:"center",gap:2,py:6},children:[e.jsx(u,{variant:"body2",sx:{fontWeight:600,textAlign:"center",padding:"0 12px"}
1,children:"No plans or add-ons found. Please upgrade your plan to access more features."}),Se&&e.jsx($,{variant:j,color:H,sx:{fontWeight:700,minWidth:"148px"},onClick:O,children:"Upgrade Now"})]}):e.jsx($e,{usersList:t,count:I,isListLoading:W,rowsPerPage:o,setRowsPerPage:y,page:m,setPage:T,onRenewPlan:V})),oe[s]?.key==="addons"&&e.jsx(Oe,{addonsList:g,count:n,isListLoading:b,rowsPerPage:P,setRowsPerPage:U,page:f,setPage:R}),oe[s]?.key==="transactions"&&e.jsx(Yt,{})]})]})})};export{wn 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.