@mx-cartographer/experiences 3.13.4-alpha.mm3 → 3.13.5-alpha.mm.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.
@@ -1,51 +1,20 @@
1
- import { Account, CategoryApi, Category, DateRangeCategoryTotals, GlobalStore, MonthlyCategoryTotals } from '../../common';
1
+ import { Account, CategoryApi, Category, DetailedCategory, DateRangeCategoryTotals, GlobalStore, MonthlyCategoryTotals } from '../../common';
2
2
  import { UiStore } from './UiStore';
3
- import { DetailedCategory } from '../../common/types/Category';
4
3
  export declare class CategoryStore {
5
4
  api: CategoryApi;
6
5
  globalStore: GlobalStore;
7
6
  uiStore: UiStore;
8
7
  categories: Category[];
9
- detailedCategories: DetailedCategory[];
10
8
  dateRangeCategoryTotals: DateRangeCategoryTotals[];
11
9
  monthlyCategoryTotals: MonthlyCategoryTotals[];
12
10
  isLoadingCategoryTotals: boolean;
13
11
  constructor(globalStore: GlobalStore);
14
12
  initialize: (endpoint: string, token: string) => Promise<void>;
13
+ get detailedCategories(): DetailedCategory[];
14
+ get incomeCategories(): DetailedCategory[];
15
+ get spendCategories(): DetailedCategory[];
16
+ get transferCategories(): DetailedCategory[];
15
17
  addCategory: (name: string, parentGuid: string) => Promise<void>;
16
- augmentCategories(): {
17
- average: number;
18
- color: string;
19
- generalHistory: {
20
- timestamp: number;
21
- label: string;
22
- total: number;
23
- }[];
24
- history: {
25
- timestamp: number;
26
- label: string;
27
- total: number;
28
- }[];
29
- icon: string;
30
- isTransfer: boolean;
31
- monthlyTotals: MonthlyCategoryTotals[];
32
- total: number;
33
- value: number;
34
- guid: string;
35
- income: boolean;
36
- is_default: boolean;
37
- is_income: boolean;
38
- metadata?: string;
39
- name: string;
40
- parent_guid?: string;
41
- revision?: number;
42
- user_guid?: string;
43
- }[];
44
- getHistory: (totals: MonthlyCategoryTotals[], startDate?: number, monthsBack?: number) => {
45
- timestamp: number;
46
- label: string;
47
- total: number;
48
- }[];
49
18
  loadCategories: () => Promise<void>;
50
19
  loadDateRangeCategoryTotals: (accounts: Account[], startDate: Date, endDate: Date) => Promise<void>;
51
20
  loadMonthlyCategoryTotals: (accounts?: Account[], startDate?: Date, endDate?: Date) => Promise<void>;
@@ -0,0 +1,8 @@
1
+ import { Category, DateRangeCategoryTotals, DetailedCategory, MonthlyCategoryTotals } from '../../common';
2
+ /**
3
+ * Augment categories
4
+ * @param categories - Categories to augment
5
+ * @param monthlyCategoryTotals - Monthly category totals
6
+ * @param currentCategoryTotals - Current month category totals
7
+ */
8
+ export declare const augmentCategories: (categories: Category[], currentCategoryTotals: DateRangeCategoryTotals[], monthlyCategoryTotals: MonthlyCategoryTotals[]) => DetailedCategory[];
@@ -1,4 +1,5 @@
1
1
  import { default as React, CSSProperties } from 'react';
2
+ import { MarkHandlers } from './linechart/CustomMark';
2
3
  interface LineChartProps {
3
4
  baseline?: string;
4
5
  colors: (string | undefined)[];
@@ -6,10 +7,10 @@ interface LineChartProps {
6
7
  x: string;
7
8
  y: number;
8
9
  }[][];
9
- onMarkClick?: (event: React.MouseEvent<SVGPathElement, MouseEvent>, dataIndex: number) => void;
10
10
  height?: number;
11
- getMarkStyles?: (markIndex: number) => CSSProperties;
12
11
  labels: string[];
12
+ markHandlers?: MarkHandlers;
13
+ markStyles?: (markIndex: number) => CSSProperties;
13
14
  showArea?: boolean;
14
15
  showAverage?: boolean;
15
16
  showBars?: boolean;
@@ -1,7 +1,12 @@
1
1
  import { default as React } from 'react';
2
2
  import { MarkElementProps } from '@mui/x-charts';
3
- interface CustomMarkProps extends MarkElementProps {
3
+ export type MarkHandlers = {
4
4
  onMarkClick?: (event: React.MouseEvent<SVGPathElement, MouseEvent>, dataIndex: number) => void;
5
+ onMouseEnter?: (dataIndex: number) => void;
6
+ onMouseLeave?: () => void;
7
+ };
8
+ interface CustomMarkProps extends MarkElementProps {
9
+ handlers?: MarkHandlers;
5
10
  showLabel: boolean;
6
11
  yData: number[];
7
12
  }
@@ -1,2 +1 @@
1
1
  export { default as Dialog } from './Dialog';
2
- export { default as ErrorDialog } from './ErrorDialog';
@@ -25,21 +25,34 @@ export interface MonthlyCategoryTotals {
25
25
  year: number;
26
26
  year_month: number;
27
27
  }
28
- export interface CategoryHistory {
29
- timestamp: number;
28
+ export interface MonthlyAmount {
29
+ amount: number;
30
+ isoDate: string;
30
31
  label: string;
31
- total: number;
32
32
  }
33
+ /**
34
+ * @averageAmount - The average amount for this category
35
+ * @color - Color to represent this category
36
+ * @currentAmount - The amount of this category for the current month
37
+ * @monthlyAmounts - The past 12 monthly amounts for this category
38
+ * @icon - Icon to represent this category
39
+ * @isTransfer - Is this category for transfers
40
+ * @subCategories - Detailed subcategories for this category
41
+ * @totalAmount - The total amount (including subcategories) for the current month
42
+ * @totalAverageAmount - The total average amount (including subcategories) for this category
43
+ * @totalMonthlyAmounts - The past 12 total monthly amounts (including subcategories)
44
+ */
33
45
  export interface DetailedCategory extends Category {
34
- average: number;
46
+ averageAmount: number;
35
47
  color: string;
36
- generalHistory: CategoryHistory[];
37
- history: CategoryHistory[];
48
+ currentAmount: number;
49
+ monthlyAmounts: MonthlyAmount[];
38
50
  icon: string;
39
51
  isTransfer: boolean;
40
- monthlyTotals: MonthlyCategoryTotals[];
41
- total: number;
42
- value: number;
52
+ subCategories: DetailedCategory[];
53
+ totalAmount: number;
54
+ totalAverageAmount: number;
55
+ totalMonthlyAmounts: MonthlyAmount[];
43
56
  }
44
57
  export interface CategoryTotal {
45
58
  amount: number;
@@ -6,7 +6,7 @@ export type { Beat, DataSeries } from './Beat';
6
6
  export { UserVerification } from './Beat';
7
7
  export type { Budget, BudgetColors, DetailedBudget } from './Budget';
8
8
  export type { CashflowEvent, CashflowSequence, RepeatDay, RepeatInterval, RepeatMonth, RepeatWeekday, } from './Cashflow';
9
- export type { Category, CategoryTotal, DateRangeCategoryTotals, MonthlyCategoryTotals, } from './Category';
9
+ export type { Category, CategoryTotal, DateRangeCategoryTotals, DetailedCategory, MonthlyAmount, MonthlyCategoryTotals, } from './Category';
10
10
  export type { DateType, DateRange } from './Date';
11
11
  export type { Expense } from './Expense';
12
12
  export { ExpenseStatus, ScheduledPaymentTypes } from './Expense';
@@ -1,3 +1,6 @@
1
- import { Category, CategoryTotal, DateRangeCategoryTotals } from '../types';
1
+ import { Category, CategoryTotal, DateRangeCategoryTotals, DetailedCategory } from '../types';
2
2
  export declare const getCategory: (categories: Category[], categoryGuid: string | undefined) => Category | undefined;
3
+ export declare const getDetailedCategory: (detailedCategories: DetailedCategory[], guid: string | undefined) => DetailedCategory | undefined;
4
+ export declare const getDetailedSubCategory: (detailedCategories: DetailedCategory[], guid: string | undefined) => DetailedCategory | undefined;
3
5
  export declare const getCategoryTotalsByParent: (categories: Category[], dateRangeTotals: DateRangeCategoryTotals[]) => CategoryTotal[];
6
+ export declare const isIncome: (categories: Category[], guid: string) => boolean;
@@ -1,5 +1,5 @@
1
1
  export { analyticsSession } from './Analytics';
2
- export { getCategory, getCategoryTotalsByParent } from './Categories';
2
+ export { getCategory, getDetailedCategory, getDetailedSubCategory, getCategoryTotalsByParent, isIncome, } from './Categories';
3
3
  export { Fetch } from './Fetch';
4
4
  export { buildDynamicCopy, buildPluralCopy, getLocale } from './Localization';
5
5
  export { formatCurrency, formatOrdinal, formatPercentage, getCurrencyCodes, isValidNumber, } from './NumberFormatting';