@layerfi/components 0.1.114-alpha → 0.1.114-alpha.2

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.
@@ -69,6 +69,7 @@ const useSWRMutation = require("swr/mutation");
69
69
  const reactAriaComponents = require("react-aria-components");
70
70
  const useResizeObserver = require("@react-hook/resize-observer");
71
71
  const lucideReact = require("lucide-react");
72
+ const react$2 = require("motion/react");
72
73
  const CurrencyInput = require("react-currency-input-field");
73
74
  const Select$1 = require("react-select");
74
75
  const uuid = require("uuid");
@@ -110,7 +111,7 @@ const LinkedAccountsContext = react.createContext({
110
111
  setAccountsToAddOpeningBalanceInModal: () => {
111
112
  }
112
113
  });
113
- const version = "0.1.114-alpha";
114
+ const version = "0.1.114-alpha.2";
114
115
  const pkg = {
115
116
  version
116
117
  };
@@ -1766,25 +1767,17 @@ function clampToPresentOrPast(date2, cutoff = dateFns.endOfDay(/* @__PURE__ */ n
1766
1767
  return dateFns.min([date2, cutoff]);
1767
1768
  }
1768
1769
  const RANGE_MODE_LOOKUP = {
1769
- dayPicker: {
1770
+ date: {
1770
1771
  getStartDate: ({ startDate }) => dateFns.startOfMonth(startDate),
1771
1772
  getEndDate: ({ endDate }) => clampToPresentOrPast(dateFns.endOfDay(endDate))
1772
1773
  },
1773
- dayRangePicker: {
1774
+ full: {
1774
1775
  getStartDate: ({ startDate }) => startDate,
1775
1776
  getEndDate: ({ endDate }) => clampToPresentOrPast(dateFns.endOfDay(endDate))
1776
1777
  },
1777
- monthPicker: {
1778
+ month: {
1778
1779
  getStartDate: ({ startDate }) => dateFns.startOfMonth(startDate),
1779
1780
  getEndDate: ({ endDate }) => clampToPresentOrPast(dateFns.endOfMonth(endDate))
1780
- },
1781
- monthRangePicker: {
1782
- getStartDate: ({ startDate }) => dateFns.startOfMonth(startDate),
1783
- getEndDate: ({ endDate }) => clampToPresentOrPast(dateFns.endOfMonth(endDate))
1784
- },
1785
- yearPicker: {
1786
- getStartDate: ({ startDate }) => dateFns.startOfYear(startDate),
1787
- getEndDate: ({ endDate }) => clampToPresentOrPast(dateFns.endOfYear(endDate))
1788
1781
  }
1789
1782
  };
1790
1783
  function withCorrectedRange(fn) {
@@ -1804,28 +1797,18 @@ function buildStore$2() {
1804
1797
  return next;
1805
1798
  };
1806
1799
  const setDate = ({ date: date2 }) => {
1807
- const s = RANGE_MODE_LOOKUP.dayPicker.getStartDate({ startDate: date2 });
1808
- const e = RANGE_MODE_LOOKUP.dayPicker.getEndDate({ endDate: date2 });
1800
+ const s = RANGE_MODE_LOOKUP.date.getStartDate({ startDate: date2 });
1801
+ const e = RANGE_MODE_LOOKUP.date.getEndDate({ endDate: date2 });
1809
1802
  return apply2({ startDate: s, endDate: e });
1810
1803
  };
1811
1804
  const setDateRange = withCorrectedRange(({ startDate, endDate }) => {
1812
- const s = RANGE_MODE_LOOKUP.dayRangePicker.getStartDate({ startDate });
1813
- const e = RANGE_MODE_LOOKUP.dayRangePicker.getEndDate({ endDate });
1805
+ const s = RANGE_MODE_LOOKUP.full.getStartDate({ startDate });
1806
+ const e = RANGE_MODE_LOOKUP.full.getEndDate({ endDate });
1814
1807
  return apply2({ startDate: s, endDate: e });
1815
1808
  });
1816
1809
  const setMonth = ({ startDate }) => {
1817
- const s = RANGE_MODE_LOOKUP.monthPicker.getStartDate({ startDate });
1818
- const e = RANGE_MODE_LOOKUP.monthPicker.getEndDate({ endDate: startDate });
1819
- return apply2({ startDate: s, endDate: e });
1820
- };
1821
- const setMonthRange = withCorrectedRange(({ startDate, endDate }) => {
1822
- const s = RANGE_MODE_LOOKUP.monthRangePicker.getStartDate({ startDate });
1823
- const e = RANGE_MODE_LOOKUP.monthRangePicker.getEndDate({ endDate });
1824
- return apply2({ startDate: s, endDate: e });
1825
- });
1826
- const setYear = ({ startDate }) => {
1827
- const s = RANGE_MODE_LOOKUP.yearPicker.getStartDate({ startDate });
1828
- const e = RANGE_MODE_LOOKUP.yearPicker.getEndDate({ endDate: startDate });
1810
+ const s = RANGE_MODE_LOOKUP.month.getStartDate({ startDate });
1811
+ const e = RANGE_MODE_LOOKUP.month.getEndDate({ endDate: startDate });
1829
1812
  return apply2({ startDate: s, endDate: e });
1830
1813
  };
1831
1814
  const setRangeWithExplicitDisplayMode = ({
@@ -1834,16 +1817,12 @@ function buildStore$2() {
1834
1817
  displayMode
1835
1818
  }) => {
1836
1819
  switch (displayMode) {
1837
- case "dayPicker":
1820
+ case "date":
1838
1821
  return setDate({ date: endDate });
1839
- case "dayRangePicker":
1822
+ case "full":
1840
1823
  return setDateRange({ startDate, endDate });
1841
- case "monthPicker":
1824
+ case "month":
1842
1825
  return setMonth({ startDate });
1843
- case "monthRangePicker":
1844
- return setMonthRange({ startDate, endDate });
1845
- case "yearPicker":
1846
- return setYear({ startDate });
1847
1826
  default:
1848
1827
  unsafeAssertUnreachable({
1849
1828
  message: "Invalid `displayMode`"
@@ -1858,8 +1837,6 @@ function buildStore$2() {
1858
1837
  setRangeWithExplicitDisplayMode,
1859
1838
  setDateRange,
1860
1839
  setMonth,
1861
- setMonthRange,
1862
- setYear,
1863
1840
  setMonthByPeriod: ({ monthNumber, yearNumber }) => {
1864
1841
  const effectiveMonthNumber = Math.min(Math.max(monthNumber, 1), 12);
1865
1842
  return setMonth({ startDate: new Date(yearNumber, effectiveMonthNumber - 1, 1) });
@@ -1906,14 +1883,10 @@ function useGlobalDateRangeActions() {
1906
1883
  );
1907
1884
  const setDateRange = zustand.useStore(store, ({ actions: { setDateRange: setDateRange2 } }) => setDateRange2);
1908
1885
  const setMonth = zustand.useStore(store, ({ actions: { setMonth: setMonth2 } }) => setMonth2);
1909
- const setMonthRange = zustand.useStore(store, ({ actions: { setMonthRange: setMonthRange2 } }) => setMonthRange2);
1910
- const setYear = zustand.useStore(store, ({ actions: { setYear: setYear2 } }) => setYear2);
1911
1886
  return {
1912
1887
  setRangeWithExplicitDisplayMode,
1913
1888
  setDateRange,
1914
- setMonth,
1915
- setMonthRange,
1916
- setYear
1889
+ setMonth
1917
1890
  };
1918
1891
  }
1919
1892
  function useGlobalDatePeriodAlignedActions() {
@@ -1929,7 +1902,7 @@ function GlobalDateStoreProvider({
1929
1902
  }
1930
1903
  const useBankTransactionsFilters = (params) => {
1931
1904
  const dateFilterMode = (params == null ? void 0 : params.applyGlobalDateRange) ? BankTransactionsDateFilterMode.GlobalDateRange : (params == null ? void 0 : params.monthlyView) ? BankTransactionsDateFilterMode.MonthlyView : void 0;
1932
- const globalDateRange = useGlobalDateRange({ displayMode: "monthPicker" });
1905
+ const globalDateRange = useGlobalDateRange({ displayMode: "full" });
1933
1906
  const defaultDateRange = {
1934
1907
  startDate: dateFns.startOfMonth(/* @__PURE__ */ new Date()),
1935
1908
  endDate: dateFns.endOfMonth(/* @__PURE__ */ new Date())
@@ -6209,7 +6182,7 @@ const ProfitAndLossReportSchema = effect.Schema.Struct({
6209
6182
  expenses: LineItemSchema,
6210
6183
  taxes: LineItemSchema,
6211
6184
  customLineItems: effect.pipe(
6212
- effect.Schema.propertySignature(effect.Schema.NullOr(LineItemSchema)),
6185
+ effect.Schema.propertySignature(effect.Schema.NullishOr(effect.Schema.Array(LineItemSchema))),
6213
6186
  effect.Schema.fromKey("custom_line_items")
6214
6187
  ),
6215
6188
  otherOutflows: effect.pipe(
@@ -7332,6 +7305,10 @@ const getBankTransactionMatchAsSuggestedMatch = (bankTransaction) => {
7332
7305
  }
7333
7306
  return void 0;
7334
7307
  };
7308
+ const getBankTransactionFirstSuggestedMatch = (bankTransaction) => {
7309
+ var _a, _b;
7310
+ return (_b = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) != null ? _b : (_a = bankTransaction == null ? void 0 : bankTransaction.suggested_matches) == null ? void 0 : _a[0];
7311
+ };
7335
7312
  const IconButton = (_y) => {
7336
7313
  var _z = _y, {
7337
7314
  className,
@@ -9011,11 +8988,59 @@ const SubmitButton = (_ba) => {
9011
8988
  })
9012
8989
  );
9013
8990
  };
8991
+ const variants = {
8992
+ fade: {
8993
+ initial: { opacity: 0 },
8994
+ animate: { opacity: 1 },
8995
+ exit: { opacity: 0 },
8996
+ transition: { duration: 0.3, ease: [0, 0, 0.58, 1] }
8997
+ },
8998
+ slideUp: {
8999
+ initial: { y: "100%" },
9000
+ animate: { y: 0 },
9001
+ exit: { y: "100%" },
9002
+ transition: { duration: 0.35, ease: [0.4, 0, 0.2, 1] }
9003
+ },
9004
+ expand: {
9005
+ initial: { height: 0, opacity: 0 },
9006
+ animate: { height: "auto", opacity: 1 },
9007
+ exit: { height: 0, opacity: 0 },
9008
+ transition: {
9009
+ height: { duration: 0.25, ease: [0.4, 0, 0.2, 1] },
9010
+ opacity: { duration: 0.15, ease: [0, 0, 0.58, 1] }
9011
+ }
9012
+ }
9013
+ };
9014
+ const AnimatedContent = (_da) => {
9015
+ var _ea = _da, {
9016
+ children,
9017
+ variant,
9018
+ isOpen,
9019
+ slotProps = { AnimatePresence: { initial: false } }
9020
+ } = _ea, props = __objRest(_ea, [
9021
+ "children",
9022
+ "variant",
9023
+ "isOpen",
9024
+ "slotProps"
9025
+ ]);
9026
+ const config = variants[variant];
9027
+ return /* @__PURE__ */ jsxRuntime.jsx(react$2.AnimatePresence, __spreadProps(__spreadValues({}, slotProps.AnimatePresence), { children: isOpen && /* @__PURE__ */ jsxRuntime.jsx(
9028
+ react$2.motion.div,
9029
+ __spreadProps(__spreadValues({
9030
+ initial: config.initial,
9031
+ animate: config.animate,
9032
+ exit: config.exit,
9033
+ transition: config.transition
9034
+ }, props), {
9035
+ children
9036
+ })
9037
+ ) }));
9038
+ };
9014
9039
  const BASE_MODAL_OVERLAY_CLASS_NAME = "Layer__ModalOverlay";
9015
9040
  const MODAL_OVERLAY_CLASS_NAME = `Layer__Portal ${BASE_MODAL_OVERLAY_CLASS_NAME}`;
9016
9041
  const ModalOverlay = react.forwardRef(
9017
- (_da, ref) => {
9018
- var _ea = _da, { variant } = _ea, restProps = __objRest(_ea, ["variant"]);
9042
+ (_fa, ref) => {
9043
+ var _ga = _fa, { variant } = _ga, restProps = __objRest(_ga, ["variant"]);
9019
9044
  const dataProperties = toDataProperties({ variant });
9020
9045
  return /* @__PURE__ */ jsxRuntime.jsx(
9021
9046
  reactAriaComponents.ModalOverlay,
@@ -9042,8 +9067,8 @@ const InternalModal = react.forwardRef(({ children, flexBlock, flexInline, size,
9042
9067
  InternalModal.displayName = "Modal";
9043
9068
  const DIALOG_CLASS_NAME = "Layer__Dialog";
9044
9069
  const Dialog = react.forwardRef(
9045
- (_fa, ref) => {
9046
- var _ga = _fa, { variant = "center" } = _ga, restProps = __objRest(_ga, ["variant"]);
9070
+ (_ha, ref) => {
9071
+ var _ia = _ha, { variant = "center" } = _ia, restProps = __objRest(_ia, ["variant"]);
9047
9072
  const dataProperties = toDataProperties({ variant });
9048
9073
  return /* @__PURE__ */ jsxRuntime.jsx(
9049
9074
  reactAriaComponents.Dialog,
@@ -9081,11 +9106,25 @@ function Drawer({
9081
9106
  isDismissable = false,
9082
9107
  role
9083
9108
  }) {
9084
- return /* @__PURE__ */ jsxRuntime.jsx(ModalOverlay, { isOpen, onOpenChange, variant, isDismissable, children: /* @__PURE__ */ jsxRuntime.jsx(InternalModal, { flexBlock, flexInline, size, variant, children: /* @__PURE__ */ jsxRuntime.jsx(Dialog, { role: role != null ? role : "dialog", "aria-label": ariaLabel, variant, children }) }) });
9109
+ const isMobileDrawer = variant === "mobile-drawer";
9110
+ const shouldUseFadeOverlay = variant === "drawer" || isMobileDrawer;
9111
+ const modalContent = /* @__PURE__ */ jsxRuntime.jsx(InternalModal, { flexBlock, flexInline, size, variant, children: /* @__PURE__ */ jsxRuntime.jsx(Dialog, { role: role != null ? role : "dialog", "aria-label": ariaLabel, variant, children }) });
9112
+ const wrappedModalContent = isMobileDrawer ? /* @__PURE__ */ jsxRuntime.jsx(
9113
+ AnimatedContent,
9114
+ {
9115
+ variant: "slideUp",
9116
+ isOpen,
9117
+ className: "Layer__ModalContentSlideUpMotionContent",
9118
+ slotProps: { AnimatePresence: { initial: true } },
9119
+ children: modalContent
9120
+ }
9121
+ ) : modalContent;
9122
+ const overlayContent = shouldUseFadeOverlay ? /* @__PURE__ */ jsxRuntime.jsx(AnimatedContent, { variant: "fade", isOpen, className: "Layer__ModalContentFadeMotionContent", children: wrappedModalContent }) : wrappedModalContent;
9123
+ return /* @__PURE__ */ jsxRuntime.jsx(ModalOverlay, { isOpen, onOpenChange, variant, isDismissable, children: overlayContent });
9085
9124
  }
9086
9125
  const HEADING_CLASS_NAME = "Layer__UI__Heading";
9087
- const Heading = react.forwardRef((_ha, ref) => {
9088
- var _ia = _ha, { align, pie, pbe, size, variant, weight, ellipsis, className } = _ia, restProps = __objRest(_ia, ["align", "pie", "pbe", "size", "variant", "weight", "ellipsis", "className"]);
9126
+ const Heading = react.forwardRef((_ja, ref) => {
9127
+ var _ka = _ja, { align, pie, pbe, size, variant, weight, ellipsis, className } = _ka, restProps = __objRest(_ka, ["align", "pie", "pbe", "size", "variant", "weight", "ellipsis", "className"]);
9089
9128
  const dataProperties = toDataProperties({ pbe, pie, size, align, variant, weight, ellipsis });
9090
9129
  return /* @__PURE__ */ jsxRuntime.jsx(
9091
9130
  reactAriaComponents.Heading,
@@ -9112,21 +9151,25 @@ function ButtonSpinner({ size }) {
9112
9151
  function ButtonTransparentContent({ children }) {
9113
9152
  return /* @__PURE__ */ jsxRuntime.jsx("span", { className: BUTTON_CLASS_NAMES.TRANSPARENT_CONTENT, children });
9114
9153
  }
9115
- const Button = react.forwardRef((_ja, ref) => {
9116
- var _ka = _ja, {
9154
+ const Button = react.forwardRef((_la, ref) => {
9155
+ var _ma = _la, {
9117
9156
  children,
9118
9157
  ellipsis,
9119
9158
  icon,
9120
9159
  inset,
9121
9160
  size = "md",
9122
- variant = "solid"
9123
- } = _ka, restProps = __objRest(_ka, [
9161
+ variant = "solid",
9162
+ fullWidth = false,
9163
+ flex = false
9164
+ } = _ma, restProps = __objRest(_ma, [
9124
9165
  "children",
9125
9166
  "ellipsis",
9126
9167
  "icon",
9127
9168
  "inset",
9128
9169
  "size",
9129
- "variant"
9170
+ "variant",
9171
+ "fullWidth",
9172
+ "flex"
9130
9173
  ]);
9131
9174
  const { isPending = false } = restProps;
9132
9175
  const dataProperties = toDataProperties({
@@ -9134,7 +9177,9 @@ const Button = react.forwardRef((_ja, ref) => {
9134
9177
  icon,
9135
9178
  inset,
9136
9179
  size,
9137
- variant
9180
+ variant,
9181
+ "full-width": fullWidth,
9182
+ flex
9138
9183
  });
9139
9184
  return /* @__PURE__ */ jsxRuntime.jsx(
9140
9185
  reactAriaComponents.Button,
@@ -9491,8 +9536,8 @@ const CHECK_SIZE = {
9491
9536
  md: 14,
9492
9537
  lg: 16
9493
9538
  };
9494
- function Checkbox(_la) {
9495
- var _ma = _la, { children, className, variant = "default", size = "sm", isIndeterminate } = _ma, props = __objRest(_ma, ["children", "className", "variant", "size", "isIndeterminate"]);
9539
+ function Checkbox(_na) {
9540
+ var _oa = _na, { children, className, variant = "default", size = "sm", isIndeterminate } = _oa, props = __objRest(_oa, ["children", "className", "variant", "size", "isIndeterminate"]);
9496
9541
  const dataProperties = react.useMemo(() => toDataProperties({
9497
9542
  size,
9498
9543
  variant,
@@ -9510,8 +9555,8 @@ function Checkbox(_la) {
9510
9555
  })
9511
9556
  );
9512
9557
  }
9513
- function CheckboxWithTooltip(_na) {
9514
- var _oa = _na, { tooltip } = _oa, props = __objRest(_oa, ["tooltip"]);
9558
+ function CheckboxWithTooltip(_pa) {
9559
+ var _qa = _pa, { tooltip } = _qa, props = __objRest(_qa, ["tooltip"]);
9515
9560
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__checkbox-wrapper", children: /* @__PURE__ */ jsxRuntime.jsxs(DeprecatedTooltip, { disabled: !tooltip, children: [
9516
9561
  /* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsxRuntime.jsx(Checkbox, __spreadValues({}, props)) }),
9517
9562
  /* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: tooltip })
@@ -9856,8 +9901,8 @@ const isDateAllowedToBrowse = (date2, business) => {
9856
9901
  }
9857
9902
  return dateFns.differenceInCalendarMonths(dateFns.startOfMonth(date2), activationDate) >= 0;
9858
9903
  };
9859
- const ErrorText = (_pa) => {
9860
- var _qa = _pa, { className } = _qa, props = __objRest(_qa, ["className"]);
9904
+ const ErrorText = (_ra) => {
9905
+ var _sa = _ra, { className } = _sa, props = __objRest(_sa, ["className"]);
9861
9906
  return /* @__PURE__ */ jsxRuntime.jsx(Text, __spreadProps(__spreadValues({}, props), { status: "error", className }));
9862
9907
  };
9863
9908
  const InputGroup$1 = ({
@@ -9896,8 +9941,8 @@ const transformCurrencyValue = (rawValue) => {
9896
9941
  }
9897
9942
  return cleaned;
9898
9943
  };
9899
- const AmountInput = (_ra) => {
9900
- var _sa = _ra, {
9944
+ const AmountInput = (_ta) => {
9945
+ var _ua = _ta, {
9901
9946
  onChange,
9902
9947
  className,
9903
9948
  leftText,
@@ -9905,7 +9950,7 @@ const AmountInput = (_ra) => {
9905
9950
  isInvalid,
9906
9951
  badge,
9907
9952
  placeholder = "$0.00"
9908
- } = _sa, props = __objRest(_sa, [
9953
+ } = _ua, props = __objRest(_ua, [
9909
9954
  "onChange",
9910
9955
  "className",
9911
9956
  "leftText",
@@ -9950,8 +9995,8 @@ const AmountInput = (_ra) => {
9950
9995
  /* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
9951
9996
  ] });
9952
9997
  };
9953
- const ChevronLeft = (_ta) => {
9954
- var props = __objRest(_ta, []);
9998
+ const ChevronLeft = (_va) => {
9999
+ var props = __objRest(_va, []);
9955
10000
  return /* @__PURE__ */ jsxRuntime.jsx(
9956
10001
  "svg",
9957
10002
  __spreadProps(__spreadValues({
@@ -9975,8 +10020,8 @@ const ChevronLeft = (_ta) => {
9975
10020
  };
9976
10021
  const CALENDAR_CLASS_NAME = "Layer__UI__Calendar";
9977
10022
  const Calendar = react.forwardRef(
9978
- function Calendar2(_ua, ref) {
9979
- var _va = _ua, { className, isReadOnly } = _va, restProps = __objRest(_va, ["className", "isReadOnly"]);
10023
+ function Calendar2(_wa, ref) {
10024
+ var _xa = _wa, { className, isReadOnly } = _xa, restProps = __objRest(_xa, ["className", "isReadOnly"]);
9980
10025
  const dataProperties = toDataProperties({ readonly: isReadOnly });
9981
10026
  return /* @__PURE__ */ jsxRuntime.jsx(
9982
10027
  reactAriaComponents.Calendar,
@@ -9990,8 +10035,8 @@ const Calendar = react.forwardRef(
9990
10035
  );
9991
10036
  const CALENDAR_GRID_CLASS_NAME = "Layer__UI__CalendarGrid";
9992
10037
  const CalendarGrid = react.forwardRef(
9993
- function CalendarGrid2(_wa, ref) {
9994
- var _xa = _wa, { className } = _xa, restProps = __objRest(_xa, ["className"]);
10038
+ function CalendarGrid2(_ya, ref) {
10039
+ var _za = _ya, { className } = _za, restProps = __objRest(_za, ["className"]);
9995
10040
  return /* @__PURE__ */ jsxRuntime.jsx(
9996
10041
  reactAriaComponents.CalendarGrid,
9997
10042
  __spreadProps(__spreadValues({}, restProps), {
@@ -10003,8 +10048,8 @@ const CalendarGrid = react.forwardRef(
10003
10048
  );
10004
10049
  const CALENDAR_GRID_BODY_CLASS_NAME = "Layer__UI__CalendarGridBody";
10005
10050
  const CalendarGridBody = react.forwardRef(
10006
- function CalendarGridBody2(_ya, ref) {
10007
- var _za = _ya, { className } = _za, restProps = __objRest(_za, ["className"]);
10051
+ function CalendarGridBody2(_Aa, ref) {
10052
+ var _Ba = _Aa, { className } = _Ba, restProps = __objRest(_Ba, ["className"]);
10008
10053
  return /* @__PURE__ */ jsxRuntime.jsx(
10009
10054
  reactAriaComponents.CalendarGridBody,
10010
10055
  __spreadProps(__spreadValues({}, restProps), {
@@ -10016,8 +10061,8 @@ const CalendarGridBody = react.forwardRef(
10016
10061
  );
10017
10062
  const CALENDAR_CELL_CLASS_NAME = "Layer__UI__CalendarCell";
10018
10063
  const CalendarCell = react.forwardRef(
10019
- function CalendarCell2(_Aa, ref) {
10020
- var _Ba = _Aa, { className, size = "sm" } = _Ba, restProps = __objRest(_Ba, ["className", "size"]);
10064
+ function CalendarCell2(_Ca, ref) {
10065
+ var _Da = _Ca, { className, size = "sm" } = _Da, restProps = __objRest(_Da, ["className", "size"]);
10021
10066
  const dataProperties = toDataProperties({ size });
10022
10067
  return /* @__PURE__ */ jsxRuntime.jsx(
10023
10068
  reactAriaComponents.CalendarCell,
@@ -10030,8 +10075,8 @@ const CalendarCell = react.forwardRef(
10030
10075
  );
10031
10076
  const CALENDAR_GRID_HEADER_CLASS_NAME = "Layer__UI__CalendarGridHeader";
10032
10077
  const CalendarGridHeader = react.forwardRef(
10033
- function CalendarGridHeader2(_Ca, ref) {
10034
- var _Da = _Ca, { className } = _Da, restProps = __objRest(_Da, ["className"]);
10078
+ function CalendarGridHeader2(_Ea, ref) {
10079
+ var _Fa = _Ea, { className } = _Fa, restProps = __objRest(_Fa, ["className"]);
10035
10080
  return /* @__PURE__ */ jsxRuntime.jsx(
10036
10081
  reactAriaComponents.CalendarGridHeader,
10037
10082
  __spreadProps(__spreadValues({}, restProps), {
@@ -10043,8 +10088,8 @@ const CalendarGridHeader = react.forwardRef(
10043
10088
  );
10044
10089
  const CALENDAR_HEADER_CELL_CLASS_NAME = "Layer__UI__CalendarHeaderCell";
10045
10090
  const CalendarHeaderCell = react.forwardRef(
10046
- function CalendarHeaderCell2(_Ea, ref) {
10047
- var _Fa = _Ea, { className, size = "sm" } = _Fa, restProps = __objRest(_Fa, ["className", "size"]);
10091
+ function CalendarHeaderCell2(_Ga, ref) {
10092
+ var _Ha = _Ga, { className, size = "sm" } = _Ha, restProps = __objRest(_Ha, ["className", "size"]);
10048
10093
  const dataProperties = toDataProperties({ size });
10049
10094
  return /* @__PURE__ */ jsxRuntime.jsx(
10050
10095
  reactAriaComponents.CalendarHeaderCell,
@@ -10070,8 +10115,8 @@ const DateCalendar = ({ minDate, maxDate, variant }) => {
10070
10115
  };
10071
10116
  const DATE_FIELD_CLASS_NAME = "Layer__UI__DateField";
10072
10117
  const DateField = react.forwardRef(
10073
- function DateField2(_Ga, ref) {
10074
- var _Ha = _Ga, { inline, className, isReadOnly } = _Ha, restProps = __objRest(_Ha, ["inline", "className", "isReadOnly"]);
10118
+ function DateField2(_Ia, ref) {
10119
+ var _Ja = _Ia, { inline, className, isReadOnly } = _Ja, restProps = __objRest(_Ja, ["inline", "className", "isReadOnly"]);
10075
10120
  const dataProperties = toDataProperties({ inline, readonly: isReadOnly });
10076
10121
  return /* @__PURE__ */ jsxRuntime.jsx(
10077
10122
  reactAriaComponents.DateField,
@@ -10085,8 +10130,8 @@ const DateField = react.forwardRef(
10085
10130
  );
10086
10131
  const DATE_INPUT_CLASS_NAME = "Layer__UI__DateInput";
10087
10132
  const DateInput = react.forwardRef(
10088
- function DateInput2(_Ia, ref) {
10089
- var _Ja = _Ia, { inset, pointerEvents } = _Ja, restProps = __objRest(_Ja, ["inset", "pointerEvents"]);
10133
+ function DateInput2(_Ka, ref) {
10134
+ var _La = _Ka, { inset, pointerEvents } = _La, restProps = __objRest(_La, ["inset", "pointerEvents"]);
10090
10135
  const dataProperties = toDataProperties({ inset, "pointer-events": pointerEvents });
10091
10136
  return /* @__PURE__ */ jsxRuntime.jsx(
10092
10137
  reactAriaComponents.DateInput,
@@ -10099,8 +10144,8 @@ const DateInput = react.forwardRef(
10099
10144
  );
10100
10145
  const DATE_SEGMENT_CLASS_NAME = "Layer__UI__DateSegment";
10101
10146
  const DateSegment = react.forwardRef(
10102
- function DateSegment2(_Ka, ref) {
10103
- var _La = _Ka, { isReadOnly } = _La, restProps = __objRest(_La, ["isReadOnly"]);
10147
+ function DateSegment2(_Ma, ref) {
10148
+ var _Na = _Ma, { isReadOnly } = _Na, restProps = __objRest(_Na, ["isReadOnly"]);
10104
10149
  const dataProperties = toDataProperties({ interactive: !isReadOnly });
10105
10150
  return /* @__PURE__ */ jsxRuntime.jsx(
10106
10151
  reactAriaComponents.DateSegment,
@@ -10126,8 +10171,8 @@ const DatePicker$1 = react.forwardRef(
10126
10171
  const POPOVER_CLASS_NAME = "Layer__Popover";
10127
10172
  const POPOVER_CLASS_NAMES = `Layer__Portal ${POPOVER_CLASS_NAME}`;
10128
10173
  const Popover = react.forwardRef(
10129
- function Popover2(_Ma, ref) {
10130
- var _Na = _Ma, { flexInline = false } = _Na, restProps = __objRest(_Na, ["flexInline"]);
10174
+ function Popover2(_Oa, ref) {
10175
+ var _Pa = _Oa, { flexInline = false } = _Pa, restProps = __objRest(_Pa, ["flexInline"]);
10131
10176
  const dataProperties = toDataProperties({ "flex-inline": flexInline });
10132
10177
  return /* @__PURE__ */ jsxRuntime.jsx(
10133
10178
  reactAriaComponents.Popover,
@@ -10141,7 +10186,6 @@ const Popover = react.forwardRef(
10141
10186
  const DATE_FORMAT$1 = "LLL d, yyyy";
10142
10187
  const DATE_FORMAT_SHORT = "M/d/yyyy";
10143
10188
  const DATE_FORMAT_WITH_TIME_READABLE = "LLLL do, yyyy 'at' h:mm a";
10144
- const MONTH_DAY_FORMAT = "LLL d";
10145
10189
  const TIME_FORMAT = "p";
10146
10190
  const BREAKPOINTS = {
10147
10191
  TABLET: 760,
@@ -10202,8 +10246,8 @@ function ResponsivePopover({ children, triggerRef }) {
10202
10246
  }
10203
10247
  );
10204
10248
  }
10205
- const ChevronDown = (_Oa) => {
10206
- var _Pa = _Oa, { size = 18 } = _Pa, props = __objRest(_Pa, ["size"]);
10249
+ const ChevronDown = (_Qa) => {
10250
+ var _Ra = _Qa, { size = 18 } = _Ra, props = __objRest(_Ra, ["size"]);
10207
10251
  return /* @__PURE__ */ jsxRuntime.jsx(
10208
10252
  "svg",
10209
10253
  __spreadProps(__spreadValues({
@@ -10227,8 +10271,8 @@ const ChevronDown = (_Oa) => {
10227
10271
  };
10228
10272
  const INPUT_GROUP_CLASS_NAME = "Layer__InputGroup";
10229
10273
  const InputGroup = react.forwardRef(
10230
- function InputGroup2(_Qa, ref) {
10231
- var _Ra = _Qa, { actionCount, className, slots, children } = _Ra, restProps = __objRest(_Ra, ["actionCount", "className", "slots", "children"]);
10274
+ function InputGroup2(_Sa, ref) {
10275
+ var _Ta = _Sa, { actionCount, className, slots, children } = _Ta, restProps = __objRest(_Ta, ["actionCount", "className", "slots", "children"]);
10232
10276
  const combinedClassName = classNames(INPUT_GROUP_CLASS_NAME, className);
10233
10277
  const dataProperties = toDataProperties({
10234
10278
  "action-count": actionCount
@@ -10245,15 +10289,15 @@ const InputGroup = react.forwardRef(
10245
10289
  );
10246
10290
  const FORM_CLASS_NAME = "Layer__UI__Form";
10247
10291
  const Form = react.forwardRef(
10248
- function Form2(_Sa, ref) {
10249
- var _Ta = _Sa, { children, className } = _Ta, restProps = __objRest(_Ta, ["children", "className"]);
10292
+ function Form2(_Ua, ref) {
10293
+ var _Va = _Ua, { children, className } = _Va, restProps = __objRest(_Va, ["children", "className"]);
10250
10294
  return /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Form, __spreadProps(__spreadValues({}, restProps), { className: classNames(FORM_CLASS_NAME, className), ref, children }));
10251
10295
  }
10252
10296
  );
10253
10297
  const TEXT_FIELD_CLASS_NAME = "Layer__UI__TextField";
10254
10298
  const TextField = react.forwardRef(
10255
- function TextField2(_Ua, ref) {
10256
- var _Va = _Ua, { children, inline, textarea, className } = _Va, restProps = __objRest(_Va, ["children", "inline", "textarea", "className"]);
10299
+ function TextField2(_Wa, ref) {
10300
+ var _Xa = _Wa, { children, inline, textarea, className } = _Xa, restProps = __objRest(_Xa, ["children", "inline", "textarea", "className"]);
10257
10301
  const dataProperties = toDataProperties({ inline, textarea });
10258
10302
  return /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.TextField, __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(TEXT_FIELD_CLASS_NAME, className), ref, children: withRenderProp(children, (node) => node) }));
10259
10303
  }
@@ -10942,8 +10986,8 @@ const useIsVisible = (ref) => {
10942
10986
  }, [ref]);
10943
10987
  return isIntersecting;
10944
10988
  };
10945
- const ChevronDownFill = (_Wa) => {
10946
- var _Xa = _Wa, { size = 18 } = _Xa, props = __objRest(_Xa, ["size"]);
10989
+ const ChevronDownFill = (_Ya) => {
10990
+ var _Za = _Ya, { size = 18 } = _Za, props = __objRest(_Za, ["size"]);
10947
10991
  return /* @__PURE__ */ jsxRuntime.jsxs(
10948
10992
  "svg",
10949
10993
  __spreadProps(__spreadValues({
@@ -10968,8 +11012,8 @@ const ChevronDownFill = (_Wa) => {
10968
11012
  })
10969
11013
  );
10970
11014
  };
10971
- const File = (_Ya) => {
10972
- var _Za = _Ya, { size = 12 } = _Za, props = __objRest(_Za, ["size"]);
11015
+ const File = (__a) => {
11016
+ var _$a = __a, { size = 12 } = _$a, props = __objRest(_$a, ["size"]);
10973
11017
  return /* @__PURE__ */ jsxRuntime.jsxs(
10974
11018
  "svg",
10975
11019
  __spreadProps(__spreadValues({
@@ -11029,13 +11073,13 @@ const File = (_Ya) => {
11029
11073
  })
11030
11074
  );
11031
11075
  };
11032
- const Input$1 = (__a) => {
11033
- var _$a = __a, {
11076
+ const Input$1 = (_ab) => {
11077
+ var _bb = _ab, {
11034
11078
  className,
11035
11079
  isInvalid,
11036
11080
  errorMessage,
11037
11081
  leftText
11038
- } = _$a, props = __objRest(_$a, [
11082
+ } = _bb, props = __objRest(_bb, [
11039
11083
  "className",
11040
11084
  "isInvalid",
11041
11085
  "errorMessage",
@@ -11055,19 +11099,19 @@ const Input$1 = (__a) => {
11055
11099
  /* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
11056
11100
  ] });
11057
11101
  };
11058
- const TextButton = (_ab) => {
11059
- var _bb = _ab, {
11102
+ const TextButton = (_cb) => {
11103
+ var _db = _cb, {
11060
11104
  className,
11061
11105
  children
11062
- } = _bb, props = __objRest(_bb, [
11106
+ } = _db, props = __objRest(_db, [
11063
11107
  "className",
11064
11108
  "children"
11065
11109
  ]);
11066
11110
  const baseClassName2 = classNames("Layer__text-btn", className);
11067
11111
  return /* @__PURE__ */ jsxRuntime.jsx("button", __spreadProps(__spreadValues({}, props), { className: baseClassName2, children }));
11068
11112
  };
11069
- const ScissorsFullOpen = (_cb) => {
11070
- var _db = _cb, { size = 12 } = _db, props = __objRest(_db, ["size"]);
11113
+ const ScissorsFullOpen = (_eb) => {
11114
+ var _fb = _eb, { size = 12 } = _fb, props = __objRest(_fb, ["size"]);
11071
11115
  return /* @__PURE__ */ jsxRuntime.jsx(
11072
11116
  "svg",
11073
11117
  __spreadProps(__spreadValues({
@@ -11132,8 +11176,8 @@ const ScissorsFullOpen = (_cb) => {
11132
11176
  })
11133
11177
  );
11134
11178
  };
11135
- const Trash = (_eb) => {
11136
- var _fb = _eb, { size = 18 } = _fb, props = __objRest(_fb, ["size"]);
11179
+ const Trash = (_gb) => {
11180
+ var _hb = _gb, { size = 18 } = _hb, props = __objRest(_hb, ["size"]);
11137
11181
  return /* @__PURE__ */ jsxRuntime.jsxs(
11138
11182
  "svg",
11139
11183
  __spreadProps(__spreadValues({
@@ -11184,8 +11228,8 @@ const Trash = (_eb) => {
11184
11228
  })
11185
11229
  );
11186
11230
  };
11187
- const UploadCloud = (_gb) => {
11188
- var _hb = _gb, { size = 18 } = _hb, props = __objRest(_hb, ["size"]);
11231
+ const UploadCloud = (_ib) => {
11232
+ var _jb = _ib, { size = 18 } = _jb, props = __objRest(_jb, ["size"]);
11189
11233
  return /* @__PURE__ */ jsxRuntime.jsxs(
11190
11234
  "svg",
11191
11235
  __spreadProps(__spreadValues({
@@ -11440,8 +11484,8 @@ const ReceiptsProvider = ({
11440
11484
  const contextData = useReceipts({ bankTransaction, isActive });
11441
11485
  return /* @__PURE__ */ jsxRuntime.jsx(ReceiptsContext.Provider, { value: contextData, children });
11442
11486
  };
11443
- const DownloadCloud = (_ib) => {
11444
- var _jb = _ib, { size = 18 } = _jb, props = __objRest(_jb, ["size"]);
11487
+ const DownloadCloud = (_kb) => {
11488
+ var _lb = _kb, { size = 18 } = _lb, props = __objRest(_lb, ["size"]);
11445
11489
  return /* @__PURE__ */ jsxRuntime.jsxs(
11446
11490
  "svg",
11447
11491
  __spreadProps(__spreadValues({
@@ -11483,8 +11527,8 @@ const DownloadCloud = (_ib) => {
11483
11527
  })
11484
11528
  );
11485
11529
  };
11486
- const Eye = (_kb) => {
11487
- var _lb = _kb, { size = 18 } = _lb, props = __objRest(_lb, ["size"]);
11530
+ const Eye = (_mb) => {
11531
+ var _nb = _mb, { size = 18 } = _nb, props = __objRest(_nb, ["size"]);
11488
11532
  return /* @__PURE__ */ jsxRuntime.jsx(
11489
11533
  "svg",
11490
11534
  __spreadProps(__spreadValues({
@@ -11637,8 +11681,8 @@ const openReceiptInNewTab = (url, index2) => (e) => {
11637
11681
  `);
11638
11682
  }
11639
11683
  };
11640
- const BankTransactionReceiptsWithProvider = react.forwardRef((_mb, ref) => {
11641
- var _nb = _mb, { bankTransaction, isActive } = _nb, props = __objRest(_nb, ["bankTransaction", "isActive"]);
11684
+ const BankTransactionReceiptsWithProvider = react.forwardRef((_ob, ref) => {
11685
+ var _pb = _ob, { bankTransaction, isActive } = _pb, props = __objRest(_pb, ["bankTransaction", "isActive"]);
11642
11686
  return /* @__PURE__ */ jsxRuntime.jsx(ReceiptsProvider, { bankTransaction, isActive, children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionReceipts, __spreadProps(__spreadValues({}, props), { ref })) });
11643
11687
  });
11644
11688
  BankTransactionReceiptsWithProvider.displayName = "BankTransactionReceiptsWithProvider";
@@ -11690,8 +11734,8 @@ const BankTransactionReceipts = react.forwardRef(
11690
11734
  );
11691
11735
  BankTransactionReceipts.displayName = "BankTransactionReceipts";
11692
11736
  const PORTAL_CLASS_NAME = "Layer__Portal";
11693
- const Check = (_ob) => {
11694
- var _pb = _ob, { size = 18 } = _pb, props = __objRest(_pb, ["size"]);
11737
+ const Check = (_qb) => {
11738
+ var _rb = _qb, { size = 18 } = _rb, props = __objRest(_rb, ["size"]);
11695
11739
  return /* @__PURE__ */ jsxRuntime.jsx(
11696
11740
  "svg",
11697
11741
  __spreadProps(__spreadValues({
@@ -11887,8 +11931,8 @@ function buildCustomMenuPortal() {
11887
11931
  );
11888
11932
  };
11889
11933
  }
11890
- function ComboBox(_qb) {
11891
- var _rb = _qb, {
11934
+ function ComboBox(_sb) {
11935
+ var _tb = _sb, {
11892
11936
  className,
11893
11937
  selectedValue,
11894
11938
  onSelectedValueChange,
@@ -11906,7 +11950,7 @@ function ComboBox(_qb) {
11906
11950
  isClearable = true,
11907
11951
  isReadOnly = false,
11908
11952
  displayDisabledAsSelected
11909
- } = _rb, ariaProps = __objRest(_rb, [
11953
+ } = _tb, ariaProps = __objRest(_tb, [
11910
11954
  "className",
11911
11955
  "selectedValue",
11912
11956
  "onSelectedValueChange",
@@ -13103,8 +13147,8 @@ function isCategorizationEnabledForStatus(status) {
13103
13147
  }
13104
13148
  }
13105
13149
  }
13106
- const MinimizeTwo = (_sb) => {
13107
- var _tb = _sb, { size = 18 } = _tb, props = __objRest(_tb, ["size"]);
13150
+ const MinimizeTwo = (_ub) => {
13151
+ var _vb = _ub, { size = 18 } = _vb, props = __objRest(_vb, ["size"]);
13108
13152
  return /* @__PURE__ */ jsxRuntime.jsxs(
13109
13153
  "svg",
13110
13154
  __spreadProps(__spreadValues({
@@ -13182,7 +13226,7 @@ const MatchBadge = ({
13182
13226
  }
13183
13227
  return;
13184
13228
  };
13185
- const MatchForm$1 = ({
13229
+ const MatchForm = ({
13186
13230
  classNamePrefix,
13187
13231
  bankTransaction,
13188
13232
  selectedMatchId,
@@ -13535,12 +13579,12 @@ const Notification = ({
13535
13579
  }
13536
13580
  );
13537
13581
  };
13538
- const Textarea = (_ub) => {
13539
- var _vb = _ub, {
13582
+ const Textarea = (_wb) => {
13583
+ var _xb = _wb, {
13540
13584
  className,
13541
13585
  isInvalid,
13542
13586
  errorMessage
13543
- } = _vb, props = __objRest(_vb, [
13587
+ } = _xb, props = __objRest(_xb, [
13544
13588
  "className",
13545
13589
  "isInvalid",
13546
13590
  "errorMessage"
@@ -13682,9 +13726,7 @@ const BankTransactionMemo = ({ bankTransactionId }) => {
13682
13726
  return /* @__PURE__ */ jsxRuntime.jsx(
13683
13727
  InputGroup$1,
13684
13728
  {
13685
- className: "Layer__bank-transaction-memo-input-group",
13686
13729
  name: "memo",
13687
- label: "Description",
13688
13730
  children: /* @__PURE__ */ jsxRuntime.jsx(
13689
13731
  Textarea,
13690
13732
  {
@@ -13866,9 +13908,9 @@ function BankTransactionFormFields({
13866
13908
  if (!showTags && !showCustomerVendor && !showDescriptions) {
13867
13909
  return null;
13868
13910
  }
13869
- return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { pi: "md", pbe: "lg", gap: "md", className: "Layer__bank-transaction-form-fields", children: [
13870
- showCustomerVendor && !hideCustomerVendor ? /* @__PURE__ */ jsxRuntime.jsx(BankTransactionCustomerVendorSelector, { bankTransaction }) : null,
13871
- showTags && !hideTags ? /* @__PURE__ */ jsxRuntime.jsx(
13911
+ return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "md", children: [
13912
+ showCustomerVendor && !hideCustomerVendor && /* @__PURE__ */ jsxRuntime.jsx(BankTransactionCustomerVendorSelector, { bankTransaction }),
13913
+ showTags && !hideTags && /* @__PURE__ */ jsxRuntime.jsx(
13872
13914
  TagDimensionsGroup,
13873
13915
  {
13874
13916
  value: selectedTags,
@@ -13876,8 +13918,11 @@ function BankTransactionFormFields({
13876
13918
  showLabels: true,
13877
13919
  isReadOnly
13878
13920
  }
13879
- ) : null,
13880
- showDescriptions ? /* @__PURE__ */ jsxRuntime.jsx(BankTransactionMemo, { bankTransactionId: bankTransaction.id }) : null
13921
+ ),
13922
+ showDescriptions && /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
13923
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", weight: "bold", children: "Description" }),
13924
+ /* @__PURE__ */ jsxRuntime.jsx(BankTransactionMemo, { bankTransactionId: bankTransaction.id })
13925
+ ] })
13881
13926
  ] });
13882
13927
  }
13883
13928
  var CategorizationType = /* @__PURE__ */ ((CategorizationType2) => {
@@ -14073,23 +14118,21 @@ const DateTime = ({
14073
14118
  };
14074
14119
  const CLASS_NAME$8 = "Layer__MoneyText";
14075
14120
  const MoneySpan = react.forwardRef(
14076
- (_wb, ref) => {
14077
- var _xb = _wb, { amount, bold, size, displayPlusSign, className } = _xb, restProps = __objRest(_xb, ["amount", "bold", "size", "displayPlusSign", "className"]);
14121
+ (_yb, ref) => {
14122
+ var _zb = _yb, { amount, bold, size, displayPlusSign, className } = _zb, restProps = __objRest(_zb, ["amount", "bold", "size", "displayPlusSign", "className"]);
14078
14123
  const dataProperties = toDataProperties({
14079
14124
  bold,
14080
- positive: amount >= 0,
14081
- negative: amount < 0,
14082
- size
14125
+ "positive": amount >= 0,
14126
+ "negative": amount < 0,
14127
+ size,
14128
+ "display-plus-sign": displayPlusSign
14083
14129
  });
14084
- return /* @__PURE__ */ jsxRuntime.jsxs("span", __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(CLASS_NAME$8, className), ref, children: [
14085
- displayPlusSign && "+",
14086
- centsToDollars(Math.abs(amount))
14087
- ] }));
14130
+ return /* @__PURE__ */ jsxRuntime.jsx("span", __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(CLASS_NAME$8, className), ref, children: centsToDollars(Math.abs(amount)) }));
14088
14131
  }
14089
14132
  );
14090
14133
  MoneySpan.displayName = "MoneySpan";
14091
- const Scissors = (_yb) => {
14092
- var _zb = _yb, { size = 11 } = _zb, props = __objRest(_zb, ["size"]);
14134
+ const Scissors = (_Ab) => {
14135
+ var _Bb = _Ab, { size = 11 } = _Bb, props = __objRest(_Bb, ["size"]);
14093
14136
  return /* @__PURE__ */ jsxRuntime.jsxs(
14094
14137
  "svg",
14095
14138
  __spreadProps(__spreadValues({
@@ -14220,21 +14263,27 @@ const Scissors = (_yb) => {
14220
14263
  );
14221
14264
  };
14222
14265
  const BankTransactionsBaseSelectedValue = (props) => {
14223
- var _a, _b, _c, _d, _e, _f;
14266
+ var _a, _b, _c, _d, _e, _f, _g, _h;
14224
14267
  const { type, className, label, slotProps } = props;
14268
+ if (type === "placeholder") {
14269
+ return /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", align: "center", className, children: /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, size: (_b = (_a = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _a.size) != null ? _b : "md", children: label }) });
14270
+ }
14225
14271
  if (type === "match" || type === "transfer") {
14226
14272
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", align: "center", className, children: [
14227
14273
  /* @__PURE__ */ jsxRuntime.jsx(Badge, { size: BadgeSize.SMALL, icon: /* @__PURE__ */ jsxRuntime.jsx(MinimizeTwo, { size: 11 }), children: type === "transfer" ? "Transfer" : "Match" }),
14228
- /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, size: (_b = (_a = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _a.size) != null ? _b : "md", children: label })
14274
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, size: (_d = (_c = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _c.size) != null ? _d : "md", children: label })
14229
14275
  ] });
14230
14276
  }
14231
14277
  if (type === "split") {
14232
14278
  return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", align: "center", className, children: [
14233
14279
  /* @__PURE__ */ jsxRuntime.jsx(Badge, { size: BadgeSize.SMALL, icon: /* @__PURE__ */ jsxRuntime.jsx(Scissors, { size: 11 }), children: "Split" }),
14234
- /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, size: (_d = (_c = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _c.size) != null ? _d : "md", children: label })
14280
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, size: (_f = (_e = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _e.size) != null ? _f : "md", children: label })
14235
14281
  ] });
14236
14282
  }
14237
- return /* @__PURE__ */ jsxRuntime.jsx(HStack, { gap: "xs", align: "center", className, children: /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, size: (_f = (_e = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _e.size) != null ? _f : "md", children: label }) });
14283
+ return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", align: "center", className, children: [
14284
+ /* @__PURE__ */ jsxRuntime.jsx(Badge, { size: BadgeSize.SMALL, icon: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Layers2Icon, { size: 11 }), children: "Category" }),
14285
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, size: (_h = (_g = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _g.size) != null ? _h : "md", children: label })
14286
+ ] });
14238
14287
  };
14239
14288
  const BankTransactionsUncategorizedSelectedValue = (props) => {
14240
14289
  const { selectedValue, className, slotProps } = props;
@@ -14688,9 +14737,9 @@ const ExpandedBankTransactionRow = react.forwardRef(
14688
14737
  submitBtnText = "Save",
14689
14738
  containerWidth,
14690
14739
  showDescriptions,
14691
- showReceiptUploads
14740
+ showReceiptUploads,
14741
+ showLeftPadding = true
14692
14742
  }, ref) => {
14693
- var _a, _b;
14694
14743
  const {
14695
14744
  categorize: categorizeBankTransaction2,
14696
14745
  match: matchBankTransaction2
@@ -14708,7 +14757,7 @@ const ExpandedBankTransactionRow = react.forwardRef(
14708
14757
  /* categorize */
14709
14758
  );
14710
14759
  const [selectedMatch, setSelectedMatch] = react.useState(
14711
- (_b = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) != null ? _b : (_a = bankTransaction == null ? void 0 : bankTransaction.suggested_matches) == null ? void 0 : _a[0]
14760
+ getBankTransactionFirstSuggestedMatch(bankTransaction)
14712
14761
  );
14713
14762
  const [matchFormError, setMatchFormError] = react.useState();
14714
14763
  const bodyRef = react.useRef(null);
@@ -14770,14 +14819,14 @@ const ExpandedBankTransactionRow = react.forwardRef(
14770
14819
  });
14771
14820
  }
14772
14821
  };
14773
- const save = () => __async(null, null, function* () {
14774
- var _a2;
14822
+ const save = () => {
14823
+ var _a;
14775
14824
  if (purpose === "match") {
14776
14825
  if (!selectedMatch) {
14777
14826
  setMatchFormError("Select an option to match the transaction");
14778
14827
  return;
14779
- } else if (selectedMatch && selectedMatch.id !== ((_a2 = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a2.id)) {
14780
- yield onMatchSubmit(selectedMatch.id);
14828
+ } else if (selectedMatch && selectedMatch.id !== ((_a = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a.id)) {
14829
+ void onMatchSubmit(selectedMatch.id);
14781
14830
  return;
14782
14831
  }
14783
14832
  close2();
@@ -14785,19 +14834,19 @@ const ExpandedBankTransactionRow = react.forwardRef(
14785
14834
  }
14786
14835
  if (!isValid) return;
14787
14836
  const categorizationRequest = buildCategorizeBankTransactionPayloadForSplit(localSplits);
14788
- yield categorizeBankTransaction2(
14837
+ void categorizeBankTransaction2(
14789
14838
  bankTransaction.id,
14790
14839
  categorizationRequest
14791
14840
  );
14792
14841
  deselect(bankTransaction.id);
14793
14842
  close2();
14794
- });
14843
+ };
14795
14844
  react.useImperativeHandle(ref, () => ({
14796
14845
  save
14797
14846
  }));
14798
14847
  const onMatchSubmit = (matchId) => __async(null, null, function* () {
14799
- var _a2;
14800
- const foundMatch = (_a2 = bankTransaction.suggested_matches) == null ? void 0 : _a2.find(
14848
+ var _a;
14849
+ const foundMatch = (_a = bankTransaction.suggested_matches) == null ? void 0 : _a.find(
14801
14850
  (x) => x.id === matchId
14802
14851
  );
14803
14852
  if (!foundMatch) {
@@ -14815,228 +14864,227 @@ const ExpandedBankTransactionRow = react.forwardRef(
14815
14864
  "span",
14816
14865
  {
14817
14866
  className: `${className} ${className}--${isOpen ? "expanded" : "collapsed"}`,
14818
- children: !isOpen ? null : /* @__PURE__ */ jsxRuntime.jsxs("span", { className: `${className}__wrapper`, ref: bodyRef, children: [
14819
- categorizationEnabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${className}__content-toggle`, children: /* @__PURE__ */ jsxRuntime.jsx(
14820
- Toggle,
14821
- {
14822
- name: `purpose-${bankTransaction.id}${asListItem ? "-li" : ""}`,
14823
- size: ToggleSize.small,
14824
- options: [
14825
- {
14826
- value: "categorize",
14827
- label: "Categorize"
14828
- },
14829
- {
14830
- value: "match",
14831
- label: "Match",
14832
- disabled: !hasMatch(bankTransaction),
14833
- disabledMessage: "We could not find matching transactions"
14834
- }
14835
- ],
14836
- selected: purpose,
14837
- onChange: onChangePurpose
14838
- }
14839
- ) }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}),
14840
- /* @__PURE__ */ jsxRuntime.jsxs(
14841
- "div",
14842
- {
14843
- className: `${className}__content`,
14844
- id: `expanded-${bankTransaction.id}`,
14845
- children: [
14846
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className}__content-panels`, children: [
14847
- /* @__PURE__ */ jsxRuntime.jsx(
14848
- "div",
14849
- {
14850
- className: classNames(
14851
- `${className}__match`,
14852
- `${className}__content-panel`,
14853
- purpose === "match" ? `${className}__content-panel--active` : ""
14854
- ),
14855
- children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${className}__content-panel-container`, children: /* @__PURE__ */ jsxRuntime.jsx(
14856
- MatchForm$1,
14857
- {
14858
- classNamePrefix: className,
14859
- bankTransaction,
14860
- selectedMatchId: selectedMatch == null ? void 0 : selectedMatch.id,
14861
- readOnly: !categorizationEnabled,
14862
- setSelectedMatch: (suggestedMatch) => {
14863
- setMatchFormError(void 0);
14864
- setSelectedMatch(suggestedMatch);
14865
- },
14866
- matchFormError
14867
- }
14868
- ) })
14869
- }
14870
- ),
14871
- /* @__PURE__ */ jsxRuntime.jsx(
14872
- "div",
14873
- {
14874
- className: classNames(
14875
- `${className}__splits`,
14876
- `${className}__content-panel`,
14877
- purpose === "categorize" ? `${className}__content-panel--active` : ""
14878
- ),
14879
- children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className}__content-panel-container`, children: [
14880
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${className}__splits-inputs`, children: effectiveSplits.map((split, index2) => /* @__PURE__ */ jsxRuntime.jsxs(
14881
- "div",
14867
+ children: isOpen && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
14868
+ /* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
14869
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: `${className}__wrapper`, ref: bodyRef, children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { pis: showLeftPadding ? "md" : void 0, pbs: "sm", children: [
14870
+ categorizationEnabled && /* @__PURE__ */ jsxRuntime.jsx(HStack, { pi: "md", pbe: "md", pbs: "3xs", children: /* @__PURE__ */ jsxRuntime.jsx(
14871
+ Toggle,
14872
+ {
14873
+ name: `purpose-${bankTransaction.id}${asListItem ? "-li" : ""}`,
14874
+ size: ToggleSize.small,
14875
+ options: [
14876
+ {
14877
+ value: "categorize",
14878
+ label: "Categorize"
14879
+ },
14880
+ {
14881
+ value: "match",
14882
+ label: "Match",
14883
+ disabled: !hasMatch(bankTransaction),
14884
+ disabledMessage: "We could not find matching transactions"
14885
+ }
14886
+ ],
14887
+ selected: purpose,
14888
+ onChange: onChangePurpose
14889
+ }
14890
+ ) }),
14891
+ /* @__PURE__ */ jsxRuntime.jsxs(
14892
+ "div",
14893
+ {
14894
+ className: `${className}__content`,
14895
+ id: `expanded-${bankTransaction.id}`,
14896
+ children: [
14897
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className}__content-panels`, children: [
14898
+ /* @__PURE__ */ jsxRuntime.jsx(
14899
+ "div",
14900
+ {
14901
+ className: classNames(
14902
+ `${className}__match`,
14903
+ `${className}__content-panel`,
14904
+ purpose === "match" ? `${className}__content-panel--active` : ""
14905
+ ),
14906
+ children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${className}__content-panel-container`, children: /* @__PURE__ */ jsxRuntime.jsx(
14907
+ MatchForm,
14882
14908
  {
14883
- className: `${className}__table-cell--split-entry`,
14884
- children: [
14885
- /* @__PURE__ */ jsxRuntime.jsx(
14886
- AmountInput,
14887
- {
14888
- name: `split-${index2}${asListItem ? "-li" : ""}`,
14889
- disabled: index2 === 0 || !categorizationEnabled,
14890
- onChange: updateSplitAmount(index2),
14891
- value: getInputValueForSplitAtIndex(index2, split),
14892
- onBlur: onBlurSplitAmount,
14893
- className: `${className}__table-cell--split-entry__amount`,
14894
- isInvalid: split.amount < 0
14895
- }
14896
- ),
14897
- /* @__PURE__ */ jsxRuntime.jsx(
14898
- BankTransactionCategoryComboBox,
14899
- {
14900
- bankTransaction,
14901
- selectedValue: split.category,
14902
- onSelectedValueChange: (value) => {
14903
- changeCategoryForSplitAtIndex(index2, value);
14904
- },
14905
- isLoading: bankTransaction.processing,
14906
- isDisabled: !categorizationEnabled,
14907
- includeSuggestedMatches: false
14908
- }
14909
- ),
14910
- showTags && /* @__PURE__ */ jsxRuntime.jsx(
14911
- TagDimensionsGroup,
14912
- {
14913
- value: split.tags,
14914
- onChange: (tags) => changeTags(index2, tags),
14915
- showLabels: false,
14916
- isReadOnly: !categorizationEnabled,
14917
- className: `${className}__table-cell--split-entry__tags`
14918
- }
14919
- ),
14920
- showCustomerVendor && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__expanded-bank-transaction-row__table-cell--split-entry__customer", children: /* @__PURE__ */ jsxRuntime.jsx(
14921
- CustomerVendorSelector,
14922
- {
14923
- selectedCustomerVendor: split.customerVendor,
14924
- onSelectedCustomerVendorChange: (customerVendor) => changeCustomerVendor(index2, customerVendor),
14925
- placeholder: "Set customer or vendor",
14926
- isReadOnly: !categorizationEnabled,
14927
- showLabel: false
14928
- }
14929
- ) }),
14930
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__expanded-bank-transaction-row__table-cell--split-entry__button", children: /* @__PURE__ */ jsxRuntime.jsx(
14931
- Button,
14932
- {
14933
- onPress: () => removeSplit(index2),
14934
- variant: "outlined",
14935
- icon: true,
14936
- isDisabled: index2 == 0,
14937
- children: /* @__PURE__ */ jsxRuntime.jsx(Trash, { size: 18 })
14938
- }
14939
- ) })
14940
- ]
14941
- },
14942
- `split-${index2}`
14943
- )) }),
14944
- splitFormError && /* @__PURE__ */ jsxRuntime.jsx(HStack, { pb: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: splitFormError }) }),
14945
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className}__total-and-btns`, children: [
14946
- effectiveSplits.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
14947
- Input$1,
14948
- {
14949
- disabled: true,
14950
- leftText: "Total",
14951
- inputMode: "numeric",
14952
- value: `$${centsToDollars(
14953
- effectiveSplits.reduce(
14954
- (x, { amount }) => x + amount,
14955
- 0
14956
- )
14957
- )}`
14958
- }
14959
- ),
14960
- categorizationEnabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${className}__splits-buttons`, children: effectiveSplits.length > 1 ? /* @__PURE__ */ jsxRuntime.jsx(
14961
- TextButton,
14962
- {
14963
- onClick: addSplit,
14964
- children: "Add new split"
14965
- }
14966
- ) : /* @__PURE__ */ jsxRuntime.jsxs(
14967
- Button,
14909
+ classNamePrefix: className,
14910
+ bankTransaction,
14911
+ selectedMatchId: selectedMatch == null ? void 0 : selectedMatch.id,
14912
+ readOnly: !categorizationEnabled,
14913
+ setSelectedMatch: (suggestedMatch) => {
14914
+ setMatchFormError(void 0);
14915
+ setSelectedMatch(suggestedMatch);
14916
+ },
14917
+ matchFormError
14918
+ }
14919
+ ) })
14920
+ }
14921
+ ),
14922
+ /* @__PURE__ */ jsxRuntime.jsx(
14923
+ "div",
14924
+ {
14925
+ className: classNames(
14926
+ `${className}__splits`,
14927
+ `${className}__content-panel`,
14928
+ purpose === "categorize" ? `${className}__content-panel--active` : ""
14929
+ ),
14930
+ children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className}__content-panel-container`, children: [
14931
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${className}__splits-inputs`, children: effectiveSplits.map((split, index2) => /* @__PURE__ */ jsxRuntime.jsxs(
14932
+ "div",
14968
14933
  {
14969
- onClick: addSplit,
14970
- variant: "outlined",
14934
+ className: `${className}__table-cell--split-entry`,
14971
14935
  children: [
14972
- /* @__PURE__ */ jsxRuntime.jsx(ScissorsFullOpen, { size: 14 }),
14973
- "Split"
14936
+ /* @__PURE__ */ jsxRuntime.jsx(
14937
+ AmountInput,
14938
+ {
14939
+ name: `split-${index2}${asListItem ? "-li" : ""}`,
14940
+ disabled: index2 === 0 || !categorizationEnabled,
14941
+ onChange: updateSplitAmount(index2),
14942
+ value: getInputValueForSplitAtIndex(index2, split),
14943
+ onBlur: onBlurSplitAmount,
14944
+ className: `${className}__table-cell--split-entry__amount`,
14945
+ isInvalid: split.amount < 0
14946
+ }
14947
+ ),
14948
+ /* @__PURE__ */ jsxRuntime.jsx(
14949
+ BankTransactionCategoryComboBox,
14950
+ {
14951
+ bankTransaction,
14952
+ selectedValue: split.category,
14953
+ onSelectedValueChange: (value) => {
14954
+ changeCategoryForSplitAtIndex(index2, value);
14955
+ },
14956
+ isLoading: bankTransaction.processing,
14957
+ isDisabled: !categorizationEnabled,
14958
+ includeSuggestedMatches: false
14959
+ }
14960
+ ),
14961
+ showTags && /* @__PURE__ */ jsxRuntime.jsx(
14962
+ TagDimensionsGroup,
14963
+ {
14964
+ value: split.tags,
14965
+ onChange: (tags) => changeTags(index2, tags),
14966
+ showLabels: false,
14967
+ isReadOnly: !categorizationEnabled,
14968
+ className: `${className}__table-cell--split-entry__tags`
14969
+ }
14970
+ ),
14971
+ showCustomerVendor && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__expanded-bank-transaction-row__table-cell--split-entry__customer", children: /* @__PURE__ */ jsxRuntime.jsx(
14972
+ CustomerVendorSelector,
14973
+ {
14974
+ selectedCustomerVendor: split.customerVendor,
14975
+ onSelectedCustomerVendorChange: (customerVendor) => changeCustomerVendor(index2, customerVendor),
14976
+ placeholder: "Set customer or vendor",
14977
+ isReadOnly: !categorizationEnabled,
14978
+ showLabel: false
14979
+ }
14980
+ ) }),
14981
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__expanded-bank-transaction-row__table-cell--split-entry__button", children: /* @__PURE__ */ jsxRuntime.jsx(
14982
+ Button,
14983
+ {
14984
+ onPress: () => removeSplit(index2),
14985
+ variant: "outlined",
14986
+ icon: true,
14987
+ isDisabled: index2 == 0,
14988
+ children: /* @__PURE__ */ jsxRuntime.jsx(Trash, { size: 18 })
14989
+ }
14990
+ ) })
14974
14991
  ]
14975
- }
14976
- ) }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
14992
+ },
14993
+ `split-${index2}`
14994
+ )) }),
14995
+ splitFormError && /* @__PURE__ */ jsxRuntime.jsx(HStack, { pb: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: splitFormError }) }),
14996
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className}__total-and-btns`, children: [
14997
+ effectiveSplits.length > 1 && /* @__PURE__ */ jsxRuntime.jsx(
14998
+ Input$1,
14999
+ {
15000
+ disabled: true,
15001
+ leftText: "Total",
15002
+ inputMode: "numeric",
15003
+ value: `$${centsToDollars(
15004
+ effectiveSplits.reduce(
15005
+ (x, { amount }) => x + amount,
15006
+ 0
15007
+ )
15008
+ )}`
15009
+ }
15010
+ ),
15011
+ categorizationEnabled ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${className}__splits-buttons`, children: effectiveSplits.length > 1 ? /* @__PURE__ */ jsxRuntime.jsx(
15012
+ TextButton,
15013
+ {
15014
+ onClick: addSplit,
15015
+ children: "Add new split"
15016
+ }
15017
+ ) : /* @__PURE__ */ jsxRuntime.jsxs(
15018
+ Button,
15019
+ {
15020
+ onClick: addSplit,
15021
+ variant: "outlined",
15022
+ children: [
15023
+ /* @__PURE__ */ jsxRuntime.jsx(ScissorsFullOpen, { size: 14 }),
15024
+ "Split"
15025
+ ]
15026
+ }
15027
+ ) }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
15028
+ ] })
14977
15029
  ] })
14978
- ] })
14979
- }
14980
- )
14981
- ] }),
14982
- /* @__PURE__ */ jsxRuntime.jsx(
14983
- BankTransactionFormFields,
14984
- {
14985
- bankTransaction,
14986
- showDescriptions,
14987
- hideTags: purpose === "categorize",
14988
- hideCustomerVendor: purpose === "categorize"
14989
- /* categorize */
14990
- }
14991
- ),
14992
- showReceiptUploads && /* @__PURE__ */ jsxRuntime.jsx(
14993
- BankTransactionReceiptsWithProvider,
14994
- {
14995
- bankTransaction,
14996
- isActive: isOpen,
14997
- classNamePrefix: className,
14998
- floatingActions: !asListItem
14999
- }
15000
- ),
15001
- asListItem && categorizationEnabled ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className}__submit-btn`, children: [
15002
- bankTransaction.error ? /* @__PURE__ */ jsxRuntime.jsxs(
15003
- Text,
15030
+ }
15031
+ )
15032
+ ] }),
15033
+ /* @__PURE__ */ jsxRuntime.jsx(VStack, { pis: "md", className: "Layer__ExpandedBankTransactionRow__Description", children: /* @__PURE__ */ jsxRuntime.jsx(
15034
+ BankTransactionFormFields,
15004
15035
  {
15005
- as: "span",
15006
- size: TextSize.md,
15007
- className: "Layer__unsaved-info",
15008
- children: [
15009
- /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Unsaved" }),
15010
- /* @__PURE__ */ jsxRuntime.jsx(AlertCircle, { size: 12 })
15011
- ]
15036
+ bankTransaction,
15037
+ showDescriptions,
15038
+ hideTags: purpose === "categorize",
15039
+ hideCustomerVendor: purpose === "categorize"
15040
+ /* categorize */
15012
15041
  }
15013
- ) : null,
15014
- /* @__PURE__ */ jsxRuntime.jsx(
15015
- SubmitButton,
15042
+ ) }),
15043
+ showReceiptUploads && /* @__PURE__ */ jsxRuntime.jsx(
15044
+ BankTransactionReceiptsWithProvider,
15016
15045
  {
15017
- onClick: () => {
15018
- if (!bankTransaction.processing) {
15019
- void save();
15020
- }
15021
- },
15022
- className: "Layer__bank-transaction__submit-btn",
15023
- processing: bankTransaction.processing,
15024
- active: true,
15025
- action: categorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
15026
- children: submitBtnText
15046
+ bankTransaction,
15047
+ isActive: isOpen,
15048
+ classNamePrefix: className,
15049
+ floatingActions: !asListItem
15027
15050
  }
15028
- )
15029
- ] }) : null
15030
- ]
15031
- }
15032
- ),
15033
- /* @__PURE__ */ jsxRuntime.jsx(
15034
- APIErrorNotifications,
15035
- {
15036
- bankTransaction,
15037
- containerWidth
15038
- }
15039
- )
15051
+ ),
15052
+ asListItem && categorizationEnabled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className}__submit-btn`, children: [
15053
+ bankTransaction.error && /* @__PURE__ */ jsxRuntime.jsxs(
15054
+ Text,
15055
+ {
15056
+ as: "span",
15057
+ size: TextSize.md,
15058
+ className: "Layer__unsaved-info",
15059
+ children: [
15060
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: "Unsaved" }),
15061
+ /* @__PURE__ */ jsxRuntime.jsx(AlertCircle, { size: 12 })
15062
+ ]
15063
+ }
15064
+ ),
15065
+ /* @__PURE__ */ jsxRuntime.jsx(
15066
+ SubmitButton,
15067
+ {
15068
+ onClick: save,
15069
+ className: "Layer__bank-transaction__submit-btn",
15070
+ processing: bankTransaction.processing,
15071
+ active: true,
15072
+ action: categorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
15073
+ children: submitBtnText
15074
+ }
15075
+ )
15076
+ ] })
15077
+ ]
15078
+ }
15079
+ ),
15080
+ /* @__PURE__ */ jsxRuntime.jsx(
15081
+ APIErrorNotifications,
15082
+ {
15083
+ bankTransaction,
15084
+ containerWidth
15085
+ }
15086
+ )
15087
+ ] }) })
15040
15088
  ] })
15041
15089
  }
15042
15090
  );
@@ -15163,8 +15211,8 @@ const getMonthNameFromNumber = (monthNumber) => {
15163
15211
  }
15164
15212
  return (_a = monthNames.at(monthNumber - 1)) != null ? _a : "";
15165
15213
  };
15166
- const Clock = (_Ab) => {
15167
- var _Bb = _Ab, { size = 18 } = _Bb, props = __objRest(_Bb, ["size"]);
15214
+ const Clock = (_Cb) => {
15215
+ var _Db = _Cb, { size = 18 } = _Db, props = __objRest(_Db, ["size"]);
15168
15216
  return /* @__PURE__ */ jsxRuntime.jsxs(
15169
15217
  "svg",
15170
15218
  __spreadProps(__spreadValues({
@@ -15447,10 +15495,14 @@ const BankTransactionRow = ({
15447
15495
  __spreadProps(__spreadValues(__spreadValues({
15448
15496
  className: `Layer__table-cell Layer__table-cell__amount-col Layer__bank-transactions__amount-col Layer__table-cell--amount ${className}__table-cell--amount-${isCredit(bankTransaction) ? "credit" : "debit"}`
15449
15497
  }, openRow), showReceiptDataProperties), {
15450
- children: /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "Layer__table-cell-content", children: [
15451
- isCredit(bankTransaction) ? "+$" : " $",
15452
- centsToDollars(bankTransaction.amount)
15453
- ] })
15498
+ children: /* @__PURE__ */ jsxRuntime.jsx(VStack, { align: "end", children: /* @__PURE__ */ jsxRuntime.jsx(
15499
+ MoneySpan,
15500
+ {
15501
+ amount: bankTransaction.amount,
15502
+ displayPlusSign: isCredit(bankTransaction),
15503
+ className: "Layer__table-cell-content"
15504
+ }
15505
+ ) })
15454
15506
  })
15455
15507
  ),
15456
15508
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -15471,7 +15523,7 @@ const BankTransactionRow = ({
15471
15523
  `${className}__actions-cell--${open ? "open" : "close"}`
15472
15524
  ),
15473
15525
  children: open ? /* @__PURE__ */ jsxRuntime.jsxs(HStack, { pie: "md", gap: "md", justify: "end", className: "Layer__bank-transaction-row__category-open", children: [
15474
- bankTransaction.error ? /* @__PURE__ */ jsxRuntime.jsxs(
15526
+ bankTransaction.error && /* @__PURE__ */ jsxRuntime.jsxs(
15475
15527
  Text,
15476
15528
  {
15477
15529
  as: "span",
@@ -15482,8 +15534,8 @@ const BankTransactionRow = ({
15482
15534
  /* @__PURE__ */ jsxRuntime.jsx(AlertCircle, { size: 12 })
15483
15535
  ]
15484
15536
  }
15485
- ) : null,
15486
- categorizationEnabled ? /* @__PURE__ */ jsxRuntime.jsx(
15537
+ ),
15538
+ categorizationEnabled && /* @__PURE__ */ jsxRuntime.jsx(
15487
15539
  SubmitButton,
15488
15540
  {
15489
15541
  onClick: () => {
@@ -15497,8 +15549,8 @@ const BankTransactionRow = ({
15497
15549
  action: categorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
15498
15550
  children: categorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Confirm"
15499
15551
  }
15500
- ) : null,
15501
- !categorizationEnabled && !categorized ? /* @__PURE__ */ jsxRuntime.jsx(VStack, { children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) }) : null,
15552
+ ),
15553
+ !categorizationEnabled && !categorized && /* @__PURE__ */ jsxRuntime.jsx(VStack, { children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) }),
15502
15554
  /* @__PURE__ */ jsxRuntime.jsx(
15503
15555
  IconButton,
15504
15556
  {
@@ -15514,26 +15566,36 @@ const BankTransactionRow = ({
15514
15566
  }
15515
15567
  )
15516
15568
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(HStack, { pi: "md", gap: "md", className: "Layer__bank-transaction-row__category-hstack", children: [
15517
- categorizationEnabled && !categorized ? /* @__PURE__ */ jsxRuntime.jsx(
15518
- BankTransactionCategoryComboBox,
15569
+ /* @__PURE__ */ jsxRuntime.jsx(
15570
+ AnimatedContent,
15519
15571
  {
15520
- bankTransaction,
15521
- selectedValue: selectedCategory != null ? selectedCategory : null,
15522
- onSelectedValueChange: (selectedCategory2) => {
15523
- setTransactionCategory(bankTransaction.id, selectedCategory2);
15524
- setShowRetry(false);
15525
- },
15526
- isLoading: bankTransaction.processing
15527
- }
15528
- ) : null,
15529
- categorized ? /* @__PURE__ */ jsxRuntime.jsx(
15572
+ variant: "fade",
15573
+ isOpen: categorizationEnabled && !categorized,
15574
+ className: "Layer__BankTransactionRow__CategoryComboBoxMotionContent",
15575
+ slotProps: { AnimatePresence: { mode: "wait" } },
15576
+ children: /* @__PURE__ */ jsxRuntime.jsx(
15577
+ BankTransactionCategoryComboBox,
15578
+ {
15579
+ bankTransaction,
15580
+ selectedValue: selectedCategory != null ? selectedCategory : null,
15581
+ onSelectedValueChange: (selectedCategory2) => {
15582
+ setTransactionCategory(bankTransaction.id, selectedCategory2);
15583
+ setShowRetry(false);
15584
+ },
15585
+ isLoading: bankTransaction.processing
15586
+ }
15587
+ )
15588
+ },
15589
+ "category-combobox"
15590
+ ),
15591
+ categorized && /* @__PURE__ */ jsxRuntime.jsx(
15530
15592
  BankTransactionsCategorizedSelectedValue,
15531
15593
  {
15532
15594
  bankTransaction,
15533
15595
  className: "Layer__bank-transaction-row__category"
15534
15596
  }
15535
- ) : null,
15536
- categorizationEnabled && !categorized && showRetry ? /* @__PURE__ */ jsxRuntime.jsx(
15597
+ ),
15598
+ categorizationEnabled && !categorized && showRetry && /* @__PURE__ */ jsxRuntime.jsx(
15537
15599
  RetryButton,
15538
15600
  {
15539
15601
  onClick: () => {
@@ -15546,8 +15608,8 @@ const BankTransactionRow = ({
15546
15608
  error: "Approval failed. Check connection and retry in few seconds.",
15547
15609
  children: "Retry"
15548
15610
  }
15549
- ) : null,
15550
- !categorized && categorizationEnabled && !showRetry ? /* @__PURE__ */ jsxRuntime.jsx(
15611
+ ),
15612
+ !categorized && categorizationEnabled && !showRetry && /* @__PURE__ */ jsxRuntime.jsx(
15551
15613
  SubmitButton,
15552
15614
  {
15553
15615
  onClick: () => {
@@ -15561,8 +15623,8 @@ const BankTransactionRow = ({
15561
15623
  action: categorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
15562
15624
  children: categorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Confirm"
15563
15625
  }
15564
- ) : null,
15565
- !categorizationEnabled && !categorized ? /* @__PURE__ */ jsxRuntime.jsx(VStack, { pis: "xs", fluid: true, children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) }) : null,
15626
+ ),
15627
+ !categorizationEnabled && !categorized && /* @__PURE__ */ jsxRuntime.jsx(VStack, { pis: "xs", fluid: true, children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) }),
15566
15628
  /* @__PURE__ */ jsxRuntime.jsx(
15567
15629
  IconButton,
15568
15630
  {
@@ -15581,7 +15643,7 @@ const BankTransactionRow = ({
15581
15643
  }
15582
15644
  )
15583
15645
  ] }),
15584
- /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, className: "Layer__bank-transaction-row__expanded-td", children: /* @__PURE__ */ jsxRuntime.jsx(
15646
+ /* @__PURE__ */ jsxRuntime.jsx("tr", { children: /* @__PURE__ */ jsxRuntime.jsx("td", { colSpan, className: "Layer__bank-transaction-row__expanded-td", children: /* @__PURE__ */ jsxRuntime.jsx(AnimatedContent, { variant: "expand", isOpen: open, children: /* @__PURE__ */ jsxRuntime.jsx(
15585
15647
  ExpandedBankTransactionRow,
15586
15648
  {
15587
15649
  ref: expandedRowRef,
@@ -15594,7 +15656,7 @@ const BankTransactionRow = ({
15594
15656
  showReceiptUploads,
15595
15657
  showTooltips
15596
15658
  }
15597
- ) }) })
15659
+ ) }, `expanded-${bankTransaction.id}`) }) })
15598
15660
  ] });
15599
15661
  };
15600
15662
  const BankTransactionsCategorizedSelectedValue = (props) => {
@@ -15621,6 +15683,40 @@ const normalizeFromBankTransaction = (bankTransaction) => {
15621
15683
  label: (_e = (_d = bankTransaction.category) == null ? void 0 : _d.display_name) != null ? _e : ""
15622
15684
  };
15623
15685
  };
15686
+ const BankTransactionsListItemCategory = ({
15687
+ bankTransaction,
15688
+ mobile = false
15689
+ }) => {
15690
+ const className = mobile ? "Layer__bankTransactionsListItemCategory__Mobile" : "Layer__bankTransactionsListItemCategory__List";
15691
+ const categorized = isCategorized(bankTransaction);
15692
+ const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
15693
+ if (categorized) {
15694
+ return /* @__PURE__ */ jsxRuntime.jsx(
15695
+ BankTransactionsCategorizedSelectedValue,
15696
+ {
15697
+ bankTransaction,
15698
+ className,
15699
+ slotProps: { Label: { size: "sm" } }
15700
+ }
15701
+ );
15702
+ }
15703
+ return selectedCategory ? /* @__PURE__ */ jsxRuntime.jsx(
15704
+ BankTransactionsUncategorizedSelectedValue,
15705
+ {
15706
+ selectedValue: selectedCategory != null ? selectedCategory : null,
15707
+ className,
15708
+ slotProps: { Label: { size: "sm" } }
15709
+ }
15710
+ ) : /* @__PURE__ */ jsxRuntime.jsx(
15711
+ BankTransactionsBaseSelectedValue,
15712
+ {
15713
+ type: "placeholder",
15714
+ label: "No category selected",
15715
+ className,
15716
+ slotProps: { Label: { size: "sm" } }
15717
+ }
15718
+ );
15719
+ };
15624
15720
  const BankTransactionsListItem = ({
15625
15721
  index: index2,
15626
15722
  dateFormat,
@@ -15675,6 +15771,9 @@ const BankTransactionsListItem = ({
15675
15771
  deselect(bankTransaction.id);
15676
15772
  setOpenExpandedRow(false);
15677
15773
  });
15774
+ const handleSave = () => {
15775
+ void save();
15776
+ };
15678
15777
  const openClassName = openExpandedRow ? "Layer__bank-transaction-list-item--expanded" : "";
15679
15778
  const rowClassName = classNames(
15680
15779
  "Layer__bank-transaction-list-item",
@@ -15731,14 +15830,14 @@ const BankTransactionsListItem = ({
15731
15830
  /* @__PURE__ */ jsxRuntime.jsx(
15732
15831
  MoneySpan,
15733
15832
  {
15734
- className: `Layer__bank-transaction-list-item__amount-${isCredit(bankTransaction) ? "credit" : "debit"}`,
15735
15833
  amount: bankTransaction.amount,
15736
- displayPlusSign: isCredit(bankTransaction)
15834
+ displayPlusSign: isCredit(bankTransaction),
15835
+ size: "md"
15737
15836
  }
15738
15837
  )
15739
15838
  ] }),
15740
- !categorizationEnabled && !categorized ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__bank-transaction-list-item__processing-info", children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) }) : null,
15741
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__bank-transaction-list-item__expanded-row", children: /* @__PURE__ */ jsxRuntime.jsx(
15839
+ !categorizationEnabled && !categorized && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__bank-transaction-list-item__processing-info", children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) }),
15840
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__bank-transaction-list-item__expanded-row", children: /* @__PURE__ */ jsxRuntime.jsx(AnimatedContent, { variant: "expand", isOpen: openExpandedRow, children: /* @__PURE__ */ jsxRuntime.jsx(
15742
15841
  ExpandedBankTransactionRow,
15743
15842
  {
15744
15843
  ref: expandedRowRef,
@@ -15751,11 +15850,12 @@ const BankTransactionsListItem = ({
15751
15850
  containerWidth,
15752
15851
  showDescriptions,
15753
15852
  showReceiptUploads,
15754
- showTooltips
15853
+ showTooltips,
15854
+ showLeftPadding: false
15755
15855
  }
15756
- ) }),
15757
- /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "Layer__bank-transaction-list-item__base-row", children: [
15758
- categorizationEnabled && !categorized ? /* @__PURE__ */ jsxRuntime.jsx(
15856
+ ) }, `expanded-${bankTransaction.id}`) }),
15857
+ !openExpandedRow && categorizationEnabled && !categorized && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { pi: "md", gap: "md", pb: "md", children: [
15858
+ /* @__PURE__ */ jsxRuntime.jsx(
15759
15859
  BankTransactionCategoryComboBox,
15760
15860
  {
15761
15861
  bankTransaction,
@@ -15766,48 +15866,36 @@ const BankTransactionsListItem = ({
15766
15866
  },
15767
15867
  isLoading: bankTransaction.processing
15768
15868
  }
15769
- ) : null,
15770
- categorized ? /* @__PURE__ */ jsxRuntime.jsx(
15771
- BankTransactionsCategorizedSelectedValue,
15772
- {
15773
- bankTransaction
15774
- }
15775
- ) : selectedCategory ? /* @__PURE__ */ jsxRuntime.jsx(
15776
- BankTransactionsUncategorizedSelectedValue,
15777
- {
15778
- selectedValue: selectedCategory
15779
- }
15780
- ) : null,
15781
- categorizationEnabled && !categorized && !showRetry ? /* @__PURE__ */ jsxRuntime.jsx(
15869
+ ),
15870
+ !showRetry && /* @__PURE__ */ jsxRuntime.jsx(
15782
15871
  SubmitButton,
15783
15872
  {
15784
- onClick: () => {
15785
- if (!bankTransaction.processing) {
15786
- void save();
15787
- }
15788
- },
15873
+ disabled: bankTransaction.processing,
15874
+ onClick: handleSave,
15789
15875
  className: "Layer__bank-transaction__submit-btn",
15790
15876
  processing: bankTransaction.processing,
15791
15877
  action: !categorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
15792
15878
  children: !categorized ? (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Approve" : (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update"
15793
15879
  }
15794
- ) : null,
15795
- categorizationEnabled && !categorized && showRetry ? /* @__PURE__ */ jsxRuntime.jsx(
15880
+ ),
15881
+ showRetry && /* @__PURE__ */ jsxRuntime.jsx(
15796
15882
  RetryButton,
15797
15883
  {
15798
- onClick: () => {
15799
- if (!bankTransaction.processing) {
15800
- void save();
15801
- }
15802
- },
15884
+ onClick: handleSave,
15803
15885
  className: "Layer__bank-transaction__retry-btn",
15804
15886
  processing: bankTransaction.processing,
15805
15887
  error: "Approval failed. Check connection and retry in few seconds.",
15806
15888
  children: "Retry"
15807
15889
  }
15808
- ) : null
15890
+ )
15809
15891
  ] }),
15810
- bankTransaction.error && showRetry ? /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
15892
+ !openExpandedRow && categorizationEnabled && categorized && /* @__PURE__ */ jsxRuntime.jsx(
15893
+ BankTransactionsListItemCategory,
15894
+ {
15895
+ bankTransaction
15896
+ }
15897
+ ),
15898
+ bankTransaction.error && showRetry && /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." })
15811
15899
  ] });
15812
15900
  };
15813
15901
  const useBankTransactionsTableCheckboxState = ({ bankTransactions }) => {
@@ -15912,53 +16000,52 @@ const BankTransactionsList = ({
15912
16000
  ) })
15913
16001
  ] });
15914
16002
  };
15915
- const CloseIcon = (_Cb) => {
15916
- var _Db = _Cb, { size = 12 } = _Db, props = __objRest(_Db, ["size"]);
15917
- return /* @__PURE__ */ jsxRuntime.jsxs(
15918
- "svg",
15919
- __spreadProps(__spreadValues({
15920
- viewBox: "0 0 12 12",
15921
- fill: "none",
15922
- xmlns: "http://www.w3.org/2000/svg"
15923
- }, props), {
15924
- width: size,
15925
- height: size,
15926
- children: [
15927
- /* @__PURE__ */ jsxRuntime.jsx(
15928
- "path",
15929
- {
15930
- d: "M8.75 3.25L3.25 8.75",
15931
- stroke: "currentColor",
15932
- strokeLinecap: "round",
15933
- strokeLinejoin: "round"
15934
- }
15935
- ),
15936
- /* @__PURE__ */ jsxRuntime.jsx(
15937
- "path",
15938
- {
15939
- d: "M3.25 3.25L8.75 8.75",
15940
- stroke: "currentColor",
15941
- strokeLinecap: "round",
15942
- strokeLinejoin: "round"
15943
- }
15944
- )
15945
- ]
15946
- })
15947
- );
16003
+ const useTransactionToOpen = () => {
16004
+ const [transactionIdToOpen, setTransactionIdToOpen] = react.useState(void 0);
16005
+ const clearTransactionIdToOpen = react.useCallback(() => setTransactionIdToOpen(void 0), []);
16006
+ return {
16007
+ transactionIdToOpen,
16008
+ setTransactionIdToOpen,
16009
+ clearTransactionIdToOpen
16010
+ };
15948
16011
  };
15949
- const CloseButton = (_Eb) => {
15950
- var _Fb = _Eb, {
15951
- className,
15952
- textOnly = false
15953
- } = _Fb, props = __objRest(_Fb, [
15954
- "className",
15955
- "textOnly"
15956
- ]);
15957
- const baseClassName2 = classNames("Layer__btn", "Layer__back-btn", className);
15958
- return /* @__PURE__ */ jsxRuntime.jsx("button", __spreadProps(__spreadValues({}, props), { className: baseClassName2, children: textOnly ? "Back" : /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, { size: 16 }) }));
16012
+ const TransactionToOpenContext = react.createContext({
16013
+ transactionIdToOpen: void 0,
16014
+ setTransactionIdToOpen: () => void 0,
16015
+ clearTransactionIdToOpen: () => void 0
16016
+ });
16017
+ const BankTransactionsMobileListItemCheckbox = ({
16018
+ bulkActionsEnabled,
16019
+ bankTransaction,
16020
+ checkboxContainerRef
16021
+ }) => {
16022
+ const internalRef = react.useRef(null);
16023
+ const ref = checkboxContainerRef || internalRef;
16024
+ const bookkeepingStatus = useEffectiveBookkeepingStatus();
16025
+ const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
16026
+ const { select, deselect } = useBulkSelectionActions();
16027
+ const isSelected = useIdIsSelected();
16028
+ const isTransactionSelected = isSelected(bankTransaction.id);
16029
+ if (!categorizationEnabled || !bulkActionsEnabled) {
16030
+ return null;
16031
+ }
16032
+ return /* @__PURE__ */ jsxRuntime.jsx(VStack, { align: "start", pis: "md", pie: "2xs", ref, children: /* @__PURE__ */ jsxRuntime.jsx(
16033
+ Checkbox,
16034
+ {
16035
+ size: "md",
16036
+ isSelected: isTransactionSelected,
16037
+ onChange: (selected) => {
16038
+ if (selected) {
16039
+ select(bankTransaction.id);
16040
+ } else {
16041
+ deselect(bankTransaction.id);
16042
+ }
16043
+ }
16044
+ }
16045
+ ) });
15959
16046
  };
15960
- const Paperclip = (_Gb) => {
15961
- var _Hb = _Gb, { size = 20 } = _Hb, props = __objRest(_Hb, ["size"]);
16047
+ const Paperclip = (_Eb) => {
16048
+ var _Fb = _Eb, { size = 20 } = _Fb, props = __objRest(_Fb, ["size"]);
15962
16049
  return /* @__PURE__ */ jsxRuntime.jsx(
15963
16050
  "svg",
15964
16051
  __spreadProps(__spreadValues({
@@ -15980,6 +16067,73 @@ const Paperclip = (_Gb) => {
15980
16067
  })
15981
16068
  );
15982
16069
  };
16070
+ const BusinessFormMobileItem = ({
16071
+ option
16072
+ }) => {
16073
+ const value = option.value.value;
16074
+ const label = option.value.label;
16075
+ return /* @__PURE__ */ jsxRuntime.jsx(
16076
+ reactAriaComponents.GridListItem,
16077
+ {
16078
+ id: value,
16079
+ textValue: label,
16080
+ className: "Layer__BusinessFormMobileItem",
16081
+ children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", pi: "md", pb: "sm", children: [
16082
+ !option.asLink && /* @__PURE__ */ jsxRuntime.jsx(
16083
+ Checkbox,
16084
+ {
16085
+ slot: "selection",
16086
+ variant: "round"
16087
+ }
16088
+ ),
16089
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", children: label }),
16090
+ option.asLink && /* @__PURE__ */ jsxRuntime.jsx(
16091
+ ChevronRight,
16092
+ {
16093
+ size: 16,
16094
+ className: "Layer__BusinessFormMobileItem__link-icon"
16095
+ }
16096
+ )
16097
+ ] })
16098
+ },
16099
+ value
16100
+ );
16101
+ };
16102
+ const BusinessFormMobile = ({
16103
+ options: options2,
16104
+ selectedId,
16105
+ onSelect,
16106
+ readOnly
16107
+ }) => {
16108
+ const handleSelectionChange = react.useCallback((keys2) => {
16109
+ if (readOnly) return;
16110
+ const selectedKey = [...keys2][0];
16111
+ const selectedOption = options2.find((opt) => opt.value.value === selectedKey);
16112
+ if (selectedOption) {
16113
+ onSelect(selectedOption);
16114
+ }
16115
+ }, [options2, onSelect, readOnly]);
16116
+ return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
16117
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", weight: "bold", children: "Select category" }),
16118
+ /* @__PURE__ */ jsxRuntime.jsx(
16119
+ reactAriaComponents.GridList,
16120
+ {
16121
+ "aria-label": "Select a category",
16122
+ selectionMode: "single",
16123
+ selectedKeys: selectedId ? /* @__PURE__ */ new Set([selectedId]) : /* @__PURE__ */ new Set(),
16124
+ onSelectionChange: handleSelectionChange,
16125
+ className: "Layer__BusinessFormMobile",
16126
+ children: options2.map((option) => /* @__PURE__ */ jsxRuntime.jsx(
16127
+ BusinessFormMobileItem,
16128
+ {
16129
+ option
16130
+ },
16131
+ option.value.value
16132
+ ))
16133
+ }
16134
+ )
16135
+ ] });
16136
+ };
15983
16137
  const ActionableList = ({
15984
16138
  options: options2,
15985
16139
  onClick,
@@ -16053,8 +16207,8 @@ const flattenCategories = (categories) => {
16053
16207
  return leafCategories.map((cat) => new CategoryAsOption(cat));
16054
16208
  });
16055
16209
  };
16056
- const X = (_Ib) => {
16057
- var _Jb = _Ib, { size = 18 } = _Jb, props = __objRest(_Jb, ["size"]);
16210
+ const X = (_Gb) => {
16211
+ var _Hb = _Gb, { size = 18 } = _Hb, props = __objRest(_Hb, ["size"]);
16058
16212
  return /* @__PURE__ */ jsxRuntime.jsxs(
16059
16213
  "svg",
16060
16214
  __spreadProps(__spreadValues({
@@ -16088,11 +16242,11 @@ const X = (_Ib) => {
16088
16242
  );
16089
16243
  };
16090
16244
  const CLASS_NAME$7 = "Layer__MinimalSearchField";
16091
- function MinimalSearchField(_Kb) {
16092
- var _Lb = _Kb, {
16245
+ function MinimalSearchField(_Ib) {
16246
+ var _Jb = _Ib, {
16093
16247
  placeholder,
16094
16248
  isDisabled
16095
- } = _Lb, restProps = __objRest(_Lb, [
16249
+ } = _Jb, restProps = __objRest(_Jb, [
16096
16250
  "placeholder",
16097
16251
  "isDisabled"
16098
16252
  ]);
@@ -16108,8 +16262,8 @@ function MinimalSearchField(_Kb) {
16108
16262
  ] }));
16109
16263
  }
16110
16264
  const CLASS_NAME$6 = "Layer__SearchField";
16111
- function SearchField(_Mb) {
16112
- var _Nb = _Mb, { slot = "search", className, label, isDisabled } = _Nb, restProps = __objRest(_Nb, ["slot", "className", "label", "isDisabled"]);
16265
+ function SearchField(_Kb) {
16266
+ var _Lb = _Kb, { slot = "search", className, label, isDisabled } = _Lb, restProps = __objRest(_Lb, ["slot", "className", "label", "isDisabled"]);
16113
16267
  const combinedClassName = classNames(CLASS_NAME$6, className);
16114
16268
  return /* @__PURE__ */ jsxRuntime.jsxs(InputGroup, { slot, className: combinedClassName, children: [
16115
16269
  /* @__PURE__ */ jsxRuntime.jsx(VStack, { slot: "icon", align: "center", justify: "center", className: "Layer__SearchField__Icon", "data-disabled": isDisabled || void 0, children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Search, { size: 14 }) }),
@@ -16126,7 +16280,7 @@ function SearchField(_Mb) {
16126
16280
  const isGroup = (item) => {
16127
16281
  return "categories" in item;
16128
16282
  };
16129
- const BusinessCategories = ({
16283
+ const BankTransactionsMobileListBusinessCategories = ({
16130
16284
  select,
16131
16285
  selectedId,
16132
16286
  showTooltips
@@ -16201,7 +16355,7 @@ const CategorySelectDrawer = ({
16201
16355
  onOpenChange
16202
16356
  }) => {
16203
16357
  return /* @__PURE__ */ jsxRuntime.jsx(Drawer, { isOpen, onOpenChange, variant: "mobile-drawer", isDismissable: true, children: ({ close: close2 }) => /* @__PURE__ */ jsxRuntime.jsx(
16204
- BusinessCategories,
16358
+ BankTransactionsMobileListBusinessCategories,
16205
16359
  {
16206
16360
  select: (option) => {
16207
16361
  onSelect(option);
@@ -16212,7 +16366,11 @@ const CategorySelectDrawer = ({
16212
16366
  }
16213
16367
  ) });
16214
16368
  };
16215
- const BusinessForm$1 = ({
16369
+ const SELECT_CATEGORY_VALUE = "SELECT_CATEGORY";
16370
+ const isSelectCategoryOption = (value) => {
16371
+ return isPlaceholderAsOption(value) && value.value === SELECT_CATEGORY_VALUE;
16372
+ };
16373
+ const BankTransactionsMobileListBusinessForm = ({
16216
16374
  bankTransaction,
16217
16375
  showCategorization,
16218
16376
  showDescriptions,
@@ -16221,6 +16379,17 @@ const BusinessForm$1 = ({
16221
16379
  }) => {
16222
16380
  const receiptsRef = react.useRef(null);
16223
16381
  const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
16382
+ const [sessionCategories, setSessionCategories] = react.useState(() => {
16383
+ var _a;
16384
+ const initialMap = /* @__PURE__ */ new Map();
16385
+ if (((_a = bankTransaction == null ? void 0 : bankTransaction.categorization_flow) == null ? void 0 : _a.type) === CategorizationType.ASK_FROM_SUGGESTIONS) {
16386
+ bankTransaction.categorization_flow.suggestions.forEach((suggestion) => {
16387
+ const opt = new ApiCategorizationAsOption(suggestion);
16388
+ initialMap.set(opt.value, opt);
16389
+ });
16390
+ }
16391
+ return initialMap;
16392
+ });
16224
16393
  const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
16225
16394
  const { setTransactionCategory } = useBankTransactionsCategoryActions();
16226
16395
  const [showRetry, setShowRetry] = react.useState(false);
@@ -16231,42 +16400,26 @@ const BusinessForm$1 = ({
16231
16400
  }
16232
16401
  }, [bankTransaction.error]);
16233
16402
  const options2 = react.useMemo(() => {
16234
- var _a;
16235
- const options22 = ((_a = bankTransaction == null ? void 0 : bankTransaction.categorization_flow) == null ? void 0 : _a.type) === CategorizationType.ASK_FROM_SUGGESTIONS ? bankTransaction.categorization_flow.suggestions.map((x) => {
16236
- var _a2;
16237
- const opt = new ApiCategorizationAsOption(x);
16238
- return {
16239
- label: opt.label,
16240
- id: opt.value,
16241
- description: (_a2 = x.description) != null ? _a2 : void 0,
16242
- value: opt
16243
- };
16244
- }) : [];
16245
- if (selectedCategory && !options22.find((x) => x.id === selectedCategory.value)) {
16246
- options22.unshift({
16247
- label: selectedCategory.label,
16248
- id: selectedCategory.value,
16249
- value: selectedCategory
16250
- });
16251
- }
16252
- if (options22.length) {
16253
- options22.push({
16254
- label: "See all categories",
16255
- id: "SELECT_CATEGORY",
16256
- value: {
16257
- type: "SELECT_CATEGORY"
16258
- },
16259
- secondary: true,
16260
- asLink: true
16261
- });
16262
- }
16403
+ const options22 = Array.from(sessionCategories.values()).map((category) => ({
16404
+ value: category
16405
+ }));
16406
+ options22.push({
16407
+ value: new PlaceholderAsOption({
16408
+ label: "Show all categories",
16409
+ value: "SELECT_CATEGORY"
16410
+ }),
16411
+ asLink: true
16412
+ });
16263
16413
  return options22;
16264
- }, [bankTransaction, selectedCategory]);
16414
+ }, [sessionCategories]);
16265
16415
  const onCategorySelect = (category) => {
16266
- if ("type" in category.value && category.value.type === "SELECT_CATEGORY") {
16416
+ if (isSelectCategoryOption(category.value)) {
16267
16417
  setIsDrawerOpen(true);
16268
16418
  } else {
16269
16419
  const option = category.value;
16420
+ if (!isPlaceholderAsOption(option)) {
16421
+ setSessionCategories((prev) => new Map(prev).set(option.value, option));
16422
+ }
16270
16423
  if (selectedCategory && option.value === selectedCategory.value) {
16271
16424
  setTransactionCategory(bankTransaction.id, null);
16272
16425
  } else {
@@ -16289,22 +16442,28 @@ const BusinessForm$1 = ({
16289
16442
  true
16290
16443
  );
16291
16444
  };
16445
+ const onDrawerSelect = react.useCallback((category) => {
16446
+ if (!category) return;
16447
+ setSessionCategories((prev) => new Map(prev).set(category.value, category));
16448
+ setTransactionCategory(bankTransaction.id, category);
16449
+ }, [bankTransaction.id, setTransactionCategory]);
16292
16450
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16293
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__business-form", children: [
16294
- showCategorization ? /* @__PURE__ */ jsxRuntime.jsx(
16295
- ActionableList,
16451
+ /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
16452
+ showCategorization && /* @__PURE__ */ jsxRuntime.jsx(
16453
+ BusinessFormMobile,
16296
16454
  {
16297
16455
  options: options2,
16298
- onClick: onCategorySelect,
16299
- selectedId: selectedCategory == null ? void 0 : selectedCategory.value,
16300
- showDescriptions: showTooltips
16456
+ onSelect: onCategorySelect,
16457
+ selectedId: selectedCategory == null ? void 0 : selectedCategory.value
16301
16458
  }
16302
- ) : null,
16459
+ ),
16303
16460
  /* @__PURE__ */ jsxRuntime.jsx(
16304
16461
  BankTransactionFormFields,
16305
16462
  {
16306
16463
  bankTransaction,
16307
- showDescriptions
16464
+ showDescriptions,
16465
+ hideCustomerVendor: true,
16466
+ hideTags: true
16308
16467
  }
16309
16468
  ),
16310
16469
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -16325,7 +16484,7 @@ const BusinessForm$1 = ({
16325
16484
  )
16326
16485
  }
16327
16486
  ),
16328
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__actions", children: [
16487
+ /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", children: [
16329
16488
  showReceiptUploads && /* @__PURE__ */ jsxRuntime.jsx(
16330
16489
  FileInput,
16331
16490
  {
@@ -16338,33 +16497,22 @@ const BusinessForm$1 = ({
16338
16497
  icon: /* @__PURE__ */ jsxRuntime.jsx(Paperclip, {})
16339
16498
  }
16340
16499
  ),
16341
- options2.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(
16342
- Button$1,
16343
- {
16344
- onClick: () => {
16345
- setIsDrawerOpen(true);
16346
- },
16347
- fullWidth: true,
16348
- variant: ButtonVariant.secondary,
16349
- children: "Select category"
16350
- }
16351
- ) : null,
16352
- showCategorization && options2.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
16353
- Button$1,
16500
+ showCategorization && sessionCategories.size > 0 && /* @__PURE__ */ jsxRuntime.jsx(
16501
+ Button,
16354
16502
  {
16355
16503
  onClick: save,
16356
- disabled: !selectedCategory || isLoading || bankTransaction.processing,
16357
16504
  fullWidth: true,
16358
- children: isLoading || bankTransaction.processing ? "Confirming..." : "Confirm"
16505
+ isDisabled: !selectedCategory || isLoading || bankTransaction.processing,
16506
+ children: bankTransaction.processing || isLoading ? "Confirming..." : "Confirm"
16359
16507
  }
16360
- ) : null
16508
+ )
16361
16509
  ] }),
16362
16510
  bankTransaction.error && showRetry ? /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
16363
16511
  ] }),
16364
16512
  /* @__PURE__ */ jsxRuntime.jsx(
16365
16513
  CategorySelectDrawer,
16366
16514
  {
16367
- onSelect: (category) => setTransactionCategory(bankTransaction.id, category),
16515
+ onSelect: onDrawerSelect,
16368
16516
  selectedId: selectedCategory == null ? void 0 : selectedCategory.value,
16369
16517
  showTooltips,
16370
16518
  isOpen: isDrawerOpen,
@@ -16388,7 +16536,7 @@ const isAlreadyAssigned = (bankTransaction) => {
16388
16536
  )
16389
16537
  );
16390
16538
  };
16391
- const PersonalForm = ({
16539
+ const BankTransactionsMobileListPersonalForm = ({
16392
16540
  bankTransaction,
16393
16541
  showReceiptUploads,
16394
16542
  showDescriptions,
@@ -16419,12 +16567,14 @@ const PersonalForm = ({
16419
16567
  );
16420
16568
  };
16421
16569
  const alreadyAssigned = isAlreadyAssigned(bankTransaction);
16422
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__personal-form", children: [
16570
+ return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
16423
16571
  /* @__PURE__ */ jsxRuntime.jsx(
16424
16572
  BankTransactionFormFields,
16425
16573
  {
16426
16574
  bankTransaction,
16427
- showDescriptions
16575
+ showDescriptions,
16576
+ hideCustomerVendor: true,
16577
+ hideTags: true
16428
16578
  }
16429
16579
  ),
16430
16580
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -16445,7 +16595,7 @@ const PersonalForm = ({
16445
16595
  )
16446
16596
  }
16447
16597
  ),
16448
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__actions", children: [
16598
+ /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", children: [
16449
16599
  showReceiptUploads && /* @__PURE__ */ jsxRuntime.jsx(
16450
16600
  FileInput,
16451
16601
  {
@@ -16458,98 +16608,131 @@ const PersonalForm = ({
16458
16608
  icon: /* @__PURE__ */ jsxRuntime.jsx(Paperclip, {})
16459
16609
  }
16460
16610
  ),
16461
- showCategorization ? /* @__PURE__ */ jsxRuntime.jsx(
16462
- Button$1,
16611
+ showCategorization && /* @__PURE__ */ jsxRuntime.jsx(
16612
+ Button,
16463
16613
  {
16464
16614
  fullWidth: true,
16465
- disabled: alreadyAssigned || isLoading || bankTransaction.processing,
16466
16615
  onClick: save,
16467
- children: isLoading || bankTransaction.processing ? "Saving..." : alreadyAssigned ? "Saved as Personal" : "Categorize as Personal"
16616
+ isDisabled: alreadyAssigned || isLoading || bankTransaction.processing,
16617
+ children: bankTransaction.processing || isLoading ? "Confirming..." : alreadyAssigned ? "Confirmed" : "Mark as Personal"
16468
16618
  }
16469
- ) : null
16619
+ )
16470
16620
  ] }),
16471
16621
  bankTransaction.error && showRetry ? /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
16472
16622
  ] });
16473
16623
  };
16624
+ const DATE_FORMAT = "LLL d";
16625
+ const BankTransactionsAmountDate = ({ amount, date: date2, slotProps }) => {
16626
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16627
+ VStack,
16628
+ {
16629
+ align: "end",
16630
+ gap: "3xs",
16631
+ pb: "sm",
16632
+ children: [
16633
+ /* @__PURE__ */ jsxRuntime.jsx(HStack, { children: /* @__PURE__ */ jsxRuntime.jsx(
16634
+ MoneySpan,
16635
+ __spreadValues({
16636
+ amount
16637
+ }, slotProps == null ? void 0 : slotProps.MoneySpan)
16638
+ ) }),
16639
+ /* @__PURE__ */ jsxRuntime.jsx(
16640
+ DateTime,
16641
+ {
16642
+ value: date2,
16643
+ dateFormat: DATE_FORMAT,
16644
+ onlyDate: true,
16645
+ slotProps: {
16646
+ Date: __spreadValues({
16647
+ variant: "subtle",
16648
+ size: "sm"
16649
+ }, slotProps == null ? void 0 : slotProps.DateTime)
16650
+ }
16651
+ }
16652
+ )
16653
+ ]
16654
+ }
16655
+ );
16656
+ };
16657
+ const MatchFormMobileItem = ({ match, bankTransaction, inAppLink }) => {
16658
+ return /* @__PURE__ */ jsxRuntime.jsx(
16659
+ reactAriaComponents.GridListItem,
16660
+ {
16661
+ id: match.id,
16662
+ textValue: match.details.description,
16663
+ children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { pi: "md", gap: "md", justify: "space-between", children: [
16664
+ /* @__PURE__ */ jsxRuntime.jsxs(HStack, { align: "center", children: [
16665
+ /* @__PURE__ */ jsxRuntime.jsx(
16666
+ Checkbox,
16667
+ {
16668
+ slot: "selection",
16669
+ variant: "round",
16670
+ className: "Layer__MatchFormMobileItem__Checkbox"
16671
+ }
16672
+ ),
16673
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", children: match.details.description })
16674
+ ] }),
16675
+ /* @__PURE__ */ jsxRuntime.jsx(
16676
+ BankTransactionsAmountDate,
16677
+ {
16678
+ amount: match.details.amount,
16679
+ date: match.details.date,
16680
+ slotProps: {
16681
+ MoneySpan: { size: "sm", displayPlusSign: isCredit(bankTransaction) },
16682
+ DateTime: { size: "xs" }
16683
+ }
16684
+ }
16685
+ ),
16686
+ inAppLink
16687
+ ] })
16688
+ },
16689
+ match.id
16690
+ );
16691
+ };
16474
16692
  const MatchFormMobile = ({
16475
- classNamePrefix,
16476
16693
  bankTransaction,
16477
16694
  selectedMatchId,
16478
16695
  setSelectedMatch,
16479
16696
  matchFormError,
16480
16697
  readOnly
16481
16698
  }) => {
16482
- var _a;
16483
16699
  const { renderInAppLink } = useInAppLinkContext();
16484
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classNamePrefix}__match-list`, children: [
16485
- (_a = bankTransaction.suggested_matches) == null ? void 0 : _a.map((match, idx) => {
16486
- const matchDetails = match.details ? decodeMatchDetails(match.details) : void 0;
16487
- const inAppLink = renderInAppLink && matchDetails ? renderInAppLink(convertMatchDetailsToLinkingMetadata(matchDetails)) : null;
16488
- return /* @__PURE__ */ jsxRuntime.jsxs(
16489
- "div",
16490
- {
16491
- className: classNames(
16492
- `${classNamePrefix}__match-item`,
16493
- match.id === selectedMatchId ? `${classNamePrefix}__match-item--selected` : ""
16494
- ),
16495
- onClick: () => {
16496
- if (readOnly) {
16497
- return;
16498
- }
16499
- setSelectedMatch(match);
16500
- },
16501
- children: [
16502
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classNamePrefix}__match-item__col-details`, children: [
16503
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classNamePrefix}__match-item__heading`, children: [
16504
- /* @__PURE__ */ jsxRuntime.jsx(
16505
- Text,
16506
- {
16507
- className: `${classNamePrefix}__match-item__name`,
16508
- as: "span",
16509
- children: match.details.description
16510
- }
16511
- ),
16512
- /* @__PURE__ */ jsxRuntime.jsxs(
16513
- Text,
16514
- {
16515
- className: `${classNamePrefix}__match-item__amount`,
16516
- as: "span",
16517
- children: [
16518
- "$",
16519
- centsToDollars(match.details.amount)
16520
- ]
16521
- }
16522
- )
16523
- ] }),
16524
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${classNamePrefix}__match-item__details`, children: [
16525
- /* @__PURE__ */ jsxRuntime.jsx(HStack, { children: inAppLink }),
16526
- /* @__PURE__ */ jsxRuntime.jsx(
16527
- Text,
16528
- {
16529
- className: `${classNamePrefix}__match-item__date`,
16530
- size: TextSize.sm,
16531
- as: "span",
16532
- children: dateFns.format(dateFns.parseISO(match.details.date), MONTH_DAY_FORMAT)
16533
- }
16534
- )
16535
- ] })
16536
- ] }),
16537
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: `${classNamePrefix}__match-item__col-status`, children: selectedMatchId && selectedMatchId === match.id ? /* @__PURE__ */ jsxRuntime.jsx(
16538
- Check,
16539
- {
16540
- size: 16,
16541
- className: `${classNamePrefix}__match-item__selected-icon`
16542
- }
16543
- ) : null })
16544
- ]
16545
- },
16546
- idx
16547
- );
16548
- }),
16549
- matchFormError && /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: matchFormError })
16550
- ] });
16700
+ const suggestedMatches = bankTransaction.suggested_matches;
16701
+ return /* @__PURE__ */ jsxRuntime.jsxs(
16702
+ reactAriaComponents.GridList,
16703
+ {
16704
+ "aria-label": "Select a match",
16705
+ selectionMode: "single",
16706
+ selectedKeys: selectedMatchId ? /* @__PURE__ */ new Set([selectedMatchId]) : /* @__PURE__ */ new Set(),
16707
+ onSelectionChange: (keys2) => {
16708
+ if (readOnly) return;
16709
+ const selectedKey = [...keys2][0];
16710
+ const selectedMatch = suggestedMatches == null ? void 0 : suggestedMatches.find((m) => m.id === selectedKey);
16711
+ if (selectedMatch) {
16712
+ setSelectedMatch(selectedMatch);
16713
+ }
16714
+ },
16715
+ className: "Layer__MatchFormMobile",
16716
+ children: [
16717
+ suggestedMatches == null ? void 0 : suggestedMatches.map((match) => {
16718
+ const matchDetails = match.details ? decodeMatchDetails(match.details) : void 0;
16719
+ const inAppLink = renderInAppLink && matchDetails ? renderInAppLink(convertMatchDetailsToLinkingMetadata(matchDetails)) : null;
16720
+ return /* @__PURE__ */ jsxRuntime.jsx(
16721
+ MatchFormMobileItem,
16722
+ {
16723
+ match,
16724
+ bankTransaction,
16725
+ inAppLink
16726
+ },
16727
+ match.id
16728
+ );
16729
+ }),
16730
+ matchFormError && /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: matchFormError })
16731
+ ]
16732
+ }
16733
+ );
16551
16734
  };
16552
- const MatchForm = ({
16735
+ const BankTransactionsMobileListMatchForm = ({
16553
16736
  bankTransaction,
16554
16737
  showReceiptUploads,
16555
16738
  showDescriptions,
@@ -16559,7 +16742,7 @@ const MatchForm = ({
16559
16742
  const receiptsRef = react.useRef(null);
16560
16743
  const { match: matchBankTransaction2, isLoading } = useBankTransactionsContext();
16561
16744
  const [selectedMatch, setSelectedMatch] = react.useState(
16562
- getBankTransactionMatchAsSuggestedMatch(bankTransaction)
16745
+ getBankTransactionFirstSuggestedMatch(bankTransaction)
16563
16746
  );
16564
16747
  const [formError, setFormError] = react.useState();
16565
16748
  const showRetry = Boolean(bankTransaction.error);
@@ -16573,24 +16756,24 @@ const MatchForm = ({
16573
16756
  }
16574
16757
  yield matchBankTransaction2(bankTransaction.id, foundMatch.id, true);
16575
16758
  });
16576
- const save = () => __async(null, null, function* () {
16759
+ const save = () => {
16577
16760
  var _a2;
16578
16761
  if (!showCategorization) {
16579
16762
  return;
16580
16763
  }
16581
16764
  if (!selectedMatch) {
16582
16765
  setFormError("Select an option to match the transaction");
16583
- } else if (selectedMatch && selectedMatch.id !== ((_a2 = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a2.id)) {
16584
- yield onMatchSubmit(selectedMatch.id);
16766
+ }
16767
+ if (selectedMatch && selectedMatch.id !== ((_a2 = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a2.id)) {
16768
+ void onMatchSubmit(selectedMatch.id);
16585
16769
  }
16586
16770
  return;
16587
- });
16588
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
16589
- /* @__PURE__ */ jsxRuntime.jsx(Text, { weight: TextWeight.bold, size: TextSize.sm, children: "Find match" }),
16771
+ };
16772
+ return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
16773
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", weight: "bold", children: "Find Match" }),
16590
16774
  /* @__PURE__ */ jsxRuntime.jsx(
16591
16775
  MatchFormMobile,
16592
16776
  {
16593
- classNamePrefix: "Layer__bank-transaction-mobile-list-item",
16594
16777
  readOnly: !showCategorization,
16595
16778
  bankTransaction,
16596
16779
  selectedMatchId: selectedMatch == null ? void 0 : selectedMatch.id,
@@ -16604,28 +16787,21 @@ const MatchForm = ({
16604
16787
  BankTransactionFormFields,
16605
16788
  {
16606
16789
  bankTransaction,
16607
- showDescriptions
16790
+ showDescriptions,
16791
+ hideCustomerVendor: true,
16792
+ hideTags: true
16608
16793
  }
16609
16794
  ),
16610
- /* @__PURE__ */ jsxRuntime.jsx(
16611
- "div",
16795
+ showReceiptUploads && /* @__PURE__ */ jsxRuntime.jsx(
16796
+ BankTransactionReceipts,
16612
16797
  {
16613
- className: classNames(
16614
- "Layer__bank-transaction-mobile-list-item__receipts",
16615
- hasReceipts(bankTransaction) ? "Layer__bank-transaction-mobile-list-item__actions--with-receipts" : void 0
16616
- ),
16617
- children: showReceiptUploads && /* @__PURE__ */ jsxRuntime.jsx(
16618
- BankTransactionReceipts,
16619
- {
16620
- ref: receiptsRef,
16621
- floatingActions: false,
16622
- hideUploadButtons: true,
16623
- label: "Receipts"
16624
- }
16625
- )
16798
+ ref: receiptsRef,
16799
+ floatingActions: false,
16800
+ hideUploadButtons: true,
16801
+ label: "Receipts"
16626
16802
  }
16627
16803
  ),
16628
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__actions", children: [
16804
+ /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", children: [
16629
16805
  showReceiptUploads && /* @__PURE__ */ jsxRuntime.jsx(
16630
16806
  FileInput,
16631
16807
  {
@@ -16639,49 +16815,37 @@ const MatchForm = ({
16639
16815
  }
16640
16816
  ),
16641
16817
  showCategorization && /* @__PURE__ */ jsxRuntime.jsx(
16642
- Button$1,
16818
+ Button,
16643
16819
  {
16644
16820
  fullWidth: true,
16645
- disabled: !selectedMatch || isLoading || bankTransaction.processing || selectedMatch.id === ((_a = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a.id),
16646
- onClick: () => {
16647
- void save();
16648
- },
16821
+ isDisabled: !selectedMatch || isLoading || bankTransaction.processing || selectedMatch.id === ((_a = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a.id),
16822
+ onClick: save,
16649
16823
  children: isLoading || bankTransaction.processing ? "Saving..." : "Approve match"
16650
16824
  }
16651
16825
  )
16652
16826
  ] }),
16653
16827
  formError && /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: formError }),
16654
- showRetry ? /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
16828
+ showRetry && /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." })
16655
16829
  ] });
16656
16830
  };
16657
- const CategorySelectDrawerWithTrigger = ({
16658
- value,
16659
- onChange,
16660
- showTooltips
16661
- }) => {
16831
+ const CategorySelectDrawerWithTrigger = ({ value, onChange, showTooltips }) => {
16662
16832
  var _a;
16663
16833
  const [isDrawerOpen, setIsDrawerOpen] = react.useState(false);
16664
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16834
+ return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { fluid: true, children: [
16665
16835
  /* @__PURE__ */ jsxRuntime.jsxs(
16666
- "button",
16836
+ Button,
16667
16837
  {
16838
+ flex: true,
16839
+ fullWidth: true,
16668
16840
  "aria-label": "Select category",
16669
- className: classNames(
16670
- "Layer__category-menu__drawer-btn",
16671
- value && "Layer__category-menu__drawer-btn--selected"
16672
- ),
16673
16841
  onClick: () => {
16674
16842
  setIsDrawerOpen(true);
16675
16843
  },
16844
+ variant: "outlined",
16676
16845
  children: [
16677
- (_a = value == null ? void 0 : value.label) != null ? _a : "Select...",
16678
- /* @__PURE__ */ jsxRuntime.jsx(
16679
- ChevronDown,
16680
- {
16681
- size: 16,
16682
- className: "Layer__category-menu__drawer-btn__arrow"
16683
- }
16684
- )
16846
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { children: (_a = value == null ? void 0 : value.label) != null ? _a : "Select..." }),
16847
+ /* @__PURE__ */ jsxRuntime.jsx(Spacer, {}),
16848
+ /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, { size: 16 })
16685
16849
  ]
16686
16850
  }
16687
16851
  ),
@@ -16697,7 +16861,7 @@ const CategorySelectDrawerWithTrigger = ({
16697
16861
  )
16698
16862
  ] });
16699
16863
  };
16700
- const SplitForm = ({
16864
+ const BankTransactionsMobileListSplitForm = ({
16701
16865
  bankTransaction,
16702
16866
  showTooltips,
16703
16867
  showCategorization,
@@ -16726,84 +16890,90 @@ const SplitForm = ({
16726
16890
  bankTransaction,
16727
16891
  selectedCategory
16728
16892
  });
16893
+ const effectiveSplits = showCategorization ? localSplits : [];
16894
+ const addSplitButtonText = effectiveSplits.length > 1 ? "Add new split" : "Split";
16729
16895
  react.useEffect(() => {
16730
16896
  if (bankTransaction.error) {
16731
16897
  setShowRetry(true);
16732
16898
  }
16733
16899
  }, [bankTransaction.error]);
16734
- const save = () => __async(null, null, function* () {
16900
+ const save = () => {
16735
16901
  if (!isValid) return;
16736
16902
  const categorizationRequest = buildCategorizeBankTransactionPayloadForSplit(localSplits);
16737
- yield categorizeBankTransaction2(
16903
+ void categorizeBankTransaction2(
16738
16904
  bankTransaction.id,
16739
16905
  categorizationRequest
16740
16906
  );
16741
16907
  deselect(bankTransaction.id);
16742
16908
  close();
16743
- });
16744
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { children: [
16745
- showCategorization ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16909
+ };
16910
+ const handleCategoryChange = react.useCallback((index2) => (value) => {
16911
+ changeCategoryForSplitAtIndex(index2, value);
16912
+ }, [changeCategoryForSplitAtIndex]);
16913
+ return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
16914
+ showCategorization && /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", children: [
16746
16915
  /* @__PURE__ */ jsxRuntime.jsx(Text, { weight: TextWeight.bold, size: TextSize.sm, children: "Split transaction" }),
16747
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__bank-transactions__table-cell__header", children: [
16748
- /* @__PURE__ */ jsxRuntime.jsx(Text, { size: TextSize.sm, children: "Category" }),
16749
- /* @__PURE__ */ jsxRuntime.jsx(Text, { size: TextSize.sm, children: "Amount" })
16750
- ] }),
16751
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__bank-transactions__splits-inputs", children: [
16752
- localSplits.map((split, index2) => /* @__PURE__ */ jsxRuntime.jsxs(
16753
- "div",
16754
- {
16755
- className: "Layer__bank-transactions__table-cell--split-entry",
16756
- children: [
16757
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__bank-transactions__table-cell--split-entry__right-col", children: /* @__PURE__ */ jsxRuntime.jsx(
16758
- CategorySelectDrawerWithTrigger,
16759
- {
16760
- value: split.category,
16761
- onChange: (value) => changeCategoryForSplitAtIndex(index2, value),
16762
- showTooltips
16763
- }
16764
- ) }),
16765
- /* @__PURE__ */ jsxRuntime.jsx(
16766
- AmountInput,
16767
- {
16768
- name: `split-${index2}`,
16769
- disabled: index2 === 0 || !showCategorization,
16770
- onChange: updateSplitAmount(index2),
16771
- value: getInputValueForSplitAtIndex(index2, split),
16772
- onBlur: onBlurSplitAmount,
16773
- isInvalid: split.amount < 0
16774
- }
16775
- ),
16776
- index2 > 0 && /* @__PURE__ */ jsxRuntime.jsx(
16777
- Button$1,
16778
- {
16779
- className: "Layer__bank-transactions__table-cell--split-entry__merge-btn",
16780
- onClick: () => removeSplit(index2),
16781
- rightIcon: /* @__PURE__ */ jsxRuntime.jsx(Trash, { size: 16 }),
16782
- variant: ButtonVariant.secondary,
16783
- iconOnly: true
16784
- }
16785
- )
16786
- ]
16787
- },
16788
- `split-${index2}`
16789
- )),
16790
- /* @__PURE__ */ jsxRuntime.jsx(
16791
- TextButton,
16792
- {
16793
- onClick: addSplit,
16794
- disabled: isLoading,
16795
- className: "Layer__add-new-split",
16796
- children: "Add new split"
16797
- }
16798
- )
16799
- ] }),
16916
+ /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "sm", children: localSplits.map((split, index2) => /* @__PURE__ */ jsxRuntime.jsxs(
16917
+ HStack,
16918
+ {
16919
+ gap: "xs",
16920
+ align: "center",
16921
+ justify: "space-between",
16922
+ children: [
16923
+ /* @__PURE__ */ jsxRuntime.jsx(
16924
+ CategorySelectDrawerWithTrigger,
16925
+ {
16926
+ value: split.category,
16927
+ onChange: handleCategoryChange(index2),
16928
+ showTooltips
16929
+ }
16930
+ ),
16931
+ /* @__PURE__ */ jsxRuntime.jsx(
16932
+ AmountInput,
16933
+ {
16934
+ name: `split-${index2}`,
16935
+ disabled: index2 === 0 || !showCategorization,
16936
+ onChange: updateSplitAmount(index2),
16937
+ value: getInputValueForSplitAtIndex(index2, split),
16938
+ onBlur: onBlurSplitAmount,
16939
+ isInvalid: split.amount < 0,
16940
+ className: "Layer__BankTransactionsMobileSplitForm__AmountInput"
16941
+ }
16942
+ ),
16943
+ /* @__PURE__ */ jsxRuntime.jsx(
16944
+ Button,
16945
+ {
16946
+ onClick: () => removeSplit(index2),
16947
+ variant: "outlined",
16948
+ icon: true,
16949
+ isDisabled: index2 == 0,
16950
+ children: /* @__PURE__ */ jsxRuntime.jsx(Trash, { size: 16 })
16951
+ }
16952
+ )
16953
+ ]
16954
+ },
16955
+ `split-${index2}`
16956
+ )) }),
16957
+ /* @__PURE__ */ jsxRuntime.jsx(HStack, { justify: "end", children: /* @__PURE__ */ jsxRuntime.jsxs(
16958
+ Button,
16959
+ {
16960
+ onClick: addSplit,
16961
+ variant: "outlined",
16962
+ children: [
16963
+ /* @__PURE__ */ jsxRuntime.jsx(Scissors, { size: 14 }),
16964
+ addSplitButtonText
16965
+ ]
16966
+ }
16967
+ ) }),
16800
16968
  splitFormError && /* @__PURE__ */ jsxRuntime.jsx(HStack, { pbe: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: splitFormError }) })
16801
- ] }) : null,
16969
+ ] }),
16802
16970
  /* @__PURE__ */ jsxRuntime.jsx(
16803
16971
  BankTransactionFormFields,
16804
16972
  {
16805
16973
  bankTransaction,
16806
- showDescriptions
16974
+ showDescriptions,
16975
+ hideCustomerVendor: true,
16976
+ hideTags: true
16807
16977
  }
16808
16978
  ),
16809
16979
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -16824,7 +16994,7 @@ const SplitForm = ({
16824
16994
  )
16825
16995
  }
16826
16996
  ),
16827
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__actions", children: [
16997
+ /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", children: [
16828
16998
  showReceiptUploads && /* @__PURE__ */ jsxRuntime.jsx(
16829
16999
  FileInput,
16830
17000
  {
@@ -16838,19 +17008,19 @@ const SplitForm = ({
16838
17008
  }
16839
17009
  ),
16840
17010
  showCategorization && /* @__PURE__ */ jsxRuntime.jsx(
16841
- Button$1,
17011
+ Button,
16842
17012
  {
16843
17013
  fullWidth: true,
16844
- onClick: () => void save(),
16845
- disabled: isLoading || bankTransaction.processing,
16846
- children: isLoading || bankTransaction.processing ? "Saving..." : "Save"
17014
+ onClick: save,
17015
+ isDisabled: isLoading || bankTransaction.processing || !isValid,
17016
+ children: bankTransaction.processing || isLoading ? "Confirming..." : "Confirm"
16847
17017
  }
16848
17018
  )
16849
17019
  ] }),
16850
- bankTransaction.error && showRetry ? /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
17020
+ bankTransaction.error && showRetry && /* @__PURE__ */ jsxRuntime.jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." })
16851
17021
  ] });
16852
17022
  };
16853
- const SplitAndMatchForm = ({
17023
+ const BankTransactionsMobileListSplitAndMatchForm = ({
16854
17024
  bankTransaction,
16855
17025
  showTooltips,
16856
17026
  showReceiptUploads,
@@ -16862,9 +17032,9 @@ const SplitAndMatchForm = ({
16862
17032
  bankTransaction.category ? "categorize" : anyMatch ? "match" : "categorize"
16863
17033
  /* categorize */
16864
17034
  );
16865
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__split-and-match-form", children: [
17035
+ return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
16866
17036
  formType === "categorize" && /* @__PURE__ */ jsxRuntime.jsx(
16867
- SplitForm,
17037
+ BankTransactionsMobileListSplitForm,
16868
17038
  {
16869
17039
  bankTransaction,
16870
17040
  showTooltips,
@@ -16874,7 +17044,7 @@ const SplitAndMatchForm = ({
16874
17044
  }
16875
17045
  ),
16876
17046
  formType === "match" && /* @__PURE__ */ jsxRuntime.jsx(
16877
- MatchForm,
17047
+ BankTransactionsMobileListMatchForm,
16878
17048
  {
16879
17049
  bankTransaction,
16880
17050
  showReceiptUploads,
@@ -16882,17 +17052,16 @@ const SplitAndMatchForm = ({
16882
17052
  showCategorization
16883
17053
  }
16884
17054
  ),
16885
- showCategorization && anyMatch && formType === "match" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__bank-transaction-mobile-list-item__switch-form-btns", children: /* @__PURE__ */ jsxRuntime.jsx(TextButton, { onClick: () => setFormType(
17055
+ showCategorization && anyMatch && (formType === "match" ? /* @__PURE__ */ jsxRuntime.jsx(TextButton, { onClick: () => setFormType(
16886
17056
  "categorize"
16887
17057
  /* categorize */
16888
- ), children: "or split transaction" }) }) : null,
16889
- showCategorization && anyMatch && formType === "categorize" ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__bank-transaction-mobile-list-item__switch-form-btns", children: /* @__PURE__ */ jsxRuntime.jsx(TextButton, { onClick: () => setFormType(
17058
+ ), children: "or split transaction" }) : /* @__PURE__ */ jsxRuntime.jsx(TextButton, { onClick: () => setFormType(
16890
17059
  "match"
16891
17060
  /* match */
16892
- ), children: "or find match" }) }) : null
17061
+ ), children: "or find match" }))
16893
17062
  ] });
16894
17063
  };
16895
- const BankTransactionMobileForms = ({
17064
+ const BankTransactionsMobileForms = ({
16896
17065
  purpose,
16897
17066
  bankTransaction,
16898
17067
  showTooltips,
@@ -16905,7 +17074,7 @@ const BankTransactionMobileForms = ({
16905
17074
  switch (purpose) {
16906
17075
  case Purpose.business:
16907
17076
  return /* @__PURE__ */ jsxRuntime.jsx(
16908
- BusinessForm$1,
17077
+ BankTransactionsMobileListBusinessForm,
16909
17078
  {
16910
17079
  bankTransaction,
16911
17080
  showCategorization,
@@ -16916,7 +17085,7 @@ const BankTransactionMobileForms = ({
16916
17085
  );
16917
17086
  case Purpose.personal:
16918
17087
  return /* @__PURE__ */ jsxRuntime.jsx(
16919
- PersonalForm,
17088
+ BankTransactionsMobileListPersonalForm,
16920
17089
  {
16921
17090
  bankTransaction,
16922
17091
  showReceiptUploads,
@@ -16926,7 +17095,7 @@ const BankTransactionMobileForms = ({
16926
17095
  );
16927
17096
  case Purpose.more:
16928
17097
  return /* @__PURE__ */ jsxRuntime.jsx(
16929
- SplitAndMatchForm,
17098
+ BankTransactionsMobileListSplitAndMatchForm,
16930
17099
  {
16931
17100
  bankTransaction,
16932
17101
  showCategorization,
@@ -16939,75 +17108,69 @@ const BankTransactionMobileForms = ({
16939
17108
  return null;
16940
17109
  }
16941
17110
  };
16942
- return /* @__PURE__ */ jsxRuntime.jsx(ReceiptsProvider, { bankTransaction, isActive: isOpen, children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__bank-transaction-mobile-list-item__form-container", children: getContent() }) });
17111
+ return /* @__PURE__ */ jsxRuntime.jsx(ReceiptsProvider, { bankTransaction, isActive: isOpen, children: getContent() });
16943
17112
  };
16944
- const useTransactionToOpen = () => {
16945
- const [transactionIdToOpen, setTransactionIdToOpen] = react.useState(void 0);
16946
- const clearTransactionIdToOpen = react.useCallback(() => setTransactionIdToOpen(void 0), []);
16947
- return {
16948
- transactionIdToOpen,
16949
- setTransactionIdToOpen,
16950
- clearTransactionIdToOpen
16951
- };
16952
- };
16953
- const TransactionToOpenContext = react.createContext({
16954
- transactionIdToOpen: void 0,
16955
- setTransactionIdToOpen: () => void 0,
16956
- clearTransactionIdToOpen: () => void 0
16957
- });
16958
- const BankTransactionsMobileListItemCheckbox = ({
16959
- bulkActionsEnabled,
17113
+ const PURPOSE_TOGGLE_OPTIONS = [
17114
+ {
17115
+ value: "business",
17116
+ label: "Business",
17117
+ style: { minWidth: 84 }
17118
+ },
17119
+ {
17120
+ value: "personal",
17121
+ label: "Personal",
17122
+ style: { minWidth: 84 }
17123
+ },
17124
+ {
17125
+ value: "more",
17126
+ label: "More",
17127
+ style: { minWidth: 84 }
17128
+ }
17129
+ ];
17130
+ const BankTransactionsMobileListItemExpandedRow = ({
16960
17131
  bankTransaction,
16961
- checkboxContainerRef
17132
+ showCategorization,
17133
+ showDescriptions,
17134
+ showReceiptUploads,
17135
+ showTooltips
16962
17136
  }) => {
16963
- const internalRef = react.useRef(null);
16964
- const ref = checkboxContainerRef || internalRef;
16965
- const bookkeepingStatus = useEffectiveBookkeepingStatus();
16966
- const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
16967
- const { select, deselect } = useBulkSelectionActions();
16968
- const isSelected = useIdIsSelected();
16969
- const isTransactionSelected = isSelected(bankTransaction.id);
16970
- if (!categorizationEnabled || !bulkActionsEnabled) {
16971
- return null;
16972
- }
16973
- return /* @__PURE__ */ jsxRuntime.jsx(VStack, { align: "start", pis: "md", pie: "2xs", ref, children: /* @__PURE__ */ jsxRuntime.jsx(
16974
- Checkbox,
16975
- {
16976
- size: "md",
16977
- isSelected: isTransactionSelected,
16978
- onChange: (selected) => {
16979
- if (selected) {
16980
- select(bankTransaction.id);
16981
- } else {
16982
- deselect(bankTransaction.id);
16983
- }
17137
+ const [purpose, setPurpose] = react.useState(getInitialPurpose(bankTransaction));
17138
+ const onChangePurpose = (event) => setPurpose(event.target.value);
17139
+ return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { pi: "md", gap: "md", pbe: "md", children: [
17140
+ showCategorization && /* @__PURE__ */ jsxRuntime.jsx(
17141
+ Toggle,
17142
+ {
17143
+ name: `purpose-${bankTransaction.id}`,
17144
+ size: ToggleSize.medium,
17145
+ options: PURPOSE_TOGGLE_OPTIONS,
17146
+ selected: purpose,
17147
+ onChange: onChangePurpose
16984
17148
  }
16985
- }
16986
- ) });
16987
- };
16988
- const BankTransactionsMobileListItemCategory = ({
16989
- bankTransaction
16990
- }) => {
16991
- const categorized = isCategorized(bankTransaction);
16992
- const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
16993
- if (categorized) {
16994
- return /* @__PURE__ */ jsxRuntime.jsx(
16995
- BankTransactionsCategorizedSelectedValue,
17149
+ ),
17150
+ /* @__PURE__ */ jsxRuntime.jsx(
17151
+ BankTransactionsMobileForms,
16996
17152
  {
17153
+ purpose,
16997
17154
  bankTransaction,
16998
- className: "Layer__bankTransactionsMobileListItemCategory",
16999
- slotProps: { Label: { size: "sm" } }
17155
+ showCategorization,
17156
+ showDescriptions,
17157
+ showReceiptUploads,
17158
+ showTooltips
17000
17159
  }
17001
- );
17002
- }
17003
- return selectedCategory ? /* @__PURE__ */ jsxRuntime.jsx(
17004
- BankTransactionsUncategorizedSelectedValue,
17005
- {
17006
- selectedValue: selectedCategory != null ? selectedCategory : null,
17007
- className: "Layer__bankTransactionsMobileListItemCategory",
17008
- slotProps: { Label: { size: "sm" } }
17160
+ )
17161
+ ] });
17162
+ };
17163
+ const getInitialPurpose = (bankTransaction) => {
17164
+ if (bankTransaction.category) {
17165
+ if (bankTransaction.category.type === "Exclusion") {
17166
+ return Purpose.personal;
17009
17167
  }
17010
- ) : /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, className: "Layer__bankTransactionsMobileListItemCategory", size: "sm", children: "No category selected" });
17168
+ if (bankTransaction.categorization_status === CategorizationStatus.SPLIT) {
17169
+ return Purpose.more;
17170
+ }
17171
+ return Purpose.business;
17172
+ }
17173
+ return hasMatch(bankTransaction) ? Purpose.more : Purpose.business;
17011
17174
  };
17012
17175
  var Purpose = /* @__PURE__ */ ((Purpose2) => {
17013
17176
  Purpose2["business"] = "business";
@@ -17015,7 +17178,6 @@ var Purpose = /* @__PURE__ */ ((Purpose2) => {
17015
17178
  Purpose2["more"] = "more";
17016
17179
  return Purpose2;
17017
17180
  })(Purpose || {});
17018
- const DATE_FORMAT = "LLL d";
17019
17181
  const getAssignedValue = (bankTransaction, renderInAppLink) => {
17020
17182
  var _a, _b, _c, _d;
17021
17183
  if (bankTransaction.categorization_status === CategorizationStatus.SPLIT) {
@@ -17051,21 +17213,8 @@ const BankTransactionsMobileListItem = ({
17051
17213
  } = react.useContext(TransactionToOpenContext);
17052
17214
  const { shouldHideAfterCategorize } = useBankTransactionsContext();
17053
17215
  const categorized = isCategorized(bankTransaction);
17054
- const formRowRef = useElementSize(
17055
- (_a2, _b2, { height: height2 }) => setHeight(height2)
17056
- );
17057
- const headingRowRef = useElementSize((_a2, _b2, { height: height2 }) => {
17058
- setHeadingHeight(height2);
17059
- });
17060
17216
  const itemRef = react.useRef(null);
17061
- const [removeAnim, setRemoveAnim] = react.useState(false);
17062
- const [purpose, setPurpose] = react.useState(
17063
- bankTransaction.category ? bankTransaction.category.type === "Exclusion" ? "personal" : bankTransaction.categorization_status === CategorizationStatus.SPLIT ? "more" : "business" : hasMatch(bankTransaction) ? "more" : "business"
17064
- /* business */
17065
- );
17066
17217
  const [open, setOpen] = react.useState(isFirstItem);
17067
- const [height, setHeight] = react.useState(0);
17068
- const [headingHeight, setHeadingHeight] = react.useState(63);
17069
17218
  const openNext = () => {
17070
17219
  if (editable && itemRef.current && itemRef.current.nextSibling) {
17071
17220
  const txId = itemRef.current.nextSibling.getAttribute(
@@ -17095,10 +17244,12 @@ const BankTransactionsMobileListItem = ({
17095
17244
  }
17096
17245
  }, [bankTransaction.id, clearTransactionIdToOpen, transactionIdToOpen]);
17097
17246
  react.useEffect(() => {
17098
- if (!removeAnim && bankTransaction.recently_categorized) {
17247
+ if (bankTransaction.recently_categorized) {
17099
17248
  if (editable && shouldHideAfterCategorize()) {
17100
- setRemoveAnim(true);
17101
- openNext();
17249
+ setTimeout(() => {
17250
+ removeTransaction(bankTransaction);
17251
+ openNext();
17252
+ }, 300);
17102
17253
  } else {
17103
17254
  close2();
17104
17255
  }
@@ -17109,14 +17260,10 @@ const BankTransactionsMobileListItem = ({
17109
17260
  bankTransaction.match
17110
17261
  ]);
17111
17262
  const toggleOpen = () => {
17112
- if (open) {
17113
- setHeight(0);
17114
- }
17115
17263
  setOpen(!open);
17116
17264
  };
17117
17265
  const close2 = () => {
17118
17266
  setOpen(false);
17119
- setHeight(0);
17120
17267
  };
17121
17268
  const checkboxContainerRef = react.useRef(null);
17122
17269
  const handleRowClick = (event) => {
@@ -17141,7 +17288,11 @@ const BankTransactionsMobileListItem = ({
17141
17288
  }, 300);
17142
17289
  }
17143
17290
  }, [bankTransaction.recently_categorized]);
17144
- const onChangePurpose = (event) => setPurpose(event.target.value);
17291
+ react.useEffect(() => {
17292
+ if (bulkActionsEnabled) {
17293
+ close2();
17294
+ }
17295
+ }, [bulkActionsEnabled]);
17145
17296
  const bookkeepingStatus = useEffectiveBookkeepingStatus();
17146
17297
  const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
17147
17298
  const { select, deselect } = useBulkSelectionActions();
@@ -17153,169 +17304,96 @@ const BankTransactionsMobileListItem = ({
17153
17304
  const openClassName = open ? `${className}--expanded` : "";
17154
17305
  const rowClassName = classNames(
17155
17306
  className,
17156
- removeAnim ? "Layer__bank-transaction-row--removing" : "",
17157
17307
  open ? openClassName : "",
17158
17308
  isVisible ? "show" : ""
17159
17309
  );
17160
- return /* @__PURE__ */ jsxRuntime.jsxs("li", { ref: itemRef, className: rowClassName, "data-item": bankTransaction.id, children: [
17161
- /* @__PURE__ */ jsxRuntime.jsx(
17310
+ return /* @__PURE__ */ jsxRuntime.jsx("li", { ref: itemRef, className: rowClassName, "data-item": bankTransaction.id, children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { children: [
17311
+ /* @__PURE__ */ jsxRuntime.jsxs(
17162
17312
  "div",
17163
17313
  {
17164
17314
  onClick: handleRowClick,
17165
17315
  role: "button",
17166
- style: {
17167
- height: headingHeight
17168
- },
17169
- children: /* @__PURE__ */ jsxRuntime.jsxs(
17170
- VStack,
17171
- {
17172
- ref: headingRowRef,
17173
- children: [
17174
- /* @__PURE__ */ jsxRuntime.jsxs(
17175
- HStack,
17176
- {
17177
- gap: "md",
17178
- justify: "space-between",
17179
- align: "center",
17180
- pie: "md",
17181
- children: [
17182
- /* @__PURE__ */ jsxRuntime.jsxs(HStack, { align: "center", children: [
17183
- /* @__PURE__ */ jsxRuntime.jsx(
17184
- BankTransactionsMobileListItemCheckbox,
17185
- {
17186
- bulkActionsEnabled,
17187
- bankTransaction,
17188
- checkboxContainerRef
17189
- }
17190
- ),
17191
- /* @__PURE__ */ jsxRuntime.jsxs(
17192
- VStack,
17193
- {
17194
- align: "start",
17195
- gap: "3xs",
17196
- className: "Layer__bankTransactionsMobileListItem__headingContentLeft",
17197
- pi: "md",
17198
- pb: "sm",
17199
- children: [
17200
- /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, children: (_b = bankTransaction.counterparty_name) != null ? _b : bankTransaction.description }),
17201
- /* @__PURE__ */ jsxRuntime.jsx(Span, { className: "Layer__bankTransactionsMobileListItem__categorizedValue", children: categorized && bankTransaction.categorization_status ? getAssignedValue(bankTransaction, renderInAppLink) : null }),
17202
- /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "2xs", align: "center", children: [
17203
- /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", ellipsis: true, children: fullAccountName }),
17204
- hasReceipts(bankTransaction) ? /* @__PURE__ */ jsxRuntime.jsx(File, { size: 12 }) : null
17205
- ] }),
17206
- !categorizationEnabled && !categorized ? /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) : null
17207
- ]
17208
- }
17209
- )
17210
- ] }),
17211
- /* @__PURE__ */ jsxRuntime.jsxs(
17212
- VStack,
17213
- {
17214
- align: "end",
17215
- gap: "3xs",
17216
- pb: "sm",
17217
- children: [
17218
- /* @__PURE__ */ jsxRuntime.jsxs(HStack, { children: [
17219
- /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "md", children: isCredit(bankTransaction) ? "+" : "" }),
17220
- /* @__PURE__ */ jsxRuntime.jsx(
17221
- MoneySpan,
17222
- {
17223
- amount: bankTransaction.amount
17224
- }
17225
- )
17226
- ] }),
17227
- /* @__PURE__ */ jsxRuntime.jsx(
17228
- DateTime,
17229
- {
17230
- value: bankTransaction.date,
17231
- dateFormat: DATE_FORMAT,
17232
- onlyDate: true,
17233
- slotProps: {
17234
- Date: { size: "sm", variant: "subtle" }
17235
- }
17236
- }
17237
- )
17238
- ]
17239
- }
17240
- )
17241
- ]
17242
- }
17243
- ),
17244
- /* @__PURE__ */ jsxRuntime.jsx(
17245
- BankTransactionsMobileListItemCategory,
17246
- {
17247
- bankTransaction
17248
- }
17249
- )
17250
- ]
17251
- }
17252
- )
17253
- }
17254
- ),
17255
- /* @__PURE__ */ jsxRuntime.jsx(
17256
- "div",
17257
- {
17258
- className: `${className}__expanded-row`,
17259
- style: { height: !open || removeAnim ? 0 : height },
17260
- children: open && /* @__PURE__ */ jsxRuntime.jsxs(
17261
- "div",
17262
- {
17263
- className: `${className}__expanded-row__content`,
17264
- ref: formRowRef,
17265
- children: [
17266
- categorizationEnabled ? /* @__PURE__ */ jsxRuntime.jsxs("div", { className: `${className}__toggle-row`, children: [
17316
+ children: [
17317
+ /* @__PURE__ */ jsxRuntime.jsxs(
17318
+ HStack,
17319
+ {
17320
+ gap: "md",
17321
+ justify: "space-between",
17322
+ align: "center",
17323
+ pie: "md",
17324
+ children: [
17325
+ /* @__PURE__ */ jsxRuntime.jsxs(HStack, { align: "center", children: [
17326
+ /* @__PURE__ */ jsxRuntime.jsx(
17327
+ BankTransactionsMobileListItemCheckbox,
17328
+ {
17329
+ bulkActionsEnabled,
17330
+ bankTransaction,
17331
+ checkboxContainerRef
17332
+ }
17333
+ ),
17334
+ /* @__PURE__ */ jsxRuntime.jsxs(
17335
+ VStack,
17336
+ {
17337
+ align: "start",
17338
+ gap: "3xs",
17339
+ className: "Layer__bankTransactionsMobileListItem__headingContentLeft",
17340
+ pi: "md",
17341
+ pb: "sm",
17342
+ children: [
17343
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, children: (_b = bankTransaction.counterparty_name) != null ? _b : bankTransaction.description }),
17344
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { className: "Layer__bankTransactionsMobileListItem__categorizedValue", children: categorized && bankTransaction.categorization_status ? getAssignedValue(bankTransaction, renderInAppLink) : null }),
17345
+ /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "2xs", align: "center", children: [
17346
+ /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", ellipsis: true, children: fullAccountName }),
17347
+ hasReceipts(bankTransaction) ? /* @__PURE__ */ jsxRuntime.jsx(File, { size: 12 }) : null
17348
+ ] }),
17349
+ !categorizationEnabled && !categorized ? /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) : null
17350
+ ]
17351
+ }
17352
+ )
17353
+ ] }),
17267
17354
  /* @__PURE__ */ jsxRuntime.jsx(
17268
- Toggle,
17355
+ BankTransactionsAmountDate,
17269
17356
  {
17270
- name: `purpose-${bankTransaction.id}`,
17271
- size: ToggleSize.xsmall,
17272
- options: [
17273
- {
17274
- value: "business",
17275
- label: "Business",
17276
- style: { minWidth: 84 }
17277
- },
17278
- {
17279
- value: "personal",
17280
- label: "Personal",
17281
- style: { minWidth: 84 }
17282
- },
17283
- {
17284
- value: "more",
17285
- label: "More",
17286
- style: { minWidth: 84 }
17357
+ amount: bankTransaction.amount,
17358
+ date: bankTransaction.date,
17359
+ slotProps: {
17360
+ MoneySpan: {
17361
+ size: "md",
17362
+ displayPlusSign: isCredit(bankTransaction)
17287
17363
  }
17288
- ],
17289
- selected: purpose,
17290
- onChange: onChangePurpose
17364
+ }
17291
17365
  }
17292
- ),
17293
- /* @__PURE__ */ jsxRuntime.jsx(CloseButton, { onClick: () => close2() })
17294
- ] }) : null,
17295
- /* @__PURE__ */ jsxRuntime.jsx(
17296
- BankTransactionMobileForms,
17297
- {
17298
- isOpen: open,
17299
- purpose,
17300
- bankTransaction,
17301
- showCategorization: categorizationEnabled,
17302
- showDescriptions,
17303
- showReceiptUploads,
17304
- showTooltips
17305
- }
17306
- )
17307
- ]
17308
- }
17309
- )
17366
+ )
17367
+ ]
17368
+ }
17369
+ ),
17370
+ !open && /* @__PURE__ */ jsxRuntime.jsx(
17371
+ BankTransactionsListItemCategory,
17372
+ {
17373
+ bankTransaction,
17374
+ mobile: true
17375
+ }
17376
+ )
17377
+ ]
17310
17378
  }
17311
- )
17312
- ] });
17379
+ ),
17380
+ /* @__PURE__ */ jsxRuntime.jsx(AnimatedContent, { variant: "expand", isOpen: open, children: /* @__PURE__ */ jsxRuntime.jsx(
17381
+ BankTransactionsMobileListItemExpandedRow,
17382
+ {
17383
+ bankTransaction,
17384
+ showCategorization: categorizationEnabled,
17385
+ showDescriptions,
17386
+ showReceiptUploads,
17387
+ showTooltips
17388
+ }
17389
+ ) }, `expanded-${bankTransaction.id}`)
17390
+ ] }) });
17313
17391
  };
17314
17392
  const SWITCH_CLASS_NAME = "Layer__Switch";
17315
- const Switch = react.forwardRef((_Ob, ref) => {
17316
- var _Pb = _Ob, {
17393
+ const Switch = react.forwardRef((_Mb, ref) => {
17394
+ var _Nb = _Mb, {
17317
17395
  children
17318
- } = _Pb, props = __objRest(_Pb, [
17396
+ } = _Nb, props = __objRest(_Nb, [
17319
17397
  "children"
17320
17398
  ]);
17321
17399
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -17691,8 +17769,8 @@ const usePaginationRange = ({
17691
17769
  }, [totalCount, pageSize, siblingCount, currentPage]);
17692
17770
  return paginationRange;
17693
17771
  };
17694
- const PaginationButton = (_Qb) => {
17695
- var _Rb = _Qb, { children, isSelected } = _Rb, buttonProps = __objRest(_Rb, ["children", "isSelected"]);
17772
+ const PaginationButton = (_Ob) => {
17773
+ var _Pb = _Ob, { children, isSelected } = _Pb, buttonProps = __objRest(_Pb, ["children", "isSelected"]);
17696
17774
  return /* @__PURE__ */ jsxRuntime.jsx(
17697
17775
  Button,
17698
17776
  __spreadProps(__spreadValues({
@@ -18239,8 +18317,8 @@ function BaseFormTextField({
18239
18317
  }
18240
18318
  const INPUT_CLASS_NAME = "Layer__UI__Input";
18241
18319
  const Input = react.forwardRef(
18242
- function Input2(_Sb, ref) {
18243
- var _Tb = _Sb, { inset, placement } = _Tb, restProps = __objRest(_Tb, ["inset", "placement"]);
18320
+ function Input2(_Qb, ref) {
18321
+ var _Rb = _Qb, { inset, placement } = _Rb, restProps = __objRest(_Rb, ["inset", "placement"]);
18244
18322
  const dataProperties = toDataProperties({ inset, placement });
18245
18323
  return /* @__PURE__ */ jsxRuntime.jsx(
18246
18324
  reactAriaComponents.Input,
@@ -18336,15 +18414,15 @@ const withForceUpdate = (value) => {
18336
18414
  writable: false
18337
18415
  });
18338
18416
  };
18339
- function FormBigDecimalField(_Ub) {
18340
- var _Vb = _Ub, {
18417
+ function FormBigDecimalField(_Sb) {
18418
+ var _Tb = _Sb, {
18341
18419
  mode = "decimal",
18342
18420
  allowNegative = false,
18343
18421
  maxValue = mode === "percent" ? BIG_DECIMAL_ONE : DEFAULT_MAX_VALUE,
18344
18422
  minDecimalPlaces = mode === "currency" ? 2 : DEFAULT_MIN_DECIMAL_PLACES,
18345
18423
  maxDecimalPlaces = mode === "currency" ? 2 : DEFAULT_MAX_DECIMAL_PLACES,
18346
18424
  slots
18347
- } = _Vb, restProps = __objRest(_Vb, [
18425
+ } = _Tb, restProps = __objRest(_Tb, [
18348
18426
  "mode",
18349
18427
  "allowNegative",
18350
18428
  "maxValue",
@@ -18509,8 +18587,8 @@ function FormDateField({
18509
18587
  }
18510
18588
  const TEXTAREA_CLASS_NAME = "Layer__UI__TextArea";
18511
18589
  const TextArea = react.forwardRef(
18512
- function TextArea2(_Wb, ref) {
18513
- var _Xb = _Wb, { resize = "none" } = _Xb, restProps = __objRest(_Xb, ["resize"]);
18590
+ function TextArea2(_Ub, ref) {
18591
+ var _Vb = _Ub, { resize = "none" } = _Vb, restProps = __objRest(_Vb, ["resize"]);
18514
18592
  const dataProperties = toDataProperties({ resize });
18515
18593
  return /* @__PURE__ */ jsxRuntime.jsx(
18516
18594
  reactAriaComponents.TextArea,
@@ -18792,6 +18870,40 @@ const CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
18792
18870
  }
18793
18871
  );
18794
18872
  };
18873
+ const CloseIcon = (_Wb) => {
18874
+ var _Xb = _Wb, { size = 12 } = _Xb, props = __objRest(_Xb, ["size"]);
18875
+ return /* @__PURE__ */ jsxRuntime.jsxs(
18876
+ "svg",
18877
+ __spreadProps(__spreadValues({
18878
+ viewBox: "0 0 12 12",
18879
+ fill: "none",
18880
+ xmlns: "http://www.w3.org/2000/svg"
18881
+ }, props), {
18882
+ width: size,
18883
+ height: size,
18884
+ children: [
18885
+ /* @__PURE__ */ jsxRuntime.jsx(
18886
+ "path",
18887
+ {
18888
+ d: "M8.75 3.25L3.25 8.75",
18889
+ stroke: "currentColor",
18890
+ strokeLinecap: "round",
18891
+ strokeLinejoin: "round"
18892
+ }
18893
+ ),
18894
+ /* @__PURE__ */ jsxRuntime.jsx(
18895
+ "path",
18896
+ {
18897
+ d: "M3.25 3.25L8.75 8.75",
18898
+ stroke: "currentColor",
18899
+ strokeLinecap: "round",
18900
+ strokeLinejoin: "round"
18901
+ }
18902
+ )
18903
+ ]
18904
+ })
18905
+ );
18906
+ };
18795
18907
  const VALID_EXTENSIONS = [".csv"];
18796
18908
  const VALID_FILE_TYPES = ["text/csv", "text/plain", "application/vnd.ms-excel"];
18797
18909
  const MAX_FILE_SIZE = 2 * 1024 * 1024;
@@ -21071,6 +21183,7 @@ function useRejectCategorizationRulesUpdateSuggestion() {
21071
21183
  function RuleUpdatesPromptStep({ ruleSuggestion, close: close2 }) {
21072
21184
  const { next } = useWizard();
21073
21185
  const { addToast } = useLayerContext();
21186
+ const { isMobile } = useSizeClass();
21074
21187
  const [dontAskAgain, setDontAskAgain] = react.useState(false);
21075
21188
  const { trigger: rejectRuleSuggestion, isMutating } = useRejectCategorizationRulesUpdateSuggestion();
21076
21189
  const handleRejectRuleSuggestion = react.useCallback(() => {
@@ -21088,7 +21201,7 @@ function RuleUpdatesPromptStep({ ruleSuggestion, close: close2 }) {
21088
21201
  }
21089
21202
  }))();
21090
21203
  }, [addToast, close2, dontAskAgain, rejectRuleSuggestion, ruleSuggestion.newRule.createdBySuggestionId]);
21091
- return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "3xl", children: [
21204
+ return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: isMobile ? "md" : "3xl", children: [
21092
21205
  /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "md", children: ruleSuggestion.suggestionPrompt }),
21093
21206
  /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "sm", align: "end", children: [
21094
21207
  /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "sm", justify: "end", align: "end", children: [
@@ -22568,12 +22681,12 @@ const collectRevenueItems = (data) => {
22568
22681
  }
22569
22682
  return revenueItems;
22570
22683
  };
22571
- const humanizeTitle = (sidebarView) => {
22684
+ const humanizeTitle = (sidebarView, overrides) => {
22572
22685
  switch (sidebarView) {
22573
22686
  case "expenses":
22574
- return "Expenses";
22687
+ return (overrides == null ? void 0 : overrides.expenseChartHeader) || "Expenses";
22575
22688
  case "revenue":
22576
- return "Revenue";
22689
+ return (overrides == null ? void 0 : overrides.revenueChartHeader) || "Revenue";
22577
22690
  default:
22578
22691
  return "Profit & Loss";
22579
22692
  }
@@ -22588,69 +22701,10 @@ const applyShare = (items, total) => {
22588
22701
  });
22589
22702
  });
22590
22703
  };
22591
- var ReportKey = /* @__PURE__ */ ((ReportKey2) => {
22592
- ReportKey2["ProfitAndLoss"] = "ProfitAndLoss";
22593
- ReportKey2["BalanceSheet"] = "BalanceSheet";
22594
- ReportKey2["StatementOfCashFlows"] = "StatementOfCashFlows";
22595
- return ReportKey2;
22596
- })(ReportKey || {});
22597
- const defaultModeByReport = {
22598
- [
22599
- "ProfitAndLoss"
22600
- /* ProfitAndLoss */
22601
- ]: "monthPicker",
22602
- // This one should never change, but is included for completeness
22603
- [
22604
- "BalanceSheet"
22605
- /* BalanceSheet */
22606
- ]: "dayPicker",
22607
- [
22608
- "StatementOfCashFlows"
22609
- /* StatementOfCashFlows */
22610
- ]: "monthPicker"
22611
- };
22612
- const ReportsModeStoreContext = react.createContext(
22613
- zustand.createStore(() => ({
22614
- resetPnLModeToDefaultOnMount: true,
22615
- modeByReport: {},
22616
- actions: {
22617
- setModeForReport: () => {
22618
- }
22619
- }
22620
- }))
22621
- );
22622
- function useReportMode(report) {
22623
- const store = react.useContext(ReportsModeStoreContext);
22624
- return zustand.useStore(store, (state) => state.modeByReport[report]);
22625
- }
22626
- function useReportModeWithFallback(report, fallback) {
22627
- const mode = useReportMode(report);
22628
- return mode != null ? mode : fallback;
22629
- }
22630
- function ReportsModeStoreProvider({
22631
- children,
22632
- initialModes,
22633
- resetPnLModeToDefaultOnMount = true
22634
- }) {
22635
- const [store] = react.useState(
22636
- () => zustand.createStore((set) => ({
22637
- modeByReport: __spreadValues(__spreadValues({}, defaultModeByReport), initialModes),
22638
- resetPnLModeToDefaultOnMount,
22639
- actions: {
22640
- setModeForReport: (report, mode) => set((state) => ({
22641
- modeByReport: __spreadProps(__spreadValues({}, state.modeByReport), {
22642
- [report]: mode
22643
- })
22644
- }))
22645
- }
22646
- }))
22647
- );
22648
- return /* @__PURE__ */ jsxRuntime.jsx(ReportsModeStoreContext.Provider, { value: store, children });
22649
- }
22650
22704
  const useProfitAndLoss = ({ tagFilter, reportingBasis }) => {
22651
22705
  var _a;
22652
- const rangeDisplayMode = useReportModeWithFallback(ReportKey.ProfitAndLoss, "monthPicker");
22653
- const dateRange = useGlobalDateRange({ displayMode: rangeDisplayMode });
22706
+ const [displayMode, setDisplayMode] = react.useState("month");
22707
+ const dateRange = useGlobalDateRange({ displayMode });
22654
22708
  const [filters, setFilters] = react.useState({
22655
22709
  expenses: void 0,
22656
22710
  revenue: void 0
@@ -22774,7 +22828,9 @@ const useProfitAndLoss = ({ tagFilter, reportingBasis }) => {
22774
22828
  tagFilter,
22775
22829
  dateRange,
22776
22830
  selectedLineItem,
22777
- setSelectedLineItem
22831
+ setSelectedLineItem,
22832
+ setDisplayMode,
22833
+ displayMode
22778
22834
  };
22779
22835
  };
22780
22836
  function range(start, end) {
@@ -22783,12 +22839,56 @@ function range(start, end) {
22783
22839
  function isArrayWithAtLeastOne(list) {
22784
22840
  return list.length > 0;
22785
22841
  }
22786
- function getArrayWithAtLeastOneOrFallback(list, fallback) {
22787
- if (list.length === 0) {
22788
- return fallback;
22842
+ var DateGroupBy = /* @__PURE__ */ ((DateGroupBy2) => {
22843
+ DateGroupBy2["AllTime"] = "AllTime";
22844
+ DateGroupBy2["Month"] = "Month";
22845
+ DateGroupBy2["Year"] = "Year";
22846
+ return DateGroupBy2;
22847
+ })(DateGroupBy || {});
22848
+ const DateGroupByOptionConfig = {
22849
+ [
22850
+ "AllTime"
22851
+ /* AllTime */
22852
+ ]: {
22853
+ label: "All time",
22854
+ value: "AllTime"
22855
+ /* AllTime */
22856
+ },
22857
+ [
22858
+ "Month"
22859
+ /* Month */
22860
+ ]: {
22861
+ label: "Compare by month",
22862
+ value: "Month"
22863
+ /* Month */
22864
+ },
22865
+ [
22866
+ "Year"
22867
+ /* Year */
22868
+ ]: {
22869
+ label: "Compare by year",
22870
+ value: "Year"
22871
+ /* Year */
22789
22872
  }
22790
- return list;
22791
- }
22873
+ };
22874
+ const options$3 = Object.values(DateGroupByOptionConfig);
22875
+ const DateGroupByComboBox = ({ value, onValueChange }) => {
22876
+ const selectedOption = value ? DateGroupByOptionConfig[value] : null;
22877
+ const onSelectedValueChange = react.useCallback((option) => {
22878
+ onValueChange((option == null ? void 0 : option.value) || null);
22879
+ }, [onValueChange]);
22880
+ return /* @__PURE__ */ jsxRuntime.jsx(
22881
+ ComboBox,
22882
+ {
22883
+ className: "Layer__DateGroupByComboBox",
22884
+ options: options$3,
22885
+ onSelectedValueChange,
22886
+ selectedValue: selectedOption,
22887
+ isSearchable: false,
22888
+ isClearable: false
22889
+ }
22890
+ );
22891
+ };
22792
22892
  function prepareFiltersBody(compareOptions) {
22793
22893
  const noneFilters = compareOptions.filter(
22794
22894
  ({ tagFilterConfig: { tagFilters: tagFilters2 } }) => tagFilters2 === "None"
@@ -22828,9 +22928,9 @@ function prepareFiltersBody(compareOptions) {
22828
22928
  return isArrayWithAtLeastOne(allFilters) ? allFilters : void 0;
22829
22929
  }
22830
22930
  function preparePeriodsBodyForMonths(dateRange, comparePeriods) {
22831
- const adjustedStartDate = dateFns.startOfMonth(dateRange.startDate);
22931
+ const adjustedEndDate = dateFns.startOfMonth(dateRange.endDate);
22832
22932
  const rawPeriods = range(0, comparePeriods).map((index2) => {
22833
- const currentPeriod = dateFns.subMonths(adjustedStartDate, index2);
22933
+ const currentPeriod = dateFns.subMonths(adjustedEndDate, index2);
22834
22934
  return {
22835
22935
  year: dateFns.getYear(currentPeriod),
22836
22936
  month: dateFns.getMonth(currentPeriod) + 1
@@ -22851,9 +22951,9 @@ function preparePeriodsBodyForMonths(dateRange, comparePeriods) {
22851
22951
  };
22852
22952
  }
22853
22953
  function preparePeriodsBodyForYears(dateRange, comparePeriods) {
22854
- const adjustedStartDate = dateFns.startOfYear(dateRange.startDate);
22954
+ const adjustedEndDate = dateFns.startOfYear(dateRange.endDate);
22855
22955
  const rawPeriods = range(0, comparePeriods).map((index2) => {
22856
- const currentPeriod = dateFns.subYears(adjustedStartDate, index2);
22956
+ const currentPeriod = dateFns.subYears(adjustedEndDate, index2);
22857
22957
  return {
22858
22958
  year: dateFns.getYear(currentPeriod)
22859
22959
  };
@@ -22878,17 +22978,51 @@ function preparePeriodsBodyForDateRange(dateRange) {
22878
22978
  }]
22879
22979
  };
22880
22980
  }
22881
- function preparePeriodsBody(dateRange, comparePeriods, rangeDisplayMode) {
22882
- switch (rangeDisplayMode) {
22883
- case "yearPicker":
22981
+ function preparePeriodsBody(dateRange, comparePeriods, comparisonPeriodMode) {
22982
+ switch (comparisonPeriodMode) {
22983
+ case DateGroupBy.Year:
22884
22984
  return preparePeriodsBodyForYears(dateRange, comparePeriods);
22885
- case "monthPicker":
22985
+ case DateGroupBy.Month:
22886
22986
  return preparePeriodsBodyForMonths(dateRange, comparePeriods);
22987
+ case DateGroupBy.AllTime:
22887
22988
  default:
22888
22989
  return preparePeriodsBodyForDateRange(dateRange);
22889
22990
  }
22890
22991
  }
22891
- const COMPARE_MODES_SUPPORTING_MULTI_PERIOD = ["monthPicker", "yearPicker"];
22992
+ const ProfitAndLossContext = react.createContext({
22993
+ data: void 0,
22994
+ filteredDataRevenue: [],
22995
+ filteredTotalRevenue: void 0,
22996
+ filteredDataExpenses: [],
22997
+ filteredTotalExpenses: void 0,
22998
+ isLoading: true,
22999
+ isValidating: false,
23000
+ isError: false,
23001
+ dateRange: {
23002
+ startDate: dateFns.startOfMonth(/* @__PURE__ */ new Date()),
23003
+ endDate: dateFns.endOfMonth(/* @__PURE__ */ new Date())
23004
+ },
23005
+ refetch: () => {
23006
+ },
23007
+ sidebarScope: void 0,
23008
+ setSidebarScope: () => {
23009
+ },
23010
+ sortBy: () => {
23011
+ },
23012
+ setFilterTypes: () => {
23013
+ },
23014
+ filters: {
23015
+ expenses: void 0,
23016
+ revenue: void 0
23017
+ },
23018
+ tagFilter: void 0,
23019
+ selectedLineItem: null,
23020
+ setSelectedLineItem: () => {
23021
+ },
23022
+ setDisplayMode: () => {
23023
+ },
23024
+ displayMode: "month"
23025
+ });
22892
23026
  const isNotOnlyNoneTag = (compareOptions) => {
22893
23027
  return Boolean(
22894
23028
  compareOptions == null ? void 0 : compareOptions.some((option) => option.tagFilterConfig.tagFilters !== "None")
@@ -22917,16 +23051,24 @@ function useProfitAndLossComparison({
22917
23051
  reportingBasis,
22918
23052
  comparisonConfig
22919
23053
  }) {
22920
- var _a, _b;
22921
- const [comparePeriods, setComparePeriods] = react.useState((_a = comparisonConfig == null ? void 0 : comparisonConfig.defaultPeriods) != null ? _a : 1);
23054
+ var _a;
23055
+ const [comparisonPeriodMode, setComparisonPeriodMode] = react.useState(DateGroupBy.AllTime);
23056
+ const { displayMode } = react.useContext(ProfitAndLossContext);
23057
+ const { startDate, endDate } = useGlobalDateRange({ displayMode: "month" });
23058
+ const comparePeriods = react.useMemo(() => {
23059
+ if (!comparisonPeriodMode || comparisonPeriodMode === DateGroupBy.AllTime) {
23060
+ return 1;
23061
+ }
23062
+ if (comparisonPeriodMode === DateGroupBy.Year) {
23063
+ return Math.abs(dateFns.differenceInCalendarYears(endDate, startDate)) + 1;
23064
+ }
23065
+ return Math.abs(dateFns.differenceInCalendarMonths(endDate, startDate)) + 1;
23066
+ }, [comparisonPeriodMode, endDate, startDate]);
22922
23067
  const [selectedCompareOptions, setSelectedCompareOptionsState] = react.useState(
22923
23068
  (comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter) ? [comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter] : []
22924
23069
  );
22925
- const rangeDisplayMode = useReportModeWithFallback(ReportKey.ProfitAndLoss, "monthPicker");
22926
- const dateRange = useGlobalDateRange({ displayMode: rangeDisplayMode });
22927
- const isPeriodsSelectEnabled = COMPARE_MODES_SUPPORTING_MULTI_PERIOD.includes(rangeDisplayMode);
22928
- const effectiveComparePeriods = isPeriodsSelectEnabled ? comparePeriods : 1;
22929
- const compareModeActive = react.useMemo(() => effectiveComparePeriods > 1 || selectedCompareOptions.length > 1 || selectedCompareOptions.length === 1 && isNotOnlyNoneTag(selectedCompareOptions), [effectiveComparePeriods, selectedCompareOptions]);
23070
+ const dateRange = useGlobalDateRange({ displayMode });
23071
+ const compareModeActive = react.useMemo(() => comparePeriods > 1 || selectedCompareOptions.length > 1 || selectedCompareOptions.length === 1 && isNotOnlyNoneTag(selectedCompareOptions), [comparePeriods, selectedCompareOptions]);
22930
23072
  const setSelectedCompareOptions = (values) => {
22931
23073
  const options2 = values.map(
22932
23074
  (option) => comparisonConfig == null ? void 0 : comparisonConfig.tagComparisonOptions.find(
@@ -22942,7 +23084,7 @@ function useProfitAndLossComparison({
22942
23084
  const { businessId } = useLayerContext();
22943
23085
  const { apiUrl } = useEnvironment();
22944
23086
  const { data: auth } = useAuth();
22945
- const periods = preparePeriodsBody(dateRange, effectiveComparePeriods, rangeDisplayMode);
23087
+ const periods = preparePeriodsBody(dateRange, comparePeriods, comparisonPeriodMode);
22946
23088
  const tagFilters = prepareFiltersBody(selectedCompareOptions);
22947
23089
  const queryKey = buildKey$v(__spreadProps(__spreadValues({}, auth), {
22948
23090
  businessId,
@@ -22968,7 +23110,7 @@ function useProfitAndLossComparison({
22968
23110
  })
22969
23111
  );
22970
23112
  const getProfitAndLossComparisonCsv = (dateRange2, moneyFormat) => {
22971
- const periods2 = preparePeriodsBody(dateRange2, effectiveComparePeriods, rangeDisplayMode);
23113
+ const periods2 = preparePeriodsBody(dateRange2, comparePeriods, comparisonPeriodMode);
22972
23114
  const tagFilters2 = prepareFiltersBody(selectedCompareOptions);
22973
23115
  return Layer.profitAndLossComparisonCsv(apiUrl, auth == null ? void 0 : auth.access_token, {
22974
23116
  params: {
@@ -22986,15 +23128,15 @@ function useProfitAndLossComparison({
22986
23128
  data: data == null ? void 0 : data.pnls,
22987
23129
  isLoading,
22988
23130
  isValidating,
22989
- isPeriodsSelectEnabled,
22990
23131
  compareModeActive,
22991
- comparePeriods: effectiveComparePeriods,
22992
- setComparePeriods,
22993
- compareOptions: (_b = comparisonConfig == null ? void 0 : comparisonConfig.tagComparisonOptions) != null ? _b : [],
23132
+ comparePeriods,
23133
+ compareOptions: (_a = comparisonConfig == null ? void 0 : comparisonConfig.tagComparisonOptions) != null ? _a : [],
22994
23134
  selectedCompareOptions,
22995
23135
  setSelectedCompareOptions,
22996
23136
  getProfitAndLossComparisonCsv,
22997
- comparisonConfig
23137
+ comparisonConfig,
23138
+ comparisonPeriodMode,
23139
+ setComparisonPeriodMode
22998
23140
  };
22999
23141
  }
23000
23142
  const getYearMonthKey = (y, m) => {
@@ -23254,10 +23396,8 @@ const ProfitAndLossChart = ({
23254
23396
  const [compactView, setCompactView] = react.useState(false);
23255
23397
  const barSize = compactView ? 10 : 20;
23256
23398
  const { getColor, business } = useLayerContext();
23257
- const rangeDisplayMode = useReportModeWithFallback(ReportKey.ProfitAndLoss, "monthPicker");
23258
- const dateRange = useGlobalDateRange({ displayMode: rangeDisplayMode });
23399
+ const dateRange = useGlobalDateRange({ displayMode: "month" });
23259
23400
  const { setMonth } = useGlobalDateRangeActions();
23260
- const showIndicator = rangeDisplayMode === "monthPicker";
23261
23401
  const [customCursorSize, setCustomCursorSize] = react.useState({
23262
23402
  width: 0,
23263
23403
  height: 0,
@@ -23753,7 +23893,7 @@ const ProfitAndLossChart = ({
23753
23893
  xAxisId: "revenue",
23754
23894
  stackId: "revenue",
23755
23895
  children: [
23756
- showIndicator ? /* @__PURE__ */ jsxRuntime.jsx(
23896
+ /* @__PURE__ */ jsxRuntime.jsx(
23757
23897
  recharts.LabelList,
23758
23898
  {
23759
23899
  content: /* @__PURE__ */ jsxRuntime.jsx(
@@ -23764,7 +23904,7 @@ const ProfitAndLossChart = ({
23764
23904
  }
23765
23905
  )
23766
23906
  }
23767
- ) : null,
23907
+ ),
23768
23908
  dataOrPlaceholderData.map((entry) => {
23769
23909
  return /* @__PURE__ */ jsxRuntime.jsx(
23770
23910
  recharts.Cell,
@@ -24679,6 +24819,17 @@ const Header = react.forwardRef(
24679
24819
  }
24680
24820
  );
24681
24821
  Header.displayName = "Header";
24822
+ const CloseButton = (_yc) => {
24823
+ var _zc = _yc, {
24824
+ className,
24825
+ textOnly = false
24826
+ } = _zc, props = __objRest(_zc, [
24827
+ "className",
24828
+ "textOnly"
24829
+ ]);
24830
+ const baseClassName2 = classNames("Layer__btn", "Layer__back-btn", className);
24831
+ return /* @__PURE__ */ jsxRuntime.jsx("button", __spreadProps(__spreadValues({}, props), { className: baseClassName2, children: textOnly ? "Back" : /* @__PURE__ */ jsxRuntime.jsx(CloseIcon, { size: 16 }) }));
24832
+ };
24682
24833
  const LedgerAccountsContext = react.createContext({
24683
24834
  data: void 0,
24684
24835
  entryData: void 0,
@@ -25157,37 +25308,6 @@ const DetailReportBreadcrumb = ({
25157
25308
  subtitle && /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", variant: "subtle", children: subtitle })
25158
25309
  ] }) }) });
25159
25310
  };
25160
- const ProfitAndLossContext = react.createContext({
25161
- data: void 0,
25162
- filteredDataRevenue: [],
25163
- filteredTotalRevenue: void 0,
25164
- filteredDataExpenses: [],
25165
- filteredTotalExpenses: void 0,
25166
- isLoading: true,
25167
- isValidating: false,
25168
- isError: false,
25169
- dateRange: {
25170
- startDate: dateFns.startOfMonth(/* @__PURE__ */ new Date()),
25171
- endDate: dateFns.endOfMonth(/* @__PURE__ */ new Date())
25172
- },
25173
- refetch: () => {
25174
- },
25175
- sidebarScope: void 0,
25176
- setSidebarScope: () => {
25177
- },
25178
- sortBy: () => {
25179
- },
25180
- setFilterTypes: () => {
25181
- },
25182
- filters: {
25183
- expenses: void 0,
25184
- revenue: void 0
25185
- },
25186
- tagFilter: void 0,
25187
- selectedLineItem: null,
25188
- setSelectedLineItem: () => {
25189
- }
25190
- });
25191
25311
  const COMPONENT_NAME$8 = "ProfitAndLossDetailReport";
25192
25312
  const ErrorState = () => /* @__PURE__ */ jsxRuntime.jsx(
25193
25313
  DataState,
@@ -25469,7 +25589,7 @@ const ProfitAndLossDetailedCharts = ({
25469
25589
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__profit-and-loss-detailed-charts", children: [
25470
25590
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "Layer__profit-and-loss-detailed-charts__header", children: [
25471
25591
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__profit-and-loss-detailed-charts__head", children: [
25472
- /* @__PURE__ */ jsxRuntime.jsx(Text, { size: TextSize.lg, weight: TextWeight.bold, className: "title", children: humanizeTitle(theScope) }),
25592
+ /* @__PURE__ */ jsxRuntime.jsx(Text, { size: TextSize.lg, weight: TextWeight.bold, className: "title", children: humanizeTitle(theScope, stringOverrides == null ? void 0 : stringOverrides.detailedChartStringOverrides) }),
25473
25593
  /* @__PURE__ */ jsxRuntime.jsx(Text, { size: TextSize.sm, className: "date", children: dateFns.format(dateRange.startDate, "LLLL, y") }),
25474
25594
  showDatePicker && /* @__PURE__ */ jsxRuntime.jsx(GlobalMonthPicker, {})
25475
25595
  ] }),
@@ -25486,7 +25606,7 @@ const ProfitAndLossDetailedCharts = ({
25486
25606
  /* @__PURE__ */ jsxRuntime.jsxs("header", { className: "Layer__profit-and-loss-detailed-charts__header--tablet", children: [
25487
25607
  !hideClose && /* @__PURE__ */ jsxRuntime.jsx(BackButton, { onClick: () => setSidebarScope(void 0) }),
25488
25608
  /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__profit-and-loss-detailed-charts__head", children: [
25489
- /* @__PURE__ */ jsxRuntime.jsx(Text, { size: TextSize.lg, weight: TextWeight.bold, className: "title", children: humanizeTitle(theScope) }),
25609
+ /* @__PURE__ */ jsxRuntime.jsx(Text, { size: TextSize.lg, weight: TextWeight.bold, className: "title", children: humanizeTitle(theScope, stringOverrides == null ? void 0 : stringOverrides.detailedChartStringOverrides) }),
25490
25610
  /* @__PURE__ */ jsxRuntime.jsx(Text, { size: TextSize.sm, className: "date", children: dateFns.format(dateRange.startDate, "LLLL, y") })
25491
25611
  ] })
25492
25612
  ] }),
@@ -25568,11 +25688,8 @@ const ProfitAndLossComparisonContext = react.createContext({
25568
25688
  data: void 0,
25569
25689
  isLoading: true,
25570
25690
  isValidating: false,
25571
- isPeriodsSelectEnabled: true,
25572
25691
  compareModeActive: false,
25573
25692
  comparePeriods: 0,
25574
- setComparePeriods: () => {
25575
- },
25576
25693
  compareOptions: [],
25577
25694
  selectedCompareOptions: [],
25578
25695
  setSelectedCompareOptions: function() {
@@ -25581,7 +25698,10 @@ const ProfitAndLossComparisonContext = react.createContext({
25581
25698
  getProfitAndLossComparisonCsv: function() {
25582
25699
  throw new Error("Function not implemented.");
25583
25700
  },
25584
- comparisonConfig: void 0
25701
+ comparisonConfig: void 0,
25702
+ comparisonPeriodMode: null,
25703
+ setComparisonPeriodMode: () => {
25704
+ }
25585
25705
  });
25586
25706
  const ProfitAndLossFullReportDownloadButton = ({
25587
25707
  stringOverrides,
@@ -25913,7 +26033,7 @@ const options$2 = Object.values(dateSelectionOptionConfig).filter((opt) => opt.v
25913
26033
  const DateSelectionComboBox = () => {
25914
26034
  const [lastPreset, setLastPreset] = react.useState(null);
25915
26035
  const { business } = useLayerContext();
25916
- const dateRange = useGlobalDateRange({ displayMode: "dayRangePicker" });
26036
+ const dateRange = useGlobalDateRange({ displayMode: "full" });
25917
26037
  const { setDateRange } = useGlobalDateRangeActions();
25918
26038
  const selectedPreset = presetForDateRange(dateRange, lastPreset, getActivationDate(business));
25919
26039
  const selectedOption = dateSelectionOptionConfig[selectedPreset != null ? selectedPreset : DatePreset.Custom];
@@ -25937,7 +26057,7 @@ const DateSelectionComboBox = () => {
25937
26057
  );
25938
26058
  };
25939
26059
  const DateRangeSelection = ({ minDate, maxDate }) => {
25940
- const { startDate: globalStartDate, endDate: globalEndDate } = useGlobalDateRange({ displayMode: "dayRangePicker" });
26060
+ const { startDate: globalStartDate, endDate: globalEndDate } = useGlobalDateRange({ displayMode: "full" });
25941
26061
  const { setDateRange: setGlobalDateRange } = useGlobalDateRangeActions();
25942
26062
  const { value } = useSizeClass();
25943
26063
  const {
@@ -26209,26 +26329,32 @@ const useTableExpandRow = () => {
26209
26329
  toggleAllRows
26210
26330
  };
26211
26331
  };
26212
- const generateComparisonPeriods = (startDate, numberOfPeriods, rangeDisplayMode) => {
26213
- switch (rangeDisplayMode) {
26214
- case "yearPicker":
26215
- return generateComparisonYears(startDate, numberOfPeriods);
26332
+ const generateComparisonPeriods = (params) => {
26333
+ switch (params.mode) {
26334
+ case DateGroupBy.Year:
26335
+ return generateComparisonYears(params.endDate, params.numberOfPeriods);
26336
+ case DateGroupBy.Month:
26337
+ return generateComparisonMonths(params.endDate, params.numberOfPeriods);
26216
26338
  default:
26217
- return generateComparisonMonths(startDate, numberOfPeriods);
26339
+ return generateComparisonDateRange(params.startDate, params.endDate);
26218
26340
  }
26219
26341
  };
26220
- const generateComparisonMonths = (startDate, numberOfMonths) => {
26342
+ const generateComparisonMonths = (endDate, numberOfMonths) => {
26221
26343
  return Array.from({ length: numberOfMonths }, (_, index2) => {
26222
- const currentMonth = dateFns.subMonths(startDate, numberOfMonths - index2 - 1);
26223
- return { date: currentMonth, label: dateFns.format(currentMonth, "MMM") };
26344
+ const currentMonth = dateFns.subMonths(endDate, numberOfMonths - index2 - 1);
26345
+ return { date: currentMonth, label: dateFns.format(currentMonth, "MMM yyyy") };
26224
26346
  });
26225
26347
  };
26226
- const generateComparisonYears = (startDate, numberOfYears) => {
26348
+ const generateComparisonYears = (endDate, numberOfYears) => {
26227
26349
  return Array.from({ length: numberOfYears }, (_, index2) => {
26228
- const currentMonth = dateFns.subYears(startDate, numberOfYears - index2 - 1);
26350
+ const currentMonth = dateFns.subYears(endDate, numberOfYears - index2 - 1);
26229
26351
  return { date: currentMonth, label: dateFns.format(currentMonth, "yyyy") };
26230
26352
  });
26231
26353
  };
26354
+ const generateComparisonDateRange = (startDate, endDate) => {
26355
+ const label = `${dateFns.format(startDate, DATE_FORMAT$1)} - ${dateFns.format(endDate, DATE_FORMAT$1)}`;
26356
+ return [{ date: startDate, endDate, label }];
26357
+ };
26232
26358
  const getComparisonValue = (name, depth, cellData) => {
26233
26359
  if (depth === 0) {
26234
26360
  if (typeof cellData === "string" || typeof cellData === "number") {
@@ -26236,8 +26362,8 @@ const getComparisonValue = (name, depth, cellData) => {
26236
26362
  } else {
26237
26363
  return (cellData == null ? void 0 : cellData.value) !== void 0 ? cellData.value : "";
26238
26364
  }
26239
- } else if (typeof cellData === "object" && cellData !== null && "lineItems" in cellData) {
26240
- for (const item of cellData.lineItems || []) {
26365
+ } else if (typeof cellData === "object" && cellData !== null && "line_items" in cellData) {
26366
+ for (const item of cellData.line_items || []) {
26241
26367
  const result = getComparisonLineItemValue(item, name, depth);
26242
26368
  if (result !== "") {
26243
26369
  return result;
@@ -26248,11 +26374,11 @@ const getComparisonValue = (name, depth, cellData) => {
26248
26374
  };
26249
26375
  const getComparisonLineItemValue = (lineItem, name, depth) => {
26250
26376
  if (depth === 1) {
26251
- if (lineItem.displayName === name) {
26377
+ if (lineItem.display_name === name) {
26252
26378
  return lineItem.value !== void 0 ? lineItem.value : "";
26253
26379
  }
26254
- } else if (lineItem.lineItems && lineItem.lineItems.length > 0) {
26255
- for (const childLineItem of lineItem.lineItems) {
26380
+ } else if (lineItem.line_items && lineItem.line_items.length > 0) {
26381
+ for (const childLineItem of lineItem.line_items) {
26256
26382
  const result = getComparisonLineItemValue(childLineItem, name, depth - 1);
26257
26383
  if (result !== "") {
26258
26384
  return result;
@@ -26262,54 +26388,47 @@ const getComparisonLineItemValue = (lineItem, name, depth) => {
26262
26388
  return "";
26263
26389
  };
26264
26390
  const mergeComparisonLineItemsAtDepth = (lineItems) => {
26391
+ var _a, _b, _c;
26265
26392
  const map = /* @__PURE__ */ new Map();
26266
- const mergeItems = (items) => {
26267
- items.forEach((item) => {
26268
- if (!map.has(item.displayName)) {
26269
- map.set(item.displayName, __spreadProps(__spreadValues({}, item), { lineItems: [] }));
26270
- }
26271
- const existingItem = map.get(item.displayName);
26272
- if (item.lineItems) {
26273
- existingItem.lineItems = mergeComparisonLineItemsAtDepth([
26274
- ...existingItem.lineItems || [],
26275
- ...item.lineItems
26276
- ]);
26277
- }
26278
- if (item.value !== void 0) {
26279
- map.set(item.displayName, __spreadProps(__spreadValues({}, existingItem), { value: item.value }));
26280
- }
26281
- });
26282
- };
26283
- mergeItems(lineItems);
26393
+ for (const item of lineItems) {
26394
+ const key = item.display_name;
26395
+ const existing = (_b = map.get(key)) != null ? _b : __spreadProps(__spreadValues({}, item), { line_items: (_a = item.line_items) != null ? _a : [] });
26396
+ let next = existing;
26397
+ if (item.line_items && item.line_items.length > 0) {
26398
+ const mergedChildren = mergeComparisonLineItemsAtDepth([
26399
+ ...(_c = existing.line_items) != null ? _c : [],
26400
+ ...item.line_items
26401
+ ]);
26402
+ next = __spreadProps(__spreadValues({}, next), { line_items: mergedChildren });
26403
+ }
26404
+ if (item.value !== void 0) {
26405
+ next = __spreadProps(__spreadValues({}, next), { value: item.value });
26406
+ }
26407
+ map.set(key, next);
26408
+ }
26284
26409
  return Array.from(map.values());
26285
26410
  };
26286
26411
  const ProfitAndLossCompareTable = ({
26287
26412
  stringOverrides
26288
26413
  }) => {
26414
+ const { dateRange, displayMode } = react.useContext(ProfitAndLossContext);
26289
26415
  const {
26290
26416
  data: comparisonData,
26291
26417
  isLoading,
26292
26418
  comparePeriods,
26293
- selectedCompareOptions
26419
+ selectedCompareOptions,
26420
+ comparisonPeriodMode
26294
26421
  } = react.useContext(ProfitAndLossComparisonContext);
26295
26422
  const { isOpen, setIsOpen } = useTableExpandRow();
26296
26423
  const { data: bookkeepingPeriods } = useBookkeepingPeriods();
26297
- const rangeDisplayMode = useReportModeWithFallback(ReportKey.ProfitAndLoss, "monthPicker");
26298
- const dateRange = useGlobalDateRange({ displayMode: rangeDisplayMode });
26299
26424
  react.useEffect(() => {
26300
26425
  setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
26301
26426
  }, []);
26302
26427
  if (isLoading || comparisonData === void 0) {
26303
- return /* @__PURE__ */ jsxRuntime.jsx(
26304
- "div",
26305
- {
26306
- className: classNames("Layer__profit-and-loss-table__loader-container"),
26307
- children: /* @__PURE__ */ jsxRuntime.jsx(Loader, {})
26308
- }
26309
- );
26428
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__profit-and-loss-table__loader-container", children: /* @__PURE__ */ jsxRuntime.jsx(Loader, {}) });
26310
26429
  }
26311
26430
  const getBookkeepingPeriodStatus = (date2) => {
26312
- if (!bookkeepingPeriods || rangeDisplayMode !== "monthPicker") {
26431
+ if (!bookkeepingPeriods || displayMode !== "month") {
26313
26432
  return;
26314
26433
  }
26315
26434
  const currentMonth = date2.getMonth() + 1;
@@ -26338,7 +26457,7 @@ const ProfitAndLossCompareTable = ({
26338
26457
  )[0];
26339
26458
  lineItem = "display_name" in mergedLineItems ? mergedLineItems : void 0;
26340
26459
  }
26341
- const expandable = (lineItem == null ? void 0 : lineItem.lineItems) && lineItem.lineItems.length > 0 ? true : false;
26460
+ const expandable = (lineItem == null ? void 0 : lineItem.line_items) && lineItem.line_items.length > 0 ? true : false;
26342
26461
  const expanded = expandable ? isOpen(rowKey) : true;
26343
26462
  return /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
26344
26463
  /* @__PURE__ */ jsxRuntime.jsxs(
@@ -26351,20 +26470,29 @@ const ProfitAndLossCompareTable = ({
26351
26470
  variant: expandable ? "expandable" : "default",
26352
26471
  handleExpand: () => setIsOpen(rowKey),
26353
26472
  children: [
26354
- /* @__PURE__ */ jsxRuntime.jsx(TableCell, { primary: true, withExpandIcon: expandable, children: lineItem ? lineItem.displayName : rowDisplayName }),
26473
+ /* @__PURE__ */ jsxRuntime.jsx(
26474
+ TableCell,
26475
+ {
26476
+ primary: true,
26477
+ withExpandIcon: expandable,
26478
+ nowrap: true,
26479
+ className: "Layer__profit-and-loss-compare-table__sticky-cell",
26480
+ children: lineItem ? lineItem.display_name : rowDisplayName
26481
+ }
26482
+ ),
26355
26483
  rowData.map((cell, i) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { isCurrency: true, children: getComparisonValue(
26356
- lineItem ? lineItem.displayName : rowDisplayName,
26484
+ lineItem ? lineItem.display_name : rowDisplayName,
26357
26485
  depth,
26358
26486
  cell
26359
26487
  ) }, "compare-value" + i))
26360
26488
  ]
26361
26489
  }
26362
26490
  ),
26363
- expanded && (lineItem == null ? void 0 : lineItem.lineItems) ? lineItem.lineItems.map(
26491
+ expanded && (lineItem == null ? void 0 : lineItem.line_items) ? lineItem.line_items.map(
26364
26492
  (child) => renderRow(
26365
- child.displayName,
26493
+ child.display_name,
26366
26494
  depth + 1,
26367
- child.displayName,
26495
+ child.display_name,
26368
26496
  child,
26369
26497
  rowData
26370
26498
  )
@@ -26373,7 +26501,13 @@ const ProfitAndLossCompareTable = ({
26373
26501
  };
26374
26502
  return /* @__PURE__ */ jsxRuntime.jsxs(Table, { borderCollapse: "collapse", bottomSpacing: false, children: [
26375
26503
  /* @__PURE__ */ jsxRuntime.jsx(TableHead, { children: selectedCompareOptions && selectedCompareOptions.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { rowKey: "", children: [
26376
- /* @__PURE__ */ jsxRuntime.jsx(TableCell, { isHeaderCell: true }),
26504
+ /* @__PURE__ */ jsxRuntime.jsx(
26505
+ TableCell,
26506
+ {
26507
+ isHeaderCell: true,
26508
+ className: "Layer__profit-and-loss-compare-table__sticky-cell"
26509
+ }
26510
+ ),
26377
26511
  selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsxs(react.Fragment, { children: [
26378
26512
  /* @__PURE__ */ jsxRuntime.jsx(TableCell, { primary: true, isHeaderCell: true, children: option.displayName }, option.displayName + "-" + i),
26379
26513
  comparePeriods && Array.from({ length: comparePeriods - 1 }, (_, index2) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { isHeaderCell: true }, option.displayName + "-" + index2))
@@ -26381,20 +26515,24 @@ const ProfitAndLossCompareTable = ({
26381
26515
  ] }) }),
26382
26516
  /* @__PURE__ */ jsxRuntime.jsxs(TableBody, { children: [
26383
26517
  comparePeriods && /* @__PURE__ */ jsxRuntime.jsxs(TableRow, { rowKey: "", children: [
26384
- /* @__PURE__ */ jsxRuntime.jsx(TableCell, { isHeaderCell: true }),
26385
- selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: generateComparisonPeriods(
26386
- dateRange.startDate,
26387
- comparePeriods,
26388
- rangeDisplayMode
26389
- ).map((month, index2) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { isHeaderCell: true, children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "2xs", children: [
26518
+ /* @__PURE__ */ jsxRuntime.jsx(
26519
+ TableCell,
26520
+ {
26521
+ isHeaderCell: true,
26522
+ className: "Layer__profit-and-loss-compare-table__sticky-cell"
26523
+ }
26524
+ ),
26525
+ selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: generateComparisonPeriods(__spreadValues({
26526
+ numberOfPeriods: comparePeriods,
26527
+ mode: comparisonPeriodMode
26528
+ }, dateRange)).map((month, index2) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { isHeaderCell: true, children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "2xs", children: [
26390
26529
  month.label,
26391
26530
  " ",
26392
26531
  getBookkeepingPeriodStatus(month.date)
26393
- ] }) }, option.displayName + "-" + index2)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: generateComparisonPeriods(
26394
- dateRange.startDate,
26395
- comparePeriods,
26396
- rangeDisplayMode
26397
- ).map((month, index2) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { isHeaderCell: true, children: month.label }, "total-" + index2 + "-cell")) }, "total-1")
26532
+ ] }) }, option.displayName + "-" + index2)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsxRuntime.jsx(react.Fragment, { children: generateComparisonPeriods(__spreadValues({
26533
+ numberOfPeriods: comparePeriods,
26534
+ mode: comparisonPeriodMode
26535
+ }, dateRange)).map((month, index2) => /* @__PURE__ */ jsxRuntime.jsx(TableCell, { isHeaderCell: true, children: month.label }, "total-" + index2 + "-cell")) }, "total-1")
26398
26536
  ] }),
26399
26537
  renderRow("income", 0, "Income"),
26400
26538
  renderRow("cost_of_goods_sold", 0, "Cost of Goods Sold"),
@@ -26602,13 +26740,15 @@ const ProfitAndLossTableComponent = ({
26602
26740
  rowKey: "other_outflows",
26603
26741
  rowIndex: 8
26604
26742
  }),
26605
- data.customLineItems && renderLineItem({
26606
- lineItem: data.customLineItems,
26607
- depth: 0,
26608
- rowKey: "other_activity",
26609
- rowIndex: 9,
26610
- showValue: false
26611
- })
26743
+ data.customLineItems && data.customLineItems.map(
26744
+ (customLineItem, index2) => renderLineItem({
26745
+ lineItem: customLineItem,
26746
+ depth: 0,
26747
+ rowKey: `custom_line_item_${index2}`,
26748
+ rowIndex: 9 + index2,
26749
+ showValue: false
26750
+ })
26751
+ )
26612
26752
  ] }) });
26613
26753
  };
26614
26754
  const ProfitAndLossTableWithProvider = (props) => {
@@ -26670,44 +26810,16 @@ const selectStyles = {
26670
26810
  });
26671
26811
  }
26672
26812
  };
26673
- function buildCompareOptions(rangeDisplayMode) {
26674
- switch (rangeDisplayMode) {
26675
- case "monthPicker":
26676
- return [
26677
- { value: 1, label: "This month" },
26678
- { value: 2, label: "Last 2 months" },
26679
- { value: 3, label: "Last 3 months" }
26680
- ];
26681
- case "yearPicker":
26682
- return [
26683
- { value: 1, label: "This year" },
26684
- { value: 2, label: "Last 2 years" },
26685
- { value: 3, label: "Last 3 years" }
26686
- ];
26687
- default:
26688
- return [
26689
- { value: 1, label: "This period" },
26690
- { value: 2, label: "Last 2 periods" },
26691
- { value: 3, label: "Last 3 periods" }
26692
- ];
26693
- }
26694
- }
26695
26813
  const ProfitAndLossCompareOptions = () => {
26696
26814
  const {
26697
- setComparePeriods,
26698
26815
  setSelectedCompareOptions,
26699
- isPeriodsSelectEnabled,
26700
- comparePeriods,
26701
26816
  compareOptions,
26702
26817
  selectedCompareOptions,
26703
- comparisonConfig
26818
+ comparisonConfig,
26819
+ comparisonPeriodMode,
26820
+ setComparisonPeriodMode
26704
26821
  } = react.useContext(ProfitAndLossComparisonContext);
26705
- const rangeDisplayMode = useReportModeWithFallback(ReportKey.ProfitAndLoss, "monthPicker");
26706
- const periods = react.useMemo(
26707
- () => comparePeriods !== 0 ? comparePeriods : 1,
26708
- [comparePeriods]
26709
- );
26710
- const timeComparisonOptions = buildCompareOptions(rangeDisplayMode);
26822
+ const { displayMode } = react.useContext(ProfitAndLossContext);
26711
26823
  const tagComparisonSelectOptions = compareOptions.map(
26712
26824
  (tagComparisonOption) => {
26713
26825
  return {
@@ -26719,19 +26831,8 @@ const ProfitAndLossCompareOptions = () => {
26719
26831
  if (!comparisonConfig) {
26720
26832
  return null;
26721
26833
  }
26722
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "Layer__compare__options", children: [
26723
- /* @__PURE__ */ jsxRuntime.jsx(
26724
- Select,
26725
- {
26726
- options: timeComparisonOptions,
26727
- onChange: (e) => setComparePeriods(e && e.value ? e.value : 1),
26728
- value: timeComparisonOptions.find(
26729
- (option) => option.value === periods
26730
- ),
26731
- placeholder: rangeDisplayMode === "yearPicker" ? "Compare years" : "Compare months",
26732
- disabled: !isPeriodsSelectEnabled
26733
- }
26734
- ),
26834
+ return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { align: "center", gap: "xs", children: [
26835
+ displayMode === "full" && /* @__PURE__ */ jsxRuntime.jsx(DateGroupByComboBox, { value: comparisonPeriodMode, onValueChange: setComparisonPeriodMode }),
26735
26836
  /* @__PURE__ */ jsxRuntime.jsx(
26736
26837
  MultiSelect,
26737
26838
  {
@@ -26748,7 +26849,8 @@ const ProfitAndLossCompareOptions = () => {
26748
26849
  };
26749
26850
  }),
26750
26851
  placeholder: "Select views",
26751
- styles: selectStyles
26852
+ styles: selectStyles,
26853
+ className: "Layer__ProfitAndLoss__TagMultiSelect"
26752
26854
  }
26753
26855
  )
26754
26856
  ] });
@@ -26762,8 +26864,11 @@ const ProfitAndLossReport = ({
26762
26864
  hideHeader
26763
26865
  }) => {
26764
26866
  var _a;
26765
- const { selectedLineItem, setSelectedLineItem } = react.useContext(ProfitAndLossContext);
26867
+ const { selectedLineItem, setSelectedLineItem, setDisplayMode } = react.useContext(ProfitAndLossContext);
26766
26868
  const { comparisonConfig } = react.useContext(ProfitAndLossComparisonContext);
26869
+ react.useEffect(() => {
26870
+ setDisplayMode(dateSelectionMode);
26871
+ }, [dateSelectionMode, setDisplayMode]);
26767
26872
  const breadcrumbIndexMap = react.useMemo(() => {
26768
26873
  if (!selectedLineItem) return {};
26769
26874
  return selectedLineItem.breadcrumbPath.reduce((acc, item, index2) => {
@@ -26886,13 +26991,13 @@ function toMiniChartData({
26886
26991
  function ProfitAndLossSummariesMiniChart({
26887
26992
  data,
26888
26993
  chartColorsList,
26889
- variants
26994
+ variants: variants2
26890
26995
  }) {
26891
26996
  const typeColorMapping = mapTypesToColors(data, chartColorsList);
26892
26997
  let chartDimension = 52;
26893
26998
  let innerRadius = 10;
26894
26999
  let outerRadius = 16;
26895
- switch (variants == null ? void 0 : variants.size) {
27000
+ switch (variants2 == null ? void 0 : variants2.size) {
26896
27001
  case "sm":
26897
27002
  chartDimension = 52;
26898
27003
  innerRadius = 10;
@@ -26936,10 +27041,10 @@ function ProfitAndLossSummariesMiniChart({
26936
27041
  ) });
26937
27042
  }
26938
27043
  function ProfitAndLossSummariesHeading({
26939
- variants,
27044
+ variants: variants2,
26940
27045
  children
26941
27046
  }) {
26942
- const { size = "2xs" } = variants != null ? variants : {};
27047
+ const { size = "2xs" } = variants2 != null ? variants2 : {};
26943
27048
  return /* @__PURE__ */ jsxRuntime.jsx(Heading, { level: 3, size, slot: "heading", children });
26944
27049
  }
26945
27050
  const CLASS_NAME$3 = "Layer__ProfitAndLossSummariesSummary";
@@ -26950,14 +27055,14 @@ function ProfitAndLossSummariesSummary({
26950
27055
  amount,
26951
27056
  isLoading,
26952
27057
  slots,
26953
- variants
27058
+ variants: variants2
26954
27059
  }) {
26955
27060
  const { Chart } = slots != null ? slots : {};
26956
- const { size = "2xs" } = variants != null ? variants : {};
27061
+ const { size = "2xs" } = variants2 != null ? variants2 : {};
26957
27062
  const dataProperties = toDataProperties({ size });
26958
27063
  return /* @__PURE__ */ jsxRuntime.jsxs("div", __spreadProps(__spreadValues({ className: CLASS_NAME$3 }, dataProperties), { children: [
26959
27064
  Chart ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: CHART_AREA_CLASS_NAME, children: Chart }) : /* @__PURE__ */ jsxRuntime.jsx("div", { className: CHART_AREA_EMPTY_FRAME_CLASS_NAME }),
26960
- /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossSummariesHeading, { variants, children: label }),
27065
+ /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossSummariesHeading, { variants: variants2, children: label }),
26961
27066
  isLoading ? /* @__PURE__ */ jsxRuntime.jsx(SkeletonLoader, { height: "20px" }) : /* @__PURE__ */ jsxRuntime.jsx(MoneySpan, { slot: "amount", amount, size: "lg", bold: true })
26962
27067
  ] }));
26963
27068
  }
@@ -26966,10 +27071,10 @@ function TransactionsToReview({
26966
27071
  onClick,
26967
27072
  usePnlDateRange,
26968
27073
  tagFilter = void 0,
26969
- variants
27074
+ variants: variants2
26970
27075
  }) {
26971
27076
  var _a;
26972
- const { size = "sm" } = variants != null ? variants : {};
27077
+ const { size = "sm" } = variants2 != null ? variants2 : {};
26973
27078
  const { dateRange: contextDateRange } = react.useContext(ProfitAndLossContext);
26974
27079
  const dateRange = usePnlDateRange ? contextDateRange : void 0;
26975
27080
  const currentDate = react.useMemo(() => dateRange ? dateRange.startDate : dateFns.startOfMonth(/* @__PURE__ */ new Date()), [dateRange]);
@@ -27043,7 +27148,7 @@ function TransactionsToReview({
27043
27148
  }
27044
27149
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { onClick, className: CLASS_NAME$2, children: [
27045
27150
  /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: verticalGap, align: "start", children: [
27046
- /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossSummariesHeading, { variants, children: "Transactions to review" }),
27151
+ /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossSummariesHeading, { variants: variants2, children: "Transactions to review" }),
27047
27152
  transactionsToReviewBadge
27048
27153
  ] }),
27049
27154
  /* @__PURE__ */ jsxRuntime.jsx(IconButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(ChevronRight, {}), withBorder: true, onClick })
@@ -27057,7 +27162,7 @@ function Internal_ProfitAndLossSummaries({
27057
27162
  stringOverrides,
27058
27163
  chartColorsList,
27059
27164
  slots,
27060
- variants
27165
+ variants: variants2
27061
27166
  }) {
27062
27167
  var _a, _b, _c, _d;
27063
27168
  const {
@@ -27094,11 +27199,11 @@ function Internal_ProfitAndLossSummaries({
27094
27199
  {
27095
27200
  data: revenueChartData,
27096
27201
  chartColorsList,
27097
- variants
27202
+ variants: variants2
27098
27203
  }
27099
27204
  )
27100
27205
  },
27101
- variants
27206
+ variants: variants2
27102
27207
  }
27103
27208
  )
27104
27209
  }
@@ -27120,11 +27225,11 @@ function Internal_ProfitAndLossSummaries({
27120
27225
  {
27121
27226
  data: expensesChartData,
27122
27227
  chartColorsList,
27123
- variants
27228
+ variants: variants2
27124
27229
  }
27125
27230
  )
27126
27231
  },
27127
- variants
27232
+ variants: variants2
27128
27233
  }
27129
27234
  )
27130
27235
  }
@@ -27134,17 +27239,17 @@ function Internal_ProfitAndLossSummaries({
27134
27239
  {
27135
27240
  label: (stringOverrides == null ? void 0 : stringOverrides.netProfitLabel) || "Net Profit",
27136
27241
  amount: (_d = data == null ? void 0 : data.netProfit) != null ? _d : 0,
27137
- variants,
27242
+ variants: variants2,
27138
27243
  isLoading
27139
27244
  }
27140
27245
  ) }),
27141
27246
  unstable_AdditionalListItems.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossSummariesListItem, { children: item }, index2))
27142
27247
  ] }) });
27143
27248
  }
27144
- function ProfitAndLossSummaries(_yc) {
27145
- var _zc = _yc, {
27249
+ function ProfitAndLossSummaries(_Ac) {
27250
+ var _Bc = _Ac, {
27146
27251
  onTransactionsToReviewClick
27147
- } = _zc, restProps = __objRest(_zc, [
27252
+ } = _Bc, restProps = __objRest(_Bc, [
27148
27253
  "onTransactionsToReviewClick"
27149
27254
  ]);
27150
27255
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -27166,7 +27271,7 @@ function ProfitAndLossSummaries(_yc) {
27166
27271
  })
27167
27272
  );
27168
27273
  }
27169
- const ProfitAndLossWithoutReportsModeProvider = ({
27274
+ const ProfitAndLoss = ({
27170
27275
  children,
27171
27276
  tagFilter,
27172
27277
  comparisonConfig,
@@ -27177,14 +27282,6 @@ const ProfitAndLossWithoutReportsModeProvider = ({
27177
27282
  const comparisonContextData = useProfitAndLossComparison({ comparisonConfig, reportingBasis });
27178
27283
  return /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossContext.Provider, { value: contextData, children: /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossComparisonContext.Provider, { value: comparisonContextData, children: asContainer ? /* @__PURE__ */ jsxRuntime.jsx(Container, { name: "profit-and-loss", children }) : children }) });
27179
27284
  };
27180
- const ProfitAndLossWithReportsModeProvider = (props) => {
27181
- return /* @__PURE__ */ jsxRuntime.jsx(ReportsModeStoreProvider, { initialModes: { ProfitAndLoss: "monthPicker" }, children: /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossWithoutReportsModeProvider, __spreadValues({}, props)) });
27182
- };
27183
- const ProfitAndLoss = (_Ac) => {
27184
- var _Bc = _Ac, { withReportsModeProvider = true } = _Bc, restProps = __objRest(_Bc, ["withReportsModeProvider"]);
27185
- if (withReportsModeProvider) return /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossWithReportsModeProvider, __spreadValues({}, restProps));
27186
- return /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossWithoutReportsModeProvider, __spreadValues({}, restProps));
27187
- };
27188
27285
  ProfitAndLoss.Chart = ProfitAndLossChart;
27189
27286
  ProfitAndLoss.Summaries = ProfitAndLossSummaries;
27190
27287
  ProfitAndLoss.DetailedCharts = ProfitAndLossDetailedCharts;
@@ -27589,9 +27686,6 @@ const CombinedDateSelection = ({ mode }) => {
27589
27686
  return /* @__PURE__ */ jsxRuntime.jsx(DateSelection, {});
27590
27687
  };
27591
27688
  const COMPONENT_NAME$7 = "balance-sheet";
27592
- const StandaloneBalanceSheet = (props) => {
27593
- return /* @__PURE__ */ jsxRuntime.jsx(ReportsModeStoreProvider, { initialModes: { BalanceSheet: "dayPicker" }, children: /* @__PURE__ */ jsxRuntime.jsx(BalanceSheet, __spreadValues({}, props)) });
27594
- };
27595
27689
  const BalanceSheet = (props) => {
27596
27690
  return /* @__PURE__ */ jsxRuntime.jsx(
27597
27691
  BalanceSheetView,
@@ -27914,27 +28008,7 @@ function useStatementOfCashFlow({
27914
28008
  )().then(({ data }) => data)
27915
28009
  );
27916
28010
  }
27917
- const DEFAULT_ALLOWED_PICKER_MODES = ["monthPicker"];
27918
- const getAllowedDateRangePickerModes = ({
27919
- allowedDatePickerModes,
27920
- defaultDatePickerMode
27921
- }) => getArrayWithAtLeastOneOrFallback(
27922
- allowedDatePickerModes != null ? allowedDatePickerModes : defaultDatePickerMode ? [defaultDatePickerMode] : [],
27923
- DEFAULT_ALLOWED_PICKER_MODES
27924
- );
27925
- const getInitialDateRangePickerMode = ({
27926
- allowedDatePickerModes,
27927
- defaultDatePickerMode
27928
- }) => {
27929
- const allowedDateRangePickerModes = getAllowedDateRangePickerModes({ allowedDatePickerModes, defaultDatePickerMode });
27930
- const initialRangeDisplayMode = defaultDatePickerMode && allowedDateRangePickerModes.includes(defaultDatePickerMode) ? defaultDatePickerMode : allowedDateRangePickerModes[0];
27931
- return initialRangeDisplayMode;
27932
- };
27933
28011
  const COMPONENT_NAME$6 = "statement-of-cash-flow";
27934
- const StandaloneStatementOfCashFlow = (props) => {
27935
- const initialModeForStatementOfCashFlows = getInitialDateRangePickerMode(props);
27936
- return /* @__PURE__ */ jsxRuntime.jsx(ReportsModeStoreProvider, { initialModes: { StatementOfCashFlows: initialModeForStatementOfCashFlows }, children: /* @__PURE__ */ jsxRuntime.jsx(StatementOfCashFlow, __spreadValues({}, props)) });
27937
- };
27938
28012
  const StatementOfCashFlow = (props) => {
27939
28013
  return /* @__PURE__ */ jsxRuntime.jsx(StatementOfCashFlowView, __spreadValues({}, props));
27940
28014
  };
@@ -27942,8 +28016,7 @@ const StatementOfCashFlowView = ({
27942
28016
  stringOverrides,
27943
28017
  dateSelectionMode = "full"
27944
28018
  }) => {
27945
- const displayMode = useReportModeWithFallback(ReportKey.StatementOfCashFlows, "monthPicker");
27946
- const dateRange = useGlobalDateRange({ displayMode });
28019
+ const dateRange = useGlobalDateRange({ displayMode: dateSelectionMode });
27947
28020
  const { data, isLoading } = useStatementOfCashFlow(dateRange);
27948
28021
  const { view, containerRef } = useElementViewSize();
27949
28022
  return /* @__PURE__ */ jsxRuntime.jsx(TableProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -28633,7 +28706,7 @@ const useChartOfAccounts = ({ withDates = false } = {}) => {
28633
28706
  const { businessId } = useLayerContext();
28634
28707
  const { apiUrl } = useEnvironment();
28635
28708
  const { data: auth } = useAuth();
28636
- const { startDate, endDate } = useGlobalDateRange({ displayMode: "monthPicker" });
28709
+ const { startDate, endDate } = useGlobalDateRange({ displayMode: "month" });
28637
28710
  const [form, setForm] = react.useState();
28638
28711
  const [sendingForm, setSendingForm] = react.useState(false);
28639
28712
  const [apiError, setApiError] = react.useState(void 0);
@@ -36207,7 +36280,8 @@ const BookkeepingOverview = ({
36207
36280
  {
36208
36281
  text: ((_e = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _e.header) || "Profit & Loss",
36209
36282
  withDatePicker: true,
36210
- withStatus: true
36283
+ withStatus: true,
36284
+ dateSelectionMode: "month"
36211
36285
  }
36212
36286
  ),
36213
36287
  /* @__PURE__ */ jsxRuntime.jsx(BookkeepingProfitAndLossSummariesContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(
@@ -36321,7 +36395,7 @@ const AccountingOverview = ({
36321
36395
  children: /* @__PURE__ */ jsxRuntime.jsxs(
36322
36396
  View,
36323
36397
  {
36324
- title,
36398
+ title: (stringOverrides == null ? void 0 : stringOverrides.title) || title,
36325
36399
  showHeader: showTitle,
36326
36400
  header: /* @__PURE__ */ jsxRuntime.jsx(Header, { children: /* @__PURE__ */ jsxRuntime.jsx(HeaderRow, { children: /* @__PURE__ */ jsxRuntime.jsx(HeaderCol, { children: /* @__PURE__ */ jsxRuntime.jsx(GlobalMonthPicker, {}) }) }) }),
36327
36401
  children: [
@@ -36545,7 +36619,7 @@ const ProjectProfitabilityView = ({
36545
36619
  valueOptions,
36546
36620
  showTitle,
36547
36621
  stringOverrides,
36548
- datePickerMode = "monthPicker",
36622
+ dateSelectionMode = "month",
36549
36623
  csvMoneyFormat = "DOLLAR_STRING"
36550
36624
  }) => {
36551
36625
  const [activeTab, setActiveTab] = react.useState("overview");
@@ -36638,7 +36712,7 @@ const ProjectProfitabilityView = ({
36638
36712
  ProfitAndLoss.Report,
36639
36713
  {
36640
36714
  stringOverrides,
36641
- datePickerMode,
36715
+ dateSelectionMode,
36642
36716
  csvMoneyFormat
36643
36717
  }
36644
36718
  ) })
@@ -38812,7 +38886,7 @@ function useUnifiedReportDateVariant() {
38812
38886
  function useUnifiedReportWithDateParams() {
38813
38887
  const store = react.useContext(UnifiedReportStoreContext);
38814
38888
  const { date: effectiveDate } = useGlobalDate();
38815
- const { startDate, endDate } = useGlobalDateRange({ displayMode: "dayRangePicker" });
38889
+ const { startDate, endDate } = useGlobalDateRange({ displayMode: "full" });
38816
38890
  const report = zustand.useStore(store, (state) => state.report);
38817
38891
  const dateVariant = reportToDateVariantMap[report];
38818
38892
  switch (dateVariant) {
@@ -39081,13 +39155,6 @@ const Reports = ({
39081
39155
  const { view, containerRef } = useElementViewSize();
39082
39156
  const options2 = getOptions(enabledReports);
39083
39157
  const defaultTitle2 = enabledReports.length > 1 ? "Reports" : (_a = options2.find((option) => option.value === enabledReports[0])) == null ? void 0 : _a.label;
39084
- const initialModeForProfitAndLoss = profitAndLossConfig ? getInitialDateRangePickerMode(profitAndLossConfig) : "monthPicker";
39085
- const initialModeForStatementOfCashFlows = statementOfCashFlowConfig ? getInitialDateRangePickerMode(statementOfCashFlowConfig) : "monthPicker";
39086
- const initialModes = {
39087
- [ReportKey.ProfitAndLoss]: initialModeForProfitAndLoss,
39088
- [ReportKey.BalanceSheet]: "dayPicker",
39089
- [ReportKey.StatementOfCashFlows]: initialModeForStatementOfCashFlows
39090
- };
39091
39158
  return /* @__PURE__ */ jsxRuntime.jsxs(
39092
39159
  View,
39093
39160
  {
@@ -39103,7 +39170,7 @@ const Reports = ({
39103
39170
  onChange: (opt) => setActiveTab(opt.target.value)
39104
39171
  }
39105
39172
  ) }),
39106
- /* @__PURE__ */ jsxRuntime.jsx(Container, { name: "reports", ref: containerRef, children: /* @__PURE__ */ jsxRuntime.jsx(ReportsModeStoreProvider, { initialModes, resetPnLModeToDefaultOnMount: false, children: /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLoss, { asContainer: false, comparisonConfig, withReportsModeProvider: false, children: /* @__PURE__ */ jsxRuntime.jsx(
39173
+ /* @__PURE__ */ jsxRuntime.jsx(Container, { name: "reports", ref: containerRef, children: /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLoss, { asContainer: false, comparisonConfig, children: /* @__PURE__ */ jsxRuntime.jsx(
39107
39174
  ReportsPanel,
39108
39175
  {
39109
39176
  openReport: activeTab,
@@ -39113,7 +39180,7 @@ const Reports = ({
39113
39180
  view,
39114
39181
  renderInAppLink
39115
39182
  }
39116
- ) }) }) })
39183
+ ) }) })
39117
39184
  ]
39118
39185
  }
39119
39186
  );
@@ -42925,7 +42992,7 @@ const BusinessProvider = ({
42925
42992
  hasBeenTouched,
42926
42993
  resetCaches
42927
42994
  } = useDataSync();
42928
- const globalDateRange = useGlobalDateRange({ displayMode: "dayRangePicker" });
42995
+ const globalDateRange = useGlobalDateRange({ displayMode: "full" });
42929
42996
  const { setDateRange } = useGlobalDateRangeActions();
42930
42997
  const dateRange = react.useMemo(() => ({
42931
42998
  range: globalDateRange,
@@ -43089,7 +43156,7 @@ const LayerProvider = (_od) => {
43089
43156
  ) }) });
43090
43157
  };
43091
43158
  exports.AccountingOverview = AccountingOverview;
43092
- exports.BalanceSheet = StandaloneBalanceSheet;
43159
+ exports.BalanceSheet = BalanceSheet;
43093
43160
  exports.BankTransactions = BankTransactions;
43094
43161
  exports.BankTransactionsWithLinkedAccounts = BankTransactionsWithLinkedAccounts;
43095
43162
  exports.BookkeepingOverview = BookkeepingOverview;
@@ -43112,7 +43179,7 @@ exports.ProfitAndLoss = ProfitAndLoss;
43112
43179
  exports.ProfitAndLossView = ProfitAndLossView;
43113
43180
  exports.ProjectProfitabilityView = ProjectProfitabilityView;
43114
43181
  exports.Reports = Reports;
43115
- exports.StatementOfCashFlow = StandaloneStatementOfCashFlow;
43182
+ exports.StatementOfCashFlow = StatementOfCashFlow;
43116
43183
  exports.Tasks = Tasks;
43117
43184
  exports.unstable_BillsView = unstable_BillsView;
43118
43185
  exports.unstable_UnifiedReports = UnifiedReport;