@layerfi/components 0.1.9 → 0.1.10

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
@@ -88,7 +88,7 @@ declare module '@layerfi/components/api/layer/categories' {
88
88
 
89
89
  }
90
90
  declare module '@layerfi/components/api/layer/ledger_accounts' {
91
- import { AccountAlternate, LedgerAccounts, NewAccount } from '@layerfi/components/types';
91
+ import { Account, LedgerAccounts, NewAccount, EditAccount } from '@layerfi/components/types';
92
92
  export const getLedgerAccounts: (baseUrl: string, accessToken: string | undefined, options?: {
93
93
  params?: Record<string, string | undefined> | undefined;
94
94
  } | undefined) => () => Promise<{
@@ -98,7 +98,22 @@ declare module '@layerfi/components/api/layer/ledger_accounts' {
98
98
  params?: Record<string, string | undefined> | undefined;
99
99
  body?: NewAccount | undefined;
100
100
  } | undefined) => Promise<{
101
- data: AccountAlternate;
101
+ data: Account;
102
+ }>;
103
+ export const updateAccount: (baseUrl: string, accessToken: string | undefined, options?: {
104
+ params?: Record<string, string | undefined> | undefined;
105
+ body?: EditAccount | undefined;
106
+ } | undefined) => Promise<{
107
+ data: Account;
108
+ }>;
109
+
110
+ }
111
+ declare module '@layerfi/components/api/layer/linked_accounts' {
112
+ import { LinkedAccounts } from '@layerfi/components/types/linked_accounts';
113
+ export const getLinkedAccounts: (baseUrl: string, accessToken: string | undefined, options?: {
114
+ params?: Record<string, string | undefined> | undefined;
115
+ } | undefined) => () => Promise<{
116
+ data: LinkedAccounts;
102
117
  }>;
103
118
 
104
119
  }
@@ -141,7 +156,13 @@ declare module '@layerfi/components/api/layer' {
141
156
  params?: Record<string, string | undefined> | undefined;
142
157
  body?: import("@layerfi/components/types").NewAccount | undefined;
143
158
  } | undefined) => Promise<{
144
- data: import("@layerfi/components/types").AccountAlternate;
159
+ data: import("@layerfi/components/types").Account;
160
+ }>;
161
+ updateAccount: (baseUrl: string, accessToken: string | undefined, options?: {
162
+ params?: Record<string, string | undefined> | undefined;
163
+ body?: import("@layerfi/components/types").EditAccount | undefined;
164
+ } | undefined) => Promise<{
165
+ data: import("@layerfi/components/types").Account;
145
166
  }>;
146
167
  getBalanceSheet: (_token: string, _params: {
147
168
  params: import("@layerfi/components/api/layer/balance_sheet").GetBalanceSheetParams;
@@ -168,6 +189,11 @@ declare module '@layerfi/components/api/layer' {
168
189
  data?: import("@layerfi/components/types").ProfitAndLoss | undefined;
169
190
  error?: unknown;
170
191
  }>;
192
+ getLinkedAccounts: (baseUrl: string, accessToken: string | undefined, options?: {
193
+ params?: Record<string, string | undefined> | undefined;
194
+ } | undefined) => () => Promise<{
195
+ data: import("@layerfi/components/types/linked_accounts").LinkedAccounts;
196
+ }>;
171
197
  };
172
198
 
173
199
  }
@@ -284,11 +310,12 @@ declare module '@layerfi/components/components/BankTransactionRow/BankTransactio
284
310
  editable: boolean;
285
311
  removeTransaction: (id: string) => void;
286
312
  containerWidth?: number;
313
+ initialLoad?: boolean;
287
314
  };
288
315
  export type LastSubmittedForm = 'simple' | 'match' | 'split' | undefined;
289
316
  export const extractDescriptionForSplit: (category: Category) => string;
290
317
  export const getDefaultSelectedCategory: (bankTransaction: BankTransaction) => import("@layerfi/components/components/CategorySelect/CategorySelect").CategoryOption | undefined;
291
- export const BankTransactionRow: ({ index, dateFormat, bankTransaction, editable, removeTransaction, containerWidth, }: Props) => React.JSX.Element | null;
318
+ export const BankTransactionRow: ({ index, dateFormat, bankTransaction, editable, removeTransaction, containerWidth, initialLoad, }: Props) => React.JSX.Element | null;
292
319
  export {};
293
320
 
294
321
  }
@@ -322,13 +349,22 @@ declare module '@layerfi/components/components/BankTransactions/BankTransactions
322
349
  export interface BankTransactionsProps {
323
350
  asWidget?: boolean;
324
351
  pageSize?: number;
352
+ categorizedOnly?: boolean;
325
353
  }
326
- export const BankTransactions: ({ asWidget, pageSize, }: BankTransactionsProps) => React.JSX.Element;
354
+ export const BankTransactions: ({ asWidget, pageSize, categorizedOnly, }: BankTransactionsProps) => React.JSX.Element;
327
355
 
328
356
  }
329
357
  declare module '@layerfi/components/components/BankTransactions/index' {
330
358
  export { BankTransactions } from '@layerfi/components/components/BankTransactions/BankTransactions';
331
359
 
360
+ }
361
+ declare module '@layerfi/components/components/Button/BackButton' {
362
+ import React, { ButtonHTMLAttributes } from 'react';
363
+ export interface BackButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
364
+ textOnly?: boolean;
365
+ }
366
+ export const BackButton: ({ className, children, textOnly, ...props }: BackButtonProps) => React.JSX.Element;
367
+
332
368
  }
333
369
  declare module '@layerfi/components/components/Button/Button' {
334
370
  import React, { ButtonHTMLAttributes, ReactNode } from 'react';
@@ -397,25 +433,7 @@ declare module '@layerfi/components/components/Button/index' {
397
433
  export { RetryButton } from '@layerfi/components/components/Button/RetryButton';
398
434
  export { SubmitButton } from '@layerfi/components/components/Button/SubmitButton';
399
435
  export { TextButton } from '@layerfi/components/components/Button/TextButton';
400
-
401
- }
402
- declare module '@layerfi/components/components/CategoryMenu/CategoryMenu' {
403
- import React from 'react';
404
- import { BankTransaction, Category } from '@layerfi/components/types';
405
- type Props = {
406
- name?: string;
407
- bankTransaction: BankTransaction;
408
- value: Category | undefined;
409
- onChange: (newValue: Category) => void;
410
- disabled?: boolean;
411
- className?: string;
412
- };
413
- export const CategoryMenu: ({ bankTransaction, name, value, onChange, disabled, className, }: Props) => React.JSX.Element;
414
- export {};
415
-
416
- }
417
- declare module '@layerfi/components/components/CategoryMenu/index' {
418
- export { CategoryMenu } from '@layerfi/components/components/CategoryMenu/CategoryMenu';
436
+ export { BackButton } from '@layerfi/components/components/Button/BackButton';
419
437
 
420
438
  }
421
439
  declare module '@layerfi/components/components/CategorySelect/CategorySelect' {
@@ -526,6 +544,7 @@ declare module '@layerfi/components/components/ExpandedBankTransactionRow/Expand
526
544
  type Props = {
527
545
  bankTransaction: BankTransaction;
528
546
  isOpen?: boolean;
547
+ close: () => void;
529
548
  asListItem?: boolean;
530
549
  submitBtnText?: string;
531
550
  containerWidth?: number;
@@ -554,6 +573,22 @@ declare module '@layerfi/components/components/Hello/Hello' {
554
573
  declare module '@layerfi/components/components/Hello/index' {
555
574
  export { Hello } from '@layerfi/components/components/Hello/Hello';
556
575
 
576
+ }
577
+ declare module '@layerfi/components/components/HoverMenu/HoverMenu' {
578
+ import React, { ReactNode } from 'react';
579
+ export interface HoverMenuProps {
580
+ children: ReactNode;
581
+ config: {
582
+ name: string;
583
+ action: () => void;
584
+ }[];
585
+ }
586
+ export const HoverMenu: ({ children, config }: HoverMenuProps) => React.JSX.Element;
587
+
588
+ }
589
+ declare module '@layerfi/components/components/HoverMenu/index' {
590
+ export { HoverMenu, HoverMenuProps } from '@layerfi/components/components/HoverMenu/HoverMenu';
591
+
557
592
  }
558
593
  declare module '@layerfi/components/components/Input/FileInput' {
559
594
  import React from 'react';
@@ -620,6 +655,8 @@ declare module '@layerfi/components/components/LedgerAccounts/LedgerAccounts' {
620
655
  refetch: () => void;
621
656
  create: (newAccount: import("@layerfi/components/types").NewAccount) => void;
622
657
  form?: import("@layerfi/components/hooks/useLedgerAccounts/useLedgerAccounts").LedgerAccountsForm | undefined;
658
+ sendingForm?: boolean | undefined;
659
+ apiError?: string | undefined;
623
660
  addAccount: () => void;
624
661
  editAccount: (id: string) => void;
625
662
  cancelForm: () => void;
@@ -650,8 +687,13 @@ declare module '@layerfi/components/components/LedgerAccountsRow/LedgerAccountsR
650
687
  type LedgerAccountsRowProps = {
651
688
  account: Account;
652
689
  depth?: number;
690
+ index: number;
691
+ cumulativeIndex?: number;
692
+ expanded: boolean;
693
+ acountsLength: number;
694
+ defaultOpen?: boolean;
653
695
  };
654
- export const LedgerAccountsRow: ({ account, depth, }: LedgerAccountsRowProps) => React.JSX.Element;
696
+ export const LedgerAccountsRow: ({ account, depth, index, cumulativeIndex, expanded, defaultOpen, acountsLength, }: LedgerAccountsRowProps) => React.JSX.Element;
655
697
  export {};
656
698
 
657
699
  }
@@ -668,18 +710,38 @@ declare module '@layerfi/components/components/LedgerAccountsSidebar/index' {
668
710
  export { LedgerAccountsSidebar } from '@layerfi/components/components/LedgerAccountsSidebar/LedgerAccountsSidebar';
669
711
 
670
712
  }
671
- declare module '@layerfi/components/components/LinkedAccounts/LinkedAccountThumb' {
713
+ declare module '@layerfi/components/components/LinkedAccountOptions/LinkedAccountOptions' {
714
+ import React from 'react';
715
+ import { HoverMenuProps } from '@layerfi/components/components/HoverMenu/index';
716
+ interface LinkedAccountOptionsProps extends HoverMenuProps {
717
+ }
718
+ export const LinkedAccountOptions: ({ children, config, }: LinkedAccountOptionsProps) => React.JSX.Element;
719
+ export {};
720
+
721
+ }
722
+ declare module '@layerfi/components/components/LinkedAccountOptions/index' {
723
+ export { LinkedAccountOptions } from '@layerfi/components/components/LinkedAccountOptions/LinkedAccountOptions';
724
+
725
+ }
726
+ declare module '@layerfi/components/components/LinkedAccountThumb/LinkedAccountThumb' {
672
727
  import React from 'react';
673
728
  import { LinkedAccount } from '@layerfi/components/types/linked_accounts';
674
729
  export interface LinkedAccountThumbProps {
675
730
  account: LinkedAccount;
731
+ asWidget?: boolean;
676
732
  }
677
- export const LinkedAccountThumb: ({ account }: LinkedAccountThumbProps) => React.JSX.Element;
733
+ export const LinkedAccountThumb: ({ account, asWidget, }: LinkedAccountThumbProps) => React.JSX.Element;
734
+
735
+ }
736
+ declare module '@layerfi/components/components/LinkedAccountThumb/index' {
737
+ export { LinkedAccountThumb } from '@layerfi/components/components/LinkedAccountThumb/LinkedAccountThumb';
678
738
 
679
739
  }
680
740
  declare module '@layerfi/components/components/LinkedAccounts/LinkedAccounts' {
681
741
  import React from 'react';
682
- export const LinkedAccounts: () => React.JSX.Element;
742
+ export const LinkedAccounts: ({ asWidget }: {
743
+ asWidget?: boolean | undefined;
744
+ }) => React.JSX.Element;
683
745
 
684
746
  }
685
747
  declare module '@layerfi/components/components/LinkedAccounts/index' {
@@ -1337,6 +1399,10 @@ declare module '@layerfi/components/hooks/useLedgerAccounts/index' {
1337
1399
  declare module '@layerfi/components/hooks/useLedgerAccounts/useLedgerAccounts' {
1338
1400
  import { Account, LedgerAccounts, NewAccount } from '@layerfi/components/types';
1339
1401
  import { BaseSelectOption } from '@layerfi/components/types/general';
1402
+ interface FormError {
1403
+ field: string;
1404
+ message: string;
1405
+ }
1340
1406
  export interface LedgerAccountsForm {
1341
1407
  action: 'new' | 'edit';
1342
1408
  accountId?: string;
@@ -1347,6 +1413,7 @@ declare module '@layerfi/components/hooks/useLedgerAccounts/useLedgerAccounts' {
1347
1413
  subType?: BaseSelectOption;
1348
1414
  category?: BaseSelectOption;
1349
1415
  };
1416
+ errors?: FormError[];
1350
1417
  }
1351
1418
  type UseLedgerAccounts = () => {
1352
1419
  data: LedgerAccounts | undefined;
@@ -1356,6 +1423,8 @@ declare module '@layerfi/components/hooks/useLedgerAccounts/useLedgerAccounts' {
1356
1423
  refetch: () => void;
1357
1424
  create: (newAccount: NewAccount) => void;
1358
1425
  form?: LedgerAccountsForm;
1426
+ sendingForm?: boolean;
1427
+ apiError?: string;
1359
1428
  addAccount: () => void;
1360
1429
  editAccount: (id: string) => void;
1361
1430
  cancelForm: () => void;
@@ -1374,15 +1443,16 @@ declare module '@layerfi/components/hooks/useLinkedAccounts/index' {
1374
1443
 
1375
1444
  }
1376
1445
  declare module '@layerfi/components/hooks/useLinkedAccounts/useLinkedAccounts' {
1377
- import { Metadata } from '@layerfi/components/types';
1378
1446
  import { LinkedAccount } from '@layerfi/components/types/linked_accounts';
1379
1447
  type UseLinkedAccounts = () => {
1380
1448
  data?: LinkedAccount[];
1381
- metadata: Metadata;
1382
1449
  isLoading: boolean;
1383
1450
  isValidating: boolean;
1384
1451
  error: unknown;
1385
1452
  refetch: () => void;
1453
+ addAccount: () => void;
1454
+ unlinkAccount: () => void;
1455
+ renewLinkAccount: () => void;
1386
1456
  };
1387
1457
  export const useLinkedAccounts: UseLinkedAccounts;
1388
1458
  export {};
@@ -1468,6 +1538,13 @@ declare module '@layerfi/components/icons/ArrowRightCircle' {
1468
1538
  const ArrowRightCircle: ({ size, ...props }: IconSvgProps) => React.JSX.Element;
1469
1539
  export default ArrowRightCircle;
1470
1540
 
1541
+ }
1542
+ declare module '@layerfi/components/icons/BackArrow' {
1543
+ import * as React from 'react';
1544
+ import { IconSvgProps } from '@layerfi/components/icons/types';
1545
+ const BackArrow: ({ size, ...props }: IconSvgProps) => React.JSX.Element;
1546
+ export default BackArrow;
1547
+
1471
1548
  }
1472
1549
  declare module '@layerfi/components/icons/Calendar' {
1473
1550
  import * as React from 'react';
@@ -1531,6 +1608,13 @@ declare module '@layerfi/components/icons/Edit2' {
1531
1608
  const Edit2: ({ size, ...props }: IconSvgProps) => React.JSX.Element;
1532
1609
  export default Edit2;
1533
1610
 
1611
+ }
1612
+ declare module '@layerfi/components/icons/InstitutionIcon' {
1613
+ import * as React from 'react';
1614
+ import { IconSvgProps } from '@layerfi/components/icons/types';
1615
+ const InstitutionIcon: ({ size, ...props }: IconSvgProps) => React.JSX.Element;
1616
+ export default InstitutionIcon;
1617
+
1534
1618
  }
1535
1619
  declare module '@layerfi/components/icons/Loader' {
1536
1620
  import * as React from 'react';
@@ -1545,6 +1629,13 @@ declare module '@layerfi/components/icons/MinimizeTwo' {
1545
1629
  const MinimizeTwo: ({ size, ...props }: IconSvgProps) => React.JSX.Element;
1546
1630
  export default MinimizeTwo;
1547
1631
 
1632
+ }
1633
+ declare module '@layerfi/components/icons/MoreVertical' {
1634
+ import React from 'react';
1635
+ import { IconSvgProps } from '@layerfi/components/icons/types';
1636
+ const MoreVertical: ({ size, ...props }: IconSvgProps) => React.JSX.Element;
1637
+ export default MoreVertical;
1638
+
1548
1639
  }
1549
1640
  declare module '@layerfi/components/icons/PieChart' {
1550
1641
  import * as React from 'react';
@@ -1552,6 +1643,13 @@ declare module '@layerfi/components/icons/PieChart' {
1552
1643
  const PieChart: ({ size, ...props }: IconSvgProps) => React.JSX.Element;
1553
1644
  export default PieChart;
1554
1645
 
1646
+ }
1647
+ declare module '@layerfi/components/icons/PlusIcon' {
1648
+ import * as React from 'react';
1649
+ import { IconSvgProps } from '@layerfi/components/icons/types';
1650
+ const PlusIcon: ({ size, ...props }: IconSvgProps) => React.JSX.Element;
1651
+ export default PlusIcon;
1652
+
1555
1653
  }
1556
1654
  declare module '@layerfi/components/icons/RefreshCcw' {
1557
1655
  import * as React from 'react';
@@ -1912,8 +2010,9 @@ declare module '@layerfi/components/types/ledger_accounts' {
1912
2010
  import { Direction } from '@layerfi/components/types/bank_transactions';
1913
2011
  import { Category } from '@layerfi/components/types/categories';
1914
2012
  export interface LedgerAccounts {
1915
- name: string;
2013
+ type: string;
1916
2014
  accounts: Account[];
2015
+ entries?: any[];
1917
2016
  }
1918
2017
  export interface AccountEntry {
1919
2018
  account: Account;
@@ -1942,16 +2041,18 @@ declare module '@layerfi/components/types/ledger_accounts' {
1942
2041
  selfOnlyBalance: number;
1943
2042
  entries?: AccountEntry[];
1944
2043
  }
1945
- export interface AccountAlternate {
1946
- type: 'Ledger_Account';
1947
- id: string;
2044
+ export type NewAccount = {
1948
2045
  name: string;
1949
- stable_name: string | null;
1950
2046
  normality: Direction;
1951
- pnl_category: string | null;
1952
- }
1953
- export type NewAccount = {
2047
+ parent_id?: {
2048
+ type: 'AccountId';
2049
+ id: string;
2050
+ };
2051
+ description: string;
2052
+ };
2053
+ export type EditAccount = {
1954
2054
  name: string;
2055
+ stable_name: string;
1955
2056
  normality: Direction;
1956
2057
  parent_id?: {
1957
2058
  type: 'AccountId';
@@ -1980,10 +2081,24 @@ declare module '@layerfi/components/types/line_item' {
1980
2081
 
1981
2082
  }
1982
2083
  declare module '@layerfi/components/types/linked_accounts' {
2084
+ export interface LinkedAccounts {
2085
+ type: string;
2086
+ external_accounts: LinkedAccount[];
2087
+ }
1983
2088
  export interface LinkedAccount {
1984
- name: string;
1985
- account: string;
1986
- amount: number;
2089
+ id: string;
2090
+ external_account_name: string;
2091
+ external_account_number: string;
2092
+ latest_balance_timestamp: {
2093
+ external_account_external_id: string;
2094
+ external_account_source: string;
2095
+ balance: number;
2096
+ at: string;
2097
+ created_at: string;
2098
+ };
2099
+ current_ledger_balance: number;
2100
+ institution: string;
2101
+ institutionLogo: string;
1987
2102
  }
1988
2103
 
1989
2104
  }
@@ -2016,7 +2131,7 @@ declare module '@layerfi/components/types' {
2016
2131
  export { BalanceSheet } from '@layerfi/components/types/balance_sheet';
2017
2132
  export { Direction, BankTransaction } from '@layerfi/components/types/bank_transactions';
2018
2133
  export { CategorizationStatus, Category, CategorizationType, AutoCategorization, SuggestedCategorization, SingleCategoryUpdate, SplitCategoryUpdate, CategoryUpdate, } from '@layerfi/components/types/categories';
2019
- export { AccountAlternate, LedgerAccounts, Account, NewAccount, } from '@layerfi/components/types/ledger_accounts';
2134
+ export { LedgerAccounts, Account, NewAccount, EditAccount, } from '@layerfi/components/types/ledger_accounts';
2020
2135
  export { SortDirection } from '@layerfi/components/types/general';
2021
2136
  export type DateRange<T = Date> = {
2022
2137
  startDate: T;
@@ -2059,6 +2174,10 @@ declare module '@layerfi/components/utils/helpers' {
2059
2174
  export const range: (start: number, end: number) => number[];
2060
2175
  export const debounce: <F extends (...args: Parameters<F>) => ReturnType<F>>(fnc: F, timeout?: number) => (...args: Parameters<F>) => void;
2061
2176
  export const sleep: (time: number) => Promise<unknown>;
2177
+ /**
2178
+ * Convert the account name into stable_name
2179
+ */
2180
+ export const convertToStableName: (name: string) => string;
2062
2181
 
2063
2182
  }
2064
2183
  declare module '@layerfi/components/utils/profitAndLossUtils' {