@layerfi/components 0.1.114-alpha.3 → 0.1.114-alpha.4

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.
@@ -65,18 +65,18 @@ import useSWRInfinite from "swr/infinite";
65
65
  import useSWRMutation from "swr/mutation";
66
66
  import { useStoreWithEqualityFn } from "zustand/traditional";
67
67
  import { useFloating, offset, flip, shift, autoUpdate, useHover, useFocus, useDismiss, useRole, useInteractions, useTransitionStyles, useMergeRefs, FloatingPortal } from "@floating-ui/react";
68
- import { Button as Button$2, Header as Header$3, Label as Label$1, Text as Text$1, ModalOverlay as ModalOverlay$1, Modal as Modal$1, Dialog as Dialog$1, Heading as Heading$2, Form as Form$1, TextField as TextField$1, FieldError as FieldError$1, Input as Input$2, Group, Checkbox as Checkbox$1, DateField as DateField$1, DateInput as DateInput$1, DateSegment as DateSegment$1, DatePicker as DatePicker$2, NumberField as NumberField$1, TextArea as TextArea$1, MenuTrigger, Popover as Popover$1, Menu as Menu$1, MenuItem as MenuItem$2, GridList, GridListItem, DialogTrigger, SearchField as SearchField$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, Switch as Switch$1, Calendar as Calendar$1, CalendarGrid as CalendarGrid$1, CalendarGridBody as CalendarGridBody$1, CalendarCell as CalendarCell$1, CalendarGridHeader as CalendarGridHeader$1, CalendarHeaderCell as CalendarHeaderCell$1, Meter as Meter$1, Link as Link$3 } from "react-aria-components";
69
- import { LoaderCircle, X as X$1, ChevronDown as ChevronDown$1, Layers2Icon, UploadCloud as UploadCloud$1, CopyIcon, FileSpreadsheet, FileDownIcon, Minus, Check as Check$1, RefreshCcw as RefreshCcw$1, MenuIcon, ChevronRight as ChevronRight$1, PencilRuler, ChevronLeft as ChevronLeft$1, Search, SearchX, Trash2, CheckIcon, AlertCircle as AlertCircle$1, TriangleAlert, List, AlertTriangle, Save as Save$1, Plus as Plus$1, HandCoins, Menu as Menu$2, Trash as Trash$1, Send, Calendar as Calendar$2, Download, Users, Milestone, Video, Clock as Clock$1, Link as Link$4, Car } from "lucide-react";
68
+ import { Button as Button$2, Header as Header$3, Label as Label$1, Text as Text$1, ModalOverlay as ModalOverlay$1, Modal as Modal$1, Dialog as Dialog$1, Heading as Heading$2, Group, SearchField as SearchField$1, Input as Input$2, Form as Form$1, TextField as TextField$1, FieldError as FieldError$1, Checkbox as Checkbox$1, DateField as DateField$1, DateInput as DateInput$1, DateSegment as DateSegment$1, DatePicker as DatePicker$2, NumberField as NumberField$1, TextArea as TextArea$1, MenuTrigger, Popover as Popover$1, Menu as Menu$1, MenuItem as MenuItem$2, GridList, GridListItem, DialogTrigger, Table as Table$2, Column as Column$1, Cell as Cell$1, TableHeader as TableHeader$1, TableBody as TableBody$2, Row as Row$1, Switch as Switch$1, Calendar as Calendar$1, CalendarGrid as CalendarGrid$1, CalendarGridBody as CalendarGridBody$1, CalendarCell as CalendarCell$1, CalendarGridHeader as CalendarGridHeader$1, CalendarHeaderCell as CalendarHeaderCell$1, Meter as Meter$1, Link as Link$3 } from "react-aria-components";
69
+ import { LoaderCircle, X as X$1, ChevronDown as ChevronDown$1, Layers2Icon, UploadCloud as UploadCloud$1, Search, ChevronLeft as ChevronLeft$1, CopyIcon, FileSpreadsheet, FileDownIcon, Minus, Check as Check$1, RefreshCcw as RefreshCcw$1, MenuIcon, ChevronRight as ChevronRight$1, PencilRuler, SearchX, Trash2, CheckIcon, AlertCircle as AlertCircle$1, TriangleAlert, List, AlertTriangle, Save as Save$1, Plus as Plus$1, HandCoins, Menu as Menu$2, Trash as Trash$1, Send, Calendar as Calendar$2, Download, Users, Milestone, Video, Clock as Clock$1, Link as Link$4, Car } from "lucide-react";
70
70
  import pluralize from "pluralize";
71
71
  import { mergeRefs } from "react-merge-refs";
72
72
  import useResizeObserver from "@react-hook/resize-observer";
73
73
  import Select$1, { components } from "react-select";
74
- import { AnimatePresence, motion } from "motion/react";
75
74
  import { useDropzone } from "react-dropzone";
76
75
  import { createFormHookContexts, createFormHook, useForm as useForm$1, useStore as useStore$1, revalidateLogic } from "@tanstack/react-form";
77
76
  import BaseCreatableSelect from "react-select/creatable";
78
77
  import { useReactTable, getSortedRowModel, getCoreRowModel, flexRender, createColumnHelper, getPaginationRowModel, getExpandedRowModel } from "@tanstack/react-table";
79
78
  import { useVirtualizer } from "@tanstack/react-virtual";
79
+ import { AnimatePresence, motion } from "motion/react";
80
80
  import CurrencyInput from "react-currency-input-field";
81
81
  import { v4 } from "uuid";
82
82
  import { ResponsiveContainer, ComposedChart, ReferenceLine, Tooltip as Tooltip$1, CartesianGrid, Legend, XAxis, YAxis, Bar, Cell as Cell$2, LabelList, Line, Rectangle, PieChart, Pie, Label as Label$2, Text as Text$2 } from "recharts";
@@ -202,7 +202,7 @@ class ErrorHandlerClass {
202
202
  }
203
203
  const errorHandler = new ErrorHandlerClass();
204
204
  const reportError = (payload) => errorHandler.onError(payload);
205
- const version = "0.1.114-alpha.3";
205
+ const version = "0.1.114-alpha.4";
206
206
  const pkg = {
207
207
  version
208
208
  };
@@ -4894,7 +4894,7 @@ const useAugmentedBankTransactions = (params) => {
4894
4894
  }
4895
4895
  }).finally(() => {
4896
4896
  var _a2;
4897
- (_a2 = eventCallbacks == null ? void 0 : eventCallbacks.onTransactionCategorized) == null ? void 0 : _a2.call(eventCallbacks, bankTransactionId);
4897
+ (_a2 = eventCallbacks == null ? void 0 : eventCallbacks.onTransactionCategorized) == null ? void 0 : _a2.call(eventCallbacks);
4898
4898
  });
4899
4899
  });
4900
4900
  const { trigger: matchBankTransaction2 } = useMatchBankTransaction({
@@ -4953,7 +4953,7 @@ const useAugmentedBankTransactions = (params) => {
4953
4953
  }
4954
4954
  }).finally(() => {
4955
4955
  var _a2;
4956
- (_a2 = eventCallbacks == null ? void 0 : eventCallbacks.onTransactionCategorized) == null ? void 0 : _a2.call(eventCallbacks, bankTransactionId);
4956
+ (_a2 = eventCallbacks == null ? void 0 : eventCallbacks.onTransactionCategorized) == null ? void 0 : _a2.call(eventCallbacks);
4957
4957
  });
4958
4958
  });
4959
4959
  const shouldHideAfterCategorize = () => {
@@ -6786,7 +6786,7 @@ function BulkSelectionStoreProvider({
6786
6786
  const [store] = useState(() => buildStore());
6787
6787
  return /* @__PURE__ */ jsx(BulkSelectionStoreContext.Provider, { value: store, children });
6788
6788
  }
6789
- const CLASS_NAME$d = "Layer__Stack";
6789
+ const CLASS_NAME$c = "Layer__Stack";
6790
6790
  const Stack = forwardRef(
6791
6791
  function Stack2(_H, ref) {
6792
6792
  var _I = _H, {
@@ -6839,7 +6839,7 @@ const Stack = forwardRef(
6839
6839
  __spreadProps(__spreadValues(__spreadValues({
6840
6840
  ref
6841
6841
  }, restProps), dataProperties), {
6842
- className: classNames(CLASS_NAME$d, className),
6842
+ className: classNames(CLASS_NAME$c, className),
6843
6843
  children
6844
6844
  })
6845
6845
  );
@@ -6963,9 +6963,9 @@ function useDebounce(fn) {
6963
6963
  }, []);
6964
6964
  return debouncedCallback;
6965
6965
  }
6966
- const CLASS_NAME$c = "Layer__LoadingSpinner";
6966
+ const CLASS_NAME$b = "Layer__LoadingSpinner";
6967
6967
  function LoadingSpinner({ size }) {
6968
- return /* @__PURE__ */ jsx(LoaderCircle, { className: CLASS_NAME$c, size });
6968
+ return /* @__PURE__ */ jsx(LoaderCircle, { className: CLASS_NAME$b, size });
6969
6969
  }
6970
6970
  function withRenderProp(renderProp, callback) {
6971
6971
  if (typeof renderProp === "function") {
@@ -7079,7 +7079,7 @@ function buildKey$T({
7079
7079
  }
7080
7080
  const useBulkCategorize = () => {
7081
7081
  const { data } = useAuth();
7082
- const { businessId } = useLayerContext();
7082
+ const { businessId, eventCallbacks } = useLayerContext();
7083
7083
  const { forceReloadBankTransactions } = useBankTransactionsGlobalCacheActions();
7084
7084
  const mutationResponse = useSWRMutation(
7085
7085
  () => buildKey$T(__spreadProps(__spreadValues({}, data), {
@@ -7101,11 +7101,13 @@ const useBulkCategorize = () => {
7101
7101
  const originalTrigger = mutationResponse.trigger;
7102
7102
  const stableProxiedTrigger = useCallback(
7103
7103
  (...triggerParameters) => __async(null, null, function* () {
7104
+ var _a;
7104
7105
  const triggerResult = yield originalTrigger(...triggerParameters);
7105
7106
  void forceReloadBankTransactions();
7107
+ (_a = eventCallbacks == null ? void 0 : eventCallbacks.onTransactionCategorized) == null ? void 0 : _a.call(eventCallbacks);
7106
7108
  return triggerResult;
7107
7109
  }),
7108
- [originalTrigger, forceReloadBankTransactions]
7110
+ [originalTrigger, forceReloadBankTransactions, eventCallbacks]
7109
7111
  );
7110
7112
  return new Proxy(mutationResponse, {
7111
7113
  get(target, prop) {
@@ -7705,18 +7707,16 @@ const centsToDollars = (cents = NaN) => isNaN(cents) ? "-.--" : formatter.format
7705
7707
  function centsToDollarsWithoutCommas(cents = 0) {
7706
7708
  return centsToDollars(cents).replaceAll(",", "");
7707
7709
  }
7708
- const CLASS_NAME$b = "Layer__MoneyText";
7710
+ const CLASS_NAME$a = "Layer__MoneySpan";
7709
7711
  const MoneySpan = forwardRef(
7710
7712
  (_V, ref) => {
7711
- var _W = _V, { amount, bold, size, displayPlusSign, className } = _W, restProps = __objRest(_W, ["amount", "bold", "size", "displayPlusSign", "className"]);
7713
+ var _W = _V, { amount, displayPlusSign, className } = _W, restProps = __objRest(_W, ["amount", "displayPlusSign", "className"]);
7712
7714
  const dataProperties = toDataProperties({
7713
- bold,
7714
7715
  "positive": amount >= 0,
7715
7716
  "negative": amount < 0,
7716
- size,
7717
7717
  "display-plus-sign": displayPlusSign
7718
7718
  });
7719
- return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(CLASS_NAME$b, className), ref, children: centsToDollars(Math.abs(amount)) }));
7719
+ return /* @__PURE__ */ jsx(Span, __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(CLASS_NAME$a, className), ref, children: centsToDollars(Math.abs(amount)) }));
7720
7720
  }
7721
7721
  );
7722
7722
  MoneySpan.displayName = "MoneySpan";
@@ -8137,7 +8137,7 @@ const BankTransactionCategoryComboBoxOption = ({ option, fallback }) => {
8137
8137
  /* @__PURE__ */ jsx(Span, { size: "sm", variant: "placeholder", children: option.label }),
8138
8138
  inAppLink
8139
8139
  ] }),
8140
- /* @__PURE__ */ jsx(MoneySpan, { size: "sm", bold: true, amount: option.original.details.amount })
8140
+ /* @__PURE__ */ jsx(MoneySpan, { size: "sm", weight: "bold", amount: option.original.details.amount })
8141
8141
  ] });
8142
8142
  }
8143
8143
  return fallback;
@@ -8213,59 +8213,11 @@ const BankTransactionCategoryComboBox = ({
8213
8213
  }
8214
8214
  );
8215
8215
  };
8216
- const variants = {
8217
- fade: {
8218
- initial: { opacity: 0 },
8219
- animate: { opacity: 1 },
8220
- exit: { opacity: 0 },
8221
- transition: { duration: 0.3, ease: [0, 0, 0.58, 1] }
8222
- },
8223
- slideUp: {
8224
- initial: { y: "100%" },
8225
- animate: { y: 0 },
8226
- exit: { y: "100%" },
8227
- transition: { duration: 0.35, ease: [0.4, 0, 0.2, 1] }
8228
- },
8229
- expand: {
8230
- initial: { height: 0, opacity: 0 },
8231
- animate: { height: "auto", opacity: 1 },
8232
- exit: { height: 0, opacity: 0 },
8233
- transition: {
8234
- height: { duration: 0.25, ease: [0.4, 0, 0.2, 1] },
8235
- opacity: { duration: 0.15, ease: [0, 0, 0.58, 1] }
8236
- }
8237
- }
8238
- };
8239
- const AnimatedPresenceDiv = (_$) => {
8240
- var _aa = _$, {
8241
- children,
8242
- variant,
8243
- isOpen,
8244
- slotProps = { AnimatePresence: { initial: false } }
8245
- } = _aa, props = __objRest(_aa, [
8246
- "children",
8247
- "variant",
8248
- "isOpen",
8249
- "slotProps"
8250
- ]);
8251
- const config = variants[variant];
8252
- return /* @__PURE__ */ jsx(AnimatePresence, __spreadProps(__spreadValues({}, slotProps.AnimatePresence), { children: isOpen && /* @__PURE__ */ jsx(
8253
- motion.div,
8254
- __spreadProps(__spreadValues({
8255
- initial: config.initial,
8256
- animate: config.animate,
8257
- exit: config.exit,
8258
- transition: config.transition
8259
- }, props), {
8260
- children
8261
- })
8262
- ) }));
8263
- };
8264
8216
  const BASE_MODAL_OVERLAY_CLASS_NAME = "Layer__ModalOverlay";
8265
8217
  const MODAL_OVERLAY_CLASS_NAME = `Layer__Portal ${BASE_MODAL_OVERLAY_CLASS_NAME}`;
8266
8218
  const ModalOverlay = forwardRef(
8267
- (_ba, ref) => {
8268
- var _ca = _ba, { variant } = _ca, restProps = __objRest(_ca, ["variant"]);
8219
+ (_$, ref) => {
8220
+ var _aa = _$, { variant } = _aa, restProps = __objRest(_aa, ["variant"]);
8269
8221
  const dataProperties = toDataProperties({ variant });
8270
8222
  return /* @__PURE__ */ jsx(
8271
8223
  ModalOverlay$1,
@@ -8292,8 +8244,8 @@ const InternalModal = forwardRef(({ children, flexBlock, flexInline, size, varia
8292
8244
  InternalModal.displayName = "Modal";
8293
8245
  const DIALOG_CLASS_NAME = "Layer__Dialog";
8294
8246
  const Dialog = forwardRef(
8295
- (_da, ref) => {
8296
- var _ea = _da, { variant = "center" } = _ea, restProps = __objRest(_ea, ["variant"]);
8247
+ (_ba, ref) => {
8248
+ var _ca = _ba, { variant = "center" } = _ca, restProps = __objRest(_ca, ["variant"]);
8297
8249
  const dataProperties = toDataProperties({ variant });
8298
8250
  return /* @__PURE__ */ jsx(
8299
8251
  Dialog$1,
@@ -8331,25 +8283,11 @@ function Drawer({
8331
8283
  isDismissable = false,
8332
8284
  role
8333
8285
  }) {
8334
- const isMobileDrawer = variant === "mobile-drawer";
8335
- const shouldUseFadeOverlay = variant === "drawer" || isMobileDrawer;
8336
- const modalContent = /* @__PURE__ */ jsx(InternalModal, { flexBlock, flexInline, size, variant, children: /* @__PURE__ */ jsx(Dialog, { role: role != null ? role : "dialog", "aria-label": ariaLabel, variant, children }) });
8337
- const wrappedModalContent = isMobileDrawer ? /* @__PURE__ */ jsx(
8338
- AnimatedPresenceDiv,
8339
- {
8340
- variant: "slideUp",
8341
- isOpen,
8342
- className: "Layer__ModalContentSlideUpMotionContent",
8343
- slotProps: { AnimatePresence: { initial: true } },
8344
- children: modalContent
8345
- }
8346
- ) : modalContent;
8347
- const overlayContent = shouldUseFadeOverlay ? /* @__PURE__ */ jsx(AnimatedPresenceDiv, { variant: "fade", isOpen, className: "Layer__ModalContentFadeMotionContent", children: wrappedModalContent }) : wrappedModalContent;
8348
- return /* @__PURE__ */ jsx(ModalOverlay, { isOpen, onOpenChange, variant, isDismissable, children: overlayContent });
8286
+ return /* @__PURE__ */ jsx(ModalOverlay, { isOpen, onOpenChange, variant, isDismissable, children: /* @__PURE__ */ jsx(InternalModal, { flexBlock, flexInline, size, variant, children: /* @__PURE__ */ jsx(Dialog, { role: role != null ? role : "dialog", "aria-label": ariaLabel, variant, children }) }) });
8349
8287
  }
8350
8288
  const HEADING_CLASS_NAME = "Layer__UI__Heading";
8351
- const Heading$1 = forwardRef((_fa, ref) => {
8352
- var _ga = _fa, { align, pie, pbe, size, variant, weight, ellipsis, className } = _ga, restProps = __objRest(_ga, ["align", "pie", "pbe", "size", "variant", "weight", "ellipsis", "className"]);
8289
+ const Heading$1 = forwardRef((_da, ref) => {
8290
+ var _ea = _da, { align, pie, pbe, size, variant, weight, ellipsis, className } = _ea, restProps = __objRest(_ea, ["align", "pie", "pbe", "size", "variant", "weight", "ellipsis", "className"]);
8353
8291
  const dataProperties = toDataProperties({ pbe, pie, size, align, variant, weight, ellipsis });
8354
8292
  return /* @__PURE__ */ jsx(
8355
8293
  Heading$2,
@@ -8420,8 +8358,8 @@ const MODAL_ACTIONS_CLASS_NAME = "Layer__ModalActions";
8420
8358
  function ModalActions({ children }) {
8421
8359
  return /* @__PURE__ */ jsx("div", { className: MODAL_ACTIONS_CLASS_NAME, children });
8422
8360
  }
8423
- const AlertCircle = (_ha) => {
8424
- var _ia = _ha, { size = 18 } = _ia, props = __objRest(_ia, ["size"]);
8361
+ const AlertCircle = (_fa) => {
8362
+ var _ga = _fa, { size = 18 } = _ga, props = __objRest(_ga, ["size"]);
8425
8363
  return /* @__PURE__ */ jsxs(
8426
8364
  "svg",
8427
8365
  __spreadProps(__spreadValues({
@@ -8463,8 +8401,8 @@ const AlertCircle = (_ha) => {
8463
8401
  })
8464
8402
  );
8465
8403
  };
8466
- const Save = (_ja) => {
8467
- var _ka = _ja, { size = 18 } = _ka, props = __objRest(_ka, ["size"]);
8404
+ const Save = (_ha) => {
8405
+ var _ia = _ha, { size = 18 } = _ia, props = __objRest(_ia, ["size"]);
8468
8406
  return /* @__PURE__ */ jsxs(
8469
8407
  "svg",
8470
8408
  __spreadProps(__spreadValues({
@@ -8506,14 +8444,14 @@ const Save = (_ja) => {
8506
8444
  })
8507
8445
  );
8508
8446
  };
8509
- const RetryButton = (_la) => {
8510
- var _ma = _la, {
8447
+ const RetryButton = (_ja) => {
8448
+ var _ka = _ja, {
8511
8449
  className,
8512
8450
  processing,
8513
8451
  disabled,
8514
8452
  error,
8515
8453
  children
8516
- } = _ma, props = __objRest(_ma, [
8454
+ } = _ka, props = __objRest(_ka, [
8517
8455
  "className",
8518
8456
  "processing",
8519
8457
  "disabled",
@@ -8570,8 +8508,8 @@ const buildRightIcon = ({
8570
8508
  }
8571
8509
  return /* @__PURE__ */ jsx(Save, { size: 16 });
8572
8510
  };
8573
- const SubmitButton = (_na) => {
8574
- var _oa = _na, {
8511
+ const SubmitButton = (_la) => {
8512
+ var _ma = _la, {
8575
8513
  active,
8576
8514
  className,
8577
8515
  processing,
@@ -8583,7 +8521,7 @@ const SubmitButton = (_na) => {
8583
8521
  variant = ButtonVariant.primary,
8584
8522
  withRetry,
8585
8523
  iconAsPrimary = true
8586
- } = _oa, props = __objRest(_oa, [
8524
+ } = _ma, props = __objRest(_ma, [
8587
8525
  "active",
8588
8526
  "className",
8589
8527
  "processing",
@@ -8688,12 +8626,323 @@ function BaseConfirmationModal({
8688
8626
  ] });
8689
8627
  } });
8690
8628
  }
8629
+ const ChevronDown = (_na) => {
8630
+ var _oa = _na, { size = 18 } = _oa, props = __objRest(_oa, ["size"]);
8631
+ return /* @__PURE__ */ jsx(
8632
+ "svg",
8633
+ __spreadProps(__spreadValues({
8634
+ viewBox: "0 0 18 18",
8635
+ fill: "none",
8636
+ xmlns: "http://www.w3.org/2000/svg"
8637
+ }, props), {
8638
+ width: size,
8639
+ height: size,
8640
+ children: /* @__PURE__ */ jsx(
8641
+ "path",
8642
+ {
8643
+ d: "M4.5 6.75L9 11.25L13.5 6.75",
8644
+ stroke: "currentColor",
8645
+ strokeLinecap: "round",
8646
+ strokeLinejoin: "round"
8647
+ }
8648
+ )
8649
+ })
8650
+ );
8651
+ };
8652
+ const ActionableList = ({
8653
+ options: options2,
8654
+ onClick,
8655
+ selectedId,
8656
+ showDescriptions = false,
8657
+ className
8658
+ }) => {
8659
+ return /* @__PURE__ */ jsx("ul", { className: classNames("Layer__actionable-list", className), children: options2.map((x, idx) => /* @__PURE__ */ jsxs(
8660
+ "li",
8661
+ {
8662
+ role: "button",
8663
+ onClick: () => onClick(x),
8664
+ className: classNames(
8665
+ x.secondary && "Layer__actionable-list-item--secondary",
8666
+ x.asLink && "Layer__actionable-list-item--as-link",
8667
+ selectedId === x.id && "Layer__actionable-list__item--selected"
8668
+ ),
8669
+ children: [
8670
+ /* @__PURE__ */ jsxs("div", { className: "Layer__actionable-list__content", children: [
8671
+ /* @__PURE__ */ jsx(Text, { size: TextSize.sm, children: x.label }),
8672
+ /* TODO: Replace 'See all categories' with something more generic */
8673
+ showDescriptions && x.description && x.label !== "See all categories" && /* @__PURE__ */ jsx(
8674
+ Text,
8675
+ {
8676
+ className: "Layer__actionable-list__content-description",
8677
+ size: TextSize.sm,
8678
+ children: x.description
8679
+ }
8680
+ )
8681
+ ] }),
8682
+ !x.asLink && selectedId && selectedId === x.id ? /* @__PURE__ */ jsx("span", { className: "Layer__actionable-list__select Layer__actionable-list__select--selected", children: /* @__PURE__ */ jsx(
8683
+ Check,
8684
+ {
8685
+ size: 14,
8686
+ className: "Layer__actionable-list__selected-icon"
8687
+ }
8688
+ ) }) : null,
8689
+ !x.asLink && (!selectedId || selectedId !== x.id) ? /* @__PURE__ */ jsx("span", { className: "Layer__actionable-list__select" }) : null,
8690
+ x.asLink && /* @__PURE__ */ jsx(
8691
+ ChevronRight,
8692
+ {
8693
+ size: 16,
8694
+ className: "Layer__actionable-list__link-icon"
8695
+ }
8696
+ )
8697
+ ]
8698
+ },
8699
+ `actionable-list-item-${idx}`
8700
+ )) });
8701
+ };
8702
+ function getLeafCategories(category) {
8703
+ if (!category.subCategories || category.subCategories.length === 0) {
8704
+ return [category];
8705
+ }
8706
+ return category.subCategories.flatMap((subCategory) => getLeafCategories(subCategory));
8707
+ }
8708
+ const flattenCategories = (categories) => {
8709
+ return categories.flatMap((category) => {
8710
+ const subCategories = category.subCategories;
8711
+ if (!subCategories || subCategories.length === 0) {
8712
+ return [new CategoryAsOption(category)];
8713
+ }
8714
+ const leafCategories = getLeafCategories(category);
8715
+ if (subCategories.every((subCategory) => !subCategory.subCategories || subCategory.subCategories.length === 0)) {
8716
+ return [{
8717
+ label: category.displayName,
8718
+ id: "id" in category ? category.id : category.stableName,
8719
+ categories: leafCategories.map((cat) => new CategoryAsOption(cat))
8720
+ }];
8721
+ }
8722
+ return leafCategories.map((cat) => new CategoryAsOption(cat));
8723
+ });
8724
+ };
8725
+ const INPUT_GROUP_CLASS_NAME = "Layer__InputGroup";
8726
+ const InputGroup$1 = forwardRef(
8727
+ function InputGroup2(_pa, ref) {
8728
+ var _qa = _pa, { actionCount, className, slots, children } = _qa, restProps = __objRest(_qa, ["actionCount", "className", "slots", "children"]);
8729
+ const combinedClassName = classNames(INPUT_GROUP_CLASS_NAME, className);
8730
+ const dataProperties = toDataProperties({
8731
+ "action-count": actionCount
8732
+ });
8733
+ return /* @__PURE__ */ jsx(
8734
+ Group,
8735
+ __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), {
8736
+ className: combinedClassName,
8737
+ ref,
8738
+ children
8739
+ })
8740
+ );
8741
+ }
8742
+ );
8743
+ const X = (_ra) => {
8744
+ var _sa = _ra, { size = 18 } = _sa, props = __objRest(_sa, ["size"]);
8745
+ return /* @__PURE__ */ jsxs(
8746
+ "svg",
8747
+ __spreadProps(__spreadValues({
8748
+ xmlns: "http://www.w3.org/2000/svg",
8749
+ viewBox: "0 0 18 18",
8750
+ fill: "none"
8751
+ }, props), {
8752
+ width: size,
8753
+ height: size,
8754
+ children: [
8755
+ /* @__PURE__ */ jsx(
8756
+ "path",
8757
+ {
8758
+ d: "M13.5 4.5L4.5 13.5",
8759
+ stroke: "currentColor",
8760
+ strokeLinecap: "round",
8761
+ strokeLinejoin: "round"
8762
+ }
8763
+ ),
8764
+ /* @__PURE__ */ jsx(
8765
+ "path",
8766
+ {
8767
+ d: "M4.5 4.5L13.5 13.5",
8768
+ stroke: "currentColor",
8769
+ strokeLinecap: "round",
8770
+ strokeLinejoin: "round"
8771
+ }
8772
+ )
8773
+ ]
8774
+ })
8775
+ );
8776
+ };
8777
+ const CLASS_NAME$9 = "Layer__MinimalSearchField";
8778
+ function MinimalSearchField(_ta) {
8779
+ var _ua = _ta, {
8780
+ placeholder,
8781
+ isDisabled
8782
+ } = _ua, restProps = __objRest(_ua, [
8783
+ "placeholder",
8784
+ "isDisabled"
8785
+ ]);
8786
+ return /* @__PURE__ */ jsxs(SearchField$1, __spreadProps(__spreadValues({}, restProps), { isDisabled, className: CLASS_NAME$9, children: [
8787
+ /* @__PURE__ */ jsx(
8788
+ Input$2,
8789
+ {
8790
+ slot: "input",
8791
+ placeholder
8792
+ }
8793
+ ),
8794
+ /* @__PURE__ */ jsx(Button, { slot: "clear-button", inset: true, icon: true, variant: "ghost", "aria-label": "Clear search", children: /* @__PURE__ */ jsx(X, {}) })
8795
+ ] }));
8796
+ }
8797
+ const CLASS_NAME$8 = "Layer__SearchField";
8798
+ function SearchField(_va) {
8799
+ var _wa = _va, { slot = "search", className, label, isDisabled } = _wa, restProps = __objRest(_wa, ["slot", "className", "label", "isDisabled"]);
8800
+ const combinedClassName = classNames(CLASS_NAME$8, className);
8801
+ return /* @__PURE__ */ jsxs(InputGroup$1, { slot, className: combinedClassName, children: [
8802
+ /* @__PURE__ */ jsx(VStack, { slot: "icon", align: "center", justify: "center", className: "Layer__SearchField__Icon", "data-disabled": isDisabled || void 0, children: /* @__PURE__ */ jsx(Search, { size: 14 }) }),
8803
+ /* @__PURE__ */ jsx(
8804
+ MinimalSearchField,
8805
+ __spreadProps(__spreadValues({}, restProps), {
8806
+ placeholder: label,
8807
+ "aria-label": label,
8808
+ isDisabled
8809
+ })
8810
+ )
8811
+ ] });
8812
+ }
8813
+ const isGroup = (item) => {
8814
+ return "categories" in item;
8815
+ };
8816
+ const BankTransactionsMobileListBusinessCategories = ({
8817
+ select,
8818
+ selectedId,
8819
+ showTooltips
8820
+ }) => {
8821
+ const { data: categories } = useCategories();
8822
+ const [query, setQuery] = useState("");
8823
+ const categoryOptions = useMemo(
8824
+ () => flattenCategories(
8825
+ (categories != null ? categories : []).filter((category) => category.type != "ExclusionNested")
8826
+ ),
8827
+ [categories]
8828
+ );
8829
+ const [optionsToShow, setOptionsToShow] = useState(categoryOptions);
8830
+ const [selectedGroup, setSelectedGroup] = useState();
8831
+ const filteredOptions = useMemo(() => {
8832
+ let options2 = optionsToShow;
8833
+ if (query) {
8834
+ const lower = query.toLowerCase();
8835
+ options2 = options2.flatMap((opt) => {
8836
+ if (isGroup(opt)) {
8837
+ return opt.categories.filter(
8838
+ (cat) => cat.label.toLowerCase().includes(lower)
8839
+ );
8840
+ }
8841
+ return opt.label.toLowerCase().includes(lower) ? [opt] : [];
8842
+ });
8843
+ }
8844
+ return options2.sort((a, b) => a.label.localeCompare(b.label)).map((opt) => {
8845
+ var _a;
8846
+ return isGroup(opt) ? { label: opt.label, id: opt.id, value: opt, asLink: true } : { label: opt.label, id: opt.value, description: (_a = opt.original.description) != null ? _a : void 0, value: opt };
8847
+ });
8848
+ }, [optionsToShow, query]);
8849
+ const onCategorySelect = (item) => {
8850
+ if (isGroup(item.value)) {
8851
+ setOptionsToShow(item.value.categories);
8852
+ setSelectedGroup(item.value.label);
8853
+ setQuery("");
8854
+ return;
8855
+ }
8856
+ select(item.value);
8857
+ };
8858
+ const clearSelectedGroup = useCallback(() => {
8859
+ setOptionsToShow(categoryOptions);
8860
+ setSelectedGroup(void 0);
8861
+ setQuery("");
8862
+ }, [categoryOptions]);
8863
+ return /* @__PURE__ */ jsxs(VStack, { className: "Layer__bank-transaction-mobile-list-item__categories_list-container", pbs: "lg", gap: "md", children: [
8864
+ /* @__PURE__ */ jsxs(VStack, { pis: "sm", pie: "sm", gap: "md", children: [
8865
+ /* @__PURE__ */ jsx(HStack, { pis: "xs", children: selectedGroup ? /* @__PURE__ */ jsxs(Button, { variant: "text", onClick: clearSelectedGroup, children: [
8866
+ /* @__PURE__ */ jsx(ChevronLeft$1, { size: 18 }),
8867
+ /* @__PURE__ */ jsx(ModalHeading, { size: "sm", weight: "bold", align: "center", children: selectedGroup })
8868
+ ] }) : /* @__PURE__ */ jsx(ModalHeading, { size: "sm", weight: "bold", children: "Select category" }) }),
8869
+ /* @__PURE__ */ jsx(SearchField, { value: query, onChange: setQuery, label: "Search categories..." })
8870
+ ] }),
8871
+ /* @__PURE__ */ jsx(
8872
+ ActionableList,
8873
+ {
8874
+ options: filteredOptions,
8875
+ onClick: onCategorySelect,
8876
+ selectedId,
8877
+ showDescriptions: showTooltips,
8878
+ className: "Layer__bank-transaction-mobile-list-item__categories_list"
8879
+ }
8880
+ )
8881
+ ] });
8882
+ };
8883
+ const CategorySelectDrawer = ({
8884
+ onSelect,
8885
+ selectedId,
8886
+ showTooltips,
8887
+ isOpen,
8888
+ onOpenChange
8889
+ }) => {
8890
+ return /* @__PURE__ */ jsx(Drawer, { isOpen, onOpenChange, variant: "mobile-drawer", isDismissable: true, children: ({ close: close2 }) => /* @__PURE__ */ jsx(
8891
+ BankTransactionsMobileListBusinessCategories,
8892
+ {
8893
+ select: (option) => {
8894
+ onSelect(option);
8895
+ close2();
8896
+ },
8897
+ selectedId,
8898
+ showTooltips
8899
+ }
8900
+ ) });
8901
+ };
8902
+ const CategorySelectDrawerWithTrigger = ({ value, onChange, showTooltips }) => {
8903
+ var _a;
8904
+ const [isDrawerOpen, setIsDrawerOpen] = useState(false);
8905
+ return /* @__PURE__ */ jsxs(HStack, { fluid: true, children: [
8906
+ /* @__PURE__ */ jsxs(
8907
+ Button,
8908
+ {
8909
+ flex: true,
8910
+ fullWidth: true,
8911
+ "aria-label": "Select category",
8912
+ onClick: () => {
8913
+ setIsDrawerOpen(true);
8914
+ },
8915
+ variant: "outlined",
8916
+ children: [
8917
+ /* @__PURE__ */ jsx(Span, { children: (_a = value == null ? void 0 : value.label) != null ? _a : "Select..." }),
8918
+ /* @__PURE__ */ jsx(Spacer, {}),
8919
+ /* @__PURE__ */ jsx(ChevronDown, { size: 16 })
8920
+ ]
8921
+ }
8922
+ ),
8923
+ /* @__PURE__ */ jsx(
8924
+ CategorySelectDrawer,
8925
+ {
8926
+ onSelect: onChange,
8927
+ selectedId: value == null ? void 0 : value.value,
8928
+ showTooltips,
8929
+ isOpen: isDrawerOpen,
8930
+ onOpenChange: setIsDrawerOpen
8931
+ }
8932
+ )
8933
+ ] });
8934
+ };
8691
8935
  var CategorizationMode = /* @__PURE__ */ ((CategorizationMode2) => {
8692
8936
  CategorizationMode2["Categorize"] = "Categorize";
8693
8937
  CategorizationMode2["Recategorize"] = "Recategorize";
8694
8938
  return CategorizationMode2;
8695
8939
  })(CategorizationMode || {});
8696
- const BankTransactionsCategorizeAllModal = ({ isOpen, onOpenChange, mode }) => {
8940
+ const BankTransactionsCategorizeAllModal = ({
8941
+ isOpen,
8942
+ onOpenChange,
8943
+ mode,
8944
+ useCategorySelectDrawer = false
8945
+ }) => {
8697
8946
  const { count } = useCountSelectedIds();
8698
8947
  const { selectedIds } = useSelectedIds();
8699
8948
  const { clearSelection } = useBulkSelectionActions();
@@ -8735,7 +8984,15 @@ const BankTransactionsCategorizeAllModal = ({ isOpen, onOpenChange, mode }) => {
8735
8984
  content: /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
8736
8985
  /* @__PURE__ */ jsxs(VStack, { gap: "3xs", children: [
8737
8986
  /* @__PURE__ */ jsx(Label, { htmlFor: categorySelectId, children: "Select category" }),
8738
- /* @__PURE__ */ jsx(
8987
+ useCategorySelectDrawer ? /* @__PURE__ */ jsx(
8988
+ CategorySelectDrawerWithTrigger,
8989
+ {
8990
+ "aria-labelledby": categorySelectId,
8991
+ value: selectedCategory,
8992
+ onChange: setSelectedCategory,
8993
+ showTooltips: false
8994
+ }
8995
+ ) : /* @__PURE__ */ jsx(
8739
8996
  BankTransactionCategoryComboBox,
8740
8997
  {
8741
8998
  inputId: categorySelectId,
@@ -8806,7 +9063,7 @@ function buildKey$R({
8806
9063
  }
8807
9064
  const useBulkMatchOrCategorize = () => {
8808
9065
  const { data } = useAuth();
8809
- const { businessId } = useLayerContext();
9066
+ const { businessId, eventCallbacks } = useLayerContext();
8810
9067
  const { selectedIds } = useSelectedIds();
8811
9068
  const { transactionCategories } = useGetAllBankTransactionsCategories();
8812
9069
  const { forceReloadBankTransactions } = useBankTransactionsGlobalCacheActions();
@@ -8834,14 +9091,13 @@ const useBulkMatchOrCategorize = () => {
8834
9091
  const { trigger: originalTrigger } = mutationResponse;
8835
9092
  const stableProxiedTrigger = useCallback(
8836
9093
  (...triggerParameters) => __async(null, null, function* () {
9094
+ var _a;
8837
9095
  const triggerResult = yield originalTrigger(...triggerParameters);
8838
9096
  void forceReloadBankTransactions();
9097
+ (_a = eventCallbacks == null ? void 0 : eventCallbacks.onTransactionCategorized) == null ? void 0 : _a.call(eventCallbacks);
8839
9098
  return triggerResult;
8840
9099
  }),
8841
- [
8842
- originalTrigger,
8843
- forceReloadBankTransactions
8844
- ]
9100
+ [originalTrigger, forceReloadBankTransactions, eventCallbacks]
8845
9101
  );
8846
9102
  const proxiedResponse = new Proxy(mutationResponse, {
8847
9103
  get(target, prop) {
@@ -8902,7 +9158,7 @@ function buildKey$Q({
8902
9158
  }
8903
9159
  const useBulkUncategorize = () => {
8904
9160
  const { data } = useAuth();
8905
- const { businessId } = useLayerContext();
9161
+ const { businessId, eventCallbacks } = useLayerContext();
8906
9162
  const { forceReloadBankTransactions } = useBankTransactionsGlobalCacheActions();
8907
9163
  const mutationResponse = useSWRMutation(
8908
9164
  () => buildKey$Q(__spreadProps(__spreadValues({}, data), {
@@ -8924,11 +9180,13 @@ const useBulkUncategorize = () => {
8924
9180
  const originalTrigger = mutationResponse.trigger;
8925
9181
  const stableProxiedTrigger = useCallback(
8926
9182
  (...triggerParameters) => __async(null, null, function* () {
9183
+ var _a;
8927
9184
  const triggerResult = yield originalTrigger(...triggerParameters);
8928
9185
  void forceReloadBankTransactions();
9186
+ (_a = eventCallbacks == null ? void 0 : eventCallbacks.onTransactionCategorized) == null ? void 0 : _a.call(eventCallbacks);
8929
9187
  return triggerResult;
8930
9188
  }),
8931
- [originalTrigger, forceReloadBankTransactions]
9189
+ [originalTrigger, forceReloadBankTransactions, eventCallbacks]
8932
9190
  );
8933
9191
  return new Proxy(mutationResponse, {
8934
9192
  get(target, prop) {
@@ -8963,7 +9221,7 @@ const BankTransactionsUncategorizeAllModal = ({ isOpen, onOpenChange }) => {
8963
9221
  }
8964
9222
  );
8965
9223
  };
8966
- const BankTransactionsBulkActions = () => {
9224
+ const BankTransactionsBulkActions = ({ useCategorySelectDrawer = false }) => {
8967
9225
  const { display } = useBankTransactionsContext();
8968
9226
  const [categorizeModalOpen, setCategorizeModalOpen] = useState(false);
8969
9227
  const [confirmModalOpen, setConfirmModalOpen] = useState(false);
@@ -8983,7 +9241,8 @@ const BankTransactionsBulkActions = () => {
8983
9241
  {
8984
9242
  isOpen: categorizeModalOpen,
8985
9243
  onOpenChange: setCategorizeModalOpen,
8986
- mode: CategorizationMode.Categorize
9244
+ mode: CategorizationMode.Categorize,
9245
+ useCategorySelectDrawer
8987
9246
  }
8988
9247
  ),
8989
9248
  /* @__PURE__ */ jsx(Button, { variant: "solid", onClick: () => setConfirmModalOpen(true), children: "Confirm" }),
@@ -9008,7 +9267,8 @@ const BankTransactionsBulkActions = () => {
9008
9267
  {
9009
9268
  isOpen: recategorizeModalOpen,
9010
9269
  onOpenChange: setRecategorizeModalOpen,
9011
- mode: CategorizationMode.Recategorize
9270
+ mode: CategorizationMode.Recategorize,
9271
+ useCategorySelectDrawer
9012
9272
  }
9013
9273
  ),
9014
9274
  /* @__PURE__ */ jsx(
@@ -9028,8 +9288,8 @@ const BankTransactionsBulkActions = () => {
9028
9288
  )
9029
9289
  ] }) }) });
9030
9290
  };
9031
- const UploadCloud = (_pa) => {
9032
- var _qa = _pa, { size = 18 } = _qa, props = __objRest(_qa, ["size"]);
9291
+ const UploadCloud = (_xa) => {
9292
+ var _ya = _xa, { size = 18 } = _ya, props = __objRest(_ya, ["size"]);
9033
9293
  return /* @__PURE__ */ jsxs(
9034
9294
  "svg",
9035
9295
  __spreadProps(__spreadValues({
@@ -9411,8 +9671,8 @@ const CopyTemplateHeadersButtonGroup = ({ headers, className }) => {
9411
9671
  key
9412
9672
  )) });
9413
9673
  };
9414
- const CloseIcon = (_ra) => {
9415
- var _sa = _ra, { size = 12 } = _sa, props = __objRest(_sa, ["size"]);
9674
+ const CloseIcon = (_za) => {
9675
+ var _Aa = _za, { size = 12 } = _Aa, props = __objRest(_Aa, ["size"]);
9416
9676
  return /* @__PURE__ */ jsxs(
9417
9677
  "svg",
9418
9678
  __spreadProps(__spreadValues({
@@ -9683,15 +9943,15 @@ function useCreateCustomAccount() {
9683
9943
  }
9684
9944
  const FORM_CLASS_NAME = "Layer__UI__Form";
9685
9945
  const Form = forwardRef(
9686
- function Form2(_ta, ref) {
9687
- var _ua = _ta, { children, className } = _ua, restProps = __objRest(_ua, ["children", "className"]);
9946
+ function Form2(_Ba, ref) {
9947
+ var _Ca = _Ba, { children, className } = _Ca, restProps = __objRest(_Ca, ["children", "className"]);
9688
9948
  return /* @__PURE__ */ jsx(Form$1, __spreadProps(__spreadValues({}, restProps), { className: classNames(FORM_CLASS_NAME, className), ref, children }));
9689
9949
  }
9690
9950
  );
9691
9951
  const TEXT_FIELD_CLASS_NAME = "Layer__UI__TextField";
9692
9952
  const TextField = forwardRef(
9693
- function TextField2(_va, ref) {
9694
- var _wa = _va, { children, inline, textarea, className } = _wa, restProps = __objRest(_wa, ["children", "inline", "textarea", "className"]);
9953
+ function TextField2(_Da, ref) {
9954
+ var _Ea = _Da, { children, inline, textarea, className } = _Ea, restProps = __objRest(_Ea, ["children", "inline", "textarea", "className"]);
9695
9955
  const dataProperties = toDataProperties({ inline, textarea });
9696
9956
  return /* @__PURE__ */ jsx(TextField$1, __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), { className: classNames(TEXT_FIELD_CLASS_NAME, className), ref, children: withRenderProp(children, (node) => node) }));
9697
9957
  }
@@ -9821,8 +10081,8 @@ function formatBigDecimalToString(value, options2 = {
9821
10081
  }
9822
10082
  const INPUT_CLASS_NAME = "Layer__UI__Input";
9823
10083
  const Input$1 = forwardRef(
9824
- function Input2(_xa, ref) {
9825
- var _ya = _xa, { inset, placement } = _ya, restProps = __objRest(_ya, ["inset", "placement"]);
10084
+ function Input2(_Fa, ref) {
10085
+ var _Ga = _Fa, { inset, placement } = _Ga, restProps = __objRest(_Ga, ["inset", "placement"]);
9826
10086
  const dataProperties = toDataProperties({ inset, placement });
9827
10087
  return /* @__PURE__ */ jsx(
9828
10088
  Input$2,
@@ -9833,24 +10093,6 @@ const Input$1 = forwardRef(
9833
10093
  );
9834
10094
  }
9835
10095
  );
9836
- const INPUT_GROUP_CLASS_NAME = "Layer__InputGroup";
9837
- const InputGroup$1 = forwardRef(
9838
- function InputGroup2(_za, ref) {
9839
- var _Aa = _za, { actionCount, className, slots, children } = _Aa, restProps = __objRest(_Aa, ["actionCount", "className", "slots", "children"]);
9840
- const combinedClassName = classNames(INPUT_GROUP_CLASS_NAME, className);
9841
- const dataProperties = toDataProperties({
9842
- "action-count": actionCount
9843
- });
9844
- return /* @__PURE__ */ jsx(
9845
- Group,
9846
- __spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), {
9847
- className: combinedClassName,
9848
- ref,
9849
- children
9850
- })
9851
- );
9852
- }
9853
- );
9854
10096
  const DEFAULT_MAX_VALUE = BigDecimal.fromBigInt(BigInt(1e7));
9855
10097
  const DEFAULT_MIN_DECIMAL_PLACES = 0;
9856
10098
  const DEFAULT_MAX_DECIMAL_PLACES = 3;
@@ -9863,21 +10105,23 @@ const withForceUpdate = (value) => {
9863
10105
  writable: false
9864
10106
  });
9865
10107
  };
9866
- function FormBigDecimalField(_Ba) {
9867
- var _Ca = _Ba, {
10108
+ function FormBigDecimalField(_Ha) {
10109
+ var _Ia = _Ha, {
9868
10110
  mode = "decimal",
9869
10111
  allowNegative = false,
9870
10112
  maxValue = mode === "percent" ? BIG_DECIMAL_ONE : DEFAULT_MAX_VALUE,
9871
10113
  minDecimalPlaces = mode === "currency" ? 2 : DEFAULT_MIN_DECIMAL_PLACES,
9872
10114
  maxDecimalPlaces = mode === "currency" ? 2 : DEFAULT_MAX_DECIMAL_PLACES,
9873
- slots
9874
- } = _Ca, restProps = __objRest(_Ca, [
10115
+ slots,
10116
+ placeholder
10117
+ } = _Ia, restProps = __objRest(_Ia, [
9875
10118
  "mode",
9876
10119
  "allowNegative",
9877
10120
  "maxValue",
9878
10121
  "minDecimalPlaces",
9879
10122
  "maxDecimalPlaces",
9880
- "slots"
10123
+ "slots",
10124
+ "placeholder"
9881
10125
  ]);
9882
10126
  const field = useFieldContext();
9883
10127
  const { name, state, handleChange, handleBlur } = field;
@@ -9937,20 +10181,21 @@ function FormBigDecimalField(_Ba) {
9937
10181
  onChange: onInputChange,
9938
10182
  onBlur: onInputBlur,
9939
10183
  onBeforeInput,
9940
- onPaste
10184
+ onPaste,
10185
+ placeholder
9941
10186
  }
9942
10187
  ),
9943
10188
  (slots == null ? void 0 : slots.badge) && /* @__PURE__ */ jsx(HStack, { children: slots.badge })
9944
10189
  ] }) }));
9945
10190
  }
9946
- const CLASS_NAME$a = "Layer__Checkbox";
10191
+ const CLASS_NAME$7 = "Layer__Checkbox";
9947
10192
  const CHECK_SIZE = {
9948
10193
  sm: 12,
9949
10194
  md: 14,
9950
10195
  lg: 16
9951
10196
  };
9952
- function Checkbox(_Da) {
9953
- var _Ea = _Da, { children, className, variant = "default", size = "sm", isIndeterminate } = _Ea, props = __objRest(_Ea, ["children", "className", "variant", "size", "isIndeterminate"]);
10197
+ function Checkbox(_Ja) {
10198
+ var _Ka = _Ja, { children, className, variant = "default", size = "sm", isIndeterminate } = _Ka, props = __objRest(_Ka, ["children", "className", "variant", "size", "isIndeterminate"]);
9954
10199
  const dataProperties = useMemo(() => toDataProperties({
9955
10200
  size,
9956
10201
  variant,
@@ -9960,7 +10205,7 @@ function Checkbox(_Da) {
9960
10205
  Checkbox$1,
9961
10206
  __spreadProps(__spreadValues(__spreadValues({}, dataProperties), props), {
9962
10207
  isIndeterminate,
9963
- className: classNames(CLASS_NAME$a, className),
10208
+ className: classNames(CLASS_NAME$7, className),
9964
10209
  children: withRenderProp(children, (node) => /* @__PURE__ */ jsxs(Fragment, { children: [
9965
10210
  /* @__PURE__ */ jsx("div", { slot: "checkbox", children: isIndeterminate ? /* @__PURE__ */ jsx(Minus, { size: CHECK_SIZE[size] }) : /* @__PURE__ */ jsx(Check$1, { size: CHECK_SIZE[size] }) }),
9966
10211
  node
@@ -9968,8 +10213,8 @@ function Checkbox(_Da) {
9968
10213
  })
9969
10214
  );
9970
10215
  }
9971
- function CheckboxWithTooltip(_Fa) {
9972
- var _Ga = _Fa, { tooltip } = _Ga, props = __objRest(_Ga, ["tooltip"]);
10216
+ function CheckboxWithTooltip(_La) {
10217
+ var _Ma = _La, { tooltip } = _Ma, props = __objRest(_Ma, ["tooltip"]);
9973
10218
  return /* @__PURE__ */ jsx("div", { className: "Layer__checkbox-wrapper", children: /* @__PURE__ */ jsxs(DeprecatedTooltip, { disabled: !tooltip, children: [
9974
10219
  /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsx(Checkbox, __spreadValues({}, props)) }),
9975
10220
  /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: tooltip })
@@ -10015,8 +10260,8 @@ function FormCheckboxField({
10015
10260
  }
10016
10261
  const DATE_FIELD_CLASS_NAME = "Layer__UI__DateField";
10017
10262
  const DateField = forwardRef(
10018
- function DateField2(_Ha, ref) {
10019
- var _Ia = _Ha, { inline, className, isReadOnly } = _Ia, restProps = __objRest(_Ia, ["inline", "className", "isReadOnly"]);
10263
+ function DateField2(_Na, ref) {
10264
+ var _Oa = _Na, { inline, className, isReadOnly } = _Oa, restProps = __objRest(_Oa, ["inline", "className", "isReadOnly"]);
10020
10265
  const dataProperties = toDataProperties({ inline, readonly: isReadOnly });
10021
10266
  return /* @__PURE__ */ jsx(
10022
10267
  DateField$1,
@@ -10030,8 +10275,8 @@ const DateField = forwardRef(
10030
10275
  );
10031
10276
  const DATE_INPUT_CLASS_NAME = "Layer__UI__DateInput";
10032
10277
  const DateInput = forwardRef(
10033
- function DateInput2(_Ja, ref) {
10034
- var _Ka = _Ja, { inset, pointerEvents } = _Ka, restProps = __objRest(_Ka, ["inset", "pointerEvents"]);
10278
+ function DateInput2(_Pa, ref) {
10279
+ var _Qa = _Pa, { inset, pointerEvents } = _Qa, restProps = __objRest(_Qa, ["inset", "pointerEvents"]);
10035
10280
  const dataProperties = toDataProperties({ inset, "pointer-events": pointerEvents });
10036
10281
  return /* @__PURE__ */ jsx(
10037
10282
  DateInput$1,
@@ -10044,8 +10289,8 @@ const DateInput = forwardRef(
10044
10289
  );
10045
10290
  const DATE_SEGMENT_CLASS_NAME = "Layer__UI__DateSegment";
10046
10291
  const DateSegment = forwardRef(
10047
- function DateSegment2(_La, ref) {
10048
- var _Ma = _La, { isReadOnly } = _Ma, restProps = __objRest(_Ma, ["isReadOnly"]);
10292
+ function DateSegment2(_Ra, ref) {
10293
+ var _Sa = _Ra, { isReadOnly } = _Sa, restProps = __objRest(_Sa, ["isReadOnly"]);
10049
10294
  const dataProperties = toDataProperties({ interactive: !isReadOnly });
10050
10295
  return /* @__PURE__ */ jsx(
10051
10296
  DateSegment$1,
@@ -10126,8 +10371,8 @@ function FormDateField({
10126
10371
  }
10127
10372
  const NUMBER_FIELD_CLASS_NAME = "Layer__UI__NumberField";
10128
10373
  const NumberField = forwardRef(
10129
- function NumberField2(_Na, ref) {
10130
- var _Oa = _Na, { inline, className, isReadOnly } = _Oa, restProps = __objRest(_Oa, ["inline", "className", "isReadOnly"]);
10374
+ function NumberField2(_Ta, ref) {
10375
+ var _Ua = _Ta, { inline, className, isReadOnly } = _Ua, restProps = __objRest(_Ua, ["inline", "className", "isReadOnly"]);
10131
10376
  const dataProperties = toDataProperties({ inline, readonly: isReadOnly });
10132
10377
  return /* @__PURE__ */ jsx(
10133
10378
  NumberField$1,
@@ -10149,7 +10394,8 @@ function FormNumberField({
10149
10394
  showFieldError = true,
10150
10395
  isReadOnly = false,
10151
10396
  minValue,
10152
- maxValue
10397
+ maxValue,
10398
+ placeholder
10153
10399
  }) {
10154
10400
  const field = useFieldContext();
10155
10401
  const { name, state, handleChange, handleBlur } = field;
@@ -10187,7 +10433,7 @@ function FormNumberField({
10187
10433
  children: label
10188
10434
  })
10189
10435
  ),
10190
- /* @__PURE__ */ jsx(InputGroup$1, { slot: "input", children: /* @__PURE__ */ jsx(Input$1, { inset: true }) }),
10436
+ /* @__PURE__ */ jsx(InputGroup$1, { slot: "input", children: /* @__PURE__ */ jsx(Input$1, { inset: true, placeholder }) }),
10191
10437
  shouldShowErrorMessage && /* @__PURE__ */ jsx(FieldError, { children: errorMessage })
10192
10438
  ]
10193
10439
  })
@@ -10195,8 +10441,8 @@ function FormNumberField({
10195
10441
  }
10196
10442
  const TEXTAREA_CLASS_NAME = "Layer__UI__TextArea";
10197
10443
  const TextArea = forwardRef(
10198
- function TextArea2(_Pa, ref) {
10199
- var _Qa = _Pa, { resize = "none" } = _Qa, restProps = __objRest(_Qa, ["resize"]);
10444
+ function TextArea2(_Va, ref) {
10445
+ var _Wa = _Va, { resize = "none" } = _Wa, restProps = __objRest(_Wa, ["resize"]);
10200
10446
  const dataProperties = toDataProperties({ resize });
10201
10447
  return /* @__PURE__ */ jsx(
10202
10448
  TextArea$1,
@@ -10207,7 +10453,8 @@ const TextArea = forwardRef(
10207
10453
  );
10208
10454
  }
10209
10455
  );
10210
- function FormTextAreaField(props) {
10456
+ function FormTextAreaField(_Xa) {
10457
+ var _Ya = _Xa, { placeholder } = _Ya, props = __objRest(_Ya, ["placeholder"]);
10211
10458
  const field = useFieldContext();
10212
10459
  const { name, state, handleChange, handleBlur } = field;
10213
10460
  const { value } = state;
@@ -10222,11 +10469,13 @@ function FormTextAreaField(props) {
10222
10469
  name,
10223
10470
  value,
10224
10471
  onChange,
10225
- onBlur: handleBlur
10472
+ onBlur: handleBlur,
10473
+ placeholder
10226
10474
  }
10227
10475
  ) }));
10228
10476
  }
10229
- function FormTextField(props) {
10477
+ function FormTextField(_Za) {
10478
+ var __a = _Za, { placeholder } = __a, props = __objRest(__a, ["placeholder"]);
10230
10479
  const field = useFieldContext();
10231
10480
  const { name, state, handleChange, handleBlur } = field;
10232
10481
  const { value } = state;
@@ -10241,6 +10490,7 @@ function FormTextField(props) {
10241
10490
  value,
10242
10491
  onChange,
10243
10492
  onBlur: handleBlur,
10493
+ placeholder,
10244
10494
  inset: true
10245
10495
  }
10246
10496
  ) }) }));
@@ -10313,13 +10563,13 @@ const useCustomAccountForm = ({ onSuccess }) => {
10313
10563
  const isFormValid = useStore$1(form.store, (state) => state.isValid);
10314
10564
  return { form, submitError, isFormValid };
10315
10565
  };
10316
- const Input = (_Ra) => {
10317
- var _Sa = _Ra, {
10566
+ const Input = (_$a) => {
10567
+ var _ab = _$a, {
10318
10568
  className,
10319
10569
  isInvalid,
10320
10570
  errorMessage,
10321
10571
  leftText
10322
- } = _Sa, props = __objRest(_Sa, [
10572
+ } = _ab, props = __objRest(_ab, [
10323
10573
  "className",
10324
10574
  "isInvalid",
10325
10575
  "errorMessage",
@@ -10365,8 +10615,8 @@ const InputGroup = ({
10365
10615
  children
10366
10616
  ] });
10367
10617
  };
10368
- const ChevronDownFill = (_Ta) => {
10369
- var _Ua = _Ta, { size = 18 } = _Ua, props = __objRest(_Ua, ["size"]);
10618
+ const ChevronDownFill = (_bb) => {
10619
+ var _cb = _bb, { size = 18 } = _cb, props = __objRest(_cb, ["size"]);
10370
10620
  return /* @__PURE__ */ jsxs(
10371
10621
  "svg",
10372
10622
  __spreadProps(__spreadValues({
@@ -10435,8 +10685,8 @@ const Select = ({
10435
10685
  /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
10436
10686
  ] });
10437
10687
  };
10438
- const ErrorText = (_Va) => {
10439
- var _Wa = _Va, { className } = _Wa, props = __objRest(_Wa, ["className"]);
10688
+ const ErrorText = (_db) => {
10689
+ var _eb = _db, { className } = _eb, props = __objRest(_eb, ["className"]);
10440
10690
  return /* @__PURE__ */ jsx(Text, __spreadProps(__spreadValues({}, props), { status: "error", className }));
10441
10691
  };
10442
10692
  const accountTypeOptions = [
@@ -11269,44 +11519,10 @@ const BankTransactionsHeaderMenu = ({ actions, isDisabled }) => {
11269
11519
  isModalOpen && /* @__PURE__ */ jsx(BankTransactionsUploadModal, { isOpen: true, onOpenChange: setIsModalOpen })
11270
11520
  ] });
11271
11521
  };
11272
- const CLASS_NAME$9 = "Layer__BankTransactionsActions";
11522
+ const CLASS_NAME$6 = "Layer__BankTransactionsActions";
11273
11523
  function BankTransactionsActions({ children }) {
11274
- return /* @__PURE__ */ jsx("div", { className: CLASS_NAME$9, children });
11524
+ return /* @__PURE__ */ jsx("div", { className: CLASS_NAME$6, children });
11275
11525
  }
11276
- const X = (_Xa) => {
11277
- var _Ya = _Xa, { size = 18 } = _Ya, props = __objRest(_Ya, ["size"]);
11278
- return /* @__PURE__ */ jsxs(
11279
- "svg",
11280
- __spreadProps(__spreadValues({
11281
- xmlns: "http://www.w3.org/2000/svg",
11282
- viewBox: "0 0 18 18",
11283
- fill: "none"
11284
- }, props), {
11285
- width: size,
11286
- height: size,
11287
- children: [
11288
- /* @__PURE__ */ jsx(
11289
- "path",
11290
- {
11291
- d: "M13.5 4.5L4.5 13.5",
11292
- stroke: "currentColor",
11293
- strokeLinecap: "round",
11294
- strokeLinejoin: "round"
11295
- }
11296
- ),
11297
- /* @__PURE__ */ jsx(
11298
- "path",
11299
- {
11300
- d: "M4.5 4.5L13.5 13.5",
11301
- stroke: "currentColor",
11302
- strokeLinecap: "round",
11303
- strokeLinejoin: "round"
11304
- }
11305
- )
11306
- ]
11307
- })
11308
- );
11309
- };
11310
11526
  const BulkActionsModule = ({ slots }) => {
11311
11527
  const { count } = useCountSelectedIds();
11312
11528
  const { clearSelection } = useBulkSelectionActions();
@@ -11328,8 +11544,8 @@ const BulkActionsModule = ({ slots }) => {
11328
11544
  /* @__PURE__ */ jsx(slots.BulkActions, {})
11329
11545
  ] });
11330
11546
  };
11331
- const DownloadCloud = (_Za) => {
11332
- var __a = _Za, { size = 18 } = __a, props = __objRest(__a, ["size"]);
11547
+ const DownloadCloud = (_fb) => {
11548
+ var _gb = _fb, { size = 18 } = _gb, props = __objRest(_gb, ["size"]);
11333
11549
  return /* @__PURE__ */ jsxs(
11334
11550
  "svg",
11335
11551
  __spreadProps(__spreadValues({
@@ -11453,29 +11669,6 @@ function useSizeClass() {
11453
11669
  isDesktop: sizeClass === "desktop"
11454
11670
  };
11455
11671
  }
11456
- const ChevronDown = (_$a) => {
11457
- var _ab = _$a, { size = 18 } = _ab, props = __objRest(_ab, ["size"]);
11458
- return /* @__PURE__ */ jsx(
11459
- "svg",
11460
- __spreadProps(__spreadValues({
11461
- viewBox: "0 0 18 18",
11462
- fill: "none",
11463
- xmlns: "http://www.w3.org/2000/svg"
11464
- }, props), {
11465
- width: size,
11466
- height: size,
11467
- children: /* @__PURE__ */ jsx(
11468
- "path",
11469
- {
11470
- d: "M4.5 6.75L9 11.25L13.5 6.75",
11471
- stroke: "currentColor",
11472
- strokeLinecap: "round",
11473
- strokeLinejoin: "round"
11474
- }
11475
- )
11476
- })
11477
- );
11478
- };
11479
11672
  const MONTHS = [
11480
11673
  "January",
11481
11674
  "February",
@@ -11604,8 +11797,8 @@ function MonthCalendar({
11604
11797
  const POPOVER_CLASS_NAME = "Layer__Popover";
11605
11798
  const POPOVER_CLASS_NAMES = `Layer__Portal ${POPOVER_CLASS_NAME}`;
11606
11799
  const Popover = forwardRef(
11607
- function Popover2(_bb, ref) {
11608
- var _cb = _bb, { flexInline = false } = _cb, restProps = __objRest(_cb, ["flexInline"]);
11800
+ function Popover2(_hb, ref) {
11801
+ var _ib = _hb, { flexInline = false } = _ib, restProps = __objRest(_ib, ["flexInline"]);
11609
11802
  const dataProperties = toDataProperties({ "flex-inline": flexInline });
11610
11803
  return /* @__PURE__ */ jsx(
11611
11804
  Popover$1,
@@ -11675,42 +11868,6 @@ const MonthPicker = ({
11675
11868
  ) }) })
11676
11869
  ] });
11677
11870
  };
11678
- const CLASS_NAME$8 = "Layer__MinimalSearchField";
11679
- function MinimalSearchField(_db) {
11680
- var _eb = _db, {
11681
- placeholder,
11682
- isDisabled
11683
- } = _eb, restProps = __objRest(_eb, [
11684
- "placeholder",
11685
- "isDisabled"
11686
- ]);
11687
- return /* @__PURE__ */ jsxs(SearchField$1, __spreadProps(__spreadValues({}, restProps), { isDisabled, className: CLASS_NAME$8, children: [
11688
- /* @__PURE__ */ jsx(
11689
- Input$2,
11690
- {
11691
- slot: "input",
11692
- placeholder
11693
- }
11694
- ),
11695
- /* @__PURE__ */ jsx(Button, { slot: "clear-button", inset: true, icon: true, variant: "ghost", "aria-label": "Clear search", children: /* @__PURE__ */ jsx(X, {}) })
11696
- ] }));
11697
- }
11698
- const CLASS_NAME$7 = "Layer__SearchField";
11699
- function SearchField(_fb) {
11700
- var _gb = _fb, { slot = "search", className, label, isDisabled } = _gb, restProps = __objRest(_gb, ["slot", "className", "label", "isDisabled"]);
11701
- const combinedClassName = classNames(CLASS_NAME$7, className);
11702
- return /* @__PURE__ */ jsxs(InputGroup$1, { slot, className: combinedClassName, children: [
11703
- /* @__PURE__ */ jsx(VStack, { slot: "icon", align: "center", justify: "center", className: "Layer__SearchField__Icon", "data-disabled": isDisabled || void 0, children: /* @__PURE__ */ jsx(Search, { size: 14 }) }),
11704
- /* @__PURE__ */ jsx(
11705
- MinimalSearchField,
11706
- __spreadProps(__spreadValues({}, restProps), {
11707
- placeholder: label,
11708
- "aria-label": label,
11709
- isDisabled
11710
- })
11711
- )
11712
- ] });
11713
- }
11714
11871
  const SmallLoader = ({ size = 28 }) => {
11715
11872
  return /* @__PURE__ */ jsx(
11716
11873
  "span",
@@ -11953,7 +12110,7 @@ function useInvisibleDownload() {
11953
12110
  }, []);
11954
12111
  return { invisibleDownloadRef, triggerInvisibleDownload };
11955
12112
  }
11956
- const CLASS_NAME$6 = "Layer__InvisibleDownload";
12113
+ const CLASS_NAME$5 = "Layer__InvisibleDownload";
11957
12114
  const InvisibleDownload = forwardRef((_props, ref) => {
11958
12115
  const internalRef = useRef(null);
11959
12116
  useImperativeHandle(ref, () => ({
@@ -11972,7 +12129,7 @@ const InvisibleDownload = forwardRef((_props, ref) => {
11972
12129
  const handleContainClick = useCallback((event) => {
11973
12130
  event.stopPropagation();
11974
12131
  }, []);
11975
- return /* @__PURE__ */ jsx("a", { download: true, className: CLASS_NAME$6, ref: internalRef, onClick: handleContainClick });
12132
+ return /* @__PURE__ */ jsx("a", { download: true, className: CLASS_NAME$5, ref: internalRef, onClick: handleContainClick });
11976
12133
  });
11977
12134
  InvisibleDownload.displayName = "InvisibleDownload";
11978
12135
  function TransactionsSearch({ slot, isDisabled }) {
@@ -12119,6 +12276,9 @@ const BankTransactionsHeader = ({
12119
12276
  }
12120
12277
  return actions;
12121
12278
  }, [withUploadMenu, showCategorizationRules]);
12279
+ const BulkActionsModuleSlot = useCallback(() => {
12280
+ return /* @__PURE__ */ jsx(BankTransactionsBulkActions, { useCategorySelectDrawer: listView && mobileComponent === "mobileList" });
12281
+ }, [listView, mobileComponent]);
12122
12282
  return /* @__PURE__ */ jsxs(
12123
12283
  Header$1,
12124
12284
  {
@@ -12134,7 +12294,7 @@ const BankTransactionsHeader = ({
12134
12294
  showBulkActions ? /* @__PURE__ */ jsx(
12135
12295
  BulkActionsModule,
12136
12296
  {
12137
- slots: { BulkActions: BankTransactionsBulkActions }
12297
+ slots: { BulkActions: BulkActionsModuleSlot }
12138
12298
  }
12139
12299
  ) : /* @__PURE__ */ jsxs(HStack, { slot: "toggle", justify: "center", gap: "xs", children: [
12140
12300
  collapseHeader && headerTopRow,
@@ -12169,8 +12329,8 @@ const BankTransactionsHeader = ({
12169
12329
  }
12170
12330
  );
12171
12331
  };
12172
- const Inbox = (_hb) => {
12173
- var _ib = _hb, { size = 18 } = _ib, props = __objRest(_ib, ["size"]);
12332
+ const Inbox = (_jb) => {
12333
+ var _kb = _jb, { size = 18 } = _kb, props = __objRest(_kb, ["size"]);
12174
12334
  return /* @__PURE__ */ jsxs(
12175
12335
  "svg",
12176
12336
  __spreadProps(__spreadValues({
@@ -12652,8 +12812,8 @@ function asMutable(a) {
12652
12812
  const CSS_PREFIX$1 = "Layer__UI__Table";
12653
12813
  const getClassName = (component, additionalClassNames, withHidden) => classNames(`${CSS_PREFIX$1}-${component}`, withHidden && `${CSS_PREFIX$1}-${component}--hidden`, additionalClassNames);
12654
12814
  const Table$1 = forwardRef(
12655
- (_jb, ref) => {
12656
- var _kb = _jb, { children, className } = _kb, restProps = __objRest(_kb, ["children", "className"]);
12815
+ (_lb, ref) => {
12816
+ var _mb = _lb, { children, className } = _mb, restProps = __objRest(_mb, ["children", "className"]);
12657
12817
  return /* @__PURE__ */ jsx(
12658
12818
  Table$2,
12659
12819
  __spreadProps(__spreadValues({
@@ -12666,8 +12826,8 @@ const Table$1 = forwardRef(
12666
12826
  }
12667
12827
  );
12668
12828
  Table$1.displayName = "Table";
12669
- const TableHeaderInner = (_lb, ref) => {
12670
- var _mb = _lb, { children, className, hideHeader } = _mb, restProps = __objRest(_mb, ["children", "className", "hideHeader"]);
12829
+ const TableHeaderInner = (_nb, ref) => {
12830
+ var _ob = _nb, { children, className, hideHeader } = _ob, restProps = __objRest(_ob, ["children", "className", "hideHeader"]);
12671
12831
  return /* @__PURE__ */ jsx(
12672
12832
  TableHeader$1,
12673
12833
  __spreadProps(__spreadValues({
@@ -12680,8 +12840,8 @@ const TableHeaderInner = (_lb, ref) => {
12680
12840
  };
12681
12841
  const TableHeader = forwardRef(TableHeaderInner);
12682
12842
  TableHeader.displayName = "TableHeader";
12683
- const TableBodyInner = (_nb, ref) => {
12684
- var _ob = _nb, { children, className } = _ob, restProps = __objRest(_ob, ["children", "className"]);
12843
+ const TableBodyInner = (_pb, ref) => {
12844
+ var _qb = _pb, { children, className } = _qb, restProps = __objRest(_qb, ["children", "className"]);
12685
12845
  return /* @__PURE__ */ jsx(
12686
12846
  TableBody$2,
12687
12847
  __spreadProps(__spreadValues({
@@ -12694,8 +12854,8 @@ const TableBodyInner = (_nb, ref) => {
12694
12854
  };
12695
12855
  const TableBody$1 = forwardRef(TableBodyInner);
12696
12856
  TableBody$1.displayName = "TableBody";
12697
- const RowInner = (_pb, ref) => {
12698
- var _qb = _pb, { children, className, depth = 0 } = _qb, restProps = __objRest(_qb, ["children", "className", "depth"]);
12857
+ const RowInner = (_rb, ref) => {
12858
+ var _sb = _rb, { children, className, depth = 0 } = _sb, restProps = __objRest(_sb, ["children", "className", "depth"]);
12699
12859
  const dataProperties = toDataProperties({ depth });
12700
12860
  return /* @__PURE__ */ jsx(
12701
12861
  Row$1,
@@ -12710,8 +12870,8 @@ const RowInner = (_pb, ref) => {
12710
12870
  const Row = forwardRef(RowInner);
12711
12871
  Row.displayName = "Row";
12712
12872
  const Column = forwardRef(
12713
- (_rb, ref) => {
12714
- var _sb = _rb, { children, className, textAlign = "left" } = _sb, restProps = __objRest(_sb, ["children", "className", "textAlign"]);
12873
+ (_tb, ref) => {
12874
+ var _ub = _tb, { children, className, textAlign = "left" } = _ub, restProps = __objRest(_ub, ["children", "className", "textAlign"]);
12715
12875
  const dataProperties = toDataProperties({ "text-align": textAlign });
12716
12876
  return /* @__PURE__ */ jsx(
12717
12877
  Column$1,
@@ -12726,8 +12886,8 @@ const Column = forwardRef(
12726
12886
  );
12727
12887
  Column.displayName = "Column";
12728
12888
  const Cell = forwardRef(
12729
- (_tb, ref) => {
12730
- var _ub = _tb, { children, className } = _ub, restProps = __objRest(_ub, ["children", "className"]);
12889
+ (_vb, ref) => {
12890
+ var _wb = _vb, { children, className } = _wb, restProps = __objRest(_wb, ["children", "className"]);
12731
12891
  return /* @__PURE__ */ jsx(
12732
12892
  Cell$1,
12733
12893
  __spreadProps(__spreadValues({
@@ -13104,8 +13264,8 @@ function useDelayedVisibility({
13104
13264
  );
13105
13265
  return { isVisible };
13106
13266
  }
13107
- const File = (_vb) => {
13108
- var _wb = _vb, { size = 12 } = _wb, props = __objRest(_wb, ["size"]);
13267
+ const File = (_xb) => {
13268
+ var _yb = _xb, { size = 12 } = _yb, props = __objRest(_yb, ["size"]);
13109
13269
  return /* @__PURE__ */ jsxs(
13110
13270
  "svg",
13111
13271
  __spreadProps(__spreadValues({
@@ -13165,6 +13325,57 @@ const File = (_vb) => {
13165
13325
  })
13166
13326
  );
13167
13327
  };
13328
+ const variants = {
13329
+ fade: {
13330
+ initial: { opacity: 0 },
13331
+ animate: { opacity: 1 },
13332
+ exit: { opacity: 0 },
13333
+ transition: { duration: 0.3, ease: [0, 0, 0.58, 1] }
13334
+ },
13335
+ slideUp: {
13336
+ initial: { y: "100%" },
13337
+ animate: { y: 0 },
13338
+ exit: { y: "100%" },
13339
+ transition: { duration: 0.35, ease: [0.4, 0, 0.2, 1] }
13340
+ },
13341
+ expand: {
13342
+ initial: { height: 0, opacity: 0 },
13343
+ animate: { height: "auto", opacity: 1 },
13344
+ exit: { height: 0, opacity: 0 },
13345
+ transition: {
13346
+ height: { duration: 0.25, ease: [0.4, 0, 0.2, 1] },
13347
+ opacity: { duration: 0.15, ease: [0, 0, 0.58, 1] }
13348
+ }
13349
+ }
13350
+ };
13351
+ const AnimatedPresenceDiv = (_zb) => {
13352
+ var _Ab = _zb, {
13353
+ children,
13354
+ variant,
13355
+ isOpen,
13356
+ slotProps = { AnimatePresence: { initial: false } },
13357
+ key
13358
+ } = _Ab, props = __objRest(_Ab, [
13359
+ "children",
13360
+ "variant",
13361
+ "isOpen",
13362
+ "slotProps",
13363
+ "key"
13364
+ ]);
13365
+ const config = variants[variant];
13366
+ return /* @__PURE__ */ jsx(AnimatePresence, __spreadProps(__spreadValues({}, slotProps.AnimatePresence), { children: isOpen && /* @__PURE__ */ jsx(
13367
+ motion.div,
13368
+ __spreadProps(__spreadValues({
13369
+ initial: config.initial,
13370
+ animate: config.animate,
13371
+ exit: config.exit,
13372
+ transition: config.transition
13373
+ }, props), {
13374
+ children
13375
+ }),
13376
+ key
13377
+ ) }));
13378
+ };
13168
13379
  function isActiveBookkeepingStatus(status) {
13169
13380
  return status === BookkeepingStatus$2.ACTIVE || status === BookkeepingStatus$2.ONBOARDING;
13170
13381
  }
@@ -13264,29 +13475,8 @@ function useBookkeepingPeriods() {
13264
13475
  }
13265
13476
  });
13266
13477
  }
13267
- const monthNames = [
13268
- "January",
13269
- "February",
13270
- "March",
13271
- "April",
13272
- "May",
13273
- "June",
13274
- "July",
13275
- "August",
13276
- "September",
13277
- "October",
13278
- "November",
13279
- "December"
13280
- ];
13281
- const getMonthNameFromNumber = (monthNumber) => {
13282
- var _a;
13283
- if (monthNumber < 1 || monthNumber > 12) {
13284
- return "";
13285
- }
13286
- return (_a = monthNames.at(monthNumber - 1)) != null ? _a : "";
13287
- };
13288
- const Clock = (_xb) => {
13289
- var _yb = _xb, { size = 18 } = _yb, props = __objRest(_yb, ["size"]);
13478
+ const Clock = (_Bb) => {
13479
+ var _Cb = _Bb, { size = 18 } = _Cb, props = __objRest(_Cb, ["size"]);
13290
13480
  return /* @__PURE__ */ jsxs(
13291
13481
  "svg",
13292
13482
  __spreadProps(__spreadValues({
@@ -13311,6 +13501,27 @@ const Clock = (_xb) => {
13311
13501
  })
13312
13502
  );
13313
13503
  };
13504
+ const monthNames = [
13505
+ "January",
13506
+ "February",
13507
+ "March",
13508
+ "April",
13509
+ "May",
13510
+ "June",
13511
+ "July",
13512
+ "August",
13513
+ "September",
13514
+ "October",
13515
+ "November",
13516
+ "December"
13517
+ ];
13518
+ const getMonthNameFromNumber = (monthNumber) => {
13519
+ var _a;
13520
+ if (monthNumber < 1 || monthNumber > 12) {
13521
+ return "";
13522
+ }
13523
+ return (_a = monthNames.at(monthNumber - 1)) != null ? _a : "";
13524
+ };
13314
13525
  function getBookkeepingStatusConfig({
13315
13526
  status,
13316
13527
  monthNumber,
@@ -13379,10 +13590,24 @@ const BookkeepingStatus$1 = ({ status, text, monthNumber, iconOnly }) => {
13379
13590
  )
13380
13591
  ] }));
13381
13592
  };
13382
- const BankTransactionsProcessingInfo = () => /* @__PURE__ */ jsxs(DeprecatedTooltip, { offset: 12, children: [
13383
- /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsx(BookkeepingStatus$1, { status: BookkeepingPeriodStatus.IN_PROGRESS_AWAITING_BOOKKEEPER, text: "Processing" }) }),
13384
- /* @__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." })
13385
- ] });
13593
+ const BankTransactionsProcessingInfo = ({ showAsBadge = false }) => {
13594
+ const tooltipContent = "Our team will review and categorize this transaction. We'll reach out if we have any questions about it.";
13595
+ if (showAsBadge) {
13596
+ return /* @__PURE__ */ jsx(HStack, { gap: "xs", align: "center", fluid: true, className: "Layer__BankTransactionsProcessingInfo", children: /* @__PURE__ */ jsx(
13597
+ Badge,
13598
+ {
13599
+ size: BadgeSize.SMALL,
13600
+ icon: /* @__PURE__ */ jsx(Clock, { size: 11 }),
13601
+ variant: BadgeVariant.INFO,
13602
+ children: "Processing"
13603
+ }
13604
+ ) });
13605
+ }
13606
+ return /* @__PURE__ */ jsxs(DeprecatedTooltip, { offset: 12, children: [
13607
+ /* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsx(BookkeepingStatus$1, { status: BookkeepingPeriodStatus.IN_PROGRESS_AWAITING_BOOKKEEPER, text: "Processing" }) }),
13608
+ /* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", width: "md", children: tooltipContent })
13609
+ ] });
13610
+ };
13386
13611
  const isSplitsValid = (localSplits) => {
13387
13612
  return validateSplit(localSplits).reduce((acc, splitError) => acc && splitError === void 0, true);
13388
13613
  };
@@ -13577,8 +13802,8 @@ const useSplitsForm = ({
13577
13802
  saveLocalSplitsToCategoryStore
13578
13803
  };
13579
13804
  };
13580
- const ScissorsFullOpen = (_zb) => {
13581
- var _Ab = _zb, { size = 12 } = _Ab, props = __objRest(_Ab, ["size"]);
13805
+ const ScissorsFullOpen = (_Db) => {
13806
+ var _Eb = _Db, { size = 12 } = _Eb, props = __objRest(_Eb, ["size"]);
13582
13807
  return /* @__PURE__ */ jsx(
13583
13808
  "svg",
13584
13809
  __spreadProps(__spreadValues({
@@ -13643,8 +13868,8 @@ const ScissorsFullOpen = (_zb) => {
13643
13868
  })
13644
13869
  );
13645
13870
  };
13646
- const Trash = (_Bb) => {
13647
- var _Cb = _Bb, { size = 18 } = _Cb, props = __objRest(_Cb, ["size"]);
13871
+ const Trash = (_Fb) => {
13872
+ var _Gb = _Fb, { size = 18 } = _Gb, props = __objRest(_Gb, ["size"]);
13648
13873
  return /* @__PURE__ */ jsxs(
13649
13874
  "svg",
13650
13875
  __spreadProps(__spreadValues({
@@ -13839,8 +14064,8 @@ const ReceiptsProvider = ({
13839
14064
  const contextData = useReceipts({ bankTransaction, isActive });
13840
14065
  return /* @__PURE__ */ jsx(ReceiptsContext.Provider, { value: contextData, children });
13841
14066
  };
13842
- const Eye = (_Db) => {
13843
- var _Eb = _Db, { size = 18 } = _Eb, props = __objRest(_Eb, ["size"]);
14067
+ const Eye = (_Hb) => {
14068
+ var _Ib = _Hb, { size = 18 } = _Ib, props = __objRest(_Ib, ["size"]);
13844
14069
  return /* @__PURE__ */ jsx(
13845
14070
  "svg",
13846
14071
  __spreadProps(__spreadValues({
@@ -13976,11 +14201,11 @@ const FileThumb = ({
13976
14201
  }
13977
14202
  );
13978
14203
  };
13979
- const TextButton = (_Fb) => {
13980
- var _Gb = _Fb, {
14204
+ const TextButton = (_Jb) => {
14205
+ var _Kb = _Jb, {
13981
14206
  className,
13982
14207
  children
13983
- } = _Gb, props = __objRest(_Gb, [
14208
+ } = _Kb, props = __objRest(_Kb, [
13984
14209
  "className",
13985
14210
  "children"
13986
14211
  ]);
@@ -14064,8 +14289,8 @@ const openReceiptInNewTab = (url, index) => (e) => {
14064
14289
  `);
14065
14290
  }
14066
14291
  };
14067
- const BankTransactionReceiptsWithProvider = forwardRef((_Hb, ref) => {
14068
- var _Ib = _Hb, { bankTransaction, isActive } = _Ib, props = __objRest(_Ib, ["bankTransaction", "isActive"]);
14292
+ const BankTransactionReceiptsWithProvider = forwardRef((_Lb, ref) => {
14293
+ var _Mb = _Lb, { bankTransaction, isActive } = _Mb, props = __objRest(_Mb, ["bankTransaction", "isActive"]);
14069
14294
  return /* @__PURE__ */ jsx(ReceiptsProvider, { bankTransaction, isActive, children: /* @__PURE__ */ jsx(BankTransactionReceipts, __spreadProps(__spreadValues({}, props), { ref })) });
14070
14295
  });
14071
14296
  BankTransactionReceiptsWithProvider.displayName = "BankTransactionReceiptsWithProvider";
@@ -14232,8 +14457,8 @@ const transformCurrencyValue = (rawValue) => {
14232
14457
  }
14233
14458
  return cleaned;
14234
14459
  };
14235
- const AmountInput = (_Jb) => {
14236
- var _Kb = _Jb, {
14460
+ const AmountInput = (_Nb) => {
14461
+ var _Ob = _Nb, {
14237
14462
  onChange,
14238
14463
  className,
14239
14464
  leftText,
@@ -14241,7 +14466,7 @@ const AmountInput = (_Jb) => {
14241
14466
  isInvalid,
14242
14467
  badge,
14243
14468
  placeholder = "$0.00"
14244
- } = _Kb, props = __objRest(_Kb, [
14469
+ } = _Ob, props = __objRest(_Ob, [
14245
14470
  "onChange",
14246
14471
  "className",
14247
14472
  "leftText",
@@ -14517,12 +14742,12 @@ const useBankTransactionMemo = ({ bankTransactionId }) => {
14517
14742
  });
14518
14743
  return form;
14519
14744
  };
14520
- const Textarea = (_Lb) => {
14521
- var _Mb = _Lb, {
14745
+ const Textarea = (_Pb) => {
14746
+ var _Qb = _Pb, {
14522
14747
  className,
14523
14748
  isInvalid,
14524
14749
  errorMessage
14525
- } = _Mb, props = __objRest(_Mb, [
14750
+ } = _Qb, props = __objRest(_Qb, [
14526
14751
  "className",
14527
14752
  "isInvalid",
14528
14753
  "errorMessage"
@@ -16074,7 +16299,6 @@ const extractDescriptionForSplit = (category) => {
16074
16299
  }
16075
16300
  return category.entries.map((c) => c.category.display_name).join(", ");
16076
16301
  };
16077
- let clickTimer = Date.now();
16078
16302
  const BankTransactionRow = ({
16079
16303
  index,
16080
16304
  editable,
@@ -16094,10 +16318,10 @@ const BankTransactionRow = ({
16094
16318
  const [showRetry, setShowRetry] = useState(false);
16095
16319
  const { shouldHideAfterCategorize } = useBankTransactionsContext();
16096
16320
  const [open, setOpen] = useState(false);
16097
- const toggleOpen = () => {
16321
+ const toggleOpen = useCallback(() => {
16098
16322
  setShowRetry(false);
16099
16323
  setOpen(!open);
16100
- };
16324
+ }, [open]);
16101
16325
  const bookkeepingStatus = useEffectiveBookkeepingStatus();
16102
16326
  const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
16103
16327
  const categorized = isCategorized(bankTransaction);
@@ -16130,16 +16354,12 @@ const BankTransactionRow = ({
16130
16354
  deselect(bankTransaction.id);
16131
16355
  setOpen(false);
16132
16356
  });
16133
- const openRow = {
16134
- onMouseDown: () => {
16135
- clickTimer = Date.now();
16136
- },
16137
- onMouseUp: () => {
16138
- if (Date.now() - clickTimer < 100 && !open) {
16139
- setShowRetry(false);
16140
- setOpen(true);
16141
- }
16142
- }
16357
+ const handleRowClick = () => {
16358
+ setShowRetry(false);
16359
+ toggleOpen();
16360
+ };
16361
+ const preventRowExpansion = (e) => {
16362
+ e.stopPropagation();
16143
16363
  };
16144
16364
  const className = "Layer__bank-transaction-row";
16145
16365
  const openClassName = open ? `${className}--expanded` : "";
@@ -16156,8 +16376,8 @@ const BankTransactionRow = ({
16156
16376
  );
16157
16377
  const colSpan = categorizationEnabled ? 7 : 6;
16158
16378
  return /* @__PURE__ */ jsxs(Fragment, { children: [
16159
- /* @__PURE__ */ jsxs("tr", { className: rowClassName, children: [
16160
- categorizationEnabled && /* @__PURE__ */ jsx("td", { className: "Layer__table-cell Layer__bank-transactions__checkbox-col", children: /* @__PURE__ */ jsx("span", { className: "Layer__table-cell-content", children: /* @__PURE__ */ jsx(
16379
+ /* @__PURE__ */ jsxs("tr", { className: rowClassName, onClick: handleRowClick, children: [
16380
+ categorizationEnabled && /* @__PURE__ */ jsx("td", { className: "Layer__table-cell Layer__bank-transactions__checkbox-col", onClick: preventRowExpansion, children: /* @__PURE__ */ jsx("span", { className: "Layer__table-cell-content", children: /* @__PURE__ */ jsx(
16161
16381
  Checkbox,
16162
16382
  {
16163
16383
  isSelected: isTransactionSelected,
@@ -16172,25 +16392,22 @@ const BankTransactionRow = ({
16172
16392
  ) }) }),
16173
16393
  /* @__PURE__ */ jsx(
16174
16394
  "td",
16175
- __spreadProps(__spreadValues({
16176
- className: "Layer__table-cell Layer__bank-transaction-table__date-col"
16177
- }, openRow), {
16395
+ {
16396
+ className: "Layer__table-cell Layer__bank-transaction-table__date-col",
16178
16397
  children: /* @__PURE__ */ jsx("span", { className: "Layer__table-cell-content", children: /* @__PURE__ */ jsx(Span, { children: format(parseISO(bankTransaction.date), dateFormat) }) })
16179
- })
16398
+ }
16180
16399
  ),
16181
16400
  /* @__PURE__ */ jsx(
16182
16401
  "td",
16183
- __spreadProps(__spreadValues({
16184
- className: "Layer__table-cell Layer__bank-transactions__tx-col"
16185
- }, openRow), {
16402
+ {
16403
+ className: "Layer__table-cell Layer__bank-transactions__tx-col",
16186
16404
  children: /* @__PURE__ */ jsx("span", { className: "Layer__table-cell-content", children: /* @__PURE__ */ jsx(Span, { withTooltip: true, children: (_a = bankTransaction.counterparty_name) != null ? _a : bankTransaction.description }) })
16187
- })
16405
+ }
16188
16406
  ),
16189
16407
  /* @__PURE__ */ jsx(
16190
16408
  "td",
16191
- __spreadProps(__spreadValues({
16192
- className: "Layer__table-cell Layer__bank-transactions__account-col"
16193
- }, openRow), {
16409
+ {
16410
+ className: "Layer__table-cell Layer__bank-transactions__account-col",
16194
16411
  children: /* @__PURE__ */ jsx("span", { className: "Layer__table-cell-content", children: /* @__PURE__ */ jsxs(VStack, { align: "start", children: [
16195
16412
  /* @__PURE__ */ jsxs(Span, { ellipsis: true, children: [
16196
16413
  bankTransaction.account_name,
@@ -16198,13 +16415,13 @@ const BankTransactionRow = ({
16198
16415
  ] }),
16199
16416
  ((_b = bankTransaction.account_institution) == null ? void 0 : _b.name) && /* @__PURE__ */ jsx(Span, { ellipsis: true, variant: "subtle", size: "sm", children: bankTransaction.account_institution.name })
16200
16417
  ] }) })
16201
- })
16418
+ }
16202
16419
  ),
16203
16420
  /* @__PURE__ */ jsx(
16204
16421
  "td",
16205
- __spreadProps(__spreadValues(__spreadValues({
16422
+ __spreadProps(__spreadValues({
16206
16423
  className: `Layer__table-cell Layer__table-cell__amount-col Layer__bank-transactions__amount-col Layer__table-cell--amount ${className}__table-cell--amount-${isCredit(bankTransaction) ? "credit" : "debit"}`
16207
- }, openRow), showReceiptDataProperties), {
16424
+ }, showReceiptDataProperties), {
16208
16425
  children: /* @__PURE__ */ jsx(VStack, { align: "end", children: /* @__PURE__ */ jsx(
16209
16426
  MoneySpan,
16210
16427
  {
@@ -16232,6 +16449,7 @@ const BankTransactionRow = ({
16232
16449
  `${className}__actions-cell`,
16233
16450
  `${className}__actions-cell--${open ? "open" : "close"}`
16234
16451
  ),
16452
+ onClick: preventRowExpansion,
16235
16453
  children: open ? /* @__PURE__ */ jsxs(HStack, { pie: "md", gap: "md", justify: "end", className: "Layer__bank-transaction-row__category-open", children: [
16236
16454
  bankTransaction.error && /* @__PURE__ */ jsxs(
16237
16455
  Text,
@@ -16495,6 +16713,9 @@ const BankTransactionsListItem = ({
16495
16713
  const handleSave = () => {
16496
16714
  void save();
16497
16715
  };
16716
+ const preventRowExpansion = (e) => {
16717
+ e.stopPropagation();
16718
+ };
16498
16719
  const openClassName = openExpandedRow ? "Layer__bank-transaction-list-item--expanded" : "";
16499
16720
  const rowClassName = classNames(
16500
16721
  "Layer__bank-transaction-list-item",
@@ -16502,7 +16723,7 @@ const BankTransactionsListItem = ({
16502
16723
  openExpandedRow ? openClassName : "",
16503
16724
  isVisible ? "show" : ""
16504
16725
  );
16505
- return /* @__PURE__ */ jsxs("li", { className: rowClassName, children: [
16726
+ return /* @__PURE__ */ jsxs("li", { className: rowClassName, onClick: toggleExpandedRow, children: [
16506
16727
  /* @__PURE__ */ jsxs("span", { className: "Layer__bank-transaction-list-item__heading", children: [
16507
16728
  /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transaction-list-item__heading__main", children: [
16508
16729
  /* @__PURE__ */ jsx(Span, { ellipsis: true, size: "sm", children: format(parseISO(bankTransaction.date), dateFormat) }),
@@ -16533,7 +16754,7 @@ const BankTransactionsListItem = ({
16533
16754
  ] }),
16534
16755
  /* @__PURE__ */ jsxs(HStack, { className: "Layer__bank-transaction-list-item__body", children: [
16535
16756
  /* @__PURE__ */ jsxs(HStack, { gap: "sm", className: "Layer__bank-transaction-list-item__body__name", children: [
16536
- categorizationEnabled && /* @__PURE__ */ jsx("div", { className: "Layer__bank-transaction-list-item__checkbox", children: /* @__PURE__ */ jsx(
16757
+ categorizationEnabled && /* @__PURE__ */ jsx("div", { className: "Layer__bank-transaction-list-item__checkbox", onClick: preventRowExpansion, children: /* @__PURE__ */ jsx(
16537
16758
  Checkbox,
16538
16759
  {
16539
16760
  isSelected: isTransactionSelected,
@@ -16558,7 +16779,7 @@ const BankTransactionsListItem = ({
16558
16779
  )
16559
16780
  ] }),
16560
16781
  !categorizationEnabled && !categorized && /* @__PURE__ */ jsx("span", { className: "Layer__bank-transaction-list-item__processing-info", children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }),
16561
- /* @__PURE__ */ jsx("span", { className: "Layer__bank-transaction-list-item__expanded-row", children: /* @__PURE__ */ jsx(AnimatedPresenceDiv, { variant: "expand", isOpen: openExpandedRow, children: /* @__PURE__ */ jsx(
16782
+ /* @__PURE__ */ jsx("span", { className: "Layer__bank-transaction-list-item__expanded-row", onClick: preventRowExpansion, children: /* @__PURE__ */ jsx(AnimatedPresenceDiv, { variant: "expand", isOpen: openExpandedRow, children: /* @__PURE__ */ jsx(
16562
16783
  ExpandedBankTransactionRow,
16563
16784
  {
16564
16785
  ref: expandedRowRef,
@@ -16575,7 +16796,7 @@ const BankTransactionsListItem = ({
16575
16796
  variant: "list"
16576
16797
  }
16577
16798
  ) }, `expanded-${bankTransaction.id}`) }),
16578
- !openExpandedRow && categorizationEnabled && !categorized && /* @__PURE__ */ jsxs(HStack, { pi: "md", gap: "md", pb: "md", children: [
16799
+ !openExpandedRow && categorizationEnabled && !categorized && /* @__PURE__ */ jsx("div", { onClick: preventRowExpansion, children: /* @__PURE__ */ jsxs(HStack, { pi: "md", gap: "md", pb: "md", children: [
16579
16800
  /* @__PURE__ */ jsx(
16580
16801
  BankTransactionCategoryComboBox,
16581
16802
  {
@@ -16601,7 +16822,7 @@ const BankTransactionsListItem = ({
16601
16822
  children: showRetry ? "Retry" : !categorized ? (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Approve" : (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update"
16602
16823
  }
16603
16824
  )
16604
- ] }),
16825
+ ] }) }),
16605
16826
  !openExpandedRow && categorized && /* @__PURE__ */ jsx(
16606
16827
  BankTransactionsListItemCategory,
16607
16828
  {
@@ -16669,10 +16890,10 @@ const BankTransactionsList = ({
16669
16890
  ] });
16670
16891
  };
16671
16892
  const SWITCH_CLASS_NAME = "Layer__Switch";
16672
- const Switch = forwardRef((_Nb, ref) => {
16673
- var _Ob = _Nb, {
16893
+ const Switch = forwardRef((_Rb, ref) => {
16894
+ var _Sb = _Rb, {
16674
16895
  children
16675
- } = _Ob, props = __objRest(_Ob, [
16896
+ } = _Sb, props = __objRest(_Sb, [
16676
16897
  "children"
16677
16898
  ]);
16678
16899
  return /* @__PURE__ */ jsx(
@@ -16811,8 +17032,8 @@ const BankTransactionsMobileListItemCheckbox = ({
16811
17032
  }
16812
17033
  ) });
16813
17034
  };
16814
- const Paperclip = (_Pb) => {
16815
- var _Qb = _Pb, { size = 20 } = _Qb, props = __objRest(_Qb, ["size"]);
17035
+ const Paperclip = (_Tb) => {
17036
+ var _Ub = _Tb, { size = 20 } = _Ub, props = __objRest(_Ub, ["size"]);
16816
17037
  return /* @__PURE__ */ jsx(
16817
17038
  "svg",
16818
17039
  __spreadProps(__spreadValues({
@@ -16901,168 +17122,6 @@ const BusinessFormMobile = ({
16901
17122
  )
16902
17123
  ] });
16903
17124
  };
16904
- const ActionableList = ({
16905
- options: options2,
16906
- onClick,
16907
- selectedId,
16908
- showDescriptions = false,
16909
- className
16910
- }) => {
16911
- return /* @__PURE__ */ jsx("ul", { className: classNames("Layer__actionable-list", className), children: options2.map((x, idx) => /* @__PURE__ */ jsxs(
16912
- "li",
16913
- {
16914
- role: "button",
16915
- onClick: () => onClick(x),
16916
- className: classNames(
16917
- x.secondary && "Layer__actionable-list-item--secondary",
16918
- x.asLink && "Layer__actionable-list-item--as-link",
16919
- selectedId === x.id && "Layer__actionable-list__item--selected"
16920
- ),
16921
- children: [
16922
- /* @__PURE__ */ jsxs("div", { className: "Layer__actionable-list__content", children: [
16923
- /* @__PURE__ */ jsx(Text, { size: TextSize.sm, children: x.label }),
16924
- /* TODO: Replace 'See all categories' with something more generic */
16925
- showDescriptions && x.description && x.label !== "See all categories" && /* @__PURE__ */ jsx(
16926
- Text,
16927
- {
16928
- className: "Layer__actionable-list__content-description",
16929
- size: TextSize.sm,
16930
- children: x.description
16931
- }
16932
- )
16933
- ] }),
16934
- !x.asLink && selectedId && selectedId === x.id ? /* @__PURE__ */ jsx("span", { className: "Layer__actionable-list__select Layer__actionable-list__select--selected", children: /* @__PURE__ */ jsx(
16935
- Check,
16936
- {
16937
- size: 14,
16938
- className: "Layer__actionable-list__selected-icon"
16939
- }
16940
- ) }) : null,
16941
- !x.asLink && (!selectedId || selectedId !== x.id) ? /* @__PURE__ */ jsx("span", { className: "Layer__actionable-list__select" }) : null,
16942
- x.asLink && /* @__PURE__ */ jsx(
16943
- ChevronRight,
16944
- {
16945
- size: 16,
16946
- className: "Layer__actionable-list__link-icon"
16947
- }
16948
- )
16949
- ]
16950
- },
16951
- `actionable-list-item-${idx}`
16952
- )) });
16953
- };
16954
- function getLeafCategories(category) {
16955
- if (!category.subCategories || category.subCategories.length === 0) {
16956
- return [category];
16957
- }
16958
- return category.subCategories.flatMap((subCategory) => getLeafCategories(subCategory));
16959
- }
16960
- const flattenCategories = (categories) => {
16961
- return categories.flatMap((category) => {
16962
- const subCategories = category.subCategories;
16963
- if (!subCategories || subCategories.length === 0) {
16964
- return [new CategoryAsOption(category)];
16965
- }
16966
- const leafCategories = getLeafCategories(category);
16967
- if (subCategories.every((subCategory) => !subCategory.subCategories || subCategory.subCategories.length === 0)) {
16968
- return [{
16969
- label: category.displayName,
16970
- id: "id" in category ? category.id : category.stableName,
16971
- categories: leafCategories.map((cat) => new CategoryAsOption(cat))
16972
- }];
16973
- }
16974
- return leafCategories.map((cat) => new CategoryAsOption(cat));
16975
- });
16976
- };
16977
- const isGroup = (item) => {
16978
- return "categories" in item;
16979
- };
16980
- const BankTransactionsMobileListBusinessCategories = ({
16981
- select,
16982
- selectedId,
16983
- showTooltips
16984
- }) => {
16985
- const { data: categories } = useCategories();
16986
- const [query, setQuery] = useState("");
16987
- const categoryOptions = useMemo(
16988
- () => flattenCategories(
16989
- (categories != null ? categories : []).filter((category) => category.type != "ExclusionNested")
16990
- ),
16991
- [categories]
16992
- );
16993
- const [optionsToShow, setOptionsToShow] = useState(categoryOptions);
16994
- const [selectedGroup, setSelectedGroup] = useState();
16995
- const filteredOptions = useMemo(() => {
16996
- let options2 = optionsToShow;
16997
- if (query) {
16998
- const lower = query.toLowerCase();
16999
- options2 = options2.flatMap((opt) => {
17000
- if (isGroup(opt)) {
17001
- return opt.categories.filter(
17002
- (cat) => cat.label.toLowerCase().includes(lower)
17003
- );
17004
- }
17005
- return opt.label.toLowerCase().includes(lower) ? [opt] : [];
17006
- });
17007
- }
17008
- return options2.sort((a, b) => a.label.localeCompare(b.label)).map((opt) => {
17009
- var _a;
17010
- return isGroup(opt) ? { label: opt.label, id: opt.id, value: opt, asLink: true } : { label: opt.label, id: opt.value, description: (_a = opt.original.description) != null ? _a : void 0, value: opt };
17011
- });
17012
- }, [optionsToShow, query]);
17013
- const onCategorySelect = (item) => {
17014
- if (isGroup(item.value)) {
17015
- setOptionsToShow(item.value.categories);
17016
- setSelectedGroup(item.value.label);
17017
- setQuery("");
17018
- return;
17019
- }
17020
- select(item.value);
17021
- };
17022
- const clearSelectedGroup = useCallback(() => {
17023
- setOptionsToShow(categoryOptions);
17024
- setSelectedGroup(void 0);
17025
- setQuery("");
17026
- }, [categoryOptions]);
17027
- return /* @__PURE__ */ jsxs(VStack, { className: "Layer__bank-transaction-mobile-list-item__categories_list-container", pbs: "lg", gap: "md", children: [
17028
- /* @__PURE__ */ jsxs(VStack, { pis: "sm", pie: "sm", gap: "md", children: [
17029
- /* @__PURE__ */ jsx(HStack, { pis: "xs", children: selectedGroup ? /* @__PURE__ */ jsxs(Button, { variant: "text", onClick: clearSelectedGroup, children: [
17030
- /* @__PURE__ */ jsx(ChevronLeft$1, { size: 18 }),
17031
- /* @__PURE__ */ jsx(ModalHeading, { size: "sm", weight: "bold", align: "center", children: selectedGroup })
17032
- ] }) : /* @__PURE__ */ jsx(ModalHeading, { size: "sm", weight: "bold", children: "Select category" }) }),
17033
- /* @__PURE__ */ jsx(SearchField, { value: query, onChange: setQuery, label: "Search categories..." })
17034
- ] }),
17035
- /* @__PURE__ */ jsx(
17036
- ActionableList,
17037
- {
17038
- options: filteredOptions,
17039
- onClick: onCategorySelect,
17040
- selectedId,
17041
- showDescriptions: showTooltips,
17042
- className: "Layer__bank-transaction-mobile-list-item__categories_list"
17043
- }
17044
- )
17045
- ] });
17046
- };
17047
- const CategorySelectDrawer = ({
17048
- onSelect,
17049
- selectedId,
17050
- showTooltips,
17051
- isOpen,
17052
- onOpenChange
17053
- }) => {
17054
- return /* @__PURE__ */ jsx(Drawer, { isOpen, onOpenChange, variant: "mobile-drawer", isDismissable: true, children: ({ close: close2 }) => /* @__PURE__ */ jsx(
17055
- BankTransactionsMobileListBusinessCategories,
17056
- {
17057
- select: (option) => {
17058
- onSelect(option);
17059
- close2();
17060
- },
17061
- selectedId,
17062
- showTooltips
17063
- }
17064
- ) });
17065
- };
17066
17125
  const SELECT_CATEGORY_VALUE = "SELECT_CATEGORY";
17067
17126
  const isSelectCategoryOption = (value) => {
17068
17127
  return isPlaceholderAsOption(value) && value.value === SELECT_CATEGORY_VALUE;
@@ -17079,6 +17138,10 @@ const BankTransactionsMobileListBusinessForm = ({
17079
17138
  const [sessionCategories, setSessionCategories] = useState(() => {
17080
17139
  var _a;
17081
17140
  const initialMap = /* @__PURE__ */ new Map();
17141
+ if (bankTransaction.category) {
17142
+ const existingCategory = convertApiCategorizationToCategoryOrSplitAsOption(bankTransaction.category);
17143
+ initialMap.set(existingCategory.value, existingCategory);
17144
+ }
17082
17145
  if (((_a = bankTransaction == null ? void 0 : bankTransaction.categorization_flow) == null ? void 0 : _a.type) === CategorizationType.ASK_FROM_SUGGESTIONS) {
17083
17146
  bankTransaction.categorization_flow.suggestions.forEach((suggestion) => {
17084
17147
  const opt = new ApiCategorizationAsOption(suggestion);
@@ -17347,7 +17410,7 @@ const MatchFormMobileItem = ({ match, bankTransaction, inAppLink }) => {
17347
17410
  }
17348
17411
  }
17349
17412
  ),
17350
- inAppLink
17413
+ inAppLink && /* @__PURE__ */ jsx(HStack, { align: "center", children: /* @__PURE__ */ jsx(Span, { size: "sm", children: inAppLink }) })
17351
17414
  ] })
17352
17415
  },
17353
17416
  match.id
@@ -17492,39 +17555,6 @@ const BankTransactionsMobileListMatchForm = ({
17492
17555
  showRetry && /* @__PURE__ */ jsx(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." })
17493
17556
  ] });
17494
17557
  };
17495
- const CategorySelectDrawerWithTrigger = ({ value, onChange, showTooltips }) => {
17496
- var _a;
17497
- const [isDrawerOpen, setIsDrawerOpen] = useState(false);
17498
- return /* @__PURE__ */ jsxs(HStack, { fluid: true, children: [
17499
- /* @__PURE__ */ jsxs(
17500
- Button,
17501
- {
17502
- flex: true,
17503
- fullWidth: true,
17504
- "aria-label": "Select category",
17505
- onClick: () => {
17506
- setIsDrawerOpen(true);
17507
- },
17508
- variant: "outlined",
17509
- children: [
17510
- /* @__PURE__ */ jsx(Span, { children: (_a = value == null ? void 0 : value.label) != null ? _a : "Select..." }),
17511
- /* @__PURE__ */ jsx(Spacer, {}),
17512
- /* @__PURE__ */ jsx(ChevronDown, { size: 16 })
17513
- ]
17514
- }
17515
- ),
17516
- /* @__PURE__ */ jsx(
17517
- CategorySelectDrawer,
17518
- {
17519
- onSelect: onChange,
17520
- selectedId: value == null ? void 0 : value.value,
17521
- showTooltips,
17522
- isOpen: isDrawerOpen,
17523
- onOpenChange: setIsDrawerOpen
17524
- }
17525
- )
17526
- ] });
17527
- };
17528
17558
  const BankTransactionsMobileListSplitForm = ({
17529
17559
  bankTransaction,
17530
17560
  showTooltips,
@@ -17793,6 +17823,7 @@ const PURPOSE_TOGGLE_OPTIONS = [
17793
17823
  ];
17794
17824
  const BankTransactionsMobileListItemExpandedRow = ({
17795
17825
  bankTransaction,
17826
+ isOpen,
17796
17827
  showCategorization,
17797
17828
  showDescriptions,
17798
17829
  showReceiptUploads,
@@ -17814,6 +17845,7 @@ const BankTransactionsMobileListItemExpandedRow = ({
17814
17845
  /* @__PURE__ */ jsx(
17815
17846
  BankTransactionsMobileForms,
17816
17847
  {
17848
+ isOpen,
17817
17849
  purpose,
17818
17850
  bankTransaction,
17819
17851
  showCategorization,
@@ -17856,20 +17888,15 @@ var Purpose = /* @__PURE__ */ ((Purpose2) => {
17856
17888
  Purpose2["more"] = "more";
17857
17889
  return Purpose2;
17858
17890
  })(Purpose || {});
17859
- const getAssignedValue = (bankTransaction, renderInAppLink) => {
17860
- var _a, _b, _c, _d;
17861
- if (bankTransaction.categorization_status === CategorizationStatus.SPLIT) {
17862
- return extractDescriptionForSplit(bankTransaction.category);
17863
- }
17864
- if (bankTransaction.categorization_status === CategorizationStatus.MATCHED) {
17865
- if (renderInAppLink && ((_a = bankTransaction.match) == null ? void 0 : _a.details)) {
17866
- const matchDetails = bankTransaction.match.details ? decodeMatchDetails(bankTransaction.match.details) : void 0;
17867
- const inAppLink = matchDetails ? renderInAppLink(convertMatchDetailsToLinkingMetadata(matchDetails)) : void 0;
17868
- if (inAppLink) return inAppLink;
17891
+ const getInAppLink = (bankTransaction, renderInAppLink) => {
17892
+ var _a;
17893
+ if (bankTransaction.categorization_status === CategorizationStatus.MATCHED && renderInAppLink && ((_a = bankTransaction.match) == null ? void 0 : _a.details)) {
17894
+ const matchDetails = decodeMatchDetails(bankTransaction.match.details);
17895
+ if (matchDetails) {
17896
+ return renderInAppLink(convertMatchDetailsToLinkingMetadata(matchDetails));
17869
17897
  }
17870
- return (_c = (_b = bankTransaction.match) == null ? void 0 : _b.details) == null ? void 0 : _c.description;
17871
17898
  }
17872
- return (_d = bankTransaction.category) == null ? void 0 : _d.display_name;
17899
+ return null;
17873
17900
  };
17874
17901
  const BankTransactionsMobileListItem = ({
17875
17902
  index,
@@ -17977,6 +18004,12 @@ const BankTransactionsMobileListItem = ({
17977
18004
  const isSelected = useIdIsSelected();
17978
18005
  const isTransactionSelected = isSelected(bankTransaction.id);
17979
18006
  const { renderInAppLink } = useInAppLinkContext();
18007
+ const inAppLink = useMemo(() => {
18008
+ if (!categorized) {
18009
+ return null;
18010
+ }
18011
+ return getInAppLink(bankTransaction, renderInAppLink);
18012
+ }, [categorized, bankTransaction, renderInAppLink]);
17980
18013
  const { isVisible } = useDelayedVisibility({ delay: index * 20, initialVisibility: Boolean(initialLoad) });
17981
18014
  const className = "Layer__bank-transaction-mobile-list-item";
17982
18015
  const openClassName = open ? `${className}--expanded` : "";
@@ -17995,9 +18028,8 @@ const BankTransactionsMobileListItem = ({
17995
18028
  /* @__PURE__ */ jsxs(
17996
18029
  HStack,
17997
18030
  {
17998
- gap: "lg",
18031
+ gap: "sm",
17999
18032
  justify: "space-between",
18000
- align: "center",
18001
18033
  pie: "md",
18002
18034
  children: [
18003
18035
  /* @__PURE__ */ jsxs(HStack, { align: "center", overflow: "hidden", children: [
@@ -18014,12 +18046,12 @@ const BankTransactionsMobileListItem = ({
18014
18046
  {
18015
18047
  align: "start",
18016
18048
  gap: "3xs",
18017
- className: "Layer__bankTransactionsMobileListItem__headingContentLeft",
18049
+ className: "Layer__BankTransactionsMobileListItem__HeadingContentLeft",
18018
18050
  pi: "md",
18019
18051
  pb: "sm",
18020
18052
  children: [
18021
18053
  /* @__PURE__ */ jsx(Span, { ellipsis: true, children: (_b = bankTransaction.counterparty_name) != null ? _b : bankTransaction.description }),
18022
- /* @__PURE__ */ jsx(Span, { className: "Layer__bankTransactionsMobileListItem__categorizedValue", children: categorized && bankTransaction.categorization_status ? getAssignedValue(bankTransaction, renderInAppLink) : null }),
18054
+ inAppLink && /* @__PURE__ */ jsx(Span, { className: "Layer__BankTransactionsMobileListItem__CategorizedValue", children: inAppLink }),
18023
18055
  /* @__PURE__ */ jsxs(HStack, { gap: "2xs", align: "center", children: [
18024
18056
  /* @__PURE__ */ jsx(Span, { size: "sm", ellipsis: true, children: fullAccountName }),
18025
18057
  hasReceipts(bankTransaction) ? /* @__PURE__ */ jsx(File, { size: 12 }) : null
@@ -18044,7 +18076,7 @@ const BankTransactionsMobileListItem = ({
18044
18076
  ]
18045
18077
  }
18046
18078
  ),
18047
- !open && (!categorizationEnabled && !categorized ? /* @__PURE__ */ jsx("span", { className: "Layer__bank-transaction-list-item__processing-info", children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }) : /* @__PURE__ */ jsx(
18079
+ !open && (!categorizationEnabled && !categorized ? /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, { showAsBadge: true }) : /* @__PURE__ */ jsx(
18048
18080
  BankTransactionsListItemCategory,
18049
18081
  {
18050
18082
  bankTransaction,
@@ -18058,6 +18090,7 @@ const BankTransactionsMobileListItem = ({
18058
18090
  BankTransactionsMobileListItemExpandedRow,
18059
18091
  {
18060
18092
  bankTransaction,
18093
+ isOpen: open,
18061
18094
  showCategorization: categorizationEnabled,
18062
18095
  showDescriptions,
18063
18096
  showReceiptUploads,
@@ -18078,6 +18111,7 @@ const BankTransactionsMobileList = ({
18078
18111
  const transactionToOpenContextData = useTransactionToOpen();
18079
18112
  const [bulkActionsEnabled, setBulkActionsEnabled] = useState(false);
18080
18113
  const { clearSelection } = useBulkSelectionActions();
18114
+ useUpsertBankTransactionsDefaultCategories(bankTransactions);
18081
18115
  useEffect(() => {
18082
18116
  if (!bulkActionsEnabled) {
18083
18117
  clearSelection();
@@ -18256,8 +18290,8 @@ const BankTransactionsTable = ({
18256
18290
  }
18257
18291
  );
18258
18292
  };
18259
- const BackArrow = (_Rb) => {
18260
- var _Sb = _Rb, { size = 18 } = _Sb, props = __objRest(_Sb, ["size"]);
18293
+ const BackArrow = (_Vb) => {
18294
+ var _Wb = _Vb, { size = 18 } = _Wb, props = __objRest(_Wb, ["size"]);
18261
18295
  return /* @__PURE__ */ jsx(
18262
18296
  "svg",
18263
18297
  __spreadProps(__spreadValues({
@@ -18425,8 +18459,8 @@ const usePaginationRange = ({
18425
18459
  }, [totalCount, pageSize, siblingCount, currentPage]);
18426
18460
  return paginationRange;
18427
18461
  };
18428
- const ChevronLeft = (_Tb) => {
18429
- var props = __objRest(_Tb, []);
18462
+ const ChevronLeft = (_Xb) => {
18463
+ var props = __objRest(_Xb, []);
18430
18464
  return /* @__PURE__ */ jsx(
18431
18465
  "svg",
18432
18466
  __spreadProps(__spreadValues({
@@ -18448,8 +18482,8 @@ const ChevronLeft = (_Tb) => {
18448
18482
  })
18449
18483
  );
18450
18484
  };
18451
- const PaginationButton = (_Ub) => {
18452
- var _Vb = _Ub, { children, isSelected } = _Vb, buttonProps = __objRest(_Vb, ["children", "isSelected"]);
18485
+ const PaginationButton = (_Yb) => {
18486
+ var _Zb = _Yb, { children, isSelected } = _Zb, buttonProps = __objRest(_Zb, ["children", "isSelected"]);
18453
18487
  return /* @__PURE__ */ jsx(
18454
18488
  Button,
18455
18489
  __spreadProps(__spreadValues({
@@ -18878,8 +18912,8 @@ function usePreloadTagDimensions(parameters) {
18878
18912
  useTagDimensions(parameters);
18879
18913
  }
18880
18914
  const COMPONENT_NAME$c = "bank-transactions";
18881
- const BankTransactions = (_Wb) => {
18882
- var _Xb = _Wb, {
18915
+ const BankTransactions = (__b) => {
18916
+ var _$b = __b, {
18883
18917
  onError,
18884
18918
  showTags = false,
18885
18919
  showCustomerVendor = false,
@@ -18887,7 +18921,7 @@ const BankTransactions = (_Wb) => {
18887
18921
  applyGlobalDateRange = false,
18888
18922
  mode,
18889
18923
  renderInAppLink
18890
- } = _Xb, props = __objRest(_Xb, [
18924
+ } = _$b, props = __objRest(_$b, [
18891
18925
  "onError",
18892
18926
  "showTags",
18893
18927
  "showCustomerVendor",
@@ -19117,7 +19151,7 @@ const BankTransactionsTableView = ({
19117
19151
  }
19118
19152
  )
19119
19153
  ] }),
19120
- !isLoadingWithoutData && listView && mobileComponent !== "mobileList" ? /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transactions__list-wrapper", children: [
19154
+ !isLoadingWithoutData && listView && mobileComponent !== "mobileList" && /* @__PURE__ */ jsxs("div", { className: "Layer__bank-transactions__list-wrapper", children: [
19121
19155
  rulesSuggestionModal,
19122
19156
  /* @__PURE__ */ jsx(
19123
19157
  BankTransactionsList,
@@ -19132,8 +19166,8 @@ const BankTransactionsTableView = ({
19132
19166
  showTooltips
19133
19167
  }
19134
19168
  )
19135
- ] }) : null,
19136
- !isLoadingWithoutData && listView && mobileComponent === "mobileList" ? /* @__PURE__ */ jsxs(Fragment, { children: [
19169
+ ] }),
19170
+ !isLoadingWithoutData && listView && mobileComponent === "mobileList" && /* @__PURE__ */ jsxs(Fragment, { children: [
19137
19171
  /* @__PURE__ */ jsx(
19138
19172
  BankTransactionsMobileList,
19139
19173
  {
@@ -19146,9 +19180,9 @@ const BankTransactionsTableView = ({
19146
19180
  }
19147
19181
  ),
19148
19182
  rulesSuggestionDrawer
19149
- ] }) : null,
19150
- listView && isLoadingWithoutData ? /* @__PURE__ */ jsx("div", { className: "Layer__bank-transactions__list-loader", children: /* @__PURE__ */ jsx(Loader, {}) }) : null,
19151
- !isSyncing || listView ? /* @__PURE__ */ jsx(
19183
+ ] }),
19184
+ listView && isLoadingWithoutData && /* @__PURE__ */ jsx("div", { className: "Layer__bank-transactions__list-loader", children: /* @__PURE__ */ jsx(Loader, {}) }),
19185
+ (!isSyncing || listView) && /* @__PURE__ */ jsx(
19152
19186
  BankTransactionsTableEmptyStates,
19153
19187
  {
19154
19188
  hasVisibleTransactions: ((_a = bankTransactions == null ? void 0 : bankTransactions.length) != null ? _a : 0) > 0,
@@ -19157,7 +19191,7 @@ const BankTransactionsTableView = ({
19157
19191
  isFiltered: Boolean(filters == null ? void 0 : filters.query),
19158
19192
  isLoadingWithoutData
19159
19193
  }
19160
- ) : null,
19194
+ ),
19161
19195
  !isMonthlyViewMode && /* @__PURE__ */ jsx(HStack, { justify: "end", children: /* @__PURE__ */ jsx(
19162
19196
  Pagination,
19163
19197
  {
@@ -19252,8 +19286,8 @@ function QuickbooksContextProvider({ children }) {
19252
19286
  const quickbooksContextData = useQuickbooks();
19253
19287
  return /* @__PURE__ */ jsx(QuickbooksContext.Provider, { value: quickbooksContextData, children });
19254
19288
  }
19255
- const Cog = (_Yb) => {
19256
- var _Zb = _Yb, { size = 12 } = _Zb, props = __objRest(_Zb, ["size"]);
19289
+ const Cog = (_ac) => {
19290
+ var _bc = _ac, { size = 12 } = _bc, props = __objRest(_bc, ["size"]);
19257
19291
  const id = useId();
19258
19292
  return /* @__PURE__ */ jsxs(
19259
19293
  "svg",
@@ -19274,8 +19308,8 @@ const Cog = (_Yb) => {
19274
19308
  })
19275
19309
  );
19276
19310
  };
19277
- const QuickbooksIcon = (__b) => {
19278
- var _$b = __b, { size = 24 } = _$b, props = __objRest(_$b, ["size"]);
19311
+ const QuickbooksIcon = (_cc) => {
19312
+ var _dc = _cc, { size = 24 } = _dc, props = __objRest(_dc, ["size"]);
19279
19313
  return /* @__PURE__ */ jsxs(
19280
19314
  "svg",
19281
19315
  __spreadProps(__spreadValues({
@@ -19434,8 +19468,8 @@ function IntegrationsQuickbooksUnlinkConfirmationModal({ isOpen, onOpenChange })
19434
19468
  }
19435
19469
  );
19436
19470
  }
19437
- const MoreVertical = (_ac) => {
19438
- var _bc = _ac, { size = 18 } = _bc, props = __objRest(_bc, ["size"]);
19471
+ const MoreVertical = (_ec) => {
19472
+ var _fc = _ec, { size = 18 } = _fc, props = __objRest(_fc, ["size"]);
19439
19473
  return /* @__PURE__ */ jsxs(
19440
19474
  "svg",
19441
19475
  __spreadProps(__spreadValues({
@@ -19664,8 +19698,8 @@ const IntegrationsComponent = ({
19664
19698
  (quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected) && /* @__PURE__ */ jsx(IntegrationsContent, {})
19665
19699
  ] });
19666
19700
  };
19667
- const PlusIcon = (_cc) => {
19668
- var _dc = _cc, { size = 14 } = _dc, props = __objRest(_dc, ["size"]);
19701
+ const PlusIcon = (_gc) => {
19702
+ var _hc = _gc, { size = 14 } = _hc, props = __objRest(_hc, ["size"]);
19669
19703
  return /* @__PURE__ */ jsxs(
19670
19704
  "svg",
19671
19705
  __spreadProps(__spreadValues({
@@ -19707,8 +19741,8 @@ const PlusIcon = (_cc) => {
19707
19741
  })
19708
19742
  );
19709
19743
  };
19710
- const InstitutionIcon = (_ec) => {
19711
- var _fc = _ec, { size = 18 } = _fc, props = __objRest(_fc, ["size"]);
19744
+ const InstitutionIcon = (_ic) => {
19745
+ var _jc = _ic, { size = 18 } = _jc, props = __objRest(_jc, ["size"]);
19712
19746
  return /* @__PURE__ */ jsxs(
19713
19747
  "svg",
19714
19748
  __spreadProps(__spreadValues({
@@ -20015,10 +20049,10 @@ const InstitutionIcon = (_ec) => {
20015
20049
  })
20016
20050
  );
20017
20051
  };
20018
- const CLASS_NAME$5 = "Layer__BasicLinkedAccountContainer";
20052
+ const CLASS_NAME$4 = "Layer__BasicLinkedAccountContainer";
20019
20053
  function BasicLinkedAccountContainer({ children, isSelected }) {
20020
20054
  const dataProperties = toDataProperties({ selected: isSelected });
20021
- return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, dataProperties), { className: CLASS_NAME$5, children }));
20055
+ return /* @__PURE__ */ jsx("div", __spreadProps(__spreadValues({}, dataProperties), { className: CLASS_NAME$4, children }));
20022
20056
  }
20023
20057
  function BasicLinkedAccountLogo({ account }) {
20024
20058
  var _a, _b, _c;
@@ -20326,8 +20360,8 @@ const MenuItem = forwardRef(
20326
20360
  );
20327
20361
  const PILL_CLASS_NAME = "Layer__Pill";
20328
20362
  const Pill = forwardRef(
20329
- function Pill2(_gc, ref) {
20330
- var _hc = _gc, { children, status } = _hc, restProps = __objRest(_hc, ["children", "status"]);
20363
+ function Pill2(_kc, ref) {
20364
+ var _lc = _kc, { children, status } = _lc, restProps = __objRest(_lc, ["children", "status"]);
20331
20365
  const dataProperties = toDataProperties({ status });
20332
20366
  return /* @__PURE__ */ jsx(
20333
20367
  Button$2,
@@ -20690,8 +20724,8 @@ const LinkedAccountsContent = ({
20690
20724
  };
20691
20725
  const CALENDAR_CLASS_NAME = "Layer__UI__Calendar";
20692
20726
  const Calendar = forwardRef(
20693
- function Calendar2(_ic, ref) {
20694
- var _jc = _ic, { className, isReadOnly } = _jc, restProps = __objRest(_jc, ["className", "isReadOnly"]);
20727
+ function Calendar2(_mc, ref) {
20728
+ var _nc = _mc, { className, isReadOnly } = _nc, restProps = __objRest(_nc, ["className", "isReadOnly"]);
20695
20729
  const dataProperties = toDataProperties({ readonly: isReadOnly });
20696
20730
  return /* @__PURE__ */ jsx(
20697
20731
  Calendar$1,
@@ -20705,8 +20739,8 @@ const Calendar = forwardRef(
20705
20739
  );
20706
20740
  const CALENDAR_GRID_CLASS_NAME = "Layer__UI__CalendarGrid";
20707
20741
  const CalendarGrid = forwardRef(
20708
- function CalendarGrid2(_kc, ref) {
20709
- var _lc = _kc, { className } = _lc, restProps = __objRest(_lc, ["className"]);
20742
+ function CalendarGrid2(_oc, ref) {
20743
+ var _pc = _oc, { className } = _pc, restProps = __objRest(_pc, ["className"]);
20710
20744
  return /* @__PURE__ */ jsx(
20711
20745
  CalendarGrid$1,
20712
20746
  __spreadProps(__spreadValues({}, restProps), {
@@ -20718,8 +20752,8 @@ const CalendarGrid = forwardRef(
20718
20752
  );
20719
20753
  const CALENDAR_GRID_BODY_CLASS_NAME = "Layer__UI__CalendarGridBody";
20720
20754
  const CalendarGridBody = forwardRef(
20721
- function CalendarGridBody2(_mc, ref) {
20722
- var _nc = _mc, { className } = _nc, restProps = __objRest(_nc, ["className"]);
20755
+ function CalendarGridBody2(_qc, ref) {
20756
+ var _rc = _qc, { className } = _rc, restProps = __objRest(_rc, ["className"]);
20723
20757
  return /* @__PURE__ */ jsx(
20724
20758
  CalendarGridBody$1,
20725
20759
  __spreadProps(__spreadValues({}, restProps), {
@@ -20731,8 +20765,8 @@ const CalendarGridBody = forwardRef(
20731
20765
  );
20732
20766
  const CALENDAR_CELL_CLASS_NAME = "Layer__UI__CalendarCell";
20733
20767
  const CalendarCell = forwardRef(
20734
- function CalendarCell2(_oc, ref) {
20735
- var _pc = _oc, { className, size = "sm" } = _pc, restProps = __objRest(_pc, ["className", "size"]);
20768
+ function CalendarCell2(_sc, ref) {
20769
+ var _tc = _sc, { className, size = "sm" } = _tc, restProps = __objRest(_tc, ["className", "size"]);
20736
20770
  const dataProperties = toDataProperties({ size });
20737
20771
  return /* @__PURE__ */ jsx(
20738
20772
  CalendarCell$1,
@@ -20745,8 +20779,8 @@ const CalendarCell = forwardRef(
20745
20779
  );
20746
20780
  const CALENDAR_GRID_HEADER_CLASS_NAME = "Layer__UI__CalendarGridHeader";
20747
20781
  const CalendarGridHeader = forwardRef(
20748
- function CalendarGridHeader2(_qc, ref) {
20749
- var _rc = _qc, { className } = _rc, restProps = __objRest(_rc, ["className"]);
20782
+ function CalendarGridHeader2(_uc, ref) {
20783
+ var _vc = _uc, { className } = _vc, restProps = __objRest(_vc, ["className"]);
20750
20784
  return /* @__PURE__ */ jsx(
20751
20785
  CalendarGridHeader$1,
20752
20786
  __spreadProps(__spreadValues({}, restProps), {
@@ -20758,8 +20792,8 @@ const CalendarGridHeader = forwardRef(
20758
20792
  );
20759
20793
  const CALENDAR_HEADER_CELL_CLASS_NAME = "Layer__UI__CalendarHeaderCell";
20760
20794
  const CalendarHeaderCell = forwardRef(
20761
- function CalendarHeaderCell2(_sc, ref) {
20762
- var _tc = _sc, { className, size = "sm" } = _tc, restProps = __objRest(_tc, ["className", "size"]);
20795
+ function CalendarHeaderCell2(_wc, ref) {
20796
+ var _xc = _wc, { className, size = "sm" } = _xc, restProps = __objRest(_xc, ["className", "size"]);
20763
20797
  const dataProperties = toDataProperties({ size });
20764
20798
  return /* @__PURE__ */ jsx(
20765
20799
  CalendarHeaderCell$1,
@@ -20892,7 +20926,7 @@ const useDatePickerState = ({ date, setDate, minDate = null, maxDate = null }) =
20892
20926
  maxDateZdt
20893
20927
  }), [errorText, isInvalid, localDate, onBlur, onChange, maxDateZdt, minDateZdt]);
20894
20928
  };
20895
- const CLASS_NAME$4 = "Layer__caobfb";
20929
+ const CLASS_NAME$3 = "Layer__caobfb";
20896
20930
  const AccountFormBox = ({
20897
20931
  account,
20898
20932
  value,
@@ -20925,8 +20959,8 @@ const AccountFormBox = ({
20925
20959
  onChange(__spreadProps(__spreadValues({}, value), { isDateInvalid }));
20926
20960
  }
20927
20961
  }, [isDateInvalid, onChange, value]);
20928
- return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, dataProps), { className: CLASS_NAME$4, children: [
20929
- /* @__PURE__ */ jsx("div", { className: `${CLASS_NAME$4}__icon-col`, children: ((_a = account.institution) == null ? void 0 : _a.logo) != void 0 ? /* @__PURE__ */ jsx(
20962
+ return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({}, dataProps), { className: CLASS_NAME$3, children: [
20963
+ /* @__PURE__ */ jsx("div", { className: `${CLASS_NAME$3}__icon-col`, children: ((_a = account.institution) == null ? void 0 : _a.logo) != void 0 ? /* @__PURE__ */ jsx(
20930
20964
  "img",
20931
20965
  {
20932
20966
  width: 32,
@@ -20935,13 +20969,13 @@ const AccountFormBox = ({
20935
20969
  alt: ((_b = account.institution) == null ? void 0 : _b.name) ? (_c = account.institution) == null ? void 0 : _c.name : account.external_account_name
20936
20970
  }
20937
20971
  ) : /* @__PURE__ */ jsx(InstitutionIcon, {}) }),
20938
- /* @__PURE__ */ jsxs("div", { className: `${CLASS_NAME$4}__details-col`, children: [
20939
- /* @__PURE__ */ jsxs("div", { className: `${CLASS_NAME$4}__details-col__details`, children: [
20940
- /* @__PURE__ */ jsxs("div", { className: `${CLASS_NAME$4}__details-col__name`, children: [
20972
+ /* @__PURE__ */ jsxs("div", { className: `${CLASS_NAME$3}__details-col`, children: [
20973
+ /* @__PURE__ */ jsxs("div", { className: `${CLASS_NAME$3}__details-col__details`, children: [
20974
+ /* @__PURE__ */ jsxs("div", { className: `${CLASS_NAME$3}__details-col__name`, children: [
20941
20975
  /* @__PURE__ */ jsx(
20942
20976
  Text,
20943
20977
  {
20944
- className: `${CLASS_NAME$4}__details-col__name__institution-name`,
20978
+ className: `${CLASS_NAME$3}__details-col__name__institution-name`,
20945
20979
  size: TextSize.sm,
20946
20980
  children: (_d = account.institution) == null ? void 0 : _d.name
20947
20981
  }
@@ -20949,7 +20983,7 @@ const AccountFormBox = ({
20949
20983
  /* @__PURE__ */ jsx(
20950
20984
  Text,
20951
20985
  {
20952
- className: `${CLASS_NAME$4}__details-col__name__account-name`,
20986
+ className: `${CLASS_NAME$3}__details-col__name__account-name`,
20953
20987
  size: TextSize.sm,
20954
20988
  children: account.external_account_name
20955
20989
  }
@@ -20960,7 +20994,7 @@ const AccountFormBox = ({
20960
20994
  account.mask
20961
20995
  ] })
20962
20996
  ] }),
20963
- /* @__PURE__ */ jsxs("div", { className: `${CLASS_NAME$4}__details-col__inputs`, children: [
20997
+ /* @__PURE__ */ jsxs("div", { className: `${CLASS_NAME$3}__details-col__inputs`, children: [
20964
20998
  /* @__PURE__ */ jsx(InputGroup, { label: "Opening date", children: /* @__PURE__ */ jsx(
20965
20999
  DatePicker,
20966
21000
  {
@@ -20989,7 +21023,7 @@ const AccountFormBox = ({
20989
21023
  ] }),
20990
21024
  errors.includes("API_ERROR") && /* @__PURE__ */ jsx(ErrorText, { children: "An error occurred while saving data. You will have an opportunity to try again later." })
20991
21025
  ] }),
20992
- !disableConfirmExclude && /* @__PURE__ */ jsx("div", { className: `${CLASS_NAME$4}__confirm-col`, children: /* @__PURE__ */ jsx(
21026
+ !disableConfirmExclude && /* @__PURE__ */ jsx("div", { className: `${CLASS_NAME$3}__confirm-col`, children: /* @__PURE__ */ jsx(
20993
21027
  Checkbox,
20994
21028
  {
20995
21029
  size: "lg",
@@ -20998,7 +21032,7 @@ const AccountFormBox = ({
20998
21032
  "aria-label": "Confirm Account Inclusion"
20999
21033
  }
21000
21034
  ) }),
21001
- /* @__PURE__ */ jsx("div", { className: `${CLASS_NAME$4}__success-banner`, children: /* @__PURE__ */ jsx(CheckCircle, { size: 36 }) })
21035
+ /* @__PURE__ */ jsx("div", { className: `${CLASS_NAME$3}__success-banner`, children: /* @__PURE__ */ jsx(CheckCircle, { size: 36 }) })
21002
21036
  ] }));
21003
21037
  };
21004
21038
  function buildKey$z({
@@ -21874,8 +21908,8 @@ const useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
21874
21908
  refetch
21875
21909
  };
21876
21910
  };
21877
- const BarChart2 = (_uc) => {
21878
- var _vc = _uc, { size = 12 } = _vc, props = __objRest(_vc, ["size"]);
21911
+ const BarChart2 = (_yc) => {
21912
+ var _zc = _yc, { size = 12 } = _zc, props = __objRest(_zc, ["size"]);
21879
21913
  return /* @__PURE__ */ jsxs(
21880
21914
  "svg",
21881
21915
  __spreadProps(__spreadValues({
@@ -22665,11 +22699,11 @@ const ProfitAndLossChart = ({
22665
22699
  isSyncing && !hasNonZeroData ? /* @__PURE__ */ jsx(ChartStateCard, {}) : null
22666
22700
  ] });
22667
22701
  };
22668
- const BackButton = (_wc) => {
22669
- var _xc = _wc, {
22702
+ const BackButton = (_Ac) => {
22703
+ var _Bc = _Ac, {
22670
22704
  className,
22671
22705
  textOnly = false
22672
- } = _xc, props = __objRest(_xc, [
22706
+ } = _Bc, props = __objRest(_Bc, [
22673
22707
  "className",
22674
22708
  "textOnly"
22675
22709
  ]);
@@ -22717,8 +22751,8 @@ const TASKS_CHARTS_COLORS = {
22717
22751
  done: "#3B9C63",
22718
22752
  pending: "#DFA000"
22719
22753
  };
22720
- const SortArrows = (_yc) => {
22721
- var _zc = _yc, { size = 13 } = _zc, props = __objRest(_zc, ["size"]);
22754
+ const SortArrows = (_Cc) => {
22755
+ var _Dc = _Cc, { size = 13 } = _Dc, props = __objRest(_Dc, ["size"]);
22722
22756
  return /* @__PURE__ */ jsxs(
22723
22757
  "svg",
22724
22758
  __spreadProps(__spreadValues({
@@ -23383,11 +23417,11 @@ const LedgerAccountsContext = createContext({
23383
23417
  fetchMore: () => {
23384
23418
  }
23385
23419
  });
23386
- const CloseButton = (_Ac) => {
23387
- var _Bc = _Ac, {
23420
+ const CloseButton = (_Ec) => {
23421
+ var _Fc = _Ec, {
23388
23422
  className,
23389
23423
  textOnly = false
23390
- } = _Bc, props = __objRest(_Bc, [
23424
+ } = _Fc, props = __objRest(_Fc, [
23391
23425
  "className",
23392
23426
  "textOnly"
23393
23427
  ]);
@@ -24125,7 +24159,7 @@ const ProfitAndLossDetailReport = ({
24125
24159
  ),
24126
24160
  rowsWithRunningBalance.lines.length > 0 && /* @__PURE__ */ jsxs(HStack, { pb: "sm", align: "center", className: "Layer__profit-and-loss-detail-report__total-row", children: [
24127
24161
  /* @__PURE__ */ jsx(HStack, { className: "Layer__profit-and-loss-detail-report__total-label", children: /* @__PURE__ */ jsx(Label, { weight: "bold", size: "md", children: "Total" }) }),
24128
- /* @__PURE__ */ jsx(HStack, { className: "Layer__profit-and-loss-detail-report__total-amount", children: /* @__PURE__ */ jsx(MoneySpan, { bold: true, size: "md", amount: rowsWithRunningBalance.total }) })
24162
+ /* @__PURE__ */ jsx(HStack, { className: "Layer__profit-and-loss-detail-report__total-amount", children: /* @__PURE__ */ jsx(MoneySpan, { weight: "bold", size: "md", amount: rowsWithRunningBalance.total }) })
24129
24163
  ] })
24130
24164
  ] }) });
24131
24165
  };
@@ -25282,7 +25316,7 @@ const ProfitAndLossTableComponent = ({
25282
25316
  {
25283
25317
  variant: "text",
25284
25318
  onPress: () => onLineItemClick(lineItem.name, currentBreadcrumbs),
25285
- children: /* @__PURE__ */ jsx(MoneySpan, { bold: true, amount: (_a = lineItem.value) != null ? _a : 0 })
25319
+ children: /* @__PURE__ */ jsx(MoneySpan, { amount: (_a = lineItem.value) != null ? _a : 0, weight: "bold" })
25286
25320
  }
25287
25321
  )
25288
25322
  }
@@ -25564,6 +25598,19 @@ const ProfitAndLossReport = ({
25564
25598
  }
25565
25599
  ) }) });
25566
25600
  };
25601
+ function calculatePercentageChange(current, previous) {
25602
+ if (current >= 0 && previous < 0 || current < 0 && previous >= 0) {
25603
+ return null;
25604
+ }
25605
+ if (previous === 0) {
25606
+ return current === 0 ? null : 100;
25607
+ }
25608
+ return (current - previous) / Math.abs(previous) * 100;
25609
+ }
25610
+ function formatPercentageChange(value) {
25611
+ if (value === null) return "";
25612
+ return `${Math.abs(value).toFixed(0)}%`;
25613
+ }
25567
25614
  const LIST_ITEM_CLASS_NAME = "Layer__ProfitAndLossSummariesListItem";
25568
25615
  function ProfitAndLossSummariesListItem({
25569
25616
  children,
@@ -25675,24 +25722,49 @@ function ProfitAndLossSummariesHeading({
25675
25722
  const { size = "2xs" } = variants2 != null ? variants2 : {};
25676
25723
  return /* @__PURE__ */ jsx(Heading$1, { level: 3, size, slot: "heading", children });
25677
25724
  }
25678
- const CLASS_NAME$3 = "Layer__ProfitAndLossSummariesSummary";
25679
25725
  const CHART_AREA_CLASS_NAME = "Layer__ProfitAndLossSummariesSummaryChartArea";
25680
- const CHART_AREA_EMPTY_FRAME_CLASS_NAME = "Layer__ProfitAndLossSummariesSummaryChartAreaEmptyFrame";
25681
25726
  function ProfitAndLossSummariesSummary({
25682
25727
  label,
25683
25728
  amount,
25684
25729
  isLoading,
25730
+ percentChange,
25731
+ comparisonMonth,
25732
+ isExpense = false,
25685
25733
  slots,
25686
25734
  variants: variants2
25687
25735
  }) {
25688
25736
  const { Chart } = slots != null ? slots : {};
25689
- const { size = "2xs" } = variants2 != null ? variants2 : {};
25690
- const dataProperties = toDataProperties({ size });
25691
- return /* @__PURE__ */ jsxs("div", __spreadProps(__spreadValues({ className: CLASS_NAME$3 }, dataProperties), { children: [
25692
- Chart ? /* @__PURE__ */ jsx("div", { className: CHART_AREA_CLASS_NAME, children: Chart }) : /* @__PURE__ */ jsx("div", { className: CHART_AREA_EMPTY_FRAME_CLASS_NAME }),
25693
- /* @__PURE__ */ jsx(ProfitAndLossSummariesHeading, { variants: variants2, children: label }),
25694
- isLoading ? /* @__PURE__ */ jsx(SkeletonLoader, { height: "20px" }) : /* @__PURE__ */ jsx(MoneySpan, { slot: "amount", amount, size: "lg", bold: true })
25695
- ] }));
25737
+ const showPercentChange = percentChange !== void 0 && percentChange !== null && comparisonMonth;
25738
+ const isGoodChange = showPercentChange && (isExpense ? percentChange < 0 : percentChange >= 0);
25739
+ const arrow = showPercentChange && percentChange >= 0 ? "↑" : "↓";
25740
+ return /* @__PURE__ */ jsxs(HStack, { gap: "xs", align: "center", children: [
25741
+ Chart && /* @__PURE__ */ jsx(
25742
+ HStack,
25743
+ {
25744
+ align: "center",
25745
+ justify: "center",
25746
+ className: CHART_AREA_CLASS_NAME,
25747
+ children: Chart
25748
+ }
25749
+ ),
25750
+ /* @__PURE__ */ jsxs(HStack, { gap: "xs", fluid: true, pi: "sm", children: [
25751
+ /* @__PURE__ */ jsxs(VStack, { gap: "3xs", fluid: true, children: [
25752
+ /* @__PURE__ */ jsx(ProfitAndLossSummariesHeading, { variants: variants2, children: label }),
25753
+ isLoading ? /* @__PURE__ */ jsx(SkeletonLoader, { height: "20px" }) : /* @__PURE__ */ jsx(MoneySpan, { slot: "amount", amount, size: "lg", weight: "bold" })
25754
+ ] }),
25755
+ showPercentChange && /* @__PURE__ */ jsxs(VStack, { gap: "3xs", align: "end", children: [
25756
+ /* @__PURE__ */ jsxs(HStack, { gap: "3xs", align: "center", children: [
25757
+ /* @__PURE__ */ jsx(Span, { size: "md", weight: "bold", status: isGoodChange ? "success" : void 0, children: arrow }),
25758
+ /* @__PURE__ */ jsx(Span, { size: "md", weight: "normal", status: isGoodChange ? "success" : void 0, children: formatPercentageChange(percentChange != null ? percentChange : null) })
25759
+ ] }),
25760
+ /* @__PURE__ */ jsxs(Span, { size: "xs", variant: "subtle", noWrap: true, children: [
25761
+ "vs.",
25762
+ " ",
25763
+ comparisonMonth || ""
25764
+ ] })
25765
+ ] })
25766
+ ] })
25767
+ ] });
25696
25768
  }
25697
25769
  const CLASS_NAME$2 = "Layer__TransactionsToReview";
25698
25770
  function TransactionsToReview({
@@ -25799,6 +25871,14 @@ function Internal_ProfitAndLossSummaries({
25799
25871
  setSidebarScope,
25800
25872
  sidebarScope
25801
25873
  } = useContext(ProfitAndLossContext);
25874
+ const { startDate, endDate: _endDate } = useGlobalDateRange({ displayMode: "month" });
25875
+ const previousMonthStart = sub(startDate, { months: 1 });
25876
+ const { data: previousData } = useProfitAndLossSummaries({
25877
+ startYear: previousMonthStart.getFullYear(),
25878
+ startMonth: previousMonthStart.getMonth() + 1,
25879
+ endYear: previousMonthStart.getFullYear(),
25880
+ endMonth: previousMonthStart.getMonth() + 1
25881
+ });
25802
25882
  const { revenueChartData, expensesChartData } = useMemo(
25803
25883
  () => ({
25804
25884
  revenueChartData: toMiniChartData({ scope: "revenue", data }),
@@ -25806,7 +25886,35 @@ function Internal_ProfitAndLossSummaries({
25806
25886
  }),
25807
25887
  [data]
25808
25888
  );
25809
- const effectiveData = data != null ? data : { income: { value: 0 }, netProfit: 0 };
25889
+ const effectiveData = useMemo(
25890
+ () => data != null ? data : { income: { value: 0 }, netProfit: 0 },
25891
+ [data]
25892
+ );
25893
+ const comparisonData = useMemo(() => {
25894
+ var _a2, _b2, _c2, _d2, _e, _f, _g;
25895
+ const previousMonthData = (_a2 = previousData == null ? void 0 : previousData.months) == null ? void 0 : _a2[0];
25896
+ if (!previousMonthData) {
25897
+ return null;
25898
+ }
25899
+ const currentRevenue = (_b2 = effectiveData.income.value) != null ? _b2 : 0;
25900
+ const previousRevenue = (_c2 = previousMonthData.income) != null ? _c2 : 0;
25901
+ const currentExpenses = ((_d2 = effectiveData.income.value) != null ? _d2 : 0) - effectiveData.netProfit;
25902
+ const previousExpenses = (_e = previousMonthData.totalExpenses) != null ? _e : 0;
25903
+ const currentNetProfit = (_f = effectiveData.netProfit) != null ? _f : 0;
25904
+ const previousNetProfit = (_g = previousMonthData.netProfit) != null ? _g : 0;
25905
+ return {
25906
+ revenuePercentChange: calculatePercentageChange(currentRevenue, previousRevenue),
25907
+ expensesPercentChange: calculatePercentageChange(currentExpenses, previousExpenses),
25908
+ netProfitPercentChange: calculatePercentageChange(currentNetProfit, previousNetProfit),
25909
+ comparisonMonth: format(previousMonthStart, "MMM")
25910
+ };
25911
+ }, [previousData, effectiveData, previousMonthStart]);
25912
+ const {
25913
+ revenuePercentChange = null,
25914
+ expensesPercentChange = null,
25915
+ netProfitPercentChange = null,
25916
+ comparisonMonth = null
25917
+ } = comparisonData != null ? comparisonData : {};
25810
25918
  const { unstable_AdditionalListItems = [] } = slots != null ? slots : {};
25811
25919
  const listItemCount = unstable_AdditionalListItems.length + 3;
25812
25920
  return /* @__PURE__ */ jsx("section", { className: SECTION_CLASS_NAMES, children: /* @__PURE__ */ jsxs(ProfitAndLossSummariesList, { itemCount: listItemCount, children: [
@@ -25821,6 +25929,8 @@ function Internal_ProfitAndLossSummaries({
25821
25929
  label: (stringOverrides == null ? void 0 : stringOverrides.revenueLabel) || revenueLabel || "Revenue",
25822
25930
  amount: (_a = effectiveData.income.value) != null ? _a : 0,
25823
25931
  isLoading,
25932
+ percentChange: revenuePercentChange,
25933
+ comparisonMonth: comparisonMonth != null ? comparisonMonth : void 0,
25824
25934
  slots: {
25825
25935
  Chart: /* @__PURE__ */ jsx(
25826
25936
  ProfitAndLossSummariesMiniChart,
@@ -25847,6 +25957,9 @@ function Internal_ProfitAndLossSummaries({
25847
25957
  label: (stringOverrides == null ? void 0 : stringOverrides.expensesLabel) || "Expenses",
25848
25958
  amount: ((_c = (_b = effectiveData == null ? void 0 : effectiveData.income) == null ? void 0 : _b.value) != null ? _c : 0) - effectiveData.netProfit,
25849
25959
  isLoading,
25960
+ percentChange: expensesPercentChange,
25961
+ comparisonMonth: comparisonMonth != null ? comparisonMonth : void 0,
25962
+ isExpense: true,
25850
25963
  slots: {
25851
25964
  Chart: /* @__PURE__ */ jsx(
25852
25965
  ProfitAndLossSummariesMiniChart,
@@ -25868,16 +25981,18 @@ function Internal_ProfitAndLossSummaries({
25868
25981
  label: (stringOverrides == null ? void 0 : stringOverrides.netProfitLabel) || "Net Profit",
25869
25982
  amount: (_d = data == null ? void 0 : data.netProfit) != null ? _d : 0,
25870
25983
  variants: variants2,
25871
- isLoading
25984
+ isLoading,
25985
+ percentChange: netProfitPercentChange,
25986
+ comparisonMonth: comparisonMonth != null ? comparisonMonth : void 0
25872
25987
  }
25873
25988
  ) }),
25874
25989
  unstable_AdditionalListItems.map((item, index) => /* @__PURE__ */ jsx(ProfitAndLossSummariesListItem, { children: item }, index))
25875
25990
  ] }) });
25876
25991
  }
25877
- function ProfitAndLossSummaries(_Cc) {
25878
- var _Dc = _Cc, {
25992
+ function ProfitAndLossSummaries(_Gc) {
25993
+ var _Hc = _Gc, {
25879
25994
  onTransactionsToReviewClick
25880
- } = _Dc, restProps = __objRest(_Dc, [
25995
+ } = _Hc, restProps = __objRest(_Hc, [
25881
25996
  "onTransactionsToReviewClick"
25882
25997
  ]);
25883
25998
  return /* @__PURE__ */ jsx(
@@ -26077,8 +26192,8 @@ function BalanceSheetDownloadButton({
26077
26192
  /* @__PURE__ */ jsx(InvisibleDownload, { ref: invisibleDownloadRef })
26078
26193
  ] });
26079
26194
  }
26080
- const Collapse = (_Ec) => {
26081
- var props = __objRest(_Ec, []);
26195
+ const Collapse = (_Ic) => {
26196
+ var props = __objRest(_Ic, []);
26082
26197
  return /* @__PURE__ */ jsxs(
26083
26198
  "svg",
26084
26199
  __spreadProps(__spreadValues({
@@ -26111,8 +26226,8 @@ const Collapse = (_Ec) => {
26111
26226
  })
26112
26227
  );
26113
26228
  };
26114
- const Expand = (_Fc) => {
26115
- var props = __objRest(_Fc, []);
26229
+ const Expand = (_Jc) => {
26230
+ var props = __objRest(_Jc, []);
26116
26231
  return /* @__PURE__ */ jsxs(
26117
26232
  "svg",
26118
26233
  __spreadProps(__spreadValues({
@@ -27760,8 +27875,8 @@ const ChartOfAccountsContext = createContext(
27760
27875
  }
27761
27876
  }
27762
27877
  );
27763
- const Plus = (_Gc) => {
27764
- var _Hc = _Gc, { size = 14 } = _Hc, props = __objRest(_Hc, ["size"]);
27878
+ const Plus = (_Kc) => {
27879
+ var _Lc = _Kc, { size = 14 } = _Lc, props = __objRest(_Lc, ["size"]);
27765
27880
  return /* @__PURE__ */ jsxs(
27766
27881
  "svg",
27767
27882
  __spreadProps(__spreadValues({
@@ -28128,8 +28243,8 @@ var LedgerAccountNodeType = /* @__PURE__ */ ((LedgerAccountNodeType2) => {
28128
28243
  LedgerAccountNodeType2["Parent"] = "Parent";
28129
28244
  return LedgerAccountNodeType2;
28130
28245
  })(LedgerAccountNodeType || {});
28131
- const Edit2 = (_Ic) => {
28132
- var _Jc = _Ic, { size = 18 } = _Jc, props = __objRest(_Jc, ["size"]);
28246
+ const Edit2 = (_Mc) => {
28247
+ var _Nc = _Mc, { size = 18 } = _Nc, props = __objRest(_Nc, ["size"]);
28133
28248
  return /* @__PURE__ */ jsx(
28134
28249
  "svg",
28135
28250
  __spreadProps(__spreadValues({
@@ -30810,8 +30925,8 @@ function usePaginatedList(list, pageSize) {
30810
30925
  reset
30811
30926
  };
30812
30927
  }
30813
- const SmileIcon = (_Kc) => {
30814
- var _Lc = _Kc, { size = 12 } = _Lc, props = __objRest(_Lc, ["size"]);
30928
+ const SmileIcon = (_Oc) => {
30929
+ var _Pc = _Oc, { size = 12 } = _Pc, props = __objRest(_Pc, ["size"]);
30815
30930
  return /* @__PURE__ */ jsxs(
30816
30931
  "svg",
30817
30932
  __spreadProps(__spreadValues({
@@ -31656,8 +31771,8 @@ const useBookkeepingYearsStatus = () => {
31656
31771
  isLoading
31657
31772
  };
31658
31773
  };
31659
- const ArrowRightCircle = (_Mc) => {
31660
- var _Nc = _Mc, { size = 18 } = _Nc, props = __objRest(_Nc, ["size"]);
31774
+ const ArrowRightCircle = (_Qc) => {
31775
+ var _Rc = _Qc, { size = 18 } = _Rc, props = __objRest(_Rc, ["size"]);
31661
31776
  return /* @__PURE__ */ jsxs(
31662
31777
  "svg",
31663
31778
  __spreadProps(__spreadValues({
@@ -33705,12 +33820,12 @@ const FormSection = ({ children, title }) => {
33705
33820
  children
33706
33821
  ] });
33707
33822
  };
33708
- const PhoneInput = (_Oc) => {
33709
- var _Pc = _Oc, {
33823
+ const PhoneInput = (_Sc) => {
33824
+ var _Tc = _Sc, {
33710
33825
  value,
33711
33826
  onChange,
33712
33827
  placeholder = "Phone number"
33713
- } = _Pc, props = __objRest(_Pc, [
33828
+ } = _Tc, props = __objRest(_Tc, [
33714
33829
  "value",
33715
33830
  "onChange",
33716
33831
  "placeholder"
@@ -34002,8 +34117,8 @@ const SummaryStep = ({ onNext, title = defaultTitle$1, description = defaultDesc
34002
34117
  /* @__PURE__ */ jsx(Button$1, { onClick: onNext, children: nextBtnText })
34003
34118
  ] });
34004
34119
  };
34005
- const Document = (_Qc) => {
34006
- var _Rc = _Qc, { size = 20 } = _Rc, props = __objRest(_Rc, ["size"]);
34120
+ const Document = (_Uc) => {
34121
+ var _Vc = _Uc, { size = 20 } = _Vc, props = __objRest(_Vc, ["size"]);
34007
34122
  return /* @__PURE__ */ jsxs(
34008
34123
  "svg",
34009
34124
  __spreadProps(__spreadValues({
@@ -34108,8 +34223,8 @@ const Document = (_Qc) => {
34108
34223
  })
34109
34224
  );
34110
34225
  };
34111
- const TrendingUp = (_Sc) => {
34112
- var _Tc = _Sc, { size = 20 } = _Tc, props = __objRest(_Tc, ["size"]);
34226
+ const TrendingUp = (_Wc) => {
34227
+ var _Xc = _Wc, { size = 20 } = _Xc, props = __objRest(_Xc, ["size"]);
34113
34228
  return /* @__PURE__ */ jsxs(
34114
34229
  "svg",
34115
34230
  __spreadProps(__spreadValues({
@@ -34366,8 +34481,8 @@ const PlatformOnboarding = ({ onComplete }) => {
34366
34481
  /* @__PURE__ */ jsx("div", { className: "Layer__platform-onboarding-layout__footer", children: renderStepFooter() })
34367
34482
  ] }) });
34368
34483
  };
34369
- const CoffeeIcon = (_Uc) => {
34370
- var _Vc = _Uc, { size = 11 } = _Vc, props = __objRest(_Vc, ["size"]);
34484
+ const CoffeeIcon = (_Yc) => {
34485
+ var _Zc = _Yc, { size = 11 } = _Zc, props = __objRest(_Zc, ["size"]);
34371
34486
  return /* @__PURE__ */ jsxs(
34372
34487
  "svg",
34373
34488
  __spreadProps(__spreadValues({
@@ -34438,8 +34553,8 @@ const CoffeeIcon = (_Uc) => {
34438
34553
  })
34439
34554
  );
34440
34555
  };
34441
- const Link$1 = (_Wc) => {
34442
- var _Xc = _Wc, {
34556
+ const Link$1 = (__c) => {
34557
+ var _$c = __c, {
34443
34558
  className,
34444
34559
  children,
34445
34560
  variant = ButtonVariant.primary,
@@ -34449,7 +34564,7 @@ const Link$1 = (_Wc) => {
34449
34564
  iconAsPrimary = false,
34450
34565
  justify = "center",
34451
34566
  fullWidth
34452
- } = _Xc, props = __objRest(_Xc, [
34567
+ } = _$c, props = __objRest(_$c, [
34453
34568
  "className",
34454
34569
  "children",
34455
34570
  "variant",
@@ -34541,8 +34656,8 @@ const BookkeepingUpsellBar = ({
34541
34656
  onClick ? /* @__PURE__ */ jsx(Button$1, { variant: ButtonVariant.secondary, onClick, children: "Schedule a demo" }) : href ? /* @__PURE__ */ jsx(Link$1, { href, target: "_blank", variant: ButtonVariant.secondary, children: "Schedule a demo" }) : null
34542
34657
  ] });
34543
34658
  };
34544
- const ChevronRightFill = (_Yc) => {
34545
- var _Zc = _Yc, { size = 18 } = _Zc, props = __objRest(_Zc, ["size"]);
34659
+ const ChevronRightFill = (_ad) => {
34660
+ var _bd = _ad, { size = 18 } = _bd, props = __objRest(_bd, ["size"]);
34546
34661
  return /* @__PURE__ */ jsxs(
34547
34662
  "svg",
34548
34663
  __spreadProps(__spreadValues({
@@ -37824,8 +37939,8 @@ const getClassnameForSubComponent = (className, suffix) => {
37824
37939
  };
37825
37940
  const METER_CLASS_NAME = "Layer__Meter";
37826
37941
  const Meter = forwardRef(
37827
- function Meter2(__c, ref) {
37828
- var _$c = __c, { className, label, meterOnly } = _$c, restProps = __objRest(_$c, ["className", "label", "meterOnly"]);
37942
+ function Meter2(_cd, ref) {
37943
+ var _dd = _cd, { className, label, meterOnly } = _dd, restProps = __objRest(_dd, ["className", "label", "meterOnly"]);
37829
37944
  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: [
37830
37945
  !meterOnly && /* @__PURE__ */ jsxs(HStack, { justify: "space-between", children: [
37831
37946
  /* @__PURE__ */ jsx(Label, { slot: "label", children: label }),
@@ -37940,11 +38055,11 @@ const ProfitAndLossView = (props) => {
37940
38055
  const containerRef = useRef(null);
37941
38056
  return /* @__PURE__ */ jsx(Container, { name: COMPONENT_NAME$3, ref: containerRef, children: /* @__PURE__ */ jsx(ProfitAndLoss, { children: /* @__PURE__ */ jsx(ProfitAndLossPanel, __spreadValues({ containerRef }, props)) }) });
37942
38057
  };
37943
- const ProfitAndLossPanel = (_ad) => {
37944
- var _bd = _ad, {
38058
+ const ProfitAndLossPanel = (_ed) => {
38059
+ var _fd = _ed, {
37945
38060
  containerRef,
37946
38061
  stringOverrides
37947
- } = _bd, props = __objRest(_bd, [
38062
+ } = _fd, props = __objRest(_fd, [
37948
38063
  "containerRef",
37949
38064
  "stringOverrides"
37950
38065
  ]);
@@ -38207,13 +38322,13 @@ function ExpandableDataTable({
38207
38322
  );
38208
38323
  }
38209
38324
  const UNIFIED_REPORT_TAG_KEY = "#unified-report";
38210
- function buildKey$7(_cd) {
38211
- var _dd = _cd, {
38325
+ function buildKey$7(_gd) {
38326
+ var _hd = _gd, {
38212
38327
  access_token: accessToken,
38213
38328
  apiUrl,
38214
38329
  businessId,
38215
38330
  report
38216
- } = _dd, dateParams = __objRest(_dd, [
38331
+ } = _hd, dateParams = __objRest(_hd, [
38217
38332
  "access_token",
38218
38333
  "apiUrl",
38219
38334
  "businessId",
@@ -38229,8 +38344,8 @@ function buildKey$7(_cd) {
38229
38344
  }, dateParams);
38230
38345
  }
38231
38346
  }
38232
- const getUnifiedReport = get((_ed) => {
38233
- var _fd = _ed, { businessId, report } = _fd, dateParams = __objRest(_fd, ["businessId", "report"]);
38347
+ const getUnifiedReport = get((_id) => {
38348
+ var _jd = _id, { businessId, report } = _jd, dateParams = __objRest(_jd, ["businessId", "report"]);
38234
38349
  const parameters = toDefinedSearchParameters(__spreadValues({}, dateParams));
38235
38350
  return `/v1/businesses/${businessId}/reports/unified/${report}?${parameters}`;
38236
38351
  });
@@ -38259,8 +38374,8 @@ class UnifiedReportSWRResponse {
38259
38374
  return this.swrResponse.mutate;
38260
38375
  }
38261
38376
  }
38262
- function useUnifiedReport(_gd) {
38263
- var _hd = _gd, { report } = _hd, dateParams = __objRest(_hd, ["report"]);
38377
+ function useUnifiedReport(_kd) {
38378
+ var _ld = _kd, { report } = _ld, dateParams = __objRest(_ld, ["report"]);
38264
38379
  const { data: auth } = useAuth();
38265
38380
  const { apiUrl } = useEnvironment();
38266
38381
  const { businessId } = useLayerContext();
@@ -39790,19 +39905,19 @@ const VendorsProvider = ({ children }) => {
39790
39905
  const vendors = useVendors();
39791
39906
  return /* @__PURE__ */ jsx(VendorsContext.Provider, { value: vendors, children });
39792
39907
  };
39793
- const SelectVendor = (_id) => {
39794
- var _jd = _id, { withContext = true } = _jd, props = __objRest(_jd, ["withContext"]);
39908
+ const SelectVendor = (_md) => {
39909
+ var _nd = _md, { withContext = true } = _nd, props = __objRest(_nd, ["withContext"]);
39795
39910
  if (withContext) {
39796
39911
  return /* @__PURE__ */ jsx(VendorsProvider, { children: /* @__PURE__ */ jsx(SelectVendorContent, __spreadValues({}, props)) });
39797
39912
  }
39798
39913
  return /* @__PURE__ */ jsx(SelectVendorContent, __spreadValues({}, props));
39799
39914
  };
39800
- const SelectVendorContent = (_kd) => {
39801
- var _ld = _kd, {
39915
+ const SelectVendorContent = (_od) => {
39916
+ var _pd = _od, {
39802
39917
  value,
39803
39918
  onChange,
39804
39919
  placeholder = "Select vendor"
39805
- } = _ld, props = __objRest(_ld, [
39920
+ } = _pd, props = __objRest(_pd, [
39806
39921
  "value",
39807
39922
  "onChange",
39808
39923
  "placeholder"
@@ -40569,8 +40684,8 @@ const BillsTableWithPanel = ({
40569
40684
  }
40570
40685
  );
40571
40686
  };
40572
- const Bills = (_md) => {
40573
- var _nd = _md, { context = true } = _nd, props = __objRest(_nd, ["context"]);
40687
+ const Bills = (_qd) => {
40688
+ var _rd = _qd, { context = true } = _rd, props = __objRest(_rd, ["context"]);
40574
40689
  if (context) {
40575
40690
  return /* @__PURE__ */ jsx(BillsProvider, { children: /* @__PURE__ */ jsx(BillsContent, __spreadValues({}, props)) });
40576
40691
  }
@@ -40628,8 +40743,8 @@ const getTimezoneDisplay = (date) => {
40628
40743
  };
40629
40744
  const LINK_CLASS_NAME = "Layer__UI__Link";
40630
40745
  const Link = forwardRef(
40631
- function Link2(_od, ref) {
40632
- var _pd = _od, {
40746
+ function Link2(_sd, ref) {
40747
+ var _td = _sd, {
40633
40748
  children,
40634
40749
  size = "md",
40635
40750
  ellipsis,
@@ -40638,7 +40753,7 @@ const Link = forwardRef(
40638
40753
  href,
40639
40754
  target,
40640
40755
  rel
40641
- } = _pd, restProps = __objRest(_pd, [
40756
+ } = _td, restProps = __objRest(_td, [
40642
40757
  "children",
40643
40758
  "size",
40644
40759
  "ellipsis",
@@ -41141,8 +41256,10 @@ const VehicleSchema = Schema.Struct({
41141
41256
  Schema.propertySignature(Schema.NullishOr(Schema.String)),
41142
41257
  Schema.fromKey("external_id")
41143
41258
  ),
41144
- make: Schema.String,
41145
- model: Schema.String,
41259
+ makeAndModel: pipe(
41260
+ Schema.propertySignature(Schema.String),
41261
+ Schema.fromKey("make_and_model")
41262
+ ),
41146
41263
  year: Schema.Number,
41147
41264
  licensePlate: pipe(
41148
41265
  Schema.propertySignature(Schema.NullishOr(Schema.String)),
@@ -41164,16 +41281,17 @@ const VehicleSchema = Schema.Struct({
41164
41281
  )
41165
41282
  });
41166
41283
  Schema.Struct({
41167
- make: Schema.String,
41168
- model: Schema.String,
41284
+ makeAndModel: Schema.String,
41169
41285
  year: Schema.Number,
41170
41286
  licensePlate: Schema.String,
41171
41287
  vin: Schema.String,
41172
41288
  description: Schema.String
41173
41289
  });
41174
41290
  const UpsertVehicleSchema = Schema.Struct({
41175
- make: Schema.String,
41176
- model: Schema.String,
41291
+ makeAndModel: pipe(
41292
+ Schema.propertySignature(Schema.String),
41293
+ Schema.fromKey("make_and_model")
41294
+ ),
41177
41295
  year: Schema.Number,
41178
41296
  licensePlate: pipe(
41179
41297
  Schema.propertySignature(Schema.NullishOr(Schema.String)),
@@ -41415,9 +41533,6 @@ const getTripFormDefaultValues = (trip) => {
41415
41533
  const validateTripForm = ({ trip }) => {
41416
41534
  const { vehicle, tripDate, distance, purpose } = trip;
41417
41535
  const errors = [];
41418
- if (vehicle === null) {
41419
- errors.push({ vehicle: "Vehicle is a required field." });
41420
- }
41421
41536
  if (tripDate === null) {
41422
41537
  errors.push({ tripDate: "Trip date is a required field." });
41423
41538
  }
@@ -41430,6 +41545,9 @@ const validateTripForm = ({ trip }) => {
41430
41545
  if (!purpose) {
41431
41546
  errors.push({ purpose: "Purpose is a required field." });
41432
41547
  }
41548
+ if (vehicle === null) {
41549
+ errors.push({ vehicle: "Vehicle is a required field." });
41550
+ }
41433
41551
  return errors.length > 0 ? errors : null;
41434
41552
  };
41435
41553
  const convertTripFormToUpsertTrip = (form) => {
@@ -41728,8 +41846,7 @@ const useTripForm = (props) => {
41728
41846
  );
41729
41847
  };
41730
41848
  const formatDistance = (distance) => {
41731
- const distanceNum = parseFloat(BigDecimal.unsafeToNumber(distance).toString());
41732
- return `${distanceNum.toFixed(1)} mi`;
41849
+ return `${BigDecimal.format(distance)} mi`;
41733
41850
  };
41734
41851
  const getPurposeLabel = (purpose) => {
41735
41852
  var _a;
@@ -41842,7 +41959,7 @@ function useListVehicles() {
41842
41959
  );
41843
41960
  return new ListVehiclesSWRResponse(response);
41844
41961
  }
41845
- const getVehicleDisplayName = (vehicle) => [vehicle.year, vehicle.make, vehicle.model].join(" ");
41962
+ const getVehicleDisplayName = (vehicle) => `${vehicle.year} ${vehicle.makeAndModel}`;
41846
41963
  class VehicleAsOption {
41847
41964
  constructor(vehicle) {
41848
41965
  __publicField(this, "internalVehicle");
@@ -41957,33 +42074,88 @@ const TripForm = (props) => {
41957
42074
  ) });
41958
42075
  }
41959
42076
  } }),
41960
- /* @__PURE__ */ jsx(form.Field, { name: "vehicle", children: (field) => /* @__PURE__ */ jsx(
41961
- VehicleSelector,
42077
+ /* @__PURE__ */ jsx(form.AppField, { name: "tripDate", children: (field) => /* @__PURE__ */ jsx(
42078
+ field.FormDateField,
41962
42079
  {
41963
- selectedVehicle: field.state.value,
41964
- onSelectedVehicleChange: field.handleChange,
42080
+ label: "Trip date",
42081
+ inline: true,
41965
42082
  isReadOnly,
42083
+ className: `${TRIP_FORM_FIELD_CSS_PREFIX}__TripDate`
42084
+ }
42085
+ ) }),
42086
+ /* @__PURE__ */ jsx(form.AppField, { name: "distance", children: (field) => /* @__PURE__ */ jsx(
42087
+ field.FormBigDecimalField,
42088
+ {
42089
+ label: "Distance (miles)",
41966
42090
  inline: true,
41967
- containerClassName: `${TRIP_FORM_FIELD_CSS_PREFIX}__Vehicle`
42091
+ isReadOnly,
42092
+ maxDecimalPlaces: 2,
42093
+ placeholder: "Enter distance",
42094
+ className: `${TRIP_FORM_FIELD_CSS_PREFIX}__Distance`
42095
+ }
42096
+ ) }),
42097
+ /* @__PURE__ */ jsx(form.AppField, { name: "startAddress", children: (field) => /* @__PURE__ */ jsx(
42098
+ field.FormTextField,
42099
+ {
42100
+ label: "Start address",
42101
+ inline: true,
42102
+ isReadOnly,
42103
+ placeholder: "Enter address",
42104
+ className: `${TRIP_FORM_FIELD_CSS_PREFIX}__StartAddress`
42105
+ }
42106
+ ) }),
42107
+ /* @__PURE__ */ jsx(form.AppField, { name: "endAddress", children: (field) => /* @__PURE__ */ jsx(
42108
+ field.FormTextField,
42109
+ {
42110
+ label: "End address",
42111
+ inline: true,
42112
+ isReadOnly,
42113
+ placeholder: "Enter address",
42114
+ className: `${TRIP_FORM_FIELD_CSS_PREFIX}__EndAddress`
41968
42115
  }
41969
42116
  ) }),
41970
- /* @__PURE__ */ jsx(form.AppField, { name: "tripDate", children: (field) => /* @__PURE__ */ jsx(field.FormDateField, { label: "Trip date", inline: true, className: `${TRIP_FORM_FIELD_CSS_PREFIX}__TripDate`, isReadOnly }) }),
41971
- /* @__PURE__ */ jsx(form.AppField, { name: "distance", children: (field) => /* @__PURE__ */ jsx(field.FormBigDecimalField, { label: "Distance (miles)", inline: true, className: `${TRIP_FORM_FIELD_CSS_PREFIX}__Distance`, isReadOnly, maxDecimalPlaces: 1 }) }),
41972
42117
  /* @__PURE__ */ jsx(form.Field, { name: "purpose", children: (field) => /* @__PURE__ */ jsx(
41973
42118
  TripPurposeComboBox,
41974
42119
  {
41975
- className: `${TRIP_FORM_FIELD_CSS_PREFIX}__Purpose`,
41976
42120
  value: field.state.value,
41977
42121
  onValueChange: (value) => field.handleChange(value != null ? value : TripPurpose.Unreviewed),
41978
- isReadOnly
42122
+ isReadOnly,
42123
+ className: `${TRIP_FORM_FIELD_CSS_PREFIX}__Purpose`
41979
42124
  }
41980
42125
  ) }),
41981
- /* @__PURE__ */ jsx(form.AppField, { name: "startAddress", children: (field) => /* @__PURE__ */ jsx(field.FormTextField, { label: "Start address", inline: true, className: `${TRIP_FORM_FIELD_CSS_PREFIX}__StartAddress`, isReadOnly }) }),
41982
- /* @__PURE__ */ jsx(form.AppField, { name: "endAddress", children: (field) => /* @__PURE__ */ jsx(field.FormTextField, { label: "End address", inline: true, className: `${TRIP_FORM_FIELD_CSS_PREFIX}__EndAddress`, isReadOnly }) }),
41983
- /* @__PURE__ */ jsx(form.AppField, { name: "description", children: (field) => /* @__PURE__ */ jsx(field.FormTextAreaField, { label: "Description", inline: true, className: `${TRIP_FORM_FIELD_CSS_PREFIX}__Description`, isReadOnly }) }),
41984
- /* @__PURE__ */ jsx(VStack, { justify: "end", className: `${TRIP_FORM_CSS_PREFIX}__Submit`, children: /* @__PURE__ */ jsx(form.Subscribe, { selector: (state) => [state.canSubmit, state.isSubmitting], children: ([canSubmit, isSubmitting]) => /* @__PURE__ */ jsx(Button, { type: "submit", isDisabled: !canSubmit, isPending: isSubmitting, onPress: () => {
41985
- void form.handleSubmit();
41986
- }, children: "Save Trip" }) }) })
42126
+ /* @__PURE__ */ jsx(form.AppField, { name: "description", children: (field) => /* @__PURE__ */ jsx(
42127
+ field.FormTextAreaField,
42128
+ {
42129
+ label: "Description",
42130
+ inline: true,
42131
+ isReadOnly,
42132
+ placeholder: "Add description",
42133
+ className: `${TRIP_FORM_FIELD_CSS_PREFIX}__Description`
42134
+ }
42135
+ ) }),
42136
+ /* @__PURE__ */ jsx(form.Field, { name: "vehicle", children: (field) => /* @__PURE__ */ jsx(
42137
+ VehicleSelector,
42138
+ {
42139
+ selectedVehicle: field.state.value,
42140
+ onSelectedVehicleChange: field.handleChange,
42141
+ isReadOnly,
42142
+ inline: true,
42143
+ placeholder: "Add vehicle",
42144
+ containerClassName: `${TRIP_FORM_FIELD_CSS_PREFIX}__Vehicle`
42145
+ }
42146
+ ) }),
42147
+ /* @__PURE__ */ jsx(VStack, { justify: "end", className: `${TRIP_FORM_CSS_PREFIX}__Submit`, children: /* @__PURE__ */ jsx(form.Subscribe, { selector: (state) => [state.canSubmit, state.isSubmitting], children: ([canSubmit, isSubmitting]) => /* @__PURE__ */ jsx(
42148
+ Button,
42149
+ {
42150
+ type: "submit",
42151
+ isDisabled: !canSubmit,
42152
+ isPending: isSubmitting,
42153
+ onPress: () => {
42154
+ void form.handleSubmit();
42155
+ },
42156
+ children: "Save Trip"
42157
+ }
42158
+ ) }) })
41987
42159
  ] });
41988
42160
  };
41989
42161
  const TripsTableHeaderMenu = () => {
@@ -42215,32 +42387,40 @@ const TripsTable = () => {
42215
42387
  }
42216
42388
  )
42217
42389
  ] }),
42218
- /* @__PURE__ */ jsx(Drawer, { isOpen: isTripDrawerOpen, onOpenChange: setIsTripDrawerOpen, "aria-label": selectedTrip ? "Trip details" : "Record trip", children: ({ close: close2 }) => /* @__PURE__ */ jsxs(VStack, { pb: "lg", children: [
42219
- /* @__PURE__ */ jsx(VStack, { pi: "md", children: /* @__PURE__ */ jsx(
42220
- ModalTitleWithClose,
42221
- {
42222
- heading: /* @__PURE__ */ jsx(ModalHeading, { size: "md", children: selectedTrip ? "Trip details" : "Record trip" }),
42223
- onClose: close2
42224
- }
42225
- ) }),
42226
- /* @__PURE__ */ jsx(
42227
- TripForm,
42228
- {
42229
- trip: selectedTrip != null ? selectedTrip : void 0,
42230
- onSuccess: () => {
42231
- setSelectedTrip(null);
42232
- close2();
42233
- }
42234
- }
42235
- )
42236
- ] }) })
42390
+ /* @__PURE__ */ jsx(
42391
+ Drawer,
42392
+ {
42393
+ isOpen: isTripDrawerOpen,
42394
+ onOpenChange: setIsTripDrawerOpen,
42395
+ isDismissable: true,
42396
+ "aria-label": selectedTrip ? "Trip details" : "Record trip",
42397
+ children: ({ close: close2 }) => /* @__PURE__ */ jsxs(VStack, { pb: "lg", children: [
42398
+ /* @__PURE__ */ jsx(VStack, { pi: "md", children: /* @__PURE__ */ jsx(
42399
+ ModalTitleWithClose,
42400
+ {
42401
+ heading: /* @__PURE__ */ jsx(ModalHeading, { size: "md", children: selectedTrip ? "Trip details" : "Record trip" }),
42402
+ onClose: close2
42403
+ }
42404
+ ) }),
42405
+ /* @__PURE__ */ jsx(
42406
+ TripForm,
42407
+ {
42408
+ trip: selectedTrip != null ? selectedTrip : void 0,
42409
+ onSuccess: () => {
42410
+ setSelectedTrip(null);
42411
+ close2();
42412
+ }
42413
+ }
42414
+ )
42415
+ ] })
42416
+ }
42417
+ )
42237
42418
  ] });
42238
42419
  };
42239
42420
  const getVehicleFormDefaultValues = (vehicle) => {
42240
42421
  if (vehicle) {
42241
42422
  return {
42242
- make: vehicle.make,
42243
- model: vehicle.model,
42423
+ makeAndModel: vehicle.makeAndModel,
42244
42424
  year: vehicle.year,
42245
42425
  licensePlate: vehicle.licensePlate || "",
42246
42426
  vin: vehicle.vin || "",
@@ -42248,33 +42428,31 @@ const getVehicleFormDefaultValues = (vehicle) => {
42248
42428
  };
42249
42429
  }
42250
42430
  return {
42251
- make: "",
42252
- model: "",
42253
- year: (/* @__PURE__ */ new Date()).getFullYear(),
42431
+ makeAndModel: "",
42432
+ year: Number.NaN,
42254
42433
  licensePlate: "",
42255
42434
  vin: "",
42256
42435
  description: ""
42257
42436
  };
42258
42437
  };
42259
42438
  const validateVehicleForm = ({ vehicle }) => {
42260
- const { make, model, year } = vehicle;
42439
+ const { makeAndModel, year } = vehicle;
42261
42440
  const errors = [];
42262
- if (!make.trim()) {
42263
- errors.push({ make: "Make is a required field." });
42441
+ if (!makeAndModel.trim()) {
42442
+ errors.push({ makeAndModel: "Make and model is a required field." });
42264
42443
  }
42265
- if (!model.trim()) {
42266
- errors.push({ model: "Model is a required field." });
42444
+ if (Number.isNaN(year)) {
42445
+ errors.push({ year: "Year is a required field." });
42267
42446
  }
42268
42447
  const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
42269
- if (year < 1900 || year > currentYear + 1) {
42448
+ if (!Number.isNaN(year) && (year < 1900 || year > currentYear + 1)) {
42270
42449
  errors.push({ year: `Year must be between 1900 and ${currentYear + 1}.` });
42271
42450
  }
42272
42451
  return errors.length > 0 ? errors : null;
42273
42452
  };
42274
42453
  const convertVehicleFormToUpsertVehicle = (form) => {
42275
42454
  return {
42276
- make: form.make.trim(),
42277
- model: form.model.trim(),
42455
+ makeAndModel: form.makeAndModel.trim(),
42278
42456
  year: form.year,
42279
42457
  licensePlate: form.licensePlate.trim() || null,
42280
42458
  vin: form.vin.trim() || null,
@@ -42464,20 +42642,73 @@ const VehicleForm = (props) => {
42464
42642
  ) });
42465
42643
  }
42466
42644
  } }),
42467
- /* @__PURE__ */ jsx(form.AppField, { name: "make", children: (field) => /* @__PURE__ */ jsx(field.FormTextField, { label: "Make", inline: true, className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__Make`, isReadOnly }) }),
42468
- /* @__PURE__ */ jsx(form.AppField, { name: "model", children: (field) => /* @__PURE__ */ jsx(field.FormTextField, { label: "Model", inline: true, className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__Model`, isReadOnly }) }),
42469
- /* @__PURE__ */ jsx(form.AppField, { name: "year", children: (field) => /* @__PURE__ */ jsx(field.FormNumberField, { maxValue: 9999, label: "Year", inline: true, className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__Year`, isReadOnly }) }),
42470
- /* @__PURE__ */ jsx(form.AppField, { name: "licensePlate", children: (field) => /* @__PURE__ */ jsx(field.FormTextField, { label: "License plate", inline: true, className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__LicensePlate`, isReadOnly }) }),
42471
- /* @__PURE__ */ jsx(form.AppField, { name: "vin", children: (field) => /* @__PURE__ */ jsx(field.FormTextField, { label: "VIN", inline: true, className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__Vin`, isReadOnly }) }),
42472
- /* @__PURE__ */ jsx(form.AppField, { name: "description", children: (field) => /* @__PURE__ */ jsx(field.FormTextAreaField, { label: "Description", inline: true, className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__Description`, isReadOnly }) }),
42473
- /* @__PURE__ */ jsx(VStack, { justify: "end", className: `${VEHICLE_FORM_CSS_PREFIX}__Submit`, children: /* @__PURE__ */ jsx(form.Subscribe, { selector: (state) => [state.canSubmit, state.isSubmitting], children: ([canSubmit, isSubmitting]) => /* @__PURE__ */ jsx(Button, { type: "submit", isDisabled: !canSubmit, isPending: isSubmitting, onPress: () => {
42474
- void form.handleSubmit();
42475
- }, children: "Save Vehicle" }) }) })
42645
+ /* @__PURE__ */ jsx(form.AppField, { name: "makeAndModel", children: (field) => /* @__PURE__ */ jsx(
42646
+ field.FormTextField,
42647
+ {
42648
+ label: "Make and model",
42649
+ inline: true,
42650
+ isReadOnly,
42651
+ placeholder: "Enter vehicle make and model",
42652
+ className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__MakeAndModel`
42653
+ }
42654
+ ) }),
42655
+ /* @__PURE__ */ jsx(form.AppField, { name: "year", children: (field) => /* @__PURE__ */ jsx(
42656
+ field.FormNumberField,
42657
+ {
42658
+ maxValue: 9999,
42659
+ label: "Year",
42660
+ inline: true,
42661
+ isReadOnly,
42662
+ placeholder: "Enter vehicle year",
42663
+ className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__Year`
42664
+ }
42665
+ ) }),
42666
+ /* @__PURE__ */ jsx(form.AppField, { name: "licensePlate", children: (field) => /* @__PURE__ */ jsx(
42667
+ field.FormTextField,
42668
+ {
42669
+ label: "License plate",
42670
+ inline: true,
42671
+ isReadOnly,
42672
+ placeholder: "Enter license plate",
42673
+ className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__LicensePlate`
42674
+ }
42675
+ ) }),
42676
+ /* @__PURE__ */ jsx(form.AppField, { name: "vin", children: (field) => /* @__PURE__ */ jsx(
42677
+ field.FormTextField,
42678
+ {
42679
+ label: "VIN",
42680
+ inline: true,
42681
+ isReadOnly,
42682
+ placeholder: "Enter VIN",
42683
+ className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__Vin`
42684
+ }
42685
+ ) }),
42686
+ /* @__PURE__ */ jsx(form.AppField, { name: "description", children: (field) => /* @__PURE__ */ jsx(
42687
+ field.FormTextAreaField,
42688
+ {
42689
+ label: "Description",
42690
+ inline: true,
42691
+ isReadOnly,
42692
+ placeholder: "Add description",
42693
+ className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__Description`
42694
+ }
42695
+ ) }),
42696
+ /* @__PURE__ */ jsx(VStack, { justify: "end", className: `${VEHICLE_FORM_CSS_PREFIX}__Submit`, children: /* @__PURE__ */ jsx(form.Subscribe, { selector: (state) => [state.canSubmit, state.isSubmitting], children: ([canSubmit, isSubmitting]) => /* @__PURE__ */ jsx(
42697
+ Button,
42698
+ {
42699
+ type: "submit",
42700
+ isDisabled: !canSubmit,
42701
+ isPending: isSubmitting,
42702
+ onPress: () => {
42703
+ void form.handleSubmit();
42704
+ },
42705
+ children: "Save Vehicle"
42706
+ }
42707
+ ) }) })
42476
42708
  ] });
42477
42709
  };
42478
42710
  const VEHICLE_CARD_FIELDS = [
42479
- { label: "Make", key: "make" },
42480
- { label: "Model", key: "model" },
42711
+ { label: "Make and model", key: "makeAndModel" },
42481
42712
  { label: "Year", key: "year" },
42482
42713
  { label: "License plate", key: "licensePlate" },
42483
42714
  { label: "VIN", key: "vin" },
@@ -43059,6 +43290,20 @@ const BusinessProvider = ({
43059
43290
  }) => {
43060
43291
  errorHandler.setOnError(onError);
43061
43292
  const colors = buildColorsPalette(theme);
43293
+ const eventCallbacksRef = useRef(eventCallbacks);
43294
+ useEffect(() => {
43295
+ eventCallbacksRef.current = eventCallbacks;
43296
+ }, [eventCallbacks]);
43297
+ const stableEventCallbacks = useMemo(() => ({
43298
+ onTransactionCategorized: () => {
43299
+ var _a, _b;
43300
+ (_b = (_a = eventCallbacksRef.current) == null ? void 0 : _a.onTransactionCategorized) == null ? void 0 : _b.call(_a);
43301
+ },
43302
+ onTransactionsFetched: () => {
43303
+ var _a, _b;
43304
+ (_b = (_a = eventCallbacksRef.current) == null ? void 0 : _a.onTransactionsFetched) == null ? void 0 : _b.call(_a);
43305
+ }
43306
+ }), []);
43062
43307
  const [state, dispatch] = useReducer(reducer, {
43063
43308
  businessId,
43064
43309
  business: void 0,
@@ -43203,7 +43448,7 @@ const BusinessProvider = ({
43203
43448
  readTimestamps,
43204
43449
  expireDataCaches: resetCaches,
43205
43450
  hasBeenTouched,
43206
- eventCallbacks,
43451
+ eventCallbacks: stableEventCallbacks,
43207
43452
  accountingConfiguration,
43208
43453
  dateRange
43209
43454
  }),
@@ -43214,14 +43459,14 @@ const BusinessProvider = ({
43214
43459
  }
43215
43460
  );
43216
43461
  };
43217
- const LayerProvider = (_qd) => {
43218
- var _rd = _qd, {
43462
+ const LayerProvider = (_ud) => {
43463
+ var _vd = _ud, {
43219
43464
  appId,
43220
43465
  appSecret,
43221
43466
  businessAccessToken,
43222
43467
  environment,
43223
43468
  usePlaidSandbox
43224
- } = _rd, restProps = __objRest(_rd, [
43469
+ } = _vd, restProps = __objRest(_vd, [
43225
43470
  "appId",
43226
43471
  "appSecret",
43227
43472
  "businessAccessToken",