@layerfi/components 0.1.53 → 0.1.54

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -705,18 +705,6 @@ var useBankTransactionsContext = () => useContext4(BankTransactionsContext);
705
705
  // src/hooks/useBankTransactions/useBankTransactions.tsx
706
706
  import { useEffect as useEffect3, useMemo as useMemo2, useRef, useState as useState5 } from "react";
707
707
 
708
- // src/components/BankTransactions/constants.ts
709
- var CategorizedCategories = [
710
- "CATEGORIZED" /* CATEGORIZED */,
711
- "JOURNALING" /* JOURNALING */,
712
- "SPLIT" /* SPLIT */,
713
- "MATCHED" /* MATCHED */
714
- ];
715
- var ReviewCategories = [
716
- "READY_FOR_INPUT" /* READY_FOR_INPUT */,
717
- "LAYER_REVIEW" /* LAYER_REVIEW */
718
- ];
719
-
720
708
  // src/hooks/useLinkedAccounts/useLinkedAccounts.ts
721
709
  import { useEffect as useEffect2, useState as useState4 } from "react";
722
710
  import { usePlaidLink } from "react-plaid-link";
@@ -1329,7 +1317,7 @@ var useBankTransactions = (params) => {
1329
1317
  mutate(updatedData, { revalidate: false });
1330
1318
  };
1331
1319
  const shouldHideAfterCategorize = (bankTransaction) => {
1332
- return filters?.categorizationStatus === "review" /* review */ && ReviewCategories.includes(bankTransaction.categorization_status);
1320
+ return filters?.categorizationStatus === "review" /* review */;
1333
1321
  };
1334
1322
  const removeAfterCategorize = (bankTransaction) => {
1335
1323
  if (shouldHideAfterCategorize(bankTransaction)) {
@@ -2271,6 +2259,18 @@ var Sunrise = ({ size = 12, ...props }) => /* @__PURE__ */ React16.createElement
2271
2259
  );
2272
2260
  var Sunrise_default = Sunrise;
2273
2261
 
2262
+ // src/components/BankTransactions/constants.ts
2263
+ var CategorizedCategories = [
2264
+ "CATEGORIZED" /* CATEGORIZED */,
2265
+ "JOURNALING" /* JOURNALING */,
2266
+ "SPLIT" /* SPLIT */,
2267
+ "MATCHED" /* MATCHED */
2268
+ ];
2269
+ var ReviewCategories = [
2270
+ "READY_FOR_INPUT" /* READY_FOR_INPUT */,
2271
+ "LAYER_REVIEW" /* LAYER_REVIEW */
2272
+ ];
2273
+
2274
2274
  // src/components/BankTransactions/utils.ts
2275
2275
  var filterVisibility = (scope, bankTransaction) => {
2276
2276
  const categorized = CategorizedCategories.includes(
@@ -5698,7 +5698,7 @@ import classNames32 from "classnames";
5698
5698
  var isAlreadyMatched2 = (bankTransaction) => {
5699
5699
  if (bankTransaction?.match) {
5700
5700
  const foundMatch = bankTransaction.suggested_matches?.find(
5701
- (x) => x.details.id === bankTransaction?.match?.details.id
5701
+ (x) => x.details.id === bankTransaction?.match?.details.id || x.details.id === bankTransaction?.match?.bank_transaction.id
5702
5702
  );
5703
5703
  return foundMatch?.id;
5704
5704
  }
@@ -5736,7 +5736,7 @@ var ExpandedBankTransactionRow = forwardRef5(
5736
5736
  bankTransaction.category ? "categorize" /* categorize */ : hasMatch(bankTransaction) ? "match" /* match */ : "categorize" /* categorize */
5737
5737
  );
5738
5738
  const [selectedMatchId, setSelectedMatchId] = useState13(
5739
- isAlreadyMatched2(bankTransaction)
5739
+ isAlreadyMatched2(bankTransaction) ?? bankTransaction?.suggested_matches?.[0]?.id
5740
5740
  );
5741
5741
  const [matchFormError, setMatchFormError] = useState13();
5742
5742
  const [splitFormError, setSplitFormError] = useState13();
@@ -5859,9 +5859,12 @@ var ExpandedBankTransactionRow = forwardRef5(
5859
5859
  if (purpose === "match" /* match */) {
5860
5860
  if (!selectedMatchId) {
5861
5861
  setMatchFormError("Select an option to match the transaction");
5862
+ return;
5862
5863
  } else if (selectedMatchId && selectedMatchId !== isAlreadyMatched2(bankTransaction)) {
5863
- onMatchSubmit(selectedMatchId);
5864
+ await onMatchSubmit(selectedMatchId);
5865
+ return;
5864
5866
  }
5867
+ close();
5865
5868
  return;
5866
5869
  }
5867
5870
  if (!validateSplit(rowState)) {
@@ -12344,7 +12347,10 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
12344
12347
  }
12345
12348
  const data2 = {
12346
12349
  name: form.data.name ?? "",
12347
- stable_name: form.data.stable_name,
12350
+ stable_name: form.data.stable_name ? {
12351
+ type: "StableName",
12352
+ stable_name: form.data.stable_name
12353
+ } : void 0,
12348
12354
  parent_id: form.data.parent ? {
12349
12355
  type: "AccountId",
12350
12356
  id: form.data.parent.value