@royalinvest/dto 0.69.18 → 0.69.20

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.
@@ -7,6 +7,7 @@ export interface IProperty {
7
7
  municipality: string;
8
8
  state: string;
9
9
  country: string;
10
+ country_abbrev: string;
10
11
  postal_code?: string;
11
12
  photo_url?: string;
12
13
  units: IPropertyUnit[];
package/dist/utils.d.ts CHANGED
@@ -4,3 +4,4 @@ export declare function fromMinorUnits(amountMinor: string, currency: CurrencyEn
4
4
  export declare function fromMinorUnitsExact(amountMinor: string, currency: CurrencyEnum): string;
5
5
  export declare function parseMajorToMinor(value: string, currency: CurrencyEnum): string;
6
6
  export declare function resolveLocale(uiLanguage: LocaleType, country?: CountryEnum | null): string;
7
+ export declare function formatMoney(amountMinor: string, currency: CurrencyEnum, locale: string): string;
package/dist/utils.js CHANGED
@@ -4,6 +4,7 @@ exports.fromMinorUnits = fromMinorUnits;
4
4
  exports.fromMinorUnitsExact = fromMinorUnitsExact;
5
5
  exports.parseMajorToMinor = parseMajorToMinor;
6
6
  exports.resolveLocale = resolveLocale;
7
+ exports.formatMoney = formatMoney;
7
8
  const config_1 = require("./config");
8
9
  // This is going to be used for web app to show amount in minor taking into account units configured for the currency
9
10
  function fromMinorUnits(amountMinor, currency) {
@@ -51,3 +52,11 @@ function resolveLocale(uiLanguage, country) {
51
52
  // Fallback: language-only default
52
53
  return config_1.DEFAULT_LOCALE_BY_LANGUAGE[uiLanguage] ?? "en-US";
53
54
  }
55
+ function formatMoney(amountMinor, currency, locale) {
56
+ const amountMajor = fromMinorUnits(amountMinor, currency);
57
+ return new Intl.NumberFormat(locale, {
58
+ style: "currency",
59
+ currency,
60
+ currencyDisplay: "symbol",
61
+ }).format(amountMajor);
62
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@royalinvest/dto",
3
- "version": "0.69.18",
3
+ "version": "0.69.20",
4
4
  "description": "Data Transfer Objects (DTOs) to carry data between frontend and backend processes.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",