1import{u as _,W as C,l as c,E as D,L as N,c as h}from"./BmND6XgJ.js";import{e as i}from"./CMu_vnXo.js";import{g as b}from"./BaR6M3Pd.js";import{g as v}from"./BQjE_gPp.js";const A=(u,n)=>`${u}-${(n||"").toUpperCase()}`,k=()=>{const{makeCommercetoolsRequest:u}=_(),{languageAndCountry:n,countryLocalization:y,countryCode:g}=C(),r=c("loyaltyLevels",()=>null),a=c("loyaltyLevelsLoading",()=>!1),m=e=>{const o=i(e,v.COHORT_RANGE_FROM,n.value),t=i(e,v.COHORT_RANGE_TO,n.value);return{from:o?Number.parseFloat(o):0,to:t?Number.parseFloat(t):void 0}},d=(e,o)=>e?.storesRef?.some(s=>s.key===o)&&e?.isActive,L=e=>{const o={};return e?(e.customerGroups.results.forEach(t=>{const s=t.key,R=A(s,g.value),l=e.cartDiscounts.results.find(T=>T.key===R);if(l&&!d(l,y.value.storeId))return;const E=l?l.value.permyriad/100:0,O=m(t),S=b(s);o[s]={levelNumber:S,spendingRange:O,discountPercentage:E}}),Object.values(o).sort((t,s)=>t.levelNumber-s.levelNumber)):[]},p=async()=>{if(r.value===null&&!a.value){a.value=!0;try{const e=await u({endpoint:D.CT.GET_LOYALTY_LEVELS});r.value=L(e?.data)}catch(e){N.error("error.useLoyaltyLevels",String(e))}finally{a.value=!1}}},f=h(()=>r.value?.length?Math.max(...r.value.map(e=>e.discountPercentage)):null);return{load:p,loading:a,loyaltyLevels:r,highestLoyaltyDiscountPercentage:f}};export{k as u}; 2//# sourceMappingURL=CX_ukUkg.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.