1import{a as he,b as fe,c as _e}from"./chunk-M4TLMCEW.js";import{a as D}from"./chunk-YD4VDQMJ.js";import"./chunk-QJBD4VRJ.js";import"./chunk-W6FYOFIK.js";import"./chunk-QMNK3GO2.js";import"./chunk-DSDDXUEL.js";import"./chunk-W3HULUU6.js";import"./chunk-WY3PYQ3K.js";import{b as ue}from"./chunk-6JR2UR3Y.js";import{a as me}from"./chunk-NREWKZHS.js";import{a as de}from"./chunk-Z2HMW2IQ.js";import"./chunk-4MPIUD7L.js";import"./chunk-OMAR6RBO.js";import{b as pe}from"./chunk-JBGTHU2Q.js";import"./chunk-X6WED2AZ.js";import"./chunk-FPCIQYGC.js";import"./chunk-FHCTE6FP.js";import"./chunk-E34OQ4RJ.js";import"./chunk-H4EPMV5Z.js";import"./chunk-JN6AA4VD.js";import{a as W}from"./chunk-ZSHO3KMD.js";import"./chunk-QVGEDMLN.js";import"./chunk-UZY2R5Q5.js";import{a as be}from"./chunk-5GAGQHFR.js";import"./chunk-RYT6C367.js";import"./chunk-SNZM6YGS.js";import"./chunk-3PGMBZAP.js";import"./chunk-FQFO62CD.js";import"./chunk-VT7CJSCD.js";import{a as ce}from"./chunk-PNYSZFNB.js";import{A as Z,G as ee,M as te,N as ie,O as ne,P as oe,R as ae,U as re,V as se,i as U,k as G,m as Q,t as X,w as J,wa as le}from"./chunk-Y3MTRBLK.js";import"./chunk-XMBPLYUK.js";import"./chunk-QRMJLQVM.js";import"./chunk-24HYNKH3.js";import"./chunk-65I45D2I.js";import"./chunk-GZL4NBTB.js";import"./chunk-OMIAKVTT.js";import"./chunk-3XCK7DOC.js";import"./chunk-PJWNDC7A.js";import"./chunk-QDFFLVTB.js";import"./chunk-JIVZONLP.js";import"./chunk-S43ITSQ5.js";import{e as Y,h as $,i as K,k as V}from"./chunk-5FWAKVG3.js";import{z as H}from"./chunk-KAXBUATZ.js";import{$c as L,Cc as u,Dc as a,Dd as j,Ec as r,Fa as b,Fc as v,Jb as p,Jd as E,Kd as N,Ma as I,Oc as w,Sa as h,Ta as f,Vc as m,Wb as g,Xc as d,ad as O,bc as P,bd as z,cc as T,gc as R,jd as l,kd as S,ld as B,rd as A,sd as F,td as q,vc as C,xc as y}from"./chunk-XW6AEKHB.js";import{a as M,i as xe,l as _}from"./chunk-6G35VSEK.js";var x=xe(be());var Te=n=>[n];function Ee(n,c){if(n&1){let e=w();a(0,"cnp-callout",12),l(1),a(2,"cnp-button",26),m("click",function(){h(e);let t=d();return f(t.retry())}),l(3,"Retry"),r()()}if(n&2){let e=d();u("heading",e.staleHeading),p(),B(" ",e.staleDescription," ")}}function Ne(n,c){if(n&1){let e=w();a(0,"cnp-button",27),m("click",function(){h(e);let t=d();return f(t.retry())}),l(1,"Retry"),r()}}function ke(n,c){if(n&1){let e=w();a(0,"cnp-button",27),m("click",function(){h(e);let t=d();return f(t.clearSearch())}),l(1,"Clear search"),r()}}function Ve(n,c){if(n&1){let e=w();a(0,"cnp-button",28),m("click",function(){h(e);let t=d();return f(t.create())}),v(1,"cnp-icon",3),l(2," Create "),r()}}function De(n,c){if(n&1&&(a(0,"a",29),l(1),r()),n&2){let e=c.$implicit,i=c.value;u("routerLink",j(3,Te,e.PK))("title",e.message),p(),S(i)}}function Me(n,c){if(n&1&&(a(0,"cnp-status-pill",30),l(1),r()),n&2){let e=c.$implicit,i=d().statusPill(e);u("tone",i.tone)("icon",i.icon),p(),S(i.label)}}function Ie(n,c){if(n&1&&(a(0,"span",31),l(1),E(2,"dateFormat"),r()),n&2){let e=d().$implicit;p(),S(N(2,1,e.dateCreated))}}function Pe(n,c){n&1&&(a(0,"span",32),l(1,"\u2014"),r(),a(2,"span",33),l(3,"Empty"),r())}function Re(n,c){if(n&1&&C(0,Ie,3,3,"span",31)(1,Pe,4,0),n&2){let e=c.$implicit;y(e.dateCreated?0:1)}}function Le(n,c){if(n&1&&(a(0,"span",31),l(1),E(2,"dateFormat"),r()),n&2){let e=d().$implicit;p(),S(N(2,1,e.sendTime))}}function Oe(n,c){n&1&&(a(0,"span",32),l(1,"\u2014"),r(),a(2,"span",33),l(3,"Empty"),r())}function ze(n,c){if(n&1&&C(0,Le,3,3,"span",31)(1,Oe,4,0),n&2){let e=c.$implicit;y(e.sendTime?0:1)}}function Be(n,c){if(n&1&&(a(0,"span",31),l(1),E(2,"dateFormat"),r()),n&2){let e=d().$implicit;p(),S(N(2,1,e.lastUpdate))}}function Ae(n,c){n&1&&(a(0,"span",32),l(1,"\u2014"),r(),a(2,"span",33),l(3,"Empty"),r())}function Fe(n,c){if(n&1&&C(0,Be,3,3,"span",31)(1,Ae,4,0),n&2){let e=c.$implicit;y(e.status==="sent"&&e.lastUpdate?0:1)}}function qe(n,c){if(n&1){let e=w();a(0,"app-import-body",34),m("done",function(t){h(e);let o=d();return f(o.onImportDone(t))}),r()}if(n&2){let e=d();u("headerData",e.importHeaders)}}function je(n,c){if(n&1){let e=w();a(0,"cnp-dropdown",35),m("select",function(t){h(e);let o=d();return f(o.importBody==null?null:o.importBody.downloadTemplate(t))}),l(1," Download template "),r(),a(2,"cnp-button",36),m("click",function(){h(e);let t=d();return f(t.importOpen=!1)}),l(3,"Close"),r(),a(4,"cnp-button",37),m("click",function(){h(e);let t=d();return f(t.importBody==null?null:t.importBody.upload())}),l(5," Preview "),r()}if(n&2){let e=d();u("items",e.importFormatItems),p(4),u("disabled",(e.importBody==null?null:e.importBody.isLoading)??!1)("loading",(e.importBody==null?null:e.importBody.isLoading)??!1)}}function He(n,c){if(n&1){let e=w();a(0,"cnp-checkbox",38),m("changed",function(t){h(e);let o=d();return f(o.importBody==null?null:o.importBody.toggleOverwrite(t))}),r(),a(1,"cnp-button",36),m("click",function(){h(e);let t=d();return f(t.importOpen=!1)}),l(2,"Close"),r()}if(n&2){let e=d();u("checked",(e.importBody==null?null:e.importBody.updateExisting)??!1)}}var k=(()=>{class n{constructor(e,i,t,o,s,we,Se){this.notificationService=e,this.eventService=i,this.router=t,this.route=o,this.csvDownloadService=s,this.auditTrailService=we,this.toastService=Se,this.columns=[{key:"message",header:"Message",sortable:!0,truncate:!0,width:"34%"},{key:"status",header:"Status",sortable:!0,width:"12%"},{key:"dateCreated",header:"Created",sortable:!0,width:"18%"},{key:"sendTime",header:"Scheduled",sortable:!0,width:"18%"},{key:"lastUpdate",header:"Sent",sortable:!0,width:"18%"}],this.isLoading=!0,this.loadError=!1,this.staleData=!1,this.notifications=[],this.isLocalhost=!0,this.importOpen=!1,this.importFormatItems=[{id:"csv",label:"CSV"},{id:"xlsx",label:"XLSX"}],this.isExporting=!1,this.reloadGeneration=0,this.search="",this.sort={key:"dateCreated",direction:"desc"},this.page=1,this.pageSize=50,this.pageSizeOptions=[25,50,100],this.matched=[],this.rows=[],this.exportColumns=["Me
1ssage","Channels","Send_type","Send_datetime","Minutes_before_session","Session","Audience","Recipient_emails","Redirect_label","Redirect_url"],this.importHeaders=[{name:"Message",format:"Text",required:"Required",description:"The notification text shown to recipients."},{name:"Channels",format:"List (semicolon)",required:"Required",description:"How it is delivered: one or more of push, email or in-app, separated by semicolons. e.g. push;email;in-app"},{name:"Send_type",format:"datetime | minutes-before-session | on-check-in",required:"Optional",description:"When to send. Leave blank to create an unscheduled draft you send manually later."},{name:"Send_datetime",format:"YYYY-MM-DD HH:mm:ss",required:"Conditional",description:"Date and time to send, in the event's timezone and in the future. Used only when Send_type is datetime. e.g. 2026-08-15 10:30:00"},{name:"Minutes_before_session",format:"Number",required:"Conditional",description:"Minutes before the session starts to send. Used when Send_type is minutes-before-session; also fill in Session. e.g. 15"},{name:"Session",format:"Session ID",required:"Conditional",description:"The session ID (e.g. session-1740045\u2026). Required when Audience is session or Send_type is minutes-before-session. Tip: export your notifications to see the exact ID."},{name:"Audience",format:"all | session | emails",required:"Required",description:"Who receives it: all (everyone), session (attendees of the Session column), or emails (the addresses in Recipient_emails)."},{name:"Recipient_emails",format:"List (semicolon)",required:"Conditional",description:"Recipient email addresses, separated by semicolons. Required when Audience is emails. Each must already be an attendee in this event. e.g. [email protected];[email protected]"},{name:"Redirect_label",format:"Text",required:"Optional",description:"Label for the tap-through link (shown on pop-up and banner notifications). e.g. View agenda"},{name:"Redirect_url",format:"In-app path",required:"Optional",description:"The in-app path opened when the notification is tapped. Must start with /. e.g. /agenda"}],this.byId=ve=>String(ve.PK??""),this.errorHeading="We couldn\u2019t load your notifications",this.errorDescription="Please try again in a moment.",this.staleHeading="Showing a saved copy",this.staleDescription="We couldn\u2019t refresh the list. Retry to load the latest notifications.",this.emailAudienceTargets=["fixed","type","country","custom"]}get resultCount(){let e=this.matched.length;return`${e} ${e===1?"notification":"notifications"}`}get announcement(){if(this.isLoading)return"";let e=this.sort;if(!e)return this.resultCount;let i=this.columns.find(o=>o.key===e.key)?.header??e.key,t=e.direction==="asc"?"ascending":"descending";return`${this.resultCount}, sorted by ${i}, ${t}`}get hasSearch(){return this.search.trim().length>0}get emptyIcon(){return this.loadError?"error":this.hasSearch?"no-results":"inbox"}get emptyHeading(){return this.loadError?this.errorHeading:this.hasSearch?"No notifications match your search":"No notifications yet"}get emptyDescription(){return this.loadError?this.errorDescription:this.hasSearch?"Try a different term, or clear the search to see every notification.":"Notifications you create will appear here."}ngOnInit(){this.load()}ngOnDestroy(){this.notificationSubscription?.unsubscribe(),this.notificationLoadInterval&&(clearInterval(this.notificationLoadInterval),this.notificationLoadInterval=null)}load(){return _(this,null,function*(){this.notificationSubscription=this.notificationService.onChanged(e=>{e?.length&&(e.map(i=>_(this,null,function*(){return i.sendTimeRaw=i.sendTime,i?.session&&i?.sessionData?.PK?i.sendTime=x.default.utc(x.default.tz(i.sessionData.startTime,"YYYY-MM-DD hh:mm:ss",this.eventService.data.timezone).subtract(i.minOffset,"m")).format():i.sendTime&&(i.sendTime=x.default.utc(x.default.tz(i.sendTime,"YYYY-MM-DD hh:mm:ss",this.eventService.data.timezone)).format()),i})),this.notifications=e,this.refreshView()),this.loadError=!1,this.isLoading=!1}),yield this.reloadNotifications(),this.notificationLoadInterval=setInterval(()=>this.reloadNotifications(),6e4)})}reloadNotifications(){return _(this,null,function*(){let e=++this.reloadGeneration,i;try{i=yield this.notificationService.loadWithOutcome(!0)}catch{i={data:null,httpFailed:!0,fromCache:!1}}if(e!==this.reloadGeneration)return;this.isLoading=!1;let t=this.loadError||this.staleData,o=(i.data?.length??0)>0;this.loadError=!o&&i.httpFailed,this.staleData=o&&i.httpFailed,(this.loadError||this.staleData)&&!t&&this.toastService.showDanger("Couldn\u2019t refresh notifications","Please try again in a moment.")})}retry(){return _(this,null,function*(){this.isLoading=!0,this.loadError=!1,this.staleData=!1,yield this.reloadNotifications()})}create(){this.router.navigate(["new"],{relativeTo:this.route})}import(){this.importOpen=!0}onImportDone(e){return _(this,null,function*(){this.importOpen=!1,e&&(yield this.retry())})}export(){return _(this,null,function*(){this.isExporting=!0;try{let e=this.notifications.map(i=>this.buildExportRow(i));yield this.csvDownloadService.fromJsonList("notifications",e,this.exportColumns),yield this.auditTrailService.create(this.auditTrailService.ActionEnum.Export)}finally{this.isExporting=!1}})}buildExportRow(e){let i=[];e.sendPushNotif&&i.push("push"),e.sendEmail&&i.push("email"),e.showAsToast&&i.push("in-app");let t=this.deriveExportTiming(e),o=this.deriveExportAudience(e);return{Message:e.message||"",Channels:i.join(";"),Send_type:t.sendType,Send_datetime:t.sendDatetime,Minutes_before_session:t.minutesBefore,Session:t.session||o.session,Audience:o.audience,Recipient_emails:o.recipientEmails,Redirect_label:e.redirectLabel||"",Redirect_url:e.url||""}}deriveExportTiming(e){return e.checkinNotif?{sendType:"on-check-in",sendDatetime:"",minutesBefore:"",session:""}:e.session?{sendType:"minutes-before-session",sendDatetime:"",minutesBefore:e.minOffset!=null?String(e.minOffset):"",session:e.session}:e.sendTimeRaw?{sendType:"datetime",sendDatetime:e.sendTimeRaw,minutesBefore:"",session:""}:{sendType:"",sendDatetime:"",minutesBefore:"",session:""}}deriveExportAudience(e){let i=e.target==="session"&&Array.isArray(e.recipientEmails);return this.emailAudienceTargets.includes(e.target)||i?{audience:"emails",recipientEmails:(e.recipientEmails||[]).join(";"),session:""}:e.target==="session"?{audience:"session",recipientEmails:"",session:Array.isArray(e.targetValue)&&e.targetValue[0]?.PK||""}:e.target==="all"||e.sendToAll?{audience:"all",recipientEmails:"",session:""}:{audience:"",recipientEmails:"",session:""}}statusPill(e){let i=he(e);return M({label:i},fe(i))}onSearchChange(e){this.search=e,this.page=1,this.refreshView()}clearSearch(){this.search="",this.page=1,this.refreshView()}onSortChange(e){this.sort=e,this.refreshView()}onPageChange(e){this.page=e,this.refreshView()}onPageSizeChange(e){this.pageSize=e,this.page=1,this.refreshView()}refresh(){return _(this,null,function*(){this.isLoading=!0,yield this.reloadNotifications()})}view(e){this.router.navigate(["view",e])}refreshView(){this.matched=this.sortRows(this.filterRows(this.notifications));let e=Math.max(1,Math.ceil(this.matched.length/this.pageSize));this.page>e&&(this.page=e);let i=(this.page-1)*this.pageSize;this.rows=this.matched.slice(i,i+this.pageSize)}filterRows(e){let i=this.search.trim().toLowerCase();return i?e.filter(t=>this.matchesSearch(t,i)):[...e]}matchesSearch(e,i){return Object.values(e).some(t=>!!t&&String(t).toLowerCase().trim().includes(i))}sortRows(e){let i=this.sort;if(!i?.key||!i.direction)return e;let t=i.direction==="asc"?1:-1;return[...e].sort((o,s)=>this.compare(o,s,i.key)*t)}compare(e,i,t){let o=this.sortValue(e,t),s=this.sortValue(i,t);return typeof o!=typeof s&&(typeof o=="number"&&(o=String(o)),typeof s=="number"&&(s=String(s))),o==null?s==null?0:-1:s==null?1:typeof o=="number"&&typeof s=="number"?this.rank(o,s):this.rank(String(o),String(s))}rank(e,i){return e>i?1:e<i?-1:0}sortValue(e,i){let t=e[i];if(typeof t=="number")return t;if(typeof t=="string"){let o=Number(t);return!isNaN(parseFloat(t))&&!isNaN(o)&&o<Number.MAX_SAFE_INTEGER?o:t}return t==null?null:String(t)}static{this.\u0275fac=function(i){return new(i||n)(g(_e),g(W),g($),g(Y),g(de),g(me),g(ce))}}static{this.\u0275cmp=P({type:n,selectors:[["ng-component"]],viewQuery:function(i,t){if(i&1&&L(D,5),i&2){let o;
1O(o=z())&&(t.importBody=o.first)}},decls:33,vars:25,consts:[[1,"notifications-page"],["heading","Notifications","description","Notify attendees via in-app pop-ups, push notifications and email."],["variant","primary",3,"click"],["name","create"],["variant","secondary",3,"click","disabled"],["name","import"],["variant","secondary",3,"click","loading","disabled"],["name","export"],[1,"list-card"],["ariaLabel","Notification list controls",3,"count"],["label","Search notifications","placeholder","Search\u2026",1,"search",3,"valueChange","value"],["role","status","cnpVisuallyHidden",""],["tone","warning","live","status",1,"load-error",3,"heading"],["ariaLabel","Notifications",3,"sortChange","columns","rows","rowKey","loading","sort"],["cnpTableEmpty","",3,"icon","heading","description","headingLevel"],["cnpEmptyStatePrimary","","variant","secondary","size","sm"],["cnpEmptyStatePrimary","","size","sm"],["cnpCell","message"],["cnpCell","status"],["cnpCell","dateCreated"],["cnpCell","sendTime"],["cnpCell","lastUpdate"],["noun","notifications",3,"pageChange","pageSizeChange","total","page","pageSize","pageSizeOptions"],["heading","Import notifications","size","lg",3,"openChange","dismissible","open"],["module","notifications","moduleLabel","notification",3,"headerData"],["cnpModalFooter","",1,"import-actions"],["cnpCalloutAction","","variant","secondary","size","sm",3,"click"],["cnpEmptyStatePrimary","","variant","secondary","size","sm",3,"click"],["cnpEmptyStatePrimary","","size","sm",3,"click"],[1,"cell-message",3,"routerLink","title"],[3,"tone","icon"],[1,"cell-date"],["aria-hidden","true",1,"cell-empty"],["cnpVisuallyHidden",""],["module","notifications","moduleLabel","notification",3,"done","headerData"],[3,"select","items"],["variant","secondary",3,"click"],[3,"click","disabled","loading"],["label","Overwrite existing",3,"changed","checked"]],template:function(i,t){i&1&&(a(0,"div",0)(1,"cnp-page-header",1)(2,"cnp-button",2),m("click",function(){return t.create()}),v(3,"cnp-icon",3),l(4," Create "),r(),a(5,"cnp-button",4),m("click",function(){return t.import()}),v(6,"cnp-icon",5),l(7," Import "),r(),a(8,"cnp-button",6),m("click",function(){return t.export()}),v(9,"cnp-icon",7),l(10," Export "),r()(),a(11,"div",8)(12,"cnp-toolbar",9)(13,"cnp-search-field",10),m("valueChange",function(s){return t.onSearchChange(s)}),r()(),a(14,"span",11),l(15),r(),C(16,Ee,4,2,"cnp-callout",12),a(17,"cnp-table",13),m("sortChange",function(s){return t.onSortChange(s)}),a(18,"cnp-empty-state",14),C(19,Ne,2,0,"cnp-button",15)(20,ke,2,0,"cnp-button",15)(21,Ve,3,0,"cnp-button",16),r(),R(22,De,2,5,"ng-template",17)(23,Me,2,3,"ng-template",18)(24,Re,2,1,"ng-template",19)(25,ze,2,1,"ng-template",20)(26,Fe,2,1,"ng-template",21),r(),a(27,"cnp-paginator",22),m("pageChange",function(s){return t.onPageChange(s)})("pageSizeChange",function(s){return t.onPageSizeChange(s)}),r()(),a(28,"cnp-modal",23),q("openChange",function(s){return F(t.importOpen,s)||(t.importOpen=s),s}),C(29,qe,1,1,"app-import-body",24),a(30,"div",25),C(31,je,6,3)(32,He,3,1),r()()()),i&2&&(p(5),u("disabled",t.importOpen),p(3),u("loading",t.isExporting)("disabled",t.isExporting||!t.notifications.length),p(4),u("count",t.resultCount),p(),u("value",t.search),p(2),S(t.announcement),p(),y(!t.isLoading&&t.staleData?16:-1),p(),u("columns",t.columns)("rows",t.rows)("rowKey",t.byId)("loading",t.isLoading)("sort",t.sort),p(),u("icon",t.emptyIcon)("heading",t.emptyHeading)("description",t.emptyDescription)("headingLevel",2),p(),y(t.loadError?19:t.hasSearch?20:21),p(8),u("total",t.matched.length)("page",t.page)("pageSize",t.pageSize)("pageSizeOptions",t.pageSizeOptions),p(),u("dismissible",!1),A("open",t.importOpen),p(),y(t.importOpen?29:-1),p(2),y(((t.importBody==null?null:t.importBody.viewStatus)??"select")==="select"?31:32))},dependencies:[G,le,ne,te,J,se,U,re,Z,ae,X,Q,oe,ee,ie,K,D,pe],styles:["[_nghost-%COMP%]{display:block;padding:var(--cnp-space-page-gutter-y) var(--cnp-space-page-gutter-x)}.notifications-page[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--cnp-space-card-gap)}.list-card[_ngcontent-%COMP%]{background:var(--cnp-color-bg-card);border-radius:var(--cnp-radius-container);box-shadow:var(--cnp-shadow-low);overflow:hidden}.search[_ngcontent-%COMP%]{--cnp-search-field-width: 220px;min-width:0}.load-error[_ngcontent-%COMP%]{margin:0 var(--cnp-space-card-padding) var(--cnp-space-4)}.cell-message[_ngcontent-%COMP%]{display:block;max-width:640px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.cell-date[_ngcontent-%COMP%]{white-space:nowrap}.cell-empty[_ngcontent-%COMP%]{color:var(--cnp-color-text-muted)}.import-actions[_ngcontent-%COMP%]{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;
1gap:var(--cnp-space-3);width:100%}"]})}}return n})();var Ce=[I(ue)],Ye=[{path:"",component:k},{path:"new",loadComponent:()=>import("./chunk-S2RFFXAR.js").then(n=>n.NotificationComposerComponent),providers:Ce},{path:":id/update",loadComponent:()=>import("./chunk-S2RFFXAR.js").then(n=>n.NotificationComposerComponent),providers:Ce},{path:":id",loadChildren:()=>import("./chunk-WJBXQTN3.js").then(n=>n.ViewModule)}],ye=(()=>{class n{static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275mod=T({type:n})}static{this.\u0275inj=b({imports:[V.forChild(Ye),V]})}}return n})();var ut=(()=>{class n{static{this.\u0275fac=function(i){return new(i||n)}}static{this.\u0275mod=T({type:n})}static{this.\u0275inj=b({imports:[H,ye,k]})}}return n})();export{ut as NotificationModule};
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.