1import{a as be}from"./chunk-CBIJKFM4.js";import{a as xe}from"./chunk-NSO7MX34.js";import"./chunk-ROHEKHPC.js";import{c as ve}from"./chunk-RAFUWYJN.js";import{c as _e,d as ue,e as ge,h as Ce,i as fe,j as ye}from"./chunk-DVZU5CVJ.js";import"./chunk-VBIS4RIG.js";import"./chunk-CS4RYRPY.js";import{a as me}from"./chunk-VOC432IK.js";import{a as de}from"./chunk-KMLBDAIL.js";import"./chunk-SPGQLN2D.js";import"./chunk-T5TG5SXI.js";import"./chunk-ZC3JI6NP.js";import{a as he}from"./chunk-B2TNZBSS.js";import"./chunk-6VLD62UO.js";import"./chunk-2G6VTBFV.js";import{a as ce}from"./chunk-II6Z7II2.js";import"./chunk-PQ6GXZCL.js";import"./chunk-PSHIUB7C.js";import"./chunk-B4NGXDNV.js";import"./chunk-JEYCZHNJ.js";import"./chunk-MZTVMKSR.js";import{c as le}from"./chunk-XVPTGADK.js";import{a as re}from"./chunk-DB2MSPGV.js";import"./chunk-P5WJHXZR.js";import"./chunk-W4AXMS7R.js";import"./chunk-HAOYSTOT.js";import"./chunk-TPAO65A6.js";import"./chunk-MFFDADCV.js";import{e as oe,f as ae}from"./chunk-D7JYH7Z2.js";import"./chunk-7GJN2MC7.js";import"./chunk-Z46Y6S5P.js";import{d as te,g as ie,s as ne}from"./chunk-6TTFESGE.js";import"./chunk-L4ZECQ2P.js";import{a as pe}from"./chunk-JCWFWABS.js";import"./chunk-DDIA4NSV.js";import"./chunk-QS2NHNT2.js";import"./chunk-ZCAFZXY6.js";import"./chunk-DZB5AS3P.js";import{la as Q}from"./chunk-4SDXCDMU.js";import{a as se}from"./chunk-XCFEUDP2.js";import{g as ee}from"./chunk-DOFJQ3CP.js";import"./chunk-N3MB6XEY.js";import{M as q,T as X,V as Y,W as Z}from"./chunk-U3QRES2V.js";import{Ab as S,Bb as A,Cb as f,Db as r,Eb as s,Ec as c,Fb as w,Fc as d,Gc as k,Mb as x,Nc as V,Pa as a,Rb as u,S as B,Tb as p,X as g,Y as C,Ya as M,Z as R,bb as N,bc as F,dc as W,fc as T,gc as m,ha as v,hb as $,hc as y,ic as G,nc as j,oc as H,pc as U,sb as z,wb as h,wc as J,xb as b,xc as L,zb as K}from"./chunk-XM45IX7R.js";import"./chunk-TZ4TJNSX.js";import{a as P,b as E}from"./chunk-NCEQPEJE.js";var Te=()=>[10,50,100,200,500],Ge=n=>({area:n}),Se=n=>({count:n}),D=(n,t)=>t.value,Ae=(n,t)=>t.key,Re=(n,t)=>t.asset_id;function Fe(n,t){if(n&1){let e=x();r(0,"p-button",34),c(1,"transloco"),u("onClick",function(){g(e);let o=p(2);return C(o.createCampaignFromGaps())}),s()}n&2&&f("label",d(1,1,"productActivity.gaps.createCampaign"))}function Ie(n,t){n&1&&(w(0,"p-button",35),c(1,"transloco"),c(2,"transloco"),r(3,"span",36),m(4),c(5,"transloco"),s()),n&2&&(f("label",d(1,4,"productActivity.gaps.createCampaign"))("disabled",!0)("pTooltip",d(2,6,"productActivity.gaps.createCampaignDisabledTooltip")),a(4),y(d(5,8,"productActivity.gaps.pickSameOfferHint")))}function ke(n,t){if(n&1){let e=x();r(0,"span",31),m(1),c(2,"transloco"),s(),h(3,Fe,2,3,"p-button",32)(4,Ie,6,10),r(5,"p-button",33),c(6,"transloco"),u("onClick",function(){g(e);let o=p();return C(o.selectedGapRows.set([]))}),s()}if(n&2){let e=p();a(),y(k(2,4,"productActivity.gaps.selected",L(9,Se,e.selectedGapRows().length))),a(2),b(e.canCreateCampaign()?3:4),a(2),f("label",d(6,7,"productActivity.gaps.clear"))("text",!0)}}function Ve(n,t){n&1&&(r(0,"th",40),m(1),c(2,"transloco"),w(3,"p-sortIcon",46),s()),n&2&&(a(),G("",d(2,1,"productActivity.gaps.table.country")," "))}function Oe(n,t){if(n&1){let e=x();r(0,"th",41),c(1,"transloco"),r(2,"span",47),m(3),c(4,"transloco"),w(5,"p-sortIcon",48),r(6,"button",49),u("click",function(o){return g(e),p(4),F(53).toggle(o),C(o.stopPropagation())}),R(),r(7,"svg",50),w(8,"polygon",51),s()()()()}if(n&2){let e=p(4);f("pTooltip",d(1,4,"productActivity.gaps.table.missingOffersTooltip")),a(3),G(" ",d(4,6,"productActivity.gaps.table.missingOffers")," "),a(3),T(e.filterAssetIds().length?"text-primary-600":"text-surface-400 hover:text-primary-600")}}function Pe(n,t){if(n&1){let e=x();r(0,"th",42),c(1,"transloco"),r(2,"span",47),m(3),c(4,"transloco"),r(5,"button",49),u("click",function(o){return g(e),p(4),F(80).toggle(o),C(o.stopPropagation())}),R(),r(6,"svg",50),w(7,"polygon",51),s()()()()}if(n&2){let e=p(4);f("pTooltip",k(1,4,"productActivity.gaps.table.areaTooltip",L(9,Ge,e.areaLabelService.areaLabel()))),a(3),G(" ",d(4,7,"productActivity.gaps.table.area")," "),a(2),T(e.filterAreas().length?"text-primary-600":"text-surface-400 hover:text-primary-600")}}function Ee(n,t){n&1&&(r(0,"th",43),c(1,"transloco"),m(2),c(3,"transloco"),w(4,"p-sortIcon",52),s()),n&2&&(f("pTooltip",d(1,2,"productActivity.gaps.table.employeesTooltip")),a(2),G(" ",d(3,4,"productActivity.gaps.table.employees")," "))}function Me(n,t){n&1&&(r(0,"th",44),c(1,"transloco"),m(2),c(3,"transloco"),w(4,"p-sortIcon",53),s()),n&2&&(f("pTooltip",d(1,2,"productActivity.gaps.table.emailsSentTooltip")),a(2),G(" ",d(3,4,"productActivity.gaps.table.emailsSent")," "))}function Le(n,t){if(n&1){let e=x();r(0,"th",45),c(1,"transloco"),r(2,"span",47),m(3),c(4,"transloco"),w(5,"p-sortIcon",54),r(6,"button",49),u("click",function(o){return g(e),p(4),F(62).toggle(o),C(o.stopPropagation())}),R(),r(7,"svg",50),w(8,"polygon",51),s()()()()}if(n&2){let e=p(4);f("pTooltip",d(1,4,"productActivity.gaps.table.lastContactTooltip")),a(3),G(" ",d(4,6,"productActivity.gaps.table.lastContact")," "),a(3),T(e.filterLastContact().length?"text-primary-600":"text-surface-400 hover:text-primary-600")}}function Be(n,t){if(n&1){let e=x();r(0,"th")(1,"span",47),m(2),c(3,"transloco"),r(4,"button",49),u("click",function(o){return g(e),p(4),F(71).toggle(o),C(o.stopPropagation())}),R(),r(5,"svg",50),w(6,"polygon",51),s()()()()}if(n&2){let e=p(4);a(2),G(" ",d(3,3,"productActivity.gaps.table.gapReason")," "),a(2),T(e.filterGapReasons().length?"text-primary-600":"text-surface-400 hover:text-primary-600")}}function De(n,t){if(n&1&&h(0,Ve,4,3,"th",40)(1,Oe,9,8,"th",41)(2,Pe,8,11,"th",42)(3,Ee,5,6,"th",43)(4,Me,5,6,"th",44)(5,Le,9,8,"th",45)(6,Be,7,5,"th"),n&2){let e,i=p().$implicit;b((e=i.key)==="country"?0:e==="missing_offers"?1:e==="area"?2:e==="employees"?3:e==="emails_sent"?4:e==="last_contact"?5:e
1==="gap_reason"?6:-1)}}function Ne(n,t){if(n&1&&h(0,De,7,1),n&2){let e=t.$implicit,i=p(2);b(i.col(e.key)?0:-1)}}function $e(n,t){if(n&1&&(r(0,"tr")(1,"th",37),w(2,"p-tableHeaderCheckbox"),s(),r(3,"th",38),m(4),c(5,"transloco"),w(6,"p-sortIcon",39),s(),S(7,Ne,1,1,null,null,Ae),s()),n&2){let e=p();a(4),G("",d(5,1,"productActivity.gaps.table.company")," "),a(3),A(e.columnDefs)}}function ze(n,t){if(n&1&&(r(0,"td"),m(1),s()),n&2){let e=p(3).$implicit;T(e.country?"":"text-surface-400"),a(),y(e.country??"\u2014")}}function Ke(n,t){if(n&1&&(r(0,"span",61),m(1),s()),n&2){let e=p(4).$implicit;a(),y(e.missing_assets[0].asset_name)}}function We(n,t){if(n&1&&(r(0,"span",62),R(),r(1,"svg",50),w(2,"line",64)(3,"line",65)(4,"line",66)(5,"line",67)(6,"line",68)(7,"line",69),s(),m(8),c(9,"transloco"),s()),n&2){let e=p(4).$implicit;a(8),G(" ",k(9,1,"productActivity.gaps.table.offersCount",L(4,Se,e.missing_assets.length))," ")}}function je(n,t){if(n&1&&(r(0,"span",63),m(1),s()),n&2){let e=p(4).$implicit;a(),y(e.chosenAssetName)}}function He(n,t){if(n&1){let e=x();r(0,"td")(1,"button",60),u("click",function(o){g(e);let l=p(3).$implicit,_=p(),O=F(46);return C(_.openOfferPicker(l,o,O))}),h(2,Ke,2,1,"span",61)(3,We,10,6,"span",62),h(4,je,2,1,"span",63),s()()}if(n&2){let e=p(3).$implicit,i=p();a(2),b(e.missing_assets.length===1?2:3),a(2),b(i.isSelected(e)&&e.chosenAssetId?4:-1)}}function Ue(n,t){if(n&1){let e=x();r(0,"td")(1,"app-inline-multiselect",70),c(2,"transloco"),u("save",function(o){g(e);let l=p(3).$implicit,_=p();return C(_.saveCompanyAreas(l,o))}),s()()}if(n&2){let e=p(3).$implicit,i=p();a(),f("value",e.areas)("options",i.areaOptions())("placeholder",d(2,3,"productActivity.gaps.area.placeholder"))}}function Je(n,t){if(n&1&&(r(0,"td"),m(1),s()),n&2){let e=p(3).$implicit;T(e.employee_count===0?"text-surface-400":""),a(),y(e.employee_count)}}function qe(n,t){if(n&1&&(r(0,"td"),m(1),s()),n&2){let e=p(3).$implicit;T(e.outreach_count===0?"text-surface-400":""),a(),y(e.outreach_count)}}function Qe(n,t){if(n&1){let e=x();r(0,"td",71),u("mouseenter",function(){g(e);let o=p(3).$implicit,l=p();return C(l.history.onTriggerEnter("company",o.company_id,o.company_name))})("mouseleave",function(){g(e);let o=p(4);return C(o.history.onTriggerLeave())}),m(1),c(2,"appDate"),s()}if(n&2){let e=p(3).$implicit;a(),G(" ",e.last_outreach_date?k(2,1,e.last_outreach_date,"d MMM y"):"\u2014"," ")}}function Xe(n,t){if(n&1){let e=x();r(0,"button",75),c(1,"transloco"),u("click",function(){g(e);let o=p(4).$implicit,l=p();return C(l.openFindContacts(o))}),m(2),c(3,"transloco"),s()}n&2&&(f("pTooltip",d(1,2,"productActivity.gaps.gapReason.noContactsTooltip")),a(2),y(d(3,4,"productActivity.gaps.gapReason.noContacts")))}function Ye(n,t){n&1&&(r(0,"span",73),c(1,"transloco"),m(2),c(3,"transloco"),s()),n&2&&(f("pTooltip",d(1,2,"productActivity.gaps.gapReason.neverTargetedTooltip")),a(2),y(d(3,4,"productActivity.gaps.gapReason.neverTargeted")))}function Ze(n,t){n&1&&(r(0,"span",74),c(1,"transloco"),m(2),c(3,"transloco"),s()),n&2&&(f("pTooltip",d(1,2,"productActivity.gaps.gapReason.offerGapTooltip")),a(2),y(d(3,4,"productActivity.gaps.gapReason.offerGap")))}function et(n,t){if(n&1&&(r(0,"td"),h(1,Xe,4,6,"button",72)(2,Ye,4,6,"span",73)(3,Ze,4,6,"span",74),s()),n&2){let e=p(3).$implicit;a(),b(e.employee_count===0?1:e.outreach_count===0?2:3)}}function tt(n,t){if(n&1&&h(0,ze,2,3,"td",58)(1,He,5,2,"td")(2,Ue,3,5,"td")(3,Je,2,3,"td",58)(4,qe,2,3,"td",58)(5,Qe,3,4,"td",59)(6,et,4,1,"td"),n&2){let e,i=p().$implicit;b((e=i.key)==="country"?0:e==="missing_offers"?1:e==="area"?2:e==="employees"?3:e==="emails_sent"?4:e==="last_contact"?5:e==="gap_reason"?6:-1)}}function it(n,t){if(n&1&&h(0,tt,7,1),n&2){let e=t.$implicit,i=p(2);b(i.col(e.key)?0:-1)}}function nt(n,t){if(n&1){let e=x();r(0,"tr")(1,"td"),w(2,"p-tableCheckbox",55),s(),r(3,"td",56)(4,"a",57),u("click",function(){let o=g(e).$implicit,l=p();return C(l.openCompany(o.company_id))}),m(5),s()(),S(6,it,1,1,null,null,Ae),s()}if(n&2){let e=t.$implicit,i=p();a(2),f("value",e),a(3),y(e.company_name),a(),A(i.columnDefs)}}function ot(n,t){if(n&1&&(r(0,"tr")(1,"td",76),m(2),c(3,"transloco"),s()()),n&2){let e=p();a(),z("colspan",e.colCount()),a(),y(d(3,2,"productActivity.gaps.empty"))}}function at(n,t){n&1&&(R(),r(0,"svg",50),w(1,"polyline",80),s())}function rt(n,t){n&1&&w(0,"span",79)}function st(n,t){if(n&1){let e=x();r(0,"button",78),u("click",function(){let o=g(e).$implicit,l=p(),_=p(),O=F(46);return C(_.chooseOfferForRow(l,o,O))}),h(1,at,2,0,":svg:svg",50)(2,rt,1,0,"span",79),m(3),s()}if(n&2){let e=t.$implicit,i=p(),o=p();W("bg-primary-50",o.isSelectedWithOffer(i,e.asset_id))("text-primary-700",o.isSelectedWithOffer(i,e.asset_id)),a(),b(o.isSelectedWithOffer(i,e.asset_id)?1:2),a(2),G(" ",e.asset_name," ")}}function pt(n,t){n&1&&S(0,st,4,6,"button",77,Re),n&2&&A(t.missing_assets)}function lt(n,t){if(n&1){let e=x();r(0,"label",26)(1,"input",81),u("change",function(){let o=g(e).$implicit,l=p();return C(l.toggleGapOfferFilter(o.value))}),s(),m(2),s()}if(n&2){let e=t.$implicit,i=p();a(),f("checked",i.filterAssetIds().includes(e.value)),a(),G(" ",e.label," ")}}function ct(n,t){if(n&1){let e=x();r(0,"div",27)(1,"button",82),u("click",function(){g(e);let o=p();return o.filterAssetIds.set([]),C(o.onFilterChange())}),m(2),c(3,"transloco"),s()()}n&2&&(a(2),y(d(3,1,"productActivity.gaps.popover.clearFilter")))}function dt(n,t){if(n&1){let e=x();r(0,"label",26)(1,"input",81),u("change",function(){let o=g(e).$implicit,l=p();return C(l.toggleLastContactFilter(o.value))}),s(),m(2),s()}if(n&2){let e=t.$implicit,i=p();a(),f("checked",i.filterLastContact().includes(e.value)),a(),G(" ",e.label," ")}}function mt(n,t){if(n&1){let e=x();r(0,"div",27)(1,"button",82),u("click",function(){g(e);let o=p();return o.filterLastContact.set([]),C(o.onFilterChange())}),m(2),c(3,"transloco"),s()()}n&2&&(a(2),y(d(3,1,"productActivity.gaps.popover.clearFilter")))}function _t(n,t){if(n&1){let e=x();r(0,"label",26)(1,"input",81),u("change",function(){let o=g(e).$implicit,l=p();return C(l.toggleGapReasonFilter(o.value))}),s(),m(2),s()}if(n&2){let e=t.$implicit,i=p();a(),f("checked",i.filterGapReasons().includes(e.value)),a(),G(" ",e.label," ")}}function ut(n,t){if(n&1){let e=x();r(0,"div",27)(1,"button",82),u("click",function(){g(e);let o=p();return o.filterGapReasons.set([]),C(o.onFilterChange())}),m(2),c(3,"transloco"),s()()}n&2&&(a(2),y(d(3,1,"productActivity.gaps.popover.clearFilter")))}function gt(n,t){if(n&1){let e=x();r(0,"label",26)(1,"input",81),u("change",function(){let o=g(e).$implicit,l=p();return C(l.toggleAreaFilter(o))}),s(),m(2),s()}if(n&2){let e=t.$implicit,i=p();a(),f("checked",i.filterAreas().includes(e)),a(),G(" ",e," ")}}function Ct(n,t){if(n&1){let e=x();r(0,"div",27)(1,"button",82),u("click",function(){g(e);let o=p();return o.filterAreas.set([]),C(o.onFilterChange())}),m(2),c(3,"transloco"),s()()}n&2&&(a(2),y(d(3,1,"productActivity.gaps.popover.clearFilter")))}function ft(n,t){if(n&1){let e=x();r(0,"app-find-contacts-params-dialog",83),u("closed",function(){g(e);let o=p();return C(o.findContactsRow.set(null))})("enrichmentDone",function(){g(e);let o=p();return C(o.onFindContactsDone())}),s()}if(n&2){let e=t;f("companyId",e.company_id)("companyName",e.company_name)("companyCountry",e.country??void 0)}}var we=class n{constructor(t,e,i,o){this.api=t;this.auth=e;this.router=i;this.history=o}api;auth;router;history;transloco=B(Y);activeLang=X(this.transloco.langChanges$,{initialValue:this.transloco.getActiveLang()});t=(t,e)=>this.transloco.translate(t,e);products=v([]);assets=v([]);productOptions=v([]);assetOptions=v([]);countryOptions=v([]);filterCountries=v([]);filterProductId=v(null);filterAssetIds=v([]);filterAreas=v([]);areaOptions=v([]);filterGapReasons=v([]);filterLastContact=v([]);gapReasonOptions=V(()=>(this.activeLang(),[{label:this.t("productActivity.gaps.gapReason.noContacts"),value:"no_contacts"},{label:this.t("productActivity.gaps.gapReason.neverTargeted"),value:"never_targeted"},{label:this.t("productActivity.gaps.gapReason.offerGap"),value:"offer_gap"}]));lastContactOptions=V(()=>(this.activeLang(),[{label:this.t("productActivity.gaps.lastContact.never"),value:"never"},{label:this.t("productActivity.gaps.lastContact.ge7"),value:"7d"},{label:this.t("productActivity.gaps.lastContact.ge14"),value:"14d"},{label:this.t("productActivity.gaps.lastContact.ge1m"),value:"1m"}]));filteredAssetOptions=V(()=>{let t=this.filterProductId();return t?this.assets().filter(e=>e.products.some(i=>i.id===t)).map(e=>({label:e.name,value:e.id})):this.assetOptions()});gapRows=v([]);gapTotal=v(0);gapFirst=v(0);gapPageRows=v(50);gapSortField=v("country");gapSortOrder=v(1);gapLoading=v(!1);selectedGapRows=v([]);get selectedGapRowsArray(){return this.selectedGapRows()}set selectedGapRowsArray(t){this.selectedGapRows.set(t)}gapPopoverRow=v(null);findContactsRow=v(null);static DEFAULT_COLS=[{key:"country",label:"",labelKey:"productActivity.gaps.table.country"},{key:"missing_offers",label:"",labelKey:"productActivity.gaps.table.missingOffers"},{key:"area",label:"",labelKey:"productActivity.gaps.table.area"},{key:"employees",label:"",labelKey:"productActivity.gaps.table.employees"},{key:"emails_sent",label:"",labelKey:"productActivity.gaps.table.emailsSent"},{key:"last_contact",label:"",labelKey:"productActivity.gaps.table.lastContact"},{key:"gap_reason",label:"",labelKey:"productActivity.gaps.table.gapReason"}];columnDefs=[...n.DEFAULT_COLS];visibleCols=v(["country","missing_offers","area","employees","emails_sent","last_contact","gap_reason"]);col(t){return this.visibleCols().includes(t)}colCount=V(()=>2+this.visibleCols().length);canCreateCampaign=V(()=>{let t=this.selectedGapRows();if(!t.length)return!1;let e=t[0].chosenAssetId;return!!e&&t.every(i=>i.chosenAssetId===e)});areaLabelService=B(ce);
1ngOnInit(){this.areaLabelService.ensureLoaded(),this.loadPreferences(),this.loadFilterOptions()}get prefsKey(){let t=this.auth.currentTenantId()??"x",e=this.auth.currentUser()?.id??"x";return`pa-gaps-${t}-${e}`}loadPreferences(){try{let t=localStorage.getItem(this.prefsKey);if(t){let e=JSON.parse(t);if(e.filterCountries&&this.filterCountries.set(e.filterCountries),"filterProductId"in e&&this.filterProductId.set(e.filterProductId??null),e.filterAssetIds&&this.filterAssetIds.set(e.filterAssetIds),e.filterAreas&&this.filterAreas.set(e.filterAreas),e.filterGapReasons&&this.filterGapReasons.set(e.filterGapReasons),e.filterLastContact&&this.filterLastContact.set(e.filterLastContact),e.gapRows&&this.gapPageRows.set(e.gapRows),e.gapSortField&&this.gapSortField.set(e.gapSortField),e.gapSortOrder&&this.gapSortOrder.set(e.gapSortOrder),e.visibleCols&&this.visibleCols.set(e.visibleCols),e.colOrder){let i=new Map(n.DEFAULT_COLS.map(_=>[_.key,_])),o=e.colOrder.filter(_=>i.has(_)).map(_=>i.get(_)),l=n.DEFAULT_COLS.filter(_=>!e.colOrder.includes(_.key));this.columnDefs=[...o,...l]}}}catch(t){}}savePreferences(){try{localStorage.setItem(this.prefsKey,JSON.stringify({filterCountries:this.filterCountries(),filterProductId:this.filterProductId(),filterAssetIds:this.filterAssetIds(),filterAreas:this.filterAreas(),filterGapReasons:this.filterGapReasons(),filterLastContact:this.filterLastContact(),gapRows:this.gapPageRows(),gapSortField:this.gapSortField(),gapSortOrder:this.gapSortOrder(),visibleCols:this.visibleCols(),colOrder:this.columnDefs.map(t=>t.key)}))}catch(t){}}loadFilterOptions(){this.api.getProducts().subscribe(t=>{this.products.set(t),this.productOptions.set(t.map(e=>({label:e.name,value:e.id})))}),this.api.getAssetsPage({limit:500}).subscribe(t=>{this.assets.set(t.items),this.assetOptions.set(t.items.map(e=>({label:e.name,value:e.id})))}),this.api.getCountries().subscribe(t=>this.countryOptions.set(t)),this.api.getAreas().subscribe(t=>this.areaOptions.set(t))}onProductChange(t){if(this.filterProductId.set(t),t&&this.filterAssetIds().length){let e=new Set(this.assets().filter(i=>i.products.some(o=>o.id===t)).map(i=>i.id));this.filterAssetIds.set(this.filterAssetIds().filter(i=>e.has(i)))}this.onFilterChange()}onFilterChange(){this.gapFirst.set(0),this.selectedGapRows.set([]),this.savePreferences(),this.loadGaps(1,this.gapPageRows(),this.gapSortField(),this.gapSortOrder())}loadGaps(t,e,i,o){this.gapLoading.set(!0);let l=o===1?"asc":"desc";this.api.getProductActivityCompanyGaps(t,e,i,l,this.filterCountries()?.length?this.filterCountries():void 0,this.filterAssetIds()?.length?this.filterAssetIds():void 0,this.filterProductId()??void 0,this.filterGapReasons()?.length?this.filterGapReasons():void 0,this.filterLastContact()?.length?this.filterLastContact():void 0,this.filterAreas()?.length?this.filterAreas():void 0).subscribe({next:_=>{let O=_.items.map(I=>E(P({},I),{gapKey:I.company_id,chosenAssetId:I.missing_assets.length===1?I.missing_assets[0].asset_id:null,chosenAssetName:I.missing_assets.length===1?I.missing_assets[0].asset_name:null}));this.gapRows.set(O),this.gapTotal.set(_.total),this.gapLoading.set(!1)},error:()=>this.gapLoading.set(!1)})}onGapLazy(t){let e=t.rows??this.gapPageRows(),i=Math.floor((t.first??0)/e)+1,o=t.sortField||this.gapSortField(),l=t.sortOrder??this.gapSortOrder();this.gapFirst.set(t.first??0),this.gapPageRows.set(e),this.gapSortField.set(o),this.gapSortOrder.set(l),this.savePreferences(),this.loadGaps(i,e,o,l)}isSelected(t){return this.selectedGapRows().some(e=>e.company_id===t.company_id)}isSelectedWithOffer(t,e){return this.selectedGapRows().some(i=>i.company_id===t.company_id&&i.chosenAssetId===e)}preselectByRecency(t){let e=Date.now(),i=this.gapRows().filter(o=>o.missing_assets.length?t===null?o.outreach_count===0:(o.last_outreach_date?new Date(o.last_outreach_date).getTime():0)<e-t*864e5:!1);this.selectedGapRows.set(i.map(o=>E(P({},o),{chosenAssetId:o.missing_assets[0].asset_id,chosenAssetName:o.missing_assets[0].asset_name})))}openOfferPicker(t,e,i){let o=this.selectedGapRows().find(l=>l.company_id===t.company_id);this.gapPopoverRow.set(o??t),i.show(e)}chooseOfferForRow(t,e,i){let o=E(P({},t),{chosenAssetId:e.asset_id,chosenAssetName:e.asset_name});this.isSelected(t)?this.selectedGapRows.set(this.selectedGapRows().map(l
1=>l.company_id===t.company_id?o:l)):this.selectedGapRows.set([...this.selectedGapRows(),o]),this.gapPopoverRow.set(o),i.hide()}toggleGapOfferFilter(t){let e=this.filterAssetIds();this.filterAssetIds.set(e.includes(t)?e.filter(i=>i!==t):[...e,t]),this.onFilterChange()}toggleGapReasonFilter(t){let e=this.filterGapReasons();this.filterGapReasons.set(e.includes(t)?e.filter(i=>i!==t):[...e,t]),this.onFilterChange()}toggleLastContactFilter(t){let e=this.filterLastContact();this.filterLastContact.set(e.includes(t)?e.filter(i=>i!==t):[...e,t]),this.onFilterChange()}saveCompanyAreas(t,e){this.api.updateCompany(t.company_id,{areas:e}).subscribe({next:()=>{this.gapRows.set(this.gapRows().map(i=>i.company_id===t.company_id?E(P({},i),{areas:e}):i))}})}toggleAreaFilter(t){let e=this.filterAreas();this.filterAreas.set(e.includes(t)?e.filter(i=>i!==t):[...e,t]),this.onFilterChange()}openFindContacts(t){this.findContactsRow.set(t)}onFindContactsDone(){this.findContactsRow.set(null),this.loadGaps(Math.floor(this.gapFirst()/this.gapPageRows())+1,this.gapPageRows(),this.gapSortField(),this.gapSortOrder())}openCompany(t){window.open(`/companies/${t}`,"_blank")}createCampaignFromGaps(){let t=this.selectedGapRows();!t.length||!this.canCreateCampaign()||this.router.navigate(["/campaigns/new"],{queryParams:{asset_id:t[0].chosenAssetId,company_ids:JSON.stringify([...new Set(t.map(e=>e.company_id))])}})}static \u0275fac=function(e){return new(e||n)(M(se),M(ee),M(q),M(he))};static \u0275cmp=N({type:n,selectors:[["app-company-gaps"]],decls:89,vars:100,consts:[["offerPop",""],["colOfferFilter",""],["colLastContactFilter",""],["colGapReasonFilter",""],["colAreaFilter",""],[1,"p-6","space-y-6"],[1,"bg-white","border","border-surface-200","rounded-xl","p-4","flex","flex-wrap","gap-4"],[1,"flex","flex-col","gap-1","min-w-48"],[1,"text-xs","text-surface-600"],[3,"ngModelChange","options","ngModel","placeholder","showClear","maxSelectedLabels"],["optionLabel","label","optionValue","value",3,"ngModelChange","options","showClear","placeholder","ngModel"],["optionLabel","label","optionValue","value",3,"ngModelChange","options","showClear","placeholder","maxSelectedLabels","ngModel"],[3,"ngModelChange","options","showClear","placeholder","maxSelectedLabels","filter","ngModel"],[1,"bg-white","border","border-surface-200","rounded-xl","p-5","space-y-4"],[1,"flex","items-center","gap-2","flex-wrap"],[1,"text-xs","text-surface-500","mr-1"],["severity","secondary","size","small",3,"onClick","label","outlined","disabled"],[1,"ml-auto"],[3,"valueChange","columnsChange","columns","value"],["dataKey","gapKey","stripedRows","",3,"onLazyLoad","selectionChange","value","totalRecords","rows","rowsPerPageOptions","paginator","lazy","loading","first","sortField","sortOrder","selection"],["pTemplate","header"],["pTemplate","body"],["pTemplate","emptymessage"],[1,"p-1","min-w-52","max-w-80"],[1,"text-xs","font-medium","text-surface-500","mb-1.5","px-2","uppercase","tracking-wide"],[1,"p-1","min-w-56","max-w-80"],[1,"flex","items-center","gap-2","px-2","py-1.5","rounded","text-sm","hover:bg-surface-50","cursor-pointer"],[1,"border-t","border-surface-100","mt-1","pt-1"],[1,"p-1","min-w-52"],[1,"p-1","min-w-56","max-w-80",2,"max-height","320px","overflow-y","auto"],[3,"companyId","companyName","companyCountry"],[1,"text-sm","text-surface-600","ml-2"],["icon","pi pi-megaphone","size","small",3,"label"],["severity","secondary","size","small",3,"onClick","label","text"],["icon","pi pi-megaphone","size","small",3,"onClick","label"],["icon","pi pi-megaphone","size","small","tooltipPosition","top",3,"label","disabled","pTooltip"],[1,"text-xs","text-surface-500"],[2,"width","3rem"],["pSortableColumn","company_name"],["field","company_name"],["pSortableColumn","country"],["pSortableColumn","missing_count","tooltipPosition","top",3,"pTooltip"],["tooltipPosition","top",3,"pTooltip"],["pSortableColumn","employee_count","tooltipPosition","top",3,"pTooltip"],["pSortableColumn","outreach_count","tooltipPosition","top",3,"pTooltip"],["pSortableColumn","last_outreach_date","tooltipPosition","top",3,"pTooltip"],["field","country"],[1,"inline-flex","items-center","gap-1"],["field","missing_count"],["type","button",1,"leading-none",3,"click"],["xmlns","http://www.w3.org/2000/svg","width","12","height","12","viewBox","0 0 24 24","fill","none","stroke","currentColor","stroke-width","2","stroke-linecap","round","stroke-linejoin","round"],["points","22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3"],["field","employee_count"],["field","outreach_count"],["field","last_outreach_date"],[3,"value"],[1,"font-medium"],[1,"curs
1or-pointer","hover:underline","text-primary-600",3,"click"],[3,"class"],[1,"text-surface-500","text-xs","cursor-pointer","hover:text-primary-600","hover:underline","underline-offset-2","transition-colors"],["type","button",1,"flex","flex-col","items-start","gap-0.5","w-full","text-left","hover:bg-surface-50","rounded","px-1","-mx-1","py-0.5","transition-colors",3,"click"],[1,"text-sm"],[1,"inline-flex","items-center","gap-1","text-sm","text-primary-700","font-medium"],[1,"text-xs","text-surface-400"],["x1","8","y1","6","x2","21","y2","6"],["x1","8","y1","12","x2","21","y2","12"],["x1","8","y1","18","x2","21","y2","18"],["x1","3","y1","6","x2","3.01","y2","6"],["x1","3","y1","12","x2","3.01","y2","12"],["x1","3","y1","18","x2","3.01","y2","18"],[3,"save","value","options","placeholder"],[1,"text-surface-500","text-xs","cursor-pointer","hover:text-primary-600","hover:underline","underline-offset-2","transition-colors",3,"mouseenter","mouseleave"],["type","button","tooltipPosition","top",1,"inline-flex","items-center","px-2","py-0.5","rounded","text-xs","font-medium","bg-red-50","text-red-600","hover:bg-red-100","transition-colors","cursor-pointer",3,"pTooltip"],["tooltipPosition","top",1,"inline-flex","items-center","px-2","py-0.5","rounded","text-xs","font-medium","bg-amber-50","text-amber-700",3,"pTooltip"],["tooltipPosition","top",1,"inline-flex","items-center","px-2","py-0.5","rounded","text-xs","font-medium","bg-blue-50","text-blue-700",3,"pTooltip"],["type","button","tooltipPosition","top",1,"inline-flex","items-center","px-2","py-0.5","rounded","text-xs","font-medium","bg-red-50","text-red-600","hover:bg-red-100","transition-colors","cursor-pointer",3,"click","pTooltip"],[1,"text-center","text-surface-400","text-sm","py-6"],["type","button",1,"w-full","text-left","px-2","py-1.5","rounded","text-sm","hover:bg-surface-100","flex","items-center","gap-2","transition-colors",3,"bg-primary-50","text-primary-700"],["type","button",1,"w-full","text-left","px-2","py-1.5","rounded","text-sm","hover:bg-surface-100","flex","items-center","gap-2","transition-colors",3,"click"],[1,"w-3","inline-block"],["points","20 6 9 17 4 12"],["type","checkbox",1,"rounded","border-surface-300",3,"change","checked"],["type","button",1,"text-xs","text-surface-400","hover:text-surface-600","px-2","py-1",3,"click"],[3,"closed","enrichmentDone","companyId","companyName","companyCountry"]],template:function(e,i){if(e&1){let o=x();r(0,"div",5)(1,"div",6)(2,"div",7)(3,"label",8),m(4),c(5,"transloco"),s(),r(6,"p-multiselect",9),c(7,"transloco"),u("ngModelChange",function(_){return g(o),i.filterCountries.set(_??[]),C(i.onFilterChange())}),s()(),r(8,"div",7)(9,"label",8),m(10),c(11,"transloco"),s(),r(12,"p-select",10),c(13,"transloco"),u("ngModelChange",function(_){return i.onProductChange(_)}),s()(),r(14,"div",7)(15,"label",8),m(16),c(17,"transloco"),s(),r(18,"p-multiselect",11),c(19,"transloco"),u("ngModelChange",function(_){return g(o),i.filterAssetIds.set(_??[]),C(i.onFilterChange())}),s()(),r(20,"div",7)(21,"label",8),m(22),s(),r(23,"p-multiselect",12),c(24,"transloco"),u("ngModelChange",function(_){return g(o),i.filterAreas.set(_??[]),C(i.onFilterChange())}),s()()(),r(25,"div",13)(26,"div",14)(27,"span",15),m(28),c(29,"transloco"),s(),r(30,"p-button",16),c(31,"transloco"),u("onClick",function(){return i.preselectByRecency(null)}),s(),r(32,"p-button",16),c(33,"transloco"),u("onClick",function(){return i.preselectByRecency(7)}),s(),r(34,"p-button",16),c(35,"transloco"),u("onClick",function(){return i.preselectByRecency(14)}),s(),r(36,"p-button",16),c(37,"transloco"),u("onClick",function(){return i.preselectByRecency(30)}),s(),h(38,ke,7,11),r(39,"div",17)(40,"app-column-picker",18),u("valueChange",function(_){return g(o),i.visibleCols.set(_),C(i.savePreferences())})("columnsChange",function(_){return g(o),i.columnDefs=_,C(i.savePreferences())}),s()()(),r(41,"p-table",19),u("onLazyLoad",function(_){return i.onGapLazy(_)}),U("selectionChange",function(_){return g(o),H(i.selectedGapRowsArray,_)||(i.selectedGapRowsArray=_),C(_)}),u("selectionChange",function(_){return i.selectedGapRows.set(_)}),$(42,$e,9,3,"ng-template",20)(43,nt,8,2,"ng-template",21)(44,ot,4,4,"ng-template",22),s()()(),r(45,"p-popover",null,0)(47,"div",23)(48,"div",24),m(49),c(50,"transloco"),s(),h(51,pt,2,0),s()(),r(52,"p-popover",null,1)(54,"div",25)(55,"div",24),m(56),c(57,"transloco"),s(),S(58,lt,3,2,"label",26,D),h(60,ct,4,3,"div",27),s()(),r(61,"p-popover",null,2)(63,"div",28)(64,"div",24),m(65),c(66,"transloco"),s(),S(67,dt,3,2,"label",26,D),h(69,mt,4,3,"div",27),s()(),r(70,"p-popover",null,3)(72,"div",28)(73,"div",24),m(74),c(75,"transloco"),s(),S(76,_t,3,2,"label",26,D),h(78,ut,4,3,"div",27),s()(),r(79,"p-popover",null,4)(81,"div",29)(82,"div",24),m(83),c(84,"transloco"),s(),S(85,gt,3,2,"label",26,K),h(87,Ct,4,3,"div",27),s()(),h(88,ft,1,3,"app-find-contacts-params-dialog",3
10)}if(e&2){let o,l;a(4),y(d(5,62,"productActivity.gaps.filters.country")),a(2),f("options",i.countryOptions())("ngModel",i.filterCountries())("placeholder",d(7,64,"productActivity.gaps.filters.countryAll"))("showClear",!0)("maxSelectedLabels",2),a(4),y(d(11,66,"productActivity.gaps.filters.product")),a(2),f("options",i.productOptions())("showClear",!0)("placeholder",d(13,68,"productActivity.gaps.filters.productAll"))("ngModel",i.filterProductId()),a(4),y(d(17,70,"productActivity.gaps.filters.offer")),a(2),f("options",i.filteredAssetOptions())("showClear",!0)("placeholder",d(19,72,"productActivity.gaps.filters.offerAll"))("maxSelectedLabels",1)("ngModel",i.filterAssetIds()),a(4),y(i.areaLabelService.areaLabel()),a(),f("options",i.areaOptions())("showClear",!0)("placeholder",d(24,74,"productActivity.gaps.filters.areaAll"))("maxSelectedLabels",2)("filter",!0)("ngModel",i.filterAreas()),a(5),y(d(29,76,"productActivity.gaps.preselect.label")),a(2),f("label",d(31,78,"productActivity.gaps.preselect.neverContacted"))("outlined",!0)("disabled",i.gapRows().length===0),a(2),f("label",d(33,80,"productActivity.gaps.preselect.ge7Days"))("outlined",!0)("disabled",i.gapRows().length===0),a(2),f("label",d(35,82,"productActivity.gaps.preselect.ge14Days"))("outlined",!0)("disabled",i.gapRows().length===0),a(2),f("label",d(37,84,"productActivity.gaps.preselect.ge1Month"))("outlined",!0)("disabled",i.gapRows().length===0),a(2),b(i.selectedGapRows().length>0?38:-1),a(2),f("columns",i.columnDefs)("value",i.visibleCols()),a(),f("value",i.gapRows())("totalRecords",i.gapTotal())("rows",i.gapPageRows())("rowsPerPageOptions",J(97,Te))("paginator",!0)("lazy",!0)("loading",i.gapLoading())("first",i.gapFirst())("sortField",i.gapSortField())("sortOrder",i.gapSortOrder()),j("selection",i.selectedGapRowsArray),a(8),y(d(50,86,"productActivity.gaps.popover.selectOffer")),a(2),b((o=i.gapPopoverRow())?51:-1,o),a(5),y(d(57,88,"productActivity.gaps.popover.filterByOffer")),a(2),A(i.assetOptions()),a(2),b(i.filterAssetIds().length>0?60:-1),a(5),y(d(66,90,"productActivity.gaps.popover.filterByLastContact")),a(2),A(i.lastContactOptions()),a(2),b(i.filterLastContact().length>0?69:-1),a(5),y(d(75,92,"productActivity.gaps.popover.filterByGapReason")),a(2),A(i.gapReasonOptions()),a(2),b(i.filterGapReasons().length>0?78:-1),a(5),y(k(84,94,"productActivity.gaps.popover.filterByArea",L(98,Ge,i.areaLabelService.areaLabel().toLowerCase()))),a(2),A(i.areaOptions()),a(2),b(i.filterAreas().length>0?87:-1),a(),b((l=i.findContactsRow())?88:-1,l)}},dependencies:[ne,te,ie,re,de,le,ye,_e,Q,ue,ge,Ce,fe,ae,oe,me,xe,ve,be,pe,Z],encapsulation:2})};export{we as CompanyGapsComponent};
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.