@layerfi/components 0.1.107-alpha.2 → 0.1.108-alpha

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.
@@ -5570,7 +5570,7 @@ import { useState as useState3 } from "react";
5570
5570
  import { useReducer, useEffect } from "react";
5571
5571
 
5572
5572
  // package.json
5573
- var version = "0.1.107-alpha.2";
5573
+ var version = "0.1.108-alpha";
5574
5574
 
5575
5575
  // src/models/APIError.ts
5576
5576
  var APIError = class _APIError extends Error {
@@ -5943,14 +5943,11 @@ import { differenceInDays, formatISO as formatISO2 } from "date-fns";
5943
5943
  import { ZonedDateTime } from "@internationalized/date";
5944
5944
  var toLocalDateString = (date) => formatISO2(date.valueOf(), { representation: "date" });
5945
5945
  function getDueDifference(dueDate) {
5946
- const today = /* @__PURE__ */ new Date();
5947
- today.setHours(0, 0, 0, 0);
5946
+ const today3 = /* @__PURE__ */ new Date();
5947
+ today3.setHours(0, 0, 0, 0);
5948
5948
  const normalizedDue = new Date(dueDate);
5949
5949
  normalizedDue.setHours(0, 0, 0, 0);
5950
- return differenceInDays(normalizedDue, today);
5951
- }
5952
- function isZonedDateTime(val) {
5953
- return val instanceof ZonedDateTime;
5950
+ return differenceInDays(normalizedDue, today3);
5954
5951
  }
5955
5952
 
5956
5953
  // src/api/layer/profit_and_loss.ts
@@ -6478,10 +6475,10 @@ import { jsx as jsx4 } from "react/jsx-runtime";
6478
6475
  var InAppLinkContext = createContext4({});
6479
6476
  var useInAppLinkContext = () => useContext4(InAppLinkContext);
6480
6477
  var InAppLinkProvider = ({
6481
- convertToInAppLink,
6478
+ renderInAppLink,
6482
6479
  children
6483
6480
  }) => {
6484
- return /* @__PURE__ */ jsx4(InAppLinkContext.Provider, { value: { convertToInAppLink }, children });
6481
+ return /* @__PURE__ */ jsx4(InAppLinkContext.Provider, { value: { renderInAppLink }, children });
6485
6482
  };
6486
6483
 
6487
6484
  // src/schemas/customer.ts
@@ -6616,7 +6613,7 @@ var TransactionLedgerEntrySourceSchema = Schema3.Struct({
6616
6613
  Schema3.fromKey("transaction_id")
6617
6614
  ),
6618
6615
  externalId: pipe3(
6619
- Schema3.propertySignature(Schema3.String),
6616
+ Schema3.propertySignature(Schema3.NullOr(Schema3.String)),
6620
6617
  Schema3.fromKey("external_id")
6621
6618
  ),
6622
6619
  accountName: pipe3(
@@ -6626,7 +6623,7 @@ var TransactionLedgerEntrySourceSchema = Schema3.Struct({
6626
6623
  date: Schema3.String,
6627
6624
  amount: Schema3.Number,
6628
6625
  direction: Schema3.Enums(Direction),
6629
- counterparty: Schema3.optional(Schema3.String),
6626
+ counterparty: Schema3.optional(Schema3.NullOr(Schema3.String)),
6630
6627
  description: Schema3.optional(Schema3.String),
6631
6628
  memo: Schema3.optional(Schema3.NullOr(Schema3.String)),
6632
6629
  metadata: Schema3.optional(Schema3.NullOr(Schema3.Unknown)),
@@ -6650,7 +6647,7 @@ var InvoiceLedgerEntrySourceSchema = Schema3.Struct({
6650
6647
  Schema3.fromKey("invoice_id")
6651
6648
  ),
6652
6649
  externalId: pipe3(
6653
- Schema3.propertySignature(Schema3.String),
6650
+ Schema3.propertySignature(Schema3.NullOr(Schema3.String)),
6654
6651
  Schema3.fromKey("external_id")
6655
6652
  ),
6656
6653
  invoiceNumber: pipe3(
@@ -6658,7 +6655,7 @@ var InvoiceLedgerEntrySourceSchema = Schema3.Struct({
6658
6655
  Schema3.fromKey("invoice_number")
6659
6656
  ),
6660
6657
  recipientName: pipe3(
6661
- Schema3.propertySignature(Schema3.String),
6658
+ Schema3.propertySignature(Schema3.NullOr(Schema3.String)),
6662
6659
  Schema3.fromKey("recipient_name")
6663
6660
  ),
6664
6661
  customerDescription: pipe3(
@@ -6714,7 +6711,7 @@ var InvoicePaymentLedgerEntrySourceSchema = Schema3.Struct({
6714
6711
  ),
6715
6712
  type: Schema3.Literal("Invoice_Payment_Ledger_Entry_Source"),
6716
6713
  externalId: pipe3(
6717
- Schema3.propertySignature(Schema3.String),
6714
+ Schema3.propertySignature(Schema3.NullOr(Schema3.String)),
6718
6715
  Schema3.fromKey("external_id")
6719
6716
  ),
6720
6717
  invoiceId: pipe3(
@@ -6864,7 +6861,7 @@ var PayoutLedgerEntrySourceSchema = Schema3.Struct({
6864
6861
  Schema3.fromKey("payout_id")
6865
6862
  ),
6866
6863
  externalId: pipe3(
6867
- Schema3.propertySignature(Schema3.String),
6864
+ Schema3.propertySignature(Schema3.NullOr(Schema3.String)),
6868
6865
  Schema3.fromKey("external_id")
6869
6866
  ),
6870
6867
  paidOutAmount: pipe3(
@@ -13404,30 +13401,32 @@ var Spacer = () => /* @__PURE__ */ jsx68("div", { className: "Layer__Spacer" });
13404
13401
 
13405
13402
  // src/components/BaseConfirmationModal/BaseConfirmationModal.tsx
13406
13403
  import { useCallback as useCallback10, useState as useState13 } from "react";
13407
- import { jsx as jsx69, jsxs as jsxs35 } from "react/jsx-runtime";
13404
+ import { Fragment as Fragment6, jsx as jsx69, jsxs as jsxs35 } from "react/jsx-runtime";
13408
13405
  function BaseConfirmationModal({
13409
13406
  isOpen,
13410
13407
  onOpenChange,
13411
13408
  title,
13412
13409
  description,
13410
+ content,
13413
13411
  onConfirm,
13414
13412
  confirmLabel = "Confirm",
13415
13413
  retryLabel = "Retry",
13416
13414
  cancelLabel = "Cancel",
13417
- errorText
13415
+ errorText,
13416
+ closeOnConfirm = true
13418
13417
  }) {
13419
13418
  const [isProcessing, setIsProcessing] = useState13(false);
13420
13419
  const [error, setError] = useState13(null);
13421
13420
  const onClickConfirm = useCallback10((close2) => {
13422
13421
  setIsProcessing(true);
13423
13422
  void Promise.resolve(onConfirm()).then(() => {
13424
- close2();
13423
+ if (closeOnConfirm) close2();
13425
13424
  }).catch((e) => {
13426
13425
  setError(e);
13427
13426
  }).finally(() => {
13428
13427
  setIsProcessing(false);
13429
13428
  });
13430
- }, [onConfirm]);
13429
+ }, [closeOnConfirm, onConfirm]);
13431
13430
  const getErrorMessage = (error2, errorText2) => {
13432
13431
  var _a;
13433
13432
  if (error2 === null) return null;
@@ -13436,32 +13435,31 @@ function BaseConfirmationModal({
13436
13435
  };
13437
13436
  return /* @__PURE__ */ jsx69(Modal, { flexBlock: true, isOpen, onOpenChange, role: "alertdialog", children: ({ close: close2 }) => {
13438
13437
  var _a;
13439
- return /* @__PURE__ */ jsxs35(VStack, { gap: "2xs", children: [
13440
- /* @__PURE__ */ jsx69(
13438
+ return /* @__PURE__ */ jsxs35(Fragment6, { children: [
13439
+ /* @__PURE__ */ jsx69(VStack, { pbe: "2xs", children: /* @__PURE__ */ jsx69(
13441
13440
  ModalTitleWithClose,
13442
13441
  {
13443
13442
  heading: /* @__PURE__ */ jsx69(ModalHeading, { size: "lg", children: title }),
13444
13443
  onClose: close2
13445
13444
  }
13446
- ),
13447
- /* @__PURE__ */ jsxs35(VStack, { children: [
13448
- /* @__PURE__ */ jsx69(ModalDescription, { children: description }),
13449
- /* @__PURE__ */ jsx69(ModalActions, { children: /* @__PURE__ */ jsxs35(HStack, { gap: "md", children: [
13450
- /* @__PURE__ */ jsx69(Spacer, {}),
13451
- /* @__PURE__ */ jsx69(Button, { variant: "secondary" /* secondary */, onClick: close2, children: cancelLabel }),
13452
- /* @__PURE__ */ jsx69(
13453
- SubmitButton,
13454
- {
13455
- onClick: () => onClickConfirm(close2),
13456
- processing: isProcessing,
13457
- error: (_a = getErrorMessage(error, errorText)) != null ? _a : "",
13458
- withRetry: true,
13459
- noIcon: !isProcessing,
13460
- children: error ? retryLabel : confirmLabel
13461
- }
13462
- )
13463
- ] }) })
13464
- ] })
13445
+ ) }),
13446
+ description && /* @__PURE__ */ jsx69(ModalDescription, { children: description }),
13447
+ content && /* @__PURE__ */ jsx69(ModalContent, { children: content }),
13448
+ /* @__PURE__ */ jsx69(ModalActions, { children: /* @__PURE__ */ jsxs35(HStack, { gap: "md", children: [
13449
+ /* @__PURE__ */ jsx69(Spacer, {}),
13450
+ /* @__PURE__ */ jsx69(Button, { variant: "secondary" /* secondary */, onClick: close2, children: cancelLabel }),
13451
+ /* @__PURE__ */ jsx69(
13452
+ SubmitButton,
13453
+ {
13454
+ onClick: () => onClickConfirm(close2),
13455
+ processing: isProcessing,
13456
+ error: (_a = getErrorMessage(error, errorText)) != null ? _a : "",
13457
+ withRetry: true,
13458
+ noIcon: !isProcessing,
13459
+ children: error ? retryLabel : confirmLabel
13460
+ }
13461
+ )
13462
+ ] }) })
13465
13463
  ] });
13466
13464
  } });
13467
13465
  }
@@ -13692,7 +13690,7 @@ import { Check } from "lucide-react";
13692
13690
  import { useMemo as useMemo13 } from "react";
13693
13691
  import { Checkbox as ReactAriaCheckbox } from "react-aria-components";
13694
13692
  import classNames24 from "classnames";
13695
- import { Fragment as Fragment6, jsx as jsx73, jsxs as jsxs37 } from "react/jsx-runtime";
13693
+ import { Fragment as Fragment7, jsx as jsx73, jsxs as jsxs37 } from "react/jsx-runtime";
13696
13694
  var CLASS_NAME3 = "Layer__Checkbox";
13697
13695
  function Checkbox(_a) {
13698
13696
  var _b = _a, { children, className, variant = "default", size = "md" } = _b, props = __objRest(_b, ["children", "className", "variant", "size"]);
@@ -13705,7 +13703,7 @@ function Checkbox(_a) {
13705
13703
  ReactAriaCheckbox,
13706
13704
  __spreadProps(__spreadValues(__spreadValues({}, dataProperties), props), {
13707
13705
  className: classNames24(CLASS_NAME3, className),
13708
- children: withRenderProp(children, (node) => /* @__PURE__ */ jsxs37(Fragment6, { children: [
13706
+ children: withRenderProp(children, (node) => /* @__PURE__ */ jsxs37(Fragment7, { children: [
13709
13707
  /* @__PURE__ */ jsx73("div", { slot: "checkbox", children: /* @__PURE__ */ jsx73(Check, { size: size === "lg" ? 16 : 12 }) }),
13710
13708
  node
13711
13709
  ] }))
@@ -13857,7 +13855,7 @@ function useConfirmAndExcludeMultiple({ onSuccess }) {
13857
13855
  }
13858
13856
 
13859
13857
  // src/components/LinkedAccounts/ConfirmationModal/LinkedAccountsConfirmationModal.tsx
13860
- import { Fragment as Fragment7, jsx as jsx76, jsxs as jsxs40 } from "react/jsx-runtime";
13858
+ import { Fragment as Fragment8, jsx as jsx76, jsxs as jsxs40 } from "react/jsx-runtime";
13861
13859
  function getButtonLabel({ totalCount, confirmedCount }) {
13862
13860
  if (confirmedCount === totalCount) {
13863
13861
  return totalCount > 1 ? "Confirm All Accounts" : "Confirm Account";
@@ -13941,7 +13939,7 @@ function LinkedAccountsConfirmationModalContent({ onClose }) {
13941
13939
  }
13942
13940
  });
13943
13941
  const { descriptionLabel, buttonLabel } = getFormComponentLabels(formState);
13944
- return /* @__PURE__ */ jsxs40(Fragment7, { children: [
13942
+ return /* @__PURE__ */ jsxs40(Fragment8, { children: [
13945
13943
  /* @__PURE__ */ jsx76(
13946
13944
  ModalTitleWithClose,
13947
13945
  {
@@ -13972,7 +13970,7 @@ function LinkedAccountsConfirmationModalContent({ onClose }) {
13972
13970
  }
13973
13971
  }
13974
13972
  ) }),
13975
- /* @__PURE__ */ jsx76(ModalActions, { children: /* @__PURE__ */ jsx76(VStack, { gap: "md", children: hasError ? /* @__PURE__ */ jsxs40(Fragment7, { children: [
13973
+ /* @__PURE__ */ jsx76(ModalActions, { children: /* @__PURE__ */ jsx76(VStack, { gap: "md", children: hasError ? /* @__PURE__ */ jsxs40(Fragment8, { children: [
13976
13974
  /* @__PURE__ */ jsx76(P, { size: "sm", children: "An error occurred while confirming accounts. You will have an opportunity to try again later." }),
13977
13975
  /* @__PURE__ */ jsx76(P, { size: "sm", children: "No data will be synced until you confirm." }),
13978
13976
  /* @__PURE__ */ jsx76(Button2, { onPress: close, children: "Close" })
@@ -13998,7 +13996,7 @@ function LinkedAccountsConfirmationModal() {
13998
13996
  }
13999
13997
 
14000
13998
  // src/components/LinkedAccounts/LinkedAccountsContent.tsx
14001
- import { Fragment as Fragment8, jsx as jsx77, jsxs as jsxs41 } from "react/jsx-runtime";
13999
+ import { Fragment as Fragment9, jsx as jsx77, jsxs as jsxs41 } from "react/jsx-runtime";
14002
14000
  var LinkedAccountsContent = ({
14003
14001
  asWidget,
14004
14002
  showLedgerBalance,
@@ -14013,7 +14011,7 @@ var LinkedAccountsContent = ({
14013
14011
  showUnlinkItem && "--show-unlink-item",
14014
14012
  showBreakConnection && "--show-break-connection"
14015
14013
  );
14016
- return /* @__PURE__ */ jsxs41(Fragment8, { children: [
14014
+ return /* @__PURE__ */ jsxs41(Fragment9, { children: [
14017
14015
  /* @__PURE__ */ jsxs41("div", { className: "Layer__linked-accounts__list", children: [
14018
14016
  data == null ? void 0 : data.map((account, index) => /* @__PURE__ */ jsx77(
14019
14017
  LinkedAccountItemThumb,
@@ -14201,7 +14199,7 @@ var UploadCloud2 = (_a) => {
14201
14199
  var UploadCloud_default = UploadCloud2;
14202
14200
 
14203
14201
  // src/components/Input/FileInput.tsx
14204
- import { Fragment as Fragment9, jsx as jsx81, jsxs as jsxs45 } from "react/jsx-runtime";
14202
+ import { Fragment as Fragment10, jsx as jsx81, jsxs as jsxs45 } from "react/jsx-runtime";
14205
14203
  var FileInput = ({
14206
14204
  text = "Upload",
14207
14205
  onUpload,
@@ -14224,7 +14222,7 @@ var FileInput = ({
14224
14222
  }
14225
14223
  };
14226
14224
  if (secondary) {
14227
- return /* @__PURE__ */ jsxs45(Fragment9, { children: [
14225
+ return /* @__PURE__ */ jsxs45(Fragment10, { children: [
14228
14226
  /* @__PURE__ */ jsx81(TextButton, { onClick, disabled, children: text }),
14229
14227
  /* @__PURE__ */ jsx81(
14230
14228
  "input",
@@ -14238,7 +14236,7 @@ var FileInput = ({
14238
14236
  )
14239
14237
  ] });
14240
14238
  }
14241
- return /* @__PURE__ */ jsxs45(Fragment9, { children: [
14239
+ return /* @__PURE__ */ jsxs45(Fragment10, { children: [
14242
14240
  /* @__PURE__ */ jsx81(
14243
14241
  Button,
14244
14242
  {
@@ -14554,7 +14552,7 @@ import {
14554
14552
  subQuarters,
14555
14553
  subYears
14556
14554
  } from "date-fns";
14557
- import { Fragment as Fragment10, jsx as jsx88 } from "react/jsx-runtime";
14555
+ import { Fragment as Fragment11, jsx as jsx88 } from "react/jsx-runtime";
14558
14556
  var DatePickerOptions = ({
14559
14557
  customDateRanges = [
14560
14558
  {
@@ -14605,7 +14603,7 @@ var DatePickerOptions = ({
14605
14603
  );
14606
14604
  optionsComponents.push(...customOptionComponents);
14607
14605
  if (optionsComponents.length === 0) {
14608
- return /* @__PURE__ */ jsx88(Fragment10, {});
14606
+ return /* @__PURE__ */ jsx88(Fragment11, {});
14609
14607
  }
14610
14608
  return /* @__PURE__ */ jsx88("div", { className: "Layer__datepicker__popper__custom-footer", children: optionsComponents });
14611
14609
  };
@@ -14613,7 +14611,7 @@ var DatePickerOptions = ({
14613
14611
  // src/components/DatePicker/DatePicker.tsx
14614
14612
  import classNames32 from "classnames";
14615
14613
  import { endOfDay as endOfDay2, endOfMonth as endOfMonth4, endOfYear as endOfYear3, getYear } from "date-fns";
14616
- import { Fragment as Fragment11, jsx as jsx89, jsxs as jsxs51 } from "react/jsx-runtime";
14614
+ import { Fragment as Fragment12, jsx as jsx89, jsxs as jsxs51 } from "react/jsx-runtime";
14617
14615
  var ReactDatePicker = RDP.default.default || RDP.default || RDP;
14618
14616
  var isRangeMode = (displayMode) => displayMode === "dayRangePicker" || displayMode === "monthRangePicker";
14619
14617
  var showNavigationArrows = (navigateArrows, isDesktop) => {
@@ -14915,7 +14913,7 @@ var DatePicker = (_a) => {
14915
14913
  ]
14916
14914
  })
14917
14915
  ),
14918
- showNavigationArrows(navigateArrows, isDesktop) && /* @__PURE__ */ jsxs51(Fragment11, { children: [
14916
+ showNavigationArrows(navigateArrows, isDesktop) && /* @__PURE__ */ jsxs51(Fragment12, { children: [
14919
14917
  /* @__PURE__ */ jsxs51(
14920
14918
  Button,
14921
14919
  {
@@ -16054,7 +16052,7 @@ var flattenOptionGroups = (options3) => {
16054
16052
  return options3.flatMap(
16055
16053
  (opt) => {
16056
16054
  var _a;
16057
- return ((_a = opt.value) == null ? void 0 : _a.type) === "GROUP" && Array.isArray(opt.value.items) ? flattenOptionGroups(opt.value.items) : [opt];
16055
+ return ((_a = opt.value) == null ? void 0 : _a.type) === "GROUP" && Array.isArray(opt.value.items) ? [opt, ...flattenOptionGroups(opt.value.items)] : [opt];
16058
16056
  }
16059
16057
  );
16060
16058
  };
@@ -16168,18 +16166,21 @@ var BusinessCategories = ({
16168
16166
  const [optionsToShow, setOptionsToShow] = useState20(categoryOptions);
16169
16167
  const [selectedGroup, setSelectedGroup] = useState20();
16170
16168
  const filteredOptions = useMemo18(() => {
16171
- const sortedOptions = optionsToShow.sort((a, b) => a.label.localeCompare(b.label));
16172
- if (!query) return sortedOptions;
16173
- const lower = query.toLowerCase();
16174
- const flattenedOptions = flattenOptionGroups(sortedOptions);
16175
- return flattenedOptions.filter(
16176
- (opt) => opt.label.toLowerCase().includes(lower)
16177
- );
16169
+ let options3 = optionsToShow;
16170
+ if (query) {
16171
+ const lower = query.toLowerCase();
16172
+ const flattenedOptions = flattenOptionGroups(options3);
16173
+ options3 = flattenedOptions.filter(
16174
+ (opt) => opt.label.toLowerCase().includes(lower)
16175
+ );
16176
+ }
16177
+ return options3.sort((a, b) => a.label.localeCompare(b.label));
16178
16178
  }, [optionsToShow, query]);
16179
16179
  const onCategorySelect = (v) => {
16180
16180
  if (v.value.type === "GROUP" && v.value.items) {
16181
16181
  setOptionsToShow(v.value.items);
16182
16182
  setSelectedGroup(v.label);
16183
+ setQuery("");
16183
16184
  return;
16184
16185
  }
16185
16186
  select(v);
@@ -16187,13 +16188,14 @@ var BusinessCategories = ({
16187
16188
  const clearSelectedGroup = useCallback13(() => {
16188
16189
  setOptionsToShow(categoryOptions);
16189
16190
  setSelectedGroup(void 0);
16191
+ setQuery("");
16190
16192
  }, [categoryOptions]);
16191
16193
  return /* @__PURE__ */ jsxs63(VStack, { className: "Layer__bank-transaction-mobile-list-item__categories_list-container", pbs: "lg", gap: "md", children: [
16192
16194
  /* @__PURE__ */ jsxs63(VStack, { pis: "sm", pie: "sm", gap: "md", children: [
16193
16195
  /* @__PURE__ */ jsx103(HStack, { pis: "xs", children: selectedGroup ? /* @__PURE__ */ jsxs63(Button2, { variant: "text", onClick: clearSelectedGroup, children: [
16194
16196
  /* @__PURE__ */ jsx103(ChevronLeft2, { size: 18 }),
16195
- /* @__PURE__ */ jsx103(Span, { size: "lg", weight: "bold", align: "center", children: selectedGroup })
16196
- ] }) : /* @__PURE__ */ jsx103(Span, { size: "lg", weight: "bold", children: "Select category" }) }),
16197
+ /* @__PURE__ */ jsx103(ModalHeading, { size: "sm", weight: "bold", align: "center", children: selectedGroup })
16198
+ ] }) : /* @__PURE__ */ jsx103(ModalHeading, { size: "sm", weight: "bold", children: "Select category" }) }),
16197
16199
  /* @__PURE__ */ jsx103(SearchField, { value: query, onChange: setQuery, label: "Search categories..." })
16198
16200
  ] }),
16199
16201
  /* @__PURE__ */ jsx103(
@@ -16453,7 +16455,7 @@ var convertMatchDetailsToLinkingMetadata = (matchDetails) => {
16453
16455
 
16454
16456
  // src/components/CategorySelect/CategorySelect.tsx
16455
16457
  import { useCallback as useCallback14, useState as useState21 } from "react";
16456
- import { Fragment as Fragment12, jsx as jsx105, jsxs as jsxs64 } from "react/jsx-runtime";
16458
+ import { Fragment as Fragment13, jsx as jsx105, jsxs as jsxs64 } from "react/jsx-runtime";
16457
16459
  var mapCategoryToOption2 = (category) => {
16458
16460
  var _a, _b;
16459
16461
  return {
@@ -16515,7 +16517,7 @@ var Option2 = (props) => {
16515
16517
  return null;
16516
16518
  }
16517
16519
  if (props.data.type === "match") {
16518
- const inAppLink = props.convertToInAppLink && props.data.payload.details ? props.convertToInAppLink(convertMatchDetailsToLinkingMetadata(props.data.payload.details)) : null;
16520
+ const inAppLink = props.renderInAppLink && props.data.payload.details ? props.renderInAppLink(convertMatchDetailsToLinkingMetadata(props.data.payload.details)) : null;
16519
16521
  return /* @__PURE__ */ jsxs64(
16520
16522
  components3.Option,
16521
16523
  __spreadProps(__spreadValues({}, props), {
@@ -16604,7 +16606,7 @@ var CategorySelect = ({
16604
16606
  }) => {
16605
16607
  var _a, _b, _c, _d;
16606
16608
  const { data: categories } = useCategories();
16607
- const { convertToInAppLink } = useInAppLinkContext();
16609
+ const { renderInAppLink } = useInAppLinkContext();
16608
16610
  const [isDrawerOpen, setIsDrawerOpen] = useState21(false);
16609
16611
  const onSelect = useCallback14((option) => {
16610
16612
  if (option.value.payload) {
@@ -16651,7 +16653,7 @@ var CategorySelect = ({
16651
16653
  const selected = value ? value : !excludeMatches && (matchOptions == null ? void 0 : matchOptions.length) === 1 && matchOptions[0].options.length === 1 ? matchOptions[0].options[0] : void 0;
16652
16654
  const placeholder = (matchOptions == null ? void 0 : matchOptions.length) === 1 && matchOptions[0].options.length > 1 ? `${matchOptions[0].options.length} possible matches...` : "Categorize or match...";
16653
16655
  if (asDrawer) {
16654
- return /* @__PURE__ */ jsxs64(Fragment12, { children: [
16656
+ return /* @__PURE__ */ jsxs64(Fragment13, { children: [
16655
16657
  /* @__PURE__ */ jsxs64(
16656
16658
  "button",
16657
16659
  {
@@ -16715,7 +16717,7 @@ var CategorySelect = ({
16715
16717
  components: {
16716
16718
  DropdownIndicator,
16717
16719
  GroupHeading,
16718
- Option: (optionProps) => /* @__PURE__ */ jsx105(Option2, __spreadProps(__spreadValues({}, optionProps), { showTooltips, convertToInAppLink }))
16720
+ Option: (optionProps) => /* @__PURE__ */ jsx105(Option2, __spreadProps(__spreadValues({}, optionProps), { showTooltips, renderInAppLink }))
16719
16721
  },
16720
16722
  isDisabled: disabled,
16721
16723
  isOptionDisabled: (option) => {
@@ -17384,7 +17386,7 @@ var MatchForm = ({
17384
17386
  }) => {
17385
17387
  const bookkeepingStatus = useEffectiveBookkeepingStatus();
17386
17388
  const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
17387
- const { convertToInAppLink } = useInAppLinkContext();
17389
+ const { renderInAppLink } = useInAppLinkContext();
17388
17390
  const {
17389
17391
  suggested_matches: suggestedMatches = [],
17390
17392
  match
@@ -17400,12 +17402,12 @@ var MatchForm = ({
17400
17402
  /* @__PURE__ */ jsx114("div", { className: `${classNamePrefix}__match-table__date`, children: "Date" }),
17401
17403
  /* @__PURE__ */ jsx114("div", { className: `${classNamePrefix}__match-table__desc`, children: "Description" }),
17402
17404
  /* @__PURE__ */ jsx114("div", { className: `${classNamePrefix}__match-table__amount`, children: "Amount" }),
17403
- convertToInAppLink && /* @__PURE__ */ jsx114("div", { className: `${classNamePrefix}__match-table__link`, children: "Link" }),
17405
+ renderInAppLink && /* @__PURE__ */ jsx114("div", { className: `${classNamePrefix}__match-table__link`, children: "Link" }),
17404
17406
  match && /* @__PURE__ */ jsx114("div", { className: `${classNamePrefix}__match-table__status` })
17405
17407
  ] }),
17406
17408
  effectiveSuggestedMatches.map((suggestedMatch) => {
17407
17409
  var _a;
17408
- const inAppLink = convertToInAppLink ? convertToInAppLink(convertMatchDetailsToLinkingMetadata(suggestedMatch.details)) : null;
17410
+ const inAppLink = renderInAppLink ? renderInAppLink(convertMatchDetailsToLinkingMetadata(suggestedMatch.details)) : null;
17409
17411
  return /* @__PURE__ */ jsxs71(
17410
17412
  "div",
17411
17413
  {
@@ -17499,10 +17501,10 @@ var MatchFormMobile = ({
17499
17501
  readOnly
17500
17502
  }) => {
17501
17503
  var _a;
17502
- const { convertToInAppLink } = useInAppLinkContext();
17504
+ const { renderInAppLink } = useInAppLinkContext();
17503
17505
  return /* @__PURE__ */ jsxs72("div", { className: `${classNamePrefix}__match-list`, children: [
17504
17506
  (_a = bankTransaction.suggested_matches) == null ? void 0 : _a.map((match, idx) => {
17505
- const inAppLink = convertToInAppLink ? convertToInAppLink(convertMatchDetailsToLinkingMetadata(match.details)) : null;
17507
+ const inAppLink = renderInAppLink ? renderInAppLink(convertMatchDetailsToLinkingMetadata(match.details)) : null;
17506
17508
  return /* @__PURE__ */ jsxs72(
17507
17509
  "div",
17508
17510
  {
@@ -18558,6 +18560,7 @@ function ComboBox(_a) {
18558
18560
  options: options3 != null ? options3 : groups,
18559
18561
  onInputChange: onInputValueChange,
18560
18562
  escapeClearsValue: true,
18563
+ menuPortalTarget: document.body,
18561
18564
  placeholder,
18562
18565
  unstyled: true,
18563
18566
  className,
@@ -18579,6 +18582,10 @@ function ComboBox(_a) {
18579
18582
  menuList: () => COMBO_BOX_CLASS_NAMES.MENU_LIST,
18580
18583
  group: () => COMBO_BOX_CLASS_NAMES.GROUP
18581
18584
  },
18585
+ styles: {
18586
+ // Ensure the menu portal appears stacked above modals
18587
+ menuPortal: (base) => __spreadProps(__spreadValues({}, base), { zIndex: 101 })
18588
+ },
18582
18589
  components: {
18583
18590
  GroupHeading: CustomGroupHeadingRef.current,
18584
18591
  Option: CustomComboBoxOption,
@@ -19789,7 +19796,7 @@ function BankTransactionFormFields({
19789
19796
  }
19790
19797
 
19791
19798
  // src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
19792
- import { Fragment as Fragment13, jsx as jsx130, jsxs as jsxs80 } from "react/jsx-runtime";
19799
+ import { Fragment as Fragment14, jsx as jsx130, jsxs as jsxs80 } from "react/jsx-runtime";
19793
19800
  var isAlreadyMatched2 = (bankTransaction) => {
19794
19801
  var _a;
19795
19802
  if (bankTransaction == null ? void 0 : bankTransaction.match) {
@@ -20016,7 +20023,7 @@ var ExpandedBankTransactionRow = forwardRef15(
20016
20023
  selected: purpose,
20017
20024
  onChange: onChangePurpose
20018
20025
  }
20019
- ) }) : /* @__PURE__ */ jsx130(Fragment13, {}),
20026
+ ) }) : /* @__PURE__ */ jsx130(Fragment14, {}),
20020
20027
  /* @__PURE__ */ jsxs80(
20021
20028
  "div",
20022
20029
  {
@@ -20141,7 +20148,7 @@ var ExpandedBankTransactionRow = forwardRef15(
20141
20148
  variant: "secondary" /* secondary */,
20142
20149
  children: "Split"
20143
20150
  }
20144
- ) }) : /* @__PURE__ */ jsx130(Fragment13, {})
20151
+ ) }) : /* @__PURE__ */ jsx130(Fragment14, {})
20145
20152
  ] })
20146
20153
  ] })
20147
20154
  }
@@ -20506,7 +20513,7 @@ function useDelayedVisibility({
20506
20513
  }
20507
20514
 
20508
20515
  // src/components/BankTransactionRow/BankTransactionRow.tsx
20509
- import { Fragment as Fragment14, jsx as jsx137, jsxs as jsxs85 } from "react/jsx-runtime";
20516
+ import { Fragment as Fragment15, jsx as jsx137, jsxs as jsxs85 } from "react/jsx-runtime";
20510
20517
  var extractDescriptionForSplit = (category) => {
20511
20518
  if (!category || !category.entries) {
20512
20519
  return "";
@@ -20619,7 +20626,7 @@ var BankTransactionRow = ({
20619
20626
  () => toDataProperties({ "show-receipt-upload-column": showReceiptUploadColumn }),
20620
20627
  [showReceiptUploadColumn]
20621
20628
  );
20622
- return /* @__PURE__ */ jsxs85(Fragment14, { children: [
20629
+ return /* @__PURE__ */ jsxs85(Fragment15, { children: [
20623
20630
  /* @__PURE__ */ jsxs85("tr", { className: rowClassName, children: [
20624
20631
  /* @__PURE__ */ jsx137(
20625
20632
  "td",
@@ -20712,7 +20719,7 @@ var BankTransactionRow = ({
20712
20719
  }
20713
20720
  ) : null,
20714
20721
  categorized && !open2 ? /* @__PURE__ */ jsxs85(Text, { as: "span", className: `${className}__category-text`, children: [
20715
- bankTransaction.categorization_status === "SPLIT" /* SPLIT */ && /* @__PURE__ */ jsxs85(Fragment14, { children: [
20722
+ bankTransaction.categorization_status === "SPLIT" /* SPLIT */ && /* @__PURE__ */ jsxs85(Fragment15, { children: [
20716
20723
  /* @__PURE__ */ jsx137(
20717
20724
  Badge,
20718
20725
  {
@@ -20729,7 +20736,7 @@ var BankTransactionRow = ({
20729
20736
  ),
20730
20737
  /* @__PURE__ */ jsx137("span", { className: `${className}__category-text__text`, children: extractDescriptionForSplit(bankTransaction.category) })
20731
20738
  ] }),
20732
- (bankTransaction == null ? void 0 : bankTransaction.categorization_status) === "MATCHED" /* MATCHED */ && (bankTransaction == null ? void 0 : bankTransaction.match) && /* @__PURE__ */ jsxs85(Fragment14, { children: [
20739
+ (bankTransaction == null ? void 0 : bankTransaction.categorization_status) === "MATCHED" /* MATCHED */ && (bankTransaction == null ? void 0 : bankTransaction.match) && /* @__PURE__ */ jsxs85(Fragment15, { children: [
20733
20740
  /* @__PURE__ */ jsx137(
20734
20741
  MatchBadge,
20735
20742
  {
@@ -20826,11 +20833,11 @@ var BankTransactionRow = ({
20826
20833
 
20827
20834
  // src/components/BankTransactionList/Assignment.tsx
20828
20835
  import { parseISO as parseISO10, format as formatTime7 } from "date-fns";
20829
- import { Fragment as Fragment15, jsx as jsx138, jsxs as jsxs86 } from "react/jsx-runtime";
20836
+ import { Fragment as Fragment16, jsx as jsx138, jsxs as jsxs86 } from "react/jsx-runtime";
20830
20837
  var Assignment = ({ bankTransaction }) => {
20831
20838
  var _a, _b, _c, _d;
20832
20839
  if (bankTransaction.match && bankTransaction.categorization_status === "MATCHED" /* MATCHED */) {
20833
- return /* @__PURE__ */ jsxs86(Fragment15, { children: [
20840
+ return /* @__PURE__ */ jsxs86(Fragment16, { children: [
20834
20841
  /* @__PURE__ */ jsx138(
20835
20842
  MatchBadge,
20836
20843
  {
@@ -20847,7 +20854,7 @@ var Assignment = ({ bankTransaction }) => {
20847
20854
  ] });
20848
20855
  }
20849
20856
  if (bankTransaction.categorization_status === "SPLIT" /* SPLIT */) {
20850
- return /* @__PURE__ */ jsxs86(Fragment15, { children: [
20857
+ return /* @__PURE__ */ jsxs86(Fragment16, { children: [
20851
20858
  /* @__PURE__ */ jsx138(
20852
20859
  Badge,
20853
20860
  {
@@ -21110,7 +21117,7 @@ var Paperclip_default = Paperclip;
21110
21117
 
21111
21118
  // src/components/BankTransactionMobileList/BusinessForm.tsx
21112
21119
  import classNames44 from "classnames";
21113
- import { Fragment as Fragment16, jsx as jsx142, jsxs as jsxs88 } from "react/jsx-runtime";
21120
+ import { Fragment as Fragment17, jsx as jsx142, jsxs as jsxs88 } from "react/jsx-runtime";
21114
21121
  var BusinessForm = ({
21115
21122
  bankTransaction,
21116
21123
  showCategorization,
@@ -21184,7 +21191,7 @@ var BusinessForm = ({
21184
21191
  true
21185
21192
  );
21186
21193
  };
21187
- return /* @__PURE__ */ jsxs88(Fragment16, { children: [
21194
+ return /* @__PURE__ */ jsxs88(Fragment17, { children: [
21188
21195
  /* @__PURE__ */ jsxs88("div", { className: "Layer__bank-transaction-mobile-list-item__business-form", children: [
21189
21196
  showCategorization ? /* @__PURE__ */ jsx142(
21190
21197
  ActionableList,
@@ -21489,7 +21496,7 @@ var MatchForm2 = ({
21489
21496
  // src/components/BankTransactionMobileList/SplitForm.tsx
21490
21497
  import { useEffect as useEffect18, useRef as useRef18, useState as useState34 } from "react";
21491
21498
  import classNames47 from "classnames";
21492
- import { Fragment as Fragment17, jsx as jsx145, jsxs as jsxs91 } from "react/jsx-runtime";
21499
+ import { Fragment as Fragment18, jsx as jsx145, jsxs as jsxs91 } from "react/jsx-runtime";
21493
21500
  var SplitForm = ({
21494
21501
  bankTransaction,
21495
21502
  showTooltips,
@@ -21630,7 +21637,7 @@ var SplitForm = ({
21630
21637
  );
21631
21638
  });
21632
21639
  return /* @__PURE__ */ jsxs91("div", { children: [
21633
- showCategorization ? /* @__PURE__ */ jsxs91(Fragment17, { children: [
21640
+ showCategorization ? /* @__PURE__ */ jsxs91(Fragment18, { children: [
21634
21641
  /* @__PURE__ */ jsx145(Text, { weight: "bold" /* bold */, size: "sm" /* sm */, children: "Split transaction" }),
21635
21642
  /* @__PURE__ */ jsxs91("div", { className: "Layer__bank-transactions__table-cell__header", children: [
21636
21643
  /* @__PURE__ */ jsx145(Text, { size: "sm" /* sm */, children: "Category" }),
@@ -21864,14 +21871,14 @@ import classNames48 from "classnames";
21864
21871
  import { parseISO as parseISO12, format as formatTime9 } from "date-fns";
21865
21872
  import { jsx as jsx148, jsxs as jsxs93 } from "react/jsx-runtime";
21866
21873
  var DATE_FORMAT2 = "LLL d";
21867
- var getAssignedValue2 = (bankTransaction, convertToInAppLink) => {
21874
+ var getAssignedValue2 = (bankTransaction, renderInAppLink) => {
21868
21875
  var _a, _b, _c, _d;
21869
21876
  if (bankTransaction.categorization_status === "SPLIT" /* SPLIT */) {
21870
21877
  return extractDescriptionForSplit(bankTransaction.category);
21871
21878
  }
21872
21879
  if (bankTransaction.categorization_status === "MATCHED" /* MATCHED */) {
21873
- if (convertToInAppLink && ((_a = bankTransaction.match) == null ? void 0 : _a.details)) {
21874
- const inAppLink = convertToInAppLink(convertMatchDetailsToLinkingMetadata(bankTransaction.match.details));
21880
+ if (renderInAppLink && ((_a = bankTransaction.match) == null ? void 0 : _a.details)) {
21881
+ const inAppLink = renderInAppLink(convertMatchDetailsToLinkingMetadata(bankTransaction.match.details));
21875
21882
  if (inAppLink) return inAppLink;
21876
21883
  }
21877
21884
  return (_c = (_b = bankTransaction.match) == null ? void 0 : _b.details) == null ? void 0 : _c.description;
@@ -21896,7 +21903,7 @@ var BankTransactionMobileListItem = ({
21896
21903
  clearTransactionIdToOpen
21897
21904
  } = useContext20(TransactionToOpenContext);
21898
21905
  const { shouldHideAfterCategorize } = useBankTransactionsContext();
21899
- const { convertToInAppLink } = useInAppLinkContext();
21906
+ const { renderInAppLink } = useInAppLinkContext();
21900
21907
  const formRowRef = useElementSize(
21901
21908
  (_a2, _b, { height: height2 }) => setHeight(height2)
21902
21909
  );
@@ -21983,7 +21990,7 @@ var BankTransactionMobileListItem = ({
21983
21990
  /* @__PURE__ */ jsxs93("div", { className: `${className}__heading__main`, children: [
21984
21991
  /* @__PURE__ */ jsx148(Text, { as: "span", className: `${className}__heading__tx-name`, children: (_a = bankTransaction.counterparty_name) != null ? _a : bankTransaction.description }),
21985
21992
  /* @__PURE__ */ jsxs93(Text, { as: "span", className: `${className}__heading__account-name`, children: [
21986
- categorized && bankTransaction.categorization_status ? getAssignedValue2(bankTransaction, convertToInAppLink) : null,
21993
+ categorized && bankTransaction.categorization_status ? getAssignedValue2(bankTransaction, renderInAppLink) : null,
21987
21994
  /* @__PURE__ */ jsx148("span", { children: !categorized && bankTransaction.account_name }),
21988
21995
  hasReceipts(bankTransaction) ? /* @__PURE__ */ jsx148(File_default, { size: 12 }) : null
21989
21996
  ] }),
@@ -22631,18 +22638,39 @@ var InvisibleDownload_default = InvisibleDownload;
22631
22638
  import { useState as useState45 } from "react";
22632
22639
 
22633
22640
  // src/components/ui/DropdownMenu/DropdownMenu.tsx
22634
- import { Menu as Menu3, MenuItem as AriaMenuItem, MenuTrigger as MenuTrigger2, Popover as Popover2, Separator as AriaSeparator, Header as Header4, Dialog as Dialog2 } from "react-aria-components";
22641
+ import { createContext as createContext15, useContext as useContext21 } from "react";
22642
+ import { Menu as AriaMenu, MenuItem as AriaMenuItem, MenuTrigger as MenuTrigger2, Popover as Popover2, Dialog as Dialog2 } from "react-aria-components";
22635
22643
  import { jsx as jsx160, jsxs as jsxs98 } from "react/jsx-runtime";
22636
- var Heading3 = ({ children }) => /* @__PURE__ */ jsx160(Header4, { children: /* @__PURE__ */ jsx160(Text, { size: "sm" /* sm */, weight: "bold" /* bold */, className: "Layer__dropdown-menu__menu-item__heading", children }) });
22637
- var MenuItem3 = ({ children, onClick, isDisabled }) => /* @__PURE__ */ jsx160(AriaMenuItem, { onAction: onClick, isDisabled, className: "Layer__dropdown-menu__menu-item", children });
22638
- var MenuList = ({ children }) => /* @__PURE__ */ jsx160(Menu3, { className: "Layer__dropdown-menu__menu-list", children });
22639
- var DropdownMenu = ({ children, ariaLabel, slots, slotProps }) => {
22644
+ var DropdownMenuContext = createContext15({});
22645
+ var useDropdownMenu = () => useContext21(DropdownMenuContext);
22646
+ var DropdownMenuProvider = DropdownMenuContext.Provider;
22647
+ var MenuItem3 = ({ children, onClick, isDisabled }) => {
22648
+ const { variant } = useDropdownMenu();
22649
+ const dataProps = toDataProperties({ variant });
22650
+ return /* @__PURE__ */ jsx160(
22651
+ AriaMenuItem,
22652
+ __spreadProps(__spreadValues({
22653
+ onAction: onClick,
22654
+ isDisabled,
22655
+ className: "Layer__UI__DropdownMenu__MenuItem"
22656
+ }, dataProps), {
22657
+ children
22658
+ })
22659
+ );
22660
+ };
22661
+ var MenuList = ({ children }) => {
22662
+ const { variant } = useDropdownMenu();
22663
+ const dataProps = toDataProperties({ variant });
22664
+ return /* @__PURE__ */ jsx160(AriaMenu, __spreadProps(__spreadValues({ className: "Layer__UI__DropdownMenu__Menu" }, dataProps), { children }));
22665
+ };
22666
+ var DropdownMenu = ({ children, ariaLabel, variant, slots, slotProps }) => {
22640
22667
  var _a;
22641
22668
  const { Trigger } = slots;
22642
22669
  const width = (_a = slotProps == null ? void 0 : slotProps.Dialog) == null ? void 0 : _a.width;
22670
+ const dataProps = toDataProperties({ variant });
22643
22671
  return /* @__PURE__ */ jsxs98(MenuTrigger2, { children: [
22644
22672
  /* @__PURE__ */ jsx160(Trigger, { "aria-label": "Menu" }),
22645
- /* @__PURE__ */ jsx160(Popover2, { placement: "bottom right", className: "Layer__dropdown-menu__popover Layer__variables", children: /* @__PURE__ */ jsx160(Dialog2, { className: "Layer__dropdown-menu__menu", "aria-label": ariaLabel, style: { width }, children }) })
22673
+ /* @__PURE__ */ jsx160(Popover2, { placement: "bottom right", className: "Layer__UI__DropdownMenu__Popover Layer__variables", children: /* @__PURE__ */ jsx160(Dialog2, __spreadProps(__spreadValues({ className: "Layer__UI__DropdownMenu__Dialog", "aria-label": ariaLabel, style: { width } }, dataProps), { children: /* @__PURE__ */ jsx160(DropdownMenuProvider, { value: { variant }, children }) })) })
22646
22674
  ] });
22647
22675
  };
22648
22676
 
@@ -22655,9 +22683,9 @@ import { useCallback as useCallback38, useState as useState44 } from "react";
22655
22683
  // src/components/Wizard/Wizard.tsx
22656
22684
  import {
22657
22685
  Children,
22658
- createContext as createContext15,
22686
+ createContext as createContext16,
22659
22687
  useCallback as useCallback26,
22660
- useContext as useContext21,
22688
+ useContext as useContext22,
22661
22689
  useMemo as useMemo34,
22662
22690
  useState as useState38
22663
22691
  } from "react";
@@ -22695,7 +22723,7 @@ function useWizardStep({
22695
22723
  const currentStep = steps.at(effectiveStepIndex);
22696
22724
  return { currentStep, next, previous, goToStep };
22697
22725
  }
22698
- var WizardContext = createContext15({
22726
+ var WizardContext = createContext16({
22699
22727
  next: () => __async(null, null, function* () {
22700
22728
  }),
22701
22729
  previous: () => {
@@ -22704,10 +22732,10 @@ var WizardContext = createContext15({
22704
22732
  }
22705
22733
  });
22706
22734
  function useWizard() {
22707
- return useContext21(WizardContext);
22735
+ return useContext22(WizardContext);
22708
22736
  }
22709
22737
  function Wizard({
22710
- Header: Header6,
22738
+ Header: Header5,
22711
22739
  Footer,
22712
22740
  onComplete,
22713
22741
  onStepChange,
@@ -22721,7 +22749,7 @@ function Wizard({
22721
22749
  });
22722
22750
  const contextValue = useMemo34(() => ({ next, previous, goToStep }), [next, previous, goToStep]);
22723
22751
  return /* @__PURE__ */ jsxs99(WizardContext.Provider, { value: contextValue, children: [
22724
- Header6,
22752
+ Header5,
22725
22753
  currentStep,
22726
22754
  Footer
22727
22755
  ] });
@@ -23297,8 +23325,7 @@ function FormDateField({
23297
23325
  setLocalDate(value);
23298
23326
  }, [value]);
23299
23327
  const onBlur = useCallback29(() => {
23300
- const nextDate = isZonedDateTime(localDate) ? localDate : null;
23301
- handleChange(nextDate);
23328
+ handleChange(localDate);
23302
23329
  handleBlur();
23303
23330
  }, [handleBlur, handleChange, localDate]);
23304
23331
  const errorMessage = errors.length !== 0 ? errors[0] : void 0;
@@ -23539,7 +23566,7 @@ var useCustomAccountForm = ({ onSuccess }) => {
23539
23566
  };
23540
23567
 
23541
23568
  // src/components/CustomAccountForm/CustomAccountForm.tsx
23542
- import { Fragment as Fragment18, jsx as jsx173, jsxs as jsxs103 } from "react/jsx-runtime";
23569
+ import { Fragment as Fragment19, jsx as jsx173, jsxs as jsxs103 } from "react/jsx-runtime";
23543
23570
  var accountTypeOptions = [
23544
23571
  { value: "CHECKING" /* CHECKING */, label: "Checking" },
23545
23572
  { value: "SAVINGS" /* SAVINGS */, label: "Savings" },
@@ -23569,7 +23596,7 @@ var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
23569
23596
  validators: {
23570
23597
  onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Account name is required"
23571
23598
  },
23572
- children: (field) => /* @__PURE__ */ jsx173(Fragment18, { children: /* @__PURE__ */ jsx173(InputGroup, { name: "account_name", label: "Account name", className: "Layer__custom-account-form__field", children: /* @__PURE__ */ jsx173(
23599
+ children: (field) => /* @__PURE__ */ jsx173(Fragment19, { children: /* @__PURE__ */ jsx173(InputGroup, { name: "account_name", label: "Account name", className: "Layer__custom-account-form__field", children: /* @__PURE__ */ jsx173(
23573
23600
  Input,
23574
23601
  {
23575
23602
  className: "Layer__custom-account-form__input",
@@ -23590,7 +23617,7 @@ var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
23590
23617
  validators: {
23591
23618
  onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Institution name is required"
23592
23619
  },
23593
- children: (field) => /* @__PURE__ */ jsx173(Fragment18, { children: /* @__PURE__ */ jsx173(InputGroup, { name: "institution_name", label: "Institution name", className: "Layer__custom-account-form__field", children: /* @__PURE__ */ jsx173(
23620
+ children: (field) => /* @__PURE__ */ jsx173(Fragment19, { children: /* @__PURE__ */ jsx173(InputGroup, { name: "institution_name", label: "Institution name", className: "Layer__custom-account-form__field", children: /* @__PURE__ */ jsx173(
23594
23621
  Input,
23595
23622
  {
23596
23623
  className: "Layer__custom-account-form__input",
@@ -23611,7 +23638,7 @@ var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
23611
23638
  validators: {
23612
23639
  onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Account type is required"
23613
23640
  },
23614
- children: (field) => /* @__PURE__ */ jsx173(Fragment18, { children: /* @__PURE__ */ jsx173(InputGroup, { name: "account_type", label: "Account type", className: "Layer__custom-account-form__field", children: /* @__PURE__ */ jsx173(
23641
+ children: (field) => /* @__PURE__ */ jsx173(Fragment19, { children: /* @__PURE__ */ jsx173(InputGroup, { name: "account_type", label: "Account type", className: "Layer__custom-account-form__field", children: /* @__PURE__ */ jsx173(
23615
23642
  Select,
23616
23643
  {
23617
23644
  className: "Layer__custom-account-form__input",
@@ -23926,7 +23953,7 @@ var templateExampleTransactions = [
23926
23953
  ];
23927
23954
 
23928
23955
  // src/components/UploadTransactions/UploadTransactionsUploadCsvStep.tsx
23929
- import { Fragment as Fragment19, jsx as jsx178, jsxs as jsxs105 } from "react/jsx-runtime";
23956
+ import { Fragment as Fragment20, jsx as jsx178, jsxs as jsxs105 } from "react/jsx-runtime";
23930
23957
  var formatCreateLabel = (inputValue) => {
23931
23958
  return inputValue ? `Create "${inputValue}"` : "Create account";
23932
23959
  };
@@ -24029,7 +24056,7 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
24029
24056
  onCancel: () => onSelectAccount(null),
24030
24057
  onSuccess: onCreateAccountSuccess
24031
24058
  }
24032
- ) }) : /* @__PURE__ */ jsxs105(Fragment19, { children: [
24059
+ ) }) : /* @__PURE__ */ jsxs105(Fragment20, { children: [
24033
24060
  /* @__PURE__ */ jsx178(CsvUpload, { file: selectedFile, onFileSelected, replaceDropTarget: true }),
24034
24061
  /* @__PURE__ */ jsx178(Separator, {}),
24035
24062
  /* @__PURE__ */ jsxs105(VStack, { gap: "xs", className: "Layer__upload-transactions__template-section", children: [
@@ -24505,9 +24532,9 @@ function UploadTransactions({ onComplete }) {
24505
24532
  }
24506
24533
 
24507
24534
  // src/components/BankTransactions/BankTransactionsUploadModal/BankTransactionsUploadModal.tsx
24508
- import { Fragment as Fragment20, jsx as jsx183, jsxs as jsxs110 } from "react/jsx-runtime";
24535
+ import { Fragment as Fragment21, jsx as jsx183, jsxs as jsxs110 } from "react/jsx-runtime";
24509
24536
  function BankTransactionsUploadModalContent({ onClose }) {
24510
- return /* @__PURE__ */ jsxs110(Fragment20, { children: [
24537
+ return /* @__PURE__ */ jsxs110(Fragment21, { children: [
24511
24538
  /* @__PURE__ */ jsx183(ModalCloseButton, { onClose, positionAbsolute: true }),
24512
24539
  /* @__PURE__ */ jsx183(UploadTransactions, { onComplete: onClose })
24513
24540
  ] });
@@ -24517,11 +24544,11 @@ function BankTransactionsUploadModal({ isOpen, onOpenChange }) {
24517
24544
  }
24518
24545
 
24519
24546
  // src/components/BankTransactions/BankTransactionsUploadMenu.tsx
24520
- import { Fragment as Fragment21, jsx as jsx184, jsxs as jsxs111 } from "react/jsx-runtime";
24547
+ import { Fragment as Fragment22, jsx as jsx184, jsxs as jsxs111 } from "react/jsx-runtime";
24521
24548
  var MenuTriggerButton = () => /* @__PURE__ */ jsx184(Button2, { variant: "outlined", icon: true, children: /* @__PURE__ */ jsx184(UploadCloud_default, { size: 12 }) });
24522
24549
  var BankTransactionsUploadMenu = () => {
24523
24550
  const [isModalOpen, setIsModalOpen] = useState45(false);
24524
- return /* @__PURE__ */ jsxs111(Fragment21, { children: [
24551
+ return /* @__PURE__ */ jsxs111(Fragment22, { children: [
24525
24552
  /* @__PURE__ */ jsxs111(
24526
24553
  DropdownMenu,
24527
24554
  {
@@ -24531,10 +24558,10 @@ var BankTransactionsUploadMenu = () => {
24531
24558
  Dialog: { width: "18rem" }
24532
24559
  },
24533
24560
  children: [
24534
- /* @__PURE__ */ jsx184(Heading3, { children: "Choose how to upload transactions" }),
24561
+ /* @__PURE__ */ jsx184(Heading2, { weight: "bold", size: "2xs", children: "Choose how to upload transactions" }),
24535
24562
  /* @__PURE__ */ jsx184(MenuList, { children: /* @__PURE__ */ jsxs111(MenuItem3, { onClick: () => setIsModalOpen(true), children: [
24536
24563
  /* @__PURE__ */ jsx184(VStack, { className: "Layer__bank-transactions__header-menu__upload-transactions-icon", children: /* @__PURE__ */ jsx184(UploadCloud_default, { size: 16 }) }),
24537
- /* @__PURE__ */ jsx184(Text, { size: "sm" /* sm */, children: "Upload transactions manually" }),
24564
+ /* @__PURE__ */ jsx184(Span, { size: "sm", children: "Upload transactions manually" }),
24538
24565
  /* @__PURE__ */ jsx184(Spacer, {}),
24539
24566
  /* @__PURE__ */ jsx184(ChevronRight2, { size: 12 })
24540
24567
  ] }, "upload-txns") })
@@ -24546,7 +24573,7 @@ var BankTransactionsUploadMenu = () => {
24546
24573
  };
24547
24574
 
24548
24575
  // src/components/BankTransactions/BankTransactionsHeader.tsx
24549
- import { Fragment as Fragment22, jsx as jsx185, jsxs as jsxs112 } from "react/jsx-runtime";
24576
+ import { Fragment as Fragment23, jsx as jsx185, jsxs as jsxs112 } from "react/jsx-runtime";
24550
24577
  function TransactionsSearch({ slot }) {
24551
24578
  const { filters, setFilters } = useBankTransactionsContext();
24552
24579
  const [localSearch, setLocalSearch] = useState46(() => {
@@ -24584,7 +24611,7 @@ var DownloadButton2 = ({
24584
24611
  }
24585
24612
  });
24586
24613
  };
24587
- return /* @__PURE__ */ jsxs112(Fragment22, { children: [
24614
+ return /* @__PURE__ */ jsxs112(Fragment23, { children: [
24588
24615
  /* @__PURE__ */ jsx185(
24589
24616
  DownloadButton,
24590
24617
  {
@@ -24807,7 +24834,7 @@ var BankTransactions = (_a) => {
24807
24834
  monthlyView = false,
24808
24835
  applyGlobalDateRange = false,
24809
24836
  mode,
24810
- convertToInAppLink
24837
+ renderInAppLink
24811
24838
  } = _b, props = __objRest(_b, [
24812
24839
  "onError",
24813
24840
  "showTags",
@@ -24815,13 +24842,13 @@ var BankTransactions = (_a) => {
24815
24842
  "monthlyView",
24816
24843
  "applyGlobalDateRange",
24817
24844
  "mode",
24818
- "convertToInAppLink"
24845
+ "renderInAppLink"
24819
24846
  ]);
24820
24847
  usePreloadTagDimensions({ isEnabled: showTags });
24821
24848
  usePreloadCustomers({ isEnabled: showCustomerVendor });
24822
24849
  usePreloadVendors({ isEnabled: showCustomerVendor });
24823
24850
  const contextData = useAugmentedBankTransactions({ monthlyView, applyGlobalDateRange });
24824
- return /* @__PURE__ */ jsx188(ErrorBoundary, { onError, children: /* @__PURE__ */ jsx188(BankTransactionsContext.Provider, { value: contextData, children: /* @__PURE__ */ jsx188(LegacyModeProvider, { overrideMode: mode, children: /* @__PURE__ */ jsx188(BankTransactionTagVisibilityProvider, { showTags, children: /* @__PURE__ */ jsx188(BankTransactionCustomerVendorVisibilityProvider, { showCustomerVendor, children: /* @__PURE__ */ jsx188(InAppLinkProvider, { convertToInAppLink, children: /* @__PURE__ */ jsx188(BankTransactionsContent, __spreadValues({}, props)) }) }) }) }) }) });
24851
+ return /* @__PURE__ */ jsx188(ErrorBoundary, { onError, children: /* @__PURE__ */ jsx188(BankTransactionsContext.Provider, { value: contextData, children: /* @__PURE__ */ jsx188(LegacyModeProvider, { overrideMode: mode, children: /* @__PURE__ */ jsx188(BankTransactionTagVisibilityProvider, { showTags, children: /* @__PURE__ */ jsx188(BankTransactionCustomerVendorVisibilityProvider, { showCustomerVendor, children: /* @__PURE__ */ jsx188(InAppLinkProvider, { renderInAppLink, children: /* @__PURE__ */ jsx188(BankTransactionsContent, __spreadValues({}, props)) }) }) }) }) }) });
24825
24852
  };
24826
24853
  var BankTransactionsContent = ({
24827
24854
  asWidget = false,
@@ -25039,13 +25066,13 @@ var BankTransactionsContent = ({
25039
25066
  };
25040
25067
 
25041
25068
  // src/components/Integrations/Integrations.tsx
25042
- import { useContext as useContext27 } from "react";
25069
+ import { useContext as useContext28 } from "react";
25043
25070
 
25044
25071
  // src/components/Integrations/IntegrationsContent.tsx
25045
- import { useContext as useContext25 } from "react";
25072
+ import { useContext as useContext26 } from "react";
25046
25073
 
25047
25074
  // src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumb.tsx
25048
- import { useCallback as useCallback40, useContext as useContext24, useMemo as useMemo40, useState as useState48 } from "react";
25075
+ import { useCallback as useCallback40, useContext as useContext25, useMemo as useMemo40, useState as useState48 } from "react";
25049
25076
 
25050
25077
  // src/icons/QuickbooksIcon.tsx
25051
25078
  import { jsx as jsx189, jsxs as jsxs115 } from "react/jsx-runtime";
@@ -25094,8 +25121,8 @@ var Card = ({ children, className }) => {
25094
25121
  };
25095
25122
 
25096
25123
  // src/contexts/QuickbooksContext/QuickbooksContext.tsx
25097
- import { createContext as createContext16 } from "react";
25098
- var QuickbooksContext = createContext16({
25124
+ import { createContext as createContext17 } from "react";
25125
+ var QuickbooksContext = createContext17({
25099
25126
  linkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
25100
25127
  unlinkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
25101
25128
  syncFromQuickbooks: () => {
@@ -25105,7 +25132,7 @@ var QuickbooksContext = createContext16({
25105
25132
  });
25106
25133
 
25107
25134
  // src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumbFooter.tsx
25108
- import { useContext as useContext22 } from "react";
25135
+ import { useContext as useContext23 } from "react";
25109
25136
  import { format, isValid } from "date-fns";
25110
25137
 
25111
25138
  // src/components/Integrations/IntegrationsQuickbooksItemThumb/utils.ts
@@ -25163,7 +25190,7 @@ var getFooterConfig = (quickbooksUiState, lastSyncedAt) => {
25163
25190
  }
25164
25191
  };
25165
25192
  var IntegrationsQuickbooksItemThumbFooter = ({ quickbooksUiState }) => {
25166
- const { quickbooksConnectionStatus } = useContext22(QuickbooksContext);
25193
+ const { quickbooksConnectionStatus } = useContext23(QuickbooksContext);
25167
25194
  if (!quickbooksConnectionStatus) return null;
25168
25195
  const { title, description, badgeVariant } = getFooterConfig(quickbooksUiState, quickbooksConnectionStatus.last_synced_at);
25169
25196
  return /* @__PURE__ */ jsxs117(HStack, { className: "loadingbar", children: [
@@ -25180,10 +25207,10 @@ var IntegrationsQuickbooksItemThumbFooter = ({ quickbooksUiState }) => {
25180
25207
  import { AlertCircle as AlertCircle2, CheckIcon } from "lucide-react";
25181
25208
 
25182
25209
  // src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksUnlinkConfirmationModal.tsx
25183
- import { useContext as useContext23 } from "react";
25210
+ import { useContext as useContext24 } from "react";
25184
25211
  import { jsx as jsx193 } from "react/jsx-runtime";
25185
25212
  function IntegrationsQuickbooksUnlinkConfirmationModal({ isOpen, onOpenChange }) {
25186
- const { unlinkQuickbooks } = useContext23(QuickbooksContext);
25213
+ const { unlinkQuickbooks } = useContext24(QuickbooksContext);
25187
25214
  return /* @__PURE__ */ jsx193(
25188
25215
  BaseConfirmationModal,
25189
25216
  {
@@ -25235,7 +25262,7 @@ var getBadgeConfig = (quickbooksUiState, hasSynced) => {
25235
25262
  }
25236
25263
  };
25237
25264
  var IntegrationsQuickbooksItemThumb = () => {
25238
- const { quickbooksConnectionStatus, syncFromQuickbooks: syncFromQuickbooks2 } = useContext24(QuickbooksContext);
25265
+ const { quickbooksConnectionStatus, syncFromQuickbooks: syncFromQuickbooks2 } = useContext25(QuickbooksContext);
25239
25266
  const [hasSynced, setHasSynced] = useState48(false);
25240
25267
  const [isConfirmationModalOpen, setIsConfirmationModalOpen] = useState48(false);
25241
25268
  const onSync = useCallback40(() => {
@@ -25284,7 +25311,7 @@ var IntegrationsQuickbooksItemThumb = () => {
25284
25311
  // src/components/Integrations/IntegrationsContent.tsx
25285
25312
  import { jsx as jsx195 } from "react/jsx-runtime";
25286
25313
  var IntegrationsContent = () => {
25287
- const { quickbooksConnectionStatus } = useContext25(QuickbooksContext);
25314
+ const { quickbooksConnectionStatus } = useContext26(QuickbooksContext);
25288
25315
  return /* @__PURE__ */ jsx195("div", { className: "Layer__linked-accounts__list", children: (quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected) && /* @__PURE__ */ jsx195(IntegrationsQuickbooksItemThumb, {}) });
25289
25316
  };
25290
25317
 
@@ -25361,7 +25388,7 @@ function QuickbooksContextProvider({ children }) {
25361
25388
  }
25362
25389
 
25363
25390
  // src/components/Integrations/IntegrationsConnectMenu/IntegrationsConnectMenu.tsx
25364
- import { useCallback as useCallback42, useContext as useContext26, useState as useState50 } from "react";
25391
+ import { useCallback as useCallback42, useContext as useContext27, useState as useState50 } from "react";
25365
25392
 
25366
25393
  // src/icons/Cog.tsx
25367
25394
  import { useId as useId4 } from "react";
@@ -25398,7 +25425,7 @@ var MenuTriggerButton2 = () => /* @__PURE__ */ jsxs120(Button2, { variant: "outl
25398
25425
  ] });
25399
25426
  var IntegrationsConnectMenu = () => {
25400
25427
  const { addToast } = useLayerContext();
25401
- const { quickbooksConnectionStatus, linkQuickbooks } = useContext26(QuickbooksContext);
25428
+ const { quickbooksConnectionStatus, linkQuickbooks } = useContext27(QuickbooksContext);
25402
25429
  const quickbooksIsConnected = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected;
25403
25430
  const [isLinkQuickbooksError, setIsLinkQuickbooksError] = useState50(false);
25404
25431
  const initiateQuickbooksOAuth = useCallback42(() => {
@@ -25416,15 +25443,15 @@ var IntegrationsConnectMenu = () => {
25416
25443
  slots: { Trigger: MenuTriggerButton2 },
25417
25444
  slotProps: { Dialog: { width: 280 } },
25418
25445
  children: [
25419
- /* @__PURE__ */ jsx198(Heading3, { children: "Integrations" }),
25446
+ /* @__PURE__ */ jsx198(Heading2, { size: "2xs", weight: "bold", children: "Integrations" }),
25420
25447
  /* @__PURE__ */ jsx198(MenuList, { children: quickbooksIsConnected ? /* @__PURE__ */ jsxs120(MenuItem3, { isDisabled: true, children: [
25421
25448
  /* @__PURE__ */ jsx198(QuickbooksIcon_default, { size: 20 }),
25422
- /* @__PURE__ */ jsx198(Text, { size: "sm" /* sm */, children: "QuickBooks connected" }),
25449
+ /* @__PURE__ */ jsx198(Span, { size: "sm", children: "QuickBooks connected" }),
25423
25450
  /* @__PURE__ */ jsx198(Spacer, {}),
25424
25451
  /* @__PURE__ */ jsx198(Check_default, { size: 16 })
25425
25452
  ] }, "quickbooks-connected") : /* @__PURE__ */ jsxs120(MenuItem3, { onClick: initiateQuickbooksOAuth, children: [
25426
25453
  /* @__PURE__ */ jsx198(QuickbooksIcon_default, { size: 20 }),
25427
- /* @__PURE__ */ jsx198(Text, __spreadProps(__spreadValues({}, isLinkQuickbooksError && { status: "error" }), { size: "sm" /* sm */, children: isLinkQuickbooksError ? "Retry Connect QuickBooks" : "Connect QuickBooks" })),
25454
+ /* @__PURE__ */ jsx198(Span, __spreadProps(__spreadValues({}, isLinkQuickbooksError && { status: "error" }), { size: "sm", children: isLinkQuickbooksError ? "Retry Connect QuickBooks" : "Connect QuickBooks" })),
25428
25455
  /* @__PURE__ */ jsx198(Spacer, {}),
25429
25456
  /* @__PURE__ */ jsx198(Link_default, { size: 12 })
25430
25457
  ] }, "connect-quickbooks") })
@@ -25442,7 +25469,7 @@ var Integrations = (props) => {
25442
25469
  var IntegrationsComponent = ({
25443
25470
  stringOverrides
25444
25471
  }) => {
25445
- const { quickbooksConnectionStatus } = useContext27(QuickbooksContext);
25472
+ const { quickbooksConnectionStatus } = useContext28(QuickbooksContext);
25446
25473
  const isLoading = quickbooksConnectionStatus === void 0;
25447
25474
  return /* @__PURE__ */ jsxs121(Container, { name: COMPONENT_NAME3, children: [
25448
25475
  /* @__PURE__ */ jsxs121(Header, { className: "Layer__linked-accounts__header", children: [
@@ -25469,11 +25496,11 @@ var IntegrationsComponent = ({
25469
25496
  };
25470
25497
 
25471
25498
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
25472
- import { createContext as createContext21 } from "react";
25499
+ import { createContext as createContext22 } from "react";
25473
25500
 
25474
25501
  // src/contexts/ProfitAndLossComparisonContext/ProfitAndLossComparisonContext.tsx
25475
- import { createContext as createContext17 } from "react";
25476
- var PNLComparisonContext = createContext17({
25502
+ import { createContext as createContext18 } from "react";
25503
+ var PNLComparisonContext = createContext18({
25477
25504
  data: void 0,
25478
25505
  isLoading: true,
25479
25506
  isValidating: false,
@@ -25546,7 +25573,7 @@ var applyShare = (items, total) => {
25546
25573
  };
25547
25574
 
25548
25575
  // src/providers/ReportsModeStoreProvider/ReportsModeStoreProvider.tsx
25549
- import { useState as useState51, createContext as createContext18, useContext as useContext28 } from "react";
25576
+ import { useState as useState51, createContext as createContext19, useContext as useContext29 } from "react";
25550
25577
  import { createStore as createStore3, useStore as useStore4 } from "zustand";
25551
25578
  import { jsx as jsx200 } from "react/jsx-runtime";
25552
25579
  var defaultModeByReport = {
@@ -25555,7 +25582,7 @@ var defaultModeByReport = {
25555
25582
  ["BalanceSheet" /* BalanceSheet */]: "dayPicker",
25556
25583
  ["StatementOfCashFlows" /* StatementOfCashFlows */]: "monthPicker"
25557
25584
  };
25558
- var ReportsModeStoreContext = createContext18(
25585
+ var ReportsModeStoreContext = createContext19(
25559
25586
  createStore3(() => ({
25560
25587
  resetPnLModeToDefaultOnMount: true,
25561
25588
  modeByReport: {},
@@ -25566,15 +25593,15 @@ var ReportsModeStoreContext = createContext18(
25566
25593
  }))
25567
25594
  );
25568
25595
  function useReportModeStore() {
25569
- const store = useContext28(ReportsModeStoreContext);
25596
+ const store = useContext29(ReportsModeStoreContext);
25570
25597
  return useStore4(store);
25571
25598
  }
25572
25599
  function useReportMode(report) {
25573
- const store = useContext28(ReportsModeStoreContext);
25600
+ const store = useContext29(ReportsModeStoreContext);
25574
25601
  return useStore4(store, (state) => state.modeByReport[report]);
25575
25602
  }
25576
25603
  function useReportModeActions() {
25577
- const store = useContext28(ReportsModeStoreContext);
25604
+ const store = useContext29(ReportsModeStoreContext);
25578
25605
  const setModeForReport = useStore4(store, (s) => s.actions.setModeForReport);
25579
25606
  return { setModeForReport };
25580
25607
  }
@@ -26210,8 +26237,8 @@ var getChartWindow = ({
26210
26237
  currentYear,
26211
26238
  currentMonth
26212
26239
  }) => {
26213
- const today = startOfMonth8(Date.now());
26214
- const yearAgo = sub2(today, { months: 11 });
26240
+ const today3 = startOfMonth8(Date.now());
26241
+ const yearAgo = sub2(today3, { months: 11 });
26215
26242
  const current = startOfMonth8(new Date(currentYear, currentMonth - 1, 1));
26216
26243
  if (differenceInMonths(startOfMonth8(chartWindow.start), current) < 0 && differenceInMonths(startOfMonth8(chartWindow.end), current) > 1) {
26217
26244
  return chartWindow;
@@ -26222,13 +26249,13 @@ var getChartWindow = ({
26222
26249
  end: endOfMonth6(add(current, { months: 11 }))
26223
26250
  };
26224
26251
  }
26225
- if (differenceInMonths(endOfMonth6(chartWindow.end), endOfMonth6(current)) === 1 && differenceInMonths(today, current) >= 1) {
26252
+ if (differenceInMonths(endOfMonth6(chartWindow.end), endOfMonth6(current)) === 1 && differenceInMonths(today3, current) >= 1) {
26226
26253
  return {
26227
26254
  start: startOfMonth8(sub2(current, { months: 10 })),
26228
26255
  end: endOfMonth6(add(current, { months: 2 }))
26229
26256
  };
26230
26257
  }
26231
- if (differenceInMonths(current, startOfMonth8(chartWindow.end)) === 0 && differenceInMonths(current, startOfMonth8(today)) > 0) {
26258
+ if (differenceInMonths(current, startOfMonth8(chartWindow.end)) === 0 && differenceInMonths(current, startOfMonth8(today3)) > 0) {
26232
26259
  return {
26233
26260
  start: startOfMonth8(sub2(current, { months: 11 })),
26234
26261
  end: endOfMonth6(add(current, { months: 1 }))
@@ -26237,7 +26264,7 @@ var getChartWindow = ({
26237
26264
  if (current >= yearAgo) {
26238
26265
  return {
26239
26266
  start: startOfMonth8(yearAgo),
26240
- end: endOfMonth6(today)
26267
+ end: endOfMonth6(today3)
26241
26268
  };
26242
26269
  }
26243
26270
  if (Number(current) > Number(chartWindow.end)) {
@@ -26378,9 +26405,9 @@ var ProfitAndLossChart = ({
26378
26405
  var _a;
26379
26406
  if (isLoading || !hasNonZeroData) {
26380
26407
  const loadingData = [];
26381
- const today = Date.now();
26408
+ const today3 = Date.now();
26382
26409
  for (let i = 11; i >= 0; i--) {
26383
- const currentDate = sub2(today, { months: i });
26410
+ const currentDate = sub2(today3, { months: i });
26384
26411
  loadingData.push({
26385
26412
  name: format3(currentDate, compactView ? "LLLLL" : "LLL"),
26386
26413
  revenue: 0,
@@ -26905,7 +26932,7 @@ var ProfitAndLossChart = ({
26905
26932
  };
26906
26933
 
26907
26934
  // src/components/ProfitAndLossCompareOptions/ProfitAndLossCompareOptions.tsx
26908
- import { useContext as useContext29, useMemo as useMemo45 } from "react";
26935
+ import { useContext as useContext30, useMemo as useMemo45 } from "react";
26909
26936
  import { jsx as jsx205, jsxs as jsxs125 } from "react/jsx-runtime";
26910
26937
  var selectStyles = {
26911
26938
  valueContainer: (styles) => {
@@ -26945,7 +26972,7 @@ var ProfitAndLossCompareOptions = () => {
26945
26972
  compareOptions,
26946
26973
  selectedCompareOptions,
26947
26974
  comparisonConfig
26948
- } = useContext29(ProfitAndLoss2.ComparisonContext);
26975
+ } = useContext30(ProfitAndLoss2.ComparisonContext);
26949
26976
  const rangeDisplayMode = useReportModeWithFallback("ProfitAndLoss" /* ProfitAndLoss */, "monthPicker");
26950
26977
  const periods = useMemo45(
26951
26978
  () => comparePeriods !== 0 ? comparePeriods : 1,
@@ -27138,7 +27165,7 @@ var ProfitAndLossDatePicker = ({
27138
27165
  };
27139
27166
 
27140
27167
  // src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
27141
- import { useContext as useContext30, useState as useState56 } from "react";
27168
+ import { useContext as useContext31, useState as useState56 } from "react";
27142
27169
 
27143
27170
  // src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
27144
27171
  import { useMemo as useMemo47 } from "react";
@@ -27801,7 +27828,7 @@ var ProfitAndLossDetailedCharts = ({
27801
27828
  sidebarScope,
27802
27829
  setSidebarScope,
27803
27830
  setFilterTypes
27804
- } = useContext30(ProfitAndLoss2.Context);
27831
+ } = useContext31(ProfitAndLoss2.Context);
27805
27832
  const theScope = scope ? scope : sidebarScope;
27806
27833
  const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
27807
27834
  const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
@@ -27874,7 +27901,7 @@ var ProfitAndLossDetailedCharts = ({
27874
27901
  };
27875
27902
 
27876
27903
  // src/components/ProfitAndLossDownloadButton/ProfitAndLossDownloadButton.tsx
27877
- import { useContext as useContext31, useState as useState57 } from "react";
27904
+ import { useContext as useContext32, useState as useState57 } from "react";
27878
27905
  import { jsx as jsx213 } from "react/jsx-runtime";
27879
27906
  var ProfitAndLossDownloadButton = ({
27880
27907
  stringOverrides,
@@ -27882,8 +27909,8 @@ var ProfitAndLossDownloadButton = ({
27882
27909
  moneyFormat,
27883
27910
  view
27884
27911
  }) => {
27885
- const { dateRange, tagFilter } = useContext31(ProfitAndLoss2.Context);
27886
- const { getProfitAndLossComparisonCsv } = useContext31(
27912
+ const { dateRange, tagFilter } = useContext32(ProfitAndLoss2.Context);
27913
+ const { getProfitAndLossComparisonCsv } = useContext32(
27887
27914
  ProfitAndLoss2.ComparisonContext
27888
27915
  );
27889
27916
  const { businessId } = useLayerContext();
@@ -27991,7 +28018,7 @@ var ProfitAndLossHeader = ({
27991
28018
  };
27992
28019
 
27993
28020
  // src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
27994
- import { useCallback as useCallback49, useContext as useContext35, useMemo as useMemo53, useState as useState60 } from "react";
28021
+ import { useCallback as useCallback49, useContext as useContext36, useMemo as useMemo53, useState as useState60 } from "react";
27995
28022
 
27996
28023
  // src/components/Header/Header.tsx
27997
28024
  import {
@@ -27999,7 +28026,7 @@ import {
27999
28026
  } from "react";
28000
28027
  import classNames66 from "classnames";
28001
28028
  import { jsx as jsx216 } from "react/jsx-runtime";
28002
- var Header5 = forwardRef22(
28029
+ var Header4 = forwardRef22(
28003
28030
  ({ className, children, style, sticky, asHeader, rounded }, ref) => {
28004
28031
  const baseClassName = classNames66(
28005
28032
  "Layer__header",
@@ -28021,7 +28048,7 @@ var Header5 = forwardRef22(
28021
28048
  );
28022
28049
  }
28023
28050
  );
28024
- Header5.displayName = "Header";
28051
+ Header4.displayName = "Header";
28025
28052
 
28026
28053
  // src/components/Header/HeaderRow.tsx
28027
28054
  import classNames67 from "classnames";
@@ -28040,7 +28067,7 @@ var HeaderCol = ({ className, children, style, noPadding = false }) => {
28040
28067
  };
28041
28068
 
28042
28069
  // src/components/ProfitAndLossDetailLinesDownloadButton/ProfitAndLossDetailLinesDownloadButton.tsx
28043
- import { useContext as useContext32 } from "react";
28070
+ import { useContext as useContext33 } from "react";
28044
28071
 
28045
28072
  // src/hooks/useProfitAndLoss/useProfitAndLossDetailLinesExport.ts
28046
28073
  import useSWRMutation13 from "swr/mutation";
@@ -28137,13 +28164,13 @@ function useProfitAndLossDetailLinesExport({
28137
28164
  }
28138
28165
 
28139
28166
  // src/components/ProfitAndLossDetailLinesDownloadButton/ProfitAndLossDetailLinesDownloadButton.tsx
28140
- import { Fragment as Fragment23, jsx as jsx219, jsxs as jsxs132 } from "react/jsx-runtime";
28167
+ import { Fragment as Fragment24, jsx as jsx219, jsxs as jsxs132 } from "react/jsx-runtime";
28141
28168
  function ProfitAndLossDetailLinesDownloadButton({
28142
28169
  pnlStructureLineItemName,
28143
28170
  iconOnly
28144
28171
  }) {
28145
28172
  const { businessId } = useLayerContext();
28146
- const { tagFilter, dateRange } = useContext32(ProfitAndLoss2.Context);
28173
+ const { tagFilter, dateRange } = useContext33(ProfitAndLoss2.Context);
28147
28174
  const { invisibleDownloadRef, triggerInvisibleDownload } = useInvisibleDownload();
28148
28175
  const { trigger, isMutating, error } = useProfitAndLossDetailLinesExport({
28149
28176
  businessId,
@@ -28157,7 +28184,7 @@ function ProfitAndLossDetailLinesDownloadButton({
28157
28184
  }
28158
28185
  }
28159
28186
  });
28160
- return /* @__PURE__ */ jsxs132(Fragment23, { children: [
28187
+ return /* @__PURE__ */ jsxs132(Fragment24, { children: [
28161
28188
  /* @__PURE__ */ jsx219(
28162
28189
  DownloadButton,
28163
28190
  {
@@ -28285,14 +28312,14 @@ var View = forwardRef23(
28285
28312
  View.displayName = "View";
28286
28313
 
28287
28314
  // src/components/ProfitAndLossDetailReport/ProfitAndLossDetailReport.tsx
28288
- import { useContext as useContext34, useState as useState59, useMemo as useMemo52, useCallback as useCallback48 } from "react";
28315
+ import { useContext as useContext35, useState as useState59, useMemo as useMemo52, useCallback as useCallback48 } from "react";
28289
28316
 
28290
28317
  // src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
28291
- import { useContext as useContext33, useMemo as useMemo50 } from "react";
28318
+ import { useContext as useContext34, useMemo as useMemo50 } from "react";
28292
28319
 
28293
28320
  // src/contexts/LedgerAccountsContext/LedgerAccountsContext.tsx
28294
- import { createContext as createContext19 } from "react";
28295
- var LedgerAccountsContext = createContext19({
28321
+ import { createContext as createContext20 } from "react";
28322
+ var LedgerAccountsContext = createContext20({
28296
28323
  data: void 0,
28297
28324
  entryData: void 0,
28298
28325
  isLoading: false,
@@ -28476,7 +28503,7 @@ var TableHead = ({ children }) => {
28476
28503
 
28477
28504
  // src/components/TableRow/TableRow.tsx
28478
28505
  import classNames74 from "classnames";
28479
- import { Fragment as Fragment24, jsx as jsx229, jsxs as jsxs140 } from "react/jsx-runtime";
28506
+ import { Fragment as Fragment25, jsx as jsx229, jsxs as jsxs140 } from "react/jsx-runtime";
28480
28507
  var TableRow = ({
28481
28508
  rowKey,
28482
28509
  children,
@@ -28506,7 +28533,7 @@ var TableRow = ({
28506
28533
  selected && "Layer__table-row--selected",
28507
28534
  !isHeadRow && expandable && (isExpanded ? "Layer__table-row--expanded" : "Layer__table-row--collapsed")
28508
28535
  ]);
28509
- return /* @__PURE__ */ jsxs140(Fragment24, { children: [
28536
+ return /* @__PURE__ */ jsxs140(Fragment25, { children: [
28510
28537
  withDivider && withDividerPosition === "top" && /* @__PURE__ */ jsx229("tr", { className: "Layer__table-empty-row", children: /* @__PURE__ */ jsx229("td", { colSpan: Array.isArray(children) ? children.length : 1 }) }),
28511
28538
  /* @__PURE__ */ jsx229(
28512
28539
  "tr",
@@ -28543,7 +28570,7 @@ var Table = ({
28543
28570
  };
28544
28571
 
28545
28572
  // src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
28546
- import { Fragment as Fragment25, jsx as jsx231, jsxs as jsxs141 } from "react/jsx-runtime";
28573
+ import { Fragment as Fragment26, jsx as jsx231, jsxs as jsxs141 } from "react/jsx-runtime";
28547
28574
  var SourceDetailView = ({
28548
28575
  source,
28549
28576
  stringOverrides
@@ -28551,7 +28578,7 @@ var SourceDetailView = ({
28551
28578
  var _a, _b;
28552
28579
  switch (source.type) {
28553
28580
  case "Transaction_Ledger_Entry_Source": {
28554
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28581
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28555
28582
  /* @__PURE__ */ jsx231(
28556
28583
  DetailsListItem,
28557
28584
  {
@@ -28578,7 +28605,7 @@ var SourceDetailView = ({
28578
28605
  ] });
28579
28606
  }
28580
28607
  case "Invoice_Ledger_Entry_Source": {
28581
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28608
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28582
28609
  /* @__PURE__ */ jsx231(
28583
28610
  DetailsListItem,
28584
28611
  {
@@ -28598,7 +28625,7 @@ var SourceDetailView = ({
28598
28625
  ] });
28599
28626
  }
28600
28627
  case "Manual_Ledger_Entry_Source": {
28601
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28628
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28602
28629
  /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.memoLabel) || "Memo", children: source.memo }),
28603
28630
  /* @__PURE__ */ jsx231(
28604
28631
  DetailsListItem,
@@ -28610,7 +28637,7 @@ var SourceDetailView = ({
28610
28637
  ] });
28611
28638
  }
28612
28639
  case "Invoice_Payment_Ledger_Entry_Source": {
28613
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28640
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28614
28641
  /* @__PURE__ */ jsx231(
28615
28642
  DetailsListItem,
28616
28643
  {
@@ -28622,7 +28649,7 @@ var SourceDetailView = ({
28622
28649
  ] });
28623
28650
  }
28624
28651
  case "Refund_Allocation_Ledger_Entry_Source": {
28625
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28652
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28626
28653
  /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) }),
28627
28654
  /* @__PURE__ */ jsx231(
28628
28655
  DetailsListItem,
@@ -28634,7 +28661,7 @@ var SourceDetailView = ({
28634
28661
  ] });
28635
28662
  }
28636
28663
  case "Refund_Payment_Ledger_Entry_Source": {
28637
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28664
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28638
28665
  /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.refundedToCustomerAmount) }),
28639
28666
  /* @__PURE__ */ jsx231(
28640
28667
  DetailsListItem,
@@ -28655,7 +28682,7 @@ var SourceDetailView = ({
28655
28682
  );
28656
28683
  }
28657
28684
  case "Payout_Ledger_Entry_Source": {
28658
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28685
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28659
28686
  /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.paidOutAmount) }),
28660
28687
  /* @__PURE__ */ jsx231(
28661
28688
  DetailsListItem,
@@ -28667,7 +28694,7 @@ var SourceDetailView = ({
28667
28694
  ] });
28668
28695
  }
28669
28696
  case "Quickbooks_Ledger_Entry_Source": {
28670
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28697
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28671
28698
  /* @__PURE__ */ jsx231(
28672
28699
  DetailsListItem,
28673
28700
  {
@@ -28679,7 +28706,7 @@ var SourceDetailView = ({
28679
28706
  ] });
28680
28707
  }
28681
28708
  case "Invoice_Write_Off_Ledger_Entry_Source": {
28682
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28709
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28683
28710
  /* @__PURE__ */ jsx231(
28684
28711
  DetailsListItem,
28685
28712
  {
@@ -28699,19 +28726,19 @@ var SourceDetailView = ({
28699
28726
  ] });
28700
28727
  }
28701
28728
  case "Vendor_Refund_Allocation_Ledger_Entry_Source": {
28702
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28729
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28703
28730
  /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) }),
28704
28731
  /* @__PURE__ */ jsx231(DetailsListItem, { label: "Vendor Description", children: source.vendorDescription })
28705
28732
  ] });
28706
28733
  }
28707
28734
  case "Vendor_Refund_Payment_Ledger_Entry_Source": {
28708
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28735
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28709
28736
  /* @__PURE__ */ jsx231(DetailsListItem, { label: "Refunded Amount", children: convertCentsToCurrency(source.refundedByVendorAmount) }),
28710
28737
  /* @__PURE__ */ jsx231(DetailsListItem, { label: "Vendor Description", children: source.vendorDescription })
28711
28738
  ] });
28712
28739
  }
28713
28740
  case "Vendor_Payout_Ledger_Entry_Source": {
28714
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28741
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28715
28742
  /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.paidOutAmount) }),
28716
28743
  /* @__PURE__ */ jsx231(
28717
28744
  DetailsListItem,
@@ -28730,7 +28757,7 @@ var SourceDetailView = ({
28730
28757
  return /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) });
28731
28758
  }
28732
28759
  case "Bill_Ledger_Entry_Source": {
28733
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28760
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28734
28761
  /* @__PURE__ */ jsx231(DetailsListItem, { label: "Bill Number", children: source.billNumber }),
28735
28762
  /* @__PURE__ */ jsx231(DetailsListItem, { label: "Vendor Description", children: source.vendorDescription }),
28736
28763
  /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.dateLabel) || "Date", children: /* @__PURE__ */ jsx231(DateTime, { value: source.date }) }),
@@ -28738,21 +28765,21 @@ var SourceDetailView = ({
28738
28765
  ] });
28739
28766
  }
28740
28767
  case "Bill_Payment_Ledger_Entry_Source": {
28741
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28768
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28742
28769
  /* @__PURE__ */ jsx231(DetailsListItem, { label: "Bill Number", children: source.billNumber }),
28743
28770
  /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) })
28744
28771
  ] });
28745
28772
  }
28746
28773
  case "Vendor_Credit_Ledger_Entry_Source": {
28747
28774
  const vendorDisplayName = (_a = source.vendor.individualName) != null ? _a : source.vendor.companyName;
28748
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28775
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28749
28776
  /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) }),
28750
28777
  vendorDisplayName && /* @__PURE__ */ jsx231(DetailsListItem, { label: "Vendor", children: vendorDisplayName })
28751
28778
  ] });
28752
28779
  }
28753
28780
  case "Customer_Credit_Ledger_Entry_Source": {
28754
28781
  const customerDisplayName = (_b = source.customer.individualName) != null ? _b : source.customer.companyName;
28755
- return /* @__PURE__ */ jsxs141(Fragment25, { children: [
28782
+ return /* @__PURE__ */ jsxs141(Fragment26, { children: [
28756
28783
  /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) }),
28757
28784
  customerDisplayName && /* @__PURE__ */ jsx231(DetailsListItem, { label: "Customer", children: customerDisplayName })
28758
28785
  ] });
@@ -28765,8 +28792,8 @@ var LedgerAccountEntryDetails = ({
28765
28792
  stringOverrides
28766
28793
  }) => {
28767
28794
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
28768
- const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = useContext33(LedgerAccountsContext);
28769
- const { convertToInAppLink } = useInAppLinkContext();
28795
+ const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = useContext34(LedgerAccountsContext);
28796
+ const { renderInAppLink } = useInAppLinkContext();
28770
28797
  const { totalDebit, totalCredit } = useMemo50(() => {
28771
28798
  var _a2;
28772
28799
  let totalDebit2 = 0;
@@ -28787,14 +28814,14 @@ var LedgerAccountEntryDetails = ({
28787
28814
  var _a2, _b2;
28788
28815
  const badgeContent = (_a2 = ledgerEntrySource == null ? void 0 : ledgerEntrySource.entityName) != null ? _a2 : entryData == null ? void 0 : entryData.entry_type;
28789
28816
  const defaultBadge = /* @__PURE__ */ jsx231(Badge, { children: badgeContent });
28790
- if (!convertToInAppLink || !ledgerEntrySource) {
28817
+ if (!renderInAppLink || !ledgerEntrySource) {
28791
28818
  return defaultBadge;
28792
28819
  }
28793
28820
  const linkingMetadata = convertLedgerEntrySourceToLinkingMetadata(ledgerEntrySource);
28794
- return (_b2 = convertToInAppLink(linkingMetadata)) != null ? _b2 : defaultBadge;
28795
- }, [convertToInAppLink, entryData == null ? void 0 : entryData.entry_type, ledgerEntrySource]);
28821
+ return (_b2 = renderInAppLink(linkingMetadata)) != null ? _b2 : defaultBadge;
28822
+ }, [renderInAppLink, entryData == null ? void 0 : entryData.entry_type, ledgerEntrySource]);
28796
28823
  return /* @__PURE__ */ jsxs141("div", { className: "Layer__ledger-account__entry-details", children: [
28797
- /* @__PURE__ */ jsx231(Header5, { className: "Layer__ledger-account__entry-details__header", children: /* @__PURE__ */ jsxs141(HeaderRow, { children: [
28824
+ /* @__PURE__ */ jsx231(Header4, { className: "Layer__ledger-account__entry-details__header", children: /* @__PURE__ */ jsxs141(HeaderRow, { children: [
28798
28825
  /* @__PURE__ */ jsxs141(HeaderCol, { className: "Layer__hidden-lg Layer__hidden-xl", children: [
28799
28826
  /* @__PURE__ */ jsx231(BackButton, { onClick: closeSelectedEntry }),
28800
28827
  /* @__PURE__ */ jsx231(Heading, { size: "secondary" /* secondary */, children: (stringOverrides == null ? void 0 : stringOverrides.title) || "Transaction details" })
@@ -29158,11 +29185,11 @@ var VirtualizedDataTable = ({
29158
29185
  // src/components/BaseDetailView/BaseDetailView.tsx
29159
29186
  import { jsx as jsx234, jsxs as jsxs143 } from "react/jsx-runtime";
29160
29187
  var BaseDetailView = ({ name, onGoBack, slots, children, borderless = false }) => {
29161
- const { Header: Header6, BackIcon } = slots;
29188
+ const { Header: Header5, BackIcon } = slots;
29162
29189
  return /* @__PURE__ */ jsxs143(Container, { name, className: "Layer__BaseDetailView", transparentBg: borderless, children: [
29163
29190
  /* @__PURE__ */ jsxs143(HStack, { align: "center", gap: "md", className: "Layer__BaseDetailView__Header", children: [
29164
29191
  /* @__PURE__ */ jsx234(Button2, { variant: "outlined", icon: true, onPress: onGoBack, children: BackIcon ? /* @__PURE__ */ jsx234(BackIcon, {}) : /* @__PURE__ */ jsx234(BackArrow_default, {}) }),
29165
- /* @__PURE__ */ jsx234(Header6, {})
29192
+ /* @__PURE__ */ jsx234(Header5, {})
29166
29193
  ] }),
29167
29194
  children
29168
29195
  ] });
@@ -29241,8 +29268,19 @@ var ProfitAndLossDetailReport = ({
29241
29268
  stringOverrides
29242
29269
  }) => {
29243
29270
  const { businessId } = useLayerContext();
29244
- const { tagFilter, dateRange } = useContext34(ProfitAndLoss2.Context);
29271
+ const { tagFilter, dateRange } = useContext35(ProfitAndLoss2.Context);
29245
29272
  const [selectedSource, setSelectedSource] = useState59(null);
29273
+ const { renderInAppLink } = useInAppLinkContext();
29274
+ const badgeOrInAppLink = useMemo52(() => {
29275
+ var _a;
29276
+ if (!selectedSource) return void 0;
29277
+ const defaultBadge = /* @__PURE__ */ jsx237(Badge, { children: selectedSource.entityName });
29278
+ if (!renderInAppLink) {
29279
+ return defaultBadge;
29280
+ }
29281
+ const linkingMetadata = convertLedgerEntrySourceToLinkingMetadata(selectedSource);
29282
+ return (_a = renderInAppLink(linkingMetadata)) != null ? _a : defaultBadge;
29283
+ }, [renderInAppLink, selectedSource]);
29246
29284
  const dynamicBreadcrumbs = useMemo52(() => {
29247
29285
  return breadcrumbPath || [{ name: lineItemName, display_name: lineItemName }];
29248
29286
  }, [breadcrumbPath, lineItemName]);
@@ -29345,7 +29383,7 @@ var ProfitAndLossDetailReport = ({
29345
29383
  }
29346
29384
  }
29347
29385
  }), [stringOverrides, handleSourceClick]);
29348
- const Header6 = useCallback48(() => {
29386
+ const Header5 = useCallback48(() => {
29349
29387
  return /* @__PURE__ */ jsx237(
29350
29388
  DetailReportBreadcrumb,
29351
29389
  {
@@ -29356,18 +29394,18 @@ var ProfitAndLossDetailReport = ({
29356
29394
  );
29357
29395
  }, [dynamicBreadcrumbs, dateRange, onBreadcrumbClick]);
29358
29396
  if (selectedSource) {
29359
- return /* @__PURE__ */ jsx237(BaseDetailView, { slots: { Header: Header6 }, name: "Profit And Loss Detail Report", onGoBack: handleBackToList, borderless: true, children: /* @__PURE__ */ jsx237(VStack, { pi: "md", children: /* @__PURE__ */ jsxs145(
29397
+ return /* @__PURE__ */ jsx237(BaseDetailView, { slots: { Header: Header5 }, name: "Profit And Loss Detail Report", onGoBack: handleBackToList, borderless: true, children: /* @__PURE__ */ jsx237(VStack, { pi: "md", children: /* @__PURE__ */ jsxs145(
29360
29398
  DetailsList,
29361
29399
  {
29362
29400
  title: (stringOverrides == null ? void 0 : stringOverrides.sourceDetailsTitle) || "Transaction source",
29363
29401
  children: [
29364
- /* @__PURE__ */ jsx237(DetailsListItem, { label: "Source", children: /* @__PURE__ */ jsx237(Badge, { children: selectedSource.entityName }) }),
29402
+ /* @__PURE__ */ jsx237(DetailsListItem, { label: "Source", children: badgeOrInAppLink }),
29365
29403
  /* @__PURE__ */ jsx237(SourceDetailView, { source: selectedSource })
29366
29404
  ]
29367
29405
  }
29368
29406
  ) }) });
29369
29407
  }
29370
- return /* @__PURE__ */ jsx237(BaseDetailView, { slots: { Header: Header6 }, name: "Profit And Loss Detail Report", onGoBack: onClose, borderless: true, children: /* @__PURE__ */ jsxs145(VStack, { className: "Layer__ProfitAndLossDetailReport", children: [
29408
+ return /* @__PURE__ */ jsx237(BaseDetailView, { slots: { Header: Header5 }, name: "Profit And Loss Detail Report", onGoBack: onClose, borderless: true, children: /* @__PURE__ */ jsxs145(VStack, { className: "Layer__ProfitAndLossDetailReport", children: [
29371
29409
  /* @__PURE__ */ jsx237(
29372
29410
  VirtualizedDataTable,
29373
29411
  {
@@ -29392,7 +29430,7 @@ var ProfitAndLossDetailReport = ({
29392
29430
  };
29393
29431
 
29394
29432
  // src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
29395
- import { Fragment as Fragment26, jsx as jsx238, jsxs as jsxs146 } from "react/jsx-runtime";
29433
+ import { Fragment as Fragment27, jsx as jsx238, jsxs as jsxs146 } from "react/jsx-runtime";
29396
29434
  var ProfitAndLossReport = ({
29397
29435
  stringOverrides,
29398
29436
  allowedDatePickerModes,
@@ -29400,10 +29438,11 @@ var ProfitAndLossReport = ({
29400
29438
  defaultDatePickerMode,
29401
29439
  customDateRanges,
29402
29440
  csvMoneyFormat,
29403
- view
29441
+ view,
29442
+ renderInAppLink
29404
29443
  }) => {
29405
29444
  var _a;
29406
- const { comparisonConfig } = useContext35(ProfitAndLoss2.ComparisonContext);
29445
+ const { comparisonConfig } = useContext36(ProfitAndLoss2.ComparisonContext);
29407
29446
  const [selectedLineItem, setSelectedLineItem] = useState60(null);
29408
29447
  const breadcrumbIndexMap = useMemo53(() => {
29409
29448
  if (!selectedLineItem) return {};
@@ -29428,13 +29467,13 @@ var ProfitAndLossReport = ({
29428
29467
  const handleCloseDetailReport = useCallback49(() => {
29429
29468
  setSelectedLineItem(null);
29430
29469
  }, []);
29431
- return /* @__PURE__ */ jsx238(
29470
+ return /* @__PURE__ */ jsx238(InAppLinkProvider, { renderInAppLink, children: /* @__PURE__ */ jsx238(
29432
29471
  View,
29433
29472
  {
29434
29473
  type: "panel",
29435
- header: /* @__PURE__ */ jsxs146(Header5, { children: [
29474
+ header: /* @__PURE__ */ jsxs146(Header4, { children: [
29436
29475
  /* @__PURE__ */ jsxs146(HeaderRow, { children: [
29437
- /* @__PURE__ */ jsx238(HeaderCol, { children: /* @__PURE__ */ jsxs146(Fragment26, { children: [
29476
+ /* @__PURE__ */ jsx238(HeaderCol, { children: /* @__PURE__ */ jsxs146(Fragment27, { children: [
29438
29477
  /* @__PURE__ */ jsx238(
29439
29478
  ProfitAndLoss2.DatePicker,
29440
29479
  {
@@ -29481,11 +29520,11 @@ var ProfitAndLossReport = ({
29481
29520
  }
29482
29521
  )
29483
29522
  }
29484
- );
29523
+ ) });
29485
29524
  };
29486
29525
 
29487
29526
  // src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
29488
- import { useContext as useContext37, useMemo as useMemo56 } from "react";
29527
+ import { useContext as useContext38, useMemo as useMemo56 } from "react";
29489
29528
 
29490
29529
  // src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesList.tsx
29491
29530
  import { useMemo as useMemo54 } from "react";
@@ -29632,7 +29671,7 @@ function ProfitAndLossSummariesSummary({
29632
29671
  }
29633
29672
 
29634
29673
  // src/views/AccountingOverview/internal/TransactionsToReview.tsx
29635
- import { useContext as useContext36, useMemo as useMemo55 } from "react";
29674
+ import { useContext as useContext37, useMemo as useMemo55 } from "react";
29636
29675
  import { getMonth as getMonth2, getYear as getYear3, startOfMonth as startOfMonth9 } from "date-fns";
29637
29676
  import { jsx as jsx243, jsxs as jsxs148 } from "react/jsx-runtime";
29638
29677
  var CLASS_NAME13 = "Layer__TransactionsToReview";
@@ -29643,7 +29682,7 @@ function TransactionsToReview({
29643
29682
  variants
29644
29683
  }) {
29645
29684
  const { size = "sm" } = variants != null ? variants : {};
29646
- const { dateRange: contextDateRange } = useContext36(ProfitAndLoss2.Context);
29685
+ const { dateRange: contextDateRange } = useContext37(ProfitAndLoss2.Context);
29647
29686
  const dateRange = usePnlDateRange ? contextDateRange : void 0;
29648
29687
  const { data, isLoading, isError, refetch } = useProfitAndLossLTM({
29649
29688
  currentDate: dateRange ? dateRange.startDate : startOfMonth9(/* @__PURE__ */ new Date()),
@@ -29736,7 +29775,7 @@ function Internal_ProfitAndLossSummaries({
29736
29775
  isLoading,
29737
29776
  setSidebarScope,
29738
29777
  sidebarScope
29739
- } = useContext37(ProfitAndLoss2.Context);
29778
+ } = useContext38(ProfitAndLoss2.Context);
29740
29779
  const { revenueChartData, expensesChartData } = useMemo56(
29741
29780
  () => ({
29742
29781
  revenueChartData: toMiniChartData({ scope: "revenue", data }),
@@ -29839,10 +29878,10 @@ function ProfitAndLossSummaries(_a) {
29839
29878
  }
29840
29879
 
29841
29880
  // src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
29842
- import { useContext as useContext41 } from "react";
29881
+ import { useContext as useContext42 } from "react";
29843
29882
 
29844
29883
  // src/contexts/TableContext/TableContext.tsx
29845
- import { createContext as createContext20, useState as useState61 } from "react";
29884
+ import { createContext as createContext21, useState as useState61 } from "react";
29846
29885
  import { jsx as jsx245 } from "react/jsx-runtime";
29847
29886
  var defaultValue = {
29848
29887
  expandedRows: [],
@@ -29854,7 +29893,7 @@ var defaultValue = {
29854
29893
  setExpandedAllRows: () => {
29855
29894
  }
29856
29895
  };
29857
- var TableContext = createContext20(defaultValue);
29896
+ var TableContext = createContext21(defaultValue);
29858
29897
  var TableProvider = ({ children }) => {
29859
29898
  const [expandedRows, setExpandedRowsState] = useState61([]);
29860
29899
  const [expandedAllRows, setExpandedAllRows] = useState61(false);
@@ -29883,10 +29922,10 @@ var TableProvider = ({ children }) => {
29883
29922
  };
29884
29923
 
29885
29924
  // src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
29886
- import { Fragment as Fragment27, useContext as useContext39, useEffect as useEffect28, useMemo as useMemo57 } from "react";
29925
+ import { Fragment as Fragment28, useContext as useContext40, useEffect as useEffect28, useMemo as useMemo57 } from "react";
29887
29926
 
29888
29927
  // src/hooks/useTableExpandRow/useTableExpandRow.tsx
29889
- import { useContext as useContext38 } from "react";
29928
+ import { useContext as useContext39 } from "react";
29890
29929
  var useTableExpandRow = () => {
29891
29930
  const {
29892
29931
  expandedAllRows,
@@ -29894,7 +29933,7 @@ var useTableExpandRow = () => {
29894
29933
  expandAllRows,
29895
29934
  expandedRows,
29896
29935
  setExpandedRows
29897
- } = useContext38(TableContext);
29936
+ } = useContext39(TableContext);
29898
29937
  const toggleAllRows = () => {
29899
29938
  if (expandedAllRows) {
29900
29939
  setIsOpen([]);
@@ -30000,7 +30039,7 @@ var mergeComparisonLineItemsAtDepth = (lineItems) => {
30000
30039
 
30001
30040
  // src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
30002
30041
  import classNames78 from "classnames";
30003
- import { Fragment as Fragment28, jsx as jsx246, jsxs as jsxs150 } from "react/jsx-runtime";
30042
+ import { Fragment as Fragment29, jsx as jsx246, jsxs as jsxs150 } from "react/jsx-runtime";
30004
30043
  var ProfitAndLossCompareTable = ({
30005
30044
  stringOverrides
30006
30045
  }) => {
@@ -30009,7 +30048,7 @@ var ProfitAndLossCompareTable = ({
30009
30048
  isLoading,
30010
30049
  comparePeriods,
30011
30050
  selectedCompareOptions
30012
- } = useContext39(ProfitAndLoss2.ComparisonContext);
30051
+ } = useContext40(ProfitAndLoss2.ComparisonContext);
30013
30052
  const { isOpen, setIsOpen } = useTableExpandRow();
30014
30053
  const { data: bookkeepingPeriods } = useBookkeepingPeriods();
30015
30054
  const rangeDisplayMode = useReportModeWithFallback("ProfitAndLoss" /* ProfitAndLoss */, "monthPicker");
@@ -30050,7 +30089,7 @@ var ProfitAndLossCompareTable = ({
30050
30089
  }
30051
30090
  });
30052
30091
  if (rowData.length === 0) {
30053
- return /* @__PURE__ */ jsx246(Fragment28, {});
30092
+ return /* @__PURE__ */ jsx246(Fragment29, {});
30054
30093
  }
30055
30094
  const mergedLineItems = mergeComparisonLineItemsAtDepth(
30056
30095
  rowData
@@ -30059,7 +30098,7 @@ var ProfitAndLossCompareTable = ({
30059
30098
  }
30060
30099
  const expandable = (lineItem == null ? void 0 : lineItem.lineItems) && lineItem.lineItems.length > 0 ? true : false;
30061
30100
  const expanded = expandable ? isOpen(rowKey) : true;
30062
- return /* @__PURE__ */ jsxs150(Fragment27, { children: [
30101
+ return /* @__PURE__ */ jsxs150(Fragment28, { children: [
30063
30102
  /* @__PURE__ */ jsxs150(
30064
30103
  TableRow,
30065
30104
  {
@@ -30093,7 +30132,7 @@ var ProfitAndLossCompareTable = ({
30093
30132
  return /* @__PURE__ */ jsxs150(Table, { borderCollapse: "collapse", bottomSpacing: false, children: [
30094
30133
  /* @__PURE__ */ jsx246(TableHead, { children: selectedCompareOptions && selectedCompareOptions.length > 1 && /* @__PURE__ */ jsxs150(TableRow, { rowKey: "", children: [
30095
30134
  /* @__PURE__ */ jsx246(TableCell, { isHeaderCell: true }),
30096
- selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxs150(Fragment27, { children: [
30135
+ selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxs150(Fragment28, { children: [
30097
30136
  /* @__PURE__ */ jsx246(TableCell, { primary: true, isHeaderCell: true, children: option.displayName }, option.displayName + "-" + i),
30098
30137
  comparePeriods && Array.from({ length: comparePeriods - 1 }, (_, index) => /* @__PURE__ */ jsx246(TableCell, { isHeaderCell: true }, option.displayName + "-" + index))
30099
30138
  ] }, option.displayName + "-" + i))
@@ -30101,7 +30140,7 @@ var ProfitAndLossCompareTable = ({
30101
30140
  /* @__PURE__ */ jsxs150(TableBody, { children: [
30102
30141
  comparePeriods && /* @__PURE__ */ jsxs150(TableRow, { rowKey: "", children: [
30103
30142
  /* @__PURE__ */ jsx246(TableCell, { isHeaderCell: true }),
30104
- selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsx246(Fragment27, { children: generateComparisonPeriods(
30143
+ selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsx246(Fragment28, { children: generateComparisonPeriods(
30105
30144
  dateRange.startDate,
30106
30145
  comparePeriods,
30107
30146
  rangeDisplayMode
@@ -30109,7 +30148,7 @@ var ProfitAndLossCompareTable = ({
30109
30148
  month.label,
30110
30149
  " ",
30111
30150
  getBookkeepingPeriodStatus(month.date)
30112
- ] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsx246(Fragment27, { children: generateComparisonPeriods(
30151
+ ] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsx246(Fragment28, { children: generateComparisonPeriods(
30113
30152
  dateRange.startDate,
30114
30153
  comparePeriods,
30115
30154
  rangeDisplayMode
@@ -30141,7 +30180,7 @@ var ProfitAndLossCompareTable = ({
30141
30180
  };
30142
30181
 
30143
30182
  // src/components/ProfitAndLossTable/ProfitAndLossTableComponent.tsx
30144
- import { Fragment as Fragment29, useContext as useContext40, useEffect as useEffect29 } from "react";
30183
+ import { Fragment as Fragment30, useContext as useContext41, useEffect as useEffect29 } from "react";
30145
30184
  import classNames79 from "classnames";
30146
30185
  import { jsx as jsx247, jsxs as jsxs151 } from "react/jsx-runtime";
30147
30186
  var ProfitAndLossTableComponent = ({
@@ -30149,7 +30188,7 @@ var ProfitAndLossTableComponent = ({
30149
30188
  stringOverrides,
30150
30189
  onLineItemClick
30151
30190
  }) => {
30152
- const { data, isLoading } = useContext40(ProfitAndLoss2.Context);
30191
+ const { data, isLoading } = useContext41(ProfitAndLoss2.Context);
30153
30192
  const { isOpen, setIsOpen } = useTableExpandRow();
30154
30193
  useEffect29(() => {
30155
30194
  setIsOpen(["income", "cost_of_goods_sold", "expenses", "other_activity"]);
@@ -30182,7 +30221,7 @@ var ProfitAndLossTableComponent = ({
30182
30221
  ...parentBreadcrumbs,
30183
30222
  { name: lineItem.name, display_name: lineItem.displayName }
30184
30223
  ];
30185
- return /* @__PURE__ */ jsxs151(Fragment29, { children: [
30224
+ return /* @__PURE__ */ jsxs151(Fragment30, { children: [
30186
30225
  /* @__PURE__ */ jsxs151(
30187
30226
  TableRow,
30188
30227
  {
@@ -30318,14 +30357,14 @@ var ProfitAndLossTableComponent = ({
30318
30357
  // src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
30319
30358
  import { jsx as jsx248 } from "react/jsx-runtime";
30320
30359
  var ProfitAndLossTableWithProvider = (props) => {
30321
- const { compareModeActive } = useContext41(ProfitAndLoss2.ComparisonContext);
30360
+ const { compareModeActive } = useContext42(ProfitAndLoss2.ComparisonContext);
30322
30361
  return /* @__PURE__ */ jsx248(TableProvider, { children: compareModeActive ? /* @__PURE__ */ jsx248("div", { className: "Layer__compare__table__wrapper", children: /* @__PURE__ */ jsx248(ProfitAndLossCompareTable, __spreadValues({}, props)) }) : /* @__PURE__ */ jsx248(ProfitAndLossTableComponent, __spreadValues({}, props)) });
30323
30362
  };
30324
30363
 
30325
30364
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
30326
30365
  import { endOfMonth as endOfMonth7, startOfMonth as startOfMonth10 } from "date-fns";
30327
30366
  import { jsx as jsx249 } from "react/jsx-runtime";
30328
- var PNLContext = createContext21({
30367
+ var PNLContext = createContext22({
30329
30368
  data: void 0,
30330
30369
  filteredDataRevenue: [],
30331
30370
  filteredTotalRevenue: void 0,
@@ -30504,7 +30543,7 @@ var BalanceSheetExpandAllButton = ({
30504
30543
  };
30505
30544
 
30506
30545
  // src/components/BalanceSheetTable/BalanceSheetTable.tsx
30507
- import { Fragment as Fragment30, useEffect as useEffect30 } from "react";
30546
+ import { Fragment as Fragment31, useEffect as useEffect30 } from "react";
30508
30547
  import { jsx as jsx252, jsxs as jsxs152 } from "react/jsx-runtime";
30509
30548
  var BalanceSheetTable = ({
30510
30549
  data,
@@ -30528,7 +30567,7 @@ var BalanceSheetTable = ({
30528
30567
  if (expandable) {
30529
30568
  allRowKeys.push(rowKey);
30530
30569
  }
30531
- return /* @__PURE__ */ jsxs152(Fragment30, { children: [
30570
+ return /* @__PURE__ */ jsxs152(Fragment31, { children: [
30532
30571
  /* @__PURE__ */ jsxs152(
30533
30572
  TableRow,
30534
30573
  {
@@ -30579,7 +30618,7 @@ var BalanceSheetTable = ({
30579
30618
  /* @__PURE__ */ jsx252(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.typeColumnHeader) || "Type" }),
30580
30619
  /* @__PURE__ */ jsx252(TableCell, { isHeaderCell: true, align: "right" /* RIGHT */, children: (stringOverrides == null ? void 0 : stringOverrides.totalColumnHeader) || "Total" })
30581
30620
  ] }) }),
30582
- /* @__PURE__ */ jsx252(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx252(Fragment30, { children: data[row.lineItem] && renderLineItem(
30621
+ /* @__PURE__ */ jsx252(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx252(Fragment31, { children: data[row.lineItem] && renderLineItem(
30583
30622
  data[row.lineItem],
30584
30623
  0,
30585
30624
  row.lineItem,
@@ -30653,7 +30692,7 @@ function useBalanceSheetDownload({
30653
30692
  }
30654
30693
 
30655
30694
  // src/components/BalanceSheet/download/BalanceSheetDownloadButton.tsx
30656
- import { Fragment as Fragment31, jsx as jsx253, jsxs as jsxs153 } from "react/jsx-runtime";
30695
+ import { Fragment as Fragment32, jsx as jsx253, jsxs as jsxs153 } from "react/jsx-runtime";
30657
30696
  function BalanceSheetDownloadButton({
30658
30697
  effectiveDate,
30659
30698
  iconOnly
@@ -30663,7 +30702,7 @@ function BalanceSheetDownloadButton({
30663
30702
  effectiveDate,
30664
30703
  onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
30665
30704
  });
30666
- return /* @__PURE__ */ jsxs153(Fragment31, { children: [
30705
+ return /* @__PURE__ */ jsxs153(Fragment32, { children: [
30667
30706
  /* @__PURE__ */ jsx253(
30668
30707
  DownloadButton,
30669
30708
  {
@@ -30710,7 +30749,7 @@ var BalanceSheetView = ({
30710
30749
  {
30711
30750
  type: "panel",
30712
30751
  ref: containerRef,
30713
- header: /* @__PURE__ */ jsx254(Header5, { children: /* @__PURE__ */ jsxs154(HeaderRow, { children: [
30752
+ header: /* @__PURE__ */ jsx254(Header4, { children: /* @__PURE__ */ jsxs154(HeaderRow, { children: [
30714
30753
  /* @__PURE__ */ jsx254(HeaderCol, { children: /* @__PURE__ */ jsx254(BalanceSheetDatePicker, {}) }),
30715
30754
  withExpandAllButton && /* @__PURE__ */ jsx254(HeaderCol, { children: /* @__PURE__ */ jsx254(BalanceSheetExpandAllButton, { view }) })
30716
30755
  ] }) }),
@@ -30730,7 +30769,7 @@ var BalanceSheetView = ({
30730
30769
  {
30731
30770
  type: "panel",
30732
30771
  ref: containerRef,
30733
- header: /* @__PURE__ */ jsx254(Header5, { children: /* @__PURE__ */ jsxs154(HeaderRow, { children: [
30772
+ header: /* @__PURE__ */ jsx254(Header4, { children: /* @__PURE__ */ jsxs154(HeaderRow, { children: [
30734
30773
  /* @__PURE__ */ jsx254(HeaderCol, { children: /* @__PURE__ */ jsx254(BalanceSheetDatePicker, {}) }),
30735
30774
  /* @__PURE__ */ jsxs154(HeaderCol, { children: [
30736
30775
  withExpandAllButton && /* @__PURE__ */ jsx254(BalanceSheetExpandAllButton, { view }),
@@ -30756,7 +30795,7 @@ var BalanceSheetView = ({
30756
30795
  };
30757
30796
 
30758
30797
  // src/components/StatementOfCashFlowTable/StatementOfCashFlowTable.tsx
30759
- import { Fragment as Fragment32 } from "react";
30798
+ import { Fragment as Fragment33 } from "react";
30760
30799
  import { jsx as jsx255, jsxs as jsxs155 } from "react/jsx-runtime";
30761
30800
  var StatementOfCashFlowTable = ({
30762
30801
  data,
@@ -30767,7 +30806,7 @@ var StatementOfCashFlowTable = ({
30767
30806
  const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
30768
30807
  const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
30769
30808
  const expanded = expandable ? isOpen(rowKey) : true;
30770
- return /* @__PURE__ */ jsxs155(Fragment32, { children: [
30809
+ return /* @__PURE__ */ jsxs155(Fragment33, { children: [
30771
30810
  /* @__PURE__ */ jsxs155(
30772
30811
  TableRow,
30773
30812
  {
@@ -30819,7 +30858,7 @@ var StatementOfCashFlowTable = ({
30819
30858
  ] }) }),
30820
30859
  /* @__PURE__ */ jsx255(TableBody, { children: config.map((row, idx) => {
30821
30860
  if (row.type === "line_item") {
30822
- return /* @__PURE__ */ jsx255(Fragment32, { children: data[row.lineItem] && renderLineItem(
30861
+ return /* @__PURE__ */ jsx255(Fragment33, { children: data[row.lineItem] && renderLineItem(
30823
30862
  data[row.lineItem],
30824
30863
  0,
30825
30864
  row.lineItem ? row.lineItem : "",
@@ -30945,7 +30984,7 @@ function useCashflowStatementDownload({
30945
30984
  }
30946
30985
 
30947
30986
  // src/components/StatementOfCashFlow/download/CashflowStatementDownloadButton.tsx
30948
- import { Fragment as Fragment33, jsx as jsx256, jsxs as jsxs156 } from "react/jsx-runtime";
30987
+ import { Fragment as Fragment34, jsx as jsx256, jsxs as jsxs156 } from "react/jsx-runtime";
30949
30988
  function CashflowStatementDownloadButton({
30950
30989
  startDate,
30951
30990
  endDate,
@@ -30957,7 +30996,7 @@ function CashflowStatementDownloadButton({
30957
30996
  endDate,
30958
30997
  onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
30959
30998
  });
30960
- return /* @__PURE__ */ jsxs156(Fragment33, { children: [
30999
+ return /* @__PURE__ */ jsxs156(Fragment34, { children: [
30961
31000
  /* @__PURE__ */ jsx256(
30962
31001
  DownloadButton,
30963
31002
  {
@@ -31088,7 +31127,7 @@ var StatementOfCashFlowView = ({
31088
31127
  {
31089
31128
  type: "panel",
31090
31129
  ref: containerRef,
31091
- header: /* @__PURE__ */ jsx258(Header5, { children: /* @__PURE__ */ jsxs157(HeaderRow, { children: [
31130
+ header: /* @__PURE__ */ jsx258(Header4, { children: /* @__PURE__ */ jsxs157(HeaderRow, { children: [
31092
31131
  /* @__PURE__ */ jsx258(HeaderCol, { children: /* @__PURE__ */ jsx258(
31093
31132
  StatementOfCashFlowDatePicker,
31094
31133
  {
@@ -31119,12 +31158,12 @@ var StatementOfCashFlowView = ({
31119
31158
  };
31120
31159
 
31121
31160
  // src/components/ChartOfAccounts/ChartOfAccounts.tsx
31122
- import { useContext as useContext48 } from "react";
31161
+ import { useContext as useContext49 } from "react";
31123
31162
 
31124
31163
  // src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
31125
- import { createContext as createContext22 } from "react";
31164
+ import { createContext as createContext23 } from "react";
31126
31165
  import { endOfMonth as endOfMonth9, startOfMonth as startOfMonth12 } from "date-fns";
31127
- var ChartOfAccountsContext = createContext22(
31166
+ var ChartOfAccountsContext = createContext23(
31128
31167
  {
31129
31168
  data: void 0,
31130
31169
  isLoading: false,
@@ -32088,7 +32127,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
32088
32127
  };
32089
32128
 
32090
32129
  // src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
32091
- import { useContext as useContext45, useState as useState66 } from "react";
32130
+ import { useContext as useContext46, useState as useState66 } from "react";
32092
32131
 
32093
32132
  // src/icons/Plus.tsx
32094
32133
  import { jsx as jsx259, jsxs as jsxs158 } from "react/jsx-runtime";
@@ -32129,11 +32168,11 @@ var Plus = (_a) => {
32129
32168
  var Plus_default = Plus;
32130
32169
 
32131
32170
  // src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
32132
- import { useContext as useContext42 } from "react";
32171
+ import { useContext as useContext43 } from "react";
32133
32172
  import { endOfMonth as endOfMonth11, startOfMonth as startOfMonth14 } from "date-fns";
32134
32173
  import { jsx as jsx260 } from "react/jsx-runtime";
32135
32174
  var ChartOfAccountsDatePicker = () => {
32136
- const { changeDateRange, dateRange } = useContext42(ChartOfAccountsContext);
32175
+ const { changeDateRange, dateRange } = useContext43(ChartOfAccountsContext);
32137
32176
  return /* @__PURE__ */ jsx260(
32138
32177
  DatePicker,
32139
32178
  {
@@ -32152,7 +32191,7 @@ var ChartOfAccountsDatePicker = () => {
32152
32191
  };
32153
32192
 
32154
32193
  // src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
32155
- import { useContext as useContext43, useMemo as useMemo61 } from "react";
32194
+ import { useContext as useContext44, useMemo as useMemo61 } from "react";
32156
32195
 
32157
32196
  // src/components/ChartOfAccountsForm/useParentOptions.ts
32158
32197
  import { useMemo as useMemo60 } from "react";
@@ -32183,7 +32222,7 @@ var ChartOfAccountsForm = ({
32183
32222
  submitForm,
32184
32223
  sendingForm,
32185
32224
  apiError
32186
- } = useContext43(ChartOfAccountsContext);
32225
+ } = useContext44(ChartOfAccountsContext);
32187
32226
  const parentOptions = useParentOptions(data);
32188
32227
  const entry = useMemo61(() => {
32189
32228
  if ((form == null ? void 0 : form.action) === "edit" && form.accountId) {
@@ -32205,7 +32244,7 @@ var ChartOfAccountsForm = ({
32205
32244
  submitForm();
32206
32245
  },
32207
32246
  children: [
32208
- /* @__PURE__ */ jsx261(Header5, { className: "Layer__chart-of-accounts__sidebar__header", children: /* @__PURE__ */ jsxs159(HeaderRow, { children: [
32247
+ /* @__PURE__ */ jsx261(Header4, { className: "Layer__chart-of-accounts__sidebar__header", children: /* @__PURE__ */ jsxs159(HeaderRow, { children: [
32209
32248
  /* @__PURE__ */ jsx261(HeaderCol, { children: /* @__PURE__ */ jsx261(Heading, { size: "secondary" /* secondary */, className: "title", children: (form == null ? void 0 : form.action) === "edit" ? (stringOverrides == null ? void 0 : stringOverrides.editModeHeader) || "Edit Account" : (stringOverrides == null ? void 0 : stringOverrides.createModeHeader) || "Add New Account" }) }),
32210
32249
  /* @__PURE__ */ jsxs159(HeaderCol, { className: "actions", children: [
32211
32250
  /* @__PURE__ */ jsx261(
@@ -32398,7 +32437,7 @@ var ChartOfAccountsSidebar = ({
32398
32437
  };
32399
32438
 
32400
32439
  // src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
32401
- import { Fragment as Fragment34, useContext as useContext44, useEffect as useEffect33, useMemo as useMemo62, useState as useState65 } from "react";
32440
+ import { Fragment as Fragment35, useContext as useContext45, useEffect as useEffect33, useMemo as useMemo62, useState as useState65 } from "react";
32402
32441
 
32403
32442
  // src/icons/Edit2.tsx
32404
32443
  import { jsx as jsx263 } from "react/jsx-runtime";
@@ -32577,7 +32616,7 @@ var getMatchedTextIndices = ({
32577
32616
  };
32578
32617
 
32579
32618
  // src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
32580
- import { Fragment as Fragment35, jsx as jsx264, jsxs as jsxs160 } from "react/jsx-runtime";
32619
+ import { Fragment as Fragment36, jsx as jsx264, jsxs as jsxs160 } from "react/jsx-runtime";
32581
32620
  var highlightMatch = ({ text, query, isMatching }) => {
32582
32621
  const matchedTextIndices = getMatchedTextIndices({ text, query, isMatching });
32583
32622
  if (matchedTextIndices === null) {
@@ -32618,8 +32657,8 @@ var ChartOfAccountsTableContent = ({
32618
32657
  expandAll,
32619
32658
  templateAccountsEditable
32620
32659
  }) => {
32621
- const { setSelectedAccount } = useContext44(LedgerAccountsContext);
32622
- const { editAccount, deleteAccount } = useContext44(ChartOfAccountsContext);
32660
+ const { setSelectedAccount } = useContext45(LedgerAccountsContext);
32661
+ const { editAccount, deleteAccount } = useContext45(ChartOfAccountsContext);
32623
32662
  const [toggledKeys, setToggledKeys] = useState65({});
32624
32663
  const [accountToDelete, setAccountToDelete] = useState65(null);
32625
32664
  const sortedAccounts = useMemo62(() => sortAccountsRecursive(data.accounts), [data.accounts]);
@@ -32703,7 +32742,7 @@ var ChartOfAccountsTableContent = ({
32703
32742
  e.stopPropagation();
32704
32743
  setAccountToDelete(account);
32705
32744
  };
32706
- return /* @__PURE__ */ jsxs160(Fragment34, { children: [
32745
+ return /* @__PURE__ */ jsxs160(Fragment35, { children: [
32707
32746
  /* @__PURE__ */ jsxs160(
32708
32747
  TableRow,
32709
32748
  {
@@ -32799,7 +32838,7 @@ var ChartOfAccountsTableContent = ({
32799
32838
  }
32800
32839
  ) });
32801
32840
  }
32802
- return /* @__PURE__ */ jsxs160(Fragment35, { children: [
32841
+ return /* @__PURE__ */ jsxs160(Fragment36, { children: [
32803
32842
  /* @__PURE__ */ jsxs160(Table, { componentName: "chart-of-accounts", children: [
32804
32843
  /* @__PURE__ */ jsxs160("colgroup", { children: [
32805
32844
  /* @__PURE__ */ jsx264("col", { className: "Layer__chart-of-accounts--name" }),
@@ -32899,7 +32938,7 @@ function useAccountBalancesDownload({
32899
32938
  }
32900
32939
 
32901
32940
  // src/components/ChartOfAccounts/download/AccountBalancesDownloadButton.tsx
32902
- import { Fragment as Fragment36, jsx as jsx265, jsxs as jsxs161 } from "react/jsx-runtime";
32941
+ import { Fragment as Fragment37, jsx as jsx265, jsxs as jsxs161 } from "react/jsx-runtime";
32903
32942
  function AccountBalancesDownloadButton({
32904
32943
  startCutoff,
32905
32944
  endCutoff,
@@ -32911,7 +32950,7 @@ function AccountBalancesDownloadButton({
32911
32950
  endCutoff,
32912
32951
  onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
32913
32952
  });
32914
- return /* @__PURE__ */ jsxs161(Fragment36, { children: [
32953
+ return /* @__PURE__ */ jsxs161(Fragment37, { children: [
32915
32954
  /* @__PURE__ */ jsx265(
32916
32955
  DownloadButton,
32917
32956
  {
@@ -32942,7 +32981,7 @@ var ChartOfAccountsTableWithPanel = ({
32942
32981
  stringOverrides,
32943
32982
  templateAccountsEditable
32944
32983
  }) => {
32945
- const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext45(ChartOfAccountsContext);
32984
+ const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext46(ChartOfAccountsContext);
32946
32985
  const [expandAll, setExpandAll] = useState66();
32947
32986
  const { inputValue, searchQuery, handleInputChange } = useDebouncedSearchInput({ initialInputState: "" });
32948
32987
  return /* @__PURE__ */ jsxs162(
@@ -32958,7 +32997,7 @@ var ChartOfAccountsTableWithPanel = ({
32958
32997
  sidebarIsOpen: Boolean(form),
32959
32998
  parentRef: containerRef,
32960
32999
  children: [
32961
- /* @__PURE__ */ jsx266(Header5, { className: `Layer__${COMPONENT_NAME7}__header`, asHeader: true, rounded: true, children: /* @__PURE__ */ jsx266(HeaderRow, { children: /* @__PURE__ */ jsx266(HeaderCol, { children: /* @__PURE__ */ jsx266(
33000
+ /* @__PURE__ */ jsx266(Header4, { className: `Layer__${COMPONENT_NAME7}__header`, asHeader: true, rounded: true, children: /* @__PURE__ */ jsx266(HeaderRow, { children: /* @__PURE__ */ jsx266(HeaderCol, { children: /* @__PURE__ */ jsx266(
32962
33001
  Heading,
32963
33002
  {
32964
33003
  className: `Layer__${COMPONENT_NAME7}__title`,
@@ -32966,7 +33005,7 @@ var ChartOfAccountsTableWithPanel = ({
32966
33005
  children: (stringOverrides == null ? void 0 : stringOverrides.headerText) || "Chart of Accounts"
32967
33006
  }
32968
33007
  ) }) }) }),
32969
- /* @__PURE__ */ jsx266(Header5, { className: `Layer__${COMPONENT_NAME7}__header`, sticky: true, children: /* @__PURE__ */ jsxs162(HeaderRow, { children: [
33008
+ /* @__PURE__ */ jsx266(Header4, { className: `Layer__${COMPONENT_NAME7}__header`, sticky: true, children: /* @__PURE__ */ jsxs162(HeaderRow, { children: [
32970
33009
  /* @__PURE__ */ jsx266(HeaderCol, { children: /* @__PURE__ */ jsx266(
32971
33010
  Heading,
32972
33011
  {
@@ -33037,13 +33076,13 @@ var ChartOfAccountsTableWithPanel = ({
33037
33076
 
33038
33077
  // src/components/LedgerAccount/LedgerAccountIndex.tsx
33039
33078
  import {
33040
- useContext as useContext47,
33079
+ useContext as useContext48,
33041
33080
  useMemo as useMemo64,
33042
33081
  useState as useState67
33043
33082
  } from "react";
33044
33083
 
33045
33084
  // src/components/LedgerAccount/LedgerAccountRow.tsx
33046
- import { useContext as useContext46, useMemo as useMemo63 } from "react";
33085
+ import { useContext as useContext47, useMemo as useMemo63 } from "react";
33047
33086
  import classNames80 from "classnames";
33048
33087
  import { parseISO as parseISO14, format as formatTime11 } from "date-fns";
33049
33088
  import { jsx as jsx267, jsxs as jsxs163 } from "react/jsx-runtime";
@@ -33054,7 +33093,7 @@ var LedgerAccountRow = ({
33054
33093
  nodeType
33055
33094
  }) => {
33056
33095
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
33057
- const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext46(LedgerAccountsContext);
33096
+ const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext47(LedgerAccountsContext);
33058
33097
  const ledgerEntrySource = useMemo63(() => {
33059
33098
  return row.source ? decodeLedgerEntrySource(row.source) : void 0;
33060
33099
  }, [row.source]);
@@ -33178,7 +33217,7 @@ var LedgerAccountRow = ({
33178
33217
 
33179
33218
  // src/components/LedgerAccount/LedgerAccountIndex.tsx
33180
33219
  import classNames81 from "classnames";
33181
- import { Fragment as Fragment37, jsx as jsx268, jsxs as jsxs164 } from "react/jsx-runtime";
33220
+ import { Fragment as Fragment38, jsx as jsx268, jsxs as jsxs164 } from "react/jsx-runtime";
33182
33221
  var LedgerAccount = ({
33183
33222
  containerRef,
33184
33223
  pageSize = 15,
@@ -33199,7 +33238,7 @@ var LedgerAccount = ({
33199
33238
  refetch,
33200
33239
  hasMore,
33201
33240
  fetchMore
33202
- } = useContext47(LedgerAccountsContext);
33241
+ } = useContext48(LedgerAccountsContext);
33203
33242
  const baseClassName = classNames81(
33204
33243
  "Layer__ledger-account__index",
33205
33244
  selectedAccount && "open"
@@ -33239,7 +33278,7 @@ var LedgerAccount = ({
33239
33278
  parentRef: containerRef,
33240
33279
  className: "Layer__ledger-account__panel",
33241
33280
  children: /* @__PURE__ */ jsxs164("div", { className: baseClassName, children: [
33242
- /* @__PURE__ */ jsx268(Header5, { className: "Layer__ledger-account__header", children: /* @__PURE__ */ jsx268(HeaderRow, { children: /* @__PURE__ */ jsxs164(HeaderCol, { children: [
33281
+ /* @__PURE__ */ jsx268(Header4, { className: "Layer__ledger-account__header", children: /* @__PURE__ */ jsx268(HeaderRow, { children: /* @__PURE__ */ jsxs164(HeaderCol, { children: [
33243
33282
  /* @__PURE__ */ jsx268(BackButton, { onClick: close2 }),
33244
33283
  /* @__PURE__ */ jsxs164("div", { className: "Layer__ledger-account__title-container", children: [
33245
33284
  /* @__PURE__ */ jsx268(
@@ -33276,13 +33315,13 @@ var LedgerAccount = ({
33276
33315
  /* @__PURE__ */ jsxs164("table", { className: "Layer__table Layer__table--hover-effect Layer__ledger-account-table", children: [
33277
33316
  /* @__PURE__ */ jsx268("thead", { children: /* @__PURE__ */ jsxs164("tr", { children: [
33278
33317
  view !== "desktop" && /* @__PURE__ */ jsx268("th", {}),
33279
- view === "desktop" && /* @__PURE__ */ jsxs164(Fragment37, { children: [
33318
+ view === "desktop" && /* @__PURE__ */ jsxs164(Fragment38, { children: [
33280
33319
  /* @__PURE__ */ jsx268("th", { className: "Layer__table-header", children: ((_b = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _b.dateColumnHeader) || "Date" }),
33281
33320
  /* @__PURE__ */ jsx268("th", { className: "Layer__table-header", children: ((_c = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _c.journalIdColumnHeader) || "Journal ID #" }),
33282
33321
  /* @__PURE__ */ jsx268("th", { className: "Layer__table-header", children: ((_d = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _d.sourceColumnHeader) || "Source" }),
33283
33322
  nodeType !== "Leaf" /* Leaf */ && /* @__PURE__ */ jsx268("th", { className: "Layer__table-header", children: ((_e = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _e.accountColumnHeader) || "Account" })
33284
33323
  ] }),
33285
- view !== "mobile" && /* @__PURE__ */ jsxs164(Fragment37, { children: [
33324
+ view !== "mobile" && /* @__PURE__ */ jsxs164(Fragment38, { children: [
33286
33325
  /* @__PURE__ */ jsx268("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_f = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _f.debitColumnHeader) || "Debit" }),
33287
33326
  /* @__PURE__ */ jsx268("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_g = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _g.creditColumnHeader) || "Credit" }),
33288
33327
  /* @__PURE__ */ jsx268("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_h = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _h.runningBalanceColumnHeader) || "Running balance" })
@@ -33344,7 +33383,7 @@ var ChartOfAccounts2 = (props) => {
33344
33383
  const ledgerAccountsContextData = useLedgerAccounts(
33345
33384
  (_a = props.showReversalEntries) != null ? _a : false
33346
33385
  );
33347
- return /* @__PURE__ */ jsx269(ChartOfAccountsContext.Provider, { value: chartOfAccountsContextData, children: /* @__PURE__ */ jsx269(LedgerAccountsContext.Provider, { value: ledgerAccountsContextData, children: /* @__PURE__ */ jsx269(InAppLinkProvider, { convertToInAppLink: props.getInAppLink, children: /* @__PURE__ */ jsx269(ChartOfAccountsContent, __spreadValues({}, props)) }) }) });
33386
+ return /* @__PURE__ */ jsx269(ChartOfAccountsContext.Provider, { value: chartOfAccountsContextData, children: /* @__PURE__ */ jsx269(LedgerAccountsContext.Provider, { value: ledgerAccountsContextData, children: /* @__PURE__ */ jsx269(InAppLinkProvider, { renderInAppLink: props.renderInAppLink, children: /* @__PURE__ */ jsx269(ChartOfAccountsContent, __spreadValues({}, props)) }) }) });
33348
33387
  };
33349
33388
  var ChartOfAccountsContent = ({
33350
33389
  asWidget,
@@ -33354,7 +33393,7 @@ var ChartOfAccountsContent = ({
33354
33393
  templateAccountsEditable,
33355
33394
  showAddAccountButton
33356
33395
  }) => {
33357
- const { selectedAccount } = useContext48(LedgerAccountsContext);
33396
+ const { selectedAccount } = useContext49(LedgerAccountsContext);
33358
33397
  const { view, containerRef } = useElementViewSize();
33359
33398
  return /* @__PURE__ */ jsx269(Container, { name: "chart-of-accounts", ref: containerRef, asWidget, children: selectedAccount ? /* @__PURE__ */ jsx269(
33360
33399
  LedgerAccount,
@@ -33379,8 +33418,8 @@ var ChartOfAccountsContent = ({
33379
33418
  };
33380
33419
 
33381
33420
  // src/contexts/JournalContext/JournalContext.tsx
33382
- import { createContext as createContext23 } from "react";
33383
- var JournalContext = createContext23({
33421
+ import { createContext as createContext24 } from "react";
33422
+ var JournalContext = createContext24({
33384
33423
  refetch: () => {
33385
33424
  },
33386
33425
  setSelectedEntryId: () => {
@@ -33791,13 +33830,13 @@ var useJournal = () => {
33791
33830
  };
33792
33831
 
33793
33832
  // src/components/JournalTable/JournalTableWithPanel.tsx
33794
- import { useContext as useContext54, useMemo as useMemo69, useState as useState70 } from "react";
33833
+ import { useContext as useContext55, useMemo as useMemo69, useState as useState70 } from "react";
33795
33834
 
33796
33835
  // src/components/JournalSidebar/JournalSidebar.tsx
33797
- import { useContext as useContext52 } from "react";
33836
+ import { useContext as useContext53 } from "react";
33798
33837
 
33799
33838
  // src/components/JournalEntryDetails/JournalEntryDetails.tsx
33800
- import { useContext as useContext49, useMemo as useMemo67, useState as useState69 } from "react";
33839
+ import { useContext as useContext50, useMemo as useMemo67, useState as useState69 } from "react";
33801
33840
  import { jsx as jsx270, jsxs as jsxs165 } from "react/jsx-runtime";
33802
33841
  var JournalEntryDetails = () => {
33803
33842
  var _a, _b;
@@ -33809,8 +33848,8 @@ var JournalEntryDetails = () => {
33809
33848
  selectedEntryId,
33810
33849
  reverseEntry,
33811
33850
  refetch
33812
- } = useContext49(JournalContext);
33813
- const { convertToInAppLink } = useInAppLinkContext();
33851
+ } = useContext50(JournalContext);
33852
+ const { renderInAppLink } = useInAppLinkContext();
33814
33853
  const [reverseEntryProcessing, setReverseEntryProcessing] = useState69(false);
33815
33854
  const [reverseEntryError, setReverseEntryError] = useState69();
33816
33855
  const entry = useMemo67(() => {
@@ -33826,12 +33865,12 @@ var JournalEntryDetails = () => {
33826
33865
  var _a2, _b2;
33827
33866
  const badgeContent = (_a2 = ledgerEntrySource == null ? void 0 : ledgerEntrySource.entityName) != null ? _a2 : entry == null ? void 0 : entry.entry_type;
33828
33867
  const defaultBadge = /* @__PURE__ */ jsx270(Badge, { children: badgeContent });
33829
- if (!convertToInAppLink || !ledgerEntrySource) {
33868
+ if (!renderInAppLink || !ledgerEntrySource) {
33830
33869
  return defaultBadge;
33831
33870
  }
33832
33871
  const linkingMetadata = convertLedgerEntrySourceToLinkingMetadata(ledgerEntrySource);
33833
- return (_b2 = convertToInAppLink(linkingMetadata)) != null ? _b2 : defaultBadge;
33834
- }, [convertToInAppLink, entry == null ? void 0 : entry.entry_type, ledgerEntrySource]);
33872
+ return (_b2 = renderInAppLink(linkingMetadata)) != null ? _b2 : defaultBadge;
33873
+ }, [renderInAppLink, entry == null ? void 0 : entry.entry_type, ledgerEntrySource]);
33835
33874
  const sortedLineItems = useMemo67(
33836
33875
  () => {
33837
33876
  var _a2;
@@ -33857,7 +33896,7 @@ var JournalEntryDetails = () => {
33857
33896
  }
33858
33897
  });
33859
33898
  return /* @__PURE__ */ jsxs165("div", { className: "Layer__journal__entry-details", children: [
33860
- /* @__PURE__ */ jsx270(Header5, { className: "Layer__journal__entry-details__mobile-header", children: /* @__PURE__ */ jsxs165(HeaderRow, { children: [
33899
+ /* @__PURE__ */ jsx270(Header4, { className: "Layer__journal__entry-details__mobile-header", children: /* @__PURE__ */ jsxs165(HeaderRow, { children: [
33861
33900
  /* @__PURE__ */ jsxs165(HeaderCol, { className: "Layer__hidden-lg Layer__hidden-xl", children: [
33862
33901
  /* @__PURE__ */ jsx270(BackButton, { onClick: closeSelectedEntry }),
33863
33902
  /* @__PURE__ */ jsx270(Heading, { size: "secondary" /* secondary */, children: "Transaction details" })
@@ -34013,11 +34052,11 @@ var JournalEntryDetails = () => {
34013
34052
  };
34014
34053
 
34015
34054
  // src/components/JournalForm/JournalForm.tsx
34016
- import { useContext as useContext51 } from "react";
34055
+ import { useContext as useContext52 } from "react";
34017
34056
 
34018
34057
  // src/components/JournalForm/JournalFormEntryLines.tsx
34019
- import { useContext as useContext50, useMemo as useMemo68 } from "react";
34020
- import { Fragment as Fragment38, jsx as jsx271, jsxs as jsxs166 } from "react/jsx-runtime";
34058
+ import { useContext as useContext51, useMemo as useMemo68 } from "react";
34059
+ import { Fragment as Fragment39, jsx as jsx271, jsxs as jsxs166 } from "react/jsx-runtime";
34021
34060
  function recursiveFlattenCategories(accounts) {
34022
34061
  const flattenedResult = accounts.flatMap((a) => {
34023
34062
  var _a;
@@ -34037,7 +34076,7 @@ var JournalFormEntryLines = ({
34037
34076
  config
34038
34077
  }) => {
34039
34078
  const { data: categories } = useCategories({ mode: "ALL" });
34040
- const { form } = useContext50(JournalContext);
34079
+ const { form } = useContext51(JournalContext);
34041
34080
  const { flattenedCategories, parentOptions } = useMemo68(() => {
34042
34081
  const flattenedCategories2 = recursiveFlattenCategories(categories != null ? categories : []);
34043
34082
  const parentOptions2 = [...flattenedCategories2].sort((a, b) => a.display_name.localeCompare(b.display_name)).map((account) => {
@@ -34119,7 +34158,7 @@ var JournalFormEntryLines = ({
34119
34158
  ]
34120
34159
  );
34121
34160
  };
34122
- return /* @__PURE__ */ jsx271(Fragment38, { children: ["DEBIT", "CREDIT"].map((direction, idx) => {
34161
+ return /* @__PURE__ */ jsx271(Fragment39, { children: ["DEBIT", "CREDIT"].map((direction, idx) => {
34123
34162
  return /* @__PURE__ */ jsxs166(
34124
34163
  "div",
34125
34164
  {
@@ -34250,7 +34289,7 @@ var JournalForm = ({
34250
34289
  changeFormData,
34251
34290
  addEntryLine,
34252
34291
  removeEntryLine
34253
- } = useContext51(JournalContext);
34292
+ } = useContext52(JournalContext);
34254
34293
  return /* @__PURE__ */ jsxs167(
34255
34294
  "form",
34256
34295
  {
@@ -34260,7 +34299,7 @@ var JournalForm = ({
34260
34299
  submitForm();
34261
34300
  },
34262
34301
  children: [
34263
- /* @__PURE__ */ jsx272(Header5, { className: "Layer__journal__sidebar__header", children: /* @__PURE__ */ jsxs167(HeaderRow, { children: [
34302
+ /* @__PURE__ */ jsx272(Header4, { className: "Layer__journal__sidebar__header", children: /* @__PURE__ */ jsxs167(HeaderRow, { children: [
34264
34303
  /* @__PURE__ */ jsx272(HeaderCol, { children: /* @__PURE__ */ jsx272(Heading, { size: "secondary" /* secondary */, className: "title", children: (_a = stringOverrides == null ? void 0 : stringOverrides.header) != null ? _a : "Add New Entry" }) }),
34265
34304
  /* @__PURE__ */ jsxs167(HeaderCol, { className: "actions", children: [
34266
34305
  /* @__PURE__ */ jsx272(
@@ -34398,7 +34437,7 @@ var JournalSidebar = ({
34398
34437
  config,
34399
34438
  stringOverrides
34400
34439
  }) => {
34401
- const { selectedEntryId } = useContext52(JournalContext);
34440
+ const { selectedEntryId } = useContext53(JournalContext);
34402
34441
  if (selectedEntryId !== "new") {
34403
34442
  return /* @__PURE__ */ jsx273(JournalEntryDetails, {});
34404
34443
  }
@@ -34406,7 +34445,7 @@ var JournalSidebar = ({
34406
34445
  };
34407
34446
 
34408
34447
  // src/components/JournalTable/JournalTable.tsx
34409
- import { Fragment as Fragment39, useContext as useContext53, useLayoutEffect as useLayoutEffect4 } from "react";
34448
+ import { Fragment as Fragment40, useContext as useContext54, useLayoutEffect as useLayoutEffect4 } from "react";
34410
34449
  import { parseISO as parseISO15, format as formatTime12 } from "date-fns";
34411
34450
  import { jsx as jsx274, jsxs as jsxs168 } from "react/jsx-runtime";
34412
34451
  var accountName = (row) => {
@@ -34434,7 +34473,7 @@ var JournalTableContent = ({
34434
34473
  data,
34435
34474
  stringOverrides
34436
34475
  }) => {
34437
- const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext53(JournalContext);
34476
+ const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext54(JournalContext);
34438
34477
  const { isOpen, setIsOpen } = useTableExpandRow();
34439
34478
  useLayoutEffect4(() => {
34440
34479
  if (data.length > 0) {
@@ -34444,7 +34483,7 @@ var JournalTableContent = ({
34444
34483
  const renderJournalRow = (row, index, rowKey, depth) => {
34445
34484
  const expandable = !!row.line_items && row.line_items.length > 0;
34446
34485
  const expanded = !expandable || isOpen(rowKey);
34447
- return /* @__PURE__ */ jsxs168(Fragment39, { children: [
34486
+ return /* @__PURE__ */ jsxs168(Fragment40, { children: [
34448
34487
  /* @__PURE__ */ jsxs168(
34449
34488
  TableRow,
34450
34489
  {
@@ -34580,7 +34619,7 @@ function useJournalEntriesDownload({
34580
34619
  }
34581
34620
 
34582
34621
  // src/components/Journal/download/JournalEntriesDownloadButton.tsx
34583
- import { Fragment as Fragment40, jsx as jsx275, jsxs as jsxs169 } from "react/jsx-runtime";
34622
+ import { Fragment as Fragment41, jsx as jsx275, jsxs as jsxs169 } from "react/jsx-runtime";
34584
34623
  function JournalEntriesDownloadButton({
34585
34624
  startCutoff,
34586
34625
  endCutoff,
@@ -34592,7 +34631,7 @@ function JournalEntriesDownloadButton({
34592
34631
  endCutoff,
34593
34632
  onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
34594
34633
  });
34595
- return /* @__PURE__ */ jsxs169(Fragment40, { children: [
34634
+ return /* @__PURE__ */ jsxs169(Fragment41, { children: [
34596
34635
  /* @__PURE__ */ jsx275(
34597
34636
  DownloadButton,
34598
34637
  {
@@ -34631,7 +34670,7 @@ var JournalTableWithPanel = ({
34631
34670
  addEntry,
34632
34671
  hasMore,
34633
34672
  fetchMore
34634
- } = useContext54(JournalContext);
34673
+ } = useContext55(JournalContext);
34635
34674
  const data = useMemo69(
34636
34675
  () => {
34637
34676
  if (!rawData) return void 0;
@@ -34660,7 +34699,7 @@ var JournalTableWithPanel = ({
34660
34699
  parentRef: containerRef,
34661
34700
  children: [
34662
34701
  /* @__PURE__ */ jsx276(
34663
- Header5,
34702
+ Header4,
34664
34703
  {
34665
34704
  className: `Layer__${COMPONENT_NAME8}__header`,
34666
34705
  asHeader: true,
@@ -34676,7 +34715,7 @@ var JournalTableWithPanel = ({
34676
34715
  ) }) })
34677
34716
  }
34678
34717
  ),
34679
- /* @__PURE__ */ jsx276(Header5, { children: /* @__PURE__ */ jsxs170(HeaderRow, { children: [
34718
+ /* @__PURE__ */ jsx276(Header4, { children: /* @__PURE__ */ jsxs170(HeaderRow, { children: [
34680
34719
  /* @__PURE__ */ jsx276(HeaderCol, { children: /* @__PURE__ */ jsx276(
34681
34720
  Heading,
34682
34721
  {
@@ -34750,7 +34789,7 @@ var JOURNAL_CONFIG = {
34750
34789
  var Journal = (props) => {
34751
34790
  const JournalContextData = useJournal();
34752
34791
  const AccountsContextData = useChartOfAccounts();
34753
- return /* @__PURE__ */ jsx277(ChartOfAccountsContext.Provider, { value: AccountsContextData, children: /* @__PURE__ */ jsx277(JournalContext.Provider, { value: JournalContextData, children: /* @__PURE__ */ jsx277(InAppLinkProvider, { convertToInAppLink: props.convertToInAppLink, children: /* @__PURE__ */ jsx277(JournalContent, __spreadValues({}, props)) }) }) });
34792
+ return /* @__PURE__ */ jsx277(ChartOfAccountsContext.Provider, { value: AccountsContextData, children: /* @__PURE__ */ jsx277(JournalContext.Provider, { value: JournalContextData, children: /* @__PURE__ */ jsx277(InAppLinkProvider, { renderInAppLink: props.renderInAppLink, children: /* @__PURE__ */ jsx277(JournalContent, __spreadValues({}, props)) }) }) });
34754
34793
  };
34755
34794
  var JournalContent = ({
34756
34795
  asWidget,
@@ -35159,7 +35198,7 @@ function useUpdateTaskUploadDescription() {
35159
35198
  }
35160
35199
 
35161
35200
  // src/components/Tasks/TasksListItem.tsx
35162
- import { Fragment as Fragment41, jsx as jsx281, jsxs as jsxs172 } from "react/jsx-runtime";
35201
+ import { Fragment as Fragment42, jsx as jsx281, jsxs as jsxs172 } from "react/jsx-runtime";
35163
35202
  var TasksListItem = ({
35164
35203
  task,
35165
35204
  defaultOpen
@@ -35215,7 +35254,7 @@ var TasksListItem = ({
35215
35254
  }
35216
35255
  );
35217
35256
  } else {
35218
- return /* @__PURE__ */ jsxs172(Fragment41, { children: [
35257
+ return /* @__PURE__ */ jsxs172(Fragment42, { children: [
35219
35258
  /* @__PURE__ */ jsx281(
35220
35259
  Button,
35221
35260
  {
@@ -35440,7 +35479,7 @@ function usePaginatedList(list, pageSize) {
35440
35479
  }
35441
35480
 
35442
35481
  // src/components/Tasks/TasksList.tsx
35443
- import { Fragment as Fragment42, jsx as jsx284, jsxs as jsxs175 } from "react/jsx-runtime";
35482
+ import { Fragment as Fragment43, jsx as jsx284, jsxs as jsxs175 } from "react/jsx-runtime";
35444
35483
  var TasksEmptyState = () => /* @__PURE__ */ jsxs175("div", { className: "Layer__tasks-empty-state", children: [
35445
35484
  /* @__PURE__ */ jsx284("div", { className: "Layer__tasks-icon", children: /* @__PURE__ */ jsx284(SmileIcon_default, {}) }),
35446
35485
  /* @__PURE__ */ jsxs175(Text, { size: "sm" /* sm */, children: [
@@ -35480,7 +35519,7 @@ function TasksList({ pageSize = 8, mobile }) {
35480
35519
  }
35481
35520
  );
35482
35521
  }
35483
- return /* @__PURE__ */ jsx284("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs175(Fragment42, { children: [
35522
+ return /* @__PURE__ */ jsx284("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs175(Fragment43, { children: [
35484
35523
  pageItems.map((task, index) => /* @__PURE__ */ jsx284(
35485
35524
  TasksListItem,
35486
35525
  {
@@ -35517,7 +35556,7 @@ var BookkeepingStatusDescription = ({ monthNumber, status, incompleteTasksCount
35517
35556
  };
35518
35557
 
35519
35558
  // src/components/Tasks/TasksPending.tsx
35520
- import { Fragment as Fragment43, jsx as jsx286, jsxs as jsxs176 } from "react/jsx-runtime";
35559
+ import { Fragment as Fragment44, jsx as jsx286, jsxs as jsxs176 } from "react/jsx-runtime";
35521
35560
  var TasksPending = () => {
35522
35561
  var _a, _b, _c, _d;
35523
35562
  const { date } = useGlobalDate();
@@ -35579,7 +35618,7 @@ var TasksPending = () => {
35579
35618
  ) })
35580
35619
  ] }) : null
35581
35620
  ] }),
35582
- /* @__PURE__ */ jsx286("div", { className: "Layer__tasks-pending-main", children: activePeriod && /* @__PURE__ */ jsxs176(Fragment43, { children: [
35621
+ /* @__PURE__ */ jsx286("div", { className: "Layer__tasks-pending-main", children: activePeriod && /* @__PURE__ */ jsxs176(Fragment44, { children: [
35583
35622
  /* @__PURE__ */ jsx286(BookkeepingStatus2, { status: activePeriod.status, monthNumber: activePeriod.month }),
35584
35623
  /* @__PURE__ */ jsx286(
35585
35624
  BookkeepingStatusDescription,
@@ -36139,7 +36178,7 @@ function TasksEmptyContainer({ children }) {
36139
36178
  }
36140
36179
 
36141
36180
  // src/components/Tasks/Tasks.tsx
36142
- import { Fragment as Fragment44, jsx as jsx296, jsxs as jsxs183 } from "react/jsx-runtime";
36181
+ import { Fragment as Fragment45, jsx as jsx296, jsxs as jsxs183 } from "react/jsx-runtime";
36143
36182
  function Tasks({
36144
36183
  mobile = false,
36145
36184
  tasksHeader,
@@ -36172,7 +36211,7 @@ function Tasks({
36172
36211
  /* @__PURE__ */ jsx296(Heading2, { size: "xs", level: 4, children: "Not Enrolled in Bookkeeping" }),
36173
36212
  /* @__PURE__ */ jsx296(P, { children: "If you believe this is an error, please contact support." })
36174
36213
  ] }) }),
36175
- children: () => /* @__PURE__ */ jsxs183(Fragment44, { children: [
36214
+ children: () => /* @__PURE__ */ jsxs183(Fragment45, { children: [
36176
36215
  /* @__PURE__ */ jsx296(TasksYearsTabs, {}),
36177
36216
  /* @__PURE__ */ jsx296(TasksMonthSelector, {}),
36178
36217
  /* @__PURE__ */ jsx296(TasksPending, {}),
@@ -36186,10 +36225,10 @@ function Tasks({
36186
36225
  }
36187
36226
 
36188
36227
  // src/components/PlatformOnboarding/LinkAccounts.tsx
36189
- import { useContext as useContext57 } from "react";
36228
+ import { useContext as useContext58 } from "react";
36190
36229
 
36191
36230
  // src/components/PlatformOnboarding/Steps/LinkAccountsConfirmationStep.tsx
36192
- import { useContext as useContext55 } from "react";
36231
+ import { useContext as useContext56 } from "react";
36193
36232
  import { useForm as useForm3 } from "@tanstack/react-form";
36194
36233
 
36195
36234
  // src/components/PlatformOnboarding/Container/LinkAccountsListContainer.tsx
@@ -36225,7 +36264,7 @@ function LinkAccountsConfirmationStep() {
36225
36264
  data: linkedAccounts,
36226
36265
  loadingStatus: linkedAccountsLoadingStatus,
36227
36266
  refetchAccounts
36228
- } = useContext55(LinkedAccountsContext);
36267
+ } = useContext56(LinkedAccountsContext);
36229
36268
  const effectiveLinkedAccounts = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
36230
36269
  const { trigger } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
36231
36270
  const { previous, next } = useWizard();
@@ -36298,9 +36337,9 @@ function LinkAccountsConfirmationStep() {
36298
36337
  }
36299
36338
 
36300
36339
  // src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
36301
- import { useContext as useContext56 } from "react";
36340
+ import { useContext as useContext57 } from "react";
36302
36341
  import pluralize5 from "pluralize";
36303
- import { Fragment as Fragment45, jsx as jsx299, jsxs as jsxs185 } from "react/jsx-runtime";
36342
+ import { Fragment as Fragment46, jsx as jsx299, jsxs as jsxs185 } from "react/jsx-runtime";
36304
36343
  function LinkAccountsLinkStep() {
36305
36344
  const {
36306
36345
  data,
@@ -36308,10 +36347,10 @@ function LinkAccountsLinkStep() {
36308
36347
  error,
36309
36348
  refetchAccounts,
36310
36349
  addConnection
36311
- } = useContext56(LinkedAccountsContext);
36350
+ } = useContext57(LinkedAccountsContext);
36312
36351
  const { next } = useWizard();
36313
36352
  const effectiveAccounts = data != null ? data : [];
36314
- return /* @__PURE__ */ jsxs185(Fragment45, { children: [
36353
+ return /* @__PURE__ */ jsxs185(Fragment46, { children: [
36315
36354
  /* @__PURE__ */ jsx299(
36316
36355
  ConditionalList,
36317
36356
  {
@@ -36371,7 +36410,7 @@ function LinkAccountsLinkStep() {
36371
36410
  children: ({ item: account }) => /* @__PURE__ */ jsx299(BasicLinkedAccountContainer, { isSelected: true, children: /* @__PURE__ */ jsx299(BasicLinkedAccountContent, { account }) }, account.id)
36372
36411
  }
36373
36412
  ),
36374
- effectiveAccounts.length > 0 ? /* @__PURE__ */ jsxs185(Fragment45, { children: [
36413
+ effectiveAccounts.length > 0 ? /* @__PURE__ */ jsxs185(Fragment46, { children: [
36375
36414
  /* @__PURE__ */ jsx299(Separator, { mbs: "lg", mbe: "lg" }),
36376
36415
  /* @__PURE__ */ jsx299(HStack, { justify: "start", gap: "sm", children: /* @__PURE__ */ jsx299(Button, { onClick: () => {
36377
36416
  void next();
@@ -36388,7 +36427,7 @@ function LinkAccounts(props) {
36388
36427
  function LinkAccountsContent({
36389
36428
  onComplete
36390
36429
  }) {
36391
- const { data: linkedAccounts, loadingStatus } = useContext57(LinkedAccountsContext);
36430
+ const { data: linkedAccounts, loadingStatus } = useContext58(LinkedAccountsContext);
36392
36431
  const linkedAccountsNeedingConfirmation = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
36393
36432
  const hideConfirmationStep = loadingStatus === "complete" && linkedAccountsNeedingConfirmation.length === 0;
36394
36433
  return /* @__PURE__ */ jsx300("section", { className: "Layer__link-accounts Layer__component", children: /* @__PURE__ */ jsxs186(
@@ -36595,7 +36634,7 @@ var TrendingUp = (_a) => {
36595
36634
  var TrendingUp_default = TrendingUp;
36596
36635
 
36597
36636
  // src/components/PlatformOnboarding/Steps/WelcomeStep.tsx
36598
- import { Fragment as Fragment46, jsx as jsx304, jsxs as jsxs190 } from "react/jsx-runtime";
36637
+ import { Fragment as Fragment47, jsx as jsx304, jsxs as jsxs190 } from "react/jsx-runtime";
36599
36638
  var defaultTitle = "Welcome";
36600
36639
  var defaultDescription = "Welcome to the platform onboarding process";
36601
36640
  var WelcomeStep = ({ onNext, title = defaultTitle, description, stepsEnabled }) => {
@@ -36616,7 +36655,7 @@ var WelcomeStep = ({ onNext, title = defaultTitle, description, stepsEnabled })
36616
36655
  }
36617
36656
  return defaultDescription;
36618
36657
  };
36619
- return /* @__PURE__ */ jsxs190(Fragment46, { children: [
36658
+ return /* @__PURE__ */ jsxs190(Fragment47, { children: [
36620
36659
  /* @__PURE__ */ jsxs190("div", { className: "Layer__platform-onboarding__welcome", children: [
36621
36660
  /* @__PURE__ */ jsx304(Heading, { className: "Layer__platform-onboarding__heading", align: "left", children: title }),
36622
36661
  /* @__PURE__ */ jsx304(Text, { status: "disabled", children: buildDescription() })
@@ -36693,12 +36732,12 @@ var WelcomeStepFooter = () => {
36693
36732
  };
36694
36733
 
36695
36734
  // src/components/PlatformOnboarding/Steps/SummaryStep.tsx
36696
- import { Fragment as Fragment47, jsx as jsx305, jsxs as jsxs191 } from "react/jsx-runtime";
36735
+ import { Fragment as Fragment48, jsx as jsx305, jsxs as jsxs191 } from "react/jsx-runtime";
36697
36736
  var defaultTitle2 = "You\u2019re all set!";
36698
36737
  var defaultDescription2 = "We\u2019re syncing your accounts. This process may take a while to complete.";
36699
36738
  var defaultNextBtnText = "Go to dashboard";
36700
36739
  var SummaryStep = ({ onNext, title = defaultTitle2, description = defaultDescription2, nextBtnText = defaultNextBtnText }) => {
36701
- return /* @__PURE__ */ jsxs191(Fragment47, { children: [
36740
+ return /* @__PURE__ */ jsxs191(Fragment48, { children: [
36702
36741
  /* @__PURE__ */ jsxs191("div", { className: "Layer__platform-onboarding__summary", children: [
36703
36742
  /* @__PURE__ */ jsx305(Heading, { className: "Layer__platform-onboarding__heading", align: "left", children: title }),
36704
36743
  /* @__PURE__ */ jsx305(Text, { status: "disabled", children: description })
@@ -37213,7 +37252,7 @@ var PhoneInput = (_a) => {
37213
37252
 
37214
37253
  // src/components/BusinessForm/BusinessForm.tsx
37215
37254
  import { isPossiblePhoneNumber } from "libphonenumber-js";
37216
- import { Fragment as Fragment48, jsx as jsx310, jsxs as jsxs193 } from "react/jsx-runtime";
37255
+ import { Fragment as Fragment49, jsx as jsx310, jsxs as jsxs193 } from "react/jsx-runtime";
37217
37256
  var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
37218
37257
  var _a;
37219
37258
  const { form, submitError, isFormValid } = useBusinessForm({ onSuccess });
@@ -37237,7 +37276,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
37237
37276
  validators: {
37238
37277
  onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Full name is required"
37239
37278
  },
37240
- children: (field) => /* @__PURE__ */ jsx310(Fragment48, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "full_name", label: "Full name", children: /* @__PURE__ */ jsx310(
37279
+ children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "full_name", label: "Full name", children: /* @__PURE__ */ jsx310(
37241
37280
  Input,
37242
37281
  {
37243
37282
  name: "full_name",
@@ -37250,7 +37289,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
37250
37289
  ) }) })
37251
37290
  }
37252
37291
  ),
37253
- /* @__PURE__ */ jsx310(form.Field, { name: "preferred_name", children: (field) => /* @__PURE__ */ jsx310(Fragment48, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "preferred_name", label: "Preferred name", children: /* @__PURE__ */ jsx310(
37292
+ /* @__PURE__ */ jsx310(form.Field, { name: "preferred_name", children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "preferred_name", label: "Preferred name", children: /* @__PURE__ */ jsx310(
37254
37293
  Input,
37255
37294
  {
37256
37295
  name: "preferred_name",
@@ -37267,7 +37306,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
37267
37306
  validators: {
37268
37307
  onSubmit: ({ value }) => validateEmailFormat(value, true) ? void 0 : "Email is invalid"
37269
37308
  },
37270
- children: (field) => /* @__PURE__ */ jsx310(Fragment48, { children: /* @__PURE__ */ jsx310(
37309
+ children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(
37271
37310
  InputGroup,
37272
37311
  {
37273
37312
  name: "email",
@@ -37294,7 +37333,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
37294
37333
  validators: {
37295
37334
  onSubmit: ({ value }) => isPossiblePhoneNumber(value != null ? value : "", "US") ? void 0 : "Phone number is invalid"
37296
37335
  },
37297
- children: (field) => /* @__PURE__ */ jsx310(Fragment48, { children: /* @__PURE__ */ jsx310(
37336
+ children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(
37298
37337
  InputGroup,
37299
37338
  {
37300
37339
  name: "phone_number",
@@ -37321,7 +37360,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
37321
37360
  validators: {
37322
37361
  onBlur: ({ value }) => notEmpty(value) ? void 0 : "Company name is required"
37323
37362
  },
37324
- children: (field) => /* @__PURE__ */ jsx310(Fragment48, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "legal_name", label: "Company", children: /* @__PURE__ */ jsx310(
37363
+ children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "legal_name", label: "Company", children: /* @__PURE__ */ jsx310(
37325
37364
  Input,
37326
37365
  {
37327
37366
  name: "legal_name",
@@ -37334,7 +37373,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
37334
37373
  ) }) })
37335
37374
  }
37336
37375
  ),
37337
- /* @__PURE__ */ jsx310(form.Field, { name: "dba", children: (field) => /* @__PURE__ */ jsx310(Fragment48, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "dba", label: "DBA (optional)", children: /* @__PURE__ */ jsx310(
37376
+ /* @__PURE__ */ jsx310(form.Field, { name: "dba", children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "dba", label: "DBA (optional)", children: /* @__PURE__ */ jsx310(
37338
37377
  Input,
37339
37378
  {
37340
37379
  name: "dba",
@@ -37345,7 +37384,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
37345
37384
  errorMessage: field.state.meta.errors.join(", ")
37346
37385
  }
37347
37386
  ) }) }) }),
37348
- /* @__PURE__ */ jsx310(form.Field, { name: "entity_type", children: (field) => /* @__PURE__ */ jsx310(Fragment48, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "entity_type", label: "Entity type", children: /* @__PURE__ */ jsx310(
37387
+ /* @__PURE__ */ jsx310(form.Field, { name: "entity_type", children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "entity_type", label: "Entity type", children: /* @__PURE__ */ jsx310(
37349
37388
  BusinessTypeSelect,
37350
37389
  {
37351
37390
  value: field.state.value,
@@ -37353,14 +37392,14 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
37353
37392
  }
37354
37393
  ) }) }) }),
37355
37394
  /* @__PURE__ */ jsxs193("div", { className: "Layer__business-form__state-tin-fields", children: [
37356
- /* @__PURE__ */ jsx310(form.Field, { name: "us_state", children: (field) => /* @__PURE__ */ jsx310(Fragment48, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "us_state", label: "State", className: "Layer__business-form__state", children: /* @__PURE__ */ jsx310(
37395
+ /* @__PURE__ */ jsx310(form.Field, { name: "us_state", children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "us_state", label: "State", className: "Layer__business-form__state", children: /* @__PURE__ */ jsx310(
37357
37396
  USStateSelect,
37358
37397
  {
37359
37398
  value: field.state.value,
37360
37399
  onChange: (option) => field.handleChange(option.value)
37361
37400
  }
37362
37401
  ) }) }) }),
37363
- /* @__PURE__ */ jsx310(form.Field, { name: "tin", children: (field) => /* @__PURE__ */ jsx310(Fragment48, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "tin", label: "Tax ID number (optional)", children: /* @__PURE__ */ jsx310(
37402
+ /* @__PURE__ */ jsx310(form.Field, { name: "tin", children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "tin", label: "Tax ID number (optional)", children: /* @__PURE__ */ jsx310(
37364
37403
  Input,
37365
37404
  {
37366
37405
  name: "tin",
@@ -37391,10 +37430,10 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
37391
37430
  };
37392
37431
 
37393
37432
  // src/components/PlatformOnboarding/Steps/BusinessInfoStep.tsx
37394
- import { Fragment as Fragment49, jsx as jsx311, jsxs as jsxs194 } from "react/jsx-runtime";
37433
+ import { Fragment as Fragment50, jsx as jsx311, jsxs as jsxs194 } from "react/jsx-runtime";
37395
37434
  var defaultTitle3 = "We\u2019ll use this information to contact you whenever we have questions on your books.";
37396
37435
  var BusinessInfoStep = ({ title = defaultTitle3, onNext }) => {
37397
- return /* @__PURE__ */ jsxs194(Fragment49, { children: [
37436
+ return /* @__PURE__ */ jsxs194(Fragment50, { children: [
37398
37437
  /* @__PURE__ */ jsx311(Heading2, { children: title }),
37399
37438
  /* @__PURE__ */ jsx311(BusinessForm2, { onSuccess: onNext })
37400
37439
  ] });
@@ -37821,7 +37860,7 @@ var AccountingOverview = ({
37821
37860
  {
37822
37861
  title,
37823
37862
  showHeader: showTitle,
37824
- header: /* @__PURE__ */ jsx317(Header5, { children: /* @__PURE__ */ jsx317(HeaderRow, { children: /* @__PURE__ */ jsx317(HeaderCol, { children: /* @__PURE__ */ jsx317(ProfitAndLoss2.DatePicker, {}) }) }) }),
37863
+ header: /* @__PURE__ */ jsx317(Header4, { children: /* @__PURE__ */ jsx317(HeaderRow, { children: /* @__PURE__ */ jsx317(HeaderCol, { children: /* @__PURE__ */ jsx317(ProfitAndLoss2.DatePicker, {}) }) }) }),
37825
37864
  children: [
37826
37865
  enableOnboarding && /* @__PURE__ */ jsx317(
37827
37866
  Onboarding,
@@ -37943,7 +37982,7 @@ var BankTransactionsWithLinkedAccounts = ({
37943
37982
  showUploadOptions = false,
37944
37983
  mobileComponent,
37945
37984
  stringOverrides,
37946
- convertToInAppLink
37985
+ renderInAppLink
37947
37986
  }) => {
37948
37987
  return /* @__PURE__ */ jsxs200(
37949
37988
  View,
@@ -37974,7 +38013,7 @@ var BankTransactionsWithLinkedAccounts = ({
37974
38013
  mobileComponent,
37975
38014
  mode,
37976
38015
  stringOverrides: stringOverrides == null ? void 0 : stringOverrides.bankTransactions,
37977
- convertToInAppLink
38016
+ renderInAppLink
37978
38017
  }
37979
38018
  )
37980
38019
  ]
@@ -37991,7 +38030,7 @@ var GeneralLedgerView = ({
37991
38030
  showTitle = true,
37992
38031
  stringOverrides,
37993
38032
  chartOfAccountsOptions,
37994
- convertToInAppLink
38033
+ renderInAppLink
37995
38034
  }) => {
37996
38035
  const [activeTab, setActiveTab] = useState79("chartOfAccounts");
37997
38036
  return /* @__PURE__ */ jsx319(ProfitAndLoss2, { asContainer: false, children: /* @__PURE__ */ jsxs201(
@@ -38027,13 +38066,13 @@ var GeneralLedgerView = ({
38027
38066
  stringOverrides: stringOverrides == null ? void 0 : stringOverrides.chartOfAccounts,
38028
38067
  templateAccountsEditable: chartOfAccountsOptions == null ? void 0 : chartOfAccountsOptions.templateAccountsEditable,
38029
38068
  showReversalEntries: chartOfAccountsOptions == null ? void 0 : chartOfAccountsOptions.showReversalEntries,
38030
- getInAppLink: convertToInAppLink
38069
+ renderInAppLink
38031
38070
  }
38032
38071
  ) : /* @__PURE__ */ jsx319(
38033
38072
  Journal,
38034
38073
  {
38035
38074
  stringOverrides: stringOverrides == null ? void 0 : stringOverrides.journal,
38036
- convertToInAppLink
38075
+ renderInAppLink
38037
38076
  }
38038
38077
  )
38039
38078
  ]
@@ -38044,7 +38083,7 @@ var GeneralLedgerView = ({
38044
38083
  // src/views/ProjectProfitability/ProjectProfitability.tsx
38045
38084
  import { useState as useState80 } from "react";
38046
38085
  import Select5 from "react-select";
38047
- import { Fragment as Fragment50, jsx as jsx320, jsxs as jsxs202 } from "react/jsx-runtime";
38086
+ import { Fragment as Fragment51, jsx as jsx320, jsxs as jsxs202 } from "react/jsx-runtime";
38048
38087
  var ProjectProfitabilityView = ({
38049
38088
  valueOptions,
38050
38089
  showTitle,
@@ -38117,7 +38156,7 @@ var ProjectProfitabilityView = ({
38117
38156
  }
38118
38157
  )
38119
38158
  ] }),
38120
- /* @__PURE__ */ jsx320(Container, { name: "project", children: /* @__PURE__ */ jsxs202(Fragment50, { children: [
38159
+ /* @__PURE__ */ jsx320(Container, { name: "project", children: /* @__PURE__ */ jsxs202(Fragment51, { children: [
38121
38160
  activeTab === "overview" && /* @__PURE__ */ jsx320(
38122
38161
  AccountingOverview,
38123
38162
  {
@@ -38153,7 +38192,7 @@ var ProjectProfitabilityView = ({
38153
38192
  };
38154
38193
 
38155
38194
  // src/contexts/BillsContext.tsx
38156
- import { createContext as createContext24, useContext as useContext58 } from "react";
38195
+ import { createContext as createContext25, useContext as useContext59 } from "react";
38157
38196
 
38158
38197
  // src/hooks/useBills.tsx
38159
38198
  import { useMemo as useMemo76, useState as useState81 } from "react";
@@ -38545,7 +38584,7 @@ var useBillsRecordPayment = ({ refetchAllBills }) => {
38545
38584
  // src/contexts/BillsContext.tsx
38546
38585
  import { endOfMonth as endOfMonth13, startOfMonth as startOfMonth16 } from "date-fns";
38547
38586
  import { jsx as jsx321 } from "react/jsx-runtime";
38548
- var BillsContext = createContext24({
38587
+ var BillsContext = createContext25({
38549
38588
  data: [],
38550
38589
  paginatedData: [],
38551
38590
  currentPage: 1,
@@ -38576,7 +38615,7 @@ var BillsContext = createContext24({
38576
38615
  refetch: () => {
38577
38616
  }
38578
38617
  });
38579
- var BillsRecordPaymentContext = createContext24({
38618
+ var BillsRecordPaymentContext = createContext25({
38580
38619
  billsToPay: [],
38581
38620
  setBill: () => {
38582
38621
  },
@@ -38620,8 +38659,8 @@ var BillsRecordPaymentContext = createContext24({
38620
38659
  isLoading: false,
38621
38660
  apiError: void 0
38622
38661
  });
38623
- var useBillsContext = () => useContext58(BillsContext);
38624
- var useBillsRecordPaymentContext = () => useContext58(BillsRecordPaymentContext);
38662
+ var useBillsContext = () => useContext59(BillsContext);
38663
+ var useBillsRecordPaymentContext = () => useContext59(BillsRecordPaymentContext);
38625
38664
  var BillsProvider = ({ children }) => {
38626
38665
  const bills = useBills();
38627
38666
  return /* @__PURE__ */ jsx321(BillsContext.Provider, { value: bills, children: /* @__PURE__ */ jsx321(BillContextWithRecordPayment, { children }) });
@@ -38883,7 +38922,7 @@ var useUnpaidBillsByVendor = ({ vendorId }) => {
38883
38922
  };
38884
38923
 
38885
38924
  // src/components/Bills/BillsRecordPayment.tsx
38886
- import { Fragment as Fragment51, jsx as jsx324, jsxs as jsxs204 } from "react/jsx-runtime";
38925
+ import { Fragment as Fragment52, jsx as jsx324, jsxs as jsxs204 } from "react/jsx-runtime";
38887
38926
  var buildLabel = (bill, amount) => {
38888
38927
  var _a, _b;
38889
38928
  const amountNumber = amount !== void 0 ? Number(amount) : 0;
@@ -39082,7 +39121,7 @@ var BillsRecordPayment = ({
39082
39121
  /* @__PURE__ */ jsx324(Text, { size: "md" /* md */, children: "Total" }),
39083
39122
  /* @__PURE__ */ jsx324(Text, { size: "md" /* md */, children: convertNumberToCurrency(totalAmount) })
39084
39123
  ] }),
39085
- /* @__PURE__ */ jsx324("div", { className: "Layer__bills__record-payment__submit-container", children: apiError ? /* @__PURE__ */ jsxs204(Fragment51, { children: [
39124
+ /* @__PURE__ */ jsx324("div", { className: "Layer__bills__record-payment__submit-container", children: apiError ? /* @__PURE__ */ jsxs204(Fragment52, { children: [
39086
39125
  /* @__PURE__ */ jsx324(
39087
39126
  RetryButton,
39088
39127
  {
@@ -39115,7 +39154,7 @@ var BillsSidebar = () => {
39115
39154
  };
39116
39155
 
39117
39156
  // src/contexts/VendorsContext.tsx
39118
- import { createContext as createContext25, useContext as useContext59 } from "react";
39157
+ import { createContext as createContext26, useContext as useContext60 } from "react";
39119
39158
 
39120
39159
  // src/hooks/useVendors.ts
39121
39160
  import useSWR21 from "swr";
@@ -39140,10 +39179,10 @@ var useVendors = () => {
39140
39179
 
39141
39180
  // src/contexts/VendorsContext.tsx
39142
39181
  import { jsx as jsx326 } from "react/jsx-runtime";
39143
- var VendorsContext = createContext25({
39182
+ var VendorsContext = createContext26({
39144
39183
  data: []
39145
39184
  });
39146
- var useVendorsContext = () => useContext59(VendorsContext);
39185
+ var useVendorsContext = () => useContext60(VendorsContext);
39147
39186
  var VendorsProvider = ({ children }) => {
39148
39187
  const vendors = useVendors();
39149
39188
  return /* @__PURE__ */ jsx326(VendorsContext.Provider, { value: vendors, children });
@@ -39257,8 +39296,8 @@ function buildDifference(due_at) {
39257
39296
  if (isNaN(d)) {
39258
39297
  return { text: "" };
39259
39298
  }
39260
- const today = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
39261
- const daysDiff = differenceInDays2(today, d);
39299
+ const today3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
39300
+ const daysDiff = differenceInDays2(today3, d);
39262
39301
  if (daysDiff === 0) {
39263
39302
  return {
39264
39303
  text: "Due today",
@@ -39351,7 +39390,7 @@ var BillSummary = ({ bill }) => {
39351
39390
  };
39352
39391
 
39353
39392
  // src/components/Bills/BillsDetails.tsx
39354
- import { Fragment as Fragment52, jsx as jsx331, jsxs as jsxs207 } from "react/jsx-runtime";
39393
+ import { Fragment as Fragment53, jsx as jsx331, jsxs as jsxs207 } from "react/jsx-runtime";
39355
39394
  var flattenCategories3 = (categories) => {
39356
39395
  return categories.reduce((acc, category) => {
39357
39396
  var _a;
@@ -39394,7 +39433,7 @@ var BillsDetails = ({
39394
39433
  className: "Layer__bills-account__index",
39395
39434
  floating: true,
39396
39435
  children: [
39397
- /* @__PURE__ */ jsx331(Header5, { className: "Layer__bills-account__header", children: /* @__PURE__ */ jsx331(HeaderRow, { children: /* @__PURE__ */ jsxs207(HeaderCol, { children: [
39436
+ /* @__PURE__ */ jsx331(Header4, { className: "Layer__bills-account__header", children: /* @__PURE__ */ jsx331(HeaderRow, { children: /* @__PURE__ */ jsxs207(HeaderCol, { children: [
39398
39437
  /* @__PURE__ */ jsx331(BackButton, { onClick: () => closeBillDetails() }),
39399
39438
  /* @__PURE__ */ jsxs207("div", { className: "Layer__bills-account__title-container", children: [
39400
39439
  /* @__PURE__ */ jsx331(
@@ -39474,7 +39513,7 @@ var BillsDetails = ({
39474
39513
  validators: { onSubmit: ({ value }) => value ? void 0 : "Vendor is required" },
39475
39514
  children: (field) => {
39476
39515
  var _a, _b, _c;
39477
- return /* @__PURE__ */ jsxs207(Fragment52, { children: [
39516
+ return /* @__PURE__ */ jsxs207(Fragment53, { children: [
39478
39517
  /* @__PURE__ */ jsx331(InputGroup, { inline: true, label: "Vendor", children: /* @__PURE__ */ jsx331(
39479
39518
  SelectVendor,
39480
39519
  {
@@ -39672,7 +39711,7 @@ var BillsDetails = ({
39672
39711
  import { useMemo as useMemo82 } from "react";
39673
39712
 
39674
39713
  // src/components/Bills/BillsTable.tsx
39675
- import { Fragment as Fragment53 } from "react";
39714
+ import { Fragment as Fragment54 } from "react";
39676
39715
 
39677
39716
  // src/components/DueStatus/DueStatus.tsx
39678
39717
  import { useMemo as useMemo81 } from "react";
@@ -39736,8 +39775,8 @@ var getDiff = (refDate) => {
39736
39775
  if (isNaN(d)) {
39737
39776
  return null;
39738
39777
  }
39739
- const today = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
39740
- return differenceInDays3(today, d);
39778
+ const today3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
39779
+ return differenceInDays3(today3, d);
39741
39780
  };
39742
39781
  var DueStatus = ({ dueDate, paidAt, size = "md" }) => {
39743
39782
  const date = useMemo81(() => {
@@ -39836,7 +39875,7 @@ var BillsTableContent = ({
39836
39875
  "Layer__bills-table__actions-col",
39837
39876
  status === "PAID" ? "Layer__bills-table__actions-col--narrow" : ""
39838
39877
  );
39839
- return /* @__PURE__ */ jsx334(Fragment53, { children: /* @__PURE__ */ jsxs209(TableRow, { rowKey: rowKey + "-" + index, variant: "main", children: [
39878
+ return /* @__PURE__ */ jsx334(Fragment54, { children: /* @__PURE__ */ jsxs209(TableRow, { rowKey: rowKey + "-" + index, variant: "main", children: [
39840
39879
  /* @__PURE__ */ jsxs209(TableCell, { primary: true, nowrap: true, className: "Layer__bills-table__vendor-col", children: [
39841
39880
  bulkSelectionActive && status === "UNPAID" && /* @__PURE__ */ jsx334(
39842
39881
  CheckboxWithTooltip,
@@ -39903,7 +39942,7 @@ var BillsTableContent = ({
39903
39942
 
39904
39943
  // src/components/Bills/BillsList.tsx
39905
39944
  import classNames91 from "classnames";
39906
- import { Fragment as Fragment54, jsx as jsx335, jsxs as jsxs210 } from "react/jsx-runtime";
39945
+ import { Fragment as Fragment55, jsx as jsx335, jsxs as jsxs210 } from "react/jsx-runtime";
39907
39946
  var BillsList = ({
39908
39947
  stringOverrides
39909
39948
  }) => {
@@ -40025,8 +40064,8 @@ var BillsListItem = ({
40025
40064
  ] })
40026
40065
  ] }));
40027
40066
  };
40028
- var BillAmount = ({ bill }) => /* @__PURE__ */ jsxs210(Fragment54, { children: [
40029
- bill.outstanding_balance !== 0 ? /* @__PURE__ */ jsxs210(Fragment54, { children: [
40067
+ var BillAmount = ({ bill }) => /* @__PURE__ */ jsxs210(Fragment55, { children: [
40068
+ bill.outstanding_balance !== 0 ? /* @__PURE__ */ jsxs210(Fragment55, { children: [
40030
40069
  /* @__PURE__ */ jsx335(Text, { as: "span", status: "disabled", children: convertCentsToCurrency(bill.outstanding_balance) }),
40031
40070
  /* @__PURE__ */ jsx335("span", { className: "Layer__bills-list-item__separator" })
40032
40071
  ] }) : null,
@@ -40034,7 +40073,7 @@ var BillAmount = ({ bill }) => /* @__PURE__ */ jsxs210(Fragment54, { children: [
40034
40073
  ] });
40035
40074
 
40036
40075
  // src/components/Bills/BillsTableWithPanel.tsx
40037
- import { Fragment as Fragment55, jsx as jsx336, jsxs as jsxs211 } from "react/jsx-runtime";
40076
+ import { Fragment as Fragment56, jsx as jsx336, jsxs as jsxs211 } from "react/jsx-runtime";
40038
40077
  var COMPONENT_NAME9 = "bills";
40039
40078
  var BillsTableWithPanel = ({
40040
40079
  containerRef,
@@ -40083,7 +40122,7 @@ var BillsTableWithPanel = ({
40083
40122
  parentRef: containerRef,
40084
40123
  children: [
40085
40124
  /* @__PURE__ */ jsxs211(
40086
- Header5,
40125
+ Header4,
40087
40126
  {
40088
40127
  className: `Layer__${COMPONENT_NAME9}__header`,
40089
40128
  asHeader: true,
@@ -40115,7 +40154,7 @@ var BillsTableWithPanel = ({
40115
40154
  }
40116
40155
  ) }) }),
40117
40156
  status === "UNPAID" && /* @__PURE__ */ jsxs211(HeaderRow, { direction: isMobile ? "col" : "row", children: [
40118
- /* @__PURE__ */ jsx336(HeaderCol, { noPadding: true, children: bulkSelectionActive ? /* @__PURE__ */ jsxs211(Fragment55, { children: [
40157
+ /* @__PURE__ */ jsx336(HeaderCol, { noPadding: true, children: bulkSelectionActive ? /* @__PURE__ */ jsxs211(Fragment56, { children: [
40119
40158
  /* @__PURE__ */ jsx336(
40120
40159
  SelectVendor,
40121
40160
  {
@@ -40267,7 +40306,7 @@ var BillsViewContent = ({
40267
40306
 
40268
40307
  // src/views/Reports/Reports.tsx
40269
40308
  import { useState as useState84 } from "react";
40270
- import { Fragment as Fragment56, jsx as jsx340, jsxs as jsxs212 } from "react/jsx-runtime";
40309
+ import { Fragment as Fragment57, jsx as jsx340, jsxs as jsxs212 } from "react/jsx-runtime";
40271
40310
  var getOptions = (enabledReports) => {
40272
40311
  return [
40273
40312
  enabledReports.includes("profitAndLoss") ? {
@@ -40291,7 +40330,8 @@ var Reports = ({
40291
40330
  enabledReports = ["profitAndLoss", "balanceSheet", "statementOfCashFlow"],
40292
40331
  comparisonConfig,
40293
40332
  profitAndLossConfig,
40294
- statementOfCashFlowConfig
40333
+ statementOfCashFlowConfig,
40334
+ renderInAppLink
40295
40335
  }) => {
40296
40336
  var _a;
40297
40337
  const [activeTab, setActiveTab] = useState84(enabledReports[0]);
@@ -40327,7 +40367,8 @@ var Reports = ({
40327
40367
  stringOverrides,
40328
40368
  profitAndLossConfig,
40329
40369
  statementOfCashFlowConfig,
40330
- view
40370
+ view,
40371
+ renderInAppLink
40331
40372
  }
40332
40373
  ) }) }) })
40333
40374
  ]
@@ -40339,14 +40380,16 @@ var ReportsPanel = ({
40339
40380
  stringOverrides,
40340
40381
  profitAndLossConfig,
40341
40382
  statementOfCashFlowConfig,
40342
- view
40383
+ view,
40384
+ renderInAppLink
40343
40385
  }) => {
40344
- return /* @__PURE__ */ jsxs212(Fragment56, { children: [
40386
+ return /* @__PURE__ */ jsxs212(Fragment57, { children: [
40345
40387
  openReport === "profitAndLoss" && /* @__PURE__ */ jsx340(
40346
40388
  ProfitAndLossReport,
40347
40389
  __spreadValues({
40348
40390
  stringOverrides,
40349
- view
40391
+ view,
40392
+ renderInAppLink
40350
40393
  }, profitAndLossConfig)
40351
40394
  ),
40352
40395
  openReport === "balanceSheet" && /* @__PURE__ */ jsx340(BalanceSheet, { stringOverrides: stringOverrides == null ? void 0 : stringOverrides.balanceSheet }),
@@ -40360,8 +40403,8 @@ var ReportsPanel = ({
40360
40403
  };
40361
40404
 
40362
40405
  // src/components/ProfitAndLossView/ProfitAndLossView.tsx
40363
- import { useContext as useContext60, useRef as useRef29 } from "react";
40364
- import { Fragment as Fragment57, jsx as jsx341, jsxs as jsxs213 } from "react/jsx-runtime";
40406
+ import { useContext as useContext61, useRef as useRef29 } from "react";
40407
+ import { Fragment as Fragment58, jsx as jsx341, jsxs as jsxs213 } from "react/jsx-runtime";
40365
40408
  var COMPONENT_NAME10 = "profit-and-loss";
40366
40409
  var ProfitAndLossView = (props) => {
40367
40410
  const containerRef = useRef29(null);
@@ -40375,7 +40418,7 @@ var ProfitAndLossPanel = (_a) => {
40375
40418
  "containerRef",
40376
40419
  "stringOverrides"
40377
40420
  ]);
40378
- const { sidebarScope } = useContext60(ProfitAndLoss2.Context);
40421
+ const { sidebarScope } = useContext61(ProfitAndLoss2.Context);
40379
40422
  return /* @__PURE__ */ jsxs213(
40380
40423
  Panel,
40381
40424
  {
@@ -40406,7 +40449,7 @@ var Components = ({
40406
40449
  hideTable = false,
40407
40450
  stringOverrides
40408
40451
  }) => {
40409
- const { isError, isLoading, isValidating, refetch } = useContext60(
40452
+ const { isError, isLoading, isValidating, refetch } = useContext61(
40410
40453
  ProfitAndLoss2.Context
40411
40454
  );
40412
40455
  if (!isLoading && isError) {
@@ -40421,7 +40464,7 @@ var Components = ({
40421
40464
  }
40422
40465
  ) });
40423
40466
  }
40424
- return /* @__PURE__ */ jsxs213(Fragment57, { children: [
40467
+ return /* @__PURE__ */ jsxs213(Fragment58, { children: [
40425
40468
  !hideChart && /* @__PURE__ */ jsxs213("div", { className: `Layer__${COMPONENT_NAME10}__chart_with_summaries`, children: [
40426
40469
  /* @__PURE__ */ jsxs213(
40427
40470
  "div",
@@ -40457,7 +40500,7 @@ var Components = ({
40457
40500
  };
40458
40501
 
40459
40502
  // src/providers/InvoiceStore/InvoiceStoreProvider.tsx
40460
- import { useState as useState86, createContext as createContext26, useContext as useContext61, useMemo as useMemo86 } from "react";
40503
+ import { useState as useState86, createContext as createContext27, useContext as useContext62, useMemo as useMemo86 } from "react";
40461
40504
  import { createStore as createStore4, useStore as useStore7 } from "zustand";
40462
40505
 
40463
40506
  // src/components/Invoices/InvoiceTable/InvoiceTable.tsx
@@ -40601,6 +40644,7 @@ var InvoiceStatus = /* @__PURE__ */ ((InvoiceStatus3) => {
40601
40644
  InvoiceStatus3["PartiallyWrittenOff"] = "PARTIALLY_WRITTEN_OFF";
40602
40645
  InvoiceStatus3["PartiallyPaid"] = "PARTIALLY_PAID";
40603
40646
  InvoiceStatus3["Sent"] = "SENT";
40647
+ InvoiceStatus3["Refunded"] = "REFUNDED";
40604
40648
  return InvoiceStatus3;
40605
40649
  })(InvoiceStatus || {});
40606
40650
  var InvoiceStatusSchema = Schema19.Enums(InvoiceStatus);
@@ -40727,8 +40771,7 @@ var UpsertInvoiceLineItemSchema = Schema19.Struct({
40727
40771
  Schema19.fromKey("unit_price")
40728
40772
  ),
40729
40773
  quantity: Schema19.BigDecimal,
40730
- salesTaxes: pipe11(
40731
- Schema19.propertySignature(Schema19.UndefinedOr(Schema19.Array(UpsertInvoiceTaxLineItemSchema))),
40774
+ salesTaxes: Schema19.optional(Schema19.Array(UpsertInvoiceTaxLineItemSchema)).pipe(
40732
40775
  Schema19.fromKey("sales_taxes")
40733
40776
  )
40734
40777
  });
@@ -40741,21 +40784,19 @@ var UpsertInvoiceSchema = Schema19.Struct({
40741
40784
  Schema19.propertySignature(Schema19.Date),
40742
40785
  Schema19.fromKey("due_at")
40743
40786
  ),
40744
- invoiceNumber: pipe11(
40745
- Schema19.propertySignature(Schema19.UndefinedOr(Schema19.String)),
40787
+ invoiceNumber: Schema19.optional(Schema19.String).pipe(
40746
40788
  Schema19.fromKey("invoice_number")
40747
40789
  ),
40748
40790
  customerId: pipe11(
40749
40791
  Schema19.propertySignature(Schema19.UUID),
40750
40792
  Schema19.fromKey("customer_id")
40751
40793
  ),
40752
- memo: Schema19.NullOr(Schema19.String),
40794
+ memo: Schema19.optional(Schema19.String),
40753
40795
  lineItems: pipe11(
40754
40796
  Schema19.propertySignature(Schema19.Array(UpsertInvoiceLineItemSchema)),
40755
40797
  Schema19.fromKey("line_items")
40756
40798
  ),
40757
- additionalDiscount: pipe11(
40758
- Schema19.propertySignature(Schema19.UndefinedOr(Schema19.Number)),
40799
+ additionalDiscount: Schema19.optional(Schema19.Number).pipe(
40759
40800
  Schema19.fromKey("additional_discount")
40760
40801
  )
40761
40802
  });
@@ -40816,7 +40857,8 @@ var InvoiceSummaryStatsResponseSchema = Schema19.Struct({
40816
40857
  var UpsertDedicatedInvoicePaymentSchema = Schema19.Struct({
40817
40858
  amount: Schema19.Number,
40818
40859
  method: PaymentMethodSchema,
40819
- paidAt: Schema19.optional(Schema19.Date).pipe(
40860
+ paidAt: pipe11(
40861
+ Schema19.propertySignature(Schema19.Date),
40820
40862
  Schema19.fromKey("paid_at")
40821
40863
  ),
40822
40864
  referenceNumber: Schema19.optional(Schema19.String).pipe(
@@ -40827,7 +40869,7 @@ var UpsertDedicatedInvoicePaymentSchema = Schema19.Struct({
40827
40869
  var DedicatedInvoicePaymentFormSchema = Schema19.Struct({
40828
40870
  amount: Schema19.BigDecimal,
40829
40871
  method: Schema19.NullOr(PaymentMethodSchema),
40830
- paidAt: ZonedDateTimeFromSelf,
40872
+ paidAt: Schema19.NullOr(ZonedDateTimeFromSelf),
40831
40873
  referenceNumber: Schema19.String,
40832
40874
  memo: Schema19.String
40833
40875
  });
@@ -41209,6 +41251,9 @@ var getDueStatusConfig = (invoice, { inline }) => {
41209
41251
  case "PARTIALLY_WRITTEN_OFF" /* PartiallyWrittenOff */: {
41210
41252
  return { text: "Partially Written Off" };
41211
41253
  }
41254
+ case "REFUNDED" /* Refunded */: {
41255
+ return { text: "Refunded" };
41256
+ }
41212
41257
  case "PAID" /* Paid */: {
41213
41258
  return {
41214
41259
  text: "Paid",
@@ -41274,6 +41319,7 @@ var InvoiceStatusOptionConfig = {
41274
41319
  ["Sent" /* Sent */]: { label: "Sent", value: "Sent" /* Sent */ },
41275
41320
  ["Paid" /* Paid */]: { label: "Paid", value: "Paid" /* Paid */ },
41276
41321
  ["Voided" /* Voided */]: { label: "Voided", value: "Voided" /* Voided */ },
41322
+ ["Refunded" /* Refunded */]: { label: "Refunded", value: "Refunded" /* Refunded */ },
41277
41323
  ["Written Off" /* WrittenOff */]: { label: "Written Off", value: "Written Off" /* WrittenOff */ }
41278
41324
  };
41279
41325
  var ALL_OPTION = InvoiceStatusOptionConfig["All" /* All */];
@@ -41285,6 +41331,7 @@ var AmountCell = ({ invoice }) => {
41285
41331
  case "PARTIALLY_WRITTEN_OFF" /* PartiallyWrittenOff */:
41286
41332
  case "WRITTEN_OFF" /* WrittenOff */:
41287
41333
  case "VOIDED" /* Voided */:
41334
+ case "REFUNDED" /* Refunded */:
41288
41335
  case "SENT" /* Sent */: {
41289
41336
  return /* @__PURE__ */ jsx348(VStack, { children: /* @__PURE__ */ jsx348(Span, { align: "right", children: totalAmount }) });
41290
41337
  }
@@ -41360,6 +41407,8 @@ var getListInvoiceParams = ({ status }) => {
41360
41407
  return { status: ["WRITTEN_OFF" /* WrittenOff */, "PARTIALLY_WRITTEN_OFF" /* PartiallyWrittenOff */] };
41361
41408
  case "Voided" /* Voided */:
41362
41409
  return { status: ["VOIDED" /* Voided */] };
41410
+ case "Refunded" /* Refunded */:
41411
+ return { status: ["REFUNDED" /* Refunded */] };
41363
41412
  default:
41364
41413
  unsafeAssertUnreachable({
41365
41414
  value: statusFilter,
@@ -41669,7 +41718,7 @@ var useUpsertInvoice = (props) => {
41669
41718
 
41670
41719
  // src/providers/InvoiceStore/InvoiceStoreProvider.tsx
41671
41720
  import { jsx as jsx349 } from "react/jsx-runtime";
41672
- var InvoiceStoreContext = createContext26(
41721
+ var InvoiceStoreContext = createContext27(
41673
41722
  createStore4(() => ({
41674
41723
  routeState: { route: "Table" /* Table */ },
41675
41724
  tableQuery: { status: ALL_OPTION },
@@ -41689,7 +41738,7 @@ var isInvoiceDetail = (routeState) => {
41689
41738
  return routeState.route === "Detail" /* Detail */;
41690
41739
  };
41691
41740
  function useInvoiceRouteState() {
41692
- const store = useContext61(InvoiceStoreContext);
41741
+ const store = useContext62(InvoiceStoreContext);
41693
41742
  return useStore7(store, (state) => state.routeState);
41694
41743
  }
41695
41744
  function useInvoiceDetail() {
@@ -41699,13 +41748,13 @@ function useInvoiceDetail() {
41699
41748
  return invoiceDetail;
41700
41749
  }
41701
41750
  function useInvoiceTableQuery() {
41702
- const store = useContext61(InvoiceStoreContext);
41751
+ const store = useContext62(InvoiceStoreContext);
41703
41752
  const query = useStore7(store, (state) => state.tableQuery);
41704
41753
  const setQuery = useStore7(store, (state) => state.setTableQuery);
41705
41754
  return useMemo86(() => ({ query, setQuery }), [query, setQuery]);
41706
41755
  }
41707
41756
  function useInvoiceNavigation() {
41708
- const store = useContext61(InvoiceStoreContext);
41757
+ const store = useContext62(InvoiceStoreContext);
41709
41758
  return useStore7(store, (state) => state.navigate);
41710
41759
  }
41711
41760
  function InvoiceStoreProvider(props) {
@@ -41750,7 +41799,7 @@ function InvoiceStoreProvider(props) {
41750
41799
  }
41751
41800
 
41752
41801
  // src/components/Invoices/InvoiceDetail/InvoiceDetail.tsx
41753
- import { useCallback as useCallback77, useMemo as useMemo90, useRef as useRef33, useState as useState89 } from "react";
41802
+ import { useCallback as useCallback86, useMemo as useMemo92, useRef as useRef35, useState as useState91 } from "react";
41754
41803
 
41755
41804
  // src/components/Invoices/InvoiceForm/InvoiceForm.tsx
41756
41805
  import { forwardRef as forwardRef26, useCallback as useCallback72, useEffect as useEffect38, useImperativeHandle as useImperativeHandle4, useRef as useRef31 } from "react";
@@ -42415,7 +42464,7 @@ var DataPoint = ({ label, children }) => {
42415
42464
  };
42416
42465
 
42417
42466
  // src/components/Invoices/InvoiceDetail/InvoiceDetail.tsx
42418
- import { SquarePen, HandCoins as HandCoins2, Menu as MenuIcon, Save as Save2 } from "lucide-react";
42467
+ import { HandCoins as HandCoins2, Save as Save2 } from "lucide-react";
42419
42468
 
42420
42469
  // src/components/Invoices/InvoicePaymentForm/InvoicePaymentForm.tsx
42421
42470
  import { useCallback as useCallback76 } from "react";
@@ -42564,7 +42613,7 @@ import { Schema as Schema25 } from "effect";
42564
42613
  // src/components/Invoices/InvoicePaymentForm/formUtils.ts
42565
42614
  import { BigDecimal as BD7 } from "effect";
42566
42615
  import { formatDate as formatDate2, startOfToday as startOfToday3 } from "date-fns";
42567
- import { getLocalTimeZone as getLocalTimeZone2, fromDate as fromDate3, toCalendarDate as toCalendarDate3 } from "@internationalized/date";
42616
+ import { getLocalTimeZone as getLocalTimeZone2, fromDate as fromDate3, toCalendarDate as toCalendarDate3, today } from "@internationalized/date";
42568
42617
  var getInvoicePaymentFormDefaultValues = (invoice) => {
42569
42618
  const paidAt = fromDate3(startOfToday3(), getLocalTimeZone2());
42570
42619
  return {
@@ -42587,21 +42636,27 @@ var validateInvoicePaymentForm = ({ invoicePayment, invoice }) => {
42587
42636
  if (paidAt === null) {
42588
42637
  errors.push({ paidAt: "Payment date is a required field." });
42589
42638
  }
42590
- if (invoice.sentAt && toCalendarDate3(paidAt).compare(toCalendarDate3(fromDate3(invoice.sentAt, "UTC"))) < 0) {
42639
+ if (paidAt && invoice.sentAt && toCalendarDate3(paidAt).compare(toCalendarDate3(fromDate3(invoice.sentAt, "UTC"))) < 0) {
42591
42640
  errors.push({ paidAt: `Payment date cannot be before the invoice date (${formatDate2(invoice.sentAt, DATE_FORMAT_SHORT)}).` });
42592
42641
  }
42642
+ if (paidAt && toCalendarDate3(paidAt).compare(today(getLocalTimeZone2())) > 0) {
42643
+ errors.push({ paidAt: "Payment date cannot be in the future." });
42644
+ }
42593
42645
  if (method === null) {
42594
42646
  errors.push({ method: "Payment method is a required field." });
42595
42647
  }
42596
42648
  return errors.length > 0 ? errors : null;
42597
42649
  };
42598
- var convertInvoicePaymentFormToParams = (form) => ({
42599
- amount: convertBigDecimalToCents(form.amount),
42600
- method: form.method,
42601
- paidAt: form.paidAt.toDate(),
42602
- referenceNumber: form.referenceNumber.trim() || void 0,
42603
- memo: form.memo.trim() || void 0
42604
- });
42650
+ var convertInvoicePaymentFormToParams = (form) => {
42651
+ var _a;
42652
+ return {
42653
+ amount: convertBigDecimalToCents(form.amount),
42654
+ method: form.method,
42655
+ paidAt: (_a = form.paidAt) == null ? void 0 : _a.toDate(),
42656
+ referenceNumber: form.referenceNumber.trim() || void 0,
42657
+ memo: form.memo.trim() || void 0
42658
+ };
42659
+ };
42605
42660
 
42606
42661
  // src/components/Invoices/InvoicePaymentForm/useInvoicePaymentForm.ts
42607
42662
  var useInvoicePaymentForm = (props) => {
@@ -42750,40 +42805,788 @@ var InvoicePaymentForm = (props) => {
42750
42805
  ] });
42751
42806
  };
42752
42807
 
42808
+ // src/components/Invoices/InvoiceDetail/InvoiceDetailHeaderMenu.tsx
42809
+ import { useCallback as useCallback85, useState as useState90 } from "react";
42810
+ import { Menu as MenuIcon } from "lucide-react";
42811
+
42812
+ // src/features/invoices/api/useVoidInvoice.tsx
42813
+ import { useCallback as useCallback77 } from "react";
42814
+ import useSWRMutation30 from "swr/mutation";
42815
+ import { Schema as Schema26 } from "effect";
42816
+ var VOID_INVOICE_TAG_KEY = "#void-invoice";
42817
+ var VoidInvoiceReturnSchema = Schema26.Struct({
42818
+ data: InvoiceSchema
42819
+ });
42820
+ var voidInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/void`);
42821
+ function buildKey46({
42822
+ access_token: accessToken,
42823
+ apiUrl,
42824
+ businessId,
42825
+ invoiceId
42826
+ }) {
42827
+ if (accessToken && apiUrl) {
42828
+ return {
42829
+ accessToken,
42830
+ apiUrl,
42831
+ businessId,
42832
+ invoiceId,
42833
+ tags: [VOID_INVOICE_TAG_KEY]
42834
+ };
42835
+ }
42836
+ }
42837
+ var VoidInvoiceSWRResponse = class {
42838
+ constructor(swrResponse) {
42839
+ __publicField(this, "swrResponse");
42840
+ this.swrResponse = swrResponse;
42841
+ }
42842
+ get data() {
42843
+ return this.swrResponse.data;
42844
+ }
42845
+ get trigger() {
42846
+ return this.swrResponse.trigger;
42847
+ }
42848
+ get isMutating() {
42849
+ return this.swrResponse.isMutating;
42850
+ }
42851
+ get isError() {
42852
+ return this.swrResponse.error !== void 0;
42853
+ }
42854
+ };
42855
+ var useVoidInvoice = ({ invoiceId }) => {
42856
+ const { data } = useAuth();
42857
+ const { businessId } = useLayerContext();
42858
+ const rawMutationResponse = useSWRMutation30(
42859
+ () => buildKey46(__spreadProps(__spreadValues({}, data), {
42860
+ businessId,
42861
+ invoiceId
42862
+ })),
42863
+ ({ accessToken, apiUrl, businessId: businessId2, invoiceId: invoiceId2 }) => {
42864
+ return voidInvoice(
42865
+ apiUrl,
42866
+ accessToken,
42867
+ { params: { businessId: businessId2, invoiceId: invoiceId2 } }
42868
+ ).then(Schema26.decodeUnknownPromise(VoidInvoiceReturnSchema));
42869
+ },
42870
+ {
42871
+ revalidate: false,
42872
+ throwOnError: true
42873
+ }
42874
+ );
42875
+ const mutationResponse = new VoidInvoiceSWRResponse(rawMutationResponse);
42876
+ const { patchInvoiceByKey } = useInvoicesGlobalCacheActions();
42877
+ const { forceReloadInvoiceSummaryStats } = useInvoiceSummaryStatsCacheActions();
42878
+ const originalTrigger = mutationResponse.trigger;
42879
+ const stableProxiedTrigger = useCallback77(
42880
+ (...triggerParameters) => __async(null, null, function* () {
42881
+ const triggerResult = yield originalTrigger(...triggerParameters);
42882
+ void patchInvoiceByKey(triggerResult.data);
42883
+ void forceReloadInvoiceSummaryStats();
42884
+ return triggerResult;
42885
+ }),
42886
+ [originalTrigger, patchInvoiceByKey, forceReloadInvoiceSummaryStats]
42887
+ );
42888
+ return new Proxy(mutationResponse, {
42889
+ get(target, prop) {
42890
+ if (prop === "trigger") {
42891
+ return stableProxiedTrigger;
42892
+ }
42893
+ return Reflect.get(target, prop);
42894
+ }
42895
+ });
42896
+ };
42897
+
42898
+ // src/components/Invoices/Modal/InvoiceVoidModal.tsx
42899
+ import { useCallback as useCallback78 } from "react";
42900
+ import { jsx as jsx355 } from "react/jsx-runtime";
42901
+ function InvoiceVoidModal({ isOpen, onOpenChange, invoiceId, onSuccess }) {
42902
+ const { trigger: voidInvoice2 } = useVoidInvoice({ invoiceId });
42903
+ const onConfirm = useCallback78(() => __async(null, null, function* () {
42904
+ const { data: invoice } = yield voidInvoice2();
42905
+ onSuccess(invoice);
42906
+ }), [onSuccess, voidInvoice2]);
42907
+ return /* @__PURE__ */ jsx355(
42908
+ BaseConfirmationModal,
42909
+ {
42910
+ isOpen,
42911
+ onOpenChange,
42912
+ title: "Void invoice",
42913
+ description: "Voiding this invoice will mark it as cancelled, and you will no longer be able to apply payments to it. This action cannot be undone.",
42914
+ onConfirm,
42915
+ confirmLabel: "Void Invoice",
42916
+ errorText: "There was an error voiding this invoice. Please check your connection and try again in a few seconds."
42917
+ }
42918
+ );
42919
+ }
42920
+
42921
+ // src/features/invoices/api/useWriteoffInvoice.tsx
42922
+ import { Schema as Schema28 } from "effect";
42923
+ import { useCallback as useCallback79 } from "react";
42924
+ import useSWRMutation31 from "swr/mutation";
42925
+
42926
+ // src/features/invoices/invoiceWriteoffSchemas.ts
42927
+ import { Schema as Schema27, pipe as pipe12 } from "effect";
42928
+ var InvoiceWriteoffMode = /* @__PURE__ */ ((InvoiceWriteoffMode2) => {
42929
+ InvoiceWriteoffMode2["Expense"] = "EXPENSE";
42930
+ InvoiceWriteoffMode2["RevenueReversal"] = "REVENUE_REVERSAL";
42931
+ return InvoiceWriteoffMode2;
42932
+ })(InvoiceWriteoffMode || {});
42933
+ var InvoiceWriteoffModeSchema = Schema27.Enums(InvoiceWriteoffMode);
42934
+ var TransformedInvoiceWriteoffModeSchema = Schema27.transform(
42935
+ Schema27.NonEmptyTrimmedString,
42936
+ Schema27.typeSchema(InvoiceWriteoffModeSchema),
42937
+ {
42938
+ decode: (input) => {
42939
+ if (Object.values(InvoiceWriteoffModeSchema.enums).includes(input)) {
42940
+ return input;
42941
+ }
42942
+ return "EXPENSE" /* Expense */;
42943
+ },
42944
+ encode: (input) => input
42945
+ }
42946
+ );
42947
+ var CreateInvoiceWriteoffSchema = Schema27.Struct({
42948
+ externalId: Schema27.optional(Schema27.String).pipe(
42949
+ Schema27.fromKey("external_id")
42950
+ ),
42951
+ amount: Schema27.Number,
42952
+ writeOffMode: Schema27.optional(InvoiceWriteoffModeSchema).pipe(
42953
+ Schema27.fromKey("write_off_mode")
42954
+ ),
42955
+ writeOffAt: pipe12(
42956
+ Schema27.propertySignature(Schema27.Date),
42957
+ Schema27.fromKey("write_off_at")
42958
+ ),
42959
+ referenceNumber: Schema27.optional(Schema27.String).pipe(
42960
+ Schema27.fromKey("reference_number")
42961
+ ),
42962
+ memo: Schema27.optional(Schema27.String)
42963
+ });
42964
+ var InvoiceWriteoffSchema = Schema27.Struct({
42965
+ invoiceId: pipe12(
42966
+ Schema27.propertySignature(Schema27.UUID),
42967
+ Schema27.fromKey("invoice_id")
42968
+ ),
42969
+ externalId: pipe12(
42970
+ Schema27.propertySignature(Schema27.NullOr(Schema27.String)),
42971
+ Schema27.fromKey("external_id")
42972
+ ),
42973
+ amount: Schema27.Number,
42974
+ writeOffMode: pipe12(
42975
+ Schema27.propertySignature(TransformedInvoiceWriteoffModeSchema),
42976
+ Schema27.fromKey("write_off_mode")
42977
+ ),
42978
+ writeOffAt: pipe12(
42979
+ Schema27.propertySignature(Schema27.Date),
42980
+ Schema27.fromKey("write_off_at")
42981
+ ),
42982
+ referenceNumber: pipe12(
42983
+ Schema27.propertySignature(Schema27.NullOr(Schema27.String)),
42984
+ Schema27.fromKey("reference_number")
42985
+ ),
42986
+ memo: Schema27.NullOr(Schema27.String)
42987
+ });
42988
+
42989
+ // src/features/invoices/api/useWriteoffInvoice.tsx
42990
+ var CREATE_INVOICE_WRITEOFF_TAG_KEY = "#writeoff-invoice";
42991
+ var writeoffInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/write-off`);
42992
+ function buildKey47({
42993
+ access_token: accessToken,
42994
+ apiUrl,
42995
+ businessId,
42996
+ invoiceId,
42997
+ invoiceWriteoffId = void 0
42998
+ }) {
42999
+ if (accessToken && apiUrl) {
43000
+ return {
43001
+ accessToken,
43002
+ apiUrl,
43003
+ businessId,
43004
+ invoiceId,
43005
+ invoiceWriteoffId,
43006
+ tags: [CREATE_INVOICE_WRITEOFF_TAG_KEY]
43007
+ };
43008
+ }
43009
+ }
43010
+ var WriteoffInvoiceReturnSchema = Schema28.Struct({
43011
+ data: InvoiceWriteoffSchema
43012
+ });
43013
+ var WriteoffInvoiceSWRResponse = class {
43014
+ constructor(swrResponse) {
43015
+ __publicField(this, "swrResponse");
43016
+ this.swrResponse = swrResponse;
43017
+ }
43018
+ get data() {
43019
+ return this.swrResponse.data;
43020
+ }
43021
+ get trigger() {
43022
+ return this.swrResponse.trigger;
43023
+ }
43024
+ get isMutating() {
43025
+ return this.swrResponse.isMutating;
43026
+ }
43027
+ get isError() {
43028
+ return this.swrResponse.error !== void 0;
43029
+ }
43030
+ };
43031
+ var updateInvoiceWithWriteoff = (invoice) => {
43032
+ const status = invoice.status === "PARTIALLY_PAID" /* PartiallyPaid */ ? "PARTIALLY_WRITTEN_OFF" /* PartiallyWrittenOff */ : "WRITTEN_OFF" /* WrittenOff */;
43033
+ return __spreadProps(__spreadValues({}, invoice), { status, outstandingBalance: 0 });
43034
+ };
43035
+ var useWriteoffInvoice = ({ invoiceId }) => {
43036
+ const { data } = useAuth();
43037
+ const { businessId } = useLayerContext();
43038
+ const applyWriteoffToInvoice = useCallback79(() => (invoice) => {
43039
+ if (invoice.id !== invoiceId) return invoice;
43040
+ return updateInvoiceWithWriteoff(invoice);
43041
+ }, [invoiceId]);
43042
+ const rawMutationResponse = useSWRMutation31(
43043
+ () => buildKey47(__spreadProps(__spreadValues({}, data), {
43044
+ businessId,
43045
+ invoiceId
43046
+ })),
43047
+ ({ accessToken, apiUrl, businessId: businessId2, invoiceId: invoiceId2 }, { arg: decodedBody }) => {
43048
+ const body = Schema28.encodeSync(CreateInvoiceWriteoffSchema)(decodedBody);
43049
+ return writeoffInvoice(
43050
+ apiUrl,
43051
+ accessToken,
43052
+ { params: { businessId: businessId2, invoiceId: invoiceId2 }, body }
43053
+ ).then(Schema28.decodeUnknownPromise(WriteoffInvoiceReturnSchema));
43054
+ },
43055
+ {
43056
+ revalidate: false,
43057
+ throwOnError: true
43058
+ }
43059
+ );
43060
+ const mutationResponse = new WriteoffInvoiceSWRResponse(rawMutationResponse);
43061
+ const { patchInvoiceWithTransformation } = useInvoicesGlobalCacheActions();
43062
+ const { forceReloadInvoiceSummaryStats } = useInvoiceSummaryStatsCacheActions();
43063
+ const originalTrigger = mutationResponse.trigger;
43064
+ const stableProxiedTrigger = useCallback79(
43065
+ (...triggerParameters) => __async(null, null, function* () {
43066
+ const triggerResult = yield originalTrigger(...triggerParameters);
43067
+ void patchInvoiceWithTransformation(applyWriteoffToInvoice());
43068
+ void forceReloadInvoiceSummaryStats();
43069
+ return triggerResult;
43070
+ }),
43071
+ [originalTrigger, patchInvoiceWithTransformation, applyWriteoffToInvoice, forceReloadInvoiceSummaryStats]
43072
+ );
43073
+ return new Proxy(mutationResponse, {
43074
+ get(target, prop) {
43075
+ if (prop === "trigger") {
43076
+ return stableProxiedTrigger;
43077
+ }
43078
+ return Reflect.get(target, prop);
43079
+ }
43080
+ });
43081
+ };
43082
+
43083
+ // src/components/Invoices/Modal/InvoiceWriteoffModal.tsx
43084
+ import { useCallback as useCallback80 } from "react";
43085
+ import { jsx as jsx356 } from "react/jsx-runtime";
43086
+ function InvoiceWriteoffModal({ isOpen, onOpenChange, invoice, onSuccess }) {
43087
+ const { trigger: writeoffInvoice2 } = useWriteoffInvoice({ invoiceId: invoice.id });
43088
+ const onConfirm = useCallback80(() => __async(null, null, function* () {
43089
+ yield writeoffInvoice2({
43090
+ writeOffAt: /* @__PURE__ */ new Date(),
43091
+ amount: invoice.outstandingBalance
43092
+ });
43093
+ onSuccess(updateInvoiceWithWriteoff(invoice));
43094
+ }), [invoice, onSuccess, writeoffInvoice2]);
43095
+ return /* @__PURE__ */ jsx356(
43096
+ BaseConfirmationModal,
43097
+ {
43098
+ isOpen,
43099
+ onOpenChange,
43100
+ title: "Write off invoice",
43101
+ description: "Writing off this invoice will record it as bad debt, and you will no longer be able to apply payments to it. This action cannot be undone.",
43102
+ onConfirm,
43103
+ confirmLabel: "Write Off Invoice",
43104
+ errorText: "There was an error writing off this invoice. Please check your connection and try again in a few seconds."
43105
+ }
43106
+ );
43107
+ }
43108
+
43109
+ // src/components/Invoices/Modal/InvoiceResetModal.tsx
43110
+ import { jsx as jsx357 } from "react/jsx-runtime";
43111
+ function InvoiceResetModal({ isOpen, onOpenChange, invoiceId: _invoiceId }) {
43112
+ return /* @__PURE__ */ jsx357(
43113
+ BaseConfirmationModal,
43114
+ {
43115
+ isOpen,
43116
+ onOpenChange,
43117
+ title: "Reset invoice to sent",
43118
+ description: "Resetting this invoice will delete all payments, refunds, and write offs associated with it. This action cannot be undone.",
43119
+ onConfirm: () => {
43120
+ },
43121
+ confirmLabel: "Reset Invoice",
43122
+ errorText: "There was an error resetting this invoice. Please check your connection and try again in a few seconds."
43123
+ }
43124
+ );
43125
+ }
43126
+
43127
+ // src/components/Invoices/Modal/InvoiceRefundModal.tsx
43128
+ import { useCallback as useCallback84, useMemo as useMemo91, useRef as useRef34 } from "react";
43129
+
43130
+ // src/components/Invoices/InvoiceRefundForm/InvoiceRefundForm.tsx
43131
+ import { forwardRef as forwardRef27, useCallback as useCallback83, useImperativeHandle as useImperativeHandle5 } from "react";
43132
+ import { AlertTriangle as AlertTriangle3 } from "lucide-react";
43133
+
43134
+ // src/components/Invoices/InvoiceRefundForm/useInvoiceRefundForm.ts
43135
+ import { useCallback as useCallback82, useMemo as useMemo90, useState as useState89, useRef as useRef33 } from "react";
43136
+ import { revalidateLogic as revalidateLogic3 } from "@tanstack/react-form";
43137
+ import { Schema as Schema31 } from "effect";
43138
+
43139
+ // src/components/Invoices/InvoiceRefundForm/formUtils.ts
43140
+ import { formatDate as formatDate3, startOfToday as startOfToday4 } from "date-fns";
43141
+ import { getLocalTimeZone as getLocalTimeZone3, fromDate as fromDate4, toCalendarDate as toCalendarDate4, today as today2 } from "@internationalized/date";
43142
+ var getInvoiceRefundFormDefaultValues = (invoice) => {
43143
+ const completedAt = fromDate4(startOfToday4(), getLocalTimeZone3());
43144
+ return {
43145
+ amount: convertCentsToBigDecimal(invoice.totalAmount),
43146
+ method: null,
43147
+ completedAt
43148
+ };
43149
+ };
43150
+ var validateInvoiceRefundForm = ({ invoiceRefund, invoice }) => {
43151
+ const { completedAt, method } = invoiceRefund;
43152
+ const errors = [];
43153
+ if (completedAt === null) {
43154
+ errors.push({ completedAt: "Refund date is a required field." });
43155
+ }
43156
+ if (completedAt && invoice.paidAt && toCalendarDate4(completedAt).compare(toCalendarDate4(fromDate4(invoice.paidAt, "UTC"))) < 0) {
43157
+ errors.push({ completedAt: `Refund date cannot be before the last invoice payment (${formatDate3(invoice.paidAt, DATE_FORMAT_SHORT)}).` });
43158
+ }
43159
+ if (completedAt && toCalendarDate4(completedAt).compare(today2(getLocalTimeZone3())) > 0) {
43160
+ errors.push({ completedAt: "Refund date cannot be in the future." });
43161
+ }
43162
+ if (method === null) {
43163
+ errors.push({ method: "Payment method is a required field." });
43164
+ }
43165
+ return errors.length > 0 ? errors : null;
43166
+ };
43167
+ var convertInvoiceRefundFormToParams = (form) => {
43168
+ var _a;
43169
+ return {
43170
+ amount: convertBigDecimalToCents(form.amount),
43171
+ method: form.method,
43172
+ completedAt: (_a = form.completedAt) == null ? void 0 : _a.toDate()
43173
+ };
43174
+ };
43175
+
43176
+ // src/features/invoices/customerRefundSchemas.ts
43177
+ import { Schema as Schema29, pipe as pipe13 } from "effect";
43178
+ var CustomerRefundStatus = /* @__PURE__ */ ((CustomerRefundStatus2) => {
43179
+ CustomerRefundStatus2["Paid"] = "PAID";
43180
+ CustomerRefundStatus2["PartiallyPaid"] = "PARTIALLY_PAID";
43181
+ CustomerRefundStatus2["Sent"] = "SENT";
43182
+ return CustomerRefundStatus2;
43183
+ })(CustomerRefundStatus || {});
43184
+ var CustomerRefundStatusSchema = Schema29.Enums(CustomerRefundStatus);
43185
+ var TransformedCustomerRefundStatusSchema = Schema29.transform(
43186
+ Schema29.NonEmptyTrimmedString,
43187
+ Schema29.typeSchema(CustomerRefundStatusSchema),
43188
+ {
43189
+ decode: (input) => {
43190
+ if (Object.values(CustomerRefundStatusSchema.enums).includes(input)) {
43191
+ return input;
43192
+ }
43193
+ return "SENT" /* Sent */;
43194
+ },
43195
+ encode: (input) => input
43196
+ }
43197
+ );
43198
+ var CreateCustomerRefundSchema = Schema29.Struct({
43199
+ externalId: Schema29.optional(Schema29.String).pipe(
43200
+ Schema29.fromKey("external_id")
43201
+ ),
43202
+ refundedAmount: Schema29.optional(Schema29.Number).pipe(
43203
+ Schema29.fromKey("refunded_amount")
43204
+ ),
43205
+ completedAt: pipe13(
43206
+ Schema29.propertySignature(Schema29.Date),
43207
+ Schema29.fromKey("completed_at")
43208
+ ),
43209
+ method: PaymentMethodSchema,
43210
+ referenceNumber: Schema29.optional(Schema29.String).pipe(
43211
+ Schema29.fromKey("reference_number")
43212
+ ),
43213
+ memo: Schema29.optional(Schema29.String)
43214
+ });
43215
+ var CustomerRefundSchema = Schema29.Struct({
43216
+ externalId: pipe13(
43217
+ Schema29.propertySignature(Schema29.UndefinedOr(Schema29.String)),
43218
+ Schema29.fromKey("external_id")
43219
+ ),
43220
+ refundedAmount: pipe13(
43221
+ Schema29.propertySignature(Schema29.Number),
43222
+ Schema29.fromKey("refunded_amount")
43223
+ ),
43224
+ status: TransformedCustomerRefundStatusSchema,
43225
+ completedAt: pipe13(
43226
+ Schema29.propertySignature(Schema29.Date),
43227
+ Schema29.fromKey("completed_at")
43228
+ ),
43229
+ isDedicated: pipe13(
43230
+ Schema29.propertySignature(Schema29.Boolean),
43231
+ Schema29.fromKey("is_dedicated")
43232
+ ),
43233
+ referenceNumber: pipe13(
43234
+ Schema29.propertySignature(Schema29.NullOr(Schema29.String)),
43235
+ Schema29.fromKey("reference_number")
43236
+ ),
43237
+ memo: Schema29.NullOr(Schema29.String)
43238
+ });
43239
+
43240
+ // src/features/invoices/api/useRefundInvoice.tsx
43241
+ import { useCallback as useCallback81 } from "react";
43242
+ import useSWRMutation32 from "swr/mutation";
43243
+ import { Schema as Schema30 } from "effect";
43244
+ var REFUND_INVOICE_TAG_KEY = "#refund-invoice";
43245
+ var RefundInvoiceReturnSchema = Schema30.Struct({
43246
+ data: CustomerRefundSchema
43247
+ });
43248
+ var refundInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/refund`);
43249
+ function buildKey48({
43250
+ access_token: accessToken,
43251
+ apiUrl,
43252
+ businessId,
43253
+ invoiceId
43254
+ }) {
43255
+ if (accessToken && apiUrl) {
43256
+ return {
43257
+ accessToken,
43258
+ apiUrl,
43259
+ businessId,
43260
+ invoiceId,
43261
+ tags: [REFUND_INVOICE_TAG_KEY]
43262
+ };
43263
+ }
43264
+ }
43265
+ var RefundInvoiceSWRResponse = class {
43266
+ constructor(swrResponse) {
43267
+ __publicField(this, "swrResponse");
43268
+ this.swrResponse = swrResponse;
43269
+ }
43270
+ get data() {
43271
+ return this.swrResponse.data;
43272
+ }
43273
+ get trigger() {
43274
+ return this.swrResponse.trigger;
43275
+ }
43276
+ get isMutating() {
43277
+ return this.swrResponse.isMutating;
43278
+ }
43279
+ get isError() {
43280
+ return this.swrResponse.error !== void 0;
43281
+ }
43282
+ };
43283
+ var updateInvoiceWithRefund = (invoice) => {
43284
+ return __spreadProps(__spreadValues({}, invoice), { status: "REFUNDED" /* Refunded */ });
43285
+ };
43286
+ var useRefundInvoice = ({ invoiceId }) => {
43287
+ const { data } = useAuth();
43288
+ const { businessId } = useLayerContext();
43289
+ const applyRefundToInvoice = useCallback81(() => (invoice) => {
43290
+ if (invoice.id !== invoiceId) return invoice;
43291
+ return updateInvoiceWithRefund(invoice);
43292
+ }, [invoiceId]);
43293
+ const rawMutationResponse = useSWRMutation32(
43294
+ () => buildKey48(__spreadProps(__spreadValues({}, data), {
43295
+ businessId,
43296
+ invoiceId
43297
+ })),
43298
+ ({ accessToken, apiUrl, businessId: businessId2, invoiceId: invoiceId2 }, { arg: body }) => {
43299
+ return refundInvoice(
43300
+ apiUrl,
43301
+ accessToken,
43302
+ { params: { businessId: businessId2, invoiceId: invoiceId2 }, body }
43303
+ ).then(Schema30.decodeUnknownPromise(RefundInvoiceReturnSchema));
43304
+ },
43305
+ {
43306
+ revalidate: false,
43307
+ throwOnError: true
43308
+ }
43309
+ );
43310
+ const mutationResponse = new RefundInvoiceSWRResponse(rawMutationResponse);
43311
+ const { patchInvoiceWithTransformation } = useInvoicesGlobalCacheActions();
43312
+ const { forceReloadInvoiceSummaryStats } = useInvoiceSummaryStatsCacheActions();
43313
+ const originalTrigger = mutationResponse.trigger;
43314
+ const stableProxiedTrigger = useCallback81(
43315
+ (...triggerParameters) => __async(null, null, function* () {
43316
+ const triggerResult = yield originalTrigger(...triggerParameters);
43317
+ void patchInvoiceWithTransformation(applyRefundToInvoice());
43318
+ void forceReloadInvoiceSummaryStats();
43319
+ return triggerResult;
43320
+ }),
43321
+ [originalTrigger, patchInvoiceWithTransformation, applyRefundToInvoice, forceReloadInvoiceSummaryStats]
43322
+ );
43323
+ return new Proxy(mutationResponse, {
43324
+ get(target, prop) {
43325
+ if (prop === "trigger") {
43326
+ return stableProxiedTrigger;
43327
+ }
43328
+ return Reflect.get(target, prop);
43329
+ }
43330
+ });
43331
+ };
43332
+
43333
+ // src/components/Invoices/InvoiceRefundForm/useInvoiceRefundForm.ts
43334
+ var useInvoiceRefundForm = ({ onSuccess, invoice }) => {
43335
+ const [submitError, setSubmitError] = useState89(void 0);
43336
+ const { trigger: refundInvoice2 } = useRefundInvoice({ invoiceId: invoice.id });
43337
+ const defaultValuesRef = useRef33(getInvoiceRefundFormDefaultValues(invoice));
43338
+ const defaultValues = defaultValuesRef.current;
43339
+ const onSubmit = useCallback82((_0) => __async(null, [_0], function* ({ value }) {
43340
+ try {
43341
+ const customerRefundParams = convertInvoiceRefundFormToParams(value);
43342
+ const refundInvoiceRequest = Schema31.encodeUnknownSync(CreateCustomerRefundSchema)(customerRefundParams);
43343
+ const { data: refund } = yield refundInvoice2(refundInvoiceRequest);
43344
+ setSubmitError(void 0);
43345
+ onSuccess(refund);
43346
+ } catch (e) {
43347
+ console.error(e);
43348
+ setSubmitError("Something went wrong. Please try again.");
43349
+ }
43350
+ }), [onSuccess, refundInvoice2]);
43351
+ const onDynamic = useCallback82(({ value }) => {
43352
+ return validateInvoiceRefundForm({ invoiceRefund: value, invoice });
43353
+ }, [invoice]);
43354
+ const validators = useMemo90(() => ({ onDynamic }), [onDynamic]);
43355
+ const form = useAppForm({
43356
+ defaultValues,
43357
+ onSubmit,
43358
+ validators,
43359
+ validationLogic: revalidateLogic3({
43360
+ mode: "submit",
43361
+ modeAfterSubmission: "submit"
43362
+ }),
43363
+ canSubmitWhenInvalid: true
43364
+ });
43365
+ return useMemo90(
43366
+ () => ({ form, submitError }),
43367
+ [form, submitError]
43368
+ );
43369
+ };
43370
+
43371
+ // src/components/Invoices/InvoiceRefundForm/InvoiceRefundForm.tsx
43372
+ import { jsx as jsx358, jsxs as jsxs226 } from "react/jsx-runtime";
43373
+ var INVOICE_REFUND_FORM_CSS_PREFIX = "Layer__InvoiceRefundForm";
43374
+ var INVOICE_REFUND_FORM_FIELD_CSS_PREFIX = `${INVOICE_REFUND_FORM_CSS_PREFIX}__Field`;
43375
+ var InvoiceRefundForm = forwardRef27(({ onSuccess, invoice }, ref) => {
43376
+ const { form, submitError } = useInvoiceRefundForm({ onSuccess, invoice });
43377
+ const blockNativeOnSubmit = useCallback83((e) => {
43378
+ e.preventDefault();
43379
+ e.stopPropagation();
43380
+ }, []);
43381
+ useImperativeHandle5(ref, () => ({
43382
+ submit: () => form.handleSubmit()
43383
+ }));
43384
+ return /* @__PURE__ */ jsxs226(Form, { className: INVOICE_REFUND_FORM_CSS_PREFIX, onSubmit: blockNativeOnSubmit, children: [
43385
+ /* @__PURE__ */ jsx358(form.Subscribe, { selector: (state) => state.errorMap, children: (errorMap) => {
43386
+ const validationErrors = flattenValidationErrors(errorMap);
43387
+ if (validationErrors.length > 0 || submitError) {
43388
+ return /* @__PURE__ */ jsx358(HStack, { className: `${INVOICE_REFUND_FORM_CSS_PREFIX}__FormError`, children: /* @__PURE__ */ jsx358(
43389
+ DataState,
43390
+ {
43391
+ icon: /* @__PURE__ */ jsx358(AlertTriangle3, { size: 16 }),
43392
+ status: "failed" /* failed */,
43393
+ title: validationErrors[0] || submitError,
43394
+ titleSize: "md" /* md */,
43395
+ inline: true
43396
+ }
43397
+ ) });
43398
+ }
43399
+ } }),
43400
+ /* @__PURE__ */ jsxs226(VStack, { className: `${INVOICE_REFUND_FORM_CSS_PREFIX}__Section`, gap: "sm", children: [
43401
+ /* @__PURE__ */ jsxs226(HStack, { className: `${INVOICE_REFUND_FORM_FIELD_CSS_PREFIX}__InvoiceNo`, gap: "xs", align: "center", children: [
43402
+ /* @__PURE__ */ jsx358(Span, { size: "sm", children: "Invoice" }),
43403
+ /* @__PURE__ */ jsxs226(Span, { size: "md", weight: "bold", children: [
43404
+ "#",
43405
+ invoice.invoiceNumber
43406
+ ] })
43407
+ ] }),
43408
+ /* @__PURE__ */ jsx358(form.AppField, { name: "completedAt", children: (field) => /* @__PURE__ */ jsx358(field.FormDateField, { label: "Refund date", inline: true, className: `${INVOICE_REFUND_FORM_FIELD_CSS_PREFIX}__CompletedAt` }) }),
43409
+ /* @__PURE__ */ jsx358(form.Field, { name: "method", children: (field) => /* @__PURE__ */ jsx358(
43410
+ PaymentMethodComboBox,
43411
+ {
43412
+ className: `${INVOICE_REFUND_FORM_FIELD_CSS_PREFIX}__PaymentMethod`,
43413
+ value: field.state.value,
43414
+ onValueChange: field.handleChange,
43415
+ inline: true
43416
+ }
43417
+ ) }),
43418
+ /* @__PURE__ */ jsx358(form.AppField, { name: "amount", children: (field) => /* @__PURE__ */ jsx358(field.FormBigDecimalField, { label: "Amount", inline: true, className: `${INVOICE_REFUND_FORM_FIELD_CSS_PREFIX}__Amount`, mode: "currency", isReadOnly: true }) })
43419
+ ] })
43420
+ ] });
43421
+ });
43422
+ InvoiceRefundForm.displayName = "InvoiceRefundForm";
43423
+
43424
+ // src/components/Invoices/Modal/InvoiceRefundModal.tsx
43425
+ import { jsx as jsx359 } from "react/jsx-runtime";
43426
+ function InvoiceRefundModal({ isOpen, onOpenChange, invoice, onSuccess }) {
43427
+ const formRef = useRef34(null);
43428
+ const onConfirm = useCallback84(() => {
43429
+ var _a;
43430
+ return (_a = formRef.current) == null ? void 0 : _a.submit();
43431
+ }, []);
43432
+ const onSuccessForm = useCallback84(() => {
43433
+ onSuccess(updateInvoiceWithRefund(invoice));
43434
+ onOpenChange == null ? void 0 : onOpenChange(false);
43435
+ }, [invoice, onOpenChange, onSuccess]);
43436
+ const content = useMemo91(() => /* @__PURE__ */ jsx359(InvoiceRefundForm, { invoice, onSuccess: onSuccessForm, ref: formRef }), [invoice, onSuccessForm]);
43437
+ return /* @__PURE__ */ jsx359(
43438
+ BaseConfirmationModal,
43439
+ {
43440
+ isOpen,
43441
+ onOpenChange,
43442
+ title: "Issue refund",
43443
+ content,
43444
+ onConfirm,
43445
+ confirmLabel: "Refund Invoice",
43446
+ errorText: "There was an error issuing a refund for this invoice. Please check your connection and try again in a few seconds.",
43447
+ closeOnConfirm: false
43448
+ }
43449
+ );
43450
+ }
43451
+
43452
+ // src/components/Invoices/InvoiceDetail/InvoiceDetailHeaderMenu.tsx
43453
+ import { Fragment as Fragment59, jsx as jsx360, jsxs as jsxs227 } from "react/jsx-runtime";
43454
+ var availableActions = {
43455
+ ["SENT" /* Sent */]: [
43456
+ "Edit" /* Edit */,
43457
+ "Void" /* Void */,
43458
+ "Writeoff" /* Writeoff */
43459
+ ],
43460
+ ["PARTIALLY_PAID" /* PartiallyPaid */]: [
43461
+ "Writeoff" /* Writeoff */,
43462
+ "Reset" /* Reset */
43463
+ ],
43464
+ ["PAID" /* Paid */]: [
43465
+ "Refund" /* Refund */,
43466
+ "Reset" /* Reset */
43467
+ ],
43468
+ ["VOIDED" /* Voided */]: [],
43469
+ ["PARTIALLY_WRITTEN_OFF" /* PartiallyWrittenOff */]: ["Reset" /* Reset */],
43470
+ ["WRITTEN_OFF" /* WrittenOff */]: ["Reset" /* Reset */],
43471
+ ["REFUNDED" /* Refunded */]: ["Reset" /* Reset */]
43472
+ };
43473
+ var getInvoiceActions = (invoice) => {
43474
+ return availableActions[invoice.status];
43475
+ };
43476
+ var InvoiceDetailHeaderMenu = ({ onEditInvoice }) => {
43477
+ const viewState = useInvoiceDetail();
43478
+ const { toViewInvoice } = useInvoiceNavigation();
43479
+ const [openModal, setOpenModal] = useState90();
43480
+ const onSuccessUpdateInvoice = useCallback85((updatedInvoice) => {
43481
+ toViewInvoice(updatedInvoice);
43482
+ }, [toViewInvoice]);
43483
+ const onOpenChangeByMode = useCallback85(
43484
+ (mode) => (isOpen = true) => {
43485
+ if (isOpen) {
43486
+ setOpenModal(mode);
43487
+ } else {
43488
+ setOpenModal(void 0);
43489
+ }
43490
+ },
43491
+ []
43492
+ );
43493
+ const Trigger = useCallback85(() => {
43494
+ return /* @__PURE__ */ jsx360(Button2, { icon: true, variant: "outlined", children: /* @__PURE__ */ jsx360(MenuIcon, { size: 14 }) });
43495
+ }, []);
43496
+ if (viewState.mode === "Create" /* Create */) return null;
43497
+ const invoice = viewState.invoice;
43498
+ const invoiceActions = getInvoiceActions(invoice);
43499
+ if (!invoiceActions.length) return null;
43500
+ return /* @__PURE__ */ jsxs227(Fragment59, { children: [
43501
+ /* @__PURE__ */ jsx360(
43502
+ DropdownMenu,
43503
+ {
43504
+ ariaLabel: "Additional invoice actions",
43505
+ slots: { Trigger },
43506
+ slotProps: { Dialog: { width: 160 } },
43507
+ variant: "compact",
43508
+ children: /* @__PURE__ */ jsxs227(MenuList, { children: [
43509
+ invoiceActions.includes("Edit" /* Edit */) && /* @__PURE__ */ jsx360(MenuItem3, { onClick: onEditInvoice, children: /* @__PURE__ */ jsx360(Span, { size: "sm", children: "Edit details" }) }, "Edit" /* Edit */),
43510
+ invoiceActions.includes("Refund" /* Refund */) && /* @__PURE__ */ jsx360(MenuItem3, { onClick: onOpenChangeByMode("Refund" /* Refund */), children: /* @__PURE__ */ jsx360(Span, { size: "sm", children: "Issue refund" }) }, "Refund" /* Refund */),
43511
+ invoiceActions.includes("Void" /* Void */) && /* @__PURE__ */ jsx360(MenuItem3, { onClick: onOpenChangeByMode("Void" /* Void */), children: /* @__PURE__ */ jsx360(Span, { size: "sm", children: "Cancel/Void" }) }, "Void" /* Void */),
43512
+ invoiceActions.includes("Writeoff" /* Writeoff */) && /* @__PURE__ */ jsx360(MenuItem3, { onClick: onOpenChangeByMode("Writeoff" /* Writeoff */), children: /* @__PURE__ */ jsx360(Span, { size: "sm", children: "Write off" }) }, "Writeoff" /* Writeoff */),
43513
+ invoiceActions.includes("Reset" /* Reset */) && /* @__PURE__ */ jsx360(MenuItem3, { onClick: onOpenChangeByMode("Reset" /* Reset */), children: /* @__PURE__ */ jsx360(Span, { size: "sm", children: "Reset to sent" }) }, "Reset" /* Reset */)
43514
+ ] })
43515
+ }
43516
+ ),
43517
+ /* @__PURE__ */ jsx360(
43518
+ InvoiceRefundModal,
43519
+ {
43520
+ isOpen: openModal === "Refund" /* Refund */,
43521
+ onOpenChange: onOpenChangeByMode("Refund" /* Refund */),
43522
+ invoice,
43523
+ onSuccess: onSuccessUpdateInvoice
43524
+ }
43525
+ ),
43526
+ /* @__PURE__ */ jsx360(
43527
+ InvoiceVoidModal,
43528
+ {
43529
+ isOpen: openModal === "Void" /* Void */,
43530
+ onOpenChange: onOpenChangeByMode("Void" /* Void */),
43531
+ invoiceId: invoice.id,
43532
+ onSuccess: onSuccessUpdateInvoice
43533
+ }
43534
+ ),
43535
+ /* @__PURE__ */ jsx360(
43536
+ InvoiceWriteoffModal,
43537
+ {
43538
+ isOpen: openModal === "Writeoff" /* Writeoff */,
43539
+ onOpenChange: onOpenChangeByMode("Writeoff" /* Writeoff */),
43540
+ invoice,
43541
+ onSuccess: onSuccessUpdateInvoice
43542
+ }
43543
+ ),
43544
+ /* @__PURE__ */ jsx360(
43545
+ InvoiceResetModal,
43546
+ {
43547
+ isOpen: openModal === "Reset" /* Reset */,
43548
+ onOpenChange: onOpenChangeByMode("Reset" /* Reset */),
43549
+ invoiceId: invoice.id,
43550
+ onSuccess: onSuccessUpdateInvoice
43551
+ }
43552
+ )
43553
+ ] });
43554
+ };
43555
+
42753
43556
  // src/components/Invoices/InvoiceDetail/InvoiceDetail.tsx
42754
- import { Fragment as Fragment58, jsx as jsx355, jsxs as jsxs226 } from "react/jsx-runtime";
43557
+ import { Fragment as Fragment60, jsx as jsx361, jsxs as jsxs228 } from "react/jsx-runtime";
42755
43558
  var InvoiceDetail = () => {
42756
43559
  const viewState = useInvoiceDetail();
42757
- const [isPaymentDrawerOpen, setIsPaymentDrawerOpen] = useState89(false);
42758
- const [isDiscardChangesModalOpen, setIsDiscardChangesModalOpen] = useState89(false);
43560
+ const [isPaymentDrawerOpen, setIsPaymentDrawerOpen] = useState91(false);
43561
+ const [isDiscardChangesModalOpen, setIsDiscardChangesModalOpen] = useState91(false);
42759
43562
  const { toViewInvoice, toInvoiceTable } = useInvoiceNavigation();
42760
43563
  const { addToast } = useLayerContext();
42761
- const formRef = useRef33(null);
42762
- const [isReadOnly, setIsReadOnly] = useState89(viewState.mode === "Update" /* Update */);
42763
- const onUpsertInvoiceSuccess = useCallback77((invoice) => {
43564
+ const formRef = useRef35(null);
43565
+ const [isReadOnly, setIsReadOnly] = useState91(viewState.mode === "Update" /* Update */);
43566
+ const onUpsertInvoiceSuccess = useCallback86((invoice) => {
42764
43567
  const toastContent = viewState.mode === "Update" /* Update */ ? "Invoice updated successfully" : "Invoice created successfully";
42765
43568
  addToast({ content: toastContent, type: "success" });
42766
43569
  toViewInvoice(invoice);
42767
43570
  setIsReadOnly(true);
42768
43571
  }, [viewState.mode, addToast, toViewInvoice]);
42769
- const onUpsertInvoicePaymentSuccess = useCallback77((invoice, invoicePayment) => {
43572
+ const onUpsertInvoicePaymentSuccess = useCallback86((invoice, invoicePayment) => {
42770
43573
  addToast({ content: "Invoice paid successfully", type: "success" });
42771
43574
  const updatedInvoice = updateInvoiceWithPayment(invoice, invoicePayment);
42772
43575
  toViewInvoice(updatedInvoice);
42773
43576
  }, [addToast, toViewInvoice]);
42774
- const onSubmit = useCallback77(() => {
43577
+ const onSubmit = useCallback86(() => {
42775
43578
  var _a;
42776
43579
  return void ((_a = formRef.current) == null ? void 0 : _a.submit());
42777
43580
  }, []);
42778
- const [formState, setFormState] = useState89({
43581
+ const [formState, setFormState] = useState91({
42779
43582
  isDirty: false,
42780
43583
  isSubmitting: false
42781
43584
  });
42782
- const onChangeFormState = useCallback77((nextState) => {
43585
+ const onChangeFormState = useCallback86((nextState) => {
42783
43586
  setFormState(nextState);
42784
43587
  }, []);
42785
- const Header6 = useCallback77(() => {
42786
- return /* @__PURE__ */ jsx355(
43588
+ const Header5 = useCallback86(() => {
43589
+ return /* @__PURE__ */ jsx361(
42787
43590
  InvoiceDetailHeader,
42788
43591
  {
42789
43592
  onSubmit,
@@ -42795,17 +43598,17 @@ var InvoiceDetail = () => {
42795
43598
  );
42796
43599
  }, [onSubmit, isReadOnly, formState]);
42797
43600
  const hasChanges = !isReadOnly && formState.isDirty;
42798
- const onGoBack = useCallback77(() => {
43601
+ const onGoBack = useCallback86(() => {
42799
43602
  if (hasChanges) {
42800
43603
  setIsDiscardChangesModalOpen(true);
42801
43604
  } else {
42802
43605
  toInvoiceTable();
42803
43606
  }
42804
43607
  }, [hasChanges, toInvoiceTable]);
42805
- return /* @__PURE__ */ jsxs226(Fragment58, { children: [
42806
- /* @__PURE__ */ jsxs226(BaseDetailView, { slots: { Header: Header6, BackIcon: hasChanges ? X_default : BackArrow_default }, name: "Invoice Detail View", onGoBack, children: [
42807
- viewState.mode === "Update" /* Update */ && /* @__PURE__ */ jsx355(InvoiceDetailSubHeader, { invoice: viewState.invoice }),
42808
- /* @__PURE__ */ jsx355(
43608
+ return /* @__PURE__ */ jsxs228(Fragment60, { children: [
43609
+ /* @__PURE__ */ jsxs228(BaseDetailView, { slots: { Header: Header5, BackIcon: hasChanges ? X_default : BackArrow_default }, name: "Invoice Detail View", onGoBack, children: [
43610
+ viewState.mode === "Update" /* Update */ && /* @__PURE__ */ jsx361(InvoiceDetailSubHeader, { invoice: viewState.invoice }),
43611
+ /* @__PURE__ */ jsx361(
42809
43612
  InvoiceForm,
42810
43613
  {
42811
43614
  isReadOnly,
@@ -42815,7 +43618,7 @@ var InvoiceDetail = () => {
42815
43618
  }
42816
43619
  )
42817
43620
  ] }),
42818
- /* @__PURE__ */ jsx355(
43621
+ /* @__PURE__ */ jsx361(
42819
43622
  BaseConfirmationModal,
42820
43623
  {
42821
43624
  isOpen: isDiscardChangesModalOpen,
@@ -42827,15 +43630,15 @@ var InvoiceDetail = () => {
42827
43630
  cancelLabel: "Keep editing"
42828
43631
  }
42829
43632
  ),
42830
- viewState.mode === "Update" /* Update */ && /* @__PURE__ */ jsx355(Drawer, { isOpen: isPaymentDrawerOpen, onOpenChange: setIsPaymentDrawerOpen, children: ({ close: close2 }) => /* @__PURE__ */ jsxs226(VStack, { pb: "lg", gap: "lg", children: [
42831
- /* @__PURE__ */ jsx355(VStack, { pi: "md", children: /* @__PURE__ */ jsx355(
43633
+ viewState.mode === "Update" /* Update */ && /* @__PURE__ */ jsx361(Drawer, { isOpen: isPaymentDrawerOpen, onOpenChange: setIsPaymentDrawerOpen, children: ({ close: close2 }) => /* @__PURE__ */ jsxs228(VStack, { pb: "lg", gap: "lg", children: [
43634
+ /* @__PURE__ */ jsx361(VStack, { pi: "md", children: /* @__PURE__ */ jsx361(
42832
43635
  ModalTitleWithClose,
42833
43636
  {
42834
- heading: /* @__PURE__ */ jsx355(ModalHeading, { size: "lg", children: "Record invoice payment" }),
43637
+ heading: /* @__PURE__ */ jsx361(ModalHeading, { size: "lg", children: "Record invoice payment" }),
42835
43638
  onClose: close2
42836
43639
  }
42837
43640
  ) }),
42838
- /* @__PURE__ */ jsx355(
43641
+ /* @__PURE__ */ jsx361(
42839
43642
  InvoicePaymentForm,
42840
43643
  {
42841
43644
  onSuccess: (invoicePayment) => {
@@ -42852,73 +43655,60 @@ var InvoiceDetail = () => {
42852
43655
  var InvoiceDetailHeader = ({ onSubmit, formState, isReadOnly, setIsReadOnly, openInvoicePaymentDrawer }) => {
42853
43656
  const viewState = useInvoiceDetail();
42854
43657
  const { isSubmitting } = formState;
42855
- const MenuButton = useCallback77(() => {
42856
- return /* @__PURE__ */ jsx355(Button2, { icon: true, variant: "outlined", children: /* @__PURE__ */ jsx355(MenuIcon, { size: 14 }) });
42857
- }, []);
42858
- const saveButton = useMemo90(() => /* @__PURE__ */ jsxs226(Button2, { isPending: isSubmitting, onPress: onSubmit, children: [
43658
+ const onEditInvoice = useCallback86(() => {
43659
+ setIsReadOnly(false);
43660
+ }, [setIsReadOnly]);
43661
+ const saveButton = useMemo92(() => /* @__PURE__ */ jsxs228(Button2, { isPending: isSubmitting, onPress: onSubmit, children: [
42859
43662
  "Save",
42860
- /* @__PURE__ */ jsx355(Save2, { size: 14 })
43663
+ /* @__PURE__ */ jsx361(Save2, { size: 14 })
42861
43664
  ] }), [isSubmitting, onSubmit]);
42862
43665
  if (viewState.mode === "Create" /* Create */) {
42863
- return /* @__PURE__ */ jsxs226(HStack, { justify: "space-between", align: "center", fluid: true, pie: "md", children: [
42864
- /* @__PURE__ */ jsx355(Heading2, { children: "Create Invoice" }),
43666
+ return /* @__PURE__ */ jsxs228(HStack, { justify: "space-between", align: "center", fluid: true, pie: "md", children: [
43667
+ /* @__PURE__ */ jsx361(Heading2, { children: "Create Invoice" }),
42865
43668
  saveButton
42866
43669
  ] });
42867
43670
  }
42868
43671
  const invoiceNumber = viewState.invoice.invoiceNumber;
42869
43672
  const headingContent = isReadOnly ? invoiceNumber ? `Invoice #${invoiceNumber}` : "View Invoice" : invoiceNumber ? `Editing Invoice #${invoiceNumber}` : "Editing Invoice";
42870
43673
  const canMarkAsPaid = viewState.mode === "Update" /* Update */ && (viewState.invoice.status === "SENT" /* Sent */ || viewState.invoice.status === "PARTIALLY_PAID" /* PartiallyPaid */);
42871
- return /* @__PURE__ */ jsxs226(HStack, { justify: "space-between", align: "center", fluid: true, pie: "md", children: [
42872
- /* @__PURE__ */ jsx355(Heading2, { children: headingContent }),
42873
- isReadOnly ? /* @__PURE__ */ jsxs226(HStack, { gap: "xs", children: [
42874
- canMarkAsPaid && /* @__PURE__ */ jsxs226(Button2, { onPress: openInvoicePaymentDrawer, children: [
43674
+ return /* @__PURE__ */ jsxs228(HStack, { justify: "space-between", align: "center", fluid: true, pie: "md", children: [
43675
+ /* @__PURE__ */ jsx361(Heading2, { children: headingContent }),
43676
+ isReadOnly ? /* @__PURE__ */ jsxs228(HStack, { gap: "xs", children: [
43677
+ canMarkAsPaid && /* @__PURE__ */ jsxs228(Button2, { onPress: openInvoicePaymentDrawer, children: [
42875
43678
  "Mark as paid",
42876
- /* @__PURE__ */ jsx355(HandCoins2, { size: 14 })
43679
+ /* @__PURE__ */ jsx361(HandCoins2, { size: 14 })
42877
43680
  ] }),
42878
- /* @__PURE__ */ jsx355(
42879
- DropdownMenu,
42880
- {
42881
- ariaLabel: "Invoice actions",
42882
- slots: { Trigger: MenuButton },
42883
- slotProps: { Dialog: { width: 280 } },
42884
- children: /* @__PURE__ */ jsx355(MenuList, { children: /* @__PURE__ */ jsxs226(MenuItem3, { onClick: () => {
42885
- setIsReadOnly(false);
42886
- }, children: [
42887
- /* @__PURE__ */ jsx355(SquarePen, { size: 14 }),
42888
- /* @__PURE__ */ jsx355(Span, { size: "sm", children: "Edit invoice" })
42889
- ] }, "edit-invoice") })
42890
- }
42891
- )
43681
+ /* @__PURE__ */ jsx361(InvoiceDetailHeaderMenu, { onEditInvoice })
42892
43682
  ] }) : saveButton
42893
43683
  ] });
42894
43684
  };
42895
43685
  var InvoiceDetailSubHeader = ({ invoice }) => {
42896
43686
  const { outstandingBalance, totalAmount } = invoice;
42897
- return /* @__PURE__ */ jsx355(HStack, { className: "Layer__InvoiceDetail__SubHeader", children: /* @__PURE__ */ jsxs226(HStack, { gap: "5xl", children: [
42898
- /* @__PURE__ */ jsx355(DataPoint, { label: "Balance due", children: /* @__PURE__ */ jsx355(Span, { children: convertCentsToCurrency(outstandingBalance) }) }),
42899
- /* @__PURE__ */ jsx355(DataPoint, { label: "Open balance", children: /* @__PURE__ */ jsx355(Span, { children: convertCentsToCurrency(totalAmount) }) }),
42900
- /* @__PURE__ */ jsx355(DataPoint, { label: "Status", children: /* @__PURE__ */ jsx355(InvoiceStatusCell, { invoice, inline: true }) })
43687
+ return /* @__PURE__ */ jsx361(HStack, { className: "Layer__InvoiceDetail__SubHeader", children: /* @__PURE__ */ jsxs228(HStack, { gap: "5xl", children: [
43688
+ /* @__PURE__ */ jsx361(DataPoint, { label: "Balance due", children: /* @__PURE__ */ jsx361(Span, { children: convertCentsToCurrency(outstandingBalance) }) }),
43689
+ /* @__PURE__ */ jsx361(DataPoint, { label: "Open balance", children: /* @__PURE__ */ jsx361(Span, { children: convertCentsToCurrency(totalAmount) }) }),
43690
+ /* @__PURE__ */ jsx361(DataPoint, { label: "Status", children: /* @__PURE__ */ jsx361(InvoiceStatusCell, { invoice, inline: true }) })
42901
43691
  ] }) });
42902
43692
  };
42903
43693
 
42904
43694
  // src/components/ui/Meter/Meter.tsx
42905
- import { forwardRef as forwardRef27 } from "react";
43695
+ import { forwardRef as forwardRef28 } from "react";
42906
43696
  import { Meter as ReactAriaMeter } from "react-aria-components";
42907
43697
  import classNames95 from "classnames";
42908
- import { jsx as jsx356, jsxs as jsxs227 } from "react/jsx-runtime";
43698
+ import { jsx as jsx362, jsxs as jsxs229 } from "react/jsx-runtime";
42909
43699
  var getClassnameForSubComponent = (className, suffix) => {
42910
43700
  return classNames95(`${METER_CLASS_NAME}__${suffix}`, className && `${className}__${suffix}`);
42911
43701
  };
42912
43702
  var METER_CLASS_NAME = "Layer__Meter";
42913
- var Meter = forwardRef27(
43703
+ var Meter = forwardRef28(
42914
43704
  function Meter2(_a, ref) {
42915
43705
  var _b = _a, { className, label, meterOnly } = _b, restProps = __objRest(_b, ["className", "label", "meterOnly"]);
42916
- return /* @__PURE__ */ jsx356(ReactAriaMeter, __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, restProps), { className: classNames95(METER_CLASS_NAME, className), ref }), meterOnly && { "aria-label": label }), { children: ({ percentage, valueText }) => /* @__PURE__ */ jsxs227(VStack, { gap: "3xs", fluid: true, children: [
42917
- !meterOnly && /* @__PURE__ */ jsxs227(HStack, { justify: "space-between", children: [
42918
- /* @__PURE__ */ jsx356(Label, { slot: "label", children: label }),
42919
- /* @__PURE__ */ jsx356(Span, { slot: "value", children: valueText })
43706
+ return /* @__PURE__ */ jsx362(ReactAriaMeter, __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, restProps), { className: classNames95(METER_CLASS_NAME, className), ref }), meterOnly && { "aria-label": label }), { children: ({ percentage, valueText }) => /* @__PURE__ */ jsxs229(VStack, { gap: "3xs", fluid: true, children: [
43707
+ !meterOnly && /* @__PURE__ */ jsxs229(HStack, { justify: "space-between", children: [
43708
+ /* @__PURE__ */ jsx362(Label, { slot: "label", children: label }),
43709
+ /* @__PURE__ */ jsx362(Span, { slot: "value", children: valueText })
42920
43710
  ] }),
42921
- /* @__PURE__ */ jsx356(HStack, { slot: "bar", children: /* @__PURE__ */ jsxs227(
43711
+ /* @__PURE__ */ jsx362(HStack, { slot: "bar", children: /* @__PURE__ */ jsxs229(
42922
43712
  "svg",
42923
43713
  {
42924
43714
  className: getClassnameForSubComponent(className, "svg"),
@@ -42927,7 +43717,7 @@ var Meter = forwardRef27(
42927
43717
  "aria-hidden": "true",
42928
43718
  focusable: "false",
42929
43719
  children: [
42930
- /* @__PURE__ */ jsx356(
43720
+ /* @__PURE__ */ jsx362(
42931
43721
  "rect",
42932
43722
  {
42933
43723
  className: getClassnameForSubComponent(className, "track"),
@@ -42937,7 +43727,7 @@ var Meter = forwardRef27(
42937
43727
  height: "4"
42938
43728
  }
42939
43729
  ),
42940
- /* @__PURE__ */ jsx356(
43730
+ /* @__PURE__ */ jsx362(
42941
43731
  "rect",
42942
43732
  {
42943
43733
  className: getClassnameForSubComponent(className, "fill"),
@@ -42956,7 +43746,7 @@ var Meter = forwardRef27(
42956
43746
 
42957
43747
  // src/components/Invoices/InvoiceSummaryStats/InvoiceSummaryStats.tsx
42958
43748
  import { BigDecimal as BD9 } from "effect";
42959
- import { jsx as jsx357, jsxs as jsxs228 } from "react/jsx-runtime";
43749
+ import { jsx as jsx363, jsxs as jsxs230 } from "react/jsx-runtime";
42960
43750
  var getPercentageOverdue = (sentTotal, overdueTotal) => {
42961
43751
  if (!sentTotal && !overdueTotal) return 50;
42962
43752
  if (!sentTotal) return 100;
@@ -42975,68 +43765,68 @@ var InvoiceSummaryStats = () => {
42975
43765
  const { overdueCount, overdueTotal, sentCount, sentTotal } = (_b = data == null ? void 0 : data.invoices) != null ? _b : {};
42976
43766
  const invoicesTotal = (overdueTotal || BigInt(0)) + (sentTotal || BigInt(0));
42977
43767
  const percentageOverdue = getPercentageOverdue(sentTotal, overdueTotal);
42978
- return /* @__PURE__ */ jsxs228(HStack, { className: "Layer__InvoiceSummaryStats__Container", gap: "lg", children: [
42979
- /* @__PURE__ */ jsxs228(VStack, { className: "Layer__InvoiceSummaryStats__Payments", gap: "3xs", children: [
42980
- /* @__PURE__ */ jsxs228(HStack, { align: "center", children: [
42981
- /* @__PURE__ */ jsx357(Span, { size: "sm", children: "Paid" }),
43768
+ return /* @__PURE__ */ jsxs230(HStack, { className: "Layer__InvoiceSummaryStats__Container", gap: "lg", children: [
43769
+ /* @__PURE__ */ jsxs230(VStack, { className: "Layer__InvoiceSummaryStats__Payments", gap: "3xs", children: [
43770
+ /* @__PURE__ */ jsxs230(HStack, { align: "center", children: [
43771
+ /* @__PURE__ */ jsx363(Span, { size: "sm", children: "Paid" }),
42982
43772
  "\xA0",
42983
- /* @__PURE__ */ jsx357(Span, { size: "sm", variant: "subtle", children: "last 30 days" })
43773
+ /* @__PURE__ */ jsx363(Span, { size: "sm", variant: "subtle", children: "last 30 days" })
42984
43774
  ] }),
42985
- /* @__PURE__ */ jsxs228(HStack, { align: "center", gap: "xs", children: [
42986
- /* @__PURE__ */ jsx357(Badge, { variant: "success" /* SUCCESS */, size: "xs" /* EXTRA_SMALL */, icon: /* @__PURE__ */ jsx357(Check_default, { size: 11 }), iconOnly: true }),
42987
- /* @__PURE__ */ jsx357(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "24px", width: "120px", children: /* @__PURE__ */ jsx357(Span, { size: "xl", children: invoicePaymentsTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(invoicePaymentsTotal), { mode: "currency" }) }) })
43775
+ /* @__PURE__ */ jsxs230(HStack, { align: "center", gap: "xs", children: [
43776
+ /* @__PURE__ */ jsx363(Badge, { variant: "success" /* SUCCESS */, size: "xs" /* EXTRA_SMALL */, icon: /* @__PURE__ */ jsx363(Check_default, { size: 11 }), iconOnly: true }),
43777
+ /* @__PURE__ */ jsx363(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "24px", width: "120px", children: /* @__PURE__ */ jsx363(Span, { size: "xl", children: invoicePaymentsTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(invoicePaymentsTotal), { mode: "currency" }) }) })
42988
43778
  ] })
42989
43779
  ] }),
42990
- /* @__PURE__ */ jsxs228(VStack, { gap: "sm", fluid: true, children: [
42991
- /* @__PURE__ */ jsxs228(HStack, { gap: "md", align: "end", children: [
42992
- /* @__PURE__ */ jsxs228(HStack, { align: "center", children: [
42993
- /* @__PURE__ */ jsx357(Span, { size: "sm", pbe: "3xs", children: "Owed to you" }),
43780
+ /* @__PURE__ */ jsxs230(VStack, { gap: "sm", fluid: true, children: [
43781
+ /* @__PURE__ */ jsxs230(HStack, { gap: "md", align: "end", children: [
43782
+ /* @__PURE__ */ jsxs230(HStack, { align: "center", children: [
43783
+ /* @__PURE__ */ jsx363(Span, { size: "sm", pbe: "3xs", children: "Owed to you" }),
42994
43784
  "\xA0",
42995
- /* @__PURE__ */ jsx357(Span, { size: "sm", pbe: "3xs", variant: "subtle", children: "last 12 months" })
43785
+ /* @__PURE__ */ jsx363(Span, { size: "sm", pbe: "3xs", variant: "subtle", children: "last 12 months" })
42996
43786
  ] }),
42997
- /* @__PURE__ */ jsx357(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "24px", width: "120px", children: /* @__PURE__ */ jsx357(Span, { size: "xl", children: invoicesTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(invoicesTotal), { mode: "currency" }) }) })
43787
+ /* @__PURE__ */ jsx363(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "24px", width: "120px", children: /* @__PURE__ */ jsx363(Span, { size: "xl", children: invoicesTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(invoicesTotal), { mode: "currency" }) }) })
42998
43788
  ] }),
42999
- /* @__PURE__ */ jsxs228(HStack, { justify: "space-between", children: [
43000
- /* @__PURE__ */ jsxs228(HStack, { gap: "xs", align: "center", children: [
43001
- /* @__PURE__ */ jsx357(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "17px", width: "80px", children: /* @__PURE__ */ jsx357(Span, { size: "md", children: overdueTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(overdueTotal), { mode: "currency" }) }) }),
43002
- !showSkeleton && overdueCount !== void 0 ? /* @__PURE__ */ jsx357(Badge, { variant: "warning" /* WARNING */, size: "small" /* SMALL */, children: `Overdue invoices: ${overdueCount}` }) : /* @__PURE__ */ jsx357(BadgeLoader, { variant: "warning" /* WARNING */, showLoading: true })
43789
+ /* @__PURE__ */ jsxs230(HStack, { justify: "space-between", children: [
43790
+ /* @__PURE__ */ jsxs230(HStack, { gap: "xs", align: "center", children: [
43791
+ /* @__PURE__ */ jsx363(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "17px", width: "80px", children: /* @__PURE__ */ jsx363(Span, { size: "md", children: overdueTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(overdueTotal), { mode: "currency" }) }) }),
43792
+ !showSkeleton && overdueCount !== void 0 ? /* @__PURE__ */ jsx363(Badge, { variant: "warning" /* WARNING */, size: "small" /* SMALL */, children: `Overdue invoices: ${overdueCount}` }) : /* @__PURE__ */ jsx363(BadgeLoader, { variant: "warning" /* WARNING */, showLoading: true })
43003
43793
  ] }),
43004
- /* @__PURE__ */ jsxs228(HStack, { gap: "xs", align: "center", children: [
43005
- !showSkeleton && sentCount !== void 0 ? /* @__PURE__ */ jsx357(Badge, { variant: "info" /* INFO */, size: "small" /* SMALL */, children: `Upcoming invoices: ${sentCount}` }) : /* @__PURE__ */ jsx357(BadgeLoader, { variant: "info" /* INFO */, showLoading: true }),
43006
- /* @__PURE__ */ jsx357(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "17px", width: "80px", children: /* @__PURE__ */ jsx357(Span, { size: "md", children: sentTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(sentTotal), { mode: "currency" }) }) })
43794
+ /* @__PURE__ */ jsxs230(HStack, { gap: "xs", align: "center", children: [
43795
+ !showSkeleton && sentCount !== void 0 ? /* @__PURE__ */ jsx363(Badge, { variant: "info" /* INFO */, size: "small" /* SMALL */, children: `Upcoming invoices: ${sentCount}` }) : /* @__PURE__ */ jsx363(BadgeLoader, { variant: "info" /* INFO */, showLoading: true }),
43796
+ /* @__PURE__ */ jsx363(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "17px", width: "80px", children: /* @__PURE__ */ jsx363(Span, { size: "md", children: sentTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(sentTotal), { mode: "currency" }) }) })
43007
43797
  ] })
43008
43798
  ] }),
43009
- /* @__PURE__ */ jsx357(Meter, { label: "Invoices meter", minValue: 0, maxValue: 100, value: percentageOverdue, meterOnly: true, className: "Layer__InvoiceSummaryStats__Meter" })
43799
+ /* @__PURE__ */ jsx363(Meter, { label: "Invoices meter", minValue: 0, maxValue: 100, value: percentageOverdue, meterOnly: true, className: "Layer__InvoiceSummaryStats__Meter" })
43010
43800
  ] })
43011
43801
  ] });
43012
43802
  };
43013
43803
 
43014
43804
  // src/components/Invoices/InvoiceOverview/InvoiceOverview.tsx
43015
- import { jsx as jsx358, jsxs as jsxs229 } from "react/jsx-runtime";
43805
+ import { jsx as jsx364, jsxs as jsxs231 } from "react/jsx-runtime";
43016
43806
  var InvoiceOverview = () => {
43017
- return /* @__PURE__ */ jsxs229(VStack, { children: [
43018
- /* @__PURE__ */ jsx358(InvoiceSummaryStats, {}),
43019
- /* @__PURE__ */ jsx358(InvoiceTable, {})
43807
+ return /* @__PURE__ */ jsxs231(VStack, { children: [
43808
+ /* @__PURE__ */ jsx364(InvoiceSummaryStats, {}),
43809
+ /* @__PURE__ */ jsx364(InvoiceTable, {})
43020
43810
  ] });
43021
43811
  };
43022
43812
 
43023
43813
  // src/components/Invoices/Invoices.tsx
43024
- import { jsx as jsx359 } from "react/jsx-runtime";
43814
+ import { jsx as jsx365 } from "react/jsx-runtime";
43025
43815
  var unstable_Invoices = ({ showTitle = true, stringOverrides }) => {
43026
- return /* @__PURE__ */ jsx359(InvoiceStoreProvider, { children: /* @__PURE__ */ jsx359(View, { title: (stringOverrides == null ? void 0 : stringOverrides.title) || "Invoices", showHeader: showTitle, children: /* @__PURE__ */ jsx359(InvoicesContent, {}) }) });
43816
+ return /* @__PURE__ */ jsx365(InvoiceStoreProvider, { children: /* @__PURE__ */ jsx365(View, { title: (stringOverrides == null ? void 0 : stringOverrides.title) || "Invoices", showHeader: showTitle, children: /* @__PURE__ */ jsx365(InvoicesContent, {}) }) });
43027
43817
  };
43028
43818
  var InvoicesContent = () => {
43029
43819
  const routeState = useInvoiceRouteState();
43030
- return routeState.route === "Detail" /* Detail */ ? /* @__PURE__ */ jsx359(InvoiceDetail, {}) : /* @__PURE__ */ jsx359(InvoiceOverview, {});
43820
+ return routeState.route === "Detail" /* Detail */ ? /* @__PURE__ */ jsx365(InvoiceDetail, {}) : /* @__PURE__ */ jsx365(InvoiceOverview, {});
43031
43821
  };
43032
43822
 
43033
43823
  // src/providers/BankTransactionsProvider/BankTransactionsProvider.tsx
43034
- import { jsx as jsx360 } from "react/jsx-runtime";
43824
+ import { jsx as jsx366 } from "react/jsx-runtime";
43035
43825
  var BankTransactionsProvider = ({
43036
43826
  children
43037
43827
  }) => {
43038
43828
  const bankTransactionsContextData = useAugmentedBankTransactions();
43039
- return /* @__PURE__ */ jsx360(BankTransactionsContext.Provider, { value: bankTransactionsContextData, children });
43829
+ return /* @__PURE__ */ jsx366(BankTransactionsContext.Provider, { value: bankTransactionsContextData, children });
43040
43830
  };
43041
43831
  export {
43042
43832
  AccountingOverview,