@cranberry-money/shared-constants 1.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.
package/README.md ADDED
@@ -0,0 +1,115 @@
1
+ # @myportfolio/shared-constants
2
+
3
+ Shared constants for the MyPortfolio platform, supporting both web (Blueberry) and mobile (Blackberry) applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @myportfolio/shared-constants
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ```typescript
14
+ import {
15
+ CURRENCY_AUD,
16
+ DEFAULT_CURRENCY,
17
+ CHART_COLORS,
18
+ getChartColor,
19
+ TIME_RANGES
20
+ } from '@myportfolio/shared-constants';
21
+
22
+ // Currency constants
23
+ const defaultCurr = DEFAULT_CURRENCY; // 'AUD'
24
+
25
+ // Chart colors for data visualization
26
+ const portfolioColors = allocations.map((_, i) => getChartColor(i));
27
+
28
+ // Time range configurations
29
+ const availableRanges = TIME_RANGES; // [{ label: '1W', value: '1W', days: 7 }, ...]
30
+ ```
31
+
32
+ ## Available Constants
33
+
34
+ ### Common (`common.ts`)
35
+ - Number formatting: `DECIMAL_PLACES`, quantity thresholds
36
+ - Error types: `ERROR_TYPE_BUSINESS_LOGIC`, `ERROR_TYPE_PERMISSION`, etc.
37
+ - Sort directions: `SORT_DIRECTION_ASC`, `SORT_DIRECTION_DESC`
38
+ - Locale settings: `LOCALE_AUSTRALIA`
39
+
40
+ ### Currency (`currency.ts`)
41
+ - Currency codes: `CURRENCY_AUD`, `CURRENCY_USD`
42
+ - Default currency: `DEFAULT_CURRENCY`
43
+ - Currency info: `CURRENCIES` array with symbols and names
44
+ - Helper: `getCurrencyInfo(code)` function
45
+
46
+ ### HTTP (`http.ts`)
47
+ - HTTP headers: `HTTP_HEADER_CONTENT_TYPE`
48
+ - Content types: `CONTENT_TYPE_APPLICATION_JSON`
49
+
50
+ ### Time (`time.ts`)
51
+ - Time calculations: `MILLISECONDS_PER_DAY`
52
+ - Default periods: `DEFAULT_RECENT_TRANSACTIONS_DAYS`
53
+ - Time ranges: `TIME_RANGES` array with configurations
54
+ - Types: `TimeRange`, `TimeRangeConfig`
55
+
56
+ ### UI Colors (`ui/colors.ts`)
57
+ - Chart color palette: `CHART_COLORS` array
58
+ - Dynamic color selection: `getChartColor(index)` function
59
+
60
+ ### UI Status (`ui/status.ts`)
61
+ - Status type mappings: `STATUS_STATES` object
62
+ - Platform-agnostic colors: `STATUS_COLORS` with hex values
63
+ - Types: `StatusType`
64
+
65
+ ## Platform Compatibility
66
+
67
+ This package is designed to work across:
68
+ - Web applications (React) - Direct import of constants
69
+ - Mobile applications (React Native) - Platform-agnostic hex colors and values
70
+ - Node.js environments - For server-side consistency
71
+
72
+ ### Platform-Specific Adaptations
73
+
74
+ #### Web (Tailwind CSS)
75
+ ```typescript
76
+ import { STATUS_COLORS } from '@myportfolio/shared-constants';
77
+
78
+ // Adapt hex colors to Tailwind classes
79
+ const statusClasses = {
80
+ pending: 'text-warning-600',
81
+ success: 'text-success-600',
82
+ // ... map STATUS_COLORS to your design system
83
+ };
84
+ ```
85
+
86
+ #### Mobile (React Native)
87
+ ```typescript
88
+ import { STATUS_COLORS, CHART_COLORS } from '@myportfolio/shared-constants';
89
+
90
+ const styles = StyleSheet.create({
91
+ pendingStatus: {
92
+ color: STATUS_COLORS.pending, // Direct hex usage
93
+ },
94
+ chartData: {
95
+ backgroundColor: CHART_COLORS[0], // Direct hex usage
96
+ },
97
+ });
98
+ ```
99
+
100
+ ## Development
101
+
102
+ ```bash
103
+ # Build the package
104
+ npm run build
105
+
106
+ # Watch for changes
107
+ npm run dev
108
+
109
+ # Type check
110
+ npm run typecheck
111
+ ```
112
+
113
+ ## License
114
+
115
+ MIT
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Common shared constants for the MyPortfolio platform.
3
+ *
4
+ * Contains truly universal constants that don't fit into specific domains.
5
+ */
6
+ export declare const DECIMAL_PLACES = 2;
7
+ export declare const DEFAULT_NUMERIC_ZERO = 0;
8
+ export declare const DEFAULT_EMPTY_STRING = "";
9
+ export declare const QUANTITY_FORMAT_THRESHOLD_MILLION = 1000000;
10
+ export declare const QUANTITY_FORMAT_THRESHOLD_THOUSAND = 1000;
11
+ export declare const ERROR_TYPE_BUSINESS_LOGIC = "business_logic";
12
+ export declare const ERROR_TYPE_PERMISSION = "permission";
13
+ export declare const ERROR_TYPE_SERVER = "server";
14
+ export declare const SORT_DIRECTION_ASC = "asc";
15
+ export declare const SORT_DIRECTION_DESC = "desc";
16
+ export type SortDirection = typeof SORT_DIRECTION_ASC | typeof SORT_DIRECTION_DESC;
17
+ export declare const LOCALE_AUSTRALIA = "en-AU";
18
+ export declare const NUMBER_FORMAT_OPTIONS_CURRENCY: {
19
+ readonly style: "currency";
20
+ readonly minimumFractionDigits: 2;
21
+ readonly maximumFractionDigits: 2;
22
+ };
23
+ export declare const NUMBER_FORMAT_OPTIONS_CURRENCY_SIGNED: {
24
+ readonly signDisplay: "always";
25
+ readonly style: "currency";
26
+ readonly minimumFractionDigits: 2;
27
+ readonly maximumFractionDigits: 2;
28
+ };
29
+ export declare const QUERY_PARAM_ORDER_BY = "order_by";
30
+ export declare const ORDER_BY_CREATED_AT = "created_at";
31
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../src/common.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,eAAO,MAAM,cAAc,IAAI,CAAC;AAGhC,eAAO,MAAM,oBAAoB,IAAI,CAAC;AACtC,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAGvC,eAAO,MAAM,iCAAiC,UAAU,CAAC;AACzD,eAAO,MAAM,kCAAkC,OAAO,CAAC;AAGvD,eAAO,MAAM,yBAAyB,mBAAmB,CAAC;AAC1D,eAAO,MAAM,qBAAqB,eAAe,CAAC;AAClD,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAG1C,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AACxC,eAAO,MAAM,mBAAmB,SAAS,CAAC;AAE1C,MAAM,MAAM,aAAa,GAAG,OAAO,kBAAkB,GAAG,OAAO,mBAAmB,CAAC;AAGnF,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAGxC,eAAO,MAAM,8BAA8B;;;;CAIjC,CAAC;AAEX,eAAO,MAAM,qCAAqC;;;;;CAGxC,CAAC;AAGX,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAC/C,eAAO,MAAM,mBAAmB,eAAe,CAAC"}
package/dist/common.js ADDED
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Common shared constants for the MyPortfolio platform.
3
+ *
4
+ * Contains truly universal constants that don't fit into specific domains.
5
+ */
6
+ // Number formatting
7
+ export const DECIMAL_PLACES = 2;
8
+ // Default numeric values
9
+ export const DEFAULT_NUMERIC_ZERO = 0;
10
+ export const DEFAULT_EMPTY_STRING = '';
11
+ // Quantity formatting thresholds
12
+ export const QUANTITY_FORMAT_THRESHOLD_MILLION = 1000000;
13
+ export const QUANTITY_FORMAT_THRESHOLD_THOUSAND = 1000;
14
+ // Error types
15
+ export const ERROR_TYPE_BUSINESS_LOGIC = 'business_logic';
16
+ export const ERROR_TYPE_PERMISSION = 'permission';
17
+ export const ERROR_TYPE_SERVER = 'server';
18
+ // Sort directions
19
+ export const SORT_DIRECTION_ASC = 'asc';
20
+ export const SORT_DIRECTION_DESC = 'desc';
21
+ // Locale and formatting constants
22
+ export const LOCALE_AUSTRALIA = 'en-AU';
23
+ // Number formatting options
24
+ export const NUMBER_FORMAT_OPTIONS_CURRENCY = {
25
+ style: 'currency',
26
+ minimumFractionDigits: DECIMAL_PLACES,
27
+ maximumFractionDigits: DECIMAL_PLACES,
28
+ };
29
+ export const NUMBER_FORMAT_OPTIONS_CURRENCY_SIGNED = {
30
+ ...NUMBER_FORMAT_OPTIONS_CURRENCY,
31
+ signDisplay: 'always',
32
+ };
33
+ // Query parameter constants
34
+ export const QUERY_PARAM_ORDER_BY = 'order_by';
35
+ export const ORDER_BY_CREATED_AT = 'created_at';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Currency-related constants for the MyPortfolio platform.
3
+ *
4
+ * These constants should match backend constants where applicable.
5
+ */
6
+ export declare const CURRENCY_AUD = "AUD";
7
+ export declare const CURRENCY_USD = "USD";
8
+ export declare const DEFAULT_CURRENCY = "AUD";
9
+ export declare const CURRENCY_LABEL_AUD = "Australian Dollar";
10
+ export declare const CURRENCY_LABEL_USD = "US Dollar";
11
+ export type CurrencyCode = typeof CURRENCY_AUD | typeof CURRENCY_USD;
12
+ export interface CurrencyInfo {
13
+ code: CurrencyCode;
14
+ name: string;
15
+ symbol: string;
16
+ }
17
+ export declare const CURRENCIES: CurrencyInfo[];
18
+ export declare const getCurrencyInfo: (code: CurrencyCode) => CurrencyInfo | undefined;
19
+ //# sourceMappingURL=currency.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../src/currency.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,eAAO,MAAM,YAAY,QAAQ,CAAC;AAClC,eAAO,MAAM,YAAY,QAAQ,CAAC;AAGlC,eAAO,MAAM,gBAAgB,QAAe,CAAC;AAG7C,eAAO,MAAM,kBAAkB,sBAAsB,CAAC;AACtD,eAAO,MAAM,kBAAkB,cAAc,CAAC;AAG9C,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,GAAG,OAAO,YAAY,CAAC;AAGrE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAChB;AAGD,eAAO,MAAM,UAAU,EAAE,YAAY,EAGpC,CAAC;AAGF,eAAO,MAAM,eAAe,GAAI,MAAM,YAAY,KAAG,YAAY,GAAG,SAEnE,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Currency-related constants for the MyPortfolio platform.
3
+ *
4
+ * These constants should match backend constants where applicable.
5
+ */
6
+ // Currency constants - ISO 4217 codes
7
+ export const CURRENCY_AUD = 'AUD';
8
+ export const CURRENCY_USD = 'USD';
9
+ // Default currency
10
+ export const DEFAULT_CURRENCY = CURRENCY_AUD;
11
+ // Currency label constants
12
+ export const CURRENCY_LABEL_AUD = 'Australian Dollar';
13
+ export const CURRENCY_LABEL_USD = 'US Dollar';
14
+ // Available currencies with display information
15
+ export const CURRENCIES = [
16
+ { code: CURRENCY_AUD, name: CURRENCY_LABEL_AUD, symbol: 'A$' },
17
+ { code: CURRENCY_USD, name: CURRENCY_LABEL_USD, symbol: '$' },
18
+ ];
19
+ // Helper function to get currency info by code
20
+ export const getCurrencyInfo = (code) => {
21
+ return CURRENCIES.find((currency) => currency.code === code);
22
+ };
package/dist/http.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ /**
2
+ * HTTP and network-related constants for the MyPortfolio platform.
3
+ *
4
+ * Contains HTTP headers, content types, and other network-related constants.
5
+ */
6
+ export declare const HTTP_HEADER_CONTENT_TYPE = "Content-Type";
7
+ export declare const CONTENT_TYPE_APPLICATION_JSON = "application/json";
8
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,eAAO,MAAM,wBAAwB,iBAAiB,CAAC;AAGvD,eAAO,MAAM,6BAA6B,qBAAqB,CAAC"}
package/dist/http.js ADDED
@@ -0,0 +1,9 @@
1
+ /**
2
+ * HTTP and network-related constants for the MyPortfolio platform.
3
+ *
4
+ * Contains HTTP headers, content types, and other network-related constants.
5
+ */
6
+ // HTTP Headers
7
+ export const HTTP_HEADER_CONTENT_TYPE = 'Content-Type';
8
+ // Content Types
9
+ export const CONTENT_TYPE_APPLICATION_JSON = 'application/json';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Centralized export of all shared constants
3
+ */
4
+ export * from './common';
5
+ export * from './time';
6
+ export * from './currency';
7
+ export * from './http';
8
+ export * from './ui';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AAGvB,cAAc,MAAM,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Centralized export of all shared constants
3
+ */
4
+ // Re-export shared constants
5
+ export * from './common';
6
+ export * from './time';
7
+ export * from './currency';
8
+ export * from './http';
9
+ // Re-export UI constants
10
+ export * from './ui';
package/dist/time.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Time and time range constants for the MyPortfolio platform.
3
+ *
4
+ * Contains time-related constants for formatting, intervals, calculations,
5
+ * and time ranges used for charts, analytics, and filtering data by time periods.
6
+ */
7
+ export declare const MILLISECONDS_PER_DAY: number;
8
+ export declare const DEFAULT_RECENT_TRANSACTIONS_DAYS = 30;
9
+ export declare const DATE_ISO_TIME_SEPARATOR = "T";
10
+ export type TimeRange = '1W' | '1M' | '6M' | '1Y' | '3Y' | '5Y' | '10Y';
11
+ export interface TimeRangeConfig {
12
+ label: string;
13
+ value: TimeRange;
14
+ days: number;
15
+ }
16
+ export declare const TIME_RANGES: TimeRangeConfig[];
17
+ //# sourceMappingURL=time.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"time.d.ts","sourceRoot":"","sources":["../src/time.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,eAAO,MAAM,oBAAoB,QAAsB,CAAC;AAGxD,eAAO,MAAM,gCAAgC,KAAK,CAAC;AAGnD,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAG3C,MAAM,MAAM,SAAS,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,KAAK,CAAC;AAGxE,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;CACd;AAGD,eAAO,MAAM,WAAW,EAAE,eAAe,EAQxC,CAAC"}
package/dist/time.js ADDED
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Time and time range constants for the MyPortfolio platform.
3
+ *
4
+ * Contains time-related constants for formatting, intervals, calculations,
5
+ * and time ranges used for charts, analytics, and filtering data by time periods.
6
+ */
7
+ // Time unit constants (in milliseconds) - only used constants
8
+ export const MILLISECONDS_PER_DAY = 24 * 60 * 60 * 1000;
9
+ // Default time periods - only used constants
10
+ export const DEFAULT_RECENT_TRANSACTIONS_DAYS = 30;
11
+ // Date format patterns
12
+ export const DATE_ISO_TIME_SEPARATOR = 'T';
13
+ // Time range configurations with labels and day counts
14
+ export const TIME_RANGES = [
15
+ { label: '1W', value: '1W', days: 7 },
16
+ { label: '1M', value: '1M', days: 30 },
17
+ { label: '6M', value: '6M', days: 180 },
18
+ { label: '1Y', value: '1Y', days: 365 },
19
+ { label: '3Y', value: '3Y', days: 1095 },
20
+ { label: '5Y', value: '5Y', days: 1825 },
21
+ { label: '10Y', value: '10Y', days: 3650 },
22
+ ];
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Chart colors for data visualizations
3
+ *
4
+ * This file provides programmatic access to chart colors for JavaScript/TypeScript code.
5
+ * These colors are specifically designed for data visualization and chart components.
6
+ *
7
+ * Usage:
8
+ * - Use CHART_COLORS array for static color assignments
9
+ * - Use getChartColor() function for dynamic color cycling
10
+ * - These can be adapted for platform-specific color systems
11
+ *
12
+ * For UI element styling:
13
+ * - Web: Use Tailwind classes (bg-surface-primary, text-content-primary, etc.)
14
+ * - Mobile: Adapt to React Native StyleSheet or theme system
15
+ */
16
+ /**
17
+ * Chart color palette for data visualizations
18
+ *
19
+ * These colors are carefully selected for:
20
+ * - Visual distinction in charts and graphs
21
+ * - Accessibility and contrast
22
+ * - Brand consistency
23
+ */
24
+ export declare const CHART_COLORS: readonly ["#3B82F6", "#EF4444", "#10B981", "#F59E0B", "#8B5CF6", "#EC4899", "#06B6D4", "#84CC16", "#F97316", "#6366F1"];
25
+ /**
26
+ * Get a chart color by index with automatic cycling
27
+ *
28
+ * Useful for assigning colors to dynamic data sets where you don't know
29
+ * the number of items in advance. Automatically cycles through the palette.
30
+ *
31
+ * @param index - Zero-based index for color selection
32
+ * @returns Hex color string from the chart palette
33
+ *
34
+ * @example
35
+ * // Assign colors to portfolio allocations
36
+ * allocations.map((item, i) => ({
37
+ * ...item,
38
+ * color: getChartColor(i)
39
+ * }));
40
+ *
41
+ * // Colors cycle automatically:
42
+ * getChartColor(0); // '#3B82F6' (blue)
43
+ * getChartColor(1); // '#EF4444' (red)
44
+ * getChartColor(10); // '#3B82F6' (cycles back to blue)
45
+ */
46
+ export declare const getChartColor: (index: number) => string;
47
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/ui/colors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,YAAY,yHAWf,CAAC;AAEX;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,aAAa,GAAI,OAAO,MAAM,KAAG,MAE7C,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Chart colors for data visualizations
3
+ *
4
+ * This file provides programmatic access to chart colors for JavaScript/TypeScript code.
5
+ * These colors are specifically designed for data visualization and chart components.
6
+ *
7
+ * Usage:
8
+ * - Use CHART_COLORS array for static color assignments
9
+ * - Use getChartColor() function for dynamic color cycling
10
+ * - These can be adapted for platform-specific color systems
11
+ *
12
+ * For UI element styling:
13
+ * - Web: Use Tailwind classes (bg-surface-primary, text-content-primary, etc.)
14
+ * - Mobile: Adapt to React Native StyleSheet or theme system
15
+ */
16
+ /**
17
+ * Chart color palette for data visualizations
18
+ *
19
+ * These colors are carefully selected for:
20
+ * - Visual distinction in charts and graphs
21
+ * - Accessibility and contrast
22
+ * - Brand consistency
23
+ */
24
+ export const CHART_COLORS = [
25
+ '#3B82F6', // Blue - primary data color
26
+ '#EF4444', // Red - negative/loss indicators
27
+ '#10B981', // Green - positive/gain indicators
28
+ '#F59E0B', // Amber - warning/volatility
29
+ '#8B5CF6', // Purple - volume/secondary metrics
30
+ '#EC4899', // Pink - accent data
31
+ '#06B6D4', // Cyan - info/neutral data
32
+ '#84CC16', // Lime - growth indicators
33
+ '#F97316', // Orange - emphasis data
34
+ '#6366F1', // Indigo - brand accent
35
+ ];
36
+ /**
37
+ * Get a chart color by index with automatic cycling
38
+ *
39
+ * Useful for assigning colors to dynamic data sets where you don't know
40
+ * the number of items in advance. Automatically cycles through the palette.
41
+ *
42
+ * @param index - Zero-based index for color selection
43
+ * @returns Hex color string from the chart palette
44
+ *
45
+ * @example
46
+ * // Assign colors to portfolio allocations
47
+ * allocations.map((item, i) => ({
48
+ * ...item,
49
+ * color: getChartColor(i)
50
+ * }));
51
+ *
52
+ * // Colors cycle automatically:
53
+ * getChartColor(0); // '#3B82F6' (blue)
54
+ * getChartColor(1); // '#EF4444' (red)
55
+ * getChartColor(10); // '#3B82F6' (cycles back to blue)
56
+ */
57
+ export const getChartColor = (index) => {
58
+ return CHART_COLORS[index % CHART_COLORS.length];
59
+ };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Centralized export of UI constants
3
+ */
4
+ export * from './colors';
5
+ export * from './status';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Centralized export of UI constants
3
+ */
4
+ export * from './colors';
5
+ export * from './status';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Status constants for withdrawal and trade entities
3
+ *
4
+ * These constants map status states to consistent styling.
5
+ * Platform-specific implementations should adapt these to their styling systems:
6
+ * - Web: Convert to Tailwind classes or CSS variables
7
+ * - Mobile: Adapt to React Native StyleSheet or theme colors
8
+ *
9
+ * All color references should be adapted to platform-specific design systems.
10
+ */
11
+ export type StatusType = 'pending' | 'processing' | 'success' | 'error' | 'neutral';
12
+ export declare const STATUS_STATES: {
13
+ readonly PENDING: "pending";
14
+ readonly AWAITING: "pending";
15
+ readonly PROCESSING: "processing";
16
+ readonly IN_PROGRESS: "processing";
17
+ readonly APPROVED: "success";
18
+ readonly COMPLETED: "success";
19
+ readonly REJECTED: "error";
20
+ readonly FAILED: "error";
21
+ readonly CANCELLED: "neutral";
22
+ readonly DEFAULT: "neutral";
23
+ };
24
+ export declare const STATUS_COLORS: {
25
+ readonly pending: "#F59E0B";
26
+ readonly processing: "#3B82F6";
27
+ readonly success: "#10B981";
28
+ readonly error: "#EF4444";
29
+ readonly neutral: "#6B7280";
30
+ };
31
+ //# sourceMappingURL=status.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/ui/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,YAAY,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;AAGpF,eAAO,MAAM,aAAa;;;;;;;;;;;CAoBhB,CAAC;AAGX,eAAO,MAAM,aAAa;;;;;;CAMhB,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Status constants for withdrawal and trade entities
3
+ *
4
+ * These constants map status states to consistent styling.
5
+ * Platform-specific implementations should adapt these to their styling systems:
6
+ * - Web: Convert to Tailwind classes or CSS variables
7
+ * - Mobile: Adapt to React Native StyleSheet or theme colors
8
+ *
9
+ * All color references should be adapted to platform-specific design systems.
10
+ */
11
+ // Status state mappings
12
+ export const STATUS_STATES = {
13
+ // Pending/Waiting states
14
+ PENDING: 'pending',
15
+ AWAITING: 'pending',
16
+ // Active/Processing states
17
+ PROCESSING: 'processing',
18
+ IN_PROGRESS: 'processing',
19
+ // Success states
20
+ APPROVED: 'success',
21
+ COMPLETED: 'success',
22
+ // Error states
23
+ REJECTED: 'error',
24
+ FAILED: 'error',
25
+ // Neutral states
26
+ CANCELLED: 'neutral',
27
+ DEFAULT: 'neutral',
28
+ };
29
+ // Platform-agnostic status colors (hex values)
30
+ export const STATUS_COLORS = {
31
+ pending: '#F59E0B', // Amber/Warning
32
+ processing: '#3B82F6', // Blue/Primary
33
+ success: '#10B981', // Green/Success
34
+ error: '#EF4444', // Red/Error
35
+ neutral: '#6B7280', // Gray/Neutral
36
+ };
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@cranberry-money/shared-constants",
3
+ "version": "1.0.0",
4
+ "description": "Shared constants for MyPortfolio platform",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "require": "./dist/index.cjs"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "clean": "rm -rf dist",
20
+ "typecheck": "tsc --noEmit",
21
+ "dev": "tsc --watch"
22
+ },
23
+ "devDependencies": {
24
+ "typescript": "^5.0.0"
25
+ },
26
+ "peerDependencies": {
27
+ "typescript": ">=5.0.0"
28
+ },
29
+ "keywords": [
30
+ "typescript",
31
+ "constants",
32
+ "shared",
33
+ "portfolio"
34
+ ],
35
+ "author": "MyPortfolio Team",
36
+ "license": "MIT",
37
+ "publishConfig": {
38
+ "access": "restricted",
39
+ "registry": "https://registry.npmjs.org/"
40
+ },
41
+ "repository": {
42
+ "type": "git",
43
+ "url": "git+https://github.com/your-org/cranberry.git",
44
+ "directory": "packages/shared-constants"
45
+ }
46
+ }