@bazous/ui 0.3.2

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 (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +150 -0
  3. package/dist/answers/AnswerPicture.d.ts +13 -0
  4. package/dist/answers/contract.d.ts +160 -0
  5. package/dist/answers/draw.d.ts +16 -0
  6. package/dist/answers/index.d.ts +6 -0
  7. package/dist/answers/messages.d.ts +3 -0
  8. package/dist/answers.js +10 -0
  9. package/dist/answers.js.map +1 -0
  10. package/dist/canvas/index.d.ts +32 -0
  11. package/dist/canvas.js +285 -0
  12. package/dist/canvas.js.map +1 -0
  13. package/dist/contract/snapshot.d.ts +173 -0
  14. package/dist/engine/scenario.d.ts +40 -0
  15. package/dist/format/index.d.ts +37 -0
  16. package/dist/i18n/index.d.ts +25 -0
  17. package/dist/i18n/shared.d.ts +3 -0
  18. package/dist/index-yeBMtDf1.js +649 -0
  19. package/dist/index-yeBMtDf1.js.map +1 -0
  20. package/dist/index.d.ts +20 -0
  21. package/dist/index.js +1258 -0
  22. package/dist/index.js.map +1 -0
  23. package/dist/modules/Question.d.ts +18 -0
  24. package/dist/modules/available-now/index.d.ts +8 -0
  25. package/dist/modules/due-before-payday/index.d.ts +9 -0
  26. package/dist/modules/low-point/index.d.ts +12 -0
  27. package/dist/modules/margin-after-payday/index.d.ts +9 -0
  28. package/dist/modules/monthly-structure/index.d.ts +24 -0
  29. package/dist/modules/next-actions/index.d.ts +13 -0
  30. package/dist/modules/pay-cycles/index.d.ts +31 -0
  31. package/dist/modules/registry.d.ts +7 -0
  32. package/dist/modules/types.d.ts +77 -0
  33. package/dist/modules/what-if/index.d.ts +6 -0
  34. package/dist/primitives/CashflowChart.d.ts +22 -0
  35. package/dist/primitives/index.d.ts +57 -0
  36. package/dist/styles.css +1 -0
  37. package/package.json +84 -0
  38. package/schema/answers.schema.json +719 -0
  39. package/schema/canvas.json +181 -0
  40. package/schema/snapshot.schema.json +821 -0
@@ -0,0 +1,821 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://bazous.com/schema/snapshot/v1.json",
4
+ "title": "Bazous household snapshot",
5
+ "description": "What GET /api/v1/cockpit returns. The only input of @bazous/ui. Amounts are decimal strings in the base currency unless named original_amount/amount; dates are ISO YYYY-MM-DD.",
6
+ "type": "object",
7
+ "$defs": {
8
+ "decimal": {
9
+ "type": "string",
10
+ "pattern": "^-?\\d+(\\.\\d+)?$"
11
+ },
12
+ "date": {
13
+ "type": "string",
14
+ "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
15
+ },
16
+ "currency": {
17
+ "type": "string",
18
+ "pattern": "^[A-Z]{3}$"
19
+ },
20
+ "event": {
21
+ "type": "object",
22
+ "properties": {
23
+ "date": {
24
+ "$ref": "#/$defs/date"
25
+ },
26
+ "label": {
27
+ "type": "string"
28
+ },
29
+ "amount": {
30
+ "$ref": "#/$defs/decimal"
31
+ },
32
+ "direction": {
33
+ "enum": [
34
+ "inflow",
35
+ "outflow"
36
+ ]
37
+ },
38
+ "original_amount": {
39
+ "$ref": "#/$defs/decimal"
40
+ },
41
+ "currency": {
42
+ "$ref": "#/$defs/currency"
43
+ },
44
+ "kind": {
45
+ "type": "string"
46
+ },
47
+ "ref_id": {
48
+ "type": [
49
+ "string",
50
+ "null"
51
+ ]
52
+ },
53
+ "status": {
54
+ "type": [
55
+ "string",
56
+ "null"
57
+ ]
58
+ }
59
+ },
60
+ "required": [
61
+ "date",
62
+ "label",
63
+ "amount",
64
+ "direction",
65
+ "original_amount",
66
+ "currency",
67
+ "kind",
68
+ "ref_id",
69
+ "status"
70
+ ],
71
+ "additionalProperties": false
72
+ },
73
+ "action": {
74
+ "oneOf": [
75
+ {
76
+ "type": "object",
77
+ "properties": {
78
+ "type": {
79
+ "enum": [
80
+ "overdue",
81
+ "due_today",
82
+ "before_income",
83
+ "plan",
84
+ "undated"
85
+ ]
86
+ },
87
+ "ref_id": {
88
+ "type": "string"
89
+ },
90
+ "label": {
91
+ "type": "string"
92
+ },
93
+ "description": {
94
+ "type": [
95
+ "string",
96
+ "null"
97
+ ]
98
+ },
99
+ "date": {
100
+ "anyOf": [
101
+ {
102
+ "$ref": "#/$defs/date"
103
+ },
104
+ {
105
+ "type": "null"
106
+ }
107
+ ]
108
+ },
109
+ "amount": {
110
+ "$ref": "#/$defs/decimal"
111
+ },
112
+ "currency": {
113
+ "$ref": "#/$defs/currency"
114
+ },
115
+ "amount_base": {
116
+ "$ref": "#/$defs/decimal"
117
+ },
118
+ "confidence": {
119
+ "anyOf": [
120
+ {
121
+ "$ref": "#/$defs/decimal"
122
+ },
123
+ {
124
+ "type": "null"
125
+ }
126
+ ]
127
+ },
128
+ "target": {
129
+ "anyOf": [
130
+ {
131
+ "$ref": "#/$defs/date"
132
+ },
133
+ {
134
+ "type": "null"
135
+ }
136
+ ]
137
+ }
138
+ },
139
+ "required": [
140
+ "type",
141
+ "ref_id",
142
+ "label",
143
+ "date",
144
+ "amount",
145
+ "currency",
146
+ "amount_base"
147
+ ],
148
+ "additionalProperties": false
149
+ },
150
+ {
151
+ "type": "object",
152
+ "properties": {
153
+ "type": {
154
+ "const": "needs_review"
155
+ },
156
+ "kind": {
157
+ "enum": [
158
+ "obligation",
159
+ "transaction"
160
+ ]
161
+ },
162
+ "ref_id": {
163
+ "type": "string"
164
+ },
165
+ "label": {
166
+ "type": "string"
167
+ },
168
+ "date": {
169
+ "anyOf": [
170
+ {
171
+ "$ref": "#/$defs/date"
172
+ },
173
+ {
174
+ "type": "null"
175
+ }
176
+ ]
177
+ },
178
+ "amount": {
179
+ "$ref": "#/$defs/decimal"
180
+ },
181
+ "currency": {
182
+ "$ref": "#/$defs/currency"
183
+ },
184
+ "confidence": {
185
+ "anyOf": [
186
+ {
187
+ "$ref": "#/$defs/decimal"
188
+ },
189
+ {
190
+ "type": "null"
191
+ }
192
+ ]
193
+ }
194
+ },
195
+ "required": [
196
+ "type",
197
+ "kind",
198
+ "ref_id",
199
+ "label",
200
+ "date",
201
+ "amount",
202
+ "currency",
203
+ "confidence"
204
+ ],
205
+ "additionalProperties": false
206
+ },
207
+ {
208
+ "type": "object",
209
+ "properties": {
210
+ "type": {
211
+ "const": "missing_amounts"
212
+ },
213
+ "label": {
214
+ "type": "string"
215
+ },
216
+ "items": {
217
+ "type": "array",
218
+ "items": {
219
+ "type": "string"
220
+ }
221
+ }
222
+ },
223
+ "required": [
224
+ "type",
225
+ "label",
226
+ "items"
227
+ ],
228
+ "additionalProperties": false
229
+ }
230
+ ]
231
+ }
232
+ },
233
+ "properties": {
234
+ "as_of": {
235
+ "$ref": "#/$defs/date"
236
+ },
237
+ "horizon_end": {
238
+ "$ref": "#/$defs/date"
239
+ },
240
+ "next_income_date": {
241
+ "anyOf": [
242
+ {
243
+ "$ref": "#/$defs/date"
244
+ },
245
+ {
246
+ "type": "null"
247
+ }
248
+ ]
249
+ },
250
+ "second_income_date": {
251
+ "anyOf": [
252
+ {
253
+ "$ref": "#/$defs/date"
254
+ },
255
+ {
256
+ "type": "null"
257
+ }
258
+ ]
259
+ },
260
+ "base_currency": {
261
+ "$ref": "#/$defs/currency"
262
+ },
263
+ "fx_rates": {
264
+ "type": "object",
265
+ "additionalProperties": {
266
+ "$ref": "#/$defs/decimal"
267
+ }
268
+ },
269
+ "opening_balance": {
270
+ "$ref": "#/$defs/decimal"
271
+ },
272
+ "due_before_next_income": {
273
+ "$ref": "#/$defs/decimal"
274
+ },
275
+ "gap_before_next_income": {
276
+ "$ref": "#/$defs/decimal"
277
+ },
278
+ "low_point": {
279
+ "type": "object",
280
+ "properties": {
281
+ "date": {
282
+ "$ref": "#/$defs/date"
283
+ },
284
+ "balance": {
285
+ "$ref": "#/$defs/decimal"
286
+ },
287
+ "days_from_now": {
288
+ "type": "integer",
289
+ "minimum": 0
290
+ }
291
+ },
292
+ "required": [
293
+ "date",
294
+ "balance",
295
+ "days_from_now"
296
+ ],
297
+ "additionalProperties": false
298
+ },
299
+ "end_of_horizon": {
300
+ "type": "object",
301
+ "properties": {
302
+ "date": {
303
+ "$ref": "#/$defs/date"
304
+ },
305
+ "balance": {
306
+ "$ref": "#/$defs/decimal"
307
+ }
308
+ },
309
+ "required": [
310
+ "date",
311
+ "balance"
312
+ ],
313
+ "additionalProperties": false
314
+ },
315
+ "main_cycle": {
316
+ "type": "object",
317
+ "properties": {
318
+ "start": {
319
+ "$ref": "#/$defs/date"
320
+ },
321
+ "end": {
322
+ "$ref": "#/$defs/date"
323
+ },
324
+ "total_out": {
325
+ "$ref": "#/$defs/decimal"
326
+ },
327
+ "total_in": {
328
+ "$ref": "#/$defs/decimal"
329
+ },
330
+ "drivers": {
331
+ "type": "array",
332
+ "items": {
333
+ "type": "object",
334
+ "properties": {
335
+ "label": {
336
+ "type": "string"
337
+ },
338
+ "date": {
339
+ "$ref": "#/$defs/date"
340
+ },
341
+ "amount": {
342
+ "$ref": "#/$defs/decimal"
343
+ },
344
+ "share": {
345
+ "$ref": "#/$defs/decimal"
346
+ }
347
+ },
348
+ "required": [
349
+ "label",
350
+ "date",
351
+ "amount",
352
+ "share"
353
+ ],
354
+ "additionalProperties": false
355
+ }
356
+ }
357
+ },
358
+ "required": [
359
+ "start",
360
+ "end",
361
+ "total_out",
362
+ "total_in",
363
+ "drivers"
364
+ ],
365
+ "additionalProperties": false
366
+ },
367
+ "cycles": {
368
+ "type": "array",
369
+ "minItems": 1,
370
+ "items": {
371
+ "type": "object",
372
+ "properties": {
373
+ "key": {
374
+ "type": "string"
375
+ },
376
+ "start": {
377
+ "$ref": "#/$defs/date"
378
+ },
379
+ "end": {
380
+ "$ref": "#/$defs/date"
381
+ },
382
+ "total_out": {
383
+ "$ref": "#/$defs/decimal"
384
+ },
385
+ "total_in": {
386
+ "$ref": "#/$defs/decimal"
387
+ },
388
+ "items": {
389
+ "type": "array",
390
+ "items": {
391
+ "$ref": "#/$defs/event"
392
+ }
393
+ }
394
+ },
395
+ "required": [
396
+ "key",
397
+ "start",
398
+ "end",
399
+ "total_out",
400
+ "total_in",
401
+ "items"
402
+ ],
403
+ "additionalProperties": false
404
+ }
405
+ },
406
+ "points": {
407
+ "type": "array",
408
+ "minItems": 1,
409
+ "items": {
410
+ "type": "object",
411
+ "properties": {
412
+ "date": {
413
+ "$ref": "#/$defs/date"
414
+ },
415
+ "inflows": {
416
+ "$ref": "#/$defs/decimal"
417
+ },
418
+ "outflows": {
419
+ "$ref": "#/$defs/decimal"
420
+ },
421
+ "closing_balance": {
422
+ "$ref": "#/$defs/decimal"
423
+ }
424
+ },
425
+ "required": [
426
+ "date",
427
+ "inflows",
428
+ "outflows",
429
+ "closing_balance"
430
+ ],
431
+ "additionalProperties": false
432
+ }
433
+ },
434
+ "events": {
435
+ "type": "array",
436
+ "items": {
437
+ "$ref": "#/$defs/event"
438
+ }
439
+ },
440
+ "household": {
441
+ "type": "object",
442
+ "properties": {
443
+ "id": {
444
+ "type": "string"
445
+ },
446
+ "name": {
447
+ "type": "string"
448
+ }
449
+ },
450
+ "required": [
451
+ "id",
452
+ "name"
453
+ ],
454
+ "additionalProperties": true
455
+ },
456
+ "accounts": {
457
+ "type": "array",
458
+ "items": {
459
+ "type": "object",
460
+ "properties": {
461
+ "id": {
462
+ "type": "string"
463
+ },
464
+ "name": {
465
+ "type": "string"
466
+ },
467
+ "account_type": {
468
+ "type": "string"
469
+ },
470
+ "currency": {
471
+ "$ref": "#/$defs/currency"
472
+ },
473
+ "institution": {
474
+ "type": [
475
+ "string",
476
+ "null"
477
+ ]
478
+ },
479
+ "balance": {
480
+ "anyOf": [
481
+ {
482
+ "$ref": "#/$defs/decimal"
483
+ },
484
+ {
485
+ "type": "null"
486
+ }
487
+ ]
488
+ },
489
+ "balance_base": {
490
+ "anyOf": [
491
+ {
492
+ "$ref": "#/$defs/decimal"
493
+ },
494
+ {
495
+ "type": "null"
496
+ }
497
+ ]
498
+ },
499
+ "observed_at": {
500
+ "type": [
501
+ "string",
502
+ "null"
503
+ ]
504
+ }
505
+ },
506
+ "required": [
507
+ "id",
508
+ "name",
509
+ "account_type",
510
+ "currency",
511
+ "institution",
512
+ "balance",
513
+ "balance_base",
514
+ "observed_at"
515
+ ],
516
+ "additionalProperties": true
517
+ }
518
+ },
519
+ "structure": {
520
+ "type": "object",
521
+ "properties": {
522
+ "fixed_monthly": {
523
+ "$ref": "#/$defs/decimal"
524
+ },
525
+ "income_monthly": {
526
+ "$ref": "#/$defs/decimal"
527
+ },
528
+ "fixed_ratio_percent": {
529
+ "anyOf": [
530
+ {
531
+ "$ref": "#/$defs/decimal"
532
+ },
533
+ {
534
+ "type": "null"
535
+ }
536
+ ]
537
+ },
538
+ "structural_margin": {
539
+ "anyOf": [
540
+ {
541
+ "$ref": "#/$defs/decimal"
542
+ },
543
+ {
544
+ "type": "null"
545
+ }
546
+ ]
547
+ },
548
+ "by_category": {
549
+ "type": "array",
550
+ "items": {
551
+ "type": "object",
552
+ "properties": {
553
+ "category": {
554
+ "type": "string"
555
+ },
556
+ "amount": {
557
+ "$ref": "#/$defs/decimal"
558
+ }
559
+ },
560
+ "required": [
561
+ "category",
562
+ "amount"
563
+ ],
564
+ "additionalProperties": false
565
+ }
566
+ }
567
+ },
568
+ "required": [
569
+ "fixed_monthly",
570
+ "income_monthly",
571
+ "fixed_ratio_percent",
572
+ "structural_margin",
573
+ "by_category"
574
+ ],
575
+ "additionalProperties": false
576
+ },
577
+ "debts": {
578
+ "type": "object",
579
+ "properties": {
580
+ "total_base": {
581
+ "$ref": "#/$defs/decimal"
582
+ },
583
+ "items": {
584
+ "type": "array",
585
+ "items": {
586
+ "type": "object",
587
+ "properties": {
588
+ "id": {
589
+ "type": "string"
590
+ },
591
+ "name": {
592
+ "type": "string"
593
+ },
594
+ "principal": {
595
+ "$ref": "#/$defs/decimal"
596
+ },
597
+ "currency": {
598
+ "$ref": "#/$defs/currency"
599
+ },
600
+ "due_day": {
601
+ "type": [
602
+ "integer",
603
+ "null"
604
+ ]
605
+ }
606
+ },
607
+ "required": [
608
+ "id",
609
+ "name",
610
+ "principal",
611
+ "currency",
612
+ "due_day"
613
+ ],
614
+ "additionalProperties": true
615
+ }
616
+ }
617
+ },
618
+ "required": [
619
+ "total_base",
620
+ "items"
621
+ ],
622
+ "additionalProperties": false
623
+ },
624
+ "actions": {
625
+ "type": "array",
626
+ "items": {
627
+ "$ref": "#/$defs/action"
628
+ }
629
+ },
630
+ "data_quality": {
631
+ "type": "object",
632
+ "properties": {
633
+ "last_transaction_date": {
634
+ "anyOf": [
635
+ {
636
+ "$ref": "#/$defs/date"
637
+ },
638
+ {
639
+ "type": "null"
640
+ }
641
+ ]
642
+ },
643
+ "days_since_last_transaction": {
644
+ "type": [
645
+ "integer",
646
+ "null"
647
+ ]
648
+ },
649
+ "accounts_without_balance": {
650
+ "type": "array",
651
+ "items": {
652
+ "type": "string"
653
+ }
654
+ },
655
+ "fx_missing": {
656
+ "type": "array",
657
+ "items": {
658
+ "type": "string"
659
+ }
660
+ },
661
+ "rules_without_amount": {
662
+ "type": "array",
663
+ "items": {
664
+ "type": "string"
665
+ }
666
+ },
667
+ "needs_review_count": {
668
+ "type": "integer",
669
+ "minimum": 0
670
+ }
671
+ },
672
+ "required": [
673
+ "last_transaction_date",
674
+ "days_since_last_transaction",
675
+ "accounts_without_balance",
676
+ "fx_missing",
677
+ "rules_without_amount",
678
+ "needs_review_count"
679
+ ],
680
+ "additionalProperties": true
681
+ },
682
+ "actual_vs_expected": {
683
+ "type": "object",
684
+ "properties": {
685
+ "period_start": {
686
+ "anyOf": [
687
+ {
688
+ "$ref": "#/$defs/date"
689
+ },
690
+ {
691
+ "type": "null"
692
+ }
693
+ ]
694
+ },
695
+ "period_end": {
696
+ "anyOf": [
697
+ {
698
+ "$ref": "#/$defs/date"
699
+ },
700
+ {
701
+ "type": "null"
702
+ }
703
+ ]
704
+ },
705
+ "complete": {
706
+ "type": "boolean"
707
+ },
708
+ "items": {
709
+ "type": "array",
710
+ "items": {
711
+ "type": "object",
712
+ "properties": {
713
+ "category": {
714
+ "type": "string"
715
+ },
716
+ "expected": {
717
+ "anyOf": [
718
+ {
719
+ "$ref": "#/$defs/decimal"
720
+ },
721
+ {
722
+ "type": "null"
723
+ }
724
+ ]
725
+ },
726
+ "actual": {
727
+ "$ref": "#/$defs/decimal"
728
+ },
729
+ "delta": {
730
+ "anyOf": [
731
+ {
732
+ "$ref": "#/$defs/decimal"
733
+ },
734
+ {
735
+ "type": "null"
736
+ }
737
+ ]
738
+ }
739
+ },
740
+ "required": [
741
+ "category",
742
+ "expected",
743
+ "actual",
744
+ "delta"
745
+ ],
746
+ "additionalProperties": false
747
+ }
748
+ }
749
+ },
750
+ "required": [
751
+ "period_start",
752
+ "period_end",
753
+ "complete",
754
+ "items"
755
+ ],
756
+ "additionalProperties": false
757
+ },
758
+ "uncategorized": {
759
+ "type": "array",
760
+ "items": {
761
+ "type": "object",
762
+ "properties": {
763
+ "id": {
764
+ "type": "string"
765
+ },
766
+ "label": {
767
+ "type": "string"
768
+ },
769
+ "amount": {
770
+ "$ref": "#/$defs/decimal"
771
+ },
772
+ "currency": {
773
+ "$ref": "#/$defs/currency"
774
+ },
775
+ "booking_date": {
776
+ "$ref": "#/$defs/date"
777
+ },
778
+ "suggested_category": {
779
+ "type": [
780
+ "string",
781
+ "null"
782
+ ]
783
+ }
784
+ },
785
+ "required": [
786
+ "id",
787
+ "label",
788
+ "amount",
789
+ "currency",
790
+ "booking_date",
791
+ "suggested_category"
792
+ ],
793
+ "additionalProperties": false
794
+ }
795
+ }
796
+ },
797
+ "required": [
798
+ "as_of",
799
+ "horizon_end",
800
+ "next_income_date",
801
+ "second_income_date",
802
+ "base_currency",
803
+ "fx_rates",
804
+ "opening_balance",
805
+ "due_before_next_income",
806
+ "gap_before_next_income",
807
+ "low_point",
808
+ "end_of_horizon",
809
+ "main_cycle",
810
+ "cycles",
811
+ "points",
812
+ "events",
813
+ "household",
814
+ "accounts",
815
+ "structure",
816
+ "debts",
817
+ "actions",
818
+ "data_quality"
819
+ ],
820
+ "additionalProperties": true
821
+ }