@cobre-npm/library-portal-core 0.54.0 → 0.56.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.
Files changed (57) hide show
  1. package/README.md +108 -30
  2. package/dist/cjs/businessLines/catalog.d.ts +19 -0
  3. package/dist/cjs/businessLines/catalog.js +10 -0
  4. package/dist/cjs/businessLines/index.d.ts +2 -0
  5. package/dist/cjs/businessLines/index.js +17 -0
  6. package/dist/cjs/businessLines/utils/business-line.utils.d.ts +2 -0
  7. package/dist/cjs/businessLines/utils/business-line.utils.js +6 -0
  8. package/dist/cjs/countries/base/utils/country.utils.d.ts +7 -0
  9. package/dist/cjs/countries/base/utils/country.utils.js +9 -1
  10. package/dist/cjs/countries/iso/utils/country-iso.utils.d.ts +7 -0
  11. package/dist/cjs/countries/iso/utils/country-iso.utils.js +9 -1
  12. package/dist/cjs/filterClassification/categoryFamilies/catalog.d.ts +33 -0
  13. package/dist/cjs/filterClassification/categoryFamilies/catalog.js +12 -0
  14. package/dist/cjs/filterClassification/categoryFamilies/locales/en.json +11 -0
  15. package/dist/cjs/filterClassification/categoryFamilies/locales/es-mex.json +11 -0
  16. package/dist/cjs/filterClassification/categoryFamilies/utils/filter-classification-category-family.utils.d.ts +8 -0
  17. package/dist/cjs/filterClassification/categoryFamilies/utils/filter-classification-category-family.utils.js +19 -0
  18. package/dist/cjs/filterClassification/index.d.ts +7 -0
  19. package/dist/cjs/filterClassification/index.js +20 -0
  20. package/dist/cjs/filterClassification/interfaces/filter-classification.interface.d.ts +14 -0
  21. package/dist/cjs/filterClassification/interfaces/filter-classification.interface.js +2 -0
  22. package/dist/cjs/filterClassification/sections/catalog.d.ts +28 -0
  23. package/dist/cjs/filterClassification/sections/catalog.js +13 -0
  24. package/dist/cjs/filterClassification/sections/locales/en.json +12 -0
  25. package/dist/cjs/filterClassification/sections/locales/es-mex.json +12 -0
  26. package/dist/cjs/filterClassification/sections/utils/filter-classification-section.utils.d.ts +7 -0
  27. package/dist/cjs/filterClassification/sections/utils/filter-classification-section.utils.js +20 -0
  28. package/dist/cjs/filterClassification/utils/type-group.utils.d.ts +9 -0
  29. package/dist/cjs/filterClassification/utils/type-group.utils.js +21 -0
  30. package/dist/cjs/filterClassification/utils/type-label.utils.d.ts +9 -0
  31. package/dist/cjs/filterClassification/utils/type-label.utils.js +17 -0
  32. package/dist/cjs/movements/index.d.ts +1 -1
  33. package/dist/cjs/movements/types/catalog.d.ts +27 -16
  34. package/dist/cjs/movements/types/catalog.js +26 -26
  35. package/dist/cjs/movements/types/utils/movement-type.utils.d.ts +1 -8
  36. package/dist/cjs/movements/types/utils/movement-type.utils.js +1 -8
  37. package/dist/cjs/transactions/index.d.ts +0 -1
  38. package/dist/esm/businessLines/catalog.js +7 -0
  39. package/dist/esm/businessLines/index.js +1 -0
  40. package/dist/esm/businessLines/utils/business-line.utils.js +2 -0
  41. package/dist/esm/countries/base/utils/country.utils.js +7 -0
  42. package/dist/esm/countries/iso/utils/country-iso.utils.js +7 -0
  43. package/dist/esm/filterClassification/categoryFamilies/catalog.js +9 -0
  44. package/dist/esm/filterClassification/categoryFamilies/locales/en.json +11 -0
  45. package/dist/esm/filterClassification/categoryFamilies/locales/es-mex.json +11 -0
  46. package/dist/esm/filterClassification/categoryFamilies/utils/filter-classification-category-family.utils.js +12 -0
  47. package/dist/esm/filterClassification/index.js +4 -0
  48. package/dist/esm/filterClassification/interfaces/filter-classification.interface.js +1 -0
  49. package/dist/esm/filterClassification/sections/catalog.js +10 -0
  50. package/dist/esm/filterClassification/sections/locales/en.json +12 -0
  51. package/dist/esm/filterClassification/sections/locales/es-mex.json +12 -0
  52. package/dist/esm/filterClassification/sections/utils/filter-classification-section.utils.js +13 -0
  53. package/dist/esm/filterClassification/utils/type-group.utils.js +16 -0
  54. package/dist/esm/filterClassification/utils/type-label.utils.js +13 -0
  55. package/dist/esm/movements/types/catalog.js +26 -26
  56. package/dist/esm/movements/types/utils/movement-type.utils.js +1 -8
  57. package/package.json +11 -1
package/README.md CHANGED
@@ -39,12 +39,14 @@ import { getCountries } from "@cobre-npm/library-portal-core/countries"
39
39
  | `@cobre-npm/library-portal-core/counterparties` | Counterparty types + `Counterparty` interfaces |
40
40
  | `@cobre-npm/library-portal-core/countries` | Countries (base) and ISO countries (dialing codes, etc.) |
41
41
  | `@cobre-npm/library-portal-core/movements` | Movement types and statuses |
42
+ | `@cobre-npm/library-portal-core/businessLines` | Cobre's lines of business (LoB) |
42
43
  | `@cobre-npm/library-portal-core/subclients` | Subclient statuses + `Subclient`/`SubclientPerson` interfaces |
43
44
  | `@cobre-npm/library-portal-core/documentTypes` | Document types (definition + per-country applicability) |
44
45
  | `@cobre-npm/library-portal-core/currencies` | Currencies |
45
46
  | `@cobre-npm/library-portal-core/transactions` | Transaction types + interfaces |
46
47
  | `@cobre-npm/library-portal-core/canonicalTransactions` | Canonical transaction/money-movement detail interfaces |
47
48
  | `@cobre-npm/library-portal-core/search` | Search / aggregation interfaces |
49
+ | `@cobre-npm/library-portal-core/filterClassification` | Grouped type-filter vocabulary (families, sections, categories), `splitTypeLabel`, group-selection helpers |
48
50
  | `@cobre-npm/library-portal-core/trustedSessions` | Trusted session (OTP elevation window) interfaces + constants |
49
51
  | `@cobre-npm/library-portal-core/exports` | Export request/response entity + the engine's format/operator allow-lists |
50
52
  | `@cobre-npm/library-portal-core/financialInstitutions` | Financial institutions (banks) by country, with labels |
@@ -221,62 +223,70 @@ Groups two catalogs:
221
223
 
222
224
  ```ts
223
225
  import {
224
- getCountries, type Country, type CountryOption,
225
- getCountriesISO, getIndicativesWithCodes, hasCountryISOFlag,
226
- type CountryISO, type CountryISOOption, type IndicativeWithCode,
226
+ getCountries, queryCountries, type Country, type CountryOption, type CountryQuery,
227
+ getCountriesISO, queryCountriesISO, getIndicativesWithCodes, hasCountryISOFlag,
228
+ type CountryISO, type CountryISOOption, type CountryISOQuery, type IndicativeWithCode,
227
229
  } from "@cobre-npm/library-portal-core/countries"
228
230
 
229
- getCountries("en").col.label // "Colombia"
230
- getCountriesISO("en").col // { code:"col", isoCode:"COL", indicative:"+57", label:"Colombia" }
231
- getIndicativesWithCodes("en") // view-model for a phone dialing-code selector
232
- hasCountryISOFlag("col") // true — whether a flag asset is available
231
+ getCountries("en").col.label // "Colombia"
232
+ queryCountries({ lang: "en", code: ["mex", "col"] }) // [ mex, col ] → the list a picker needs
233
+ getCountriesISO("en").col // { code:"col", isoCode:"COL", indicative:"+57", label:"Colombia" }
234
+ queryCountriesISO({ lang: "en", isoCode: "MEX" }) // [ mex ] → filter the full ISO catalog
235
+ getIndicativesWithCodes("en") // view-model for a phone dialing-code selector
236
+ hasCountryISOFlag("col") // true — whether a flag asset is available
233
237
  ```
234
238
 
235
239
  - **base** (i18n): business countries (`col`, `mex`, `usa`, `global`, …).
240
+ `queryCountries({ lang, ... })` returns the same catalog as a **list**, narrowed by `code` — same
241
+ matching rules as [`queryAccountTypes`](#accounts): `lang` is required (i18n domain, no default) inside
242
+ the query object, and there is no default field.
236
243
  - **iso** (i18n): full ISO catalog (~249 countries) with `isoCode` and `indicative`.
244
+ `queryCountriesISO({ lang, ... })` returns the same catalog as a **list**, narrowed by `code`/`isoCode`
245
+ — same rules as above, over the full ISO catalog instead of the small business one.
246
+
247
+ As with every `queryX()`, **a key that is present always filters** — it's the absence of the key that
248
+ doesn't. So `queryCountries({ lang, code: undefined })` returns `[]`, not "no filter". An optional UI
249
+ filter has to be spread in conditionally:
250
+
251
+ ```ts
252
+ queryCountries({ lang, ...(codes ? { code: codes } : {}) })
253
+ ```
237
254
 
238
255
  ### `movements`
239
256
 
240
257
  ```ts
241
258
  import {
242
- getMovementTypes, queryMovementTypes, type MovementType, type MovementTypeGroupLabel,
259
+ getMovementTypes, queryMovementTypes, type MovementType,
243
260
  type MovementTypeOption, type MovementTypeQuery,
244
- type ClassificationLine, type ClassificationCategory,
245
261
  getMovementStatuses, queryMovementStatuses, type MovementStatus, type MovementStatusType,
246
262
  type MovementStatusOption, type MovementStatusQuery,
247
263
  } from "@cobre-npm/library-portal-core/movements"
248
264
 
249
265
  getMovementTypes("en").ach.label // "Transfer · ACH"
250
- getMovementTypes("en").on_ramp.groupLabel // "Stablecoin"
266
+ getMovementTypes("en").on_ramp.section // "stablecoin"
251
267
  getMovementTypes("en").on_ramp.label // "Conversion to stablecoin" (individual label)
252
268
  getMovementTypes("en").spei.category // "payments"
253
269
  queryMovementTypes({ lang: "en", category: "top_up" }) // r2p_top_up_bancolombia, r2p_top_up_pse
254
- queryMovementTypes({ lang: "en", groupLabel: "Stablecoin" }) // global, off_ramp, on_ramp, stable_payout
270
+ queryMovementTypes({ lang: "en", section: "stablecoin" }) // global, off_ramp, on_ramp, stable_payout
255
271
  getMovementStatuses("en").completed // { code: "completed", label: "Completed", type: "success", icon: "icon-check" }
256
272
  queryMovementStatuses({ lang: "en", type: "error" }) // error, failed, rejected — localized
257
273
  ```
258
274
 
259
275
  - **types** (i18n): movement types, usually labelled as "what you did · rail" (`Transfer · SPEI`,
260
276
  `Collection · Bre-B`). Movement and transaction types share one classification, carried on each record as
261
- codes, not translated text (nothing displays them yet): `line: ClassificationLine`
262
- (`payin | payout | cbmm | stable | unclassified`) and `category: ClassificationCategory`
263
- (`payments | collections | conversions | international | between_accounts | top_up | adjustment |
264
- reward | unclassified`). Both types are exported from `/movements` and `/transactions` (the same types on
265
- both subpaths). `on_ramp`/`off_ramp`/`stable_payout`/`global`
266
- additionally carry `groupLabel: "Stablecoin"` — a display grouping for views that need to show them
267
- under one label. `getMovementTypes()` keeps returning each rail's own individual `label` unchanged; a
268
- consumer that wants the grouped label picks `groupLabel ?? label`. There's no separate `getXLabel`
269
- for this — the value already comes back inside `getMovementTypes()`, same as everything else in this
270
- catalog.
277
+ codes, not translated text (nothing displays them yet): `line: BusinessLine`
278
+ (`payin | payout | cbmm | stable | unclassified`, defined in [`businessLines`](#businesslines)) and
279
+ `category: FilterClassificationCategory` (`payments | collections | conversions | international | between_accounts | top_up |
280
+ adjustment | reward | unclassified`, defined in [`filterClassification`](#filterclassification)). Each movement type also carries a
281
+ `section: FilterClassificationSection` (`cop | mxn | usd_global | eur | corridors | stablecoin | …`), the heading it
282
+ is listed under in grouped filters. `getMovementTypes()` returns each rail's own `label` unchanged.
271
283
  - **types query** (i18n `queryX()`): `queryMovementTypes({ lang, ...filters })` — same rules as
272
- `queryTransactionTypes`/`queryDocumentTypes`, no default field. `code`, `line`, `category`, `group` and
273
- `groupLabel` are filterable (equality only; a list matches any of its values). Filter by `group`, not
274
- `groupLabel` — the label is display text. Both are optional on the record: **a key that is present always filters**, so
275
- `groupLabel: undefined` matches the rails that don't carry a group, not "no filter". An optional UI
284
+ `queryTransactionTypes`/`queryDocumentTypes`, no default field. `code`, `line`, `category` and `section` are
285
+ filterable (equality only; a list matches any of its values). A present key always filters, so an optional UI
276
286
  filter has to be spread in conditionally:
277
287
 
278
288
  ```ts
279
- queryMovementTypes({ lang, ...(group.value ? { groupLabel: group.value } : {}) })
289
+ queryMovementTypes({ lang, ...(section.value ? { section: section.value } : {}) })
280
290
  ```
281
291
  - **status** (i18n): movement statuses (`initiated`, `processing`, `completed`, …). Each record also
282
292
  carries `type: MovementStatusType` (`success | warning | error | info | neutral | pending`) — a
@@ -291,6 +301,21 @@ queryMovementStatuses({ lang: "en", type: "error" }) // error, failed, rejected
291
301
  the real use case: `queryMovementStatuses({ lang, type: "error" })` returns `error`, `failed`,
292
302
  `rejected`, replacing a hand-maintained list of codes with a query.
293
303
 
304
+ ### `businessLines`
305
+
306
+ Cobre's lines of business (LoB). No i18n (no labels exist yet), so `getBusinessLines()` takes no arguments.
307
+
308
+ ```ts
309
+ import { getBusinessLines, type BusinessLine } from "@cobre-npm/library-portal-core/businessLines"
310
+
311
+ getBusinessLines().cbmm // { code: "cbmm" }
312
+ ```
313
+
314
+ - **lines**: `payin`, `payout`, `cbmm`, `stable`, `unclassified`. `BusinessLine` is the type of the `line` field of
315
+ movement and transaction types.
316
+ - `/movements` and `/transactions` no longer re-export the line/category types (formerly `ClassificationLine` /
317
+ `ClassificationCategory`): use `BusinessLine` from `/businessLines` and `FilterClassificationCategory` from [`/filterClassification`](#filterclassification).
318
+
294
319
  ### `subclients`
295
320
 
296
321
  ```ts
@@ -415,7 +440,6 @@ And two on rule 1: `{ minAmount: 1 }` is equality, not `>=`, which is rarely wha
415
440
  ```ts
416
441
  import {
417
442
  getTransactionTypes, queryTransactionTypes, type TransactionType, type TransactionTypeQuery,
418
- type ClassificationLine, type ClassificationCategory,
419
443
  type Transaction, type EnrichedTransaction, /* ...interfaces */
420
444
  } from "@cobre-npm/library-portal-core/transactions"
421
445
 
@@ -427,7 +451,7 @@ queryTransactionTypes({ lang: "en", category: "top_up" }) // col_top_up_credit
427
451
 
428
452
  - **types** (i18n): `getTransactionTypes(lang)`; each record carries `code`, `creditDebitType`
429
453
  (`"credit" | "debit"` — the same `CreditDebitType` used by the `Transaction` interface), `label`, and the same
430
- `line: ClassificationLine` / `category: ClassificationCategory` codes as movement types (value sets
454
+ `line: BusinessLine` / `category: FilterClassificationCategory` codes as movement types (value sets
431
455
  listed under [`movements`](#movements)). Labels are usually "what you did · rail" (`Outgoing transfer ·
432
456
  SPEI`). Types that stand for a collapsed matrix row (`cbmm_*`, `internal_*`, `mex_*`, `col_debit`/`col_credit`, `misc_*`,
433
457
  `adjustment_*`, `col_cb_*`, the corridors, ramps and `stable_payout_*`, plus `transfer_credit`) add a
@@ -442,12 +466,66 @@ queryTransactionTypes({ lang: "en", category: "top_up" }) // col_top_up_credit
442
466
  `queryTransactionTypes({ lang: "en", line: "payin", category: "collections" })`.
443
467
  - **interfaces**: `Transaction`, `EnrichedTransaction`, `TransactionMetadata`, `CreditDebitType`.
444
468
 
445
- ### `search` / `trustedSessions`
469
+ ### `search`
446
470
 
447
- Interfaces only (pure types):
471
+ Interfaces only (pure types): the Cobre Search request/response contract.
448
472
 
449
473
  ```ts
450
474
  import type { SearchRequest, SearchResponse, SearchFilter } from "@cobre-npm/library-portal-core/search"
475
+ ```
476
+
477
+ ### `filterClassification`
478
+
479
+ The vocabulary of the grouped type filter, shared by movement and transaction types and owned by neither (some
480
+ transactions, like adjustments and rewards, have no money movement): **families** are the chips, **sections** are
481
+ the headings inside a chip, and **types** (movement / transaction types) are the options.
482
+
483
+ ```ts
484
+ import {
485
+ getFilterClassificationCategoryFamilies, getFilterClassificationSections, splitTypeLabel,
486
+ expandGroupSelection, getGroupSelectionState,
487
+ type FilterClassificationCategoryFamily, type FilterClassificationSection,
488
+ type FilterClassificationCategory, type FilterClassificationRecord,
489
+ } from "@cobre-npm/library-portal-core/filterClassification"
490
+
491
+ declare const types: { category: FilterClassificationCategory }[] // e.g. Object.values(getMovementTypes("en"))
492
+ declare const record: { section: FilterClassificationSection } // one of those types
493
+ declare const groups: FilterClassificationRecord<string>[] // the UI's group records
494
+ declare const group: FilterClassificationRecord<string> // one of them
495
+ declare const selectedCodes: string[] // what the user has ticked
496
+
497
+ const families = getFilterClassificationCategoryFamilies("en")
498
+ families.between_accounts.label // "Between accounts"
499
+ families.between_accounts.categories // ["between_accounts", "adjustment", "reward"]
500
+ types.filter(type => families.between_accounts.categories.includes(type.category)) // group types by family
501
+ getFilterClassificationSections("es-mex")[record.section].label // "Corredores"
502
+ splitTypeLabel("Transfer · ACH") // { title: "Transfer", rail: "ACH" }
503
+ splitTypeLabel("International") // { title: "International" } — no empty rail
504
+ expandGroupSelection(["stablecoin_group", "ach"], groups) // member codes + "ach"; the group code is never returned
505
+ getGroupSelectionState(group, selectedCodes) // "checked" | "indeterminate" | "unchecked"
506
+ ```
507
+
508
+ - **Family** (`FilterClassificationCategoryFamily`): the chips of the grouped type filter, in chip order: `payments`, `collections`,
509
+ `international`, `conversions`, `top_up`, `between_accounts` and `unclassified`. Each family lists the
510
+ `categories` it groups, and a category belongs to exactly one family (`adjustment` and `reward` fold into
511
+ `between_accounts`). `getFilterClassificationCategoryFamilies(lang)` returns each family with its label and categories; `lang` is required.
512
+ - **Category** (`FilterClassificationCategory`): derived from the families' lists: `payments`, `collections`, `conversions`,
513
+ `international`, `between_accounts`, `top_up`, `adjustment`, `reward`, `unclassified`. The family is never stored
514
+ per record: group types by family with `getFilterClassificationCategoryFamilies(lang)[family].categories.includes(type.category)`.
515
+ - **Section** (`FilterClassificationSection`): groups types by currency, rail or corridor (`cop`, `mxn`, `usd_global`, `eur`,
516
+ `corridors`, `stablecoin`). It is stored per type, used as a heading in the grouped filter, never selectable and
517
+ never sent to an API. `getFilterClassificationSections(lang)`. `internal` and `connected_account` exist but no movement type uses
518
+ them yet.
519
+ - **`splitTypeLabel(label)`**: splits at the first `" · "` into `{ title, rail? }` for two-line options.
520
+ - **group helpers**: `FilterClassificationRecord<Code>` (`code`, `members`, `line`, `category`, `section`). A group code is a UI
521
+ identifier: `expandGroupSelection` swaps it for its members before calling an API, and `getGroupSelectionState`
522
+ gives the checkbox state from the selected member codes.
523
+
524
+ ### `trustedSessions`
525
+
526
+ Interfaces only (pure types):
527
+
528
+ ```ts
451
529
  import type { TrustedSessionStatus } from "@cobre-npm/library-portal-core/trustedSessions"
452
530
  ```
453
531
 
@@ -0,0 +1,19 @@
1
+ export declare const BUSINESS_LINES: {
2
+ readonly payin: {
3
+ readonly code: "payin";
4
+ };
5
+ readonly payout: {
6
+ readonly code: "payout";
7
+ };
8
+ readonly cbmm: {
9
+ readonly code: "cbmm";
10
+ };
11
+ readonly stable: {
12
+ readonly code: "stable";
13
+ };
14
+ readonly unclassified: {
15
+ readonly code: "unclassified";
16
+ };
17
+ };
18
+ export type BusinessLine = keyof typeof BUSINESS_LINES;
19
+ export type BusinessLineRecord = (typeof BUSINESS_LINES)[BusinessLine];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BUSINESS_LINES = void 0;
4
+ exports.BUSINESS_LINES = {
5
+ payin: { code: "payin" },
6
+ payout: { code: "payout" },
7
+ cbmm: { code: "cbmm" },
8
+ stable: { code: "stable" },
9
+ unclassified: { code: "unclassified" },
10
+ };
@@ -0,0 +1,2 @@
1
+ export type { BusinessLine, BusinessLineRecord } from "./catalog";
2
+ export * from "./utils/business-line.utils";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./utils/business-line.utils"), exports);
@@ -0,0 +1,2 @@
1
+ import type { BusinessLine, BusinessLineRecord } from "../catalog";
2
+ export declare const getBusinessLines: () => Record<BusinessLine, BusinessLineRecord>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBusinessLines = void 0;
4
+ const catalog_1 = require("../catalog");
5
+ const getBusinessLines = () => catalog_1.BUSINESS_LINES;
6
+ exports.getBusinessLines = getBusinessLines;
@@ -1,6 +1,13 @@
1
1
  import type { Country, CountryRecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
+ import type { CatalogQuery } from "../../../utils/catalog-query.utils";
3
4
  export type CountryOption = CountryRecord & {
4
5
  label: string;
5
6
  };
6
7
  export declare const getCountries: (lang: Locale) => Record<Country, CountryOption>;
8
+ /** `lang` is required (i18n domain, no default) and travels inside the query object, never positional. */
9
+ export type CountryQuery = CatalogQuery<CountryRecord> & {
10
+ lang: Locale;
11
+ };
12
+ /** The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules. */
13
+ export declare const queryCountries: (query: CountryQuery) => CountryOption[];
@@ -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.getCountries = void 0;
6
+ exports.queryCountries = exports.getCountries = 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 getCountries = (lang) => {
12
13
  const locale = locales[lang];
@@ -17,3 +18,10 @@ const getCountries = (lang) => {
17
18
  return result;
18
19
  };
19
20
  exports.getCountries = getCountries;
21
+ /** The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules. */
22
+ const queryCountries = (query) => {
23
+ const { lang, ...criteria } = query;
24
+ const countries = (0, exports.getCountries)(lang);
25
+ return Object.values(countries).filter(country => (0, catalog_query_utils_1.matchesQuery)(country, criteria));
26
+ };
27
+ exports.queryCountries = queryCountries;
@@ -1,5 +1,6 @@
1
1
  import type { CountryISO, CountryISORecord } from "../catalog";
2
2
  import type { Locale } from "../../../lang";
3
+ import type { CatalogQuery } from "../../../utils/catalog-query.utils";
3
4
  export declare const hasCountryISOFlag: (code: CountryISO) => boolean;
4
5
  export type CountryISOOption = CountryISORecord & {
5
6
  label: string;
@@ -12,4 +13,10 @@ export interface IndicativeWithCode {
12
13
  isoCode: string | undefined;
13
14
  }
14
15
  export declare const getCountriesISO: (lang: Locale) => Record<CountryISO, CountryISOOption>;
16
+ /** `lang` is required (i18n domain, no default) and travels inside the query object, never positional. */
17
+ export type CountryISOQuery = CatalogQuery<CountryISORecord> & {
18
+ lang: Locale;
19
+ };
20
+ /** The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules. */
21
+ export declare const queryCountriesISO: (query: CountryISOQuery) => CountryISOOption[];
15
22
  export declare const getIndicativesWithCodes: (lang: Locale) => IndicativeWithCode[];
@@ -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.getIndicativesWithCodes = exports.getCountriesISO = exports.hasCountryISOFlag = void 0;
6
+ exports.getIndicativesWithCodes = exports.queryCountriesISO = exports.getCountriesISO = exports.hasCountryISOFlag = 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 AVAILABLE_FLAG_CODES = new Set(["col", "mex", "usa"]);
12
13
  const hasCountryISOFlag = (code) => AVAILABLE_FLAG_CODES.has(code);
@@ -20,6 +21,13 @@ const getCountriesISO = (lang) => {
20
21
  return result;
21
22
  };
22
23
  exports.getCountriesISO = getCountriesISO;
24
+ /** The catalog as a list, narrowed by the query — see `matchesQuery` for the matching rules. */
25
+ const queryCountriesISO = (query) => {
26
+ const { lang, ...criteria } = query;
27
+ const countries = (0, exports.getCountriesISO)(lang);
28
+ return Object.values(countries).filter(country => (0, catalog_query_utils_1.matchesQuery)(country, criteria));
29
+ };
30
+ exports.queryCountriesISO = queryCountriesISO;
23
31
  const getIndicativesWithCodes = (lang) => {
24
32
  const locale = locales[lang];
25
33
  const seenDialCodes = new Set();
@@ -0,0 +1,33 @@
1
+ export declare const FILTER_CLASSIFICATION_CATEGORY_FAMILIES: {
2
+ readonly payments: {
3
+ readonly code: "payments";
4
+ readonly categories: readonly ["payments"];
5
+ };
6
+ readonly collections: {
7
+ readonly code: "collections";
8
+ readonly categories: readonly ["collections"];
9
+ };
10
+ readonly international: {
11
+ readonly code: "international";
12
+ readonly categories: readonly ["international"];
13
+ };
14
+ readonly conversions: {
15
+ readonly code: "conversions";
16
+ readonly categories: readonly ["conversions"];
17
+ };
18
+ readonly top_up: {
19
+ readonly code: "top_up";
20
+ readonly categories: readonly ["top_up"];
21
+ };
22
+ readonly between_accounts: {
23
+ readonly code: "between_accounts";
24
+ readonly categories: readonly ["between_accounts", "adjustment", "reward"];
25
+ };
26
+ readonly unclassified: {
27
+ readonly code: "unclassified";
28
+ readonly categories: readonly ["unclassified"];
29
+ };
30
+ };
31
+ export type FilterClassificationCategoryFamily = keyof typeof FILTER_CLASSIFICATION_CATEGORY_FAMILIES;
32
+ export type FilterClassificationCategoryFamilyRecord = (typeof FILTER_CLASSIFICATION_CATEGORY_FAMILIES)[FilterClassificationCategoryFamily];
33
+ export type FilterClassificationCategory = FilterClassificationCategoryFamilyRecord["categories"][number];
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FILTER_CLASSIFICATION_CATEGORY_FAMILIES = void 0;
4
+ exports.FILTER_CLASSIFICATION_CATEGORY_FAMILIES = {
5
+ payments: { code: "payments", categories: ["payments"] },
6
+ collections: { code: "collections", categories: ["collections"] },
7
+ international: { code: "international", categories: ["international"] },
8
+ conversions: { code: "conversions", categories: ["conversions"] },
9
+ top_up: { code: "top_up", categories: ["top_up"] },
10
+ between_accounts: { code: "between_accounts", categories: ["between_accounts", "adjustment", "reward"] },
11
+ unclassified: { code: "unclassified", categories: ["unclassified"] },
12
+ };
@@ -0,0 +1,11 @@
1
+ {
2
+ "categoryFamilies": {
3
+ "payments": "Payments",
4
+ "collections": "Collections",
5
+ "international": "International",
6
+ "conversions": "Conversions",
7
+ "top_up": "Top-up",
8
+ "between_accounts": "Between accounts",
9
+ "unclassified": "Unclassified"
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ {
2
+ "categoryFamilies": {
3
+ "payments": "Pagos",
4
+ "collections": "Recaudos",
5
+ "international": "Internacional",
6
+ "conversions": "Conversiones",
7
+ "top_up": "Recarga",
8
+ "between_accounts": "Entre cuentas",
9
+ "unclassified": "Sin clasificar"
10
+ }
11
+ }
@@ -0,0 +1,8 @@
1
+ import type { FilterClassificationCategory, FilterClassificationCategoryFamily } from "../catalog";
2
+ import type { Locale } from "../../../lang";
3
+ export type FilterClassificationCategoryFamilyOption = {
4
+ code: FilterClassificationCategoryFamily;
5
+ categories: readonly FilterClassificationCategory[];
6
+ label: string;
7
+ };
8
+ export declare const getFilterClassificationCategoryFamilies: (lang: Locale) => Record<FilterClassificationCategoryFamily, FilterClassificationCategoryFamilyOption>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getFilterClassificationCategoryFamilies = void 0;
7
+ const catalog_1 = require("../catalog");
8
+ const en_json_1 = __importDefault(require("../locales/en.json"));
9
+ const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
+ const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
11
+ const getFilterClassificationCategoryFamilies = (lang) => {
12
+ const locale = locales[lang];
13
+ const result = {};
14
+ for (const record of Object.values(catalog_1.FILTER_CLASSIFICATION_CATEGORY_FAMILIES)) {
15
+ result[record.code] = { ...record, label: locale.categoryFamilies[record.code] };
16
+ }
17
+ return result;
18
+ };
19
+ exports.getFilterClassificationCategoryFamilies = getFilterClassificationCategoryFamilies;
@@ -0,0 +1,7 @@
1
+ export type { FilterClassificationRecord } from "./interfaces/filter-classification.interface";
2
+ export type { FilterClassificationCategory, FilterClassificationCategoryFamily } from "./categoryFamilies/catalog";
3
+ export * from "./categoryFamilies/utils/filter-classification-category-family.utils";
4
+ export type { FilterClassificationSection } from "./sections/catalog";
5
+ export * from "./sections/utils/filter-classification-section.utils";
6
+ export * from "./utils/type-label.utils";
7
+ export * from "./utils/type-group.utils";
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./categoryFamilies/utils/filter-classification-category-family.utils"), exports);
18
+ __exportStar(require("./sections/utils/filter-classification-section.utils"), exports);
19
+ __exportStar(require("./utils/type-label.utils"), exports);
20
+ __exportStar(require("./utils/type-group.utils"), exports);
@@ -0,0 +1,14 @@
1
+ import type { BusinessLine } from "../../businessLines/catalog";
2
+ import type { FilterClassificationCategory } from "../categoryFamilies/catalog";
3
+ import type { FilterClassificationSection } from "../sections/catalog";
4
+ /**
5
+ * A selectable group of type codes (one checkbox that stands for several types). The group `code` is a UI
6
+ * identifier: it is never sent to an API, only its `members` are — see `expandGroupSelection`.
7
+ */
8
+ export type FilterClassificationRecord<Code extends string> = {
9
+ readonly code: Code;
10
+ readonly members: readonly Code[];
11
+ readonly line: BusinessLine;
12
+ readonly category: FilterClassificationCategory;
13
+ readonly section: FilterClassificationSection;
14
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,28 @@
1
+ export declare const FILTER_CLASSIFICATION_SECTIONS: {
2
+ readonly cop: {
3
+ readonly code: "cop";
4
+ };
5
+ readonly mxn: {
6
+ readonly code: "mxn";
7
+ };
8
+ readonly usd_global: {
9
+ readonly code: "usd_global";
10
+ };
11
+ readonly eur: {
12
+ readonly code: "eur";
13
+ };
14
+ readonly corridors: {
15
+ readonly code: "corridors";
16
+ };
17
+ readonly stablecoin: {
18
+ readonly code: "stablecoin";
19
+ };
20
+ readonly internal: {
21
+ readonly code: "internal";
22
+ };
23
+ readonly connected_account: {
24
+ readonly code: "connected_account";
25
+ };
26
+ };
27
+ export type FilterClassificationSection = keyof typeof FILTER_CLASSIFICATION_SECTIONS;
28
+ export type FilterClassificationSectionRecord = (typeof FILTER_CLASSIFICATION_SECTIONS)[FilterClassificationSection];
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FILTER_CLASSIFICATION_SECTIONS = void 0;
4
+ exports.FILTER_CLASSIFICATION_SECTIONS = {
5
+ cop: { code: "cop" },
6
+ mxn: { code: "mxn" },
7
+ usd_global: { code: "usd_global" },
8
+ eur: { code: "eur" },
9
+ corridors: { code: "corridors" },
10
+ stablecoin: { code: "stablecoin" },
11
+ internal: { code: "internal" },
12
+ connected_account: { code: "connected_account" },
13
+ };
@@ -0,0 +1,12 @@
1
+ {
2
+ "sections": {
3
+ "cop": "COP",
4
+ "mxn": "MXN",
5
+ "usd_global": "USD / Global",
6
+ "eur": "EUR",
7
+ "corridors": "Corridors",
8
+ "stablecoin": "Stablecoin",
9
+ "internal": "Internal",
10
+ "connected_account": "Connected account"
11
+ }
12
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "sections": {
3
+ "cop": "COP",
4
+ "mxn": "MXN",
5
+ "usd_global": "USD / Global",
6
+ "eur": "EUR",
7
+ "corridors": "Corredores",
8
+ "stablecoin": "Stablecoin",
9
+ "internal": "Internas",
10
+ "connected_account": "Cuenta conectada"
11
+ }
12
+ }
@@ -0,0 +1,7 @@
1
+ import type { FilterClassificationSection, FilterClassificationSectionRecord } from "../catalog";
2
+ import type { Locale } from "../../../lang";
3
+ export type FilterClassificationSectionOption = FilterClassificationSectionRecord & {
4
+ label: string;
5
+ };
6
+ /** The section headings indexed by code, each with its label. A section is a heading: never selectable, never sent to an API. */
7
+ export declare const getFilterClassificationSections: (lang: Locale) => Record<FilterClassificationSection, FilterClassificationSectionOption>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getFilterClassificationSections = void 0;
7
+ const catalog_1 = require("../catalog");
8
+ const en_json_1 = __importDefault(require("../locales/en.json"));
9
+ const es_mex_json_1 = __importDefault(require("../locales/es-mex.json"));
10
+ const locales = { en: en_json_1.default, "es-mex": es_mex_json_1.default };
11
+ /** The section headings indexed by code, each with its label. A section is a heading: never selectable, never sent to an API. */
12
+ const getFilterClassificationSections = (lang) => {
13
+ const locale = locales[lang];
14
+ const result = {};
15
+ for (const record of Object.values(catalog_1.FILTER_CLASSIFICATION_SECTIONS)) {
16
+ result[record.code] = { ...record, label: locale.sections[record.code] };
17
+ }
18
+ return result;
19
+ };
20
+ exports.getFilterClassificationSections = getFilterClassificationSections;