@everymatrix/user-transaction-history 1.13.11
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/index-206e75cb.js +1416 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +21 -0
- package/dist/cjs/user-transaction-history.cjs.entry.js +333 -0
- package/dist/cjs/user-transaction-history.cjs.js +19 -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 +22 -0
- package/dist/collection/components/internal/loader.js +14 -0
- package/dist/collection/components/internal/page-size.js +7 -0
- package/dist/collection/components/internal/table.js +31 -0
- package/dist/collection/components/internal/transaction.js +14 -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 +357 -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 +55 -0
- package/dist/components/index.d.ts +26 -0
- package/dist/components/index.js +1 -0
- package/dist/components/user-transaction-history.d.ts +11 -0
- package/dist/components/user-transaction-history.js +364 -0
- package/dist/esm/index-32e3ae05.js +1388 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +17 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/css-shim.js +1 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm/user-transaction-history.entry.js +329 -0
- package/dist/esm/user-transaction-history.js +17 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/stencil.config.js +22 -0
- package/dist/types/Users/adrian.pripon/Documents/Work/stencil/widgets-stencil/packages/user-transaction-history/.stencil/packages/user-transaction-history/stencil.config.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/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 +1565 -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 +28 -0
- package/dist/user-transaction-history/index.esm.js +0 -0
- package/dist/user-transaction-history/p-10b5b959.js +1 -0
- package/dist/user-transaction-history/p-8e086032.entry.js +1 -0
- package/dist/user-transaction-history/user-transaction-history.esm.js +1 -0
- package/loader/cdn.js +3 -0
- package/loader/index.cjs.js +3 -0
- package/loader/index.d.ts +12 -0
- package/loader/index.es2017.js +3 -0
- package/loader/index.js +4 -0
- package/loader/package.json +10 -0
- package/package.json +19 -0
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
import { Localization } from '../../utils/locale.util';
|
|
2
|
+
import { Component, Host, Prop, State, h, Element, Watch, Listen, getAssetPath } from '@stencil/core';
|
|
3
|
+
import { Loader } from '../internal/loader';
|
|
4
|
+
import { TransactionComponent } from '../internal/transaction';
|
|
5
|
+
import { PageSize } from '../internal/page-size';
|
|
6
|
+
import { Filters } from '../internal/filters';
|
|
7
|
+
import { TableComponent } from '../internal/table';
|
|
8
|
+
export class TransactionHistoryWidget {
|
|
9
|
+
constructor() {
|
|
10
|
+
this.pageSizes = [10, 25, 50];
|
|
11
|
+
this.pagination = null;
|
|
12
|
+
this.stylingAppended = false;
|
|
13
|
+
/*
|
|
14
|
+
* Language of the application.
|
|
15
|
+
*/
|
|
16
|
+
this.language = Localization.defaultLanguage;
|
|
17
|
+
/*
|
|
18
|
+
* Is mobile mode on. Default value `false`.
|
|
19
|
+
*/
|
|
20
|
+
this.mobile = false;
|
|
21
|
+
/*
|
|
22
|
+
* Client styling via inline styles.
|
|
23
|
+
*/
|
|
24
|
+
this.clientStyling = null;
|
|
25
|
+
/*
|
|
26
|
+
* The path to file with styles in `css` format.
|
|
27
|
+
*/
|
|
28
|
+
this.clientStylingUrl = null;
|
|
29
|
+
this.page = 0;
|
|
30
|
+
this.pageSize = this.pageSizes[0];
|
|
31
|
+
this.showMobileFilter = false;
|
|
32
|
+
this.type = '0';
|
|
33
|
+
this.showLoader = true;
|
|
34
|
+
}
|
|
35
|
+
watchMultiple() {
|
|
36
|
+
this.loadTransactions();
|
|
37
|
+
}
|
|
38
|
+
async componentWillLoad() {
|
|
39
|
+
if (this.translationUrl) {
|
|
40
|
+
await Localization.loadCustomTranslations(this.translationUrl);
|
|
41
|
+
}
|
|
42
|
+
this.loadTransactions();
|
|
43
|
+
}
|
|
44
|
+
componentDidRender() {
|
|
45
|
+
this.getComponentHeight();
|
|
46
|
+
if (!this.stylingAppended && this.stylingContainer) {
|
|
47
|
+
if (this.clientStyling) {
|
|
48
|
+
this.setStyles(this.clientStyling);
|
|
49
|
+
}
|
|
50
|
+
if (this.clientStylingUrl) {
|
|
51
|
+
this.setClientStylingByURL();
|
|
52
|
+
}
|
|
53
|
+
this.stylingAppended = true;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
getComponentHeight() {
|
|
57
|
+
var _a;
|
|
58
|
+
if (this.mobile) {
|
|
59
|
+
let height = this.el.getBoundingClientRect().height - ((_a = this.el.shadowRoot.querySelector('.table')) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().y);
|
|
60
|
+
this.el.style.setProperty('--heightScrollableContainer', height + 'px');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
setHeightTableProperty() {
|
|
64
|
+
let height = this.getComponentHeight();
|
|
65
|
+
this.el.style.setProperty('--heightScrollableContainer', height + 'px');
|
|
66
|
+
}
|
|
67
|
+
changeTransactionsType(type) {
|
|
68
|
+
this.type = type;
|
|
69
|
+
}
|
|
70
|
+
changePageSize(pageSize) {
|
|
71
|
+
this.pageSize = pageSize;
|
|
72
|
+
}
|
|
73
|
+
prev() {
|
|
74
|
+
var _a;
|
|
75
|
+
if (!((_a = this.pagination) === null || _a === void 0 ? void 0 : _a.previous)) {
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
this.page--;
|
|
79
|
+
}
|
|
80
|
+
next() {
|
|
81
|
+
var _a;
|
|
82
|
+
if (!((_a = this.pagination) === null || _a === void 0 ? void 0 : _a.next)) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
this.page++;
|
|
86
|
+
}
|
|
87
|
+
applyFilters(from, to) {
|
|
88
|
+
this.from = from ? new Date(from).toISOString() : null;
|
|
89
|
+
this.to = to ? new Date(to).toISOString() : null;
|
|
90
|
+
this.loadTransactions();
|
|
91
|
+
}
|
|
92
|
+
showFilter() {
|
|
93
|
+
this.showMobileFilter = !this.showMobileFilter;
|
|
94
|
+
}
|
|
95
|
+
render() {
|
|
96
|
+
var _a;
|
|
97
|
+
const filterSrc = getAssetPath('../assets/filter.svg');
|
|
98
|
+
const warningSrc = getAssetPath('../assets/warning.svg');
|
|
99
|
+
return (h(Host, null,
|
|
100
|
+
this.showLoader ? h(Loader, null) : '',
|
|
101
|
+
h("div", { class: "wrapper", ref: el => (this.stylingContainer = el) },
|
|
102
|
+
h("div", { class: { 'types types-mobile': this.mobile, 'types types-desktop': !this.mobile } },
|
|
103
|
+
h("button", { class: 'transaction-type' + ' ' + (this.type === '0' ? 'clicked' : ''), onClick: () => this.changeTransactionsType('0') }, Localization.translate('deposit', this.language)),
|
|
104
|
+
h("button", { class: 'transaction-type' + ' ' + (this.type === '1' ? 'clicked' : ''), onClick: () => this.changeTransactionsType('1') }, Localization.translate('withdrawals', this.language))),
|
|
105
|
+
!this.mobile ? h(PageSize, { language: this.language, pageSizes: this.pageSizes, currentPageSize: this.pageSize, changePageSize: s => this.changePageSize(s) }) : '',
|
|
106
|
+
this.mobile ? (h("button", { class: "mobile-filter-button", onClick: () => this.showFilter() },
|
|
107
|
+
h("img", { src: filterSrc, alt: "Filter" }),
|
|
108
|
+
Localization.translate('filter', this.language))) : (''),
|
|
109
|
+
!this.mobile || (this.showMobileFilter && this.mobile) ? h(Filters, { language: this.language, applyFilters: (from, to) => this.applyFilters(from, to) }) : '',
|
|
110
|
+
((_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" },
|
|
111
|
+
h("img", { src: warningSrc, alt: "Warning" }),
|
|
112
|
+
h("span", null, Localization.translate('noData', this.language)))),
|
|
113
|
+
h("div", { class: "pagination" },
|
|
114
|
+
h("button", { onClick: () => this.prev() }, '<'),
|
|
115
|
+
h("button", { onClick: () => this.next() }, '>')))));
|
|
116
|
+
}
|
|
117
|
+
async loadTransactions() {
|
|
118
|
+
this.showLoader = true;
|
|
119
|
+
try {
|
|
120
|
+
const url = `${this.endpoint}/v1/player/${this.userId}/transactions/banking?${this.getParams()}`;
|
|
121
|
+
const response = await fetch(url, {
|
|
122
|
+
headers: {
|
|
123
|
+
'X-Sessionid': this.session,
|
|
124
|
+
'Content-Type': 'application/json'
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
if (!response.ok) {
|
|
128
|
+
const err = await response.text();
|
|
129
|
+
throw new Error(err);
|
|
130
|
+
}
|
|
131
|
+
const data = await response.json();
|
|
132
|
+
this.pagination = data.pagination;
|
|
133
|
+
this.transactions = data.transactions;
|
|
134
|
+
}
|
|
135
|
+
catch (ex) {
|
|
136
|
+
console.error(ex);
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
this.showLoader = false;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
getParams() {
|
|
143
|
+
var _a, _b;
|
|
144
|
+
const now = new Date();
|
|
145
|
+
const offset = (this.page * this.pageSize).toString();
|
|
146
|
+
const startDate = (_a = this.from) !== null && _a !== void 0 ? _a : new Date(now.getFullYear(), now.getMonth(), 1).toISOString();
|
|
147
|
+
const endDate = (_b = this.to) !== null && _b !== void 0 ? _b : new Date(now.getFullYear(), now.getMonth() + 1, 0).toISOString();
|
|
148
|
+
return `offset=${offset}&endDate=${endDate}&startDate=${startDate}&type=${this.type}&limit=${this.pageSize}`;
|
|
149
|
+
}
|
|
150
|
+
setStyles(styles) {
|
|
151
|
+
const cssFile = document.createElement('style');
|
|
152
|
+
cssFile.innerHTML = styles;
|
|
153
|
+
this.stylingContainer.prepend(cssFile);
|
|
154
|
+
}
|
|
155
|
+
async setClientStylingByURL() {
|
|
156
|
+
try {
|
|
157
|
+
const response = await fetch(this.clientStylingUrl);
|
|
158
|
+
if (!response.ok) {
|
|
159
|
+
const err = await response.text();
|
|
160
|
+
throw new Error(err);
|
|
161
|
+
}
|
|
162
|
+
const styles = await response.text();
|
|
163
|
+
this.setStyles(styles);
|
|
164
|
+
}
|
|
165
|
+
catch (ex) {
|
|
166
|
+
console.error(`Failed to load client styles ${this.clientStylingUrl}`, ex);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
static get is() { return "user-transaction-history"; }
|
|
170
|
+
static get encapsulation() { return "shadow"; }
|
|
171
|
+
static get originalStyleUrls() { return {
|
|
172
|
+
"$": ["user-transaction-history.scss"]
|
|
173
|
+
}; }
|
|
174
|
+
static get styleUrls() { return {
|
|
175
|
+
"$": ["user-transaction-history.css"]
|
|
176
|
+
}; }
|
|
177
|
+
static get assetsDirs() { return ["../assets"]; }
|
|
178
|
+
static get properties() { return {
|
|
179
|
+
"endpoint": {
|
|
180
|
+
"type": "string",
|
|
181
|
+
"mutable": false,
|
|
182
|
+
"complexType": {
|
|
183
|
+
"original": "string | null",
|
|
184
|
+
"resolved": "string",
|
|
185
|
+
"references": {}
|
|
186
|
+
},
|
|
187
|
+
"required": false,
|
|
188
|
+
"optional": false,
|
|
189
|
+
"docs": {
|
|
190
|
+
"tags": [],
|
|
191
|
+
"text": ""
|
|
192
|
+
},
|
|
193
|
+
"attribute": "endpoint",
|
|
194
|
+
"reflect": true
|
|
195
|
+
},
|
|
196
|
+
"session": {
|
|
197
|
+
"type": "string",
|
|
198
|
+
"mutable": false,
|
|
199
|
+
"complexType": {
|
|
200
|
+
"original": "string",
|
|
201
|
+
"resolved": "string",
|
|
202
|
+
"references": {}
|
|
203
|
+
},
|
|
204
|
+
"required": false,
|
|
205
|
+
"optional": false,
|
|
206
|
+
"docs": {
|
|
207
|
+
"tags": [],
|
|
208
|
+
"text": ""
|
|
209
|
+
},
|
|
210
|
+
"attribute": "session",
|
|
211
|
+
"reflect": true
|
|
212
|
+
},
|
|
213
|
+
"language": {
|
|
214
|
+
"type": "string",
|
|
215
|
+
"mutable": false,
|
|
216
|
+
"complexType": {
|
|
217
|
+
"original": "string",
|
|
218
|
+
"resolved": "string",
|
|
219
|
+
"references": {}
|
|
220
|
+
},
|
|
221
|
+
"required": false,
|
|
222
|
+
"optional": false,
|
|
223
|
+
"docs": {
|
|
224
|
+
"tags": [],
|
|
225
|
+
"text": ""
|
|
226
|
+
},
|
|
227
|
+
"attribute": "language",
|
|
228
|
+
"reflect": true,
|
|
229
|
+
"defaultValue": "Localization.defaultLanguage"
|
|
230
|
+
},
|
|
231
|
+
"userId": {
|
|
232
|
+
"type": "string",
|
|
233
|
+
"mutable": false,
|
|
234
|
+
"complexType": {
|
|
235
|
+
"original": "string",
|
|
236
|
+
"resolved": "string",
|
|
237
|
+
"references": {}
|
|
238
|
+
},
|
|
239
|
+
"required": false,
|
|
240
|
+
"optional": false,
|
|
241
|
+
"docs": {
|
|
242
|
+
"tags": [],
|
|
243
|
+
"text": ""
|
|
244
|
+
},
|
|
245
|
+
"attribute": "user-id",
|
|
246
|
+
"reflect": true
|
|
247
|
+
},
|
|
248
|
+
"translationUrl": {
|
|
249
|
+
"type": "string",
|
|
250
|
+
"mutable": false,
|
|
251
|
+
"complexType": {
|
|
252
|
+
"original": "string",
|
|
253
|
+
"resolved": "string",
|
|
254
|
+
"references": {}
|
|
255
|
+
},
|
|
256
|
+
"required": false,
|
|
257
|
+
"optional": false,
|
|
258
|
+
"docs": {
|
|
259
|
+
"tags": [],
|
|
260
|
+
"text": ""
|
|
261
|
+
},
|
|
262
|
+
"attribute": "translation-url",
|
|
263
|
+
"reflect": true
|
|
264
|
+
},
|
|
265
|
+
"mobile": {
|
|
266
|
+
"type": "boolean",
|
|
267
|
+
"mutable": false,
|
|
268
|
+
"complexType": {
|
|
269
|
+
"original": "boolean",
|
|
270
|
+
"resolved": "boolean",
|
|
271
|
+
"references": {}
|
|
272
|
+
},
|
|
273
|
+
"required": false,
|
|
274
|
+
"optional": false,
|
|
275
|
+
"docs": {
|
|
276
|
+
"tags": [],
|
|
277
|
+
"text": ""
|
|
278
|
+
},
|
|
279
|
+
"attribute": "mobile",
|
|
280
|
+
"reflect": true,
|
|
281
|
+
"defaultValue": "false"
|
|
282
|
+
},
|
|
283
|
+
"clientStyling": {
|
|
284
|
+
"type": "string",
|
|
285
|
+
"mutable": false,
|
|
286
|
+
"complexType": {
|
|
287
|
+
"original": "string | null",
|
|
288
|
+
"resolved": "string",
|
|
289
|
+
"references": {}
|
|
290
|
+
},
|
|
291
|
+
"required": false,
|
|
292
|
+
"optional": false,
|
|
293
|
+
"docs": {
|
|
294
|
+
"tags": [],
|
|
295
|
+
"text": ""
|
|
296
|
+
},
|
|
297
|
+
"attribute": "client-styling",
|
|
298
|
+
"reflect": true,
|
|
299
|
+
"defaultValue": "null"
|
|
300
|
+
},
|
|
301
|
+
"clientStylingUrl": {
|
|
302
|
+
"type": "string",
|
|
303
|
+
"mutable": false,
|
|
304
|
+
"complexType": {
|
|
305
|
+
"original": "string | null",
|
|
306
|
+
"resolved": "string",
|
|
307
|
+
"references": {}
|
|
308
|
+
},
|
|
309
|
+
"required": false,
|
|
310
|
+
"optional": false,
|
|
311
|
+
"docs": {
|
|
312
|
+
"tags": [],
|
|
313
|
+
"text": ""
|
|
314
|
+
},
|
|
315
|
+
"attribute": "client-styling-url",
|
|
316
|
+
"reflect": true,
|
|
317
|
+
"defaultValue": "null"
|
|
318
|
+
}
|
|
319
|
+
}; }
|
|
320
|
+
static get states() { return {
|
|
321
|
+
"page": {},
|
|
322
|
+
"pageSize": {},
|
|
323
|
+
"showMobileFilter": {},
|
|
324
|
+
"to": {},
|
|
325
|
+
"from": {},
|
|
326
|
+
"type": {},
|
|
327
|
+
"transactions": {},
|
|
328
|
+
"showLoader": {}
|
|
329
|
+
}; }
|
|
330
|
+
static get elementRef() { return "el"; }
|
|
331
|
+
static get watchers() { return [{
|
|
332
|
+
"propName": "page",
|
|
333
|
+
"methodName": "watchMultiple"
|
|
334
|
+
}, {
|
|
335
|
+
"propName": "type",
|
|
336
|
+
"methodName": "watchMultiple"
|
|
337
|
+
}, {
|
|
338
|
+
"propName": "session",
|
|
339
|
+
"methodName": "watchMultiple"
|
|
340
|
+
}, {
|
|
341
|
+
"propName": "userId",
|
|
342
|
+
"methodName": "watchMultiple"
|
|
343
|
+
}, {
|
|
344
|
+
"propName": "pageSize",
|
|
345
|
+
"methodName": "watchMultiple"
|
|
346
|
+
}, {
|
|
347
|
+
"propName": "showMobileFilter",
|
|
348
|
+
"methodName": "getComponentHeight"
|
|
349
|
+
}]; }
|
|
350
|
+
static get listeners() { return [{
|
|
351
|
+
"name": "resize",
|
|
352
|
+
"method": "getComponentHeight",
|
|
353
|
+
"target": "window",
|
|
354
|
+
"capture": false,
|
|
355
|
+
"passive": true
|
|
356
|
+
}]; }
|
|
357
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import '@vaadin/date-picker/theme/lumo/vaadin-date-picker.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './components';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export class CurrencyFormatter {
|
|
2
|
+
constructor() { }
|
|
3
|
+
static format(currency, value) {
|
|
4
|
+
let result = `${value} ${currency}`;
|
|
5
|
+
try {
|
|
6
|
+
const formatter = new Intl.NumberFormat('en-US', {
|
|
7
|
+
style: 'currency',
|
|
8
|
+
currency: currency,
|
|
9
|
+
});
|
|
10
|
+
result = formatter.format(value);
|
|
11
|
+
}
|
|
12
|
+
catch (_a) {
|
|
13
|
+
// If we here formatter do not support that currency.
|
|
14
|
+
// Just ignore that and use the currency name instead of it symbol.
|
|
15
|
+
}
|
|
16
|
+
return result;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export class DateTransformer {
|
|
2
|
+
constructor() { }
|
|
3
|
+
static dateToFormatedString(date) {
|
|
4
|
+
const dateStr = date.toLocaleDateString('en-gb');
|
|
5
|
+
const timeStr = date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
|
|
6
|
+
return `${dateStr}, ${timeStr}`;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export const DEFAULT_TRANSLATIONS = {
|
|
2
|
+
"en": {
|
|
3
|
+
"deposit": "Deposit",
|
|
4
|
+
"withdrawals": "Withdrawals",
|
|
5
|
+
"show": "Show",
|
|
6
|
+
"from": "From",
|
|
7
|
+
"to": "To",
|
|
8
|
+
"filter": "Filter",
|
|
9
|
+
"transactionId": "Transaction ID",
|
|
10
|
+
"date": "Date",
|
|
11
|
+
"amount": "Amount",
|
|
12
|
+
"productType": "Product Type",
|
|
13
|
+
"status": "Status",
|
|
14
|
+
"noData": "There are no account activities"
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export class Localization {
|
|
18
|
+
constructor() { }
|
|
19
|
+
static async loadCustomTranslations(translationUrl) {
|
|
20
|
+
try {
|
|
21
|
+
const response = await fetch(translationUrl, {
|
|
22
|
+
headers: {
|
|
23
|
+
'Content-Type': 'application/json',
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
const err = await response.text();
|
|
28
|
+
throw new Error(err);
|
|
29
|
+
}
|
|
30
|
+
const translations = await response.json();
|
|
31
|
+
Localization.updateTranslations(translations);
|
|
32
|
+
}
|
|
33
|
+
catch (ex) {
|
|
34
|
+
console.error(`Failed to load translations ${translationUrl}. ${ex.message}`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
static translate(key, locale) {
|
|
38
|
+
var _a, _b;
|
|
39
|
+
const avaliableLocales = Localization.getAvaliableLanguages(locale);
|
|
40
|
+
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];
|
|
41
|
+
}
|
|
42
|
+
static getAvaliableLanguages(locale) {
|
|
43
|
+
var _a;
|
|
44
|
+
const customLanguage = ((_a = Localization.customLanguages) === null || _a === void 0 ? void 0 : _a.includes(locale)) ? locale : Localization.defaultLanguage;
|
|
45
|
+
const predefinedLanguage = Localization.supportedLanguages.includes(locale) ? locale : Localization.defaultLanguage;
|
|
46
|
+
return { predefinedLanguage, customLanguage };
|
|
47
|
+
}
|
|
48
|
+
static updateTranslations(translations) {
|
|
49
|
+
Localization.customLanguages = Array.from(new Set([...Localization.supportedLanguages, ...Object.keys(translations).map(k => k.toLowerCase())]));
|
|
50
|
+
Localization.customTranslation = translations;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
Localization.defaultLanguage = 'en';
|
|
54
|
+
Localization.supportedLanguages = ['en'];
|
|
55
|
+
Localization.defaultTranslation = DEFAULT_TRANSLATIONS;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/* UserTransactionHistory custom elements */
|
|
2
|
+
|
|
3
|
+
import type { Components, JSX } from "../types/components";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Used to manually set the base path where assets can be found.
|
|
7
|
+
* If the script is used as "module", it's recommended to use "import.meta.url",
|
|
8
|
+
* such as "setAssetPath(import.meta.url)". Other options include
|
|
9
|
+
* "setAssetPath(document.currentScript.src)", or using a bundler's replace plugin to
|
|
10
|
+
* dynamically set the path at build time, such as "setAssetPath(process.env.ASSET_PATH)".
|
|
11
|
+
* But do note that this configuration depends on how your script is bundled, or lack of
|
|
12
|
+
* bundling, and where your assets can be loaded from. Additionally custom bundling
|
|
13
|
+
* will have to ensure the static assets are copied to its build directory.
|
|
14
|
+
*/
|
|
15
|
+
export declare const setAssetPath: (path: string) => void;
|
|
16
|
+
|
|
17
|
+
export interface SetPlatformOptions {
|
|
18
|
+
raf?: (c: FrameRequestCallback) => number;
|
|
19
|
+
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
20
|
+
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
|
|
21
|
+
}
|
|
22
|
+
export declare const setPlatformOptions: (opts: SetPlatformOptions) => void;
|
|
23
|
+
|
|
24
|
+
export type { Components, JSX };
|
|
25
|
+
|
|
26
|
+
export * from '../types';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { setAssetPath, setPlatformOptions } from '@stencil/core/internal/client';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Components, JSX } from "../types/components";
|
|
2
|
+
|
|
3
|
+
interface UserTransactionHistory extends Components.UserTransactionHistory, HTMLElement {}
|
|
4
|
+
export const UserTransactionHistory: {
|
|
5
|
+
prototype: UserTransactionHistory;
|
|
6
|
+
new (): UserTransactionHistory;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Used to define this component and all nested components recursively.
|
|
10
|
+
*/
|
|
11
|
+
export const defineCustomElement: () => void;
|