@everymatrix/user-transaction-history 1.55.0 → 1.56.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 (26) hide show
  1. package/dist/cjs/{index-4252bc97.js → index-cf677425.js} +183 -72
  2. package/dist/cjs/loader.cjs.js +2 -2
  3. package/dist/cjs/user-transaction-history.cjs.entry.js +99 -37
  4. package/dist/cjs/user-transaction-history.cjs.js +3 -3
  5. package/dist/collection/collection-manifest.json +1 -1
  6. package/dist/collection/components/user-transaction-history/user-transaction-history.js +81 -36
  7. package/dist/esm/{index-e8249896.js → index-12dd2b03.js} +183 -72
  8. package/dist/esm/loader.js +3 -3
  9. package/dist/esm/user-transaction-history.entry.js +99 -37
  10. package/dist/esm/user-transaction-history.js +4 -4
  11. 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
  12. 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
  13. package/dist/types/components/user-transaction-history/user-transaction-history.d.ts +6 -3
  14. package/dist/types/components.d.ts +2 -0
  15. package/dist/user-transaction-history/p-71a8cd66.js +2 -0
  16. package/dist/user-transaction-history/p-ce923f40.entry.js +1 -0
  17. package/dist/user-transaction-history/user-transaction-history.esm.js +1 -1
  18. package/package.json +1 -1
  19. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/user-transaction-history/.stencil/packages/stencil/user-transaction-history/stencil.config.d.ts +0 -2
  20. package/dist/types/Users/maria.bumbar/Desktop/widgets-monorepo/packages/stencil/user-transaction-history/.stencil/packages/stencil/user-transaction-history/stencil.config.dev.d.ts +0 -2
  21. package/dist/user-transaction-history/p-380caf32.js +0 -2
  22. package/dist/user-transaction-history/p-7972bcc3.entry.js +0 -1
  23. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/user-transaction-history/.stencil/tools/plugins/index.d.ts +0 -0
  24. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/user-transaction-history/.stencil/tools/plugins/stencil-clean-deps-plugin.d.ts +0 -0
  25. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/user-transaction-history/.stencil/tools/plugins/vite-chunk-plugin.d.ts +0 -0
  26. /package/dist/types/Users/{maria.bumbar/Desktop → adrian.pripon/Documents/Work}/widgets-monorepo/packages/stencil/user-transaction-history/.stencil/tools/plugins/vite-clean-deps-plugin.d.ts +0 -0
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-4252bc97.js');
5
+ const index = require('./index-cf677425.js');
6
6
 
7
7
  const DEFAULT_TRANSLATIONS = {
8
8
  "en": {
@@ -183,6 +183,63 @@ const TableComponent = ({ source, language }) => {
183
183
  index.h("span", { class: transaction.status.toLowerCase() }, transaction.status)))))));
184
184
  };
185
185
 
186
+ /**
187
+ * @name setClientStyling
188
+ * @description Method used to create and append to the passed element of the widget a style element with the content received
189
+ * @param {HTMLElement} stylingContainer The reference element of the widget
190
+ * @param {string} clientStyling The style content
191
+ */
192
+ function setClientStyling(stylingContainer, clientStyling) {
193
+ if (stylingContainer) {
194
+ const sheet = document.createElement('style');
195
+ sheet.innerHTML = clientStyling;
196
+ stylingContainer.appendChild(sheet);
197
+ }
198
+ }
199
+
200
+ /**
201
+ * @name setClientStylingURL
202
+ * @description Method used to create and append to the passed element of the widget a style element with the content fetched from a given URL
203
+ * @param {HTMLElement} stylingContainer The reference element of the widget
204
+ * @param {string} clientStylingUrl The URL of the style content
205
+ */
206
+ function setClientStylingURL(stylingContainer, clientStylingUrl) {
207
+ const url = new URL(clientStylingUrl);
208
+
209
+ fetch(url.href)
210
+ .then((res) => res.text())
211
+ .then((data) => {
212
+ const cssFile = document.createElement('style');
213
+ cssFile.innerHTML = data;
214
+ if (stylingContainer) {
215
+ stylingContainer.appendChild(cssFile);
216
+ }
217
+ })
218
+ .catch((err) => {
219
+ console.error('There was an error while trying to load client styling from URL', err);
220
+ });
221
+ }
222
+
223
+ /**
224
+ * @name setStreamLibrary
225
+ * @description Method used to create and append to the passed element of the widget a style element with content fetched from the MessageBus
226
+ * @param {HTMLElement} stylingContainer The highest element of the widget
227
+ * @param {string} domain The domain from where the content should be fetched (e.g. 'Casino.Style', 'App.Style', 'casino-footer.style', etc.)
228
+ * @param {ref} subscription A reference to a variable where the subscription should be saved for unsubscribing when no longer needed
229
+ */
230
+ function setStreamStyling(stylingContainer, domain, subscription) {
231
+ if (window.emMessageBus) {
232
+ const sheet = document.createElement('style');
233
+
234
+ window.emMessageBus.subscribe(domain, (data) => {
235
+ sheet.innerHTML = data;
236
+ if (stylingContainer) {
237
+ stylingContainer.appendChild(sheet);
238
+ }
239
+ });
240
+ }
241
+ }
242
+
186
243
  const userTransactionHistoryCss = ":host{--activeButtonBackground:#7ec51e;--activeButtonFont:#002149;--hoverBackground:#ffffff;--background:#e4e6e8;--success:#7ac345;--heightScrollableContainer:400px;--borderColor:#d3d3d3;--borderColorButton:#c4c4c4;--textColor:#002554;--textColorHover:#7ac345;--errorColor:#c23b21;--loaderColor:#7ac345;--headerTableBackground:#cdcdcd;--borderTable:#dedede;--shadowBorderTable:#f1f1f1;--backgroundTable:#ffffff;font-family:Roboto, Arial, sans-serif;font-size:14px;color:var(--textColor);display:block;background-color:var(--background)}:host .wrapper{height:100%;padding:1rem}:host .types{display:flex;width:100%;gap:5px}:host .transaction-type{background:inherit;font-weight:600;padding:0.6rem 1.6rem;border:1px solid #6c757d;cursor:pointer}:host .transaction-type:hover{color:var(--activeButtonBackground);border-color:var(--activeButtonBackground);background:var(--hoverBackground)}:host .clicked{background-color:var(--activeButtonBackground);border-color:var(--activeButtonBackground)}:host .types-mobile{justify-content:center;margin-bottom:15px}:host .types-desktop{justify-content:flex-end;margin-bottom:3rem}:host .page-size{display:flex;width:100%;justify-content:flex-end;align-items:center}:host .page-size button{background:transparent;border:none;cursor:pointer;margin:0.4rem;width:2rem;height:2rem}:host .page-size button:hover{color:var(--textColorHover)}:host .page-size button.active{background:var(--activeButtonBackground);color:var(--textColor);font-weight:600;border-radius:0.4rem}:host .period{display:flex;width:100%;align-items:flex-end;justify-content:center;gap:10px;background:#f0f0f0;border-bottom:2px solid #e9e9e9;padding:1.6rem 0 0;margin-bottom:4rem}@media (max-width: 801px){:host .period{margin-bottom:0;flex-direction:column;align-items:stretch;width:auto;padding:1.4rem 2.8rem;box-shadow:0 4px 5px 0 rgba(90, 90, 90, 0.24)}}:host .period .range{color:var(--errorColor)}:host .period .filter-btn{height:40px;background:transparent;border:0.1rem solid var(--borderColorButton);min-width:12rem;max-width:17rem;cursor:pointer}@media (max-width: 801px){:host .period .filter-btn{max-width:none;min-width:none;margin-top:1rem}}:host .period .filter-btn:hover{border:none;background:var(--hoverBackground)}:host .period .duet-date__input{padding:7px 60px 7px 7px}:host .period+button{padding:9px 15px}:host .period-content{display:flex;flex-direction:row;width:100%;justify-content:center;align-items:flex-end;margin:0 auto 1.6rem}@media (max-width: 801px){:host .period-content{flex-direction:column;align-items:stretch}}:host .period-content span{height:40px;display:flex;align-items:center;justify-content:center}@media (max-width: 801px){:host .period-content span{display:none}}:host .period-content .filter-btn{margin-left:60px}@media (max-width: 801px){:host .period-content .filter-btn{margin-left:0}}:host .period-content .date-input{padding:0 4px}@media (max-width: 801px){:host .period-content .date-input{width:auto}:host .period-content .date-input:first-child{margin-bottom:0.5rem}}:host .period-content .date-input label{display:inline-block;margin-bottom:0.9rem}:host .period-content .date-input input{border:0.1rem solid var(--borderColor);box-sizing:border-box;border-radius:0.2rem}:host .pagination{display:flex;width:100%;justify-content:center;margin-top:1.5rem}:host .pagination button{cursor:pointer;border:none;background-color:var(--activeButtonBackground);color:#fff;opacity:0.5;padding:7px 12px}:host .pagination button:hover{opacity:1}:host .pagination button:focus{opacity:1}:host button.active{color:var(--activeButtonFont);background-color:var(--activeButtonBackground)}.mobile-filter-button{display:flex;justify-content:center;align-items:center;width:100%;height:2.8rem;background:inherit;border:1px solid var(--borderColorButton)}.mobile-filter-button img{height:50%;margin-right:0.5rem}.noData{display:flex;align-items:center;box-shadow:0 0.4rem 0.4rem rgba(0, 0, 0, 0.25);padding:1.1rem;border-radius:0.6rem}.noData span{margin-left:0.5rem}.table{height:var(--heightScrollableContainer);overflow-y:auto}.table .mobile-table{height:100%}.data-transaction{border-bottom:1px solid var(--borderColor);background-color:var(--hoverBackground);padding:0 20px;display:grid;grid-template-columns:repeat(2, 1fr)}.data-transaction .text-style-status{font-weight:600}.data-transaction .text-style-status .success{color:var(--success)}.data-transaction .text-style-status .error{color:var(--errorColor)}.data-transaction .text-style{text-align:end}.data-transaction .date{font-size:12px;display:flex;align-items:center}.loader{display:inline-block;position:absolute;width:80px;height:80px;top:calc(50% - 40px);left:calc(50% - 40px);z-index:100}.loader::before{content:\"\";position:fixed;top:0;bottom:0;left:0;right:0;background-color:rgba(255, 255, 255, 0.6)}.loader div{position:absolute;width:6px;height:6px;background:var(--loaderColor);border-radius:50%;animation:loader 1.2s linear infinite}.loader div:nth-child(1){animation-delay:0s;top:37px;left:66px}.loader div:nth-child(2){animation-delay:-0.1s;top:22px;left:62px}.loader div:nth-child(3){animation-delay:-0.2s;top:11px;left:52px}.loader div:nth-child(4){animation-delay:-0.3s;top:7px;left:37px}.loader div:nth-child(5){animation-delay:-0.4s;top:11px;left:22px}.loader div:nth-child(6){animation-delay:-0.5s;top:22px;left:11px}.loader div:nth-child(7){animation-delay:-0.6s;top:37px;left:7px}.loader div:nth-child(8){animation-delay:-0.7s;top:52px;left:11px}.loader div:nth-child(9){animation-delay:-0.8s;top:62px;left:22px}.loader div:nth-child(10){animation-delay:-0.9s;top:66px;left:37px}.loader div:nth-child(11){animation-delay:-1s;top:62px;left:52px}.loader div:nth-child(12){animation-delay:-1.1s;top:52px;left:62px}@keyframes loader{0%,20%,80%,100%{transform:scale(1)}50%{transform:scale(1.5)}}.table thead th{position:sticky;top:0}table{border-collapse:collapse;width:100%}table th{padding:14px 24px;text-align:left;font-weight:600;color:var(--textColor);background:var(--headerTableBackground)}table td{padding:1rem 1.7rem;box-shadow:0 -1px 0 0 var(--shadowBorderTable) inset;border-bottom:0.1rem solid var(--borderTable);text-align:left;color:var(--textColor)}table tbody{background:var(--backgroundTable)}table .success{color:var(--success)}table .error{color:var(--errorColor)}vaadin-date-picker{min-width:320px}@media (max-width: 1261px){vaadin-date-picker{width:auto;min-width:auto}}@media (max-width: 801px){vaadin-date-picker{width:100%}}";
187
244
  const UserTransactionHistoryStyle0 = userTransactionHistoryCss;
188
245
 
@@ -191,45 +248,64 @@ const UserTransactionHistory = class {
191
248
  index.registerInstance(this, hostRef);
192
249
  this.pageSizes = [10, 25, 50];
193
250
  this.pagination = null;
194
- this.stylingAppended = false;
195
- this.endpoint = undefined;
196
- this.session = undefined;
251
+ /*
252
+ * Language of the application.
253
+ */
197
254
  this.language = Localization.defaultLanguage;
198
- this.userId = undefined;
199
- this.translationUrl = undefined;
255
+ /*
256
+ * Is mobile mode on. Default value `false`.
257
+ */
200
258
  this.mobile = false;
259
+ /*
260
+ * Client styling via inline styles.
261
+ */
201
262
  this.clientStyling = null;
263
+ /*
264
+ * The path to file with styles in `css` format.
265
+ */
202
266
  this.clientStylingUrl = null;
203
267
  this.page = 0;
204
268
  this.pageSize = this.pageSizes[0];
205
269
  this.showMobileFilter = false;
206
- this.to = undefined;
207
- this.from = undefined;
208
270
  this.type = '0';
209
- this.transactions = undefined;
210
271
  this.showLoader = true;
211
272
  }
212
273
  watchMultiple() {
213
274
  this.loadTransactions();
214
275
  }
276
+ handleClientStylingChange(newValue, oldValue) {
277
+ if (newValue != oldValue) {
278
+ setClientStyling(this.stylingContainer, this.clientStyling);
279
+ }
280
+ }
281
+ handleClientStylingUrlChange(newValue, oldValue) {
282
+ if (newValue != oldValue) {
283
+ if (this.clientStylingUrl)
284
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
285
+ }
286
+ }
215
287
  async componentWillLoad() {
216
288
  if (this.translationUrl) {
217
289
  await Localization.loadCustomTranslations(this.translationUrl);
218
290
  }
219
291
  this.loadTransactions();
220
292
  }
221
- componentDidRender() {
222
- this.getComponentHeight();
223
- if (!this.stylingAppended && this.stylingContainer) {
224
- if (this.clientStyling) {
225
- this.setStyles(this.clientStyling);
293
+ componentDidLoad() {
294
+ if (this.stylingContainer) {
295
+ if (window.emMessageBus != undefined) {
296
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`);
226
297
  }
227
- if (this.clientStylingUrl) {
228
- this.setClientStylingByURL();
298
+ else {
299
+ if (this.clientStyling)
300
+ setClientStyling(this.stylingContainer, this.clientStyling);
301
+ if (this.clientStylingUrl)
302
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
229
303
  }
230
- this.stylingAppended = true;
231
304
  }
232
305
  }
306
+ componentDidRender() {
307
+ this.getComponentHeight();
308
+ }
233
309
  getComponentHeight() {
234
310
  var _a;
235
311
  if (this.mobile) {
@@ -269,11 +345,14 @@ const UserTransactionHistory = class {
269
345
  showFilter() {
270
346
  this.showMobileFilter = !this.showMobileFilter;
271
347
  }
348
+ disconnectedCallback() {
349
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
350
+ }
272
351
  render() {
273
352
  var _a;
274
353
  const filterSrc = index.getAssetPath('../assets/filter.svg');
275
354
  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() }, '>')))));
355
+ return (index.h(index.Host, { key: '8d6470d73afff5dbc8a8c3a1a47426223971ad47' }, this.showLoader ? index.h(Loader, null) : '', index.h("div", { key: '8c32d9425b701747559ea1e63a3b2c4bb31780ab', class: "wrapper", ref: el => (this.stylingContainer = el) }, index.h("div", { key: 'b2a9216bfcfa5950c174f6e06a179e2ae3790f6b', class: { 'types types-mobile': this.mobile, 'types types-desktop': !this.mobile } }, index.h("button", { key: 'e2ce33fe2ab27abab68bd721b8b945bde5d672ac', class: 'transaction-type' + ' ' + (this.type === '0' ? 'clicked' : ''), onClick: () => this.changeTransactionsType('0') }, Localization.translate('deposit', this.language)), index.h("button", { key: '6d80bef56bf4ec590cc2e4aa704f930a47b29f3c', 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: '9b7950ed91c4795f4355ce406d7cba40c46c0184', class: "pagination" }, index.h("button", { key: 'bc7b2bce0a21763fc5a10d2249b74c2d9805d3b5', onClick: () => this.prev() }, '<'), index.h("button", { key: '69210c5b101a24563babdbe6b3361d091afc2cc0', onClick: () => this.next() }, '>')))));
277
356
  }
278
357
  async loadTransactions() {
279
358
  this.showLoader = true;
@@ -308,25 +387,6 @@ const UserTransactionHistory = class {
308
387
  const endDate = (_b = this.to) !== null && _b !== void 0 ? _b : new Date(now.getFullYear(), now.getMonth() + 1, 0).toISOString();
309
388
  return `offset=${offset}&endDate=${endDate}&startDate=${startDate}&type=${this.type}&limit=${this.pageSize}`;
310
389
  }
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
390
  static get assetsDirs() { return ["../assets"]; }
331
391
  get el() { return index.getElement(this); }
332
392
  static get watchers() { return {
@@ -335,6 +395,8 @@ const UserTransactionHistory = class {
335
395
  "session": ["watchMultiple"],
336
396
  "userId": ["watchMultiple"],
337
397
  "pageSize": ["watchMultiple"],
398
+ "clientStyling": ["handleClientStylingChange"],
399
+ "clientStylingUrl": ["handleClientStylingUrlChange"],
338
400
  "showMobileFilter": ["getComponentHeight"]
339
401
  }; }
340
402
  };
@@ -2,11 +2,11 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- const index = require('./index-4252bc97.js');
5
+ const index = require('./index-cf677425.js');
6
6
  const appGlobals = require('./app-globals-3a1e7e63.js');
7
7
 
8
8
  /*
9
- Stencil Client Patch Browser v4.22.3 | MIT Licensed | https://stenciljs.com
9
+ Stencil Client Patch Browser v4.26.0 | MIT Licensed | https://stenciljs.com
10
10
  */
11
11
  var patchBrowser = () => {
12
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));
@@ -19,7 +19,7 @@ var patchBrowser = () => {
19
19
 
20
20
  patchBrowser().then(async (options) => {
21
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);
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"],"mbSource":[513,"mb-source"],"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"],"clientStyling":["handleClientStylingChange"],"clientStylingUrl":["handleClientStylingUrlChange"],"showMobileFilter":["getComponentHeight"]}]]]], options);
23
23
  });
24
24
 
25
25
  exports.setNonce = index.setNonce;
@@ -4,7 +4,7 @@
4
4
  ],
5
5
  "compiler": {
6
6
  "name": "@stencil/core",
7
- "version": "4.22.3",
7
+ "version": "4.26.0",
8
8
  "typescriptVersion": "5.5.4"
9
9
  },
10
10
  "collections": [],
@@ -5,49 +5,69 @@ import { TransactionComponent } from "../internal/transaction";
5
5
  import { PageSize } from "../internal/page-size";
6
6
  import { Filters } from "../internal/filters";
7
7
  import { TableComponent } from "../internal/table";
8
+ import { setClientStyling, setClientStylingURL, setStreamStyling } from "../../../../../../../../libs/common/src/styling/index";
8
9
  export class UserTransactionHistory {
9
10
  constructor() {
10
11
  this.pageSizes = [10, 25, 50];
11
12
  this.pagination = null;
12
- this.stylingAppended = false;
13
- this.endpoint = undefined;
14
- this.session = undefined;
13
+ /*
14
+ * Language of the application.
15
+ */
15
16
  this.language = Localization.defaultLanguage;
16
- this.userId = undefined;
17
- this.translationUrl = undefined;
17
+ /*
18
+ * Is mobile mode on. Default value `false`.
19
+ */
18
20
  this.mobile = false;
21
+ /*
22
+ * Client styling via inline styles.
23
+ */
19
24
  this.clientStyling = null;
25
+ /*
26
+ * The path to file with styles in `css` format.
27
+ */
20
28
  this.clientStylingUrl = null;
21
29
  this.page = 0;
22
30
  this.pageSize = this.pageSizes[0];
23
31
  this.showMobileFilter = false;
24
- this.to = undefined;
25
- this.from = undefined;
26
32
  this.type = '0';
27
- this.transactions = undefined;
28
33
  this.showLoader = true;
29
34
  }
30
35
  watchMultiple() {
31
36
  this.loadTransactions();
32
37
  }
38
+ handleClientStylingChange(newValue, oldValue) {
39
+ if (newValue != oldValue) {
40
+ setClientStyling(this.stylingContainer, this.clientStyling);
41
+ }
42
+ }
43
+ handleClientStylingUrlChange(newValue, oldValue) {
44
+ if (newValue != oldValue) {
45
+ if (this.clientStylingUrl)
46
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
47
+ }
48
+ }
33
49
  async componentWillLoad() {
34
50
  if (this.translationUrl) {
35
51
  await Localization.loadCustomTranslations(this.translationUrl);
36
52
  }
37
53
  this.loadTransactions();
38
54
  }
39
- componentDidRender() {
40
- this.getComponentHeight();
41
- if (!this.stylingAppended && this.stylingContainer) {
42
- if (this.clientStyling) {
43
- this.setStyles(this.clientStyling);
55
+ componentDidLoad() {
56
+ if (this.stylingContainer) {
57
+ if (window.emMessageBus != undefined) {
58
+ setStreamStyling(this.stylingContainer, `${this.mbSource}.Style`, this.stylingSubscription);
44
59
  }
45
- if (this.clientStylingUrl) {
46
- this.setClientStylingByURL();
60
+ else {
61
+ if (this.clientStyling)
62
+ setClientStyling(this.stylingContainer, this.clientStyling);
63
+ if (this.clientStylingUrl)
64
+ setClientStylingURL(this.stylingContainer, this.clientStylingUrl);
47
65
  }
48
- this.stylingAppended = true;
49
66
  }
50
67
  }
68
+ componentDidRender() {
69
+ this.getComponentHeight();
70
+ }
51
71
  getComponentHeight() {
52
72
  var _a;
53
73
  if (this.mobile) {
@@ -87,11 +107,14 @@ export class UserTransactionHistory {
87
107
  showFilter() {
88
108
  this.showMobileFilter = !this.showMobileFilter;
89
109
  }
110
+ disconnectedCallback() {
111
+ this.stylingSubscription && this.stylingSubscription.unsubscribe();
112
+ }
90
113
  render() {
91
114
  var _a;
92
115
  const filterSrc = getAssetPath('../assets/filter.svg');
93
116
  const warningSrc = getAssetPath('../assets/warning.svg');
94
- 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() }, '>')))));
117
+ return (h(Host, { key: '8d6470d73afff5dbc8a8c3a1a47426223971ad47' }, this.showLoader ? h(Loader, null) : '', h("div", { key: '8c32d9425b701747559ea1e63a3b2c4bb31780ab', class: "wrapper", ref: el => (this.stylingContainer = el) }, h("div", { key: 'b2a9216bfcfa5950c174f6e06a179e2ae3790f6b', class: { 'types types-mobile': this.mobile, 'types types-desktop': !this.mobile } }, h("button", { key: 'e2ce33fe2ab27abab68bd721b8b945bde5d672ac', class: 'transaction-type' + ' ' + (this.type === '0' ? 'clicked' : ''), onClick: () => this.changeTransactionsType('0') }, Localization.translate('deposit', this.language)), h("button", { key: '6d80bef56bf4ec590cc2e4aa704f930a47b29f3c', 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: '9b7950ed91c4795f4355ce406d7cba40c46c0184', class: "pagination" }, h("button", { key: 'bc7b2bce0a21763fc5a10d2249b74c2d9805d3b5', onClick: () => this.prev() }, '<'), h("button", { key: '69210c5b101a24563babdbe6b3361d091afc2cc0', onClick: () => this.next() }, '>')))));
95
118
  }
96
119
  async loadTransactions() {
97
120
  this.showLoader = true;
@@ -126,25 +149,6 @@ export class UserTransactionHistory {
126
149
  const endDate = (_b = this.to) !== null && _b !== void 0 ? _b : new Date(now.getFullYear(), now.getMonth() + 1, 0).toISOString();
127
150
  return `offset=${offset}&endDate=${endDate}&startDate=${startDate}&type=${this.type}&limit=${this.pageSize}`;
128
151
  }
129
- setStyles(styles) {
130
- const cssFile = document.createElement('style');
131
- cssFile.innerHTML = styles;
132
- this.stylingContainer.prepend(cssFile);
133
- }
134
- async setClientStylingByURL() {
135
- try {
136
- const response = await fetch(this.clientStylingUrl);
137
- if (!response.ok) {
138
- const err = await response.text();
139
- throw new Error(err);
140
- }
141
- const styles = await response.text();
142
- this.setStyles(styles);
143
- }
144
- catch (ex) {
145
- console.error(`Failed to load client styles ${this.clientStylingUrl}`, ex);
146
- }
147
- }
148
152
  static get is() { return "user-transaction-history"; }
149
153
  static get encapsulation() { return "shadow"; }
150
154
  static get originalStyleUrls() {
@@ -174,6 +178,8 @@ export class UserTransactionHistory {
174
178
  "tags": [],
175
179
  "text": ""
176
180
  },
181
+ "getter": false,
182
+ "setter": false,
177
183
  "attribute": "endpoint",
178
184
  "reflect": true
179
185
  },
@@ -191,6 +197,8 @@ export class UserTransactionHistory {
191
197
  "tags": [],
192
198
  "text": ""
193
199
  },
200
+ "getter": false,
201
+ "setter": false,
194
202
  "attribute": "session",
195
203
  "reflect": true
196
204
  },
@@ -208,6 +216,8 @@ export class UserTransactionHistory {
208
216
  "tags": [],
209
217
  "text": ""
210
218
  },
219
+ "getter": false,
220
+ "setter": false,
211
221
  "attribute": "language",
212
222
  "reflect": true,
213
223
  "defaultValue": "Localization.defaultLanguage"
@@ -226,6 +236,8 @@ export class UserTransactionHistory {
226
236
  "tags": [],
227
237
  "text": ""
228
238
  },
239
+ "getter": false,
240
+ "setter": false,
229
241
  "attribute": "user-id",
230
242
  "reflect": true
231
243
  },
@@ -243,6 +255,8 @@ export class UserTransactionHistory {
243
255
  "tags": [],
244
256
  "text": ""
245
257
  },
258
+ "getter": false,
259
+ "setter": false,
246
260
  "attribute": "translation-url",
247
261
  "reflect": true
248
262
  },
@@ -260,6 +274,8 @@ export class UserTransactionHistory {
260
274
  "tags": [],
261
275
  "text": ""
262
276
  },
277
+ "getter": false,
278
+ "setter": false,
263
279
  "attribute": "mobile",
264
280
  "reflect": true,
265
281
  "defaultValue": "false"
@@ -278,6 +294,8 @@ export class UserTransactionHistory {
278
294
  "tags": [],
279
295
  "text": ""
280
296
  },
297
+ "getter": false,
298
+ "setter": false,
281
299
  "attribute": "client-styling",
282
300
  "reflect": true,
283
301
  "defaultValue": "null"
@@ -296,9 +314,30 @@ export class UserTransactionHistory {
296
314
  "tags": [],
297
315
  "text": ""
298
316
  },
317
+ "getter": false,
318
+ "setter": false,
299
319
  "attribute": "client-styling-url",
300
320
  "reflect": true,
301
321
  "defaultValue": "null"
322
+ },
323
+ "mbSource": {
324
+ "type": "string",
325
+ "mutable": false,
326
+ "complexType": {
327
+ "original": "string",
328
+ "resolved": "string",
329
+ "references": {}
330
+ },
331
+ "required": false,
332
+ "optional": false,
333
+ "docs": {
334
+ "tags": [],
335
+ "text": ""
336
+ },
337
+ "getter": false,
338
+ "setter": false,
339
+ "attribute": "mb-source",
340
+ "reflect": true
302
341
  }
303
342
  };
304
343
  }
@@ -331,6 +370,12 @@ export class UserTransactionHistory {
331
370
  }, {
332
371
  "propName": "pageSize",
333
372
  "methodName": "watchMultiple"
373
+ }, {
374
+ "propName": "clientStyling",
375
+ "methodName": "handleClientStylingChange"
376
+ }, {
377
+ "propName": "clientStylingUrl",
378
+ "methodName": "handleClientStylingUrlChange"
334
379
  }, {
335
380
  "propName": "showMobileFilter",
336
381
  "methodName": "getComponentHeight"