1import{c as O}from"./chunk-5RP73VZ5.js";import{a as N}from"./chunk-4OPVZPNY.js";import"./chunk-SNLQ4K5G.js";import{c as W}from"./chunk-KRJYA5WV.js";import"./chunk-JLZLBKFQ.js";import"./chunk-4HM7XAEG.js";import"./chunk-QZMZXZ4U.js";import"./chunk-7GQHGAWA.js";import"./chunk-OKC6FPX2.js";import"./chunk-H6RLFBCZ.js";import{b as H}from"./chunk-B3Q5O2RI.js";import"./chunk-PXHAXO7Z.js";import{a as z}from"./chunk-S62TCMIB.js";import{a as L}from"./chunk-G3WRLDOB.js";import{a as X}from"./chunk-LEOK3TBM.js";import{a as R}from"./chunk-N2MVBGGZ.js";import"./chunk-V3EKAILP.js";import"./chunk-OS3CABJ4.js";import{c as D}from"./chunk-Y2QBTOIT.js";import"./chunk-WDX5GBAZ.js";import"./chunk-R3ABRJGS.js";import"./chunk-26QG2NYG.js";import"./chunk-IT7TKBQK.js";import{a as Y,b as q}from"./chunk-54JU5EOI.js";import{a as j}from"./chunk-CIG6VMOU.js";import{a as ee}from"./chunk-SDDMIKZ6.js";import{e as $,q as J}from"./chunk-ZIEJAFXK.js";import{a as F}from"./chunk-CGXOZM2U.js";import"./chunk-UFP4MN6V.js";import{a as V}from"./chunk-NJ4UKWCM.js";import"./chunk-SHNDZLFX.js";import"./chunk-WPILDL5A.js";import{l as I}from"./chunk-QOPGEPEN.js";import{U as S,t as B}from"./chunk-4FDDMESX.js";import{Bb as f,Ec as E,Fa as d,Fc as a,Ga as u,Hb as T,N as w,Qb as k,Rb as b,Sc as A,Wb as h,gc as l,na as p,oc as m,sa as M,tc as C,uc as g,vc as r,zc as P}from"./chunk-FGMC3YKI.js";import{h as Z}from"./chunk-TWZW5B45.js";var K=Z(ee());function te(t,i){t&1&&r(0,"five-cents-skeleton-summary-header")}function ie(t,i){if(t&1&&r(0,"fivecents-home-black-banner",1),t&2){let e=a();l("bannerTitleInput",e.bannerTitle)("bannerSubtitleInput",e.bannerSubtitle)("inputTabs",e.bannerTabs)("showActionButtons",!1)("stackCards",!0)}}function ne(t,i){t&1&&r(0,"five-cents-skeleton-summary-table")}function oe(t,i){t&1&&r(0,"fivecents-sub-account-permissions")}function se(t,i){t&1&&r(0,"five-cents-skeleton-summary-table")}function ae(t,i){if(t&1){let e=P();C(0,"fivecents-table",3),E("searchTextValue",function(n){d(e);let s=a(3);return u(s.onSearchTextChange(n))})("buttonClickEvent",function(n){d(e);let s=a(3);return u(s.buttonClickEvent(n))}),g(),C(1,"fivecents-backend-pagination",4),E("startFrom",function(n){d(e);let s=a(3);return u(s.getStartFrom(n))}),g()}if(t&2){let e=a(3);l("title","Email History")("tableHeaderProps",e.tableHeaderProps),f(),l("totalNumberOfItems",e.totalNumberOfEmails)("itemsPerPage",e.itemPerpage)("Paginationloading",e.paginationLoading)}}function re(t,i){if(t&1&&h(0,se,1,0,"five-cents-skeleton-summary-table")(1,ae,2,5),t&2){let e=a(2);m(e.loading?0:1)}}function le(t,i){if(t&1&&h(0,oe,1,0,"fivecents-sub-account-permissions")(1,re,2,1),t&2){let e=a();m(e.hasEmailPermission?1:0)}}var _=class t{constructor(i){this.homeService=i;this.clientDetails$=this.store.select(D),this.store.select(H).subscribe(e=>{this.services=e}),this.clientDetails$.subscribe(e=>{e&&(this.clientId=e.id,this.activeServicesCount=e.stats?.productsnumactive??0)})}tableHeaderProps;totalNumberOfEmails;clientDetails$;breadcrumbsData=[{text:"My Emails",route:""}];store=M(I);isSunAccountDetails=this.store.select(j);itemPerpage=10;loading=!0;initialLoad=!0;paginationLoading=!1;clientId;emailList=[];hasEmailPermission=!1;showPermissionChecked=!1;activeServicesCount=0;services=[];bannerTitle="Email History";bannerSubtitle="Track stream alerts, session notices and billing emails";get bannerTabs(){return[{title:"Active Services",greenPoint:!0,mainValue:"out of "+this.services.length,secondaryValue:String(this.activeServicesCount),secondaryValueText:"active"},{title:"Email Sent",secondaryValue:String(this.totalNumberOfEmails||0),secondaryValueText:"sent"}]}ngOnInit(){this.isSunAccountDetails.pipe(w(1)).subscribe(i=>{if(i){let o=i?.contacts?.contact?.[0]?.permissions??[],n=Array.isArray(o)?o:o.split(",");this.hasEmailPermission=n.includes("emails")}else{let e=localStorage.getItem("isSubContact")==="true",o=localStorage.getItem("contactResponse");if(e&&o)try{let c=JSON.parse(o)?.contacts.contact?.[0]?.permissions??[],v=Array.isArray(c)?c:c.split(",");this.hasEmailPermission=v.includes("emails")}catch(n){console.error("Invalid contactResponse from localStorage",n),this.hasEmailPermission=!1}else this.hasEmailPermission=!0}this.hasEmailPermission&&(this.hasEmailPermission=!0,this.getClientEmails()),this.showPermissionChecked=!0})}getStartFrom(i){this.getClientEmails(i*this.itemPerpage,!1)}getClientEmails(i=0,e=!0){this.initialLoad&&(this.loading=!0),this.paginationLoading=!0;let o={clientid:this.clientId,limitstart:i,limitnum:this.itemPerpage};this.homeService.getClientEmails(o).subscribe(n=>{this.loading=!1,this.initialLoad=!1,this.paginationLoading=!1,this.emailList=n.emails.email,n.emails&&n.emails.email&&(this.totalNumberOfEmails=n.totalresults,this.tableHeaderProps={globalColor:"#B2B6C6",tableHeight:"100%",searchBox:!0,stickyHeader:!0,headers:{color:"#B2B6C6",headers:[{text:"Date Sent",width:30,textAlign:"center"},{text:"Message Subject",width:35,textAlign:"center"},{text:"Actions",width:35,textAlign:"center"}]},body:n.emails.email.map(s=>({color:"#000",body:[{text:this.formatDate(s.date),type:"text",width:30,textAlign:"center"},{text:s.subject,type:"text",width:35,textAlign:"center"},{text:"View Message",width:35,status:"buttonType",type:"button",statusColor:"#59A52C",statusTextColor:"#FFFFFF",textAlign:"center"}]}))})})}openMessage(i,e){let s=(window.screen.width-800)/2+window.screenX,v=`width=800,height=400,top=${(window.screen.height-400)/2+window.screenY},left=${s},location=no,menubar=no,status=no,toolbar=no`,x=window.open("","_blank",v);if(x){let U=` 2 <div style="background-color: #f2f2f2; padding: 20px; text-align: center;"> 3 <h1 style="margin: 0;">${i}</h1> 4 <p>${e}</p> 5 <button style="background-color: black; color: white; padding: 10px 20px; border: none; cursor: pointer; border-radius: 5px;" onclick="window.close()">Close</button> 6 </div> 7 `;x.document.write(U),x.document.close()}}formatDate(i){return(0,K.default)(i).format("dddd, MMMM Do, YYYY, (h:mm)")}onSearchTextChange(i){}buttonClickEvent(i){if(i.type==="Action"){let e=this.emailList[i.index];this.openMessage(e.subject,e.message)}}static \u0275fac=function(e){return new(e||t)(T(V))};static \u0275cmp=k({type:t,selectors:[["fivecents-my-emails"]],standalone:!1,decls:7,vars:3,consts:[[3,"breadcrumbs"],["type","my-services","backRoute","/home",3,"bannerTitleInput","bannerSubtitleInput","inputTabs","showActionButtons","stackCards"],[1,"d-none"],[3,"searchTextValue","buttonClickEvent","title","tableHeaderProps"],[3,"startFrom","totalNumberOfItems","itemsPerPage","Paginationloading"]],template:function(e,o){e&1&&(r(0,"fivecents-breadcrumbs",0),h(1,te,1,0,"five-cents-skeleton-summary-header")(2,ie,1,5,"fivecents-home-black-banner",1)(3,ne,1,0,"five-cents-skeleton-summary-table")(4,le,2,1),C(5,"div",2),A(6," version: v1.0.7 feat: enhance MyEmailsComponent to manage email permissions with fallbacks "),g()),e&2&&(l("breadcrumbs",o.breadcrumbsData),f(),m(o.showPermissionChecked?2:1),f(2),m(o.showPermissionChecked?4:3))},dependencies:[O,N,L,R,$,F,Y],encapsulation:2})};var me=[{path:"",component:_}],y=class t{static \u0275fac=function(e){return new(e||t)};static \u0275mod=b({type:t});static \u0275inj=p({imports:[S.forChild(me),S]})};var Q=class t{static \u0275fac=function(e){return new(e||t)};static \u0275mod=b({type:t});static \u0275inj=p({imports:[B,y,W,z,X,J,q]})};export{Q as MyEmailsModule};
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.