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