@everymatrix/user-transaction-history 1.0.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-4699d9a2.js +1382 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +15 -0
- package/dist/cjs/user-transaction-history.cjs.entry.js +343 -0
- package/dist/cjs/user-transaction-history.cjs.js +25 -0
- package/dist/collection/assets/filter.svg +4 -0
- package/dist/collection/assets/warning.svg +4 -0
- package/dist/collection/collection-manifest.json +12 -0
- package/dist/collection/components/internal/filters.js +13 -0
- package/dist/collection/components/internal/loader.js +2 -0
- package/dist/collection/components/internal/page-size.js +5 -0
- package/dist/collection/components/internal/table.js +20 -0
- package/dist/collection/components/internal/transaction.js +4 -0
- package/dist/collection/components/user-transaction-history/index.js +1 -0
- package/dist/collection/components/user-transaction-history/user-transaction-history.css +406 -0
- package/dist/collection/components/user-transaction-history/user-transaction-history.js +348 -0
- package/dist/collection/contracts/translation.js +1 -0
- package/dist/collection/global/app.js +1 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/models/transactions-response.model.js +1 -0
- package/dist/collection/utils/currency.utils.js +18 -0
- package/dist/collection/utils/date.util.js +8 -0
- package/dist/collection/utils/locale.util.js +69 -0
- package/dist/collection/utils/utils.js +3 -0
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-b111cb50.js +1353 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/user-transaction-history.entry.js +339 -0
- package/dist/esm/user-transaction-history.js +20 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +17 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/user-transaction-history/.stencil/packages/stencil/user-transaction-history/stencil.config.d.ts +2 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/user-transaction-history/.stencil/packages/stencil/user-transaction-history/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/internal/filters.d.ts +8 -0
- package/dist/types/components/internal/loader.d.ts +2 -0
- package/dist/types/components/internal/page-size.d.ts +9 -0
- package/dist/types/components/internal/table.d.ts +7 -0
- package/dist/types/components/internal/transaction.d.ts +3 -0
- package/dist/types/components/user-transaction-history/index.d.ts +1 -0
- package/dist/types/components/user-transaction-history/user-transaction-history.d.ts +40 -0
- package/dist/types/components.d.ts +53 -0
- package/dist/types/contracts/translation.d.ts +2 -0
- package/dist/types/global/app.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/models/transactions-response.model.d.ts +23 -0
- package/dist/types/stencil-public-runtime.d.ts +1674 -0
- package/dist/types/utils/currency.utils.d.ts +4 -0
- package/dist/types/utils/date.util.d.ts +4 -0
- package/dist/types/utils/locale.util.d.ts +42 -0
- package/dist/types/utils/utils.d.ts +1 -0
- package/dist/user-transaction-history/index.esm.js +0 -0
- package/dist/user-transaction-history/p-57173b50.js +2 -0
- package/dist/user-transaction-history/p-e1255160.js +1 -0
- package/dist/user-transaction-history/p-e43630ee.entry.js +1 -0
- package/dist/user-transaction-history/user-transaction-history.esm.js +1 -0
- package/loader/cdn.js +1 -0
- package/loader/index.cjs.js +1 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +1 -0
- package/loader/index.js +2 -0
- package/loader/package.json +11 -0
- package/package.json +26 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-4699d9a2.js');
|
|
6
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
|
+
|
|
8
|
+
const defineCustomElements = async (win, options) => {
|
|
9
|
+
if (typeof window === 'undefined') return undefined;
|
|
10
|
+
await appGlobals.globalScripts();
|
|
11
|
+
return index.bootstrapLazy([["user-transaction-history.cjs",[[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"]}]]]], options);
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
exports.setNonce = index.setNonce;
|
|
15
|
+
exports.defineCustomElements = defineCustomElements;
|
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-4699d9a2.js');
|
|
6
|
+
|
|
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
|
+
}
|
|
36
|
+
};
|
|
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);
|
|
52
|
+
}
|
|
53
|
+
catch (ex) {
|
|
54
|
+
console.error(`Failed to load translations ${translationUrl}. ${ex.message}`);
|
|
55
|
+
}
|
|
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
|
+
}
|
|
73
|
+
Localization.defaultLanguage = 'en';
|
|
74
|
+
Localization.supportedLanguages = ['en'];
|
|
75
|
+
Localization.defaultTranslation = DEFAULT_TRANSLATIONS;
|
|
76
|
+
|
|
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)));
|
|
90
|
+
|
|
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
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
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.
|
|
114
|
+
}
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
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
|
+
" ")));
|
|
130
|
+
|
|
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)))));
|
|
135
|
+
};
|
|
136
|
+
|
|
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)))));
|
|
156
|
+
};
|
|
157
|
+
|
|
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)))))));
|
|
184
|
+
};
|
|
185
|
+
|
|
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:999}.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;
|
|
188
|
+
|
|
189
|
+
const UserTransactionHistory = class {
|
|
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;
|
|
211
|
+
}
|
|
212
|
+
watchMultiple() {
|
|
213
|
+
this.loadTransactions();
|
|
214
|
+
}
|
|
215
|
+
async componentWillLoad() {
|
|
216
|
+
if (this.translationUrl) {
|
|
217
|
+
await Localization.loadCustomTranslations(this.translationUrl);
|
|
218
|
+
}
|
|
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;
|
|
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
|
+
}
|
|
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;
|
|
254
|
+
}
|
|
255
|
+
this.page--;
|
|
256
|
+
}
|
|
257
|
+
next() {
|
|
258
|
+
var _a;
|
|
259
|
+
if (!((_a = this.pagination) === null || _a === void 0 ? void 0 : _a.next)) {
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
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 = 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() }, '>')))));
|
|
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'
|
|
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
|
+
}
|
|
329
|
+
}
|
|
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
|
+
}; }
|
|
340
|
+
};
|
|
341
|
+
UserTransactionHistory.style = UserTransactionHistoryStyle0;
|
|
342
|
+
|
|
343
|
+
exports.user_transaction_history = UserTransactionHistory;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
const index = require('./index-4699d9a2.js');
|
|
6
|
+
const appGlobals = require('./app-globals-3a1e7e63.js');
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
Stencil Client Patch Browser v4.20.0 | MIT Licensed | https://stenciljs.com
|
|
10
|
+
*/
|
|
11
|
+
var patchBrowser = () => {
|
|
12
|
+
const importMeta = (typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('user-transaction-history.cjs.js', document.baseURI).href));
|
|
13
|
+
const opts = {};
|
|
14
|
+
if (importMeta !== "") {
|
|
15
|
+
opts.resourcesUrl = new URL(".", importMeta).href;
|
|
16
|
+
}
|
|
17
|
+
return index.promiseResolve(opts);
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
patchBrowser().then(async (options) => {
|
|
21
|
+
await appGlobals.globalScripts();
|
|
22
|
+
return index.bootstrapLazy([["user-transaction-history.cjs",[[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"]}]]]], options);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
exports.setNonce = index.setNonce;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg viewBox="0 0 48 48" id="filter" width="48" height="48"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path d="M4 10h7.09a6 6 0 0 0 11.82 0H44a1 1 0 0 0 0-2H22.91A6 6 0 0 0 11.09 8H4a1 1 0 0 0 0 2zM17 5a4 4 0 1 1-4 4A4 4 0 0 1 17 5zM44 23H36.91a6 6 0 0 0-11.82 0H4a1 1 0 0 0 0 2H25.09a6 6 0 0 0 11.82 0H44a1 1 0 0 0 0-2zM31 28a4 4 0 1 1 4-4A4 4 0 0 1 31 28zM44 38H22.91a6 6 0 0 0-11.82 0H4a1 1 0 0 0 0 2h7.09a6 6 0 0 0 11.82 0H44a1 1 0 0 0 0-2zM17 43a4 4 0 1 1 4-4A4 4 0 0 1 17 43z" data-name="Layer 15"></path>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { Localization } from "../../utils/locale.util";
|
|
3
|
+
export const Filters = ({ from, to, applyFilters, language }) => {
|
|
4
|
+
let fromPicker;
|
|
5
|
+
let toPicker;
|
|
6
|
+
const fromChange = () => {
|
|
7
|
+
from = fromPicker.value;
|
|
8
|
+
};
|
|
9
|
+
const toChange = () => {
|
|
10
|
+
to = toPicker.value;
|
|
11
|
+
};
|
|
12
|
+
return (h("div", { class: "period" }, h("div", { class: "period-content" }, h("div", { class: "date-input" }, h("vaadin-date-picker", { value: from, ref: el => (fromPicker = el), label: Localization.translate('from', language), onChange: fromChange })), h("span", null, h("svg", { width: "24px", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg" }, 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' }))), h("div", { class: "date-input" }, h("vaadin-date-picker", { value: to, ref: el => (toPicker = el), label: Localization.translate('to', language), onChange: toChange })), h("button", { class: "filter-btn", onClick: () => applyFilters(from, to) }, Localization.translate('filter', language)))));
|
|
13
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
export const Loader = () => (h("div", { class: "loader" }, h("div", null), h("div", null), h("div", null), h("div", null), h("div", null), h("div", null), h("div", null), h("div", null), h("div", null), h("div", null), h("div", null), h("div", null)));
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { Localization } from "../../utils/locale.util";
|
|
3
|
+
export const PageSize = (props) => {
|
|
4
|
+
return (h("div", { class: "page-size" }, h("span", null, Localization.translate('show', props.language)), props.pageSizes.map(pageSize => (h("button", { class: props.currentPageSize === pageSize ? 'active' : '', onClick: () => props.changePageSize(pageSize) }, pageSize)))));
|
|
5
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { CurrencyFormatter } from "../../utils/currency.utils";
|
|
3
|
+
import { DateTransformer } from "../../utils/date.util";
|
|
4
|
+
import { Localization } from "../../utils/locale.util";
|
|
5
|
+
export const TableComponent = ({ source, language }) => {
|
|
6
|
+
const columns = [
|
|
7
|
+
{ name: Localization.translate('transactionId', language) },
|
|
8
|
+
{
|
|
9
|
+
name: Localization.translate('date', language),
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
name: Localization.translate('amount', language),
|
|
13
|
+
},
|
|
14
|
+
{ name: Localization.translate('productType', language) },
|
|
15
|
+
{
|
|
16
|
+
name: Localization.translate('status', language),
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
return (h("table", null, h("thead", null, h("tr", null, columns.map(column => h("th", null, column.name)))), h("tbody", null, source.map(transaction => h("tr", null, h("td", null, transaction.transId), h("td", null, DateTransformer.dateToFormatedString(new Date(transaction.created))), h("td", null, CurrencyFormatter.format(transaction.currency, transaction.realAmount), " "), h("td", null, transaction.productType), h("td", null, h("span", { class: transaction.status.toLowerCase() }, transaction.status)))))));
|
|
20
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { DateTransformer } from "../../utils/date.util";
|
|
3
|
+
import { CurrencyFormatter } from "../../utils/currency.utils";
|
|
4
|
+
export const TransactionComponent = (transaction) => (h("div", { class: "data-transaction" }, h("p", null, transaction.productType), h("p", { class: "text-style text-style-status" }, h("span", { class: transaction.status.toLowerCase() }, transaction.status)), h("p", { class: "date" }, transaction.transId, " | ", DateTransformer.dateToFormatedString(new Date(transaction.created))), h("p", { class: "text-style" }, CurrencyFormatter.format(transaction.currency, transaction.realAmount), " ")));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { UserTransactionHistory } from './user-transaction-history';
|