PageSourceSearch

https://von-lupin.com/theme/dd62c4f2f1cf1f436cc0e3941a1116c4/js/pr…/prems-bonus-system.js?1791365103

js von-lupin.com collected 2026-10-08 06:42:00 UTC 17,339 bytes, 1 lines download raw bytes

1(()=>{"use strict";var t={857:t=>{var e=function(t){var e;return!!t&&"object"==typeof t&&"[object RegExp]"!==(e=Object.prototype.toString.call(t))&&"[object Date]"!==e&&t.$$typeof!==s},s="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function i(t,e){return!1!==e.clone&&e.isMergeableObject(t)?a(Array.isArray(t)?[]:{},t,e):t}function n(t,e,s){return t.concat(e).map(function(t){return i(t,s)})}function r(t){return Object.keys(t).concat(Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(t).filter(function(e){return Object.propertyIsEnumerable.call(t,e)}):[])}function o(t,e){try{return e in t}catch(t){return!1}}function a(t,s,c){(c=c||{}).arrayMerge=c.arrayMerge||n,c.isMergeableObject=c.isMergeableObject||e,c.cloneUnlessOtherwiseSpecified=i;var l,u,d=Array.isArray(s);return d!==Array.isArray(t)?i(s,c):d?c.arrayMerge(t,s,c):(u={},(l=c).isMergeableObject(t)&&r(t).forEach(function(e){u[e]=i(t[e],l)}),r(s).forEach(function(e){(!o(t,e)||Object.hasOwnProperty.call(t,e)&&Object.propertyIsEnumerable.call(t,e))&&(o(t,e)&&l.isMergeableObject(s[e])?u[e]=(function(t,e){if(!e.customMerge)return a;var s=e.customMerge(t);return"function"==typeof s?s:a})(e,l)(t[e],s[e],l):u[e]=i(s[e],l))}),u)}a.all=function(t,e){if(!Array.isArray(t))throw Error("first argument should be an array");return t.reduce(function(t,s){return a(t,s,e)},{})},t.exports=a}},e={};function s(i){var n=e[i];if(void 0!==n)return n.exports;var r=e[i]={exports:{}};return t[i](r,r.exports,s),r.exports}(()=>{s.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return s.d(e,{a:e}),e}})(),(()=>{s.d=(t,e)=>{for(var i in e)s.o(e,i)&&!s.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})}})(),(()=>{s.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e)})(),(()=>{var t=s(857),e=s.n(t);class i{static ucFirst(t){return t.charAt(0).toUpperCase()+t.slice(1)}static lcFirst(t){return t.charAt(0).toLowerCase()+t.slice(1)}static toDashCase(t){return t.replace(/([A-Z])/g,"-$1").replace(/^-/,"").toLowerCase()}static toLowerCamelCase(t,e){let s=i.toUpperCamelCase(t,e);return i.lcFirst(s)}static toUpperCamelCase(t,e){return e?t.split(e).map(t=>i.ucFirst(t.toLowerCase())).join(""):i.ucFirst(t.toLowerCase())}static parsePrimitive(t){try{return/^\d+(.|,)\d+$/.test(t)&&(t=t.replace(",",".")),JSON.parse(t)}catch(e){return t.toString()}}}class n{static isNode(t){return"object"==typeof t&&null!==t&&(t===document||t===window||t instanceof Node)}static hasAttribute(t,e){if(!n.isNode(t))throw Error("The element must be a valid HTML Node!");return"function"==typeof t.hasAttribute&&t.hasAttribute(e)}static getAttribute(t,e){let s=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(s&&!1===n.hasAttribute(t,e))throw Error('The required property "'.concat(e,'" does not exist!'));if("function"!=typeof t.getAttribute){if(s)throw Error("This node doesn't support the getAttribute function!");return}return t.getAttribute(e)}static getDataAttribute(t,e){let s=!(arguments.length>2)||void 0===arguments[2]||arguments[2],r=e.replace(/^data(|-)/,""),o=i.toLowerCamelCase(r,"-");if(!n.isNode(t)){if(s)throw Error("The passed node is not a valid HTML Node!");return}if(void 0===t.dataset){if(s)throw Error("This node doesn't support the dataset attribute!");return}let a=t.dataset[o];if(void 0===a){if(s)throw Error('The required data attribute "'.concat(e,'" does not exist on ').concat(t,"!"));return a}return i.parsePrimitive(a)}static querySelector(t,e){let s=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(s&&!n.isNode(t))throw Error("The parent node is not a valid HTML Node!");let i=t.querySelector(e)||!1;if(s&&!1===i)throw Error('The required element "'.concat(e,'" does not exist in parent node!'));return i}static querySelectorAll(t,e){let s=!(arguments.length>2)||void 0===arguments[2]||arguments[2];if(s&&!n.isNode(t))throw Error("The parent node is not a valid HTML Node!");let i=t.querySelectorAll(e);if(0===i.length&&(i=!1),s&&!1===i)throw Error('At least one item of "'.concat(e,'" must exist in parent node!'));return i}static getFocusableElements(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return t.querySelectorAll('\n            input:not([tabindex^="-"]):not([disabled]):not([type="hidden"]),\n            select:not([tabindex^="-"]):not([disabled]),\n            textarea:not([tabindex^="-"]):not([disabled]),\n            button:not([tabindex^="-"]):not([disabled]),\n            a[href]:not([tabindex^="-"]):not([disabled]),\n            [tabindex]:not
1([tabindex^="-"]):not([disabled])\n        ')}static getFirstFocusableElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document.body;return this.getFocusableElements(t)[0]}static getLastFocusableElement(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:document,e=this.getFocusableElements(t);return e[e.length-1]}}class r{publish(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},s=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=new CustomEvent(t,{detail:e,cancelable:s});return this.el.dispatchEvent(i),i}subscribe(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=this,n=t.split("."),r=s.scope?e.bind(s.scope):e;if(s.once&&!0===s.once){let e=r;r=function(s){i.unsubscribe(t),e(s)}}return this.el.addEventListener(n[0],r),this.listeners.push({splitEventName:n,opts:s,cb:r}),!0}unsubscribe(t){let e=t.split(".");return this.listeners=this.listeners.reduce((t,s)=>([...s.splitEventName].sort().toString()===e.sort().toString()?this.el.removeEventListener(s.splitEventName[0],s.cb):t.push(s),t),[]),!0}reset(){return this.listeners.forEach(t=>{this.el.removeEventListener(t.splitEventName[0],t.cb)}),this.listeners=[],!0}get el(){return this._el}set el(t){this._el=t}get listeners(){return this._listeners}set listeners(t){this._listeners=t}constructor(t=document){this._el=t,t.$emitter=this,this._listeners=[]}}class o{init(){throw Error('The "init" method for the plugin "'.concat(this._pluginName,'" is not defined.'))}update(){}_init(){this._initialized||(this.init(),this._initialized=!0)}_update(){this._initialized&&this.update()}_mergeOptions(t){let s=i.toDashCase(this._pluginName),r=n.getDataAttribute(this.el,"data-".concat(s,"-config"),!1),o=n.getAttribute(this.el,"data-".concat(s,"-options"),!1),a=[this.constructor.options,this.options,t];r&&a.push(window.PluginConfigManager.get(this._pluginName,r));try{o&&a.push(JSON.parse(o))}catch(t){throw console.error(this.el),Error('The data attribute "data-'.concat(s,'-options" could not be parsed to json: ').concat(t.message))}return e().all(a.filter(t=>t instanceof Object&&!(t instanceof Array)).map(t=>t||{}))}_registerInstance(){window.PluginManager.getPluginInstancesFromElement(this.el).set(this._pluginName,this),window.PluginManager.getPlugin(this._pluginName,!1).get("instances").push(this)}_getPluginName(t){return t||(t=this.constructor.name),t}constructor(t,e={},s=!1){if(!n.isNode(t))throw Error("There is no valid element given.");this.el=t,this.$emitter=new r(this.el),this._pluginName=this._getPluginName(s),this.options=this._mergeOptions(e),this._initialized=!1,this._registerInstance(),this._init()}}class a extends o{init(){let t=document.getElementById("bonus-slider");t&&(this.applySlider(t),window.PluginManager.getPluginInstances("FormAjaxSubmit").forEach(t=>{t.$emitter.subscribe("onAfterAjaxSubmit",this.applySlider.bind(this))}))}applySlider(t){let{pointInput:e,pointDisplayOutput:s,btnRedeemPoints:i,sliderStart:n,sliderStep:r}=this.options;this.pointInput=document.querySelector(e),this.pointDisplayOutput=document.querySelector(s),this.btnRedeemPoints=document.querySelector(i);let o=parseInt(t.dataset.rangeMin),a=parseInt(t.dataset.rangeMax),c=parseFloat(document.getElementById("bonus--conversion-factor").value);noUiSlider.create(t,{start:n,connect:!1,step:r,range:{min:~~o,max:~~a}}),t.noUiSlider.on("update",(e,s)=>{let i=parseInt(e[s],10),n=(i*(1/c)).toFixed(2);i>0?this.btnRedeemPoints.classList.remove("invisible"):this.btnRedeemPoints.classList.add("invisible"),document.getElementById("bonus-slider-conversion-status").innerHTML="".concat(i," P / ").concat(n," ").concat(t.dataset.currency),this.pointDisplayOutput.innerHTML=i,this.pointInput.value=i})}}a.options={pointInput:"#bonus-slider-points",pointDisplayOutput:"#point-display-output",btnRedeemPoints:".btn-redeem-points",sliderStart:0,sliderStep:1};class c{get(t,e){let s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"application/json",i=this._createPreparedRequest("GET",t,s);return this._sendRequest(i,null,e)}post(t,e,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(e,i);let n=this._createPreparedRequest("POST",t,i);return this._sendRequest(n,e,s)}delete(t,e,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(e,i);let n=this._createPreparedRequest("DELETE",t,i);return this._sendRequest(n,e,s)}patch(t,e,s){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"application/json";i=this._getContentType(e,i);let n=this._createPreparedRequest("PATCH",t,i);return this._sendRequest(n,e,s)}
1abort(){if(this._request)return this._request.abort()}setErrorHandlingInternal(t){this._errorHandlingInternal=t}_registerOnLoaded(t,e){e&&(!0===this._errorHandlingInternal?(t.addEventListener("load",()=>{e(t.responseText,t)}),t.addEventListener("abort",()=>{console.warn("the request to ".concat(t.responseURL," was aborted"))}),t.addEventListener("error",()=>{console.warn("the request to ".concat(t.responseURL," failed with status ").concat(t.status))}),t.addEventListener("timeout",()=>{console.warn("the request to ".concat(t.responseURL," timed out"))})):t.addEventListener("loadend",()=>{e(t.responseText,t)}))}_sendRequest(t,e,s){return this._registerOnLoaded(t,s),t.send(e),t}_getContentType(t,e){return t instanceof FormData&&(e=!1),e}_createPreparedRequest(t,e,s){return this._request=new XMLHttpRequest,this._request.open(t,e),this._request.setRequestHeader("X-Requested-With","XMLHttpRequest"),s&&this._request.setRequestHeader("Content-type",s),this._request}constructor(){this._request=null,this._errorHandlingInternal=!1}}class l{static iterate(t,e){if(t instanceof Map||Array.isArray(t))return t.forEach(e);if(t instanceof FormData){for(var s of t.entries())e(s[1],s[0]);return}if(t instanceof NodeList)return t.forEach(e);if(t instanceof HTMLCollection)return Array.from(t).forEach(e);if(t instanceof Object)return Object.keys(t).forEach(s=>{e(t[s],s)});throw Error("The element type ".concat(typeof t," is not iterable!"))}}let u="loader",d={BEFORE:"before",INNER:"inner"};class h{create(){if(!this.exists()){if(this.position===d.INNER){this.parent.innerHTML=h.getTemplate();return}this.parent.insertAdjacentHTML(this._getPosition(),h.getTemplate())}}remove(){let t=this.parent.querySelectorAll(".".concat(u));l.iterate(t,t=>t.remove())}exists(){return this.parent.querySelectorAll(".".concat(u)).length>0}_getPosition(){return this.position===d.BEFORE?"afterbegin":"beforeend"}static getTemplate(){return'<div class="'.concat(u,'" role="status">\n                    <span class="').concat("visually-hidden",'">Loading...</span>\n                </div>')}static SELECTOR_CLASS(){return u}constructor(t,e=d.BEFORE){this.parent=t instanceof Element?t:document.body.querySelector(t),this.position=e}}class p{static isTouchDevice(){return"ontouchstart"in document.documentElement}static isIOSDevice(){return p.isIPhoneDevice()||p.isIPadDevice()}static isNativeWindowsBrowser(){return p.isIEBrowser()||p.isEdgeBrowser()}static isIPhoneDevice(){return!!navigator.userAgent.match(/iPhone/i)}static isIPadDevice(){return!!navigator.userAgent.match(/iPad/i)}static isIEBrowser(){return -1!==navigator.userAgent.toLowerCase().indexOf("msie")||!!navigator.userAgent.match(/Trident.*rv:\d+\./)}static isEdgeBrowser(){return!!navigator.userAgent.match(/Edge\/\d+/i)}static getList(){return{"is-touch":p.isTouchDevice(),"is-ios":p.isIOSDevice(),"is-native-windows":p.isNativeWindowsBrowser(),"is-iphone":p.isIPhoneDevice(),"is-ipad":p.isIPadDevice(),"is-ie":p.isIEBrowser(),"is-edge":p.isEdgeBrowser()}}}let g="modal-backdrop",m="modal-backdrop-open",b="no-scroll",y={ON_CLICK:"backdrop/onclick"};class v{create(t){this._removeExistingBackdrops(),document.body.insertAdjacentHTML("beforeend",this._getTemplate());let e=document.body.lastChild;document.documentElement.classList.add(b),setTimeout(function(){e.classList.add(m),"function"==typeof t&&t()},75),this._dispatchEvents()}remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350,e=this._getBackdrops();l.iterate(e,t=>t.classList.remove(m)),setTimeout(this._removeExistingBackdrops.bind(this),t),document.documentElement.classList.remove(b)}_dispatchEvents(){let t=p.isTouchDevice()?"touchstart":"click";document.addEventListener(t,function(t){t.target.classList.contains(g)&&document.dispatchEvent(new CustomEvent(y.ON_CLICK))})}_getBackdrops(){return document.querySelectorAll(".".concat(g))}_removeExistingBackdrops(){if(!1===this._exists())return;let t=this._getBackdrops();l.iterate(t,t=>t.remove())}_exists(){return document.querySelectorAll(".".concat(g)).length>0}_getTemplate(){return'<div class="'.concat(g,'"></div>')}constructor(){return v.instance||(v.instance=this),v.instance}}let f=Object.freeze(new v);class _{static create(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;f.create(t)}static remove(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:350;f.remove(t)}static SELECTOR_CLASS(){return g}}let E=Object.freeze(new class extends h{create(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];!this.exists()&&t&&(_.create(),document.querySelector(".".concat(_.SELECTOR_CLASS())).insertAdjacentHTML("beforeend",h.getTemplate()))}remove(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];super.remove(),t&&_.remove()}constructor(){super(document.body)}});class w{static create(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];E.create(t)}static remove(){let t=!(arguments.length>0)||void 0===arguments[0]||arguments[0];E.remove(t)}}class L extends o{init(){var t,e;let{containerSelector:s,buyWidgetContainerSelector:i,buyWithPointsOnlyCheckboxSelector:n}=this.options;this._client=new c,this.container=document.querySelector(s);let r=(e=this.container)===null||void 0===e?void 0:(t=e.dataset)===null||void 0===t?void 0:t.bonusQuantitySelector;this.select=document.querySelector(r),this.buyWidgetContainer=document.querySelector(i),this.buyWithPointsOnlyCheckbox=document.querySelector(n),this._registerEvents()}_registerEvents(){this.select&&(this.select.onchange=this._fetch.bind(this)),this.buyWithPointsOnlyCheckbox&&(this.buyWithPointsOnlyCheckbox.onchange=this._fetchBuyWithPoints.bind(this))}_fetch(){if(this.container){let t="false",e=new URL(this.container.dataset.updatePointsUrl);this.buyWithPointsOnlyCheckbox&&(t=this.buyWithPointsOnlyCheckbox.checked),e.searchParams.append("quantity",this.select.value),e.searchParams.append("isOnlyBuyableWithPoints",t),this.container.classList.add(this.options.containerIsLoadingClass),this._client.get(e.toString(),this._setContent.bind(this),"application/json",!0)}}_fetchBuyWithPoints(){if(this.buyWidgetContainer){w.create();let t=new URL(this.buyWidgetContainer.dataset.buyWithPointsUrl);t.searchParams.append("state",this.buyWithPointsOnlyCheckbox.checked),this._client.get("".concat(t),t=>{window.location.reload()})}}_setContent(t){this.container.classList.remove(this.options.containerIsLoadingClass),this.container.innerHTML=JSON.parse(t).template}}L.options={containerSelector:"#bonus-system-product-detail-points-ajax-container",containerIsLoadingClass:"bonus-system-is-loading",buyWidgetContainerSelector:"#bonus-system-product-detail-buy",buyWithPointsOnlyCheckboxSelector:"#buy-with-points-only-checkbox"};class C extends o{init(){this._getTriggers(),this._getTargets(),this._registerEvents()}_getTargets(){let t=n.getDataAttribute(this.el,this.options.targetDataAttribute);this._targets=n.querySelectorAll(this.el,t)}_getTriggers(){let t=n.getDataAttribute(this.el,this.options.triggerDataAttribute);this._triggers=n.querySelectorAll(this.el,t)}_registerEvents(){l.iterate(this._triggers,t=>{t.addEventListener("change",this._onChange.bind(this))})}_onChange(t){let e=t.target.checked;l.iterate(this._targets,t=>{e?this._hideElement(t):this._showElement(t)})}_showElement(t){this._replaceElementClass(t,this.options.hideClass,this.options.showClass)}_hideElement(t){this._replaceElementClass(t,this.options.showClass,this.options.hideClass),t.classList.contains(this.options.showClass)||t.classList.contains(this.options.hideClass)||t.classList.add(this.options.hideClass)}_replaceElementClass(t,e,s){t.classList.contains(e)&&t.classList.replace(e,s)}}C.options={targetDataAttribute:"data-form-register-guest-hint-toggle-target",triggerDataAttribute:"data-prems-register-guest-hint-trigger-selector",showClass:"d-block",hideClass:"d-none"};let S=window.PluginManager;S.register("PremsBonusSystemRangeSlider",a,".bonus-system-redeem-points-container"),S.register("ProductQuantityBonusPoints",L,"#productDetailPageBuyProductForm"),S.register("RegisterGuestHint",C,"[data-
1prems-register-guest-hint]")})()})();

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.