@layerfi/components 0.1.103 → 0.1.104-alpha

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.
@@ -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.103";
5573
+ var version = "0.1.104-alpha";
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
- descriptionFilter: descriptionFilter2,
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/domain/transactions/searchField/TransactionsSearchField.tsx
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/domain/transactions/searchField/TransactionsSearchField.tsx
20467
+ // src/components/SearchField/SearchField.tsx
20465
20468
  import { jsx as jsx160, jsxs as jsxs98 } from "react/jsx-runtime";
20466
- var CLASS_NAME9 = "Layer__TransactionsSearchField";
20467
- function TransactionsSearchField(_a) {
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
- slot: "search",
20475
- placeholder: "Search transactions",
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
- descriptionFilter,
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
- descriptionFilter,
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.descriptionFilter) != null ? _a : "";
21935
+ return (_a = filters == null ? void 0 : filters.query) != null ? _a : "";
21934
21936
  });
21935
21937
  const debouncedSetDescription = useDebounce((value) => {
21936
- setFilters({ descriptionFilter: value });
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
- TransactionsSearchField,
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.descriptionFilter),
22400
+ isFiltered: Boolean(filters == null ? void 0 : filters.query),
22398
22401
  isLoadingWithoutData
22399
22402
  }
22400
22403
  ) : null,
@@ -28188,7 +28191,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
28188
28191
  };
28189
28192
 
28190
28193
  // src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
28191
- import { useContext as useContext44, useState as useState60 } from "react";
28194
+ import { useContext as useContext44, useState as useState61 } from "react";
28192
28195
 
28193
28196
  // src/icons/Plus.tsx
28194
28197
  import { jsx as jsx241, jsxs as jsxs149 } from "react/jsx-runtime";
@@ -28498,7 +28501,7 @@ var ChartOfAccountsSidebar = ({
28498
28501
  };
28499
28502
 
28500
28503
  // src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
28501
- import { Fragment as Fragment34, useContext as useContext43, useEffect as useEffect34, useLayoutEffect as useLayoutEffect4, useMemo as useMemo46, useRef as useRef26 } from "react";
28504
+ import { Fragment as Fragment34, useContext as useContext43, useEffect as useEffect34, useMemo as useMemo46, useState as useState60 } from "react";
28502
28505
 
28503
28506
  // src/icons/Edit2.tsx
28504
28507
  import { jsx as jsx245 } from "react/jsx-runtime";
@@ -28529,12 +28532,172 @@ var Edit2_default = Edit2;
28529
28532
 
28530
28533
  // src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
28531
28534
  import { List } from "lucide-react";
28535
+
28536
+ // src/components/ChartOfAccountsTable/utils/types.ts
28537
+ var LedgerAccountTypeOrderEnum = /* @__PURE__ */ ((LedgerAccountTypeOrderEnum2) => {
28538
+ LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["ASSET"] = 0] = "ASSET";
28539
+ LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["LIABILITY"] = 1] = "LIABILITY";
28540
+ LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["EQUITY"] = 2] = "EQUITY";
28541
+ LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["REVENUE"] = 3] = "REVENUE";
28542
+ LedgerAccountTypeOrderEnum2[LedgerAccountTypeOrderEnum2["EXPENSES"] = 4] = "EXPENSES";
28543
+ return LedgerAccountTypeOrderEnum2;
28544
+ })(LedgerAccountTypeOrderEnum || {});
28545
+ var LedgerAccountSubtypeOrderEnum = /* @__PURE__ */ ((LedgerAccountSubtypeOrderEnum2) => {
28546
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["BANK_ACCOUNTS"] = 0] = "BANK_ACCOUNTS";
28547
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CASH"] = 1] = "CASH";
28548
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNDEPOSITED_FUNDS"] = 2] = "UNDEPOSITED_FUNDS";
28549
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PAYMENT_PROCESSOR_CLEARING_ACCOUNT"] = 3] = "PAYMENT_PROCESSOR_CLEARING_ACCOUNT";
28550
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INBOUND_PAYMENT_METHOD_CLEARING"] = 4] = "INBOUND_PAYMENT_METHOD_CLEARING";
28551
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ACCOUNTS_RECEIVABLE"] = 5] = "ACCOUNTS_RECEIVABLE";
28552
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INVENTORY"] = 6] = "INVENTORY";
28553
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CURRENT_ASSET"] = 7] = "CURRENT_ASSET";
28554
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["FIXED_ASSET"] = 8] = "FIXED_ASSET";
28555
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INTANGIBLE_ASSET"] = 9] = "INTANGIBLE_ASSET";
28556
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PREPAID_EXPENSES"] = 10] = "PREPAID_EXPENSES";
28557
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["DEVELOPMENT_COSTS"] = 11] = "DEVELOPMENT_COSTS";
28558
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CREDIT_CARD"] = 12] = "CREDIT_CARD";
28559
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ACCOUNTS_PAYABLE"] = 13] = "ACCOUNTS_PAYABLE";
28560
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["LINE_OF_CREDIT"] = 14] = "LINE_OF_CREDIT";
28561
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["REFUND_LIABILITIES"] = 15] = "REFUND_LIABILITIES";
28562
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PAYROLL_LIABILITY"] = 16] = "PAYROLL_LIABILITY";
28563
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["SALES_TAXES_PAYABLE"] = 17] = "SALES_TAXES_PAYABLE";
28564
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_TAXES_PAYABLE"] = 18] = "OTHER_TAXES_PAYABLE";
28565
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["TIPS"] = 19] = "TIPS";
28566
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNEARNED_REVENUE"] = 20] = "UNEARNED_REVENUE";
28567
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNDEPOSITED_OUTFLOWS"] = 21] = "UNDEPOSITED_OUTFLOWS";
28568
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OUTGOING_PAYMENT_CLEARING_ACCOUNT"] = 22] = "OUTGOING_PAYMENT_CLEARING_ACCOUNT";
28569
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_CURRENT_LIABILITY"] = 23] = "OTHER_CURRENT_LIABILITY";
28570
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["SHAREHOLDER_LOAN"] = 24] = "SHAREHOLDER_LOAN";
28571
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["NOTES_PAYABLE"] = 25] = "NOTES_PAYABLE";
28572
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_LONG_TERM_LIABILITIES"] = 26] = "OTHER_LONG_TERM_LIABILITIES";
28573
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["CONTRIBUTIONS"] = 27] = "CONTRIBUTIONS";
28574
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["DISTRIBUTIONS"] = 28] = "DISTRIBUTIONS";
28575
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["COMMON_STOCK"] = 29] = "COMMON_STOCK";
28576
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ADDITIONAL_PAID_IN_CAPITAL"] = 30] = "ADDITIONAL_PAID_IN_CAPITAL";
28577
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["RETAINED_EARNINGS"] = 31] = "RETAINED_EARNINGS";
28578
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["ACCUMULATED_ADJUSTMENTS"] = 32] = "ACCUMULATED_ADJUSTMENTS";
28579
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OPENING_BALANCE_EQUITY"] = 33] = "OPENING_BALANCE_EQUITY";
28580
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_EQUITY"] = 34] = "OTHER_EQUITY";
28581
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["SALES"] = 35] = "SALES";
28582
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["REVENUE"] = 36] = "REVENUE";
28583
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNCATEGORIZED_REVENUE"] = 37] = "UNCATEGORIZED_REVENUE";
28584
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["RETURNS_ALLOWANCES"] = 38] = "RETURNS_ALLOWANCES";
28585
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OTHER_INCOME"] = 39] = "OTHER_INCOME";
28586
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["COGS"] = 40] = "COGS";
28587
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["OPERATING_EXPENSES"] = 41] = "OPERATING_EXPENSES";
28588
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["PAYROLL"] = 42] = "PAYROLL";
28589
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["INTEREST_EXPENSES"] = 43] = "INTEREST_EXPENSES";
28590
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["TAXES_LICENSES"] = 44] = "TAXES_LICENSES";
28591
+ LedgerAccountSubtypeOrderEnum2[LedgerAccountSubtypeOrderEnum2["UNCATEGORIZED_EXPENSE"] = 45] = "UNCATEGORIZED_EXPENSE";
28592
+ return LedgerAccountSubtypeOrderEnum2;
28593
+ })(LedgerAccountSubtypeOrderEnum || {});
28594
+
28595
+ // src/components/ChartOfAccountsTable/utils/utils.ts
28596
+ var compareByEnum = (a, b, enumMap) => {
28597
+ const aVal = a !== void 0 ? enumMap[a] : void 0;
28598
+ const bVal = b !== void 0 ? enumMap[b] : void 0;
28599
+ if (aVal !== void 0 && bVal !== void 0) return aVal - bVal;
28600
+ if (aVal === void 0 && bVal !== void 0) return 1;
28601
+ if (aVal !== void 0 && bVal === void 0) return -1;
28602
+ return 0;
28603
+ };
28604
+ var compareAccounts = (a, b) => {
28605
+ var _a, _b, _c, _d, _e, _f;
28606
+ const typeComparison = compareByEnum(
28607
+ a.account_type.value,
28608
+ b.account_type.value,
28609
+ LedgerAccountTypeOrderEnum
28610
+ );
28611
+ if (typeComparison !== 0) return typeComparison;
28612
+ const subtypeComparison = compareByEnum(
28613
+ (_a = a.account_subtype) == null ? void 0 : _a.value,
28614
+ (_b = b.account_subtype) == null ? void 0 : _b.value,
28615
+ LedgerAccountSubtypeOrderEnum
28616
+ );
28617
+ if (subtypeComparison !== 0) return subtypeComparison;
28618
+ 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 : "");
28619
+ if (subtypeNameCompare !== 0) return subtypeNameCompare;
28620
+ return a.name.localeCompare(b.name);
28621
+ };
28622
+ var sortAccountsRecursive = (accounts) => {
28623
+ return accounts.map((account) => __spreadProps(__spreadValues({}, account), {
28624
+ sub_accounts: account.sub_accounts ? sortAccountsRecursive(account.sub_accounts) : []
28625
+ })).sort(compareAccounts);
28626
+ };
28627
+ var accountMatchesQuery = (account, query) => {
28628
+ var _a;
28629
+ return [
28630
+ account.name,
28631
+ account.account_type.display_name,
28632
+ ((_a = account.account_subtype) == null ? void 0 : _a.display_name) || "",
28633
+ centsToDollars(account.balance),
28634
+ centsToDollarsWithoutCommas(account.balance),
28635
+ convertCentsToCurrency(account.balance) || ""
28636
+ ].some((field) => field.toLowerCase().includes(query));
28637
+ };
28638
+ var filterAccounts = (accounts, query) => {
28639
+ return accounts.flatMap((account) => {
28640
+ const isMatching = accountMatchesQuery(account, query);
28641
+ const matchingChildren = filterAccounts(account.sub_accounts, query);
28642
+ if (matchingChildren.length > 0) {
28643
+ return [__spreadProps(__spreadValues({}, account), { sub_accounts: matchingChildren, isMatching: true })];
28644
+ }
28645
+ if (isMatching) {
28646
+ return [__spreadProps(__spreadValues({}, account), { isMatching: true })];
28647
+ }
28648
+ return [];
28649
+ });
28650
+ };
28651
+ var skippedChars = ["$", ","];
28652
+ var getMatchedTextIndices = ({
28653
+ text,
28654
+ query,
28655
+ isMatching
28656
+ }) => {
28657
+ if (!query || !isMatching) return null;
28658
+ const normalize = (s) => s.replace(/[$,]/g, "").toLowerCase();
28659
+ const normalizedText = normalize(text);
28660
+ const normalizedQuery = normalize(query);
28661
+ const normalizedMatchStartIdx = normalizedText.indexOf(normalizedQuery);
28662
+ if (normalizedMatchStartIdx === -1) return null;
28663
+ let positionInNormalizedText = 0, matchStartIdx = 0;
28664
+ while (positionInNormalizedText < normalizedMatchStartIdx && matchStartIdx < text.length) {
28665
+ if (!skippedChars.includes(text[matchStartIdx])) positionInNormalizedText++;
28666
+ matchStartIdx++;
28667
+ }
28668
+ if (skippedChars.includes(text[matchStartIdx]) && query[0] !== text[matchStartIdx]) {
28669
+ matchStartIdx++;
28670
+ }
28671
+ let charsMatched = 0, matchEndIdx = matchStartIdx;
28672
+ while (charsMatched < normalizedQuery.length && matchEndIdx < text.length) {
28673
+ if (!skippedChars.includes(text[matchEndIdx])) charsMatched++;
28674
+ matchEndIdx++;
28675
+ }
28676
+ if (skippedChars.includes(text[matchEndIdx]) && query[query.length - 1] === text[matchEndIdx]) {
28677
+ matchEndIdx++;
28678
+ }
28679
+ return { startIdx: matchStartIdx, endIdx: matchEndIdx };
28680
+ };
28681
+
28682
+ // src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
28532
28683
  import { jsx as jsx246, jsxs as jsxs151 } from "react/jsx-runtime";
28533
- var SORTED_STABLE_NAMES = ["ASSETS", "LIABILITIES", "EQUITY", "REVENUE", "EXPENSES"];
28684
+ var highlightMatch = ({ text, query, isMatching }) => {
28685
+ const matchedTextIndices = getMatchedTextIndices({ text, query, isMatching });
28686
+ if (matchedTextIndices === null) {
28687
+ return /* @__PURE__ */ jsx246(Span, { ellipsis: true, children: text });
28688
+ }
28689
+ const { startIdx, endIdx } = matchedTextIndices;
28690
+ return /* @__PURE__ */ jsxs151(Span, { ellipsis: true, children: [
28691
+ text.slice(0, startIdx),
28692
+ /* @__PURE__ */ jsx246("mark", { className: "Layer__mark", children: text.slice(startIdx, endIdx) }),
28693
+ text.slice(endIdx)
28694
+ ] });
28695
+ };
28534
28696
  var ChartOfAccountsTable = ({
28535
28697
  view,
28536
28698
  stringOverrides,
28537
28699
  data,
28700
+ searchQuery,
28538
28701
  error,
28539
28702
  expandAll,
28540
28703
  templateAccountsEditable = true
@@ -28543,6 +28706,7 @@ var ChartOfAccountsTable = ({
28543
28706
  {
28544
28707
  view,
28545
28708
  data,
28709
+ searchQuery,
28546
28710
  stringOverrides,
28547
28711
  error,
28548
28712
  expandAll,
@@ -28552,61 +28716,57 @@ var ChartOfAccountsTable = ({
28552
28716
  var ChartOfAccountsTableContent = ({
28553
28717
  stringOverrides,
28554
28718
  data,
28719
+ searchQuery,
28555
28720
  error,
28556
28721
  expandAll,
28557
28722
  templateAccountsEditable
28558
28723
  }) => {
28559
- const hasMountedRef = useRef26(false);
28560
28724
  const { setAccountId } = useContext43(LedgerAccountsContext);
28561
28725
  const { editAccount } = useContext43(ChartOfAccountsContext);
28562
- const { isOpen, setIsOpen } = useTableExpandRow();
28563
- const sortedAccounts = useMemo46(() => {
28564
- return data.accounts.sort((a, b) => {
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(() => {
28726
+ const [toggledKeys, setToggledKeys] = useState60({});
28727
+ const sortedAccounts = useMemo46(() => sortAccountsRecursive(data.accounts), [data.accounts]);
28728
+ const allRowKeys = useMemo46(() => {
28574
28729
  const keys = [];
28575
- const collect = (accounts, parentKey) => {
28730
+ const collect = (accounts) => {
28576
28731
  for (const account of accounts) {
28577
- const key = `${parentKey}-${account.id}`;
28732
+ const key = `coa-row-${account.id}`;
28578
28733
  if (account.sub_accounts.length > 0) {
28579
28734
  keys.push(key);
28580
- collect(account.sub_accounts, key);
28735
+ collect(account.sub_accounts);
28581
28736
  }
28582
28737
  }
28583
28738
  };
28584
- collect(data.accounts, "coa-row");
28739
+ collect(data.accounts);
28585
28740
  return keys;
28586
28741
  }, [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
28742
  useEffect34(() => {
28596
- if (expandAll === "expanded") {
28597
- setIsOpen(expandableRowKeys);
28598
- } else if (expandAll === "collapsed") {
28599
- setIsOpen([]);
28600
- }
28743
+ if (expandAll === void 0) return;
28744
+ setToggledKeys(
28745
+ Object.fromEntries(
28746
+ allRowKeys.map((key) => [key, expandAll === "expanded"])
28747
+ )
28748
+ );
28601
28749
  }, [expandAll]);
28602
- const renderChartOfAccountsDesktopRow = (account, index, rowKey, depth) => {
28750
+ useEffect34(() => {
28751
+ setToggledKeys({});
28752
+ }, [searchQuery]);
28753
+ const filteredAccounts = useMemo46(() => {
28754
+ if (!searchQuery) return sortedAccounts;
28755
+ return filterAccounts(sortedAccounts, searchQuery.toLowerCase());
28756
+ }, [searchQuery, sortedAccounts]);
28757
+ const renderChartOfAccountsDesktopRow = ({ account, index, depth, searchQuery: searchQuery2 }) => {
28603
28758
  var _a, _b;
28759
+ const rowKey = `coa-row-${account.id}`;
28604
28760
  const hasSubAccounts = !!account.sub_accounts && account.sub_accounts.length > 0;
28605
- const isExpanded = !hasSubAccounts || isOpen(rowKey);
28761
+ const manuallyToggled = toggledKeys[rowKey];
28762
+ const isExpanded = !hasSubAccounts || manuallyToggled === true || manuallyToggled !== false && (account.isMatching || depth === 0);
28606
28763
  const isNonEditable = !templateAccountsEditable && !!account.stable_name;
28607
28764
  const onClickRow = (e) => {
28608
28765
  e.stopPropagation();
28609
- if (hasSubAccounts) setIsOpen(rowKey);
28766
+ if (!hasSubAccounts) return;
28767
+ setToggledKeys((prev) => __spreadProps(__spreadValues({}, prev), {
28768
+ [rowKey]: !isExpanded
28769
+ }));
28610
28770
  };
28611
28771
  const onClickAccountName = (e) => {
28612
28772
  e.stopPropagation();
@@ -28637,12 +28797,28 @@ var ChartOfAccountsTableContent = ({
28637
28797
  TableCell,
28638
28798
  {
28639
28799
  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: account.name }) }))
28800
+ children: /* @__PURE__ */ jsx246(HStack, __spreadProps(__spreadValues({}, !hasSubAccounts && { pis: "lg" }), { overflow: "hidden", children: /* @__PURE__ */ jsx246(Button2, { variant: "text", ellipsis: true, onClick: onClickAccountName, children: highlightMatch({
28801
+ text: account.name,
28802
+ query: searchQuery2,
28803
+ isMatching: account.isMatching
28804
+ }) }) }))
28641
28805
  }
28642
28806
  ),
28643
- /* @__PURE__ */ jsx246(TableCell, { children: depth != 0 && ((_a = account.account_type) == null ? void 0 : _a.display_name) }),
28644
- /* @__PURE__ */ jsx246(TableCell, { children: depth != 0 && ((_b = account.account_subtype) == null ? void 0 : _b.display_name) }),
28645
- /* @__PURE__ */ jsx246(TableCell, { isCurrency: true, children: account.balance }),
28807
+ /* @__PURE__ */ jsx246(TableCell, { children: depth != 0 && highlightMatch({
28808
+ text: ((_a = account.account_type) == null ? void 0 : _a.display_name) || "",
28809
+ query: searchQuery2,
28810
+ isMatching: account.isMatching
28811
+ }) }),
28812
+ /* @__PURE__ */ jsx246(TableCell, { children: depth != 0 && highlightMatch({
28813
+ text: ((_b = account.account_subtype) == null ? void 0 : _b.display_name) || "",
28814
+ query: searchQuery2,
28815
+ isMatching: account.isMatching
28816
+ }) }),
28817
+ /* @__PURE__ */ jsx246(TableCell, { children: highlightMatch({
28818
+ text: convertCentsToCurrency(account.balance) || "",
28819
+ query: searchQuery2,
28820
+ isMatching: account.isMatching
28821
+ }) }),
28646
28822
  /* @__PURE__ */ jsx246(TableCell, { align: "right" /* RIGHT */, children: /* @__PURE__ */ jsxs151(HStack, { className: "Layer__coa__actions", gap: "xs", children: [
28647
28823
  /* @__PURE__ */ jsx246(
28648
28824
  Button,
@@ -28671,16 +28847,25 @@ var ChartOfAccountsTableContent = ({
28671
28847
  }
28672
28848
  ),
28673
28849
  hasSubAccounts && isExpanded && account.sub_accounts.map((subItem, subIdx) => {
28674
- const subRowKey = `${rowKey}-${subItem.id}`;
28675
- return renderChartOfAccountsDesktopRow(
28676
- subItem,
28677
- subIdx,
28678
- subRowKey,
28679
- depth + 1
28680
- );
28850
+ return renderChartOfAccountsDesktopRow({
28851
+ account: subItem,
28852
+ index: subIdx,
28853
+ depth: depth + 1,
28854
+ searchQuery: searchQuery2
28855
+ });
28681
28856
  })
28682
28857
  ] }, rowKey + "-" + index);
28683
28858
  };
28859
+ if (filteredAccounts.length === 0) {
28860
+ return /* @__PURE__ */ jsx246("div", { className: "Layer__table-state-container", children: /* @__PURE__ */ jsx246(
28861
+ DataState,
28862
+ {
28863
+ status: "info" /* info */,
28864
+ title: "No accounts found",
28865
+ description: 'No accounts match the current filters. Click "Add Account" to create a new one.'
28866
+ }
28867
+ ) });
28868
+ }
28684
28869
  return /* @__PURE__ */ jsxs151(Table, { componentName: "chart-of-accounts", children: [
28685
28870
  /* @__PURE__ */ jsxs151("colgroup", { children: [
28686
28871
  /* @__PURE__ */ jsx246("col", { className: "Layer__chart-of-accounts--name" }),
@@ -28696,13 +28881,13 @@ var ChartOfAccountsTableContent = ({
28696
28881
  /* @__PURE__ */ jsx246(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.balanceColumnHeader) || "Balance" }),
28697
28882
  /* @__PURE__ */ jsx246(TableCell, { isHeaderCell: true })
28698
28883
  ] }) }),
28699
- /* @__PURE__ */ jsx246(TableBody, { children: !error && sortedAccounts.map(
28700
- (account, idx) => renderChartOfAccountsDesktopRow(
28884
+ /* @__PURE__ */ jsx246(TableBody, { children: !error && filteredAccounts.map(
28885
+ (account, index) => renderChartOfAccountsDesktopRow({
28701
28886
  account,
28702
- idx,
28703
- `coa-row-${account.id}`,
28704
- 0
28705
- )
28887
+ index,
28888
+ depth: 0,
28889
+ searchQuery
28890
+ })
28706
28891
  ) })
28707
28892
  ] });
28708
28893
  };
@@ -28807,7 +28992,8 @@ var ChartOfAccountsTableWithPanel = ({
28807
28992
  templateAccountsEditable
28808
28993
  }) => {
28809
28994
  const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext44(ChartOfAccountsContext);
28810
- const [expandAll, setExpandAll] = useState60();
28995
+ const [expandAll, setExpandAll] = useState61();
28996
+ const { inputValue, searchQuery, handleInputChange } = useDebouncedSearchInput({ initialInputState: "" });
28811
28997
  return /* @__PURE__ */ jsxs153(
28812
28998
  Panel,
28813
28999
  {
@@ -28835,7 +29021,7 @@ var ChartOfAccountsTableWithPanel = ({
28835
29021
  {
28836
29022
  size: "secondary" /* secondary */,
28837
29023
  className: `Layer__${COMPONENT_NAME6}__subtitle`,
28838
- children: withDateControl || withExpandAllButton ? /* @__PURE__ */ jsxs153("div", { className: "Layer__header__actions-col", children: [
29024
+ children: withDateControl || withExpandAllButton ? /* @__PURE__ */ jsxs153(HStack, { align: "center", gap: "xs", children: [
28839
29025
  withDateControl && /* @__PURE__ */ jsx248(ChartOfAccountsDatePicker, {}),
28840
29026
  withExpandAllButton && /* @__PURE__ */ jsx248(
28841
29027
  ExpandCollapseButton,
@@ -28851,7 +29037,8 @@ var ChartOfAccountsTableWithPanel = ({
28851
29037
  ] }) : null
28852
29038
  }
28853
29039
  ) }),
28854
- /* @__PURE__ */ jsxs153(HeaderCol, { children: [
29040
+ /* @__PURE__ */ jsxs153(HeaderCol, { className: "Layer__chart-of-accounts__actions", children: [
29041
+ /* @__PURE__ */ jsx248(SearchField, { label: "Search accounts", value: inputValue, onChange: handleInputChange }),
28855
29042
  /* @__PURE__ */ jsx248(
28856
29043
  AccountBalancesDownloadButton,
28857
29044
  {
@@ -28874,6 +29061,7 @@ var ChartOfAccountsTableWithPanel = ({
28874
29061
  {
28875
29062
  view,
28876
29063
  data,
29064
+ searchQuery,
28877
29065
  error,
28878
29066
  stringOverrides,
28879
29067
  expandAll,
@@ -28890,17 +29078,7 @@ var ChartOfAccountsTableWithPanel = ({
28890
29078
  isLoading: isValidating || isLoading
28891
29079
  }
28892
29080
  ) }) : 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
29081
+ (!data || isLoading) && !error ? /* @__PURE__ */ jsx248("div", { className: `Layer__${COMPONENT_NAME6}__loader-container`, children: /* @__PURE__ */ jsx248(Loader2, {}) }) : null
28904
29082
  ]
28905
29083
  }
28906
29084
  );
@@ -28910,7 +29088,7 @@ var ChartOfAccountsTableWithPanel = ({
28910
29088
  import {
28911
29089
  useContext as useContext47,
28912
29090
  useMemo as useMemo48,
28913
- useState as useState61
29091
+ useState as useState62
28914
29092
  } from "react";
28915
29093
 
28916
29094
  // src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
@@ -29441,7 +29619,7 @@ var LedgerAccount = ({
29441
29619
  stringOverrides
29442
29620
  }) => {
29443
29621
  var _a, _b, _c, _d, _e, _f, _g, _h;
29444
- const [currentPage, setCurrentPage] = useState61(1);
29622
+ const [currentPage, setCurrentPage] = useState62(1);
29445
29623
  const { data: accountData } = useContext47(ChartOfAccountsContext);
29446
29624
  const {
29447
29625
  data: rawData,
@@ -29657,7 +29835,7 @@ var JournalContext = createContext22({
29657
29835
  });
29658
29836
 
29659
29837
  // src/hooks/useJournal/useJournal.tsx
29660
- import { useState as useState62, useMemo as useMemo50, useCallback as useCallback34 } from "react";
29838
+ import { useState as useState63, useMemo as useMemo50, useCallback as useCallback34 } from "react";
29661
29839
 
29662
29840
  // src/features/ledger/entries/api/useListLedgerEntries.ts
29663
29841
  import useSWRInfinite4 from "swr/infinite";
@@ -29759,11 +29937,11 @@ var useJournal = () => {
29759
29937
  } = useLayerContext();
29760
29938
  const { apiUrl } = useEnvironment();
29761
29939
  const { data: auth } = useAuth();
29762
- const [selectedEntryId, setSelectedEntryId] = useState62();
29763
- const [form, setForm] = useState62();
29764
- const [addingEntry, setAddingEntry] = useState62(false);
29765
- const [sendingForm, setSendingForm] = useState62(false);
29766
- const [apiError, setApiError] = useState62(void 0);
29940
+ const [selectedEntryId, setSelectedEntryId] = useState63();
29941
+ const [form, setForm] = useState63();
29942
+ const [addingEntry, setAddingEntry] = useState63(false);
29943
+ const [sendingForm, setSendingForm] = useState63(false);
29944
+ const [apiError, setApiError] = useState63(void 0);
29767
29945
  const {
29768
29946
  data: paginatedData,
29769
29947
  isLoading,
@@ -30036,13 +30214,13 @@ var useJournal = () => {
30036
30214
  };
30037
30215
 
30038
30216
  // src/components/JournalTable/JournalTableWithPanel.tsx
30039
- import { useContext as useContext54, useMemo as useMemo53, useState as useState64 } from "react";
30217
+ import { useContext as useContext54, useMemo as useMemo53, useState as useState65 } from "react";
30040
30218
 
30041
30219
  // src/components/JournalSidebar/JournalSidebar.tsx
30042
30220
  import { useContext as useContext52 } from "react";
30043
30221
 
30044
30222
  // src/components/JournalEntryDetails/JournalEntryDetails.tsx
30045
- import { useContext as useContext49, useMemo as useMemo51, useState as useState63 } from "react";
30223
+ import { useContext as useContext49, useMemo as useMemo51, useState as useState64 } from "react";
30046
30224
  import { jsx as jsx256, jsxs as jsxs160 } from "react/jsx-runtime";
30047
30225
  var JournalEntryDetails = () => {
30048
30226
  var _a, _b, _c, _d;
@@ -30055,8 +30233,8 @@ var JournalEntryDetails = () => {
30055
30233
  reverseEntry,
30056
30234
  refetch
30057
30235
  } = useContext49(JournalContext);
30058
- const [reverseEntryProcessing, setReverseEntryProcessing] = useState63(false);
30059
- const [reverseEntryError, setReverseEntryError] = useState63();
30236
+ const [reverseEntryProcessing, setReverseEntryProcessing] = useState64(false);
30237
+ const [reverseEntryError, setReverseEntryError] = useState64();
30060
30238
  const entry = useMemo51(() => {
30061
30239
  if (selectedEntryId && data) {
30062
30240
  return data.find((x) => x.id === selectedEntryId);
@@ -30633,7 +30811,7 @@ var JournalSidebar = ({
30633
30811
  };
30634
30812
 
30635
30813
  // src/components/JournalTable/JournalTable.tsx
30636
- import { Fragment as Fragment39, useContext as useContext53, useLayoutEffect as useLayoutEffect5 } from "react";
30814
+ import { Fragment as Fragment39, useContext as useContext53, useLayoutEffect as useLayoutEffect4 } from "react";
30637
30815
  import { parseISO as parseISO15, format as formatTime12 } from "date-fns";
30638
30816
  import { jsx as jsx260, jsxs as jsxs163 } from "react/jsx-runtime";
30639
30817
  var accountName = (row) => {
@@ -30663,7 +30841,7 @@ var JournalTableContent = ({
30663
30841
  }) => {
30664
30842
  const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext53(JournalContext);
30665
30843
  const { isOpen, setIsOpen } = useTableExpandRow();
30666
- useLayoutEffect5(() => {
30844
+ useLayoutEffect4(() => {
30667
30845
  if (data.length > 0) {
30668
30846
  setIsOpen(data.map((x) => `journal-row-${x.id}`));
30669
30847
  }
@@ -30847,7 +31025,7 @@ var JournalTableWithPanel = ({
30847
31025
  stringOverrides,
30848
31026
  view
30849
31027
  }) => {
30850
- const [currentPage, setCurrentPage] = useState64(1);
31028
+ const [currentPage, setCurrentPage] = useState65(1);
30851
31029
  const {
30852
31030
  data: rawData,
30853
31031
  isLoading,
@@ -31064,7 +31242,7 @@ var SmileIcon = (_a) => {
31064
31242
  var SmileIcon_default = SmileIcon;
31065
31243
 
31066
31244
  // src/components/Tasks/TasksListItem.tsx
31067
- import { useEffect as useEffect36, useMemo as useMemo54, useState as useState65 } from "react";
31245
+ import { useEffect as useEffect36, useMemo as useMemo54, useState as useState66 } from "react";
31068
31246
  import classNames76 from "classnames";
31069
31247
 
31070
31248
  // src/utils/bookkeeping/tasks/getBookkeepingTaskStatusIcon.tsx
@@ -31392,9 +31570,9 @@ var TasksListItem = ({
31392
31570
  defaultOpen
31393
31571
  }) => {
31394
31572
  var _a, _b;
31395
- const [isOpen, setIsOpen] = useState65(defaultOpen);
31396
- const [userResponse, setUserResponse] = useState65((_a = task.user_response) != null ? _a : "");
31397
- const [selectedFiles, setSelectedFiles] = useState65();
31573
+ const [isOpen, setIsOpen] = useState66(defaultOpen);
31574
+ const [userResponse, setUserResponse] = useState66((_a = task.user_response) != null ? _a : "");
31575
+ const [selectedFiles, setSelectedFiles] = useState66();
31398
31576
  const { trigger: handleSubmitUserResponseForTask } = useSubmitUserResponseForTask();
31399
31577
  const { trigger: handleUploadDocumentsForTask } = useUploadDocumentsForTask();
31400
31578
  const { trigger: handleDeleteUploadsOnTask } = useDeleteUploadsOnTask();
@@ -31572,7 +31750,7 @@ var MobilePanel = ({ header, children, open: open2, onClose, className }) => {
31572
31750
  };
31573
31751
 
31574
31752
  // src/components/Tasks/TasksListMobile.tsx
31575
- import { useState as useState66 } from "react";
31753
+ import { useState as useState67 } from "react";
31576
31754
  import { jsx as jsx269, jsxs as jsxs169 } from "react/jsx-runtime";
31577
31755
  var MOBILE_SHOW_UNRESOLVED_TASKS_COUNT = 2;
31578
31756
  var TasksListMobile = ({
@@ -31583,7 +31761,7 @@ var TasksListMobile = ({
31583
31761
  pageSize,
31584
31762
  setCurrentPage
31585
31763
  }) => {
31586
- const [showMobilePanel, setShowMobilePanel] = useState66(false);
31764
+ const [showMobilePanel, setShowMobilePanel] = useState67(false);
31587
31765
  const unresolvedTasks = getIncompleteTasks(sortedTasks).slice(0, MOBILE_SHOW_UNRESOLVED_TASKS_COUNT);
31588
31766
  return /* @__PURE__ */ jsxs169("div", { className: "Layer__tasks-list", children: [
31589
31767
  unresolvedTasks.map((task, index) => /* @__PURE__ */ jsx269(
@@ -31631,9 +31809,9 @@ var TasksListMobile = ({
31631
31809
  };
31632
31810
 
31633
31811
  // src/hooks/array/usePaginatedList.ts
31634
- import { useCallback as useCallback39, useMemo as useMemo55, useState as useState67 } from "react";
31812
+ import { useCallback as useCallback39, useMemo as useMemo55, useState as useState68 } from "react";
31635
31813
  function usePaginatedList(list, pageSize) {
31636
- const [internalPageIndex, setInternalPageIndex] = useState67(0);
31814
+ const [internalPageIndex, setInternalPageIndex] = useState68(0);
31637
31815
  const pageCount = Math.max(0, Math.ceil(list.length / pageSize));
31638
31816
  const effectivePageIndex = Math.max(0, Math.min(internalPageIndex, pageCount - 1));
31639
31817
  const pageItems = useMemo55(() => {
@@ -32151,7 +32329,7 @@ var TasksPanelNotification = ({
32151
32329
  import { useMemo as useMemo59 } from "react";
32152
32330
 
32153
32331
  // src/components/Tabs/Tabs.tsx
32154
- import { useEffect as useEffect37, useState as useState68 } from "react";
32332
+ import { useEffect as useEffect37, useState as useState69 } from "react";
32155
32333
 
32156
32334
  // src/components/Tabs/Tab.tsx
32157
32335
  import { jsx as jsx278, jsxs as jsxs176 } from "react/jsx-runtime";
@@ -32218,9 +32396,9 @@ import { jsx as jsx279, jsxs as jsxs177 } from "react/jsx-runtime";
32218
32396
  import { createElement as createElement2 } from "react";
32219
32397
  var STARTING_PADDING = 12;
32220
32398
  var Tabs = ({ name, options, selected, onChange }) => {
32221
- const [initialized, setInitialized] = useState68(false);
32222
- const [thumbPos, setThumbPos] = useState68({ left: 0, width: 0 });
32223
- const [currentWidth, setCurrentWidth] = useState68(0);
32399
+ const [initialized, setInitialized] = useState69(false);
32400
+ const [thumbPos, setThumbPos] = useState69({ left: 0, width: 0 });
32401
+ const [currentWidth, setCurrentWidth] = useState69(0);
32224
32402
  const selectedValue = selected || options[0].value;
32225
32403
  const baseClassName = classNames79(
32226
32404
  "Layer__tabs",
@@ -32633,7 +32811,7 @@ function LinkAccountsContent({
32633
32811
  }
32634
32812
 
32635
32813
  // src/components/PlatformOnboarding/PlatformOnboarding.tsx
32636
- import { useState as useState70 } from "react";
32814
+ import { useState as useState71 } from "react";
32637
32815
 
32638
32816
  // src/components/ProgressSteps/ProgressSteps.tsx
32639
32817
  import { jsx as jsx287, jsxs as jsxs182 } from "react/jsx-runtime";
@@ -33221,7 +33399,7 @@ function useUpdateBusiness() {
33221
33399
  }
33222
33400
 
33223
33401
  // src/components/BusinessForm/useBusinessForm.ts
33224
- import { useState as useState69 } from "react";
33402
+ import { useState as useState70 } from "react";
33225
33403
  var getPerson = (personnel) => {
33226
33404
  const owners = personnel == null ? void 0 : personnel.filter((p) => p.roles.find((x) => x.role === "OWNER"));
33227
33405
  if (owners && owners.length > 0) {
@@ -33232,7 +33410,7 @@ var getPerson = (personnel) => {
33232
33410
  var useBusinessForm = ({ onSuccess }) => {
33233
33411
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
33234
33412
  const { business } = useLayerContext();
33235
- const [submitError, setSubmitError] = useState69(void 0);
33413
+ const [submitError, setSubmitError] = useState70(void 0);
33236
33414
  const { data: personnel } = useBusinessPersonnel();
33237
33415
  const person = getPerson(personnel);
33238
33416
  const { trigger: createBusinessPersonnel2 } = useCreateBusinessPersonnel();
@@ -33648,7 +33826,7 @@ var PLATFORM_ONBOARDING_STEPS = [
33648
33826
  }
33649
33827
  ];
33650
33828
  var PlatformOnboarding = ({ onComplete }) => {
33651
- const [step, setStep] = useState70(PLATFORM_ONBOARDING_STEPS[0].id);
33829
+ const [step, setStep] = useState71(PLATFORM_ONBOARDING_STEPS[0].id);
33652
33830
  const isFirstStep = PLATFORM_ONBOARDING_STEPS[0].id === step;
33653
33831
  const nextStep = () => {
33654
33832
  const currentStepIndex = PLATFORM_ONBOARDING_STEPS.findIndex((s) => s.id === step);
@@ -33810,7 +33988,7 @@ var BookkeepingUpsellBar = ({
33810
33988
  };
33811
33989
 
33812
33990
  // src/views/BookkeepingOverview/BookkeepingOverview.tsx
33813
- import { useState as useState71 } from "react";
33991
+ import { useState as useState72 } from "react";
33814
33992
 
33815
33993
  // src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
33816
33994
  import { jsx as jsx301 } from "react/jsx-runtime";
@@ -33825,14 +34003,14 @@ function BookkeepingProfitAndLossSummariesContainer({
33825
34003
  import classNames81 from "classnames";
33826
34004
 
33827
34005
  // src/views/BookkeepingOverview/useKeepInMobileViewport.tsx
33828
- import { useEffect as useEffect38, useRef as useRef28 } from "react";
34006
+ import { useEffect as useEffect38, useRef as useRef27 } from "react";
33829
34007
  var TASKS_MOBILE_VIEWPORT_WIDTH = 1100;
33830
34008
  var useKeepInMobileViewport = () => {
33831
- const upperContentRef = useRef28(null);
33832
- const targetElementRef = useRef28(null);
33833
- const lastKnownSizeRef = useRef28(null);
33834
- const lastKnownTargetPositionRef = useRef28(null);
33835
- const upperElementInFocus = useRef28(false);
34009
+ const upperContentRef = useRef27(null);
34010
+ const targetElementRef = useRef27(null);
34011
+ const lastKnownSizeRef = useRef27(null);
34012
+ const lastKnownTargetPositionRef = useRef27(null);
34013
+ const upperElementInFocus = useRef27(false);
33836
34014
  useEffect38(() => {
33837
34015
  if (!upperContentRef.current || !targetElementRef.current) return;
33838
34016
  lastKnownSizeRef.current = upperContentRef.current.getBoundingClientRect().height;
@@ -33890,7 +34068,7 @@ var BookkeepingOverview = ({
33890
34068
  slotProps
33891
34069
  }) => {
33892
34070
  var _a, _b, _c, _d, _e, _f;
33893
- const [pnlToggle, setPnlToggle] = useState71("expenses");
34071
+ const [pnlToggle, setPnlToggle] = useState72("expenses");
33894
34072
  const [width] = useWindowSize();
33895
34073
  const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
33896
34074
  const { upperContentRef, targetElementRef, upperElementInFocus } = useKeepInMobileViewport();
@@ -34021,7 +34199,7 @@ var BookkeepingOverview = ({
34021
34199
  };
34022
34200
 
34023
34201
  // src/views/AccountingOverview/AccountingOverview.tsx
34024
- import { useState as useState72 } from "react";
34202
+ import { useState as useState73 } from "react";
34025
34203
  import classNames82 from "classnames";
34026
34204
  import { jsx as jsx303, jsxs as jsxs194 } from "react/jsx-runtime";
34027
34205
  var AccountingOverview = ({
@@ -34037,7 +34215,7 @@ var AccountingOverview = ({
34037
34215
  slotProps
34038
34216
  }) => {
34039
34217
  var _a, _b, _c, _d, _e;
34040
- const [pnlToggle, setPnlToggle] = useState72("expenses");
34218
+ const [pnlToggle, setPnlToggle] = useState73("expenses");
34041
34219
  const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
34042
34220
  return /* @__PURE__ */ jsx303(
34043
34221
  ProfitAndLoss,
@@ -34208,7 +34386,7 @@ var BankTransactionsWithLinkedAccounts = ({
34208
34386
  };
34209
34387
 
34210
34388
  // src/views/GeneralLedger/GeneralLedger.tsx
34211
- import { useState as useState73 } from "react";
34389
+ import { useState as useState74 } from "react";
34212
34390
  import { jsx as jsx305, jsxs as jsxs196 } from "react/jsx-runtime";
34213
34391
  var GeneralLedgerView = ({
34214
34392
  title,
@@ -34217,7 +34395,7 @@ var GeneralLedgerView = ({
34217
34395
  stringOverrides,
34218
34396
  chartOfAccountsOptions
34219
34397
  }) => {
34220
- const [activeTab, setActiveTab] = useState73("chartOfAccounts");
34398
+ const [activeTab, setActiveTab] = useState74("chartOfAccounts");
34221
34399
  return /* @__PURE__ */ jsx305(ProfitAndLoss, { asContainer: false, children: /* @__PURE__ */ jsxs196(
34222
34400
  View,
34223
34401
  {
@@ -34259,7 +34437,7 @@ var GeneralLedgerView = ({
34259
34437
  };
34260
34438
 
34261
34439
  // src/views/ProjectProfitability/ProjectProfitability.tsx
34262
- import { useState as useState74 } from "react";
34440
+ import { useState as useState75 } from "react";
34263
34441
  import Select4 from "react-select";
34264
34442
  import { Fragment as Fragment50, jsx as jsx306, jsxs as jsxs197 } from "react/jsx-runtime";
34265
34443
  var ProjectProfitabilityView = ({
@@ -34269,9 +34447,9 @@ var ProjectProfitabilityView = ({
34269
34447
  datePickerMode = "monthPicker",
34270
34448
  csvMoneyFormat = "DOLLAR_STRING"
34271
34449
  }) => {
34272
- const [activeTab, setActiveTab] = useState74("overview");
34273
- const [tagFilter, setTagFilter] = useState74(null);
34274
- const [pnlTagFilter, setPnlTagFilter] = useState74(
34450
+ const [activeTab, setActiveTab] = useState75("overview");
34451
+ const [tagFilter, setTagFilter] = useState75(null);
34452
+ const [pnlTagFilter, setPnlTagFilter] = useState75(
34275
34453
  void 0
34276
34454
  );
34277
34455
  const isOptionSelected = (option, selectValue) => {
@@ -34373,7 +34551,7 @@ var ProjectProfitabilityView = ({
34373
34551
  import { createContext as createContext23, useContext as useContext58 } from "react";
34374
34552
 
34375
34553
  // src/hooks/useBills.tsx
34376
- import { useMemo as useMemo60, useState as useState75 } from "react";
34554
+ import { useMemo as useMemo60, useState as useState76 } from "react";
34377
34555
  import { endOfMonth as endOfMonth14, startOfMonth as startOfMonth17, sub as sub3 } from "date-fns";
34378
34556
  import useSWRInfinite5 from "swr/infinite";
34379
34557
  var PAGE_SIZE = 20;
@@ -34381,15 +34559,15 @@ var useBills = () => {
34381
34559
  const { businessId } = useLayerContext();
34382
34560
  const { data: auth } = useAuth();
34383
34561
  const { apiUrl } = useEnvironment();
34384
- const [status, setStatus] = useState75("UNPAID");
34385
- const [vendor, setVendor] = useState75(null);
34386
- const [billInDetails, setBillInDetails] = useState75();
34387
- const [showBillInDetails, setShowBillInDetails] = useState75(false);
34388
- const [dateRange, setDateRange] = useState75({
34562
+ const [status, setStatus] = useState76("UNPAID");
34563
+ const [vendor, setVendor] = useState76(null);
34564
+ const [billInDetails, setBillInDetails] = useState76();
34565
+ const [showBillInDetails, setShowBillInDetails] = useState76(false);
34566
+ const [dateRange, setDateRange] = useState76({
34389
34567
  startDate: sub3(startOfMonth17(/* @__PURE__ */ new Date()), { years: 1 }),
34390
34568
  endDate: endOfMonth14(/* @__PURE__ */ new Date())
34391
34569
  });
34392
- const [currentPage, setCurrentPage] = useState75(1);
34570
+ const [currentPage, setCurrentPage] = useState76(1);
34393
34571
  const openBillDetails = (bill) => {
34394
34572
  setBillInDetails(bill);
34395
34573
  setShowBillInDetails(true);
@@ -34506,7 +34684,7 @@ var useBills = () => {
34506
34684
  };
34507
34685
 
34508
34686
  // src/components/Bills/useBillsRecordPayment.ts
34509
- import { useEffect as useEffect39, useMemo as useMemo61, useState as useState76 } from "react";
34687
+ import { useEffect as useEffect39, useMemo as useMemo61, useState as useState77 } from "react";
34510
34688
  import useSWRMutation25 from "swr/mutation";
34511
34689
  function buildKey37({
34512
34690
  access_token: accessToken,
@@ -34529,13 +34707,13 @@ var useBillsRecordPayment = ({ refetchAllBills }) => {
34529
34707
  const { data: auth } = useAuth();
34530
34708
  const { apiUrl } = useEnvironment();
34531
34709
  const { billInDetails, openBillDetails } = useBillsContext();
34532
- const [showRecordPaymentForm, setShowRecordPaymentForm] = useState76(false);
34533
- const [bulkSelectionActive, setBulkSelectionActive] = useState76(false);
34534
- const [vendor, setVendorState] = useState76();
34535
- const [paymentDate, setPaymentDate] = useState76(/* @__PURE__ */ new Date());
34536
- const [paymentMethod, setPaymentMethod] = useState76("ACH");
34537
- const [billsToPay, setBillsToPay] = useState76([]);
34538
- const [dataSaved, setDataSaved] = useState76(false);
34710
+ const [showRecordPaymentForm, setShowRecordPaymentForm] = useState77(false);
34711
+ const [bulkSelectionActive, setBulkSelectionActive] = useState77(false);
34712
+ const [vendor, setVendorState] = useState77();
34713
+ const [paymentDate, setPaymentDate] = useState77(/* @__PURE__ */ new Date());
34714
+ const [paymentMethod, setPaymentMethod] = useState77("ACH");
34715
+ const [billsToPay, setBillsToPay] = useState77([]);
34716
+ const [dataSaved, setDataSaved] = useState77(false);
34539
34717
  const openBulkSelection = () => {
34540
34718
  setBulkSelectionActive(true);
34541
34719
  };
@@ -34850,14 +35028,14 @@ var BillContextWithRecordPayment = ({ children }) => {
34850
35028
  };
34851
35029
 
34852
35030
  // src/components/Bills/useBillForm.ts
34853
- import { useState as useState77 } from "react";
35031
+ import { useState as useState78 } from "react";
34854
35032
  import { useForm as useForm5, useStore as useStore5 } from "@tanstack/react-form";
34855
35033
  var useBillForm = (bill) => {
34856
35034
  var _a, _b, _c, _d;
34857
35035
  const { businessId, addToast } = useLayerContext();
34858
35036
  const { apiUrl } = useEnvironment();
34859
35037
  const { data: auth } = useAuth();
34860
- const [submitError, setSubmitError] = useState77(void 0);
35038
+ const [submitError, setSubmitError] = useState78(void 0);
34861
35039
  const { openBillDetails, refetch } = useBillsContext();
34862
35040
  const form = useForm5({
34863
35041
  defaultValues: {
@@ -36484,7 +36662,7 @@ var BillsViewContent = ({
36484
36662
  };
36485
36663
 
36486
36664
  // src/views/Reports/Reports.tsx
36487
- import { useState as useState78 } from "react";
36665
+ import { useState as useState79 } from "react";
36488
36666
  import { Fragment as Fragment56, jsx as jsx326, jsxs as jsxs207 } from "react/jsx-runtime";
36489
36667
  var getOptions = (enabledReports) => {
36490
36668
  return [
@@ -36512,7 +36690,7 @@ var Reports = ({
36512
36690
  statementOfCashFlowConfig
36513
36691
  }) => {
36514
36692
  var _a;
36515
- const [activeTab, setActiveTab] = useState78(enabledReports[0]);
36693
+ const [activeTab, setActiveTab] = useState79(enabledReports[0]);
36516
36694
  const { view, containerRef } = useElementViewSize();
36517
36695
  const options = getOptions(enabledReports);
36518
36696
  const defaultTitle4 = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
@@ -36571,11 +36749,11 @@ var ReportsPanel = ({
36571
36749
  };
36572
36750
 
36573
36751
  // src/components/ProfitAndLossView/ProfitAndLossView.tsx
36574
- import { useContext as useContext60, useRef as useRef29 } from "react";
36752
+ import { useContext as useContext60, useRef as useRef28 } from "react";
36575
36753
  import { Fragment as Fragment57, jsx as jsx327, jsxs as jsxs208 } from "react/jsx-runtime";
36576
36754
  var COMPONENT_NAME9 = "profit-and-loss";
36577
36755
  var ProfitAndLossView = (props) => {
36578
- const containerRef = useRef29(null);
36756
+ const containerRef = useRef28(null);
36579
36757
  return /* @__PURE__ */ jsx327(Container, { name: COMPONENT_NAME9, ref: containerRef, children: /* @__PURE__ */ jsx327(ProfitAndLoss, { children: /* @__PURE__ */ jsx327(ProfitAndLossPanel, __spreadValues({ containerRef }, props)) }) });
36580
36758
  };
36581
36759
  var ProfitAndLossPanel = (_a) => {