@salla.sa/twilight-components
Version:
Salla Web Component
4 lines • 1.11 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import{h as n}from"./p-BHYtfMwX.js";function t(n,t=(window.matchMedia("(min-width: 768px)").matches?3:2)){return n<t?n:n-n%t}function a(n=null){for(const n of document.querySelectorAll("salla-modal"))n.close();n&&requestAnimationFrame(n)}function o(n){const t=(n.prizes||[]).map((n=>({...n,items:(n.items||[]).map((t=>({...t,group_title:n.title,group_type:n.type})))}))),a={type:"all",title:salla.lang.get("pages.loyalty_program.all"),items:t.reduce(((n,t)=>n.concat(t.items)),[])};return t.unshift(a),{...n,prizes:t,prizes_count:a.items.length,points:n.points??[]}}function l(n){return[n.name.replace(/\s/g,"-"),`brand-${n.id}`].join("/")}function r(t){return"number"==typeof t?n("span",null,t," ",salla.lang.get("pages.loyalty_program.point")):function(n){for(const t of n.conditions??[])if(t.key?.endsWith("_FOR_UNIT"))return!0;return!1}(t)?n("span",null,"1 ",salla.config.currency().symbol," = ",t.points," ",salla.lang.get("pages.loyalty_program.point")):n("span",null,t.points," ",salla.lang.get("pages.loyalty_program.point"))}export{t as a,l as b,a as c,r as f,o as n}