@everymatrix/loyalty-shop 0.1.11 → 0.1.13
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-BcRXvso4.js → LoyaltyPagination-B-q5gKJj.js} +2429 -2837
- package/components/LoyaltyPagination-Boz7CVJt.cjs +16 -0
- package/components/LoyaltyPagination-CEvN3M3n.cjs +16 -0
- package/components/LoyaltyPagination-Z_igiBkY.js +6754 -0
- package/components/LoyaltyPointsCard-BhdXzF1P.cjs +18 -0
- package/components/LoyaltyPointsCard-DRKV1-dq.js +254 -0
- package/components/LoyaltyPointsCard-Dh-TnTTL.cjs +18 -0
- package/components/{LoyaltyPointsCard-DMYnP3nm.js → LoyaltyPointsCard-yCHI1R_t.js} +42 -36
- package/components/LoyaltyShop-BsZThRDe.cjs +27 -0
- package/components/LoyaltyShop-CtNpYAKa.js +517 -0
- package/components/LoyaltyShop-Cx8CxsMn.cjs +27 -0
- package/components/{LoyaltyShop-DV-j5py7.js → LoyaltyShop-DoIx97J9.js} +261 -223
- package/components/LoyaltyShopItem-BRiUNphq.cjs +5 -0
- package/components/{LoyaltyShopItem-BRu06lmS.js → LoyaltyShopItem-C2xuJLoW.js} +82 -74
- package/components/LoyaltyShopItem-D_oViqJP.cjs +5 -0
- package/components/LoyaltyShopItem-bXQ_G5NK.js +355 -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 +5 -2
- package/components/LoyaltyPagination-CiEOz3pr.cjs +0 -16
- package/components/LoyaltyPointsCard-BcX6gbsm.cjs +0 -18
- package/components/LoyaltyShop-CJ-9FkKC.cjs +0 -27
- package/components/LoyaltyShopItem-Dd0M-wKW.cjs +0 -5
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
typeof globalThis.HTMLElement>"u"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const e=require("./LoyaltyPagination-Boz7CVJt.cjs"),G=require("./LoyaltyPointsCard-BhdXzF1P.cjs");if(typeof window<"u"){let m=function(r){return function(...o){try{return r.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-BhdXzF1P.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,"$_",l),[l,y]=e.setup_stores(),i=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"),v=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 E=e.user_derived(()=>e.get(s)?.presentation?.assets?.[0]??""),k=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"),M=()=>{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()&&M()}),e.user_effect(()=>{if(n()){e.set(s,n(),!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 O=()=>{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(!i()||!e.get(s))return;e.set(g,!0),e.set(S,"");const t=e.get(s).id;try{await e.redeemReward({apiEndpoint:i(),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 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 n()},set elevateReward(t){n(t),e.flushSync()},get translationUrl(){return v()},set translationUrl(t){v(t),e.flushSync()}},N=e.comment(),V=e.first_child(N);{var j=t=>{var a=X(),f=e.child(a),T=e.child(f);{var A=c=>{var u=Y();e.template_effect(()=>{e.set_attribute(u,"src",e.get(E)||W),e.set_attribute(u,"alt",e.get(k))}),e.append(c,u)};e.if_block(T,c=>{e.get(E)&&c(A)})}var b=e.sibling(T,2),B=e.child(b,!0);e.reset(b);var w=e.sibling(b,2),H=e.child(w);e.reset(w);var _=e.sibling(w,2);_.__click=O;var q=e.child(_,!0);e.reset(_),e.reset(f);var L=e.sibling(f,2);G.LoyaltyPointsCard(L,{get apiEndpoint(){return i()},get userSession(){return d()},get locale(){return p()}});var Z=e.sibling(L,2);{var F=c=>{var u=Q(),C=e.child(u),J=e.child(C,!0);e.reset(C),e.reset(u),e.template_effect(()=>e.set_text(J,e.get(R))),e.append(c,u)};e.if_block(Z,c=>{e.get(R)&&c(F)})}e.reset(a),e.template_effect((c,u)=>{e.set_text(B,e.get(k)),e.set_text(H,`${e.get(s).points??""}
|
|
5
|
+
${c??""}`),_.disabled=!e.get(I)||e.get(g),e.set_text(q,u)},[()=>o()("tokens"),()=>o()("buyNow")]),e.append(t,a)};e.if_block(V,t=>{e.get(s)&&t(j)})}e.append(m,N);var D=e.pop(z);return y(),D}e.delegate(["click"]);e.create_custom_element(x,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[],!0);function U(m,r){e.push(r,!0);let o=e.prop(r,"apiEndpoint",7,""),l=e.prop(r,"userSession",7,""),y=e.prop(r,"locale",7,""),i=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 l()},set userSession(n=""){l(n),e.flushSync()},get locale(){return y()},set locale(n=""){y(n),e.flushSync()},get itemId(){return i()},set itemId(n=""){i(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 l()},get locale(){return y()},get itemId(){return i()},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:{}},[],[],!1));const ee=Object.freeze(Object.defineProperty({__proto__:null,default:U},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShopItem=x;exports.LoyaltyShopItem_ce=ee;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import { y as
|
|
2
|
-
import { L as
|
|
1
|
+
import { y as pe, c as G, p as K, a as me, b as o, s as ve, d as Z, z as C, A as fe, B as he, C as J, E as w, F as ye, G as ge, m as a, f as _e, g as we, i as U, h as S, j as W, H as be, I as xe, J as Ee, K as Re, k as i, l as ke, n as f, o as x, r as h, t as M, q as I, v as O, u as T, L as Se, w as Ie, $ as Te, M as q } from "./LoyaltyPagination-B-q5gKJj.js";
|
|
2
|
+
import { L as Ne } from "./LoyaltyPointsCard-yCHI1R_t.js";
|
|
3
|
+
typeof globalThis.HTMLElement > "u" && (globalThis.HTMLElement = class {
|
|
4
|
+
}, globalThis.customElements = { define() {
|
|
5
|
+
}, get() {
|
|
6
|
+
}, whenDefined() {
|
|
7
|
+
} });
|
|
3
8
|
if (typeof window < "u") {
|
|
4
9
|
let y = function(t) {
|
|
5
10
|
return function(...l) {
|
|
@@ -12,14 +17,14 @@ if (typeof window < "u") {
|
|
|
12
17
|
}
|
|
13
18
|
};
|
|
14
19
|
};
|
|
15
|
-
customElements.define = y(customElements.define), import("./LoyaltyPointsCard-
|
|
20
|
+
customElements.define = y(customElements.define), import("./LoyaltyPointsCard-yCHI1R_t.js").then((t) => t.a).then((t) => {
|
|
16
21
|
const l = t.default || t;
|
|
17
22
|
customElements.get("loyalty-points-card") || customElements.define("loyalty-points-card", l.element || l);
|
|
18
23
|
}).catch((t) => {
|
|
19
24
|
console.error("BOOT ERROR:", t);
|
|
20
25
|
});
|
|
21
26
|
}
|
|
22
|
-
const
|
|
27
|
+
const Le = {
|
|
23
28
|
en: {
|
|
24
29
|
tokens: "Tokens",
|
|
25
30
|
buyNow: "Buy Now",
|
|
@@ -55,9 +60,9 @@ const Te = {
|
|
|
55
60
|
buyNow: "Vásárlás",
|
|
56
61
|
back: "Vissza"
|
|
57
62
|
}
|
|
58
|
-
},
|
|
59
|
-
var
|
|
60
|
-
const
|
|
63
|
+
}, Ce = "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";
|
|
64
|
+
var Ue = O('<img class="loyalty-shop-item__image svelte-ravnpu"/>'), Me = O('<div class="loyalty-shop-item__card loyalty-shop-item__card--description svelte-ravnpu"><p class="loyalty-shop-item__description svelte-ravnpu"> </p></div>'), Oe = O('<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>');
|
|
65
|
+
const ze = {
|
|
61
66
|
hash: "svelte-ravnpu",
|
|
62
67
|
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;}
|
|
63
68
|
|
|
@@ -65,13 +70,13 @@ const je = {
|
|
|
65
70
|
}`
|
|
66
71
|
};
|
|
67
72
|
function Y(y, t) {
|
|
68
|
-
K(t, !0), me(y,
|
|
69
|
-
const l = () => Ie(
|
|
70
|
-
ve({ withLocale:
|
|
73
|
+
K(t, !0), me(y, ze);
|
|
74
|
+
const l = () => Ie(Te, "$_", d), [d, b] = ke(), u = o(t, "apiEndpoint", 7, ""), c = o(t, "userSession", 7, ""), p = o(t, "locale", 7, ""), g = o(t, "itemId", 7, ""), n = o(t, "elevateReward"), E = o(t, "translationUrl");
|
|
75
|
+
ve({ withLocale: p(), translations: {} }), Object.entries(Le).forEach(([e, s]) => {
|
|
71
76
|
Z(e, s);
|
|
72
77
|
});
|
|
73
|
-
let
|
|
74
|
-
const j =
|
|
78
|
+
let r = C(fe(n())), R = C(!1), z = C("");
|
|
79
|
+
const j = T(() => a(r)?.presentation?.assets?.[0] ?? ""), V = T(() => a(r)?.presentation?.displayName ?? a(r)?.displayName ?? ""), A = T(() => a(r)?.presentation?.description ?? ""), B = T(() => a(r)?.available === "true"), X = () => {
|
|
75
80
|
let e = new URL(E(), window.location.href);
|
|
76
81
|
fetch(e.href).then((s) => s.json()).then((s) => {
|
|
77
82
|
Object.keys(s).forEach((_) => {
|
|
@@ -84,30 +89,30 @@ function Y(y, t) {
|
|
|
84
89
|
he(() => {
|
|
85
90
|
E() && X();
|
|
86
91
|
}), J(() => {
|
|
87
|
-
if (
|
|
88
|
-
w(
|
|
92
|
+
if (n()) {
|
|
93
|
+
w(r, n(), !0);
|
|
89
94
|
return;
|
|
90
95
|
}
|
|
91
96
|
!u() || !g() || ye(
|
|
92
97
|
{
|
|
93
98
|
apiEndpoint: u(),
|
|
94
|
-
userSession:
|
|
95
|
-
locale:
|
|
99
|
+
userSession: c(),
|
|
100
|
+
locale: p()
|
|
96
101
|
},
|
|
97
102
|
g()
|
|
98
103
|
).then((e) => {
|
|
99
|
-
w(
|
|
104
|
+
w(r, e, !0);
|
|
100
105
|
}).catch((e) => console.error("Failed to load shop item:", e));
|
|
101
106
|
});
|
|
102
107
|
const $ = () => {
|
|
103
|
-
a(R) || !a(B) || !a(
|
|
108
|
+
a(R) || !a(B) || !a(r) || Se(a(r).displayName || a(r).presentation.displayName, a(r).id);
|
|
104
109
|
}, ee = async () => {
|
|
105
|
-
if (!u() || !a(
|
|
110
|
+
if (!u() || !a(r))
|
|
106
111
|
return;
|
|
107
112
|
w(R, !0), w(z, "");
|
|
108
|
-
const e = a(
|
|
113
|
+
const e = a(r).id;
|
|
109
114
|
try {
|
|
110
|
-
await be({ apiEndpoint: u(), userSession:
|
|
115
|
+
await be({ apiEndpoint: u(), userSession: c() }, e), xe(e), Ee();
|
|
111
116
|
} catch (s) {
|
|
112
117
|
w(z, s?.message ?? "Redeem failed", !0), Re(e, s);
|
|
113
118
|
} finally {
|
|
@@ -116,7 +121,7 @@ function Y(y, t) {
|
|
|
116
121
|
};
|
|
117
122
|
J(() => {
|
|
118
123
|
const e = (s) => {
|
|
119
|
-
s.data?.type === ge.REDEEM_REWARD_CONFIRMED && s.data?.id === a(
|
|
124
|
+
s.data?.type === ge.REDEEM_REWARD_CONFIRMED && s.data?.id === a(r)?.id && ee();
|
|
120
125
|
};
|
|
121
126
|
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
122
127
|
});
|
|
@@ -128,16 +133,16 @@ function Y(y, t) {
|
|
|
128
133
|
u(e), i();
|
|
129
134
|
},
|
|
130
135
|
get userSession() {
|
|
131
|
-
return
|
|
136
|
+
return c();
|
|
132
137
|
},
|
|
133
138
|
set userSession(e = "") {
|
|
134
|
-
|
|
139
|
+
c(e), i();
|
|
135
140
|
},
|
|
136
141
|
get locale() {
|
|
137
|
-
return
|
|
142
|
+
return p();
|
|
138
143
|
},
|
|
139
144
|
set locale(e = "") {
|
|
140
|
-
|
|
145
|
+
p(e), i();
|
|
141
146
|
},
|
|
142
147
|
get itemId() {
|
|
143
148
|
return g();
|
|
@@ -146,10 +151,10 @@ function Y(y, t) {
|
|
|
146
151
|
g(e), i();
|
|
147
152
|
},
|
|
148
153
|
get elevateReward() {
|
|
149
|
-
return
|
|
154
|
+
return n();
|
|
150
155
|
},
|
|
151
156
|
set elevateReward(e) {
|
|
152
|
-
|
|
157
|
+
n(e), i();
|
|
153
158
|
},
|
|
154
159
|
get translationUrl() {
|
|
155
160
|
return E();
|
|
@@ -160,63 +165,65 @@ function Y(y, t) {
|
|
|
160
165
|
}, D = _e(), ae = we(D);
|
|
161
166
|
{
|
|
162
167
|
var se = (e) => {
|
|
163
|
-
var s =
|
|
168
|
+
var s = Oe(), _ = f(s), H = f(_);
|
|
164
169
|
{
|
|
165
|
-
var
|
|
166
|
-
var v =
|
|
167
|
-
|
|
168
|
-
q(v, "src", a(j) ||
|
|
170
|
+
var re = (m) => {
|
|
171
|
+
var v = Ue();
|
|
172
|
+
M(() => {
|
|
173
|
+
q(v, "src", a(j) || Ce), q(v, "alt", a(V));
|
|
169
174
|
}), S(m, v);
|
|
170
175
|
};
|
|
171
|
-
U(
|
|
172
|
-
a(j) && m(
|
|
176
|
+
U(H, (m) => {
|
|
177
|
+
a(j) && m(re);
|
|
173
178
|
});
|
|
174
179
|
}
|
|
175
|
-
var
|
|
176
|
-
h(
|
|
177
|
-
var L = x(
|
|
180
|
+
var N = x(H, 2), oe = f(N, !0);
|
|
181
|
+
h(N);
|
|
182
|
+
var L = x(N, 2), ie = f(L);
|
|
178
183
|
h(L);
|
|
179
|
-
var k = x(L, 2)
|
|
184
|
+
var k = x(L, 2);
|
|
185
|
+
k.__click = $;
|
|
186
|
+
var le = f(k, !0);
|
|
180
187
|
h(k), h(_);
|
|
181
|
-
var
|
|
182
|
-
|
|
188
|
+
var F = x(_, 2);
|
|
189
|
+
Ne(F, {
|
|
183
190
|
get apiEndpoint() {
|
|
184
191
|
return u();
|
|
185
192
|
},
|
|
186
193
|
get userSession() {
|
|
187
|
-
return
|
|
194
|
+
return c();
|
|
188
195
|
},
|
|
189
196
|
get locale() {
|
|
190
|
-
return
|
|
197
|
+
return p();
|
|
191
198
|
}
|
|
192
199
|
});
|
|
193
|
-
var de = x(
|
|
200
|
+
var de = x(F, 2);
|
|
194
201
|
{
|
|
195
202
|
var ue = (m) => {
|
|
196
|
-
var v = Me(), P = f(v),
|
|
197
|
-
h(P), h(v),
|
|
203
|
+
var v = Me(), P = f(v), ce = f(P, !0);
|
|
204
|
+
h(P), h(v), M(() => I(ce, a(A))), S(m, v);
|
|
198
205
|
};
|
|
199
206
|
U(de, (m) => {
|
|
200
207
|
a(A) && m(ue);
|
|
201
208
|
});
|
|
202
209
|
}
|
|
203
|
-
h(s),
|
|
210
|
+
h(s), M(
|
|
204
211
|
(m, v) => {
|
|
205
|
-
I(oe, a(V)), I(ie, `${a(
|
|
212
|
+
I(oe, a(V)), I(ie, `${a(r).points ?? ""}
|
|
206
213
|
${m ?? ""}`), k.disabled = !a(B) || a(R), I(le, v);
|
|
207
214
|
},
|
|
208
215
|
[() => l()("tokens"), () => l()("buyNow")]
|
|
209
|
-
),
|
|
216
|
+
), S(e, s);
|
|
210
217
|
};
|
|
211
218
|
U(ae, (e) => {
|
|
212
|
-
a(
|
|
219
|
+
a(r) && e(se);
|
|
213
220
|
});
|
|
214
221
|
}
|
|
215
222
|
S(y, D);
|
|
216
|
-
var
|
|
217
|
-
return b(),
|
|
223
|
+
var ne = W(te);
|
|
224
|
+
return b(), ne;
|
|
218
225
|
}
|
|
219
|
-
|
|
226
|
+
pe(["click"]);
|
|
220
227
|
G(
|
|
221
228
|
Y,
|
|
222
229
|
{
|
|
@@ -229,47 +236,47 @@ G(
|
|
|
229
236
|
},
|
|
230
237
|
[],
|
|
231
238
|
[],
|
|
232
|
-
|
|
239
|
+
!0
|
|
233
240
|
);
|
|
234
241
|
function Q(y, t) {
|
|
235
242
|
K(t, !0);
|
|
236
|
-
let l = o(t, "apiEndpoint", 7, ""), d = o(t, "userSession", 7, ""), b = o(t, "locale", 7, ""), u = o(t, "itemId", 7, ""),
|
|
243
|
+
let l = o(t, "apiEndpoint", 7, ""), d = o(t, "userSession", 7, ""), b = o(t, "locale", 7, ""), u = o(t, "itemId", 7, ""), c = o(t, "elevateReward"), p = o(t, "translationUrl");
|
|
237
244
|
var g = {
|
|
238
245
|
get apiEndpoint() {
|
|
239
246
|
return l();
|
|
240
247
|
},
|
|
241
|
-
set apiEndpoint(
|
|
242
|
-
l(
|
|
248
|
+
set apiEndpoint(n = "") {
|
|
249
|
+
l(n), i();
|
|
243
250
|
},
|
|
244
251
|
get userSession() {
|
|
245
252
|
return d();
|
|
246
253
|
},
|
|
247
|
-
set userSession(
|
|
248
|
-
d(
|
|
254
|
+
set userSession(n = "") {
|
|
255
|
+
d(n), i();
|
|
249
256
|
},
|
|
250
257
|
get locale() {
|
|
251
258
|
return b();
|
|
252
259
|
},
|
|
253
|
-
set locale(
|
|
254
|
-
b(
|
|
260
|
+
set locale(n = "") {
|
|
261
|
+
b(n), i();
|
|
255
262
|
},
|
|
256
263
|
get itemId() {
|
|
257
264
|
return u();
|
|
258
265
|
},
|
|
259
|
-
set itemId(
|
|
260
|
-
u(
|
|
266
|
+
set itemId(n = "") {
|
|
267
|
+
u(n), i();
|
|
261
268
|
},
|
|
262
269
|
get elevateReward() {
|
|
263
|
-
return
|
|
270
|
+
return c();
|
|
264
271
|
},
|
|
265
|
-
set elevateReward(
|
|
266
|
-
|
|
272
|
+
set elevateReward(n) {
|
|
273
|
+
c(n), i();
|
|
267
274
|
},
|
|
268
275
|
get translationUrl() {
|
|
269
|
-
return
|
|
276
|
+
return p();
|
|
270
277
|
},
|
|
271
|
-
set translationUrl(
|
|
272
|
-
|
|
278
|
+
set translationUrl(n) {
|
|
279
|
+
p(n), i();
|
|
273
280
|
}
|
|
274
281
|
};
|
|
275
282
|
return Y(y, {
|
|
@@ -286,10 +293,10 @@ function Q(y, t) {
|
|
|
286
293
|
return u();
|
|
287
294
|
},
|
|
288
295
|
get elevateReward() {
|
|
289
|
-
return
|
|
296
|
+
return c();
|
|
290
297
|
},
|
|
291
298
|
get translationUrl() {
|
|
292
|
-
return
|
|
299
|
+
return p();
|
|
293
300
|
}
|
|
294
301
|
}), W(g);
|
|
295
302
|
}
|
|
@@ -304,13 +311,14 @@ customElements.define("loyalty-shop-item", G(
|
|
|
304
311
|
translationUrl: {}
|
|
305
312
|
},
|
|
306
313
|
[],
|
|
307
|
-
[]
|
|
314
|
+
[],
|
|
315
|
+
!1
|
|
308
316
|
));
|
|
309
|
-
const
|
|
317
|
+
const Ae = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
310
318
|
__proto__: null,
|
|
311
319
|
default: Q
|
|
312
320
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
313
321
|
export {
|
|
314
322
|
Y as L,
|
|
315
|
-
|
|
323
|
+
Ae as a
|
|
316
324
|
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var M=(y,n,o)=>new Promise((d,v)=>{var p=i=>{try{c(o.next(i))}catch(r){v(r)}},u=i=>{try{c(o.throw(i))}catch(r){v(r)}},c=i=>i.done?d(i.value):Promise.resolve(i.value).then(p,u);c((o=o.apply(y,n)).next())});typeof globalThis.HTMLElement=="undefined"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const e=require("./LoyaltyPagination-CEvN3M3n.cjs"),K=require("./LoyaltyPointsCard-Dh-TnTTL.cjs");if(typeof window!="undefined"){let y=function(n){return function(...o){try{return n.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-Dh-TnTTL.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 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
|
+
|
|
3
|
+
@media (min-width: 768px) {.loyalty-shop-item__image.svelte-ravnpu {height:clamp(170px, 30vw, 400px);object-fit:cover;}
|
|
4
|
+
}`};function k(y,n){e.push(n,!0),e.append_styles(y,ee);const o=()=>e.store_get(e.$format,"$_",d),[d,v]=e.setup_stores(),p=e.prop(n,"apiEndpoint",7,""),u=e.prop(n,"userSession",7,""),c=e.prop(n,"locale",7,""),i=e.prop(n,"itemId",7,""),r=e.prop(n,"elevateReward"),b=e.prop(n,"translationUrl");e.setupI18n({withLocale:c(),translations:{}}),Object.entries(W).forEach(([t,a])=>{e.addNewMessages(t,a)});let l=e.state(e.proxy(r())),w=e.state(!1),R=e.state("");const I=e.user_derived(()=>{var t,a,s,m;return(m=(s=(a=(t=e.get(l))==null?void 0:t.presentation)==null?void 0:a.assets)==null?void 0:s[0])!=null?m:""}),N=e.user_derived(()=>{var t,a,s,m,g;return(g=(m=(a=(t=e.get(l))==null?void 0:t.presentation)==null?void 0:a.displayName)!=null?m:(s=e.get(l))==null?void 0:s.displayName)!=null?g:""}),T=e.user_derived(()=>{var t,a,s;return(s=(a=(t=e.get(l))==null?void 0:t.presentation)==null?void 0:a.description)!=null?s:""}),L=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(a=>a.json()).then(a=>{Object.keys(a).forEach(s=>{e.addNewMessages(s,a[s])})}).catch(a=>{console.log("loyalty shop item translation url err:",a)})};e.user_pre_effect(()=>{b()&&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(w)||!e.get(L)||!e.get(l)||e.sendRedeemRewardRequested(e.get(l).displayName||e.get(l).presentation.displayName,e.get(l).id)},V=()=>M(this,null,function*(){var a;if(!p()||!e.get(l))return;e.set(w,!0),e.set(R,"");const t=e.get(l).id;try{yield e.redeemReward({apiEndpoint:p(),userSession:u()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton()}catch(s){e.set(R,(a=s==null?void 0:s.message)!=null?a:"Redeem failed",!0),e.sendRedeemRewardFailed(t,s)}finally{e.set(w,!1)}});e.user_effect(()=>{const t=a=>{var s,m,g;((s=a.data)==null?void 0:s.type)===e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED&&((m=a.data)==null?void 0:m.id)===((g=e.get(l))==null?void 0:g.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 b()},set translationUrl(t){b(t),e.flushSync()}},C=e.comment(),D=e.first_child(C);{var A=t=>{var a=$(),s=e.child(a),m=e.child(s);{var g=h=>{var f=Q();e.template_effect(()=>{e.set_attribute(f,"src",e.get(I)||Y),e.set_attribute(f,"alt",e.get(N))}),e.append(h,f)};e.if_block(m,h=>{e.get(I)&&h(g)})}var S=e.sibling(m,2),H=e.child(S,!0);e.reset(S);var E=e.sibling(S,2),q=e.child(E);e.reset(E);var x=e.sibling(E,2);x.__click=z;var Z=e.child(x,!0);e.reset(x),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 f=X(),_=e.child(f),G=e.child(_,!0);e.reset(_),e.reset(f),e.template_effect(()=>e.set_text(G,e.get(T))),e.append(h,f)};e.if_block(F,h=>{e.get(T)&&h(J)})}e.reset(a),e.template_effect((h,f)=>{var _;e.set_text(H,e.get(N)),e.set_text(q,`${(_=e.get(l).points)!=null?_:""}
|
|
5
|
+
${h!=null?h:""}`),x.disabled=!e.get(L)||e.get(w),e.set_text(Z,f)},[()=>o()("tokens"),()=>o()("buyNow")]),e.append(t,a)};e.if_block(D,t=>{e.get(l)&&t(A)})}e.append(y,C);var B=e.pop(j);return v(),B}e.delegate(["click"]);e.create_custom_element(k,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[],!0);function O(y,n){e.push(n,!0);let o=e.prop(n,"apiEndpoint",7,""),d=e.prop(n,"userSession",7,""),v=e.prop(n,"locale",7,""),p=e.prop(n,"itemId",7,""),u=e.prop(n,"elevateReward"),c=e.prop(n,"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 v()},set locale(r=""){v(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 k(y,{get apiEndpoint(){return o()},get userSession(){return d()},get locale(){return v()},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:{}},[],[],!1));const te=Object.freeze(Object.defineProperty({__proto__:null,default:O},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShopItem=k;exports.LoyaltyShopItem_ce=te;
|