@layerfi/components 0.1.36 → 0.1.38

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
@@ -60,6 +60,8 @@ declare module '@layerfi/components/api/layer/bankTransactions' {
60
60
  };
61
61
  export interface GetBankTransactionsParams extends Record<string, string | undefined> {
62
62
  businessId: string;
63
+ cursor?: string;
64
+ categorized?: string;
63
65
  sortOrder?: 'ASC' | 'DESC';
64
66
  sortBy?: string;
65
67
  }
@@ -855,7 +857,7 @@ declare module '@layerfi/components/components/BankTransactionList/BankTransacti
855
857
  bankTransactions?: BankTransaction[];
856
858
  editable: boolean;
857
859
  containerWidth: number;
858
- removeTransaction: (id: string) => void;
860
+ removeTransaction: (bt: BankTransaction) => void;
859
861
  showDescriptions?: boolean;
860
862
  showReceiptUploads?: boolean;
861
863
  }
@@ -873,10 +875,10 @@ declare module '@layerfi/components/components/BankTransactionList/BankTransacti
873
875
  editable: boolean;
874
876
  showDescriptions: boolean;
875
877
  showReceiptUploads: boolean;
876
- removeTransaction: (id: string) => void;
878
+ removeTransaction: (bt: BankTransaction) => void;
877
879
  containerWidth?: number;
878
880
  };
879
- export const BankTransactionListItem: ({ index, dateFormat, bankTransaction, editable, showDescriptions, showReceiptUploads, containerWidth, }: Props) => React.JSX.Element | null;
881
+ export const BankTransactionListItem: ({ index, dateFormat, bankTransaction, editable, showDescriptions, showReceiptUploads, containerWidth, removeTransaction, }: Props) => React.JSX.Element;
880
882
  export {};
881
883
 
882
884
  }
@@ -902,7 +904,7 @@ declare module '@layerfi/components/components/BankTransactionMobileList/BankTra
902
904
  export interface BankTransactionMobileListProps {
903
905
  bankTransactions?: BankTransaction[];
904
906
  editable: boolean;
905
- removeTransaction: (id: string) => void;
907
+ removeTransaction: (bt: BankTransaction) => void;
906
908
  initialLoad?: boolean;
907
909
  }
908
910
  export const BankTransactionMobileList: ({ bankTransactions, removeTransaction, editable, initialLoad, }: BankTransactionMobileListProps) => React.JSX.Element;
@@ -915,7 +917,7 @@ declare module '@layerfi/components/components/BankTransactionMobileList/BankTra
915
917
  index: number;
916
918
  bankTransaction: BankTransaction;
917
919
  editable: boolean;
918
- removeTransaction: (id: string) => void;
920
+ removeTransaction: (bt: BankTransaction) => void;
919
921
  initialLoad?: boolean;
920
922
  }
921
923
  export enum Purpose {
@@ -1033,7 +1035,7 @@ declare module '@layerfi/components/components/BankTransactionRow/BankTransactio
1033
1035
  editable: boolean;
1034
1036
  dateFormat: string;
1035
1037
  bankTransaction: BankTransaction;
1036
- removeTransaction: (id: string) => void;
1038
+ removeTransaction: (bt: BankTransaction) => void;
1037
1039
  containerWidth?: number;
1038
1040
  initialLoad?: boolean;
1039
1041
  showDescriptions: boolean;
@@ -1042,7 +1044,7 @@ declare module '@layerfi/components/components/BankTransactionRow/BankTransactio
1042
1044
  export type LastSubmittedForm = 'simple' | 'match' | 'split' | undefined;
1043
1045
  export const extractDescriptionForSplit: (category: Category) => string;
1044
1046
  export const getDefaultSelectedCategory: (bankTransaction: BankTransaction) => import("@layerfi/components/components/CategorySelect/CategorySelect").CategoryOption | undefined;
1045
- export const BankTransactionRow: ({ index, editable, dateFormat, bankTransaction, removeTransaction, containerWidth, initialLoad, showDescriptions, showReceiptUploads, }: Props) => React.JSX.Element | null;
1047
+ export const BankTransactionRow: ({ index, editable, dateFormat, bankTransaction, removeTransaction, containerWidth, initialLoad, showDescriptions, showReceiptUploads, }: Props) => React.JSX.Element;
1046
1048
  export {};
1047
1049
 
1048
1050
  }
@@ -1095,8 +1097,7 @@ declare module '@layerfi/components/components/BankTransactions/BankTransactions
1095
1097
  }
1096
1098
  declare module '@layerfi/components/components/BankTransactions/BankTransactionsHeader' {
1097
1099
  import React, { ChangeEvent } from 'react';
1098
- import { DisplayState } from '@layerfi/components/hooks/useBankTransactions/types';
1099
- import { DateRange } from '@layerfi/components/types';
1100
+ import { DateRange, DisplayState } from '@layerfi/components/types';
1100
1101
  import { MobileComponentType } from '@layerfi/components/components/BankTransactions/constants';
1101
1102
  export interface BankTransactionsHeaderProps {
1102
1103
  shiftStickyHeader: number;
@@ -1119,13 +1120,14 @@ declare module '@layerfi/components/components/BankTransactions/DataStates' {
1119
1120
  import { BankTransaction } from '@layerfi/components/types';
1120
1121
  interface DataStatesProps {
1121
1122
  bankTransactions?: BankTransaction[];
1123
+ transactionsLoading: boolean;
1122
1124
  isLoading?: boolean;
1123
1125
  isValidating?: boolean;
1124
1126
  error?: unknown;
1125
1127
  refetch: () => void;
1126
1128
  editable: boolean;
1127
1129
  }
1128
- export const DataStates: ({ bankTransactions, isLoading, isValidating, error, refetch, editable, }: DataStatesProps) => React.JSX.Element;
1130
+ export const DataStates: ({ bankTransactions, transactionsLoading, isLoading, isValidating, error, refetch, editable, }: DataStatesProps) => React.JSX.Element;
1129
1131
  export {};
1130
1132
 
1131
1133
  }
@@ -1141,8 +1143,8 @@ declare module '@layerfi/components/components/BankTransactions/index' {
1141
1143
 
1142
1144
  }
1143
1145
  declare module '@layerfi/components/components/BankTransactions/utils' {
1144
- import { BankTransaction, CategorizationScope } from '@layerfi/components/types';
1145
- export const filterVisibility: (scope: CategorizationScope, bankTransaction: BankTransaction) => boolean;
1146
+ import { BankTransaction, DisplayState } from '@layerfi/components/types';
1147
+ export const filterVisibility: (scope: DisplayState, bankTransaction: BankTransaction) => boolean;
1146
1148
  export const isCategorized: (bankTransaction: BankTransaction) => boolean;
1147
1149
 
1148
1150
  }
@@ -1156,7 +1158,7 @@ declare module '@layerfi/components/components/BankTransactionsTable/BankTransac
1156
1158
  isLoading?: boolean;
1157
1159
  initialLoad?: boolean;
1158
1160
  containerWidth: number;
1159
- removeTransaction: (id: string) => void;
1161
+ removeTransaction: (bt: BankTransaction) => void;
1160
1162
  showDescriptions?: boolean;
1161
1163
  showReceiptUploads?: boolean;
1162
1164
  }
@@ -1534,8 +1536,10 @@ declare module '@layerfi/components/components/DatePicker/DatePicker' {
1534
1536
  popperClassName?: string;
1535
1537
  currentDateOption?: boolean;
1536
1538
  minDate?: Date;
1539
+ maxDate?: Date;
1540
+ navigateArrows?: boolean;
1537
1541
  }
1538
- export const DatePicker: ({ selected, onChange, mode, dateFormat, timeIntervals, timeCaption, placeholderText, options, wrapperClassName, calendarClassName, popperClassName, minDate, currentDateOption, ...props }: DatePickerProps) => React.JSX.Element;
1542
+ export const DatePicker: ({ selected, onChange, mode, dateFormat, timeIntervals, timeCaption, placeholderText, options, wrapperClassName, calendarClassName, popperClassName, minDate, maxDate, currentDateOption, navigateArrows, ...props }: DatePickerProps) => React.JSX.Element;
1539
1543
  export {};
1540
1544
 
1541
1545
  }
@@ -2097,8 +2101,10 @@ declare module '@layerfi/components/components/Pagination/Pagination' {
2097
2101
  onPageChange: (page: number) => void;
2098
2102
  totalCount: number;
2099
2103
  siblingCount?: number;
2104
+ hasMore?: boolean;
2105
+ fetchMore?: () => void;
2100
2106
  }
2101
- export const Pagination: ({ onPageChange, totalCount, siblingCount, currentPage, pageSize, }: PaginationProps) => React.JSX.Element | undefined;
2107
+ export const Pagination: ({ onPageChange, totalCount, siblingCount, currentPage, pageSize, hasMore, fetchMore }: PaginationProps) => React.JSX.Element | undefined;
2102
2108
 
2103
2109
  }
2104
2110
  declare module '@layerfi/components/components/Pagination/index' {
@@ -3025,41 +3031,47 @@ declare module '@layerfi/components/contexts/BalanceSheetContext/index' {
3025
3031
  declare module '@layerfi/components/contexts/BankTransactionsContext/BankTransactionsContext' {
3026
3032
  /// <reference types="react" />
3027
3033
  import { useBankTransactions } from '@layerfi/components/hooks/useBankTransactions/index';
3028
- import { DisplayState } from '@layerfi/components/hooks/useBankTransactions/types';
3034
+ import { DisplayState } from '@layerfi/components/types';
3029
3035
  export type BankTransactionsContextType = ReturnType<typeof useBankTransactions>;
3030
3036
  export const BankTransactionsContext: import("react").Context<{
3031
3037
  data?: import("@layerfi/components/types").BankTransaction[] | undefined;
3032
- metadata: import("@layerfi/components/types").Metadata;
3038
+ metadata?: import("@layerfi/components/types").Metadata | undefined;
3033
3039
  loadingStatus: import("@layerfi/components/types/general").LoadedStatus;
3034
3040
  isLoading: boolean;
3035
3041
  isValidating: boolean;
3036
3042
  error: unknown;
3043
+ hasMore?: boolean | undefined;
3037
3044
  filters?: import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters | undefined;
3038
3045
  accountsList?: import("@layerfi/components/hooks/useBankTransactions/types").AccountItem[] | undefined;
3039
3046
  display: DisplayState;
3040
3047
  categorize: (id: string, newCategory: import("@layerfi/components/types").CategoryUpdate, notify?: boolean | undefined) => Promise<void>;
3041
3048
  match: (id: string, matchId: string, notify?: boolean | undefined) => Promise<void>;
3042
3049
  updateOneLocal: (bankTransaction: import("@layerfi/components/types").BankTransaction) => void;
3050
+ removeAfterCategorize: (bankTransaction: import("@layerfi/components/types").BankTransaction) => void;
3043
3051
  refetch: () => void;
3044
3052
  setFilters: (filters?: Partial<import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters> | undefined) => void;
3045
3053
  activate: () => void;
3054
+ fetchMore: () => void;
3046
3055
  }>;
3047
3056
  export const useBankTransactionsContext: () => {
3048
3057
  data?: import("@layerfi/components/types").BankTransaction[] | undefined;
3049
- metadata: import("@layerfi/components/types").Metadata;
3058
+ metadata?: import("@layerfi/components/types").Metadata | undefined;
3050
3059
  loadingStatus: import("@layerfi/components/types/general").LoadedStatus;
3051
3060
  isLoading: boolean;
3052
3061
  isValidating: boolean;
3053
3062
  error: unknown;
3063
+ hasMore?: boolean | undefined;
3054
3064
  filters?: import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters | undefined;
3055
3065
  accountsList?: import("@layerfi/components/hooks/useBankTransactions/types").AccountItem[] | undefined;
3056
3066
  display: DisplayState;
3057
3067
  categorize: (id: string, newCategory: import("@layerfi/components/types").CategoryUpdate, notify?: boolean | undefined) => Promise<void>;
3058
3068
  match: (id: string, matchId: string, notify?: boolean | undefined) => Promise<void>;
3059
3069
  updateOneLocal: (bankTransaction: import("@layerfi/components/types").BankTransaction) => void;
3070
+ removeAfterCategorize: (bankTransaction: import("@layerfi/components/types").BankTransaction) => void;
3060
3071
  refetch: () => void;
3061
3072
  setFilters: (filters?: Partial<import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters> | undefined) => void;
3062
3073
  activate: () => void;
3074
+ fetchMore: () => void;
3063
3075
  };
3064
3076
 
3065
3077
  }
@@ -3291,7 +3303,7 @@ declare module '@layerfi/components/hooks/useBankTransactions/index' {
3291
3303
 
3292
3304
  }
3293
3305
  declare module '@layerfi/components/hooks/useBankTransactions/types' {
3294
- import { BankTransaction, CategorizationScope, CategoryUpdate, DateRange, Direction, Metadata } from '@layerfi/components/types';
3306
+ import { BankTransaction, CategoryUpdate, DateRange, Direction, DisplayState, Metadata } from '@layerfi/components/types';
3295
3307
  import { LoadedStatus } from '@layerfi/components/types/general';
3296
3308
  export interface NumericRangeFilter {
3297
3309
  min?: number;
@@ -3301,33 +3313,34 @@ declare module '@layerfi/components/hooks/useBankTransactions/types' {
3301
3313
  id: string;
3302
3314
  name: string;
3303
3315
  }
3304
- export enum DisplayState {
3305
- review = "review",
3306
- categorized = "categorized"
3307
- }
3308
3316
  export interface BankTransactionFilters {
3309
3317
  amount?: NumericRangeFilter;
3310
3318
  account?: string[];
3311
3319
  direction?: Direction[];
3312
- categorizationStatus?: CategorizationScope;
3320
+ categorizationStatus?: DisplayState;
3313
3321
  dateRange?: Partial<DateRange>;
3314
3322
  }
3315
- export type UseBankTransactions = () => {
3323
+ export type UseBankTransactions = (params?: {
3324
+ scope?: DisplayState;
3325
+ }) => {
3316
3326
  data?: BankTransaction[];
3317
- metadata: Metadata;
3327
+ metadata?: Metadata;
3318
3328
  loadingStatus: LoadedStatus;
3319
3329
  isLoading: boolean;
3320
3330
  isValidating: boolean;
3321
3331
  error: unknown;
3332
+ hasMore?: boolean;
3322
3333
  filters?: BankTransactionFilters;
3323
3334
  accountsList?: AccountItem[];
3324
3335
  display: DisplayState;
3325
3336
  categorize: (id: BankTransaction['id'], newCategory: CategoryUpdate, notify?: boolean) => Promise<void>;
3326
3337
  match: (id: BankTransaction['id'], matchId: BankTransaction['id'], notify?: boolean) => Promise<void>;
3327
3338
  updateOneLocal: (bankTransaction: BankTransaction) => void;
3339
+ removeAfterCategorize: (bankTransaction: BankTransaction) => void;
3328
3340
  refetch: () => void;
3329
3341
  setFilters: (filters?: Partial<BankTransactionFilters>) => void;
3330
3342
  activate: () => void;
3343
+ fetchMore: () => void;
3331
3344
  };
3332
3345
 
3333
3346
  }
@@ -3337,13 +3350,14 @@ declare module '@layerfi/components/hooks/useBankTransactions/useBankTransaction
3337
3350
 
3338
3351
  }
3339
3352
  declare module '@layerfi/components/hooks/useBankTransactions/utils' {
3340
- import { BankTransaction, CategorizationScope, DateRange, Direction } from '@layerfi/components/types';
3353
+ import { BankTransaction, DateRange, Direction, DisplayState } from '@layerfi/components/types';
3341
3354
  import { AccountItem, NumericRangeFilter } from '@layerfi/components/hooks/useBankTransactions/types';
3342
3355
  export const collectAccounts: (transactions?: BankTransaction[]) => AccountItem[];
3356
+ export const uniqAccountsList: (arr: AccountItem[], track?: Set<unknown>) => AccountItem[];
3343
3357
  export const applyAmountFilter: (data?: BankTransaction[], filter?: NumericRangeFilter) => BankTransaction[] | undefined;
3344
3358
  export const applyAccountFilter: (data?: BankTransaction[], filter?: string[]) => BankTransaction[] | undefined;
3345
3359
  export const applyDirectionFilter: (data?: BankTransaction[], filter?: Direction[]) => BankTransaction[] | undefined;
3346
- export const applyCategorizationStatusFilter: (data?: BankTransaction[], filter?: CategorizationScope) => BankTransaction[] | undefined;
3360
+ export const applyCategorizationStatusFilter: (data?: BankTransaction[], filter?: DisplayState) => BankTransaction[] | undefined;
3347
3361
  export const appplyDateRangeFilter: (data?: BankTransaction[], filter?: Partial<DateRange>) => BankTransaction[] | undefined;
3348
3362
 
3349
3363
  }
@@ -3635,6 +3649,7 @@ declare module '@layerfi/components/hooks/useProfitAndLoss/useProfitAndLossLTM'
3635
3649
  loaded?: LoadedStatus;
3636
3650
  error?: any;
3637
3651
  pullData: (date: Date) => void;
3652
+ refetch: () => void;
3638
3653
  };
3639
3654
  /**
3640
3655
  * Hooks fetch Last Twelve Months sending 12 requests (one for each month).
@@ -4029,6 +4044,8 @@ declare module '@layerfi/components/index' {
4029
4044
  export { ProfitAndLossView } from '@layerfi/components/components/ProfitAndLossView/index';
4030
4045
  export { useLayerContext } from '@layerfi/components/contexts/LayerContext/index';
4031
4046
  export { useBankTransactionsContext } from '@layerfi/components/contexts/BankTransactionsContext/index';
4047
+ export { BankTransactionsProvider } from '@layerfi/components/providers/BankTransactionsProvider/index';
4048
+ export { DisplayState } from '@layerfi/components/types/bank_transactions';
4032
4049
 
4033
4050
  }
4034
4051
  declare module '@layerfi/components/models/APIError' {
@@ -4177,6 +4194,10 @@ declare module '@layerfi/components/types/bank_transactions' {
4177
4194
  export enum BankTransactionMatchType {
4178
4195
  CONFIRM_MATCH = "Confirm_Match"
4179
4196
  }
4197
+ export enum DisplayState {
4198
+ review = "review",
4199
+ categorized = "categorized"
4200
+ }
4180
4201
  export interface BankTransaction extends Record<string, unknown> {
4181
4202
  type: 'Bank_Transaction';
4182
4203
  account_name?: string;
@@ -4270,10 +4291,6 @@ declare module '@layerfi/components/types/categories' {
4270
4291
  JOURNALING = "JOURNALING",
4271
4292
  MATCHED = "MATCHED"
4272
4293
  }
4273
- export enum CategorizationScope {
4274
- TO_REVIEW = "TO_REVIEW",
4275
- CATEGORIZED = "CATEGORIZED"
4276
- }
4277
4294
  export interface CategoryEntry {
4278
4295
  amount?: number;
4279
4296
  category: Category;
@@ -4799,6 +4816,9 @@ declare module '@layerfi/components/types/profit_and_loss' {
4799
4816
  totalExpenses: number;
4800
4817
  uncategorizedInflows: number;
4801
4818
  uncategorizedOutflows: number;
4819
+ operatingExpensesInverse?: number;
4820
+ uncategorizedOutflowsInverse?: number;
4821
+ uncategorized_transactions: number;
4802
4822
  }
4803
4823
  export interface ProfitAndLossSummaries {
4804
4824
  type: 'Profit_And_Loss_Summaries';
@@ -4898,8 +4918,8 @@ declare module '@layerfi/components/types' {
4898
4918
  export { LineItem } from '@layerfi/components/types/line_item';
4899
4919
  export { BalanceSheet } from '@layerfi/components/types/balance_sheet';
4900
4920
  export { StatementOfCashFlow } from '@layerfi/components/types/statement_of_cash_flow';
4901
- export { Direction, BankTransaction } from '@layerfi/components/types/bank_transactions';
4902
- export { CategorizationStatus, CategorizationScope, Category, CategorizationType, AutoCategorization, SuggestedCategorization, SingleCategoryUpdate, SplitCategoryUpdate, CategoryUpdate, } from '@layerfi/components/types/categories';
4921
+ export { Direction, BankTransaction, DisplayState } from '@layerfi/components/types/bank_transactions';
4922
+ export { CategorizationStatus, Category, CategorizationType, AutoCategorization, SuggestedCategorization, SingleCategoryUpdate, SplitCategoryUpdate, CategoryUpdate, } from '@layerfi/components/types/categories';
4903
4923
  export { ChartOfAccounts, Account, NewAccount, EditAccount, } from '@layerfi/components/types/chart_of_accounts';
4904
4924
  export { LedgerAccountLineItems as LedgerAccounts, LedgerAccountLineItem, LedgerAccountsAccount, LedgerAccountsEntry, } from '@layerfi/components/types/ledger_accounts';
4905
4925
  export { SortDirection } from '@layerfi/components/types/general';
@@ -4925,7 +4945,7 @@ declare module '@layerfi/components/utils/bankTransactions' {
4925
4945
  export const hasMatch: (bankTransaction?: BankTransaction) => boolean;
4926
4946
  export const isCredit: ({ direction }: Pick<BankTransaction, 'direction'>) => boolean;
4927
4947
  export const isAlreadyMatched: (bankTransaction?: BankTransaction) => string | undefined;
4928
- export const countTransactionsToReview: ({ transactions, dateRange }: {
4948
+ export const countTransactionsToReview: ({ transactions, dateRange, }: {
4929
4949
  transactions?: BankTransaction[] | undefined;
4930
4950
  dateRange?: DateRange | undefined;
4931
4951
  }) => number;