PageSourceSearch

https://www.arvikanyheter.se/assets/rev/js/follow-modal-module-YDLA4FNU.js

js arvikanyheter.se collected 2026-10-04 02:14:48 UTC 7,952 bytes, 2 lines download raw bytes

1import{d as O,i as n}from"./chunk-765SKFHO.js";import"./chunk-CZRSL6NU.js";import{a as E}from"./chunk-F4JR2GIT.js";import{a as u}from"./chunk-5FWKMTUW.js";import{f as s,g as d,h as p,j as b,l as r,q as N,r as I,u as a}from"./chunk-VJGBCIFP.js";import{d as _,e as m,g as f}from"./chunk-XCPXRTXT.js";import"./chunk-XJLSI5BW.js";import"./chunk-ZOYOJ6FT.js";import{d as w}from"./chunk-6KHOHYTW.js";var i=w(E());var h=class{constructor(t){this.element=t,this._init()}_init(){this._modalContainer=this.element.querySelector("lcl-modal-container"),this._modal=this.element.querySelector("lcl-modal"),this._modalId=this._modal.id;let t=document.querySelector("main").getAttribute("class"),o=this.element.querySelector(".app-template"),e=this.element.querySelector(".web-template");switch(r&&e?e.classList.add("hidden"):!r&&o&&o.classList.add("hidden"),this._interactedWith=!1,this._modalContainer.addEventListener("lcl-modal:track-close",()=>{this._interactedWith===!1&&(this.element.dataset.state==="notification-permission"?this._trackModalInteraction(n.FOLLOW_PUSH_DENIED,n.NOTIFICATIONS_OFF,"close"):this._modalId===i.FOLLOW_CONFIRMATION_INNER_MODAL_ID&&this._trackModalInteraction(n.FOLLOW_PUSH_DENIED,n.NOTIFICATIONS_ON,"close")),this._interactedWith=!1}),this._pageType="",t.includes("article-page")?this._pageType="article page":t.includes("follows-page")?this._pageType="follows page":t.includes("page-subject")&&(this._pageType="subject page"),this._modalId){case i.FOLLOW_CONFIRMATION_INNER_MODAL_ID:this._initConfirmationModal();break;case i.FOLLOW_MODIFICATION_INNER_MODAL_ID:this._initModificationModal();break}this._nameToReplace=this.element.querySelector(".follow-modal:not(.hidden) .follow-modal__message .name-to-replace")}_initConfirmationModal(){s()&&(this._cancelButton=this.element.querySelector(".follow-modal:not(.hidden) .follow-confirmation-modal__cancel"),this._cancelButton&&this._cancelButton.addEventListener("click",()=>{document.dispatchEvent(new CustomEvent("lcl-follow-modal:follow-push-state-changed",{bubbles:!0,detail:{state:"unfollow_no_push"}})),this._interactedWith=!0,this._trackModalInteraction(n.FOLLOW_PUSH_DENIED,n.NOTIFICATIONS_ON),this._modalContainer.closeModal()}),this._okButton=this.element.querySelector(".follow-modal:not(.hidden) .follow-confirmation-modal__ok"),this._okButton.addEventListener("click",()=>{this._followSubjectNotifications({filter:i.FOLLOW_NOTIFICATION_FILTER_ALL_NEWS}),document.dispatchEvent(new CustomEvent("lcl-follow-modal:follow-push-state-changed",{bubbles:!0,detail:{state:"unfollow_with_push"}})),this._interactedWith=!0,d()||I?this._modalContainer.closeModal():this.element.dataset.state="notification-permission"}),this._initNotificationPermissionModal()),this._registerOpenListener({eventName:i.FOLLOW_CONFIRMATION_OPEN_EVENT_NAME,modalId:i.FOLLOW_CONFIRMATION_INNER_MODAL_ID})}_initNotificationPermissionModal(){let t=this.element.querySelector(".follow-modal:not(.hidden) .notification-permission__link");(b||p)&&t.removeAttribute("href"),t&&t.addEventListener("click",()=>{this._interactedWith=!0,N(),this._modalContainer.closeModal()});let o=this.element.querySelector(".follow-modal:not(.hidden) .notification-permission__skip");o&&o.addEventListener("click",()=>{this._interactedWith=!0,this._modalContainer.closeModal(),this._trackModalInteraction(n.FOLLOW_PUSH_DENIED,n.NOTIFICATIONS_OFF)})}_initModificationModal(){s()&&(this._turnOffNotificationsButton=this.element.querySelector(".follow-modal:not(.hidden) .follow-modification-modal__turn-off-notifications"),this._turnOffNotificationsButton&&this._turnOffNotificationsButton.addEventListener("click",()=>{document.dispatchEvent(new CustomEvent("lcl-follow-modal:follow-push-state-changed",{bubbles:!0,detail:{state:"unfollow_no_push",subjectId:this._subjectId}})),this._interactedWith=!0,this._unfollowSubjectNotifications(),this._modalContainer.closeModal(),this._trackModalInteraction(n.FOLLOW_PUSH_DEACTIVATED,n.NOTIFICATIONS_ON)}),this._turnOnNotificationsButton=this.element.querySelector(".follow-modal:not(.hidden) .follow-modification-modal__turn-on-notifications"),this._turnOnNotificationsButton&&this._turnOnNotificationsButton.addEventListener("click",()=>
1{document.dispatchEvent(new CustomEvent("lcl-follow-modal:follow-push-state-changed",{bubbles:!0,detail:{state:"unfollow_with_push",subjectId:this._subjectId}})),this._interactedWith=!0,this._followSubjectNotifications({filter:this._filter}),this._modalContainer.closeModal()}),this._cancelButton=this.element.querySelector(".follow-modal:not(.hidden) .follow-modification-modal__cancel"),this._cancelButton.addEventListener("click",()=>{this._interactedWith=!0,this._modalContainer.closeModal()}),d()?this._modalContainer.closeModal():this.element.dataset.state="notification-permission"),this._unfollowButton=this.element.querySelector(".follow-modal:not(.hidden) .follow-modification-modal__unfollow"),this._unfollowButton.addEventListener("click",()=>{document.dispatchEvent(new CustomEvent("lcl-follow-modal:follow-push-state-changed",{bubbles:!0,detail:{state:"follow",subjectId:this._subjectId}})),this._interactedWith=!0,this._unfollowSubject(),this._modalContainer.closeModal()}),this._initNotificationPermissionModal(),this._registerOpenListener({eventName:i.FOLLOW_MODIFICATION_OPEN_EVENT_NAME,modalId:i.FOLLOW_MODIFICATION_INNER_MODAL_ID})}_registerOpenListener({eventName:t,modalId:o}){document.addEventListener(t,e=>{delete this.element.dataset.state,this._nameToReplace.textContent=e.detail.subjectName,this._subjectId=e.detail.subjectId,this._subjectType=e.detail.subjectType,this._subjectFilter=e.detail.subjectFilter,this._filter=this._subjectFilter,this.element.setAttribute("subject-type",this._subjectType),this.element.setAttribute("button-state",e.detail.currentState),document.dispatchEvent(new CustomEvent(O(o),{bubbles:!0,detail:{focusAfter:e.detail.focusAfter,element:this.element}}))})}_trackModalInteraction(t,o,e="button"){u({element:this.element,eventName:"follow-modal-interaction",data:{category:"push setting follow",action:t,page:this._pageType,exit:e,deviceSettings:o}})}_trackNotficationSettingChange(t){!t&&this._subjectFilter===i.FOLLOW_NOTIFICATION_FILTER_NONE||u({element:this.element,eventName:"push-setting-changed",data:{action:t?"Follow Push Activated":"Follow Push Deactivated",type:this._subjectType,id:this._subjectId,name:this._nameToReplace.textContent}})}get _filter(){let t=this.element.querySelector(`input[name="${i.FOLLOW_NOTIFICATION_FILTER}"]:checked`);if(t)return t.value===i.FOLLOW_NOTIFICATION_FILTER_NONE?void 0:t.value}set _filter(t){let o=t||i.FOLLOW_NOTIFICATION_FILTER_NONE,e=this.element.querySelector(`input[name="${i.FOLLOW_NOTIFICATION_FILTER}"][value="${o}"]`);e&&(e.checked=!0)}_followSubjectNotifications({filter:t}){let{_subjectType:o,_subjectId:e}=this,l=s();return _({id:e,filter:t,type:o,token:l}).then(c=>{c.ok&&this._trackNotficationSettingChange(!0)}).catch(c=>{a(c)})}_unfollowSubjectNotifications(){let{_subjectType:t,_subjectId:o}=this,e=s();return m({id:o,type:t,token:e}).then(l=>{l.ok&&(this._modalContainer.closeModal(),this._trackNotficationSettingChange(!1))}).catch(l=>{a(l)})}_unfollowSubject(){let{_subjectType:t,_subjectId:o}=this,e=s();return this._unfollowButton.dispatchEvent(new CustomEvent("lcl-button:loading:start",{detail:{statusText:"Avf\xF6ljer"},bubbles:!0})),f({id:o,type:t,token:e}).then(()=>{this._unfollowButton.dispatchEvent(new CustomEvent("lcl-button:loading:stop",{detail:{statusText:""},bubbles:!0})),this._modalContainer.closeModal(),this._trackNotficationSettingChange(!1),document.dispatchEvent(new CustomEvent("lcl-follow-modal:subject-unfollowed",{bubbles:!0,detail:{state:"unfollow"}}))}).catch(l=>{this._unfollowButton.dispatchEvent(new CustomEvent("lcl-button:loading:stop",{detail:{statusText:"Avf\xF6ljning misslyckad"},bubbles:!0})),a(l)})}};export{h as default};
2//# sourceMappingURL=follow-modal-module-YDLA4FNU.js.map

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.