@cranberry-money/shared-constants 4.15.0 → 5.1.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.
- package/dist/api/auth.d.ts +28 -12
- package/dist/api/auth.d.ts.map +1 -1
- package/dist/api/auth.js +39 -18
- package/dist/api/config.d.ts.map +1 -1
- package/dist/api/config.js +15 -15
- package/dist/api/endpoints.js +31 -28
- package/dist/api/http.js +9 -6
- package/dist/api/index.js +20 -4
- package/dist/business/accounts.d.ts +1 -1
- package/dist/business/accounts.d.ts.map +1 -1
- package/dist/business/accounts.js +37 -35
- package/dist/business/bank-accounts.d.ts +17 -10
- package/dist/business/bank-accounts.d.ts.map +1 -1
- package/dist/business/bank-accounts.js +63 -51
- package/dist/business/banking.js +29 -26
- package/dist/business/countries.js +6 -3
- package/dist/business/documents.d.ts +12 -6
- package/dist/business/documents.d.ts.map +1 -1
- package/dist/business/documents.js +46 -43
- package/dist/business/index.d.ts +0 -1
- package/dist/business/index.d.ts.map +1 -1
- package/dist/business/index.js +74 -14
- package/dist/business/industries.js +5 -2
- package/dist/business/investments.js +56 -53
- package/dist/business/status/banks.d.ts +0 -6
- package/dist/business/status/banks.d.ts.map +1 -1
- package/dist/business/status/banks.js +14 -17
- package/dist/business/status/cash-accounts.d.ts.map +1 -1
- package/dist/business/status/cash-accounts.js +39 -37
- package/dist/business/status/documents.d.ts +4 -4
- package/dist/business/status/documents.d.ts.map +1 -1
- package/dist/business/status/documents.js +28 -24
- package/dist/business/status/index.js +23 -7
- package/dist/business/status/instruments.js +24 -21
- package/dist/business/status/portfolios.d.ts +0 -6
- package/dist/business/status/portfolios.d.ts.map +1 -1
- package/dist/business/status/portfolios.js +8 -11
- package/dist/business/status/trades.d.ts +12 -15
- package/dist/business/status/trades.d.ts.map +1 -1
- package/dist/business/status/trades.js +89 -90
- package/dist/business/status/withdrawals.d.ts +19 -18
- package/dist/business/status/withdrawals.d.ts.map +1 -1
- package/dist/business/status/withdrawals.js +102 -111
- package/dist/business/trading.js +26 -23
- package/dist/financial/currency.d.ts +0 -16
- package/dist/financial/currency.d.ts.map +1 -1
- package/dist/financial/currency.js +46 -58
- package/dist/financial/formatting.d.ts +1 -1
- package/dist/financial/formatting.d.ts.map +1 -1
- package/dist/financial/formatting.js +39 -24
- package/dist/financial/index.js +19 -3
- package/dist/financial/instruments.js +28 -25
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +21 -9
- package/dist/ui/colors.d.ts +10 -10
- package/dist/ui/colors.d.ts.map +1 -1
- package/dist/ui/colors.js +41 -40
- package/dist/ui/display.js +23 -20
- package/dist/ui/index.d.ts +0 -1
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +19 -4
- package/dist/ui/labels/index.js +49 -15
- package/dist/utilities/common.d.ts +20 -10
- package/dist/utilities/common.d.ts.map +1 -1
- package/dist/utilities/common.js +36 -16
- package/dist/utilities/defaults.d.ts.map +1 -1
- package/dist/utilities/defaults.js +37 -41
- package/dist/utilities/index.js +21 -5
- package/dist/utilities/sorting.js +16 -13
- package/dist/utilities/time.js +12 -9
- package/dist/utilities/validation.d.ts.map +1 -1
- package/dist/utilities/validation.js +8 -6
- package/package.json +1 -1
- package/dist/business/holdings.d.ts +0 -34
- package/dist/business/holdings.d.ts.map +0 -1
- package/dist/business/holdings.js +0 -34
- package/dist/common/index.d.ts +0 -2
- package/dist/common/index.d.ts.map +0 -1
- package/dist/common/index.js +0 -1
- package/dist/common/statuses.d.ts +0 -20
- package/dist/common/statuses.d.ts.map +0 -1
- package/dist/common/statuses.js +0 -19
- package/dist/config/defaults.d.ts +0 -79
- package/dist/config/defaults.d.ts.map +0 -1
- package/dist/config/defaults.js +0 -77
- package/dist/config/index.d.ts +0 -8
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -7
- package/dist/config/pagination.d.ts +0 -28
- package/dist/config/pagination.d.ts.map +0 -1
- package/dist/config/pagination.js +0 -40
- package/dist/config/thresholds.d.ts +0 -65
- package/dist/config/thresholds.d.ts.map +0 -1
- package/dist/config/thresholds.js +0 -82
- package/dist/ui/status-colors-unified.d.ts +0 -91
- package/dist/ui/status-colors-unified.d.ts.map +0 -1
- package/dist/ui/status-colors-unified.js +0 -106
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified threshold and limit constants
|
|
3
|
-
* Consolidates numeric thresholds, limits, and common values
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Common numeric thresholds used across the application
|
|
7
|
-
*/
|
|
8
|
-
export const COMMON_THRESHOLDS = {
|
|
9
|
-
// Base units
|
|
10
|
-
THOUSAND: 1000,
|
|
11
|
-
MILLION: 1000000,
|
|
12
|
-
BILLION: 1000000000,
|
|
13
|
-
// Decimal places
|
|
14
|
-
DEFAULT_DECIMALS: 2,
|
|
15
|
-
CURRENCY_DECIMALS: 2,
|
|
16
|
-
PERCENTAGE_DECIMALS: 2,
|
|
17
|
-
QUANTITY_DECIMALS: 6,
|
|
18
|
-
PRICE_DECIMALS: 4,
|
|
19
|
-
// String lengths
|
|
20
|
-
MAX_NAME_LENGTH: 100,
|
|
21
|
-
MAX_DESCRIPTION_LENGTH: 500,
|
|
22
|
-
MAX_NOTES_LENGTH: 1000,
|
|
23
|
-
MIN_PASSWORD_LENGTH: 8,
|
|
24
|
-
// File limits
|
|
25
|
-
MAX_FILE_SIZE_MB: 10,
|
|
26
|
-
MAX_FILE_NAME_LENGTH: 255,
|
|
27
|
-
// Business limits
|
|
28
|
-
MIN_PORTFOLIO_VALUE: 1000,
|
|
29
|
-
MIN_TRADE_AMOUNT: 10,
|
|
30
|
-
MIN_WITHDRAWAL_AMOUNT: 100,
|
|
31
|
-
MAX_PORTFOLIOS_PER_USER: 10,
|
|
32
|
-
MAX_TRADES_PER_DAY: 100,
|
|
33
|
-
// Display thresholds
|
|
34
|
-
MIN_DISPLAY_AMOUNT: 0.01,
|
|
35
|
-
MIN_DISPLAY_PERCENTAGE: 0.01,
|
|
36
|
-
// API/Network
|
|
37
|
-
DEFAULT_TIMEOUT_MS: 30000, // 30 seconds
|
|
38
|
-
DEFAULT_RETRY_ATTEMPTS: 3,
|
|
39
|
-
DEFAULT_RETRY_DELAY_MS: 1000, // 1 second
|
|
40
|
-
MAX_RETRY_DELAY_MS: 10000, // 10 seconds
|
|
41
|
-
REQUEST_DEBOUNCE_MS: 300,
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Numeric ranges for validation
|
|
45
|
-
*/
|
|
46
|
-
export const NUMERIC_RANGES = {
|
|
47
|
-
AMOUNT: {
|
|
48
|
-
MIN: 0,
|
|
49
|
-
MAX: 999999999.99,
|
|
50
|
-
},
|
|
51
|
-
PERCENTAGE: {
|
|
52
|
-
MIN: 0,
|
|
53
|
-
MAX: 100,
|
|
54
|
-
},
|
|
55
|
-
QUANTITY: {
|
|
56
|
-
MIN: 0,
|
|
57
|
-
MAX: 999999999.999999,
|
|
58
|
-
},
|
|
59
|
-
};
|
|
60
|
-
/**
|
|
61
|
-
* Format a number with thousand separators
|
|
62
|
-
*/
|
|
63
|
-
export const formatWithThousandSeparator = (value) => {
|
|
64
|
-
if (value >= COMMON_THRESHOLDS.BILLION) {
|
|
65
|
-
return `${(value / COMMON_THRESHOLDS.BILLION).toFixed(1)}B`;
|
|
66
|
-
}
|
|
67
|
-
if (value >= COMMON_THRESHOLDS.MILLION) {
|
|
68
|
-
return `${(value / COMMON_THRESHOLDS.MILLION).toFixed(1)}M`;
|
|
69
|
-
}
|
|
70
|
-
if (value >= COMMON_THRESHOLDS.THOUSAND) {
|
|
71
|
-
return `${(value / COMMON_THRESHOLDS.THOUSAND).toFixed(1)}K`;
|
|
72
|
-
}
|
|
73
|
-
return value.toString();
|
|
74
|
-
};
|
|
75
|
-
/**
|
|
76
|
-
* Abbreviation suffixes for large numbers
|
|
77
|
-
*/
|
|
78
|
-
export const NUMBER_ABBREVIATIONS = {
|
|
79
|
-
THOUSAND: 'K',
|
|
80
|
-
MILLION: 'M',
|
|
81
|
-
BILLION: 'B',
|
|
82
|
-
};
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified status color mappings
|
|
3
|
-
* Consolidates duplicate color assignments for consistent UI styling
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Unified mapping of status states to Tailwind CSS color classes
|
|
7
|
-
* Groups similar states that should have the same visual treatment
|
|
8
|
-
*/
|
|
9
|
-
export declare const UNIFIED_STATUS_COLORS: {
|
|
10
|
-
readonly pending: "text-warning-600";
|
|
11
|
-
readonly awaiting: "text-warning-600";
|
|
12
|
-
readonly pending_review: "text-warning-600";
|
|
13
|
-
readonly on_hold: "text-warning-600";
|
|
14
|
-
readonly processing: "text-primary-600";
|
|
15
|
-
readonly in_progress: "text-primary-600";
|
|
16
|
-
readonly active: "text-primary-600";
|
|
17
|
-
readonly completed: "text-success-700";
|
|
18
|
-
readonly approved: "text-success-600";
|
|
19
|
-
readonly executed: "text-success-600";
|
|
20
|
-
readonly settled: "text-success-600";
|
|
21
|
-
readonly success: "text-success-600";
|
|
22
|
-
readonly failed: "text-error-700";
|
|
23
|
-
readonly rejected: "text-error-600";
|
|
24
|
-
readonly error: "text-error-600";
|
|
25
|
-
readonly cancelled: "text-content-subtle";
|
|
26
|
-
readonly expired: "text-content-subtle";
|
|
27
|
-
readonly inactive: "text-content-subtle";
|
|
28
|
-
readonly closed: "text-content-subtle";
|
|
29
|
-
readonly default: "text-content-subtle";
|
|
30
|
-
};
|
|
31
|
-
export type StatusColorKey = keyof typeof UNIFIED_STATUS_COLORS;
|
|
32
|
-
export type StatusColorValue = (typeof UNIFIED_STATUS_COLORS)[StatusColorKey];
|
|
33
|
-
/**
|
|
34
|
-
* Get color class for a status
|
|
35
|
-
* @param status - The status key (lowercase)
|
|
36
|
-
* @returns The Tailwind CSS color class
|
|
37
|
-
*/
|
|
38
|
-
export declare const getStatusColor: (status: string) => string;
|
|
39
|
-
/**
|
|
40
|
-
* Background color variants for status states
|
|
41
|
-
* Uses lighter shades for backgrounds
|
|
42
|
-
*/
|
|
43
|
-
export declare const UNIFIED_STATUS_BG_COLORS: {
|
|
44
|
-
readonly pending: "bg-warning-50";
|
|
45
|
-
readonly awaiting: "bg-warning-50";
|
|
46
|
-
readonly pending_review: "bg-warning-50";
|
|
47
|
-
readonly on_hold: "bg-warning-50";
|
|
48
|
-
readonly processing: "bg-primary-50";
|
|
49
|
-
readonly in_progress: "bg-primary-50";
|
|
50
|
-
readonly active: "bg-primary-50";
|
|
51
|
-
readonly completed: "bg-success-50";
|
|
52
|
-
readonly approved: "bg-success-50";
|
|
53
|
-
readonly executed: "bg-success-50";
|
|
54
|
-
readonly settled: "bg-success-50";
|
|
55
|
-
readonly success: "bg-success-50";
|
|
56
|
-
readonly failed: "bg-error-50";
|
|
57
|
-
readonly rejected: "bg-error-50";
|
|
58
|
-
readonly error: "bg-error-50";
|
|
59
|
-
readonly cancelled: "bg-gray-50";
|
|
60
|
-
readonly expired: "bg-gray-50";
|
|
61
|
-
readonly inactive: "bg-gray-50";
|
|
62
|
-
readonly closed: "bg-gray-50";
|
|
63
|
-
readonly default: "bg-gray-50";
|
|
64
|
-
};
|
|
65
|
-
/**
|
|
66
|
-
* Badge color combinations (background + text)
|
|
67
|
-
* For use in status badges and pills
|
|
68
|
-
*/
|
|
69
|
-
export declare const UNIFIED_STATUS_BADGE_COLORS: {
|
|
70
|
-
readonly pending: "bg-warning-100 text-warning-700";
|
|
71
|
-
readonly awaiting: "bg-warning-100 text-warning-700";
|
|
72
|
-
readonly pending_review: "bg-warning-100 text-warning-700";
|
|
73
|
-
readonly on_hold: "bg-warning-100 text-warning-700";
|
|
74
|
-
readonly processing: "bg-primary-100 text-primary-700";
|
|
75
|
-
readonly in_progress: "bg-primary-100 text-primary-700";
|
|
76
|
-
readonly active: "bg-primary-100 text-primary-700";
|
|
77
|
-
readonly completed: "bg-success-100 text-success-700";
|
|
78
|
-
readonly approved: "bg-success-100 text-success-700";
|
|
79
|
-
readonly executed: "bg-success-100 text-success-700";
|
|
80
|
-
readonly settled: "bg-success-100 text-success-700";
|
|
81
|
-
readonly success: "bg-success-100 text-success-700";
|
|
82
|
-
readonly failed: "bg-error-100 text-error-700";
|
|
83
|
-
readonly rejected: "bg-error-100 text-error-700";
|
|
84
|
-
readonly error: "bg-error-100 text-error-700";
|
|
85
|
-
readonly cancelled: "bg-gray-100 text-gray-700";
|
|
86
|
-
readonly expired: "bg-gray-100 text-gray-700";
|
|
87
|
-
readonly inactive: "bg-gray-100 text-gray-700";
|
|
88
|
-
readonly closed: "bg-gray-100 text-gray-700";
|
|
89
|
-
readonly default: "bg-gray-100 text-gray-700";
|
|
90
|
-
};
|
|
91
|
-
//# sourceMappingURL=status-colors-unified.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status-colors-unified.d.ts","sourceRoot":"","sources":["../../src/ui/status-colors-unified.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;CA8BxB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAChE,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,cAAc,CAAC,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,MAG/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;CA8B3B,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;CA8B9B,CAAC"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unified status color mappings
|
|
3
|
-
* Consolidates duplicate color assignments for consistent UI styling
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Unified mapping of status states to Tailwind CSS color classes
|
|
7
|
-
* Groups similar states that should have the same visual treatment
|
|
8
|
-
*/
|
|
9
|
-
export const UNIFIED_STATUS_COLORS = {
|
|
10
|
-
// Pending/Waiting states - Warning color (amber/yellow)
|
|
11
|
-
pending: 'text-warning-600',
|
|
12
|
-
awaiting: 'text-warning-600',
|
|
13
|
-
pending_review: 'text-warning-600',
|
|
14
|
-
on_hold: 'text-warning-600',
|
|
15
|
-
// Processing/Active states - Primary color (blue)
|
|
16
|
-
processing: 'text-primary-600',
|
|
17
|
-
in_progress: 'text-primary-600',
|
|
18
|
-
active: 'text-primary-600',
|
|
19
|
-
// Success states - Success color (green)
|
|
20
|
-
completed: 'text-success-700',
|
|
21
|
-
approved: 'text-success-600',
|
|
22
|
-
executed: 'text-success-600',
|
|
23
|
-
settled: 'text-success-600',
|
|
24
|
-
success: 'text-success-600',
|
|
25
|
-
// Error states - Error color (red)
|
|
26
|
-
failed: 'text-error-700',
|
|
27
|
-
rejected: 'text-error-600',
|
|
28
|
-
error: 'text-error-600',
|
|
29
|
-
// Neutral/Cancelled states - Subtle color (gray)
|
|
30
|
-
cancelled: 'text-content-subtle',
|
|
31
|
-
expired: 'text-content-subtle',
|
|
32
|
-
inactive: 'text-content-subtle',
|
|
33
|
-
closed: 'text-content-subtle',
|
|
34
|
-
default: 'text-content-subtle',
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Get color class for a status
|
|
38
|
-
* @param status - The status key (lowercase)
|
|
39
|
-
* @returns The Tailwind CSS color class
|
|
40
|
-
*/
|
|
41
|
-
export const getStatusColor = (status) => {
|
|
42
|
-
const normalizedStatus = status.toLowerCase().replace(/_/g, '_');
|
|
43
|
-
return UNIFIED_STATUS_COLORS[normalizedStatus] || UNIFIED_STATUS_COLORS.default;
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Background color variants for status states
|
|
47
|
-
* Uses lighter shades for backgrounds
|
|
48
|
-
*/
|
|
49
|
-
export const UNIFIED_STATUS_BG_COLORS = {
|
|
50
|
-
// Pending/Waiting states
|
|
51
|
-
pending: 'bg-warning-50',
|
|
52
|
-
awaiting: 'bg-warning-50',
|
|
53
|
-
pending_review: 'bg-warning-50',
|
|
54
|
-
on_hold: 'bg-warning-50',
|
|
55
|
-
// Processing/Active states
|
|
56
|
-
processing: 'bg-primary-50',
|
|
57
|
-
in_progress: 'bg-primary-50',
|
|
58
|
-
active: 'bg-primary-50',
|
|
59
|
-
// Success states
|
|
60
|
-
completed: 'bg-success-50',
|
|
61
|
-
approved: 'bg-success-50',
|
|
62
|
-
executed: 'bg-success-50',
|
|
63
|
-
settled: 'bg-success-50',
|
|
64
|
-
success: 'bg-success-50',
|
|
65
|
-
// Error states
|
|
66
|
-
failed: 'bg-error-50',
|
|
67
|
-
rejected: 'bg-error-50',
|
|
68
|
-
error: 'bg-error-50',
|
|
69
|
-
// Neutral/Cancelled states
|
|
70
|
-
cancelled: 'bg-gray-50',
|
|
71
|
-
expired: 'bg-gray-50',
|
|
72
|
-
inactive: 'bg-gray-50',
|
|
73
|
-
closed: 'bg-gray-50',
|
|
74
|
-
default: 'bg-gray-50',
|
|
75
|
-
};
|
|
76
|
-
/**
|
|
77
|
-
* Badge color combinations (background + text)
|
|
78
|
-
* For use in status badges and pills
|
|
79
|
-
*/
|
|
80
|
-
export const UNIFIED_STATUS_BADGE_COLORS = {
|
|
81
|
-
// Pending/Waiting states
|
|
82
|
-
pending: 'bg-warning-100 text-warning-700',
|
|
83
|
-
awaiting: 'bg-warning-100 text-warning-700',
|
|
84
|
-
pending_review: 'bg-warning-100 text-warning-700',
|
|
85
|
-
on_hold: 'bg-warning-100 text-warning-700',
|
|
86
|
-
// Processing/Active states
|
|
87
|
-
processing: 'bg-primary-100 text-primary-700',
|
|
88
|
-
in_progress: 'bg-primary-100 text-primary-700',
|
|
89
|
-
active: 'bg-primary-100 text-primary-700',
|
|
90
|
-
// Success states
|
|
91
|
-
completed: 'bg-success-100 text-success-700',
|
|
92
|
-
approved: 'bg-success-100 text-success-700',
|
|
93
|
-
executed: 'bg-success-100 text-success-700',
|
|
94
|
-
settled: 'bg-success-100 text-success-700',
|
|
95
|
-
success: 'bg-success-100 text-success-700',
|
|
96
|
-
// Error states
|
|
97
|
-
failed: 'bg-error-100 text-error-700',
|
|
98
|
-
rejected: 'bg-error-100 text-error-700',
|
|
99
|
-
error: 'bg-error-100 text-error-700',
|
|
100
|
-
// Neutral/Cancelled states
|
|
101
|
-
cancelled: 'bg-gray-100 text-gray-700',
|
|
102
|
-
expired: 'bg-gray-100 text-gray-700',
|
|
103
|
-
inactive: 'bg-gray-100 text-gray-700',
|
|
104
|
-
closed: 'bg-gray-100 text-gray-700',
|
|
105
|
-
default: 'bg-gray-100 text-gray-700',
|
|
106
|
-
};
|