@cobre-npm/library-portal-core 0.56.0 → 0.57.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 +35 -4
- package/dist/cjs/filterClassification/interfaces/filter-classification.interface.d.ts +2 -2
- package/dist/cjs/filterClassification/utils/type-group.utils.d.ts +6 -2
- package/dist/cjs/filterClassification/utils/type-group.utils.js +4 -1
- package/dist/cjs/transactions/index.d.ts +1 -1
- package/dist/cjs/transactions/types/catalog.d.ts +108 -0
- package/dist/cjs/transactions/types/catalog.js +101 -0
- package/dist/cjs/transactions/types/locales/en.json +9 -0
- package/dist/cjs/transactions/types/locales/es-mex.json +9 -0
- package/dist/cjs/transactions/types/utils/transaction-type.utils.d.ts +12 -1
- package/dist/cjs/transactions/types/utils/transaction-type.utils.js +30 -1
- package/dist/esm/filterClassification/utils/type-group.utils.js +2 -0
- package/dist/esm/transactions/types/catalog.js +101 -0
- package/dist/esm/transactions/types/locales/en.json +9 -0
- package/dist/esm/transactions/types/locales/es-mex.json +9 -0
- package/dist/esm/transactions/types/utils/transaction-type.utils.js +28 -0
- package/package.json +1 -1
|
@@ -7,287 +7,388 @@ exports.TRANSACTION_TYPES = {
|
|
|
7
7
|
code: "spei_debit",
|
|
8
8
|
line: "payout",
|
|
9
9
|
category: "payments",
|
|
10
|
+
section: "mxn",
|
|
11
|
+
group: null,
|
|
10
12
|
},
|
|
11
13
|
spei_credit: {
|
|
12
14
|
creditDebitType: "credit",
|
|
13
15
|
code: "spei_credit",
|
|
14
16
|
line: "payin",
|
|
15
17
|
category: "collections",
|
|
18
|
+
section: "mxn",
|
|
19
|
+
group: null,
|
|
16
20
|
},
|
|
17
21
|
spei_return: {
|
|
18
22
|
creditDebitType: "credit",
|
|
19
23
|
code: "spei_return",
|
|
20
24
|
line: "payout",
|
|
21
25
|
category: "payments",
|
|
26
|
+
section: "mxn",
|
|
27
|
+
group: null,
|
|
22
28
|
},
|
|
23
29
|
spei_rejected: {
|
|
24
30
|
creditDebitType: "credit",
|
|
25
31
|
code: "spei_rejected",
|
|
26
32
|
line: "payout",
|
|
27
33
|
category: "payments",
|
|
34
|
+
section: "mxn",
|
|
35
|
+
group: null,
|
|
28
36
|
},
|
|
29
37
|
internal_spei_debit: {
|
|
30
38
|
creditDebitType: "debit",
|
|
31
39
|
code: "internal_spei_debit",
|
|
32
40
|
line: "unclassified",
|
|
33
41
|
category: "between_accounts",
|
|
42
|
+
section: "internal",
|
|
43
|
+
group: null,
|
|
44
|
+
filterDisplay: "when_present",
|
|
34
45
|
},
|
|
35
46
|
internal_spei_credit: {
|
|
36
47
|
creditDebitType: "credit",
|
|
37
48
|
code: "internal_spei_credit",
|
|
38
49
|
line: "unclassified",
|
|
39
50
|
category: "between_accounts",
|
|
51
|
+
section: "internal",
|
|
52
|
+
group: null,
|
|
53
|
+
filterDisplay: "when_present",
|
|
40
54
|
},
|
|
41
55
|
adjustment_credit: {
|
|
42
56
|
creditDebitType: "credit",
|
|
43
57
|
code: "adjustment_credit",
|
|
44
58
|
line: "unclassified",
|
|
45
59
|
category: "adjustment",
|
|
60
|
+
section: "internal",
|
|
61
|
+
group: null,
|
|
46
62
|
},
|
|
47
63
|
adjustment_debit: {
|
|
48
64
|
creditDebitType: "debit",
|
|
49
65
|
code: "adjustment_debit",
|
|
50
66
|
line: "unclassified",
|
|
51
67
|
category: "adjustment",
|
|
68
|
+
section: "internal",
|
|
69
|
+
group: null,
|
|
52
70
|
},
|
|
53
71
|
mex_debit: {
|
|
54
72
|
creditDebitType: "debit",
|
|
55
73
|
code: "mex_debit",
|
|
56
74
|
line: "payout",
|
|
57
75
|
category: "payments",
|
|
76
|
+
section: "connected_account",
|
|
77
|
+
group: null,
|
|
58
78
|
},
|
|
59
79
|
mex_credit: {
|
|
60
80
|
creditDebitType: "credit",
|
|
61
81
|
code: "mex_credit",
|
|
62
82
|
line: "payout",
|
|
63
83
|
category: "payments",
|
|
84
|
+
section: "connected_account",
|
|
85
|
+
group: null,
|
|
64
86
|
},
|
|
65
87
|
col_debit: {
|
|
66
88
|
creditDebitType: "debit",
|
|
67
89
|
code: "col_debit",
|
|
68
90
|
line: "payout",
|
|
69
91
|
category: "payments",
|
|
92
|
+
section: "connected_account",
|
|
93
|
+
group: null,
|
|
70
94
|
},
|
|
71
95
|
col_credit: {
|
|
72
96
|
creditDebitType: "credit",
|
|
73
97
|
code: "col_credit",
|
|
74
98
|
line: "payout",
|
|
75
99
|
category: "payments",
|
|
100
|
+
section: "connected_account",
|
|
101
|
+
group: null,
|
|
76
102
|
},
|
|
77
103
|
misc_debit: {
|
|
78
104
|
creditDebitType: "debit",
|
|
79
105
|
code: "misc_debit",
|
|
80
106
|
line: "unclassified",
|
|
81
107
|
category: "unclassified",
|
|
108
|
+
section: "connected_account",
|
|
109
|
+
group: null,
|
|
110
|
+
filterDisplay: "when_present",
|
|
82
111
|
},
|
|
83
112
|
misc_credit: {
|
|
84
113
|
creditDebitType: "credit",
|
|
85
114
|
code: "misc_credit",
|
|
86
115
|
line: "unclassified",
|
|
87
116
|
category: "unclassified",
|
|
117
|
+
section: "connected_account",
|
|
118
|
+
group: null,
|
|
119
|
+
filterDisplay: "when_present",
|
|
88
120
|
},
|
|
89
121
|
internal_credit: {
|
|
90
122
|
creditDebitType: "credit",
|
|
91
123
|
code: "internal_credit",
|
|
92
124
|
line: "unclassified",
|
|
93
125
|
category: "between_accounts",
|
|
126
|
+
section: "internal",
|
|
127
|
+
group: "internal",
|
|
94
128
|
},
|
|
95
129
|
internal_debit: {
|
|
96
130
|
creditDebitType: "debit",
|
|
97
131
|
code: "internal_debit",
|
|
98
132
|
line: "unclassified",
|
|
99
133
|
category: "between_accounts",
|
|
134
|
+
section: "internal",
|
|
135
|
+
group: "internal",
|
|
100
136
|
},
|
|
101
137
|
r2p_credit: {
|
|
102
138
|
creditDebitType: "credit",
|
|
103
139
|
code: "r2p_credit",
|
|
104
140
|
line: "payin",
|
|
105
141
|
category: "collections",
|
|
142
|
+
section: "cop",
|
|
143
|
+
group: null,
|
|
106
144
|
},
|
|
107
145
|
cbmm_debit: {
|
|
108
146
|
creditDebitType: "debit",
|
|
109
147
|
code: "cbmm_debit",
|
|
110
148
|
line: "cbmm",
|
|
111
149
|
category: "international",
|
|
150
|
+
section: "corridors",
|
|
151
|
+
group: "cbmm",
|
|
112
152
|
},
|
|
113
153
|
cbmm_credit: {
|
|
114
154
|
creditDebitType: "credit",
|
|
115
155
|
code: "cbmm_credit",
|
|
116
156
|
line: "cbmm",
|
|
117
157
|
category: "international",
|
|
158
|
+
section: "corridors",
|
|
159
|
+
group: "cbmm",
|
|
118
160
|
},
|
|
119
161
|
dd_credit: {
|
|
120
162
|
creditDebitType: "credit",
|
|
121
163
|
code: "dd_credit",
|
|
122
164
|
line: "payin",
|
|
123
165
|
category: "collections",
|
|
166
|
+
section: "cop",
|
|
167
|
+
group: null,
|
|
124
168
|
},
|
|
125
169
|
col_cb_credit: {
|
|
126
170
|
creditDebitType: "credit",
|
|
127
171
|
code: "col_cb_credit",
|
|
128
172
|
line: "payin",
|
|
129
173
|
category: "between_accounts",
|
|
174
|
+
section: "internal",
|
|
175
|
+
group: null,
|
|
130
176
|
},
|
|
131
177
|
col_cb_debit: {
|
|
132
178
|
creditDebitType: "debit",
|
|
133
179
|
code: "col_cb_debit",
|
|
134
180
|
line: "payin",
|
|
135
181
|
category: "between_accounts",
|
|
182
|
+
section: "internal",
|
|
183
|
+
group: null,
|
|
184
|
+
filterDisplay: "when_present",
|
|
136
185
|
},
|
|
137
186
|
breb_credit: {
|
|
138
187
|
creditDebitType: "credit",
|
|
139
188
|
code: "breb_credit",
|
|
140
189
|
line: "payin",
|
|
141
190
|
category: "collections",
|
|
191
|
+
section: "cop",
|
|
192
|
+
group: null,
|
|
142
193
|
},
|
|
143
194
|
breb_debit: {
|
|
144
195
|
creditDebitType: "debit",
|
|
145
196
|
code: "breb_debit",
|
|
146
197
|
line: "payout",
|
|
147
198
|
category: "payments",
|
|
199
|
+
section: "cop",
|
|
200
|
+
group: null,
|
|
148
201
|
},
|
|
149
202
|
r2p_breb_credit: {
|
|
150
203
|
creditDebitType: "credit",
|
|
151
204
|
code: "r2p_breb_credit",
|
|
152
205
|
line: "payin",
|
|
153
206
|
category: "collections",
|
|
207
|
+
section: "cop",
|
|
208
|
+
group: null,
|
|
154
209
|
},
|
|
155
210
|
breb_rejected: {
|
|
156
211
|
creditDebitType: "credit",
|
|
157
212
|
code: "breb_rejected",
|
|
158
213
|
line: "payout",
|
|
159
214
|
category: "payments",
|
|
215
|
+
section: "cop",
|
|
216
|
+
group: null,
|
|
160
217
|
},
|
|
161
218
|
col_top_up_credit: {
|
|
162
219
|
creditDebitType: "credit",
|
|
163
220
|
code: "col_top_up_credit",
|
|
164
221
|
line: "payin",
|
|
165
222
|
category: "top_up",
|
|
223
|
+
section: "internal",
|
|
224
|
+
group: null,
|
|
166
225
|
},
|
|
167
226
|
global_debit: {
|
|
168
227
|
creditDebitType: "debit",
|
|
169
228
|
code: "global_debit",
|
|
170
229
|
line: "payout",
|
|
171
230
|
category: "payments",
|
|
231
|
+
section: "usd_global",
|
|
232
|
+
group: null,
|
|
172
233
|
},
|
|
173
234
|
global_credit: {
|
|
174
235
|
creditDebitType: "credit",
|
|
175
236
|
code: "global_credit",
|
|
176
237
|
line: "cbmm",
|
|
177
238
|
category: "collections",
|
|
239
|
+
section: "usd_global",
|
|
240
|
+
group: null,
|
|
178
241
|
},
|
|
179
242
|
r2p_spei_credit: {
|
|
180
243
|
creditDebitType: "credit",
|
|
181
244
|
code: "r2p_spei_credit",
|
|
182
245
|
line: "payin",
|
|
183
246
|
category: "collections",
|
|
247
|
+
section: "mxn",
|
|
248
|
+
group: null,
|
|
184
249
|
},
|
|
185
250
|
transfer_credit: {
|
|
186
251
|
creditDebitType: "credit",
|
|
187
252
|
code: "transfer_credit",
|
|
188
253
|
line: "payin",
|
|
189
254
|
category: "collections",
|
|
255
|
+
section: "connected_account",
|
|
256
|
+
group: null,
|
|
190
257
|
},
|
|
191
258
|
fedwire_debit: {
|
|
192
259
|
creditDebitType: "debit",
|
|
193
260
|
code: "fedwire_debit",
|
|
194
261
|
line: "payout",
|
|
195
262
|
category: "payments",
|
|
263
|
+
section: "usd_global",
|
|
264
|
+
group: null,
|
|
196
265
|
},
|
|
197
266
|
fedwire_credit: {
|
|
198
267
|
creditDebitType: "credit",
|
|
199
268
|
code: "fedwire_credit",
|
|
200
269
|
line: "cbmm",
|
|
201
270
|
category: "collections",
|
|
271
|
+
section: "usd_global",
|
|
272
|
+
group: null,
|
|
202
273
|
},
|
|
203
274
|
reward_credit: {
|
|
204
275
|
creditDebitType: "credit",
|
|
205
276
|
code: "reward_credit",
|
|
206
277
|
line: "stable",
|
|
207
278
|
category: "reward",
|
|
279
|
+
section: "internal",
|
|
280
|
+
group: null,
|
|
208
281
|
},
|
|
209
282
|
global_pay_to_usa_debit: {
|
|
210
283
|
creditDebitType: "debit",
|
|
211
284
|
code: "global_pay_to_usa_debit",
|
|
212
285
|
line: "cbmm",
|
|
213
286
|
category: "international",
|
|
287
|
+
section: "corridors",
|
|
288
|
+
group: "global_pay_to_usa",
|
|
214
289
|
},
|
|
215
290
|
global_pay_to_usa_credit: {
|
|
216
291
|
creditDebitType: "credit",
|
|
217
292
|
code: "global_pay_to_usa_credit",
|
|
218
293
|
line: "cbmm",
|
|
219
294
|
category: "international",
|
|
295
|
+
section: "corridors",
|
|
296
|
+
group: "global_pay_to_usa",
|
|
220
297
|
},
|
|
221
298
|
usa_pay_to_global_debit: {
|
|
222
299
|
creditDebitType: "debit",
|
|
223
300
|
code: "usa_pay_to_global_debit",
|
|
224
301
|
line: "cbmm",
|
|
225
302
|
category: "international",
|
|
303
|
+
section: "corridors",
|
|
304
|
+
group: "usa_pay_to_global",
|
|
226
305
|
},
|
|
227
306
|
usa_pay_to_global_credit: {
|
|
228
307
|
creditDebitType: "credit",
|
|
229
308
|
code: "usa_pay_to_global_credit",
|
|
230
309
|
line: "cbmm",
|
|
231
310
|
category: "international",
|
|
311
|
+
section: "corridors",
|
|
312
|
+
group: "usa_pay_to_global",
|
|
232
313
|
},
|
|
233
314
|
onramp_credit: {
|
|
234
315
|
creditDebitType: "credit",
|
|
235
316
|
code: "onramp_credit",
|
|
236
317
|
line: "stable",
|
|
237
318
|
category: "conversions",
|
|
319
|
+
section: "usd_global",
|
|
320
|
+
group: "on_ramp",
|
|
238
321
|
},
|
|
239
322
|
offramp_debit: {
|
|
240
323
|
creditDebitType: "debit",
|
|
241
324
|
code: "offramp_debit",
|
|
242
325
|
line: "stable",
|
|
243
326
|
category: "conversions",
|
|
327
|
+
section: "usd_global",
|
|
328
|
+
group: "off_ramp",
|
|
244
329
|
},
|
|
245
330
|
stable_payout_debit: {
|
|
246
331
|
creditDebitType: "debit",
|
|
247
332
|
code: "stable_payout_debit",
|
|
248
333
|
line: "stable",
|
|
249
334
|
category: "conversions",
|
|
335
|
+
section: "usd_global",
|
|
336
|
+
group: "stable_payout",
|
|
250
337
|
},
|
|
251
338
|
stable_payout_credit: {
|
|
252
339
|
creditDebitType: "credit",
|
|
253
340
|
code: "stable_payout_credit",
|
|
254
341
|
line: "stable",
|
|
255
342
|
category: "conversions",
|
|
343
|
+
section: "usd_global",
|
|
344
|
+
group: "stable_payout",
|
|
256
345
|
},
|
|
257
346
|
global_pay_to_generic_debit: {
|
|
258
347
|
creditDebitType: "debit",
|
|
259
348
|
code: "global_pay_to_generic_debit",
|
|
260
349
|
line: "payout",
|
|
261
350
|
category: "payments",
|
|
351
|
+
section: "usd_global",
|
|
352
|
+
group: null,
|
|
262
353
|
},
|
|
263
354
|
global_pay_to_generic_credit: {
|
|
264
355
|
creditDebitType: "credit",
|
|
265
356
|
code: "global_pay_to_generic_credit",
|
|
266
357
|
line: "cbmm",
|
|
267
358
|
category: "collections",
|
|
359
|
+
section: "usd_global",
|
|
360
|
+
group: null,
|
|
268
361
|
},
|
|
269
362
|
global_rejected: {
|
|
270
363
|
creditDebitType: "credit",
|
|
271
364
|
code: "global_rejected",
|
|
272
365
|
line: "cbmm",
|
|
273
366
|
category: "collections",
|
|
367
|
+
section: "usd_global",
|
|
368
|
+
group: null,
|
|
274
369
|
},
|
|
275
370
|
offramp_treasury_credit: {
|
|
276
371
|
creditDebitType: "credit",
|
|
277
372
|
code: "offramp_treasury_credit",
|
|
278
373
|
line: "stable",
|
|
279
374
|
category: "conversions",
|
|
375
|
+
section: "usd_global",
|
|
376
|
+
group: null,
|
|
280
377
|
},
|
|
281
378
|
onramp_debit: {
|
|
282
379
|
creditDebitType: "debit",
|
|
283
380
|
code: "onramp_debit",
|
|
284
381
|
line: "stable",
|
|
285
382
|
category: "conversions",
|
|
383
|
+
section: "usd_global",
|
|
384
|
+
group: "on_ramp",
|
|
286
385
|
},
|
|
287
386
|
offramp_credit: {
|
|
288
387
|
creditDebitType: "credit",
|
|
289
388
|
code: "offramp_credit",
|
|
290
389
|
line: "stable",
|
|
291
390
|
category: "conversions",
|
|
391
|
+
section: "usd_global",
|
|
392
|
+
group: "off_ramp",
|
|
292
393
|
},
|
|
293
394
|
};
|
|
@@ -48,5 +48,14 @@
|
|
|
48
48
|
"offramp_treasury_credit": "Treasury conversion · Off-Ramp",
|
|
49
49
|
"onramp_debit": "Conversion to stablecoin · On-Ramp · debit",
|
|
50
50
|
"offramp_credit": "Conversion to local currency · Off-Ramp · credit"
|
|
51
|
+
},
|
|
52
|
+
"transactionTypeGroups": {
|
|
53
|
+
"cbmm": "Cross-border movement · Debit and credit",
|
|
54
|
+
"global_pay_to_usa": "International transfer · USA corridor",
|
|
55
|
+
"usa_pay_to_global": "International transfer · Global corridor",
|
|
56
|
+
"on_ramp": "Conversion to stablecoin · On-Ramp",
|
|
57
|
+
"off_ramp": "Conversion to local currency · Off-Ramp",
|
|
58
|
+
"stable_payout": "Stablecoin payment · Direct",
|
|
59
|
+
"internal": "Movement between my accounts · Debit and credit"
|
|
51
60
|
}
|
|
52
61
|
}
|
|
@@ -48,5 +48,14 @@
|
|
|
48
48
|
"offramp_treasury_credit": "Conversión de tesorería · Off-Ramp",
|
|
49
49
|
"onramp_debit": "Conversión a stablecoin · On-Ramp · débito",
|
|
50
50
|
"offramp_credit": "Conversión a moneda local · Off-Ramp · crédito"
|
|
51
|
+
},
|
|
52
|
+
"transactionTypeGroups": {
|
|
53
|
+
"cbmm": "Movimiento cross-border · Débito y crédito",
|
|
54
|
+
"global_pay_to_usa": "Transferencia internacional · Corredor USA",
|
|
55
|
+
"usa_pay_to_global": "Transferencia internacional · Corredor Global",
|
|
56
|
+
"on_ramp": "Conversión a stablecoin · On-Ramp",
|
|
57
|
+
"off_ramp": "Conversión a moneda local · Off-Ramp",
|
|
58
|
+
"stable_payout": "Pago en stablecoin · Directo",
|
|
59
|
+
"internal": "Movimiento entre mis cuentas · Débito y crédito"
|
|
51
60
|
}
|
|
52
61
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { TransactionType, TransactionTypeRecord } from "../catalog";
|
|
1
|
+
import type { TransactionType, TransactionTypeGroup, TransactionTypeRecord } from "../catalog";
|
|
2
|
+
import type { FilterClassificationRecord } from "../../../filterClassification/interfaces/filter-classification.interface";
|
|
2
3
|
import type { Locale } from "../../../lang";
|
|
3
4
|
import type { CatalogQuery } from "../../../utils/catalog-query.utils";
|
|
4
5
|
export type TransactionTypeOption = TransactionTypeRecord & {
|
|
@@ -15,3 +16,13 @@ export type TransactionTypeQuery = CatalogQuery<TransactionTypeRecord> & {
|
|
|
15
16
|
};
|
|
16
17
|
/** The catalog as a list narrowed by the query, each record enriched with its label for `query.lang`. */
|
|
17
18
|
export declare const queryTransactionTypes: (query: TransactionTypeQuery) => TransactionTypeOption[];
|
|
19
|
+
/** A group of debit/credit legs folded into one option; `line`, `category` and `section` come from its members. */
|
|
20
|
+
export type TransactionTypeGroupOption = FilterClassificationRecord<TransactionTypeGroup, TransactionType> & {
|
|
21
|
+
label: string;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Same list as `queryTransactionTypes(query)` with each group folded into one option, placed at its first
|
|
25
|
+
* member's position. A group collapses only if all its legs survive the query; otherwise the surviving legs
|
|
26
|
+
* come out as plain options. Tell the two apart with `isGroupOption`.
|
|
27
|
+
*/
|
|
28
|
+
export declare const collapseTransactionTypes: (query: TransactionTypeQuery) => (TransactionTypeOption | TransactionTypeGroupOption)[];
|
|
@@ -3,7 +3,7 @@ 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.queryTransactionTypes = exports.getTransactionTypes = void 0;
|
|
6
|
+
exports.collapseTransactionTypes = exports.queryTransactionTypes = exports.getTransactionTypes = 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"));
|
|
@@ -30,3 +30,32 @@ const queryTransactionTypes = (query) => {
|
|
|
30
30
|
.map(record => ({ ...record, label: locales[lang].transactionTypes[record.code] }));
|
|
31
31
|
};
|
|
32
32
|
exports.queryTransactionTypes = queryTransactionTypes;
|
|
33
|
+
const membersByGroup = Object.values(catalog_1.TRANSACTION_TYPES).reduce((groups, record) => {
|
|
34
|
+
if (record.group !== null)
|
|
35
|
+
groups[record.group] = [...(groups[record.group] ?? []), record.code];
|
|
36
|
+
return groups;
|
|
37
|
+
}, {});
|
|
38
|
+
/**
|
|
39
|
+
* Same list as `queryTransactionTypes(query)` with each group folded into one option, placed at its first
|
|
40
|
+
* member's position. A group collapses only if all its legs survive the query; otherwise the surviving legs
|
|
41
|
+
* come out as plain options. Tell the two apart with `isGroupOption`.
|
|
42
|
+
*/
|
|
43
|
+
const collapseTransactionTypes = (query) => {
|
|
44
|
+
const options = (0, exports.queryTransactionTypes)(query);
|
|
45
|
+
const surviving = new Set(options.map(option => option.code));
|
|
46
|
+
const collapsed = new Set();
|
|
47
|
+
const result = [];
|
|
48
|
+
for (const option of options) {
|
|
49
|
+
const { group } = option;
|
|
50
|
+
if (group === null || !membersByGroup[group].every(member => surviving.has(member))) {
|
|
51
|
+
result.push(option);
|
|
52
|
+
}
|
|
53
|
+
else if (!collapsed.has(group)) {
|
|
54
|
+
const { line, category, section } = option;
|
|
55
|
+
collapsed.add(group);
|
|
56
|
+
result.push({ code: group, members: membersByGroup[group], line, category, section, label: locales[query.lang].transactionTypeGroups[group] });
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return result;
|
|
60
|
+
};
|
|
61
|
+
exports.collapseTransactionTypes = collapseTransactionTypes;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/** Tells a group option (it has `members`) from a plain option, narrowing a mixed list of both. */
|
|
2
|
+
export const isGroupOption = (option) => "members" in option;
|
|
1
3
|
/**
|
|
2
4
|
* The codes to send to an API: each selected group code is replaced by its members, anything else passes
|
|
3
5
|
* through. The group code itself never appears in the output, and repeated codes are dropped.
|