@everymatrix/loyalty-shop 0.2.0 → 0.2.2
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.
- package/components/LoyaltyPagination-B2XwqERr.cjs +14 -0
- package/components/LoyaltyPagination-B8amLojn.cjs +14 -0
- package/components/{LoyaltyPagination-CvGlrsHL.js → LoyaltyPagination-BqHc2i2H.js} +2841 -2576
- package/components/LoyaltyPagination-DOu-qNFO.js +7260 -0
- package/components/LoyaltyPointsCard-BjF9SVWO.js +249 -0
- package/components/LoyaltyPointsCard-C2Xj_0zZ.cjs +18 -0
- package/components/{LoyaltyPointsCard-4xMK1Yj3.js → LoyaltyPointsCard-DKq6yH_i.js} +60 -59
- package/components/LoyaltyPointsCard-DO9GoE9Q.cjs +18 -0
- package/components/{LoyaltyShop-BolB3kh1.js → LoyaltyShop-CBH93UYT.js} +168 -169
- package/components/LoyaltyShop-CCeVtHJ7.cjs +27 -0
- package/components/LoyaltyShop-CnX4zXMd.cjs +27 -0
- package/components/LoyaltyShop-aSar2Vkc.js +478 -0
- package/components/LoyaltyShopItem-BvxV4bEm.cjs +5 -0
- package/components/LoyaltyShopItem-CYoPPSZj.cjs +5 -0
- package/components/{LoyaltyShopItem-BF51hsPa.js → LoyaltyShopItem-DL7R43c_.js} +115 -109
- package/components/LoyaltyShopItem-bzNnPlQa.js +353 -0
- package/es2015/loyalty-shop.cjs +1 -0
- package/es2015/loyalty-shop.js +28 -0
- package/esnext/loyalty-shop.cjs +1 -1
- package/esnext/loyalty-shop.js +7 -2
- package/package.json +10 -4
- package/components/LoyaltyPagination-BfDVbl1b.js +0 -138
- package/components/LoyaltyPagination-BqAUwwMS.cjs +0 -16
- package/components/LoyaltyPagination-Ct4i2m7L.cjs +0 -12
- package/components/LoyaltyPagination-UwvULUW0.js +0 -137
- package/components/LoyaltyPointsCard-Cqwkhg0M.cjs +0 -18
- package/components/LoyaltyShop-B-D5synj.js +0 -6724
- package/components/LoyaltyShop-CIrwO8kv.cjs +0 -31
- package/components/LoyaltyShop-ChhuDPwH.js +0 -6624
- package/components/LoyaltyShop-DLj15-su.cjs +0 -27
- package/components/LoyaltyShopItem-lB3kVETK.cjs +0 -5
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./LoyaltyPagination-BqAUwwMS.cjs"),ve=require("./LoyaltyShopItem-lB3kVETK.cjs");if(typeof window<"u"){let f=function(n){return function(...l){try{return n.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-BqAUwwMS.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 f=function(n){return function(...l){try{return n.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-lB3kVETK.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 _e={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
|
-
90deg,
|
|
3
|
-
var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1)) 0%,
|
|
4
|
-
color-mix(in srgb, var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1)) 80%, white) 50%,
|
|
5
|
-
var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1)) 100%
|
|
6
|
-
);background-size:200% 100%;
|
|
7
|
-
animation: svelte-1f1q033-shimmer 3s linear infinite;border-radius:6px;}.skeleton-line.svelte-1f1q033 {height:14px;border-radius:6px;background:linear-gradient(
|
|
8
|
-
90deg,
|
|
9
|
-
var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1)) 0%,
|
|
10
|
-
color-mix(in srgb, var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1)) 80%, white) 50%,
|
|
11
|
-
var(--app-container-bg-subtle, rgba(251, 251, 251, 0.1)) 100%
|
|
12
|
-
);background-size:200% 100%;
|
|
13
|
-
animation: svelte-1f1q033-shimmer 3s linear infinite;}.skeleton-line--short.svelte-1f1q033 {width:40%;}.loyalty-shop__item--skeleton.svelte-1f1q033 {display:flex;flex-direction:column;}.loyalty-shop__item--skeleton.svelte-1f1q033 .loyalty-shop__item-image:where(.svelte-1f1q033) {width:100%;height:82px;border-radius:6px;}.loyalty-shop__item--skeleton.svelte-1f1q033 .loyalty-shop__item-title:where(.svelte-1f1q033) {width:90%;}.loyalty-shop__item--skeleton.svelte-1f1q033 .loyalty-shop__item-points:where(.svelte-1f1q033) {width:40%;}.loyalty-shop__item-button-skeleton.svelte-1f1q033 {margin-top:auto;width:100%;height:40px;border-radius:6px;}.loyalty-shop__item-image-container.svelte-1f1q033 {cursor:pointer;}
|
|
14
|
-
|
|
15
|
-
@keyframes svelte-1f1q033-shimmer {
|
|
16
|
-
0% {
|
|
17
|
-
background-position: 200% 0;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
100% {
|
|
21
|
-
background-position: -200% 0;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
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 B(f,n){e.push(n,!0),e.append_styles(f,Le);const l=()=>e.store_get(e.$format,"$_",r),[r,k]=e.setup_stores(),p=e.prop(n,"apiEndpoint",7,""),c=e.prop(n,"userSession",7,""),m=e.prop(n,"locale",7,""),a=e.prop(n,"limitItem",7,e.ITEMS_LIMIT_DEFAULT),S=e.prop(n,"translationUrl");e.setupI18n({withLocale:m(),translations:{}});const Y=async()=>{try{const t=new URL(S(),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(([i,_])=>{e.addNewMessages(i,_)})}catch(t){console.error("loyalty shop translation url err:",t)}};Object.entries(_e).forEach(([t,o])=>{e.addNewMessages(t,o)});let g=e.state(e.proxy([])),w=e.state(void 0),q=e.state(0),h=e.state(0),v=e.state(e.proxy(e.MOBILE_LOAD_ITEMS)),M=e.state(!1),R=e.state(!1),E=e.state(void 0),y=e.state(!1),I=e.state(void 0),L=0;const Z=e.user_derived(()=>typeof a()=="number"?a():parseInt(a(),e.ITEMS_LIMIT_DEFAULT)||e.ITEMS_LIMIT_DEFAULT),j=()=>{if(!p()||!c())return;e.set(M,!0),e.set(R,!1);const t=++L,o=e.get(y)&&e.get(h)>0;e.fetchShopRewards({apiEndpoint:p(),userSession:c(),locale:m()},e.get(h),e.get(v)).then(s=>{if(t!==L)return;const i=s.data??[];e.set(q,s.total??0,!0),o?e.set(g,[...e.get(g),...i],!0):e.set(g,i,!0)}).catch(s=>{t===L&&(e.set(R,!0),console.error("Failed to load shop rewards:",s))}).finally(()=>{t===L&&e.set(M,!1)})};e.user_effect(()=>{p(),c(),m(),e.get(h),e.get(v),j()}),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(I))return;const t=new IntersectionObserver(o=>{o.some(s=>s.isIntersecting)&&e.get(g).length<e.get(q)&&e.set(h,e.get(h)+e.get(v))},{rootMargin:"200px"});return t.observe(e.get(I)),()=>t.disconnect()}),e.user_pre_effect(()=>{S()&&Y()});const J=t=>t.presentation?.assets?.[0]??be,N=t=>t.displayName??t.presentation?.displayName??"",O=t=>t.available==="true",W=t=>{e.get(E)||!O(t)||e.sendRedeemRewardRequested(N(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(),j()}catch(o){e.sendRedeemRewardFailed(t,o)}finally{e.set(E,void 0)}}};e.user_effect(()=>{const t=o=>{const{type:s,id:i,source:_}=o.data??{};switch(s){case e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED:i&&e.get(g).some(T=>T.id===i)&&G(i);break;case e.EVENT_TYPES.BACK_BUTTON_CLICKED:_===e.SOURCE&&e.set(w,void 0);break}};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});const Q=()=>e.get(g).length?l()("generalError"):l()("noContent"),X=t=>{e.set(h,t,!0)},$=t=>{e.sendRewardItemClicked(t.displayName||t.presentation.displayName,t.id)},F=t=>{e.set(w,t,!0),$(t)},ee=t=>o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),F(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 m()},set locale(t=""){m(t),e.flushSync()},get limitItem(){return a()},set limitItem(t=e.ITEMS_LIMIT_DEFAULT){a(t),e.flushSync()},get translationUrl(){return S()},set translationUrl(t){S(t),e.flushSync()}},P=Ie(),ne=e.child(P);{var oe=t=>{ve.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 m()}})},se=t=>{var o=we();e.each(o,21,()=>Array(e.get(v)),e.index,(s,i,_,T)=>{var U=ke();e.append(s,U)}),e.reset(o),e.append(t,o)},le=t=>{var o=Ee(),s=e.child(o,!0);e.reset(o),e.template_effect(i=>e.set_text(s,i),[Q]),e.append(t,o)},re=t=>{var o=qe(),s=e.first_child(o);e.each(s,21,()=>e.get(g),u=>u.id,(u,d)=>{var b=xe();let V;var x=e.child(b),ie=e.user_derived(()=>ee(e.get(d))),K=e.child(x);e.reset(x);var A=e.sibling(x,2),de=e.child(A,!0);e.reset(A);var D=e.sibling(A,2),pe=e.child(D);e.reset(D);var C=e.sibling(D,2),ce=e.child(C,!0);e.reset(C),e.reset(b),e.template_effect((z,ue,ge,me,fe,he,ye)=>{V=e.set_class(b,1,"loyalty-shop__item svelte-1f1q033",null,V,z),e.set_attribute(K,"src",ue),e.set_attribute(K,"alt",ge),e.set_text(de,me),e.set_text(pe,`${e.get(d).points??""}
|
|
27
|
-
${fe??""}`),C.disabled=he,e.set_text(ce,ye)},[()=>({"loyalty-shop__item--unavailable":!O(e.get(d))}),()=>J(e.get(d)),()=>N(e.get(d)),()=>N(e.get(d)),()=>l()("tokens"),()=>!O(e.get(d))||e.get(E)===e.get(d).id,()=>l()("buyNow")]),e.delegated("click",x,()=>F(e.get(d))),e.delegated("keydown",x,function(...z){e.get(ie)?.apply(this,z)}),e.delegated("click",C,()=>W(e.get(d))),e.append(u,b)}),e.reset(s);var i=e.sibling(s,2);{var _=u=>{e.LoyaltyPagination(u,{get offset(){return e.get(h)},get limit(){return e.get(v)},get total(){return e.get(q)},onPageChange:X,get locale(){return m()}})};e.if_block(i,u=>{e.get(y)||u(_)})}var T=e.sibling(i,2);{var U=u=>{var d=Se();e.bind_this(d,b=>e.set(I,b),()=>e.get(I)),e.append(u,d)};e.if_block(T,u=>{e.get(y)&&e.get(g).length<e.get(q)&&u(U)})}e.append(t,o)};e.if_block(ne,t=>{e.get(w)?t(oe):e.get(M)&&e.get(g).length===0?t(se,1):!e.get(g).length||e.get(R)?t(le,2):t(re,-1)})}e.reset(P),e.append(f,P);var ae=e.pop(te);return k(),ae}e.delegate(["click","keydown"]);e.create_custom_element(B,{apiEndpoint:{},userSession:{},locale:{},limitItem:{},translationUrl:{}},[],[],{mode:"open"});function H(f,n){e.push(n,!0);let l=e.prop(n,"apiEndpoint",7,""),r=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 m={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 k()},set locale(a=""){k(a),e.flushSync()},get limitItem(){return p()},set limitItem(a=e.ITEMS_LIMIT_DEFAULT){p(a),e.flushSync()},get translationUrl(){return c()},set translationUrl(a){c(a),e.flushSync()}};return B(f,{get apiEndpoint(){return l()},get userSession(){return r()},get locale(){return k()},get limitItem(){return p()},get translationUrl(){return c()}}),e.pop(m)}customElements.define("loyalty-shop",e.create_custom_element(H,{apiEndpoint:{},userSession:{},locale:{},limitItem:{},translationUrl:{}},[],[]));const Te=Object.freeze(Object.defineProperty({__proto__:null,default:H},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShop=B;exports.LoyaltyShop_ce=Te;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";const e=require("./LoyaltyPagination-BqAUwwMS.cjs"),G=require("./LoyaltyPointsCard-Cqwkhg0M.cjs");if(typeof window<"u"){let m=function(r){return function(...o){try{return r.apply(this,o)}catch(i){if(i instanceof DOMException&&i.message.includes("has already been used with this registry")||i instanceof Error&&i.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw i}}};customElements.define=m(customElements.define),Promise.resolve().then(()=>require("./LoyaltyPointsCard-Cqwkhg0M.cjs")).then(r=>r.LoyaltyPointsCard_ce).then(r=>{const o=r.default||r;customElements.get("loyalty-points-card")||customElements.define("loyalty-points-card",o.element||o)}).catch(r=>{console.error("BOOT ERROR:",r)})}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
|
-
|
|
3
|
-
@media (min-width: 768px) {.loyalty-shop-item__image.svelte-ravnpu {height:clamp(170px, 30vw, 400px);object-fit:cover;}
|
|
4
|
-
}`};function x(m,r){e.push(r,!0),e.append_styles(m,$);const o=()=>e.store_get(e.$format,"$_",i),[i,v]=e.setup_stores(),l=e.prop(r,"apiEndpoint",7,""),d=e.prop(r,"userSession",7,""),p=e.prop(r,"locale",7,""),h=e.prop(r,"itemId",7,""),n=e.prop(r,"elevateReward"),f=e.prop(r,"translationUrl");e.setupI18n({withLocale:p(),translations:{}}),Object.entries(K).forEach(([t,a])=>{e.addNewMessages(t,a)});let s=e.state(e.proxy(n())),g=e.state(!1),S=e.state("");const k=e.user_derived(()=>e.get(s)?.presentation?.assets?.[0]??""),E=e.user_derived(()=>e.get(s)?.presentation?.displayName??e.get(s)?.displayName??""),R=e.user_derived(()=>e.get(s)?.presentation?.description??""),I=e.user_derived(()=>e.get(s)?.available==="true"),O=()=>{let t=new URL(f(),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(()=>{f()&&O()}),e.user_effect(()=>{if(n()){e.set(s,n(),!0);return}!l()||!h()||e.fetchShopItem({apiEndpoint:l(),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(g)||!e.get(I)||!e.get(s)||e.sendRedeemRewardRequested(e.get(s).displayName||e.get(s).presentation.displayName,e.get(s).id)},P=async()=>{if(!l()||!e.get(s))return;e.set(g,!0),e.set(S,"");const t=e.get(s).id;try{await e.redeemReward({apiEndpoint:l(),userSession:d()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton()}catch(a){e.set(S,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&&P()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});var z={get apiEndpoint(){return l()},set apiEndpoint(t=""){l(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 n()},set elevateReward(t){n(t),e.flushSync()},get translationUrl(){return f()},set translationUrl(t){f(t),e.flushSync()}},N=e.comment(),V=e.first_child(N);{var j=t=>{var a=X(),y=e.child(a),C=e.child(y);{var B=c=>{var u=Y();e.template_effect(()=>{e.set_attribute(u,"src",e.get(k)||W),e.set_attribute(u,"alt",e.get(E))}),e.append(c,u)};e.if_block(C,c=>{e.get(k)&&c(B)})}var b=e.sibling(C,2),D=e.child(b,!0);e.reset(b);var w=e.sibling(b,2),q=e.child(w);e.reset(w);var _=e.sibling(w,2),Z=e.child(_,!0);e.reset(_),e.reset(y);var L=e.sibling(y,2);G.LoyaltyPointsCard(L,{get apiEndpoint(){return l()},get userSession(){return d()},get locale(){return p()}});var F=e.sibling(L,2);{var H=c=>{var u=Q(),T=e.child(u),J=e.child(T,!0);e.reset(T),e.reset(u),e.template_effect(()=>e.set_text(J,e.get(R))),e.append(c,u)};e.if_block(F,c=>{e.get(R)&&c(H)})}e.reset(a),e.template_effect((c,u)=>{e.set_text(D,e.get(E)),e.set_text(q,`${e.get(s).points??""}
|
|
5
|
-
${c??""}`),_.disabled=!e.get(I)||e.get(g),e.set_text(Z,u)},[()=>o()("tokens"),()=>o()("buyNow")]),e.delegated("click",_,M),e.append(t,a)};e.if_block(V,t=>{e.get(s)&&t(j)})}e.append(m,N);var A=e.pop(z);return v(),A}e.delegate(["click"]);e.create_custom_element(x,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[],{mode:"open"});function U(m,r){e.push(r,!0);let o=e.prop(r,"apiEndpoint",7,""),i=e.prop(r,"userSession",7,""),v=e.prop(r,"locale",7,""),l=e.prop(r,"itemId",7,""),d=e.prop(r,"elevateReward"),p=e.prop(r,"translationUrl");var h={get apiEndpoint(){return o()},set apiEndpoint(n=""){o(n),e.flushSync()},get userSession(){return i()},set userSession(n=""){i(n),e.flushSync()},get locale(){return v()},set locale(n=""){v(n),e.flushSync()},get itemId(){return l()},set itemId(n=""){l(n),e.flushSync()},get elevateReward(){return d()},set elevateReward(n){d(n),e.flushSync()},get translationUrl(){return p()},set translationUrl(n){p(n),e.flushSync()}};return x(m,{get apiEndpoint(){return o()},get userSession(){return i()},get locale(){return v()},get itemId(){return l()},get elevateReward(){return d()},get translationUrl(){return p()}}),e.pop(h)}customElements.define("loyalty-shop-item",e.create_custom_element(U,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[]));const ee=Object.freeze(Object.defineProperty({__proto__:null,default:U},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShopItem=x;exports.LoyaltyShopItem_ce=ee;
|