@cobre-npm/library-portal-core 0.9.0 → 0.10.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.
@@ -2,6 +2,7 @@ export declare const CurrencyData: readonly [{
2
2
  readonly id: 1;
3
3
  readonly label: "COP";
4
4
  readonly code: "cop";
5
+ readonly isoCode: "COP";
5
6
  readonly geo: "col";
6
7
  readonly flagAsset: "col";
7
8
  readonly minAmount: 1;
@@ -10,6 +11,7 @@ export declare const CurrencyData: readonly [{
10
11
  readonly id: 2;
11
12
  readonly label: "MXN";
12
13
  readonly code: "mxn";
14
+ readonly isoCode: "MXN";
13
15
  readonly geo: "mex";
14
16
  readonly flagAsset: "mex";
15
17
  readonly minAmount: 0.01;
@@ -18,6 +20,7 @@ export declare const CurrencyData: readonly [{
18
20
  readonly id: 3;
19
21
  readonly label: "USD";
20
22
  readonly code: "usd";
23
+ readonly isoCode: "USD";
21
24
  readonly geo: "usa";
22
25
  readonly flagAsset: "eu";
23
26
  readonly minAmount: 100;
@@ -26,6 +29,7 @@ export declare const CurrencyData: readonly [{
26
29
  readonly id: 4;
27
30
  readonly label: "COP Stable";
28
31
  readonly code: "cop_stable";
32
+ readonly isoCode: "COP";
29
33
  readonly geo: "col";
30
34
  readonly minAmount: 1;
31
35
  readonly type: "stable";
@@ -34,6 +38,7 @@ export declare const CurrencyData: readonly [{
34
38
  readonly id: 5;
35
39
  readonly label: "USD Stable";
36
40
  readonly code: "usd_stable";
41
+ readonly isoCode: "USD";
37
42
  readonly geo: "global";
38
43
  readonly minAmount: 1;
39
44
  readonly type: "stable";
@@ -42,6 +47,7 @@ export declare const CurrencyData: readonly [{
42
47
  readonly id: 6;
43
48
  readonly label: "USD (USDT)";
44
49
  readonly code: "usdt";
50
+ readonly isoCode: "USD";
45
51
  readonly geo: "usa";
46
52
  readonly flagAsset: "usdt";
47
53
  readonly minAmount: 1;
@@ -50,6 +56,7 @@ export declare const CurrencyData: readonly [{
50
56
  readonly id: 7;
51
57
  readonly label: "USD (USDC)";
52
58
  readonly code: "usdc";
59
+ readonly isoCode: "USD";
53
60
  readonly geo: "usa";
54
61
  readonly flagAsset: "usdc";
55
62
  readonly minAmount: 1;
@@ -58,6 +65,7 @@ export declare const CurrencyData: readonly [{
58
65
  readonly id: 8;
59
66
  readonly label: "COPco";
60
67
  readonly code: "copco";
68
+ readonly isoCode: "COP";
61
69
  readonly geo: "col";
62
70
  readonly minAmount: 1;
63
71
  readonly type: "stable";
@@ -1 +1 @@
1
- {"version":3,"file":"currencies.data.d.ts","sourceRoot":"","sources":["../../../src/constants/currencies/currencies.data.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyEf,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA"}
1
+ {"version":3,"file":"currencies.data.d.ts","sourceRoot":"","sources":["../../../src/constants/currencies/currencies.data.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAiFf,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAA;AAChE,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA"}
@@ -8,6 +8,7 @@ exports.CurrencyData = [
8
8
  id: 1,
9
9
  label: "COP",
10
10
  code: currencies_constants_1.Currencies.COP,
11
+ isoCode: "COP",
11
12
  geo: countries_constants_1.Countries.COL,
12
13
  flagAsset: "col",
13
14
  minAmount: 1,
@@ -17,6 +18,7 @@ exports.CurrencyData = [
17
18
  id: 2,
18
19
  label: "MXN",
19
20
  code: currencies_constants_1.Currencies.MXN,
21
+ isoCode: "MXN",
20
22
  geo: countries_constants_1.Countries.MEX,
21
23
  flagAsset: "mex",
22
24
  minAmount: 0.01,
@@ -26,6 +28,7 @@ exports.CurrencyData = [
26
28
  id: 3,
27
29
  label: "USD",
28
30
  code: currencies_constants_1.Currencies.USD,
31
+ isoCode: "USD",
29
32
  geo: countries_constants_1.Countries.USA,
30
33
  flagAsset: "eu",
31
34
  minAmount: 100,
@@ -35,6 +38,7 @@ exports.CurrencyData = [
35
38
  id: 4,
36
39
  label: "COP Stable",
37
40
  code: currencies_constants_1.Currencies.COPStable,
41
+ isoCode: "COP",
38
42
  geo: countries_constants_1.Countries.COL,
39
43
  minAmount: 1,
40
44
  type: "stable",
@@ -44,6 +48,7 @@ exports.CurrencyData = [
44
48
  id: 5,
45
49
  label: "USD Stable",
46
50
  code: currencies_constants_1.Currencies.USDStable,
51
+ isoCode: "USD",
47
52
  geo: countries_constants_1.Countries.GLOBAL,
48
53
  minAmount: 1,
49
54
  type: "stable",
@@ -53,6 +58,7 @@ exports.CurrencyData = [
53
58
  id: 6,
54
59
  label: "USD (USDT)",
55
60
  code: currencies_constants_1.Currencies.USDT,
61
+ isoCode: "USD",
56
62
  geo: countries_constants_1.Countries.USA,
57
63
  flagAsset: "usdt",
58
64
  minAmount: 1,
@@ -62,6 +68,7 @@ exports.CurrencyData = [
62
68
  id: 7,
63
69
  label: "USD (USDC)",
64
70
  code: currencies_constants_1.Currencies.USDC,
71
+ isoCode: "USD",
65
72
  geo: countries_constants_1.Countries.USA,
66
73
  flagAsset: "usdc",
67
74
  minAmount: 1,
@@ -71,6 +78,7 @@ exports.CurrencyData = [
71
78
  id: 8,
72
79
  label: "COPco",
73
80
  code: currencies_constants_1.Currencies.COPCO,
81
+ isoCode: "COP",
74
82
  geo: countries_constants_1.Countries.COL,
75
83
  minAmount: 1,
76
84
  type: "stable",
@@ -1 +1 @@
1
- {"version":3,"file":"currencies.data.js","sourceRoot":"","sources":["../../../src/constants/currencies/currencies.data.ts"],"names":[],"mappings":";;;AAAA,0EAA4D;AAC5D,iEAAmD;AAEtC,QAAA,YAAY,GAAG;IAC1B;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,iCAAU,CAAC,GAAG;QACpB,GAAG,EAAE,+BAAS,CAAC,GAAG;QAClB,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,MAAM;KACb;IACD;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,iCAAU,CAAC,GAAG;QACpB,GAAG,EAAE,+BAAS,CAAC,GAAG;QAClB,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,MAAM;KACb;IACD;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,iCAAU,CAAC,GAAG;QACpB,GAAG,EAAE,+BAAS,CAAC,GAAG;QAClB,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,GAAG;QACd,IAAI,EAAE,MAAM;KACb;IACD;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,iCAAU,CAAC,SAAS;QAC1B,GAAG,EAAE,+BAAS,CAAC,GAAG;QAClB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,YAAY;KACxB;IACD;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,iCAAU,CAAC,SAAS;QAC1B,GAAG,EAAE,+BAAS,CAAC,MAAM;QACrB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,YAAY;KACxB;IACD;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,iCAAU,CAAC,IAAI;QACrB,GAAG,EAAE,+BAAS,CAAC,GAAG;QAClB,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,YAAY;KACnB;IACD;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,YAAY;QACnB,IAAI,EAAE,iCAAU,CAAC,IAAI;QACrB,GAAG,EAAE,+BAAS,CAAC,GAAG;QAClB,SAAS,EAAE,MAAM;QACjB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,YAAY;KACnB;IACD;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,iCAAU,CAAC,KAAK;QACtB,GAAG,EAAE,+BAAS,CAAC,GAAG;QAClB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,YAAY;KACxB;CACO,CAAA"}
1
+ {"version":3,"file":"currencies.data.js","sourceRoot":"","sources":["../../../src/constants/currencies/currencies.data.ts"],"names":[],"mappings":";;;AAAA,0EAA4D;AAC5D,iEAAmD;AAEtC,QAAA,YAAY,GAAG;IAC1B;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,iCAAU,CAAC,GAAG;QACpB,OAAO,EAAE,KAAK;QACd,GAAG,EAAE,+BAAS,CAAC,GAAG;QAClB,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,MAAM;KACb;IACD;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,KAAK;QACZ,IAAI,EAAE,iCAAU,CAAC,GAAG;QACpB,OAAO,EAAE,KAAK;QACd,GAAG,EAAE,+BAAS,CAAC,GAAG;QAClB,SAAS,EAAE,KAAK;QAChB,SAAS,EAAE,IAAI;QACf,IAAI,EAAE,MAAM;KACb;IACD;QACE,EAAE,EAAE,CAAC;QACL,KAAK,EAAE,KAAK;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SAAS,EAAE,CAAC;QACZ,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,YAAY;KACxB;CACO,CAAA"}
@@ -5,4 +5,5 @@ export declare const getCurrenciesByType: (...types: CurrencyType[]) => Currency
5
5
  export declare const getCurrencyByCode: (code: Currency) => CurrencyRecord | undefined;
6
6
  export declare const getFlagAsset: (currency: Currency) => string;
7
7
  export declare const isStableCurrency: (currency: Currency) => boolean;
8
+ export declare const getCurrencyFlag: (code: string) => string;
8
9
  //# sourceMappingURL=currencies.filters.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"currencies.filters.d.ts","sourceRoot":"","sources":["../../../src/constants/currencies/currencies.filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,EAAc,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAI7D,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,KAAG,IAAI,IAAI,QAC3B,CAAA;AAEhC,eAAO,MAAM,mBAAmB,GAAI,GAAG,OAAO,YAAY,EAAE,KAAG,cAAc,EAI5E,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,MAAM,QAAQ,KAAG,cAAc,GAAG,SAEnE,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,KAAG,MAIjD,CAAA;AAID,eAAO,MAAM,gBAAgB,GAAI,UAAU,QAAQ,KAAG,OAIrD,CAAA"}
1
+ {"version":3,"file":"currencies.filters.d.ts","sourceRoot":"","sources":["../../../src/constants/currencies/currencies.filters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,EAAc,QAAQ,EAAE,MAAM,wBAAwB,CAAA;AAI7D,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,KAAG,IAAI,IAAI,QAC3B,CAAA;AAEhC,eAAO,MAAM,mBAAmB,GAAI,GAAG,OAAO,YAAY,EAAE,KAAG,cAAc,EAI5E,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,MAAM,QAAQ,KAAG,cAAc,GAAG,SAEnE,CAAA;AAED,eAAO,MAAM,YAAY,GAAI,UAAU,QAAQ,KAAG,MAIjD,CAAA;AAID,eAAO,MAAM,gBAAgB,GAAI,UAAU,QAAQ,KAAG,OAIrD,CAAA;AAED,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MAM9C,CAAA"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isStableCurrency = exports.getFlagAsset = exports.getCurrencyByCode = exports.getCurrenciesByType = exports.isKnownCurrencyCode = void 0;
3
+ exports.getCurrencyFlag = exports.isStableCurrency = exports.getFlagAsset = exports.getCurrencyByCode = exports.getCurrenciesByType = exports.isKnownCurrencyCode = void 0;
4
4
  const currencies_data_1 = require("./currencies.data");
5
5
  const currencies_constants_1 = require("./currencies.constants");
6
6
  const KNOWN_CURRENCY_CODES = new Set(Object.values(currencies_constants_1.Currencies));
@@ -27,4 +27,11 @@ const isStableCurrency = (currency) => {
27
27
  return found !== undefined && STABLE_TYPES.has(found.type);
28
28
  };
29
29
  exports.isStableCurrency = isStableCurrency;
30
+ const getCurrencyFlag = (code) => {
31
+ const normalized = code.trim().toLowerCase();
32
+ if (!(0, exports.isKnownCurrencyCode)(normalized))
33
+ return "";
34
+ return (0, exports.getCurrencyByCode)(normalized)?.flagAsset ?? "";
35
+ };
36
+ exports.getCurrencyFlag = getCurrencyFlag;
30
37
  //# sourceMappingURL=currencies.filters.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"currencies.filters.js","sourceRoot":"","sources":["../../../src/constants/currencies/currencies.filters.ts"],"names":[],"mappings":";;;AAAA,uDAAwF;AACxF,iEAA6D;AAE7D,MAAM,oBAAoB,GAAG,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,C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AY,CAAC,CAAC,CAAA;AAE7D,MAAM,gBAAgB,GAAG,CAAC,QAAkB,EAAW,EAAE;IAC9D,MAAM,KAAK,GAAG,IAAA,yBAAiB,EAAC,QAAQ,CAAC,CAAA;IAEzC,OAAO,KAAK,KAAK,SAAS,IAAI,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;AAC5D,CAAC,CAAA;AAJY,QAAA,gBAAgB,oBAI5B;AAEM,MAAM,eAAe,GAAG,CAAC,IAAY,EAAU,EAAE;IACtD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAA;IAE5C,IAAI,CAAC,IAAA,2BAAmB,EAAC,UAAU,CAAC;QAAE,OAAO,EAAE,CAAA;IAE/C,OAAO,IAAA,yBAAiB,EAAC,UAAU,CAAC,EAAE,SAAS,IAAI,EAAE,CAAA;AACvD,CAAC,CAAA;AANY,QAAA,eAAe,mBAM3B"}
@@ -1,2 +1,2 @@
1
- export declare const formatAmount: (amount: number) => string;
1
+ export declare const formatAmount: (amount: number, currency?: string | null) => string;
2
2
  //# sourceMappingURL=amount.utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"amount.utils.d.ts","sourceRoot":"","sources":["../../src/utils/amount.utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,KAAG,MAI7C,CAAA"}
1
+ {"version":3,"file":"amount.utils.d.ts","sourceRoot":"","sources":["../../src/utils/amount.utils.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,GAAI,QAAQ,MAAM,EAAE,WAAU,MAAM,GAAG,IAAY,KAAG,MAY9E,CAAA"}
@@ -1,10 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatAmount = void 0;
4
- const formatAmount = (amount) => {
4
+ const currencies_data_1 = require("../constants/currencies/currencies.data");
5
+ const formatAmount = (amount, currency = "USD") => {
5
6
  if (amount === undefined || amount === null)
6
7
  return "-";
7
- return new Intl.NumberFormat("en-US", { style: "currency", currency: "USD" }).format(amount / 100);
8
+ const isoCode = currency
9
+ ? (currencies_data_1.CurrencyData.find((c) => c.code === currency.trim().toLowerCase())?.isoCode ?? currency)
10
+ : null;
11
+ const options = isoCode
12
+ ? { style: "currency", currency: isoCode }
13
+ : { style: "decimal", minimumFractionDigits: 2, maximumFractionDigits: 2 };
14
+ return new Intl.NumberFormat("en-US", options).format(amount / 100);
8
15
  };
9
16
  exports.formatAmount = formatAmount;
10
17
  //# sourceMappingURL=amount.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"amount.utils.js","sourceRoot":"","sources":["../../src/utils/amount.utils.ts"],"names":[],"mappings":";;;AAAO,MAAM,YAAY,GAAG,CAAC,MAAc,EAAU,EAAE;IACrD,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,GAAG,CAAA;IAEvD,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAA;AACpG,CAAC,CAAA;AAJY,QAAA,YAAY,gBAIxB"}
1
+ {"version":3,"file":"amount.utils.js","sourceRoot":"","sources":["../../src/utils/amount.utils.ts"],"names":[],"mappings":";;;AAAA,6EAAsE;AAE/D,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,WAA0B,KAAK,EAAU,EAAE;IACtF,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI;QAAE,OAAO,GAAG,CAAA;IAEvD,MAAM,OAAO,GAAG,QAAQ;QACtB,CAAC,CAAC,CAAC,8BAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC,EAAE,OAAO,IAAI,QAAQ,CAAC;QAC3F,CAAC,CAAC,IAAI,CAAA;IAER,MAAM,OAAO,GAA6B,OAAO;QAC/C,CAAC,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,EAAE;QAC1C,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,CAAC,EAAE,qBAAqB,EAAE,CAAC,EAAE,CAAA;IAE5E,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,CAAA;AACrE,CAAC,CAAA;AAZY,QAAA,YAAY,gBAYxB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobre-npm/library-portal-core",
3
- "version": "0.9.0",
3
+ "version": "0.10.0",
4
4
  "description": "Shared configurations and resources for Portal MFEs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",