1import{a as Te,b as je,r as Se,s as Ie}from"./chunk-BH6AEEQT.js";import{Na as xe,Qa as Me,Za as Pe,a as ve,g as ye,h as _e,i as Ce}from"./chunk-6VE2ZK36.js";import{b as be,c as V}from"./chunk-5VLIHN6G.js";import{h as ge}from"./chunk-YA6TCHIV.js";import{a as he}from"./chunk-WOT3ABG3.js";import"./chunk-XUV6RSJT.js";import{a as ae}from"./chunk-3AQGEJ6I.js";import"./chunk-VKVWX2OA.js";import"./chunk-AS2ZKWYW.js";import"./chunk-7XRXS7NG.js";import"./chunk-YFZSEQBA.js";import"./chunk-O4QTNUWW.js";import"./chunk-SCMUGQN4.js";import"./chunk-5IE3ZNWJ.js";import"./chunk-UXWRPKXH.js";import"./chunk-U7W5Y5AD.js";import"./chunk-VRFF64FC.js";import{a as oe}from"./chunk-FPU2MZG2.js";import"./chunk-F3RTGCGZ.js";import"./chunk-WHRLPBNK.js";import{c as se}from"./chunk-5RP73VZ5.js";import"./chunk-4OPVZPNY.js";import"./chunk-SNLQ4K5G.js";import{b as pe,c as ue}from"./chunk-KRJYA5WV.js";import"./chunk-JLZLBKFQ.js";import"./chunk-4HM7XAEG.js";import"./chunk-QZMZXZ4U.js";import"./chunk-7GQHGAWA.js";import{b as ne}from"./chunk-K7266GLW.js";import"./chunk-OKC6FPX2.js";import"./chunk-H6RLFBCZ.js";import"./chunk-PXHAXO7Z.js";import{a as fe}from"./chunk-LEOK3TBM.js";import{a as le}from"./chunk-N2MVBGGZ.js";import"./chunk-V3EKAILP.js";import"./chunk-OS3CABJ4.js";import"./chunk-Y2QBTOIT.js";import"./chunk-WDX5GBAZ.js";import{a as ie}from"./chunk-R3ABRJGS.js";import{a as ee,b as te,c as re,f as S}from"./chunk-HVJQYGG7.js";import"./chunk-26QG2NYG.js";import{D as Q,E as W,F as X,e as _,h as U,i as G,n as Z,r as Y,u as J,z as K}from"./chunk-IT7TKBQK.js";import"./chunk-SDDMIKZ6.js";import{e as me,q as de}from"./chunk-ZIEJAFXK.js";import"./chunk-CGXOZM2U.js";import"./chunk-UFP4MN6V.js";import{b as ce}from"./chunk-SHNDZLFX.js";import"./chunk-WPILDL5A.js";import{l as j}from"./chunk-QOPGEPEN.js";import{O as L,R as z,U as k,n as H,t as T}from"./chunk-4FDDMESX.js";import{Bb as c,C as D,Ec as d,Fa as v,Fc as h,Ga as y,Hb as n,Qb as x,Rb as f,Sc as M,Wb as $,a as C,da as R,fd as F,gc as s,na as u,oc as N,pd as q,qd as E,tc as l,uc as m,vc as g,zc as O}from"./chunk-FGMC3YKI.js";import"./chunk-TWZW5B45.js";var Ne=()=>({required:"Project name is required."}),I=class a{constructor(r,e,t,i,o){this.fb=r;this.store=e;this.actions$=t;this.dialogRef=i;this.data=o;this.form=this.fb.group({name:["",[_.required,_.maxLength(120)]],timezone:["UTC",_.required],currency_code:["USD",_.required]})}form;submitting=!1;timezoneItems=[];currencyItems=[];currencies=[];subscriptions=new C;ngOnInit(){this.store.dispatch(Me({serviceId:this.data.serviceId})),this.store.dispatch(xe({serviceId:this.data.serviceId})),this.subscriptions.add(this.store.select(Ie).subscribe(r=>{r&&(this.timezoneItems=Object.values(r).flat().map(e=>({name:e,value:e})))})),this.subscriptions.add(this.store.select(Se).subscribe(r=>{this.currencies=r??[],this.currencyItems=this.currencies.map(e=>({name:`${e.code} - ${e.name}${e.symbol?" ("+e.symbol+")":""}`,value:e.code}))})),this.subscriptions.add(this.actions$.pipe(V(_e)).subscribe(()=>this.dialogRef.close(!0))),this.subscriptions.add(this.actions$.pipe(V(Ce)).subscribe(()=>this.submitting=!1))}ngOnDestroy(){this.subscriptions.unsubscribe()}submit(){if(this.form.invalid||this.submitting){this.form.markAllAsTouched();return}this.submitting=!0;let{name:r,timezone:e,currency_code:t}=this.form.value,i=this.currencies.find(o=>o.code===t);this.store.dispatch(ye({serviceId:this.data.serviceId,requestData:{name:r,timezone:e,currency_code:t,currency_symbol:i?.symbol}}))}cancel(){this.dialogRef.close()}static \u0275fac=function(e){return new(e||a)(n(Q),n(j),n(be),n(ee),n(te))};static \u0275cmp=x({type:a,selectors:[["fivecents-create-project"]],standalone:!1,decls:16,vars:9,consts:[[1,"am-dialog"],[1,"am-dialog__header","relative","d-flex","align-items-center","justify-content-center","p-20","brt-8"],[1,"font-L","fw-700"],[1,"image-poistion"],["aria-label","Close",1,"close",3,"click"],["src","assets/images/close-popup.svg"],[1,"am-dialog__body","px-125","py-50","d-flex","flex-column","gap-20",3,"ngSubmit","formGroup"],["label","PROJECT NAME","placeholder","Enter your project name","formControlName","name",3,"required","errorMessages"],["label","TIMEZONE","formControlName","timezone","bindLabel","name","bindValue","value","placeholder","Select timezone",3,"items","required"],["label","CURRENCY","formControlName","currency_code","bindLabel","name","bindValue","value","placeholder","Select currency",3,"items","required"],[1,"d-flex","justify-content-center","gap-12","mb-30"],["variant","grey",3,"btnClick"],["variant","green","type","submit",3,"btnClick","loading"]],template:function(e,t){e&1&&(l(0,"div",0)(1,"div",1)(2,"h2",2),M(3,"Create New Project"),m(),l(4,"div",3)(5,"button",4),d("click",function(){return t.cancel()}),g(6,"img",5),m()()(),l(7,"form",6),d("ngSubmit",function(){return t.submit()}),g(8,"app-input",7)(9,"app-select",8)(10,"app-select",9),m(),l(11,"div",10)(12,"app-button",11),d("btnClick",function(){return t.cancel()}),M(13,"Cancel"),m(),l(14,"app-button",12),d("btnClick",function(){return t.submit()}),M(15," Create Project "),m()()()),e&2&&(c(7),s("formGroup",t.form),c(),s("required",!0)("errorMessages",F(8,Ne)),c(),s("items",t.timezoneItems)("required",!0),c(),s("items",t.currencyItems)("required",!0),c(4),s("loading",t.submitting))},dependencies:[Z,U,G,K,Y,J,ie,oe,ne],styles:[".am-dialog[_ngcontent-%COMP%]{display:block}.am-dialog__header[_ngcontent-%COMP%]{background:#f4f4f4}.am-dialog__close[_ngcontent-%COMP%]{right:1rem;top:50%;transform:translateY(-50%);width:2rem;height:2rem;background:#fff;box-shadow:0 1px 4px #00000026}"]})};function Oe(a,r){if(a&1){let e=O();l(0,"fivecents-table",3),q(1,"async"),d("sortChange",function(i){v(e);let o=h();return y(o.onSort(i))})("manageButton",function(i){v(e);let o=h();return y(o.handleManageButton(i))})("emptyDataEvent",function(){v(e);let i=h();return y(i.openCreateProject())})("searchTextValue",function(i){v(e);let o=h();return y(o.onSearch(i))}),m()}if(a&2){let e,t=h();s("tableHeaderProps",t.tableHeaderProps)("loading",(e=E(1,3,t.loading$))!==null&&e!==void 0?e:!1)("sortOptions",t.sortOptions)}}function Fe(a,r){a&1&&g(0,"five-cents-skeleton-summary-table")}var A=class a{constructor(r,e,t,i,o){this.store=r;this.dialog=e;this.router=t;this.route=i;this.adManager=o;this.loading$=this.store.select(Te)}serviceId=null;dashboardId="";projects=[];filteredProjects=[];loading$;searchTerm="";sortBy="newest";sortOptions=[{label:"Newest",value:"newest"},{label:"Oldest",value:"oldest"},{label:"A - Z",value:"name"},{label:"Z - A",value:"name-desc"}];breadcrumbs=[];bannerType="module";subText="Boost campaigns with Ad Manager!";blackBannerTabs=[];moduleButtons=[{label:"+ Create New Project",variant:"green",action:"create-project"}];tableHeaderProps=null;subscriptions=new C;stats=null;statsRefreshMs=3e4;ngOnInit(){this.dashboardId=this.route.parent?.parent?.snapshot.paramMap.get("dashboardId")??this.router.url.split("/")[1],this.breadcrumbs=[{text:"Dashboard",route:`/${this.dashboardId}`},{text:"Ad Manager"}],this.subscriptions.add(this.store.select(ce).subscribe(r=>{r?.id&&r.id!==this.serviceId&&(this.serviceId=r.id,this.loadProjects(),this.watchStats(r.id))}
1)),this.subscriptions.add(this.store.select(je).subscribe(r=>{this.projects=r??[],this.applyFilters()}))}ngOnDestroy(){this.subscriptions.unsubscribe()}loadProjects(){this.serviceId!=null&&this.store.dispatch(ve({serviceId:this.serviceId}))}watchStats(r){this.subscriptions.add(D(0,this.statsRefreshMs).pipe(R(()=>this.adManager.getStats(r))).subscribe({next:e=>{this.stats=e?.stats??e??null,this.setBannerTabs()},error:()=>{}}))}stat(r,e,t="0"){return r||(e!=null?`${e}`:t)}setBannerTabs(){let r=we=>this.projects.reduce((Be,ke)=>Be+(Number(ke[we])||0),0),e=this.stats,t=e?.projects?.count??this.projects.length,i=e?.projects?.limit??0,o=e?.usage_this_month,b=e?.monthly_hits,p=e?.hourly_throughput;this.blackBannerTabs=[{title:"Projects",titleIconSrc:"assets/images/ad-manager/settings.svg",secondaryValue:`${t}`,secondaryValueText:"created",mainValue:i>0?`of ${i}`:void 0,slider:i>0?e?.projects?.percent??0:void 0,greenPoint:!1},{title:"Total Advertiser",titleIconSrc:"assets/images/ad-manager/advertiser.svg",secondaryValue:`${e?.advertisers?.total??r("advertisers_count")}`,secondaryValueText:"advertiser",mainValue:`${t} projects`,greenPoint:!0},{title:"Total Campaigns",titleIconSrc:"assets/images/ad-manager/campaigns.svg",secondaryValue:`${e?.campaigns?.total??r("campaigns_count")}`,secondaryValueText:"campaigns",mainValue:`${t} projects`,greenPoint:!0},{title:"Total Creatives",titleIconSrc:"assets/images/ad-manager/creatives.svg",secondaryValue:`${e?.creatives?.total??r("creatives_count")}`,secondaryValueText:"creatives",mainValue:`${t} projects`,greenPoint:!0}],e&&this.blackBannerTabs.push({title:"Monthly Hits Used",titleIconSrc:"assets/images/ad-manager/reports.svg",secondaryValue:this.stat(o?.ad_requests_formatted,o?.ad_requests),secondaryValueText:"requests",mainValue:b?.limit_formatted?`of ${b.limit_formatted}`:void 0,slider:b?.used_percent??0,greenPoint:!1},{title:"Impressions This Month",titleIconSrc:"assets/images/ad-manager/ad-pods.svg",secondaryValue:this.stat(o?.impressions_formatted,o?.impressions),secondaryValueText:"impressions",greenPoint:!1},{title:"Average Fill Rate",titleIconSrc:"assets/images/ad-manager/reports.svg",secondaryValue:this.stat(o?.avg_fill_rate_formatted,o?.avg_fill_rate,"0%"),secondaryValueText:"this month",slider:o?.avg_fill_rate??0,greenPoint:!1},{title:"Average Completion Rate",titleIconSrc:"assets/images/ad-manager/reports.svg",secondaryValue:this.stat(o?.avg_completion_rate_formatted,o?.avg_completion_rate,"0%"),secondaryValueText:"this month",slider:o?.avg_completion_rate??0,greenPoint:!1},{title:"Hourly Throughput",titleIconSrc:"assets/images/ad-manager/ad-pods.svg",secondaryValue:this.stat(p?.current_formatted,p?.current),secondaryValueText:"req/hr",mainValue:p?.limit_formatted?`of ${p.limit_formatted}`:void 0,slider:p?.percent??0,sliderInDanger:(p?.percent??0)>=80,greenPoint:!1})}onSearch(r){this.searchTerm=r??"",this.applyFilters()}onSort(r){this.sortBy=r||"newest",this.applyFilters()}applyFilters(){let r=this.searchTerm.trim().toLowerCase(),e=r?this.projects.filter(t=>t.name?.toLowerCase().includes(r)):[...this.projects];switch(this.sortBy){case"oldest":e=e.sort((t,i)=>(t.id??0)-(i.id??0));break;case"name":e=e.sort((t,i)=>(t.name??"").localeCompare(i.name??""));break;case"name-desc":e=e.sort((t,i)=>(i.name??"").localeCompare(t.name??""));break;default:e=e.sort((t,i)=>(i.id??0)-(t.id??0));break}this.filteredProjects=e,this.setBannerTabs(),this.buildTable()}formatUsage(r){if(!r)return"\u2014";let e=(t,i)=>`<span class="d-flex gap-5"><span class="text-secondary fw-400 w-60px ">${t}:</span><span class="text-black fw-500">${i}</span></span>`;return'<span class="usage-grid font-M "><span class="usage-col">'+e("Req",r.ad_requests??0)+e("Impr",r.impressions??0)+'</span><span class="usage-divider"></span><span class="usage-col">'+e("Fill",r.fill_rate??0)+e("Comp",r.completion_rate??0)+"</span></span>"}buildTable(){let r={color:"#252525",headers:[{text:"#",width:4},{text:"Name",width:16},{text:"Timezone",width:12},{text:"Currency",width:10,textAlign:"center"},{text:"Advertisers",width:10,textAlign:"center"},{text:"Campaigns",width:10,textAlign:"center"},{text:"Creatives",width:10,textAlign:"center"},{text:"This Month",width:18,textAlign:"center"},{text:"",width:10,manageButton:["1"]}]},e=this.filteredProjects.map((t,i)=>{let o=this.formatUsage(t.usage_this_month),b=t.settings?.currency_symbol?`${t.settings?.currency_symbol} ${t.settings?.currency_code??""}`:t.settings?.currency_code??"USD";return{color:"",body:[{type:"text",text:(i+1).toString().padStart(2,"0"),width:4},{type:"text",text:t.name,width:16,route:t.id.toString()},{type:"text",text:t.settings?.timezone||"UTC",width:12},{status:"hollowButton",text:b,statusColor:"#58a52c31",statusTextColor:"#59a52c",width:10,textAlign:"center"},{type:"text",text:`${t.advertisers_count??0}`,width:10,textAlign:"center"},{type:"text",text:`${t.campaigns_count??0}`,width:10,textAlign:"center"},{type:"text",text:`${t.creatives_count??0}`,width:10,textAlign:"center"},{type:"text",text:o,width:18,textAlign:"center"},{text:"Manage",width:10,manageButton:["Manage"],textAlign:"center"}]}});this.tableHeaderProps={globalColor:"#252525",headers:r,body:e,searchBox:!0,empty
1DataText:this.searchTerm?`No projects found for <span class="text-black">${this.searchTerm}</span>`:"Create your First Project",emptyDataActionText:"Create New Project",pagination:{frontend:!0,totalContent:this.filteredProjects.length,perPageContent:20}}}onBannerAction(r){r==="create-project"&&this.openCreateProject()}handleManageButton(r){let e=this.filteredProjects[r.id];e&&this.manageProject(e)}openCreateProject(){this.serviceId!=null&&this.dialog.open(I,{width:"1100px",disableClose:!0,panelClass:"custom-mat-dialog",data:{serviceId:this.serviceId}})}manageProject(r){this.router.navigate([r.id],{relativeTo:this.route})}static \u0275fac=function(e){return new(e||a)(n(j),n(re),n(z),n(L),n(Pe))};static \u0275cmp=x({type:a,selectors:[["fivecents-ad-manager-summary"]],standalone:!1,decls:4,vars:7,consts:[[3,"breadcrumbs"],[3,"contentClicked","bannerType","title","subText","blackBannerTabs","moduleButtons"],["title","Ad Manager Projects",3,"tableHeaderProps","loading","sortOptions"],["title","Ad Manager Projects",3,"sortChange","manageButton","emptyDataEvent","searchTextValue","tableHeaderProps","loading","sortOptions"]],template:function(e,t){e&1&&(g(0,"fivecents-breadcrumbs",0),l(1,"fivecents-black-banner",1),d("contentClicked",function(o){return t.onBannerAction(o)}),m(),$(2,Oe,2,5,"fivecents-table",2)(3,Fe,1,0,"five-cents-skeleton-summary-table")),e&2&&(s("breadcrumbs",t.breadcrumbs),c(),s("bannerType",t.bannerType)("title","Ad Manager")("subText",t.subText)("blackBannerTabs",t.blackBannerTabs)("moduleButtons",t.moduleButtons),c(),N(t.tableHeaderProps?2:3))},dependencies:[le,ge,se,me,H],styles:["[_nghost-%COMP%]{display:block}"]})};var qe=[{path:"",component:A}],w=class a{static \u0275fac=function(e){return new(e||a)};static \u0275mod=f({type:a});static \u0275inj=u({imports:[k.forChild(qe),k]})};var B=class a{static \u0275fac=function(e){return new(e||a)};static \u0275mod=f({type:a});static \u0275inj=u({imports:[T,W,X,S,pe,ae]})};var Ae=class a{static \u0275fac=function(e){return new(e||a)};static \u0275mod=f({type:a});static \u0275inj=u({imports:[T,w,B,fe,he,ue,de,S]})};export{Ae as SummaryModule};
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.