PageSourceSearch

https://www.labello.com/dist/NiveaX/modules/Coupon-Coupon.994873fa.js

js labello.com collected 2026-10-02 12:42:00 UTC 4,324 bytes, 2 lines download raw bytes

1"use strict";(self.NiveaXwebpackJsonp=self.NiveaXwebpackJsonp||[]).push([[5164,7921,8688],{8328:(e,t,o)=>{o.r(t),o.d(t,{default:()=>r});var n=o(76202),s=o(98684),i=o(930);class r{constructor(e,t){this.element=e,this.wrapper=this.element.parentElement,this.layer=new n.default(this.wrapper,{layerModifierClasses:"nx-layer--popup"}),this.init(t)}init(e){return this.layer.insertContent(this.getPopUp(e)),this.element.addEventListener("click",e=>this.onElementClick(e)),this}onElementClick(e){e.preventDefault(),e.stopPropagation(),this.element.classList.toggle("nx-submenu--open"),(0,s.nB)(this.element,"nx-submenu--open")?(document.addEventListener("click",e=>this.onBodyClick(e)),this.layer.open()):this.layer.close()}onBodyClick(e){const t=e.target.closest(".nx-header-icons__link");t&&t!==this.element||this.closeLayer()}closeLayer(){(0,s.vy)(this.element,"nx-submenu--open"),document.removeEventListener("click",e=>this.onBodyClick(e)),this.layer.close()}getPopUp(e){return(0,s.Uo)(`\n            <div class="nx-submenu">\n                <h2 class="nx-submenu__title"></h2>\n                <ul class="nx-submenu-popup">\n                    ${e.map(e=>(0,i.l9)(e)).join("")}\n                </ul>\n            </div>\n        `)}}},88972:(e,t,o)=>{o.r(t),o.d(t,{default:()=>l});var n=o(98684),s=o(21464),i=o(93096),r=o(76202);class l{static setup(e='[data-module="Coupon"]'){Array.from(document.querySelectorAll(e)).filter(e=>!e.dataset.moduleInitialized).forEach(e=>{new l(e),e.dataset.moduleInitialized="true"})}constructor(e,t={}){this.submenuStructure=[],this.element=e,this.options=(0,s.$E)(this.element,Object.assign(this.getDefaultOptions(),t)),this.couponWrapper=this.element.querySelector(`.${this.options.wrapperSelector}`),this.couponID=this.couponWrapper.dataset.couponId,this.couponUrl=this.couponWrapper.href,this.useHrefToFetch=""===this.couponWrapper.dataset.fetchUrl,this.layer=new r.default(this.couponWrapper,{layerModifierClasses:"nx-layer--popup"}),this.initCouponsArray(),this.checkIfRedeemed(this.couponID)&&this.lockThisRedeemedCoupon()}init(){return this.checkCouponType(),this}getRedeemedCoupons(){return localStorage.getItem(this.options.localStorageKey)?localStorage.getItem(this.options.localStorageKey):"false"}initCouponsArray(){return"false"===this.getRedeemedCoupons()?this.couponsArray=[]:this.couponsArray=(0,s.pt)(this.getRedeemedCoupons()),this.couponsArray}checkCouponType(){var e;this.couponWrapper.classList.contains(this.options.elementSelector+"--locked")?this.initLogInRegisterAction(this.couponWrapper,this.submenuStructure):null===(e=this.element.querySelector(".nx-coupon-teaser__link-wrapper"))||void 0===e||e.addEventListener("click",e=>this.useHrefToFetch?this.fetchCoupon(e,this.couponUrl):this.pushCouponToArray())}fetchCoupon(e,t){e.preventDefault(),this.element.classList.contains(this.options.elementSelector+"--redeemed")||fetch(t,{credentials:"include"}).then(e=>e.json()).then(e=>{e.printUrl?this.fetchedCouponSuccess(e.printUrl):this.fetchedCouponError(e.errorMessage)}
1).catch(e=>console.error(`Request failed:/\n${e}`))}fetchedCouponSuccess(e){this.pushCouponToArray(),window.open(e,"_blank")}fetchedCouponError(e){this.layer.insertContent(this.getPopUpContent(e)),this.layer.open()}getPopUpContent(e){return(0,n.Uo)(`\n            <div class="nx-coupon-error nx-font--bold nx-font-heading-4">\n                <div>${e}</div>\n                <i></i>\n            </div>\n        `)}pushCouponToArray(){this.initCouponsArray(),this.checkIfRedeemed(this.couponID)||(this.couponsArray.push(this.couponID),this.saveRedeemedCouponsToLocalStorage().lockThisRedeemedCoupon())}saveRedeemedCouponsToLocalStorage(){return localStorage.setItem(this.options.localStorageKey,JSON.stringify(this.couponsArray)),this}lockThisRedeemedCoupon(){return this.element.classList.add(this.options.elementSelector+"--redeemed"),this}checkIfRedeemed(e){return this.couponsArray.includes(e)}initLogInRegisterAction(e,t){new i.default(e,t)}getDefaultOptions(){return{elementSelector:"nx-coupons",wrapperSelector:"nx-coupon-teaser__link-wrapper",contentSelector:"nx-coupon-teaser__content",localStorageKey:"CouponsRedeemed"}}}},93096:(e,t,o)=>{o.r(t),o.d(t,{default:()=>n});const n=o(8328).default}}]);
2//# sourceMappingURL=/dist/NiveaX/./modules/Coupon-Coupon.994873fa.js.5b6b1b7d.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.