PageSourceSearch

https://www.metlink.org.nz/_resources/app/client/dist/assets/Alerts-DnHoOnM8.js

js metlink.org.nz collected 2026-10-01 10:42:44 UTC 8,103 bytes, 1 lines download raw bytes

1import{O as o,Q as a,a2 as i,a7 as T,a3 as C,X as M,Z as u,F as f,a6 as A,m as h,$ as _,a4 as m,af as U,S as w,q as b,a5 as k,B as I,D as B}from"./vendor-DKuO0rbx.js";import{_ as y,A as E,e as N,s as F,g as H,h as P}from"./main-28h1t_1Q.js";import{T as D}from"./Tabs-C_YXiXwB.js";import{S as L}from"./Switch-B7jeOVP2.js";import"./lodash-pUwldgrz.js";import"./timezone-support-C-mnkNYX.js";import"./vue-tools-BAyj-N1r.js";const O={name:"CampaignSlotCard",props:{slotDetails:{type:Object}}},V={class:"card card--campaign"},R=["href"],q=["src","alt"],W=i("i",{class:"material-icons","aria-hidden":"true"},"chevron_right",-1);function j(e,t,r,l,n,s){return a(),o("div",V,[i("a",{href:r.slotDetails.TargetURL,target:"_blank"},[i("img",{src:r.slotDetails.Image,alt:r.slotDetails.altText},null,8,q),i("span",{class:"update__link",style:T({color:r.slotDetails.MoreInfoLinkColor})},[C(" More information "),W],4)],8,R)])}const x=y(O,[["render",j]]),G={components:{Alert:E,CampaignSlotCard:x},props:{alerts:{type:Array,required:!0},mode:{type:String,required:!0}},computed:{...M({campaignSlots:e=>e.campaignsSlots.servicealert?e.campaignsSlots.servicealert:[]}),severeAlerts(){return this.alerts.filter(e=>e.severity_level==="SEVERE")},nonSevereAlerts(){return this.alerts.filter(e=>e.severity_level!=="SEVERE")},shuffledSlots(){const e=this.campaignSlots.filter(({Mode:t})=>!t||t.split(",").reduce((r,l)=>(l===this.mode&&(r=!0),r),!1)).slice();return e.sort((t,r)=>.5-Math.random()),e}},methods:{campaignSlot(e){const t=e+1;return this.alerts.length<2?this.shuffledSlots[0]:t%2==0?this.shuffledSlots[t/2-1]:null}}};function z(e,t,r,l,n,s){const g=u("Alert"),S=u("CampaignSlotCard");return a(),o("div",null,[(a(!0),o(f,null,A(s.severeAlerts,(c,d)=>(a(),o(f,{key:`severe-${r.mode}-${c.id}`},[h(g,{alert:c,mode:r.mode,modalOnImageClick:!0,class:"card",onShowAlertModal:p=>e.$emit("show-alert-modal",c)},null,8,["alert","mode","onShowAlertModal"]),s.campaignSlot(d)?(a(),_(S,{key:`severe-${d}-${e.campaignSlots.length}`,"slot-details":s.campaignSlot(d)},null,8,["slot-details"])):m("",!0)],64))),128)),(a(!0),o(f,null,A(s.nonSevereAlerts,(c,d)=>(a(),o(f,{key:`${r.mode}-${c.id}`},[h(g,{alert:c,mode:r.mode,modalOnImageClick:!0,class:"card",onShowAlertModal:p=>e.$emit("show-alert-modal",c)},null,8,["alert","mode","onShowAlertModal"]),s.campaignSlot(d+s.severeAlerts.length)?(a(),_(S,{key:`${d}-${e.campaignSlots.length}`,"slot-details":s.campaignSlot(d)},null,8,["slot-details"])):m("",!0)],64))),128))])}const $=y(G,[["render",z]]);I.extend(B);const Q={name:"alerts",components:{Tabs:D,Notification:P,AlertImageModal:H,AlertsList:$,Switch:L},mixins:[N,F],props:{mode:{type:String,default:"bus"},date:{type:String,default:"today"}},head(){var t;let e="";if(!this.date||!((t=this.$route.params)!=null&&t.mode))e="Service Alerts | Public Transport | Metlink";else{let r="";switch(this.mode){case"bus":r="Buses";break;case"train":r="Trains";break;case"school":r="School";break;case"train":r="Trains";break;default:r="Ferry & Cable Car";break}e=`${this.date==="today"?"Today's":"Upcoming"} Service Alerts for ${r} | Public Transport | Metlink`}return this.makeHead({title:e,meta:[{name:"description",content:"Stay informed with the latest service alerts for Metlink’s bus, train & ferry services across Greater Wellington. Get real-time updates on disruptions & changes"}]})},computed:{...M({currentUser:e=>e.currentUser}),...U({serviceStyle:"serviceStyle",serviceAlertsByMode:"serviceAlertsByMode",stopByStopId:"stopByStopId",serviceAlertById:"serviceAlertById"}),modeHeading(){return this.mode==="other"?"ferry & cable car":this.mode},alerts(){let e=this.serviceAlertsByMode(this.mode).filter(t=>this.date==="upcoming"?!this.alertHasActivePeriodToday(t):this.alertHasActivePeriodToday(t));return this.currentUser&&this.currentUser.services.length&&e.forEach(t=>{const r=t.affected_routes.filter(l=>this.currentUser.services.includes(l));t.user_favourite=!!r.length}),this.currentUser&&this.currentUser.services.length&&e.sort((t,r)=>r.user_favourite-t.user_favourite),this.currentUser&&this.showFavourites&&this.currentUser.services.length&&(e=e.filter(t=>t.user_favourite)),e=this.sortAlertsByPriority(e),e},immediateUpcomingAlerts(){return this.alerts.filter(this.startsLessThanAWeekFromNow)},plannedUpcomingAlerts(){return this.alerts.filter(this.startsMoreThanAWeekFromNow)},smsSubscriptionNotification(){return this.currentUser&&this.currentUser.notifications?this.currentUser.notifications.find(e=>e.type==="sms_subscription"):null},showFavourites:{get(){return this.$store.state.showFavourites},set(e){this.$store.commit("SET_SHOW_FAVOURITES",e)}}},data(){return{selectedAlert:null,showImageModal:!1,hasTargeted:!1}},beforeRouteEnter(e,t,r){r(l=>{l.$store.commit("SET_SHOW_PANEL",!0)})},mounted(){this.$nextTick(()=>{this.routeToAlert(!1)})},updated(){this.routeToAlert(!0)},methods:{handleImageModalClose(){this.showImageModal=!1},onSelectMode(e){e!==this.mode&&this.$router.replace({name:"alerts",params:{mode:e,date:this.date}})},onSelectDate(e){e!==this.date&&this.$router.replace({name:"alerts",params:{mode:this.mode,date:e}})},dateClass(e){let t=["btn-group__btn"];return e===this.date&&t.push("btn-group__btn--active"),t},handleShowAlertModal(e){this.selectedAlert=e,this.showImageModal=!0},routeToAlert(e){var t,r;if(!this.hasTargeted&&((r=(t=this.$route)==null?void 0:t.query)!=null&&r.alertid)){let l=this.serviceAlertById(this.$route.query.alertid);if(l){let n=this.alertHasActivePeriodToday(l)?"today":"upcoming",s=l.mode?l.mode:"bus";n!==this.date||s!==this.mode?this.$router.push({path:"/alerts/"+s+"/"+n+"?alertid="+l.id}):(this.scrollToAlertPosition(l,e),this.hasTargeted=!0)}}},scrollToAlertPosition(e,t){const r=document.getElementById(e.id);if(r){let n=r.getBoundingClientRect().top-65;window.scrollTo(0,n)}}}},X={class:"top-card"},Z={class:"top-card__body"},J={class:"btn-group"},K={key:1,class:"toggle-filter toggle-filter--alerts"},Y={key:0,class:"panel__body__content"},ee={key:0},te=i("h2",{class:"card__h1 mb-3"}
1,"Next 7 days",-1),re={key:1},se={key:0,class:"panel__vertical-divider"},ae=i("h2",{class:"card__h1 mb-3"},"Planned work",-1),le={key:1,class:"panel__body__content"};function oe(e,t,r,l,n,s){const g=u("Notification"),S=u("Tabs"),c=u("Switch"),d=u("AlertsList"),p=u("AlertImageModal");return a(),o("div",null,[i("div",X,[i("div",Z,[s.smsSubscriptionNotification?(a(),_(g,{key:0,notification:s.smsSubscriptionNotification,class:"notification--in-panel"},null,8,["notification"])):m("",!0),i("div",J,[i("button",{onClick:t[0]||(t[0]=b(v=>s.onSelectDate("today"),["prevent"])),class:w(s.dateClass("today"))},"Today",2),i("button",{onClick:t[1]||(t[1]=b(v=>s.onSelectDate("upcoming"),["prevent"])),class:w(s.dateClass("upcoming"))},"Upcoming",2)]),h(S,{onSelect:s.onSelectMode,initial:r.mode},null,8,["onSelect","initial"]),e.currentUser?(a(),o("div",K,[h(c,{"init-model":s.showFavourites,"label-text":"Only show my favourite services","onSwitch:change":t[2]||(t[2]=v=>{s.showFavourites=v})},null,8,["init-model"])])):m("",!0)])]),s.alerts.length?(a(),o("div",Y,[r.date==="today"?(a(),_(d,{key:0,mode:r.mode,alerts:s.alerts,onShowAlertModal:s.handleShowAlertModal},null,8,["mode","alerts","onShowAlertModal"])):(a(),o(f,{key:1},[s.immediateUpcomingAlerts.length?(a(),o("div",ee,[te,h(d,{mode:r.mode,alerts:s.immediateUpcomingAlerts,onShowAlertModal:s.handleShowAlertModal},null,8,["mode","alerts","onShowAlertModal"])])):m("",!0),s.plannedUpcomingAlerts.length?(a(),o("div",re,[s.immediateUpcomingAlerts.length?(a(),o("hr",se)):m("",!0),ae,h(d,{mode:r.mode,alerts:s.plannedUpcomingAlerts,onShowAlertModal:s.handleShowAlertModal},null,8,["mode","alerts","onShowAlertModal"])])):m("",!0)],64))])):(a(),o("div",le,[i("p",null,"There are no "+k(s.modeHeading)+" alerts"+k(s.showFavourites?" for your favourite services":"")+".",1)])),n.selectedAlert&&n.selectedAlert.image?(a(),_(p,{key:2,alert:n.selectedAlert,open:n.showImageModal,onCloseModal:t[3]||(t[3]=v=>s.handleImageModalClose())},null,8,["alert","open"])):m("",!0)])}const fe=y(Q,[["render",oe]]);export{fe as default};

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.