@layerfi/components 0.1.11 → 0.1.13
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/esm/index.js +462 -127
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +123 -36
- package/dist/index.js +466 -131
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +4 -1
- package/dist/styles/index.css.map +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -92,12 +92,19 @@ declare module '@layerfi/components/api/layer/categories' {
|
|
|
92
92
|
|
|
93
93
|
}
|
|
94
94
|
declare module '@layerfi/components/api/layer/chart_of_accounts' {
|
|
95
|
-
import { Account, ChartOfAccounts, NewAccount, EditAccount,
|
|
95
|
+
import { Account, ChartOfAccounts, NewAccount, EditAccount, LedgerAccountsEntry } from '@layerfi/components/types';
|
|
96
|
+
import { ChartWithBalances } from '@layerfi/components/types/chart_of_accounts';
|
|
97
|
+
import { LedgerAccountLineItems } from '@layerfi/components/types/ledger_accounts';
|
|
96
98
|
export const getChartOfAccounts: (baseUrl: string, accessToken: string | undefined, options?: {
|
|
97
99
|
params?: Record<string, string | undefined> | undefined;
|
|
98
100
|
} | undefined) => () => Promise<{
|
|
99
101
|
data: ChartOfAccounts;
|
|
100
102
|
}>;
|
|
103
|
+
export const getLedgerAccountBalances: (baseUrl: string, accessToken: string | undefined, options?: {
|
|
104
|
+
params?: Record<string, string | undefined> | undefined;
|
|
105
|
+
} | undefined) => () => Promise<{
|
|
106
|
+
data: ChartWithBalances;
|
|
107
|
+
}>;
|
|
101
108
|
export const createAccount: (baseUrl: string, accessToken: string | undefined, options?: {
|
|
102
109
|
params?: Record<string, string | undefined> | undefined;
|
|
103
110
|
body?: NewAccount | undefined;
|
|
@@ -113,7 +120,7 @@ declare module '@layerfi/components/api/layer/chart_of_accounts' {
|
|
|
113
120
|
export const getLedgerAccountsLines: (baseUrl: string, accessToken: string | undefined, options?: {
|
|
114
121
|
params?: Record<string, string | undefined> | undefined;
|
|
115
122
|
} | undefined) => () => Promise<{
|
|
116
|
-
data:
|
|
123
|
+
data: LedgerAccountLineItems;
|
|
117
124
|
}>;
|
|
118
125
|
export const getLedgerAccountsEntry: (baseUrl: string, accessToken: string | undefined, options?: {
|
|
119
126
|
params?: Record<string, string | undefined> | undefined;
|
|
@@ -227,6 +234,11 @@ declare module '@layerfi/components/api/layer' {
|
|
|
227
234
|
} | undefined) => () => Promise<{
|
|
228
235
|
data: import("@layerfi/components/types").ChartOfAccounts;
|
|
229
236
|
}>;
|
|
237
|
+
getLedgerAccountBalances: (baseUrl: string, accessToken: string | undefined, options?: {
|
|
238
|
+
params?: Record<string, string | undefined> | undefined;
|
|
239
|
+
} | undefined) => () => Promise<{
|
|
240
|
+
data: import("@layerfi/components/types/chart_of_accounts").ChartWithBalances;
|
|
241
|
+
}>;
|
|
230
242
|
getLedgerAccountsLines: (baseUrl: string, accessToken: string | undefined, options?: {
|
|
231
243
|
params?: Record<string, string | undefined> | undefined;
|
|
232
244
|
} | undefined) => () => Promise<{
|
|
@@ -584,7 +596,7 @@ declare module '@layerfi/components/components/ChartOfAccounts/ChartOfAccounts'
|
|
|
584
596
|
}
|
|
585
597
|
export type ChartOfAccountsContextType = ReturnType<typeof useChartOfAccounts>;
|
|
586
598
|
export const ChartOfAccountsContext: React.Context<{
|
|
587
|
-
data: import("@layerfi/components/types").
|
|
599
|
+
data: import("@layerfi/components/types/chart_of_accounts").ChartWithBalances | undefined;
|
|
588
600
|
isLoading?: boolean | undefined;
|
|
589
601
|
isValidating?: boolean | undefined;
|
|
590
602
|
error?: unknown;
|
|
@@ -629,8 +641,18 @@ declare module '@layerfi/components/components/ChartOfAccountsForm/ChartOfAccoun
|
|
|
629
641
|
|
|
630
642
|
}
|
|
631
643
|
declare module '@layerfi/components/components/ChartOfAccountsForm/constants' {
|
|
644
|
+
import { Direction } from '@layerfi/components/types';
|
|
632
645
|
import { BaseSelectOption } from '@layerfi/components/types/general';
|
|
633
|
-
export const
|
|
646
|
+
export const LEDGER_ACCOUNT_TYPES: BaseSelectOption[];
|
|
647
|
+
export const DEFAULT_ACCOUNT_TYPE_DIRECTION: Record<string, Direction>;
|
|
648
|
+
export const NORMALITY_OPTIONS: BaseSelectOption[];
|
|
649
|
+
export const ASSET_LEDGER_ACCOUNT_SUBTYPES: BaseSelectOption[];
|
|
650
|
+
export const LIABILITY_LEDGER_ACCOUNT_SUBTYPES: BaseSelectOption[];
|
|
651
|
+
export const EQUITY_LEDGER_ACCOUNT_SUBTYPES: BaseSelectOption[];
|
|
652
|
+
export const REVENUE_LEDGER_ACCOUNT_SUBTYPES: BaseSelectOption[];
|
|
653
|
+
export const EXPENSE_LEDGER_ACCOUNT_SUBTYPES: BaseSelectOption[];
|
|
654
|
+
export const LEDGER_ACCOUNT_SUBTYPES: BaseSelectOption[];
|
|
655
|
+
export const LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE: Record<string, BaseSelectOption[]>;
|
|
634
656
|
|
|
635
657
|
}
|
|
636
658
|
declare module '@layerfi/components/components/ChartOfAccountsForm/index' {
|
|
@@ -638,17 +660,17 @@ declare module '@layerfi/components/components/ChartOfAccountsForm/index' {
|
|
|
638
660
|
|
|
639
661
|
}
|
|
640
662
|
declare module '@layerfi/components/components/ChartOfAccountsForm/useParentOptions' {
|
|
641
|
-
import {
|
|
663
|
+
import { ChartWithBalances } from '@layerfi/components/types/chart_of_accounts';
|
|
642
664
|
import { BaseSelectOption } from '@layerfi/components/types/general';
|
|
643
|
-
export const useParentOptions: (data?:
|
|
665
|
+
export const useParentOptions: (data?: ChartWithBalances) => BaseSelectOption[];
|
|
644
666
|
|
|
645
667
|
}
|
|
646
668
|
declare module '@layerfi/components/components/ChartOfAccountsRow/ChartOfAccountsRow' {
|
|
647
669
|
import React from 'react';
|
|
648
|
-
import {
|
|
670
|
+
import { LedgerAccountBalance } from '@layerfi/components/types/chart_of_accounts';
|
|
649
671
|
import { View } from '@layerfi/components/components/ChartOfAccounts/ChartOfAccounts';
|
|
650
672
|
type ChartOfAccountsRowProps = {
|
|
651
|
-
account:
|
|
673
|
+
account: LedgerAccountBalance;
|
|
652
674
|
depth?: number;
|
|
653
675
|
index: number;
|
|
654
676
|
cumulativeIndex?: number;
|
|
@@ -889,8 +911,10 @@ declare module '@layerfi/components/components/Input/Select' {
|
|
|
889
911
|
onChange: (selected: T) => void;
|
|
890
912
|
disabled?: boolean;
|
|
891
913
|
placeholder?: string;
|
|
914
|
+
isInvalid?: boolean;
|
|
915
|
+
errorMessage?: string;
|
|
892
916
|
}
|
|
893
|
-
export const Select: <T>({ name, options, className, classNamePrefix, value, onChange, disabled, placeholder, }: SelectProps<T>) => React.JSX.Element;
|
|
917
|
+
export const Select: <T>({ name, options, className, classNamePrefix, value, onChange, disabled, placeholder, isInvalid, errorMessage, }: SelectProps<T>) => React.JSX.Element;
|
|
894
918
|
|
|
895
919
|
}
|
|
896
920
|
declare module '@layerfi/components/components/Input/index' {
|
|
@@ -913,10 +937,10 @@ declare module '@layerfi/components/components/LedgerAccount/LedgerAccountIndex'
|
|
|
913
937
|
}
|
|
914
938
|
declare module '@layerfi/components/components/LedgerAccount/LedgerAccountRow' {
|
|
915
939
|
import React from 'react';
|
|
916
|
-
import {
|
|
940
|
+
import { LedgerAccountLineItem } from '@layerfi/components/types';
|
|
917
941
|
import { View } from '@layerfi/components/components/ChartOfAccounts/ChartOfAccounts';
|
|
918
942
|
export interface LedgerAccountRowProps {
|
|
919
|
-
row:
|
|
943
|
+
row: LedgerAccountLineItem;
|
|
920
944
|
index: number;
|
|
921
945
|
initialLoad?: boolean;
|
|
922
946
|
view: View;
|
|
@@ -1675,7 +1699,8 @@ declare module '@layerfi/components/hooks/useChartOfAccounts/index' {
|
|
|
1675
1699
|
|
|
1676
1700
|
}
|
|
1677
1701
|
declare module '@layerfi/components/hooks/useChartOfAccounts/useChartOfAccounts' {
|
|
1678
|
-
import {
|
|
1702
|
+
import { NewAccount } from '@layerfi/components/types';
|
|
1703
|
+
import { ChartWithBalances, LedgerAccountBalance } from '@layerfi/components/types/chart_of_accounts';
|
|
1679
1704
|
import { BaseSelectOption } from '@layerfi/components/types/general';
|
|
1680
1705
|
interface FormError {
|
|
1681
1706
|
field: string;
|
|
@@ -1686,15 +1711,16 @@ declare module '@layerfi/components/hooks/useChartOfAccounts/useChartOfAccounts'
|
|
|
1686
1711
|
accountId?: string;
|
|
1687
1712
|
data: {
|
|
1688
1713
|
parent?: BaseSelectOption;
|
|
1714
|
+
stable_name?: string;
|
|
1689
1715
|
name?: string;
|
|
1690
1716
|
type?: BaseSelectOption;
|
|
1691
1717
|
subType?: BaseSelectOption;
|
|
1692
|
-
|
|
1718
|
+
normality?: BaseSelectOption;
|
|
1693
1719
|
};
|
|
1694
1720
|
errors?: FormError[];
|
|
1695
1721
|
}
|
|
1696
1722
|
type UseChartOfAccounts = () => {
|
|
1697
|
-
data:
|
|
1723
|
+
data: ChartWithBalances | undefined;
|
|
1698
1724
|
isLoading?: boolean;
|
|
1699
1725
|
isValidating?: boolean;
|
|
1700
1726
|
error?: unknown;
|
|
@@ -1709,7 +1735,7 @@ declare module '@layerfi/components/hooks/useChartOfAccounts/useChartOfAccounts'
|
|
|
1709
1735
|
changeFormData: (name: string, value: string | BaseSelectOption | undefined) => void;
|
|
1710
1736
|
submitForm: () => void;
|
|
1711
1737
|
};
|
|
1712
|
-
export const flattenAccounts: (accounts:
|
|
1738
|
+
export const flattenAccounts: (accounts: LedgerAccountBalance[]) => LedgerAccountBalance[];
|
|
1713
1739
|
export const useChartOfAccounts: UseChartOfAccounts;
|
|
1714
1740
|
export {};
|
|
1715
1741
|
|
|
@@ -2292,6 +2318,23 @@ declare module '@layerfi/components/types/chart_of_accounts' {
|
|
|
2292
2318
|
selfOnlyBalance: number;
|
|
2293
2319
|
entries?: AccountEntry[];
|
|
2294
2320
|
}
|
|
2321
|
+
export type ChartWithBalances = {
|
|
2322
|
+
accounts: LedgerAccountBalance[];
|
|
2323
|
+
};
|
|
2324
|
+
export type ApiAccountType = {
|
|
2325
|
+
value: string;
|
|
2326
|
+
display_name: string;
|
|
2327
|
+
};
|
|
2328
|
+
export type LedgerAccountBalance = {
|
|
2329
|
+
id: string;
|
|
2330
|
+
name: string;
|
|
2331
|
+
stable_name: string;
|
|
2332
|
+
account_type: ApiAccountType;
|
|
2333
|
+
account_subtype?: ApiAccountType;
|
|
2334
|
+
normality: Direction;
|
|
2335
|
+
balance: number;
|
|
2336
|
+
sub_accounts: LedgerAccountBalance[];
|
|
2337
|
+
};
|
|
2295
2338
|
export type NewAccount = {
|
|
2296
2339
|
name: string;
|
|
2297
2340
|
normality: Direction;
|
|
@@ -2299,17 +2342,19 @@ declare module '@layerfi/components/types/chart_of_accounts' {
|
|
|
2299
2342
|
type: 'AccountId';
|
|
2300
2343
|
id: string;
|
|
2301
2344
|
};
|
|
2302
|
-
|
|
2345
|
+
account_type: string;
|
|
2346
|
+
account_subtype?: string;
|
|
2303
2347
|
};
|
|
2304
2348
|
export type EditAccount = {
|
|
2349
|
+
stable_name?: string;
|
|
2305
2350
|
name: string;
|
|
2306
|
-
stable_name: string;
|
|
2307
2351
|
normality: Direction;
|
|
2308
2352
|
parent_id?: {
|
|
2309
2353
|
type: 'AccountId';
|
|
2310
2354
|
id: string;
|
|
2311
2355
|
};
|
|
2312
|
-
|
|
2356
|
+
account_type: string;
|
|
2357
|
+
account_subtype?: string;
|
|
2313
2358
|
};
|
|
2314
2359
|
|
|
2315
2360
|
}
|
|
@@ -2400,7 +2445,7 @@ declare module '@layerfi/components/types/layer_context' {
|
|
|
2400
2445
|
}
|
|
2401
2446
|
declare module '@layerfi/components/types/ledger_accounts' {
|
|
2402
2447
|
import { BankTransaction, Direction } from '@layerfi/components/types/bank_transactions';
|
|
2403
|
-
export type
|
|
2448
|
+
export type LedgerAccountLineItems = LedgerAccountLineItem[];
|
|
2404
2449
|
export interface LedgerAccountsEntry {
|
|
2405
2450
|
agent?: string;
|
|
2406
2451
|
business_id: string;
|
|
@@ -2416,17 +2461,7 @@ declare module '@layerfi/components/types/ledger_accounts' {
|
|
|
2416
2461
|
reversal_of_id?: string;
|
|
2417
2462
|
type: string;
|
|
2418
2463
|
transaction?: BankTransaction;
|
|
2419
|
-
|
|
2420
|
-
export interface LedgerAccountsLine {
|
|
2421
|
-
type: string;
|
|
2422
|
-
id: string;
|
|
2423
|
-
entry_id: string;
|
|
2424
|
-
account: LedgerAccountsAccount;
|
|
2425
|
-
amount: number;
|
|
2426
|
-
direction: Direction;
|
|
2427
|
-
date: string;
|
|
2428
|
-
transaction?: BankTransaction;
|
|
2429
|
-
invoice: string | null;
|
|
2464
|
+
source?: LedgerEntrySource;
|
|
2430
2465
|
}
|
|
2431
2466
|
export interface LedgerAccountsAccount {
|
|
2432
2467
|
always_show_in_pnl?: boolean;
|
|
@@ -2437,13 +2472,63 @@ declare module '@layerfi/components/types/ledger_accounts' {
|
|
|
2437
2472
|
stable_name: string;
|
|
2438
2473
|
}
|
|
2439
2474
|
export interface LedgerAccountLineItem {
|
|
2440
|
-
|
|
2475
|
+
id: string;
|
|
2476
|
+
entry_id: string;
|
|
2477
|
+
account: LedgerAccountsAccount;
|
|
2441
2478
|
amount: number;
|
|
2442
|
-
createdAt: string;
|
|
2443
2479
|
direction: Direction;
|
|
2444
|
-
|
|
2445
|
-
|
|
2446
|
-
|
|
2480
|
+
date: string;
|
|
2481
|
+
source?: LedgerEntrySource;
|
|
2482
|
+
running_balance: number;
|
|
2483
|
+
}
|
|
2484
|
+
export interface LedgerEntrySource {
|
|
2485
|
+
display_description: string;
|
|
2486
|
+
entity_name: string;
|
|
2487
|
+
type: string;
|
|
2488
|
+
}
|
|
2489
|
+
export interface TransactionLedgerEntrySource extends LedgerEntrySource {
|
|
2490
|
+
transaction_id: string;
|
|
2491
|
+
external_id: string;
|
|
2492
|
+
account_name: string;
|
|
2493
|
+
date: string;
|
|
2494
|
+
amount: number;
|
|
2495
|
+
direction: Direction;
|
|
2496
|
+
counterparty?: string;
|
|
2497
|
+
}
|
|
2498
|
+
export interface InvoiceLedgerEntrySource extends LedgerEntrySource {
|
|
2499
|
+
invoice_id: string;
|
|
2500
|
+
external_id: string;
|
|
2501
|
+
invoice_number: string;
|
|
2502
|
+
recipient_name: string;
|
|
2503
|
+
date: string;
|
|
2504
|
+
amount: number;
|
|
2505
|
+
}
|
|
2506
|
+
export interface ManualLedgerEntrySource extends LedgerEntrySource {
|
|
2507
|
+
manual_entry_id: string;
|
|
2508
|
+
memo: string;
|
|
2509
|
+
created_by: string;
|
|
2510
|
+
}
|
|
2511
|
+
export interface InvoicePaymentLedgerEntrySource extends LedgerEntrySource {
|
|
2512
|
+
external_id: string;
|
|
2513
|
+
invoice_id: string;
|
|
2514
|
+
invoice_number: string;
|
|
2515
|
+
amount: number;
|
|
2516
|
+
}
|
|
2517
|
+
export interface RefundPaymentLedgerEntrySource extends LedgerEntrySource {
|
|
2518
|
+
external_id: string;
|
|
2519
|
+
refund_id: string;
|
|
2520
|
+
refunded_to_customer_amount: number;
|
|
2521
|
+
recipient_name: string;
|
|
2522
|
+
}
|
|
2523
|
+
export interface OpeningBalanceLedgerEntrySource extends LedgerEntrySource {
|
|
2524
|
+
account_name: string;
|
|
2525
|
+
}
|
|
2526
|
+
export interface PayoutLedgerEntrySource extends LedgerEntrySource {
|
|
2527
|
+
payout_id: string;
|
|
2528
|
+
external_id: string;
|
|
2529
|
+
paid_out_amount: number;
|
|
2530
|
+
processor: string;
|
|
2531
|
+
completed_at: string;
|
|
2447
2532
|
}
|
|
2448
2533
|
|
|
2449
2534
|
}
|
|
@@ -2488,6 +2573,8 @@ declare module '@layerfi/components/types/linked_accounts' {
|
|
|
2488
2573
|
name: string;
|
|
2489
2574
|
logo: string;
|
|
2490
2575
|
};
|
|
2576
|
+
mask?: string;
|
|
2577
|
+
logo_base64?: string;
|
|
2491
2578
|
}
|
|
2492
2579
|
export type PublicToken = {
|
|
2493
2580
|
public_token: string;
|
|
@@ -2525,7 +2612,7 @@ declare module '@layerfi/components/types' {
|
|
|
2525
2612
|
export { Direction, BankTransaction } from '@layerfi/components/types/bank_transactions';
|
|
2526
2613
|
export { CategorizationStatus, Category, CategorizationType, AutoCategorization, SuggestedCategorization, SingleCategoryUpdate, SplitCategoryUpdate, CategoryUpdate, } from '@layerfi/components/types/categories';
|
|
2527
2614
|
export { ChartOfAccounts, Account, NewAccount, EditAccount, } from '@layerfi/components/types/chart_of_accounts';
|
|
2528
|
-
export { LedgerAccounts,
|
|
2615
|
+
export { LedgerAccountLineItems as LedgerAccounts, LedgerAccountLineItem, LedgerAccountsAccount, LedgerAccountsEntry, } from '@layerfi/components/types/ledger_accounts';
|
|
2529
2616
|
export { SortDirection } from '@layerfi/components/types/general';
|
|
2530
2617
|
export type DateRange<T = Date> = {
|
|
2531
2618
|
startDate: T;
|