@umituz/react-native-subscription 1.3.0 → 1.4.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/package.json +1 -1
- package/src/index.ts +3 -0
- package/src/utils/priceUtils.ts +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-subscription",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "Subscription management system for React Native apps - Database-first approach with secure validation",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -89,6 +89,9 @@ export {
|
|
|
89
89
|
getDaysUntilExpiration,
|
|
90
90
|
} from './utils/dateValidationUtils';
|
|
91
91
|
|
|
92
|
+
// Price utilities
|
|
93
|
+
export { formatPrice } from './utils/priceUtils';
|
|
94
|
+
|
|
92
95
|
|
|
93
96
|
// =============================================================================
|
|
94
97
|
// USER TIER - Types & Utilities
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price Formatting Utilities
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Format price for display
|
|
7
|
+
* @param price - Price value
|
|
8
|
+
* @param currencyCode - Currency code (e.g., 'USD', 'EUR')
|
|
9
|
+
* @returns Formatted price string
|
|
10
|
+
*/
|
|
11
|
+
export function formatPrice(price: number, currencyCode: string): string {
|
|
12
|
+
try {
|
|
13
|
+
return new Intl.NumberFormat('en-US', {
|
|
14
|
+
style: 'currency',
|
|
15
|
+
currency: currencyCode,
|
|
16
|
+
}).format(price);
|
|
17
|
+
} catch {
|
|
18
|
+
return `${currencyCode} ${price.toFixed(2)}`;
|
|
19
|
+
}
|
|
20
|
+
}
|