@layerfi/components 0.1.103 → 0.1.104
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/cjs/index.cjs +393 -107
- package/dist/esm/index.mjs +464 -178
- package/dist/index.css +138 -139
- package/dist/index.d.ts +94 -16
- package/package.json +1 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -5570,7 +5570,7 @@ import { useState as useState5 } from "react";
|
|
|
5570
5570
|
import { useReducer, useEffect as useEffect2 } from "react";
|
|
5571
5571
|
|
|
5572
5572
|
// package.json
|
|
5573
|
-
var version = "0.1.
|
|
5573
|
+
var version = "0.1.104";
|
|
5574
5574
|
|
|
5575
5575
|
// src/models/APIError.ts
|
|
5576
5576
|
var APIError = class _APIError extends Error {
|
|
@@ -5755,9 +5755,9 @@ var getBankTransactions = get(
|
|
|
5755
5755
|
businessId,
|
|
5756
5756
|
cursor,
|
|
5757
5757
|
categorized,
|
|
5758
|
-
descriptionFilter,
|
|
5759
5758
|
direction,
|
|
5760
5759
|
limit,
|
|
5760
|
+
query,
|
|
5761
5761
|
startDate,
|
|
5762
5762
|
endDate,
|
|
5763
5763
|
sortBy = "date",
|
|
@@ -5767,8 +5767,8 @@ var getBankTransactions = get(
|
|
|
5767
5767
|
const parameters = toDefinedSearchParameters({
|
|
5768
5768
|
cursor,
|
|
5769
5769
|
categorized,
|
|
5770
|
-
descriptionFilter,
|
|
5771
5770
|
direction,
|
|
5771
|
+
q: query,
|
|
5772
5772
|
startDate,
|
|
5773
5773
|
endDate,
|
|
5774
5774
|
sortBy,
|
|
@@ -5787,8 +5787,8 @@ var matchBankTransaction = put(
|
|
|
5787
5787
|
var getBankTransactionsExcel = get(({
|
|
5788
5788
|
businessId,
|
|
5789
5789
|
categorized,
|
|
5790
|
-
descriptionFilter,
|
|
5791
5790
|
direction,
|
|
5791
|
+
query,
|
|
5792
5792
|
startDate,
|
|
5793
5793
|
endDate,
|
|
5794
5794
|
sortBy = "date",
|
|
@@ -5796,8 +5796,8 @@ var getBankTransactionsExcel = get(({
|
|
|
5796
5796
|
}) => {
|
|
5797
5797
|
const parameters = toDefinedSearchParameters({
|
|
5798
5798
|
categorized,
|
|
5799
|
-
descriptionFilter,
|
|
5800
5799
|
direction,
|
|
5800
|
+
q: query,
|
|
5801
5801
|
startDate,
|
|
5802
5802
|
endDate,
|
|
5803
5803
|
sortBy,
|
|
@@ -8029,8 +8029,8 @@ function keyLoader(previousPageData, {
|
|
|
8029
8029
|
apiUrl,
|
|
8030
8030
|
businessId,
|
|
8031
8031
|
categorized,
|
|
8032
|
-
descriptionFilter,
|
|
8033
8032
|
direction,
|
|
8033
|
+
query,
|
|
8034
8034
|
startDate,
|
|
8035
8035
|
endDate,
|
|
8036
8036
|
tagFilterQueryString
|
|
@@ -8042,8 +8042,8 @@ function keyLoader(previousPageData, {
|
|
|
8042
8042
|
businessId,
|
|
8043
8043
|
categorized,
|
|
8044
8044
|
cursor: previousPageData ? previousPageData.meta.pagination.cursor : void 0,
|
|
8045
|
-
descriptionFilter,
|
|
8046
8045
|
direction,
|
|
8046
|
+
query,
|
|
8047
8047
|
startDate,
|
|
8048
8048
|
endDate,
|
|
8049
8049
|
tagFilterQueryString,
|
|
@@ -8053,8 +8053,8 @@ function keyLoader(previousPageData, {
|
|
|
8053
8053
|
}
|
|
8054
8054
|
function useBankTransactions({
|
|
8055
8055
|
categorized,
|
|
8056
|
-
descriptionFilter,
|
|
8057
8056
|
direction,
|
|
8057
|
+
query,
|
|
8058
8058
|
startDate,
|
|
8059
8059
|
endDate,
|
|
8060
8060
|
tagFilterQueryString
|
|
@@ -8067,8 +8067,8 @@ function useBankTransactions({
|
|
|
8067
8067
|
__spreadProps(__spreadValues({}, data), {
|
|
8068
8068
|
businessId,
|
|
8069
8069
|
categorized,
|
|
8070
|
-
descriptionFilter,
|
|
8071
8070
|
direction,
|
|
8071
|
+
query,
|
|
8072
8072
|
startDate,
|
|
8073
8073
|
endDate,
|
|
8074
8074
|
tagFilterQueryString
|
|
@@ -8081,7 +8081,7 @@ function useBankTransactions({
|
|
|
8081
8081
|
categorized: categorized2,
|
|
8082
8082
|
cursor,
|
|
8083
8083
|
direction: direction2,
|
|
8084
|
-
|
|
8084
|
+
query: query2,
|
|
8085
8085
|
startDate: startDate2,
|
|
8086
8086
|
endDate: endDate2,
|
|
8087
8087
|
tagFilterQueryString: tagFilterQueryString2
|
|
@@ -8094,9 +8094,9 @@ function useBankTransactions({
|
|
|
8094
8094
|
businessId: businessId2,
|
|
8095
8095
|
categorized: categorized2,
|
|
8096
8096
|
cursor,
|
|
8097
|
-
limit: 200,
|
|
8098
|
-
descriptionFilter: descriptionFilter2,
|
|
8099
8097
|
direction: direction2,
|
|
8098
|
+
limit: 200,
|
|
8099
|
+
query: query2,
|
|
8100
8100
|
startDate: startDate2,
|
|
8101
8101
|
endDate: endDate2,
|
|
8102
8102
|
tagFilterQueryString: tagFilterQueryString2
|
|
@@ -8405,8 +8405,8 @@ function bankTransactionFiltersToHookOptions(filters) {
|
|
|
8405
8405
|
var _a, _b, _c;
|
|
8406
8406
|
return {
|
|
8407
8407
|
categorized: (filters == null ? void 0 : filters.categorizationStatus) ? filters.categorizationStatus !== "all" /* all */ ? filters.categorizationStatus === "categorized" /* categorized */ : void 0 : void 0,
|
|
8408
|
-
descriptionFilter: filters == null ? void 0 : filters.descriptionFilter,
|
|
8409
8408
|
direction: ((_a = filters == null ? void 0 : filters.direction) == null ? void 0 : _a.length) === 1 ? filters.direction[0] === "CREDIT" /* CREDIT */ ? "INFLOW" : "OUTFLOW" : void 0,
|
|
8409
|
+
query: filters == null ? void 0 : filters.query,
|
|
8410
8410
|
startDate: (_b = filters == null ? void 0 : filters.dateRange) == null ? void 0 : _b.startDate,
|
|
8411
8411
|
endDate: (_c = filters == null ? void 0 : filters.dateRange) == null ? void 0 : _c.endDate,
|
|
8412
8412
|
tagFilterQueryString: (filters == null ? void 0 : filters.tagFilter) ? tagFilterToQueryString(filters.tagFilter) : void 0
|
|
@@ -11110,6 +11110,9 @@ var formatter = new Intl.NumberFormat("en-US", {
|
|
|
11110
11110
|
maximumFractionDigits: 2
|
|
11111
11111
|
});
|
|
11112
11112
|
var centsToDollars = (cents = NaN) => isNaN(cents) ? "-.--" : formatter.format(cents / 100);
|
|
11113
|
+
function centsToDollarsWithoutCommas(cents = 0) {
|
|
11114
|
+
return centsToDollars(cents).replaceAll(",", "");
|
|
11115
|
+
}
|
|
11113
11116
|
var dollarsToCents = (dollars = "") => Math.round(parseFloat(dollars) * 100);
|
|
11114
11117
|
|
|
11115
11118
|
// src/components/LinkedAccountThumb/LinkedAccountThumb.tsx
|
|
@@ -20438,7 +20441,7 @@ import { useCallback as useCallback27, useState as useState43 } from "react";
|
|
|
20438
20441
|
import classNames56 from "classnames";
|
|
20439
20442
|
import { endOfMonth as endOfMonth5, startOfMonth as startOfMonth5 } from "date-fns";
|
|
20440
20443
|
|
|
20441
|
-
// src/components/
|
|
20444
|
+
// src/components/SearchField/SearchField.tsx
|
|
20442
20445
|
import { Group as Group2 } from "react-aria-components";
|
|
20443
20446
|
import { Search } from "lucide-react";
|
|
20444
20447
|
|
|
@@ -20461,19 +20464,18 @@ function MinimalSearchField(_a) {
|
|
|
20461
20464
|
] }));
|
|
20462
20465
|
}
|
|
20463
20466
|
|
|
20464
|
-
// src/components/
|
|
20467
|
+
// src/components/SearchField/SearchField.tsx
|
|
20465
20468
|
import { jsx as jsx160, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
20466
|
-
var CLASS_NAME9 = "
|
|
20467
|
-
function
|
|
20468
|
-
var _b = _a, { slot } = _b, restProps = __objRest(_b, ["slot"]);
|
|
20469
|
+
var CLASS_NAME9 = "Layer__SearchField Layer__InputGroup";
|
|
20470
|
+
function SearchField(_a) {
|
|
20471
|
+
var _b = _a, { slot = "search", label } = _b, restProps = __objRest(_b, ["slot", "label"]);
|
|
20469
20472
|
return /* @__PURE__ */ jsxs98(Group2, { slot, className: CLASS_NAME9, children: [
|
|
20470
20473
|
/* @__PURE__ */ jsx160(VStack, { slot: "icon", align: "center", justify: "center", children: /* @__PURE__ */ jsx160(Search, { size: 14 }) }),
|
|
20471
20474
|
/* @__PURE__ */ jsx160(
|
|
20472
20475
|
MinimalSearchField,
|
|
20473
20476
|
__spreadProps(__spreadValues({}, restProps), {
|
|
20474
|
-
|
|
20475
|
-
|
|
20476
|
-
"aria-label": "Search transactions"
|
|
20477
|
+
placeholder: label,
|
|
20478
|
+
"aria-label": label
|
|
20477
20479
|
})
|
|
20478
20480
|
)
|
|
20479
20481
|
] });
|
|
@@ -20517,7 +20519,7 @@ function useBankTransactionsDownload() {
|
|
|
20517
20519
|
arg: {
|
|
20518
20520
|
categorized,
|
|
20519
20521
|
direction,
|
|
20520
|
-
|
|
20522
|
+
query,
|
|
20521
20523
|
startDate,
|
|
20522
20524
|
endDate,
|
|
20523
20525
|
tagFilterQueryString
|
|
@@ -20530,7 +20532,7 @@ function useBankTransactionsDownload() {
|
|
|
20530
20532
|
params: {
|
|
20531
20533
|
businessId: businessId2,
|
|
20532
20534
|
categorized,
|
|
20533
|
-
|
|
20535
|
+
query,
|
|
20534
20536
|
direction,
|
|
20535
20537
|
startDate,
|
|
20536
20538
|
endDate,
|
|
@@ -21930,19 +21932,20 @@ function TransactionsSearch({ slot }) {
|
|
|
21930
21932
|
const { filters, setFilters } = useBankTransactionsContext();
|
|
21931
21933
|
const [localSearch, setLocalSearch] = useState43(() => {
|
|
21932
21934
|
var _a;
|
|
21933
|
-
return (_a = filters == null ? void 0 : filters.
|
|
21935
|
+
return (_a = filters == null ? void 0 : filters.query) != null ? _a : "";
|
|
21934
21936
|
});
|
|
21935
21937
|
const debouncedSetDescription = useDebounce((value) => {
|
|
21936
|
-
setFilters({
|
|
21938
|
+
setFilters({ query: value });
|
|
21937
21939
|
});
|
|
21938
21940
|
const handleSearch = useCallback27((value) => {
|
|
21939
21941
|
setLocalSearch(value);
|
|
21940
21942
|
void debouncedSetDescription(value);
|
|
21941
21943
|
}, [debouncedSetDescription]);
|
|
21942
21944
|
return /* @__PURE__ */ jsx177(
|
|
21943
|
-
|
|
21945
|
+
SearchField,
|
|
21944
21946
|
{
|
|
21945
21947
|
slot,
|
|
21948
|
+
label: "Search transactions",
|
|
21946
21949
|
value: localSearch,
|
|
21947
21950
|
onChange: handleSearch
|
|
21948
21951
|
}
|
|
@@ -22394,7 +22397,7 @@ var BankTransactionsContent = ({
|
|
|
22394
22397
|
hasVisibleTransactions: ((_a = bankTransactions == null ? void 0 : bankTransactions.length) != null ? _a : 0) > 0,
|
|
22395
22398
|
isCategorizationMode: editable,
|
|
22396
22399
|
isError: Boolean(error),
|
|
22397
|
-
isFiltered: Boolean(filters == null ? void 0 : filters.
|
|
22400
|
+
isFiltered: Boolean(filters == null ? void 0 : filters.query),
|
|
22398
22401
|
isLoadingWithoutData
|
|
22399
22402
|
}
|
|
22400
22403
|
) : null,
|
|
@@ -27658,6 +27661,10 @@ var ASSET_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27658
27661
|
value: "FIXED_ASSET",
|
|
27659
27662
|
label: "Fixed Assets"
|
|
27660
27663
|
},
|
|
27664
|
+
{
|
|
27665
|
+
value: "ACCUMULATED_DEPRECIATION",
|
|
27666
|
+
label: "Accumulated Depreciation"
|
|
27667
|
+
},
|
|
27661
27668
|
{
|
|
27662
27669
|
value: "CASH",
|
|
27663
27670
|
label: "Cash"
|
|
@@ -27665,13 +27672,33 @@ var ASSET_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27665
27672
|
{
|
|
27666
27673
|
value: "UNDEPOSITED_FUNDS",
|
|
27667
27674
|
label: "Undeposited Funds"
|
|
27675
|
+
},
|
|
27676
|
+
{
|
|
27677
|
+
value: "CURRENT_ASSET",
|
|
27678
|
+
label: "Current Assets"
|
|
27679
|
+
},
|
|
27680
|
+
{
|
|
27681
|
+
value: "NON_CURRENT_ASSET",
|
|
27682
|
+
label: "Non-Current Assets"
|
|
27683
|
+
},
|
|
27684
|
+
{
|
|
27685
|
+
value: "PREPAID_EXPENSES",
|
|
27686
|
+
label: "Prepaid Expenses"
|
|
27687
|
+
},
|
|
27688
|
+
{
|
|
27689
|
+
value: "DEVELOPMENT_COSTS",
|
|
27690
|
+
label: "Development Costs"
|
|
27691
|
+
},
|
|
27692
|
+
{
|
|
27693
|
+
value: "LOANS_RECEIVABLE",
|
|
27694
|
+
label: "Loans Receivable"
|
|
27695
|
+
},
|
|
27696
|
+
{
|
|
27697
|
+
value: "INTANGIBLE_ASSET",
|
|
27698
|
+
label: "Intangible Assets"
|
|
27668
27699
|
}
|
|
27669
27700
|
];
|
|
27670
27701
|
var LIABILITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
27671
|
-
{
|
|
27672
|
-
value: "LIABILITY",
|
|
27673
|
-
label: "Liabilities"
|
|
27674
|
-
},
|
|
27675
27702
|
{
|
|
27676
27703
|
value: "ACCOUNTS_PAYABLE",
|
|
27677
27704
|
label: "Accounts Payable"
|
|
@@ -27681,36 +27708,72 @@ var LIABILITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27681
27708
|
label: "Credit Cards"
|
|
27682
27709
|
},
|
|
27683
27710
|
{
|
|
27684
|
-
value: "
|
|
27685
|
-
label: "
|
|
27711
|
+
value: "INCOME_TAXES_PAYABLE",
|
|
27712
|
+
label: "Income Taxes Payable"
|
|
27713
|
+
},
|
|
27714
|
+
{
|
|
27715
|
+
value: "SALES_TAXES_PAYABLE",
|
|
27716
|
+
label: "Sales Taxes Payable"
|
|
27717
|
+
},
|
|
27718
|
+
{
|
|
27719
|
+
value: "OTHER_TAXES_PAYABLE",
|
|
27720
|
+
label: "Other Taxes Payable"
|
|
27721
|
+
},
|
|
27722
|
+
{
|
|
27723
|
+
value: "PAYROLL_TAXES_PAYABLE",
|
|
27724
|
+
label: "Payroll Taxes Payable"
|
|
27725
|
+
},
|
|
27726
|
+
{
|
|
27727
|
+
value: "UNEARNED_REVENUE",
|
|
27728
|
+
label: "Unearned Revenue"
|
|
27686
27729
|
},
|
|
27687
27730
|
{
|
|
27688
27731
|
value: "PAYROLL_LIABILITY",
|
|
27689
27732
|
label: "Payroll Liabilities"
|
|
27690
27733
|
},
|
|
27691
27734
|
{
|
|
27692
|
-
value: "
|
|
27693
|
-
label: "
|
|
27735
|
+
value: "PAYROLL_CLEARING",
|
|
27736
|
+
label: "Payroll Clearing"
|
|
27694
27737
|
},
|
|
27695
27738
|
{
|
|
27696
27739
|
value: "LINE_OF_CREDIT",
|
|
27697
27740
|
label: "Lines of Credit"
|
|
27698
27741
|
},
|
|
27699
|
-
{
|
|
27700
|
-
value: "NOTES_PAYABLE",
|
|
27701
|
-
label: "Notes Payable"
|
|
27702
|
-
},
|
|
27703
27742
|
{
|
|
27704
27743
|
value: "TIPS",
|
|
27705
27744
|
label: "Tips"
|
|
27706
27745
|
},
|
|
27707
27746
|
{
|
|
27708
|
-
value: "
|
|
27709
|
-
label: "
|
|
27747
|
+
value: "REFUND_LIABILITIES",
|
|
27748
|
+
label: "Refund Liabilities"
|
|
27710
27749
|
},
|
|
27711
27750
|
{
|
|
27712
27751
|
value: "UNDEPOSITED_OUTFLOWS",
|
|
27713
27752
|
label: "Undeposited Outflows"
|
|
27753
|
+
},
|
|
27754
|
+
{
|
|
27755
|
+
value: "OUTGOING_PAYMENT_CLEARING_ACCOUNT",
|
|
27756
|
+
label: "Outgoing Payment Clearing Accounts"
|
|
27757
|
+
},
|
|
27758
|
+
{
|
|
27759
|
+
value: "OTHER_CURRENT_LIABILITY",
|
|
27760
|
+
label: "Current Liabilities"
|
|
27761
|
+
},
|
|
27762
|
+
{
|
|
27763
|
+
value: "LOANS_PAYABLE",
|
|
27764
|
+
label: "Loans Payable"
|
|
27765
|
+
},
|
|
27766
|
+
{
|
|
27767
|
+
value: "NOTES_PAYABLE",
|
|
27768
|
+
label: "Notes Payable"
|
|
27769
|
+
},
|
|
27770
|
+
{
|
|
27771
|
+
value: "SHAREHOLDER_LOAN",
|
|
27772
|
+
label: "Shareholder Loans"
|
|
27773
|
+
},
|
|
27774
|
+
{
|
|
27775
|
+
value: "NON_CURRENT_LIABILITY",
|
|
27776
|
+
label: "Long Term Liabilities"
|
|
27714
27777
|
}
|
|
27715
27778
|
];
|
|
27716
27779
|
var EQUITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
@@ -27726,6 +27789,10 @@ var EQUITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27726
27789
|
value: "COMMON_STOCK",
|
|
27727
27790
|
label: "Common Stock"
|
|
27728
27791
|
},
|
|
27792
|
+
{
|
|
27793
|
+
value: "PREFERRED_STOCK",
|
|
27794
|
+
label: "Preferred Stock"
|
|
27795
|
+
},
|
|
27729
27796
|
{
|
|
27730
27797
|
value: "ADDITIONAL_PAID_IN_CAPITAL",
|
|
27731
27798
|
label: "Additional Paid In Capital"
|
|
@@ -27741,6 +27808,10 @@ var EQUITY_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27741
27808
|
{
|
|
27742
27809
|
value: "OPENING_BALANCE_EQUITY",
|
|
27743
27810
|
label: "Opening Balance Equity"
|
|
27811
|
+
},
|
|
27812
|
+
{
|
|
27813
|
+
value: "OTHER_EQUITY",
|
|
27814
|
+
label: "Other Equity"
|
|
27744
27815
|
}
|
|
27745
27816
|
];
|
|
27746
27817
|
var REVENUE_LEDGER_ACCOUNT_SUBTYPES = [
|
|
@@ -27755,6 +27826,18 @@ var REVENUE_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27755
27826
|
{
|
|
27756
27827
|
value: "RETURNS_ALLOWANCES",
|
|
27757
27828
|
label: "Returns & Allowances"
|
|
27829
|
+
},
|
|
27830
|
+
{
|
|
27831
|
+
value: "DIVIDEND_INCOME",
|
|
27832
|
+
label: "Dividend Income"
|
|
27833
|
+
},
|
|
27834
|
+
{
|
|
27835
|
+
value: "INTEREST_INCOME",
|
|
27836
|
+
label: "Interest Income"
|
|
27837
|
+
},
|
|
27838
|
+
{
|
|
27839
|
+
value: "OTHER_INCOME",
|
|
27840
|
+
label: "Other Income"
|
|
27758
27841
|
}
|
|
27759
27842
|
];
|
|
27760
27843
|
var EXPENSE_LEDGER_ACCOUNT_SUBTYPES = [
|
|
@@ -27775,12 +27858,40 @@ var EXPENSE_LEDGER_ACCOUNT_SUBTYPES = [
|
|
|
27775
27858
|
label: "Taxes & Licenses"
|
|
27776
27859
|
},
|
|
27777
27860
|
{
|
|
27778
|
-
value: "
|
|
27779
|
-
label: "
|
|
27861
|
+
value: "UNCATEGORIZED_EXPENSE",
|
|
27862
|
+
label: "Uncategorized Expense"
|
|
27780
27863
|
},
|
|
27781
27864
|
{
|
|
27782
27865
|
value: "CHARITABLE_CONTRIBUTIONS",
|
|
27783
27866
|
label: "Charitable Contributions"
|
|
27867
|
+
},
|
|
27868
|
+
{
|
|
27869
|
+
value: "LOAN_EXPENSES",
|
|
27870
|
+
label: "Loan Expenses"
|
|
27871
|
+
},
|
|
27872
|
+
{
|
|
27873
|
+
value: "FINANCE_COSTS",
|
|
27874
|
+
label: "Finance Costs"
|
|
27875
|
+
},
|
|
27876
|
+
{
|
|
27877
|
+
value: "INTEREST_EXPENSES",
|
|
27878
|
+
label: "Interest Expenses"
|
|
27879
|
+
},
|
|
27880
|
+
{
|
|
27881
|
+
value: "DEPRECIATION",
|
|
27882
|
+
label: "Depreciation"
|
|
27883
|
+
},
|
|
27884
|
+
{
|
|
27885
|
+
value: "AMORTIZATION",
|
|
27886
|
+
label: "Amortization"
|
|
27887
|
+
},
|
|
27888
|
+
{
|
|
27889
|
+
value: "BAD_DEBT",
|
|
27890
|
+
label: "Bad Debt"
|
|
27891
|
+
},
|
|
27892
|
+
{
|
|
27893
|
+
value: "OTHER_EXPENSES",
|
|
27894
|
+
label: "Other Expenses"
|
|
27784
27895
|
}
|
|
27785
27896
|
];
|
|
27786
27897
|
var LEDGER_ACCOUNT_SUBTYPES = [
|
|
@@ -28188,7 +28299,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
28188
28299
|
};
|
|
28189
28300
|
|
|
28190
28301
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
|
|
28191
|
-
import { useContext as useContext44, useState as
|
|
28302
|
+
import { useContext as useContext44, useState as useState61 } from "react";
|
|
28192
28303
|
|
|
28193
28304
|
// src/icons/Plus.tsx
|
|
28194
28305
|
import { jsx as jsx241, jsxs as jsxs149 } from "react/jsx-runtime";
|
|
@@ -28498,7 +28609,7 @@ var ChartOfAccountsSidebar = ({
|
|
|
28498
28609
|
};
|
|
28499
28610
|
|
|
28500
28611
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
28501
|
-
import { Fragment as Fragment34, useContext as useContext43, useEffect as useEffect34,
|
|
28612
|
+
import { Fragment as Fragment34, useContext as useContext43, useEffect as useEffect34, useMemo as useMemo46, useState as useState60 } from "react";
|
|
28502
28613
|
|
|
28503
28614
|
// src/icons/Edit2.tsx
|
|
28504
28615
|
import { jsx as jsx245 } from "react/jsx-runtime";
|
|
@@ -28529,12 +28640,172 @@ var Edit2_default = Edit2;
|
|
|
28529
28640
|
|
|
28530
28641
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
28531
28642
|
import { List } from "lucide-react";
|
|
28643
|
+
|
|
28644
|
+
// src/components/ChartOfAccountsTable/utils/types.ts
|
|
28645
|
+
var LedgerAccountTypeOrderEnum = /* @__PURE__ */ ((LedgerAccountTypeOrderEnum2) => {
|
|
28646
|
+
LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["ASSET"] = 0] = "ASSET";
|
|
28647
|
+
LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["LIABILITY"] = 1] = "LIABILITY";
|
|
28648
|
+
LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["EQUITY"] = 2] = "EQUITY";
|
|
28649
|
+
LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["REVENUE"] = 3] = "REVENUE";
|
|
28650
|
+
LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["EXPENSES"] = 4] = "EXPENSES";
|
|
28651
|
+
return LedgerAccountTypeOrderEnum2;
|
|
28652
|
+
})(LedgerAccountTypeOrderEnum || {});
|
|
28653
|
+
var LedgerAccountSubtypeOrderEnum = /* @__PURE__ */ ((LedgerAccountSubtypeOrderEnum2) => {
|
|
28654
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["BANK_ACCOUNTS"] = 0] = "BANK_ACCOUNTS";
|
|
28655
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CASH"] = 1] = "CASH";
|
|
28656
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNDEPOSITED_FUNDS"] = 2] = "UNDEPOSITED_FUNDS";
|
|
28657
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PAYMENT_PROCESSOR_CLEARING_ACCOUNT"] = 3] = "PAYMENT_PROCESSOR_CLEARING_ACCOUNT";
|
|
28658
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INBOUND_PAYMENT_METHOD_CLEARING"] = 4] = "INBOUND_PAYMENT_METHOD_CLEARING";
|
|
28659
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ACCOUNTS_RECEIVABLE"] = 5] = "ACCOUNTS_RECEIVABLE";
|
|
28660
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INVENTORY"] = 6] = "INVENTORY";
|
|
28661
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CURRENT_ASSET"] = 7] = "CURRENT_ASSET";
|
|
28662
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["FIXED_ASSET"] = 8] = "FIXED_ASSET";
|
|
28663
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INTANGIBLE_ASSET"] = 9] = "INTANGIBLE_ASSET";
|
|
28664
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PREPAID_EXPENSES"] = 10] = "PREPAID_EXPENSES";
|
|
28665
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["DEVELOPMENT_COSTS"] = 11] = "DEVELOPMENT_COSTS";
|
|
28666
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CREDIT_CARD"] = 12] = "CREDIT_CARD";
|
|
28667
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ACCOUNTS_PAYABLE"] = 13] = "ACCOUNTS_PAYABLE";
|
|
28668
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["LINE_OF_CREDIT"] = 14] = "LINE_OF_CREDIT";
|
|
28669
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["REFUND_LIABILITIES"] = 15] = "REFUND_LIABILITIES";
|
|
28670
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PAYROLL_LIABILITY"] = 16] = "PAYROLL_LIABILITY";
|
|
28671
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["SALES_TAXES_PAYABLE"] = 17] = "SALES_TAXES_PAYABLE";
|
|
28672
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_TAXES_PAYABLE"] = 18] = "OTHER_TAXES_PAYABLE";
|
|
28673
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["TIPS"] = 19] = "TIPS";
|
|
28674
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNEARNED_REVENUE"] = 20] = "UNEARNED_REVENUE";
|
|
28675
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNDEPOSITED_OUTFLOWS"] = 21] = "UNDEPOSITED_OUTFLOWS";
|
|
28676
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OUTGOING_PAYMENT_CLEARING_ACCOUNT"] = 22] = "OUTGOING_PAYMENT_CLEARING_ACCOUNT";
|
|
28677
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_CURRENT_LIABILITY"] = 23] = "OTHER_CURRENT_LIABILITY";
|
|
28678
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["SHAREHOLDER_LOAN"] = 24] = "SHAREHOLDER_LOAN";
|
|
28679
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["NOTES_PAYABLE"] = 25] = "NOTES_PAYABLE";
|
|
28680
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_LONG_TERM_LIABILITIES"] = 26] = "OTHER_LONG_TERM_LIABILITIES";
|
|
28681
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CONTRIBUTIONS"] = 27] = "CONTRIBUTIONS";
|
|
28682
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["DISTRIBUTIONS"] = 28] = "DISTRIBUTIONS";
|
|
28683
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["COMMON_STOCK"] = 29] = "COMMON_STOCK";
|
|
28684
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ADDITIONAL_PAID_IN_CAPITAL"] = 30] = "ADDITIONAL_PAID_IN_CAPITAL";
|
|
28685
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["RETAINED_EARNINGS"] = 31] = "RETAINED_EARNINGS";
|
|
28686
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ACCUMULATED_ADJUSTMENTS"] = 32] = "ACCUMULATED_ADJUSTMENTS";
|
|
28687
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OPENING_BALANCE_EQUITY"] = 33] = "OPENING_BALANCE_EQUITY";
|
|
28688
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_EQUITY"] = 34] = "OTHER_EQUITY";
|
|
28689
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["SALES"] = 35] = "SALES";
|
|
28690
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["REVENUE"] = 36] = "REVENUE";
|
|
28691
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNCATEGORIZED_REVENUE"] = 37] = "UNCATEGORIZED_REVENUE";
|
|
28692
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["RETURNS_ALLOWANCES"] = 38] = "RETURNS_ALLOWANCES";
|
|
28693
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_INCOME"] = 39] = "OTHER_INCOME";
|
|
28694
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["COGS"] = 40] = "COGS";
|
|
28695
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OPERATING_EXPENSES"] = 41] = "OPERATING_EXPENSES";
|
|
28696
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PAYROLL"] = 42] = "PAYROLL";
|
|
28697
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INTEREST_EXPENSES"] = 43] = "INTEREST_EXPENSES";
|
|
28698
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["TAXES_LICENSES"] = 44] = "TAXES_LICENSES";
|
|
28699
|
+
LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNCATEGORIZED_EXPENSE"] = 45] = "UNCATEGORIZED_EXPENSE";
|
|
28700
|
+
return LedgerAccountSubtypeOrderEnum2;
|
|
28701
|
+
})(LedgerAccountSubtypeOrderEnum || {});
|
|
28702
|
+
|
|
28703
|
+
// src/components/ChartOfAccountsTable/utils/utils.ts
|
|
28704
|
+
var compareByEnum = (a, b, enumMap) => {
|
|
28705
|
+
const aVal = a !== void 0 ? enumMap[a] : void 0;
|
|
28706
|
+
const bVal = b !== void 0 ? enumMap[b] : void 0;
|
|
28707
|
+
if (aVal !== void 0 && bVal !== void 0) return aVal - bVal;
|
|
28708
|
+
if (aVal === void 0 && bVal !== void 0) return 1;
|
|
28709
|
+
if (aVal !== void 0 && bVal === void 0) return -1;
|
|
28710
|
+
return 0;
|
|
28711
|
+
};
|
|
28712
|
+
var compareAccounts = (a, b) => {
|
|
28713
|
+
var _a, _b, _c, _d, _e, _f;
|
|
28714
|
+
const typeComparison = compareByEnum(
|
|
28715
|
+
a.account_type.value,
|
|
28716
|
+
b.account_type.value,
|
|
28717
|
+
LedgerAccountTypeOrderEnum
|
|
28718
|
+
);
|
|
28719
|
+
if (typeComparison !== 0) return typeComparison;
|
|
28720
|
+
const subtypeComparison = compareByEnum(
|
|
28721
|
+
(_a = a.account_subtype) == null ? void 0 : _a.value,
|
|
28722
|
+
(_b = b.account_subtype) == null ? void 0 : _b.value,
|
|
28723
|
+
LedgerAccountSubtypeOrderEnum
|
|
28724
|
+
);
|
|
28725
|
+
if (subtypeComparison !== 0) return subtypeComparison;
|
|
28726
|
+
const subtypeNameCompare = ((_d = (_c = a.account_subtype) == null ? void 0 : _c.display_name) != null ? _d : "").localeCompare((_f = (_e = b.account_subtype) == null ? void 0 : _e.display_name) != null ? _f : "");
|
|
28727
|
+
if (subtypeNameCompare !== 0) return subtypeNameCompare;
|
|
28728
|
+
return a.name.localeCompare(b.name);
|
|
28729
|
+
};
|
|
28730
|
+
var sortAccountsRecursive = (accounts) => {
|
|
28731
|
+
return accounts.map((account) => __spreadProps(__spreadValues({}, account), {
|
|
28732
|
+
sub_accounts: account.sub_accounts ? sortAccountsRecursive(account.sub_accounts) : []
|
|
28733
|
+
})).sort(compareAccounts);
|
|
28734
|
+
};
|
|
28735
|
+
var accountMatchesQuery = (account, query) => {
|
|
28736
|
+
var _a;
|
|
28737
|
+
return [
|
|
28738
|
+
account.name,
|
|
28739
|
+
account.account_type.display_name,
|
|
28740
|
+
((_a = account.account_subtype) == null ? void 0 : _a.display_name) || "",
|
|
28741
|
+
centsToDollars(account.balance),
|
|
28742
|
+
centsToDollarsWithoutCommas(account.balance),
|
|
28743
|
+
convertCentsToCurrency(account.balance) || ""
|
|
28744
|
+
].some((field) => field.toLowerCase().includes(query));
|
|
28745
|
+
};
|
|
28746
|
+
var filterAccounts = (accounts, query) => {
|
|
28747
|
+
return accounts.flatMap((account) => {
|
|
28748
|
+
const isMatching = accountMatchesQuery(account, query);
|
|
28749
|
+
const matchingChildren = filterAccounts(account.sub_accounts, query);
|
|
28750
|
+
if (matchingChildren.length > 0) {
|
|
28751
|
+
return [__spreadProps(__spreadValues({}, account), { sub_accounts: matchingChildren, isMatching: true })];
|
|
28752
|
+
}
|
|
28753
|
+
if (isMatching) {
|
|
28754
|
+
return [__spreadProps(__spreadValues({}, account), { isMatching: true })];
|
|
28755
|
+
}
|
|
28756
|
+
return [];
|
|
28757
|
+
});
|
|
28758
|
+
};
|
|
28759
|
+
var skippedChars = ["$", ","];
|
|
28760
|
+
var getMatchedTextIndices = ({
|
|
28761
|
+
text,
|
|
28762
|
+
query,
|
|
28763
|
+
isMatching
|
|
28764
|
+
}) => {
|
|
28765
|
+
if (!query || !isMatching) return null;
|
|
28766
|
+
const normalize = (s) => s.replace(/[$,]/g, "").toLowerCase();
|
|
28767
|
+
const normalizedText = normalize(text);
|
|
28768
|
+
const normalizedQuery = normalize(query);
|
|
28769
|
+
const normalizedMatchStartIdx = normalizedText.indexOf(normalizedQuery);
|
|
28770
|
+
if (normalizedMatchStartIdx === -1) return null;
|
|
28771
|
+
let positionInNormalizedText = 0, matchStartIdx = 0;
|
|
28772
|
+
while (positionInNormalizedText < normalizedMatchStartIdx && matchStartIdx < text.length) {
|
|
28773
|
+
if (!skippedChars.includes(text[matchStartIdx])) positionInNormalizedText++;
|
|
28774
|
+
matchStartIdx++;
|
|
28775
|
+
}
|
|
28776
|
+
if (skippedChars.includes(text[matchStartIdx]) && query[0] !== text[matchStartIdx]) {
|
|
28777
|
+
matchStartIdx++;
|
|
28778
|
+
}
|
|
28779
|
+
let charsMatched = 0, matchEndIdx = matchStartIdx;
|
|
28780
|
+
while (charsMatched < normalizedQuery.length && matchEndIdx < text.length) {
|
|
28781
|
+
if (!skippedChars.includes(text[matchEndIdx])) charsMatched++;
|
|
28782
|
+
matchEndIdx++;
|
|
28783
|
+
}
|
|
28784
|
+
if (skippedChars.includes(text[matchEndIdx]) && query[query.length - 1] === text[matchEndIdx]) {
|
|
28785
|
+
matchEndIdx++;
|
|
28786
|
+
}
|
|
28787
|
+
return { startIdx: matchStartIdx, endIdx: matchEndIdx };
|
|
28788
|
+
};
|
|
28789
|
+
|
|
28790
|
+
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
28532
28791
|
import { jsx as jsx246, jsxs as jsxs151 } from "react/jsx-runtime";
|
|
28533
|
-
var
|
|
28792
|
+
var highlightMatch = ({ text, query, isMatching }) => {
|
|
28793
|
+
const matchedTextIndices = getMatchedTextIndices({ text, query, isMatching });
|
|
28794
|
+
if (matchedTextIndices === null) {
|
|
28795
|
+
return /* @__PURE__ */ jsx246(Span, { ellipsis: true, children: text });
|
|
28796
|
+
}
|
|
28797
|
+
const { startIdx, endIdx } = matchedTextIndices;
|
|
28798
|
+
return /* @__PURE__ */ jsxs151(Span, { ellipsis: true, children: [
|
|
28799
|
+
text.slice(0, startIdx),
|
|
28800
|
+
/* @__PURE__ */ jsx246("mark", { className: "Layer__mark", children: text.slice(startIdx, endIdx) }),
|
|
28801
|
+
text.slice(endIdx)
|
|
28802
|
+
] });
|
|
28803
|
+
};
|
|
28534
28804
|
var ChartOfAccountsTable = ({
|
|
28535
28805
|
view,
|
|
28536
28806
|
stringOverrides,
|
|
28537
28807
|
data,
|
|
28808
|
+
searchQuery,
|
|
28538
28809
|
error,
|
|
28539
28810
|
expandAll,
|
|
28540
28811
|
templateAccountsEditable = true
|
|
@@ -28543,6 +28814,7 @@ var ChartOfAccountsTable = ({
|
|
|
28543
28814
|
{
|
|
28544
28815
|
view,
|
|
28545
28816
|
data,
|
|
28817
|
+
searchQuery,
|
|
28546
28818
|
stringOverrides,
|
|
28547
28819
|
error,
|
|
28548
28820
|
expandAll,
|
|
@@ -28552,61 +28824,57 @@ var ChartOfAccountsTable = ({
|
|
|
28552
28824
|
var ChartOfAccountsTableContent = ({
|
|
28553
28825
|
stringOverrides,
|
|
28554
28826
|
data,
|
|
28827
|
+
searchQuery,
|
|
28555
28828
|
error,
|
|
28556
28829
|
expandAll,
|
|
28557
28830
|
templateAccountsEditable
|
|
28558
28831
|
}) => {
|
|
28559
|
-
const hasMountedRef = useRef26(false);
|
|
28560
28832
|
const { setAccountId } = useContext43(LedgerAccountsContext);
|
|
28561
28833
|
const { editAccount } = useContext43(ChartOfAccountsContext);
|
|
28562
|
-
const
|
|
28563
|
-
const sortedAccounts = useMemo46(() =>
|
|
28564
|
-
|
|
28565
|
-
const indexA = SORTED_STABLE_NAMES.indexOf(a.stable_name);
|
|
28566
|
-
const indexB = SORTED_STABLE_NAMES.indexOf(b.stable_name);
|
|
28567
|
-
if (indexA === -1 && indexB === -1) return 0;
|
|
28568
|
-
if (indexA === -1) return 1;
|
|
28569
|
-
if (indexB === -1) return -1;
|
|
28570
|
-
return indexA - indexB;
|
|
28571
|
-
});
|
|
28572
|
-
}, [data.accounts]);
|
|
28573
|
-
const expandableRowKeys = useMemo46(() => {
|
|
28834
|
+
const [toggledKeys, setToggledKeys] = useState60({});
|
|
28835
|
+
const sortedAccounts = useMemo46(() => sortAccountsRecursive(data.accounts), [data.accounts]);
|
|
28836
|
+
const allRowKeys = useMemo46(() => {
|
|
28574
28837
|
const keys = [];
|
|
28575
|
-
const collect = (accounts
|
|
28838
|
+
const collect = (accounts) => {
|
|
28576
28839
|
for (const account of accounts) {
|
|
28577
|
-
const key =
|
|
28840
|
+
const key = `coa-row-${account.id}`;
|
|
28578
28841
|
if (account.sub_accounts.length > 0) {
|
|
28579
28842
|
keys.push(key);
|
|
28580
|
-
collect(account.sub_accounts
|
|
28843
|
+
collect(account.sub_accounts);
|
|
28581
28844
|
}
|
|
28582
28845
|
}
|
|
28583
28846
|
};
|
|
28584
|
-
collect(data.accounts
|
|
28847
|
+
collect(data.accounts);
|
|
28585
28848
|
return keys;
|
|
28586
28849
|
}, [data.accounts]);
|
|
28587
|
-
useLayoutEffect4(() => {
|
|
28588
|
-
if (hasMountedRef.current) return;
|
|
28589
|
-
const defaultExpanded = data.accounts.map(
|
|
28590
|
-
(account) => "coa-row-" + account.id
|
|
28591
|
-
);
|
|
28592
|
-
setIsOpen(defaultExpanded);
|
|
28593
|
-
hasMountedRef.current = true;
|
|
28594
|
-
}, []);
|
|
28595
28850
|
useEffect34(() => {
|
|
28596
|
-
if (expandAll ===
|
|
28597
|
-
|
|
28598
|
-
|
|
28599
|
-
|
|
28600
|
-
|
|
28851
|
+
if (expandAll === void 0) return;
|
|
28852
|
+
setToggledKeys(
|
|
28853
|
+
Object.fromEntries(
|
|
28854
|
+
allRowKeys.map((key) => [key, expandAll === "expanded"])
|
|
28855
|
+
)
|
|
28856
|
+
);
|
|
28601
28857
|
}, [expandAll]);
|
|
28602
|
-
|
|
28858
|
+
useEffect34(() => {
|
|
28859
|
+
setToggledKeys({});
|
|
28860
|
+
}, [searchQuery]);
|
|
28861
|
+
const filteredAccounts = useMemo46(() => {
|
|
28862
|
+
if (!searchQuery) return sortedAccounts;
|
|
28863
|
+
return filterAccounts(sortedAccounts, searchQuery.toLowerCase());
|
|
28864
|
+
}, [searchQuery, sortedAccounts]);
|
|
28865
|
+
const renderChartOfAccountsDesktopRow = ({ account, index, depth, searchQuery: searchQuery2 }) => {
|
|
28603
28866
|
var _a, _b;
|
|
28867
|
+
const rowKey = `coa-row-${account.id}`;
|
|
28604
28868
|
const hasSubAccounts = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
28605
|
-
const
|
|
28869
|
+
const manuallyToggled = toggledKeys[rowKey];
|
|
28870
|
+
const isExpanded = !hasSubAccounts || manuallyToggled === true || manuallyToggled !== false && (account.isMatching || depth === 0);
|
|
28606
28871
|
const isNonEditable = !templateAccountsEditable && !!account.stable_name;
|
|
28607
28872
|
const onClickRow = (e) => {
|
|
28608
28873
|
e.stopPropagation();
|
|
28609
|
-
if (hasSubAccounts)
|
|
28874
|
+
if (!hasSubAccounts) return;
|
|
28875
|
+
setToggledKeys((prev) => __spreadProps(__spreadValues({}, prev), {
|
|
28876
|
+
[rowKey]: !isExpanded
|
|
28877
|
+
}));
|
|
28610
28878
|
};
|
|
28611
28879
|
const onClickAccountName = (e) => {
|
|
28612
28880
|
e.stopPropagation();
|
|
@@ -28637,12 +28905,28 @@ var ChartOfAccountsTableContent = ({
|
|
|
28637
28905
|
TableCell,
|
|
28638
28906
|
{
|
|
28639
28907
|
withExpandIcon: hasSubAccounts,
|
|
28640
|
-
children: /* @__PURE__ */ jsx246(HStack, __spreadProps(__spreadValues({}, !hasSubAccounts && { pis: "lg" }), { overflow: "hidden", children: /* @__PURE__ */ jsx246(Button2, { variant: "text", ellipsis: true, onClick: onClickAccountName, children:
|
|
28908
|
+
children: /* @__PURE__ */ jsx246(HStack, __spreadProps(__spreadValues({}, !hasSubAccounts && { pis: "lg" }), { overflow: "hidden", children: /* @__PURE__ */ jsx246(Button2, { variant: "text", ellipsis: true, onClick: onClickAccountName, children: highlightMatch({
|
|
28909
|
+
text: account.name,
|
|
28910
|
+
query: searchQuery2,
|
|
28911
|
+
isMatching: account.isMatching
|
|
28912
|
+
}) }) }))
|
|
28641
28913
|
}
|
|
28642
28914
|
),
|
|
28643
|
-
/* @__PURE__ */ jsx246(TableCell, { children: depth != 0 && (
|
|
28644
|
-
|
|
28645
|
-
|
|
28915
|
+
/* @__PURE__ */ jsx246(TableCell, { children: depth != 0 && highlightMatch({
|
|
28916
|
+
text: ((_a = account.account_type) == null ? void 0 : _a.display_name) || "",
|
|
28917
|
+
query: searchQuery2,
|
|
28918
|
+
isMatching: account.isMatching
|
|
28919
|
+
}) }),
|
|
28920
|
+
/* @__PURE__ */ jsx246(TableCell, { children: depth != 0 && highlightMatch({
|
|
28921
|
+
text: ((_b = account.account_subtype) == null ? void 0 : _b.display_name) || "",
|
|
28922
|
+
query: searchQuery2,
|
|
28923
|
+
isMatching: account.isMatching
|
|
28924
|
+
}) }),
|
|
28925
|
+
/* @__PURE__ */ jsx246(TableCell, { children: highlightMatch({
|
|
28926
|
+
text: convertCentsToCurrency(account.balance) || "",
|
|
28927
|
+
query: searchQuery2,
|
|
28928
|
+
isMatching: account.isMatching
|
|
28929
|
+
}) }),
|
|
28646
28930
|
/* @__PURE__ */ jsx246(TableCell, { align: "right" /* RIGHT */, children: /* @__PURE__ */ jsxs151(HStack, { className: "Layer__coa__actions", gap: "xs", children: [
|
|
28647
28931
|
/* @__PURE__ */ jsx246(
|
|
28648
28932
|
Button,
|
|
@@ -28671,16 +28955,25 @@ var ChartOfAccountsTableContent = ({
|
|
|
28671
28955
|
}
|
|
28672
28956
|
),
|
|
28673
28957
|
hasSubAccounts && isExpanded && account.sub_accounts.map((subItem, subIdx) => {
|
|
28674
|
-
|
|
28675
|
-
|
|
28676
|
-
|
|
28677
|
-
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
);
|
|
28958
|
+
return renderChartOfAccountsDesktopRow({
|
|
28959
|
+
account: subItem,
|
|
28960
|
+
index: subIdx,
|
|
28961
|
+
depth: depth + 1,
|
|
28962
|
+
searchQuery: searchQuery2
|
|
28963
|
+
});
|
|
28681
28964
|
})
|
|
28682
28965
|
] }, rowKey + "-" + index);
|
|
28683
28966
|
};
|
|
28967
|
+
if (filteredAccounts.length === 0) {
|
|
28968
|
+
return /* @__PURE__ */ jsx246("div", { className: "Layer__table-state-container", children: /* @__PURE__ */ jsx246(
|
|
28969
|
+
DataState,
|
|
28970
|
+
{
|
|
28971
|
+
status: "info" /* info */,
|
|
28972
|
+
title: "No accounts found",
|
|
28973
|
+
description: 'No accounts match the current filters. Click "Add Account" to create a new one.'
|
|
28974
|
+
}
|
|
28975
|
+
) });
|
|
28976
|
+
}
|
|
28684
28977
|
return /* @__PURE__ */ jsxs151(Table, { componentName: "chart-of-accounts", children: [
|
|
28685
28978
|
/* @__PURE__ */ jsxs151("colgroup", { children: [
|
|
28686
28979
|
/* @__PURE__ */ jsx246("col", { className: "Layer__chart-of-accounts--name" }),
|
|
@@ -28696,13 +28989,13 @@ var ChartOfAccountsTableContent = ({
|
|
|
28696
28989
|
/* @__PURE__ */ jsx246(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.balanceColumnHeader) || "Balance" }),
|
|
28697
28990
|
/* @__PURE__ */ jsx246(TableCell, { isHeaderCell: true })
|
|
28698
28991
|
] }) }),
|
|
28699
|
-
/* @__PURE__ */ jsx246(TableBody, { children: !error &&
|
|
28700
|
-
(account,
|
|
28992
|
+
/* @__PURE__ */ jsx246(TableBody, { children: !error && filteredAccounts.map(
|
|
28993
|
+
(account, index) => renderChartOfAccountsDesktopRow({
|
|
28701
28994
|
account,
|
|
28702
|
-
|
|
28703
|
-
|
|
28704
|
-
|
|
28705
|
-
)
|
|
28995
|
+
index,
|
|
28996
|
+
depth: 0,
|
|
28997
|
+
searchQuery
|
|
28998
|
+
})
|
|
28706
28999
|
) })
|
|
28707
29000
|
] });
|
|
28708
29001
|
};
|
|
@@ -28807,7 +29100,8 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28807
29100
|
templateAccountsEditable
|
|
28808
29101
|
}) => {
|
|
28809
29102
|
const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext44(ChartOfAccountsContext);
|
|
28810
|
-
const [expandAll, setExpandAll] =
|
|
29103
|
+
const [expandAll, setExpandAll] = useState61();
|
|
29104
|
+
const { inputValue, searchQuery, handleInputChange } = useDebouncedSearchInput({ initialInputState: "" });
|
|
28811
29105
|
return /* @__PURE__ */ jsxs153(
|
|
28812
29106
|
Panel,
|
|
28813
29107
|
{
|
|
@@ -28835,7 +29129,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28835
29129
|
{
|
|
28836
29130
|
size: "secondary" /* secondary */,
|
|
28837
29131
|
className: `Layer__${COMPONENT_NAME6}__subtitle`,
|
|
28838
|
-
children: withDateControl || withExpandAllButton ? /* @__PURE__ */ jsxs153(
|
|
29132
|
+
children: withDateControl || withExpandAllButton ? /* @__PURE__ */ jsxs153(HStack, { align: "center", gap: "xs", children: [
|
|
28839
29133
|
withDateControl && /* @__PURE__ */ jsx248(ChartOfAccountsDatePicker, {}),
|
|
28840
29134
|
withExpandAllButton && /* @__PURE__ */ jsx248(
|
|
28841
29135
|
ExpandCollapseButton,
|
|
@@ -28851,7 +29145,8 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28851
29145
|
] }) : null
|
|
28852
29146
|
}
|
|
28853
29147
|
) }),
|
|
28854
|
-
/* @__PURE__ */ jsxs153(HeaderCol, { children: [
|
|
29148
|
+
/* @__PURE__ */ jsxs153(HeaderCol, { className: "Layer__chart-of-accounts__actions", children: [
|
|
29149
|
+
/* @__PURE__ */ jsx248(SearchField, { label: "Search accounts", value: inputValue, onChange: handleInputChange }),
|
|
28855
29150
|
/* @__PURE__ */ jsx248(
|
|
28856
29151
|
AccountBalancesDownloadButton,
|
|
28857
29152
|
{
|
|
@@ -28874,6 +29169,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28874
29169
|
{
|
|
28875
29170
|
view,
|
|
28876
29171
|
data,
|
|
29172
|
+
searchQuery,
|
|
28877
29173
|
error,
|
|
28878
29174
|
stringOverrides,
|
|
28879
29175
|
expandAll,
|
|
@@ -28890,17 +29186,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28890
29186
|
isLoading: isValidating || isLoading
|
|
28891
29187
|
}
|
|
28892
29188
|
) }) : null,
|
|
28893
|
-
(!data || isLoading) && !error ? /* @__PURE__ */ jsx248("div", { className: `Layer__${COMPONENT_NAME6}__loader-container`, children: /* @__PURE__ */ jsx248(Loader2, {}) }) : null
|
|
28894
|
-
!isLoading && !error && (data == null ? void 0 : data.accounts.length) === 0 ? /* @__PURE__ */ jsx248("div", { className: "Layer__table-state-container", children: /* @__PURE__ */ jsx248(
|
|
28895
|
-
DataState,
|
|
28896
|
-
{
|
|
28897
|
-
status: "info" /* info */,
|
|
28898
|
-
title: "Accounts were not found",
|
|
28899
|
-
description: 'New account can be created with "Add Account".',
|
|
28900
|
-
onRefresh: () => refetch(),
|
|
28901
|
-
isLoading: isValidating
|
|
28902
|
-
}
|
|
28903
|
-
) }) : null
|
|
29189
|
+
(!data || isLoading) && !error ? /* @__PURE__ */ jsx248("div", { className: `Layer__${COMPONENT_NAME6}__loader-container`, children: /* @__PURE__ */ jsx248(Loader2, {}) }) : null
|
|
28904
29190
|
]
|
|
28905
29191
|
}
|
|
28906
29192
|
);
|
|
@@ -28910,7 +29196,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
28910
29196
|
import {
|
|
28911
29197
|
useContext as useContext47,
|
|
28912
29198
|
useMemo as useMemo48,
|
|
28913
|
-
useState as
|
|
29199
|
+
useState as useState62
|
|
28914
29200
|
} from "react";
|
|
28915
29201
|
|
|
28916
29202
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
@@ -29441,7 +29727,7 @@ var LedgerAccount = ({
|
|
|
29441
29727
|
stringOverrides
|
|
29442
29728
|
}) => {
|
|
29443
29729
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
29444
|
-
const [currentPage, setCurrentPage] =
|
|
29730
|
+
const [currentPage, setCurrentPage] = useState62(1);
|
|
29445
29731
|
const { data: accountData } = useContext47(ChartOfAccountsContext);
|
|
29446
29732
|
const {
|
|
29447
29733
|
data: rawData,
|
|
@@ -29657,7 +29943,7 @@ var JournalContext = createContext22({
|
|
|
29657
29943
|
});
|
|
29658
29944
|
|
|
29659
29945
|
// src/hooks/useJournal/useJournal.tsx
|
|
29660
|
-
import { useState as
|
|
29946
|
+
import { useState as useState63, useMemo as useMemo50, useCallback as useCallback34 } from "react";
|
|
29661
29947
|
|
|
29662
29948
|
// src/features/ledger/entries/api/useListLedgerEntries.ts
|
|
29663
29949
|
import useSWRInfinite4 from "swr/infinite";
|
|
@@ -29759,11 +30045,11 @@ var useJournal = () => {
|
|
|
29759
30045
|
} = useLayerContext();
|
|
29760
30046
|
const { apiUrl } = useEnvironment();
|
|
29761
30047
|
const { data: auth } = useAuth();
|
|
29762
|
-
const [selectedEntryId, setSelectedEntryId] =
|
|
29763
|
-
const [form, setForm] =
|
|
29764
|
-
const [addingEntry, setAddingEntry] =
|
|
29765
|
-
const [sendingForm, setSendingForm] =
|
|
29766
|
-
const [apiError, setApiError] =
|
|
30048
|
+
const [selectedEntryId, setSelectedEntryId] = useState63();
|
|
30049
|
+
const [form, setForm] = useState63();
|
|
30050
|
+
const [addingEntry, setAddingEntry] = useState63(false);
|
|
30051
|
+
const [sendingForm, setSendingForm] = useState63(false);
|
|
30052
|
+
const [apiError, setApiError] = useState63(void 0);
|
|
29767
30053
|
const {
|
|
29768
30054
|
data: paginatedData,
|
|
29769
30055
|
isLoading,
|
|
@@ -30036,13 +30322,13 @@ var useJournal = () => {
|
|
|
30036
30322
|
};
|
|
30037
30323
|
|
|
30038
30324
|
// src/components/JournalTable/JournalTableWithPanel.tsx
|
|
30039
|
-
import { useContext as useContext54, useMemo as useMemo53, useState as
|
|
30325
|
+
import { useContext as useContext54, useMemo as useMemo53, useState as useState65 } from "react";
|
|
30040
30326
|
|
|
30041
30327
|
// src/components/JournalSidebar/JournalSidebar.tsx
|
|
30042
30328
|
import { useContext as useContext52 } from "react";
|
|
30043
30329
|
|
|
30044
30330
|
// src/components/JournalEntryDetails/JournalEntryDetails.tsx
|
|
30045
|
-
import { useContext as useContext49, useMemo as useMemo51, useState as
|
|
30331
|
+
import { useContext as useContext49, useMemo as useMemo51, useState as useState64 } from "react";
|
|
30046
30332
|
import { jsx as jsx256, jsxs as jsxs160 } from "react/jsx-runtime";
|
|
30047
30333
|
var JournalEntryDetails = () => {
|
|
30048
30334
|
var _a, _b, _c, _d;
|
|
@@ -30055,8 +30341,8 @@ var JournalEntryDetails = () => {
|
|
|
30055
30341
|
reverseEntry,
|
|
30056
30342
|
refetch
|
|
30057
30343
|
} = useContext49(JournalContext);
|
|
30058
|
-
const [reverseEntryProcessing, setReverseEntryProcessing] =
|
|
30059
|
-
const [reverseEntryError, setReverseEntryError] =
|
|
30344
|
+
const [reverseEntryProcessing, setReverseEntryProcessing] = useState64(false);
|
|
30345
|
+
const [reverseEntryError, setReverseEntryError] = useState64();
|
|
30060
30346
|
const entry = useMemo51(() => {
|
|
30061
30347
|
if (selectedEntryId && data) {
|
|
30062
30348
|
return data.find((x) => x.id === selectedEntryId);
|
|
@@ -30633,7 +30919,7 @@ var JournalSidebar = ({
|
|
|
30633
30919
|
};
|
|
30634
30920
|
|
|
30635
30921
|
// src/components/JournalTable/JournalTable.tsx
|
|
30636
|
-
import { Fragment as Fragment39, useContext as useContext53, useLayoutEffect as
|
|
30922
|
+
import { Fragment as Fragment39, useContext as useContext53, useLayoutEffect as useLayoutEffect4 } from "react";
|
|
30637
30923
|
import { parseISO as parseISO15, format as formatTime12 } from "date-fns";
|
|
30638
30924
|
import { jsx as jsx260, jsxs as jsxs163 } from "react/jsx-runtime";
|
|
30639
30925
|
var accountName = (row) => {
|
|
@@ -30663,7 +30949,7 @@ var JournalTableContent = ({
|
|
|
30663
30949
|
}) => {
|
|
30664
30950
|
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext53(JournalContext);
|
|
30665
30951
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
30666
|
-
|
|
30952
|
+
useLayoutEffect4(() => {
|
|
30667
30953
|
if (data.length > 0) {
|
|
30668
30954
|
setIsOpen(data.map((x) => `journal-row-${x.id}`));
|
|
30669
30955
|
}
|
|
@@ -30847,7 +31133,7 @@ var JournalTableWithPanel = ({
|
|
|
30847
31133
|
stringOverrides,
|
|
30848
31134
|
view
|
|
30849
31135
|
}) => {
|
|
30850
|
-
const [currentPage, setCurrentPage] =
|
|
31136
|
+
const [currentPage, setCurrentPage] = useState65(1);
|
|
30851
31137
|
const {
|
|
30852
31138
|
data: rawData,
|
|
30853
31139
|
isLoading,
|
|
@@ -31064,7 +31350,7 @@ var SmileIcon = (_a) => {
|
|
|
31064
31350
|
var SmileIcon_default = SmileIcon;
|
|
31065
31351
|
|
|
31066
31352
|
// src/components/Tasks/TasksListItem.tsx
|
|
31067
|
-
import { useEffect as useEffect36, useMemo as useMemo54, useState as
|
|
31353
|
+
import { useEffect as useEffect36, useMemo as useMemo54, useState as useState66 } from "react";
|
|
31068
31354
|
import classNames76 from "classnames";
|
|
31069
31355
|
|
|
31070
31356
|
// src/utils/bookkeeping/tasks/getBookkeepingTaskStatusIcon.tsx
|
|
@@ -31392,9 +31678,9 @@ var TasksListItem = ({
|
|
|
31392
31678
|
defaultOpen
|
|
31393
31679
|
}) => {
|
|
31394
31680
|
var _a, _b;
|
|
31395
|
-
const [isOpen, setIsOpen] =
|
|
31396
|
-
const [userResponse, setUserResponse] =
|
|
31397
|
-
const [selectedFiles, setSelectedFiles] =
|
|
31681
|
+
const [isOpen, setIsOpen] = useState66(defaultOpen);
|
|
31682
|
+
const [userResponse, setUserResponse] = useState66((_a = task.user_response) != null ? _a : "");
|
|
31683
|
+
const [selectedFiles, setSelectedFiles] = useState66();
|
|
31398
31684
|
const { trigger: handleSubmitUserResponseForTask } = useSubmitUserResponseForTask();
|
|
31399
31685
|
const { trigger: handleUploadDocumentsForTask } = useUploadDocumentsForTask();
|
|
31400
31686
|
const { trigger: handleDeleteUploadsOnTask } = useDeleteUploadsOnTask();
|
|
@@ -31572,7 +31858,7 @@ var MobilePanel = ({ header, children, open: open2, onClose, className }) => {
|
|
|
31572
31858
|
};
|
|
31573
31859
|
|
|
31574
31860
|
// src/components/Tasks/TasksListMobile.tsx
|
|
31575
|
-
import { useState as
|
|
31861
|
+
import { useState as useState67 } from "react";
|
|
31576
31862
|
import { jsx as jsx269, jsxs as jsxs169 } from "react/jsx-runtime";
|
|
31577
31863
|
var MOBILE_SHOW_UNRESOLVED_TASKS_COUNT = 2;
|
|
31578
31864
|
var TasksListMobile = ({
|
|
@@ -31583,7 +31869,7 @@ var TasksListMobile = ({
|
|
|
31583
31869
|
pageSize,
|
|
31584
31870
|
setCurrentPage
|
|
31585
31871
|
}) => {
|
|
31586
|
-
const [showMobilePanel, setShowMobilePanel] =
|
|
31872
|
+
const [showMobilePanel, setShowMobilePanel] = useState67(false);
|
|
31587
31873
|
const unresolvedTasks = getIncompleteTasks(sortedTasks).slice(0, MOBILE_SHOW_UNRESOLVED_TASKS_COUNT);
|
|
31588
31874
|
return /* @__PURE__ */ jsxs169("div", { className: "Layer__tasks-list", children: [
|
|
31589
31875
|
unresolvedTasks.map((task, index) => /* @__PURE__ */ jsx269(
|
|
@@ -31631,9 +31917,9 @@ var TasksListMobile = ({
|
|
|
31631
31917
|
};
|
|
31632
31918
|
|
|
31633
31919
|
// src/hooks/array/usePaginatedList.ts
|
|
31634
|
-
import { useCallback as useCallback39, useMemo as useMemo55, useState as
|
|
31920
|
+
import { useCallback as useCallback39, useMemo as useMemo55, useState as useState68 } from "react";
|
|
31635
31921
|
function usePaginatedList(list, pageSize) {
|
|
31636
|
-
const [internalPageIndex, setInternalPageIndex] =
|
|
31922
|
+
const [internalPageIndex, setInternalPageIndex] = useState68(0);
|
|
31637
31923
|
const pageCount = Math.max(0, Math.ceil(list.length / pageSize));
|
|
31638
31924
|
const effectivePageIndex = Math.max(0, Math.min(internalPageIndex, pageCount - 1));
|
|
31639
31925
|
const pageItems = useMemo55(() => {
|
|
@@ -32151,7 +32437,7 @@ var TasksPanelNotification = ({
|
|
|
32151
32437
|
import { useMemo as useMemo59 } from "react";
|
|
32152
32438
|
|
|
32153
32439
|
// src/components/Tabs/Tabs.tsx
|
|
32154
|
-
import { useEffect as useEffect37, useState as
|
|
32440
|
+
import { useEffect as useEffect37, useState as useState69 } from "react";
|
|
32155
32441
|
|
|
32156
32442
|
// src/components/Tabs/Tab.tsx
|
|
32157
32443
|
import { jsx as jsx278, jsxs as jsxs176 } from "react/jsx-runtime";
|
|
@@ -32218,9 +32504,9 @@ import { jsx as jsx279, jsxs as jsxs177 } from "react/jsx-runtime";
|
|
|
32218
32504
|
import { createElement as createElement2 } from "react";
|
|
32219
32505
|
var STARTING_PADDING = 12;
|
|
32220
32506
|
var Tabs = ({ name, options, selected, onChange }) => {
|
|
32221
|
-
const [initialized, setInitialized] =
|
|
32222
|
-
const [thumbPos, setThumbPos] =
|
|
32223
|
-
const [currentWidth, setCurrentWidth] =
|
|
32507
|
+
const [initialized, setInitialized] = useState69(false);
|
|
32508
|
+
const [thumbPos, setThumbPos] = useState69({ left: 0, width: 0 });
|
|
32509
|
+
const [currentWidth, setCurrentWidth] = useState69(0);
|
|
32224
32510
|
const selectedValue = selected || options[0].value;
|
|
32225
32511
|
const baseClassName = classNames79(
|
|
32226
32512
|
"Layer__tabs",
|
|
@@ -32633,7 +32919,7 @@ function LinkAccountsContent({
|
|
|
32633
32919
|
}
|
|
32634
32920
|
|
|
32635
32921
|
// src/components/PlatformOnboarding/PlatformOnboarding.tsx
|
|
32636
|
-
import { useState as
|
|
32922
|
+
import { useState as useState71 } from "react";
|
|
32637
32923
|
|
|
32638
32924
|
// src/components/ProgressSteps/ProgressSteps.tsx
|
|
32639
32925
|
import { jsx as jsx287, jsxs as jsxs182 } from "react/jsx-runtime";
|
|
@@ -33221,7 +33507,7 @@ function useUpdateBusiness() {
|
|
|
33221
33507
|
}
|
|
33222
33508
|
|
|
33223
33509
|
// src/components/BusinessForm/useBusinessForm.ts
|
|
33224
|
-
import { useState as
|
|
33510
|
+
import { useState as useState70 } from "react";
|
|
33225
33511
|
var getPerson = (personnel) => {
|
|
33226
33512
|
const owners = personnel == null ? void 0 : personnel.filter((p) => p.roles.find((x) => x.role === "OWNER"));
|
|
33227
33513
|
if (owners && owners.length > 0) {
|
|
@@ -33232,7 +33518,7 @@ var getPerson = (personnel) => {
|
|
|
33232
33518
|
var useBusinessForm = ({ onSuccess }) => {
|
|
33233
33519
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
33234
33520
|
const { business } = useLayerContext();
|
|
33235
|
-
const [submitError, setSubmitError] =
|
|
33521
|
+
const [submitError, setSubmitError] = useState70(void 0);
|
|
33236
33522
|
const { data: personnel } = useBusinessPersonnel();
|
|
33237
33523
|
const person = getPerson(personnel);
|
|
33238
33524
|
const { trigger: createBusinessPersonnel2 } = useCreateBusinessPersonnel();
|
|
@@ -33648,7 +33934,7 @@ var PLATFORM_ONBOARDING_STEPS = [
|
|
|
33648
33934
|
}
|
|
33649
33935
|
];
|
|
33650
33936
|
var PlatformOnboarding = ({ onComplete }) => {
|
|
33651
|
-
const [step, setStep] =
|
|
33937
|
+
const [step, setStep] = useState71(PLATFORM_ONBOARDING_STEPS[0].id);
|
|
33652
33938
|
const isFirstStep = PLATFORM_ONBOARDING_STEPS[0].id === step;
|
|
33653
33939
|
const nextStep = () => {
|
|
33654
33940
|
const currentStepIndex = PLATFORM_ONBOARDING_STEPS.findIndex((s) => s.id === step);
|
|
@@ -33810,7 +34096,7 @@ var BookkeepingUpsellBar = ({
|
|
|
33810
34096
|
};
|
|
33811
34097
|
|
|
33812
34098
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
33813
|
-
import { useState as
|
|
34099
|
+
import { useState as useState72 } from "react";
|
|
33814
34100
|
|
|
33815
34101
|
// src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
|
|
33816
34102
|
import { jsx as jsx301 } from "react/jsx-runtime";
|
|
@@ -33825,14 +34111,14 @@ function BookkeepingProfitAndLossSummariesContainer({
|
|
|
33825
34111
|
import classNames81 from "classnames";
|
|
33826
34112
|
|
|
33827
34113
|
// src/views/BookkeepingOverview/useKeepInMobileViewport.tsx
|
|
33828
|
-
import { useEffect as useEffect38, useRef as
|
|
34114
|
+
import { useEffect as useEffect38, useRef as useRef27 } from "react";
|
|
33829
34115
|
var TASKS_MOBILE_VIEWPORT_WIDTH = 1100;
|
|
33830
34116
|
var useKeepInMobileViewport = () => {
|
|
33831
|
-
const upperContentRef =
|
|
33832
|
-
const targetElementRef =
|
|
33833
|
-
const lastKnownSizeRef =
|
|
33834
|
-
const lastKnownTargetPositionRef =
|
|
33835
|
-
const upperElementInFocus =
|
|
34117
|
+
const upperContentRef = useRef27(null);
|
|
34118
|
+
const targetElementRef = useRef27(null);
|
|
34119
|
+
const lastKnownSizeRef = useRef27(null);
|
|
34120
|
+
const lastKnownTargetPositionRef = useRef27(null);
|
|
34121
|
+
const upperElementInFocus = useRef27(false);
|
|
33836
34122
|
useEffect38(() => {
|
|
33837
34123
|
if (!upperContentRef.current || !targetElementRef.current) return;
|
|
33838
34124
|
lastKnownSizeRef.current = upperContentRef.current.getBoundingClientRect().height;
|
|
@@ -33890,7 +34176,7 @@ var BookkeepingOverview = ({
|
|
|
33890
34176
|
slotProps
|
|
33891
34177
|
}) => {
|
|
33892
34178
|
var _a, _b, _c, _d, _e, _f;
|
|
33893
|
-
const [pnlToggle, setPnlToggle] =
|
|
34179
|
+
const [pnlToggle, setPnlToggle] = useState72("expenses");
|
|
33894
34180
|
const [width] = useWindowSize();
|
|
33895
34181
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
33896
34182
|
const { upperContentRef, targetElementRef, upperElementInFocus } = useKeepInMobileViewport();
|
|
@@ -34021,7 +34307,7 @@ var BookkeepingOverview = ({
|
|
|
34021
34307
|
};
|
|
34022
34308
|
|
|
34023
34309
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
34024
|
-
import { useState as
|
|
34310
|
+
import { useState as useState73 } from "react";
|
|
34025
34311
|
import classNames82 from "classnames";
|
|
34026
34312
|
import { jsx as jsx303, jsxs as jsxs194 } from "react/jsx-runtime";
|
|
34027
34313
|
var AccountingOverview = ({
|
|
@@ -34037,7 +34323,7 @@ var AccountingOverview = ({
|
|
|
34037
34323
|
slotProps
|
|
34038
34324
|
}) => {
|
|
34039
34325
|
var _a, _b, _c, _d, _e;
|
|
34040
|
-
const [pnlToggle, setPnlToggle] =
|
|
34326
|
+
const [pnlToggle, setPnlToggle] = useState73("expenses");
|
|
34041
34327
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
34042
34328
|
return /* @__PURE__ */ jsx303(
|
|
34043
34329
|
ProfitAndLoss,
|
|
@@ -34208,7 +34494,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
34208
34494
|
};
|
|
34209
34495
|
|
|
34210
34496
|
// src/views/GeneralLedger/GeneralLedger.tsx
|
|
34211
|
-
import { useState as
|
|
34497
|
+
import { useState as useState74 } from "react";
|
|
34212
34498
|
import { jsx as jsx305, jsxs as jsxs196 } from "react/jsx-runtime";
|
|
34213
34499
|
var GeneralLedgerView = ({
|
|
34214
34500
|
title,
|
|
@@ -34217,7 +34503,7 @@ var GeneralLedgerView = ({
|
|
|
34217
34503
|
stringOverrides,
|
|
34218
34504
|
chartOfAccountsOptions
|
|
34219
34505
|
}) => {
|
|
34220
|
-
const [activeTab, setActiveTab] =
|
|
34506
|
+
const [activeTab, setActiveTab] = useState74("chartOfAccounts");
|
|
34221
34507
|
return /* @__PURE__ */ jsx305(ProfitAndLoss, { asContainer: false, children: /* @__PURE__ */ jsxs196(
|
|
34222
34508
|
View,
|
|
34223
34509
|
{
|
|
@@ -34259,7 +34545,7 @@ var GeneralLedgerView = ({
|
|
|
34259
34545
|
};
|
|
34260
34546
|
|
|
34261
34547
|
// src/views/ProjectProfitability/ProjectProfitability.tsx
|
|
34262
|
-
import { useState as
|
|
34548
|
+
import { useState as useState75 } from "react";
|
|
34263
34549
|
import Select4 from "react-select";
|
|
34264
34550
|
import { Fragment as Fragment50, jsx as jsx306, jsxs as jsxs197 } from "react/jsx-runtime";
|
|
34265
34551
|
var ProjectProfitabilityView = ({
|
|
@@ -34269,9 +34555,9 @@ var ProjectProfitabilityView = ({
|
|
|
34269
34555
|
datePickerMode = "monthPicker",
|
|
34270
34556
|
csvMoneyFormat = "DOLLAR_STRING"
|
|
34271
34557
|
}) => {
|
|
34272
|
-
const [activeTab, setActiveTab] =
|
|
34273
|
-
const [tagFilter, setTagFilter] =
|
|
34274
|
-
const [pnlTagFilter, setPnlTagFilter] =
|
|
34558
|
+
const [activeTab, setActiveTab] = useState75("overview");
|
|
34559
|
+
const [tagFilter, setTagFilter] = useState75(null);
|
|
34560
|
+
const [pnlTagFilter, setPnlTagFilter] = useState75(
|
|
34275
34561
|
void 0
|
|
34276
34562
|
);
|
|
34277
34563
|
const isOptionSelected = (option, selectValue) => {
|
|
@@ -34373,7 +34659,7 @@ var ProjectProfitabilityView = ({
|
|
|
34373
34659
|
import { createContext as createContext23, useContext as useContext58 } from "react";
|
|
34374
34660
|
|
|
34375
34661
|
// src/hooks/useBills.tsx
|
|
34376
|
-
import { useMemo as useMemo60, useState as
|
|
34662
|
+
import { useMemo as useMemo60, useState as useState76 } from "react";
|
|
34377
34663
|
import { endOfMonth as endOfMonth14, startOfMonth as startOfMonth17, sub as sub3 } from "date-fns";
|
|
34378
34664
|
import useSWRInfinite5 from "swr/infinite";
|
|
34379
34665
|
var PAGE_SIZE = 20;
|
|
@@ -34381,15 +34667,15 @@ var useBills = () => {
|
|
|
34381
34667
|
const { businessId } = useLayerContext();
|
|
34382
34668
|
const { data: auth } = useAuth();
|
|
34383
34669
|
const { apiUrl } = useEnvironment();
|
|
34384
|
-
const [status, setStatus] =
|
|
34385
|
-
const [vendor, setVendor] =
|
|
34386
|
-
const [billInDetails, setBillInDetails] =
|
|
34387
|
-
const [showBillInDetails, setShowBillInDetails] =
|
|
34388
|
-
const [dateRange, setDateRange] =
|
|
34670
|
+
const [status, setStatus] = useState76("UNPAID");
|
|
34671
|
+
const [vendor, setVendor] = useState76(null);
|
|
34672
|
+
const [billInDetails, setBillInDetails] = useState76();
|
|
34673
|
+
const [showBillInDetails, setShowBillInDetails] = useState76(false);
|
|
34674
|
+
const [dateRange, setDateRange] = useState76({
|
|
34389
34675
|
startDate: sub3(startOfMonth17(/* @__PURE__ */ new Date()), { years: 1 }),
|
|
34390
34676
|
endDate: endOfMonth14(/* @__PURE__ */ new Date())
|
|
34391
34677
|
});
|
|
34392
|
-
const [currentPage, setCurrentPage] =
|
|
34678
|
+
const [currentPage, setCurrentPage] = useState76(1);
|
|
34393
34679
|
const openBillDetails = (bill) => {
|
|
34394
34680
|
setBillInDetails(bill);
|
|
34395
34681
|
setShowBillInDetails(true);
|
|
@@ -34506,7 +34792,7 @@ var useBills = () => {
|
|
|
34506
34792
|
};
|
|
34507
34793
|
|
|
34508
34794
|
// src/components/Bills/useBillsRecordPayment.ts
|
|
34509
|
-
import { useEffect as useEffect39, useMemo as useMemo61, useState as
|
|
34795
|
+
import { useEffect as useEffect39, useMemo as useMemo61, useState as useState77 } from "react";
|
|
34510
34796
|
import useSWRMutation25 from "swr/mutation";
|
|
34511
34797
|
function buildKey37({
|
|
34512
34798
|
access_token: accessToken,
|
|
@@ -34529,13 +34815,13 @@ var useBillsRecordPayment = ({ refetchAllBills }) => {
|
|
|
34529
34815
|
const { data: auth } = useAuth();
|
|
34530
34816
|
const { apiUrl } = useEnvironment();
|
|
34531
34817
|
const { billInDetails, openBillDetails } = useBillsContext();
|
|
34532
|
-
const [showRecordPaymentForm, setShowRecordPaymentForm] =
|
|
34533
|
-
const [bulkSelectionActive, setBulkSelectionActive] =
|
|
34534
|
-
const [vendor, setVendorState] =
|
|
34535
|
-
const [paymentDate, setPaymentDate] =
|
|
34536
|
-
const [paymentMethod, setPaymentMethod] =
|
|
34537
|
-
const [billsToPay, setBillsToPay] =
|
|
34538
|
-
const [dataSaved, setDataSaved] =
|
|
34818
|
+
const [showRecordPaymentForm, setShowRecordPaymentForm] = useState77(false);
|
|
34819
|
+
const [bulkSelectionActive, setBulkSelectionActive] = useState77(false);
|
|
34820
|
+
const [vendor, setVendorState] = useState77();
|
|
34821
|
+
const [paymentDate, setPaymentDate] = useState77(/* @__PURE__ */ new Date());
|
|
34822
|
+
const [paymentMethod, setPaymentMethod] = useState77("ACH");
|
|
34823
|
+
const [billsToPay, setBillsToPay] = useState77([]);
|
|
34824
|
+
const [dataSaved, setDataSaved] = useState77(false);
|
|
34539
34825
|
const openBulkSelection = () => {
|
|
34540
34826
|
setBulkSelectionActive(true);
|
|
34541
34827
|
};
|
|
@@ -34850,14 +35136,14 @@ var BillContextWithRecordPayment = ({ children }) => {
|
|
|
34850
35136
|
};
|
|
34851
35137
|
|
|
34852
35138
|
// src/components/Bills/useBillForm.ts
|
|
34853
|
-
import { useState as
|
|
35139
|
+
import { useState as useState78 } from "react";
|
|
34854
35140
|
import { useForm as useForm5, useStore as useStore5 } from "@tanstack/react-form";
|
|
34855
35141
|
var useBillForm = (bill) => {
|
|
34856
35142
|
var _a, _b, _c, _d;
|
|
34857
35143
|
const { businessId, addToast } = useLayerContext();
|
|
34858
35144
|
const { apiUrl } = useEnvironment();
|
|
34859
35145
|
const { data: auth } = useAuth();
|
|
34860
|
-
const [submitError, setSubmitError] =
|
|
35146
|
+
const [submitError, setSubmitError] = useState78(void 0);
|
|
34861
35147
|
const { openBillDetails, refetch } = useBillsContext();
|
|
34862
35148
|
const form = useForm5({
|
|
34863
35149
|
defaultValues: {
|
|
@@ -36484,7 +36770,7 @@ var BillsViewContent = ({
|
|
|
36484
36770
|
};
|
|
36485
36771
|
|
|
36486
36772
|
// src/views/Reports/Reports.tsx
|
|
36487
|
-
import { useState as
|
|
36773
|
+
import { useState as useState79 } from "react";
|
|
36488
36774
|
import { Fragment as Fragment56, jsx as jsx326, jsxs as jsxs207 } from "react/jsx-runtime";
|
|
36489
36775
|
var getOptions = (enabledReports) => {
|
|
36490
36776
|
return [
|
|
@@ -36512,7 +36798,7 @@ var Reports = ({
|
|
|
36512
36798
|
statementOfCashFlowConfig
|
|
36513
36799
|
}) => {
|
|
36514
36800
|
var _a;
|
|
36515
|
-
const [activeTab, setActiveTab] =
|
|
36801
|
+
const [activeTab, setActiveTab] = useState79(enabledReports[0]);
|
|
36516
36802
|
const { view, containerRef } = useElementViewSize();
|
|
36517
36803
|
const options = getOptions(enabledReports);
|
|
36518
36804
|
const defaultTitle4 = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
|
|
@@ -36571,11 +36857,11 @@ var ReportsPanel = ({
|
|
|
36571
36857
|
};
|
|
36572
36858
|
|
|
36573
36859
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
36574
|
-
import { useContext as useContext60, useRef as
|
|
36860
|
+
import { useContext as useContext60, useRef as useRef28 } from "react";
|
|
36575
36861
|
import { Fragment as Fragment57, jsx as jsx327, jsxs as jsxs208 } from "react/jsx-runtime";
|
|
36576
36862
|
var COMPONENT_NAME9 = "profit-and-loss";
|
|
36577
36863
|
var ProfitAndLossView = (props) => {
|
|
36578
|
-
const containerRef =
|
|
36864
|
+
const containerRef = useRef28(null);
|
|
36579
36865
|
return /* @__PURE__ */ jsx327(Container, { name: COMPONENT_NAME9, ref: containerRef, children: /* @__PURE__ */ jsx327(ProfitAndLoss, { children: /* @__PURE__ */ jsx327(ProfitAndLossPanel, __spreadValues({ containerRef }, props)) }) });
|
|
36580
36866
|
};
|
|
36581
36867
|
var ProfitAndLossPanel = (_a) => {
|