@everymatrix/loyalty-shop 0.1.8 → 0.1.10
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 +7073 -0
- package/components/LoyaltyPagination-CiEOz3pr.cjs +16 -0
- package/components/LoyaltyPointsCard-BcX6gbsm.cjs +18 -0
- package/components/LoyaltyPointsCard-DMYnP3nm.js +241 -0
- package/components/LoyaltyShop-CJ-9FkKC.cjs +27 -0
- package/components/LoyaltyShop-DV-j5py7.js +453 -0
- package/components/LoyaltyShopItem-BRu06lmS.js +316 -0
- package/components/LoyaltyShopItem-Dd0M-wKW.cjs +5 -0
- package/esnext/loyalty-shop.cjs +1 -0
- package/esnext/loyalty-shop.js +23 -0
- package/package.json +9 -8
- package/components/LoyaltyPagination-BFOXFDPJ.js +0 -144
- package/components/LoyaltyPagination-DmhT7cnV.js +0 -143
- package/components/LoyaltyPagination-ISl0nfTe.cjs +0 -12
- package/components/LoyaltyShop-CXYYTheE.js +0 -6490
- package/components/LoyaltyShop-DdRqHIuf.js +0 -6395
- package/components/LoyaltyShop-rDkxy2lO.cjs +0 -31
- package/es2015/loyalty-shop.cjs +0 -1
- package/es2015/loyalty-shop.js +0 -16
|
@@ -0,0 +1,316 @@
|
|
|
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";
|
|
3
|
+
if (typeof window < "u") {
|
|
4
|
+
let y = function(t) {
|
|
5
|
+
return function(...l) {
|
|
6
|
+
try {
|
|
7
|
+
return t.apply(this, l);
|
|
8
|
+
} catch (d) {
|
|
9
|
+
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"))
|
|
10
|
+
return !1;
|
|
11
|
+
throw d;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
customElements.define = y(customElements.define), import("./LoyaltyPointsCard-DMYnP3nm.js").then((t) => t.a).then((t) => {
|
|
16
|
+
const l = t.default || t;
|
|
17
|
+
customElements.get("loyalty-points-card") || customElements.define("loyalty-points-card", l.element || l);
|
|
18
|
+
}).catch((t) => {
|
|
19
|
+
console.error("BOOT ERROR:", t);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
const Te = {
|
|
23
|
+
en: {
|
|
24
|
+
tokens: "Tokens",
|
|
25
|
+
buyNow: "Buy Now",
|
|
26
|
+
back: "Back"
|
|
27
|
+
},
|
|
28
|
+
tr: {
|
|
29
|
+
tokens: "Tokens",
|
|
30
|
+
buyNow: "Şimdi Satın Al",
|
|
31
|
+
back: "Geri"
|
|
32
|
+
},
|
|
33
|
+
da: {
|
|
34
|
+
tokens: "Tokens",
|
|
35
|
+
buyNow: "Køb nu",
|
|
36
|
+
back: "Tilbage"
|
|
37
|
+
},
|
|
38
|
+
de: {
|
|
39
|
+
tokens: "Token",
|
|
40
|
+
buyNow: "Jetzt kaufen",
|
|
41
|
+
back: "Zurück"
|
|
42
|
+
},
|
|
43
|
+
nl: {
|
|
44
|
+
tokens: "Tokens",
|
|
45
|
+
buyNow: "Nu kopen",
|
|
46
|
+
back: "Terug"
|
|
47
|
+
},
|
|
48
|
+
fr: {
|
|
49
|
+
tokens: "Jetons",
|
|
50
|
+
buyNow: "Acheter",
|
|
51
|
+
back: "Retour"
|
|
52
|
+
},
|
|
53
|
+
hu: {
|
|
54
|
+
tokens: "Tokenek",
|
|
55
|
+
buyNow: "Vásárlás",
|
|
56
|
+
back: "Vissza"
|
|
57
|
+
}
|
|
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 = {
|
|
61
|
+
hash: "svelte-ravnpu",
|
|
62
|
+
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
|
+
|
|
64
|
+
@media (min-width: 768px) {.loyalty-shop-item__image.svelte-ravnpu {height:clamp(170px, 30vw, 400px);object-fit:cover;}
|
|
65
|
+
}`
|
|
66
|
+
};
|
|
67
|
+
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]) => {
|
|
71
|
+
Z(e, s);
|
|
72
|
+
});
|
|
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 = () => {
|
|
75
|
+
let e = new URL(E(), window.location.href);
|
|
76
|
+
fetch(e.href).then((s) => s.json()).then((s) => {
|
|
77
|
+
Object.keys(s).forEach((_) => {
|
|
78
|
+
Z(_, s[_]);
|
|
79
|
+
});
|
|
80
|
+
}).catch((s) => {
|
|
81
|
+
console.log("loyalty shop item translation url err:", s);
|
|
82
|
+
});
|
|
83
|
+
};
|
|
84
|
+
he(() => {
|
|
85
|
+
E() && X();
|
|
86
|
+
}), J(() => {
|
|
87
|
+
if (r()) {
|
|
88
|
+
w(n, r(), !0);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
!u() || !g() || ye(
|
|
92
|
+
{
|
|
93
|
+
apiEndpoint: u(),
|
|
94
|
+
userSession: p(),
|
|
95
|
+
locale: c()
|
|
96
|
+
},
|
|
97
|
+
g()
|
|
98
|
+
).then((e) => {
|
|
99
|
+
w(n, e, !0);
|
|
100
|
+
}).catch((e) => console.error("Failed to load shop item:", e));
|
|
101
|
+
});
|
|
102
|
+
const $ = () => {
|
|
103
|
+
a(R) || !a(B) || !a(n) || Ce(a(n).displayName || a(n).presentation.displayName, a(n).id);
|
|
104
|
+
}, ee = async () => {
|
|
105
|
+
if (!u() || !a(n))
|
|
106
|
+
return;
|
|
107
|
+
w(R, !0), w(z, "");
|
|
108
|
+
const e = a(n).id;
|
|
109
|
+
try {
|
|
110
|
+
await be({ apiEndpoint: u(), userSession: p() }, e), xe(e), Ee();
|
|
111
|
+
} catch (s) {
|
|
112
|
+
w(z, s?.message ?? "Redeem failed", !0), Re(e, s);
|
|
113
|
+
} finally {
|
|
114
|
+
w(R, !1);
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
J(() => {
|
|
118
|
+
const e = (s) => {
|
|
119
|
+
s.data?.type === ge.REDEEM_REWARD_CONFIRMED && s.data?.id === a(n)?.id && ee();
|
|
120
|
+
};
|
|
121
|
+
return window.addEventListener("message", e), () => window.removeEventListener("message", e);
|
|
122
|
+
});
|
|
123
|
+
var te = {
|
|
124
|
+
get apiEndpoint() {
|
|
125
|
+
return u();
|
|
126
|
+
},
|
|
127
|
+
set apiEndpoint(e = "") {
|
|
128
|
+
u(e), i();
|
|
129
|
+
},
|
|
130
|
+
get userSession() {
|
|
131
|
+
return p();
|
|
132
|
+
},
|
|
133
|
+
set userSession(e = "") {
|
|
134
|
+
p(e), i();
|
|
135
|
+
},
|
|
136
|
+
get locale() {
|
|
137
|
+
return c();
|
|
138
|
+
},
|
|
139
|
+
set locale(e = "") {
|
|
140
|
+
c(e), i();
|
|
141
|
+
},
|
|
142
|
+
get itemId() {
|
|
143
|
+
return g();
|
|
144
|
+
},
|
|
145
|
+
set itemId(e = "") {
|
|
146
|
+
g(e), i();
|
|
147
|
+
},
|
|
148
|
+
get elevateReward() {
|
|
149
|
+
return r();
|
|
150
|
+
},
|
|
151
|
+
set elevateReward(e) {
|
|
152
|
+
r(e), i();
|
|
153
|
+
},
|
|
154
|
+
get translationUrl() {
|
|
155
|
+
return E();
|
|
156
|
+
},
|
|
157
|
+
set translationUrl(e) {
|
|
158
|
+
E(e), i();
|
|
159
|
+
}
|
|
160
|
+
}, D = _e(), ae = we(D);
|
|
161
|
+
{
|
|
162
|
+
var se = (e) => {
|
|
163
|
+
var s = ze(), _ = f(s), F = f(_);
|
|
164
|
+
{
|
|
165
|
+
var ne = (m) => {
|
|
166
|
+
var v = Oe();
|
|
167
|
+
O(() => {
|
|
168
|
+
q(v, "src", a(j) || Ue), q(v, "alt", a(V));
|
|
169
|
+
}), S(m, v);
|
|
170
|
+
};
|
|
171
|
+
U(F, (m) => {
|
|
172
|
+
a(j) && m(ne);
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
var C = x(F, 2), oe = f(C, !0);
|
|
176
|
+
h(C);
|
|
177
|
+
var L = x(C, 2), ie = f(L);
|
|
178
|
+
h(L);
|
|
179
|
+
var k = x(L, 2), le = f(k, !0);
|
|
180
|
+
h(k), h(_);
|
|
181
|
+
var H = x(_, 2);
|
|
182
|
+
Le(H, {
|
|
183
|
+
get apiEndpoint() {
|
|
184
|
+
return u();
|
|
185
|
+
},
|
|
186
|
+
get userSession() {
|
|
187
|
+
return p();
|
|
188
|
+
},
|
|
189
|
+
get locale() {
|
|
190
|
+
return c();
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
var de = x(H, 2);
|
|
194
|
+
{
|
|
195
|
+
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);
|
|
198
|
+
};
|
|
199
|
+
U(de, (m) => {
|
|
200
|
+
a(A) && m(ue);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
h(s), O(
|
|
204
|
+
(m, v) => {
|
|
205
|
+
I(oe, a(V)), I(ie, `${a(n).points ?? ""}
|
|
206
|
+
${m ?? ""}`), k.disabled = !a(B) || a(R), I(le, v);
|
|
207
|
+
},
|
|
208
|
+
[() => l()("tokens"), () => l()("buyNow")]
|
|
209
|
+
), Se("click", k, $), S(e, s);
|
|
210
|
+
};
|
|
211
|
+
U(ae, (e) => {
|
|
212
|
+
a(n) && e(se);
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
S(y, D);
|
|
216
|
+
var re = W(te);
|
|
217
|
+
return b(), re;
|
|
218
|
+
}
|
|
219
|
+
ce(["click"]);
|
|
220
|
+
G(
|
|
221
|
+
Y,
|
|
222
|
+
{
|
|
223
|
+
apiEndpoint: {},
|
|
224
|
+
userSession: {},
|
|
225
|
+
locale: {},
|
|
226
|
+
itemId: {},
|
|
227
|
+
elevateReward: {},
|
|
228
|
+
translationUrl: {}
|
|
229
|
+
},
|
|
230
|
+
[],
|
|
231
|
+
[],
|
|
232
|
+
{ mode: "open" }
|
|
233
|
+
);
|
|
234
|
+
function Q(y, t) {
|
|
235
|
+
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");
|
|
237
|
+
var g = {
|
|
238
|
+
get apiEndpoint() {
|
|
239
|
+
return l();
|
|
240
|
+
},
|
|
241
|
+
set apiEndpoint(r = "") {
|
|
242
|
+
l(r), i();
|
|
243
|
+
},
|
|
244
|
+
get userSession() {
|
|
245
|
+
return d();
|
|
246
|
+
},
|
|
247
|
+
set userSession(r = "") {
|
|
248
|
+
d(r), i();
|
|
249
|
+
},
|
|
250
|
+
get locale() {
|
|
251
|
+
return b();
|
|
252
|
+
},
|
|
253
|
+
set locale(r = "") {
|
|
254
|
+
b(r), i();
|
|
255
|
+
},
|
|
256
|
+
get itemId() {
|
|
257
|
+
return u();
|
|
258
|
+
},
|
|
259
|
+
set itemId(r = "") {
|
|
260
|
+
u(r), i();
|
|
261
|
+
},
|
|
262
|
+
get elevateReward() {
|
|
263
|
+
return p();
|
|
264
|
+
},
|
|
265
|
+
set elevateReward(r) {
|
|
266
|
+
p(r), i();
|
|
267
|
+
},
|
|
268
|
+
get translationUrl() {
|
|
269
|
+
return c();
|
|
270
|
+
},
|
|
271
|
+
set translationUrl(r) {
|
|
272
|
+
c(r), i();
|
|
273
|
+
}
|
|
274
|
+
};
|
|
275
|
+
return Y(y, {
|
|
276
|
+
get apiEndpoint() {
|
|
277
|
+
return l();
|
|
278
|
+
},
|
|
279
|
+
get userSession() {
|
|
280
|
+
return d();
|
|
281
|
+
},
|
|
282
|
+
get locale() {
|
|
283
|
+
return b();
|
|
284
|
+
},
|
|
285
|
+
get itemId() {
|
|
286
|
+
return u();
|
|
287
|
+
},
|
|
288
|
+
get elevateReward() {
|
|
289
|
+
return p();
|
|
290
|
+
},
|
|
291
|
+
get translationUrl() {
|
|
292
|
+
return c();
|
|
293
|
+
}
|
|
294
|
+
}), W(g);
|
|
295
|
+
}
|
|
296
|
+
customElements.define("loyalty-shop-item", G(
|
|
297
|
+
Q,
|
|
298
|
+
{
|
|
299
|
+
apiEndpoint: {},
|
|
300
|
+
userSession: {},
|
|
301
|
+
locale: {},
|
|
302
|
+
itemId: {},
|
|
303
|
+
elevateReward: {},
|
|
304
|
+
translationUrl: {}
|
|
305
|
+
},
|
|
306
|
+
[],
|
|
307
|
+
[]
|
|
308
|
+
));
|
|
309
|
+
const Be = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
310
|
+
__proto__: null,
|
|
311
|
+
default: Q
|
|
312
|
+
}, Symbol.toStringTag, { value: "Module" }));
|
|
313
|
+
export {
|
|
314
|
+
Y as L,
|
|
315
|
+
Be as a
|
|
316
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";const e=require("./LoyaltyPagination-CiEOz3pr.cjs"),G=require("./LoyaltyPointsCard-BcX6gbsm.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-BcX6gbsm.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;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const s=require("../components/LoyaltyShop-CJ-9FkKC.cjs");if(typeof window<"u"){let o=function(e){return function(...n){try{return e.apply(this,n)}catch(t){if(t instanceof DOMException&&t.message.includes("has already been used with this registry")||t instanceof Error&&t.message.includes("Cannot define multiple custom elements with the same tag name"))return!1;throw t}}};customElements.define=o(customElements.define),Promise.resolve().then(()=>require("../components/LoyaltyShop-CJ-9FkKC.cjs")).then(e=>e.LoyaltyShop_ce).then(e=>{const n=e.default||e;customElements.get("loyalty-shop")||customElements.define("loyalty-shop",n.element||n)}).catch(e=>{console.error("BOOT ERROR:",e)})}module.exports=s.LoyaltyShop;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { L as a } from "../components/LoyaltyShop-DV-j5py7.js";
|
|
2
|
+
if (typeof window < "u") {
|
|
3
|
+
let s = function(e) {
|
|
4
|
+
return function(...n) {
|
|
5
|
+
try {
|
|
6
|
+
return e.apply(this, n);
|
|
7
|
+
} catch (t) {
|
|
8
|
+
if (t instanceof DOMException && t.message.includes("has already been used with this registry") || t instanceof Error && t.message.includes("Cannot define multiple custom elements with the same tag name"))
|
|
9
|
+
return !1;
|
|
10
|
+
throw t;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
customElements.define = s(customElements.define), import("../components/LoyaltyShop-DV-j5py7.js").then((e) => e.a).then((e) => {
|
|
15
|
+
const n = e.default || e;
|
|
16
|
+
customElements.get("loyalty-shop") || customElements.define("loyalty-shop", n.element || n);
|
|
17
|
+
}).catch((e) => {
|
|
18
|
+
console.error("BOOT ERROR:", e);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
a as default
|
|
23
|
+
};
|
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@everymatrix/loyalty-shop",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.10",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"main": "
|
|
6
|
-
"module": "esnext/loyalty-shop.js",
|
|
5
|
+
"main": "./esnext/loyalty-shop.cjs",
|
|
6
|
+
"module": "./esnext/loyalty-shop.js",
|
|
7
7
|
"exports": {
|
|
8
8
|
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
9
10
|
"import": "./esnext/loyalty-shop.js",
|
|
10
|
-
"require": "./
|
|
11
|
+
"require": "./esnext/loyalty-shop.cjs",
|
|
12
|
+
"default": "./esnext/loyalty-shop.js"
|
|
11
13
|
},
|
|
12
|
-
"./
|
|
13
|
-
"./
|
|
14
|
+
"./esnext/loyalty-shop.cjs": "./esnext/loyalty-shop.cjs",
|
|
15
|
+
"./esnext/loyalty-shop.js": "./esnext/loyalty-shop.js"
|
|
14
16
|
},
|
|
15
17
|
"files": [
|
|
16
|
-
"
|
|
17
|
-
"es2015",
|
|
18
|
+
"esnext",
|
|
18
19
|
"components"
|
|
19
20
|
],
|
|
20
21
|
"publishConfig": {
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { p as et, a as at, b as g, s as st, c as nt, u as S, d as lt, e as B, i as O, g as e, f, h as ot, j as it, k as M, l as rt, m as v, n as y, o as pt, t as z, q as x, r as G, v as ct, w as T, x as _t, y as dt, z as gt, $ as ft, A as m, B as vt, C as yt, D as mt } from "./LoyaltyShop-CXYYTheE.js";
|
|
2
|
-
const ut = {
|
|
3
|
-
en: {
|
|
4
|
-
prev: "Previous",
|
|
5
|
-
next: "Next"
|
|
6
|
-
},
|
|
7
|
-
tr: {
|
|
8
|
-
prev: "Önceki",
|
|
9
|
-
next: "Sonraki"
|
|
10
|
-
}
|
|
11
|
-
}, q = 10, ht = 7, xt = 4;
|
|
12
|
-
var bt = x('<span class="loyalty-pagination__ellipsis svelte-lms3sp" aria-hidden="true">...</span>'), wt = x('<button type="button"> </button>'), It = x('<div class="loyalty-pagination__pages svelte-lms3sp"><button class="loyalty-pagination__btn loyalty-pagination__btn--prev svelte-lms3sp" type="button"> </button> <!> <button class="loyalty-pagination__btn loyalty-pagination__btn--next svelte-lms3sp" type="button"> </button></div>'), Pt = x('<div class="loyalty-pagination svelte-lms3sp"><!></div>');
|
|
13
|
-
const kt = {
|
|
14
|
-
hash: "svelte-lms3sp",
|
|
15
|
-
code: `
|
|
16
|
-
@layer loyalty-pagination-component {.loyalty-pagination.svelte-lms3sp {display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;box-sizing:border-box;width:100%;}
|
|
17
|
-
|
|
18
|
-
@media (min-width: 768px) {.loyalty-pagination.svelte-lms3sp {width:auto;margin-left:auto;justify-content:flex-end;padding-right:10px;}.loyalty-pagination__pages.svelte-lms3sp {justify-content:flex-end;}
|
|
19
|
-
}.loyalty-pagination__pages.svelte-lms3sp {display:flex;flex-wrap:wrap;align-items:center;gap:8px;justify-content:flex-start;}.loyalty-pagination__ellipsis.svelte-lms3sp {display:inline-flex;align-items:center;justify-content:center;color:var(--text-default, #ffffff);font-size:13px;width:24px;}.loyalty-pagination__btn.svelte-lms3sp {min-width:30px;height:30px;padding:4px 8px;border:none;border-radius:4px;background:var(--bg-overlay-neutral-level-1, rgba(251, 251, 251, 0.05));color:var(--text-subtle, #dfe3e8);font-size:13px;font-weight:400;cursor:pointer;}.loyalty-pagination__btn--active.svelte-lms3sp {background:var(--accent, #ffcc00);color:var(--text-on-color, #261d00);}.loyalty-pagination__btn.svelte-lms3sp:disabled {cursor:default;color:var(--text-muted, rgba(251, 251, 251, 0.15));}.loyalty-pagination__btn--prev.svelte-lms3sp,
|
|
20
|
-
.loyalty-pagination__btn--next.svelte-lms3sp {width:95px;}
|
|
21
|
-
|
|
22
|
-
@media (max-width: 767px) {.loyalty-pagination__btn--prev.svelte-lms3sp,
|
|
23
|
-
.loyalty-pagination__btn--next.svelte-lms3sp {width:90px;}
|
|
24
|
-
}.loyalty-pagination__btn--prev.svelte-lms3sp:not(:disabled),
|
|
25
|
-
.loyalty-pagination__btn--next.svelte-lms3sp:not(:disabled) {color:var(--text-default, #ffffff);}
|
|
26
|
-
}`
|
|
27
|
-
};
|
|
28
|
-
function Mt(A, o) {
|
|
29
|
-
et(o, !0), at(A, kt);
|
|
30
|
-
const E = () => gt(ft, "$_", D), [D, V] = it(), b = g(o, "offset", 7, 0), n = g(o, "limit", 7, q), w = g(o, "total", 7, 0), c = g(o, "onPageChange", 7, (t) => {
|
|
31
|
-
}), u = g(o, "locale", 7, "en");
|
|
32
|
-
st({ withLocale: u(), translations: {} }), Object.entries(ut).forEach(([t, a]) => {
|
|
33
|
-
nt(t, a);
|
|
34
|
-
}), S(() => {
|
|
35
|
-
var t;
|
|
36
|
-
lt((t = u()) != null ? t : "en");
|
|
37
|
-
});
|
|
38
|
-
const h = M(() => Math.max(1, Math.ceil(w() / Math.max(1, n())))), i = M(() => n() > 0 ? Math.floor(b() / n()) : 0);
|
|
39
|
-
let I = rt(!1);
|
|
40
|
-
S(() => {
|
|
41
|
-
const t = window.matchMedia("(max-width: 767px)"), a = (s) => {
|
|
42
|
-
B(I, s.matches, !0);
|
|
43
|
-
};
|
|
44
|
-
return B(I, t.matches, !0), t.addEventListener("change", a), () => t.removeEventListener("change", a);
|
|
45
|
-
});
|
|
46
|
-
const F = (t, a, s) => t <= (s ? xt : ht) ? Array.from({ length: t }, (N, d) => d) : a <= 1 || a >= t - 2 ? [0, 1, "ellipsis", t - 2, t - 1] : [0, "ellipsis", a, "ellipsis", t - 1], R = M(() => F(e(h), e(i), e(I))), U = (t) => c()(t * n()), H = () => c()(Math.max(0, e(i) - 1) * n()), J = () => c()(Math.min(e(h) - 1, e(i) + 1) * n());
|
|
47
|
-
var K = {
|
|
48
|
-
get offset() {
|
|
49
|
-
return b();
|
|
50
|
-
},
|
|
51
|
-
set offset(t = 0) {
|
|
52
|
-
b(t), v();
|
|
53
|
-
},
|
|
54
|
-
get limit() {
|
|
55
|
-
return n();
|
|
56
|
-
},
|
|
57
|
-
set limit(t = q) {
|
|
58
|
-
n(t), v();
|
|
59
|
-
},
|
|
60
|
-
get total() {
|
|
61
|
-
return w();
|
|
62
|
-
},
|
|
63
|
-
set total(t = 0) {
|
|
64
|
-
w(t), v();
|
|
65
|
-
},
|
|
66
|
-
get onPageChange() {
|
|
67
|
-
return c();
|
|
68
|
-
},
|
|
69
|
-
set onPageChange(t = (a) => {
|
|
70
|
-
}) {
|
|
71
|
-
c(t), v();
|
|
72
|
-
},
|
|
73
|
-
get locale() {
|
|
74
|
-
return u();
|
|
75
|
-
},
|
|
76
|
-
set locale(t = "en") {
|
|
77
|
-
u(t), v();
|
|
78
|
-
}
|
|
79
|
-
}, P = Pt(), Q = y(P);
|
|
80
|
-
{
|
|
81
|
-
var W = (t) => {
|
|
82
|
-
var a = It(), s = y(a);
|
|
83
|
-
s.__click = H;
|
|
84
|
-
var L = y(s, !0);
|
|
85
|
-
m(s);
|
|
86
|
-
var k = G(s, 2);
|
|
87
|
-
pt(k, 17, () => e(R), ct, (d, r) => {
|
|
88
|
-
var C = vt(), Y = yt(C);
|
|
89
|
-
{
|
|
90
|
-
var Z = (p) => {
|
|
91
|
-
var l = bt();
|
|
92
|
-
f(p, l);
|
|
93
|
-
}, $ = (p) => {
|
|
94
|
-
var l = wt();
|
|
95
|
-
let j;
|
|
96
|
-
l.__click = () => U(e(r));
|
|
97
|
-
var tt = y(l, !0);
|
|
98
|
-
m(l), z(() => {
|
|
99
|
-
j = mt(l, 1, "loyalty-pagination__btn svelte-lms3sp", null, j, {
|
|
100
|
-
"loyalty-pagination__btn--active": e(r) === e(i)
|
|
101
|
-
}), T(tt, e(r) + 1);
|
|
102
|
-
}), f(p, l);
|
|
103
|
-
};
|
|
104
|
-
O(Y, (p) => {
|
|
105
|
-
e(r) === "ellipsis" ? p(Z) : p($, !1);
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
f(d, C);
|
|
109
|
-
});
|
|
110
|
-
var _ = G(k, 2);
|
|
111
|
-
_.__click = J;
|
|
112
|
-
var N = y(_, !0);
|
|
113
|
-
m(_), m(a), z(
|
|
114
|
-
(d, r) => {
|
|
115
|
-
s.disabled = e(i) <= 0, T(L, d), _.disabled = e(i) >= e(h) - 1, T(N, r);
|
|
116
|
-
},
|
|
117
|
-
[() => E()("prev"), () => E()("next")]
|
|
118
|
-
), f(t, a);
|
|
119
|
-
};
|
|
120
|
-
O(Q, (t) => {
|
|
121
|
-
e(h) > 1 && t(W);
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
m(P), f(A, P);
|
|
125
|
-
var X = ot(K);
|
|
126
|
-
return V(), X;
|
|
127
|
-
}
|
|
128
|
-
_t(["click"]);
|
|
129
|
-
customElements.define("loyalty-pagination", dt(
|
|
130
|
-
Mt,
|
|
131
|
-
{
|
|
132
|
-
offset: {},
|
|
133
|
-
limit: {},
|
|
134
|
-
total: {},
|
|
135
|
-
onPageChange: {},
|
|
136
|
-
locale: {}
|
|
137
|
-
},
|
|
138
|
-
[],
|
|
139
|
-
[],
|
|
140
|
-
!1
|
|
141
|
-
));
|
|
142
|
-
export {
|
|
143
|
-
Mt as default
|
|
144
|
-
};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import { a as et, p as g, s as at, b as st, u as S, i as B, c as f, d as nt, e as lt, f as x, g as v, h as ot, j as it, k as O, l as rt, m as pt, n as ct, o as y, q as e, r as m, t as M, v as z, w as _t, x as dt, y as G, z as gt, A as ft, B as vt, C as T, D as yt, $ as mt } from "./LoyaltyShop-DdRqHIuf.js";
|
|
2
|
-
const ut = {
|
|
3
|
-
en: {
|
|
4
|
-
prev: "Previous",
|
|
5
|
-
next: "Next"
|
|
6
|
-
},
|
|
7
|
-
tr: {
|
|
8
|
-
prev: "Önceki",
|
|
9
|
-
next: "Sonraki"
|
|
10
|
-
}
|
|
11
|
-
}, q = 10, ht = 7, xt = 4;
|
|
12
|
-
var bt = x('<span class="loyalty-pagination__ellipsis svelte-lms3sp" aria-hidden="true">...</span>'), wt = x('<button type="button"> </button>'), It = x('<div class="loyalty-pagination__pages svelte-lms3sp"><button class="loyalty-pagination__btn loyalty-pagination__btn--prev svelte-lms3sp" type="button"> </button> <!> <button class="loyalty-pagination__btn loyalty-pagination__btn--next svelte-lms3sp" type="button"> </button></div>'), Pt = x('<div class="loyalty-pagination svelte-lms3sp"><!></div>');
|
|
13
|
-
const kt = {
|
|
14
|
-
hash: "svelte-lms3sp",
|
|
15
|
-
code: `
|
|
16
|
-
@layer loyalty-pagination-component {.loyalty-pagination.svelte-lms3sp {display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;box-sizing:border-box;width:100%;}
|
|
17
|
-
|
|
18
|
-
@media (min-width: 768px) {.loyalty-pagination.svelte-lms3sp {width:auto;margin-left:auto;justify-content:flex-end;padding-right:10px;}.loyalty-pagination__pages.svelte-lms3sp {justify-content:flex-end;}
|
|
19
|
-
}.loyalty-pagination__pages.svelte-lms3sp {display:flex;flex-wrap:wrap;align-items:center;gap:8px;justify-content:flex-start;}.loyalty-pagination__ellipsis.svelte-lms3sp {display:inline-flex;align-items:center;justify-content:center;color:var(--text-default, #ffffff);font-size:13px;width:24px;}.loyalty-pagination__btn.svelte-lms3sp {min-width:30px;height:30px;padding:4px 8px;border:none;border-radius:4px;background:var(--bg-overlay-neutral-level-1, rgba(251, 251, 251, 0.05));color:var(--text-subtle, #dfe3e8);font-size:13px;font-weight:400;cursor:pointer;}.loyalty-pagination__btn--active.svelte-lms3sp {background:var(--accent, #ffcc00);color:var(--text-on-color, #261d00);}.loyalty-pagination__btn.svelte-lms3sp:disabled {cursor:default;color:var(--text-muted, rgba(251, 251, 251, 0.15));}.loyalty-pagination__btn--prev.svelte-lms3sp,
|
|
20
|
-
.loyalty-pagination__btn--next.svelte-lms3sp {width:95px;}
|
|
21
|
-
|
|
22
|
-
@media (max-width: 767px) {.loyalty-pagination__btn--prev.svelte-lms3sp,
|
|
23
|
-
.loyalty-pagination__btn--next.svelte-lms3sp {width:90px;}
|
|
24
|
-
}.loyalty-pagination__btn--prev.svelte-lms3sp:not(:disabled),
|
|
25
|
-
.loyalty-pagination__btn--next.svelte-lms3sp:not(:disabled) {color:var(--text-default, #ffffff);}
|
|
26
|
-
}`
|
|
27
|
-
};
|
|
28
|
-
function Mt(A, o) {
|
|
29
|
-
ot(o, !0), et(A, kt);
|
|
30
|
-
const E = () => yt(mt, "$_", D), [D, V] = lt(), b = g(o, "offset", 7, 0), n = g(o, "limit", 7, q), w = g(o, "total", 7, 0), c = g(o, "onPageChange", 7, (t) => {
|
|
31
|
-
}), u = g(o, "locale", 7, "en");
|
|
32
|
-
at({ withLocale: u(), translations: {} }), Object.entries(ut).forEach(([t, a]) => {
|
|
33
|
-
st(t, a);
|
|
34
|
-
}), S(() => {
|
|
35
|
-
it(u() ?? "en");
|
|
36
|
-
});
|
|
37
|
-
const h = M(() => Math.max(1, Math.ceil(w() / Math.max(1, n())))), i = M(() => n() > 0 ? Math.floor(b() / n()) : 0);
|
|
38
|
-
let I = ct(!1);
|
|
39
|
-
S(() => {
|
|
40
|
-
const t = window.matchMedia("(max-width: 767px)"), a = (s) => {
|
|
41
|
-
O(I, s.matches, !0);
|
|
42
|
-
};
|
|
43
|
-
return O(I, t.matches, !0), t.addEventListener("change", a), () => t.removeEventListener("change", a);
|
|
44
|
-
});
|
|
45
|
-
const F = (t, a, s) => t <= (s ? xt : ht) ? Array.from({ length: t }, (N, d) => d) : a <= 1 || a >= t - 2 ? [0, 1, "ellipsis", t - 2, t - 1] : [0, "ellipsis", a, "ellipsis", t - 1], R = M(() => F(e(h), e(i), e(I))), U = (t) => c()(t * n()), H = () => c()(Math.max(0, e(i) - 1) * n()), J = () => c()(Math.min(e(h) - 1, e(i) + 1) * n());
|
|
46
|
-
var K = {
|
|
47
|
-
get offset() {
|
|
48
|
-
return b();
|
|
49
|
-
},
|
|
50
|
-
set offset(t = 0) {
|
|
51
|
-
b(t), v();
|
|
52
|
-
},
|
|
53
|
-
get limit() {
|
|
54
|
-
return n();
|
|
55
|
-
},
|
|
56
|
-
set limit(t = q) {
|
|
57
|
-
n(t), v();
|
|
58
|
-
},
|
|
59
|
-
get total() {
|
|
60
|
-
return w();
|
|
61
|
-
},
|
|
62
|
-
set total(t = 0) {
|
|
63
|
-
w(t), v();
|
|
64
|
-
},
|
|
65
|
-
get onPageChange() {
|
|
66
|
-
return c();
|
|
67
|
-
},
|
|
68
|
-
set onPageChange(t = (a) => {
|
|
69
|
-
}) {
|
|
70
|
-
c(t), v();
|
|
71
|
-
},
|
|
72
|
-
get locale() {
|
|
73
|
-
return u();
|
|
74
|
-
},
|
|
75
|
-
set locale(t = "en") {
|
|
76
|
-
u(t), v();
|
|
77
|
-
}
|
|
78
|
-
}, P = Pt(), Q = y(P);
|
|
79
|
-
{
|
|
80
|
-
var W = (t) => {
|
|
81
|
-
var a = It(), s = y(a);
|
|
82
|
-
s.__click = H;
|
|
83
|
-
var L = y(s, !0);
|
|
84
|
-
m(s);
|
|
85
|
-
var k = z(s, 2);
|
|
86
|
-
_t(k, 17, () => e(R), dt, (d, r) => {
|
|
87
|
-
var C = gt(), Y = ft(C);
|
|
88
|
-
{
|
|
89
|
-
var Z = (p) => {
|
|
90
|
-
var l = bt();
|
|
91
|
-
f(p, l);
|
|
92
|
-
}, $ = (p) => {
|
|
93
|
-
var l = wt();
|
|
94
|
-
let j;
|
|
95
|
-
l.__click = () => U(e(r));
|
|
96
|
-
var tt = y(l, !0);
|
|
97
|
-
m(l), G(() => {
|
|
98
|
-
j = vt(l, 1, "loyalty-pagination__btn svelte-lms3sp", null, j, {
|
|
99
|
-
"loyalty-pagination__btn--active": e(r) === e(i)
|
|
100
|
-
}), T(tt, e(r) + 1);
|
|
101
|
-
}), f(p, l);
|
|
102
|
-
};
|
|
103
|
-
B(Y, (p) => {
|
|
104
|
-
e(r) === "ellipsis" ? p(Z) : p($, !1);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
f(d, C);
|
|
108
|
-
});
|
|
109
|
-
var _ = z(k, 2);
|
|
110
|
-
_.__click = J;
|
|
111
|
-
var N = y(_, !0);
|
|
112
|
-
m(_), m(a), G(
|
|
113
|
-
(d, r) => {
|
|
114
|
-
s.disabled = e(i) <= 0, T(L, d), _.disabled = e(i) >= e(h) - 1, T(N, r);
|
|
115
|
-
},
|
|
116
|
-
[() => E()("prev"), () => E()("next")]
|
|
117
|
-
), f(t, a);
|
|
118
|
-
};
|
|
119
|
-
B(Q, (t) => {
|
|
120
|
-
e(h) > 1 && t(W);
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
m(P), f(A, P);
|
|
124
|
-
var X = nt(K);
|
|
125
|
-
return V(), X;
|
|
126
|
-
}
|
|
127
|
-
rt(["click"]);
|
|
128
|
-
customElements.define("loyalty-pagination", pt(
|
|
129
|
-
Mt,
|
|
130
|
-
{
|
|
131
|
-
offset: {},
|
|
132
|
-
limit: {},
|
|
133
|
-
total: {},
|
|
134
|
-
onPageChange: {},
|
|
135
|
-
locale: {}
|
|
136
|
-
},
|
|
137
|
-
[],
|
|
138
|
-
[],
|
|
139
|
-
!1
|
|
140
|
-
));
|
|
141
|
-
export {
|
|
142
|
-
Mt as default
|
|
143
|
-
};
|