@everymatrix/loyalty-shop 0.1.11 → 0.1.12

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.
@@ -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 ce, c as G, p as K, a as me, b as o, s as ve, d as Z, z as T, 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 O, q as I, L as Se, v as M, u as N, w as Ie, $ as Ne, M as Ce, N as q } from "./LoyaltyPagination-BcRXvso4.js";
2
- import { L as Le } from "./LoyaltyPointsCard-DMYnP3nm.js";
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-DMYnP3nm.js").then((t) => t.a).then((t) => {
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 Te = {
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
- }, Ue = "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";
59
- var Oe = M('<img class="loyalty-shop-item__image svelte-ravnpu"/>'), Me = M('<div class="loyalty-shop-item__card loyalty-shop-item__card--description svelte-ravnpu"><p class="loyalty-shop-item__description svelte-ravnpu"> </p></div>'), ze = M('<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>');
60
- const je = {
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, je);
69
- const l = () => Ie(Ne, "$_", d), [d, b] = ke(), u = o(t, "apiEndpoint", 7, ""), p = o(t, "userSession", 7, ""), c = o(t, "locale", 7, ""), g = o(t, "itemId", 7, ""), r = o(t, "elevateReward"), E = o(t, "translationUrl");
70
- ve({ withLocale: c(), translations: {} }), Object.entries(Te).forEach(([e, s]) => {
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 n = T(fe(r())), R = T(!1), z = T("");
74
- const j = N(() => a(n)?.presentation?.assets?.[0] ?? ""), V = N(() => a(n)?.presentation?.displayName ?? a(n)?.displayName ?? ""), A = N(() => a(n)?.presentation?.description ?? ""), B = N(() => a(n)?.available === "true"), X = () => {
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 (r()) {
88
- w(n, r(), !0);
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: p(),
95
- locale: c()
99
+ userSession: c(),
100
+ locale: p()
96
101
  },
97
102
  g()
98
103
  ).then((e) => {
99
- w(n, e, !0);
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(n) || Ce(a(n).displayName || a(n).presentation.displayName, a(n).id);
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(n))
110
+ if (!u() || !a(r))
106
111
  return;
107
112
  w(R, !0), w(z, "");
108
- const e = a(n).id;
113
+ const e = a(r).id;
109
114
  try {
110
- await be({ apiEndpoint: u(), userSession: p() }, e), xe(e), Ee();
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(n)?.id && ee();
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 p();
136
+ return c();
132
137
  },
133
138
  set userSession(e = "") {
134
- p(e), i();
139
+ c(e), i();
135
140
  },
136
141
  get locale() {
137
- return c();
142
+ return p();
138
143
  },
139
144
  set locale(e = "") {
140
- c(e), i();
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 r();
154
+ return n();
150
155
  },
151
156
  set elevateReward(e) {
152
- r(e), i();
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 = ze(), _ = f(s), F = f(_);
168
+ var s = Oe(), _ = f(s), H = f(_);
164
169
  {
165
- var ne = (m) => {
166
- var v = Oe();
167
- O(() => {
168
- q(v, "src", a(j) || Ue), q(v, "alt", a(V));
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(F, (m) => {
172
- a(j) && m(ne);
176
+ U(H, (m) => {
177
+ a(j) && m(re);
173
178
  });
174
179
  }
175
- var C = x(F, 2), oe = f(C, !0);
176
- h(C);
177
- var L = x(C, 2), ie = f(L);
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), le = f(k, !0);
184
+ var k = x(L, 2);
185
+ k.__click = $;
186
+ var le = f(k, !0);
180
187
  h(k), h(_);
181
- var H = x(_, 2);
182
- Le(H, {
188
+ var F = x(_, 2);
189
+ Ne(F, {
183
190
  get apiEndpoint() {
184
191
  return u();
185
192
  },
186
193
  get userSession() {
187
- return p();
194
+ return c();
188
195
  },
189
196
  get locale() {
190
- return c();
197
+ return p();
191
198
  }
192
199
  });
193
- var de = x(H, 2);
200
+ var de = x(F, 2);
194
201
  {
195
202
  var ue = (m) => {
196
- var v = Me(), P = f(v), pe = f(P, !0);
197
- h(P), h(v), O(() => I(pe, a(A))), S(m, 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), O(
210
+ h(s), M(
204
211
  (m, v) => {
205
- I(oe, a(V)), I(ie, `${a(n).points ?? ""}
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
- ), Se("click", k, $), S(e, s);
216
+ ), S(e, s);
210
217
  };
211
218
  U(ae, (e) => {
212
- a(n) && e(se);
219
+ a(r) && e(se);
213
220
  });
214
221
  }
215
222
  S(y, D);
216
- var re = W(te);
217
- return b(), re;
223
+ var ne = W(te);
224
+ return b(), ne;
218
225
  }
219
- ce(["click"]);
226
+ pe(["click"]);
220
227
  G(
221
228
  Y,
222
229
  {
@@ -229,47 +236,47 @@ G(
229
236
  },
230
237
  [],
231
238
  [],
232
- { mode: "open" }
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, ""), p = o(t, "elevateReward"), c = o(t, "translationUrl");
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(r = "") {
242
- l(r), i();
248
+ set apiEndpoint(n = "") {
249
+ l(n), i();
243
250
  },
244
251
  get userSession() {
245
252
  return d();
246
253
  },
247
- set userSession(r = "") {
248
- d(r), i();
254
+ set userSession(n = "") {
255
+ d(n), i();
249
256
  },
250
257
  get locale() {
251
258
  return b();
252
259
  },
253
- set locale(r = "") {
254
- b(r), i();
260
+ set locale(n = "") {
261
+ b(n), i();
255
262
  },
256
263
  get itemId() {
257
264
  return u();
258
265
  },
259
- set itemId(r = "") {
260
- u(r), i();
266
+ set itemId(n = "") {
267
+ u(n), i();
261
268
  },
262
269
  get elevateReward() {
263
- return p();
270
+ return c();
264
271
  },
265
- set elevateReward(r) {
266
- p(r), i();
272
+ set elevateReward(n) {
273
+ c(n), i();
267
274
  },
268
275
  get translationUrl() {
269
- return c();
276
+ return p();
270
277
  },
271
- set translationUrl(r) {
272
- c(r), i();
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 p();
296
+ return c();
290
297
  },
291
298
  get translationUrl() {
292
- return c();
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 Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
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
- Be as a
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;