1"use strict"; 2!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="7efe342e-8adb-5e16-97fe-181e4552aa87")}catch(e){}}(); 3(self.webpackChunkclient_panel=self.webpackChunkclient_panel||[]).push([[9681],{15062:(k,E,e)=>{e.d(E,{x:()=>X});var m=e(75797),S=e(43942),I=e(19999),b=e(98764),j=e(52575),z=e(36647),C=e(85240),A=e(52849),$=e(40436),V=e(47276);let X=(()=>{class w{constructor(x,t,v){this.sorterService=x,this.filtersService=t,this.paginatorService=v,this.refresh$=new m.t(0)}getManager(x){return new S.c(t=>{let v={count:0,items:[]};const L=(0,I.z)([this.sorterService.state,this.paginatorService.state,this.filtersService.state.pipe((0,b.M)(()=>{this.paginatorService.setState({page:1})})),this.refresh$]).pipe((0,b.M)(()=>t.next({...v,loading:!0})),(0,j.B)(10),(0,z.n)(([r,u,c])=>x({filters:c,...u,sort:r.length?r:[{field:"createdAt",direction:"desc"}]}))).subscribe(r=>{v=r,t.next({...v,loading:!1})});return()=>{v={count:0,items:[]},L.unsubscribe()}})}refresh(){this.refresh$.next(this.refresh$.value+1)}static{this.\u0275fac=function(t){return new(t||w)(C.KVO(A.P),C.KVO($.b),C.KVO(V.H))}}static{this.\u0275prov=C.jDH({token:w,factory:w.\u0275fac,providedIn:"any"})}}return w})()},16067:(k,E,e)=>{e.d(E,{PS:()=>j,D0:()=>b,tW:()=>C,Mb:()=>z});var m=e(49645),S=e.n(m);const b=A=>S()(A).endOf("day").toDate(),j=A=>S()(A).startOf("day").toDate(),z={ACTIVE:"Aktywna",INACTIVE:"Nieaktywna",CREATING:"W trakcie konfiguracji",PROCESSING:"W trakcie konfiguracji",ERROR:"B\u0142\u0105d",INVALID:"B\u0142\u0119dna konfiguracja",BLOCKED:"Zablokowana",VERIFYING:"W trakcie weryfikacji",NOT_CREATED:"Nieskonfigurowana"},C={ACTIVE:"info",INACTIVE:"error",CREATING:"warning",PROCESSING:"warning",ERROR:"error",INVALID:"error",BLOCKED:"error",VERIFYING:"warning",NOT_CREATED:"default"}},40436:(k,E,e)=>{e.d(E,{K:()=>S.K,b:()=>m.b});var m=e(95338),S=e(22858)},61669:(k,E,e)=>{e.d(E,{z:()=>I});var m=e(12481);const S=["*"];let I=(()=>{class b{static{this.\u0275fac=function(C){return new(C||b)}}static{this.\u0275cmp=m.VBU({type:b,selectors:[["table-header"]],inputs:{row:"row"},standalone:!1,ngContentSelectors:S,decls:2,vars:0,consts:[[1,"table-header"]],template:function(C,A){1&C&&(m.NAR(),m.j41(0,"div",0),m.SdG(1),m.k0s())},styles:[".table-header[_ngcontent-%COMP%]{display:flex;flex-flow:row;align-items:center;justify-content:space-between}.table-header[_ngcontent-%COMP%] >h4, .table-header[_ngcontent-%COMP%] >h6{margin-bottom:0}.table-header[_ngcontent-%COMP%] >div{display:flex;justify-content:right;align-items:center}"]})}}return b})()},61859:(k,E,e)=>{e.r(E),e.d(E,{RetailMediaManagerModule:()=>ce});var m=e(93683),S=e(8050),I=e(38223),b=e(41134),j=e(75910),z=e(62795),C=e(27265),A=e(21303),$=e(34487),V=e(89204),X=e(21102),w=e.n(X),W=e(49645),x=e.n(W),t=e(12481),v=e(59452),L=e(70271),r=e(56196),u=e(36647),c=e(86301),p=e(19999),h=e(63037),g=e(13710),l=e(85240),K=e(15062),U=e(40436),N=e(84608),Y=e(10796),at=e(78253),ht=e(65123),it=e(35073),_=e(24074),st=e(84175),H=e(53777),yt=e(61669),ot=e(26364),rt=e(13088),Z=e(24398),T=e(99027),q=e(31730),J=e(5270),ct=e(32518),tt=e(85422),It=e(74388);let Ct=(()=>{class i{setOperations(){return{Archive:{label:"Archiwizuj",name:"Archive",icon:"archive",iconOnly:!0,easyAccess:!1},Unarchive:{label:"Cofnij archiwizacj\u0119",name:"Unarchive",icon:"unarchive",iconOnly:!0,easyAccess:!1},ShowOrder:{label:"Wy\u015bwietl ofert\u0119",name:"ShowOrder",icon:"list_alt",iconOnly:!0,easyAccess:!0,fn:()=>{this.showOrder()}}}}constructor(n,a){this.dialogService=n,this.router=a,this.onUpdateStatus=new t.bkB,this.statusesIcons=ct.DG,this.actionsMap=ct.sk}showOrder(){this.router.navigate(["order-acceptance",this.campaign.campaignId])}setCampaignStatus(n){const a=this.campaign;if(!a?.status)return;const{question:s,message:f}=this.getMessageBasedOnStatus(n,a.name,a.state);this.dialogService.openConfirmDialog({message:s}).afterClosed().subscribe(O=>{O&&this.onUpdateStatus.emit({campaign:a,status:n,successMessage:f})})}getMessageBasedOnStatus(n,a,s){switch(n){case T.BE.ACTIVE:return{question:"Czy na pewno chcesz uruchomi\u0107 kampani\u0119?",message:`Zmieniono status kampanii: ${a} na aktywn\u0105`};case T.BE.NOT_ACTIVE:return{question:"Czy na pewno chcesz zatrzyma\u0107 kampani\u0119?",message:`Zmieniono status kampanii: ${a} na nieaktywn\u0105`};case T.BE.PAUSED:return{question:"Czy na pewno chcesz wstrzyma\u0107 kampani\u0119?",message:`Zmieniono status kampanii: ${a} na wstrzyman\u0105`};case T.BE.ARCHIVED:return s===T.BE.ARCHIVED?{question:"Czy na pewno chcesz przywr\xf3ci\u0107 kampani\u0119?",message:`Przywr\xf3cono kampani\u0119: ${a}`}:{question:"Czy na pewno chcesz zarchiwizowa\u0107 kampani\u0119?",message:`Zmieniono status kampanii: ${a} na zarchiwizowan\u0105`};case T.BE.DRAFT:return{question:"Czy na pewno chcesz przenie\u015b\u0107 kampani\u0119 do stanu szkica?",message:`Zmieniono status kampanii: ${a} na szkic`};case T.BE.NOT_PAID:return{question:"Czy na pewno chcesz przenie\u015b\u0107 kampani\u0119 do stanu nieop\u0142acony?",message:`Zmieniono status kampanii: ${a} na nieop\u0142acon\u0105`};case T.BE.RESERVED:return{question:"Czy na pewno chcesz przenie\u015b\u0107 kampani\u0119 do stanu zarezerwowany?",message:`Zmieniono status kampanii: ${a} na zarezerwowan\u0105`};case T.BE.TO_REVIEW:return{question:"Czy na pewno chcesz wys\u0142a\u0107 kampani\u0119 do weryfikacji?",message:`Zmieniono status kampanii: ${a} na w trakcie weryfikacji`};case T.BE.CANCELED:return{question:"Czy na pewno chcesz anulowa\u0107 kampani\u0119? Nie b\u0119dzie ona weryfikowana!",message:`Zmieniono status kampanii: ${a} na anulowan\u0105`};default:return{question:"Czy na pewno chcesz zmieni\u0107 status kampanii?",message:`Zmieniono status kampanii: ${a}`}}}static{this.\u0275fac=function(a){return new(a||i)(t.rXU(it.o),t.rXU(tt.Ix))}}static{this.\u0275cmp=t.VBU({type:i,selectors:[["rm-retail-media-campaign-actions"]],inputs:{campaign:"campaign"},outputs:{onUpdateStatus:"onUpdateStatus"},decls:1,vars:4,consts:[[3,"onValueChange","actions","operations","statusesIcons","actionsMap"]],template:function(a,s){1&a&&(t.j41(0,"object-actions",0),t.bIt("onValueChange",function(O){return s.setCampaignStatus(O)}),t.k0s()),2&a&&t.Y8G("actions",s.campaign.actions)("operations",s.setOperations())("statusesIcons",s.statusesIcons)("actionsMap",s.actionsMap)},dependencies:[C.q,It.w],encapsulation:2})}}return i})();var F=e(30499),Tt=e(24735),Mt=e(69885),St=e(49710),bt=e(31034),Rt=e(60631),Et=e(55510),At=e(16401);const $t=["table"],wt=["*"],Ot=i=>[i];function jt(i,o){if(1&i&&(t.j41(0,"div",13)(1,"a",16)(2,"mat-icon",17),t.EFF(3,"edit"),t.k0s()()()),2&i){const n=t.XpG(2).row;t.R7$(),t.Y8G("routerLink",t.eq3(1,Ot,n.campaignId))}}function zt(i,o){if(1&i){const n=t.RV6();t.j41(0,"div",12),t.nVh(1,jt,4,3,"div",13),t.nI1(2,"async"),t.j41(3,"div",14)(4,"rm-retail-media-campaign-actions",15),t.bIt("onUpdateStatus",function(s){l.eBV(n);
3const f=t.XpG(2);return l.Njj(f.setStatus(s))}),t.k0s()()()}if(2&i){const n=t.XpG().row,a=t.XpG();t.R7$(),t.vxM(t.bMT(2,2,a.canEdit(n.state,n.status))?1:-1),t.R7$(3),t.Y8G("campaign",n)}}function Dt(i,o){if(1&i&&(t.j41(0,"div",8)(1,"div",9)(2,"chip",10)(3,"div",11),t.EFF(4),t.nI1(5,"date"),t.nI1(6,"date"),t.k0s()()(),t.nVh(7,zt,5,4,"div",12),t.k0s()),2&i){const n=o.row,a=t.XpG();t.R7$(),t.AVh("name--loading",n.isLoading),t.R7$(),t.Y8G("info",a.getStatusLabel(n.state,n.status))("label",n.name)("loading",n.isLoading)("type",a.getStatusType(n.state,n.status)),t.R7$(2),t.Lme(" ",t.i5U(5,9,n.dateFrom,"dd.MM.yyyy")," - ",t.i5U(6,12,n.dateTo,"dd.MM.yyyy")," "),t.R7$(3),t.vxM(n.isLoading?-1:7)}}function Gt(i,o){if(1&i&&t.EFF(0),2&i){const n=o.row,a=t.XpG();t.SpI(" ",a.getTypeLabel(n.campaignType)," ")}}class P{getStatusType(o,n){return n===T.BE.NOT_ACTIVE&&o!==T.Xf.ARCHIVED?"error":q.qK[o]||"neutral"}getStatusLabel(o,n){return n===T.BE.NOT_ACTIVE&&o!==T.Xf.ARCHIVED?q.BC[n]:q.BC[o]}getTypeLabel(o){switch(o){case F.S.CROSS_RETAIL_EMISSION:return"Cross-Retail Emission";case F.S.RETAIL_MEDIA_INVENTORY:case F.S.RETAIL_MEDIA_SELF_ADVERTISING:return"Retail Media Inventory"}}isCampaignActive(o){return o===T.BE.ACTIVE}canEdit(o,n){return o===T.Xf.ARCHIVED?(0,v.of)(!1):this.isAdminGuard.canActivate().pipe((0,L.T)(a=>a||n!==T.BE.TO_ACCEPT))}setStatus(o){const n=o.campaign;n.status&&(n.isLoading=!0,this.updateStatus.emit(o))}setOperations(){return{Archive:{label:"Archiwizuj",name:"Archive",icon:"archive",iconOnly:!0,easyAccess:!1},Unarchive:{label:"Cofnij archiwizacj\u0119",name:"Unarchive",icon:"unarchive",iconOnly:!0,easyAccess:!1}}}constructor(o){this.isAdminGuard=o,this.items=[],this.loading=!1,this.updateStatus=new t.bkB,this.config={expandable:"config.website",columns:[{id:"name",field:"name",label:"Kampania",type:"template",sortable:!0},{id:"campaignType",field:"campaignType",label:"Rodzaj kampanii",type:"template",sortable:!0},{field:"filled_emission",id:"filled_emission",label:"Impresje",type:"number",async:!0},{field:"adclick",id:"adclick",label:"Klikni\u0119cia",type:"number",async:!0}]},this.context={objectType:"rmnCampaigns",displayLabels:[],pendingMessage:"Generowanie..."}}static{this.\u0275fac=function(n){return new(n||P)(t.rXU(Tt.I))}}static{this.\u0275cmp=t.VBU({type:P,selectors:[["rm-campaign-table"]],viewQuery:function(n,a){if(1&n&&t.GBs($t,5),2&n){let s;t.mGM(s=t.lsd())&&(a.table=s.first)}},inputs:{items:"items",loading:"loading"},outputs:{updateStatus:"updateStatus"},ngContentSelectors:wt,decls:13,vars:4,consts:[["table",""],[3,"config","context","items","loading"],["data-table-cell","name"],["data-table-cell","campaignType"],["not-found-content",""],["easy-access-funcs",""],["mat-menu-item",""],["disabled","","mat-menu-item",""],[1,"row-wrapper"],[1,"name"],[3,"info","label","loading","type"],[1,"period"],[1,"actions-wrapper"],[1,"edit"],[1,"actions"],[3,"onUpdateStatus","campaign"],["mat-icon-button","","matTooltip","Edytuj",3,"routerLink"],[1,"material-icons-outlined"]],template:function(n,a){1&n&&(t.NAR(),t.j41(0,"data-table",1,0),t.DNE(2,Dt,8,15,"ng-template",2)(3,Gt,1,1,"ng-template",3),t.qex(4,4),t.SdG(5),t.bVm(),t.qex(6,5),t.j41(7,"button",6)(8,"span"),t.EFF(9,"Archiwizuj"),t.k0s()(),t.j41(10,"button",7)(11,"span"),t.EFF(12,"Szczeg\xf3\u0142y kampanii"),t.k0s()(),t.bVm(),t.k0s()),2&n&&t.Y8G("config",a.config)("context",a.context)("items",a.items)("loading",a.loading)},dependencies:[S.L,_.An,Mt.iY,$.Wk,St.oV,bt.fb,j.b,Rt.w,Et.u,At.U,m.MD,$.iI,C.q,Ct,b.D6,m.Jj,m.vh],styles:[".row-wrapper[_ngcontent-%COMP%]{display:flex;justify-content:space-between;width:100%}.row-wrapper[_ngcontent-%COMP%] .name[_ngcontent-%COMP%]{display:flex;flex:1;align-items:center}.row-wrapper[_ngcontent-%COMP%] .name--loading[_ngcontent-%COMP%]{opacity:.7}.row-wrapper[_ngcontent-%COMP%] .name[_ngcontent-%COMP%] chip[_ngcontent-%COMP%]{flex-grow:1}.row-wrapper[_ngcontent-%COMP%] .period[_ngcontent-%COMP%]{color:#999;font-size:.75rem}.row-wrapper[_ngcontent-%COMP%] .actions-wrapper[_ngcontent-%COMP%]{display:flex;justify-content:flex-end}.row-wrapper[_ngcontent-%COMP%] .actions-wrapper[_ngcontent-%COMP%] .edit[_ngcontent-%COMP%]{margin-top:.5rem}.row-wrapper[_ngcontent-%COMP%] .actions-wrapper[_ngcontent-%COMP%] .actions[_ngcontent-%COMP%], .row-wrapper[_ngcontent-%COMP%] .extra-actions[_ngcontent-%COMP%]{display:flex;justify-content:left}"]})}}(0,Z.Cg)([(0,J.Y)()],P.prototype,"getStatusType",null),(0,Z.Cg)([(0,J.Y)()],P.prototype,"getStatusLabel",null),(0,Z.Cg)([(0,J.Y)()],P.prototype,"getTypeLabel",null),(0,Z.Cg)([(0,J.Y)()],P.prototype,"isCampaignActive",null),(0,Z.Cg)([(0,J.Y)()],P.prototype,"canEdit",null);var lt=e(64698),xt=e(35513),Nt=e(57241);let mt=(()=>{class i{constructor(){this.filters=[{field:"name",label:"Wyszukaj",type:"search",operator:lt.t.like,placeholder:"Wyszukaj"},{type:"list",field:"states",label:"Status kampanii",operator:lt.t.overlaps,placeholder:"Wszystkie",data:q.aw},{field:"campaignType",type:"list",label:"Rodzaj kampanii",placeholder:"Wszystkie",data:[{value:[F.S.RETAIL_MEDIA_INVENTORY,F.S.RETAIL_MEDIA_SELF_ADVERTISING],label:"Retail Media Inventory"},{value:F.S.CROSS_RETAIL_EMISSION,label:"Cross-Retail Emission"}]}]}static{this.\u0275fac=function(a){return new(a||i)}}static{this.\u0275cmp=t.VBU({type:i,selectors:[["rm-campaign-filters"]],decls:1,vars:1,consts:[[3,"filters"]],template:function(a,s){1&a&&t.nrm(0,"table-filters",0),2&a&&t.Y8G("filters",s.filters)},dependencies:[xt.b,Nt.h,m.MD],styles:["[_nghost-%COMP%] mat-form-field{width:13.75rem}"]})}}return i})();function Ft(i,o){if(1&i){const n=t.RV6();t.qex(0),t.j41(1,"h6"),t.EFF(2,"W tym miejscu pojawi\u0105 si\u0119 wyniki Twoich kampanii. "),t.k0s(),t.j41(3,"p"),t.EFF(4,"Dodaj now\u0105 kampani\u0119, aby \u015bledzi\u0107 wyniki dzia\u0142a\u0144 reklamowych. "),t.k0s(),t.j41(5,"a",4),t.bIt("click",function(){l.eBV(n);const s=t.XpG(2);return l.Njj(s.onCreate())}),t.EFF(6," Dodaj kampani\u0119"),t.k0s(),t.bVm()}}function Pt(i,o){1&i&&(t.qex(0),t.j41(1,"h6"),t.EFF(2,"Brak kampanii spe\u0142niaj\u0105cych Twoje kryteria wyszukiwania."),t.k0s(),t.j41(3,"p"),t.EFF(4,"Zmie\u0144 filtry aby wy\u015bwietli\u0107 inne kampanie."),t.k0s(),t.bVm())}function Vt(i,o){if(1&i){const n=t.RV6();t.j41(0,"div")(1,"mat-card"),t.nrm(2,"breadcrumbs"),t.j41(3,"table-header")(4,"h6"),t.EFF(5,"Kampanie Retail Media"),t.k0s(),t.j41(6,"div",2),t.nrm(7,"rm-campaign-filters"),t.j41(8,"div",3)(9,"button",4),t.bIt("click",function(){l.eBV(n);const s=t.XpG();return l.Njj(s.onCreate())}),t.j41(10,"mat-icon"),t.EFF(11,"add"),t.k0s(),t.EFF(12," Dodaj kampani\u0119 "),t.k0s()()()(),t.j41(13,"rm-campaign-table",5),t.bIt("updateStatus",function(s){l.eBV(n);
3const f=t.XpG();return l.Njj(f.updateStatus(s))}),t.DNE(14,Ft,7,0,"ng-container",6)(15,Pt,5,0,"ng-container",6),t.k0s(),t.nrm(16,"app-paginator",7),t.k0s()()}if(2&i){const n=o.ngIf,a=t.XpG();t.R7$(13),t.Y8G("items",n.campaigns.items)("loading",n.loading),t.R7$(),t.Y8G("ngIf",!1===a.hasFilters),t.R7$(),t.Y8G("ngIf",a.hasFilters),t.R7$(),t.Y8G("count",n.campaigns.count)}}function Lt(i,o){1&i&&t.nrm(0,"app-loader")}x().extend(w());let Ut=(()=>{class i{onCreate(){const n=new t.bkB;n.subscribe(()=>{this.tableManager.refresh(),this.rightPanelService.closeAll()}),this.rightPanelService.open({title:"Retail Media Network",managed:!1,outputs:{onCreated:n},module:()=>Promise.all([e.e(5660),e.e(2421),e.e(6848),e.e(825),e.e(262)]).then(e.bind(e,50825)).then(a=>a.RetailMediaCreatorModule),beforeClose:a=>a.form.pristine&&!a.form.disabled?(0,v.of)(!0):this.dialogService.openConfirmDialog({message:"Czy na pewno chcesz zamkn\u0105\u0107 formularz?"}).afterClosed().pipe((0,L.T)(s=>!!s))})}updateStatus(n){var a=this;return(0,V.A)(function*(){const s=n.status,f=n.campaign,O=n.successMessage,M=yield(0,r._)(a.viewModel$);try{(yield a.retailMediaService.updateStatus(M.website.contractorId,M.website.id,f.campaignId,s))?(a.tableManager.refresh(),a.snackbarService.success(O)):a.snackbarService.alert(`Wyst\u0105pi\u0142 b\u0142\u0105d podczas zmiany statusu kampanii: ${f.name}.`)}catch{a.snackbarService.alert(`Wyst\u0105pi\u0142 b\u0142\u0105d podczas zmiany statusu kampanii: ${f.name}.`)}})()}constructor(n,a,s,f,O,M,D,et){this.tableManager=n,this.filtersService=a,this.snackbarService=s,this.websiteContext=f,this.retailMediaService=O,this.statisticsService=M,this.rightPanelService=D,this.dialogService=et,this.campaigns$=this.websiteContext.getSelectedWebsite().pipe((0,u.n)(G=>this.tableManager.getManager(B=>this.retailMediaService.getCampaigns(G.contractorId,G.id,B))),(0,c.t)(1)),this.statistics$=(0,p.z)([this.websiteContext.getSelectedWebsite(),this.campaigns$]).pipe((0,u.n)(([G,B])=>{if(0===B.items.length)return(0,v.of)([]);const d=B.items.map(y=>y.campaignId);return this.statisticsService.getTotalStatistics({websiteId:G.id,contractorId:G.contractorId,serviceType:g.C0.RETAIL_MEDIA,campaignIds:d})})).pipe((0,h.Z)(null)),this.viewModel$=(0,p.z)([this.campaigns$,this.statistics$,this.websiteContext.getSelectedWebsite()]).pipe((0,L.T)(([G,B,d])=>({website:d,loading:G.loading,campaigns:{count:G.count,items:G.items.map(y=>{if(B){const R=B.find(Q=>Number(Q.campaignId)===y.campaignId);return R?{...y,...R}:{...y,adclick:"-",filled_emission:"-"}}return y})}}))).pipe((0,c.t)(1))}get hasFilters(){return this.filtersService.getState().length>0}static{this.\u0275fac=function(a){return new(a||i)(t.rXU(K.x),t.rXU(U.b),t.rXU(N.v),t.rXU(Y.U9),t.rXU(at.$),t.rXU(ht.r),t.rXU(C._S),t.rXU(it.o))}}static{this.\u0275cmp=t.VBU({type:i,selectors:[["rm-campaings"]],standalone:!1,decls:4,vars:4,consts:[["spinner",""],[4,"ngIf","ngIfElse"],[1,"header-info"],[1,"extra-actions"],["mat-flat-button","","color","primary",3,"click"],[3,"updateStatus","items","loading"],[4,"ngIf"],[3,"count"]],template:function(a,s){if(1&a&&(t.DNE(0,Vt,17,5,"div",1),t.nI1(1,"async"),t.DNE(2,Lt,1,0,"ng-template",null,0,t.C5r)),2&a){const f=t.sdS(3);t.Y8G("ngIf",t.bMT(1,2,s.viewModel$))("ngIfElse",f)}},dependencies:[m.bT,_.An,st.$z,H.RN,yt.z,ot.m,rt.V,P,mt,A.h,m.Jj],styles:["rm-campaign-filters[_ngcontent-%COMP%]{margin-right:10px}.header-info[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;justify-content:left!important}.extra-actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap}"]})}}return i})();var dt=e(86089),pt=e(27307),Bt=e(91817),ut=e(98764),Xt=e(37580),Yt=e(56884),kt=e(15583),Wt=e(50393),Kt=e(56460),Ht=e(57178),Zt=e(97407),gt=e(36206),ft=e(15874);const vt=["*","*"];function Jt(i,o){1&i&&t.SdG(0,0,["*ngTemplateOutlet","buttons"])}function Qt(i,o){1&i&&t.SdG(0,1,["*ngTemplateOutlet","buttons"])}function qt(i,o){if(1&i&&t.nrm(0,"rm-retail-media-parameters-info",18),2&i){const n=t.XpG(2).ngIf;t.Y8G("campaignType",n.campaign.campaignType)}}function _t(i,o){if(1&i&&t.nrm(0,"rm-retail-media-products-info",18),2&i){const n=t.XpG(2).ngIf;t.Y8G("campaignType",n.campaign.campaignType)}}function te(i,o){if(1&i&&(t.qex(0),t.DNE(1,qt,1,1,"rm-retail-media-parameters-info",17)(2,_t,1,1,"rm-retail-media-products-info",17),t.bVm()),2&i){t.XpG();const n=t.sdS(14);t.R7$(),t.Y8G("ngIf",0===n.selectedIndex),t.R7$(),t.Y8G("ngIf",1===n.selectedIndex)}}function ee(i,o){if(1&i){const n=t.RV6();t.qex(0),t.j41(1,"mat-card")(2,"mat-card-header")(3,"mat-card-title"),t.nrm(4,"breadcrumbs"),t.j41(5,"div",4)(6,"h4",5),t.EFF(7),t.k0s(),t.j41(8,"h5",6),t.EFF(9),t.k0s()()()(),t.j41(10,"mat-card-content")(11,"div",7)(12,"div",8)(13,"mat-tab-group",9,2)(15,"mat-tab",10),t.nrm(16,"rm-campaign-parameters-form",11),t.DNE(17,Jt,1,0,"ng-content",12),t.k0s(),t.j41(18,"mat-tab",13)(19,"h6"),t.EFF(20,"Produkty w kampanii"),t.k0s(),t.j41(21,"rm-campaign-products-form",14),t.bIt("onSubmit",function(){l.eBV(n);const s=t.XpG();return l.Njj(s.onSave())}),t.k0s(),t.DNE(22,Qt,1,0,"ng-content",12),t.k0s()()(),t.j41(23,"div",15),t.DNE(24,te,3,2,"ng-container",16),t.k0s()()()(),t.bVm()}if(2&i){const n=o.ngIf,a=t.XpG(),s=t.sdS(5);t.R7$(7),t.JRh(null==n.campaign?null:n.campaign.name),t.R7$(2),t.Lme("ID: ",null==n.campaign?null:n.campaign.campaignId,", Kampania: ",a.getLabel(null==n.campaign?null:n.campaign.campaignType)),t.R7$(4),t.Y8G("animationDuration",0),t.R7$(3),t.Y8G("form",a.form)("audienceSegments",n.segments)("partners",a.partners),t.R7$(),t.Y8G("ngTemplateOutlet",s),t.R7$(4),t.Y8G("form",a.form.controls.products)("pending",a.pending)("campaignType",null==n.campaign?null:n.campaign.campaignType),t.R7$(),t.Y8G("ngTemplateOutlet",s),t.R7$(2),t.Y8G("ngIf",n.campaign)}}function ne(i,o){1&i&&t.nrm(0,"app-loader")}function ae(i,o){if(1&i){const n=t.RV6();t.j41(0,"div",19)(1,"button",20),t.bIt("click",function(){l.eBV(n);const s=t.XpG();return l.Njj(s.onSave())}),t.j41(2,"mat-icon",21),t.EFF(3,"save"),t.k0s(),t.EFF(4," zapisz zmiany "),t.k0s()()}if(2&i){const n=t.XpG();
3t.R7$(),t.Y8G("pending",n.pending)("disabled",n.form.invalid||n.form.pristine||n.pending)}}const ie=[{path:"",title:"",component:Ut},{path:":id",title:"",component:(()=>{class i{constructor(n,a,s,f,O,M,D,et,G,B){this.route=n,this.breadcrumbsService=a,this.websiteContext=s,this.productsService=f,this.snackBarService=O,this.retailMediaService=M,this.campaignService=D,this.retailMediaCampaignFormfactory=et,this.changeDetectorRef=G,this.router=B,this.pending=!1,this.form=this.retailMediaCampaignFormfactory.form,this.viewModel$=(0,p.z)([this.route.params.pipe((0,L.T)(d=>Number(d.id)),(0,Bt.F)()),this.websiteContext.getSelectedWebsite()]).pipe((0,u.n)(([d,y])=>(0,p.z)([(0,v.of)(y),this.retailMediaService.getCampaign(y.contractorId,y.id,d).pipe((0,ut.M)(R=>{R||(this.snackBarService.alert("Nie znaleziono kampanii."),this.router.navigate(["client","services","retail-media"]))})),this.retailMediaService.getCampaignRevenue(y.contractorId,y.id,d),this.campaignService.getAudienceSegments()])),(0,u.n)(([d,y,R,Q])=>(0,p.z)([(0,v.of)(d),(0,v.of)(y),(0,v.of)(R),(0,v.of)(Q),this.productsService.getProductsByIds(y?.products?.map(nt=>nt.productId)??[])])),(0,L.T)(([d,y,R,Q,nt])=>({website:d,revenue:R,campaign:y,segments:Q,products:nt})),(0,ut.M)(d=>{d.campaign&&(this.form.removeControl("agreement"),this.form.removeControl("customerServiceAgreement"),this.form.patchValue({...d.campaign,dateTo:new Date(d.campaign?.dateTo),dateFrom:new Date(d.campaign?.dateFrom),revenue:d.revenue,products:d.products,agreement:!0,audienceSegments:d.campaign?.audienceSegments?(0,dt.l)(d.campaign?.audienceSegments,d.segments):void 0,websites:d.campaign?.websites?this.getWebsites(d.campaign?.websites,d.products):void 0}),this.breadcrumbsService.append({label:d.campaign.name}))})).pipe((0,c.t)(1)),this.partners=[],this.form.get("products")?.valueChanges.subscribe(()=>{const d=new Map;for(const y of this.form.getRawValue().products)for(const R of y.offers.items)d.has(R.feed.id)?d.get(R.feed.id).productsCount+=1:d.set(R.feed.id,{...R.feed,productsCount:1});this.partners=Array.from(d.values()).sort((y,R)=>R.productsCount-y.productsCount)})}onSave(){var n=this;return(0,V.A)(function*(){if(n.form.invalid)return n.form.markAsTouched();n.pending=!0,n.changeDetectorRef.detectChanges();const a=n.form.getRawValue(),s=yield(0,r._)(n.viewModel$),f=a.campaignType===F.S.RETAIL_MEDIA_SELF_ADVERTISING?{included:[s.website.id],excluded:[]}:a.websites?n.getWebsitesIds(a.websites):null;(yield n.retailMediaService.updateCampaign({campaign:{cpm:a.cpm,name:a.name,budget:a.budget,impressions:a.impressions,products:a.products.map(M=>({productId:M.id,categoryId:M.categoryId})),campaignId:s.campaign?.campaignId,campaignType:a.campaignType,dateTo:(0,pt.bu)(a.dateTo),dateFrom:(0,pt.bu)(a.dateFrom),audienceSegments:a.audienceSegments?(0,dt.B)(a.audienceSegments):null,websites:f},websiteId:s.website.id,contractorId:s.website.contractorId}))?(n.form.markAsPristine(),n.snackBarService.success("Dane kampanii zosta\u0142y zaktualizowane.")):n.snackBarService.alert("Wyst\u0105pi\u0142 b\u0142\u0105d podczas zapisu danych. Spr\xf3buj ponownie p\xf3\u017aniej."),n.pending=!1,n.changeDetectorRef.detectChanges()})()}getWebsites(n,a){const s=new Map,f=new Map;for(const O of a)for(const M of O.offers.items){if(n.included.includes(M.feed.id)){const D=s.get(M.feed.id);s.set(M.feed.id,D?{...D,productsCount:D.productsCount+1}:{...M.feed,productsCount:1})}if(n.excluded.includes(M.feed.id)){const D=f.get(M.feed.id);f.set(M.feed.id,D?{...D,productsCount:D.productsCount+1}:{...M.feed,productsCount:1})}}return{included:Array.from(s.values()),excluded:Array.from(f.values())}}getWebsitesIds(n){return{included:n.included.map(a=>a.id),excluded:n.excluded.map(a=>a.id)}}getLabel(n){switch(n){case F.S.CROSS_RETAIL_EMISSION:return"Cross-Retail Emission";case F.S.RETAIL_MEDIA_INVENTORY:case F.S.RETAIL_MEDIA_SELF_ADVERTISING:return"Retail Media Inventory";default:return"Nieznany typ"}}static{this.\u0275fac=function(a){return new(a||i)(t.rXU(tt.nX),t.rXU(Yt.E),t.rXU(Y.U9),t.rXU(kt.g),t.rXU(N.v),t.rXU(at.$),t.rXU(T.OF),t.rXU(Wt._),t.rXU(Xt.gRc),t.rXU(tt.Ix))}}static{this.\u0275cmp=t.VBU({type:i,selectors:[["rm-retail-media-campaing"]],standalone:!1,ngContentSelectors:vt,decls:6,vars:4,consts:[["spinner",""],["buttons",""],["tabs",""],[4,"ngIf","ngIfElse"],[1,"info"],[1,"name"],[1,"extra-info"],[1,"content-aside"],[1,"content-aside__content"],["color","accent","mat-stretch-tabs","false","mat-align-tabs","start",3,"animationDuration"],["label","Parametry kampanii"],[3,"form","audienceSegments","partners"],[4,"ngTemplateOutlet"],["label","Wyb\xf3r produkt\xf3w"],[1,"products",3,"onSubmit","form","pending","campaignType"],[1,"content-aside__aside"],[4,"ngIf"],[3,"campaignType",4,"ngIf"],[3,"campaignType"],[1,"buttons"],["mat-flat-button","","color","primary",3,"click","pending","disabled"],[1,"material-icons-outlined"]],template:function(a,s){if(1&a&&(t.NAR(vt),t.DNE(0,ee,25,13,"ng-container",3),t.nI1(1,"async"),t.DNE(2,ne,1,0,"ng-template",null,0,t.C5r)(4,ae,5,2,"ng-template",null,1,t.C5r)),2&a){const f=t.sdS(3);t.Y8G("ngIf",t.bMT(1,2,s.viewModel$))("ngIfElse",f)}},dependencies:[m.bT,m.T3,_.An,st.$z,I.mq,I.T8,H.RN,H.m2,H.MM,H.dh,ot.m,Kt.B,rt.V,Ht.z,Zt.H,gt.N,ft.r,m.Jj],styles:["h6[_ngcontent-%COMP%], rm-campaign-parameters-form[_ngcontent-%COMP%]{margin-top:2.5rem}.products[_ngcontent-%COMP%]{height:31.25rem}.info[_ngcontent-%COMP%]{display:flex;flex-direction:column}.info[_ngcontent-%COMP%] .name[_ngcontent-%COMP%]{margin-bottom:0}.info[_ngcontent-%COMP%] .extra-info[_ngcontent-%COMP%]{color:#9e9e9e;font-size:.9rem}"]})}}return i})()}];let se=(()=>
3{class i{static{this.\u0275fac=function(a){return new(a||i)}}static{this.\u0275mod=t.$C({type:i})}static{this.\u0275inj=l.G2t({imports:[$.iI.forChild(ie),$.iI]})}}return i})();var oe=e(84389),re=e(8937);let ce=(()=>{class i{static{this.\u0275fac=function(a){return new(a||i)}}static{this.\u0275mod=t.$C({type:i})}static{this.\u0275inj=l.G2t({imports:[m.MD,S.L,j.b,I.RI,z.V,C.q,b.D6,se,oe.z,re.H,gt.N,ft.r,P,mt,A.h]})}}return i})()},65123:(k,E,e)=>{e.d(E,{r:()=>r});var m=e(24398),S=e(49645),I=e.n(S),b=e(21102),j=e.n(b),z=e(43942),C=e(86301);function A(u){const c={};return(p,h,g)=>{const l=g.value;return g.value=function(...K){const U=Date.now(),N=JSON.stringify(K);if(void 0===c[N]||c[N].expired<U){let Y=l.apply(this,K);Y instanceof z.c&&(Y=Y.pipe((0,C.t)(1))),c[N]={value:Y,expired:U+u.ttl}}return c[N].value},g}}var $=e(70271),V=e(61318),X=e(59452),w=e(18424),t=e(85240),v=e(10546),L=e(20624);I().extend(j());class r{constructor(c,p){this.graphqlService=c,this.loggerService=p}getStatistics(c){return this.graphqlService.query(w.y.GatewayApi,"query PANEL_STATS_QUERY(\n $websiteId: Int!,\n $contractorId: Int!,\n $metrics: [String!]!,\n $dimensions: [String!],\n $filters: JSON,\n $to: DateTime!,\n $from: DateTime!,\n $granularity: String!,\n $queryType: QueryType!\n) {\n contractor(id: $contractorId) {\n website(id: $websiteId) {\n serviceStatistics {\n query(\n to: $to,\n from: $from,\n metrics: $metrics\n filters: $filters,\n dimensions: $dimensions,\n granularity: $granularity,\n queryType: $queryType\n ) {\n events {\n data\n timestamp\n }\n }\n }\n }\n }\n}\n",c).pipe((0,$.T)(h=>h?.contractor.website.serviceStatistics.query.events),(0,V.W)(h=>(this.loggerService.error(h),(0,X.of)([]))))}getTotalStatistics(c){return this.graphqlService.query(w.y.GatewayApi,"query PANEL_TOTAL_STATS_QUERY(\n $contractorId: Int!,\n $websiteId: Int!,\n $serviceType: ServiceType!,\n $lineitemIds: [Int!]\n) {\n contractor(id: $contractorId) {\n website(id: $websiteId) {\n serviceStatistics {\n queryTotalStats(serviceType: $serviceType, lineitemIds: $lineitemIds) {\n lineitemId\n statsData {\n adclick\n budget_spent\n filled_emission\n revenue\n video_vis\n video_vc\n ctr\n video_vcr\n filled_request\n ecpm\n }\n }\n }\n }\n }\n}\n",{contractorId:c.contractorId,websiteId:c.websiteId,serviceType:c.serviceType,lineitemIds:c.campaignIds}).pipe((0,$.T)(g=>g?.contractor.website.serviceStatistics.queryTotalStats),(0,$.T)(g=>g.map(l=>({...l.statsData,ctr:l.statsData.ctr/100,video_vcr:l.statsData.video_vcr/100,campaignId:l.lineitemId}))),(0,V.W)(g=>(this.loggerService.error(g),(0,X.of)([]))))}fillMissingTimestamps(c,p,h,g){let l=I()(p);const K=I()(h);"day"===g&&(l=l.startOf("day"));const U=[...c];for(;l<=K;){const N=l.toISOString();switch(U.includes(N)||U.push(N),g){case"day":l=l.add(1,"day");break;case"hour":l=l.add(1,"hour")}}return U.sort(),U}static{this.\u0275fac=function(p){return new(p||r)(t.KVO(v.P),t.KVO(L.g))}}static{this.\u0275prov=t.jDH({token:r,factory:r.\u0275fac,providedIn:"root"})}}(0,m.Cg)([A({ttl:3e5})],r.prototype,"getStatistics",null),(0,m.Cg)([A({ttl:3e5})],r.prototype,"getTotalStatistics",null)},78253:(k,E,e)=>{e.d(E,{$:()=>t});var m=e(18424),S=e(5342),I=e(70271),b=e(61318),j=e(59452),W=e(85240),x=e(10546);let t=(()=>{class v{constructor(r){this.graphqlService=r}createCampaign(r){return(0,S.s)(this.graphqlService.mutation(m.y.GatewayApi,"mutation PANEL_CREATE_RETAIL_MEDIA_CAMPAIGN($websiteId: Int!, $contractorId: Int!, $campaign: CampaignCreateMutationArgs!) {\n contractor(id: $contractorId) {\n website(id: $websiteId) {\n serviceRetailMedia {\n campaign {\n create(campaign: $campaign) {\n campaignId\n }\n }\n }\n }\n }\n}\n",r).pipe((0,I.T)(c=>c.contractor.website.serviceRetailMedia.campaign.create.campaignId)))}updateCampaign(r){return(0,S.s)(this.graphqlService.mutation(m.y.GatewayApi,"mutation PANEL_UPDATE_RETAIL_MEDIA_CAMPAING($websiteId: Int!, $contractorId: Int!, $campaign: CampaignUpdateMutationArgs!) {\n contractor(id: $contractorId) {\n website(id: $websiteId) {\n serviceRetailMedia {\n campaign {\n update(campaign: $campaign) {\n campaignId\n }\n }\n }\n }\n }\n}",r).pipe((0,I.T)(c=>c.contractor.website.serviceRetailMedia.campaign.update.campaignId===r.campaign.campaignId)))}getCampaignsCount(r,u,c){return this.graphqlService.query(m.y.GatewayApi,"query PANEL_GET_RETAIL_MEDIA_CAMPAIGN_COUNT($websiteId: Int!, $contractorId: Int!) {\n contractor(id: $contractorId) {\n website(id: $websiteId) {\n serviceRetailMedia {\n campaigns {\n pageInfo {\n count\n }\n }\n }\n }\n }\n}",{websiteId:u,contractorId:r,...c}).pipe((0,I.T)(h=>h.contractor.website.serviceRetailMedia.campaigns.pageInfo.count??0))}getCampaigns(r,u,c){const h=c?.filters?.map(g=>"like"===g.operator?{...g,value:`%${g.value}%`}:g);return this.graphqlService.query(m.y.GatewayApi,"\nquery PANEL_GET_RETAIL_MEDIA_CAMPAIGNS(\n $contractorId: Int!,\n $websiteId: Int!,\n $sort: [SortItem!],\n $filters: [FilterItemV3!],\n $limit: Int,\n $offset: Int\n) {\n contractor(id: $contractorId) {\n website(id: $websiteId) {\n serviceRetailMedia {\n campaigns(filters: $filters, sort: $sort, limit: $limit, offset: $offset) {\n items {\n cpm\n name\n budget\n impressions\n status\n states\n dateFrom\n dateTo\n campaignId\n campaignType\n products {\n productId\n categoryId\n }\n audienceSegments {\n includes\n excludes\n }\n actions\n }\n pageInfo {\n count\n }\n }\n }\n }\n }\n}\n",{websiteId:u,contractorId:r,...c,filters:h}).pipe((0,I.T)(g=>({items:g.contractor.website.serviceRetailMedia.campaigns.items.map(l
3=>this.toCampaign(l)),count:g.contractor.website.serviceRetailMedia.campaigns.pageInfo.count??0})))}getCampaign(r,u,c){return this.graphqlService.query(m.y.GatewayApi,"\nquery PANEL_GET_RETAIL_MEDIA_CAMPAIGN($contractorId: Int!, $websiteId: Int!, $campaignId: Int!) {\n contractor(id: $contractorId) {\n website(id: $websiteId) {\n serviceRetailMedia {\n campaign(campaignId: $campaignId) {\n cpm\n name\n status\n states\n budget\n impressions\n campaignId\n campaignType\n dateFrom\n dateTo\n products {\n productId\n categoryId\n }\n audienceSegments {\n includes\n excludes\n }\n actions\n websites {\n included\n excluded\n }\n }\n }\n }\n }\n}\n",{websiteId:u,contractorId:r,campaignId:c}).pipe((0,I.T)(h=>h.contractor.website.serviceRetailMedia.campaign?this.toCampaign(h.contractor.website.serviceRetailMedia.campaign):null),(0,b.W)(()=>(0,j.of)(null)))}getCampaignRevenue(r,u,c){return this.graphqlService.query(m.y.GatewayApi,"\nquery PANEL_GET_RETAIL_MEDIA_CAMPAIGN($contractorId: Int!, $websiteId: Int!, $campaignId: Int!) {\n contractor(id: $contractorId) {\n website(id: $websiteId) {\n serviceRetailMedia {\n campaign(campaignId: $campaignId) {\n revenue\n }\n }\n }\n }\n}",{websiteId:u,contractorId:r,campaignId:c}).pipe((0,I.T)(h=>h.contractor.website.serviceRetailMedia.campaign?.revenue??0),(0,b.W)(()=>(0,j.of)(0)))}updateStatus(r,u,c,p){const g=this.graphqlService.mutation(m.y.GatewayApi,"mutation PANEL_UPDATE_STATUS_RETAIL_MEDIA_CAMPAING($websiteId: Int!, $contractorId: Int!, $campaignId: Int!, $status: CampaignStatus!) {\n contractor(id: $contractorId) {\n website(id: $websiteId) {\n serviceRetailMedia {\n campaign {\n status(campaignId: $campaignId, status: $status) {\n status\n }\n }\n }\n }\n }\n}\n",{contractorId:r,websiteId:u,campaignId:c,status:p}).pipe((0,I.T)(l=>"OK"===l.contractor.website.serviceRetailMedia.campaign.status.status));return(0,S.s)(g)}toCampaign(r){return{...r,state:r.states[1]||r.states[0]}}static{this.\u0275fac=function(u){return new(u||v)(W.KVO(x.P))}}static{this.\u0275prov=W.jDH({token:v,factory:v.\u0275fac,providedIn:"root"})}}return v})()}}]); 4//# sourceMappingURL=9681.2976e213e5937749.js.map 5//# debugId=7efe342e-8adb-5e16-97fe-181e4552aa87
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.