@everymatrix/player-account-controller 1.47.0 → 1.47.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,355 @@
1
+ var d = (t, a, i) => new Promise((o, r) => {
2
+ var l = (s) => {
3
+ try {
4
+ c(i.next(s));
5
+ } catch (p) {
6
+ r(p);
7
+ }
8
+ }, h = (s) => {
9
+ try {
10
+ c(i.throw(s));
11
+ } catch (p) {
12
+ r(p);
13
+ }
14
+ }, c = (s) => s.done ? o(s.value) : Promise.resolve(s.value).then(l, h);
15
+ c((i = i.apply(t, a)).next());
16
+ });
17
+ import { b, p as f, r as y, g as u, h as e, H as v, a as x } from "./index-b111cb50-CuFaYbey.js";
18
+ import { b as w } from "./app-globals-0f993ce5-aPSxk6sG.js";
19
+ var k = () => {
20
+ const t = import.meta.url, a = {};
21
+ return t !== "" && (a.resourcesUrl = new URL(".", t).href), f(a);
22
+ };
23
+ k().then((t) => d(void 0, null, function* () {
24
+ return yield w(), b([["user-transaction-history", [[1, "user-transaction-history", { endpoint: [513], session: [513], language: [513], userId: [513, "user-id"], translationUrl: [513, "translation-url"], mobile: [516], clientStyling: [513, "client-styling"], clientStylingUrl: [513, "client-styling-url"], page: [32], pageSize: [32], showMobileFilter: [32], to: [32], from: [32], type: [32], transactions: [32], showLoader: [32] }, [[9, "resize", "getComponentHeight"]], { page: ["watchMultiple"], type: ["watchMultiple"], session: ["watchMultiple"], userId: ["watchMultiple"], pageSize: ["watchMultiple"], showMobileFilter: ["getComponentHeight"] }]]]], t);
25
+ }));
26
+ const S = {
27
+ en: {
28
+ deposit: "Deposit",
29
+ withdrawals: "Withdrawals",
30
+ show: "Show",
31
+ from: "From",
32
+ to: "To",
33
+ filter: "Filter",
34
+ transactionId: "Transaction ID",
35
+ date: "Date",
36
+ amount: "Amount",
37
+ productType: "Product Type",
38
+ status: "Status",
39
+ noData: "There are no account activities"
40
+ },
41
+ hr: {
42
+ deposit: "Uplate",
43
+ withdrawals: "Isplate",
44
+ show: "Prikaži",
45
+ from: "Od",
46
+ to: "Do",
47
+ filter: "Filter",
48
+ transactionId: "ID transakcije",
49
+ date: "Datum",
50
+ amount: "Iznos",
51
+ productType: "Vrsta proizvoda",
52
+ status: "Status",
53
+ noData: "Nema aktivnosti na računu"
54
+ }
55
+ };
56
+ class n {
57
+ constructor() {
58
+ }
59
+ static loadCustomTranslations(a) {
60
+ return d(this, null, function* () {
61
+ try {
62
+ const i = yield fetch(a, {
63
+ headers: {
64
+ "Content-Type": "application/json"
65
+ }
66
+ });
67
+ if (!i.ok) {
68
+ const r = yield i.text();
69
+ throw new Error(r);
70
+ }
71
+ const o = yield i.json();
72
+ n.updateTranslations(o);
73
+ } catch (i) {
74
+ console.error(`Failed to load translations ${a}. ${i.message}`);
75
+ }
76
+ });
77
+ }
78
+ static translate(a, i) {
79
+ var o, r;
80
+ const l = n.getAvaliableLanguages(i);
81
+ return ((r = (o = n.customTranslation) === null || o === void 0 ? void 0 : o[l.customLanguage]) === null || r === void 0 ? void 0 : r[a]) || n.defaultTranslation[l.predefinedLanguage][a];
82
+ }
83
+ static getAvaliableLanguages(a) {
84
+ var i;
85
+ const o = !((i = n.customLanguages) === null || i === void 0) && i.includes(a) ? a : n.defaultLanguage;
86
+ return { predefinedLanguage: n.supportedLanguages.includes(a) ? a : n.defaultLanguage, customLanguage: o };
87
+ }
88
+ static updateTranslations(a) {
89
+ n.customLanguages = Array.from(/* @__PURE__ */ new Set([...n.supportedLanguages, ...Object.keys(a).map((i) => i.toLowerCase())])), n.customTranslation = a;
90
+ }
91
+ }
92
+ n.defaultLanguage = "en";
93
+ n.supportedLanguages = ["en"];
94
+ n.defaultTranslation = S;
95
+ const C = () => e(
96
+ "div",
97
+ { class: "loader" },
98
+ e("div", null),
99
+ e("div", null),
100
+ e("div", null),
101
+ e("div", null),
102
+ e("div", null),
103
+ e("div", null),
104
+ e("div", null),
105
+ e("div", null),
106
+ e("div", null),
107
+ e("div", null),
108
+ e("div", null),
109
+ e("div", null)
110
+ );
111
+ class g {
112
+ constructor() {
113
+ }
114
+ static dateToFormatedString(a) {
115
+ const i = a.toLocaleDateString("en-gb"), o = a.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit", hour12: !1 });
116
+ return `${i}, ${o}`;
117
+ }
118
+ }
119
+ class m {
120
+ constructor() {
121
+ }
122
+ static format(a, i) {
123
+ let o = `${i} ${a}`;
124
+ try {
125
+ o = new Intl.NumberFormat("en-US", {
126
+ style: "currency",
127
+ currency: a
128
+ }).format(i);
129
+ } catch (r) {
130
+ }
131
+ return o;
132
+ }
133
+ }
134
+ const T = (t) => e(
135
+ "div",
136
+ { class: "data-transaction" },
137
+ e("p", null, t.productType),
138
+ e(
139
+ "p",
140
+ { class: "text-style text-style-status" },
141
+ e("span", { class: t.status.toLowerCase() }, t.status)
142
+ ),
143
+ e(
144
+ "p",
145
+ { class: "date" },
146
+ t.transId,
147
+ " | ",
148
+ g.dateToFormatedString(new Date(t.created))
149
+ ),
150
+ e(
151
+ "p",
152
+ { class: "text-style" },
153
+ m.format(t.currency, t.realAmount),
154
+ " "
155
+ )
156
+ ), B = (t) => e(
157
+ "div",
158
+ { class: "page-size" },
159
+ e("span", null, n.translate("show", t.language)),
160
+ t.pageSizes.map((a) => e("button", { class: t.currentPageSize === a ? "active" : "", onClick: () => t.changePageSize(a) }, a))
161
+ ), F = ({ from: t, to: a, applyFilters: i, language: o }) => {
162
+ let r, l;
163
+ const h = () => {
164
+ t = r.value;
165
+ }, c = () => {
166
+ a = l.value;
167
+ };
168
+ return e(
169
+ "div",
170
+ { class: "period" },
171
+ e(
172
+ "div",
173
+ { class: "period-content" },
174
+ e(
175
+ "div",
176
+ { class: "date-input" },
177
+ e("vaadin-date-picker", { value: t, ref: (s) => r = s, label: n.translate("from", o), onChange: h })
178
+ ),
179
+ e(
180
+ "span",
181
+ null,
182
+ e(
183
+ "svg",
184
+ { width: "24px", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
185
+ e("path", { d: "m21 11.75c0-.414-.336-.75-.75-.75h-16.5c-.414 0-.75.336-.75.75s.336.75.75.75h16.5c.414 0 .75-.336.75-.75z", "fill-rule": "nonzero", fill: "#5d687b" })
186
+ )
187
+ ),
188
+ e(
189
+ "div",
190
+ { class: "date-input" },
191
+ e("vaadin-date-picker", { value: a, ref: (s) => l = s, label: n.translate("to", o), onChange: c })
192
+ ),
193
+ e("button", { class: "filter-btn", onClick: () => i(t, a) }, n.translate("filter", o))
194
+ )
195
+ );
196
+ }, D = ({ source: t, language: a }) => {
197
+ const i = [
198
+ { name: n.translate("transactionId", a) },
199
+ {
200
+ name: n.translate("date", a)
201
+ },
202
+ {
203
+ name: n.translate("amount", a)
204
+ },
205
+ { name: n.translate("productType", a) },
206
+ {
207
+ name: n.translate("status", a)
208
+ }
209
+ ];
210
+ return e(
211
+ "table",
212
+ null,
213
+ e(
214
+ "thead",
215
+ null,
216
+ e("tr", null, i.map((o) => e("th", null, o.name)))
217
+ ),
218
+ e("tbody", null, t.map((o) => e(
219
+ "tr",
220
+ null,
221
+ e("td", null, o.transId),
222
+ e("td", null, g.dateToFormatedString(new Date(o.created))),
223
+ e(
224
+ "td",
225
+ null,
226
+ m.format(o.currency, o.realAmount),
227
+ " "
228
+ ),
229
+ e("td", null, o.productType),
230
+ e(
231
+ "td",
232
+ null,
233
+ e("span", { class: o.status.toLowerCase() }, o.status)
234
+ )
235
+ )))
236
+ );
237
+ }, L = ':host{--activeButtonBackground:#7ec51e;--activeButtonFont:#002149;--hoverBackground:#ffffff;--background:#e4e6e8;--success:#7ac345;--heightScrollableContainer:400px;--borderColor:#d3d3d3;--borderColorButton:#c4c4c4;--textColor:#002554;--textColorHover:#7ac345;--errorColor:#c23b21;--loaderColor:#7ac345;--headerTableBackground:#cdcdcd;--borderTable:#dedede;--shadowBorderTable:#f1f1f1;--backgroundTable:#ffffff;font-family:Roboto, Arial, sans-serif;font-size:14px;color:var(--textColor);display:block;background-color:var(--background)}:host .wrapper{height:100%;padding:1rem}:host .types{display:flex;width:100%;gap:5px}:host .transaction-type{background:inherit;font-weight:600;padding:0.6rem 1.6rem;border:1px solid #6c757d;cursor:pointer}:host .transaction-type:hover{color:var(--activeButtonBackground);border-color:var(--activeButtonBackground);background:var(--hoverBackground)}:host .clicked{background-color:var(--activeButtonBackground);border-color:var(--activeButtonBackground)}:host .types-mobile{justify-content:center;margin-bottom:15px}:host .types-desktop{justify-content:flex-end;margin-bottom:3rem}:host .page-size{display:flex;width:100%;justify-content:flex-end;align-items:center}:host .page-size button{background:transparent;border:none;cursor:pointer;margin:0.4rem;width:2rem;height:2rem}:host .page-size button:hover{color:var(--textColorHover)}:host .page-size button.active{background:var(--activeButtonBackground);color:var(--textColor);font-weight:600;border-radius:0.4rem}:host .period{display:flex;width:100%;align-items:flex-end;justify-content:center;gap:10px;background:#f0f0f0;border-bottom:2px solid #e9e9e9;padding:1.6rem 0 0;margin-bottom:4rem}@media (max-width: 801px){:host .period{margin-bottom:0;flex-direction:column;align-items:stretch;width:auto;padding:1.4rem 2.8rem;box-shadow:0 4px 5px 0 rgba(90, 90, 90, 0.24)}}:host .period .range{color:var(--errorColor)}:host .period .filter-btn{height:40px;background:transparent;border:0.1rem solid var(--borderColorButton);min-width:12rem;max-width:17rem;cursor:pointer}@media (max-width: 801px){:host .period .filter-btn{max-width:none;min-width:none;margin-top:1rem}}:host .period .filter-btn:hover{border:none;background:var(--hoverBackground)}:host .period .duet-date__input{padding:7px 60px 7px 7px}:host .period+button{padding:9px 15px}:host .period-content{display:flex;flex-direction:row;width:100%;justify-content:center;align-items:flex-end;margin:0 auto 1.6rem}@media (max-width: 801px){:host .period-content{flex-direction:column;align-items:stretch}}:host .period-content span{height:40px;display:flex;align-items:center;justify-content:center}@media (max-width: 801px){:host .period-content span{display:none}}:host .period-content .filter-btn{margin-left:60px}@media (max-width: 801px){:host .period-content .filter-btn{margin-left:0}}:host .period-content .date-input{padding:0 4px}@media (max-width: 801px){:host .period-content .date-input{width:auto}:host .period-content .date-input:first-child{margin-bottom:0.5rem}}:host .period-content .date-input label{display:inline-block;margin-bottom:0.9rem}:host .period-content .date-input input{border:0.1rem solid var(--borderColor);box-sizing:border-box;border-radius:0.2rem}:host .pagination{display:flex;width:100%;justify-content:center;margin-top:1.5rem}:host .pagination button{cursor:pointer;border:none;background-color:var(--activeButtonBackground);color:#fff;opacity:0.5;padding:7px 12px}:host .pagination button:hover{opacity:1}:host .pagination button:focus{opacity:1}:host button.active{color:var(--activeButtonFont);background-color:var(--activeButtonBackground)}.mobile-filter-button{display:flex;justify-content:center;align-items:center;width:100%;height:2.8rem;background:inherit;border:1px solid var(--borderColorButton)}.mobile-filter-button img{height:50%;margin-right:0.5rem}.noData{display:flex;align-items:center;box-shadow:0 0.4rem 0.4rem rgba(0, 0, 0, 0.25);padding:1.1rem;border-radius:0.6rem}.noData span{margin-left:0.5rem}.table{height:var(--heightScrollableContainer);overflow-y:auto}.table .mobile-table{height:100%}.data-transaction{border-bottom:1px solid var(--borderColor);background-color:var(--hoverBackground);padding:0 20px;display:grid;grid-template-columns:repeat(2, 1fr)}.data-transaction .text-style-status{font-weight:600}.data-transaction .text-style-status .success{color:var(--success)}.data-transaction .text-style-status .error{color:var(--errorColor)}.data-transaction .text-style{text-align:end}.data-transaction .date{font-size:12px;display:flex;align-items:center}.loader{display:inline-block;position:absolute;width:80px;height:80px;top:calc(50% - 40px);left:calc(50% - 40px);z-index:100}.loader::before{content:"";position:fixed;top:0;bottom:0;left:0;right:0;background-color:rgba(255, 255, 255, 0.6)}.loader div{position:absolute;width:6px;height:6px;background:var(--loaderColor);border-radius:50%;animation:loader 1.2s linear infinite}.loader div:nth-child(1){animation-delay:0s;top:37px;left:66px}.loader div:nth-child(2){animation-delay:-0.1s;top:22px;left:62px}.loader div:nth-child(3){animation-delay:-0.2s;top:11px;left:52px}.loader div:nth-child(4){animation-delay:-0.3s;top:7px;left:37px}.loader div:nth-child(5){animation-delay:-0.4s;top:11px;left:22px}.loader div:nth-child(6){animation-delay:-0.5s;top:22px;left:11px}.loader div:nth-child(7){animation-delay:-0.6s;top:37px;left:7px}.loader div:nth-child(8){animation-delay:-0.7s;top:52px;left:11px}.loader div:nth-child(9){animation-delay:-0.8s;top:62px;left:22px}.loader div:nth-child(10){animation-delay:-0.9s;top:66px;left:37px}.loader div:nth-child(11){animation-delay:-1s;top:62px;left:52px}.loader div:nth-child(12){animation-delay:-1.1s;top:52px;left:62px}@keyframes loader{0%,20%,80%,100%{transform:scale(1)}50%{transform:scale(1.5)}}.table thead th{position:sticky;top:0}table{border-collapse:collapse;width:100%}table th{padding:14px 24px;text-align:left;font-weight:600;color:var(--textColor);background:var(--headerTableBackground)}table td{padding:1rem 1.7rem;box-shadow:0 -1px 0 0 var(--shadowBorderTable) inset;border-bottom:0.1rem solid var(--borderTable);text-align:left;color:var(--textColor)}table tbody{background:var(--backgroundTable)}table .success{color:var(--success)}table .error{color:var(--errorColor)}vaadin-date-picker{min-width:320px}@media (max-width: 1261px){vaadin-date-picker{width:auto;min-width:auto}}@media (max-width: 801px){vaadin-date-picker{width:100%}}', z = L, M = class {
238
+ constructor(t) {
239
+ y(this, t), this.pageSizes = [10, 25, 50], this.pagination = null, this.stylingAppended = !1, this.endpoint = void 0, this.session = void 0, this.language = n.defaultLanguage, this.userId = void 0, this.translationUrl = void 0, this.mobile = !1, this.clientStyling = null, this.clientStylingUrl = null, this.page = 0, this.pageSize = this.pageSizes[0], this.showMobileFilter = !1, this.to = void 0, this.from = void 0, this.type = "0", this.transactions = void 0, this.showLoader = !0;
240
+ }
241
+ watchMultiple() {
242
+ this.loadTransactions();
243
+ }
244
+ componentWillLoad() {
245
+ return d(this, null, function* () {
246
+ this.translationUrl && (yield n.loadCustomTranslations(this.translationUrl)), this.loadTransactions();
247
+ });
248
+ }
249
+ componentDidRender() {
250
+ this.getComponentHeight(), !this.stylingAppended && this.stylingContainer && (this.clientStyling && this.setStyles(this.clientStyling), this.clientStylingUrl && this.setClientStylingByURL(), this.stylingAppended = !0);
251
+ }
252
+ getComponentHeight() {
253
+ var t;
254
+ if (this.mobile) {
255
+ let a = this.el.getBoundingClientRect().height - ((t = this.el.shadowRoot.querySelector(".table")) === null || t === void 0 ? void 0 : t.getBoundingClientRect().y);
256
+ this.el.style.setProperty("--heightScrollableContainer", a + "px");
257
+ }
258
+ }
259
+ setHeightTableProperty() {
260
+ let t = this.getComponentHeight();
261
+ this.el.style.setProperty("--heightScrollableContainer", t + "px");
262
+ }
263
+ changeTransactionsType(t) {
264
+ this.type = t;
265
+ }
266
+ changePageSize(t) {
267
+ this.pageSize = t;
268
+ }
269
+ prev() {
270
+ var t;
271
+ !((t = this.pagination) === null || t === void 0) && t.previous && this.page--;
272
+ }
273
+ next() {
274
+ var t;
275
+ !((t = this.pagination) === null || t === void 0) && t.next && this.page++;
276
+ }
277
+ applyFilters(t, a) {
278
+ this.from = t ? new Date(t).toISOString() : null, this.to = a ? new Date(a).toISOString() : null, this.loadTransactions();
279
+ }
280
+ showFilter() {
281
+ this.showMobileFilter = !this.showMobileFilter;
282
+ }
283
+ render() {
284
+ var t;
285
+ const a = u("../assets/filter.svg"), i = u("../assets/warning.svg");
286
+ return e(v, { key: "c850ba36433277706247f4b7c0c08b0ae0fb8c76" }, this.showLoader ? e(C, null) : "", e("div", { key: "20b817b5c9cf14e8af0db2ba417d09e21b6921d7", class: "wrapper", ref: (o) => this.stylingContainer = o }, e("div", { key: "3943f4ab79cb0e72083821b424000f96779e78a5", class: { "types types-mobile": this.mobile, "types types-desktop": !this.mobile } }, e("button", { key: "d1f3dfc1f4fc7013bd81c92663f578129f63c0e7", class: "transaction-type " + (this.type === "0" ? "clicked" : ""), onClick: () => this.changeTransactionsType("0") }, n.translate("deposit", this.language)), e("button", { key: "46989070ef6703fdf7c8c7ac6628e9dce731fec6", class: "transaction-type " + (this.type === "1" ? "clicked" : ""), onClick: () => this.changeTransactionsType("1") }, n.translate("withdrawals", this.language))), this.mobile ? "" : e(B, { language: this.language, pageSizes: this.pageSizes, currentPageSize: this.pageSize, changePageSize: (o) => this.changePageSize(o) }), this.mobile ? e("button", { class: "mobile-filter-button", onClick: () => this.showFilter() }, e("img", { src: a, alt: "Filter" }), n.translate("filter", this.language)) : "", !this.mobile || this.showMobileFilter && this.mobile ? e(F, { language: this.language, applyFilters: (o, r) => this.applyFilters(o, r) }) : "", ((t = this.transactions) === null || t === void 0 ? void 0 : t.length) > 0 ? e("div", { class: "table" }, this.mobile ? e("div", { class: "mobile-table" }, this.transactions.map((o) => e(T, Object.assign({}, o)))) : e(D, { source: this.transactions, language: this.language })) : e("div", { class: "noData" }, e("img", { src: i, alt: "Warning" }), e("span", null, n.translate("noData", this.language))), e("div", { key: "50710657788295389a20d59e0092dd033e428268", class: "pagination" }, e("button", { key: "cd29c880eab413a06666dc12c8df38d3ffdcfe2f", onClick: () => this.prev() }, "<"), e("button", { key: "df351ecd4237433a8ab38766669ac48d2548ed6a", onClick: () => this.next() }, ">"))));
287
+ }
288
+ loadTransactions() {
289
+ return d(this, null, function* () {
290
+ this.showLoader = !0;
291
+ try {
292
+ const t = `${this.endpoint}/v1/player/${this.userId}/transactions/banking?${this.getParams()}`, a = yield fetch(t, {
293
+ headers: {
294
+ "X-Sessionid": this.session,
295
+ "Content-Type": "application/json"
296
+ }
297
+ });
298
+ if (!a.ok) {
299
+ const o = yield a.text();
300
+ throw new Error(o);
301
+ }
302
+ const i = yield a.json();
303
+ this.pagination = i.pagination, this.transactions = i.transactions;
304
+ } catch (t) {
305
+ console.error(t);
306
+ } finally {
307
+ this.showLoader = !1;
308
+ }
309
+ });
310
+ }
311
+ getParams() {
312
+ var t, a;
313
+ const i = /* @__PURE__ */ new Date(), o = (this.page * this.pageSize).toString(), r = (t = this.from) !== null && t !== void 0 ? t : new Date(i.getFullYear(), i.getMonth(), 1).toISOString(), l = (a = this.to) !== null && a !== void 0 ? a : new Date(i.getFullYear(), i.getMonth() + 1, 0).toISOString();
314
+ return `offset=${o}&endDate=${l}&startDate=${r}&type=${this.type}&limit=${this.pageSize}`;
315
+ }
316
+ setStyles(t) {
317
+ const a = document.createElement("style");
318
+ a.innerHTML = t, this.stylingContainer.prepend(a);
319
+ }
320
+ setClientStylingByURL() {
321
+ return d(this, null, function* () {
322
+ try {
323
+ const t = yield fetch(this.clientStylingUrl);
324
+ if (!t.ok) {
325
+ const i = yield t.text();
326
+ throw new Error(i);
327
+ }
328
+ const a = yield t.text();
329
+ this.setStyles(a);
330
+ } catch (t) {
331
+ console.error(`Failed to load client styles ${this.clientStylingUrl}`, t);
332
+ }
333
+ });
334
+ }
335
+ static get assetsDirs() {
336
+ return ["../assets"];
337
+ }
338
+ get el() {
339
+ return x(this);
340
+ }
341
+ static get watchers() {
342
+ return {
343
+ page: ["watchMultiple"],
344
+ type: ["watchMultiple"],
345
+ session: ["watchMultiple"],
346
+ userId: ["watchMultiple"],
347
+ pageSize: ["watchMultiple"],
348
+ showMobileFilter: ["getComponentHeight"]
349
+ };
350
+ }
351
+ };
352
+ M.style = z;
353
+ export {
354
+ M as user_transaction_history
355
+ };