@everymatrix/user-transaction-history 1.68.0 → 1.69.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.
@@ -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"],"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);
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"],"dateFormat":[513,"date-format"],"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;
@@ -2,7 +2,7 @@ import { h } from "@stencil/core";
2
2
  import { CurrencyFormatter } from "../../utils/currency.utils";
3
3
  import { DateTransformer } from "../../utils/date.util";
4
4
  import { Localization } from "../../utils/locale.util";
5
- export const TableComponent = ({ source, language }) => {
5
+ export const TableComponent = ({ source, language, dateformat }) => {
6
6
  const columns = [
7
7
  { name: Localization.translate('transactionId', language) },
8
8
  {
@@ -16,5 +16,5 @@ export const TableComponent = ({ source, language }) => {
16
16
  name: Localization.translate('status', language),
17
17
  },
18
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)))))));
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), dateformat)), 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
20
  };
@@ -1,4 +1,4 @@
1
1
  import { h } from "@stencil/core";
2
2
  import { DateTransformer } from "../../utils/date.util";
3
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), " ")));
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), transaction.dateformat)), h("p", { class: "text-style" }, CurrencyFormatter.format(transaction.currency, transaction.realAmount), " ")));
@@ -19,6 +19,7 @@ export class UserTransactionHistory {
19
19
  this.clientStyling = null;
20
20
  this.clientStylingUrl = null;
21
21
  this.mbSource = undefined;
22
+ this.dateFormat = '';
22
23
  this.page = 0;
23
24
  this.pageSize = this.pageSizes[0];
24
25
  this.showMobileFilter = false;
@@ -110,7 +111,7 @@ export class UserTransactionHistory {
110
111
  var _a;
111
112
  const filterSrc = getAssetPath('../assets/filter.svg');
112
113
  const warningSrc = getAssetPath('../assets/warning.svg');
113
- 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: '14b4d34c0e1d258ea0547b4aa43766199a629526', class: "pagination" }, h("button", { key: 'fdd2a70e6dacf863c0783ab8dce80951294f04cc', onClick: () => this.prev() }, '<'), h("button", { key: '3bdc96262e16573e24ba07362e80ea779d30da9f', onClick: () => this.next() }, '>')))));
114
+ return (h(Host, { key: '7346a5fe57d7bc3df7b3eb88f1a175b1bb4fed10' }, this.showLoader ? h(Loader, null) : '', h("div", { key: 'f58cb9c38d88702255a3f63731c152f79cc7c071', class: "wrapper", ref: el => (this.stylingContainer = el) }, h("div", { key: 'ff79d6a34f9e4615fecd81f12cec228e567317b3', class: { 'types types-mobile': this.mobile, 'types types-desktop': !this.mobile } }, h("button", { key: '6c89c781087a854edb143e84fd684b72a6a5f8c1', class: 'transaction-type' + ' ' + (this.type === '0' ? 'clicked' : ''), onClick: () => this.changeTransactionsType('0') }, Localization.translate('deposit', this.language)), h("button", { key: '15d1f9c89a1ffdfcbc0d8e5ebf375bcd2129e2aa', 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, { dateformat: this.dateFormat })))))) : (h(TableComponent, { source: this.transactions, language: this.language, dateformat: this.dateFormat })))) : (h("div", { class: "noData" }, h("img", { src: warningSrc, alt: "Warning" }), h("span", null, Localization.translate('noData', this.language)))), h("div", { key: '5a0b142e2a02e0a24263a6b66ad36762c3934712', class: "pagination" }, h("button", { key: '2dcc9efdc61ed362e4845da8088bd5de458bab0f', onClick: () => this.prev() }, '<'), h("button", { key: 'acd4dfb619f6220bcbc9da932c6accf0e34c7df0', onClick: () => this.next() }, '>')))));
114
115
  }
115
116
  async loadTransactions() {
116
117
  this.showLoader = true;
@@ -316,6 +317,24 @@ export class UserTransactionHistory {
316
317
  },
317
318
  "attribute": "mb-source",
318
319
  "reflect": true
320
+ },
321
+ "dateFormat": {
322
+ "type": "string",
323
+ "mutable": false,
324
+ "complexType": {
325
+ "original": "string",
326
+ "resolved": "string",
327
+ "references": {}
328
+ },
329
+ "required": false,
330
+ "optional": false,
331
+ "docs": {
332
+ "tags": [],
333
+ "text": ""
334
+ },
335
+ "attribute": "date-format",
336
+ "reflect": true,
337
+ "defaultValue": "''"
319
338
  }
320
339
  };
321
340
  }
@@ -1,7 +1,8 @@
1
+ import dateFnsFormat from "date-fns/format";
1
2
  export class DateTransformer {
2
3
  constructor() { }
3
- static dateToFormatedString(date) {
4
- const dateStr = date.toLocaleDateString('en-gb');
4
+ static dateToFormatedString(date, dateformat) {
5
+ const dateStr = dateformat ? dateFnsFormat(date, dateformat) : date.toLocaleDateString('en-gb');
5
6
  const timeStr = date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit', hour12: false });
6
7
  return `${dateStr}, ${timeStr}`;
7
8
  }
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-0f993ce5.js';
5
5
  const defineCustomElements = async (win, options) => {
6
6
  if (typeof window === 'undefined') return undefined;
7
7
  await globalScripts();
8
- return bootstrapLazy([["user-transaction-history",[[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);
8
+ return bootstrapLazy([["user-transaction-history",[[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"],"dateFormat":[513,"date-format"],"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);
9
9
  };
10
10
 
11
11
  export { defineCustomElements };