1import {D}from'./chunk-DWUEse31.js';import {c as ce}from'./chunk-BRsHFk4j.js';import'./chunk-C0DmzTpz.js';import {c3 as Xr,V,G,bK as P,bI as Gt,aE as ut,O,X as Xb,j as Xv,N as Ng,bu as Ts,bv as Og,bM as Ic,bN as Gc,T as Tt,z as zg,w as w0,b1 as ei,H as H0,Z as Zx,k as dn,b2 as da,cp as xr,l as zw,bA as Nw,s as sk,n as nd,b3 as id,r as rC,m as wC,o as mv,p as GC,t as tD,q as vD,aO as cD,aP as hD,b0 as _D,aX as mD,u as al,x as tM,y as dM,L as Lb,A as r1,P as P1,B as xS,C as Vs,F as zs,J as GS,K as iI,M as RI,Q as us,S as ms,Y as UI,_ as tE,$ as Dn,a0 as ME,a1 as ny,a2 as go,a3 as Kd,a4 as XE,a5 as LT,a6 as mA,aM as QM,cx as WM,a7 as mt,a8 as fy,aa as Js,ac as H_,ae as pS,ad as gd,bV as zy,bW as W_,af as XT,bD as db,ab as Ey,a9 as ZT,ai as dy,bn as nS,ag as SC,aj as jy,al as gS,bX as $y,bE as pb,am as JT,ak as Ed,ah as YT,aT as d_,aD as By,bg as mS,bc as x_}from'./main-4WA6AAHG.js';import'./chunk-CkU8oUfw.js';var Ye=()=>["Pick the subscription you want refunded and explain why.","The request goes to the SocialLab team for review \u2014 it is not automatic.","Watch the status and the note here for their answer."],Ge=(l,c)=>c.id;function Je(l,c){if(l&1&&(Js(0,"mat-option",9),H_(1),gd()),l&2){let e=c.$implicit,p=d_();dy("value",e.id),SC(),jy(p.subLabel(e));}}function Qe(l,c){if(l&1&&(Js(0,"tr",19)(1,"td",18),H_(2),gd(),Js(3,"td",18),H_(4),pS(5,"number"),pS(6,"translate"),gd(),Js(7,"td",18)(8,"span"),H_(9),pS(10,"translate"),gd()(),Js(11,"td",18),H_(12),pS(13,"date"),gd(),Js(14,"td",20),H_(15),gd()()),l&2){let e=c.$implicit,p=d_();SC(2),jy(e.subscriptionId?"#"+e.subscriptionId:"\u2014"),SC(2),By("",mS(5,8,e.amountSar,"1.0-2")," ",gS(6,11,"SAR")),SC(4),x_(p.statusClass(e.status)),SC(),jy(gS(10,13,p.statusLabel(e.status))),SC(3),jy(mS(13,15,e.requestedOn,"yyyy-MM-dd")),SC(3),jy(e.decisionNote||e.reason||"\u2014");}}function Ue(l,c){l&1&&(Js(0,"tr")(1,"td",21),H_(2),pS(3,"translate"),gd()()),l&2&&(SC(2),jy(gS(3,1,"No refund requests yet.")));}var Jt=(()=>{class l{constructor(e,p,s,f,m,Ke){this.refundService=e,this.subscriptionService=p,this.loadingService=s,this.errorService=f,this.toastr=m,this.translate=Ke,this.refunds=[],this.subscriptions=[],this.isLoading=false,this.selectedSubscriptionId=null,this.reason="",this.submitting=false;}ngOnInit(){this.loadRefunds(),this.loadSubscriptions();}loadRefunds(){this.isLoading=true,this.loadingService.beginSuppress(),this.refundService.getMyRefunds().pipe(Xr(()=>{this.isLoading=false,this.loadingService.endSuppress();})).subscribe({next:e=>{this.refunds=e?.succeeded&&Array.isArray(e.data)?e.data:[];},error:e=>this.errorService.setError(e,"Failed to load")});}loadSubscriptions(){this.loadingService.beginSuppress(),this.subscriptionService.getMySubscriptions().pipe(Xr(()=>this.loadingService.endSuppress())).subscribe({next:e=>{this.subscriptions=e?.succeeded&&Array.isArray(e.data)?e.data:[];},error:()=>{this.subscriptions=[];}});}subLabel(e){return e.planNameAr||e.planNameEn||e.planName||"#"+e.id}requestRefund(){this.selectedSubscriptionId&&(this.submitting=true,this.loadingService.loadingOn(),this.refundService.requestRefund(this.selectedSubscriptionId,this.reason||null).pipe(Xr(()=>{this.submitting=false,this.loadingService.loadingOff();})).subscribe({next:e=>{e?.succeeded?(this.toastr.success("Refund requested."),this.selectedSubscriptionId=null,this.reason="",this.loadRefunds()):this.errorService.setError(e,"Failed");},error:e=>this.errorService.setError(e,"Failed")}));}statusLabel(e){switch(e){case 1:return "myRefunds.statusRequested";case 2:return "myRefunds.statusRejected";case 3:return "myRefunds.statusProcessed";case 4:return "myRefunds.statusFailed";default:return ""}}statusClass(e){switch(e){case 3:return "text-success";case 2:case 4:return "text-error";default:return "text-muted"}}static{this.\u0275fac=function(p){return new(p||l)(V(D),V(G),V(P),V(Gt),V(ut),V(O))};}static{this.\u0275cmp=Xb({type:l,selectors:[["app-my-refunds"]],decls:61,vars:39,consts:[["helpKey","my-refunds","intro","Ask for a refund on a subscription, and follow what happened to the requests you have already made.",3,"steps"],[1,"cardWithShadow"],[1,"m-b-0"],[1,"p-24"],[1,"text-muted","f-s-13"],[1,"row","align-items-start"],[1,"col-md-4"],["appearance","outline",1,"w-100"],[3,"ngModelChange","ngModel"],[3,"value"],[1,"col-md-6"],["matInput","","maxlength","1000",3,"ngModelChange","ngModel"],[1,"col-md-2"],["mat-flat-button","","color","primary",1,"w-100",3,"click","disabled"],[1,"cardWithShadow","m-t-24"],[1,"p-24",2,"overflow-x","auto"],[1,"w-100",2,"border-collapse","collapse","min-width","640px"],[1,"text-muted","f-s-13",2,"text-align","start"],[1,"p-8"],[2,"border-top","1px solid var(--mat-divider-color, #eee)"],[1,"p-8","text-muted","f-s-13"],["colspan","5",1,"p-16","text-center","text-muted"]],template:function(p,s){p&1&&(fy(0,"app-page-help",0),Js(1,"mat-card",1)(2,"mat-card-header")(3,"mat-card-title")(4,"h4",2),H_(5),pS(6,"translate"),gd()()(),Js(7,"mat-card-content",3)(8,"p",4),H_(9),pS(10,"translate"),gd(),Js(11,"div",5)(12,"div",6)(13,"mat-form-field",7)(14,"mat-label"),H_(15),pS(16,"translate"),gd(),Js(17,"mat-select",8),zy("ngModelChange",function(m){return W_(s.selectedSubscriptionId,m)||(s.selectedSubscriptionId=m),m}),XT(18,Je,2,2,"mat-option",9,Ge),gd(),db(),gd()(),Js(20,"div",10)(21,"mat-form-field",7)(22,"mat-label"),H_(23),pS(24,"translate"),gd(),Js(25,"input",11),zy("ngModelChange",function(m){return W_(s.reason,m)||(s.reason=m),m}),gd(),db(),gd()(),Js(26,"div",12)(27,"button",13),Ey("click",function(){return s.requestRefund()}),Js(28,"mat-icon"),H_(29,"undo"),gd(),H_(30),pS(31,"translate"),gd()()()()(),Js(32,"mat-card",14)(33,"mat-card-header")(34,"mat-card-title")(35,"h4",2),H_(36),pS(37,"translate"),gd()()(),Js(38,"mat-card-content",15)(39,"table",16)(40,"thead")(41,"tr",17)(42,"th",18),H_(43),pS(44,"translate"),gd(),Js(45,"th",18),H_(46),pS(47,"translate"),gd(),Js(48,"th",18),H_(49),pS(50,"translate"),gd(),Js(51,"th",18),H_(52),pS(53,"translate"),gd(),Js(54,"th",18),H_(55),pS(56,"translate"),gd()()(),Js(57,"tbody"),XT(58,Qe,16,18,"tr",19,Ge),ZT(60,Ue,4,3,"tr"),gd()()()()),p&2&&(dy("steps",nS(38,Ye)),SC(5),jy(gS(6,16,"Request a refund")),SC(4),jy(gS(10,18,"You can request a 30-day money-back refund for your first paid subscription. A SocialLab admin reviews it.")),SC(6),jy(gS(16,20,"Subscription")),SC(2),$y("ngModel",s.selectedSubscriptionId),pb(),SC(),JT(s.subscriptions),SC(5),jy(gS(24,22,"Reason (optional)")),SC(2),$y("ngModel",s.reason),pb(),SC(2),dy("disabled",!s.selectedSubscriptionId||s.submitting),SC(3),Ed(" ",gS(31,24,"Request")," "),SC(6),jy(gS(37,26,"My refund requests")),SC(7),jy(gS(44,28,"Subscription")),SC(3),jy(gS(47,30,"Amount")),SC(3),jy(gS(50,32,"Status")),SC(3),jy(gS(53,34,"Requested on")),SC(3),jy(gS(56,36,"Note")),SC(3),JT(s.refunds),SC(2),YT(s.refunds.length===0&&!s.isLoading?60:-1));},dependencies:[ce,Xv,Ng,Ts,Og,Ic,Gc,Tt,zg,w0,ei,H0,Zx,dn,da,xr,zw,Nw,sk,nd,id,rC,wC,mv,GC,tD,vD,cD,hD,_D,mD,al,tM,dM,Lb,r1,P1,xS,Vs,zs,GS,iI,RI,us,ms,UI,tE,Dn,ME,ny,go,Kd,XE,LT,mA,QM,WM,mt],encapsulation:2,changeDetection:1});}}return l})();export{Jt as MyRefundsComponent};
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.