PageSourceSearch

https://dz.diesel.com/on/demandware.static/Sites-DieselWW-Site/-/e…/js/component-Loyalty.chunks.js

js diesel.com collected 2026-09-24 08:41:47 UTC 4,427 bytes, 2 lines download raw bytes

1/*! For license information please see component-Loyalty.chunks.js.LICENSE.txt */
2(self.webpackChunkapp_project=self.webpackChunkapp_project||[]).push([[3402],{47376:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>i});var o=r(38302),n=r(6258);class i extends o.default{get SELECTORS(){return{progress:{active:".points-progression__active",pending:".points-progression__pending"}}}constructor(e){super(e),this.$properties=$(this.element).find("[data-loyalty-properties]"),this.$progress=$(this.element).find("[data-loyalty-progress]"),this.customerNo=$("[data-customer-number]").first().data("customer-number")||"1",this.$properties&&this.$properties.length&&this.init()}async init(){const e=$(this.element).data("loyalty-url");if(e)try{const o=await function(e){let t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1/96,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"diesel-cache-v1",i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],s=window[o]||(window[o]=new Map);return s.has(e)?t=s.get(e):(t=new Promise((async t=>{const s=n.Z.get(o)&&i,a=await caches.open(o),c=await a.match(e);let p;if(c&&s)p=c;else{const t=await fetch(e);t.status<400&&(a.put(e,t.clone()),n.Z.set(o,"true",{expires:r})),p=t}t(p)})),s.set(e,t)),t.then((e=>e.clone()))}(e,1/480,"loyalty-cache-"+this.customerNo),i=await o.json();if(!i)throw new Error("No Loyalty data found.");var t,r;this.data=i,this.render(),"customer"in i&&$(document).trigger("loyalty:tier",{tier:null===(t=i.customer.tiers)||void 0===t||null===(r=t[0])||void 0===r?void 0:r.id})}catch(e){console.warn("LOYALTY | Error while retrieving information from API: ",e),$(this.element).hide()}}render(){this.$properties.each(((e,t)=>{let r=$(t).text();$(t).data("loyalty-properties").split(",").forEach(((e,t)=>{const o=this.getValueFromProperty(e);(o||0===o||""===o)&&(r=r.replace("{".concat(t,"}"),o))})),$(t).text(r).removeAttr("data-loyalty-properties")})),this.$progress.each(((e,t)=>{const[r,o]=this.getProgressValue();$(t).find(this.SELECTORS.progress.active).css("width","".concat(r,"%")),$(t).find(this.SELECTORS.progress.pending).css("width","".concat(o,"%"))}))}getValueFromProperty(e){let t;const{customer:r}=this.data,{customerTransaction:o}=this.data;try{switch(e){case"tier":t=r.tiers[0].name||r.tiers[0].id;break;case"next":t=r.tiers[0].next.name||r.tiers[0].next.id;break;case"score":t=r.score;break;case"pending":t="+".concat(r.pending);break;case"threshold":t=r.tiers[0].points+r.tiers[0].next.points;break;case"transaction_points":t=o.total;break;default:throw t=" ",new Error("No mapping found for property ".concat(e,"."))}}catch(e){console.warn("LOYALTY | Error while mapping property to UI: ",e)}if(t||0===t||""===t)return t;throw new Error("No value found for property ".concat(e,"."))}getProgressValue(){const{customer:e}=this.data,t=e.tiers[0],r=parseInt(e.score,10),o=parseInt(e.pending,10),n=parseInt(t.points+t.next.points,10),i=100*r/n,s=100*o/n;return[i.toFixed(2),Math.min(100,i+s).toFixed(2)]}}},6258:(e,t,r)=>{"use strict";function o(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)e[o]=r[o]}return e}r.d(t,{Z:()=>n});const n=function e(t,r){function n(e,n,i){if("undefined"!=typeof document){"number"==typeof(i=o({},r,i)).expires&&(i.expires=new Date(Date.now()+864e5*i.expires)),i.expires&&(i.expires=i.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var s="";for(var a in i)i[a]&&(s+="; "+a,!0!==i[a]&&(s+="="+i[a].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+s}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],o={},n=0;n<r.length;n++){var i=r[n].split("="),s=i.slice(1).join("=");try{var a=decodeURIComponent(i[0]);if(o[a]=t.read(s,a),e===a)break}catch(e){}}return e?o[e]:o}},remove:function(e,t){n(e,"",o({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,o({},this.attributes,t))},withConverter:function(t){return e(o({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decode
2URIComponent)}},{path:"/"})}}]);

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.