@quandis/qbo4.ui 4.0.1-CI-20241115-180638 → 4.0.1-CI-20241116-001926

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "Quandis, Inc.",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
- "version": "4.0.1-CI-20241115-180638",
6
+ "version": "4.0.1-CI-20241116-001926",
7
7
  "workspaces": [
8
8
  "code"
9
9
  ],
@@ -47,7 +47,7 @@
47
47
  "autoprefixer": "^10.4.20",
48
48
  "clean-css": "^5.3.3",
49
49
  "copy-webpack-plugin": "^12.0.2",
50
- "eslint": "^9.14.0",
50
+ "eslint": "^9.15.0",
51
51
  "glob": "^11.0.0",
52
52
  "html-webpack-plugin": "^5.6.3",
53
53
  "mini-css-extract-plugin": "^2.9.2",
@@ -43,3 +43,5 @@ export declare function matches(source: any, match: any, wildCard?: string, igno
43
43
  export declare function elementData(element: HTMLElement): Record<string, string>;
44
44
  export declare function elementDate(date: string): string;
45
45
  export declare function elementDateTime(date: string): string;
46
+ export declare function elementMoney(amount: string, currency?: string, locale?: string): string;
47
+ export declare function elementPercentage(value: string, decimals?: number, locale?: string): string;
@@ -54,3 +54,20 @@ export function elementDateTime(date) {
54
54
  return '';
55
55
  return new Date(date).toLocaleString().replace(',', '');
56
56
  }
57
+ export function elementMoney(amount, currency = 'USD', locale = 'en-US') {
58
+ if (!amount)
59
+ return '';
60
+ return new Intl.NumberFormat(locale, {
61
+ style: 'currency',
62
+ currency,
63
+ }).format(Number(amount));
64
+ }
65
+ export function elementPercentage(value, decimals = 2, locale = 'en-US') {
66
+ if (!value)
67
+ return '';
68
+ return new Intl.NumberFormat(locale, {
69
+ style: 'percent',
70
+ minimumFractionDigits: decimals,
71
+ maximumFractionDigits: decimals,
72
+ }).format(Number(value));
73
+ }
@@ -72,4 +72,21 @@ export function elementDate(date: string) {
72
72
  export function elementDateTime(date: string) {
73
73
  if (!date || date.trim() == '') return '';
74
74
  return new Date(date).toLocaleString().replace(',', '');
75
+ }
76
+
77
+ export function elementMoney(amount: string, currency: string = 'USD', locale: string = 'en-US'): string {
78
+ if (!amount) return '';
79
+ return new Intl.NumberFormat(locale, {
80
+ style: 'currency',
81
+ currency,
82
+ }).format(Number(amount));
83
+ }
84
+
85
+ export function elementPercentage(value: string, decimals: number = 2, locale: string = 'en-US'): string {
86
+ if (!value) return '';
87
+ return new Intl.NumberFormat(locale, {
88
+ style: 'percent',
89
+ minimumFractionDigits: decimals,
90
+ maximumFractionDigits: decimals,
91
+ }).format(Number(value));
75
92
  }
@@ -19,6 +19,7 @@ export class RestApiService {
19
19
  const response = await fetch(endpoint, {
20
20
  method: method,
21
21
  headers: headers,
22
+ credentials: 'include',
22
23
  body: (method === 'POST' && payload) ? JSON.stringify(payload) : null
23
24
  });
24
25
  const accept = headers.get("Accept") ?? '';
@@ -29,6 +29,7 @@ export class RestApiService implements IApiService {
29
29
  const response = await fetch(endpoint, {
30
30
  method: method,
31
31
  headers: headers,
32
+ credentials: 'include',
32
33
  body: (method === 'POST' && payload) ? JSON.stringify(payload) : null
33
34
  });
34
35
  const accept = headers.get("Accept") ?? '';