@cranberry-money/shared-constants 5.1.1 → 8.0.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.
Files changed (76) hide show
  1. package/dist/api/auth.d.ts +12 -28
  2. package/dist/api/auth.d.ts.map +1 -1
  3. package/dist/api/auth.js +14 -32
  4. package/dist/api/config.d.ts.map +1 -1
  5. package/dist/api/config.js +11 -8
  6. package/dist/business/bank-accounts.d.ts +10 -17
  7. package/dist/business/bank-accounts.d.ts.map +1 -1
  8. package/dist/business/bank-accounts.js +16 -24
  9. package/dist/business/documents.d.ts +6 -12
  10. package/dist/business/documents.d.ts.map +1 -1
  11. package/dist/business/documents.js +11 -11
  12. package/dist/business/holdings.d.ts +34 -0
  13. package/dist/business/holdings.d.ts.map +1 -0
  14. package/dist/business/holdings.js +34 -0
  15. package/dist/business/index.d.ts +1 -0
  16. package/dist/business/index.d.ts.map +1 -1
  17. package/dist/business/index.js +2 -0
  18. package/dist/business/status/banks.d.ts +6 -0
  19. package/dist/business/status/banks.d.ts.map +1 -1
  20. package/dist/business/status/banks.js +6 -0
  21. package/dist/business/status/cash-accounts.d.ts.map +1 -1
  22. package/dist/business/status/cash-accounts.js +4 -3
  23. package/dist/business/status/documents.d.ts +7 -16
  24. package/dist/business/status/documents.d.ts.map +1 -1
  25. package/dist/business/status/documents.js +13 -14
  26. package/dist/business/status/portfolios.d.ts +6 -0
  27. package/dist/business/status/portfolios.d.ts.map +1 -1
  28. package/dist/business/status/portfolios.js +6 -0
  29. package/dist/business/status/trades.d.ts +26 -39
  30. package/dist/business/status/trades.d.ts.map +1 -1
  31. package/dist/business/status/trades.js +41 -32
  32. package/dist/business/status/withdrawals.d.ts +34 -62
  33. package/dist/business/status/withdrawals.d.ts.map +1 -1
  34. package/dist/business/status/withdrawals.js +61 -40
  35. package/dist/common/index.d.ts +2 -0
  36. package/dist/common/index.d.ts.map +1 -0
  37. package/dist/common/index.js +1 -0
  38. package/dist/common/statuses.d.ts +18 -0
  39. package/dist/common/statuses.d.ts.map +1 -0
  40. package/dist/common/statuses.js +17 -0
  41. package/dist/config/defaults.d.ts +68 -0
  42. package/dist/config/defaults.d.ts.map +1 -0
  43. package/dist/config/defaults.js +66 -0
  44. package/dist/config/index.d.ts +8 -0
  45. package/dist/config/index.d.ts.map +1 -0
  46. package/dist/config/index.js +7 -0
  47. package/dist/config/pagination.d.ts +28 -0
  48. package/dist/config/pagination.d.ts.map +1 -0
  49. package/dist/config/pagination.js +40 -0
  50. package/dist/config/thresholds.d.ts +65 -0
  51. package/dist/config/thresholds.d.ts.map +1 -0
  52. package/dist/config/thresholds.js +82 -0
  53. package/dist/financial/currency.d.ts +7 -0
  54. package/dist/financial/currency.d.ts.map +1 -1
  55. package/dist/financial/currency.js +7 -1
  56. package/dist/financial/formatting.d.ts +1 -1
  57. package/dist/financial/formatting.d.ts.map +1 -1
  58. package/dist/financial/formatting.js +20 -32
  59. package/dist/index.d.ts +2 -0
  60. package/dist/index.d.ts.map +1 -1
  61. package/dist/index.js +4 -0
  62. package/dist/ui/colors.d.ts +10 -10
  63. package/dist/ui/colors.d.ts.map +1 -1
  64. package/dist/ui/colors.js +28 -25
  65. package/dist/ui/index.d.ts +1 -0
  66. package/dist/ui/index.d.ts.map +1 -1
  67. package/dist/ui/index.js +1 -0
  68. package/dist/ui/status-colors-unified.d.ts +91 -0
  69. package/dist/ui/status-colors-unified.d.ts.map +1 -0
  70. package/dist/ui/status-colors-unified.js +106 -0
  71. package/dist/utilities/common.d.ts +10 -20
  72. package/dist/utilities/common.d.ts.map +1 -1
  73. package/dist/utilities/common.js +14 -31
  74. package/dist/utilities/defaults.d.ts.map +1 -1
  75. package/dist/utilities/defaults.js +35 -28
  76. package/package.json +1 -1
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Unified default values
3
+ * Consolidates common default values used across the application
4
+ */
5
+ /**
6
+ * Default string values
7
+ */
8
+ export const DEFAULT_STRINGS = {
9
+ EMPTY: '',
10
+ UNKNOWN: 'Unknown',
11
+ NOT_APPLICABLE: 'N/A',
12
+ ERROR_MESSAGE: 'An error occurred',
13
+ ZERO: '0',
14
+ NULL_UUID: '00000000-0000-0000-0000-000000000000',
15
+ };
16
+ /**
17
+ * Default numeric values
18
+ */
19
+ export const DEFAULT_NUMBERS = {
20
+ ZERO: 0,
21
+ PRECISION: 2,
22
+ PERCENTAGE_PRECISION: 2,
23
+ QUANTITY_PRECISION: 6,
24
+ };
25
+ /**
26
+ * Locale configuration
27
+ */
28
+ export const LOCALE_CONFIG = {
29
+ DEFAULT: 'en-AU',
30
+ FALLBACK: 'en-US',
31
+ SUPPORTED: ['en-AU', 'en-US', 'en-GB'],
32
+ };
33
+ /**
34
+ * Default allocation values
35
+ */
36
+ export const CONFIG_ALLOCATION_DEFAULTS = {
37
+ DEFAULT_PERCENTAGE: 10,
38
+ PERCENTAGE_PRECISION: 0.01,
39
+ TARGET_TOTAL: 100,
40
+ };
41
+ /**
42
+ * Default format options for number formatting
43
+ */
44
+ export const DEFAULT_FORMAT_OPTIONS = {
45
+ CURRENCY: {
46
+ style: 'currency',
47
+ minimumFractionDigits: DEFAULT_NUMBERS.PRECISION,
48
+ maximumFractionDigits: DEFAULT_NUMBERS.PRECISION,
49
+ },
50
+ CURRENCY_SIGNED: {
51
+ style: 'currency',
52
+ minimumFractionDigits: DEFAULT_NUMBERS.PRECISION,
53
+ maximumFractionDigits: DEFAULT_NUMBERS.PRECISION,
54
+ signDisplay: 'always',
55
+ },
56
+ PERCENTAGE: {
57
+ style: 'percent',
58
+ minimumFractionDigits: 0,
59
+ maximumFractionDigits: DEFAULT_NUMBERS.PERCENTAGE_PRECISION,
60
+ },
61
+ DECIMAL: {
62
+ style: 'decimal',
63
+ minimumFractionDigits: 0,
64
+ maximumFractionDigits: 8,
65
+ },
66
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Configuration constants module
3
+ * Exports all configuration-related constants
4
+ */
5
+ export * from './pagination';
6
+ export * from './thresholds';
7
+ export * from './defaults';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Configuration constants module
3
+ * Exports all configuration-related constants
4
+ */
5
+ export * from './pagination';
6
+ export * from './thresholds';
7
+ export * from './defaults';
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Unified pagination configuration constants
3
+ * Consolidates pagination settings from multiple locations
4
+ */
5
+ /**
6
+ * Pagination configuration
7
+ * Single source of truth for all pagination-related constants
8
+ */
9
+ export declare const PAGINATION_CONFIG: {
10
+ readonly DEFAULT_PAGE: 1;
11
+ readonly DEFAULT_PAGE_SIZE: 20;
12
+ readonly MIN_PAGE_SIZE: 1;
13
+ readonly MAX_PAGE_SIZE: 100;
14
+ readonly PAGE_SIZE_OPTIONS: readonly [10, 20, 50, 100];
15
+ readonly DEFAULT_SORT_ORDER: "desc";
16
+ };
17
+ export type PageSizeOption = (typeof PAGINATION_CONFIG.PAGE_SIZE_OPTIONS)[number];
18
+ /**
19
+ * Get validated page size
20
+ * Ensures page size is within allowed limits
21
+ */
22
+ export declare const getValidPageSize: (pageSize: number) => number;
23
+ /**
24
+ * Get validated page number
25
+ * Ensures page number is at least 1
26
+ */
27
+ export declare const getValidPageNumber: (page: number) => number;
28
+ //# sourceMappingURL=pagination.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/config/pagination.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;GAGG;AACH,eAAO,MAAM,iBAAiB;;;;;;;CAcpB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAElF;;;GAGG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAU,MAAM,KAAG,MAQnD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,KAAG,MAEjD,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Unified pagination configuration constants
3
+ * Consolidates pagination settings from multiple locations
4
+ */
5
+ /**
6
+ * Pagination configuration
7
+ * Single source of truth for all pagination-related constants
8
+ */
9
+ export const PAGINATION_CONFIG = {
10
+ // Default values
11
+ DEFAULT_PAGE: 1,
12
+ DEFAULT_PAGE_SIZE: 20,
13
+ // Limits
14
+ MIN_PAGE_SIZE: 1,
15
+ MAX_PAGE_SIZE: 100,
16
+ // Common page size options for dropdowns
17
+ PAGE_SIZE_OPTIONS: [10, 20, 50, 100],
18
+ // Default sort order
19
+ DEFAULT_SORT_ORDER: 'desc',
20
+ };
21
+ /**
22
+ * Get validated page size
23
+ * Ensures page size is within allowed limits
24
+ */
25
+ export const getValidPageSize = (pageSize) => {
26
+ if (pageSize < PAGINATION_CONFIG.MIN_PAGE_SIZE) {
27
+ return PAGINATION_CONFIG.MIN_PAGE_SIZE;
28
+ }
29
+ if (pageSize > PAGINATION_CONFIG.MAX_PAGE_SIZE) {
30
+ return PAGINATION_CONFIG.MAX_PAGE_SIZE;
31
+ }
32
+ return pageSize;
33
+ };
34
+ /**
35
+ * Get validated page number
36
+ * Ensures page number is at least 1
37
+ */
38
+ export const getValidPageNumber = (page) => {
39
+ return Math.max(PAGINATION_CONFIG.DEFAULT_PAGE, page);
40
+ };
@@ -0,0 +1,65 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,82 @@
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
+ };
@@ -17,6 +17,13 @@ export type CurrencyCode = (typeof CURRENCY_CODES)[keyof typeof CURRENCY_CODES];
17
17
  export declare const CURRENCY_SYMBOLS: Record<CurrencyCode, string>;
18
18
  export declare const CURRENCY_NAMES: Record<CurrencyCode, string>;
19
19
  export declare const CURRENCY_DECIMALS: Record<CurrencyCode, number>;
20
+ /**
21
+ * Default currency for the platform
22
+ * @intentional-duplicate AUD value appears in multiple places
23
+ * @reason Different semantic purposes - DEFAULT_CURRENCY sets platform default,
24
+ * CURRENCY_AUD defines the currency code constant
25
+ * @see INTENTIONAL-DUPLICATES.md
26
+ */
20
27
  export declare const DEFAULT_CURRENCY: "AUD";
21
28
  export declare const CURRENCY_OPTIONS: {
22
29
  value: string;
@@ -1 +1 @@
1
- {"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../src/financial/currency.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,cAAc;;;;;;;;;;;CAWjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAGhF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAWhD,CAAC;AAGX,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAW9C,CAAC;AAGX,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAWjD,CAAC;AAGX,eAAO,MAAM,gBAAgB,OAAqB,CAAC;AAGnD,eAAO,MAAM,gBAAgB;;;GAG1B,CAAC;AAGJ,eAAO,MAAM,YAAY,OAAqB,CAAC;AAC/C,eAAO,MAAM,YAAY,OAAqB,CAAC;AAC/C,eAAO,MAAM,YAAY,OAAqB,CAAC;AAC/C,eAAO,MAAM,YAAY,OAAqB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,QAAqC,CAAC;AACrE,eAAO,MAAM,kBAAkB,QAAqC,CAAC"}
1
+ {"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../src/financial/currency.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,cAAc;;;;;;;;;;;CAWjB,CAAC;AAEX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAGhF,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAWhD,CAAC;AAGX,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAW9C,CAAC;AAGX,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAWjD,CAAC;AAEX;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,OAAqB,CAAC;AAGnD,eAAO,MAAM,gBAAgB;;;GAG1B,CAAC;AAGJ,eAAO,MAAM,YAAY,OAAqB,CAAC;AAC/C,eAAO,MAAM,YAAY,OAAqB,CAAC;AAC/C,eAAO,MAAM,YAAY,OAAqB,CAAC;AAC/C,eAAO,MAAM,YAAY,OAAqB,CAAC;AAC/C,eAAO,MAAM,kBAAkB,QAAqC,CAAC;AACrE,eAAO,MAAM,kBAAkB,QAAqC,CAAC"}
@@ -53,7 +53,13 @@ export const CURRENCY_DECIMALS = {
53
53
  [CURRENCY_CODES.SGD]: 2,
54
54
  [CURRENCY_CODES.HKD]: 2,
55
55
  };
56
- // Default currency
56
+ /**
57
+ * Default currency for the platform
58
+ * @intentional-duplicate AUD value appears in multiple places
59
+ * @reason Different semantic purposes - DEFAULT_CURRENCY sets platform default,
60
+ * CURRENCY_AUD defines the currency code constant
61
+ * @see INTENTIONAL-DUPLICATES.md
62
+ */
57
63
  export const DEFAULT_CURRENCY = CURRENCY_CODES.AUD;
58
64
  // Currency options for forms
59
65
  export const CURRENCY_OPTIONS = Object.entries(CURRENCY_NAMES).map(([code, name]) => ({
@@ -29,7 +29,7 @@ export declare const FORMATTING_OPTIONS: {
29
29
  readonly PERCENTAGE: {
30
30
  readonly style: "percent";
31
31
  readonly minimumFractionDigits: 0;
32
- readonly maximumFractionDigits: 4;
32
+ readonly maximumFractionDigits: 2;
33
33
  };
34
34
  readonly DECIMAL: {
35
35
  readonly style: "decimal";
@@ -1 +1 @@
1
- {"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/financial/formatting.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAkBjB,CAAC;AAGX,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;CAgBrB,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;;;;CASrB,CAAC;AAGX,eAAO,MAAM,qBAAqB;;;;CAIxB,CAAC"}
1
+ {"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/financial/formatting.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,eAAO,MAAM,cAAc;;;;;;;;;;;;;CAkBjB,CAAC;AAIX,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAIX,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;CAIrB,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;;;;CASrB,CAAC;AAIX,eAAO,MAAM,qBAAqB;;;;CAAuB,CAAC"}
@@ -1,13 +1,14 @@
1
1
  /**
2
2
  * Financial formatting constants
3
3
  */
4
+ import { COMMON_THRESHOLDS, LOCALE_CONFIG, DEFAULT_FORMAT_OPTIONS, NUMBER_ABBREVIATIONS } from '../config';
4
5
  // Number formatting
5
6
  export const NUMBER_FORMATS = {
6
7
  // Decimal places
7
- CURRENCY_DECIMALS: 2,
8
- PERCENTAGE_DECIMALS: 2,
9
- QUANTITY_DECIMALS: 6,
10
- PRICE_DECIMALS: 4,
8
+ CURRENCY_DECIMALS: COMMON_THRESHOLDS.CURRENCY_DECIMALS,
9
+ PERCENTAGE_DECIMALS: COMMON_THRESHOLDS.PERCENTAGE_DECIMALS,
10
+ QUANTITY_DECIMALS: COMMON_THRESHOLDS.QUANTITY_DECIMALS,
11
+ PRICE_DECIMALS: COMMON_THRESHOLDS.PRICE_DECIMALS,
11
12
  // Minimum decimal places
12
13
  MIN_CURRENCY_DECIMALS: 2,
13
14
  MIN_PERCENTAGE_DECIMALS: 0,
@@ -20,42 +21,29 @@ export const NUMBER_FORMATS = {
20
21
  MAX_PRICE_DECIMALS: 6,
21
22
  };
22
23
  // Locale settings
24
+ // Now references consolidated locale config
23
25
  export const LOCALE_SETTINGS = {
24
- DEFAULT: 'en-AU',
25
- FALLBACK: 'en-US',
26
- SUPPORTED: ['en-AU', 'en-US', 'en-GB'],
26
+ DEFAULT: LOCALE_CONFIG.DEFAULT,
27
+ FALLBACK: LOCALE_CONFIG.FALLBACK,
28
+ SUPPORTED: LOCALE_CONFIG.SUPPORTED,
27
29
  };
28
30
  // Formatting options
31
+ // Partially references consolidated options
29
32
  export const FORMATTING_OPTIONS = {
30
- CURRENCY: {
31
- style: 'currency',
32
- minimumFractionDigits: NUMBER_FORMATS.MIN_CURRENCY_DECIMALS,
33
- maximumFractionDigits: NUMBER_FORMATS.MAX_CURRENCY_DECIMALS,
34
- },
35
- PERCENTAGE: {
36
- style: 'percent',
37
- minimumFractionDigits: NUMBER_FORMATS.MIN_PERCENTAGE_DECIMALS,
38
- maximumFractionDigits: NUMBER_FORMATS.MAX_PERCENTAGE_DECIMALS,
39
- },
40
- DECIMAL: {
41
- style: 'decimal',
42
- minimumFractionDigits: 0,
43
- maximumFractionDigits: 8,
44
- },
33
+ CURRENCY: DEFAULT_FORMAT_OPTIONS.CURRENCY,
34
+ PERCENTAGE: DEFAULT_FORMAT_OPTIONS.PERCENTAGE,
35
+ DECIMAL: DEFAULT_FORMAT_OPTIONS.DECIMAL,
45
36
  };
46
37
  // Display thresholds
47
38
  export const DISPLAY_THRESHOLDS = {
48
39
  // Values below these thresholds show as "< threshold"
49
- MIN_DISPLAY_AMOUNT: 0.01,
50
- MIN_DISPLAY_PERCENTAGE: 0.01,
40
+ MIN_DISPLAY_AMOUNT: COMMON_THRESHOLDS.MIN_DISPLAY_AMOUNT,
41
+ MIN_DISPLAY_PERCENTAGE: COMMON_THRESHOLDS.MIN_DISPLAY_PERCENTAGE,
51
42
  // Large number abbreviations
52
- THOUSAND: 1000,
53
- MILLION: 1000000,
54
- BILLION: 1000000000,
43
+ THOUSAND: COMMON_THRESHOLDS.THOUSAND,
44
+ MILLION: COMMON_THRESHOLDS.MILLION,
45
+ BILLION: COMMON_THRESHOLDS.BILLION,
55
46
  };
56
47
  // Abbreviation suffixes
57
- export const ABBREVIATION_SUFFIXES = {
58
- THOUSAND: 'K',
59
- MILLION: 'M',
60
- BILLION: 'B',
61
- };
48
+ // @deprecated Use NUMBER_ABBREVIATIONS from config/thresholds instead
49
+ export const ABBREVIATION_SUFFIXES = NUMBER_ABBREVIATIONS;
package/dist/index.d.ts CHANGED
@@ -9,4 +9,6 @@ export * from './business';
9
9
  export * from './financial';
10
10
  export * from './ui';
11
11
  export * from './utilities';
12
+ export * from './common';
13
+ export * from './config';
12
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,OAAO,CAAC;AAGtB,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,MAAM,CAAC;AAGrB,cAAc,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,OAAO,CAAC;AAGtB,cAAc,YAAY,CAAC;AAG3B,cAAc,aAAa,CAAC;AAG5B,cAAc,MAAM,CAAC;AAGrB,cAAc,aAAa,CAAC;AAG5B,cAAc,UAAU,CAAC;AAGzB,cAAc,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -14,3 +14,7 @@ export * from './financial';
14
14
  export * from './ui';
15
15
  // Utility constants
16
16
  export * from './utilities';
17
+ // Common shared constants
18
+ export * from './common';
19
+ // Configuration constants
20
+ export * from './config';
@@ -10,16 +10,16 @@ export declare const STATUS_COLORS: {
10
10
  readonly NEUTRAL: "text-gray-600";
11
11
  };
12
12
  export type StatusColor = (typeof STATUS_COLORS)[keyof typeof STATUS_COLORS];
13
- export declare const STATUS_COLOR_PENDING = "text-warning-600";
14
- export declare const STATUS_COLOR_AWAITING = "text-warning-600";
15
- export declare const STATUS_COLOR_PROCESSING = "text-primary-600";
16
- export declare const STATUS_COLOR_IN_PROGRESS = "text-primary-600";
17
- export declare const STATUS_COLOR_APPROVED = "text-success-600";
18
- export declare const STATUS_COLOR_COMPLETED = "text-success-700";
19
- export declare const STATUS_COLOR_REJECTED = "text-error-600";
20
- export declare const STATUS_COLOR_FAILED = "text-error-700";
21
- export declare const STATUS_COLOR_CANCELLED = "text-content-subtle";
22
- export declare const STATUS_COLOR_DEFAULT = "text-content-subtle";
13
+ export declare const STATUS_COLOR_PENDING: "text-warning-600";
14
+ export declare const STATUS_COLOR_AWAITING: "text-warning-600";
15
+ export declare const STATUS_COLOR_PROCESSING: "text-primary-600";
16
+ export declare const STATUS_COLOR_IN_PROGRESS: "text-primary-600";
17
+ export declare const STATUS_COLOR_APPROVED: "text-success-600";
18
+ export declare const STATUS_COLOR_COMPLETED: "text-success-700";
19
+ export declare const STATUS_COLOR_REJECTED: "text-error-600";
20
+ export declare const STATUS_COLOR_FAILED: "text-error-700";
21
+ export declare const STATUS_COLOR_CANCELLED: "text-content-subtle";
22
+ export declare const STATUS_COLOR_DEFAULT: "text-content-subtle";
23
23
  export declare const STATUS_BG_COLORS: {
24
24
  readonly SUCCESS: "bg-green-50";
25
25
  readonly WARNING: "bg-amber-50";
@@ -1 +1 @@
1
- {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/ui/colors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,eAAO,MAAM,YAAY,yHAWf,CAAC;AAGX,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAG7E,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AACvD,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AACxD,eAAO,MAAM,uBAAuB,qBAAqB,CAAC;AAC1D,eAAO,MAAM,wBAAwB,qBAAqB,CAAC;AAC3D,eAAO,MAAM,qBAAqB,qBAAqB,CAAC;AACxD,eAAO,MAAM,sBAAsB,qBAAqB,CAAC;AACzD,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AACtD,eAAO,MAAM,mBAAmB,mBAAmB,CAAC;AACpD,eAAO,MAAM,sBAAsB,wBAAwB,CAAC;AAC5D,eAAO,MAAM,oBAAoB,wBAAwB,CAAC;AAG1D,eAAO,MAAM,gBAAgB;;;;;;CAMnB,CAAC;AAGX,eAAO,MAAM,YAAY;;;;;;;CAOf,CAAC;AAGX,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAGX,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqB/C,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAE7C,CAAC"}
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/ui/colors.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH,eAAO,MAAM,YAAY,yHAWf,CAAC;AAGX,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC;AAI7E,eAAO,MAAM,oBAAoB,oBAAgC,CAAC;AAClE,eAAO,MAAM,qBAAqB,oBAAiC,CAAC;AACpE,eAAO,MAAM,uBAAuB,oBAAmC,CAAC;AACxE,eAAO,MAAM,wBAAwB,oBAAoC,CAAC;AAC1E,eAAO,MAAM,qBAAqB,oBAAiC,CAAC;AACpE,eAAO,MAAM,sBAAsB,oBAAkC,CAAC;AACtE,eAAO,MAAM,qBAAqB,kBAAiC,CAAC;AACpE,eAAO,MAAM,mBAAmB,kBAA+B,CAAC;AAChE,eAAO,MAAM,sBAAsB,uBAAkC,CAAC;AACtE,eAAO,MAAM,oBAAoB,uBAAgC,CAAC;AAGlE,eAAO,MAAM,gBAAgB;;;;;;CAMnB,CAAC;AAGX,eAAO,MAAM,YAAY;;;;;;;CAOf,CAAC;AAGX,eAAO,MAAM,eAAe;;;;CAIlB,CAAC;AAGX,eAAO,MAAM,kBAAkB;;;;CAIrB,CAAC;AAIX,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqB/C,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAE7C,CAAC"}
package/dist/ui/colors.js CHANGED
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * UI color constants
3
3
  */
4
+ import { UNIFIED_STATUS_COLORS } from './status-colors-unified';
4
5
  // Chart color palette (10 colors for data visualization) - Blueberry compatible
5
6
  export const CHART_COLORS = [
6
7
  '#3B82F6', // Blue - primary data color
@@ -23,16 +24,17 @@ export const STATUS_COLORS = {
23
24
  NEUTRAL: 'text-gray-600',
24
25
  };
25
26
  // Individual status color constants for Blueberry compatibility
26
- export const STATUS_COLOR_PENDING = 'text-warning-600';
27
- export const STATUS_COLOR_AWAITING = 'text-warning-600';
28
- export const STATUS_COLOR_PROCESSING = 'text-primary-600';
29
- export const STATUS_COLOR_IN_PROGRESS = 'text-primary-600';
30
- export const STATUS_COLOR_APPROVED = 'text-success-600';
31
- export const STATUS_COLOR_COMPLETED = 'text-success-700';
32
- export const STATUS_COLOR_REJECTED = 'text-error-600';
33
- export const STATUS_COLOR_FAILED = 'text-error-700';
34
- export const STATUS_COLOR_CANCELLED = 'text-content-subtle';
35
- export const STATUS_COLOR_DEFAULT = 'text-content-subtle';
27
+ // Now referencing unified color mappings
28
+ export const STATUS_COLOR_PENDING = UNIFIED_STATUS_COLORS.pending;
29
+ export const STATUS_COLOR_AWAITING = UNIFIED_STATUS_COLORS.awaiting;
30
+ export const STATUS_COLOR_PROCESSING = UNIFIED_STATUS_COLORS.processing;
31
+ export const STATUS_COLOR_IN_PROGRESS = UNIFIED_STATUS_COLORS.in_progress;
32
+ export const STATUS_COLOR_APPROVED = UNIFIED_STATUS_COLORS.approved;
33
+ export const STATUS_COLOR_COMPLETED = UNIFIED_STATUS_COLORS.completed;
34
+ export const STATUS_COLOR_REJECTED = UNIFIED_STATUS_COLORS.rejected;
35
+ export const STATUS_COLOR_FAILED = UNIFIED_STATUS_COLORS.failed;
36
+ export const STATUS_COLOR_CANCELLED = UNIFIED_STATUS_COLORS.cancelled;
37
+ export const STATUS_COLOR_DEFAULT = UNIFIED_STATUS_COLORS.default;
36
38
  // Background status colors
37
39
  export const STATUS_BG_COLORS = {
38
40
  SUCCESS: 'bg-green-50',
@@ -63,25 +65,26 @@ export const PERFORMANCE_COLORS = {
63
65
  UNCHANGED: SEMANTIC_COLORS.NEUTRAL,
64
66
  };
65
67
  // Trading status colors
68
+ // @deprecated Use getStatusColor() from status-colors-unified instead
66
69
  export const TRADING_STATUS_COLORS = {
67
70
  // Trade statuses
68
- PENDING: STATUS_COLORS.WARNING,
69
- EXECUTED: STATUS_COLORS.SUCCESS,
70
- SETTLED: STATUS_COLORS.SUCCESS,
71
- CANCELLED: STATUS_COLORS.NEUTRAL,
72
- FAILED: STATUS_COLORS.ERROR,
73
- EXPIRED: STATUS_COLORS.NEUTRAL,
74
- REJECTED: STATUS_COLORS.ERROR,
71
+ PENDING: UNIFIED_STATUS_COLORS.pending,
72
+ EXECUTED: UNIFIED_STATUS_COLORS.executed,
73
+ SETTLED: UNIFIED_STATUS_COLORS.settled,
74
+ CANCELLED: UNIFIED_STATUS_COLORS.cancelled,
75
+ FAILED: UNIFIED_STATUS_COLORS.failed,
76
+ EXPIRED: UNIFIED_STATUS_COLORS.expired,
77
+ REJECTED: UNIFIED_STATUS_COLORS.rejected,
75
78
  // Withdrawal statuses
76
- PENDING_REVIEW: STATUS_COLORS.WARNING,
77
- APPROVED: STATUS_COLORS.SUCCESS,
78
- COMPLETED: STATUS_COLORS.SUCCESS,
79
- PROCESSING: STATUS_COLORS.INFO,
80
- ON_HOLD: STATUS_COLORS.WARNING,
79
+ PENDING_REVIEW: UNIFIED_STATUS_COLORS.pending_review,
80
+ APPROVED: UNIFIED_STATUS_COLORS.approved,
81
+ COMPLETED: UNIFIED_STATUS_COLORS.completed,
82
+ PROCESSING: UNIFIED_STATUS_COLORS.processing,
83
+ ON_HOLD: UNIFIED_STATUS_COLORS.on_hold,
81
84
  // Portfolio statuses
82
- ACTIVE: STATUS_COLORS.SUCCESS,
83
- INACTIVE: STATUS_COLORS.WARNING,
84
- CLOSED: STATUS_COLORS.NEUTRAL,
85
+ ACTIVE: UNIFIED_STATUS_COLORS.active,
86
+ INACTIVE: UNIFIED_STATUS_COLORS.inactive,
87
+ CLOSED: UNIFIED_STATUS_COLORS.closed,
85
88
  };
86
89
  /**
87
90
  * Get chart color by index (cycles through palette)
@@ -4,4 +4,5 @@
4
4
  export * from './colors';
5
5
  export * from './display';
6
6
  export * from './labels';
7
+ export * from './status-colors-unified';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,yBAAyB,CAAC"}
package/dist/ui/index.js CHANGED
@@ -4,3 +4,4 @@
4
4
  export * from './colors';
5
5
  export * from './display';
6
6
  export * from './labels';
7
+ export * from './status-colors-unified';