@cobre-npm/library-portal-core 0.33.0 → 0.35.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/README.md CHANGED
@@ -212,15 +212,33 @@ hasCountryISOFlag("col") // true — whether a flag asset is avai
212
212
 
213
213
  ```ts
214
214
  import {
215
- getMovementTypes, type MovementType, type MovementTypeOption,
215
+ getMovementTypes, queryMovementTypes, type MovementType, type MovementTypeGroupLabel,
216
+ type MovementTypeOption, type MovementTypeQuery,
216
217
  getMovementStatuses, type MovementStatus, type MovementStatusRecord,
217
218
  } from "@cobre-npm/library-portal-core/movements"
218
219
 
219
- getMovementTypes("en").ach.label // "ACH"
220
- getMovementStatuses().completed // { code: "completed" } (no i18n)
220
+ getMovementTypes("en").ach.label // "ACH"
221
+ getMovementTypes("en").on_ramp.groupLabel // "Stablecoin"
222
+ getMovementTypes("en").on_ramp.label // "On Ramp" (individual label, unchanged)
223
+ queryMovementTypes({ lang: "en", groupLabel: "Stablecoin" }) // global, off_ramp, on_ramp, stable_payout
224
+ getMovementStatuses().completed // { code: "completed" } (no i18n)
221
225
  ```
222
226
 
223
- - **types** (i18n): movement types (ACH, SPEI, R2P, …).
227
+ - **types** (i18n): movement types (ACH, SPEI, R2P, …). `on_ramp`/`off_ramp`/`stable_payout`/`global`
228
+ additionally carry `groupLabel: "Stablecoin"` — a display grouping for views that need to show them
229
+ under one label. `getMovementTypes()` keeps returning each rail's own individual `label` unchanged; a
230
+ consumer that wants the grouped label picks `groupLabel ?? label`. There's no separate `getXLabel`
231
+ for this — the value already comes back inside `getMovementTypes()`, same as everything else in this
232
+ catalog.
233
+ - **types query** (i18n `queryX()`): `queryMovementTypes({ lang, ...filters })` — same rules as
234
+ `queryTransactionTypes`/`queryDocumentTypes`, no default field. `groupLabel` is the only filterable
235
+ field besides `code`, and it's optional on the record: **a key that is present always filters**, so
236
+ `groupLabel: undefined` matches the 19 rails that don't carry a group, not "no filter". An optional UI
237
+ filter has to be spread in conditionally:
238
+
239
+ ```ts
240
+ queryMovementTypes({ lang, ...(group.value ? { groupLabel: group.value } : {}) })
241
+ ```
224
242
  - **status** (no i18n): movement statuses (`initiated`, `processing`, `completed`, …).
225
243
 
226
244
  ### `subclients`
@@ -1,4 +1,4 @@
1
- export type { MovementType } from "./types/catalog";
1
+ export type { MovementType, MovementTypeGroupLabel } from "./types/catalog";
2
2
  export * from "./types/utils/movement-type.utils";
3
3
  export type { MovementStatus, MovementStatusRecord } from "./status/catalog";
4
4
  export * from "./status/utils/movement-status.utils";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/movements/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,cAAc,mCAAmC,CAAA;AAEjD,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC5E,cAAc,sCAAsC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/movements/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAA;AAC3E,cAAc,mCAAmC,CAAA;AAEjD,YAAY,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AAC5E,cAAc,sCAAsC,CAAA"}
@@ -1,3 +1,4 @@
1
+ export type MovementTypeGroupLabel = "Stablecoin";
1
2
  export declare const MOVEMENT_TYPES: {
2
3
  readonly ach: {
3
4
  readonly code: "ach";
@@ -40,15 +41,18 @@ export declare const MOVEMENT_TYPES: {
40
41
  };
41
42
  readonly global: {
42
43
  readonly code: "global";
44
+ readonly groupLabel: "Stablecoin";
43
45
  };
44
46
  readonly r2p_spei: {
45
47
  readonly code: "r2p_spei";
46
48
  };
47
49
  readonly on_ramp: {
48
50
  readonly code: "on_ramp";
51
+ readonly groupLabel: "Stablecoin";
49
52
  };
50
53
  readonly off_ramp: {
51
54
  readonly code: "off_ramp";
55
+ readonly groupLabel: "Stablecoin";
52
56
  };
53
57
  readonly fedwire: {
54
58
  readonly code: "fedwire";
@@ -61,6 +65,7 @@ export declare const MOVEMENT_TYPES: {
61
65
  };
62
66
  readonly stable_payout: {
63
67
  readonly code: "stable_payout";
68
+ readonly groupLabel: "Stablecoin";
64
69
  };
65
70
  readonly breb: {
66
71
  readonly code: "breb";
@@ -70,5 +75,7 @@ export declare const MOVEMENT_TYPES: {
70
75
  };
71
76
  };
72
77
  export type MovementType = keyof typeof MOVEMENT_TYPES;
73
- export type MovementTypeRecord = (typeof MOVEMENT_TYPES)[MovementType];
78
+ export type MovementTypeRecord = (typeof MOVEMENT_TYPES)[MovementType] & {
79
+ readonly groupLabel?: MovementTypeGroupLabel;
80
+ };
74
81
  //# sourceMappingURL=catalog.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/movements/types/catalog.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwBjB,CAAA;AAEV,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,cAAc,CAAA;AACtD,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,YAAY,CAAC,CAAA"}
1
+ {"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../src/movements/types/catalog.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,sBAAsB,GAAG,YAAY,CAAA;AAEjD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwB+D,CAAA;AAE1F,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,cAAc,CAAA;AAMtD,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,YAAY,CAAC,GAAG;IAAE,QAAQ,CAAC,UAAU,CAAC,EAAE,sBAAsB,CAAA;CAAE,CAAA"}
@@ -15,14 +15,14 @@ exports.MOVEMENT_TYPES = {
15
15
  r2p_breb: { code: "r2p_breb" },
16
16
  r2p_top_up_pse: { code: "r2p_top_up_pse" },
17
17
  r2p_top_up_bancolombia: { code: "r2p_top_up_bancolombia" },
18
- global: { code: "global" },
18
+ global: { code: "global", groupLabel: "Stablecoin" },
19
19
  r2p_spei: { code: "r2p_spei" },
20
- on_ramp: { code: "on_ramp" },
21
- off_ramp: { code: "off_ramp" },
20
+ on_ramp: { code: "on_ramp", groupLabel: "Stablecoin" },
21
+ off_ramp: { code: "off_ramp", groupLabel: "Stablecoin" },
22
22
  fedwire: { code: "fedwire" },
23
23
  global_pay_to_usa: { code: "global_pay_to_usa" },
24
24
  usa_pay_to_global: { code: "usa_pay_to_global" },
25
- stable_payout: { code: "stable_payout" },
25
+ stable_payout: { code: "stable_payout", groupLabel: "Stablecoin" },
26
26
  breb: { code: "breb" },
27
27
  global_pay_to_generic: { code: "global_pay_to_generic" },
28
28
  };
@@ -1 +1 @@
1
- {"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../src/movements/types/catalog.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC5B,GAAG,EAAqB,EAAE,IAAI,EAAE,KAAK,EAAE;IACvC,QAAQ,EAAgB,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5C,IAAI,EAAoB,EAAE,IAAI,EAAE,MAAM,EAAE;IACxC,SAAS,EAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7C,WAAW,EAAa,EAAE,IAAI,EAAE,aAAa,EAAE;IAC/C,GAAG,EAAqB,EAAE,IAAI,EAAE,KAAK,EAAE;IACvC,eAAe,EAAS,EAAE,IAAI,EAAE,iBAAiB,EAAE;IACnD,SAAS,EAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7C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D,SAAS,EAAe,EAAE,IAAI,EAAE,WAAW,EAAE;IAC7C,OAAO,EAAiB,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3C,YAAY,EAAY,EAAE,IAAI,EAAE,cAAc,EAAE;IAChD,QAAQ,EAAgB,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5C,cAAc,EAAU,EAAE,IAAI,EAAE,gBAAgB,EAAE;IAClD,sBAAsB,EAAE,EAAE,IAAI,EAAE,wBAAwB,EAAE;IAC1D,MAAM,EAAkB,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE;IACpE,QAAQ,EAAgB,EAAE,IAAI,EAAE,UAAU,EAAE;IAC5C,OAAO,EAAiB,EAAE,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE;IACrE,QAAQ,EAAgB,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE;IACtE,OAAO,EAAiB,EAAE,IAAI,EAAE,SAAS,EAAE;IAC3C,iBAAiB,EAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE;IACrD,iBAAiB,EAAO,EAAE,IAAI,EAAE,mBAAmB,EAAE;IACrD,aAAa,EAAW,EAAE,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,YAAY,EAAE;IAC3E,IAAI,EAAoB,EAAE,IAAI,EAAE,MAAM,EAAE;IACxC,qBAAqB,EAAG,EAAE,IAAI,EAAE,uBAAuB,EAAE;CAC+B,CAAA"}
@@ -1,7 +1,20 @@
1
1
  import type { MovementType, MovementTypeRecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
+ import type { CatalogQuery } from "../../../utils/catalog-query.utils";
3
4
  export type MovementTypeOption = MovementTypeRecord & {
4
5
  label: string;
5
6
  };
6
7
  export declare const getMovementTypes: (lang: Locale) => Record<MovementType, MovementTypeOption>;
8
+ /** i18n domain: `lang` is required, inside the query object — see matchesQuery for the matching rules. */
9
+ export type MovementTypeQuery = CatalogQuery<MovementTypeRecord> & {
10
+ lang: Locale;
11
+ };
12
+ /**
13
+ * The catalog as a list narrowed by the query, each record enriched with its label for `query.lang`.
14
+ *
15
+ * `groupLabel` is optional on the record, so `groupLabel: undefined` is a present key like any other —
16
+ * it matches the 19 records that don't carry a group, not "no filter". A UI filter fed from an optional
17
+ * ref has to be spread in conditionally: `{ lang, ...(group ? { groupLabel: group } : {}) }`.
18
+ */
19
+ export declare const queryMovementTypes: (query: MovementTypeQuery) => MovementTypeOption[];
7
20
  //# sourceMappingURL=movement-type.utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"movement-type.utils.d.ts","sourceRoot":"","sources":["../../../../src/movements/types/utils/movement-type.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAGlE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAI3C,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvE,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAStF,CAAA"}
1
+ {"version":3,"file":"movement-type.utils.d.ts","sourceRoot":"","sources":["../../../../src/movements/types/utils/movement-type.utils.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAA;AAGlE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AAE3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAA;AAItE,MAAM,MAAM,kBAAkB,GAAG,kBAAkB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAA;AAEvE,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,KAAG,MAAM,CAAC,YAAY,EAAE,kBAAkB,CAStF,CAAA;AAED,0GAA0G;AAC1G,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,kBAAkB,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAA;AAEnF;;;;;;GAMG;AACH,eAAO,MAAM,kBAAkB,GAAI,OAAO,iBAAiB,KAAG,kBAAkB,EAM/E,CAAA"}
@@ -3,10 +3,11 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getMovementTypes = void 0;
6
+ exports.queryMovementTypes = exports.getMovementTypes = void 0;
7
7
  const catalog_1 = require("../catalog");
8
8
  const en_json_1 = __importDefault(require("../locales/en.json"));
9
9
  const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
+ const catalog_query_utils_1 = require("../../../utils/catalog-query.utils");
10
11
  const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
11
12
  const getMovementTypes = (lang) => {
12
13
  const locale = locales[lang];
@@ -17,4 +18,18 @@ const getMovementTypes = (lang) => {
17
18
  return result;
18
19
  };
19
20
  exports.getMovementTypes = getMovementTypes;
21
+ /**
22
+ * The catalog as a list narrowed by the query, each record enriched with its label for `query.lang`.
23
+ *
24
+ * `groupLabel` is optional on the record, so `groupLabel: undefined` is a present key like any other —
25
+ * it matches the 19 records that don't carry a group, not "no filter". A UI filter fed from an optional
26
+ * ref has to be spread in conditionally: `{ lang, ...(group ? { groupLabel: group } : {}) }`.
27
+ */
28
+ const queryMovementTypes = (query) => {
29
+ const { lang, ...filters } = query;
30
+ return Object.values(catalog_1.MOVEMENT_TYPES)
31
+ .filter(record => (0, catalog_query_utils_1.matchesQuery)(record, filters))
32
+ .map(record => ({ ...record, label: locales[lang].movementTypes[record.code] }));
33
+ };
34
+ exports.queryMovementTypes = queryMovementTypes;
20
35
  //# sourceMappingURL=movement-type.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"movement-type.utils.js","sourceRoot":"","sources":["../../../../src/movements/types/utils/movement-type.utils.ts"],"names":[],"mappings":";;;;;;AAAA,wCAA2C;AAE3C,iEAAyC;AACzC,yEAAgD;AAGhD,MAAM,OAAO,GAAuC,EAAE,EAAE,EAAE,iBAAQ,EAAE,QAAQ,EAAE,qBAAW,EAAE,CAAA;AAIpF,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAA4C,EAAE;IACzF,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,MAAM,MAAM,GAAG,EAA8C,CAAA;IAE7D,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,wBAAc,CAAC,EAAE,CAAC;QACnD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAA;IAC/E,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AATY,QAAA,gBAAgB,oBAS5B"}
1
+ {"version":3,"file":"movement-type.utils.js","sourceRoot":"","sources":["../../../../src/movements/types/utils/movement-type.utils.ts"],"names":[],"mappings":";;;;;;AAAA,wCAA2C;AAE3C,iEAAyC;AACzC,yEAAgD;AAEhD,4EAAiE;AAGjE,MAAM,OAAO,GAAuC,EAAE,EAAE,EAAE,iBAAQ,EAAE,QAAQ,EAAE,qBAAW,EAAE,CAAA;AAIpF,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAA4C,EAAE;IACzF,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5B,MAAM,MAAM,GAAG,EAA8C,CAAA;IAE7D,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,wBAAc,CAAC,EAAE,CAAC;QACnD,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAA;IAC/E,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC,CAAA;AATY,QAAA,gBAAgB,oBAS5B;AAKD;;;;;;GAMG;AACI,MAAM,kBAAkB,GAAG,CAAC,KAAwB,EAAwB,EAAE;IACnF,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,GAAG,KAAK,CAAA;IAElC,OAAO,MAAM,CAAC,MAAM,CAAC,wBAAc,CAAC;SACjC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,IAAA,kCAAY,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;SAC/C,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAA;AACpF,CAAC,CAAA;AANY,QAAA,kBAAkB,sBAM9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cobre-npm/library-portal-core",
3
- "version": "0.33.0",
3
+ "version": "0.35.0",
4
4
  "description": "Shared configurations and resources for Portal MFEs",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",