@everymatrix/user-transaction-history 1.43.4 → 1.45.0

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 (65) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-4699d9a2.js +1382 -0
  3. package/dist/cjs/loader.cjs.js +7 -13
  4. package/dist/cjs/user-transaction-history.cjs.entry.js +291 -295
  5. package/dist/cjs/user-transaction-history.cjs.js +17 -11
  6. package/dist/collection/collection-manifest.json +3 -3
  7. package/dist/collection/components/internal/filters.js +11 -20
  8. package/dist/collection/components/internal/loader.js +2 -14
  9. package/dist/collection/components/internal/page-size.js +3 -5
  10. package/dist/collection/components/internal/table.js +18 -29
  11. package/dist/collection/components/internal/transaction.js +4 -14
  12. package/dist/collection/components/user-transaction-history/index.js +1 -0
  13. package/dist/collection/components/user-transaction-history/user-transaction-history.js +334 -343
  14. package/dist/collection/global/app.js +1 -1
  15. package/dist/collection/utils/currency.utils.js +15 -15
  16. package/dist/collection/utils/date.util.js +6 -6
  17. package/dist/collection/utils/locale.util.js +60 -60
  18. package/dist/collection/utils/utils.js +3 -0
  19. package/dist/esm/app-globals-0f993ce5.js +3 -0
  20. package/dist/esm/index-b111cb50.js +1353 -0
  21. package/dist/esm/loader.js +7 -13
  22. package/dist/esm/user-transaction-history.entry.js +291 -295
  23. package/dist/esm/user-transaction-history.js +14 -11
  24. package/dist/stencil.config.dev.js +17 -0
  25. package/dist/stencil.config.js +14 -19
  26. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/user-transaction-history/.stencil/packages/stencil/user-transaction-history/stencil.config.d.ts +2 -0
  27. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-monorepo/packages/stencil/user-transaction-history/.stencil/packages/stencil/user-transaction-history/stencil.config.dev.d.ts +2 -0
  28. package/dist/types/components/internal/filters.d.ts +4 -4
  29. package/dist/types/components/internal/page-size.d.ts +4 -4
  30. package/dist/types/components/internal/table.d.ts +2 -2
  31. package/dist/types/components/user-transaction-history/index.d.ts +1 -0
  32. package/dist/types/components/user-transaction-history/user-transaction-history.d.ts +37 -37
  33. package/dist/types/contracts/translation.d.ts +2 -2
  34. package/dist/types/models/transactions-response.model.d.ts +17 -17
  35. package/dist/types/stencil-public-runtime.d.ts +142 -33
  36. package/dist/types/utils/currency.utils.d.ts +2 -2
  37. package/dist/types/utils/date.util.d.ts +2 -2
  38. package/dist/types/utils/locale.util.d.ts +38 -38
  39. package/dist/types/utils/utils.d.ts +1 -0
  40. package/dist/user-transaction-history/p-57173b50.js +2 -0
  41. package/dist/user-transaction-history/p-653991ac.entry.js +1 -0
  42. package/dist/user-transaction-history/p-e1255160.js +1 -0
  43. package/dist/user-transaction-history/user-transaction-history.esm.js +1 -1
  44. package/loader/cdn.js +1 -3
  45. package/loader/index.cjs.js +1 -3
  46. package/loader/index.d.ts +13 -1
  47. package/loader/index.es2017.js +1 -3
  48. package/loader/index.js +1 -3
  49. package/loader/package.json +1 -0
  50. package/package.json +8 -1
  51. package/dist/cjs/index-206e75cb.js +0 -1416
  52. package/dist/components/index.d.ts +0 -26
  53. package/dist/components/index.js +0 -1
  54. package/dist/components/user-transaction-history.d.ts +0 -11
  55. package/dist/components/user-transaction-history.js +0 -378
  56. package/dist/esm/index-32e3ae05.js +0 -1388
  57. package/dist/esm/polyfills/core-js.js +0 -11
  58. package/dist/esm/polyfills/css-shim.js +0 -1
  59. package/dist/esm/polyfills/dom.js +0 -79
  60. package/dist/esm/polyfills/es5-html-element.js +0 -1
  61. package/dist/esm/polyfills/index.js +0 -34
  62. package/dist/esm/polyfills/system.js +0 -6
  63. package/dist/types/Users/adrian.pripon/Documents/Work/widgets-stencil/packages/user-transaction-history/.stencil/packages/user-transaction-history/stencil.config.d.ts +0 -2
  64. package/dist/user-transaction-history/p-10b5b959.js +0 -1
  65. package/dist/user-transaction-history/p-4e4fb37e.entry.js +0 -1
@@ -2,346 +2,342 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-206e75cb.js');
5
+ const index = require('./index-4699d9a2.js');
6
6
 
7
7
  const DEFAULT_TRANSLATIONS = {
8
- "en": {
9
- "deposit": "Deposit",
10
- "withdrawals": "Withdrawals",
11
- "show": "Show",
12
- "from": "From",
13
- "to": "To",
14
- "filter": "Filter",
15
- "transactionId": "Transaction ID",
16
- "date": "Date",
17
- "amount": "Amount",
18
- "productType": "Product Type",
19
- "status": "Status",
20
- "noData": "There are no account activities"
21
- },
22
- "hr": {
23
- "deposit": "Uplate",
24
- "withdrawals": "Isplate",
25
- "show": "Prikaži",
26
- "from": "Od",
27
- "to": "Do",
28
- "filter": "Filter",
29
- "transactionId": "ID transakcije",
30
- "date": "Datum",
31
- "amount": "Iznos",
32
- "productType": "Vrsta proizvoda",
33
- "status": "Status",
34
- "noData": "Nema aktivnosti na računu"
35
- }
8
+ "en": {
9
+ "deposit": "Deposit",
10
+ "withdrawals": "Withdrawals",
11
+ "show": "Show",
12
+ "from": "From",
13
+ "to": "To",
14
+ "filter": "Filter",
15
+ "transactionId": "Transaction ID",
16
+ "date": "Date",
17
+ "amount": "Amount",
18
+ "productType": "Product Type",
19
+ "status": "Status",
20
+ "noData": "There are no account activities"
21
+ },
22
+ "hr": {
23
+ "deposit": "Uplate",
24
+ "withdrawals": "Isplate",
25
+ "show": "Prikaži",
26
+ "from": "Od",
27
+ "to": "Do",
28
+ "filter": "Filter",
29
+ "transactionId": "ID transakcije",
30
+ "date": "Datum",
31
+ "amount": "Iznos",
32
+ "productType": "Vrsta proizvoda",
33
+ "status": "Status",
34
+ "noData": "Nema aktivnosti na računu"
35
+ }
36
36
  };
37
37
  class Localization {
38
- constructor() { }
39
- static async loadCustomTranslations(translationUrl) {
40
- try {
41
- const response = await fetch(translationUrl, {
42
- headers: {
43
- 'Content-Type': 'application/json',
44
- },
45
- });
46
- if (!response.ok) {
47
- const err = await response.text();
48
- throw new Error(err);
49
- }
50
- const translations = await response.json();
51
- Localization.updateTranslations(translations);
38
+ constructor() { }
39
+ static async loadCustomTranslations(translationUrl) {
40
+ try {
41
+ const response = await fetch(translationUrl, {
42
+ headers: {
43
+ 'Content-Type': 'application/json',
44
+ },
45
+ });
46
+ if (!response.ok) {
47
+ const err = await response.text();
48
+ throw new Error(err);
49
+ }
50
+ const translations = await response.json();
51
+ Localization.updateTranslations(translations);
52
+ }
53
+ catch (ex) {
54
+ console.error(`Failed to load translations ${translationUrl}. ${ex.message}`);
55
+ }
52
56
  }
53
- catch (ex) {
54
- console.error(`Failed to load translations ${translationUrl}. ${ex.message}`);
57
+ static translate(key, locale) {
58
+ var _a, _b;
59
+ const avaliableLocales = Localization.getAvaliableLanguages(locale);
60
+ return ((_b = (_a = Localization.customTranslation) === null || _a === void 0 ? void 0 : _a[avaliableLocales.customLanguage]) === null || _b === void 0 ? void 0 : _b[key]) || Localization.defaultTranslation[avaliableLocales.predefinedLanguage][key];
61
+ }
62
+ static getAvaliableLanguages(locale) {
63
+ var _a;
64
+ const customLanguage = ((_a = Localization.customLanguages) === null || _a === void 0 ? void 0 : _a.includes(locale)) ? locale : Localization.defaultLanguage;
65
+ const predefinedLanguage = Localization.supportedLanguages.includes(locale) ? locale : Localization.defaultLanguage;
66
+ return { predefinedLanguage, customLanguage };
67
+ }
68
+ static updateTranslations(translations) {
69
+ Localization.customLanguages = Array.from(new Set([...Localization.supportedLanguages, ...Object.keys(translations).map(k => k.toLowerCase())]));
70
+ Localization.customTranslation = translations;
55
71
  }
56
- }
57
- static translate(key, locale) {
58
- var _a, _b;
59
- const avaliableLocales = Localization.getAvaliableLanguages(locale);
60
- return ((_b = (_a = Localization.customTranslation) === null || _a === void 0 ? void 0 : _a[avaliableLocales.customLanguage]) === null || _b === void 0 ? void 0 : _b[key]) || Localization.defaultTranslation[avaliableLocales.predefinedLanguage][key];
61
- }
62
- static getAvaliableLanguages(locale) {
63
- var _a;
64
- const customLanguage = ((_a = Localization.customLanguages) === null || _a === void 0 ? void 0 : _a.includes(locale)) ? locale : Localization.defaultLanguage;
65
- const predefinedLanguage = Localization.supportedLanguages.includes(locale) ? locale : Localization.defaultLanguage;
66
- return { predefinedLanguage, customLanguage };
67
- }
68
- static updateTranslations(translations) {
69
- Localization.customLanguages = Array.from(new Set([...Localization.supportedLanguages, ...Object.keys(translations).map(k => k.toLowerCase())]));
70
- Localization.customTranslation = translations;
71
- }
72
72
  }
73
73
  Localization.defaultLanguage = 'en';
74
74
  Localization.supportedLanguages = ['en'];
75
75
  Localization.defaultTranslation = DEFAULT_TRANSLATIONS;
76
76
 
77
77
  const Loader = () => (index.h("div", { class: "loader" },
78
- index.h("div", null),
79
- index.h("div", null),
80
- index.h("div", null),
81
- index.h("div", null),
82
- index.h("div", null),
83
- index.h("div", null),
84
- index.h("div", null),
85
- index.h("div", null),
86
- index.h("div", null),
87
- index.h("div", null),
88
- index.h("div", null),
89
- index.h("div", null)));
78
+ index.h("div", null),
79
+ index.h("div", null),
80
+ index.h("div", null),
81
+ index.h("div", null),
82
+ index.h("div", null),
83
+ index.h("div", null),
84
+ index.h("div", null),
85
+ index.h("div", null),
86
+ index.h("div", null),
87
+ index.h("div", null),
88
+ index.h("div", null),
89
+ index.h("div", null)));
90
90
 
91
91
  class DateTransformer {
92
- constructor() { }
93
- static dateToFormatedString(date) {
94
- const dateStr = date.toLocaleDateString('en-gb');
95
- const timeStr = date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
96
- return `${dateStr}, ${timeStr}`;
97
- }
92
+ constructor() { }
93
+ static dateToFormatedString(date) {
94
+ const dateStr = date.toLocaleDateString('en-gb');
95
+ const timeStr = date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
96
+ return `${dateStr}, ${timeStr}`;
97
+ }
98
98
  }
99
99
 
100
100
  class CurrencyFormatter {
101
- constructor() { }
102
- static format(currency, value) {
103
- let result = `${value} ${currency}`;
104
- try {
105
- const formatter = new Intl.NumberFormat('en-US', {
106
- style: 'currency',
107
- currency: currency,
108
- });
109
- result = formatter.format(value);
110
- }
111
- catch (_a) {
112
- // If we here formatter do not support that currency.
113
- // Just ignore that and use the currency name instead of it symbol.
101
+ constructor() { }
102
+ static format(currency, value) {
103
+ let result = `${value} ${currency}`;
104
+ try {
105
+ const formatter = new Intl.NumberFormat('en-US', {
106
+ style: 'currency',
107
+ currency: currency,
108
+ });
109
+ result = formatter.format(value);
110
+ }
111
+ catch (_a) {
112
+ // If we here formatter do not support that currency.
113
+ // Just ignore that and use the currency name instead of it symbol.
114
+ }
115
+ return result;
114
116
  }
115
- return result;
116
- }
117
117
  }
118
118
 
119
119
  const TransactionComponent = (transaction) => (index.h("div", { class: "data-transaction" },
120
- index.h("p", null, transaction.productType),
121
- index.h("p", { class: "text-style text-style-status" },
122
- index.h("span", { class: transaction.status.toLowerCase() }, transaction.status)),
123
- index.h("p", { class: "date" },
124
- transaction.transId,
125
- " | ",
126
- DateTransformer.dateToFormatedString(new Date(transaction.created))),
127
- index.h("p", { class: "text-style" },
128
- CurrencyFormatter.format(transaction.currency, transaction.realAmount),
129
- " ")));
120
+ index.h("p", null, transaction.productType),
121
+ index.h("p", { class: "text-style text-style-status" },
122
+ index.h("span", { class: transaction.status.toLowerCase() }, transaction.status)),
123
+ index.h("p", { class: "date" },
124
+ transaction.transId,
125
+ " | ",
126
+ DateTransformer.dateToFormatedString(new Date(transaction.created))),
127
+ index.h("p", { class: "text-style" },
128
+ CurrencyFormatter.format(transaction.currency, transaction.realAmount),
129
+ " ")));
130
130
 
131
131
  const PageSize = (props) => {
132
- return (index.h("div", { class: "page-size" },
133
- index.h("span", null, Localization.translate('show', props.language)),
134
- props.pageSizes.map(pageSize => (index.h("button", { class: props.currentPageSize === pageSize ? 'active' : '', onClick: () => props.changePageSize(pageSize) }, pageSize)))));
132
+ return (index.h("div", { class: "page-size" },
133
+ index.h("span", null, Localization.translate('show', props.language)),
134
+ props.pageSizes.map(pageSize => (index.h("button", { class: props.currentPageSize === pageSize ? 'active' : '', onClick: () => props.changePageSize(pageSize) }, pageSize)))));
135
135
  };
136
136
 
137
137
  const Filters = ({ from, to, applyFilters, language }) => {
138
- let fromPicker;
139
- let toPicker;
140
- const fromChange = () => {
141
- from = fromPicker.value;
142
- };
143
- const toChange = () => {
144
- to = toPicker.value;
145
- };
146
- return (index.h("div", { class: "period" },
147
- index.h("div", { class: "period-content" },
148
- index.h("div", { class: "date-input" },
149
- index.h("vaadin-date-picker", { value: from, ref: el => (fromPicker = el), label: Localization.translate('from', language), onChange: fromChange })),
150
- index.h("span", null,
151
- index.h("svg", { width: "24px", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
152
- index.h("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' }))),
153
- index.h("div", { class: "date-input" },
154
- index.h("vaadin-date-picker", { value: to, ref: el => (toPicker = el), label: Localization.translate('to', language), onChange: toChange })),
155
- index.h("button", { class: "filter-btn", onClick: () => applyFilters(from, to) }, Localization.translate('filter', language)))));
138
+ let fromPicker;
139
+ let toPicker;
140
+ const fromChange = () => {
141
+ from = fromPicker.value;
142
+ };
143
+ const toChange = () => {
144
+ to = toPicker.value;
145
+ };
146
+ return (index.h("div", { class: "period" },
147
+ index.h("div", { class: "period-content" },
148
+ index.h("div", { class: "date-input" },
149
+ index.h("vaadin-date-picker", { value: from, ref: el => (fromPicker = el), label: Localization.translate('from', language), onChange: fromChange })),
150
+ index.h("span", null,
151
+ index.h("svg", { width: "24px", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" },
152
+ index.h("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' }))),
153
+ index.h("div", { class: "date-input" },
154
+ index.h("vaadin-date-picker", { value: to, ref: el => (toPicker = el), label: Localization.translate('to', language), onChange: toChange })),
155
+ index.h("button", { class: "filter-btn", onClick: () => applyFilters(from, to) }, Localization.translate('filter', language)))));
156
156
  };
157
157
 
158
158
  const TableComponent = ({ source, language }) => {
159
- const columns = [
160
- { name: Localization.translate('transactionId', language) },
161
- {
162
- name: Localization.translate('date', language),
163
- },
164
- {
165
- name: Localization.translate('amount', language),
166
- },
167
- { name: Localization.translate('productType', language) },
168
- {
169
- name: Localization.translate('status', language),
170
- },
171
- ];
172
- return (index.h("table", null,
173
- index.h("thead", null,
174
- index.h("tr", null, columns.map(column => index.h("th", null, column.name)))),
175
- index.h("tbody", null, source.map(transaction => index.h("tr", null,
176
- index.h("td", null, transaction.transId),
177
- index.h("td", null, DateTransformer.dateToFormatedString(new Date(transaction.created))),
178
- index.h("td", null,
179
- CurrencyFormatter.format(transaction.currency, transaction.realAmount),
180
- " "),
181
- index.h("td", null, transaction.productType),
182
- index.h("td", null,
183
- index.h("span", { class: transaction.status.toLowerCase() }, transaction.status)))))));
159
+ const columns = [
160
+ { name: Localization.translate('transactionId', language) },
161
+ {
162
+ name: Localization.translate('date', language),
163
+ },
164
+ {
165
+ name: Localization.translate('amount', language),
166
+ },
167
+ { name: Localization.translate('productType', language) },
168
+ {
169
+ name: Localization.translate('status', language),
170
+ },
171
+ ];
172
+ return (index.h("table", null,
173
+ index.h("thead", null,
174
+ index.h("tr", null, columns.map(column => index.h("th", null, column.name)))),
175
+ index.h("tbody", null, source.map(transaction => index.h("tr", null,
176
+ index.h("td", null, transaction.transId),
177
+ index.h("td", null, DateTransformer.dateToFormatedString(new Date(transaction.created))),
178
+ index.h("td", null,
179
+ CurrencyFormatter.format(transaction.currency, transaction.realAmount),
180
+ " "),
181
+ index.h("td", null, transaction.productType),
182
+ index.h("td", null,
183
+ index.h("span", { class: transaction.status.toLowerCase() }, transaction.status)))))));
184
184
  };
185
185
 
186
186
  const userTransactionHistoryCss = ":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%}}";
187
+ const UserTransactionHistoryStyle0 = userTransactionHistoryCss;
187
188
 
188
189
  const UserTransactionHistory = class {
189
- constructor(hostRef) {
190
- index.registerInstance(this, hostRef);
191
- this.pageSizes = [10, 25, 50];
192
- this.pagination = null;
193
- this.stylingAppended = false;
194
- /*
195
- * Language of the application.
196
- */
197
- this.language = Localization.defaultLanguage;
198
- /*
199
- * Is mobile mode on. Default value `false`.
200
- */
201
- this.mobile = false;
202
- /*
203
- * Client styling via inline styles.
204
- */
205
- this.clientStyling = null;
206
- /*
207
- * The path to file with styles in `css` format.
208
- */
209
- this.clientStylingUrl = null;
210
- this.page = 0;
211
- this.pageSize = this.pageSizes[0];
212
- this.showMobileFilter = false;
213
- this.type = '0';
214
- this.showLoader = true;
215
- }
216
- watchMultiple() {
217
- this.loadTransactions();
218
- }
219
- async componentWillLoad() {
220
- if (this.translationUrl) {
221
- await Localization.loadCustomTranslations(this.translationUrl);
190
+ constructor(hostRef) {
191
+ index.registerInstance(this, hostRef);
192
+ this.pageSizes = [10, 25, 50];
193
+ this.pagination = null;
194
+ this.stylingAppended = false;
195
+ this.endpoint = undefined;
196
+ this.session = undefined;
197
+ this.language = Localization.defaultLanguage;
198
+ this.userId = undefined;
199
+ this.translationUrl = undefined;
200
+ this.mobile = false;
201
+ this.clientStyling = null;
202
+ this.clientStylingUrl = null;
203
+ this.page = 0;
204
+ this.pageSize = this.pageSizes[0];
205
+ this.showMobileFilter = false;
206
+ this.to = undefined;
207
+ this.from = undefined;
208
+ this.type = '0';
209
+ this.transactions = undefined;
210
+ this.showLoader = true;
222
211
  }
223
- this.loadTransactions();
224
- }
225
- componentDidRender() {
226
- this.getComponentHeight();
227
- if (!this.stylingAppended && this.stylingContainer) {
228
- if (this.clientStyling) {
229
- this.setStyles(this.clientStyling);
230
- }
231
- if (this.clientStylingUrl) {
232
- this.setClientStylingByURL();
233
- }
234
- this.stylingAppended = true;
212
+ watchMultiple() {
213
+ this.loadTransactions();
235
214
  }
236
- }
237
- getComponentHeight() {
238
- var _a;
239
- if (this.mobile) {
240
- let height = this.el.getBoundingClientRect().height - ((_a = this.el.shadowRoot.querySelector('.table')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().y);
241
- this.el.style.setProperty('--heightScrollableContainer', height + 'px');
215
+ async componentWillLoad() {
216
+ if (this.translationUrl) {
217
+ await Localization.loadCustomTranslations(this.translationUrl);
218
+ }
219
+ this.loadTransactions();
242
220
  }
243
- }
244
- setHeightTableProperty() {
245
- let height = this.getComponentHeight();
246
- this.el.style.setProperty('--heightScrollableContainer', height + 'px');
247
- }
248
- changeTransactionsType(type) {
249
- this.type = type;
250
- }
251
- changePageSize(pageSize) {
252
- this.pageSize = pageSize;
253
- }
254
- prev() {
255
- var _a;
256
- if (!((_a = this.pagination) === null || _a === void 0 ? void 0 : _a.previous)) {
257
- return;
221
+ componentDidRender() {
222
+ this.getComponentHeight();
223
+ if (!this.stylingAppended && this.stylingContainer) {
224
+ if (this.clientStyling) {
225
+ this.setStyles(this.clientStyling);
226
+ }
227
+ if (this.clientStylingUrl) {
228
+ this.setClientStylingByURL();
229
+ }
230
+ this.stylingAppended = true;
231
+ }
232
+ }
233
+ getComponentHeight() {
234
+ var _a;
235
+ if (this.mobile) {
236
+ let height = this.el.getBoundingClientRect().height - ((_a = this.el.shadowRoot.querySelector('.table')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().y);
237
+ this.el.style.setProperty('--heightScrollableContainer', height + 'px');
238
+ }
258
239
  }
259
- this.page--;
260
- }
261
- next() {
262
- var _a;
263
- if (!((_a = this.pagination) === null || _a === void 0 ? void 0 : _a.next)) {
264
- return;
240
+ setHeightTableProperty() {
241
+ let height = this.getComponentHeight();
242
+ this.el.style.setProperty('--heightScrollableContainer', height + 'px');
243
+ }
244
+ changeTransactionsType(type) {
245
+ this.type = type;
246
+ }
247
+ changePageSize(pageSize) {
248
+ this.pageSize = pageSize;
249
+ }
250
+ prev() {
251
+ var _a;
252
+ if (!((_a = this.pagination) === null || _a === void 0 ? void 0 : _a.previous)) {
253
+ return;
254
+ }
255
+ this.page--;
265
256
  }
266
- this.page++;
267
- }
268
- applyFilters(from, to) {
269
- this.from = from ? new Date(from).toISOString() : null;
270
- this.to = to ? new Date(to).toISOString() : null;
271
- this.loadTransactions();
272
- }
273
- showFilter() {
274
- this.showMobileFilter = !this.showMobileFilter;
275
- }
276
- render() {
277
- var _a;
278
- const filterSrc = index.getAssetPath('../assets/filter.svg');
279
- const warningSrc = index.getAssetPath('../assets/warning.svg');
280
- return (index.h(index.Host, null, this.showLoader ? index.h(Loader, null) : '', index.h("div", { class: "wrapper", ref: el => (this.stylingContainer = el) }, index.h("div", { class: { 'types types-mobile': this.mobile, 'types types-desktop': !this.mobile } }, index.h("button", { class: 'transaction-type' + ' ' + (this.type === '0' ? 'clicked' : ''), onClick: () => this.changeTransactionsType('0') }, Localization.translate('deposit', this.language)), index.h("button", { class: 'transaction-type' + ' ' + (this.type === '1' ? 'clicked' : ''), onClick: () => this.changeTransactionsType('1') }, Localization.translate('withdrawals', this.language))), !this.mobile ? index.h(PageSize, { language: this.language, pageSizes: this.pageSizes, currentPageSize: this.pageSize, changePageSize: s => this.changePageSize(s) }) : '', this.mobile ? (index.h("button", { class: "mobile-filter-button", onClick: () => this.showFilter() }, index.h("img", { src: filterSrc, alt: "Filter" }), Localization.translate('filter', this.language))) : (''), !this.mobile || (this.showMobileFilter && this.mobile) ? index.h(Filters, { language: this.language, applyFilters: (from, to) => this.applyFilters(from, to) }) : '', ((_a = this.transactions) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (index.h("div", { class: "table" }, this.mobile ? (index.h("div", { class: "mobile-table" }, this.transactions.map(transaction => (index.h(TransactionComponent, Object.assign({}, transaction)))))) : (index.h(TableComponent, { source: this.transactions, language: this.language })))) : (index.h("div", { class: "noData" }, index.h("img", { src: warningSrc, alt: "Warning" }), index.h("span", null, Localization.translate('noData', this.language)))), index.h("div", { class: "pagination" }, index.h("button", { onClick: () => this.prev() }, '<'), index.h("button", { onClick: () => this.next() }, '>')))));
281
- }
282
- async loadTransactions() {
283
- this.showLoader = true;
284
- try {
285
- const url = `${this.endpoint}/v1/player/${this.userId}/transactions/banking?${this.getParams()}`;
286
- const response = await fetch(url, {
287
- headers: {
288
- 'X-Sessionid': this.session,
289
- 'Content-Type': 'application/json'
257
+ next() {
258
+ var _a;
259
+ if (!((_a = this.pagination) === null || _a === void 0 ? void 0 : _a.next)) {
260
+ return;
290
261
  }
291
- });
292
- if (!response.ok) {
293
- const err = await response.text();
294
- throw new Error(err);
295
- }
296
- const data = await response.json();
297
- this.pagination = data.pagination;
298
- this.transactions = data.transactions;
262
+ this.page++;
299
263
  }
300
- catch (ex) {
301
- console.error(ex);
264
+ applyFilters(from, to) {
265
+ this.from = from ? new Date(from).toISOString() : null;
266
+ this.to = to ? new Date(to).toISOString() : null;
267
+ this.loadTransactions();
302
268
  }
303
- finally {
304
- this.showLoader = false;
269
+ showFilter() {
270
+ this.showMobileFilter = !this.showMobileFilter;
305
271
  }
306
- }
307
- getParams() {
308
- var _a, _b;
309
- const now = new Date();
310
- const offset = (this.page * this.pageSize).toString();
311
- const startDate = (_a = this.from) !== null && _a !== void 0 ? _a : new Date(now.getFullYear(), now.getMonth(), 1).toISOString();
312
- const endDate = (_b = this.to) !== null && _b !== void 0 ? _b : new Date(now.getFullYear(), now.getMonth() + 1, 0).toISOString();
313
- return `offset=${offset}&endDate=${endDate}&startDate=${startDate}&type=${this.type}&limit=${this.pageSize}`;
314
- }
315
- setStyles(styles) {
316
- const cssFile = document.createElement('style');
317
- cssFile.innerHTML = styles;
318
- this.stylingContainer.prepend(cssFile);
319
- }
320
- async setClientStylingByURL() {
321
- try {
322
- const response = await fetch(this.clientStylingUrl);
323
- if (!response.ok) {
324
- const err = await response.text();
325
- throw new Error(err);
326
- }
327
- const styles = await response.text();
328
- this.setStyles(styles);
272
+ render() {
273
+ var _a;
274
+ const filterSrc = index.getAssetPath('../assets/filter.svg');
275
+ const warningSrc = index.getAssetPath('../assets/warning.svg');
276
+ return (index.h(index.Host, { key: 'c850ba36433277706247f4b7c0c08b0ae0fb8c76' }, this.showLoader ? index.h(Loader, null) : '', index.h("div", { key: '20b817b5c9cf14e8af0db2ba417d09e21b6921d7', class: "wrapper", ref: el => (this.stylingContainer = el) }, index.h("div", { key: '3943f4ab79cb0e72083821b424000f96779e78a5', class: { 'types types-mobile': this.mobile, 'types types-desktop': !this.mobile } }, index.h("button", { key: 'd1f3dfc1f4fc7013bd81c92663f578129f63c0e7', class: 'transaction-type' + ' ' + (this.type === '0' ? 'clicked' : ''), onClick: () => this.changeTransactionsType('0') }, Localization.translate('deposit', this.language)), index.h("button", { key: '46989070ef6703fdf7c8c7ac6628e9dce731fec6', class: 'transaction-type' + ' ' + (this.type === '1' ? 'clicked' : ''), onClick: () => this.changeTransactionsType('1') }, Localization.translate('withdrawals', this.language))), !this.mobile ? index.h(PageSize, { language: this.language, pageSizes: this.pageSizes, currentPageSize: this.pageSize, changePageSize: s => this.changePageSize(s) }) : '', this.mobile ? (index.h("button", { class: "mobile-filter-button", onClick: () => this.showFilter() }, index.h("img", { src: filterSrc, alt: "Filter" }), Localization.translate('filter', this.language))) : (''), !this.mobile || (this.showMobileFilter && this.mobile) ? index.h(Filters, { language: this.language, applyFilters: (from, to) => this.applyFilters(from, to) }) : '', ((_a = this.transactions) === null || _a === void 0 ? void 0 : _a.length) > 0 ? (index.h("div", { class: "table" }, this.mobile ? (index.h("div", { class: "mobile-table" }, this.transactions.map(transaction => (index.h(TransactionComponent, Object.assign({}, transaction)))))) : (index.h(TableComponent, { source: this.transactions, language: this.language })))) : (index.h("div", { class: "noData" }, index.h("img", { src: warningSrc, alt: "Warning" }), index.h("span", null, Localization.translate('noData', this.language)))), index.h("div", { key: '50710657788295389a20d59e0092dd033e428268', class: "pagination" }, index.h("button", { key: 'cd29c880eab413a06666dc12c8df38d3ffdcfe2f', onClick: () => this.prev() }, '<'), index.h("button", { key: 'df351ecd4237433a8ab38766669ac48d2548ed6a', onClick: () => this.next() }, '>')))));
329
277
  }
330
- catch (ex) {
331
- console.error(`Failed to load client styles ${this.clientStylingUrl}`, ex);
278
+ async loadTransactions() {
279
+ this.showLoader = true;
280
+ try {
281
+ const url = `${this.endpoint}/v1/player/${this.userId}/transactions/banking?${this.getParams()}`;
282
+ const response = await fetch(url, {
283
+ headers: {
284
+ 'X-Sessionid': this.session,
285
+ 'Content-Type': 'application/json'
286
+ }
287
+ });
288
+ if (!response.ok) {
289
+ const err = await response.text();
290
+ throw new Error(err);
291
+ }
292
+ const data = await response.json();
293
+ this.pagination = data.pagination;
294
+ this.transactions = data.transactions;
295
+ }
296
+ catch (ex) {
297
+ console.error(ex);
298
+ }
299
+ finally {
300
+ this.showLoader = false;
301
+ }
302
+ }
303
+ getParams() {
304
+ var _a, _b;
305
+ const now = new Date();
306
+ const offset = (this.page * this.pageSize).toString();
307
+ const startDate = (_a = this.from) !== null && _a !== void 0 ? _a : new Date(now.getFullYear(), now.getMonth(), 1).toISOString();
308
+ const endDate = (_b = this.to) !== null && _b !== void 0 ? _b : new Date(now.getFullYear(), now.getMonth() + 1, 0).toISOString();
309
+ return `offset=${offset}&endDate=${endDate}&startDate=${startDate}&type=${this.type}&limit=${this.pageSize}`;
310
+ }
311
+ setStyles(styles) {
312
+ const cssFile = document.createElement('style');
313
+ cssFile.innerHTML = styles;
314
+ this.stylingContainer.prepend(cssFile);
315
+ }
316
+ async setClientStylingByURL() {
317
+ try {
318
+ const response = await fetch(this.clientStylingUrl);
319
+ if (!response.ok) {
320
+ const err = await response.text();
321
+ throw new Error(err);
322
+ }
323
+ const styles = await response.text();
324
+ this.setStyles(styles);
325
+ }
326
+ catch (ex) {
327
+ console.error(`Failed to load client styles ${this.clientStylingUrl}`, ex);
328
+ }
332
329
  }
333
- }
334
- static get assetsDirs() { return ["../assets"]; }
335
- get el() { return index.getElement(this); }
336
- static get watchers() { return {
337
- "page": ["watchMultiple"],
338
- "type": ["watchMultiple"],
339
- "session": ["watchMultiple"],
340
- "userId": ["watchMultiple"],
341
- "pageSize": ["watchMultiple"],
342
- "showMobileFilter": ["getComponentHeight"]
343
- }; }
330
+ static get assetsDirs() { return ["../assets"]; }
331
+ get el() { return index.getElement(this); }
332
+ static get watchers() { return {
333
+ "page": ["watchMultiple"],
334
+ "type": ["watchMultiple"],
335
+ "session": ["watchMultiple"],
336
+ "userId": ["watchMultiple"],
337
+ "pageSize": ["watchMultiple"],
338
+ "showMobileFilter": ["getComponentHeight"]
339
+ }; }
344
340
  };
345
- UserTransactionHistory.style = userTransactionHistoryCss;
341
+ UserTransactionHistory.style = UserTransactionHistoryStyle0;
346
342
 
347
343
  exports.user_transaction_history = UserTransactionHistory;