@cranberry-money/shared-utils 8.17.8 → 8.17.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cranberry-money/shared-utils",
3
- "version": "8.17.8",
3
+ "version": "8.17.9",
4
4
  "description": "Shared utility functions for MyPortfolio platform",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -1,18 +0,0 @@
1
- import type { AssetAllocation } from '@cranberry-money/shared-types';
2
- /**
3
- * Validates if allocation percentages sum to 100%
4
- * Allows for small floating point errors (e.g., 99.99 or 100.01)
5
- *
6
- * @param allocations - Array of asset allocations to validate
7
- * @returns true if allocations sum to approximately 100%, false otherwise
8
- *
9
- * @example
10
- * const allocations = [
11
- * { percentage: '50.00' },
12
- * { percentage: '30.00' },
13
- * { percentage: '20.00' }
14
- * ];
15
- * validateAllocations(allocations); // returns true
16
- */
17
- export declare const validateAllocations: (allocations: readonly AssetAllocation[]) => boolean;
18
- //# sourceMappingURL=allocations.d.ts.map
package/dist/auth.d.ts DELETED
@@ -1,55 +0,0 @@
1
- /**
2
- * Authentication and token management utilities
3
- */
4
- import type { DeviceInfo, TokenRefreshResponse, TokenRefreshError, AutoRefreshHandler } from '@cranberry-money/shared-types';
5
- /**
6
- * Check if a token has expired based on its expiration timestamp
7
- * @param expiresAt - The expiration timestamp
8
- * @returns true if token is expired, false otherwise
9
- */
10
- export declare function isTokenExpired(expiresAt: string): boolean;
11
- /**
12
- * Check if a token will expire within a specified number of minutes
13
- * @param expiresAt - The expiration timestamp
14
- * @param minutesBeforeExpiry - Minutes before expiry to consider as "expiring soon"
15
- * @returns true if token is expiring soon, false otherwise
16
- */
17
- export declare function isTokenExpiringSoon(expiresAt: string, minutesBeforeExpiry?: number): boolean;
18
- /**
19
- * Get the remaining time until token expiry in minutes
20
- * @param expiresAt - The expiration timestamp
21
- * @returns Number of minutes until expiry
22
- */
23
- export declare function getTimeUntilExpiry(expiresAt: string): number;
24
- /**
25
- * Format the time until expiry in a human-readable format
26
- * @param expiresAt - The expiration timestamp
27
- * @returns Formatted time string
28
- */
29
- export declare function formatTimeUntilExpiry(expiresAt: string): string;
30
- /**
31
- * Parse device information from user agent string
32
- * @param userAgent - The user agent string
33
- * @returns Parsed device info
34
- */
35
- export declare function parseDeviceInfo(userAgent: string): DeviceInfo;
36
- /**
37
- * Check if token refresh was successful
38
- * @param response - The refresh response
39
- * @returns true if refresh was successful, false otherwise
40
- */
41
- export declare function isRefreshSuccess(response: TokenRefreshResponse): boolean;
42
- /**
43
- * Get error message from token refresh error
44
- * @param error - The refresh error
45
- * @returns Error message string
46
- */
47
- export declare function getRefreshErrorMessage(error: TokenRefreshError): string;
48
- /**
49
- * Create an auto-refresh handler for tokens
50
- * @param refreshCallback - Callback function to refresh token
51
- * @param checkInterval - Interval in milliseconds to check for refresh
52
- * @returns Auto refresh handler with start/stop methods
53
- */
54
- export declare function createAutoRefreshHandler(refreshCallback: () => Promise<void>, checkInterval?: number): AutoRefreshHandler;
55
- //# sourceMappingURL=auth.d.ts.map
@@ -1,65 +0,0 @@
1
- /**
2
- * Badge Status Utilities - Status-specific badge functions
3
- *
4
- * This module provides pre-configured badge functions for common status types
5
- * in the MyPortfolio platform. It builds on top of the core badge system.
6
- */
7
- import type { StatusBadgeStyle, TradeStatus, WithdrawalStatus, LiquidationStatus, TargetTradeStatus } from '@cranberry-money/shared-types';
8
- import type { BadgeSize } from '@cranberry-money/shared-types';
9
- /**
10
- * Creates a badge for trade status
11
- *
12
- * @param status - Trade status constant
13
- * @param size - Badge size (default: 'md')
14
- * @returns Badge style with display text and accessibility attributes
15
- *
16
- * @example
17
- * ```typescript
18
- * const badge = getTradeStatusBadge(TRADE_STATUS_SETTLED);
19
- * // Returns badge with success variant and "Settled" display text
20
- * ```
21
- */
22
- export declare function getTradeStatusBadge(status: TradeStatus, size?: BadgeSize): StatusBadgeStyle;
23
- /**
24
- * Creates a badge for withdrawal status
25
- *
26
- * @param status - Withdrawal status constant
27
- * @param size - Badge size (default: 'md')
28
- * @returns Badge style with display text and accessibility attributes
29
- *
30
- * @example
31
- * ```typescript
32
- * const badge = getWithdrawalStatusBadge(WITHDRAWAL_STATUS_APPROVED);
33
- * // Returns badge with success variant and "Approved" display text
34
- * ```
35
- */
36
- export declare function getWithdrawalStatusBadge(status: WithdrawalStatus, size?: BadgeSize): StatusBadgeStyle;
37
- /**
38
- * Creates a badge for liquidation status
39
- *
40
- * @param status - Liquidation status constant
41
- * @param size - Badge size (default: 'md')
42
- * @returns Badge style with display text and accessibility attributes
43
- *
44
- * @example
45
- * ```typescript
46
- * const badge = getLiquidationStatusBadge(LIQUIDATION_STATUS_SETTLED);
47
- * // Returns badge with success variant and "Settled" display text
48
- * ```
49
- */
50
- export declare function getLiquidationStatusBadge(status: LiquidationStatus, size?: BadgeSize): StatusBadgeStyle;
51
- /**
52
- * Creates a badge for target trade status
53
- *
54
- * @param status - Target trade status constant
55
- * @param size - Badge size (default: 'md')
56
- * @returns Badge style with display text and accessibility attributes
57
- *
58
- * @example
59
- * ```typescript
60
- * const badge = getTargetTradeStatusBadge(TARGET_TRADE_STATUS_PENDING);
61
- * // Returns badge with warning variant and "Pending" display text
62
- * ```
63
- */
64
- export declare function getTargetTradeStatusBadge(status: TargetTradeStatus, size?: BadgeSize): StatusBadgeStyle;
65
- //# sourceMappingURL=badge-status.d.ts.map
package/dist/badge.d.ts DELETED
@@ -1,41 +0,0 @@
1
- /**
2
- * Badge System Core - Type definitions and factory function
3
- *
4
- * This module provides a standardized way to create and style badges.
5
- * It ensures consistency in colors, typography, and semantic meaning
6
- * while maintaining accessibility standards.
7
- *
8
- * Note: The actual style classes are designed to work with Tailwind CSS
9
- * and assume a specific color system is in place.
10
- */
11
- import type { BadgeVariant, BadgeSize, BadgeConfig, BadgeStyle } from '@cranberry-money/shared-types';
12
- /**
13
- * Creates a badge style configuration with appropriate CSS classes
14
- *
15
- * @param config - Badge configuration options
16
- * @param variantStyles - Optional custom variant styles (defaults to DEFAULT_BADGE_VARIANTS)
17
- * @param sizeStyles - Optional custom size styles (defaults to DEFAULT_BADGE_SIZES)
18
- * @returns Badge style object with className and accessibility attributes
19
- *
20
- * @example
21
- * ```typescript
22
- * // Create a success badge
23
- * const successBadge = createBadge({ variant: 'success' });
24
- * // Returns: { className: 'inline-flex items-center rounded-md font-medium whitespace-nowrap transition-colors bg-success-900/80 text-success-300 text-xs px-2 py-1', ariaLabel: 'success status' }
25
- *
26
- * // Create a large warning badge with custom class
27
- * const warningBadge = createBadge({ variant: 'warning', size: 'lg', className: 'ml-2' });
28
- *
29
- * // Use custom variant styles
30
- * const customVariants = { primary: 'bg-blue-500 text-white', ... };
31
- * const customBadge = createBadge({ variant: 'primary' }, customVariants);
32
- * ```
33
- */
34
- export declare function createBadge({ variant, size, className }: BadgeConfig, variantStyles?: Record<BadgeVariant, string>, sizeStyles?: Record<BadgeSize, string>): BadgeStyle;
35
- /**
36
- * Export the default style mappings for consumers who want to use them directly
37
- * or extend them with their own styles
38
- */
39
- export declare const BADGE_VARIANTS: Record<BadgeVariant, string>;
40
- export declare const BADGE_SIZES: Record<BadgeSize, string>;
41
- //# sourceMappingURL=badge.d.ts.map
@@ -1,43 +0,0 @@
1
- /**
2
- * Base transaction type interface for type flexibility
3
- */
4
- export interface BaseTransactionType {
5
- readonly [key: string]: string;
6
- }
7
- /**
8
- * Format cash account balance with AUD currency formatting
9
- *
10
- * @param balance - Balance value to format (string or number)
11
- * @returns Formatted currency string using Australian locale and AUD currency
12
- *
13
- * @example
14
- * formatBalance(1234.56); // returns '$1,234.56'
15
- * formatBalance('1000'); // returns '$1,000.00'
16
- * formatBalance(0); // returns '$0.00'
17
- */
18
- export declare const formatBalance: (balance: string | number) => string;
19
- /**
20
- * Format transaction amount with signed currency formatting (shows + or -)
21
- *
22
- * @param amount - Transaction amount to format (string or number)
23
- * @returns Formatted signed currency string using Australian locale and AUD currency
24
- *
25
- * @example
26
- * formatTransactionAmount(1234.56); // returns '+$1,234.56'
27
- * formatTransactionAmount(-500); // returns '-$500.00'
28
- * formatTransactionAmount('1000'); // returns '+$1,000.00'
29
- */
30
- export declare const formatTransactionAmount: (amount: string | number) => string;
31
- /**
32
- * Get human-readable label for transaction type
33
- *
34
- * @param transactionType - Transaction type key
35
- * @param labels - Optional custom transaction type labels (defaults to shared constants)
36
- * @returns Human-readable transaction type label
37
- *
38
- * @example
39
- * getTransactionTypeLabel('DEPOSIT'); // returns transaction type label from constants
40
- * getTransactionTypeLabel('WITHDRAWAL'); // returns transaction type label from constants
41
- */
42
- export declare const getTransactionTypeLabel: <T extends string>(transactionType: T, labels?: Record<T, string>) => string;
43
- //# sourceMappingURL=cash-account.d.ts.map
@@ -1,81 +0,0 @@
1
- /**
2
- * Generic collection and array utilities
3
- * Pure functions for common array operations with type safety
4
- */
5
- /**
6
- * Sort array of objects by a string field
7
- * @param items - Array of objects to sort
8
- * @param fieldName - Name of the field to sort by
9
- * @returns New sorted array
10
- */
11
- export declare function sortByStringField<T>(items: T[], fieldName: keyof T): T[];
12
- /**
13
- * Filter array by text search in a specific field (case-insensitive)
14
- * @param items - Array of objects to filter
15
- * @param fieldName - Name of the field to search in
16
- * @param searchTerm - Search term
17
- * @returns Filtered array
18
- */
19
- export declare function filterByTextSearch<T>(items: T[], fieldName: keyof T, searchTerm: string): T[];
20
- /**
21
- * Filter array by boolean field
22
- * @param items - Array of objects to filter
23
- * @param fieldName - Name of the boolean field
24
- * @param value - Boolean value to filter by
25
- * @returns Filtered array
26
- */
27
- export declare function filterByBooleanField<T>(items: T[], fieldName: keyof T, value: boolean): T[];
28
- /**
29
- * Find item by exact field match
30
- * @param items - Array of objects to search
31
- * @param fieldName - Name of the field to match
32
- * @param value - Value to match
33
- * @returns Found item or undefined
34
- */
35
- export declare function findByField<T>(items: T[], fieldName: keyof T, value: unknown): T | undefined;
36
- /**
37
- * Find item by case-insensitive string field match
38
- * @param items - Array of objects to search
39
- * @param fieldName - Name of the string field to match
40
- * @param value - String value to match (case-insensitive)
41
- * @returns Found item or undefined
42
- */
43
- export declare function findByStringField<T>(items: T[], fieldName: keyof T, value: string): T | undefined;
44
- /**
45
- * Extract values from a specific field and sort them
46
- * @param items - Array of objects
47
- * @param fieldName - Name of the field to extract
48
- * @returns Sorted array of extracted values
49
- */
50
- export declare function extractAndSortField<T, K extends keyof T>(items: T[], fieldName: K): T[K][];
51
- /**
52
- * Group array items by the first character of a string field
53
- * @param items - Array of objects to group
54
- * @param fieldName - Name of the string field to group by
55
- * @returns Object with first letters as keys and arrays of items as values
56
- */
57
- export declare function groupByFirstLetter<T>(items: T[], fieldName: keyof T): Record<string, T[]>;
58
- /**
59
- * Group array items by a field value
60
- * @param items - Array of objects to group
61
- * @param fieldName - Name of the field to group by
62
- * @returns Object with field values as keys and arrays of items as values
63
- */
64
- export declare function groupByField<T, K extends keyof T>(items: T[], fieldName: K): Record<string, T[]>;
65
- /**
66
- * Check if any item in array has a specific boolean field value
67
- * @param items - Array of objects to check
68
- * @param fieldName - Name of the boolean field
69
- * @param value - Boolean value to check for
70
- * @returns true if any item matches, false otherwise
71
- */
72
- export declare function hasItemWithFieldValue<T>(items: T[], fieldName: keyof T, value: unknown): boolean;
73
- /**
74
- * Count items that match a field value
75
- * @param items - Array of objects to count
76
- * @param fieldName - Name of the field to check
77
- * @param value - Value to count
78
- * @returns Number of matching items
79
- */
80
- export declare function countByFieldValue<T>(items: T[], fieldName: keyof T, value: unknown): number;
81
- //# sourceMappingURL=collections.d.ts.map
package/dist/country.d.ts DELETED
@@ -1,108 +0,0 @@
1
- /**
2
- * Base interface for country objects
3
- */
4
- export interface BaseCountry {
5
- readonly name: string;
6
- readonly code: string;
7
- readonly uuid: string;
8
- readonly isAvailable: boolean;
9
- readonly dialCode?: string;
10
- }
11
- /**
12
- * Sort countries by name
13
- *
14
- * @param countries - Array of countries to sort
15
- * @returns Sorted array of countries
16
- *
17
- * @example
18
- * const sorted = sortCountriesByName(countries);
19
- */
20
- export declare const sortCountriesByName: <T extends BaseCountry>(countries: readonly T[]) => T[];
21
- /**
22
- * Filter countries by name (case-insensitive search)
23
- *
24
- * @param countries - Array of countries to filter
25
- * @param searchTerm - Search term to filter by
26
- * @returns Filtered array of countries
27
- *
28
- * @example
29
- * const filtered = filterCountriesByName(countries, 'united');
30
- * // Returns countries with 'united' in the name
31
- */
32
- export declare const filterCountriesByName: <T extends BaseCountry>(countries: readonly T[], searchTerm: string) => T[];
33
- /**
34
- * Filter countries by availability
35
- *
36
- * @param countries - Array of countries to filter
37
- * @returns Array of available countries
38
- *
39
- * @example
40
- * const available = filterAvailableCountries(countries);
41
- */
42
- export declare const filterAvailableCountries: <T extends BaseCountry>(countries: readonly T[]) => T[];
43
- /**
44
- * Find country by exact name match
45
- *
46
- * @param countries - Array of countries to search
47
- * @param name - Exact name to find
48
- * @returns Found country or undefined
49
- *
50
- * @example
51
- * const country = findCountryByName(countries, 'United States');
52
- */
53
- export declare const findCountryByName: <T extends BaseCountry>(countries: readonly T[], name: string) => T | undefined;
54
- /**
55
- * Find country by country code
56
- *
57
- * @param countries - Array of countries to search
58
- * @param code - Country code to find (e.g., 'US', 'CA')
59
- * @returns Found country or undefined
60
- *
61
- * @example
62
- * const country = findCountryByCode(countries, 'US');
63
- */
64
- export declare const findCountryByCode: <T extends BaseCountry>(countries: readonly T[], code: string) => T | undefined;
65
- /**
66
- * Get sorted list of country names
67
- *
68
- * @param countries - Array of countries
69
- * @returns Sorted array of country names
70
- *
71
- * @example
72
- * const names = getCountryNames(countries);
73
- * // ['Australia', 'Canada', 'United States', ...]
74
- */
75
- export declare const getCountryNames: <T extends BaseCountry>(countries: readonly T[]) => string[];
76
- /**
77
- * Group countries alphabetically by first letter
78
- *
79
- * @param countries - Array of countries to group
80
- * @returns Record of countries grouped by first letter
81
- *
82
- * @example
83
- * const grouped = groupCountriesAlphabetically(countries);
84
- * // { 'A': [...], 'B': [...], 'C': [...], ... }
85
- */
86
- export declare const groupCountriesAlphabetically: <T extends BaseCountry>(countries: readonly T[]) => Record<string, T[]>;
87
- /**
88
- * Format country with dial code for display
89
- *
90
- * @param country - Country to format
91
- * @returns Formatted string with country name and dial code
92
- *
93
- * @example
94
- * formatCountryWithDialCode({ name: 'United States', dialCode: '+1', ... });
95
- * // Returns 'United States (+1)'
96
- */
97
- export declare const formatCountryWithDialCode: <T extends BaseCountry>(country: T) => string;
98
- /**
99
- * Check if a country is available
100
- *
101
- * @param country - Country to check
102
- * @returns True if country is available
103
- *
104
- * @example
105
- * const available = isCountryAvailable(country);
106
- */
107
- export declare const isCountryAvailable: <T extends BaseCountry>(country: T) => boolean;
108
- //# sourceMappingURL=country.d.ts.map
@@ -1,99 +0,0 @@
1
- /**
2
- * Currency formatting utility functions and constants
3
- *
4
- * This module provides pure functions for formatting currency values,
5
- * parsing currency inputs, and working with different currency formats.
6
- */
7
- /**
8
- * Number formatting options for currency display
9
- */
10
- export declare const NUMBER_FORMAT_OPTIONS_CURRENCY: {
11
- readonly style: "currency";
12
- readonly minimumFractionDigits: 2;
13
- readonly maximumFractionDigits: 2;
14
- };
15
- /**
16
- * Number formatting options for currency with explicit sign display
17
- */
18
- export declare const NUMBER_FORMAT_OPTIONS_CURRENCY_SIGNED: {
19
- readonly signDisplay: "always";
20
- readonly style: "currency";
21
- readonly minimumFractionDigits: 2;
22
- readonly maximumFractionDigits: 2;
23
- };
24
- /**
25
- * Formats a number as currency with commas and 2 decimal places
26
- *
27
- * @param value - Number or string value to format
28
- * @returns Formatted currency string without currency symbol
29
- *
30
- * @example
31
- * ```typescript
32
- * formatCurrency(1234.5) // '1,234.50'
33
- * formatCurrency('1234.5') // '1,234.50'
34
- * formatCurrency(0) // '0.00'
35
- * ```
36
- */
37
- export declare function formatCurrency(value: number | string): string;
38
- /**
39
- * Parses a currency string input into a number
40
- *
41
- * @param value - Currency string to parse
42
- * @returns Parsed number value (or 0 if invalid)
43
- *
44
- * @example
45
- * ```typescript
46
- * parseCurrencyInput('$1,234.56') // 1234.56
47
- * parseCurrencyInput('1234.567') // 1234.56
48
- * parseCurrencyInput('abc') // 0
49
- * ```
50
- */
51
- export declare function parseCurrencyInput(value: string): number;
52
- /**
53
- * Formats a number as currency with specific currency code and locale
54
- *
55
- * @param value - Number to format
56
- * @param currencyCode - ISO 4217 currency code (default: DEFAULT_CURRENCY)
57
- * @param locale - Locale for formatting (default: 'en-AU')
58
- * @param minimumFractionDigits - Minimum decimal places (default: 0)
59
- * @param maximumFractionDigits - Maximum decimal places (default: 0)
60
- * @returns Formatted currency string
61
- *
62
- * @example
63
- * ```typescript
64
- * formatCurrencyWithCode(1234.5) // 'A$1,235'
65
- * formatCurrencyWithCode(1234.5, 'USD', 'en-US') // '$1,235'
66
- * formatCurrencyWithCode(1234.56, 'AUD', 'en-AU', 2, 2) // 'A$1,234.56'
67
- * ```
68
- */
69
- export declare function formatCurrencyWithCode(value: number, currencyCode?: string, locale?: string, minimumFractionDigits?: number, maximumFractionDigits?: number): string;
70
- /**
71
- * Convenience function to format currency with the default currency (AUD)
72
- *
73
- * @param value - Number to format
74
- * @param minimumFractionDigits - Minimum decimal places (default: 0)
75
- * @param maximumFractionDigits - Maximum decimal places (default: 0)
76
- * @returns Formatted currency string with default currency
77
- *
78
- * @example
79
- * ```typescript
80
- * formatDefaultCurrency(1234.5) // 'A$1,235'
81
- * formatDefaultCurrency(1234.56, 2, 2) // 'A$1,234.56'
82
- * ```
83
- */
84
- export declare function formatDefaultCurrency(value: number, minimumFractionDigits?: number, maximumFractionDigits?: number): string;
85
- /**
86
- * Formats a number for displaying share quantities (no decimals)
87
- *
88
- * @param shares - Number of shares to format
89
- * @param locale - Locale for formatting (default: 'en-AU')
90
- * @returns Formatted shares string with commas as thousands separators
91
- *
92
- * @example
93
- * ```typescript
94
- * formatShares(1234) // '1,234'
95
- * formatShares(1234567) // '1,234,567'
96
- * ```
97
- */
98
- export declare function formatShares(shares: number, locale?: string): string;
99
- //# sourceMappingURL=currency.d.ts.map
@@ -1,72 +0,0 @@
1
- import type { AssetAllocation, AssetHolding } from '@cranberry-money/shared-types';
2
- /**
3
- * Display item interface for allocation data
4
- */
5
- export interface AllocationDisplayItem {
6
- readonly instrumentUuid: string;
7
- readonly symbol: string;
8
- readonly name: string;
9
- readonly targetPercentage?: number;
10
- readonly actualPercentage?: number;
11
- readonly quantity?: number;
12
- readonly value?: number;
13
- readonly currentPrice?: number;
14
- readonly color: string;
15
- readonly hasTarget: boolean;
16
- readonly hasActual: boolean;
17
- }
18
- /**
19
- * Processes allocation and holding data for dashboard display
20
- * Merges target allocations with actual holdings data
21
- *
22
- * @param allocations - Target asset allocations
23
- * @param holdings - Actual asset holdings
24
- * @returns Array of display items sorted by target/actual percentage
25
- *
26
- * @example
27
- * const allocations = [{ instrument: '123', percentage: '50.00', ... }];
28
- * const holdings = [{ instrument: { uuid: '123' }, quantity: 100, ... }];
29
- * processAllocationData(allocations, holdings);
30
- */
31
- export declare const processAllocationData: (allocations: readonly AssetAllocation[], holdings: readonly AssetHolding[]) => AllocationDisplayItem[];
32
- /**
33
- * Calculates totals from allocation display items
34
- *
35
- * @param items - Array of allocation display items
36
- * @returns Object with total calculations
37
- *
38
- * @example
39
- * const items = [{ targetPercentage: 50, actualPercentage: 45, value: 1000, quantity: 10 }];
40
- * calculateTotals(items);
41
- * // returns { totalTarget: 50, totalActual: 45, totalValue: 1000, totalQuantity: 10 }
42
- */
43
- export declare const calculateTotals: (items: readonly AllocationDisplayItem[]) => {
44
- totalTarget: number;
45
- totalActual: number;
46
- totalValue: number;
47
- totalQuantity: number;
48
- };
49
- /**
50
- * Formats a percentage value for display
51
- *
52
- * @param value - The percentage value to format
53
- * @returns Formatted percentage string
54
- *
55
- * @example
56
- * formatPercentage(45.678); // returns "45.7%"
57
- * formatPercentage(undefined); // returns "0.0%"
58
- */
59
- export declare const formatPercentage: (value?: number) => string;
60
- /**
61
- * Formats currency value for dashboard display
62
- *
63
- * @param value - The numeric value to format
64
- * @param currency - Currency code (defaults to DEFAULT_CURRENCY)
65
- * @returns Formatted currency string or "—" for undefined values
66
- *
67
- * @example
68
- * formatDashboardCurrency(1234.56); // returns "$1,234.56"
69
- * formatDashboardCurrency(undefined); // returns "—"
70
- */
71
- export declare const formatDashboardCurrency: (value?: number, currency?: string) => string;
72
- //# sourceMappingURL=dashboard.d.ts.map
package/dist/date.d.ts DELETED
@@ -1,64 +0,0 @@
1
- /**
2
- * Date and time formatting utility functions
3
- *
4
- * This module provides pure functions for formatting dates and times
5
- * in various formats suitable for display in the application.
6
- */
7
- /**
8
- * Formats a date string to a localized date
9
- *
10
- * @param dateString - ISO date string or null
11
- * @param fallback - Fallback text when date is null (default: 'No expiry')
12
- * @returns Formatted date string
13
- *
14
- * @example
15
- * ```typescript
16
- * formatDate('2024-03-15') // '3/15/2024' (in en-US)
17
- * formatDate(null) // 'No expiry'
18
- * formatDate(null, 'Not set') // 'Not set'
19
- * ```
20
- */
21
- export declare function formatDate(dateString: string | null, fallback?: string): string;
22
- /**
23
- * Formats a date string to a short date format (e.g., "Jan 15")
24
- *
25
- * @param dateString - ISO date string
26
- * @param locale - Locale for formatting (default: 'en-AU')
27
- * @returns Formatted short date string
28
- *
29
- * @example
30
- * ```typescript
31
- * formatShortDate('2024-01-15') // 'Jan 15'
32
- * formatShortDate('2024-12-25', 'en-US') // 'Dec 25'
33
- * ```
34
- */
35
- export declare function formatShortDate(dateString: string, locale?: string): string;
36
- /**
37
- * Formats a date string to a time format (24-hour)
38
- *
39
- * @param dateString - ISO date string
40
- * @param locale - Locale for formatting (default: 'en-AU')
41
- * @returns Formatted time string in 24-hour format
42
- *
43
- * @example
44
- * ```typescript
45
- * formatTime('2024-01-15T14:30:00') // '14:30'
46
- * formatTime('2024-01-15T09:05:00') // '09:05'
47
- * ```
48
- */
49
- export declare function formatTime(dateString: string, locale?: string): string;
50
- /**
51
- * Formats a date string to a combined short date and time format
52
- *
53
- * @param dateString - ISO date string
54
- * @param locale - Locale for formatting (default: 'en-AU')
55
- * @returns Formatted string like "Jan 15 14:30"
56
- *
57
- * @example
58
- * ```typescript
59
- * formatDateTime('2024-01-15T14:30:00') // 'Jan 15 14:30'
60
- * formatDateTime('2024-12-25T09:00:00', 'en-US') // 'Dec 25 09:00'
61
- * ```
62
- */
63
- export declare function formatDateTime(dateString: string, locale?: string): string;
64
- //# sourceMappingURL=date.d.ts.map