1import {_}from'./chunk-DxAoeUdk.js';import {o}from'./chunk-B0wrQYKy.js';import {c as ce}from'./chunk-BRsHFk4j.js';import'./chunk-C0DmzTpz.js';import {gZ as v,g_ as y,V,g$ as j,bK as P,aE as ut$1,bI as Gt,O,v as vr,X as Xb,N as Ng,bu as Ts,df as Wc,bv as Og,dg as xc,bN as Gc,T as Tt,j as Xv,z as zg,w as w0,b1 as ei,H as H0,Z as Zx,k as dn,b2 as da,cp as xr,bL as Sh,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,bT as GI,_ as tE,$ as Dn,a0 as ME,a1 as ny,a2 as go,a3 as Kd,a4 as XE,fg as Zf,a5 as LT,a6 as mA,a7 as mt$1,aM as QM,cx as WM,a8 as fy,aa as Js,ac as H_,ae as pS,ad as gd,ab as Ey,bV as zy,bW as W_,bD as db,a9 as ZT,ai as dy,bn as nS,ag as SC,aj as jy,al as gS,ak as Ed,bX as $y,bE as pb,aD as By,ah as YT,aR as i_,af as XT,aS as Vp,aT as d_,aU as Hp,am as JT,ba as xy,bg as mS}from'./main-4WA6AAHG.js';import'./chunk-CkU8oUfw.js';var it=()=>["Recompute to refresh every offer against today's plans and usage.","Read the usage column: a client already spending more than the plan includes is worse off on points \u2014 leave them alone.","Adjust the incentive if the client warrants it, then Send.","A sent offer appears to the client's Admin users for 14 days."],nt=()=>[10,25,50,100],at=(a,u)=>u.clientId;function ot(a,u){a&1&&(Js(0,"div",14),fy(1,"mat-spinner",16),gd());}function rt(a,u){if(a&1&&(Js(0,"div",22),H_(1),gd()),a&2){let e=d_().$implicit,d=d_(2);SC(),jy(d.ineligibleLabel(e));}}function lt(a,u){if(a&1&&(Js(0,"div",23),H_(1),pS(2,"number"),pS(3,"translate"),gd()),a&2){let e=d_().$implicit;SC(),By("",mS(2,2,e.currentMonthlyFee,"1.0-2")," / ",gS(3,5,"mo"));}}function pt(a,u){a&1&&(Js(0,"div",22),H_(1),pS(2,"translate"),gd()),a&2&&(SC(),jy(gS(2,1,"Worse off on points")));}function st(a,u){if(a&1&&(Js(0,"span"),H_(1),pS(2,"number"),pS(3,"number"),gd(),ZT(4,pt,3,3,"div",22)),a&2){let e=d_().$implicit;xy("mc-worse",e.usageExceedsIncluded),SC(),By(" ",mS(2,5,e.estimatedMonthlyUsagePoints,"1.0-0")," / ",mS(3,8,e.monthlyPointsIncluded,"1.0-0")," "),SC(3),YT(e.usageExceedsIncluded?4:-1);}}function dt(a,u){a&1&&H_(0," \u2014 ");}function ct(a,u){if(a&1){let e=i_();Js(0,"mat-form-field",24)(1,"input",30),Ey("ngModelChange",function(l){Vp(e);let c=d_().$implicit,g=d_(2);return Hp(g.overrides[c.clientId]=l)}),gd(),db(),gd();}if(a&2){let e=d_().$implicit,d=d_(2);SC(),dy("ngModel",d.effectiveIncentive(e)),pb();}}function mt(a,u){if(a&1&&(H_(0),pS(1,"number")),a&2){let e=d_().$implicit,d=d_(2);Ed(" ",mS(1,1,d.effectiveIncentive(e),"1.0-0")," ");}}function ut(a,u){if(a&1&&(Js(0,"div",23),H_(1),pS(2,"translate"),pS(3,"date"),gd()),a&2){let e=d_().$implicit;SC(),By("",gS(2,2,"until")," ",mS(3,4,e.expiresOn,"d MMM"));}}function gt(a,u){if(a&1&&(H_(0),pS(1,"translate"),Js(2,"b"),H_(3),pS(4,"number"),gd(),H_(5),pS(6,"translate")),a&2){let e=d_(2).$implicit;Ed(" ",gS(1,3,"Wants")," "),SC(3),jy(mS(4,5,e.requestedPoints,"1.0-0")),SC(2),Ed(" ",gS(6,8,"points")," ");}}function ft(a,u){if(a&1&&H_(0),a&2){let e=d_(2).$implicit;Ed(" ",e.rejectNotes," ");}}function _t(a,u){if(a&1&&(Js(0,"div",26),ZT(1,gt,7,10)(2,ft,1,1),gd()),a&2){let e=d_().$implicit,d=d_(2);SC(),YT(e.rejectReason===d.EnumMigrationRejectReason.WantsMorePoints?1:2);}}function ht(a,u){if(a&1){let e=i_();Js(0,"button",3),Ey("click",function(){Vp(e);let l=d_().$implicit,c=d_(2);return Hp(c.release(l))}),H_(1),pS(2,"translate"),gd();}a&2&&(SC(),Ed(" ",gS(2,1,"Send")," "));}function Ct(a,u){if(a&1){let e=i_();Js(0,"button",31),Ey("click",function(){Vp(e);let l=d_().$implicit,c=d_(2);return Hp(c.withdraw(l))}),H_(1),pS(2,"translate"),gd();}a&2&&(SC(),Ed(" ",gS(2,1,"Withdraw")," "));}function Mt(a,u){if(a&1&&(Js(0,"tr")(1,"td")(2,"div",21),H_(3),gd(),ZT(4,rt,2,1,"div",22),gd(),Js(5,"td"),H_(6),gd(),Js(7,"td"),H_(8),pS(9,"translate"),gd(),Js(10,"td"),H_(11),ZT(12,lt,4,7,"div",23),gd(),Js(13,"td"),H_(14),gd(),Js(15,"td"),ZT(16,st,5,11)(17,dt,1,0),gd(),Js(18,"td"),ZT(19,ct,2,1,"mat-form-field",24)(20,mt,2,4),gd(),Js(21,"td"),fy(22,"app-badge",25),pS(23,"translate"),ZT(24,ut,4,7,"div",23),ZT(25,_t,3,1,"div",26),gd(),Js(26,"td",27),ZT(27,ht,3,3,"button",28)(28,Ct,3,3,"button",29),gd()()),a&2){let e=u.$implicit,d=d_(2);xy("is-blocked",e.ineligibleReason)("is-worse-off",e.usageExceedsIncluded),SC(3),jy(e.clientName),SC(),YT(e.ineligibleReason?4:-1),SC(2),jy(d.partnerLabel(e.partner)),SC(2),By("",e.tenureMonths," ",gS(9,19,"mo")),SC(3),Ed(" ",e.currentPlanName||"\u2014"," "),SC(),YT(e.currentMonthlyFee?12:-1),SC(2),jy(e.targetPlanName||"\u2014"),SC(2),YT(e.monthlyPointsIncluded>0?16:17),SC(3),YT(d.canRelease(e)?19:20),SC(3),dy("type",d.statusBadge(e.status))("label",gS(23,21,d.statusLabel(e.status))),SC(2),YT(e.status===d.EnumMigrationOfferStatus.Released&&e.expiresOn?24:-1),SC(),YT(e.status===d.EnumMigrationOfferStatus.Rejected?25:-1),SC(2),YT(d.canRelease(e)?27:d.canWithdraw(e)?28:-1);}}function vt(a,u){if(a&1){let e=i_();Js(0,"div",17)(1,"table",18)(2,"thead")(3,"tr")(4,"th"),H_(5),pS(6,"translate"),gd(),Js(7,"th"),H_(8),pS(9,"translate"),gd(),Js(10,"th"),H_(11),pS(12,"translate"),gd(),Js(13,"th"),H_(14),pS(15,"translate"),gd(),Js(16,"th"),H_(17),pS(18,"translate"),gd(),Js(19,"th"),H_(20),pS(21,"translate"),gd(),Js(22,"th"),H_(23),pS(24,"translate"),gd(),Js(25,"th"),H_(26),pS(27,"translate"),gd(),fy(28,"th"),gd()(),Js(29,"tbody"),XT(30,Mt,29,23,"tr",19,at),gd()()(),Js(32,"mat-paginator",20),Ey("page",function(l){Vp(e);let c=d_();return Hp(c.onPage(l))}),gd();}if(a&2){let e=d_();SC(5),jy(gS(6,12,"Client")),SC(3),jy(gS(9,14,"Channel")),SC(3),jy(gS(12,16,"With us")),SC(3),jy(gS(15,18,"Current plan")),SC(3),jy(gS(18,20,"Moves to")),SC(3),jy(gS(21,22,"Usage vs included")),SC(3),jy(gS(24,24,"Incentive")),SC(3),jy(gS(27,26,"Status")),SC(4),JT(e.rows),SC(2),dy("length",e.total)("pageSize",e.pageSize)("pageIndex",e.pageNumber-1)("pageSizeOptions",nS(28,nt));}}function xt(a,u){a&1&&(Js(0,"div",15)(1,"mat-icon",32),H_(2,"inbox"),gd(),Js(3,"p"),H_(4),pS(5,"translate"),gd()()),a&2&&(SC(4),jy(gS(5,1,"No clients match the current filters")));}var Mi=(()=>{class a{constructor(e,d,l,c,g,tt){this.service=e,this.loadingService=d,this.toastr=l,this.errorService=c,this.translate=g,this.dialog=tt,this.EnumMigrationOfferStatus=v,this.EnumMigrationRejectReason=y,this.EnumPartners=o,this.rows=[],this.total=0,this.isLoading=false,this.statusFilter=null,this.partnerFilter=null,this.offerableOnly=null,this.search="",this.pageNumber=1,this.pageSize=25,this.overrides={};}ngOnInit(){this.load();}load(){this.isLoading=true,this.service.search({status:this.statusFilter,partner:this.partnerFilter,offerableOnly:this.offerableOnly,search:this.search?.trim()||null,pageNumber:this.pageNumber,pageSize:this.pageSize}).subscribe({next:e=>{this.isLoading=false,e?.succeeded?(this.rows=e.data??[],this.total=e.count??this.rows.length):this.errorService.setError(e,"Error while getting the data");},error:e=>{this.isLoading=false,this.errorService.setError(e,"Error while getting the data");}});}onFilterChange(){this.pageNumber=1,this.load();}onPage(e){this.pageNumber=e.pageIndex+1,this.pageSize=e.pageSize,this.load();}recompute(){this.loadingService.loadingOn(),this.service.recompute().subscribe({next:e=>{this.loadingService.loadingOff(),e?.succeeded?(this.toastr.success("Offers recomputed"),this.load()):this.errorService.setError(e,"Failed");},error:e=>{this.loadingService.loadingOff(),this.errorService.setError(e,"Failed");}});}release(e){let d=this.overrides[e.clientId]??e.incentivePointsOverride??e.incentivePoints;confirm(this.translate.instant("Send this offer to")+` ${e.clientName}? `+this.translate.instant("They will be offered")+` ${d} `+this.translate.instant("points, valid for 14 days."))&&(this.loadingService.loadingOn(),this.service.release({clientId:e.clientId,incentivePointsOverride:this.overrides[e.clientId]??null}).subscribe({next:c=>{this.loadingService.loadingOff(),c?.succeeded?(this.toastr.success("Offer sent"),this.load()):this.errorService.setError(c,"Failed");},error:c=>{this.loadingService.loadingOff(),this.errorService.setError(c,"Failed");}}));}withdraw(e){confirm(this.translate.instant("Withdraw this offer?"))&&(this.loadingService.loadingOn(),this.service.withdraw({clientId:e.clientId}).subscribe({next:d=>{this.loadingService.loadingOff(),d?.succeeded?(this.toastr.success("Offer withdrawn"),this.load()):this.errorService.setError(d,"Failed");},error:d=>{this.loadingService.loadingOff(),this.errorService.setError(d,"Failed");}}));}canRelease(e){return !e.ineligibleReason&&e.targetPlanId!==null&&(e.status===v.Pending||e.status===v.Expired||e.status===v.Withdrawn)}canWithdraw(e){return e.status===v.Released}statusLabel(e){switch(e){case v.Pending:return "Not sent yet";case v.Released:return "Awaiting reply";case v.Accepted:return "Accepted";case v.Rejected:return "Declined";case v.AutoConverted:return "Auto-converted";case v.Expired:return "Offer expired";case v.Withdrawn:return "Withdrawn";default:return ""}}statusBadge(e){switch(e){case v.Accepted:return "success";case v.Rejected:return "error";case v.Released:return "primary";case v.AutoConverted:return "info";case v.Expired:case v.Withdrawn:return "warning";default:return "default"}}ineligibleLabel(e){switch(e.ineligibleReason){case "NoActiveSubscription":return this.translate.instant("No active subscription \u2014 the nightly sweep handles this client.");case "NoEquivalentPlan":return this.translate.instant("No equivalent plan exists \u2014 needs a sales conversation.");default:return ""}}partnerLabel(e){switch(e){case o.Salla:return this.translate.instant("Salla");case o.Zid:return this.translate.instant("Zid");default:return this.translate.instant("Direct")}}effectiveIncentive(e){return this.overrides[e.clientId]??e.incentivePointsOverride??e.incentivePoints}static{this.\u0275fac=function(d){return new(d||a)(V(j),V(P),V(ut$1),V(Gt),V(O),V(vr))};}static{this.\u0275cmp=Xb({type:a,selectors:[["app-migration-campaign"]],decls:85,vars:87,consts:[["helpKey","admin-migration-campaign","intro","Move the remaining legacy clients onto the points model. The system computes each client's offer; you decide whether it goes out and for how much.","note","What the Status column means \u2014 Not sent yet: the offer is computed but the client sees nothing. Awaiting reply: sent, and visible to the client until the date shown under the badge. Accepted: the client moved to points. Declined: the client refused; the reason appears under the badge. Auto-converted: the nightly sweep moved this client, not this campaign. Offer expired: 14 days passed with
1no answer. Withdrawn: you pulled the offer back. A status changes only when you send or withdraw an offer, or when the client answers it.","warning","Nothing reaches a client until you send it. A client whose plan has no equivalent cannot be sent an offer at all \u2014 they need a phone call.",3,"steps"],[1,"cardWithShadow","theme-card"],[1,"spacer"],["mat-flat-button","","color","primary","type","button",3,"click"],[1,"icon-18"],[1,"b-t-1"],[1,"filter-bar"],["appearance","outline",1,"filter-bar__select"],[3,"ngModelChange","ngModel"],[3,"value"],["appearance","outline",1,"filter-bar__search"],["matInput","",3,"ngModelChange","keyup.enter","ngModel"],["matSuffix",""],[1,"filter-bar__count"],[1,"mc-loading"],[1,"mc-empty"],["diameter","32"],[1,"table-scroll"],[1,"mc-table"],[3,"is-blocked","is-worse-off"],[3,"page","length","pageSize","pageIndex","pageSizeOptions"],[1,"mc-client"],[1,"mc-blocked-note"],[1,"mc-sub"],["appearance","outline",1,"mc-points"],["size","small",3,"type","label"],[1,"mc-reject"],[1,"mc-actions"],["mat-flat-button","","color","primary","type","button"],["mat-stroked-button","","type","button"],["matInput","","type","number","min","0",3,"ngModelChange","ngModel"],["mat-stroked-button","","type","button",3,"click"],[1,"mc-empty__icon"]],template:function(d,l){d&1&&(fy(0,"app-page-help",0),Js(1,"mat-card",1)(2,"mat-card-header")(3,"mat-card-title"),H_(4),pS(5,"translate"),gd(),fy(6,"span",2),Js(7,"button",3),Ey("click",function(){return l.recompute()}),Js(8,"mat-icon",4),H_(9,"refresh"),gd(),H_(10),pS(11,"translate"),gd()(),Js(12,"mat-card-content",5)(13,"div",6)(14,"mat-form-field",7)(15,"mat-label"),H_(16),pS(17,"translate"),gd(),Js(18,"mat-select",8),zy("ngModelChange",function(g){return W_(l.statusFilter,g)||(l.statusFilter=g),g}),Ey("ngModelChange",function(){return l.onFilterChange()}),Js(19,"mat-option",9),H_(20),pS(21,"translate"),gd(),Js(22,"mat-option",9),H_(23),pS(24,"translate"),gd(),Js(25,"mat-option",9),H_(26),pS(27,"translate"),gd(),Js(28,"mat-option",9),H_(29),pS(30,"translate"),gd(),Js(31,"mat-option",9),H_(32),pS(33,"translate"),gd(),Js(34,"mat-option",9),H_(35),pS(36,"translate"),gd(),Js(37,"mat-option",9),H_(38),pS(39,"translate"),gd(),Js(40,"mat-option",9),H_(41),pS(42,"translate"),gd()(),db(),gd(),Js(43,"mat-form-field",7)(44,"mat-label"),H_(45),pS(46,"translate"),gd(),Js(47,"mat-select",8),zy("ngModelChange",function(g){return W_(l.partnerFilter,g)||(l.partnerFilter=g),g}),Ey("ngModelChange",function(){return l.onFilterChange()}),Js(48,"mat-option",9),H_(49),pS(50,"translate"),gd(),Js(51,"mat-option",9),H_(52),pS(53,"translate"),gd(),Js(54,"mat-option",9),H_(55),pS(56,"translate"),gd(),Js(57,"mat-option",9),H_(58),pS(59,"translate"),gd()(),db(),gd(),Js(60,"mat-form-field",7)(61,"mat-label"),H_(62),pS(63,"translate"),gd(),Js(64,"mat-select",8),zy("ngModelChange",function(g){return W_(l.offerableOnly,g)||(l.offerableOnly=g),g}),Ey("ngModelChange",function(){return l.onFilterChange()}),Js(65,"mat-option",9),H_(66),pS(67,"translate"),gd(),Js(68,"mat-option",9),H_(69),pS(70,"translate"),gd()(),db(),gd(),Js(71,"mat-form-field",10)(72,"mat-label"),H_(73),pS(74,"translate"),gd(),Js(75,"input",11),zy("ngModelChange",function(g){return W_(l.search,g)||(l.search=g),g}),Ey("keyup.enter",function(){return l.onFilterChange()}),gd(),db(),Js(76,"mat-icon",12),H_(77,"search"),gd()(),Js(78,"span",13),H_(79),pS(80,"number"),pS(81,"translate"),gd()(),ZT(82,ot,2,0,"div",14)(83,vt,33,29)(84,xt,6,3,"div",15),gd()()),d&2&&(dy("steps",nS(86,it)),SC(4),jy(gS(5,42,"Migration campaign")),SC(6),Ed(" ",gS(11,44,"Recompute offers")," "),SC(6),jy(gS(17,46,"Status")),SC(2),$y("ngModel",l.statusFilter),pb(),SC(),dy("value",null),SC(),jy(gS(21,48,"All")),SC(2),dy("value",l.EnumMigrationOfferStatus.Pending),SC(),jy(gS(24,50,"Not sent yet")),SC(2),dy("value",l.EnumMigrationOfferStatus.Released),SC(),jy(gS(27,52,"Awaiting reply")),SC(2),dy("value",l.EnumMigrationOfferStatus.Accepted),SC(),jy(gS(30,54,"Accepted")),SC(2),dy("value",l.EnumMigrationOfferStatus.Rejected),SC(),jy(gS(33,56,"Declined")),SC(2),dy("value",l.EnumMigrationOfferStatus.AutoConverted),SC(),jy(gS(36,58,"Auto-converted")),SC(2),dy("value",l.EnumMigrationOfferStatus.Expired),SC(),jy(gS(39,60,"Offer expired")),SC(2),dy("value",l.EnumMigrationOfferStatus.Withdrawn),SC(),jy(gS(42,62,"Withdrawn")),SC(4),jy(gS(46,64,"Channel")),SC(2),$y("ngModel",l.partnerFilter),pb(),SC(),dy("value",null),SC(),jy(gS(50,66,"All")),SC(2),dy("value",l.EnumPartners.NoPartner),SC(),jy(gS(53,68,"Direct")),SC(2),dy("value",l.EnumPartners.Salla),SC(),jy(gS(56,70,"Salla")),SC(2),dy("value",l.EnumPartners.Zid),SC(),jy(gS(59,72,"Zid")),SC(4),jy(gS(63,74,"Offerable")),SC(2),$y("ngModel",l.offerableOnly),pb(),SC(),dy("value",null),SC(),jy(gS(67,76,"All")),SC(2),dy("value",true),SC(),jy(gS(70,78,"Can be offered")),SC(4),jy(gS(74,80,"Search by name")),SC(2),$y("ngModel",l.search),pb(),SC(4),By("",gS(80,82,l.total)," ",gS(81,84,"clients")),SC(3),YT(l.isLoading?82:l.rows.length?83:84));},dependencies:[Ng,Ts,Wc,Og,xc,Gc,Tt,ce,_,Xv,zg,w0,ei,H0,Zx,dn,da,xr,Sh,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,GI,tE,Dn,ME,ny,go,Kd,XE,Zf,LT,mA,mt$1,QM,WM],styles:['@charset "UTF-8";.spacer[_ngcontent-%COMP%]{flex:1 1 auto}.filter-bar[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;gap:12px;padding:16px 0 8px}.filter-bar__select[_ngcontent-%COMP%]{width:180px}.filter-bar__search[_ngcontent-%COMP%]{width:260px}.filter-bar__count[_ngcontent-%COMP%]{margin-inline-start:auto;font-size:var(--font-size-sm);color:var(--color-text-muted)}.table-scroll[_ngcontent-%COMP%]{width:100%;overflow-x:auto}.mc-table[_ngcontent-%COMP%]{width:100%;min-width:1040px;border-collapse:collapse}.mc-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%], .mc-table[_ngcontent-%COMP%] td[_ngcontent-%COMP%]{padding:10px 12px;text-align:start;vertical-align:top;border-bottom:1px solid var(--color-border, rgba(0, 0, 0, .08))}.mc-table[_ngcontent-%COMP%] th[_ngcontent-%COMP%]{font-size:var(--font-size-sm);font-weight:600;color:var(--color-text-muted);white-space:nowrap}.mc-table[_ngcontent-%COMP%] tr.is-blocked[_ngcontent-%COMP%]{opacity:.62}.mc-table[_ngcontent-%COMP%] tr.is-worse-off[_ngcontent-%COMP%]{background:#ed6c020f}.mc-client[_ngcontent-%COMP%]{font-weight:600}.mc-sub[_ngcontent-%COMP%]{font-size:var(--font-size-sm);color:var(--color-text-muted)}.mc-blocked-note[_ngcontent-%COMP%]{margin-top:2px;font-size:var(--font-size-sm);color:#b45309}.mc-worse[_ngcontent-%COMP%]{color:#b45309;font-weight:600}.mc-reject[_ngcontent-%COMP%]{margin-top:4px;font-size:var(--font-size-sm);color:var(--color-text)}.mc-points[_ngcontent-%COMP%]{width:110px}.mc-points[_ngcontent-%COMP%] .mat-mdc-form-field-subscript-wrapper{display:none}.mc-actions[_ngcontent-%COMP%]{white-space:nowrap}.mc-loading[_ngcontent-%COMP%], .mc-empty[_ngcontent-%COMP%]{display:flex;flex-direction:column;align-items:center;gap:8px;padding:48px 0;color:var(--color-text-muted)}.mc-loading__icon[_ngcontent-%COMP%], .mc-empty__icon[_ngcontent-%COMP%]{font-size:40px;width:40px;height:40px;opacity:.5}'],changeDetection:1});}}return a})();export{Mi as MigrationCampaignComponent};
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.