@layerfi/components 0.1.69 → 0.1.71

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -2634,6 +2634,7 @@ declare module '@layerfi/components/components/ProfitAndLoss/ProfitAndLoss' {
2634
2634
  filters: import("@layerfi/components/hooks/useProfitAndLoss/useProfitAndLoss").ProfitAndLossFilters;
2635
2635
  sortBy: (scope: import("@layerfi/components/hooks/useProfitAndLoss/useProfitAndLoss").Scope, field: string, direction?: import("../../types").SortDirection | undefined) => void;
2636
2636
  setFilterTypes: (scope: import("@layerfi/components/hooks/useProfitAndLoss/useProfitAndLoss").Scope, types: string[]) => void;
2637
+ tagFilter?: import("@layerfi/components/hooks/useProfitAndLoss/useProfitAndLoss").PnlTagFilter | undefined;
2637
2638
  }>;
2638
2639
  ComparisonContext: React.Context<{
2639
2640
  data: import("@layerfi/components/types/profit_and_loss").ProfitAndLossComparisonItem[] | undefined;
@@ -4344,6 +4345,7 @@ declare module '@layerfi/components/hooks/useProfitAndLoss/useProfitAndLoss' {
4344
4345
  filters: ProfitAndLossFilters;
4345
4346
  sortBy: (scope: Scope, field: string, direction?: SortDirection) => void;
4346
4347
  setFilterTypes: (scope: Scope, types: string[]) => void;
4348
+ tagFilter?: PnlTagFilter;
4347
4349
  };
4348
4350
  export const useProfitAndLoss: UseProfitAndLoss;
4349
4351
  export {};
@@ -5047,7 +5049,6 @@ declare module '@layerfi/components/types/bank_transactions' {
5047
5049
  suggested_matches?: SuggestedMatch[];
5048
5050
  match?: BankTransactionMatch;
5049
5051
  document_ids: String[];
5050
- metadata: BankTransactionMetadata;
5051
5052
  }
5052
5053
  export interface SuggestedMatch {
5053
5054
  id: string;
package/dist/index.js CHANGED
@@ -2887,7 +2887,8 @@ var useProfitAndLoss = ({
2887
2887
  setSidebarScope,
2888
2888
  sortBy,
2889
2889
  filters,
2890
- setFilterTypes
2890
+ setFilterTypes,
2891
+ tagFilter
2891
2892
  };
2892
2893
  };
2893
2894
 
@@ -5579,7 +5580,7 @@ var ProfitAndLossDownloadButton = ({
5579
5580
  moneyFormat,
5580
5581
  view
5581
5582
  }) => {
5582
- const { dateRange } = (0, import_react55.useContext)(ProfitAndLoss.Context);
5583
+ const { dateRange, tagFilter } = (0, import_react55.useContext)(ProfitAndLoss.Context);
5583
5584
  const { getProfitAndLossComparisonCsv } = (0, import_react55.useContext)(
5584
5585
  ProfitAndLoss.ComparisonContext
5585
5586
  );
@@ -5596,7 +5597,9 @@ var ProfitAndLossDownloadButton = ({
5596
5597
  businessId,
5597
5598
  startDate: dateRange.startDate.toISOString(),
5598
5599
  endDate: dateRange.endDate.toISOString(),
5599
- moneyFormat
5600
+ moneyFormat,
5601
+ tagKey: tagFilter?.key && tagFilter.values.length > 0 ? tagFilter?.key : void 0,
5602
+ tagValues: tagFilter?.key && tagFilter.values.length > 0 ? tagFilter?.values.join(",") : void 0
5600
5603
  }
5601
5604
  }
5602
5605
  );
@@ -6700,7 +6703,8 @@ var PNLContext = (0, import_react80.createContext)({
6700
6703
  filters: {
6701
6704
  expenses: void 0,
6702
6705
  revenue: void 0
6703
- }
6706
+ },
6707
+ tagFilter: void 0
6704
6708
  });
6705
6709
  var ProfitAndLoss = ({
6706
6710
  children,
@@ -10570,6 +10574,21 @@ var ExpandedBankTransactionRow = (0, import_react113.forwardRef)(
10570
10574
  }));
10571
10575
  setReceiptUrls(retrievedDocs);
10572
10576
  };
10577
+ const fetchMemos = async () => {
10578
+ const getBankTransactionMetadata2 = Layer.getBankTransactionMetadata(
10579
+ apiUrl,
10580
+ auth.access_token,
10581
+ {
10582
+ params: {
10583
+ businessId,
10584
+ bankTransactionId: bankTransaction.id
10585
+ }
10586
+ }
10587
+ );
10588
+ const result = await getBankTransactionMetadata2();
10589
+ if (result.data.memo)
10590
+ setMemoText(result.data.memo);
10591
+ };
10573
10592
  const readDate = (date) => {
10574
10593
  if (!date)
10575
10594
  return void 0;
@@ -10607,6 +10626,9 @@ var ExpandedBankTransactionRow = (0, import_react113.forwardRef)(
10607
10626
  if (isOpen && isLoaded && receiptUrls.length === 0 && bankTransaction?.document_ids?.length > 0) {
10608
10627
  fetchDocuments();
10609
10628
  }
10629
+ if (isOpen && isLoaded) {
10630
+ fetchMemos();
10631
+ }
10610
10632
  }, [isOpen]);
10611
10633
  (0, import_react113.useEffect)(() => {
10612
10634
  if (!isLoaded) {
@@ -10622,8 +10644,8 @@ var ExpandedBankTransactionRow = (0, import_react113.forwardRef)(
10622
10644
  }, [getDivHeight, isOpen]);
10623
10645
  (0, import_react113.useEffect)(() => {
10624
10646
  const loadDocumentsAndMetadata = async () => {
10625
- if (showDescriptions && bankTransaction?.metadata.memo)
10626
- setMemoText(bankTransaction?.metadata.memo);
10647
+ if (showDescriptions && isOpen)
10648
+ await fetchMemos();
10627
10649
  if (showReceiptUploads && bankTransaction?.document_ids?.length > 0 && isOpen)
10628
10650
  await fetchDocuments();
10629
10651
  setIsLoaded(true);
@@ -17456,14 +17478,15 @@ var ProjectProfitabilityView = ({
17456
17478
  tagFilter: tagFilter ? tagFilter : void 0,
17457
17479
  onTransactionsToReviewClick: () => setActiveTab("transactions"),
17458
17480
  enableOnboarding: false,
17459
- showTransactionsToReview: false
17481
+ showTransactionsToReview: false,
17482
+ showTitle: false
17460
17483
  }
17461
17484
  ), activeTab === "transactions" && /* @__PURE__ */ import_react194.default.createElement(
17462
17485
  BankTransactions,
17463
17486
  {
17464
17487
  hideHeader: true,
17465
17488
  filters: {
17466
- categorizationStatus: "all" /* all */,
17489
+ categorizationStatus: "categorized" /* categorized */,
17467
17490
  tagFilter: tagFilter ?? void 0
17468
17491
  }
17469
17492
  }