@layerfi/components 0.1.47 → 0.1.49

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
@@ -793,12 +793,12 @@ var useBankTransactions = (params) => {
793
793
  }
794
794
  if (!prevData?.meta?.pagination?.cursor) {
795
795
  return [
796
- businessId && auth?.access_token && `bank-transactions${filters?.categorizationStatus ? `-scope-${filters?.categorizationStatus}` : ""}-${businessId}`,
796
+ businessId && auth?.access_token && `bank-transactions-${businessId}`,
797
797
  void 0
798
798
  ];
799
799
  }
800
800
  return [
801
- businessId && auth?.access_token && `bank-transactions${filters?.categorizationStatus ? `-scope-${filters?.categorizationStatus}` : ""}-${businessId}-${prevData.meta.pagination.cursor}`,
801
+ businessId && auth?.access_token && `bank-transactions-${businessId}-${prevData.meta.pagination.cursor}`,
802
802
  prevData.meta.pagination.cursor
803
803
  ];
804
804
  };
@@ -817,8 +817,7 @@ var useBankTransactions = (params) => {
817
817
  return Layer.getBankTransactions(apiUrl, auth?.access_token, {
818
818
  params: {
819
819
  businessId,
820
- cursor: nextCursor,
821
- categorized: filters?.categorizationStatus ? filters?.categorizationStatus === "categorized" /* categorized */ ? "true" : "false" : ""
820
+ cursor: nextCursor
822
821
  }
823
822
  }).call(false);
824
823
  }
@@ -987,13 +986,6 @@ var useBankTransactions = (params) => {
987
986
  mutate(updatedData, { revalidate: false });
988
987
  };
989
988
  const removeAfterCategorize = (bankTransaction) => {
990
- const updatedData = rawResponseData?.map((page) => {
991
- return {
992
- ...page,
993
- data: page.data?.filter((bt) => bt.id !== bankTransaction.id)
994
- };
995
- });
996
- mutate(updatedData, { revalidate: false });
997
989
  };
998
990
  const refetch = () => {
999
991
  mutate();
@@ -8377,7 +8369,7 @@ var DataStates = ({
8377
8369
  import { endOfMonth as endOfMonth3, parseISO as parseISO12, startOfMonth as startOfMonth4 } from "date-fns";
8378
8370
  var COMPONENT_NAME2 = "bank-transactions";
8379
8371
  var TEST_EMPTY_STATE = false;
8380
- var POLL_INTERVAL = 1e4;
8372
+ var POLL_INTERVAL = 1e3;
8381
8373
  var categorizationEnabled = (mode) => {
8382
8374
  if (mode === "bookkeeping-client") {
8383
8375
  return false;
@@ -8723,10 +8715,10 @@ var Quickbooks = () => {
8723
8715
  };
8724
8716
 
8725
8717
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
8726
- import React125, { createContext as createContext6 } from "react";
8718
+ import React130, { createContext as createContext7 } from "react";
8727
8719
 
8728
8720
  // src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
8729
- import { useMemo as useMemo7, useState as useState27 } from "react";
8721
+ import { useMemo as useMemo8, useState as useState28 } from "react";
8730
8722
 
8731
8723
  // src/utils/profitAndLossUtils.ts
8732
8724
  var doesLineItemQualifies = (item) => {
@@ -8781,17 +8773,175 @@ var applyShare = (items, total) => {
8781
8773
  });
8782
8774
  };
8783
8775
 
8784
- // src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
8785
- import { useEffect as useEffect21 } from "react";
8786
- import { startOfMonth as startOfMonth5, endOfMonth as endOfMonth4, formatISO } from "date-fns";
8776
+ // src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
8777
+ import { useEffect as useEffect21, useMemo as useMemo7, useState as useState27 } from "react";
8778
+ import { startOfMonth as startOfMonth5, sub } from "date-fns";
8787
8779
  import useSWR3 from "swr";
8780
+ var buildDates = ({ currentDate }) => {
8781
+ return {
8782
+ startYear: startOfMonth5(currentDate).getFullYear() - 1,
8783
+ startMonth: startOfMonth5(currentDate).getMonth() + 1,
8784
+ endYear: startOfMonth5(currentDate).getFullYear(),
8785
+ endMonth: startOfMonth5(currentDate).getMonth() + 1
8786
+ };
8787
+ };
8788
+ var buildMonthsArray = (startDate, endDate) => {
8789
+ if (startDate >= endDate) {
8790
+ return [];
8791
+ }
8792
+ var dates = [];
8793
+ for (var d = startDate; d <= endDate; d.setMonth(d.getMonth() + 1)) {
8794
+ dates.push(new Date(d));
8795
+ }
8796
+ return dates;
8797
+ };
8798
+ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
8799
+ currentDate: startOfMonth5(Date.now())
8800
+ }) => {
8801
+ const {
8802
+ businessId,
8803
+ auth,
8804
+ apiUrl,
8805
+ syncTimestamps,
8806
+ read,
8807
+ readTimestamps,
8808
+ hasBeenTouched
8809
+ } = useLayerContext();
8810
+ const [date, setDate] = useState27(currentDate);
8811
+ const [loaded, setLoaded] = useState27("initial");
8812
+ const [data, setData] = useState27([]);
8813
+ const { startYear, startMonth, endYear, endMonth } = useMemo7(() => {
8814
+ return buildDates({ currentDate: date });
8815
+ }, [date, businessId, tagFilter, reportingBasis]);
8816
+ const queryKey = businessId && Boolean(startYear) && Boolean(startMonth) && Boolean(endYear) && Boolean(endMonth) && auth?.access_token && `profit-and-loss-summaries-${businessId}-${startYear.toString()}-${startMonth.toString()}-${tagFilter?.key}-${tagFilter?.values?.join(
8817
+ ","
8818
+ )}-${reportingBasis}`;
8819
+ const {
8820
+ data: rawData,
8821
+ isLoading,
8822
+ isValidating,
8823
+ error,
8824
+ mutate
8825
+ } = useSWR3(
8826
+ queryKey,
8827
+ Layer.getProfitAndLossSummaries(apiUrl, auth?.access_token, {
8828
+ params: {
8829
+ businessId,
8830
+ startYear: startYear.toString(),
8831
+ startMonth: startMonth.toString(),
8832
+ endYear: endYear.toString(),
8833
+ endMonth: endMonth.toString(),
8834
+ tagKey: tagFilter?.key,
8835
+ tagValues: tagFilter?.values?.join(","),
8836
+ reportingBasis
8837
+ }
8838
+ })
8839
+ );
8840
+ useEffect21(() => {
8841
+ const newData = data.slice();
8842
+ const newPeriod = buildMonthsArray(sub(date, { years: 1 }), date);
8843
+ if (newData && newPeriod) {
8844
+ newPeriod.forEach((x) => {
8845
+ if (!newData?.find(
8846
+ (n) => x.getMonth() + 1 === n.month && x.getFullYear() === n.year
8847
+ )) {
8848
+ newData.push({
8849
+ year: x.getFullYear(),
8850
+ month: x.getMonth() + 1,
8851
+ income: 0,
8852
+ costOfGoodsSold: 0,
8853
+ grossProfit: 0,
8854
+ operatingExpenses: 0,
8855
+ profitBeforeTaxes: 0,
8856
+ taxes: 0,
8857
+ netProfit: 0,
8858
+ fullyCategorized: false,
8859
+ totalExpenses: 0,
8860
+ uncategorizedInflows: 0,
8861
+ uncategorizedOutflows: 0,
8862
+ uncategorized_transactions: 0,
8863
+ isLoading: true
8864
+ });
8865
+ }
8866
+ });
8867
+ }
8868
+ if (newData) {
8869
+ setData(
8870
+ newData.sort(
8871
+ (a, b) => Number(new Date(a.year, a.month, 1)) - Number(new Date(b.year, b.month, 1))
8872
+ )
8873
+ );
8874
+ }
8875
+ }, [startYear, startMonth]);
8876
+ useEffect21(() => {
8877
+ const newData = rawData?.data?.months?.slice();
8878
+ if (data && newData) {
8879
+ data.forEach((x) => {
8880
+ if (!newData?.find((n) => x.month === n.month && x.year === n.year)) {
8881
+ newData.push({ ...x });
8882
+ }
8883
+ });
8884
+ }
8885
+ if (newData) {
8886
+ setData(
8887
+ newData.sort(
8888
+ (a, b) => Number(new Date(a.year, a.month, 1)) - Number(new Date(b.year, b.month, 1))
8889
+ )
8890
+ );
8891
+ }
8892
+ }, [rawData]);
8893
+ useEffect21(() => {
8894
+ if (isLoading && loaded === "initial") {
8895
+ setLoaded("loading");
8896
+ return;
8897
+ }
8898
+ if (!isLoading && rawData) {
8899
+ setLoaded("complete");
8900
+ }
8901
+ }, [data, isLoading]);
8902
+ const pullData = (date2) => setDate(date2);
8903
+ useEffect21(() => {
8904
+ if (queryKey && (isLoading || isValidating)) {
8905
+ read("PROFIT_AND_LOSS" /* PROFIT_AND_LOSS */, queryKey);
8906
+ }
8907
+ }, [isLoading, isValidating]);
8908
+ useEffect21(() => {
8909
+ if (queryKey && hasBeenTouched(queryKey)) {
8910
+ mutate();
8911
+ }
8912
+ }, [
8913
+ syncTimestamps,
8914
+ startYear,
8915
+ startMonth,
8916
+ endYear,
8917
+ endMonth,
8918
+ tagFilter,
8919
+ reportingBasis
8920
+ ]);
8921
+ const refetch = () => {
8922
+ mutate();
8923
+ };
8924
+ return {
8925
+ data,
8926
+ isLoading,
8927
+ loaded,
8928
+ error,
8929
+ pullData,
8930
+ refetch
8931
+ };
8932
+ };
8933
+
8934
+ // src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
8935
+ import { useEffect as useEffect22 } from "react";
8936
+ import { startOfMonth as startOfMonth6, endOfMonth as endOfMonth4, formatISO } from "date-fns";
8937
+ import useSWR4 from "swr";
8788
8938
  var useProfitAndLossQuery = ({
8789
8939
  startDate,
8790
8940
  endDate,
8791
8941
  tagFilter,
8792
8942
  reportingBasis
8793
8943
  } = {
8794
- startDate: startOfMonth5(/* @__PURE__ */ new Date()),
8944
+ startDate: startOfMonth6(/* @__PURE__ */ new Date()),
8795
8945
  endDate: endOfMonth4(/* @__PURE__ */ new Date())
8796
8946
  }) => {
8797
8947
  const { auth, businessId, apiUrl, syncTimestamps, read, hasBeenTouched } = useLayerContext();
@@ -8804,7 +8954,7 @@ var useProfitAndLossQuery = ({
8804
8954
  isValidating,
8805
8955
  error: rawError,
8806
8956
  mutate
8807
- } = useSWR3(
8957
+ } = useSWR4(
8808
8958
  queryKey,
8809
8959
  Layer.getProfitAndLoss(apiUrl, auth?.access_token, {
8810
8960
  params: {
@@ -8820,12 +8970,12 @@ var useProfitAndLossQuery = ({
8820
8970
  const refetch = () => {
8821
8971
  mutate();
8822
8972
  };
8823
- useEffect21(() => {
8973
+ useEffect22(() => {
8824
8974
  if (queryKey && (isLoading || isValidating)) {
8825
8975
  read("PROFIT_AND_LOSS" /* PROFIT_AND_LOSS */, queryKey);
8826
8976
  }
8827
8977
  }, [isLoading, isValidating]);
8828
- useEffect21(() => {
8978
+ useEffect22(() => {
8829
8979
  if (queryKey && hasBeenTouched(queryKey)) {
8830
8980
  refetch();
8831
8981
  }
@@ -8842,33 +8992,36 @@ var useProfitAndLossQuery = ({
8842
8992
  };
8843
8993
 
8844
8994
  // src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
8845
- import { startOfMonth as startOfMonth6, endOfMonth as endOfMonth5 } from "date-fns";
8995
+ import { startOfMonth as startOfMonth7, endOfMonth as endOfMonth5 } from "date-fns";
8846
8996
  var useProfitAndLoss = ({
8847
8997
  startDate: initialStartDate,
8848
8998
  endDate: initialEndDate,
8849
8999
  tagFilter,
8850
9000
  reportingBasis
8851
9001
  } = {
8852
- startDate: startOfMonth6(/* @__PURE__ */ new Date()),
9002
+ startDate: startOfMonth7(/* @__PURE__ */ new Date()),
8853
9003
  endDate: endOfMonth5(/* @__PURE__ */ new Date())
8854
9004
  }) => {
8855
- const [startDate, setStartDate] = useState27(
8856
- initialStartDate || startOfMonth6(Date.now())
9005
+ const [startDate, setStartDate] = useState28(
9006
+ initialStartDate || startOfMonth7(Date.now())
8857
9007
  );
8858
- const [endDate, setEndDate] = useState27(
9008
+ const [endDate, setEndDate] = useState28(
8859
9009
  initialEndDate || endOfMonth5(Date.now())
8860
9010
  );
8861
- const [filters, setFilters] = useState27({
9011
+ const [filters, setFilters] = useState28({
8862
9012
  expenses: void 0,
8863
9013
  revenue: void 0
8864
9014
  });
8865
- const [sidebarScope, setSidebarScope] = useState27(void 0);
9015
+ const [sidebarScope, setSidebarScope] = useState28(void 0);
8866
9016
  const { data, isLoading, isValidating, error, refetch } = useProfitAndLossQuery({
8867
9017
  startDate,
8868
9018
  endDate,
8869
9019
  tagFilter,
8870
9020
  reportingBasis
8871
9021
  });
9022
+ const { data: summaryData } = useProfitAndLossLTM({
9023
+ currentDate: startDate ? startDate : startOfMonth7(/* @__PURE__ */ new Date())
9024
+ });
8872
9025
  const changeDateRange = ({
8873
9026
  startDate: newStartDate,
8874
9027
  endDate: newEndDate
@@ -8895,7 +9048,7 @@ var useProfitAndLoss = ({
8895
9048
  }
8896
9049
  });
8897
9050
  };
8898
- const { filteredDataRevenue, filteredTotalRevenue } = useMemo7(() => {
9051
+ const { filteredDataRevenue, filteredTotalRevenue } = useMemo8(() => {
8899
9052
  if (!data) {
8900
9053
  return { filteredDataRevenue: [], filteredTotalRevenue: void 0 };
8901
9054
  }
@@ -8909,6 +9062,19 @@ var useProfitAndLoss = ({
8909
9062
  }
8910
9063
  return x;
8911
9064
  });
9065
+ const month = startDate.getMonth() + 1;
9066
+ const year = startDate.getFullYear();
9067
+ const found = summaryData.find((x) => x.month === month && x.year === year);
9068
+ if (found && (found.uncategorizedInflows ?? 0) > 0) {
9069
+ filtered.push({
9070
+ name: "uncategorized",
9071
+ display_name: "Uncategorized",
9072
+ value: found.uncategorizedInflows,
9073
+ type: "Uncategorized",
9074
+ share: 0,
9075
+ hidden: false
9076
+ });
9077
+ }
8912
9078
  const sorted = filtered.sort((a, b) => {
8913
9079
  switch (filters["revenue"]?.sortBy) {
8914
9080
  case "category":
@@ -8931,8 +9097,8 @@ var useProfitAndLoss = ({
8931
9097
  const total = sorted.filter((x) => !x.hidden).reduce((x, { value }) => x + value, 0);
8932
9098
  const withShare = applyShare(sorted, total);
8933
9099
  return { filteredDataRevenue: withShare, filteredTotalRevenue: total };
8934
- }, [data, startDate, filters, sidebarScope]);
8935
- const { filteredDataExpenses, filteredTotalExpenses } = useMemo7(() => {
9100
+ }, [data, startDate, filters, sidebarScope, summaryData]);
9101
+ const { filteredDataExpenses, filteredTotalExpenses } = useMemo8(() => {
8936
9102
  if (!data) {
8937
9103
  return { filteredDataExpenses: [], filteredTotalExpenses: void 0 };
8938
9104
  }
@@ -8946,6 +9112,19 @@ var useProfitAndLoss = ({
8946
9112
  }
8947
9113
  return x;
8948
9114
  });
9115
+ const month = startDate.getMonth() + 1;
9116
+ const year = startDate.getFullYear();
9117
+ const found = summaryData.find((x) => x.month === month && x.year === year);
9118
+ if (found && (found.uncategorizedOutflows ?? 0) > 0) {
9119
+ filtered.push({
9120
+ name: "uncategorized",
9121
+ display_name: "Uncategorized",
9122
+ value: found.uncategorizedOutflows,
9123
+ type: "Uncategorized",
9124
+ share: 0,
9125
+ hidden: false
9126
+ });
9127
+ }
8949
9128
  const sorted = filtered.sort((a, b) => {
8950
9129
  switch (filters["expenses"]?.sortBy) {
8951
9130
  case "category":
@@ -8968,7 +9147,7 @@ var useProfitAndLoss = ({
8968
9147
  const total = sorted.filter((x) => !x.hidden).reduce((x, { value }) => x + value, 0);
8969
9148
  const withShare = applyShare(sorted, total);
8970
9149
  return { filteredDataExpenses: withShare, filteredTotalExpenses: total };
8971
- }, [data, startDate, filters, sidebarScope]);
9150
+ }, [data, startDate, filters, sidebarScope, summaryData]);
8972
9151
  return {
8973
9152
  data,
8974
9153
  filteredDataRevenue,
@@ -8992,201 +9171,43 @@ var useProfitAndLoss = ({
8992
9171
  // src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
8993
9172
  import React112, { useContext as useContext12, useEffect as useEffect24, useMemo as useMemo9, useState as useState30 } from "react";
8994
9173
 
8995
- // src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
8996
- import { useEffect as useEffect22, useMemo as useMemo8, useState as useState28 } from "react";
8997
- import { startOfMonth as startOfMonth7, sub } from "date-fns";
8998
- import useSWR4 from "swr";
8999
- var buildDates = ({ currentDate }) => {
9000
- return {
9001
- startYear: startOfMonth7(currentDate).getFullYear() - 1,
9002
- startMonth: startOfMonth7(currentDate).getMonth() + 1,
9003
- endYear: startOfMonth7(currentDate).getFullYear(),
9004
- endMonth: startOfMonth7(currentDate).getMonth() + 1
9005
- };
9006
- };
9007
- var buildMonthsArray = (startDate, endDate) => {
9008
- if (startDate >= endDate) {
9009
- return [];
9010
- }
9011
- var dates = [];
9012
- for (var d = startDate; d <= endDate; d.setMonth(d.getMonth() + 1)) {
9013
- dates.push(new Date(d));
9014
- }
9015
- return dates;
9016
- };
9017
- var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
9018
- currentDate: startOfMonth7(Date.now())
9174
+ // src/components/ProfitAndLossChart/Indicator.tsx
9175
+ import React111, { useEffect as useEffect23, useState as useState29 } from "react";
9176
+ var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
9177
+ var Indicator = ({
9178
+ className,
9179
+ animateFrom,
9180
+ setAnimateFrom,
9181
+ customCursorSize,
9182
+ setCustomCursorSize,
9183
+ viewBox = {}
9019
9184
  }) => {
9020
- const {
9021
- businessId,
9022
- auth,
9023
- apiUrl,
9024
- syncTimestamps,
9025
- read,
9026
- readTimestamps,
9027
- hasBeenTouched
9028
- } = useLayerContext();
9029
- const [date, setDate] = useState28(currentDate);
9030
- const [loaded, setLoaded] = useState28("initial");
9031
- const [data, setData] = useState28([]);
9032
- const { startYear, startMonth, endYear, endMonth } = useMemo8(() => {
9033
- return buildDates({ currentDate: date });
9034
- }, [date, businessId, tagFilter, reportingBasis]);
9035
- const queryKey = businessId && Boolean(startYear) && Boolean(startMonth) && Boolean(endYear) && Boolean(endMonth) && auth?.access_token && `profit-and-loss-summaries-${businessId}-${startYear.toString()}-${startMonth.toString()}-${tagFilter?.key}-${tagFilter?.values?.join(
9036
- ","
9037
- )}-${reportingBasis}`;
9038
- const {
9039
- data: rawData,
9040
- isLoading,
9041
- isValidating,
9042
- error,
9043
- mutate
9044
- } = useSWR4(
9045
- queryKey,
9046
- Layer.getProfitAndLossSummaries(apiUrl, auth?.access_token, {
9047
- params: {
9048
- businessId,
9049
- startYear: startYear.toString(),
9050
- startMonth: startMonth.toString(),
9051
- endYear: endYear.toString(),
9052
- endMonth: endMonth.toString(),
9053
- tagKey: tagFilter?.key,
9054
- tagValues: tagFilter?.values?.join(","),
9055
- reportingBasis
9056
- }
9057
- })
9058
- );
9059
- useEffect22(() => {
9060
- const newData = data.slice();
9061
- const newPeriod = buildMonthsArray(sub(date, { years: 1 }), date);
9062
- if (newData && newPeriod) {
9063
- newPeriod.forEach((x) => {
9064
- if (!newData?.find(
9065
- (n) => x.getMonth() + 1 === n.month && x.getFullYear() === n.year
9066
- )) {
9067
- newData.push({
9068
- year: x.getFullYear(),
9069
- month: x.getMonth() + 1,
9070
- income: 0,
9071
- costOfGoodsSold: 0,
9072
- grossProfit: 0,
9073
- operatingExpenses: 0,
9074
- profitBeforeTaxes: 0,
9075
- taxes: 0,
9076
- netProfit: 0,
9077
- fullyCategorized: false,
9078
- totalExpenses: 0,
9079
- uncategorizedInflows: 0,
9080
- uncategorizedOutflows: 0,
9081
- uncategorized_transactions: 0,
9082
- isLoading: true
9083
- });
9084
- }
9085
- });
9086
- }
9087
- if (newData) {
9088
- setData(
9089
- newData.sort(
9090
- (a, b) => Number(new Date(a.year, a.month, 1)) - Number(new Date(b.year, b.month, 1))
9091
- )
9092
- );
9093
- }
9094
- }, [startYear, startMonth]);
9095
- useEffect22(() => {
9096
- const newData = rawData?.data?.months?.slice();
9097
- if (data && newData) {
9098
- data.forEach((x) => {
9099
- if (!newData?.find((n) => x.month === n.month && x.year === n.year)) {
9100
- newData.push({ ...x });
9101
- }
9102
- });
9103
- }
9104
- if (newData) {
9105
- setData(
9106
- newData.sort(
9107
- (a, b) => Number(new Date(a.year, a.month, 1)) - Number(new Date(b.year, b.month, 1))
9108
- )
9109
- );
9110
- }
9111
- }, [rawData]);
9112
- useEffect22(() => {
9113
- if (isLoading && loaded === "initial") {
9114
- setLoaded("loading");
9115
- return;
9116
- }
9117
- if (!isLoading && rawData) {
9118
- setLoaded("complete");
9119
- }
9120
- }, [data, isLoading]);
9121
- const pullData = (date2) => setDate(date2);
9122
- useEffect22(() => {
9123
- if (queryKey && (isLoading || isValidating)) {
9124
- read("PROFIT_AND_LOSS" /* PROFIT_AND_LOSS */, queryKey);
9125
- }
9126
- }, [isLoading, isValidating]);
9127
- useEffect22(() => {
9128
- if (queryKey && hasBeenTouched(queryKey)) {
9129
- mutate();
9130
- }
9131
- }, [
9132
- syncTimestamps,
9133
- startYear,
9134
- startMonth,
9135
- endYear,
9136
- endMonth,
9137
- tagFilter,
9138
- reportingBasis
9139
- ]);
9140
- const refetch = () => {
9141
- mutate();
9142
- };
9143
- return {
9144
- data,
9145
- isLoading,
9146
- loaded,
9147
- error,
9148
- pullData,
9149
- refetch
9150
- };
9151
- };
9152
-
9153
- // src/components/ProfitAndLossChart/Indicator.tsx
9154
- import React111, { useEffect as useEffect23, useState as useState29 } from "react";
9155
- var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
9156
- var Indicator = ({
9157
- className,
9158
- animateFrom,
9159
- setAnimateFrom,
9160
- customCursorSize,
9161
- setCustomCursorSize,
9162
- viewBox = {}
9163
- }) => {
9164
- if (!className?.match(/selected/)) {
9165
- return null;
9166
- }
9167
- const [opacityIndicator, setOpacityIndicator] = useState29(0);
9168
- const { x: animateTo = 0, width = 0 } = "x" in viewBox ? viewBox : emptyViewBox;
9169
- const margin = width > 12 ? 12 : 6;
9170
- const boxWidth = width + margin;
9171
- const xOffset = boxWidth / 2;
9172
- const borderRadius = 6;
9173
- const rectWidth = `${boxWidth}px`;
9174
- const rectHeight = "calc(100% - 38px)";
9175
- useEffect23(() => {
9176
- if (Math.abs(animateTo - animateFrom) < 30) {
9177
- setOpacityIndicator(0);
9178
- }
9179
- setAnimateFrom(animateTo);
9180
- setTimeout(() => {
9181
- setOpacityIndicator(1);
9182
- }, 200);
9183
- }, [animateTo]);
9184
- const rectRef = (ref) => {
9185
- if (ref) {
9186
- const refRectWidth = ref.getBoundingClientRect().width;
9187
- const refRectHeight = ref.getBoundingClientRect().height;
9188
- if (customCursorSize.width !== refRectWidth || customCursorSize.height !== refRectHeight) {
9189
- setCustomCursorSize(refRectWidth, refRectHeight, actualX - xOffset);
9185
+ if (!className?.match(/selected/)) {
9186
+ return null;
9187
+ }
9188
+ const [opacityIndicator, setOpacityIndicator] = useState29(0);
9189
+ const { x: animateTo = 0, width = 0 } = "x" in viewBox ? viewBox : emptyViewBox;
9190
+ const margin = width > 12 ? 12 : 6;
9191
+ const boxWidth = width + margin;
9192
+ const xOffset = boxWidth / 2;
9193
+ const borderRadius = 6;
9194
+ const rectWidth = `${boxWidth}px`;
9195
+ const rectHeight = "calc(100% - 38px)";
9196
+ useEffect23(() => {
9197
+ if (Math.abs(animateTo - animateFrom) < 30) {
9198
+ setOpacityIndicator(0);
9199
+ }
9200
+ setAnimateFrom(animateTo);
9201
+ setTimeout(() => {
9202
+ setOpacityIndicator(1);
9203
+ }, 200);
9204
+ }, [animateTo]);
9205
+ const rectRef = (ref) => {
9206
+ if (ref) {
9207
+ const refRectWidth = ref.getBoundingClientRect().width;
9208
+ const refRectHeight = ref.getBoundingClientRect().height;
9209
+ if (customCursorSize.width !== refRectWidth || customCursorSize.height !== refRectHeight) {
9210
+ setCustomCursorSize(refRectWidth, refRectHeight, actualX - xOffset);
9190
9211
  }
9191
9212
  }
9192
9213
  };
@@ -10148,6 +10169,12 @@ var mapTypesToColors = (data, colorList = DEFAULT_CHART_COLOR_TYPE) => {
10148
10169
  let colorIndex = 0;
10149
10170
  return data.map((obj) => {
10150
10171
  const type = obj.type;
10172
+ if (type === "Uncategorized") {
10173
+ return {
10174
+ color: "#EEEEF0",
10175
+ opacity: 1
10176
+ };
10177
+ }
10151
10178
  if (!typeToColor[type]) {
10152
10179
  typeToColor[type] = colorList[colorIndex % colorList.length];
10153
10180
  colorIndex++;
@@ -10162,6 +10189,57 @@ var mapTypesToColors = (data, colorList = DEFAULT_CHART_COLOR_TYPE) => {
10162
10189
  };
10163
10190
  });
10164
10191
  };
10192
+ var ValueIcon = ({
10193
+ item,
10194
+ typeColorMapping,
10195
+ idx
10196
+ }) => {
10197
+ if (item.type === "Uncategorized") {
10198
+ return /* @__PURE__ */ React116.createElement(
10199
+ "svg",
10200
+ {
10201
+ viewBox: "0 0 12 12",
10202
+ fill: "none",
10203
+ xmlns: "http://www.w3.org/2000/svg",
10204
+ width: "12",
10205
+ height: "12"
10206
+ },
10207
+ /* @__PURE__ */ React116.createElement("defs", null, /* @__PURE__ */ React116.createElement(
10208
+ "pattern",
10209
+ {
10210
+ id: "layer-pie-dots-pattern-legend",
10211
+ x: "0",
10212
+ y: "0",
10213
+ width: "3",
10214
+ height: "3",
10215
+ patternUnits: "userSpaceOnUse"
10216
+ },
10217
+ /* @__PURE__ */ React116.createElement("rect", { width: "1", height: "1", opacity: 0.76 })
10218
+ )),
10219
+ /* @__PURE__ */ React116.createElement("rect", { width: "12", height: "12", id: "layer-pie-dots-pattern-bg", rx: "2" }),
10220
+ /* @__PURE__ */ React116.createElement(
10221
+ "rect",
10222
+ {
10223
+ x: "1",
10224
+ y: "1",
10225
+ width: "10",
10226
+ height: "10",
10227
+ fill: "url(#layer-pie-dots-pattern-legend)"
10228
+ }
10229
+ )
10230
+ );
10231
+ }
10232
+ return /* @__PURE__ */ React116.createElement(
10233
+ "div",
10234
+ {
10235
+ className: "share-icon",
10236
+ style: {
10237
+ background: typeColorMapping[idx].color,
10238
+ opacity: typeColorMapping[idx].opacity
10239
+ }
10240
+ }
10241
+ );
10242
+ };
10165
10243
  var DetailedTable = ({
10166
10244
  filteredData,
10167
10245
  sidebarScope,
@@ -10223,13 +10301,11 @@ var DetailedTable = ({
10223
10301
  /* @__PURE__ */ React116.createElement("td", { className: "type-col" }, item.type),
10224
10302
  /* @__PURE__ */ React116.createElement("td", { className: "value-col" }, "$", centsToDollars(item.value)),
10225
10303
  /* @__PURE__ */ React116.createElement("td", { className: "share-col" }, /* @__PURE__ */ React116.createElement("span", { className: "share-cell-content" }, formatPercent(item.share), "%", /* @__PURE__ */ React116.createElement(
10226
- "div",
10304
+ ValueIcon,
10227
10305
  {
10228
- className: "share-icon",
10229
- style: {
10230
- background: typeColorMapping[idx].color,
10231
- opacity: typeColorMapping[idx].opacity
10232
- }
10306
+ item,
10307
+ typeColorMapping,
10308
+ idx
10233
10309
  }
10234
10310
  )))
10235
10311
  );
@@ -10237,6 +10313,7 @@ var DetailedTable = ({
10237
10313
  };
10238
10314
 
10239
10315
  // src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
10316
+ import classNames43 from "classnames";
10240
10317
  import {
10241
10318
  PieChart,
10242
10319
  Pie,
@@ -10277,7 +10354,32 @@ var DetailedChart = ({
10277
10354
  }, [filteredData, isLoading]);
10278
10355
  const noValue = chartData.length === 0 || !chartData.find((x) => x.value !== 0);
10279
10356
  const typeColorMapping = mapTypesToColors(chartData, chartColorsList);
10280
- return /* @__PURE__ */ React117.createElement("div", { className: "chart-field" }, /* @__PURE__ */ React117.createElement("div", { className: "header--tablet" }, showDatePicker && /* @__PURE__ */ React117.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ React117.createElement("div", { className: "chart-container" }, /* @__PURE__ */ React117.createElement(ResponsiveContainer2, null, /* @__PURE__ */ React117.createElement(PieChart, null, !isLoading && !noValue ? /* @__PURE__ */ React117.createElement(
10357
+ return /* @__PURE__ */ React117.createElement("div", { className: "chart-field" }, /* @__PURE__ */ React117.createElement("div", { className: "header--tablet" }, showDatePicker && /* @__PURE__ */ React117.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ React117.createElement("div", { className: "chart-container" }, /* @__PURE__ */ React117.createElement(ResponsiveContainer2, null, /* @__PURE__ */ React117.createElement(PieChart, null, /* @__PURE__ */ React117.createElement("defs", null, /* @__PURE__ */ React117.createElement(
10358
+ "pattern",
10359
+ {
10360
+ id: "layer-pie-stripe-pattern",
10361
+ x: "0",
10362
+ y: "0",
10363
+ width: "4",
10364
+ height: "4",
10365
+ patternTransform: "rotate(45)",
10366
+ patternUnits: "userSpaceOnUse"
10367
+ },
10368
+ /* @__PURE__ */ React117.createElement("rect", { width: "4", height: "4", opacity: 0.16 }),
10369
+ /* @__PURE__ */ React117.createElement("line", { x1: "0", y: "0", x2: "0", y2: "4", strokeWidth: "2" })
10370
+ ), /* @__PURE__ */ React117.createElement(
10371
+ "pattern",
10372
+ {
10373
+ id: "layer-pie-dots-pattern",
10374
+ x: "0",
10375
+ y: "0",
10376
+ width: "3",
10377
+ height: "3",
10378
+ patternUnits: "userSpaceOnUse"
10379
+ },
10380
+ /* @__PURE__ */ React117.createElement("rect", { width: "3", height: "3", opacity: 0.46, className: "bg" }),
10381
+ /* @__PURE__ */ React117.createElement("rect", { width: "1", height: "1", opacity: 0.56 })
10382
+ )), !isLoading && !noValue ? /* @__PURE__ */ React117.createElement(
10281
10383
  Pie,
10282
10384
  {
10283
10385
  data: chartData,
@@ -10303,8 +10405,14 @@ var DetailedChart = ({
10303
10405
  Cell2,
10304
10406
  {
10305
10407
  key: `cell-${index}`,
10306
- className: `Layer__profit-and-loss-detailed-charts__pie ${hoveredItem && active ? "active" : "inactive"}`,
10307
- style: { fill },
10408
+ className: classNames43(
10409
+ "Layer__profit-and-loss-detailed-charts__pie",
10410
+ hoveredItem && active ? "active" : "inactive",
10411
+ entry.type === "Uncategorized" && "Layer__profit-and-loss-detailed-charts__pie--border"
10412
+ ),
10413
+ style: {
10414
+ fill: entry.type === "Uncategorized" && fill ? "url(#layer-pie-dots-pattern)" : fill
10415
+ },
10308
10416
  opacity: typeColorMapping[index].opacity,
10309
10417
  onMouseEnter: () => setHoveredItem(entry.name),
10310
10418
  onMouseLeave: () => setHoveredItem(void 0)
@@ -10660,7 +10768,7 @@ var MiniChart = ({ data }) => {
10660
10768
  };
10661
10769
 
10662
10770
  // src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
10663
- import classNames43 from "classnames";
10771
+ import classNames44 from "classnames";
10664
10772
  var CHART_PLACEHOLDER = [
10665
10773
  {
10666
10774
  name: "placeholder",
@@ -10719,7 +10827,7 @@ var ProfitAndLossSummaries = ({
10719
10827
  /* @__PURE__ */ React121.createElement(
10720
10828
  "div",
10721
10829
  {
10722
- className: classNames43(
10830
+ className: classNames44(
10723
10831
  "Layer__profit-and-loss-summaries__summary",
10724
10832
  actionable && "Layer__actionable",
10725
10833
  "Layer__profit-and-loss-summaries__summary--income",
@@ -10741,7 +10849,7 @@ var ProfitAndLossSummaries = ({
10741
10849
  /* @__PURE__ */ React121.createElement(
10742
10850
  "div",
10743
10851
  {
10744
- className: classNames43(
10852
+ className: classNames44(
10745
10853
  "Layer__profit-and-loss-summaries__summary",
10746
10854
  actionable && "Layer__actionable",
10747
10855
  "Layer__profit-and-loss-summaries__summary--expenses",
@@ -10765,7 +10873,7 @@ var ProfitAndLossSummaries = ({
10765
10873
  /* @__PURE__ */ React121.createElement(
10766
10874
  "div",
10767
10875
  {
10768
- className: classNames43(
10876
+ className: classNames44(
10769
10877
  "Layer__profit-and-loss-summaries__summary net-profit Layer__profit-and-loss-summaries__summary--net-profit",
10770
10878
  actionable && "Layer__actionable"
10771
10879
  )
@@ -10782,14 +10890,89 @@ var ProfitAndLossSummaries = ({
10782
10890
  };
10783
10891
 
10784
10892
  // src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
10785
- import React124, { useContext as useContext16 } from "react";
10893
+ import React129, { useContext as useContext17, useEffect as useEffect27 } from "react";
10894
+
10895
+ // src/hooks/useTableExpandRow/useTableExpandRow.tsx
10896
+ import { useContext as useContext16 } from "react";
10897
+
10898
+ // src/contexts/TableContext/TableContext.tsx
10899
+ import React122, { createContext as createContext6, useState as useState32 } from "react";
10900
+ var defaultValue = {
10901
+ expandedRows: [],
10902
+ setExpandedRows: () => {
10903
+ },
10904
+ expandAllRows: () => {
10905
+ },
10906
+ expandedAllRows: false,
10907
+ setExpandedAllRows: () => {
10908
+ }
10909
+ };
10910
+ var TableContext = createContext6(defaultValue);
10911
+ var TableProvider = ({ children }) => {
10912
+ const [expandedRows, setExpandedRowsState] = useState32([]);
10913
+ const [expandedAllRows, setExpandedAllRows] = useState32(false);
10914
+ const toggleRow = (rowKey) => {
10915
+ setExpandedRowsState((prevRows) => {
10916
+ const rows = [...prevRows];
10917
+ if (rows.includes(rowKey)) {
10918
+ rows.splice(rows.indexOf(rowKey), 1);
10919
+ } else {
10920
+ rows.push(rowKey);
10921
+ }
10922
+ return rows;
10923
+ });
10924
+ };
10925
+ const expandAllRows = (rowKeys) => {
10926
+ setExpandedRowsState(rowKeys);
10927
+ };
10928
+ const contextValue = {
10929
+ expandedRows,
10930
+ setExpandedRows: toggleRow,
10931
+ expandAllRows,
10932
+ expandedAllRows,
10933
+ setExpandedAllRows
10934
+ };
10935
+ return /* @__PURE__ */ React122.createElement(TableContext.Provider, { value: contextValue }, children);
10936
+ };
10786
10937
 
10787
- // src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
10788
- import React123, { useState as useState32 } from "react";
10938
+ // src/hooks/useTableExpandRow/useTableExpandRow.tsx
10939
+ var useTableExpandRow = () => {
10940
+ const {
10941
+ expandedAllRows,
10942
+ setExpandedAllRows,
10943
+ expandAllRows,
10944
+ expandedRows,
10945
+ setExpandedRows
10946
+ } = useContext16(TableContext);
10947
+ const toggleAllRows = () => {
10948
+ if (expandedAllRows) {
10949
+ setIsOpen([]);
10950
+ return setExpandedAllRows(false);
10951
+ } else {
10952
+ return setExpandedAllRows(true);
10953
+ }
10954
+ };
10955
+ const setIsOpen = (rowKey, withoutAllRowsUpdate) => {
10956
+ if (!withoutAllRowsUpdate && expandedAllRows) {
10957
+ setExpandedAllRows(false);
10958
+ }
10959
+ if (Array.isArray(rowKey)) {
10960
+ return expandAllRows(rowKey);
10961
+ }
10962
+ return setExpandedRows(rowKey);
10963
+ };
10964
+ const isOpen = (rowKey) => expandedRows.includes(rowKey);
10965
+ return {
10966
+ isOpen,
10967
+ setIsOpen,
10968
+ expandedAllRows,
10969
+ toggleAllRows
10970
+ };
10971
+ };
10789
10972
 
10790
10973
  // src/icons/PieChart.tsx
10791
- import * as React122 from "react";
10792
- var PieChart3 = ({ size = 12, ...props }) => /* @__PURE__ */ React122.createElement(
10974
+ import * as React123 from "react";
10975
+ var PieChart3 = ({ size = 12, ...props }) => /* @__PURE__ */ React123.createElement(
10793
10976
  "svg",
10794
10977
  {
10795
10978
  xmlns: "http://www.w3.org/2000/svg",
@@ -10799,7 +10982,7 @@ var PieChart3 = ({ size = 12, ...props }) => /* @__PURE__ */ React122.createElem
10799
10982
  width: size,
10800
10983
  height: size
10801
10984
  },
10802
- /* @__PURE__ */ React122.createElement("g", null, /* @__PURE__ */ React122.createElement(
10985
+ /* @__PURE__ */ React123.createElement("g", null, /* @__PURE__ */ React123.createElement(
10803
10986
  "path",
10804
10987
  {
10805
10988
  d: "M10.2213 7.78271C9.92969 8.47226 9.47363 9.07989 8.89297 9.55247C8.3123 10.0251 7.62471 10.3482 6.89031 10.4936C6.1559 10.6391 5.39705 10.6024 4.68009 10.3869C3.96313 10.1713 3.30989 9.78337 2.77749 9.25701C2.24509 8.73065 1.84973 8.08189 1.62598 7.36744C1.40223 6.65298 1.3569 5.8946 1.49396 5.15858C1.63102 4.42257 1.94629 3.73133 2.41221 3.14531C2.87813 2.55928 3.48051 2.09631 4.16669 1.79688",
@@ -10807,7 +10990,7 @@ var PieChart3 = ({ size = 12, ...props }) => /* @__PURE__ */ React122.createElem
10807
10990
  strokeLinecap: "round",
10808
10991
  strokeLinejoin: "round"
10809
10992
  }
10810
- ), /* @__PURE__ */ React122.createElement(
10993
+ ), /* @__PURE__ */ React123.createElement(
10811
10994
  "path",
10812
10995
  {
10813
10996
  d: "M10.5833 6.00033C10.5833 5.39843 10.4648 4.80244 10.2344 4.24636C10.0041 3.69028 9.66651 3.18502 9.24091 2.75942C8.8153 2.33382 8.31004 1.99621 7.75397 1.76588C7.19789 1.53554 6.60189 1.41699 6 1.41699V6.00033H10.5833Z",
@@ -10819,96 +11002,139 @@ var PieChart3 = ({ size = 12, ...props }) => /* @__PURE__ */ React122.createElem
10819
11002
  );
10820
11003
  var PieChart_default = PieChart3;
10821
11004
 
10822
- // src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
10823
- var ProfitAndLossRow = ({
10824
- variant,
10825
- lineItem,
10826
- depth = 0,
10827
- maxDepth = 8,
10828
- direction = "DEBIT" /* DEBIT */,
10829
- lockExpanded = false,
10830
- scope,
10831
- setSidebarScope,
10832
- defaultExpanded = false
11005
+ // src/components/TableBody/TableBody.tsx
11006
+ import React124 from "react";
11007
+ var TableBody = ({ children }) => {
11008
+ return /* @__PURE__ */ React124.createElement("tbody", { className: "Layer__table-body" }, children);
11009
+ };
11010
+
11011
+ // src/components/TableCell/TableCell.tsx
11012
+ import React125 from "react";
11013
+ import classNames45 from "classnames";
11014
+ var TableCell = ({
11015
+ children,
11016
+ isHeaderCell,
11017
+ isCurrency,
11018
+ primary,
11019
+ withExpandIcon = false,
11020
+ fullWidth
10833
11021
  }) => {
10834
- if (!lineItem) {
10835
- return null;
10836
- }
10837
- const { value, display_name, line_items } = lineItem;
10838
- const [expanded, setExpanded] = useState32(lockExpanded || defaultExpanded);
10839
- const amount = value ?? 0;
11022
+ const amount = typeof children === "number" ? children : 0;
11023
+ const isPositive = amount >= 0;
10840
11024
  const amountString = centsToDollars(Math.abs(amount));
10841
- const labelClasses = [
10842
- "Layer__profit-and-loss-row",
10843
- "Layer__profit-and-loss-row__label"
10844
- ];
10845
- const valueClasses = [
10846
- "Layer__profit-and-loss-row",
10847
- "Layer__profit-and-loss-row__value"
10848
- ];
10849
- const positive = amount === 0 || direction === "CREDIT" /* CREDIT */ && amount > 0 || direction === "DEBIT" /* DEBIT */ && amount < 0;
10850
- valueClasses.push(
10851
- positive ? "Layer__profit-and-loss-row__value--amount-positive" : "Layer__profit-and-loss-row__value--amount-negative"
10852
- );
10853
- labelClasses.push(`Layer__profit-and-loss-row__label--depth-${depth}`);
10854
- valueClasses.push(`Layer__profit-and-loss-row__value--depth-${depth}`);
10855
- variant && labelClasses.push(`Layer__profit-and-loss-row__label--variant-${variant}`);
10856
- variant && valueClasses.push(`Layer__profit-and-loss-row__value--variant-${variant}`);
10857
- const toggleExpanded = () => setExpanded(!expanded);
10858
- const canGoDeeper = depth < maxDepth;
10859
- const hasChildren = (line_items?.length ?? 0) > 0;
10860
- const displayChildren = hasChildren && canGoDeeper;
10861
- labelClasses.push(
10862
- `Layer__profit-and-loss-row__label--display-children-${displayChildren}`
10863
- );
10864
- valueClasses.push(
10865
- `Layer__profit-and-loss-row__value--display-children-${displayChildren}`
10866
- );
10867
- displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
10868
- displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
10869
- return /* @__PURE__ */ React123.createElement(React123.Fragment, null, /* @__PURE__ */ React123.createElement(
10870
- "div",
11025
+ const cellClassNames = classNames45(
11026
+ "Layer__table-cell",
11027
+ (primary || isHeaderCell) && "Layer__table-cell--primary",
11028
+ isCurrency && "Layer__table-cell-amount",
11029
+ isCurrency && isPositive && "Layer__table-cell-amount--positive",
11030
+ isCurrency && !isPositive && "Layer__table-cell-amount--negative"
11031
+ );
11032
+ if (isHeaderCell) {
11033
+ return /* @__PURE__ */ React125.createElement("th", { className: cellClassNames }, /* @__PURE__ */ React125.createElement("span", { className: "Layer__table-cell-content" }, children));
11034
+ }
11035
+ return /* @__PURE__ */ React125.createElement(
11036
+ "td",
10871
11037
  {
10872
- className: labelClasses.join(" "),
10873
- onClick: () => !lockExpanded && toggleExpanded(),
10874
- style: {
10875
- paddingLeft: depth === 0 && !hasChildren ? 28 : 16 * (depth + 1) + 2
10876
- }
11038
+ className: cellClassNames,
11039
+ style: fullWidth ? { width: "100%" } : void 0
10877
11040
  },
10878
- /* @__PURE__ */ React123.createElement("span", { className: "Layer__profit-and-loss-row__label__title" }, !lockExpanded && variant !== "summation" ? /* @__PURE__ */ React123.createElement(
11041
+ /* @__PURE__ */ React125.createElement("span", { className: "Layer__table-cell-content" }, withExpandIcon && /* @__PURE__ */ React125.createElement(
10879
11042
  ChevronDownFill_default,
10880
11043
  {
10881
- size: 16,
10882
- className: "Layer__profit-and-loss-row__label__chevron"
11044
+ className: "Layer__table-row--expand-icon",
11045
+ size: 16
10883
11046
  }
10884
- ) : null, /* @__PURE__ */ React123.createElement(Text, null, display_name)),
10885
- setSidebarScope && /* @__PURE__ */ React123.createElement(
10886
- "span",
10887
- {
10888
- className: "Layer__profit-and-loss-row__detailed-chart-btn",
10889
- onClick: (e) => {
10890
- e.stopPropagation();
10891
- setSidebarScope && setSidebarScope(scope ?? "expenses");
11047
+ ), isCurrency ? amountString : children, " ")
11048
+ );
11049
+ };
11050
+
11051
+ // src/components/TableHead/TableHead.tsx
11052
+ import React126 from "react";
11053
+ var TableHead = ({ children }) => {
11054
+ return /* @__PURE__ */ React126.createElement("thead", { className: "Layer__table-header" }, children);
11055
+ };
11056
+
11057
+ // src/components/TableRow/TableRow.tsx
11058
+ import React127 from "react";
11059
+ import classNames46 from "classnames";
11060
+ var TableRow = ({
11061
+ rowKey,
11062
+ children,
11063
+ depth = 0,
11064
+ expandable = false,
11065
+ isExpanded = false,
11066
+ handleExpand,
11067
+ variant = expandable ? "expandable" : "default",
11068
+ withDivider,
11069
+ withDividerPosition = "top",
11070
+ isHeadRow = false
11071
+ }) => {
11072
+ const toggleExpanded = () => {
11073
+ if (variant === "summation" || !expandable)
11074
+ return;
11075
+ handleExpand && handleExpand();
11076
+ };
11077
+ const rowClassNames = classNames46([
11078
+ "Layer__table-row",
11079
+ !isHeadRow && `Layer__table-row--depth-${depth}`,
11080
+ !isHeadRow && `Layer__table-row--variant-${variant}`,
11081
+ !isHeadRow && expandable && (isExpanded ? "Layer__table-row--expanded" : "Layer__table-row--collapsed")
11082
+ ]);
11083
+ return /* @__PURE__ */ React127.createElement(React127.Fragment, null, withDivider && withDividerPosition === "top" && /* @__PURE__ */ React127.createElement("tr", { className: "Layer__table-empty-row" }, /* @__PURE__ */ React127.createElement("td", { colSpan: Array.isArray(children) ? children.length : 1 })), /* @__PURE__ */ React127.createElement("tr", { "data-key": rowKey, className: rowClassNames, onClick: toggleExpanded }, children), withDivider && withDividerPosition === "bottom" && /* @__PURE__ */ React127.createElement("tr", { className: "Layer__table-empty-row" }, /* @__PURE__ */ React127.createElement("td", { colSpan: Array.isArray(children) ? children.length : 1 })));
11084
+ };
11085
+
11086
+ // src/components/Table/Table.tsx
11087
+ import React128, { useEffect as useEffect26, useRef as useRef15 } from "react";
11088
+ import classNames47 from "classnames";
11089
+ var Table = ({
11090
+ componentName,
11091
+ children,
11092
+ borderCollapse = "separate",
11093
+ bottomSpacing = true
11094
+ }) => {
11095
+ const tableRef = useRef15(null);
11096
+ const prevChildrenRef = useRef15([]);
11097
+ useEffect26(() => {
11098
+ if (tableRef.current) {
11099
+ const tbody = tableRef.current.querySelector("tbody");
11100
+ const rows = tbody ? Array.from(tbody.querySelectorAll("tr")) : [];
11101
+ const prevChildrenArray = prevChildrenRef.current;
11102
+ const currentChildren = rows.map(
11103
+ (child) => child.getAttribute("data-key") && {
11104
+ key: child.getAttribute("data-key"),
11105
+ child
10892
11106
  }
10893
- },
10894
- /* @__PURE__ */ React123.createElement(PieChart_default, null)
10895
- )
10896
- ), /* @__PURE__ */ React123.createElement("div", { className: valueClasses.join(" ") }, /* @__PURE__ */ React123.createElement(Text, null, amountString)), canGoDeeper && hasChildren && /* @__PURE__ */ React123.createElement(
10897
- "div",
10898
- {
10899
- className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
10900
- },
10901
- /* @__PURE__ */ React123.createElement("div", { className: "Layer__profit-and-loss-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ React123.createElement(
10902
- ProfitAndLossRow,
10903
- {
10904
- key: line_item.display_name,
10905
- lineItem: line_item,
10906
- depth: depth + 1,
10907
- maxDepth,
10908
- direction
10909
- }
10910
- )))
10911
- ));
11107
+ );
11108
+ const newChildrenKeys = [];
11109
+ const newChildrenArray = currentChildren.filter((el) => {
11110
+ if (el && el.key) {
11111
+ newChildrenKeys.push(el.key);
11112
+ }
11113
+ return el && el.key && !prevChildrenArray.includes(el.key);
11114
+ });
11115
+ newChildrenArray.forEach((row, index) => {
11116
+ const rowKey = row && row.key;
11117
+ if (rowKey && !row.child.classList.contains("Layer__table-empty-row")) {
11118
+ row.child.classList.add("Layer__table-row--anim-starting-state");
11119
+ setTimeout(() => {
11120
+ row.child.classList.add("Layer__table-row--anim-complete-state");
11121
+ row.child.classList.remove("Layer__table-row--anim-starting-state");
11122
+ }, 15 * index);
11123
+ }
11124
+ });
11125
+ prevChildrenRef.current = newChildrenKeys;
11126
+ }
11127
+ }, [children]);
11128
+ const tableWrapperClassNames = classNames47(
11129
+ "Layer__table-wrapper",
11130
+ bottomSpacing && "Layer__table-wrapper--bottom-spacing"
11131
+ );
11132
+ const tableClassNames = classNames47(
11133
+ "Layer__table",
11134
+ componentName && `Layer__${componentName}__table`,
11135
+ borderCollapse && `Layer__table__${borderCollapse}-rows`
11136
+ );
11137
+ return /* @__PURE__ */ React128.createElement("div", { className: tableWrapperClassNames }, /* @__PURE__ */ React128.createElement("table", { className: tableClassNames, ref: tableRef }, children));
10912
11138
  };
10913
11139
 
10914
11140
  // src/components/ProfitAndLossTable/empty_profit_and_loss_report.ts
@@ -10960,145 +11186,135 @@ var empty_profit_and_loss_report_default = {
10960
11186
  };
10961
11187
 
10962
11188
  // src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
10963
- import classNames44 from "classnames";
10964
- var ProfitAndLossTable = ({
10965
- lockExpanded,
10966
- asContainer,
10967
- stringOverrides
10968
- }) => {
11189
+ import classNames48 from "classnames";
11190
+ var ProfitAndLossTable = ({ asContainer, stringOverrides }) => {
10969
11191
  const {
10970
11192
  data: actualData,
10971
11193
  isLoading,
10972
11194
  setSidebarScope
10973
- } = useContext16(ProfitAndLoss.Context);
11195
+ } = useContext17(ProfitAndLoss.Context);
11196
+ const { isOpen, setIsOpen } = useTableExpandRow();
11197
+ useEffect27(() => {
11198
+ setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
11199
+ }, []);
10974
11200
  const currentData = Array.isArray(actualData) ? actualData[actualData.length - 1] : actualData;
10975
11201
  const data = !currentData || isLoading ? empty_profit_and_loss_report_default : currentData;
10976
11202
  if (isLoading || actualData === void 0) {
10977
- return /* @__PURE__ */ React124.createElement(
11203
+ return /* @__PURE__ */ React129.createElement(
10978
11204
  "div",
10979
11205
  {
10980
- className: classNames44(
11206
+ className: classNames48(
10981
11207
  "Layer__profit-and-loss-table__loader-container",
10982
11208
  asContainer && "Layer__component-container"
10983
11209
  )
10984
11210
  },
10985
- /* @__PURE__ */ React124.createElement(Loader2, null)
11211
+ /* @__PURE__ */ React129.createElement(Loader2, null)
10986
11212
  );
10987
11213
  }
10988
- return /* @__PURE__ */ React124.createElement(React124.Fragment, null, /* @__PURE__ */ React124.createElement(
10989
- "div",
10990
- {
10991
- className: classNames44(
10992
- "Layer__profit-and-loss-table Layer__profit-and-loss-table--main",
10993
- asContainer && "Layer__component-container"
10994
- )
10995
- },
10996
- /* @__PURE__ */ React124.createElement(
10997
- ProfitAndLossRow,
10998
- {
10999
- lineItem: data.income,
11000
- direction: "CREDIT" /* CREDIT */,
11001
- lockExpanded,
11002
- scope: "revenue",
11003
- setSidebarScope,
11004
- defaultExpanded: true
11005
- }
11006
- ),
11007
- /* @__PURE__ */ React124.createElement(
11008
- ProfitAndLossRow,
11009
- {
11010
- lineItem: data.cost_of_goods_sold,
11011
- direction: "DEBIT" /* DEBIT */,
11012
- lockExpanded,
11013
- scope: "expenses",
11014
- setSidebarScope,
11015
- defaultExpanded: true
11016
- }
11017
- ),
11018
- /* @__PURE__ */ React124.createElement(
11019
- ProfitAndLossRow,
11020
- {
11021
- lineItem: {
11022
- value: data.gross_profit,
11023
- display_name: stringOverrides?.grossProfitLabel || "Gross Profit"
11024
- },
11025
- variant: "summation",
11026
- direction: "CREDIT" /* CREDIT */,
11027
- lockExpanded,
11028
- scope: "revenue",
11029
- setSidebarScope,
11030
- defaultExpanded: true
11031
- }
11032
- ),
11033
- /* @__PURE__ */ React124.createElement(
11034
- ProfitAndLossRow,
11035
- {
11036
- lineItem: data.expenses,
11037
- direction: "DEBIT" /* DEBIT */,
11038
- lockExpanded,
11039
- scope: "expenses",
11040
- setSidebarScope,
11041
- defaultExpanded: true
11042
- }
11043
- ),
11044
- /* @__PURE__ */ React124.createElement(
11045
- ProfitAndLossRow,
11046
- {
11047
- lineItem: {
11048
- value: data.profit_before_taxes,
11049
- display_name: stringOverrides?.profitBeforeTaxesLabel || "Profit Before Taxes"
11050
- },
11051
- variant: "summation",
11052
- direction: "CREDIT" /* CREDIT */,
11053
- lockExpanded,
11054
- scope: "revenue",
11055
- setSidebarScope,
11056
- defaultExpanded: true
11057
- }
11058
- ),
11059
- /* @__PURE__ */ React124.createElement(
11060
- ProfitAndLossRow,
11061
- {
11062
- lineItem: data.taxes,
11063
- direction: "DEBIT" /* DEBIT */,
11064
- lockExpanded,
11065
- scope: "expenses",
11066
- setSidebarScope,
11067
- defaultExpanded: true
11068
- }
11069
- ),
11070
- /* @__PURE__ */ React124.createElement(
11071
- ProfitAndLossRow,
11214
+ const renderLineItem = (lineItem, depth, rowKey, rowIndex, scope, setSidebarScope2, variant) => {
11215
+ const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
11216
+ const expanded = expandable ? isOpen(rowKey) : true;
11217
+ return /* @__PURE__ */ React129.createElement(React129.Fragment, { key: rowKey + "-" + rowIndex }, /* @__PURE__ */ React129.createElement(
11218
+ TableRow,
11072
11219
  {
11073
- lineItem: {
11074
- value: data.net_profit,
11075
- display_name: stringOverrides?.netProfitLabel || "Net Profit"
11220
+ rowKey: rowKey + "-" + rowIndex,
11221
+ expandable,
11222
+ isExpanded: expanded,
11223
+ depth,
11224
+ variant: variant ? variant : expandable ? "expandable" : "default",
11225
+ handleExpand: () => setIsOpen(rowKey)
11226
+ },
11227
+ /* @__PURE__ */ React129.createElement(
11228
+ TableCell,
11229
+ {
11230
+ primary: true,
11231
+ withExpandIcon: expandable,
11232
+ fullWidth: !!setSidebarScope2
11076
11233
  },
11077
- variant: "summation",
11078
- direction: "CREDIT" /* CREDIT */,
11079
- lockExpanded
11080
- }
11081
- )
11082
- ), data.other_outflows || data.personal_expenses ? /* @__PURE__ */ React124.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ React124.createElement(
11083
- ProfitAndLossRow,
11234
+ lineItem.display_name,
11235
+ " ",
11236
+ setSidebarScope2 && /* @__PURE__ */ React129.createElement(
11237
+ "span",
11238
+ {
11239
+ className: "Layer__profit-and-loss-row__detailed-chart-btn",
11240
+ onClick: (e) => {
11241
+ e.stopPropagation();
11242
+ setSidebarScope2 && setSidebarScope2(scope ?? "expenses");
11243
+ }
11244
+ },
11245
+ /* @__PURE__ */ React129.createElement(PieChart_default, null)
11246
+ )
11247
+ ),
11248
+ /* @__PURE__ */ React129.createElement(TableCell, { isCurrency: true, primary: true }, lineItem.value)
11249
+ ), expanded && lineItem.line_items ? lineItem.line_items.map(
11250
+ (child, i) => renderLineItem(
11251
+ child,
11252
+ depth + 1,
11253
+ child.display_name + "-" + rowIndex,
11254
+ i
11255
+ )
11256
+ ) : null);
11257
+ };
11258
+ return /* @__PURE__ */ React129.createElement(Table, { borderCollapse: "collapse", bottomSpacing: false }, /* @__PURE__ */ React129.createElement(TableBody, null, renderLineItem(
11259
+ data.income,
11260
+ 0,
11261
+ "income",
11262
+ 0,
11263
+ "revenue",
11264
+ setSidebarScope
11265
+ ), renderLineItem(
11266
+ data.cost_of_goods_sold,
11267
+ 0,
11268
+ "cost_of_goods_sold",
11269
+ 1,
11270
+ "expenses",
11271
+ setSidebarScope
11272
+ ), renderLineItem(
11084
11273
  {
11085
- lineItem: data.other_outflows,
11086
- direction: "DEBIT" /* DEBIT */,
11087
- lockExpanded
11088
- }
11089
- ), /* @__PURE__ */ React124.createElement(
11090
- ProfitAndLossRow,
11274
+ value: data.gross_profit,
11275
+ display_name: stringOverrides?.grossProfitLabel || "Gross Profit"
11276
+ },
11277
+ 0,
11278
+ "gross_profit",
11279
+ 2,
11280
+ "revenue",
11281
+ setSidebarScope,
11282
+ "summation"
11283
+ ), renderLineItem(
11284
+ data.expenses,
11285
+ 0,
11286
+ "expenses",
11287
+ 3,
11288
+ "expenses",
11289
+ setSidebarScope
11290
+ ), renderLineItem(
11091
11291
  {
11092
- lineItem: data.personal_expenses,
11093
- direction: "DEBIT" /* DEBIT */,
11094
- lockExpanded
11095
- }
11096
- )) : null);
11292
+ value: data.profit_before_taxes,
11293
+ display_name: stringOverrides?.profitBeforeTaxesLabel || "Profit Before Taxes"
11294
+ },
11295
+ 0,
11296
+ "profit_before_taxes",
11297
+ 4,
11298
+ "revenue",
11299
+ setSidebarScope,
11300
+ "summation"
11301
+ ), renderLineItem(data.taxes, 0, "taxes", 5, "expenses", setSidebarScope), renderLineItem(
11302
+ {
11303
+ value: data.net_profit,
11304
+ display_name: stringOverrides?.netProfitLabel || "Net Profit"
11305
+ },
11306
+ 0,
11307
+ "net_profit",
11308
+ 5,
11309
+ void 0,
11310
+ void 0,
11311
+ "summation"
11312
+ ), data.other_outflows || data.personal_expenses ? /* @__PURE__ */ React129.createElement(React129.Fragment, null, renderLineItem(data.other_outflows, 0, "other_outflows", 6), renderLineItem(data.personal_expenses, 0, "personal_expenses", 7)) : null));
11097
11313
  };
11098
11314
 
11099
11315
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
11100
11316
  import { endOfMonth as endOfMonth8, startOfMonth as startOfMonth10 } from "date-fns";
11101
- var PNLContext = createContext6({
11317
+ var PNLContext = createContext7({
11102
11318
  data: void 0,
11103
11319
  filteredDataRevenue: [],
11104
11320
  filteredTotalRevenue: void 0,
@@ -11134,7 +11350,7 @@ var ProfitAndLoss = ({
11134
11350
  asContainer = true
11135
11351
  }) => {
11136
11352
  const contextData = useProfitAndLoss({ tagFilter, reportingBasis });
11137
- return /* @__PURE__ */ React125.createElement(PNLContext.Provider, { value: contextData }, asContainer ? /* @__PURE__ */ React125.createElement(Container, { name: "profit-and-loss" }, children) : children);
11353
+ return /* @__PURE__ */ React130.createElement(PNLContext.Provider, { value: contextData }, asContainer ? /* @__PURE__ */ React130.createElement(Container, { name: "profit-and-loss" }, children) : children);
11138
11354
  };
11139
11355
  ProfitAndLoss.Chart = ProfitAndLossChart;
11140
11356
  ProfitAndLoss.Context = PNLContext;
@@ -11144,11 +11360,11 @@ ProfitAndLoss.Table = ProfitAndLossTable;
11144
11360
  ProfitAndLoss.DetailedCharts = ProfitAndLossDetailedCharts;
11145
11361
 
11146
11362
  // src/components/BalanceSheet/BalanceSheet.tsx
11147
- import React138, { useEffect as useEffect30, useState as useState35 } from "react";
11363
+ import React137, { useEffect as useEffect31, useState as useState34 } from "react";
11148
11364
 
11149
11365
  // src/contexts/BalanceSheetContext/BalanceSheetContext.tsx
11150
- import { createContext as createContext7 } from "react";
11151
- var BalanceSheetContext = createContext7({
11366
+ import { createContext as createContext8 } from "react";
11367
+ var BalanceSheetContext = createContext8({
11152
11368
  data: void 0,
11153
11369
  isLoading: false,
11154
11370
  error: void 0,
@@ -11156,48 +11372,8 @@ var BalanceSheetContext = createContext7({
11156
11372
  }
11157
11373
  });
11158
11374
 
11159
- // src/contexts/TableContext/TableContext.tsx
11160
- import React126, { createContext as createContext8, useState as useState33 } from "react";
11161
- var defaultValue = {
11162
- expandedRows: [],
11163
- setExpandedRows: () => {
11164
- },
11165
- expandAllRows: () => {
11166
- },
11167
- expandedAllRows: false,
11168
- setExpandedAllRows: () => {
11169
- }
11170
- };
11171
- var TableContext = createContext8(defaultValue);
11172
- var TableProvider = ({ children }) => {
11173
- const [expandedRows, setExpandedRowsState] = useState33([]);
11174
- const [expandedAllRows, setExpandedAllRows] = useState33(false);
11175
- const toggleRow = (rowKey) => {
11176
- setExpandedRowsState((prevRows) => {
11177
- const rows = [...prevRows];
11178
- if (rows.includes(rowKey)) {
11179
- rows.splice(rows.indexOf(rowKey), 1);
11180
- } else {
11181
- rows.push(rowKey);
11182
- }
11183
- return rows;
11184
- });
11185
- };
11186
- const expandAllRows = (rowKeys) => {
11187
- setExpandedRowsState(rowKeys);
11188
- };
11189
- const contextValue = {
11190
- expandedRows,
11191
- setExpandedRows: toggleRow,
11192
- expandAllRows,
11193
- expandedAllRows,
11194
- setExpandedAllRows
11195
- };
11196
- return /* @__PURE__ */ React126.createElement(TableContext.Provider, { value: contextValue }, children);
11197
- };
11198
-
11199
11375
  // src/hooks/useBalanceSheet/useBalanceSheet.tsx
11200
- import { useEffect as useEffect26 } from "react";
11376
+ import { useEffect as useEffect28 } from "react";
11201
11377
  import { format as format3, startOfDay } from "date-fns";
11202
11378
  import useSWR5 from "swr";
11203
11379
  var useBalanceSheet = (date = /* @__PURE__ */ new Date()) => {
@@ -11216,12 +11392,12 @@ var useBalanceSheet = (date = /* @__PURE__ */ new Date()) => {
11216
11392
  const refetch = () => {
11217
11393
  mutate();
11218
11394
  };
11219
- useEffect26(() => {
11395
+ useEffect28(() => {
11220
11396
  if (queryKey && (isLoading || isValidating)) {
11221
11397
  read("BALANCE_SHEET" /* BALANCE_SHEET */, queryKey);
11222
11398
  }
11223
11399
  }, [isLoading, isValidating]);
11224
- useEffect26(() => {
11400
+ useEffect28(() => {
11225
11401
  if (queryKey && hasBeenTouched(queryKey)) {
11226
11402
  refetch();
11227
11403
  }
@@ -11230,12 +11406,12 @@ var useBalanceSheet = (date = /* @__PURE__ */ new Date()) => {
11230
11406
  };
11231
11407
 
11232
11408
  // src/components/BalanceSheetDatePicker/BalanceSheetDatePicker.tsx
11233
- import React127 from "react";
11409
+ import React131 from "react";
11234
11410
  var BalanceSheetDatePicker = ({
11235
11411
  effectiveDate,
11236
11412
  setEffectiveDate
11237
11413
  }) => {
11238
- return /* @__PURE__ */ React127.createElement(React127.Fragment, null, /* @__PURE__ */ React127.createElement(
11414
+ return /* @__PURE__ */ React131.createElement(React131.Fragment, null, /* @__PURE__ */ React131.createElement(
11239
11415
  DatePicker,
11240
11416
  {
11241
11417
  selected: effectiveDate,
@@ -11246,181 +11422,14 @@ var BalanceSheetDatePicker = ({
11246
11422
  };
11247
11423
 
11248
11424
  // src/components/BalanceSheetExpandAllButton/BalanceSheetExpandAllButton.tsx
11249
- import React128 from "react";
11250
-
11251
- // src/hooks/useTableExpandRow/useTableExpandRow.tsx
11252
- import { useContext as useContext17 } from "react";
11253
- var useTableExpandRow = () => {
11254
- const {
11255
- expandedAllRows,
11256
- setExpandedAllRows,
11257
- expandAllRows,
11258
- expandedRows,
11259
- setExpandedRows
11260
- } = useContext17(TableContext);
11261
- const toggleAllRows = () => {
11262
- if (expandedAllRows) {
11263
- setIsOpen([]);
11264
- return setExpandedAllRows(false);
11265
- } else {
11266
- return setExpandedAllRows(true);
11267
- }
11268
- };
11269
- const setIsOpen = (rowKey, withoutAllRowsUpdate) => {
11270
- if (!withoutAllRowsUpdate && expandedAllRows) {
11271
- setExpandedAllRows(false);
11272
- }
11273
- if (Array.isArray(rowKey)) {
11274
- return expandAllRows(rowKey);
11275
- }
11276
- return setExpandedRows(rowKey);
11277
- };
11278
- const isOpen = (rowKey) => expandedRows.includes(rowKey);
11279
- return {
11280
- isOpen,
11281
- setIsOpen,
11282
- expandedAllRows,
11283
- toggleAllRows
11284
- };
11285
- };
11286
-
11287
- // src/components/BalanceSheetExpandAllButton/BalanceSheetExpandAllButton.tsx
11425
+ import React132 from "react";
11288
11426
  var BalanceSheetExpandAllButton = () => {
11289
11427
  const { expandedAllRows, toggleAllRows } = useTableExpandRow();
11290
- return /* @__PURE__ */ React128.createElement(Button, { onClick: () => toggleAllRows(), variant: "secondary" /* secondary */ }, !expandedAllRows ? "Expand all rows" : "Collapse all rows");
11291
- };
11292
-
11293
- // src/components/BalanceSheetTable/BalanceSheetTable.tsx
11294
- import React134, { useEffect as useEffect28 } from "react";
11295
-
11296
- // src/components/TableBody/TableBody.tsx
11297
- import React129 from "react";
11298
- var TableBody = ({ children }) => {
11299
- return /* @__PURE__ */ React129.createElement("tbody", { className: "Layer__table-body" }, children);
11300
- };
11301
-
11302
- // src/components/TableCell/TableCell.tsx
11303
- import React130 from "react";
11304
- import classNames45 from "classnames";
11305
- var TableCell = ({
11306
- children,
11307
- isHeaderCell,
11308
- isCurrency,
11309
- primary,
11310
- withExpandIcon = false
11311
- }) => {
11312
- const amount = typeof children === "number" ? children : 0;
11313
- const isPositive = amount >= 0;
11314
- const amountString = centsToDollars(Math.abs(amount));
11315
- const cellClassNames = classNames45(
11316
- "Layer__table-cell",
11317
- (primary || isHeaderCell) && "Layer__table-cell--primary",
11318
- isCurrency && "Layer__table-cell-amount",
11319
- isCurrency && isPositive && "Layer__table-cell-amount--positive",
11320
- isCurrency && !isPositive && "Layer__table-cell-amount--negative"
11321
- );
11322
- if (isHeaderCell) {
11323
- return /* @__PURE__ */ React130.createElement("th", { className: cellClassNames }, /* @__PURE__ */ React130.createElement("span", { className: "Layer__table-cell-content" }, children));
11324
- }
11325
- return /* @__PURE__ */ React130.createElement("td", { className: cellClassNames }, /* @__PURE__ */ React130.createElement("span", { className: "Layer__table-cell-content" }, withExpandIcon && /* @__PURE__ */ React130.createElement(
11326
- ChevronDownFill_default,
11327
- {
11328
- className: "Layer__table-row--expand-icon",
11329
- size: 16
11330
- }
11331
- ), isCurrency ? amountString : children, " "));
11332
- };
11333
-
11334
- // src/components/TableHead/TableHead.tsx
11335
- import React131 from "react";
11336
- var TableHead = ({ children }) => {
11337
- return /* @__PURE__ */ React131.createElement("thead", { className: "Layer__table-header" }, children);
11338
- };
11339
-
11340
- // src/components/TableRow/TableRow.tsx
11341
- import React132 from "react";
11342
- import classNames46 from "classnames";
11343
- var TableRow = ({
11344
- rowKey,
11345
- children,
11346
- depth = 0,
11347
- expandable = false,
11348
- isExpanded = false,
11349
- handleExpand,
11350
- variant = expandable ? "expandable" : "default",
11351
- withDivider,
11352
- withDividerPosition = "top",
11353
- isHeadRow = false
11354
- }) => {
11355
- const toggleExpanded = () => {
11356
- if (variant === "summation" || !expandable)
11357
- return;
11358
- handleExpand && handleExpand();
11359
- };
11360
- const rowClassNames = classNames46([
11361
- "Layer__table-row",
11362
- !isHeadRow && `Layer__table-row--depth-${depth}`,
11363
- !isHeadRow && `Layer__table-row--variant-${variant}`,
11364
- !isHeadRow && expandable && (isExpanded ? "Layer__table-row--expanded" : "Layer__table-row--collapsed")
11365
- ]);
11366
- return /* @__PURE__ */ React132.createElement(React132.Fragment, null, withDivider && withDividerPosition === "top" && /* @__PURE__ */ React132.createElement("tr", { className: "Layer__table-empty-row" }, /* @__PURE__ */ React132.createElement("td", { colSpan: Array.isArray(children) ? children.length : 1 })), /* @__PURE__ */ React132.createElement("tr", { "data-key": rowKey, className: rowClassNames, onClick: toggleExpanded }, children), withDivider && withDividerPosition === "bottom" && /* @__PURE__ */ React132.createElement("tr", { className: "Layer__table-empty-row" }, /* @__PURE__ */ React132.createElement("td", { colSpan: Array.isArray(children) ? children.length : 1 })));
11367
- };
11368
-
11369
- // src/components/Table/Table.tsx
11370
- import React133, { useEffect as useEffect27, useRef as useRef15 } from "react";
11371
- import classNames47 from "classnames";
11372
- var Table = ({
11373
- componentName,
11374
- children,
11375
- borderCollapse = "separate",
11376
- bottomSpacing = true
11377
- }) => {
11378
- const tableRef = useRef15(null);
11379
- const prevChildrenRef = useRef15([]);
11380
- useEffect27(() => {
11381
- if (tableRef.current) {
11382
- const tbody = tableRef.current.querySelector("tbody");
11383
- const rows = tbody ? Array.from(tbody.querySelectorAll("tr")) : [];
11384
- const prevChildrenArray = prevChildrenRef.current;
11385
- const currentChildren = rows.map(
11386
- (child) => child.getAttribute("data-key") && {
11387
- key: child.getAttribute("data-key"),
11388
- child
11389
- }
11390
- );
11391
- const newChildrenKeys = [];
11392
- const newChildrenArray = currentChildren.filter((el) => {
11393
- if (el && el.key) {
11394
- newChildrenKeys.push(el.key);
11395
- }
11396
- return el && el.key && !prevChildrenArray.includes(el.key);
11397
- });
11398
- newChildrenArray.forEach((row, index) => {
11399
- const rowKey = row && row.key;
11400
- if (rowKey && !row.child.classList.contains("Layer__table-empty-row")) {
11401
- row.child.classList.add("Layer__table-row--anim-starting-state");
11402
- setTimeout(() => {
11403
- row.child.classList.add("Layer__table-row--anim-complete-state");
11404
- row.child.classList.remove("Layer__table-row--anim-starting-state");
11405
- }, 15 * index);
11406
- }
11407
- });
11408
- prevChildrenRef.current = newChildrenKeys;
11409
- }
11410
- }, [children]);
11411
- const tableWrapperClassNames = classNames47(
11412
- "Layer__table-wrapper",
11413
- bottomSpacing && "Layer__table-wrapper--bottom-spacing"
11414
- );
11415
- const tableClassNames = classNames47(
11416
- "Layer__table",
11417
- componentName && `Layer__${componentName}__table`,
11418
- borderCollapse && `Layer__table__${borderCollapse}-rows`
11419
- );
11420
- return /* @__PURE__ */ React133.createElement("div", { className: tableWrapperClassNames }, /* @__PURE__ */ React133.createElement("table", { className: tableClassNames, ref: tableRef }, children));
11428
+ return /* @__PURE__ */ React132.createElement(Button, { onClick: () => toggleAllRows(), variant: "secondary" /* secondary */ }, !expandedAllRows ? "Expand all rows" : "Collapse all rows");
11421
11429
  };
11422
11430
 
11423
11431
  // src/components/BalanceSheetTable/BalanceSheetTable.tsx
11432
+ import React133, { useEffect as useEffect29 } from "react";
11424
11433
  var BalanceSheetTable = ({
11425
11434
  data,
11426
11435
  config,
@@ -11428,12 +11437,12 @@ var BalanceSheetTable = ({
11428
11437
  }) => {
11429
11438
  const { isOpen, setIsOpen, expandedAllRows } = useTableExpandRow();
11430
11439
  const allRowKeys = [];
11431
- useEffect28(() => {
11440
+ useEffect29(() => {
11432
11441
  if (expandedAllRows) {
11433
11442
  setIsOpen(allRowKeys, true);
11434
11443
  }
11435
11444
  }, [expandedAllRows]);
11436
- useEffect28(() => {
11445
+ useEffect29(() => {
11437
11446
  setIsOpen(["assets"]);
11438
11447
  }, []);
11439
11448
  const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
@@ -11443,7 +11452,7 @@ var BalanceSheetTable = ({
11443
11452
  if (expandable) {
11444
11453
  allRowKeys.push(rowKey);
11445
11454
  }
11446
- return /* @__PURE__ */ React134.createElement(React134.Fragment, { key: rowKey + "-" + rowIndex }, /* @__PURE__ */ React134.createElement(
11455
+ return /* @__PURE__ */ React133.createElement(React133.Fragment, { key: rowKey + "-" + rowIndex }, /* @__PURE__ */ React133.createElement(
11447
11456
  TableRow,
11448
11457
  {
11449
11458
  rowKey: rowKey + "-" + rowIndex,
@@ -11453,8 +11462,8 @@ var BalanceSheetTable = ({
11453
11462
  depth,
11454
11463
  withDivider: depth === 0 && rowIndex > 0
11455
11464
  },
11456
- /* @__PURE__ */ React134.createElement(TableCell, { withExpandIcon: expandable, primary: expandable }, lineItem.display_name),
11457
- /* @__PURE__ */ React134.createElement(
11465
+ /* @__PURE__ */ React133.createElement(TableCell, { withExpandIcon: expandable, primary: expandable }, lineItem.display_name),
11466
+ /* @__PURE__ */ React133.createElement(
11458
11467
  TableCell,
11459
11468
  {
11460
11469
  isCurrency: !expandable || expandable && !expanded,
@@ -11469,18 +11478,18 @@ var BalanceSheetTable = ({
11469
11478
  rowKey + ":" + subItem.name,
11470
11479
  subIdx
11471
11480
  )
11472
- ), showChildren && expandable && /* @__PURE__ */ React134.createElement(
11481
+ ), showChildren && expandable && /* @__PURE__ */ React133.createElement(
11473
11482
  TableRow,
11474
11483
  {
11475
11484
  rowKey: rowKey + "-" + rowIndex + "--summation",
11476
11485
  depth: depth + 1,
11477
11486
  variant: "summation"
11478
11487
  },
11479
- /* @__PURE__ */ React134.createElement(TableCell, { primary: true }, `Total of ${lineItem.display_name}`),
11480
- /* @__PURE__ */ React134.createElement(TableCell, { primary: true, isCurrency: true }, lineItem.value)
11488
+ /* @__PURE__ */ React133.createElement(TableCell, { primary: true }, `Total of ${lineItem.display_name}`),
11489
+ /* @__PURE__ */ React133.createElement(TableCell, { primary: true, isCurrency: true }, lineItem.value)
11481
11490
  ));
11482
11491
  };
11483
- return /* @__PURE__ */ React134.createElement(Table, { borderCollapse: "collapse" }, /* @__PURE__ */ React134.createElement(TableHead, null, /* @__PURE__ */ React134.createElement(TableRow, { isHeadRow: true, rowKey: "balance-sheet-head-row" }, /* @__PURE__ */ React134.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.typeColumnHeader || "Type"), /* @__PURE__ */ React134.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.totalColumnHeader || "Total"))), /* @__PURE__ */ React134.createElement(TableBody, null, config.map((row, idx) => /* @__PURE__ */ React134.createElement(React134.Fragment, { key: row.lineItem }, data[row.lineItem] && renderLineItem(
11492
+ return /* @__PURE__ */ React133.createElement(Table, { borderCollapse: "collapse" }, /* @__PURE__ */ React133.createElement(TableHead, null, /* @__PURE__ */ React133.createElement(TableRow, { isHeadRow: true, rowKey: "balance-sheet-head-row" }, /* @__PURE__ */ React133.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.typeColumnHeader || "Type"), /* @__PURE__ */ React133.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.totalColumnHeader || "Total"))), /* @__PURE__ */ React133.createElement(TableBody, null, config.map((row, idx) => /* @__PURE__ */ React133.createElement(React133.Fragment, { key: row.lineItem }, data[row.lineItem] && renderLineItem(
11484
11493
  data[row.lineItem],
11485
11494
  0,
11486
11495
  row.lineItem,
@@ -11489,17 +11498,17 @@ var BalanceSheetTable = ({
11489
11498
  };
11490
11499
 
11491
11500
  // src/components/View/View.tsx
11492
- import React137 from "react";
11501
+ import React136 from "react";
11493
11502
 
11494
11503
  // src/components/ViewHeader/ViewHeader.tsx
11495
- import React135 from "react";
11504
+ import React134 from "react";
11496
11505
  var ViewHeader = ({ title, controls }) => {
11497
- return /* @__PURE__ */ React135.createElement("div", { className: "Layer__view-header" }, /* @__PURE__ */ React135.createElement("div", { className: "Layer__view-header__content" }, title && /* @__PURE__ */ React135.createElement(Heading, null, title), controls && /* @__PURE__ */ React135.createElement("div", { className: "Layer__view-header__controls" }, controls)));
11506
+ return /* @__PURE__ */ React134.createElement("div", { className: "Layer__view-header" }, /* @__PURE__ */ React134.createElement("div", { className: "Layer__view-header__content" }, title && /* @__PURE__ */ React134.createElement(Heading, null, title), controls && /* @__PURE__ */ React134.createElement("div", { className: "Layer__view-header__controls" }, controls)));
11498
11507
  };
11499
11508
 
11500
11509
  // src/components/Panel/Panel.tsx
11501
- import React136, { useEffect as useEffect29, useState as useState34 } from "react";
11502
- import classNames48 from "classnames";
11510
+ import React135, { useEffect as useEffect30, useState as useState33 } from "react";
11511
+ import classNames49 from "classnames";
11503
11512
  var Panel = ({
11504
11513
  children,
11505
11514
  className,
@@ -11509,27 +11518,27 @@ var Panel = ({
11509
11518
  parentRef,
11510
11519
  defaultSidebarHeight = false
11511
11520
  }) => {
11512
- const [sidebarHeight, setSidebarHeight] = useState34(0);
11513
- useEffect29(() => {
11521
+ const [sidebarHeight, setSidebarHeight] = useState33(0);
11522
+ useEffect30(() => {
11514
11523
  if (parentRef?.current?.offsetHeight) {
11515
11524
  setSidebarHeight(parentRef?.current?.offsetHeight - 1);
11516
11525
  }
11517
11526
  }, [parentRef?.current?.offsetHeight, sidebarIsOpen]);
11518
- const sidebarClass = classNames48(
11527
+ const sidebarClass = classNames49(
11519
11528
  "Layer__panel__sidebar",
11520
11529
  defaultSidebarHeight && "Layer__panel__sidebar--default"
11521
11530
  );
11522
- return /* @__PURE__ */ React136.createElement(
11531
+ return /* @__PURE__ */ React135.createElement(
11523
11532
  "div",
11524
11533
  {
11525
- className: classNames48(
11534
+ className: classNames49(
11526
11535
  "Layer__panel",
11527
11536
  className,
11528
11537
  sidebarIsOpen && "Layer__panel--open"
11529
11538
  )
11530
11539
  },
11531
- /* @__PURE__ */ React136.createElement("div", { className: "Layer__panel__content" }, header, children),
11532
- sidebar && /* @__PURE__ */ React136.createElement(
11540
+ /* @__PURE__ */ React135.createElement("div", { className: "Layer__panel__content" }, header, children),
11541
+ sidebar && /* @__PURE__ */ React135.createElement(
11533
11542
  "div",
11534
11543
  {
11535
11544
  className: sidebarClass,
@@ -11537,13 +11546,13 @@ var Panel = ({
11537
11546
  maxHeight: sidebarHeight > 0 && sidebarIsOpen ? sidebarHeight : 0
11538
11547
  } : {}
11539
11548
  },
11540
- /* @__PURE__ */ React136.createElement("div", { className: "Layer__panel__sidebar-content" }, sidebar)
11549
+ /* @__PURE__ */ React135.createElement("div", { className: "Layer__panel__sidebar-content" }, sidebar)
11541
11550
  )
11542
11551
  );
11543
11552
  };
11544
11553
 
11545
11554
  // src/components/View/View.tsx
11546
- import classNames49 from "classnames";
11555
+ import classNames50 from "classnames";
11547
11556
  var View = ({
11548
11557
  title,
11549
11558
  children,
@@ -11555,12 +11564,12 @@ var View = ({
11555
11564
  }) => {
11556
11565
  const { theme } = useLayerContext();
11557
11566
  const styles = parseStylesFromThemeConfig(theme);
11558
- const viewClassNames = classNames49(
11567
+ const viewClassNames = classNames50(
11559
11568
  "Layer__view",
11560
11569
  type === "panel" && "Layer__view--panel",
11561
11570
  viewClassName
11562
11571
  );
11563
- return /* @__PURE__ */ React137.createElement("div", { className: viewClassNames, style: { ...styles } }, /* @__PURE__ */ React137.createElement(ViewHeader, { title, controls: headerControls }), withSidebar ? /* @__PURE__ */ React137.createElement(Panel, { sidebarIsOpen: true, sidebar, defaultSidebarHeight: true }, /* @__PURE__ */ React137.createElement("div", { className: "Layer__view-main" }, children)) : /* @__PURE__ */ React137.createElement("div", { className: "Layer__view-main" }, children));
11572
+ return /* @__PURE__ */ React136.createElement("div", { className: viewClassNames, style: { ...styles } }, /* @__PURE__ */ React136.createElement(ViewHeader, { title, controls: headerControls }), withSidebar ? /* @__PURE__ */ React136.createElement(Panel, { sidebarIsOpen: true, sidebar, defaultSidebarHeight: true }, /* @__PURE__ */ React136.createElement("div", { className: "Layer__view-main" }, children)) : /* @__PURE__ */ React136.createElement("div", { className: "Layer__view-main" }, children));
11564
11573
  };
11565
11574
 
11566
11575
  // src/components/BalanceSheet/constants.ts
@@ -11582,7 +11591,7 @@ import { format as format4, parse, startOfDay as startOfDay2 } from "date-fns";
11582
11591
  var COMPONENT_NAME3 = "balance-sheet";
11583
11592
  var BalanceSheet = (props) => {
11584
11593
  const balanceSheetContextData = useBalanceSheet(props.effectiveDate);
11585
- return /* @__PURE__ */ React138.createElement(BalanceSheetContext.Provider, { value: balanceSheetContextData }, /* @__PURE__ */ React138.createElement(
11594
+ return /* @__PURE__ */ React137.createElement(BalanceSheetContext.Provider, { value: balanceSheetContextData }, /* @__PURE__ */ React137.createElement(
11586
11595
  BalanceSheetView,
11587
11596
  {
11588
11597
  asWidget: props.asWidget,
@@ -11596,9 +11605,9 @@ var BalanceSheetView = ({
11596
11605
  asWidget = false,
11597
11606
  stringOverrides
11598
11607
  }) => {
11599
- const [effectiveDate, setEffectiveDate] = useState35(startOfDay2(/* @__PURE__ */ new Date()));
11608
+ const [effectiveDate, setEffectiveDate] = useState34(startOfDay2(/* @__PURE__ */ new Date()));
11600
11609
  const { data, isLoading, refetch } = useBalanceSheet(effectiveDate);
11601
- useEffect30(() => {
11610
+ useEffect31(() => {
11602
11611
  const d1 = effectiveDate && format4(startOfDay2(effectiveDate), "yyyy-MM-dd'T'HH:mm:ssXXX");
11603
11612
  const d2 = data?.effective_date && format4(
11604
11613
  startOfDay2(
@@ -11611,19 +11620,19 @@ var BalanceSheetView = ({
11611
11620
  }
11612
11621
  }, [effectiveDate]);
11613
11622
  if (asWidget) {
11614
- return /* @__PURE__ */ React138.createElement(TableProvider, null, /* @__PURE__ */ React138.createElement(Container, { name: COMPONENT_NAME3, asWidget: true }, /* @__PURE__ */ React138.createElement(
11623
+ return /* @__PURE__ */ React137.createElement(TableProvider, null, /* @__PURE__ */ React137.createElement(Container, { name: COMPONENT_NAME3, asWidget: true }, /* @__PURE__ */ React137.createElement(
11615
11624
  View,
11616
11625
  {
11617
11626
  type: "panel",
11618
- headerControls: /* @__PURE__ */ React138.createElement(React138.Fragment, null, /* @__PURE__ */ React138.createElement(
11627
+ headerControls: /* @__PURE__ */ React137.createElement(React137.Fragment, null, /* @__PURE__ */ React137.createElement(
11619
11628
  BalanceSheetDatePicker,
11620
11629
  {
11621
11630
  effectiveDate,
11622
11631
  setEffectiveDate
11623
11632
  }
11624
- ), withExpandAllButton && /* @__PURE__ */ React138.createElement(BalanceSheetExpandAllButton, null))
11633
+ ), withExpandAllButton && /* @__PURE__ */ React137.createElement(BalanceSheetExpandAllButton, null))
11625
11634
  },
11626
- !data || isLoading ? /* @__PURE__ */ React138.createElement("div", { className: `Layer__${COMPONENT_NAME3}__loader-container` }, /* @__PURE__ */ React138.createElement(Loader2, null)) : /* @__PURE__ */ React138.createElement(
11635
+ !data || isLoading ? /* @__PURE__ */ React137.createElement("div", { className: `Layer__${COMPONENT_NAME3}__loader-container` }, /* @__PURE__ */ React137.createElement(Loader2, null)) : /* @__PURE__ */ React137.createElement(
11627
11636
  BalanceSheetTable,
11628
11637
  {
11629
11638
  data,
@@ -11633,19 +11642,19 @@ var BalanceSheetView = ({
11633
11642
  )
11634
11643
  )));
11635
11644
  }
11636
- return /* @__PURE__ */ React138.createElement(TableProvider, null, /* @__PURE__ */ React138.createElement(
11645
+ return /* @__PURE__ */ React137.createElement(TableProvider, null, /* @__PURE__ */ React137.createElement(
11637
11646
  View,
11638
11647
  {
11639
11648
  type: "panel",
11640
- headerControls: /* @__PURE__ */ React138.createElement(React138.Fragment, null, /* @__PURE__ */ React138.createElement(
11649
+ headerControls: /* @__PURE__ */ React137.createElement(React137.Fragment, null, /* @__PURE__ */ React137.createElement(
11641
11650
  BalanceSheetDatePicker,
11642
11651
  {
11643
11652
  effectiveDate,
11644
11653
  setEffectiveDate
11645
11654
  }
11646
- ), withExpandAllButton && /* @__PURE__ */ React138.createElement(BalanceSheetExpandAllButton, null))
11655
+ ), withExpandAllButton && /* @__PURE__ */ React137.createElement(BalanceSheetExpandAllButton, null))
11647
11656
  },
11648
- !data || isLoading ? /* @__PURE__ */ React138.createElement("div", { className: `Layer__${COMPONENT_NAME3}__loader-container` }, /* @__PURE__ */ React138.createElement(Loader2, null)) : /* @__PURE__ */ React138.createElement(
11657
+ !data || isLoading ? /* @__PURE__ */ React137.createElement("div", { className: `Layer__${COMPONENT_NAME3}__loader-container` }, /* @__PURE__ */ React137.createElement(Loader2, null)) : /* @__PURE__ */ React137.createElement(
11649
11658
  BalanceSheetTable,
11650
11659
  {
11651
11660
  data,
@@ -11657,7 +11666,7 @@ var BalanceSheetView = ({
11657
11666
  };
11658
11667
 
11659
11668
  // src/components/StatementOfCashFlow/StatementOfCashFlow.tsx
11660
- import React140, { useState as useState36 } from "react";
11669
+ import React139, { useState as useState35 } from "react";
11661
11670
 
11662
11671
  // src/contexts/StatementOfCashContext/StatementOfCashFlowContext.tsx
11663
11672
  import { createContext as createContext9 } from "react";
@@ -11670,7 +11679,7 @@ var StatementOfCashFlowContext = createContext9({
11670
11679
  });
11671
11680
 
11672
11681
  // src/hooks/useStatementOfCashFlow/useStatementOfCashFlow.tsx
11673
- import { useEffect as useEffect31 } from "react";
11682
+ import { useEffect as useEffect32 } from "react";
11674
11683
  import { format as format5, startOfDay as startOfDay3 } from "date-fns";
11675
11684
  import useSWR6 from "swr";
11676
11685
  var useStatementOfCashFlow = (startDate = /* @__PURE__ */ new Date(), endDate = /* @__PURE__ */ new Date()) => {
@@ -11694,12 +11703,12 @@ var useStatementOfCashFlow = (startDate = /* @__PURE__ */ new Date(), endDate =
11694
11703
  const refetch = () => {
11695
11704
  mutate();
11696
11705
  };
11697
- useEffect31(() => {
11706
+ useEffect32(() => {
11698
11707
  if (queryKey && (isLoading || isValidating)) {
11699
11708
  read("STATEMENT_OF_CASH_FLOWS" /* STATEMENT_OF_CASH_FLOWS */, queryKey);
11700
11709
  }
11701
11710
  }, [isLoading, isValidating]);
11702
- useEffect31(() => {
11711
+ useEffect32(() => {
11703
11712
  if (queryKey && hasBeenTouched(queryKey)) {
11704
11713
  refetch();
11705
11714
  }
@@ -11708,7 +11717,7 @@ var useStatementOfCashFlow = (startDate = /* @__PURE__ */ new Date(), endDate =
11708
11717
  };
11709
11718
 
11710
11719
  // src/components/StatementOfCashFlowTable/StatementOfCashFlowTable.tsx
11711
- import React139 from "react";
11720
+ import React138 from "react";
11712
11721
  var StatementOfCashFlowTable = ({
11713
11722
  data,
11714
11723
  config,
@@ -11718,7 +11727,7 @@ var StatementOfCashFlowTable = ({
11718
11727
  const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
11719
11728
  const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
11720
11729
  const expanded = expandable ? isOpen(rowKey) : true;
11721
- return /* @__PURE__ */ React139.createElement(React139.Fragment, { key: rowKey + "-" + rowIndex }, /* @__PURE__ */ React139.createElement(
11730
+ return /* @__PURE__ */ React138.createElement(React138.Fragment, { key: rowKey + "-" + rowIndex }, /* @__PURE__ */ React138.createElement(
11722
11731
  TableRow,
11723
11732
  {
11724
11733
  rowKey: rowKey + "-" + rowIndex,
@@ -11727,8 +11736,8 @@ var StatementOfCashFlowTable = ({
11727
11736
  handleExpand: () => setIsOpen(rowKey),
11728
11737
  depth
11729
11738
  },
11730
- /* @__PURE__ */ React139.createElement(TableCell, { withExpandIcon: expandable, primary: expandable }, lineItem.display_name),
11731
- /* @__PURE__ */ React139.createElement(
11739
+ /* @__PURE__ */ React138.createElement(TableCell, { withExpandIcon: expandable, primary: expandable }, lineItem.display_name),
11740
+ /* @__PURE__ */ React138.createElement(
11732
11741
  TableCell,
11733
11742
  {
11734
11743
  isCurrency: !expandable || expandable && !expanded,
@@ -11743,27 +11752,27 @@ var StatementOfCashFlowTable = ({
11743
11752
  rowKey + ":" + subItem.name,
11744
11753
  subIdx
11745
11754
  )
11746
- ), expanded && expandable && /* @__PURE__ */ React139.createElement(
11755
+ ), expanded && expandable && /* @__PURE__ */ React138.createElement(
11747
11756
  TableRow,
11748
11757
  {
11749
11758
  rowKey: rowKey + "-" + rowIndex + "--summation",
11750
11759
  depth: depth + 1,
11751
11760
  variant: "summation"
11752
11761
  },
11753
- /* @__PURE__ */ React139.createElement(TableCell, { primary: true }, `Total of ${lineItem.display_name}`),
11754
- /* @__PURE__ */ React139.createElement(TableCell, { primary: true, isCurrency: true }, lineItem.value)
11762
+ /* @__PURE__ */ React138.createElement(TableCell, { primary: true }, `Total of ${lineItem.display_name}`),
11763
+ /* @__PURE__ */ React138.createElement(TableCell, { primary: true, isCurrency: true }, lineItem.value)
11755
11764
  ));
11756
11765
  };
11757
- return /* @__PURE__ */ React139.createElement(Table, { borderCollapse: "collapse" }, /* @__PURE__ */ React139.createElement(TableHead, null, /* @__PURE__ */ React139.createElement(TableRow, { rowKey: "soc-flow-head-row", isHeadRow: true }, /* @__PURE__ */ React139.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.typeColumnHeader || "Type"), /* @__PURE__ */ React139.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.totalColumnHeader || "Total"))), /* @__PURE__ */ React139.createElement(TableBody, null, config.map((row, idx) => {
11766
+ return /* @__PURE__ */ React138.createElement(Table, { borderCollapse: "collapse" }, /* @__PURE__ */ React138.createElement(TableHead, null, /* @__PURE__ */ React138.createElement(TableRow, { rowKey: "soc-flow-head-row", isHeadRow: true }, /* @__PURE__ */ React138.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.typeColumnHeader || "Type"), /* @__PURE__ */ React138.createElement(TableCell, { isHeaderCell: true }, stringOverrides?.totalColumnHeader || "Total"))), /* @__PURE__ */ React138.createElement(TableBody, null, config.map((row, idx) => {
11758
11767
  if (row.type === "line_item") {
11759
- return /* @__PURE__ */ React139.createElement(React139.Fragment, { key: row.lineItem }, data[row.lineItem] && renderLineItem(
11768
+ return /* @__PURE__ */ React138.createElement(React138.Fragment, { key: row.lineItem }, data[row.lineItem] && renderLineItem(
11760
11769
  data[row.lineItem],
11761
11770
  0,
11762
11771
  row.lineItem ? row.lineItem : "",
11763
11772
  idx
11764
11773
  ));
11765
11774
  } else {
11766
- return /* @__PURE__ */ React139.createElement(TableRow, { rowKey: row.name + "-" + idx, variant: "default" }, /* @__PURE__ */ React139.createElement(TableCell, { primary: true }, row.displayName), /* @__PURE__ */ React139.createElement(TableCell, { primary: true, isCurrency: true }, row.lineItem));
11775
+ return /* @__PURE__ */ React138.createElement(TableRow, { rowKey: row.name + "-" + idx, variant: "default" }, /* @__PURE__ */ React138.createElement(TableCell, { primary: true }, row.displayName), /* @__PURE__ */ React138.createElement(TableCell, { primary: true, isCurrency: true }, row.lineItem));
11767
11776
  }
11768
11777
  })));
11769
11778
  };
@@ -11812,13 +11821,13 @@ import { startOfDay as startOfDay4, subWeeks } from "date-fns";
11812
11821
  var COMPONENT_NAME4 = "statement-of-cash-flow";
11813
11822
  var StatementOfCashFlow = ({ stringOverrides }) => {
11814
11823
  const cashContextData = useStatementOfCashFlow();
11815
- return /* @__PURE__ */ React140.createElement(StatementOfCashFlowContext.Provider, { value: cashContextData }, /* @__PURE__ */ React140.createElement(StatementOfCashFlowView, { stringOverrides }));
11824
+ return /* @__PURE__ */ React139.createElement(StatementOfCashFlowContext.Provider, { value: cashContextData }, /* @__PURE__ */ React139.createElement(StatementOfCashFlowView, { stringOverrides }));
11816
11825
  };
11817
11826
  var StatementOfCashFlowView = ({ stringOverrides }) => {
11818
- const [startDate, setStartDate] = useState36(
11827
+ const [startDate, setStartDate] = useState35(
11819
11828
  startOfDay4(subWeeks(/* @__PURE__ */ new Date(), 4))
11820
11829
  );
11821
- const [endDate, setEndDate] = useState36(startOfDay4(/* @__PURE__ */ new Date()));
11830
+ const [endDate, setEndDate] = useState35(startOfDay4(/* @__PURE__ */ new Date()));
11822
11831
  const { data, isLoading, refetch } = useStatementOfCashFlow(
11823
11832
  startDate,
11824
11833
  endDate
@@ -11834,11 +11843,11 @@ var StatementOfCashFlowView = ({ stringOverrides }) => {
11834
11843
  refetch();
11835
11844
  }
11836
11845
  };
11837
- return /* @__PURE__ */ React140.createElement(TableProvider, null, /* @__PURE__ */ React140.createElement(
11846
+ return /* @__PURE__ */ React139.createElement(TableProvider, null, /* @__PURE__ */ React139.createElement(
11838
11847
  View,
11839
11848
  {
11840
11849
  type: "panel",
11841
- headerControls: /* @__PURE__ */ React140.createElement(React140.Fragment, null, /* @__PURE__ */ React140.createElement(
11850
+ headerControls: /* @__PURE__ */ React139.createElement(React139.Fragment, null, /* @__PURE__ */ React139.createElement(
11842
11851
  DatePicker,
11843
11852
  {
11844
11853
  selected: [startDate, endDate],
@@ -11848,7 +11857,7 @@ var StatementOfCashFlowView = ({ stringOverrides }) => {
11848
11857
  }
11849
11858
  ))
11850
11859
  },
11851
- !data || isLoading ? /* @__PURE__ */ React140.createElement("div", { className: `Layer__${COMPONENT_NAME4}__loader-container` }, /* @__PURE__ */ React140.createElement(Loader2, null)) : /* @__PURE__ */ React140.createElement(
11860
+ !data || isLoading ? /* @__PURE__ */ React139.createElement("div", { className: `Layer__${COMPONENT_NAME4}__loader-container` }, /* @__PURE__ */ React139.createElement(Loader2, null)) : /* @__PURE__ */ React139.createElement(
11852
11861
  StatementOfCashFlowTable,
11853
11862
  {
11854
11863
  data,
@@ -11860,7 +11869,7 @@ var StatementOfCashFlowView = ({ stringOverrides }) => {
11860
11869
  };
11861
11870
 
11862
11871
  // src/components/ChartOfAccounts/ChartOfAccounts.tsx
11863
- import React155, { useContext as useContext25, useState as useState43 } from "react";
11872
+ import React154, { useContext as useContext25, useState as useState42 } from "react";
11864
11873
 
11865
11874
  // src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
11866
11875
  import { createContext as createContext10 } from "react";
@@ -11919,7 +11928,7 @@ var LedgerAccountsContext = createContext11({
11919
11928
  });
11920
11929
 
11921
11930
  // src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
11922
- import { useEffect as useEffect32, useState as useState37 } from "react";
11931
+ import { useEffect as useEffect33, useState as useState36 } from "react";
11923
11932
 
11924
11933
  // src/components/ChartOfAccountsForm/constants.ts
11925
11934
  var LEDGER_ACCOUNT_TYPES = [
@@ -12216,13 +12225,13 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
12216
12225
  syncTimestamps,
12217
12226
  hasBeenTouched
12218
12227
  } = useLayerContext();
12219
- const [form, setForm] = useState37();
12220
- const [sendingForm, setSendingForm] = useState37(false);
12221
- const [apiError, setApiError] = useState37(void 0);
12222
- const [startDate, setStartDate] = useState37(
12228
+ const [form, setForm] = useState36();
12229
+ const [sendingForm, setSendingForm] = useState36(false);
12230
+ const [apiError, setApiError] = useState36(void 0);
12231
+ const [startDate, setStartDate] = useState36(
12223
12232
  initialStartDate ?? startOfMonth12(Date.now())
12224
12233
  );
12225
- const [endDate, setEndDate] = useState37(
12234
+ const [endDate, setEndDate] = useState36(
12226
12235
  initialEndDate ?? endOfMonth10(Date.now())
12227
12236
  );
12228
12237
  const queryKey = businessId && auth?.access_token && `chart-of-accounts-${businessId}-${startDate?.valueOf()}-${endDate?.valueOf()}`;
@@ -12403,12 +12412,12 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
12403
12412
  newEndDate && setEndDate(newEndDate);
12404
12413
  };
12405
12414
  const refetch = () => mutate();
12406
- useEffect32(() => {
12415
+ useEffect33(() => {
12407
12416
  if (queryKey && (isLoading || isValidating)) {
12408
12417
  read("CHART_OF_ACCOUNTS" /* CHART_OF_ACCOUNTS */, queryKey);
12409
12418
  }
12410
12419
  }, [isLoading, isValidating]);
12411
- useEffect32(() => {
12420
+ useEffect33(() => {
12412
12421
  if (queryKey && hasBeenTouched(queryKey)) {
12413
12422
  refetch();
12414
12423
  }
@@ -12434,12 +12443,12 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
12434
12443
  };
12435
12444
 
12436
12445
  // src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
12437
- import { useEffect as useEffect33, useState as useState38 } from "react";
12446
+ import { useEffect as useEffect34, useState as useState37 } from "react";
12438
12447
  import useSWR8 from "swr";
12439
12448
  var useLedgerAccounts = () => {
12440
12449
  const { auth, businessId, apiUrl, read, syncTimestamps, hasBeenTouched } = useLayerContext();
12441
- const [accountId, setAccountId] = useState38();
12442
- const [selectedEntryId, setSelectedEntryId] = useState38();
12450
+ const [accountId, setAccountId] = useState37();
12451
+ const [selectedEntryId, setSelectedEntryId] = useState37();
12443
12452
  const queryKey = businessId && accountId && auth?.access_token && `ledger-accounts-lines-${businessId}-${accountId}`;
12444
12453
  const { data, isLoading, isValidating, error, mutate } = useSWR8(
12445
12454
  queryKey,
@@ -12464,12 +12473,12 @@ var useLedgerAccounts = () => {
12464
12473
  setSelectedEntryId(void 0);
12465
12474
  mutateEntryData();
12466
12475
  };
12467
- useEffect33(() => {
12476
+ useEffect34(() => {
12468
12477
  if (queryKey && (isLoading || isValidating)) {
12469
12478
  read("LEDGER_ACCOUNTS" /* LEDGER_ACCOUNTS */, queryKey);
12470
12479
  }
12471
12480
  }, [isLoading, isValidating]);
12472
- useEffect33(() => {
12481
+ useEffect34(() => {
12473
12482
  if (queryKey && hasBeenTouched(queryKey)) {
12474
12483
  refetch();
12475
12484
  }
@@ -12493,14 +12502,14 @@ var useLedgerAccounts = () => {
12493
12502
  };
12494
12503
 
12495
12504
  // src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
12496
- import React147, { useContext as useContext21, useState as useState40 } from "react";
12505
+ import React146, { useContext as useContext21, useState as useState39 } from "react";
12497
12506
 
12498
12507
  // src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
12499
- import React141, { useContext as useContext18 } from "react";
12508
+ import React140, { useContext as useContext18 } from "react";
12500
12509
  import { endOfMonth as endOfMonth11, startOfMonth as startOfMonth13 } from "date-fns";
12501
12510
  var ChartOfAccountsDatePicker = () => {
12502
12511
  const { changeDateRange, dateRange } = useContext18(ChartOfAccountsContext);
12503
- return /* @__PURE__ */ React141.createElement(
12512
+ return /* @__PURE__ */ React140.createElement(
12504
12513
  DatePicker,
12505
12514
  {
12506
12515
  mode: "monthPicker",
@@ -12518,11 +12527,11 @@ var ChartOfAccountsDatePicker = () => {
12518
12527
  };
12519
12528
 
12520
12529
  // src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
12521
- import React143, { useContext as useContext19, useEffect as useEffect34, useState as useState39 } from "react";
12530
+ import React142, { useContext as useContext19, useEffect as useEffect35, useState as useState38 } from "react";
12522
12531
 
12523
12532
  // src/icons/Edit2.tsx
12524
- import * as React142 from "react";
12525
- var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React142.createElement(
12533
+ import * as React141 from "react";
12534
+ var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React141.createElement(
12526
12535
  "svg",
12527
12536
  {
12528
12537
  xmlns: "http://www.w3.org/2000/svg",
@@ -12532,7 +12541,7 @@ var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React142.createElement(
12532
12541
  width: size,
12533
12542
  height: size
12534
12543
  },
12535
- /* @__PURE__ */ React142.createElement(
12544
+ /* @__PURE__ */ React141.createElement(
12536
12545
  "path",
12537
12546
  {
12538
12547
  d: "M12.75 2.25C12.947 2.05301 13.1808 1.89676 13.4382 1.79015C13.6956 1.68355 13.9714 1.62868 14.25 1.62868C14.5286 1.62868 14.8044 1.68355 15.0618 1.79015C15.3192 1.89676 15.553 2.05301 15.75 2.25C15.947 2.44698 16.1032 2.68083 16.2098 2.9382C16.3165 3.19557 16.3713 3.47142 16.3713 3.75C16.3713 4.02857 16.3165 4.30442 16.2098 4.56179C16.1032 4.81916 15.947 5.05302 15.75 5.25L5.625 15.375L1.5 16.5L2.625 12.375L12.75 2.25Z",
@@ -12545,7 +12554,7 @@ var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React142.createElement(
12545
12554
  var Edit2_default = Edit2;
12546
12555
 
12547
12556
  // src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
12548
- import classNames50 from "classnames";
12557
+ import classNames51 from "classnames";
12549
12558
  var INDENTATION = 24;
12550
12559
  var EXPANDED_STYLE2 = {
12551
12560
  height: 52,
@@ -12579,7 +12588,7 @@ var ChartOfAccountsRow = ({
12579
12588
  const { form, editAccount } = useContext19(ChartOfAccountsContext);
12580
12589
  const { setAccountId } = useContext19(LedgerAccountsContext);
12581
12590
  const baseStyle = view === "desktop" ? EXPANDED_STYLE2 : EXPANDED_MOBILE_STYLE;
12582
- const [isOpen, setIsOpen] = useState39(defaultOpen);
12591
+ const [isOpen, setIsOpen] = useState38(defaultOpen);
12583
12592
  const style = expanded ? {
12584
12593
  ...baseStyle,
12585
12594
  transitionDelay: `${15 * index}ms`
@@ -12587,20 +12596,20 @@ var ChartOfAccountsRow = ({
12587
12596
  ...COLLAPSED_STYLE2,
12588
12597
  transitionDelay: `${acountsLength - 15 * index}ms`
12589
12598
  };
12590
- const [showComponent, setShowComponent] = useState39(false);
12591
- const [prevExpandedAll, setPrevExpandedAll] = useState39(expandAll);
12592
- useEffect34(() => {
12599
+ const [showComponent, setShowComponent] = useState38(false);
12600
+ const [prevExpandedAll, setPrevExpandedAll] = useState38(expandAll);
12601
+ useEffect35(() => {
12593
12602
  const timeoutId = setTimeout(() => {
12594
12603
  setShowComponent(true);
12595
12604
  }, cumulativeIndex * 50);
12596
12605
  return () => clearTimeout(timeoutId);
12597
12606
  }, []);
12598
- useEffect34(() => {
12607
+ useEffect35(() => {
12599
12608
  if (prevExpandedAll !== expandAll && expandAll) {
12600
12609
  setIsOpen(expandAll === "collapsed" ? false : true);
12601
12610
  }
12602
12611
  }, [expandAll]);
12603
- const baseClass = classNames50(
12612
+ const baseClass = classNames51(
12604
12613
  "Layer__table-row",
12605
12614
  isOpen ? "Layer__table-row--expanded" : "Layer__table-row--collapsed",
12606
12615
  !expanded && "Layer__table-row--hidden",
@@ -12608,15 +12617,15 @@ var ChartOfAccountsRow = ({
12608
12617
  form?.accountId === account.id && "Layer__table-row--active",
12609
12618
  !showComponent && "Layer__table-row--anim-starting-state"
12610
12619
  );
12611
- const desktopRowClass = classNames50(
12620
+ const desktopRowClass = classNames51(
12612
12621
  baseClass,
12613
12622
  "Layer__chart-of-accounts__row---desktop"
12614
12623
  );
12615
- const mobileRowClass = classNames50(
12624
+ const mobileRowClass = classNames51(
12616
12625
  baseClass,
12617
12626
  "Layer__chart-of-accounts__row---mobile"
12618
12627
  );
12619
- return /* @__PURE__ */ React143.createElement(React143.Fragment, null, view === "desktop" && /* @__PURE__ */ React143.createElement(
12628
+ return /* @__PURE__ */ React142.createElement(React142.Fragment, null, view === "desktop" && /* @__PURE__ */ React142.createElement(
12620
12629
  "tr",
12621
12630
  {
12622
12631
  className: desktopRowClass,
@@ -12626,7 +12635,7 @@ var ChartOfAccountsRow = ({
12626
12635
  setAccountId(account.id);
12627
12636
  }
12628
12637
  },
12629
- /* @__PURE__ */ React143.createElement("td", { className: "Layer__table-cell Layer__coa__name" }, /* @__PURE__ */ React143.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React143.createElement(
12638
+ /* @__PURE__ */ React142.createElement("td", { className: "Layer__table-cell Layer__coa__name" }, /* @__PURE__ */ React142.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React142.createElement(
12630
12639
  "span",
12631
12640
  {
12632
12641
  className: "Layer__table-cell-content-indentation",
@@ -12634,7 +12643,7 @@ var ChartOfAccountsRow = ({
12634
12643
  paddingLeft: INDENTATION * depth + 16
12635
12644
  }
12636
12645
  },
12637
- account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ React143.createElement(
12646
+ account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ React142.createElement(
12638
12647
  ChevronDownFill_default,
12639
12648
  {
12640
12649
  size: 16,
@@ -12645,22 +12654,22 @@ var ChartOfAccountsRow = ({
12645
12654
  }
12646
12655
  }
12647
12656
  ),
12648
- /* @__PURE__ */ React143.createElement("span", { className: "Layer__coa__name__text" }, account.name)
12657
+ /* @__PURE__ */ React142.createElement("span", { className: "Layer__coa__name__text" }, account.name)
12649
12658
  ))),
12650
- /* @__PURE__ */ React143.createElement("td", { className: "Layer__table-cell Layer__coa__type" }, /* @__PURE__ */ React143.createElement(
12659
+ /* @__PURE__ */ React142.createElement("td", { className: "Layer__table-cell Layer__coa__type" }, /* @__PURE__ */ React142.createElement(
12651
12660
  "span",
12652
12661
  {
12653
12662
  className: "Layer__table-cell-content Layer__mobile--hidden",
12654
12663
  style
12655
12664
  },
12656
12665
  account.account_type?.display_name
12657
- ), /* @__PURE__ */ React143.createElement(
12666
+ ), /* @__PURE__ */ React142.createElement(
12658
12667
  "span",
12659
12668
  {
12660
12669
  className: "Layer__table-cell-content Layer__desktop--hidden",
12661
12670
  style
12662
12671
  },
12663
- /* @__PURE__ */ React143.createElement(
12672
+ /* @__PURE__ */ React142.createElement(
12664
12673
  Text,
12665
12674
  {
12666
12675
  weight: "bold" /* bold */,
@@ -12668,10 +12677,10 @@ var ChartOfAccountsRow = ({
12668
12677
  },
12669
12678
  account.normality
12670
12679
  ),
12671
- /* @__PURE__ */ React143.createElement(Text, { className: "Layer__coa__subtype--mobile" }, account.account_subtype?.display_name)
12680
+ /* @__PURE__ */ React142.createElement(Text, { className: "Layer__coa__subtype--mobile" }, account.account_subtype?.display_name)
12672
12681
  )),
12673
- /* @__PURE__ */ React143.createElement("td", { className: "Layer__table-cell Layer__coa__subtype Layer__mobile--hidden" }, /* @__PURE__ */ React143.createElement("span", { className: "Layer__table-cell-content", style }, account.account_subtype?.display_name)),
12674
- /* @__PURE__ */ React143.createElement("td", { className: "Layer__table-cell Layer__coa__balance" }, /* @__PURE__ */ React143.createElement(
12682
+ /* @__PURE__ */ React142.createElement("td", { className: "Layer__table-cell Layer__coa__subtype Layer__mobile--hidden" }, /* @__PURE__ */ React142.createElement("span", { className: "Layer__table-cell-content", style }, account.account_subtype?.display_name)),
12683
+ /* @__PURE__ */ React142.createElement("td", { className: "Layer__table-cell Layer__coa__balance" }, /* @__PURE__ */ React142.createElement(
12675
12684
  "span",
12676
12685
  {
12677
12686
  className: "Layer__table-cell-content Layer__table-cell--amount",
@@ -12680,11 +12689,11 @@ var ChartOfAccountsRow = ({
12680
12689
  "$",
12681
12690
  centsToDollars(Math.abs(account.balance || 0))
12682
12691
  )),
12683
- /* @__PURE__ */ React143.createElement("td", { className: "Layer__table-cell Layer__coa__actions" }, /* @__PURE__ */ React143.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React143.createElement(
12692
+ /* @__PURE__ */ React142.createElement("td", { className: "Layer__table-cell Layer__coa__actions" }, /* @__PURE__ */ React142.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React142.createElement(
12684
12693
  Button,
12685
12694
  {
12686
12695
  variant: "secondary" /* secondary */,
12687
- rightIcon: /* @__PURE__ */ React143.createElement(Edit2_default, { size: 12 }),
12696
+ rightIcon: /* @__PURE__ */ React142.createElement(Edit2_default, { size: 12 }),
12688
12697
  iconOnly: true,
12689
12698
  onClick: (e) => {
12690
12699
  e.preventDefault();
@@ -12694,7 +12703,7 @@ var ChartOfAccountsRow = ({
12694
12703
  },
12695
12704
  "Edit"
12696
12705
  )))
12697
- ), view === "mobile" || view === "tablet" ? /* @__PURE__ */ React143.createElement(
12706
+ ), view === "mobile" || view === "tablet" ? /* @__PURE__ */ React142.createElement(
12698
12707
  "tr",
12699
12708
  {
12700
12709
  className: mobileRowClass,
@@ -12704,7 +12713,7 @@ var ChartOfAccountsRow = ({
12704
12713
  setAccountId(account.id);
12705
12714
  }
12706
12715
  },
12707
- /* @__PURE__ */ React143.createElement("td", { className: "Layer__table-cell", colSpan: 5 }, /* @__PURE__ */ React143.createElement(
12716
+ /* @__PURE__ */ React142.createElement("td", { className: "Layer__table-cell", colSpan: 5 }, /* @__PURE__ */ React142.createElement(
12708
12717
  "span",
12709
12718
  {
12710
12719
  className: "Layer__table-cell-content Layer__table-cell-content-indentation",
@@ -12713,7 +12722,7 @@ var ChartOfAccountsRow = ({
12713
12722
  ...style
12714
12723
  }
12715
12724
  },
12716
- account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ React143.createElement(
12725
+ account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ React142.createElement(
12717
12726
  ChevronDownFill_default,
12718
12727
  {
12719
12728
  size: 16,
@@ -12724,14 +12733,14 @@ var ChartOfAccountsRow = ({
12724
12733
  }
12725
12734
  }
12726
12735
  ),
12727
- /* @__PURE__ */ React143.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content" }, /* @__PURE__ */ React143.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__top-row" }, /* @__PURE__ */ React143.createElement(
12736
+ /* @__PURE__ */ React142.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content" }, /* @__PURE__ */ React142.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__top-row" }, /* @__PURE__ */ React142.createElement(
12728
12737
  Text,
12729
12738
  {
12730
12739
  as: "span",
12731
12740
  className: "Layer__chart-of-accounts__mobile-row-content__name"
12732
12741
  },
12733
12742
  account.name
12734
- ), /* @__PURE__ */ React143.createElement(
12743
+ ), /* @__PURE__ */ React142.createElement(
12735
12744
  TextButton,
12736
12745
  {
12737
12746
  onClick: (e) => {
@@ -12741,7 +12750,7 @@ var ChartOfAccountsRow = ({
12741
12750
  }
12742
12751
  },
12743
12752
  "Edit"
12744
- )), /* @__PURE__ */ React143.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__bottom-row" }, /* @__PURE__ */ React143.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__types" }, /* @__PURE__ */ React143.createElement(Text, { as: "span" }, account.normality), /* @__PURE__ */ React143.createElement("span", { className: "Layer__chart-of-accounts__mobile-row-content__separator" }), /* @__PURE__ */ React143.createElement(Text, { as: "span" }, "Sub-Type")), /* @__PURE__ */ React143.createElement(
12753
+ )), /* @__PURE__ */ React142.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__bottom-row" }, /* @__PURE__ */ React142.createElement("div", { className: "Layer__chart-of-accounts__mobile-row-content__types" }, /* @__PURE__ */ React142.createElement(Text, { as: "span" }, account.normality), /* @__PURE__ */ React142.createElement("span", { className: "Layer__chart-of-accounts__mobile-row-content__separator" }), /* @__PURE__ */ React142.createElement(Text, { as: "span" }, "Sub-Type")), /* @__PURE__ */ React142.createElement(
12745
12754
  Text,
12746
12755
  {
12747
12756
  as: "span",
@@ -12751,7 +12760,7 @@ var ChartOfAccountsRow = ({
12751
12760
  centsToDollars(Math.abs(account.balance || 0))
12752
12761
  )))
12753
12762
  ))
12754
- ) : null, (account.sub_accounts || []).map((subAccount, idx) => /* @__PURE__ */ React143.createElement(
12763
+ ) : null, (account.sub_accounts || []).map((subAccount, idx) => /* @__PURE__ */ React142.createElement(
12755
12764
  ChartOfAccountsRow,
12756
12765
  {
12757
12766
  key: subAccount.id,
@@ -12768,10 +12777,10 @@ var ChartOfAccountsRow = ({
12768
12777
  };
12769
12778
 
12770
12779
  // src/components/ChartOfAccountsSidebar/ChartOfAccountsSidebar.tsx
12771
- import React146 from "react";
12780
+ import React145 from "react";
12772
12781
 
12773
12782
  // src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
12774
- import React145, { useContext as useContext20, useMemo as useMemo13 } from "react";
12783
+ import React144, { useContext as useContext20, useMemo as useMemo13 } from "react";
12775
12784
 
12776
12785
  // src/components/ChartOfAccountsForm/useParentOptions.ts
12777
12786
  import { useMemo as useMemo12 } from "react";
@@ -12808,7 +12817,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12808
12817
  if (!form) {
12809
12818
  return;
12810
12819
  }
12811
- return /* @__PURE__ */ React145.createElement(
12820
+ return /* @__PURE__ */ React144.createElement(
12812
12821
  "form",
12813
12822
  {
12814
12823
  className: "Layer__form",
@@ -12817,7 +12826,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12817
12826
  submitForm();
12818
12827
  }
12819
12828
  },
12820
- /* @__PURE__ */ React145.createElement("div", { className: "Layer__chart-of-accounts__sidebar__header" }, /* @__PURE__ */ React145.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, form?.action === "edit" ? stringOverrides?.editModeHeader || "Edit Account" : stringOverrides?.createModeHeader || "Add New Account"), /* @__PURE__ */ React145.createElement("div", { className: "actions" }, /* @__PURE__ */ React145.createElement(
12829
+ /* @__PURE__ */ React144.createElement("div", { className: "Layer__chart-of-accounts__sidebar__header" }, /* @__PURE__ */ React144.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, form?.action === "edit" ? stringOverrides?.editModeHeader || "Edit Account" : stringOverrides?.createModeHeader || "Add New Account"), /* @__PURE__ */ React144.createElement("div", { className: "actions" }, /* @__PURE__ */ React144.createElement(
12821
12830
  Button,
12822
12831
  {
12823
12832
  type: "button",
@@ -12826,7 +12835,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12826
12835
  disabled: sendingForm
12827
12836
  },
12828
12837
  stringOverrides?.cancelButton || "Cancel"
12829
- ), apiError && /* @__PURE__ */ React145.createElement(
12838
+ ), apiError && /* @__PURE__ */ React144.createElement(
12830
12839
  RetryButton,
12831
12840
  {
12832
12841
  type: "submit",
@@ -12835,7 +12844,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12835
12844
  disabled: sendingForm
12836
12845
  },
12837
12846
  stringOverrides?.retryButton || "Retry"
12838
- ), !apiError && /* @__PURE__ */ React145.createElement(
12847
+ ), !apiError && /* @__PURE__ */ React144.createElement(
12839
12848
  SubmitButton,
12840
12849
  {
12841
12850
  type: "submit",
@@ -12845,7 +12854,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12845
12854
  },
12846
12855
  stringOverrides?.saveButton || "Save"
12847
12856
  ))),
12848
- apiError && /* @__PURE__ */ React145.createElement(
12857
+ apiError && /* @__PURE__ */ React144.createElement(
12849
12858
  Text,
12850
12859
  {
12851
12860
  size: "sm" /* sm */,
@@ -12853,8 +12862,8 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12853
12862
  },
12854
12863
  apiError
12855
12864
  ),
12856
- entry && /* @__PURE__ */ React145.createElement("div", { className: "Layer__chart-of-accounts__form-edit-entry" }, /* @__PURE__ */ React145.createElement(Text, { weight: "bold" /* bold */ }, entry.name), /* @__PURE__ */ React145.createElement(Text, { weight: "bold" /* bold */ }, "$", centsToDollars(entry.balance || 0))),
12857
- /* @__PURE__ */ React145.createElement("div", { className: "Layer__chart-of-accounts__form" }, /* @__PURE__ */ React145.createElement(InputGroup, { name: "parent", label: stringOverrides?.parentLabel || "Parent", inline: true }, /* @__PURE__ */ React145.createElement(
12865
+ entry && /* @__PURE__ */ React144.createElement("div", { className: "Layer__chart-of-accounts__form-edit-entry" }, /* @__PURE__ */ React144.createElement(Text, { weight: "bold" /* bold */ }, entry.name), /* @__PURE__ */ React144.createElement(Text, { weight: "bold" /* bold */ }, "$", centsToDollars(entry.balance || 0))),
12866
+ /* @__PURE__ */ React144.createElement("div", { className: "Layer__chart-of-accounts__form" }, /* @__PURE__ */ React144.createElement(InputGroup, { name: "parent", label: stringOverrides?.parentLabel || "Parent", inline: true }, /* @__PURE__ */ React144.createElement(
12858
12867
  Select2,
12859
12868
  {
12860
12869
  options: parentOptions,
@@ -12862,7 +12871,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12862
12871
  onChange: (sel) => changeFormData("parent", sel),
12863
12872
  disabled: sendingForm
12864
12873
  }
12865
- )), /* @__PURE__ */ React145.createElement(InputGroup, { name: "name", label: stringOverrides?.nameLabel || "Name", inline: true }, /* @__PURE__ */ React145.createElement(
12874
+ )), /* @__PURE__ */ React144.createElement(InputGroup, { name: "name", label: stringOverrides?.nameLabel || "Name", inline: true }, /* @__PURE__ */ React144.createElement(
12866
12875
  Input,
12867
12876
  {
12868
12877
  name: "name",
@@ -12873,7 +12882,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12873
12882
  disabled: sendingForm,
12874
12883
  onChange: (e) => changeFormData("name", e.target.value)
12875
12884
  }
12876
- )), /* @__PURE__ */ React145.createElement(InputGroup, { name: "type", label: stringOverrides?.typeLabel || "Type", inline: true }, /* @__PURE__ */ React145.createElement(
12885
+ )), /* @__PURE__ */ React144.createElement(InputGroup, { name: "type", label: stringOverrides?.typeLabel || "Type", inline: true }, /* @__PURE__ */ React144.createElement(
12877
12886
  Select2,
12878
12887
  {
12879
12888
  options: LEDGER_ACCOUNT_TYPES,
@@ -12883,7 +12892,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12883
12892
  errorMessage: form?.errors?.find((x) => x.field === "type")?.message,
12884
12893
  disabled: sendingForm || form.action === "edit" || form.data.parent !== void 0
12885
12894
  }
12886
- )), /* @__PURE__ */ React145.createElement(InputGroup, { name: "subType", label: stringOverrides?.subTypeLabel || "Sub-Type", inline: true }, /* @__PURE__ */ React145.createElement(
12895
+ )), /* @__PURE__ */ React144.createElement(InputGroup, { name: "subType", label: stringOverrides?.subTypeLabel || "Sub-Type", inline: true }, /* @__PURE__ */ React144.createElement(
12887
12896
  Select2,
12888
12897
  {
12889
12898
  options: form?.data.type?.value !== void 0 ? LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE[form?.data.type?.value] : LEDGER_ACCOUNT_SUBTYPES,
@@ -12891,7 +12900,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12891
12900
  onChange: (sel) => changeFormData("subType", sel),
12892
12901
  disabled: sendingForm
12893
12902
  }
12894
- )), /* @__PURE__ */ React145.createElement(InputGroup, { name: "normality", label: stringOverrides?.normalityLabel || "Normality", inline: true }, /* @__PURE__ */ React145.createElement(
12903
+ )), /* @__PURE__ */ React144.createElement(InputGroup, { name: "normality", label: stringOverrides?.normalityLabel || "Normality", inline: true }, /* @__PURE__ */ React144.createElement(
12895
12904
  Select2,
12896
12905
  {
12897
12906
  options: NORMALITY_OPTIONS,
@@ -12903,7 +12912,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12903
12912
  onChange: (sel) => changeFormData("normality", sel),
12904
12913
  disabled: sendingForm
12905
12914
  }
12906
- )), /* @__PURE__ */ React145.createElement("div", { className: "actions" }, /* @__PURE__ */ React145.createElement(
12915
+ )), /* @__PURE__ */ React144.createElement("div", { className: "actions" }, /* @__PURE__ */ React144.createElement(
12907
12916
  Button,
12908
12917
  {
12909
12918
  type: "button",
@@ -12912,7 +12921,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12912
12921
  disabled: sendingForm
12913
12922
  },
12914
12923
  stringOverrides?.cancelButton || "Cancel"
12915
- ), apiError && /* @__PURE__ */ React145.createElement(
12924
+ ), apiError && /* @__PURE__ */ React144.createElement(
12916
12925
  RetryButton,
12917
12926
  {
12918
12927
  type: "submit",
@@ -12921,7 +12930,7 @@ var ChartOfAccountsForm = ({ stringOverrides }) => {
12921
12930
  disabled: sendingForm
12922
12931
  },
12923
12932
  stringOverrides?.retryButton || "Retry"
12924
- ), !apiError && /* @__PURE__ */ React145.createElement(
12933
+ ), !apiError && /* @__PURE__ */ React144.createElement(
12925
12934
  SubmitButton,
12926
12935
  {
12927
12936
  type: "submit",
@@ -12939,7 +12948,7 @@ var ChartOfAccountsSidebar = ({
12939
12948
  parentRef: _parentRef,
12940
12949
  stringOverrides
12941
12950
  }) => {
12942
- return /* @__PURE__ */ React146.createElement(ChartOfAccountsForm, { stringOverrides });
12951
+ return /* @__PURE__ */ React145.createElement(ChartOfAccountsForm, { stringOverrides });
12943
12952
  };
12944
12953
 
12945
12954
  // src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
@@ -12953,13 +12962,13 @@ var ChartOfAccountsTable = ({
12953
12962
  stringOverrides
12954
12963
  }) => {
12955
12964
  const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext21(ChartOfAccountsContext);
12956
- const [expandAll, setExpandAll] = useState40();
12965
+ const [expandAll, setExpandAll] = useState39();
12957
12966
  let cumulativeIndex = 0;
12958
12967
  const accountsLength = data?.accounts.length ?? 0;
12959
- return /* @__PURE__ */ React147.createElement(
12968
+ return /* @__PURE__ */ React146.createElement(
12960
12969
  Panel,
12961
12970
  {
12962
- sidebar: /* @__PURE__ */ React147.createElement(
12971
+ sidebar: /* @__PURE__ */ React146.createElement(
12963
12972
  ChartOfAccountsSidebar,
12964
12973
  {
12965
12974
  parentRef: containerRef,
@@ -12969,13 +12978,13 @@ var ChartOfAccountsTable = ({
12969
12978
  sidebarIsOpen: Boolean(form),
12970
12979
  parentRef: containerRef
12971
12980
  },
12972
- /* @__PURE__ */ React147.createElement(
12981
+ /* @__PURE__ */ React146.createElement(
12973
12982
  Header,
12974
12983
  {
12975
12984
  className: `Layer__${COMPONENT_NAME5}__header`,
12976
12985
  layout: withDateControl ? "next-line-actions" /* NEXT_LINE_ACTIONS */ : void 0
12977
12986
  },
12978
- /* @__PURE__ */ React147.createElement(
12987
+ /* @__PURE__ */ React146.createElement(
12979
12988
  Heading,
12980
12989
  {
12981
12990
  className: `Layer__${COMPONENT_NAME5}__title`,
@@ -12983,12 +12992,12 @@ var ChartOfAccountsTable = ({
12983
12992
  },
12984
12993
  stringOverrides?.headerText || "Chart of Accounts"
12985
12994
  ),
12986
- /* @__PURE__ */ React147.createElement(
12995
+ /* @__PURE__ */ React146.createElement(
12987
12996
  "div",
12988
12997
  {
12989
12998
  className: `Layer__${COMPONENT_NAME5}__actions Layer__header__actions`
12990
12999
  },
12991
- withDateControl || withExpandAllButton ? /* @__PURE__ */ React147.createElement("div", { className: "Layer__header__actions-col" }, withDateControl && /* @__PURE__ */ React147.createElement(ChartOfAccountsDatePicker, null), withExpandAllButton && /* @__PURE__ */ React147.createElement(
13000
+ withDateControl || withExpandAllButton ? /* @__PURE__ */ React146.createElement("div", { className: "Layer__header__actions-col" }, withDateControl && /* @__PURE__ */ React146.createElement(ChartOfAccountsDatePicker, null), withExpandAllButton && /* @__PURE__ */ React146.createElement(
12992
13001
  Button,
12993
13002
  {
12994
13003
  variant: "secondary" /* secondary */,
@@ -12998,13 +13007,13 @@ var ChartOfAccountsTable = ({
12998
13007
  },
12999
13008
  !expandAll || expandAll === "collapsed" ? "Expand all rows" : "Collapse all rows"
13000
13009
  )) : null,
13001
- /* @__PURE__ */ React147.createElement("div", { className: "Layer__header__actions-col" }, /* @__PURE__ */ React147.createElement(Button, { onClick: () => addAccount(), disabled: isLoading }, stringOverrides?.addAccountButtonText || "Add Account"))
13010
+ /* @__PURE__ */ React146.createElement("div", { className: "Layer__header__actions-col" }, /* @__PURE__ */ React146.createElement(Button, { onClick: () => addAccount(), disabled: isLoading }, stringOverrides?.addAccountButtonText || "Add Account"))
13002
13011
  )
13003
13012
  ),
13004
- /* @__PURE__ */ React147.createElement("table", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ React147.createElement("thead", null, /* @__PURE__ */ React147.createElement("tr", { className: "Layer__table-row--header" }, /* @__PURE__ */ React147.createElement("th", { className: "Layer__table-header Layer__coa__name" }, stringOverrides?.nameColumnHeader || "Name"), /* @__PURE__ */ React147.createElement("th", { className: "Layer__table-header Layer__coa__type" }, stringOverrides?.typeColumnHeader || "Type"), /* @__PURE__ */ React147.createElement("th", { className: "Layer__table-header Layer__coa__subtype Layer__mobile--hidden" }, stringOverrides?.subtypeColumnHeader || "Sub-Type"), /* @__PURE__ */ React147.createElement("th", { className: "Layer__table-header Layer__coa__balance" }, stringOverrides?.balanceColumnHeader || "Balance"), /* @__PURE__ */ React147.createElement("th", { className: "Layer__table-header Layer__coa__actions" }))), /* @__PURE__ */ React147.createElement("tbody", null, !error && data?.accounts.map((account, idx) => {
13013
+ /* @__PURE__ */ React146.createElement("table", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ React146.createElement("thead", null, /* @__PURE__ */ React146.createElement("tr", { className: "Layer__table-row--header" }, /* @__PURE__ */ React146.createElement("th", { className: "Layer__table-header Layer__coa__name" }, stringOverrides?.nameColumnHeader || "Name"), /* @__PURE__ */ React146.createElement("th", { className: "Layer__table-header Layer__coa__type" }, stringOverrides?.typeColumnHeader || "Type"), /* @__PURE__ */ React146.createElement("th", { className: "Layer__table-header Layer__coa__subtype Layer__mobile--hidden" }, stringOverrides?.subtypeColumnHeader || "Sub-Type"), /* @__PURE__ */ React146.createElement("th", { className: "Layer__table-header Layer__coa__balance" }, stringOverrides?.balanceColumnHeader || "Balance"), /* @__PURE__ */ React146.createElement("th", { className: "Layer__table-header Layer__coa__actions" }))), /* @__PURE__ */ React146.createElement("tbody", null, !error && data?.accounts.map((account, idx) => {
13005
13014
  const currentCumulativeIndex = cumulativeIndex;
13006
13015
  cumulativeIndex = (account.sub_accounts?.length || 0) + cumulativeIndex + 1;
13007
- return /* @__PURE__ */ React147.createElement(
13016
+ return /* @__PURE__ */ React146.createElement(
13008
13017
  ChartOfAccountsRow,
13009
13018
  {
13010
13019
  key: account.id,
@@ -13020,7 +13029,7 @@ var ChartOfAccountsTable = ({
13020
13029
  }
13021
13030
  );
13022
13031
  }))),
13023
- error ? /* @__PURE__ */ React147.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React147.createElement(
13032
+ error ? /* @__PURE__ */ React146.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React146.createElement(
13024
13033
  DataState,
13025
13034
  {
13026
13035
  status: "failed" /* failed */,
@@ -13030,8 +13039,8 @@ var ChartOfAccountsTable = ({
13030
13039
  isLoading: isValidating || isLoading
13031
13040
  }
13032
13041
  )) : null,
13033
- (!data || isLoading) && !error ? /* @__PURE__ */ React147.createElement("div", { className: `Layer__${COMPONENT_NAME5}__loader-container` }, /* @__PURE__ */ React147.createElement(Loader2, null)) : null,
13034
- !isLoading && !error && data?.accounts.length === 0 ? /* @__PURE__ */ React147.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React147.createElement(
13042
+ (!data || isLoading) && !error ? /* @__PURE__ */ React146.createElement("div", { className: `Layer__${COMPONENT_NAME5}__loader-container` }, /* @__PURE__ */ React146.createElement(Loader2, null)) : null,
13043
+ !isLoading && !error && data?.accounts.length === 0 ? /* @__PURE__ */ React146.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React146.createElement(
13035
13044
  DataState,
13036
13045
  {
13037
13046
  status: "info" /* info */,
@@ -13045,25 +13054,25 @@ var ChartOfAccountsTable = ({
13045
13054
  };
13046
13055
 
13047
13056
  // src/components/LedgerAccount/LedgerAccountIndex.tsx
13048
- import React154, {
13057
+ import React153, {
13049
13058
  useContext as useContext24,
13050
- useEffect as useEffect36,
13059
+ useEffect as useEffect37,
13051
13060
  useMemo as useMemo15,
13052
- useState as useState42
13061
+ useState as useState41
13053
13062
  } from "react";
13054
13063
 
13055
13064
  // src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
13056
- import React152, { useContext as useContext22, useMemo as useMemo14 } from "react";
13065
+ import React151, { useContext as useContext22, useMemo as useMemo14 } from "react";
13057
13066
 
13058
13067
  // src/components/Card/Card.tsx
13059
- import React148 from "react";
13060
- import classNames51 from "classnames";
13068
+ import React147 from "react";
13069
+ import classNames52 from "classnames";
13061
13070
  var Card = ({ children, className }) => {
13062
- return /* @__PURE__ */ React148.createElement("div", { className: classNames51("Layer__card", className) }, children);
13071
+ return /* @__PURE__ */ React147.createElement("div", { className: classNames52("Layer__card", className) }, children);
13063
13072
  };
13064
13073
 
13065
13074
  // src/components/DateTime/DateTime.tsx
13066
- import React149 from "react";
13075
+ import React148 from "react";
13067
13076
  import { parseISO as parseISO13, format as formatTime9 } from "date-fns";
13068
13077
  var DateTime = ({
13069
13078
  value,
@@ -13074,11 +13083,11 @@ var DateTime = ({
13074
13083
  onlyTime
13075
13084
  }) => {
13076
13085
  if (format7) {
13077
- return /* @__PURE__ */ React149.createElement(Text, { className: "Layer__datetime" }, formatTime9(parseISO13(value), format7));
13086
+ return /* @__PURE__ */ React148.createElement(Text, { className: "Layer__datetime" }, formatTime9(parseISO13(value), format7));
13078
13087
  }
13079
13088
  const date = formatTime9(parseISO13(value), dateFormat ?? DATE_FORMAT);
13080
13089
  const time = formatTime9(parseISO13(value), timeFormat ?? TIME_FORMAT);
13081
- return /* @__PURE__ */ React149.createElement(Text, { className: "Layer__datetime" }, !onlyTime && /* @__PURE__ */ React149.createElement(
13090
+ return /* @__PURE__ */ React148.createElement(Text, { className: "Layer__datetime" }, !onlyTime && /* @__PURE__ */ React148.createElement(
13082
13091
  Text,
13083
13092
  {
13084
13093
  as: "span",
@@ -13087,7 +13096,7 @@ var DateTime = ({
13087
13096
  className: "Layer__datetime__date"
13088
13097
  },
13089
13098
  date
13090
- ), !onlyDate && /* @__PURE__ */ React149.createElement(
13099
+ ), !onlyDate && /* @__PURE__ */ React148.createElement(
13091
13100
  Text,
13092
13101
  {
13093
13102
  as: "span",
@@ -13100,22 +13109,22 @@ var DateTime = ({
13100
13109
  };
13101
13110
 
13102
13111
  // src/components/DetailsList/DetailsList.tsx
13103
- import React150 from "react";
13104
- import classNames52 from "classnames";
13112
+ import React149 from "react";
13113
+ import classNames53 from "classnames";
13105
13114
  var DetailsList = ({
13106
13115
  title,
13107
13116
  children,
13108
13117
  className,
13109
13118
  actions
13110
13119
  }) => {
13111
- return /* @__PURE__ */ React150.createElement("div", { className: classNames52("Layer__details-list", className) }, title && /* @__PURE__ */ React150.createElement(Header, null, /* @__PURE__ */ React150.createElement(Heading, { size: "secondary" /* secondary */ }, title), actions && /* @__PURE__ */ React150.createElement("div", { className: "Layer__details-list__actions" }, actions)), /* @__PURE__ */ React150.createElement("ul", { className: "Layer__details-list__list" }, children));
13120
+ return /* @__PURE__ */ React149.createElement("div", { className: classNames53("Layer__details-list", className) }, title && /* @__PURE__ */ React149.createElement(Header, null, /* @__PURE__ */ React149.createElement(Heading, { size: "secondary" /* secondary */ }, title), actions && /* @__PURE__ */ React149.createElement("div", { className: "Layer__details-list__actions" }, actions)), /* @__PURE__ */ React149.createElement("ul", { className: "Layer__details-list__list" }, children));
13112
13121
  };
13113
13122
 
13114
13123
  // src/components/DetailsList/DetailsListItem.tsx
13115
- import React151 from "react";
13124
+ import React150 from "react";
13116
13125
  var renderValue = (value) => {
13117
13126
  if (typeof value === "string") {
13118
- return /* @__PURE__ */ React151.createElement(Text, { weight: "bold" /* bold */, size: "sm" /* sm */ }, value);
13127
+ return /* @__PURE__ */ React150.createElement(Text, { weight: "bold" /* bold */, size: "sm" /* sm */ }, value);
13119
13128
  }
13120
13129
  return value;
13121
13130
  };
@@ -13124,7 +13133,7 @@ var DetailsListItem = ({
13124
13133
  children,
13125
13134
  isLoading
13126
13135
  }) => {
13127
- return /* @__PURE__ */ React151.createElement("li", { className: "Layer__details-list-item" }, /* @__PURE__ */ React151.createElement("label", { className: "Layer__details-list-item__label" }, label), /* @__PURE__ */ React151.createElement("span", { className: "Layer__details-list-item__value" }, isLoading ? /* @__PURE__ */ React151.createElement(SkeletonLoader, null) : renderValue(children)));
13136
+ return /* @__PURE__ */ React150.createElement("li", { className: "Layer__details-list-item" }, /* @__PURE__ */ React150.createElement("label", { className: "Layer__details-list-item__label" }, label), /* @__PURE__ */ React150.createElement("span", { className: "Layer__details-list-item__value" }, isLoading ? /* @__PURE__ */ React150.createElement(SkeletonLoader, null) : renderValue(children)));
13128
13137
  };
13129
13138
 
13130
13139
  // src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
@@ -13132,31 +13141,31 @@ var SourceDetailView = ({ source, stringOverrides }) => {
13132
13141
  switch (source.type) {
13133
13142
  case "Transaction_Ledger_Entry_Source": {
13134
13143
  const transactionSource = source;
13135
- return /* @__PURE__ */ React152.createElement(React152.Fragment, null, /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.accountNameLabel || "Account name" }, transactionSource.account_name), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.dateLabel || "Date" }, /* @__PURE__ */ React152.createElement(DateTime, { value: transactionSource.date })), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.amountLabel || "Amount" }, `$${centsToDollars(transactionSource.amount)}`), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.directionLabel || "Direction" }, transactionSource.direction), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.counterpartyLabel || "Counterparty" }, transactionSource.counterparty));
13144
+ return /* @__PURE__ */ React151.createElement(React151.Fragment, null, /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.accountNameLabel || "Account name" }, transactionSource.account_name), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.dateLabel || "Date" }, /* @__PURE__ */ React151.createElement(DateTime, { value: transactionSource.date })), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.amountLabel || "Amount" }, `$${centsToDollars(transactionSource.amount)}`), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.directionLabel || "Direction" }, transactionSource.direction), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.counterpartyLabel || "Counterparty" }, transactionSource.counterparty));
13136
13145
  }
13137
13146
  case "Invoice_Ledger_Entry_Source": {
13138
13147
  const invoiceSource = source;
13139
- return /* @__PURE__ */ React152.createElement(React152.Fragment, null, /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.invoiceNumberLabel || "Invoice number" }, invoiceSource.invoice_number), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.recipientNameLabel || "Recipient name" }, invoiceSource.recipient_name), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.dateLabel || "Date" }, /* @__PURE__ */ React152.createElement(DateTime, { value: invoiceSource.date })), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.amountLabel || "Amount" }, `$${centsToDollars(invoiceSource.amount)}`));
13148
+ return /* @__PURE__ */ React151.createElement(React151.Fragment, null, /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.invoiceNumberLabel || "Invoice number" }, invoiceSource.invoice_number), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.recipientNameLabel || "Recipient name" }, invoiceSource.recipient_name), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.dateLabel || "Date" }, /* @__PURE__ */ React151.createElement(DateTime, { value: invoiceSource.date })), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.amountLabel || "Amount" }, `$${centsToDollars(invoiceSource.amount)}`));
13140
13149
  }
13141
13150
  case "Manual_Ledger_Entry_Source": {
13142
13151
  const manualSource = source;
13143
- return /* @__PURE__ */ React152.createElement(React152.Fragment, null, /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.memoLabel || "Memo" }, manualSource.memo), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.createdByLabel || "Created by" }, manualSource.created_by));
13152
+ return /* @__PURE__ */ React151.createElement(React151.Fragment, null, /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.memoLabel || "Memo" }, manualSource.memo), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.createdByLabel || "Created by" }, manualSource.created_by));
13144
13153
  }
13145
13154
  case "Invoice_Payment_Ledger_Entry_Source": {
13146
13155
  const invoicePaymentSource = source;
13147
- return /* @__PURE__ */ React152.createElement(React152.Fragment, null, /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.invoiceNumberLabel || "Invoice number" }, invoicePaymentSource.invoice_number), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.amountLabel || "Amount" }, `$${centsToDollars(invoicePaymentSource.amount)}`));
13156
+ return /* @__PURE__ */ React151.createElement(React151.Fragment, null, /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.invoiceNumberLabel || "Invoice number" }, invoicePaymentSource.invoice_number), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.amountLabel || "Amount" }, `$${centsToDollars(invoicePaymentSource.amount)}`));
13148
13157
  }
13149
13158
  case "Refund_Ledger_Entry_Source": {
13150
13159
  const refundSource = source;
13151
- return /* @__PURE__ */ React152.createElement(React152.Fragment, null, /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.amountLabel || "Amount" }, `$${centsToDollars(refundSource.refunded_to_customer_amount)}`), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.recipientNameLabel || "Recipient name" }, refundSource.recipient_name));
13160
+ return /* @__PURE__ */ React151.createElement(React151.Fragment, null, /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.amountLabel || "Amount" }, `$${centsToDollars(refundSource.refunded_to_customer_amount)}`), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.recipientNameLabel || "Recipient name" }, refundSource.recipient_name));
13152
13161
  }
13153
13162
  case "Opening_Balance_Ledger_Entry_Source": {
13154
13163
  const openingBalanceSource = source;
13155
- return /* @__PURE__ */ React152.createElement(React152.Fragment, null, /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.accountNameLabel || "Account name" }, openingBalanceSource.account_name));
13164
+ return /* @__PURE__ */ React151.createElement(React151.Fragment, null, /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.accountNameLabel || "Account name" }, openingBalanceSource.account_name));
13156
13165
  }
13157
13166
  case "Payout_Ledger_Entry_Source": {
13158
13167
  const payoutSource = source;
13159
- return /* @__PURE__ */ React152.createElement(React152.Fragment, null, /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.amountLabel || "Amount" }, `$${centsToDollars(payoutSource.paid_out_amount)}`), /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.processorLabel || "Processor" }, payoutSource.processor));
13168
+ return /* @__PURE__ */ React151.createElement(React151.Fragment, null, /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.amountLabel || "Amount" }, `$${centsToDollars(payoutSource.paid_out_amount)}`), /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.processorLabel || "Processor" }, payoutSource.processor));
13160
13169
  }
13161
13170
  default:
13162
13171
  return null;
@@ -13176,14 +13185,14 @@ var LedgerAccountEntryDetails = ({ stringOverrides }) => {
13176
13185
  });
13177
13186
  return { totalDebit: totalDebit2, totalCredit: totalCredit2 };
13178
13187
  }, [entryData]);
13179
- return /* @__PURE__ */ React152.createElement("div", { className: "Layer__ledger-account__entry-details" }, /* @__PURE__ */ React152.createElement("div", { className: "Layer__ledger-account__entry-details__back-btn" }, /* @__PURE__ */ React152.createElement(BackButton, { onClick: () => closeSelectedEntry() }), /* @__PURE__ */ React152.createElement("div", { className: "Layer__ledger-account__entry-details__title-container" }, /* @__PURE__ */ React152.createElement(Text, { weight: "bold" /* bold */ }, stringOverrides?.title || "Transaction details"))), /* @__PURE__ */ React152.createElement(
13188
+ return /* @__PURE__ */ React151.createElement("div", { className: "Layer__ledger-account__entry-details" }, /* @__PURE__ */ React151.createElement("div", { className: "Layer__ledger-account__entry-details__back-btn" }, /* @__PURE__ */ React151.createElement(BackButton, { onClick: () => closeSelectedEntry() }), /* @__PURE__ */ React151.createElement("div", { className: "Layer__ledger-account__entry-details__title-container" }, /* @__PURE__ */ React151.createElement(Text, { weight: "bold" /* bold */ }, stringOverrides?.title || "Transaction details"))), /* @__PURE__ */ React151.createElement(
13180
13189
  DetailsList,
13181
13190
  {
13182
13191
  title: stringOverrides?.transactionSource?.header || "Transaction source",
13183
- actions: /* @__PURE__ */ React152.createElement(
13192
+ actions: /* @__PURE__ */ React151.createElement(
13184
13193
  Button,
13185
13194
  {
13186
- rightIcon: /* @__PURE__ */ React152.createElement(X_default, null),
13195
+ rightIcon: /* @__PURE__ */ React151.createElement(X_default, null),
13187
13196
  iconOnly: true,
13188
13197
  onClick: closeSelectedEntry,
13189
13198
  variant: "secondary" /* secondary */,
@@ -13191,57 +13200,57 @@ var LedgerAccountEntryDetails = ({ stringOverrides }) => {
13191
13200
  }
13192
13201
  )
13193
13202
  },
13194
- /* @__PURE__ */ React152.createElement(
13203
+ /* @__PURE__ */ React151.createElement(
13195
13204
  DetailsListItem,
13196
13205
  {
13197
13206
  label: stringOverrides?.transactionSource?.details?.sourceLabel || "Source",
13198
13207
  isLoading: isLoadingEntry
13199
13208
  },
13200
- /* @__PURE__ */ React152.createElement(Badge, null, entryData?.source?.entity_name)
13209
+ /* @__PURE__ */ React151.createElement(Badge, null, entryData?.source?.entity_name)
13201
13210
  ),
13202
- entryData?.source?.display_description && /* @__PURE__ */ React152.createElement(SourceDetailView, { source: entryData?.source })
13203
- ), /* @__PURE__ */ React152.createElement(
13211
+ entryData?.source?.display_description && /* @__PURE__ */ React151.createElement(SourceDetailView, { source: entryData?.source })
13212
+ ), /* @__PURE__ */ React151.createElement(
13204
13213
  DetailsList,
13205
13214
  {
13206
13215
  title: stringOverrides?.journalEntry?.header ? stringOverrides?.journalEntry?.header(entryData?.id.substring(0, 5)) : `Journal Entry ${entryData?.id.substring(0, 5)}`,
13207
13216
  className: "Layer__border-top"
13208
13217
  },
13209
- /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.journalEntry?.details?.entryTypeLabel || "Entry type", isLoading: isLoadingEntry }, humanizeEnum(entryData?.entry_type ?? "")),
13210
- /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.journalEntry?.details?.dateLabel || "Date", isLoading: isLoadingEntry }, entryData?.entry_at && /* @__PURE__ */ React152.createElement(DateTime, { value: entryData?.entry_at })),
13211
- /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.journalEntry?.details?.creationDateLabel || "Creation date", isLoading: isLoadingEntry }, entryData?.date && /* @__PURE__ */ React152.createElement(DateTime, { value: entryData?.date })),
13212
- entryData?.reversal_id && /* @__PURE__ */ React152.createElement(DetailsListItem, { label: stringOverrides?.journalEntry?.details?.reversalLabel || "Reversal", isLoading: isLoadingEntry }, entryData?.reversal_id.substring(0, 5))
13213
- ), !isLoadingEntry && !errorEntry ? /* @__PURE__ */ React152.createElement("div", { className: "Layer__ledger-account__entry-details__line-items" }, /* @__PURE__ */ React152.createElement(Card, null, /* @__PURE__ */ React152.createElement(
13218
+ /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.journalEntry?.details?.entryTypeLabel || "Entry type", isLoading: isLoadingEntry }, humanizeEnum(entryData?.entry_type ?? "")),
13219
+ /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.journalEntry?.details?.dateLabel || "Date", isLoading: isLoadingEntry }, entryData?.entry_at && /* @__PURE__ */ React151.createElement(DateTime, { value: entryData?.entry_at })),
13220
+ /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.journalEntry?.details?.creationDateLabel || "Creation date", isLoading: isLoadingEntry }, entryData?.date && /* @__PURE__ */ React151.createElement(DateTime, { value: entryData?.date })),
13221
+ entryData?.reversal_id && /* @__PURE__ */ React151.createElement(DetailsListItem, { label: stringOverrides?.journalEntry?.details?.reversalLabel || "Reversal", isLoading: isLoadingEntry }, entryData?.reversal_id.substring(0, 5))
13222
+ ), !isLoadingEntry && !errorEntry ? /* @__PURE__ */ React151.createElement("div", { className: "Layer__ledger-account__entry-details__line-items" }, /* @__PURE__ */ React151.createElement(Card, null, /* @__PURE__ */ React151.createElement(
13214
13223
  Table,
13215
13224
  {
13216
13225
  componentName: "ledger-account__entry-details",
13217
13226
  borderCollapse: "collapse"
13218
13227
  },
13219
- /* @__PURE__ */ React152.createElement(TableHead, null, /* @__PURE__ */ React152.createElement(TableRow, { rowKey: "soc-flow-head-row", isHeadRow: true }, /* @__PURE__ */ React152.createElement(TableCell, null, stringOverrides?.lineItemsTable?.lineItemsColumnHeader || "Line items"), /* @__PURE__ */ React152.createElement(TableCell, null, stringOverrides?.lineItemsTable?.debitColumnHeader || "Debit"), /* @__PURE__ */ React152.createElement(TableCell, null, stringOverrides?.lineItemsTable?.creditColumnHeader || "Credit"))),
13220
- /* @__PURE__ */ React152.createElement(TableBody, null, entryData?.line_items?.map((item, index) => /* @__PURE__ */ React152.createElement(
13228
+ /* @__PURE__ */ React151.createElement(TableHead, null, /* @__PURE__ */ React151.createElement(TableRow, { rowKey: "soc-flow-head-row", isHeadRow: true }, /* @__PURE__ */ React151.createElement(TableCell, null, stringOverrides?.lineItemsTable?.lineItemsColumnHeader || "Line items"), /* @__PURE__ */ React151.createElement(TableCell, null, stringOverrides?.lineItemsTable?.debitColumnHeader || "Debit"), /* @__PURE__ */ React151.createElement(TableCell, null, stringOverrides?.lineItemsTable?.creditColumnHeader || "Credit"))),
13229
+ /* @__PURE__ */ React151.createElement(TableBody, null, entryData?.line_items?.map((item, index) => /* @__PURE__ */ React151.createElement(
13221
13230
  TableRow,
13222
13231
  {
13223
13232
  key: `ledger-line-item-${index}`,
13224
13233
  rowKey: `ledger-line-item-${index}`
13225
13234
  },
13226
- /* @__PURE__ */ React152.createElement(TableCell, null, item.account?.name || ""),
13227
- /* @__PURE__ */ React152.createElement(TableCell, null, item.direction === "DEBIT" /* DEBIT */ && /* @__PURE__ */ React152.createElement(Badge, { variant: "warning" /* WARNING */ }, "$", centsToDollars(item.amount || 0))),
13228
- /* @__PURE__ */ React152.createElement(TableCell, null, item.direction === "CREDIT" /* CREDIT */ && /* @__PURE__ */ React152.createElement(Badge, { variant: "success" /* SUCCESS */ }, "$", centsToDollars(item.amount || 0)))
13229
- )), /* @__PURE__ */ React152.createElement(
13235
+ /* @__PURE__ */ React151.createElement(TableCell, null, item.account?.name || ""),
13236
+ /* @__PURE__ */ React151.createElement(TableCell, null, item.direction === "DEBIT" /* DEBIT */ && /* @__PURE__ */ React151.createElement(Badge, { variant: "warning" /* WARNING */ }, "$", centsToDollars(item.amount || 0))),
13237
+ /* @__PURE__ */ React151.createElement(TableCell, null, item.direction === "CREDIT" /* CREDIT */ && /* @__PURE__ */ React151.createElement(Badge, { variant: "success" /* SUCCESS */ }, "$", centsToDollars(item.amount || 0)))
13238
+ )), /* @__PURE__ */ React151.createElement(
13230
13239
  TableRow,
13231
13240
  {
13232
13241
  rowKey: "ledger-line-item-summation",
13233
13242
  variant: "summation"
13234
13243
  },
13235
- /* @__PURE__ */ React152.createElement(TableCell, { primary: true }, stringOverrides?.lineItemsTable?.totalRowHeader || "Total"),
13236
- /* @__PURE__ */ React152.createElement(TableCell, { isCurrency: true, primary: true }, totalDebit || 0),
13237
- /* @__PURE__ */ React152.createElement(TableCell, { isCurrency: true, primary: true }, totalCredit || 0)
13244
+ /* @__PURE__ */ React151.createElement(TableCell, { primary: true }, stringOverrides?.lineItemsTable?.totalRowHeader || "Total"),
13245
+ /* @__PURE__ */ React151.createElement(TableCell, { isCurrency: true, primary: true }, totalDebit || 0),
13246
+ /* @__PURE__ */ React151.createElement(TableCell, { isCurrency: true, primary: true }, totalCredit || 0)
13238
13247
  ))
13239
13248
  ))) : null);
13240
13249
  };
13241
13250
 
13242
13251
  // src/components/LedgerAccount/LedgerAccountRow.tsx
13243
- import React153, { useContext as useContext23, useEffect as useEffect35, useState as useState41 } from "react";
13244
- import classNames53 from "classnames";
13252
+ import React152, { useContext as useContext23, useEffect as useEffect36, useState as useState40 } from "react";
13253
+ import classNames54 from "classnames";
13245
13254
  import { parseISO as parseISO14, format as formatTime10 } from "date-fns";
13246
13255
  var LedgerAccountRow = ({
13247
13256
  row,
@@ -13250,8 +13259,8 @@ var LedgerAccountRow = ({
13250
13259
  view
13251
13260
  }) => {
13252
13261
  const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext23(LedgerAccountsContext);
13253
- const [showComponent, setShowComponent] = useState41(false);
13254
- useEffect35(() => {
13262
+ const [showComponent, setShowComponent] = useState40(false);
13263
+ useEffect36(() => {
13255
13264
  if (initialLoad) {
13256
13265
  const timeoutId = setTimeout(() => {
13257
13266
  setShowComponent(true);
@@ -13262,10 +13271,10 @@ var LedgerAccountRow = ({
13262
13271
  }
13263
13272
  }, []);
13264
13273
  if (view === "tablet") {
13265
- return /* @__PURE__ */ React153.createElement(
13274
+ return /* @__PURE__ */ React152.createElement(
13266
13275
  "tr",
13267
13276
  {
13268
- className: classNames53(
13277
+ className: classNames54(
13269
13278
  "Layer__table-row",
13270
13279
  row.entry_id === selectedEntryId && "Layer__table-row--active",
13271
13280
  initialLoad && "initial-load",
@@ -13281,24 +13290,24 @@ var LedgerAccountRow = ({
13281
13290
  }
13282
13291
  }
13283
13292
  },
13284
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React153.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ React153.createElement(Text, null, row.date && formatTime10(parseISO14(row.date), DATE_FORMAT)), /* @__PURE__ */ React153.createElement(
13293
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React152.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ React152.createElement(Text, null, row.date && formatTime10(parseISO14(row.date), DATE_FORMAT)), /* @__PURE__ */ React152.createElement(
13285
13294
  Text,
13286
13295
  {
13287
13296
  weight: "normal" /* normal */,
13288
13297
  className: "Layer__ledger_account-table__journal-id"
13289
13298
  },
13290
13299
  row.entry_id.substring(0, 5)
13291
- )), /* @__PURE__ */ React153.createElement(Text, null, row.source?.display_description ?? ""))),
13292
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)),
13293
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)),
13294
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, `$${centsToDollars(row.running_balance)}`))
13300
+ )), /* @__PURE__ */ React152.createElement(Text, null, row.source?.display_description ?? ""))),
13301
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)),
13302
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)),
13303
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, `$${centsToDollars(row.running_balance)}`))
13295
13304
  );
13296
13305
  }
13297
13306
  if (view === "mobile") {
13298
- return /* @__PURE__ */ React153.createElement(
13307
+ return /* @__PURE__ */ React152.createElement(
13299
13308
  "tr",
13300
13309
  {
13301
- className: classNames53(
13310
+ className: classNames54(
13302
13311
  "Layer__table-row",
13303
13312
  row.entry_id === selectedEntryId && "Layer__table-row--active",
13304
13313
  initialLoad && "initial-load",
@@ -13314,20 +13323,20 @@ var LedgerAccountRow = ({
13314
13323
  }
13315
13324
  }
13316
13325
  },
13317
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React153.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ React153.createElement(Text, null, row.date && formatTime10(parseISO14(row.date), DATE_FORMAT)), /* @__PURE__ */ React153.createElement(
13326
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React152.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ React152.createElement(Text, null, row.date && formatTime10(parseISO14(row.date), DATE_FORMAT)), /* @__PURE__ */ React152.createElement(
13318
13327
  Text,
13319
13328
  {
13320
13329
  weight: "normal" /* normal */,
13321
13330
  className: "Layer__ledger_account-table__journal-id"
13322
13331
  },
13323
13332
  row.entry_id.substring(0, 5)
13324
- )), /* @__PURE__ */ React153.createElement(Text, null, row.source?.display_description ?? ""), /* @__PURE__ */ React153.createElement("div", { className: "Layer__ledger_account-table__balances-mobile" }, /* @__PURE__ */ React153.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Debit"), /* @__PURE__ */ React153.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, " ", row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)), /* @__PURE__ */ React153.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Credit"), /* @__PURE__ */ React153.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)), /* @__PURE__ */ React153.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Running balance"), /* @__PURE__ */ React153.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, `$${centsToDollars(row.running_balance)}`)))))
13333
+ )), /* @__PURE__ */ React152.createElement(Text, null, row.source?.display_description ?? ""), /* @__PURE__ */ React152.createElement("div", { className: "Layer__ledger_account-table__balances-mobile" }, /* @__PURE__ */ React152.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Debit"), /* @__PURE__ */ React152.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, " ", row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)), /* @__PURE__ */ React152.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Credit"), /* @__PURE__ */ React152.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)), /* @__PURE__ */ React152.createElement("div", { className: "Layer__ledger_account-table__balance-item" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__label" }, "Running balance"), /* @__PURE__ */ React152.createElement("span", { className: "Layer__ledger_account-table__balances-mobile__value" }, `$${centsToDollars(row.running_balance)}`)))))
13325
13334
  );
13326
13335
  }
13327
- return /* @__PURE__ */ React153.createElement(
13336
+ return /* @__PURE__ */ React152.createElement(
13328
13337
  "tr",
13329
13338
  {
13330
- className: classNames53(
13339
+ className: classNames54(
13331
13340
  "Layer__table-row",
13332
13341
  row.entry_id === selectedEntryId && "Layer__table-row--active",
13333
13342
  initialLoad && "initial-load",
@@ -13343,25 +13352,25 @@ var LedgerAccountRow = ({
13343
13352
  }
13344
13353
  }
13345
13354
  },
13346
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content" }, row.date && formatTime10(parseISO14(row.date), DATE_FORMAT))),
13347
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content" }, row.entry_id.substring(0, 5))),
13348
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content" }, row.source?.display_description ?? "")),
13349
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)),
13350
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)),
13351
- /* @__PURE__ */ React153.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React153.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, `$${centsToDollars(row.running_balance)}`))
13355
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content" }, row.date && formatTime10(parseISO14(row.date), DATE_FORMAT))),
13356
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content" }, row.entry_id.substring(0, 5))),
13357
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content" }, row.source?.display_description ?? "")),
13358
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars(row?.amount || 0)}`)),
13359
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "CREDIT" /* CREDIT */ && `$${centsToDollars(row?.amount || 0)}`)),
13360
+ /* @__PURE__ */ React152.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React152.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, `$${centsToDollars(row.running_balance)}`))
13352
13361
  );
13353
13362
  };
13354
13363
 
13355
13364
  // src/components/LedgerAccount/LedgerAccountIndex.tsx
13356
- import classNames54 from "classnames";
13365
+ import classNames55 from "classnames";
13357
13366
  var LedgerAccount = ({
13358
13367
  containerRef,
13359
13368
  pageSize = 15,
13360
13369
  view,
13361
13370
  stringOverrides
13362
13371
  }) => {
13363
- const [currentPage, setCurrentPage] = useState42(1);
13364
- const [initialLoad, setInitialLoad] = useState42(true);
13372
+ const [currentPage, setCurrentPage] = useState41(1);
13373
+ const [initialLoad, setInitialLoad] = useState41(true);
13365
13374
  const { data: accountData } = useContext24(ChartOfAccountsContext);
13366
13375
  const {
13367
13376
  data: rawData,
@@ -13374,7 +13383,7 @@ var LedgerAccount = ({
13374
13383
  closeSelectedEntry,
13375
13384
  refetch
13376
13385
  } = useContext24(LedgerAccountsContext);
13377
- useEffect36(() => {
13386
+ useEffect37(() => {
13378
13387
  if (!isLoading) {
13379
13388
  const timeoutLoad = setTimeout(() => {
13380
13389
  setInitialLoad(false);
@@ -13382,7 +13391,7 @@ var LedgerAccount = ({
13382
13391
  return () => clearTimeout(timeoutLoad);
13383
13392
  }
13384
13393
  }, [isLoading]);
13385
- const baseClassName = classNames54(
13394
+ const baseClassName = classNames55(
13386
13395
  "Layer__ledger-account__index",
13387
13396
  accountId && "open"
13388
13397
  );
@@ -13400,10 +13409,10 @@ var LedgerAccount = ({
13400
13409
  setAccountId(void 0);
13401
13410
  closeSelectedEntry();
13402
13411
  };
13403
- return /* @__PURE__ */ React154.createElement(
13412
+ return /* @__PURE__ */ React153.createElement(
13404
13413
  Panel,
13405
13414
  {
13406
- sidebar: /* @__PURE__ */ React154.createElement(
13415
+ sidebar: /* @__PURE__ */ React153.createElement(
13407
13416
  LedgerAccountEntryDetails,
13408
13417
  {
13409
13418
  stringOverrides: stringOverrides?.ledgerEntryDetail
@@ -13413,21 +13422,21 @@ var LedgerAccount = ({
13413
13422
  parentRef: containerRef,
13414
13423
  className: "Layer__ledger-account__panel"
13415
13424
  },
13416
- /* @__PURE__ */ React154.createElement("div", { className: baseClassName }, /* @__PURE__ */ React154.createElement("div", { className: "Layer__ledger-account__header" }, /* @__PURE__ */ React154.createElement(BackButton, { onClick: close }), /* @__PURE__ */ React154.createElement("div", { className: "Layer__ledger-account__title-container" }, /* @__PURE__ */ React154.createElement(
13425
+ /* @__PURE__ */ React153.createElement("div", { className: baseClassName }, /* @__PURE__ */ React153.createElement("div", { className: "Layer__ledger-account__header" }, /* @__PURE__ */ React153.createElement(BackButton, { onClick: close }), /* @__PURE__ */ React153.createElement("div", { className: "Layer__ledger-account__title-container" }, /* @__PURE__ */ React153.createElement(
13417
13426
  Text,
13418
13427
  {
13419
13428
  weight: "bold" /* bold */,
13420
13429
  className: "Layer__ledger-account__title"
13421
13430
  },
13422
13431
  entry?.name ?? ""
13423
- ), /* @__PURE__ */ React154.createElement("div", { className: "Layer__ledger-account__balance-container" }, /* @__PURE__ */ React154.createElement(
13432
+ ), /* @__PURE__ */ React153.createElement("div", { className: "Layer__ledger-account__balance-container" }, /* @__PURE__ */ React153.createElement(
13424
13433
  Text,
13425
13434
  {
13426
13435
  className: "Layer__ledger-account__balance-label",
13427
13436
  size: "sm" /* sm */
13428
13437
  },
13429
13438
  "Current balance"
13430
- ), /* @__PURE__ */ React154.createElement(
13439
+ ), /* @__PURE__ */ React153.createElement(
13431
13440
  Text,
13432
13441
  {
13433
13442
  className: "Layer__ledger-account__balance-value",
@@ -13435,7 +13444,7 @@ var LedgerAccount = ({
13435
13444
  },
13436
13445
  "$",
13437
13446
  centsToDollars(entry?.balance || 0)
13438
- )))), /* @__PURE__ */ React154.createElement("table", { className: "Layer__table Layer__table--hover-effect Layer__ledger-account-table" }, /* @__PURE__ */ React154.createElement("thead", null, /* @__PURE__ */ React154.createElement("tr", null, view !== "desktop" && /* @__PURE__ */ React154.createElement("th", null), view === "desktop" && /* @__PURE__ */ React154.createElement(React154.Fragment, null, /* @__PURE__ */ React154.createElement("th", { className: "Layer__table-header" }, stringOverrides?.ledgerEntriesTable?.dateColumnHeader || "Date"), /* @__PURE__ */ React154.createElement("th", { className: "Layer__table-header" }, stringOverrides?.ledgerEntriesTable?.journalIdColumnHeader || "Journal id #"), /* @__PURE__ */ React154.createElement("th", { className: "Layer__table-header" }, stringOverrides?.ledgerEntriesTable?.sourceColumnHeader || "Source")), view !== "mobile" && /* @__PURE__ */ React154.createElement(React154.Fragment, null, /* @__PURE__ */ React154.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, stringOverrides?.ledgerEntriesTable?.debitColumnHeader || "Debit"), /* @__PURE__ */ React154.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, stringOverrides?.ledgerEntriesTable?.creditColumnHeader || "Credit"), /* @__PURE__ */ React154.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, stringOverrides?.ledgerEntriesTable?.runningBalanceColumnHeader || "Running balance")))), /* @__PURE__ */ React154.createElement("tbody", null, data?.map((x, index) => /* @__PURE__ */ React154.createElement(
13447
+ )))), /* @__PURE__ */ React153.createElement("table", { className: "Layer__table Layer__table--hover-effect Layer__ledger-account-table" }, /* @__PURE__ */ React153.createElement("thead", null, /* @__PURE__ */ React153.createElement("tr", null, view !== "desktop" && /* @__PURE__ */ React153.createElement("th", null), view === "desktop" && /* @__PURE__ */ React153.createElement(React153.Fragment, null, /* @__PURE__ */ React153.createElement("th", { className: "Layer__table-header" }, stringOverrides?.ledgerEntriesTable?.dateColumnHeader || "Date"), /* @__PURE__ */ React153.createElement("th", { className: "Layer__table-header" }, stringOverrides?.ledgerEntriesTable?.journalIdColumnHeader || "Journal id #"), /* @__PURE__ */ React153.createElement("th", { className: "Layer__table-header" }, stringOverrides?.ledgerEntriesTable?.sourceColumnHeader || "Source")), view !== "mobile" && /* @__PURE__ */ React153.createElement(React153.Fragment, null, /* @__PURE__ */ React153.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, stringOverrides?.ledgerEntriesTable?.debitColumnHeader || "Debit"), /* @__PURE__ */ React153.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, stringOverrides?.ledgerEntriesTable?.creditColumnHeader || "Credit"), /* @__PURE__ */ React153.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, stringOverrides?.ledgerEntriesTable?.runningBalanceColumnHeader || "Running balance")))), /* @__PURE__ */ React153.createElement("tbody", null, data?.map((x, index) => /* @__PURE__ */ React153.createElement(
13439
13448
  LedgerAccountRow,
13440
13449
  {
13441
13450
  key: x.id,
@@ -13444,7 +13453,7 @@ var LedgerAccount = ({
13444
13453
  initialLoad,
13445
13454
  view
13446
13455
  }
13447
- )))), data && /* @__PURE__ */ React154.createElement("div", { className: "Layer__ledger-account__pagination" }, /* @__PURE__ */ React154.createElement(
13456
+ )))), data && /* @__PURE__ */ React153.createElement("div", { className: "Layer__ledger-account__pagination" }, /* @__PURE__ */ React153.createElement(
13448
13457
  Pagination,
13449
13458
  {
13450
13459
  currentPage,
@@ -13452,7 +13461,7 @@ var LedgerAccount = ({
13452
13461
  pageSize,
13453
13462
  onPageChange: (page) => setCurrentPage(page)
13454
13463
  }
13455
- )), error ? /* @__PURE__ */ React154.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React154.createElement(
13464
+ )), error ? /* @__PURE__ */ React153.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React153.createElement(
13456
13465
  DataState,
13457
13466
  {
13458
13467
  status: "failed" /* failed */,
@@ -13461,7 +13470,7 @@ var LedgerAccount = ({
13461
13470
  onRefresh: () => refetch(),
13462
13471
  isLoading: isValidating || isLoading
13463
13472
  }
13464
- )) : null, (!data || isLoading) && !error ? /* @__PURE__ */ React154.createElement("div", { className: `Layer__ledger-account__loader-container` }, /* @__PURE__ */ React154.createElement(Loader2, null)) : null, !isLoading && !error && data?.length === 0 ? /* @__PURE__ */ React154.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React154.createElement(
13473
+ )) : null, (!data || isLoading) && !error ? /* @__PURE__ */ React153.createElement("div", { className: `Layer__ledger-account__loader-container` }, /* @__PURE__ */ React153.createElement(Loader2, null)) : null, !isLoading && !error && data?.length === 0 ? /* @__PURE__ */ React153.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React153.createElement(
13465
13474
  DataState,
13466
13475
  {
13467
13476
  status: "info" /* info */,
@@ -13479,7 +13488,7 @@ var ChartOfAccounts = (props) => {
13479
13488
  withDates: props.withDateControl
13480
13489
  });
13481
13490
  const ledgerAccountsContextData = useLedgerAccounts();
13482
- return /* @__PURE__ */ React155.createElement(ChartOfAccountsContext.Provider, { value: chartOfAccountsContextData }, /* @__PURE__ */ React155.createElement(LedgerAccountsContext.Provider, { value: ledgerAccountsContextData }, /* @__PURE__ */ React155.createElement(ChartOfAccountsContent, { ...props })));
13491
+ return /* @__PURE__ */ React154.createElement(ChartOfAccountsContext.Provider, { value: chartOfAccountsContextData }, /* @__PURE__ */ React154.createElement(LedgerAccountsContext.Provider, { value: ledgerAccountsContextData }, /* @__PURE__ */ React154.createElement(ChartOfAccountsContent, { ...props })));
13483
13492
  };
13484
13493
  var ChartOfAccountsContent = ({
13485
13494
  asWidget,
@@ -13488,7 +13497,7 @@ var ChartOfAccountsContent = ({
13488
13497
  stringOverrides
13489
13498
  }) => {
13490
13499
  const { accountId } = useContext25(LedgerAccountsContext);
13491
- const [view, setView] = useState43("desktop");
13500
+ const [view, setView] = useState42("desktop");
13492
13501
  const containerRef = useElementSize((_a, _b, { width }) => {
13493
13502
  if (width) {
13494
13503
  if (width >= BREAKPOINTS.TABLET && view !== "desktop") {
@@ -13500,7 +13509,7 @@ var ChartOfAccountsContent = ({
13500
13509
  }
13501
13510
  }
13502
13511
  });
13503
- return /* @__PURE__ */ React155.createElement(Container, { name: "chart-of-accounts", ref: containerRef, asWidget }, accountId ? /* @__PURE__ */ React155.createElement(LedgerAccount, { view, containerRef, stringOverrides: stringOverrides?.ledgerAccount }) : /* @__PURE__ */ React155.createElement(
13512
+ return /* @__PURE__ */ React154.createElement(Container, { name: "chart-of-accounts", ref: containerRef, asWidget }, accountId ? /* @__PURE__ */ React154.createElement(LedgerAccount, { view, containerRef, stringOverrides: stringOverrides?.ledgerAccount }) : /* @__PURE__ */ React154.createElement(
13504
13513
  ChartOfAccountsTable,
13505
13514
  {
13506
13515
  asWidget,
@@ -13514,7 +13523,7 @@ var ChartOfAccountsContent = ({
13514
13523
  };
13515
13524
 
13516
13525
  // src/components/Journal/Journal.tsx
13517
- import React162, { useState as useState47 } from "react";
13526
+ import React161, { useState as useState46 } from "react";
13518
13527
 
13519
13528
  // src/contexts/JournalContext/JournalContext.tsx
13520
13529
  import { createContext as createContext12 } from "react";
@@ -13551,7 +13560,7 @@ var JournalContext = createContext12({
13551
13560
  });
13552
13561
 
13553
13562
  // src/hooks/useJournal/useJournal.tsx
13554
- import { useEffect as useEffect37, useState as useState44 } from "react";
13563
+ import { useEffect as useEffect38, useState as useState43 } from "react";
13555
13564
 
13556
13565
  // src/utils/journal.ts
13557
13566
  var getAccountIdentifierPayload = (journalLineItem) => {
@@ -13582,11 +13591,11 @@ var useJournal = () => {
13582
13591
  syncTimestamps,
13583
13592
  hasBeenTouched
13584
13593
  } = useLayerContext();
13585
- const [selectedEntryId, setSelectedEntryId] = useState44();
13586
- const [form, setForm] = useState44();
13587
- const [addingEntry, setAddingEntry] = useState44(false);
13588
- const [sendingForm, setSendingForm] = useState44(false);
13589
- const [apiError, setApiError] = useState44(void 0);
13594
+ const [selectedEntryId, setSelectedEntryId] = useState43();
13595
+ const [form, setForm] = useState43();
13596
+ const [addingEntry, setAddingEntry] = useState43(false);
13597
+ const [sendingForm, setSendingForm] = useState43(false);
13598
+ const [apiError, setApiError] = useState43(void 0);
13590
13599
  const queryKey = businessId && auth?.access_token && `journal-lines-${businessId}`;
13591
13600
  const { data, isLoading, isValidating, error, mutate } = useSWR9(
13592
13601
  queryKey,
@@ -13812,12 +13821,12 @@ var useJournal = () => {
13812
13821
  }
13813
13822
  });
13814
13823
  };
13815
- useEffect37(() => {
13824
+ useEffect38(() => {
13816
13825
  if (queryKey && (isLoading || isValidating)) {
13817
13826
  read("JOURNAL" /* JOURNAL */, queryKey);
13818
13827
  }
13819
13828
  }, [isLoading, isValidating]);
13820
- useEffect37(() => {
13829
+ useEffect38(() => {
13821
13830
  if (queryKey && hasBeenTouched(queryKey)) {
13822
13831
  refetch();
13823
13832
  }
@@ -13848,11 +13857,11 @@ var useJournal = () => {
13848
13857
  };
13849
13858
 
13850
13859
  // src/components/JournalTable/JournalTable.tsx
13851
- import React161, { useContext as useContext31, useMemo as useMemo17, useState as useState46 } from "react";
13860
+ import React160, { useContext as useContext31, useMemo as useMemo17, useState as useState45 } from "react";
13852
13861
 
13853
13862
  // src/components/JournalRow/JournalRow.tsx
13854
- import React156, { useContext as useContext26, useEffect as useEffect38, useState as useState45 } from "react";
13855
- import classNames55 from "classnames";
13863
+ import React155, { useContext as useContext26, useEffect as useEffect39, useState as useState44 } from "react";
13864
+ import classNames56 from "classnames";
13856
13865
  import { parseISO as parseISO15, format as formatTime11 } from "date-fns";
13857
13866
  var INDENTATION2 = 24;
13858
13867
  var EXPANDED_STYLE3 = {
@@ -13890,7 +13899,7 @@ var JournalRow = ({
13890
13899
  selectedEntries = false
13891
13900
  }) => {
13892
13901
  const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext26(JournalContext);
13893
- const [isOpen, setIsOpen] = useState45(index === 0 ? true : defaultOpen);
13902
+ const [isOpen, setIsOpen] = useState44(index === 0 ? true : defaultOpen);
13894
13903
  const style = expanded ? {
13895
13904
  ...EXPANDED_STYLE3,
13896
13905
  transitionDelay: `${15 * index}ms`
@@ -13898,8 +13907,8 @@ var JournalRow = ({
13898
13907
  ...COLLAPSED_STYLE3,
13899
13908
  transitionDelay: `${lineItemsLength - 15 * index}ms`
13900
13909
  };
13901
- const [showComponent, setShowComponent] = useState45(false);
13902
- const baseClass = classNames55(
13910
+ const [showComponent, setShowComponent] = useState44(false);
13911
+ const baseClass = classNames56(
13903
13912
  "Layer__journal-table-row",
13904
13913
  rowId(row) === selectedEntryId && "Layer__table-row--active",
13905
13914
  initialLoad && "initial-load",
@@ -13907,7 +13916,7 @@ var JournalRow = ({
13907
13916
  showComponent ? "show" : "Layer__table-row--anim-starting-state",
13908
13917
  isOpen && "Layer__journal__table-row--expanded"
13909
13918
  );
13910
- const journalEntryLineClass = classNames55(
13919
+ const journalEntryLineClass = classNames56(
13911
13920
  "Layer__journal-entry-table-row",
13912
13921
  selectedEntries && "Layer__table-row--active",
13913
13922
  initialLoad && "initial-load",
@@ -13916,7 +13925,7 @@ var JournalRow = ({
13916
13925
  "Layer__journal-line__table-row",
13917
13926
  !expanded && "Layer__table-row--hidden"
13918
13927
  );
13919
- useEffect38(() => {
13928
+ useEffect39(() => {
13920
13929
  if (initialLoad) {
13921
13930
  const timeoutId = setTimeout(() => {
13922
13931
  setShowComponent(true);
@@ -13927,7 +13936,7 @@ var JournalRow = ({
13927
13936
  }
13928
13937
  }, []);
13929
13938
  if ("line_items" in row) {
13930
- return /* @__PURE__ */ React156.createElement(React156.Fragment, null, /* @__PURE__ */ React156.createElement(
13939
+ return /* @__PURE__ */ React155.createElement(React155.Fragment, null, /* @__PURE__ */ React155.createElement(
13931
13940
  "tr",
13932
13941
  {
13933
13942
  className: baseClass,
@@ -13941,7 +13950,7 @@ var JournalRow = ({
13941
13950
  }
13942
13951
  }
13943
13952
  },
13944
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell Layer__journal__arrow" }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React156.createElement(
13953
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell Layer__journal__arrow" }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React155.createElement(
13945
13954
  "span",
13946
13955
  {
13947
13956
  className: "Layer__table-cell-content-indentation",
@@ -13954,7 +13963,7 @@ var JournalRow = ({
13954
13963
  setIsOpen(!isOpen);
13955
13964
  }
13956
13965
  },
13957
- row.line_items && row.line_items.length > 0 && /* @__PURE__ */ React156.createElement(
13966
+ row.line_items && row.line_items.length > 0 && /* @__PURE__ */ React155.createElement(
13958
13967
  ChevronDownFill_default,
13959
13968
  {
13960
13969
  size: 16,
@@ -13965,21 +13974,21 @@ var JournalRow = ({
13965
13974
  }
13966
13975
  )
13967
13976
  ))),
13968
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-content" }, row.id.substring(0, 5))),
13969
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-content" }, row.date && formatTime11(parseISO15(row.date), DATE_FORMAT))),
13970
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-content" }, humanizeEnum(row.entry_type))),
13971
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-content" }, `(${row.line_items.length})`)),
13972
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, "$", centsToDollars(
13977
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-content" }, row.id.substring(0, 5))),
13978
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-content" }, row.date && formatTime11(parseISO15(row.date), DATE_FORMAT))),
13979
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-content" }, humanizeEnum(row.entry_type))),
13980
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-content" }, `(${row.line_items.length})`)),
13981
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, "$", centsToDollars(
13973
13982
  Math.abs(
13974
13983
  row.line_items.filter((item) => item.direction === "DEBIT").map((item) => item.amount).reduce((a, b) => a + b, 0)
13975
13984
  )
13976
13985
  ))),
13977
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, "$", centsToDollars(
13986
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, "$", centsToDollars(
13978
13987
  Math.abs(
13979
13988
  row.line_items.filter((item) => item.direction === "CREDIT").map((item) => item.amount).reduce((a, b) => a + b, 0)
13980
13989
  )
13981
13990
  )))
13982
- ), (row.line_items || []).map((lineItem, idx) => /* @__PURE__ */ React156.createElement(
13991
+ ), (row.line_items || []).map((lineItem, idx) => /* @__PURE__ */ React155.createElement(
13983
13992
  JournalRow,
13984
13993
  {
13985
13994
  key: `${row.id}-${idx}`,
@@ -13994,18 +14003,18 @@ var JournalRow = ({
13994
14003
  }
13995
14004
  )));
13996
14005
  }
13997
- return /* @__PURE__ */ React156.createElement(
14006
+ return /* @__PURE__ */ React155.createElement(
13998
14007
  "tr",
13999
14008
  {
14000
14009
  className: journalEntryLineClass,
14001
14010
  style: { transitionDelay: `${15 * index}ms` }
14002
14011
  },
14003
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-content", style })),
14004
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-hidden" }, rowId(row).substring(0, 5)))),
14005
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell" }),
14006
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell" }),
14007
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React156.createElement("span", { className: "Layer__table-cell-content", style }, accountName(row))),
14008
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, row.direction === "DEBIT" && /* @__PURE__ */ React156.createElement(
14012
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-content", style })),
14013
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-hidden" }, rowId(row).substring(0, 5)))),
14014
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell" }),
14015
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell" }),
14016
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React155.createElement("span", { className: "Layer__table-cell-content", style }, accountName(row))),
14017
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, row.direction === "DEBIT" && /* @__PURE__ */ React155.createElement(
14009
14018
  "span",
14010
14019
  {
14011
14020
  className: "Layer__table-cell-content Layer__table-cell--amount",
@@ -14014,7 +14023,7 @@ var JournalRow = ({
14014
14023
  "$",
14015
14024
  centsToDollars(Math.abs(row.amount))
14016
14025
  )),
14017
- /* @__PURE__ */ React156.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, row.direction === "CREDIT" && /* @__PURE__ */ React156.createElement(
14026
+ /* @__PURE__ */ React155.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, row.direction === "CREDIT" && /* @__PURE__ */ React155.createElement(
14018
14027
  "span",
14019
14028
  {
14020
14029
  className: "Layer__table-cell-content Layer__table-cell--amount",
@@ -14027,10 +14036,10 @@ var JournalRow = ({
14027
14036
  };
14028
14037
 
14029
14038
  // src/components/JournalSidebar/JournalSidebar.tsx
14030
- import React160, { useContext as useContext30 } from "react";
14039
+ import React159, { useContext as useContext30 } from "react";
14031
14040
 
14032
14041
  // src/components/JournalEntryDetails/JournalEntryDetails.tsx
14033
- import React157, { useContext as useContext27, useMemo as useMemo16 } from "react";
14042
+ import React156, { useContext as useContext27, useMemo as useMemo16 } from "react";
14034
14043
  var JournalEntryDetails = () => {
14035
14044
  const {
14036
14045
  data,
@@ -14045,14 +14054,14 @@ var JournalEntryDetails = () => {
14045
14054
  }
14046
14055
  return;
14047
14056
  }, [data, selectedEntryId]);
14048
- return /* @__PURE__ */ React157.createElement("div", { className: "Layer__journal__entry-details" }, /* @__PURE__ */ React157.createElement(
14057
+ return /* @__PURE__ */ React156.createElement("div", { className: "Layer__journal__entry-details" }, /* @__PURE__ */ React156.createElement(
14049
14058
  DetailsList,
14050
14059
  {
14051
14060
  title: "Transaction source",
14052
- actions: /* @__PURE__ */ React157.createElement(
14061
+ actions: /* @__PURE__ */ React156.createElement(
14053
14062
  Button,
14054
14063
  {
14055
- rightIcon: /* @__PURE__ */ React157.createElement(X_default, null),
14064
+ rightIcon: /* @__PURE__ */ React156.createElement(X_default, null),
14056
14065
  iconOnly: true,
14057
14066
  onClick: closeSelectedEntry,
14058
14067
  className: "Layer__details-list__close-btn",
@@ -14060,54 +14069,54 @@ var JournalEntryDetails = () => {
14060
14069
  }
14061
14070
  )
14062
14071
  },
14063
- /* @__PURE__ */ React157.createElement(DetailsListItem, { label: "Source", isLoading: isLoadingEntry }, /* @__PURE__ */ React157.createElement(Badge, null, entry?.source?.entity_name)),
14064
- entry?.source?.display_description && /* @__PURE__ */ React157.createElement(SourceDetailView, { source: entry?.source })
14065
- ), /* @__PURE__ */ React157.createElement(
14072
+ /* @__PURE__ */ React156.createElement(DetailsListItem, { label: "Source", isLoading: isLoadingEntry }, /* @__PURE__ */ React156.createElement(Badge, null, entry?.source?.entity_name)),
14073
+ entry?.source?.display_description && /* @__PURE__ */ React156.createElement(SourceDetailView, { source: entry?.source })
14074
+ ), /* @__PURE__ */ React156.createElement(
14066
14075
  DetailsList,
14067
14076
  {
14068
14077
  title: `Journal Entry ${entry?.id.substring(0, 5)}`,
14069
14078
  className: "Layer__border-top"
14070
14079
  },
14071
- /* @__PURE__ */ React157.createElement(DetailsListItem, { label: "Entry type", isLoading: isLoadingEntry }, humanizeEnum(entry?.entry_type ?? "")),
14072
- /* @__PURE__ */ React157.createElement(DetailsListItem, { label: "Date", isLoading: isLoadingEntry }, entry?.entry_at && /* @__PURE__ */ React157.createElement(DateTime, { value: entry?.entry_at })),
14073
- /* @__PURE__ */ React157.createElement(DetailsListItem, { label: "Creation date", isLoading: isLoadingEntry }, entry?.date && /* @__PURE__ */ React157.createElement(DateTime, { value: entry?.date })),
14074
- entry?.reversal_id && /* @__PURE__ */ React157.createElement(DetailsListItem, { label: "Reversal", isLoading: isLoadingEntry }, "Journal Entry #", entry?.reversal_id)
14075
- ), !isLoadingEntry && !errorEntry ? /* @__PURE__ */ React157.createElement("div", { className: "Layer__ledger-account__entry-details__line-items" }, /* @__PURE__ */ React157.createElement(Card, null, /* @__PURE__ */ React157.createElement(
14080
+ /* @__PURE__ */ React156.createElement(DetailsListItem, { label: "Entry type", isLoading: isLoadingEntry }, humanizeEnum(entry?.entry_type ?? "")),
14081
+ /* @__PURE__ */ React156.createElement(DetailsListItem, { label: "Date", isLoading: isLoadingEntry }, entry?.entry_at && /* @__PURE__ */ React156.createElement(DateTime, { value: entry?.entry_at })),
14082
+ /* @__PURE__ */ React156.createElement(DetailsListItem, { label: "Creation date", isLoading: isLoadingEntry }, entry?.date && /* @__PURE__ */ React156.createElement(DateTime, { value: entry?.date })),
14083
+ entry?.reversal_id && /* @__PURE__ */ React156.createElement(DetailsListItem, { label: "Reversal", isLoading: isLoadingEntry }, "Journal Entry #", entry?.reversal_id)
14084
+ ), !isLoadingEntry && !errorEntry ? /* @__PURE__ */ React156.createElement("div", { className: "Layer__ledger-account__entry-details__line-items" }, /* @__PURE__ */ React156.createElement(Card, null, /* @__PURE__ */ React156.createElement(
14076
14085
  Table,
14077
14086
  {
14078
14087
  componentName: "ledger-account__entry-details",
14079
14088
  borderCollapse: "collapse"
14080
14089
  },
14081
- /* @__PURE__ */ React157.createElement(TableHead, null, /* @__PURE__ */ React157.createElement(TableRow, { rowKey: "soc-flow-head-row", isHeadRow: true }, /* @__PURE__ */ React157.createElement(TableCell, null, "Line items"), [...Array(3)].map((_, index) => /* @__PURE__ */ React157.createElement(TableCell, { key: `ledger-empty-cell-${index}` })), /* @__PURE__ */ React157.createElement(TableCell, null, "Debit"), /* @__PURE__ */ React157.createElement(TableCell, null, "Credit"))),
14082
- /* @__PURE__ */ React157.createElement(TableBody, null, entry?.line_items?.map((item, index) => /* @__PURE__ */ React157.createElement(
14090
+ /* @__PURE__ */ React156.createElement(TableHead, null, /* @__PURE__ */ React156.createElement(TableRow, { rowKey: "soc-flow-head-row", isHeadRow: true }, /* @__PURE__ */ React156.createElement(TableCell, null, "Line items"), [...Array(3)].map((_, index) => /* @__PURE__ */ React156.createElement(TableCell, { key: `ledger-empty-cell-${index}` })), /* @__PURE__ */ React156.createElement(TableCell, null, "Debit"), /* @__PURE__ */ React156.createElement(TableCell, null, "Credit"))),
14091
+ /* @__PURE__ */ React156.createElement(TableBody, null, entry?.line_items?.map((item, index) => /* @__PURE__ */ React156.createElement(
14083
14092
  TableRow,
14084
14093
  {
14085
14094
  key: `ledger-line-item-${index}`,
14086
14095
  rowKey: `ledger-line-item-${index}`
14087
14096
  },
14088
- /* @__PURE__ */ React157.createElement(TableCell, null, item.account_identifier?.name || ""),
14089
- [...Array(3)].map((_, index2) => /* @__PURE__ */ React157.createElement(TableCell, { key: `ledger-empty-cell-${index2}` })),
14090
- /* @__PURE__ */ React157.createElement(TableCell, null, item.direction === "DEBIT" /* DEBIT */ && /* @__PURE__ */ React157.createElement(Badge, { variant: "warning" /* WARNING */ }, "$", centsToDollars(item.amount || 0))),
14091
- /* @__PURE__ */ React157.createElement(TableCell, null, item.direction === "CREDIT" /* CREDIT */ && /* @__PURE__ */ React157.createElement(Badge, { variant: "success" /* SUCCESS */ }, "$", centsToDollars(item.amount || 0)))
14092
- )), /* @__PURE__ */ React157.createElement(
14097
+ /* @__PURE__ */ React156.createElement(TableCell, null, item.account_identifier?.name || ""),
14098
+ [...Array(3)].map((_, index2) => /* @__PURE__ */ React156.createElement(TableCell, { key: `ledger-empty-cell-${index2}` })),
14099
+ /* @__PURE__ */ React156.createElement(TableCell, null, item.direction === "DEBIT" /* DEBIT */ && /* @__PURE__ */ React156.createElement(Badge, { variant: "warning" /* WARNING */ }, "$", centsToDollars(item.amount || 0))),
14100
+ /* @__PURE__ */ React156.createElement(TableCell, null, item.direction === "CREDIT" /* CREDIT */ && /* @__PURE__ */ React156.createElement(Badge, { variant: "success" /* SUCCESS */ }, "$", centsToDollars(item.amount || 0)))
14101
+ )), /* @__PURE__ */ React156.createElement(
14093
14102
  TableRow,
14094
14103
  {
14095
14104
  rowKey: "ledger-line-item-summation",
14096
14105
  variant: "summation"
14097
14106
  },
14098
- /* @__PURE__ */ React157.createElement(TableCell, { primary: true }, "Total"),
14099
- [...Array(3)].map((_, index) => /* @__PURE__ */ React157.createElement(TableCell, { key: `ledger-empty-cell-${index}` })),
14100
- /* @__PURE__ */ React157.createElement(TableCell, { isCurrency: true, primary: true }, entry?.line_items.filter((item) => item.direction === "DEBIT").map((item) => item.amount).reduce((a, b) => a + b, 0) || 0),
14101
- /* @__PURE__ */ React157.createElement(TableCell, { isCurrency: true, primary: true }, entry?.line_items.filter((item) => item.direction === "CREDIT").map((item) => item.amount).reduce((a, b) => a + b, 0) || 0)
14107
+ /* @__PURE__ */ React156.createElement(TableCell, { primary: true }, "Total"),
14108
+ [...Array(3)].map((_, index) => /* @__PURE__ */ React156.createElement(TableCell, { key: `ledger-empty-cell-${index}` })),
14109
+ /* @__PURE__ */ React156.createElement(TableCell, { isCurrency: true, primary: true }, entry?.line_items.filter((item) => item.direction === "DEBIT").map((item) => item.amount).reduce((a, b) => a + b, 0) || 0),
14110
+ /* @__PURE__ */ React156.createElement(TableCell, { isCurrency: true, primary: true }, entry?.line_items.filter((item) => item.direction === "CREDIT").map((item) => item.amount).reduce((a, b) => a + b, 0) || 0)
14102
14111
  ))
14103
14112
  ))) : null);
14104
14113
  };
14105
14114
 
14106
14115
  // src/components/JournalForm/JournalForm.tsx
14107
- import React159, { useContext as useContext29 } from "react";
14116
+ import React158, { useContext as useContext29 } from "react";
14108
14117
 
14109
14118
  // src/components/JournalForm/JournalFormEntryLines.tsx
14110
- import React158, { useContext as useContext28 } from "react";
14119
+ import React157, { useContext as useContext28 } from "react";
14111
14120
  var JournalFormEntryLines = ({
14112
14121
  entrylineItems,
14113
14122
  addEntryLine,
@@ -14119,14 +14128,14 @@ var JournalFormEntryLines = ({
14119
14128
  const { data: accountsData } = useContext28(ChartOfAccountsContext);
14120
14129
  const { form } = useContext28(JournalContext);
14121
14130
  const parentOptions = useParentOptions(accountsData);
14122
- return /* @__PURE__ */ React158.createElement(React158.Fragment, null, Object.keys(Direction).map((direction, idx) => {
14123
- return /* @__PURE__ */ React158.createElement(
14131
+ return /* @__PURE__ */ React157.createElement(React157.Fragment, null, Object.keys(Direction).map((direction, idx) => {
14132
+ return /* @__PURE__ */ React157.createElement(
14124
14133
  "div",
14125
14134
  {
14126
14135
  key: "Layer__journal__form__input-group-" + idx,
14127
14136
  className: "Layer__journal__form__input-group Layer__journal__form__input-group__border"
14128
14137
  },
14129
- /* @__PURE__ */ React158.createElement(
14138
+ /* @__PURE__ */ React157.createElement(
14130
14139
  Text,
14131
14140
  {
14132
14141
  className: "Layer__journal__form__input-group__title",
@@ -14140,13 +14149,13 @@ var JournalFormEntryLines = ({
14140
14149
  if (item.direction !== direction) {
14141
14150
  return null;
14142
14151
  }
14143
- return /* @__PURE__ */ React158.createElement(
14152
+ return /* @__PURE__ */ React157.createElement(
14144
14153
  "div",
14145
14154
  {
14146
14155
  className: "Layer__journal__form__input-group__line-item",
14147
14156
  key: direction + "-" + idx2
14148
14157
  },
14149
- /* @__PURE__ */ React158.createElement(InputGroup, { name: direction, label: "Amount", inline: true }, /* @__PURE__ */ React158.createElement(
14158
+ /* @__PURE__ */ React157.createElement(InputGroup, { name: direction, label: "Amount", inline: true }, /* @__PURE__ */ React157.createElement(
14150
14159
  InputWithBadge,
14151
14160
  {
14152
14161
  name: direction,
@@ -14172,14 +14181,14 @@ var JournalFormEntryLines = ({
14172
14181
  )?.message
14173
14182
  }
14174
14183
  )),
14175
- /* @__PURE__ */ React158.createElement(
14184
+ /* @__PURE__ */ React157.createElement(
14176
14185
  InputGroup,
14177
14186
  {
14178
14187
  name: "account-name",
14179
14188
  label: "Account name",
14180
14189
  inline: true
14181
14190
  },
14182
- /* @__PURE__ */ React158.createElement(
14191
+ /* @__PURE__ */ React157.createElement(
14183
14192
  Select2,
14184
14193
  {
14185
14194
  options: parentOptions,
@@ -14203,18 +14212,18 @@ var JournalFormEntryLines = ({
14203
14212
  )?.message
14204
14213
  }
14205
14214
  ),
14206
- idx2 >= 2 && /* @__PURE__ */ React158.createElement(
14215
+ idx2 >= 2 && /* @__PURE__ */ React157.createElement(
14207
14216
  IconButton,
14208
14217
  {
14209
14218
  className: "Layer__remove__button",
14210
14219
  onClick: () => removeEntryLine(idx2),
14211
- icon: /* @__PURE__ */ React158.createElement(Trash_default, null)
14220
+ icon: /* @__PURE__ */ React157.createElement(Trash_default, null)
14212
14221
  }
14213
14222
  )
14214
14223
  )
14215
14224
  );
14216
14225
  }),
14217
- (config.form.addEntryLinesLimit === void 0 || config.form.addEntryLinesLimit > entrylineItems?.length) && /* @__PURE__ */ React158.createElement(
14226
+ (config.form.addEntryLinesLimit === void 0 || config.form.addEntryLinesLimit > entrylineItems?.length) && /* @__PURE__ */ React157.createElement(
14218
14227
  TextButton,
14219
14228
  {
14220
14229
  className: "Layer__journal__add-entry-line",
@@ -14238,7 +14247,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14238
14247
  addEntryLine,
14239
14248
  removeEntryLine
14240
14249
  } = useContext29(JournalContext);
14241
- return /* @__PURE__ */ React159.createElement(
14250
+ return /* @__PURE__ */ React158.createElement(
14242
14251
  "form",
14243
14252
  {
14244
14253
  className: "Layer__form",
@@ -14247,7 +14256,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14247
14256
  submitForm();
14248
14257
  }
14249
14258
  },
14250
- /* @__PURE__ */ React159.createElement("div", { className: "Layer__journal__sidebar__header" }, /* @__PURE__ */ React159.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, stringOverrides?.header && "Add New Entry"), /* @__PURE__ */ React159.createElement("div", { className: "actions" }, /* @__PURE__ */ React159.createElement(
14259
+ /* @__PURE__ */ React158.createElement("div", { className: "Layer__journal__sidebar__header" }, /* @__PURE__ */ React158.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, stringOverrides?.header && "Add New Entry"), /* @__PURE__ */ React158.createElement("div", { className: "actions" }, /* @__PURE__ */ React158.createElement(
14251
14260
  Button,
14252
14261
  {
14253
14262
  type: "button",
@@ -14256,7 +14265,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14256
14265
  disabled: sendingForm
14257
14266
  },
14258
14267
  stringOverrides?.cancelButton || "Cancel"
14259
- ), apiError && /* @__PURE__ */ React159.createElement(
14268
+ ), apiError && /* @__PURE__ */ React158.createElement(
14260
14269
  RetryButton,
14261
14270
  {
14262
14271
  type: "submit",
@@ -14265,7 +14274,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14265
14274
  disabled: sendingForm
14266
14275
  },
14267
14276
  stringOverrides?.retryButton || "Retry"
14268
- ), !apiError && /* @__PURE__ */ React159.createElement(
14277
+ ), !apiError && /* @__PURE__ */ React158.createElement(
14269
14278
  SubmitButton,
14270
14279
  {
14271
14280
  type: "submit",
@@ -14275,7 +14284,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14275
14284
  },
14276
14285
  stringOverrides?.saveButton || "Save"
14277
14286
  ))),
14278
- apiError && /* @__PURE__ */ React159.createElement(
14287
+ apiError && /* @__PURE__ */ React158.createElement(
14279
14288
  Text,
14280
14289
  {
14281
14290
  size: "sm" /* sm */,
@@ -14283,7 +14292,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14283
14292
  },
14284
14293
  apiError
14285
14294
  ),
14286
- /* @__PURE__ */ React159.createElement("div", { className: "Layer__journal__form__input-group" }, /* @__PURE__ */ React159.createElement(InputGroup, { name: "date", label: "Date", inline: true }, /* @__PURE__ */ React159.createElement("div", { className: "Layer__journal__datepicker__wrapper" }, /* @__PURE__ */ React159.createElement(
14295
+ /* @__PURE__ */ React158.createElement("div", { className: "Layer__journal__form__input-group" }, /* @__PURE__ */ React158.createElement(InputGroup, { name: "date", label: "Date", inline: true }, /* @__PURE__ */ React158.createElement("div", { className: "Layer__journal__datepicker__wrapper" }, /* @__PURE__ */ React158.createElement(
14287
14296
  DatePicker,
14288
14297
  {
14289
14298
  selected: form?.data.entry_at ? new Date(form?.data.entry_at) : /* @__PURE__ */ new Date(),
@@ -14296,7 +14305,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14296
14305
  placeholderText: "Select date",
14297
14306
  currentDateOption: false
14298
14307
  }
14299
- ), /* @__PURE__ */ React159.createElement(
14308
+ ), /* @__PURE__ */ React158.createElement(
14300
14309
  DatePicker,
14301
14310
  {
14302
14311
  selected: form?.data.entry_at ? new Date(form?.data.entry_at) : /* @__PURE__ */ new Date(),
@@ -14310,7 +14319,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14310
14319
  currentDateOption: false
14311
14320
  }
14312
14321
  )))),
14313
- /* @__PURE__ */ React159.createElement(
14322
+ /* @__PURE__ */ React158.createElement(
14314
14323
  JournalFormEntryLines,
14315
14324
  {
14316
14325
  entrylineItems: form?.data.line_items || [],
@@ -14321,7 +14330,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14321
14330
  config
14322
14331
  }
14323
14332
  ),
14324
- /* @__PURE__ */ React159.createElement("div", { className: "Layer__journal__form__input-group Layer__journal__form__input-group__textarea" }, /* @__PURE__ */ React159.createElement(InputGroup, { name: "memo", label: "Notes" }, /* @__PURE__ */ React159.createElement(
14333
+ /* @__PURE__ */ React158.createElement("div", { className: "Layer__journal__form__input-group Layer__journal__form__input-group__textarea" }, /* @__PURE__ */ React158.createElement(InputGroup, { name: "memo", label: "Notes" }, /* @__PURE__ */ React158.createElement(
14325
14334
  Textarea,
14326
14335
  {
14327
14336
  name: "memo",
@@ -14331,7 +14340,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14331
14340
  disabled: sendingForm
14332
14341
  }
14333
14342
  ))),
14334
- /* @__PURE__ */ React159.createElement("div", { className: "Layer__journal__bottom-actions" }, /* @__PURE__ */ React159.createElement(
14343
+ /* @__PURE__ */ React158.createElement("div", { className: "Layer__journal__bottom-actions" }, /* @__PURE__ */ React158.createElement(
14335
14344
  Button,
14336
14345
  {
14337
14346
  type: "button",
@@ -14340,7 +14349,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14340
14349
  disabled: sendingForm
14341
14350
  },
14342
14351
  stringOverrides?.cancelButton || "Cancel"
14343
- ), apiError && /* @__PURE__ */ React159.createElement(
14352
+ ), apiError && /* @__PURE__ */ React158.createElement(
14344
14353
  RetryButton,
14345
14354
  {
14346
14355
  type: "submit",
@@ -14349,7 +14358,7 @@ var JournalForm = ({ config, stringOverrides }) => {
14349
14358
  disabled: sendingForm
14350
14359
  },
14351
14360
  stringOverrides?.retryButton || "Retry"
14352
- ), !apiError && /* @__PURE__ */ React159.createElement(
14361
+ ), !apiError && /* @__PURE__ */ React158.createElement(
14353
14362
  SubmitButton,
14354
14363
  {
14355
14364
  type: "submit",
@@ -14370,9 +14379,9 @@ var JournalSidebar = ({
14370
14379
  }) => {
14371
14380
  const { selectedEntryId } = useContext30(JournalContext);
14372
14381
  if (selectedEntryId !== "new") {
14373
- return /* @__PURE__ */ React160.createElement(JournalEntryDetails, null);
14382
+ return /* @__PURE__ */ React159.createElement(JournalEntryDetails, null);
14374
14383
  }
14375
- return /* @__PURE__ */ React160.createElement(JournalForm, { config, stringOverrides });
14384
+ return /* @__PURE__ */ React159.createElement(JournalForm, { config, stringOverrides });
14376
14385
  };
14377
14386
 
14378
14387
  // src/components/JournalTable/JournalTable.tsx
@@ -14384,7 +14393,7 @@ var JournalTable = ({
14384
14393
  config,
14385
14394
  stringOverrides
14386
14395
  }) => {
14387
- const [currentPage, setCurrentPage] = useState46(1);
14396
+ const [currentPage, setCurrentPage] = useState45(1);
14388
14397
  const {
14389
14398
  data: rawData,
14390
14399
  isLoading,
@@ -14399,16 +14408,16 @@ var JournalTable = ({
14399
14408
  const lastPageIndex = firstPageIndex + pageSize;
14400
14409
  return rawData?.sort((a, b) => Date.parse(b.date) - Date.parse(a.date))?.slice(firstPageIndex, lastPageIndex);
14401
14410
  }, [rawData, currentPage]);
14402
- return /* @__PURE__ */ React161.createElement(
14411
+ return /* @__PURE__ */ React160.createElement(
14403
14412
  Panel,
14404
14413
  {
14405
- sidebar: /* @__PURE__ */ React161.createElement(JournalSidebar, { parentRef: containerRef, config, stringOverrides: stringOverrides?.journalForm }),
14414
+ sidebar: /* @__PURE__ */ React160.createElement(JournalSidebar, { parentRef: containerRef, config, stringOverrides: stringOverrides?.journalForm }),
14406
14415
  sidebarIsOpen: Boolean(selectedEntryId),
14407
14416
  parentRef: containerRef
14408
14417
  },
14409
- /* @__PURE__ */ React161.createElement(Header, { className: `Layer__${COMPONENT_NAME6}__header` }, /* @__PURE__ */ React161.createElement(Heading, { className: `Layer__${COMPONENT_NAME6}__title` }, stringOverrides?.componentTitle || "Journal"), /* @__PURE__ */ React161.createElement("div", { className: `Layer__${COMPONENT_NAME6}__actions` }, /* @__PURE__ */ React161.createElement(Button, { onClick: () => addEntry(), disabled: isLoading }, stringOverrides?.addEntryButton || "Add Entry"))),
14410
- /* @__PURE__ */ React161.createElement("table", { className: "Layer__table Layer__table--hover-effect Layer__journal__table" }, /* @__PURE__ */ React161.createElement("thead", null, /* @__PURE__ */ React161.createElement("tr", null, /* @__PURE__ */ React161.createElement("th", { className: "Layer__table-header" }), /* @__PURE__ */ React161.createElement("th", { className: "Layer__table-header" }, stringOverrides?.idColumnHeader || "Id"), /* @__PURE__ */ React161.createElement("th", { className: "Layer__table-header" }, stringOverrides?.dateColumnHeader || "Date"), /* @__PURE__ */ React161.createElement("th", { className: "Layer__table-header" }, stringOverrides?.transactionColumnHeader || "Transaction"), /* @__PURE__ */ React161.createElement("th", { className: "Layer__table-header" }, stringOverrides?.accountColumnHeader || "Account"), /* @__PURE__ */ React161.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, stringOverrides?.debitColumnHeader || "Debit"), /* @__PURE__ */ React161.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, stringOverrides?.creditColumnHeader || "Credit"))), /* @__PURE__ */ React161.createElement("tbody", null, !error && data?.map((entry, idx) => {
14411
- return /* @__PURE__ */ React161.createElement(
14418
+ /* @__PURE__ */ React160.createElement(Header, { className: `Layer__${COMPONENT_NAME6}__header` }, /* @__PURE__ */ React160.createElement(Heading, { className: `Layer__${COMPONENT_NAME6}__title` }, stringOverrides?.componentTitle || "Journal"), /* @__PURE__ */ React160.createElement("div", { className: `Layer__${COMPONENT_NAME6}__actions` }, /* @__PURE__ */ React160.createElement(Button, { onClick: () => addEntry(), disabled: isLoading }, stringOverrides?.addEntryButton || "Add Entry"))),
14419
+ /* @__PURE__ */ React160.createElement("table", { className: "Layer__table Layer__table--hover-effect Layer__journal__table" }, /* @__PURE__ */ React160.createElement("thead", null, /* @__PURE__ */ React160.createElement("tr", null, /* @__PURE__ */ React160.createElement("th", { className: "Layer__table-header" }), /* @__PURE__ */ React160.createElement("th", { className: "Layer__table-header" }, stringOverrides?.idColumnHeader || "Id"), /* @__PURE__ */ React160.createElement("th", { className: "Layer__table-header" }, stringOverrides?.dateColumnHeader || "Date"), /* @__PURE__ */ React160.createElement("th", { className: "Layer__table-header" }, stringOverrides?.transactionColumnHeader || "Transaction"), /* @__PURE__ */ React160.createElement("th", { className: "Layer__table-header" }, stringOverrides?.accountColumnHeader || "Account"), /* @__PURE__ */ React160.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, stringOverrides?.debitColumnHeader || "Debit"), /* @__PURE__ */ React160.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, stringOverrides?.creditColumnHeader || "Credit"))), /* @__PURE__ */ React160.createElement("tbody", null, !error && data?.map((entry, idx) => {
14420
+ return /* @__PURE__ */ React160.createElement(
14412
14421
  JournalRow,
14413
14422
  {
14414
14423
  key: "journal-row-" + idx + entry.id,
@@ -14418,7 +14427,7 @@ var JournalTable = ({
14418
14427
  }
14419
14428
  );
14420
14429
  }))),
14421
- data && /* @__PURE__ */ React161.createElement("div", { className: "Layer__journal__pagination" }, /* @__PURE__ */ React161.createElement(
14430
+ data && /* @__PURE__ */ React160.createElement("div", { className: "Layer__journal__pagination" }, /* @__PURE__ */ React160.createElement(
14422
14431
  Pagination,
14423
14432
  {
14424
14433
  currentPage,
@@ -14427,7 +14436,7 @@ var JournalTable = ({
14427
14436
  onPageChange: (page) => setCurrentPage(page)
14428
14437
  }
14429
14438
  )),
14430
- error ? /* @__PURE__ */ React161.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React161.createElement(
14439
+ error ? /* @__PURE__ */ React160.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React160.createElement(
14431
14440
  DataState,
14432
14441
  {
14433
14442
  status: "failed" /* failed */,
@@ -14437,7 +14446,7 @@ var JournalTable = ({
14437
14446
  isLoading: isValidating || isLoading
14438
14447
  }
14439
14448
  )) : null,
14440
- (!data || isLoading) && !error ? /* @__PURE__ */ React161.createElement("div", { className: `Layer__${COMPONENT_NAME6}__loader-container` }, /* @__PURE__ */ React161.createElement(Loader2, null)) : null
14449
+ (!data || isLoading) && !error ? /* @__PURE__ */ React160.createElement("div", { className: `Layer__${COMPONENT_NAME6}__loader-container` }, /* @__PURE__ */ React160.createElement(Loader2, null)) : null
14441
14450
  );
14442
14451
  };
14443
14452
 
@@ -14450,14 +14459,14 @@ var JOURNAL_CONFIG = {
14450
14459
  var Journal = (props) => {
14451
14460
  const JournalContextData = useJournal();
14452
14461
  const AccountsContextData = useChartOfAccounts();
14453
- return /* @__PURE__ */ React162.createElement(ChartOfAccountsContext.Provider, { value: AccountsContextData }, /* @__PURE__ */ React162.createElement(JournalContext.Provider, { value: JournalContextData }, /* @__PURE__ */ React162.createElement(TableProvider, null, /* @__PURE__ */ React162.createElement(JournalContent, { ...props }))));
14462
+ return /* @__PURE__ */ React161.createElement(ChartOfAccountsContext.Provider, { value: AccountsContextData }, /* @__PURE__ */ React161.createElement(JournalContext.Provider, { value: JournalContextData }, /* @__PURE__ */ React161.createElement(TableProvider, null, /* @__PURE__ */ React161.createElement(JournalContent, { ...props }))));
14454
14463
  };
14455
14464
  var JournalContent = ({
14456
14465
  asWidget,
14457
14466
  config = JOURNAL_CONFIG,
14458
14467
  stringOverrides
14459
14468
  }) => {
14460
- const [view, setView] = useState47("desktop");
14469
+ const [view, setView] = useState46("desktop");
14461
14470
  const containerRef = useElementSize((_a, _b, { width }) => {
14462
14471
  if (width) {
14463
14472
  if (width >= BREAKPOINTS.TABLET && view !== "desktop") {
@@ -14469,7 +14478,7 @@ var JournalContent = ({
14469
14478
  }
14470
14479
  }
14471
14480
  });
14472
- return /* @__PURE__ */ React162.createElement(Container, { name: "journal", ref: containerRef, asWidget }, /* @__PURE__ */ React162.createElement(
14481
+ return /* @__PURE__ */ React161.createElement(Container, { name: "journal", ref: containerRef, asWidget }, /* @__PURE__ */ React161.createElement(
14473
14482
  JournalTable,
14474
14483
  {
14475
14484
  view,
@@ -14481,12 +14490,12 @@ var JournalContent = ({
14481
14490
  };
14482
14491
 
14483
14492
  // src/components/Tasks/Tasks.tsx
14484
- import React169, {
14493
+ import React168, {
14485
14494
  createContext as createContext14,
14486
14495
  useContext as useContext36,
14487
- useEffect as useEffect42,
14496
+ useEffect as useEffect43,
14488
14497
  useMemo as useMemo19,
14489
- useState as useState51
14498
+ useState as useState50
14490
14499
  } from "react";
14491
14500
 
14492
14501
  // src/contexts/TasksContext/TasksContext.tsx
@@ -14503,10 +14512,10 @@ var TasksContext = createContext13({
14503
14512
  });
14504
14513
 
14505
14514
  // src/hooks/useTasks/useTasks.tsx
14506
- import { useEffect as useEffect39, useState as useState48 } from "react";
14515
+ import { useEffect as useEffect40, useState as useState47 } from "react";
14507
14516
  import useSWR10 from "swr";
14508
14517
  var useTasks = () => {
14509
- const [loadedStatus, setLoadedStatus] = useState48("initial");
14518
+ const [loadedStatus, setLoadedStatus] = useState47("initial");
14510
14519
  const { auth, businessId, apiUrl, read, syncTimestamps, hasBeenTouched } = useLayerContext();
14511
14520
  const queryKey = businessId && auth?.access_token && `tasks-${businessId}`;
14512
14521
  const { data, isLoading, isValidating, error, mutate } = useSWR10(
@@ -14515,7 +14524,7 @@ var useTasks = () => {
14515
14524
  params: { businessId }
14516
14525
  })
14517
14526
  );
14518
- useEffect39(() => {
14527
+ useEffect40(() => {
14519
14528
  if (isLoading && loadedStatus === "initial") {
14520
14529
  setLoadedStatus("loading");
14521
14530
  } else if (!isLoading && loadedStatus === "loading") {
@@ -14535,12 +14544,12 @@ var useTasks = () => {
14535
14544
  body: data2
14536
14545
  }).then(() => refetch());
14537
14546
  };
14538
- useEffect39(() => {
14547
+ useEffect40(() => {
14539
14548
  if (queryKey && (isLoading || isValidating)) {
14540
14549
  read("TASKS" /* TASKS */, queryKey);
14541
14550
  }
14542
14551
  }, [isLoading, isValidating]);
14543
- useEffect39(() => {
14552
+ useEffect40(() => {
14544
14553
  if (queryKey && hasBeenTouched(queryKey)) {
14545
14554
  refetch();
14546
14555
  }
@@ -14563,11 +14572,11 @@ function isComplete(taskType) {
14563
14572
  }
14564
14573
 
14565
14574
  // src/components/TasksHeader/TasksHeader.tsx
14566
- import React164, { useContext as useContext32 } from "react";
14575
+ import React163, { useContext as useContext32 } from "react";
14567
14576
 
14568
14577
  // src/icons/ProgressIcon.tsx
14569
- import * as React163 from "react";
14570
- var ProgressIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React163.createElement(
14578
+ import * as React162 from "react";
14579
+ var ProgressIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React162.createElement(
14571
14580
  "svg",
14572
14581
  {
14573
14582
  xmlns: "http://www.w3.org/2000/svg",
@@ -14577,7 +14586,7 @@ var ProgressIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React163.createE
14577
14586
  width: size,
14578
14587
  height: size
14579
14588
  },
14580
- /* @__PURE__ */ React163.createElement(
14589
+ /* @__PURE__ */ React162.createElement(
14581
14590
  "path",
14582
14591
  {
14583
14592
  d: "M9 1.5V4.5",
@@ -14586,7 +14595,7 @@ var ProgressIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React163.createE
14586
14595
  strokeLinejoin: "round"
14587
14596
  }
14588
14597
  ),
14589
- /* @__PURE__ */ React163.createElement(
14598
+ /* @__PURE__ */ React162.createElement(
14590
14599
  "path",
14591
14600
  {
14592
14601
  d: "M9 13.5V16.5",
@@ -14595,7 +14604,7 @@ var ProgressIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React163.createE
14595
14604
  strokeLinejoin: "round"
14596
14605
  }
14597
14606
  ),
14598
- /* @__PURE__ */ React163.createElement(
14607
+ /* @__PURE__ */ React162.createElement(
14599
14608
  "path",
14600
14609
  {
14601
14610
  d: "M3.6975 3.6975L5.82 5.82",
@@ -14604,7 +14613,7 @@ var ProgressIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React163.createE
14604
14613
  strokeLinejoin: "round"
14605
14614
  }
14606
14615
  ),
14607
- /* @__PURE__ */ React163.createElement(
14616
+ /* @__PURE__ */ React162.createElement(
14608
14617
  "path",
14609
14618
  {
14610
14619
  d: "M12.18 12.18L14.3025 14.3025",
@@ -14613,7 +14622,7 @@ var ProgressIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React163.createE
14613
14622
  strokeLinejoin: "round"
14614
14623
  }
14615
14624
  ),
14616
- /* @__PURE__ */ React163.createElement(
14625
+ /* @__PURE__ */ React162.createElement(
14617
14626
  "path",
14618
14627
  {
14619
14628
  d: "M1.5 9H4.5",
@@ -14622,7 +14631,7 @@ var ProgressIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React163.createE
14622
14631
  strokeLinejoin: "round"
14623
14632
  }
14624
14633
  ),
14625
- /* @__PURE__ */ React163.createElement(
14634
+ /* @__PURE__ */ React162.createElement(
14626
14635
  "path",
14627
14636
  {
14628
14637
  d: "M13.5 9H16.5",
@@ -14631,7 +14640,7 @@ var ProgressIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React163.createE
14631
14640
  strokeLinejoin: "round"
14632
14641
  }
14633
14642
  ),
14634
- /* @__PURE__ */ React163.createElement(
14643
+ /* @__PURE__ */ React162.createElement(
14635
14644
  "path",
14636
14645
  {
14637
14646
  d: "M3.6975 14.3025L5.82 12.18",
@@ -14640,7 +14649,7 @@ var ProgressIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React163.createE
14640
14649
  strokeLinejoin: "round"
14641
14650
  }
14642
14651
  ),
14643
- /* @__PURE__ */ React163.createElement(
14652
+ /* @__PURE__ */ React162.createElement(
14644
14653
  "path",
14645
14654
  {
14646
14655
  d: "M12.18 5.82L14.3025 3.6975",
@@ -14655,22 +14664,22 @@ var ProgressIcon_default = ProgressIcon;
14655
14664
  // src/components/TasksHeader/TasksHeader.tsx
14656
14665
  var ICONS = {
14657
14666
  loading: {
14658
- icon: /* @__PURE__ */ React164.createElement(ProgressIcon_default, { size: 12, className: "Layer__anim--rotating" }),
14667
+ icon: /* @__PURE__ */ React163.createElement(ProgressIcon_default, { size: 12, className: "Layer__anim--rotating" }),
14659
14668
  text: "Loading",
14660
14669
  badge: "default" /* DEFAULT */
14661
14670
  },
14662
14671
  done: {
14663
- icon: /* @__PURE__ */ React164.createElement(Check_default, { size: 12 }),
14672
+ icon: /* @__PURE__ */ React163.createElement(Check_default, { size: 12 }),
14664
14673
  text: "Done",
14665
14674
  badge: "success" /* SUCCESS */
14666
14675
  },
14667
14676
  pending: {
14668
- icon: /* @__PURE__ */ React164.createElement(AlertCircle_default, { size: 12 }),
14677
+ icon: /* @__PURE__ */ React163.createElement(AlertCircle_default, { size: 12 }),
14669
14678
  text: "In progress",
14670
14679
  badge: "warning" /* WARNING */
14671
14680
  },
14672
14681
  refresh: {
14673
- icon: /* @__PURE__ */ React164.createElement(RefreshCcw_default, { size: 12 }),
14682
+ icon: /* @__PURE__ */ React163.createElement(RefreshCcw_default, { size: 12 }),
14674
14683
  text: "Refresh",
14675
14684
  badge: "default" /* DEFAULT */
14676
14685
  }
@@ -14684,7 +14693,7 @@ var TasksHeader = ({
14684
14693
  const { data: tasks, loadedStatus, refetch, error } = useContext32(TasksContext);
14685
14694
  const completedTasks = tasks?.filter((task) => isComplete(task.status)).length;
14686
14695
  const badgeVariant = completedTasks === tasks?.length ? ICONS.done : ICONS.pending;
14687
- return /* @__PURE__ */ React164.createElement("div", { className: "Layer__tasks-header" }, /* @__PURE__ */ React164.createElement("div", { className: "Layer__tasks-header__left-col" }, /* @__PURE__ */ React164.createElement(Text, { size: "lg" /* lg */ }, tasksHeader), loadedStatus !== "complete" && !open ? /* @__PURE__ */ React164.createElement(Badge, { variant: ICONS.loading.badge, icon: ICONS.loading.icon }, ICONS.loading.text) : loadedStatus === "complete" && (!tasks || error) ? /* @__PURE__ */ React164.createElement(
14696
+ return /* @__PURE__ */ React163.createElement("div", { className: "Layer__tasks-header" }, /* @__PURE__ */ React163.createElement("div", { className: "Layer__tasks-header__left-col" }, /* @__PURE__ */ React163.createElement(Text, { size: "lg" /* lg */ }, tasksHeader), loadedStatus !== "complete" && !open ? /* @__PURE__ */ React163.createElement(Badge, { variant: ICONS.loading.badge, icon: ICONS.loading.icon }, ICONS.loading.text) : loadedStatus === "complete" && (!tasks || error) ? /* @__PURE__ */ React163.createElement(
14688
14697
  Badge,
14689
14698
  {
14690
14699
  onClick: () => refetch(),
@@ -14692,15 +14701,15 @@ var TasksHeader = ({
14692
14701
  icon: ICONS.refresh.icon
14693
14702
  },
14694
14703
  ICONS.refresh.text
14695
- ) : loadedStatus === "complete" ? /* @__PURE__ */ React164.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text) : open ? null : /* @__PURE__ */ React164.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text)), collapsable && /* @__PURE__ */ React164.createElement(ExpandButton, { onClick: toggleContent, collapsed: !open }));
14704
+ ) : loadedStatus === "complete" ? /* @__PURE__ */ React163.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text) : open ? null : /* @__PURE__ */ React163.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text)), collapsable && /* @__PURE__ */ React163.createElement(ExpandButton, { onClick: toggleContent, collapsed: !open }));
14696
14705
  };
14697
14706
 
14698
14707
  // src/components/TasksList/TasksList.tsx
14699
- import React167, { useContext as useContext34, useMemo as useMemo18, useState as useState50 } from "react";
14708
+ import React166, { useContext as useContext34, useMemo as useMemo18, useState as useState49 } from "react";
14700
14709
 
14701
14710
  // src/icons/SmileIcon.tsx
14702
- import * as React165 from "react";
14703
- var SmileIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React165.createElement(
14711
+ import * as React164 from "react";
14712
+ var SmileIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React164.createElement(
14704
14713
  "svg",
14705
14714
  {
14706
14715
  viewBox: "0 0 12 12",
@@ -14710,7 +14719,7 @@ var SmileIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React165.createElem
14710
14719
  width: size,
14711
14720
  height: size
14712
14721
  },
14713
- /* @__PURE__ */ React165.createElement(
14722
+ /* @__PURE__ */ React164.createElement(
14714
14723
  "path",
14715
14724
  {
14716
14725
  d: "M6.5 11.5C9.26142 11.5 11.5 9.26142 11.5 6.5C11.5 3.73858 9.26142 1.5 6.5 1.5C3.73858 1.5 1.5 3.73858 1.5 6.5C1.5 9.26142 3.73858 11.5 6.5 11.5Z",
@@ -14719,7 +14728,7 @@ var SmileIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React165.createElem
14719
14728
  strokeLinejoin: "round"
14720
14729
  }
14721
14730
  ),
14722
- /* @__PURE__ */ React165.createElement(
14731
+ /* @__PURE__ */ React164.createElement(
14723
14732
  "path",
14724
14733
  {
14725
14734
  d: "M4.5 7.5C4.5 7.5 5.25 8.5 6.5 8.5C7.75 8.5 8.5 7.5 8.5 7.5",
@@ -14728,7 +14737,7 @@ var SmileIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React165.createElem
14728
14737
  strokeLinejoin: "round"
14729
14738
  }
14730
14739
  ),
14731
- /* @__PURE__ */ React165.createElement(
14740
+ /* @__PURE__ */ React164.createElement(
14732
14741
  "path",
14733
14742
  {
14734
14743
  d: "M5 5H5.005",
@@ -14737,7 +14746,7 @@ var SmileIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React165.createElem
14737
14746
  strokeLinejoin: "round"
14738
14747
  }
14739
14748
  ),
14740
- /* @__PURE__ */ React165.createElement(
14749
+ /* @__PURE__ */ React164.createElement(
14741
14750
  "path",
14742
14751
  {
14743
14752
  d: "M8 5H8.005",
@@ -14750,40 +14759,40 @@ var SmileIcon = ({ size = 12, ...props }) => /* @__PURE__ */ React165.createElem
14750
14759
  var SmileIcon_default = SmileIcon;
14751
14760
 
14752
14761
  // src/components/TasksListItem/TasksListItem.tsx
14753
- import React166, { useContext as useContext33, useEffect as useEffect40, useState as useState49 } from "react";
14754
- import classNames56 from "classnames";
14762
+ import React165, { useContext as useContext33, useEffect as useEffect41, useState as useState48 } from "react";
14763
+ import classNames57 from "classnames";
14755
14764
  var TasksListItem = ({
14756
14765
  task,
14757
14766
  goToNextPageIfAllComplete,
14758
14767
  defaultOpen
14759
14768
  }) => {
14760
- const [isOpen, setIsOpen] = useState49(defaultOpen);
14761
- const [userResponse, setUserResponse] = useState49(task.user_response || "");
14769
+ const [isOpen, setIsOpen] = useState48(defaultOpen);
14770
+ const [userResponse, setUserResponse] = useState48(task.user_response || "");
14762
14771
  const { submitResponseToTask: submitResponseToTask2 } = useContext33(TasksContext);
14763
- const taskBodyClassName = classNames56(
14772
+ const taskBodyClassName = classNames57(
14764
14773
  "Layer__tasks-list-item__body",
14765
14774
  isOpen && "Layer__tasks-list-item__body--expanded",
14766
14775
  isComplete(task.status) && "Layer__tasks-list-item--completed"
14767
14776
  );
14768
- const taskHeadClassName = classNames56(
14777
+ const taskHeadClassName = classNames57(
14769
14778
  "Layer__tasks-list-item__head-info",
14770
14779
  isComplete(task.status) ? "Layer__tasks-list-item--completed" : "Layer__tasks-list-item--pending"
14771
14780
  );
14772
- const taskItemClassName = classNames56(
14781
+ const taskItemClassName = classNames57(
14773
14782
  "Layer__tasks-list-item",
14774
14783
  isOpen && "Layer__tasks-list-item__expanded"
14775
14784
  );
14776
- useEffect40(() => {
14785
+ useEffect41(() => {
14777
14786
  setIsOpen(defaultOpen);
14778
14787
  }, [defaultOpen]);
14779
- return /* @__PURE__ */ React166.createElement("div", { className: "Layer__tasks-list-item-wrapper" }, /* @__PURE__ */ React166.createElement("div", { className: taskItemClassName }, /* @__PURE__ */ React166.createElement(
14788
+ return /* @__PURE__ */ React165.createElement("div", { className: "Layer__tasks-list-item-wrapper" }, /* @__PURE__ */ React165.createElement("div", { className: taskItemClassName }, /* @__PURE__ */ React165.createElement(
14780
14789
  "div",
14781
14790
  {
14782
14791
  className: "Layer__tasks-list-item__head",
14783
14792
  onClick: () => setIsOpen(!isOpen)
14784
14793
  },
14785
- /* @__PURE__ */ React166.createElement("div", { className: taskHeadClassName }, /* @__PURE__ */ React166.createElement("div", { className: "Layer__tasks-list-item__head-info__status" }, isComplete(task.status) ? /* @__PURE__ */ React166.createElement(Check_default, { size: 12 }) : /* @__PURE__ */ React166.createElement(AlertCircle_default, { size: 12 })), /* @__PURE__ */ React166.createElement(Text, { size: "md" /* md */ }, task.title)),
14786
- /* @__PURE__ */ React166.createElement(
14794
+ /* @__PURE__ */ React165.createElement("div", { className: taskHeadClassName }, /* @__PURE__ */ React165.createElement("div", { className: "Layer__tasks-list-item__head-info__status" }, isComplete(task.status) ? /* @__PURE__ */ React165.createElement(Check_default, { size: 12 }) : /* @__PURE__ */ React165.createElement(AlertCircle_default, { size: 12 })), /* @__PURE__ */ React165.createElement(Text, { size: "md" /* md */ }, task.title)),
14795
+ /* @__PURE__ */ React165.createElement(
14787
14796
  ChevronDownFill_default,
14788
14797
  {
14789
14798
  size: 16,
@@ -14793,13 +14802,13 @@ var TasksListItem = ({
14793
14802
  }
14794
14803
  }
14795
14804
  )
14796
- ), /* @__PURE__ */ React166.createElement("div", { className: taskBodyClassName }, /* @__PURE__ */ React166.createElement("div", { className: "Layer__tasks-list-item__body-info" }, /* @__PURE__ */ React166.createElement(Text, { size: "sm" /* sm */ }, task.question), /* @__PURE__ */ React166.createElement(
14805
+ ), /* @__PURE__ */ React165.createElement("div", { className: taskBodyClassName }, /* @__PURE__ */ React165.createElement("div", { className: "Layer__tasks-list-item__body-info" }, /* @__PURE__ */ React165.createElement(Text, { size: "sm" /* sm */ }, task.question), /* @__PURE__ */ React165.createElement(
14797
14806
  Textarea,
14798
14807
  {
14799
14808
  value: userResponse,
14800
14809
  onChange: (e) => setUserResponse(e.target.value)
14801
14810
  }
14802
- ), /* @__PURE__ */ React166.createElement("div", { className: "Layer__tasks-list-item__actions" }, /* @__PURE__ */ React166.createElement(
14811
+ ), /* @__PURE__ */ React165.createElement("div", { className: "Layer__tasks-list-item__actions" }, /* @__PURE__ */ React165.createElement(
14803
14812
  Button,
14804
14813
  {
14805
14814
  disabled: userResponse.length === 0 || userResponse === task.user_response,
@@ -14823,14 +14832,14 @@ function paginateArray(array, chunkSize = 10) {
14823
14832
  }
14824
14833
  return result;
14825
14834
  }
14826
- var TasksEmptyState = () => /* @__PURE__ */ React167.createElement("div", { className: "Layer__tasks-empty-state" }, /* @__PURE__ */ React167.createElement("div", { className: "Layer__tasks-icon" }, /* @__PURE__ */ React167.createElement(SmileIcon_default, null)), /* @__PURE__ */ React167.createElement(Text, { size: "sm" /* sm */ }, "There are no pending tasks!", /* @__PURE__ */ React167.createElement("br", null), " Great job!"));
14835
+ var TasksEmptyState = () => /* @__PURE__ */ React166.createElement("div", { className: "Layer__tasks-empty-state" }, /* @__PURE__ */ React166.createElement("div", { className: "Layer__tasks-icon" }, /* @__PURE__ */ React166.createElement(SmileIcon_default, null)), /* @__PURE__ */ React166.createElement(Text, { size: "sm" /* sm */ }, "There are no pending tasks!", /* @__PURE__ */ React166.createElement("br", null), " Great job!"));
14827
14836
  var TasksList = ({ pageSize = 10 }) => {
14828
14837
  const { data: tasks, error } = useContext34(TasksContext);
14829
14838
  const firstPageWithIincompleteTasks = paginateArray(
14830
14839
  tasks || [],
14831
14840
  pageSize
14832
14841
  ).findIndex((page) => page.some((task) => !isComplete(task.status)));
14833
- const [currentPage, setCurrentPage] = useState50(
14842
+ const [currentPage, setCurrentPage] = useState49(
14834
14843
  firstPageWithIincompleteTasks === -1 ? 1 : firstPageWithIincompleteTasks + 1
14835
14844
  );
14836
14845
  const sortedTasks = useMemo18(() => {
@@ -14847,7 +14856,7 @@ var TasksList = ({ pageSize = 10 }) => {
14847
14856
  setCurrentPage(currentPage + 1);
14848
14857
  }
14849
14858
  };
14850
- return /* @__PURE__ */ React167.createElement("div", { className: "Layer__tasks-list" }, sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ React167.createElement(React167.Fragment, null, sortedTasks.map((task, index) => /* @__PURE__ */ React167.createElement(
14859
+ return /* @__PURE__ */ React166.createElement("div", { className: "Layer__tasks-list" }, sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ React166.createElement(React166.Fragment, null, sortedTasks.map((task, index) => /* @__PURE__ */ React166.createElement(
14851
14860
  TasksListItem,
14852
14861
  {
14853
14862
  key: task.id,
@@ -14855,7 +14864,7 @@ var TasksList = ({ pageSize = 10 }) => {
14855
14864
  goToNextPageIfAllComplete: goToNextPage,
14856
14865
  defaultOpen: index === indexFirstIncomplete
14857
14866
  }
14858
- )), tasks && tasks.length >= 10 && /* @__PURE__ */ React167.createElement("div", { className: "Layer__tasks__pagination" }, /* @__PURE__ */ React167.createElement(
14867
+ )), tasks && tasks.length >= 10 && /* @__PURE__ */ React166.createElement("div", { className: "Layer__tasks__pagination" }, /* @__PURE__ */ React166.createElement(
14859
14868
  Pagination,
14860
14869
  {
14861
14870
  currentPage,
@@ -14863,12 +14872,12 @@ var TasksList = ({ pageSize = 10 }) => {
14863
14872
  pageSize,
14864
14873
  onPageChange: (page) => setCurrentPage(page)
14865
14874
  }
14866
- ))) : /* @__PURE__ */ React167.createElement(React167.Fragment, null, error ? /* @__PURE__ */ React167.createElement(ErrorText, null, "Approval failed. Check connection and retry in few seconds.") : /* @__PURE__ */ React167.createElement(TasksEmptyState, null)));
14875
+ ))) : /* @__PURE__ */ React166.createElement(React166.Fragment, null, error ? /* @__PURE__ */ React166.createElement(ErrorText, null, "Approval failed. Check connection and retry in few seconds.") : /* @__PURE__ */ React166.createElement(TasksEmptyState, null)));
14867
14876
  };
14868
14877
 
14869
14878
  // src/components/TasksPending/TasksPending.tsx
14870
- import React168, { useContext as useContext35 } from "react";
14871
- import classNames57 from "classnames";
14879
+ import React167, { useContext as useContext35 } from "react";
14880
+ import classNames58 from "classnames";
14872
14881
  import { format as format6 } from "date-fns";
14873
14882
  import { Cell as Cell4, Pie as Pie3, PieChart as PieChart4 } from "recharts";
14874
14883
  var TasksPending = () => {
@@ -14884,10 +14893,10 @@ var TasksPending = () => {
14884
14893
  value: data?.filter((task) => !isComplete(task.status)).length
14885
14894
  }
14886
14895
  ];
14887
- const taskStatusClassName = classNames57(
14896
+ const taskStatusClassName = classNames58(
14888
14897
  completedTasks && completedTasks > 0 ? "Layer__tasks-pending-bar__status--done" : "Layer__tasks-pending-bar__status--pending"
14889
14898
  );
14890
- return /* @__PURE__ */ React168.createElement("div", { className: "Layer__tasks-pending" }, /* @__PURE__ */ React168.createElement(Text, { size: "lg" /* lg */ }, format6(Date.now(), "MMMM")), /* @__PURE__ */ React168.createElement("div", { className: "Layer__tasks-pending-bar" }, /* @__PURE__ */ React168.createElement(Text, { size: "sm" /* sm */ }, /* @__PURE__ */ React168.createElement("span", { className: taskStatusClassName }, completedTasks), "/", data?.length, " done"), /* @__PURE__ */ React168.createElement(PieChart4, { width: 24, height: 24, className: "mini-chart" }, /* @__PURE__ */ React168.createElement(
14899
+ return /* @__PURE__ */ React167.createElement("div", { className: "Layer__tasks-pending" }, /* @__PURE__ */ React167.createElement(Text, { size: "lg" /* lg */ }, format6(Date.now(), "MMMM")), /* @__PURE__ */ React167.createElement("div", { className: "Layer__tasks-pending-bar" }, /* @__PURE__ */ React167.createElement(Text, { size: "sm" /* sm */ }, /* @__PURE__ */ React167.createElement("span", { className: taskStatusClassName }, completedTasks), "/", data?.length, " done"), /* @__PURE__ */ React167.createElement(PieChart4, { width: 24, height: 24, className: "mini-chart" }, /* @__PURE__ */ React167.createElement(
14891
14900
  Pie3,
14892
14901
  {
14893
14902
  data: chartData,
@@ -14905,7 +14914,7 @@ var TasksPending = () => {
14905
14914
  animationEasing: "ease-in-out"
14906
14915
  },
14907
14916
  chartData.map((task, index) => {
14908
- return /* @__PURE__ */ React168.createElement(
14917
+ return /* @__PURE__ */ React167.createElement(
14909
14918
  Cell4,
14910
14919
  {
14911
14920
  key: `cell-${index}`,
@@ -14918,7 +14927,7 @@ var TasksPending = () => {
14918
14927
  };
14919
14928
 
14920
14929
  // src/components/Tasks/Tasks.tsx
14921
- import classNames58 from "classnames";
14930
+ import classNames59 from "classnames";
14922
14931
  var UseTasksContext = createContext14({
14923
14932
  data: void 0,
14924
14933
  isLoading: void 0,
@@ -14938,7 +14947,7 @@ var Tasks = ({
14938
14947
  // deprecated
14939
14948
  stringOverrides
14940
14949
  }) => {
14941
- return /* @__PURE__ */ React169.createElement(TasksProvider, null, /* @__PURE__ */ React169.createElement(
14950
+ return /* @__PURE__ */ React168.createElement(TasksProvider, null, /* @__PURE__ */ React168.createElement(
14942
14951
  TasksComponent,
14943
14952
  {
14944
14953
  collapsable,
@@ -14951,7 +14960,7 @@ var Tasks = ({
14951
14960
  };
14952
14961
  var TasksProvider = ({ children }) => {
14953
14962
  const contextData = useTasks();
14954
- return /* @__PURE__ */ React169.createElement(TasksContext.Provider, { value: contextData }, children);
14963
+ return /* @__PURE__ */ React168.createElement(TasksContext.Provider, { value: contextData }, children);
14955
14964
  };
14956
14965
  var TasksComponent = ({
14957
14966
  collapsable = false,
@@ -14971,15 +14980,15 @@ var TasksComponent = ({
14971
14980
  }
14972
14981
  return false;
14973
14982
  }, [data, isLoading]);
14974
- const [open, setOpen] = useState51(
14983
+ const [open, setOpen] = useState50(
14975
14984
  defaultCollapsed || collapsedWhenComplete ? false : true
14976
14985
  );
14977
- useEffect42(() => {
14986
+ useEffect43(() => {
14978
14987
  if (allComplete && open && collapsedWhenComplete && loadedStatus === "complete") {
14979
14988
  setOpen(false);
14980
14989
  }
14981
14990
  }, [allComplete]);
14982
- return /* @__PURE__ */ React169.createElement("div", { className: "Layer__tasks-component" }, /* @__PURE__ */ React169.createElement(
14991
+ return /* @__PURE__ */ React168.createElement("div", { className: "Layer__tasks-component" }, /* @__PURE__ */ React168.createElement(
14983
14992
  TasksHeader,
14984
14993
  {
14985
14994
  tasksHeader: stringOverrides?.header || tasksHeader,
@@ -14987,24 +14996,24 @@ var TasksComponent = ({
14987
14996
  open,
14988
14997
  toggleContent: () => setOpen(!open)
14989
14998
  }
14990
- ), /* @__PURE__ */ React169.createElement(
14999
+ ), /* @__PURE__ */ React168.createElement(
14991
15000
  "div",
14992
15001
  {
14993
- className: classNames58(
15002
+ className: classNames59(
14994
15003
  "Layer__tasks__content",
14995
15004
  !open && "Layer__tasks__content--collapsed"
14996
15005
  )
14997
15006
  },
14998
- isLoading || !data ? /* @__PURE__ */ React169.createElement("div", { className: "Layer__tasks__loader-container" }, /* @__PURE__ */ React169.createElement(Loader2, null)) : /* @__PURE__ */ React169.createElement(React169.Fragment, null, data.length > 0 && /* @__PURE__ */ React169.createElement(TasksPending, null), /* @__PURE__ */ React169.createElement(TasksList, null))
15007
+ isLoading || !data ? /* @__PURE__ */ React168.createElement("div", { className: "Layer__tasks__loader-container" }, /* @__PURE__ */ React168.createElement(Loader2, null)) : /* @__PURE__ */ React168.createElement(React168.Fragment, null, data.length > 0 && /* @__PURE__ */ React168.createElement(TasksPending, null), /* @__PURE__ */ React168.createElement(TasksList, null))
14999
15008
  ));
15000
15009
  };
15001
15010
 
15002
15011
  // src/components/UpsellBanner/BookkeepingUpsellBar.tsx
15003
- import React172 from "react";
15012
+ import React171 from "react";
15004
15013
 
15005
15014
  // src/icons/Coffee.tsx
15006
- import * as React170 from "react";
15007
- var CoffeeIcon = ({ size = 11, ...props }) => /* @__PURE__ */ React170.createElement(
15015
+ import * as React169 from "react";
15016
+ var CoffeeIcon = ({ size = 11, ...props }) => /* @__PURE__ */ React169.createElement(
15008
15017
  "svg",
15009
15018
  {
15010
15019
  xmlns: "http://www.w3.org/2000/svg",
@@ -15014,7 +15023,7 @@ var CoffeeIcon = ({ size = 11, ...props }) => /* @__PURE__ */ React170.createEle
15014
15023
  width: size,
15015
15024
  height: size
15016
15025
  },
15017
- /* @__PURE__ */ React170.createElement("g", { "clip-path": "url(#clip0_5018_10141)" }, /* @__PURE__ */ React170.createElement(
15026
+ /* @__PURE__ */ React169.createElement("g", { "clip-path": "url(#clip0_5018_10141)" }, /* @__PURE__ */ React169.createElement(
15018
15027
  "path",
15019
15028
  {
15020
15029
  d: "M3.25 4.16666H2.79167C2.30544 4.16666 1.83912 4.35981 1.4953 4.70363C1.15149 5.04744 0.958333 5.51376 0.958333 5.99999C0.958333 6.48622 1.15149 6.95254 1.4953 7.29635C1.83912 7.64017 2.30544 7.83332 2.79167 7.83332H3.25",
@@ -15022,7 +15031,7 @@ var CoffeeIcon = ({ size = 11, ...props }) => /* @__PURE__ */ React170.createEle
15022
15031
  strokeLinecap: "round",
15023
15032
  strokeLinejoin: "round"
15024
15033
  }
15025
- ), /* @__PURE__ */ React170.createElement(
15034
+ ), /* @__PURE__ */ React169.createElement(
15026
15035
  "path",
15027
15036
  {
15028
15037
  d: "M10.5834 4.16666H3.25004V8.29166C3.25004 8.77789 3.4432 9.2442 3.78701 9.58802C4.13083 9.93184 4.59714 10.125 5.08337 10.125H8.75004C9.23627 10.125 9.70259 9.93184 10.0464 9.58802C10.3902 9.2442 10.5834 8.77789 10.5834 8.29166V4.16666Z",
@@ -15030,7 +15039,7 @@ var CoffeeIcon = ({ size = 11, ...props }) => /* @__PURE__ */ React170.createEle
15030
15039
  strokeLinecap: "round",
15031
15040
  strokeLinejoin: "round"
15032
15041
  }
15033
- ), /* @__PURE__ */ React170.createElement(
15042
+ ), /* @__PURE__ */ React169.createElement(
15034
15043
  "path",
15035
15044
  {
15036
15045
  d: "M8.75 0.958344V2.33334",
@@ -15038,7 +15047,7 @@ var CoffeeIcon = ({ size = 11, ...props }) => /* @__PURE__ */ React170.createEle
15038
15047
  strokeLinecap: "round",
15039
15048
  strokeLinejoin: "round"
15040
15049
  }
15041
- ), /* @__PURE__ */ React170.createElement(
15050
+ ), /* @__PURE__ */ React169.createElement(
15042
15051
  "path",
15043
15052
  {
15044
15053
  d: "M6.91663 0.958344V2.33334",
@@ -15046,7 +15055,7 @@ var CoffeeIcon = ({ size = 11, ...props }) => /* @__PURE__ */ React170.createEle
15046
15055
  strokeLinecap: "round",
15047
15056
  strokeLinejoin: "round"
15048
15057
  }
15049
- ), /* @__PURE__ */ React170.createElement(
15058
+ ), /* @__PURE__ */ React169.createElement(
15050
15059
  "path",
15051
15060
  {
15052
15061
  d: "M5.08337 0.958344V2.33334",
@@ -15055,7 +15064,7 @@ var CoffeeIcon = ({ size = 11, ...props }) => /* @__PURE__ */ React170.createEle
15055
15064
  strokeLinejoin: "round"
15056
15065
  }
15057
15066
  )),
15058
- /* @__PURE__ */ React170.createElement("defs", null, /* @__PURE__ */ React170.createElement("clipPath", { id: "clip0_5018_10141" }, /* @__PURE__ */ React170.createElement(
15067
+ /* @__PURE__ */ React169.createElement("defs", null, /* @__PURE__ */ React169.createElement("clipPath", { id: "clip0_5018_10141" }, /* @__PURE__ */ React169.createElement(
15059
15068
  "rect",
15060
15069
  {
15061
15070
  width: "11",
@@ -15068,9 +15077,9 @@ var CoffeeIcon = ({ size = 11, ...props }) => /* @__PURE__ */ React170.createEle
15068
15077
  var Coffee_default = CoffeeIcon;
15069
15078
 
15070
15079
  // src/components/IconBox/IconBox.tsx
15071
- import React171 from "react";
15080
+ import React170 from "react";
15072
15081
  var IconBox = ({ children }) => {
15073
- return /* @__PURE__ */ React171.createElement("span", { className: "Layer__icon-box" }, children);
15082
+ return /* @__PURE__ */ React170.createElement("span", { className: "Layer__icon-box" }, children);
15074
15083
  };
15075
15084
 
15076
15085
  // src/components/UpsellBanner/BookkeepingUpsellBar.tsx
@@ -15078,35 +15087,35 @@ var BookkeepingUpsellBar = ({
15078
15087
  onClick,
15079
15088
  href
15080
15089
  }) => {
15081
- return /* @__PURE__ */ React172.createElement("div", { className: "Layer__bar-banner Layer__bar-banner--bookkeeping" }, /* @__PURE__ */ React172.createElement("div", { className: "Layer__bar-banner__left-col" }, /* @__PURE__ */ React172.createElement(IconBox, null, /* @__PURE__ */ React172.createElement(Coffee_default, null)), /* @__PURE__ */ React172.createElement("div", { className: "Layer__bar-banner__text-container" }, /* @__PURE__ */ React172.createElement(Text, { size: "md" /* md */, weight: "bold" /* bold */ }, "Need help with your books?"), /* @__PURE__ */ React172.createElement(
15090
+ return /* @__PURE__ */ React171.createElement("div", { className: "Layer__bar-banner Layer__bar-banner--bookkeeping" }, /* @__PURE__ */ React171.createElement("div", { className: "Layer__bar-banner__left-col" }, /* @__PURE__ */ React171.createElement(IconBox, null, /* @__PURE__ */ React171.createElement(Coffee_default, null)), /* @__PURE__ */ React171.createElement("div", { className: "Layer__bar-banner__text-container" }, /* @__PURE__ */ React171.createElement(Text, { size: "md" /* md */, weight: "bold" /* bold */ }, "Need help with your books?"), /* @__PURE__ */ React171.createElement(
15082
15091
  Text,
15083
15092
  {
15084
15093
  size: "sm" /* sm */,
15085
15094
  className: "Layer__bar-banner__text-container__desc"
15086
15095
  },
15087
15096
  "Order bookkeeping service supported by real humans."
15088
- ))), onClick ? /* @__PURE__ */ React172.createElement(Button, { variant: "secondary" /* secondary */, onClick }, "Schedule a demo") : href ? /* @__PURE__ */ React172.createElement(Link2, { href, target: "_blank", variant: "secondary" /* secondary */ }, "Schedule a demo") : null);
15097
+ ))), onClick ? /* @__PURE__ */ React171.createElement(Button, { variant: "secondary" /* secondary */, onClick }, "Schedule a demo") : href ? /* @__PURE__ */ React171.createElement(Link2, { href, target: "_blank", variant: "secondary" /* secondary */ }, "Schedule a demo") : null);
15089
15098
  };
15090
15099
 
15091
15100
  // src/views/BookkeepingOverview/BookkeepingOverview.tsx
15092
- import React173, { useState as useState52 } from "react";
15093
- import classNames59 from "classnames";
15101
+ import React172, { useState as useState51 } from "react";
15102
+ import classNames60 from "classnames";
15094
15103
  var BookkeepingOverview = ({
15095
15104
  title,
15096
15105
  // deprecated
15097
15106
  stringOverrides
15098
15107
  }) => {
15099
- const [pnlToggle, setPnlToggle] = useState52("expenses");
15108
+ const [pnlToggle, setPnlToggle] = useState51("expenses");
15100
15109
  const [width] = useWindowSize();
15101
- return /* @__PURE__ */ React173.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React173.createElement(TasksProvider, null, /* @__PURE__ */ React173.createElement(
15110
+ return /* @__PURE__ */ React172.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React172.createElement(TasksProvider, null, /* @__PURE__ */ React172.createElement(
15102
15111
  View,
15103
15112
  {
15104
15113
  viewClassName: "Layer__bookkeeping-overview--view",
15105
15114
  title: stringOverrides?.title || title || "Bookkeeping overview",
15106
15115
  withSidebar: width > 1100,
15107
- sidebar: /* @__PURE__ */ React173.createElement(TasksComponent, { stringOverrides: stringOverrides?.tasks })
15116
+ sidebar: /* @__PURE__ */ React172.createElement(TasksComponent, { stringOverrides: stringOverrides?.tasks })
15108
15117
  },
15109
- width <= 1100 && /* @__PURE__ */ React173.createElement(
15118
+ width <= 1100 && /* @__PURE__ */ React172.createElement(
15110
15119
  TasksComponent,
15111
15120
  {
15112
15121
  collapsable: true,
@@ -15114,23 +15123,23 @@ var BookkeepingOverview = ({
15114
15123
  stringOverrides: stringOverrides?.tasks
15115
15124
  }
15116
15125
  ),
15117
- /* @__PURE__ */ React173.createElement(
15126
+ /* @__PURE__ */ React172.createElement(
15118
15127
  Container,
15119
15128
  {
15120
15129
  name: "bookkeeping-overview-profit-and-loss",
15121
15130
  asWidget: true,
15122
15131
  elevated: true
15123
15132
  },
15124
- /* @__PURE__ */ React173.createElement(Header, null, /* @__PURE__ */ React173.createElement(Heading, { size: "secondary" /* secondary */ }, stringOverrides?.profitAndLoss?.header || "Profit & Loss"), /* @__PURE__ */ React173.createElement(ProfitAndLoss.DatePicker, null)),
15125
- /* @__PURE__ */ React173.createElement("div", { className: "Layer__bookkeeping-overview__summaries-row" }, /* @__PURE__ */ React173.createElement(
15133
+ /* @__PURE__ */ React172.createElement(Header, null, /* @__PURE__ */ React172.createElement(Heading, { size: "secondary" /* secondary */ }, stringOverrides?.profitAndLoss?.header || "Profit & Loss"), /* @__PURE__ */ React172.createElement(ProfitAndLoss.DatePicker, null)),
15134
+ /* @__PURE__ */ React172.createElement("div", { className: "Layer__bookkeeping-overview__summaries-row" }, /* @__PURE__ */ React172.createElement(
15126
15135
  ProfitAndLoss.Summaries,
15127
15136
  {
15128
15137
  stringOverrides: stringOverrides?.profitAndLoss?.summaries
15129
15138
  }
15130
15139
  )),
15131
- /* @__PURE__ */ React173.createElement(ProfitAndLoss.Chart, null)
15140
+ /* @__PURE__ */ React172.createElement(ProfitAndLoss.Chart, null)
15132
15141
  ),
15133
- /* @__PURE__ */ React173.createElement("div", { className: "Layer__bookkeeping-overview-profit-and-loss-charts" }, /* @__PURE__ */ React173.createElement(
15142
+ /* @__PURE__ */ React172.createElement("div", { className: "Layer__bookkeeping-overview-profit-and-loss-charts" }, /* @__PURE__ */ React172.createElement(
15134
15143
  Toggle,
15135
15144
  {
15136
15145
  name: "pnl-detailed-charts",
@@ -15147,15 +15156,15 @@ var BookkeepingOverview = ({
15147
15156
  selected: pnlToggle,
15148
15157
  onChange: (e) => setPnlToggle(e.target.value)
15149
15158
  }
15150
- ), /* @__PURE__ */ React173.createElement(
15159
+ ), /* @__PURE__ */ React172.createElement(
15151
15160
  Container,
15152
15161
  {
15153
- name: classNames59(
15162
+ name: classNames60(
15154
15163
  "bookkeeping-overview-profit-and-loss-chart",
15155
15164
  pnlToggle !== "revenue" && "bookkeeping-overview-profit-and-loss-chart--hidden"
15156
15165
  )
15157
15166
  },
15158
- /* @__PURE__ */ React173.createElement(
15167
+ /* @__PURE__ */ React172.createElement(
15159
15168
  ProfitAndLoss.DetailedCharts,
15160
15169
  {
15161
15170
  scope: "revenue",
@@ -15163,15 +15172,15 @@ var BookkeepingOverview = ({
15163
15172
  stringOverrides: stringOverrides?.profitAndLoss?.detailedCharts
15164
15173
  }
15165
15174
  )
15166
- ), /* @__PURE__ */ React173.createElement(
15175
+ ), /* @__PURE__ */ React172.createElement(
15167
15176
  Container,
15168
15177
  {
15169
- name: classNames59(
15178
+ name: classNames60(
15170
15179
  "bookkeeping-overview-profit-and-loss-chart",
15171
15180
  pnlToggle !== "expenses" && "bookkeeping-overview-profit-and-loss-chart--hidden"
15172
15181
  )
15173
15182
  },
15174
- /* @__PURE__ */ React173.createElement(
15183
+ /* @__PURE__ */ React172.createElement(
15175
15184
  ProfitAndLoss.DetailedCharts,
15176
15185
  {
15177
15186
  scope: "expenses",
@@ -15184,29 +15193,29 @@ var BookkeepingOverview = ({
15184
15193
  };
15185
15194
 
15186
15195
  // src/views/AccountingOverview/AccountingOverview.tsx
15187
- import React177, { useState as useState54 } from "react";
15196
+ import React176, { useState as useState53 } from "react";
15188
15197
 
15189
15198
  // src/components/TransactionToReviewCard/TransactionToReviewCard.tsx
15190
- import React176, { useContext as useContext37, useEffect as useEffect43, useState as useState53 } from "react";
15199
+ import React175, { useContext as useContext37, useEffect as useEffect44, useState as useState52 } from "react";
15191
15200
 
15192
15201
  // src/components/BadgeLoader/BadgeLoader.tsx
15193
- import React174 from "react";
15202
+ import React173 from "react";
15194
15203
  var BadgeLoader = ({ children }) => {
15195
- return /* @__PURE__ */ React174.createElement("span", { className: "Layer__loader Layer__loader--as-badge" }, /* @__PURE__ */ React174.createElement(Loader_default, { size: 11, className: "Layer__anim--rotating" }), children);
15204
+ return /* @__PURE__ */ React173.createElement("span", { className: "Layer__loader Layer__loader--as-badge" }, /* @__PURE__ */ React173.createElement(Loader_default, { size: 11, className: "Layer__anim--rotating" }), children);
15196
15205
  };
15197
15206
 
15198
15207
  // src/components/NotificationCard/NotificationCard.tsx
15199
- import React175 from "react";
15200
- import classNames60 from "classnames";
15208
+ import React174 from "react";
15209
+ import classNames61 from "classnames";
15201
15210
  var NotificationCard = ({
15202
15211
  onClick,
15203
15212
  children,
15204
15213
  className
15205
15214
  }) => {
15206
- return /* @__PURE__ */ React175.createElement("div", { className: classNames60("Layer__notification-card", className) }, /* @__PURE__ */ React175.createElement("div", { className: "Layer__notification-card__main" }, children), /* @__PURE__ */ React175.createElement(
15215
+ return /* @__PURE__ */ React174.createElement("div", { className: classNames61("Layer__notification-card", className) }, /* @__PURE__ */ React174.createElement("div", { className: "Layer__notification-card__main" }, children), /* @__PURE__ */ React174.createElement(
15207
15216
  IconButton,
15208
15217
  {
15209
- icon: /* @__PURE__ */ React175.createElement(ChevronRight_default, null),
15218
+ icon: /* @__PURE__ */ React174.createElement(ChevronRight_default, null),
15210
15219
  withBorder: true,
15211
15220
  onClick: () => onClick()
15212
15221
  }
@@ -15221,14 +15230,14 @@ var TransactionToReviewCard = ({
15221
15230
  }) => {
15222
15231
  const { dateRange: contextDateRange } = useContext37(ProfitAndLoss.Context);
15223
15232
  const dateRange = usePnlDateRange ? contextDateRange : void 0;
15224
- const [toReview, setToReview] = useState53(0);
15233
+ const [toReview, setToReview] = useState52(0);
15225
15234
  const { data, loaded, error, refetch } = useProfitAndLossLTM({
15226
15235
  currentDate: dateRange ? dateRange.startDate : startOfMonth14(/* @__PURE__ */ new Date())
15227
15236
  });
15228
- useEffect43(() => {
15237
+ useEffect44(() => {
15229
15238
  checkTransactionsToReview();
15230
15239
  }, []);
15231
- useEffect43(() => {
15240
+ useEffect44(() => {
15232
15241
  checkTransactionsToReview();
15233
15242
  }, [dateRange, loaded]);
15234
15243
  const checkTransactionsToReview = () => {
@@ -15241,40 +15250,40 @@ var TransactionToReviewCard = ({
15241
15250
  }
15242
15251
  }
15243
15252
  };
15244
- return /* @__PURE__ */ React176.createElement(
15253
+ return /* @__PURE__ */ React175.createElement(
15245
15254
  NotificationCard,
15246
15255
  {
15247
15256
  className: "Layer__txs-to-review",
15248
15257
  onClick: () => onClick && onClick()
15249
15258
  },
15250
- /* @__PURE__ */ React176.createElement(Text, { size: "sm" /* sm */ }, "Transactions to review"),
15251
- loaded === "initial" || loaded === "loading" ? /* @__PURE__ */ React176.createElement(BadgeLoader, null) : null,
15252
- loaded === "complete" && error ? /* @__PURE__ */ React176.createElement(
15259
+ /* @__PURE__ */ React175.createElement(Text, { size: "sm" /* sm */ }, "Transactions to review"),
15260
+ loaded === "initial" || loaded === "loading" ? /* @__PURE__ */ React175.createElement(BadgeLoader, null) : null,
15261
+ loaded === "complete" && error ? /* @__PURE__ */ React175.createElement(
15253
15262
  Badge,
15254
15263
  {
15255
15264
  variant: "error" /* ERROR */,
15256
15265
  size: "small" /* SMALL */,
15257
- icon: /* @__PURE__ */ React176.createElement(RefreshCcw_default, { size: 12 }),
15266
+ icon: /* @__PURE__ */ React175.createElement(RefreshCcw_default, { size: 12 }),
15258
15267
  onClick: () => refetch()
15259
15268
  },
15260
15269
  "Refresh"
15261
15270
  ) : null,
15262
- loaded === "complete" && !error && toReview > 0 ? /* @__PURE__ */ React176.createElement(
15271
+ loaded === "complete" && !error && toReview > 0 ? /* @__PURE__ */ React175.createElement(
15263
15272
  Badge,
15264
15273
  {
15265
15274
  variant: "warning" /* WARNING */,
15266
15275
  size: "small" /* SMALL */,
15267
- icon: /* @__PURE__ */ React176.createElement(Bell_default, { size: 12 })
15276
+ icon: /* @__PURE__ */ React175.createElement(Bell_default, { size: 12 })
15268
15277
  },
15269
15278
  toReview,
15270
15279
  " pending"
15271
15280
  ) : null,
15272
- loaded === "complete" && !error && toReview === 0 ? /* @__PURE__ */ React176.createElement(
15281
+ loaded === "complete" && !error && toReview === 0 ? /* @__PURE__ */ React175.createElement(
15273
15282
  Badge,
15274
15283
  {
15275
15284
  variant: "success" /* SUCCESS */,
15276
15285
  size: "small" /* SMALL */,
15277
- icon: /* @__PURE__ */ React176.createElement(Check_default, { size: 12 })
15286
+ icon: /* @__PURE__ */ React175.createElement(Check_default, { size: 12 })
15278
15287
  },
15279
15288
  "All done"
15280
15289
  ) : null
@@ -15282,7 +15291,7 @@ var TransactionToReviewCard = ({
15282
15291
  };
15283
15292
 
15284
15293
  // src/views/AccountingOverview/AccountingOverview.tsx
15285
- import classNames61 from "classnames";
15294
+ import classNames62 from "classnames";
15286
15295
  var AccountingOverview = ({
15287
15296
  title = "Accounting overview",
15288
15297
  enableOnboarding = false,
@@ -15291,33 +15300,33 @@ var AccountingOverview = ({
15291
15300
  chartColorsList,
15292
15301
  stringOverrides
15293
15302
  }) => {
15294
- const [pnlToggle, setPnlToggle] = useState54("expenses");
15295
- return /* @__PURE__ */ React177.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React177.createElement(View, { title, headerControls: /* @__PURE__ */ React177.createElement(ProfitAndLoss.DatePicker, null) }, enableOnboarding && /* @__PURE__ */ React177.createElement(
15303
+ const [pnlToggle, setPnlToggle] = useState53("expenses");
15304
+ return /* @__PURE__ */ React176.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React176.createElement(View, { title, headerControls: /* @__PURE__ */ React176.createElement(ProfitAndLoss.DatePicker, null) }, enableOnboarding && /* @__PURE__ */ React176.createElement(
15296
15305
  Onboarding,
15297
15306
  {
15298
15307
  onTransactionsToReviewClick
15299
15308
  }
15300
- ), /* @__PURE__ */ React177.createElement("div", { className: "Layer__accounting-overview__summaries-row" }, /* @__PURE__ */ React177.createElement(
15309
+ ), /* @__PURE__ */ React176.createElement("div", { className: "Layer__accounting-overview__summaries-row" }, /* @__PURE__ */ React176.createElement(
15301
15310
  ProfitAndLoss.Summaries,
15302
15311
  {
15303
15312
  stringOverrides: stringOverrides?.profitAndLoss?.summaries
15304
15313
  }
15305
- ), /* @__PURE__ */ React177.createElement(
15314
+ ), /* @__PURE__ */ React176.createElement(
15306
15315
  TransactionToReviewCard,
15307
15316
  {
15308
15317
  usePnlDateRange: true,
15309
15318
  onClick: onTransactionsToReviewClick
15310
15319
  }
15311
- )), /* @__PURE__ */ React177.createElement(
15320
+ )), /* @__PURE__ */ React176.createElement(
15312
15321
  Container,
15313
15322
  {
15314
15323
  name: "accounting-overview-profit-and-loss",
15315
15324
  asWidget: true,
15316
15325
  elevated: true
15317
15326
  },
15318
- /* @__PURE__ */ React177.createElement(Header, null, /* @__PURE__ */ React177.createElement(Heading, { size: "secondary" /* secondary */ }, stringOverrides?.header || "Profit & Loss")),
15319
- /* @__PURE__ */ React177.createElement(ProfitAndLoss.Chart, null)
15320
- ), middleBanner && /* @__PURE__ */ React177.createElement(Container, { name: "accounting-overview-middle-banner" }, middleBanner), /* @__PURE__ */ React177.createElement("div", { className: "Layer__accounting-overview-profit-and-loss-charts" }, /* @__PURE__ */ React177.createElement(
15327
+ /* @__PURE__ */ React176.createElement(Header, null, /* @__PURE__ */ React176.createElement(Heading, { size: "secondary" /* secondary */ }, stringOverrides?.header || "Profit & Loss")),
15328
+ /* @__PURE__ */ React176.createElement(ProfitAndLoss.Chart, null)
15329
+ ), middleBanner && /* @__PURE__ */ React176.createElement(Container, { name: "accounting-overview-middle-banner" }, middleBanner), /* @__PURE__ */ React176.createElement("div", { className: "Layer__accounting-overview-profit-and-loss-charts" }, /* @__PURE__ */ React176.createElement(
15321
15330
  Toggle,
15322
15331
  {
15323
15332
  name: "pnl-detailed-charts",
@@ -15334,15 +15343,15 @@ var AccountingOverview = ({
15334
15343
  selected: pnlToggle,
15335
15344
  onChange: (e) => setPnlToggle(e.target.value)
15336
15345
  }
15337
- ), /* @__PURE__ */ React177.createElement(
15346
+ ), /* @__PURE__ */ React176.createElement(
15338
15347
  Container,
15339
15348
  {
15340
- name: classNames61(
15349
+ name: classNames62(
15341
15350
  "accounting-overview-profit-and-loss-chart",
15342
15351
  pnlToggle !== "revenue" && "accounting-overview-profit-and-loss-chart--hidden"
15343
15352
  )
15344
15353
  },
15345
- /* @__PURE__ */ React177.createElement(
15354
+ /* @__PURE__ */ React176.createElement(
15346
15355
  ProfitAndLoss.DetailedCharts,
15347
15356
  {
15348
15357
  scope: "revenue",
@@ -15351,15 +15360,15 @@ var AccountingOverview = ({
15351
15360
  chartColorsList
15352
15361
  }
15353
15362
  )
15354
- ), /* @__PURE__ */ React177.createElement(
15363
+ ), /* @__PURE__ */ React176.createElement(
15355
15364
  Container,
15356
15365
  {
15357
- name: classNames61(
15366
+ name: classNames62(
15358
15367
  "accounting-overview-profit-and-loss-chart",
15359
15368
  pnlToggle !== "expenses" && "accounting-overview-profit-and-loss-chart--hidden"
15360
15369
  )
15361
15370
  },
15362
- /* @__PURE__ */ React177.createElement(
15371
+ /* @__PURE__ */ React176.createElement(
15363
15372
  ProfitAndLoss.DetailedCharts,
15364
15373
  {
15365
15374
  scope: "expenses",
@@ -15372,7 +15381,7 @@ var AccountingOverview = ({
15372
15381
  };
15373
15382
 
15374
15383
  // src/views/BankTransactionsWithLinkedAccounts/BankTransactionsWithLinkedAccounts.tsx
15375
- import React178 from "react";
15384
+ import React177 from "react";
15376
15385
  var BankTransactionsWithLinkedAccounts = ({
15377
15386
  title,
15378
15387
  // deprecated
@@ -15386,7 +15395,7 @@ var BankTransactionsWithLinkedAccounts = ({
15386
15395
  mobileComponent,
15387
15396
  stringOverrides
15388
15397
  }) => {
15389
- return /* @__PURE__ */ React178.createElement(View, { title: stringOverrides?.title || title || "Bank transactions" }, /* @__PURE__ */ React178.createElement(
15398
+ return /* @__PURE__ */ React177.createElement(View, { title: stringOverrides?.title || title || "Bank transactions" }, /* @__PURE__ */ React177.createElement(
15390
15399
  LinkedAccounts,
15391
15400
  {
15392
15401
  elevated: elevatedLinkedAccounts,
@@ -15395,7 +15404,7 @@ var BankTransactionsWithLinkedAccounts = ({
15395
15404
  showBreakConnection,
15396
15405
  stringOverrides: stringOverrides?.linkedAccounts
15397
15406
  }
15398
- ), /* @__PURE__ */ React178.createElement(
15407
+ ), /* @__PURE__ */ React177.createElement(
15399
15408
  BankTransactions,
15400
15409
  {
15401
15410
  asWidget: true,
@@ -15409,14 +15418,14 @@ var BankTransactionsWithLinkedAccounts = ({
15409
15418
  };
15410
15419
 
15411
15420
  // src/views/GeneralLedger/GeneralLedger.tsx
15412
- import React179, { useState as useState55 } from "react";
15421
+ import React178, { useState as useState54 } from "react";
15413
15422
  var GeneralLedgerView = ({
15414
15423
  title,
15415
15424
  // deprecated
15416
15425
  stringOverrides
15417
15426
  }) => {
15418
- const [activeTab, setActiveTab] = useState55("chartOfAccounts");
15419
- return /* @__PURE__ */ React179.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React179.createElement(View, { title: stringOverrides?.title || title || "General Ledger" }, /* @__PURE__ */ React179.createElement(
15427
+ const [activeTab, setActiveTab] = useState54("chartOfAccounts");
15428
+ return /* @__PURE__ */ React178.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React178.createElement(View, { title: stringOverrides?.title || title || "General Ledger" }, /* @__PURE__ */ React178.createElement(
15420
15429
  Toggle,
15421
15430
  {
15422
15431
  name: "general-ledger-tabs",
@@ -15433,24 +15442,24 @@ var GeneralLedgerView = ({
15433
15442
  selected: activeTab,
15434
15443
  onChange: (opt) => setActiveTab(opt.target.value)
15435
15444
  }
15436
- ), /* @__PURE__ */ React179.createElement(Container, { name: "generalLedger" }, activeTab === "chartOfAccounts" ? /* @__PURE__ */ React179.createElement(
15445
+ ), /* @__PURE__ */ React178.createElement(Container, { name: "generalLedger" }, activeTab === "chartOfAccounts" ? /* @__PURE__ */ React178.createElement(
15437
15446
  ChartOfAccounts,
15438
15447
  {
15439
15448
  asWidget: true,
15440
15449
  withExpandAllButton: true,
15441
15450
  stringOverrides: stringOverrides?.chartOfAccounts
15442
15451
  }
15443
- ) : /* @__PURE__ */ React179.createElement(Journal, { stringOverrides: stringOverrides?.journal }))));
15452
+ ) : /* @__PURE__ */ React178.createElement(Journal, { stringOverrides: stringOverrides?.journal }))));
15444
15453
  };
15445
15454
 
15446
15455
  // src/views/Reports/Reports.tsx
15447
- import React180, { useContext as useContext38, useRef as useRef16, useState as useState56 } from "react";
15456
+ import React179, { useContext as useContext38, useRef as useRef16, useState as useState55 } from "react";
15448
15457
  var DownloadButton2 = ({
15449
15458
  stringOverrides
15450
15459
  }) => {
15451
15460
  const { dateRange } = useContext38(ProfitAndLoss.Context);
15452
15461
  const { auth, businessId, apiUrl } = useLayerContext();
15453
- const [requestFailed, setRequestFailed] = useState56(false);
15462
+ const [requestFailed, setRequestFailed] = useState55(false);
15454
15463
  const handleClick = async () => {
15455
15464
  const month = (dateRange.startDate.getMonth() + 1).toString();
15456
15465
  const year = dateRange.startDate.getFullYear().toString();
@@ -15477,7 +15486,7 @@ var DownloadButton2 = ({
15477
15486
  setRequestFailed(true);
15478
15487
  }
15479
15488
  };
15480
- return requestFailed ? /* @__PURE__ */ React180.createElement(
15489
+ return requestFailed ? /* @__PURE__ */ React179.createElement(
15481
15490
  RetryButton,
15482
15491
  {
15483
15492
  onClick: handleClick,
@@ -15485,11 +15494,11 @@ var DownloadButton2 = ({
15485
15494
  error: "Approval failed. Check connection and retry in few seconds."
15486
15495
  },
15487
15496
  stringOverrides?.retryButtonText || "Retry"
15488
- ) : /* @__PURE__ */ React180.createElement(
15497
+ ) : /* @__PURE__ */ React179.createElement(
15489
15498
  Button,
15490
15499
  {
15491
15500
  variant: "secondary" /* secondary */,
15492
- rightIcon: /* @__PURE__ */ React180.createElement(DownloadCloud_default, { size: 12 }),
15501
+ rightIcon: /* @__PURE__ */ React179.createElement(DownloadCloud_default, { size: 12 }),
15493
15502
  onClick: handleClick
15494
15503
  },
15495
15504
  stringOverrides?.downloadButtonText || "Download"
@@ -15517,10 +15526,10 @@ var Reports = ({
15517
15526
  enabledReports = ["profitAndLoss", "balanceSheet", "statementOfCashFlow"]
15518
15527
  }) => {
15519
15528
  const containerRef = useRef16(null);
15520
- const [activeTab, setActiveTab] = useState56(enabledReports[0]);
15529
+ const [activeTab, setActiveTab] = useState55(enabledReports[0]);
15521
15530
  const options = getOptions(enabledReports);
15522
15531
  const defaultTitle = enabledReports.length > 1 ? "Reports" : options.find((option) => option.value = enabledReports[0])?.label;
15523
- return /* @__PURE__ */ React180.createElement(View, { title: stringOverrides?.title || title || defaultTitle }, enabledReports.length > 1 && /* @__PURE__ */ React180.createElement("div", { className: "Layer__component Layer__header__actions" }, /* @__PURE__ */ React180.createElement(
15532
+ return /* @__PURE__ */ React179.createElement(View, { title: stringOverrides?.title || title || defaultTitle }, enabledReports.length > 1 && /* @__PURE__ */ React179.createElement("div", { className: "Layer__component Layer__header__actions" }, /* @__PURE__ */ React179.createElement(
15524
15533
  Toggle,
15525
15534
  {
15526
15535
  name: "reports-tabs",
@@ -15528,7 +15537,7 @@ var Reports = ({
15528
15537
  selected: activeTab,
15529
15538
  onChange: (opt) => setActiveTab(opt.target.value)
15530
15539
  }
15531
- )), /* @__PURE__ */ React180.createElement(Container, { name: "reports", ref: containerRef }, /* @__PURE__ */ React180.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React180.createElement(
15540
+ )), /* @__PURE__ */ React179.createElement(Container, { name: "reports", ref: containerRef }, /* @__PURE__ */ React179.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React179.createElement(
15532
15541
  ReportsPanel,
15533
15542
  {
15534
15543
  containerRef,
@@ -15543,21 +15552,21 @@ var ReportsPanel = ({
15543
15552
  stringOverrides
15544
15553
  }) => {
15545
15554
  const { sidebarScope } = useContext38(ProfitAndLoss.Context);
15546
- return /* @__PURE__ */ React180.createElement(React180.Fragment, null, openReport === "profitAndLoss" && /* @__PURE__ */ React180.createElement(
15555
+ return /* @__PURE__ */ React179.createElement(React179.Fragment, null, openReport === "profitAndLoss" && /* @__PURE__ */ React179.createElement(TableProvider, null, /* @__PURE__ */ React179.createElement(
15547
15556
  View,
15548
15557
  {
15549
15558
  type: "panel",
15550
- headerControls: /* @__PURE__ */ React180.createElement(React180.Fragment, null, /* @__PURE__ */ React180.createElement(ProfitAndLoss.DatePicker, null), /* @__PURE__ */ React180.createElement(
15559
+ headerControls: /* @__PURE__ */ React179.createElement(React179.Fragment, null, /* @__PURE__ */ React179.createElement(ProfitAndLoss.DatePicker, null), /* @__PURE__ */ React179.createElement(
15551
15560
  DownloadButton2,
15552
15561
  {
15553
15562
  stringOverrides: stringOverrides?.downloadButton
15554
15563
  }
15555
15564
  ))
15556
15565
  },
15557
- /* @__PURE__ */ React180.createElement(
15566
+ /* @__PURE__ */ React179.createElement(
15558
15567
  Panel,
15559
15568
  {
15560
- sidebar: /* @__PURE__ */ React180.createElement(
15569
+ sidebar: /* @__PURE__ */ React179.createElement(
15561
15570
  ProfitAndLoss.DetailedCharts,
15562
15571
  {
15563
15572
  showDatePicker: false,
@@ -15567,7 +15576,7 @@ var ReportsPanel = ({
15567
15576
  sidebarIsOpen: Boolean(sidebarScope),
15568
15577
  parentRef: containerRef
15569
15578
  },
15570
- /* @__PURE__ */ React180.createElement(
15579
+ /* @__PURE__ */ React179.createElement(
15571
15580
  ProfitAndLoss.Table,
15572
15581
  {
15573
15582
  asContainer: false,
@@ -15575,7 +15584,7 @@ var ReportsPanel = ({
15575
15584
  }
15576
15585
  )
15577
15586
  )
15578
- ), openReport === "balanceSheet" && /* @__PURE__ */ React180.createElement(BalanceSheet, { stringOverrides: stringOverrides?.balanceSheet }), openReport === "statementOfCashFlow" && /* @__PURE__ */ React180.createElement(
15587
+ )), openReport === "balanceSheet" && /* @__PURE__ */ React179.createElement(BalanceSheet, { stringOverrides: stringOverrides?.balanceSheet }), openReport === "statementOfCashFlow" && /* @__PURE__ */ React179.createElement(
15579
15588
  StatementOfCashFlow,
15580
15589
  {
15581
15590
  stringOverrides: stringOverrides?.statementOfCashflow
@@ -15584,11 +15593,11 @@ var ReportsPanel = ({
15584
15593
  };
15585
15594
 
15586
15595
  // src/components/ProfitAndLossView/ProfitAndLossView.tsx
15587
- import React181, { useContext as useContext39, useRef as useRef17 } from "react";
15596
+ import React180, { useContext as useContext39, useRef as useRef17 } from "react";
15588
15597
  var COMPONENT_NAME7 = "profit-and-loss";
15589
15598
  var ProfitAndLossView = (props) => {
15590
15599
  const containerRef = useRef17(null);
15591
- return /* @__PURE__ */ React181.createElement(Container, { name: COMPONENT_NAME7, ref: containerRef }, /* @__PURE__ */ React181.createElement(ProfitAndLoss, null, /* @__PURE__ */ React181.createElement(ProfitAndLossPanel, { containerRef, ...props })));
15600
+ return /* @__PURE__ */ React180.createElement(Container, { name: COMPONENT_NAME7, ref: containerRef }, /* @__PURE__ */ React180.createElement(ProfitAndLoss, null, /* @__PURE__ */ React180.createElement(ProfitAndLossPanel, { containerRef, ...props })));
15592
15601
  };
15593
15602
  var ProfitAndLossPanel = ({
15594
15603
  containerRef,
@@ -15596,10 +15605,10 @@ var ProfitAndLossPanel = ({
15596
15605
  ...props
15597
15606
  }) => {
15598
15607
  const { sidebarScope } = useContext39(ProfitAndLoss.Context);
15599
- return /* @__PURE__ */ React181.createElement(
15608
+ return /* @__PURE__ */ React180.createElement(
15600
15609
  Panel,
15601
15610
  {
15602
- sidebar: /* @__PURE__ */ React181.createElement(
15611
+ sidebar: /* @__PURE__ */ React180.createElement(
15603
15612
  ProfitAndLossDetailedCharts,
15604
15613
  {
15605
15614
  stringOverrides: stringOverrides?.profitAndLossDetailedCharts
@@ -15608,8 +15617,8 @@ var ProfitAndLossPanel = ({
15608
15617
  sidebarIsOpen: Boolean(sidebarScope),
15609
15618
  parentRef: containerRef
15610
15619
  },
15611
- /* @__PURE__ */ React181.createElement(Header, { className: `Layer__${COMPONENT_NAME7}__header` }, /* @__PURE__ */ React181.createElement(Heading, { className: "Layer__profit-and-loss__title" }, stringOverrides?.header || "Profit & Loss")),
15612
- /* @__PURE__ */ React181.createElement(Components, { stringOverrides, ...props })
15620
+ /* @__PURE__ */ React180.createElement(Header, { className: `Layer__${COMPONENT_NAME7}__header` }, /* @__PURE__ */ React180.createElement(Heading, { className: "Layer__profit-and-loss__title" }, stringOverrides?.header || "Profit & Loss")),
15621
+ /* @__PURE__ */ React180.createElement(Components, { stringOverrides, ...props })
15613
15622
  );
15614
15623
  };
15615
15624
  var Components = ({
@@ -15621,7 +15630,7 @@ var Components = ({
15621
15630
  ProfitAndLoss.Context
15622
15631
  );
15623
15632
  if (!isLoading && error) {
15624
- return /* @__PURE__ */ React181.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React181.createElement(
15633
+ return /* @__PURE__ */ React180.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React180.createElement(
15625
15634
  DataState,
15626
15635
  {
15627
15636
  status: "failed" /* failed */,
@@ -15632,13 +15641,13 @@ var Components = ({
15632
15641
  }
15633
15642
  ));
15634
15643
  }
15635
- return /* @__PURE__ */ React181.createElement(React181.Fragment, null, !hideChart && /* @__PURE__ */ React181.createElement("div", { className: `Layer__${COMPONENT_NAME7}__chart_with_summaries` }, /* @__PURE__ */ React181.createElement(
15644
+ return /* @__PURE__ */ React180.createElement(React180.Fragment, null, !hideChart && /* @__PURE__ */ React180.createElement("div", { className: `Layer__${COMPONENT_NAME7}__chart_with_summaries` }, /* @__PURE__ */ React180.createElement(
15636
15645
  "div",
15637
15646
  {
15638
15647
  className: `Layer__${COMPONENT_NAME7}__chart_with_summaries__summary-col`
15639
15648
  },
15640
- /* @__PURE__ */ React181.createElement(ProfitAndLoss.DatePicker, null),
15641
- /* @__PURE__ */ React181.createElement(
15649
+ /* @__PURE__ */ React180.createElement(ProfitAndLoss.DatePicker, null),
15650
+ /* @__PURE__ */ React180.createElement(
15642
15651
  ProfitAndLoss.Summaries,
15643
15652
  {
15644
15653
  vertical: true,
@@ -15646,18 +15655,18 @@ var Components = ({
15646
15655
  stringOverrides: stringOverrides?.profitAndLossSummaries
15647
15656
  }
15648
15657
  )
15649
- ), /* @__PURE__ */ React181.createElement(
15658
+ ), /* @__PURE__ */ React180.createElement(
15650
15659
  "div",
15651
15660
  {
15652
15661
  className: `Layer__${COMPONENT_NAME7}__chart_with_summaries__chart-col`
15653
15662
  },
15654
- /* @__PURE__ */ React181.createElement(ProfitAndLoss.Chart, null)
15655
- )), !hideTable && /* @__PURE__ */ React181.createElement(
15663
+ /* @__PURE__ */ React180.createElement(ProfitAndLoss.Chart, null)
15664
+ )), !hideTable && /* @__PURE__ */ React180.createElement(TableProvider, null, /* @__PURE__ */ React180.createElement(
15656
15665
  ProfitAndLoss.Table,
15657
15666
  {
15658
15667
  stringOverrides: stringOverrides?.profitAndLossTable
15659
15668
  }
15660
- ));
15669
+ )));
15661
15670
  };
15662
15671
  export {
15663
15672
  AccountingOverview,