PageSourceSearch

https://www.nyaludvikatidning.se/assets/rev/js/tapet-paywall-module-LCZITIBL.js

js nyaludvikatidning.se collected 2026-10-04 11:19:52 UTC 3,006 bytes, 2 lines download raw bytes

1import{b as u,c as f,d as _}from"./chunk-N62CHIIA.js";import{a as p,b as m,c as d}from"./chunk-CZRSL6NU.js";import{i as h,u as i}from"./chunk-VJGBCIFP.js";import"./chunk-XCPXRTXT.js";import{a as n,d as l,g as c}from"./chunk-XJLSI5BW.js";import{a as o}from"./chunk-ZOYOJ6FT.js";import"./chunk-6KHOHYTW.js";var r=class{constructor(e){this.element=e,this.init()}init(){this._articleUrl=this.element.getAttribute("data-article-url"),this._articleId=this.element.getAttribute("data-article-uuid"),this._segments=this.element.getAttribute("data-segments"),this._context=this.element.getAttribute("data-context"),this._accessRestriction=this.element.getAttribute("data-access-restriction"),this.clientId=null,this._init()}_init(){this.isNativeApp?this._handleNativeApp():(Promise.all([this._checkConsentForPurpose(n.analysisAndDevelopment),this._checkConsentForPurpose(n.marketingAndContent),this._checkBonniernewsReynoldsConsent()]).then(e=>{e.every(Boolean)&&this._setClientId()}).catch(e=>i(e)).finally(()=>this._fetchPaywall()),f(),_("#tapet-paywall").then(()=>{u("#tapet-paywall")}).catch(e=>i(e)))}_fetchPaywall(){let s="/api/get-paywall"+m(d({articleUrl:this._articleUrl,articleId:this._articleId,segments:this._segments,context:this._context,accessRestriction:this._accessRestriction,channel:p(),...!this._segments&&{clientId:this.clientId}}));fetch(s).then(t=>{if(t.status===200)return this._removeError(),t.text();throw new Error("Error calling /api/get-paywalls")}).then(t=>{if(t){let a=document.createRange().createContextualFragment(t);this.element.innerHTML="",this.element.appendChild(a)}else this._setError();this._observeNativeApp()}).catch(()=>{this._setError()})}_setClientId(){this.clientId=o("bnacid")}_setError(){this.offerElement.classList.add("tapet-paywall--error")}_removeError(){this.offerElement.classList.remove("tapet-paywall--error")}_observeNativeApp(){if(window.MutationObserver){let e=document.querySelector("html"),s={attributes:!0,childList:!1,subtree:!1},t=(y,g)=>{(e.classList.contains("generik-app")||e.classList.contains("ios-native-app")||e.classList.contains("android-native-app"))&&(this._handleNativeApp(),g.disconnect())};new MutationObserver(t).observe(e,s)}}get offerElement(){return this.element.querySelector(".tapet-paywall-container")}get isNativeApp(){return["ios","android"].includes(h.os)||this.element.closest(".ios-native-app")||this.element.closest(".android-native-app")||this.element.closest(".generik-app")}_handleNativeApp(){let e=this.element.querySelector('[data-name="paywall-fallback-template"]');if(!(e&&e instanceof HTMLTemplateElement&&this.offerElement))return;let s=e.content.cloneNode(!0),t=this.offerElement.querySelector(".tapet-paywall-container__paywall");t&&t.remove(),this.element.appendChild(s)}_checkConsentForPurpose(e){return l(e).then(s=>!!s)}_checkBonniernewsReynoldsConsent(){return new Promise(e=>{c("bonniernews-reynolds",s=>{e(!!s.enabled)})})}};export{r as default};
2//# sourceMappingURL=tapet-paywall-module-LCZITIBL.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.