@lucaapp/service-utils 1.57.7 → 1.58.1

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.
@@ -25,10 +25,6 @@ export declare class Money<T extends SupportedCurrencies = SupportedCurrencies>
25
25
  clone(): Money<T>;
26
26
  getAmount(): number;
27
27
  getAmountInMajorUnits(): number;
28
- /**
29
- * @deprecated Use getFormattedString in place of getEuroString
30
- */
31
- getEuroString(): string;
32
28
  getFormattedString(locale: string, includeSymbol?: boolean): string;
33
29
  private assertSameCurrency;
34
30
  add(addend?: Money<T>): Money<T>;
@@ -39,12 +39,6 @@ class Money {
39
39
  getAmountInMajorUnits() {
40
40
  return convertToMajorUnits(this.value);
41
41
  }
42
- /**
43
- * @deprecated Use getFormattedString in place of getEuroString
44
- */
45
- getEuroString() {
46
- return this.getAmountInMajorUnits().toFixed(2);
47
- }
48
42
  getFormattedString(locale, includeSymbol = true) {
49
43
  const transactionalLanguage = locale === 'de' ? 'de-DE' : 'en-US';
50
44
  const formattedString = new Intl.NumberFormat(transactionalLanguage, {
@@ -137,13 +131,7 @@ const moneyfiedGet = (model, key) => {
137
131
  };
138
132
  exports.moneyfiedGet = moneyfiedGet;
139
133
  const moneyfiedSet = (model, key, value) => {
140
- const modelCurrency = model.getDataValue('currency');
141
- if (value?.currency && modelCurrency && value.currency !== modelCurrency) {
142
- throw new TypeError('Currencies must match');
143
- }
144
- else if (value?.currency && !modelCurrency) {
145
- model.setDataValue('currency', value.currency);
146
- }
147
134
  model.setDataValue(key, value?.getAmount());
135
+ model.setDataValue('currency', value?.currency);
148
136
  };
149
137
  exports.moneyfiedSet = moneyfiedSet;
@@ -1,4 +1,6 @@
1
1
  export declare enum SupportedCurrencies {
2
- EUR = "EUR"
2
+ CHF = "CHF",
3
+ EUR = "EUR",
4
+ GBP = "GBP"
3
5
  }
4
6
  export declare const currencySymbols: Record<SupportedCurrencies, string>;
@@ -3,8 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.currencySymbols = exports.SupportedCurrencies = void 0;
4
4
  var SupportedCurrencies;
5
5
  (function (SupportedCurrencies) {
6
+ SupportedCurrencies["CHF"] = "CHF";
6
7
  SupportedCurrencies["EUR"] = "EUR";
8
+ SupportedCurrencies["GBP"] = "GBP";
7
9
  })(SupportedCurrencies || (exports.SupportedCurrencies = SupportedCurrencies = {}));
8
10
  exports.currencySymbols = {
11
+ [SupportedCurrencies.CHF]: 'CHF',
9
12
  [SupportedCurrencies.EUR]: '€',
13
+ [SupportedCurrencies.GBP]: '£',
10
14
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lucaapp/service-utils",
3
- "version": "1.57.7",
3
+ "version": "1.58.1",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [