@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.
@@ -53,7 +53,7 @@ var __async = (__this, __arguments, generator) => {
53
53
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
54
54
  import { createContext, useContext, useMemo, useState, useEffect, forwardRef, isValidElement, cloneElement, useRef, useCallback, useLayoutEffect, useImperativeHandle, useId, createElement, Component, Children, Fragment as Fragment$1, useReducer } from "react";
55
55
  import { usePlaidLink } from "react-plaid-link";
56
- import { formatISO, differenceInDays, endOfDay, startOfMonth, endOfMonth, startOfYear, min, endOfYear, max, isWithinInterval, parseISO, differenceInCalendarMonths, format, isValid, subMonths, getYear, getMonth, subYears, sub, differenceInMonths, add, startOfDay, endOfToday, isEqual, addYears, subQuarters, addQuarters, endOfQuarter, startOfQuarter, addMonths, set, startOfToday, endOfYesterday, formatDate as formatDate$1 } from "date-fns";
56
+ import { formatISO, differenceInDays, endOfDay, startOfMonth, endOfMonth, min, max, isWithinInterval, parseISO, differenceInCalendarMonths, format, startOfYear, isValid, subMonths, getYear, getMonth, subYears, differenceInCalendarYears, sub, differenceInMonths, add, startOfDay, endOfToday, isEqual, addYears, endOfYear, subQuarters, addQuarters, endOfQuarter, startOfQuarter, addMonths, set, startOfToday, endOfYesterday, formatDate as formatDate$1 } from "date-fns";
57
57
  import { fromDate, getLocalTimeZone, CalendarDate, ZonedDateTime, toCalendarDate, today } from "@internationalized/date";
58
58
  import useSWR, { useSWRConfig, SWRConfig } from "swr";
59
59
  import { createStore, useStore } from "zustand";
@@ -65,10 +65,11 @@ import { Schema, pipe, BigDecimal, Option, Effect } from "effect";
65
65
  import useSWRInfinite from "swr/infinite";
66
66
  import { debounce, uniqBy, merge, uniqueId } from "lodash-es";
67
67
  import useSWRMutation from "swr/mutation";
68
- import { Button as Button$2, Menu as Menu$1, MenuItem as MenuItem$2, Header as Header$3, Label as Label$1, Text as Text$1, MenuTrigger, Popover as Popover$1, ModalOverlay as ModalOverlay$1, Modal as Modal$1, Dialog as Dialog$1, Heading as Heading$2, Checkbox as Checkbox$1, Calendar as Calendar$1, CalendarGrid as CalendarGrid$1, CalendarGridBody as CalendarGridBody$1, CalendarCell as CalendarCell$1, CalendarGridHeader as CalendarGridHeader$1, CalendarHeaderCell as CalendarHeaderCell$1, DateField as DateField$1, DateInput as DateInput$1, DateSegment as DateSegment$1, DatePicker as DatePicker$2, Group, Form as Form$1, TextField as TextField$1, FieldError as FieldError$1, SearchField as SearchField$1, Input as Input$2, Switch as Switch$1, TextArea as TextArea$1, GridList, GridListItem, DialogTrigger, Table as Table$2, Column as Column$1, Cell as Cell$1, TableHeader as TableHeader$1, TableBody as TableBody$2, Row as Row$1, Link as Link$3, Meter as Meter$1 } from "react-aria-components";
68
+ import { Button as Button$2, Menu as Menu$1, MenuItem as MenuItem$2, Header as Header$3, Label as Label$1, Text as Text$1, MenuTrigger, Popover as Popover$1, ModalOverlay as ModalOverlay$1, Modal as Modal$1, Dialog as Dialog$1, Heading as Heading$2, Checkbox as Checkbox$1, Calendar as Calendar$1, CalendarGrid as CalendarGrid$1, CalendarGridBody as CalendarGridBody$1, CalendarCell as CalendarCell$1, CalendarGridHeader as CalendarGridHeader$1, CalendarHeaderCell as CalendarHeaderCell$1, DateField as DateField$1, DateInput as DateInput$1, DateSegment as DateSegment$1, DatePicker as DatePicker$2, Group, Form as Form$1, TextField as TextField$1, FieldError as FieldError$1, GridListItem, GridList, SearchField as SearchField$1, Input as Input$2, Switch as Switch$1, TextArea as TextArea$1, DialogTrigger, Table as Table$2, Column as Column$1, Cell as Cell$1, TableHeader as TableHeader$1, TableBody as TableBody$2, Row as Row$1, Link as Link$3, Meter as Meter$1 } from "react-aria-components";
69
69
  import useResizeObserver from "@react-hook/resize-observer";
70
70
  import { mergeRefs } from "react-merge-refs";
71
- import { UploadCloud as UploadCloud$1, LoaderCircle, X as X$1, Minus, Check as Check$1, TriangleAlert, ChevronDown as ChevronDown$1, Search, ChevronLeft as ChevronLeft$1, FileSpreadsheet, FileDownIcon, CopyIcon, RefreshCcw as RefreshCcw$1, ChevronRight as ChevronRight$1, MenuIcon, PencilRuler, SearchX, Trash2, CheckIcon, AlertCircle as AlertCircle$1, List, AlertTriangle, Save as Save$1, Calendar as Calendar$2, Download, Users, Milestone, Video, Clock as Clock$1, Link as Link$4, Plus as Plus$1, HandCoins, Trash as Trash$1, Menu as Menu$2, Send } from "lucide-react";
71
+ import { UploadCloud as UploadCloud$1, LoaderCircle, X as X$1, Minus, Check as Check$1, TriangleAlert, ChevronDown as ChevronDown$1, Layers2Icon, Search, ChevronLeft as ChevronLeft$1, FileSpreadsheet, FileDownIcon, CopyIcon, RefreshCcw as RefreshCcw$1, ChevronRight as ChevronRight$1, MenuIcon, PencilRuler, SearchX, Trash2, CheckIcon, AlertCircle as AlertCircle$1, List, AlertTriangle, Save as Save$1, Calendar as Calendar$2, Download, Users, Milestone, Video, Clock as Clock$1, Link as Link$4, Plus as Plus$1, HandCoins, Trash as Trash$1, Menu as Menu$2, Send } from "lucide-react";
72
+ import { AnimatePresence, motion } from "motion/react";
72
73
  import CurrencyInput from "react-currency-input-field";
73
74
  import Select$1, { components } from "react-select";
74
75
  import { v4 } from "uuid";
@@ -110,7 +111,7 @@ const LinkedAccountsContext = 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(date, cutoff = endOfDay(/* @__PURE__ */ new Date()
1766
1767
  return min([date, cutoff]);
1767
1768
  }
1768
1769
  const RANGE_MODE_LOOKUP = {
1769
- dayPicker: {
1770
+ date: {
1770
1771
  getStartDate: ({ startDate }) => startOfMonth(startDate),
1771
1772
  getEndDate: ({ endDate }) => clampToPresentOrPast(endOfDay(endDate))
1772
1773
  },
1773
- dayRangePicker: {
1774
+ full: {
1774
1775
  getStartDate: ({ startDate }) => startDate,
1775
1776
  getEndDate: ({ endDate }) => clampToPresentOrPast(endOfDay(endDate))
1776
1777
  },
1777
- monthPicker: {
1778
+ month: {
1778
1779
  getStartDate: ({ startDate }) => startOfMonth(startDate),
1779
1780
  getEndDate: ({ endDate }) => clampToPresentOrPast(endOfMonth(endDate))
1780
- },
1781
- monthRangePicker: {
1782
- getStartDate: ({ startDate }) => startOfMonth(startDate),
1783
- getEndDate: ({ endDate }) => clampToPresentOrPast(endOfMonth(endDate))
1784
- },
1785
- yearPicker: {
1786
- getStartDate: ({ startDate }) => startOfYear(startDate),
1787
- getEndDate: ({ endDate }) => clampToPresentOrPast(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 }) => {
1807
- const s = RANGE_MODE_LOOKUP.dayPicker.getStartDate({ startDate: date });
1808
- const e = RANGE_MODE_LOOKUP.dayPicker.getEndDate({ endDate: date });
1800
+ const s = RANGE_MODE_LOOKUP.date.getStartDate({ startDate: date });
1801
+ const e = RANGE_MODE_LOOKUP.date.getEndDate({ endDate: date });
1809
1802
  return apply({ 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 apply({ 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 apply({ 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 apply({ 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 apply({ 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 = useStore(store, ({ actions: { setDateRange: setDateRange2 } }) => setDateRange2);
1908
1885
  const setMonth = useStore(store, ({ actions: { setMonth: setMonth2 } }) => setMonth2);
1909
- const setMonthRange = useStore(store, ({ actions: { setMonthRange: setMonthRange2 } }) => setMonthRange2);
1910
- const setYear = 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: startOfMonth(/* @__PURE__ */ new Date()),
1935
1908
  endDate: endOfMonth(/* @__PURE__ */ new Date())
@@ -4759,7 +4732,7 @@ const ProfitAndLossReportSchema = Schema.Struct({
4759
4732
  expenses: LineItemSchema,
4760
4733
  taxes: LineItemSchema,
4761
4734
  customLineItems: pipe(
4762
- Schema.propertySignature(Schema.NullOr(LineItemSchema)),
4735
+ Schema.propertySignature(Schema.NullishOr(Schema.Array(LineItemSchema))),
4763
4736
  Schema.fromKey("custom_line_items")
4764
4737
  ),
4765
4738
  otherOutflows: pipe(
@@ -5882,6 +5855,10 @@ const getBankTransactionMatchAsSuggestedMatch = (bankTransaction) => {
5882
5855
  }
5883
5856
  return void 0;
5884
5857
  };
5858
+ const getBankTransactionFirstSuggestedMatch = (bankTransaction) => {
5859
+ var _a, _b;
5860
+ return (_b = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) != null ? _b : (_a = bankTransaction == null ? void 0 : bankTransaction.suggested_matches) == null ? void 0 : _a[0];
5861
+ };
5885
5862
  const IconButton = (_y) => {
5886
5863
  var _z = _y, {
5887
5864
  className,
@@ -7535,11 +7512,59 @@ const SubmitButton = (_ba) => {
7535
7512
  })
7536
7513
  );
7537
7514
  };
7515
+ const variants = {
7516
+ fade: {
7517
+ initial: { opacity: 0 },
7518
+ animate: { opacity: 1 },
7519
+ exit: { opacity: 0 },
7520
+ transition: { duration: 0.3, ease: [0, 0, 0.58, 1] }
7521
+ },
7522
+ slideUp: {
7523
+ initial: { y: "100%" },
7524
+ animate: { y: 0 },
7525
+ exit: { y: "100%" },
7526
+ transition: { duration: 0.35, ease: [0.4, 0, 0.2, 1] }
7527
+ },
7528
+ expand: {
7529
+ initial: { height: 0, opacity: 0 },
7530
+ animate: { height: "auto", opacity: 1 },
7531
+ exit: { height: 0, opacity: 0 },
7532
+ transition: {
7533
+ height: { duration: 0.25, ease: [0.4, 0, 0.2, 1] },
7534
+ opacity: { duration: 0.15, ease: [0, 0, 0.58, 1] }
7535
+ }
7536
+ }
7537
+ };
7538
+ const AnimatedContent = (_da) => {
7539
+ var _ea = _da, {
7540
+ children,
7541
+ variant,
7542
+ isOpen,
7543
+ slotProps = { AnimatePresence: { initial: false } }
7544
+ } = _ea, props = __objRest(_ea, [
7545
+ "children",
7546
+ "variant",
7547
+ "isOpen",
7548
+ "slotProps"
7549
+ ]);
7550
+ const config = variants[variant];
7551
+ return /* @__PURE__ */ jsx(AnimatePresence, __spreadProps(__spreadValues({}, slotProps.AnimatePresence), { children: isOpen && /* @__PURE__ */ jsx(
7552
+ motion.div,
7553
+ __spreadProps(__spreadValues({
7554
+ initial: config.initial,
7555
+ animate: config.animate,
7556
+ exit: config.exit,
7557
+ transition: config.transition
7558
+ }, props), {
7559
+ children
7560
+ })
7561
+ ) }));
7562
+ };
7538
7563
  const BASE_MODAL_OVERLAY_CLASS_NAME = "Layer__ModalOverlay";
7539
7564
  const MODAL_OVERLAY_CLASS_NAME = `Layer__Portal ${BASE_MODAL_OVERLAY_CLASS_NAME}`;
7540
7565
  const ModalOverlay = forwardRef(
7541
- (_da, ref) => {
7542
- var _ea = _da, { variant } = _ea, restProps = __objRest(_ea, ["variant"]);
7566
+ (_fa, ref) => {
7567
+ var _ga = _fa, { variant } = _ga, restProps = __objRest(_ga, ["variant"]);
7543
7568
  const dataProperties = toDataProperties({ variant });
7544
7569
  return /* @__PURE__ */ jsx(
7545
7570
  ModalOverlay$1,
@@ -7566,8 +7591,8 @@ const InternalModal = forwardRef(({ children, flexBlock, flexInline, size, varia
7566
7591
  InternalModal.displayName = "Modal";
7567
7592
  const DIALOG_CLASS_NAME = "Layer__Dialog";
7568
7593
  const Dialog = forwardRef(
7569
- (_fa, ref) => {
7570
- var _ga = _fa, { variant = "center" } = _ga, restProps = __objRest(_ga, ["variant"]);
7594
+ (_ha, ref) => {
7595
+ var _ia = _ha, { variant = "center" } = _ia, restProps = __objRest(_ia, ["variant"]);
7571
7596
  const dataProperties = toDataProperties({ variant });
7572
7597
  return /* @__PURE__ */ jsx(
7573
7598
  Dialog$1,
@@ -7605,11 +7630,25 @@ function Drawer({
7605
7630
  isDismissable = false,
7606
7631
  role
7607
7632
  }) {
7608
- return /* @__PURE__ */ jsx(ModalOverlay, { isOpen, onOpenChange, variant, isDismissable, children: /* @__PURE__ */ jsx(InternalModal, { flexBlock, flexInline, size, variant, children: /* @__PURE__ */ jsx(Dialog, { role: role != null ? role : "dialog", "aria-label": ariaLabel, variant, children }) }) });
7633
+ const isMobileDrawer = variant === "mobile-drawer";
7634
+ const shouldUseFadeOverlay = variant === "drawer" || isMobileDrawer;
7635
+ const modalContent = /* @__PURE__ */ jsx(InternalModal, { flexBlock, flexInline, size, variant, children: /* @__PURE__ */ jsx(Dialog, { role: role != null ? role : "dialog", "aria-label": ariaLabel, variant, children }) });
7636
+ const wrappedModalContent = isMobileDrawer ? /* @__PURE__ */ jsx(
7637
+ AnimatedContent,
7638
+ {
7639
+ variant: "slideUp",
7640
+ isOpen,
7641
+ className: "Layer__ModalContentSlideUpMotionContent",
7642
+ slotProps: { AnimatePresence: { initial: true } },
7643
+ children: modalContent
7644
+ }
7645
+ ) : modalContent;
7646
+ const overlayContent = shouldUseFadeOverlay ? /* @__PURE__ */ jsx(AnimatedContent, { variant: "fade", isOpen, className: "Layer__ModalContentFadeMotionContent", children: wrappedModalContent }) : wrappedModalContent;
7647
+ return /* @__PURE__ */ jsx(ModalOverlay, { isOpen, onOpenChange, variant, isDismissable, children: overlayContent });
7609
7648
  }
7610
7649
  const HEADING_CLASS_NAME = "Layer__UI__Heading";
7611
- const Heading = forwardRef((_ha, ref) => {
7612
- var _ia = _ha, { align, pie, pbe, size, variant, weight, ellipsis, className } = _ia, restProps = __objRest(_ia, ["align", "pie", "pbe", "size", "variant", "weight", "ellipsis", "className"]);
7650
+ const Heading = forwardRef((_ja, ref) => {
7651
+ var _ka = _ja, { align, pie, pbe, size, variant, weight, ellipsis, className } = _ka, restProps = __objRest(_ka, ["align", "pie", "pbe", "size", "variant", "weight", "ellipsis", "className"]);
7613
7652
  const dataProperties = toDataProperties({ pbe, pie, size, align, variant, weight, ellipsis });
7614
7653
  return /* @__PURE__ */ jsx(
7615
7654
  Heading$2,
@@ -7636,21 +7675,25 @@ function ButtonSpinner({ size }) {
7636
7675
  function ButtonTransparentContent({ children }) {
7637
7676
  return /* @__PURE__ */ jsx("span", { className: BUTTON_CLASS_NAMES.TRANSPARENT_CONTENT, children });
7638
7677
  }
7639
- const Button = forwardRef((_ja, ref) => {
7640
- var _ka = _ja, {
7678
+ const Button = forwardRef((_la, ref) => {
7679
+ var _ma = _la, {
7641
7680
  children,
7642
7681
  ellipsis,
7643
7682
  icon,
7644
7683
  inset,
7645
7684
  size = "md",
7646
- variant = "solid"
7647
- } = _ka, restProps = __objRest(_ka, [
7685
+ variant = "solid",
7686
+ fullWidth = false,
7687
+ flex = false
7688
+ } = _ma, restProps = __objRest(_ma, [
7648
7689
  "children",
7649
7690
  "ellipsis",
7650
7691
  "icon",
7651
7692
  "inset",
7652
7693
  "size",
7653
- "variant"
7694
+ "variant",
7695
+ "fullWidth",
7696
+ "flex"
7654
7697
  ]);
7655
7698
  const { isPending = false } = restProps;
7656
7699
  const dataProperties = toDataProperties({
@@ -7658,7 +7701,9 @@ const Button = forwardRef((_ja, ref) => {
7658
7701
  icon,
7659
7702
  inset,
7660
7703
  size,
7661
- variant
7704
+ variant,
7705
+ "full-width": fullWidth,
7706
+ flex
7662
7707
  });
7663
7708
  return /* @__PURE__ */ jsx(
7664
7709
  Button$2,
@@ -8015,8 +8060,8 @@ const CHECK_SIZE = {
8015
8060
  md: 14,
8016
8061
  lg: 16
8017
8062
  };
8018
- function Checkbox(_la) {
8019
- var _ma = _la, { children, className, variant = "default", size = "sm", isIndeterminate } = _ma, props = __objRest(_ma, ["children", "className", "variant", "size", "isIndeterminate"]);
8063
+ function Checkbox(_na) {
8064
+ var _oa = _na, { children, className, variant = "default", size = "sm", isIndeterminate } = _oa, props = __objRest(_oa, ["children", "className", "variant", "size", "isIndeterminate"]);
8020
8065
  const dataProperties = useMemo(() => toDataProperties({
8021
8066
  size,
8022
8067
  variant,
@@ -8034,8 +8079,8 @@ function Checkbox(_la) {
8034
8079
  })
8035
8080
  );
8036
8081
  }
8037
- function CheckboxWithTooltip(_na) {
8038
- var _oa = _na, { tooltip } = _oa, props = __objRest(_oa, ["tooltip"]);
8082
+ function CheckboxWithTooltip(_pa) {
8083
+ var _qa = _pa, { tooltip } = _qa, props = __objRest(_qa, ["tooltip"]);
8039
8084
  return /* @__PURE__ */ jsx("div", { className: "Layer__checkbox-wrapper", children: /* @__PURE__ */ jsxs(DeprecatedTooltip, { disabled: !tooltip, children: [
8040
8085
  /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx(Checkbox, __spreadValues({}, props)) }),
8041
8086
  /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: tooltip })
@@ -8380,8 +8425,8 @@ const isDateAllowedToBrowse = (date, business) => {
8380
8425
  }
8381
8426
  return differenceInCalendarMonths(startOfMonth(date), activationDate) >= 0;
8382
8427
  };
8383
- const ErrorText = (_pa) => {
8384
- var _qa = _pa, { className } = _qa, props = __objRest(_qa, ["className"]);
8428
+ const ErrorText = (_ra) => {
8429
+ var _sa = _ra, { className } = _sa, props = __objRest(_sa, ["className"]);
8385
8430
  return /* @__PURE__ */ jsx(Text, __spreadProps(__spreadValues({}, props), { status: "error", className }));
8386
8431
  };
8387
8432
  const InputGroup$1 = ({
@@ -8420,8 +8465,8 @@ const transformCurrencyValue = (rawValue) => {
8420
8465
  }
8421
8466
  return cleaned;
8422
8467
  };
8423
- const AmountInput = (_ra) => {
8424
- var _sa = _ra, {
8468
+ const AmountInput = (_ta) => {
8469
+ var _ua = _ta, {
8425
8470
  onChange,
8426
8471
  className,
8427
8472
  leftText,
@@ -8429,7 +8474,7 @@ const AmountInput = (_ra) => {
8429
8474
  isInvalid,
8430
8475
  badge,
8431
8476
  placeholder = "$0.00"
8432
- } = _sa, props = __objRest(_sa, [
8477
+ } = _ua, props = __objRest(_ua, [
8433
8478
  "onChange",
8434
8479
  "className",
8435
8480
  "leftText",
@@ -8474,8 +8519,8 @@ const AmountInput = (_ra) => {
8474
8519
  /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
8475
8520
  ] });
8476
8521
  };
8477
- const ChevronLeft = (_ta) => {
8478
- var props = __objRest(_ta, []);
8522
+ const ChevronLeft = (_va) => {
8523
+ var props = __objRest(_va, []);
8479
8524
  return /* @__PURE__ */ jsx(
8480
8525
  "svg",
8481
8526
  __spreadProps(__spreadValues({
@@ -8499,8 +8544,8 @@ const ChevronLeft = (_ta) => {
8499
8544
  };
8500
8545
  const CALENDAR_CLASS_NAME = "Layer__UI__Calendar";
8501
8546
  const Calendar = forwardRef(
8502
- function Calendar2(_ua, ref) {
8503
- var _va = _ua, { className, isReadOnly } = _va, restProps = __objRest(_va, ["className", "isReadOnly"]);
8547
+ function Calendar2(_wa, ref) {
8548
+ var _xa = _wa, { className, isReadOnly } = _xa, restProps = __objRest(_xa, ["className", "isReadOnly"]);
8504
8549
  const dataProperties = toDataProperties({ readonly: isReadOnly });
8505
8550
  return /* @__PURE__ */ jsx(
8506
8551
  Calendar$1,
@@ -8514,8 +8559,8 @@ const Calendar = forwardRef(
8514
8559
  );
8515
8560
  const CALENDAR_GRID_CLASS_NAME = "Layer__UI__CalendarGrid";
8516
8561
  const CalendarGrid = forwardRef(
8517
- function CalendarGrid2(_wa, ref) {
8518
- var _xa = _wa, { className } = _xa, restProps = __objRest(_xa, ["className"]);
8562
+ function CalendarGrid2(_ya, ref) {
8563
+ var _za = _ya, { className } = _za, restProps = __objRest(_za, ["className"]);
8519
8564
  return /* @__PURE__ */ jsx(
8520
8565
  CalendarGrid$1,
8521
8566
  __spreadProps(__spreadValues({}, restProps), {
@@ -8527,8 +8572,8 @@ const CalendarGrid = forwardRef(
8527
8572
  );
8528
8573
  const CALENDAR_GRID_BODY_CLASS_NAME = "Layer__UI__CalendarGridBody";
8529
8574
  const CalendarGridBody = forwardRef(
8530
- function CalendarGridBody2(_ya, ref) {
8531
- var _za = _ya, { className } = _za, restProps = __objRest(_za, ["className"]);
8575
+ function CalendarGridBody2(_Aa, ref) {
8576
+ var _Ba = _Aa, { className } = _Ba, restProps = __objRest(_Ba, ["className"]);
8532
8577
  return /* @__PURE__ */ jsx(
8533
8578
  CalendarGridBody$1,
8534
8579
  __spreadProps(__spreadValues({}, restProps), {
@@ -8540,8 +8585,8 @@ const CalendarGridBody = forwardRef(
8540
8585
  );
8541
8586
  const CALENDAR_CELL_CLASS_NAME = "Layer__UI__CalendarCell";
8542
8587
  const CalendarCell = forwardRef(
8543
- function CalendarCell2(_Aa, ref) {
8544
- var _Ba = _Aa, { className, size = "sm" } = _Ba, restProps = __objRest(_Ba, ["className", "size"]);
8588
+ function CalendarCell2(_Ca, ref) {
8589
+ var _Da = _Ca, { className, size = "sm" } = _Da, restProps = __objRest(_Da, ["className", "size"]);
8545
8590
  const dataProperties = toDataProperties({ size });
8546
8591
  return /* @__PURE__ */ jsx(
8547
8592
  CalendarCell$1,
@@ -8554,8 +8599,8 @@ const CalendarCell = forwardRef(
8554
8599
  );
8555
8600
  const CALENDAR_GRID_HEADER_CLASS_NAME = "Layer__UI__CalendarGridHeader";
8556
8601
  const CalendarGridHeader = forwardRef(
8557
- function CalendarGridHeader2(_Ca, ref) {
8558
- var _Da = _Ca, { className } = _Da, restProps = __objRest(_Da, ["className"]);
8602
+ function CalendarGridHeader2(_Ea, ref) {
8603
+ var _Fa = _Ea, { className } = _Fa, restProps = __objRest(_Fa, ["className"]);
8559
8604
  return /* @__PURE__ */ jsx(
8560
8605
  CalendarGridHeader$1,
8561
8606
  __spreadProps(__spreadValues({}, restProps), {
@@ -8567,8 +8612,8 @@ const CalendarGridHeader = forwardRef(
8567
8612
  );
8568
8613
  const CALENDAR_HEADER_CELL_CLASS_NAME = "Layer__UI__CalendarHeaderCell";
8569
8614
  const CalendarHeaderCell = forwardRef(
8570
- function CalendarHeaderCell2(_Ea, ref) {
8571
- var _Fa = _Ea, { className, size = "sm" } = _Fa, restProps = __objRest(_Fa, ["className", "size"]);
8615
+ function CalendarHeaderCell2(_Ga, ref) {
8616
+ var _Ha = _Ga, { className, size = "sm" } = _Ha, restProps = __objRest(_Ha, ["className", "size"]);
8572
8617
  const dataProperties = toDataProperties({ size });
8573
8618
  return /* @__PURE__ */ jsx(
8574
8619
  CalendarHeaderCell$1,
@@ -8594,8 +8639,8 @@ const DateCalendar = ({ minDate, maxDate, variant }) => {
8594
8639
  };
8595
8640
  const DATE_FIELD_CLASS_NAME = "Layer__UI__DateField";
8596
8641
  const DateField = forwardRef(
8597
- function DateField2(_Ga, ref) {
8598
- var _Ha = _Ga, { inline, className, isReadOnly } = _Ha, restProps = __objRest(_Ha, ["inline", "className", "isReadOnly"]);
8642
+ function DateField2(_Ia, ref) {
8643
+ var _Ja = _Ia, { inline, className, isReadOnly } = _Ja, restProps = __objRest(_Ja, ["inline", "className", "isReadOnly"]);
8599
8644
  const dataProperties = toDataProperties({ inline, readonly: isReadOnly });
8600
8645
  return /* @__PURE__ */ jsx(
8601
8646
  DateField$1,
@@ -8609,8 +8654,8 @@ const DateField = forwardRef(
8609
8654
  );
8610
8655
  const DATE_INPUT_CLASS_NAME = "Layer__UI__DateInput";
8611
8656
  const DateInput = forwardRef(
8612
- function DateInput2(_Ia, ref) {
8613
- var _Ja = _Ia, { inset, pointerEvents } = _Ja, restProps = __objRest(_Ja, ["inset", "pointerEvents"]);
8657
+ function DateInput2(_Ka, ref) {
8658
+ var _La = _Ka, { inset, pointerEvents } = _La, restProps = __objRest(_La, ["inset", "pointerEvents"]);
8614
8659
  const dataProperties = toDataProperties({ inset, "pointer-events": pointerEvents });
8615
8660
  return /* @__PURE__ */ jsx(
8616
8661
  DateInput$1,
@@ -8623,8 +8668,8 @@ const DateInput = forwardRef(
8623
8668
  );
8624
8669
  const DATE_SEGMENT_CLASS_NAME = "Layer__UI__DateSegment";
8625
8670
  const DateSegment = forwardRef(
8626
- function DateSegment2(_Ka, ref) {
8627
- var _La = _Ka, { isReadOnly } = _La, restProps = __objRest(_La, ["isReadOnly"]);
8671
+ function DateSegment2(_Ma, ref) {
8672
+ var _Na = _Ma, { isReadOnly } = _Na, restProps = __objRest(_Na, ["isReadOnly"]);
8628
8673
  const dataProperties = toDataProperties({ interactive: !isReadOnly });
8629
8674
  return /* @__PURE__ */ jsx(
8630
8675
  DateSegment$1,
@@ -8650,8 +8695,8 @@ const DatePicker$1 = forwardRef(
8650
8695
  const POPOVER_CLASS_NAME = "Layer__Popover";
8651
8696
  const POPOVER_CLASS_NAMES = `Layer__Portal ${POPOVER_CLASS_NAME}`;
8652
8697
  const Popover = forwardRef(
8653
- function Popover2(_Ma, ref) {
8654
- var _Na = _Ma, { flexInline = false } = _Na, restProps = __objRest(_Na, ["flexInline"]);
8698
+ function Popover2(_Oa, ref) {
8699
+ var _Pa = _Oa, { flexInline = false } = _Pa, restProps = __objRest(_Pa, ["flexInline"]);
8655
8700
  const dataProperties = toDataProperties({ "flex-inline": flexInline });
8656
8701
  return /* @__PURE__ */ jsx(
8657
8702
  Popover$1,
@@ -8665,7 +8710,6 @@ const Popover = forwardRef(
8665
8710
  const DATE_FORMAT$1 = "LLL d, yyyy";
8666
8711
  const DATE_FORMAT_SHORT = "M/d/yyyy";
8667
8712
  const DATE_FORMAT_WITH_TIME_READABLE = "LLLL do, yyyy 'at' h:mm a";
8668
- const MONTH_DAY_FORMAT = "LLL d";
8669
8713
  const TIME_FORMAT = "p";
8670
8714
  const BREAKPOINTS = {
8671
8715
  TABLET: 760,
@@ -8726,8 +8770,8 @@ function ResponsivePopover({ children, triggerRef }) {
8726
8770
  }
8727
8771
  );
8728
8772
  }
8729
- const ChevronDown = (_Oa) => {
8730
- var _Pa = _Oa, { size = 18 } = _Pa, props = __objRest(_Pa, ["size"]);
8773
+ const ChevronDown = (_Qa) => {
8774
+ var _Ra = _Qa, { size = 18 } = _Ra, props = __objRest(_Ra, ["size"]);
8731
8775
  return /* @__PURE__ */ jsx(
8732
8776
  "svg",
8733
8777
  __spreadProps(__spreadValues({
@@ -8751,8 +8795,8 @@ const ChevronDown = (_Oa) => {
8751
8795
  };
8752
8796
  const INPUT_GROUP_CLASS_NAME = "Layer__InputGroup";
8753
8797
  const InputGroup = forwardRef(
8754
- function InputGroup2(_Qa, ref) {
8755
- var _Ra = _Qa, { actionCount, className, slots, children } = _Ra, restProps = __objRest(_Ra, ["actionCount", "className", "slots", "children"]);
8798
+ function InputGroup2(_Sa, ref) {
8799
+ var _Ta = _Sa, { actionCount, className, slots, children } = _Ta, restProps = __objRest(_Ta, ["actionCount", "className", "slots", "children"]);
8756
8800
  const combinedClassName = classNames(INPUT_GROUP_CLASS_NAME, className);
8757
8801
  const dataProperties = toDataProperties({
8758
8802
  "action-count": actionCount
@@ -8769,15 +8813,15 @@ const InputGroup = forwardRef(
8769
8813
  );
8770
8814
  const FORM_CLASS_NAME = "Layer__UI__Form";
8771
8815
  const Form = forwardRef(
8772
- function Form2(_Sa, ref) {
8773
- var _Ta = _Sa, { children, className } = _Ta, restProps = __objRest(_Ta, ["children", "className"]);
8816
+ function Form2(_Ua, ref) {
8817
+ var _Va = _Ua, { children, className } = _Va, restProps = __objRest(_Va, ["children", "className"]);
8774
8818
  return /* @__PURE__ */ jsx(Form$1, __spreadProps(__spreadValues({}, restProps), { className: classNames(FORM_CLASS_NAME, className), ref, children }));
8775
8819
  }
8776
8820
  );
8777
8821
  const TEXT_FIELD_CLASS_NAME = "Layer__UI__TextField";
8778
8822
  const TextField = forwardRef(
8779
- function TextField2(_Ua, ref) {
8780
- var _Va = _Ua, { children, inline, textarea, className } = _Va, restProps = __objRest(_Va, ["children", "inline", "textarea", "className"]);
8823
+ function TextField2(_Wa, ref) {
8824
+ var _Xa = _Wa, { children, inline, textarea, className } = _Xa, restProps = __objRest(_Xa, ["children", "inline", "textarea", "className"]);
8781
8825
  const dataProperties = toDataProperties({ inline, textarea });
8782
8826
  return /* @__PURE__ */ jsx(TextField$1, __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(TEXT_FIELD_CLASS_NAME, className), ref, children: withRenderProp(children, (node) => node) }));
8783
8827
  }
@@ -9466,8 +9510,8 @@ const useIsVisible = (ref) => {
9466
9510
  }, [ref]);
9467
9511
  return isIntersecting;
9468
9512
  };
9469
- const ChevronDownFill = (_Wa) => {
9470
- var _Xa = _Wa, { size = 18 } = _Xa, props = __objRest(_Xa, ["size"]);
9513
+ const ChevronDownFill = (_Ya) => {
9514
+ var _Za = _Ya, { size = 18 } = _Za, props = __objRest(_Za, ["size"]);
9471
9515
  return /* @__PURE__ */ jsxs(
9472
9516
  "svg",
9473
9517
  __spreadProps(__spreadValues({
@@ -9492,8 +9536,8 @@ const ChevronDownFill = (_Wa) => {
9492
9536
  })
9493
9537
  );
9494
9538
  };
9495
- const File = (_Ya) => {
9496
- var _Za = _Ya, { size = 12 } = _Za, props = __objRest(_Za, ["size"]);
9539
+ const File = (__a) => {
9540
+ var _$a = __a, { size = 12 } = _$a, props = __objRest(_$a, ["size"]);
9497
9541
  return /* @__PURE__ */ jsxs(
9498
9542
  "svg",
9499
9543
  __spreadProps(__spreadValues({
@@ -9553,13 +9597,13 @@ const File = (_Ya) => {
9553
9597
  })
9554
9598
  );
9555
9599
  };
9556
- const Input$1 = (__a) => {
9557
- var _$a = __a, {
9600
+ const Input$1 = (_ab) => {
9601
+ var _bb = _ab, {
9558
9602
  className,
9559
9603
  isInvalid,
9560
9604
  errorMessage,
9561
9605
  leftText
9562
- } = _$a, props = __objRest(_$a, [
9606
+ } = _bb, props = __objRest(_bb, [
9563
9607
  "className",
9564
9608
  "isInvalid",
9565
9609
  "errorMessage",
@@ -9579,19 +9623,19 @@ const Input$1 = (__a) => {
9579
9623
  /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
9580
9624
  ] });
9581
9625
  };
9582
- const TextButton = (_ab) => {
9583
- var _bb = _ab, {
9626
+ const TextButton = (_cb) => {
9627
+ var _db = _cb, {
9584
9628
  className,
9585
9629
  children
9586
- } = _bb, props = __objRest(_bb, [
9630
+ } = _db, props = __objRest(_db, [
9587
9631
  "className",
9588
9632
  "children"
9589
9633
  ]);
9590
9634
  const baseClassName2 = classNames("Layer__text-btn", className);
9591
9635
  return /* @__PURE__ */ jsx("button", __spreadProps(__spreadValues({}, props), { className: baseClassName2, children }));
9592
9636
  };
9593
- const ScissorsFullOpen = (_cb) => {
9594
- var _db = _cb, { size = 12 } = _db, props = __objRest(_db, ["size"]);
9637
+ const ScissorsFullOpen = (_eb) => {
9638
+ var _fb = _eb, { size = 12 } = _fb, props = __objRest(_fb, ["size"]);
9595
9639
  return /* @__PURE__ */ jsx(
9596
9640
  "svg",
9597
9641
  __spreadProps(__spreadValues({
@@ -9656,8 +9700,8 @@ const ScissorsFullOpen = (_cb) => {
9656
9700
  })
9657
9701
  );
9658
9702
  };
9659
- const Trash = (_eb) => {
9660
- var _fb = _eb, { size = 18 } = _fb, props = __objRest(_fb, ["size"]);
9703
+ const Trash = (_gb) => {
9704
+ var _hb = _gb, { size = 18 } = _hb, props = __objRest(_hb, ["size"]);
9661
9705
  return /* @__PURE__ */ jsxs(
9662
9706
  "svg",
9663
9707
  __spreadProps(__spreadValues({
@@ -9708,8 +9752,8 @@ const Trash = (_eb) => {
9708
9752
  })
9709
9753
  );
9710
9754
  };
9711
- const UploadCloud = (_gb) => {
9712
- var _hb = _gb, { size = 18 } = _hb, props = __objRest(_hb, ["size"]);
9755
+ const UploadCloud = (_ib) => {
9756
+ var _jb = _ib, { size = 18 } = _jb, props = __objRest(_jb, ["size"]);
9713
9757
  return /* @__PURE__ */ jsxs(
9714
9758
  "svg",
9715
9759
  __spreadProps(__spreadValues({
@@ -9964,8 +10008,8 @@ const ReceiptsProvider = ({
9964
10008
  const contextData = useReceipts({ bankTransaction, isActive });
9965
10009
  return /* @__PURE__ */ jsx(ReceiptsContext.Provider, { value: contextData, children });
9966
10010
  };
9967
- const DownloadCloud = (_ib) => {
9968
- var _jb = _ib, { size = 18 } = _jb, props = __objRest(_jb, ["size"]);
10011
+ const DownloadCloud = (_kb) => {
10012
+ var _lb = _kb, { size = 18 } = _lb, props = __objRest(_lb, ["size"]);
9969
10013
  return /* @__PURE__ */ jsxs(
9970
10014
  "svg",
9971
10015
  __spreadProps(__spreadValues({
@@ -10007,8 +10051,8 @@ const DownloadCloud = (_ib) => {
10007
10051
  })
10008
10052
  );
10009
10053
  };
10010
- const Eye = (_kb) => {
10011
- var _lb = _kb, { size = 18 } = _lb, props = __objRest(_lb, ["size"]);
10054
+ const Eye = (_mb) => {
10055
+ var _nb = _mb, { size = 18 } = _nb, props = __objRest(_nb, ["size"]);
10012
10056
  return /* @__PURE__ */ jsx(
10013
10057
  "svg",
10014
10058
  __spreadProps(__spreadValues({
@@ -10161,8 +10205,8 @@ const openReceiptInNewTab = (url, index) => (e) => {
10161
10205
  `);
10162
10206
  }
10163
10207
  };
10164
- const BankTransactionReceiptsWithProvider = forwardRef((_mb, ref) => {
10165
- var _nb = _mb, { bankTransaction, isActive } = _nb, props = __objRest(_nb, ["bankTransaction", "isActive"]);
10208
+ const BankTransactionReceiptsWithProvider = forwardRef((_ob, ref) => {
10209
+ var _pb = _ob, { bankTransaction, isActive } = _pb, props = __objRest(_pb, ["bankTransaction", "isActive"]);
10166
10210
  return /* @__PURE__ */ jsx(ReceiptsProvider, { bankTransaction, isActive, children: /* @__PURE__ */ jsx(BankTransactionReceipts, __spreadProps(__spreadValues({}, props), { ref })) });
10167
10211
  });
10168
10212
  BankTransactionReceiptsWithProvider.displayName = "BankTransactionReceiptsWithProvider";
@@ -10214,8 +10258,8 @@ const BankTransactionReceipts = forwardRef(
10214
10258
  );
10215
10259
  BankTransactionReceipts.displayName = "BankTransactionReceipts";
10216
10260
  const PORTAL_CLASS_NAME = "Layer__Portal";
10217
- const Check = (_ob) => {
10218
- var _pb = _ob, { size = 18 } = _pb, props = __objRest(_pb, ["size"]);
10261
+ const Check = (_qb) => {
10262
+ var _rb = _qb, { size = 18 } = _rb, props = __objRest(_rb, ["size"]);
10219
10263
  return /* @__PURE__ */ jsx(
10220
10264
  "svg",
10221
10265
  __spreadProps(__spreadValues({
@@ -10411,8 +10455,8 @@ function buildCustomMenuPortal() {
10411
10455
  );
10412
10456
  };
10413
10457
  }
10414
- function ComboBox(_qb) {
10415
- var _rb = _qb, {
10458
+ function ComboBox(_sb) {
10459
+ var _tb = _sb, {
10416
10460
  className,
10417
10461
  selectedValue,
10418
10462
  onSelectedValueChange,
@@ -10430,7 +10474,7 @@ function ComboBox(_qb) {
10430
10474
  isClearable = true,
10431
10475
  isReadOnly = false,
10432
10476
  displayDisabledAsSelected
10433
- } = _rb, ariaProps = __objRest(_rb, [
10477
+ } = _tb, ariaProps = __objRest(_tb, [
10434
10478
  "className",
10435
10479
  "selectedValue",
10436
10480
  "onSelectedValueChange",
@@ -11627,8 +11671,8 @@ function isCategorizationEnabledForStatus(status) {
11627
11671
  }
11628
11672
  }
11629
11673
  }
11630
- const MinimizeTwo = (_sb) => {
11631
- var _tb = _sb, { size = 18 } = _tb, props = __objRest(_tb, ["size"]);
11674
+ const MinimizeTwo = (_ub) => {
11675
+ var _vb = _ub, { size = 18 } = _vb, props = __objRest(_vb, ["size"]);
11632
11676
  return /* @__PURE__ */ jsxs(
11633
11677
  "svg",
11634
11678
  __spreadProps(__spreadValues({
@@ -11706,7 +11750,7 @@ const MatchBadge = ({
11706
11750
  }
11707
11751
  return;
11708
11752
  };
11709
- const MatchForm$1 = ({
11753
+ const MatchForm = ({
11710
11754
  classNamePrefix,
11711
11755
  bankTransaction,
11712
11756
  selectedMatchId,
@@ -12059,12 +12103,12 @@ const Notification = ({
12059
12103
  }
12060
12104
  );
12061
12105
  };
12062
- const Textarea = (_ub) => {
12063
- var _vb = _ub, {
12106
+ const Textarea = (_wb) => {
12107
+ var _xb = _wb, {
12064
12108
  className,
12065
12109
  isInvalid,
12066
12110
  errorMessage
12067
- } = _vb, props = __objRest(_vb, [
12111
+ } = _xb, props = __objRest(_xb, [
12068
12112
  "className",
12069
12113
  "isInvalid",
12070
12114
  "errorMessage"
@@ -12206,9 +12250,7 @@ const BankTransactionMemo = ({ bankTransactionId }) => {
12206
12250
  return /* @__PURE__ */ jsx(
12207
12251
  InputGroup$1,
12208
12252
  {
12209
- className: "Layer__bank-transaction-memo-input-group",
12210
12253
  name: "memo",
12211
- label: "Description",
12212
12254
  children: /* @__PURE__ */ jsx(
12213
12255
  Textarea,
12214
12256
  {
@@ -12390,9 +12432,9 @@ function BankTransactionFormFields({
12390
12432
  if (!showTags && !showCustomerVendor && !showDescriptions) {
12391
12433
  return null;
12392
12434
  }
12393
- return /* @__PURE__ */ jsxs(VStack, { pi: "md", pbe: "lg", gap: "md", className: "Layer__bank-transaction-form-fields", children: [
12394
- showCustomerVendor && !hideCustomerVendor ? /* @__PURE__ */ jsx(BankTransactionCustomerVendorSelector, { bankTransaction }) : null,
12395
- showTags && !hideTags ? /* @__PURE__ */ jsx(
12435
+ return /* @__PURE__ */ jsxs(VStack, { gap: "md", children: [
12436
+ showCustomerVendor && !hideCustomerVendor && /* @__PURE__ */ jsx(BankTransactionCustomerVendorSelector, { bankTransaction }),
12437
+ showTags && !hideTags && /* @__PURE__ */ jsx(
12396
12438
  TagDimensionsGroup,
12397
12439
  {
12398
12440
  value: selectedTags,
@@ -12400,8 +12442,11 @@ function BankTransactionFormFields({
12400
12442
  showLabels: true,
12401
12443
  isReadOnly
12402
12444
  }
12403
- ) : null,
12404
- showDescriptions ? /* @__PURE__ */ jsx(BankTransactionMemo, { bankTransactionId: bankTransaction.id }) : null
12445
+ ),
12446
+ showDescriptions && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
12447
+ /* @__PURE__ */ jsx(Span, { size: "sm", weight: "bold", children: "Description" }),
12448
+ /* @__PURE__ */ jsx(BankTransactionMemo, { bankTransactionId: bankTransaction.id })
12449
+ ] })
12405
12450
  ] });
12406
12451
  }
12407
12452
  var CategorizationType = /* @__PURE__ */ ((CategorizationType2) => {
@@ -12597,23 +12642,21 @@ const DateTime = ({
12597
12642
  };
12598
12643
  const CLASS_NAME$8 = "Layer__MoneyText";
12599
12644
  const MoneySpan = forwardRef(
12600
- (_wb, ref) => {
12601
- var _xb = _wb, { amount, bold, size, displayPlusSign, className } = _xb, restProps = __objRest(_xb, ["amount", "bold", "size", "displayPlusSign", "className"]);
12645
+ (_yb, ref) => {
12646
+ var _zb = _yb, { amount, bold, size, displayPlusSign, className } = _zb, restProps = __objRest(_zb, ["amount", "bold", "size", "displayPlusSign", "className"]);
12602
12647
  const dataProperties = toDataProperties({
12603
12648
  bold,
12604
- positive: amount >= 0,
12605
- negative: amount < 0,
12606
- size
12649
+ "positive": amount >= 0,
12650
+ "negative": amount < 0,
12651
+ size,
12652
+ "display-plus-sign": displayPlusSign
12607
12653
  });
12608
- return /* @__PURE__ */ jsxs("span", __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(CLASS_NAME$8, className), ref, children: [
12609
- displayPlusSign && "+",
12610
- centsToDollars(Math.abs(amount))
12611
- ] }));
12654
+ return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(CLASS_NAME$8, className), ref, children: centsToDollars(Math.abs(amount)) }));
12612
12655
  }
12613
12656
  );
12614
12657
  MoneySpan.displayName = "MoneySpan";
12615
- const Scissors = (_yb) => {
12616
- var _zb = _yb, { size = 11 } = _zb, props = __objRest(_zb, ["size"]);
12658
+ const Scissors = (_Ab) => {
12659
+ var _Bb = _Ab, { size = 11 } = _Bb, props = __objRest(_Bb, ["size"]);
12617
12660
  return /* @__PURE__ */ jsxs(
12618
12661
  "svg",
12619
12662
  __spreadProps(__spreadValues({
@@ -12744,21 +12787,27 @@ const Scissors = (_yb) => {
12744
12787
  );
12745
12788
  };
12746
12789
  const BankTransactionsBaseSelectedValue = (props) => {
12747
- var _a, _b, _c, _d, _e, _f;
12790
+ var _a, _b, _c, _d, _e, _f, _g, _h;
12748
12791
  const { type, className, label, slotProps } = props;
12792
+ if (type === "placeholder") {
12793
+ return /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", className, children: /* @__PURE__ */ jsx(Span, { ellipsis: true, size: (_b = (_a = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _a.size) != null ? _b : "md", children: label }) });
12794
+ }
12749
12795
  if (type === "match" || type === "transfer") {
12750
12796
  return /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", className, children: [
12751
12797
  /* @__PURE__ */ jsx(Badge, { size: BadgeSize.SMALL, icon: /* @__PURE__ */ jsx(MinimizeTwo, { size: 11 }), children: type === "transfer" ? "Transfer" : "Match" }),
12752
- /* @__PURE__ */ jsx(Span, { ellipsis: true, size: (_b = (_a = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _a.size) != null ? _b : "md", children: label })
12798
+ /* @__PURE__ */ jsx(Span, { ellipsis: true, size: (_d = (_c = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _c.size) != null ? _d : "md", children: label })
12753
12799
  ] });
12754
12800
  }
12755
12801
  if (type === "split") {
12756
12802
  return /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", className, children: [
12757
12803
  /* @__PURE__ */ jsx(Badge, { size: BadgeSize.SMALL, icon: /* @__PURE__ */ jsx(Scissors, { size: 11 }), children: "Split" }),
12758
- /* @__PURE__ */ jsx(Span, { ellipsis: true, size: (_d = (_c = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _c.size) != null ? _d : "md", children: label })
12804
+ /* @__PURE__ */ jsx(Span, { ellipsis: true, size: (_f = (_e = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _e.size) != null ? _f : "md", children: label })
12759
12805
  ] });
12760
12806
  }
12761
- return /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", className, children: /* @__PURE__ */ jsx(Span, { ellipsis: true, size: (_f = (_e = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _e.size) != null ? _f : "md", children: label }) });
12807
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", className, children: [
12808
+ /* @__PURE__ */ jsx(Badge, { size: BadgeSize.SMALL, icon: /* @__PURE__ */ jsx(Layers2Icon, { size: 11 }), children: "Category" }),
12809
+ /* @__PURE__ */ jsx(Span, { ellipsis: true, size: (_h = (_g = slotProps == null ? void 0 : slotProps.Label) == null ? void 0 : _g.size) != null ? _h : "md", children: label })
12810
+ ] });
12762
12811
  };
12763
12812
  const BankTransactionsUncategorizedSelectedValue = (props) => {
12764
12813
  const { selectedValue, className, slotProps } = props;
@@ -13212,9 +13261,9 @@ const ExpandedBankTransactionRow = forwardRef(
13212
13261
  submitBtnText = "Save",
13213
13262
  containerWidth,
13214
13263
  showDescriptions,
13215
- showReceiptUploads
13264
+ showReceiptUploads,
13265
+ showLeftPadding = true
13216
13266
  }, ref) => {
13217
- var _a, _b;
13218
13267
  const {
13219
13268
  categorize: categorizeBankTransaction2,
13220
13269
  match: matchBankTransaction2
@@ -13232,7 +13281,7 @@ const ExpandedBankTransactionRow = forwardRef(
13232
13281
  /* categorize */
13233
13282
  );
13234
13283
  const [selectedMatch, setSelectedMatch] = useState(
13235
- (_b = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) != null ? _b : (_a = bankTransaction == null ? void 0 : bankTransaction.suggested_matches) == null ? void 0 : _a[0]
13284
+ getBankTransactionFirstSuggestedMatch(bankTransaction)
13236
13285
  );
13237
13286
  const [matchFormError, setMatchFormError] = useState();
13238
13287
  const bodyRef = useRef(null);
@@ -13294,14 +13343,14 @@ const ExpandedBankTransactionRow = forwardRef(
13294
13343
  });
13295
13344
  }
13296
13345
  };
13297
- const save = () => __async(null, null, function* () {
13298
- var _a2;
13346
+ const save = () => {
13347
+ var _a;
13299
13348
  if (purpose === "match") {
13300
13349
  if (!selectedMatch) {
13301
13350
  setMatchFormError("Select an option to match the transaction");
13302
13351
  return;
13303
- } else if (selectedMatch && selectedMatch.id !== ((_a2 = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a2.id)) {
13304
- yield onMatchSubmit(selectedMatch.id);
13352
+ } else if (selectedMatch && selectedMatch.id !== ((_a = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a.id)) {
13353
+ void onMatchSubmit(selectedMatch.id);
13305
13354
  return;
13306
13355
  }
13307
13356
  close2();
@@ -13309,19 +13358,19 @@ const ExpandedBankTransactionRow = forwardRef(
13309
13358
  }
13310
13359
  if (!isValid2) return;
13311
13360
  const categorizationRequest = buildCategorizeBankTransactionPayloadForSplit(localSplits);
13312
- yield categorizeBankTransaction2(
13361
+ void categorizeBankTransaction2(
13313
13362
  bankTransaction.id,
13314
13363
  categorizationRequest
13315
13364
  );
13316
13365
  deselect(bankTransaction.id);
13317
13366
  close2();
13318
- });
13367
+ };
13319
13368
  useImperativeHandle(ref, () => ({
13320
13369
  save
13321
13370
  }));
13322
13371
  const onMatchSubmit = (matchId) => __async(null, null, function* () {
13323
- var _a2;
13324
- const foundMatch = (_a2 = bankTransaction.suggested_matches) == null ? void 0 : _a2.find(
13372
+ var _a;
13373
+ const foundMatch = (_a = bankTransaction.suggested_matches) == null ? void 0 : _a.find(
13325
13374
  (x) => x.id === matchId
13326
13375
  );
13327
13376
  if (!foundMatch) {
@@ -13339,228 +13388,227 @@ const ExpandedBankTransactionRow = forwardRef(
13339
13388
  "span",
13340
13389
  {
13341
13390
  className: `${className} ${className}--${isOpen ? "expanded" : "collapsed"}`,
13342
- children: !isOpen ? null : /* @__PURE__ */ jsxs("span", { className: `${className}__wrapper`, ref: bodyRef, children: [
13343
- categorizationEnabled ? /* @__PURE__ */ jsx("div", { className: `${className}__content-toggle`, children: /* @__PURE__ */ jsx(
13344
- Toggle,
13345
- {
13346
- name: `purpose-${bankTransaction.id}${asListItem ? "-li" : ""}`,
13347
- size: ToggleSize.small,
13348
- options: [
13349
- {
13350
- value: "categorize",
13351
- label: "Categorize"
13352
- },
13353
- {
13354
- value: "match",
13355
- label: "Match",
13356
- disabled: !hasMatch(bankTransaction),
13357
- disabledMessage: "We could not find matching transactions"
13358
- }
13359
- ],
13360
- selected: purpose,
13361
- onChange: onChangePurpose
13362
- }
13363
- ) }) : /* @__PURE__ */ jsx(Fragment, {}),
13364
- /* @__PURE__ */ jsxs(
13365
- "div",
13366
- {
13367
- className: `${className}__content`,
13368
- id: `expanded-${bankTransaction.id}`,
13369
- children: [
13370
- /* @__PURE__ */ jsxs("div", { className: `${className}__content-panels`, children: [
13371
- /* @__PURE__ */ jsx(
13372
- "div",
13373
- {
13374
- className: classNames(
13375
- `${className}__match`,
13376
- `${className}__content-panel`,
13377
- purpose === "match" ? `${className}__content-panel--active` : ""
13378
- ),
13379
- children: /* @__PURE__ */ jsx("div", { className: `${className}__content-panel-container`, children: /* @__PURE__ */ jsx(
13380
- MatchForm$1,
13381
- {
13382
- classNamePrefix: className,
13383
- bankTransaction,
13384
- selectedMatchId: selectedMatch == null ? void 0 : selectedMatch.id,
13385
- readOnly: !categorizationEnabled,
13386
- setSelectedMatch: (suggestedMatch) => {
13387
- setMatchFormError(void 0);
13388
- setSelectedMatch(suggestedMatch);
13389
- },
13390
- matchFormError
13391
- }
13392
- ) })
13393
- }
13394
- ),
13395
- /* @__PURE__ */ jsx(
13396
- "div",
13397
- {
13398
- className: classNames(
13399
- `${className}__splits`,
13400
- `${className}__content-panel`,
13401
- purpose === "categorize" ? `${className}__content-panel--active` : ""
13402
- ),
13403
- children: /* @__PURE__ */ jsxs("div", { className: `${className}__content-panel-container`, children: [
13404
- /* @__PURE__ */ jsx("div", { className: `${className}__splits-inputs`, children: effectiveSplits.map((split, index) => /* @__PURE__ */ jsxs(
13405
- "div",
13391
+ children: isOpen && /* @__PURE__ */ jsxs(Fragment, { children: [
13392
+ /* @__PURE__ */ jsx(Separator, {}),
13393
+ /* @__PURE__ */ jsx("span", { className: `${className}__wrapper`, ref: bodyRef, children: /* @__PURE__ */ jsxs(VStack, { pis: showLeftPadding ? "md" : void 0, pbs: "sm", children: [
13394
+ categorizationEnabled && /* @__PURE__ */ jsx(HStack, { pi: "md", pbe: "md", pbs: "3xs", children: /* @__PURE__ */ jsx(
13395
+ Toggle,
13396
+ {
13397
+ name: `purpose-${bankTransaction.id}${asListItem ? "-li" : ""}`,
13398
+ size: ToggleSize.small,
13399
+ options: [
13400
+ {
13401
+ value: "categorize",
13402
+ label: "Categorize"
13403
+ },
13404
+ {
13405
+ value: "match",
13406
+ label: "Match",
13407
+ disabled: !hasMatch(bankTransaction),
13408
+ disabledMessage: "We could not find matching transactions"
13409
+ }
13410
+ ],
13411
+ selected: purpose,
13412
+ onChange: onChangePurpose
13413
+ }
13414
+ ) }),
13415
+ /* @__PURE__ */ jsxs(
13416
+ "div",
13417
+ {
13418
+ className: `${className}__content`,
13419
+ id: `expanded-${bankTransaction.id}`,
13420
+ children: [
13421
+ /* @__PURE__ */ jsxs("div", { className: `${className}__content-panels`, children: [
13422
+ /* @__PURE__ */ jsx(
13423
+ "div",
13424
+ {
13425
+ className: classNames(
13426
+ `${className}__match`,
13427
+ `${className}__content-panel`,
13428
+ purpose === "match" ? `${className}__content-panel--active` : ""
13429
+ ),
13430
+ children: /* @__PURE__ */ jsx("div", { className: `${className}__content-panel-container`, children: /* @__PURE__ */ jsx(
13431
+ MatchForm,
13406
13432
  {
13407
- className: `${className}__table-cell--split-entry`,
13408
- children: [
13409
- /* @__PURE__ */ jsx(
13410
- AmountInput,
13411
- {
13412
- name: `split-${index}${asListItem ? "-li" : ""}`,
13413
- disabled: index === 0 || !categorizationEnabled,
13414
- onChange: updateSplitAmount(index),
13415
- value: getInputValueForSplitAtIndex(index, split),
13416
- onBlur: onBlurSplitAmount,
13417
- className: `${className}__table-cell--split-entry__amount`,
13418
- isInvalid: split.amount < 0
13419
- }
13420
- ),
13421
- /* @__PURE__ */ jsx(
13422
- BankTransactionCategoryComboBox,
13423
- {
13424
- bankTransaction,
13425
- selectedValue: split.category,
13426
- onSelectedValueChange: (value) => {
13427
- changeCategoryForSplitAtIndex(index, value);
13428
- },
13429
- isLoading: bankTransaction.processing,
13430
- isDisabled: !categorizationEnabled,
13431
- includeSuggestedMatches: false
13432
- }
13433
- ),
13434
- showTags && /* @__PURE__ */ jsx(
13435
- TagDimensionsGroup,
13436
- {
13437
- value: split.tags,
13438
- onChange: (tags) => changeTags(index, tags),
13439
- showLabels: false,
13440
- isReadOnly: !categorizationEnabled,
13441
- className: `${className}__table-cell--split-entry__tags`
13442
- }
13443
- ),
13444
- showCustomerVendor && /* @__PURE__ */ jsx("div", { className: "Layer__expanded-bank-transaction-row__table-cell--split-entry__customer", children: /* @__PURE__ */ jsx(
13445
- CustomerVendorSelector,
13446
- {
13447
- selectedCustomerVendor: split.customerVendor,
13448
- onSelectedCustomerVendorChange: (customerVendor) => changeCustomerVendor(index, customerVendor),
13449
- placeholder: "Set customer or vendor",
13450
- isReadOnly: !categorizationEnabled,
13451
- showLabel: false
13452
- }
13453
- ) }),
13454
- /* @__PURE__ */ jsx("div", { className: "Layer__expanded-bank-transaction-row__table-cell--split-entry__button", children: /* @__PURE__ */ jsx(
13455
- Button,
13456
- {
13457
- onPress: () => removeSplit(index),
13458
- variant: "outlined",
13459
- icon: true,
13460
- isDisabled: index == 0,
13461
- children: /* @__PURE__ */ jsx(Trash, { size: 18 })
13462
- }
13463
- ) })
13464
- ]
13465
- },
13466
- `split-${index}`
13467
- )) }),
13468
- splitFormError && /* @__PURE__ */ jsx(HStack, { pb: "sm", children: /* @__PURE__ */ jsx(ErrorText, { children: splitFormError }) }),
13469
- /* @__PURE__ */ jsxs("div", { className: `${className}__total-and-btns`, children: [
13470
- effectiveSplits.length > 1 && /* @__PURE__ */ jsx(
13471
- Input$1,
13472
- {
13473
- disabled: true,
13474
- leftText: "Total",
13475
- inputMode: "numeric",
13476
- value: `$${centsToDollars(
13477
- effectiveSplits.reduce(
13478
- (x, { amount }) => x + amount,
13479
- 0
13480
- )
13481
- )}`
13482
- }
13483
- ),
13484
- categorizationEnabled ? /* @__PURE__ */ jsx("div", { className: `${className}__splits-buttons`, children: effectiveSplits.length > 1 ? /* @__PURE__ */ jsx(
13485
- TextButton,
13486
- {
13487
- onClick: addSplit,
13488
- children: "Add new split"
13489
- }
13490
- ) : /* @__PURE__ */ jsxs(
13491
- Button,
13433
+ classNamePrefix: className,
13434
+ bankTransaction,
13435
+ selectedMatchId: selectedMatch == null ? void 0 : selectedMatch.id,
13436
+ readOnly: !categorizationEnabled,
13437
+ setSelectedMatch: (suggestedMatch) => {
13438
+ setMatchFormError(void 0);
13439
+ setSelectedMatch(suggestedMatch);
13440
+ },
13441
+ matchFormError
13442
+ }
13443
+ ) })
13444
+ }
13445
+ ),
13446
+ /* @__PURE__ */ jsx(
13447
+ "div",
13448
+ {
13449
+ className: classNames(
13450
+ `${className}__splits`,
13451
+ `${className}__content-panel`,
13452
+ purpose === "categorize" ? `${className}__content-panel--active` : ""
13453
+ ),
13454
+ children: /* @__PURE__ */ jsxs("div", { className: `${className}__content-panel-container`, children: [
13455
+ /* @__PURE__ */ jsx("div", { className: `${className}__splits-inputs`, children: effectiveSplits.map((split, index) => /* @__PURE__ */ jsxs(
13456
+ "div",
13492
13457
  {
13493
- onClick: addSplit,
13494
- variant: "outlined",
13458
+ className: `${className}__table-cell--split-entry`,
13495
13459
  children: [
13496
- /* @__PURE__ */ jsx(ScissorsFullOpen, { size: 14 }),
13497
- "Split"
13460
+ /* @__PURE__ */ jsx(
13461
+ AmountInput,
13462
+ {
13463
+ name: `split-${index}${asListItem ? "-li" : ""}`,
13464
+ disabled: index === 0 || !categorizationEnabled,
13465
+ onChange: updateSplitAmount(index),
13466
+ value: getInputValueForSplitAtIndex(index, split),
13467
+ onBlur: onBlurSplitAmount,
13468
+ className: `${className}__table-cell--split-entry__amount`,
13469
+ isInvalid: split.amount < 0
13470
+ }
13471
+ ),
13472
+ /* @__PURE__ */ jsx(
13473
+ BankTransactionCategoryComboBox,
13474
+ {
13475
+ bankTransaction,
13476
+ selectedValue: split.category,
13477
+ onSelectedValueChange: (value) => {
13478
+ changeCategoryForSplitAtIndex(index, value);
13479
+ },
13480
+ isLoading: bankTransaction.processing,
13481
+ isDisabled: !categorizationEnabled,
13482
+ includeSuggestedMatches: false
13483
+ }
13484
+ ),
13485
+ showTags && /* @__PURE__ */ jsx(
13486
+ TagDimensionsGroup,
13487
+ {
13488
+ value: split.tags,
13489
+ onChange: (tags) => changeTags(index, tags),
13490
+ showLabels: false,
13491
+ isReadOnly: !categorizationEnabled,
13492
+ className: `${className}__table-cell--split-entry__tags`
13493
+ }
13494
+ ),
13495
+ showCustomerVendor && /* @__PURE__ */ jsx("div", { className: "Layer__expanded-bank-transaction-row__table-cell--split-entry__customer", children: /* @__PURE__ */ jsx(
13496
+ CustomerVendorSelector,
13497
+ {
13498
+ selectedCustomerVendor: split.customerVendor,
13499
+ onSelectedCustomerVendorChange: (customerVendor) => changeCustomerVendor(index, customerVendor),
13500
+ placeholder: "Set customer or vendor",
13501
+ isReadOnly: !categorizationEnabled,
13502
+ showLabel: false
13503
+ }
13504
+ ) }),
13505
+ /* @__PURE__ */ jsx("div", { className: "Layer__expanded-bank-transaction-row__table-cell--split-entry__button", children: /* @__PURE__ */ jsx(
13506
+ Button,
13507
+ {
13508
+ onPress: () => removeSplit(index),
13509
+ variant: "outlined",
13510
+ icon: true,
13511
+ isDisabled: index == 0,
13512
+ children: /* @__PURE__ */ jsx(Trash, { size: 18 })
13513
+ }
13514
+ ) })
13498
13515
  ]
13499
- }
13500
- ) }) : /* @__PURE__ */ jsx(Fragment, {})
13516
+ },
13517
+ `split-${index}`
13518
+ )) }),
13519
+ splitFormError && /* @__PURE__ */ jsx(HStack, { pb: "sm", children: /* @__PURE__ */ jsx(ErrorText, { children: splitFormError }) }),
13520
+ /* @__PURE__ */ jsxs("div", { className: `${className}__total-and-btns`, children: [
13521
+ effectiveSplits.length > 1 && /* @__PURE__ */ jsx(
13522
+ Input$1,
13523
+ {
13524
+ disabled: true,
13525
+ leftText: "Total",
13526
+ inputMode: "numeric",
13527
+ value: `$${centsToDollars(
13528
+ effectiveSplits.reduce(
13529
+ (x, { amount }) => x + amount,
13530
+ 0
13531
+ )
13532
+ )}`
13533
+ }
13534
+ ),
13535
+ categorizationEnabled ? /* @__PURE__ */ jsx("div", { className: `${className}__splits-buttons`, children: effectiveSplits.length > 1 ? /* @__PURE__ */ jsx(
13536
+ TextButton,
13537
+ {
13538
+ onClick: addSplit,
13539
+ children: "Add new split"
13540
+ }
13541
+ ) : /* @__PURE__ */ jsxs(
13542
+ Button,
13543
+ {
13544
+ onClick: addSplit,
13545
+ variant: "outlined",
13546
+ children: [
13547
+ /* @__PURE__ */ jsx(ScissorsFullOpen, { size: 14 }),
13548
+ "Split"
13549
+ ]
13550
+ }
13551
+ ) }) : /* @__PURE__ */ jsx(Fragment, {})
13552
+ ] })
13501
13553
  ] })
13502
- ] })
13503
- }
13504
- )
13505
- ] }),
13506
- /* @__PURE__ */ jsx(
13507
- BankTransactionFormFields,
13508
- {
13509
- bankTransaction,
13510
- showDescriptions,
13511
- hideTags: purpose === "categorize",
13512
- hideCustomerVendor: purpose === "categorize"
13513
- /* categorize */
13514
- }
13515
- ),
13516
- showReceiptUploads && /* @__PURE__ */ jsx(
13517
- BankTransactionReceiptsWithProvider,
13518
- {
13519
- bankTransaction,
13520
- isActive: isOpen,
13521
- classNamePrefix: className,
13522
- floatingActions: !asListItem
13523
- }
13524
- ),
13525
- asListItem && categorizationEnabled ? /* @__PURE__ */ jsxs("div", { className: `${className}__submit-btn`, children: [
13526
- bankTransaction.error ? /* @__PURE__ */ jsxs(
13527
- Text,
13554
+ }
13555
+ )
13556
+ ] }),
13557
+ /* @__PURE__ */ jsx(VStack, { pis: "md", className: "Layer__ExpandedBankTransactionRow__Description", children: /* @__PURE__ */ jsx(
13558
+ BankTransactionFormFields,
13528
13559
  {
13529
- as: "span",
13530
- size: TextSize.md,
13531
- className: "Layer__unsaved-info",
13532
- children: [
13533
- /* @__PURE__ */ jsx("span", { children: "Unsaved" }),
13534
- /* @__PURE__ */ jsx(AlertCircle, { size: 12 })
13535
- ]
13560
+ bankTransaction,
13561
+ showDescriptions,
13562
+ hideTags: purpose === "categorize",
13563
+ hideCustomerVendor: purpose === "categorize"
13564
+ /* categorize */
13536
13565
  }
13537
- ) : null,
13538
- /* @__PURE__ */ jsx(
13539
- SubmitButton,
13566
+ ) }),
13567
+ showReceiptUploads && /* @__PURE__ */ jsx(
13568
+ BankTransactionReceiptsWithProvider,
13540
13569
  {
13541
- onClick: () => {
13542
- if (!bankTransaction.processing) {
13543
- void save();
13544
- }
13545
- },
13546
- className: "Layer__bank-transaction__submit-btn",
13547
- processing: bankTransaction.processing,
13548
- active: true,
13549
- action: categorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
13550
- children: submitBtnText
13570
+ bankTransaction,
13571
+ isActive: isOpen,
13572
+ classNamePrefix: className,
13573
+ floatingActions: !asListItem
13551
13574
  }
13552
- )
13553
- ] }) : null
13554
- ]
13555
- }
13556
- ),
13557
- /* @__PURE__ */ jsx(
13558
- APIErrorNotifications,
13559
- {
13560
- bankTransaction,
13561
- containerWidth
13562
- }
13563
- )
13575
+ ),
13576
+ asListItem && categorizationEnabled && /* @__PURE__ */ jsxs("div", { className: `${className}__submit-btn`, children: [
13577
+ bankTransaction.error && /* @__PURE__ */ jsxs(
13578
+ Text,
13579
+ {
13580
+ as: "span",
13581
+ size: TextSize.md,
13582
+ className: "Layer__unsaved-info",
13583
+ children: [
13584
+ /* @__PURE__ */ jsx("span", { children: "Unsaved" }),
13585
+ /* @__PURE__ */ jsx(AlertCircle, { size: 12 })
13586
+ ]
13587
+ }
13588
+ ),
13589
+ /* @__PURE__ */ jsx(
13590
+ SubmitButton,
13591
+ {
13592
+ onClick: save,
13593
+ className: "Layer__bank-transaction__submit-btn",
13594
+ processing: bankTransaction.processing,
13595
+ active: true,
13596
+ action: categorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
13597
+ children: submitBtnText
13598
+ }
13599
+ )
13600
+ ] })
13601
+ ]
13602
+ }
13603
+ ),
13604
+ /* @__PURE__ */ jsx(
13605
+ APIErrorNotifications,
13606
+ {
13607
+ bankTransaction,
13608
+ containerWidth
13609
+ }
13610
+ )
13611
+ ] }) })
13564
13612
  ] })
13565
13613
  }
13566
13614
  );
@@ -13687,8 +13735,8 @@ const getMonthNameFromNumber = (monthNumber) => {
13687
13735
  }
13688
13736
  return (_a = monthNames.at(monthNumber - 1)) != null ? _a : "";
13689
13737
  };
13690
- const Clock = (_Ab) => {
13691
- var _Bb = _Ab, { size = 18 } = _Bb, props = __objRest(_Bb, ["size"]);
13738
+ const Clock = (_Cb) => {
13739
+ var _Db = _Cb, { size = 18 } = _Db, props = __objRest(_Db, ["size"]);
13692
13740
  return /* @__PURE__ */ jsxs(
13693
13741
  "svg",
13694
13742
  __spreadProps(__spreadValues({
@@ -13971,10 +14019,14 @@ const BankTransactionRow = ({
13971
14019
  __spreadProps(__spreadValues(__spreadValues({
13972
14020
  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"}`
13973
14021
  }, openRow), showReceiptDataProperties), {
13974
- children: /* @__PURE__ */ jsxs("span", { className: "Layer__table-cell-content", children: [
13975
- isCredit(bankTransaction) ? "+$" : " $",
13976
- centsToDollars(bankTransaction.amount)
13977
- ] })
14022
+ children: /* @__PURE__ */ jsx(VStack, { align: "end", children: /* @__PURE__ */ jsx(
14023
+ MoneySpan,
14024
+ {
14025
+ amount: bankTransaction.amount,
14026
+ displayPlusSign: isCredit(bankTransaction),
14027
+ className: "Layer__table-cell-content"
14028
+ }
14029
+ ) })
13978
14030
  })
13979
14031
  ),
13980
14032
  /* @__PURE__ */ jsx(
@@ -13995,7 +14047,7 @@ const BankTransactionRow = ({
13995
14047
  `${className}__actions-cell--${open ? "open" : "close"}`
13996
14048
  ),
13997
14049
  children: open ? /* @__PURE__ */ jsxs(HStack, { pie: "md", gap: "md", justify: "end", className: "Layer__bank-transaction-row__category-open", children: [
13998
- bankTransaction.error ? /* @__PURE__ */ jsxs(
14050
+ bankTransaction.error && /* @__PURE__ */ jsxs(
13999
14051
  Text,
14000
14052
  {
14001
14053
  as: "span",
@@ -14006,8 +14058,8 @@ const BankTransactionRow = ({
14006
14058
  /* @__PURE__ */ jsx(AlertCircle, { size: 12 })
14007
14059
  ]
14008
14060
  }
14009
- ) : null,
14010
- categorizationEnabled ? /* @__PURE__ */ jsx(
14061
+ ),
14062
+ categorizationEnabled && /* @__PURE__ */ jsx(
14011
14063
  SubmitButton,
14012
14064
  {
14013
14065
  onClick: () => {
@@ -14021,8 +14073,8 @@ const BankTransactionRow = ({
14021
14073
  action: categorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
14022
14074
  children: categorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Confirm"
14023
14075
  }
14024
- ) : null,
14025
- !categorizationEnabled && !categorized ? /* @__PURE__ */ jsx(VStack, { children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }) : null,
14076
+ ),
14077
+ !categorizationEnabled && !categorized && /* @__PURE__ */ jsx(VStack, { children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }),
14026
14078
  /* @__PURE__ */ jsx(
14027
14079
  IconButton,
14028
14080
  {
@@ -14038,26 +14090,36 @@ const BankTransactionRow = ({
14038
14090
  }
14039
14091
  )
14040
14092
  ] }) : /* @__PURE__ */ jsxs(HStack, { pi: "md", gap: "md", className: "Layer__bank-transaction-row__category-hstack", children: [
14041
- categorizationEnabled && !categorized ? /* @__PURE__ */ jsx(
14042
- BankTransactionCategoryComboBox,
14093
+ /* @__PURE__ */ jsx(
14094
+ AnimatedContent,
14043
14095
  {
14044
- bankTransaction,
14045
- selectedValue: selectedCategory != null ? selectedCategory : null,
14046
- onSelectedValueChange: (selectedCategory2) => {
14047
- setTransactionCategory(bankTransaction.id, selectedCategory2);
14048
- setShowRetry(false);
14049
- },
14050
- isLoading: bankTransaction.processing
14051
- }
14052
- ) : null,
14053
- categorized ? /* @__PURE__ */ jsx(
14096
+ variant: "fade",
14097
+ isOpen: categorizationEnabled && !categorized,
14098
+ className: "Layer__BankTransactionRow__CategoryComboBoxMotionContent",
14099
+ slotProps: { AnimatePresence: { mode: "wait" } },
14100
+ children: /* @__PURE__ */ jsx(
14101
+ BankTransactionCategoryComboBox,
14102
+ {
14103
+ bankTransaction,
14104
+ selectedValue: selectedCategory != null ? selectedCategory : null,
14105
+ onSelectedValueChange: (selectedCategory2) => {
14106
+ setTransactionCategory(bankTransaction.id, selectedCategory2);
14107
+ setShowRetry(false);
14108
+ },
14109
+ isLoading: bankTransaction.processing
14110
+ }
14111
+ )
14112
+ },
14113
+ "category-combobox"
14114
+ ),
14115
+ categorized && /* @__PURE__ */ jsx(
14054
14116
  BankTransactionsCategorizedSelectedValue,
14055
14117
  {
14056
14118
  bankTransaction,
14057
14119
  className: "Layer__bank-transaction-row__category"
14058
14120
  }
14059
- ) : null,
14060
- categorizationEnabled && !categorized && showRetry ? /* @__PURE__ */ jsx(
14121
+ ),
14122
+ categorizationEnabled && !categorized && showRetry && /* @__PURE__ */ jsx(
14061
14123
  RetryButton,
14062
14124
  {
14063
14125
  onClick: () => {
@@ -14070,8 +14132,8 @@ const BankTransactionRow = ({
14070
14132
  error: "Approval failed. Check connection and retry in few seconds.",
14071
14133
  children: "Retry"
14072
14134
  }
14073
- ) : null,
14074
- !categorized && categorizationEnabled && !showRetry ? /* @__PURE__ */ jsx(
14135
+ ),
14136
+ !categorized && categorizationEnabled && !showRetry && /* @__PURE__ */ jsx(
14075
14137
  SubmitButton,
14076
14138
  {
14077
14139
  onClick: () => {
@@ -14085,8 +14147,8 @@ const BankTransactionRow = ({
14085
14147
  action: categorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
14086
14148
  children: categorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Confirm"
14087
14149
  }
14088
- ) : null,
14089
- !categorizationEnabled && !categorized ? /* @__PURE__ */ jsx(VStack, { pis: "xs", fluid: true, children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }) : null,
14150
+ ),
14151
+ !categorizationEnabled && !categorized && /* @__PURE__ */ jsx(VStack, { pis: "xs", fluid: true, children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }),
14090
14152
  /* @__PURE__ */ jsx(
14091
14153
  IconButton,
14092
14154
  {
@@ -14105,7 +14167,7 @@ const BankTransactionRow = ({
14105
14167
  }
14106
14168
  )
14107
14169
  ] }),
14108
- /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan, className: "Layer__bank-transaction-row__expanded-td", children: /* @__PURE__ */ jsx(
14170
+ /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan, className: "Layer__bank-transaction-row__expanded-td", children: /* @__PURE__ */ jsx(AnimatedContent, { variant: "expand", isOpen: open, children: /* @__PURE__ */ jsx(
14109
14171
  ExpandedBankTransactionRow,
14110
14172
  {
14111
14173
  ref: expandedRowRef,
@@ -14118,7 +14180,7 @@ const BankTransactionRow = ({
14118
14180
  showReceiptUploads,
14119
14181
  showTooltips
14120
14182
  }
14121
- ) }) })
14183
+ ) }, `expanded-${bankTransaction.id}`) }) })
14122
14184
  ] });
14123
14185
  };
14124
14186
  const BankTransactionsCategorizedSelectedValue = (props) => {
@@ -14145,6 +14207,40 @@ const normalizeFromBankTransaction = (bankTransaction) => {
14145
14207
  label: (_e = (_d = bankTransaction.category) == null ? void 0 : _d.display_name) != null ? _e : ""
14146
14208
  };
14147
14209
  };
14210
+ const BankTransactionsListItemCategory = ({
14211
+ bankTransaction,
14212
+ mobile = false
14213
+ }) => {
14214
+ const className = mobile ? "Layer__bankTransactionsListItemCategory__Mobile" : "Layer__bankTransactionsListItemCategory__List";
14215
+ const categorized = isCategorized(bankTransaction);
14216
+ const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
14217
+ if (categorized) {
14218
+ return /* @__PURE__ */ jsx(
14219
+ BankTransactionsCategorizedSelectedValue,
14220
+ {
14221
+ bankTransaction,
14222
+ className,
14223
+ slotProps: { Label: { size: "sm" } }
14224
+ }
14225
+ );
14226
+ }
14227
+ return selectedCategory ? /* @__PURE__ */ jsx(
14228
+ BankTransactionsUncategorizedSelectedValue,
14229
+ {
14230
+ selectedValue: selectedCategory != null ? selectedCategory : null,
14231
+ className,
14232
+ slotProps: { Label: { size: "sm" } }
14233
+ }
14234
+ ) : /* @__PURE__ */ jsx(
14235
+ BankTransactionsBaseSelectedValue,
14236
+ {
14237
+ type: "placeholder",
14238
+ label: "No category selected",
14239
+ className,
14240
+ slotProps: { Label: { size: "sm" } }
14241
+ }
14242
+ );
14243
+ };
14148
14244
  const BankTransactionsListItem = ({
14149
14245
  index,
14150
14246
  dateFormat,
@@ -14199,6 +14295,9 @@ const BankTransactionsListItem = ({
14199
14295
  deselect(bankTransaction.id);
14200
14296
  setOpenExpandedRow(false);
14201
14297
  });
14298
+ const handleSave = () => {
14299
+ void save();
14300
+ };
14202
14301
  const openClassName = openExpandedRow ? "Layer__bank-transaction-list-item--expanded" : "";
14203
14302
  const rowClassName = classNames(
14204
14303
  "Layer__bank-transaction-list-item",
@@ -14255,14 +14354,14 @@ const BankTransactionsListItem = ({
14255
14354
  /* @__PURE__ */ jsx(
14256
14355
  MoneySpan,
14257
14356
  {
14258
- className: `Layer__bank-transaction-list-item__amount-${isCredit(bankTransaction) ? "credit" : "debit"}`,
14259
14357
  amount: bankTransaction.amount,
14260
- displayPlusSign: isCredit(bankTransaction)
14358
+ displayPlusSign: isCredit(bankTransaction),
14359
+ size: "md"
14261
14360
  }
14262
14361
  )
14263
14362
  ] }),
14264
- !categorizationEnabled && !categorized ? /* @__PURE__ */ jsx("span", { className: "Layer__bank-transaction-list-item__processing-info", children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }) : null,
14265
- /* @__PURE__ */ jsx("span", { className: "Layer__bank-transaction-list-item__expanded-row", children: /* @__PURE__ */ jsx(
14363
+ !categorizationEnabled && !categorized && /* @__PURE__ */ jsx("span", { className: "Layer__bank-transaction-list-item__processing-info", children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }),
14364
+ /* @__PURE__ */ jsx("span", { className: "Layer__bank-transaction-list-item__expanded-row", children: /* @__PURE__ */ jsx(AnimatedContent, { variant: "expand", isOpen: openExpandedRow, children: /* @__PURE__ */ jsx(
14266
14365
  ExpandedBankTransactionRow,
14267
14366
  {
14268
14367
  ref: expandedRowRef,
@@ -14275,11 +14374,12 @@ const BankTransactionsListItem = ({
14275
14374
  containerWidth,
14276
14375
  showDescriptions,
14277
14376
  showReceiptUploads,
14278
- showTooltips
14377
+ showTooltips,
14378
+ showLeftPadding: false
14279
14379
  }
14280
- ) }),
14281
- /* @__PURE__ */ jsxs("span", { className: "Layer__bank-transaction-list-item__base-row", children: [
14282
- categorizationEnabled && !categorized ? /* @__PURE__ */ jsx(
14380
+ ) }, `expanded-${bankTransaction.id}`) }),
14381
+ !openExpandedRow && categorizationEnabled && !categorized && /* @__PURE__ */ jsxs(HStack, { pi: "md", gap: "md", pb: "md", children: [
14382
+ /* @__PURE__ */ jsx(
14283
14383
  BankTransactionCategoryComboBox,
14284
14384
  {
14285
14385
  bankTransaction,
@@ -14290,48 +14390,36 @@ const BankTransactionsListItem = ({
14290
14390
  },
14291
14391
  isLoading: bankTransaction.processing
14292
14392
  }
14293
- ) : null,
14294
- categorized ? /* @__PURE__ */ jsx(
14295
- BankTransactionsCategorizedSelectedValue,
14296
- {
14297
- bankTransaction
14298
- }
14299
- ) : selectedCategory ? /* @__PURE__ */ jsx(
14300
- BankTransactionsUncategorizedSelectedValue,
14301
- {
14302
- selectedValue: selectedCategory
14303
- }
14304
- ) : null,
14305
- categorizationEnabled && !categorized && !showRetry ? /* @__PURE__ */ jsx(
14393
+ ),
14394
+ !showRetry && /* @__PURE__ */ jsx(
14306
14395
  SubmitButton,
14307
14396
  {
14308
- onClick: () => {
14309
- if (!bankTransaction.processing) {
14310
- void save();
14311
- }
14312
- },
14397
+ disabled: bankTransaction.processing,
14398
+ onClick: handleSave,
14313
14399
  className: "Layer__bank-transaction__submit-btn",
14314
14400
  processing: bankTransaction.processing,
14315
14401
  action: !categorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
14316
14402
  children: !categorized ? (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Approve" : (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update"
14317
14403
  }
14318
- ) : null,
14319
- categorizationEnabled && !categorized && showRetry ? /* @__PURE__ */ jsx(
14404
+ ),
14405
+ showRetry && /* @__PURE__ */ jsx(
14320
14406
  RetryButton,
14321
14407
  {
14322
- onClick: () => {
14323
- if (!bankTransaction.processing) {
14324
- void save();
14325
- }
14326
- },
14408
+ onClick: handleSave,
14327
14409
  className: "Layer__bank-transaction__retry-btn",
14328
14410
  processing: bankTransaction.processing,
14329
14411
  error: "Approval failed. Check connection and retry in few seconds.",
14330
14412
  children: "Retry"
14331
14413
  }
14332
- ) : null
14414
+ )
14333
14415
  ] }),
14334
- bankTransaction.error && showRetry ? /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
14416
+ !openExpandedRow && categorizationEnabled && categorized && /* @__PURE__ */ jsx(
14417
+ BankTransactionsListItemCategory,
14418
+ {
14419
+ bankTransaction
14420
+ }
14421
+ ),
14422
+ bankTransaction.error && showRetry && /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." })
14335
14423
  ] });
14336
14424
  };
14337
14425
  const useBankTransactionsTableCheckboxState = ({ bankTransactions }) => {
@@ -14436,53 +14524,52 @@ const BankTransactionsList = ({
14436
14524
  ) })
14437
14525
  ] });
14438
14526
  };
14439
- const CloseIcon = (_Cb) => {
14440
- var _Db = _Cb, { size = 12 } = _Db, props = __objRest(_Db, ["size"]);
14441
- return /* @__PURE__ */ jsxs(
14442
- "svg",
14443
- __spreadProps(__spreadValues({
14444
- viewBox: "0 0 12 12",
14445
- fill: "none",
14446
- xmlns: "http://www.w3.org/2000/svg"
14447
- }, props), {
14448
- width: size,
14449
- height: size,
14450
- children: [
14451
- /* @__PURE__ */ jsx(
14452
- "path",
14453
- {
14454
- d: "M8.75 3.25L3.25 8.75",
14455
- stroke: "currentColor",
14456
- strokeLinecap: "round",
14457
- strokeLinejoin: "round"
14458
- }
14459
- ),
14460
- /* @__PURE__ */ jsx(
14461
- "path",
14462
- {
14463
- d: "M3.25 3.25L8.75 8.75",
14464
- stroke: "currentColor",
14465
- strokeLinecap: "round",
14466
- strokeLinejoin: "round"
14467
- }
14468
- )
14469
- ]
14470
- })
14471
- );
14527
+ const useTransactionToOpen = () => {
14528
+ const [transactionIdToOpen, setTransactionIdToOpen] = useState(void 0);
14529
+ const clearTransactionIdToOpen = useCallback(() => setTransactionIdToOpen(void 0), []);
14530
+ return {
14531
+ transactionIdToOpen,
14532
+ setTransactionIdToOpen,
14533
+ clearTransactionIdToOpen
14534
+ };
14472
14535
  };
14473
- const CloseButton = (_Eb) => {
14474
- var _Fb = _Eb, {
14475
- className,
14476
- textOnly = false
14477
- } = _Fb, props = __objRest(_Fb, [
14478
- "className",
14479
- "textOnly"
14480
- ]);
14481
- const baseClassName2 = classNames("Layer__btn", "Layer__back-btn", className);
14482
- return /* @__PURE__ */ jsx("button", __spreadProps(__spreadValues({}, props), { className: baseClassName2, children: textOnly ? "Back" : /* @__PURE__ */ jsx(CloseIcon, { size: 16 }) }));
14536
+ const TransactionToOpenContext = createContext({
14537
+ transactionIdToOpen: void 0,
14538
+ setTransactionIdToOpen: () => void 0,
14539
+ clearTransactionIdToOpen: () => void 0
14540
+ });
14541
+ const BankTransactionsMobileListItemCheckbox = ({
14542
+ bulkActionsEnabled,
14543
+ bankTransaction,
14544
+ checkboxContainerRef
14545
+ }) => {
14546
+ const internalRef = useRef(null);
14547
+ const ref = checkboxContainerRef || internalRef;
14548
+ const bookkeepingStatus = useEffectiveBookkeepingStatus();
14549
+ const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
14550
+ const { select, deselect } = useBulkSelectionActions();
14551
+ const isSelected = useIdIsSelected();
14552
+ const isTransactionSelected = isSelected(bankTransaction.id);
14553
+ if (!categorizationEnabled || !bulkActionsEnabled) {
14554
+ return null;
14555
+ }
14556
+ return /* @__PURE__ */ jsx(VStack, { align: "start", pis: "md", pie: "2xs", ref, children: /* @__PURE__ */ jsx(
14557
+ Checkbox,
14558
+ {
14559
+ size: "md",
14560
+ isSelected: isTransactionSelected,
14561
+ onChange: (selected) => {
14562
+ if (selected) {
14563
+ select(bankTransaction.id);
14564
+ } else {
14565
+ deselect(bankTransaction.id);
14566
+ }
14567
+ }
14568
+ }
14569
+ ) });
14483
14570
  };
14484
- const Paperclip = (_Gb) => {
14485
- var _Hb = _Gb, { size = 20 } = _Hb, props = __objRest(_Hb, ["size"]);
14571
+ const Paperclip = (_Eb) => {
14572
+ var _Fb = _Eb, { size = 20 } = _Fb, props = __objRest(_Fb, ["size"]);
14486
14573
  return /* @__PURE__ */ jsx(
14487
14574
  "svg",
14488
14575
  __spreadProps(__spreadValues({
@@ -14504,6 +14591,73 @@ const Paperclip = (_Gb) => {
14504
14591
  })
14505
14592
  );
14506
14593
  };
14594
+ const BusinessFormMobileItem = ({
14595
+ option
14596
+ }) => {
14597
+ const value = option.value.value;
14598
+ const label = option.value.label;
14599
+ return /* @__PURE__ */ jsx(
14600
+ GridListItem,
14601
+ {
14602
+ id: value,
14603
+ textValue: label,
14604
+ className: "Layer__BusinessFormMobileItem",
14605
+ children: /* @__PURE__ */ jsxs(HStack, { gap: "md", pi: "md", pb: "sm", children: [
14606
+ !option.asLink && /* @__PURE__ */ jsx(
14607
+ Checkbox,
14608
+ {
14609
+ slot: "selection",
14610
+ variant: "round"
14611
+ }
14612
+ ),
14613
+ /* @__PURE__ */ jsx(Span, { size: "sm", children: label }),
14614
+ option.asLink && /* @__PURE__ */ jsx(
14615
+ ChevronRight,
14616
+ {
14617
+ size: 16,
14618
+ className: "Layer__BusinessFormMobileItem__link-icon"
14619
+ }
14620
+ )
14621
+ ] })
14622
+ },
14623
+ value
14624
+ );
14625
+ };
14626
+ const BusinessFormMobile = ({
14627
+ options: options2,
14628
+ selectedId,
14629
+ onSelect,
14630
+ readOnly
14631
+ }) => {
14632
+ const handleSelectionChange = useCallback((keys) => {
14633
+ if (readOnly) return;
14634
+ const selectedKey = [...keys][0];
14635
+ const selectedOption = options2.find((opt) => opt.value.value === selectedKey);
14636
+ if (selectedOption) {
14637
+ onSelect(selectedOption);
14638
+ }
14639
+ }, [options2, onSelect, readOnly]);
14640
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
14641
+ /* @__PURE__ */ jsx(Span, { size: "sm", weight: "bold", children: "Select category" }),
14642
+ /* @__PURE__ */ jsx(
14643
+ GridList,
14644
+ {
14645
+ "aria-label": "Select a category",
14646
+ selectionMode: "single",
14647
+ selectedKeys: selectedId ? /* @__PURE__ */ new Set([selectedId]) : /* @__PURE__ */ new Set(),
14648
+ onSelectionChange: handleSelectionChange,
14649
+ className: "Layer__BusinessFormMobile",
14650
+ children: options2.map((option) => /* @__PURE__ */ jsx(
14651
+ BusinessFormMobileItem,
14652
+ {
14653
+ option
14654
+ },
14655
+ option.value.value
14656
+ ))
14657
+ }
14658
+ )
14659
+ ] });
14660
+ };
14507
14661
  const ActionableList = ({
14508
14662
  options: options2,
14509
14663
  onClick,
@@ -14577,8 +14731,8 @@ const flattenCategories = (categories) => {
14577
14731
  return leafCategories.map((cat) => new CategoryAsOption(cat));
14578
14732
  });
14579
14733
  };
14580
- const X = (_Ib) => {
14581
- var _Jb = _Ib, { size = 18 } = _Jb, props = __objRest(_Jb, ["size"]);
14734
+ const X = (_Gb) => {
14735
+ var _Hb = _Gb, { size = 18 } = _Hb, props = __objRest(_Hb, ["size"]);
14582
14736
  return /* @__PURE__ */ jsxs(
14583
14737
  "svg",
14584
14738
  __spreadProps(__spreadValues({
@@ -14612,11 +14766,11 @@ const X = (_Ib) => {
14612
14766
  );
14613
14767
  };
14614
14768
  const CLASS_NAME$7 = "Layer__MinimalSearchField";
14615
- function MinimalSearchField(_Kb) {
14616
- var _Lb = _Kb, {
14769
+ function MinimalSearchField(_Ib) {
14770
+ var _Jb = _Ib, {
14617
14771
  placeholder,
14618
14772
  isDisabled
14619
- } = _Lb, restProps = __objRest(_Lb, [
14773
+ } = _Jb, restProps = __objRest(_Jb, [
14620
14774
  "placeholder",
14621
14775
  "isDisabled"
14622
14776
  ]);
@@ -14632,8 +14786,8 @@ function MinimalSearchField(_Kb) {
14632
14786
  ] }));
14633
14787
  }
14634
14788
  const CLASS_NAME$6 = "Layer__SearchField";
14635
- function SearchField(_Mb) {
14636
- var _Nb = _Mb, { slot = "search", className, label, isDisabled } = _Nb, restProps = __objRest(_Nb, ["slot", "className", "label", "isDisabled"]);
14789
+ function SearchField(_Kb) {
14790
+ var _Lb = _Kb, { slot = "search", className, label, isDisabled } = _Lb, restProps = __objRest(_Lb, ["slot", "className", "label", "isDisabled"]);
14637
14791
  const combinedClassName = classNames(CLASS_NAME$6, className);
14638
14792
  return /* @__PURE__ */ jsxs(InputGroup, { slot, className: combinedClassName, children: [
14639
14793
  /* @__PURE__ */ jsx(VStack, { slot: "icon", align: "center", justify: "center", className: "Layer__SearchField__Icon", "data-disabled": isDisabled || void 0, children: /* @__PURE__ */ jsx(Search, { size: 14 }) }),
@@ -14650,7 +14804,7 @@ function SearchField(_Mb) {
14650
14804
  const isGroup = (item) => {
14651
14805
  return "categories" in item;
14652
14806
  };
14653
- const BusinessCategories = ({
14807
+ const BankTransactionsMobileListBusinessCategories = ({
14654
14808
  select,
14655
14809
  selectedId,
14656
14810
  showTooltips
@@ -14725,7 +14879,7 @@ const CategorySelectDrawer = ({
14725
14879
  onOpenChange
14726
14880
  }) => {
14727
14881
  return /* @__PURE__ */ jsx(Drawer, { isOpen, onOpenChange, variant: "mobile-drawer", isDismissable: true, children: ({ close: close2 }) => /* @__PURE__ */ jsx(
14728
- BusinessCategories,
14882
+ BankTransactionsMobileListBusinessCategories,
14729
14883
  {
14730
14884
  select: (option) => {
14731
14885
  onSelect(option);
@@ -14736,7 +14890,11 @@ const CategorySelectDrawer = ({
14736
14890
  }
14737
14891
  ) });
14738
14892
  };
14739
- const BusinessForm$1 = ({
14893
+ const SELECT_CATEGORY_VALUE = "SELECT_CATEGORY";
14894
+ const isSelectCategoryOption = (value) => {
14895
+ return isPlaceholderAsOption(value) && value.value === SELECT_CATEGORY_VALUE;
14896
+ };
14897
+ const BankTransactionsMobileListBusinessForm = ({
14740
14898
  bankTransaction,
14741
14899
  showCategorization,
14742
14900
  showDescriptions,
@@ -14745,6 +14903,17 @@ const BusinessForm$1 = ({
14745
14903
  }) => {
14746
14904
  const receiptsRef = useRef(null);
14747
14905
  const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
14906
+ const [sessionCategories, setSessionCategories] = useState(() => {
14907
+ var _a;
14908
+ const initialMap = /* @__PURE__ */ new Map();
14909
+ if (((_a = bankTransaction == null ? void 0 : bankTransaction.categorization_flow) == null ? void 0 : _a.type) === CategorizationType.ASK_FROM_SUGGESTIONS) {
14910
+ bankTransaction.categorization_flow.suggestions.forEach((suggestion) => {
14911
+ const opt = new ApiCategorizationAsOption(suggestion);
14912
+ initialMap.set(opt.value, opt);
14913
+ });
14914
+ }
14915
+ return initialMap;
14916
+ });
14748
14917
  const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
14749
14918
  const { setTransactionCategory } = useBankTransactionsCategoryActions();
14750
14919
  const [showRetry, setShowRetry] = useState(false);
@@ -14755,42 +14924,26 @@ const BusinessForm$1 = ({
14755
14924
  }
14756
14925
  }, [bankTransaction.error]);
14757
14926
  const options2 = useMemo(() => {
14758
- var _a;
14759
- 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) => {
14760
- var _a2;
14761
- const opt = new ApiCategorizationAsOption(x);
14762
- return {
14763
- label: opt.label,
14764
- id: opt.value,
14765
- description: (_a2 = x.description) != null ? _a2 : void 0,
14766
- value: opt
14767
- };
14768
- }) : [];
14769
- if (selectedCategory && !options22.find((x) => x.id === selectedCategory.value)) {
14770
- options22.unshift({
14771
- label: selectedCategory.label,
14772
- id: selectedCategory.value,
14773
- value: selectedCategory
14774
- });
14775
- }
14776
- if (options22.length) {
14777
- options22.push({
14778
- label: "See all categories",
14779
- id: "SELECT_CATEGORY",
14780
- value: {
14781
- type: "SELECT_CATEGORY"
14782
- },
14783
- secondary: true,
14784
- asLink: true
14785
- });
14786
- }
14927
+ const options22 = Array.from(sessionCategories.values()).map((category) => ({
14928
+ value: category
14929
+ }));
14930
+ options22.push({
14931
+ value: new PlaceholderAsOption({
14932
+ label: "Show all categories",
14933
+ value: "SELECT_CATEGORY"
14934
+ }),
14935
+ asLink: true
14936
+ });
14787
14937
  return options22;
14788
- }, [bankTransaction, selectedCategory]);
14938
+ }, [sessionCategories]);
14789
14939
  const onCategorySelect = (category) => {
14790
- if ("type" in category.value && category.value.type === "SELECT_CATEGORY") {
14940
+ if (isSelectCategoryOption(category.value)) {
14791
14941
  setIsDrawerOpen(true);
14792
14942
  } else {
14793
14943
  const option = category.value;
14944
+ if (!isPlaceholderAsOption(option)) {
14945
+ setSessionCategories((prev) => new Map(prev).set(option.value, option));
14946
+ }
14794
14947
  if (selectedCategory && option.value === selectedCategory.value) {
14795
14948
  setTransactionCategory(bankTransaction.id, null);
14796
14949
  } else {
@@ -14813,22 +14966,28 @@ const BusinessForm$1 = ({
14813
14966
  true
14814
14967
  );
14815
14968
  };
14969
+ const onDrawerSelect = useCallback((category) => {
14970
+ if (!category) return;
14971
+ setSessionCategories((prev) => new Map(prev).set(category.value, category));
14972
+ setTransactionCategory(bankTransaction.id, category);
14973
+ }, [bankTransaction.id, setTransactionCategory]);
14816
14974
  return /* @__PURE__ */ jsxs(Fragment, { children: [
14817
- /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__business-form", children: [
14818
- showCategorization ? /* @__PURE__ */ jsx(
14819
- ActionableList,
14975
+ /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
14976
+ showCategorization && /* @__PURE__ */ jsx(
14977
+ BusinessFormMobile,
14820
14978
  {
14821
14979
  options: options2,
14822
- onClick: onCategorySelect,
14823
- selectedId: selectedCategory == null ? void 0 : selectedCategory.value,
14824
- showDescriptions: showTooltips
14980
+ onSelect: onCategorySelect,
14981
+ selectedId: selectedCategory == null ? void 0 : selectedCategory.value
14825
14982
  }
14826
- ) : null,
14983
+ ),
14827
14984
  /* @__PURE__ */ jsx(
14828
14985
  BankTransactionFormFields,
14829
14986
  {
14830
14987
  bankTransaction,
14831
- showDescriptions
14988
+ showDescriptions,
14989
+ hideCustomerVendor: true,
14990
+ hideTags: true
14832
14991
  }
14833
14992
  ),
14834
14993
  /* @__PURE__ */ jsx(
@@ -14849,7 +15008,7 @@ const BusinessForm$1 = ({
14849
15008
  )
14850
15009
  }
14851
15010
  ),
14852
- /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__actions", children: [
15011
+ /* @__PURE__ */ jsxs(HStack, { gap: "md", children: [
14853
15012
  showReceiptUploads && /* @__PURE__ */ jsx(
14854
15013
  FileInput,
14855
15014
  {
@@ -14862,33 +15021,22 @@ const BusinessForm$1 = ({
14862
15021
  icon: /* @__PURE__ */ jsx(Paperclip, {})
14863
15022
  }
14864
15023
  ),
14865
- options2.length === 0 ? /* @__PURE__ */ jsx(
14866
- Button$1,
14867
- {
14868
- onClick: () => {
14869
- setIsDrawerOpen(true);
14870
- },
14871
- fullWidth: true,
14872
- variant: ButtonVariant.secondary,
14873
- children: "Select category"
14874
- }
14875
- ) : null,
14876
- showCategorization && options2.length > 0 ? /* @__PURE__ */ jsx(
14877
- Button$1,
15024
+ showCategorization && sessionCategories.size > 0 && /* @__PURE__ */ jsx(
15025
+ Button,
14878
15026
  {
14879
15027
  onClick: save,
14880
- disabled: !selectedCategory || isLoading || bankTransaction.processing,
14881
15028
  fullWidth: true,
14882
- children: isLoading || bankTransaction.processing ? "Confirming..." : "Confirm"
15029
+ isDisabled: !selectedCategory || isLoading || bankTransaction.processing,
15030
+ children: bankTransaction.processing || isLoading ? "Confirming..." : "Confirm"
14883
15031
  }
14884
- ) : null
15032
+ )
14885
15033
  ] }),
14886
15034
  bankTransaction.error && showRetry ? /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
14887
15035
  ] }),
14888
15036
  /* @__PURE__ */ jsx(
14889
15037
  CategorySelectDrawer,
14890
15038
  {
14891
- onSelect: (category) => setTransactionCategory(bankTransaction.id, category),
15039
+ onSelect: onDrawerSelect,
14892
15040
  selectedId: selectedCategory == null ? void 0 : selectedCategory.value,
14893
15041
  showTooltips,
14894
15042
  isOpen: isDrawerOpen,
@@ -14912,7 +15060,7 @@ const isAlreadyAssigned = (bankTransaction) => {
14912
15060
  )
14913
15061
  );
14914
15062
  };
14915
- const PersonalForm = ({
15063
+ const BankTransactionsMobileListPersonalForm = ({
14916
15064
  bankTransaction,
14917
15065
  showReceiptUploads,
14918
15066
  showDescriptions,
@@ -14943,12 +15091,14 @@ const PersonalForm = ({
14943
15091
  );
14944
15092
  };
14945
15093
  const alreadyAssigned = isAlreadyAssigned(bankTransaction);
14946
- return /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__personal-form", children: [
15094
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
14947
15095
  /* @__PURE__ */ jsx(
14948
15096
  BankTransactionFormFields,
14949
15097
  {
14950
15098
  bankTransaction,
14951
- showDescriptions
15099
+ showDescriptions,
15100
+ hideCustomerVendor: true,
15101
+ hideTags: true
14952
15102
  }
14953
15103
  ),
14954
15104
  /* @__PURE__ */ jsx(
@@ -14969,7 +15119,7 @@ const PersonalForm = ({
14969
15119
  )
14970
15120
  }
14971
15121
  ),
14972
- /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__actions", children: [
15122
+ /* @__PURE__ */ jsxs(HStack, { gap: "md", children: [
14973
15123
  showReceiptUploads && /* @__PURE__ */ jsx(
14974
15124
  FileInput,
14975
15125
  {
@@ -14982,98 +15132,131 @@ const PersonalForm = ({
14982
15132
  icon: /* @__PURE__ */ jsx(Paperclip, {})
14983
15133
  }
14984
15134
  ),
14985
- showCategorization ? /* @__PURE__ */ jsx(
14986
- Button$1,
15135
+ showCategorization && /* @__PURE__ */ jsx(
15136
+ Button,
14987
15137
  {
14988
15138
  fullWidth: true,
14989
- disabled: alreadyAssigned || isLoading || bankTransaction.processing,
14990
15139
  onClick: save,
14991
- children: isLoading || bankTransaction.processing ? "Saving..." : alreadyAssigned ? "Saved as Personal" : "Categorize as Personal"
15140
+ isDisabled: alreadyAssigned || isLoading || bankTransaction.processing,
15141
+ children: bankTransaction.processing || isLoading ? "Confirming..." : alreadyAssigned ? "Confirmed" : "Mark as Personal"
14992
15142
  }
14993
- ) : null
15143
+ )
14994
15144
  ] }),
14995
15145
  bankTransaction.error && showRetry ? /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
14996
15146
  ] });
14997
15147
  };
15148
+ const DATE_FORMAT = "LLL d";
15149
+ const BankTransactionsAmountDate = ({ amount, date, slotProps }) => {
15150
+ return /* @__PURE__ */ jsxs(
15151
+ VStack,
15152
+ {
15153
+ align: "end",
15154
+ gap: "3xs",
15155
+ pb: "sm",
15156
+ children: [
15157
+ /* @__PURE__ */ jsx(HStack, { children: /* @__PURE__ */ jsx(
15158
+ MoneySpan,
15159
+ __spreadValues({
15160
+ amount
15161
+ }, slotProps == null ? void 0 : slotProps.MoneySpan)
15162
+ ) }),
15163
+ /* @__PURE__ */ jsx(
15164
+ DateTime,
15165
+ {
15166
+ value: date,
15167
+ dateFormat: DATE_FORMAT,
15168
+ onlyDate: true,
15169
+ slotProps: {
15170
+ Date: __spreadValues({
15171
+ variant: "subtle",
15172
+ size: "sm"
15173
+ }, slotProps == null ? void 0 : slotProps.DateTime)
15174
+ }
15175
+ }
15176
+ )
15177
+ ]
15178
+ }
15179
+ );
15180
+ };
15181
+ const MatchFormMobileItem = ({ match, bankTransaction, inAppLink }) => {
15182
+ return /* @__PURE__ */ jsx(
15183
+ GridListItem,
15184
+ {
15185
+ id: match.id,
15186
+ textValue: match.details.description,
15187
+ children: /* @__PURE__ */ jsxs(HStack, { pi: "md", gap: "md", justify: "space-between", children: [
15188
+ /* @__PURE__ */ jsxs(HStack, { align: "center", children: [
15189
+ /* @__PURE__ */ jsx(
15190
+ Checkbox,
15191
+ {
15192
+ slot: "selection",
15193
+ variant: "round",
15194
+ className: "Layer__MatchFormMobileItem__Checkbox"
15195
+ }
15196
+ ),
15197
+ /* @__PURE__ */ jsx(Span, { size: "sm", children: match.details.description })
15198
+ ] }),
15199
+ /* @__PURE__ */ jsx(
15200
+ BankTransactionsAmountDate,
15201
+ {
15202
+ amount: match.details.amount,
15203
+ date: match.details.date,
15204
+ slotProps: {
15205
+ MoneySpan: { size: "sm", displayPlusSign: isCredit(bankTransaction) },
15206
+ DateTime: { size: "xs" }
15207
+ }
15208
+ }
15209
+ ),
15210
+ inAppLink
15211
+ ] })
15212
+ },
15213
+ match.id
15214
+ );
15215
+ };
14998
15216
  const MatchFormMobile = ({
14999
- classNamePrefix,
15000
15217
  bankTransaction,
15001
15218
  selectedMatchId,
15002
15219
  setSelectedMatch,
15003
15220
  matchFormError,
15004
15221
  readOnly
15005
15222
  }) => {
15006
- var _a;
15007
15223
  const { renderInAppLink } = useInAppLinkContext();
15008
- return /* @__PURE__ */ jsxs("div", { className: `${classNamePrefix}__match-list`, children: [
15009
- (_a = bankTransaction.suggested_matches) == null ? void 0 : _a.map((match, idx) => {
15010
- const matchDetails = match.details ? decodeMatchDetails(match.details) : void 0;
15011
- const inAppLink = renderInAppLink && matchDetails ? renderInAppLink(convertMatchDetailsToLinkingMetadata(matchDetails)) : null;
15012
- return /* @__PURE__ */ jsxs(
15013
- "div",
15014
- {
15015
- className: classNames(
15016
- `${classNamePrefix}__match-item`,
15017
- match.id === selectedMatchId ? `${classNamePrefix}__match-item--selected` : ""
15018
- ),
15019
- onClick: () => {
15020
- if (readOnly) {
15021
- return;
15022
- }
15023
- setSelectedMatch(match);
15024
- },
15025
- children: [
15026
- /* @__PURE__ */ jsxs("div", { className: `${classNamePrefix}__match-item__col-details`, children: [
15027
- /* @__PURE__ */ jsxs("div", { className: `${classNamePrefix}__match-item__heading`, children: [
15028
- /* @__PURE__ */ jsx(
15029
- Text,
15030
- {
15031
- className: `${classNamePrefix}__match-item__name`,
15032
- as: "span",
15033
- children: match.details.description
15034
- }
15035
- ),
15036
- /* @__PURE__ */ jsxs(
15037
- Text,
15038
- {
15039
- className: `${classNamePrefix}__match-item__amount`,
15040
- as: "span",
15041
- children: [
15042
- "$",
15043
- centsToDollars(match.details.amount)
15044
- ]
15045
- }
15046
- )
15047
- ] }),
15048
- /* @__PURE__ */ jsxs("div", { className: `${classNamePrefix}__match-item__details`, children: [
15049
- /* @__PURE__ */ jsx(HStack, { children: inAppLink }),
15050
- /* @__PURE__ */ jsx(
15051
- Text,
15052
- {
15053
- className: `${classNamePrefix}__match-item__date`,
15054
- size: TextSize.sm,
15055
- as: "span",
15056
- children: format(parseISO(match.details.date), MONTH_DAY_FORMAT)
15057
- }
15058
- )
15059
- ] })
15060
- ] }),
15061
- /* @__PURE__ */ jsx("div", { className: `${classNamePrefix}__match-item__col-status`, children: selectedMatchId && selectedMatchId === match.id ? /* @__PURE__ */ jsx(
15062
- Check,
15063
- {
15064
- size: 16,
15065
- className: `${classNamePrefix}__match-item__selected-icon`
15066
- }
15067
- ) : null })
15068
- ]
15069
- },
15070
- idx
15071
- );
15072
- }),
15073
- matchFormError && /* @__PURE__ */ jsx(ErrorText, { children: matchFormError })
15074
- ] });
15224
+ const suggestedMatches = bankTransaction.suggested_matches;
15225
+ return /* @__PURE__ */ jsxs(
15226
+ GridList,
15227
+ {
15228
+ "aria-label": "Select a match",
15229
+ selectionMode: "single",
15230
+ selectedKeys: selectedMatchId ? /* @__PURE__ */ new Set([selectedMatchId]) : /* @__PURE__ */ new Set(),
15231
+ onSelectionChange: (keys) => {
15232
+ if (readOnly) return;
15233
+ const selectedKey = [...keys][0];
15234
+ const selectedMatch = suggestedMatches == null ? void 0 : suggestedMatches.find((m) => m.id === selectedKey);
15235
+ if (selectedMatch) {
15236
+ setSelectedMatch(selectedMatch);
15237
+ }
15238
+ },
15239
+ className: "Layer__MatchFormMobile",
15240
+ children: [
15241
+ suggestedMatches == null ? void 0 : suggestedMatches.map((match) => {
15242
+ const matchDetails = match.details ? decodeMatchDetails(match.details) : void 0;
15243
+ const inAppLink = renderInAppLink && matchDetails ? renderInAppLink(convertMatchDetailsToLinkingMetadata(matchDetails)) : null;
15244
+ return /* @__PURE__ */ jsx(
15245
+ MatchFormMobileItem,
15246
+ {
15247
+ match,
15248
+ bankTransaction,
15249
+ inAppLink
15250
+ },
15251
+ match.id
15252
+ );
15253
+ }),
15254
+ matchFormError && /* @__PURE__ */ jsx(ErrorText, { children: matchFormError })
15255
+ ]
15256
+ }
15257
+ );
15075
15258
  };
15076
- const MatchForm = ({
15259
+ const BankTransactionsMobileListMatchForm = ({
15077
15260
  bankTransaction,
15078
15261
  showReceiptUploads,
15079
15262
  showDescriptions,
@@ -15083,7 +15266,7 @@ const MatchForm = ({
15083
15266
  const receiptsRef = useRef(null);
15084
15267
  const { match: matchBankTransaction2, isLoading } = useBankTransactionsContext();
15085
15268
  const [selectedMatch, setSelectedMatch] = useState(
15086
- getBankTransactionMatchAsSuggestedMatch(bankTransaction)
15269
+ getBankTransactionFirstSuggestedMatch(bankTransaction)
15087
15270
  );
15088
15271
  const [formError, setFormError] = useState();
15089
15272
  const showRetry = Boolean(bankTransaction.error);
@@ -15097,24 +15280,24 @@ const MatchForm = ({
15097
15280
  }
15098
15281
  yield matchBankTransaction2(bankTransaction.id, foundMatch.id, true);
15099
15282
  });
15100
- const save = () => __async(null, null, function* () {
15283
+ const save = () => {
15101
15284
  var _a2;
15102
15285
  if (!showCategorization) {
15103
15286
  return;
15104
15287
  }
15105
15288
  if (!selectedMatch) {
15106
15289
  setFormError("Select an option to match the transaction");
15107
- } else if (selectedMatch && selectedMatch.id !== ((_a2 = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a2.id)) {
15108
- yield onMatchSubmit(selectedMatch.id);
15290
+ }
15291
+ if (selectedMatch && selectedMatch.id !== ((_a2 = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a2.id)) {
15292
+ void onMatchSubmit(selectedMatch.id);
15109
15293
  }
15110
15294
  return;
15111
- });
15112
- return /* @__PURE__ */ jsxs("div", { children: [
15113
- /* @__PURE__ */ jsx(Text, { weight: TextWeight.bold, size: TextSize.sm, children: "Find match" }),
15295
+ };
15296
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
15297
+ /* @__PURE__ */ jsx(Span, { size: "sm", weight: "bold", children: "Find Match" }),
15114
15298
  /* @__PURE__ */ jsx(
15115
15299
  MatchFormMobile,
15116
15300
  {
15117
- classNamePrefix: "Layer__bank-transaction-mobile-list-item",
15118
15301
  readOnly: !showCategorization,
15119
15302
  bankTransaction,
15120
15303
  selectedMatchId: selectedMatch == null ? void 0 : selectedMatch.id,
@@ -15128,28 +15311,21 @@ const MatchForm = ({
15128
15311
  BankTransactionFormFields,
15129
15312
  {
15130
15313
  bankTransaction,
15131
- showDescriptions
15314
+ showDescriptions,
15315
+ hideCustomerVendor: true,
15316
+ hideTags: true
15132
15317
  }
15133
15318
  ),
15134
- /* @__PURE__ */ jsx(
15135
- "div",
15319
+ showReceiptUploads && /* @__PURE__ */ jsx(
15320
+ BankTransactionReceipts,
15136
15321
  {
15137
- className: classNames(
15138
- "Layer__bank-transaction-mobile-list-item__receipts",
15139
- hasReceipts(bankTransaction) ? "Layer__bank-transaction-mobile-list-item__actions--with-receipts" : void 0
15140
- ),
15141
- children: showReceiptUploads && /* @__PURE__ */ jsx(
15142
- BankTransactionReceipts,
15143
- {
15144
- ref: receiptsRef,
15145
- floatingActions: false,
15146
- hideUploadButtons: true,
15147
- label: "Receipts"
15148
- }
15149
- )
15322
+ ref: receiptsRef,
15323
+ floatingActions: false,
15324
+ hideUploadButtons: true,
15325
+ label: "Receipts"
15150
15326
  }
15151
15327
  ),
15152
- /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__actions", children: [
15328
+ /* @__PURE__ */ jsxs(HStack, { gap: "md", children: [
15153
15329
  showReceiptUploads && /* @__PURE__ */ jsx(
15154
15330
  FileInput,
15155
15331
  {
@@ -15163,49 +15339,37 @@ const MatchForm = ({
15163
15339
  }
15164
15340
  ),
15165
15341
  showCategorization && /* @__PURE__ */ jsx(
15166
- Button$1,
15342
+ Button,
15167
15343
  {
15168
15344
  fullWidth: true,
15169
- disabled: !selectedMatch || isLoading || bankTransaction.processing || selectedMatch.id === ((_a = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a.id),
15170
- onClick: () => {
15171
- void save();
15172
- },
15345
+ isDisabled: !selectedMatch || isLoading || bankTransaction.processing || selectedMatch.id === ((_a = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a.id),
15346
+ onClick: save,
15173
15347
  children: isLoading || bankTransaction.processing ? "Saving..." : "Approve match"
15174
15348
  }
15175
15349
  )
15176
15350
  ] }),
15177
15351
  formError && /* @__PURE__ */ jsx(ErrorText, { children: formError }),
15178
- showRetry ? /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
15352
+ showRetry && /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." })
15179
15353
  ] });
15180
15354
  };
15181
- const CategorySelectDrawerWithTrigger = ({
15182
- value,
15183
- onChange,
15184
- showTooltips
15185
- }) => {
15355
+ const CategorySelectDrawerWithTrigger = ({ value, onChange, showTooltips }) => {
15186
15356
  var _a;
15187
15357
  const [isDrawerOpen, setIsDrawerOpen] = useState(false);
15188
- return /* @__PURE__ */ jsxs(Fragment, { children: [
15358
+ return /* @__PURE__ */ jsxs(HStack, { fluid: true, children: [
15189
15359
  /* @__PURE__ */ jsxs(
15190
- "button",
15360
+ Button,
15191
15361
  {
15362
+ flex: true,
15363
+ fullWidth: true,
15192
15364
  "aria-label": "Select category",
15193
- className: classNames(
15194
- "Layer__category-menu__drawer-btn",
15195
- value && "Layer__category-menu__drawer-btn--selected"
15196
- ),
15197
15365
  onClick: () => {
15198
15366
  setIsDrawerOpen(true);
15199
15367
  },
15368
+ variant: "outlined",
15200
15369
  children: [
15201
- (_a = value == null ? void 0 : value.label) != null ? _a : "Select...",
15202
- /* @__PURE__ */ jsx(
15203
- ChevronDown,
15204
- {
15205
- size: 16,
15206
- className: "Layer__category-menu__drawer-btn__arrow"
15207
- }
15208
- )
15370
+ /* @__PURE__ */ jsx(Span, { children: (_a = value == null ? void 0 : value.label) != null ? _a : "Select..." }),
15371
+ /* @__PURE__ */ jsx(Spacer, {}),
15372
+ /* @__PURE__ */ jsx(ChevronDown, { size: 16 })
15209
15373
  ]
15210
15374
  }
15211
15375
  ),
@@ -15221,7 +15385,7 @@ const CategorySelectDrawerWithTrigger = ({
15221
15385
  )
15222
15386
  ] });
15223
15387
  };
15224
- const SplitForm = ({
15388
+ const BankTransactionsMobileListSplitForm = ({
15225
15389
  bankTransaction,
15226
15390
  showTooltips,
15227
15391
  showCategorization,
@@ -15250,84 +15414,90 @@ const SplitForm = ({
15250
15414
  bankTransaction,
15251
15415
  selectedCategory
15252
15416
  });
15417
+ const effectiveSplits = showCategorization ? localSplits : [];
15418
+ const addSplitButtonText = effectiveSplits.length > 1 ? "Add new split" : "Split";
15253
15419
  useEffect(() => {
15254
15420
  if (bankTransaction.error) {
15255
15421
  setShowRetry(true);
15256
15422
  }
15257
15423
  }, [bankTransaction.error]);
15258
- const save = () => __async(null, null, function* () {
15424
+ const save = () => {
15259
15425
  if (!isValid2) return;
15260
15426
  const categorizationRequest = buildCategorizeBankTransactionPayloadForSplit(localSplits);
15261
- yield categorizeBankTransaction2(
15427
+ void categorizeBankTransaction2(
15262
15428
  bankTransaction.id,
15263
15429
  categorizationRequest
15264
15430
  );
15265
15431
  deselect(bankTransaction.id);
15266
15432
  close();
15267
- });
15268
- return /* @__PURE__ */ jsxs("div", { children: [
15269
- showCategorization ? /* @__PURE__ */ jsxs(Fragment, { children: [
15433
+ };
15434
+ const handleCategoryChange = useCallback((index) => (value) => {
15435
+ changeCategoryForSplitAtIndex(index, value);
15436
+ }, [changeCategoryForSplitAtIndex]);
15437
+ return /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
15438
+ showCategorization && /* @__PURE__ */ jsxs(VStack, { gap: "sm", children: [
15270
15439
  /* @__PURE__ */ jsx(Text, { weight: TextWeight.bold, size: TextSize.sm, children: "Split transaction" }),
15271
- /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transactions__table-cell__header", children: [
15272
- /* @__PURE__ */ jsx(Text, { size: TextSize.sm, children: "Category" }),
15273
- /* @__PURE__ */ jsx(Text, { size: TextSize.sm, children: "Amount" })
15274
- ] }),
15275
- /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transactions__splits-inputs", children: [
15276
- localSplits.map((split, index) => /* @__PURE__ */ jsxs(
15277
- "div",
15278
- {
15279
- className: "Layer__bank-transactions__table-cell--split-entry",
15280
- children: [
15281
- /* @__PURE__ */ jsx("div", { className: "Layer__bank-transactions__table-cell--split-entry__right-col", children: /* @__PURE__ */ jsx(
15282
- CategorySelectDrawerWithTrigger,
15283
- {
15284
- value: split.category,
15285
- onChange: (value) => changeCategoryForSplitAtIndex(index, value),
15286
- showTooltips
15287
- }
15288
- ) }),
15289
- /* @__PURE__ */ jsx(
15290
- AmountInput,
15291
- {
15292
- name: `split-${index}`,
15293
- disabled: index === 0 || !showCategorization,
15294
- onChange: updateSplitAmount(index),
15295
- value: getInputValueForSplitAtIndex(index, split),
15296
- onBlur: onBlurSplitAmount,
15297
- isInvalid: split.amount < 0
15298
- }
15299
- ),
15300
- index > 0 && /* @__PURE__ */ jsx(
15301
- Button$1,
15302
- {
15303
- className: "Layer__bank-transactions__table-cell--split-entry__merge-btn",
15304
- onClick: () => removeSplit(index),
15305
- rightIcon: /* @__PURE__ */ jsx(Trash, { size: 16 }),
15306
- variant: ButtonVariant.secondary,
15307
- iconOnly: true
15308
- }
15309
- )
15310
- ]
15311
- },
15312
- `split-${index}`
15313
- )),
15314
- /* @__PURE__ */ jsx(
15315
- TextButton,
15316
- {
15317
- onClick: addSplit,
15318
- disabled: isLoading,
15319
- className: "Layer__add-new-split",
15320
- children: "Add new split"
15321
- }
15322
- )
15323
- ] }),
15440
+ /* @__PURE__ */ jsx(VStack, { gap: "sm", children: localSplits.map((split, index) => /* @__PURE__ */ jsxs(
15441
+ HStack,
15442
+ {
15443
+ gap: "xs",
15444
+ align: "center",
15445
+ justify: "space-between",
15446
+ children: [
15447
+ /* @__PURE__ */ jsx(
15448
+ CategorySelectDrawerWithTrigger,
15449
+ {
15450
+ value: split.category,
15451
+ onChange: handleCategoryChange(index),
15452
+ showTooltips
15453
+ }
15454
+ ),
15455
+ /* @__PURE__ */ jsx(
15456
+ AmountInput,
15457
+ {
15458
+ name: `split-${index}`,
15459
+ disabled: index === 0 || !showCategorization,
15460
+ onChange: updateSplitAmount(index),
15461
+ value: getInputValueForSplitAtIndex(index, split),
15462
+ onBlur: onBlurSplitAmount,
15463
+ isInvalid: split.amount < 0,
15464
+ className: "Layer__BankTransactionsMobileSplitForm__AmountInput"
15465
+ }
15466
+ ),
15467
+ /* @__PURE__ */ jsx(
15468
+ Button,
15469
+ {
15470
+ onClick: () => removeSplit(index),
15471
+ variant: "outlined",
15472
+ icon: true,
15473
+ isDisabled: index == 0,
15474
+ children: /* @__PURE__ */ jsx(Trash, { size: 16 })
15475
+ }
15476
+ )
15477
+ ]
15478
+ },
15479
+ `split-${index}`
15480
+ )) }),
15481
+ /* @__PURE__ */ jsx(HStack, { justify: "end", children: /* @__PURE__ */ jsxs(
15482
+ Button,
15483
+ {
15484
+ onClick: addSplit,
15485
+ variant: "outlined",
15486
+ children: [
15487
+ /* @__PURE__ */ jsx(Scissors, { size: 14 }),
15488
+ addSplitButtonText
15489
+ ]
15490
+ }
15491
+ ) }),
15324
15492
  splitFormError && /* @__PURE__ */ jsx(HStack, { pbe: "sm", children: /* @__PURE__ */ jsx(ErrorText, { children: splitFormError }) })
15325
- ] }) : null,
15493
+ ] }),
15326
15494
  /* @__PURE__ */ jsx(
15327
15495
  BankTransactionFormFields,
15328
15496
  {
15329
15497
  bankTransaction,
15330
- showDescriptions
15498
+ showDescriptions,
15499
+ hideCustomerVendor: true,
15500
+ hideTags: true
15331
15501
  }
15332
15502
  ),
15333
15503
  /* @__PURE__ */ jsx(
@@ -15348,7 +15518,7 @@ const SplitForm = ({
15348
15518
  )
15349
15519
  }
15350
15520
  ),
15351
- /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__actions", children: [
15521
+ /* @__PURE__ */ jsxs(HStack, { gap: "md", children: [
15352
15522
  showReceiptUploads && /* @__PURE__ */ jsx(
15353
15523
  FileInput,
15354
15524
  {
@@ -15362,19 +15532,19 @@ const SplitForm = ({
15362
15532
  }
15363
15533
  ),
15364
15534
  showCategorization && /* @__PURE__ */ jsx(
15365
- Button$1,
15535
+ Button,
15366
15536
  {
15367
15537
  fullWidth: true,
15368
- onClick: () => void save(),
15369
- disabled: isLoading || bankTransaction.processing,
15370
- children: isLoading || bankTransaction.processing ? "Saving..." : "Save"
15538
+ onClick: save,
15539
+ isDisabled: isLoading || bankTransaction.processing || !isValid2,
15540
+ children: bankTransaction.processing || isLoading ? "Confirming..." : "Confirm"
15371
15541
  }
15372
15542
  )
15373
15543
  ] }),
15374
- bankTransaction.error && showRetry ? /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
15544
+ bankTransaction.error && showRetry && /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." })
15375
15545
  ] });
15376
15546
  };
15377
- const SplitAndMatchForm = ({
15547
+ const BankTransactionsMobileListSplitAndMatchForm = ({
15378
15548
  bankTransaction,
15379
15549
  showTooltips,
15380
15550
  showReceiptUploads,
@@ -15386,9 +15556,9 @@ const SplitAndMatchForm = ({
15386
15556
  bankTransaction.category ? "categorize" : anyMatch ? "match" : "categorize"
15387
15557
  /* categorize */
15388
15558
  );
15389
- return /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transaction-mobile-list-item__split-and-match-form", children: [
15559
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
15390
15560
  formType === "categorize" && /* @__PURE__ */ jsx(
15391
- SplitForm,
15561
+ BankTransactionsMobileListSplitForm,
15392
15562
  {
15393
15563
  bankTransaction,
15394
15564
  showTooltips,
@@ -15398,7 +15568,7 @@ const SplitAndMatchForm = ({
15398
15568
  }
15399
15569
  ),
15400
15570
  formType === "match" && /* @__PURE__ */ jsx(
15401
- MatchForm,
15571
+ BankTransactionsMobileListMatchForm,
15402
15572
  {
15403
15573
  bankTransaction,
15404
15574
  showReceiptUploads,
@@ -15406,17 +15576,16 @@ const SplitAndMatchForm = ({
15406
15576
  showCategorization
15407
15577
  }
15408
15578
  ),
15409
- showCategorization && anyMatch && formType === "match" ? /* @__PURE__ */ jsx("div", { className: "Layer__bank-transaction-mobile-list-item__switch-form-btns", children: /* @__PURE__ */ jsx(TextButton, { onClick: () => setFormType(
15579
+ showCategorization && anyMatch && (formType === "match" ? /* @__PURE__ */ jsx(TextButton, { onClick: () => setFormType(
15410
15580
  "categorize"
15411
15581
  /* categorize */
15412
- ), children: "or split transaction" }) }) : null,
15413
- showCategorization && anyMatch && formType === "categorize" ? /* @__PURE__ */ jsx("div", { className: "Layer__bank-transaction-mobile-list-item__switch-form-btns", children: /* @__PURE__ */ jsx(TextButton, { onClick: () => setFormType(
15582
+ ), children: "or split transaction" }) : /* @__PURE__ */ jsx(TextButton, { onClick: () => setFormType(
15414
15583
  "match"
15415
15584
  /* match */
15416
- ), children: "or find match" }) }) : null
15585
+ ), children: "or find match" }))
15417
15586
  ] });
15418
15587
  };
15419
- const BankTransactionMobileForms = ({
15588
+ const BankTransactionsMobileForms = ({
15420
15589
  purpose,
15421
15590
  bankTransaction,
15422
15591
  showTooltips,
@@ -15429,7 +15598,7 @@ const BankTransactionMobileForms = ({
15429
15598
  switch (purpose) {
15430
15599
  case Purpose.business:
15431
15600
  return /* @__PURE__ */ jsx(
15432
- BusinessForm$1,
15601
+ BankTransactionsMobileListBusinessForm,
15433
15602
  {
15434
15603
  bankTransaction,
15435
15604
  showCategorization,
@@ -15440,7 +15609,7 @@ const BankTransactionMobileForms = ({
15440
15609
  );
15441
15610
  case Purpose.personal:
15442
15611
  return /* @__PURE__ */ jsx(
15443
- PersonalForm,
15612
+ BankTransactionsMobileListPersonalForm,
15444
15613
  {
15445
15614
  bankTransaction,
15446
15615
  showReceiptUploads,
@@ -15450,7 +15619,7 @@ const BankTransactionMobileForms = ({
15450
15619
  );
15451
15620
  case Purpose.more:
15452
15621
  return /* @__PURE__ */ jsx(
15453
- SplitAndMatchForm,
15622
+ BankTransactionsMobileListSplitAndMatchForm,
15454
15623
  {
15455
15624
  bankTransaction,
15456
15625
  showCategorization,
@@ -15463,75 +15632,69 @@ const BankTransactionMobileForms = ({
15463
15632
  return null;
15464
15633
  }
15465
15634
  };
15466
- return /* @__PURE__ */ jsx(ReceiptsProvider, { bankTransaction, isActive: isOpen, children: /* @__PURE__ */ jsx("div", { className: "Layer__bank-transaction-mobile-list-item__form-container", children: getContent() }) });
15635
+ return /* @__PURE__ */ jsx(ReceiptsProvider, { bankTransaction, isActive: isOpen, children: getContent() });
15467
15636
  };
15468
- const useTransactionToOpen = () => {
15469
- const [transactionIdToOpen, setTransactionIdToOpen] = useState(void 0);
15470
- const clearTransactionIdToOpen = useCallback(() => setTransactionIdToOpen(void 0), []);
15471
- return {
15472
- transactionIdToOpen,
15473
- setTransactionIdToOpen,
15474
- clearTransactionIdToOpen
15475
- };
15476
- };
15477
- const TransactionToOpenContext = createContext({
15478
- transactionIdToOpen: void 0,
15479
- setTransactionIdToOpen: () => void 0,
15480
- clearTransactionIdToOpen: () => void 0
15481
- });
15482
- const BankTransactionsMobileListItemCheckbox = ({
15483
- bulkActionsEnabled,
15637
+ const PURPOSE_TOGGLE_OPTIONS = [
15638
+ {
15639
+ value: "business",
15640
+ label: "Business",
15641
+ style: { minWidth: 84 }
15642
+ },
15643
+ {
15644
+ value: "personal",
15645
+ label: "Personal",
15646
+ style: { minWidth: 84 }
15647
+ },
15648
+ {
15649
+ value: "more",
15650
+ label: "More",
15651
+ style: { minWidth: 84 }
15652
+ }
15653
+ ];
15654
+ const BankTransactionsMobileListItemExpandedRow = ({
15484
15655
  bankTransaction,
15485
- checkboxContainerRef
15656
+ showCategorization,
15657
+ showDescriptions,
15658
+ showReceiptUploads,
15659
+ showTooltips
15486
15660
  }) => {
15487
- const internalRef = useRef(null);
15488
- const ref = checkboxContainerRef || internalRef;
15489
- const bookkeepingStatus = useEffectiveBookkeepingStatus();
15490
- const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
15491
- const { select, deselect } = useBulkSelectionActions();
15492
- const isSelected = useIdIsSelected();
15493
- const isTransactionSelected = isSelected(bankTransaction.id);
15494
- if (!categorizationEnabled || !bulkActionsEnabled) {
15495
- return null;
15496
- }
15497
- return /* @__PURE__ */ jsx(VStack, { align: "start", pis: "md", pie: "2xs", ref, children: /* @__PURE__ */ jsx(
15498
- Checkbox,
15499
- {
15500
- size: "md",
15501
- isSelected: isTransactionSelected,
15502
- onChange: (selected) => {
15503
- if (selected) {
15504
- select(bankTransaction.id);
15505
- } else {
15506
- deselect(bankTransaction.id);
15507
- }
15661
+ const [purpose, setPurpose] = useState(getInitialPurpose(bankTransaction));
15662
+ const onChangePurpose = (event) => setPurpose(event.target.value);
15663
+ return /* @__PURE__ */ jsxs(VStack, { pi: "md", gap: "md", pbe: "md", children: [
15664
+ showCategorization && /* @__PURE__ */ jsx(
15665
+ Toggle,
15666
+ {
15667
+ name: `purpose-${bankTransaction.id}`,
15668
+ size: ToggleSize.medium,
15669
+ options: PURPOSE_TOGGLE_OPTIONS,
15670
+ selected: purpose,
15671
+ onChange: onChangePurpose
15508
15672
  }
15509
- }
15510
- ) });
15511
- };
15512
- const BankTransactionsMobileListItemCategory = ({
15513
- bankTransaction
15514
- }) => {
15515
- const categorized = isCategorized(bankTransaction);
15516
- const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
15517
- if (categorized) {
15518
- return /* @__PURE__ */ jsx(
15519
- BankTransactionsCategorizedSelectedValue,
15673
+ ),
15674
+ /* @__PURE__ */ jsx(
15675
+ BankTransactionsMobileForms,
15520
15676
  {
15677
+ purpose,
15521
15678
  bankTransaction,
15522
- className: "Layer__bankTransactionsMobileListItemCategory",
15523
- slotProps: { Label: { size: "sm" } }
15679
+ showCategorization,
15680
+ showDescriptions,
15681
+ showReceiptUploads,
15682
+ showTooltips
15524
15683
  }
15525
- );
15526
- }
15527
- return selectedCategory ? /* @__PURE__ */ jsx(
15528
- BankTransactionsUncategorizedSelectedValue,
15529
- {
15530
- selectedValue: selectedCategory != null ? selectedCategory : null,
15531
- className: "Layer__bankTransactionsMobileListItemCategory",
15532
- slotProps: { Label: { size: "sm" } }
15684
+ )
15685
+ ] });
15686
+ };
15687
+ const getInitialPurpose = (bankTransaction) => {
15688
+ if (bankTransaction.category) {
15689
+ if (bankTransaction.category.type === "Exclusion") {
15690
+ return Purpose.personal;
15533
15691
  }
15534
- ) : /* @__PURE__ */ jsx(Span, { ellipsis: true, className: "Layer__bankTransactionsMobileListItemCategory", size: "sm", children: "No category selected" });
15692
+ if (bankTransaction.categorization_status === CategorizationStatus.SPLIT) {
15693
+ return Purpose.more;
15694
+ }
15695
+ return Purpose.business;
15696
+ }
15697
+ return hasMatch(bankTransaction) ? Purpose.more : Purpose.business;
15535
15698
  };
15536
15699
  var Purpose = /* @__PURE__ */ ((Purpose2) => {
15537
15700
  Purpose2["business"] = "business";
@@ -15539,7 +15702,6 @@ var Purpose = /* @__PURE__ */ ((Purpose2) => {
15539
15702
  Purpose2["more"] = "more";
15540
15703
  return Purpose2;
15541
15704
  })(Purpose || {});
15542
- const DATE_FORMAT = "LLL d";
15543
15705
  const getAssignedValue = (bankTransaction, renderInAppLink) => {
15544
15706
  var _a, _b, _c, _d;
15545
15707
  if (bankTransaction.categorization_status === CategorizationStatus.SPLIT) {
@@ -15575,21 +15737,8 @@ const BankTransactionsMobileListItem = ({
15575
15737
  } = useContext(TransactionToOpenContext);
15576
15738
  const { shouldHideAfterCategorize } = useBankTransactionsContext();
15577
15739
  const categorized = isCategorized(bankTransaction);
15578
- const formRowRef = useElementSize(
15579
- (_a2, _b2, { height: height2 }) => setHeight(height2)
15580
- );
15581
- const headingRowRef = useElementSize((_a2, _b2, { height: height2 }) => {
15582
- setHeadingHeight(height2);
15583
- });
15584
15740
  const itemRef = useRef(null);
15585
- const [removeAnim, setRemoveAnim] = useState(false);
15586
- const [purpose, setPurpose] = useState(
15587
- bankTransaction.category ? bankTransaction.category.type === "Exclusion" ? "personal" : bankTransaction.categorization_status === CategorizationStatus.SPLIT ? "more" : "business" : hasMatch(bankTransaction) ? "more" : "business"
15588
- /* business */
15589
- );
15590
15741
  const [open, setOpen] = useState(isFirstItem);
15591
- const [height, setHeight] = useState(0);
15592
- const [headingHeight, setHeadingHeight] = useState(63);
15593
15742
  const openNext = () => {
15594
15743
  if (editable && itemRef.current && itemRef.current.nextSibling) {
15595
15744
  const txId = itemRef.current.nextSibling.getAttribute(
@@ -15619,10 +15768,12 @@ const BankTransactionsMobileListItem = ({
15619
15768
  }
15620
15769
  }, [bankTransaction.id, clearTransactionIdToOpen, transactionIdToOpen]);
15621
15770
  useEffect(() => {
15622
- if (!removeAnim && bankTransaction.recently_categorized) {
15771
+ if (bankTransaction.recently_categorized) {
15623
15772
  if (editable && shouldHideAfterCategorize()) {
15624
- setRemoveAnim(true);
15625
- openNext();
15773
+ setTimeout(() => {
15774
+ removeTransaction(bankTransaction);
15775
+ openNext();
15776
+ }, 300);
15626
15777
  } else {
15627
15778
  close2();
15628
15779
  }
@@ -15633,14 +15784,10 @@ const BankTransactionsMobileListItem = ({
15633
15784
  bankTransaction.match
15634
15785
  ]);
15635
15786
  const toggleOpen = () => {
15636
- if (open) {
15637
- setHeight(0);
15638
- }
15639
15787
  setOpen(!open);
15640
15788
  };
15641
15789
  const close2 = () => {
15642
15790
  setOpen(false);
15643
- setHeight(0);
15644
15791
  };
15645
15792
  const checkboxContainerRef = useRef(null);
15646
15793
  const handleRowClick = (event) => {
@@ -15665,7 +15812,11 @@ const BankTransactionsMobileListItem = ({
15665
15812
  }, 300);
15666
15813
  }
15667
15814
  }, [bankTransaction.recently_categorized]);
15668
- const onChangePurpose = (event) => setPurpose(event.target.value);
15815
+ useEffect(() => {
15816
+ if (bulkActionsEnabled) {
15817
+ close2();
15818
+ }
15819
+ }, [bulkActionsEnabled]);
15669
15820
  const bookkeepingStatus = useEffectiveBookkeepingStatus();
15670
15821
  const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
15671
15822
  const { select, deselect } = useBulkSelectionActions();
@@ -15677,169 +15828,96 @@ const BankTransactionsMobileListItem = ({
15677
15828
  const openClassName = open ? `${className}--expanded` : "";
15678
15829
  const rowClassName = classNames(
15679
15830
  className,
15680
- removeAnim ? "Layer__bank-transaction-row--removing" : "",
15681
15831
  open ? openClassName : "",
15682
15832
  isVisible ? "show" : ""
15683
15833
  );
15684
- return /* @__PURE__ */ jsxs("li", { ref: itemRef, className: rowClassName, "data-item": bankTransaction.id, children: [
15685
- /* @__PURE__ */ jsx(
15834
+ return /* @__PURE__ */ jsx("li", { ref: itemRef, className: rowClassName, "data-item": bankTransaction.id, children: /* @__PURE__ */ jsxs(VStack, { children: [
15835
+ /* @__PURE__ */ jsxs(
15686
15836
  "div",
15687
15837
  {
15688
15838
  onClick: handleRowClick,
15689
15839
  role: "button",
15690
- style: {
15691
- height: headingHeight
15692
- },
15693
- children: /* @__PURE__ */ jsxs(
15694
- VStack,
15695
- {
15696
- ref: headingRowRef,
15697
- children: [
15698
- /* @__PURE__ */ jsxs(
15699
- HStack,
15700
- {
15701
- gap: "md",
15702
- justify: "space-between",
15703
- align: "center",
15704
- pie: "md",
15705
- children: [
15706
- /* @__PURE__ */ jsxs(HStack, { align: "center", children: [
15707
- /* @__PURE__ */ jsx(
15708
- BankTransactionsMobileListItemCheckbox,
15709
- {
15710
- bulkActionsEnabled,
15711
- bankTransaction,
15712
- checkboxContainerRef
15713
- }
15714
- ),
15715
- /* @__PURE__ */ jsxs(
15716
- VStack,
15717
- {
15718
- align: "start",
15719
- gap: "3xs",
15720
- className: "Layer__bankTransactionsMobileListItem__headingContentLeft",
15721
- pi: "md",
15722
- pb: "sm",
15723
- children: [
15724
- /* @__PURE__ */ jsx(Span, { ellipsis: true, children: (_b = bankTransaction.counterparty_name) != null ? _b : bankTransaction.description }),
15725
- /* @__PURE__ */ jsx(Span, { className: "Layer__bankTransactionsMobileListItem__categorizedValue", children: categorized && bankTransaction.categorization_status ? getAssignedValue(bankTransaction, renderInAppLink) : null }),
15726
- /* @__PURE__ */ jsxs(HStack, { gap: "2xs", align: "center", children: [
15727
- /* @__PURE__ */ jsx(Span, { size: "sm", ellipsis: true, children: fullAccountName }),
15728
- hasReceipts(bankTransaction) ? /* @__PURE__ */ jsx(File, { size: 12 }) : null
15729
- ] }),
15730
- !categorizationEnabled && !categorized ? /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) : null
15731
- ]
15732
- }
15733
- )
15734
- ] }),
15735
- /* @__PURE__ */ jsxs(
15736
- VStack,
15737
- {
15738
- align: "end",
15739
- gap: "3xs",
15740
- pb: "sm",
15741
- children: [
15742
- /* @__PURE__ */ jsxs(HStack, { children: [
15743
- /* @__PURE__ */ jsx(Span, { size: "md", children: isCredit(bankTransaction) ? "+" : "" }),
15744
- /* @__PURE__ */ jsx(
15745
- MoneySpan,
15746
- {
15747
- amount: bankTransaction.amount
15748
- }
15749
- )
15750
- ] }),
15751
- /* @__PURE__ */ jsx(
15752
- DateTime,
15753
- {
15754
- value: bankTransaction.date,
15755
- dateFormat: DATE_FORMAT,
15756
- onlyDate: true,
15757
- slotProps: {
15758
- Date: { size: "sm", variant: "subtle" }
15759
- }
15760
- }
15761
- )
15762
- ]
15763
- }
15764
- )
15765
- ]
15766
- }
15767
- ),
15768
- /* @__PURE__ */ jsx(
15769
- BankTransactionsMobileListItemCategory,
15770
- {
15771
- bankTransaction
15772
- }
15773
- )
15774
- ]
15775
- }
15776
- )
15777
- }
15778
- ),
15779
- /* @__PURE__ */ jsx(
15780
- "div",
15781
- {
15782
- className: `${className}__expanded-row`,
15783
- style: { height: !open || removeAnim ? 0 : height },
15784
- children: open && /* @__PURE__ */ jsxs(
15785
- "div",
15786
- {
15787
- className: `${className}__expanded-row__content`,
15788
- ref: formRowRef,
15789
- children: [
15790
- categorizationEnabled ? /* @__PURE__ */ jsxs("div", { className: `${className}__toggle-row`, children: [
15840
+ children: [
15841
+ /* @__PURE__ */ jsxs(
15842
+ HStack,
15843
+ {
15844
+ gap: "md",
15845
+ justify: "space-between",
15846
+ align: "center",
15847
+ pie: "md",
15848
+ children: [
15849
+ /* @__PURE__ */ jsxs(HStack, { align: "center", children: [
15850
+ /* @__PURE__ */ jsx(
15851
+ BankTransactionsMobileListItemCheckbox,
15852
+ {
15853
+ bulkActionsEnabled,
15854
+ bankTransaction,
15855
+ checkboxContainerRef
15856
+ }
15857
+ ),
15858
+ /* @__PURE__ */ jsxs(
15859
+ VStack,
15860
+ {
15861
+ align: "start",
15862
+ gap: "3xs",
15863
+ className: "Layer__bankTransactionsMobileListItem__headingContentLeft",
15864
+ pi: "md",
15865
+ pb: "sm",
15866
+ children: [
15867
+ /* @__PURE__ */ jsx(Span, { ellipsis: true, children: (_b = bankTransaction.counterparty_name) != null ? _b : bankTransaction.description }),
15868
+ /* @__PURE__ */ jsx(Span, { className: "Layer__bankTransactionsMobileListItem__categorizedValue", children: categorized && bankTransaction.categorization_status ? getAssignedValue(bankTransaction, renderInAppLink) : null }),
15869
+ /* @__PURE__ */ jsxs(HStack, { gap: "2xs", align: "center", children: [
15870
+ /* @__PURE__ */ jsx(Span, { size: "sm", ellipsis: true, children: fullAccountName }),
15871
+ hasReceipts(bankTransaction) ? /* @__PURE__ */ jsx(File, { size: 12 }) : null
15872
+ ] }),
15873
+ !categorizationEnabled && !categorized ? /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) : null
15874
+ ]
15875
+ }
15876
+ )
15877
+ ] }),
15791
15878
  /* @__PURE__ */ jsx(
15792
- Toggle,
15879
+ BankTransactionsAmountDate,
15793
15880
  {
15794
- name: `purpose-${bankTransaction.id}`,
15795
- size: ToggleSize.xsmall,
15796
- options: [
15797
- {
15798
- value: "business",
15799
- label: "Business",
15800
- style: { minWidth: 84 }
15801
- },
15802
- {
15803
- value: "personal",
15804
- label: "Personal",
15805
- style: { minWidth: 84 }
15806
- },
15807
- {
15808
- value: "more",
15809
- label: "More",
15810
- style: { minWidth: 84 }
15881
+ amount: bankTransaction.amount,
15882
+ date: bankTransaction.date,
15883
+ slotProps: {
15884
+ MoneySpan: {
15885
+ size: "md",
15886
+ displayPlusSign: isCredit(bankTransaction)
15811
15887
  }
15812
- ],
15813
- selected: purpose,
15814
- onChange: onChangePurpose
15888
+ }
15815
15889
  }
15816
- ),
15817
- /* @__PURE__ */ jsx(CloseButton, { onClick: () => close2() })
15818
- ] }) : null,
15819
- /* @__PURE__ */ jsx(
15820
- BankTransactionMobileForms,
15821
- {
15822
- isOpen: open,
15823
- purpose,
15824
- bankTransaction,
15825
- showCategorization: categorizationEnabled,
15826
- showDescriptions,
15827
- showReceiptUploads,
15828
- showTooltips
15829
- }
15830
- )
15831
- ]
15832
- }
15833
- )
15890
+ )
15891
+ ]
15892
+ }
15893
+ ),
15894
+ !open && /* @__PURE__ */ jsx(
15895
+ BankTransactionsListItemCategory,
15896
+ {
15897
+ bankTransaction,
15898
+ mobile: true
15899
+ }
15900
+ )
15901
+ ]
15834
15902
  }
15835
- )
15836
- ] });
15903
+ ),
15904
+ /* @__PURE__ */ jsx(AnimatedContent, { variant: "expand", isOpen: open, children: /* @__PURE__ */ jsx(
15905
+ BankTransactionsMobileListItemExpandedRow,
15906
+ {
15907
+ bankTransaction,
15908
+ showCategorization: categorizationEnabled,
15909
+ showDescriptions,
15910
+ showReceiptUploads,
15911
+ showTooltips
15912
+ }
15913
+ ) }, `expanded-${bankTransaction.id}`)
15914
+ ] }) });
15837
15915
  };
15838
15916
  const SWITCH_CLASS_NAME = "Layer__Switch";
15839
- const Switch = forwardRef((_Ob, ref) => {
15840
- var _Pb = _Ob, {
15917
+ const Switch = forwardRef((_Mb, ref) => {
15918
+ var _Nb = _Mb, {
15841
15919
  children
15842
- } = _Pb, props = __objRest(_Pb, [
15920
+ } = _Nb, props = __objRest(_Nb, [
15843
15921
  "children"
15844
15922
  ]);
15845
15923
  return /* @__PURE__ */ jsx(
@@ -16215,8 +16293,8 @@ const usePaginationRange = ({
16215
16293
  }, [totalCount, pageSize, siblingCount, currentPage]);
16216
16294
  return paginationRange;
16217
16295
  };
16218
- const PaginationButton = (_Qb) => {
16219
- var _Rb = _Qb, { children, isSelected } = _Rb, buttonProps = __objRest(_Rb, ["children", "isSelected"]);
16296
+ const PaginationButton = (_Ob) => {
16297
+ var _Pb = _Ob, { children, isSelected } = _Pb, buttonProps = __objRest(_Pb, ["children", "isSelected"]);
16220
16298
  return /* @__PURE__ */ jsx(
16221
16299
  Button,
16222
16300
  __spreadProps(__spreadValues({
@@ -16763,8 +16841,8 @@ function BaseFormTextField({
16763
16841
  }
16764
16842
  const INPUT_CLASS_NAME = "Layer__UI__Input";
16765
16843
  const Input = forwardRef(
16766
- function Input2(_Sb, ref) {
16767
- var _Tb = _Sb, { inset, placement } = _Tb, restProps = __objRest(_Tb, ["inset", "placement"]);
16844
+ function Input2(_Qb, ref) {
16845
+ var _Rb = _Qb, { inset, placement } = _Rb, restProps = __objRest(_Rb, ["inset", "placement"]);
16768
16846
  const dataProperties = toDataProperties({ inset, placement });
16769
16847
  return /* @__PURE__ */ jsx(
16770
16848
  Input$2,
@@ -16860,15 +16938,15 @@ const withForceUpdate = (value) => {
16860
16938
  writable: false
16861
16939
  });
16862
16940
  };
16863
- function FormBigDecimalField(_Ub) {
16864
- var _Vb = _Ub, {
16941
+ function FormBigDecimalField(_Sb) {
16942
+ var _Tb = _Sb, {
16865
16943
  mode = "decimal",
16866
16944
  allowNegative = false,
16867
16945
  maxValue = mode === "percent" ? BIG_DECIMAL_ONE : DEFAULT_MAX_VALUE,
16868
16946
  minDecimalPlaces = mode === "currency" ? 2 : DEFAULT_MIN_DECIMAL_PLACES,
16869
16947
  maxDecimalPlaces = mode === "currency" ? 2 : DEFAULT_MAX_DECIMAL_PLACES,
16870
16948
  slots
16871
- } = _Vb, restProps = __objRest(_Vb, [
16949
+ } = _Tb, restProps = __objRest(_Tb, [
16872
16950
  "mode",
16873
16951
  "allowNegative",
16874
16952
  "maxValue",
@@ -17033,8 +17111,8 @@ function FormDateField({
17033
17111
  }
17034
17112
  const TEXTAREA_CLASS_NAME = "Layer__UI__TextArea";
17035
17113
  const TextArea = forwardRef(
17036
- function TextArea2(_Wb, ref) {
17037
- var _Xb = _Wb, { resize = "none" } = _Xb, restProps = __objRest(_Xb, ["resize"]);
17114
+ function TextArea2(_Ub, ref) {
17115
+ var _Vb = _Ub, { resize = "none" } = _Vb, restProps = __objRest(_Vb, ["resize"]);
17038
17116
  const dataProperties = toDataProperties({ resize });
17039
17117
  return /* @__PURE__ */ jsx(
17040
17118
  TextArea$1,
@@ -17316,6 +17394,40 @@ const CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
17316
17394
  }
17317
17395
  );
17318
17396
  };
17397
+ const CloseIcon = (_Wb) => {
17398
+ var _Xb = _Wb, { size = 12 } = _Xb, props = __objRest(_Xb, ["size"]);
17399
+ return /* @__PURE__ */ jsxs(
17400
+ "svg",
17401
+ __spreadProps(__spreadValues({
17402
+ viewBox: "0 0 12 12",
17403
+ fill: "none",
17404
+ xmlns: "http://www.w3.org/2000/svg"
17405
+ }, props), {
17406
+ width: size,
17407
+ height: size,
17408
+ children: [
17409
+ /* @__PURE__ */ jsx(
17410
+ "path",
17411
+ {
17412
+ d: "M8.75 3.25L3.25 8.75",
17413
+ stroke: "currentColor",
17414
+ strokeLinecap: "round",
17415
+ strokeLinejoin: "round"
17416
+ }
17417
+ ),
17418
+ /* @__PURE__ */ jsx(
17419
+ "path",
17420
+ {
17421
+ d: "M3.25 3.25L8.75 8.75",
17422
+ stroke: "currentColor",
17423
+ strokeLinecap: "round",
17424
+ strokeLinejoin: "round"
17425
+ }
17426
+ )
17427
+ ]
17428
+ })
17429
+ );
17430
+ };
17319
17431
  const VALID_EXTENSIONS = [".csv"];
17320
17432
  const VALID_FILE_TYPES = ["text/csv", "text/plain", "application/vnd.ms-excel"];
17321
17433
  const MAX_FILE_SIZE = 2 * 1024 * 1024;
@@ -19595,6 +19707,7 @@ function useRejectCategorizationRulesUpdateSuggestion() {
19595
19707
  function RuleUpdatesPromptStep({ ruleSuggestion, close: close2 }) {
19596
19708
  const { next } = useWizard();
19597
19709
  const { addToast } = useLayerContext();
19710
+ const { isMobile } = useSizeClass();
19598
19711
  const [dontAskAgain, setDontAskAgain] = useState(false);
19599
19712
  const { trigger: rejectRuleSuggestion, isMutating } = useRejectCategorizationRulesUpdateSuggestion();
19600
19713
  const handleRejectRuleSuggestion = useCallback(() => {
@@ -19612,7 +19725,7 @@ function RuleUpdatesPromptStep({ ruleSuggestion, close: close2 }) {
19612
19725
  }
19613
19726
  }))();
19614
19727
  }, [addToast, close2, dontAskAgain, rejectRuleSuggestion, ruleSuggestion.newRule.createdBySuggestionId]);
19615
- return /* @__PURE__ */ jsxs(VStack, { gap: "3xl", children: [
19728
+ return /* @__PURE__ */ jsxs(VStack, { gap: isMobile ? "md" : "3xl", children: [
19616
19729
  /* @__PURE__ */ jsx(Span, { size: "md", children: ruleSuggestion.suggestionPrompt }),
19617
19730
  /* @__PURE__ */ jsxs(VStack, { gap: "sm", align: "end", children: [
19618
19731
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", justify: "end", align: "end", children: [
@@ -21092,12 +21205,12 @@ const collectRevenueItems = (data) => {
21092
21205
  }
21093
21206
  return revenueItems;
21094
21207
  };
21095
- const humanizeTitle = (sidebarView) => {
21208
+ const humanizeTitle = (sidebarView, overrides) => {
21096
21209
  switch (sidebarView) {
21097
21210
  case "expenses":
21098
- return "Expenses";
21211
+ return (overrides == null ? void 0 : overrides.expenseChartHeader) || "Expenses";
21099
21212
  case "revenue":
21100
- return "Revenue";
21213
+ return (overrides == null ? void 0 : overrides.revenueChartHeader) || "Revenue";
21101
21214
  default:
21102
21215
  return "Profit & Loss";
21103
21216
  }
@@ -21112,69 +21225,10 @@ const applyShare = (items, total) => {
21112
21225
  });
21113
21226
  });
21114
21227
  };
21115
- var ReportKey = /* @__PURE__ */ ((ReportKey2) => {
21116
- ReportKey2["ProfitAndLoss"] = "ProfitAndLoss";
21117
- ReportKey2["BalanceSheet"] = "BalanceSheet";
21118
- ReportKey2["StatementOfCashFlows"] = "StatementOfCashFlows";
21119
- return ReportKey2;
21120
- })(ReportKey || {});
21121
- const defaultModeByReport = {
21122
- [
21123
- "ProfitAndLoss"
21124
- /* ProfitAndLoss */
21125
- ]: "monthPicker",
21126
- // This one should never change, but is included for completeness
21127
- [
21128
- "BalanceSheet"
21129
- /* BalanceSheet */
21130
- ]: "dayPicker",
21131
- [
21132
- "StatementOfCashFlows"
21133
- /* StatementOfCashFlows */
21134
- ]: "monthPicker"
21135
- };
21136
- const ReportsModeStoreContext = createContext(
21137
- createStore(() => ({
21138
- resetPnLModeToDefaultOnMount: true,
21139
- modeByReport: {},
21140
- actions: {
21141
- setModeForReport: () => {
21142
- }
21143
- }
21144
- }))
21145
- );
21146
- function useReportMode(report) {
21147
- const store = useContext(ReportsModeStoreContext);
21148
- return useStore(store, (state) => state.modeByReport[report]);
21149
- }
21150
- function useReportModeWithFallback(report, fallback) {
21151
- const mode = useReportMode(report);
21152
- return mode != null ? mode : fallback;
21153
- }
21154
- function ReportsModeStoreProvider({
21155
- children,
21156
- initialModes,
21157
- resetPnLModeToDefaultOnMount = true
21158
- }) {
21159
- const [store] = useState(
21160
- () => createStore((set2) => ({
21161
- modeByReport: __spreadValues(__spreadValues({}, defaultModeByReport), initialModes),
21162
- resetPnLModeToDefaultOnMount,
21163
- actions: {
21164
- setModeForReport: (report, mode) => set2((state) => ({
21165
- modeByReport: __spreadProps(__spreadValues({}, state.modeByReport), {
21166
- [report]: mode
21167
- })
21168
- }))
21169
- }
21170
- }))
21171
- );
21172
- return /* @__PURE__ */ jsx(ReportsModeStoreContext.Provider, { value: store, children });
21173
- }
21174
21228
  const useProfitAndLoss = ({ tagFilter, reportingBasis }) => {
21175
21229
  var _a;
21176
- const rangeDisplayMode = useReportModeWithFallback(ReportKey.ProfitAndLoss, "monthPicker");
21177
- const dateRange = useGlobalDateRange({ displayMode: rangeDisplayMode });
21230
+ const [displayMode, setDisplayMode] = useState("month");
21231
+ const dateRange = useGlobalDateRange({ displayMode });
21178
21232
  const [filters, setFilters] = useState({
21179
21233
  expenses: void 0,
21180
21234
  revenue: void 0
@@ -21298,7 +21352,9 @@ const useProfitAndLoss = ({ tagFilter, reportingBasis }) => {
21298
21352
  tagFilter,
21299
21353
  dateRange,
21300
21354
  selectedLineItem,
21301
- setSelectedLineItem
21355
+ setSelectedLineItem,
21356
+ setDisplayMode,
21357
+ displayMode
21302
21358
  };
21303
21359
  };
21304
21360
  function range(start, end) {
@@ -21307,12 +21363,56 @@ function range(start, end) {
21307
21363
  function isArrayWithAtLeastOne(list) {
21308
21364
  return list.length > 0;
21309
21365
  }
21310
- function getArrayWithAtLeastOneOrFallback(list, fallback) {
21311
- if (list.length === 0) {
21312
- return fallback;
21366
+ var DateGroupBy = /* @__PURE__ */ ((DateGroupBy2) => {
21367
+ DateGroupBy2["AllTime"] = "AllTime";
21368
+ DateGroupBy2["Month"] = "Month";
21369
+ DateGroupBy2["Year"] = "Year";
21370
+ return DateGroupBy2;
21371
+ })(DateGroupBy || {});
21372
+ const DateGroupByOptionConfig = {
21373
+ [
21374
+ "AllTime"
21375
+ /* AllTime */
21376
+ ]: {
21377
+ label: "All time",
21378
+ value: "AllTime"
21379
+ /* AllTime */
21380
+ },
21381
+ [
21382
+ "Month"
21383
+ /* Month */
21384
+ ]: {
21385
+ label: "Compare by month",
21386
+ value: "Month"
21387
+ /* Month */
21388
+ },
21389
+ [
21390
+ "Year"
21391
+ /* Year */
21392
+ ]: {
21393
+ label: "Compare by year",
21394
+ value: "Year"
21395
+ /* Year */
21313
21396
  }
21314
- return list;
21315
- }
21397
+ };
21398
+ const options$3 = Object.values(DateGroupByOptionConfig);
21399
+ const DateGroupByComboBox = ({ value, onValueChange }) => {
21400
+ const selectedOption = value ? DateGroupByOptionConfig[value] : null;
21401
+ const onSelectedValueChange = useCallback((option) => {
21402
+ onValueChange((option == null ? void 0 : option.value) || null);
21403
+ }, [onValueChange]);
21404
+ return /* @__PURE__ */ jsx(
21405
+ ComboBox,
21406
+ {
21407
+ className: "Layer__DateGroupByComboBox",
21408
+ options: options$3,
21409
+ onSelectedValueChange,
21410
+ selectedValue: selectedOption,
21411
+ isSearchable: false,
21412
+ isClearable: false
21413
+ }
21414
+ );
21415
+ };
21316
21416
  function prepareFiltersBody(compareOptions) {
21317
21417
  const noneFilters = compareOptions.filter(
21318
21418
  ({ tagFilterConfig: { tagFilters: tagFilters2 } }) => tagFilters2 === "None"
@@ -21352,9 +21452,9 @@ function prepareFiltersBody(compareOptions) {
21352
21452
  return isArrayWithAtLeastOne(allFilters) ? allFilters : void 0;
21353
21453
  }
21354
21454
  function preparePeriodsBodyForMonths(dateRange, comparePeriods) {
21355
- const adjustedStartDate = startOfMonth(dateRange.startDate);
21455
+ const adjustedEndDate = startOfMonth(dateRange.endDate);
21356
21456
  const rawPeriods = range(0, comparePeriods).map((index) => {
21357
- const currentPeriod = subMonths(adjustedStartDate, index);
21457
+ const currentPeriod = subMonths(adjustedEndDate, index);
21358
21458
  return {
21359
21459
  year: getYear(currentPeriod),
21360
21460
  month: getMonth(currentPeriod) + 1
@@ -21375,9 +21475,9 @@ function preparePeriodsBodyForMonths(dateRange, comparePeriods) {
21375
21475
  };
21376
21476
  }
21377
21477
  function preparePeriodsBodyForYears(dateRange, comparePeriods) {
21378
- const adjustedStartDate = startOfYear(dateRange.startDate);
21478
+ const adjustedEndDate = startOfYear(dateRange.endDate);
21379
21479
  const rawPeriods = range(0, comparePeriods).map((index) => {
21380
- const currentPeriod = subYears(adjustedStartDate, index);
21480
+ const currentPeriod = subYears(adjustedEndDate, index);
21381
21481
  return {
21382
21482
  year: getYear(currentPeriod)
21383
21483
  };
@@ -21402,17 +21502,51 @@ function preparePeriodsBodyForDateRange(dateRange) {
21402
21502
  }]
21403
21503
  };
21404
21504
  }
21405
- function preparePeriodsBody(dateRange, comparePeriods, rangeDisplayMode) {
21406
- switch (rangeDisplayMode) {
21407
- case "yearPicker":
21505
+ function preparePeriodsBody(dateRange, comparePeriods, comparisonPeriodMode) {
21506
+ switch (comparisonPeriodMode) {
21507
+ case DateGroupBy.Year:
21408
21508
  return preparePeriodsBodyForYears(dateRange, comparePeriods);
21409
- case "monthPicker":
21509
+ case DateGroupBy.Month:
21410
21510
  return preparePeriodsBodyForMonths(dateRange, comparePeriods);
21511
+ case DateGroupBy.AllTime:
21411
21512
  default:
21412
21513
  return preparePeriodsBodyForDateRange(dateRange);
21413
21514
  }
21414
21515
  }
21415
- const COMPARE_MODES_SUPPORTING_MULTI_PERIOD = ["monthPicker", "yearPicker"];
21516
+ const ProfitAndLossContext = createContext({
21517
+ data: void 0,
21518
+ filteredDataRevenue: [],
21519
+ filteredTotalRevenue: void 0,
21520
+ filteredDataExpenses: [],
21521
+ filteredTotalExpenses: void 0,
21522
+ isLoading: true,
21523
+ isValidating: false,
21524
+ isError: false,
21525
+ dateRange: {
21526
+ startDate: startOfMonth(/* @__PURE__ */ new Date()),
21527
+ endDate: endOfMonth(/* @__PURE__ */ new Date())
21528
+ },
21529
+ refetch: () => {
21530
+ },
21531
+ sidebarScope: void 0,
21532
+ setSidebarScope: () => {
21533
+ },
21534
+ sortBy: () => {
21535
+ },
21536
+ setFilterTypes: () => {
21537
+ },
21538
+ filters: {
21539
+ expenses: void 0,
21540
+ revenue: void 0
21541
+ },
21542
+ tagFilter: void 0,
21543
+ selectedLineItem: null,
21544
+ setSelectedLineItem: () => {
21545
+ },
21546
+ setDisplayMode: () => {
21547
+ },
21548
+ displayMode: "month"
21549
+ });
21416
21550
  const isNotOnlyNoneTag = (compareOptions) => {
21417
21551
  return Boolean(
21418
21552
  compareOptions == null ? void 0 : compareOptions.some((option) => option.tagFilterConfig.tagFilters !== "None")
@@ -21441,16 +21575,24 @@ function useProfitAndLossComparison({
21441
21575
  reportingBasis,
21442
21576
  comparisonConfig
21443
21577
  }) {
21444
- var _a, _b;
21445
- const [comparePeriods, setComparePeriods] = useState((_a = comparisonConfig == null ? void 0 : comparisonConfig.defaultPeriods) != null ? _a : 1);
21578
+ var _a;
21579
+ const [comparisonPeriodMode, setComparisonPeriodMode] = useState(DateGroupBy.AllTime);
21580
+ const { displayMode } = useContext(ProfitAndLossContext);
21581
+ const { startDate, endDate } = useGlobalDateRange({ displayMode: "month" });
21582
+ const comparePeriods = useMemo(() => {
21583
+ if (!comparisonPeriodMode || comparisonPeriodMode === DateGroupBy.AllTime) {
21584
+ return 1;
21585
+ }
21586
+ if (comparisonPeriodMode === DateGroupBy.Year) {
21587
+ return Math.abs(differenceInCalendarYears(endDate, startDate)) + 1;
21588
+ }
21589
+ return Math.abs(differenceInCalendarMonths(endDate, startDate)) + 1;
21590
+ }, [comparisonPeriodMode, endDate, startDate]);
21446
21591
  const [selectedCompareOptions, setSelectedCompareOptionsState] = useState(
21447
21592
  (comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter) ? [comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter] : []
21448
21593
  );
21449
- const rangeDisplayMode = useReportModeWithFallback(ReportKey.ProfitAndLoss, "monthPicker");
21450
- const dateRange = useGlobalDateRange({ displayMode: rangeDisplayMode });
21451
- const isPeriodsSelectEnabled = COMPARE_MODES_SUPPORTING_MULTI_PERIOD.includes(rangeDisplayMode);
21452
- const effectiveComparePeriods = isPeriodsSelectEnabled ? comparePeriods : 1;
21453
- const compareModeActive = useMemo(() => effectiveComparePeriods > 1 || selectedCompareOptions.length > 1 || selectedCompareOptions.length === 1 && isNotOnlyNoneTag(selectedCompareOptions), [effectiveComparePeriods, selectedCompareOptions]);
21594
+ const dateRange = useGlobalDateRange({ displayMode });
21595
+ const compareModeActive = useMemo(() => comparePeriods > 1 || selectedCompareOptions.length > 1 || selectedCompareOptions.length === 1 && isNotOnlyNoneTag(selectedCompareOptions), [comparePeriods, selectedCompareOptions]);
21454
21596
  const setSelectedCompareOptions = (values) => {
21455
21597
  const options2 = values.map(
21456
21598
  (option) => comparisonConfig == null ? void 0 : comparisonConfig.tagComparisonOptions.find(
@@ -21466,7 +21608,7 @@ function useProfitAndLossComparison({
21466
21608
  const { businessId } = useLayerContext();
21467
21609
  const { apiUrl } = useEnvironment();
21468
21610
  const { data: auth } = useAuth();
21469
- const periods = preparePeriodsBody(dateRange, effectiveComparePeriods, rangeDisplayMode);
21611
+ const periods = preparePeriodsBody(dateRange, comparePeriods, comparisonPeriodMode);
21470
21612
  const tagFilters = prepareFiltersBody(selectedCompareOptions);
21471
21613
  const queryKey = buildKey$v(__spreadProps(__spreadValues({}, auth), {
21472
21614
  businessId,
@@ -21492,7 +21634,7 @@ function useProfitAndLossComparison({
21492
21634
  })
21493
21635
  );
21494
21636
  const getProfitAndLossComparisonCsv = (dateRange2, moneyFormat) => {
21495
- const periods2 = preparePeriodsBody(dateRange2, effectiveComparePeriods, rangeDisplayMode);
21637
+ const periods2 = preparePeriodsBody(dateRange2, comparePeriods, comparisonPeriodMode);
21496
21638
  const tagFilters2 = prepareFiltersBody(selectedCompareOptions);
21497
21639
  return Layer.profitAndLossComparisonCsv(apiUrl, auth == null ? void 0 : auth.access_token, {
21498
21640
  params: {
@@ -21510,15 +21652,15 @@ function useProfitAndLossComparison({
21510
21652
  data: data == null ? void 0 : data.pnls,
21511
21653
  isLoading,
21512
21654
  isValidating,
21513
- isPeriodsSelectEnabled,
21514
21655
  compareModeActive,
21515
- comparePeriods: effectiveComparePeriods,
21516
- setComparePeriods,
21517
- compareOptions: (_b = comparisonConfig == null ? void 0 : comparisonConfig.tagComparisonOptions) != null ? _b : [],
21656
+ comparePeriods,
21657
+ compareOptions: (_a = comparisonConfig == null ? void 0 : comparisonConfig.tagComparisonOptions) != null ? _a : [],
21518
21658
  selectedCompareOptions,
21519
21659
  setSelectedCompareOptions,
21520
21660
  getProfitAndLossComparisonCsv,
21521
- comparisonConfig
21661
+ comparisonConfig,
21662
+ comparisonPeriodMode,
21663
+ setComparisonPeriodMode
21522
21664
  };
21523
21665
  }
21524
21666
  const getYearMonthKey = (y, m) => {
@@ -21778,10 +21920,8 @@ const ProfitAndLossChart = ({
21778
21920
  const [compactView, setCompactView] = useState(false);
21779
21921
  const barSize = compactView ? 10 : 20;
21780
21922
  const { getColor, business } = useLayerContext();
21781
- const rangeDisplayMode = useReportModeWithFallback(ReportKey.ProfitAndLoss, "monthPicker");
21782
- const dateRange = useGlobalDateRange({ displayMode: rangeDisplayMode });
21923
+ const dateRange = useGlobalDateRange({ displayMode: "month" });
21783
21924
  const { setMonth } = useGlobalDateRangeActions();
21784
- const showIndicator = rangeDisplayMode === "monthPicker";
21785
21925
  const [customCursorSize, setCustomCursorSize] = useState({
21786
21926
  width: 0,
21787
21927
  height: 0,
@@ -22277,7 +22417,7 @@ const ProfitAndLossChart = ({
22277
22417
  xAxisId: "revenue",
22278
22418
  stackId: "revenue",
22279
22419
  children: [
22280
- showIndicator ? /* @__PURE__ */ jsx(
22420
+ /* @__PURE__ */ jsx(
22281
22421
  LabelList,
22282
22422
  {
22283
22423
  content: /* @__PURE__ */ jsx(
@@ -22288,7 +22428,7 @@ const ProfitAndLossChart = ({
22288
22428
  }
22289
22429
  )
22290
22430
  }
22291
- ) : null,
22431
+ ),
22292
22432
  dataOrPlaceholderData.map((entry) => {
22293
22433
  return /* @__PURE__ */ jsx(
22294
22434
  Cell$2,
@@ -23203,6 +23343,17 @@ const Header = forwardRef(
23203
23343
  }
23204
23344
  );
23205
23345
  Header.displayName = "Header";
23346
+ const CloseButton = (_yc) => {
23347
+ var _zc = _yc, {
23348
+ className,
23349
+ textOnly = false
23350
+ } = _zc, props = __objRest(_zc, [
23351
+ "className",
23352
+ "textOnly"
23353
+ ]);
23354
+ const baseClassName2 = classNames("Layer__btn", "Layer__back-btn", className);
23355
+ return /* @__PURE__ */ jsx("button", __spreadProps(__spreadValues({}, props), { className: baseClassName2, children: textOnly ? "Back" : /* @__PURE__ */ jsx(CloseIcon, { size: 16 }) }));
23356
+ };
23206
23357
  const LedgerAccountsContext = createContext({
23207
23358
  data: void 0,
23208
23359
  entryData: void 0,
@@ -23681,37 +23832,6 @@ const DetailReportBreadcrumb = ({
23681
23832
  subtitle && /* @__PURE__ */ jsx(Span, { size: "sm", variant: "subtle", children: subtitle })
23682
23833
  ] }) }) });
23683
23834
  };
23684
- const ProfitAndLossContext = createContext({
23685
- data: void 0,
23686
- filteredDataRevenue: [],
23687
- filteredTotalRevenue: void 0,
23688
- filteredDataExpenses: [],
23689
- filteredTotalExpenses: void 0,
23690
- isLoading: true,
23691
- isValidating: false,
23692
- isError: false,
23693
- dateRange: {
23694
- startDate: startOfMonth(/* @__PURE__ */ new Date()),
23695
- endDate: endOfMonth(/* @__PURE__ */ new Date())
23696
- },
23697
- refetch: () => {
23698
- },
23699
- sidebarScope: void 0,
23700
- setSidebarScope: () => {
23701
- },
23702
- sortBy: () => {
23703
- },
23704
- setFilterTypes: () => {
23705
- },
23706
- filters: {
23707
- expenses: void 0,
23708
- revenue: void 0
23709
- },
23710
- tagFilter: void 0,
23711
- selectedLineItem: null,
23712
- setSelectedLineItem: () => {
23713
- }
23714
- });
23715
23835
  const COMPONENT_NAME$8 = "ProfitAndLossDetailReport";
23716
23836
  const ErrorState = () => /* @__PURE__ */ jsx(
23717
23837
  DataState,
@@ -23993,7 +24113,7 @@ const ProfitAndLossDetailedCharts = ({
23993
24113
  return /* @__PURE__ */ jsxs("div", { className: "Layer__profit-and-loss-detailed-charts", children: [
23994
24114
  /* @__PURE__ */ jsxs("header", { className: "Layer__profit-and-loss-detailed-charts__header", children: [
23995
24115
  /* @__PURE__ */ jsxs("div", { className: "Layer__profit-and-loss-detailed-charts__head", children: [
23996
- /* @__PURE__ */ jsx(Text, { size: TextSize.lg, weight: TextWeight.bold, className: "title", children: humanizeTitle(theScope) }),
24116
+ /* @__PURE__ */ jsx(Text, { size: TextSize.lg, weight: TextWeight.bold, className: "title", children: humanizeTitle(theScope, stringOverrides == null ? void 0 : stringOverrides.detailedChartStringOverrides) }),
23997
24117
  /* @__PURE__ */ jsx(Text, { size: TextSize.sm, className: "date", children: format(dateRange.startDate, "LLLL, y") }),
23998
24118
  showDatePicker && /* @__PURE__ */ jsx(GlobalMonthPicker, {})
23999
24119
  ] }),
@@ -24010,7 +24130,7 @@ const ProfitAndLossDetailedCharts = ({
24010
24130
  /* @__PURE__ */ jsxs("header", { className: "Layer__profit-and-loss-detailed-charts__header--tablet", children: [
24011
24131
  !hideClose && /* @__PURE__ */ jsx(BackButton, { onClick: () => setSidebarScope(void 0) }),
24012
24132
  /* @__PURE__ */ jsxs("div", { className: "Layer__profit-and-loss-detailed-charts__head", children: [
24013
- /* @__PURE__ */ jsx(Text, { size: TextSize.lg, weight: TextWeight.bold, className: "title", children: humanizeTitle(theScope) }),
24133
+ /* @__PURE__ */ jsx(Text, { size: TextSize.lg, weight: TextWeight.bold, className: "title", children: humanizeTitle(theScope, stringOverrides == null ? void 0 : stringOverrides.detailedChartStringOverrides) }),
24014
24134
  /* @__PURE__ */ jsx(Text, { size: TextSize.sm, className: "date", children: format(dateRange.startDate, "LLLL, y") })
24015
24135
  ] })
24016
24136
  ] }),
@@ -24092,11 +24212,8 @@ const ProfitAndLossComparisonContext = createContext({
24092
24212
  data: void 0,
24093
24213
  isLoading: true,
24094
24214
  isValidating: false,
24095
- isPeriodsSelectEnabled: true,
24096
24215
  compareModeActive: false,
24097
24216
  comparePeriods: 0,
24098
- setComparePeriods: () => {
24099
- },
24100
24217
  compareOptions: [],
24101
24218
  selectedCompareOptions: [],
24102
24219
  setSelectedCompareOptions: function() {
@@ -24105,7 +24222,10 @@ const ProfitAndLossComparisonContext = createContext({
24105
24222
  getProfitAndLossComparisonCsv: function() {
24106
24223
  throw new Error("Function not implemented.");
24107
24224
  },
24108
- comparisonConfig: void 0
24225
+ comparisonConfig: void 0,
24226
+ comparisonPeriodMode: null,
24227
+ setComparisonPeriodMode: () => {
24228
+ }
24109
24229
  });
24110
24230
  const ProfitAndLossFullReportDownloadButton = ({
24111
24231
  stringOverrides,
@@ -24437,7 +24557,7 @@ const options$2 = Object.values(dateSelectionOptionConfig).filter((opt) => opt.v
24437
24557
  const DateSelectionComboBox = () => {
24438
24558
  const [lastPreset, setLastPreset] = useState(null);
24439
24559
  const { business } = useLayerContext();
24440
- const dateRange = useGlobalDateRange({ displayMode: "dayRangePicker" });
24560
+ const dateRange = useGlobalDateRange({ displayMode: "full" });
24441
24561
  const { setDateRange } = useGlobalDateRangeActions();
24442
24562
  const selectedPreset = presetForDateRange(dateRange, lastPreset, getActivationDate(business));
24443
24563
  const selectedOption = dateSelectionOptionConfig[selectedPreset != null ? selectedPreset : DatePreset.Custom];
@@ -24461,7 +24581,7 @@ const DateSelectionComboBox = () => {
24461
24581
  );
24462
24582
  };
24463
24583
  const DateRangeSelection = ({ minDate, maxDate }) => {
24464
- const { startDate: globalStartDate, endDate: globalEndDate } = useGlobalDateRange({ displayMode: "dayRangePicker" });
24584
+ const { startDate: globalStartDate, endDate: globalEndDate } = useGlobalDateRange({ displayMode: "full" });
24465
24585
  const { setDateRange: setGlobalDateRange } = useGlobalDateRangeActions();
24466
24586
  const { value } = useSizeClass();
24467
24587
  const {
@@ -24733,26 +24853,32 @@ const useTableExpandRow = () => {
24733
24853
  toggleAllRows
24734
24854
  };
24735
24855
  };
24736
- const generateComparisonPeriods = (startDate, numberOfPeriods, rangeDisplayMode) => {
24737
- switch (rangeDisplayMode) {
24738
- case "yearPicker":
24739
- return generateComparisonYears(startDate, numberOfPeriods);
24856
+ const generateComparisonPeriods = (params) => {
24857
+ switch (params.mode) {
24858
+ case DateGroupBy.Year:
24859
+ return generateComparisonYears(params.endDate, params.numberOfPeriods);
24860
+ case DateGroupBy.Month:
24861
+ return generateComparisonMonths(params.endDate, params.numberOfPeriods);
24740
24862
  default:
24741
- return generateComparisonMonths(startDate, numberOfPeriods);
24863
+ return generateComparisonDateRange(params.startDate, params.endDate);
24742
24864
  }
24743
24865
  };
24744
- const generateComparisonMonths = (startDate, numberOfMonths) => {
24866
+ const generateComparisonMonths = (endDate, numberOfMonths) => {
24745
24867
  return Array.from({ length: numberOfMonths }, (_, index) => {
24746
- const currentMonth = subMonths(startDate, numberOfMonths - index - 1);
24747
- return { date: currentMonth, label: format(currentMonth, "MMM") };
24868
+ const currentMonth = subMonths(endDate, numberOfMonths - index - 1);
24869
+ return { date: currentMonth, label: format(currentMonth, "MMM yyyy") };
24748
24870
  });
24749
24871
  };
24750
- const generateComparisonYears = (startDate, numberOfYears) => {
24872
+ const generateComparisonYears = (endDate, numberOfYears) => {
24751
24873
  return Array.from({ length: numberOfYears }, (_, index) => {
24752
- const currentMonth = subYears(startDate, numberOfYears - index - 1);
24874
+ const currentMonth = subYears(endDate, numberOfYears - index - 1);
24753
24875
  return { date: currentMonth, label: format(currentMonth, "yyyy") };
24754
24876
  });
24755
24877
  };
24878
+ const generateComparisonDateRange = (startDate, endDate) => {
24879
+ const label = `${format(startDate, DATE_FORMAT$1)} - ${format(endDate, DATE_FORMAT$1)}`;
24880
+ return [{ date: startDate, endDate, label }];
24881
+ };
24756
24882
  const getComparisonValue = (name, depth, cellData) => {
24757
24883
  if (depth === 0) {
24758
24884
  if (typeof cellData === "string" || typeof cellData === "number") {
@@ -24760,8 +24886,8 @@ const getComparisonValue = (name, depth, cellData) => {
24760
24886
  } else {
24761
24887
  return (cellData == null ? void 0 : cellData.value) !== void 0 ? cellData.value : "";
24762
24888
  }
24763
- } else if (typeof cellData === "object" && cellData !== null && "lineItems" in cellData) {
24764
- for (const item of cellData.lineItems || []) {
24889
+ } else if (typeof cellData === "object" && cellData !== null && "line_items" in cellData) {
24890
+ for (const item of cellData.line_items || []) {
24765
24891
  const result = getComparisonLineItemValue(item, name, depth);
24766
24892
  if (result !== "") {
24767
24893
  return result;
@@ -24772,11 +24898,11 @@ const getComparisonValue = (name, depth, cellData) => {
24772
24898
  };
24773
24899
  const getComparisonLineItemValue = (lineItem, name, depth) => {
24774
24900
  if (depth === 1) {
24775
- if (lineItem.displayName === name) {
24901
+ if (lineItem.display_name === name) {
24776
24902
  return lineItem.value !== void 0 ? lineItem.value : "";
24777
24903
  }
24778
- } else if (lineItem.lineItems && lineItem.lineItems.length > 0) {
24779
- for (const childLineItem of lineItem.lineItems) {
24904
+ } else if (lineItem.line_items && lineItem.line_items.length > 0) {
24905
+ for (const childLineItem of lineItem.line_items) {
24780
24906
  const result = getComparisonLineItemValue(childLineItem, name, depth - 1);
24781
24907
  if (result !== "") {
24782
24908
  return result;
@@ -24786,54 +24912,47 @@ const getComparisonLineItemValue = (lineItem, name, depth) => {
24786
24912
  return "";
24787
24913
  };
24788
24914
  const mergeComparisonLineItemsAtDepth = (lineItems) => {
24915
+ var _a, _b, _c;
24789
24916
  const map = /* @__PURE__ */ new Map();
24790
- const mergeItems = (items) => {
24791
- items.forEach((item) => {
24792
- if (!map.has(item.displayName)) {
24793
- map.set(item.displayName, __spreadProps(__spreadValues({}, item), { lineItems: [] }));
24794
- }
24795
- const existingItem = map.get(item.displayName);
24796
- if (item.lineItems) {
24797
- existingItem.lineItems = mergeComparisonLineItemsAtDepth([
24798
- ...existingItem.lineItems || [],
24799
- ...item.lineItems
24800
- ]);
24801
- }
24802
- if (item.value !== void 0) {
24803
- map.set(item.displayName, __spreadProps(__spreadValues({}, existingItem), { value: item.value }));
24804
- }
24805
- });
24806
- };
24807
- mergeItems(lineItems);
24917
+ for (const item of lineItems) {
24918
+ const key = item.display_name;
24919
+ const existing = (_b = map.get(key)) != null ? _b : __spreadProps(__spreadValues({}, item), { line_items: (_a = item.line_items) != null ? _a : [] });
24920
+ let next = existing;
24921
+ if (item.line_items && item.line_items.length > 0) {
24922
+ const mergedChildren = mergeComparisonLineItemsAtDepth([
24923
+ ...(_c = existing.line_items) != null ? _c : [],
24924
+ ...item.line_items
24925
+ ]);
24926
+ next = __spreadProps(__spreadValues({}, next), { line_items: mergedChildren });
24927
+ }
24928
+ if (item.value !== void 0) {
24929
+ next = __spreadProps(__spreadValues({}, next), { value: item.value });
24930
+ }
24931
+ map.set(key, next);
24932
+ }
24808
24933
  return Array.from(map.values());
24809
24934
  };
24810
24935
  const ProfitAndLossCompareTable = ({
24811
24936
  stringOverrides
24812
24937
  }) => {
24938
+ const { dateRange, displayMode } = useContext(ProfitAndLossContext);
24813
24939
  const {
24814
24940
  data: comparisonData,
24815
24941
  isLoading,
24816
24942
  comparePeriods,
24817
- selectedCompareOptions
24943
+ selectedCompareOptions,
24944
+ comparisonPeriodMode
24818
24945
  } = useContext(ProfitAndLossComparisonContext);
24819
24946
  const { isOpen, setIsOpen } = useTableExpandRow();
24820
24947
  const { data: bookkeepingPeriods } = useBookkeepingPeriods();
24821
- const rangeDisplayMode = useReportModeWithFallback(ReportKey.ProfitAndLoss, "monthPicker");
24822
- const dateRange = useGlobalDateRange({ displayMode: rangeDisplayMode });
24823
24948
  useEffect(() => {
24824
24949
  setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
24825
24950
  }, []);
24826
24951
  if (isLoading || comparisonData === void 0) {
24827
- return /* @__PURE__ */ jsx(
24828
- "div",
24829
- {
24830
- className: classNames("Layer__profit-and-loss-table__loader-container"),
24831
- children: /* @__PURE__ */ jsx(Loader, {})
24832
- }
24833
- );
24952
+ return /* @__PURE__ */ jsx("div", { className: "Layer__profit-and-loss-table__loader-container", children: /* @__PURE__ */ jsx(Loader, {}) });
24834
24953
  }
24835
24954
  const getBookkeepingPeriodStatus = (date) => {
24836
- if (!bookkeepingPeriods || rangeDisplayMode !== "monthPicker") {
24955
+ if (!bookkeepingPeriods || displayMode !== "month") {
24837
24956
  return;
24838
24957
  }
24839
24958
  const currentMonth = date.getMonth() + 1;
@@ -24862,7 +24981,7 @@ const ProfitAndLossCompareTable = ({
24862
24981
  )[0];
24863
24982
  lineItem = "display_name" in mergedLineItems ? mergedLineItems : void 0;
24864
24983
  }
24865
- const expandable = (lineItem == null ? void 0 : lineItem.lineItems) && lineItem.lineItems.length > 0 ? true : false;
24984
+ const expandable = (lineItem == null ? void 0 : lineItem.line_items) && lineItem.line_items.length > 0 ? true : false;
24866
24985
  const expanded = expandable ? isOpen(rowKey) : true;
24867
24986
  return /* @__PURE__ */ jsxs(Fragment$1, { children: [
24868
24987
  /* @__PURE__ */ jsxs(
@@ -24875,20 +24994,29 @@ const ProfitAndLossCompareTable = ({
24875
24994
  variant: expandable ? "expandable" : "default",
24876
24995
  handleExpand: () => setIsOpen(rowKey),
24877
24996
  children: [
24878
- /* @__PURE__ */ jsx(TableCell, { primary: true, withExpandIcon: expandable, children: lineItem ? lineItem.displayName : rowDisplayName }),
24997
+ /* @__PURE__ */ jsx(
24998
+ TableCell,
24999
+ {
25000
+ primary: true,
25001
+ withExpandIcon: expandable,
25002
+ nowrap: true,
25003
+ className: "Layer__profit-and-loss-compare-table__sticky-cell",
25004
+ children: lineItem ? lineItem.display_name : rowDisplayName
25005
+ }
25006
+ ),
24879
25007
  rowData.map((cell, i) => /* @__PURE__ */ jsx(TableCell, { isCurrency: true, children: getComparisonValue(
24880
- lineItem ? lineItem.displayName : rowDisplayName,
25008
+ lineItem ? lineItem.display_name : rowDisplayName,
24881
25009
  depth,
24882
25010
  cell
24883
25011
  ) }, "compare-value" + i))
24884
25012
  ]
24885
25013
  }
24886
25014
  ),
24887
- expanded && (lineItem == null ? void 0 : lineItem.lineItems) ? lineItem.lineItems.map(
25015
+ expanded && (lineItem == null ? void 0 : lineItem.line_items) ? lineItem.line_items.map(
24888
25016
  (child) => renderRow(
24889
- child.displayName,
25017
+ child.display_name,
24890
25018
  depth + 1,
24891
- child.displayName,
25019
+ child.display_name,
24892
25020
  child,
24893
25021
  rowData
24894
25022
  )
@@ -24897,7 +25025,13 @@ const ProfitAndLossCompareTable = ({
24897
25025
  };
24898
25026
  return /* @__PURE__ */ jsxs(Table, { borderCollapse: "collapse", bottomSpacing: false, children: [
24899
25027
  /* @__PURE__ */ jsx(TableHead, { children: selectedCompareOptions && selectedCompareOptions.length > 1 && /* @__PURE__ */ jsxs(TableRow, { rowKey: "", children: [
24900
- /* @__PURE__ */ jsx(TableCell, { isHeaderCell: true }),
25028
+ /* @__PURE__ */ jsx(
25029
+ TableCell,
25030
+ {
25031
+ isHeaderCell: true,
25032
+ className: "Layer__profit-and-loss-compare-table__sticky-cell"
25033
+ }
25034
+ ),
24901
25035
  selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxs(Fragment$1, { children: [
24902
25036
  /* @__PURE__ */ jsx(TableCell, { primary: true, isHeaderCell: true, children: option.displayName }, option.displayName + "-" + i),
24903
25037
  comparePeriods && Array.from({ length: comparePeriods - 1 }, (_, index) => /* @__PURE__ */ jsx(TableCell, { isHeaderCell: true }, option.displayName + "-" + index))
@@ -24905,20 +25039,24 @@ const ProfitAndLossCompareTable = ({
24905
25039
  ] }) }),
24906
25040
  /* @__PURE__ */ jsxs(TableBody, { children: [
24907
25041
  comparePeriods && /* @__PURE__ */ jsxs(TableRow, { rowKey: "", children: [
24908
- /* @__PURE__ */ jsx(TableCell, { isHeaderCell: true }),
24909
- selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsx(Fragment$1, { children: generateComparisonPeriods(
24910
- dateRange.startDate,
24911
- comparePeriods,
24912
- rangeDisplayMode
24913
- ).map((month, index) => /* @__PURE__ */ jsx(TableCell, { isHeaderCell: true, children: /* @__PURE__ */ jsxs(HStack, { gap: "2xs", children: [
25042
+ /* @__PURE__ */ jsx(
25043
+ TableCell,
25044
+ {
25045
+ isHeaderCell: true,
25046
+ className: "Layer__profit-and-loss-compare-table__sticky-cell"
25047
+ }
25048
+ ),
25049
+ selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsx(Fragment$1, { children: generateComparisonPeriods(__spreadValues({
25050
+ numberOfPeriods: comparePeriods,
25051
+ mode: comparisonPeriodMode
25052
+ }, dateRange)).map((month, index) => /* @__PURE__ */ jsx(TableCell, { isHeaderCell: true, children: /* @__PURE__ */ jsxs(HStack, { gap: "2xs", children: [
24914
25053
  month.label,
24915
25054
  " ",
24916
25055
  getBookkeepingPeriodStatus(month.date)
24917
- ] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsx(Fragment$1, { children: generateComparisonPeriods(
24918
- dateRange.startDate,
24919
- comparePeriods,
24920
- rangeDisplayMode
24921
- ).map((month, index) => /* @__PURE__ */ jsx(TableCell, { isHeaderCell: true, children: month.label }, "total-" + index + "-cell")) }, "total-1")
25056
+ ] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsx(Fragment$1, { children: generateComparisonPeriods(__spreadValues({
25057
+ numberOfPeriods: comparePeriods,
25058
+ mode: comparisonPeriodMode
25059
+ }, dateRange)).map((month, index) => /* @__PURE__ */ jsx(TableCell, { isHeaderCell: true, children: month.label }, "total-" + index + "-cell")) }, "total-1")
24922
25060
  ] }),
24923
25061
  renderRow("income", 0, "Income"),
24924
25062
  renderRow("cost_of_goods_sold", 0, "Cost of Goods Sold"),
@@ -25126,13 +25264,15 @@ const ProfitAndLossTableComponent = ({
25126
25264
  rowKey: "other_outflows",
25127
25265
  rowIndex: 8
25128
25266
  }),
25129
- data.customLineItems && renderLineItem({
25130
- lineItem: data.customLineItems,
25131
- depth: 0,
25132
- rowKey: "other_activity",
25133
- rowIndex: 9,
25134
- showValue: false
25135
- })
25267
+ data.customLineItems && data.customLineItems.map(
25268
+ (customLineItem, index) => renderLineItem({
25269
+ lineItem: customLineItem,
25270
+ depth: 0,
25271
+ rowKey: `custom_line_item_${index}`,
25272
+ rowIndex: 9 + index,
25273
+ showValue: false
25274
+ })
25275
+ )
25136
25276
  ] }) });
25137
25277
  };
25138
25278
  const ProfitAndLossTableWithProvider = (props) => {
@@ -25194,44 +25334,16 @@ const selectStyles = {
25194
25334
  });
25195
25335
  }
25196
25336
  };
25197
- function buildCompareOptions(rangeDisplayMode) {
25198
- switch (rangeDisplayMode) {
25199
- case "monthPicker":
25200
- return [
25201
- { value: 1, label: "This month" },
25202
- { value: 2, label: "Last 2 months" },
25203
- { value: 3, label: "Last 3 months" }
25204
- ];
25205
- case "yearPicker":
25206
- return [
25207
- { value: 1, label: "This year" },
25208
- { value: 2, label: "Last 2 years" },
25209
- { value: 3, label: "Last 3 years" }
25210
- ];
25211
- default:
25212
- return [
25213
- { value: 1, label: "This period" },
25214
- { value: 2, label: "Last 2 periods" },
25215
- { value: 3, label: "Last 3 periods" }
25216
- ];
25217
- }
25218
- }
25219
25337
  const ProfitAndLossCompareOptions = () => {
25220
25338
  const {
25221
- setComparePeriods,
25222
25339
  setSelectedCompareOptions,
25223
- isPeriodsSelectEnabled,
25224
- comparePeriods,
25225
25340
  compareOptions,
25226
25341
  selectedCompareOptions,
25227
- comparisonConfig
25342
+ comparisonConfig,
25343
+ comparisonPeriodMode,
25344
+ setComparisonPeriodMode
25228
25345
  } = useContext(ProfitAndLossComparisonContext);
25229
- const rangeDisplayMode = useReportModeWithFallback(ReportKey.ProfitAndLoss, "monthPicker");
25230
- const periods = useMemo(
25231
- () => comparePeriods !== 0 ? comparePeriods : 1,
25232
- [comparePeriods]
25233
- );
25234
- const timeComparisonOptions = buildCompareOptions(rangeDisplayMode);
25346
+ const { displayMode } = useContext(ProfitAndLossContext);
25235
25347
  const tagComparisonSelectOptions = compareOptions.map(
25236
25348
  (tagComparisonOption) => {
25237
25349
  return {
@@ -25243,19 +25355,8 @@ const ProfitAndLossCompareOptions = () => {
25243
25355
  if (!comparisonConfig) {
25244
25356
  return null;
25245
25357
  }
25246
- return /* @__PURE__ */ jsxs("div", { className: "Layer__compare__options", children: [
25247
- /* @__PURE__ */ jsx(
25248
- Select,
25249
- {
25250
- options: timeComparisonOptions,
25251
- onChange: (e) => setComparePeriods(e && e.value ? e.value : 1),
25252
- value: timeComparisonOptions.find(
25253
- (option) => option.value === periods
25254
- ),
25255
- placeholder: rangeDisplayMode === "yearPicker" ? "Compare years" : "Compare months",
25256
- disabled: !isPeriodsSelectEnabled
25257
- }
25258
- ),
25358
+ return /* @__PURE__ */ jsxs(HStack, { align: "center", gap: "xs", children: [
25359
+ displayMode === "full" && /* @__PURE__ */ jsx(DateGroupByComboBox, { value: comparisonPeriodMode, onValueChange: setComparisonPeriodMode }),
25259
25360
  /* @__PURE__ */ jsx(
25260
25361
  MultiSelect,
25261
25362
  {
@@ -25272,7 +25373,8 @@ const ProfitAndLossCompareOptions = () => {
25272
25373
  };
25273
25374
  }),
25274
25375
  placeholder: "Select views",
25275
- styles: selectStyles
25376
+ styles: selectStyles,
25377
+ className: "Layer__ProfitAndLoss__TagMultiSelect"
25276
25378
  }
25277
25379
  )
25278
25380
  ] });
@@ -25286,8 +25388,11 @@ const ProfitAndLossReport = ({
25286
25388
  hideHeader
25287
25389
  }) => {
25288
25390
  var _a;
25289
- const { selectedLineItem, setSelectedLineItem } = useContext(ProfitAndLossContext);
25391
+ const { selectedLineItem, setSelectedLineItem, setDisplayMode } = useContext(ProfitAndLossContext);
25290
25392
  const { comparisonConfig } = useContext(ProfitAndLossComparisonContext);
25393
+ useEffect(() => {
25394
+ setDisplayMode(dateSelectionMode);
25395
+ }, [dateSelectionMode, setDisplayMode]);
25291
25396
  const breadcrumbIndexMap = useMemo(() => {
25292
25397
  if (!selectedLineItem) return {};
25293
25398
  return selectedLineItem.breadcrumbPath.reduce((acc, item, index) => {
@@ -25410,13 +25515,13 @@ function toMiniChartData({
25410
25515
  function ProfitAndLossSummariesMiniChart({
25411
25516
  data,
25412
25517
  chartColorsList,
25413
- variants
25518
+ variants: variants2
25414
25519
  }) {
25415
25520
  const typeColorMapping = mapTypesToColors(data, chartColorsList);
25416
25521
  let chartDimension = 52;
25417
25522
  let innerRadius = 10;
25418
25523
  let outerRadius = 16;
25419
- switch (variants == null ? void 0 : variants.size) {
25524
+ switch (variants2 == null ? void 0 : variants2.size) {
25420
25525
  case "sm":
25421
25526
  chartDimension = 52;
25422
25527
  innerRadius = 10;
@@ -25460,10 +25565,10 @@ function ProfitAndLossSummariesMiniChart({
25460
25565
  ) });
25461
25566
  }
25462
25567
  function ProfitAndLossSummariesHeading({
25463
- variants,
25568
+ variants: variants2,
25464
25569
  children
25465
25570
  }) {
25466
- const { size = "2xs" } = variants != null ? variants : {};
25571
+ const { size = "2xs" } = variants2 != null ? variants2 : {};
25467
25572
  return /* @__PURE__ */ jsx(Heading, { level: 3, size, slot: "heading", children });
25468
25573
  }
25469
25574
  const CLASS_NAME$3 = "Layer__ProfitAndLossSummariesSummary";
@@ -25474,14 +25579,14 @@ function ProfitAndLossSummariesSummary({
25474
25579
  amount,
25475
25580
  isLoading,
25476
25581
  slots,
25477
- variants
25582
+ variants: variants2
25478
25583
  }) {
25479
25584
  const { Chart } = slots != null ? slots : {};
25480
- const { size = "2xs" } = variants != null ? variants : {};
25585
+ const { size = "2xs" } = variants2 != null ? variants2 : {};
25481
25586
  const dataProperties = toDataProperties({ size });
25482
25587
  return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ className: CLASS_NAME$3 }, dataProperties), { children: [
25483
25588
  Chart ? /* @__PURE__ */ jsx("div", { className: CHART_AREA_CLASS_NAME, children: Chart }) : /* @__PURE__ */ jsx("div", { className: CHART_AREA_EMPTY_FRAME_CLASS_NAME }),
25484
- /* @__PURE__ */ jsx(ProfitAndLossSummariesHeading, { variants, children: label }),
25589
+ /* @__PURE__ */ jsx(ProfitAndLossSummariesHeading, { variants: variants2, children: label }),
25485
25590
  isLoading ? /* @__PURE__ */ jsx(SkeletonLoader, { height: "20px" }) : /* @__PURE__ */ jsx(MoneySpan, { slot: "amount", amount, size: "lg", bold: true })
25486
25591
  ] }));
25487
25592
  }
@@ -25490,10 +25595,10 @@ function TransactionsToReview({
25490
25595
  onClick,
25491
25596
  usePnlDateRange,
25492
25597
  tagFilter = void 0,
25493
- variants
25598
+ variants: variants2
25494
25599
  }) {
25495
25600
  var _a;
25496
- const { size = "sm" } = variants != null ? variants : {};
25601
+ const { size = "sm" } = variants2 != null ? variants2 : {};
25497
25602
  const { dateRange: contextDateRange } = useContext(ProfitAndLossContext);
25498
25603
  const dateRange = usePnlDateRange ? contextDateRange : void 0;
25499
25604
  const currentDate = useMemo(() => dateRange ? dateRange.startDate : startOfMonth(/* @__PURE__ */ new Date()), [dateRange]);
@@ -25567,7 +25672,7 @@ function TransactionsToReview({
25567
25672
  }
25568
25673
  return /* @__PURE__ */ jsxs("div", { onClick, className: CLASS_NAME$2, children: [
25569
25674
  /* @__PURE__ */ jsxs(VStack, { gap: verticalGap, align: "start", children: [
25570
- /* @__PURE__ */ jsx(ProfitAndLossSummariesHeading, { variants, children: "Transactions to review" }),
25675
+ /* @__PURE__ */ jsx(ProfitAndLossSummariesHeading, { variants: variants2, children: "Transactions to review" }),
25571
25676
  transactionsToReviewBadge
25572
25677
  ] }),
25573
25678
  /* @__PURE__ */ jsx(IconButton, { icon: /* @__PURE__ */ jsx(ChevronRight, {}), withBorder: true, onClick })
@@ -25581,7 +25686,7 @@ function Internal_ProfitAndLossSummaries({
25581
25686
  stringOverrides,
25582
25687
  chartColorsList,
25583
25688
  slots,
25584
- variants
25689
+ variants: variants2
25585
25690
  }) {
25586
25691
  var _a, _b, _c, _d;
25587
25692
  const {
@@ -25618,11 +25723,11 @@ function Internal_ProfitAndLossSummaries({
25618
25723
  {
25619
25724
  data: revenueChartData,
25620
25725
  chartColorsList,
25621
- variants
25726
+ variants: variants2
25622
25727
  }
25623
25728
  )
25624
25729
  },
25625
- variants
25730
+ variants: variants2
25626
25731
  }
25627
25732
  )
25628
25733
  }
@@ -25644,11 +25749,11 @@ function Internal_ProfitAndLossSummaries({
25644
25749
  {
25645
25750
  data: expensesChartData,
25646
25751
  chartColorsList,
25647
- variants
25752
+ variants: variants2
25648
25753
  }
25649
25754
  )
25650
25755
  },
25651
- variants
25756
+ variants: variants2
25652
25757
  }
25653
25758
  )
25654
25759
  }
@@ -25658,17 +25763,17 @@ function Internal_ProfitAndLossSummaries({
25658
25763
  {
25659
25764
  label: (stringOverrides == null ? void 0 : stringOverrides.netProfitLabel) || "Net Profit",
25660
25765
  amount: (_d = data == null ? void 0 : data.netProfit) != null ? _d : 0,
25661
- variants,
25766
+ variants: variants2,
25662
25767
  isLoading
25663
25768
  }
25664
25769
  ) }),
25665
25770
  unstable_AdditionalListItems.map((item, index) => /* @__PURE__ */ jsx(ProfitAndLossSummariesListItem, { children: item }, index))
25666
25771
  ] }) });
25667
25772
  }
25668
- function ProfitAndLossSummaries(_yc) {
25669
- var _zc = _yc, {
25773
+ function ProfitAndLossSummaries(_Ac) {
25774
+ var _Bc = _Ac, {
25670
25775
  onTransactionsToReviewClick
25671
- } = _zc, restProps = __objRest(_zc, [
25776
+ } = _Bc, restProps = __objRest(_Bc, [
25672
25777
  "onTransactionsToReviewClick"
25673
25778
  ]);
25674
25779
  return /* @__PURE__ */ jsx(
@@ -25690,7 +25795,7 @@ function ProfitAndLossSummaries(_yc) {
25690
25795
  })
25691
25796
  );
25692
25797
  }
25693
- const ProfitAndLossWithoutReportsModeProvider = ({
25798
+ const ProfitAndLoss = ({
25694
25799
  children,
25695
25800
  tagFilter,
25696
25801
  comparisonConfig,
@@ -25701,14 +25806,6 @@ const ProfitAndLossWithoutReportsModeProvider = ({
25701
25806
  const comparisonContextData = useProfitAndLossComparison({ comparisonConfig, reportingBasis });
25702
25807
  return /* @__PURE__ */ jsx(ProfitAndLossContext.Provider, { value: contextData, children: /* @__PURE__ */ jsx(ProfitAndLossComparisonContext.Provider, { value: comparisonContextData, children: asContainer ? /* @__PURE__ */ jsx(Container, { name: "profit-and-loss", children }) : children }) });
25703
25808
  };
25704
- const ProfitAndLossWithReportsModeProvider = (props) => {
25705
- return /* @__PURE__ */ jsx(ReportsModeStoreProvider, { initialModes: { ProfitAndLoss: "monthPicker" }, children: /* @__PURE__ */ jsx(ProfitAndLossWithoutReportsModeProvider, __spreadValues({}, props)) });
25706
- };
25707
- const ProfitAndLoss = (_Ac) => {
25708
- var _Bc = _Ac, { withReportsModeProvider = true } = _Bc, restProps = __objRest(_Bc, ["withReportsModeProvider"]);
25709
- if (withReportsModeProvider) return /* @__PURE__ */ jsx(ProfitAndLossWithReportsModeProvider, __spreadValues({}, restProps));
25710
- return /* @__PURE__ */ jsx(ProfitAndLossWithoutReportsModeProvider, __spreadValues({}, restProps));
25711
- };
25712
25809
  ProfitAndLoss.Chart = ProfitAndLossChart;
25713
25810
  ProfitAndLoss.Summaries = ProfitAndLossSummaries;
25714
25811
  ProfitAndLoss.DetailedCharts = ProfitAndLossDetailedCharts;
@@ -26113,9 +26210,6 @@ const CombinedDateSelection = ({ mode }) => {
26113
26210
  return /* @__PURE__ */ jsx(DateSelection, {});
26114
26211
  };
26115
26212
  const COMPONENT_NAME$7 = "balance-sheet";
26116
- const StandaloneBalanceSheet = (props) => {
26117
- return /* @__PURE__ */ jsx(ReportsModeStoreProvider, { initialModes: { BalanceSheet: "dayPicker" }, children: /* @__PURE__ */ jsx(BalanceSheet, __spreadValues({}, props)) });
26118
- };
26119
26213
  const BalanceSheet = (props) => {
26120
26214
  return /* @__PURE__ */ jsx(
26121
26215
  BalanceSheetView,
@@ -26438,27 +26532,7 @@ function useStatementOfCashFlow({
26438
26532
  )().then(({ data }) => data)
26439
26533
  );
26440
26534
  }
26441
- const DEFAULT_ALLOWED_PICKER_MODES = ["monthPicker"];
26442
- const getAllowedDateRangePickerModes = ({
26443
- allowedDatePickerModes,
26444
- defaultDatePickerMode
26445
- }) => getArrayWithAtLeastOneOrFallback(
26446
- allowedDatePickerModes != null ? allowedDatePickerModes : defaultDatePickerMode ? [defaultDatePickerMode] : [],
26447
- DEFAULT_ALLOWED_PICKER_MODES
26448
- );
26449
- const getInitialDateRangePickerMode = ({
26450
- allowedDatePickerModes,
26451
- defaultDatePickerMode
26452
- }) => {
26453
- const allowedDateRangePickerModes = getAllowedDateRangePickerModes({ allowedDatePickerModes, defaultDatePickerMode });
26454
- const initialRangeDisplayMode = defaultDatePickerMode && allowedDateRangePickerModes.includes(defaultDatePickerMode) ? defaultDatePickerMode : allowedDateRangePickerModes[0];
26455
- return initialRangeDisplayMode;
26456
- };
26457
26535
  const COMPONENT_NAME$6 = "statement-of-cash-flow";
26458
- const StandaloneStatementOfCashFlow = (props) => {
26459
- const initialModeForStatementOfCashFlows = getInitialDateRangePickerMode(props);
26460
- return /* @__PURE__ */ jsx(ReportsModeStoreProvider, { initialModes: { StatementOfCashFlows: initialModeForStatementOfCashFlows }, children: /* @__PURE__ */ jsx(StatementOfCashFlow, __spreadValues({}, props)) });
26461
- };
26462
26536
  const StatementOfCashFlow = (props) => {
26463
26537
  return /* @__PURE__ */ jsx(StatementOfCashFlowView, __spreadValues({}, props));
26464
26538
  };
@@ -26466,8 +26540,7 @@ const StatementOfCashFlowView = ({
26466
26540
  stringOverrides,
26467
26541
  dateSelectionMode = "full"
26468
26542
  }) => {
26469
- const displayMode = useReportModeWithFallback(ReportKey.StatementOfCashFlows, "monthPicker");
26470
- const dateRange = useGlobalDateRange({ displayMode });
26543
+ const dateRange = useGlobalDateRange({ displayMode: dateSelectionMode });
26471
26544
  const { data, isLoading } = useStatementOfCashFlow(dateRange);
26472
26545
  const { view, containerRef } = useElementViewSize();
26473
26546
  return /* @__PURE__ */ jsx(TableProvider, { children: /* @__PURE__ */ jsx(
@@ -27157,7 +27230,7 @@ const useChartOfAccounts = ({ withDates = false } = {}) => {
27157
27230
  const { businessId } = useLayerContext();
27158
27231
  const { apiUrl } = useEnvironment();
27159
27232
  const { data: auth } = useAuth();
27160
- const { startDate, endDate } = useGlobalDateRange({ displayMode: "monthPicker" });
27233
+ const { startDate, endDate } = useGlobalDateRange({ displayMode: "month" });
27161
27234
  const [form, setForm] = useState();
27162
27235
  const [sendingForm, setSendingForm] = useState(false);
27163
27236
  const [apiError, setApiError] = useState(void 0);
@@ -34731,7 +34804,8 @@ const BookkeepingOverview = ({
34731
34804
  {
34732
34805
  text: ((_e = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _e.header) || "Profit & Loss",
34733
34806
  withDatePicker: true,
34734
- withStatus: true
34807
+ withStatus: true,
34808
+ dateSelectionMode: "month"
34735
34809
  }
34736
34810
  ),
34737
34811
  /* @__PURE__ */ jsx(BookkeepingProfitAndLossSummariesContainer, { children: /* @__PURE__ */ jsx(
@@ -34845,7 +34919,7 @@ const AccountingOverview = ({
34845
34919
  children: /* @__PURE__ */ jsxs(
34846
34920
  View,
34847
34921
  {
34848
- title,
34922
+ title: (stringOverrides == null ? void 0 : stringOverrides.title) || title,
34849
34923
  showHeader: showTitle,
34850
34924
  header: /* @__PURE__ */ jsx(Header, { children: /* @__PURE__ */ jsx(HeaderRow, { children: /* @__PURE__ */ jsx(HeaderCol, { children: /* @__PURE__ */ jsx(GlobalMonthPicker, {}) }) }) }),
34851
34925
  children: [
@@ -35069,7 +35143,7 @@ const ProjectProfitabilityView = ({
35069
35143
  valueOptions,
35070
35144
  showTitle,
35071
35145
  stringOverrides,
35072
- datePickerMode = "monthPicker",
35146
+ dateSelectionMode = "month",
35073
35147
  csvMoneyFormat = "DOLLAR_STRING"
35074
35148
  }) => {
35075
35149
  const [activeTab, setActiveTab] = useState("overview");
@@ -35162,7 +35236,7 @@ const ProjectProfitabilityView = ({
35162
35236
  ProfitAndLoss.Report,
35163
35237
  {
35164
35238
  stringOverrides,
35165
- datePickerMode,
35239
+ dateSelectionMode,
35166
35240
  csvMoneyFormat
35167
35241
  }
35168
35242
  ) })
@@ -37336,7 +37410,7 @@ function useUnifiedReportDateVariant() {
37336
37410
  function useUnifiedReportWithDateParams() {
37337
37411
  const store = useContext(UnifiedReportStoreContext);
37338
37412
  const { date: effectiveDate } = useGlobalDate();
37339
- const { startDate, endDate } = useGlobalDateRange({ displayMode: "dayRangePicker" });
37413
+ const { startDate, endDate } = useGlobalDateRange({ displayMode: "full" });
37340
37414
  const report = useStore(store, (state) => state.report);
37341
37415
  const dateVariant = reportToDateVariantMap[report];
37342
37416
  switch (dateVariant) {
@@ -37605,13 +37679,6 @@ const Reports = ({
37605
37679
  const { view, containerRef } = useElementViewSize();
37606
37680
  const options2 = getOptions(enabledReports);
37607
37681
  const defaultTitle2 = enabledReports.length > 1 ? "Reports" : (_a = options2.find((option) => option.value === enabledReports[0])) == null ? void 0 : _a.label;
37608
- const initialModeForProfitAndLoss = profitAndLossConfig ? getInitialDateRangePickerMode(profitAndLossConfig) : "monthPicker";
37609
- const initialModeForStatementOfCashFlows = statementOfCashFlowConfig ? getInitialDateRangePickerMode(statementOfCashFlowConfig) : "monthPicker";
37610
- const initialModes = {
37611
- [ReportKey.ProfitAndLoss]: initialModeForProfitAndLoss,
37612
- [ReportKey.BalanceSheet]: "dayPicker",
37613
- [ReportKey.StatementOfCashFlows]: initialModeForStatementOfCashFlows
37614
- };
37615
37682
  return /* @__PURE__ */ jsxs(
37616
37683
  View,
37617
37684
  {
@@ -37627,7 +37694,7 @@ const Reports = ({
37627
37694
  onChange: (opt) => setActiveTab(opt.target.value)
37628
37695
  }
37629
37696
  ) }),
37630
- /* @__PURE__ */ jsx(Container, { name: "reports", ref: containerRef, children: /* @__PURE__ */ jsx(ReportsModeStoreProvider, { initialModes, resetPnLModeToDefaultOnMount: false, children: /* @__PURE__ */ jsx(ProfitAndLoss, { asContainer: false, comparisonConfig, withReportsModeProvider: false, children: /* @__PURE__ */ jsx(
37697
+ /* @__PURE__ */ jsx(Container, { name: "reports", ref: containerRef, children: /* @__PURE__ */ jsx(ProfitAndLoss, { asContainer: false, comparisonConfig, children: /* @__PURE__ */ jsx(
37631
37698
  ReportsPanel,
37632
37699
  {
37633
37700
  openReport: activeTab,
@@ -37637,7 +37704,7 @@ const Reports = ({
37637
37704
  view,
37638
37705
  renderInAppLink
37639
37706
  }
37640
- ) }) }) })
37707
+ ) }) })
37641
37708
  ]
37642
37709
  }
37643
37710
  );
@@ -41449,7 +41516,7 @@ const BusinessProvider = ({
41449
41516
  hasBeenTouched,
41450
41517
  resetCaches
41451
41518
  } = useDataSync();
41452
- const globalDateRange = useGlobalDateRange({ displayMode: "dayRangePicker" });
41519
+ const globalDateRange = useGlobalDateRange({ displayMode: "full" });
41453
41520
  const { setDateRange } = useGlobalDateRangeActions();
41454
41521
  const dateRange = useMemo(() => ({
41455
41522
  range: globalDateRange,
@@ -41614,7 +41681,7 @@ const LayerProvider = (_od) => {
41614
41681
  };
41615
41682
  export {
41616
41683
  AccountingOverview,
41617
- StandaloneBalanceSheet as BalanceSheet,
41684
+ BalanceSheet,
41618
41685
  BankTransactions,
41619
41686
  BankTransactionsWithLinkedAccounts,
41620
41687
  BookkeepingOverview,
@@ -41637,7 +41704,7 @@ export {
41637
41704
  ProfitAndLossView,
41638
41705
  ProjectProfitabilityView,
41639
41706
  Reports,
41640
- StandaloneStatementOfCashFlow as StatementOfCashFlow,
41707
+ StatementOfCashFlow,
41641
41708
  Tasks,
41642
41709
  unstable_BillsView,
41643
41710
  UnifiedReport as unstable_UnifiedReports,