1import {p as pt}from'./chunk-ejbyXQs6.js';import {E as Ee$1,z as zn}from'./chunk-Cdg9UMlV.js';import {l}from'./chunk-C98B6s87.js';import {h}from'./chunk-DIlu6Xur.js';import {g,v as vr,fI as I,bH as L,E,D,V,bI as Gt,bJ as V$1,O,aE as ut,bK as P,e as f,X as Xb,T as Tt,j as Xv,R as RM,z as zg,i as ai$1,cn as pe,N as Ng,w as w0,b1 as ei$1,H as H0,Z as Zx,k as dn,b2 as da,cp as xr,l as zw,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,aW as pD,aX as mD,u as al,x as tM,y as dM,L as Lb,A as r1,P as P1,fV as z_,cZ as j_,cQ as G_,cR as O1,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,_ as tE,$ as Dn,a0 as ME,a1 as ny,a2 as go,a3 as Kd,a4 as XE,a5 as LT,a6 as mA,a7 as mt,cx as WM,aw as o,ei as p_,a8 as fy,aa as Js,a9 as ZT,ad as gd,aB as ey,ai as dy,bn as nS,ag as SC,ah as YT,aZ as by,a_ as m_,a$ as y_,ac as H_,ae as pS,aT as d_,aD as By,al as gS,aR as i_,ab as Ey,aS as Vp,aU as Hp,aj as jy,ak as Ed,c8 as Vy,ej as h_,bV as zy,bW as W_,bX as $y,dm as oS,bg as mS}from'./main-4WA6AAHG.js';import {B as Bt}from'./chunk-swNbBqwZ.js';import {S}from'./chunk-CH84xj75.js';import {P as Pe$1}from'./chunk-eo_COu5C.js';import'./chunk-CRDu30vL.js';import'./chunk-CF84gehD.js';import {E as En,D as De$1}from'./chunk-DFWdtebV.js';import {f as f$1}from'./chunk-CmdXsb3H.js';import {h as he$1}from'./chunk-DvLFd6NQ.js';import {Q,X}from'./chunk-D6ErD1U4.js';import'./chunk-BGOHF1M9.js';import {c as ce}from'./chunk-BRsHFk4j.js';import'./chunk-C0DmzTpz.js';import'./chunk-CkU8oUfw.js';import'./chunk-DrBQt-fY.js';var be=["chart"],ye=["*"],Pe=()=>["Read the funnel top to bottom to see where the campaign lost people.","Failure Reasons is where you find out whether the problem was the numbers, the template or the account."],he=()=>[10,50,100],De=(e,n)=>["/admin/promotions/api-promotions/promotion-details",e,n];function Te(e,n){if(e&1&&(Js(0,"span"),H_(1),pS(2,"translate"),gd()),e&2){let t=d_();SC(),By(" '",t.promotion.notes,"' ",gS(2,2,"details and sending status"),". ");}}function Me(e,n){if(e&1){let t=i_();Js(0,"app-permission-button",11),Ey("clickAction",function(){Vp(t);let m=d_();return Hp(m.goBack())}),gd();}}function Ie(e,n){e&1&&(H_(0),pS(1,"translate")),e&2&&Ed(" ",gS(1,1,"Campaign paused: daily send limit reached")," ");}function we(e,n){e&1&&(H_(0),pS(1,"translate")),e&2&&Ed(" ",gS(1,1,"Campaign has not finished sending yet")," ");}function Ae(e,n){e&1&&(H_(0),pS(1,"translate")),e&2&&Ed(" ",gS(1,1,"Campaign not sent")," ");}function Ee(e,n){e&1&&(H_(0),pS(1,"translate")),e&2&&Ed(" ",gS(1,1,"Campaign completed with some failures")," ");}function Be(e,n){if(e&1&&(Js(0,"span",16),H_(1),pS(2,"translate"),Js(3,"span",17),H_(4),pS(5,"translate"),gd()()),e&2){let t=d_(2);SC(),Ed(" ",gS(2,4,"Sending continues automatically as your 24-hour window frees up.")," "),SC(3),Vy("(",t.failureBanner.sentCount," / ",t.failureBanner.total," ",gS(5,6,"Sent"),")");}}function Fe(e,n){if(e&1&&(Js(0,"span",16)(1,"span",18),H_(2),pS(3,"translate"),gd()()),e&2){let t=d_(2);SC(2),Vy("(",t.failureBanner.sentCount," / ",t.failureBanner.total," ",gS(3,3,"Sent"),")");}}function ke(e,n){if(e&1&&(H_(0),pS(1,"translate"),Js(2,"strong"),H_(3),gd()),e&2){let t=d_(3);Ed(" ",gS(1,2,"Reason"),": "),SC(3),jy(t.failureBanner.reason);}}function Oe(e,n){if(e&1&&(Js(0,"span",16),ZT(1,ke,4,4),Js(2,"span",17),H_(3),pS(4,"translate"),gd()()),e&2){let t=d_(2);SC(),YT(t.failureBanner.reason?1:-1),SC(2),Vy("(",t.failureBanner.failedCount," / ",t.failureBanner.total," ",gS(4,4,"Not Sent"),")");}}function Re(e,n){if(e&1&&(Js(0,"span",16),H_(1),pS(2,"translate"),Js(3,"strong"),H_(4),gd()()),e&2){let t=d_(2);SC(),Ed(" ",gS(2,2,"Still waiting to be sent"),": "),SC(3),jy(t.failureBanner.pendingCount);}}function Ne(e,n){if(e&1&&(Js(0,"mat-card",1)(1,"mat-card-content",12)(2,"div",13)(3,"mat-icon",14),H_(4),gd(),Js(5,"div")(6,"h5",15),ZT(7,Ie,2,3)(8,we,2,3)(9,Ae,2,3)(10,Ee,2,3),gd(),ZT(11,Be,6,8,"span",16)(12,Fe,4,5,"span",16)(13,Oe,5,6,"span",16),ZT(14,Re,5,4,"span",16),gd()()()()),e&2){let t,c=d_();SC(),dy("ngClass",c.failureBanner.kind==="full"?"bg-light-error":"bg-light-warning"),SC(2),dy("ngClass",c.failureBanner.kind==="full"?"text-error":"text-warning"),SC(),jy(c.failureBanner.kind==="paused"||c.failureBanner.kind==="pending"?"schedule":"error"),SC(2),dy("ngClass",c.failureBanner.kind==="full"?"text-error":"text-warning"),SC(),YT((t=c.failureBanner.kind)==="paused"?7:t==="pending"?8:t==="full"?9:10),SC(4),YT(c.failureBanner.kind==="paused"?11:c.failureBanner.kind==="pending"?12:13),SC(3),YT(c.failureBanner.pendingCount>0?14:-1);}}function je(e,n){e&1&&(Js(0,"div",19)(1,"mat-icon"),H_(2," bar_chart "),gd()(),H_(3),pS(4,"translate")),e&2&&(SC(3),Ed(" ",gS(4,1,"
1Statistics")," "));}function Le(e,n){if(e&1&&(Js(0,"div",23)(1,"mat-card",24)(2,"div",28)(3,"h4",29),H_(4),pS(5,"translate"),gd(),Js(6,"h5",30),H_(7),gd()()()(),Js(8,"div",23)(9,"mat-card",24)(10,"div",25)(11,"h4",26),H_(12),pS(13,"translate"),gd(),Js(14,"h5",27),H_(15),gd()()()(),Js(16,"div",23)(17,"mat-card",24)(18,"div",36)(19,"h4",37),H_(20),pS(21,"translate"),gd(),Js(22,"h5",38),H_(23),gd()()()(),Js(24,"div",23)(25,"mat-card",24)(26,"div",39)(27,"h4",40),H_(28),pS(29,"translate"),gd(),Js(30,"h5",41),H_(31),gd()()()()),e&2){let t=d_(3);SC(4),Ed(" ",gS(5,8,"Success Rate")," "),SC(3),Ed("",t.formatRate(t.stats.kpis.successRate),"%"),SC(5),Ed(" ",gS(13,10,"Delivery Rate")," "),SC(3),Ed("",t.formatRate(t.stats.kpis.deliveryRate),"%"),SC(5),Ed(" ",gS(21,12,"Read Rate")," "),SC(3),Ed("",t.formatRate(t.stats.kpis.readRate),"%"),SC(5),Ed(" ",gS(29,14,"Engagement Rate")," "),SC(3),Ed("",t.formatRate(t.stats.kpis.engagedRate),"%");}}function $e(e,n){if(e&1&&(Js(0,"mat-card",1)(1,"mat-card-header")(2,"mat-card-title",42),H_(3),pS(4,"translate"),gd()(),Js(5,"mat-card-content",2),fy(6,"apx-chart",43),gd()()),e&2){let t=d_(3);SC(3),jy(gS(4,10,"Delivery Funnel")),SC(3),dy("series",t.deliveryFunnelChart.series)("chart",t.deliveryFunnelChart.chart)("plotOptions",t.deliveryFunnelChart.plotOptions)("xaxis",t.deliveryFunnelChart.xaxis)("colors",t.deliveryFunnelChart.colors)("dataLabels",t.deliveryFunnelChart.dataLabels)("legend",t.deliveryFunnelChart.legend)("grid",t.deliveryFunnelChart.grid)("tooltip",t.deliveryFunnelChart.tooltip);}}function Ve(e,n){if(e&1&&(Js(0,"mat-card",1)(1,"mat-card-header")(2,"mat-card-title",42),H_(3),pS(4,"translate"),gd()(),Js(5,"mat-card-content",2),fy(6,"apx-chart",44),gd()()),e&2){let t=d_(3);SC(3),jy(gS(4,11,"Failure Reasons")),SC(3),dy("series",t.failureChart.series)("chart",t.failureChart.chart)("plotOptions",t.failureChart.plotOptions)("xaxis",t.failureChart.xaxis)("yaxis",t.failureChart.yaxis)("colors",t.failureChart.colors)("dataLabels",t.failureChart.dataLabels)("legend",t.failureChart.legend)("grid",t.failureChart.grid)("tooltip",t.failureChart.tooltip);}}function ze(e,n){if(e&1&&(Js(0,"mat-card-content",20)(1,"mat-card",21)(2,"mat-card-title")(3,"div",22)(4,"div",23)(5,"mat-card",24)(6,"div",25)(7,"h4",26),H_(8),pS(9,"translate"),gd(),Js(10,"h5",27),H_(11),gd()()()(),Js(12,"div",23)(13,"mat-card",24)(14,"div",28)(15,"h4",29),H_(16),pS(17,"translate"),gd(),Js(18,"h5",30),H_(19),gd()()()(),Js(20,"div",23)(21,"mat-card",24)(22,"div",31)(23,"h4",32),H_(24),pS(25,"translate"),gd(),Js(26,"h5",33),H_(27),gd()()()(),ZT(28,Le,32,16),gd()(),Js(29,"mat-card-content",34),fy(30,"apx-chart",35),gd()(),ZT(31,$e,7,12,"mat-card",1),ZT(32,Ve,7,13,"mat-card",1),gd()),e&2){let t=d_(2);SC(8),Ed(" ",gS(9,16,"Total")," "),SC(3),jy(t.promotion.countTotal),SC(5),Ed(" ",gS(17,18,"Success")," "),SC(3),jy(t.promotion.countSuccess),SC(5),Ed(" ",gS(25,20,"Not Sent")," "),SC(3),Ed("",t.promotion.countTotal-t.promotion.countSuccess," "),SC(),YT(t.stats?28:-1),SC(2),dy("series",t.chartOptions.series)("chart",t.chartOptions.chart)("dataLabels",t.chartOptions.dataLabels)("plotOptions",t.chartOptions.plotOptions)("legend",t.chartOptions.legend)("colors",t.chartOptions.colors)("tooltip",t.chartOptions.tooltip),SC(),YT(t.deliveryFunnelChart?31:-1),SC(),YT(t.failureChart?32:-1);}}function He(e,n){e&1&&(Js(0,"mat-tab"),ey(1,je,5,3,"ng-template",9)(2,ze,33,22,"ng-template",10),gd());}function We(e,n){e&1&&(Js(0,"div",19)(1,"mat-icon"),H_(2,"info"),gd()(),H_(3),pS(4,"translate")),e&2&&(SC(3),Ed(" ",gS(4,1,"Info")," "));}function Qe(e,n){if(e&1&&(Js(0,"div",46),fy(1,"app-user-date",50),gd()),e&2){let t=d_(3);SC(),dy("name",t.promotion.createdBy)("datetime",t.promotion.createdOn)("day",true);}}function Ge(e,n){if(e&1&&(Js(0,"div",46),fy(1,"app-user-date",51),gd()),e&2){let t=d_(3);SC(),dy("datetime",t.promotion.startSendingOn)("day",true);}}function qe(e,n){if(e&1&&(Js(0,"div",46),fy(1,"app-user-date",52),gd()),e&2){let t=d_(3);SC(),dy("datetime",t.promotion.firstMessageSentOn)("day",true);}}function Ke(e,n){if(e&1&&(Js(0,"div",46),fy(1,"app-user-date",53),gd()),e&2){let t=d_(3);SC(),dy("datetime",t.promotion.lastMessageSentOn)("day",true);}}function Ue(e,n){if(e&1&&(Js(0,"div",46),fy(1,"app-user-date",54),gd()),e&2){let t=d_(3);
1SC(),dy("datetime",t.promotion.finishSendingOn)("day",true);}}function Je(e,n){if(e&1&&(Js(0,"div",46)(1,"mat-card",1)(2,"mat-card-content",47)(3,"mat-card-title"),H_(4),pS(5,"translate"),gd(),H_(6),pS(7,"translate"),gd()()()),e&2){let t=d_(3);SC(4),jy(gS(5,2,"Repeat Type")),SC(2),Ed(" ",gS(7,4,t.getRepeatTypeText(t.promotion.repeatType))," ");}}function Xe(e,n){if(e&1&&(Js(0,"mat-card-content",20)(1,"div",45)(2,"div",46)(3,"mat-card",1)(4,"mat-card-content",47)(5,"mat-card-title"),H_(6),pS(7,"translate"),gd(),Js(8,"mat-card-subtitle",48),H_(9),gd()()()(),Js(10,"div",46)(11,"mat-card",1)(12,"mat-card-content",47)(13,"mat-card-title"),H_(14),pS(15,"translate"),gd(),Js(16,"mat-card-subtitle",48),H_(17),pS(18,"translate"),gd()()()(),Js(19,"div",46)(20,"mat-card",1)(21,"mat-card-content",47)(22,"mat-card-title"),H_(23),pS(24,"translate"),gd(),Js(25,"mat-icon",49),H_(26,"chat"),gd(),H_(27),gd()()(),Js(28,"div",46)(29,"mat-card",1)(30,"mat-card-content",47)(31,"mat-card-title"),H_(32),pS(33,"translate"),gd(),Js(34,"mat-icon",49),H_(35,"chat"),gd(),H_(36),gd()()(),ZT(37,Qe,2,3,"div",46),ZT(38,Ge,2,2,"div",46),ZT(39,qe,2,2,"div",46),ZT(40,Ke,2,2,"div",46),ZT(41,Ue,2,2,"div",46),ZT(42,Je,8,6,"div",46),gd()()),e&2){let t=d_(2);SC(6),jy(gS(7,14,"Name")),SC(3),Ed(" ",t.promotion.notes," "),SC(5),jy(gS(15,16,"Status")),SC(3),Ed(" ",gS(18,18,t.getStatusTxt(t.promotion.status))," "),SC(6),jy(gS(24,20,"Group")),SC(4),Ed(" ",t.promotion.groupName," "),SC(5),jy(gS(33,22,"Template")),SC(4),Ed(" ",t.promotion.templateName," "),SC(),YT(t.promotion.createdOn?37:-1),SC(),YT(t.promotion.startSendingOn?38:-1),SC(),YT(t.promotion.firstMessageSentOn?39:-1),SC(),YT(t.promotion.lastMessageSentOn?40:-1),SC(),YT(t.promotion.finishSendingOn?41:-1),SC(),YT(t.promotion.repeatType?42:-1);}}function Ye(e,n){if(e&1&&ZT(0,Xe,43,24,"mat-card-content",20),e&2){let t=d_();YT(t.promotion?0:-1);}}function Ze(e,n){e&1&&(Js(0,"div",19)(1,"mat-icon"),H_(2,"ads_click"),gd()(),H_(3),pS(4,"translate")),e&2&&(SC(3),Ed(" ",gS(4,1,"Button responses")," "));}function ti(e,n){if(e&1&&(Js(0,"mat-card",1)(1,"mat-card-content",2),fy(2,"app-promotion-button-responses",55),gd()()),e&2){let t=d_(2);SC(2),dy("promotionId",t.promotion.id)("clientId",t.clientId)("campaignName",t.promotion.notes);}}function ei(e,n){e&1&&(Js(0,"mat-tab"),ey(1,Ze,5,3,"ng-template",9)(2,ti,3,3,"ng-template",10),gd());}function ii(e,n){e&1&&(Js(0,"div",19)(1,"mat-icon"),H_(2,"people"),gd()(),H_(3),pS(4,"translate")),e&2&&(SC(3),Ed(" ",gS(4,1,"Promotion Customers")," "));}function ni(e,n){if(e&1&&H_(0),e&2){let t=n.$implicit;Ed(" ",t.customerPhoneNumber," ");}}function oi(e,n){if(e&1&&H_(0),e&2){let t=n.$implicit;Ed(" ",t.customerName," ");}}function ai(e,n){if(e&1&&fy(0,"app-status-icon",68),e&2){let t=n.$implicit;dy("isActive",t.isSent);}}function ri(e,n){if(e&1&&(H_(0),pS(1,"localTime"),pS(2,"date")),e&2){let t=d_().$implicit;Ed(" ",mS(2,3,gS(1,1,t.sentOn),"dd/MM/yyyy hh:mm a")," ");}}function li(e,n){if(e&1&&ZT(0,ri,3,6),e&2){let t=n.$implicit;YT(t.sentOn?0:-1);}}function mi(e,n){if(e&1&&fy(0,"app-status-icon",69),e&2){let t=n.$implicit;dy("isActive",t.isDelivered)("showInactive",false);}}function pi(e,n){if(e&1&&fy(0,"app-status-icon",69),e&2){let t=n.$implicit;dy("isActive",t.isRead)("showInactive",false);}}function di(e,n){e&1&&(Js(0,"mat-icon",70),H_(1,"error"),gd());}function si(e,n){if(e&1&&ZT(0,di,2,0,"mat-icon",70),e&2){let t=n.$implicit;YT(t.isFailed?0:-1);}}function ci(e,n){if(e&1&&H_(0),e&2){let t=d_().$implicit;Ed(" ",t.failedReason," ");}}function _i(e,n){e&1&&(Js(0,"span",18),H_(1),pS(2,"translate"),gd()),e&2&&(SC(),jy(gS(2,1,"Not sent yet")));}function ui(e,n){if(e&1&&ZT(0,ci,1,1)(1,_i,3,3,"span",18),e&2){let t=n.$implicit;YT(t.failedReason?0:t.isSent?-1:1);}}function Ci(e,n){if(e&1){let t=i_();Js(0,"mat-form-field")(1,"mat-label"),H_(2),pS(3,"translate"),gd(),Js(4,"mat-select",57),zy("valueChange",function(m){Vp(t);let x=d_(4);return W_(x.isFailed,m)||(x.isFailed=m),Hp(m)}),Ey("selectionChange",function(){Vp(t);let m=d_(4);return Hp(m.getPromotionInfo(0,10))}),Js(5,"mat-option",58),H_(6),pS(7,"translate"),gd(),Js(8,"mat-option",58),H_(9),pS(10,"translate"),gd(),Js(11,"mat-option",58),H_(12),pS(13,"translate"),gd()()(),Js(14,"app-responsive-table",59),ey(15,ni,1,1,"ng-template",60)(16,oi,1,1,"ng-template",61)(17,ai,1,1,"ng-template",62)(18,li,1,1,"ng-template",63)(19,mi,1,2,"ng-template",64)(20,pi,1,2,"ng-template",65)(21,si,1,1,"ng-template",66)(22,ui,2,1,"ng-template",67),gd();}if(e&2){let t=d_(4);SC(2),jy(gS(3,10,"Success Status")),SC(2),$y("value",t.isFailed),SC(),dy("value",null),SC(),jy(gS(7,12,"All")),SC(2),dy("value",true),SC(),jy(gS(10,14,"Failed")),SC(2),dy("value",false),SC(),jy(gS(13,16,"Success")),SC(2),dy("dataSource",t.promotionCustomers)("columns",t.customerColumns);}}function fi(e,n){e&1&&h_(0,0,null,Ci,23,18);}function xi(e,n){if(e&1){let t=i_();Js(0,"mat-card",1)(1,"mat-card-content",2),ZT(2,fi,2,0),Js(3,"paginator-configurable",56),Ey("page",function(m){Vp(t);let x=d_(2);return Hp(x.onPageChange(m))}),gd()()();}if(e&2){let t=d_(2);SC(2),YT(t.promotion&&!t.promotion.repeatType?2:-1),SC(),dy("length",t.totalCustomers)("pageSizeOptions",nS(3,he));}}function gi(e,n){e&1&&(Js(0,"mat-tab"),ey(1,ii,5,3,"ng-template",9)(2,xi,4,4,"ng-template",10),gd());}function hi(e,n){e&1&&(Js(0,"div",19),fy(1,"mat-icon"),Js(2,"mat-icon",71),H_(3,"more_horiz "),gd()(),H_(4),pS(5,"translate")),e&2&&(SC(4),Ed(" ",gS(5,1,"View Repetitions")," "));}function vi(e,n){e&1&&(Js(0,"h4"),H_(1),pS(2,"translate"),gd()),e&2&&(SC(),Ed(" ",gS(2,1,"No Data")));}function Si(e,n){if(e&1&&H_(0),e&2){let t=n.$implicit;Ed(" ",t.businessName," ");}}function bi(e,n){if(e&1&&(Js(0,"span"),H_(1),pS(2,"localTime"),pS(3,"date"),gd()),e&2){let t=d_().$implicit;SC(),jy(mS(3,3,gS(2,1,t.firstMessageSentOn),"dd/MM/yyyy"));}}function yi(e,n){if(e&1&&(Js(0,"span"),H_(1),pS(2,"localTime"),pS(3,"date"),gd()),e&2){let t=d_().$implicit;SC(),jy(mS(3,3,gS(2,1,t.startSendingOn),"dd/MM/yyyy"));}}function Pi(e,n){if(e&1){let t=i_();ZT(0,bi,4,6,"span"),ZT(1,yi,4,6,"span"),Js(2,"mat-icon",79),Ey("click",function(){let m=Vp(t).$implicit,x=d_(5);return Hp(x.showPromoDates(m))}),H_(3,"watch"),gd();}if(e&2){let t=n.$implicit;YT(t.firstMessageSentOn?0:-1),SC(),YT(t.firstMessageSentOn?-1:1);}}function Di(e,n){if(e&1&&H_(0),e&2){let t=n.$implicit;Ed(" ",t.notes," ");}}function Ti(e,n){if(e&1&&(H_(0),pS(1,"translate")),e&2){let t=n.$implicit,c=d_(5);Ed(" ",gS(1,1,c.getStatusTxt(t.status))," ");}}function Mi(e,n){if(e&1&&H_(0),e&2){let t=n.$implicit;Ed(" ",t.countTotal," ");}}function Ii(e,n){if(e&1&&(Js(0,"span"),H_(1),gd()),e&2){let t=d_().$implicit;SC(),jy(t.countSuccess);}}function wi(e,n){if(e&1&&ZT(0,Ii,2,1,"span"),e&2){let t=n.$implicit;YT(t.repeatType?-1:0);}}function Ai(e,n){if(e&1&&(Js(0,"span"),H_(1),gd()),e&2){let t=d_().$implicit;SC(),jy(t.countTotal-t.countSuccess);}}function Ei(e,n){if(e&1&&ZT(0,Ai,2,1,"span"),e&2){let t=n.$implicit;YT(t.repeatType?-1:0);}}function Bi(e,n){if(e&1&&(Js(0,"a",80),H_(1),pS(2,"translate"),Js(3,"mat-icon",49),H_(4,"info"),gd()()),e&2){let t=n.$implicit;dy("routerLink",oS(4,De,t.id,t.clientId)),SC(),Ed(" ",gS(2,2,"Details")," ");}}function Fi(e,n){if(e&1&&(Js(0,"app-responsive-table",59),ey(1,Si,1,1,"ng-template",72)(2,Pi,4,2,"ng-template",73)(3,Di,1,1,"ng-template",74)(4,Ti,2,3,"ng-template",75)(5,Mi,1,1,"ng-template",76)(6,wi,1,1,"ng-template",77)(7,Ei,1,1,"ng-template",66)(8,Bi,5,7,"ng-template",78),gd()),e&2){let t=d_(4);dy("dataSource",t.childrenPromotions)("columns",t.childColumns);}}
1function ki(e,n){if(e&1&&(ZT(0,vi,3,3,"h4"),ZT(1,Fi,9,2,"app-responsive-table",59)),e&2){let t=d_(3);YT(!t.childrenPromotions||t.childrenPromotions.length==0?0:-1),SC(),YT(t.childrenPromotions&&t.childrenPromotions.length>0?1:-1);}}function Oi(e,n){if(e&1){let t=i_();Js(0,"mat-card",1)(1,"mat-card-content",2),ZT(2,ki,2,2),Js(3,"paginator-configurable",56),Ey("page",function(m){Vp(t);let x=d_(2);return Hp(x.onChildrenPageChange(m))}),gd()()();}if(e&2){let t=d_(2);SC(2),YT(t.promotion&&t.promotion.repeatType?2:-1),SC(),dy("length",t.totalChildren)("pageSizeOptions",nS(3,he));}}function Ri(e,n){e&1&&(Js(0,"mat-tab"),ey(1,hi,6,3,"ng-template",9)(2,Oi,4,4,"ng-template",10),gd());}var no=(()=>{class e{constructor(t,c,m,x,S,ve,Se){this.promotionAdminService=t,this.errorService=c,this.activatedRoute=m,this.translate=x,this.toastr=S,this.loadingService=ve,this.dialogConfigService=Se,this.chart=Object.create(null),this.dialog=g(vr),this.stats=null,this.isSent=null,this.isFailed=null,this.childrenPromotions=[],this.totalCustomers=0,this.totalChildren=0,this.clientId=null,this.customerColumns=[{key:"phoneNumber",label:"Phone Number",priority:1},{key:"customerName",label:"Customer Name",priority:1},{key:"sent",label:"Sent?",priority:1},{key:"sentOn",label:"Sent On",priority:2},{key:"delivered",label:"Delivered?",priority:2},{key:"read",label:"Read?",priority:3},{key:"failed",label:"Failed",priority:2},{key:"failedReason",label:"Failed Reason",priority:3}],this.childColumns=[{key:"businessName",label:"Business Name",priority:1},{key:"promoDate",label:"Promo Date",priority:1},{key:"name",label:"Name",priority:1},{key:"status",label:"Status",priority:2},{key:"total",label:"Total Customers",priority:2},{key:"success",label:"Success",priority:3},{key:"failed",label:"Not Sent",priority:3},{key:"actions",label:"Actions",priority:1,hideLabel:true}],this.navigationHistory=g(I);}getPromotionInfo(t=0,c=10){this.clientId&&(this.sub=this.promotionAdminService.getPromotionInfoById(this.clientId,this.id,this.isSent,this.isFailed,t,c).subscribe({next:m=>{if(!m?.succeeded||!m.data){this.errorService.setError(m,"Error while getting the data");return}let x=m.data;this.promotionCustomers=x.promotionCustomers,this.promotion=x.promotion,this.stats=x.stats??null,this.totalCustomers=m.count||0,this.setChart(),this.buildStatsCharts();},error:m=>this.errorService.setError(m,"Error while getting the data")}));}onPageChange(t){this.getPromotionInfo(t.pageIndex,t.pageSize);}setChart(){let t=Number(this.promotion?.countSuccess)||0,c=Number(this.promotion?.countTotal-this.promotion?.countSuccess)||0;this.chartOptions={series:[t,c],labels:[this.translate.instant("Success"),this.translate.instant("Fail")],chart:{id:"donut-chart",type:"donut",height:350,width:500,fontFamily:"'Cairo', sans-serif",foreColor:"#adb
10bb"},dataLabels:{enabled:true},plotOptions:{pie:{donut:{size:"70px"}}},legend:{show:true,position:"bottom",width:"50px"},colors:["#5D87FF","#ECF2FF","#49BEFF","#E8F7FF","#FFAE1F"],tooltip:{theme:"dark",fillSeriesColor:false}};}buildStatsCharts(){if(!this.stats){this.deliveryFunnelChart=null,this.failureChart=null;return}this.buildDeliveryFunnelChart(),this.buildFailureChart();}buildDeliveryFunnelChart(){let t=this.stats?.deliveryFunnel;if(!t){this.deliveryFunnelChart=null;return}this.deliveryFunnelChart={series:[{name:this.translate.instant("Count"),data:[t.sentCount,t.deliveredCount,t.readCount,t.engagedCount]}],chart:{type:"bar",height:260,fontFamily:"'Cairo', sans-serif",foreColor:"#adb0bb",toolbar:{show:false}},plotOptions:{bar:{horizontal:true,barHeight:"50%",borderRadius:4}},colors:["#5D87FF"],xaxis:{categories:[this.translate.instant("Sent"),this.translate.instant("Delivered"),this.translate.instant("Read"),this.translate.instant("Engaged")]},dataLabels:{enabled:true},legend:{show:false},grid:{borderColor:"#e0e0e0",strokeDashArray:3},tooltip:{theme:"dark"}};}buildFailureChart(){let t=this.stats?.failureReasons??[];if(t.length===0){this.failureChart=null;return}let c=t.map(S=>S.reason&&S.reason.trim()!==""?S.reason:this.translate.instant("Not Sent")),m=t.map(S=>S.count),x=Math.max(200,t.length*40);this.failureChart={series:[{name:this.translate.instant("Count"),data:m}],chart:{type:"bar",height:x,fontFamily:"'Cairo', sans-serif",foreColor:"#adb
10bb",toolbar:{show:false}},plotOptions:{bar:{horizontal:true,barHeight:"60%",borderRadius:4,distributed:true}},colors:["#FA896B","#FFAE1F","#5D87FF","#49BEFF","#39B69A","#8B5CF6","#EC4899","#F97316","#06B6D4","#84CC16"],xaxis:{categories:c,title:{text:this.translate.instant("Count")}},yaxis:{labels:{maxWidth:280,style:{fontSize:"12px"}}},dataLabels:{enabled:true,style:{fontSize:"12px"}},legend:{show:false},grid:{borderColor:"#e0e0e0",strokeDashArray:3},tooltip:{theme:"dark"}};}formatRate(t){return t?t.toFixed(1):"0.0"}get failureBanner(){return Ee$1(this.promotion,this.stats)}ngOnInit(){return L(this,null,function*(){this.activatedRoute.params.subscribe(t=>{this.id=t.id,this.clientId=t.clientId,this.getPromotionInfo(0,10),this.searchChildrenPromotions(0,10);});})}ngOnDestroy(){this.sub&&this.sub.unsubscribe();}getStatusTxt(t){switch(t){case 0:return "New";case 1:return "On Progress";case 2:return "Completed";case 3:return "Failed";case 4:return "PausedDailyLimit";default:return ""}}getRepeatTypeText(t){switch(t){case h.Daily:return "Daily";case h.Weekly:return "Weekly";case h.Monthly:return "Monthly";default:return "None"}}searchChildrenPromotions(t=0,c=10){this.clientId&&(this.loadingService.loadingOn(),this.sub=this.promotionAdminService.searchPromotions(this.clientId,t,c,this.id).subscribe({next:m=>{this.loadingService.loadingOff(),this.childrenPromotions=m.data,this.totalChildren=m.count||0;},error:m=>this.errorService.setError(m,"Error while getting the data")}));}onChildrenPageChange(t){this.searchChildrenPromotions(t.pageIndex,t.pageSize);}showPromoDates(t){this.dialog.open(pt,E(D({},this.dialogConfigService.getDefaultDialogConfig()),{width:"600px",data:{promotion:t}}));}goBack(){this.navigationHistory.back(["/admin/promotions/api-promotions"]);}static{this.\u0275fac=function(c){return new(c||e)(V(l),V(Gt),V(V$1),V(O),V(ut),V(P),V(f))};}static{this.\u0275cmp=Xb({type:e,selectors:[["promotion-details"]],viewQuery:function(c,m){if(c&1&&by(be,5),c&2){let x;m_(x=y_())&&(m.chart=x.first);}},inputs:{clientId:"clientId"},ngContentSelectors:ye,decls:19,vars:9,consts:[["helpKey","admin-client-promotion-details","intro","One client's campaign in full: the delivery funnel, the rates, and the reason behind every failed message.",3,"steps"],[1,"cardWithShadow"],[1,"p-24"],[1,"row","justify-content-between"],[1,"col-lg-6","align-items-center"],[1,"col-lg-6","d-flex","align-items-center","justify-content-end"],["permission","Manage_Promotions","label","Back","color","primary","className","m-r-10","icon","arrow_back"],[1,"p-0"],["mat-stretch-tabs","false","animationDuration","0ms"],["mat-tab-label",""],["matTabContent",""],["permission","Manage_Promotions","label","Back","color","primary","className","m-r-10","icon","arrow_back",3,"clickAction"],[1,"p-16","rounded",3,"ngClass"],[1,"d-flex","align-items-start"],[1,"m-r-12",3,"ngClass"],[1,"m-0","f-w-600",3,"ngClass"],[1,"f-s-14","d-block","m-t-4"],[1,"m-l-8","text-muted"],[1,"text-muted"],[1,"d-flex","align-items-center"],[1,"p-y-24","b-t-1"],[1,"cardWithShadow","theme-card"],[1,"row"],[1,"col-sm-6","col-lg-4"],[1,"shadow-none"],[1,"p-30","bg-light-primary","text-center","rounded"],[1,"f-s-24","text-primary","m-0","m-b-4"],[1,"text-primary","f-w-600","m-0","f-s-16"],[1,"p-30","bg-light-success","text-center","rounded"],[1,"f-s-24","text-success","m-0","m-b-4"],[1,"text-success","f-w-600","m-0","f-s-16"],[1,"p-30","bg-light-error","text-center","rounded"],[1,"f-s-24","text-error","m-0","m-b-4"],[1,"text-error","f-w-600","m-0","f-s-16"],[1,"b-t-1"],[3,"series","chart","dataLabels","plotOptions","legend","colors","tooltip"],[1,"p-30","bg-light-accent","text-center","rounded"],[1,"f-s-24","text-accent","m-0","m-b-4"],[1,"text-accent","f-w-600","m-0","f-s-16"],[1,"p-30","bg-light-warning","text-center","rounded"],[1,"f-s-24","text-warning","m-0","m-b-4"],[1,"text-warning","f-w-600","m-0","f-s-16"],[1,"section-title"],[3,"series","chart","plotOptions","xaxis","colors","dataLabels","legend","grid","tooltip"],[3,"series","chart","plotOptions","xaxis","yaxis","colors","dataLabels","legend","grid","tooltip"],[1,"row","m-t-24"],[1,"col-sm-6"],[1,"p-y-24"],[1,"mat-body-1","p-t-10"],[1,"icon-18"],["t
1itle","Created",3,"name","datetime","day"],["title","Start Sending On",3,"datetime","day"],["title","First Message Sent On",3,"datetime","day"],["title","Last Message Sent On",3,"datetime","day"],["title","Finish Sending On",3,"datetime","day"],[3,"promotionId","clientId","campaignName"],[3,"page","length","pageSizeOptions"],[3,"valueChange","selectionChange","value"],[3,"value"],[3,"dataSource","columns"],["rtColumnDef","phoneNumber"],["rtColumnDef","customerName"],["rtColumnDef","sent"],["rtColumnDef","sentOn"],["rtColumnDef","delivered"],["rtColumnDef","read"],["rtColumnDef","failed"],["rtColumnDef","failedReason"],[3,"isActive"],[3,"isActive","showInactive"],[1,"m-r-8",2,"color","red"],[1,"m-r-8"],["rtColumnDef","businessName"],["rtColumnDef","promoDate"],["rtColumnDef","name"],["rtColumnDef","status"],["rtColumnDef","total"],["rtColumnDef","success"],["rtColumnDef","actions"],[1,"icon-18",3,"click"],["color","primary","mat-flat-button","",3,"routerLink"]],template:function(c,m){c&1&&(p_(),fy(0,"app-page-help",0),Js(1,"mat-card",1)(2,"mat-card-content",2)(3,"div",3)(4,"div",4),ZT(5,Te,3,4,"span"),gd(),Js(6,"div",5),ZT(7,Me,1,0,"app-permission-button",6),gd()()()(),ZT(8,Ne,15,7,"mat-card",1),Js(9,"mat-card",1)(10,"mat-card-content",7)(11,"mat-tab-group",8),ZT(12,He,3,0,"mat-tab"),Js(13,"mat-tab"),ey(14,We,5,3,"ng-template",9)(15,Ye,1,1,"ng-template",10),gd(),ZT(16,ei,3,0,"mat-tab"),ZT(17,gi,3,0,"mat-tab"),ZT(18,Ri,3,0,"mat-tab"),gd()()()),c&2&&(dy("steps",nS(8,Pe)),SC(5),YT(m.promotion?5:-1),SC(2),YT(m.promotion?7:-1),SC(),YT(m.failureBanner?8:-1),SC(4),YT(m.promotion&&!m.promotion.repeatType?12:-1),SC(4),YT(m.promotion&&!m.promotion.repeatType&&m.clientId?16:-1),SC(),YT(m.promotion&&!m.promotion.repeatType?17:-1),SC(),YT(m.promotion&&m.promotion.repeatType?18:-1));},dependencies:[ce,Tt,Xv,RM,zg,ai$1,Q,X,pe,Pe$1,Bt,S,En,De$1,f$1,he$1,zn,Ng,w0,ei$1,H0,Zx,dn,da,xr,zw,sk,nd,id,rC,wC,mv,GC,tD,vD,cD,hD,_D,pD,mD,al,tM,dM,Lb,r1,P1,z_,j_,G_,O1,xS,Vs,zs,GS,iI,RI,us,ms,UI,tE,Dn,ME,ny,go,Kd,XE,LT,mA,mt,WM,o],styles:["textarea[_ngcontent-%COMP%]{resize:none} mat-icon{display:inline-flex!important;align-items:center!important;justify-content:center!important;overflow:visible!important} mat-icon.icon-18{font-size:var(--font-size-lg)!important;line-height:18px!important;width:20px!important;height:20px!important;min-width:20px!important;min-height:20px!important;padding:2px!important;box-sizing:content-box!important} mat-icon.icon-20{font-size:var(--font-size-xl)!important;line-height:20px!important;width:20px!important;height:20px!important;min-width:20px!important;min-height:20px!important} mat-icon.icon-60{font-size:60px!important;line-height:60px!important;width:60px!important;height:60px!important;min-width:60px!important;min-height:60px!important} td mat-icon{overflow:visible!important;flex-shrink:0!important}"],changeDetection:1});}}return e})();export{no as AdminPromotionDetailsComponent};
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.