@everymatrix/loyalty-shop 0.2.3 → 0.2.5

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.
Files changed (31) hide show
  1. package/components/{LoyaltyPagination-B8amLojn.cjs → LoyaltyPagination-B7JqsoUi.cjs} +8 -8
  2. package/components/{LoyaltyPagination-B2XwqERr.cjs → LoyaltyPagination-BRav_RW5.cjs} +8 -8
  3. package/components/{LoyaltyPagination-DOu-qNFO.js → LoyaltyPagination-Cw2snZwZ.js} +10 -10
  4. package/components/{LoyaltyPagination-BqHc2i2H.js → LoyaltyPagination-CyjgdUPo.js} +10 -10
  5. package/components/LoyaltyPointsCard-CFk3DpjI.js +249 -0
  6. package/components/LoyaltyPointsCard-DTOQlcMH.js +242 -0
  7. package/components/LoyaltyPointsCard-Xb627em8.cjs +18 -0
  8. package/components/LoyaltyPointsCard-njx77PMq.cjs +18 -0
  9. package/components/LoyaltyShop-8d3N_F-0.cjs +27 -0
  10. package/components/LoyaltyShop-BKubFlFr.js +478 -0
  11. package/components/LoyaltyShop-D_Oyu_cp.cjs +27 -0
  12. package/components/LoyaltyShop-Dfybp9ut.js +452 -0
  13. package/components/{LoyaltyShopItem-DL7R43c_.js → LoyaltyShopItem-BXrrNl9f.js} +72 -72
  14. package/components/LoyaltyShopItem-CGOptttz.cjs +5 -0
  15. package/components/{LoyaltyShopItem-bzNnPlQa.js → LoyaltyShopItem-CqY63kaT.js} +103 -103
  16. package/components/LoyaltyShopItem-DEz9OVzD.cjs +5 -0
  17. package/es2015/loyalty-shop.cjs +1 -1
  18. package/es2015/loyalty-shop.js +2 -2
  19. package/esnext/loyalty-shop.cjs +1 -1
  20. package/esnext/loyalty-shop.js +2 -2
  21. package/package.json +1 -1
  22. package/components/LoyaltyPointsCard-BjF9SVWO.js +0 -249
  23. package/components/LoyaltyPointsCard-C2Xj_0zZ.cjs +0 -18
  24. package/components/LoyaltyPointsCard-DKq6yH_i.js +0 -242
  25. package/components/LoyaltyPointsCard-DO9GoE9Q.cjs +0 -18
  26. package/components/LoyaltyShop-CBH93UYT.js +0 -452
  27. package/components/LoyaltyShop-CCeVtHJ7.cjs +0 -27
  28. package/components/LoyaltyShop-CnX4zXMd.cjs +0 -27
  29. package/components/LoyaltyShop-aSar2Vkc.js +0 -478
  30. package/components/LoyaltyShopItem-BvxV4bEm.cjs +0 -5
  31. package/components/LoyaltyShopItem-CYoPPSZj.cjs +0 -5
@@ -1,12 +1,12 @@
1
- import { z as me, c as G, p as K, a as ve, b as o, s as fe, d as Z, A as N, B as he, C as ye, E as J, F as g, G as ge, H as _e, m as t, f as we, g as be, i as T, h as E, j as W, I as xe, J as Ee, K as Re, L as ke, k as i, l as Se, n as L, q as b, o as R, r as C, t as U, v as k, M as Ie, w as M, u as S, x as Ne, $ as Te, N as Le, O as q } from "./LoyaltyPagination-BqHc2i2H.js";
2
- import { L as Ce } from "./LoyaltyPointsCard-DKq6yH_i.js";
1
+ import { z as me, c as G, p as K, a as fe, b as r, s as he, d as Z, A as N, B as ye, C as ge, E as J, F as _, G as _e, H as ve, m as t, f as we, g as be, i as T, h as E, j as W, I as xe, J as Ee, K as Re, L as ke, k as i, l as Se, n as L, q as b, o as R, r as C, t as U, v as k, M as Ie, w as M, u as S, x as Ne, $ as Te, N as Le, O as q } from "./LoyaltyPagination-CyjgdUPo.js";
2
+ import { L as Ce } from "./LoyaltyPointsCard-DTOQlcMH.js";
3
3
  typeof globalThis.HTMLElement > "u" && (globalThis.HTMLElement = class {
4
4
  }, globalThis.customElements = { define() {
5
5
  }, get() {
6
6
  }, whenDefined() {
7
7
  } });
8
8
  if (typeof window < "u") {
9
- let f = function(a) {
9
+ let h = function(a) {
10
10
  return function(...l) {
11
11
  try {
12
12
  return a.apply(this, l);
@@ -17,7 +17,7 @@ if (typeof window < "u") {
17
17
  }
18
18
  };
19
19
  };
20
- customElements.define = f(customElements.define), import("./LoyaltyPointsCard-DKq6yH_i.js").then((a) => a.a).then((a) => {
20
+ customElements.define = h(customElements.define), import("./LoyaltyPointsCard-DTOQlcMH.js").then((a) => a.a).then((a) => {
21
21
  const l = a.default || a;
22
22
  customElements.get("loyalty-points-card") || customElements.define("loyalty-points-card", l.element || l);
23
23
  }).catch((a) => {
@@ -61,87 +61,87 @@ const Ue = {
61
61
  back: "Vissza"
62
62
  }
63
63
  }, Me = "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 Oe = M('<img class="loyalty-shop-item__image svelte-ravnpu"/>'), ze = M('<div class="loyalty-shop-item__card loyalty-shop-item__card--description svelte-ravnpu"><p class="loyalty-shop-item__description svelte-ravnpu"> </p></div>'), je = 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>');
64
+ var Oe = M('<img class="loyalty-shop-item__image"/>'), ze = M('<div class="loyalty-shop-item__card loyalty-shop-item__card--description"><p class="loyalty-shop-item__description"> </p></div>'), je = M('<div class="loyalty-shop-item"><div class="loyalty-shop-item__card"><!> <span class="loyalty-shop-item__title"> </span> <span class="loyalty-shop-item__points"> </span> <button class="loyalty-shop-item__button" type="button"> </button></div> <!> <!></div>');
65
65
  const Ve = {
66
66
  hash: "svelte-ravnpu",
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;}
67
+ code: `.loyalty-shop-item {display:flex;flex-direction:column;gap:12px;}.loyalty-shop-item__card {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 {min-height:120px;}.loyalty-shop-item__image {width:100%;height:170px;border-radius:6px;}.loyalty-shop-item__title {color:var(--text-default, #ffffff);font-size:12px;font-weight:400;}.loyalty-shop-item__points {color:var(--text-subtle, #dfe3e8);font-size:14px;font-weight:400;}.loyalty-shop-item__button {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:disabled {opacity:0.4;cursor:default;}.loyalty-shop-item__description {color:var(--text-subtle, #dfe3e8);font-size:12px;line-height:1.4;margin:0;font-weight:500;min-height:120px;}
68
68
 
69
- @media (min-width: 768px) {.loyalty-shop-item__image.svelte-ravnpu {height:clamp(170px, 30vw, 400px);object-fit:cover;}
69
+ @media (min-width: 768px) {.loyalty-shop-item__image {height:clamp(170px, 30vw, 400px);object-fit:cover;}
70
70
  }`
71
71
  };
72
- function Y(f, a) {
73
- K(a, !0), ve(f, Ve);
74
- const l = () => Ne(Te, "$_", d), [d, _] = Se(), u = o(a, "apiEndpoint", 7, ""), c = o(a, "userSession", 7, ""), p = o(a, "locale", 7, ""), h = o(a, "itemId", 7, ""), n = o(a, "elevateReward"), x = o(a, "translationUrl");
75
- fe({ withLocale: p(), translations: {} }), Object.entries(Ue).forEach(([e, s]) => {
72
+ function Y(h, a) {
73
+ K(a, !0), fe(h, Ve);
74
+ const l = () => Ne(Te, "$_", d), [d, v] = Se(), c = r(a, "apiEndpoint", 7, ""), u = r(a, "userSession", 7, ""), p = r(a, "locale", 7, ""), y = r(a, "itemId", 7, ""), n = r(a, "elevateReward"), x = r(a, "translationUrl");
75
+ he({ withLocale: p(), translations: {} }), Object.entries(Ue).forEach(([e, s]) => {
76
76
  Z(e, s);
77
77
  });
78
- let r = N(he(n())), w = N(!1), O = N("");
79
- const z = S(() => t(r)?.presentation?.assets?.[0] ?? ""), j = S(() => t(r)?.presentation?.displayName ?? t(r)?.displayName ?? ""), V = S(() => t(r)?.presentation?.description ?? ""), A = S(() => t(r)?.available === "true"), X = () => {
78
+ let o = N(ye(n())), w = N(!1), O = N("");
79
+ const z = S(() => t(o)?.presentation?.assets?.[0] ?? ""), j = S(() => t(o)?.presentation?.displayName ?? t(o)?.displayName ?? ""), V = S(() => t(o)?.presentation?.description ?? ""), A = S(() => t(o)?.available === "true"), X = () => {
80
80
  let e = new URL(x(), window.location.href);
81
81
  fetch(e.href).then((s) => s.json()).then((s) => {
82
- Object.keys(s).forEach((y) => {
83
- Z(y, s[y]);
82
+ Object.keys(s).forEach((g) => {
83
+ Z(g, s[g]);
84
84
  });
85
85
  }).catch((s) => {
86
86
  console.log("loyalty shop item translation url err:", s);
87
87
  });
88
88
  };
89
- ye(() => {
89
+ ge(() => {
90
90
  x() && X();
91
91
  }), J(() => {
92
92
  if (n()) {
93
- g(r, n(), !0);
93
+ _(o, n(), !0);
94
94
  return;
95
95
  }
96
- if (!u() || !h())
96
+ if (!c() || !y())
97
97
  return;
98
98
  let e = !1;
99
- return ge(
99
+ return _e(
100
100
  {
101
- apiEndpoint: u(),
102
- userSession: c(),
101
+ apiEndpoint: c(),
102
+ userSession: u(),
103
103
  locale: p()
104
104
  },
105
- h()
105
+ y()
106
106
  ).then((s) => {
107
- e || g(r, s, !0);
107
+ e || _(o, s, !0);
108
108
  }).catch((s) => console.error("Failed to load shop item:", s)), () => {
109
109
  e = !0;
110
110
  };
111
111
  });
112
112
  const $ = () => {
113
- t(w) || !t(A) || !t(r) || Le(t(r).displayName || t(r).presentation.displayName, t(r).id);
113
+ t(w) || !t(A) || !t(o) || Le(t(o).displayName || t(o).presentation.displayName, t(o).id);
114
114
  }, ee = async () => {
115
- if (!u() || !t(r) || t(w))
115
+ if (!c() || !t(o) || t(w))
116
116
  return;
117
- g(w, !0), g(O, "");
118
- const e = t(r).id;
117
+ _(w, !0), _(O, "");
118
+ const e = t(o).id;
119
119
  try {
120
- await xe({ apiEndpoint: u(), userSession: c() }, e), Ee(e), Re();
120
+ await xe({ apiEndpoint: c(), userSession: u() }, e), Ee(e), Re();
121
121
  } catch (s) {
122
- g(O, s?.message ?? "Redeem failed", !0), ke(e, s);
122
+ _(O, s?.message ?? "Redeem failed", !0), ke(e, s);
123
123
  } finally {
124
- g(w, !1);
124
+ _(w, !1);
125
125
  }
126
126
  };
127
127
  J(() => {
128
128
  const e = (s) => {
129
- s.data?.type === _e.REDEEM_REWARD_CONFIRMED && s.data?.id === t(r)?.id && ee();
129
+ s.data?.type === ve.REDEEM_REWARD_CONFIRMED && s.data?.id === t(o)?.id && ee();
130
130
  };
131
131
  return window.addEventListener("message", e), () => window.removeEventListener("message", e);
132
132
  });
133
133
  var te = {
134
134
  get apiEndpoint() {
135
- return u();
135
+ return c();
136
136
  },
137
137
  set apiEndpoint(e = "") {
138
- u(e), i();
138
+ c(e), i();
139
139
  },
140
140
  get userSession() {
141
- return c();
141
+ return u();
142
142
  },
143
143
  set userSession(e = "") {
144
- c(e), i();
144
+ u(e), i();
145
145
  },
146
146
  get locale() {
147
147
  return p();
@@ -150,10 +150,10 @@ function Y(f, a) {
150
150
  p(e), i();
151
151
  },
152
152
  get itemId() {
153
- return h();
153
+ return y();
154
154
  },
155
155
  set itemId(e = "") {
156
- h(e), i();
156
+ y(e), i();
157
157
  },
158
158
  get elevateReward() {
159
159
  return n();
@@ -170,27 +170,27 @@ function Y(f, a) {
170
170
  }, B = we(), ae = be(B);
171
171
  {
172
172
  var se = (e) => {
173
- var s = je(), y = L(s), D = L(y);
173
+ var s = je(), g = L(s), D = L(g);
174
174
  {
175
- var re = (m) => {
176
- var v = Oe();
175
+ var oe = (m) => {
176
+ var f = Oe();
177
177
  U(() => {
178
- q(v, "src", t(z) || Me), q(v, "alt", t(j));
179
- }), E(m, v);
178
+ q(f, "src", t(z) || Me), q(f, "alt", t(j));
179
+ }), E(m, f);
180
180
  };
181
181
  T(D, (m) => {
182
- t(z) && m(re);
182
+ t(z) && m(oe);
183
183
  });
184
184
  }
185
- var H = b(D, 2), oe = R(H, !0), F = b(H, 2), ie = R(F), I = b(F, 2), le = R(I, !0);
186
- C(y);
187
- var P = b(y, 2);
185
+ var H = b(D, 2), re = R(H, !0), F = b(H, 2), ie = R(F), I = b(F, 2), le = R(I, !0);
186
+ C(g);
187
+ var P = b(g, 2);
188
188
  Ce(P, {
189
189
  get apiEndpoint() {
190
- return u();
190
+ return c();
191
191
  },
192
192
  get userSession() {
193
- return c();
193
+ return u();
194
194
  },
195
195
  get locale() {
196
196
  return p();
@@ -198,29 +198,29 @@ function Y(f, a) {
198
198
  });
199
199
  var de = b(P, 2);
200
200
  {
201
- var ue = (m) => {
202
- var v = ze(), ce = L(v), pe = R(ce, !0);
203
- C(v), U(() => k(pe, t(V))), E(m, v);
201
+ var ce = (m) => {
202
+ var f = ze(), ue = L(f), pe = R(ue, !0);
203
+ C(f), U(() => k(pe, t(V))), E(m, f);
204
204
  };
205
205
  T(de, (m) => {
206
- t(V) && m(ue);
206
+ t(V) && m(ce);
207
207
  });
208
208
  }
209
209
  C(s), U(
210
- (m, v) => {
211
- k(oe, t(j)), k(ie, `${t(r).points ?? ""}
212
- ${m ?? ""}`), I.disabled = !t(A) || t(w), k(le, v);
210
+ (m, f) => {
211
+ k(re, t(j)), k(ie, `${t(o).points ?? ""}
212
+ ${m ?? ""}`), I.disabled = !t(A) || t(w), k(le, f);
213
213
  },
214
214
  [() => l()("tokens"), () => l()("buyNow")]
215
215
  ), Ie("click", I, $), E(e, s);
216
216
  };
217
217
  T(ae, (e) => {
218
- t(r) && e(se);
218
+ t(o) && e(se);
219
219
  });
220
220
  }
221
- E(f, B);
221
+ E(h, B);
222
222
  var ne = W(te);
223
- return _(), ne;
223
+ return v(), ne;
224
224
  }
225
225
  me(["click"]);
226
226
  G(
@@ -237,10 +237,10 @@ G(
237
237
  [],
238
238
  { mode: "open" }
239
239
  );
240
- function Q(f, a) {
240
+ function Q(h, a) {
241
241
  K(a, !0);
242
- let l = o(a, "apiEndpoint", 7, ""), d = o(a, "userSession", 7, ""), _ = o(a, "locale", 7, ""), u = o(a, "itemId", 7, ""), c = o(a, "elevateReward"), p = o(a, "translationUrl");
243
- var h = {
242
+ let l = r(a, "apiEndpoint", 7, ""), d = r(a, "userSession", 7, ""), v = r(a, "locale", 7, ""), c = r(a, "itemId", 7, ""), u = r(a, "elevateReward"), p = r(a, "translationUrl");
243
+ var y = {
244
244
  get apiEndpoint() {
245
245
  return l();
246
246
  },
@@ -254,22 +254,22 @@ function Q(f, a) {
254
254
  d(n), i();
255
255
  },
256
256
  get locale() {
257
- return _();
257
+ return v();
258
258
  },
259
259
  set locale(n = "") {
260
- _(n), i();
260
+ v(n), i();
261
261
  },
262
262
  get itemId() {
263
- return u();
263
+ return c();
264
264
  },
265
265
  set itemId(n = "") {
266
- u(n), i();
266
+ c(n), i();
267
267
  },
268
268
  get elevateReward() {
269
- return c();
269
+ return u();
270
270
  },
271
271
  set elevateReward(n) {
272
- c(n), i();
272
+ u(n), i();
273
273
  },
274
274
  get translationUrl() {
275
275
  return p();
@@ -278,7 +278,7 @@ function Q(f, a) {
278
278
  p(n), i();
279
279
  }
280
280
  };
281
- return Y(f, {
281
+ return Y(h, {
282
282
  get apiEndpoint() {
283
283
  return l();
284
284
  },
@@ -286,18 +286,18 @@ function Q(f, a) {
286
286
  return d();
287
287
  },
288
288
  get locale() {
289
- return _();
289
+ return v();
290
290
  },
291
291
  get itemId() {
292
- return u();
292
+ return c();
293
293
  },
294
294
  get elevateReward() {
295
- return c();
295
+ return u();
296
296
  },
297
297
  get translationUrl() {
298
298
  return p();
299
299
  }
300
- }), W(h);
300
+ }), W(y);
301
301
  }
302
302
  customElements.define("loyalty-shop-item", G(
303
303
  Q,
@@ -0,0 +1,5 @@
1
+ typeof globalThis.HTMLElement>"u"&&(globalThis.HTMLElement=class{},globalThis.customElements={define(){},get(){},whenDefined(){}});const e=require("./LoyaltyPagination-B7JqsoUi.cjs"),G=require("./LoyaltyPointsCard-Xb627em8.cjs");if(typeof window<"u"){let m=function(n){return function(...s){try{return n.apply(this,s)}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-Xb627em8.cjs")).then(n=>n.LoyaltyPointsCard_ce).then(n=>{const s=n.default||n;customElements.get("loyalty-points-card")||customElements.define("loyalty-points-card",s.element||s)}).catch(n=>{console.error("BOOT ERROR:",n)})}const K={en:{tokens:"Tokens",buyNow:"Buy Now",back:"Back"},tr:{tokens:"Tokens",buyNow:"Şimdi Satın Al",back:"Geri"},da:{tokens:"Tokens",buyNow:"Køb nu",back:"Tilbage"},de:{tokens:"Token",buyNow:"Jetzt kaufen",back:"Zurück"},nl:{tokens:"Tokens",buyNow:"Nu kopen",back:"Terug"},fr:{tokens:"Jetons",buyNow:"Acheter",back:"Retour"},hu:{tokens:"Tokenek",buyNow:"Vásárlás",back:"Vissza"}},W="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='800px'%20height='800px'%20viewBox='0%200%20120%20120'%20fill='none'%3e%3crect%20width='120'%20height='120'/%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M33.2503%2038.4816C33.2603%2037.0472%2034.4199%2035.8864%2035.8543%2035.875H83.1463C84.5848%2035.875%2085.7503%2037.0431%2085.7503%2038.4816V80.5184C85.7403%2081.9528%2084.5807%2083.1136%2083.1463%2083.125H35.8543C34.4158%2083.1236%2033.2503%2081.957%2033.2503%2080.5184V38.4816ZM80.5006%2041.1251H38.5006V77.8751L62.8921%2053.4783C63.9172%2052.4536%2065.5788%2052.4536%2066.6039%2053.4783L80.5006%2067.4013V41.1251ZM43.75%2051.6249C43.75%2054.5244%2046.1005%2056.8749%2049%2056.8749C51.8995%2056.8749%2054.25%2054.5244%2054.25%2051.6249C54.25%2048.7254%2051.8995%2046.3749%2049%2046.3749C46.1005%2046.3749%2043.75%2048.7254%2043.75%2051.6249Z'%20fill='%23687787'/%3e%3c/svg%3e";var Y=e.from_html('<img class="loyalty-shop-item__image"/>'),Q=e.from_html('<div class="loyalty-shop-item__card loyalty-shop-item__card--description"><p class="loyalty-shop-item__description"> </p></div>'),X=e.from_html('<div class="loyalty-shop-item"><div class="loyalty-shop-item__card"><!> <span class="loyalty-shop-item__title"> </span> <span class="loyalty-shop-item__points"> </span> <button class="loyalty-shop-item__button" type="button"> </button></div> <!> <!></div>');const $={hash:"svelte-ravnpu",code:`.loyalty-shop-item {display:flex;flex-direction:column;gap:12px;}.loyalty-shop-item__card {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 {min-height:120px;}.loyalty-shop-item__image {width:100%;height:170px;border-radius:6px;}.loyalty-shop-item__title {color:var(--text-default, #ffffff);font-size:12px;font-weight:400;}.loyalty-shop-item__points {color:var(--text-subtle, #dfe3e8);font-size:14px;font-weight:400;}.loyalty-shop-item__button {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:disabled {opacity:0.4;cursor:default;}.loyalty-shop-item__description {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 {height:clamp(170px, 30vw, 400px);object-fit:cover;}
4
+ }`};function b(m,n){e.push(n,!0),e.append_styles(m,$);const s=()=>e.store_get(e.$format,"$_",i),[i,y]=e.setup_stores(),l=e.prop(n,"apiEndpoint",7,""),d=e.prop(n,"userSession",7,""),c=e.prop(n,"locale",7,""),h=e.prop(n,"itemId",7,""),a=e.prop(n,"elevateReward"),_=e.prop(n,"translationUrl");e.setupI18n({withLocale:c(),translations:{}}),Object.entries(K).forEach(([t,o])=>{e.addNewMessages(t,o)});let r=e.state(e.proxy(a())),g=e.state(!1),w=e.state("");const x=e.user_derived(()=>e.get(r)?.presentation?.assets?.[0]??""),S=e.user_derived(()=>e.get(r)?.presentation?.displayName??e.get(r)?.displayName??""),E=e.user_derived(()=>e.get(r)?.presentation?.description??""),k=e.user_derived(()=>e.get(r)?.available==="true"),U=()=>{let t=new URL(_(),window.location.href);fetch(t.href).then(o=>o.json()).then(o=>{Object.keys(o).forEach(f=>{e.addNewMessages(f,o[f])})}).catch(o=>{console.log("loyalty shop item translation url err:",o)})};e.user_pre_effect(()=>{_()&&U()}),e.user_effect(()=>{if(a()){e.set(r,a(),!0);return}if(!l()||!h())return;let t=!1;return e.fetchShopItem({apiEndpoint:l(),userSession:d(),locale:c()},h()).then(o=>{t||e.set(r,o,!0)}).catch(o=>console.error("Failed to load shop item:",o)),()=>{t=!0}});const M=()=>{e.get(g)||!e.get(k)||!e.get(r)||e.sendRedeemRewardRequested(e.get(r).displayName||e.get(r).presentation.displayName,e.get(r).id)},O=async()=>{if(!l()||!e.get(r)||e.get(g))return;e.set(g,!0),e.set(w,"");const t=e.get(r).id;try{await e.redeemReward({apiEndpoint:l(),userSession:d()},t),e.sendRedeemRewardSuccess(t),e.dispatchRedeemRewardButton()}catch(o){e.set(w,o?.message??"Redeem failed",!0),e.sendRedeemRewardFailed(t,o)}finally{e.set(g,!1)}};e.user_effect(()=>{const t=o=>{o.data?.type===e.EVENT_TYPES.REDEEM_REWARD_CONFIRMED&&o.data?.id===e.get(r)?.id&&O()};return window.addEventListener("message",t),()=>window.removeEventListener("message",t)});var P={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 c()},set locale(t=""){c(t),e.flushSync()},get itemId(){return h()},set itemId(t=""){h(t),e.flushSync()},get elevateReward(){return a()},set elevateReward(t){a(t),e.flushSync()},get translationUrl(){return _()},set translationUrl(t){_(t),e.flushSync()}},R=e.comment(),z=e.first_child(R);{var V=t=>{var o=X(),f=e.child(o),I=e.child(f);{var D=p=>{var u=Y();e.template_effect(()=>{e.set_attribute(u,"src",e.get(x)||W),e.set_attribute(u,"alt",e.get(S))}),e.append(p,u)};e.if_block(I,p=>{e.get(x)&&p(D)})}var N=e.sibling(I,2),A=e.only_child(N,!0),T=e.sibling(N,2),B=e.only_child(T),v=e.sibling(T,2),H=e.only_child(v,!0);e.reset(f);var L=e.sibling(f,2);G.LoyaltyPointsCard(L,{get apiEndpoint(){return l()},get userSession(){return d()},get locale(){return c()}});var q=e.sibling(L,2);{var Z=p=>{var u=Q(),F=e.child(u),J=e.only_child(F,!0);e.reset(u),e.template_effect(()=>e.set_text(J,e.get(E))),e.append(p,u)};e.if_block(q,p=>{e.get(E)&&p(Z)})}e.reset(o),e.template_effect((p,u)=>{e.set_text(A,e.get(S)),e.set_text(B,`${e.get(r).points??""}
5
+ ${p??""}`),v.disabled=!e.get(k)||e.get(g),e.set_text(H,u)},[()=>s()("tokens"),()=>s()("buyNow")]),e.delegated("click",v,M),e.append(t,o)};e.if_block(z,t=>{e.get(r)&&t(V)})}e.append(m,R);var j=e.pop(P);return y(),j}e.delegate(["click"]);e.create_custom_element(b,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[],{mode:"open"});function C(m,n){e.push(n,!0);let s=e.prop(n,"apiEndpoint",7,""),i=e.prop(n,"userSession",7,""),y=e.prop(n,"locale",7,""),l=e.prop(n,"itemId",7,""),d=e.prop(n,"elevateReward"),c=e.prop(n,"translationUrl");var h={get apiEndpoint(){return s()},set apiEndpoint(a=""){s(a),e.flushSync()},get userSession(){return i()},set userSession(a=""){i(a),e.flushSync()},get locale(){return y()},set locale(a=""){y(a),e.flushSync()},get itemId(){return l()},set itemId(a=""){l(a),e.flushSync()},get elevateReward(){return d()},set elevateReward(a){d(a),e.flushSync()},get translationUrl(){return c()},set translationUrl(a){c(a),e.flushSync()}};return b(m,{get apiEndpoint(){return s()},get userSession(){return i()},get locale(){return y()},get itemId(){return l()},get elevateReward(){return d()},get translationUrl(){return c()}}),e.pop(h)}customElements.define("loyalty-shop-item",e.create_custom_element(C,{apiEndpoint:{},userSession:{},locale:{},itemId:{},elevateReward:{},translationUrl:{}},[],[]));const ee=Object.freeze(Object.defineProperty({__proto__:null,default:C},Symbol.toStringTag,{value:"Module"}));exports.LoyaltyShopItem=b;exports.LoyaltyShopItem_ce=ee;