@layerfi/components 0.1.131-alpha → 0.1.131

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.
@@ -20,7 +20,7 @@ import { FloatingPortal, autoUpdate, flip, offset, shift, useDismiss, useFloatin
20
20
  import { CalendarDate, ZonedDateTime, fromDate, getLocalTimeZone, parseDate, toCalendarDate, today } from "@internationalized/date";
21
21
  import { mergeRefs } from "react-merge-refs";
22
22
  import useResizeObserver from "@react-hook/resize-observer";
23
- import { AlertCircle, AlertTriangle, Archive, ArchiveRestore, ArrowRight, Briefcase, Car, Check, CheckCircle, CheckIcon, ChevronLeft, ChevronRight, Circle, CircleAlert, Clock, Clock3, CopyIcon, Edit, ExternalLink, FileDownIcon, FileSpreadsheet, FileText, HandCoins, Hourglass, Info, Layers2Icon, List, LoaderCircle, Lock, Menu as Menu$1, MenuIcon, Minus, PencilRuler, Play, Plus, RefreshCcw, RotateCcw, Save, Search, SearchX, Trash, Trash2, TriangleAlert, UploadCloud, UserRoundPen, Video, X, XCircle } from "lucide-react";
23
+ import { AlertCircle, AlertTriangle, Archive, ArchiveRestore, ArrowRight, ArrowUpRight, Briefcase, Car, Check, CheckCircle, CheckIcon, ChevronLeft, ChevronRight, Circle, Clock, Clock3, CopyIcon, Edit, ExternalLink, FileDownIcon, FileSpreadsheet, FileText, HandCoins, Hourglass, Info, Layers2Icon, List, LoaderCircle, Lock, Menu as Menu$1, MenuIcon, Minus, PencilRuler, Play, Plus, RefreshCcw, RotateCcw, Save, Search, SearchX, Trash, Trash2, TriangleAlert, UploadCloud, UserRoundPen, Video, X, XCircle, XIcon } from "lucide-react";
24
24
  import { DurationFormat } from "@formatjs/intl-durationformat";
25
25
  import Select, { components } from "react-select";
26
26
  import CreatableSelect from "react-select/creatable";
@@ -216,7 +216,7 @@ var getIntlLocale = (locale) => {
216
216
  };
217
217
  var package_default = {
218
218
  name: "@layerfi/components",
219
- version: "0.1.131-alpha",
219
+ version: "0.1.131",
220
220
  description: "Layer React Components",
221
221
  main: "dist/cjs/index.cjs",
222
222
  module: "dist/esm/index.mjs",
@@ -661,7 +661,7 @@ function _requestOAuthToken() {
661
661
  return _requestOAuthToken.apply(this, arguments);
662
662
  }
663
663
  var AUTH_TAG_KEY = "#auth";
664
- function buildKey$90({ appId, appSecret, businessAccessToken, apiUrl, authUrl, scope }) {
664
+ function buildKey$89({ appId, appSecret, businessAccessToken, apiUrl, authUrl, scope }) {
665
665
  if (businessAccessToken) return {
666
666
  apiUrl,
667
667
  businessAccessToken,
@@ -684,7 +684,7 @@ var FALLBACK_REFRESH_MS = DEFAULT_EXPIRES_IN_SECONDS / 2 * 1e3;
684
684
  function useAuth() {
685
685
  const { apiUrl, authUrl, scope } = useEnvironment();
686
686
  const { appId, appSecret, businessAccessToken } = useAuthInput();
687
- return useSWR(() => buildKey$90({
687
+ return useSWR(() => buildKey$89({
688
688
  appId,
689
689
  appSecret,
690
690
  businessAccessToken,
@@ -732,7 +732,7 @@ var useLayerContext = () => {
732
732
  var BANK_ACCOUNTS_TAG_KEY = "#bank-accounts";
733
733
  var requiresNotification = (bankAccount) => bankAccount.is_disconnected && bankAccount.notify_when_disconnected;
734
734
  var listBankAccounts = get(({ businessId }) => `/v1/businesses/${businessId}/bank-accounts`);
735
- function buildKey$89({ access_token: accessToken, apiUrl, businessId }) {
735
+ function buildKey$88({ access_token: accessToken, apiUrl, businessId }) {
736
736
  if (accessToken && apiUrl) return {
737
737
  accessToken,
738
738
  apiUrl,
@@ -753,7 +753,7 @@ function useListBankAccounts() {
753
753
  const { businessId } = useLayerContext();
754
754
  const { apiUrl } = useEnvironment();
755
755
  const { data: auth } = useAuth();
756
- return new ListBankAccountsSWRResponse(useSWR(() => buildKey$89(_objectSpread2(_objectSpread2({}, auth), {}, {
756
+ return new ListBankAccountsSWRResponse(useSWR(() => buildKey$88(_objectSpread2(_objectSpread2({}, auth), {}, {
757
757
  apiUrl,
758
758
  businessId
759
759
  })), ({ accessToken, apiUrl, businessId }) => listBankAccounts(apiUrl, accessToken, { params: { businessId } })().then(({ data }) => data)));
@@ -777,16 +777,20 @@ var bankTransactions_default$1 = {
777
777
  "download_transactions": "Download transactions",
778
778
  "manage_categorization_rules": "Manage categorization rules",
779
779
  "mark_as_personal": "Mark as Personal",
780
+ "no_tax_code": "No tax code",
780
781
  "or_find_match": "or find match",
781
782
  "or_split_transaction": "or split transaction",
782
783
  "recategorize_all": "Recategorize All",
783
784
  "search_categories": "Search categories...",
785
+ "search_tax_codes": "Search tax codes...",
784
786
  "select_a_category": "Select a category",
785
787
  "select_a_match": "Select a match",
786
788
  "select_category": "Select category",
789
+ "select_tax_code": "Select tax code",
787
790
  "set_transaction_customer_vendor": "Set transaction customer or vendor",
788
791
  "show_all_categories": "Show all categories",
789
792
  "split_label": "Split",
793
+ "split_number_label": "Split #{{number}}",
790
794
  "split_transaction": "Split transaction",
791
795
  "uncategorize_all": "Uncategorize All",
792
796
  "upload_receipt": "Upload receipt",
@@ -848,6 +852,7 @@ var bankTransactions_default$1 = {
848
852
  "selected_counterparty": "this counterparty",
849
853
  "suggested_category": "Suggested category",
850
854
  "suggestions_uppercase": "SUGGESTIONS",
855
+ "tax_code": "Tax Code",
851
856
  "this_will_confirm_count_transactions_one": "This will confirm {{displayCount}} transaction.",
852
857
  "this_will_confirm_count_transactions_other": "This will confirm {{displayCount}} transactions.",
853
858
  "to_review": "To Review",
@@ -1203,6 +1208,7 @@ var common_default$1 = {
1203
1208
  "uncategorized": "Uncategorized",
1204
1209
  "unsaved_changes_lost": "Any unsaved changes will be lost.",
1205
1210
  "value": "Value",
1211
+ "view_label": "View",
1206
1212
  "yes": "Yes"
1207
1213
  },
1208
1214
  state: {
@@ -1662,6 +1668,7 @@ var mileageTracking_default$1 = {
1662
1668
  },
1663
1669
  label: {
1664
1670
  "deduction_colon": "Deduction:",
1671
+ "in_year": "In {{year}}",
1665
1672
  "mileage_tracking": "Mileage Tracking",
1666
1673
  "miles_colon": "Miles:",
1667
1674
  "miles_month": "Miles this month",
@@ -1748,14 +1755,7 @@ var tags_default$1 = {
1748
1755
  "select_dimension_name": "Select {{dimensionName}}",
1749
1756
  "select_tags": "Select tags"
1750
1757
  },
1751
- empty: { "matching_tags": "No matching tags found" },
1752
- error: { "load_tag_options": "An error occurred while loading tag options." },
1753
- label: {
1754
- "active_tags": "Active Tags",
1755
- "add_tag_to_transaction": "Add a tag to this transaction...",
1756
- "tag_label_archived": "{{label}} (Archived)",
1757
- "tags": "Tags"
1758
- }
1758
+ label: { "tag_label_archived": "{{label}} (Archived)" }
1759
1759
  };
1760
1760
  var taxEstimates_default$1 = {
1761
1761
  action: {
@@ -1764,8 +1764,12 @@ var taxEstimates_default$1 = {
1764
1764
  "update_tax_profile": "Update tax profile"
1765
1765
  },
1766
1766
  banner: { "categorization_incomplete": {
1767
- "description_one": "You have {{count}} uncategorized transaction with {{amount}} in potential deductions to review.",
1768
- "description_other": "You have {{count}} uncategorized transactions with {{amount}} in potential deductions to review.",
1767
+ "description_one": "In tax year {{year}}, you have {{count}} uncategorized transaction with potentially {{deductions}} in deductions and {{income}} in unrecognized income. Review and categorize your transactions for more accurate estimates.",
1768
+ "description_other": "In tax year {{year}}, you have {{count}} uncategorized transactions with potentially {{deductions}} in deductions and {{income}} in unrecognized income. Review and categorize your transactions for more accurate estimates.",
1769
+ "description_short_one": "You have {{count}} uncategorized transaction: {{deductions}} in deductions and {{income}} in unrecognized income.",
1770
+ "description_short_other": "You have {{count}} uncategorized transactions: {{deductions}} in deductions and {{income}} in unrecognized income.",
1771
+ "description_with_range_one": "In tax year {{year}}, you have {{count}} uncategorized transaction spanning {{dateRange}} with potentially {{deductions}} in deductions and {{income}} in unrecognized income. Review and categorize your transactions for more accurate estimates.",
1772
+ "description_with_range_other": "In tax year {{year}}, you have {{count}} uncategorized transactions spanning from {{dateRange}} with potentially {{deductions}} in deductions and {{income}} in unrecognized income. Review and categorize your transactions for more accurate estimates.",
1769
1773
  "title": "Your tax estimates are incomplete"
1770
1774
  } },
1771
1775
  disclaimer: {
@@ -1775,6 +1779,8 @@ var taxEstimates_default$1 = {
1775
1779
  empty: {
1776
1780
  "no_tax_details": "No tax details",
1777
1781
  "no_tax_details_description": "No tax details found",
1782
+ "no_tax_estimates_summary": "Get started with your tax estimates",
1783
+ "no_tax_estimates_summary_description": "Start by importing and categorizing your bank transactions",
1778
1784
  "no_tax_payments_to_display": "There are no tax payments to display.",
1779
1785
  "tax_payments": "No tax payments found"
1780
1786
  },
@@ -2216,16 +2222,20 @@ var bankTransactions_default = {
2216
2222
  "download_transactions": "Télécharger les transactions",
2217
2223
  "manage_categorization_rules": "Gérer les règles de catégorisation",
2218
2224
  "mark_as_personal": "Marquer comme personnel",
2225
+ "no_tax_code": "Aucun code de taxe",
2219
2226
  "or_find_match": "ou trouver une correspondance",
2220
2227
  "or_split_transaction": "ou répartir la transaction",
2221
2228
  "recategorize_all": "Tout recatégoriser",
2222
2229
  "search_categories": "Rechercher des catégories...",
2230
+ "search_tax_codes": "Rechercher des codes de taxe...",
2223
2231
  "select_a_category": "Sélectionner une catégorie",
2224
2232
  "select_a_match": "Sélectionner une correspondance",
2225
2233
  "select_category": "Sélectionner une catégorie",
2234
+ "select_tax_code": "Sélectionner un code de taxe",
2226
2235
  "set_transaction_customer_vendor": "Définir le client ou le fournisseur de la transaction",
2227
2236
  "show_all_categories": "Afficher toutes les catégories",
2228
2237
  "split_label": "Répartir",
2238
+ "split_number_label": "Ventilation no {{number}}",
2229
2239
  "split_transaction": "Répartir la transaction",
2230
2240
  "uncategorize_all": "Tout décatégoriser",
2231
2241
  "upload_receipt": "Téléverser un reçu",
@@ -2287,6 +2297,7 @@ var bankTransactions_default = {
2287
2297
  "selected_counterparty": "cette contrepartie",
2288
2298
  "suggested_category": "Catégorie suggérée",
2289
2299
  "suggestions_uppercase": "SUGGESTIONS",
2300
+ "tax_code": "Code de taxe",
2290
2301
  "this_will_confirm_count_transactions_one": "Cette action confirmera {{displayCount}} transaction.",
2291
2302
  "this_will_confirm_count_transactions_other": "Cette action confirmera {{displayCount}} transactions.",
2292
2303
  "to_review": "À examiner",
@@ -2642,6 +2653,7 @@ var common_default = {
2642
2653
  "uncategorized": "Sans catégorie",
2643
2654
  "unsaved_changes_lost": "Toute modification non enregistrée sera perdue.",
2644
2655
  "value": "Valeur",
2656
+ "view_label": "Voir",
2645
2657
  "yes": "Oui"
2646
2658
  },
2647
2659
  state: {
@@ -3101,6 +3113,7 @@ var mileageTracking_default = {
3101
3113
  },
3102
3114
  label: {
3103
3115
  "deduction_colon": "Déduction :",
3116
+ "in_year": "En {{year}}",
3104
3117
  "mileage_tracking": "Suivi du kilométrage",
3105
3118
  "miles_colon": "Kilométrage\xA0:",
3106
3119
  "miles_month": "Kilométrage ce mois-ci",
@@ -3187,14 +3200,7 @@ var tags_default = {
3187
3200
  "select_dimension_name": "Sélectionner {{dimensionName}}",
3188
3201
  "select_tags": "Sélectionner des étiquettes"
3189
3202
  },
3190
- empty: { "matching_tags": "Aucune étiquette correspondante trouvée" },
3191
- error: { "load_tag_options": "Une erreur s’est produite lors du chargement des options d’étiquette." },
3192
- label: {
3193
- "active_tags": "Étiquettes actives",
3194
- "add_tag_to_transaction": "Ajouter une étiquette à cette transaction...",
3195
- "tag_label_archived": "{{label}} (Archivé)",
3196
- "tags": "Étiquettes"
3197
- }
3203
+ label: { "tag_label_archived": "{{label}} (Archivé)" }
3198
3204
  };
3199
3205
  var taxEstimates_default = {
3200
3206
  action: {
@@ -3203,8 +3209,12 @@ var taxEstimates_default = {
3203
3209
  "update_tax_profile": "Mettre à jour le profil fiscal"
3204
3210
  },
3205
3211
  banner: { "categorization_incomplete": {
3206
- "description_one": "Vous avez {{count}} transaction non catégorisée avec {{amount}} en déductions potentielles à examiner.",
3207
- "description_other": "Vous avez {{count}} transactions non catégorisées avec {{amount}} en déductions potentielles à examiner.",
3212
+ "description_one": "Au cours de l’année d’imposition {{year}}, vous avez {{count}} transaction non catégorisée, avec potentiellement {{deductions}} en déductions et {{income}} en revenus non reconnus. Passez vos transactions en revue et catégorisez-les pour obtenir des estimations plus précises.",
3213
+ "description_other": "Au cours de l’année d’imposition {{year}}, vous avez {{count}} transactions non catégorisées, avec potentiellement {{deductions}} en déductions et {{income}} en revenus non reconnus. Passez vos transactions en revue et catégorisez-les pour obtenir des estimations plus précises.",
3214
+ "description_short_one": "Vous avez {{count}} transaction non catégorisée : {{deductions}} en déductions et {{income}} en revenus non reconnus.",
3215
+ "description_short_other": "Vous avez {{count}} transactions non catégorisées: {{deductions}} en déductions et {{income}} en revenus non reconnus.",
3216
+ "description_with_range_one": "Au cours de l’année d’imposition {{year}}, vous avez {{count}} transaction non catégorisée couvrant la période {{dateRange}}, avec potentiellement {{deductions}} en déductions et {{income}} en revenus non reconnus. Passez vos transactions en revue et catégorisez-les pour obtenir des estimations plus précises.",
3217
+ "description_with_range_other": "Au cours de l’année d’imposition {{year}}, vous avez {{count}} transactions non catégorisées pour la période {{dateRange}}, avec potentiellement {{deductions}} en déductions et {{income}} en revenus non reconnus. Passez vos transactions en revue et catégorisez-les pour obtenir des estimations plus précises.",
3208
3218
  "title": "Vos estimations fiscales sont incomplètes"
3209
3219
  } },
3210
3220
  disclaimer: {
@@ -3214,6 +3224,8 @@ var taxEstimates_default = {
3214
3224
  empty: {
3215
3225
  "no_tax_details": "Aucun détail fiscal",
3216
3226
  "no_tax_details_description": "Aucun détail fiscal trouvé",
3227
+ "no_tax_estimates_summary": "Commencez vos estimations d’impôt",
3228
+ "no_tax_estimates_summary_description": "Commencez par importer et catégoriser vos opérations bancaires",
3217
3229
  "no_tax_payments_to_display": "Il n’y a aucun paiement d’impôt à afficher.",
3218
3230
  "tax_payments": "Aucun paiement d’impôt trouvé"
3219
3231
  },
@@ -3747,7 +3759,7 @@ var useLocalizedKey = () => {
3747
3759
  var _excluded$117 = ["trigger"];
3748
3760
  var UNLINK_BANK_ACCOUNT_TAG_KEY = "#unlink-bank-account";
3749
3761
  var unlinkBankAccount = del(({ businessId, bankAccountId }) => `/v1/businesses/${businessId}/bank-accounts/${bankAccountId}`);
3750
- function buildKey$88({ access_token: accessToken, apiUrl, businessId }) {
3762
+ function buildKey$87({ access_token: accessToken, apiUrl, businessId }) {
3751
3763
  if (accessToken && apiUrl) return {
3752
3764
  accessToken,
3753
3765
  apiUrl,
@@ -3760,7 +3772,7 @@ function useUnlinkBankAccount() {
3760
3772
  const { businessId } = useLayerContext();
3761
3773
  const { apiUrl } = useEnvironment();
3762
3774
  const { data: auth } = useAuth();
3763
- const _useSWRMutation = useSWRMutation(() => withLocale(buildKey$88({
3775
+ const _useSWRMutation = useSWRMutation(() => withLocale(buildKey$87({
3764
3776
  access_token: auth === null || auth === void 0 ? void 0 : auth.access_token,
3765
3777
  apiUrl,
3766
3778
  businessId
@@ -5068,6 +5080,9 @@ var SplitAsOption = class extends BaseCategorizationOption {
5068
5080
  get type() {
5069
5081
  return CategorizationOption.Split;
5070
5082
  }
5083
+ get isSingleSplit() {
5084
+ return this.internalValue.length === 1;
5085
+ }
5071
5086
  get label() {
5072
5087
  return this.internalValue.map((split) => {
5073
5088
  var _split$category$label, _split$category;
@@ -5075,7 +5090,7 @@ var SplitAsOption = class extends BaseCategorizationOption {
5075
5090
  }).join(", ");
5076
5091
  }
5077
5092
  get value() {
5078
- if (this.internalValue.length == 1) {
5093
+ if (this.isSingleSplit) {
5079
5094
  var _this$internalValue$, _this$internalValue$2;
5080
5095
  return (_this$internalValue$ = (_this$internalValue$2 = this.internalValue[0].category) === null || _this$internalValue$2 === void 0 ? void 0 : _this$internalValue$2.value) !== null && _this$internalValue$ !== void 0 ? _this$internalValue$ : "";
5081
5096
  }
@@ -5137,57 +5152,38 @@ var isPlaceholderAsOption = (option) => {
5137
5152
  return option.type === CategorizationOption.Placeholder;
5138
5153
  };
5139
5154
  //#endregion
5140
- //#region src/components/TaxCodeSelect/taxCodeComboBoxOption.ts
5141
- var NO_TAX_CODE = "__no_tax_code__";
5142
- var TaxCodeComboBoxOption = class TaxCodeComboBoxOption extends BaseComboBoxOption {
5143
- constructor(taxOption) {
5144
- super(taxOption);
5145
- }
5146
- static noTaxCode(label) {
5147
- return new TaxCodeComboBoxOption({
5148
- code: NO_TAX_CODE,
5149
- display_name: label
5150
- });
5151
- }
5152
- get original() {
5153
- return this.internalValue;
5154
- }
5155
- get label() {
5156
- return this.internalValue.display_name;
5157
- }
5158
- get value() {
5159
- return this.internalValue.code;
5160
- }
5161
- };
5162
- //#endregion
5163
5155
  //#region src/utils/bankTransactions/taxCode.ts
5164
5156
  var getBankTransactionTaxOptions = (bankTransaction) => {
5165
5157
  if (!(bankTransaction === null || bankTransaction === void 0 ? void 0 : bankTransaction.tax_options)) return [];
5166
5158
  return Object.values(bankTransaction.tax_options).flat();
5167
5159
  };
5168
- var getDefaultTaxCodeOptionForBankTransaction = (bankTransaction) => {
5160
+ var getDefaultTaxCodeForBankTransaction = (bankTransaction) => {
5169
5161
  const taxCode = bankTransaction === null || bankTransaction === void 0 ? void 0 : bankTransaction.tax_code;
5170
5162
  if (!taxCode) return null;
5171
- const option = getBankTransactionTaxOptions(bankTransaction).find((option) => option.code === taxCode);
5172
- return option ? new TaxCodeComboBoxOption(option) : null;
5163
+ return getBankTransactionTaxOptions(bankTransaction).some((option) => option.code === taxCode) ? taxCode : null;
5173
5164
  };
5174
5165
  var hasBankTransactionTaxCode = (bankTransaction, selectedTaxCode) => {
5175
5166
  if (!selectedTaxCode) return false;
5176
- return getBankTransactionTaxOptions(bankTransaction).some((taxOption) => taxOption.code === selectedTaxCode.value);
5167
+ return getBankTransactionTaxOptions(bankTransaction).some((taxOption) => taxOption.code === selectedTaxCode);
5177
5168
  };
5178
5169
  var getCategoryPayloadTaxCode = (selectedCategory, selectedTaxCode) => {
5179
- var _selectedTaxCode$valu;
5180
5170
  if (!canCategoryHaveTaxCode(selectedCategory)) return null;
5181
- return (_selectedTaxCode$valu = selectedTaxCode === null || selectedTaxCode === void 0 ? void 0 : selectedTaxCode.value) !== null && _selectedTaxCode$valu !== void 0 ? _selectedTaxCode$valu : null;
5171
+ return selectedTaxCode !== null && selectedTaxCode !== void 0 ? selectedTaxCode : null;
5182
5172
  };
5183
5173
  var canCategoryHaveTaxCode = (category) => {
5184
5174
  if (!category) return true;
5185
5175
  if (isPlaceholderAsOption(category)) return false;
5186
5176
  if (isSuggestedMatchAsOption(category)) return false;
5187
- if (isSplitAsOption(category)) return false;
5188
- if (!category.classification) return false;
5189
- if (isClassificationExclusion(category.classification)) return false;
5190
- return true;
5177
+ if (isSplitAsOption(category)) {
5178
+ if (category.isSingleSplit) {
5179
+ var _category$original$0$;
5180
+ const classification = (_category$original$0$ = category.original[0].category) === null || _category$original$0$ === void 0 ? void 0 : _category$original$0$.classification;
5181
+ return !!classification && !isClassificationExclusion(classification);
5182
+ }
5183
+ return false;
5184
+ }
5185
+ const classification = category.classification;
5186
+ return !!classification && !isClassificationExclusion(classification);
5191
5187
  };
5192
5188
  var resolveCategoryTaxCode = (bankTransaction, selectedCategory, selectedTaxCode) => {
5193
5189
  return getCategoryPayloadTaxCode(selectedCategory, hasBankTransactionTaxCode(bankTransaction, selectedTaxCode) ? selectedTaxCode : null);
@@ -5238,7 +5234,11 @@ function buildStore$2() {
5238
5234
  });
5239
5235
  },
5240
5236
  setTransactionCategorySelection: (id, category) => {
5241
- set(({ categorizations }) => updateCategorizationProperty(categorizations, id, "category", category));
5237
+ set(({ categorizations }) => {
5238
+ const { categorizations: nextCategorizations } = updateCategorizationProperty(categorizations, id, "category", category);
5239
+ if (category && !canCategoryHaveTaxCode(category)) return updateCategorizationProperty(nextCategorizations, id, "taxCode", null);
5240
+ return { categorizations: nextCategorizations };
5241
+ });
5242
5242
  },
5243
5243
  setTransactionMatchSelection: (id, match) => {
5244
5244
  set(({ categorizations }) => updateCategorizationProperty(categorizations, id, "match", match));
@@ -5878,7 +5878,7 @@ var buildCategorizeBankTransactionPayloadForSplit = (splits) => {
5878
5878
  var getDefaultCategorizationForBankTransaction = (bankTransaction) => {
5879
5879
  return {
5880
5880
  category: getDefaultSelectedCategoryForBankTransaction(bankTransaction),
5881
- taxCode: getDefaultTaxCodeOptionForBankTransaction(bankTransaction),
5881
+ taxCode: getDefaultTaxCodeForBankTransaction(bankTransaction),
5882
5882
  match: getDefaultSuggestedMatchForBankTransaction(bankTransaction),
5883
5883
  variant: getDefaultVariantForBankTransaction(bankTransaction)
5884
5884
  };
@@ -6131,7 +6131,7 @@ var getBookkeepingStatus = get(({ businessId }) => {
6131
6131
  });
6132
6132
  var BOOKKEEPING_TAG_KEY = "#bookkeeping";
6133
6133
  var BOOKKEEPING_STATUS_TAG_KEY = "#bookkeeping-status";
6134
- function buildKey$87({ access_token: accessToken, apiUrl, businessId }) {
6134
+ function buildKey$86({ access_token: accessToken, apiUrl, businessId }) {
6135
6135
  if (accessToken && apiUrl) return {
6136
6136
  accessToken,
6137
6137
  apiUrl,
@@ -6142,7 +6142,7 @@ function buildKey$87({ access_token: accessToken, apiUrl, businessId }) {
6142
6142
  function useBookkeepingStatus() {
6143
6143
  const { data: auth } = useAuth();
6144
6144
  const { businessId } = useLayerContext();
6145
- return useSWR(() => buildKey$87(_objectSpread2(_objectSpread2({}, auth), {}, { businessId })), ({ accessToken, apiUrl, businessId }) => getBookkeepingStatus(apiUrl, accessToken, { params: { businessId } })().then(Schema.decodeUnknownPromise(BookkeepingStatusResponseSchema)).then(({ data }) => data));
6145
+ return useSWR(() => buildKey$86(_objectSpread2(_objectSpread2({}, auth), {}, { businessId })), ({ accessToken, apiUrl, businessId }) => getBookkeepingStatus(apiUrl, accessToken, { params: { businessId } })().then(Schema.decodeUnknownPromise(BookkeepingStatusResponseSchema)).then(({ data }) => data));
6146
6146
  }
6147
6147
  function useBookkeepingStatusGlobalCacheActions() {
6148
6148
  const { forceReload } = useGlobalCacheActions();
@@ -7361,7 +7361,7 @@ var BREAKPOINTS = {
7361
7361
  //#endregion
7362
7362
  //#region src/hooks/api/businesses/[business-id]/categories/useCategories.ts
7363
7363
  var CATEGORIES_TAG_KEY = "#categories";
7364
- function buildKey$86({ access_token: accessToken, apiUrl, businessId, mode }) {
7364
+ function buildKey$85({ access_token: accessToken, apiUrl, businessId, mode }) {
7365
7365
  if (accessToken && apiUrl) return {
7366
7366
  accessToken,
7367
7367
  apiUrl,
@@ -7377,7 +7377,7 @@ function useCategories({ mode } = {}) {
7377
7377
  const withLocale = useLocalizedKey();
7378
7378
  const { data: auth } = useAuth();
7379
7379
  const { businessId } = useLayerContext();
7380
- return useSWR(() => withLocale(buildKey$86(_objectSpread2(_objectSpread2({}, auth), {}, {
7380
+ return useSWR(() => withLocale(buildKey$85(_objectSpread2(_objectSpread2({}, auth), {}, {
7381
7381
  businessId,
7382
7382
  mode
7383
7383
  }))), ({ accessToken, apiUrl, businessId, mode }) => getCategories(apiUrl, accessToken, { params: {
@@ -7482,7 +7482,7 @@ function useCustomersGlobalCacheActions() {
7482
7482
  //#endregion
7483
7483
  //#region src/hooks/api/businesses/[business-id]/tags/dimensions/useTagDimensions.ts
7484
7484
  var TAG_DIMENSIONS_TAG_KEY = "#tag-dimensions";
7485
- function buildKey$85({ access_token: accessToken, apiUrl, businessId, isEnabled }) {
7485
+ function buildKey$84({ access_token: accessToken, apiUrl, businessId, isEnabled }) {
7486
7486
  if (!isEnabled) return;
7487
7487
  if (accessToken && apiUrl) return {
7488
7488
  accessToken,
@@ -7498,7 +7498,7 @@ function useTagDimensions({ isEnabled = true } = {}) {
7498
7498
  const { data: auth } = useAuth();
7499
7499
  const { apiUrl } = useEnvironment();
7500
7500
  const { businessId } = useLayerContext();
7501
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$85(_objectSpread2(_objectSpread2({}, auth), {}, {
7501
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$84(_objectSpread2(_objectSpread2({}, auth), {}, {
7502
7502
  apiUrl,
7503
7503
  businessId,
7504
7504
  isEnabled
@@ -7901,7 +7901,7 @@ var getBankTransactionsExcel = get(({ businessId, categorized, direction, query,
7901
7901
  sortOrder
7902
7902
  })}`;
7903
7903
  });
7904
- function buildKey$84({ access_token: accessToken, apiUrl, businessId }) {
7904
+ function buildKey$83({ access_token: accessToken, apiUrl, businessId }) {
7905
7905
  if (accessToken && apiUrl) return {
7906
7906
  accessToken,
7907
7907
  apiUrl,
@@ -7913,7 +7913,7 @@ function useBankTransactionsDownload() {
7913
7913
  const withLocale = useLocalizedKey();
7914
7914
  const { data } = useAuth();
7915
7915
  const { businessId } = useLayerContext();
7916
- return useSWRMutation(() => withLocale(buildKey$84(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { categorized, direction, query, startDate, endDate, tagFilterQueryString } }) => getBankTransactionsExcel(apiUrl, accessToken, { params: {
7916
+ return useSWRMutation(() => withLocale(buildKey$83(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { categorized, direction, query, startDate, endDate, tagFilterQueryString } }) => getBankTransactionsExcel(apiUrl, accessToken, { params: {
7917
7917
  businessId,
7918
7918
  categorized,
7919
7919
  query,
@@ -8177,6 +8177,7 @@ var _excluded$101 = [
8177
8177
  "ellipsis",
8178
8178
  "nonAria",
8179
8179
  "noWrap",
8180
+ "numeric",
8180
8181
  "pb",
8181
8182
  "pbe",
8182
8183
  "pbs",
@@ -8186,13 +8187,14 @@ var _excluded$101 = [
8186
8187
  "weight"
8187
8188
  ];
8188
8189
  function splitTextProps(props) {
8189
- const { align, children, ellipsis, nonAria, noWrap, pb, pbe, pbs, size, status, variant, weight } = props, restProps = _objectWithoutProperties(props, _excluded$101);
8190
+ const { align, children, ellipsis, nonAria, noWrap, numeric, pb, pbe, pbs, size, status, variant, weight } = props, restProps = _objectWithoutProperties(props, _excluded$101);
8190
8191
  return {
8191
8192
  children,
8192
8193
  dataProperties: toDataProperties({
8193
8194
  align,
8194
8195
  ellipsis,
8195
8196
  "no-wrap": noWrap,
8197
+ numeric,
8196
8198
  pb,
8197
8199
  pbe,
8198
8200
  pbs,
@@ -9082,7 +9084,7 @@ var getProfitAndLossDetailLines = (apiUrl, accessToken, params) => {
9082
9084
  //#endregion
9083
9085
  //#region src/hooks/api/businesses/[business-id]/reports/profit-and-loss/useProfitAndLossReport.tsx
9084
9086
  var PNL_REPORT_TAG_KEY = "#profit-and-loss-report";
9085
- function buildKey$83({ access_token: accessToken, apiUrl, businessId, startDate, endDate, tagKey, tagValues, reportingBasis, includeUncategorized }) {
9087
+ function buildKey$82({ access_token: accessToken, apiUrl, businessId, startDate, endDate, tagKey, tagValues, reportingBasis, includeUncategorized }) {
9086
9088
  if (accessToken && apiUrl) return {
9087
9089
  accessToken,
9088
9090
  apiUrl,
@@ -9110,7 +9112,7 @@ function useProfitAndLossReport({ startDate, endDate, tagKey, tagValues, reporti
9110
9112
  const withLocale = useLocalizedKey();
9111
9113
  const { data } = useAuth();
9112
9114
  const { businessId } = useLayerContext();
9113
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$83(_objectSpread2(_objectSpread2({}, data), {}, {
9115
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$82(_objectSpread2(_objectSpread2({}, data), {}, {
9114
9116
  businessId,
9115
9117
  startDate,
9116
9118
  endDate,
@@ -9135,7 +9137,7 @@ var useProfitAndLossReportCacheActions = () => {
9135
9137
  //#endregion
9136
9138
  //#region src/hooks/api/businesses/[business-id]/reports/profit-and-loss-comparison/useProfitAndLossComparisonReport.tsx
9137
9139
  var PNL_COMPARISON_REPORT_TAG_KEY = "#profit-and-loss-comparison-report";
9138
- function buildKey$82({ access_token: accessToken, apiUrl, businessId, periods, tagFilters, reportingBasis }) {
9140
+ function buildKey$81({ access_token: accessToken, apiUrl, businessId, periods, tagFilters, reportingBasis }) {
9139
9141
  if (accessToken && apiUrl && periods) return {
9140
9142
  accessToken,
9141
9143
  apiUrl,
@@ -9152,7 +9154,7 @@ function useProfitAndLossComparisonReport({ periods, tagFilters, reportingBasis
9152
9154
  const { data } = useAuth();
9153
9155
  const { businessId } = useLayerContext();
9154
9156
  const { apiUrl } = useEnvironment();
9155
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$82(_objectSpread2(_objectSpread2({}, data), {}, {
9157
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$81(_objectSpread2(_objectSpread2({}, data), {}, {
9156
9158
  apiUrl,
9157
9159
  businessId,
9158
9160
  periods,
@@ -9174,7 +9176,7 @@ var useProfitAndLossComparisonReportCacheActions = () => {
9174
9176
  //#endregion
9175
9177
  //#region src/hooks/api/businesses/[business-id]/reports/profit-and-loss-summaries/useProfitAndLossSummaries.tsx
9176
9178
  var PNL_SUMMARIES_TAG_KEY = "#profit-and-loss-summaries";
9177
- function buildKey$81({ access_token: accessToken, apiUrl, businessId, startMonth, startYear, endMonth, endYear, tagKey, tagValues, reportingBasis }) {
9179
+ function buildKey$80({ access_token: accessToken, apiUrl, businessId, startMonth, startYear, endMonth, endYear, tagKey, tagValues, reportingBasis }) {
9178
9180
  if (accessToken && apiUrl) return {
9179
9181
  accessToken,
9180
9182
  apiUrl,
@@ -9204,7 +9206,7 @@ function useProfitAndLossSummaries({ startYear, startMonth, endYear, endMonth, t
9204
9206
  const withLocale = useLocalizedKey();
9205
9207
  const { data } = useAuth();
9206
9208
  const { businessId } = useLayerContext();
9207
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$81(_objectSpread2(_objectSpread2({}, data), {}, {
9209
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$80(_objectSpread2(_objectSpread2({}, data), {}, {
9208
9210
  businessId,
9209
9211
  startYear,
9210
9212
  startMonth,
@@ -9267,7 +9269,7 @@ var CategorizeTransactionRequestSchema$1 = Schema.Struct({
9267
9269
  });
9268
9270
  var BulkCategorizeRequestSchema = Schema.Struct({ transactions: Schema.Array(CategorizeTransactionRequestSchema$1) });
9269
9271
  var bulkCategorize = post(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/bulk-categorize`);
9270
- function buildKey$80({ access_token: accessToken, apiUrl, businessId }) {
9272
+ function buildKey$79({ access_token: accessToken, apiUrl, businessId }) {
9271
9273
  if (accessToken && apiUrl) return {
9272
9274
  accessToken,
9273
9275
  apiUrl,
@@ -9281,7 +9283,7 @@ var useBulkCategorize = () => {
9281
9283
  const { businessId, eventCallbacks } = useLayerContext();
9282
9284
  const { forceReloadBankTransactions } = useBankTransactionsGlobalCacheActions();
9283
9285
  const { debouncedInvalidateProfitAndLoss } = useProfitAndLossGlobalInvalidator();
9284
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$80(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg }) => bulkCategorize(apiUrl, accessToken, {
9286
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$79(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg }) => bulkCategorize(apiUrl, accessToken, {
9285
9287
  params: { businessId },
9286
9288
  body: Schema.encodeSync(BulkCategorizeRequestSchema)(arg)
9287
9289
  }).then(({ data }) => data), {
@@ -9308,6 +9310,29 @@ var useBulkCategorize = () => {
9308
9310
  } });
9309
9311
  };
9310
9312
  //#endregion
9313
+ //#region src/components/TaxCodeSelect/taxCodeComboBoxOption.ts
9314
+ var NO_TAX_CODE = "__no_tax_code__";
9315
+ var TaxCodeComboBoxOption = class TaxCodeComboBoxOption extends BaseComboBoxOption {
9316
+ constructor(taxOption) {
9317
+ super(taxOption);
9318
+ }
9319
+ static noTaxCode(label) {
9320
+ return new TaxCodeComboBoxOption({
9321
+ code: NO_TAX_CODE,
9322
+ display_name: label
9323
+ });
9324
+ }
9325
+ get original() {
9326
+ return this.internalValue;
9327
+ }
9328
+ get label() {
9329
+ return this.internalValue.display_name;
9330
+ }
9331
+ get value() {
9332
+ return this.internalValue.code;
9333
+ }
9334
+ };
9335
+ //#endregion
9311
9336
  //#region src/hooks/features/bankTransactions/useTaxCodeOptions.ts
9312
9337
  var useTaxCodeOptions = (bankTransaction) => {
9313
9338
  const taxCodeOptions = useMemo(() => getBankTransactionTaxOptions(bankTransaction).map((option) => new TaxCodeComboBoxOption(option)), [bankTransaction]);
@@ -10330,6 +10355,7 @@ function buildCustomSingleValue({ SingleValue }) {
10330
10355
  return function CustomSingleValue(_ref8) {
10331
10356
  let { children } = _ref8, restProps = _objectWithoutProperties(_ref8, _excluded8);
10332
10357
  const defaultRenderedSingleValue = /* @__PURE__ */ jsx(Span, {
10358
+ variant: "inherit",
10333
10359
  ellipsis: true,
10334
10360
  children
10335
10361
  });
@@ -11178,7 +11204,16 @@ var useTaxCodeSelect = ({ options = EMPTY_ARRAY$6, selectedValue, onSelectedValu
11178
11204
  const { t } = useTranslation();
11179
11205
  const noTaxCodeOption = useMemo(() => TaxCodeComboBoxOption.noTaxCode(t("bankTransactions:action.no_tax_code", "No tax code")), [t]);
11180
11206
  const optionsWithNoTaxCode = useMemo(() => [noTaxCodeOption, ...options], [noTaxCodeOption, options]);
11181
- const resolvedSelectedValue = useMemo(() => selectedValue !== null && selectedValue !== void 0 ? selectedValue : noTaxCodeOption, [selectedValue, noTaxCodeOption]);
11207
+ const resolvedSelectedValue = useMemo(() => {
11208
+ if (selectedValue === null) return noTaxCodeOption;
11209
+ const match = options.find((option) => option.value === selectedValue.value);
11210
+ if (match) return match;
11211
+ return selectedValue;
11212
+ }, [
11213
+ selectedValue,
11214
+ noTaxCodeOption,
11215
+ options
11216
+ ]);
11182
11217
  const handleChange = useCallback((next) => {
11183
11218
  var _options$find;
11184
11219
  if (next === null || next.value === "__no_tax_code__") {
@@ -11229,6 +11264,18 @@ var filterOptionsOrGroups = (source, query) => {
11229
11264
  }
11230
11265
  return { options: [] };
11231
11266
  };
11267
+ var resolveSelectedOption = (source, selectedValue) => {
11268
+ var _source$options, _source$groups;
11269
+ if (!selectedValue) return null;
11270
+ const optionMatch = ((_source$options = source.options) !== null && _source$options !== void 0 ? _source$options : []).find((option) => option.value === selectedValue.value);
11271
+ if (optionMatch) return optionMatch;
11272
+ const groups = (_source$groups = source.groups) !== null && _source$groups !== void 0 ? _source$groups : [];
11273
+ for (const group of groups) {
11274
+ const match = group.options.find((option) => option.value === selectedValue.value);
11275
+ if (match) return match;
11276
+ }
11277
+ return selectedValue;
11278
+ };
11232
11279
  //#endregion
11233
11280
  //#region src/components/ui/Checkbox/Checkbox.tsx
11234
11281
  var _excluded$80 = [
@@ -11372,7 +11419,7 @@ var EmptyState$7 = () => {
11372
11419
  children: t("common:empty.results", "No results found")
11373
11420
  });
11374
11421
  };
11375
- var ErrorState$8 = () => {
11422
+ var ErrorState$6 = () => {
11376
11423
  const { t } = useTranslation();
11377
11424
  return /* @__PURE__ */ jsx(Span, {
11378
11425
  size: "sm",
@@ -11415,7 +11462,7 @@ var MobileSelectionDrawerList = (_ref) => {
11415
11462
  data,
11416
11463
  slots: {
11417
11464
  EmptyState: EmptyState$7,
11418
- ErrorState: ErrorState$8
11465
+ ErrorState: ErrorState$6
11419
11466
  },
11420
11467
  renderItem,
11421
11468
  onClickItem,
@@ -11440,7 +11487,7 @@ var _excluded$78 = [
11440
11487
  "slotProps"
11441
11488
  ];
11442
11489
  var MobileSelectionDrawerWithTrigger = (_ref) => {
11443
- var _slotProps$Trigger$ic, _slotProps$Trigger, _selectedValue$label;
11490
+ var _slotProps$Trigger$ic, _slotProps$Trigger, _resolvedSelectedValu;
11444
11491
  let { ariaLabel, heading, selectedValue, onSelectedValueChange, placeholder, isLoading = false, isError = false, isDisabled = false, isSearchable = false, searchPlaceholder, slotProps } = _ref, optionOrGroups = _objectWithoutProperties(_ref, _excluded$78);
11445
11492
  const { t } = useTranslation();
11446
11493
  const { options, groups } = optionOrGroups;
@@ -11458,6 +11505,9 @@ var MobileSelectionDrawerWithTrigger = (_ref) => {
11458
11505
  groups,
11459
11506
  searchQuery
11460
11507
  ]);
11508
+ const resolvedSelectedValue = useMemo(() => {
11509
+ return resolveSelectedOption(filteredOptionsOrGroups, selectedValue);
11510
+ }, [filteredOptionsOrGroups, selectedValue]);
11461
11511
  const Header = useCallback(() => /* @__PURE__ */ jsx(ModalTitleWithClose, {
11462
11512
  heading: /* @__PURE__ */ jsx(ModalHeading, {
11463
11513
  size: "md",
@@ -11480,8 +11530,8 @@ var MobileSelectionDrawerWithTrigger = (_ref) => {
11480
11530
  children: [/* @__PURE__ */ jsx(Span, {
11481
11531
  size: "sm",
11482
11532
  ellipsis: true,
11483
- children: (_selectedValue$label = selectedValue === null || selectedValue === void 0 ? void 0 : selectedValue.label) !== null && _selectedValue$label !== void 0 ? _selectedValue$label : resolvedPlaceholder
11484
- }), triggerIcon]
11533
+ children: (_resolvedSelectedValu = resolvedSelectedValue === null || resolvedSelectedValue === void 0 ? void 0 : resolvedSelectedValue.label) !== null && _resolvedSelectedValu !== void 0 ? _resolvedSelectedValu : resolvedPlaceholder
11534
+ }), !isDisabled && triggerIcon]
11485
11535
  })
11486
11536
  }), /* @__PURE__ */ jsx(Drawer, {
11487
11537
  slots: { Header },
@@ -11500,7 +11550,7 @@ var MobileSelectionDrawerWithTrigger = (_ref) => {
11500
11550
  onChange: setSearchQuery,
11501
11551
  label: resolvedSearchPlaceholder
11502
11552
  }), /* @__PURE__ */ jsx(MobileSelectionDrawerList, _objectSpread2(_objectSpread2({ ariaLabel }, filteredOptionsOrGroups), {}, {
11503
- selectedValue,
11553
+ selectedValue: resolvedSelectedValue,
11504
11554
  onSelectedValueChange: (value) => {
11505
11555
  onSelectedValueChange(value);
11506
11556
  close();
@@ -11563,6 +11613,10 @@ var BankTransactionsCategorizeAllModal = ({ isOpen, onOpenChange, mode, isMobile
11563
11613
  const bankTransactionsById = useMemo(() => getBankTransactionsById(bankTransactions), [bankTransactions]);
11564
11614
  const selectedTransactions = useMemo(() => getSelectedBankTransactions(selectedIds, bankTransactionsById), [selectedIds, bankTransactionsById]);
11565
11615
  const { taxCodeOptions } = useTaxCodeOptions(useMemo(() => getFirstBankTransactionWithTaxOptions(selectedTransactions), [selectedTransactions]));
11616
+ const handleSelectedCategoryChange = useCallback((category) => {
11617
+ setSelectedCategory(category);
11618
+ if (category && !canCategoryHaveTaxCode(category)) setSelectedTaxCode(null);
11619
+ }, []);
11566
11620
  const handleCategorizeModalClose = useCallback((isOpen) => {
11567
11621
  onOpenChange(isOpen);
11568
11622
  if (!isOpen) {
@@ -11577,10 +11631,13 @@ var BankTransactionsCategorizeAllModal = ({ isOpen, onOpenChange, mode, isMobile
11577
11631
  type: "Category",
11578
11632
  category: selectedCategory.classification
11579
11633
  };
11580
- yield trigger({ transactions: Array.from(selectedIds).map((transactionId) => ({
11581
- transactionId,
11582
- categorization: _objectSpread2(_objectSpread2({}, categorization), {}, { taxCode: resolveCategoryTaxCode(bankTransactionsById.get(transactionId), selectedCategory, selectedTaxCode) })
11583
- })) });
11634
+ yield trigger({ transactions: Array.from(selectedIds).map((transactionId) => {
11635
+ var _selectedTaxCode$valu;
11636
+ return {
11637
+ transactionId,
11638
+ categorization: _objectSpread2(_objectSpread2({}, categorization), {}, { taxCode: resolveCategoryTaxCode(bankTransactionsById.get(transactionId), selectedCategory, (_selectedTaxCode$valu = selectedTaxCode === null || selectedTaxCode === void 0 ? void 0 : selectedTaxCode.value) !== null && _selectedTaxCode$valu !== void 0 ? _selectedTaxCode$valu : null) })
11639
+ };
11640
+ }) });
11584
11641
  clearSelection();
11585
11642
  }), [
11586
11643
  selectedIds,
@@ -11609,12 +11666,12 @@ var BankTransactionsCategorizeAllModal = ({ isOpen, onOpenChange, mode, isMobile
11609
11666
  }), isMobileView ? /* @__PURE__ */ jsx(CategorySelectDrawerWithTrigger, {
11610
11667
  "aria-labelledby": categorySelectId,
11611
11668
  selectedValue: selectedCategory,
11612
- onSelectedValueChange: setSelectedCategory,
11669
+ onSelectedValueChange: handleSelectedCategoryChange,
11613
11670
  showTooltips: false
11614
11671
  }) : /* @__PURE__ */ jsx(BankTransactionCategoryComboBox, {
11615
11672
  inputId: categorySelectId,
11616
11673
  selectedValue: selectedCategory,
11617
- onSelectedValueChange: setSelectedCategory,
11674
+ onSelectedValueChange: handleSelectedCategoryChange,
11618
11675
  includeSuggestedMatches: false,
11619
11676
  isDisabled: isMutating
11620
11677
  })]
@@ -11681,7 +11738,7 @@ var toSplitEntry = (split) => {
11681
11738
  var buildBulkMatchOrCategorizePayload = (selectedIds, categorizations) => {
11682
11739
  const transactions = {};
11683
11740
  for (const transactionId of selectedIds) {
11684
- var _categorizations$get, _taxCode$value;
11741
+ var _categorizations$get;
11685
11742
  const { category, match, taxCode, variant } = (_categorizations$get = categorizations.get(transactionId)) !== null && _categorizations$get !== void 0 ? _categorizations$get : DEFAULT_CATEGORIZATION;
11686
11743
  if (variant === BankTransactionSelectionVariant.MATCH) {
11687
11744
  if (!match) continue;
@@ -11710,7 +11767,7 @@ var buildBulkMatchOrCategorizePayload = (selectedIds, categorizations) => {
11710
11767
  categorization: {
11711
11768
  type: "Category",
11712
11769
  category: classification,
11713
- taxCode: (_taxCode$value = taxCode === null || taxCode === void 0 ? void 0 : taxCode.value) !== null && _taxCode$value !== void 0 ? _taxCode$value : null
11770
+ taxCode: taxCode !== null && taxCode !== void 0 ? taxCode : null
11714
11771
  }
11715
11772
  };
11716
11773
  }
@@ -11733,7 +11790,7 @@ Schema.Struct({ businessId: Schema.String });
11733
11790
  var bulkMatchOrCategorize = post(({ businessId }) => {
11734
11791
  return `/v1/businesses/${businessId}/bank-transactions/bulk-match-or-categorize`;
11735
11792
  });
11736
- function buildKey$79({ access_token: accessToken, apiUrl, businessId }) {
11793
+ function buildKey$78({ access_token: accessToken, apiUrl, businessId }) {
11737
11794
  if (accessToken && apiUrl) return {
11738
11795
  accessToken,
11739
11796
  apiUrl,
@@ -11752,7 +11809,7 @@ var useBulkMatchOrCategorize = () => {
11752
11809
  const buildTransactionsPayload = useCallback(() => {
11753
11810
  return { transactions: buildBulkMatchOrCategorizePayload(selectedIds, categorizations) };
11754
11811
  }, [selectedIds, categorizations]);
11755
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$79(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg }) => bulkMatchOrCategorize(apiUrl, accessToken, {
11812
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$78(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg }) => bulkMatchOrCategorize(apiUrl, accessToken, {
11756
11813
  params: { businessId },
11757
11814
  body: Schema.encodeSync(BulkMatchOrCategorizeRequestSchema)(arg)
11758
11815
  }).then(({ data }) => data), {
@@ -11839,7 +11896,7 @@ var BankTransactionsConfirmAllModal = ({ isOpen, onOpenChange, isMobileView = fa
11839
11896
  var BULK_UNCATEGORIZE_BANK_TRANSACTIONS_TAG_KEY = "#bulk-uncategorize-bank-transactions";
11840
11897
  var BulkUncategorizeRequestSchema = Schema.Struct({ transactionIds: Schema.propertySignature(Schema.Array(Schema.UUID)).pipe(Schema.fromKey("transaction_ids")) });
11841
11898
  var bulkUncategorize = post(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/bulk-uncategorize`);
11842
- function buildKey$78({ access_token: accessToken, apiUrl, businessId }) {
11899
+ function buildKey$77({ access_token: accessToken, apiUrl, businessId }) {
11843
11900
  if (accessToken && apiUrl) return {
11844
11901
  accessToken,
11845
11902
  apiUrl,
@@ -11853,7 +11910,7 @@ var useBulkUncategorize = () => {
11853
11910
  const { businessId, eventCallbacks } = useLayerContext();
11854
11911
  const { forceReloadBankTransactions } = useBankTransactionsGlobalCacheActions();
11855
11912
  const { debouncedInvalidateProfitAndLoss } = useProfitAndLossGlobalInvalidator();
11856
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$78(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg }) => bulkUncategorize(apiUrl, accessToken, {
11913
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$77(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg }) => bulkUncategorize(apiUrl, accessToken, {
11857
11914
  params: { businessId },
11858
11915
  body: Schema.encodeSync(BulkUncategorizeRequestSchema)(arg)
11859
11916
  }).then(({ data }) => data), {
@@ -12235,7 +12292,7 @@ var mapRawCustomAccountToCustomAccount = (raw) => ({
12235
12292
  //#endregion
12236
12293
  //#region src/hooks/api/businesses/[business-id]/custom-accounts/useCustomAccounts.ts
12237
12294
  var CUSTOM_ACCOUNTS_TAG_KEY = "#custom-accounts";
12238
- function buildKey$77({ access_token: accessToken, apiUrl, businessId, userCreated }) {
12295
+ function buildKey$76({ access_token: accessToken, apiUrl, businessId, userCreated }) {
12239
12296
  if (accessToken && apiUrl) return {
12240
12297
  accessToken,
12241
12298
  apiUrl,
@@ -12253,7 +12310,7 @@ function useCustomAccounts({ userCreated } = {}) {
12253
12310
  const withLocale = useLocalizedKey();
12254
12311
  const { data } = useAuth();
12255
12312
  const { businessId } = useLayerContext();
12256
- return useSWR(() => withLocale(buildKey$77(_objectSpread2(_objectSpread2({}, data), {}, {
12313
+ return useSWR(() => withLocale(buildKey$76(_objectSpread2(_objectSpread2({}, data), {}, {
12257
12314
  businessId,
12258
12315
  userCreated
12259
12316
  }))), ({ accessToken, apiUrl, businessId, userCreated }) => getCustomAccounts(apiUrl, accessToken, { params: {
@@ -12263,7 +12320,7 @@ function useCustomAccounts({ userCreated } = {}) {
12263
12320
  }
12264
12321
  //#endregion
12265
12322
  //#region src/hooks/api/businesses/[business-id]/custom-accounts/[custom-account-id]/parse-csv/useCustomAccountParseCsv.ts
12266
- function buildKey$76({ access_token: accessToken, apiUrl, businessId }) {
12323
+ function buildKey$75({ access_token: accessToken, apiUrl, businessId }) {
12267
12324
  if (accessToken && apiUrl) return {
12268
12325
  accessToken,
12269
12326
  apiUrl,
@@ -12280,7 +12337,7 @@ function useCustomAccountParseCsv() {
12280
12337
  const withLocale = useLocalizedKey();
12281
12338
  const { data } = useAuth();
12282
12339
  const { businessId } = useLayerContext();
12283
- return useSWRMutation(() => withLocale(buildKey$76(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { customAccountId, file } }) => parseCsv(apiUrl, accessToken, {
12340
+ return useSWRMutation(() => withLocale(buildKey$75(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { customAccountId, file } }) => parseCsv(apiUrl, accessToken, {
12284
12341
  businessId,
12285
12342
  customAccountId,
12286
12343
  file
@@ -12562,7 +12619,7 @@ get(({ businessId }) => `/v1/businesses/${businessId}/external-accounts`);
12562
12619
  //#endregion
12563
12620
  //#region src/hooks/api/businesses/[business-id]/custom-accounts/useCreateCustomAccount.ts
12564
12621
  var createCustomAccount = post(({ businessId }) => `/v1/businesses/${businessId}/custom-accounts`);
12565
- function buildKey$75({ access_token: accessToken, apiUrl, businessId }) {
12622
+ function buildKey$74({ access_token: accessToken, apiUrl, businessId }) {
12566
12623
  if (accessToken && apiUrl) return {
12567
12624
  accessToken,
12568
12625
  apiUrl,
@@ -12575,7 +12632,7 @@ function useCreateCustomAccount() {
12575
12632
  const { data } = useAuth();
12576
12633
  const { businessId } = useLayerContext();
12577
12634
  const { mutate } = useSWRConfig();
12578
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$75(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: body }) => createCustomAccount(apiUrl, accessToken, {
12635
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$74(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: body }) => createCustomAccount(apiUrl, accessToken, {
12579
12636
  params: { businessId },
12580
12637
  body
12581
12638
  }).then(({ data }) => mapRawCustomAccountToCustomAccount(data)), { revalidate: false });
@@ -14151,7 +14208,7 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
14151
14208
  //#region src/hooks/api/businesses/[business-id]/custom-accounts/[custom-account-id]/transactions/useCreateCustomAccountTransactions.ts
14152
14209
  var _excluded$56 = ["customAccountId"];
14153
14210
  var createCustomAccountTransactions = post(({ businessId, customAccountId }) => `/v1/businesses/${businessId}/custom-accounts/${customAccountId}/transactions`);
14154
- function buildKey$74({ access_token: accessToken, apiUrl, businessId }) {
14211
+ function buildKey$73({ access_token: accessToken, apiUrl, businessId }) {
14155
14212
  if (accessToken && apiUrl) return {
14156
14213
  accessToken,
14157
14214
  apiUrl,
@@ -14163,7 +14220,7 @@ function useCreateCustomAccountTransactions() {
14163
14220
  const withLocale = useLocalizedKey();
14164
14221
  const { data } = useAuth();
14165
14222
  const { businessId } = useLayerContext();
14166
- return useSWRMutation(() => withLocale(buildKey$74(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, _ref) => {
14223
+ return useSWRMutation(() => withLocale(buildKey$73(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, _ref) => {
14167
14224
  let { arg: _ref2 } = _ref, { customAccountId } = _ref2, body = _objectWithoutProperties(_ref2, _excluded$56);
14168
14225
  return createCustomAccountTransactions(apiUrl, accessToken, {
14169
14226
  params: {
@@ -14603,7 +14660,7 @@ var VirtualizedDataTable = ({ columnConfig, data, isLoading, isError, componentN
14603
14660
  var ROW_HEIGHT = 52;
14604
14661
  var TABLE_HEIGHT = ROW_HEIGHT * 9 - 1;
14605
14662
  var EmptyState$6 = () => null;
14606
- var ErrorState$7 = () => null;
14663
+ var ErrorState$5 = () => null;
14607
14664
  function ValidateCsvTable({ data, headers, formatters, className }) {
14608
14665
  const { t } = useTranslation();
14609
14666
  const sortedData = useMemo(() => [...data].sort((a, b) => {
@@ -14659,7 +14716,7 @@ function ValidateCsvTable({ data, headers, formatters, className }) {
14659
14716
  shrinkHeightToFitRows: true,
14660
14717
  slots: {
14661
14718
  EmptyState: EmptyState$6,
14662
- ErrorState: ErrorState$7
14719
+ ErrorState: ErrorState$5
14663
14720
  }
14664
14721
  })
14665
14722
  });
@@ -15606,7 +15663,7 @@ var useGetBankTransactionMatchOrCategoryWithDefault = (bankTransaction) => {
15606
15663
  var _excluded$54 = ["bankTransactionId"];
15607
15664
  var CATEGORIZE_BANK_TRANSACTION_TAG = "#categorize-bank-transaction";
15608
15665
  var categorizeBankTransaction = put(({ businessId, bankTransactionId }) => `/v1/businesses/${businessId}/bank-transactions/${bankTransactionId}/categorize`);
15609
- function buildKey$73({ access_token: accessToken, apiUrl, businessId }) {
15666
+ function buildKey$72({ access_token: accessToken, apiUrl, businessId }) {
15610
15667
  if (accessToken && apiUrl) return {
15611
15668
  accessToken,
15612
15669
  apiUrl,
@@ -15622,7 +15679,7 @@ function useCategorizeBankTransaction() {
15622
15679
  const { debouncedInvalidateProfitAndLoss } = useProfitAndLossGlobalInvalidator();
15623
15680
  const { useBankTransactionsOptions } = useBankTransactionsContext();
15624
15681
  const { forceReloadBackgroundBankTransactions } = useBankTransactionsGlobalCacheActions();
15625
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$73({
15682
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$72({
15626
15683
  access_token: auth === null || auth === void 0 ? void 0 : auth.access_token,
15627
15684
  apiUrl: auth === null || auth === void 0 ? void 0 : auth.apiUrl,
15628
15685
  businessId
@@ -15700,7 +15757,7 @@ function useCategorizeBankTransactionWithCacheUpdate() {
15700
15757
  var _excluded$53 = ["bankTransactionId"];
15701
15758
  var matchBankTransaction = put(({ businessId, bankTransactionId }) => `/v1/businesses/${businessId}/bank-transactions/${bankTransactionId}/match`);
15702
15759
  var MATCH_BANK_TRANSACTION_TAG = "#match-bank-transaction";
15703
- function buildKey$72({ access_token: accessToken, apiUrl, businessId }) {
15760
+ function buildKey$71({ access_token: accessToken, apiUrl, businessId }) {
15704
15761
  if (accessToken && apiUrl) return {
15705
15762
  accessToken,
15706
15763
  apiUrl,
@@ -15716,7 +15773,7 @@ function useMatchBankTransaction() {
15716
15773
  const { debouncedInvalidateProfitAndLoss } = useProfitAndLossGlobalInvalidator();
15717
15774
  const { useBankTransactionsOptions } = useBankTransactionsContext();
15718
15775
  const { forceReloadBackgroundBankTransactions } = useBankTransactionsGlobalCacheActions();
15719
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$72({
15776
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$71({
15720
15777
  access_token: auth === null || auth === void 0 ? void 0 : auth.access_token,
15721
15778
  apiUrl: auth === null || auth === void 0 ? void 0 : auth.apiUrl,
15722
15779
  businessId
@@ -16109,7 +16166,7 @@ var getBookkeepingPeriods = get(({ businessId }) => {
16109
16166
  return `/v1/businesses/${businessId}/bookkeeping/periods`;
16110
16167
  });
16111
16168
  var BOOKKEEPING_PERIODS_TAG_KEY = "#bookkeeping-periods";
16112
- function buildKey$71({ access_token: accessToken, apiUrl, businessId, isActiveOrPaused }) {
16169
+ function buildKey$70({ access_token: accessToken, apiUrl, businessId, isActiveOrPaused }) {
16113
16170
  if (accessToken && apiUrl && isActiveOrPaused) return {
16114
16171
  accessToken,
16115
16172
  apiUrl,
@@ -16123,7 +16180,7 @@ function useBookkeepingPeriods() {
16123
16180
  const { businessId } = useLayerContext();
16124
16181
  const { data, isLoading: isLoadingBookkeepingStatus } = useBookkeepingStatus();
16125
16182
  const isActiveOrPaused = data ? isActiveOrPausedBookkeepingStatus(data.status) : false;
16126
- const swrResponse = useSWR(() => withLocale(buildKey$71(_objectSpread2(_objectSpread2({}, auth), {}, {
16183
+ const swrResponse = useSWR(() => withLocale(buildKey$70(_objectSpread2(_objectSpread2({}, auth), {}, {
16127
16184
  businessId,
16128
16185
  isActiveOrPaused
16129
16186
  }))), ({ accessToken, apiUrl, businessId }) => getBookkeepingPeriods(apiUrl, accessToken, { params: { businessId } })().then(({ data: { periods } }) => periods.map((period) => _objectSpread2(_objectSpread2({}, period), {}, {
@@ -16296,7 +16353,7 @@ function useMinMutatingMutation({ swrMutationResponse, minMutatingMs }) {
16296
16353
  //#endregion
16297
16354
  //#region src/hooks/api/businesses/[business-id]/bank-transactions/[bank-transaction-id]/metadata/useSetMetadataOnBankTransaction.ts
16298
16355
  var SET_METADATA_ON_BANK_TRANSACTION_TAG_KEY = "#set-metadata-on-bank-transaction";
16299
- function buildKey$70({ access_token: accessToken, apiUrl, businessId, bankTransactionId }) {
16356
+ function buildKey$69({ access_token: accessToken, apiUrl, businessId, bankTransactionId }) {
16300
16357
  if (accessToken && apiUrl) return {
16301
16358
  accessToken,
16302
16359
  apiUrl,
@@ -16310,7 +16367,7 @@ function useSetMetadataOnBankTransaction({ bankTransactionId }) {
16310
16367
  const withLocale = useLocalizedKey();
16311
16368
  const { data } = useAuth();
16312
16369
  const { businessId } = useLayerContext();
16313
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$70(_objectSpread2(_objectSpread2({}, data), {}, {
16370
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$69(_objectSpread2(_objectSpread2({}, data), {}, {
16314
16371
  businessId,
16315
16372
  bankTransactionId
16316
16373
  }))), ({ accessToken, apiUrl, businessId, bankTransactionId }, { arg: { vendor, customer } }) => {
@@ -16359,7 +16416,7 @@ function useSetMetadataOnBankTransaction({ bankTransactionId }) {
16359
16416
  //#region src/hooks/api/businesses/[business-id]/bank-transactions/tags/useRemoveTagFromBankTransaction.ts
16360
16417
  var REMOVE_TAG_FROM_BANK_TRANSACTION_TAG_KEY = "#remove-tag-from-bank-transaction";
16361
16418
  var removeTagFromBankTransaction = del(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/tags`);
16362
- function buildKey$69({ access_token: accessToken, apiUrl, businessId, bankTransactionId }) {
16419
+ function buildKey$68({ access_token: accessToken, apiUrl, businessId, bankTransactionId }) {
16363
16420
  if (accessToken && apiUrl) return {
16364
16421
  accessToken,
16365
16422
  apiUrl,
@@ -16372,7 +16429,7 @@ function useRemoveTagFromBankTransaction({ bankTransactionId }) {
16372
16429
  const withLocale = useLocalizedKey();
16373
16430
  const { data } = useAuth();
16374
16431
  const { businessId } = useLayerContext();
16375
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$69(_objectSpread2(_objectSpread2({}, data), {}, {
16432
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$68(_objectSpread2(_objectSpread2({}, data), {}, {
16376
16433
  businessId,
16377
16434
  bankTransactionId
16378
16435
  }))), ({ accessToken, apiUrl, businessId }, { arg: { tagId } }) => removeTagFromBankTransaction(apiUrl, accessToken, {
@@ -16411,7 +16468,7 @@ function useRemoveTagFromBankTransaction({ bankTransactionId }) {
16411
16468
  //#region src/hooks/api/businesses/[business-id]/bank-transactions/tags/useTagBankTransaction.ts
16412
16469
  var TAG_BANK_TRANSACTION_TAG_KEY = "#tag-bank-transaction";
16413
16470
  var tagBankTransaction = post(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/tags`);
16414
- function buildKey$68({ access_token: accessToken, apiUrl, businessId, bankTransactionId }) {
16471
+ function buildKey$67({ access_token: accessToken, apiUrl, businessId, bankTransactionId }) {
16415
16472
  if (accessToken && apiUrl) return {
16416
16473
  accessToken,
16417
16474
  apiUrl,
@@ -16424,7 +16481,7 @@ function useTagBankTransaction({ bankTransactionId }) {
16424
16481
  const withLocale = useLocalizedKey();
16425
16482
  const { data } = useAuth();
16426
16483
  const { businessId } = useLayerContext();
16427
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$68(_objectSpread2(_objectSpread2({}, data), {}, {
16484
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$67(_objectSpread2(_objectSpread2({}, data), {}, {
16428
16485
  businessId,
16429
16486
  bankTransactionId
16430
16487
  }))), ({ accessToken, apiUrl, businessId, bankTransactionId }, { arg: { key, value, dimensionDisplayName, valueDisplayName } }) => tagBankTransaction(apiUrl, accessToken, {
@@ -16537,8 +16594,8 @@ var calculateUpdatedAmounts = (initialRowSplits, { index, newAmountInput, totalA
16537
16594
  var getCustomerVendorForBankTransaction = (bankTransaction) => {
16538
16595
  return bankTransaction.customer ? decodeCustomerVendor(_objectSpread2(_objectSpread2({}, bankTransaction.customer), {}, { customerVendorType: "CUSTOMER" })) : bankTransaction.vendor ? decodeCustomerVendor(_objectSpread2(_objectSpread2({}, bankTransaction.vendor), {}, { customerVendorType: "VENDOR" })) : null;
16539
16596
  };
16540
- var getLocalSplitStateForExpandedTransaction = (bankTransaction, selectedCategory) => {
16541
- var _coercedSelectedCateg;
16597
+ var getLocalSplitStateForExpandedTransaction = (bankTransaction, selectedCategory, selectedTaxCode) => {
16598
+ var _coercedSelectedCateg, _ref;
16542
16599
  let coercedSelectedCategory = selectedCategory;
16543
16600
  if (!selectedCategory || isPlaceholderAsOption(selectedCategory)) coercedSelectedCategory = null;
16544
16601
  else if (isApiCategorizationAsOption(selectedCategory) && isSplitCategorizationEncoded(selectedCategory.original)) coercedSelectedCategory = convertApiCategorizationToCategoryOrSplitAsOption(selectedCategory.original);
@@ -16555,6 +16612,7 @@ var getLocalSplitStateForExpandedTransaction = (bankTransaction, selectedCategor
16555
16612
  return [{
16556
16613
  amount: bankTransaction.amount,
16557
16614
  category: (_coercedSelectedCateg = coercedSelectedCategory) !== null && _coercedSelectedCateg !== void 0 ? _coercedSelectedCateg : null,
16615
+ taxCode: (_ref = selectedTaxCode !== null && selectedTaxCode !== void 0 ? selectedTaxCode : bankTransaction.tax_code) !== null && _ref !== void 0 ? _ref : null,
16558
16616
  tags: bankTransaction.transaction_tags.map((tag) => makeTagFromTransactionTag(Schema$1.decodeSync(TransactionTagSchema)(tag))),
16559
16617
  customerVendor: getCustomerVendorForBankTransaction(bankTransaction)
16560
16618
  }];
@@ -16564,30 +16622,45 @@ var getLocalSplitStateForExpandedTransaction = (bankTransaction, selectedCategor
16564
16622
  var useSplitsForm = ({ bankTransaction, isOpen }) => {
16565
16623
  const { t } = useTranslation();
16566
16624
  const intl = useIntl();
16567
- const { category: selectedCategory } = useGetBankTransactionCategorizationWithDefault(bankTransaction);
16568
- const [localSplits, setLocalSplits] = useState(getLocalSplitStateForExpandedTransaction(bankTransaction, selectedCategory));
16625
+ const { category: selectedCategory, taxCode: selectedTaxCode } = useGetBankTransactionCategorizationWithDefault(bankTransaction);
16626
+ const prevIsOpenRef = useRef(isOpen);
16627
+ const prevBankTransactionRef = useRef(bankTransaction);
16628
+ const [localSplits, setLocalSplits] = useState(getLocalSplitStateForExpandedTransaction(bankTransaction, selectedCategory, selectedTaxCode));
16569
16629
  const [inputValues, setInputValues] = useState({});
16570
16630
  const [splitFormError, setSplitFormError] = useState();
16571
- const { setTransactionCategorySelection } = useBankTransactionsCategorizationActions();
16572
- useEffect(() => {
16573
- setLocalSplits(getLocalSplitStateForExpandedTransaction(bankTransaction, selectedCategory));
16631
+ const { setTransactionCategorySelection, setTransactionTaxCodeSelection } = useBankTransactionsCategorizationActions();
16632
+ const resetLocalSplits = useCallback(() => {
16633
+ setLocalSplits(getLocalSplitStateForExpandedTransaction(bankTransaction, selectedCategory, selectedTaxCode));
16574
16634
  setSplitFormError(void 0);
16575
16635
  setInputValues({});
16576
16636
  }, [
16577
16637
  bankTransaction,
16578
16638
  selectedCategory,
16579
- isOpen
16639
+ selectedTaxCode
16580
16640
  ]);
16641
+ useEffect(() => {
16642
+ if (prevBankTransactionRef.current === bankTransaction) return;
16643
+ resetLocalSplits();
16644
+ prevBankTransactionRef.current = bankTransaction;
16645
+ }, [bankTransaction, resetLocalSplits]);
16646
+ useEffect(() => {
16647
+ if (prevIsOpenRef.current === isOpen) return;
16648
+ resetLocalSplits();
16649
+ prevIsOpenRef.current = isOpen;
16650
+ }, [isOpen, resetLocalSplits]);
16581
16651
  const saveLocalSplitsToCategoryStore = useCallback((splits) => {
16582
16652
  if (!isSplitsValid(splits)) {
16583
16653
  setSplitFormError(getSplitsErrorMessage(splits, t));
16584
16654
  return;
16585
16655
  }
16586
16656
  setTransactionCategorySelection(bankTransaction.id, new SplitAsOption(splits));
16657
+ const nextTaxCode = splits.length === 1 ? splits[0].taxCode : null;
16658
+ setTransactionTaxCodeSelection(bankTransaction.id, nextTaxCode !== null && nextTaxCode !== void 0 ? nextTaxCode : null);
16587
16659
  setSplitFormError(void 0);
16588
16660
  }, [
16589
16661
  bankTransaction.id,
16590
16662
  setTransactionCategorySelection,
16663
+ setTransactionTaxCodeSelection,
16591
16664
  t
16592
16665
  ]);
16593
16666
  const addSplit = useCallback(() => {
@@ -16629,7 +16702,10 @@ var useSplitsForm = ({ bankTransaction, isOpen }) => {
16629
16702
  const changeCategoryForSplitAtIndex = useCallback((index, newCategory) => {
16630
16703
  if (newCategory === null) return;
16631
16704
  const newLocalSplits = [...localSplits];
16632
- newLocalSplits[index].category = newCategory;
16705
+ newLocalSplits[index] = _objectSpread2(_objectSpread2({}, newLocalSplits[index]), {}, {
16706
+ category: newCategory,
16707
+ taxCode: canCategoryHaveTaxCode(newCategory) ? newLocalSplits[index].taxCode : null
16708
+ });
16633
16709
  setLocalSplits(newLocalSplits);
16634
16710
  setSplitFormError(void 0);
16635
16711
  saveLocalSplitsToCategoryStore(newLocalSplits);
@@ -16972,7 +17048,7 @@ function BankTransactionCustomerVendorSelector({ bankTransaction }) {
16972
17048
  //#region src/hooks/api/businesses/[business-id]/bank-transactions/[bank-transaction-id]/metadata/useBankTransactionsMetadata.ts
16973
17049
  var getBankTransactionMetadata = get(({ businessId, bankTransactionId }) => `/v1/businesses/${businessId}/bank-transactions/${bankTransactionId}/metadata`);
16974
17050
  var GET_BANK_TRANSACTION_METADATA_TAG_KEY = "#bank-transaction-metadata";
16975
- function buildKey$67({ access_token: accessToken, apiUrl, businessId, bankTransactionId }) {
17051
+ function buildKey$66({ access_token: accessToken, apiUrl, businessId, bankTransactionId }) {
16976
17052
  if (accessToken && apiUrl) return {
16977
17053
  accessToken,
16978
17054
  apiUrl,
@@ -16985,7 +17061,7 @@ function useBankTransactionMetadata({ bankTransactionId }) {
16985
17061
  const withLocale = useLocalizedKey();
16986
17062
  const { data: auth } = useAuth();
16987
17063
  const { businessId } = useLayerContext();
16988
- return useSWR(() => withLocale(buildKey$67(_objectSpread2(_objectSpread2({}, auth), {}, {
17064
+ return useSWR(() => withLocale(buildKey$66(_objectSpread2(_objectSpread2({}, auth), {}, {
16989
17065
  businessId,
16990
17066
  bankTransactionId
16991
17067
  }))), ({ accessToken, apiUrl, businessId }) => getBankTransactionMetadata(apiUrl, accessToken, { params: {
@@ -16997,7 +17073,7 @@ function useBankTransactionMetadata({ bankTransactionId }) {
16997
17073
  //#region src/hooks/api/businesses/[business-id]/bank-transactions/[bank-transaction-id]/metadata/useUpdateBankTransactionMetadata.ts
16998
17074
  var updateBankTransactionMetadata = put(({ businessId, bankTransactionId }) => `/v1/businesses/${businessId}/bank-transactions/${bankTransactionId}/metadata`);
16999
17075
  var UPDATE_BANK_TRANSACTION_METADATA_TAG_KEY = "#update-bank-transaction-metadata";
17000
- function buildKey$66({ access_token: accessToken, apiUrl, businessId, bankTransactionId }) {
17076
+ function buildKey$65({ access_token: accessToken, apiUrl, businessId, bankTransactionId }) {
17001
17077
  if (accessToken && apiUrl) return {
17002
17078
  accessToken,
17003
17079
  apiUrl,
@@ -17011,7 +17087,7 @@ function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
17011
17087
  const { data: auth } = useAuth();
17012
17088
  const { businessId } = useLayerContext();
17013
17089
  const { mutate } = useSWRConfig();
17014
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$66({
17090
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$65({
17015
17091
  access_token: auth === null || auth === void 0 ? void 0 : auth.access_token,
17016
17092
  apiUrl: auth === null || auth === void 0 ? void 0 : auth.apiUrl,
17017
17093
  businessId,
@@ -17144,7 +17220,7 @@ var BankTransactionMemo = ({ bankTransactionId, isMobile }) => {
17144
17220
  //#endregion
17145
17221
  //#region src/hooks/api/businesses/[business-id]/tags/dimensions/key/[dimension-key]/useTagDimensionByKey.ts
17146
17222
  var TAG_DIMENSION_BY_KEY_TAG_KEY = "#tag-dimension-by-key";
17147
- function buildKey$65({ access_token: accessToken, apiUrl, businessId, isEnabled, dimensionKey }) {
17223
+ function buildKey$64({ access_token: accessToken, apiUrl, businessId, isEnabled, dimensionKey }) {
17148
17224
  if (!isEnabled) return;
17149
17225
  if (accessToken && apiUrl) return {
17150
17226
  accessToken,
@@ -17160,7 +17236,7 @@ function useTagDimensionByKey({ isEnabled = true, dimensionKey }) {
17160
17236
  const { data: auth } = useAuth();
17161
17237
  const { apiUrl } = useEnvironment();
17162
17238
  const { businessId } = useLayerContext();
17163
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$65(_objectSpread2(_objectSpread2({}, auth), {}, {
17239
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$64(_objectSpread2(_objectSpread2({}, auth), {}, {
17164
17240
  apiUrl,
17165
17241
  isEnabled,
17166
17242
  businessId,
@@ -18069,7 +18145,7 @@ var ExpandedBankTransactionRow = ({ bankTransaction, isOpen = false, asListItem
18069
18145
  return _objectSpread2(_objectSpread2({}, currentSplit), {}, { taxCode: (_value$value = value === null || value === void 0 ? void 0 : value.value) !== null && _value$value !== void 0 ? _value$value : null });
18070
18146
  });
18071
18147
  },
18072
- isDisabled: !isCategorizationEnabled,
18148
+ isDisabled: !isCategorizationEnabled || !canCategoryHaveTaxCode(split.category),
18073
18149
  className: "Layer__expanded-bank-transaction-row__table-cell--split-entry__tax-code"
18074
18150
  }),
18075
18151
  showTags && /* @__PURE__ */ jsx(TagDimensionsGroup, {
@@ -18480,17 +18556,24 @@ var BankTransactionsMobileCategorySelectionItem = ({ option }) => {
18480
18556
  //#endregion
18481
18557
  //#region src/components/BankTransactionsMobileCategorySelection/utils.ts
18482
18558
  var SELECT_CATEGORY_VALUE = "SELECT_CATEGORY";
18483
- var buildInitialSessionCategoriesMap = (bankTransaction) => {
18559
+ var isSingleSelectedCategory = (selectedCategory) => {
18560
+ if (!selectedCategory) return false;
18561
+ if (isPlaceholderAsOption(selectedCategory)) return false;
18562
+ if (isSplitAsOption(selectedCategory) && !selectedCategory.isSingleSplit) return false;
18563
+ return true;
18564
+ };
18565
+ var buildInitialSessionCategoriesMap = (bankTransaction, selectedCategory) => {
18484
18566
  var _bankTransaction$cate;
18485
18567
  const categoriesMap = /* @__PURE__ */ new Map();
18486
18568
  if (bankTransaction.category) {
18487
18569
  const existingCategory = convertApiCategorizationToCategoryOrSplitAsOption(bankTransaction.category);
18488
- categoriesMap.set(existingCategory.value, existingCategory);
18570
+ if (isSingleSelectedCategory(existingCategory)) categoriesMap.set(existingCategory.value, existingCategory);
18489
18571
  }
18490
18572
  if ((bankTransaction === null || bankTransaction === void 0 || (_bankTransaction$cate = bankTransaction.categorization_flow) === null || _bankTransaction$cate === void 0 ? void 0 : _bankTransaction$cate.type) === CategorizationType.ASK_FROM_SUGGESTIONS) bankTransaction.categorization_flow.suggestions.forEach((suggestion) => {
18491
18573
  const suggestionOption = new ApiCategorizationAsOption(suggestion);
18492
18574
  categoriesMap.set(suggestionOption.value, suggestionOption);
18493
18575
  });
18576
+ if (selectedCategory && isSingleSelectedCategory(selectedCategory)) categoriesMap.set(selectedCategory.value, selectedCategory);
18494
18577
  return categoriesMap;
18495
18578
  };
18496
18579
  var buildCategoryOptions = (sessionCategories, showAllCategoriesLabel) => {
@@ -18510,15 +18593,15 @@ var BankTransactionsMobileCategorySelection = ({ bankTransaction, showTooltips =
18510
18593
  const { t } = useTranslation();
18511
18594
  const { setTransactionCategorySelection, setTransactionTaxCodeSelection } = useBankTransactionsCategorizationActions();
18512
18595
  const [isDrawerOpen, setIsDrawerOpen] = useState(false);
18513
- const [sessionCategories, setSessionCategories] = useState(() => buildInitialSessionCategoriesMap(bankTransaction));
18514
18596
  const previousTransactionIdRef = useRef(bankTransaction.id);
18515
- const { taxCodeOptions, hasTaxCodeOptions } = useTaxCodeOptions(bankTransaction);
18597
+ const { taxCodeOptions, hasTaxCodeOptions, getSelectedTaxCodeOption } = useTaxCodeOptions(bankTransaction);
18516
18598
  const { category: selectedCategory, taxCode: selectedTaxCode } = useGetBankTransactionCategorizationWithDefault(bankTransaction);
18599
+ const [sessionCategories, setSessionCategories] = useState(() => buildInitialSessionCategoriesMap(bankTransaction, selectedCategory));
18517
18600
  useEffect(() => {
18518
18601
  if (previousTransactionIdRef.current === bankTransaction.id) return;
18602
+ setSessionCategories(buildInitialSessionCategoriesMap(bankTransaction, selectedCategory));
18519
18603
  previousTransactionIdRef.current = bankTransaction.id;
18520
- setSessionCategories(buildInitialSessionCategoriesMap(bankTransaction));
18521
- }, [bankTransaction]);
18604
+ }, [bankTransaction, selectedCategory]);
18522
18605
  const categoryOptions = useMemo(() => buildCategoryOptions(sessionCategories, t("bankTransactions:action.show_all_categories", "Show all categories")), [sessionCategories, t]);
18523
18606
  const handleCategoryGridSelect = useCallback((selectionKeys) => {
18524
18607
  if (selectionKeys === "all") return;
@@ -18548,7 +18631,8 @@ var BankTransactionsMobileCategorySelection = ({ bankTransaction, showTooltips =
18548
18631
  setTransactionCategorySelection(bankTransaction.id, selectedDrawerCategory);
18549
18632
  }, [bankTransaction.id, setTransactionCategorySelection]);
18550
18633
  const handleTaxCodeSelect = useCallback((taxCode) => {
18551
- setTransactionTaxCodeSelection(bankTransaction.id, taxCode);
18634
+ var _taxCode$value;
18635
+ setTransactionTaxCodeSelection(bankTransaction.id, (_taxCode$value = taxCode === null || taxCode === void 0 ? void 0 : taxCode.value) !== null && _taxCode$value !== void 0 ? _taxCode$value : null);
18552
18636
  }, [bankTransaction.id, setTransactionTaxCodeSelection]);
18553
18637
  return /* @__PURE__ */ jsxs(VStack, {
18554
18638
  gap: "sm",
@@ -18568,7 +18652,7 @@ var BankTransactionsMobileCategorySelection = ({ bankTransaction, showTooltips =
18568
18652
  }),
18569
18653
  hasTaxCodeOptions && canCategoryHaveTaxCode(selectedCategory) && /* @__PURE__ */ jsx(TaxCodeMobileDrawer, {
18570
18654
  options: taxCodeOptions,
18571
- selectedValue: selectedTaxCode,
18655
+ selectedValue: getSelectedTaxCodeOption(selectedTaxCode),
18572
18656
  onSelectedValueChange: handleTaxCodeSelect,
18573
18657
  isDisabled: isSubmitting
18574
18658
  }),
@@ -18963,7 +19047,7 @@ var BankTransactionsMobileListSplitForm = ({ bankTransaction, showTooltips, show
18963
19047
  return _objectSpread2(_objectSpread2({}, currentSplit), {}, { taxCode: (_value$value = value === null || value === void 0 ? void 0 : value.value) !== null && _value$value !== void 0 ? _value$value : null });
18964
19048
  });
18965
19049
  },
18966
- isDisabled: !showCategorization
19050
+ isDisabled: !showCategorization || !canCategoryHaveTaxCode(split.category)
18967
19051
  })
18968
19052
  }),
18969
19053
  /* @__PURE__ */ jsx(Button$1, {
@@ -19120,11 +19204,10 @@ var PURPOSE_TOGGLE_CONFIG = [
19120
19204
  _objectSpread2(_objectSpread2({ value: "personal" }, translationKey("common:label.personal", "Personal")), {}, { style: { minWidth: 84 } }),
19121
19205
  _objectSpread2(_objectSpread2({ value: "more" }, translationKey("common:label.more", "More")), {}, { style: { minWidth: 84 } })
19122
19206
  ];
19123
- var BankTransactionsMobileListItemExpandedRow = ({ bankTransaction, isOpen, showCategorization, showDescriptions, showReceiptUploads, showTooltips }) => {
19207
+ var BankTransactionsMobileListItemExpandedRow = ({ bankTransaction, isOpen, purpose, setPurpose, showCategorization, showDescriptions, showReceiptUploads, showTooltips }) => {
19124
19208
  const { t } = useTranslation();
19125
19209
  const selectedCategorization = useGetBankTransactionCategorizationWithDefault(bankTransaction);
19126
19210
  const { setTransactionSelectionVariant } = useBankTransactionsCategorizationActions();
19127
- const [purpose, setPurpose] = useState(getPurposeFromStore(selectedCategorization));
19128
19211
  const purposeToggleOptions = useMemo(() => PURPOSE_TOGGLE_CONFIG.map((opt) => _objectSpread2(_objectSpread2({}, opt), {}, { label: t(opt.i18nKey, opt.defaultValue) })), [t]);
19129
19212
  const onChangePurpose = (key) => {
19130
19213
  const nextPurpose = key;
@@ -19153,12 +19236,6 @@ var BankTransactionsMobileListItemExpandedRow = ({ bankTransaction, isOpen, show
19153
19236
  })]
19154
19237
  });
19155
19238
  };
19156
- var getPurposeFromStore = (selectedCategorization) => {
19157
- if (selectedCategorization.variant === BankTransactionSelectionVariant.MATCH) return Purpose.more;
19158
- if (selectedCategorization.category === null) return Purpose.business;
19159
- if (isSplitAsOption(selectedCategorization.category)) return Purpose.more;
19160
- return Purpose.business;
19161
- };
19162
19239
  //#endregion
19163
19240
  //#region src/components/BankTransactionsMobileList/TransactionToOpenContext.ts
19164
19241
  var useTransactionToOpen = () => {
@@ -19194,6 +19271,8 @@ var BankTransactionsMobileListItem = ({ index, bankTransaction, initialLoad, isF
19194
19271
  var _bankTransaction$coun, _bankTransaction$acco;
19195
19272
  const { shouldHideAfterCategorize } = useBankTransactionsContext();
19196
19273
  const { setTransactionIdToOpen, transactionIdToOpen, clearTransactionIdToOpen } = useContext(TransactionToOpenContext);
19274
+ const selectedCategorization = useGetBankTransactionCategorizationWithDefault(bankTransaction);
19275
+ const [purpose, setPurpose] = useState(() => getPurposeFromStore(selectedCategorization));
19197
19276
  const categorized = isCategorized(bankTransaction);
19198
19277
  const isCategorizationEnabled = useBankTransactionsIsCategorizationEnabledContext();
19199
19278
  const { select, deselect } = useBulkSelectionActions();
@@ -19340,6 +19419,8 @@ var BankTransactionsMobileListItem = ({ index, bankTransaction, initialLoad, isF
19340
19419
  children: /* @__PURE__ */ jsx(BankTransactionsMobileListItemExpandedRow, {
19341
19420
  bankTransaction,
19342
19421
  isOpen: open,
19422
+ purpose,
19423
+ setPurpose,
19343
19424
  showCategorization: isCategorizationEnabled,
19344
19425
  showDescriptions,
19345
19426
  showReceiptUploads,
@@ -19348,6 +19429,13 @@ var BankTransactionsMobileListItem = ({ index, bankTransaction, initialLoad, isF
19348
19429
  })] })
19349
19430
  });
19350
19431
  };
19432
+ var getPurposeFromStore = (selectedCategorization) => {
19433
+ if (selectedCategorization.variant === BankTransactionSelectionVariant.MATCH) return Purpose.more;
19434
+ const category = selectedCategorization.category;
19435
+ if (category === null) return Purpose.business;
19436
+ if (isSplitAsOption(category)) return category.isSingleSplit ? Purpose.business : Purpose.more;
19437
+ return Purpose.business;
19438
+ };
19351
19439
  //#endregion
19352
19440
  //#region src/components/BankTransactionsMobileList/BankTransactionsMobileList.tsx
19353
19441
  var BankTransactionsMobileList = ({ bankTransactions, initialLoad, showDescriptions, showReceiptUploads, showTooltips }) => {
@@ -19894,7 +19982,7 @@ function useCategorizationRulesGlobalCacheActions() {
19894
19982
  //#endregion
19895
19983
  //#region src/hooks/api/businesses/[business-id]/categorization-rules/[categorization-rule-id]/archive/useArchiveCategorizationRule.ts
19896
19984
  var ARCHIVE_CATEGORIZATION_RULE_TAG = "#archive-categorization-rule";
19897
- function buildKey$64({ access_token: accessToken, apiUrl, businessId }) {
19985
+ function buildKey$63({ access_token: accessToken, apiUrl, businessId }) {
19898
19986
  if (accessToken && apiUrl) return {
19899
19987
  accessToken,
19900
19988
  apiUrl,
@@ -19909,7 +19997,7 @@ function useArchiveCategorizationRule() {
19909
19997
  const { data: auth } = useAuth();
19910
19998
  const { businessId } = useLayerContext();
19911
19999
  const { forceReloadCategorizationRules } = useCategorizationRulesGlobalCacheActions();
19912
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$64({
20000
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$63({
19913
20001
  access_token: auth === null || auth === void 0 ? void 0 : auth.access_token,
19914
20002
  apiUrl: auth === null || auth === void 0 ? void 0 : auth.apiUrl,
19915
20003
  businessId
@@ -20777,7 +20865,7 @@ var ErrorBoundary = class extends Component {
20777
20865
  //#endregion
20778
20866
  //#region src/hooks/api/businesses/[business-id]/categorization-rules/suggestions/useRejectCategorizationRulesUpdateSuggestion.ts
20779
20867
  var REJECT_CATEGORIZATION_RULE_SUGGESTION_TAG = "#reject-categorization-rule-suggestion";
20780
- function buildKey$63({ access_token: accessToken, apiUrl, businessId }) {
20868
+ function buildKey$62({ access_token: accessToken, apiUrl, businessId }) {
20781
20869
  if (accessToken && apiUrl) return {
20782
20870
  accessToken,
20783
20871
  apiUrl,
@@ -20790,7 +20878,7 @@ function useRejectCategorizationRulesUpdateSuggestion() {
20790
20878
  const withLocale = useLocalizedKey();
20791
20879
  const { data: auth } = useAuth();
20792
20880
  const { businessId } = useLayerContext();
20793
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$63({
20881
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$62({
20794
20882
  access_token: auth === null || auth === void 0 ? void 0 : auth.access_token,
20795
20883
  apiUrl: auth === null || auth === void 0 ? void 0 : auth.apiUrl,
20796
20884
  businessId
@@ -20810,7 +20898,7 @@ function useRejectCategorizationRulesUpdateSuggestion() {
20810
20898
  //#endregion
20811
20899
  //#region src/hooks/api/businesses/[business-id]/categorization-rules/useCreateCategorizationRule.ts
20812
20900
  var CREATE_CATEGORIZATION_RULE_TAG = "#create-categorization-rule";
20813
- function buildKey$62({ access_token: accessToken, apiUrl, businessId }) {
20901
+ function buildKey$61({ access_token: accessToken, apiUrl, businessId }) {
20814
20902
  if (accessToken && apiUrl) return {
20815
20903
  accessToken,
20816
20904
  apiUrl,
@@ -20827,7 +20915,7 @@ function useCreateCategorizationRule() {
20827
20915
  const { forceReloadBankTransactions } = useBankTransactionsGlobalCacheActions();
20828
20916
  const { debouncedInvalidateProfitAndLoss } = useProfitAndLossGlobalInvalidator();
20829
20917
  const { forceReloadCategorizationRules } = useCategorizationRulesGlobalCacheActions();
20830
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$62({
20918
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$61({
20831
20919
  access_token: auth === null || auth === void 0 ? void 0 : auth.access_token,
20832
20920
  apiUrl: auth === null || auth === void 0 ? void 0 : auth.apiUrl,
20833
20921
  businessId
@@ -20977,7 +21065,7 @@ var TransactionColumns = /* @__PURE__ */ function(TransactionColumns) {
20977
21065
  TransactionColumns["Amount"] = "Amount";
20978
21066
  return TransactionColumns;
20979
21067
  }(TransactionColumns || {});
20980
- var ErrorState$6 = () => {
21068
+ var ErrorState$4 = () => {
20981
21069
  const { t } = useTranslation();
20982
21070
  return /* @__PURE__ */ jsx(DataState, {
20983
21071
  spacing: true,
@@ -21041,7 +21129,7 @@ var AffectedTransactionsTable = ({ transactions, isLoading = false, isError = fa
21041
21129
  shrinkHeightToFitRows: true,
21042
21130
  slots: {
21043
21131
  EmptyState: EmptyState$5,
21044
- ErrorState: ErrorState$6
21132
+ ErrorState: ErrorState$4
21045
21133
  }
21046
21134
  })
21047
21135
  });
@@ -21989,7 +22077,7 @@ var PlusIcon = (_ref) => {
21989
22077
  };
21990
22078
  //#endregion
21991
22079
  //#region src/hooks/features/bankAccounts/useConfirmAndExcludeMultiple.ts
21992
- function buildKey$61({ access_token: accessToken, apiUrl, businessId }) {
22080
+ function buildKey$60({ access_token: accessToken, apiUrl, businessId }) {
21993
22081
  if (accessToken && apiUrl) return {
21994
22082
  accessToken,
21995
22083
  apiUrl,
@@ -22019,7 +22107,7 @@ function useConfirmAndExcludeMultiple({ onSuccess }) {
22019
22107
  const withLocale = useLocalizedKey();
22020
22108
  const { data: auth } = useAuth();
22021
22109
  const { businessId } = useLayerContext();
22022
- return useSWRMutation(() => withLocale(buildKey$61({
22110
+ return useSWRMutation(() => withLocale(buildKey$60({
22023
22111
  access_token: auth === null || auth === void 0 ? void 0 : auth.access_token,
22024
22112
  apiUrl: auth === null || auth === void 0 ? void 0 : auth.apiUrl,
22025
22113
  businessId
@@ -22890,7 +22978,7 @@ var LinkedAccountsContent = ({ asWidget, showLedgerBalance, showUnlinkItem, show
22890
22978
  //#endregion
22891
22979
  //#region src/hooks/legacy/useUpdateOpeningBalanceAndDate.ts
22892
22980
  var updateBankAccountOpeningBalance = post(({ businessId, bankAccountId }) => `/v1/businesses/${businessId}/bank-accounts/${bankAccountId}/opening-balance`);
22893
- function buildKey$60({ access_token: accessToken, apiUrl, businessId, data }) {
22981
+ function buildKey$59({ access_token: accessToken, apiUrl, businessId, data }) {
22894
22982
  if (accessToken && apiUrl) return {
22895
22983
  accessToken,
22896
22984
  apiUrl,
@@ -22922,7 +23010,7 @@ function useBulkSetOpeningBalanceAndDate(data, { onSuccess }) {
22922
23010
  if (!openingBalance) errors.push("MISSING_BALANCE");
22923
23011
  return errors;
22924
23012
  };
22925
- return useSWRMutation(() => withLocale(buildKey$60({
23013
+ return useSWRMutation(() => withLocale(buildKey$59({
22926
23014
  access_token: auth === null || auth === void 0 ? void 0 : auth.access_token,
22927
23015
  apiUrl: auth === null || auth === void 0 ? void 0 : auth.apiUrl,
22928
23016
  businessId,
@@ -24424,17 +24512,6 @@ var ProfitAndLossChart = ({ tagFilter, hideLegend = false }) => {
24424
24512
  });
24425
24513
  };
24426
24514
  //#endregion
24427
- //#region src/components/Button/BackButton.tsx
24428
- var _excluded$27 = ["className", "textOnly"];
24429
- var BackButton = (_ref) => {
24430
- let { className, textOnly = false } = _ref, props = _objectWithoutProperties(_ref, _excluded$27);
24431
- const baseClassName = classNames("Layer__btn", "Layer__back-btn", className);
24432
- return /* @__PURE__ */ jsx("button", _objectSpread2(_objectSpread2({}, props), {}, {
24433
- className: baseClassName,
24434
- children: textOnly ? "Back" : /* @__PURE__ */ jsx(BackArrow, { size: 16 })
24435
- }));
24436
- };
24437
- //#endregion
24438
24515
  //#region src/components/DetailedCharts/DetailedChart.tsx
24439
24516
  var DetailedChart = ({ data, isLoading, interactionProps, stylingProps, slots }) => {
24440
24517
  var _chartData$find$value, _chartData$find;
@@ -24605,7 +24682,7 @@ var DetailedChart = ({ data, isLoading, interactionProps, stylingProps, slots })
24605
24682
  };
24606
24683
  //#endregion
24607
24684
  //#region src/icons/SortArrows.tsx
24608
- var _excluded$26 = ["size"];
24685
+ var _excluded$27 = ["size"];
24609
24686
  var ClassNames = {
24610
24687
  DESC_ARROW: "Layer__SortArrows__DescArrow",
24611
24688
  ASC_ARROW: "Layer__SortArrows__AscArrow"
@@ -24616,7 +24693,7 @@ var SortArrows = (_ref) => {
24616
24693
  xmlns: "http://www.w3.org/2000/svg",
24617
24694
  viewBox: "0 0 12 13",
24618
24695
  fill: "none"
24619
- }, _objectWithoutProperties(_ref, _excluded$26)), {}, {
24696
+ }, _objectWithoutProperties(_ref, _excluded$27)), {}, {
24620
24697
  width: size,
24621
24698
  height: size,
24622
24699
  children: [/* @__PURE__ */ jsxs("g", {
@@ -24761,7 +24838,7 @@ var RegularValueIcon = ({ colorMapping }) => {
24761
24838
  };
24762
24839
  //#endregion
24763
24840
  //#region src/components/DetailedTable/DetailedTable.tsx
24764
- var _excluded$25 = ["data"];
24841
+ var _excluded$26 = ["data"];
24765
24842
  var DetailedTable = ({ stylingProps, sortParams, sortFunction, interactionProps, rows, stringOverrides, showTypeColumn = true }) => {
24766
24843
  const { t } = useTranslation();
24767
24844
  const setAndToggleSortDirection = (params) => {
@@ -24771,22 +24848,12 @@ var DetailedTable = ({ stylingProps, sortParams, sortFunction, interactionProps,
24771
24848
  sortOrder: sortOrderOverride
24772
24849
  }, defaultSortOrder);
24773
24850
  };
24774
- const buildHeaderVariant = useCallback((column) => {
24775
- return sortParams.sortBy === column ? void 0 : "subtle";
24776
- }, [sortParams.sortBy]);
24777
24851
  const { isMobile, isDesktop } = useSizeClass();
24778
24852
  const hasType = showTypeColumn && rows.length > 0 && rows.map((r) => r.item.type).every((type) => type !== void 0);
24779
24853
  const isSortable = interactionProps !== NO_OP_INTERACTION_PROPS;
24780
- useEffect(() => {
24781
- if (!hasType && sortParams.sortBy === "type") sortFunction({
24782
- sortBy: "value",
24783
- sortOrder: void 0
24784
- }, SortOrder.DESC);
24785
- }, [
24786
- hasType,
24787
- sortParams.sortBy,
24788
- sortFunction
24789
- ]);
24854
+ const buildHeaderVariant = useCallback((column) => {
24855
+ return sortParams.sortBy === column ? void 0 : "subtle";
24856
+ }, [sortParams.sortBy]);
24790
24857
  return /* @__PURE__ */ jsx(VStack, {
24791
24858
  className: "Layer__DetailedTable",
24792
24859
  children: /* @__PURE__ */ jsx(VStack, {
@@ -24902,7 +24969,7 @@ var DetailedTable = ({ stylingProps, sortParams, sortFunction, interactionProps,
24902
24969
  });
24903
24970
  };
24904
24971
  var DetailedTableWithData = (_ref) => {
24905
- let { data } = _ref, props = _objectWithoutProperties(_ref, _excluded$25);
24972
+ let { data } = _ref, props = _objectWithoutProperties(_ref, _excluded$26);
24906
24973
  return /* @__PURE__ */ jsx(DetailedTable, _objectSpread2({ rows: useDetailedTableRows({ data }) }, props));
24907
24974
  };
24908
24975
  //#endregion
@@ -25075,9 +25142,20 @@ var LedgerAccountsContext = createContext({
25075
25142
  fetchMore: () => {}
25076
25143
  });
25077
25144
  //#endregion
25145
+ //#region src/components/Button/BackButton.tsx
25146
+ var _excluded$25 = ["className", "textOnly"];
25147
+ var BackButton = (_ref) => {
25148
+ let { className, textOnly = false } = _ref, props = _objectWithoutProperties(_ref, _excluded$25);
25149
+ const baseClassName = classNames("Layer__btn", "Layer__back-btn", className);
25150
+ return /* @__PURE__ */ jsx("button", _objectSpread2(_objectSpread2({}, props), {}, {
25151
+ className: baseClassName,
25152
+ children: textOnly ? "Back" : /* @__PURE__ */ jsx(BackArrow, { size: 16 })
25153
+ }));
25154
+ };
25155
+ //#endregion
25078
25156
  //#region src/components/Button/CloseButton.tsx
25079
25157
  var _excluded$24 = ["className", "textOnly"];
25080
- var CloseButton = (_ref) => {
25158
+ var CloseButton$1 = (_ref) => {
25081
25159
  let { className, textOnly = false } = _ref, props = _objectWithoutProperties(_ref, _excluded$24);
25082
25160
  const baseClassName = classNames("Layer__btn", "Layer__back-btn", className);
25083
25161
  return /* @__PURE__ */ jsx("button", _objectSpread2(_objectSpread2({}, props), {}, {
@@ -25456,7 +25534,7 @@ var LedgerAccountEntryDetails = ({ stringOverrides }) => {
25456
25534
  }),
25457
25535
  /* @__PURE__ */ jsx(HeaderCol, {
25458
25536
  className: "Layer__show-lg Layer__show-xl",
25459
- children: /* @__PURE__ */ jsx(CloseButton, { onClick: closeSelectedEntry })
25537
+ children: /* @__PURE__ */ jsx(CloseButton$1, { onClick: closeSelectedEntry })
25460
25538
  })
25461
25539
  ] })
25462
25540
  }),
@@ -25586,7 +25664,7 @@ var PnlDetailColumns = /* @__PURE__ */ function(PnlDetailColumns) {
25586
25664
  PnlDetailColumns["Balance"] = "Balance";
25587
25665
  return PnlDetailColumns;
25588
25666
  }(PnlDetailColumns || {});
25589
- var ErrorState$5 = () => {
25667
+ var ErrorState$3 = () => {
25590
25668
  const { t } = useTranslation();
25591
25669
  return /* @__PURE__ */ jsx(DataState, {
25592
25670
  spacing: true,
@@ -25769,7 +25847,7 @@ var ProfitAndLossDetailReport = ({ lineItemName, breadcrumbPath, onClose, onBrea
25769
25847
  shrinkHeightToFitRows: true,
25770
25848
  slots: {
25771
25849
  EmptyState: EmptyState$4,
25772
- ErrorState: ErrorState$5
25850
+ ErrorState: ErrorState$3
25773
25851
  }
25774
25852
  }), rowsWithRunningBalance.lines.length > 0 && /* @__PURE__ */ jsxs(HStack, {
25775
25853
  pb: "sm",
@@ -25822,6 +25900,68 @@ function DetailReportModal({ isOpen, onOpenChange, selectedItem, onBreadcrumbCli
25822
25900
  });
25823
25901
  }
25824
25902
  //#endregion
25903
+ //#region src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedChartsHeader.tsx
25904
+ var HeaderTitle = ({ title, dateLabel, isTablet, showDatePicker }) => /* @__PURE__ */ jsxs(VStack, {
25905
+ className: "Layer__ProfitAndLossDetailedChartsHeader__head",
25906
+ children: [
25907
+ /* @__PURE__ */ jsx(Span, {
25908
+ size: "lg",
25909
+ weight: "bold",
25910
+ children: title
25911
+ }),
25912
+ /* @__PURE__ */ jsx(Span, {
25913
+ size: "sm",
25914
+ variant: isTablet ? void 0 : "subtle",
25915
+ className: "Layer__ProfitAndLossDetailedChartsHeader__date",
25916
+ children: dateLabel
25917
+ }),
25918
+ !isTablet && showDatePicker && /* @__PURE__ */ jsx(GlobalMonthPicker, {})
25919
+ ]
25920
+ });
25921
+ var CloseButtonVariant = /* @__PURE__ */ function(CloseButtonVariant) {
25922
+ CloseButtonVariant["OutlinedIconButton"] = "OutlinedIconButton";
25923
+ CloseButtonVariant["BackButton"] = "BackButton";
25924
+ return CloseButtonVariant;
25925
+ }(CloseButtonVariant || {});
25926
+ var CloseButton = ({ variant, onClose, ariaLabel }) => {
25927
+ if (variant === CloseButtonVariant.BackButton) return /* @__PURE__ */ jsx(BackButton, {
25928
+ onClick: onClose,
25929
+ "aria-label": ariaLabel
25930
+ });
25931
+ return /* @__PURE__ */ jsx(Button$1, {
25932
+ icon: true,
25933
+ inset: true,
25934
+ variant: "outlined",
25935
+ onPress: onClose,
25936
+ "aria-label": ariaLabel,
25937
+ children: /* @__PURE__ */ jsx(XIcon, {})
25938
+ });
25939
+ };
25940
+ var ProfitAndLossDetailedChartsHeader = ({ title, date, mode, showCloseButton = true, showDatePicker = false, onClose }) => {
25941
+ const { t } = useTranslation();
25942
+ const { formatDate } = useIntlFormatter();
25943
+ const isTablet = mode === "tablet";
25944
+ const headerProps = {
25945
+ title,
25946
+ isTablet,
25947
+ showDatePicker,
25948
+ dateLabel: formatDate(date, DateFormat.MonthYear)
25949
+ };
25950
+ const closeButtonProps = {
25951
+ variant: isTablet ? CloseButtonVariant.BackButton : CloseButtonVariant.OutlinedIconButton,
25952
+ onClose,
25953
+ ariaLabel: t("common:action.close_label", "Close")
25954
+ };
25955
+ return /* @__PURE__ */ jsxs("header", {
25956
+ className: classNames("Layer__ProfitAndLossDetailedChartsHeader", `Layer__ProfitAndLossDetailedChartsHeader--${mode}`),
25957
+ children: [
25958
+ isTablet && showCloseButton && /* @__PURE__ */ jsx(CloseButton, _objectSpread2({}, closeButtonProps)),
25959
+ /* @__PURE__ */ jsx(HeaderTitle, _objectSpread2({}, headerProps)),
25960
+ !isTablet && showCloseButton && /* @__PURE__ */ jsx(CloseButton, _objectSpread2({}, closeButtonProps))
25961
+ ]
25962
+ });
25963
+ };
25964
+ //#endregion
25825
25965
  //#region src/utils/chartColors.ts
25826
25966
  var DEFAULT_CHART_COLORS = [
25827
25967
  "#008028",
@@ -25932,9 +26072,9 @@ var DetailedChartsDatePickerHeader = () => {
25932
26072
  });
25933
26073
  };
25934
26074
  var ProfitAndLossDetailedCharts = ({ scope, hideClose = false, hideHeader = false, showDatePicker = false, chartColorsList, stringOverrides, slotProps }) => {
25935
- var _ref, _filters$activeScope, _filters$activeScope$, _filters$activeScope2, _ref2;
26075
+ var _ref, _filters$activeScope, _filters$activeScope$, _filters$activeScope2, _ref2, _slotProps$detailedTa, _slotProps$detailedTa2;
25936
26076
  const { t } = useTranslation();
25937
- const { formatDate } = useIntlFormatter();
26077
+ const { isDesktop } = useSizeClass();
25938
26078
  const { chartDataRevenue, tableDataRevenue, totalRevenue, chartDataExpenses, tableDataExpenses, totalExpenses, sortBy: _oldSortByScope, isLoading, filters, dateRange, sidebarScope, setSidebarScope } = useContext(ProfitAndLossContext);
25939
26079
  const activeScope = (_ref = scope !== null && scope !== void 0 ? scope : sidebarScope) !== null && _ref !== void 0 ? _ref : "expenses";
25940
26080
  const sortOrder = ((_filters$activeScope = filters[activeScope]) === null || _filters$activeScope === void 0 ? void 0 : _filters$activeScope.sortOrder) === SortOrder.ASC ? SortOrder.ASC : SortOrder.DESC;
@@ -25942,10 +26082,21 @@ var ProfitAndLossDetailedCharts = ({ scope, hideClose = false, hideHeader = fals
25942
26082
  const chartData = activeScope === "revenue" ? chartDataRevenue : chartDataExpenses;
25943
26083
  const tableData = activeScope === "revenue" ? tableDataRevenue : tableDataExpenses;
25944
26084
  const total = (_ref2 = activeScope === "revenue" ? totalRevenue : totalExpenses) !== null && _ref2 !== void 0 ? _ref2 : 0;
25945
- const sortParams = useMemo(() => ({
25946
- sortBy: sortByField,
26085
+ const tableHasType = ((_slotProps$detailedTa = slotProps === null || slotProps === void 0 || (_slotProps$detailedTa2 = slotProps.detailedTable) === null || _slotProps$detailedTa2 === void 0 ? void 0 : _slotProps$detailedTa2.showTypeColumn) !== null && _slotProps$detailedTa !== void 0 ? _slotProps$detailedTa : true) && tableData.length > 0 && tableData.every((item) => item.type !== void 0);
26086
+ const sortParams = useMemo(() => {
26087
+ if (!tableHasType && sortByField === "type") return {
26088
+ sortBy: "value",
26089
+ sortOrder: SortOrder.DESC
26090
+ };
26091
+ return {
26092
+ sortBy: sortByField,
26093
+ sortOrder
26094
+ };
26095
+ }, [
26096
+ tableHasType,
26097
+ sortByField,
25947
26098
  sortOrder
25948
- }), [sortByField, sortOrder]);
26099
+ ]);
25949
26100
  const isEmpty = useMemo(() => {
25950
26101
  if (isLoading) return false;
25951
26102
  const chartDataValues = chartData.map((x) => _objectSpread2(_objectSpread2({}, x), {}, { value: x.value > 0 ? x.value : 0 }));
@@ -25976,10 +26127,19 @@ var ProfitAndLossDetailedCharts = ({ scope, hideClose = false, hideHeader = fals
25976
26127
  colorSelector,
25977
26128
  fallbackFillSelector
25978
26129
  }), [colorSelector, fallbackFillSelector]);
26130
+ const sortedTableData = useMemo(() => {
26131
+ if (sortParams.sortBy === sortByField && sortParams.sortOrder === sortOrder) return tableData;
26132
+ return [...tableData].sort(createPnlLineItemComparator(sortParams));
26133
+ }, [
26134
+ tableData,
26135
+ sortParams,
26136
+ sortByField,
26137
+ sortOrder
26138
+ ]);
25979
26139
  const tableDataWithTotal = useMemo(() => ({
25980
- data: tableData,
26140
+ data: sortedTableData,
25981
26141
  total
25982
- }), [tableData, total]);
26142
+ }), [sortedTableData, total]);
25983
26143
  const chartDataWithTotal = useMemo(() => ({
25984
26144
  data: chartData,
25985
26145
  total
@@ -25988,50 +26148,17 @@ var ProfitAndLossDetailedCharts = ({ scope, hideClose = false, hideHeader = fals
25988
26148
  const sortFunction = useCallback((sortParams, defaultSortOrder) => {
25989
26149
  if (sortParams.sortBy) _oldSortByScope(activeScope, sortParams.sortBy, sortParams.sortOrder, defaultSortOrder);
25990
26150
  }, [_oldSortByScope, activeScope]);
26151
+ const handleClose = useCallback(() => setSidebarScope(void 0), [setSidebarScope]);
25991
26152
  return /* @__PURE__ */ jsxs("div", {
25992
26153
  className: "Layer__profit-and-loss-detailed-charts",
25993
26154
  children: [
25994
- !hideHeader && /* @__PURE__ */ jsxs("header", {
25995
- className: "Layer__profit-and-loss-detailed-charts__header",
25996
- children: [/* @__PURE__ */ jsxs(VStack, {
25997
- className: "Layer__profit-and-loss-detailed-charts__head",
25998
- children: [
25999
- /* @__PURE__ */ jsx(Span, {
26000
- size: "lg",
26001
- weight: "bold",
26002
- children: humanizeTitle(activeScope, stringOverrides === null || stringOverrides === void 0 ? void 0 : stringOverrides.detailedChartStringOverrides, t)
26003
- }),
26004
- /* @__PURE__ */ jsx(Span, {
26005
- size: "sm",
26006
- variant: "subtle",
26007
- children: formatDate(dateRange.startDate, DateFormat.MonthYear)
26008
- }),
26009
- showDatePicker && /* @__PURE__ */ jsx(GlobalMonthPicker, {})
26010
- ]
26011
- }), !hideClose && /* @__PURE__ */ jsx(Button$1, {
26012
- icon: true,
26013
- inset: true,
26014
- variant: "outlined",
26015
- onPress: () => setSidebarScope(void 0),
26016
- "aria-label": t("common:action.close", "Close"),
26017
- children: /* @__PURE__ */ jsx(X$1, {})
26018
- })]
26019
- }),
26020
- !hideHeader && /* @__PURE__ */ jsxs("header", {
26021
- className: "Layer__profit-and-loss-detailed-charts__header--tablet",
26022
- children: [!hideClose && /* @__PURE__ */ jsx(BackButton, { onClick: () => setSidebarScope(void 0) }), /* @__PURE__ */ jsxs(VStack, {
26023
- className: "Layer__profit-and-loss-detailed-charts__head",
26024
- children: [/* @__PURE__ */ jsx(Span, {
26025
- size: "lg",
26026
- weight: "bold",
26027
- className: "title",
26028
- children: humanizeTitle(activeScope, stringOverrides === null || stringOverrides === void 0 ? void 0 : stringOverrides.detailedChartStringOverrides, t)
26029
- }), /* @__PURE__ */ jsx(Span, {
26030
- size: "sm",
26031
- className: "date",
26032
- children: formatDate(dateRange.startDate, DateFormat.MonthYear)
26033
- })]
26034
- })]
26155
+ !hideHeader && /* @__PURE__ */ jsx(ProfitAndLossDetailedChartsHeader, {
26156
+ mode: isDesktop ? "desktop" : "tablet",
26157
+ title: humanizeTitle(activeScope, stringOverrides === null || stringOverrides === void 0 ? void 0 : stringOverrides.detailedChartStringOverrides, t),
26158
+ date: dateRange.startDate,
26159
+ showCloseButton: !hideClose,
26160
+ showDatePicker,
26161
+ onClose: handleClose
26035
26162
  }),
26036
26163
  /* @__PURE__ */ jsx("div", {
26037
26164
  className: "Layer__profit-and-loss-detailed-charts__content",
@@ -26315,7 +26442,7 @@ var getProfitAndLossDetailLinesExcel = (apiUrl, accessToken, params) => {
26315
26442
  });
26316
26443
  return get(({ businessId }) => `/v1/businesses/${businessId}/reports/profit-and-loss/lines/exports/excel?${queryParams.toString()}`)(apiUrl, accessToken, { params: { businessId } });
26317
26444
  };
26318
- function buildKey$59({ access_token: accessToken, apiUrl, businessId, startDate, endDate, pnlStructureLineItemName, tagFilter, reportingBasis, pnlStructure }) {
26445
+ function buildKey$58({ access_token: accessToken, apiUrl, businessId, startDate, endDate, pnlStructureLineItemName, tagFilter, reportingBasis, pnlStructure }) {
26319
26446
  if (accessToken && apiUrl) return {
26320
26447
  accessToken,
26321
26448
  apiUrl,
@@ -26338,7 +26465,7 @@ function useProfitAndLossDetailLinesExport({ startDate, endDate, pnlStructureLin
26338
26465
  const { data: auth } = useAuth();
26339
26466
  const { businessId } = useLayerContext();
26340
26467
  const { apiUrl } = useEnvironment();
26341
- return useSWRMutation(() => withLocale(buildKey$59(_objectSpread2(_objectSpread2({}, auth), {}, {
26468
+ return useSWRMutation(() => withLocale(buildKey$58(_objectSpread2(_objectSpread2({}, auth), {}, {
26342
26469
  apiUrl,
26343
26470
  businessId,
26344
26471
  startDate,
@@ -27814,7 +27941,7 @@ ProfitAndLoss.Report = ProfitAndLossReport;
27814
27941
  var getBalanceSheet = get(({ businessId, effectiveDate }) => {
27815
27942
  return `/v1/businesses/${businessId}/reports/balance-sheet?${toDefinedSearchParameters({ effectiveDate })}`;
27816
27943
  });
27817
- function buildKey$58({ access_token: accessToken, apiUrl, businessId, effectiveDate }) {
27944
+ function buildKey$57({ access_token: accessToken, apiUrl, businessId, effectiveDate }) {
27818
27945
  if (accessToken && apiUrl) return {
27819
27946
  accessToken,
27820
27947
  apiUrl,
@@ -27828,7 +27955,7 @@ function useBalanceSheet({ effectiveDate = endOfDay(/* @__PURE__ */ new Date())
27828
27955
  const { data: auth } = useAuth();
27829
27956
  const { apiUrl } = useEnvironment();
27830
27957
  const { businessId } = useLayerContext();
27831
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$58(_objectSpread2(_objectSpread2({}, auth), {}, {
27958
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$57(_objectSpread2(_objectSpread2({}, auth), {}, {
27832
27959
  apiUrl,
27833
27960
  businessId,
27834
27961
  effectiveDate
@@ -27892,7 +28019,7 @@ var getBalanceSheetExcel = get(({ businessId, effectiveDate }) => {
27892
28019
  return `/v1/businesses/${businessId}/reports/balance-sheet/exports/excel?${toDefinedSearchParameters({ effectiveDate })}`;
27893
28020
  });
27894
28021
  var DOWNLOAD_BALANCE_SHEET_TAG_KEY = "#download-balance-sheet";
27895
- function buildKey$57({ access_token: accessToken, apiUrl, businessId, effectiveDate }) {
28022
+ function buildKey$56({ access_token: accessToken, apiUrl, businessId, effectiveDate }) {
27896
28023
  if (accessToken && apiUrl) return {
27897
28024
  accessToken,
27898
28025
  apiUrl,
@@ -27905,7 +28032,7 @@ function useBalanceSheetDownload({ effectiveDate, onSuccess }) {
27905
28032
  const withLocale = useLocalizedKey();
27906
28033
  const { data: auth } = useAuth();
27907
28034
  const { businessId } = useLayerContext();
27908
- return useSWRMutation(() => withLocale(buildKey$57(_objectSpread2(_objectSpread2({}, auth), {}, {
28035
+ return useSWRMutation(() => withLocale(buildKey$56(_objectSpread2(_objectSpread2({}, auth), {}, {
27909
28036
  businessId,
27910
28037
  effectiveDate
27911
28038
  }))), ({ accessToken, apiUrl, businessId, effectiveDate }) => getBalanceSheetExcel(apiUrl, accessToken, { params: {
@@ -28120,7 +28247,7 @@ var getStatementOfCashFlow = get(({ businessId, startDate, endDate }) => {
28120
28247
  endDate
28121
28248
  })}`;
28122
28249
  });
28123
- function buildKey$56({ access_token: accessToken, apiUrl, businessId, startDate, endDate }) {
28250
+ function buildKey$55({ access_token: accessToken, apiUrl, businessId, startDate, endDate }) {
28124
28251
  if (accessToken && apiUrl) return {
28125
28252
  accessToken,
28126
28253
  apiUrl,
@@ -28135,7 +28262,7 @@ function useStatementOfCashFlow({ startDate = startOfMonth(/* @__PURE__ */ new D
28135
28262
  const { data: auth } = useAuth();
28136
28263
  const { apiUrl } = useEnvironment();
28137
28264
  const { businessId } = useLayerContext();
28138
- return new SWRQueryResult(useSWR(withLocale(buildKey$56(_objectSpread2(_objectSpread2({}, auth), {}, {
28265
+ return new SWRQueryResult(useSWR(withLocale(buildKey$55(_objectSpread2(_objectSpread2({}, auth), {}, {
28139
28266
  apiUrl,
28140
28267
  businessId,
28141
28268
  startDate,
@@ -28196,7 +28323,7 @@ var getCashflowStatementCSV = get(({ businessId, startDate, endDate }) => {
28196
28323
  })}`;
28197
28324
  });
28198
28325
  var DOWNLOAD_CASHFLOW_STATEMENT_TAG_KEY = "#download-cashflow-statement";
28199
- function buildKey$55({ access_token: accessToken, apiUrl, businessId, startDate, endDate }) {
28326
+ function buildKey$54({ access_token: accessToken, apiUrl, businessId, startDate, endDate }) {
28200
28327
  if (accessToken && apiUrl) return {
28201
28328
  accessToken,
28202
28329
  apiUrl,
@@ -28210,7 +28337,7 @@ function useCashflowStatementDownload({ startDate, endDate, onSuccess }) {
28210
28337
  const withLocale = useLocalizedKey();
28211
28338
  const { data: auth } = useAuth();
28212
28339
  const { businessId } = useLayerContext();
28213
- return useSWRMutation(() => withLocale(buildKey$55(_objectSpread2(_objectSpread2({}, auth), {}, {
28340
+ return useSWRMutation(() => withLocale(buildKey$54(_objectSpread2(_objectSpread2({}, auth), {}, {
28214
28341
  businessId,
28215
28342
  startDate,
28216
28343
  endDate
@@ -28380,7 +28507,7 @@ var StatementOfCashFlowView = ({ view: propView, stringOverrides, dateSelectionM
28380
28507
  //#endregion
28381
28508
  //#region src/hooks/api/businesses/[business-id]/ledger/accounts/[account-id]/useDeleteLedgerAccount.ts
28382
28509
  var deleteAccountFromLedger = del(({ businessId, accountId }) => `/v1/businesses/${businessId}/ledger/accounts/${accountId}`);
28383
- function buildKey$54({ access_token: accessToken, apiUrl, businessId }) {
28510
+ function buildKey$53({ access_token: accessToken, apiUrl, businessId }) {
28384
28511
  if (accessToken && apiUrl) return {
28385
28512
  accessToken,
28386
28513
  apiUrl,
@@ -28392,7 +28519,7 @@ function useDeleteAccountFromLedger() {
28392
28519
  const withLocale = useLocalizedKey();
28393
28520
  const { data } = useAuth();
28394
28521
  const { businessId } = useLayerContext();
28395
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$54(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { accountId } }) => deleteAccountFromLedger(apiUrl, accessToken, { params: {
28522
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$53(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { accountId } }) => deleteAccountFromLedger(apiUrl, accessToken, { params: {
28396
28523
  businessId,
28397
28524
  accountId
28398
28525
  } }), {
@@ -28414,7 +28541,7 @@ var getLedgerAccountBalances = get(({ businessId, startDate, endDate }) => {
28414
28541
  endDate
28415
28542
  })}`;
28416
28543
  });
28417
- function buildKey$53({ access_token: accessToken, apiUrl, businessId, startDate, endDate }) {
28544
+ function buildKey$52({ access_token: accessToken, apiUrl, businessId, startDate, endDate }) {
28418
28545
  if (accessToken && apiUrl) return {
28419
28546
  accessToken,
28420
28547
  apiUrl,
@@ -28428,7 +28555,7 @@ function useLedgerBalances(withDates, startDate, endDate) {
28428
28555
  const withLocale = useLocalizedKey();
28429
28556
  const { data } = useAuth();
28430
28557
  const { businessId } = useLayerContext();
28431
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$53(_objectSpread2(_objectSpread2({}, data), {}, {
28558
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$52(_objectSpread2(_objectSpread2({}, data), {}, {
28432
28559
  businessId,
28433
28560
  startDate: withDates ? startDate : void 0,
28434
28561
  endDate: withDates ? endDate : void 0
@@ -28996,7 +29123,7 @@ function useListLedgerAccountLines({ accountId, include_entries_before_activatio
28996
29123
  //#region src/hooks/api/businesses/[business-id]/ledger/entries/[entry-id]/useLedgerAccountsEntry.ts
28997
29124
  var LEDGER_ACCOUNTS_ENTRY_TAG_KEY = "#ledger-accounts-entry";
28998
29125
  var getLedgerAccountsEntry = get(({ businessId, entryId }) => `/v1/businesses/${businessId}/ledger/entries/${entryId}`);
28999
- function buildKey$52({ accessToken, apiUrl, businessId, entryId }) {
29126
+ function buildKey$51({ accessToken, apiUrl, businessId, entryId }) {
29000
29127
  if (!accessToken || !entryId) return null;
29001
29128
  return {
29002
29129
  accessToken,
@@ -29011,7 +29138,7 @@ function useLedgerAccountsEntry({ entryId }) {
29011
29138
  const { businessId } = useLayerContext();
29012
29139
  const { apiUrl } = useEnvironment();
29013
29140
  const { data: auth } = useAuth();
29014
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$52({
29141
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$51({
29015
29142
  accessToken: auth === null || auth === void 0 ? void 0 : auth.access_token,
29016
29143
  apiUrl,
29017
29144
  businessId,
@@ -29763,7 +29890,7 @@ var Plus$1 = (_ref) => {
29763
29890
  //#endregion
29764
29891
  //#region src/hooks/api/businesses/[business-id]/ledger/balances/exports/csv/useAccountBalancesDownload.ts
29765
29892
  var getLedgerAccountBalancesCSV = get(({ businessId }) => `/v1/businesses/${businessId}/ledger/balances/exports/csv`);
29766
- function buildKey$51({ access_token: accessToken, apiUrl, businessId, startCutoff, endCutoff }) {
29893
+ function buildKey$50({ access_token: accessToken, apiUrl, businessId, startCutoff, endCutoff }) {
29767
29894
  if (accessToken && apiUrl) return {
29768
29895
  accessToken,
29769
29896
  apiUrl,
@@ -29781,7 +29908,7 @@ function useAccountBalancesDownload({ startCutoff, endCutoff, onSuccess }) {
29781
29908
  const withLocale = useLocalizedKey();
29782
29909
  const { data: auth } = useAuth();
29783
29910
  const { businessId } = useLayerContext();
29784
- return useSWRMutation(() => withLocale(buildKey$51(_objectSpread2(_objectSpread2({}, auth), {}, {
29911
+ return useSWRMutation(() => withLocale(buildKey$50(_objectSpread2(_objectSpread2({}, auth), {}, {
29785
29912
  businessId,
29786
29913
  startCutoff,
29787
29914
  endCutoff
@@ -30752,7 +30879,7 @@ var UpsertJournalEntryMode = /* @__PURE__ */ function(UpsertJournalEntryMode) {
30752
30879
  return UpsertJournalEntryMode;
30753
30880
  }({});
30754
30881
  var createJournalEntry = post(({ businessId }) => `/v1/businesses/${businessId}/ledger/journal-entries`);
30755
- function buildKey$50({ access_token: accessToken, apiUrl, businessId }) {
30882
+ function buildKey$49({ access_token: accessToken, apiUrl, businessId }) {
30756
30883
  if (accessToken && apiUrl) return {
30757
30884
  accessToken,
30758
30885
  apiUrl,
@@ -30769,7 +30896,7 @@ var useUpsertJournalEntry = (props) => {
30769
30896
  const { forceReloadLedgerEntries } = useLedgerEntriesCacheActions();
30770
30897
  const { debouncedInvalidateProfitAndLoss } = useProfitAndLossGlobalInvalidator();
30771
30898
  const { invalidate } = useGlobalCacheActions();
30772
- const rawMutationResponse = useSWRMutation(() => withLocale(buildKey$50(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: body }) => {
30899
+ const rawMutationResponse = useSWRMutation(() => withLocale(buildKey$49(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: body }) => {
30773
30900
  return createJournalEntry(apiUrl, accessToken, {
30774
30901
  params: { businessId },
30775
30902
  body
@@ -31479,7 +31606,7 @@ var JournalEntryDrawerHeader = ({ onSubmit, formState }) => {
31479
31606
  //#endregion
31480
31607
  //#region src/hooks/api/businesses/[business-id]/ledger/entries/exports/csv/useJournalEntriesDownload.ts
31481
31608
  var getJournalEntriesCSV = get(({ businessId }) => `/v1/businesses/${businessId}/ledger/entries/exports/csv`);
31482
- function buildKey$49({ access_token: accessToken, apiUrl, businessId, startCutoff, endCutoff }) {
31609
+ function buildKey$48({ access_token: accessToken, apiUrl, businessId, startCutoff, endCutoff }) {
31483
31610
  if (accessToken && apiUrl) return {
31484
31611
  accessToken,
31485
31612
  apiUrl,
@@ -31497,7 +31624,7 @@ function useJournalEntriesDownload({ startCutoff, endCutoff, onSuccess }) {
31497
31624
  const withLocale = useLocalizedKey();
31498
31625
  const { data: auth } = useAuth();
31499
31626
  const { businessId } = useLayerContext();
31500
- return useSWRMutation(() => withLocale(buildKey$49(_objectSpread2(_objectSpread2({}, auth), {}, {
31627
+ return useSWRMutation(() => withLocale(buildKey$48(_objectSpread2(_objectSpread2({}, auth), {}, {
31501
31628
  businessId,
31502
31629
  startCutoff,
31503
31630
  endCutoff
@@ -31602,7 +31729,7 @@ var JournalEntryDetails = () => {
31602
31729
  }),
31603
31730
  /* @__PURE__ */ jsx(HeaderCol, {
31604
31731
  className: "Layer__show-lg Layer__show-xl",
31605
- children: /* @__PURE__ */ jsx(CloseButton, { onClick: closeSelectedEntry })
31732
+ children: /* @__PURE__ */ jsx(CloseButton$1, { onClick: closeSelectedEntry })
31606
31733
  })
31607
31734
  ] })
31608
31735
  }),
@@ -32189,7 +32316,7 @@ function getIconForTask(task) {
32189
32316
  //#endregion
32190
32317
  //#region src/hooks/api/businesses/[business-id]/tasks/[task-id]/upload/delete/useDeleteUploadsOnTask.ts
32191
32318
  var deleteUploadsOnTask = post(({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/upload/delete`);
32192
- function buildKey$48({ access_token: accessToken, apiUrl, businessId }) {
32319
+ function buildKey$47({ access_token: accessToken, apiUrl, businessId }) {
32193
32320
  if (accessToken && apiUrl) return {
32194
32321
  accessToken,
32195
32322
  apiUrl,
@@ -32202,7 +32329,7 @@ function useDeleteUploadsOnTask() {
32202
32329
  const { data: auth } = useAuth();
32203
32330
  const { businessId } = useLayerContext();
32204
32331
  const { mutate } = useSWRConfig();
32205
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$48(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { taskId } }) => deleteUploadsOnTask(apiUrl, accessToken, { params: {
32332
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$47(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { taskId } }) => deleteUploadsOnTask(apiUrl, accessToken, { params: {
32206
32333
  businessId,
32207
32334
  taskId
32208
32335
  } }), {
@@ -32223,7 +32350,7 @@ function useDeleteUploadsOnTask() {
32223
32350
  //#endregion
32224
32351
  //#region src/hooks/api/businesses/[business-id]/tasks/[task-id]/upload/update-description/useUpdateTaskUploadDescription.ts
32225
32352
  var updateTaskUploadsDescription = post(({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/upload/update-description`);
32226
- function buildKey$47({ access_token: accessToken, apiUrl, businessId }) {
32353
+ function buildKey$46({ access_token: accessToken, apiUrl, businessId }) {
32227
32354
  if (accessToken && apiUrl) return {
32228
32355
  accessToken,
32229
32356
  apiUrl,
@@ -32236,7 +32363,7 @@ function useUpdateTaskUploadDescription() {
32236
32363
  const { data: auth } = useAuth();
32237
32364
  const { businessId } = useLayerContext();
32238
32365
  const { mutate } = useSWRConfig();
32239
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$47(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { taskId, description } }) => updateTaskUploadsDescription(apiUrl, accessToken, {
32366
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$46(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { taskId, description } }) => updateTaskUploadsDescription(apiUrl, accessToken, {
32240
32367
  params: {
32241
32368
  businessId,
32242
32369
  taskId
@@ -32268,7 +32395,7 @@ function completeTaskWithUpload(baseUrl, accessToken, { businessId, taskId, file
32268
32395
  if (description) formData.append("description", description);
32269
32396
  return postWithFormData(`/v1/businesses/${businessId}/tasks/${taskId}/upload`, formData, baseUrl, accessToken);
32270
32397
  }
32271
- function buildKey$46({ access_token: accessToken, apiUrl, businessId }) {
32398
+ function buildKey$45({ access_token: accessToken, apiUrl, businessId }) {
32272
32399
  if (accessToken && apiUrl) return {
32273
32400
  accessToken,
32274
32401
  apiUrl,
@@ -32281,7 +32408,7 @@ function useUploadDocumentsForTask() {
32281
32408
  const { data: auth } = useAuth();
32282
32409
  const { businessId } = useLayerContext();
32283
32410
  const { mutate } = useSWRConfig();
32284
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$46(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { taskId, files, description } }) => completeTaskWithUpload(apiUrl, accessToken, {
32411
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$45(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { taskId, files, description } }) => completeTaskWithUpload(apiUrl, accessToken, {
32285
32412
  businessId,
32286
32413
  taskId,
32287
32414
  files,
@@ -32304,7 +32431,7 @@ function useUploadDocumentsForTask() {
32304
32431
  //#endregion
32305
32432
  //#region src/hooks/api/businesses/[business-id]/tasks/[task-id]/user-response/useSubmitResponseForTask.ts
32306
32433
  var submitUserResponseForTask = post(({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/user-response`);
32307
- function buildKey$45({ access_token: accessToken, apiUrl, businessId }) {
32434
+ function buildKey$44({ access_token: accessToken, apiUrl, businessId }) {
32308
32435
  if (accessToken && apiUrl) return {
32309
32436
  accessToken,
32310
32437
  apiUrl,
@@ -32317,7 +32444,7 @@ function useSubmitUserResponseForTask() {
32317
32444
  const { data: auth } = useAuth();
32318
32445
  const { businessId } = useLayerContext();
32319
32446
  const { mutate } = useSWRConfig();
32320
- const mutationResponse = useSWRMutation(() => withLocale(buildKey$45(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { taskId, userResponse } }) => submitUserResponseForTask(apiUrl, accessToken, {
32447
+ const mutationResponse = useSWRMutation(() => withLocale(buildKey$44(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: { taskId, userResponse } }) => submitUserResponseForTask(apiUrl, accessToken, {
32321
32448
  body: {
32322
32449
  type: "FreeResponse",
32323
32450
  user_response: userResponse
@@ -34361,7 +34488,7 @@ var MileageSummarySchema = Schema.Struct({ years: Schema.Array(MileageYearSchema
34361
34488
  //#endregion
34362
34489
  //#region src/hooks/api/businesses/[business-id]/mileage/summary/useMileageSummary.tsx
34363
34490
  var MILEAGE_SUMMARY_TAG_KEY = "#mileage-summary";
34364
- function buildKey$44({ access_token: accessToken, apiUrl, businessId }) {
34491
+ function buildKey$43({ access_token: accessToken, apiUrl, businessId }) {
34365
34492
  if (accessToken && apiUrl) return {
34366
34493
  accessToken,
34367
34494
  apiUrl,
@@ -34374,7 +34501,7 @@ function useMileageSummary() {
34374
34501
  const withLocale = useLocalizedKey();
34375
34502
  const { data } = useAuth();
34376
34503
  const { businessId } = useLayerContext();
34377
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$44(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }) => getMileageSummary(apiUrl, accessToken, { params: { businessId } })().then(({ data }) => Schema.decodeUnknownPromise(MileageSummarySchema)(data))));
34504
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$43(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }) => getMileageSummary(apiUrl, accessToken, { params: { businessId } })().then(({ data }) => Schema.decodeUnknownPromise(MileageSummarySchema)(data))));
34378
34505
  }
34379
34506
  var useMileageSummaryGlobalCacheActions = () => {
34380
34507
  const { invalidate } = useGlobalCacheActions();
@@ -34577,7 +34704,7 @@ var listVehicles = get(({ businessId, allowArchived }) => {
34577
34704
  return `/v1/businesses/${businessId}/mileage/vehicles?${toDefinedSearchParameters({ allowArchived })}`;
34578
34705
  });
34579
34706
  var VEHICLES_TAG_KEY = "#list-vehicles";
34580
- function buildKey$43({ access_token: accessToken, apiUrl, businessId, allowArchived }) {
34707
+ function buildKey$42({ access_token: accessToken, apiUrl, businessId, allowArchived }) {
34581
34708
  if (accessToken && apiUrl) return {
34582
34709
  accessToken,
34583
34710
  apiUrl,
@@ -34596,7 +34723,7 @@ function useListVehicles({ allowArchived } = {}) {
34596
34723
  const withLocale = useLocalizedKey();
34597
34724
  const { data } = useAuth();
34598
34725
  const { businessId } = useLayerContext();
34599
- return new ListVehiclesSWRResponse(useSWR(() => withLocale(buildKey$43(_objectSpread2(_objectSpread2({}, data), {}, {
34726
+ return new ListVehiclesSWRResponse(useSWR(() => withLocale(buildKey$42(_objectSpread2(_objectSpread2({}, data), {}, {
34600
34727
  businessId,
34601
34728
  allowArchived
34602
34729
  }))), ({ accessToken, apiUrl, businessId, allowArchived }) => listVehicles(apiUrl, accessToken, { params: {
@@ -34625,7 +34752,7 @@ var UpsertTripMode = /* @__PURE__ */ function(UpsertTripMode) {
34625
34752
  }({});
34626
34753
  var createTrip = post(({ businessId }) => `/v1/businesses/${businessId}/mileage/trips`);
34627
34754
  var updateTrip = patch(({ businessId, tripId }) => `/v1/businesses/${businessId}/mileage/trips/${tripId}`);
34628
- function buildKey$42({ access_token: accessToken, apiUrl, businessId, tripId = void 0 }) {
34755
+ function buildKey$41({ access_token: accessToken, apiUrl, businessId, tripId = void 0 }) {
34629
34756
  if (accessToken && apiUrl) return {
34630
34757
  accessToken,
34631
34758
  apiUrl,
@@ -34666,7 +34793,7 @@ var useUpsertTrip = (props) => {
34666
34793
  const { businessId } = useLayerContext();
34667
34794
  const { mode } = props;
34668
34795
  const tripId = mode === UpsertTripMode.Update ? props.tripId : void 0;
34669
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$42(_objectSpread2(_objectSpread2({}, data), {}, {
34796
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$41(_objectSpread2(_objectSpread2({}, data), {}, {
34670
34797
  businessId,
34671
34798
  tripId
34672
34799
  }))), ({ accessToken, apiUrl, businessId, tripId }, { arg: body }) => {
@@ -35499,7 +35626,7 @@ var InvoiceSummaryStatsResponseSchema = Schema.Struct({
35499
35626
  //#endregion
35500
35627
  //#region src/hooks/api/businesses/[business-id]/invoices/summary-stats/useInvoiceSummaryStats.tsx
35501
35628
  var INVOICE_SUMMARY_STATS_TAG_KEY = "#invoices-summary-stats";
35502
- function buildKey$41({ access_token: accessToken, apiUrl, businessId }) {
35629
+ function buildKey$40({ access_token: accessToken, apiUrl, businessId }) {
35503
35630
  if (accessToken && apiUrl) return {
35504
35631
  accessToken,
35505
35632
  apiUrl,
@@ -35512,7 +35639,7 @@ function useInvoiceSummaryStats() {
35512
35639
  const withLocale = useLocalizedKey();
35513
35640
  const { data } = useAuth();
35514
35641
  const { businessId } = useLayerContext();
35515
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$41(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }) => getInvoiceSummaryStats(apiUrl, accessToken, { params: { businessId } })().then(({ data }) => Schema.decodeUnknownPromise(InvoiceSummaryStatsResponseSchema)(data))));
35642
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$40(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }) => getInvoiceSummaryStats(apiUrl, accessToken, { params: { businessId } })().then(({ data }) => Schema.decodeUnknownPromise(InvoiceSummaryStatsResponseSchema)(data))));
35516
35643
  }
35517
35644
  var useInvoiceSummaryStatsCacheActions = () => {
35518
35645
  const { forceReload } = useGlobalCacheActions();
@@ -35625,7 +35752,7 @@ var UpsertInvoiceMode = /* @__PURE__ */ function(UpsertInvoiceMode) {
35625
35752
  }({});
35626
35753
  var createInvoice = post(({ businessId }) => `/v1/businesses/${businessId}/invoices`);
35627
35754
  var updateInvoice = patch(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}`);
35628
- function buildKey$40({ access_token: accessToken, apiUrl, businessId, invoiceId = void 0 }) {
35755
+ function buildKey$39({ access_token: accessToken, apiUrl, businessId, invoiceId = void 0 }) {
35629
35756
  if (accessToken && apiUrl) return {
35630
35757
  accessToken,
35631
35758
  apiUrl,
@@ -35666,7 +35793,7 @@ var useUpsertInvoice = (props) => {
35666
35793
  const { businessId } = useLayerContext();
35667
35794
  const { mode } = props;
35668
35795
  const invoiceId = mode === UpsertInvoiceMode.Update ? props.invoiceId : void 0;
35669
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$40(_objectSpread2(_objectSpread2({}, data), {}, {
35796
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$39(_objectSpread2(_objectSpread2({}, data), {}, {
35670
35797
  businessId,
35671
35798
  invoiceId
35672
35799
  }))), ({ accessToken, apiUrl, businessId, invoiceId }, { arg: body }) => {
@@ -36288,7 +36415,7 @@ var CustomerRefundSchema = Schema.Struct({
36288
36415
  var REFUND_INVOICE_TAG_KEY = "#refund-invoice";
36289
36416
  var RefundInvoiceReturnSchema = Schema.Struct({ data: CustomerRefundSchema });
36290
36417
  var refundInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/refund`);
36291
- function buildKey$39({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
36418
+ function buildKey$38({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
36292
36419
  if (accessToken && apiUrl) return {
36293
36420
  accessToken,
36294
36421
  apiUrl,
@@ -36308,7 +36435,7 @@ var useRefundInvoice = ({ invoiceId }) => {
36308
36435
  if (invoice.id !== invoiceId) return invoice;
36309
36436
  return updateInvoiceWithRefund(invoice);
36310
36437
  }, [invoiceId]);
36311
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$39(_objectSpread2(_objectSpread2({}, data), {}, {
36438
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$38(_objectSpread2(_objectSpread2({}, data), {}, {
36312
36439
  businessId,
36313
36440
  invoiceId
36314
36441
  }))), ({ accessToken, apiUrl, businessId, invoiceId }, { arg: body }) => {
@@ -36616,7 +36743,7 @@ function InvoiceRefundModal({ isOpen, onOpenChange, invoice, onSuccess }) {
36616
36743
  var RESET_INVOICE_TAG_KEY = "#reset-invoice";
36617
36744
  var ResetInvoiceReturnSchema = Schema.Struct({ data: InvoiceSchema });
36618
36745
  var resetInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/reset`);
36619
- function buildKey$38({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
36746
+ function buildKey$37({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
36620
36747
  if (accessToken && apiUrl) return {
36621
36748
  accessToken,
36622
36749
  apiUrl,
@@ -36629,7 +36756,7 @@ var useResetInvoice = ({ invoiceId }) => {
36629
36756
  const withLocale = useLocalizedKey();
36630
36757
  const { data } = useAuth();
36631
36758
  const { businessId } = useLayerContext();
36632
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$38(_objectSpread2(_objectSpread2({}, data), {}, {
36759
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$37(_objectSpread2(_objectSpread2({}, data), {}, {
36633
36760
  businessId,
36634
36761
  invoiceId
36635
36762
  }))), ({ accessToken, apiUrl, businessId, invoiceId }) => {
@@ -36684,7 +36811,7 @@ function InvoiceResetModal({ isOpen, onOpenChange, invoice, onSuccess }) {
36684
36811
  var VOID_INVOICE_TAG_KEY = "#void-invoice";
36685
36812
  var VoidInvoiceReturnSchema = Schema.Struct({ data: InvoiceSchema });
36686
36813
  var voidInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/void`);
36687
- function buildKey$37({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
36814
+ function buildKey$36({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
36688
36815
  if (accessToken && apiUrl) return {
36689
36816
  accessToken,
36690
36817
  apiUrl,
@@ -36697,7 +36824,7 @@ var useVoidInvoice = ({ invoiceId }) => {
36697
36824
  const withLocale = useLocalizedKey();
36698
36825
  const { data } = useAuth();
36699
36826
  const { businessId } = useLayerContext();
36700
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$37(_objectSpread2(_objectSpread2({}, data), {}, {
36827
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$36(_objectSpread2(_objectSpread2({}, data), {}, {
36701
36828
  businessId,
36702
36829
  invoiceId
36703
36830
  }))), ({ accessToken, apiUrl, businessId, invoiceId }) => {
@@ -36782,7 +36909,7 @@ var InvoiceWriteoffSchema = Schema.Struct({
36782
36909
  //#region src/hooks/api/businesses/[business-id]/invoices/[invoice-id]/write-off/useWriteoffInvoice.tsx
36783
36910
  var CREATE_INVOICE_WRITEOFF_TAG_KEY = "#writeoff-invoice";
36784
36911
  var writeoffInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/write-off`);
36785
- function buildKey$36({ access_token: accessToken, apiUrl, businessId, invoiceId, invoiceWriteoffId = void 0 }) {
36912
+ function buildKey$35({ access_token: accessToken, apiUrl, businessId, invoiceId, invoiceWriteoffId = void 0 }) {
36786
36913
  if (accessToken && apiUrl) return {
36787
36914
  accessToken,
36788
36915
  apiUrl,
@@ -36808,7 +36935,7 @@ var useWriteoffInvoice = ({ invoiceId }) => {
36808
36935
  if (invoice.id !== invoiceId) return invoice;
36809
36936
  return updateInvoiceWithWriteoff(invoice);
36810
36937
  }, [invoiceId]);
36811
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$36(_objectSpread2(_objectSpread2({}, data), {}, {
36938
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$35(_objectSpread2(_objectSpread2({}, data), {}, {
36812
36939
  businessId,
36813
36940
  invoiceId
36814
36941
  }))), ({ accessToken, apiUrl, businessId, invoiceId }, { arg: decodedBody }) => {
@@ -37142,7 +37269,7 @@ var UpsertDedicatedInvoicePaymentMode = /* @__PURE__ */ function(UpsertDedicated
37142
37269
  }({});
37143
37270
  var createDedicatedInvoicePayment = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/payment/`);
37144
37271
  var updateDedicatedInvoicePayment = put(({ businessId, invoiceId, invoicePaymentId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/payment/${invoicePaymentId}`);
37145
- function buildKey$35({ access_token: accessToken, apiUrl, businessId, invoiceId, invoicePaymentId = void 0 }) {
37272
+ function buildKey$34({ access_token: accessToken, apiUrl, businessId, invoiceId, invoicePaymentId = void 0 }) {
37146
37273
  if (accessToken && apiUrl) return {
37147
37274
  accessToken,
37148
37275
  apiUrl,
@@ -37200,7 +37327,7 @@ var useUpsertDedicatedInvoicePayment = (props) => {
37200
37327
  if (invoice.id !== invoiceId) return invoice;
37201
37328
  return updateInvoiceWithPayment(invoice, invoicePayment);
37202
37329
  }, [invoiceId]);
37203
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$35(_objectSpread2(_objectSpread2({}, data), {}, {
37330
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$34(_objectSpread2(_objectSpread2({}, data), {}, {
37204
37331
  businessId,
37205
37332
  invoiceId,
37206
37333
  invoicePaymentId
@@ -37596,7 +37723,7 @@ var AccountingConfigurationSchema = Schema.Struct({
37596
37723
  //#endregion
37597
37724
  //#region src/hooks/api/businesses/[business-id]/accounting-config/useAccountingConfiguration.tsx
37598
37725
  var ACCOUNTING_CONFIGURATION_TAG_KEY = "#accounting-configuration";
37599
- function buildKey$34({ access_token: accessToken, apiUrl, businessId }) {
37726
+ function buildKey$33({ access_token: accessToken, apiUrl, businessId }) {
37600
37727
  if (accessToken && apiUrl) return {
37601
37728
  accessToken,
37602
37729
  apiUrl,
@@ -37610,7 +37737,7 @@ var getAccountingConfiguration = get(({ businessId }) => {
37610
37737
  function useAccountingConfiguration({ businessId }) {
37611
37738
  const { apiUrl } = useEnvironment();
37612
37739
  const { data: auth } = useAuth();
37613
- const queryKey = buildKey$34(_objectSpread2(_objectSpread2({}, auth), {}, {
37740
+ const queryKey = buildKey$33(_objectSpread2(_objectSpread2({}, auth), {}, {
37614
37741
  apiUrl,
37615
37742
  businessId
37616
37743
  }));
@@ -37626,7 +37753,7 @@ var UpsertCustomerMode = /* @__PURE__ */ function(UpsertCustomerMode) {
37626
37753
  }({});
37627
37754
  var createCustomer = post(({ businessId }) => `/v1/businesses/${businessId}/customers`);
37628
37755
  var updateCustomer = patch(({ businessId, customerId }) => `/v1/businesses/${businessId}/customers/${customerId}`);
37629
- function buildKey$33({ access_token: accessToken, apiUrl, businessId, customerId = void 0 }) {
37756
+ function buildKey$32({ access_token: accessToken, apiUrl, businessId, customerId = void 0 }) {
37630
37757
  if (accessToken && apiUrl) return {
37631
37758
  accessToken,
37632
37759
  apiUrl,
@@ -37670,7 +37797,7 @@ var useUpsertCustomer = (props) => {
37670
37797
  const { businessId } = useLayerContext();
37671
37798
  const { mode } = props;
37672
37799
  const customerId = mode === UpsertCustomerMode.Update ? props.customerId : void 0;
37673
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$33(_objectSpread2(_objectSpread2({}, data), {}, {
37800
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$32(_objectSpread2(_objectSpread2({}, data), {}, {
37674
37801
  businessId,
37675
37802
  customerId
37676
37803
  }))), ({ accessToken, apiUrl, businessId, customerId }, { arg: body }) => {
@@ -38766,7 +38893,7 @@ var InvoicePaymentMethodsResponseSchema = Schema.Struct({ data: InvoicePaymentMe
38766
38893
  //#endregion
38767
38894
  //#region src/hooks/api/businesses/[business-id]/invoices/[invoice-id]/payment-methods/useInvoicePaymentMethods.tsx
38768
38895
  var INVOICE_PAYMENT_METHODS_TAG_KEY = "#invoice-payment-methods";
38769
- function buildKey$32({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
38896
+ function buildKey$31({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
38770
38897
  if (accessToken && apiUrl && invoiceId) return {
38771
38898
  accessToken,
38772
38899
  apiUrl,
@@ -38780,7 +38907,7 @@ function useInvoicePaymentMethods({ invoiceId }) {
38780
38907
  const withLocale = useLocalizedKey();
38781
38908
  const { data } = useAuth();
38782
38909
  const { businessId } = useLayerContext();
38783
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$32(_objectSpread2(_objectSpread2({}, data), {}, {
38910
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$31(_objectSpread2(_objectSpread2({}, data), {}, {
38784
38911
  businessId,
38785
38912
  invoiceId
38786
38913
  }))), ({ accessToken, apiUrl, businessId, invoiceId }) => getInvoicePaymentMethods(apiUrl, accessToken, { params: {
@@ -38794,7 +38921,7 @@ var FINALIZE_INVOICE_TAG_KEY = "#finalize-invoice";
38794
38921
  var FinalizeInvoiceBodySchema = Schema.extend(InvoicePaymentMethodsSchema, Schema.Struct({ customPaymentInstructions: Schema.optional(Schema.String).pipe(Schema.fromKey("custom_payment_instructions")) }));
38795
38922
  var FinalizeInvoiceResponseSchema = Schema.Struct({ data: Schema.extend(InvoicePaymentMethodsSchema, Schema.Struct({ invoice: InvoiceSchema })) });
38796
38923
  var finalizeInvoice = put(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/finalize-invoice`);
38797
- function buildKey$31({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
38924
+ function buildKey$30({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
38798
38925
  if (accessToken && apiUrl) return {
38799
38926
  accessToken,
38800
38927
  apiUrl,
@@ -38808,7 +38935,7 @@ function useFinalizeInvoice({ invoiceId }) {
38808
38935
  const { data } = useAuth();
38809
38936
  const { businessId } = useLayerContext();
38810
38937
  const { mutate } = useSWRConfig();
38811
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$31(_objectSpread2(_objectSpread2({}, data), {}, {
38938
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$30(_objectSpread2(_objectSpread2({}, data), {}, {
38812
38939
  businessId,
38813
38940
  invoiceId
38814
38941
  }))), ({ accessToken, apiUrl, businessId, invoiceId }, { arg: body }) => finalizeInvoice(apiUrl, accessToken, {
@@ -38980,7 +39107,7 @@ var InvoiceFinalizeForm = ({ invoice, initialPaymentMethods, onSuccess }) => {
38980
39107
  //#endregion
38981
39108
  //#region src/hooks/api/businesses/[business-id]/invoices/[invoice-id]/html/useInvoicePreview.tsx
38982
39109
  var INVOICE_PREVIEW_TAG_KEY = "#invoices-preview";
38983
- function buildKey$30({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
39110
+ function buildKey$29({ access_token: accessToken, apiUrl, businessId, invoiceId }) {
38984
39111
  if (accessToken && apiUrl) return {
38985
39112
  accessToken,
38986
39113
  apiUrl,
@@ -38994,7 +39121,7 @@ function useInvoicePreview({ invoiceId }) {
38994
39121
  const withLocale = useLocalizedKey();
38995
39122
  const { data } = useAuth();
38996
39123
  const { businessId } = useLayerContext();
38997
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$30(_objectSpread2(_objectSpread2({}, data), {}, {
39124
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$29(_objectSpread2(_objectSpread2({}, data), {}, {
38998
39125
  businessId,
38999
39126
  invoiceId
39000
39127
  }))), ({ accessToken, apiUrl, businessId, invoiceId }) => getInvoicePreview(apiUrl, accessToken, { params: {
@@ -39387,7 +39514,7 @@ var StripeAccountStatusResponseSchema = Schema.Struct({ data: StripeAccountStatu
39387
39514
  //#endregion
39388
39515
  //#region src/hooks/api/businesses/[business-id]/stripe/status/useStripeAccountStatus.tsx
39389
39516
  var STRIPE_ACCOUNT_STATUS_TAG_KEY = "#stripe-account-status";
39390
- function buildKey$29({ access_token: accessToken, apiUrl, businessId }) {
39517
+ function buildKey$28({ access_token: accessToken, apiUrl, businessId }) {
39391
39518
  if (accessToken && apiUrl) return {
39392
39519
  accessToken,
39393
39520
  apiUrl,
@@ -39401,7 +39528,7 @@ function useStripeAccountStatus() {
39401
39528
  const { data } = useAuth();
39402
39529
  const { businessId } = useLayerContext();
39403
39530
  const { apiUrl } = useEnvironment();
39404
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$29(_objectSpread2(_objectSpread2({}, data), {}, {
39531
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$28(_objectSpread2(_objectSpread2({}, data), {}, {
39405
39532
  apiUrl,
39406
39533
  businessId
39407
39534
  }))), ({ accessToken, apiUrl, businessId }) => getStripeAccountStatus(apiUrl, accessToken, { params: { businessId } })().then(Schema.decodeUnknownPromise(StripeAccountStatusResponseSchema)).then(({ data }) => data)));
@@ -39521,7 +39648,7 @@ var StripeConnectAccountLinkDataSchema = Schema.Struct({
39521
39648
  });
39522
39649
  var StripeConnectAccountLinkResponseSchema = Schema.Struct({ data: StripeConnectAccountLinkDataSchema });
39523
39650
  var createStripeConnectAccountLink = post(({ businessId }) => `/v1/businesses/${businessId}/stripe/connect-account-link`);
39524
- function buildKey$28({ access_token: accessToken, apiUrl, businessId }) {
39651
+ function buildKey$27({ access_token: accessToken, apiUrl, businessId }) {
39525
39652
  if (accessToken && apiUrl) return {
39526
39653
  accessToken,
39527
39654
  apiUrl,
@@ -39534,7 +39661,7 @@ function useStripeConnectAccountLink() {
39534
39661
  const { data } = useAuth();
39535
39662
  const { businessId } = useLayerContext();
39536
39663
  const { apiUrl } = useEnvironment();
39537
- return new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$28(_objectSpread2(_objectSpread2({}, data), {}, {
39664
+ return new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$27(_objectSpread2(_objectSpread2({}, data), {}, {
39538
39665
  apiUrl,
39539
39666
  businessId
39540
39667
  }))), ({ accessToken, apiUrl, businessId }) => {
@@ -39700,7 +39827,7 @@ var Components = ({ hideChart = false, hideTable = false, stringOverrides }) =>
39700
39827
  //#region src/hooks/api/businesses/[business-id]/reports/config/useReportConfig.ts
39701
39828
  var REPORT_CONFIG_TAG_KEY = "#report-config";
39702
39829
  var getReportConfig = get(({ businessId }) => `/v1/businesses/${businessId}/reports/config`);
39703
- function buildKey$27({ access_token: accessToken, apiUrl, businessId }) {
39830
+ function buildKey$26({ access_token: accessToken, apiUrl, businessId }) {
39704
39831
  if (accessToken && apiUrl) return {
39705
39832
  accessToken,
39706
39833
  apiUrl,
@@ -39712,7 +39839,7 @@ function useReportConfig() {
39712
39839
  const withLocale = useLocalizedKey();
39713
39840
  const { data: auth } = useAuth();
39714
39841
  const { businessId } = useLayerContext();
39715
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$27(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), function() {
39842
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$26(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), function() {
39716
39843
  var _ref = _asyncToGenerator(function* ({ accessToken, apiUrl, businessId }) {
39717
39844
  return getReportConfig(apiUrl, accessToken, { params: { businessId } })().then(Schema.decodeUnknownPromise(ReportConfigResponseSchema)).then(({ data }) => data);
39718
39845
  });
@@ -40158,7 +40285,7 @@ var getUnifiedReportExcel = get((_ref) => {
40158
40285
  });
40159
40286
  var getTag$1 = (report) => `#unified-${report}-report-excel`;
40160
40287
  var UnifiedReportExcelReturnSchema = Schema.Struct({ data: S3PresignedUrlSchema });
40161
- function buildKey$26({ access_token: accessToken, apiUrl, businessId, params }) {
40288
+ function buildKey$25({ access_token: accessToken, apiUrl, businessId, params }) {
40162
40289
  if (!params || !accessToken || !apiUrl) return;
40163
40290
  return _objectSpread2(_objectSpread2({
40164
40291
  accessToken,
@@ -40172,7 +40299,7 @@ function useUnifiedReportExcel({ onSuccess } = {}) {
40172
40299
  const { apiUrl } = useEnvironment();
40173
40300
  const { businessId } = useLayerContext();
40174
40301
  const params = useUnifiedReportParams();
40175
- return new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$26(_objectSpread2(_objectSpread2({}, auth), {}, {
40302
+ return new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$25(_objectSpread2(_objectSpread2({}, auth), {}, {
40176
40303
  apiUrl,
40177
40304
  businessId,
40178
40305
  params
@@ -40235,7 +40362,7 @@ var _excluded$6 = ["businessId", "route"], _excluded2$1 = [
40235
40362
  "tags"
40236
40363
  ];
40237
40364
  var getTag = (report) => `#unified-${report}-report`;
40238
- function buildKey$25({ access_token: accessToken, apiUrl, businessId, params }) {
40365
+ function buildKey$24({ access_token: accessToken, apiUrl, businessId, params }) {
40239
40366
  if (!params || !accessToken || !apiUrl) return;
40240
40367
  return _objectSpread2(_objectSpread2({
40241
40368
  accessToken,
@@ -40253,7 +40380,7 @@ function useUnifiedReport() {
40253
40380
  const { apiUrl } = useEnvironment();
40254
40381
  const { businessId } = useLayerContext();
40255
40382
  const params = useUnifiedReportParams();
40256
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$25(_objectSpread2(_objectSpread2({}, auth), {}, {
40383
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$24(_objectSpread2(_objectSpread2({}, auth), {}, {
40257
40384
  apiUrl,
40258
40385
  businessId,
40259
40386
  params
@@ -40858,7 +40985,7 @@ var BankTransactionsWithLinkedAccounts = ({ title, showTitle = true, elevatedLin
40858
40985
  //#region src/hooks/api/businesses/[business-id]/call-bookings/useCreateCallBooking.tsx
40859
40986
  var CREATE_CALL_BOOKING_TAG_KEY = "#create-call-booking";
40860
40987
  var createCallBooking = post(({ businessId }) => `/v1/businesses/${businessId}/call-bookings`);
40861
- function buildKey$24({ access_token: accessToken, apiUrl, businessId }) {
40988
+ function buildKey$23({ access_token: accessToken, apiUrl, businessId }) {
40862
40989
  if (accessToken && apiUrl) return {
40863
40990
  accessToken,
40864
40991
  apiUrl,
@@ -40871,7 +40998,7 @@ function useCreateCallBooking() {
40871
40998
  const { data } = useAuth();
40872
40999
  const { businessId } = useLayerContext();
40873
41000
  const { forceReloadCallBookings } = useCallBookingsGlobalCacheActions();
40874
- const rawMutationResponse = useSWRMutation(() => withLocale(buildKey$24(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: body }) => createCallBooking(apiUrl, accessToken, {
41001
+ const rawMutationResponse = useSWRMutation(() => withLocale(buildKey$23(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }, { arg: body }) => createCallBooking(apiUrl, accessToken, {
40875
41002
  params: { businessId },
40876
41003
  body
40877
41004
  }).then(Schema.decodeUnknownPromise(CallBookingItemResponseSchema)), {
@@ -41433,6 +41560,40 @@ var GeneralLedgerView = ({ title, showTitle = true, showTags = true, showCustome
41433
41560
  });
41434
41561
  };
41435
41562
  //#endregion
41563
+ //#region src/hooks/features/mileage/useMileageTrackingYearlySummary.ts
41564
+ var EMPTY_MONTHS = Array.from({ length: 12 }, (_, i) => ({
41565
+ month: i + 1,
41566
+ miles: 0,
41567
+ estimatedDeduction: 0
41568
+ }));
41569
+ function useMileageTrackingYearlySummary() {
41570
+ const { data, isLoading, isError } = useMileageSummary();
41571
+ const { startDate } = useGlobalDateRange({ dateSelectionMode: "year" });
41572
+ const selectedYear = getYear(startDate);
41573
+ const selectedYearData = useMemo(() => data === null || data === void 0 ? void 0 : data.years.find((y) => y.year === selectedYear), [data, selectedYear]);
41574
+ return {
41575
+ data,
41576
+ selectedYear,
41577
+ selectedYearData,
41578
+ chartData: useMemo(() => {
41579
+ if (!selectedYearData) return { years: [{
41580
+ year: selectedYear,
41581
+ months: EMPTY_MONTHS
41582
+ }] };
41583
+ return { years: [{
41584
+ year: selectedYearData.year,
41585
+ months: selectedYearData.months.map(({ month, miles, estimatedDeduction }) => ({
41586
+ month,
41587
+ miles,
41588
+ estimatedDeduction
41589
+ }))
41590
+ }] };
41591
+ }, [selectedYearData, selectedYear]),
41592
+ isLoading,
41593
+ isError
41594
+ };
41595
+ }
41596
+ //#endregion
41436
41597
  //#region src/components/MileageDeductionChart/MileageDeductionChartTooltip.tsx
41437
41598
  var MileageDeductionChartTooltipContent = ({ active, payload }) => {
41438
41599
  const { t } = useTranslation();
@@ -41465,13 +41626,13 @@ var MileageDeductionChartTooltip = ({ cursorWidth }) => /* @__PURE__ */ jsx(Char
41465
41626
  });
41466
41627
  //#endregion
41467
41628
  //#region src/components/MileageDeductionChart/MileageDeductionChart.tsx
41468
- var CHART_MARGIN$1 = {
41629
+ var CHART_MARGIN$2 = {
41469
41630
  top: 0,
41470
41631
  right: 0,
41471
41632
  bottom: 0,
41472
41633
  left: 0
41473
41634
  };
41474
- var CHART_HEIGHT$1 = 328;
41635
+ var DEFAULT_CHART_HEIGHT = 328;
41475
41636
  var RESIZE_DEBOUNCE_MS = 50;
41476
41637
  var CURSOR_WIDTH_MULTIPLE = 2.2;
41477
41638
  var BAR_RADIUS = [
@@ -41494,7 +41655,7 @@ var getBarSize = (width) => {
41494
41655
  if (width < MEDIUM_BREAKPOINT) return MEDIUM_BAR_SIZE;
41495
41656
  return LARGE_BAR_SIZE;
41496
41657
  };
41497
- var MileageDeductionChart = ({ data, selectedYear }) => {
41658
+ var MileageDeductionChart = ({ data, selectedYear, chartHeight = DEFAULT_CHART_HEIGHT }) => {
41498
41659
  var _getColor$hex, _getColor;
41499
41660
  const { getColor } = useLayerContext();
41500
41661
  const { formatDate, formatCurrencyFromCents } = useIntlFormatter();
@@ -41505,7 +41666,7 @@ var MileageDeductionChart = ({ data, selectedYear }) => {
41505
41666
  justify: "center",
41506
41667
  children: /* @__PURE__ */ jsx(ResponsiveContainer, {
41507
41668
  width: "100%",
41508
- height: CHART_HEIGHT$1,
41669
+ height: chartHeight,
41509
41670
  debounce: RESIZE_DEBOUNCE_MS,
41510
41671
  onResize: useCallback((width) => {
41511
41672
  setBarSize(getBarSize(width));
@@ -41529,7 +41690,7 @@ var MileageDeductionChart = ({ data, selectedYear }) => {
41529
41690
  formatDate,
41530
41691
  selectedYear
41531
41692
  ]),
41532
- margin: CHART_MARGIN$1,
41693
+ margin: CHART_MARGIN$2,
41533
41694
  children: [
41534
41695
  /* @__PURE__ */ jsx(CartesianGrid, {
41535
41696
  vertical: false,
@@ -41559,11 +41720,6 @@ var MileageDeductionChart = ({ data, selectedYear }) => {
41559
41720
  };
41560
41721
  //#endregion
41561
41722
  //#region src/components/MileageTrackingStats/MileageTrackingStats.tsx
41562
- var EMPTY_MONTHS = Array.from({ length: 12 }, (_, i) => ({
41563
- month: i + 1,
41564
- miles: 0,
41565
- estimatedDeduction: 0
41566
- }));
41567
41723
  var MileageTrackingStatsRow = ({ label, value }) => {
41568
41724
  const { formatNumber } = useIntlFormatter();
41569
41725
  return /* @__PURE__ */ jsxs(VStack, {
@@ -41578,12 +41734,14 @@ var MileageTrackingStatsRow = ({ label, value }) => {
41578
41734
  })]
41579
41735
  });
41580
41736
  };
41581
- var MileageTrackingStatsCard = ({ title, amount, formatAsMoney, breakdown }) => {
41737
+ var MileageTrackingStatsCard = ({ title, amount, formatAsMoney, breakdown, description }) => {
41582
41738
  const { t } = useTranslation();
41583
41739
  const { formatNumber } = useIntlFormatter();
41584
41740
  return /* @__PURE__ */ jsxs(VStack, {
41585
41741
  className: "Layer__MileageTrackingStats__Card",
41586
41742
  gap: "3xs",
41743
+ pi: "xs",
41744
+ pb: "xs",
41587
41745
  children: [
41588
41746
  /* @__PURE__ */ jsx(Span, {
41589
41747
  size: "md",
@@ -41598,6 +41756,11 @@ var MileageTrackingStatsCard = ({ title, amount, formatAsMoney, breakdown }) =>
41598
41756
  weight: "bold",
41599
41757
  children: formatNumber(amount)
41600
41758
  }),
41759
+ description && /* @__PURE__ */ jsx(Span, {
41760
+ size: "xs",
41761
+ variant: "subtle",
41762
+ children: description
41763
+ }),
41601
41764
  breakdown && /* @__PURE__ */ jsxs(HStack, {
41602
41765
  gap: "md",
41603
41766
  children: [
@@ -41621,26 +41784,7 @@ var MileageTrackingStatsCard = ({ title, amount, formatAsMoney, breakdown }) =>
41621
41784
  var MileageTrackingStats = () => {
41622
41785
  var _selectedYearData$est, _selectedYearData$mil, _selectedYearData$bus, _selectedYearData$per, _selectedYearData$unc, _selectedYearData$tri, _selectedYearData$bus2, _selectedYearData$per2, _selectedYearData$unc2;
41623
41786
  const { t } = useTranslation();
41624
- const { data: mileageData, isLoading, isError } = useMileageSummary();
41625
- const { startDate } = useGlobalDateRange({ dateSelectionMode: "year" });
41626
- const selectedYear = getYear(startDate);
41627
- const selectedYearData = useMemo(() => {
41628
- return mileageData === null || mileageData === void 0 ? void 0 : mileageData.years.find((y) => y.year === selectedYear);
41629
- }, [mileageData, selectedYear]);
41630
- const chartData = useMemo(() => {
41631
- if (!selectedYearData) return { years: [{
41632
- year: selectedYear,
41633
- months: EMPTY_MONTHS
41634
- }] };
41635
- return { years: [{
41636
- year: selectedYearData.year,
41637
- months: selectedYearData.months.map(({ month, miles, estimatedDeduction }) => ({
41638
- month,
41639
- miles,
41640
- estimatedDeduction
41641
- }))
41642
- }] };
41643
- }, [selectedYearData, selectedYear]);
41787
+ const { data: mileageData, selectedYear, selectedYearData, chartData, isLoading, isError } = useMileageTrackingYearlySummary();
41644
41788
  if (isError) return /* @__PURE__ */ jsx(Container, {
41645
41789
  name: "mileage-tracking-stats",
41646
41790
  children: /* @__PURE__ */ jsx(DataState, {
@@ -41833,7 +41977,7 @@ function useAutoResetPageIndex(filters, data) {
41833
41977
  //#region src/hooks/api/businesses/[business-id]/mileage/trips/[trip-id]/useDeleteTrip.tsx
41834
41978
  var DELETE_TRIP_TAG_KEY = "#delete-trip";
41835
41979
  var deleteTrip = del(({ businessId, tripId }) => `/v1/businesses/${businessId}/mileage/trips/${tripId}`);
41836
- function buildKey$23({ access_token: accessToken, apiUrl, businessId, tripId }) {
41980
+ function buildKey$22({ access_token: accessToken, apiUrl, businessId, tripId }) {
41837
41981
  if (accessToken && apiUrl) return {
41838
41982
  accessToken,
41839
41983
  apiUrl,
@@ -41846,7 +41990,7 @@ var useDeleteTrip = ({ tripId }) => {
41846
41990
  const withLocale = useLocalizedKey();
41847
41991
  const { data } = useAuth();
41848
41992
  const { businessId } = useLayerContext();
41849
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$23(_objectSpread2(_objectSpread2({}, data), {}, {
41993
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$22(_objectSpread2(_objectSpread2({}, data), {}, {
41850
41994
  businessId,
41851
41995
  tripId
41852
41996
  }))), ({ accessToken, apiUrl, businessId, tripId }) => {
@@ -42390,7 +42534,7 @@ var UpsertVehicleMode = /* @__PURE__ */ function(UpsertVehicleMode) {
42390
42534
  }({});
42391
42535
  var createVehicle = post(({ businessId }) => `/v1/businesses/${businessId}/mileage/vehicles`);
42392
42536
  var updateVehicle = patch(({ businessId, vehicleId }) => `/v1/businesses/${businessId}/mileage/vehicles/${vehicleId}`);
42393
- function buildKey$22({ access_token: accessToken, apiUrl, businessId, vehicleId = void 0 }) {
42537
+ function buildKey$21({ access_token: accessToken, apiUrl, businessId, vehicleId = void 0 }) {
42394
42538
  if (accessToken && apiUrl) return {
42395
42539
  accessToken,
42396
42540
  apiUrl,
@@ -42434,7 +42578,7 @@ var useUpsertVehicle = (props) => {
42434
42578
  const { businessId } = useLayerContext();
42435
42579
  const { mode } = props;
42436
42580
  const vehicleId = mode === UpsertVehicleMode.Update ? props.vehicleId : void 0;
42437
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$22(_objectSpread2(_objectSpread2({}, data), {}, {
42581
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$21(_objectSpread2(_objectSpread2({}, data), {}, {
42438
42582
  businessId,
42439
42583
  vehicleId
42440
42584
  }))), ({ accessToken, apiUrl, businessId, vehicleId }, { arg: body }) => {
@@ -42743,7 +42887,7 @@ var VehicleDrawer = ({ isOpen, onOpenChange, vehicle, onSuccess }) => {
42743
42887
  var ARCHIVE_VEHICLE_TAG_KEY = "#archive-vehicle";
42744
42888
  var ArchiveVehicleReturnSchema = Schema.Struct({ data: VehicleSchema });
42745
42889
  var archiveVehicle = post(({ businessId, vehicleId }) => `/v1/businesses/${businessId}/mileage/vehicles/${vehicleId}/archive`);
42746
- function buildKey$21({ access_token: accessToken, apiUrl, businessId, vehicleId }) {
42890
+ function buildKey$20({ access_token: accessToken, apiUrl, businessId, vehicleId }) {
42747
42891
  if (accessToken && apiUrl) return {
42748
42892
  accessToken,
42749
42893
  apiUrl,
@@ -42756,7 +42900,7 @@ var useArchiveVehicle = ({ vehicleId }) => {
42756
42900
  const withLocale = useLocalizedKey();
42757
42901
  const { data } = useAuth();
42758
42902
  const { businessId } = useLayerContext();
42759
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$21(_objectSpread2(_objectSpread2({}, data), {}, {
42903
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$20(_objectSpread2(_objectSpread2({}, data), {}, {
42760
42904
  businessId,
42761
42905
  vehicleId
42762
42906
  }))), ({ accessToken, apiUrl, businessId, vehicleId }) => {
@@ -42804,7 +42948,7 @@ function VehicleArchiveConfirmationModal({ isOpen, onOpenChange, vehicle, useDra
42804
42948
  //#region src/hooks/api/businesses/[business-id]/mileage/vehicles/[vehicle-id]/useDeleteVehicle.tsx
42805
42949
  var DELETE_VEHICLE_TAG_KEY = "#delete-vehicle";
42806
42950
  var deleteVehicle = del(({ businessId, vehicleId }) => `/v1/businesses/${businessId}/mileage/vehicles/${vehicleId}`);
42807
- function buildKey$20({ access_token: accessToken, apiUrl, businessId, vehicleId }) {
42951
+ function buildKey$19({ access_token: accessToken, apiUrl, businessId, vehicleId }) {
42808
42952
  if (accessToken && apiUrl) return {
42809
42953
  accessToken,
42810
42954
  apiUrl,
@@ -42817,7 +42961,7 @@ var useDeleteVehicle = ({ vehicleId }) => {
42817
42961
  const withLocale = useLocalizedKey();
42818
42962
  const { data } = useAuth();
42819
42963
  const { businessId } = useLayerContext();
42820
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$20(_objectSpread2(_objectSpread2({}, data), {}, {
42964
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$19(_objectSpread2(_objectSpread2({}, data), {}, {
42821
42965
  businessId,
42822
42966
  vehicleId
42823
42967
  }))), ({ accessToken, apiUrl, businessId, vehicleId }) => {
@@ -42866,7 +43010,7 @@ function VehicleDeleteConfirmationModal({ isOpen, onOpenChange, vehicle, useDraw
42866
43010
  var REACTIVATE_VEHICLE_TAG_KEY = "#reactivate-vehicle";
42867
43011
  var ReactivateVehicleReturnSchema = Schema.Struct({ data: VehicleSchema });
42868
43012
  var reactivateVehicle = post(({ businessId, vehicleId }) => `/v1/businesses/${businessId}/mileage/vehicles/${vehicleId}/reactivate`);
42869
- function buildKey$19({ access_token: accessToken, apiUrl, businessId, vehicleId }) {
43013
+ function buildKey$18({ access_token: accessToken, apiUrl, businessId, vehicleId }) {
42870
43014
  if (accessToken && apiUrl) return {
42871
43015
  accessToken,
42872
43016
  apiUrl,
@@ -42879,7 +43023,7 @@ var useReactivateVehicle = ({ vehicleId }) => {
42879
43023
  const withLocale = useLocalizedKey();
42880
43024
  const { data } = useAuth();
42881
43025
  const { businessId } = useLayerContext();
42882
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$19(_objectSpread2(_objectSpread2({}, data), {}, {
43026
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$18(_objectSpread2(_objectSpread2({}, data), {}, {
42883
43027
  businessId,
42884
43028
  vehicleId
42885
43029
  }))), ({ accessToken, apiUrl, businessId, vehicleId }) => {
@@ -43418,188 +43562,567 @@ var ReportsPanel = ({ openReport, stringOverrides, profitAndLossConfig, statemen
43418
43562
  ] });
43419
43563
  };
43420
43564
  //#endregion
43421
- //#region src/types/location.ts
43422
- var US_STATES_CONFIG = [
43423
- _objectSpread2({ value: "AL" }, translationKey("usStates:label.alabama", "Alabama")),
43424
- _objectSpread2({ value: "AK" }, translationKey("usStates:label.alaska", "Alaska")),
43425
- _objectSpread2({ value: "AZ" }, translationKey("usStates:label.arizona", "Arizona")),
43426
- _objectSpread2({ value: "AR" }, translationKey("usStates:label.arkansas", "Arkansas")),
43427
- _objectSpread2({ value: "CA" }, translationKey("usStates:label.california", "California")),
43428
- _objectSpread2({ value: "CO" }, translationKey("usStates:label.colorado", "Colorado")),
43429
- _objectSpread2({ value: "CT" }, translationKey("usStates:label.connecticut", "Connecticut")),
43430
- _objectSpread2({ value: "DE" }, translationKey("usStates:label.delaware", "Delaware")),
43431
- _objectSpread2({ value: "DC" }, translationKey("usStates:label.district_columbia", "District of Columbia")),
43432
- _objectSpread2({ value: "FL" }, translationKey("usStates:label.florida", "Florida")),
43433
- _objectSpread2({ value: "GA" }, translationKey("usStates:label.georgia", "Georgia")),
43434
- _objectSpread2({ value: "HI" }, translationKey("usStates:label.hawaii", "Hawaii")),
43435
- _objectSpread2({ value: "ID" }, translationKey("usStates:label.idaho", "Idaho")),
43436
- _objectSpread2({ value: "IL" }, translationKey("usStates:label.illinois", "Illinois")),
43437
- _objectSpread2({ value: "IN" }, translationKey("usStates:label.indiana", "Indiana")),
43438
- _objectSpread2({ value: "IA" }, translationKey("usStates:label.iowa", "Iowa")),
43439
- _objectSpread2({ value: "KS" }, translationKey("usStates:label.kansas", "Kansas")),
43440
- _objectSpread2({ value: "KY" }, translationKey("usStates:label.kentucky", "Kentucky")),
43441
- _objectSpread2({ value: "LA" }, translationKey("usStates:label.louisiana", "Louisiana")),
43442
- _objectSpread2({ value: "ME" }, translationKey("usStates:label.maine", "Maine")),
43443
- _objectSpread2({ value: "MD" }, translationKey("usStates:label.maryland", "Maryland")),
43444
- _objectSpread2({ value: "MA" }, translationKey("usStates:label.massachusetts", "Massachusetts")),
43445
- _objectSpread2({ value: "MI" }, translationKey("usStates:label.michigan", "Michigan")),
43446
- _objectSpread2({ value: "MN" }, translationKey("usStates:label.minnesota", "Minnesota")),
43447
- _objectSpread2({ value: "MS" }, translationKey("usStates:label.mississippi", "Mississippi")),
43448
- _objectSpread2({ value: "MO" }, translationKey("usStates:label.missouri", "Missouri")),
43449
- _objectSpread2({ value: "MT" }, translationKey("usStates:label.montana", "Montana")),
43450
- _objectSpread2({ value: "NE" }, translationKey("usStates:label.nebraska", "Nebraska")),
43451
- _objectSpread2({ value: "NV" }, translationKey("usStates:label.nevada", "Nevada")),
43452
- _objectSpread2({ value: "NH" }, translationKey("usStates:label.new_hampshire", "New Hampshire")),
43453
- _objectSpread2({ value: "NJ" }, translationKey("usStates:label.new_jersey", "New Jersey")),
43454
- _objectSpread2({ value: "NM" }, translationKey("usStates:label.new_mexico", "New Mexico")),
43455
- _objectSpread2({ value: "NY" }, translationKey("usStates:label.new_york", "New York")),
43456
- _objectSpread2({ value: "NC" }, translationKey("usStates:label.north_carolina", "North Carolina")),
43457
- _objectSpread2({ value: "ND" }, translationKey("usStates:label.north_dakota", "North Dakota")),
43458
- _objectSpread2({ value: "OH" }, translationKey("usStates:label.ohio", "Ohio")),
43459
- _objectSpread2({ value: "OK" }, translationKey("usStates:label.oklahoma", "Oklahoma")),
43460
- _objectSpread2({ value: "OR" }, translationKey("usStates:label.oregon", "Oregon")),
43461
- _objectSpread2({ value: "PA" }, translationKey("usStates:label.pennsylvania", "Pennsylvania")),
43462
- _objectSpread2({ value: "RI" }, translationKey("usStates:label.rhode_island", "Rhode Island")),
43463
- _objectSpread2({ value: "SC" }, translationKey("usStates:label.south_carolina", "South Carolina")),
43464
- _objectSpread2({ value: "SD" }, translationKey("usStates:label.south_dakota", "South Dakota")),
43465
- _objectSpread2({ value: "TN" }, translationKey("usStates:label.tennessee", "Tennessee")),
43466
- _objectSpread2({ value: "TX" }, translationKey("usStates:label.texas", "Texas")),
43467
- _objectSpread2({ value: "UT" }, translationKey("usStates:label.utah", "Utah")),
43468
- _objectSpread2({ value: "VT" }, translationKey("usStates:label.vermont", "Vermont")),
43469
- _objectSpread2({ value: "VA" }, translationKey("usStates:label.virginia", "Virginia")),
43470
- _objectSpread2({ value: "WA" }, translationKey("usStates:label.washington", "Washington")),
43471
- _objectSpread2({ value: "WV" }, translationKey("usStates:label.west_virginia", "West Virginia")),
43472
- _objectSpread2({ value: "WI" }, translationKey("usStates:label.wisconsin", "Wisconsin")),
43473
- _objectSpread2({ value: "WY" }, translationKey("usStates:label.wyoming", "Wyoming")),
43474
- _objectSpread2({ value: "PR" }, translationKey("usStates:label.puerto_rico", "Puerto Rico"))
43475
- ];
43476
- var US_STATE_VALUES = US_STATES_CONFIG.map((s) => s.value);
43565
+ //#region src/components/ui/SummaryCard/SummaryCard.tsx
43566
+ var SummaryCard = ({ slots, children, className }) => {
43567
+ const { title, subtitle, legend, primaryAction } = slots;
43568
+ const titleNode = typeof title === "string" ? /* @__PURE__ */ jsx(Heading$2, {
43569
+ size: "md",
43570
+ children: title
43571
+ }) : title;
43572
+ const subtitleNode = typeof subtitle === "string" ? /* @__PURE__ */ jsx(Span, {
43573
+ size: "sm",
43574
+ variant: "subtle",
43575
+ children: subtitle
43576
+ }) : subtitle;
43577
+ return /* @__PURE__ */ jsx(Card, {
43578
+ className: classNames("Layer__SummaryCard", className),
43579
+ children: /* @__PURE__ */ jsxs(VStack, {
43580
+ className: "Layer__SummaryCard__Body",
43581
+ children: [/* @__PURE__ */ jsxs(HStack, {
43582
+ className: "Layer__SummaryCard__Header",
43583
+ justify: "space-between",
43584
+ align: "center",
43585
+ gap: "md",
43586
+ pb: "md",
43587
+ pi: "lg",
43588
+ children: [/* @__PURE__ */ jsxs(VStack, {
43589
+ className: "Layer__SummaryCard__HeaderTitle",
43590
+ children: [titleNode, subtitleNode && /* @__PURE__ */ jsx("div", {
43591
+ className: "Layer__SummaryCard__HeaderSubtitle",
43592
+ children: subtitleNode
43593
+ })]
43594
+ }), (legend || primaryAction) && /* @__PURE__ */ jsxs(HStack, {
43595
+ className: "Layer__SummaryCard__HeaderActions",
43596
+ gap: "md",
43597
+ align: "center",
43598
+ children: [legend && /* @__PURE__ */ jsx("div", {
43599
+ className: "Layer__SummaryCard__HeaderLegend",
43600
+ children: legend
43601
+ }), primaryAction && /* @__PURE__ */ jsx("div", {
43602
+ className: "Layer__SummaryCard__HeaderPrimaryAction",
43603
+ children: primaryAction
43604
+ })]
43605
+ })]
43606
+ }), /* @__PURE__ */ jsx("div", {
43607
+ className: "Layer__SummaryCard__Content",
43608
+ children
43609
+ })]
43610
+ })
43611
+ });
43612
+ };
43477
43613
  //#endregion
43478
- //#region src/schemas/taxEstimates/filingStatus.ts
43479
- var FilingStatus = /* @__PURE__ */ function(FilingStatus) {
43480
- FilingStatus["SINGLE"] = "SINGLE";
43481
- FilingStatus["MARRIED"] = "MARRIED";
43482
- FilingStatus["MARRIED_SEPARATELY"] = "MARRIED_SEPARATELY";
43483
- FilingStatus["HEAD"] = "HEAD";
43484
- FilingStatus["WIDOWER"] = "WIDOWER";
43485
- return FilingStatus;
43486
- }({});
43487
- var FilingStatusSchema = Schema.Enums(FilingStatus);
43614
+ //#region src/hooks/utils/i18n/useGlobalMonthSubtitle.ts
43615
+ var useGlobalMonthSubtitle = () => {
43616
+ const { formatDate } = useIntlFormatter();
43617
+ const { date } = useGlobalDate({ dateSelectionMode: "month" });
43618
+ return formatDate(date, MonthYearPattern.MonthYear);
43619
+ };
43488
43620
  //#endregion
43489
- //#region src/schemas/taxEstimates/profile.ts
43490
- var USStateCodeSchema = Schema.Literal(...US_STATE_VALUES);
43491
- var WithholdingSchema = Schema.Struct({
43492
- useCustomWithholding: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Boolean)), Schema.fromKey("use_custom_withholding")),
43493
- amount: Schema.NullishOr(Schema.Number)
43494
- });
43495
- var HomeOfficeDeductionSchema = Schema.Struct({
43496
- useHomeOfficeDeduction: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Boolean)), Schema.fromKey("use_home_office_deduction")),
43497
- homeOfficeArea: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Number)), Schema.fromKey("home_office_area"))
43498
- });
43499
- var VehicleDeductionSchema = Schema.Struct({ useMileageDeduction: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Boolean)), Schema.fromKey("use_mileage_deduction")) });
43500
- var DeductionsSchema = Schema.Struct({
43501
- homeOffice: pipe(Schema.propertySignature(Schema.NullishOr(HomeOfficeDeductionSchema)), Schema.fromKey("home_office")),
43502
- vehicle: Schema.NullishOr(VehicleDeductionSchema)
43503
- });
43504
- var FederalConfigurationSchema = Schema.Struct({
43505
- filingStatus: pipe(Schema.propertySignature(Schema.NullishOr(FilingStatusSchema)), Schema.fromKey("filing_status")),
43506
- annualW2Income: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Number)), Schema.fromKey("annual_w2_income")),
43507
- tipIncome: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Number)), Schema.fromKey("tip_income")),
43508
- overtimeIncome: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Number)), Schema.fromKey("overtime_income")),
43509
- withholding: Schema.NullishOr(WithholdingSchema)
43510
- });
43511
- var StateConfigurationSchema = Schema.Struct({
43512
- taxState: pipe(Schema.propertySignature(Schema.NullishOr(USStateCodeSchema)), Schema.fromKey("tax_state")),
43513
- filingStatus: pipe(Schema.propertySignature(Schema.NullishOr(FilingStatusSchema)), Schema.fromKey("filing_status")),
43514
- withholding: Schema.NullishOr(WithholdingSchema)
43515
- });
43516
- var UsConfigurationSchema = Schema.Struct({
43517
- federal: Schema.NullishOr(FederalConfigurationSchema),
43518
- state: Schema.NullishOr(StateConfigurationSchema),
43519
- deductions: pipe(Schema.propertySignature(Schema.NullishOr(DeductionsSchema)), Schema.fromKey("deductions"))
43621
+ //#region src/components/ui/SummaryCard/ExpandSummaryCardButton.tsx
43622
+ function ExpandSummaryCardButton({ callback, ariaLabel }) {
43623
+ return /* @__PURE__ */ jsx(Button$1, {
43624
+ variant: "outlined",
43625
+ icon: true,
43626
+ onPress: callback,
43627
+ "aria-label": ariaLabel,
43628
+ children: /* @__PURE__ */ jsx(ArrowUpRight, {})
43629
+ });
43630
+ }
43631
+ //#endregion
43632
+ //#region src/components/ui/SummaryCard/useSummaryCardSlots.tsx
43633
+ var useSummaryCardSlots = ({ defaultTitle, legend, interactionProps, stringOverrides }) => {
43634
+ const { t } = useTranslation();
43635
+ const subtitle = useGlobalMonthSubtitle();
43636
+ const { onClickExpand } = interactionProps !== null && interactionProps !== void 0 ? interactionProps : {};
43637
+ return useMemo(() => {
43638
+ var _stringOverrides$titl;
43639
+ const primaryAction = onClickExpand ? /* @__PURE__ */ jsx(ExpandSummaryCardButton, {
43640
+ callback: onClickExpand,
43641
+ ariaLabel: t("common:label.view_label", "View")
43642
+ }) : void 0;
43643
+ return {
43644
+ title: (_stringOverrides$titl = stringOverrides === null || stringOverrides === void 0 ? void 0 : stringOverrides.title) !== null && _stringOverrides$titl !== void 0 ? _stringOverrides$titl : defaultTitle,
43645
+ subtitle,
43646
+ legend,
43647
+ primaryAction
43648
+ };
43649
+ }, [
43650
+ stringOverrides === null || stringOverrides === void 0 ? void 0 : stringOverrides.title,
43651
+ defaultTitle,
43652
+ subtitle,
43653
+ legend,
43654
+ onClickExpand,
43655
+ t
43656
+ ]);
43657
+ };
43658
+ //#endregion
43659
+ //#region src/components/ExpensesSummaryCard/ExpensesSummaryCard.tsx
43660
+ var ExpensesSummaryCard = ({ stylingProps, interactionProps, stringOverrides, className }) => {
43661
+ const { t } = useTranslation();
43662
+ const { chartColorsList } = stylingProps !== null && stylingProps !== void 0 ? stylingProps : {};
43663
+ const slots = useSummaryCardSlots({
43664
+ defaultTitle: t("common:label.expenses", "Expenses"),
43665
+ interactionProps,
43666
+ stringOverrides
43667
+ });
43668
+ const resolvedStringOverrides = useMemo(() => {
43669
+ var _stringOverrides$titl;
43670
+ return { detailedChartStringOverrides: { expenseChartHeader: (_stringOverrides$titl = stringOverrides === null || stringOverrides === void 0 ? void 0 : stringOverrides.title) !== null && _stringOverrides$titl !== void 0 ? _stringOverrides$titl : t("common:label.expenses", "Expenses") } };
43671
+ }, [stringOverrides === null || stringOverrides === void 0 ? void 0 : stringOverrides.title, t]);
43672
+ return /* @__PURE__ */ jsx(SummaryCard, {
43673
+ className: classNames("Layer__ExpensesSummaryCard", className),
43674
+ slots,
43675
+ children: /* @__PURE__ */ jsx(ProfitAndLossDetailedCharts, {
43676
+ scope: "expenses",
43677
+ hideClose: true,
43678
+ hideHeader: true,
43679
+ chartColorsList,
43680
+ stringOverrides: resolvedStringOverrides,
43681
+ slotProps: { detailedTable: { showTypeColumn: false } }
43682
+ })
43683
+ });
43684
+ };
43685
+ //#endregion
43686
+ //#region src/components/MileageTrackingSummary/MileageTrackingSummary.tsx
43687
+ var MileageTrackingSummary = ({ header: headerOverride } = {}) => {
43688
+ const { t } = useTranslation();
43689
+ const { formatDate } = useIntlFormatter();
43690
+ const { data, selectedYear, selectedYearData, chartData, isLoading, isError } = useMileageTrackingYearlySummary();
43691
+ const { isDesktop, isMobile } = useSizeClass();
43692
+ const inYearLabel = t("mileageTracking:label.in_year", "In {{year}}", { year: formatDate(new Date(selectedYear, 0, 1), DateFormat.Year) });
43693
+ const title = headerOverride !== null && headerOverride !== void 0 ? headerOverride : t("mileageTracking:label.mileage_tracking", "Mileage Tracking");
43694
+ const statsProps = isDesktop ? { direction: "column" } : isMobile ? { direction: "column" } : { direction: "row" };
43695
+ return /* @__PURE__ */ jsxs(Container, {
43696
+ name: "mileage-tracking-summary",
43697
+ children: [/* @__PURE__ */ jsx(VStack, {
43698
+ className: "Layer__MileageTrackingSummary__Header",
43699
+ gap: "md",
43700
+ children: /* @__PURE__ */ jsx(Heading$2, {
43701
+ size: isDesktop ? "md" : "sm",
43702
+ children: title
43703
+ })
43704
+ }), /* @__PURE__ */ jsx(ConditionalBlock, {
43705
+ data,
43706
+ isLoading,
43707
+ isError,
43708
+ Loading: /* @__PURE__ */ jsx(HStack, {
43709
+ className: "Layer__MileageTrackingSummary__Content",
43710
+ gap: "lg",
43711
+ justify: "center",
43712
+ align: "center",
43713
+ children: /* @__PURE__ */ jsx(Loader, {})
43714
+ }),
43715
+ Error: /* @__PURE__ */ jsx(DataState, {
43716
+ status: DataStateStatus.failed,
43717
+ title: t("mileageTracking:error.load_mileage_summary_data", "Failed to load mileage summary data"),
43718
+ spacing: true
43719
+ }),
43720
+ children: () => {
43721
+ var _selectedYearData$est, _selectedYearData$mil, _selectedYearData$tri;
43722
+ return /* @__PURE__ */ jsxs(Stack, {
43723
+ className: "Layer__MileageTrackingSummary__Content",
43724
+ direction: isDesktop ? "row" : "column",
43725
+ gap: "lg",
43726
+ children: [/* @__PURE__ */ jsxs(Stack, _objectSpread2(_objectSpread2({}, statsProps), {}, {
43727
+ className: "Layer__MileageTrackingSummary__Cards",
43728
+ gap: "md",
43729
+ children: [
43730
+ /* @__PURE__ */ jsx("div", {
43731
+ className: "Layer__MileageTrackingSummary__StatCardSlot",
43732
+ children: /* @__PURE__ */ jsx(MileageTrackingStatsCard, {
43733
+ title: t("mileageTracking:label.total_deduction", "Total Deduction"),
43734
+ amount: (_selectedYearData$est = selectedYearData === null || selectedYearData === void 0 ? void 0 : selectedYearData.estimatedDeduction) !== null && _selectedYearData$est !== void 0 ? _selectedYearData$est : 0,
43735
+ formatAsMoney: true,
43736
+ description: inYearLabel
43737
+ })
43738
+ }),
43739
+ /* @__PURE__ */ jsx("div", {
43740
+ className: "Layer__MileageTrackingSummary__StatCardSlot",
43741
+ children: /* @__PURE__ */ jsx(MileageTrackingStatsCard, {
43742
+ title: t("mileageTracking:label.total_miles", "Total Miles"),
43743
+ amount: (_selectedYearData$mil = selectedYearData === null || selectedYearData === void 0 ? void 0 : selectedYearData.miles) !== null && _selectedYearData$mil !== void 0 ? _selectedYearData$mil : 0,
43744
+ description: inYearLabel
43745
+ })
43746
+ }),
43747
+ /* @__PURE__ */ jsx("div", {
43748
+ className: "Layer__MileageTrackingSummary__StatCardSlot",
43749
+ children: /* @__PURE__ */ jsx(MileageTrackingStatsCard, {
43750
+ title: t("trips:label.trips", "Trips"),
43751
+ amount: (_selectedYearData$tri = selectedYearData === null || selectedYearData === void 0 ? void 0 : selectedYearData.trips) !== null && _selectedYearData$tri !== void 0 ? _selectedYearData$tri : 0,
43752
+ description: inYearLabel
43753
+ })
43754
+ })
43755
+ ]
43756
+ })), /* @__PURE__ */ jsx(VStack, {
43757
+ className: "Layer__MileageTrackingSummary__Chart",
43758
+ fluid: true,
43759
+ justify: "end",
43760
+ children: /* @__PURE__ */ jsx(MileageDeductionChart, {
43761
+ data: chartData,
43762
+ selectedYear,
43763
+ chartHeight: isDesktop ? 250 : 200
43764
+ })
43765
+ })]
43766
+ });
43767
+ }
43768
+ })]
43769
+ });
43770
+ };
43771
+ //#endregion
43772
+ //#region src/components/ProfitAndLossSummaryCard/PnlLegend.tsx
43773
+ var Swatch$1 = ({ className }) => /* @__PURE__ */ jsx("span", {
43774
+ className: `Layer__PnlLegend__Swatch ${className}`,
43775
+ "aria-hidden": true
43520
43776
  });
43521
- var TaxProfileSchema = Schema.Struct({
43522
- taxCountryCode: pipe(Schema.propertySignature(Schema.NullishOr(Schema.String)), Schema.fromKey("tax_country_code")),
43523
- usConfiguration: pipe(Schema.propertySignature(Schema.NullishOr(UsConfigurationSchema)), Schema.fromKey("us_configuration")),
43524
- userHasSavedTaxProfile: pipe(Schema.propertySignature(Schema.Boolean), Schema.fromKey("user_has_saved_tax_profile"))
43777
+ var PnlLegend = ({ direction = "row" }) => {
43778
+ const { t } = useTranslation();
43779
+ return /* @__PURE__ */ jsxs(Stack, {
43780
+ className: "Layer__PnlLegend",
43781
+ direction,
43782
+ align: "start",
43783
+ gap: direction === "row" ? "md" : "2xs",
43784
+ pis: direction === "column" ? "md" : void 0,
43785
+ pbe: direction === "column" ? "md" : void 0,
43786
+ children: [
43787
+ /* @__PURE__ */ jsxs(HStack, {
43788
+ gap: "2xs",
43789
+ align: "center",
43790
+ children: [/* @__PURE__ */ jsx(Swatch$1, { className: "Layer__PnlLegend__Swatch--income" }), /* @__PURE__ */ jsx(Span, {
43791
+ size: "sm",
43792
+ children: t("common:label.revenue", "Revenue")
43793
+ })]
43794
+ }),
43795
+ /* @__PURE__ */ jsxs(HStack, {
43796
+ gap: "2xs",
43797
+ align: "center",
43798
+ children: [/* @__PURE__ */ jsx(Swatch$1, { className: "Layer__PnlLegend__Swatch--expenses" }), /* @__PURE__ */ jsx(Span, {
43799
+ size: "sm",
43800
+ children: t("common:label.expenses", "Expenses")
43801
+ })]
43802
+ }),
43803
+ /* @__PURE__ */ jsxs(HStack, {
43804
+ gap: "2xs",
43805
+ align: "center",
43806
+ children: [/* @__PURE__ */ jsx(Swatch$1, { className: "Layer__PnlLegend__Swatch--uncategorized" }), /* @__PURE__ */ jsx(Span, {
43807
+ size: "sm",
43808
+ children: t("common:label.uncategorized", "Uncategorized")
43809
+ })]
43810
+ })
43811
+ ]
43812
+ });
43813
+ };
43814
+ //#endregion
43815
+ //#region src/components/ProfitAndLossSummaryCard/ProfitAndLossSummaryCard.tsx
43816
+ var ProfitAndLossSummaryCard = ({ interactionProps, stringOverrides, className }) => {
43817
+ const { t } = useTranslation();
43818
+ const { isDesktop } = useSizeClass();
43819
+ const { tagFilter } = useContext(ProfitAndLossContext);
43820
+ const legend = useMemo(() => /* @__PURE__ */ jsx(PnlLegend, { direction: isDesktop ? "row" : "column" }), [isDesktop]);
43821
+ const slots = useSummaryCardSlots({
43822
+ defaultTitle: t("common:label.profit_loss", "Profit & Loss"),
43823
+ legend: isDesktop ? legend : void 0,
43824
+ interactionProps,
43825
+ stringOverrides
43826
+ });
43827
+ return /* @__PURE__ */ jsx(SummaryCard, {
43828
+ className: classNames("Layer__ProfitAndLossSummaryCard", className),
43829
+ slots,
43830
+ children: /* @__PURE__ */ jsxs(VStack, {
43831
+ gap: "sm",
43832
+ children: [/* @__PURE__ */ jsx(ProfitAndLossChart, {
43833
+ tagFilter,
43834
+ hideLegend: true
43835
+ }), !isDesktop && legend]
43836
+ })
43837
+ });
43838
+ };
43839
+ //#endregion
43840
+ //#region src/components/ui/Swatch/Swatch.tsx
43841
+ var Swatch = ({ color, opacity, pattern }) => {
43842
+ const patternId = useId();
43843
+ const circleStyle = {
43844
+ fill: pattern === "stripes" ? `url(#${patternId})` : color,
43845
+ fillOpacity: opacity
43846
+ };
43847
+ return /* @__PURE__ */ jsxs("svg", {
43848
+ "aria-hidden": true,
43849
+ className: "Layer__Swatch",
43850
+ viewBox: "0 0 10 10",
43851
+ children: [pattern === "stripes" && /* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", {
43852
+ id: patternId,
43853
+ width: "4",
43854
+ height: "4",
43855
+ patternUnits: "userSpaceOnUse",
43856
+ patternTransform: "rotate(45)",
43857
+ children: /* @__PURE__ */ jsx("rect", {
43858
+ width: "2",
43859
+ height: "4",
43860
+ style: { fill: color }
43861
+ })
43862
+ }) }), /* @__PURE__ */ jsx("circle", {
43863
+ cx: "5",
43864
+ cy: "5",
43865
+ r: "5",
43866
+ style: circleStyle
43867
+ })]
43868
+ });
43869
+ };
43870
+ //#endregion
43871
+ //#region src/components/ui/Legend/Legend.tsx
43872
+ var LegendLayout = /* @__PURE__ */ function(LegendLayout) {
43873
+ LegendLayout["Table"] = "Table";
43874
+ LegendLayout["Aligned"] = "Aligned";
43875
+ return LegendLayout;
43876
+ }({});
43877
+ var Legend$1 = ({ items, total, colorSelector, formatValue, layout = LegendLayout.Table }) => {
43878
+ const { formatPercent } = useIntlFormatter();
43879
+ if (layout === LegendLayout.Aligned) return /* @__PURE__ */ jsx("div", {
43880
+ className: "Layer__UI__Legend Layer__UI__Legend--aligned",
43881
+ children: items.map((item) => {
43882
+ const percentage = total > 0 ? item.value / total : 0;
43883
+ return /* @__PURE__ */ jsxs("div", {
43884
+ className: "Layer__UI__Legend__AlignedItem",
43885
+ style: {
43886
+ display: "flex",
43887
+ flexDirection: "column",
43888
+ flexGrow: total > 0 ? item.value / total : 1,
43889
+ flexBasis: 0
43890
+ },
43891
+ children: [
43892
+ /* @__PURE__ */ jsx(Span, {
43893
+ size: "sm",
43894
+ variant: "subtle",
43895
+ ellipsis: true,
43896
+ withTooltip: true,
43897
+ children: item.displayName
43898
+ }),
43899
+ /* @__PURE__ */ jsx(Span, {
43900
+ size: "lg",
43901
+ className: "Layer__UI__Legend__AlignedValue",
43902
+ weight: "bold",
43903
+ children: formatValue(item.value)
43904
+ }),
43905
+ /* @__PURE__ */ jsx(Span, {
43906
+ size: "sm",
43907
+ variant: "subtle",
43908
+ children: formatPercent(percentage, { maximumFractionDigits: 0 })
43909
+ })
43910
+ ]
43911
+ }, item.name);
43912
+ })
43913
+ });
43914
+ return /* @__PURE__ */ jsx(Stack, {
43915
+ direction: "row",
43916
+ className: "Layer__UI__Legend Layer__UI__Legend--table",
43917
+ gap: "lg",
43918
+ align: "start",
43919
+ children: items.map((item) => {
43920
+ var _colorSelector;
43921
+ const { color, opacity } = (_colorSelector = colorSelector(item)) !== null && _colorSelector !== void 0 ? _colorSelector : DEFAULT_TYPE_COLOR_MAPPING;
43922
+ const percentage = total > 0 ? item.value / total : 0;
43923
+ return /* @__PURE__ */ jsxs(VStack, {
43924
+ className: "Layer__UI__Legend__Item",
43925
+ gap: "2xs",
43926
+ children: [/* @__PURE__ */ jsxs(HStack, {
43927
+ className: "Layer__UI__Legend__Label",
43928
+ gap: "2xs",
43929
+ align: "center",
43930
+ children: [/* @__PURE__ */ jsx(Swatch, {
43931
+ color,
43932
+ opacity
43933
+ }), /* @__PURE__ */ jsx(Span, {
43934
+ size: "md",
43935
+ ellipsis: true,
43936
+ withTooltip: true,
43937
+ children: item.displayName
43938
+ })]
43939
+ }), /* @__PURE__ */ jsxs(HStack, {
43940
+ className: "Layer__UI__Legend__Meta",
43941
+ gap: "2xs",
43942
+ align: "baseline",
43943
+ children: [/* @__PURE__ */ jsx(Span, {
43944
+ className: "Layer__UI__Legend__Value",
43945
+ size: "sm",
43946
+ children: formatValue(item.value)
43947
+ }), /* @__PURE__ */ jsx(Span, {
43948
+ className: "Layer__UI__Legend__Percentage",
43949
+ size: "sm",
43950
+ variant: "subtle",
43951
+ children: formatPercent(percentage, { maximumFractionDigits: 0 })
43952
+ })]
43953
+ })]
43954
+ }, item.name);
43955
+ })
43956
+ });
43957
+ };
43958
+ //#endregion
43959
+ //#region src/components/ui/HorizontalBarChart/HorizontalBarChart.tsx
43960
+ var CHART_HEIGHT$1 = 24;
43961
+ var CHART_MARGIN$1 = {
43962
+ top: 0,
43963
+ right: 0,
43964
+ bottom: 0,
43965
+ left: 0
43966
+ };
43967
+ var CHART_BORDER_RADIUS$1 = 8;
43968
+ var Y_AXIS_CATEGORY_KEY = "__layer_hbar_category";
43969
+ var HorizontalBarChart = ({ data, stylingProps, formatValue, showLegend = true, labelMode = LegendLayout.Table, slots }) => {
43970
+ const { data: items, total } = data;
43971
+ const positiveItems = useMemo(() => items.filter((item) => item.value > 0), [items]);
43972
+ const positiveTotal = positiveItems.reduce((sum, item) => sum + item.value, 0);
43973
+ const legendDenominator = positiveTotal > 0 ? positiveTotal : total;
43974
+ const chartData = useMemo(() => {
43975
+ return [positiveItems.reduce((acc, item) => {
43976
+ acc[item.name] = item.value;
43977
+ return acc;
43978
+ }, { [Y_AXIS_CATEGORY_KEY]: "series" })];
43979
+ }, [positiveItems]);
43980
+ const chartKey = positiveItems.map((item) => item.name).join("|");
43981
+ const legendNode = (slots === null || slots === void 0 ? void 0 : slots.Legend) !== void 0 ? slots.Legend : /* @__PURE__ */ jsx(Legend$1, {
43982
+ items: positiveItems,
43983
+ total: legendDenominator,
43984
+ colorSelector: stylingProps.colorSelector,
43985
+ formatValue,
43986
+ layout: labelMode
43987
+ });
43988
+ return /* @__PURE__ */ jsxs(VStack, {
43989
+ className: "Layer__HorizontalBarChart Layer__UI__Chart--focusReset",
43990
+ gap: "md",
43991
+ justify: "center",
43992
+ children: [/* @__PURE__ */ jsx("div", {
43993
+ className: "Layer__HorizontalBarChart__Bar",
43994
+ children: /* @__PURE__ */ jsx(ResponsiveContainer, {
43995
+ width: "100%",
43996
+ height: CHART_HEIGHT$1,
43997
+ children: /* @__PURE__ */ jsxs(BarChart, {
43998
+ data: chartData,
43999
+ layout: "vertical",
44000
+ margin: CHART_MARGIN$1,
44001
+ barCategoryGap: "0%",
44002
+ barGap: 0,
44003
+ barSize: CHART_HEIGHT$1,
44004
+ children: [
44005
+ /* @__PURE__ */ jsx(XAxis, {
44006
+ type: "number",
44007
+ hide: true,
44008
+ domain: [0, positiveTotal > 0 ? positiveTotal : 1],
44009
+ allowDataOverflow: true
44010
+ }),
44011
+ /* @__PURE__ */ jsx(YAxis, {
44012
+ type: "category",
44013
+ dataKey: Y_AXIS_CATEGORY_KEY,
44014
+ hide: true,
44015
+ width: 0
44016
+ }),
44017
+ positiveItems.map((item, index) => {
44018
+ var _stylingProps$colorSe;
44019
+ const isFirstSegment = index === 0;
44020
+ const isLastSegment = index === positiveItems.length - 1;
44021
+ const { color, opacity } = (_stylingProps$colorSe = stylingProps.colorSelector(item)) !== null && _stylingProps$colorSe !== void 0 ? _stylingProps$colorSe : DEFAULT_TYPE_COLOR_MAPPING;
44022
+ return /* @__PURE__ */ jsx(Bar, {
44023
+ dataKey: item.name,
44024
+ barSize: CHART_HEIGHT$1,
44025
+ fill: color,
44026
+ fillOpacity: opacity,
44027
+ stackId: "horizontal-bar-chart",
44028
+ isAnimationActive: false,
44029
+ radius: [
44030
+ isFirstSegment ? CHART_BORDER_RADIUS$1 : 0,
44031
+ isLastSegment ? CHART_BORDER_RADIUS$1 : 0,
44032
+ isLastSegment ? CHART_BORDER_RADIUS$1 : 0,
44033
+ isFirstSegment ? CHART_BORDER_RADIUS$1 : 0
44034
+ ]
44035
+ }, item.name);
44036
+ })
44037
+ ]
44038
+ })
44039
+ }, chartKey)
44040
+ }), showLegend && legendNode]
44041
+ });
44042
+ };
44043
+ //#endregion
44044
+ //#region src/components/TaxEstimatesSummaryCard/constants.ts
44045
+ var resolveCategoryColor = ({ key }) => {
44046
+ var _federal$state$key;
44047
+ return (_federal$state$key = {
44048
+ federal: DEFAULT_CHART_COLORS[0],
44049
+ state: DEFAULT_CHART_COLORS[1]
44050
+ }[key]) !== null && _federal$state$key !== void 0 ? _federal$state$key : DEFAULT_CHART_COLORS[0];
44051
+ };
44052
+ //#endregion
44053
+ //#region src/schemas/taxEstimates/summary.ts
44054
+ var TaxSummarySectionTypeSchema = Schema.Literal("federal", "state");
44055
+ var TaxSummarySectionSchema = Schema.Struct({
44056
+ type: TaxSummarySectionTypeSchema,
44057
+ key: Schema.NullishOr(Schema.String),
44058
+ label: Schema.String,
44059
+ total: Schema.Number,
44060
+ taxesPaid: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("taxes_paid")),
44061
+ taxesOwed: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("taxes_owed"))
43525
44062
  });
43526
- var TaxProfileResponseSchema = Schema.Struct({ data: TaxProfileSchema });
43527
- var TaxProfileRequestSchema = Schema.Struct({
43528
- taxCountryCode: pipe(Schema.propertySignature(Schema.NullishOr(Schema.String)), Schema.fromKey("tax_country_code")),
43529
- usConfiguration: pipe(Schema.propertySignature(Schema.NullishOr(UsConfigurationSchema)), Schema.fromKey("us_configuration"))
44063
+ var TaxSummarySchema = Schema.Struct({
44064
+ year: Schema.Number,
44065
+ projectedTaxesOwed: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("projected_taxes_owed")),
44066
+ taxesDueAt: pipe(Schema.propertySignature(Schema.Date), Schema.fromKey("taxes_due_at")),
44067
+ uncategorizedTaxPayments: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("uncategorized_tax_payments")),
44068
+ sections: Schema.Array(TaxSummarySectionSchema)
43530
44069
  });
44070
+ var TaxSummaryResponseSchema = Schema.Struct({ data: TaxSummarySchema });
43531
44071
  //#endregion
43532
- //#region src/hooks/api/businesses/[business-id]/tax-estimates/profile/useTaxProfile.ts
43533
- var TAX_PROFILE_TAG_KEY = "#tax-profile";
43534
- var getTaxProfile = get(({ businessId }) => {
43535
- return `/v1/businesses/${businessId}/tax-estimates/profile`;
44072
+ //#region src/hooks/api/businesses/[business-id]/tax-estimates/summary/useTaxSummary.ts
44073
+ var TAX_SUMMARY_TAG_KEY = "#tax-summary";
44074
+ var getTaxSummary = get(({ businessId, year, reportingBasis, fullYearProjection }) => {
44075
+ return `/v1/businesses/${businessId}/tax-estimates/summary?${toDefinedSearchParameters({
44076
+ year,
44077
+ reporting_basis: reportingBasis,
44078
+ full_year_projection: fullYearProjection
44079
+ })}`;
43536
44080
  });
43537
- function buildKey$18({ access_token: accessToken, apiUrl, businessId }) {
44081
+ function buildKey$17({ access_token: accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection, enabled = true }) {
44082
+ if (!enabled) return;
43538
44083
  if (accessToken && apiUrl) return {
43539
44084
  accessToken,
43540
44085
  apiUrl,
43541
44086
  businessId,
43542
- tags: [TAX_PROFILE_TAG_KEY]
44087
+ year,
44088
+ reportingBasis,
44089
+ fullYearProjection,
44090
+ tags: [TAX_SUMMARY_TAG_KEY]
43543
44091
  };
43544
44092
  }
43545
- function useTaxProfile() {
44093
+ function useTaxSummary({ year, reportingBasis, fullYearProjection, enabled = true }) {
43546
44094
  const withLocale = useLocalizedKey();
43547
44095
  const { data: auth } = useAuth();
43548
44096
  const { businessId } = useLayerContext();
43549
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$18(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), function() {
43550
- var _ref = _asyncToGenerator(function* ({ accessToken, apiUrl, businessId }) {
43551
- return getTaxProfile(apiUrl, accessToken, { params: { businessId } })().then(Schema.decodeUnknownPromise(TaxProfileResponseSchema)).then(({ data }) => data);
44097
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$17(_objectSpread2(_objectSpread2({}, auth), {}, {
44098
+ businessId,
44099
+ year,
44100
+ reportingBasis,
44101
+ fullYearProjection,
44102
+ enabled
44103
+ }))), function() {
44104
+ var _ref = _asyncToGenerator(function* ({ accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection }) {
44105
+ return getTaxSummary(apiUrl, accessToken, { params: {
44106
+ businessId,
44107
+ year,
44108
+ reportingBasis,
44109
+ fullYearProjection
44110
+ } })().then(Schema.decodeUnknownPromise(TaxSummaryResponseSchema)).then(({ data }) => data);
43552
44111
  });
43553
44112
  return function(_x) {
43554
44113
  return _ref.apply(this, arguments);
43555
44114
  };
43556
44115
  }()));
43557
44116
  }
43558
- function useTaxProfileGlobalCacheActions() {
43559
- const { patchCache } = useGlobalCacheActions();
43560
- return { patchTaxProfile: useCallback((updatedProfile) => patchCache(({ tags }) => tags.includes(TAX_PROFILE_TAG_KEY), () => updatedProfile), [patchCache]) };
43561
- }
43562
- //#endregion
43563
- //#region src/hooks/features/taxEstimates/useTaxEstimatesOnboardingStatus.ts
43564
- var OnboardingStatus = /* @__PURE__ */ function(OnboardingStatus) {
43565
- OnboardingStatus["Loading"] = "Loading";
43566
- OnboardingStatus["Error"] = "Error";
43567
- OnboardingStatus["NotOnboarded"] = "NotOnboarded";
43568
- OnboardingStatus["Onboarded"] = "Onboarded";
43569
- OnboardingStatus["FeatureDisabled"] = "FeatureDisabled";
43570
- return OnboardingStatus;
43571
- }({});
43572
- function getTaxEstimatesOnboardingStatus(input) {
43573
- var _input$accountingConf, _input$taxProfile;
43574
- const isFeatureEnabled = !!((_input$accountingConf = input.accountingConfiguration) === null || _input$accountingConf === void 0 ? void 0 : _input$accountingConf.enableTaxEstimates);
43575
- const hasSavedTaxProfile = (_input$taxProfile = input.taxProfile) === null || _input$taxProfile === void 0 ? void 0 : _input$taxProfile.userHasSavedTaxProfile;
43576
- if (input.isError) return OnboardingStatus.Error;
43577
- if (input.isLoading || !input.accountingConfiguration) return OnboardingStatus.Loading;
43578
- if (!isFeatureEnabled) return OnboardingStatus.FeatureDisabled;
43579
- if (hasSavedTaxProfile === false) return OnboardingStatus.NotOnboarded;
43580
- if (hasSavedTaxProfile === true) return OnboardingStatus.Onboarded;
43581
- return OnboardingStatus.Loading;
43582
- }
43583
- function useTaxEstimatesOnboardingStatus() {
43584
- const { accountingConfiguration } = useLayerContext();
43585
- const { data: taxProfile, isLoading, isError } = useTaxProfile();
43586
- return getTaxEstimatesOnboardingStatus({
43587
- isLoading,
43588
- isError,
43589
- accountingConfiguration,
43590
- taxProfile
43591
- });
43592
- }
43593
44117
  //#endregion
43594
44118
  //#region src/providers/TaxEstimatesRouteStore/TaxEstimatesRouteStoreProvider.tsx
43595
44119
  var TaxEstimatesRoute = /* @__PURE__ */ function(TaxEstimatesRoute) {
43596
- TaxEstimatesRoute["Overview"] = "overview";
43597
44120
  TaxEstimatesRoute["Estimates"] = "estimates";
43598
44121
  TaxEstimatesRoute["Payments"] = "payments";
43599
44122
  TaxEstimatesRoute["Profile"] = "profile";
43600
44123
  return TaxEstimatesRoute;
43601
44124
  }({});
43602
- var DEFAULT_ROUTE = TaxEstimatesRoute.Overview;
44125
+ var DEFAULT_ROUTE = TaxEstimatesRoute.Estimates;
43603
44126
  var TaxEstimatesRouteStoreContext = createContext(createStore((set) => ({
43604
44127
  routeState: { route: DEFAULT_ROUTE },
43605
44128
  navigate: {
@@ -43672,6 +44195,463 @@ function useFullYearProjection() {
43672
44195
  }), [fullYearProjection, setFullYearProjection]);
43673
44196
  }
43674
44197
  //#endregion
44198
+ //#region src/components/TaxEstimatesSummaryCard/useTaxEstimatesSummaryCard.ts
44199
+ var prepareTaxSummaryData = (taxSummaryData, shortenedDisplayName, isMobile) => {
44200
+ return taxSummaryData.sections.map((section) => ({
44201
+ value: Math.max(section.taxesOwed, 0),
44202
+ name: section.type,
44203
+ displayName: isMobile ? shortenedDisplayName(section.type) : section.label
44204
+ }));
44205
+ };
44206
+ var useTaxEstimatesSummaryCard = () => {
44207
+ const { year } = useTaxEstimatesYear();
44208
+ const { fullYearProjection } = useFullYearProjection();
44209
+ const { t } = useTranslation();
44210
+ const { isDesktop, isMobile } = useSizeClass();
44211
+ const { data: taxSummaryData, isLoading, isError } = useTaxSummary({
44212
+ year,
44213
+ fullYearProjection,
44214
+ enabled: true
44215
+ });
44216
+ const shortenedDisplayName = useCallback((type) => {
44217
+ if (type === "federal") return t("taxEstimates:label.federal", "Federal");
44218
+ if (type === "state") return t("taxEstimates:label.state", "State");
44219
+ return type;
44220
+ }, [t]);
44221
+ return {
44222
+ detailData: useMemo(() => {
44223
+ if (!taxSummaryData) return void 0;
44224
+ const data = prepareTaxSummaryData(taxSummaryData, shortenedDisplayName, isMobile);
44225
+ return {
44226
+ data,
44227
+ total: data.reduce((sum, section) => sum + section.value, 0)
44228
+ };
44229
+ }, [
44230
+ taxSummaryData,
44231
+ isMobile,
44232
+ shortenedDisplayName
44233
+ ]),
44234
+ isLoading,
44235
+ isError,
44236
+ layout: isDesktop ? "taxOverview" : "summaryCard",
44237
+ title: t("taxEstimates:label.tax_summary", "Tax Summary")
44238
+ };
44239
+ };
44240
+ //#endregion
44241
+ //#region src/components/TaxEstimatesSummaryCard/TaxEstimatesSummaryCard.tsx
44242
+ var LoadingState$1 = ({ mode }) => {
44243
+ if (mode === TaxEstimatesSummaryCardMode.HorizontalBarChart) return /* @__PURE__ */ jsxs(VStack, {
44244
+ gap: "md",
44245
+ className: "Layer__TaxEstimatesSummaryCard__Content",
44246
+ pb: "md",
44247
+ pi: "lg",
44248
+ children: [
44249
+ /* @__PURE__ */ jsx(SkeletonLoader, {
44250
+ height: "24px",
44251
+ width: "40%"
44252
+ }),
44253
+ /* @__PURE__ */ jsx(SkeletonLoader, {
44254
+ height: "24px",
44255
+ width: "100%"
44256
+ }),
44257
+ /* @__PURE__ */ jsx(SkeletonLoader, {
44258
+ height: "16px",
44259
+ width: "100%"
44260
+ })
44261
+ ]
44262
+ });
44263
+ return /* @__PURE__ */ jsxs(VStack, {
44264
+ gap: "md",
44265
+ className: "Layer__TaxEstimatesSummaryCard__Content",
44266
+ pb: "md",
44267
+ pi: "lg",
44268
+ align: "center",
44269
+ children: [
44270
+ /* @__PURE__ */ jsx(CircleSkeletonLoader, {
44271
+ height: "128px",
44272
+ width: "128px"
44273
+ }),
44274
+ /* @__PURE__ */ jsx(SkeletonLoader, {
44275
+ height: "24px",
44276
+ width: "80%"
44277
+ }),
44278
+ /* @__PURE__ */ jsx(SkeletonLoader, {
44279
+ height: "24px",
44280
+ width: "80%"
44281
+ }),
44282
+ /* @__PURE__ */ jsx(SkeletonLoader, {
44283
+ height: "24px",
44284
+ width: "80%"
44285
+ })
44286
+ ]
44287
+ });
44288
+ };
44289
+ var ErrorState$2 = () => {
44290
+ const { t } = useTranslation();
44291
+ return /* @__PURE__ */ jsx(VStack, {
44292
+ gap: "md",
44293
+ className: "Layer__TaxEstimatesSummaryCard__Content",
44294
+ pb: "md",
44295
+ pi: "lg",
44296
+ align: "center",
44297
+ children: /* @__PURE__ */ jsx(Span, {
44298
+ size: "lg",
44299
+ children: t("taxEstimates:error.load_tax_estimates_summary", "We couldn't load your tax summary")
44300
+ })
44301
+ });
44302
+ };
44303
+ function allTaxSectionsAreEmpty(summary) {
44304
+ return summary.data.every((section) => section.value === 0);
44305
+ }
44306
+ function TaxEstimatesSummaryCardEmpty() {
44307
+ const { t } = useTranslation();
44308
+ return /* @__PURE__ */ jsx(DataState, {
44309
+ status: DataStateStatus.info,
44310
+ title: t("taxEstimates:empty.no_tax_estimates_summary", "Get started with your tax estimates"),
44311
+ description: t("taxEstimates:empty.no_tax_estimates_summary_description", "Start by importing and categorizing your bank transactions"),
44312
+ spacing: true
44313
+ });
44314
+ }
44315
+ var TaxEstimatesSummaryCardMode = /* @__PURE__ */ function(TaxEstimatesSummaryCardMode) {
44316
+ TaxEstimatesSummaryCardMode["PieChart"] = "PieChart";
44317
+ TaxEstimatesSummaryCardMode["HorizontalBarChart"] = "HorizontalBarChart";
44318
+ return TaxEstimatesSummaryCardMode;
44319
+ }({});
44320
+ var Content = ({ data, mode, commonProps, layout }) => {
44321
+ if (mode === TaxEstimatesSummaryCardMode.HorizontalBarChart) return /* @__PURE__ */ jsx(HorizontalBarChartContent, {
44322
+ data,
44323
+ commonProps
44324
+ });
44325
+ return /* @__PURE__ */ jsx(PieChartContent, {
44326
+ data,
44327
+ commonProps,
44328
+ layout
44329
+ });
44330
+ };
44331
+ var HorizontalBarChartContent = ({ data, commonProps }) => {
44332
+ const { t } = useTranslation();
44333
+ const { formatCurrencyFromCents } = useIntlFormatter();
44334
+ const { isDesktop } = useSizeClass();
44335
+ return /* @__PURE__ */ jsxs(VStack, {
44336
+ className: "Layer__TaxEstimatesSummaryCard__Content Layer__TaxEstimatesSummaryCard__Content--horizontal",
44337
+ gap: "md",
44338
+ pi: "lg",
44339
+ pbe: "lg",
44340
+ children: [/* @__PURE__ */ jsxs(HStack, {
44341
+ className: "Layer__TaxEstimatesSummaryCard__TotalRow",
44342
+ justify: "space-between",
44343
+ align: "baseline",
44344
+ gap: "md",
44345
+ children: [/* @__PURE__ */ jsx(Span, {
44346
+ size: "md",
44347
+ variant: "subtle",
44348
+ children: t("common:label.total", "Total")
44349
+ }), /* @__PURE__ */ jsx(Span, {
44350
+ size: "xl",
44351
+ weight: "bold",
44352
+ numeric: "tabular-nums",
44353
+ className: "Layer__TaxEstimatesSummaryCard__TotalValue",
44354
+ children: formatCurrencyFromCents(data.total)
44355
+ })]
44356
+ }), /* @__PURE__ */ jsx(HorizontalBarChart, {
44357
+ data,
44358
+ stylingProps: commonProps.stylingProps,
44359
+ formatValue: formatCurrencyFromCents,
44360
+ labelMode: isDesktop ? LegendLayout.Aligned : LegendLayout.Table
44361
+ })]
44362
+ });
44363
+ };
44364
+ var PieChartContent = ({ data, commonProps, layout }) => {
44365
+ const { isMobile } = useSizeClass();
44366
+ return isMobile || layout === "summaryCard" ? /* @__PURE__ */ jsxs(VStack, {
44367
+ className: "Layer__TaxEstimatesSummaryCard__Content Layer__TaxEstimatesSummaryCard__Content--mobile",
44368
+ gap: "lg",
44369
+ children: [/* @__PURE__ */ jsx(DetailedChart, _objectSpread2({ data }, commonProps)), /* @__PURE__ */ jsx(DetailedTableWithData, _objectSpread2(_objectSpread2({ data }, commonProps), NO_SORT_PROPS))]
44370
+ }) : /* @__PURE__ */ jsxs(HStack, {
44371
+ className: "Layer__TaxEstimatesSummaryCard__Content",
44372
+ align: "center",
44373
+ gap: "lg",
44374
+ children: [/* @__PURE__ */ jsx(DetailedChart, _objectSpread2({ data }, commonProps)), /* @__PURE__ */ jsx(DetailedTableWithData, _objectSpread2(_objectSpread2({ data }, commonProps), NO_SORT_PROPS))]
44375
+ });
44376
+ };
44377
+ var TaxEstimatesSummaryCard = ({ mode = TaxEstimatesSummaryCardMode.PieChart, title: titleOverride, withHeaderSeparator = false } = {}) => {
44378
+ const { detailData, layout, title: defaultTitle, isLoading, isError } = useTaxEstimatesSummaryCard();
44379
+ const { isDesktop } = useSizeClass();
44380
+ const isSummaryCardLayout = layout === "summaryCard";
44381
+ const title = titleOverride !== null && titleOverride !== void 0 ? titleOverride : defaultTitle;
44382
+ const commonProps = useMemo(() => {
44383
+ var _detailData$data;
44384
+ const colorByKey = detailData === null || detailData === void 0 || (_detailData$data = detailData.data) === null || _detailData$data === void 0 ? void 0 : _detailData$data.reduce((acc, item) => {
44385
+ acc[item.name] = resolveCategoryColor({ key: item.name });
44386
+ return acc;
44387
+ }, {});
44388
+ return {
44389
+ interactionProps: NO_OP_INTERACTION_PROPS,
44390
+ stylingProps: { colorSelector: (item) => {
44391
+ var _colorByKey$item$name;
44392
+ return {
44393
+ color: (_colorByKey$item$name = colorByKey === null || colorByKey === void 0 ? void 0 : colorByKey[item.name]) !== null && _colorByKey$item$name !== void 0 ? _colorByKey$item$name : "var(--color-base-300)",
44394
+ opacity: 1
44395
+ };
44396
+ } }
44397
+ };
44398
+ }, [detailData === null || detailData === void 0 ? void 0 : detailData.data]);
44399
+ return /* @__PURE__ */ jsx(VStack, {
44400
+ className: "Layer__TaxEstimatesSummaryCard__Container",
44401
+ children: /* @__PURE__ */ jsx(Card, {
44402
+ className: classNames("Layer__TaxEstimatesSummaryCard", isSummaryCardLayout && "Layer__TaxEstimatesSummaryCard--summaryCard"),
44403
+ children: /* @__PURE__ */ jsxs(VStack, {
44404
+ gap: "md",
44405
+ className: "Layer__TaxEstimatesSummaryCard__Body",
44406
+ children: [/* @__PURE__ */ jsx(HStack, {
44407
+ className: classNames("Layer__TaxEstimatesSummaryCard__Header", (isSummaryCardLayout || withHeaderSeparator) && "Layer__SummaryCard__ContainerHeader"),
44408
+ justify: "space-between",
44409
+ align: isSummaryCardLayout ? "center" : "start",
44410
+ gap: "md",
44411
+ children: /* @__PURE__ */ jsx(Heading$2, {
44412
+ size: !isDesktop ? "sm" : "md",
44413
+ children: title
44414
+ })
44415
+ }), /* @__PURE__ */ jsx(ConditionalBlock, {
44416
+ data: detailData,
44417
+ isLoading,
44418
+ isError,
44419
+ Loading: /* @__PURE__ */ jsx(LoadingState$1, { mode }),
44420
+ Error: /* @__PURE__ */ jsx(ErrorState$2, {}),
44421
+ children: ({ data }) => allTaxSectionsAreEmpty(data) ? /* @__PURE__ */ jsx(TaxEstimatesSummaryCardEmpty, {}) : /* @__PURE__ */ jsx(Content, {
44422
+ data,
44423
+ mode,
44424
+ commonProps,
44425
+ layout
44426
+ })
44427
+ })]
44428
+ })
44429
+ })
44430
+ });
44431
+ };
44432
+ //#endregion
44433
+ //#region src/views/SolopreneurOverview/SolopreneurOverview.tsx
44434
+ var SolopreneurOverview = ({ showTitle = true, enableOnboarding = false, onboardingStepOverride = void 0, onTransactionsToReviewClick, middleBanner, chartColorsList, stringOverrides, tagFilter = void 0, slotProps }) => {
44435
+ var _slotProps$profitAndL, _stringOverrides$card, _stringOverrides$card2, _stringOverrides$card3, _stringOverrides$card4;
44436
+ const { t } = useTranslation();
44437
+ const { value: sizeClass } = useSizeClass();
44438
+ const profitAndLossSummariesVariants = slotProps === null || slotProps === void 0 || (_slotProps$profitAndL = slotProps.profitAndLoss) === null || _slotProps$profitAndL === void 0 || (_slotProps$profitAndL = _slotProps$profitAndL.summaries) === null || _slotProps$profitAndL === void 0 ? void 0 : _slotProps$profitAndL.variants;
44439
+ return /* @__PURE__ */ jsx(ProfitAndLoss, {
44440
+ asContainer: false,
44441
+ tagFilter: tagFilter ? {
44442
+ key: tagFilter.tagKey,
44443
+ values: tagFilter.tagValues
44444
+ } : void 0,
44445
+ children: /* @__PURE__ */ jsxs(View, {
44446
+ title: (stringOverrides === null || stringOverrides === void 0 ? void 0 : stringOverrides.title) || t("common:label.overview", "Overview"),
44447
+ showHeader: showTitle,
44448
+ header: /* @__PURE__ */ jsx(Header$2, { children: /* @__PURE__ */ jsx(HeaderRow, { children: /* @__PURE__ */ jsx(HeaderCol, { children: /* @__PURE__ */ jsx(GlobalMonthPicker, { truncateMonth: sizeClass === "mobile" }) }) }) }),
44449
+ children: [
44450
+ enableOnboarding && /* @__PURE__ */ jsx(Onboarding, {
44451
+ onTransactionsToReviewClick,
44452
+ onboardingStepOverride
44453
+ }),
44454
+ /* @__PURE__ */ jsx(ProfitAndLossSummaries, {
44455
+ stringOverrides: stringOverrides === null || stringOverrides === void 0 ? void 0 : stringOverrides.profitAndLossSummaries,
44456
+ chartColorsList,
44457
+ onTransactionsToReviewClick,
44458
+ variants: profitAndLossSummariesVariants
44459
+ }),
44460
+ middleBanner,
44461
+ /* @__PURE__ */ jsxs("div", {
44462
+ className: "Layer__SolopreneurOverview__Grid",
44463
+ children: [
44464
+ /* @__PURE__ */ jsx(ProfitAndLossSummaryCard, { stringOverrides: { title: stringOverrides === null || stringOverrides === void 0 || (_stringOverrides$card = stringOverrides.cards) === null || _stringOverrides$card === void 0 || (_stringOverrides$card = _stringOverrides$card.profitAndLoss) === null || _stringOverrides$card === void 0 ? void 0 : _stringOverrides$card.header } }),
44465
+ /* @__PURE__ */ jsx(ExpensesSummaryCard, {
44466
+ stylingProps: { chartColorsList },
44467
+ stringOverrides: { title: stringOverrides === null || stringOverrides === void 0 || (_stringOverrides$card2 = stringOverrides.cards) === null || _stringOverrides$card2 === void 0 || (_stringOverrides$card2 = _stringOverrides$card2.expenses) === null || _stringOverrides$card2 === void 0 ? void 0 : _stringOverrides$card2.header }
44468
+ }),
44469
+ /* @__PURE__ */ jsx(TaxEstimatesSummaryCard, {
44470
+ mode: TaxEstimatesSummaryCardMode.HorizontalBarChart,
44471
+ withHeaderSeparator: true,
44472
+ title: stringOverrides === null || stringOverrides === void 0 || (_stringOverrides$card3 = stringOverrides.cards) === null || _stringOverrides$card3 === void 0 || (_stringOverrides$card3 = _stringOverrides$card3.taxEstimates) === null || _stringOverrides$card3 === void 0 ? void 0 : _stringOverrides$card3.header
44473
+ }),
44474
+ /* @__PURE__ */ jsx(MileageTrackingSummary, _objectSpread2({}, stringOverrides === null || stringOverrides === void 0 || (_stringOverrides$card4 = stringOverrides.cards) === null || _stringOverrides$card4 === void 0 ? void 0 : _stringOverrides$card4.mileageTracking))
44475
+ ]
44476
+ })
44477
+ ]
44478
+ })
44479
+ });
44480
+ };
44481
+ //#endregion
44482
+ //#region src/types/location.ts
44483
+ var US_STATES_CONFIG = [
44484
+ _objectSpread2({ value: "AL" }, translationKey("usStates:label.alabama", "Alabama")),
44485
+ _objectSpread2({ value: "AK" }, translationKey("usStates:label.alaska", "Alaska")),
44486
+ _objectSpread2({ value: "AZ" }, translationKey("usStates:label.arizona", "Arizona")),
44487
+ _objectSpread2({ value: "AR" }, translationKey("usStates:label.arkansas", "Arkansas")),
44488
+ _objectSpread2({ value: "CA" }, translationKey("usStates:label.california", "California")),
44489
+ _objectSpread2({ value: "CO" }, translationKey("usStates:label.colorado", "Colorado")),
44490
+ _objectSpread2({ value: "CT" }, translationKey("usStates:label.connecticut", "Connecticut")),
44491
+ _objectSpread2({ value: "DE" }, translationKey("usStates:label.delaware", "Delaware")),
44492
+ _objectSpread2({ value: "DC" }, translationKey("usStates:label.district_columbia", "District of Columbia")),
44493
+ _objectSpread2({ value: "FL" }, translationKey("usStates:label.florida", "Florida")),
44494
+ _objectSpread2({ value: "GA" }, translationKey("usStates:label.georgia", "Georgia")),
44495
+ _objectSpread2({ value: "HI" }, translationKey("usStates:label.hawaii", "Hawaii")),
44496
+ _objectSpread2({ value: "ID" }, translationKey("usStates:label.idaho", "Idaho")),
44497
+ _objectSpread2({ value: "IL" }, translationKey("usStates:label.illinois", "Illinois")),
44498
+ _objectSpread2({ value: "IN" }, translationKey("usStates:label.indiana", "Indiana")),
44499
+ _objectSpread2({ value: "IA" }, translationKey("usStates:label.iowa", "Iowa")),
44500
+ _objectSpread2({ value: "KS" }, translationKey("usStates:label.kansas", "Kansas")),
44501
+ _objectSpread2({ value: "KY" }, translationKey("usStates:label.kentucky", "Kentucky")),
44502
+ _objectSpread2({ value: "LA" }, translationKey("usStates:label.louisiana", "Louisiana")),
44503
+ _objectSpread2({ value: "ME" }, translationKey("usStates:label.maine", "Maine")),
44504
+ _objectSpread2({ value: "MD" }, translationKey("usStates:label.maryland", "Maryland")),
44505
+ _objectSpread2({ value: "MA" }, translationKey("usStates:label.massachusetts", "Massachusetts")),
44506
+ _objectSpread2({ value: "MI" }, translationKey("usStates:label.michigan", "Michigan")),
44507
+ _objectSpread2({ value: "MN" }, translationKey("usStates:label.minnesota", "Minnesota")),
44508
+ _objectSpread2({ value: "MS" }, translationKey("usStates:label.mississippi", "Mississippi")),
44509
+ _objectSpread2({ value: "MO" }, translationKey("usStates:label.missouri", "Missouri")),
44510
+ _objectSpread2({ value: "MT" }, translationKey("usStates:label.montana", "Montana")),
44511
+ _objectSpread2({ value: "NE" }, translationKey("usStates:label.nebraska", "Nebraska")),
44512
+ _objectSpread2({ value: "NV" }, translationKey("usStates:label.nevada", "Nevada")),
44513
+ _objectSpread2({ value: "NH" }, translationKey("usStates:label.new_hampshire", "New Hampshire")),
44514
+ _objectSpread2({ value: "NJ" }, translationKey("usStates:label.new_jersey", "New Jersey")),
44515
+ _objectSpread2({ value: "NM" }, translationKey("usStates:label.new_mexico", "New Mexico")),
44516
+ _objectSpread2({ value: "NY" }, translationKey("usStates:label.new_york", "New York")),
44517
+ _objectSpread2({ value: "NC" }, translationKey("usStates:label.north_carolina", "North Carolina")),
44518
+ _objectSpread2({ value: "ND" }, translationKey("usStates:label.north_dakota", "North Dakota")),
44519
+ _objectSpread2({ value: "OH" }, translationKey("usStates:label.ohio", "Ohio")),
44520
+ _objectSpread2({ value: "OK" }, translationKey("usStates:label.oklahoma", "Oklahoma")),
44521
+ _objectSpread2({ value: "OR" }, translationKey("usStates:label.oregon", "Oregon")),
44522
+ _objectSpread2({ value: "PA" }, translationKey("usStates:label.pennsylvania", "Pennsylvania")),
44523
+ _objectSpread2({ value: "RI" }, translationKey("usStates:label.rhode_island", "Rhode Island")),
44524
+ _objectSpread2({ value: "SC" }, translationKey("usStates:label.south_carolina", "South Carolina")),
44525
+ _objectSpread2({ value: "SD" }, translationKey("usStates:label.south_dakota", "South Dakota")),
44526
+ _objectSpread2({ value: "TN" }, translationKey("usStates:label.tennessee", "Tennessee")),
44527
+ _objectSpread2({ value: "TX" }, translationKey("usStates:label.texas", "Texas")),
44528
+ _objectSpread2({ value: "UT" }, translationKey("usStates:label.utah", "Utah")),
44529
+ _objectSpread2({ value: "VT" }, translationKey("usStates:label.vermont", "Vermont")),
44530
+ _objectSpread2({ value: "VA" }, translationKey("usStates:label.virginia", "Virginia")),
44531
+ _objectSpread2({ value: "WA" }, translationKey("usStates:label.washington", "Washington")),
44532
+ _objectSpread2({ value: "WV" }, translationKey("usStates:label.west_virginia", "West Virginia")),
44533
+ _objectSpread2({ value: "WI" }, translationKey("usStates:label.wisconsin", "Wisconsin")),
44534
+ _objectSpread2({ value: "WY" }, translationKey("usStates:label.wyoming", "Wyoming")),
44535
+ _objectSpread2({ value: "PR" }, translationKey("usStates:label.puerto_rico", "Puerto Rico"))
44536
+ ];
44537
+ var US_STATE_VALUES = US_STATES_CONFIG.map((s) => s.value);
44538
+ //#endregion
44539
+ //#region src/schemas/taxEstimates/filingStatus.ts
44540
+ var FilingStatus = /* @__PURE__ */ function(FilingStatus) {
44541
+ FilingStatus["SINGLE"] = "SINGLE";
44542
+ FilingStatus["MARRIED"] = "MARRIED";
44543
+ FilingStatus["MARRIED_SEPARATELY"] = "MARRIED_SEPARATELY";
44544
+ FilingStatus["HEAD"] = "HEAD";
44545
+ FilingStatus["WIDOWER"] = "WIDOWER";
44546
+ return FilingStatus;
44547
+ }({});
44548
+ var FilingStatusSchema = Schema.Enums(FilingStatus);
44549
+ //#endregion
44550
+ //#region src/schemas/taxEstimates/profile.ts
44551
+ var USStateCodeSchema = Schema.Literal(...US_STATE_VALUES);
44552
+ var WithholdingSchema = Schema.Struct({
44553
+ useCustomWithholding: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Boolean)), Schema.fromKey("use_custom_withholding")),
44554
+ amount: Schema.NullishOr(Schema.Number)
44555
+ });
44556
+ var HomeOfficeDeductionSchema = Schema.Struct({
44557
+ useHomeOfficeDeduction: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Boolean)), Schema.fromKey("use_home_office_deduction")),
44558
+ homeOfficeArea: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Number)), Schema.fromKey("home_office_area"))
44559
+ });
44560
+ var VehicleDeductionSchema = Schema.Struct({ useMileageDeduction: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Boolean)), Schema.fromKey("use_mileage_deduction")) });
44561
+ var DeductionsSchema = Schema.Struct({
44562
+ homeOffice: pipe(Schema.propertySignature(Schema.NullishOr(HomeOfficeDeductionSchema)), Schema.fromKey("home_office")),
44563
+ vehicle: Schema.NullishOr(VehicleDeductionSchema)
44564
+ });
44565
+ var FederalConfigurationSchema = Schema.Struct({
44566
+ filingStatus: pipe(Schema.propertySignature(Schema.NullishOr(FilingStatusSchema)), Schema.fromKey("filing_status")),
44567
+ annualW2Income: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Number)), Schema.fromKey("annual_w2_income")),
44568
+ tipIncome: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Number)), Schema.fromKey("tip_income")),
44569
+ overtimeIncome: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Number)), Schema.fromKey("overtime_income")),
44570
+ withholding: Schema.NullishOr(WithholdingSchema)
44571
+ });
44572
+ var StateConfigurationSchema = Schema.Struct({
44573
+ taxState: pipe(Schema.propertySignature(Schema.NullishOr(USStateCodeSchema)), Schema.fromKey("tax_state")),
44574
+ filingStatus: pipe(Schema.propertySignature(Schema.NullishOr(FilingStatusSchema)), Schema.fromKey("filing_status")),
44575
+ withholding: Schema.NullishOr(WithholdingSchema)
44576
+ });
44577
+ var UsConfigurationSchema = Schema.Struct({
44578
+ federal: Schema.NullishOr(FederalConfigurationSchema),
44579
+ state: Schema.NullishOr(StateConfigurationSchema),
44580
+ deductions: pipe(Schema.propertySignature(Schema.NullishOr(DeductionsSchema)), Schema.fromKey("deductions"))
44581
+ });
44582
+ var TaxProfileSchema = Schema.Struct({
44583
+ taxCountryCode: pipe(Schema.propertySignature(Schema.NullishOr(Schema.String)), Schema.fromKey("tax_country_code")),
44584
+ usConfiguration: pipe(Schema.propertySignature(Schema.NullishOr(UsConfigurationSchema)), Schema.fromKey("us_configuration")),
44585
+ userHasSavedTaxProfile: pipe(Schema.propertySignature(Schema.Boolean), Schema.fromKey("user_has_saved_tax_profile"))
44586
+ });
44587
+ var TaxProfileResponseSchema = Schema.Struct({ data: TaxProfileSchema });
44588
+ var TaxProfileRequestSchema = Schema.Struct({
44589
+ taxCountryCode: pipe(Schema.propertySignature(Schema.NullishOr(Schema.String)), Schema.fromKey("tax_country_code")),
44590
+ usConfiguration: pipe(Schema.propertySignature(Schema.NullishOr(UsConfigurationSchema)), Schema.fromKey("us_configuration"))
44591
+ });
44592
+ //#endregion
44593
+ //#region src/hooks/api/businesses/[business-id]/tax-estimates/profile/useTaxProfile.ts
44594
+ var TAX_PROFILE_TAG_KEY = "#tax-profile";
44595
+ var getTaxProfile = get(({ businessId }) => {
44596
+ return `/v1/businesses/${businessId}/tax-estimates/profile`;
44597
+ });
44598
+ function buildKey$16({ access_token: accessToken, apiUrl, businessId }) {
44599
+ if (accessToken && apiUrl) return {
44600
+ accessToken,
44601
+ apiUrl,
44602
+ businessId,
44603
+ tags: [TAX_PROFILE_TAG_KEY]
44604
+ };
44605
+ }
44606
+ function useTaxProfile() {
44607
+ const withLocale = useLocalizedKey();
44608
+ const { data: auth } = useAuth();
44609
+ const { businessId } = useLayerContext();
44610
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$16(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), function() {
44611
+ var _ref = _asyncToGenerator(function* ({ accessToken, apiUrl, businessId }) {
44612
+ return getTaxProfile(apiUrl, accessToken, { params: { businessId } })().then(Schema.decodeUnknownPromise(TaxProfileResponseSchema)).then(({ data }) => data);
44613
+ });
44614
+ return function(_x) {
44615
+ return _ref.apply(this, arguments);
44616
+ };
44617
+ }()));
44618
+ }
44619
+ function useTaxProfileGlobalCacheActions() {
44620
+ const { patchCache } = useGlobalCacheActions();
44621
+ return { patchTaxProfile: useCallback((updatedProfile) => patchCache(({ tags }) => tags.includes(TAX_PROFILE_TAG_KEY), () => updatedProfile), [patchCache]) };
44622
+ }
44623
+ //#endregion
44624
+ //#region src/hooks/features/taxEstimates/useTaxEstimatesOnboardingStatus.ts
44625
+ var OnboardingStatus = /* @__PURE__ */ function(OnboardingStatus) {
44626
+ OnboardingStatus["Loading"] = "Loading";
44627
+ OnboardingStatus["Error"] = "Error";
44628
+ OnboardingStatus["NotOnboarded"] = "NotOnboarded";
44629
+ OnboardingStatus["Onboarded"] = "Onboarded";
44630
+ OnboardingStatus["FeatureDisabled"] = "FeatureDisabled";
44631
+ return OnboardingStatus;
44632
+ }({});
44633
+ function getTaxEstimatesOnboardingStatus(input) {
44634
+ var _input$accountingConf, _input$taxProfile;
44635
+ const isFeatureEnabled = !!((_input$accountingConf = input.accountingConfiguration) === null || _input$accountingConf === void 0 ? void 0 : _input$accountingConf.enableTaxEstimates);
44636
+ const hasSavedTaxProfile = (_input$taxProfile = input.taxProfile) === null || _input$taxProfile === void 0 ? void 0 : _input$taxProfile.userHasSavedTaxProfile;
44637
+ if (input.isError) return OnboardingStatus.Error;
44638
+ if (input.isLoading || !input.accountingConfiguration) return OnboardingStatus.Loading;
44639
+ if (!isFeatureEnabled) return OnboardingStatus.FeatureDisabled;
44640
+ if (hasSavedTaxProfile === false) return OnboardingStatus.NotOnboarded;
44641
+ if (hasSavedTaxProfile === true) return OnboardingStatus.Onboarded;
44642
+ return OnboardingStatus.Loading;
44643
+ }
44644
+ function useTaxEstimatesOnboardingStatus() {
44645
+ const { accountingConfiguration } = useLayerContext();
44646
+ const { data: taxProfile, isLoading, isError } = useTaxProfile();
44647
+ return getTaxEstimatesOnboardingStatus({
44648
+ isLoading,
44649
+ isError,
44650
+ accountingConfiguration,
44651
+ taxProfile
44652
+ });
44653
+ }
44654
+ //#endregion
43675
44655
  //#region src/contexts/TaxEstimatesContext/TaxEstimatesContextProvider.tsx
43676
44656
  var TaxEstimatesContext = createContext({});
43677
44657
  var useTaxEstimatesContext = () => useContext(TaxEstimatesContext);
@@ -44064,7 +45044,7 @@ var getTaxDetails = get(({ businessId, year, reportingBasis, fullYearProjection
44064
45044
  full_year_projection: fullYearProjection
44065
45045
  })}`;
44066
45046
  });
44067
- function buildKey$17({ access_token: accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection }) {
45047
+ function buildKey$15({ access_token: accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection }) {
44068
45048
  if (accessToken && apiUrl) return {
44069
45049
  accessToken,
44070
45050
  apiUrl,
@@ -44079,7 +45059,7 @@ function useTaxDetails({ year, reportingBasis, fullYearProjection }) {
44079
45059
  const withLocale = useLocalizedKey();
44080
45060
  const { data: auth } = useAuth();
44081
45061
  const { businessId } = useLayerContext();
44082
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$17(_objectSpread2(_objectSpread2({}, auth), {}, {
45062
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$15(_objectSpread2(_objectSpread2({}, auth), {}, {
44083
45063
  businessId,
44084
45064
  year,
44085
45065
  reportingBasis,
@@ -44127,7 +45107,7 @@ var getTaxPayments = get(({ businessId, year, reportingBasis, fullYearProjection
44127
45107
  full_year_projection: fullYearProjection
44128
45108
  })}`;
44129
45109
  });
44130
- function buildKey$16({ access_token: accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection }) {
45110
+ function buildKey$14({ access_token: accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection }) {
44131
45111
  if (accessToken && apiUrl) return {
44132
45112
  accessToken,
44133
45113
  apiUrl,
@@ -44142,7 +45122,7 @@ function useTaxPayments({ year, reportingBasis, fullYearProjection }) {
44142
45122
  const withLocale = useLocalizedKey();
44143
45123
  const { data: auth } = useAuth();
44144
45124
  const { businessId } = useLayerContext();
44145
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$16(_objectSpread2(_objectSpread2({}, auth), {}, {
45125
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$14(_objectSpread2(_objectSpread2({}, auth), {}, {
44146
45126
  businessId,
44147
45127
  year,
44148
45128
  reportingBasis,
@@ -44175,7 +45155,7 @@ var UpsertTaxProfileMode = /* @__PURE__ */ function(UpsertTaxProfileMode) {
44175
45155
  }({});
44176
45156
  var createTaxProfile = post(({ businessId }) => `/v1/businesses/${businessId}/tax-estimates/profile`);
44177
45157
  var updateTaxProfile = patch(({ businessId }) => `/v1/businesses/${businessId}/tax-estimates/profile`);
44178
- function buildKey$15({ access_token: accessToken, apiUrl, businessId }) {
45158
+ function buildKey$13({ access_token: accessToken, apiUrl, businessId }) {
44179
45159
  if (accessToken && apiUrl) return {
44180
45160
  accessToken,
44181
45161
  apiUrl,
@@ -44193,7 +45173,7 @@ function useUpsertTaxProfile({ mode }) {
44193
45173
  const { patchTaxProfile } = useTaxProfileGlobalCacheActions();
44194
45174
  const { forceReloadTaxPayments } = useTaxPaymentsGlobalCacheActions();
44195
45175
  const { forceReloadTaxDetails } = useTaxDetailsGlobalCacheActions();
44196
- const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$15(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), function() {
45176
+ const mutationResponse = new SWRMutationResult(useSWRMutation(() => withLocale(buildKey$13(_objectSpread2(_objectSpread2({}, auth), {}, { businessId }))), function() {
44197
45177
  var _ref = _asyncToGenerator(function* ({ accessToken, apiUrl, businessId }, { arg }) {
44198
45178
  return getRequestFn(mode)(apiUrl, accessToken, {
44199
45179
  params: { businessId },
@@ -44299,10 +45279,7 @@ var TaxProfileForm = ({ taxProfile, onSuccess, isReadOnly }) => {
44299
45279
  const actionsStackProps = isDesktop ? {
44300
45280
  direction: "row",
44301
45281
  justify: "end"
44302
- } : {
44303
- direction: "column",
44304
- gap: "md"
44305
- };
45282
+ } : { direction: "column" };
44306
45283
  return /* @__PURE__ */ jsx(Form$1, {
44307
45284
  className: "Layer__TaxProfileForm",
44308
45285
  onSubmit: blockNativeOnSubmit,
@@ -44364,7 +45341,7 @@ var TaxProfileForm = ({ taxProfile, onSuccess, isReadOnly }) => {
44364
45341
  }
44365
45342
  })]
44366
45343
  }),
44367
- /* @__PURE__ */ jsxs(Stack, _objectSpread2(_objectSpread2({}, actionsStackProps), {}, { children: [/* @__PURE__ */ jsx(form.Subscribe, {
45344
+ /* @__PURE__ */ jsxs(Stack, _objectSpread2(_objectSpread2({ gap: "md" }, actionsStackProps), {}, { children: [/* @__PURE__ */ jsx(form.Subscribe, {
44368
45345
  selector: (state) => ({
44369
45346
  errorMap: state.errorMap,
44370
45347
  isDirty: state.isDirty
@@ -44444,7 +45421,7 @@ var TaxOverviewApiDataSchema = Schema.Struct({
44444
45421
  year: Schema.Number,
44445
45422
  metrics: Schema.Array(TaxOverviewMetricSchema)
44446
45423
  });
44447
- var TaxOverviewApiResponseSchema = Schema.Struct({ data: TaxOverviewApiDataSchema });
45424
+ Schema.Struct({ data: TaxOverviewApiDataSchema });
44448
45425
  var TaxOverviewDeadlineStatus = /* @__PURE__ */ function(TaxOverviewDeadlineStatus) {
44449
45426
  TaxOverviewDeadlineStatus["PastDue"] = "PAST_DUE";
44450
45427
  TaxOverviewDeadlineStatus["Paid"] = "PAID";
@@ -44465,14 +45442,20 @@ var TaxEstimatesBannerQuarterSchema = Schema.Struct({
44465
45442
  amountPaid: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("amount_paid")),
44466
45443
  balance: Schema.Number,
44467
45444
  uncategorizedCount: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("uncategorized_count")),
44468
- uncategorizedSum: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("uncategorized_sum"))
45445
+ uncategorizedMoneyIn: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("uncategorized_money_in")),
45446
+ uncategorizedMoneyOut: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("uncategorized_money_out")),
45447
+ earliestUncategorizedAt: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Date)), Schema.fromKey("earliest_uncategorized_at")),
45448
+ latestUncategorizedAt: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Date)), Schema.fromKey("latest_uncategorized_at"))
44469
45449
  });
44470
45450
  var TaxEstimatesBannerSchema = Schema.Struct({
44471
45451
  year: Schema.Number,
44472
45452
  taxesDueAt: pipe(Schema.propertySignature(CalendarDateSchema), Schema.fromKey("taxes_due_at")),
44473
45453
  totalTaxesOwed: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("total_taxes_owed")),
44474
45454
  totalUncategorizedCount: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("total_uncategorized_count")),
44475
- totalUncategorizedSum: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("total_uncategorized_sum")),
45455
+ totalUncategorizedMoneyIn: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("total_uncategorized_money_in")),
45456
+ totalUncategorizedMoneyOut: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("total_uncategorized_money_out")),
45457
+ earliestUncategorizedAt: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Date)), Schema.fromKey("earliest_uncategorized_at")),
45458
+ latestUncategorizedAt: pipe(Schema.propertySignature(Schema.NullishOr(Schema.Date)), Schema.fromKey("latest_uncategorized_at")),
44476
45459
  quarters: Schema.Array(TaxEstimatesBannerQuarterSchema)
44477
45460
  });
44478
45461
  var TaxEstimatesBannerResponseSchema = Schema.Struct({ data: TaxEstimatesBannerSchema });
@@ -44486,7 +45469,7 @@ var getTaxEstimatesBanner = get(({ businessId, year, reportingBasis, fullYearPro
44486
45469
  full_year_projection: fullYearProjection
44487
45470
  })}`;
44488
45471
  });
44489
- function buildKey$14({ access_token: accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection }) {
45472
+ function buildKey$12({ access_token: accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection }) {
44490
45473
  if (accessToken && apiUrl) return {
44491
45474
  accessToken,
44492
45475
  apiUrl,
@@ -44501,7 +45484,7 @@ function useTaxEstimatesBanner({ year, reportingBasis, fullYearProjection }) {
44501
45484
  const withLocale = useLocalizedKey();
44502
45485
  const { data: auth } = useAuth();
44503
45486
  const { businessId } = useLayerContext();
44504
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$14(_objectSpread2(_objectSpread2({}, auth), {}, {
45487
+ return new SWRQueryResult(useSWR(() => withLocale(buildKey$12(_objectSpread2(_objectSpread2({}, auth), {}, {
44505
45488
  businessId,
44506
45489
  year,
44507
45490
  reportingBasis,
@@ -44521,17 +45504,52 @@ function useTaxEstimatesBanner({ year, reportingBasis, fullYearProjection }) {
44521
45504
  }()));
44522
45505
  }
44523
45506
  //#endregion
45507
+ //#region src/hooks/features/taxEstimates/useTaxBanner.ts
45508
+ function useTaxBanner(data) {
45509
+ const { t } = useTranslation();
45510
+ const { formatCurrencyFromCents, formatDate, formatDateRange } = useIntlFormatter();
45511
+ const { isDesktop } = useSizeClass();
45512
+ const { year, totalUncategorizedCount: count, totalUncategorizedMoneyIn: moneyIn, totalUncategorizedMoneyOut: moneyOut, earliestUncategorizedAt, latestUncategorizedAt } = data;
45513
+ const deductions = formatCurrencyFromCents(moneyOut);
45514
+ const income = formatCurrencyFromCents(moneyIn);
45515
+ if (!isDesktop) return { bannerDescription: tPlural(t, "taxEstimates:banner.categorization_incomplete.description_short", {
45516
+ count,
45517
+ deductions,
45518
+ income,
45519
+ one: "You have {{count}} uncategorized transaction: {{deductions}} in deductions and {{income}} in unrecognized income.",
45520
+ other: "You have {{count}} uncategorized transactions: {{deductions}} in deductions and {{income}} in unrecognized income."
45521
+ }) };
45522
+ if (!!(earliestUncategorizedAt && latestUncategorizedAt) && earliestUncategorizedAt && latestUncategorizedAt) return { bannerDescription: tPlural(t, "taxEstimates:banner.categorization_incomplete.description_with_range", {
45523
+ count,
45524
+ year,
45525
+ dateRange: earliestUncategorizedAt.getFullYear() === latestUncategorizedAt.getFullYear() && earliestUncategorizedAt.getMonth() === latestUncategorizedAt.getMonth() && earliestUncategorizedAt.getDate() === latestUncategorizedAt.getDate() ? formatDate(earliestUncategorizedAt, DateFormat.DateShort) : formatDateRange(earliestUncategorizedAt, latestUncategorizedAt, DateFormat.DateShort),
45526
+ deductions,
45527
+ income,
45528
+ one: "In tax year {{year}}, you have {{count}} uncategorized transaction spanning {{dateRange}} with potentially {{deductions}} in deductions and {{income}} in unrecognized income. Review and categorize your transactions for more accurate estimates.",
45529
+ other: "In tax year {{year}}, you have {{count}} uncategorized transactions spanning from {{dateRange}} with potentially {{deductions}} in deductions and {{income}} in unrecognized income. Review and categorize your transactions for more accurate estimates."
45530
+ }) };
45531
+ return { bannerDescription: tPlural(t, "taxEstimates:banner.categorization_incomplete.description", {
45532
+ count,
45533
+ year,
45534
+ deductions,
45535
+ income,
45536
+ one: "In tax year {{year}}, you have {{count}} uncategorized transaction with potentially {{deductions}} in deductions and {{income}} in unrecognized income. Review and categorize your transactions for more accurate estimates.",
45537
+ other: "In tax year {{year}}, you have {{count}} uncategorized transactions with potentially {{deductions}} in deductions and {{income}} in unrecognized income. Review and categorize your transactions for more accurate estimates."
45538
+ }) };
45539
+ }
45540
+ //#endregion
44524
45541
  //#region src/components/TaxDetails/TaxBanner.tsx
44525
- var TaxBanner = ({ uncategorizedCount, uncategorizedAmount }) => {
45542
+ var TaxBanner = ({ data }) => {
44526
45543
  const { isMobile } = useSizeClass();
44527
45544
  const { t } = useTranslation();
44528
- const { formatCurrencyFromCents } = useIntlFormatter();
44529
45545
  const { onClickReviewTransactions } = useTaxEstimatesContext();
45546
+ const { bannerDescription } = useTaxBanner(data);
44530
45547
  const title = t("taxEstimates:banner.categorization_incomplete.title", "Your tax estimates are incomplete");
44531
45548
  const ReviewButton = onClickReviewTransactions ? /* @__PURE__ */ jsx(BannerButton, {
44532
45549
  onPress: () => onClickReviewTransactions({
44533
- uncategorizedAmount,
44534
- uncategorizedTransactionCount: uncategorizedCount
45550
+ uncategorizedMoneyIn: data.totalUncategorizedMoneyIn,
45551
+ uncategorizedMoneyOut: data.totalUncategorizedMoneyOut,
45552
+ uncategorizedTransactionCount: data.totalUncategorizedCount
44535
45553
  }),
44536
45554
  children: t("taxEstimates:action.review_banner", "Review")
44537
45555
  }) : void 0;
@@ -44542,12 +45560,7 @@ var TaxBanner = ({ uncategorizedCount, uncategorizedAmount }) => {
44542
45560
  variant: "warning",
44543
45561
  ariaLabel: title,
44544
45562
  title,
44545
- description: tPlural(t, "taxEstimates:banner.categorization_incomplete.description", {
44546
- count: uncategorizedCount,
44547
- amount: formatCurrencyFromCents(uncategorizedAmount),
44548
- one: "You have {{count}} uncategorized transaction with {{amount}} in potential deductions to review.",
44549
- other: "You have {{count}} uncategorized transactions with {{amount}} in potential deductions to review."
44550
- }),
45563
+ description: bannerDescription,
44551
45564
  slots: {
44552
45565
  Icon: isMobile ? null : /* @__PURE__ */ jsx(FileText, { size: 16 }),
44553
45566
  Button: ReviewButton
@@ -44571,71 +45584,6 @@ var ResponsiveDetailView = ({ name, slots, children, mobileProps }) => {
44571
45584
  });
44572
45585
  };
44573
45586
  //#endregion
44574
- //#region src/schemas/taxEstimates/summary.ts
44575
- var TaxSummarySectionTypeSchema = Schema.Literal("federal", "state");
44576
- var TaxSummarySectionSchema = Schema.Struct({
44577
- type: TaxSummarySectionTypeSchema,
44578
- key: Schema.NullishOr(Schema.String),
44579
- label: Schema.String,
44580
- total: Schema.Number,
44581
- taxesPaid: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("taxes_paid")),
44582
- taxesOwed: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("taxes_owed"))
44583
- });
44584
- var TaxSummarySchema = Schema.Struct({
44585
- year: Schema.Number,
44586
- projectedTaxesOwed: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("projected_taxes_owed")),
44587
- taxesDueAt: pipe(Schema.propertySignature(Schema.Date), Schema.fromKey("taxes_due_at")),
44588
- uncategorizedTaxPayments: pipe(Schema.propertySignature(Schema.Number), Schema.fromKey("uncategorized_tax_payments")),
44589
- sections: Schema.Array(TaxSummarySectionSchema)
44590
- });
44591
- var TaxSummaryResponseSchema = Schema.Struct({ data: TaxSummarySchema });
44592
- //#endregion
44593
- //#region src/hooks/api/businesses/[business-id]/tax-estimates/summary/useTaxSummary.ts
44594
- var TAX_SUMMARY_TAG_KEY = "#tax-summary";
44595
- var getTaxSummary = get(({ businessId, year, reportingBasis, fullYearProjection }) => {
44596
- return `/v1/businesses/${businessId}/tax-estimates/summary?${toDefinedSearchParameters({
44597
- year,
44598
- reporting_basis: reportingBasis,
44599
- full_year_projection: fullYearProjection
44600
- })}`;
44601
- });
44602
- function buildKey$13({ access_token: accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection, enabled = true }) {
44603
- if (!enabled) return;
44604
- if (accessToken && apiUrl) return {
44605
- accessToken,
44606
- apiUrl,
44607
- businessId,
44608
- year,
44609
- reportingBasis,
44610
- fullYearProjection,
44611
- tags: [TAX_SUMMARY_TAG_KEY]
44612
- };
44613
- }
44614
- function useTaxSummary({ year, reportingBasis, fullYearProjection, enabled = true }) {
44615
- const withLocale = useLocalizedKey();
44616
- const { data: auth } = useAuth();
44617
- const { businessId } = useLayerContext();
44618
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$13(_objectSpread2(_objectSpread2({}, auth), {}, {
44619
- businessId,
44620
- year,
44621
- reportingBasis,
44622
- fullYearProjection,
44623
- enabled
44624
- }))), function() {
44625
- var _ref = _asyncToGenerator(function* ({ accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection }) {
44626
- return getTaxSummary(apiUrl, accessToken, { params: {
44627
- businessId,
44628
- year,
44629
- reportingBasis,
44630
- fullYearProjection
44631
- } })().then(Schema.decodeUnknownPromise(TaxSummaryResponseSchema)).then(({ data }) => data);
44632
- });
44633
- return function(_x) {
44634
- return _ref.apply(this, arguments);
44635
- };
44636
- }()));
44637
- }
44638
- //#endregion
44639
45587
  //#region src/utils/i18n/conditional.ts
44640
45588
  var _excluded$1 = [
44641
45589
  "condition",
@@ -44695,8 +45643,7 @@ var EquationRow = ({ section, size = "md" }) => {
44695
45643
  /* @__PURE__ */ jsx(AmountWithLabel, { slotProps: {
44696
45644
  MoneySpan: {
44697
45645
  amount: section.taxesOwed,
44698
- size,
44699
- weight: "bold"
45646
+ size
44700
45647
  },
44701
45648
  Badge: { children: t("taxEstimates:label.taxes_owed", "Taxes Owed") }
44702
45649
  } })
@@ -44819,10 +45766,20 @@ var TaxSummaryCardMobile = ({ data }) => {
44819
45766
  children: t("taxEstimates:label.taxes_due_at", "Taxes due on {{date}}", { date: formatDate(data.taxesDueAt) })
44820
45767
  })]
44821
45768
  }),
44822
- /* @__PURE__ */ jsx(MoneySpan, {
44823
- size: "xl",
44824
- weight: "bold",
44825
- amount: data.projectedTaxesOwed
45769
+ /* @__PURE__ */ jsxs(HStack, {
45770
+ className: "Layer__TaxSummaryCard__MobileAmountRow",
45771
+ justify: "space-between",
45772
+ align: "baseline",
45773
+ gap: "md",
45774
+ children: [/* @__PURE__ */ jsx(MoneySpan, {
45775
+ size: "xl",
45776
+ weight: "bold",
45777
+ amount: data.projectedTaxesOwed
45778
+ }), /* @__PURE__ */ jsx(Button$1, {
45779
+ variant: "text",
45780
+ onClick: () => setIsExpanded((prev) => !prev),
45781
+ children: isExpanded ? t("common:label.hide_details", "Hide details") : t("common:label.show_details", "Show details")
45782
+ })]
44826
45783
  }),
44827
45784
  isExpanded && /* @__PURE__ */ jsx(VStack, {
44828
45785
  className: "Layer__TaxSummaryCard__MobileSections",
@@ -44831,15 +45788,6 @@ var TaxSummaryCardMobile = ({ data }) => {
44831
45788
  var _section$key;
44832
45789
  return /* @__PURE__ */ jsx(SectionEquation, { section }, (_section$key = section.key) !== null && _section$key !== void 0 ? _section$key : section.label);
44833
45790
  })
44834
- }),
44835
- /* @__PURE__ */ jsx(HStack, {
44836
- className: "Layer__TaxSummaryCard__MobileToggleWrapper",
44837
- justify: "center",
44838
- children: /* @__PURE__ */ jsx(Button$1, {
44839
- variant: "text",
44840
- onClick: () => setIsExpanded((prev) => !prev),
44841
- children: isExpanded ? t("common:label.hide_details", "Hide details") : t("common:label.show_details", "Show details")
44842
- })
44843
45791
  })
44844
45792
  ]
44845
45793
  })
@@ -45020,18 +45968,6 @@ var TaxEstimatesHeader = ({ type }) => {
45020
45968
  });
45021
45969
  };
45022
45970
  //#endregion
45023
- //#region src/components/TaxDetails/Operator/Operator.tsx
45024
- var Operator = ({ sign }) => {
45025
- if (!sign) return null;
45026
- return /* @__PURE__ */ jsx(Span, {
45027
- className: "Layer__TaxDetails__Operator",
45028
- size: "lg",
45029
- variant: "subtle",
45030
- "aria-hidden": "true",
45031
- children: sign
45032
- });
45033
- };
45034
- //#endregion
45035
45971
  //#region src/components/TaxDetails/TaxDetailsContent.tsx
45036
45972
  var TaxDetailsColumns = /* @__PURE__ */ function(TaxDetailsColumns) {
45037
45973
  TaxDetailsColumns["Label"] = "Label";
@@ -45052,7 +45988,7 @@ var EmptyState$1 = () => {
45052
45988
  spacing: true
45053
45989
  });
45054
45990
  };
45055
- var ErrorState$4 = () => {
45991
+ var ErrorState$1 = () => {
45056
45992
  const { t } = useTranslation();
45057
45993
  return /* @__PURE__ */ jsx(DataState, {
45058
45994
  status: DataStateStatus.failed,
@@ -45062,17 +45998,17 @@ var ErrorState$4 = () => {
45062
45998
  });
45063
45999
  };
45064
46000
  var TaxDetailsRowLabelCell = (row) => {
45065
- if (row.original.operator !== void 0 && row.original.operator !== null) return /* @__PURE__ */ jsxs(HStack, {
45066
- className: "Layer__TaxDetails__TaxDetailsRow--operator",
45067
- align: "center",
45068
- gap: "md",
45069
- children: [/* @__PURE__ */ jsx(Operator, { sign: row.original.operator }), /* @__PURE__ */ jsx(Span, { children: row.original.label })]
46001
+ const { operator, label } = row.original;
46002
+ if (operator === "=") return /* @__PURE__ */ jsx(Span, {
46003
+ className: "Layer__TaxDetails__TaxDetailsRow--total",
46004
+ children: label
45070
46005
  });
45071
- return /* @__PURE__ */ jsx(Span, { children: row.original.label });
46006
+ return /* @__PURE__ */ jsx(Span, { children: label });
45072
46007
  };
45073
46008
  var makeAmountCellRenderer = ({ formatNumber, formatPercent }) => {
45074
46009
  return function TaxDetailsAmountCell(row) {
45075
46010
  const { value } = row.original;
46011
+ if (row.getCanExpand() && row.getIsExpanded()) return null;
45076
46012
  if (value === void 0) return /* @__PURE__ */ jsx(Span, { children: "-" });
45077
46013
  if (isPercentageCellValue(value)) return /* @__PURE__ */ jsx(Span, { children: formatPercent(value.value, {
45078
46014
  maximumFractionDigits: 2,
@@ -45131,7 +46067,7 @@ function TaxDetailsContent() {
45131
46067
  isError,
45132
46068
  data,
45133
46069
  Loading: /* @__PURE__ */ jsx(Loader, {}),
45134
- Error: /* @__PURE__ */ jsx(ErrorState$4, {}),
46070
+ Error: /* @__PURE__ */ jsx(ErrorState$1, {}),
45135
46071
  children: ({ data: details }) => {
45136
46072
  return /* @__PURE__ */ jsx(ExpandableCardsWrapper, {
45137
46073
  className: "Layer__TaxDetails__ExpandableCardsWrapper",
@@ -45145,7 +46081,7 @@ function TaxDetailsContent() {
45145
46081
  indentSize: isDesktop ? "sm" : "xs",
45146
46082
  slots: {
45147
46083
  EmptyState: EmptyState$1,
45148
- ErrorState: ErrorState$4
46084
+ ErrorState: ErrorState$1
45149
46085
  },
45150
46086
  getSubRows: getSubRows$1,
45151
46087
  getRowId: getRowId$1
@@ -45166,673 +46102,6 @@ var TaxDetails = () => {
45166
46102
  });
45167
46103
  };
45168
46104
  //#endregion
45169
- //#region src/components/TaxEstimatesSummaryCard/constants.ts
45170
- var resolveCategoryColor = ({ key }) => {
45171
- var _federal$state$key;
45172
- return (_federal$state$key = {
45173
- federal: DEFAULT_CHART_COLORS[0],
45174
- state: DEFAULT_CHART_COLORS[1]
45175
- }[key]) !== null && _federal$state$key !== void 0 ? _federal$state$key : DEFAULT_CHART_COLORS[0];
45176
- };
45177
- //#endregion
45178
- //#region src/components/TaxEstimatesSummaryCard/useTaxEstimatesSummaryCard.ts
45179
- var prepareTaxSummaryData = (taxSummaryData, shortenedDisplayName, isMobile) => {
45180
- return taxSummaryData.sections.map((section) => ({
45181
- value: Math.max(section.taxesOwed, 0),
45182
- name: section.type,
45183
- displayName: isMobile ? shortenedDisplayName(section.type) : section.label
45184
- }));
45185
- };
45186
- var useTaxEstimatesSummaryCard = () => {
45187
- const { year } = useTaxEstimatesYear();
45188
- const { fullYearProjection } = useFullYearProjection();
45189
- const { t } = useTranslation();
45190
- const { isDesktop, isMobile } = useSizeClass();
45191
- const { data: taxSummaryData, isLoading, isError } = useTaxSummary({
45192
- year,
45193
- fullYearProjection,
45194
- enabled: true
45195
- });
45196
- const shortenedDisplayName = useCallback((type) => {
45197
- if (type === "federal") return t("taxEstimates:label.federal", "Federal");
45198
- if (type === "state") return t("taxEstimates:label.state", "State");
45199
- return type;
45200
- }, [t]);
45201
- return {
45202
- detailData: useMemo(() => {
45203
- if (!taxSummaryData) return void 0;
45204
- const data = prepareTaxSummaryData(taxSummaryData, shortenedDisplayName, isMobile);
45205
- return {
45206
- data,
45207
- total: data.reduce((sum, section) => sum + section.value, 0)
45208
- };
45209
- }, [
45210
- taxSummaryData,
45211
- isMobile,
45212
- shortenedDisplayName
45213
- ]),
45214
- isLoading,
45215
- isError,
45216
- layout: isDesktop ? "taxOverview" : "summaryCard",
45217
- title: t("taxEstimates:label.tax_summary", "Tax Summary")
45218
- };
45219
- };
45220
- //#endregion
45221
- //#region src/components/TaxEstimatesSummaryCard/TaxEstimatesSummaryCard.tsx
45222
- var LoadingState$3 = () => {
45223
- return /* @__PURE__ */ jsxs(VStack, {
45224
- gap: "md",
45225
- className: "Layer__TaxEstimatesSummaryCard__Content",
45226
- pb: "md",
45227
- pi: "lg",
45228
- align: "center",
45229
- children: [
45230
- /* @__PURE__ */ jsx(CircleSkeletonLoader, {
45231
- height: "128px",
45232
- width: "128px"
45233
- }),
45234
- /* @__PURE__ */ jsx(SkeletonLoader, {
45235
- height: "24px",
45236
- width: "80%"
45237
- }),
45238
- /* @__PURE__ */ jsx(SkeletonLoader, {
45239
- height: "24px",
45240
- width: "80%"
45241
- }),
45242
- /* @__PURE__ */ jsx(SkeletonLoader, {
45243
- height: "24px",
45244
- width: "80%"
45245
- })
45246
- ]
45247
- });
45248
- };
45249
- var ErrorState$3 = () => {
45250
- const { t } = useTranslation();
45251
- return /* @__PURE__ */ jsx(VStack, {
45252
- gap: "md",
45253
- className: "Layer__TaxEstimatesSummaryCard__Content",
45254
- pb: "md",
45255
- pi: "lg",
45256
- align: "center",
45257
- children: /* @__PURE__ */ jsx(Span, {
45258
- size: "lg",
45259
- children: t("taxEstimates:error.load_tax_estimates_summary", "We couldn't load your tax summary")
45260
- })
45261
- });
45262
- };
45263
- var Content = ({ data, commonProps, layout }) => {
45264
- const { isMobile } = useSizeClass();
45265
- return isMobile || layout === "summaryCard" ? /* @__PURE__ */ jsxs(VStack, {
45266
- className: "Layer__TaxEstimatesSummaryCard__Content Layer__TaxEstimatesSummaryCard__Content--mobile",
45267
- gap: "lg",
45268
- children: [/* @__PURE__ */ jsx(DetailedChart, _objectSpread2({ data }, commonProps)), /* @__PURE__ */ jsx(DetailedTableWithData, _objectSpread2(_objectSpread2({ data }, commonProps), NO_SORT_PROPS))]
45269
- }) : /* @__PURE__ */ jsxs(HStack, {
45270
- className: "Layer__TaxEstimatesSummaryCard__Content",
45271
- align: "center",
45272
- gap: "lg",
45273
- children: [/* @__PURE__ */ jsx(DetailedChart, _objectSpread2({ data }, commonProps)), /* @__PURE__ */ jsx(DetailedTableWithData, _objectSpread2(_objectSpread2({ data }, commonProps), NO_SORT_PROPS))]
45274
- });
45275
- };
45276
- var TaxEstimatesSummaryCard = () => {
45277
- const { detailData, layout, title, isLoading, isError } = useTaxEstimatesSummaryCard();
45278
- const { isDesktop } = useSizeClass();
45279
- const isSummaryCardLayout = layout === "summaryCard";
45280
- const commonProps = useMemo(() => {
45281
- var _detailData$data;
45282
- const colorByKey = detailData === null || detailData === void 0 || (_detailData$data = detailData.data) === null || _detailData$data === void 0 ? void 0 : _detailData$data.reduce((acc, item) => {
45283
- acc[item.name] = resolveCategoryColor({ key: item.name });
45284
- return acc;
45285
- }, {});
45286
- return {
45287
- interactionProps: NO_OP_INTERACTION_PROPS,
45288
- stylingProps: { colorSelector: (item) => {
45289
- var _colorByKey$item$name;
45290
- return {
45291
- color: (_colorByKey$item$name = colorByKey === null || colorByKey === void 0 ? void 0 : colorByKey[item.name]) !== null && _colorByKey$item$name !== void 0 ? _colorByKey$item$name : "var(--color-base-300)",
45292
- opacity: 1
45293
- };
45294
- } }
45295
- };
45296
- }, [detailData === null || detailData === void 0 ? void 0 : detailData.data]);
45297
- return /* @__PURE__ */ jsx(VStack, {
45298
- className: "Layer__TaxEstimatesSummaryCard__Container",
45299
- children: /* @__PURE__ */ jsx(Card, {
45300
- className: classNames("Layer__TaxEstimatesSummaryCard", isSummaryCardLayout && "Layer__TaxEstimatesSummaryCard--summaryCard"),
45301
- children: /* @__PURE__ */ jsxs(VStack, {
45302
- gap: "md",
45303
- className: "Layer__TaxEstimatesSummaryCard__Body",
45304
- children: [/* @__PURE__ */ jsx(HStack, {
45305
- className: classNames("Layer__TaxEstimatesSummaryCard__Header", isSummaryCardLayout && "Layer__SummaryCard__ContainerHeader"),
45306
- justify: "space-between",
45307
- align: isSummaryCardLayout ? "center" : "start",
45308
- gap: "md",
45309
- children: /* @__PURE__ */ jsx(Heading$2, {
45310
- size: !isDesktop ? "sm" : "md",
45311
- children: title
45312
- })
45313
- }), /* @__PURE__ */ jsx(ConditionalBlock, {
45314
- data: detailData,
45315
- isLoading,
45316
- isError,
45317
- Loading: /* @__PURE__ */ jsx(LoadingState$3, {}),
45318
- Error: /* @__PURE__ */ jsx(ErrorState$3, {}),
45319
- children: ({ data }) => /* @__PURE__ */ jsx(Content, {
45320
- data,
45321
- commonProps,
45322
- layout
45323
- })
45324
- })]
45325
- })
45326
- })
45327
- });
45328
- };
45329
- //#endregion
45330
- //#region src/components/TaxOverview/constants.ts
45331
- var TAX_OVERVIEW_MOBILE_BREAKPOINT = 1200;
45332
- //#endregion
45333
- //#region src/hooks/api/businesses/[business-id]/tax-estimates/overview/useTaxOverview.ts
45334
- var TAX_OVERVIEW_TAG_KEY = "#tax-overview";
45335
- var getTaxOverview = get(({ businessId, year, reportingBasis, fullYearProjection }) => {
45336
- return `/v1/businesses/${businessId}/tax-estimates/overview?${toDefinedSearchParameters({
45337
- year,
45338
- reporting_basis: reportingBasis,
45339
- full_year_projection: fullYearProjection
45340
- })}`;
45341
- });
45342
- function buildKey$12({ access_token: accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection, enabled = true }) {
45343
- if (!enabled) return;
45344
- if (accessToken && apiUrl) return {
45345
- accessToken,
45346
- apiUrl,
45347
- businessId,
45348
- year,
45349
- reportingBasis,
45350
- fullYearProjection,
45351
- tags: [TAX_OVERVIEW_TAG_KEY]
45352
- };
45353
- }
45354
- function useTaxOverview({ year, reportingBasis, fullYearProjection, enabled = true }) {
45355
- const withLocale = useLocalizedKey();
45356
- const { data: auth } = useAuth();
45357
- const { businessId } = useLayerContext();
45358
- return new SWRQueryResult(useSWR(() => withLocale(buildKey$12(_objectSpread2(_objectSpread2({}, auth), {}, {
45359
- businessId,
45360
- year,
45361
- reportingBasis,
45362
- fullYearProjection,
45363
- enabled
45364
- }))), function() {
45365
- var _ref = _asyncToGenerator(function* ({ accessToken, apiUrl, businessId, year, reportingBasis, fullYearProjection }) {
45366
- return getTaxOverview(apiUrl, accessToken, { params: {
45367
- businessId,
45368
- year,
45369
- reportingBasis,
45370
- fullYearProjection
45371
- } })().then(Schema.decodeUnknownPromise(TaxOverviewApiResponseSchema)).then(({ data }) => data);
45372
- });
45373
- return function(_x) {
45374
- return _ref.apply(this, arguments);
45375
- };
45376
- }()));
45377
- }
45378
- //#endregion
45379
- //#region src/components/MetricRow/MetricRow.tsx
45380
- var BorderedMetricRow = ({ amount, slotProps }) => {
45381
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs(HStack, {
45382
- className: "Layer__MetricCard__Meter",
45383
- align: "start",
45384
- justify: "space-between",
45385
- children: [/* @__PURE__ */ jsx(Span, {
45386
- size: "md",
45387
- className: "Layer__MetricCard__Label",
45388
- children: slotProps.Meter.label
45389
- }), /* @__PURE__ */ jsx(MoneySpan, {
45390
- size: "md",
45391
- amount
45392
- })]
45393
- }), /* @__PURE__ */ jsx(Meter$1, _objectSpread2(_objectSpread2({}, slotProps.Meter), {}, { meterOnly: true }))] });
45394
- };
45395
- var StandardMetricRow = ({ amount, slotProps }) => {
45396
- return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Span, {
45397
- size: "md",
45398
- className: "Layer__MetricRow__Label",
45399
- children: slotProps.Meter.label
45400
- }), /* @__PURE__ */ jsxs(HStack, {
45401
- className: "Layer__MetricRow__Value",
45402
- align: "center",
45403
- gap: "md",
45404
- children: [/* @__PURE__ */ jsx(MoneySpan, {
45405
- size: "md",
45406
- weight: "bold",
45407
- amount
45408
- }), /* @__PURE__ */ jsx(Meter$1, _objectSpread2(_objectSpread2({}, slotProps.Meter), {}, { meterOnly: true }))]
45409
- })] });
45410
- };
45411
- var MetricRow = ({ amount, className, showBorder = false, slotProps }) => {
45412
- const stackProps = _objectSpread2({
45413
- className: classNames(className, {
45414
- Layer__MetricCard: showBorder,
45415
- Layer__MetricRow: !showBorder
45416
- }),
45417
- align: !showBorder ? "center" : void 0,
45418
- direction: showBorder ? "column" : "row"
45419
- }, !showBorder && { justify: "space-between" });
45420
- const metricProps = {
45421
- amount,
45422
- slotProps
45423
- };
45424
- return /* @__PURE__ */ jsx(Stack, _objectSpread2(_objectSpread2({}, stackProps), {}, {
45425
- gap: "md",
45426
- children: showBorder ? /* @__PURE__ */ jsx(BorderedMetricRow, _objectSpread2({}, metricProps)) : /* @__PURE__ */ jsx(StandardMetricRow, _objectSpread2({}, metricProps))
45427
- }));
45428
- };
45429
- //#endregion
45430
- //#region src/components/TaxOverview/useMetricRowProps.ts
45431
- var METRIC_ROW_MOBILE_BREAKPOINT = 600;
45432
- var meterClassByType = {
45433
- TOTAL_INCOME: "Layer__TaxOverview__IncomeMeter",
45434
- TOTAL_PRE_AGI_DEDUCTIONS: "Layer__TaxOverview__DeductionsMeter",
45435
- TAXABLE_INCOME: "Layer__TaxOverview__TaxableIncomeMeter",
45436
- UNKNOWN_TYPE: "Layer__TaxOverview__UnknownMetricMeter"
45437
- };
45438
- function useMetricRowProps({ metricType, amount, maxMeterValue, label }) {
45439
- const [viewportWidth] = useWindowSize();
45440
- const boundedMaxMeterValue = Math.max(maxMeterValue, 1);
45441
- const boundedMeterValue = Math.min(Math.max(amount, 0), boundedMaxMeterValue);
45442
- const showBorder = viewportWidth < METRIC_ROW_MOBILE_BREAKPOINT;
45443
- return {
45444
- slotProps: useMemo(() => ({ Meter: {
45445
- className: `${meterClassByType[metricType]} Layer__TaxOverview__Meter`,
45446
- label,
45447
- minValue: 0,
45448
- value: boundedMeterValue,
45449
- maxValue: boundedMaxMeterValue
45450
- } }), [
45451
- metricType,
45452
- boundedMeterValue,
45453
- boundedMaxMeterValue,
45454
- label
45455
- ]),
45456
- showBorder
45457
- };
45458
- }
45459
- //#endregion
45460
- //#region src/components/TaxOverview/TaxEstimateMetricRow.tsx
45461
- function TaxEstimateMetricRow({ metric }) {
45462
- const { slotProps, showBorder } = useMetricRowProps({
45463
- metricType: metric.metricType,
45464
- amount: metric.value,
45465
- maxMeterValue: metric.maxValue,
45466
- label: metric.label
45467
- });
45468
- return /* @__PURE__ */ jsx(MetricRow, {
45469
- amount: metric.value,
45470
- showBorder,
45471
- slotProps
45472
- });
45473
- }
45474
- //#endregion
45475
- //#region src/components/TaxOverview/TaxableIncomeCard.tsx
45476
- var LoadingState$2 = () => /* @__PURE__ */ jsx(Loader, {});
45477
- var ErrorState$2 = () => {
45478
- const { t } = useTranslation();
45479
- return /* @__PURE__ */ jsx(DataState, {
45480
- status: DataStateStatus.failed,
45481
- title: t("taxEstimates:error.load_tax_estimates", "We couldn't load your tax estimates"),
45482
- description: t("taxEstimates:error.while_loading_tax_estimates", "An error occurred while loading your tax estimates. Please check your connection and try again.")
45483
- });
45484
- };
45485
- var TaxableIncomeCard = () => {
45486
- const { year } = useTaxEstimatesYear();
45487
- const { fullYearProjection } = useFullYearProjection();
45488
- const [viewportWidth] = useWindowSize();
45489
- const { isDesktop } = useSizeClass();
45490
- const className = classNames({ "Layer__TaxOverview__Card__MetricRow--mobile": !isDesktop });
45491
- const isHeaderVisible = viewportWidth >= TAX_OVERVIEW_MOBILE_BREAKPOINT;
45492
- const { data: taxOverviewData, isLoading, isError } = useTaxOverview({
45493
- year,
45494
- fullYearProjection,
45495
- enabled: true
45496
- });
45497
- return /* @__PURE__ */ jsxs(Card, {
45498
- className: "Layer__TaxOverview__Card",
45499
- children: [isHeaderVisible && /* @__PURE__ */ jsx(TaxEstimatesHeader, { type: TaxEstimatesHeaderType.Overview }), /* @__PURE__ */ jsx(ConditionalBlock, {
45500
- data: taxOverviewData,
45501
- isLoading,
45502
- isError,
45503
- Loading: /* @__PURE__ */ jsx(LoadingState$2, {}),
45504
- Error: /* @__PURE__ */ jsx(ErrorState$2, {}),
45505
- children: ({ data }) => /* @__PURE__ */ jsx(VStack, {
45506
- pi: isDesktop ? "md" : void 0,
45507
- children: /* @__PURE__ */ jsx(VStack, {
45508
- className,
45509
- gap: "4xs",
45510
- children: data.metrics.map((metric, index) => /* @__PURE__ */ jsx(TaxEstimateMetricRow, { metric }, `${metric.metricType}-${metric.label}-${index}`))
45511
- })
45512
- })
45513
- })]
45514
- });
45515
- };
45516
- //#endregion
45517
- //#region src/hooks/features/taxEstimates/useTaxEstimatesDeadlines.ts
45518
- function mapQuarterToSection(t, quarter) {
45519
- let quarterLabel;
45520
- switch (quarter.quarter) {
45521
- case 1:
45522
- quarterLabel = t("taxEstimates:label.q1", "Q1");
45523
- break;
45524
- case 2:
45525
- quarterLabel = t("taxEstimates:label.q2", "Q2");
45526
- break;
45527
- case 3:
45528
- quarterLabel = t("taxEstimates:label.q3", "Q3");
45529
- break;
45530
- case 4:
45531
- quarterLabel = t("taxEstimates:label.q4", "Q4");
45532
- break;
45533
- }
45534
- return _objectSpread2(_objectSpread2({}, quarter), {}, {
45535
- type: "quarter",
45536
- title: t("taxEstimates:label.quarter_taxes", "{{quarterLabel}} taxes", { quarterLabel })
45537
- });
45538
- }
45539
- var useTaxEstimatesDeadlines = () => {
45540
- const { year } = useTaxEstimatesYear();
45541
- const { fullYearProjection } = useFullYearProjection();
45542
- const { t } = useTranslation();
45543
- const { data, isLoading, isError } = useTaxEstimatesBanner({
45544
- year,
45545
- fullYearProjection
45546
- });
45547
- return {
45548
- data: useMemo(() => {
45549
- if (!data) return void 0;
45550
- const quarters = data.quarters.map((quarter) => mapQuarterToSection(t, quarter));
45551
- const annual = {
45552
- type: "annual",
45553
- title: t("taxEstimates:label.annual_taxes", "Annual taxes"),
45554
- dueDate: data.taxesDueAt,
45555
- amountOwed: data.totalTaxesOwed,
45556
- state: TaxOverviewDeadlineStatus.Neutral,
45557
- uncategorizedCount: data.totalUncategorizedCount,
45558
- uncategorizedSum: data.totalUncategorizedSum
45559
- };
45560
- return [...quarters, annual];
45561
- }, [data, t]),
45562
- isLoading,
45563
- isError
45564
- };
45565
- };
45566
- //#endregion
45567
- //#region src/components/TaxEstimatesDeadlineRow/StatusIcon.tsx
45568
- var ICON_SIZE$1 = 14;
45569
- var ICON_STROKE_WIDTH = 2.25;
45570
- var getStatusVisuals = (t, status) => {
45571
- switch (status) {
45572
- case TaxOverviewDeadlineStatus.Paid: return {
45573
- Icon: Check,
45574
- label: t("taxEstimates:label.paid", "Paid"),
45575
- tone: "paid"
45576
- };
45577
- case TaxOverviewDeadlineStatus.PastDue: return {
45578
- Icon: CircleAlert,
45579
- label: t("taxEstimates:label.payment_past_due", "Payment past due"),
45580
- tone: "pastDue"
45581
- };
45582
- case TaxOverviewDeadlineStatus.Due: return {
45583
- Icon: Clock3,
45584
- label: t("taxEstimates:label.due", "Due"),
45585
- tone: "due"
45586
- };
45587
- case TaxOverviewDeadlineStatus.CategorizationIncomplete: return {
45588
- Icon: CircleAlert,
45589
- label: t("taxEstimates:label.categorization_incomplete", "Categorization incomplete"),
45590
- tone: "warning"
45591
- };
45592
- case TaxOverviewDeadlineStatus.Neutral:
45593
- default: return {
45594
- Icon: Clock3,
45595
- label: t("taxEstimates:label.estimated_taxes", "Estimated taxes"),
45596
- tone: "neutral"
45597
- };
45598
- }
45599
- };
45600
- var StatusIcon = ({ status }) => {
45601
- const { t } = useTranslation();
45602
- const { Icon, label, tone } = getStatusVisuals(t, status);
45603
- return /* @__PURE__ */ jsxs(Tooltip$1, { children: [/* @__PURE__ */ jsx(TooltipTrigger, {
45604
- asChild: true,
45605
- children: /* @__PURE__ */ jsx(Span, {
45606
- nonAria: true,
45607
- className: `Layer__TaxOverview__AmountIcon Layer__TaxOverview__AmountIcon--${tone}`,
45608
- children: /* @__PURE__ */ jsx(Icon, {
45609
- size: ICON_SIZE$1,
45610
- strokeWidth: ICON_STROKE_WIDTH,
45611
- "aria-hidden": true
45612
- })
45613
- })
45614
- }), /* @__PURE__ */ jsx(TooltipContent, { children: /* @__PURE__ */ jsx(Span, {
45615
- className: "Layer__UI__tooltip-content--text",
45616
- children: label
45617
- }) })] });
45618
- };
45619
- //#endregion
45620
- //#region src/components/TaxEstimatesDeadlineRow/TaxEstimatesDeadlineRow.tsx
45621
- var HEADING_LEVEL = 3;
45622
- var ICON_SIZE = 12;
45623
- var TaxEstimatesDeadlineRow = ({ data }) => {
45624
- const { t } = useTranslation();
45625
- const { formatDate } = useIntlFormatter();
45626
- const { year } = useTaxEstimatesYear();
45627
- const { onClickReviewTransactions } = useTaxEstimatesContext();
45628
- const { isMobile } = useSizeClass();
45629
- const isAnnual = data.type === "annual";
45630
- return /* @__PURE__ */ jsxs(Card, {
45631
- className: "Layer__TaxOverview__DeadlineCard",
45632
- children: [/* @__PURE__ */ jsxs(HStack, {
45633
- justify: "space-between",
45634
- align: "start",
45635
- gap: "md",
45636
- pb: "md",
45637
- pi: "md",
45638
- children: [/* @__PURE__ */ jsxs(VStack, {
45639
- className: "Layer__TaxOverview__DeadlineContent",
45640
- gap: "3xs",
45641
- fluid: true,
45642
- children: [/* @__PURE__ */ jsx(Heading$2, {
45643
- level: HEADING_LEVEL,
45644
- size: "sm",
45645
- children: data.title
45646
- }), /* @__PURE__ */ jsx(Span, {
45647
- size: "sm",
45648
- variant: "subtle",
45649
- children: t("taxEstimates:label.due_with_date", "Due: {{date}}", { date: formatCalendarDate(data.dueDate, formatDate) })
45650
- })]
45651
- }), /* @__PURE__ */ jsx(VStack, {
45652
- className: "Layer__TaxOverview__DeadlineAmountColumn",
45653
- align: "end",
45654
- gap: "xs",
45655
- children: /* @__PURE__ */ jsxs(VStack, {
45656
- align: "end",
45657
- gap: "3xs",
45658
- children: [/* @__PURE__ */ jsxs(HStack, {
45659
- className: "Layer__TaxOverview__DeadlineValueRow",
45660
- align: "center",
45661
- gap: "sm",
45662
- children: [/* @__PURE__ */ jsx(StatusIcon, { status: data.state }), /* @__PURE__ */ jsx(MoneySpan, {
45663
- size: "lg",
45664
- weight: "bold",
45665
- amount: data.amountOwed
45666
- })]
45667
- }), /* @__PURE__ */ jsx(VStack, {
45668
- align: "end",
45669
- gap: "3xs",
45670
- children: /* @__PURE__ */ jsx(Span, {
45671
- size: "xs",
45672
- variant: "subtle",
45673
- children: t("taxEstimates:label.estimated_taxes", "Estimated taxes")
45674
- })
45675
- })]
45676
- })
45677
- })]
45678
- }), data.uncategorizedCount > 0 && /* @__PURE__ */ jsxs(Stack, {
45679
- direction: isMobile ? "column" : "row",
45680
- align: isMobile ? void 0 : "center",
45681
- className: "Layer__TaxOverview__DeadlineReviewRow",
45682
- justify: "space-between",
45683
- gap: "md",
45684
- pb: "md",
45685
- pi: "md",
45686
- children: [/* @__PURE__ */ jsxs(HStack, {
45687
- className: "Layer__TaxOverview__DeadlineReviewContent",
45688
- align: "center",
45689
- gap: "xs",
45690
- children: [/* @__PURE__ */ jsx(Span, {
45691
- nonAria: true,
45692
- className: "Layer__TaxOverview__DeadlineReviewIcon",
45693
- children: /* @__PURE__ */ jsx(FileText, { size: ICON_SIZE })
45694
- }), /* @__PURE__ */ jsx(Span, {
45695
- className: "Layer__TaxOverview__DeadlineReviewLabel",
45696
- size: "sm",
45697
- weight: "bold",
45698
- children: isAnnual ? tPlural(t, "taxEstimates:label.uncategorized_transactions_with_year", {
45699
- count: data.uncategorizedCount,
45700
- one: "{{count}} uncategorized transaction ({{year}})",
45701
- other: "{{count}} uncategorized transactions ({{year}})",
45702
- year
45703
- }) : tPlural(t, "taxEstimates:label.uncategorized_transactions", {
45704
- count: data.uncategorizedCount,
45705
- one: "{{count}} uncategorized transaction",
45706
- other: "{{count}} uncategorized transactions"
45707
- })
45708
- })]
45709
- }), onClickReviewTransactions && /* @__PURE__ */ jsx(Button$1, {
45710
- variant: "outlined",
45711
- onPress: () => onClickReviewTransactions({
45712
- uncategorizedAmount: data.uncategorizedSum,
45713
- uncategorizedTransactionCount: data.uncategorizedCount
45714
- }),
45715
- children: t("taxEstimates:action.review_banner", "Review")
45716
- })]
45717
- })]
45718
- });
45719
- };
45720
- //#endregion
45721
- //#region src/components/TaxOverview/TaxDeadlinesCard.tsx
45722
- var LoadingState$1 = () => {
45723
- const { t } = useTranslation();
45724
- const { isDesktop } = useSizeClass();
45725
- return /* @__PURE__ */ jsx(Card, {
45726
- className: "Layer__TaxOverview__Card Layer__TaxOverview__Card--deadlines",
45727
- children: /* @__PURE__ */ jsxs(VStack, {
45728
- gap: "lg",
45729
- children: [
45730
- /* @__PURE__ */ jsx(Heading$2, {
45731
- size: isDesktop ? "md" : "sm",
45732
- children: t("taxEstimates:label.your_tax_deadlines", "Your tax deadlines")
45733
- }),
45734
- /* @__PURE__ */ jsx(SkeletonLoader, {
45735
- height: "72px",
45736
- width: "100%"
45737
- }),
45738
- /* @__PURE__ */ jsx(SkeletonLoader, {
45739
- height: "72px",
45740
- width: "100%"
45741
- }),
45742
- /* @__PURE__ */ jsx(SkeletonLoader, {
45743
- height: "72px",
45744
- width: "100%"
45745
- }),
45746
- /* @__PURE__ */ jsx(SkeletonLoader, {
45747
- height: "72px",
45748
- width: "100%"
45749
- }),
45750
- /* @__PURE__ */ jsx(SkeletonLoader, {
45751
- height: "72px",
45752
- width: "100%"
45753
- })
45754
- ]
45755
- })
45756
- });
45757
- };
45758
- var ErrorState$1 = () => {
45759
- const { t } = useTranslation();
45760
- const { isDesktop } = useSizeClass();
45761
- return /* @__PURE__ */ jsx(Card, {
45762
- className: "Layer__TaxOverview__Card Layer__TaxOverview__Card--deadlines",
45763
- children: /* @__PURE__ */ jsxs(VStack, {
45764
- gap: "lg",
45765
- children: [/* @__PURE__ */ jsx(Heading$2, {
45766
- size: isDesktop ? "md" : "sm",
45767
- children: t("taxEstimates:label.your_tax_deadlines", "Your tax deadlines")
45768
- }), /* @__PURE__ */ jsx(Span, {
45769
- size: "md",
45770
- children: t("taxEstimates:error.load_tax_deadlines", "We couldn't load your tax deadlines")
45771
- })]
45772
- })
45773
- });
45774
- };
45775
- var TaxDeadlinesCard = () => {
45776
- const { t } = useTranslation();
45777
- const { isDesktop } = useSizeClass();
45778
- const { data, isLoading, isError } = useTaxEstimatesDeadlines();
45779
- return /* @__PURE__ */ jsx(ConditionalBlock, {
45780
- data,
45781
- isLoading,
45782
- isError,
45783
- Loading: /* @__PURE__ */ jsx(LoadingState$1, {}),
45784
- Error: /* @__PURE__ */ jsx(ErrorState$1, {}),
45785
- children: ({ data }) => {
45786
- const paymentDeadlines = data.filter((deadline) => deadline.type === "quarter");
45787
- const annualDeadline = data.find((deadline) => deadline.type === "annual");
45788
- return /* @__PURE__ */ jsx(Card, {
45789
- className: "Layer__TaxOverview__Card Layer__TaxOverview__Card--deadlines",
45790
- children: /* @__PURE__ */ jsxs(VStack, {
45791
- gap: "lg",
45792
- children: [/* @__PURE__ */ jsx(Heading$2, {
45793
- size: isDesktop ? "md" : "sm",
45794
- children: t("taxEstimates:label.your_tax_deadlines", "Your tax deadlines")
45795
- }), /* @__PURE__ */ jsxs(VStack, {
45796
- gap: "2xs",
45797
- children: [paymentDeadlines.map((deadline) => /* @__PURE__ */ jsx(TaxEstimatesDeadlineRow, { data: deadline }, deadline.title)), annualDeadline && /* @__PURE__ */ jsx(TaxEstimatesDeadlineRow, { data: annualDeadline }, "annual")]
45798
- })]
45799
- })
45800
- });
45801
- }
45802
- });
45803
- };
45804
- //#endregion
45805
- //#region src/components/TaxOverview/TaxOverview.tsx
45806
- var TaxOverview = () => {
45807
- const [viewportWidth] = useWindowSize();
45808
- if (viewportWidth < 1200) return /* @__PURE__ */ jsxs(VStack, {
45809
- className: "Layer__TaxOverview",
45810
- gap: "md",
45811
- children: [
45812
- /* @__PURE__ */ jsx(TaxEstimatesHeader, { type: TaxEstimatesHeaderType.Overview }),
45813
- /* @__PURE__ */ jsx(TaxableIncomeCard, {}),
45814
- /* @__PURE__ */ jsx(TaxEstimatesSummaryCard, {}),
45815
- /* @__PURE__ */ jsx(TaxDeadlinesCard, {})
45816
- ]
45817
- });
45818
- return /* @__PURE__ */ jsx(VStack, {
45819
- className: "Layer__TaxOverview",
45820
- gap: "md",
45821
- children: /* @__PURE__ */ jsxs(HStack, {
45822
- gap: "md",
45823
- align: "start",
45824
- children: [/* @__PURE__ */ jsxs(VStack, {
45825
- className: "Layer__TaxOverview__PrimaryColumn",
45826
- gap: "md",
45827
- children: [/* @__PURE__ */ jsx(TaxableIncomeCard, {}), /* @__PURE__ */ jsx(TaxEstimatesSummaryCard, {})]
45828
- }), /* @__PURE__ */ jsx(VStack, {
45829
- className: "Layer__TaxOverview__SecondaryColumn",
45830
- children: /* @__PURE__ */ jsx(TaxDeadlinesCard, {})
45831
- })]
45832
- })
45833
- });
45834
- };
45835
- //#endregion
45836
46105
  //#region src/components/TaxPayments/TaxPaymentsMobileList/TaxPaymentsMobileList.tsx
45837
46106
  var TaxPaymentsMobileListItem = ({ payment }) => {
45838
46107
  const { t } = useTranslation();
@@ -46025,11 +46294,7 @@ var TaxPayments = () => {
46025
46294
  };
46026
46295
  //#endregion
46027
46296
  //#region src/views/TaxEstimates/TaxEstimatesOnboardedViewContent.tsx
46028
- var TAX_ESTIMATES_TAB_CONFIG = [
46029
- _objectSpread2({ value: TaxEstimatesRoute.Overview }, translationKey("common:label.overview", "Overview")),
46030
- _objectSpread2({ value: TaxEstimatesRoute.Estimates }, translationKey("taxEstimates:label.estimates", "Estimates")),
46031
- _objectSpread2({ value: TaxEstimatesRoute.Payments }, translationKey("taxEstimates:label.payments", "Payments"))
46032
- ];
46297
+ var TAX_ESTIMATES_TAB_CONFIG = [_objectSpread2({ value: TaxEstimatesRoute.Estimates }, translationKey("taxEstimates:label.estimates", "Estimates")), _objectSpread2({ value: TaxEstimatesRoute.Payments }, translationKey("taxEstimates:label.payments", "Payments"))];
46033
46298
  var TaxEstimatesOnboardedViewContent = () => {
46034
46299
  const { t } = useTranslation();
46035
46300
  const { route } = useTaxEstimatesRouteState();
@@ -46047,9 +46312,6 @@ var TaxEstimatesOnboardedViewContent = () => {
46047
46312
  })), [t]);
46048
46313
  const handleTabChange = useCallback((key) => {
46049
46314
  switch (key) {
46050
- case TaxEstimatesRoute.Overview:
46051
- navigate.toOverview();
46052
- break;
46053
46315
  case TaxEstimatesRoute.Estimates:
46054
46316
  navigate.toEstimates();
46055
46317
  break;
@@ -46071,11 +46333,7 @@ var TaxEstimatesOnboardedViewContent = () => {
46071
46333
  selectedKey: route,
46072
46334
  onSelectionChange: handleTabChange
46073
46335
  }),
46074
- showBanner && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(TaxBanner, {
46075
- uncategorizedCount: taxBannerData.totalUncategorizedCount,
46076
- uncategorizedAmount: taxBannerData.totalUncategorizedSum
46077
- }) }),
46078
- route === TaxEstimatesRoute.Overview && /* @__PURE__ */ jsx(TaxOverview, {}),
46336
+ showBanner && /* @__PURE__ */ jsx(Fragment$1, { children: /* @__PURE__ */ jsx(TaxBanner, { data: taxBannerData }) }),
46079
46337
  route === TaxEstimatesRoute.Estimates && /* @__PURE__ */ jsx(TaxDetails, {}),
46080
46338
  route === TaxEstimatesRoute.Payments && /* @__PURE__ */ jsx(TaxPayments, {})
46081
46339
  ]
@@ -47737,6 +47995,7 @@ var ActiveTimeTrackerBanner = ({ activeEntry, timerDisplayValue }) => {
47737
47995
  align: "center",
47738
47996
  children: [/* @__PURE__ */ jsx(Span, { className: "Layer__ActiveTimeTracker__TimerDot" }), /* @__PURE__ */ jsx(Span, {
47739
47997
  className: "Layer__ActiveTimeTracker__TimerValue",
47998
+ numeric: "tabular-nums",
47740
47999
  children: timerDisplayValue
47741
48000
  })]
47742
48001
  }), /* @__PURE__ */ jsxs(HStack, {
@@ -47899,6 +48158,7 @@ var ActiveTimerDurationDisplay = () => {
47899
48158
  pb: "md",
47900
48159
  children: [/* @__PURE__ */ jsx(Span, {
47901
48160
  className: "Layer__ActiveTimeTracker__DurationValue",
48161
+ numeric: "tabular-nums",
47902
48162
  children: formatSecondsAsDuration(0)
47903
48163
  }), /* @__PURE__ */ jsx(Span, {
47904
48164
  className: "Layer__ActiveTimeTracker__DurationLabel",
@@ -48947,6 +49207,7 @@ function TimeTrackingStatsContent({ summary }) {
48947
49207
  }), /* @__PURE__ */ jsx(DurationSpan, {
48948
49208
  className: "Layer__TimeTrackingStats__SummaryValue",
48949
49209
  weight: "bold",
49210
+ numeric: "tabular-nums",
48950
49211
  durationMinutes: summary.totalMinutes
48951
49212
  })]
48952
49213
  })]
@@ -49448,4 +49709,4 @@ var LayerProvider = (_ref) => {
49448
49709
  });
49449
49710
  };
49450
49711
  //#endregion
49451
- export { AccountingOverview, BalanceSheet, BankTransactions, BankTransactionsWithLinkedAccounts, BookkeepingOverview, BookkeepingUpsellBar, ChartOfAccounts, Direction, DisplayState, EntityName, GeneralLedgerView, GlobalDateRangeSelection, GlobalMonthPicker, Integrations, Invoices, Journal, LandingPage, LayerProvider, LinkAccounts, LinkedAccounts, Onboarding, ProfitAndLoss, ProfitAndLossView, ProjectProfitabilityView, Reports, StatementOfCashFlow, SupportedLocale, Tasks, TimeTracking, UnifiedReports, MileageSummaryCard as unstable_MileageSummaryCard, unstable_MileageTracking, TaxEstimates as unstable_TaxEstimates, useLayerContext };
49712
+ export { AccountingOverview, BalanceSheet, BankTransactions, BankTransactionsWithLinkedAccounts, BookkeepingOverview, BookkeepingUpsellBar, ChartOfAccounts, Direction, DisplayState, EntityName, GeneralLedgerView, GlobalDateRangeSelection, GlobalMonthPicker, Integrations, Invoices, Journal, LandingPage, LayerProvider, LinkAccounts, LinkedAccounts, Onboarding, ProfitAndLoss, ProfitAndLossView, ProjectProfitabilityView, Reports, StatementOfCashFlow, SupportedLocale, Tasks, TimeTracking, UnifiedReports, MileageSummaryCard as unstable_MileageSummaryCard, unstable_MileageTracking, SolopreneurOverview as unstable_SolopreneurOverview, TaxEstimates as unstable_TaxEstimates, useLayerContext };