@layerfi/components 0.1.35 → 0.1.37

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
  }
@@ -2097,8 +2099,10 @@ declare module '@layerfi/components/components/Pagination/Pagination' {
2097
2099
  onPageChange: (page: number) => void;
2098
2100
  totalCount: number;
2099
2101
  siblingCount?: number;
2102
+ hasMore?: boolean;
2103
+ fetchMore?: () => void;
2100
2104
  }
2101
- export const Pagination: ({ onPageChange, totalCount, siblingCount, currentPage, pageSize, }: PaginationProps) => React.JSX.Element | undefined;
2105
+ export const Pagination: ({ onPageChange, totalCount, siblingCount, currentPage, pageSize, hasMore, fetchMore }: PaginationProps) => React.JSX.Element | undefined;
2102
2106
 
2103
2107
  }
2104
2108
  declare module '@layerfi/components/components/Pagination/index' {
@@ -3025,41 +3029,47 @@ declare module '@layerfi/components/contexts/BalanceSheetContext/index' {
3025
3029
  declare module '@layerfi/components/contexts/BankTransactionsContext/BankTransactionsContext' {
3026
3030
  /// <reference types="react" />
3027
3031
  import { useBankTransactions } from '@layerfi/components/hooks/useBankTransactions/index';
3028
- import { DisplayState } from '@layerfi/components/hooks/useBankTransactions/types';
3032
+ import { DisplayState } from '@layerfi/components/types';
3029
3033
  export type BankTransactionsContextType = ReturnType<typeof useBankTransactions>;
3030
3034
  export const BankTransactionsContext: import("react").Context<{
3031
3035
  data?: import("@layerfi/components/types").BankTransaction[] | undefined;
3032
- metadata: import("@layerfi/components/types").Metadata;
3036
+ metadata?: import("@layerfi/components/types").Metadata | undefined;
3033
3037
  loadingStatus: import("@layerfi/components/types/general").LoadedStatus;
3034
3038
  isLoading: boolean;
3035
3039
  isValidating: boolean;
3036
3040
  error: unknown;
3041
+ hasMore?: boolean | undefined;
3037
3042
  filters?: import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters | undefined;
3038
3043
  accountsList?: import("@layerfi/components/hooks/useBankTransactions/types").AccountItem[] | undefined;
3039
3044
  display: DisplayState;
3040
3045
  categorize: (id: string, newCategory: import("@layerfi/components/types").CategoryUpdate, notify?: boolean | undefined) => Promise<void>;
3041
3046
  match: (id: string, matchId: string, notify?: boolean | undefined) => Promise<void>;
3042
3047
  updateOneLocal: (bankTransaction: import("@layerfi/components/types").BankTransaction) => void;
3048
+ removeAfterCategorize: (bankTransaction: import("@layerfi/components/types").BankTransaction) => void;
3043
3049
  refetch: () => void;
3044
3050
  setFilters: (filters?: Partial<import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters> | undefined) => void;
3045
3051
  activate: () => void;
3052
+ fetchMore: () => void;
3046
3053
  }>;
3047
3054
  export const useBankTransactionsContext: () => {
3048
3055
  data?: import("@layerfi/components/types").BankTransaction[] | undefined;
3049
- metadata: import("@layerfi/components/types").Metadata;
3056
+ metadata?: import("@layerfi/components/types").Metadata | undefined;
3050
3057
  loadingStatus: import("@layerfi/components/types/general").LoadedStatus;
3051
3058
  isLoading: boolean;
3052
3059
  isValidating: boolean;
3053
3060
  error: unknown;
3061
+ hasMore?: boolean | undefined;
3054
3062
  filters?: import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters | undefined;
3055
3063
  accountsList?: import("@layerfi/components/hooks/useBankTransactions/types").AccountItem[] | undefined;
3056
3064
  display: DisplayState;
3057
3065
  categorize: (id: string, newCategory: import("@layerfi/components/types").CategoryUpdate, notify?: boolean | undefined) => Promise<void>;
3058
3066
  match: (id: string, matchId: string, notify?: boolean | undefined) => Promise<void>;
3059
3067
  updateOneLocal: (bankTransaction: import("@layerfi/components/types").BankTransaction) => void;
3068
+ removeAfterCategorize: (bankTransaction: import("@layerfi/components/types").BankTransaction) => void;
3060
3069
  refetch: () => void;
3061
3070
  setFilters: (filters?: Partial<import("@layerfi/components/hooks/useBankTransactions/types").BankTransactionFilters> | undefined) => void;
3062
3071
  activate: () => void;
3072
+ fetchMore: () => void;
3063
3073
  };
3064
3074
 
3065
3075
  }
@@ -3291,7 +3301,7 @@ declare module '@layerfi/components/hooks/useBankTransactions/index' {
3291
3301
 
3292
3302
  }
3293
3303
  declare module '@layerfi/components/hooks/useBankTransactions/types' {
3294
- import { BankTransaction, CategorizationScope, CategoryUpdate, DateRange, Direction, Metadata } from '@layerfi/components/types';
3304
+ import { BankTransaction, CategoryUpdate, DateRange, Direction, DisplayState, Metadata } from '@layerfi/components/types';
3295
3305
  import { LoadedStatus } from '@layerfi/components/types/general';
3296
3306
  export interface NumericRangeFilter {
3297
3307
  min?: number;
@@ -3301,33 +3311,34 @@ declare module '@layerfi/components/hooks/useBankTransactions/types' {
3301
3311
  id: string;
3302
3312
  name: string;
3303
3313
  }
3304
- export enum DisplayState {
3305
- review = "review",
3306
- categorized = "categorized"
3307
- }
3308
3314
  export interface BankTransactionFilters {
3309
3315
  amount?: NumericRangeFilter;
3310
3316
  account?: string[];
3311
3317
  direction?: Direction[];
3312
- categorizationStatus?: CategorizationScope;
3318
+ categorizationStatus?: DisplayState;
3313
3319
  dateRange?: Partial<DateRange>;
3314
3320
  }
3315
- export type UseBankTransactions = () => {
3321
+ export type UseBankTransactions = (params?: {
3322
+ scope?: DisplayState;
3323
+ }) => {
3316
3324
  data?: BankTransaction[];
3317
- metadata: Metadata;
3325
+ metadata?: Metadata;
3318
3326
  loadingStatus: LoadedStatus;
3319
3327
  isLoading: boolean;
3320
3328
  isValidating: boolean;
3321
3329
  error: unknown;
3330
+ hasMore?: boolean;
3322
3331
  filters?: BankTransactionFilters;
3323
3332
  accountsList?: AccountItem[];
3324
3333
  display: DisplayState;
3325
3334
  categorize: (id: BankTransaction['id'], newCategory: CategoryUpdate, notify?: boolean) => Promise<void>;
3326
3335
  match: (id: BankTransaction['id'], matchId: BankTransaction['id'], notify?: boolean) => Promise<void>;
3327
3336
  updateOneLocal: (bankTransaction: BankTransaction) => void;
3337
+ removeAfterCategorize: (bankTransaction: BankTransaction) => void;
3328
3338
  refetch: () => void;
3329
3339
  setFilters: (filters?: Partial<BankTransactionFilters>) => void;
3330
3340
  activate: () => void;
3341
+ fetchMore: () => void;
3331
3342
  };
3332
3343
 
3333
3344
  }
@@ -3337,13 +3348,14 @@ declare module '@layerfi/components/hooks/useBankTransactions/useBankTransaction
3337
3348
 
3338
3349
  }
3339
3350
  declare module '@layerfi/components/hooks/useBankTransactions/utils' {
3340
- import { BankTransaction, CategorizationScope, DateRange, Direction } from '@layerfi/components/types';
3351
+ import { BankTransaction, DateRange, Direction, DisplayState } from '@layerfi/components/types';
3341
3352
  import { AccountItem, NumericRangeFilter } from '@layerfi/components/hooks/useBankTransactions/types';
3342
3353
  export const collectAccounts: (transactions?: BankTransaction[]) => AccountItem[];
3354
+ export const uniqAccountsList: (arr: AccountItem[], track?: Set<unknown>) => AccountItem[];
3343
3355
  export const applyAmountFilter: (data?: BankTransaction[], filter?: NumericRangeFilter) => BankTransaction[] | undefined;
3344
3356
  export const applyAccountFilter: (data?: BankTransaction[], filter?: string[]) => BankTransaction[] | undefined;
3345
3357
  export const applyDirectionFilter: (data?: BankTransaction[], filter?: Direction[]) => BankTransaction[] | undefined;
3346
- export const applyCategorizationStatusFilter: (data?: BankTransaction[], filter?: CategorizationScope) => BankTransaction[] | undefined;
3358
+ export const applyCategorizationStatusFilter: (data?: BankTransaction[], filter?: DisplayState) => BankTransaction[] | undefined;
3347
3359
  export const appplyDateRangeFilter: (data?: BankTransaction[], filter?: Partial<DateRange>) => BankTransaction[] | undefined;
3348
3360
 
3349
3361
  }
@@ -4029,6 +4041,8 @@ declare module '@layerfi/components/index' {
4029
4041
  export { ProfitAndLossView } from '@layerfi/components/components/ProfitAndLossView/index';
4030
4042
  export { useLayerContext } from '@layerfi/components/contexts/LayerContext/index';
4031
4043
  export { useBankTransactionsContext } from '@layerfi/components/contexts/BankTransactionsContext/index';
4044
+ export { BankTransactionsProvider } from '@layerfi/components/providers/BankTransactionsProvider/index';
4045
+ export { DisplayState } from '@layerfi/components/types/bank_transactions';
4032
4046
 
4033
4047
  }
4034
4048
  declare module '@layerfi/components/models/APIError' {
@@ -4177,6 +4191,10 @@ declare module '@layerfi/components/types/bank_transactions' {
4177
4191
  export enum BankTransactionMatchType {
4178
4192
  CONFIRM_MATCH = "Confirm_Match"
4179
4193
  }
4194
+ export enum DisplayState {
4195
+ review = "review",
4196
+ categorized = "categorized"
4197
+ }
4180
4198
  export interface BankTransaction extends Record<string, unknown> {
4181
4199
  type: 'Bank_Transaction';
4182
4200
  account_name?: string;
@@ -4270,10 +4288,6 @@ declare module '@layerfi/components/types/categories' {
4270
4288
  JOURNALING = "JOURNALING",
4271
4289
  MATCHED = "MATCHED"
4272
4290
  }
4273
- export enum CategorizationScope {
4274
- TO_REVIEW = "TO_REVIEW",
4275
- CATEGORIZED = "CATEGORIZED"
4276
- }
4277
4291
  export interface CategoryEntry {
4278
4292
  amount?: number;
4279
4293
  category: Category;
@@ -4758,6 +4772,7 @@ declare module '@layerfi/components/types/linked_accounts' {
4758
4772
  connection_external_id?: string;
4759
4773
  connection_needs_repair_as_of: string | null;
4760
4774
  requires_user_confirmation_as_of: string | null;
4775
+ is_syncing: boolean;
4761
4776
  }
4762
4777
  export type PublicToken = {
4763
4778
  public_token: string;
@@ -4798,6 +4813,8 @@ declare module '@layerfi/components/types/profit_and_loss' {
4798
4813
  totalExpenses: number;
4799
4814
  uncategorizedInflows: number;
4800
4815
  uncategorizedOutflows: number;
4816
+ operatingExpensesInverse?: number;
4817
+ uncategorizedOutflowsInverse?: number;
4801
4818
  }
4802
4819
  export interface ProfitAndLossSummaries {
4803
4820
  type: 'Profit_And_Loss_Summaries';
@@ -4897,8 +4914,8 @@ declare module '@layerfi/components/types' {
4897
4914
  export { LineItem } from '@layerfi/components/types/line_item';
4898
4915
  export { BalanceSheet } from '@layerfi/components/types/balance_sheet';
4899
4916
  export { StatementOfCashFlow } from '@layerfi/components/types/statement_of_cash_flow';
4900
- export { Direction, BankTransaction } from '@layerfi/components/types/bank_transactions';
4901
- export { CategorizationStatus, CategorizationScope, Category, CategorizationType, AutoCategorization, SuggestedCategorization, SingleCategoryUpdate, SplitCategoryUpdate, CategoryUpdate, } from '@layerfi/components/types/categories';
4917
+ export { Direction, BankTransaction, DisplayState } from '@layerfi/components/types/bank_transactions';
4918
+ export { CategorizationStatus, Category, CategorizationType, AutoCategorization, SuggestedCategorization, SingleCategoryUpdate, SplitCategoryUpdate, CategoryUpdate, } from '@layerfi/components/types/categories';
4902
4919
  export { ChartOfAccounts, Account, NewAccount, EditAccount, } from '@layerfi/components/types/chart_of_accounts';
4903
4920
  export { LedgerAccountLineItems as LedgerAccounts, LedgerAccountLineItem, LedgerAccountsAccount, LedgerAccountsEntry, } from '@layerfi/components/types/ledger_accounts';
4904
4921
  export { SortDirection } from '@layerfi/components/types/general';
@@ -4924,7 +4941,7 @@ declare module '@layerfi/components/utils/bankTransactions' {
4924
4941
  export const hasMatch: (bankTransaction?: BankTransaction) => boolean;
4925
4942
  export const isCredit: ({ direction }: Pick<BankTransaction, 'direction'>) => boolean;
4926
4943
  export const isAlreadyMatched: (bankTransaction?: BankTransaction) => string | undefined;
4927
- export const countTransactionsToReview: ({ transactions, dateRange }: {
4944
+ export const countTransactionsToReview: ({ transactions, dateRange, }: {
4928
4945
  transactions?: BankTransaction[] | undefined;
4929
4946
  dateRange?: DateRange | undefined;
4930
4947
  }) => number;