@cranberry-money/shared-constants 5.0.0 → 5.1.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.
Files changed (81) hide show
  1. package/dist/api/auth.d.ts +28 -12
  2. package/dist/api/auth.d.ts.map +1 -1
  3. package/dist/api/auth.js +32 -14
  4. package/dist/api/config.d.ts.map +1 -1
  5. package/dist/api/config.js +8 -11
  6. package/dist/business/accounts.d.ts +1 -1
  7. package/dist/business/accounts.d.ts.map +1 -1
  8. package/dist/business/accounts.js +2 -3
  9. package/dist/business/bank-accounts.d.ts +17 -10
  10. package/dist/business/bank-accounts.d.ts.map +1 -1
  11. package/dist/business/bank-accounts.js +24 -16
  12. package/dist/business/documents.d.ts +12 -6
  13. package/dist/business/documents.d.ts.map +1 -1
  14. package/dist/business/documents.js +11 -11
  15. package/dist/business/index.d.ts +0 -1
  16. package/dist/business/index.d.ts.map +1 -1
  17. package/dist/business/index.js +0 -2
  18. package/dist/business/status/banks.d.ts +0 -6
  19. package/dist/business/status/banks.d.ts.map +1 -1
  20. package/dist/business/status/banks.js +0 -6
  21. package/dist/business/status/cash-accounts.d.ts.map +1 -1
  22. package/dist/business/status/cash-accounts.js +3 -4
  23. package/dist/business/status/documents.d.ts +4 -4
  24. package/dist/business/status/documents.d.ts.map +1 -1
  25. package/dist/business/status/documents.js +10 -9
  26. package/dist/business/status/portfolios.d.ts +0 -6
  27. package/dist/business/status/portfolios.d.ts.map +1 -1
  28. package/dist/business/status/portfolios.js +0 -6
  29. package/dist/business/status/trades.d.ts +12 -15
  30. package/dist/business/status/trades.d.ts.map +1 -1
  31. package/dist/business/status/trades.js +29 -33
  32. package/dist/business/status/withdrawals.d.ts +19 -18
  33. package/dist/business/status/withdrawals.d.ts.map +1 -1
  34. package/dist/business/status/withdrawals.js +28 -40
  35. package/dist/financial/currency.d.ts +0 -16
  36. package/dist/financial/currency.d.ts.map +1 -1
  37. package/dist/financial/currency.js +10 -25
  38. package/dist/financial/formatting.d.ts +1 -1
  39. package/dist/financial/formatting.d.ts.map +1 -1
  40. package/dist/financial/formatting.js +32 -20
  41. package/dist/index.d.ts +0 -2
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +0 -4
  44. package/dist/ui/colors.d.ts +10 -10
  45. package/dist/ui/colors.d.ts.map +1 -1
  46. package/dist/ui/colors.js +25 -28
  47. package/dist/ui/index.d.ts +0 -1
  48. package/dist/ui/index.d.ts.map +1 -1
  49. package/dist/ui/index.js +0 -1
  50. package/dist/utilities/common.d.ts +20 -10
  51. package/dist/utilities/common.d.ts.map +1 -1
  52. package/dist/utilities/common.js +31 -14
  53. package/dist/utilities/defaults.d.ts.map +1 -1
  54. package/dist/utilities/defaults.js +28 -35
  55. package/dist/utilities/validation.d.ts.map +1 -1
  56. package/dist/utilities/validation.js +2 -3
  57. package/package.json +1 -1
  58. package/dist/business/holdings.d.ts +0 -34
  59. package/dist/business/holdings.d.ts.map +0 -1
  60. package/dist/business/holdings.js +0 -34
  61. package/dist/common/index.d.ts +0 -2
  62. package/dist/common/index.d.ts.map +0 -1
  63. package/dist/common/index.js +0 -1
  64. package/dist/common/statuses.d.ts +0 -20
  65. package/dist/common/statuses.d.ts.map +0 -1
  66. package/dist/common/statuses.js +0 -19
  67. package/dist/config/defaults.d.ts +0 -79
  68. package/dist/config/defaults.d.ts.map +0 -1
  69. package/dist/config/defaults.js +0 -77
  70. package/dist/config/index.d.ts +0 -8
  71. package/dist/config/index.d.ts.map +0 -1
  72. package/dist/config/index.js +0 -7
  73. package/dist/config/pagination.d.ts +0 -28
  74. package/dist/config/pagination.d.ts.map +0 -1
  75. package/dist/config/pagination.js +0 -40
  76. package/dist/config/thresholds.d.ts +0 -65
  77. package/dist/config/thresholds.d.ts.map +0 -1
  78. package/dist/config/thresholds.js +0 -82
  79. package/dist/ui/status-colors-unified.d.ts +0 -91
  80. package/dist/ui/status-colors-unified.d.ts.map +0 -1
  81. package/dist/ui/status-colors-unified.js +0 -106
@@ -1,65 +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 declare const COMMON_THRESHOLDS: {
9
- readonly THOUSAND: 1000;
10
- readonly MILLION: 1000000;
11
- readonly BILLION: 1000000000;
12
- readonly DEFAULT_DECIMALS: 2;
13
- readonly CURRENCY_DECIMALS: 2;
14
- readonly PERCENTAGE_DECIMALS: 2;
15
- readonly QUANTITY_DECIMALS: 6;
16
- readonly PRICE_DECIMALS: 4;
17
- readonly MAX_NAME_LENGTH: 100;
18
- readonly MAX_DESCRIPTION_LENGTH: 500;
19
- readonly MAX_NOTES_LENGTH: 1000;
20
- readonly MIN_PASSWORD_LENGTH: 8;
21
- readonly MAX_FILE_SIZE_MB: 10;
22
- readonly MAX_FILE_NAME_LENGTH: 255;
23
- readonly MIN_PORTFOLIO_VALUE: 1000;
24
- readonly MIN_TRADE_AMOUNT: 10;
25
- readonly MIN_WITHDRAWAL_AMOUNT: 100;
26
- readonly MAX_PORTFOLIOS_PER_USER: 10;
27
- readonly MAX_TRADES_PER_DAY: 100;
28
- readonly MIN_DISPLAY_AMOUNT: 0.01;
29
- readonly MIN_DISPLAY_PERCENTAGE: 0.01;
30
- readonly DEFAULT_TIMEOUT_MS: 30000;
31
- readonly DEFAULT_RETRY_ATTEMPTS: 3;
32
- readonly DEFAULT_RETRY_DELAY_MS: 1000;
33
- readonly MAX_RETRY_DELAY_MS: 10000;
34
- readonly REQUEST_DEBOUNCE_MS: 300;
35
- };
36
- /**
37
- * Numeric ranges for validation
38
- */
39
- export declare const NUMERIC_RANGES: {
40
- readonly AMOUNT: {
41
- readonly MIN: 0;
42
- readonly MAX: 999999999.99;
43
- };
44
- readonly PERCENTAGE: {
45
- readonly MIN: 0;
46
- readonly MAX: 100;
47
- };
48
- readonly QUANTITY: {
49
- readonly MIN: 0;
50
- readonly MAX: 999999999.999999;
51
- };
52
- };
53
- /**
54
- * Format a number with thousand separators
55
- */
56
- export declare const formatWithThousandSeparator: (value: number) => string;
57
- /**
58
- * Abbreviation suffixes for large numbers
59
- */
60
- export declare const NUMBER_ABBREVIATIONS: {
61
- readonly THOUSAND: "K";
62
- readonly MILLION: "M";
63
- readonly BILLION: "B";
64
- };
65
- //# sourceMappingURL=thresholds.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"thresholds.d.ts","sourceRoot":"","sources":["../../src/config/thresholds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCpB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAajB,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,2BAA2B,GAAI,OAAO,MAAM,KAAG,MAW3D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB;;;;CAIvB,CAAC"}
@@ -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
- };