1import {O as O$1}from'./chunk-DDZlFzwC.js';import {S}from'./chunk-AvbB3w2y.js';import {c as ce$1}from'./chunk-Cha4_V9g.js';import'./chunk-yuXVPJRt.js';import {g,b as gr,h as c$1,c8 as Xr,E,D,H,bQ as P,bO as Gt,O,aE as lt,a as G,K as Kb,P as Pg,bt as Is,bu as Tg,bV as $s,bS as Dc,bT as zc,T as Tt,k as Kv,V as Vg,l as b0,L as L0,Y as Yx,m as dn,b2 as da,by as vr,bz as yr,n as Vw,bA as Pw,o as nk,t as td,p as tC,q as bC,s as sv,N as NC,X as XC,_ as _D,aO as oD,aP as lD,b0 as mD,aX as sD,r as il,u as XD,cj as $D,ck as Bu,cl as Nu,v as rM,F as Fb,w as t1,y as A1,z as gS,B as Vs,C as zs,I as Fi,J as NS,Z as ZS,M as EI,Q as us,R as ms,S as HI,U as ZI,$ as Dn,a0 as kE,a1 as Jv,a2 as go,a3 as qd,av as on,a4 as YE,a5 as OT,a6 as lA,a7 as mt,a8 as cy,aa as Xs,ac as V_,ad as hd,ae as fS,a9 as qT,bZ as Vy,b_ as G_,bB as lb,ab as my,ai as ay,bC as tS,ag as _C,ak as Dd,al as hS,ah as ZT,b$ as By,bE as fb,af as KT,aV as QT,am as XT,aT as l_,aR as o_,aS as Pp,aU as Lp,aj as ky,b5 as sy}from'./main-CTPND76J.js';import {R as Ri}from'./chunk-CLFEoJNz.js';import'./chunk-CAH8VGMK.js';var ne=()=>["Add a tag for each thing you want to be able to filter by later.","Keep the list short \u2014 a tag nobody applies is worse than no tag.","Renaming a tag updates it on every customer already carrying it."],oe=()=>[0,1,2,3,4,5];function re(o,u){o&1&&(Xs(0,"div",15),cy(1,"app-skeleton-loader",16),hd());}function le(o,u){o&1&&(Xs(0,"div",4),KT(1,re,2,0,"div",15,QT),hd()),o&2&&(_C(),XT(tS(0,oe)));}function se(o,u){if(o&1){let t=o_();Xs(0,"button",30),fS(1,"translate"),fS(2,"translate"),my("click",function(e){Pp(t);let i=l_().$implicit;return l_(2).showTaggedContacts(i),Lp(e.stopPropagation())}),Xs(3,"mat-icon",31),V_(4,"group"),hd(),Xs(5,"span"),V_(6),hd()();}if(o&2){let t=l_().$implicit;ay("matTooltip",hS(1,3,"Show the contacts carrying this tag")),sy("aria-label",hS(2,5,"Show the contacts carrying this tag")+": "+t.text),_C(6),ky(t.contactsCount);}}function me(o,u){o&1&&(Xs(0,"span",21),V_(1),fS(2,"translate"),hd()),o&2&&(_C(),ky(hS(2,1,"Not used yet")));}function de(o,u){if(o&1){let t=o_();Xs(0,"button",32),my("click",function(e){Pp(t);let i=l_().$implicit;return l_(2).updateTag(i,"up"),Lp(e.stopPropagation())}),Xs(1,"mat-icon",2),V_(2,"arrow_upward"),hd()();}}function ce(o,u){o&1&&(Xs(0,"mat-hint",12),V_(1),fS(2,"translate"),hd()),o&2&&(_C(),Dd(" ",hS(2,1,"You have reached the maximum number of characters")," "));}function pe(o,u){if(o&1){let t=o_();Xs(0,"mat-expansion-panel")(1,"mat-expansion-panel-header")(2,"div",17)(3,"div",18)(4,"span"),V_(5),hd(),Xs(6,"span",19),V_(7),hd(),qT(8,se,7,7,"button",20)(9,me,3,3,"span",21),hd(),Xs(10,"div",22)(11,"button",23),my("click",function(e){let i=Pp(t).$implicit;return l_(2).updateTag(i,"down"),Lp(e.stopPropagation())}),Xs(12,"mat-icon",2),V_(13,"arrow_downward"),hd()(),qT(14,de,3,0,"button",24),hd()()(),Xs(15,"div",25)(16,"mat-form-field",8)(17,"mat-label"),V_(18),fS(19,"translate"),hd(),Xs(20,"input",26),Vy("ngModelChange",function(e){let i=Pp(t).$implicit;return G_(i.text,e)||(i.text=e),Lp(e)}),hd(),lb(),Xs(21,"mat-hint",10),V_(22),hd(),qT(23,ce,3,3,"mat-hint",12),hd(),Xs(24,"div",27)(25,"button",28),fS(26,"translate"),my("click",function(){let e=Pp(t).$implicit,i=l_(2);return Lp(i.updateTag(e))}),V_(27),fS(28,"translate"),Xs(29,"mat-icon",2),V_(30,"task_alt"),hd()(),Xs(31,"button",29),fS(32,"translate"),my("click",function(){let e=Pp(t).$implicit,i=l_(2);return Lp(i.deleteTag(e.id))}),V_(33),fS(34,"translate"),Xs(35,"mat-icon",2),V_(36,"delete"),hd()()()()();}if(o&2){let t=u.$implicit;_C(5),Dd("",t.order," - "),_C(2),ky(t.text),_C(),ZT(t.contactsCount>0?8:9),_C(6),ZT(t.order>1?14:-1),_C(4),ky(hS(19,12,"Tag text")),_C(2),By("ngModel",t.text),fb(),_C(2),Dd("",t.text.length||0,"/20"),_C(),ZT(t.text.length==20?23:-1),_C(2),ay("matTooltip",hS(26,14,"Save")),_C(2),Dd(" ",hS(28,16,"Update")," "),_C(4),ay("matTooltip",hS(32,18,"Delete")),_C(2),Dd(" ",hS(34,20,"Delete")," ");}}function ge(o,u){if(o&1&&(Xs(0,"mat-accordion",5),KT(1,pe,37,22,"mat-expansion-panel",null,QT),hd()),o&2){let t=l_();_C(),XT(t.tags);}}function ue(o,u){o&1&&(Xs(0,"mat-hint",12),V_(1),fS(2,"translate"),hd()),o&2&&(_C(),Dd(" ",hS(2,1,"You have reached the maximum number of characters")," "));}var Mi=(()=>{class o{constructor(t,s,e,i,p,ae){this.loadingService=t,this.errorService=s,this.translate=e,this.toastr=i,this.customerTagService=p,this.router=ae,this.newTagText="",this.isLoading=false,this.tags=[],this.dialog=g(gr),this.dialogConfig=g(c$1);}ngOnInit(){this.getTags();}getTags(){this.isLoading=true,this.loadingService.beginSuppress(),this.sub=this.customerTagService.getCustomerTagUsage().pipe(Xr(()=>{this.isLoading=false,this.loadingService.endSuppress();})).subscribe({next:t=>{this.tags=t.data;},error:t=>this.errorService.setError(t,"Error while getting the data")});}showTaggedContacts(t){this.router.navigate(["/apps/messages"],{queryParams:{tag:t.text}});}addTag(){this.newTagText?.trim()&&(this.loadingService.loadingOn(),this.sub=this.customerTagService.addCustomerTag(this.newTagText.trim(),0).subscribe({next:t=>{this.loadingService.loadingOff(),t.succeeded?(this.getTags(),this.toastr.success("Added Successfully"),this.newTagText=""):this.errorService.setError(t,"Error while sending");},error:t=>{this.errorService.setError(t,"Failed to Add");}}));}confirmDeleteTag(t){this.loadingService.loadingOn(),this.sub=this.customerTagService.deleteCustomerTag(t).subscribe({next:s=>{this.loadingService.loadingOff(),s?(this.tags=this.tags.filter(e=>
1e.id!==t),this.tags.forEach((e,i)=>e.order=i+1),this.toastr.success("Deleted Successfully")):this.errorService.setError(s,"Fail to delete!");},error:s=>{this.errorService.setError(s,"Fail to delete!");}});}deleteTag(t){this.dialog.open(Ri,E(D({},this.dialogConfig.getDefaultDialogConfig()),{data:{confirmed:true}})).afterClosed().subscribe(e=>{(e===true||e?.confirmed===true)&&this.confirmDeleteTag(t);});}updateTag(t,s){if(!this.tags||this.tags.length===0)return;let e=this.tags.findIndex(i=>i.id===t.id);if(e!==-1){if(s){let i=s==="up"?e-1:e+1;if(i<0||i>=this.tags.length)return;[this.tags[e],this.tags[i]]=[this.tags[i],this.tags[e]];}this.tags.forEach((i,p)=>i.order=p+1),this.loadingService.loadingOn(),this.sub=this.customerTagService.bulkUpdateCustomerTags(this.tags).subscribe({next:i=>{this.loadingService.loadingOff(),i.succeeded?this.toastr.success("Updated Successfully"):this.errorService.setError(i,"Failed to Complete the Operation");},error:i=>{this.loadingService.loadingOff(),this.errorService.setError(i,"Failed to Complete the Operation");}});}}static{this.\u0275fac=function(s){return new(s||o)(H(P),H(Gt),H(O),H(lt),H(O$1),H(G))};}static{this.\u0275cmp=Kb({type:o,selectors:[["app-manage-customer-tags"]],decls:30,vars:19,consts:[["helpKey","settings-customer-tags","intro","The tags your team can put on a customer. Tags are how you segment people for campaigns and reporting.",3,"steps"],[1,"d-flex","align-items-center"],[1,"icon-18"],[1,"b-t-1","p-t-8"],[1,"skeleton-list"],["multi",""],[1,"row","align-items-center"],[1,"col-9"],["color","primary",1,"w-100"],["type","text","matInput","","name","newTagText","required","","maxlength","20",3,"ngModelChange","ngModel"],["align","end"],["align","start"],["align","start","color","warn"],[1,"col-3"],["type","button","mat-flat-button","","color","primary",1,"m-l-16",3,"click"],[1,"d-flex","align-items-center","gap-2","p-y-8"],["type","text","width","240px"],[1,"d-flex","justify-content-between","align-items-center","w-100","flex-nowrap"],[1,"d-flex","align-items-center","gap-2","flex-wrap",2,"min-width","0"],[1,"text-truncate"],["type","button",1,"sl-pill","sl-pill--info","sl-pill--plain","tag-count",3,"matTooltip"],[1,"sl-pill","sl-pill--muted","sl-pill--plain","tag-count"],[1,"d-flex","align-items-center","gap-1","flex-nowrap"],["mat-icon-button","","color","primary","aria-label","arrow downward",3,"click"],["mat-icon-button","","color","primary","aria-label","arrow upward"],[1,"p-3"],["type","text","matInput","","maxlength","20",3,"ngModelChange","ngModel"],[1,"d-flex","justify-content-end","gap-2","mt-2","flex-wrap"],["mat-flat-button","","color","primary",1,"shadow-none",3,"click","matTooltip"],["mat-flat-button","","color","warn",1,"shadow-none",3,"click","matTooltip"],["type","button",1,"sl-pill","sl-pill--info","sl-pill--plain","tag-count",3,"click","matTooltip"],[1,"icon-16"],["mat-icon-button","","color","primary","aria-label","arrow upward",3,"click"]],template:function(s,e){s&1&&(cy(0,"app-page-help",0),Xs(1,"mat-card")(2,"mat-card-header")(3,"mat-card-title",1)(4,"mat-icon",2),V_(5,"tag "),hd(),V_(6),fS(7,"translate"),hd()(),Xs(8,"mat-card-content",3),qT(9,le,3,1,"div",4),qT(10,ge,3,0,"mat-accordion",5),Xs(11,"h3",1)(12,"mat-icon",2),V_(13,"add "),hd(),V_(14),fS(15,"translate"),hd(),Xs(16,"div",6)(17,"div",7)(18,"mat-form-field",8)(19,"input",9),Vy("ngModelChange",function(p){return G_(e.newTagText,p)||(e.newTagText=p),p}),hd(),lb(),Xs(20,"mat-hint",10),V_(21),hd(),Xs(22,"mat-hint",11),V_(23),fS(24,"translate"),hd(),qT(25,ue,3,3,"mat-hint",12),hd()(),Xs(26,"div",13)(27,"button",14),my("click",function(){return e.addTag()}),V_(28),fS(29,"translate"),hd()()()()()),s&2&&(ay("steps",tS(18,ne)),_C(6),Dd(" ",hS(7,10,"Customer Tags Management")," "),_C(3),ZT(e.isLoading?9:-1),_C(),ZT(e.isLoading?-1:10),_C(4),Dd(" ",hS(15,12,"Add")," "),_C(5),By("ngModel",e.newTagText),fb(),_C(2),Dd(" ",e.newTagText.length||0,"/20 "),_C(2),Dd(" ",hS(24,14,"Maximum number of characters is")," 20 "),_C(2),ZT(e.newTagText.length==20?25:-1),_C(3),Dd(" ",hS(29,16,"Add")));},dependencies:[ce$1,Pg,Is,Tg,$s,Dc,zc,Tt,S,Kv,Vg,b0,L0,Yx,dn,da,vr,yr,Vw,Pw,nk,td,tC,bC,sv,NC,XC,_D,oD,lD,mD,sD,il,XD,$D,Bu,Nu,rM,Fb,t1,A1,gS,Vs,zs,Fi,NS,ZS,EI,us,ms,HI,ZI,Dn,kE,Jv,go,qd,on,YE,OT,lA,mt],styles:['@charset "UTF-8";.tag-count[_ngcontent-%COMP%]{border:0;cursor:default;font-family:inherit}.tag-count[_ngcontent-%COMP%]:is(button){cursor:pointer;touch-action:manipulation}.tag-count[_ngcontent-%COMP%]:is(button):hover{filter:brightness(.96)}.tag-count[_ngcontent-%COMP%]:is(button):focus-visible{outline:2px solid var(--color-primary);outline-offset:2px}.tag-count[_ngcontent-%COMP%] .icon-16[_ngcontent-%COMP%]{font-size:var(--font-size-base);width:16px;height:16px}'],changeDetection:1});}}return o}
1)();export{Mi as ManageCustomerTagsComponent};
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.