@layerfi/components 0.1.112-alpha.4 → 0.1.112-alpha.5

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.
@@ -67,6 +67,8 @@ import useSWRMutation from "swr/mutation";
67
67
  import { useFloating, offset, flip, shift, autoUpdate, useHover, useFocus, useDismiss, useRole, useInteractions, useTransitionStyles, useMergeRefs, FloatingPortal } from "@floating-ui/react";
68
68
  import { UploadCloud as UploadCloud$1, LoaderCircle, X as X$1, Minus, Check as Check$1, 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$1, Download, Users, Milestone, Video, Clock as Clock$1, Link as Link$4, TriangleAlert, Plus as Plus$1, HandCoins, Trash as Trash$1, Menu as Menu$2, Send } from "lucide-react";
69
69
  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, SearchField as SearchField$1, Input as Input$2, Group, Form as Form$1, TextField as TextField$1, FieldError as FieldError$1, DateField as DateField$1, DateInput as DateInput$1, DateSegment as DateSegment$1, DatePicker as DatePicker$2, TextArea as TextArea$1, 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, Calendar as Calendar$2, CalendarGrid as CalendarGrid$1, CalendarGridBody as CalendarGridBody$1, CalendarCell as CalendarCell$1, CalendarGridHeader as CalendarGridHeader$1, CalendarHeaderCell as CalendarHeaderCell$1, Meter as Meter$1 } from "react-aria-components";
70
+ import useResizeObserver from "@react-hook/resize-observer";
71
+ import { mergeRefs } from "react-merge-refs";
70
72
  import Select$1, { components } from "react-select";
71
73
  import CurrencyInput from "react-currency-input-field";
72
74
  import * as RDP from "react-datepicker";
@@ -109,7 +111,7 @@ const LinkedAccountsContext = createContext({
109
111
  setAccountsToAddOpeningBalanceInModal: () => {
110
112
  }
111
113
  });
112
- const version = "0.1.112-alpha.4";
114
+ const version = "0.1.112-alpha.5";
113
115
  const pkg = {
114
116
  version
115
117
  };
@@ -2673,6 +2675,36 @@ class PlaceholderAsOption extends BaseCategorizationOption {
2673
2675
  return null;
2674
2676
  }
2675
2677
  }
2678
+ class SplitAsOption extends BaseCategorizationOption {
2679
+ constructor(splits) {
2680
+ super(splits);
2681
+ }
2682
+ get original() {
2683
+ return this.internalValue;
2684
+ }
2685
+ get type() {
2686
+ return "Split";
2687
+ }
2688
+ get label() {
2689
+ return this.internalValue.map((split) => {
2690
+ var _a, _b;
2691
+ return (_b = (_a = split.category) == null ? void 0 : _a.label) != null ? _b : "Uncategorized";
2692
+ }).join(", ");
2693
+ }
2694
+ get value() {
2695
+ var _a, _b;
2696
+ if (this.internalValue.length == 1) {
2697
+ return (_b = (_a = this.internalValue[0].category) == null ? void 0 : _a.value) != null ? _b : "";
2698
+ }
2699
+ return "split";
2700
+ }
2701
+ get classification() {
2702
+ return null;
2703
+ }
2704
+ get classificationEncoded() {
2705
+ return null;
2706
+ }
2707
+ }
2676
2708
  class ApiCategorizationAsOption extends BaseCategorizationOption {
2677
2709
  constructor(categorization) {
2678
2710
  super(categorization);
@@ -5385,19 +5417,6 @@ const hasMatch = (bankTransaction) => {
5385
5417
  );
5386
5418
  };
5387
5419
  const isCredit = ({ direction }) => direction === Direction.CREDIT;
5388
- const isAlreadyMatched$1 = (bankTransaction) => {
5389
- var _a;
5390
- if (bankTransaction == null ? void 0 : bankTransaction.match) {
5391
- const foundMatch = (_a = bankTransaction.suggested_matches) == null ? void 0 : _a.find(
5392
- (x) => {
5393
- var _a2;
5394
- return x.details.id === ((_a2 = bankTransaction == null ? void 0 : bankTransaction.match) == null ? void 0 : _a2.details.id);
5395
- }
5396
- );
5397
- return foundMatch == null ? void 0 : foundMatch.id;
5398
- }
5399
- return void 0;
5400
- };
5401
5420
  const countTransactionsToReview = ({
5402
5421
  transactions,
5403
5422
  dateRange
@@ -5429,6 +5448,19 @@ const hasSuggestedTransferMatches = (bankTransaction) => {
5429
5448
  var _a, _b;
5430
5449
  return (_b = (_a = bankTransaction == null ? void 0 : bankTransaction.suggested_matches) == null ? void 0 : _a.every((x) => x.details.type === "Transfer_Match")) != null ? _b : false;
5431
5450
  };
5451
+ const getBankTransactionMatchAsSuggestedMatch = (bankTransaction) => {
5452
+ var _a;
5453
+ if (bankTransaction == null ? void 0 : bankTransaction.match) {
5454
+ const foundMatch = (_a = bankTransaction.suggested_matches) == null ? void 0 : _a.find(
5455
+ (x) => {
5456
+ var _a2, _b;
5457
+ return x.details.id === ((_a2 = bankTransaction == null ? void 0 : bankTransaction.match) == null ? void 0 : _a2.details.id) || x.details.id === ((_b = bankTransaction == null ? void 0 : bankTransaction.match) == null ? void 0 : _b.bank_transaction.id);
5458
+ }
5459
+ );
5460
+ return foundMatch;
5461
+ }
5462
+ return void 0;
5463
+ };
5432
5464
  const ChevronRight = (_k) => {
5433
5465
  var props = __objRest(_k, []);
5434
5466
  return /* @__PURE__ */ jsx(
@@ -5617,7 +5649,7 @@ function toDataProperties(input) {
5617
5649
  );
5618
5650
  return unsafeProperties;
5619
5651
  }
5620
- const Tooltip = (_n) => {
5652
+ const DeprecatedTooltip = (_n) => {
5621
5653
  var _o = _n, {
5622
5654
  children
5623
5655
  } = _o, options2 = __objRest(_o, [
@@ -5626,7 +5658,7 @@ const Tooltip = (_n) => {
5626
5658
  const tooltip = useTooltip(options2);
5627
5659
  return /* @__PURE__ */ jsx(TooltipContext.Provider, { value: tooltip, children });
5628
5660
  };
5629
- const TooltipTrigger = forwardRef(function TooltipTrigger2(_p, propRef) {
5661
+ const DeprecatedTooltipTrigger = forwardRef(function TooltipTrigger(_p, propRef) {
5630
5662
  var _q = _p, { children, asChild = false } = _q, props = __objRest(_q, ["children", "asChild"]);
5631
5663
  const context = useTooltipContext();
5632
5664
  const childrenRef = isValidElement(children) && "ref" in children ? children.ref : null;
@@ -5653,7 +5685,7 @@ const TooltipTrigger = forwardRef(function TooltipTrigger2(_p, propRef) {
5653
5685
  })
5654
5686
  );
5655
5687
  });
5656
- const TooltipContent = forwardRef(function TooltipContent2(_r, propRef) {
5688
+ const DeprecatedTooltipContent = forwardRef(function TooltipContent(_r, propRef) {
5657
5689
  var _s = _r, { className, width } = _s, props = __objRest(_s, ["className", "width"]);
5658
5690
  const context = useTooltipContext();
5659
5691
  const ref = useMergeRefs([context.refs.setFloating, propRef]);
@@ -5759,9 +5791,9 @@ const Button$1 = (_t) => {
5759
5791
  onMouseEnter: startAnimation,
5760
5792
  onMouseLeave: stopAnimation,
5761
5793
  ref: buttonRef,
5762
- children: tooltip ? /* @__PURE__ */ jsxs(Tooltip, { offset: 12, children: [
5763
- /* @__PURE__ */ jsx(TooltipTrigger, { children: content }),
5764
- tooltip && /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: tooltip })
5794
+ children: tooltip ? /* @__PURE__ */ jsxs(DeprecatedTooltip, { offset: 12, children: [
5795
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: content }),
5796
+ tooltip && /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: tooltip })
5765
5797
  ] }) : content
5766
5798
  })
5767
5799
  );
@@ -6026,9 +6058,9 @@ const buildRightIcon = ({
6026
6058
  return /* @__PURE__ */ jsx(Loader$1, { size: 14, className: "Layer__anim--rotating" });
6027
6059
  }
6028
6060
  if (error) {
6029
- return /* @__PURE__ */ jsxs(Tooltip, { offset: 12, children: [
6030
- /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsx(AlertCircle, { size: 14 }) }),
6031
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: error })
6061
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { offset: 12, children: [
6062
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsx(AlertCircle, { size: 14 }) }),
6063
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: error })
6032
6064
  ] });
6033
6065
  }
6034
6066
  if (action === "upload") {
@@ -6460,7 +6492,7 @@ const Text = (_Z) => {
6460
6492
  children,
6461
6493
  size = "md",
6462
6494
  weight = "normal",
6463
- withTooltip,
6495
+ withDeprecatedTooltip: withTooltip,
6464
6496
  ellipsis,
6465
6497
  status,
6466
6498
  pb,
@@ -6471,7 +6503,7 @@ const Text = (_Z) => {
6471
6503
  "children",
6472
6504
  "size",
6473
6505
  "weight",
6474
- "withTooltip",
6506
+ "withDeprecatedTooltip",
6475
6507
  "ellipsis",
6476
6508
  "status",
6477
6509
  "pb",
@@ -6484,13 +6516,13 @@ const Text = (_Z) => {
6484
6516
  );
6485
6517
  if (withTooltip) {
6486
6518
  return /* @__PURE__ */ jsx(
6487
- TextWithTooltip,
6519
+ DeprecatedTextWithTooltip,
6488
6520
  __spreadProps(__spreadValues(__spreadValues({
6489
6521
  as: Component2,
6490
6522
  className: baseClassName2,
6491
6523
  size,
6492
6524
  weight,
6493
- withTooltip
6525
+ withDeprecatedTooltip: withTooltip
6494
6526
  }, dataProperties), props), {
6495
6527
  children
6496
6528
  })
@@ -6498,14 +6530,14 @@ const Text = (_Z) => {
6498
6530
  }
6499
6531
  return /* @__PURE__ */ jsx(Component2, __spreadProps(__spreadValues(__spreadValues({}, props), dataProperties), { className: baseClassName2, children }));
6500
6532
  };
6501
- const TextWithTooltip = (_$) => {
6533
+ const DeprecatedTextWithTooltip = (_$) => {
6502
6534
  var _aa = _$, {
6503
6535
  as: Component2 = "p",
6504
6536
  className,
6505
6537
  children,
6506
6538
  size: _size = "md",
6507
6539
  weight: _weight = "normal",
6508
- withTooltip: _withTooltip = "whenTruncated",
6540
+ withDeprecatedTooltip: _withTooltip = "whenTruncated",
6509
6541
  tooltipOptions
6510
6542
  } = _aa, props = __objRest(_aa, [
6511
6543
  "as",
@@ -6513,7 +6545,7 @@ const TextWithTooltip = (_$) => {
6513
6545
  "children",
6514
6546
  "size",
6515
6547
  "weight",
6516
- "withTooltip",
6548
+ "withDeprecatedTooltip",
6517
6549
  "tooltipOptions"
6518
6550
  ]);
6519
6551
  const textElementRef = useRef();
@@ -6539,14 +6571,14 @@ const TextWithTooltip = (_$) => {
6539
6571
  tooltipOptions == null ? void 0 : tooltipOptions.contentClassName
6540
6572
  );
6541
6573
  return /* @__PURE__ */ jsxs(
6542
- Tooltip,
6574
+ DeprecatedTooltip,
6543
6575
  {
6544
6576
  disabled: !hoverStatus,
6545
6577
  offset: tooltipOptions == null ? void 0 : tooltipOptions.offset,
6546
6578
  shift: tooltipOptions == null ? void 0 : tooltipOptions.shift,
6547
6579
  children: [
6548
- /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsx(Component2, __spreadProps(__spreadValues({ className, ref: textElementRef }, props), { children })) }),
6549
- /* @__PURE__ */ jsx(TooltipContent, { className: contentClassName, children })
6580
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsx(Component2, __spreadProps(__spreadValues({ className, ref: textElementRef }, props), { children })) }),
6581
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: contentClassName, children })
6550
6582
  ]
6551
6583
  }
6552
6584
  );
@@ -6674,9 +6706,9 @@ const Badge = ({
6674
6706
  ] });
6675
6707
  content = onClick ? /* @__PURE__ */ jsx("button", __spreadProps(__spreadValues({ type: "button", role: "button" }, baseProps), { children: content })) : /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, baseProps), { children: content }));
6676
6708
  if (tooltip) {
6677
- return /* @__PURE__ */ jsxs(Tooltip, { offset: 12, children: [
6678
- /* @__PURE__ */ jsx(TooltipTrigger, { children: content }),
6679
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: tooltip })
6709
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { offset: 12, children: [
6710
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: content }),
6711
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: tooltip })
6680
6712
  ] });
6681
6713
  }
6682
6714
  return content;
@@ -7549,6 +7581,165 @@ const MenuItem$1 = forwardRef(
7549
7581
  );
7550
7582
  }
7551
7583
  );
7584
+ function useTruncationDetection(elementRef, options2 = {
7585
+ dependencies: [],
7586
+ checkFirstChild: false
7587
+ }) {
7588
+ const { checkFirstChild = false, dependencies = [] } = options2;
7589
+ const [isTruncated, setIsTruncated] = useState(false);
7590
+ const checkTruncation = useCallback(() => {
7591
+ if (!elementRef || !elementRef.current) {
7592
+ return;
7593
+ }
7594
+ const element = checkFirstChild ? elementRef.current.children[0] : elementRef.current;
7595
+ if (!element) {
7596
+ return;
7597
+ }
7598
+ const scrollWidth = element.scrollWidth;
7599
+ const clientWidth = element.clientWidth;
7600
+ const scrollHeight = element.scrollHeight;
7601
+ const clientHeight = element.clientHeight;
7602
+ const isHorizontallyOverflowing = Math.ceil(scrollWidth) > Math.ceil(clientWidth);
7603
+ const isVerticallyOverflowing = Math.ceil(scrollHeight) > Math.ceil(clientHeight);
7604
+ const isOverflowing = isHorizontallyOverflowing || isVerticallyOverflowing;
7605
+ setIsTruncated(isOverflowing);
7606
+ }, [elementRef, checkFirstChild, ...dependencies]);
7607
+ const DEBOUNCE_TIME_IN_MS = 450;
7608
+ const debouncedCheckTruncation = useMemo(
7609
+ () => debounce(checkTruncation, DEBOUNCE_TIME_IN_MS),
7610
+ [checkTruncation]
7611
+ );
7612
+ useResizeObserver(elementRef, debouncedCheckTruncation);
7613
+ useEffect(() => {
7614
+ const id = requestAnimationFrame(() => checkTruncation());
7615
+ return () => cancelAnimationFrame(id);
7616
+ }, [checkTruncation]);
7617
+ return isTruncated;
7618
+ }
7619
+ const CLASS_NAME$d = "Layer__Stack";
7620
+ const Stack = forwardRef(
7621
+ function Stack2(_na, ref) {
7622
+ var _oa = _na, {
7623
+ align,
7624
+ children,
7625
+ className,
7626
+ direction,
7627
+ gap,
7628
+ justify,
7629
+ overflow,
7630
+ pb,
7631
+ pbs,
7632
+ pbe,
7633
+ pi,
7634
+ pis,
7635
+ pie,
7636
+ fluid
7637
+ } = _oa, restProps = __objRest(_oa, [
7638
+ "align",
7639
+ "children",
7640
+ "className",
7641
+ "direction",
7642
+ "gap",
7643
+ "justify",
7644
+ "overflow",
7645
+ "pb",
7646
+ "pbs",
7647
+ "pbe",
7648
+ "pi",
7649
+ "pis",
7650
+ "pie",
7651
+ "fluid"
7652
+ ]);
7653
+ const dataProperties = toDataProperties({
7654
+ align,
7655
+ direction,
7656
+ gap,
7657
+ justify,
7658
+ overflow,
7659
+ pb,
7660
+ pbs,
7661
+ pbe,
7662
+ pi,
7663
+ pis,
7664
+ pie,
7665
+ fluid
7666
+ });
7667
+ return /* @__PURE__ */ jsx(
7668
+ "div",
7669
+ __spreadProps(__spreadValues(__spreadValues({
7670
+ ref
7671
+ }, restProps), dataProperties), {
7672
+ className: classNames(CLASS_NAME$d, className),
7673
+ children
7674
+ })
7675
+ );
7676
+ }
7677
+ );
7678
+ const VStack = forwardRef(
7679
+ function VStack2(props, ref) {
7680
+ return /* @__PURE__ */ jsx(Stack, __spreadProps(__spreadValues({}, props), { ref, direction: "column" }));
7681
+ }
7682
+ );
7683
+ const HStack = forwardRef(
7684
+ function HStack2(props, ref) {
7685
+ return /* @__PURE__ */ jsx(Stack, __spreadProps(__spreadValues({}, props), { ref, direction: "row" }));
7686
+ }
7687
+ );
7688
+ const Spacer = () => /* @__PURE__ */ jsx("div", { className: "Layer__Spacer" });
7689
+ const Tooltip = (_pa) => {
7690
+ var _qa = _pa, {
7691
+ children
7692
+ } = _qa, options2 = __objRest(_qa, [
7693
+ "children"
7694
+ ]);
7695
+ const tooltip = useTooltip(options2);
7696
+ return /* @__PURE__ */ jsx(TooltipContext.Provider, { value: tooltip, children });
7697
+ };
7698
+ const TooltipTrigger2 = forwardRef(function TooltipTrigger22(_ra, propRef) {
7699
+ var _sa = _ra, { children, asChild = false, wordBreak } = _sa, props = __objRest(_sa, ["children", "asChild", "wordBreak"]);
7700
+ const context = useTooltipContext();
7701
+ const childrenRef = isValidElement(children) && "ref" in children ? children.ref : null;
7702
+ const ref = useMergeRefs([context.refs.setReference, propRef, childrenRef]);
7703
+ if (asChild && isValidElement(children)) {
7704
+ return cloneElement(
7705
+ children,
7706
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
7707
+ context.getReferenceProps(__spreadProps(__spreadValues(__spreadValues({
7708
+ ref
7709
+ }, props), children.props), {
7710
+ "data-state": context.open ? "open" : "closed",
7711
+ "data-word-break": wordBreak
7712
+ }))
7713
+ );
7714
+ }
7715
+ return /* @__PURE__ */ jsx(
7716
+ HStack,
7717
+ __spreadProps(__spreadValues({
7718
+ ref,
7719
+ "data-state": context.open ? "open" : "closed",
7720
+ className: classNames("Layer__UI__tooltip-trigger")
7721
+ }, context.getReferenceProps(props)), {
7722
+ children
7723
+ })
7724
+ );
7725
+ });
7726
+ const TooltipContent2 = forwardRef(function TooltipContent22(_ta, propRef) {
7727
+ var _ua = _ta, { className, width, wordBreak } = _ua, props = __objRest(_ua, ["className", "width", "wordBreak"]);
7728
+ const context = useTooltipContext();
7729
+ const ref = useMergeRefs([context.refs.setFloating, propRef]);
7730
+ const dataProperties = toDataProperties({ width, "word-break": wordBreak });
7731
+ if (!context.open || context.disabled) return null;
7732
+ return /* @__PURE__ */ jsx(FloatingPortal, { children: /* @__PURE__ */ jsx(
7733
+ "div",
7734
+ __spreadProps(__spreadValues(__spreadValues({
7735
+ ref,
7736
+ className: classNames("Layer__UI__tooltip", className),
7737
+ style: __spreadValues({}, context.floatingStyles)
7738
+ }, dataProperties), context.getFloatingProps(props)), {
7739
+ children: /* @__PURE__ */ jsx("div", { className: "Layer__UI__tooltip-content", style: __spreadValues({}, context.styles), children: props.children })
7740
+ })
7741
+ ) });
7742
+ });
7552
7743
  function splitTextProps(props) {
7553
7744
  const _a = props, {
7554
7745
  align,
@@ -7622,13 +7813,50 @@ const P = forwardRef(
7622
7813
  }
7623
7814
  );
7624
7815
  const SPAN_CLASS_NAME = "Layer__Span";
7816
+ const BaseSpan = forwardRef(({ dataProperties, restProps, hasRef, className, renderingProps, children }, ref) => {
7817
+ if (renderingProps.nonAria) {
7818
+ return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(SPAN_CLASS_NAME, className), ref: hasRef ? ref : void 0, children }));
7819
+ }
7820
+ return /* @__PURE__ */ jsx(Text$1, __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(SPAN_CLASS_NAME, className), ref: hasRef ? ref : void 0, children }));
7821
+ });
7822
+ BaseSpan.displayName = "BaseSpan";
7625
7823
  const Span = forwardRef(
7626
- function Span2(props, ref) {
7824
+ function Span2(props, forwardedRef) {
7627
7825
  const { children, dataProperties, renderingProps, restProps } = splitTextProps(props);
7628
- if (renderingProps.nonAria) {
7629
- return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: SPAN_CLASS_NAME, ref, children }));
7826
+ const { className, tooltipContentWidth = "md" } = props;
7827
+ const internalRef = useRef(null);
7828
+ const isTruncated = useTruncationDetection(internalRef, { checkFirstChild: true });
7829
+ const mergedRef = mergeRefs([internalRef, forwardedRef]);
7830
+ if (props.withTooltip) {
7831
+ const dataPropertiesWithEllipsis = __spreadProps(__spreadValues({}, dataProperties), { "data-with-tooltip": true });
7832
+ return /* @__PURE__ */ jsxs(Tooltip, { disabled: !isTruncated, children: [
7833
+ /* @__PURE__ */ jsx(TooltipTrigger2, { children: /* @__PURE__ */ jsx(
7834
+ BaseSpan,
7835
+ {
7836
+ dataProperties: dataPropertiesWithEllipsis,
7837
+ restProps,
7838
+ hasRef: true,
7839
+ className,
7840
+ renderingProps,
7841
+ ref: mergedRef,
7842
+ children
7843
+ }
7844
+ ) }),
7845
+ /* @__PURE__ */ jsx(TooltipContent2, { width: tooltipContentWidth, children: /* @__PURE__ */ jsx("span", { className: "Layer__UI__tooltip-content--text", children }) })
7846
+ ] });
7630
7847
  }
7631
- return /* @__PURE__ */ jsx(Text$1, __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: SPAN_CLASS_NAME, ref, children }));
7848
+ return /* @__PURE__ */ jsx(
7849
+ BaseSpan,
7850
+ {
7851
+ dataProperties,
7852
+ restProps,
7853
+ hasRef: true,
7854
+ className,
7855
+ renderingProps,
7856
+ ref: mergedRef,
7857
+ children
7858
+ }
7859
+ );
7632
7860
  }
7633
7861
  );
7634
7862
  function LinkedAccountPill({ label, items }) {
@@ -7666,8 +7894,8 @@ function LinkedAccountPill({ label, items }) {
7666
7894
  const BASE_MODAL_OVERLAY_CLASS_NAME = "Layer__ModalOverlay";
7667
7895
  const MODAL_OVERLAY_CLASS_NAME = `Layer__Portal ${BASE_MODAL_OVERLAY_CLASS_NAME}`;
7668
7896
  const ModalOverlay = forwardRef(
7669
- (_na, ref) => {
7670
- var _oa = _na, { variant } = _oa, restProps = __objRest(_oa, ["variant"]);
7897
+ (_va, ref) => {
7898
+ var _wa = _va, { variant } = _wa, restProps = __objRest(_wa, ["variant"]);
7671
7899
  const dataProperties = toDataProperties({ variant });
7672
7900
  return /* @__PURE__ */ jsx(
7673
7901
  ModalOverlay$1,
@@ -7694,8 +7922,8 @@ const InternalModal = forwardRef(({ children, flexBlock, size, variant = "center
7694
7922
  InternalModal.displayName = "Modal";
7695
7923
  const DIALOG_CLASS_NAME = "Layer__Dialog";
7696
7924
  const Dialog = forwardRef(
7697
- (_pa, ref) => {
7698
- var _qa = _pa, { variant = "center" } = _qa, restProps = __objRest(_qa, ["variant"]);
7925
+ (_xa, ref) => {
7926
+ var _ya = _xa, { variant = "center" } = _ya, restProps = __objRest(_ya, ["variant"]);
7699
7927
  const dataProperties = toDataProperties({ variant });
7700
7928
  return /* @__PURE__ */ jsx(
7701
7929
  Dialog$1,
@@ -7731,9 +7959,9 @@ function Drawer({
7731
7959
  }) {
7732
7960
  return /* @__PURE__ */ jsx(ModalOverlay, { isOpen, onOpenChange, variant, isDismissable, children: /* @__PURE__ */ jsx(InternalModal, { flexBlock, size, variant, children: /* @__PURE__ */ jsx(Dialog, { role: role != null ? role : "dialog", "aria-label": ariaLabel, variant, children }) }) });
7733
7961
  }
7734
- const CLASS_NAME$d = "Layer__LoadingSpinner";
7962
+ const CLASS_NAME$c = "Layer__LoadingSpinner";
7735
7963
  function LoadingSpinner({ size }) {
7736
- return /* @__PURE__ */ jsx(LoaderCircle, { className: CLASS_NAME$d, size });
7964
+ return /* @__PURE__ */ jsx(LoaderCircle, { className: CLASS_NAME$c, size });
7737
7965
  }
7738
7966
  const BUTTON_CLASS_NAMES = {
7739
7967
  DEFAULT: "Layer__UI__Button",
@@ -7747,15 +7975,15 @@ function ButtonSpinner({ size }) {
7747
7975
  function ButtonTransparentContent({ children }) {
7748
7976
  return /* @__PURE__ */ jsx("span", { className: BUTTON_CLASS_NAMES.TRANSPARENT_CONTENT, children });
7749
7977
  }
7750
- const Button = forwardRef((_ra, ref) => {
7751
- var _sa = _ra, {
7978
+ const Button = forwardRef((_za, ref) => {
7979
+ var _Aa = _za, {
7752
7980
  children,
7753
7981
  ellipsis,
7754
7982
  icon,
7755
7983
  inset,
7756
7984
  size = "md",
7757
7985
  variant = "solid"
7758
- } = _sa, restProps = __objRest(_sa, [
7986
+ } = _Aa, restProps = __objRest(_Aa, [
7759
7987
  "children",
7760
7988
  "ellipsis",
7761
7989
  "icon",
@@ -7790,8 +8018,8 @@ const Button = forwardRef((_ra, ref) => {
7790
8018
  });
7791
8019
  Button.displayName = "Button";
7792
8020
  const HEADING_CLASS_NAME = "Layer__UI__Heading";
7793
- const Heading = forwardRef((_ta, ref) => {
7794
- var _ua = _ta, { align, pie, pbe, size, variant, weight, ellipsis, className } = _ua, restProps = __objRest(_ua, ["align", "pie", "pbe", "size", "variant", "weight", "ellipsis", "className"]);
8021
+ const Heading = forwardRef((_Ba, ref) => {
8022
+ var _Ca = _Ba, { align, pie, pbe, size, variant, weight, ellipsis, className } = _Ca, restProps = __objRest(_Ca, ["align", "pie", "pbe", "size", "variant", "weight", "ellipsis", "className"]);
7795
8023
  const dataProperties = toDataProperties({ pbe, pie, size, align, variant, weight, ellipsis });
7796
8024
  return /* @__PURE__ */ jsx(
7797
8025
  Heading$2,
@@ -7802,76 +8030,6 @@ const Heading = forwardRef((_ta, ref) => {
7802
8030
  );
7803
8031
  });
7804
8032
  Heading.displayName = "Heading";
7805
- const CLASS_NAME$c = "Layer__Stack";
7806
- const Stack = forwardRef(
7807
- function Stack2(_va, ref) {
7808
- var _wa = _va, {
7809
- align,
7810
- children,
7811
- className,
7812
- direction,
7813
- gap,
7814
- justify,
7815
- overflow,
7816
- pb,
7817
- pbs,
7818
- pbe,
7819
- pi,
7820
- pis,
7821
- pie,
7822
- fluid
7823
- } = _wa, restProps = __objRest(_wa, [
7824
- "align",
7825
- "children",
7826
- "className",
7827
- "direction",
7828
- "gap",
7829
- "justify",
7830
- "overflow",
7831
- "pb",
7832
- "pbs",
7833
- "pbe",
7834
- "pi",
7835
- "pis",
7836
- "pie",
7837
- "fluid"
7838
- ]);
7839
- const dataProperties = toDataProperties({
7840
- align,
7841
- direction,
7842
- gap,
7843
- justify,
7844
- overflow,
7845
- pb,
7846
- pbs,
7847
- pbe,
7848
- pi,
7849
- pis,
7850
- pie,
7851
- fluid
7852
- });
7853
- return /* @__PURE__ */ jsx(
7854
- "div",
7855
- __spreadProps(__spreadValues(__spreadValues({
7856
- ref
7857
- }, restProps), dataProperties), {
7858
- className: classNames(CLASS_NAME$c, className),
7859
- children
7860
- })
7861
- );
7862
- }
7863
- );
7864
- const VStack = forwardRef(
7865
- function VStack2(props, ref) {
7866
- return /* @__PURE__ */ jsx(Stack, __spreadProps(__spreadValues({}, props), { ref, direction: "column" }));
7867
- }
7868
- );
7869
- const HStack = forwardRef(
7870
- function HStack2(props, ref) {
7871
- return /* @__PURE__ */ jsx(Stack, __spreadProps(__spreadValues({}, props), { ref, direction: "row" }));
7872
- }
7873
- );
7874
- const Spacer = () => /* @__PURE__ */ jsx("div", { className: "Layer__Spacer" });
7875
8033
  const Separator = ({ mbs, mbe }) => {
7876
8034
  const dataProperties = toDataProperties({ mbs, mbe });
7877
8035
  return /* @__PURE__ */ jsx("div", __spreadValues({ className: "Layer__separator" }, dataProperties));
@@ -8201,8 +8359,8 @@ function ConditionalList({
8201
8359
  return Container2 ? /* @__PURE__ */ jsx(Container2, { children: listItems }) : listItems;
8202
8360
  }
8203
8361
  const CLASS_NAME$b = "Layer__Checkbox";
8204
- function Checkbox(_xa) {
8205
- var _ya = _xa, { children, className, variant = "default", size = "md", isIndeterminate } = _ya, props = __objRest(_ya, ["children", "className", "variant", "size", "isIndeterminate"]);
8362
+ function Checkbox(_Da) {
8363
+ var _Ea = _Da, { children, className, variant = "default", size = "md", isIndeterminate } = _Ea, props = __objRest(_Ea, ["children", "className", "variant", "size", "isIndeterminate"]);
8206
8364
  const dataProperties = useMemo(() => toDataProperties({
8207
8365
  size,
8208
8366
  variant,
@@ -8220,11 +8378,11 @@ function Checkbox(_xa) {
8220
8378
  })
8221
8379
  );
8222
8380
  }
8223
- function CheckboxWithTooltip(_za) {
8224
- var _Aa = _za, { tooltip } = _Aa, props = __objRest(_Aa, ["tooltip"]);
8225
- return /* @__PURE__ */ jsx("div", { className: "Layer__checkbox-wrapper", children: /* @__PURE__ */ jsxs(Tooltip, { disabled: !tooltip, children: [
8226
- /* @__PURE__ */ jsx(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx(Checkbox, __spreadValues({}, props)) }),
8227
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: tooltip })
8381
+ function CheckboxWithTooltip(_Fa) {
8382
+ var _Ga = _Fa, { tooltip } = _Ga, props = __objRest(_Ga, ["tooltip"]);
8383
+ return /* @__PURE__ */ jsx("div", { className: "Layer__checkbox-wrapper", children: /* @__PURE__ */ jsxs(DeprecatedTooltip, { disabled: !tooltip, children: [
8384
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx(Checkbox, __spreadValues({}, props)) }),
8385
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: tooltip })
8228
8386
  ] }) });
8229
8387
  }
8230
8388
  const CLASS_NAME$a = "Layer__BasicLinkedAccountContainer";
@@ -8566,13 +8724,13 @@ const isDateAllowedToBrowse = (date, business) => {
8566
8724
  }
8567
8725
  return differenceInCalendarMonths(startOfMonth(date), activationDate) >= 0;
8568
8726
  };
8569
- const Input$1 = (_Ba) => {
8570
- var _Ca = _Ba, {
8727
+ const Input$1 = (_Ha) => {
8728
+ var _Ia = _Ha, {
8571
8729
  className,
8572
8730
  isInvalid,
8573
8731
  errorMessage,
8574
8732
  leftText
8575
- } = _Ca, props = __objRest(_Ca, [
8733
+ } = _Ia, props = __objRest(_Ia, [
8576
8734
  "className",
8577
8735
  "isInvalid",
8578
8736
  "errorMessage",
@@ -8584,12 +8742,12 @@ const Input$1 = (_Ba) => {
8584
8742
  leftText ? "Layer__input--with-left-text" : "",
8585
8743
  className
8586
8744
  );
8587
- return /* @__PURE__ */ jsxs(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
8588
- /* @__PURE__ */ jsxs(TooltipTrigger, { className: "Layer__input-tooltip", children: [
8745
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { disabled: !isInvalid || !errorMessage, children: [
8746
+ /* @__PURE__ */ jsxs(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: [
8589
8747
  /* @__PURE__ */ jsx("input", __spreadProps(__spreadValues({}, props), { className: baseClassName2 })),
8590
8748
  leftText && /* @__PURE__ */ jsx("span", { className: "Layer__input-left-text", children: leftText })
8591
8749
  ] }),
8592
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: errorMessage })
8750
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
8593
8751
  ] });
8594
8752
  };
8595
8753
  const InputGroup$1 = ({
@@ -8618,8 +8776,8 @@ const InputGroup$1 = ({
8618
8776
  children
8619
8777
  ] });
8620
8778
  };
8621
- const UploadCloud = (_Da) => {
8622
- var _Ea = _Da, { size = 18 } = _Ea, props = __objRest(_Ea, ["size"]);
8779
+ const UploadCloud = (_Ja) => {
8780
+ var _Ka = _Ja, { size = 18 } = _Ka, props = __objRest(_Ka, ["size"]);
8623
8781
  return /* @__PURE__ */ jsxs(
8624
8782
  "svg",
8625
8783
  __spreadProps(__spreadValues({
@@ -8730,8 +8888,8 @@ const FileInput = ({
8730
8888
  )
8731
8889
  ] });
8732
8890
  };
8733
- const ChevronDownFill = (_Fa) => {
8734
- var _Ga = _Fa, { size = 18 } = _Ga, props = __objRest(_Ga, ["size"]);
8891
+ const ChevronDownFill = (_La) => {
8892
+ var _Ma = _La, { size = 18 } = _Ma, props = __objRest(_Ma, ["size"]);
8735
8893
  return /* @__PURE__ */ jsxs(
8736
8894
  "svg",
8737
8895
  __spreadProps(__spreadValues({
@@ -8777,8 +8935,8 @@ const Select = ({
8777
8935
  className
8778
8936
  );
8779
8937
  const DropdownIndicator = useCallback((props) => /* @__PURE__ */ jsx(components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx(ChevronDownFill, {}) })), []);
8780
- return /* @__PURE__ */ jsxs(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
8781
- /* @__PURE__ */ jsx(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx(
8938
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { disabled: !isInvalid || !errorMessage, children: [
8939
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx(
8782
8940
  Select$1,
8783
8941
  {
8784
8942
  inputId,
@@ -8797,7 +8955,7 @@ const Select = ({
8797
8955
  isDisabled: disabled
8798
8956
  }
8799
8957
  ) }),
8800
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: errorMessage })
8958
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
8801
8959
  ] });
8802
8960
  };
8803
8961
  const MultiSelect = ({
@@ -8822,8 +8980,8 @@ const MultiSelect = ({
8822
8980
  className
8823
8981
  );
8824
8982
  const DropdownIndicator = useCallback((props) => /* @__PURE__ */ jsx(components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx(ChevronDownFill, {}) })), []);
8825
- return /* @__PURE__ */ jsxs(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
8826
- /* @__PURE__ */ jsx(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx(
8983
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { disabled: !isInvalid || !errorMessage, children: [
8984
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx(
8827
8985
  Select$1,
8828
8986
  {
8829
8987
  inputId,
@@ -8845,7 +9003,7 @@ const MultiSelect = ({
8845
9003
  isMulti: true
8846
9004
  }
8847
9005
  ) }),
8848
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: errorMessage })
9006
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
8849
9007
  ] });
8850
9008
  };
8851
9009
  const transformCurrencyValue = (rawValue) => {
@@ -8858,8 +9016,8 @@ const transformCurrencyValue = (rawValue) => {
8858
9016
  }
8859
9017
  return cleaned;
8860
9018
  };
8861
- const AmountInput = (_Ha) => {
8862
- var _Ia = _Ha, {
9019
+ const AmountInput = (_Na) => {
9020
+ var _Oa = _Na, {
8863
9021
  onChange,
8864
9022
  className,
8865
9023
  leftText,
@@ -8867,7 +9025,7 @@ const AmountInput = (_Ha) => {
8867
9025
  isInvalid,
8868
9026
  badge,
8869
9027
  placeholder = "$0.00"
8870
- } = _Ia, props = __objRest(_Ia, [
9028
+ } = _Oa, props = __objRest(_Oa, [
8871
9029
  "onChange",
8872
9030
  "className",
8873
9031
  "leftText",
@@ -8901,15 +9059,15 @@ const AmountInput = (_Ha) => {
8901
9059
  className: baseClassName2
8902
9060
  })
8903
9061
  );
8904
- return /* @__PURE__ */ jsxs(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
8905
- /* @__PURE__ */ jsxs(TooltipTrigger, { className: "Layer__input-tooltip", children: [
9062
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { disabled: !isInvalid || !errorMessage, children: [
9063
+ /* @__PURE__ */ jsxs(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: [
8906
9064
  badge ? /* @__PURE__ */ jsxs("div", { className: "Layer__input-with-badge", children: [
8907
9065
  currencyInput,
8908
9066
  badge
8909
9067
  ] }) : currencyInput,
8910
9068
  leftText && /* @__PURE__ */ jsx("span", { className: "Layer__input-left-text", children: leftText })
8911
9069
  ] }),
8912
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: errorMessage })
9070
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
8913
9071
  ] });
8914
9072
  };
8915
9073
  const DATE_FORMAT$1 = "LLL d, yyyy";
@@ -8953,8 +9111,8 @@ function useSizeClass() {
8953
9111
  isDesktop: sizeClass === "desktop"
8954
9112
  };
8955
9113
  }
8956
- const ChevronLeft = (_Ja) => {
8957
- var props = __objRest(_Ja, []);
9114
+ const ChevronLeft = (_Pa) => {
9115
+ var props = __objRest(_Pa, []);
8958
9116
  return /* @__PURE__ */ jsx(
8959
9117
  "svg",
8960
9118
  __spreadProps(__spreadValues({
@@ -9082,8 +9240,8 @@ const getDateFormat = (mode) => {
9082
9240
  });
9083
9241
  }
9084
9242
  };
9085
- const DeprecatedDatePicker = (_Ka) => {
9086
- var _La = _Ka, {
9243
+ const DeprecatedDatePicker = (_Qa) => {
9244
+ var _Ra = _Qa, {
9087
9245
  selected,
9088
9246
  onChange,
9089
9247
  disabled,
@@ -9104,7 +9262,7 @@ const DeprecatedDatePicker = (_Ka) => {
9104
9262
  highlightYears,
9105
9263
  onChangeMode,
9106
9264
  slots
9107
- } = _La, props = __objRest(_La, [
9265
+ } = _Ra, props = __objRest(_Ra, [
9108
9266
  "selected",
9109
9267
  "onChange",
9110
9268
  "disabled",
@@ -9931,8 +10089,8 @@ const useIsVisible = (ref) => {
9931
10089
  }, [ref]);
9932
10090
  return isIntersecting;
9933
10091
  };
9934
- const File = (_Ma) => {
9935
- var _Na = _Ma, { size = 12 } = _Na, props = __objRest(_Na, ["size"]);
10092
+ const File = (_Sa) => {
10093
+ var _Ta = _Sa, { size = 12 } = _Ta, props = __objRest(_Ta, ["size"]);
9936
10094
  return /* @__PURE__ */ jsxs(
9937
10095
  "svg",
9938
10096
  __spreadProps(__spreadValues({
@@ -9992,8 +10150,8 @@ const File = (_Ma) => {
9992
10150
  })
9993
10151
  );
9994
10152
  };
9995
- const ScissorsFullOpen = (_Oa) => {
9996
- var _Pa = _Oa, { size = 12 } = _Pa, props = __objRest(_Pa, ["size"]);
10153
+ const ScissorsFullOpen = (_Ua) => {
10154
+ var _Va = _Ua, { size = 12 } = _Va, props = __objRest(_Va, ["size"]);
9997
10155
  return /* @__PURE__ */ jsx(
9998
10156
  "svg",
9999
10157
  __spreadProps(__spreadValues({
@@ -10058,8 +10216,8 @@ const ScissorsFullOpen = (_Oa) => {
10058
10216
  })
10059
10217
  );
10060
10218
  };
10061
- const Trash = (_Qa) => {
10062
- var _Ra = _Qa, { size = 18 } = _Ra, props = __objRest(_Ra, ["size"]);
10219
+ const Trash = (_Wa) => {
10220
+ var _Xa = _Wa, { size = 18 } = _Xa, props = __objRest(_Xa, ["size"]);
10063
10221
  return /* @__PURE__ */ jsxs(
10064
10222
  "svg",
10065
10223
  __spreadProps(__spreadValues({
@@ -10110,44 +10268,6 @@ const Trash = (_Qa) => {
10110
10268
  })
10111
10269
  );
10112
10270
  };
10113
- var CategorizationType = /* @__PURE__ */ ((CategorizationType2) => {
10114
- CategorizationType2["AUTO"] = "AUTO";
10115
- CategorizationType2["ASK_FROM_SUGGESTIONS"] = "ASK_FROM_SUGGESTIONS";
10116
- CategorizationType2["MEALS"] = "MEALS";
10117
- CategorizationType2["BUSINESS_TRAVEL_TRANSPORTATION"] = "BUSINESS_TRAVEL_TRANSPORTATION";
10118
- return CategorizationType2;
10119
- })(CategorizationType || {});
10120
- function hasSuggestions(categorization) {
10121
- return categorization != null && categorization.suggestions !== void 0 && categorization.suggestions.length > 0;
10122
- }
10123
- const accountIdentifierIsForCategory = (accountIdentifier, category) => {
10124
- if (accountIdentifier.type === "AccountId") {
10125
- switch (category.type) {
10126
- case "AccountNested":
10127
- return AccountIdEquivalence(accountIdentifier, makeAccountId(category.id));
10128
- case "OptionalAccountNested":
10129
- return false;
10130
- case "ExclusionNested":
10131
- return false;
10132
- }
10133
- }
10134
- switch (category.type) {
10135
- case "AccountNested":
10136
- return category.stableName ? AccountStableNameEquivalence(accountIdentifier, makeStableName(category.stableName)) : false;
10137
- case "OptionalAccountNested":
10138
- return AccountStableNameEquivalence(accountIdentifier, makeStableName(category.stableName));
10139
- case "ExclusionNested":
10140
- return false;
10141
- }
10142
- };
10143
- const getLeafCategories$2 = (categories) => {
10144
- return categories.flatMap((category) => {
10145
- if (!category.subCategories || category.subCategories.length === 0) {
10146
- return [category];
10147
- }
10148
- return getLeafCategories$2(category.subCategories);
10149
- });
10150
- };
10151
10271
  const ReceiptsContext = createContext({
10152
10272
  receiptUrls: [],
10153
10273
  uploadReceipt: () => Promise.resolve(),
@@ -10292,8 +10412,8 @@ const ReceiptsProvider = ({
10292
10412
  const contextData = useReceipts({ bankTransaction, isActive });
10293
10413
  return /* @__PURE__ */ jsx(ReceiptsContext.Provider, { value: contextData, children });
10294
10414
  };
10295
- const Eye = (_Sa) => {
10296
- var _Ta = _Sa, { size = 18 } = _Ta, props = __objRest(_Ta, ["size"]);
10415
+ const Eye = (_Ya) => {
10416
+ var _Za = _Ya, { size = 18 } = _Za, props = __objRest(_Za, ["size"]);
10297
10417
  return /* @__PURE__ */ jsx(
10298
10418
  "svg",
10299
10419
  __spreadProps(__spreadValues({
@@ -10446,8 +10566,8 @@ const openReceiptInNewTab = (url, index) => (e) => {
10446
10566
  `);
10447
10567
  }
10448
10568
  };
10449
- const BankTransactionReceiptsWithProvider = forwardRef((_Ua, ref) => {
10450
- var _Va = _Ua, { bankTransaction, isActive } = _Va, props = __objRest(_Va, ["bankTransaction", "isActive"]);
10569
+ const BankTransactionReceiptsWithProvider = forwardRef((__a, ref) => {
10570
+ var _$a = __a, { bankTransaction, isActive } = _$a, props = __objRest(_$a, ["bankTransaction", "isActive"]);
10451
10571
  return /* @__PURE__ */ jsx(ReceiptsProvider, { bankTransaction, isActive, children: /* @__PURE__ */ jsx(BankTransactionReceipts, __spreadProps(__spreadValues({}, props), { ref })) });
10452
10572
  });
10453
10573
  BankTransactionReceiptsWithProvider.displayName = "BankTransactionReceiptsWithProvider";
@@ -10499,8 +10619,8 @@ const BankTransactionReceipts = forwardRef(
10499
10619
  );
10500
10620
  BankTransactionReceipts.displayName = "BankTransactionReceipts";
10501
10621
  const PORTAL_CLASS_NAME = "Layer__Portal";
10502
- const Check = (_Wa) => {
10503
- var _Xa = _Wa, { size = 18 } = _Xa, props = __objRest(_Xa, ["size"]);
10622
+ const Check = (_ab) => {
10623
+ var _bb = _ab, { size = 18 } = _bb, props = __objRest(_bb, ["size"]);
10504
10624
  return /* @__PURE__ */ jsx(
10505
10625
  "svg",
10506
10626
  __spreadProps(__spreadValues({
@@ -10696,8 +10816,8 @@ function buildCustomMenuPortal() {
10696
10816
  );
10697
10817
  };
10698
10818
  }
10699
- function ComboBox(_Ya) {
10700
- var _Za = _Ya, {
10819
+ function ComboBox(_cb) {
10820
+ var _db = _cb, {
10701
10821
  className,
10702
10822
  selectedValue,
10703
10823
  onSelectedValueChange,
@@ -10715,7 +10835,7 @@ function ComboBox(_Ya) {
10715
10835
  isClearable = true,
10716
10836
  isReadOnly = false,
10717
10837
  displayDisabledAsSelected
10718
- } = _Za, ariaProps = __objRest(_Za, [
10838
+ } = _db, ariaProps = __objRest(_db, [
10719
10839
  "className",
10720
10840
  "selectedValue",
10721
10841
  "onSelectedValueChange",
@@ -10761,7 +10881,7 @@ function ComboBox(_Ya) {
10761
10881
  const CustomClearIndicatorRef = useRef(buildCustomClearIndicator());
10762
10882
  const CustomLoadingIndicatorRef = useRef(buildCustomLoadingIndicator());
10763
10883
  const CustomDropdownIndicatorRef = useRef(buildCustomDropdownIndicator());
10764
- return /* @__PURE__ */ jsxs(VStack, { gap: "3xs", fluid: true, children: [
10884
+ return /* @__PURE__ */ jsxs(VStack, { gap: "3xs", fluid: true, className: className ? `${className}__Container` : void 0, children: [
10765
10885
  /* @__PURE__ */ jsx(
10766
10886
  Select$1,
10767
10887
  __spreadProps(__spreadValues({
@@ -11014,7 +11134,8 @@ const TagDimensionsGroup = ({
11014
11134
  onChange,
11015
11135
  showLabels = false,
11016
11136
  isReadOnly = false,
11017
- isEnabled = true
11137
+ isEnabled = true,
11138
+ className
11018
11139
  }) => {
11019
11140
  var _a;
11020
11141
  const { accountingConfiguration } = useLayerContext();
@@ -11031,10 +11152,10 @@ const TagDimensionsGroup = ({
11031
11152
  (tag) => tag.key.toLowerCase() === dimensionKey.toLowerCase()
11032
11153
  )) != null ? _a2 : null;
11033
11154
  };
11034
- if (!isEnabled) {
11155
+ if (!isEnabled || (accountingConfiguration == null ? void 0 : accountingConfiguration.platformDisplayTags.length) === 0) {
11035
11156
  return null;
11036
11157
  }
11037
- return /* @__PURE__ */ jsx(Fragment, { children: ((_a = accountingConfiguration == null ? void 0 : accountingConfiguration.platformDisplayTags) != null ? _a : []).map((dimension) => /* @__PURE__ */ jsx(
11158
+ return /* @__PURE__ */ jsx(HStack, { gap: "xs", className, children: ((_a = accountingConfiguration == null ? void 0 : accountingConfiguration.platformDisplayTags) != null ? _a : []).map((dimension) => /* @__PURE__ */ jsx(
11038
11159
  TagDimensionCombobox,
11039
11160
  {
11040
11161
  dimensionKey: dimension.key,
@@ -11490,22 +11611,6 @@ function CustomerVendorSelector({
11490
11611
  )
11491
11612
  ] });
11492
11613
  }
11493
- const CustomerVendorTypeSchema = Schema.Literal("CUSTOMER", "VENDOR");
11494
- const DiscriminatedCustomerSchema = Schema.Struct(__spreadProps(__spreadValues({}, CustomerSchema.fields), {
11495
- customerVendorType: CustomerVendorTypeSchema.pipe(
11496
- Schema.pickLiteral("CUSTOMER")
11497
- )
11498
- }));
11499
- const DiscriminatedVendorSchema = Schema.Struct(__spreadProps(__spreadValues({}, VendorSchema.fields), {
11500
- customerVendorType: CustomerVendorTypeSchema.pipe(
11501
- Schema.pickLiteral("VENDOR")
11502
- )
11503
- }));
11504
- const CustomerVendorSchema = Schema.Union(
11505
- DiscriminatedCustomerSchema,
11506
- DiscriminatedVendorSchema
11507
- );
11508
- const decodeCustomerVendor = Schema.decodeSync(CustomerVendorSchema);
11509
11614
  const TAG_BANK_TRANSACTION_TAG_KEY = "#tag-bank-transaction";
11510
11615
  const tagBankTransaction = post(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/tags`);
11511
11616
  function buildKey$P({
@@ -11927,8 +12032,8 @@ function isCategorizationEnabledForStatus(status) {
11927
12032
  }
11928
12033
  }
11929
12034
  }
11930
- const MinimizeTwo = (__a) => {
11931
- var _$a = __a, { size = 18 } = _$a, props = __objRest(_$a, ["size"]);
12035
+ const MinimizeTwo = (_eb) => {
12036
+ var _fb = _eb, { size = 18 } = _fb, props = __objRest(_fb, ["size"]);
11932
12037
  return /* @__PURE__ */ jsxs(
11933
12038
  "svg",
11934
12039
  __spreadProps(__spreadValues({
@@ -12010,7 +12115,7 @@ const MatchForm$1 = ({
12010
12115
  classNamePrefix,
12011
12116
  bankTransaction,
12012
12117
  selectedMatchId,
12013
- setSelectedMatchId,
12118
+ setSelectedMatch,
12014
12119
  matchFormError,
12015
12120
  readOnly = false
12016
12121
  }) => {
@@ -12049,7 +12154,7 @@ const MatchForm$1 = ({
12049
12154
  if (readOnly === true) {
12050
12155
  return;
12051
12156
  }
12052
- setSelectedMatchId(suggestedMatch.id);
12157
+ setSelectedMatch(suggestedMatch);
12053
12158
  },
12054
12159
  children: [
12055
12160
  /* @__PURE__ */ jsx("div", { className: `Layer__nowrap ${classNamePrefix}__match-table__date`, children: /* @__PURE__ */ jsx("span", { children: format(parseISO(suggestedMatch.details.date), DATE_FORMAT$1) }) }),
@@ -12057,7 +12162,7 @@ const MatchForm$1 = ({
12057
12162
  Text,
12058
12163
  {
12059
12164
  className: `${classNamePrefix}__match-table__desc-tooltip`,
12060
- withTooltip: TextUseTooltip.whenTruncated,
12165
+ withDeprecatedTooltip: TextUseTooltip.whenTruncated,
12061
12166
  as: "span",
12062
12167
  children: suggestedMatch.details.description
12063
12168
  }
@@ -12094,7 +12199,7 @@ const MatchFormMobile = ({
12094
12199
  classNamePrefix,
12095
12200
  bankTransaction,
12096
12201
  selectedMatchId,
12097
- setSelectedMatchId,
12202
+ setSelectedMatch,
12098
12203
  matchFormError,
12099
12204
  readOnly
12100
12205
  }) => {
@@ -12115,7 +12220,7 @@ const MatchFormMobile = ({
12115
12220
  if (readOnly) {
12116
12221
  return;
12117
12222
  }
12118
- setSelectedMatchId(match.id);
12223
+ setSelectedMatch(match);
12119
12224
  },
12120
12225
  children: [
12121
12226
  /* @__PURE__ */ jsxs("div", { className: `${classNamePrefix}__match-item__col-details`, children: [
@@ -12282,8 +12387,8 @@ const ToggleOption = ({
12282
12387
  "Layer__toggle-option--active": checked
12283
12388
  });
12284
12389
  if (disabled) {
12285
- return /* @__PURE__ */ jsxs(Tooltip, { children: [
12286
- /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsxs(
12390
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { children: [
12391
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsxs(
12287
12392
  "label",
12288
12393
  {
12289
12394
  className: optionClassName,
@@ -12309,7 +12414,7 @@ const ToggleOption = ({
12309
12414
  ]
12310
12415
  }
12311
12416
  ) }),
12312
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: disabledMessage })
12417
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: disabledMessage })
12313
12418
  ] });
12314
12419
  }
12315
12420
  return /* @__PURE__ */ jsxs("label", { className: optionClassName, "data-checked": checked, style, children: [
@@ -12437,12 +12542,12 @@ const Notification = ({
12437
12542
  }
12438
12543
  );
12439
12544
  };
12440
- const Textarea = (_ab) => {
12441
- var _bb = _ab, {
12545
+ const Textarea = (_gb) => {
12546
+ var _hb = _gb, {
12442
12547
  className,
12443
12548
  isInvalid,
12444
12549
  errorMessage
12445
- } = _bb, props = __objRest(_bb, [
12550
+ } = _hb, props = __objRest(_hb, [
12446
12551
  "className",
12447
12552
  "isInvalid",
12448
12553
  "errorMessage"
@@ -12452,9 +12557,9 @@ const Textarea = (_ab) => {
12452
12557
  isInvalid ? "Layer__textarea--error" : "",
12453
12558
  className
12454
12559
  );
12455
- return /* @__PURE__ */ jsxs(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
12456
- /* @__PURE__ */ jsx(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx("textarea", __spreadProps(__spreadValues({}, props), { className: baseClassName2 })) }),
12457
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: errorMessage })
12560
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { disabled: !isInvalid || !errorMessage, children: [
12561
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx("textarea", __spreadProps(__spreadValues({}, props), { className: baseClassName2 })) }),
12562
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
12458
12563
  ] });
12459
12564
  };
12460
12565
  const GET_BANK_TRANSACTION_METADATA_TAG_KEY = "#bank-transaction-metadata";
@@ -12600,6 +12705,22 @@ const BankTransactionMemo = ({ bankTransactionId }) => {
12600
12705
  );
12601
12706
  } }) });
12602
12707
  };
12708
+ const CustomerVendorTypeSchema = Schema.Literal("CUSTOMER", "VENDOR");
12709
+ const DiscriminatedCustomerSchema = Schema.Struct(__spreadProps(__spreadValues({}, CustomerSchema.fields), {
12710
+ customerVendorType: CustomerVendorTypeSchema.pipe(
12711
+ Schema.pickLiteral("CUSTOMER")
12712
+ )
12713
+ }));
12714
+ const DiscriminatedVendorSchema = Schema.Struct(__spreadProps(__spreadValues({}, VendorSchema.fields), {
12715
+ customerVendorType: CustomerVendorTypeSchema.pipe(
12716
+ Schema.pickLiteral("VENDOR")
12717
+ )
12718
+ }));
12719
+ const CustomerVendorSchema = Schema.Union(
12720
+ DiscriminatedCustomerSchema,
12721
+ DiscriminatedVendorSchema
12722
+ );
12723
+ const decodeCustomerVendor = Schema.decodeSync(CustomerVendorSchema);
12603
12724
  function BankTransactionCustomerVendorSelector({
12604
12725
  bankTransaction
12605
12726
  }) {
@@ -12766,6 +12887,44 @@ function BankTransactionFormFields({
12766
12887
  showDescriptions ? /* @__PURE__ */ jsx(BankTransactionMemo, { bankTransactionId: bankTransaction.id }) : null
12767
12888
  ] });
12768
12889
  }
12890
+ var CategorizationType = /* @__PURE__ */ ((CategorizationType2) => {
12891
+ CategorizationType2["AUTO"] = "AUTO";
12892
+ CategorizationType2["ASK_FROM_SUGGESTIONS"] = "ASK_FROM_SUGGESTIONS";
12893
+ CategorizationType2["MEALS"] = "MEALS";
12894
+ CategorizationType2["BUSINESS_TRAVEL_TRANSPORTATION"] = "BUSINESS_TRAVEL_TRANSPORTATION";
12895
+ return CategorizationType2;
12896
+ })(CategorizationType || {});
12897
+ function hasSuggestions(categorization) {
12898
+ return categorization != null && categorization.suggestions !== void 0 && categorization.suggestions.length > 0;
12899
+ }
12900
+ const accountIdentifierIsForCategory = (accountIdentifier, category) => {
12901
+ if (accountIdentifier.type === "AccountId") {
12902
+ switch (category.type) {
12903
+ case "AccountNested":
12904
+ return AccountIdEquivalence(accountIdentifier, makeAccountId(category.id));
12905
+ case "OptionalAccountNested":
12906
+ return false;
12907
+ case "ExclusionNested":
12908
+ return false;
12909
+ }
12910
+ }
12911
+ switch (category.type) {
12912
+ case "AccountNested":
12913
+ return category.stableName ? AccountStableNameEquivalence(accountIdentifier, makeStableName(category.stableName)) : false;
12914
+ case "OptionalAccountNested":
12915
+ return AccountStableNameEquivalence(accountIdentifier, makeStableName(category.stableName));
12916
+ case "ExclusionNested":
12917
+ return false;
12918
+ }
12919
+ };
12920
+ const getLeafCategories$2 = (categories) => {
12921
+ return categories.flatMap((category) => {
12922
+ if (!category.subCategories || category.subCategories.length === 0) {
12923
+ return [category];
12924
+ }
12925
+ return getLeafCategories$2(category.subCategories);
12926
+ });
12927
+ };
12769
12928
  var BankTransactionCategoryComboBoxGroupLabel = /* @__PURE__ */ ((BankTransactionCategoryComboBoxGroupLabel2) => {
12770
12929
  BankTransactionCategoryComboBoxGroupLabel2["TRANSFER"] = "TRANSFER";
12771
12930
  BankTransactionCategoryComboBoxGroupLabel2["MATCH"] = "MATCH";
@@ -12773,6 +12932,19 @@ var BankTransactionCategoryComboBoxGroupLabel = /* @__PURE__ */ ((BankTransactio
12773
12932
  BankTransactionCategoryComboBoxGroupLabel2["ALL_CATEGORIES"] = "ALL CATEGORIES";
12774
12933
  return BankTransactionCategoryComboBoxGroupLabel2;
12775
12934
  })(BankTransactionCategoryComboBoxGroupLabel || {});
12935
+ const convertCategorizationToOption = (categorization) => {
12936
+ if (isSplitCategorizationEncoded(categorization)) {
12937
+ const splits = categorization.entries.map((splitEntryEncoded) => ({
12938
+ amount: splitEntryEncoded.amount || 0,
12939
+ inputValue: centsToDollars(splitEntryEncoded.amount),
12940
+ category: splitEntryEncoded.category ? new ApiCategorizationAsOption(splitEntryEncoded.category) : null,
12941
+ tags: splitEntryEncoded.tags.map((tag) => makeTagFromTransactionTag(Schema$1.decodeSync(TransactionTagSchema)(tag))),
12942
+ customerVendor: splitEntryEncoded.customer ? decodeCustomerVendor(__spreadProps(__spreadValues({}, splitEntryEncoded.customer), { customerVendorType: "CUSTOMER" })) : splitEntryEncoded.vendor ? decodeCustomerVendor(__spreadProps(__spreadValues({}, splitEntryEncoded.vendor), { customerVendorType: "VENDOR" })) : null
12943
+ }));
12944
+ return new SplitAsOption(splits);
12945
+ }
12946
+ return new ApiCategorizationAsOption(categorization);
12947
+ };
12776
12948
  function getLeafCategories$1(category) {
12777
12949
  if (!category.subCategories || category.subCategories.length === 0) {
12778
12950
  return [category];
@@ -12818,18 +12990,18 @@ const getSuggestedCategoriesGroup = (bankTransaction) => {
12818
12990
  if ((categorizationFlow == null ? void 0 : categorizationFlow.type) === CategorizationType.ASK_FROM_SUGGESTIONS && hasSuggestions(categorizationFlow)) {
12819
12991
  return {
12820
12992
  label: "SUGGESTIONS",
12821
- options: categorizationFlow.suggestions.map((suggestion) => new ApiCategorizationAsOption(suggestion))
12993
+ options: categorizationFlow.suggestions.map((suggestion) => convertCategorizationToOption(suggestion))
12822
12994
  };
12823
12995
  }
12824
12996
  return null;
12825
12997
  };
12826
- const getDefaultSelectedCategoryForBankTransaction = (bankTransaction) => {
12998
+ const getDefaultSelectedCategoryForBankTransaction = (bankTransaction, ignoreSuggestedMatches = false) => {
12827
12999
  var _a;
12828
- if ((_a = bankTransaction.suggested_matches) == null ? void 0 : _a[0]) {
13000
+ if (!ignoreSuggestedMatches && ((_a = bankTransaction.suggested_matches) == null ? void 0 : _a[0])) {
12829
13001
  return new SuggestedMatchAsOption(bankTransaction.suggested_matches[0]);
12830
13002
  }
12831
13003
  if (hasSuggestions(bankTransaction.categorization_flow)) {
12832
- return new ApiCategorizationAsOption(bankTransaction.categorization_flow.suggestions[0]);
13004
+ return convertCategorizationToOption(bankTransaction.categorization_flow.suggestions[0]);
12833
13005
  }
12834
13006
  return null;
12835
13007
  };
@@ -12877,8 +13049,8 @@ function useCategories({ mode } = {}) {
12877
13049
  function usePreloadCategories(options2) {
12878
13050
  useCategories(options2);
12879
13051
  }
12880
- const Scissors = (_cb) => {
12881
- var _db = _cb, { size = 11 } = _db, props = __objRest(_db, ["size"]);
13052
+ const Scissors = (_ib) => {
13053
+ var _jb = _ib, { size = 11 } = _jb, props = __objRest(_jb, ["size"]);
12882
13054
  return /* @__PURE__ */ jsxs(
12883
13055
  "svg",
12884
13056
  __spreadProps(__spreadValues({
@@ -13034,8 +13206,8 @@ const DateTime = ({
13034
13206
  };
13035
13207
  const CLASS_NAME$8 = "Layer__MoneyText";
13036
13208
  const MoneySpan = forwardRef(
13037
- (_eb, ref) => {
13038
- var _fb = _eb, { amount, bold, size, displayPlusSign } = _fb, restProps = __objRest(_fb, ["amount", "bold", "size", "displayPlusSign"]);
13209
+ (_kb, ref) => {
13210
+ var _lb = _kb, { amount, bold, size, displayPlusSign } = _lb, restProps = __objRest(_lb, ["amount", "bold", "size", "displayPlusSign"]);
13039
13211
  const dataProperties = toDataProperties({
13040
13212
  bold,
13041
13213
  positive: amount >= 0,
@@ -13057,7 +13229,7 @@ const BankTransactionCategoryComboBoxSelectedValue = ({ selectedValue }) => {
13057
13229
  /* @__PURE__ */ jsx(Span, { ellipsis: true, children: selectedValue.label })
13058
13230
  ] });
13059
13231
  }
13060
- if (isSplitAsOption(selectedValue)) {
13232
+ if (isSplitAsOption(selectedValue) && selectedValue.original.length > 1) {
13061
13233
  return /* @__PURE__ */ jsxs(HStack, { gap: "3xs", align: "center", children: [
13062
13234
  /* @__PURE__ */ jsx(Badge, { size: BadgeSize.SMALL, icon: /* @__PURE__ */ jsx(Scissors, { size: 11 }), children: "Split" }),
13063
13235
  /* @__PURE__ */ jsx(Span, { ellipsis: true, children: selectedValue.label })
@@ -13108,7 +13280,6 @@ const BankTransactionCategoryComboBox = ({
13108
13280
  inputId
13109
13281
  }) => {
13110
13282
  const { data: categories } = useCategories();
13111
- const loadingSuggestions = bankTransaction && isLoadingSuggestions(bankTransaction);
13112
13283
  const matchGroup = useMemo(() => {
13113
13284
  if (!includeSuggestedMatches || !bankTransaction) return null;
13114
13285
  return getSuggestedMatchesGroup(bankTransaction);
@@ -13134,6 +13305,7 @@ const BankTransactionCategoryComboBox = ({
13134
13305
  [allCategoriesGroup, categoryGroups, matchGroup, suggestedGroup]
13135
13306
  );
13136
13307
  const numMatchOptions = (matchGroup == null ? void 0 : matchGroup.options.length) || 0;
13308
+ const loadingSuggestions = bankTransaction && isLoadingSuggestions(bankTransaction) && selectedValue === null;
13137
13309
  const placeholder = numMatchOptions > 1 ? `${numMatchOptions} possible matches...` : loadingSuggestions ? "Generating suggestions..." : "Categorize or match...";
13138
13310
  const SelectedValue = useMemo(() => {
13139
13311
  return /* @__PURE__ */ jsx(BankTransactionCategoryComboBoxSelectedValue, { selectedValue });
@@ -13217,22 +13389,9 @@ function BulkSelectionStoreProvider({
13217
13389
  const [store] = useState(() => buildStore$1());
13218
13390
  return /* @__PURE__ */ jsx(BulkSelectionStoreContext.Provider, { value: store, children });
13219
13391
  }
13220
- const isAlreadyMatched = (bankTransaction) => {
13221
- var _a;
13222
- if (bankTransaction == null ? void 0 : bankTransaction.match) {
13223
- const foundMatch = (_a = bankTransaction.suggested_matches) == null ? void 0 : _a.find(
13224
- (x) => {
13225
- var _a2, _b;
13226
- return x.details.id === ((_a2 = bankTransaction == null ? void 0 : bankTransaction.match) == null ? void 0 : _a2.details.id) || x.details.id === ((_b = bankTransaction == null ? void 0 : bankTransaction.match) == null ? void 0 : _b.bank_transaction.id);
13227
- }
13228
- );
13229
- return foundMatch == null ? void 0 : foundMatch.id;
13230
- }
13231
- return void 0;
13232
- };
13233
- const validateSplit = (splitData) => {
13392
+ const validateSplit = (localSplits) => {
13234
13393
  let valid = true;
13235
- splitData.splits.forEach((split) => {
13394
+ localSplits.forEach((split) => {
13236
13395
  if (split.amount <= 0) {
13237
13396
  valid = false;
13238
13397
  } else if (!split.category) {
@@ -13241,6 +13400,137 @@ const validateSplit = (splitData) => {
13241
13400
  });
13242
13401
  return valid;
13243
13402
  };
13403
+ const calculateAddSplit = (initialRowSplits) => {
13404
+ const newSplit = {
13405
+ amount: 0,
13406
+ category: null,
13407
+ tags: [],
13408
+ customerVendor: null
13409
+ };
13410
+ return [...initialRowSplits, newSplit];
13411
+ };
13412
+ const calculateRemoveSplit = (initialRowSplits, { totalAmount, index }) => {
13413
+ const newSplits = initialRowSplits.filter((_v, idx) => idx !== index);
13414
+ const splitTotal = newSplits.reduce((sum, split, index2) => {
13415
+ const splitAmount = index2 === 0 ? 0 : split.amount;
13416
+ return sum + splitAmount;
13417
+ }, 0);
13418
+ const remaining = totalAmount - splitTotal;
13419
+ newSplits[0].amount = remaining;
13420
+ return newSplits;
13421
+ };
13422
+ const calculateUpdatedAmounts = (initialRowSplits, { index, newAmountInput, totalAmount }) => {
13423
+ const newAmount = Number(newAmountInput) * 100;
13424
+ const splitTotal = initialRowSplits.reduce((sum, split, idx) => {
13425
+ const amount = idx === 0 ? 0 : idx === index ? newAmount : split.amount;
13426
+ return sum + amount;
13427
+ }, 0);
13428
+ const remaining = totalAmount - splitTotal;
13429
+ initialRowSplits[index].amount = newAmount;
13430
+ initialRowSplits[0].amount = remaining;
13431
+ return [...initialRowSplits];
13432
+ };
13433
+ const getCustomerVendorForBankTransaction = (bankTransaction) => {
13434
+ return bankTransaction.customer ? decodeCustomerVendor(__spreadProps(__spreadValues({}, bankTransaction.customer), { customerVendorType: "CUSTOMER" })) : bankTransaction.vendor ? decodeCustomerVendor(__spreadProps(__spreadValues({}, bankTransaction.vendor), { customerVendorType: "VENDOR" })) : null;
13435
+ };
13436
+ const getLocalSplitStateForExpandedTableRow = (selectedCategory, bankTransaction) => {
13437
+ let coercedSelectedCategory = selectedCategory;
13438
+ if (!selectedCategory || isPlaceholderAsOption(selectedCategory)) {
13439
+ coercedSelectedCategory = null;
13440
+ } else if (isSuggestedMatchAsOption(selectedCategory)) {
13441
+ coercedSelectedCategory = getDefaultSelectedCategoryForBankTransaction(bankTransaction, true);
13442
+ }
13443
+ if (selectedCategory && isSplitAsOption(selectedCategory)) {
13444
+ return selectedCategory.original.map((splitEntry) => {
13445
+ return {
13446
+ amount: splitEntry.amount || 0,
13447
+ category: splitEntry.category,
13448
+ tags: splitEntry.tags,
13449
+ customerVendor: splitEntry.customerVendor
13450
+ };
13451
+ });
13452
+ }
13453
+ return [
13454
+ {
13455
+ amount: bankTransaction.amount,
13456
+ category: coercedSelectedCategory != null ? coercedSelectedCategory : null,
13457
+ tags: bankTransaction.transaction_tags.map((tag) => makeTagFromTransactionTag(Schema$1.decodeSync(TransactionTagSchema)(tag))),
13458
+ customerVendor: getCustomerVendorForBankTransaction(bankTransaction)
13459
+ }
13460
+ ];
13461
+ };
13462
+ function buildStore() {
13463
+ return createStore((set2) => ({
13464
+ transactionCategories: /* @__PURE__ */ new Map(),
13465
+ actions: {
13466
+ setTransactionCategory: (id, category) => {
13467
+ set2((state) => {
13468
+ const newMap = new Map(state.transactionCategories);
13469
+ newMap.set(id, category);
13470
+ return { transactionCategories: newMap };
13471
+ });
13472
+ },
13473
+ setOnlyNewTransactionCategories: (transactionCategories) => {
13474
+ set2((state) => {
13475
+ const newMap = new Map(state.transactionCategories);
13476
+ let hasChanges = false;
13477
+ transactionCategories.forEach(({ id, category }) => {
13478
+ if (!newMap.has(id)) {
13479
+ newMap.set(id, category);
13480
+ hasChanges = true;
13481
+ }
13482
+ });
13483
+ return hasChanges ? { transactionCategories: newMap } : state;
13484
+ });
13485
+ },
13486
+ clearTransactionCategory: (id) => {
13487
+ set2((state) => {
13488
+ const newMap = new Map(state.transactionCategories);
13489
+ newMap.delete(id);
13490
+ return { transactionCategories: newMap };
13491
+ });
13492
+ },
13493
+ clearMultipleTransactionCategories: (ids) => {
13494
+ set2((state) => {
13495
+ const newMap = new Map(state.transactionCategories);
13496
+ ids.forEach((id) => newMap.delete(id));
13497
+ return { transactionCategories: newMap };
13498
+ });
13499
+ },
13500
+ clearAllTransactionCategories: () => {
13501
+ set2({ transactionCategories: /* @__PURE__ */ new Map() });
13502
+ }
13503
+ }
13504
+ }));
13505
+ }
13506
+ const BankTransactionsCategoryStoreContext = createContext(null);
13507
+ function useBankTransactionsCategoryStore() {
13508
+ const store = useContext(BankTransactionsCategoryStoreContext);
13509
+ if (!store) {
13510
+ throw new Error("useBankTransactionsCategoryStore must be used within BankTransactionsCategoryStoreProvider");
13511
+ }
13512
+ return store;
13513
+ }
13514
+ function useBankTransactionsCategoryActions() {
13515
+ const store = useBankTransactionsCategoryStore();
13516
+ return useStore(store, (state) => state.actions);
13517
+ }
13518
+ function useGetBankTransactionCategory(transactionId) {
13519
+ const store = useBankTransactionsCategoryStore();
13520
+ const selectedCategory = useStore(store, (state) => state.transactionCategories.get(transactionId));
13521
+ return { selectedCategory };
13522
+ }
13523
+ function useGetAllBankTransactionsCategories() {
13524
+ const store = useBankTransactionsCategoryStore();
13525
+ const transactionCategories = useStore(store, (state) => state.transactionCategories);
13526
+ return { transactionCategories };
13527
+ }
13528
+ function BankTransactionsCategoryStoreProvider({
13529
+ children
13530
+ }) {
13531
+ const [store] = useState(() => buildStore());
13532
+ return /* @__PURE__ */ jsx(BankTransactionsCategoryStoreContext.Provider, { value: store, children });
13533
+ }
13244
13534
  const ExpandedBankTransactionRow = forwardRef(
13245
13535
  ({
13246
13536
  bankTransaction,
@@ -13253,12 +13543,14 @@ const ExpandedBankTransactionRow = forwardRef(
13253
13543
  showDescriptions,
13254
13544
  showReceiptUploads
13255
13545
  }, ref) => {
13256
- var _a, _b, _c, _d, _e;
13546
+ var _a, _b;
13257
13547
  const {
13258
13548
  categorize: categorizeBankTransaction2,
13259
13549
  match: matchBankTransaction2
13260
13550
  } = useBankTransactionsContext();
13261
13551
  const { deselect } = useBulkSelectionActions();
13552
+ const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
13553
+ const { setTransactionCategory } = useBankTransactionsCategoryActions();
13262
13554
  const { trigger: tagBankTransaction2 } = useTagBankTransaction({ bankTransactionId: bankTransaction.id });
13263
13555
  const { trigger: removeTagFromBankTransaction2 } = useRemoveTagFromBankTransaction({ bankTransactionId: bankTransaction.id });
13264
13556
  const { trigger: setMetadataOnBankTransaction2 } = useSetMetadataOnBankTransaction({ bankTransactionId: bankTransaction.id });
@@ -13268,146 +13560,71 @@ const ExpandedBankTransactionRow = forwardRef(
13268
13560
  bankTransaction.category ? "categorize" : hasMatch(bankTransaction) ? "match" : "categorize"
13269
13561
  /* categorize */
13270
13562
  );
13271
- const [selectedMatchId, setSelectedMatchId] = useState(
13272
- (_c = isAlreadyMatched(bankTransaction)) != null ? _c : (_b = (_a = bankTransaction == null ? void 0 : bankTransaction.suggested_matches) == null ? void 0 : _a[0]) == null ? void 0 : _b.id
13563
+ const [selectedMatch, setSelectedMatch] = useState(
13564
+ (_b = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) != null ? _b : (_a = bankTransaction == null ? void 0 : bankTransaction.suggested_matches) == null ? void 0 : _a[0]
13273
13565
  );
13274
13566
  const [matchFormError, setMatchFormError] = useState();
13275
13567
  const [splitFormError, setSplitFormError] = useState();
13276
13568
  const bodyRef = useRef(null);
13277
- const defaultCategory = bankTransaction.category ? bankTransaction.category : hasSuggestions(bankTransaction.categorization_flow) ? (_d = bankTransaction.categorization_flow) == null ? void 0 : _d.suggestions.at(0) : void 0;
13278
- const initialCustomerVendor = bankTransaction.customer ? decodeCustomerVendor(__spreadProps(__spreadValues({}, bankTransaction.customer), { customerVendorType: "CUSTOMER" })) : bankTransaction.vendor ? decodeCustomerVendor(__spreadProps(__spreadValues({}, bankTransaction.vendor), { customerVendorType: "VENDOR" })) : null;
13279
- const initialTags = bankTransaction.transaction_tags.map(({ id, key, value, dimension_display_name, value_display_name, archived_at, _local }) => {
13280
- var _a2;
13281
- return makeTag({
13282
- id,
13283
- key,
13284
- value,
13285
- dimensionDisplayName: dimension_display_name,
13286
- valueDisplayName: value_display_name,
13287
- archivedAt: archived_at,
13288
- _local: {
13289
- isOptimistic: (_a2 = _local == null ? void 0 : _local.isOptimistic) != null ? _a2 : false
13290
- }
13291
- });
13292
- });
13293
- const [rowState, updateRowState] = useState({
13294
- splits: bankTransaction.category && isSplitCategorizationEncoded(bankTransaction.category) ? (_e = bankTransaction.category) == null ? void 0 : _e.entries.map((c) => {
13295
- var _a2, _b2;
13296
- const splitTags = (_b2 = (_a2 = c.tags) == null ? void 0 : _a2.map((tag) => makeTagFromTransactionTag({
13297
- id: tag.id,
13298
- key: tag.key,
13299
- value: tag.value,
13300
- dimensionDisplayName: tag.dimension_display_name,
13301
- valueDisplayName: tag.value_display_name,
13302
- createdAt: new Date(tag.created_at),
13303
- updatedAt: new Date(tag.updated_at),
13304
- deletedAt: tag.deleted_at ? new Date(tag.deleted_at) : null,
13305
- archivedAt: tag.archived_at ? new Date(tag.archived_at) : null,
13306
- _local: tag._local
13307
- }))) != null ? _b2 : [];
13308
- const splitCustomerVendor = c.customer ? decodeCustomerVendor(__spreadProps(__spreadValues({}, c.customer), { customerVendorType: "CUSTOMER" })) : c.vendor ? decodeCustomerVendor(__spreadProps(__spreadValues({}, c.vendor), { customerVendorType: "VENDOR" })) : null;
13309
- return {
13310
- amount: c.amount || 0,
13311
- inputValue: centsToDollars(c.amount),
13312
- category: new ApiCategorizationAsOption(c.category),
13313
- tags: splitTags,
13314
- customerVendor: splitCustomerVendor
13315
- };
13316
- }) : [
13317
- {
13318
- amount: bankTransaction.amount,
13319
- inputValue: centsToDollars(bankTransaction.amount),
13320
- category: defaultCategory ? new ApiCategorizationAsOption(defaultCategory) : null,
13321
- tags: initialTags,
13322
- customerVendor: initialCustomerVendor
13323
- }
13324
- ],
13325
- description: "",
13326
- file: void 0
13327
- });
13569
+ const [localSplits, setLocalSplits] = useState(getLocalSplitStateForExpandedTableRow(selectedCategory, bankTransaction));
13570
+ useEffect(() => {
13571
+ setLocalSplits(getLocalSplitStateForExpandedTableRow(selectedCategory, bankTransaction));
13572
+ setSplitFormError(void 0);
13573
+ }, [selectedCategory, bankTransaction, isOpen]);
13328
13574
  const addSplit = () => {
13329
- updateRowState(__spreadProps(__spreadValues({}, rowState), {
13330
- splits: [
13331
- ...rowState.splits,
13332
- {
13333
- amount: 0,
13334
- inputValue: "0.00",
13335
- category: defaultCategory ? new ApiCategorizationAsOption(defaultCategory) : null,
13336
- tags: [],
13337
- customerVendor: initialCustomerVendor
13338
- }
13339
- ]
13340
- }));
13575
+ const newSplits = calculateAddSplit(localSplits);
13576
+ setLocalSplits(newSplits);
13341
13577
  setSplitFormError(void 0);
13342
13578
  };
13343
13579
  const removeSplit = (index) => {
13344
- const newSplits = rowState.splits.filter((_v, idx) => idx !== index);
13345
- const splitTotal = newSplits.reduce((sum, split, index2) => {
13346
- const amount = index2 === 0 ? 0 : split.amount;
13347
- return sum + amount;
13348
- }, 0);
13349
- const remaining = bankTransaction.amount - splitTotal;
13350
- newSplits[0].amount = remaining;
13351
- newSplits[0].inputValue = centsToDollars(remaining);
13352
- updateRowState(__spreadProps(__spreadValues({}, rowState), {
13353
- splits: newSplits
13354
- }));
13580
+ const newSplits = calculateRemoveSplit(localSplits, { totalAmount: bankTransaction.amount, index });
13581
+ setLocalSplits(newSplits);
13355
13582
  setSplitFormError(void 0);
13356
13583
  };
13357
- const sanitizeNumberInput = (input) => {
13358
- let sanitized = input.replace(/[^0-9.]/g, "");
13359
- const parts = sanitized.split(".");
13360
- if (parts.length > 2) {
13361
- sanitized = parts[0] + "." + parts.slice(1).join("");
13362
- }
13363
- if (parts.length === 2) {
13364
- sanitized = parts[0] + "." + parts[1].slice(0, 2);
13365
- }
13366
- return sanitized;
13367
- };
13368
- const updateAmounts = (rowNumber) => (event) => {
13369
- const newDisplaying = sanitizeNumberInput(event.target.value);
13370
- const newAmount = Number(newDisplaying) * 100;
13371
- const splitTotal = rowState.splits.reduce((sum, split, index) => {
13372
- const amount = index === 0 ? 0 : index === rowNumber ? newAmount : split.amount;
13373
- return sum + amount;
13374
- }, 0);
13375
- const remaining = bankTransaction.amount - splitTotal;
13376
- rowState.splits[rowNumber].amount = newAmount;
13377
- rowState.splits[rowNumber].inputValue = newDisplaying;
13378
- rowState.splits[0].amount = remaining;
13379
- rowState.splits[0].inputValue = centsToDollars(remaining);
13380
- updateRowState(__spreadValues({}, rowState));
13584
+ const updateAmounts = (index) => (value) => {
13585
+ if (!value) return;
13586
+ const newLocalSplits = calculateUpdatedAmounts(localSplits, { index, newAmountInput: value, totalAmount: bankTransaction.amount });
13587
+ setLocalSplits(newLocalSplits);
13381
13588
  setSplitFormError(void 0);
13589
+ if (validateSplit(newLocalSplits)) {
13590
+ setTransactionCategory(bankTransaction.id, new SplitAsOption(newLocalSplits));
13591
+ }
13382
13592
  };
13383
- const onBlur = (event) => {
13384
- if (event.target.value === "") {
13385
- const [_, index] = event.target.name.split("-");
13386
- rowState.splits[parseInt(index)].inputValue = "0.00";
13387
- updateRowState(__spreadValues({}, rowState));
13388
- setSplitFormError(void 0);
13593
+ const onBlur = () => {
13594
+ if (!validateSplit(localSplits)) {
13595
+ setSplitFormError("Amounts must be greater than $0.00");
13596
+ return;
13389
13597
  }
13598
+ setSplitFormError(void 0);
13390
13599
  };
13391
13600
  const onChangePurpose = (event) => {
13392
- setPurpose(
13393
- event.target.value === "match" ? "match" : "categorize"
13394
- /* categorize */
13395
- );
13601
+ const newPurpose = event.target.value === "match" ? "match" : "categorize";
13602
+ setPurpose(newPurpose);
13603
+ if (newPurpose === "match") {
13604
+ setTransactionCategory(bankTransaction.id, selectedMatch ? new SuggestedMatchAsOption(selectedMatch) : null);
13605
+ } else if (newPurpose === "categorize" && validateSplit(localSplits)) {
13606
+ setTransactionCategory(bankTransaction.id, new SplitAsOption(localSplits));
13607
+ }
13396
13608
  setSplitFormError(void 0);
13397
13609
  setMatchFormError(void 0);
13398
13610
  };
13399
- const changeCategory = (index, newValue) => {
13400
- if (newValue === null) return;
13401
- rowState.splits[index].category = newValue;
13402
- updateRowState(__spreadValues({}, rowState));
13611
+ const changeCategory = (index, newCategory) => {
13612
+ if (newCategory === null) return;
13613
+ localSplits[index].category = newCategory;
13614
+ const newLocalSplits = [...localSplits];
13615
+ setLocalSplits(newLocalSplits);
13403
13616
  setSplitFormError(void 0);
13617
+ if (validateSplit(newLocalSplits)) {
13618
+ setTransactionCategory(bankTransaction.id, new SplitAsOption(newLocalSplits));
13619
+ }
13404
13620
  };
13405
13621
  const changeTags = (index, newTags) => {
13406
- const oldTags = rowState.splits[index].tags;
13407
- rowState.splits[index].tags = newTags;
13408
- updateRowState(__spreadValues({}, rowState));
13622
+ const oldTags = localSplits[index].tags;
13623
+ localSplits[index].tags = newTags;
13624
+ const newLocalSplits = [...localSplits];
13625
+ setLocalSplits(newLocalSplits);
13409
13626
  setSplitFormError(void 0);
13410
- if (rowState.splits.length === 1) {
13627
+ if (newLocalSplits.length === 1) {
13411
13628
  const addedTags = newTags.filter(
13412
13629
  (newTag) => !oldTags.some((oldTag) => oldTag.key === newTag.key && oldTag.value === newTag.value)
13413
13630
  );
@@ -13428,32 +13645,40 @@ const ExpandedBankTransactionRow = forwardRef(
13428
13645
  });
13429
13646
  });
13430
13647
  }
13648
+ if (validateSplit(newLocalSplits)) {
13649
+ setTransactionCategory(bankTransaction.id, new SplitAsOption(newLocalSplits));
13650
+ }
13431
13651
  };
13432
13652
  const changeCustomerVendor = (index, newCustomerVendor) => {
13433
- rowState.splits[index].customerVendor = newCustomerVendor;
13434
- updateRowState(__spreadValues({}, rowState));
13653
+ localSplits[index].customerVendor = newCustomerVendor;
13654
+ const newLocalSplits = [...localSplits];
13655
+ setLocalSplits(newLocalSplits);
13435
13656
  setSplitFormError(void 0);
13436
- if (rowState.splits.length === 1) {
13657
+ if (newLocalSplits.length === 1) {
13437
13658
  void setMetadataOnBankTransaction2({
13438
13659
  customer: (newCustomerVendor == null ? void 0 : newCustomerVendor.customerVendorType) === "CUSTOMER" ? newCustomerVendor : null,
13439
13660
  vendor: (newCustomerVendor == null ? void 0 : newCustomerVendor.customerVendorType) === "VENDOR" ? newCustomerVendor : null
13440
13661
  });
13441
13662
  }
13663
+ if (validateSplit(newLocalSplits)) {
13664
+ setTransactionCategory(bankTransaction.id, new SplitAsOption(newLocalSplits));
13665
+ }
13442
13666
  };
13443
13667
  const save = () => __async(null, null, function* () {
13668
+ var _a2;
13444
13669
  if (purpose === "match") {
13445
- if (!selectedMatchId) {
13670
+ if (!selectedMatch) {
13446
13671
  setMatchFormError("Select an option to match the transaction");
13447
13672
  return;
13448
- } else if (selectedMatchId && selectedMatchId !== isAlreadyMatched(bankTransaction)) {
13449
- yield onMatchSubmit(selectedMatchId);
13673
+ } else if (selectedMatch && selectedMatch.id !== ((_a2 = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a2.id)) {
13674
+ yield onMatchSubmit(selectedMatch.id);
13450
13675
  return;
13451
13676
  }
13452
13677
  close2();
13453
13678
  return;
13454
13679
  }
13455
- if (!validateSplit(rowState)) {
13456
- if (rowState.splits.length > 1) {
13680
+ if (!validateSplit(localSplits)) {
13681
+ if (localSplits.length > 1) {
13457
13682
  setSplitFormError(
13458
13683
  "Use only positive amounts and select category for each entry"
13459
13684
  );
@@ -13464,19 +13689,19 @@ const ExpandedBankTransactionRow = forwardRef(
13464
13689
  }
13465
13690
  yield categorizeBankTransaction2(
13466
13691
  bankTransaction.id,
13467
- rowState.splits.length === 1 && (rowState == null ? void 0 : rowState.splits[0].category) ? {
13692
+ localSplits.length === 1 && localSplits[0].category ? {
13468
13693
  type: "Category",
13469
- category: rowState == null ? void 0 : rowState.splits[0].category.classificationEncoded
13694
+ category: localSplits[0].category.classificationEncoded
13470
13695
  } : {
13471
13696
  type: "Split",
13472
- entries: rowState.splits.map((split) => {
13473
- var _a2, _b2, _c2;
13697
+ entries: localSplits.map((split) => {
13698
+ var _a3, _b2, _c;
13474
13699
  return {
13475
- category: (_a2 = split.category) == null ? void 0 : _a2.classificationEncoded,
13700
+ category: (_a3 = split.category) == null ? void 0 : _a3.classificationEncoded,
13476
13701
  amount: split.amount,
13477
13702
  tags: split.tags.map((tag) => makeTagKeyValueFromTag(tag)),
13478
13703
  customer_id: ((_b2 = split.customerVendor) == null ? void 0 : _b2.customerVendorType) === "CUSTOMER" ? split.customerVendor.id : null,
13479
- vendor_id: ((_c2 = split.customerVendor) == null ? void 0 : _c2.customerVendorType) === "VENDOR" ? split.customerVendor.id : null
13704
+ vendor_id: ((_c = split.customerVendor) == null ? void 0 : _c.customerVendorType) === "VENDOR" ? split.customerVendor.id : null
13480
13705
  };
13481
13706
  })
13482
13707
  }
@@ -13501,7 +13726,7 @@ const ExpandedBankTransactionRow = forwardRef(
13501
13726
  });
13502
13727
  const bookkeepingStatus = useEffectiveBookkeepingStatus();
13503
13728
  const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
13504
- const effectiveSplits = categorizationEnabled ? rowState.splits : [];
13729
+ const effectiveSplits = categorizationEnabled ? localSplits : [];
13505
13730
  const className = "Layer__expanded-bank-transaction-row";
13506
13731
  return /* @__PURE__ */ jsx(
13507
13732
  "span",
@@ -13549,11 +13774,11 @@ const ExpandedBankTransactionRow = forwardRef(
13549
13774
  {
13550
13775
  classNamePrefix: className,
13551
13776
  bankTransaction,
13552
- selectedMatchId,
13777
+ selectedMatchId: selectedMatch == null ? void 0 : selectedMatch.id,
13553
13778
  readOnly: !categorizationEnabled,
13554
- setSelectedMatchId: (id) => {
13779
+ setSelectedMatch: (suggestedMatch) => {
13555
13780
  setMatchFormError(void 0);
13556
- setSelectedMatchId(id);
13781
+ setSelectedMatch(suggestedMatch);
13557
13782
  },
13558
13783
  matchFormError
13559
13784
  }
@@ -13575,18 +13800,16 @@ const ExpandedBankTransactionRow = forwardRef(
13575
13800
  className: `${className}__table-cell--split-entry`,
13576
13801
  children: [
13577
13802
  /* @__PURE__ */ jsx(
13578
- Input$1,
13803
+ AmountInput,
13579
13804
  {
13580
- type: "text",
13581
13805
  name: `split-${index}${asListItem ? "-li" : ""}`,
13582
13806
  disabled: index === 0 || !categorizationEnabled,
13583
13807
  onChange: updateAmounts(index),
13584
- value: split.inputValue,
13808
+ value: convertFromCents(split.amount),
13585
13809
  onBlur,
13810
+ className: `${className}__table-cell--split-entry__amount`,
13586
13811
  isInvalid: split.amount < 0,
13587
- inputMode: "numeric",
13588
- errorMessage: "Negative values are not allowed",
13589
- className: `${className}__table-cell--split-entry__amount`
13812
+ errorMessage: "Amounts must be greater than $0.00"
13590
13813
  }
13591
13814
  ),
13592
13815
  /* @__PURE__ */ jsx(
@@ -13600,15 +13823,16 @@ const ExpandedBankTransactionRow = forwardRef(
13600
13823
  includeSuggestedMatches: false
13601
13824
  }
13602
13825
  ),
13603
- showTags && /* @__PURE__ */ jsx("div", { className: `${className}__table-cell--split-entry__tags`, children: /* @__PURE__ */ jsx(
13826
+ showTags && /* @__PURE__ */ jsx(
13604
13827
  TagDimensionsGroup,
13605
13828
  {
13606
13829
  value: split.tags,
13607
13830
  onChange: (tags) => changeTags(index, tags),
13608
13831
  showLabels: false,
13609
- isReadOnly: !categorizationEnabled
13832
+ isReadOnly: !categorizationEnabled,
13833
+ className: `${className}__table-cell--split-entry__tags`
13610
13834
  }
13611
- ) }),
13835
+ ),
13612
13836
  showCustomerVendor && /* @__PURE__ */ jsx("div", { className: "Layer__expanded-bank-transaction-row__table-cell--split-entry__customer", children: /* @__PURE__ */ jsx(
13613
13837
  CustomerVendorSelector,
13614
13838
  {
@@ -13873,8 +14097,8 @@ const getMonthNameFromNumber = (monthNumber) => {
13873
14097
  }
13874
14098
  return (_a = monthNames.at(monthNumber - 1)) != null ? _a : "";
13875
14099
  };
13876
- const Clock = (_gb) => {
13877
- var _hb = _gb, { size = 18 } = _hb, props = __objRest(_hb, ["size"]);
14100
+ const Clock = (_mb) => {
14101
+ var _nb = _mb, { size = 18 } = _nb, props = __objRest(_nb, ["size"]);
13878
14102
  return /* @__PURE__ */ jsxs(
13879
14103
  "svg",
13880
14104
  __spreadProps(__spreadValues({
@@ -13967,9 +14191,9 @@ const BookkeepingStatus$1 = ({ status, text, monthNumber, iconOnly }) => {
13967
14191
  )
13968
14192
  ] }));
13969
14193
  };
13970
- const BankTransactionProcessingInfo = () => /* @__PURE__ */ jsxs(Tooltip, { offset: 12, children: [
13971
- /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsx(BookkeepingStatus$1, { status: BookkeepingPeriodStatus.IN_PROGRESS_AWAITING_BOOKKEEPER, text: "Processing" }) }),
13972
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", width: "md", children: "Our team will review and categorize this transaction. We'll reach out if we have any questions about it." })
14194
+ const BankTransactionProcessingInfo = () => /* @__PURE__ */ jsxs(DeprecatedTooltip, { offset: 12, children: [
14195
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsx(BookkeepingStatus$1, { status: BookkeepingPeriodStatus.IN_PROGRESS_AWAITING_BOOKKEEPER, text: "Processing" }) }),
14196
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", width: "md", children: "Our team will review and categorize this transaction. We'll reach out if we have any questions about it." })
13973
14197
  ] });
13974
14198
  function useDelayedVisibility({
13975
14199
  delay,
@@ -13991,73 +14215,47 @@ function useDelayedVisibility({
13991
14215
  );
13992
14216
  return { isVisible };
13993
14217
  }
13994
- function buildStore() {
13995
- return createStore((set2) => ({
13996
- transactionCategories: /* @__PURE__ */ new Map(),
13997
- actions: {
13998
- setTransactionCategory: (id, category) => {
13999
- set2((state) => {
14000
- const newMap = new Map(state.transactionCategories);
14001
- newMap.set(id, category);
14002
- return { transactionCategories: newMap };
14003
- });
14004
- },
14005
- setOnlyNewTransactionCategories: (transactionCategories) => {
14006
- set2((state) => {
14007
- const newMap = new Map(state.transactionCategories);
14008
- let hasChanges = false;
14009
- transactionCategories.forEach(({ id, category }) => {
14010
- if (!newMap.has(id)) {
14011
- newMap.set(id, category);
14012
- hasChanges = true;
14013
- }
14014
- });
14015
- return hasChanges ? { transactionCategories: newMap } : state;
14016
- });
14017
- },
14018
- clearTransactionCategory: (id) => {
14019
- set2((state) => {
14020
- const newMap = new Map(state.transactionCategories);
14021
- newMap.delete(id);
14022
- return { transactionCategories: newMap };
14023
- });
14024
- },
14025
- clearMultipleTransactionCategories: (ids) => {
14026
- set2((state) => {
14027
- const newMap = new Map(state.transactionCategories);
14028
- ids.forEach((id) => newMap.delete(id));
14029
- return { transactionCategories: newMap };
14030
- });
14031
- },
14032
- clearAllTransactionCategories: () => {
14033
- set2({ transactionCategories: /* @__PURE__ */ new Map() });
14034
- }
14218
+ const buildSplitCategorizationRequest = (selectedCategory) => {
14219
+ return {
14220
+ type: "Split",
14221
+ entries: selectedCategory.original.map((split) => {
14222
+ var _a, _b, _c;
14223
+ return {
14224
+ category: (_a = split.category) == null ? void 0 : _a.classificationEncoded,
14225
+ amount: split.amount,
14226
+ tags: split.tags.map((tag) => makeTagKeyValueFromTag(tag)),
14227
+ customer_id: ((_b = split.customerVendor) == null ? void 0 : _b.customerVendorType) === "CUSTOMER" ? split.customerVendor.id : null,
14228
+ vendor_id: ((_c = split.customerVendor) == null ? void 0 : _c.customerVendorType) === "VENDOR" ? split.customerVendor.id : null
14229
+ };
14230
+ })
14231
+ };
14232
+ };
14233
+ const useSaveBankTransactionRow = () => {
14234
+ const {
14235
+ categorize: categorizeBankTransaction2,
14236
+ match: matchBankTransaction2
14237
+ } = useBankTransactionsContext();
14238
+ const saveBankTransactionRow = useCallback((selectedCategory, bankTransaction) => __async(null, null, function* () {
14239
+ if (!selectedCategory || isPlaceholderAsOption(selectedCategory)) {
14240
+ return;
14035
14241
  }
14036
- }));
14037
- }
14038
- const BankTransactionsCategoryStoreContext = createContext(null);
14039
- function useBankTransactionsCategoryStore() {
14040
- const store = useContext(BankTransactionsCategoryStoreContext);
14041
- if (!store) {
14042
- throw new Error("useBankTransactionsCategoryStore must be used within BankTransactionsCategoryStoreProvider");
14043
- }
14044
- return store;
14045
- }
14046
- function useBankTransactionsCategoryActions() {
14047
- const store = useBankTransactionsCategoryStore();
14048
- return useStore(store, (state) => state.actions);
14049
- }
14050
- function useGetAllBankTransactionsCategories() {
14051
- const store = useBankTransactionsCategoryStore();
14052
- const transactionCategories = useStore(store, (state) => state.transactionCategories);
14053
- return { transactionCategories };
14054
- }
14055
- function BankTransactionsCategoryStoreProvider({
14056
- children
14057
- }) {
14058
- const [store] = useState(() => buildStore());
14059
- return /* @__PURE__ */ jsx(BankTransactionsCategoryStoreContext.Provider, { value: store, children });
14060
- }
14242
+ if (isSuggestedMatchAsOption(selectedCategory)) {
14243
+ return matchBankTransaction2(bankTransaction.id, selectedCategory.original.id);
14244
+ }
14245
+ if (isSplitAsOption(selectedCategory)) {
14246
+ const splitCategorizationRequest = buildSplitCategorizationRequest(selectedCategory);
14247
+ return categorizeBankTransaction2(bankTransaction.id, splitCategorizationRequest);
14248
+ }
14249
+ if (!selectedCategory.classificationEncoded) return;
14250
+ return categorizeBankTransaction2(bankTransaction.id, {
14251
+ type: "Category",
14252
+ category: selectedCategory.classificationEncoded
14253
+ });
14254
+ }), [categorizeBankTransaction2, matchBankTransaction2]);
14255
+ return useMemo(() => ({
14256
+ saveBankTransactionRow
14257
+ }), [saveBankTransactionRow]);
14258
+ };
14061
14259
  const extractDescriptionForSplit = (category) => {
14062
14260
  if (!category || !isSplitCategorizationEncoded(category)) {
14063
14261
  return "";
@@ -14083,34 +14281,22 @@ const BankTransactionRow = ({
14083
14281
  var _a, _b, _c, _d, _e, _f;
14084
14282
  const expandedRowRef = useRef(null);
14085
14283
  const [showRetry, setShowRetry] = useState(false);
14086
- const {
14087
- categorize: categorizeBankTransaction2,
14088
- match: matchBankTransaction2,
14089
- shouldHideAfterCategorize
14090
- } = useBankTransactionsContext();
14091
- const [selectedCategory, setSelectedCategory] = useState(
14092
- getDefaultSelectedCategoryForBankTransaction(bankTransaction)
14093
- );
14284
+ const { shouldHideAfterCategorize } = useBankTransactionsContext();
14094
14285
  const [open, setOpen] = useState(false);
14095
14286
  const toggleOpen = () => {
14096
14287
  setShowRetry(false);
14097
14288
  setOpen(!open);
14098
14289
  };
14290
+ const bookkeepingStatus = useEffectiveBookkeepingStatus();
14291
+ const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
14292
+ const categorized = isCategorized(bankTransaction);
14293
+ const { isVisible } = useDelayedVisibility({ delay: index * 20, initialVisibility: Boolean(initialLoad) });
14099
14294
  const { select, deselect } = useBulkSelectionActions();
14100
14295
  const isSelected = useIdIsSelected();
14101
14296
  const isTransactionSelected = isSelected(bankTransaction.id);
14102
14297
  const { setTransactionCategory } = useBankTransactionsCategoryActions();
14103
- const openRow = {
14104
- onMouseDown: () => {
14105
- clickTimer = Date.now();
14106
- },
14107
- onMouseUp: () => {
14108
- if (Date.now() - clickTimer < 100 && !open) {
14109
- setShowRetry(false);
14110
- setOpen(true);
14111
- }
14112
- }
14113
- };
14298
+ const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
14299
+ const { saveBankTransactionRow } = useSaveBankTransactionRow();
14114
14300
  useEffect(() => {
14115
14301
  if (bankTransaction.error) {
14116
14302
  setShowRetry(true);
@@ -14129,30 +14315,21 @@ const BankTransactionRow = ({
14129
14315
  (_a2 = expandedRowRef == null ? void 0 : expandedRowRef.current) == null ? void 0 : _a2.save();
14130
14316
  return;
14131
14317
  }
14132
- if (!selectedCategory || isPlaceholderAsOption(selectedCategory)) {
14133
- return;
14134
- }
14135
- if (isSuggestedMatchAsOption(selectedCategory)) {
14136
- yield matchBankTransaction2(bankTransaction.id, selectedCategory.original.id);
14137
- deselect(bankTransaction.id);
14138
- setOpen(false);
14139
- return;
14140
- }
14141
- if (isSplitAsOption(selectedCategory)) {
14142
- return;
14143
- }
14144
- if (!selectedCategory.classificationEncoded) return;
14145
- yield categorizeBankTransaction2(bankTransaction.id, {
14146
- type: "Category",
14147
- category: selectedCategory.classificationEncoded
14148
- });
14318
+ yield saveBankTransactionRow(selectedCategory, bankTransaction);
14149
14319
  deselect(bankTransaction.id);
14150
14320
  setOpen(false);
14151
14321
  });
14152
- const bookkeepingStatus = useEffectiveBookkeepingStatus();
14153
- const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
14154
- const categorized = isCategorized(bankTransaction);
14155
- const { isVisible } = useDelayedVisibility({ delay: index * 20, initialVisibility: Boolean(initialLoad) });
14322
+ const openRow = {
14323
+ onMouseDown: () => {
14324
+ clickTimer = Date.now();
14325
+ },
14326
+ onMouseUp: () => {
14327
+ if (Date.now() - clickTimer < 100 && !open) {
14328
+ setShowRetry(false);
14329
+ setOpen(true);
14330
+ }
14331
+ }
14332
+ };
14156
14333
  const className = "Layer__bank-transaction-row";
14157
14334
  const openClassName = open ? `${className}--expanded` : "";
14158
14335
  const rowClassName = classNames(
@@ -14194,7 +14371,7 @@ const BankTransactionRow = ({
14194
14371
  __spreadProps(__spreadValues({
14195
14372
  className: "Layer__table-cell Layer__bank-transactions__tx-col"
14196
14373
  }, openRow), {
14197
- children: /* @__PURE__ */ jsx("span", { className: "Layer__table-cell-content", children: /* @__PURE__ */ jsx(Span, { children: (_a = bankTransaction.counterparty_name) != null ? _a : bankTransaction.description }) })
14374
+ children: /* @__PURE__ */ jsx("span", { className: "Layer__table-cell-content", children: /* @__PURE__ */ jsx(Span, { withTooltip: true, children: (_a = bankTransaction.counterparty_name) != null ? _a : bankTransaction.description }) })
14198
14375
  })
14199
14376
  ),
14200
14377
  /* @__PURE__ */ jsx(
@@ -14248,9 +14425,8 @@ const BankTransactionRow = ({
14248
14425
  BankTransactionCategoryComboBox,
14249
14426
  {
14250
14427
  bankTransaction,
14251
- selectedValue: selectedCategory,
14428
+ selectedValue: selectedCategory != null ? selectedCategory : null,
14252
14429
  onSelectedValueChange: (selectedCategory2) => {
14253
- setSelectedCategory(selectedCategory2);
14254
14430
  setTransactionCategory(bankTransaction.id, selectedCategory2);
14255
14431
  setShowRetry(false);
14256
14432
  },
@@ -14420,28 +14596,29 @@ const BankTransactionListItem = ({
14420
14596
  stringOverrides,
14421
14597
  showDescriptions,
14422
14598
  showReceiptUploads,
14423
- showTooltips
14599
+ showTooltips,
14600
+ _showBulkSelection = false
14424
14601
  }) => {
14425
14602
  var _a, _b;
14426
14603
  const expandedRowRef = useRef(null);
14427
14604
  const [showRetry, setShowRetry] = useState(false);
14428
- const {
14429
- categorize: categorizeBankTransaction2,
14430
- match: matchBankTransaction2,
14431
- shouldHideAfterCategorize
14432
- } = useBankTransactionsContext();
14433
- const [selectedCategory, setSelectedCategory] = useState(
14434
- getDefaultSelectedCategoryForBankTransaction(bankTransaction)
14435
- );
14436
- const [open, setOpen] = useState(false);
14437
- const toggleOpen = () => {
14605
+ const { shouldHideAfterCategorize } = useBankTransactionsContext();
14606
+ const { saveBankTransactionRow } = useSaveBankTransactionRow();
14607
+ const [openExpandedRow, setOpenExpandedRow] = useState(false);
14608
+ const toggleExpandedRow = () => {
14438
14609
  setShowRetry(false);
14439
- setOpen(!open);
14610
+ setOpenExpandedRow(!openExpandedRow);
14440
14611
  };
14612
+ const { isDesktop } = useSizeClass();
14441
14613
  const bookkeepingStatus = useEffectiveBookkeepingStatus();
14442
14614
  const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
14443
- const { isDesktop } = useSizeClass();
14615
+ const categorized = isCategorized(bankTransaction);
14444
14616
  const { isVisible } = useDelayedVisibility({ delay: index * 80 });
14617
+ const { select, deselect } = useBulkSelectionActions();
14618
+ const isSelected = useIdIsSelected();
14619
+ const isTransactionSelected = isSelected(bankTransaction.id);
14620
+ const { setTransactionCategory } = useBankTransactionsCategoryActions();
14621
+ const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
14445
14622
  useEffect(() => {
14446
14623
  if (bankTransaction.error) {
14447
14624
  setShowRetry(true);
@@ -14456,33 +14633,20 @@ const BankTransactionListItem = ({
14456
14633
  }, [bankTransaction.recently_categorized]);
14457
14634
  const save = () => __async(null, null, function* () {
14458
14635
  var _a2;
14459
- if (open && (expandedRowRef == null ? void 0 : expandedRowRef.current)) {
14636
+ if (openExpandedRow && (expandedRowRef == null ? void 0 : expandedRowRef.current)) {
14460
14637
  (_a2 = expandedRowRef == null ? void 0 : expandedRowRef.current) == null ? void 0 : _a2.save();
14461
14638
  return;
14462
14639
  }
14463
- if (!selectedCategory || isPlaceholderAsOption(selectedCategory)) {
14464
- return;
14465
- }
14466
- if (isSuggestedMatchAsOption(selectedCategory)) {
14467
- yield matchBankTransaction2(bankTransaction.id, selectedCategory.original.id);
14468
- return;
14469
- }
14470
- if (isSplitAsOption(selectedCategory)) {
14471
- return;
14472
- }
14473
- if (selectedCategory.classificationEncoded === null) return;
14474
- yield categorizeBankTransaction2(bankTransaction.id, {
14475
- type: "Category",
14476
- category: selectedCategory.classificationEncoded
14477
- });
14640
+ yield saveBankTransactionRow(selectedCategory, bankTransaction);
14641
+ deselect(bankTransaction.id);
14642
+ setOpenExpandedRow(false);
14478
14643
  });
14479
- const categorized = isCategorized(bankTransaction);
14480
14644
  const className = "Layer__bank-transaction-list-item";
14481
- const openClassName = open ? `${className}--expanded` : "";
14645
+ const openClassName = openExpandedRow ? `${className}--expanded` : "";
14482
14646
  const rowClassName = classNames(
14483
14647
  className,
14484
14648
  bankTransaction.recently_categorized && editable && shouldHideAfterCategorize() ? "Layer__bank-transaction-row--removing" : "",
14485
- open ? openClassName : "",
14649
+ openExpandedRow ? openClassName : "",
14486
14650
  isVisible ? "show" : ""
14487
14651
  );
14488
14652
  return /* @__PURE__ */ jsxs("li", { className: rowClassName, children: [
@@ -14500,7 +14664,7 @@ const BankTransactionListItem = ({
14500
14664
  /* @__PURE__ */ jsx(
14501
14665
  "div",
14502
14666
  {
14503
- onClick: toggleOpen,
14667
+ onClick: toggleExpandedRow,
14504
14668
  className: classNames(
14505
14669
  "Layer__bank-transaction-row__expand-button",
14506
14670
  !isDesktop && "Layer__bank-transaction-row__expand-button--mobile"
@@ -14508,14 +14672,27 @@ const BankTransactionListItem = ({
14508
14672
  children: /* @__PURE__ */ jsx(
14509
14673
  ChevronDownFill,
14510
14674
  {
14511
- className: `Layer__chevron ${open ? "Layer__chevron__up" : "Layer__chevron__down"}`
14675
+ className: `Layer__chevron ${openExpandedRow ? "Layer__chevron__up" : "Layer__chevron__down"}`
14512
14676
  }
14513
14677
  )
14514
14678
  }
14515
14679
  )
14516
14680
  ] }),
14517
14681
  /* @__PURE__ */ jsxs("span", { className: `${className}__body`, children: [
14518
- /* @__PURE__ */ jsx("span", { className: `${className}__body__name`, children: /* @__PURE__ */ jsx(Text, { as: "span", withTooltip: TextUseTooltip.whenTruncated, children: (_b = bankTransaction.counterparty_name) != null ? _b : bankTransaction.description }) }),
14682
+ _showBulkSelection && /* @__PURE__ */ jsx("div", { className: `${className}__checkbox`, children: /* @__PURE__ */ jsx(
14683
+ Checkbox,
14684
+ {
14685
+ isSelected: isTransactionSelected,
14686
+ onChange: (selected) => {
14687
+ if (selected) {
14688
+ select(bankTransaction.id);
14689
+ } else {
14690
+ deselect(bankTransaction.id);
14691
+ }
14692
+ }
14693
+ }
14694
+ ) }),
14695
+ /* @__PURE__ */ jsx(HStack, { className: `${className}__body__name`, children: /* @__PURE__ */ jsx(Span, { withTooltip: true, children: (_b = bankTransaction.counterparty_name) != null ? _b : bankTransaction.description }) }),
14519
14696
  /* @__PURE__ */ jsx(
14520
14697
  "span",
14521
14698
  {
@@ -14530,8 +14707,8 @@ const BankTransactionListItem = ({
14530
14707
  {
14531
14708
  ref: expandedRowRef,
14532
14709
  bankTransaction,
14533
- isOpen: open,
14534
- close: () => setOpen(false),
14710
+ isOpen: openExpandedRow,
14711
+ close: () => setOpenExpandedRow(false),
14535
14712
  categorized,
14536
14713
  asListItem: true,
14537
14714
  submitBtnText: categorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Approve",
@@ -14546,9 +14723,9 @@ const BankTransactionListItem = ({
14546
14723
  BankTransactionCategoryComboBox,
14547
14724
  {
14548
14725
  bankTransaction,
14549
- selectedValue: selectedCategory,
14726
+ selectedValue: selectedCategory != null ? selectedCategory : null,
14550
14727
  onSelectedValueChange: (selectedCategory2) => {
14551
- setSelectedCategory(selectedCategory2);
14728
+ setTransactionCategory(bankTransaction.id, selectedCategory2);
14552
14729
  setShowRetry(false);
14553
14730
  },
14554
14731
  isLoading: bankTransaction.processing
@@ -14587,6 +14764,51 @@ const BankTransactionListItem = ({
14587
14764
  bankTransaction.error && showRetry ? /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
14588
14765
  ] });
14589
14766
  };
14767
+ const useBankTransactionsTableCheckboxState = ({ bankTransactions }) => {
14768
+ const { selectedIds } = useSelectedIds();
14769
+ const { selectMultiple, deselectMultiple } = useBulkSelectionActions();
14770
+ const currentPageIds = useMemo(
14771
+ () => {
14772
+ var _a;
14773
+ return (_a = bankTransactions == null ? void 0 : bankTransactions.map((tx) => tx.id)) != null ? _a : [];
14774
+ },
14775
+ [bankTransactions]
14776
+ );
14777
+ const selectedCount = useMemo(
14778
+ () => currentPageIds.filter((id) => selectedIds.has(id)).length,
14779
+ [currentPageIds, selectedIds]
14780
+ );
14781
+ const isAllSelected = selectedCount > 0 && selectedCount === currentPageIds.length;
14782
+ const isPartiallySelected = selectedCount > 0 && selectedCount < currentPageIds.length;
14783
+ const onHeaderCheckboxChange = useCallback((checked) => {
14784
+ if (!checked || isPartiallySelected) {
14785
+ deselectMultiple(currentPageIds);
14786
+ } else {
14787
+ selectMultiple(currentPageIds);
14788
+ }
14789
+ }, [
14790
+ currentPageIds,
14791
+ isPartiallySelected,
14792
+ selectMultiple,
14793
+ deselectMultiple
14794
+ ]);
14795
+ return useMemo(() => ({
14796
+ isAllSelected,
14797
+ isPartiallySelected,
14798
+ onHeaderCheckboxChange
14799
+ }), [isAllSelected, isPartiallySelected, onHeaderCheckboxChange]);
14800
+ };
14801
+ const useUpsertBankTransactionsDefaultCategories = (bankTransactions) => {
14802
+ const { setOnlyNewTransactionCategories } = useBankTransactionsCategoryActions();
14803
+ useEffect(() => {
14804
+ if (!bankTransactions) return;
14805
+ const defaultCategories = bankTransactions.map((transaction) => ({
14806
+ id: transaction.id,
14807
+ category: getDefaultSelectedCategoryForBankTransaction(transaction)
14808
+ }));
14809
+ setOnlyNewTransactionCategories(defaultCategories);
14810
+ }, [bankTransactions, setOnlyNewTransactionCategories]);
14811
+ };
14590
14812
  const BankTransactionList = ({
14591
14813
  bankTransactions,
14592
14814
  editable,
@@ -14595,29 +14817,56 @@ const BankTransactionList = ({
14595
14817
  stringOverrides,
14596
14818
  showDescriptions,
14597
14819
  showReceiptUploads,
14598
- showTooltips
14820
+ showTooltips,
14821
+ _showBulkSelection = false
14599
14822
  }) => {
14600
- return /* @__PURE__ */ jsx("ul", { className: "Layer__bank-transactions__list", children: bankTransactions == null ? void 0 : bankTransactions.map(
14601
- (bankTransaction, index) => /* @__PURE__ */ jsx(
14602
- BankTransactionListItem,
14823
+ const { isAllSelected, isPartiallySelected, onHeaderCheckboxChange } = useBankTransactionsTableCheckboxState({ bankTransactions });
14824
+ useUpsertBankTransactionsDefaultCategories(bankTransactions);
14825
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
14826
+ _showBulkSelection && /* @__PURE__ */ jsxs(
14827
+ HStack,
14603
14828
  {
14604
- index,
14605
- dateFormat: DATE_FORMAT$1,
14606
- bankTransaction,
14607
- editable,
14608
- removeTransaction,
14609
- containerWidth,
14610
- stringOverrides,
14611
- showDescriptions,
14612
- showReceiptUploads,
14613
- showTooltips
14614
- },
14615
- bankTransaction.id
14616
- )
14617
- ) });
14829
+ gap: "md",
14830
+ pi: "md",
14831
+ pb: "md",
14832
+ className: "Layer__bank-transactions__list-header",
14833
+ children: [
14834
+ /* @__PURE__ */ jsx(
14835
+ Checkbox,
14836
+ {
14837
+ isSelected: isAllSelected,
14838
+ isIndeterminate: isPartiallySelected,
14839
+ onChange: onHeaderCheckboxChange,
14840
+ "aria-label": "Select all transactions on this page"
14841
+ }
14842
+ ),
14843
+ /* @__PURE__ */ jsx(Span, { size: "sm", pbs: "3xs", children: "Select all" })
14844
+ ]
14845
+ }
14846
+ ),
14847
+ /* @__PURE__ */ jsx("ul", { className: "Layer__bank-transactions__list", children: bankTransactions == null ? void 0 : bankTransactions.map(
14848
+ (bankTransaction, index) => /* @__PURE__ */ jsx(
14849
+ BankTransactionListItem,
14850
+ {
14851
+ index,
14852
+ dateFormat: DATE_FORMAT$1,
14853
+ bankTransaction,
14854
+ editable,
14855
+ removeTransaction,
14856
+ containerWidth,
14857
+ stringOverrides,
14858
+ showDescriptions,
14859
+ showReceiptUploads,
14860
+ showTooltips,
14861
+ _showBulkSelection
14862
+ },
14863
+ bankTransaction.id
14864
+ )
14865
+ ) })
14866
+ ] });
14618
14867
  };
14619
- const Paperclip = (_ib) => {
14620
- var _jb = _ib, { size = 20 } = _jb, props = __objRest(_jb, ["size"]);
14868
+ const Paperclip = (_ob) => {
14869
+ var _pb = _ob, { size = 20 } = _pb, props = __objRest(_pb, ["size"]);
14621
14870
  return /* @__PURE__ */ jsx(
14622
14871
  "svg",
14623
14872
  __spreadProps(__spreadValues({
@@ -14725,8 +14974,8 @@ const getAssignedValue$1 = (bankTransaction) => {
14725
14974
  }
14726
14975
  return null;
14727
14976
  };
14728
- const X = (_kb) => {
14729
- var _lb = _kb, { size = 18 } = _lb, props = __objRest(_lb, ["size"]);
14977
+ const X = (_qb) => {
14978
+ var _rb = _qb, { size = 18 } = _rb, props = __objRest(_rb, ["size"]);
14730
14979
  return /* @__PURE__ */ jsxs(
14731
14980
  "svg",
14732
14981
  __spreadProps(__spreadValues({
@@ -14760,11 +15009,11 @@ const X = (_kb) => {
14760
15009
  );
14761
15010
  };
14762
15011
  const CLASS_NAME$7 = "Layer__MinimalSearchField";
14763
- function MinimalSearchField(_mb) {
14764
- var _nb = _mb, {
15012
+ function MinimalSearchField(_sb) {
15013
+ var _tb = _sb, {
14765
15014
  placeholder,
14766
15015
  isDisabled
14767
- } = _nb, restProps = __objRest(_nb, [
15016
+ } = _tb, restProps = __objRest(_tb, [
14768
15017
  "placeholder",
14769
15018
  "isDisabled"
14770
15019
  ]);
@@ -14781,8 +15030,8 @@ function MinimalSearchField(_mb) {
14781
15030
  }
14782
15031
  const INPUT_GROUP_CLASS_NAME = "Layer__InputGroup";
14783
15032
  const InputGroup = forwardRef(
14784
- function InputGroup2(_ob, ref) {
14785
- var _pb = _ob, { actionCount, className, slots, children } = _pb, restProps = __objRest(_pb, ["actionCount", "className", "slots", "children"]);
15033
+ function InputGroup2(_ub, ref) {
15034
+ var _vb = _ub, { actionCount, className, slots, children } = _vb, restProps = __objRest(_vb, ["actionCount", "className", "slots", "children"]);
14786
15035
  const combinedClassName = classNames(INPUT_GROUP_CLASS_NAME, className);
14787
15036
  const dataProperties = toDataProperties({
14788
15037
  "action-count": actionCount
@@ -14798,8 +15047,8 @@ const InputGroup = forwardRef(
14798
15047
  }
14799
15048
  );
14800
15049
  const CLASS_NAME$6 = "Layer__SearchField";
14801
- function SearchField(_qb) {
14802
- var _rb = _qb, { slot = "search", className, label, isDisabled } = _rb, restProps = __objRest(_rb, ["slot", "className", "label", "isDisabled"]);
15050
+ function SearchField(_wb) {
15051
+ var _xb = _wb, { slot = "search", className, label, isDisabled } = _xb, restProps = __objRest(_xb, ["slot", "className", "label", "isDisabled"]);
14803
15052
  const combinedClassName = classNames(CLASS_NAME$6, className);
14804
15053
  return /* @__PURE__ */ jsxs(InputGroup, { slot, className: combinedClassName, children: [
14805
15054
  /* @__PURE__ */ jsx(VStack, { slot: "icon", align: "center", justify: "center", className: "Layer__SearchField__Icon", "data-disabled": isDisabled || void 0, children: /* @__PURE__ */ jsx(Search, { size: 14 }) }),
@@ -15168,11 +15417,11 @@ const MatchForm = ({
15168
15417
  showDescriptions,
15169
15418
  showCategorization
15170
15419
  }) => {
15171
- var _a, _b;
15420
+ var _a;
15172
15421
  const receiptsRef = useRef(null);
15173
15422
  const { match: matchBankTransaction2, isLoading } = useBankTransactionsContext();
15174
- const [selectedMatchId, setSelectedMatchId] = useState(
15175
- (_b = isAlreadyMatched$1(bankTransaction)) != null ? _b : bankTransaction.suggested_matches && ((_a = bankTransaction.suggested_matches) == null ? void 0 : _a.length) > 0 ? bankTransaction.suggested_matches[0].id : void 0
15423
+ const [selectedMatch, setSelectedMatch] = useState(
15424
+ getBankTransactionMatchAsSuggestedMatch(bankTransaction)
15176
15425
  );
15177
15426
  const [formError, setFormError] = useState();
15178
15427
  const showRetry = Boolean(bankTransaction.error);
@@ -15187,13 +15436,14 @@ const MatchForm = ({
15187
15436
  yield matchBankTransaction2(bankTransaction.id, foundMatch.id, true);
15188
15437
  });
15189
15438
  const save = () => __async(null, null, function* () {
15439
+ var _a2;
15190
15440
  if (!showCategorization) {
15191
15441
  return;
15192
15442
  }
15193
- if (!selectedMatchId) {
15443
+ if (!selectedMatch) {
15194
15444
  setFormError("Select an option to match the transaction");
15195
- } else if (selectedMatchId && selectedMatchId !== isAlreadyMatched$1(bankTransaction)) {
15196
- yield onMatchSubmit(selectedMatchId);
15445
+ } else if (selectedMatch && selectedMatch.id !== ((_a2 = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a2.id)) {
15446
+ yield onMatchSubmit(selectedMatch.id);
15197
15447
  }
15198
15448
  return;
15199
15449
  });
@@ -15205,10 +15455,10 @@ const MatchForm = ({
15205
15455
  classNamePrefix: "Layer__bank-transaction-mobile-list-item",
15206
15456
  readOnly: !showCategorization,
15207
15457
  bankTransaction,
15208
- selectedMatchId,
15209
- setSelectedMatchId: (id) => {
15458
+ selectedMatchId: selectedMatch == null ? void 0 : selectedMatch.id,
15459
+ setSelectedMatch: (suggestedMatch) => {
15210
15460
  setFormError(void 0);
15211
- setSelectedMatchId(id);
15461
+ setSelectedMatch(suggestedMatch);
15212
15462
  }
15213
15463
  }
15214
15464
  ),
@@ -15254,7 +15504,7 @@ const MatchForm = ({
15254
15504
  Button$1,
15255
15505
  {
15256
15506
  fullWidth: true,
15257
- disabled: !selectedMatchId || isLoading || bankTransaction.processing || selectedMatchId === isAlreadyMatched$1(bankTransaction),
15507
+ disabled: !selectedMatch || isLoading || bankTransaction.processing || selectedMatch.id === ((_a = getBankTransactionMatchAsSuggestedMatch(bankTransaction)) == null ? void 0 : _a.id),
15258
15508
  onClick: () => {
15259
15509
  void save();
15260
15510
  },
@@ -15266,8 +15516,8 @@ const MatchForm = ({
15266
15516
  showRetry ? /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : null
15267
15517
  ] });
15268
15518
  };
15269
- const ChevronDown = (_sb) => {
15270
- var _tb = _sb, { size = 18 } = _tb, props = __objRest(_tb, ["size"]);
15519
+ const ChevronDown = (_yb) => {
15520
+ var _zb = _yb, { size = 18 } = _zb, props = __objRest(_zb, ["size"]);
15271
15521
  return /* @__PURE__ */ jsx(
15272
15522
  "svg",
15273
15523
  __spreadProps(__spreadValues({
@@ -15365,7 +15615,6 @@ const SplitForm = ({
15365
15615
  const splitCustomerVendor = c.customer ? decodeCustomerVendor(__spreadProps(__spreadValues({}, c.customer), { customerVendorType: "CUSTOMER" })) : c.vendor ? decodeCustomerVendor(__spreadProps(__spreadValues({}, c.vendor), { customerVendorType: "VENDOR" })) : null;
15366
15616
  return {
15367
15617
  amount: c.amount || 0,
15368
- inputValue: centsToDollars(c.amount),
15369
15618
  category: new ApiCategorizationAsOption(c.category),
15370
15619
  tags: splitTags,
15371
15620
  customerVendor: splitCustomerVendor
@@ -15373,14 +15622,12 @@ const SplitForm = ({
15373
15622
  }) : [
15374
15623
  {
15375
15624
  amount: bankTransaction.amount,
15376
- inputValue: centsToDollars(bankTransaction.amount),
15377
15625
  category: defaultCategory ? new ApiCategorizationAsOption(defaultCategory) : null,
15378
15626
  tags: [],
15379
15627
  customerVendor: initialCustomerVendor
15380
15628
  },
15381
15629
  {
15382
15630
  amount: 0,
15383
- inputValue: "0.00",
15384
15631
  category: defaultCategory ? new ApiCategorizationAsOption(defaultCategory) : null,
15385
15632
  tags: [],
15386
15633
  customerVendor: initialCustomerVendor
@@ -15404,7 +15651,6 @@ const SplitForm = ({
15404
15651
  }, 0);
15405
15652
  const remaining = bankTransaction.amount - splitTotal;
15406
15653
  newSplits[0].amount = remaining;
15407
- newSplits[0].inputValue = centsToDollars(remaining);
15408
15654
  updateRowState(__spreadProps(__spreadValues({}, rowState), {
15409
15655
  splits: newSplits
15410
15656
  }));
@@ -15412,23 +15658,18 @@ const SplitForm = ({
15412
15658
  };
15413
15659
  const updateAmounts = (rowNumber) => (event) => {
15414
15660
  const newAmount = dollarsToCents(event.target.value) || 0;
15415
- const newDisplaying = event.target.value;
15416
15661
  const splitTotal = rowState.splits.reduce((sum, split, index) => {
15417
15662
  const amount = index === 0 ? 0 : index === rowNumber ? newAmount : split.amount;
15418
15663
  return sum + amount;
15419
15664
  }, 0);
15420
15665
  const remaining = bankTransaction.amount - splitTotal;
15421
15666
  rowState.splits[rowNumber].amount = newAmount;
15422
- rowState.splits[rowNumber].inputValue = newDisplaying;
15423
15667
  rowState.splits[0].amount = remaining;
15424
- rowState.splits[0].inputValue = centsToDollars(remaining);
15425
15668
  updateRowState(__spreadValues({}, rowState));
15426
15669
  setFormError(void 0);
15427
15670
  };
15428
15671
  const onBlur = (event) => {
15429
15672
  if (event.target.value === "") {
15430
- const [_, index] = event.target.name.split("-");
15431
- rowState.splits[parseInt(index)].inputValue = "0.00";
15432
15673
  updateRowState(__spreadValues({}, rowState));
15433
15674
  setFormError(void 0);
15434
15675
  }
@@ -15444,7 +15685,6 @@ const SplitForm = ({
15444
15685
  ...rowState.splits,
15445
15686
  {
15446
15687
  amount: 0,
15447
- inputValue: "0.00",
15448
15688
  category: defaultCategory ? new ApiCategorizationAsOption(defaultCategory) : null,
15449
15689
  tags: [],
15450
15690
  customerVendor: initialCustomerVendor
@@ -15529,7 +15769,7 @@ const SplitForm = ({
15529
15769
  ),
15530
15770
  disabled: index === 0,
15531
15771
  onChange: updateAmounts(index),
15532
- value: split.inputValue,
15772
+ value: convertFromCents(split.amount),
15533
15773
  onBlur,
15534
15774
  isInvalid: split.amount < 0,
15535
15775
  errorMessage: "Negative values are not allowed",
@@ -16065,9 +16305,8 @@ const BankTransactionsTable = ({
16065
16305
  onRefresh
16066
16306
  }) => {
16067
16307
  var _a, _b, _c, _d, _e, _f, _g;
16068
- const { selectedIds } = useSelectedIds();
16069
- const { selectMultiple, deselectMultiple } = useBulkSelectionActions();
16070
- const { setOnlyNewTransactionCategories } = useBankTransactionsCategoryActions();
16308
+ const { isAllSelected, isPartiallySelected, onHeaderCheckboxChange } = useBankTransactionsTableCheckboxState({ bankTransactions });
16309
+ useUpsertBankTransactionsDefaultCategories(bankTransactions);
16071
16310
  const showReceiptColumn = (_a = showReceiptUploads && (bankTransactions == null ? void 0 : bankTransactions.some(
16072
16311
  (transaction) => {
16073
16312
  var _a2;
@@ -16078,39 +16317,6 @@ const BankTransactionsTable = ({
16078
16317
  () => toDataProperties({ "show-receipt-upload-column": showReceiptColumn }),
16079
16318
  [showReceiptColumn]
16080
16319
  );
16081
- const currentPageIds = useMemo(
16082
- () => {
16083
- var _a2;
16084
- return (_a2 = bankTransactions == null ? void 0 : bankTransactions.map((tx) => tx.id)) != null ? _a2 : [];
16085
- },
16086
- [bankTransactions]
16087
- );
16088
- const selectedCount = useMemo(
16089
- () => currentPageIds.filter((id) => selectedIds.has(id)).length,
16090
- [currentPageIds, selectedIds]
16091
- );
16092
- const isAllSelected = selectedCount > 0 && selectedCount === currentPageIds.length;
16093
- const isPartiallySelected = selectedCount > 0 && selectedCount < currentPageIds.length;
16094
- const handleHeaderCheckboxChange = useCallback((checked) => {
16095
- if (!checked || isPartiallySelected) {
16096
- deselectMultiple(currentPageIds);
16097
- } else {
16098
- selectMultiple(currentPageIds);
16099
- }
16100
- }, [
16101
- currentPageIds,
16102
- isPartiallySelected,
16103
- selectMultiple,
16104
- deselectMultiple
16105
- ]);
16106
- useEffect(() => {
16107
- if (!bankTransactions) return;
16108
- const defaultCategories = bankTransactions.map((transaction) => ({
16109
- id: transaction.id,
16110
- category: getDefaultSelectedCategoryForBankTransaction(transaction)
16111
- }));
16112
- setOnlyNewTransactionCategories(defaultCategories);
16113
- }, [bankTransactions, setOnlyNewTransactionCategories]);
16114
16320
  return /* @__PURE__ */ jsxs(
16115
16321
  "table",
16116
16322
  {
@@ -16123,7 +16329,7 @@ const BankTransactionsTable = ({
16123
16329
  {
16124
16330
  isSelected: isAllSelected,
16125
16331
  isIndeterminate: isPartiallySelected,
16126
- onChange: handleHeaderCheckboxChange,
16332
+ onChange: onHeaderCheckboxChange,
16127
16333
  "aria-label": "Select all transactions on this page"
16128
16334
  }
16129
16335
  ) }) }),
@@ -16246,8 +16452,8 @@ const usePaginationRange = ({
16246
16452
  }, [totalCount, pageSize, siblingCount, currentPage]);
16247
16453
  return paginationRange;
16248
16454
  };
16249
- const PaginationButton = (_ub) => {
16250
- var _vb = _ub, { children, isSelected } = _vb, buttonProps = __objRest(_vb, ["children", "isSelected"]);
16455
+ const PaginationButton = (_Ab) => {
16456
+ var _Bb = _Ab, { children, isSelected } = _Bb, buttonProps = __objRest(_Bb, ["children", "isSelected"]);
16251
16457
  return /* @__PURE__ */ jsx(
16252
16458
  Button,
16253
16459
  __spreadProps(__spreadValues({
@@ -16518,7 +16724,6 @@ function Wizard({
16518
16724
  const contextValue = useMemo(() => ({ next, previous, goToStep }), [next, previous, goToStep]);
16519
16725
  return /* @__PURE__ */ jsx(WizardContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsxs(VStack, { gap: "md", children: [
16520
16726
  Header3,
16521
- /* @__PURE__ */ jsx(Separator, {}),
16522
16727
  currentStep,
16523
16728
  Footer
16524
16729
  ] }) });
@@ -16615,8 +16820,8 @@ const CreatableSelect = ({
16615
16820
  className
16616
16821
  );
16617
16822
  const DropdownIndicator = useCallback((props) => /* @__PURE__ */ jsx(components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsx(ChevronDownFill, {}) })), []);
16618
- return /* @__PURE__ */ jsxs(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
16619
- /* @__PURE__ */ jsx(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx(
16823
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { disabled: !isInvalid || !errorMessage, children: [
16824
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx(
16620
16825
  BaseCreatableSelect,
16621
16826
  {
16622
16827
  inputId,
@@ -16641,7 +16846,7 @@ const CreatableSelect = ({
16641
16846
  createOptionPosition
16642
16847
  }
16643
16848
  ) }),
16644
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: errorMessage })
16849
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
16645
16850
  ] });
16646
16851
  };
16647
16852
  const notEmpty = (value) => {
@@ -16667,15 +16872,15 @@ function flattenValidationErrors(errors) {
16667
16872
  }
16668
16873
  const FORM_CLASS_NAME = "Layer__UI__Form";
16669
16874
  const Form = forwardRef(
16670
- function Form2(_wb, ref) {
16671
- var _xb = _wb, { children, className } = _xb, restProps = __objRest(_xb, ["children", "className"]);
16875
+ function Form2(_Cb, ref) {
16876
+ var _Db = _Cb, { children, className } = _Db, restProps = __objRest(_Db, ["children", "className"]);
16672
16877
  return /* @__PURE__ */ jsx(Form$1, __spreadProps(__spreadValues({}, restProps), { className: classNames(FORM_CLASS_NAME, className), ref, children }));
16673
16878
  }
16674
16879
  );
16675
16880
  const TEXT_FIELD_CLASS_NAME = "Layer__UI__TextField";
16676
16881
  const TextField = forwardRef(
16677
- function TextField2(_yb, ref) {
16678
- var _zb = _yb, { children, inline, textarea, className } = _zb, restProps = __objRest(_zb, ["children", "inline", "textarea", "className"]);
16882
+ function TextField2(_Eb, ref) {
16883
+ var _Fb = _Eb, { children, inline, textarea, className } = _Fb, restProps = __objRest(_Fb, ["children", "inline", "textarea", "className"]);
16679
16884
  const dataProperties = toDataProperties({ inline, textarea });
16680
16885
  return /* @__PURE__ */ jsx(TextField$1, __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(TEXT_FIELD_CLASS_NAME, className), ref, children: withRenderProp(children, (node) => node) }));
16681
16886
  }
@@ -16732,8 +16937,8 @@ function BaseFormTextField({
16732
16937
  }
16733
16938
  const INPUT_CLASS_NAME = "Layer__UI__Input";
16734
16939
  const Input = forwardRef(
16735
- function Input2(_Ab, ref) {
16736
- var _Bb = _Ab, { inset, placement } = _Bb, restProps = __objRest(_Bb, ["inset", "placement"]);
16940
+ function Input2(_Gb, ref) {
16941
+ var _Hb = _Gb, { inset, placement } = _Hb, restProps = __objRest(_Hb, ["inset", "placement"]);
16737
16942
  const dataProperties = toDataProperties({ inset, placement });
16738
16943
  return /* @__PURE__ */ jsx(
16739
16944
  Input$2,
@@ -16829,15 +17034,15 @@ const withForceUpdate = (value) => {
16829
17034
  writable: false
16830
17035
  });
16831
17036
  };
16832
- function FormBigDecimalField(_Cb) {
16833
- var _Db = _Cb, {
17037
+ function FormBigDecimalField(_Ib) {
17038
+ var _Jb = _Ib, {
16834
17039
  mode = "decimal",
16835
17040
  allowNegative = false,
16836
17041
  maxValue = mode === "percent" ? BIG_DECIMAL_ONE : DEFAULT_MAX_VALUE,
16837
17042
  minDecimalPlaces = mode === "currency" ? 2 : DEFAULT_MIN_DECIMAL_PLACES,
16838
17043
  maxDecimalPlaces = mode === "currency" ? 2 : DEFAULT_MAX_DECIMAL_PLACES,
16839
17044
  slots
16840
- } = _Db, restProps = __objRest(_Db, [
17045
+ } = _Jb, restProps = __objRest(_Jb, [
16841
17046
  "mode",
16842
17047
  "allowNegative",
16843
17048
  "maxValue",
@@ -16949,8 +17154,8 @@ function FormCheckboxField({
16949
17154
  }
16950
17155
  const DATE_FIELD_CLASS_NAME = "Layer__UI__DateField";
16951
17156
  const DateField = forwardRef(
16952
- function DateField2(_Eb, ref) {
16953
- var _Fb = _Eb, { inline, className, isReadOnly } = _Fb, restProps = __objRest(_Fb, ["inline", "className", "isReadOnly"]);
17157
+ function DateField2(_Kb, ref) {
17158
+ var _Lb = _Kb, { inline, className, isReadOnly } = _Lb, restProps = __objRest(_Lb, ["inline", "className", "isReadOnly"]);
16954
17159
  const dataProperties = toDataProperties({ inline, readonly: isReadOnly });
16955
17160
  return /* @__PURE__ */ jsx(
16956
17161
  DateField$1,
@@ -16964,8 +17169,8 @@ const DateField = forwardRef(
16964
17169
  );
16965
17170
  const DATE_INPUT_CLASS_NAME = "Layer__UI__DateInput";
16966
17171
  const DateInput = forwardRef(
16967
- function DateInput2(_Gb, ref) {
16968
- var _Hb = _Gb, { inset } = _Hb, restProps = __objRest(_Hb, ["inset"]);
17172
+ function DateInput2(_Mb, ref) {
17173
+ var _Nb = _Mb, { inset } = _Nb, restProps = __objRest(_Nb, ["inset"]);
16969
17174
  const dataProperties = toDataProperties({ inset });
16970
17175
  return /* @__PURE__ */ jsx(
16971
17176
  DateInput$1,
@@ -16978,8 +17183,8 @@ const DateInput = forwardRef(
16978
17183
  );
16979
17184
  const DATE_SEGMENT_CLASS_NAME = "Layer__UI__DateSegment";
16980
17185
  const DateSegment = forwardRef(
16981
- function DateSegment2(_Ib, ref) {
16982
- var _Jb = _Ib, { isReadOnly } = _Jb, restProps = __objRest(_Jb, ["isReadOnly"]);
17186
+ function DateSegment2(_Ob, ref) {
17187
+ var _Pb = _Ob, { isReadOnly } = _Pb, restProps = __objRest(_Pb, ["isReadOnly"]);
16983
17188
  const dataProperties = toDataProperties({ interactive: !isReadOnly });
16984
17189
  return /* @__PURE__ */ jsx(
16985
17190
  DateSegment$1,
@@ -17057,8 +17262,8 @@ function FormDateField({
17057
17262
  }
17058
17263
  const TEXTAREA_CLASS_NAME = "Layer__UI__TextArea";
17059
17264
  const TextArea = forwardRef(
17060
- function TextArea2(_Kb, ref) {
17061
- var _Lb = _Kb, { resize = "none" } = _Lb, restProps = __objRest(_Lb, ["resize"]);
17265
+ function TextArea2(_Qb, ref) {
17266
+ var _Rb = _Qb, { resize = "none" } = _Rb, restProps = __objRest(_Rb, ["resize"]);
17062
17267
  const dataProperties = toDataProperties({ resize });
17063
17268
  return /* @__PURE__ */ jsx(
17064
17269
  TextArea$1,
@@ -18321,22 +18526,19 @@ const BulkActionsModule = ({ slots }) => {
18321
18526
  const { count } = useCountSelectedIds();
18322
18527
  const { clearSelection } = useBulkSelectionActions();
18323
18528
  return /* @__PURE__ */ jsxs(HStack, { slot: "toggle", justify: "space-between", align: "center", gap: "xs", children: [
18324
- /* @__PURE__ */ jsxs(HStack, { justify: "space-between", align: "center", gap: "sm", pi: "sm", className: "Layer__BulkActionsModule__SelectedItemsContainer", children: [
18325
- /* @__PURE__ */ jsx("div", { className: "Layer__BulkActionsModule__SelectedItems", children: /* @__PURE__ */ jsxs(Span, { children: [
18326
- count,
18327
- " selected ",
18328
- pluralize("item", count)
18329
- ] }) }),
18330
- /* @__PURE__ */ jsx("div", { className: "Layer__BulkActionsModule__Divider" }),
18331
- /* @__PURE__ */ jsx(HStack, { align: "center", children: /* @__PURE__ */ jsx(
18529
+ /* @__PURE__ */ jsxs(HStack, { justify: "space-between", align: "center", pis: "xs", pie: "3xs", gap: "3xs", className: "Layer__BulkActionsModule__SelectedItemsContainer", children: [
18530
+ /* @__PURE__ */ jsx(Span, { noWrap: true, children: `${count} selected` }),
18531
+ /* @__PURE__ */ jsx(
18332
18532
  Button,
18333
18533
  {
18334
- variant: "text",
18534
+ variant: "ghost",
18535
+ icon: true,
18536
+ inset: true,
18335
18537
  onClick: clearSelection,
18336
18538
  "aria-label": "Clear selected items",
18337
- children: "Clear"
18539
+ children: /* @__PURE__ */ jsx(X, {})
18338
18540
  }
18339
- ) })
18541
+ )
18340
18542
  ] }),
18341
18543
  /* @__PURE__ */ jsx(slots.BulkActions, {})
18342
18544
  ] });
@@ -18360,40 +18562,17 @@ const CategoryUpdateSchema = Schema$1.Union(
18360
18562
  SingleCategoryUpdateSchema,
18361
18563
  SplitCategoryUpdateSchema
18362
18564
  );
18363
- const BULK_MATCH_OR_CATEGORIZE_TAG = "#bulk-match-or-categorize";
18364
- const MatchTransactionRequestSchema = Schema.Struct({
18365
- type: Schema.Literal("match"),
18366
- suggestedMatchId: pipe(
18367
- Schema.propertySignature(Schema.UUID),
18368
- Schema.fromKey("suggested_match_id")
18369
- )
18370
- });
18565
+ const BULK_CATEGORIZE_BANK_TRANSACTIONS_TAG_KEY = "#bulk-categorize-bank-transactions";
18371
18566
  const CategorizeTransactionRequestSchema$1 = Schema.Struct({
18372
- type: Schema.Literal("categorize"),
18567
+ transactionId: Schema.propertySignature(Schema.UUID).pipe(
18568
+ Schema.fromKey("transaction_id")
18569
+ ),
18373
18570
  categorization: CategoryUpdateSchema
18374
18571
  });
18375
- const MatchOrCategorizeTransactionRequestSchema = Schema.Union(
18376
- MatchTransactionRequestSchema,
18377
- CategorizeTransactionRequestSchema$1
18378
- );
18379
- const BulkMatchOrCategorizeRequestSchema = Schema.Struct({
18380
- transactions: Schema.Record({
18381
- key: Schema.UUID,
18382
- value: MatchOrCategorizeTransactionRequestSchema
18383
- })
18384
- });
18385
- Schema.Struct({
18386
- businessId: Schema.String
18572
+ const BulkCategorizeRequestSchema = Schema.Struct({
18573
+ transactions: Schema.Array(CategorizeTransactionRequestSchema$1)
18387
18574
  });
18388
- const bulkMatchOrCategorize = post(
18389
- ({ businessId }) => {
18390
- const parameters = toDefinedSearchParameters({
18391
- categorization_source: "API_FROM_COMPONENT",
18392
- match_source: "API_CONFIRM_MATCH_FROM_COMPONENT"
18393
- });
18394
- return `/v1/businesses/${businessId}/bank-transactions/bulk-match-or-categorize?${parameters}`;
18395
- }
18396
- );
18575
+ const bulkCategorize = post(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/bulk-categorize`);
18397
18576
  function buildKey$C({
18398
18577
  access_token: accessToken,
18399
18578
  apiUrl,
@@ -18404,30 +18583,24 @@ function buildKey$C({
18404
18583
  accessToken,
18405
18584
  apiUrl,
18406
18585
  businessId,
18407
- tags: [BULK_MATCH_OR_CATEGORIZE_TAG]
18586
+ tags: [BULK_CATEGORIZE_BANK_TRANSACTIONS_TAG_KEY]
18408
18587
  };
18409
18588
  }
18410
18589
  }
18411
- const useBulkMatchOrCategorize = () => {
18590
+ const useBulkCategorize = () => {
18412
18591
  const { data } = useAuth();
18413
18592
  const { businessId } = useLayerContext();
18414
- const { selectedIds } = useSelectedIds();
18415
- const { transactionCategories } = useGetAllBankTransactionsCategories();
18416
18593
  const { forceReloadBankTransactions } = useBankTransactionsGlobalCacheActions();
18417
- const buildTransactionsPayload = useCallback(() => {
18418
- const transactions = buildBulkMatchOrCategorizePayload(selectedIds, transactionCategories);
18419
- return { transactions };
18420
- }, [selectedIds, transactionCategories]);
18421
18594
  const mutationResponse = useSWRMutation(
18422
18595
  () => buildKey$C(__spreadProps(__spreadValues({}, data), {
18423
18596
  businessId
18424
18597
  })),
18425
- ({ accessToken, apiUrl, businessId: businessId2 }, { arg }) => bulkMatchOrCategorize(
18598
+ ({ accessToken, apiUrl, businessId: businessId2 }, { arg }) => bulkCategorize(
18426
18599
  apiUrl,
18427
18600
  accessToken,
18428
18601
  {
18429
18602
  params: { businessId: businessId2 },
18430
- body: Schema.encodeSync(BulkMatchOrCategorizeRequestSchema)(arg)
18603
+ body: Schema.encodeSync(BulkCategorizeRequestSchema)(arg)
18431
18604
  }
18432
18605
  ).then(({ data: data2 }) => data2),
18433
18606
  {
@@ -18435,19 +18608,16 @@ const useBulkMatchOrCategorize = () => {
18435
18608
  throwOnError: true
18436
18609
  }
18437
18610
  );
18438
- const { trigger: originalTrigger } = mutationResponse;
18611
+ const originalTrigger = mutationResponse.trigger;
18439
18612
  const stableProxiedTrigger = useCallback(
18440
18613
  (...triggerParameters) => __async(null, null, function* () {
18441
18614
  const triggerResult = yield originalTrigger(...triggerParameters);
18442
18615
  void forceReloadBankTransactions();
18443
18616
  return triggerResult;
18444
18617
  }),
18445
- [
18446
- originalTrigger,
18447
- forceReloadBankTransactions
18448
- ]
18618
+ [originalTrigger, forceReloadBankTransactions]
18449
18619
  );
18450
- const proxiedResponse = new Proxy(mutationResponse, {
18620
+ return new Proxy(mutationResponse, {
18451
18621
  get(target, prop) {
18452
18622
  if (prop === "trigger") {
18453
18623
  return stableProxiedTrigger;
@@ -18455,59 +18625,109 @@ const useBulkMatchOrCategorize = () => {
18455
18625
  return Reflect.get(target, prop);
18456
18626
  }
18457
18627
  });
18458
- return __spreadProps(__spreadValues({}, proxiedResponse), {
18459
- buildTransactionsPayload
18460
- });
18461
18628
  };
18462
- const BankTransactionsConfirmAllButton = () => {
18629
+ var CategorizationMode = /* @__PURE__ */ ((CategorizationMode2) => {
18630
+ CategorizationMode2["Categorize"] = "Categorize";
18631
+ CategorizationMode2["Recategorize"] = "Recategorize";
18632
+ return CategorizationMode2;
18633
+ })(CategorizationMode || {});
18634
+ const BankTransactionsCategorizeAllModal = ({ isOpen, onOpenChange, mode }) => {
18463
18635
  const { count } = useCountSelectedIds();
18636
+ const { selectedIds } = useSelectedIds();
18464
18637
  const { clearSelection } = useBulkSelectionActions();
18465
- const [isConfirmAllModalOpen, setIsConfirmAllModalOpen] = useState(false);
18466
- const { trigger, buildTransactionsPayload } = useBulkMatchOrCategorize();
18467
- const handleConfirmAllClick = useCallback(() => {
18468
- setIsConfirmAllModalOpen(true);
18469
- }, []);
18638
+ const [selectedCategory, setSelectedCategory] = useState(null);
18639
+ const { trigger } = useBulkCategorize();
18640
+ const handleCategorizeModalClose = useCallback((isOpen2) => {
18641
+ onOpenChange(isOpen2);
18642
+ if (!isOpen2) {
18643
+ setSelectedCategory(null);
18644
+ }
18645
+ }, [onOpenChange]);
18470
18646
  const handleConfirm = useCallback(() => __async(null, null, function* () {
18471
- const payload = buildTransactionsPayload();
18472
- yield trigger(payload);
18647
+ if (!selectedCategory || selectedCategory.classification === null) {
18648
+ return;
18649
+ }
18650
+ if (!isCategoryAsOption(selectedCategory) && !isApiCategorizationAsOption(selectedCategory)) {
18651
+ return;
18652
+ }
18653
+ const transactionIds = Array.from(selectedIds);
18654
+ const categorization = {
18655
+ type: "Category",
18656
+ category: selectedCategory.classification
18657
+ };
18658
+ yield trigger({
18659
+ transactions: transactionIds.map((transactionId) => ({
18660
+ transactionId,
18661
+ categorization
18662
+ }))
18663
+ });
18473
18664
  clearSelection();
18474
- }), [buildTransactionsPayload, trigger, clearSelection]);
18475
- return /* @__PURE__ */ jsxs(Fragment, { children: [
18476
- /* @__PURE__ */ jsx(
18477
- Button,
18478
- {
18479
- variant: "solid",
18480
- onClick: handleConfirmAllClick,
18481
- children: "Confirm all"
18482
- }
18483
- ),
18484
- /* @__PURE__ */ jsx(
18485
- BaseConfirmationModal,
18486
- {
18487
- isOpen: isConfirmAllModalOpen,
18488
- onOpenChange: setIsConfirmAllModalOpen,
18489
- title: "Confirm all suggestions?",
18490
- content: /* @__PURE__ */ jsx(Span, { children: `This action will confirm ${count} selected ${pluralize("transaction", count)}.` }),
18491
- onConfirm: handleConfirm,
18492
- confirmLabel: "Confirm All",
18493
- cancelLabel: "Cancel",
18494
- errorText: "Failed to confirm transactions",
18495
- closeOnConfirm: true
18496
- }
18497
- )
18498
- ] });
18665
+ }), [selectedIds, selectedCategory, trigger, clearSelection]);
18666
+ const categorySelectId = useId();
18667
+ return /* @__PURE__ */ jsx(
18668
+ BaseConfirmationModal,
18669
+ {
18670
+ isOpen,
18671
+ onOpenChange: handleCategorizeModalClose,
18672
+ title: mode === "Categorize" ? "Categorize all selected transactions?" : "Recategorize all selected transactions?",
18673
+ content: /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
18674
+ /* @__PURE__ */ jsxs(VStack, { gap: "3xs", children: [
18675
+ /* @__PURE__ */ jsx(Label, { htmlFor: categorySelectId, children: "Select category" }),
18676
+ /* @__PURE__ */ jsx(
18677
+ BankTransactionCategoryComboBox,
18678
+ {
18679
+ inputId: categorySelectId,
18680
+ selectedValue: selectedCategory,
18681
+ onSelectedValueChange: setSelectedCategory,
18682
+ includeSuggestedMatches: false
18683
+ }
18684
+ )
18685
+ ] }),
18686
+ selectedCategory && isCategoryAsOption(selectedCategory) && /* @__PURE__ */ jsx(Span, { children: mode === "Categorize" ? `This will categorize ${count} selected ${pluralize("transaction", count)} as ${selectedCategory.original.displayName}.` : `This will recategorize ${count} selected ${pluralize("transaction", count)} as ${selectedCategory.original.displayName}.` })
18687
+ ] }),
18688
+ onConfirm: handleConfirm,
18689
+ confirmLabel: mode === "Categorize" ? "Categorize All" : "Recategorize All",
18690
+ cancelLabel: "Cancel",
18691
+ confirmDisabled: !selectedCategory,
18692
+ errorText: mode === "Categorize" ? "Failed to categorize transactions" : "Failed to recategorize transactions",
18693
+ closeOnConfirm: true
18694
+ }
18695
+ );
18499
18696
  };
18500
- const BULK_CATEGORIZE_BANK_TRANSACTIONS_TAG_KEY = "#bulk-categorize-bank-transactions";
18697
+ const BULK_MATCH_OR_CATEGORIZE_TAG = "#bulk-match-or-categorize";
18698
+ const MatchTransactionRequestSchema = Schema.Struct({
18699
+ type: Schema.Literal("match"),
18700
+ suggestedMatchId: pipe(
18701
+ Schema.propertySignature(Schema.UUID),
18702
+ Schema.fromKey("suggested_match_id")
18703
+ )
18704
+ });
18501
18705
  const CategorizeTransactionRequestSchema = Schema.Struct({
18502
- transactionId: Schema.propertySignature(Schema.UUID).pipe(
18503
- Schema.fromKey("transaction_id")
18504
- ),
18706
+ type: Schema.Literal("categorize"),
18505
18707
  categorization: CategoryUpdateSchema
18506
18708
  });
18507
- const BulkCategorizeRequestSchema = Schema.Struct({
18508
- transactions: Schema.Array(CategorizeTransactionRequestSchema)
18709
+ const MatchOrCategorizeTransactionRequestSchema = Schema.Union(
18710
+ MatchTransactionRequestSchema,
18711
+ CategorizeTransactionRequestSchema
18712
+ );
18713
+ const BulkMatchOrCategorizeRequestSchema = Schema.Struct({
18714
+ transactions: Schema.Record({
18715
+ key: Schema.UUID,
18716
+ value: MatchOrCategorizeTransactionRequestSchema
18717
+ })
18509
18718
  });
18510
- const bulkCategorize = post(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/bulk-categorize`);
18719
+ Schema.Struct({
18720
+ businessId: Schema.String
18721
+ });
18722
+ const bulkMatchOrCategorize = post(
18723
+ ({ businessId }) => {
18724
+ const parameters = toDefinedSearchParameters({
18725
+ categorization_source: "API_FROM_COMPONENT",
18726
+ match_source: "API_CONFIRM_MATCH_FROM_COMPONENT"
18727
+ });
18728
+ return `/v1/businesses/${businessId}/bank-transactions/bulk-match-or-categorize?${parameters}`;
18729
+ }
18730
+ );
18511
18731
  function buildKey$B({
18512
18732
  access_token: accessToken,
18513
18733
  apiUrl,
@@ -18518,24 +18738,30 @@ function buildKey$B({
18518
18738
  accessToken,
18519
18739
  apiUrl,
18520
18740
  businessId,
18521
- tags: [BULK_CATEGORIZE_BANK_TRANSACTIONS_TAG_KEY]
18741
+ tags: [BULK_MATCH_OR_CATEGORIZE_TAG]
18522
18742
  };
18523
18743
  }
18524
18744
  }
18525
- const useBulkCategorize = () => {
18745
+ const useBulkMatchOrCategorize = () => {
18526
18746
  const { data } = useAuth();
18527
18747
  const { businessId } = useLayerContext();
18748
+ const { selectedIds } = useSelectedIds();
18749
+ const { transactionCategories } = useGetAllBankTransactionsCategories();
18528
18750
  const { forceReloadBankTransactions } = useBankTransactionsGlobalCacheActions();
18751
+ const buildTransactionsPayload = useCallback(() => {
18752
+ const transactions = buildBulkMatchOrCategorizePayload(selectedIds, transactionCategories);
18753
+ return { transactions };
18754
+ }, [selectedIds, transactionCategories]);
18529
18755
  const mutationResponse = useSWRMutation(
18530
18756
  () => buildKey$B(__spreadProps(__spreadValues({}, data), {
18531
18757
  businessId
18532
18758
  })),
18533
- ({ accessToken, apiUrl, businessId: businessId2 }, { arg }) => bulkCategorize(
18759
+ ({ accessToken, apiUrl, businessId: businessId2 }, { arg }) => bulkMatchOrCategorize(
18534
18760
  apiUrl,
18535
18761
  accessToken,
18536
18762
  {
18537
18763
  params: { businessId: businessId2 },
18538
- body: Schema.encodeSync(BulkCategorizeRequestSchema)(arg)
18764
+ body: Schema.encodeSync(BulkMatchOrCategorizeRequestSchema)(arg)
18539
18765
  }
18540
18766
  ).then(({ data: data2 }) => data2),
18541
18767
  {
@@ -18543,16 +18769,19 @@ const useBulkCategorize = () => {
18543
18769
  throwOnError: true
18544
18770
  }
18545
18771
  );
18546
- const originalTrigger = mutationResponse.trigger;
18772
+ const { trigger: originalTrigger } = mutationResponse;
18547
18773
  const stableProxiedTrigger = useCallback(
18548
18774
  (...triggerParameters) => __async(null, null, function* () {
18549
18775
  const triggerResult = yield originalTrigger(...triggerParameters);
18550
18776
  void forceReloadBankTransactions();
18551
18777
  return triggerResult;
18552
18778
  }),
18553
- [originalTrigger, forceReloadBankTransactions]
18779
+ [
18780
+ originalTrigger,
18781
+ forceReloadBankTransactions
18782
+ ]
18554
18783
  );
18555
- return new Proxy(mutationResponse, {
18784
+ const proxiedResponse = new Proxy(mutationResponse, {
18556
18785
  get(target, prop) {
18557
18786
  if (prop === "trigger") {
18558
18787
  return stableProxiedTrigger;
@@ -18560,137 +18789,33 @@ const useBulkCategorize = () => {
18560
18789
  return Reflect.get(target, prop);
18561
18790
  }
18562
18791
  });
18792
+ return __spreadProps(__spreadValues({}, proxiedResponse), {
18793
+ buildTransactionsPayload
18794
+ });
18563
18795
  };
18564
- const BankTransactionsCategorizeAllButton = () => {
18796
+ const BankTransactionsConfirmAllModal = ({ isOpen, onOpenChange }) => {
18565
18797
  const { count } = useCountSelectedIds();
18566
- const { selectedIds } = useSelectedIds();
18567
18798
  const { clearSelection } = useBulkSelectionActions();
18568
- const [isCategorizeAllModalOpen, setIsCategorizeAllModalOpen] = useState(false);
18569
- const [selectedCategory, setSelectedCategory] = useState(null);
18570
- const { trigger } = useBulkCategorize();
18571
- const handleCategorizeAllClick = useCallback(() => {
18572
- setIsCategorizeAllModalOpen(true);
18573
- }, []);
18574
- const handleCategorizeModalClose = useCallback((isOpen) => {
18575
- setIsCategorizeAllModalOpen(isOpen);
18576
- if (!isOpen) {
18577
- setSelectedCategory(null);
18578
- }
18579
- }, []);
18799
+ const { trigger, buildTransactionsPayload } = useBulkMatchOrCategorize();
18580
18800
  const handleConfirm = useCallback(() => __async(null, null, function* () {
18581
- if (!selectedCategory || selectedCategory.classification === null) {
18582
- return;
18583
- }
18584
- if (!isCategoryAsOption(selectedCategory) && !isApiCategorizationAsOption(selectedCategory)) {
18585
- return;
18586
- }
18587
- const transactionIds = Array.from(selectedIds);
18588
- const categorization = {
18589
- type: "Category",
18590
- category: selectedCategory.classification
18591
- };
18592
- yield trigger({
18593
- transactions: transactionIds.map((transactionId) => ({
18594
- transactionId,
18595
- categorization
18596
- }))
18597
- });
18801
+ const payload = buildTransactionsPayload();
18802
+ yield trigger(payload);
18598
18803
  clearSelection();
18599
- }), [selectedIds, selectedCategory, trigger, clearSelection]);
18600
- const categorySelectId = useId();
18601
- return /* @__PURE__ */ jsxs(Fragment, { children: [
18602
- /* @__PURE__ */ jsx(
18603
- Button,
18604
- {
18605
- variant: "outlined",
18606
- onClick: handleCategorizeAllClick,
18607
- children: "Set category"
18608
- }
18609
- ),
18610
- /* @__PURE__ */ jsx(
18611
- BaseConfirmationModal,
18612
- {
18613
- isOpen: isCategorizeAllModalOpen,
18614
- onOpenChange: handleCategorizeModalClose,
18615
- title: "Categorize all selected transactions?",
18616
- content: /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
18617
- /* @__PURE__ */ jsxs(VStack, { gap: "3xs", children: [
18618
- /* @__PURE__ */ jsx(Label, { htmlFor: categorySelectId, children: "Select category" }),
18619
- /* @__PURE__ */ jsx(
18620
- BankTransactionCategoryComboBox,
18621
- {
18622
- inputId: categorySelectId,
18623
- selectedValue: selectedCategory,
18624
- onSelectedValueChange: setSelectedCategory,
18625
- includeSuggestedMatches: false
18626
- }
18627
- )
18628
- ] }),
18629
- selectedCategory && isCategoryAsOption(selectedCategory) && /* @__PURE__ */ jsx(Span, { children: `This action will categorize ${count} selected transactions as ${selectedCategory.original.displayName}.` })
18630
- ] }),
18631
- onConfirm: handleConfirm,
18632
- confirmLabel: "Categorize All",
18633
- cancelLabel: "Cancel",
18634
- confirmDisabled: !selectedCategory,
18635
- errorText: "Failed to categorize transactions",
18636
- closeOnConfirm: true
18637
- }
18638
- )
18639
- ] });
18640
- };
18641
- const BankTransactionsRecategorizeAllButton = () => {
18642
- const { count } = useCountSelectedIds();
18643
- const [isRecategorizeAllModalOpen, setIsRecategorizeAllModalOpen] = useState(false);
18644
- const [selectedCategory, setSelectedCategory] = useState(null);
18645
- const handleRecategorizeAllClick = useCallback(() => {
18646
- setIsRecategorizeAllModalOpen(true);
18647
- }, []);
18648
- const handleRecategorizeModalClose = useCallback((isOpen) => {
18649
- setIsRecategorizeAllModalOpen(isOpen);
18650
- if (!isOpen) {
18651
- setSelectedCategory(null);
18804
+ }), [buildTransactionsPayload, trigger, clearSelection]);
18805
+ return /* @__PURE__ */ jsx(
18806
+ BaseConfirmationModal,
18807
+ {
18808
+ isOpen,
18809
+ onOpenChange,
18810
+ title: "Confirm all suggestions?",
18811
+ content: /* @__PURE__ */ jsx(Span, { children: `This will confirm ${count} selected ${pluralize("transaction", count)}.` }),
18812
+ onConfirm: handleConfirm,
18813
+ confirmLabel: "Confirm All",
18814
+ cancelLabel: "Cancel",
18815
+ errorText: "Failed to confirm transactions",
18816
+ closeOnConfirm: true
18652
18817
  }
18653
- }, []);
18654
- const categorySelectId = useId();
18655
- return /* @__PURE__ */ jsxs(Fragment, { children: [
18656
- /* @__PURE__ */ jsx(
18657
- Button,
18658
- {
18659
- variant: "outlined",
18660
- onClick: handleRecategorizeAllClick,
18661
- children: "Re-categorize all"
18662
- }
18663
- ),
18664
- /* @__PURE__ */ jsx(
18665
- BaseConfirmationModal,
18666
- {
18667
- isOpen: isRecategorizeAllModalOpen,
18668
- onOpenChange: handleRecategorizeModalClose,
18669
- title: "Recategorize all selected transactions?",
18670
- content: /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
18671
- /* @__PURE__ */ jsxs(VStack, { gap: "3xs", children: [
18672
- /* @__PURE__ */ jsx(Label, { htmlFor: categorySelectId, children: "Select category" }),
18673
- /* @__PURE__ */ jsx(
18674
- BankTransactionCategoryComboBox,
18675
- {
18676
- inputId: categorySelectId,
18677
- selectedValue: selectedCategory,
18678
- onSelectedValueChange: setSelectedCategory,
18679
- includeSuggestedMatches: false
18680
- }
18681
- )
18682
- ] }),
18683
- selectedCategory && isCategoryAsOption(selectedCategory) && /* @__PURE__ */ jsx(Span, { children: `This action will recategorize ${count} selected transactions as ${selectedCategory.original.displayName}.` })
18684
- ] }),
18685
- onConfirm: () => {
18686
- },
18687
- confirmLabel: "Recategorize All",
18688
- cancelLabel: "Cancel",
18689
- confirmDisabled: !selectedCategory,
18690
- closeOnConfirm: true
18691
- }
18692
- )
18693
- ] });
18818
+ );
18694
18819
  };
18695
18820
  const BULK_UNCATEGORIZE_BANK_TRANSACTIONS_TAG_KEY = "#bulk-uncategorize-bank-transactions";
18696
18821
  const BulkUncategorizeRequestSchema = Schema.Struct({
@@ -18752,53 +18877,94 @@ const useBulkUncategorize = () => {
18752
18877
  }
18753
18878
  });
18754
18879
  };
18755
- const BankTransactionsUncategorizeAllButton = () => {
18880
+ const BankTransactionsUncategorizeAllModal = ({ isOpen, onOpenChange }) => {
18756
18881
  const { count } = useCountSelectedIds();
18757
18882
  const { selectedIds } = useSelectedIds();
18758
18883
  const { clearSelection } = useBulkSelectionActions();
18759
- const [isUnconfirmAllModalOpen, setIsUnconfirmAllModalOpen] = useState(false);
18760
18884
  const { trigger } = useBulkUncategorize();
18761
- const handleUnconfirmAllClick = useCallback(() => {
18762
- setIsUnconfirmAllModalOpen(true);
18763
- }, []);
18764
18885
  const handleConfirm = useCallback(() => __async(null, null, function* () {
18765
18886
  const transactionIds = Array.from(selectedIds);
18766
18887
  yield trigger({ transactionIds });
18767
18888
  clearSelection();
18768
18889
  }), [selectedIds, trigger, clearSelection]);
18769
- return /* @__PURE__ */ jsxs(Fragment, { children: [
18890
+ return /* @__PURE__ */ jsx(
18891
+ BaseConfirmationModal,
18892
+ {
18893
+ isOpen,
18894
+ onOpenChange,
18895
+ title: "Uncategorize all selected transactions?",
18896
+ content: /* @__PURE__ */ jsx(Span, { children: `This will uncategorize ${count} selected ${pluralize("transaction", count)}.` }),
18897
+ onConfirm: handleConfirm,
18898
+ confirmLabel: "Uncategorize All",
18899
+ cancelLabel: "Cancel",
18900
+ errorText: "Failed to uncategorize transactions"
18901
+ }
18902
+ );
18903
+ };
18904
+ const BankTransactionsBulkActions = () => {
18905
+ const { display } = useBankTransactionsContext();
18906
+ const [categorizeModalOpen, setCategorizeModalOpen] = useState(false);
18907
+ const [confirmModalOpen, setConfirmModalOpen] = useState(false);
18908
+ const [recategorizeModalOpen, setRecategorizeModalOpen] = useState(false);
18909
+ const [uncategorizeModalOpen, setUncategorizeModalOpen] = useState(false);
18910
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(HStack, { align: "center", gap: "xs", children: display === DisplayState.review ? /* @__PURE__ */ jsxs(Fragment, { children: [
18770
18911
  /* @__PURE__ */ jsx(
18771
18912
  Button,
18772
18913
  {
18773
- variant: "solid",
18774
- onClick: handleUnconfirmAllClick,
18775
- children: "Uncategorize all"
18914
+ variant: "outlined",
18915
+ onClick: () => setCategorizeModalOpen(true),
18916
+ children: "Categorize"
18776
18917
  }
18777
18918
  ),
18778
18919
  /* @__PURE__ */ jsx(
18779
- BaseConfirmationModal,
18920
+ BankTransactionsCategorizeAllModal,
18921
+ {
18922
+ isOpen: categorizeModalOpen,
18923
+ onOpenChange: setCategorizeModalOpen,
18924
+ mode: CategorizationMode.Categorize
18925
+ }
18926
+ ),
18927
+ /* @__PURE__ */ jsx(Button, { variant: "solid", onClick: () => setConfirmModalOpen(true), children: "Confirm" }),
18928
+ /* @__PURE__ */ jsx(
18929
+ BankTransactionsConfirmAllModal,
18780
18930
  {
18781
- isOpen: isUnconfirmAllModalOpen,
18782
- onOpenChange: setIsUnconfirmAllModalOpen,
18783
- title: "Uncategorize all selected transactions?",
18784
- content: /* @__PURE__ */ jsx(Span, { children: `This action will uncategorize ${count} selected ${pluralize("transaction", count)}.` }),
18785
- onConfirm: handleConfirm,
18786
- confirmLabel: "Uncategorize All",
18787
- cancelLabel: "Cancel",
18788
- errorText: "Failed to uncategorize transactions"
18931
+ isOpen: confirmModalOpen,
18932
+ onOpenChange: setConfirmModalOpen
18789
18933
  }
18790
18934
  )
18791
- ] });
18792
- };
18793
- const BankTransactionsBulkActions = () => {
18794
- const { display } = useBankTransactionsContext();
18795
- return /* @__PURE__ */ jsx(HStack, { pis: "3xl", align: "center", gap: "sm", children: display === DisplayState.review ? /* @__PURE__ */ jsxs(Fragment, { children: [
18796
- /* @__PURE__ */ jsx(BankTransactionsCategorizeAllButton, {}),
18797
- /* @__PURE__ */ jsx(BankTransactionsConfirmAllButton, {})
18798
18935
  ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
18799
- /* @__PURE__ */ jsx(BankTransactionsRecategorizeAllButton, {}),
18800
- /* @__PURE__ */ jsx(BankTransactionsUncategorizeAllButton, {})
18801
- ] }) });
18936
+ /* @__PURE__ */ jsx(
18937
+ Button,
18938
+ {
18939
+ variant: "outlined",
18940
+ onClick: () => setRecategorizeModalOpen(true),
18941
+ children: "Recategorize"
18942
+ }
18943
+ ),
18944
+ /* @__PURE__ */ jsx(
18945
+ BankTransactionsCategorizeAllModal,
18946
+ {
18947
+ isOpen: recategorizeModalOpen,
18948
+ onOpenChange: setRecategorizeModalOpen,
18949
+ mode: CategorizationMode.Recategorize
18950
+ }
18951
+ ),
18952
+ /* @__PURE__ */ jsx(
18953
+ Button,
18954
+ {
18955
+ variant: "solid",
18956
+ onClick: () => setUncategorizeModalOpen(true),
18957
+ children: "Uncategorize"
18958
+ }
18959
+ ),
18960
+ /* @__PURE__ */ jsx(
18961
+ BankTransactionsUncategorizeAllModal,
18962
+ {
18963
+ isOpen: uncategorizeModalOpen,
18964
+ onOpenChange: setUncategorizeModalOpen
18965
+ }
18966
+ )
18967
+ ] }) }) });
18802
18968
  };
18803
18969
  function TransactionsSearch({ slot, isDisabled }) {
18804
18970
  const { filters, setFilters } = useBankTransactionsFiltersContext();
@@ -18975,8 +19141,8 @@ const BankTransactionsHeader = ({
18975
19141
  }
18976
19142
  );
18977
19143
  };
18978
- const Inbox = (_Mb) => {
18979
- var _Nb = _Mb, { size = 18 } = _Nb, props = __objRest(_Nb, ["size"]);
19144
+ const Inbox = (_Sb) => {
19145
+ var _Tb = _Sb, { size = 18 } = _Tb, props = __objRest(_Tb, ["size"]);
18980
19146
  return /* @__PURE__ */ jsxs(
18981
19147
  "svg",
18982
19148
  __spreadProps(__spreadValues({
@@ -19523,8 +19689,8 @@ function RuleUpdatesPromptStep({ ruleSuggestion, close: close2 }) {
19523
19689
  const CSS_PREFIX$1 = "Layer__UI__Table";
19524
19690
  const getClassName = (component, additionalClassNames, withHidden) => classNames(`${CSS_PREFIX$1}-${component}`, withHidden && `${CSS_PREFIX$1}-${component}--hidden`, additionalClassNames);
19525
19691
  const Table$1 = forwardRef(
19526
- (_Ob, ref) => {
19527
- var _Pb = _Ob, { children, className } = _Pb, restProps = __objRest(_Pb, ["children", "className"]);
19692
+ (_Ub, ref) => {
19693
+ var _Vb = _Ub, { children, className } = _Vb, restProps = __objRest(_Vb, ["children", "className"]);
19528
19694
  return /* @__PURE__ */ jsx(
19529
19695
  Table$2,
19530
19696
  __spreadProps(__spreadValues({
@@ -19537,8 +19703,8 @@ const Table$1 = forwardRef(
19537
19703
  }
19538
19704
  );
19539
19705
  Table$1.displayName = "Table";
19540
- const TableHeaderInner = (_Qb, ref) => {
19541
- var _Rb = _Qb, { children, className, hideHeader } = _Rb, restProps = __objRest(_Rb, ["children", "className", "hideHeader"]);
19706
+ const TableHeaderInner = (_Wb, ref) => {
19707
+ var _Xb = _Wb, { children, className, hideHeader } = _Xb, restProps = __objRest(_Xb, ["children", "className", "hideHeader"]);
19542
19708
  return /* @__PURE__ */ jsx(
19543
19709
  TableHeader$1,
19544
19710
  __spreadProps(__spreadValues({
@@ -19551,8 +19717,8 @@ const TableHeaderInner = (_Qb, ref) => {
19551
19717
  };
19552
19718
  const TableHeader = forwardRef(TableHeaderInner);
19553
19719
  TableHeader.displayName = "TableHeader";
19554
- const TableBodyInner = (_Sb, ref) => {
19555
- var _Tb = _Sb, { children, className } = _Tb, restProps = __objRest(_Tb, ["children", "className"]);
19720
+ const TableBodyInner = (_Yb, ref) => {
19721
+ var _Zb = _Yb, { children, className } = _Zb, restProps = __objRest(_Zb, ["children", "className"]);
19556
19722
  return /* @__PURE__ */ jsx(
19557
19723
  TableBody$2,
19558
19724
  __spreadProps(__spreadValues({
@@ -19565,8 +19731,8 @@ const TableBodyInner = (_Sb, ref) => {
19565
19731
  };
19566
19732
  const TableBody$1 = forwardRef(TableBodyInner);
19567
19733
  TableBody$1.displayName = "TableBody";
19568
- const RowInner = (_Ub, ref) => {
19569
- var _Vb = _Ub, { children, className, depth = 0 } = _Vb, restProps = __objRest(_Vb, ["children", "className", "depth"]);
19734
+ const RowInner = (__b, ref) => {
19735
+ var _$b = __b, { children, className, depth = 0 } = _$b, restProps = __objRest(_$b, ["children", "className", "depth"]);
19570
19736
  const dataProperties = toDataProperties({ depth });
19571
19737
  return /* @__PURE__ */ jsx(
19572
19738
  Row$1,
@@ -19581,8 +19747,8 @@ const RowInner = (_Ub, ref) => {
19581
19747
  const Row = forwardRef(RowInner);
19582
19748
  Row.displayName = "Row";
19583
19749
  const Column = forwardRef(
19584
- (_Wb, ref) => {
19585
- var _Xb = _Wb, { children, className, textAlign = "left" } = _Xb, restProps = __objRest(_Xb, ["children", "className", "textAlign"]);
19750
+ (_ac, ref) => {
19751
+ var _bc = _ac, { children, className, textAlign = "left" } = _bc, restProps = __objRest(_bc, ["children", "className", "textAlign"]);
19586
19752
  const dataProperties = toDataProperties({ "text-align": textAlign });
19587
19753
  return /* @__PURE__ */ jsx(
19588
19754
  Column$1,
@@ -19597,8 +19763,8 @@ const Column = forwardRef(
19597
19763
  );
19598
19764
  Column.displayName = "Column";
19599
19765
  const Cell = forwardRef(
19600
- (_Yb, ref) => {
19601
- var _Zb = _Yb, { children, className } = _Zb, restProps = __objRest(_Zb, ["children", "className"]);
19766
+ (_cc, ref) => {
19767
+ var _dc = _cc, { children, className } = _dc, restProps = __objRest(_dc, ["children", "className"]);
19602
19768
  return /* @__PURE__ */ jsx(
19603
19769
  Cell$1,
19604
19770
  __spreadProps(__spreadValues({
@@ -19772,13 +19938,7 @@ const AffectedTransactionsTable = ({
19772
19938
  ]: {
19773
19939
  id: "Description",
19774
19940
  header: "Description",
19775
- cell: (row) => /* @__PURE__ */ jsx(
19776
- Span,
19777
- {
19778
- ellipsis: true,
19779
- children: row.counterpartyName || row.description || "-"
19780
- }
19781
- ),
19941
+ cell: (row) => /* @__PURE__ */ jsx(Span, { withTooltip: true, children: row.counterpartyName || row.description || "-" }),
19782
19942
  isRowHeader: true
19783
19943
  },
19784
19944
  [
@@ -20246,8 +20406,8 @@ const CategorizationRulesDrawer = () => {
20246
20406
  ) });
20247
20407
  };
20248
20408
  const COMPONENT_NAME$a = "bank-transactions";
20249
- const BankTransactions = (__b) => {
20250
- var _$b = __b, {
20409
+ const BankTransactions = (_ec) => {
20410
+ var _fc = _ec, {
20251
20411
  onError,
20252
20412
  showTags = false,
20253
20413
  showCustomerVendor = false,
@@ -20256,7 +20416,7 @@ const BankTransactions = (__b) => {
20256
20416
  mode,
20257
20417
  renderInAppLink,
20258
20418
  _showBulkSelection = false
20259
- } = _$b, props = __objRest(_$b, [
20419
+ } = _fc, props = __objRest(_fc, [
20260
20420
  "onError",
20261
20421
  "showTags",
20262
20422
  "showCustomerVendor",
@@ -20495,7 +20655,8 @@ const BankTransactionsTableView = ({
20495
20655
  stringOverrides: stringOverrides == null ? void 0 : stringOverrides.bankTransactionCTAs,
20496
20656
  showDescriptions,
20497
20657
  showReceiptUploads,
20498
- showTooltips
20658
+ showTooltips,
20659
+ _showBulkSelection
20499
20660
  }
20500
20661
  )
20501
20662
  ] }) : null,
@@ -20540,8 +20701,8 @@ const BankTransactionsTableView = ({
20540
20701
  }
20541
20702
  );
20542
20703
  };
20543
- const QuickbooksIcon = (_ac) => {
20544
- var _bc = _ac, { size = 24 } = _bc, props = __objRest(_bc, ["size"]);
20704
+ const QuickbooksIcon = (_gc) => {
20705
+ var _hc = _gc, { size = 24 } = _hc, props = __objRest(_hc, ["size"]);
20545
20706
  return /* @__PURE__ */ jsxs(
20546
20707
  "svg",
20547
20708
  __spreadProps(__spreadValues({
@@ -20822,8 +20983,8 @@ function QuickbooksContextProvider({ children }) {
20822
20983
  const quickbooksContextData = useQuickbooks();
20823
20984
  return /* @__PURE__ */ jsx(QuickbooksContext.Provider, { value: quickbooksContextData, children });
20824
20985
  }
20825
- const Cog = (_cc) => {
20826
- var _dc = _cc, { size = 12 } = _dc, props = __objRest(_dc, ["size"]);
20986
+ const Cog = (_ic) => {
20987
+ var _jc = _ic, { size = 12 } = _jc, props = __objRest(_jc, ["size"]);
20827
20988
  const id = useId();
20828
20989
  return /* @__PURE__ */ jsxs(
20829
20990
  "svg",
@@ -21469,8 +21630,8 @@ const useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
21469
21630
  refetch
21470
21631
  };
21471
21632
  };
21472
- const BarChart2 = (_ec) => {
21473
- var _fc = _ec, { size = 12 } = _fc, props = __objRest(_fc, ["size"]);
21633
+ const BarChart2 = (_kc) => {
21634
+ var _lc = _kc, { size = 12 } = _lc, props = __objRest(_lc, ["size"]);
21474
21635
  return /* @__PURE__ */ jsxs(
21475
21636
  "svg",
21476
21637
  __spreadProps(__spreadValues({
@@ -22407,8 +22568,8 @@ const TASKS_CHARTS_COLORS = {
22407
22568
  done: "#3B9C63",
22408
22569
  pending: "#DFA000"
22409
22570
  };
22410
- const SortArrows = (_gc) => {
22411
- var _hc = _gc, { size = 13 } = _hc, props = __objRest(_hc, ["size"]);
22571
+ const SortArrows = (_mc) => {
22572
+ var _nc = _mc, { size = 13 } = _nc, props = __objRest(_nc, ["size"]);
22412
22573
  return /* @__PURE__ */ jsxs(
22413
22574
  "svg",
22414
22575
  __spreadProps(__spreadValues({
@@ -23785,7 +23946,7 @@ const ProfitAndLossDetailReport = ({
23785
23946
  Text,
23786
23947
  {
23787
23948
  as: "span",
23788
- withTooltip: TextUseTooltip.whenTruncated,
23949
+ withDeprecatedTooltip: TextUseTooltip.whenTruncated,
23789
23950
  ellipsis: true,
23790
23951
  children: row.account.name || "-"
23791
23952
  }
@@ -23803,7 +23964,7 @@ const ProfitAndLossDetailReport = ({
23803
23964
  Text,
23804
23965
  {
23805
23966
  as: "span",
23806
- withTooltip: TextUseTooltip.whenTruncated,
23967
+ withDeprecatedTooltip: TextUseTooltip.whenTruncated,
23807
23968
  ellipsis: true,
23808
23969
  children: ((_a = row.source) == null ? void 0 : _a.displayDescription) || row.account.accountSubtype.displayName || "-"
23809
23970
  }
@@ -25359,10 +25520,10 @@ function Internal_ProfitAndLossSummaries({
25359
25520
  unstable_AdditionalListItems.map((item, index) => /* @__PURE__ */ jsx(ProfitAndLossSummariesListItem, { children: item }, index))
25360
25521
  ] }) });
25361
25522
  }
25362
- function ProfitAndLossSummaries(_ic) {
25363
- var _jc = _ic, {
25523
+ function ProfitAndLossSummaries(_oc) {
25524
+ var _pc = _oc, {
25364
25525
  onTransactionsToReviewClick
25365
- } = _jc, restProps = __objRest(_jc, [
25526
+ } = _pc, restProps = __objRest(_pc, [
25366
25527
  "onTransactionsToReviewClick"
25367
25528
  ]);
25368
25529
  return /* @__PURE__ */ jsx(
@@ -25398,8 +25559,8 @@ const ProfitAndLossWithoutReportsModeProvider = ({
25398
25559
  const ProfitAndLossWithReportsModeProvider = (props) => {
25399
25560
  return /* @__PURE__ */ jsx(ReportsModeStoreProvider, { initialModes: { ProfitAndLoss: "monthPicker" }, children: /* @__PURE__ */ jsx(ProfitAndLossWithoutReportsModeProvider, __spreadValues({}, props)) });
25400
25561
  };
25401
- const ProfitAndLoss = (_kc) => {
25402
- var _lc = _kc, { withReportsModeProvider = true } = _lc, restProps = __objRest(_lc, ["withReportsModeProvider"]);
25562
+ const ProfitAndLoss = (_qc) => {
25563
+ var _rc = _qc, { withReportsModeProvider = true } = _rc, restProps = __objRest(_rc, ["withReportsModeProvider"]);
25403
25564
  if (withReportsModeProvider) return /* @__PURE__ */ jsx(ProfitAndLossWithReportsModeProvider, __spreadValues({}, restProps));
25404
25565
  return /* @__PURE__ */ jsx(ProfitAndLossWithoutReportsModeProvider, __spreadValues({}, restProps));
25405
25566
  };
@@ -27207,8 +27368,8 @@ const useLedgerAccounts = () => {
27207
27368
  fetchMore
27208
27369
  };
27209
27370
  };
27210
- const Plus = (_mc) => {
27211
- var _nc = _mc, { size = 14 } = _nc, props = __objRest(_nc, ["size"]);
27371
+ const Plus = (_sc) => {
27372
+ var _tc = _sc, { size = 14 } = _tc, props = __objRest(_tc, ["size"]);
27212
27373
  return /* @__PURE__ */ jsxs(
27213
27374
  "svg",
27214
27375
  __spreadProps(__spreadValues({
@@ -27507,8 +27668,8 @@ const ChartOfAccountsSidebar = ({
27507
27668
  }) => {
27508
27669
  return /* @__PURE__ */ jsx(ChartOfAccountsForm, { stringOverrides });
27509
27670
  };
27510
- const Edit2 = (_oc) => {
27511
- var _pc = _oc, { size = 18 } = _pc, props = __objRest(_pc, ["size"]);
27671
+ const Edit2 = (_uc) => {
27672
+ var _vc = _uc, { size = 18 } = _vc, props = __objRest(_vc, ["size"]);
27512
27673
  return /* @__PURE__ */ jsx(
27513
27674
  "svg",
27514
27675
  __spreadProps(__spreadValues({
@@ -30238,8 +30399,8 @@ const TasksHeader = ({
30238
30399
  }) => {
30239
30400
  return /* @__PURE__ */ jsx("div", { className: "Layer__tasks-header", children: /* @__PURE__ */ jsx(Text, { size: TextSize.lg, children: tasksHeader }) });
30240
30401
  };
30241
- const SmileIcon = (_qc) => {
30242
- var _rc = _qc, { size = 12 } = _rc, props = __objRest(_rc, ["size"]);
30402
+ const SmileIcon = (_wc) => {
30403
+ var _xc = _wc, { size = 12 } = _xc, props = __objRest(_xc, ["size"]);
30243
30404
  return /* @__PURE__ */ jsxs(
30244
30405
  "svg",
30245
30406
  __spreadProps(__spreadValues({
@@ -31198,8 +31359,8 @@ const useBookkeepingYearsStatus = () => {
31198
31359
  isLoading
31199
31360
  };
31200
31361
  };
31201
- const ArrowRightCircle = (_sc) => {
31202
- var _tc = _sc, { size = 18 } = _tc, props = __objRest(_tc, ["size"]);
31362
+ const ArrowRightCircle = (_yc) => {
31363
+ var _zc = _yc, { size = 18 } = _zc, props = __objRest(_zc, ["size"]);
31203
31364
  return /* @__PURE__ */ jsxs(
31204
31365
  "svg",
31205
31366
  __spreadProps(__spreadValues({
@@ -31328,8 +31489,8 @@ const Tab = ({
31328
31489
  badge
31329
31490
  }) => {
31330
31491
  if (disabled) {
31331
- return /* @__PURE__ */ jsxs(Tooltip, { children: [
31332
- /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsxs("label", { className: "Layer__tabs-option", "data-checked": checked, children: [
31492
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { children: [
31493
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsxs("label", { className: "Layer__tabs-option", "data-checked": checked, children: [
31333
31494
  /* @__PURE__ */ jsx(
31334
31495
  "input",
31335
31496
  {
@@ -31348,7 +31509,7 @@ const Tab = ({
31348
31509
  badge
31349
31510
  ] })
31350
31511
  ] }) }),
31351
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", children: disabledMessage })
31512
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: disabledMessage })
31352
31513
  ] });
31353
31514
  }
31354
31515
  return /* @__PURE__ */ jsxs("label", { className: "Layer__tabs-option", "data-checked": checked, children: [
@@ -32528,8 +32689,8 @@ const ProgressSteps = ({ steps, currentStep }) => {
32528
32689
  );
32529
32690
  }) });
32530
32691
  };
32531
- const Document = (_uc) => {
32532
- var _vc = _uc, { size = 20 } = _vc, props = __objRest(_vc, ["size"]);
32692
+ const Document = (_Ac) => {
32693
+ var _Bc = _Ac, { size = 20 } = _Bc, props = __objRest(_Bc, ["size"]);
32533
32694
  return /* @__PURE__ */ jsxs(
32534
32695
  "svg",
32535
32696
  __spreadProps(__spreadValues({
@@ -32634,8 +32795,8 @@ const Document = (_uc) => {
32634
32795
  })
32635
32796
  );
32636
32797
  };
32637
- const TrendingUp = (_wc) => {
32638
- var _xc = _wc, { size = 20 } = _xc, props = __objRest(_xc, ["size"]);
32798
+ const TrendingUp = (_Cc) => {
32799
+ var _Dc = _Cc, { size = 20 } = _Dc, props = __objRest(_Dc, ["size"]);
32639
32800
  return /* @__PURE__ */ jsxs(
32640
32801
  "svg",
32641
32802
  __spreadProps(__spreadValues({
@@ -33229,12 +33390,12 @@ const USStateSelect = ({ value, onChange }) => {
33229
33390
  }
33230
33391
  );
33231
33392
  };
33232
- const PhoneInput = (_yc) => {
33233
- var _zc = _yc, {
33393
+ const PhoneInput = (_Ec) => {
33394
+ var _Fc = _Ec, {
33234
33395
  value,
33235
33396
  onChange,
33236
33397
  placeholder = "Phone number"
33237
- } = _zc, props = __objRest(_zc, [
33398
+ } = _Fc, props = __objRest(_Fc, [
33238
33399
  "value",
33239
33400
  "onChange",
33240
33401
  "placeholder"
@@ -33831,8 +33992,8 @@ const PlatformOnboarding = ({ onComplete }) => {
33831
33992
  /* @__PURE__ */ jsx("div", { className: "Layer__platform-onboarding-layout__footer", children: renderStepFooter() })
33832
33993
  ] }) });
33833
33994
  };
33834
- const CoffeeIcon = (_Ac) => {
33835
- var _Bc = _Ac, { size = 11 } = _Bc, props = __objRest(_Bc, ["size"]);
33995
+ const CoffeeIcon = (_Gc) => {
33996
+ var _Hc = _Gc, { size = 11 } = _Hc, props = __objRest(_Hc, ["size"]);
33836
33997
  return /* @__PURE__ */ jsxs(
33837
33998
  "svg",
33838
33999
  __spreadProps(__spreadValues({
@@ -34114,8 +34275,8 @@ const getTimezoneDisplay = (date) => {
34114
34275
  };
34115
34276
  const LINK_CLASS_NAME = "Layer__UI__Link";
34116
34277
  const Link = forwardRef(
34117
- function Link2(_Cc, ref) {
34118
- var _Dc = _Cc, {
34278
+ function Link2(_Ic, ref) {
34279
+ var _Jc = _Ic, {
34119
34280
  children,
34120
34281
  size = "md",
34121
34282
  ellipsis,
@@ -34124,7 +34285,7 @@ const Link = forwardRef(
34124
34285
  href,
34125
34286
  target,
34126
34287
  rel
34127
- } = _Dc, restProps = __objRest(_Dc, [
34288
+ } = _Jc, restProps = __objRest(_Jc, [
34128
34289
  "children",
34129
34290
  "size",
34130
34291
  "ellipsis",
@@ -34222,8 +34383,7 @@ const BookkeepingOverview = ({
34222
34383
  showTitle = true,
34223
34384
  onClickReconnectAccounts,
34224
34385
  stringOverrides,
34225
- slotProps,
34226
- _showBookACall
34386
+ slotProps
34227
34387
  }) => {
34228
34388
  var _a, _b, _c, _d, _e, _f, _g, _h;
34229
34389
  const [pnlToggle, setPnlToggle] = useState("expenses");
@@ -34235,7 +34395,7 @@ const BookkeepingOverview = ({
34235
34395
  };
34236
34396
  const { data: callBookings, isError, isLoading, isValidating } = useCallBookings(1);
34237
34397
  const callBooking = (_d = (_c = callBookings == null ? void 0 : callBookings[0]) == null ? void 0 : _c.data[0]) != null ? _d : null;
34238
- const callBookingVisible = _showBookACall && callBooking && !isLoading && !isValidating && !isError;
34398
+ const callBookingVisible = callBooking && !isLoading && !isValidating && !isError;
34239
34399
  return /* @__PURE__ */ jsxs(ProfitAndLoss, { asContainer: false, children: [
34240
34400
  /* @__PURE__ */ jsxs(
34241
34401
  View,
@@ -35707,19 +35867,19 @@ const VendorsProvider = ({ children }) => {
35707
35867
  const vendors = useVendors();
35708
35868
  return /* @__PURE__ */ jsx(VendorsContext.Provider, { value: vendors, children });
35709
35869
  };
35710
- const SelectVendor = (_Ec) => {
35711
- var _Fc = _Ec, { withContext = true } = _Fc, props = __objRest(_Fc, ["withContext"]);
35870
+ const SelectVendor = (_Kc) => {
35871
+ var _Lc = _Kc, { withContext = true } = _Lc, props = __objRest(_Lc, ["withContext"]);
35712
35872
  if (withContext) {
35713
35873
  return /* @__PURE__ */ jsx(VendorsProvider, { children: /* @__PURE__ */ jsx(SelectVendorContent, __spreadValues({}, props)) });
35714
35874
  }
35715
35875
  return /* @__PURE__ */ jsx(SelectVendorContent, __spreadValues({}, props));
35716
35876
  };
35717
- const SelectVendorContent = (_Gc) => {
35718
- var _Hc = _Gc, {
35877
+ const SelectVendorContent = (_Mc) => {
35878
+ var _Nc = _Mc, {
35719
35879
  value,
35720
35880
  onChange,
35721
35881
  placeholder = "Select vendor"
35722
- } = _Hc, props = __objRest(_Hc, [
35882
+ } = _Nc, props = __objRest(_Nc, [
35723
35883
  "value",
35724
35884
  "onChange",
35725
35885
  "placeholder"
@@ -36676,8 +36836,8 @@ const BillsTableWithPanel = ({
36676
36836
  }
36677
36837
  );
36678
36838
  };
36679
- const Bills = (_Ic) => {
36680
- var _Jc = _Ic, { context = true } = _Jc, props = __objRest(_Jc, ["context"]);
36839
+ const Bills = (_Oc) => {
36840
+ var _Pc = _Oc, { context = true } = _Pc, props = __objRest(_Pc, ["context"]);
36681
36841
  if (context) {
36682
36842
  return /* @__PURE__ */ jsx(BillsProvider, { children: /* @__PURE__ */ jsx(BillsContent, __spreadValues({}, props)) });
36683
36843
  }
@@ -36876,13 +37036,13 @@ const UnifiedReportSchema = Schema.Struct({
36876
37036
  )
36877
37037
  });
36878
37038
  const UNIFIED_REPORT_TAG_KEY = "#unified-report";
36879
- function buildKey$9(_Kc) {
36880
- var _Lc = _Kc, {
37039
+ function buildKey$9(_Qc) {
37040
+ var _Rc = _Qc, {
36881
37041
  access_token: accessToken,
36882
37042
  apiUrl,
36883
37043
  businessId,
36884
37044
  report
36885
- } = _Lc, dateParams = __objRest(_Lc, [
37045
+ } = _Rc, dateParams = __objRest(_Rc, [
36886
37046
  "access_token",
36887
37047
  "apiUrl",
36888
37048
  "businessId",
@@ -36898,8 +37058,8 @@ function buildKey$9(_Kc) {
36898
37058
  }, dateParams);
36899
37059
  }
36900
37060
  }
36901
- const getUnifiedReport = get((_Mc) => {
36902
- var _Nc = _Mc, { businessId, report } = _Nc, dateParams = __objRest(_Nc, ["businessId", "report"]);
37061
+ const getUnifiedReport = get((_Sc) => {
37062
+ var _Tc = _Sc, { businessId, report } = _Tc, dateParams = __objRest(_Tc, ["businessId", "report"]);
36903
37063
  const parameters = toDefinedSearchParameters(__spreadValues({}, dateParams));
36904
37064
  return `/v1/businesses/${businessId}/reports/unified/${report}?${parameters}`;
36905
37065
  });
@@ -36928,8 +37088,8 @@ class UnifiedReportSWRResponse {
36928
37088
  return this.swrResponse.mutate;
36929
37089
  }
36930
37090
  }
36931
- function useUnifiedReport(_Oc) {
36932
- var _Pc = _Oc, { report } = _Pc, dateParams = __objRest(_Pc, ["report"]);
37091
+ function useUnifiedReport(_Uc) {
37092
+ var _Vc = _Uc, { report } = _Vc, dateParams = __objRest(_Vc, ["report"]);
36933
37093
  const { data: auth } = useAuth();
36934
37094
  const { apiUrl } = useEnvironment();
36935
37095
  const { businessId } = useLayerContext();
@@ -37211,8 +37371,8 @@ const DateSelectionComboBox = () => {
37211
37371
  };
37212
37372
  const CALENDAR_CLASS_NAME = "Layer__UI__Calendar";
37213
37373
  const Calendar = forwardRef(
37214
- function Calendar2(_Qc, ref) {
37215
- var _Rc = _Qc, { className, isReadOnly } = _Rc, restProps = __objRest(_Rc, ["className", "isReadOnly"]);
37374
+ function Calendar2(_Wc, ref) {
37375
+ var _Xc = _Wc, { className, isReadOnly } = _Xc, restProps = __objRest(_Xc, ["className", "isReadOnly"]);
37216
37376
  const dataProperties = toDataProperties({ readonly: isReadOnly });
37217
37377
  return /* @__PURE__ */ jsx(
37218
37378
  Calendar$2,
@@ -37226,8 +37386,8 @@ const Calendar = forwardRef(
37226
37386
  );
37227
37387
  const CALENDAR_GRID_CLASS_NAME = "Layer__UI__CalendarGrid";
37228
37388
  const CalendarGrid = forwardRef(
37229
- function CalendarGrid2(_Sc, ref) {
37230
- var _Tc = _Sc, { className } = _Tc, restProps = __objRest(_Tc, ["className"]);
37389
+ function CalendarGrid2(_Yc, ref) {
37390
+ var _Zc = _Yc, { className } = _Zc, restProps = __objRest(_Zc, ["className"]);
37231
37391
  return /* @__PURE__ */ jsx(
37232
37392
  CalendarGrid$1,
37233
37393
  __spreadProps(__spreadValues({}, restProps), {
@@ -37239,8 +37399,8 @@ const CalendarGrid = forwardRef(
37239
37399
  );
37240
37400
  const CALENDAR_GRID_BODY_CLASS_NAME = "Layer__UI__CalendarGridBody";
37241
37401
  const CalendarGridBody = forwardRef(
37242
- function CalendarGridBody2(_Uc, ref) {
37243
- var _Vc = _Uc, { className } = _Vc, restProps = __objRest(_Vc, ["className"]);
37402
+ function CalendarGridBody2(__c, ref) {
37403
+ var _$c = __c, { className } = _$c, restProps = __objRest(_$c, ["className"]);
37244
37404
  return /* @__PURE__ */ jsx(
37245
37405
  CalendarGridBody$1,
37246
37406
  __spreadProps(__spreadValues({}, restProps), {
@@ -37252,8 +37412,8 @@ const CalendarGridBody = forwardRef(
37252
37412
  );
37253
37413
  const CALENDAR_CELL_CLASS_NAME = "Layer__UI__CalendarCell";
37254
37414
  const CalendarCell = forwardRef(
37255
- function CalendarCell2(_Wc, ref) {
37256
- var _Xc = _Wc, { className } = _Xc, restProps = __objRest(_Xc, ["className"]);
37415
+ function CalendarCell2(_ad, ref) {
37416
+ var _bd = _ad, { className } = _bd, restProps = __objRest(_bd, ["className"]);
37257
37417
  return /* @__PURE__ */ jsx(
37258
37418
  CalendarCell$1,
37259
37419
  __spreadProps(__spreadValues({}, restProps), {
@@ -37265,8 +37425,8 @@ const CalendarCell = forwardRef(
37265
37425
  );
37266
37426
  const CALENDAR_GRID_HEADER_CLASS_NAME = "Layer__UI__CalendarGridHeader";
37267
37427
  const CalendarGridHeader = forwardRef(
37268
- function CalendarGridHeader2(_Yc, ref) {
37269
- var _Zc = _Yc, { className } = _Zc, restProps = __objRest(_Zc, ["className"]);
37428
+ function CalendarGridHeader2(_cd, ref) {
37429
+ var _dd = _cd, { className } = _dd, restProps = __objRest(_dd, ["className"]);
37270
37430
  return /* @__PURE__ */ jsx(
37271
37431
  CalendarGridHeader$1,
37272
37432
  __spreadProps(__spreadValues({}, restProps), {
@@ -37278,8 +37438,8 @@ const CalendarGridHeader = forwardRef(
37278
37438
  );
37279
37439
  const CALENDAR_HEADER_CELL_CLASS_NAME = "Layer__UI__CalendarHeaderCell";
37280
37440
  const CalendarHeaderCell = forwardRef(
37281
- function CalendarHeaderCell2(__c, ref) {
37282
- var _$c = __c, { className } = _$c, restProps = __objRest(_$c, ["className"]);
37441
+ function CalendarHeaderCell2(_ed, ref) {
37442
+ var _fd = _ed, { className } = _fd, restProps = __objRest(_fd, ["className"]);
37283
37443
  return /* @__PURE__ */ jsx(
37284
37444
  CalendarHeaderCell$1,
37285
37445
  __spreadProps(__spreadValues({}, restProps), {
@@ -37328,9 +37488,9 @@ const DatePicker = ({
37328
37488
  onChange
37329
37489
  }) => {
37330
37490
  const additionalAriaProps = !showLabel && { "aria-label": label };
37331
- const errorTriangle = useMemo(() => /* @__PURE__ */ jsxs(Tooltip, { offset: 12, children: [
37332
- /* @__PURE__ */ jsx(TooltipTrigger, { children: /* @__PURE__ */ jsx(FieldError, { children: /* @__PURE__ */ jsx(TriangleAlert, { size: 18 }) }) }),
37333
- /* @__PURE__ */ jsx(TooltipContent, { className: "Layer__tooltip", width: "md", children: errorText })
37491
+ const errorTriangle = useMemo(() => /* @__PURE__ */ jsxs(DeprecatedTooltip, { offset: 12, children: [
37492
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsx(FieldError, { children: /* @__PURE__ */ jsx(TriangleAlert, { size: 18 }) }) }),
37493
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", width: "md", children: errorText })
37334
37494
  ] }), [errorText]);
37335
37495
  return /* @__PURE__ */ jsxs(
37336
37496
  DatePicker$1,
@@ -37759,11 +37919,11 @@ const ProfitAndLossView = (props) => {
37759
37919
  const containerRef = useRef(null);
37760
37920
  return /* @__PURE__ */ jsx(Container, { name: COMPONENT_NAME$1, ref: containerRef, children: /* @__PURE__ */ jsx(ProfitAndLoss, { children: /* @__PURE__ */ jsx(ProfitAndLossPanel, __spreadValues({ containerRef }, props)) }) });
37761
37921
  };
37762
- const ProfitAndLossPanel = (_ad) => {
37763
- var _bd = _ad, {
37922
+ const ProfitAndLossPanel = (_gd) => {
37923
+ var _hd = _gd, {
37764
37924
  containerRef,
37765
37925
  stringOverrides
37766
- } = _bd, props = __objRest(_bd, [
37926
+ } = _hd, props = __objRest(_hd, [
37767
37927
  "containerRef",
37768
37928
  "stringOverrides"
37769
37929
  ]);
@@ -38375,8 +38535,8 @@ function useInvoicesGlobalCacheActions() {
38375
38535
  );
38376
38536
  return { patchInvoiceByKey, patchInvoiceWithTransformation, forceReloadInvoices };
38377
38537
  }
38378
- const ChevronRightFill = (_cd) => {
38379
- var _dd = _cd, { size = 18 } = _dd, props = __objRest(_dd, ["size"]);
38538
+ const ChevronRightFill = (_id) => {
38539
+ var _jd = _id, { size = 18 } = _jd, props = __objRest(_jd, ["size"]);
38380
38540
  return /* @__PURE__ */ jsxs(
38381
38541
  "svg",
38382
38542
  __spreadProps(__spreadValues({
@@ -41128,8 +41288,8 @@ const getClassnameForSubComponent = (className, suffix) => {
41128
41288
  };
41129
41289
  const METER_CLASS_NAME = "Layer__Meter";
41130
41290
  const Meter = forwardRef(
41131
- function Meter2(_ed, ref) {
41132
- var _fd = _ed, { className, label, meterOnly } = _fd, restProps = __objRest(_fd, ["className", "label", "meterOnly"]);
41291
+ function Meter2(_kd, ref) {
41292
+ var _ld = _kd, { className, label, meterOnly } = _ld, restProps = __objRest(_ld, ["className", "label", "meterOnly"]);
41133
41293
  return /* @__PURE__ */ jsx(Meter$1, __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, restProps), { className: classNames(METER_CLASS_NAME, className), ref }), meterOnly && { "aria-label": label }), { children: ({ percentage, valueText }) => /* @__PURE__ */ jsxs(VStack, { gap: "3xs", fluid: true, children: [
41134
41294
  !meterOnly && /* @__PURE__ */ jsxs(HStack, { justify: "space-between", children: [
41135
41295
  /* @__PURE__ */ jsx(Label, { slot: "label", children: label }),
@@ -41673,14 +41833,14 @@ const BusinessProvider = ({
41673
41833
  }
41674
41834
  );
41675
41835
  };
41676
- const LayerProvider = (_gd) => {
41677
- var _hd = _gd, {
41836
+ const LayerProvider = (_md) => {
41837
+ var _nd = _md, {
41678
41838
  appId,
41679
41839
  appSecret,
41680
41840
  businessAccessToken,
41681
41841
  environment,
41682
41842
  usePlaidSandbox
41683
- } = _hd, restProps = __objRest(_hd, [
41843
+ } = _nd, restProps = __objRest(_nd, [
41684
41844
  "appId",
41685
41845
  "appSecret",
41686
41846
  "businessAccessToken",