@layerfi/components 0.1.97 → 0.1.98-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.
@@ -5601,7 +5601,7 @@ var import_react16 = require("react");
5601
5601
  var import_react14 = require("react");
5602
5602
 
5603
5603
  // package.json
5604
- var version = "0.1.97";
5604
+ var version = "0.1.98-alpha";
5605
5605
 
5606
5606
  // src/models/APIError.ts
5607
5607
  var APIError = class _APIError extends Error {
@@ -5674,7 +5674,7 @@ var postWithFormData = (url, formData, baseUrl, accessToken) => {
5674
5674
  body: formData
5675
5675
  }).then((res) => handleResponse(res)).catch((error) => handleException(error));
5676
5676
  };
5677
- var handleResponse = (res) => __async(void 0, null, function* () {
5677
+ var handleResponse = (res) => __async(null, null, function* () {
5678
5678
  var _a;
5679
5679
  if (!res.ok) {
5680
5680
  const errors = yield tryToReadErrorsFromResponse(res);
@@ -5715,7 +5715,7 @@ var handleException = (error) => {
5715
5715
  });
5716
5716
  throw apiError;
5717
5717
  };
5718
- var tryToReadErrorsFromResponse = (res) => __async(void 0, null, function* () {
5718
+ var tryToReadErrorsFromResponse = (res) => __async(null, null, function* () {
5719
5719
  var _a;
5720
5720
  try {
5721
5721
  const data = yield res == null ? void 0 : res.json();
@@ -5906,6 +5906,9 @@ var createAccount = post(
5906
5906
  var updateAccount = put(
5907
5907
  ({ businessId, accountId }) => `/v1/businesses/${businessId}/ledger/accounts/${accountId}`
5908
5908
  );
5909
+ var createChildAccount = post(
5910
+ ({ businessId, accountId }) => `/v1/businesses/${businessId}/ledger/accounts/${accountId}/create-child-account`
5911
+ );
5909
5912
  var getLedgerAccountsLines = get(
5910
5913
  ({ businessId, accountId, includeReversals }) => `/v1/businesses/${businessId}/ledger/accounts/${accountId}/lines${includeReversals === "true" ? "?include_reversals=true" : ""}`
5911
5914
  );
@@ -6040,6 +6043,7 @@ var Layer = {
6040
6043
  matchBankTransaction,
6041
6044
  createAccount,
6042
6045
  updateAccount,
6046
+ createChildAccount,
6043
6047
  getBalanceSheet,
6044
6048
  getBalanceSheetCSV,
6045
6049
  getBalanceSheetExcel,
@@ -6198,7 +6202,6 @@ var import_react4 = require("react");
6198
6202
  var LayerContext = (0, import_react4.createContext)({
6199
6203
  businessId: "",
6200
6204
  business: void 0,
6201
- categories: [],
6202
6205
  theme: void 0,
6203
6206
  colors: {},
6204
6207
  setTheme: () => void 0,
@@ -7067,7 +7070,7 @@ var useLinkedAccounts = () => {
7067
7070
  setLoadingStatus("complete");
7068
7071
  }
7069
7072
  }, [isLoading]);
7070
- const fetchPlaidLinkToken = () => __async(void 0, null, function* () {
7073
+ const fetchPlaidLinkToken = () => __async(null, null, function* () {
7071
7074
  if (auth == null ? void 0 : auth.access_token) {
7072
7075
  const linkToken2 = (yield Layer.getPlaidLinkToken(apiUrl, auth.access_token, {
7073
7076
  params: { businessId }
@@ -7076,7 +7079,7 @@ var useLinkedAccounts = () => {
7076
7079
  setLinkToken(linkToken2);
7077
7080
  }
7078
7081
  });
7079
- const fetchPlaidUpdateModeLinkToken = (plaidItemPlaidId) => __async(void 0, null, function* () {
7082
+ const fetchPlaidUpdateModeLinkToken = (plaidItemPlaidId) => __async(null, null, function* () {
7080
7083
  if (auth == null ? void 0 : auth.access_token) {
7081
7084
  const linkToken2 = (yield Layer.getPlaidUpdateModeLinkToken(apiUrl, auth.access_token, {
7082
7085
  params: { businessId },
@@ -7086,7 +7089,7 @@ var useLinkedAccounts = () => {
7086
7089
  setLinkToken(linkToken2);
7087
7090
  }
7088
7091
  });
7089
- const exchangePlaidPublicToken2 = (publicToken, metadata) => __async(void 0, null, function* () {
7092
+ const exchangePlaidPublicToken2 = (publicToken, metadata) => __async(null, null, function* () {
7090
7093
  preloadAccountConfirmation();
7091
7094
  try {
7092
7095
  yield Layer.exchangePlaidPublicToken(apiUrl, auth == null ? void 0 : auth.access_token, {
@@ -7102,7 +7105,7 @@ var useLinkedAccounts = () => {
7102
7105
  token: linkToken,
7103
7106
  // If in update mode, we don't need to exchange the public token for an access token.
7104
7107
  // The existing access token will automatically become valid again
7105
- onSuccess: (publicToken, metadata) => __async(void 0, null, function* () {
7108
+ onSuccess: (publicToken, metadata) => __async(null, null, function* () {
7106
7109
  if (linkMode == "add") {
7107
7110
  exchangePlaidPublicToken2(publicToken, metadata);
7108
7111
  } else {
@@ -7134,7 +7137,7 @@ var useLinkedAccounts = () => {
7134
7137
  );
7135
7138
  }
7136
7139
  };
7137
- const repairConnection = (source, connectionExternalId) => __async(void 0, null, function* () {
7140
+ const repairConnection = (source, connectionExternalId) => __async(null, null, function* () {
7138
7141
  if (source === "PLAID") {
7139
7142
  yield fetchPlaidUpdateModeLinkToken(connectionExternalId);
7140
7143
  } else {
@@ -7143,7 +7146,7 @@ var useLinkedAccounts = () => {
7143
7146
  );
7144
7147
  }
7145
7148
  });
7146
- const removeConnection = (source, connectionExternalId) => __async(void 0, null, function* () {
7149
+ const removeConnection = (source, connectionExternalId) => __async(null, null, function* () {
7147
7150
  if (source === "PLAID") {
7148
7151
  yield unlinkPlaidItem2(connectionExternalId);
7149
7152
  yield refetchAccounts();
@@ -7153,7 +7156,7 @@ var useLinkedAccounts = () => {
7153
7156
  );
7154
7157
  }
7155
7158
  });
7156
- const unlinkAccount2 = (source, accountId) => __async(void 0, null, function* () {
7159
+ const unlinkAccount2 = (source, accountId) => __async(null, null, function* () {
7157
7160
  DEBUG && console.debug("unlinking account");
7158
7161
  if (source === "PLAID") {
7159
7162
  yield Layer.unlinkAccount(apiUrl, auth == null ? void 0 : auth.access_token, {
@@ -7167,7 +7170,7 @@ var useLinkedAccounts = () => {
7167
7170
  );
7168
7171
  }
7169
7172
  });
7170
- const confirmAccount2 = (source, accountId) => __async(void 0, null, function* () {
7173
+ const confirmAccount2 = (source, accountId) => __async(null, null, function* () {
7171
7174
  DEBUG && console.debug("confirming account");
7172
7175
  if (source === "PLAID") {
7173
7176
  yield Layer.confirmAccount(apiUrl, auth == null ? void 0 : auth.access_token, {
@@ -7184,7 +7187,7 @@ var useLinkedAccounts = () => {
7184
7187
  );
7185
7188
  }
7186
7189
  });
7187
- const excludeAccount2 = (source, accountId) => __async(void 0, null, function* () {
7190
+ const excludeAccount2 = (source, accountId) => __async(null, null, function* () {
7188
7191
  DEBUG && console.debug("excluding account");
7189
7192
  if (source === "PLAID") {
7190
7193
  yield Layer.excludeAccount(apiUrl, auth == null ? void 0 : auth.access_token, {
@@ -7204,7 +7207,7 @@ var useLinkedAccounts = () => {
7204
7207
  );
7205
7208
  }
7206
7209
  });
7207
- const breakConnection = (source, connectionExternalId) => __async(void 0, null, function* () {
7210
+ const breakConnection = (source, connectionExternalId) => __async(null, null, function* () {
7208
7211
  DEBUG && console.debug("Breaking sandbox plaid item connection");
7209
7212
  if (source === "PLAID") {
7210
7213
  yield Layer.breakPlaidItemConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
@@ -7221,23 +7224,23 @@ var useLinkedAccounts = () => {
7221
7224
  );
7222
7225
  }
7223
7226
  });
7224
- const refetchAccounts = () => __async(void 0, null, function* () {
7227
+ const refetchAccounts = () => __async(null, null, function* () {
7225
7228
  DEBUG && console.debug("refetching accounts...");
7226
7229
  yield mutate();
7227
7230
  });
7228
- const syncAccounts = () => __async(void 0, null, function* () {
7231
+ const syncAccounts = () => __async(null, null, function* () {
7229
7232
  DEBUG && console.debug("resyncing accounts...");
7230
7233
  yield Layer.syncConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
7231
7234
  params: { businessId }
7232
7235
  });
7233
7236
  });
7234
- const updateConnectionStatus2 = () => __async(void 0, null, function* () {
7237
+ const updateConnectionStatus2 = () => __async(null, null, function* () {
7235
7238
  DEBUG && console.debug("updating connection status...");
7236
7239
  yield Layer.updateConnectionStatus(apiUrl, auth == null ? void 0 : auth.access_token, {
7237
7240
  params: { businessId }
7238
7241
  });
7239
7242
  });
7240
- const unlinkPlaidItem2 = (plaidItemPlaidId) => __async(void 0, null, function* () {
7243
+ const unlinkPlaidItem2 = (plaidItemPlaidId) => __async(null, null, function* () {
7241
7244
  DEBUG && console.debug("unlinking plaid item");
7242
7245
  yield Layer.unlinkPlaidItem(apiUrl, auth == null ? void 0 : auth.access_token, {
7243
7246
  params: { businessId, plaidItemPlaidId }
@@ -7810,7 +7813,6 @@ var import_jsx_runtime8 = require("react/jsx-runtime");
7810
7813
  var reducer = (state, action) => {
7811
7814
  switch (action.type) {
7812
7815
  case "LayerContext.setBusiness" /* setBusiness */:
7813
- case "LayerContext.setCategories" /* setCategories */:
7814
7816
  case "LayerContext.setTheme" /* setTheme */:
7815
7817
  case "LayerContext.setOnboardingStep" /* setOnboardingStep */:
7816
7818
  case "LayerContext.setColors" /* setColors */:
@@ -7848,7 +7850,6 @@ var BusinessProvider = ({
7848
7850
  const [state, dispatch] = (0, import_react14.useReducer)(reducer, {
7849
7851
  businessId,
7850
7852
  business: void 0,
7851
- categories: [],
7852
7853
  theme,
7853
7854
  colors,
7854
7855
  onboardingStep: void 0,
@@ -7865,33 +7866,6 @@ var BusinessProvider = ({
7865
7866
  } = useDataSync();
7866
7867
  const { apiUrl } = useEnvironment();
7867
7868
  const { data: auth } = useAuth();
7868
- const { data: categoriesData } = (0, import_swr3.default)(
7869
- businessId && (auth == null ? void 0 : auth.access_token) && `categories-${businessId}`,
7870
- Layer.getCategories(apiUrl, auth == null ? void 0 : auth.access_token, {
7871
- params: { businessId }
7872
- }),
7873
- __spreadProps(__spreadValues({}, DEFAULT_SWR_CONFIG), {
7874
- provider: () => /* @__PURE__ */ new Map(),
7875
- onSuccess: (response) => {
7876
- var _a, _b;
7877
- if ((_b = (_a = response == null ? void 0 : response.data) == null ? void 0 : _a.categories) == null ? void 0 : _b.length) {
7878
- dispatch({
7879
- type: "LayerContext.setCategories" /* setCategories */,
7880
- payload: { categories: response.data.categories || [] }
7881
- });
7882
- }
7883
- }
7884
- })
7885
- );
7886
- (0, import_react14.useEffect)(() => {
7887
- var _a, _b;
7888
- if ((_b = (_a = categoriesData == null ? void 0 : categoriesData.data) == null ? void 0 : _a.categories) == null ? void 0 : _b.length) {
7889
- dispatch({
7890
- type: "LayerContext.setCategories" /* setCategories */,
7891
- payload: { categories: categoriesData.data.categories || [] }
7892
- });
7893
- }
7894
- }, [categoriesData]);
7895
7869
  const { data: businessData } = (0, import_swr3.default)(
7896
7870
  businessId && (auth == null ? void 0 : auth.access_token) && `business-${businessId}`,
7897
7871
  Layer.getBusiness(apiUrl, auth == null ? void 0 : auth.access_token, {
@@ -10986,7 +10960,6 @@ function LinkedAccountPill({ label, items }) {
10986
10960
  {
10987
10961
  status: "error",
10988
10962
  onPress: () => setIsOpen(true),
10989
- onHoverStart: () => setIsOpen(true),
10990
10963
  children: [
10991
10964
  /* @__PURE__ */ (0, import_jsx_runtime64.jsx)(AlertCircle_default, { size: 14 }),
10992
10965
  label
@@ -11049,13 +11022,13 @@ var LinkedAccountItemThumb = ({
11049
11022
  config: [
11050
11023
  {
11051
11024
  name: "Mark as a duplicate account",
11052
- action: () => __async(void 0, null, function* () {
11025
+ action: () => __async(null, null, function* () {
11053
11026
  yield excludeAccount2(account.external_account_source, account.id);
11054
11027
  })
11055
11028
  },
11056
11029
  {
11057
11030
  name: "Mark as not a duplicate account",
11058
- action: () => __async(void 0, null, function* () {
11031
+ action: () => __async(null, null, function* () {
11059
11032
  yield confirmAccount2(account.external_account_source, account.id);
11060
11033
  })
11061
11034
  }
@@ -11067,7 +11040,7 @@ var LinkedAccountItemThumb = ({
11067
11040
  config: [
11068
11041
  {
11069
11042
  name: "Repair connection",
11070
- action: () => __async(void 0, null, function* () {
11043
+ action: () => __async(null, null, function* () {
11071
11044
  if (account.connection_external_id) {
11072
11045
  yield repairConnection(
11073
11046
  account.external_account_source,
@@ -11082,7 +11055,7 @@ var LinkedAccountItemThumb = ({
11082
11055
  const additionalConfigs = [
11083
11056
  {
11084
11057
  name: "Unlink account",
11085
- action: () => __async(void 0, null, function* () {
11058
+ action: () => __async(null, null, function* () {
11086
11059
  if (confirm("Please confirm you wish to remove this financial account")) {
11087
11060
  yield unlinkAccount2(account.external_account_source, account.id);
11088
11061
  }
@@ -11092,7 +11065,7 @@ var LinkedAccountItemThumb = ({
11092
11065
  if (showUnlinkItem) {
11093
11066
  additionalConfigs.push({
11094
11067
  name: `Unlink all accounts under this ${(_a = account.institution) == null ? void 0 : _a.name} connection`,
11095
- action: () => __async(void 0, null, function* () {
11068
+ action: () => __async(null, null, function* () {
11096
11069
  var _a2;
11097
11070
  if (account.connection_external_id && confirm(
11098
11071
  `Please confirm you wish to remove all accounts belonging to ${((_a2 = account.institution) == null ? void 0 : _a2.name) || "this institution"}`
@@ -11116,7 +11089,7 @@ var LinkedAccountItemThumb = ({
11116
11089
  if (environment === "staging" && !account.connection_needs_repair_as_of && account.external_account_source === "PLAID" && showBreakConnection) {
11117
11090
  additionalConfigs.push({
11118
11091
  name: "Break connection (test utility)",
11119
- action: () => __async(void 0, null, function* () {
11092
+ action: () => __async(null, null, function* () {
11120
11093
  if (account.connection_external_id) {
11121
11094
  yield breakConnection(
11122
11095
  account.external_account_source,
@@ -11300,35 +11273,34 @@ function ModalContextBar({ onClose }) {
11300
11273
  Button2,
11301
11274
  {
11302
11275
  icon: true,
11276
+ size: "sm",
11303
11277
  variant: "ghost",
11304
11278
  slot: "close",
11305
11279
  onPress: onClose,
11306
11280
  "aria-label": "Close Modal",
11307
- children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_lucide_react2.X, {})
11281
+ children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(import_lucide_react2.X, { size: 24 })
11308
11282
  }
11309
11283
  ) });
11310
11284
  }
11311
- var ModalHeading = (0, import_react39.forwardRef)(
11312
- (props, ref) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
11285
+ var ModalHeading = (0, import_react39.forwardRef)(function ModalHeading2(props, ref) {
11286
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
11313
11287
  Heading2,
11314
11288
  __spreadProps(__spreadValues({}, props), {
11315
11289
  slot: "title",
11316
11290
  level: 2,
11317
11291
  ref
11318
11292
  })
11319
- )
11320
- );
11321
- ModalHeading.displayName = "ModalHeading";
11322
- var ModalDescription = (0, import_react39.forwardRef)(
11323
- (props, ref) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
11293
+ );
11294
+ });
11295
+ var ModalDescription = (0, import_react39.forwardRef)(function ModalDescription2(props, ref) {
11296
+ return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
11324
11297
  P,
11325
11298
  __spreadProps(__spreadValues({}, props), {
11326
11299
  slot: "description",
11327
11300
  ref
11328
11301
  })
11329
- )
11330
- );
11331
- ModalDescription.displayName = "ModalDescription";
11302
+ );
11303
+ });
11332
11304
  var MODAL_CONTENT_CLASS_NAME = "Layer__ModalContent";
11333
11305
  function ModalContent({ children }) {
11334
11306
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)("div", { className: MODAL_CONTENT_CLASS_NAME, children });
@@ -11570,8 +11542,9 @@ function useLinkedAccountsConfirmationModal() {
11570
11542
  visibility,
11571
11543
  actions: { dismiss: dismissAccountConfirmation, reset: resetAccountConfirmation }
11572
11544
  } = useAccountConfirmationStore();
11573
- const preloadIsOpen = visibility === "PRELOADED";
11574
- const mainIsOpen = accountsNeedingConfirmation.length > 0;
11545
+ const isDismissed = visibility === "DISMISSED";
11546
+ const preloadIsOpen = !isDismissed && visibility === "PRELOADED";
11547
+ const mainIsOpen = !isDismissed && accountsNeedingConfirmation.length > 0;
11575
11548
  const baseInfo = {
11576
11549
  accounts: accountsNeedingConfirmation,
11577
11550
  onDismiss: dismissAccountConfirmation,
@@ -11612,16 +11585,13 @@ function LinkedAccountsConfirmationModalContent({ onClose }) {
11612
11585
  ));
11613
11586
  const { trigger, isMutating, error } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
11614
11587
  const hasError = Boolean(error);
11615
- const handleFinish = () => __async(this, null, function* () {
11588
+ const handleFinish = () => __async(null, null, function* () {
11616
11589
  const success = yield trigger(formState);
11617
11590
  if (success) {
11618
11591
  onFinish();
11619
11592
  onClose();
11620
11593
  }
11621
11594
  });
11622
- const handleDismiss = () => {
11623
- onClose();
11624
- };
11625
11595
  const { descriptionLabel, buttonLabel } = getFormComponentLabels(formState);
11626
11596
  return /* @__PURE__ */ (0, import_jsx_runtime76.jsxs)(import_jsx_runtime76.Fragment, { children: [
11627
11597
  /* @__PURE__ */ (0, import_jsx_runtime76.jsx)(ModalContextBar, { onClose }),
@@ -12883,7 +12853,7 @@ function LinkedAccountsOpeningBalanceModalContent({
12883
12853
  };
12884
12854
  }),
12885
12855
  {
12886
- onSuccess: (responses) => __async(this, null, function* () {
12856
+ onSuccess: (responses) => __async(null, null, function* () {
12887
12857
  const newResults = __spreadValues({}, results);
12888
12858
  responses.forEach((r) => {
12889
12859
  newResults[r.accountId] = r;
@@ -13563,6 +13533,46 @@ var getAssignedValue = (bankTransaction) => {
13563
13533
  return;
13564
13534
  };
13565
13535
 
13536
+ // src/hooks/categories/useCategories.ts
13537
+ var import_swr5 = __toESM(require("swr"));
13538
+ var CATEGORIES_TAG_KEY = "#categories";
13539
+ function buildKey4({
13540
+ access_token: accessToken,
13541
+ apiUrl,
13542
+ businessId,
13543
+ mode
13544
+ }) {
13545
+ if (accessToken && apiUrl) {
13546
+ return {
13547
+ accessToken,
13548
+ apiUrl,
13549
+ businessId,
13550
+ mode,
13551
+ tags: [CATEGORIES_TAG_KEY]
13552
+ };
13553
+ }
13554
+ }
13555
+ function useCategories({ mode } = {}) {
13556
+ const { data: auth } = useAuth();
13557
+ const { businessId } = useLayerContext();
13558
+ return (0, import_swr5.default)(
13559
+ () => buildKey4(__spreadProps(__spreadValues({}, auth), {
13560
+ businessId,
13561
+ mode
13562
+ })),
13563
+ ({ accessToken, apiUrl, businessId: businessId2, mode: mode2 }) => getCategories(
13564
+ apiUrl,
13565
+ accessToken,
13566
+ {
13567
+ params: {
13568
+ businessId: businessId2,
13569
+ mode: mode2
13570
+ }
13571
+ }
13572
+ )().then(({ data }) => data.categories)
13573
+ );
13574
+ }
13575
+
13566
13576
  // src/components/BankTransactionMobileList/BusinessCategories.tsx
13567
13577
  var import_jsx_runtime100 = require("react/jsx-runtime");
13568
13578
  var BusinessCategories = ({
@@ -13570,9 +13580,9 @@ var BusinessCategories = ({
13570
13580
  selectedId,
13571
13581
  showTooltips
13572
13582
  }) => {
13573
- const { categories } = useLayerContext();
13583
+ const { data: categories } = useCategories();
13574
13584
  const categoryOptions = flattenCategories(
13575
- categories.filter((category) => category.type != "ExclusionNested")
13585
+ (categories != null ? categories : []).filter((category) => category.type != "ExclusionNested")
13576
13586
  );
13577
13587
  const [optionsToShow, setOptionsToShow] = (0, import_react52.useState)(categoryOptions);
13578
13588
  const [selectedGroup, setSelectedGroup] = (0, import_react52.useState)();
@@ -13822,7 +13832,7 @@ var CategorySelect = ({
13822
13832
  asDrawer = false
13823
13833
  }) => {
13824
13834
  var _a;
13825
- const { categories } = useLayerContext();
13835
+ const { data: categories } = useCategories();
13826
13836
  const matchOptions = !excludeMatches && (bankTransaction == null ? void 0 : bankTransaction.suggested_matches) ? [
13827
13837
  {
13828
13838
  label: "Match",
@@ -13849,7 +13859,7 @@ var CategorySelect = ({
13849
13859
  )
13850
13860
  }
13851
13861
  ] : [];
13852
- const categoryOptions = flattenCategories2(categories);
13862
+ const categoryOptions = flattenCategories2(categories != null ? categories : []);
13853
13863
  const options = [
13854
13864
  ...matchOptions,
13855
13865
  ...suggestedOptions,
@@ -14070,7 +14080,7 @@ var useReceipts = ({
14070
14080
  void fetchDocuments();
14071
14081
  }
14072
14082
  }, [isActive]);
14073
- const fetchDocuments = () => __async(void 0, null, function* () {
14083
+ const fetchDocuments = () => __async(null, null, function* () {
14074
14084
  const listBankTransactionDocuments2 = Layer.listBankTransactionDocuments(
14075
14085
  apiUrl,
14076
14086
  auth == null ? void 0 : auth.access_token,
@@ -14092,7 +14102,7 @@ var useReceipts = ({
14092
14102
  }));
14093
14103
  setReceiptUrls(retrievedDocs);
14094
14104
  });
14095
- const uploadReceipt = (file) => __async(void 0, null, function* () {
14105
+ const uploadReceipt = (file) => __async(null, null, function* () {
14096
14106
  var _a;
14097
14107
  const id = (/* @__PURE__ */ new Date()).valueOf().toString();
14098
14108
  const receipts = [
@@ -14137,7 +14147,7 @@ var useReceipts = ({
14137
14147
  setReceiptUrls(newReceiptUrls);
14138
14148
  }
14139
14149
  });
14140
- const archiveDocument = (document2) => __async(void 0, null, function* () {
14150
+ const archiveDocument = (document2) => __async(null, null, function* () {
14141
14151
  if (!document2.id) return;
14142
14152
  try {
14143
14153
  if (document2.error) {
@@ -14412,7 +14422,7 @@ var BankTransactionReceipts = (0, import_react56.forwardRef)(
14412
14422
  BankTransactionReceipts.displayName = "BankTransactionReceipts";
14413
14423
 
14414
14424
  // src/hooks/bookkeeping/useBookkeepingStatus.ts
14415
- var import_swr5 = __toESM(require("swr"));
14425
+ var import_swr6 = __toESM(require("swr"));
14416
14426
 
14417
14427
  // src/providers/LegacyModeProvider/LegacyModeProvider.tsx
14418
14428
  var import_react57 = require("react");
@@ -14449,7 +14459,7 @@ var getBookkeepingStatus = get(({ businessId }) => {
14449
14459
  });
14450
14460
  var BOOKKEEPING_TAG_KEY = "#bookkeeping";
14451
14461
  var BOOKKEEPING_STATUS_TAG_KEY = "#bookkeeping-status";
14452
- function buildKey4({
14462
+ function buildKey5({
14453
14463
  access_token: accessToken,
14454
14464
  apiUrl,
14455
14465
  businessId
@@ -14466,8 +14476,8 @@ function buildKey4({
14466
14476
  function useBookkeepingStatus() {
14467
14477
  const { data: auth } = useAuth();
14468
14478
  const { businessId } = useLayerContext();
14469
- return (0, import_swr5.default)(
14470
- () => buildKey4(__spreadProps(__spreadValues({}, auth), {
14479
+ return (0, import_swr6.default)(
14480
+ () => buildKey5(__spreadProps(__spreadValues({}, auth), {
14471
14481
  businessId
14472
14482
  })),
14473
14483
  ({ accessToken, apiUrl, businessId: businessId2 }) => getBookkeepingStatus(
@@ -15034,9 +15044,9 @@ var Textarea = (_a) => {
15034
15044
  var import_react_form = require("@tanstack/react-form");
15035
15045
 
15036
15046
  // src/hooks/useBankTransactions/useBankTransactionsMetadata.ts
15037
- var import_swr6 = __toESM(require("swr"));
15047
+ var import_swr7 = __toESM(require("swr"));
15038
15048
  var GET_BANK_TRANSACTION_METADATA_TAG_KEY = "#bank-transaction-metadata";
15039
- function buildKey5({
15049
+ function buildKey6({
15040
15050
  access_token: accessToken,
15041
15051
  apiUrl,
15042
15052
  businessId,
@@ -15055,8 +15065,8 @@ function buildKey5({
15055
15065
  function useBankTransactionMetadata({ bankTransactionId }) {
15056
15066
  const { data: auth } = useAuth();
15057
15067
  const { businessId } = useLayerContext();
15058
- return (0, import_swr6.default)(
15059
- () => buildKey5(__spreadProps(__spreadValues({}, auth), {
15068
+ return (0, import_swr7.default)(
15069
+ () => buildKey6(__spreadProps(__spreadValues({}, auth), {
15060
15070
  businessId,
15061
15071
  bankTransactionId
15062
15072
  })),
@@ -15080,10 +15090,10 @@ function withSWRKeyTags(key, predicate) {
15080
15090
  }
15081
15091
 
15082
15092
  // src/hooks/useBankTransactions/useUpdateBankTransactionMetadata.ts
15083
- var import_swr7 = require("swr");
15093
+ var import_swr8 = require("swr");
15084
15094
  var import_react61 = require("react");
15085
15095
  var UPDATE_BANK_TRANSACTION_METADATA_TAG_KEY = "#update-bank-transaction-metadata";
15086
- function buildKey6({
15096
+ function buildKey7({
15087
15097
  access_token: accessToken,
15088
15098
  apiUrl,
15089
15099
  businessId,
@@ -15102,9 +15112,9 @@ function buildKey6({
15102
15112
  function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
15103
15113
  const { data: auth } = useAuth();
15104
15114
  const { businessId } = useLayerContext();
15105
- const { mutate } = (0, import_swr7.useSWRConfig)();
15115
+ const { mutate } = (0, import_swr8.useSWRConfig)();
15106
15116
  const mutationResponse = (0, import_mutation3.default)(
15107
- () => buildKey6({
15117
+ () => buildKey7({
15108
15118
  access_token: auth == null ? void 0 : auth.access_token,
15109
15119
  apiUrl: auth == null ? void 0 : auth.apiUrl,
15110
15120
  businessId,
@@ -15131,7 +15141,7 @@ function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
15131
15141
  );
15132
15142
  const { trigger: originalTrigger } = mutationResponse;
15133
15143
  const stableProxiedTrigger = (0, import_react61.useCallback)(
15134
- (...triggerParameters) => __async(this, null, function* () {
15144
+ (...triggerParameters) => __async(null, null, function* () {
15135
15145
  const result = yield originalTrigger(...triggerParameters);
15136
15146
  if (result) {
15137
15147
  yield mutate((key) => withSWRKeyTags(
@@ -15161,7 +15171,7 @@ var useBankTransactionMemo = ({ bankTransactionId }) => {
15161
15171
  defaultValues: {
15162
15172
  memo: bankTransactionMetadata == null ? void 0 : bankTransactionMetadata.memo
15163
15173
  },
15164
- onSubmit: (_0) => __async(void 0, [_0], function* ({ value }) {
15174
+ onSubmit: (_0) => __async(null, [_0], function* ({ value }) {
15165
15175
  var _a;
15166
15176
  if (value.memo !== void 0 && form.state.isDirty) {
15167
15177
  yield updateBankTransactionMetadata2({ memo: (_a = value.memo) != null ? _a : "" });
@@ -15348,7 +15358,7 @@ var ExpandedBankTransactionRow = (0, import_react62.forwardRef)(
15348
15358
  updateRowState(__spreadValues({}, rowState));
15349
15359
  setSplitFormError(void 0);
15350
15360
  };
15351
- const save = () => __async(void 0, null, function* () {
15361
+ const save = () => __async(null, null, function* () {
15352
15362
  if (purpose === "match" /* match */) {
15353
15363
  if (!selectedMatchId) {
15354
15364
  setMatchFormError("Select an option to match the transaction");
@@ -15388,7 +15398,7 @@ var ExpandedBankTransactionRow = (0, import_react62.forwardRef)(
15388
15398
  (0, import_react62.useImperativeHandle)(ref, () => ({
15389
15399
  save
15390
15400
  }));
15391
- const onMatchSubmit = (matchId) => __async(void 0, null, function* () {
15401
+ const onMatchSubmit = (matchId) => __async(null, null, function* () {
15392
15402
  var _a2;
15393
15403
  const foundMatch = (_a2 = bankTransaction.suggested_matches) == null ? void 0 : _a2.find(
15394
15404
  (x) => x.id === matchId
@@ -15901,7 +15911,7 @@ var BankTransactionRow = ({
15901
15911
  }, 300);
15902
15912
  }
15903
15913
  }, [bankTransaction.recently_categorized]);
15904
- const save = () => __async(void 0, null, function* () {
15914
+ const save = () => __async(null, null, function* () {
15905
15915
  var _a2;
15906
15916
  if (open2 && (expandedRowRef == null ? void 0 : expandedRowRef.current)) {
15907
15917
  (_a2 = expandedRowRef == null ? void 0 : expandedRowRef.current) == null ? void 0 : _a2.save();
@@ -16716,7 +16726,7 @@ var MatchForm2 = ({
16716
16726
  setShowRetry(false);
16717
16727
  }
16718
16728
  }, [bankTransaction.error]);
16719
- const onMatchSubmit = (matchId) => __async(void 0, null, function* () {
16729
+ const onMatchSubmit = (matchId) => __async(null, null, function* () {
16720
16730
  var _a2;
16721
16731
  const foundMatch = (_a2 = bankTransaction.suggested_matches) == null ? void 0 : _a2.find(
16722
16732
  (x) => x.id === matchId
@@ -16726,7 +16736,7 @@ var MatchForm2 = ({
16726
16736
  }
16727
16737
  yield matchBankTransaction2(bankTransaction.id, foundMatch.id, true);
16728
16738
  });
16729
- const save = () => __async(void 0, null, function* () {
16739
+ const save = () => __async(null, null, function* () {
16730
16740
  if (!showCategorization) {
16731
16741
  return;
16732
16742
  }
@@ -16916,7 +16926,7 @@ var SplitForm = ({
16916
16926
  });
16917
16927
  return valid;
16918
16928
  };
16919
- const save = () => __async(void 0, null, function* () {
16929
+ const save = () => __async(null, null, function* () {
16920
16930
  if (!validateSplit2(rowState)) {
16921
16931
  if (rowState.splits.length > 1) {
16922
16932
  setFormError(
@@ -17905,7 +17915,7 @@ function TransactionsActions({ children }) {
17905
17915
 
17906
17916
  // src/hooks/useBankTransactions/useBankTransactionsDownload.ts
17907
17917
  var import_mutation4 = __toESM(require("swr/mutation"));
17908
- function buildKey7({
17918
+ function buildKey8({
17909
17919
  access_token: accessToken,
17910
17920
  apiUrl,
17911
17921
  businessId
@@ -17923,7 +17933,7 @@ function useBankTransactionsDownload() {
17923
17933
  const { data } = useAuth();
17924
17934
  const { businessId } = useLayerContext();
17925
17935
  return (0, import_mutation4.default)(
17926
- () => buildKey7(__spreadProps(__spreadValues({}, data), {
17936
+ () => buildKey8(__spreadProps(__spreadValues({}, data), {
17927
17937
  businessId
17928
17938
  })),
17929
17939
  ({
@@ -17988,7 +17998,7 @@ var CLASS_NAME9 = "Layer__InvisibleDownload";
17988
17998
  var InvisibleDownload = (0, import_react77.forwardRef)((_props, ref) => {
17989
17999
  const internalRef = (0, import_react77.useRef)(null);
17990
18000
  (0, import_react77.useImperativeHandle)(ref, () => ({
17991
- trigger: (_0) => __async(void 0, [_0], function* ({ url }) {
18001
+ trigger: (_0) => __async(null, [_0], function* ({ url }) {
17992
18002
  var _a;
17993
18003
  (_a = internalRef.current) == null ? void 0 : _a.setAttribute("href", url);
17994
18004
  return runDelayedSync(() => {
@@ -18506,7 +18516,7 @@ var useQuickbooks = () => {
18506
18516
  void fetchQuickbooksConnectionStatus();
18507
18517
  }
18508
18518
  }, [auth == null ? void 0 : auth.access_token]);
18509
- const fetchQuickbooksConnectionStatus = () => __async(void 0, null, function* () {
18519
+ const fetchQuickbooksConnectionStatus = () => __async(null, null, function* () {
18510
18520
  const isConnected = (yield Layer.statusOfQuickbooksConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
18511
18521
  params: { businessId }
18512
18522
  })()).data.is_connected;
@@ -18518,13 +18528,13 @@ var useQuickbooks = () => {
18518
18528
  params: { businessId }
18519
18529
  }).finally(() => setIsSyncingFromQuickbooks(false));
18520
18530
  };
18521
- const fetchIsSyncingFromQuickbooks = () => __async(void 0, null, function* () {
18531
+ const fetchIsSyncingFromQuickbooks = () => __async(null, null, function* () {
18522
18532
  const isSyncing = (yield Layer.statusOfSyncFromQuickbooks(apiUrl, auth == null ? void 0 : auth.access_token, {
18523
18533
  params: { businessId }
18524
18534
  })()).data.is_syncing;
18525
18535
  setIsSyncingFromQuickbooks(isSyncing);
18526
18536
  });
18527
- const linkQuickbooks = () => __async(void 0, null, function* () {
18537
+ const linkQuickbooks = () => __async(null, null, function* () {
18528
18538
  const res = yield Layer.initQuickbooksOAuth(apiUrl, auth == null ? void 0 : auth.access_token, {
18529
18539
  params: { businessId }
18530
18540
  });
@@ -18565,7 +18575,7 @@ var Quickbooks = () => {
18565
18575
  quickbooksIsLinked === false && /* @__PURE__ */ (0, import_jsx_runtime153.jsx)(
18566
18576
  "button",
18567
18577
  {
18568
- onClick: () => __async(void 0, null, function* () {
18578
+ onClick: () => __async(null, null, function* () {
18569
18579
  const authorizationUrl = yield linkQuickbooks();
18570
18580
  window.location.href = authorizationUrl;
18571
18581
  }),
@@ -18663,7 +18673,7 @@ var applyShare = (items, total) => {
18663
18673
  // src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
18664
18674
  var import_react83 = require("react");
18665
18675
  var import_date_fns23 = require("date-fns");
18666
- var import_swr8 = __toESM(require("swr"));
18676
+ var import_swr9 = __toESM(require("swr"));
18667
18677
  var buildDates = ({ currentDate }) => {
18668
18678
  return {
18669
18679
  startYear: (0, import_date_fns23.startOfMonth)(currentDate).getFullYear() - 1,
@@ -18704,7 +18714,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
18704
18714
  isValidating,
18705
18715
  error,
18706
18716
  mutate
18707
- } = (0, import_swr8.default)(
18717
+ } = (0, import_swr9.default)(
18708
18718
  queryKey,
18709
18719
  Layer.getProfitAndLossSummaries(apiUrl, auth == null ? void 0 : auth.access_token, {
18710
18720
  params: {
@@ -18817,7 +18827,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
18817
18827
  // src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
18818
18828
  var import_react84 = require("react");
18819
18829
  var import_date_fns24 = require("date-fns");
18820
- var import_swr9 = __toESM(require("swr"));
18830
+ var import_swr10 = __toESM(require("swr"));
18821
18831
  var useProfitAndLossQuery = ({
18822
18832
  startDate,
18823
18833
  endDate,
@@ -18840,7 +18850,7 @@ var useProfitAndLossQuery = ({
18840
18850
  isValidating,
18841
18851
  error: rawError,
18842
18852
  mutate
18843
- } = (0, import_swr9.default)(
18853
+ } = (0, import_swr10.default)(
18844
18854
  queryKey,
18845
18855
  Layer.getProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
18846
18856
  businessId,
@@ -19167,14 +19177,14 @@ function preparePeriodsBody(dateRange, comparePeriods, rangeDisplayMode) {
19167
19177
  }
19168
19178
 
19169
19179
  // src/hooks/useProfitAndLossComparison/useProfitAndLossComparison.tsx
19170
- var import_swr10 = __toESM(require("swr"));
19180
+ var import_swr11 = __toESM(require("swr"));
19171
19181
  var COMPARE_MODES_SUPPORTING_MULTI_PERIOD = ["monthPicker", "yearPicker"];
19172
19182
  var isNotOnlyNoneTag = (compareOptions) => {
19173
19183
  return Boolean(
19174
19184
  compareOptions == null ? void 0 : compareOptions.some((option) => option.tagFilterConfig.tagFilters !== "None")
19175
19185
  );
19176
19186
  };
19177
- function buildKey8({
19187
+ function buildKey9({
19178
19188
  access_token: accessToken,
19179
19189
  apiUrl,
19180
19190
  businessId,
@@ -19224,16 +19234,16 @@ function useProfitAndLossComparison({
19224
19234
  const { data: auth } = useAuth();
19225
19235
  const periods = preparePeriodsBody(dateRange, effectiveComparePeriods, rangeDisplayMode);
19226
19236
  const tagFilters = prepareFiltersBody(selectedCompareOptions);
19227
- const queryKey = buildKey8(__spreadProps(__spreadValues({}, auth), {
19237
+ const queryKey = buildKey9(__spreadProps(__spreadValues({}, auth), {
19228
19238
  businessId,
19229
19239
  periods,
19230
19240
  tagFilters,
19231
19241
  reportingBasis,
19232
19242
  compareModeActive
19233
19243
  }));
19234
- const { data, isLoading, isValidating } = (0, import_swr10.default)(
19244
+ const { data, isLoading, isValidating } = (0, import_swr11.default)(
19235
19245
  queryKey,
19236
- () => __async(this, null, function* () {
19246
+ () => __async(null, null, function* () {
19237
19247
  const response = yield Layer.compareProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
19238
19248
  params: {
19239
19249
  businessId
@@ -21160,7 +21170,7 @@ var ProfitAndLossDownloadButton = ({
21160
21170
  const { data: auth } = useAuth();
21161
21171
  const [requestFailed, setRequestFailed] = (0, import_react93.useState)(false);
21162
21172
  const [isDownloading, setIsDownloading] = (0, import_react93.useState)(false);
21163
- const handleClick = () => __async(void 0, null, function* () {
21173
+ const handleClick = () => __async(null, null, function* () {
21164
21174
  var _a;
21165
21175
  setIsDownloading(true);
21166
21176
  const getProfitAndLossExcel2 = Layer.getProfitAndLossExcel(
@@ -21223,7 +21233,7 @@ var SyncingBadge = () => {
21223
21233
  var import_react94 = require("react");
21224
21234
 
21225
21235
  // src/hooks/bookkeeping/periods/useBookkeepingPeriods.ts
21226
- var import_swr11 = __toESM(require("swr"));
21236
+ var import_swr12 = __toESM(require("swr"));
21227
21237
 
21228
21238
  // src/utils/bookkeeping/bookkeepingStatusFilters.ts
21229
21239
  function isActiveBookkeepingStatus(status) {
@@ -21281,7 +21291,7 @@ var getBookkeepingPeriods = get(({ businessId }) => {
21281
21291
  return `/v1/businesses/${businessId}/bookkeeping/periods`;
21282
21292
  });
21283
21293
  var BOOKKEEPING_PERIODS_TAG_KEY = "#bookkeeping-periods";
21284
- function buildKey9({
21294
+ function buildKey10({
21285
21295
  access_token: accessToken,
21286
21296
  apiUrl,
21287
21297
  businessId,
@@ -21301,8 +21311,8 @@ function useBookkeepingPeriods() {
21301
21311
  const { businessId } = useLayerContext();
21302
21312
  const { data, isLoading: isLoadingBookkeepingStatus } = useBookkeepingStatus();
21303
21313
  const isActiveOrPaused = data ? isActiveOrPausedBookkeepingStatus(data.status) : false;
21304
- const swrResponse = (0, import_swr11.default)(
21305
- () => buildKey9(__spreadProps(__spreadValues({}, auth), {
21314
+ const swrResponse = (0, import_swr12.default)(
21315
+ () => buildKey10(__spreadProps(__spreadValues({}, auth), {
21306
21316
  businessId,
21307
21317
  isActiveOrPaused
21308
21318
  })),
@@ -22746,9 +22756,9 @@ ProfitAndLoss.Report = ProfitAndLossReport;
22746
22756
  ProfitAndLoss.DownloadButton = ProfitAndLossDownloadButton;
22747
22757
 
22748
22758
  // src/hooks/balanceSheet/useBalanceSheet.ts
22749
- var import_swr12 = __toESM(require("swr"));
22759
+ var import_swr13 = __toESM(require("swr"));
22750
22760
  var import_date_fns31 = require("date-fns");
22751
- function buildKey10({
22761
+ function buildKey11({
22752
22762
  access_token: accessToken,
22753
22763
  apiUrl,
22754
22764
  businessId,
@@ -22770,8 +22780,8 @@ function useBalanceSheet({
22770
22780
  const { data: auth } = useAuth();
22771
22781
  const { apiUrl } = useEnvironment();
22772
22782
  const { businessId } = useLayerContext();
22773
- return (0, import_swr12.default)(
22774
- () => buildKey10(__spreadProps(__spreadValues({}, auth), {
22783
+ return (0, import_swr13.default)(
22784
+ () => buildKey11(__spreadProps(__spreadValues({}, auth), {
22775
22785
  apiUrl,
22776
22786
  businessId,
22777
22787
  effectiveDate
@@ -22964,7 +22974,7 @@ var BALANCE_SHEET_ROWS = [
22964
22974
 
22965
22975
  // src/components/BalanceSheet/download/useBalanceSheetDownload.ts
22966
22976
  var import_mutation5 = __toESM(require("swr/mutation"));
22967
- function buildKey11({
22977
+ function buildKey12({
22968
22978
  access_token: accessToken,
22969
22979
  apiUrl,
22970
22980
  businessId,
@@ -22987,7 +22997,7 @@ function useBalanceSheetDownload({
22987
22997
  const { data: auth } = useAuth();
22988
22998
  const { businessId } = useLayerContext();
22989
22999
  return (0, import_mutation5.default)(
22990
- () => buildKey11(__spreadProps(__spreadValues({}, auth), {
23000
+ () => buildKey12(__spreadProps(__spreadValues({}, auth), {
22991
23001
  businessId,
22992
23002
  effectiveDate
22993
23003
  })),
@@ -23248,7 +23258,7 @@ var STATEMENT_OF_CASH_FLOW_ROWS = [
23248
23258
 
23249
23259
  // src/components/StatementOfCashFlow/download/useCashflowStatementDownload.ts
23250
23260
  var import_mutation6 = __toESM(require("swr/mutation"));
23251
- function buildKey12({
23261
+ function buildKey13({
23252
23262
  access_token: accessToken,
23253
23263
  apiUrl,
23254
23264
  businessId,
@@ -23274,7 +23284,7 @@ function useCashflowStatementDownload({
23274
23284
  const { data: auth } = useAuth();
23275
23285
  const { businessId } = useLayerContext();
23276
23286
  return (0, import_mutation6.default)(
23277
- () => buildKey12(__spreadProps(__spreadValues({}, auth), {
23287
+ () => buildKey13(__spreadProps(__spreadValues({}, auth), {
23278
23288
  businessId,
23279
23289
  startDate,
23280
23290
  endDate
@@ -23381,9 +23391,9 @@ function StatementOfCashFlowDatePicker({
23381
23391
  }
23382
23392
 
23383
23393
  // src/hooks/useStatementOfCashFlow/useStatementOfCashFlow.tsx
23384
- var import_swr13 = __toESM(require("swr"));
23394
+ var import_swr14 = __toESM(require("swr"));
23385
23395
  var import_date_fns32 = require("date-fns");
23386
- function buildKey13({
23396
+ function buildKey14({
23387
23397
  access_token: accessToken,
23388
23398
  apiUrl,
23389
23399
  businessId,
@@ -23408,8 +23418,8 @@ function useStatementOfCashFlow({
23408
23418
  const { data: auth } = useAuth();
23409
23419
  const { apiUrl } = useEnvironment();
23410
23420
  const { businessId } = useLayerContext();
23411
- return (0, import_swr13.default)(
23412
- buildKey13(__spreadProps(__spreadValues({}, auth), {
23421
+ return (0, import_swr14.default)(
23422
+ buildKey14(__spreadProps(__spreadValues({}, auth), {
23413
23423
  apiUrl,
23414
23424
  businessId,
23415
23425
  startDate,
@@ -23478,7 +23488,7 @@ var StatementOfCashFlowView = ({
23478
23488
  };
23479
23489
 
23480
23490
  // src/components/ChartOfAccounts/ChartOfAccounts.tsx
23481
- var import_react126 = require("react");
23491
+ var import_react127 = require("react");
23482
23492
 
23483
23493
  // src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
23484
23494
  var import_react114 = require("react");
@@ -23742,7 +23752,7 @@ var LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE = {
23742
23752
 
23743
23753
  // src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
23744
23754
  var import_date_fns34 = require("date-fns");
23745
- var import_swr14 = __toESM(require("swr"));
23755
+ var import_swr15 = __toESM(require("swr"));
23746
23756
  var validate = (formData) => {
23747
23757
  const errors = [];
23748
23758
  const nameError = validateName(formData);
@@ -23847,7 +23857,7 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
23847
23857
  initialEndDate != null ? initialEndDate : (0, import_date_fns34.endOfMonth)(Date.now())
23848
23858
  );
23849
23859
  const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `chart-of-accounts-${businessId}-${startDate == null ? void 0 : startDate.valueOf()}-${endDate == null ? void 0 : endDate.valueOf()}`;
23850
- const { data, isLoading, isValidating, error, mutate } = (0, import_swr14.default)(
23860
+ const { data, isLoading, isValidating, error, mutate } = (0, import_swr15.default)(
23851
23861
  queryKey,
23852
23862
  Layer.getLedgerAccountBalances(apiUrl, auth == null ? void 0 : auth.access_token, {
23853
23863
  params: {
@@ -23857,7 +23867,7 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
23857
23867
  }
23858
23868
  })
23859
23869
  );
23860
- const create = (newAccount) => __async(void 0, null, function* () {
23870
+ const create = (newAccount) => __async(null, null, function* () {
23861
23871
  setSendingForm(true);
23862
23872
  setApiError(void 0);
23863
23873
  try {
@@ -23874,7 +23884,7 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
23874
23884
  touch("CHART_OF_ACCOUNTS" /* CHART_OF_ACCOUNTS */);
23875
23885
  }
23876
23886
  });
23877
- const update = (accountData, accountId) => __async(void 0, null, function* () {
23887
+ const update = (accountData, accountId) => __async(null, null, function* () {
23878
23888
  setSendingForm(true);
23879
23889
  setApiError(void 0);
23880
23890
  const newAccountData = __spreadValues({}, accountData);
@@ -24055,17 +24065,22 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
24055
24065
  };
24056
24066
  };
24057
24067
 
24058
- // src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
24068
+ // src/hooks/useChartOfAccounts/useCreateChildAccount.tsx
24069
+ var import_mutation7 = __toESM(require("swr/mutation"));
24070
+ var import_swr16 = require("swr");
24059
24071
  var import_react117 = require("react");
24060
- var import_swr15 = __toESM(require("swr"));
24072
+
24073
+ // src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
24074
+ var import_react118 = require("react");
24075
+ var import_swr17 = __toESM(require("swr"));
24061
24076
  var useLedgerAccounts = (showReversalEntries = false) => {
24062
24077
  const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
24063
24078
  const { apiUrl } = useEnvironment();
24064
24079
  const { data: auth } = useAuth();
24065
- const [accountId, setAccountId] = (0, import_react117.useState)();
24066
- const [selectedEntryId, setSelectedEntryId] = (0, import_react117.useState)();
24080
+ const [accountId, setAccountId] = (0, import_react118.useState)();
24081
+ const [selectedEntryId, setSelectedEntryId] = (0, import_react118.useState)();
24067
24082
  const queryKey = businessId && accountId && (auth == null ? void 0 : auth.access_token) && `ledger-accounts-lines-${businessId}-${accountId}`;
24068
- const { data, isLoading, isValidating, error, mutate } = (0, import_swr15.default)(
24083
+ const { data, isLoading, isValidating, error, mutate } = (0, import_swr17.default)(
24069
24084
  queryKey,
24070
24085
  Layer.getLedgerAccountsLines(apiUrl, auth == null ? void 0 : auth.access_token, {
24071
24086
  params: {
@@ -24081,7 +24096,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
24081
24096
  isLoading: isLoadingEntry,
24082
24097
  isValidating: isValdiatingEntry,
24083
24098
  error: errorEntry
24084
- } = (0, import_swr15.default)(
24099
+ } = (0, import_swr17.default)(
24085
24100
  businessId && selectedEntryId && (auth == null ? void 0 : auth.access_token) && `ledger-accounts-entry-${businessId}-${selectedEntryId}}`,
24086
24101
  Layer.getLedgerAccountsEntry(apiUrl, auth == null ? void 0 : auth.access_token, {
24087
24102
  params: { businessId, entryId: selectedEntryId }
@@ -24092,12 +24107,12 @@ var useLedgerAccounts = (showReversalEntries = false) => {
24092
24107
  setSelectedEntryId(void 0);
24093
24108
  mutateEntryData();
24094
24109
  };
24095
- (0, import_react117.useEffect)(() => {
24110
+ (0, import_react118.useEffect)(() => {
24096
24111
  if (queryKey && (isLoading || isValidating)) {
24097
24112
  read("LEDGER_ACCOUNTS" /* LEDGER_ACCOUNTS */, queryKey);
24098
24113
  }
24099
24114
  }, [isLoading, isValidating]);
24100
- (0, import_react117.useEffect)(() => {
24115
+ (0, import_react118.useEffect)(() => {
24101
24116
  if (queryKey && hasBeenTouched(queryKey)) {
24102
24117
  refetch();
24103
24118
  }
@@ -24121,7 +24136,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
24121
24136
  };
24122
24137
 
24123
24138
  // src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
24124
- var import_react122 = require("react");
24139
+ var import_react123 = require("react");
24125
24140
 
24126
24141
  // src/icons/Plus.tsx
24127
24142
  var import_jsx_runtime205 = require("react/jsx-runtime");
@@ -24162,11 +24177,11 @@ var Plus = (_a) => {
24162
24177
  var Plus_default = Plus;
24163
24178
 
24164
24179
  // src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
24165
- var import_react118 = require("react");
24180
+ var import_react119 = require("react");
24166
24181
  var import_date_fns35 = require("date-fns");
24167
24182
  var import_jsx_runtime206 = require("react/jsx-runtime");
24168
24183
  var ChartOfAccountsDatePicker = () => {
24169
- const { changeDateRange, dateRange } = (0, import_react118.useContext)(ChartOfAccountsContext);
24184
+ const { changeDateRange, dateRange } = (0, import_react119.useContext)(ChartOfAccountsContext);
24170
24185
  return /* @__PURE__ */ (0, import_jsx_runtime206.jsx)(
24171
24186
  DatePicker,
24172
24187
  {
@@ -24185,13 +24200,13 @@ var ChartOfAccountsDatePicker = () => {
24185
24200
  };
24186
24201
 
24187
24202
  // src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
24188
- var import_react120 = require("react");
24203
+ var import_react121 = require("react");
24189
24204
 
24190
24205
  // src/components/ChartOfAccountsForm/useParentOptions.ts
24191
- var import_react119 = require("react");
24206
+ var import_react120 = require("react");
24192
24207
  var useParentOptions = (data) => {
24193
24208
  var _a;
24194
- return (0, import_react119.useMemo)(
24209
+ return (0, import_react120.useMemo)(
24195
24210
  () => flattenAccounts((data == null ? void 0 : data.accounts) || []).sort((a, b) => (a == null ? void 0 : a.name) && (b == null ? void 0 : b.name) ? a.name.localeCompare(b.name) : 0).map((x) => {
24196
24211
  return {
24197
24212
  label: x.name,
@@ -24216,9 +24231,9 @@ var ChartOfAccountsForm = ({
24216
24231
  submitForm,
24217
24232
  sendingForm,
24218
24233
  apiError
24219
- } = (0, import_react120.useContext)(ChartOfAccountsContext);
24234
+ } = (0, import_react121.useContext)(ChartOfAccountsContext);
24220
24235
  const parentOptions = useParentOptions(data);
24221
- const entry = (0, import_react120.useMemo)(() => {
24236
+ const entry = (0, import_react121.useMemo)(() => {
24222
24237
  if ((form == null ? void 0 : form.action) === "edit" && form.accountId) {
24223
24238
  return flattenAccounts((data == null ? void 0 : data.accounts) || []).find(
24224
24239
  (x) => x.id === form.accountId
@@ -24431,7 +24446,7 @@ var ChartOfAccountsSidebar = ({
24431
24446
  };
24432
24447
 
24433
24448
  // src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
24434
- var import_react121 = require("react");
24449
+ var import_react122 = require("react");
24435
24450
 
24436
24451
  // src/icons/Edit2.tsx
24437
24452
  var import_jsx_runtime209 = require("react/jsx-runtime");
@@ -24491,18 +24506,18 @@ var ChartOfAccountsTableContent = ({
24491
24506
  expandAll,
24492
24507
  templateAccountsEditable
24493
24508
  }) => {
24494
- const { setAccountId } = (0, import_react121.useContext)(LedgerAccountsContext);
24495
- const { editAccount } = (0, import_react121.useContext)(ChartOfAccountsContext);
24509
+ const { setAccountId } = (0, import_react122.useContext)(LedgerAccountsContext);
24510
+ const { editAccount } = (0, import_react122.useContext)(ChartOfAccountsContext);
24496
24511
  const { isOpen, setIsOpen } = useTableExpandRow();
24497
- const [accountsRowKeys, setAccountsRowKeys] = (0, import_react121.useState)([]);
24498
- (0, import_react121.useEffect)(() => {
24512
+ const [accountsRowKeys, setAccountsRowKeys] = (0, import_react122.useState)([]);
24513
+ (0, import_react122.useEffect)(() => {
24499
24514
  if (expandAll === "expanded") {
24500
24515
  setIsOpen(accountsRowKeys);
24501
24516
  } else if (expandAll === "collapsed") {
24502
24517
  setIsOpen([]);
24503
24518
  }
24504
24519
  }, [expandAll]);
24505
- (0, import_react121.useEffect)(() => {
24520
+ (0, import_react122.useEffect)(() => {
24506
24521
  const defaultExpanded = data.accounts.map(
24507
24522
  (account) => "coa-row-" + account.id
24508
24523
  );
@@ -24521,7 +24536,7 @@ var ChartOfAccountsTableContent = ({
24521
24536
  var _a, _b;
24522
24537
  const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
24523
24538
  const expanded = expandable ? isOpen(rowKey) : true;
24524
- return /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)(import_react121.Fragment, { children: [
24539
+ return /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)(import_react122.Fragment, { children: [
24525
24540
  /* @__PURE__ */ (0, import_jsx_runtime210.jsxs)(
24526
24541
  TableRow,
24527
24542
  {
@@ -24598,8 +24613,8 @@ var ChartOfAccountsTableContent = ({
24598
24613
  };
24599
24614
 
24600
24615
  // src/components/ChartOfAccounts/download/useAccountBalancesDownload.ts
24601
- var import_mutation7 = __toESM(require("swr/mutation"));
24602
- function buildKey14({
24616
+ var import_mutation8 = __toESM(require("swr/mutation"));
24617
+ function buildKey15({
24603
24618
  access_token: accessToken,
24604
24619
  apiUrl,
24605
24620
  businessId,
@@ -24624,8 +24639,8 @@ function useAccountBalancesDownload({
24624
24639
  }) {
24625
24640
  const { data: auth } = useAuth();
24626
24641
  const { businessId } = useLayerContext();
24627
- return (0, import_mutation7.default)(
24628
- () => buildKey14(__spreadProps(__spreadValues({}, auth), {
24642
+ return (0, import_mutation8.default)(
24643
+ () => buildKey15(__spreadProps(__spreadValues({}, auth), {
24629
24644
  businessId,
24630
24645
  startCutoff,
24631
24646
  endCutoff
@@ -24697,8 +24712,8 @@ var ChartOfAccountsTableWithPanel = ({
24697
24712
  templateAccountsEditable
24698
24713
  }) => {
24699
24714
  var _a;
24700
- const { data, isLoading, addAccount, error, isValidating, refetch, form } = (0, import_react122.useContext)(ChartOfAccountsContext);
24701
- const [expandAll, setExpandAll] = (0, import_react122.useState)();
24715
+ const { data, isLoading, addAccount, error, isValidating, refetch, form } = (0, import_react123.useContext)(ChartOfAccountsContext);
24716
+ const [expandAll, setExpandAll] = (0, import_react123.useState)();
24702
24717
  const cumulativeIndex = 0;
24703
24718
  const accountsLength = (_a = data == null ? void 0 : data.accounts.length) != null ? _a : 0;
24704
24719
  return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(
@@ -24803,10 +24818,10 @@ var ChartOfAccountsTableWithPanel = ({
24803
24818
  };
24804
24819
 
24805
24820
  // src/components/LedgerAccount/LedgerAccountIndex.tsx
24806
- var import_react125 = require("react");
24821
+ var import_react126 = require("react");
24807
24822
 
24808
24823
  // src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
24809
- var import_react123 = require("react");
24824
+ var import_react124 = require("react");
24810
24825
 
24811
24826
  // src/utils/journal.ts
24812
24827
  var getAccountIdentifierPayload = (journalLineItem) => {
@@ -25057,8 +25072,8 @@ var LedgerAccountEntryDetails = ({
25057
25072
  stringOverrides
25058
25073
  }) => {
25059
25074
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
25060
- const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = (0, import_react123.useContext)(LedgerAccountsContext);
25061
- const { totalDebit, totalCredit } = (0, import_react123.useMemo)(() => {
25075
+ const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = (0, import_react124.useContext)(LedgerAccountsContext);
25076
+ const { totalDebit, totalCredit } = (0, import_react124.useMemo)(() => {
25062
25077
  var _a2;
25063
25078
  let totalDebit2 = 0;
25064
25079
  let totalCredit2 = 0;
@@ -25204,7 +25219,7 @@ var LedgerAccountEntryDetails = ({
25204
25219
  };
25205
25220
 
25206
25221
  // src/components/LedgerAccount/LedgerAccountRow.tsx
25207
- var import_react124 = require("react");
25222
+ var import_react125 = require("react");
25208
25223
  var import_classnames68 = __toESM(require("classnames"));
25209
25224
  var import_date_fns37 = require("date-fns");
25210
25225
  var import_jsx_runtime218 = require("react/jsx-runtime");
@@ -25215,9 +25230,9 @@ var LedgerAccountRow = ({
25215
25230
  view
25216
25231
  }) => {
25217
25232
  var _a, _b, _c, _d, _e, _f;
25218
- const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react124.useContext)(LedgerAccountsContext);
25219
- const [showComponent, setShowComponent] = (0, import_react124.useState)(false);
25220
- (0, import_react124.useEffect)(() => {
25233
+ const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react125.useContext)(LedgerAccountsContext);
25234
+ const [showComponent, setShowComponent] = (0, import_react125.useState)(false);
25235
+ (0, import_react125.useEffect)(() => {
25221
25236
  if (initialLoad) {
25222
25237
  const timeoutId = setTimeout(() => {
25223
25238
  setShowComponent(true);
@@ -25361,9 +25376,9 @@ var LedgerAccount = ({
25361
25376
  stringOverrides
25362
25377
  }) => {
25363
25378
  var _a, _b, _c, _d, _e, _f, _g, _h;
25364
- const [currentPage, setCurrentPage] = (0, import_react125.useState)(1);
25365
- const [initialLoad, setInitialLoad] = (0, import_react125.useState)(true);
25366
- const { data: accountData } = (0, import_react125.useContext)(ChartOfAccountsContext);
25379
+ const [currentPage, setCurrentPage] = (0, import_react126.useState)(1);
25380
+ const [initialLoad, setInitialLoad] = (0, import_react126.useState)(true);
25381
+ const { data: accountData } = (0, import_react126.useContext)(ChartOfAccountsContext);
25367
25382
  const {
25368
25383
  data: rawData,
25369
25384
  error,
@@ -25374,8 +25389,8 @@ var LedgerAccount = ({
25374
25389
  selectedEntryId,
25375
25390
  closeSelectedEntry,
25376
25391
  refetch
25377
- } = (0, import_react125.useContext)(LedgerAccountsContext);
25378
- (0, import_react125.useEffect)(() => {
25392
+ } = (0, import_react126.useContext)(LedgerAccountsContext);
25393
+ (0, import_react126.useEffect)(() => {
25379
25394
  if (!isLoading) {
25380
25395
  const timeoutLoad = setTimeout(() => {
25381
25396
  setInitialLoad(false);
@@ -25387,12 +25402,12 @@ var LedgerAccount = ({
25387
25402
  "Layer__ledger-account__index",
25388
25403
  accountId && "open"
25389
25404
  );
25390
- const account = (0, import_react125.useMemo)(() => {
25405
+ const account = (0, import_react126.useMemo)(() => {
25391
25406
  return flattenAccounts((accountData == null ? void 0 : accountData.accounts) || []).find(
25392
25407
  (x) => x.id === accountId
25393
25408
  );
25394
25409
  }, [accountId]);
25395
- const data = (0, import_react125.useMemo)(() => {
25410
+ const data = (0, import_react126.useMemo)(() => {
25396
25411
  var _a2;
25397
25412
  const firstPageIndex = (currentPage - 1) * pageSize;
25398
25413
  const lastPageIndex = firstPageIndex + pageSize;
@@ -25530,7 +25545,7 @@ var ChartOfAccountsContent = ({
25530
25545
  templateAccountsEditable,
25531
25546
  showAddAccountButton
25532
25547
  }) => {
25533
- const { accountId } = (0, import_react126.useContext)(LedgerAccountsContext);
25548
+ const { accountId } = (0, import_react127.useContext)(LedgerAccountsContext);
25534
25549
  const { view, containerRef } = useElementViewSize();
25535
25550
  return /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(Container, { name: "chart-of-accounts", ref: containerRef, asWidget, children: accountId ? /* @__PURE__ */ (0, import_jsx_runtime220.jsx)(
25536
25551
  LedgerAccount,
@@ -25555,8 +25570,8 @@ var ChartOfAccountsContent = ({
25555
25570
  };
25556
25571
 
25557
25572
  // src/contexts/JournalContext/JournalContext.tsx
25558
- var import_react127 = require("react");
25559
- var JournalContext = (0, import_react127.createContext)({
25573
+ var import_react128 = require("react");
25574
+ var JournalContext = (0, import_react128.createContext)({
25560
25575
  data: void 0,
25561
25576
  isLoading: false,
25562
25577
  error: void 0,
@@ -25590,8 +25605,8 @@ var JournalContext = (0, import_react127.createContext)({
25590
25605
  });
25591
25606
 
25592
25607
  // src/hooks/useJournal/useJournal.tsx
25593
- var import_react128 = require("react");
25594
- var import_swr16 = __toESM(require("swr"));
25608
+ var import_react129 = require("react");
25609
+ var import_swr18 = __toESM(require("swr"));
25595
25610
  var useJournal = () => {
25596
25611
  const {
25597
25612
  businessId,
@@ -25602,13 +25617,13 @@ var useJournal = () => {
25602
25617
  } = useLayerContext();
25603
25618
  const { apiUrl } = useEnvironment();
25604
25619
  const { data: auth } = useAuth();
25605
- const [selectedEntryId, setSelectedEntryId] = (0, import_react128.useState)();
25606
- const [form, setForm] = (0, import_react128.useState)();
25607
- const [addingEntry, setAddingEntry] = (0, import_react128.useState)(false);
25608
- const [sendingForm, setSendingForm] = (0, import_react128.useState)(false);
25609
- const [apiError, setApiError] = (0, import_react128.useState)(void 0);
25620
+ const [selectedEntryId, setSelectedEntryId] = (0, import_react129.useState)();
25621
+ const [form, setForm] = (0, import_react129.useState)();
25622
+ const [addingEntry, setAddingEntry] = (0, import_react129.useState)(false);
25623
+ const [sendingForm, setSendingForm] = (0, import_react129.useState)(false);
25624
+ const [apiError, setApiError] = (0, import_react129.useState)(void 0);
25610
25625
  const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `journal-lines-${businessId}`;
25611
- const { data, isLoading, isValidating, error, mutate } = (0, import_swr16.default)(
25626
+ const { data, isLoading, isValidating, error, mutate } = (0, import_swr18.default)(
25612
25627
  queryKey,
25613
25628
  Layer.getJournal(apiUrl, auth == null ? void 0 : auth.access_token, {
25614
25629
  params: { businessId }
@@ -25618,7 +25633,7 @@ var useJournal = () => {
25618
25633
  const closeSelectedEntry = () => {
25619
25634
  setSelectedEntryId(void 0);
25620
25635
  };
25621
- const create = (newJournalEntry) => __async(void 0, null, function* () {
25636
+ const create = (newJournalEntry) => __async(null, null, function* () {
25622
25637
  setSendingForm(true);
25623
25638
  setApiError(void 0);
25624
25639
  try {
@@ -25817,17 +25832,17 @@ var useJournal = () => {
25817
25832
  })
25818
25833
  }));
25819
25834
  };
25820
- const reverseEntry = (entryId) => __async(void 0, null, function* () {
25835
+ const reverseEntry = (entryId) => __async(null, null, function* () {
25821
25836
  return Layer.reverseJournalEntry(apiUrl, auth == null ? void 0 : auth.access_token, {
25822
25837
  params: { businessId, entryId }
25823
25838
  });
25824
25839
  });
25825
- (0, import_react128.useEffect)(() => {
25840
+ (0, import_react129.useEffect)(() => {
25826
25841
  if (queryKey && (isLoading || isValidating)) {
25827
25842
  read("JOURNAL" /* JOURNAL */, queryKey);
25828
25843
  }
25829
25844
  }, [isLoading, isValidating]);
25830
- (0, import_react128.useEffect)(() => {
25845
+ (0, import_react129.useEffect)(() => {
25831
25846
  if (queryKey && hasBeenTouched(queryKey)) {
25832
25847
  refetch();
25833
25848
  }
@@ -25859,13 +25874,13 @@ var useJournal = () => {
25859
25874
  };
25860
25875
 
25861
25876
  // src/components/JournalTable/JournalTableWithPanel.tsx
25862
- var import_react134 = require("react");
25877
+ var import_react135 = require("react");
25863
25878
 
25864
25879
  // src/components/JournalSidebar/JournalSidebar.tsx
25865
- var import_react132 = require("react");
25880
+ var import_react133 = require("react");
25866
25881
 
25867
25882
  // src/components/JournalEntryDetails/JournalEntryDetails.tsx
25868
- var import_react129 = require("react");
25883
+ var import_react130 = require("react");
25869
25884
  var import_jsx_runtime221 = require("react/jsx-runtime");
25870
25885
  var JournalEntryDetails = () => {
25871
25886
  var _a, _b, _c, _d;
@@ -25877,16 +25892,16 @@ var JournalEntryDetails = () => {
25877
25892
  selectedEntryId,
25878
25893
  reverseEntry,
25879
25894
  refetch
25880
- } = (0, import_react129.useContext)(JournalContext);
25881
- const [reverseEntryProcessing, setReverseEntryProcessing] = (0, import_react129.useState)(false);
25882
- const [reverseEntryError, setReverseEntryError] = (0, import_react129.useState)();
25883
- const entry = (0, import_react129.useMemo)(() => {
25895
+ } = (0, import_react130.useContext)(JournalContext);
25896
+ const [reverseEntryProcessing, setReverseEntryProcessing] = (0, import_react130.useState)(false);
25897
+ const [reverseEntryError, setReverseEntryError] = (0, import_react130.useState)();
25898
+ const entry = (0, import_react130.useMemo)(() => {
25884
25899
  if (selectedEntryId && data) {
25885
25900
  return data.find((x) => x.id === selectedEntryId);
25886
25901
  }
25887
25902
  return;
25888
25903
  }, [data, selectedEntryId]);
25889
- const sortedLineItems = (0, import_react129.useMemo)(
25904
+ const sortedLineItems = (0, import_react130.useMemo)(
25890
25905
  () => {
25891
25906
  var _a2;
25892
25907
  return (_a2 = entry == null ? void 0 : entry.line_items) == null ? void 0 : _a2.sort(
@@ -25895,7 +25910,7 @@ var JournalEntryDetails = () => {
25895
25910
  },
25896
25911
  [entry == null ? void 0 : entry.line_items]
25897
25912
  );
25898
- const onReverseEntry = () => __async(void 0, null, function* () {
25913
+ const onReverseEntry = () => __async(null, null, function* () {
25899
25914
  if (!entry) {
25900
25915
  return;
25901
25916
  }
@@ -26064,49 +26079,10 @@ var JournalEntryDetails = () => {
26064
26079
  };
26065
26080
 
26066
26081
  // src/components/JournalForm/JournalForm.tsx
26067
- var import_react131 = require("react");
26068
-
26069
- // src/components/JournalForm/JournalFormEntryLines.tsx
26070
- var import_react130 = require("react");
26071
-
26072
- // src/hooks/categories/useAllCategories.ts
26073
- var import_swr17 = __toESM(require("swr"));
26074
- function buildKey15({
26075
- access_token: accessToken,
26076
- apiUrl,
26077
- businessId
26078
- }) {
26079
- if (accessToken && apiUrl) {
26080
- return {
26081
- accessToken,
26082
- apiUrl,
26083
- businessId,
26084
- mode: "ALL",
26085
- tags: ["#categories"]
26086
- };
26087
- }
26088
- }
26089
- function useAllCategories() {
26090
- const { data: auth } = useAuth();
26091
- const { businessId } = useLayerContext();
26092
- return (0, import_swr17.default)(
26093
- () => buildKey15(__spreadProps(__spreadValues({}, auth), {
26094
- businessId
26095
- })),
26096
- ({ accessToken, apiUrl, businessId: businessId2, mode }) => getCategories(
26097
- apiUrl,
26098
- accessToken,
26099
- {
26100
- params: {
26101
- businessId: businessId2,
26102
- mode
26103
- }
26104
- }
26105
- )().then(({ data }) => data.categories)
26106
- );
26107
- }
26082
+ var import_react132 = require("react");
26108
26083
 
26109
26084
  // src/components/JournalForm/JournalFormEntryLines.tsx
26085
+ var import_react131 = require("react");
26110
26086
  var import_jsx_runtime222 = require("react/jsx-runtime");
26111
26087
  function recursiveFlattenCategories(accounts) {
26112
26088
  const flattenedResult = accounts.flatMap((a) => {
@@ -26126,10 +26102,10 @@ var JournalFormEntryLines = ({
26126
26102
  sendingForm,
26127
26103
  config
26128
26104
  }) => {
26129
- const { data } = useAllCategories();
26130
- const { form } = (0, import_react130.useContext)(JournalContext);
26131
- const { flattenedCategories, parentOptions } = (0, import_react130.useMemo)(() => {
26132
- const flattenedCategories2 = recursiveFlattenCategories(data != null ? data : []);
26105
+ const { data: categories } = useCategories({ mode: "ALL" });
26106
+ const { form } = (0, import_react131.useContext)(JournalContext);
26107
+ const { flattenedCategories, parentOptions } = (0, import_react131.useMemo)(() => {
26108
+ const flattenedCategories2 = recursiveFlattenCategories(categories != null ? categories : []);
26133
26109
  const parentOptions2 = [...flattenedCategories2].sort((a, b) => a.display_name.localeCompare(b.display_name)).map((account) => {
26134
26110
  switch (account.type) {
26135
26111
  case "AccountNested":
@@ -26155,7 +26131,7 @@ var JournalFormEntryLines = ({
26155
26131
  }
26156
26132
  });
26157
26133
  return { flattenedCategories: flattenedCategories2, parentOptions: parentOptions2 };
26158
- }, [data]);
26134
+ }, [categories]);
26159
26135
  const handleChangeParent = ({
26160
26136
  lineItemIndex,
26161
26137
  value
@@ -26340,7 +26316,7 @@ var JournalForm = ({
26340
26316
  changeFormData,
26341
26317
  addEntryLine,
26342
26318
  removeEntryLine
26343
- } = (0, import_react131.useContext)(JournalContext);
26319
+ } = (0, import_react132.useContext)(JournalContext);
26344
26320
  return /* @__PURE__ */ (0, import_jsx_runtime223.jsxs)(
26345
26321
  "form",
26346
26322
  {
@@ -26488,7 +26464,7 @@ var JournalSidebar = ({
26488
26464
  config,
26489
26465
  stringOverrides
26490
26466
  }) => {
26491
- const { selectedEntryId } = (0, import_react132.useContext)(JournalContext);
26467
+ const { selectedEntryId } = (0, import_react133.useContext)(JournalContext);
26492
26468
  if (selectedEntryId !== "new") {
26493
26469
  return /* @__PURE__ */ (0, import_jsx_runtime224.jsx)(JournalEntryDetails, {});
26494
26470
  }
@@ -26496,7 +26472,7 @@ var JournalSidebar = ({
26496
26472
  };
26497
26473
 
26498
26474
  // src/components/JournalTable/JournalTable.tsx
26499
- var import_react133 = require("react");
26475
+ var import_react134 = require("react");
26500
26476
  var import_date_fns38 = require("date-fns");
26501
26477
  var import_jsx_runtime225 = require("react/jsx-runtime");
26502
26478
  var accountName = (row) => {
@@ -26524,9 +26500,9 @@ var JournalTableContent = ({
26524
26500
  data,
26525
26501
  stringOverrides
26526
26502
  }) => {
26527
- const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react133.useContext)(JournalContext);
26503
+ const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react134.useContext)(JournalContext);
26528
26504
  const { isOpen, setIsOpen } = useTableExpandRow();
26529
- (0, import_react133.useEffect)(() => {
26505
+ (0, import_react134.useEffect)(() => {
26530
26506
  if (data.length > 0) {
26531
26507
  setIsOpen(data.map((x) => `journal-row-${x.id}`));
26532
26508
  }
@@ -26534,7 +26510,7 @@ var JournalTableContent = ({
26534
26510
  const renderJournalRow = (row, index, rowKey, depth) => {
26535
26511
  const expandable = !!row.line_items && row.line_items.length > 0;
26536
26512
  const expanded = expandable ? isOpen(rowKey) : true;
26537
- return /* @__PURE__ */ (0, import_jsx_runtime225.jsxs)(import_react133.Fragment, { children: [
26513
+ return /* @__PURE__ */ (0, import_jsx_runtime225.jsxs)(import_react134.Fragment, { children: [
26538
26514
  /* @__PURE__ */ (0, import_jsx_runtime225.jsxs)(
26539
26515
  TableRow,
26540
26516
  {
@@ -26615,7 +26591,7 @@ var JournalTableContent = ({
26615
26591
  };
26616
26592
 
26617
26593
  // src/components/Journal/download/useJournalEntriesDownload.ts
26618
- var import_mutation8 = __toESM(require("swr/mutation"));
26594
+ var import_mutation9 = __toESM(require("swr/mutation"));
26619
26595
  function buildKey16({
26620
26596
  access_token: accessToken,
26621
26597
  apiUrl,
@@ -26641,7 +26617,7 @@ function useJournalEntriesDownload({
26641
26617
  }) {
26642
26618
  const { data: auth } = useAuth();
26643
26619
  const { businessId } = useLayerContext();
26644
- return (0, import_mutation8.default)(
26620
+ return (0, import_mutation9.default)(
26645
26621
  () => buildKey16(__spreadProps(__spreadValues({}, auth), {
26646
26622
  businessId,
26647
26623
  startCutoff,
@@ -26688,7 +26664,7 @@ function JournalEntriesDownloadButton({
26688
26664
  {
26689
26665
  iconOnly,
26690
26666
  onClick: () => {
26691
- trigger();
26667
+ void trigger();
26692
26668
  },
26693
26669
  isDownloading: isMutating,
26694
26670
  requestFailed: Boolean(error),
@@ -26710,7 +26686,7 @@ var JournalTableWithPanel = ({
26710
26686
  stringOverrides,
26711
26687
  view
26712
26688
  }) => {
26713
- const [currentPage, setCurrentPage] = (0, import_react134.useState)(1);
26689
+ const [currentPage, setCurrentPage] = (0, import_react135.useState)(1);
26714
26690
  const {
26715
26691
  data: rawData,
26716
26692
  isLoading,
@@ -26719,8 +26695,8 @@ var JournalTableWithPanel = ({
26719
26695
  refetch,
26720
26696
  selectedEntryId,
26721
26697
  addEntry
26722
- } = (0, import_react134.useContext)(JournalContext);
26723
- const data = (0, import_react134.useMemo)(() => {
26698
+ } = (0, import_react135.useContext)(JournalContext);
26699
+ const data = (0, import_react135.useMemo)(() => {
26724
26700
  var _a;
26725
26701
  const firstPageIndex = (currentPage - 1) * pageSize;
26726
26702
  const lastPageIndex = firstPageIndex + pageSize;
@@ -26857,7 +26833,7 @@ var TasksHeader = ({
26857
26833
  };
26858
26834
 
26859
26835
  // src/components/Tasks/TasksList.tsx
26860
- var import_react142 = require("react");
26836
+ var import_react143 = require("react");
26861
26837
 
26862
26838
  // src/icons/SmileIcon.tsx
26863
26839
  var import_jsx_runtime230 = require("react/jsx-runtime");
@@ -26916,7 +26892,7 @@ var SmileIcon = (_a) => {
26916
26892
  var SmileIcon_default = SmileIcon;
26917
26893
 
26918
26894
  // src/components/Tasks/TasksListItem.tsx
26919
- var import_react139 = require("react");
26895
+ var import_react140 = require("react");
26920
26896
  var import_classnames70 = __toESM(require("classnames"));
26921
26897
 
26922
26898
  // src/utils/bookkeeping/tasks/getBookkeepingTaskStatusIcon.tsx
@@ -26940,8 +26916,8 @@ function getIconForTask(task) {
26940
26916
  }
26941
26917
 
26942
26918
  // src/hooks/bookkeeping/periods/tasks/useSubmitResponseForTask.ts
26943
- var import_swr18 = require("swr");
26944
- var import_mutation9 = __toESM(require("swr/mutation"));
26919
+ var import_swr19 = require("swr");
26920
+ var import_mutation10 = __toESM(require("swr/mutation"));
26945
26921
 
26946
26922
  // src/api/layer/tasks.ts
26947
26923
  var submitUserResponseForTask = post(
@@ -26974,7 +26950,7 @@ function completeTaskWithUpload(baseUrl, accessToken, {
26974
26950
  }
26975
26951
 
26976
26952
  // src/hooks/bookkeeping/periods/tasks/useSubmitResponseForTask.ts
26977
- var import_react135 = require("react");
26953
+ var import_react136 = require("react");
26978
26954
  function buildKey17({
26979
26955
  access_token: accessToken,
26980
26956
  apiUrl,
@@ -26992,8 +26968,8 @@ function buildKey17({
26992
26968
  function useSubmitUserResponseForTask() {
26993
26969
  const { data: auth } = useAuth();
26994
26970
  const { businessId } = useLayerContext();
26995
- const { mutate } = (0, import_swr18.useSWRConfig)();
26996
- const mutationResponse = (0, import_mutation9.default)(
26971
+ const { mutate } = (0, import_swr19.useSWRConfig)();
26972
+ const mutationResponse = (0, import_mutation10.default)(
26997
26973
  () => buildKey17(__spreadProps(__spreadValues({}, auth), {
26998
26974
  businessId
26999
26975
  })),
@@ -27017,8 +26993,8 @@ function useSubmitUserResponseForTask() {
27017
26993
  }
27018
26994
  );
27019
26995
  const { trigger: originalTrigger } = mutationResponse;
27020
- const stableProxiedTrigger = (0, import_react135.useCallback)(
27021
- (...triggerParameters) => __async(this, null, function* () {
26996
+ const stableProxiedTrigger = (0, import_react136.useCallback)(
26997
+ (...triggerParameters) => __async(null, null, function* () {
27022
26998
  const result = yield originalTrigger(...triggerParameters);
27023
26999
  if (result) {
27024
27000
  void mutate((key) => withSWRKeyTags(
@@ -27041,9 +27017,9 @@ function useSubmitUserResponseForTask() {
27041
27017
  }
27042
27018
 
27043
27019
  // src/hooks/bookkeeping/periods/tasks/useUploadDocumentsForTask.ts
27044
- var import_swr19 = require("swr");
27045
- var import_mutation10 = __toESM(require("swr/mutation"));
27046
- var import_react136 = require("react");
27020
+ var import_swr20 = require("swr");
27021
+ var import_mutation11 = __toESM(require("swr/mutation"));
27022
+ var import_react137 = require("react");
27047
27023
  function buildKey18({
27048
27024
  access_token: accessToken,
27049
27025
  apiUrl,
@@ -27061,8 +27037,8 @@ function buildKey18({
27061
27037
  function useUploadDocumentsForTask() {
27062
27038
  const { data: auth } = useAuth();
27063
27039
  const { businessId } = useLayerContext();
27064
- const { mutate } = (0, import_swr19.useSWRConfig)();
27065
- const mutationResponse = (0, import_mutation10.default)(
27040
+ const { mutate } = (0, import_swr20.useSWRConfig)();
27041
+ const mutationResponse = (0, import_mutation11.default)(
27066
27042
  () => buildKey18(__spreadProps(__spreadValues({}, auth), {
27067
27043
  businessId
27068
27044
  })),
@@ -27082,8 +27058,8 @@ function useUploadDocumentsForTask() {
27082
27058
  }
27083
27059
  );
27084
27060
  const { trigger: originalTrigger } = mutationResponse;
27085
- const stableProxiedTrigger = (0, import_react136.useCallback)(
27086
- (...triggerParameters) => __async(this, null, function* () {
27061
+ const stableProxiedTrigger = (0, import_react137.useCallback)(
27062
+ (...triggerParameters) => __async(null, null, function* () {
27087
27063
  const result = yield originalTrigger(...triggerParameters);
27088
27064
  if (result) {
27089
27065
  void mutate((key) => withSWRKeyTags(
@@ -27106,9 +27082,9 @@ function useUploadDocumentsForTask() {
27106
27082
  }
27107
27083
 
27108
27084
  // src/hooks/bookkeeping/periods/tasks/useDeleteUploadsOnTask.ts
27109
- var import_swr20 = require("swr");
27110
- var import_mutation11 = __toESM(require("swr/mutation"));
27111
- var import_react137 = require("react");
27085
+ var import_swr21 = require("swr");
27086
+ var import_mutation12 = __toESM(require("swr/mutation"));
27087
+ var import_react138 = require("react");
27112
27088
  function buildKey19({
27113
27089
  access_token: accessToken,
27114
27090
  apiUrl,
@@ -27126,8 +27102,8 @@ function buildKey19({
27126
27102
  function useDeleteUploadsOnTask() {
27127
27103
  const { data: auth } = useAuth();
27128
27104
  const { businessId } = useLayerContext();
27129
- const { mutate } = (0, import_swr20.useSWRConfig)();
27130
- const mutationResponse = (0, import_mutation11.default)(
27105
+ const { mutate } = (0, import_swr21.useSWRConfig)();
27106
+ const mutationResponse = (0, import_mutation12.default)(
27131
27107
  () => buildKey19(__spreadProps(__spreadValues({}, auth), {
27132
27108
  businessId
27133
27109
  })),
@@ -27144,8 +27120,8 @@ function useDeleteUploadsOnTask() {
27144
27120
  }
27145
27121
  );
27146
27122
  const { trigger: originalTrigger } = mutationResponse;
27147
- const stableProxiedTrigger = (0, import_react137.useCallback)(
27148
- (...triggerParameters) => __async(this, null, function* () {
27123
+ const stableProxiedTrigger = (0, import_react138.useCallback)(
27124
+ (...triggerParameters) => __async(null, null, function* () {
27149
27125
  const result = yield originalTrigger(...triggerParameters);
27150
27126
  if (result) {
27151
27127
  void mutate((key) => withSWRKeyTags(
@@ -27168,9 +27144,9 @@ function useDeleteUploadsOnTask() {
27168
27144
  }
27169
27145
 
27170
27146
  // src/hooks/bookkeeping/periods/tasks/useUpdateTaskUploadDescription.ts
27171
- var import_swr21 = require("swr");
27172
- var import_mutation12 = __toESM(require("swr/mutation"));
27173
- var import_react138 = require("react");
27147
+ var import_swr22 = require("swr");
27148
+ var import_mutation13 = __toESM(require("swr/mutation"));
27149
+ var import_react139 = require("react");
27174
27150
  function buildKey20({
27175
27151
  access_token: accessToken,
27176
27152
  apiUrl,
@@ -27188,8 +27164,8 @@ function buildKey20({
27188
27164
  function useUpdateTaskUploadDescription() {
27189
27165
  const { data: auth } = useAuth();
27190
27166
  const { businessId } = useLayerContext();
27191
- const { mutate } = (0, import_swr21.useSWRConfig)();
27192
- const mutationResponse = (0, import_mutation12.default)(
27167
+ const { mutate } = (0, import_swr22.useSWRConfig)();
27168
+ const mutationResponse = (0, import_mutation13.default)(
27193
27169
  () => buildKey20(__spreadProps(__spreadValues({}, auth), {
27194
27170
  businessId
27195
27171
  })),
@@ -27210,8 +27186,8 @@ function useUpdateTaskUploadDescription() {
27210
27186
  }
27211
27187
  );
27212
27188
  const { trigger: originalTrigger } = mutationResponse;
27213
- const stableProxiedTrigger = (0, import_react138.useCallback)(
27214
- (...triggerParameters) => __async(this, null, function* () {
27189
+ const stableProxiedTrigger = (0, import_react139.useCallback)(
27190
+ (...triggerParameters) => __async(null, null, function* () {
27215
27191
  const result = yield originalTrigger(...triggerParameters);
27216
27192
  if (result) {
27217
27193
  void mutate((key) => withSWRKeyTags(
@@ -27240,9 +27216,9 @@ var TasksListItem = ({
27240
27216
  defaultOpen
27241
27217
  }) => {
27242
27218
  var _a, _b;
27243
- const [isOpen, setIsOpen] = (0, import_react139.useState)(defaultOpen);
27244
- const [userResponse, setUserResponse] = (0, import_react139.useState)((_a = task.user_response) != null ? _a : "");
27245
- const [selectedFiles, setSelectedFiles] = (0, import_react139.useState)();
27219
+ const [isOpen, setIsOpen] = (0, import_react140.useState)(defaultOpen);
27220
+ const [userResponse, setUserResponse] = (0, import_react140.useState)((_a = task.user_response) != null ? _a : "");
27221
+ const [selectedFiles, setSelectedFiles] = (0, import_react140.useState)();
27246
27222
  const { trigger: handleSubmitUserResponseForTask } = useSubmitUserResponseForTask();
27247
27223
  const { trigger: handleUploadDocumentsForTask } = useUploadDocumentsForTask();
27248
27224
  const { trigger: handleDeleteUploadsOnTask } = useDeleteUploadsOnTask();
@@ -27260,10 +27236,10 @@ var TasksListItem = ({
27260
27236
  "Layer__tasks-list-item",
27261
27237
  isOpen && "Layer__tasks-list-item__expanded"
27262
27238
  );
27263
- (0, import_react139.useEffect)(() => {
27239
+ (0, import_react140.useEffect)(() => {
27264
27240
  setIsOpen(defaultOpen);
27265
27241
  }, [defaultOpen]);
27266
- const submit = () => __async(void 0, null, function* () {
27242
+ const submit = () => __async(null, null, function* () {
27267
27243
  if (!selectedFiles) {
27268
27244
  return;
27269
27245
  }
@@ -27275,7 +27251,7 @@ var TasksListItem = ({
27275
27251
  setIsOpen(false);
27276
27252
  setSelectedFiles(void 0);
27277
27253
  });
27278
- const uploadDocumentAction = (0, import_react139.useMemo)(() => {
27254
+ const uploadDocumentAction = (0, import_react140.useMemo)(() => {
27279
27255
  if (task.user_response_type === "UPLOAD_DOCUMENT") {
27280
27256
  if (task.status === "TODO") {
27281
27257
  if (!selectedFiles) {
@@ -27420,7 +27396,7 @@ var MobilePanel = ({ header, children, open: open2, onClose, className }) => {
27420
27396
  };
27421
27397
 
27422
27398
  // src/components/Tasks/TasksListMobile.tsx
27423
- var import_react140 = require("react");
27399
+ var import_react141 = require("react");
27424
27400
  var import_jsx_runtime234 = require("react/jsx-runtime");
27425
27401
  var MOBILE_SHOW_UNRESOLVED_TASKS_COUNT = 2;
27426
27402
  var TasksListMobile = ({
@@ -27431,7 +27407,7 @@ var TasksListMobile = ({
27431
27407
  pageSize,
27432
27408
  setCurrentPage
27433
27409
  }) => {
27434
- const [showMobilePanel, setShowMobilePanel] = (0, import_react140.useState)(false);
27410
+ const [showMobilePanel, setShowMobilePanel] = (0, import_react141.useState)(false);
27435
27411
  const unresolvedTasks = getIncompleteTasks(sortedTasks).slice(0, MOBILE_SHOW_UNRESOLVED_TASKS_COUNT);
27436
27412
  return /* @__PURE__ */ (0, import_jsx_runtime234.jsxs)("div", { className: "Layer__tasks-list", children: [
27437
27413
  unresolvedTasks.map((task, index) => /* @__PURE__ */ (0, import_jsx_runtime234.jsx)(
@@ -27479,27 +27455,27 @@ var TasksListMobile = ({
27479
27455
  };
27480
27456
 
27481
27457
  // src/hooks/array/usePaginatedList.ts
27482
- var import_react141 = require("react");
27458
+ var import_react142 = require("react");
27483
27459
  function usePaginatedList(list, pageSize) {
27484
- const [internalPageIndex, setInternalPageIndex] = (0, import_react141.useState)(0);
27460
+ const [internalPageIndex, setInternalPageIndex] = (0, import_react142.useState)(0);
27485
27461
  const pageCount = Math.max(0, Math.ceil(list.length / pageSize));
27486
27462
  const effectivePageIndex = Math.max(0, Math.min(internalPageIndex, pageCount - 1));
27487
- const pageItems = (0, import_react141.useMemo)(() => {
27463
+ const pageItems = (0, import_react142.useMemo)(() => {
27488
27464
  return list.slice(
27489
27465
  effectivePageIndex * pageSize,
27490
27466
  (effectivePageIndex + 1) * pageSize
27491
27467
  );
27492
27468
  }, [list, effectivePageIndex, pageSize]);
27493
- const next = (0, import_react141.useCallback)(() => {
27469
+ const next = (0, import_react142.useCallback)(() => {
27494
27470
  setInternalPageIndex(Math.min(effectivePageIndex + 1, pageCount - 1));
27495
27471
  }, [effectivePageIndex, pageCount]);
27496
- const set2 = (0, import_react141.useCallback)((pageIndex) => {
27472
+ const set2 = (0, import_react142.useCallback)((pageIndex) => {
27497
27473
  setInternalPageIndex(Math.max(0, Math.min(pageIndex, pageCount - 1)));
27498
27474
  }, [pageCount]);
27499
- const previous = (0, import_react141.useCallback)(() => {
27475
+ const previous = (0, import_react142.useCallback)(() => {
27500
27476
  setInternalPageIndex(Math.max(effectivePageIndex - 1, 0));
27501
27477
  }, [effectivePageIndex]);
27502
- const reset = (0, import_react141.useCallback)(() => {
27478
+ const reset = (0, import_react142.useCallback)(() => {
27503
27479
  setInternalPageIndex(0);
27504
27480
  }, []);
27505
27481
  return {
@@ -27527,7 +27503,7 @@ var TasksEmptyState = () => /* @__PURE__ */ (0, import_jsx_runtime235.jsxs)("div
27527
27503
  ] });
27528
27504
  function TasksList({ pageSize = 8, mobile }) {
27529
27505
  const { activePeriod } = useActiveBookkeepingPeriod();
27530
- const sortedTasks = (0, import_react142.useMemo)(() => {
27506
+ const sortedTasks = (0, import_react143.useMemo)(() => {
27531
27507
  var _a;
27532
27508
  const tasksInPeriod = (_a = activePeriod == null ? void 0 : activePeriod.tasks) != null ? _a : [];
27533
27509
  return tasksInPeriod.sort((taskA, taskB) => {
@@ -27669,7 +27645,7 @@ var TasksPending = () => {
27669
27645
  };
27670
27646
 
27671
27647
  // src/components/Tasks/TasksMonthSelector.tsx
27672
- var import_react143 = require("react");
27648
+ var import_react144 = require("react");
27673
27649
  var import_date_fns40 = require("date-fns");
27674
27650
 
27675
27651
  // src/components/Tasks/TaskStatusBadge.tsx
@@ -27771,7 +27747,7 @@ function useActiveYearBookkeepingPeriods() {
27771
27747
  const { date } = useGlobalDate();
27772
27748
  const { data } = useBookkeepingPeriods();
27773
27749
  const activeYear = (0, import_date_fns40.getYear)(date);
27774
- const periodsInActiveYear = (0, import_react143.useMemo)(() => {
27750
+ const periodsInActiveYear = (0, import_react144.useMemo)(() => {
27775
27751
  return data == null ? void 0 : data.filter((period) => period.year === activeYear);
27776
27752
  }, [data, activeYear]);
27777
27753
  return { periodsInActiveYear };
@@ -27782,7 +27758,7 @@ function TasksMonthSelector() {
27782
27758
  const { periodsInActiveYear } = useActiveYearBookkeepingPeriods();
27783
27759
  const activeMonthNumber = (0, import_date_fns40.getMonth)(date) + 1;
27784
27760
  const activeYear = (0, import_date_fns40.getYear)(date);
27785
- const monthsData = (0, import_react143.useMemo)(() => {
27761
+ const monthsData = (0, import_react144.useMemo)(() => {
27786
27762
  return Array.from({ length: 12 }, (_, index) => {
27787
27763
  var _a, _b;
27788
27764
  const date2 = (0, import_date_fns40.set)(
@@ -27832,13 +27808,13 @@ var import_classnames74 = __toESM(require("classnames"));
27832
27808
  var import_pluralize3 = __toESM(require("pluralize"));
27833
27809
 
27834
27810
  // src/hooks/bookkeeping/periods/useBookkeepingYearsStatus.ts
27835
- var import_react144 = require("react");
27811
+ var import_react145 = require("react");
27836
27812
  var import_date_fns41 = require("date-fns");
27837
27813
  var useBookkeepingYearsStatus = () => {
27838
27814
  const { business } = useLayerContext();
27839
27815
  const activationDate = getActivationDate(business);
27840
27816
  const { data, isLoading } = useBookkeepingPeriods();
27841
- const yearStatuses = (0, import_react144.useMemo)(() => {
27817
+ const yearStatuses = (0, import_react145.useMemo)(() => {
27842
27818
  const startYear = (0, import_date_fns41.getYear)(activationDate != null ? activationDate : /* @__PURE__ */ new Date());
27843
27819
  const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
27844
27820
  const count = currentYear - startYear + 1;
@@ -27853,7 +27829,7 @@ var useBookkeepingYearsStatus = () => {
27853
27829
  };
27854
27830
  }).filter(({ year }) => data == null ? void 0 : data.some((period) => period.year === year)).sort((a, b) => b.year - a.year);
27855
27831
  }, [activationDate, data]);
27856
- const earliestIncompletePeriod = (0, import_react144.useMemo)(
27832
+ const earliestIncompletePeriod = (0, import_react145.useMemo)(
27857
27833
  () => [...data != null ? data : []].sort((a, b) => {
27858
27834
  if (a.year === b.year) {
27859
27835
  return b.month - a.month;
@@ -27919,7 +27895,7 @@ var ArrowRightCircle = (_a) => {
27919
27895
  var ArrowRightCircle_default = ArrowRightCircle;
27920
27896
 
27921
27897
  // src/hooks/bookkeeping/useBankAccounts.ts
27922
- var import_swr22 = __toESM(require("swr"));
27898
+ var import_swr23 = __toESM(require("swr"));
27923
27899
  var BANK_ACCOUNTS_TAG_KEY = "#bank-accounts";
27924
27900
  var getBankAccounts = get(
27925
27901
  ({ businessId }) => `/v1/businesses/${businessId}/bank-accounts`
@@ -27944,7 +27920,7 @@ var useBankAccounts = () => {
27944
27920
  const { businessId } = useLayerContext();
27945
27921
  const { apiUrl } = useEnvironment();
27946
27922
  const { data: auth } = useAuth();
27947
- const { data, error, isLoading } = (0, import_swr22.default)(
27923
+ const { data, error, isLoading } = (0, import_swr23.default)(
27948
27924
  () => buildKey21(__spreadProps(__spreadValues({}, auth), {
27949
27925
  apiUrl,
27950
27926
  businessId
@@ -28040,10 +28016,10 @@ var TasksPanelNotification = ({
28040
28016
  };
28041
28017
 
28042
28018
  // src/components/Tasks/TasksYearsTabs.tsx
28043
- var import_react147 = require("react");
28019
+ var import_react148 = require("react");
28044
28020
 
28045
28021
  // src/components/Tabs/Tabs.tsx
28046
- var import_react145 = require("react");
28022
+ var import_react146 = require("react");
28047
28023
 
28048
28024
  // src/components/Tabs/Tab.tsx
28049
28025
  var import_jsx_runtime243 = require("react/jsx-runtime");
@@ -28107,12 +28083,12 @@ var Tab = ({
28107
28083
  // src/components/Tabs/Tabs.tsx
28108
28084
  var import_classnames73 = __toESM(require("classnames"));
28109
28085
  var import_jsx_runtime244 = require("react/jsx-runtime");
28110
- var import_react146 = require("react");
28086
+ var import_react147 = require("react");
28111
28087
  var STARTING_PADDING = 12;
28112
28088
  var Tabs = ({ name, options, selected, onChange }) => {
28113
- const [initialized, setInitialized] = (0, import_react145.useState)(false);
28114
- const [thumbPos, setThumbPos] = (0, import_react145.useState)({ left: 0, width: 0 });
28115
- const [currentWidth, setCurrentWidth] = (0, import_react145.useState)(0);
28089
+ const [initialized, setInitialized] = (0, import_react146.useState)(false);
28090
+ const [thumbPos, setThumbPos] = (0, import_react146.useState)({ left: 0, width: 0 });
28091
+ const [currentWidth, setCurrentWidth] = (0, import_react146.useState)(0);
28116
28092
  const selectedValue = selected || options[0].value;
28117
28093
  const baseClassName = (0, import_classnames73.default)(
28118
28094
  "Layer__tabs",
@@ -28147,14 +28123,14 @@ var Tabs = ({ name, options, selected, onChange }) => {
28147
28123
  shift2 = shift2 + STARTING_PADDING;
28148
28124
  setThumbPos({ left: shift2, width });
28149
28125
  };
28150
- (0, import_react145.useEffect)(() => {
28126
+ (0, import_react146.useEffect)(() => {
28151
28127
  const selectedIndex = getSelectedIndex();
28152
28128
  updateSelectPosition(selectedIndex);
28153
28129
  setTimeout(() => {
28154
28130
  setInitialized(true);
28155
28131
  }, 400);
28156
28132
  }, []);
28157
- (0, import_react145.useEffect)(() => {
28133
+ (0, import_react146.useEffect)(() => {
28158
28134
  const selectedIndex = getSelectedIndex();
28159
28135
  updateSelectPosition(selectedIndex);
28160
28136
  }, [selectedValue, currentWidth]);
@@ -28170,7 +28146,7 @@ var Tabs = ({ name, options, selected, onChange }) => {
28170
28146
  return /* @__PURE__ */ (0, import_jsx_runtime244.jsx)("div", { className: "Layer__tabs__container", children: /* @__PURE__ */ (0, import_jsx_runtime244.jsxs)("div", { className: baseClassName, ref: elementRef, children: [
28171
28147
  options.map((option, index) => {
28172
28148
  var _a;
28173
- return /* @__PURE__ */ (0, import_react146.createElement)(
28149
+ return /* @__PURE__ */ (0, import_react147.createElement)(
28174
28150
  Tab,
28175
28151
  __spreadProps(__spreadValues({}, option), {
28176
28152
  key: option.value,
@@ -28202,7 +28178,7 @@ var TasksYearsTabs = () => {
28202
28178
  yearNumber: Number(year)
28203
28179
  });
28204
28180
  };
28205
- const yearsList = (0, import_react147.useMemo)(() => {
28181
+ const yearsList = (0, import_react148.useMemo)(() => {
28206
28182
  return yearStatuses == null ? void 0 : yearStatuses.sort((a, b) => a.year - b.year).map((y) => {
28207
28183
  return {
28208
28184
  value: `${y.year}`,
@@ -28305,40 +28281,40 @@ function Tasks({
28305
28281
  }
28306
28282
 
28307
28283
  // src/components/PlatformOnboarding/LinkAccounts.tsx
28308
- var import_react151 = require("react");
28284
+ var import_react152 = require("react");
28309
28285
 
28310
28286
  // src/components/PlatformOnboarding/Steps/LinkAccountsConfirmationStep.tsx
28311
- var import_react149 = require("react");
28287
+ var import_react150 = require("react");
28312
28288
  var import_react_form2 = require("@tanstack/react-form");
28313
28289
 
28314
28290
  // src/components/Wizard/Wizard.tsx
28315
- var import_react148 = require("react");
28291
+ var import_react149 = require("react");
28316
28292
  var import_jsx_runtime248 = require("react/jsx-runtime");
28317
28293
  function useWizardStep({
28318
28294
  steps,
28319
28295
  onComplete
28320
28296
  }) {
28321
28297
  const stepCount = steps.length;
28322
- const [activeStepIndex, setActiveStepIndex] = (0, import_react148.useState)(0);
28323
- const next = (0, import_react148.useCallback)(() => __async(this, null, function* () {
28298
+ const [activeStepIndex, setActiveStepIndex] = (0, import_react149.useState)(0);
28299
+ const next = (0, import_react149.useCallback)(() => __async(null, null, function* () {
28324
28300
  setActiveStepIndex((stepIndex) => Math.min(stepIndex + 1, stepCount - 1));
28325
28301
  if (activeStepIndex === stepCount - 1 && onComplete) {
28326
28302
  yield onComplete == null ? void 0 : onComplete();
28327
28303
  }
28328
28304
  }), [stepCount, activeStepIndex, onComplete]);
28329
- const previous = (0, import_react148.useCallback)(() => setActiveStepIndex((stepIndex) => Math.max(stepIndex - 1, 0)), []);
28305
+ const previous = (0, import_react149.useCallback)(() => setActiveStepIndex((stepIndex) => Math.max(stepIndex - 1, 0)), []);
28330
28306
  const effectiveStepIndex = Math.min(activeStepIndex, stepCount - 1);
28331
28307
  const currentStep = steps.at(effectiveStepIndex);
28332
28308
  return { currentStep, next, previous };
28333
28309
  }
28334
- var WizardContext = (0, import_react148.createContext)({
28310
+ var WizardContext = (0, import_react149.createContext)({
28335
28311
  next: () => {
28336
28312
  },
28337
28313
  previous: () => {
28338
28314
  }
28339
28315
  });
28340
28316
  function useWizard() {
28341
- return (0, import_react148.useContext)(WizardContext);
28317
+ return (0, import_react149.useContext)(WizardContext);
28342
28318
  }
28343
28319
  function Wizard({
28344
28320
  Header: Header3,
@@ -28346,12 +28322,12 @@ function Wizard({
28346
28322
  onComplete,
28347
28323
  children
28348
28324
  }) {
28349
- const childrenArray = import_react148.Children.toArray(children);
28325
+ const childrenArray = import_react149.Children.toArray(children);
28350
28326
  const { currentStep, next, previous } = useWizardStep({
28351
28327
  steps: childrenArray,
28352
28328
  onComplete
28353
28329
  });
28354
- const value = (0, import_react148.useMemo)(() => ({ next, previous }), [next, previous]);
28330
+ const value = (0, import_react149.useMemo)(() => ({ next, previous }), [next, previous]);
28355
28331
  return /* @__PURE__ */ (0, import_jsx_runtime248.jsxs)(WizardContext.Provider, { value, children: [
28356
28332
  Header3,
28357
28333
  currentStep,
@@ -28392,7 +28368,7 @@ function LinkAccountsConfirmationStep() {
28392
28368
  data: linkedAccounts,
28393
28369
  loadingStatus: linkedAccountsLoadingStatus,
28394
28370
  refetchAccounts
28395
- } = (0, import_react149.useContext)(LinkedAccountsContext);
28371
+ } = (0, import_react150.useContext)(LinkedAccountsContext);
28396
28372
  const effectiveLinkedAccounts = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
28397
28373
  const { trigger } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
28398
28374
  const { previous, next } = useWizard();
@@ -28405,7 +28381,7 @@ function LinkAccountsConfirmationStep() {
28405
28381
  defaultValues: {
28406
28382
  accounts: effectiveLinkedAccounts.map((account) => ({ account, isSelected: true }))
28407
28383
  },
28408
- onSubmit: (_0) => __async(this, [_0], function* ({ value }) {
28384
+ onSubmit: (_0) => __async(null, [_0], function* ({ value }) {
28409
28385
  const formattedArg = Object.fromEntries(
28410
28386
  value.accounts.map(({ account, isSelected }) => [account.id, isSelected])
28411
28387
  );
@@ -28465,7 +28441,7 @@ function LinkAccountsConfirmationStep() {
28465
28441
  }
28466
28442
 
28467
28443
  // src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
28468
- var import_react150 = require("react");
28444
+ var import_react151 = require("react");
28469
28445
  var import_pluralize4 = __toESM(require("pluralize"));
28470
28446
 
28471
28447
  // src/components/Separator/Separator.tsx
@@ -28484,7 +28460,7 @@ function LinkAccountsLinkStep() {
28484
28460
  error,
28485
28461
  refetchAccounts,
28486
28462
  addConnection
28487
- } = (0, import_react150.useContext)(LinkedAccountsContext);
28463
+ } = (0, import_react151.useContext)(LinkedAccountsContext);
28488
28464
  const { next } = useWizard();
28489
28465
  const effectiveAccounts = data != null ? data : [];
28490
28466
  return /* @__PURE__ */ (0, import_jsx_runtime252.jsxs)(import_jsx_runtime252.Fragment, { children: [
@@ -28564,7 +28540,7 @@ function LinkAccounts(props) {
28564
28540
  function LinkAccountsContent({
28565
28541
  onComplete
28566
28542
  }) {
28567
- const { data: linkedAccounts, loadingStatus } = (0, import_react151.useContext)(LinkedAccountsContext);
28543
+ const { data: linkedAccounts, loadingStatus } = (0, import_react152.useContext)(LinkedAccountsContext);
28568
28544
  const linkedAccountsNeedingConfirmation = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
28569
28545
  const hideConfirmationStep = loadingStatus === "complete" && linkedAccountsNeedingConfirmation.length === 0;
28570
28546
  return /* @__PURE__ */ (0, import_jsx_runtime253.jsx)("section", { className: "Layer__link-accounts Layer__component", children: /* @__PURE__ */ (0, import_jsx_runtime253.jsxs)(
@@ -28582,7 +28558,7 @@ function LinkAccountsContent({
28582
28558
  }
28583
28559
 
28584
28560
  // src/components/PlatformOnboarding/PlatformOnboarding.tsx
28585
- var import_react156 = require("react");
28561
+ var import_react157 = require("react");
28586
28562
 
28587
28563
  // src/components/ProgressSteps/ProgressSteps.tsx
28588
28564
  var import_jsx_runtime254 = require("react/jsx-runtime");
@@ -28901,7 +28877,7 @@ var validateEmailFormat = (email, required = false) => {
28901
28877
  var import_react_form3 = require("@tanstack/react-form");
28902
28878
 
28903
28879
  // src/hooks/businessPersonnel/useBusinessPersonnel.ts
28904
- var import_swr23 = __toESM(require("swr"));
28880
+ var import_swr24 = __toESM(require("swr"));
28905
28881
 
28906
28882
  // src/utils/array/readonlyTransformations.ts
28907
28883
  function mapReadonly(array, callbackFn) {
@@ -28937,7 +28913,7 @@ var getBusinessPersonnel = get(({ businessId }) => `/v1/businesses/${businessId}
28937
28913
  function useBusinessPersonnel() {
28938
28914
  const { data } = useAuth();
28939
28915
  const { businessId } = useLayerContext();
28940
- return (0, import_swr23.default)(
28916
+ return (0, import_swr24.default)(
28941
28917
  () => buildKey22(__spreadProps(__spreadValues({}, data), {
28942
28918
  businessId
28943
28919
  })),
@@ -28977,9 +28953,9 @@ function useBusinessPersonnel() {
28977
28953
  }
28978
28954
 
28979
28955
  // src/hooks/businessPersonnel/useCreateBusinessPersonnel.ts
28980
- var import_mutation13 = __toESM(require("swr/mutation"));
28981
- var import_swr24 = require("swr");
28982
- var import_react152 = require("react");
28956
+ var import_mutation14 = __toESM(require("swr/mutation"));
28957
+ var import_swr25 = require("swr");
28958
+ var import_react153 = require("react");
28983
28959
  var createBusinessPersonnel = post(({ businessId }) => `/v1/businesses/${businessId}/personnel`);
28984
28960
  function buildKey23({
28985
28961
  access_token: accessToken,
@@ -28998,8 +28974,8 @@ function buildKey23({
28998
28974
  function useCreateBusinessPersonnel() {
28999
28975
  const { data } = useAuth();
29000
28976
  const { businessId } = useLayerContext();
29001
- const { mutate } = (0, import_swr24.useSWRConfig)();
29002
- const mutationResponse = (0, import_mutation13.default)(
28977
+ const { mutate } = (0, import_swr25.useSWRConfig)();
28978
+ const mutationResponse = (0, import_mutation14.default)(
29003
28979
  () => buildKey23(__spreadProps(__spreadValues({}, data), {
29004
28980
  businessId
29005
28981
  })),
@@ -29017,8 +28993,8 @@ function useCreateBusinessPersonnel() {
29017
28993
  }
29018
28994
  );
29019
28995
  const { trigger: originalTrigger } = mutationResponse;
29020
- const stableProxiedTrigger = (0, import_react152.useCallback)(
29021
- (...triggerParameters) => __async(this, null, function* () {
28996
+ const stableProxiedTrigger = (0, import_react153.useCallback)(
28997
+ (...triggerParameters) => __async(null, null, function* () {
29022
28998
  const result = yield originalTrigger(...triggerParameters);
29023
28999
  if (result) {
29024
29000
  yield mutate((key) => withSWRKeyTags(
@@ -29041,8 +29017,8 @@ function useCreateBusinessPersonnel() {
29041
29017
  }
29042
29018
 
29043
29019
  // src/hooks/businessPersonnel/useUpdateBusinessPersonnel.ts
29044
- var import_mutation14 = __toESM(require("swr/mutation"));
29045
- var import_swr25 = require("swr");
29020
+ var import_mutation15 = __toESM(require("swr/mutation"));
29021
+ var import_swr26 = require("swr");
29046
29022
 
29047
29023
  // src/api/layer/businessPersonnel/updateBusinessPersonnel.ts
29048
29024
  var updateBusinessPersonnel = post(({ businessId, businessPersonnelId }) => {
@@ -29050,7 +29026,7 @@ var updateBusinessPersonnel = post(({ businessId, businessPersonnelId }) => {
29050
29026
  });
29051
29027
 
29052
29028
  // src/hooks/businessPersonnel/useUpdateBusinessPersonnel.ts
29053
- var import_react153 = require("react");
29029
+ var import_react154 = require("react");
29054
29030
  function buildKey24({
29055
29031
  access_token: accessToken,
29056
29032
  apiUrl,
@@ -29070,8 +29046,8 @@ function buildKey24({
29070
29046
  function useUpdateBusinessPersonnel({ businessPersonnelId }) {
29071
29047
  const { data } = useAuth();
29072
29048
  const { businessId } = useLayerContext();
29073
- const { mutate } = (0, import_swr25.useSWRConfig)();
29074
- const mutationResponse = (0, import_mutation14.default)(
29049
+ const { mutate } = (0, import_swr26.useSWRConfig)();
29050
+ const mutationResponse = (0, import_mutation15.default)(
29075
29051
  () => buildKey24(__spreadProps(__spreadValues({}, data), {
29076
29052
  businessId,
29077
29053
  businessPersonnelId
@@ -29093,8 +29069,8 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
29093
29069
  }
29094
29070
  );
29095
29071
  const { trigger: originalTrigger } = mutationResponse;
29096
- const stableProxiedTrigger = (0, import_react153.useCallback)(
29097
- (...triggerParameters) => __async(this, null, function* () {
29072
+ const stableProxiedTrigger = (0, import_react154.useCallback)(
29073
+ (...triggerParameters) => __async(null, null, function* () {
29098
29074
  const result = yield originalTrigger(...triggerParameters);
29099
29075
  if (result) {
29100
29076
  yield mutate((key) => withSWRKeyTags(
@@ -29117,9 +29093,9 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
29117
29093
  }
29118
29094
 
29119
29095
  // src/hooks/business/useUpdateBusiness.ts
29120
- var import_mutation15 = __toESM(require("swr/mutation"));
29121
- var import_swr26 = require("swr");
29122
- var import_react154 = require("react");
29096
+ var import_mutation16 = __toESM(require("swr/mutation"));
29097
+ var import_swr27 = require("swr");
29098
+ var import_react155 = require("react");
29123
29099
  var BUSINESS_TAG_KEY = "business";
29124
29100
  function buildKey25({
29125
29101
  access_token: accessToken,
@@ -29138,8 +29114,8 @@ function buildKey25({
29138
29114
  function useUpdateBusiness() {
29139
29115
  const { data } = useAuth();
29140
29116
  const { businessId } = useLayerContext();
29141
- const { mutate } = (0, import_swr26.useSWRConfig)();
29142
- const mutationResponse = (0, import_mutation15.default)(
29117
+ const { mutate } = (0, import_swr27.useSWRConfig)();
29118
+ const mutationResponse = (0, import_mutation16.default)(
29143
29119
  () => buildKey25(__spreadProps(__spreadValues({}, data), {
29144
29120
  businessId
29145
29121
  })),
@@ -29157,8 +29133,8 @@ function useUpdateBusiness() {
29157
29133
  }
29158
29134
  );
29159
29135
  const { trigger: originalTrigger } = mutationResponse;
29160
- const stableProxiedTrigger = (0, import_react154.useCallback)(
29161
- (...triggerParameters) => __async(this, null, function* () {
29136
+ const stableProxiedTrigger = (0, import_react155.useCallback)(
29137
+ (...triggerParameters) => __async(null, null, function* () {
29162
29138
  const result = yield originalTrigger(...triggerParameters);
29163
29139
  if (result) {
29164
29140
  yield mutate((key) => withSWRKeyTags(
@@ -29181,7 +29157,7 @@ function useUpdateBusiness() {
29181
29157
  }
29182
29158
 
29183
29159
  // src/components/BusinessForm/useBusinessForm.ts
29184
- var import_react155 = require("react");
29160
+ var import_react156 = require("react");
29185
29161
  var getPerson = (personnel) => {
29186
29162
  const owners = personnel == null ? void 0 : personnel.filter((p) => p.roles.find((x) => x.role === "OWNER"));
29187
29163
  if (owners && owners.length > 0) {
@@ -29192,7 +29168,7 @@ var getPerson = (personnel) => {
29192
29168
  var useBusinessForm = ({ onSuccess }) => {
29193
29169
  var _a, _b, _c, _d, _e, _f, _g, _h, _i;
29194
29170
  const { business } = useLayerContext();
29195
- const [submitError, setSubmitError] = (0, import_react155.useState)(void 0);
29171
+ const [submitError, setSubmitError] = (0, import_react156.useState)(void 0);
29196
29172
  const { data: personnel } = useBusinessPersonnel();
29197
29173
  const person = getPerson(personnel);
29198
29174
  const { trigger: createBusinessPersonnel2 } = useCreateBusinessPersonnel();
@@ -29209,7 +29185,7 @@ var useBusinessForm = ({ onSuccess }) => {
29209
29185
  us_state: (_i = business == null ? void 0 : business.us_state) != null ? _i : void 0,
29210
29186
  tin: business == null ? void 0 : business.tin
29211
29187
  },
29212
- onSubmit: (_0) => __async(void 0, [_0], function* ({ value }) {
29188
+ onSubmit: (_0) => __async(null, [_0], function* ({ value }) {
29213
29189
  var _a2;
29214
29190
  try {
29215
29191
  setSubmitError(void 0);
@@ -29608,7 +29584,7 @@ var PLATFORM_ONBOARDING_STEPS = [
29608
29584
  }
29609
29585
  ];
29610
29586
  var PlatformOnboarding = ({ onComplete }) => {
29611
- const [step, setStep] = (0, import_react156.useState)(PLATFORM_ONBOARDING_STEPS[0].id);
29587
+ const [step, setStep] = (0, import_react157.useState)(PLATFORM_ONBOARDING_STEPS[0].id);
29612
29588
  const isFirstStep = PLATFORM_ONBOARDING_STEPS[0].id === step;
29613
29589
  const nextStep = () => {
29614
29590
  const currentStepIndex = PLATFORM_ONBOARDING_STEPS.findIndex((s) => s.id === step);
@@ -29770,7 +29746,7 @@ var BookkeepingUpsellBar = ({
29770
29746
  };
29771
29747
 
29772
29748
  // src/views/BookkeepingOverview/BookkeepingOverview.tsx
29773
- var import_react158 = require("react");
29749
+ var import_react159 = require("react");
29774
29750
 
29775
29751
  // src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
29776
29752
  var import_jsx_runtime268 = require("react/jsx-runtime");
@@ -29785,15 +29761,15 @@ function BookkeepingProfitAndLossSummariesContainer({
29785
29761
  var import_classnames75 = __toESM(require("classnames"));
29786
29762
 
29787
29763
  // src/views/BookkeepingOverview/useKeepInMobileViewport.tsx
29788
- var import_react157 = require("react");
29764
+ var import_react158 = require("react");
29789
29765
  var TASKS_MOBILE_VIEWPORT_WIDTH = 1100;
29790
29766
  var useKeepInMobileViewport = () => {
29791
- const upperContentRef = (0, import_react157.useRef)(null);
29792
- const targetElementRef = (0, import_react157.useRef)(null);
29793
- const lastKnownSizeRef = (0, import_react157.useRef)(null);
29794
- const lastKnownTargetPositionRef = (0, import_react157.useRef)(null);
29795
- const upperElementInFocus = (0, import_react157.useRef)(false);
29796
- (0, import_react157.useEffect)(() => {
29767
+ const upperContentRef = (0, import_react158.useRef)(null);
29768
+ const targetElementRef = (0, import_react158.useRef)(null);
29769
+ const lastKnownSizeRef = (0, import_react158.useRef)(null);
29770
+ const lastKnownTargetPositionRef = (0, import_react158.useRef)(null);
29771
+ const upperElementInFocus = (0, import_react158.useRef)(false);
29772
+ (0, import_react158.useEffect)(() => {
29797
29773
  if (!upperContentRef.current || !targetElementRef.current) return;
29798
29774
  lastKnownSizeRef.current = upperContentRef.current.getBoundingClientRect().height;
29799
29775
  lastKnownTargetPositionRef.current = targetElementRef.current.getBoundingClientRect().top;
@@ -29850,7 +29826,7 @@ var BookkeepingOverview = ({
29850
29826
  slotProps
29851
29827
  }) => {
29852
29828
  var _a, _b, _c, _d, _e, _f;
29853
- const [pnlToggle, setPnlToggle] = (0, import_react158.useState)("expenses");
29829
+ const [pnlToggle, setPnlToggle] = (0, import_react159.useState)("expenses");
29854
29830
  const [width] = useWindowSize();
29855
29831
  const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
29856
29832
  const { upperContentRef, targetElementRef, upperElementInFocus } = useKeepInMobileViewport();
@@ -29981,7 +29957,7 @@ var BookkeepingOverview = ({
29981
29957
  };
29982
29958
 
29983
29959
  // src/views/AccountingOverview/AccountingOverview.tsx
29984
- var import_react159 = require("react");
29960
+ var import_react160 = require("react");
29985
29961
  var import_classnames76 = __toESM(require("classnames"));
29986
29962
  var import_jsx_runtime270 = require("react/jsx-runtime");
29987
29963
  var AccountingOverview = ({
@@ -29997,7 +29973,7 @@ var AccountingOverview = ({
29997
29973
  slotProps
29998
29974
  }) => {
29999
29975
  var _a, _b, _c, _d, _e;
30000
- const [pnlToggle, setPnlToggle] = (0, import_react159.useState)("expenses");
29976
+ const [pnlToggle, setPnlToggle] = (0, import_react160.useState)("expenses");
30001
29977
  const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
30002
29978
  return /* @__PURE__ */ (0, import_jsx_runtime270.jsx)(
30003
29979
  ProfitAndLoss,
@@ -30164,7 +30140,7 @@ var BankTransactionsWithLinkedAccounts = ({
30164
30140
  };
30165
30141
 
30166
30142
  // src/views/GeneralLedger/GeneralLedger.tsx
30167
- var import_react160 = require("react");
30143
+ var import_react161 = require("react");
30168
30144
  var import_jsx_runtime272 = require("react/jsx-runtime");
30169
30145
  var GeneralLedgerView = ({
30170
30146
  title,
@@ -30173,7 +30149,7 @@ var GeneralLedgerView = ({
30173
30149
  stringOverrides,
30174
30150
  chartOfAccountsOptions
30175
30151
  }) => {
30176
- const [activeTab, setActiveTab] = (0, import_react160.useState)("chartOfAccounts");
30152
+ const [activeTab, setActiveTab] = (0, import_react161.useState)("chartOfAccounts");
30177
30153
  return /* @__PURE__ */ (0, import_jsx_runtime272.jsx)(ProfitAndLoss, { asContainer: false, children: /* @__PURE__ */ (0, import_jsx_runtime272.jsxs)(
30178
30154
  View,
30179
30155
  {
@@ -30215,7 +30191,7 @@ var GeneralLedgerView = ({
30215
30191
  };
30216
30192
 
30217
30193
  // src/views/ProjectProfitability/ProjectProfitability.tsx
30218
- var import_react161 = require("react");
30194
+ var import_react162 = require("react");
30219
30195
  var import_react_select5 = __toESM(require("react-select"));
30220
30196
  var import_jsx_runtime273 = require("react/jsx-runtime");
30221
30197
  var ProjectProfitabilityView = ({
@@ -30225,9 +30201,9 @@ var ProjectProfitabilityView = ({
30225
30201
  datePickerMode = "monthPicker",
30226
30202
  csvMoneyFormat = "DOLLAR_STRING"
30227
30203
  }) => {
30228
- const [activeTab, setActiveTab] = (0, import_react161.useState)("overview");
30229
- const [tagFilter, setTagFilter] = (0, import_react161.useState)(null);
30230
- const [pnlTagFilter, setPnlTagFilter] = (0, import_react161.useState)(
30204
+ const [activeTab, setActiveTab] = (0, import_react162.useState)("overview");
30205
+ const [tagFilter, setTagFilter] = (0, import_react162.useState)(null);
30206
+ const [pnlTagFilter, setPnlTagFilter] = (0, import_react162.useState)(
30231
30207
  void 0
30232
30208
  );
30233
30209
  const isOptionSelected = (option, selectValue) => {
@@ -30326,7 +30302,7 @@ var ProjectProfitabilityView = ({
30326
30302
  };
30327
30303
 
30328
30304
  // src/views/Reports/Reports.tsx
30329
- var import_react162 = require("react");
30305
+ var import_react163 = require("react");
30330
30306
  var import_jsx_runtime274 = require("react/jsx-runtime");
30331
30307
  var getOptions = (enabledReports) => {
30332
30308
  return [
@@ -30354,7 +30330,7 @@ var Reports = ({
30354
30330
  statementOfCashFlowConfig
30355
30331
  }) => {
30356
30332
  var _a;
30357
- const [activeTab, setActiveTab] = (0, import_react162.useState)(enabledReports[0]);
30333
+ const [activeTab, setActiveTab] = (0, import_react163.useState)(enabledReports[0]);
30358
30334
  const { view, containerRef } = useElementViewSize();
30359
30335
  const options = getOptions(enabledReports);
30360
30336
  const defaultTitle4 = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
@@ -30416,11 +30392,11 @@ var ReportsPanel = ({
30416
30392
  };
30417
30393
 
30418
30394
  // src/components/ProfitAndLossView/ProfitAndLossView.tsx
30419
- var import_react163 = require("react");
30395
+ var import_react164 = require("react");
30420
30396
  var import_jsx_runtime275 = require("react/jsx-runtime");
30421
30397
  var COMPONENT_NAME7 = "profit-and-loss";
30422
30398
  var ProfitAndLossView = (props) => {
30423
- const containerRef = (0, import_react163.useRef)(null);
30399
+ const containerRef = (0, import_react164.useRef)(null);
30424
30400
  return /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(Container, { name: COMPONENT_NAME7, ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ProfitAndLoss, { children: /* @__PURE__ */ (0, import_jsx_runtime275.jsx)(ProfitAndLossPanel, __spreadValues({ containerRef }, props)) }) });
30425
30401
  };
30426
30402
  var ProfitAndLossPanel = (_a) => {
@@ -30431,7 +30407,7 @@ var ProfitAndLossPanel = (_a) => {
30431
30407
  "containerRef",
30432
30408
  "stringOverrides"
30433
30409
  ]);
30434
- const { sidebarScope } = (0, import_react163.useContext)(ProfitAndLoss.Context);
30410
+ const { sidebarScope } = (0, import_react164.useContext)(ProfitAndLoss.Context);
30435
30411
  return /* @__PURE__ */ (0, import_jsx_runtime275.jsxs)(
30436
30412
  Panel,
30437
30413
  {
@@ -30462,7 +30438,7 @@ var Components = ({
30462
30438
  hideTable = false,
30463
30439
  stringOverrides
30464
30440
  }) => {
30465
- const { error, isLoading, isValidating, refetch } = (0, import_react163.useContext)(
30441
+ const { error, isLoading, isValidating, refetch } = (0, import_react164.useContext)(
30466
30442
  ProfitAndLoss.Context
30467
30443
  );
30468
30444
  if (!isLoading && error) {