@layerfi/components 0.1.27 → 0.1.28

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/dist/index.d.ts CHANGED
@@ -836,9 +836,9 @@ declare module '@layerfi/components/components/BankTransactionRow/BankTransactio
836
836
  import { BankTransaction, Category } from '@layerfi/components/types';
837
837
  type Props = {
838
838
  index: number;
839
+ editable: boolean;
839
840
  dateFormat: string;
840
841
  bankTransaction: BankTransaction;
841
- editable: boolean;
842
842
  removeTransaction: (id: string) => void;
843
843
  containerWidth?: number;
844
844
  initialLoad?: boolean;
@@ -848,7 +848,7 @@ declare module '@layerfi/components/components/BankTransactionRow/BankTransactio
848
848
  export type LastSubmittedForm = 'simple' | 'match' | 'split' | undefined;
849
849
  export const extractDescriptionForSplit: (category: Category) => string;
850
850
  export const getDefaultSelectedCategory: (bankTransaction: BankTransaction) => import("@layerfi/components/components/CategorySelect/CategorySelect").CategoryOption | undefined;
851
- export const BankTransactionRow: ({ index, dateFormat, bankTransaction, editable, removeTransaction, containerWidth, initialLoad, showDescriptions, showReceiptUploads, }: Props) => React.JSX.Element | null;
851
+ export const BankTransactionRow: ({ index, editable, dateFormat, bankTransaction, removeTransaction, containerWidth, initialLoad, showDescriptions, showReceiptUploads, }: Props) => React.JSX.Element | null;
852
852
  export {};
853
853
 
854
854
  }
@@ -879,6 +879,7 @@ declare module '@layerfi/components/components/BankTransactionRow/index' {
879
879
  }
880
880
  declare module '@layerfi/components/components/BankTransactions/BankTransactions' {
881
881
  import React from 'react';
882
+ import { BankTransactionFilters } from '@layerfi/components/hooks/useBankTransactions/types';
882
883
  import { MobileComponentType } from '@layerfi/components/components/BankTransactions/constants';
883
884
  export interface BankTransactionsProps {
884
885
  asWidget?: boolean;
@@ -887,20 +888,25 @@ declare module '@layerfi/components/components/BankTransactions/BankTransactions
887
888
  showDescriptions?: boolean;
888
889
  showReceiptUploads?: boolean;
889
890
  monthlyView?: boolean;
891
+ categorizeView?: boolean;
890
892
  mobileComponent?: MobileComponentType;
893
+ filters?: BankTransactionFilters;
894
+ hideHeader?: boolean;
891
895
  }
892
- export const BankTransactions: ({ asWidget, pageSize, categorizedOnly, showDescriptions, showReceiptUploads, monthlyView, mobileComponent, }: BankTransactionsProps) => React.JSX.Element;
896
+ export const BankTransactions: ({ asWidget, pageSize, categorizedOnly, categorizeView, showDescriptions, showReceiptUploads, monthlyView, mobileComponent, filters: inputFilters, hideHeader, }: BankTransactionsProps) => React.JSX.Element;
893
897
 
894
898
  }
895
899
  declare module '@layerfi/components/components/BankTransactions/BankTransactionsHeader' {
896
900
  import React, { ChangeEvent } from 'react';
901
+ import { DisplayState } from '@layerfi/components/hooks/useBankTransactions/types';
897
902
  import { DateRange } from '@layerfi/components/types';
898
- import { DisplayState, MobileComponentType } from '@layerfi/components/components/BankTransactions/constants';
903
+ import { MobileComponentType } from '@layerfi/components/components/BankTransactions/constants';
899
904
  export interface BankTransactionsHeaderProps {
900
905
  shiftStickyHeader: number;
901
906
  asWidget?: boolean;
902
907
  categorizedOnly?: boolean;
903
- display: DisplayState;
908
+ categorizeView?: boolean;
909
+ display?: DisplayState;
904
910
  onCategorizationDisplayChange: (event: ChangeEvent<HTMLInputElement>) => void;
905
911
  mobileComponent?: MobileComponentType;
906
912
  withDatePicker?: boolean;
@@ -908,7 +914,7 @@ declare module '@layerfi/components/components/BankTransactions/BankTransactions
908
914
  dateRange?: DateRange;
909
915
  setDateRange?: (value: DateRange) => void;
910
916
  }
911
- export const BankTransactionsHeader: ({ shiftStickyHeader, asWidget, categorizedOnly, display, onCategorizationDisplayChange, mobileComponent, withDatePicker, listView, dateRange, setDateRange, }: BankTransactionsHeaderProps) => React.JSX.Element;
917
+ export const BankTransactionsHeader: ({ shiftStickyHeader, asWidget, categorizedOnly, categorizeView, display, onCategorizationDisplayChange, mobileComponent, withDatePicker, listView, dateRange, setDateRange, }: BankTransactionsHeaderProps) => React.JSX.Element;
912
918
 
913
919
  }
914
920
  declare module '@layerfi/components/components/BankTransactions/DataStates' {
@@ -929,10 +935,6 @@ declare module '@layerfi/components/components/BankTransactions/DataStates' {
929
935
  declare module '@layerfi/components/components/BankTransactions/constants' {
930
936
  import { CategorizationStatus } from '@layerfi/components/types';
931
937
  export type MobileComponentType = 'regularList' | 'mobileList';
932
- export enum DisplayState {
933
- review = "review",
934
- categorized = "categorized"
935
- }
936
938
  export const CategorizedCategories: CategorizationStatus[];
937
939
  export const ReviewCategories: CategorizationStatus[];
938
940
 
@@ -942,9 +944,9 @@ declare module '@layerfi/components/components/BankTransactions/index' {
942
944
 
943
945
  }
944
946
  declare module '@layerfi/components/components/BankTransactions/utils' {
945
- import { BankTransaction } from '@layerfi/components/types';
946
- import { DisplayState } from '@layerfi/components/components/BankTransactions/constants';
947
- export const filterVisibility: (display: DisplayState, bankTransaction: BankTransaction) => boolean;
947
+ import { BankTransaction, CategorizationScope } from '@layerfi/components/types';
948
+ export const filterVisibility: (scope: CategorizationScope, bankTransaction: BankTransaction) => boolean;
949
+ export const isCategorized: (bankTransaction: BankTransaction) => boolean;
948
950
 
949
951
  }
950
952
  declare module '@layerfi/components/components/BankTransactionsTable/BankTransactionsTable' {
@@ -953,6 +955,7 @@ declare module '@layerfi/components/components/BankTransactionsTable/BankTransac
953
955
  interface BankTransactionsTableProps {
954
956
  bankTransactions?: BankTransaction[];
955
957
  editable: boolean;
958
+ categorizeView?: boolean;
956
959
  isLoading?: boolean;
957
960
  initialLoad?: boolean;
958
961
  containerWidth: number;
@@ -960,7 +963,7 @@ declare module '@layerfi/components/components/BankTransactionsTable/BankTransac
960
963
  showDescriptions?: boolean;
961
964
  showReceiptUploads?: boolean;
962
965
  }
963
- export const BankTransactionsTable: ({ editable, isLoading, bankTransactions, initialLoad, containerWidth, removeTransaction, showDescriptions, showReceiptUploads, }: BankTransactionsTableProps) => React.JSX.Element;
966
+ export const BankTransactionsTable: ({ categorizeView, editable, isLoading, bankTransactions, initialLoad, containerWidth, removeTransaction, showDescriptions, showReceiptUploads, }: BankTransactionsTableProps) => React.JSX.Element;
964
967
  export {};
965
968
 
966
969
  }
@@ -1375,7 +1378,7 @@ declare module '@layerfi/components/components/ExpandedBankTransactionRow/Expand
1375
1378
  asListItem?: boolean;
1376
1379
  submitBtnText?: string;
1377
1380
  containerWidth?: number;
1378
- editable?: boolean;
1381
+ categorized?: boolean;
1379
1382
  showDescriptions: boolean;
1380
1383
  showReceiptUploads: boolean;
1381
1384
  };
@@ -2574,6 +2577,51 @@ declare module '@layerfi/components/config/theme' {
2574
2577
  };
2575
2578
  };
2576
2579
 
2580
+ }
2581
+ declare module '@layerfi/components/contexts/BankTransactionsContext/BankTransactionsContext' {
2582
+ /// <reference types="react" />
2583
+ import { useBankTransactions } from '@layerfi/components/hooks/useBankTransactions/index';
2584
+ import { DisplayState } from '@layerfi/components/hooks/useBankTransactions/types';
2585
+ export type BankTransactionsContextType = ReturnType<typeof useBankTransactions>;
2586
+ export const BankTransactionsContext: import("react").Context<{
2587
+ data?: import("@layerfi/components/types").BankTransaction[] | undefined;
2588
+ metadata: import("@layerfi/components/types").Metadata;
2589
+ loadingStatus: import("@layerfi/components/types/general").LoadedStatus;
2590
+ isLoading: boolean;
2591
+ isValidating: boolean;
2592
+ error: unknown;
2593
+ filters?: import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters | undefined;
2594
+ accountsList?: import("@layerfi/components/hooks/useBankTransactions/types").AccountItem[] | undefined;
2595
+ display: DisplayState;
2596
+ categorize: (id: string, newCategory: import("@layerfi/components/types").CategoryUpdate, notify?: boolean | undefined) => Promise<void>;
2597
+ match: (id: string, matchId: string, notify?: boolean | undefined) => Promise<void>;
2598
+ updateOneLocal: (bankTransaction: import("@layerfi/components/types").BankTransaction) => void;
2599
+ refetch: () => void;
2600
+ setFilters: (filters?: Partial<import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters> | undefined) => void;
2601
+ activate: () => void;
2602
+ }>;
2603
+ export const useBankTransactionsContext: () => {
2604
+ data?: import("@layerfi/components/types").BankTransaction[] | undefined;
2605
+ metadata: import("@layerfi/components/types").Metadata;
2606
+ loadingStatus: import("@layerfi/components/types/general").LoadedStatus;
2607
+ isLoading: boolean;
2608
+ isValidating: boolean;
2609
+ error: unknown;
2610
+ filters?: import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters | undefined;
2611
+ accountsList?: import("@layerfi/components/hooks/useBankTransactions/types").AccountItem[] | undefined;
2612
+ display: DisplayState;
2613
+ categorize: (id: string, newCategory: import("@layerfi/components/types").CategoryUpdate, notify?: boolean | undefined) => Promise<void>;
2614
+ match: (id: string, matchId: string, notify?: boolean | undefined) => Promise<void>;
2615
+ updateOneLocal: (bankTransaction: import("@layerfi/components/types").BankTransaction) => void;
2616
+ refetch: () => void;
2617
+ setFilters: (filters?: Partial<import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters> | undefined) => void;
2618
+ activate: () => void;
2619
+ };
2620
+
2621
+ }
2622
+ declare module '@layerfi/components/contexts/BankTransactionsContext/index' {
2623
+ export { BankTransactionsContext, useBankTransactionsContext } from '@layerfi/components/contexts/BankTransactionsContext/BankTransactionsContext';
2624
+
2577
2625
  }
2578
2626
  declare module '@layerfi/components/contexts/ChartOfAccountsContext/ChartOfAccountsContext' {
2579
2627
  /// <reference types="react" />
@@ -2664,10 +2712,13 @@ declare module '@layerfi/components/contexts/LayerContext/LayerContext' {
2664
2712
  export const LayerContext: import("react").Context<LayerContextValues & LayerContextHelpers & {
2665
2713
  setTheme: (theme: LayerThemeConfig) => void;
2666
2714
  }>;
2715
+ export const useLayerContext: () => LayerContextValues & LayerContextHelpers & {
2716
+ setTheme: (theme: LayerThemeConfig) => void;
2717
+ };
2667
2718
 
2668
2719
  }
2669
2720
  declare module '@layerfi/components/contexts/LayerContext/index' {
2670
- export { LayerContext } from '@layerfi/components/contexts/LayerContext/LayerContext';
2721
+ export { LayerContext, useLayerContext } from '@layerfi/components/contexts/LayerContext/LayerContext';
2671
2722
 
2672
2723
  }
2673
2724
  declare module '@layerfi/components/contexts/LedgerAccountsContext/LedgerAccountsContext' {
@@ -2760,23 +2811,61 @@ declare module '@layerfi/components/hooks/useBankTransactions/index' {
2760
2811
  export { useBankTransactions } from '@layerfi/components/hooks/useBankTransactions/useBankTransactions';
2761
2812
 
2762
2813
  }
2763
- declare module '@layerfi/components/hooks/useBankTransactions/useBankTransactions' {
2764
- import { BankTransaction, CategoryUpdate, Metadata } from '@layerfi/components/types';
2814
+ declare module '@layerfi/components/hooks/useBankTransactions/types' {
2815
+ import { BankTransaction, CategorizationScope, CategoryUpdate, DateRange, Direction, Metadata } from '@layerfi/components/types';
2765
2816
  import { LoadedStatus } from '@layerfi/components/types/general';
2766
- type UseBankTransactions = () => {
2817
+ export interface NumericRangeFilter {
2818
+ min?: number;
2819
+ max?: number;
2820
+ }
2821
+ export interface AccountItem {
2822
+ id: string;
2823
+ name: string;
2824
+ }
2825
+ export enum DisplayState {
2826
+ review = "review",
2827
+ categorized = "categorized"
2828
+ }
2829
+ export interface BankTransactionFilters {
2830
+ amount?: NumericRangeFilter;
2831
+ account?: string[];
2832
+ direction?: Direction[];
2833
+ categorizationStatus?: CategorizationScope;
2834
+ dateRange?: Partial<DateRange>;
2835
+ }
2836
+ export type UseBankTransactions = () => {
2767
2837
  data?: BankTransaction[];
2768
2838
  metadata: Metadata;
2769
2839
  loadingStatus: LoadedStatus;
2770
2840
  isLoading: boolean;
2771
2841
  isValidating: boolean;
2772
2842
  error: unknown;
2843
+ filters?: BankTransactionFilters;
2844
+ accountsList?: AccountItem[];
2845
+ display: DisplayState;
2773
2846
  categorize: (id: BankTransaction['id'], newCategory: CategoryUpdate, notify?: boolean) => Promise<void>;
2774
2847
  match: (id: BankTransaction['id'], matchId: BankTransaction['id'], notify?: boolean) => Promise<void>;
2775
2848
  updateOneLocal: (bankTransaction: BankTransaction) => void;
2776
2849
  refetch: () => void;
2850
+ setFilters: (filters?: Partial<BankTransactionFilters>) => void;
2851
+ activate: () => void;
2777
2852
  };
2853
+
2854
+ }
2855
+ declare module '@layerfi/components/hooks/useBankTransactions/useBankTransactions' {
2856
+ import { UseBankTransactions } from '@layerfi/components/hooks/useBankTransactions/types';
2778
2857
  export const useBankTransactions: UseBankTransactions;
2779
- export {};
2858
+
2859
+ }
2860
+ declare module '@layerfi/components/hooks/useBankTransactions/utils' {
2861
+ import { BankTransaction, CategorizationScope, DateRange, Direction } from '@layerfi/components/types';
2862
+ import { AccountItem, NumericRangeFilter } from '@layerfi/components/hooks/useBankTransactions/types';
2863
+ export const collectAccounts: (transactions?: BankTransaction[]) => AccountItem[];
2864
+ export const applyAmountFilter: (data?: BankTransaction[], filter?: NumericRangeFilter) => BankTransaction[] | undefined;
2865
+ export const applyAccountFilter: (data?: BankTransaction[], filter?: string[]) => BankTransaction[] | undefined;
2866
+ export const applyDirectionFilter: (data?: BankTransaction[], filter?: Direction[]) => BankTransaction[] | undefined;
2867
+ export const applyCategorizationStatusFilter: (data?: BankTransaction[], filter?: CategorizationScope) => BankTransaction[] | undefined;
2868
+ export const appplyDateRangeFilter: (data?: BankTransaction[], filter?: Partial<DateRange>) => BankTransaction[] | undefined;
2780
2869
 
2781
2870
  }
2782
2871
  declare module '@layerfi/components/hooks/useChartOfAccounts/index' {
@@ -2905,16 +2994,6 @@ declare module '@layerfi/components/hooks/useJournal/useJournal' {
2905
2994
  export const useJournal: UseJournal;
2906
2995
  export {};
2907
2996
 
2908
- }
2909
- declare module '@layerfi/components/hooks/useLayerContext/index' {
2910
- export { useLayerContext } from '@layerfi/components/hooks/useLayerContext/useLayerContext';
2911
-
2912
- }
2913
- declare module '@layerfi/components/hooks/useLayerContext/useLayerContext' {
2914
- export const useLayerContext: () => import("@layerfi/components/types").LayerContextValues & import("../../types").LayerContextHelpers & {
2915
- setTheme: (theme: import("@layerfi/components/types/layer_context").LayerThemeConfig) => void;
2916
- };
2917
-
2918
2997
  }
2919
2998
  declare module '@layerfi/components/hooks/useLedgerAccounts/index' {
2920
2999
  export { useLedgerAccounts } from '@layerfi/components/hooks/useLedgerAccounts/useLedgerAccounts';
@@ -3385,6 +3464,7 @@ declare module '@layerfi/components/icons/types' {
3385
3464
 
3386
3465
  }
3387
3466
  declare module '@layerfi/components/index' {
3467
+ export { LayerProvider } from '@layerfi/components/providers/LayerProvider/index';
3388
3468
  export { BalanceSheet } from '@layerfi/components/components/BalanceSheet/index';
3389
3469
  export { BankTransactions } from '@layerfi/components/components/BankTransactions/index';
3390
3470
  export { Hello } from '@layerfi/components/components/Hello/index';
@@ -3392,8 +3472,6 @@ declare module '@layerfi/components/index' {
3392
3472
  export { ProfitAndLoss } from '@layerfi/components/components/ProfitAndLoss/index';
3393
3473
  export { ProfitAndLossView } from '@layerfi/components/components/ProfitAndLossView/index';
3394
3474
  export { ChartOfAccounts } from '@layerfi/components/components/ChartOfAccounts/index';
3395
- export { LayerProvider } from '@layerfi/components/providers/LayerProvider/index';
3396
- export { useLayerContext } from '@layerfi/components/hooks/useLayerContext/index';
3397
3475
  export { Journal } from '@layerfi/components/components/Journal/index';
3398
3476
  export { Onboarding } from '@layerfi/components/components/Onboarding/index';
3399
3477
  export { Tasks } from '@layerfi/components/components/Tasks/index';
@@ -3401,6 +3479,8 @@ declare module '@layerfi/components/index' {
3401
3479
  export { BankTransactionsWithLinkedAccounts } from '@layerfi/components/views/BankTransactionsWithLinkedAccounts/index';
3402
3480
  export { Reports } from '@layerfi/components/views/Reports/index';
3403
3481
  export { GeneralLedgerView } from '@layerfi/components/views/GeneralLedger/index';
3482
+ export { useLayerContext } from '@layerfi/components/contexts/LayerContext/index';
3483
+ export { useBankTransactionsContext } from '@layerfi/components/contexts/BankTransactionsContext/index';
3404
3484
 
3405
3485
  }
3406
3486
  declare module '@layerfi/components/models/APIError' {
@@ -3427,6 +3507,19 @@ declare module '@layerfi/components/models/Money' {
3427
3507
  };
3428
3508
  export default _default;
3429
3509
 
3510
+ }
3511
+ declare module '@layerfi/components/providers/BankTransactionsProvider/BankTransactionsProvider' {
3512
+ import React, { ReactNode } from 'react';
3513
+ interface BankTransactionsProviderProps {
3514
+ children: ReactNode;
3515
+ }
3516
+ export const BankTransactionsProvider: ({ children, }: BankTransactionsProviderProps) => React.JSX.Element;
3517
+ export {};
3518
+
3519
+ }
3520
+ declare module '@layerfi/components/providers/BankTransactionsProvider/index' {
3521
+ export { BankTransactionsProvider } from '@layerfi/components/providers/BankTransactionsProvider/BankTransactionsProvider';
3522
+
3430
3523
  }
3431
3524
  declare module '@layerfi/components/providers/LayerProvider/LayerProvider' {
3432
3525
  import React, { PropsWithChildren } from 'react';
@@ -3591,6 +3684,10 @@ declare module '@layerfi/components/types/categories' {
3591
3684
  JOURNALING = "JOURNALING",
3592
3685
  MATCHED = "MATCHED"
3593
3686
  }
3687
+ export enum CategorizationScope {
3688
+ TO_REVIEW = "TO_REVIEW",
3689
+ CATEGORIZED = "CATEGORIZED"
3690
+ }
3594
3691
  export interface CategoryEntry {
3595
3692
  amount?: number;
3596
3693
  category: Category;
@@ -3801,6 +3898,7 @@ declare module '@layerfi/components/types/layer_context' {
3801
3898
  getColor: (shade: number) => ColorsPaletteOption | undefined;
3802
3899
  setLightColor: (color?: ColorConfig) => void;
3803
3900
  setDarkColor: (color?: ColorConfig) => void;
3901
+ setTextColor: (color?: ColorConfig) => void;
3804
3902
  setColors: (colors?: LayerThemeConfigColors) => void;
3805
3903
  setOnboardingStep: (value: OnboardingStep) => void;
3806
3904
  addToast: (toast: ToastProps) => void;
@@ -3839,6 +3937,7 @@ declare module '@layerfi/components/types/layer_context' {
3839
3937
  export interface LayerThemeConfigColors {
3840
3938
  dark?: ColorConfig;
3841
3939
  light?: ColorConfig;
3940
+ text?: ColorConfig;
3842
3941
  }
3843
3942
  export interface LayerThemeConfig {
3844
3943
  colors?: LayerThemeConfigColors;
@@ -4113,7 +4212,7 @@ declare module '@layerfi/components/types' {
4113
4212
  export { LineItem } from '@layerfi/components/types/line_item';
4114
4213
  export { BalanceSheet } from '@layerfi/components/types/balance_sheet';
4115
4214
  export { Direction, BankTransaction } from '@layerfi/components/types/bank_transactions';
4116
- export { CategorizationStatus, Category, CategorizationType, AutoCategorization, SuggestedCategorization, SingleCategoryUpdate, SplitCategoryUpdate, CategoryUpdate, } from '@layerfi/components/types/categories';
4215
+ export { CategorizationStatus, CategorizationScope, Category, CategorizationType, AutoCategorization, SuggestedCategorization, SingleCategoryUpdate, SplitCategoryUpdate, CategoryUpdate, } from '@layerfi/components/types/categories';
4117
4216
  export { ChartOfAccounts, Account, NewAccount, EditAccount, } from '@layerfi/components/types/chart_of_accounts';
4118
4217
  export { LedgerAccountLineItems as LedgerAccounts, LedgerAccountLineItem, LedgerAccountsAccount, LedgerAccountsEntry, } from '@layerfi/components/types/ledger_accounts';
4119
4218
  export { SortDirection } from '@layerfi/components/types/general';