@layerfi/components 0.1.29 → 0.1.31

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
@@ -31,6 +31,7 @@ declare module '@layerfi/components/api/layer/authenticated_http' {
31
31
  params?: Params | undefined;
32
32
  body?: Body_1 | undefined;
33
33
  } | undefined) => Promise<Return>;
34
+ export const postWithFormData: <Return extends Record<string, unknown> = Record<string, unknown>>(url: string, formData: FormData, baseUrl: string, accessToken: string | undefined) => Promise<Return>;
34
35
 
35
36
  }
36
37
  declare module '@layerfi/components/api/layer/balance_sheet' {
@@ -46,7 +47,7 @@ declare module '@layerfi/components/api/layer/balance_sheet' {
46
47
  }
47
48
  declare module '@layerfi/components/api/layer/bankTransactions' {
48
49
  import { CategoryUpdate, BankTransaction, Metadata } from '@layerfi/components/types';
49
- import { BankTransactionMatch, BankTransactionMatchType } from '@layerfi/components/types/bank_transactions';
50
+ import { BankTransactionMatch, BankTransactionMatchType, BankTransactionMetadata, DocumentS3Urls, FileMetadata } from '@layerfi/components/types/bank_transactions';
50
51
  import { S3PresignedUrl } from '@layerfi/components/types/general';
51
52
  export type GetBankTransactionsReturn = {
52
53
  data?: BankTransaction[];
@@ -93,6 +94,36 @@ declare module '@layerfi/components/api/layer/bankTransactions' {
93
94
  data?: S3PresignedUrl | undefined;
94
95
  error?: unknown;
95
96
  }>;
97
+ export const getBankTransactionMetadata: (baseUrl: string, accessToken: string | undefined, options?: {
98
+ params?: Record<string, string | undefined> | undefined;
99
+ } | undefined) => () => Promise<{
100
+ data: BankTransactionMetadata;
101
+ errors: unknown;
102
+ }>;
103
+ export const updateBankTransactionMetadata: (baseUrl: string, accessToken: string | undefined, options?: {
104
+ params?: Record<string, string | undefined> | undefined;
105
+ body?: {
106
+ memo: string;
107
+ } | undefined;
108
+ } | undefined) => Promise<{
109
+ data: BankTransactionMetadata;
110
+ errors: unknown;
111
+ }>;
112
+ export const listBankTransactionDocuments: (baseUrl: string, accessToken: string | undefined, options?: {
113
+ params?: Record<string, string | undefined> | undefined;
114
+ } | undefined) => () => Promise<{
115
+ data: DocumentS3Urls;
116
+ errors: unknown;
117
+ }>;
118
+ export const uploadBankTransactionDocument: (baseUrl: string, accessToken: string) => ({ businessId, bankTransactionId, file, documentType, }: {
119
+ businessId: string;
120
+ bankTransactionId: string;
121
+ file: File;
122
+ documentType: string;
123
+ }) => Promise<{
124
+ data: FileMetadata;
125
+ errors: unknown;
126
+ }>;
96
127
 
97
128
  }
98
129
  declare module '@layerfi/components/api/layer/business' {
@@ -364,6 +395,36 @@ declare module '@layerfi/components/api/layer' {
364
395
  data?: import("@layerfi/components/types/general").S3PresignedUrl | undefined;
365
396
  error?: unknown;
366
397
  }>;
398
+ getBankTransactionMetadata: (baseUrl: string, accessToken: string | undefined, options?: {
399
+ params?: Record<string, string | undefined> | undefined;
400
+ } | undefined) => () => Promise<{
401
+ data: import("@layerfi/components/types/bank_transactions").BankTransactionMetadata;
402
+ errors: unknown;
403
+ }>;
404
+ listBankTransactionDocuments: (baseUrl: string, accessToken: string | undefined, options?: {
405
+ params?: Record<string, string | undefined> | undefined;
406
+ } | undefined) => () => Promise<{
407
+ data: import("@layerfi/components/types/bank_transactions").DocumentS3Urls;
408
+ errors: unknown;
409
+ }>;
410
+ updateBankTransactionMetadata: (baseUrl: string, accessToken: string | undefined, options?: {
411
+ params?: Record<string, string | undefined> | undefined;
412
+ body?: {
413
+ memo: string;
414
+ } | undefined;
415
+ } | undefined) => Promise<{
416
+ data: import("@layerfi/components/types/bank_transactions").BankTransactionMetadata;
417
+ errors: unknown;
418
+ }>;
419
+ uploadBankTransactionDocument: (baseUrl: string, accessToken: string) => ({ businessId, bankTransactionId, file, documentType, }: {
420
+ businessId: string;
421
+ bankTransactionId: string;
422
+ file: File;
423
+ documentType: string;
424
+ }) => Promise<{
425
+ data: import("@layerfi/components/types/bank_transactions").FileMetadata;
426
+ errors: unknown;
427
+ }>;
367
428
  getCategories: (baseUrl: string, accessToken: string | undefined, options?: {
368
429
  params?: Record<string, string | undefined> | undefined;
369
430
  } | undefined) => () => Promise<{
@@ -1738,9 +1799,11 @@ declare module '@layerfi/components/components/LinkedAccounts/LinkedAccounts' {
1738
1799
  asWidget?: boolean;
1739
1800
  elevated?: boolean;
1740
1801
  showLedgerBalance?: boolean;
1802
+ showUnlinkItem?: boolean;
1803
+ showBreakConnection?: boolean;
1741
1804
  }
1742
1805
  export const LinkedAccounts: (props: LinkedAccountsProps) => React.JSX.Element;
1743
- export const LinkedAccountsComponent: ({ asWidget, elevated, showLedgerBalance, }: LinkedAccountsProps) => React.JSX.Element;
1806
+ export const LinkedAccountsComponent: ({ asWidget, elevated, showLedgerBalance, showUnlinkItem, showBreakConnection, }: LinkedAccountsProps) => React.JSX.Element;
1744
1807
 
1745
1808
  }
1746
1809
  declare module '@layerfi/components/components/LinkedAccounts/LinkedAccountsContent' {
@@ -1748,8 +1811,10 @@ declare module '@layerfi/components/components/LinkedAccounts/LinkedAccountsCont
1748
1811
  interface LinkedAccountsDataProps {
1749
1812
  asWidget?: boolean;
1750
1813
  showLedgerBalance?: boolean;
1814
+ showUnlinkItem?: boolean;
1815
+ showBreakConnection?: boolean;
1751
1816
  }
1752
- export const LinkedAccountsContent: ({ asWidget, showLedgerBalance, }: LinkedAccountsDataProps) => React.JSX.Element;
1817
+ export const LinkedAccountsContent: ({ asWidget, showLedgerBalance, showUnlinkItem, showBreakConnection, }: LinkedAccountsDataProps) => React.JSX.Element;
1753
1818
  export {};
1754
1819
 
1755
1820
  }
@@ -1816,7 +1881,7 @@ declare module '@layerfi/components/components/Onboarding/ConnectAccount' {
1816
1881
  onTransactionsToReviewClick?: () => void;
1817
1882
  currentMonthOnly?: boolean;
1818
1883
  }
1819
- export const ConnectAccount: ({ onboardingStep, onTransactionsToReviewClick, currentMonthOnly, }: ConnectAccountProps) => React.JSX.Element;
1884
+ export const ConnectAccount: ({ onboardingStep, onTransactionsToReviewClick, }: ConnectAccountProps) => React.JSX.Element;
1820
1885
 
1821
1886
  }
1822
1887
  declare module '@layerfi/components/components/Onboarding/Onboarding' {
@@ -2415,9 +2480,9 @@ declare module '@layerfi/components/components/TransactionToReviewCard/Transacti
2415
2480
  import React from 'react';
2416
2481
  export interface TransactionToReviewCardProps {
2417
2482
  onClick?: () => void;
2418
- currentMonthOnly?: true;
2483
+ usePnlDateRange?: boolean;
2419
2484
  }
2420
- export const TransactionToReviewCard: ({ onClick, currentMonthOnly, }: TransactionToReviewCardProps) => React.JSX.Element;
2485
+ export const TransactionToReviewCard: ({ onClick, usePnlDateRange, }: TransactionToReviewCardProps) => React.JSX.Element;
2421
2486
 
2422
2487
  }
2423
2488
  declare module '@layerfi/components/components/TransactionToReviewCard/index' {
@@ -2701,7 +2766,7 @@ declare module '@layerfi/components/contexts/JournalContext/JournalContext' {
2701
2766
  selectedEntryId?: string | undefined;
2702
2767
  setSelectedEntryId: (id?: string | undefined) => void;
2703
2768
  closeSelectedEntry: () => void;
2704
- create: (newJournalEntry: import("@layerfi/components/types/journal").NewJournalEntry) => void;
2769
+ create: (newJournalEntry: import("@layerfi/components/types/journal").NewApiJournalEntry) => void;
2705
2770
  changeFormData: (name: string, value: string | number | import("@layerfi/components/types/general").BaseSelectOption | undefined, lineItemIndex?: number | undefined, accounts?: import("../../types/chart_of_accounts").LedgerAccountBalance[] | undefined) => void;
2706
2771
  submitForm: () => void;
2707
2772
  cancelForm: () => void;
@@ -2974,7 +3039,7 @@ declare module '@layerfi/components/hooks/useJournal/useJournal' {
2974
3039
  import { Direction, FormError, FormErrorWithId } from '@layerfi/components/types';
2975
3040
  import { LedgerAccountBalance } from '@layerfi/components/types/chart_of_accounts';
2976
3041
  import { BaseSelectOption } from '@layerfi/components/types/general';
2977
- import { JournalEntry, NewJournalEntry } from '@layerfi/components/types/journal';
3042
+ import { JournalEntry, NewApiJournalEntry, NewFormJournalEntry } from '@layerfi/components/types/journal';
2978
3043
  type UseJournal = () => {
2979
3044
  data?: JournalEntry[];
2980
3045
  isLoading?: boolean;
@@ -2987,7 +3052,7 @@ declare module '@layerfi/components/hooks/useJournal/useJournal' {
2987
3052
  selectedEntryId?: string;
2988
3053
  setSelectedEntryId: (id?: string) => void;
2989
3054
  closeSelectedEntry: () => void;
2990
- create: (newJournalEntry: NewJournalEntry) => void;
3055
+ create: (newJournalEntry: NewApiJournalEntry) => void;
2991
3056
  changeFormData: (name: string, value: string | BaseSelectOption | undefined | number, lineItemIndex?: number, accounts?: LedgerAccountBalance[] | undefined) => void;
2992
3057
  submitForm: () => void;
2993
3058
  cancelForm: () => void;
@@ -3001,7 +3066,7 @@ declare module '@layerfi/components/hooks/useJournal/useJournal' {
3001
3066
  };
3002
3067
  export interface JournalFormTypes {
3003
3068
  action: string;
3004
- data: NewJournalEntry;
3069
+ data: NewFormJournalEntry;
3005
3070
  errors?: {
3006
3071
  entry: FormError[];
3007
3072
  lineItems: FormErrorWithId[];
@@ -3614,6 +3679,7 @@ declare module '@layerfi/components/types/balance_sheet' {
3614
3679
  }
3615
3680
  declare module '@layerfi/components/types/bank_transactions' {
3616
3681
  import { Categorization, CategorizationStatus, Category } from '@layerfi/components/types/categories';
3682
+ import { S3PresignedUrl } from "@layerfi/components/types/general";
3617
3683
  export enum Direction {
3618
3684
  CREDIT = "CREDIT",
3619
3685
  DEBIT = "DEBIT"
@@ -3668,6 +3734,20 @@ declare module '@layerfi/components/types/bank_transactions' {
3668
3734
  type: string;
3669
3735
  };
3670
3736
  }
3737
+ export interface BankTransactionMetadata {
3738
+ memo: string | null;
3739
+ }
3740
+ export interface DocumentS3Urls {
3741
+ type: 'Document_S3_Urls';
3742
+ documentUrls: S3PresignedUrl[];
3743
+ }
3744
+ export interface FileMetadata {
3745
+ type: 'File_Metadata';
3746
+ id: string | null;
3747
+ fileType: string;
3748
+ fileName: string;
3749
+ documentType: string;
3750
+ }
3671
3751
 
3672
3752
  }
3673
3753
  declare module '@layerfi/components/types/business' {
@@ -3732,7 +3812,7 @@ declare module '@layerfi/components/types/categories' {
3732
3812
  suggestions: Category[];
3733
3813
  }
3734
3814
  export type Categorization = AutoCategorization | SuggestedCategorization;
3735
- export type CategoryPayloadObject = {
3815
+ export type AccountIdentifierPayloadObject = {
3736
3816
  type: 'StableName';
3737
3817
  stable_name: string;
3738
3818
  } | {
@@ -3741,12 +3821,12 @@ declare module '@layerfi/components/types/categories' {
3741
3821
  };
3742
3822
  export type SingleCategoryUpdate = {
3743
3823
  type: 'Category';
3744
- category: CategoryPayloadObject;
3824
+ category: AccountIdentifierPayloadObject;
3745
3825
  };
3746
3826
  export type SplitCategoryUpdate = {
3747
3827
  type: 'Split';
3748
3828
  entries: {
3749
- category: string | CategoryPayloadObject;
3829
+ category: string | AccountIdentifierPayloadObject;
3750
3830
  amount: number;
3751
3831
  }[];
3752
3832
  };
@@ -3846,6 +3926,7 @@ declare module '@layerfi/components/types/general' {
3846
3926
  declare module '@layerfi/components/types/journal' {
3847
3927
  import { Account } from '@layerfi/components/types';
3848
3928
  import { Direction } from '@layerfi/components/types/bank_transactions';
3929
+ import { AccountIdentifierPayloadObject } from '@layerfi/components/types/categories';
3849
3930
  import { LedgerEntrySource } from '@layerfi/components/types/ledger_accounts';
3850
3931
  export interface JournalEntry {
3851
3932
  id: string;
@@ -3869,7 +3950,18 @@ declare module '@layerfi/components/types/journal' {
3869
3950
  entry_at: string;
3870
3951
  createdAt: string;
3871
3952
  }
3872
- export type NewJournalEntry = {
3953
+ export type NewApiJournalEntry = {
3954
+ entry_at: string;
3955
+ created_by: string;
3956
+ memo: string;
3957
+ line_items: NewApiJournalEntryLineItem[];
3958
+ };
3959
+ export type NewApiJournalEntryLineItem = {
3960
+ account_identifier: AccountIdentifierPayloadObject;
3961
+ amount: number;
3962
+ direction: Direction;
3963
+ };
3964
+ export type NewFormJournalEntry = {
3873
3965
  entry_at: string;
3874
3966
  created_by: string;
3875
3967
  memo: string;
@@ -4250,13 +4342,13 @@ declare module '@layerfi/components/types' {
4250
4342
  }
4251
4343
  declare module '@layerfi/components/utils/bankTransactions' {
4252
4344
  import { CategoryOption } from '@layerfi/components/components/CategorySelect/CategorySelect';
4253
- import { BankTransaction } from '@layerfi/components/types';
4345
+ import { BankTransaction, DateRange } from '@layerfi/components/types';
4254
4346
  export const hasMatch: (bankTransaction?: BankTransaction) => boolean;
4255
4347
  export const isCredit: ({ direction }: Pick<BankTransaction, 'direction'>) => boolean;
4256
4348
  export const isAlreadyMatched: (bankTransaction?: BankTransaction) => string | undefined;
4257
- export const countTransactionsToReview: ({ transactions, currentMonthOnly, }: {
4349
+ export const countTransactionsToReview: ({ transactions, dateRange }: {
4258
4350
  transactions?: BankTransaction[] | undefined;
4259
- currentMonthOnly?: boolean | undefined;
4351
+ dateRange?: DateRange | undefined;
4260
4352
  }) => number;
4261
4353
  export const getCategorizePayload: (category: CategoryOption) => {
4262
4354
  type: "AccountId";
@@ -4322,6 +4414,12 @@ declare module '@layerfi/components/utils/helpers' {
4322
4414
  */
4323
4415
  export const convertToStableName: (name: string) => string;
4324
4416
 
4417
+ }
4418
+ declare module '@layerfi/components/utils/journal' {
4419
+ import { AccountIdentifierPayloadObject } from '@layerfi/components/types/categories';
4420
+ import { JournalEntryLineItem } from '@layerfi/components/types/journal';
4421
+ export const getAccountIdentifierPayload: (journalLineItem: JournalEntryLineItem) => AccountIdentifierPayloadObject;
4422
+
4325
4423
  }
4326
4424
  declare module '@layerfi/components/utils/profitAndLossUtils' {
4327
4425
  import { SidebarScope } from '@layerfi/components/hooks/useProfitAndLoss/useProfitAndLoss';
@@ -4354,11 +4452,13 @@ declare module '@layerfi/components/views/BankTransactionsWithLinkedAccounts/Ban
4354
4452
  title?: string;
4355
4453
  elevatedLinkedAccounts?: boolean;
4356
4454
  showLedgerBalance?: boolean;
4455
+ showUnlinkItem?: boolean;
4456
+ showBreakConnection?: boolean;
4357
4457
  showDescriptions?: boolean;
4358
4458
  showReceiptUploads?: boolean;
4359
4459
  mobileComponent?: MobileComponentType;
4360
4460
  }
4361
- export const BankTransactionsWithLinkedAccounts: ({ title, elevatedLinkedAccounts, showLedgerBalance, showDescriptions, showReceiptUploads, mobileComponent, }: BankTransactionsWithLinkedAccountsProps) => React.JSX.Element;
4461
+ export const BankTransactionsWithLinkedAccounts: ({ title, elevatedLinkedAccounts, showLedgerBalance, showUnlinkItem, showBreakConnection, showDescriptions, showReceiptUploads, mobileComponent, }: BankTransactionsWithLinkedAccountsProps) => React.JSX.Element;
4362
4462
 
4363
4463
  }
4364
4464
  declare module '@layerfi/components/views/BankTransactionsWithLinkedAccounts/index' {