@firedesktop/react-base 2.1.25 → 3.0.1
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/LICENSE +162 -0
- package/README.md +174 -94
- package/dist/components/AppIcon.d.ts +20 -20
- package/dist/components/AppIcon.js +53 -64
- package/dist/components/AppIcon.js.map +1 -1
- package/dist/components/AppInput.d.ts +20 -20
- package/dist/components/AppInput.js +7 -18
- package/dist/components/AppInput.js.map +1 -1
- package/dist/components/AppPagination.d.ts +11 -11
- package/dist/components/AppPagination.js +63 -74
- package/dist/components/AppPagination.js.map +1 -1
- package/dist/components/Spin.d.ts +6 -6
- package/dist/components/Spin.js +21 -17
- package/dist/components/Spin.js.map +1 -1
- package/dist/components/Toaster/Toaster.d.ts +7 -7
- package/dist/components/Toaster/Toaster.js +41 -29
- package/dist/components/Toaster/Toaster.js.map +1 -1
- package/dist/components/Toaster/Types.d.ts +6 -6
- package/dist/components/Toaster/Types.js +1 -1
- package/dist/components/index.d.ts +7 -7
- package/dist/components/index.js +7 -7
- package/dist/index.d.ts +8 -7
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/utils/CurrencyUtiles.d.ts +4 -4
- package/dist/utils/CurrencyUtiles.js +35 -30
- package/dist/utils/CurrencyUtiles.js.map +1 -1
- package/dist/utils/DateUtils.d.ts +7 -7
- package/dist/utils/DateUtils.js +111 -100
- package/dist/utils/DateUtils.js.map +1 -1
- package/dist/utils/FileUtils.d.ts +5 -5
- package/dist/utils/FileUtils.js +73 -73
- package/dist/utils/FileUtils.js.map +1 -1
- package/dist/utils/Logger.d.ts +13 -0
- package/dist/utils/Logger.js +44 -0
- package/dist/utils/Logger.js.map +1 -0
- package/dist/utils/RegExValidation.d.ts +4 -4
- package/dist/utils/RegExValidation.js +19 -19
- package/dist/utils/UrlUtils.d.ts +4 -4
- package/dist/utils/UrlUtils.js +15 -15
- package/dist/utils/UrlUtils.js.map +1 -1
- package/dist/utils/configuration/ConfigurationLoader.d.ts +6 -6
- package/dist/utils/configuration/ConfigurationLoader.js +76 -75
- package/dist/utils/configuration/ConfigurationLoader.js.map +1 -1
- package/dist/utils/configuration/ConfigurationManager.d.ts +5 -5
- package/dist/utils/configuration/ConfigurationManager.js +96 -89
- package/dist/utils/configuration/ConfigurationManager.js.map +1 -1
- package/dist/utils/configuration/ConfigurationReturner.d.ts +9 -9
- package/dist/utils/configuration/ConfigurationReturner.js +70 -69
- package/dist/utils/configuration/ConfigurationReturner.js.map +1 -1
- package/dist/utils/configuration/index.d.ts +4 -4
- package/dist/utils/configuration/index.js +4 -4
- package/dist/utils/fetch/Types.d.ts +10 -10
- package/dist/utils/fetch/Types.js +1 -1
- package/dist/utils/fetch/fetchWrapper.d.ts +14 -14
- package/dist/utils/fetch/fetchWrapper.js +268 -233
- package/dist/utils/fetch/fetchWrapper.js.map +1 -1
- package/dist/utils/fetch/index.d.ts +3 -3
- package/dist/utils/fetch/index.js +3 -3
- package/dist/utils/index.d.ts +10 -9
- package/dist/utils/index.js +10 -9
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/labels/LanguageLoader.d.ts +7 -7
- package/dist/utils/labels/LanguageLoader.js +130 -100
- package/dist/utils/labels/LanguageLoader.js.map +1 -1
- package/dist/utils/labels/LanguageManager.d.ts +6 -6
- package/dist/utils/labels/LanguageManager.js +118 -110
- package/dist/utils/labels/LanguageManager.js.map +1 -1
- package/dist/utils/labels/LanguageReturner.d.ts +10 -10
- package/dist/utils/labels/LanguageReturner.js +70 -69
- package/dist/utils/labels/LanguageReturner.js.map +1 -1
- package/dist/utils/labels/index.d.ts +4 -4
- package/dist/utils/labels/index.js +4 -4
- package/docs/APP_ICON.md +82 -0
- package/docs/APP_INPUT.md +81 -0
- package/docs/APP_PAGINATION.md +61 -0
- package/docs/CONFIGURATION.md +105 -0
- package/docs/FETCH_WRAPPER.md +163 -0
- package/docs/LABELS.md +148 -0
- package/docs/LOGGER.md +112 -0
- package/docs/SECURITY_AUDIT_2026-02-05.md +468 -0
- package/docs/SPIN.md +45 -0
- package/docs/TOASTER.md +75 -0
- package/docs/UTILITIES.md +177 -0
- package/package.json +28 -38
- package/src/App.css +0 -12
- package/src/lib/components/AppIcon.tsx +0 -784
- package/src/lib/components/AppInput.tsx +0 -66
- package/src/lib/components/AppPagination.tsx +0 -124
- package/src/lib/components/Spin.tsx +0 -31
- package/src/lib/components/Toaster/Toaster.tsx +0 -50
- package/src/lib/components/Toaster/Types.ts +0 -11
- package/src/lib/components/index.ts +0 -8
- package/src/lib/index.ts +0 -15
- package/src/lib/styles/base.css +0 -392
- package/src/lib/styles/syncfusion_bootstrap4.css +0 -10
- package/src/lib/styles/toaster.css +0 -50
- package/src/lib/utils/CurrencyUtiles.ts +0 -48
- package/src/lib/utils/DateUtils.ts +0 -135
- package/src/lib/utils/FileUtils.ts +0 -40
- package/src/lib/utils/RegExValidation.ts +0 -49
- package/src/lib/utils/UrlUtils.ts +0 -17
- package/src/lib/utils/configuration/ConfigurationLoader.tsx +0 -43
- package/src/lib/utils/configuration/ConfigurationManager.ts +0 -38
- package/src/lib/utils/configuration/ConfigurationReturner.tsx +0 -39
- package/src/lib/utils/configuration/index.ts +0 -9
- package/src/lib/utils/fetch/Types.ts +0 -11
- package/src/lib/utils/fetch/fetchWrapper.ts +0 -174
- package/src/lib/utils/fetch/index.ts +0 -4
- package/src/lib/utils/index.ts +0 -11
- package/src/lib/utils/labels/LanguageLoader.tsx +0 -69
- package/src/lib/utils/labels/LanguageManager.ts +0 -61
- package/src/lib/utils/labels/LanguageReturner.tsx +0 -41
- package/src/lib/utils/labels/index.ts +0 -9
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
@font-face {
|
|
2
|
-
font-family: 'Toast_icons';
|
|
3
|
-
src: url(data:application/x-font-ttf;charset=utf-8;base64,AAEAAAAKAIAAAwAgT1MvMj0gSRkAAAEoAAAAVmNtYXDnM+eRAAABsAAAAEpnbHlmzVnmlwAAAhgAAAZAaGVhZBEYIl8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R1ZGlvd3d3LnN5bmNmdXNpb24uY29tACAARgBpAG4AYQBsACAAVABvAGEAcwB0ACAATQBlAHQAcgBvAHAAUgBlAGcAdQBsAGEAcgBGAGkAbgBhAGwAIABUAG8AYQBzAHQAIABNAGUAdAByAG8AcABGAGkAbgBhAGwAIABUAG8AYQBzAHQAIABNAGUAdAByAG8AcABWAGUAcgBzAGkAbwBuACAAMQAuADAARgBpAG4AYQBsACAAVABvAGEAcwB0ACAATQBlAHQAcgBvAHAARgBvAG4AdAAgAGcAZQBuAGUAcgBhAHQAZQBkACAAdQBzAGkAbgBnACAAUwB5AG4AYwBmAHUAcwBpAG8AbgAgAE0AZQB0AHIAbwAgAFMAdAB1AGQAaQBvAHcAdwB3AC4AcwB5AG4AYwBmAHUAcwBpAG8AbgAuAGMAbwBtAAAAAAIAAAAAAAAACgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAECAQMBBAEFAQYBBwEIAQkBCgELAQwBDQAFRXJyb3IHU3VjY2VzcwVBbGFybQdXYXJuaW5nBEluZm8HTWVldGluZwVCbGluawdTdHJldGNoA1NpcANTaXQFVHJhc2gAAAAA) format('truetype');
|
|
4
|
-
font-weight: normal;
|
|
5
|
-
font-style: normal;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
#toast_types button {
|
|
9
|
-
margin: 5px;
|
|
10
|
-
min-width: 160px;
|
|
11
|
-
max-width: 160px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
#toast_types {
|
|
15
|
-
text-align: center;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.toast-icons {
|
|
19
|
-
font-family: 'Toast_icons' !important;
|
|
20
|
-
speak: none;
|
|
21
|
-
font-size: 55px;
|
|
22
|
-
font-style: normal;
|
|
23
|
-
font-weight: normal;
|
|
24
|
-
font-variant: normal;
|
|
25
|
-
text-transform: none;
|
|
26
|
-
line-height: 1;
|
|
27
|
-
-webkit-font-smoothing: antialiased;
|
|
28
|
-
-moz-osx-font-smoothing: grayscale;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
#toast_type .e-toast-icon.e-icons {
|
|
32
|
-
height: auto;
|
|
33
|
-
font-size: 30px;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
.toast-icons.e-success::before {
|
|
37
|
-
content: "\e701";
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.toast-icons.e-error::before {
|
|
41
|
-
content: "\e700";
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.toast-icons.e-info::before {
|
|
45
|
-
content: "\e704";
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.toast-icons.e-warning::before {
|
|
49
|
-
content: "\e703";
|
|
50
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
export default function CurrencyUtiles() {
|
|
2
|
-
/**
|
|
3
|
-
* Intl
|
|
4
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat
|
|
5
|
-
*
|
|
6
|
-
* @param value
|
|
7
|
-
* @param locale 'en-US' or 'en' or 'US'...
|
|
8
|
-
* @param currency https://www.easymarkets.com/eu/learn-centre/discover-trading/currency-acronyms-and-abbreviations/, default EUR
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
const numberToCurrencyString = (value: string | number | undefined, locale: string = 'IT', currency = 'EUR'): string => {
|
|
12
|
-
try {
|
|
13
|
-
const valueNumber = Number(value);
|
|
14
|
-
|
|
15
|
-
if (value === undefined || value === null || isNaN(valueNumber))
|
|
16
|
-
return '';
|
|
17
|
-
|
|
18
|
-
return new Intl.NumberFormat(locale, { style: 'currency', currency }).format(valueNumber);
|
|
19
|
-
} catch (err) { }
|
|
20
|
-
|
|
21
|
-
return '';
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* @param value number
|
|
26
|
-
* @param locale your locale (e.g. IT, it-IT, en-US,...)
|
|
27
|
-
* @param minimumFractionDigits number of fraction digits
|
|
28
|
-
* @returns
|
|
29
|
-
*/
|
|
30
|
-
const numberToCurrencyStringNoSymbol = (value: string | number | undefined, locale: string = 'IT', minimumFractionDigits: number = 2): string => {
|
|
31
|
-
try {
|
|
32
|
-
const valueNumber = Number(value);
|
|
33
|
-
|
|
34
|
-
if (value === undefined || value === null || isNaN(valueNumber))
|
|
35
|
-
return '';
|
|
36
|
-
|
|
37
|
-
return new Intl.NumberFormat(locale, { minimumFractionDigits }).format(valueNumber);
|
|
38
|
-
} catch (err) { }
|
|
39
|
-
|
|
40
|
-
return '';
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
numberToCurrencyString,
|
|
46
|
-
numberToCurrencyStringNoSymbol
|
|
47
|
-
};
|
|
48
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
export default function DateUtils() {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Intl
|
|
5
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat
|
|
6
|
-
* format
|
|
7
|
-
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/format
|
|
8
|
-
* @param inComingDate
|
|
9
|
-
* @param locale 'en-US' or 'en' or 'US'...
|
|
10
|
-
* @returns
|
|
11
|
-
*/
|
|
12
|
-
const dateToString = (inComingDate: string | Date, locale: string = 'IT'): String => {
|
|
13
|
-
try {
|
|
14
|
-
if (inComingDate instanceof Date)
|
|
15
|
-
return new Intl.DateTimeFormat(locale, {
|
|
16
|
-
|
|
17
|
-
}).format(inComingDate);
|
|
18
|
-
else
|
|
19
|
-
return new Intl.DateTimeFormat(locale).format(new Date(inComingDate));
|
|
20
|
-
} catch (err) { }
|
|
21
|
-
|
|
22
|
-
return '';
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const dateToString_Italian = (inComingDate: string | Date | undefined, separator: string,
|
|
26
|
-
time: 'HH:mm' | 'HH:mm:ss' | undefined): string => {
|
|
27
|
-
if (!inComingDate)
|
|
28
|
-
return '';
|
|
29
|
-
|
|
30
|
-
try {
|
|
31
|
-
let day = 0;
|
|
32
|
-
let month = 0;
|
|
33
|
-
let year = 0;
|
|
34
|
-
let hour = 0;
|
|
35
|
-
let minutes = 0;
|
|
36
|
-
let seconds = 0;
|
|
37
|
-
|
|
38
|
-
if (inComingDate instanceof Date) {
|
|
39
|
-
day = inComingDate.getDate();
|
|
40
|
-
month = inComingDate.getMonth();
|
|
41
|
-
year = inComingDate.getFullYear();
|
|
42
|
-
|
|
43
|
-
hour = inComingDate.getHours();
|
|
44
|
-
minutes = inComingDate.getMinutes();
|
|
45
|
-
seconds = inComingDate.getSeconds();
|
|
46
|
-
}
|
|
47
|
-
else {
|
|
48
|
-
const newD = new Date(inComingDate);
|
|
49
|
-
day = newD.getDate();
|
|
50
|
-
month = newD.getMonth();
|
|
51
|
-
year = newD.getFullYear();
|
|
52
|
-
|
|
53
|
-
hour = newD.getHours();
|
|
54
|
-
minutes = newD.getMinutes();
|
|
55
|
-
seconds = newD.getSeconds();
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
let value = `${('' + day).padStart(2, '0')}${separator}${('' + (month + 1)).padStart(2, '0')}${separator}${year}`;
|
|
59
|
-
|
|
60
|
-
if (time) {
|
|
61
|
-
value += ` ${('' + hour).padStart(2, '0')}:${('' + minutes).padStart(2, '0')}`;
|
|
62
|
-
if (time === 'HH:mm:ss')
|
|
63
|
-
value += `:${('' + seconds).padStart(2, '0')}`;
|
|
64
|
-
}
|
|
65
|
-
return value;
|
|
66
|
-
} catch (err) { }
|
|
67
|
-
|
|
68
|
-
return '';
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const isoStringToDate = (value: string | undefined): Date | undefined => {
|
|
72
|
-
if (!value)
|
|
73
|
-
return undefined;
|
|
74
|
-
|
|
75
|
-
try {
|
|
76
|
-
return new Date(value);
|
|
77
|
-
} catch (err) { }
|
|
78
|
-
|
|
79
|
-
return undefined;
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const removeTime = (inComingDate?: string | Date): Date | undefined => {
|
|
83
|
-
if (!inComingDate)
|
|
84
|
-
return undefined;
|
|
85
|
-
|
|
86
|
-
try {
|
|
87
|
-
let date: Date;
|
|
88
|
-
if (inComingDate instanceof Date) {
|
|
89
|
-
date = inComingDate;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
date = new Date(inComingDate);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
return new Date(
|
|
96
|
-
date.getFullYear(),
|
|
97
|
-
date.getMonth(),
|
|
98
|
-
date.getDate()
|
|
99
|
-
);
|
|
100
|
-
} catch (err) { }
|
|
101
|
-
};
|
|
102
|
-
|
|
103
|
-
/**
|
|
104
|
-
* inComingDate: must be in the following format '2022-07-07T14:00:00.000Z'
|
|
105
|
-
*/
|
|
106
|
-
const zuluTimeUTC_to_yourTimeZone = (inComingDate: string): string => {
|
|
107
|
-
if (inComingDate && inComingDate[inComingDate.length - 1] === 'Z') {
|
|
108
|
-
try {
|
|
109
|
-
const date = new Date(inComingDate);
|
|
110
|
-
const day = date.getDate();
|
|
111
|
-
const month = date.getMonth();
|
|
112
|
-
const year = date.getFullYear();
|
|
113
|
-
const hour = date.getHours();
|
|
114
|
-
const minutes = date.getMinutes();
|
|
115
|
-
const seconds = date.getSeconds();
|
|
116
|
-
const separator = '-';
|
|
117
|
-
|
|
118
|
-
return `${year}${separator}${('' + (month + 1)).padStart(2, '0')}${separator}${('' + day).padStart(2, '0')}` +
|
|
119
|
-
`T${('' + hour).padStart(2, '0')}:${('' + minutes).padStart(2, '0')}:${('' + seconds).padStart(2, '0')}`;
|
|
120
|
-
}
|
|
121
|
-
catch (err) { }
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return inComingDate;
|
|
125
|
-
};
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return {
|
|
129
|
-
dateToString,
|
|
130
|
-
dateToString_Italian,
|
|
131
|
-
isoStringToDate,
|
|
132
|
-
removeTime,
|
|
133
|
-
zuluTimeUTC_to_yourTimeZone
|
|
134
|
-
};
|
|
135
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
function FileUtils() {
|
|
2
|
-
const b64toBlob = (b64Data: string, contentType: string = '', sliceSize: number = 512): Blob | undefined => {
|
|
3
|
-
if (!b64Data || b64Data === '')
|
|
4
|
-
return undefined;
|
|
5
|
-
|
|
6
|
-
const byteCharacters = atob(b64Data);
|
|
7
|
-
const byteArrays = [];
|
|
8
|
-
|
|
9
|
-
for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) {
|
|
10
|
-
const slice = byteCharacters.slice(offset, offset + sliceSize);
|
|
11
|
-
|
|
12
|
-
const byteNumbers = new Array(slice.length);
|
|
13
|
-
for (let i = 0; i < slice.length; i++) {
|
|
14
|
-
byteNumbers[i] = slice.charCodeAt(i);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const byteArray = new Uint8Array(byteNumbers);
|
|
18
|
-
byteArrays.push(byteArray);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const blob = new Blob(byteArrays, { type: contentType });
|
|
22
|
-
return blob;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const fileReadAsync = async (file: File) => {
|
|
26
|
-
return new Promise((resolve: (value: string | ArrayBuffer | null) => void, reject: (value: DOMException | null) => void) => {
|
|
27
|
-
const reader = new FileReader();
|
|
28
|
-
reader.onload = () => resolve(reader.result);
|
|
29
|
-
reader.onerror = () => reject(reader.error);
|
|
30
|
-
reader.readAsText(file);
|
|
31
|
-
});
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
return {
|
|
35
|
-
b64toBlob,
|
|
36
|
-
fileReadAsync
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export default FileUtils;
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export default function RegExValidation() {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* True if
|
|
5
|
-
* - start with a letter
|
|
6
|
-
* - Only contains letters number and _
|
|
7
|
-
*
|
|
8
|
-
* @param value a gnetic string
|
|
9
|
-
* @returns
|
|
10
|
-
*/
|
|
11
|
-
const isAValid_CSharpName = (value?: string): boolean => {
|
|
12
|
-
/**
|
|
13
|
-
* ^ --> asserts the start of the string.
|
|
14
|
-
* (?![0-9]) --> is a negative lookahead that ensures the class name does not start with a digit.
|
|
15
|
-
* \w+ --> matches one or more word characters (alphanumeric characters and underscores).
|
|
16
|
-
* $ --> asserts the end of the string.
|
|
17
|
-
*/
|
|
18
|
-
const regex = /^(?![0-9])\w+$/;
|
|
19
|
-
|
|
20
|
-
if (!value)
|
|
21
|
-
return false;
|
|
22
|
-
|
|
23
|
-
return regex.test(value);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const isAValid_EmailAddress = (value?: string): boolean => {
|
|
27
|
-
/**
|
|
28
|
-
* - ^: Start of the string.
|
|
29
|
-
* - [a-zA-Z0-9._%+-]+: Matches one or more of the characters in the set:
|
|
30
|
-
* letters (both uppercase and lowercase), digits, period (.), underscore (_), percent (%), plus (+), and hyphen (-).
|
|
31
|
-
* - @: Matches the @ symbol.
|
|
32
|
-
* - [a-zA-Z0-9.-]+: Matches one or more letters (both uppercase and lowercase), digits, period (.), or hyphen (-).
|
|
33
|
-
* - \.: Matches a literal period (dot). The backslash \ is used to escape the special meaning of the period.
|
|
34
|
-
* - [a-zA-Z]{2,}: Matches two or more letters (both uppercase and lowercase). This is the top-level domain (TLD) part of the email address.
|
|
35
|
-
* - $: End of the string.
|
|
36
|
-
*/
|
|
37
|
-
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
38
|
-
|
|
39
|
-
if (!value)
|
|
40
|
-
return false;
|
|
41
|
-
|
|
42
|
-
return regex.test(value);
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
isAValid_CSharpName,
|
|
47
|
-
isAValid_EmailAddress
|
|
48
|
-
};
|
|
49
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
function UrlUtils() {
|
|
2
|
-
const validate = (url?: string) => {
|
|
3
|
-
var pattern = new RegExp('^(https?:\\/\\/)?' + // protocol
|
|
4
|
-
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
|
|
5
|
-
'((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
|
|
6
|
-
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
|
|
7
|
-
'(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
|
|
8
|
-
'(\\#[-a-z\\d_]*)?$', 'i'); // fragment locator
|
|
9
|
-
return !!pattern.test(url);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
return {
|
|
13
|
-
validate
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default UrlUtils;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import { useDispatch, useSelector } from 'react-redux';
|
|
3
|
-
|
|
4
|
-
import ConfigurationManager from './ConfigurationManager';
|
|
5
|
-
|
|
6
|
-
export type configurationLoaderParamsType = {
|
|
7
|
-
updateAppState: (name: string, value: object) => any,
|
|
8
|
-
path?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function ConfigurationLoader({ updateAppState, path }: configurationLoaderParamsType) {
|
|
12
|
-
const dispatch = useDispatch();
|
|
13
|
-
const configuration: any = useSelector((state: any) => state.configuration);
|
|
14
|
-
const { loadConfiguration } = ConfigurationManager();
|
|
15
|
-
|
|
16
|
-
let fullPath = '/configuration/config.json';
|
|
17
|
-
if (path)
|
|
18
|
-
fullPath = path;
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
async function justAsync() {
|
|
22
|
-
if (!configuration || !configuration.loaded) {
|
|
23
|
-
console.log(`Loading Configuration for this Site in this path: ${fullPath}`);
|
|
24
|
-
await loadConfiguration(fullPath).then((response: any) => {
|
|
25
|
-
console.log(`Loaded Configuration for this Site in this path: ${fullPath}`, response);
|
|
26
|
-
dispatch(updateAppState('configuration', response));
|
|
27
|
-
|
|
28
|
-
}).catch((err: any) => {
|
|
29
|
-
console.error(`Problem loading the Site Configuration in this path: ${fullPath}`);
|
|
30
|
-
});
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
justAsync();
|
|
34
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
35
|
-
}, []);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<React.Fragment>
|
|
39
|
-
</React.Fragment>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export default ConfigurationLoader;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
function ConfigurationManager() {
|
|
2
|
-
|
|
3
|
-
async function loadConfiguration(fullPath: string) {
|
|
4
|
-
try {
|
|
5
|
-
const res = await fetch(fullPath, {
|
|
6
|
-
headers: {
|
|
7
|
-
'Content-Type': 'application/json; charset=utf-8',
|
|
8
|
-
'Cache-Control': 'no-cache, no-store, must-revalidate',
|
|
9
|
-
'Expires': '0',
|
|
10
|
-
'pragma': 'no-cache',
|
|
11
|
-
'X-Content-Type-Options': 'nosniff'
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
return await res.json();
|
|
15
|
-
}
|
|
16
|
-
catch (err) {
|
|
17
|
-
console.error('Problem loading the Site Configuration');
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
async function loadConfigurationWithDispatch(dispatch: any, updateAppState: any, configuration: any) {
|
|
22
|
-
if (!configuration || !configuration.loaded) {
|
|
23
|
-
var avoidCache = new Date().getTime();
|
|
24
|
-
const fullPath = `/configuration/config.json?${avoidCache}`;
|
|
25
|
-
console.log(`Loading Configuration for this Site from this path: ${fullPath}`);
|
|
26
|
-
loadConfiguration(fullPath).then((response: any) => {
|
|
27
|
-
console.log(`Loaded Configuration for this Site in this path: ${fullPath}`, response);
|
|
28
|
-
dispatch(updateAppState('configuration', response));
|
|
29
|
-
}).catch((err: any) => {
|
|
30
|
-
console.error(`Problem loading the Site Configuration in this path: ${fullPath}`);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return { loadConfiguration, loadConfigurationWithDispatch };
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export default ConfigurationManager;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
|
|
3
|
-
import ConfigurationManager from './ConfigurationManager';
|
|
4
|
-
|
|
5
|
-
export type Configuration_Type = {
|
|
6
|
-
loaded: boolean
|
|
7
|
-
}
|
|
8
|
-
export type configurationLoaderParamsType = {
|
|
9
|
-
configuration?: Configuration_Type
|
|
10
|
-
onConfigurationLoad: (condifiguration?: Configuration_Type) => void
|
|
11
|
-
path: string
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export default function ConfigurationReturner({ configuration, onConfigurationLoad, path }: configurationLoaderParamsType) {
|
|
15
|
-
const { loadConfiguration } = ConfigurationManager();
|
|
16
|
-
|
|
17
|
-
const fullPath = `${path}/config.json`;
|
|
18
|
-
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
async function justAsync() {
|
|
21
|
-
if (!configuration || !configuration.loaded) {
|
|
22
|
-
console.log(`Loading Configuration for this Path: ${path} in this fullpath: ${fullPath}`);
|
|
23
|
-
await loadConfiguration(fullPath).then((response: any) => {
|
|
24
|
-
console.log(`Loaded Configuration for this Path: ${path} in this fullpath: ${fullPath}`, response);
|
|
25
|
-
onConfigurationLoad(response);
|
|
26
|
-
}).catch((err: any) => {
|
|
27
|
-
console.error(`Problem loading the Path: ${path} Configuration in this fullpath: ${fullPath}`);
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
justAsync();
|
|
32
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
|
-
}, []);
|
|
34
|
-
|
|
35
|
-
return (
|
|
36
|
-
<React.Fragment>
|
|
37
|
-
</React.Fragment>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import ConfigurationManager from './ConfigurationManager';
|
|
2
|
-
import ConfigurationLoader from './ConfigurationLoader';
|
|
3
|
-
import ConfigurationReturner from './ConfigurationReturner';
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
ConfigurationLoader,
|
|
7
|
-
ConfigurationManager,
|
|
8
|
-
ConfigurationReturner
|
|
9
|
-
};
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import * as Types from './Types';
|
|
2
|
-
|
|
3
|
-
class Constants {
|
|
4
|
-
static labels = {
|
|
5
|
-
errorBadRequest: 'Request is not in a valid format',
|
|
6
|
-
errorGeneric: 'Sorry we have errors on the remote server',
|
|
7
|
-
errorServerNotAvailable: 'Server not available',
|
|
8
|
-
errorSessionExpired: 'Your session has expired, please login.',
|
|
9
|
-
} as Types.ILabels;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
class FetchWrapper {
|
|
13
|
-
apiVersion?: string;
|
|
14
|
-
labels?: Types.ILabels;
|
|
15
|
-
status_401?: () => Promise<void>;
|
|
16
|
-
status_403?: () => Promise<void>;
|
|
17
|
-
|
|
18
|
-
constructor(apiVersion?: string, labels?: Types.ILabels, status_401?: () => Promise<void>, status_403?: () => Promise<void>) {
|
|
19
|
-
this.apiVersion = apiVersion;
|
|
20
|
-
this.status_401 = status_401;
|
|
21
|
-
this.status_403 = status_403;
|
|
22
|
-
|
|
23
|
-
if (labels && labels !== null && labels.errorGeneric && labels.errorServerNotAvailable && labels.errorSessionExpired)
|
|
24
|
-
this.labels = labels;
|
|
25
|
-
else
|
|
26
|
-
this.labels = Constants.labels;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
get = async (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
30
|
-
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
31
|
-
return this.generic('GET', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
post = async (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
35
|
-
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
36
|
-
return this.generic('POST', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
put = async (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
40
|
-
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
41
|
-
return this.generic('PUT', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
delete = async (url: string, applicationName?: string, token?: string, onGenericServerError?: (status: number, error?: any) => void, params?: Blob | any, isFile = false, isBlobInReturn = false,
|
|
45
|
-
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
46
|
-
return this.generic('DELETE', url, applicationName, token, onGenericServerError, params, isFile, isBlobInReturn, this.apiVersion, additionalParams, timeoutInMilli);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
generic = async (method: string, url: string, applicationName: string | undefined, token: string | undefined,
|
|
50
|
-
onGenericServerError?: (status: number, error?: any) => void,
|
|
51
|
-
params?: Blob | any, isFile?: boolean, isBlobInReturn?: boolean, version?: string,
|
|
52
|
-
additionalParams: Types.AdditionalParamsType[] = [], timeoutInMilli: number = 60000) => {
|
|
53
|
-
|
|
54
|
-
const abortController = new AbortController();
|
|
55
|
-
const timeoutId = setTimeout(() => abortController.abort(), timeoutInMilli); // 60.000 milliseconds timeout
|
|
56
|
-
|
|
57
|
-
// Headers & Body
|
|
58
|
-
let body: BodyInit;
|
|
59
|
-
const headers = new Headers();
|
|
60
|
-
// Cache
|
|
61
|
-
headers.append('Cache-Control', 'no-cache, no-store, must-revalidate');
|
|
62
|
-
headers.append('pragma', 'no-cache');
|
|
63
|
-
headers.append('Expires', '0');
|
|
64
|
-
headers.append('X-Content-Type-Options', 'nosniff');
|
|
65
|
-
|
|
66
|
-
if (version)
|
|
67
|
-
headers.append('api-version', version);
|
|
68
|
-
if (applicationName)
|
|
69
|
-
headers.append('ApplicationName', applicationName);
|
|
70
|
-
if (token)
|
|
71
|
-
headers.append('SessionToken', token);
|
|
72
|
-
// This should be the right way, but here we use SessionToken
|
|
73
|
-
// headers.append('Authorization', 'Bearer ' + token);
|
|
74
|
-
|
|
75
|
-
if (params || isFile) {
|
|
76
|
-
if (isFile) {
|
|
77
|
-
var formData = new FormData();
|
|
78
|
-
|
|
79
|
-
if (params)
|
|
80
|
-
formData.append('file', params);
|
|
81
|
-
|
|
82
|
-
body = formData;
|
|
83
|
-
if (additionalParams) {
|
|
84
|
-
for (let index = 0; index < additionalParams.length; index++) {
|
|
85
|
-
const element = additionalParams[index];
|
|
86
|
-
formData.append(element.name, '' + element.value);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
} else {
|
|
90
|
-
headers.append('Content-Type', 'application/json');
|
|
91
|
-
body = JSON.stringify(params);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
const requestInit = {
|
|
96
|
-
body,
|
|
97
|
-
method: method,
|
|
98
|
-
mode: 'cors',
|
|
99
|
-
cache: 'no-cache',
|
|
100
|
-
credentials: 'include',
|
|
101
|
-
headers,
|
|
102
|
-
signal: abortController.signal
|
|
103
|
-
} as RequestInit;
|
|
104
|
-
|
|
105
|
-
const labels = this.labels;
|
|
106
|
-
const status_401 = this.status_401;
|
|
107
|
-
const status_403 = this.status_403;
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
return await fetch(encodeURI(url), requestInit)
|
|
111
|
-
.then(response => {
|
|
112
|
-
// Others Status Code
|
|
113
|
-
if (response.status < 200 || response.status >= 300)
|
|
114
|
-
throw response;
|
|
115
|
-
|
|
116
|
-
return isBlobInReturn ? response.blob() : response.json();
|
|
117
|
-
})
|
|
118
|
-
.then(json => {
|
|
119
|
-
return json;
|
|
120
|
-
})
|
|
121
|
-
.catch(async error => {
|
|
122
|
-
console.warn(`Error on fetch url: ${url}`, error);
|
|
123
|
-
|
|
124
|
-
if (!error || error?.message === 'Failed to fetch')
|
|
125
|
-
throw new Error(labels?.errorServerNotAvailable);
|
|
126
|
-
|
|
127
|
-
// This is an error coming from BE
|
|
128
|
-
if (error.status === 401 && status_401) {
|
|
129
|
-
await status_401();
|
|
130
|
-
} else if (error.status === 403 && status_403) {
|
|
131
|
-
await status_403();
|
|
132
|
-
} else if (onGenericServerError) {
|
|
133
|
-
onGenericServerError(error.status, error);
|
|
134
|
-
}
|
|
135
|
-
else {
|
|
136
|
-
if (!error.text) {
|
|
137
|
-
if (error.status === 400) {
|
|
138
|
-
throw labels?.errorBadRequest;
|
|
139
|
-
} else if (error.status === 401 || error.status === 403) {
|
|
140
|
-
throw labels?.errorSessionExpired;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
else
|
|
144
|
-
return error.text();
|
|
145
|
-
|
|
146
|
-
if (error.message && error.message !== '')
|
|
147
|
-
throw error.message;
|
|
148
|
-
|
|
149
|
-
throw labels?.errorGeneric;
|
|
150
|
-
}
|
|
151
|
-
})
|
|
152
|
-
.then(finalMessage => {
|
|
153
|
-
if (typeof (finalMessage) === 'object')
|
|
154
|
-
return finalMessage;
|
|
155
|
-
|
|
156
|
-
if (finalMessage)
|
|
157
|
-
throw finalMessage;
|
|
158
|
-
|
|
159
|
-
throw labels?.errorGeneric ?? 'Error';
|
|
160
|
-
})
|
|
161
|
-
.finally(() => {
|
|
162
|
-
clearTimeout(timeoutId);
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
catch (error) {
|
|
166
|
-
if (onGenericServerError && (error as any)?.status)
|
|
167
|
-
onGenericServerError((error as any)?.status, error);
|
|
168
|
-
|
|
169
|
-
throw error;
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
export default FetchWrapper;
|