@everymatrix/loyalty-shop 0.1.22 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- var B=(f,o,l)=>new Promise((r,y)=>{var d=a=>{try{c(l.next(a))}catch(_){y(_)}},p=a=>{try{c(l.throw(a))}catch(_){y(_)}},c=a=>a.done?r(a.value):Promise.resolve(a.value).then(d,p);c((l=l.apply(f,o)).next())});typeof globalThis.HTMLElement=="undefined"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const e=require("./LoyaltyPagination-ChnSUs6d.cjs"),be=require("./LoyaltyShopItem-DpFV9qnk.cjs");if(typeof window!="undefined"){let f=function(o){return function(...l){try{return o.apply(this,l)}catch(r){if(r instanceof DOMException&&r.message.includes("has already been used with this registry")||r instanceof Error&&r.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw r}}};customElements.define=f(customElements.define),Promise.resolve().then(()=>require("./LoyaltyPagination-ChnSUs6d.cjs")).then(o=>o.LoyaltyPagination_ce).then(o=>{const l=o.default||o;customElements.get("loyalty-pagination")||customElements.define("loyalty-pagination",l.element||l)}).catch(o=>{console.error("BOOT ERROR:",o)})}if(typeof window!="undefined"){let f=function(o){return function(...l){try{return o.apply(this,l)}catch(r){if(r instanceof DOMException&&r.message.includes("has already been used with this registry")||r instanceof Error&&r.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw r}}};customElements.define=f(customElements.define),Promise.resolve().then(()=>require("./LoyaltyShopItem-DpFV9qnk.cjs")).then(o=>o.LoyaltyShopItem_ce).then(o=>{const l=o.default||o;customElements.get("loyalty-shop-item")||customElements.define("loyalty-shop-item",l.element||l)}).catch(o=>{console.error("BOOT ERROR:",o)})}const ke={en:{loading:"Loading…",noContent:"There are no bonus items available for redemption.",networkProblem:"Network problem. Please reload.",tokens:"Tokens",buyNow:"Buy Now",generalError:"Something went wrong... Please try again."},tr:{loading:"Yükleniyor…",noContent:"Kullanılabilir bonus öğesi bulunmamaktadır.",networkProblem:"Ağ sorunu. Lütfen yeniden yükleyin.",tokens:"Tokens",buyNow:"Satın Al",generalError:"Bir sorun oluştu, lütfen tekrar deneyin."},da:{loading:"Indlæser…",noContent:"Der er ingen bonusgenstande tilgængelige til indløsning.",networkProblem:"Netværksproblem. Genindlæs venligst siden.",tokens:"Tokens",buyNow:"Køb nu",generalError:"Noget gik galt. Prøv venligst igen."},de:{loading:"Wird geladen…",noContent:"Es sind keine Bonusartikel zum Einlösen verfügbar.",networkProblem:"Netzwerkproblem. Bitte lade die Seite neu.",tokens:"Token",buyNow:"Jetzt kaufen",generalError:"Etwas ist schiefgelaufen. Bitte versuche es erneut."},nl:{loading:"Laden…",noContent:"Er zijn geen bonusitems beschikbaar om in te wisselen.",networkProblem:"Netwerkprobleem. Laad de pagina opnieuw.",tokens:"Tokens",buyNow:"Nu kopen",generalError:"Er is iets misgegaan. Probeer het opnieuw."},fr:{loading:"Chargement…",noContent:"Aucun bonus n'est disponible pour être échangé.",networkProblem:"Problème de réseau. Veuillez recharger la page.",tokens:"Jetons",buyNow:"Acheter",generalError:"Une erreur s'est produite. Veuillez réessayer."},hu:{loading:"Betöltés…",noContent:"Nincsenek beváltható bónuszok.",networkProblem:"Hálózati probléma. Kérjük, töltsd újra az oldalt.",tokens:"Tokenek",buyNow:"Vásárlás",generalError:"Hiba történt. Kérjük, próbáld újra."}},we="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='800px'%20height='800px'%20viewBox='0%200%20120%20120'%20fill='none'%3e%3crect%20width='120'%20height='120'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.2503%2038.4816C33.2603%2037.0472%2034.4199%2035.8864%2035.8543%2035.875H83.1463C84.5848%2035.875%2085.7503%2037.0431%2085.7503%2038.4816V80.5184C85.7403%2081.9528%2084.5807%2083.1136%2083.1463%2083.125H35.8543C34.4158%2083.1236%2033.2503%2081.957%2033.2503%2080.5184V38.4816ZM80.5006%2041.1251H38.5006V77.8751L62.8921%2053.4783C63.9172%2052.4536%2065.5788%2052.4536%2066.6039%2053.4783L80.5006%2067.4013V41.1251ZM43.75%2051.6249C43.75%2054.5244%2046.1005%2056.8749%2049%2056.8749C51.8995%2056.8749%2054.25%2054.5244%2054.25%2051.6249C54.25%2048.7254%2051.8995%2046.3749%2049%2046.3749C46.1005%2046.3749%2043.75%2048.7254%2043.75%2051.6249Z'%20fill='%23687787'/%3e%3c/svg%3e";var Ee=e.from_html('<div class="loyalty-shop__item loyalty-shop__item--skeleton svelte-1f1q033"><div class="loyalty-shop__item-image skeleton-box svelte-1f1q033"></div> <div class="loyalty-shop__item-title skeleton-line svelte-1f1q033"></div> <div class="loyalty-shop__item-points skeleton-line skeleton-line--short svelte-1f1q033"></div> <div class="loyalty-shop__item-button-skeleton skeleton-box svelte-1f1q033"></div></div>'),xe=e.from_html('<div class="loyalty-shop__grid loyalty-shop__grid--skeleton svelte-1f1q033"></div>'),Se=e.from_html('<div class="loyalty-shop__unavailable svelte-1f1q033"> </div>'),qe=e.from_html('<div><div role="button" tabindex="0" class="loyalty-shop__item-image-container svelte-1f1q033"><img class="loyalty-shop__item-image svelte-1f1q033"/></div> <span class="loyalty-shop__item-title svelte-1f1q033"> </span> <span class="loyalty-shop__item-points svelte-1f1q033"> </span> <button class="loyalty-shop__item-button svelte-1f1q033" type="button"> </button></div>'),Ie=e.from_html('<div class="load-more-sentinel svelte-1f1q033" aria-hidden="true"></div>'),Le=e.from_html('<div class="loyalty-shop__grid svelte-1f1q033"></div> <!> <!>',1),Te=e.from_html('<div class="loyalty-shop svelte-1f1q033"><!></div>');const Me={hash:"svelte-1f1q033",code:`.loyalty-shop.svelte-1f1q033 {padding:16px;border-radius:6px;border:1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));background-color:var(--app-container-bg-default, #022652);width:100%;box-sizing:border-box;display:flex;flex-direction:column;gap:16px;}.loyalty-shop__unavailable.svelte-1f1q033 {color:var(--text-subtle, #dfe3e8);font-size:14px;padding:24px 0;text-align:center;}.loyalty-shop__grid.svelte-1f1q033 {display:grid;gap:16px;grid-template-columns:repeat(2, 1fr);margin:0;}.loyalty-shop__item.svelte-1f1q033 {display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:10px;border:1px solid var(--border-default, rgba(251, 251, 251, 0.15));background-color:var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1));}.loyalty-shop__item--unavailable.svelte-1f1q033 {opacity:1;}.loyalty-shop__item-image.svelte-1f1q033 {width:100%;height:82px;border-radius:6px;}.loyalty-shop__item-title.svelte-1f1q033 {color:var(--text-default, #ffffff);font-size:12px;font-weight:400;}.loyalty-shop__item-points.svelte-1f1q033 {color:var(--text-subtle, #dfe3e8);font-size:14px;font-weight:400;}.loyalty-shop__item-button.svelte-1f1q033 {margin-top:auto;width:100%;height:37px;padding:8px 16px;border:none;border-radius:6px;background:var(--button-primary-bg-default, #ffcc00);color:var(--button-primary-text-default, #261d00);font-size:12px;font-weight:400;cursor:pointer;}.loyalty-shop__item-button.svelte-1f1q033:disabled {opacity:0.4;cursor:default;}.skeleton-box.svelte-1f1q033 {background:linear-gradient(
1
+ var B=(f,o,l)=>new Promise((r,y)=>{var d=a=>{try{c(l.next(a))}catch(_){y(_)}},p=a=>{try{c(l.throw(a))}catch(_){y(_)}},c=a=>a.done?r(a.value):Promise.resolve(a.value).then(d,p);c((l=l.apply(f,o)).next())});typeof globalThis.HTMLElement=="undefined"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const e=require("./LoyaltyPagination-ChnSUs6d.cjs"),be=require("./LoyaltyShopItem-CJk-XfSP.cjs");if(typeof window!="undefined"){let f=function(o){return function(...l){try{return o.apply(this,l)}catch(r){if(r instanceof DOMException&&r.message.includes("has already been used with this registry")||r instanceof Error&&r.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw r}}};customElements.define=f(customElements.define),Promise.resolve().then(()=>require("./LoyaltyPagination-ChnSUs6d.cjs")).then(o=>o.LoyaltyPagination_ce).then(o=>{const l=o.default||o;customElements.get("loyalty-pagination")||customElements.define("loyalty-pagination",l.element||l)}).catch(o=>{console.error("BOOT ERROR:",o)})}if(typeof window!="undefined"){let f=function(o){return function(...l){try{return o.apply(this,l)}catch(r){if(r instanceof DOMException&&r.message.includes("has already been used with this registry")||r instanceof Error&&r.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw r}}};customElements.define=f(customElements.define),Promise.resolve().then(()=>require("./LoyaltyShopItem-CJk-XfSP.cjs")).then(o=>o.LoyaltyShopItem_ce).then(o=>{const l=o.default||o;customElements.get("loyalty-shop-item")||customElements.define("loyalty-shop-item",l.element||l)}).catch(o=>{console.error("BOOT ERROR:",o)})}const ke={en:{loading:"Loading…",noContent:"There are no bonus items available for redemption.",networkProblem:"Network problem. Please reload.",tokens:"Tokens",buyNow:"Buy Now",generalError:"Something went wrong... Please try again."},tr:{loading:"Yükleniyor…",noContent:"Kullanılabilir bonus öğesi bulunmamaktadır.",networkProblem:"Ağ sorunu. Lütfen yeniden yükleyin.",tokens:"Tokens",buyNow:"Satın Al",generalError:"Bir sorun oluştu, lütfen tekrar deneyin."},da:{loading:"Indlæser…",noContent:"Der er ingen bonusgenstande tilgængelige til indløsning.",networkProblem:"Netværksproblem. Genindlæs venligst siden.",tokens:"Tokens",buyNow:"Køb nu",generalError:"Noget gik galt. Prøv venligst igen."},de:{loading:"Wird geladen…",noContent:"Es sind keine Bonusartikel zum Einlösen verfügbar.",networkProblem:"Netzwerkproblem. Bitte lade die Seite neu.",tokens:"Token",buyNow:"Jetzt kaufen",generalError:"Etwas ist schiefgelaufen. Bitte versuche es erneut."},nl:{loading:"Laden…",noContent:"Er zijn geen bonusitems beschikbaar om in te wisselen.",networkProblem:"Netwerkprobleem. Laad de pagina opnieuw.",tokens:"Tokens",buyNow:"Nu kopen",generalError:"Er is iets misgegaan. Probeer het opnieuw."},fr:{loading:"Chargement…",noContent:"Aucun bonus n'est disponible pour être échangé.",networkProblem:"Problème de réseau. Veuillez recharger la page.",tokens:"Jetons",buyNow:"Acheter",generalError:"Une erreur s'est produite. Veuillez réessayer."},hu:{loading:"Betöltés…",noContent:"Nincsenek beváltható bónuszok.",networkProblem:"Hálózati probléma. Kérjük, töltsd újra az oldalt.",tokens:"Tokenek",buyNow:"Vásárlás",generalError:"Hiba történt. Kérjük, próbáld újra."}},we="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='800px'%20height='800px'%20viewBox='0%200%20120%20120'%20fill='none'%3e%3crect%20width='120'%20height='120'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.2503%2038.4816C33.2603%2037.0472%2034.4199%2035.8864%2035.8543%2035.875H83.1463C84.5848%2035.875%2085.7503%2037.0431%2085.7503%2038.4816V80.5184C85.7403%2081.9528%2084.5807%2083.1136%2083.1463%2083.125H35.8543C34.4158%2083.1236%2033.2503%2081.957%2033.2503%2080.5184V38.4816ZM80.5006%2041.1251H38.5006V77.8751L62.8921%2053.4783C63.9172%2052.4536%2065.5788%2052.4536%2066.6039%2053.4783L80.5006%2067.4013V41.1251ZM43.75%2051.6249C43.75%2054.5244%2046.1005%2056.8749%2049%2056.8749C51.8995%2056.8749%2054.25%2054.5244%2054.25%2051.6249C54.25%2048.7254%2051.8995%2046.3749%2049%2046.3749C46.1005%2046.3749%2043.75%2048.7254%2043.75%2051.6249Z'%20fill='%23687787'/%3e%3c/svg%3e";var Ee=e.from_html('<div class="loyalty-shop__item loyalty-shop__item--skeleton svelte-1f1q033"><div class="loyalty-shop__item-image skeleton-box svelte-1f1q033"></div> <div class="loyalty-shop__item-title skeleton-line svelte-1f1q033"></div> <div class="loyalty-shop__item-points skeleton-line skeleton-line--short svelte-1f1q033"></div> <div class="loyalty-shop__item-button-skeleton skeleton-box svelte-1f1q033"></div></div>'),xe=e.from_html('<div class="loyalty-shop__grid loyalty-shop__grid--skeleton svelte-1f1q033"></div>'),Se=e.from_html('<div class="loyalty-shop__unavailable svelte-1f1q033"> </div>'),qe=e.from_html('<div><div role="button" tabindex="0" class="loyalty-shop__item-image-container svelte-1f1q033"><img class="loyalty-shop__item-image svelte-1f1q033"/></div> <span class="loyalty-shop__item-title svelte-1f1q033"> </span> <span class="loyalty-shop__item-points svelte-1f1q033"> </span> <button class="loyalty-shop__item-button svelte-1f1q033" type="button"> </button></div>'),Ie=e.from_html('<div class="load-more-sentinel svelte-1f1q033" aria-hidden="true"></div>'),Le=e.from_html('<div class="loyalty-shop__grid svelte-1f1q033"></div> <!> <!>',1),Te=e.from_html('<div class="loyalty-shop svelte-1f1q033"><!></div>');const Me={hash:"svelte-1f1q033",code:`.loyalty-shop.svelte-1f1q033 {padding:16px;border-radius:6px;border:1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));background-color:var(--app-container-bg-default, #022652);width:100%;box-sizing:border-box;display:flex;flex-direction:column;gap:16px;}.loyalty-shop__unavailable.svelte-1f1q033 {color:var(--text-subtle, #dfe3e8);font-size:14px;padding:24px 0;text-align:center;}.loyalty-shop__grid.svelte-1f1q033 {display:grid;gap:16px;grid-template-columns:repeat(2, 1fr);margin:0;}.loyalty-shop__item.svelte-1f1q033 {display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:10px;border:1px solid var(--border-default, rgba(251, 251, 251, 0.15));background-color:var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1));}.loyalty-shop__item--unavailable.svelte-1f1q033 {opacity:1;}.loyalty-shop__item-image.svelte-1f1q033 {width:100%;height:82px;border-radius:6px;}.loyalty-shop__item-title.svelte-1f1q033 {color:var(--text-default, #ffffff);font-size:12px;font-weight:400;}.loyalty-shop__item-points.svelte-1f1q033 {color:var(--text-subtle, #dfe3e8);font-size:14px;font-weight:400;}.loyalty-shop__item-button.svelte-1f1q033 {margin-top:auto;width:100%;height:37px;padding:8px 16px;border:none;border-radius:6px;background:var(--button-primary-bg-default, #ffcc00);color:var(--button-primary-text-default, #261d00);font-size:12px;font-weight:400;cursor:pointer;}.loyalty-shop__item-button.svelte-1f1q033:disabled {opacity:0.4;cursor:default;}.skeleton-box.svelte-1f1q033 {background:linear-gradient(
2
2
  90deg,
3
3
  var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1)) 0%,
4
4
  color-mix(in srgb, var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1)) 80%, white) 50%,
@@ -23,5 +23,5 @@ var B=(f,o,l)=>new Promise((r,y)=>{var d=a=>{try{c(l.next(a))}catch(_){y(_)}},p=
23
23
  }
24
24
 
25
25
  @media (min-width: 768px) {.loyalty-shop__grid.svelte-1f1q033 {grid-template-columns:repeat(4, 1fr);justify-content:start;margin:0;}.loyalty-shop__item.svelte-1f1q033 {width:100%;height:100%;box-sizing:border-box;}.loyalty-shop__item-image.svelte-1f1q033 {height:200px;}.loyalty-shop__item--skeleton.svelte-1f1q033 .loyalty-shop__item-image:where(.svelte-1f1q033) {height:200px;}
26
- }`};function j(f,o){e.push(o,!0),e.append_styles(f,Me);const l=()=>e.store_get(e.$format,"$_",r),[r,y]=e.setup_stores(),d=e.prop(o,"apiEndpoint",7,""),p=e.prop(o,"userSession",7,""),c=e.prop(o,"locale",7,""),a=e.prop(o,"limitItem",7,e.ITEMS_LIMIT_DEFAULT),_=e.prop(o,"translationUrl");e.setupI18n({withLocale:c(),translations:{}});const G=()=>B(this,null,function*(){try{const t=new URL(_(),window.location.href),n=yield fetch(t.href);if(!n.ok)throw new Error("Failed to fetch translations");const s=yield n.json();Object.entries(s).forEach(([i,h])=>{e.addNewMessages(i,h)})}catch(t){console.error("loyalty shop translation url err:",t)}});Object.entries(ke).forEach(([t,n])=>{e.addNewMessages(t,n)});let m=e.state(e.proxy([])),x=e.state(void 0),I=e.state(0),b=e.state(0),w=e.state(e.proxy(e.MOBILE_LOAD_ITEMS)),R=e.state(!1),N=e.state(!1),S=e.state(void 0),k=e.state(!1),L=e.state(void 0),T=0;const Q=e.user_derived(()=>typeof a()=="number"?a():parseInt(a(),e.ITEMS_LIMIT_DEFAULT)||e.ITEMS_LIMIT_DEFAULT),F=()=>{if(!d()||!p())return;e.set(R,!0),e.set(N,!1);const t=++T,n=e.get(k)&&e.get(b)>0;e.fetchShopRewards({apiEndpoint:d(),userSession:p(),locale:c()},e.get(b),e.get(w)).then(s=>{var h,v;if(t!==T)return;const i=(h=s.data)!=null?h:[];e.set(I,(v=s.total)!=null?v:0,!0),n?e.set(m,[...e.get(m),...i],!0):e.set(m,i,!0)}).catch(s=>{t===T&&(e.set(N,!0),console.error("Failed to load shop rewards:",s))}).finally(()=>{t===T&&e.set(R,!1)})};e.user_effect(()=>{d(),p(),c(),e.get(b),e.get(w),F()}),e.user_effect(()=>{const t=window.matchMedia("(max-width: 767px)"),n=s=>{e.set(k,s.matches,!0)};return e.set(k,t.matches,!0),t.addEventListener("change",n),()=>t.removeEventListener("change",n)}),e.user_effect(()=>{e.set(w,e.get(k)?e.MOBILE_LOAD_ITEMS:e.get(Q),!0)}),e.user_effect(()=>{if(!e.get(k)||!e.get(L))return;const t=new IntersectionObserver(n=>{n.some(s=>s.isIntersecting)&&e.get(m).length<e.get(I)&&e.set(b,e.get(b)+e.get(w))},{rootMargin:"200px"});return t.observe(e.get(L)),()=>t.disconnect()}),e.user_pre_effect(()=>{_()&&G()});const X=t=>{var n,s,i;return(i=(s=(n=t.presentation)==null?void 0:n.assets)==null?void 0:s[0])!=null?i:we},O=t=>{var n,s,i;return(i=(s=t.displayName)!=null?s:(n=t.presentation)==null?void 0:n.displayName)!=null?i:""},P=t=>t.available==="true",$=t=>{e.get(S)||!P(t)||e.sendRedeemRewardRequested(O(t),t.id)},ee=t=>B(this,null,function*(){if(!(!d()||e.get(S))){e.set(S,t,!0);try{yield e.redeemReward({apiEndpoint:d(),userSession:p()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton(),F()}catch(n){e.sendRedeemRewardFailed(t,n)}finally{e.set(S,void 0)}}});e.user_effect(()=>{const t=n=>{var v;const{type:s,id:i,source:h}=(v=n.data)!=null?v:{};switch(s){case e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED:i&&e.get(m).some(q=>q.id===i)&&ee(i);break;case e.EVENT_TYPES.BACK_BUTTON_CLICKED:h===e.SOURCE&&e.set(x,void 0);break}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});const te=()=>e.get(m).length?l()("generalError"):l()("noContent"),ne=t=>{e.set(b,t,!0)},oe=t=>{e.sendRewardItemClicked(t.displayName||t.presentation.displayName,t.id)},V=t=>{e.set(x,t,!0),oe(t)},se=t=>n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),V(t))};var le={get apiEndpoint(){return d()},set apiEndpoint(t=""){d(t),e.flushSync()},get userSession(){return p()},set userSession(t=""){p(t),e.flushSync()},get locale(){return c()},set locale(t=""){c(t),e.flushSync()},get limitItem(){return a()},set limitItem(t=e.ITEMS_LIMIT_DEFAULT){a(t),e.flushSync()},get translationUrl(){return _()},set translationUrl(t){_(t),e.flushSync()}},U=Te(),ae=e.child(U);{var ie=t=>{be.LoyaltyShopItem(t,{get itemId(){return e.get(x).id},get elevateReward(){return e.get(x)},get apiEndpoint(){return d()},get userSession(){return p()},get locale(){return c()}})},re=t=>{var n=xe();e.each(n,21,()=>Array(e.get(w)),e.index,(s,i,h,v)=>{var q=Ee();e.append(s,q)}),e.reset(n),e.append(t,n)},de=t=>{var n=Se(),s=e.only_child(n,!0);e.template_effect(i=>e.set_text(s,i),[()=>te()]),e.append(t,n)},pe=t=>{var n=Le(),s=e.first_child(n);e.each(s,21,()=>e.get(m),u=>u.id,(u,g)=>{var E=qe();let H;var M=e.child(E),ge=e.user_derived(()=>se(e.get(g))),K=e.only_child(M),Y=e.sibling(M,2),ue=e.only_child(Y,!0),Z=e.sibling(Y,2),fe=e.only_child(Z),D=e.sibling(Z,2),me=e.only_child(D,!0);e.reset(E),e.template_effect((A,C,he,ye,z,_e,ve)=>{var J;H=e.set_class(E,1,"loyalty-shop__item svelte-1f1q033",null,H,{"loyalty-shop__item--unavailable":A}),e.set_attribute(K,"src",C),e.set_attribute(K,"alt",he),e.set_text(ue,ye),e.set_text(fe,`${(J=e.get(g).points)!=null?J:""}
27
- ${z!=null?z:""}`),D.disabled=_e,e.set_text(me,ve)},[()=>!P(e.get(g)),()=>X(e.get(g)),()=>O(e.get(g)),()=>O(e.get(g)),()=>l()("tokens"),()=>!P(e.get(g))||e.get(S)===e.get(g).id,()=>l()("buyNow")]),e.delegated("click",M,()=>V(e.get(g))),e.delegated("keydown",M,function(...A){var C;(C=e.get(ge))==null||C.apply(this,A)}),e.delegated("click",D,()=>$(e.get(g))),e.append(u,E)}),e.reset(s);var i=e.sibling(s,2);{var h=u=>{e.LoyaltyPagination(u,{get offset(){return e.get(b)},get limit(){return e.get(w)},get total(){return e.get(I)},onPageChange:ne,get locale(){return c()}})};e.if_block(i,u=>{e.get(k)||u(h)})}var v=e.sibling(i,2);{var q=u=>{var g=Ie();e.bind_this(g,E=>e.set(L,E),()=>e.get(L)),e.append(u,g)};e.if_block(v,u=>{e.get(k)&&e.get(m).length<e.get(I)&&u(q)})}e.append(t,n)};e.if_block(ae,t=>{e.get(x)?t(ie):e.get(R)&&e.get(m).length===0?t(re,1):!e.get(m).length||e.get(N)?t(de,2):t(pe,-1)})}e.reset(U),e.append(f,U);var ce=e.pop(le);return y(),ce}e.delegate(["click","keydown"]);e.create_custom_element(j,{apiEndpoint:{},userSession:{},locale:{},limitItem:{},translationUrl:{}},[],[],{mode:"open"});function W(f,o){e.push(o,!0);let l=e.prop(o,"apiEndpoint",7,""),r=e.prop(o,"userSession",7,""),y=e.prop(o,"locale",7,""),d=e.prop(o,"limitItem",7,e.ITEMS_LIMIT_DEFAULT),p=e.prop(o,"translationUrl");var c={get apiEndpoint(){return l()},set apiEndpoint(a=""){l(a),e.flushSync()},get userSession(){return r()},set userSession(a=""){r(a),e.flushSync()},get locale(){return y()},set locale(a=""){y(a),e.flushSync()},get limitItem(){return d()},set limitItem(a=e.ITEMS_LIMIT_DEFAULT){d(a),e.flushSync()},get translationUrl(){return p()},set translationUrl(a){p(a),e.flushSync()}};return j(f,{get apiEndpoint(){return l()},get userSession(){return r()},get locale(){return y()},get limitItem(){return d()},get translationUrl(){return p()}}),e.pop(c)}customElements.define("loyalty-shop",e.create_custom_element(W,{apiEndpoint:{},userSession:{},locale:{},limitItem:{},translationUrl:{}},[],[]));const Ce=Object.freeze(Object.defineProperty({__proto__:null,default:W},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShop=j;exports.LoyaltyShop_ce=Ce;
26
+ }`};function j(f,o){e.push(o,!0),e.append_styles(f,Me);const l=()=>e.store_get(e.$format,"$_",r),[r,y]=e.setup_stores(),d=e.prop(o,"apiEndpoint",7,""),p=e.prop(o,"userSession",7,""),c=e.prop(o,"locale",7,""),a=e.prop(o,"limitItem",7,e.ITEMS_LIMIT_DEFAULT),_=e.prop(o,"translationUrl");e.setupI18n({withLocale:c(),translations:{}});const G=()=>B(this,null,function*(){try{const t=new URL(_(),window.location.href),n=yield fetch(t.href);if(!n.ok)throw new Error("Failed to fetch translations");const s=yield n.json();Object.entries(s).forEach(([i,h])=>{e.addNewMessages(i,h)})}catch(t){console.error("loyalty shop translation url err:",t)}});Object.entries(ke).forEach(([t,n])=>{e.addNewMessages(t,n)});let m=e.state(e.proxy([])),w=e.state(void 0),I=e.state(0),b=e.state(0),E=e.state(e.proxy(e.MOBILE_LOAD_ITEMS)),R=e.state(!1),N=e.state(!1),S=e.state(void 0),k=e.state(!1),L=e.state(void 0),T=0;const Q=e.user_derived(()=>typeof a()=="number"?a():parseInt(a(),e.ITEMS_LIMIT_DEFAULT)||e.ITEMS_LIMIT_DEFAULT),F=()=>{if(!d()||!p())return;e.set(R,!0),e.set(N,!1);const t=++T,n=e.get(k)&&e.get(b)>0;e.fetchShopRewards({apiEndpoint:d(),userSession:p(),locale:c()},e.get(b),e.get(E)).then(s=>{var h,v;if(t!==T)return;const i=(h=s.data)!=null?h:[];e.set(I,(v=s.total)!=null?v:0,!0),n?e.set(m,[...e.get(m),...i],!0):e.set(m,i,!0)}).catch(s=>{t===T&&(e.set(N,!0),console.error("Failed to load shop rewards:",s))}).finally(()=>{t===T&&e.set(R,!1)})};e.user_effect(()=>{d(),p(),c(),e.get(b),e.get(E),F()}),e.user_effect(()=>{const t=window.matchMedia("(max-width: 767px)"),n=s=>{e.set(k,s.matches,!0)};return e.set(k,t.matches,!0),t.addEventListener("change",n),()=>t.removeEventListener("change",n)}),e.user_effect(()=>{e.set(E,e.get(k)?e.MOBILE_LOAD_ITEMS:e.get(Q),!0)}),e.user_effect(()=>{if(!e.get(k)||!e.get(L))return;const t=new IntersectionObserver(n=>{n.some(s=>s.isIntersecting)&&e.get(m).length<e.get(I)&&e.set(b,e.get(b)+e.get(E))},{rootMargin:"200px"});return t.observe(e.get(L)),()=>t.disconnect()}),e.user_pre_effect(()=>{_()&&G()});const X=t=>{var n,s,i;return(i=(s=(n=t.presentation)==null?void 0:n.assets)==null?void 0:s[0])!=null?i:we},O=t=>{var n,s,i;return(i=(s=t.displayName)!=null?s:(n=t.presentation)==null?void 0:n.displayName)!=null?i:""},P=t=>t.available==="true",$=t=>{e.get(S)||!P(t)||e.sendRedeemRewardRequested(O(t),t.id)},ee=t=>B(this,null,function*(){if(!(!d()||e.get(S))){e.set(S,t,!0);try{yield e.redeemReward({apiEndpoint:d(),userSession:p()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton(),F()}catch(n){e.sendRedeemRewardFailed(t,n)}finally{e.set(S,void 0)}}});e.user_effect(()=>{const t=n=>{var v;const{type:s,id:i,source:h}=(v=n.data)!=null?v:{};switch(s){case e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED:if(e.get(w))break;i&&e.get(m).some(q=>q.id===i)&&ee(i);break;case e.EVENT_TYPES.BACK_BUTTON_CLICKED:h===e.SOURCE&&e.set(w,void 0);break}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});const te=()=>e.get(m).length?l()("generalError"):l()("noContent"),ne=t=>{e.set(b,t,!0)},oe=t=>{e.sendRewardItemClicked(t.displayName||t.presentation.displayName,t.id)},V=t=>{e.set(w,t,!0),oe(t)},se=t=>n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),V(t))};var le={get apiEndpoint(){return d()},set apiEndpoint(t=""){d(t),e.flushSync()},get userSession(){return p()},set userSession(t=""){p(t),e.flushSync()},get locale(){return c()},set locale(t=""){c(t),e.flushSync()},get limitItem(){return a()},set limitItem(t=e.ITEMS_LIMIT_DEFAULT){a(t),e.flushSync()},get translationUrl(){return _()},set translationUrl(t){_(t),e.flushSync()}},U=Te(),ae=e.child(U);{var ie=t=>{be.LoyaltyShopItem(t,{get itemId(){return e.get(w).id},get elevateReward(){return e.get(w)},get apiEndpoint(){return d()},get userSession(){return p()},get locale(){return c()}})},re=t=>{var n=xe();e.each(n,21,()=>Array(e.get(E)),e.index,(s,i,h,v)=>{var q=Ee();e.append(s,q)}),e.reset(n),e.append(t,n)},de=t=>{var n=Se(),s=e.only_child(n,!0);e.template_effect(i=>e.set_text(s,i),[()=>te()]),e.append(t,n)},pe=t=>{var n=Le(),s=e.first_child(n);e.each(s,21,()=>e.get(m),u=>u.id,(u,g)=>{var x=qe();let H;var M=e.child(x),ge=e.user_derived(()=>se(e.get(g))),K=e.only_child(M),Y=e.sibling(M,2),ue=e.only_child(Y,!0),Z=e.sibling(Y,2),fe=e.only_child(Z),D=e.sibling(Z,2),me=e.only_child(D,!0);e.reset(x),e.template_effect((A,C,he,ye,z,_e,ve)=>{var J;H=e.set_class(x,1,"loyalty-shop__item svelte-1f1q033",null,H,{"loyalty-shop__item--unavailable":A}),e.set_attribute(K,"src",C),e.set_attribute(K,"alt",he),e.set_text(ue,ye),e.set_text(fe,`${(J=e.get(g).points)!=null?J:""}
27
+ ${z!=null?z:""}`),D.disabled=_e,e.set_text(me,ve)},[()=>!P(e.get(g)),()=>X(e.get(g)),()=>O(e.get(g)),()=>O(e.get(g)),()=>l()("tokens"),()=>!P(e.get(g))||e.get(S)===e.get(g).id,()=>l()("buyNow")]),e.delegated("click",M,()=>V(e.get(g))),e.delegated("keydown",M,function(...A){var C;(C=e.get(ge))==null||C.apply(this,A)}),e.delegated("click",D,()=>$(e.get(g))),e.append(u,x)}),e.reset(s);var i=e.sibling(s,2);{var h=u=>{e.LoyaltyPagination(u,{get offset(){return e.get(b)},get limit(){return e.get(E)},get total(){return e.get(I)},onPageChange:ne,get locale(){return c()}})};e.if_block(i,u=>{e.get(k)||u(h)})}var v=e.sibling(i,2);{var q=u=>{var g=Ie();e.bind_this(g,x=>e.set(L,x),()=>e.get(L)),e.append(u,g)};e.if_block(v,u=>{e.get(k)&&e.get(m).length<e.get(I)&&u(q)})}e.append(t,n)};e.if_block(ae,t=>{e.get(w)?t(ie):e.get(R)&&e.get(m).length===0?t(re,1):!e.get(m).length||e.get(N)?t(de,2):t(pe,-1)})}e.reset(U),e.append(f,U);var ce=e.pop(le);return y(),ce}e.delegate(["click","keydown"]);e.create_custom_element(j,{apiEndpoint:{},userSession:{},locale:{},limitItem:{},translationUrl:{}},[],[],{mode:"open"});function W(f,o){e.push(o,!0);let l=e.prop(o,"apiEndpoint",7,""),r=e.prop(o,"userSession",7,""),y=e.prop(o,"locale",7,""),d=e.prop(o,"limitItem",7,e.ITEMS_LIMIT_DEFAULT),p=e.prop(o,"translationUrl");var c={get apiEndpoint(){return l()},set apiEndpoint(a=""){l(a),e.flushSync()},get userSession(){return r()},set userSession(a=""){r(a),e.flushSync()},get locale(){return y()},set locale(a=""){y(a),e.flushSync()},get limitItem(){return d()},set limitItem(a=e.ITEMS_LIMIT_DEFAULT){d(a),e.flushSync()},get translationUrl(){return p()},set translationUrl(a){p(a),e.flushSync()}};return j(f,{get apiEndpoint(){return l()},get userSession(){return r()},get locale(){return y()},get limitItem(){return d()},get translationUrl(){return p()}}),e.pop(c)}customElements.define("loyalty-shop",e.create_custom_element(W,{apiEndpoint:{},userSession:{},locale:{},limitItem:{},translationUrl:{}},[],[]));const Ce=Object.freeze(Object.defineProperty({__proto__:null,default:W},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShop=j;exports.LoyaltyShop_ce=Ce;
@@ -14,8 +14,8 @@ var X = (f, s, o) => new Promise((r, k) => {
14
14
  }, p = (l) => l.done ? r(l.value) : Promise.resolve(l.value).then(u, c);
15
15
  p((o = o.apply(f, s)).next());
16
16
  });
17
- import { z as Ze, c as ye, p as ve, a as Je, b as v, s as We, d as re, A as y, B as de, P as ue, E as O, m as t, F as d, C as Ye, H as ce, S as Ge, i as $, h as S, j as be, Q as L, R as Qe, u as pe, I as Xe, J as $e, K as et, L as tt, w as I, k as b, l as nt, n as me, r as V, T as ge, U as st, o as z, t as fe, v as H, g as at, q as P, x as ot, $ as lt, V as it, O as he, M as ee, W as rt, X as dt, N as ut, Y as ct } from "./LoyaltyPagination-o3rQCgms.js";
18
- import { L as pt } from "./LoyaltyShopItem-DxwkafBG.js";
17
+ import { z as Ze, c as ye, p as ve, a as Je, b as v, s as We, d as re, A as y, B as de, P as ue, E as O, m as t, F as d, C as Ye, H as ce, S as Ge, i as $, h as S, j as be, Q as N, R as Qe, u as pe, I as Xe, J as $e, K as et, L as tt, w as I, k as b, l as nt, n as me, r as V, T as ge, U as st, o as z, t as fe, v as H, g as at, q as P, x as ot, $ as lt, V as it, O as he, M as ee, W as rt, X as dt, N as ut, Y as ct } from "./LoyaltyPagination-o3rQCgms.js";
18
+ import { L as pt } from "./LoyaltyShopItem-DVSebOOP.js";
19
19
  typeof globalThis.HTMLElement == "undefined" && (globalThis.HTMLElement = class {
20
20
  }, globalThis.customElements = { define() {
21
21
  }, get() {
@@ -52,7 +52,7 @@ if (typeof window != "undefined") {
52
52
  }
53
53
  };
54
54
  };
55
- customElements.define = f(customElements.define), import("./LoyaltyShopItem-DxwkafBG.js").then((s) => s.a).then((s) => {
55
+ customElements.define = f(customElements.define), import("./LoyaltyShopItem-DVSebOOP.js").then((s) => s.a).then((s) => {
56
56
  const o = s.default || s;
57
57
  customElements.get("loyalty-shop-item") || customElements.define("loyalty-shop-item", o.element || o);
58
58
  }).catch((s) => {
@@ -149,7 +149,7 @@ const wt = {
149
149
  };
150
150
  function _e(f, s) {
151
151
  ve(s, !0), Je(f, wt);
152
- const o = () => ot(lt, "$_", r), [r, k] = nt(), u = v(s, "apiEndpoint", 7, ""), c = v(s, "userSession", 7, ""), p = v(s, "locale", 7, ""), l = v(s, "limitItem", 7, L), w = v(s, "translationUrl");
152
+ const o = () => ot(lt, "$_", r), [r, k] = nt(), u = v(s, "apiEndpoint", 7, ""), c = v(s, "userSession", 7, ""), p = v(s, "locale", 7, ""), l = v(s, "limitItem", 7, N), w = v(s, "translationUrl");
153
153
  We({ withLocale: p(), translations: {} });
154
154
  const we = () => X(this, null, function* () {
155
155
  try {
@@ -167,8 +167,8 @@ function _e(f, s) {
167
167
  Object.entries(mt).forEach(([e, n]) => {
168
168
  re(e, n);
169
169
  });
170
- let h = y(de([])), N = y(void 0), U = y(0), E = y(0), C = y(de(ue)), K = y(!1), F = y(!1), T = y(void 0), q = y(!1), B = y(void 0), A = 0;
171
- const xe = pe(() => typeof l() == "number" ? l() : parseInt(l(), L) || L), te = () => {
170
+ let h = y(de([])), C = y(void 0), U = y(0), E = y(0), R = y(de(ue)), K = y(!1), F = y(!1), T = y(void 0), q = y(!1), B = y(void 0), A = 0;
171
+ const xe = pe(() => typeof l() == "number" ? l() : parseInt(l(), N) || N), te = () => {
172
172
  if (!u() || !c())
173
173
  return;
174
174
  d(K, !0), d(F, !1);
@@ -180,7 +180,7 @@ function _e(f, s) {
180
180
  locale: p()
181
181
  },
182
182
  t(E),
183
- t(C)
183
+ t(R)
184
184
  ).then((a) => {
185
185
  var _, x;
186
186
  if (e !== A)
@@ -194,19 +194,19 @@ function _e(f, s) {
194
194
  });
195
195
  };
196
196
  O(() => {
197
- u(), c(), p(), t(E), t(C), te();
197
+ u(), c(), p(), t(E), t(R), te();
198
198
  }), O(() => {
199
199
  const e = window.matchMedia("(max-width: 767px)"), n = (a) => {
200
200
  d(q, a.matches, !0);
201
201
  };
202
202
  return d(q, e.matches, !0), e.addEventListener("change", n), () => e.removeEventListener("change", n);
203
203
  }), O(() => {
204
- d(C, t(q) ? ue : t(xe), !0);
204
+ d(R, t(q) ? ue : t(xe), !0);
205
205
  }), O(() => {
206
206
  if (!t(q) || !t(B)) return;
207
207
  const e = new IntersectionObserver(
208
208
  (n) => {
209
- n.some((a) => a.isIntersecting) && t(h).length < t(U) && d(E, t(E) + t(C));
209
+ n.some((a) => a.isIntersecting) && t(h).length < t(U) && d(E, t(E) + t(R));
210
210
  },
211
211
  { rootMargin: "200px" }
212
212
  );
@@ -240,10 +240,12 @@ function _e(f, s) {
240
240
  const { type: a, id: i, source: _ } = (x = n.data) != null ? x : {};
241
241
  switch (a) {
242
242
  case ce.REDEEM_REWARD_CONFIRMED:
243
+ if (t(C))
244
+ break;
243
245
  i && t(h).some((M) => M.id === i) && Se(i);
244
246
  break;
245
247
  case ce.BACK_BUTTON_CLICKED:
246
- _ === Ge && d(N, void 0);
248
+ _ === Ge && d(C, void 0);
247
249
  break;
248
250
  }
249
251
  };
@@ -254,7 +256,7 @@ function _e(f, s) {
254
256
  }, Re = (e) => {
255
257
  ct(e.displayName || e.presentation.displayName, e.id);
256
258
  }, ne = (e) => {
257
- d(N, e, !0), Re(e);
259
+ d(C, e, !0), Re(e);
258
260
  }, Le = (e) => (n) => {
259
261
  (n.key === "Enter" || n.key === " ") && (n.preventDefault(), ne(e));
260
262
  };
@@ -280,7 +282,7 @@ function _e(f, s) {
280
282
  get limitItem() {
281
283
  return l();
282
284
  },
283
- set limitItem(e = L) {
285
+ set limitItem(e = N) {
284
286
  l(e), b();
285
287
  },
286
288
  get translationUrl() {
@@ -294,10 +296,10 @@ function _e(f, s) {
294
296
  var Me = (e) => {
295
297
  pt(e, {
296
298
  get itemId() {
297
- return t(N).id;
299
+ return t(C).id;
298
300
  },
299
301
  get elevateReward() {
300
- return t(N);
302
+ return t(C);
301
303
  },
302
304
  get apiEndpoint() {
303
305
  return u();
@@ -311,7 +313,7 @@ function _e(f, s) {
311
313
  });
312
314
  }, Oe = (e) => {
313
315
  var n = ht();
314
- ge(n, 21, () => Array(t(C)), st, (a, i, _, x) => {
316
+ ge(n, 21, () => Array(t(R)), st, (a, i, _, x) => {
315
317
  var M = ft();
316
318
  S(a, M);
317
319
  }), V(n), S(e, n);
@@ -321,13 +323,13 @@ function _e(f, s) {
321
323
  }, Pe = (e) => {
322
324
  var n = _t(), a = at(n);
323
325
  ge(a, 21, () => t(h), (g) => g.id, (g, m) => {
324
- var R = vt();
326
+ var L = vt();
325
327
  let se;
326
- var D = me(R), Be = pe(() => Le(t(m))), ae = z(D), oe = P(D, 2), Ae = z(oe, !0), le = P(oe, 2), De = z(le), Y = P(le, 2), je = z(Y, !0);
327
- V(R), fe(
328
+ var D = me(L), Be = pe(() => Le(t(m))), ae = z(D), oe = P(D, 2), Ae = z(oe, !0), le = P(oe, 2), De = z(le), Y = P(le, 2), je = z(Y, !0);
329
+ V(L), fe(
328
330
  (G, j, Ve, He, Q, Ke, Fe) => {
329
331
  var ie;
330
- se = it(R, 1, "loyalty-shop__item svelte-1f1q033", null, se, { "loyalty-shop__item--unavailable": G }), he(ae, "src", j), he(ae, "alt", Ve), H(Ae, He), H(De, `${(ie = t(m).points) != null ? ie : ""}
332
+ se = it(L, 1, "loyalty-shop__item svelte-1f1q033", null, se, { "loyalty-shop__item--unavailable": G }), he(ae, "src", j), he(ae, "alt", Ve), H(Ae, He), H(De, `${(ie = t(m).points) != null ? ie : ""}
331
333
  ${Q != null ? Q : ""}`), Y.disabled = Ke, H(je, Fe);
332
334
  },
333
335
  [
@@ -342,7 +344,7 @@ function _e(f, s) {
342
344
  ), ee("click", D, () => ne(t(m))), ee("keydown", D, function(...G) {
343
345
  var j;
344
346
  (j = t(Be)) == null || j.apply(this, G);
345
- }), ee("click", Y, () => qe(t(m))), S(g, R);
347
+ }), ee("click", Y, () => qe(t(m))), S(g, L);
346
348
  }), V(a);
347
349
  var i = P(a, 2);
348
350
  {
@@ -352,7 +354,7 @@ function _e(f, s) {
352
354
  return t(E);
353
355
  },
354
356
  get limit() {
355
- return t(C);
357
+ return t(R);
356
358
  },
357
359
  get total() {
358
360
  return t(U);
@@ -371,7 +373,7 @@ function _e(f, s) {
371
373
  {
372
374
  var M = (g) => {
373
375
  var m = bt();
374
- dt(m, (R) => d(B, R), () => t(B)), S(g, m);
376
+ dt(m, (L) => d(B, L), () => t(B)), S(g, m);
375
377
  };
376
378
  $(x, (g) => {
377
379
  t(q) && t(h).length < t(U) && g(M);
@@ -380,7 +382,7 @@ function _e(f, s) {
380
382
  S(e, n);
381
383
  };
382
384
  $(Te, (e) => {
383
- t(N) ? e(Me) : t(K) && t(h).length === 0 ? e(Oe, 1) : !t(h).length || t(F) ? e(ze, 2) : e(Pe, -1);
385
+ t(C) ? e(Me) : t(K) && t(h).length === 0 ? e(Oe, 1) : !t(h).length || t(F) ? e(ze, 2) : e(Pe, -1);
384
386
  });
385
387
  }
386
388
  V(W), S(f, W);
@@ -403,7 +405,7 @@ ye(
403
405
  );
404
406
  function ke(f, s) {
405
407
  ve(s, !0);
406
- let o = v(s, "apiEndpoint", 7, ""), r = v(s, "userSession", 7, ""), k = v(s, "locale", 7, ""), u = v(s, "limitItem", 7, L), c = v(s, "translationUrl");
408
+ let o = v(s, "apiEndpoint", 7, ""), r = v(s, "userSession", 7, ""), k = v(s, "locale", 7, ""), u = v(s, "limitItem", 7, N), c = v(s, "translationUrl");
407
409
  var p = {
408
410
  get apiEndpoint() {
409
411
  return o();
@@ -426,7 +428,7 @@ function ke(f, s) {
426
428
  get limitItem() {
427
429
  return u();
428
430
  },
429
- set limitItem(l = L) {
431
+ set limitItem(l = N) {
430
432
  u(l), b();
431
433
  },
432
434
  get translationUrl() {
@@ -1,4 +1,4 @@
1
- typeof globalThis.HTMLElement>"u"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const e=require("./LoyaltyPagination-DzmuO9_8.cjs"),_e=require("./LoyaltyShopItem-PkfmBV5A.cjs");if(typeof window<"u"){let m=function(n){return function(...l){try{return n.apply(this,l)}catch(a){if(a instanceof DOMException&&a.message.includes("has already been used with this registry")||a instanceof Error&&a.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw a}}};customElements.define=m(customElements.define),Promise.resolve().then(()=>require("./LoyaltyPagination-DzmuO9_8.cjs")).then(n=>n.LoyaltyPagination_ce).then(n=>{const l=n.default||n;customElements.get("loyalty-pagination")||customElements.define("loyalty-pagination",l.element||l)}).catch(n=>{console.error("BOOT ERROR:",n)})}if(typeof window<"u"){let m=function(n){return function(...l){try{return n.apply(this,l)}catch(a){if(a instanceof DOMException&&a.message.includes("has already been used with this registry")||a instanceof Error&&a.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw a}}};customElements.define=m(customElements.define),Promise.resolve().then(()=>require("./LoyaltyShopItem-PkfmBV5A.cjs")).then(n=>n.LoyaltyShopItem_ce).then(n=>{const l=n.default||n;customElements.get("loyalty-shop-item")||customElements.define("loyalty-shop-item",l.element||l)}).catch(n=>{console.error("BOOT ERROR:",n)})}const ve={en:{loading:"Loading…",noContent:"There are no bonus items available for redemption.",networkProblem:"Network problem. Please reload.",tokens:"Tokens",buyNow:"Buy Now",generalError:"Something went wrong... Please try again."},tr:{loading:"Yükleniyor…",noContent:"Kullanılabilir bonus öğesi bulunmamaktadır.",networkProblem:"Ağ sorunu. Lütfen yeniden yükleyin.",tokens:"Tokens",buyNow:"Satın Al",generalError:"Bir sorun oluştu, lütfen tekrar deneyin."},da:{loading:"Indlæser…",noContent:"Der er ingen bonusgenstande tilgængelige til indløsning.",networkProblem:"Netværksproblem. Genindlæs venligst siden.",tokens:"Tokens",buyNow:"Køb nu",generalError:"Noget gik galt. Prøv venligst igen."},de:{loading:"Wird geladen…",noContent:"Es sind keine Bonusartikel zum Einlösen verfügbar.",networkProblem:"Netzwerkproblem. Bitte lade die Seite neu.",tokens:"Token",buyNow:"Jetzt kaufen",generalError:"Etwas ist schiefgelaufen. Bitte versuche es erneut."},nl:{loading:"Laden…",noContent:"Er zijn geen bonusitems beschikbaar om in te wisselen.",networkProblem:"Netwerkprobleem. Laad de pagina opnieuw.",tokens:"Tokens",buyNow:"Nu kopen",generalError:"Er is iets misgegaan. Probeer het opnieuw."},fr:{loading:"Chargement…",noContent:"Aucun bonus n'est disponible pour être échangé.",networkProblem:"Problème de réseau. Veuillez recharger la page.",tokens:"Jetons",buyNow:"Acheter",generalError:"Une erreur s'est produite. Veuillez réessayer."},hu:{loading:"Betöltés…",noContent:"Nincsenek beváltható bónuszok.",networkProblem:"Hálózati probléma. Kérjük, töltsd újra az oldalt.",tokens:"Tokenek",buyNow:"Vásárlás",generalError:"Hiba történt. Kérjük, próbáld újra."}},be="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='800px'%20height='800px'%20viewBox='0%200%20120%20120'%20fill='none'%3e%3crect%20width='120'%20height='120'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.2503%2038.4816C33.2603%2037.0472%2034.4199%2035.8864%2035.8543%2035.875H83.1463C84.5848%2035.875%2085.7503%2037.0431%2085.7503%2038.4816V80.5184C85.7403%2081.9528%2084.5807%2083.1136%2083.1463%2083.125H35.8543C34.4158%2083.1236%2033.2503%2081.957%2033.2503%2080.5184V38.4816ZM80.5006%2041.1251H38.5006V77.8751L62.8921%2053.4783C63.9172%2052.4536%2065.5788%2052.4536%2066.6039%2053.4783L80.5006%2067.4013V41.1251ZM43.75%2051.6249C43.75%2054.5244%2046.1005%2056.8749%2049%2056.8749C51.8995%2056.8749%2054.25%2054.5244%2054.25%2051.6249C54.25%2048.7254%2051.8995%2046.3749%2049%2046.3749C46.1005%2046.3749%2043.75%2048.7254%2043.75%2051.6249Z'%20fill='%23687787'/%3e%3c/svg%3e";var ke=e.from_html('<div class="loyalty-shop__item loyalty-shop__item--skeleton svelte-1f1q033"><div class="loyalty-shop__item-image skeleton-box svelte-1f1q033"></div> <div class="loyalty-shop__item-title skeleton-line svelte-1f1q033"></div> <div class="loyalty-shop__item-points skeleton-line skeleton-line--short svelte-1f1q033"></div> <div class="loyalty-shop__item-button-skeleton skeleton-box svelte-1f1q033"></div></div>'),we=e.from_html('<div class="loyalty-shop__grid loyalty-shop__grid--skeleton svelte-1f1q033"></div>'),Ee=e.from_html('<div class="loyalty-shop__unavailable svelte-1f1q033"> </div>'),xe=e.from_html('<div><div role="button" tabindex="0" class="loyalty-shop__item-image-container svelte-1f1q033"><img class="loyalty-shop__item-image svelte-1f1q033"/></div> <span class="loyalty-shop__item-title svelte-1f1q033"> </span> <span class="loyalty-shop__item-points svelte-1f1q033"> </span> <button class="loyalty-shop__item-button svelte-1f1q033" type="button"> </button></div>'),Se=e.from_html('<div class="load-more-sentinel svelte-1f1q033" aria-hidden="true"></div>'),qe=e.from_html('<div class="loyalty-shop__grid svelte-1f1q033"></div> <!> <!>',1),Ie=e.from_html('<div class="loyalty-shop svelte-1f1q033"><!></div>');const Le={hash:"svelte-1f1q033",code:`.loyalty-shop.svelte-1f1q033 {padding:16px;border-radius:6px;border:1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));background-color:var(--app-container-bg-default, #022652);width:100%;box-sizing:border-box;display:flex;flex-direction:column;gap:16px;}.loyalty-shop__unavailable.svelte-1f1q033 {color:var(--text-subtle, #dfe3e8);font-size:14px;padding:24px 0;text-align:center;}.loyalty-shop__grid.svelte-1f1q033 {display:grid;gap:16px;grid-template-columns:repeat(2, 1fr);margin:0;}.loyalty-shop__item.svelte-1f1q033 {display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:10px;border:1px solid var(--border-default, rgba(251, 251, 251, 0.15));background-color:var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1));}.loyalty-shop__item--unavailable.svelte-1f1q033 {opacity:1;}.loyalty-shop__item-image.svelte-1f1q033 {width:100%;height:82px;border-radius:6px;}.loyalty-shop__item-title.svelte-1f1q033 {color:var(--text-default, #ffffff);font-size:12px;font-weight:400;}.loyalty-shop__item-points.svelte-1f1q033 {color:var(--text-subtle, #dfe3e8);font-size:14px;font-weight:400;}.loyalty-shop__item-button.svelte-1f1q033 {margin-top:auto;width:100%;height:37px;padding:8px 16px;border:none;border-radius:6px;background:var(--button-primary-bg-default, #ffcc00);color:var(--button-primary-text-default, #261d00);font-size:12px;font-weight:400;cursor:pointer;}.loyalty-shop__item-button.svelte-1f1q033:disabled {opacity:0.4;cursor:default;}.skeleton-box.svelte-1f1q033 {background:linear-gradient(
1
+ typeof globalThis.HTMLElement>"u"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const e=require("./LoyaltyPagination-DzmuO9_8.cjs"),_e=require("./LoyaltyShopItem-IvsEBlK0.cjs");if(typeof window<"u"){let m=function(n){return function(...l){try{return n.apply(this,l)}catch(a){if(a instanceof DOMException&&a.message.includes("has already been used with this registry")||a instanceof Error&&a.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw a}}};customElements.define=m(customElements.define),Promise.resolve().then(()=>require("./LoyaltyPagination-DzmuO9_8.cjs")).then(n=>n.LoyaltyPagination_ce).then(n=>{const l=n.default||n;customElements.get("loyalty-pagination")||customElements.define("loyalty-pagination",l.element||l)}).catch(n=>{console.error("BOOT ERROR:",n)})}if(typeof window<"u"){let m=function(n){return function(...l){try{return n.apply(this,l)}catch(a){if(a instanceof DOMException&&a.message.includes("has already been used with this registry")||a instanceof Error&&a.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw a}}};customElements.define=m(customElements.define),Promise.resolve().then(()=>require("./LoyaltyShopItem-IvsEBlK0.cjs")).then(n=>n.LoyaltyShopItem_ce).then(n=>{const l=n.default||n;customElements.get("loyalty-shop-item")||customElements.define("loyalty-shop-item",l.element||l)}).catch(n=>{console.error("BOOT ERROR:",n)})}const ve={en:{loading:"Loading…",noContent:"There are no bonus items available for redemption.",networkProblem:"Network problem. Please reload.",tokens:"Tokens",buyNow:"Buy Now",generalError:"Something went wrong... Please try again."},tr:{loading:"Yükleniyor…",noContent:"Kullanılabilir bonus öğesi bulunmamaktadır.",networkProblem:"Ağ sorunu. Lütfen yeniden yükleyin.",tokens:"Tokens",buyNow:"Satın Al",generalError:"Bir sorun oluştu, lütfen tekrar deneyin."},da:{loading:"Indlæser…",noContent:"Der er ingen bonusgenstande tilgængelige til indløsning.",networkProblem:"Netværksproblem. Genindlæs venligst siden.",tokens:"Tokens",buyNow:"Køb nu",generalError:"Noget gik galt. Prøv venligst igen."},de:{loading:"Wird geladen…",noContent:"Es sind keine Bonusartikel zum Einlösen verfügbar.",networkProblem:"Netzwerkproblem. Bitte lade die Seite neu.",tokens:"Token",buyNow:"Jetzt kaufen",generalError:"Etwas ist schiefgelaufen. Bitte versuche es erneut."},nl:{loading:"Laden…",noContent:"Er zijn geen bonusitems beschikbaar om in te wisselen.",networkProblem:"Netwerkprobleem. Laad de pagina opnieuw.",tokens:"Tokens",buyNow:"Nu kopen",generalError:"Er is iets misgegaan. Probeer het opnieuw."},fr:{loading:"Chargement…",noContent:"Aucun bonus n'est disponible pour être échangé.",networkProblem:"Problème de réseau. Veuillez recharger la page.",tokens:"Jetons",buyNow:"Acheter",generalError:"Une erreur s'est produite. Veuillez réessayer."},hu:{loading:"Betöltés…",noContent:"Nincsenek beváltható bónuszok.",networkProblem:"Hálózati probléma. Kérjük, töltsd újra az oldalt.",tokens:"Tokenek",buyNow:"Vásárlás",generalError:"Hiba történt. Kérjük, próbáld újra."}},be="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='800px'%20height='800px'%20viewBox='0%200%20120%20120'%20fill='none'%3e%3crect%20width='120'%20height='120'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.2503%2038.4816C33.2603%2037.0472%2034.4199%2035.8864%2035.8543%2035.875H83.1463C84.5848%2035.875%2085.7503%2037.0431%2085.7503%2038.4816V80.5184C85.7403%2081.9528%2084.5807%2083.1136%2083.1463%2083.125H35.8543C34.4158%2083.1236%2033.2503%2081.957%2033.2503%2080.5184V38.4816ZM80.5006%2041.1251H38.5006V77.8751L62.8921%2053.4783C63.9172%2052.4536%2065.5788%2052.4536%2066.6039%2053.4783L80.5006%2067.4013V41.1251ZM43.75%2051.6249C43.75%2054.5244%2046.1005%2056.8749%2049%2056.8749C51.8995%2056.8749%2054.25%2054.5244%2054.25%2051.6249C54.25%2048.7254%2051.8995%2046.3749%2049%2046.3749C46.1005%2046.3749%2043.75%2048.7254%2043.75%2051.6249Z'%20fill='%23687787'/%3e%3c/svg%3e";var ke=e.from_html('<div class="loyalty-shop__item loyalty-shop__item--skeleton svelte-1f1q033"><div class="loyalty-shop__item-image skeleton-box svelte-1f1q033"></div> <div class="loyalty-shop__item-title skeleton-line svelte-1f1q033"></div> <div class="loyalty-shop__item-points skeleton-line skeleton-line--short svelte-1f1q033"></div> <div class="loyalty-shop__item-button-skeleton skeleton-box svelte-1f1q033"></div></div>'),we=e.from_html('<div class="loyalty-shop__grid loyalty-shop__grid--skeleton svelte-1f1q033"></div>'),Ee=e.from_html('<div class="loyalty-shop__unavailable svelte-1f1q033"> </div>'),xe=e.from_html('<div><div role="button" tabindex="0" class="loyalty-shop__item-image-container svelte-1f1q033"><img class="loyalty-shop__item-image svelte-1f1q033"/></div> <span class="loyalty-shop__item-title svelte-1f1q033"> </span> <span class="loyalty-shop__item-points svelte-1f1q033"> </span> <button class="loyalty-shop__item-button svelte-1f1q033" type="button"> </button></div>'),Se=e.from_html('<div class="load-more-sentinel svelte-1f1q033" aria-hidden="true"></div>'),qe=e.from_html('<div class="loyalty-shop__grid svelte-1f1q033"></div> <!> <!>',1),Ie=e.from_html('<div class="loyalty-shop svelte-1f1q033"><!></div>');const Le={hash:"svelte-1f1q033",code:`.loyalty-shop.svelte-1f1q033 {padding:16px;border-radius:6px;border:1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));background-color:var(--app-container-bg-default, #022652);width:100%;box-sizing:border-box;display:flex;flex-direction:column;gap:16px;}.loyalty-shop__unavailable.svelte-1f1q033 {color:var(--text-subtle, #dfe3e8);font-size:14px;padding:24px 0;text-align:center;}.loyalty-shop__grid.svelte-1f1q033 {display:grid;gap:16px;grid-template-columns:repeat(2, 1fr);margin:0;}.loyalty-shop__item.svelte-1f1q033 {display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:10px;border:1px solid var(--border-default, rgba(251, 251, 251, 0.15));background-color:var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1));}.loyalty-shop__item--unavailable.svelte-1f1q033 {opacity:1;}.loyalty-shop__item-image.svelte-1f1q033 {width:100%;height:82px;border-radius:6px;}.loyalty-shop__item-title.svelte-1f1q033 {color:var(--text-default, #ffffff);font-size:12px;font-weight:400;}.loyalty-shop__item-points.svelte-1f1q033 {color:var(--text-subtle, #dfe3e8);font-size:14px;font-weight:400;}.loyalty-shop__item-button.svelte-1f1q033 {margin-top:auto;width:100%;height:37px;padding:8px 16px;border:none;border-radius:6px;background:var(--button-primary-bg-default, #ffcc00);color:var(--button-primary-text-default, #261d00);font-size:12px;font-weight:400;cursor:pointer;}.loyalty-shop__item-button.svelte-1f1q033:disabled {opacity:0.4;cursor:default;}.skeleton-box.svelte-1f1q033 {background:linear-gradient(
2
2
  90deg,
3
3
  var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1)) 0%,
4
4
  color-mix(in srgb, var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1)) 80%, white) 50%,
@@ -23,5 +23,5 @@ typeof globalThis.HTMLElement>"u"&&(globalThis.HTMLElement=class{},globalThis.cu
23
23
  }
24
24
 
25
25
  @media (min-width: 768px) {.loyalty-shop__grid.svelte-1f1q033 {grid-template-columns:repeat(4, 1fr);justify-content:start;margin:0;}.loyalty-shop__item.svelte-1f1q033 {width:100%;height:100%;box-sizing:border-box;}.loyalty-shop__item-image.svelte-1f1q033 {height:200px;}.loyalty-shop__item--skeleton.svelte-1f1q033 .loyalty-shop__item-image:where(.svelte-1f1q033) {height:200px;}
26
- }`};function A(m,n){e.push(n,!0),e.append_styles(m,Le);const l=()=>e.store_get(e.$format,"$_",a),[a,k]=e.setup_stores(),p=e.prop(n,"apiEndpoint",7,""),c=e.prop(n,"userSession",7,""),f=e.prop(n,"locale",7,""),i=e.prop(n,"limitItem",7,e.ITEMS_LIMIT_DEFAULT),x=e.prop(n,"translationUrl");e.setupI18n({withLocale:f(),translations:{}});const Y=async()=>{try{const t=new URL(x(),window.location.href),o=await fetch(t.href);if(!o.ok)throw new Error("Failed to fetch translations");const s=await o.json();Object.entries(s).forEach(([r,v])=>{e.addNewMessages(r,v)})}catch(t){console.error("loyalty shop translation url err:",t)}};Object.entries(ve).forEach(([t,o])=>{e.addNewMessages(t,o)});let u=e.state(e.proxy([])),w=e.state(void 0),S=e.state(0),h=e.state(0),_=e.state(e.proxy(e.MOBILE_LOAD_ITEMS)),M=e.state(!1),C=e.state(!1),E=e.state(void 0),y=e.state(!1),q=e.state(void 0),I=0;const Z=e.user_derived(()=>typeof i()=="number"?i():parseInt(i(),e.ITEMS_LIMIT_DEFAULT)||e.ITEMS_LIMIT_DEFAULT),z=()=>{if(!p()||!c())return;e.set(M,!0),e.set(C,!1);const t=++I,o=e.get(y)&&e.get(h)>0;e.fetchShopRewards({apiEndpoint:p(),userSession:c(),locale:f()},e.get(h),e.get(_)).then(s=>{if(t!==I)return;const r=s.data??[];e.set(S,s.total??0,!0),o?e.set(u,[...e.get(u),...r],!0):e.set(u,r,!0)}).catch(s=>{t===I&&(e.set(C,!0),console.error("Failed to load shop rewards:",s))}).finally(()=>{t===I&&e.set(M,!1)})};e.user_effect(()=>{p(),c(),f(),e.get(h),e.get(_),z()}),e.user_effect(()=>{const t=window.matchMedia("(max-width: 767px)"),o=s=>{e.set(y,s.matches,!0)};return e.set(y,t.matches,!0),t.addEventListener("change",o),()=>t.removeEventListener("change",o)}),e.user_effect(()=>{e.set(_,e.get(y)?e.MOBILE_LOAD_ITEMS:e.get(Z),!0)}),e.user_effect(()=>{if(!e.get(y)||!e.get(q))return;const t=new IntersectionObserver(o=>{o.some(s=>s.isIntersecting)&&e.get(u).length<e.get(S)&&e.set(h,e.get(h)+e.get(_))},{rootMargin:"200px"});return t.observe(e.get(q)),()=>t.disconnect()}),e.user_pre_effect(()=>{x()&&Y()});const J=t=>t.presentation?.assets?.[0]??be,R=t=>t.displayName??t.presentation?.displayName??"",N=t=>t.available==="true",W=t=>{e.get(E)||!N(t)||e.sendRedeemRewardRequested(R(t),t.id)},G=async t=>{if(!(!p()||e.get(E))){e.set(E,t,!0);try{await e.redeemReward({apiEndpoint:p(),userSession:c()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton(),z()}catch(o){e.sendRedeemRewardFailed(t,o)}finally{e.set(E,void 0)}}};e.user_effect(()=>{const t=o=>{const{type:s,id:r,source:v}=o.data??{};switch(s){case e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED:r&&e.get(u).some(L=>L.id===r)&&G(r);break;case e.EVENT_TYPES.BACK_BUTTON_CLICKED:v===e.SOURCE&&e.set(w,void 0);break}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});const Q=()=>e.get(u).length?l()("generalError"):l()("noContent"),X=t=>{e.set(h,t,!0)},$=t=>{e.sendRewardItemClicked(t.displayName||t.presentation.displayName,t.id)},B=t=>{e.set(w,t,!0),$(t)},ee=t=>o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),B(t))};var te={get apiEndpoint(){return p()},set apiEndpoint(t=""){p(t),e.flushSync()},get userSession(){return c()},set userSession(t=""){c(t),e.flushSync()},get locale(){return f()},set locale(t=""){f(t),e.flushSync()},get limitItem(){return i()},set limitItem(t=e.ITEMS_LIMIT_DEFAULT){i(t),e.flushSync()},get translationUrl(){return x()},set translationUrl(t){x(t),e.flushSync()}},O=Ie(),ne=e.child(O);{var oe=t=>{_e.LoyaltyShopItem(t,{get itemId(){return e.get(w).id},get elevateReward(){return e.get(w)},get apiEndpoint(){return p()},get userSession(){return c()},get locale(){return f()}})},se=t=>{var o=we();e.each(o,21,()=>Array(e.get(_)),e.index,(s,r,v,L)=>{var P=ke();e.append(s,P)}),e.reset(o),e.append(t,o)},le=t=>{var o=Ee(),s=e.only_child(o,!0);e.template_effect(r=>e.set_text(s,r),[()=>Q()]),e.append(t,o)},ae=t=>{var o=qe(),s=e.first_child(o);e.each(s,21,()=>e.get(u),g=>g.id,(g,d)=>{var b=xe();let j;var T=e.child(b),re=e.user_derived(()=>ee(e.get(d))),F=e.only_child(T),V=e.sibling(T,2),de=e.only_child(V,!0),H=e.sibling(V,2),pe=e.only_child(H),U=e.sibling(H,2),ce=e.only_child(U,!0);e.reset(b),e.template_effect((D,ge,ue,fe,me,he,ye)=>{j=e.set_class(b,1,"loyalty-shop__item svelte-1f1q033",null,j,{"loyalty-shop__item--unavailable":D}),e.set_attribute(F,"src",ge),e.set_attribute(F,"alt",ue),e.set_text(de,fe),e.set_text(pe,`${e.get(d).points??""}
27
- ${me??""}`),U.disabled=he,e.set_text(ce,ye)},[()=>!N(e.get(d)),()=>J(e.get(d)),()=>R(e.get(d)),()=>R(e.get(d)),()=>l()("tokens"),()=>!N(e.get(d))||e.get(E)===e.get(d).id,()=>l()("buyNow")]),e.delegated("click",T,()=>B(e.get(d))),e.delegated("keydown",T,function(...D){e.get(re)?.apply(this,D)}),e.delegated("click",U,()=>W(e.get(d))),e.append(g,b)}),e.reset(s);var r=e.sibling(s,2);{var v=g=>{e.LoyaltyPagination(g,{get offset(){return e.get(h)},get limit(){return e.get(_)},get total(){return e.get(S)},onPageChange:X,get locale(){return f()}})};e.if_block(r,g=>{e.get(y)||g(v)})}var L=e.sibling(r,2);{var P=g=>{var d=Se();e.bind_this(d,b=>e.set(q,b),()=>e.get(q)),e.append(g,d)};e.if_block(L,g=>{e.get(y)&&e.get(u).length<e.get(S)&&g(P)})}e.append(t,o)};e.if_block(ne,t=>{e.get(w)?t(oe):e.get(M)&&e.get(u).length===0?t(se,1):!e.get(u).length||e.get(C)?t(le,2):t(ae,-1)})}e.reset(O),e.append(m,O);var ie=e.pop(te);return k(),ie}e.delegate(["click","keydown"]);e.create_custom_element(A,{apiEndpoint:{},userSession:{},locale:{},limitItem:{},translationUrl:{}},[],[],{mode:"open"});function K(m,n){e.push(n,!0);let l=e.prop(n,"apiEndpoint",7,""),a=e.prop(n,"userSession",7,""),k=e.prop(n,"locale",7,""),p=e.prop(n,"limitItem",7,e.ITEMS_LIMIT_DEFAULT),c=e.prop(n,"translationUrl");var f={get apiEndpoint(){return l()},set apiEndpoint(i=""){l(i),e.flushSync()},get userSession(){return a()},set userSession(i=""){a(i),e.flushSync()},get locale(){return k()},set locale(i=""){k(i),e.flushSync()},get limitItem(){return p()},set limitItem(i=e.ITEMS_LIMIT_DEFAULT){p(i),e.flushSync()},get translationUrl(){return c()},set translationUrl(i){c(i),e.flushSync()}};return A(m,{get apiEndpoint(){return l()},get userSession(){return a()},get locale(){return k()},get limitItem(){return p()},get translationUrl(){return c()}}),e.pop(f)}customElements.define("loyalty-shop",e.create_custom_element(K,{apiEndpoint:{},userSession:{},locale:{},limitItem:{},translationUrl:{}},[],[]));const Te=Object.freeze(Object.defineProperty({__proto__:null,default:K},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShop=A;exports.LoyaltyShop_ce=Te;
26
+ }`};function A(m,n){e.push(n,!0),e.append_styles(m,Le);const l=()=>e.store_get(e.$format,"$_",a),[a,w]=e.setup_stores(),p=e.prop(n,"apiEndpoint",7,""),c=e.prop(n,"userSession",7,""),f=e.prop(n,"locale",7,""),i=e.prop(n,"limitItem",7,e.ITEMS_LIMIT_DEFAULT),x=e.prop(n,"translationUrl");e.setupI18n({withLocale:f(),translations:{}});const Y=async()=>{try{const t=new URL(x(),window.location.href),o=await fetch(t.href);if(!o.ok)throw new Error("Failed to fetch translations");const s=await o.json();Object.entries(s).forEach(([r,b])=>{e.addNewMessages(r,b)})}catch(t){console.error("loyalty shop translation url err:",t)}};Object.entries(ve).forEach(([t,o])=>{e.addNewMessages(t,o)});let u=e.state(e.proxy([])),_=e.state(void 0),S=e.state(0),h=e.state(0),v=e.state(e.proxy(e.MOBILE_LOAD_ITEMS)),M=e.state(!1),C=e.state(!1),E=e.state(void 0),y=e.state(!1),q=e.state(void 0),I=0;const Z=e.user_derived(()=>typeof i()=="number"?i():parseInt(i(),e.ITEMS_LIMIT_DEFAULT)||e.ITEMS_LIMIT_DEFAULT),z=()=>{if(!p()||!c())return;e.set(M,!0),e.set(C,!1);const t=++I,o=e.get(y)&&e.get(h)>0;e.fetchShopRewards({apiEndpoint:p(),userSession:c(),locale:f()},e.get(h),e.get(v)).then(s=>{if(t!==I)return;const r=s.data??[];e.set(S,s.total??0,!0),o?e.set(u,[...e.get(u),...r],!0):e.set(u,r,!0)}).catch(s=>{t===I&&(e.set(C,!0),console.error("Failed to load shop rewards:",s))}).finally(()=>{t===I&&e.set(M,!1)})};e.user_effect(()=>{p(),c(),f(),e.get(h),e.get(v),z()}),e.user_effect(()=>{const t=window.matchMedia("(max-width: 767px)"),o=s=>{e.set(y,s.matches,!0)};return e.set(y,t.matches,!0),t.addEventListener("change",o),()=>t.removeEventListener("change",o)}),e.user_effect(()=>{e.set(v,e.get(y)?e.MOBILE_LOAD_ITEMS:e.get(Z),!0)}),e.user_effect(()=>{if(!e.get(y)||!e.get(q))return;const t=new IntersectionObserver(o=>{o.some(s=>s.isIntersecting)&&e.get(u).length<e.get(S)&&e.set(h,e.get(h)+e.get(v))},{rootMargin:"200px"});return t.observe(e.get(q)),()=>t.disconnect()}),e.user_pre_effect(()=>{x()&&Y()});const J=t=>t.presentation?.assets?.[0]??be,R=t=>t.displayName??t.presentation?.displayName??"",N=t=>t.available==="true",W=t=>{e.get(E)||!N(t)||e.sendRedeemRewardRequested(R(t),t.id)},G=async t=>{if(!(!p()||e.get(E))){e.set(E,t,!0);try{await e.redeemReward({apiEndpoint:p(),userSession:c()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton(),z()}catch(o){e.sendRedeemRewardFailed(t,o)}finally{e.set(E,void 0)}}};e.user_effect(()=>{const t=o=>{const{type:s,id:r,source:b}=o.data??{};switch(s){case e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED:if(e.get(_))break;r&&e.get(u).some(L=>L.id===r)&&G(r);break;case e.EVENT_TYPES.BACK_BUTTON_CLICKED:b===e.SOURCE&&e.set(_,void 0);break}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});const Q=()=>e.get(u).length?l()("generalError"):l()("noContent"),X=t=>{e.set(h,t,!0)},$=t=>{e.sendRewardItemClicked(t.displayName||t.presentation.displayName,t.id)},B=t=>{e.set(_,t,!0),$(t)},ee=t=>o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),B(t))};var te={get apiEndpoint(){return p()},set apiEndpoint(t=""){p(t),e.flushSync()},get userSession(){return c()},set userSession(t=""){c(t),e.flushSync()},get locale(){return f()},set locale(t=""){f(t),e.flushSync()},get limitItem(){return i()},set limitItem(t=e.ITEMS_LIMIT_DEFAULT){i(t),e.flushSync()},get translationUrl(){return x()},set translationUrl(t){x(t),e.flushSync()}},O=Ie(),ne=e.child(O);{var oe=t=>{_e.LoyaltyShopItem(t,{get itemId(){return e.get(_).id},get elevateReward(){return e.get(_)},get apiEndpoint(){return p()},get userSession(){return c()},get locale(){return f()}})},se=t=>{var o=we();e.each(o,21,()=>Array(e.get(v)),e.index,(s,r,b,L)=>{var P=ke();e.append(s,P)}),e.reset(o),e.append(t,o)},le=t=>{var o=Ee(),s=e.only_child(o,!0);e.template_effect(r=>e.set_text(s,r),[()=>Q()]),e.append(t,o)},ae=t=>{var o=qe(),s=e.first_child(o);e.each(s,21,()=>e.get(u),g=>g.id,(g,d)=>{var k=xe();let j;var T=e.child(k),re=e.user_derived(()=>ee(e.get(d))),F=e.only_child(T),V=e.sibling(T,2),de=e.only_child(V,!0),H=e.sibling(V,2),pe=e.only_child(H),U=e.sibling(H,2),ce=e.only_child(U,!0);e.reset(k),e.template_effect((D,ge,ue,fe,me,he,ye)=>{j=e.set_class(k,1,"loyalty-shop__item svelte-1f1q033",null,j,{"loyalty-shop__item--unavailable":D}),e.set_attribute(F,"src",ge),e.set_attribute(F,"alt",ue),e.set_text(de,fe),e.set_text(pe,`${e.get(d).points??""}
27
+ ${me??""}`),U.disabled=he,e.set_text(ce,ye)},[()=>!N(e.get(d)),()=>J(e.get(d)),()=>R(e.get(d)),()=>R(e.get(d)),()=>l()("tokens"),()=>!N(e.get(d))||e.get(E)===e.get(d).id,()=>l()("buyNow")]),e.delegated("click",T,()=>B(e.get(d))),e.delegated("keydown",T,function(...D){e.get(re)?.apply(this,D)}),e.delegated("click",U,()=>W(e.get(d))),e.append(g,k)}),e.reset(s);var r=e.sibling(s,2);{var b=g=>{e.LoyaltyPagination(g,{get offset(){return e.get(h)},get limit(){return e.get(v)},get total(){return e.get(S)},onPageChange:X,get locale(){return f()}})};e.if_block(r,g=>{e.get(y)||g(b)})}var L=e.sibling(r,2);{var P=g=>{var d=Se();e.bind_this(d,k=>e.set(q,k),()=>e.get(q)),e.append(g,d)};e.if_block(L,g=>{e.get(y)&&e.get(u).length<e.get(S)&&g(P)})}e.append(t,o)};e.if_block(ne,t=>{e.get(_)?t(oe):e.get(M)&&e.get(u).length===0?t(se,1):!e.get(u).length||e.get(C)?t(le,2):t(ae,-1)})}e.reset(O),e.append(m,O);var ie=e.pop(te);return w(),ie}e.delegate(["click","keydown"]);e.create_custom_element(A,{apiEndpoint:{},userSession:{},locale:{},limitItem:{},translationUrl:{}},[],[],{mode:"open"});function K(m,n){e.push(n,!0);let l=e.prop(n,"apiEndpoint",7,""),a=e.prop(n,"userSession",7,""),w=e.prop(n,"locale",7,""),p=e.prop(n,"limitItem",7,e.ITEMS_LIMIT_DEFAULT),c=e.prop(n,"translationUrl");var f={get apiEndpoint(){return l()},set apiEndpoint(i=""){l(i),e.flushSync()},get userSession(){return a()},set userSession(i=""){a(i),e.flushSync()},get locale(){return w()},set locale(i=""){w(i),e.flushSync()},get limitItem(){return p()},set limitItem(i=e.ITEMS_LIMIT_DEFAULT){p(i),e.flushSync()},get translationUrl(){return c()},set translationUrl(i){c(i),e.flushSync()}};return A(m,{get apiEndpoint(){return l()},get userSession(){return a()},get locale(){return w()},get limitItem(){return p()},get translationUrl(){return c()}}),e.pop(f)}customElements.define("loyalty-shop",e.create_custom_element(K,{apiEndpoint:{},userSession:{},locale:{},limitItem:{},translationUrl:{}},[],[]));const Te=Object.freeze(Object.defineProperty({__proto__:null,default:K},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShop=A;exports.LoyaltyShop_ce=Te;
@@ -1,5 +1,5 @@
1
- import { z as Ke, c as me, p as ge, a as Fe, b as h, s as Ze, d as ae, A as f, B as oe, P as le, E as N, m as t, F as i, C as Je, H as ie, S as We, i as G, h as w, j as fe, Q as I, R as Ye, u as re, I as Ge, J as Qe, K as Xe, L as $e, w as x, k as y, l as et, n as de, r as D, T as ue, U as tt, o as T, t as ce, v as j, g as nt, q as M, x as st, $ as at, V as ot, O as pe, M as Q, W as lt, X as it, N as rt, Y as dt } from "./LoyaltyPagination-D7m97E0W.js";
2
- import { L as ut } from "./LoyaltyShopItem-CtZFkxzA.js";
1
+ import { z as Ke, c as me, p as ge, a as Fe, b as h, s as Ze, d as ae, A as f, B as oe, P as le, E as N, m as t, F as i, C as Je, H as ie, S as We, i as G, h as w, j as fe, Q as C, R as Ye, u as re, I as Ge, J as Qe, K as Xe, L as $e, w as x, k as y, l as et, n as de, r as D, T as ue, U as tt, o as T, t as ce, v as j, g as nt, q as M, x as st, $ as at, V as ot, O as pe, M as Q, W as lt, X as it, N as rt, Y as dt } from "./LoyaltyPagination-D7m97E0W.js";
2
+ import { L as ut } from "./LoyaltyShopItem-6udy8eXZ.js";
3
3
  typeof globalThis.HTMLElement > "u" && (globalThis.HTMLElement = class {
4
4
  }, globalThis.customElements = { define() {
5
5
  }, get() {
@@ -36,7 +36,7 @@ if (typeof window < "u") {
36
36
  }
37
37
  };
38
38
  };
39
- customElements.define = b(customElements.define), import("./LoyaltyShopItem-CtZFkxzA.js").then((n) => n.a).then((n) => {
39
+ customElements.define = b(customElements.define), import("./LoyaltyShopItem-6udy8eXZ.js").then((n) => n.a).then((n) => {
40
40
  const o = n.default || n;
41
41
  customElements.get("loyalty-shop-item") || customElements.define("loyalty-shop-item", o.element || o);
42
42
  }).catch((n) => {
@@ -133,7 +133,7 @@ const _t = {
133
133
  };
134
134
  function he(b, n) {
135
135
  ge(n, !0), Fe(b, _t);
136
- const o = () => st(at, "$_", l), [l, C] = et(), c = h(n, "apiEndpoint", 7, ""), p = h(n, "userSession", 7, ""), v = h(n, "locale", 7, ""), r = h(n, "limitItem", 7, I), O = h(n, "translationUrl");
136
+ const o = () => st(at, "$_", l), [l, R] = et(), c = h(n, "apiEndpoint", 7, ""), p = h(n, "userSession", 7, ""), v = h(n, "locale", 7, ""), r = h(n, "limitItem", 7, C), O = h(n, "translationUrl");
137
137
  Ze({ withLocale: v(), translations: {} });
138
138
  const ve = async () => {
139
139
  try {
@@ -141,8 +141,8 @@ function he(b, n) {
141
141
  if (!s.ok)
142
142
  throw new Error("Failed to fetch translations");
143
143
  const a = await s.json();
144
- Object.entries(a).forEach(([d, q]) => {
145
- ae(d, q);
144
+ Object.entries(a).forEach(([d, S]) => {
145
+ ae(d, S);
146
146
  });
147
147
  } catch (e) {
148
148
  console.error("loyalty shop translation url err:", e);
@@ -151,8 +151,8 @@ function he(b, n) {
151
151
  Object.entries(ct).forEach(([e, s]) => {
152
152
  ae(e, s);
153
153
  });
154
- let g = f(oe([])), R = f(void 0), z = f(0), _ = f(0), E = f(oe(le)), V = f(!1), H = f(!1), L = f(void 0), k = f(!1), P = f(void 0), U = 0;
155
- const be = re(() => typeof r() == "number" ? r() : parseInt(r(), I) || I), X = () => {
154
+ let g = f(oe([])), E = f(void 0), z = f(0), _ = f(0), q = f(oe(le)), V = f(!1), H = f(!1), L = f(void 0), k = f(!1), P = f(void 0), U = 0;
155
+ const be = re(() => typeof r() == "number" ? r() : parseInt(r(), C) || C), X = () => {
156
156
  if (!c() || !p())
157
157
  return;
158
158
  i(V, !0), i(H, !1);
@@ -164,7 +164,7 @@ function he(b, n) {
164
164
  locale: v()
165
165
  },
166
166
  t(_),
167
- t(E)
167
+ t(q)
168
168
  ).then((a) => {
169
169
  if (e !== U)
170
170
  return;
@@ -177,19 +177,19 @@ function he(b, n) {
177
177
  });
178
178
  };
179
179
  N(() => {
180
- c(), p(), v(), t(_), t(E), X();
180
+ c(), p(), v(), t(_), t(q), X();
181
181
  }), N(() => {
182
182
  const e = window.matchMedia("(max-width: 767px)"), s = (a) => {
183
183
  i(k, a.matches, !0);
184
184
  };
185
185
  return i(k, e.matches, !0), e.addEventListener("change", s), () => e.removeEventListener("change", s);
186
186
  }), N(() => {
187
- i(E, t(k) ? le : t(be), !0);
187
+ i(q, t(k) ? le : t(be), !0);
188
188
  }), N(() => {
189
189
  if (!t(k) || !t(P)) return;
190
190
  const e = new IntersectionObserver(
191
191
  (s) => {
192
- s.some((a) => a.isIntersecting) && t(g).length < t(z) && i(_, t(_) + t(E));
192
+ s.some((a) => a.isIntersecting) && t(g).length < t(z) && i(_, t(_) + t(q));
193
193
  },
194
194
  { rootMargin: "200px" }
195
195
  );
@@ -213,13 +213,15 @@ function he(b, n) {
213
213
  };
214
214
  N(() => {
215
215
  const e = (s) => {
216
- const { type: a, id: d, source: q } = s.data ?? {};
216
+ const { type: a, id: d, source: S } = s.data ?? {};
217
217
  switch (a) {
218
218
  case ie.REDEEM_REWARD_CONFIRMED:
219
+ if (t(E))
220
+ break;
219
221
  d && t(g).some((B) => B.id === d) && we(d);
220
222
  break;
221
223
  case ie.BACK_BUTTON_CLICKED:
222
- q === We && i(R, void 0);
224
+ S === We && i(E, void 0);
223
225
  break;
224
226
  }
225
227
  };
@@ -230,7 +232,7 @@ function he(b, n) {
230
232
  }, qe = (e) => {
231
233
  dt(e.displayName || e.presentation.displayName, e.id);
232
234
  }, $ = (e) => {
233
- i(R, e, !0), qe(e);
235
+ i(E, e, !0), qe(e);
234
236
  }, Se = (e) => (s) => {
235
237
  (s.key === "Enter" || s.key === " ") && (s.preventDefault(), $(e));
236
238
  };
@@ -256,7 +258,7 @@ function he(b, n) {
256
258
  get limitItem() {
257
259
  return r();
258
260
  },
259
- set limitItem(e = I) {
261
+ set limitItem(e = C) {
260
262
  r(e), y();
261
263
  },
262
264
  get translationUrl() {
@@ -270,10 +272,10 @@ function he(b, n) {
270
272
  var Re = (e) => {
271
273
  ut(e, {
272
274
  get itemId() {
273
- return t(R).id;
275
+ return t(E).id;
274
276
  },
275
277
  get elevateReward() {
276
- return t(R);
278
+ return t(E);
277
279
  },
278
280
  get apiEndpoint() {
279
281
  return c();
@@ -287,7 +289,7 @@ function he(b, n) {
287
289
  });
288
290
  }, Le = (e) => {
289
291
  var s = gt();
290
- ue(s, 21, () => Array(t(E)), tt, (a, d, q, B) => {
292
+ ue(s, 21, () => Array(t(q)), tt, (a, d, S, B) => {
291
293
  var J = mt();
292
294
  w(a, J);
293
295
  }), D(s), w(e, s);
@@ -297,12 +299,12 @@ function he(b, n) {
297
299
  }, Te = (e) => {
298
300
  var s = vt(), a = nt(s);
299
301
  ue(a, 21, () => t(g), (m) => m.id, (m, u) => {
300
- var S = ht();
302
+ var I = ht();
301
303
  let ee;
302
- var A = de(S), Oe = re(() => Se(t(u))), te = T(A), ne = M(A, 2), ze = T(ne, !0), se = M(ne, 2), Pe = T(se), W = M(se, 2), Ue = T(W, !0);
303
- D(S), ce(
304
+ var A = de(I), Oe = re(() => Se(t(u))), te = T(A), ne = M(A, 2), ze = T(ne, !0), se = M(ne, 2), Pe = T(se), W = M(se, 2), Ue = T(W, !0);
305
+ D(I), ce(
304
306
  (Y, Be, Ae, De, je, Ve, He) => {
305
- ee = ot(S, 1, "loyalty-shop__item svelte-1f1q033", null, ee, { "loyalty-shop__item--unavailable": Y }), pe(te, "src", Be), pe(te, "alt", Ae), j(ze, De), j(Pe, `${t(u).points ?? ""}
307
+ ee = ot(I, 1, "loyalty-shop__item svelte-1f1q033", null, ee, { "loyalty-shop__item--unavailable": Y }), pe(te, "src", Be), pe(te, "alt", Ae), j(ze, De), j(Pe, `${t(u).points ?? ""}
306
308
  ${je ?? ""}`), W.disabled = Ve, j(Ue, He);
307
309
  },
308
310
  [
@@ -316,17 +318,17 @@ function he(b, n) {
316
318
  ]
317
319
  ), Q("click", A, () => $(t(u))), Q("keydown", A, function(...Y) {
318
320
  t(Oe)?.apply(this, Y);
319
- }), Q("click", W, () => ke(t(u))), w(m, S);
321
+ }), Q("click", W, () => ke(t(u))), w(m, I);
320
322
  }), D(a);
321
323
  var d = M(a, 2);
322
324
  {
323
- var q = (m) => {
325
+ var S = (m) => {
324
326
  lt(m, {
325
327
  get offset() {
326
328
  return t(_);
327
329
  },
328
330
  get limit() {
329
- return t(E);
331
+ return t(q);
330
332
  },
331
333
  get total() {
332
334
  return t(z);
@@ -338,14 +340,14 @@ function he(b, n) {
338
340
  });
339
341
  };
340
342
  G(d, (m) => {
341
- t(k) || m(q);
343
+ t(k) || m(S);
342
344
  });
343
345
  }
344
346
  var B = M(d, 2);
345
347
  {
346
348
  var J = (m) => {
347
349
  var u = yt();
348
- it(u, (S) => i(P, S), () => t(P)), w(m, u);
350
+ it(u, (I) => i(P, I), () => t(P)), w(m, u);
349
351
  };
350
352
  G(B, (m) => {
351
353
  t(k) && t(g).length < t(z) && m(J);
@@ -354,12 +356,12 @@ function he(b, n) {
354
356
  w(e, s);
355
357
  };
356
358
  G(Ce, (e) => {
357
- t(R) ? e(Re) : t(V) && t(g).length === 0 ? e(Le, 1) : !t(g).length || t(H) ? e(Ne, 2) : e(Te, -1);
359
+ t(E) ? e(Re) : t(V) && t(g).length === 0 ? e(Le, 1) : !t(g).length || t(H) ? e(Ne, 2) : e(Te, -1);
358
360
  });
359
361
  }
360
362
  D(Z), w(b, Z);
361
363
  var Me = fe(Ie);
362
- return C(), Me;
364
+ return R(), Me;
363
365
  }
364
366
  Ke(["click", "keydown"]);
365
367
  me(
@@ -377,7 +379,7 @@ me(
377
379
  );
378
380
  function ye(b, n) {
379
381
  ge(n, !0);
380
- let o = h(n, "apiEndpoint", 7, ""), l = h(n, "userSession", 7, ""), C = h(n, "locale", 7, ""), c = h(n, "limitItem", 7, I), p = h(n, "translationUrl");
382
+ let o = h(n, "apiEndpoint", 7, ""), l = h(n, "userSession", 7, ""), R = h(n, "locale", 7, ""), c = h(n, "limitItem", 7, C), p = h(n, "translationUrl");
381
383
  var v = {
382
384
  get apiEndpoint() {
383
385
  return o();
@@ -392,15 +394,15 @@ function ye(b, n) {
392
394
  l(r), y();
393
395
  },
394
396
  get locale() {
395
- return C();
397
+ return R();
396
398
  },
397
399
  set locale(r = "") {
398
- C(r), y();
400
+ R(r), y();
399
401
  },
400
402
  get limitItem() {
401
403
  return c();
402
404
  },
403
- set limitItem(r = I) {
405
+ set limitItem(r = C) {
404
406
  c(r), y();
405
407
  },
406
408
  get translationUrl() {
@@ -418,7 +420,7 @@ function ye(b, n) {
418
420
  return l();
419
421
  },
420
422
  get locale() {
421
- return C();
423
+ return R();
422
424
  },
423
425
  get limitItem() {
424
426
  return c();
@@ -1,4 +1,4 @@
1
- import { z as me, c as G, p as K, a as ve, b as o, s as fe, d as Z, A as N, B as he, C as ye, E as J, F as g, G as ge, H as _e, m as a, f as we, g as be, i as T, h as E, j as W, I as xe, J as Ee, K as Re, L as ke, k as i, l as Se, n as L, q as w, o as R, r as C, t as U, v as k, M as Ie, w as M, u as S, x as Ne, $ as Te, N as Le, O as q } from "./LoyaltyPagination-D7m97E0W.js";
1
+ import { z as me, c as G, p as K, a as ve, b as o, s as fe, d as Z, A as N, B as he, C as ye, E as J, F as g, G as ge, H as _e, m as t, f as we, g as be, i as T, h as E, j as W, I as xe, J as Ee, K as Re, L as ke, k as i, l as Se, n as L, q as b, o as R, r as C, t as U, v as k, M as Ie, w as M, u as S, x as Ne, $ as Te, N as Le, O as q } from "./LoyaltyPagination-D7m97E0W.js";
2
2
  import { L as Ce } from "./LoyaltyPointsCard-SZEIZzo0.js";
3
3
  typeof globalThis.HTMLElement > "u" && (globalThis.HTMLElement = class {
4
4
  }, globalThis.customElements = { define() {
@@ -6,10 +6,10 @@ typeof globalThis.HTMLElement > "u" && (globalThis.HTMLElement = class {
6
6
  }, whenDefined() {
7
7
  } });
8
8
  if (typeof window < "u") {
9
- let f = function(t) {
9
+ let f = function(a) {
10
10
  return function(...l) {
11
11
  try {
12
- return t.apply(this, l);
12
+ return a.apply(this, l);
13
13
  } catch (d) {
14
14
  if (d instanceof DOMException && d.message.includes("has already been used with this registry") || d instanceof Error && d.message.includes("Cannot define multiple custom elements with the same tag name"))
15
15
  return !1;
@@ -17,11 +17,11 @@ if (typeof window < "u") {
17
17
  }
18
18
  };
19
19
  };
20
- customElements.define = f(customElements.define), import("./LoyaltyPointsCard-SZEIZzo0.js").then((t) => t.a).then((t) => {
21
- const l = t.default || t;
20
+ customElements.define = f(customElements.define), import("./LoyaltyPointsCard-SZEIZzo0.js").then((a) => a.a).then((a) => {
21
+ const l = a.default || a;
22
22
  customElements.get("loyalty-points-card") || customElements.define("loyalty-points-card", l.element || l);
23
- }).catch((t) => {
24
- console.error("BOOT ERROR:", t);
23
+ }).catch((a) => {
24
+ console.error("BOOT ERROR:", a);
25
25
  });
26
26
  }
27
27
  const Ue = {
@@ -69,15 +69,15 @@ const Ve = {
69
69
  @media (min-width: 768px) {.loyalty-shop-item__image.svelte-ravnpu {height:clamp(170px, 30vw, 400px);object-fit:cover;}
70
70
  }`
71
71
  };
72
- function Y(f, t) {
73
- K(t, !0), ve(f, Ve);
74
- const l = () => Ne(Te, "$_", d), [d, _] = Se(), u = o(t, "apiEndpoint", 7, ""), c = o(t, "userSession", 7, ""), p = o(t, "locale", 7, ""), h = o(t, "itemId", 7, ""), n = o(t, "elevateReward"), b = o(t, "translationUrl");
72
+ function Y(f, a) {
73
+ K(a, !0), ve(f, Ve);
74
+ const l = () => Ne(Te, "$_", d), [d, _] = Se(), u = o(a, "apiEndpoint", 7, ""), c = o(a, "userSession", 7, ""), p = o(a, "locale", 7, ""), h = o(a, "itemId", 7, ""), n = o(a, "elevateReward"), x = o(a, "translationUrl");
75
75
  fe({ withLocale: p(), translations: {} }), Object.entries(Ue).forEach(([e, s]) => {
76
76
  Z(e, s);
77
77
  });
78
- let r = N(he(n())), x = N(!1), O = N("");
79
- const z = S(() => a(r)?.presentation?.assets?.[0] ?? ""), j = S(() => a(r)?.presentation?.displayName ?? a(r)?.displayName ?? ""), V = S(() => a(r)?.presentation?.description ?? ""), A = S(() => a(r)?.available === "true"), X = () => {
80
- let e = new URL(b(), window.location.href);
78
+ let r = N(he(n())), w = N(!1), O = N("");
79
+ const z = S(() => t(r)?.presentation?.assets?.[0] ?? ""), j = S(() => t(r)?.presentation?.displayName ?? t(r)?.displayName ?? ""), V = S(() => t(r)?.presentation?.description ?? ""), A = S(() => t(r)?.available === "true"), X = () => {
80
+ let e = new URL(x(), window.location.href);
81
81
  fetch(e.href).then((s) => s.json()).then((s) => {
82
82
  Object.keys(s).forEach((y) => {
83
83
  Z(y, s[y]);
@@ -87,41 +87,46 @@ function Y(f, t) {
87
87
  });
88
88
  };
89
89
  ye(() => {
90
- b() && X();
90
+ x() && X();
91
91
  }), J(() => {
92
92
  if (n()) {
93
93
  g(r, n(), !0);
94
94
  return;
95
95
  }
96
- !u() || !h() || ge(
96
+ if (!u() || !h())
97
+ return;
98
+ let e = !1;
99
+ return ge(
97
100
  {
98
101
  apiEndpoint: u(),
99
102
  userSession: c(),
100
103
  locale: p()
101
104
  },
102
105
  h()
103
- ).then((e) => {
104
- g(r, e, !0);
105
- }).catch((e) => console.error("Failed to load shop item:", e));
106
+ ).then((s) => {
107
+ e || g(r, s, !0);
108
+ }).catch((s) => console.error("Failed to load shop item:", s)), () => {
109
+ e = !0;
110
+ };
106
111
  });
107
112
  const $ = () => {
108
- a(x) || !a(A) || !a(r) || Le(a(r).displayName || a(r).presentation.displayName, a(r).id);
113
+ t(w) || !t(A) || !t(r) || Le(t(r).displayName || t(r).presentation.displayName, t(r).id);
109
114
  }, ee = async () => {
110
- if (!u() || !a(r))
115
+ if (!u() || !t(r) || t(w))
111
116
  return;
112
- g(x, !0), g(O, "");
113
- const e = a(r).id;
117
+ g(w, !0), g(O, "");
118
+ const e = t(r).id;
114
119
  try {
115
120
  await xe({ apiEndpoint: u(), userSession: c() }, e), Ee(e), Re();
116
121
  } catch (s) {
117
122
  g(O, s?.message ?? "Redeem failed", !0), ke(e, s);
118
123
  } finally {
119
- g(x, !1);
124
+ g(w, !1);
120
125
  }
121
126
  };
122
127
  J(() => {
123
128
  const e = (s) => {
124
- s.data?.type === _e.REDEEM_REWARD_CONFIRMED && s.data?.id === a(r)?.id && ee();
129
+ s.data?.type === _e.REDEEM_REWARD_CONFIRMED && s.data?.id === t(r)?.id && ee();
125
130
  };
126
131
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
127
132
  });
@@ -157,10 +162,10 @@ function Y(f, t) {
157
162
  n(e), i();
158
163
  },
159
164
  get translationUrl() {
160
- return b();
165
+ return x();
161
166
  },
162
167
  set translationUrl(e) {
163
- b(e), i();
168
+ x(e), i();
164
169
  }
165
170
  }, B = we(), ae = be(B);
166
171
  {
@@ -170,16 +175,16 @@ function Y(f, t) {
170
175
  var re = (m) => {
171
176
  var v = Oe();
172
177
  U(() => {
173
- q(v, "src", a(z) || Me), q(v, "alt", a(j));
178
+ q(v, "src", t(z) || Me), q(v, "alt", t(j));
174
179
  }), E(m, v);
175
180
  };
176
181
  T(D, (m) => {
177
- a(z) && m(re);
182
+ t(z) && m(re);
178
183
  });
179
184
  }
180
- var H = w(D, 2), oe = R(H, !0), F = w(H, 2), ie = R(F), I = w(F, 2), le = R(I, !0);
185
+ var H = b(D, 2), oe = R(H, !0), F = b(H, 2), ie = R(F), I = b(F, 2), le = R(I, !0);
181
186
  C(y);
182
- var P = w(y, 2);
187
+ var P = b(y, 2);
183
188
  Ce(P, {
184
189
  get apiEndpoint() {
185
190
  return u();
@@ -191,26 +196,26 @@ function Y(f, t) {
191
196
  return p();
192
197
  }
193
198
  });
194
- var de = w(P, 2);
199
+ var de = b(P, 2);
195
200
  {
196
201
  var ue = (m) => {
197
202
  var v = ze(), ce = L(v), pe = R(ce, !0);
198
- C(v), U(() => k(pe, a(V))), E(m, v);
203
+ C(v), U(() => k(pe, t(V))), E(m, v);
199
204
  };
200
205
  T(de, (m) => {
201
- a(V) && m(ue);
206
+ t(V) && m(ue);
202
207
  });
203
208
  }
204
209
  C(s), U(
205
210
  (m, v) => {
206
- k(oe, a(j)), k(ie, `${a(r).points ?? ""}
207
- ${m ?? ""}`), I.disabled = !a(A) || a(x), k(le, v);
211
+ k(oe, t(j)), k(ie, `${t(r).points ?? ""}
212
+ ${m ?? ""}`), I.disabled = !t(A) || t(w), k(le, v);
208
213
  },
209
214
  [() => l()("tokens"), () => l()("buyNow")]
210
215
  ), Ie("click", I, $), E(e, s);
211
216
  };
212
217
  T(ae, (e) => {
213
- a(r) && e(se);
218
+ t(r) && e(se);
214
219
  });
215
220
  }
216
221
  E(f, B);
@@ -232,9 +237,9 @@ G(
232
237
  [],
233
238
  { mode: "open" }
234
239
  );
235
- function Q(f, t) {
236
- K(t, !0);
237
- let l = o(t, "apiEndpoint", 7, ""), d = o(t, "userSession", 7, ""), _ = o(t, "locale", 7, ""), u = o(t, "itemId", 7, ""), c = o(t, "elevateReward"), p = o(t, "translationUrl");
240
+ function Q(f, a) {
241
+ K(a, !0);
242
+ let l = o(a, "apiEndpoint", 7, ""), d = o(a, "userSession", 7, ""), _ = o(a, "locale", 7, ""), u = o(a, "itemId", 7, ""), c = o(a, "elevateReward"), p = o(a, "translationUrl");
238
243
  var h = {
239
244
  get apiEndpoint() {
240
245
  return l();
@@ -1,5 +1,5 @@
1
- var M=(f,a,o)=>new Promise((d,g)=>{var p=i=>{try{c(o.next(i))}catch(r){g(r)}},u=i=>{try{c(o.throw(i))}catch(r){g(r)}},c=i=>i.done?d(i.value):Promise.resolve(i.value).then(p,u);c((o=o.apply(f,a)).next())});typeof globalThis.HTMLElement=="undefined"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const e=require("./LoyaltyPagination-ChnSUs6d.cjs"),K=require("./LoyaltyPointsCard-5kjF6xRz.cjs");if(typeof window!="undefined"){let f=function(a){return function(...o){try{return a.apply(this,o)}catch(d){if(d instanceof DOMException&&d.message.includes("has already been used with this registry")||d instanceof Error&&d.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw d}}};customElements.define=f(customElements.define),Promise.resolve().then(()=>require("./LoyaltyPointsCard-5kjF6xRz.cjs")).then(a=>a.LoyaltyPointsCard_ce).then(a=>{const o=a.default||a;customElements.get("loyalty-points-card")||customElements.define("loyalty-points-card",o.element||o)}).catch(a=>{console.error("BOOT ERROR:",a)})}const W={en:{tokens:"Tokens",buyNow:"Buy Now",back:"Back"},tr:{tokens:"Tokens",buyNow:"Şimdi Satın Al",back:"Geri"},da:{tokens:"Tokens",buyNow:"Køb nu",back:"Tilbage"},de:{tokens:"Token",buyNow:"Jetzt kaufen",back:"Zurück"},nl:{tokens:"Tokens",buyNow:"Nu kopen",back:"Terug"},fr:{tokens:"Jetons",buyNow:"Acheter",back:"Retour"},hu:{tokens:"Tokenek",buyNow:"Vásárlás",back:"Vissza"}},Y="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='800px'%20height='800px'%20viewBox='0%200%20120%20120'%20fill='none'%3e%3crect%20width='120'%20height='120'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.2503%2038.4816C33.2603%2037.0472%2034.4199%2035.8864%2035.8543%2035.875H83.1463C84.5848%2035.875%2085.7503%2037.0431%2085.7503%2038.4816V80.5184C85.7403%2081.9528%2084.5807%2083.1136%2083.1463%2083.125H35.8543C34.4158%2083.1236%2033.2503%2081.957%2033.2503%2080.5184V38.4816ZM80.5006%2041.1251H38.5006V77.8751L62.8921%2053.4783C63.9172%2052.4536%2065.5788%2052.4536%2066.6039%2053.4783L80.5006%2067.4013V41.1251ZM43.75%2051.6249C43.75%2054.5244%2046.1005%2056.8749%2049%2056.8749C51.8995%2056.8749%2054.25%2054.5244%2054.25%2051.6249C54.25%2048.7254%2051.8995%2046.3749%2049%2046.3749C46.1005%2046.3749%2043.75%2048.7254%2043.75%2051.6249Z'%20fill='%23687787'/%3e%3c/svg%3e";var Q=e.from_html('<img class="loyalty-shop-item__image svelte-ravnpu"/>'),X=e.from_html('<div class="loyalty-shop-item__card loyalty-shop-item__card--description svelte-ravnpu"><p class="loyalty-shop-item__description svelte-ravnpu"> </p></div>'),$=e.from_html('<div class="loyalty-shop-item svelte-ravnpu"><div class="loyalty-shop-item__card svelte-ravnpu"><!> <span class="loyalty-shop-item__title svelte-ravnpu"> </span> <span class="loyalty-shop-item__points svelte-ravnpu"> </span> <button class="loyalty-shop-item__button svelte-ravnpu" type="button"> </button></div> <!> <!></div>');const ee={hash:"svelte-ravnpu",code:`.loyalty-shop-item.svelte-ravnpu {display:flex;flex-direction:column;gap:12px;}.loyalty-shop-item__card.svelte-ravnpu {display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:10px;border:1px solid var(--border-default, rgba(251, 251, 251, 0.15));background-color:var(--app-container-bg-default, #022652);}.loyalty-shop-item__card--description.svelte-ravnpu {min-height:120px;}.loyalty-shop-item__image.svelte-ravnpu {width:100%;height:170px;border-radius:6px;}.loyalty-shop-item__title.svelte-ravnpu {color:var(--text-default, #ffffff);font-size:12px;font-weight:400;}.loyalty-shop-item__points.svelte-ravnpu {color:var(--text-subtle, #dfe3e8);font-size:14px;font-weight:400;}.loyalty-shop-item__button.svelte-ravnpu {margin-top:auto;width:100%;height:37px;padding:8px 16px;border:none;border-radius:6px;background:var(--button-primary-bg-default, #ffcc00);color:var(--button-primary-text-default, #261d00);font-size:12px;font-weight:400;cursor:pointer;}.loyalty-shop-item__button.svelte-ravnpu:disabled {opacity:0.4;cursor:default;}.loyalty-shop-item__description.svelte-ravnpu {color:var(--text-subtle, #dfe3e8);font-size:12px;line-height:1.4;margin:0;font-weight:500;min-height:120px;}
1
+ var M=(y,a,o)=>new Promise((d,g)=>{var c=i=>{try{p(o.next(i))}catch(r){g(r)}},u=i=>{try{p(o.throw(i))}catch(r){g(r)}},p=i=>i.done?d(i.value):Promise.resolve(i.value).then(c,u);p((o=o.apply(y,a)).next())});typeof globalThis.HTMLElement=="undefined"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const e=require("./LoyaltyPagination-ChnSUs6d.cjs"),K=require("./LoyaltyPointsCard-5kjF6xRz.cjs");if(typeof window!="undefined"){let y=function(a){return function(...o){try{return a.apply(this,o)}catch(d){if(d instanceof DOMException&&d.message.includes("has already been used with this registry")||d instanceof Error&&d.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw d}}};customElements.define=y(customElements.define),Promise.resolve().then(()=>require("./LoyaltyPointsCard-5kjF6xRz.cjs")).then(a=>a.LoyaltyPointsCard_ce).then(a=>{const o=a.default||a;customElements.get("loyalty-points-card")||customElements.define("loyalty-points-card",o.element||o)}).catch(a=>{console.error("BOOT ERROR:",a)})}const W={en:{tokens:"Tokens",buyNow:"Buy Now",back:"Back"},tr:{tokens:"Tokens",buyNow:"Şimdi Satın Al",back:"Geri"},da:{tokens:"Tokens",buyNow:"Køb nu",back:"Tilbage"},de:{tokens:"Token",buyNow:"Jetzt kaufen",back:"Zurück"},nl:{tokens:"Tokens",buyNow:"Nu kopen",back:"Terug"},fr:{tokens:"Jetons",buyNow:"Acheter",back:"Retour"},hu:{tokens:"Tokenek",buyNow:"Vásárlás",back:"Vissza"}},Y="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='800px'%20height='800px'%20viewBox='0%200%20120%20120'%20fill='none'%3e%3crect%20width='120'%20height='120'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.2503%2038.4816C33.2603%2037.0472%2034.4199%2035.8864%2035.8543%2035.875H83.1463C84.5848%2035.875%2085.7503%2037.0431%2085.7503%2038.4816V80.5184C85.7403%2081.9528%2084.5807%2083.1136%2083.1463%2083.125H35.8543C34.4158%2083.1236%2033.2503%2081.957%2033.2503%2080.5184V38.4816ZM80.5006%2041.1251H38.5006V77.8751L62.8921%2053.4783C63.9172%2052.4536%2065.5788%2052.4536%2066.6039%2053.4783L80.5006%2067.4013V41.1251ZM43.75%2051.6249C43.75%2054.5244%2046.1005%2056.8749%2049%2056.8749C51.8995%2056.8749%2054.25%2054.5244%2054.25%2051.6249C54.25%2048.7254%2051.8995%2046.3749%2049%2046.3749C46.1005%2046.3749%2043.75%2048.7254%2043.75%2051.6249Z'%20fill='%23687787'/%3e%3c/svg%3e";var Q=e.from_html('<img class="loyalty-shop-item__image svelte-ravnpu"/>'),X=e.from_html('<div class="loyalty-shop-item__card loyalty-shop-item__card--description svelte-ravnpu"><p class="loyalty-shop-item__description svelte-ravnpu"> </p></div>'),$=e.from_html('<div class="loyalty-shop-item svelte-ravnpu"><div class="loyalty-shop-item__card svelte-ravnpu"><!> <span class="loyalty-shop-item__title svelte-ravnpu"> </span> <span class="loyalty-shop-item__points svelte-ravnpu"> </span> <button class="loyalty-shop-item__button svelte-ravnpu" type="button"> </button></div> <!> <!></div>');const ee={hash:"svelte-ravnpu",code:`.loyalty-shop-item.svelte-ravnpu {display:flex;flex-direction:column;gap:12px;}.loyalty-shop-item__card.svelte-ravnpu {display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:10px;border:1px solid var(--border-default, rgba(251, 251, 251, 0.15));background-color:var(--app-container-bg-default, #022652);}.loyalty-shop-item__card--description.svelte-ravnpu {min-height:120px;}.loyalty-shop-item__image.svelte-ravnpu {width:100%;height:170px;border-radius:6px;}.loyalty-shop-item__title.svelte-ravnpu {color:var(--text-default, #ffffff);font-size:12px;font-weight:400;}.loyalty-shop-item__points.svelte-ravnpu {color:var(--text-subtle, #dfe3e8);font-size:14px;font-weight:400;}.loyalty-shop-item__button.svelte-ravnpu {margin-top:auto;width:100%;height:37px;padding:8px 16px;border:none;border-radius:6px;background:var(--button-primary-bg-default, #ffcc00);color:var(--button-primary-text-default, #261d00);font-size:12px;font-weight:400;cursor:pointer;}.loyalty-shop-item__button.svelte-ravnpu:disabled {opacity:0.4;cursor:default;}.loyalty-shop-item__description.svelte-ravnpu {color:var(--text-subtle, #dfe3e8);font-size:12px;line-height:1.4;margin:0;font-weight:500;min-height:120px;}
2
2
 
3
3
  @media (min-width: 768px) {.loyalty-shop-item__image.svelte-ravnpu {height:clamp(170px, 30vw, 400px);object-fit:cover;}
4
- }`};function S(f,a){e.push(a,!0),e.append_styles(f,ee);const o=()=>e.store_get(e.$format,"$_",d),[d,g]=e.setup_stores(),p=e.prop(a,"apiEndpoint",7,""),u=e.prop(a,"userSession",7,""),c=e.prop(a,"locale",7,""),i=e.prop(a,"itemId",7,""),r=e.prop(a,"elevateReward"),_=e.prop(a,"translationUrl");e.setupI18n({withLocale:c(),translations:{}}),Object.entries(W).forEach(([t,n])=>{e.addNewMessages(t,n)});let l=e.state(e.proxy(r())),b=e.state(!1),E=e.state("");const k=e.user_derived(()=>{var t,n,s,m;return(m=(s=(n=(t=e.get(l))==null?void 0:t.presentation)==null?void 0:n.assets)==null?void 0:s[0])!=null?m:""}),R=e.user_derived(()=>{var t,n,s,m,v;return(v=(m=(n=(t=e.get(l))==null?void 0:t.presentation)==null?void 0:n.displayName)!=null?m:(s=e.get(l))==null?void 0:s.displayName)!=null?v:""}),I=e.user_derived(()=>{var t,n,s;return(s=(n=(t=e.get(l))==null?void 0:t.presentation)==null?void 0:n.description)!=null?s:""}),N=e.user_derived(()=>{var t;return((t=e.get(l))==null?void 0:t.available)==="true"}),P=()=>{let t=new URL(_(),window.location.href);fetch(t.href).then(n=>n.json()).then(n=>{Object.keys(n).forEach(s=>{e.addNewMessages(s,n[s])})}).catch(n=>{console.log("loyalty shop item translation url err:",n)})};e.user_pre_effect(()=>{_()&&P()}),e.user_effect(()=>{if(r()){e.set(l,r(),!0);return}!p()||!i()||e.fetchShopItem({apiEndpoint:p(),userSession:u(),locale:c()},i()).then(t=>{e.set(l,t,!0)}).catch(t=>console.error("Failed to load shop item:",t))});const z=()=>{e.get(b)||!e.get(N)||!e.get(l)||e.sendRedeemRewardRequested(e.get(l).displayName||e.get(l).presentation.displayName,e.get(l).id)},V=()=>M(this,null,function*(){var n;if(!p()||!e.get(l))return;e.set(b,!0),e.set(E,"");const t=e.get(l).id;try{yield e.redeemReward({apiEndpoint:p(),userSession:u()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton()}catch(s){e.set(E,(n=s==null?void 0:s.message)!=null?n:"Redeem failed",!0),e.sendRedeemRewardFailed(t,s)}finally{e.set(b,!1)}});e.user_effect(()=>{const t=n=>{var s,m,v;((s=n.data)==null?void 0:s.type)===e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED&&((m=n.data)==null?void 0:m.id)===((v=e.get(l))==null?void 0:v.id)&&V()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});var j={get apiEndpoint(){return p()},set apiEndpoint(t=""){p(t),e.flushSync()},get userSession(){return u()},set userSession(t=""){u(t),e.flushSync()},get locale(){return c()},set locale(t=""){c(t),e.flushSync()},get itemId(){return i()},set itemId(t=""){i(t),e.flushSync()},get elevateReward(){return r()},set elevateReward(t){r(t),e.flushSync()},get translationUrl(){return _()},set translationUrl(t){_(t),e.flushSync()}},T=e.comment(),D=e.first_child(T);{var A=t=>{var n=$(),s=e.child(n),m=e.child(s);{var v=h=>{var y=Q();e.template_effect(()=>{e.set_attribute(y,"src",e.get(k)||Y),e.set_attribute(y,"alt",e.get(R))}),e.append(h,y)};e.if_block(m,h=>{e.get(k)&&h(v)})}var L=e.sibling(m,2),H=e.only_child(L,!0),C=e.sibling(L,2),q=e.only_child(C),x=e.sibling(C,2),Z=e.only_child(x,!0);e.reset(s);var U=e.sibling(s,2);K.LoyaltyPointsCard(U,{get apiEndpoint(){return p()},get userSession(){return u()},get locale(){return c()}});var F=e.sibling(U,2);{var J=h=>{var y=X(),w=e.child(y),G=e.only_child(w,!0);e.reset(y),e.template_effect(()=>e.set_text(G,e.get(I))),e.append(h,y)};e.if_block(F,h=>{e.get(I)&&h(J)})}e.reset(n),e.template_effect((h,y)=>{var w;e.set_text(H,e.get(R)),e.set_text(q,`${(w=e.get(l).points)!=null?w:""}
5
- ${h!=null?h:""}`),x.disabled=!e.get(N)||e.get(b),e.set_text(Z,y)},[()=>o()("tokens"),()=>o()("buyNow")]),e.delegated("click",x,z),e.append(t,n)};e.if_block(D,t=>{e.get(l)&&t(A)})}e.append(f,T);var B=e.pop(j);return g(),B}e.delegate(["click"]);e.create_custom_element(S,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[],{mode:"open"});function O(f,a){e.push(a,!0);let o=e.prop(a,"apiEndpoint",7,""),d=e.prop(a,"userSession",7,""),g=e.prop(a,"locale",7,""),p=e.prop(a,"itemId",7,""),u=e.prop(a,"elevateReward"),c=e.prop(a,"translationUrl");var i={get apiEndpoint(){return o()},set apiEndpoint(r=""){o(r),e.flushSync()},get userSession(){return d()},set userSession(r=""){d(r),e.flushSync()},get locale(){return g()},set locale(r=""){g(r),e.flushSync()},get itemId(){return p()},set itemId(r=""){p(r),e.flushSync()},get elevateReward(){return u()},set elevateReward(r){u(r),e.flushSync()},get translationUrl(){return c()},set translationUrl(r){c(r),e.flushSync()}};return S(f,{get apiEndpoint(){return o()},get userSession(){return d()},get locale(){return g()},get itemId(){return p()},get elevateReward(){return u()},get translationUrl(){return c()}}),e.pop(i)}customElements.define("loyalty-shop-item",e.create_custom_element(O,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[]));const te=Object.freeze(Object.defineProperty({__proto__:null,default:O},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShopItem=S;exports.LoyaltyShopItem_ce=te;
4
+ }`};function S(y,a){e.push(a,!0),e.append_styles(y,ee);const o=()=>e.store_get(e.$format,"$_",d),[d,g]=e.setup_stores(),c=e.prop(a,"apiEndpoint",7,""),u=e.prop(a,"userSession",7,""),p=e.prop(a,"locale",7,""),i=e.prop(a,"itemId",7,""),r=e.prop(a,"elevateReward"),b=e.prop(a,"translationUrl");e.setupI18n({withLocale:p(),translations:{}}),Object.entries(W).forEach(([t,n])=>{e.addNewMessages(t,n)});let l=e.state(e.proxy(r())),_=e.state(!1),E=e.state("");const k=e.user_derived(()=>{var t,n,s,m;return(m=(s=(n=(t=e.get(l))==null?void 0:t.presentation)==null?void 0:n.assets)==null?void 0:s[0])!=null?m:""}),R=e.user_derived(()=>{var t,n,s,m,v;return(v=(m=(n=(t=e.get(l))==null?void 0:t.presentation)==null?void 0:n.displayName)!=null?m:(s=e.get(l))==null?void 0:s.displayName)!=null?v:""}),I=e.user_derived(()=>{var t,n,s;return(s=(n=(t=e.get(l))==null?void 0:t.presentation)==null?void 0:n.description)!=null?s:""}),N=e.user_derived(()=>{var t;return((t=e.get(l))==null?void 0:t.available)==="true"}),P=()=>{let t=new URL(b(),window.location.href);fetch(t.href).then(n=>n.json()).then(n=>{Object.keys(n).forEach(s=>{e.addNewMessages(s,n[s])})}).catch(n=>{console.log("loyalty shop item translation url err:",n)})};e.user_pre_effect(()=>{b()&&P()}),e.user_effect(()=>{if(r()){e.set(l,r(),!0);return}if(!c()||!i())return;let t=!1;return e.fetchShopItem({apiEndpoint:c(),userSession:u(),locale:p()},i()).then(n=>{t||e.set(l,n,!0)}).catch(n=>console.error("Failed to load shop item:",n)),()=>{t=!0}});const z=()=>{e.get(_)||!e.get(N)||!e.get(l)||e.sendRedeemRewardRequested(e.get(l).displayName||e.get(l).presentation.displayName,e.get(l).id)},V=()=>M(this,null,function*(){var n;if(!c()||!e.get(l)||e.get(_))return;e.set(_,!0),e.set(E,"");const t=e.get(l).id;try{yield e.redeemReward({apiEndpoint:c(),userSession:u()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton()}catch(s){e.set(E,(n=s==null?void 0:s.message)!=null?n:"Redeem failed",!0),e.sendRedeemRewardFailed(t,s)}finally{e.set(_,!1)}});e.user_effect(()=>{const t=n=>{var s,m,v;((s=n.data)==null?void 0:s.type)===e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED&&((m=n.data)==null?void 0:m.id)===((v=e.get(l))==null?void 0:v.id)&&V()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});var j={get apiEndpoint(){return c()},set apiEndpoint(t=""){c(t),e.flushSync()},get userSession(){return u()},set userSession(t=""){u(t),e.flushSync()},get locale(){return p()},set locale(t=""){p(t),e.flushSync()},get itemId(){return i()},set itemId(t=""){i(t),e.flushSync()},get elevateReward(){return r()},set elevateReward(t){r(t),e.flushSync()},get translationUrl(){return b()},set translationUrl(t){b(t),e.flushSync()}},T=e.comment(),D=e.first_child(T);{var A=t=>{var n=$(),s=e.child(n),m=e.child(s);{var v=h=>{var f=Q();e.template_effect(()=>{e.set_attribute(f,"src",e.get(k)||Y),e.set_attribute(f,"alt",e.get(R))}),e.append(h,f)};e.if_block(m,h=>{e.get(k)&&h(v)})}var L=e.sibling(m,2),H=e.only_child(L,!0),C=e.sibling(L,2),q=e.only_child(C),x=e.sibling(C,2),Z=e.only_child(x,!0);e.reset(s);var U=e.sibling(s,2);K.LoyaltyPointsCard(U,{get apiEndpoint(){return c()},get userSession(){return u()},get locale(){return p()}});var F=e.sibling(U,2);{var J=h=>{var f=X(),w=e.child(f),G=e.only_child(w,!0);e.reset(f),e.template_effect(()=>e.set_text(G,e.get(I))),e.append(h,f)};e.if_block(F,h=>{e.get(I)&&h(J)})}e.reset(n),e.template_effect((h,f)=>{var w;e.set_text(H,e.get(R)),e.set_text(q,`${(w=e.get(l).points)!=null?w:""}
5
+ ${h!=null?h:""}`),x.disabled=!e.get(N)||e.get(_),e.set_text(Z,f)},[()=>o()("tokens"),()=>o()("buyNow")]),e.delegated("click",x,z),e.append(t,n)};e.if_block(D,t=>{e.get(l)&&t(A)})}e.append(y,T);var B=e.pop(j);return g(),B}e.delegate(["click"]);e.create_custom_element(S,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[],{mode:"open"});function O(y,a){e.push(a,!0);let o=e.prop(a,"apiEndpoint",7,""),d=e.prop(a,"userSession",7,""),g=e.prop(a,"locale",7,""),c=e.prop(a,"itemId",7,""),u=e.prop(a,"elevateReward"),p=e.prop(a,"translationUrl");var i={get apiEndpoint(){return o()},set apiEndpoint(r=""){o(r),e.flushSync()},get userSession(){return d()},set userSession(r=""){d(r),e.flushSync()},get locale(){return g()},set locale(r=""){g(r),e.flushSync()},get itemId(){return c()},set itemId(r=""){c(r),e.flushSync()},get elevateReward(){return u()},set elevateReward(r){u(r),e.flushSync()},get translationUrl(){return p()},set translationUrl(r){p(r),e.flushSync()}};return S(y,{get apiEndpoint(){return o()},get userSession(){return d()},get locale(){return g()},get itemId(){return c()},get elevateReward(){return u()},get translationUrl(){return p()}}),e.pop(i)}customElements.define("loyalty-shop-item",e.create_custom_element(O,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[]));const te=Object.freeze(Object.defineProperty({__proto__:null,default:O},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShopItem=S;exports.LoyaltyShopItem_ce=te;
@@ -14,7 +14,7 @@ var q = (g, a, o) => new Promise((d, _) => {
14
14
  }, c = (l) => l.done ? d(l.value) : Promise.resolve(l.value).then(u, v);
15
15
  c((o = o.apply(g, a)).next());
16
16
  });
17
- import { z as ve, c as Y, p as Q, a as fe, b as p, s as he, d as G, A as C, B as ye, C as ge, E as K, F as b, G as _e, H as we, m as s, f as be, g as xe, i as U, h as S, j as X, I as Ee, J as Re, K as ke, L as Se, k as m, l as Ie, n as M, q as x, o as I, r as O, t as z, v as N, M as Ne, w as j, u as T, x as Te, $ as Le, N as Ce, O as W } from "./LoyaltyPagination-o3rQCgms.js";
17
+ import { z as ve, c as Y, p as Q, a as fe, b as p, s as he, d as G, A as C, B as ye, C as ge, E as K, F as b, G as _e, H as we, m as s, f as be, g as xe, i as U, h as S, j as X, I as Ee, J as Re, K as ke, L as Se, k as m, l as Ie, n as M, q as E, o as I, r as O, t as z, v as N, M as Ne, w as j, u as T, x as Te, $ as Le, N as Ce, O as W } from "./LoyaltyPagination-o3rQCgms.js";
18
18
  import { L as Ue } from "./LoyaltyPointsCard-CdBEe40I.js";
19
19
  typeof globalThis.HTMLElement == "undefined" && (globalThis.HTMLElement = class {
20
20
  }, globalThis.customElements = { define() {
@@ -87,11 +87,11 @@ const Ae = {
87
87
  };
88
88
  function $(g, a) {
89
89
  Q(a, !0), fe(g, Ae);
90
- const o = () => Te(Le, "$_", d), [d, _] = Ie(), u = p(a, "apiEndpoint", 7, ""), v = p(a, "userSession", 7, ""), c = p(a, "locale", 7, ""), l = p(a, "itemId", 7, ""), r = p(a, "elevateReward"), E = p(a, "translationUrl");
90
+ const o = () => Te(Le, "$_", d), [d, _] = Ie(), u = p(a, "apiEndpoint", 7, ""), v = p(a, "userSession", 7, ""), c = p(a, "locale", 7, ""), l = p(a, "itemId", 7, ""), r = p(a, "elevateReward"), R = p(a, "translationUrl");
91
91
  he({ withLocale: c(), translations: {} }), Object.entries(Me).forEach(([e, t]) => {
92
92
  G(e, t);
93
93
  });
94
- let i = C(ye(r())), R = C(!1), V = C("");
94
+ let i = C(ye(r())), x = C(!1), V = C("");
95
95
  const A = T(() => {
96
96
  var e, t, n, f;
97
97
  return (f = (n = (t = (e = s(i)) == null ? void 0 : e.presentation) == null ? void 0 : t.assets) == null ? void 0 : n[0]) != null ? f : "";
@@ -105,7 +105,7 @@ function $(g, a) {
105
105
  var e;
106
106
  return ((e = s(i)) == null ? void 0 : e.available) === "true";
107
107
  }), te = () => {
108
- let e = new URL(E(), window.location.href);
108
+ let e = new URL(R(), window.location.href);
109
109
  fetch(e.href).then((t) => t.json()).then((t) => {
110
110
  Object.keys(t).forEach((n) => {
111
111
  G(n, t[n]);
@@ -115,37 +115,42 @@ function $(g, a) {
115
115
  });
116
116
  };
117
117
  ge(() => {
118
- E() && te();
118
+ R() && te();
119
119
  }), K(() => {
120
120
  if (r()) {
121
121
  b(i, r(), !0);
122
122
  return;
123
123
  }
124
- !u() || !l() || _e(
124
+ if (!u() || !l())
125
+ return;
126
+ let e = !1;
127
+ return _e(
125
128
  {
126
129
  apiEndpoint: u(),
127
130
  userSession: v(),
128
131
  locale: c()
129
132
  },
130
133
  l()
131
- ).then((e) => {
132
- b(i, e, !0);
133
- }).catch((e) => console.error("Failed to load shop item:", e));
134
+ ).then((t) => {
135
+ e || b(i, t, !0);
136
+ }).catch((t) => console.error("Failed to load shop item:", t)), () => {
137
+ e = !0;
138
+ };
134
139
  });
135
140
  const ae = () => {
136
- s(R) || !s(H) || !s(i) || Ce(s(i).displayName || s(i).presentation.displayName, s(i).id);
141
+ s(x) || !s(H) || !s(i) || Ce(s(i).displayName || s(i).presentation.displayName, s(i).id);
137
142
  }, se = () => q(this, null, function* () {
138
143
  var t;
139
- if (!u() || !s(i))
144
+ if (!u() || !s(i) || s(x))
140
145
  return;
141
- b(R, !0), b(V, "");
146
+ b(x, !0), b(V, "");
142
147
  const e = s(i).id;
143
148
  try {
144
149
  yield Ee({ apiEndpoint: u(), userSession: v() }, e), Re(e), ke();
145
150
  } catch (n) {
146
151
  b(V, (t = n == null ? void 0 : n.message) != null ? t : "Redeem failed", !0), Se(e, n);
147
152
  } finally {
148
- b(R, !1);
153
+ b(x, !1);
149
154
  }
150
155
  });
151
156
  K(() => {
@@ -187,10 +192,10 @@ function $(g, a) {
187
192
  r(e), m();
188
193
  },
189
194
  get translationUrl() {
190
- return E();
195
+ return R();
191
196
  },
192
197
  set translationUrl(e) {
193
- E(e), m();
198
+ R(e), m();
194
199
  }
195
200
  }, F = be(), re = xe(F);
196
201
  {
@@ -207,9 +212,9 @@ function $(g, a) {
207
212
  s(A) && h(w);
208
213
  });
209
214
  }
210
- var P = x(f, 2), le = I(P, !0), Z = x(P, 2), de = I(Z), L = x(Z, 2), ue = I(L, !0);
215
+ var P = E(f, 2), le = I(P, !0), Z = E(P, 2), de = I(Z), L = E(Z, 2), ue = I(L, !0);
211
216
  O(n);
212
- var J = x(n, 2);
217
+ var J = E(n, 2);
213
218
  Ue(J, {
214
219
  get apiEndpoint() {
215
220
  return u();
@@ -221,7 +226,7 @@ function $(g, a) {
221
226
  return c();
222
227
  }
223
228
  });
224
- var ce = x(J, 2);
229
+ var ce = E(J, 2);
225
230
  {
226
231
  var pe = (h) => {
227
232
  var y = je(), k = M(y), me = I(k, !0);
@@ -235,7 +240,7 @@ function $(g, a) {
235
240
  (h, y) => {
236
241
  var k;
237
242
  N(le, s(B)), N(de, `${(k = s(i).points) != null ? k : ""}
238
- ${h != null ? h : ""}`), L.disabled = !s(H) || s(R), N(ue, y);
243
+ ${h != null ? h : ""}`), L.disabled = !s(H) || s(x), N(ue, y);
239
244
  },
240
245
  [() => o()("tokens"), () => o()("buyNow")]
241
246
  ), Ne("click", L, ae), S(e, t);
@@ -1,5 +1,5 @@
1
1
  typeof globalThis.HTMLElement>"u"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const e=require("./LoyaltyPagination-DzmuO9_8.cjs"),G=require("./LoyaltyPointsCard-46BqNZEK.cjs");if(typeof window<"u"){let m=function(n){return function(...o){try{return n.apply(this,o)}catch(l){if(l instanceof DOMException&&l.message.includes("has already been used with this registry")||l instanceof Error&&l.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw l}}};customElements.define=m(customElements.define),Promise.resolve().then(()=>require("./LoyaltyPointsCard-46BqNZEK.cjs")).then(n=>n.LoyaltyPointsCard_ce).then(n=>{const o=n.default||n;customElements.get("loyalty-points-card")||customElements.define("loyalty-points-card",o.element||o)}).catch(n=>{console.error("BOOT ERROR:",n)})}const K={en:{tokens:"Tokens",buyNow:"Buy Now",back:"Back"},tr:{tokens:"Tokens",buyNow:"Şimdi Satın Al",back:"Geri"},da:{tokens:"Tokens",buyNow:"Køb nu",back:"Tilbage"},de:{tokens:"Token",buyNow:"Jetzt kaufen",back:"Zurück"},nl:{tokens:"Tokens",buyNow:"Nu kopen",back:"Terug"},fr:{tokens:"Jetons",buyNow:"Acheter",back:"Retour"},hu:{tokens:"Tokenek",buyNow:"Vásárlás",back:"Vissza"}},W="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='800px'%20height='800px'%20viewBox='0%200%20120%20120'%20fill='none'%3e%3crect%20width='120'%20height='120'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.2503%2038.4816C33.2603%2037.0472%2034.4199%2035.8864%2035.8543%2035.875H83.1463C84.5848%2035.875%2085.7503%2037.0431%2085.7503%2038.4816V80.5184C85.7403%2081.9528%2084.5807%2083.1136%2083.1463%2083.125H35.8543C34.4158%2083.1236%2033.2503%2081.957%2033.2503%2080.5184V38.4816ZM80.5006%2041.1251H38.5006V77.8751L62.8921%2053.4783C63.9172%2052.4536%2065.5788%2052.4536%2066.6039%2053.4783L80.5006%2067.4013V41.1251ZM43.75%2051.6249C43.75%2054.5244%2046.1005%2056.8749%2049%2056.8749C51.8995%2056.8749%2054.25%2054.5244%2054.25%2051.6249C54.25%2048.7254%2051.8995%2046.3749%2049%2046.3749C46.1005%2046.3749%2043.75%2048.7254%2043.75%2051.6249Z'%20fill='%23687787'/%3e%3c/svg%3e";var Y=e.from_html('<img class="loyalty-shop-item__image svelte-ravnpu"/>'),Q=e.from_html('<div class="loyalty-shop-item__card loyalty-shop-item__card--description svelte-ravnpu"><p class="loyalty-shop-item__description svelte-ravnpu"> </p></div>'),X=e.from_html('<div class="loyalty-shop-item svelte-ravnpu"><div class="loyalty-shop-item__card svelte-ravnpu"><!> <span class="loyalty-shop-item__title svelte-ravnpu"> </span> <span class="loyalty-shop-item__points svelte-ravnpu"> </span> <button class="loyalty-shop-item__button svelte-ravnpu" type="button"> </button></div> <!> <!></div>');const $={hash:"svelte-ravnpu",code:`.loyalty-shop-item.svelte-ravnpu {display:flex;flex-direction:column;gap:12px;}.loyalty-shop-item__card.svelte-ravnpu {display:flex;flex-direction:column;gap:8px;padding:16px;border-radius:10px;border:1px solid var(--border-default, rgba(251, 251, 251, 0.15));background-color:var(--app-container-bg-default, #022652);}.loyalty-shop-item__card--description.svelte-ravnpu {min-height:120px;}.loyalty-shop-item__image.svelte-ravnpu {width:100%;height:170px;border-radius:6px;}.loyalty-shop-item__title.svelte-ravnpu {color:var(--text-default, #ffffff);font-size:12px;font-weight:400;}.loyalty-shop-item__points.svelte-ravnpu {color:var(--text-subtle, #dfe3e8);font-size:14px;font-weight:400;}.loyalty-shop-item__button.svelte-ravnpu {margin-top:auto;width:100%;height:37px;padding:8px 16px;border:none;border-radius:6px;background:var(--button-primary-bg-default, #ffcc00);color:var(--button-primary-text-default, #261d00);font-size:12px;font-weight:400;cursor:pointer;}.loyalty-shop-item__button.svelte-ravnpu:disabled {opacity:0.4;cursor:default;}.loyalty-shop-item__description.svelte-ravnpu {color:var(--text-subtle, #dfe3e8);font-size:12px;line-height:1.4;margin:0;font-weight:500;min-height:120px;}
2
2
 
3
3
  @media (min-width: 768px) {.loyalty-shop-item__image.svelte-ravnpu {height:clamp(170px, 30vw, 400px);object-fit:cover;}
4
- }`};function b(m,n){e.push(n,!0),e.append_styles(m,$);const o=()=>e.store_get(e.$format,"$_",l),[l,f]=e.setup_stores(),i=e.prop(n,"apiEndpoint",7,""),d=e.prop(n,"userSession",7,""),p=e.prop(n,"locale",7,""),h=e.prop(n,"itemId",7,""),r=e.prop(n,"elevateReward"),g=e.prop(n,"translationUrl");e.setupI18n({withLocale:p(),translations:{}}),Object.entries(K).forEach(([t,a])=>{e.addNewMessages(t,a)});let s=e.state(e.proxy(r())),v=e.state(!1),w=e.state("");const x=e.user_derived(()=>e.get(s)?.presentation?.assets?.[0]??""),S=e.user_derived(()=>e.get(s)?.presentation?.displayName??e.get(s)?.displayName??""),E=e.user_derived(()=>e.get(s)?.presentation?.description??""),k=e.user_derived(()=>e.get(s)?.available==="true"),U=()=>{let t=new URL(g(),window.location.href);fetch(t.href).then(a=>a.json()).then(a=>{Object.keys(a).forEach(y=>{e.addNewMessages(y,a[y])})}).catch(a=>{console.log("loyalty shop item translation url err:",a)})};e.user_pre_effect(()=>{g()&&U()}),e.user_effect(()=>{if(r()){e.set(s,r(),!0);return}!i()||!h()||e.fetchShopItem({apiEndpoint:i(),userSession:d(),locale:p()},h()).then(t=>{e.set(s,t,!0)}).catch(t=>console.error("Failed to load shop item:",t))});const M=()=>{e.get(v)||!e.get(k)||!e.get(s)||e.sendRedeemRewardRequested(e.get(s).displayName||e.get(s).presentation.displayName,e.get(s).id)},O=async()=>{if(!i()||!e.get(s))return;e.set(v,!0),e.set(w,"");const t=e.get(s).id;try{await e.redeemReward({apiEndpoint:i(),userSession:d()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton()}catch(a){e.set(w,a?.message??"Redeem failed",!0),e.sendRedeemRewardFailed(t,a)}finally{e.set(v,!1)}};e.user_effect(()=>{const t=a=>{a.data?.type===e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED&&a.data?.id===e.get(s)?.id&&O()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});var P={get apiEndpoint(){return i()},set apiEndpoint(t=""){i(t),e.flushSync()},get userSession(){return d()},set userSession(t=""){d(t),e.flushSync()},get locale(){return p()},set locale(t=""){p(t),e.flushSync()},get itemId(){return h()},set itemId(t=""){h(t),e.flushSync()},get elevateReward(){return r()},set elevateReward(t){r(t),e.flushSync()},get translationUrl(){return g()},set translationUrl(t){g(t),e.flushSync()}},R=e.comment(),z=e.first_child(R);{var V=t=>{var a=X(),y=e.child(a),I=e.child(y);{var D=c=>{var u=Y();e.template_effect(()=>{e.set_attribute(u,"src",e.get(x)||W),e.set_attribute(u,"alt",e.get(S))}),e.append(c,u)};e.if_block(I,c=>{e.get(x)&&c(D)})}var N=e.sibling(I,2),A=e.only_child(N,!0),T=e.sibling(N,2),B=e.only_child(T),_=e.sibling(T,2),H=e.only_child(_,!0);e.reset(y);var L=e.sibling(y,2);G.LoyaltyPointsCard(L,{get apiEndpoint(){return i()},get userSession(){return d()},get locale(){return p()}});var q=e.sibling(L,2);{var Z=c=>{var u=Q(),F=e.child(u),J=e.only_child(F,!0);e.reset(u),e.template_effect(()=>e.set_text(J,e.get(E))),e.append(c,u)};e.if_block(q,c=>{e.get(E)&&c(Z)})}e.reset(a),e.template_effect((c,u)=>{e.set_text(A,e.get(S)),e.set_text(B,`${e.get(s).points??""}
5
- ${c??""}`),_.disabled=!e.get(k)||e.get(v),e.set_text(H,u)},[()=>o()("tokens"),()=>o()("buyNow")]),e.delegated("click",_,M),e.append(t,a)};e.if_block(z,t=>{e.get(s)&&t(V)})}e.append(m,R);var j=e.pop(P);return f(),j}e.delegate(["click"]);e.create_custom_element(b,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[],{mode:"open"});function C(m,n){e.push(n,!0);let o=e.prop(n,"apiEndpoint",7,""),l=e.prop(n,"userSession",7,""),f=e.prop(n,"locale",7,""),i=e.prop(n,"itemId",7,""),d=e.prop(n,"elevateReward"),p=e.prop(n,"translationUrl");var h={get apiEndpoint(){return o()},set apiEndpoint(r=""){o(r),e.flushSync()},get userSession(){return l()},set userSession(r=""){l(r),e.flushSync()},get locale(){return f()},set locale(r=""){f(r),e.flushSync()},get itemId(){return i()},set itemId(r=""){i(r),e.flushSync()},get elevateReward(){return d()},set elevateReward(r){d(r),e.flushSync()},get translationUrl(){return p()},set translationUrl(r){p(r),e.flushSync()}};return b(m,{get apiEndpoint(){return o()},get userSession(){return l()},get locale(){return f()},get itemId(){return i()},get elevateReward(){return d()},get translationUrl(){return p()}}),e.pop(h)}customElements.define("loyalty-shop-item",e.create_custom_element(C,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[]));const ee=Object.freeze(Object.defineProperty({__proto__:null,default:C},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShopItem=b;exports.LoyaltyShopItem_ce=ee;
4
+ }`};function b(m,n){e.push(n,!0),e.append_styles(m,$);const o=()=>e.store_get(e.$format,"$_",l),[l,y]=e.setup_stores(),i=e.prop(n,"apiEndpoint",7,""),d=e.prop(n,"userSession",7,""),c=e.prop(n,"locale",7,""),h=e.prop(n,"itemId",7,""),r=e.prop(n,"elevateReward"),v=e.prop(n,"translationUrl");e.setupI18n({withLocale:c(),translations:{}}),Object.entries(K).forEach(([t,a])=>{e.addNewMessages(t,a)});let s=e.state(e.proxy(r())),g=e.state(!1),w=e.state("");const x=e.user_derived(()=>e.get(s)?.presentation?.assets?.[0]??""),S=e.user_derived(()=>e.get(s)?.presentation?.displayName??e.get(s)?.displayName??""),E=e.user_derived(()=>e.get(s)?.presentation?.description??""),k=e.user_derived(()=>e.get(s)?.available==="true"),U=()=>{let t=new URL(v(),window.location.href);fetch(t.href).then(a=>a.json()).then(a=>{Object.keys(a).forEach(f=>{e.addNewMessages(f,a[f])})}).catch(a=>{console.log("loyalty shop item translation url err:",a)})};e.user_pre_effect(()=>{v()&&U()}),e.user_effect(()=>{if(r()){e.set(s,r(),!0);return}if(!i()||!h())return;let t=!1;return e.fetchShopItem({apiEndpoint:i(),userSession:d(),locale:c()},h()).then(a=>{t||e.set(s,a,!0)}).catch(a=>console.error("Failed to load shop item:",a)),()=>{t=!0}});const M=()=>{e.get(g)||!e.get(k)||!e.get(s)||e.sendRedeemRewardRequested(e.get(s).displayName||e.get(s).presentation.displayName,e.get(s).id)},O=async()=>{if(!i()||!e.get(s)||e.get(g))return;e.set(g,!0),e.set(w,"");const t=e.get(s).id;try{await e.redeemReward({apiEndpoint:i(),userSession:d()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton()}catch(a){e.set(w,a?.message??"Redeem failed",!0),e.sendRedeemRewardFailed(t,a)}finally{e.set(g,!1)}};e.user_effect(()=>{const t=a=>{a.data?.type===e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED&&a.data?.id===e.get(s)?.id&&O()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});var P={get apiEndpoint(){return i()},set apiEndpoint(t=""){i(t),e.flushSync()},get userSession(){return d()},set userSession(t=""){d(t),e.flushSync()},get locale(){return c()},set locale(t=""){c(t),e.flushSync()},get itemId(){return h()},set itemId(t=""){h(t),e.flushSync()},get elevateReward(){return r()},set elevateReward(t){r(t),e.flushSync()},get translationUrl(){return v()},set translationUrl(t){v(t),e.flushSync()}},R=e.comment(),z=e.first_child(R);{var V=t=>{var a=X(),f=e.child(a),I=e.child(f);{var D=p=>{var u=Y();e.template_effect(()=>{e.set_attribute(u,"src",e.get(x)||W),e.set_attribute(u,"alt",e.get(S))}),e.append(p,u)};e.if_block(I,p=>{e.get(x)&&p(D)})}var N=e.sibling(I,2),A=e.only_child(N,!0),T=e.sibling(N,2),B=e.only_child(T),_=e.sibling(T,2),H=e.only_child(_,!0);e.reset(f);var L=e.sibling(f,2);G.LoyaltyPointsCard(L,{get apiEndpoint(){return i()},get userSession(){return d()},get locale(){return c()}});var q=e.sibling(L,2);{var Z=p=>{var u=Q(),F=e.child(u),J=e.only_child(F,!0);e.reset(u),e.template_effect(()=>e.set_text(J,e.get(E))),e.append(p,u)};e.if_block(q,p=>{e.get(E)&&p(Z)})}e.reset(a),e.template_effect((p,u)=>{e.set_text(A,e.get(S)),e.set_text(B,`${e.get(s).points??""}
5
+ ${p??""}`),_.disabled=!e.get(k)||e.get(g),e.set_text(H,u)},[()=>o()("tokens"),()=>o()("buyNow")]),e.delegated("click",_,M),e.append(t,a)};e.if_block(z,t=>{e.get(s)&&t(V)})}e.append(m,R);var j=e.pop(P);return y(),j}e.delegate(["click"]);e.create_custom_element(b,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[],{mode:"open"});function C(m,n){e.push(n,!0);let o=e.prop(n,"apiEndpoint",7,""),l=e.prop(n,"userSession",7,""),y=e.prop(n,"locale",7,""),i=e.prop(n,"itemId",7,""),d=e.prop(n,"elevateReward"),c=e.prop(n,"translationUrl");var h={get apiEndpoint(){return o()},set apiEndpoint(r=""){o(r),e.flushSync()},get userSession(){return l()},set userSession(r=""){l(r),e.flushSync()},get locale(){return y()},set locale(r=""){y(r),e.flushSync()},get itemId(){return i()},set itemId(r=""){i(r),e.flushSync()},get elevateReward(){return d()},set elevateReward(r){d(r),e.flushSync()},get translationUrl(){return c()},set translationUrl(r){c(r),e.flushSync()}};return b(m,{get apiEndpoint(){return o()},get userSession(){return l()},get locale(){return y()},get itemId(){return i()},get elevateReward(){return d()},get translationUrl(){return c()}}),e.pop(h)}customElements.define("loyalty-shop-item",e.create_custom_element(C,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[]));const ee=Object.freeze(Object.defineProperty({__proto__:null,default:C},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShopItem=b;exports.LoyaltyShopItem_ce=ee;
@@ -1 +1 @@
1
- typeof globalThis.HTMLElement=="undefined"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const s=require("../components/LoyaltyShop-B2lSw5jy.cjs");if(typeof window!="undefined"){let o=function(e){return function(...n){try{return e.apply(this,n)}catch(t){if(t instanceof DOMException&&t.message.includes("has already been used with this registry")||t instanceof Error&&t.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw t}}};customElements.define=o(customElements.define),Promise.resolve().then(()=>require("../components/LoyaltyShop-B2lSw5jy.cjs")).then(e=>e.LoyaltyShop_ce).then(e=>{const n=e.default||e;customElements.get("loyalty-shop")||customElements.define("loyalty-shop",n.element||n)}).catch(e=>{console.error("BOOT ERROR:",e)})}module.exports=s.LoyaltyShop;
1
+ typeof globalThis.HTMLElement=="undefined"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const s=require("../components/LoyaltyShop-DTaj_V0H.cjs");if(typeof window!="undefined"){let o=function(e){return function(...n){try{return e.apply(this,n)}catch(t){if(t instanceof DOMException&&t.message.includes("has already been used with this registry")||t instanceof Error&&t.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw t}}};customElements.define=o(customElements.define),Promise.resolve().then(()=>require("../components/LoyaltyShop-DTaj_V0H.cjs")).then(e=>e.LoyaltyShop_ce).then(e=>{const n=e.default||e;customElements.get("loyalty-shop")||customElements.define("loyalty-shop",n.element||n)}).catch(e=>{console.error("BOOT ERROR:",e)})}module.exports=s.LoyaltyShop;
@@ -1,4 +1,4 @@
1
- import { L as a } from "../components/LoyaltyShop-DGAZjo_P.js";
1
+ import { L as a } from "../components/LoyaltyShop-Jn3qrA-n.js";
2
2
  typeof globalThis.HTMLElement == "undefined" && (globalThis.HTMLElement = class {
3
3
  }, globalThis.customElements = { define() {
4
4
  }, get() {
@@ -16,7 +16,7 @@ if (typeof window != "undefined") {
16
16
  }
17
17
  };
18
18
  };
19
- customElements.define = s(customElements.define), import("../components/LoyaltyShop-DGAZjo_P.js").then((e) => e.a).then((e) => {
19
+ customElements.define = s(customElements.define), import("../components/LoyaltyShop-Jn3qrA-n.js").then((e) => e.a).then((e) => {
20
20
  const n = e.default || e;
21
21
  customElements.get("loyalty-shop") || customElements.define("loyalty-shop", n.element || n);
22
22
  }).catch((e) => {
@@ -1 +1 @@
1
- typeof globalThis.HTMLElement>"u"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const s=require("../components/LoyaltyShop-DGLy6Hu5.cjs");if(typeof window<"u"){let o=function(e){return function(...n){try{return e.apply(this,n)}catch(t){if(t instanceof DOMException&&t.message.includes("has already been used with this registry")||t instanceof Error&&t.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw t}}};customElements.define=o(customElements.define),Promise.resolve().then(()=>require("../components/LoyaltyShop-DGLy6Hu5.cjs")).then(e=>e.LoyaltyShop_ce).then(e=>{const n=e.default||e;customElements.get("loyalty-shop")||customElements.define("loyalty-shop",n.element||n)}).catch(e=>{console.error("BOOT ERROR:",e)})}module.exports=s.LoyaltyShop;
1
+ typeof globalThis.HTMLElement>"u"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const s=require("../components/LoyaltyShop-WqEP7fBO.cjs");if(typeof window<"u"){let o=function(e){return function(...n){try{return e.apply(this,n)}catch(t){if(t instanceof DOMException&&t.message.includes("has already been used with this registry")||t instanceof Error&&t.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw t}}};customElements.define=o(customElements.define),Promise.resolve().then(()=>require("../components/LoyaltyShop-WqEP7fBO.cjs")).then(e=>e.LoyaltyShop_ce).then(e=>{const n=e.default||e;customElements.get("loyalty-shop")||customElements.define("loyalty-shop",n.element||n)}).catch(e=>{console.error("BOOT ERROR:",e)})}module.exports=s.LoyaltyShop;
@@ -1,4 +1,4 @@
1
- import { L as a } from "../components/LoyaltyShop-_bWN39Rn.js";
1
+ import { L as a } from "../components/LoyaltyShop-ttYCQMVa.js";
2
2
  typeof globalThis.HTMLElement > "u" && (globalThis.HTMLElement = class {
3
3
  }, globalThis.customElements = { define() {
4
4
  }, get() {
@@ -16,7 +16,7 @@ if (typeof window < "u") {
16
16
  }
17
17
  };
18
18
  };
19
- customElements.define = s(customElements.define), import("../components/LoyaltyShop-_bWN39Rn.js").then((e) => e.a).then((e) => {
19
+ customElements.define = s(customElements.define), import("../components/LoyaltyShop-ttYCQMVa.js").then((e) => e.a).then((e) => {
20
20
  const n = e.default || e;
21
21
  customElements.get("loyalty-shop") || customElements.define("loyalty-shop", n.element || n);
22
22
  }).catch((e) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@everymatrix/loyalty-shop",
3
- "version": "0.1.22",
3
+ "version": "0.1.23",
4
4
  "type": "module",
5
5
  "main": "./esnext/loyalty-shop.cjs",
6
6
  "module": "./esnext/loyalty-shop.js",