@layerfi/components 0.1.107 → 0.1.108-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +1540 -770
- package/dist/esm/index.mjs +1215 -445
- package/dist/index.css +51 -30
- package/dist/index.d.ts +561 -36
- package/package.json +1 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -5570,7 +5570,7 @@ import { useState as useState3 } from "react";
|
|
|
5570
5570
|
import { useReducer, useEffect } from "react";
|
|
5571
5571
|
|
|
5572
5572
|
// package.json
|
|
5573
|
-
var version = "0.1.
|
|
5573
|
+
var version = "0.1.108-alpha";
|
|
5574
5574
|
|
|
5575
5575
|
// src/models/APIError.ts
|
|
5576
5576
|
var APIError = class _APIError extends Error {
|
|
@@ -5943,14 +5943,11 @@ import { differenceInDays, formatISO as formatISO2 } from "date-fns";
|
|
|
5943
5943
|
import { ZonedDateTime } from "@internationalized/date";
|
|
5944
5944
|
var toLocalDateString = (date) => formatISO2(date.valueOf(), { representation: "date" });
|
|
5945
5945
|
function getDueDifference(dueDate) {
|
|
5946
|
-
const
|
|
5947
|
-
|
|
5946
|
+
const today3 = /* @__PURE__ */ new Date();
|
|
5947
|
+
today3.setHours(0, 0, 0, 0);
|
|
5948
5948
|
const normalizedDue = new Date(dueDate);
|
|
5949
5949
|
normalizedDue.setHours(0, 0, 0, 0);
|
|
5950
|
-
return differenceInDays(normalizedDue,
|
|
5951
|
-
}
|
|
5952
|
-
function isZonedDateTime(val) {
|
|
5953
|
-
return val instanceof ZonedDateTime;
|
|
5950
|
+
return differenceInDays(normalizedDue, today3);
|
|
5954
5951
|
}
|
|
5955
5952
|
|
|
5956
5953
|
// src/api/layer/profit_and_loss.ts
|
|
@@ -13404,30 +13401,32 @@ var Spacer = () => /* @__PURE__ */ jsx68("div", { className: "Layer__Spacer" });
|
|
|
13404
13401
|
|
|
13405
13402
|
// src/components/BaseConfirmationModal/BaseConfirmationModal.tsx
|
|
13406
13403
|
import { useCallback as useCallback10, useState as useState13 } from "react";
|
|
13407
|
-
import { jsx as jsx69, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
13404
|
+
import { Fragment as Fragment6, jsx as jsx69, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
13408
13405
|
function BaseConfirmationModal({
|
|
13409
13406
|
isOpen,
|
|
13410
13407
|
onOpenChange,
|
|
13411
13408
|
title,
|
|
13412
13409
|
description,
|
|
13410
|
+
content,
|
|
13413
13411
|
onConfirm,
|
|
13414
13412
|
confirmLabel = "Confirm",
|
|
13415
13413
|
retryLabel = "Retry",
|
|
13416
13414
|
cancelLabel = "Cancel",
|
|
13417
|
-
errorText
|
|
13415
|
+
errorText,
|
|
13416
|
+
closeOnConfirm = true
|
|
13418
13417
|
}) {
|
|
13419
13418
|
const [isProcessing, setIsProcessing] = useState13(false);
|
|
13420
13419
|
const [error, setError] = useState13(null);
|
|
13421
13420
|
const onClickConfirm = useCallback10((close2) => {
|
|
13422
13421
|
setIsProcessing(true);
|
|
13423
13422
|
void Promise.resolve(onConfirm()).then(() => {
|
|
13424
|
-
close2();
|
|
13423
|
+
if (closeOnConfirm) close2();
|
|
13425
13424
|
}).catch((e) => {
|
|
13426
13425
|
setError(e);
|
|
13427
13426
|
}).finally(() => {
|
|
13428
13427
|
setIsProcessing(false);
|
|
13429
13428
|
});
|
|
13430
|
-
}, [onConfirm]);
|
|
13429
|
+
}, [closeOnConfirm, onConfirm]);
|
|
13431
13430
|
const getErrorMessage = (error2, errorText2) => {
|
|
13432
13431
|
var _a;
|
|
13433
13432
|
if (error2 === null) return null;
|
|
@@ -13436,32 +13435,31 @@ function BaseConfirmationModal({
|
|
|
13436
13435
|
};
|
|
13437
13436
|
return /* @__PURE__ */ jsx69(Modal, { flexBlock: true, isOpen, onOpenChange, role: "alertdialog", children: ({ close: close2 }) => {
|
|
13438
13437
|
var _a;
|
|
13439
|
-
return /* @__PURE__ */ jsxs35(
|
|
13440
|
-
/* @__PURE__ */ jsx69(
|
|
13438
|
+
return /* @__PURE__ */ jsxs35(Fragment6, { children: [
|
|
13439
|
+
/* @__PURE__ */ jsx69(VStack, { pbe: "2xs", children: /* @__PURE__ */ jsx69(
|
|
13441
13440
|
ModalTitleWithClose,
|
|
13442
13441
|
{
|
|
13443
13442
|
heading: /* @__PURE__ */ jsx69(ModalHeading, { size: "lg", children: title }),
|
|
13444
13443
|
onClose: close2
|
|
13445
13444
|
}
|
|
13446
|
-
),
|
|
13447
|
-
/* @__PURE__ */
|
|
13448
|
-
|
|
13449
|
-
|
|
13450
|
-
|
|
13451
|
-
|
|
13452
|
-
|
|
13453
|
-
|
|
13454
|
-
|
|
13455
|
-
|
|
13456
|
-
|
|
13457
|
-
|
|
13458
|
-
|
|
13459
|
-
|
|
13460
|
-
|
|
13461
|
-
|
|
13462
|
-
|
|
13463
|
-
|
|
13464
|
-
] })
|
|
13445
|
+
) }),
|
|
13446
|
+
description && /* @__PURE__ */ jsx69(ModalDescription, { children: description }),
|
|
13447
|
+
content && /* @__PURE__ */ jsx69(ModalContent, { children: content }),
|
|
13448
|
+
/* @__PURE__ */ jsx69(ModalActions, { children: /* @__PURE__ */ jsxs35(HStack, { gap: "md", children: [
|
|
13449
|
+
/* @__PURE__ */ jsx69(Spacer, {}),
|
|
13450
|
+
/* @__PURE__ */ jsx69(Button, { variant: "secondary" /* secondary */, onClick: close2, children: cancelLabel }),
|
|
13451
|
+
/* @__PURE__ */ jsx69(
|
|
13452
|
+
SubmitButton,
|
|
13453
|
+
{
|
|
13454
|
+
onClick: () => onClickConfirm(close2),
|
|
13455
|
+
processing: isProcessing,
|
|
13456
|
+
error: (_a = getErrorMessage(error, errorText)) != null ? _a : "",
|
|
13457
|
+
withRetry: true,
|
|
13458
|
+
noIcon: !isProcessing,
|
|
13459
|
+
children: error ? retryLabel : confirmLabel
|
|
13460
|
+
}
|
|
13461
|
+
)
|
|
13462
|
+
] }) })
|
|
13465
13463
|
] });
|
|
13466
13464
|
} });
|
|
13467
13465
|
}
|
|
@@ -13692,7 +13690,7 @@ import { Check } from "lucide-react";
|
|
|
13692
13690
|
import { useMemo as useMemo13 } from "react";
|
|
13693
13691
|
import { Checkbox as ReactAriaCheckbox } from "react-aria-components";
|
|
13694
13692
|
import classNames24 from "classnames";
|
|
13695
|
-
import { Fragment as
|
|
13693
|
+
import { Fragment as Fragment7, jsx as jsx73, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
13696
13694
|
var CLASS_NAME3 = "Layer__Checkbox";
|
|
13697
13695
|
function Checkbox(_a) {
|
|
13698
13696
|
var _b = _a, { children, className, variant = "default", size = "md" } = _b, props = __objRest(_b, ["children", "className", "variant", "size"]);
|
|
@@ -13705,7 +13703,7 @@ function Checkbox(_a) {
|
|
|
13705
13703
|
ReactAriaCheckbox,
|
|
13706
13704
|
__spreadProps(__spreadValues(__spreadValues({}, dataProperties), props), {
|
|
13707
13705
|
className: classNames24(CLASS_NAME3, className),
|
|
13708
|
-
children: withRenderProp(children, (node) => /* @__PURE__ */ jsxs37(
|
|
13706
|
+
children: withRenderProp(children, (node) => /* @__PURE__ */ jsxs37(Fragment7, { children: [
|
|
13709
13707
|
/* @__PURE__ */ jsx73("div", { slot: "checkbox", children: /* @__PURE__ */ jsx73(Check, { size: size === "lg" ? 16 : 12 }) }),
|
|
13710
13708
|
node
|
|
13711
13709
|
] }))
|
|
@@ -13857,7 +13855,7 @@ function useConfirmAndExcludeMultiple({ onSuccess }) {
|
|
|
13857
13855
|
}
|
|
13858
13856
|
|
|
13859
13857
|
// src/components/LinkedAccounts/ConfirmationModal/LinkedAccountsConfirmationModal.tsx
|
|
13860
|
-
import { Fragment as
|
|
13858
|
+
import { Fragment as Fragment8, jsx as jsx76, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
13861
13859
|
function getButtonLabel({ totalCount, confirmedCount }) {
|
|
13862
13860
|
if (confirmedCount === totalCount) {
|
|
13863
13861
|
return totalCount > 1 ? "Confirm All Accounts" : "Confirm Account";
|
|
@@ -13941,7 +13939,7 @@ function LinkedAccountsConfirmationModalContent({ onClose }) {
|
|
|
13941
13939
|
}
|
|
13942
13940
|
});
|
|
13943
13941
|
const { descriptionLabel, buttonLabel } = getFormComponentLabels(formState);
|
|
13944
|
-
return /* @__PURE__ */ jsxs40(
|
|
13942
|
+
return /* @__PURE__ */ jsxs40(Fragment8, { children: [
|
|
13945
13943
|
/* @__PURE__ */ jsx76(
|
|
13946
13944
|
ModalTitleWithClose,
|
|
13947
13945
|
{
|
|
@@ -13972,7 +13970,7 @@ function LinkedAccountsConfirmationModalContent({ onClose }) {
|
|
|
13972
13970
|
}
|
|
13973
13971
|
}
|
|
13974
13972
|
) }),
|
|
13975
|
-
/* @__PURE__ */ jsx76(ModalActions, { children: /* @__PURE__ */ jsx76(VStack, { gap: "md", children: hasError ? /* @__PURE__ */ jsxs40(
|
|
13973
|
+
/* @__PURE__ */ jsx76(ModalActions, { children: /* @__PURE__ */ jsx76(VStack, { gap: "md", children: hasError ? /* @__PURE__ */ jsxs40(Fragment8, { children: [
|
|
13976
13974
|
/* @__PURE__ */ jsx76(P, { size: "sm", children: "An error occurred while confirming accounts. You will have an opportunity to try again later." }),
|
|
13977
13975
|
/* @__PURE__ */ jsx76(P, { size: "sm", children: "No data will be synced until you confirm." }),
|
|
13978
13976
|
/* @__PURE__ */ jsx76(Button2, { onPress: close, children: "Close" })
|
|
@@ -13998,7 +13996,7 @@ function LinkedAccountsConfirmationModal() {
|
|
|
13998
13996
|
}
|
|
13999
13997
|
|
|
14000
13998
|
// src/components/LinkedAccounts/LinkedAccountsContent.tsx
|
|
14001
|
-
import { Fragment as
|
|
13999
|
+
import { Fragment as Fragment9, jsx as jsx77, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
14002
14000
|
var LinkedAccountsContent = ({
|
|
14003
14001
|
asWidget,
|
|
14004
14002
|
showLedgerBalance,
|
|
@@ -14013,7 +14011,7 @@ var LinkedAccountsContent = ({
|
|
|
14013
14011
|
showUnlinkItem && "--show-unlink-item",
|
|
14014
14012
|
showBreakConnection && "--show-break-connection"
|
|
14015
14013
|
);
|
|
14016
|
-
return /* @__PURE__ */ jsxs41(
|
|
14014
|
+
return /* @__PURE__ */ jsxs41(Fragment9, { children: [
|
|
14017
14015
|
/* @__PURE__ */ jsxs41("div", { className: "Layer__linked-accounts__list", children: [
|
|
14018
14016
|
data == null ? void 0 : data.map((account, index) => /* @__PURE__ */ jsx77(
|
|
14019
14017
|
LinkedAccountItemThumb,
|
|
@@ -14201,7 +14199,7 @@ var UploadCloud2 = (_a) => {
|
|
|
14201
14199
|
var UploadCloud_default = UploadCloud2;
|
|
14202
14200
|
|
|
14203
14201
|
// src/components/Input/FileInput.tsx
|
|
14204
|
-
import { Fragment as
|
|
14202
|
+
import { Fragment as Fragment10, jsx as jsx81, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
14205
14203
|
var FileInput = ({
|
|
14206
14204
|
text = "Upload",
|
|
14207
14205
|
onUpload,
|
|
@@ -14224,7 +14222,7 @@ var FileInput = ({
|
|
|
14224
14222
|
}
|
|
14225
14223
|
};
|
|
14226
14224
|
if (secondary) {
|
|
14227
|
-
return /* @__PURE__ */ jsxs45(
|
|
14225
|
+
return /* @__PURE__ */ jsxs45(Fragment10, { children: [
|
|
14228
14226
|
/* @__PURE__ */ jsx81(TextButton, { onClick, disabled, children: text }),
|
|
14229
14227
|
/* @__PURE__ */ jsx81(
|
|
14230
14228
|
"input",
|
|
@@ -14238,7 +14236,7 @@ var FileInput = ({
|
|
|
14238
14236
|
)
|
|
14239
14237
|
] });
|
|
14240
14238
|
}
|
|
14241
|
-
return /* @__PURE__ */ jsxs45(
|
|
14239
|
+
return /* @__PURE__ */ jsxs45(Fragment10, { children: [
|
|
14242
14240
|
/* @__PURE__ */ jsx81(
|
|
14243
14241
|
Button,
|
|
14244
14242
|
{
|
|
@@ -14554,7 +14552,7 @@ import {
|
|
|
14554
14552
|
subQuarters,
|
|
14555
14553
|
subYears
|
|
14556
14554
|
} from "date-fns";
|
|
14557
|
-
import { Fragment as
|
|
14555
|
+
import { Fragment as Fragment11, jsx as jsx88 } from "react/jsx-runtime";
|
|
14558
14556
|
var DatePickerOptions = ({
|
|
14559
14557
|
customDateRanges = [
|
|
14560
14558
|
{
|
|
@@ -14605,7 +14603,7 @@ var DatePickerOptions = ({
|
|
|
14605
14603
|
);
|
|
14606
14604
|
optionsComponents.push(...customOptionComponents);
|
|
14607
14605
|
if (optionsComponents.length === 0) {
|
|
14608
|
-
return /* @__PURE__ */ jsx88(
|
|
14606
|
+
return /* @__PURE__ */ jsx88(Fragment11, {});
|
|
14609
14607
|
}
|
|
14610
14608
|
return /* @__PURE__ */ jsx88("div", { className: "Layer__datepicker__popper__custom-footer", children: optionsComponents });
|
|
14611
14609
|
};
|
|
@@ -14613,7 +14611,7 @@ var DatePickerOptions = ({
|
|
|
14613
14611
|
// src/components/DatePicker/DatePicker.tsx
|
|
14614
14612
|
import classNames32 from "classnames";
|
|
14615
14613
|
import { endOfDay as endOfDay2, endOfMonth as endOfMonth4, endOfYear as endOfYear3, getYear } from "date-fns";
|
|
14616
|
-
import { Fragment as
|
|
14614
|
+
import { Fragment as Fragment12, jsx as jsx89, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
14617
14615
|
var ReactDatePicker = RDP.default.default || RDP.default || RDP;
|
|
14618
14616
|
var isRangeMode = (displayMode) => displayMode === "dayRangePicker" || displayMode === "monthRangePicker";
|
|
14619
14617
|
var showNavigationArrows = (navigateArrows, isDesktop) => {
|
|
@@ -14915,7 +14913,7 @@ var DatePicker = (_a) => {
|
|
|
14915
14913
|
]
|
|
14916
14914
|
})
|
|
14917
14915
|
),
|
|
14918
|
-
showNavigationArrows(navigateArrows, isDesktop) && /* @__PURE__ */ jsxs51(
|
|
14916
|
+
showNavigationArrows(navigateArrows, isDesktop) && /* @__PURE__ */ jsxs51(Fragment12, { children: [
|
|
14919
14917
|
/* @__PURE__ */ jsxs51(
|
|
14920
14918
|
Button,
|
|
14921
14919
|
{
|
|
@@ -16457,7 +16455,7 @@ var convertMatchDetailsToLinkingMetadata = (matchDetails) => {
|
|
|
16457
16455
|
|
|
16458
16456
|
// src/components/CategorySelect/CategorySelect.tsx
|
|
16459
16457
|
import { useCallback as useCallback14, useState as useState21 } from "react";
|
|
16460
|
-
import { Fragment as
|
|
16458
|
+
import { Fragment as Fragment13, jsx as jsx105, jsxs as jsxs64 } from "react/jsx-runtime";
|
|
16461
16459
|
var mapCategoryToOption2 = (category) => {
|
|
16462
16460
|
var _a, _b;
|
|
16463
16461
|
return {
|
|
@@ -16655,7 +16653,7 @@ var CategorySelect = ({
|
|
|
16655
16653
|
const selected = value ? value : !excludeMatches && (matchOptions == null ? void 0 : matchOptions.length) === 1 && matchOptions[0].options.length === 1 ? matchOptions[0].options[0] : void 0;
|
|
16656
16654
|
const placeholder = (matchOptions == null ? void 0 : matchOptions.length) === 1 && matchOptions[0].options.length > 1 ? `${matchOptions[0].options.length} possible matches...` : "Categorize or match...";
|
|
16657
16655
|
if (asDrawer) {
|
|
16658
|
-
return /* @__PURE__ */ jsxs64(
|
|
16656
|
+
return /* @__PURE__ */ jsxs64(Fragment13, { children: [
|
|
16659
16657
|
/* @__PURE__ */ jsxs64(
|
|
16660
16658
|
"button",
|
|
16661
16659
|
{
|
|
@@ -18562,6 +18560,7 @@ function ComboBox(_a) {
|
|
|
18562
18560
|
options: options3 != null ? options3 : groups,
|
|
18563
18561
|
onInputChange: onInputValueChange,
|
|
18564
18562
|
escapeClearsValue: true,
|
|
18563
|
+
menuPortalTarget: document.body,
|
|
18565
18564
|
placeholder,
|
|
18566
18565
|
unstyled: true,
|
|
18567
18566
|
className,
|
|
@@ -18583,6 +18582,10 @@ function ComboBox(_a) {
|
|
|
18583
18582
|
menuList: () => COMBO_BOX_CLASS_NAMES.MENU_LIST,
|
|
18584
18583
|
group: () => COMBO_BOX_CLASS_NAMES.GROUP
|
|
18585
18584
|
},
|
|
18585
|
+
styles: {
|
|
18586
|
+
// Ensure the menu portal appears stacked above modals
|
|
18587
|
+
menuPortal: (base) => __spreadProps(__spreadValues({}, base), { zIndex: 101 })
|
|
18588
|
+
},
|
|
18586
18589
|
components: {
|
|
18587
18590
|
GroupHeading: CustomGroupHeadingRef.current,
|
|
18588
18591
|
Option: CustomComboBoxOption,
|
|
@@ -19793,7 +19796,7 @@ function BankTransactionFormFields({
|
|
|
19793
19796
|
}
|
|
19794
19797
|
|
|
19795
19798
|
// src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
|
|
19796
|
-
import { Fragment as
|
|
19799
|
+
import { Fragment as Fragment14, jsx as jsx130, jsxs as jsxs80 } from "react/jsx-runtime";
|
|
19797
19800
|
var isAlreadyMatched2 = (bankTransaction) => {
|
|
19798
19801
|
var _a;
|
|
19799
19802
|
if (bankTransaction == null ? void 0 : bankTransaction.match) {
|
|
@@ -20020,7 +20023,7 @@ var ExpandedBankTransactionRow = forwardRef15(
|
|
|
20020
20023
|
selected: purpose,
|
|
20021
20024
|
onChange: onChangePurpose
|
|
20022
20025
|
}
|
|
20023
|
-
) }) : /* @__PURE__ */ jsx130(
|
|
20026
|
+
) }) : /* @__PURE__ */ jsx130(Fragment14, {}),
|
|
20024
20027
|
/* @__PURE__ */ jsxs80(
|
|
20025
20028
|
"div",
|
|
20026
20029
|
{
|
|
@@ -20145,7 +20148,7 @@ var ExpandedBankTransactionRow = forwardRef15(
|
|
|
20145
20148
|
variant: "secondary" /* secondary */,
|
|
20146
20149
|
children: "Split"
|
|
20147
20150
|
}
|
|
20148
|
-
) }) : /* @__PURE__ */ jsx130(
|
|
20151
|
+
) }) : /* @__PURE__ */ jsx130(Fragment14, {})
|
|
20149
20152
|
] })
|
|
20150
20153
|
] })
|
|
20151
20154
|
}
|
|
@@ -20510,7 +20513,7 @@ function useDelayedVisibility({
|
|
|
20510
20513
|
}
|
|
20511
20514
|
|
|
20512
20515
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
20513
|
-
import { Fragment as
|
|
20516
|
+
import { Fragment as Fragment15, jsx as jsx137, jsxs as jsxs85 } from "react/jsx-runtime";
|
|
20514
20517
|
var extractDescriptionForSplit = (category) => {
|
|
20515
20518
|
if (!category || !category.entries) {
|
|
20516
20519
|
return "";
|
|
@@ -20623,7 +20626,7 @@ var BankTransactionRow = ({
|
|
|
20623
20626
|
() => toDataProperties({ "show-receipt-upload-column": showReceiptUploadColumn }),
|
|
20624
20627
|
[showReceiptUploadColumn]
|
|
20625
20628
|
);
|
|
20626
|
-
return /* @__PURE__ */ jsxs85(
|
|
20629
|
+
return /* @__PURE__ */ jsxs85(Fragment15, { children: [
|
|
20627
20630
|
/* @__PURE__ */ jsxs85("tr", { className: rowClassName, children: [
|
|
20628
20631
|
/* @__PURE__ */ jsx137(
|
|
20629
20632
|
"td",
|
|
@@ -20716,7 +20719,7 @@ var BankTransactionRow = ({
|
|
|
20716
20719
|
}
|
|
20717
20720
|
) : null,
|
|
20718
20721
|
categorized && !open2 ? /* @__PURE__ */ jsxs85(Text, { as: "span", className: `${className}__category-text`, children: [
|
|
20719
|
-
bankTransaction.categorization_status === "SPLIT" /* SPLIT */ && /* @__PURE__ */ jsxs85(
|
|
20722
|
+
bankTransaction.categorization_status === "SPLIT" /* SPLIT */ && /* @__PURE__ */ jsxs85(Fragment15, { children: [
|
|
20720
20723
|
/* @__PURE__ */ jsx137(
|
|
20721
20724
|
Badge,
|
|
20722
20725
|
{
|
|
@@ -20733,7 +20736,7 @@ var BankTransactionRow = ({
|
|
|
20733
20736
|
),
|
|
20734
20737
|
/* @__PURE__ */ jsx137("span", { className: `${className}__category-text__text`, children: extractDescriptionForSplit(bankTransaction.category) })
|
|
20735
20738
|
] }),
|
|
20736
|
-
(bankTransaction == null ? void 0 : bankTransaction.categorization_status) === "MATCHED" /* MATCHED */ && (bankTransaction == null ? void 0 : bankTransaction.match) && /* @__PURE__ */ jsxs85(
|
|
20739
|
+
(bankTransaction == null ? void 0 : bankTransaction.categorization_status) === "MATCHED" /* MATCHED */ && (bankTransaction == null ? void 0 : bankTransaction.match) && /* @__PURE__ */ jsxs85(Fragment15, { children: [
|
|
20737
20740
|
/* @__PURE__ */ jsx137(
|
|
20738
20741
|
MatchBadge,
|
|
20739
20742
|
{
|
|
@@ -20830,11 +20833,11 @@ var BankTransactionRow = ({
|
|
|
20830
20833
|
|
|
20831
20834
|
// src/components/BankTransactionList/Assignment.tsx
|
|
20832
20835
|
import { parseISO as parseISO10, format as formatTime7 } from "date-fns";
|
|
20833
|
-
import { Fragment as
|
|
20836
|
+
import { Fragment as Fragment16, jsx as jsx138, jsxs as jsxs86 } from "react/jsx-runtime";
|
|
20834
20837
|
var Assignment = ({ bankTransaction }) => {
|
|
20835
20838
|
var _a, _b, _c, _d;
|
|
20836
20839
|
if (bankTransaction.match && bankTransaction.categorization_status === "MATCHED" /* MATCHED */) {
|
|
20837
|
-
return /* @__PURE__ */ jsxs86(
|
|
20840
|
+
return /* @__PURE__ */ jsxs86(Fragment16, { children: [
|
|
20838
20841
|
/* @__PURE__ */ jsx138(
|
|
20839
20842
|
MatchBadge,
|
|
20840
20843
|
{
|
|
@@ -20851,7 +20854,7 @@ var Assignment = ({ bankTransaction }) => {
|
|
|
20851
20854
|
] });
|
|
20852
20855
|
}
|
|
20853
20856
|
if (bankTransaction.categorization_status === "SPLIT" /* SPLIT */) {
|
|
20854
|
-
return /* @__PURE__ */ jsxs86(
|
|
20857
|
+
return /* @__PURE__ */ jsxs86(Fragment16, { children: [
|
|
20855
20858
|
/* @__PURE__ */ jsx138(
|
|
20856
20859
|
Badge,
|
|
20857
20860
|
{
|
|
@@ -21114,7 +21117,7 @@ var Paperclip_default = Paperclip;
|
|
|
21114
21117
|
|
|
21115
21118
|
// src/components/BankTransactionMobileList/BusinessForm.tsx
|
|
21116
21119
|
import classNames44 from "classnames";
|
|
21117
|
-
import { Fragment as
|
|
21120
|
+
import { Fragment as Fragment17, jsx as jsx142, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
21118
21121
|
var BusinessForm = ({
|
|
21119
21122
|
bankTransaction,
|
|
21120
21123
|
showCategorization,
|
|
@@ -21188,7 +21191,7 @@ var BusinessForm = ({
|
|
|
21188
21191
|
true
|
|
21189
21192
|
);
|
|
21190
21193
|
};
|
|
21191
|
-
return /* @__PURE__ */ jsxs88(
|
|
21194
|
+
return /* @__PURE__ */ jsxs88(Fragment17, { children: [
|
|
21192
21195
|
/* @__PURE__ */ jsxs88("div", { className: "Layer__bank-transaction-mobile-list-item__business-form", children: [
|
|
21193
21196
|
showCategorization ? /* @__PURE__ */ jsx142(
|
|
21194
21197
|
ActionableList,
|
|
@@ -21493,7 +21496,7 @@ var MatchForm2 = ({
|
|
|
21493
21496
|
// src/components/BankTransactionMobileList/SplitForm.tsx
|
|
21494
21497
|
import { useEffect as useEffect18, useRef as useRef18, useState as useState34 } from "react";
|
|
21495
21498
|
import classNames47 from "classnames";
|
|
21496
|
-
import { Fragment as
|
|
21499
|
+
import { Fragment as Fragment18, jsx as jsx145, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
21497
21500
|
var SplitForm = ({
|
|
21498
21501
|
bankTransaction,
|
|
21499
21502
|
showTooltips,
|
|
@@ -21634,7 +21637,7 @@ var SplitForm = ({
|
|
|
21634
21637
|
);
|
|
21635
21638
|
});
|
|
21636
21639
|
return /* @__PURE__ */ jsxs91("div", { children: [
|
|
21637
|
-
showCategorization ? /* @__PURE__ */ jsxs91(
|
|
21640
|
+
showCategorization ? /* @__PURE__ */ jsxs91(Fragment18, { children: [
|
|
21638
21641
|
/* @__PURE__ */ jsx145(Text, { weight: "bold" /* bold */, size: "sm" /* sm */, children: "Split transaction" }),
|
|
21639
21642
|
/* @__PURE__ */ jsxs91("div", { className: "Layer__bank-transactions__table-cell__header", children: [
|
|
21640
21643
|
/* @__PURE__ */ jsx145(Text, { size: "sm" /* sm */, children: "Category" }),
|
|
@@ -22635,18 +22638,39 @@ var InvisibleDownload_default = InvisibleDownload;
|
|
|
22635
22638
|
import { useState as useState45 } from "react";
|
|
22636
22639
|
|
|
22637
22640
|
// src/components/ui/DropdownMenu/DropdownMenu.tsx
|
|
22638
|
-
import {
|
|
22641
|
+
import { createContext as createContext15, useContext as useContext21 } from "react";
|
|
22642
|
+
import { Menu as AriaMenu, MenuItem as AriaMenuItem, MenuTrigger as MenuTrigger2, Popover as Popover2, Dialog as Dialog2 } from "react-aria-components";
|
|
22639
22643
|
import { jsx as jsx160, jsxs as jsxs98 } from "react/jsx-runtime";
|
|
22640
|
-
var
|
|
22641
|
-
var
|
|
22642
|
-
var
|
|
22643
|
-
var
|
|
22644
|
+
var DropdownMenuContext = createContext15({});
|
|
22645
|
+
var useDropdownMenu = () => useContext21(DropdownMenuContext);
|
|
22646
|
+
var DropdownMenuProvider = DropdownMenuContext.Provider;
|
|
22647
|
+
var MenuItem3 = ({ children, onClick, isDisabled }) => {
|
|
22648
|
+
const { variant } = useDropdownMenu();
|
|
22649
|
+
const dataProps = toDataProperties({ variant });
|
|
22650
|
+
return /* @__PURE__ */ jsx160(
|
|
22651
|
+
AriaMenuItem,
|
|
22652
|
+
__spreadProps(__spreadValues({
|
|
22653
|
+
onAction: onClick,
|
|
22654
|
+
isDisabled,
|
|
22655
|
+
className: "Layer__UI__DropdownMenu__MenuItem"
|
|
22656
|
+
}, dataProps), {
|
|
22657
|
+
children
|
|
22658
|
+
})
|
|
22659
|
+
);
|
|
22660
|
+
};
|
|
22661
|
+
var MenuList = ({ children }) => {
|
|
22662
|
+
const { variant } = useDropdownMenu();
|
|
22663
|
+
const dataProps = toDataProperties({ variant });
|
|
22664
|
+
return /* @__PURE__ */ jsx160(AriaMenu, __spreadProps(__spreadValues({ className: "Layer__UI__DropdownMenu__Menu" }, dataProps), { children }));
|
|
22665
|
+
};
|
|
22666
|
+
var DropdownMenu = ({ children, ariaLabel, variant, slots, slotProps }) => {
|
|
22644
22667
|
var _a;
|
|
22645
22668
|
const { Trigger } = slots;
|
|
22646
22669
|
const width = (_a = slotProps == null ? void 0 : slotProps.Dialog) == null ? void 0 : _a.width;
|
|
22670
|
+
const dataProps = toDataProperties({ variant });
|
|
22647
22671
|
return /* @__PURE__ */ jsxs98(MenuTrigger2, { children: [
|
|
22648
22672
|
/* @__PURE__ */ jsx160(Trigger, { "aria-label": "Menu" }),
|
|
22649
|
-
/* @__PURE__ */ jsx160(Popover2, { placement: "bottom right", className: "
|
|
22673
|
+
/* @__PURE__ */ jsx160(Popover2, { placement: "bottom right", className: "Layer__UI__DropdownMenu__Popover Layer__variables", children: /* @__PURE__ */ jsx160(Dialog2, __spreadProps(__spreadValues({ className: "Layer__UI__DropdownMenu__Dialog", "aria-label": ariaLabel, style: { width } }, dataProps), { children: /* @__PURE__ */ jsx160(DropdownMenuProvider, { value: { variant }, children }) })) })
|
|
22650
22674
|
] });
|
|
22651
22675
|
};
|
|
22652
22676
|
|
|
@@ -22659,9 +22683,9 @@ import { useCallback as useCallback38, useState as useState44 } from "react";
|
|
|
22659
22683
|
// src/components/Wizard/Wizard.tsx
|
|
22660
22684
|
import {
|
|
22661
22685
|
Children,
|
|
22662
|
-
createContext as
|
|
22686
|
+
createContext as createContext16,
|
|
22663
22687
|
useCallback as useCallback26,
|
|
22664
|
-
useContext as
|
|
22688
|
+
useContext as useContext22,
|
|
22665
22689
|
useMemo as useMemo34,
|
|
22666
22690
|
useState as useState38
|
|
22667
22691
|
} from "react";
|
|
@@ -22699,7 +22723,7 @@ function useWizardStep({
|
|
|
22699
22723
|
const currentStep = steps.at(effectiveStepIndex);
|
|
22700
22724
|
return { currentStep, next, previous, goToStep };
|
|
22701
22725
|
}
|
|
22702
|
-
var WizardContext =
|
|
22726
|
+
var WizardContext = createContext16({
|
|
22703
22727
|
next: () => __async(null, null, function* () {
|
|
22704
22728
|
}),
|
|
22705
22729
|
previous: () => {
|
|
@@ -22708,10 +22732,10 @@ var WizardContext = createContext15({
|
|
|
22708
22732
|
}
|
|
22709
22733
|
});
|
|
22710
22734
|
function useWizard() {
|
|
22711
|
-
return
|
|
22735
|
+
return useContext22(WizardContext);
|
|
22712
22736
|
}
|
|
22713
22737
|
function Wizard({
|
|
22714
|
-
Header:
|
|
22738
|
+
Header: Header5,
|
|
22715
22739
|
Footer,
|
|
22716
22740
|
onComplete,
|
|
22717
22741
|
onStepChange,
|
|
@@ -22725,7 +22749,7 @@ function Wizard({
|
|
|
22725
22749
|
});
|
|
22726
22750
|
const contextValue = useMemo34(() => ({ next, previous, goToStep }), [next, previous, goToStep]);
|
|
22727
22751
|
return /* @__PURE__ */ jsxs99(WizardContext.Provider, { value: contextValue, children: [
|
|
22728
|
-
|
|
22752
|
+
Header5,
|
|
22729
22753
|
currentStep,
|
|
22730
22754
|
Footer
|
|
22731
22755
|
] });
|
|
@@ -23301,8 +23325,7 @@ function FormDateField({
|
|
|
23301
23325
|
setLocalDate(value);
|
|
23302
23326
|
}, [value]);
|
|
23303
23327
|
const onBlur = useCallback29(() => {
|
|
23304
|
-
|
|
23305
|
-
handleChange(nextDate);
|
|
23328
|
+
handleChange(localDate);
|
|
23306
23329
|
handleBlur();
|
|
23307
23330
|
}, [handleBlur, handleChange, localDate]);
|
|
23308
23331
|
const errorMessage = errors.length !== 0 ? errors[0] : void 0;
|
|
@@ -23543,7 +23566,7 @@ var useCustomAccountForm = ({ onSuccess }) => {
|
|
|
23543
23566
|
};
|
|
23544
23567
|
|
|
23545
23568
|
// src/components/CustomAccountForm/CustomAccountForm.tsx
|
|
23546
|
-
import { Fragment as
|
|
23569
|
+
import { Fragment as Fragment19, jsx as jsx173, jsxs as jsxs103 } from "react/jsx-runtime";
|
|
23547
23570
|
var accountTypeOptions = [
|
|
23548
23571
|
{ value: "CHECKING" /* CHECKING */, label: "Checking" },
|
|
23549
23572
|
{ value: "SAVINGS" /* SAVINGS */, label: "Savings" },
|
|
@@ -23573,7 +23596,7 @@ var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
|
|
|
23573
23596
|
validators: {
|
|
23574
23597
|
onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Account name is required"
|
|
23575
23598
|
},
|
|
23576
|
-
children: (field) => /* @__PURE__ */ jsx173(
|
|
23599
|
+
children: (field) => /* @__PURE__ */ jsx173(Fragment19, { children: /* @__PURE__ */ jsx173(InputGroup, { name: "account_name", label: "Account name", className: "Layer__custom-account-form__field", children: /* @__PURE__ */ jsx173(
|
|
23577
23600
|
Input,
|
|
23578
23601
|
{
|
|
23579
23602
|
className: "Layer__custom-account-form__input",
|
|
@@ -23594,7 +23617,7 @@ var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
|
|
|
23594
23617
|
validators: {
|
|
23595
23618
|
onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Institution name is required"
|
|
23596
23619
|
},
|
|
23597
|
-
children: (field) => /* @__PURE__ */ jsx173(
|
|
23620
|
+
children: (field) => /* @__PURE__ */ jsx173(Fragment19, { children: /* @__PURE__ */ jsx173(InputGroup, { name: "institution_name", label: "Institution name", className: "Layer__custom-account-form__field", children: /* @__PURE__ */ jsx173(
|
|
23598
23621
|
Input,
|
|
23599
23622
|
{
|
|
23600
23623
|
className: "Layer__custom-account-form__input",
|
|
@@ -23615,7 +23638,7 @@ var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
|
|
|
23615
23638
|
validators: {
|
|
23616
23639
|
onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Account type is required"
|
|
23617
23640
|
},
|
|
23618
|
-
children: (field) => /* @__PURE__ */ jsx173(
|
|
23641
|
+
children: (field) => /* @__PURE__ */ jsx173(Fragment19, { children: /* @__PURE__ */ jsx173(InputGroup, { name: "account_type", label: "Account type", className: "Layer__custom-account-form__field", children: /* @__PURE__ */ jsx173(
|
|
23619
23642
|
Select,
|
|
23620
23643
|
{
|
|
23621
23644
|
className: "Layer__custom-account-form__input",
|
|
@@ -23930,7 +23953,7 @@ var templateExampleTransactions = [
|
|
|
23930
23953
|
];
|
|
23931
23954
|
|
|
23932
23955
|
// src/components/UploadTransactions/UploadTransactionsUploadCsvStep.tsx
|
|
23933
|
-
import { Fragment as
|
|
23956
|
+
import { Fragment as Fragment20, jsx as jsx178, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
23934
23957
|
var formatCreateLabel = (inputValue) => {
|
|
23935
23958
|
return inputValue ? `Create "${inputValue}"` : "Create account";
|
|
23936
23959
|
};
|
|
@@ -24033,7 +24056,7 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
|
|
|
24033
24056
|
onCancel: () => onSelectAccount(null),
|
|
24034
24057
|
onSuccess: onCreateAccountSuccess
|
|
24035
24058
|
}
|
|
24036
|
-
) }) : /* @__PURE__ */ jsxs105(
|
|
24059
|
+
) }) : /* @__PURE__ */ jsxs105(Fragment20, { children: [
|
|
24037
24060
|
/* @__PURE__ */ jsx178(CsvUpload, { file: selectedFile, onFileSelected, replaceDropTarget: true }),
|
|
24038
24061
|
/* @__PURE__ */ jsx178(Separator, {}),
|
|
24039
24062
|
/* @__PURE__ */ jsxs105(VStack, { gap: "xs", className: "Layer__upload-transactions__template-section", children: [
|
|
@@ -24509,9 +24532,9 @@ function UploadTransactions({ onComplete }) {
|
|
|
24509
24532
|
}
|
|
24510
24533
|
|
|
24511
24534
|
// src/components/BankTransactions/BankTransactionsUploadModal/BankTransactionsUploadModal.tsx
|
|
24512
|
-
import { Fragment as
|
|
24535
|
+
import { Fragment as Fragment21, jsx as jsx183, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
24513
24536
|
function BankTransactionsUploadModalContent({ onClose }) {
|
|
24514
|
-
return /* @__PURE__ */ jsxs110(
|
|
24537
|
+
return /* @__PURE__ */ jsxs110(Fragment21, { children: [
|
|
24515
24538
|
/* @__PURE__ */ jsx183(ModalCloseButton, { onClose, positionAbsolute: true }),
|
|
24516
24539
|
/* @__PURE__ */ jsx183(UploadTransactions, { onComplete: onClose })
|
|
24517
24540
|
] });
|
|
@@ -24521,11 +24544,11 @@ function BankTransactionsUploadModal({ isOpen, onOpenChange }) {
|
|
|
24521
24544
|
}
|
|
24522
24545
|
|
|
24523
24546
|
// src/components/BankTransactions/BankTransactionsUploadMenu.tsx
|
|
24524
|
-
import { Fragment as
|
|
24547
|
+
import { Fragment as Fragment22, jsx as jsx184, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
24525
24548
|
var MenuTriggerButton = () => /* @__PURE__ */ jsx184(Button2, { variant: "outlined", icon: true, children: /* @__PURE__ */ jsx184(UploadCloud_default, { size: 12 }) });
|
|
24526
24549
|
var BankTransactionsUploadMenu = () => {
|
|
24527
24550
|
const [isModalOpen, setIsModalOpen] = useState45(false);
|
|
24528
|
-
return /* @__PURE__ */ jsxs111(
|
|
24551
|
+
return /* @__PURE__ */ jsxs111(Fragment22, { children: [
|
|
24529
24552
|
/* @__PURE__ */ jsxs111(
|
|
24530
24553
|
DropdownMenu,
|
|
24531
24554
|
{
|
|
@@ -24535,10 +24558,10 @@ var BankTransactionsUploadMenu = () => {
|
|
|
24535
24558
|
Dialog: { width: "18rem" }
|
|
24536
24559
|
},
|
|
24537
24560
|
children: [
|
|
24538
|
-
/* @__PURE__ */ jsx184(
|
|
24561
|
+
/* @__PURE__ */ jsx184(Heading2, { weight: "bold", size: "2xs", children: "Choose how to upload transactions" }),
|
|
24539
24562
|
/* @__PURE__ */ jsx184(MenuList, { children: /* @__PURE__ */ jsxs111(MenuItem3, { onClick: () => setIsModalOpen(true), children: [
|
|
24540
24563
|
/* @__PURE__ */ jsx184(VStack, { className: "Layer__bank-transactions__header-menu__upload-transactions-icon", children: /* @__PURE__ */ jsx184(UploadCloud_default, { size: 16 }) }),
|
|
24541
|
-
/* @__PURE__ */ jsx184(
|
|
24564
|
+
/* @__PURE__ */ jsx184(Span, { size: "sm", children: "Upload transactions manually" }),
|
|
24542
24565
|
/* @__PURE__ */ jsx184(Spacer, {}),
|
|
24543
24566
|
/* @__PURE__ */ jsx184(ChevronRight2, { size: 12 })
|
|
24544
24567
|
] }, "upload-txns") })
|
|
@@ -24550,7 +24573,7 @@ var BankTransactionsUploadMenu = () => {
|
|
|
24550
24573
|
};
|
|
24551
24574
|
|
|
24552
24575
|
// src/components/BankTransactions/BankTransactionsHeader.tsx
|
|
24553
|
-
import { Fragment as
|
|
24576
|
+
import { Fragment as Fragment23, jsx as jsx185, jsxs as jsxs112 } from "react/jsx-runtime";
|
|
24554
24577
|
function TransactionsSearch({ slot }) {
|
|
24555
24578
|
const { filters, setFilters } = useBankTransactionsContext();
|
|
24556
24579
|
const [localSearch, setLocalSearch] = useState46(() => {
|
|
@@ -24588,7 +24611,7 @@ var DownloadButton2 = ({
|
|
|
24588
24611
|
}
|
|
24589
24612
|
});
|
|
24590
24613
|
};
|
|
24591
|
-
return /* @__PURE__ */ jsxs112(
|
|
24614
|
+
return /* @__PURE__ */ jsxs112(Fragment23, { children: [
|
|
24592
24615
|
/* @__PURE__ */ jsx185(
|
|
24593
24616
|
DownloadButton,
|
|
24594
24617
|
{
|
|
@@ -25043,13 +25066,13 @@ var BankTransactionsContent = ({
|
|
|
25043
25066
|
};
|
|
25044
25067
|
|
|
25045
25068
|
// src/components/Integrations/Integrations.tsx
|
|
25046
|
-
import { useContext as
|
|
25069
|
+
import { useContext as useContext28 } from "react";
|
|
25047
25070
|
|
|
25048
25071
|
// src/components/Integrations/IntegrationsContent.tsx
|
|
25049
|
-
import { useContext as
|
|
25072
|
+
import { useContext as useContext26 } from "react";
|
|
25050
25073
|
|
|
25051
25074
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumb.tsx
|
|
25052
|
-
import { useCallback as useCallback40, useContext as
|
|
25075
|
+
import { useCallback as useCallback40, useContext as useContext25, useMemo as useMemo40, useState as useState48 } from "react";
|
|
25053
25076
|
|
|
25054
25077
|
// src/icons/QuickbooksIcon.tsx
|
|
25055
25078
|
import { jsx as jsx189, jsxs as jsxs115 } from "react/jsx-runtime";
|
|
@@ -25098,8 +25121,8 @@ var Card = ({ children, className }) => {
|
|
|
25098
25121
|
};
|
|
25099
25122
|
|
|
25100
25123
|
// src/contexts/QuickbooksContext/QuickbooksContext.tsx
|
|
25101
|
-
import { createContext as
|
|
25102
|
-
var QuickbooksContext =
|
|
25124
|
+
import { createContext as createContext17 } from "react";
|
|
25125
|
+
var QuickbooksContext = createContext17({
|
|
25103
25126
|
linkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
|
|
25104
25127
|
unlinkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
|
|
25105
25128
|
syncFromQuickbooks: () => {
|
|
@@ -25109,7 +25132,7 @@ var QuickbooksContext = createContext16({
|
|
|
25109
25132
|
});
|
|
25110
25133
|
|
|
25111
25134
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumbFooter.tsx
|
|
25112
|
-
import { useContext as
|
|
25135
|
+
import { useContext as useContext23 } from "react";
|
|
25113
25136
|
import { format, isValid } from "date-fns";
|
|
25114
25137
|
|
|
25115
25138
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/utils.ts
|
|
@@ -25167,7 +25190,7 @@ var getFooterConfig = (quickbooksUiState, lastSyncedAt) => {
|
|
|
25167
25190
|
}
|
|
25168
25191
|
};
|
|
25169
25192
|
var IntegrationsQuickbooksItemThumbFooter = ({ quickbooksUiState }) => {
|
|
25170
|
-
const { quickbooksConnectionStatus } =
|
|
25193
|
+
const { quickbooksConnectionStatus } = useContext23(QuickbooksContext);
|
|
25171
25194
|
if (!quickbooksConnectionStatus) return null;
|
|
25172
25195
|
const { title, description, badgeVariant } = getFooterConfig(quickbooksUiState, quickbooksConnectionStatus.last_synced_at);
|
|
25173
25196
|
return /* @__PURE__ */ jsxs117(HStack, { className: "loadingbar", children: [
|
|
@@ -25184,10 +25207,10 @@ var IntegrationsQuickbooksItemThumbFooter = ({ quickbooksUiState }) => {
|
|
|
25184
25207
|
import { AlertCircle as AlertCircle2, CheckIcon } from "lucide-react";
|
|
25185
25208
|
|
|
25186
25209
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksUnlinkConfirmationModal.tsx
|
|
25187
|
-
import { useContext as
|
|
25210
|
+
import { useContext as useContext24 } from "react";
|
|
25188
25211
|
import { jsx as jsx193 } from "react/jsx-runtime";
|
|
25189
25212
|
function IntegrationsQuickbooksUnlinkConfirmationModal({ isOpen, onOpenChange }) {
|
|
25190
|
-
const { unlinkQuickbooks } =
|
|
25213
|
+
const { unlinkQuickbooks } = useContext24(QuickbooksContext);
|
|
25191
25214
|
return /* @__PURE__ */ jsx193(
|
|
25192
25215
|
BaseConfirmationModal,
|
|
25193
25216
|
{
|
|
@@ -25239,7 +25262,7 @@ var getBadgeConfig = (quickbooksUiState, hasSynced) => {
|
|
|
25239
25262
|
}
|
|
25240
25263
|
};
|
|
25241
25264
|
var IntegrationsQuickbooksItemThumb = () => {
|
|
25242
|
-
const { quickbooksConnectionStatus, syncFromQuickbooks: syncFromQuickbooks2 } =
|
|
25265
|
+
const { quickbooksConnectionStatus, syncFromQuickbooks: syncFromQuickbooks2 } = useContext25(QuickbooksContext);
|
|
25243
25266
|
const [hasSynced, setHasSynced] = useState48(false);
|
|
25244
25267
|
const [isConfirmationModalOpen, setIsConfirmationModalOpen] = useState48(false);
|
|
25245
25268
|
const onSync = useCallback40(() => {
|
|
@@ -25288,7 +25311,7 @@ var IntegrationsQuickbooksItemThumb = () => {
|
|
|
25288
25311
|
// src/components/Integrations/IntegrationsContent.tsx
|
|
25289
25312
|
import { jsx as jsx195 } from "react/jsx-runtime";
|
|
25290
25313
|
var IntegrationsContent = () => {
|
|
25291
|
-
const { quickbooksConnectionStatus } =
|
|
25314
|
+
const { quickbooksConnectionStatus } = useContext26(QuickbooksContext);
|
|
25292
25315
|
return /* @__PURE__ */ jsx195("div", { className: "Layer__linked-accounts__list", children: (quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected) && /* @__PURE__ */ jsx195(IntegrationsQuickbooksItemThumb, {}) });
|
|
25293
25316
|
};
|
|
25294
25317
|
|
|
@@ -25365,7 +25388,7 @@ function QuickbooksContextProvider({ children }) {
|
|
|
25365
25388
|
}
|
|
25366
25389
|
|
|
25367
25390
|
// src/components/Integrations/IntegrationsConnectMenu/IntegrationsConnectMenu.tsx
|
|
25368
|
-
import { useCallback as useCallback42, useContext as
|
|
25391
|
+
import { useCallback as useCallback42, useContext as useContext27, useState as useState50 } from "react";
|
|
25369
25392
|
|
|
25370
25393
|
// src/icons/Cog.tsx
|
|
25371
25394
|
import { useId as useId4 } from "react";
|
|
@@ -25402,7 +25425,7 @@ var MenuTriggerButton2 = () => /* @__PURE__ */ jsxs120(Button2, { variant: "outl
|
|
|
25402
25425
|
] });
|
|
25403
25426
|
var IntegrationsConnectMenu = () => {
|
|
25404
25427
|
const { addToast } = useLayerContext();
|
|
25405
|
-
const { quickbooksConnectionStatus, linkQuickbooks } =
|
|
25428
|
+
const { quickbooksConnectionStatus, linkQuickbooks } = useContext27(QuickbooksContext);
|
|
25406
25429
|
const quickbooksIsConnected = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected;
|
|
25407
25430
|
const [isLinkQuickbooksError, setIsLinkQuickbooksError] = useState50(false);
|
|
25408
25431
|
const initiateQuickbooksOAuth = useCallback42(() => {
|
|
@@ -25420,15 +25443,15 @@ var IntegrationsConnectMenu = () => {
|
|
|
25420
25443
|
slots: { Trigger: MenuTriggerButton2 },
|
|
25421
25444
|
slotProps: { Dialog: { width: 280 } },
|
|
25422
25445
|
children: [
|
|
25423
|
-
/* @__PURE__ */ jsx198(
|
|
25446
|
+
/* @__PURE__ */ jsx198(Heading2, { size: "2xs", weight: "bold", children: "Integrations" }),
|
|
25424
25447
|
/* @__PURE__ */ jsx198(MenuList, { children: quickbooksIsConnected ? /* @__PURE__ */ jsxs120(MenuItem3, { isDisabled: true, children: [
|
|
25425
25448
|
/* @__PURE__ */ jsx198(QuickbooksIcon_default, { size: 20 }),
|
|
25426
|
-
/* @__PURE__ */ jsx198(
|
|
25449
|
+
/* @__PURE__ */ jsx198(Span, { size: "sm", children: "QuickBooks connected" }),
|
|
25427
25450
|
/* @__PURE__ */ jsx198(Spacer, {}),
|
|
25428
25451
|
/* @__PURE__ */ jsx198(Check_default, { size: 16 })
|
|
25429
25452
|
] }, "quickbooks-connected") : /* @__PURE__ */ jsxs120(MenuItem3, { onClick: initiateQuickbooksOAuth, children: [
|
|
25430
25453
|
/* @__PURE__ */ jsx198(QuickbooksIcon_default, { size: 20 }),
|
|
25431
|
-
/* @__PURE__ */ jsx198(
|
|
25454
|
+
/* @__PURE__ */ jsx198(Span, __spreadProps(__spreadValues({}, isLinkQuickbooksError && { status: "error" }), { size: "sm", children: isLinkQuickbooksError ? "Retry Connect QuickBooks" : "Connect QuickBooks" })),
|
|
25432
25455
|
/* @__PURE__ */ jsx198(Spacer, {}),
|
|
25433
25456
|
/* @__PURE__ */ jsx198(Link_default, { size: 12 })
|
|
25434
25457
|
] }, "connect-quickbooks") })
|
|
@@ -25446,7 +25469,7 @@ var Integrations = (props) => {
|
|
|
25446
25469
|
var IntegrationsComponent = ({
|
|
25447
25470
|
stringOverrides
|
|
25448
25471
|
}) => {
|
|
25449
|
-
const { quickbooksConnectionStatus } =
|
|
25472
|
+
const { quickbooksConnectionStatus } = useContext28(QuickbooksContext);
|
|
25450
25473
|
const isLoading = quickbooksConnectionStatus === void 0;
|
|
25451
25474
|
return /* @__PURE__ */ jsxs121(Container, { name: COMPONENT_NAME3, children: [
|
|
25452
25475
|
/* @__PURE__ */ jsxs121(Header, { className: "Layer__linked-accounts__header", children: [
|
|
@@ -25473,11 +25496,11 @@ var IntegrationsComponent = ({
|
|
|
25473
25496
|
};
|
|
25474
25497
|
|
|
25475
25498
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
25476
|
-
import { createContext as
|
|
25499
|
+
import { createContext as createContext22 } from "react";
|
|
25477
25500
|
|
|
25478
25501
|
// src/contexts/ProfitAndLossComparisonContext/ProfitAndLossComparisonContext.tsx
|
|
25479
|
-
import { createContext as
|
|
25480
|
-
var PNLComparisonContext =
|
|
25502
|
+
import { createContext as createContext18 } from "react";
|
|
25503
|
+
var PNLComparisonContext = createContext18({
|
|
25481
25504
|
data: void 0,
|
|
25482
25505
|
isLoading: true,
|
|
25483
25506
|
isValidating: false,
|
|
@@ -25550,7 +25573,7 @@ var applyShare = (items, total) => {
|
|
|
25550
25573
|
};
|
|
25551
25574
|
|
|
25552
25575
|
// src/providers/ReportsModeStoreProvider/ReportsModeStoreProvider.tsx
|
|
25553
|
-
import { useState as useState51, createContext as
|
|
25576
|
+
import { useState as useState51, createContext as createContext19, useContext as useContext29 } from "react";
|
|
25554
25577
|
import { createStore as createStore3, useStore as useStore4 } from "zustand";
|
|
25555
25578
|
import { jsx as jsx200 } from "react/jsx-runtime";
|
|
25556
25579
|
var defaultModeByReport = {
|
|
@@ -25559,7 +25582,7 @@ var defaultModeByReport = {
|
|
|
25559
25582
|
["BalanceSheet" /* BalanceSheet */]: "dayPicker",
|
|
25560
25583
|
["StatementOfCashFlows" /* StatementOfCashFlows */]: "monthPicker"
|
|
25561
25584
|
};
|
|
25562
|
-
var ReportsModeStoreContext =
|
|
25585
|
+
var ReportsModeStoreContext = createContext19(
|
|
25563
25586
|
createStore3(() => ({
|
|
25564
25587
|
resetPnLModeToDefaultOnMount: true,
|
|
25565
25588
|
modeByReport: {},
|
|
@@ -25570,15 +25593,15 @@ var ReportsModeStoreContext = createContext18(
|
|
|
25570
25593
|
}))
|
|
25571
25594
|
);
|
|
25572
25595
|
function useReportModeStore() {
|
|
25573
|
-
const store =
|
|
25596
|
+
const store = useContext29(ReportsModeStoreContext);
|
|
25574
25597
|
return useStore4(store);
|
|
25575
25598
|
}
|
|
25576
25599
|
function useReportMode(report) {
|
|
25577
|
-
const store =
|
|
25600
|
+
const store = useContext29(ReportsModeStoreContext);
|
|
25578
25601
|
return useStore4(store, (state) => state.modeByReport[report]);
|
|
25579
25602
|
}
|
|
25580
25603
|
function useReportModeActions() {
|
|
25581
|
-
const store =
|
|
25604
|
+
const store = useContext29(ReportsModeStoreContext);
|
|
25582
25605
|
const setModeForReport = useStore4(store, (s) => s.actions.setModeForReport);
|
|
25583
25606
|
return { setModeForReport };
|
|
25584
25607
|
}
|
|
@@ -26214,8 +26237,8 @@ var getChartWindow = ({
|
|
|
26214
26237
|
currentYear,
|
|
26215
26238
|
currentMonth
|
|
26216
26239
|
}) => {
|
|
26217
|
-
const
|
|
26218
|
-
const yearAgo = sub2(
|
|
26240
|
+
const today3 = startOfMonth8(Date.now());
|
|
26241
|
+
const yearAgo = sub2(today3, { months: 11 });
|
|
26219
26242
|
const current = startOfMonth8(new Date(currentYear, currentMonth - 1, 1));
|
|
26220
26243
|
if (differenceInMonths(startOfMonth8(chartWindow.start), current) < 0 && differenceInMonths(startOfMonth8(chartWindow.end), current) > 1) {
|
|
26221
26244
|
return chartWindow;
|
|
@@ -26226,13 +26249,13 @@ var getChartWindow = ({
|
|
|
26226
26249
|
end: endOfMonth6(add(current, { months: 11 }))
|
|
26227
26250
|
};
|
|
26228
26251
|
}
|
|
26229
|
-
if (differenceInMonths(endOfMonth6(chartWindow.end), endOfMonth6(current)) === 1 && differenceInMonths(
|
|
26252
|
+
if (differenceInMonths(endOfMonth6(chartWindow.end), endOfMonth6(current)) === 1 && differenceInMonths(today3, current) >= 1) {
|
|
26230
26253
|
return {
|
|
26231
26254
|
start: startOfMonth8(sub2(current, { months: 10 })),
|
|
26232
26255
|
end: endOfMonth6(add(current, { months: 2 }))
|
|
26233
26256
|
};
|
|
26234
26257
|
}
|
|
26235
|
-
if (differenceInMonths(current, startOfMonth8(chartWindow.end)) === 0 && differenceInMonths(current, startOfMonth8(
|
|
26258
|
+
if (differenceInMonths(current, startOfMonth8(chartWindow.end)) === 0 && differenceInMonths(current, startOfMonth8(today3)) > 0) {
|
|
26236
26259
|
return {
|
|
26237
26260
|
start: startOfMonth8(sub2(current, { months: 11 })),
|
|
26238
26261
|
end: endOfMonth6(add(current, { months: 1 }))
|
|
@@ -26241,7 +26264,7 @@ var getChartWindow = ({
|
|
|
26241
26264
|
if (current >= yearAgo) {
|
|
26242
26265
|
return {
|
|
26243
26266
|
start: startOfMonth8(yearAgo),
|
|
26244
|
-
end: endOfMonth6(
|
|
26267
|
+
end: endOfMonth6(today3)
|
|
26245
26268
|
};
|
|
26246
26269
|
}
|
|
26247
26270
|
if (Number(current) > Number(chartWindow.end)) {
|
|
@@ -26382,9 +26405,9 @@ var ProfitAndLossChart = ({
|
|
|
26382
26405
|
var _a;
|
|
26383
26406
|
if (isLoading || !hasNonZeroData) {
|
|
26384
26407
|
const loadingData = [];
|
|
26385
|
-
const
|
|
26408
|
+
const today3 = Date.now();
|
|
26386
26409
|
for (let i = 11; i >= 0; i--) {
|
|
26387
|
-
const currentDate = sub2(
|
|
26410
|
+
const currentDate = sub2(today3, { months: i });
|
|
26388
26411
|
loadingData.push({
|
|
26389
26412
|
name: format3(currentDate, compactView ? "LLLLL" : "LLL"),
|
|
26390
26413
|
revenue: 0,
|
|
@@ -26909,7 +26932,7 @@ var ProfitAndLossChart = ({
|
|
|
26909
26932
|
};
|
|
26910
26933
|
|
|
26911
26934
|
// src/components/ProfitAndLossCompareOptions/ProfitAndLossCompareOptions.tsx
|
|
26912
|
-
import { useContext as
|
|
26935
|
+
import { useContext as useContext30, useMemo as useMemo45 } from "react";
|
|
26913
26936
|
import { jsx as jsx205, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
26914
26937
|
var selectStyles = {
|
|
26915
26938
|
valueContainer: (styles) => {
|
|
@@ -26949,7 +26972,7 @@ var ProfitAndLossCompareOptions = () => {
|
|
|
26949
26972
|
compareOptions,
|
|
26950
26973
|
selectedCompareOptions,
|
|
26951
26974
|
comparisonConfig
|
|
26952
|
-
} =
|
|
26975
|
+
} = useContext30(ProfitAndLoss2.ComparisonContext);
|
|
26953
26976
|
const rangeDisplayMode = useReportModeWithFallback("ProfitAndLoss" /* ProfitAndLoss */, "monthPicker");
|
|
26954
26977
|
const periods = useMemo45(
|
|
26955
26978
|
() => comparePeriods !== 0 ? comparePeriods : 1,
|
|
@@ -27142,7 +27165,7 @@ var ProfitAndLossDatePicker = ({
|
|
|
27142
27165
|
};
|
|
27143
27166
|
|
|
27144
27167
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
27145
|
-
import { useContext as
|
|
27168
|
+
import { useContext as useContext31, useState as useState56 } from "react";
|
|
27146
27169
|
|
|
27147
27170
|
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
27148
27171
|
import { useMemo as useMemo47 } from "react";
|
|
@@ -27805,7 +27828,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
27805
27828
|
sidebarScope,
|
|
27806
27829
|
setSidebarScope,
|
|
27807
27830
|
setFilterTypes
|
|
27808
|
-
} =
|
|
27831
|
+
} = useContext31(ProfitAndLoss2.Context);
|
|
27809
27832
|
const theScope = scope ? scope : sidebarScope;
|
|
27810
27833
|
const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
|
|
27811
27834
|
const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
|
|
@@ -27878,7 +27901,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
27878
27901
|
};
|
|
27879
27902
|
|
|
27880
27903
|
// src/components/ProfitAndLossDownloadButton/ProfitAndLossDownloadButton.tsx
|
|
27881
|
-
import { useContext as
|
|
27904
|
+
import { useContext as useContext32, useState as useState57 } from "react";
|
|
27882
27905
|
import { jsx as jsx213 } from "react/jsx-runtime";
|
|
27883
27906
|
var ProfitAndLossDownloadButton = ({
|
|
27884
27907
|
stringOverrides,
|
|
@@ -27886,8 +27909,8 @@ var ProfitAndLossDownloadButton = ({
|
|
|
27886
27909
|
moneyFormat,
|
|
27887
27910
|
view
|
|
27888
27911
|
}) => {
|
|
27889
|
-
const { dateRange, tagFilter } =
|
|
27890
|
-
const { getProfitAndLossComparisonCsv } =
|
|
27912
|
+
const { dateRange, tagFilter } = useContext32(ProfitAndLoss2.Context);
|
|
27913
|
+
const { getProfitAndLossComparisonCsv } = useContext32(
|
|
27891
27914
|
ProfitAndLoss2.ComparisonContext
|
|
27892
27915
|
);
|
|
27893
27916
|
const { businessId } = useLayerContext();
|
|
@@ -27995,7 +28018,7 @@ var ProfitAndLossHeader = ({
|
|
|
27995
28018
|
};
|
|
27996
28019
|
|
|
27997
28020
|
// src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
|
|
27998
|
-
import { useCallback as useCallback49, useContext as
|
|
28021
|
+
import { useCallback as useCallback49, useContext as useContext36, useMemo as useMemo53, useState as useState60 } from "react";
|
|
27999
28022
|
|
|
28000
28023
|
// src/components/Header/Header.tsx
|
|
28001
28024
|
import {
|
|
@@ -28003,7 +28026,7 @@ import {
|
|
|
28003
28026
|
} from "react";
|
|
28004
28027
|
import classNames66 from "classnames";
|
|
28005
28028
|
import { jsx as jsx216 } from "react/jsx-runtime";
|
|
28006
|
-
var
|
|
28029
|
+
var Header4 = forwardRef22(
|
|
28007
28030
|
({ className, children, style, sticky, asHeader, rounded }, ref) => {
|
|
28008
28031
|
const baseClassName = classNames66(
|
|
28009
28032
|
"Layer__header",
|
|
@@ -28025,7 +28048,7 @@ var Header5 = forwardRef22(
|
|
|
28025
28048
|
);
|
|
28026
28049
|
}
|
|
28027
28050
|
);
|
|
28028
|
-
|
|
28051
|
+
Header4.displayName = "Header";
|
|
28029
28052
|
|
|
28030
28053
|
// src/components/Header/HeaderRow.tsx
|
|
28031
28054
|
import classNames67 from "classnames";
|
|
@@ -28044,7 +28067,7 @@ var HeaderCol = ({ className, children, style, noPadding = false }) => {
|
|
|
28044
28067
|
};
|
|
28045
28068
|
|
|
28046
28069
|
// src/components/ProfitAndLossDetailLinesDownloadButton/ProfitAndLossDetailLinesDownloadButton.tsx
|
|
28047
|
-
import { useContext as
|
|
28070
|
+
import { useContext as useContext33 } from "react";
|
|
28048
28071
|
|
|
28049
28072
|
// src/hooks/useProfitAndLoss/useProfitAndLossDetailLinesExport.ts
|
|
28050
28073
|
import useSWRMutation13 from "swr/mutation";
|
|
@@ -28141,13 +28164,13 @@ function useProfitAndLossDetailLinesExport({
|
|
|
28141
28164
|
}
|
|
28142
28165
|
|
|
28143
28166
|
// src/components/ProfitAndLossDetailLinesDownloadButton/ProfitAndLossDetailLinesDownloadButton.tsx
|
|
28144
|
-
import { Fragment as
|
|
28167
|
+
import { Fragment as Fragment24, jsx as jsx219, jsxs as jsxs132 } from "react/jsx-runtime";
|
|
28145
28168
|
function ProfitAndLossDetailLinesDownloadButton({
|
|
28146
28169
|
pnlStructureLineItemName,
|
|
28147
28170
|
iconOnly
|
|
28148
28171
|
}) {
|
|
28149
28172
|
const { businessId } = useLayerContext();
|
|
28150
|
-
const { tagFilter, dateRange } =
|
|
28173
|
+
const { tagFilter, dateRange } = useContext33(ProfitAndLoss2.Context);
|
|
28151
28174
|
const { invisibleDownloadRef, triggerInvisibleDownload } = useInvisibleDownload();
|
|
28152
28175
|
const { trigger, isMutating, error } = useProfitAndLossDetailLinesExport({
|
|
28153
28176
|
businessId,
|
|
@@ -28161,7 +28184,7 @@ function ProfitAndLossDetailLinesDownloadButton({
|
|
|
28161
28184
|
}
|
|
28162
28185
|
}
|
|
28163
28186
|
});
|
|
28164
|
-
return /* @__PURE__ */ jsxs132(
|
|
28187
|
+
return /* @__PURE__ */ jsxs132(Fragment24, { children: [
|
|
28165
28188
|
/* @__PURE__ */ jsx219(
|
|
28166
28189
|
DownloadButton,
|
|
28167
28190
|
{
|
|
@@ -28289,14 +28312,14 @@ var View = forwardRef23(
|
|
|
28289
28312
|
View.displayName = "View";
|
|
28290
28313
|
|
|
28291
28314
|
// src/components/ProfitAndLossDetailReport/ProfitAndLossDetailReport.tsx
|
|
28292
|
-
import { useContext as
|
|
28315
|
+
import { useContext as useContext35, useState as useState59, useMemo as useMemo52, useCallback as useCallback48 } from "react";
|
|
28293
28316
|
|
|
28294
28317
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
28295
|
-
import { useContext as
|
|
28318
|
+
import { useContext as useContext34, useMemo as useMemo50 } from "react";
|
|
28296
28319
|
|
|
28297
28320
|
// src/contexts/LedgerAccountsContext/LedgerAccountsContext.tsx
|
|
28298
|
-
import { createContext as
|
|
28299
|
-
var LedgerAccountsContext =
|
|
28321
|
+
import { createContext as createContext20 } from "react";
|
|
28322
|
+
var LedgerAccountsContext = createContext20({
|
|
28300
28323
|
data: void 0,
|
|
28301
28324
|
entryData: void 0,
|
|
28302
28325
|
isLoading: false,
|
|
@@ -28480,7 +28503,7 @@ var TableHead = ({ children }) => {
|
|
|
28480
28503
|
|
|
28481
28504
|
// src/components/TableRow/TableRow.tsx
|
|
28482
28505
|
import classNames74 from "classnames";
|
|
28483
|
-
import { Fragment as
|
|
28506
|
+
import { Fragment as Fragment25, jsx as jsx229, jsxs as jsxs140 } from "react/jsx-runtime";
|
|
28484
28507
|
var TableRow = ({
|
|
28485
28508
|
rowKey,
|
|
28486
28509
|
children,
|
|
@@ -28510,7 +28533,7 @@ var TableRow = ({
|
|
|
28510
28533
|
selected && "Layer__table-row--selected",
|
|
28511
28534
|
!isHeadRow && expandable && (isExpanded ? "Layer__table-row--expanded" : "Layer__table-row--collapsed")
|
|
28512
28535
|
]);
|
|
28513
|
-
return /* @__PURE__ */ jsxs140(
|
|
28536
|
+
return /* @__PURE__ */ jsxs140(Fragment25, { children: [
|
|
28514
28537
|
withDivider && withDividerPosition === "top" && /* @__PURE__ */ jsx229("tr", { className: "Layer__table-empty-row", children: /* @__PURE__ */ jsx229("td", { colSpan: Array.isArray(children) ? children.length : 1 }) }),
|
|
28515
28538
|
/* @__PURE__ */ jsx229(
|
|
28516
28539
|
"tr",
|
|
@@ -28547,7 +28570,7 @@ var Table = ({
|
|
|
28547
28570
|
};
|
|
28548
28571
|
|
|
28549
28572
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
28550
|
-
import { Fragment as
|
|
28573
|
+
import { Fragment as Fragment26, jsx as jsx231, jsxs as jsxs141 } from "react/jsx-runtime";
|
|
28551
28574
|
var SourceDetailView = ({
|
|
28552
28575
|
source,
|
|
28553
28576
|
stringOverrides
|
|
@@ -28555,7 +28578,7 @@ var SourceDetailView = ({
|
|
|
28555
28578
|
var _a, _b;
|
|
28556
28579
|
switch (source.type) {
|
|
28557
28580
|
case "Transaction_Ledger_Entry_Source": {
|
|
28558
|
-
return /* @__PURE__ */ jsxs141(
|
|
28581
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28559
28582
|
/* @__PURE__ */ jsx231(
|
|
28560
28583
|
DetailsListItem,
|
|
28561
28584
|
{
|
|
@@ -28582,7 +28605,7 @@ var SourceDetailView = ({
|
|
|
28582
28605
|
] });
|
|
28583
28606
|
}
|
|
28584
28607
|
case "Invoice_Ledger_Entry_Source": {
|
|
28585
|
-
return /* @__PURE__ */ jsxs141(
|
|
28608
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28586
28609
|
/* @__PURE__ */ jsx231(
|
|
28587
28610
|
DetailsListItem,
|
|
28588
28611
|
{
|
|
@@ -28602,7 +28625,7 @@ var SourceDetailView = ({
|
|
|
28602
28625
|
] });
|
|
28603
28626
|
}
|
|
28604
28627
|
case "Manual_Ledger_Entry_Source": {
|
|
28605
|
-
return /* @__PURE__ */ jsxs141(
|
|
28628
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28606
28629
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.memoLabel) || "Memo", children: source.memo }),
|
|
28607
28630
|
/* @__PURE__ */ jsx231(
|
|
28608
28631
|
DetailsListItem,
|
|
@@ -28614,7 +28637,7 @@ var SourceDetailView = ({
|
|
|
28614
28637
|
] });
|
|
28615
28638
|
}
|
|
28616
28639
|
case "Invoice_Payment_Ledger_Entry_Source": {
|
|
28617
|
-
return /* @__PURE__ */ jsxs141(
|
|
28640
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28618
28641
|
/* @__PURE__ */ jsx231(
|
|
28619
28642
|
DetailsListItem,
|
|
28620
28643
|
{
|
|
@@ -28626,7 +28649,7 @@ var SourceDetailView = ({
|
|
|
28626
28649
|
] });
|
|
28627
28650
|
}
|
|
28628
28651
|
case "Refund_Allocation_Ledger_Entry_Source": {
|
|
28629
|
-
return /* @__PURE__ */ jsxs141(
|
|
28652
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28630
28653
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) }),
|
|
28631
28654
|
/* @__PURE__ */ jsx231(
|
|
28632
28655
|
DetailsListItem,
|
|
@@ -28638,7 +28661,7 @@ var SourceDetailView = ({
|
|
|
28638
28661
|
] });
|
|
28639
28662
|
}
|
|
28640
28663
|
case "Refund_Payment_Ledger_Entry_Source": {
|
|
28641
|
-
return /* @__PURE__ */ jsxs141(
|
|
28664
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28642
28665
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.refundedToCustomerAmount) }),
|
|
28643
28666
|
/* @__PURE__ */ jsx231(
|
|
28644
28667
|
DetailsListItem,
|
|
@@ -28659,7 +28682,7 @@ var SourceDetailView = ({
|
|
|
28659
28682
|
);
|
|
28660
28683
|
}
|
|
28661
28684
|
case "Payout_Ledger_Entry_Source": {
|
|
28662
|
-
return /* @__PURE__ */ jsxs141(
|
|
28685
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28663
28686
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.paidOutAmount) }),
|
|
28664
28687
|
/* @__PURE__ */ jsx231(
|
|
28665
28688
|
DetailsListItem,
|
|
@@ -28671,7 +28694,7 @@ var SourceDetailView = ({
|
|
|
28671
28694
|
] });
|
|
28672
28695
|
}
|
|
28673
28696
|
case "Quickbooks_Ledger_Entry_Source": {
|
|
28674
|
-
return /* @__PURE__ */ jsxs141(
|
|
28697
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28675
28698
|
/* @__PURE__ */ jsx231(
|
|
28676
28699
|
DetailsListItem,
|
|
28677
28700
|
{
|
|
@@ -28683,7 +28706,7 @@ var SourceDetailView = ({
|
|
|
28683
28706
|
] });
|
|
28684
28707
|
}
|
|
28685
28708
|
case "Invoice_Write_Off_Ledger_Entry_Source": {
|
|
28686
|
-
return /* @__PURE__ */ jsxs141(
|
|
28709
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28687
28710
|
/* @__PURE__ */ jsx231(
|
|
28688
28711
|
DetailsListItem,
|
|
28689
28712
|
{
|
|
@@ -28703,19 +28726,19 @@ var SourceDetailView = ({
|
|
|
28703
28726
|
] });
|
|
28704
28727
|
}
|
|
28705
28728
|
case "Vendor_Refund_Allocation_Ledger_Entry_Source": {
|
|
28706
|
-
return /* @__PURE__ */ jsxs141(
|
|
28729
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28707
28730
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) }),
|
|
28708
28731
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: "Vendor Description", children: source.vendorDescription })
|
|
28709
28732
|
] });
|
|
28710
28733
|
}
|
|
28711
28734
|
case "Vendor_Refund_Payment_Ledger_Entry_Source": {
|
|
28712
|
-
return /* @__PURE__ */ jsxs141(
|
|
28735
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28713
28736
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: "Refunded Amount", children: convertCentsToCurrency(source.refundedByVendorAmount) }),
|
|
28714
28737
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: "Vendor Description", children: source.vendorDescription })
|
|
28715
28738
|
] });
|
|
28716
28739
|
}
|
|
28717
28740
|
case "Vendor_Payout_Ledger_Entry_Source": {
|
|
28718
|
-
return /* @__PURE__ */ jsxs141(
|
|
28741
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28719
28742
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.paidOutAmount) }),
|
|
28720
28743
|
/* @__PURE__ */ jsx231(
|
|
28721
28744
|
DetailsListItem,
|
|
@@ -28734,7 +28757,7 @@ var SourceDetailView = ({
|
|
|
28734
28757
|
return /* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) });
|
|
28735
28758
|
}
|
|
28736
28759
|
case "Bill_Ledger_Entry_Source": {
|
|
28737
|
-
return /* @__PURE__ */ jsxs141(
|
|
28760
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28738
28761
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: "Bill Number", children: source.billNumber }),
|
|
28739
28762
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: "Vendor Description", children: source.vendorDescription }),
|
|
28740
28763
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.dateLabel) || "Date", children: /* @__PURE__ */ jsx231(DateTime, { value: source.date }) }),
|
|
@@ -28742,21 +28765,21 @@ var SourceDetailView = ({
|
|
|
28742
28765
|
] });
|
|
28743
28766
|
}
|
|
28744
28767
|
case "Bill_Payment_Ledger_Entry_Source": {
|
|
28745
|
-
return /* @__PURE__ */ jsxs141(
|
|
28768
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28746
28769
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: "Bill Number", children: source.billNumber }),
|
|
28747
28770
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) })
|
|
28748
28771
|
] });
|
|
28749
28772
|
}
|
|
28750
28773
|
case "Vendor_Credit_Ledger_Entry_Source": {
|
|
28751
28774
|
const vendorDisplayName = (_a = source.vendor.individualName) != null ? _a : source.vendor.companyName;
|
|
28752
|
-
return /* @__PURE__ */ jsxs141(
|
|
28775
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28753
28776
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) }),
|
|
28754
28777
|
vendorDisplayName && /* @__PURE__ */ jsx231(DetailsListItem, { label: "Vendor", children: vendorDisplayName })
|
|
28755
28778
|
] });
|
|
28756
28779
|
}
|
|
28757
28780
|
case "Customer_Credit_Ledger_Entry_Source": {
|
|
28758
28781
|
const customerDisplayName = (_b = source.customer.individualName) != null ? _b : source.customer.companyName;
|
|
28759
|
-
return /* @__PURE__ */ jsxs141(
|
|
28782
|
+
return /* @__PURE__ */ jsxs141(Fragment26, { children: [
|
|
28760
28783
|
/* @__PURE__ */ jsx231(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: convertCentsToCurrency(source.amount) }),
|
|
28761
28784
|
customerDisplayName && /* @__PURE__ */ jsx231(DetailsListItem, { label: "Customer", children: customerDisplayName })
|
|
28762
28785
|
] });
|
|
@@ -28769,7 +28792,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
28769
28792
|
stringOverrides
|
|
28770
28793
|
}) => {
|
|
28771
28794
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
|
|
28772
|
-
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } =
|
|
28795
|
+
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = useContext34(LedgerAccountsContext);
|
|
28773
28796
|
const { renderInAppLink } = useInAppLinkContext();
|
|
28774
28797
|
const { totalDebit, totalCredit } = useMemo50(() => {
|
|
28775
28798
|
var _a2;
|
|
@@ -28798,7 +28821,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
28798
28821
|
return (_b2 = renderInAppLink(linkingMetadata)) != null ? _b2 : defaultBadge;
|
|
28799
28822
|
}, [renderInAppLink, entryData == null ? void 0 : entryData.entry_type, ledgerEntrySource]);
|
|
28800
28823
|
return /* @__PURE__ */ jsxs141("div", { className: "Layer__ledger-account__entry-details", children: [
|
|
28801
|
-
/* @__PURE__ */ jsx231(
|
|
28824
|
+
/* @__PURE__ */ jsx231(Header4, { className: "Layer__ledger-account__entry-details__header", children: /* @__PURE__ */ jsxs141(HeaderRow, { children: [
|
|
28802
28825
|
/* @__PURE__ */ jsxs141(HeaderCol, { className: "Layer__hidden-lg Layer__hidden-xl", children: [
|
|
28803
28826
|
/* @__PURE__ */ jsx231(BackButton, { onClick: closeSelectedEntry }),
|
|
28804
28827
|
/* @__PURE__ */ jsx231(Heading, { size: "secondary" /* secondary */, children: (stringOverrides == null ? void 0 : stringOverrides.title) || "Transaction details" })
|
|
@@ -29162,11 +29185,11 @@ var VirtualizedDataTable = ({
|
|
|
29162
29185
|
// src/components/BaseDetailView/BaseDetailView.tsx
|
|
29163
29186
|
import { jsx as jsx234, jsxs as jsxs143 } from "react/jsx-runtime";
|
|
29164
29187
|
var BaseDetailView = ({ name, onGoBack, slots, children, borderless = false }) => {
|
|
29165
|
-
const { Header:
|
|
29188
|
+
const { Header: Header5, BackIcon } = slots;
|
|
29166
29189
|
return /* @__PURE__ */ jsxs143(Container, { name, className: "Layer__BaseDetailView", transparentBg: borderless, children: [
|
|
29167
29190
|
/* @__PURE__ */ jsxs143(HStack, { align: "center", gap: "md", className: "Layer__BaseDetailView__Header", children: [
|
|
29168
29191
|
/* @__PURE__ */ jsx234(Button2, { variant: "outlined", icon: true, onPress: onGoBack, children: BackIcon ? /* @__PURE__ */ jsx234(BackIcon, {}) : /* @__PURE__ */ jsx234(BackArrow_default, {}) }),
|
|
29169
|
-
/* @__PURE__ */ jsx234(
|
|
29192
|
+
/* @__PURE__ */ jsx234(Header5, {})
|
|
29170
29193
|
] }),
|
|
29171
29194
|
children
|
|
29172
29195
|
] });
|
|
@@ -29245,7 +29268,7 @@ var ProfitAndLossDetailReport = ({
|
|
|
29245
29268
|
stringOverrides
|
|
29246
29269
|
}) => {
|
|
29247
29270
|
const { businessId } = useLayerContext();
|
|
29248
|
-
const { tagFilter, dateRange } =
|
|
29271
|
+
const { tagFilter, dateRange } = useContext35(ProfitAndLoss2.Context);
|
|
29249
29272
|
const [selectedSource, setSelectedSource] = useState59(null);
|
|
29250
29273
|
const { renderInAppLink } = useInAppLinkContext();
|
|
29251
29274
|
const badgeOrInAppLink = useMemo52(() => {
|
|
@@ -29360,7 +29383,7 @@ var ProfitAndLossDetailReport = ({
|
|
|
29360
29383
|
}
|
|
29361
29384
|
}
|
|
29362
29385
|
}), [stringOverrides, handleSourceClick]);
|
|
29363
|
-
const
|
|
29386
|
+
const Header5 = useCallback48(() => {
|
|
29364
29387
|
return /* @__PURE__ */ jsx237(
|
|
29365
29388
|
DetailReportBreadcrumb,
|
|
29366
29389
|
{
|
|
@@ -29371,7 +29394,7 @@ var ProfitAndLossDetailReport = ({
|
|
|
29371
29394
|
);
|
|
29372
29395
|
}, [dynamicBreadcrumbs, dateRange, onBreadcrumbClick]);
|
|
29373
29396
|
if (selectedSource) {
|
|
29374
|
-
return /* @__PURE__ */ jsx237(BaseDetailView, { slots: { Header:
|
|
29397
|
+
return /* @__PURE__ */ jsx237(BaseDetailView, { slots: { Header: Header5 }, name: "Profit And Loss Detail Report", onGoBack: handleBackToList, borderless: true, children: /* @__PURE__ */ jsx237(VStack, { pi: "md", children: /* @__PURE__ */ jsxs145(
|
|
29375
29398
|
DetailsList,
|
|
29376
29399
|
{
|
|
29377
29400
|
title: (stringOverrides == null ? void 0 : stringOverrides.sourceDetailsTitle) || "Transaction source",
|
|
@@ -29382,7 +29405,7 @@ var ProfitAndLossDetailReport = ({
|
|
|
29382
29405
|
}
|
|
29383
29406
|
) }) });
|
|
29384
29407
|
}
|
|
29385
|
-
return /* @__PURE__ */ jsx237(BaseDetailView, { slots: { Header:
|
|
29408
|
+
return /* @__PURE__ */ jsx237(BaseDetailView, { slots: { Header: Header5 }, name: "Profit And Loss Detail Report", onGoBack: onClose, borderless: true, children: /* @__PURE__ */ jsxs145(VStack, { className: "Layer__ProfitAndLossDetailReport", children: [
|
|
29386
29409
|
/* @__PURE__ */ jsx237(
|
|
29387
29410
|
VirtualizedDataTable,
|
|
29388
29411
|
{
|
|
@@ -29407,7 +29430,7 @@ var ProfitAndLossDetailReport = ({
|
|
|
29407
29430
|
};
|
|
29408
29431
|
|
|
29409
29432
|
// src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
|
|
29410
|
-
import { Fragment as
|
|
29433
|
+
import { Fragment as Fragment27, jsx as jsx238, jsxs as jsxs146 } from "react/jsx-runtime";
|
|
29411
29434
|
var ProfitAndLossReport = ({
|
|
29412
29435
|
stringOverrides,
|
|
29413
29436
|
allowedDatePickerModes,
|
|
@@ -29419,7 +29442,7 @@ var ProfitAndLossReport = ({
|
|
|
29419
29442
|
renderInAppLink
|
|
29420
29443
|
}) => {
|
|
29421
29444
|
var _a;
|
|
29422
|
-
const { comparisonConfig } =
|
|
29445
|
+
const { comparisonConfig } = useContext36(ProfitAndLoss2.ComparisonContext);
|
|
29423
29446
|
const [selectedLineItem, setSelectedLineItem] = useState60(null);
|
|
29424
29447
|
const breadcrumbIndexMap = useMemo53(() => {
|
|
29425
29448
|
if (!selectedLineItem) return {};
|
|
@@ -29448,9 +29471,9 @@ var ProfitAndLossReport = ({
|
|
|
29448
29471
|
View,
|
|
29449
29472
|
{
|
|
29450
29473
|
type: "panel",
|
|
29451
|
-
header: /* @__PURE__ */ jsxs146(
|
|
29474
|
+
header: /* @__PURE__ */ jsxs146(Header4, { children: [
|
|
29452
29475
|
/* @__PURE__ */ jsxs146(HeaderRow, { children: [
|
|
29453
|
-
/* @__PURE__ */ jsx238(HeaderCol, { children: /* @__PURE__ */ jsxs146(
|
|
29476
|
+
/* @__PURE__ */ jsx238(HeaderCol, { children: /* @__PURE__ */ jsxs146(Fragment27, { children: [
|
|
29454
29477
|
/* @__PURE__ */ jsx238(
|
|
29455
29478
|
ProfitAndLoss2.DatePicker,
|
|
29456
29479
|
{
|
|
@@ -29501,7 +29524,7 @@ var ProfitAndLossReport = ({
|
|
|
29501
29524
|
};
|
|
29502
29525
|
|
|
29503
29526
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
29504
|
-
import { useContext as
|
|
29527
|
+
import { useContext as useContext38, useMemo as useMemo56 } from "react";
|
|
29505
29528
|
|
|
29506
29529
|
// src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesList.tsx
|
|
29507
29530
|
import { useMemo as useMemo54 } from "react";
|
|
@@ -29648,7 +29671,7 @@ function ProfitAndLossSummariesSummary({
|
|
|
29648
29671
|
}
|
|
29649
29672
|
|
|
29650
29673
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
29651
|
-
import { useContext as
|
|
29674
|
+
import { useContext as useContext37, useMemo as useMemo55 } from "react";
|
|
29652
29675
|
import { getMonth as getMonth2, getYear as getYear3, startOfMonth as startOfMonth9 } from "date-fns";
|
|
29653
29676
|
import { jsx as jsx243, jsxs as jsxs148 } from "react/jsx-runtime";
|
|
29654
29677
|
var CLASS_NAME13 = "Layer__TransactionsToReview";
|
|
@@ -29659,7 +29682,7 @@ function TransactionsToReview({
|
|
|
29659
29682
|
variants
|
|
29660
29683
|
}) {
|
|
29661
29684
|
const { size = "sm" } = variants != null ? variants : {};
|
|
29662
|
-
const { dateRange: contextDateRange } =
|
|
29685
|
+
const { dateRange: contextDateRange } = useContext37(ProfitAndLoss2.Context);
|
|
29663
29686
|
const dateRange = usePnlDateRange ? contextDateRange : void 0;
|
|
29664
29687
|
const { data, isLoading, isError, refetch } = useProfitAndLossLTM({
|
|
29665
29688
|
currentDate: dateRange ? dateRange.startDate : startOfMonth9(/* @__PURE__ */ new Date()),
|
|
@@ -29752,7 +29775,7 @@ function Internal_ProfitAndLossSummaries({
|
|
|
29752
29775
|
isLoading,
|
|
29753
29776
|
setSidebarScope,
|
|
29754
29777
|
sidebarScope
|
|
29755
|
-
} =
|
|
29778
|
+
} = useContext38(ProfitAndLoss2.Context);
|
|
29756
29779
|
const { revenueChartData, expensesChartData } = useMemo56(
|
|
29757
29780
|
() => ({
|
|
29758
29781
|
revenueChartData: toMiniChartData({ scope: "revenue", data }),
|
|
@@ -29855,10 +29878,10 @@ function ProfitAndLossSummaries(_a) {
|
|
|
29855
29878
|
}
|
|
29856
29879
|
|
|
29857
29880
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
29858
|
-
import { useContext as
|
|
29881
|
+
import { useContext as useContext42 } from "react";
|
|
29859
29882
|
|
|
29860
29883
|
// src/contexts/TableContext/TableContext.tsx
|
|
29861
|
-
import { createContext as
|
|
29884
|
+
import { createContext as createContext21, useState as useState61 } from "react";
|
|
29862
29885
|
import { jsx as jsx245 } from "react/jsx-runtime";
|
|
29863
29886
|
var defaultValue = {
|
|
29864
29887
|
expandedRows: [],
|
|
@@ -29870,7 +29893,7 @@ var defaultValue = {
|
|
|
29870
29893
|
setExpandedAllRows: () => {
|
|
29871
29894
|
}
|
|
29872
29895
|
};
|
|
29873
|
-
var TableContext =
|
|
29896
|
+
var TableContext = createContext21(defaultValue);
|
|
29874
29897
|
var TableProvider = ({ children }) => {
|
|
29875
29898
|
const [expandedRows, setExpandedRowsState] = useState61([]);
|
|
29876
29899
|
const [expandedAllRows, setExpandedAllRows] = useState61(false);
|
|
@@ -29899,10 +29922,10 @@ var TableProvider = ({ children }) => {
|
|
|
29899
29922
|
};
|
|
29900
29923
|
|
|
29901
29924
|
// src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
|
|
29902
|
-
import { Fragment as
|
|
29925
|
+
import { Fragment as Fragment28, useContext as useContext40, useEffect as useEffect28, useMemo as useMemo57 } from "react";
|
|
29903
29926
|
|
|
29904
29927
|
// src/hooks/useTableExpandRow/useTableExpandRow.tsx
|
|
29905
|
-
import { useContext as
|
|
29928
|
+
import { useContext as useContext39 } from "react";
|
|
29906
29929
|
var useTableExpandRow = () => {
|
|
29907
29930
|
const {
|
|
29908
29931
|
expandedAllRows,
|
|
@@ -29910,7 +29933,7 @@ var useTableExpandRow = () => {
|
|
|
29910
29933
|
expandAllRows,
|
|
29911
29934
|
expandedRows,
|
|
29912
29935
|
setExpandedRows
|
|
29913
|
-
} =
|
|
29936
|
+
} = useContext39(TableContext);
|
|
29914
29937
|
const toggleAllRows = () => {
|
|
29915
29938
|
if (expandedAllRows) {
|
|
29916
29939
|
setIsOpen([]);
|
|
@@ -30016,7 +30039,7 @@ var mergeComparisonLineItemsAtDepth = (lineItems) => {
|
|
|
30016
30039
|
|
|
30017
30040
|
// src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
|
|
30018
30041
|
import classNames78 from "classnames";
|
|
30019
|
-
import { Fragment as
|
|
30042
|
+
import { Fragment as Fragment29, jsx as jsx246, jsxs as jsxs150 } from "react/jsx-runtime";
|
|
30020
30043
|
var ProfitAndLossCompareTable = ({
|
|
30021
30044
|
stringOverrides
|
|
30022
30045
|
}) => {
|
|
@@ -30025,7 +30048,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
30025
30048
|
isLoading,
|
|
30026
30049
|
comparePeriods,
|
|
30027
30050
|
selectedCompareOptions
|
|
30028
|
-
} =
|
|
30051
|
+
} = useContext40(ProfitAndLoss2.ComparisonContext);
|
|
30029
30052
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
30030
30053
|
const { data: bookkeepingPeriods } = useBookkeepingPeriods();
|
|
30031
30054
|
const rangeDisplayMode = useReportModeWithFallback("ProfitAndLoss" /* ProfitAndLoss */, "monthPicker");
|
|
@@ -30066,7 +30089,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
30066
30089
|
}
|
|
30067
30090
|
});
|
|
30068
30091
|
if (rowData.length === 0) {
|
|
30069
|
-
return /* @__PURE__ */ jsx246(
|
|
30092
|
+
return /* @__PURE__ */ jsx246(Fragment29, {});
|
|
30070
30093
|
}
|
|
30071
30094
|
const mergedLineItems = mergeComparisonLineItemsAtDepth(
|
|
30072
30095
|
rowData
|
|
@@ -30075,7 +30098,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
30075
30098
|
}
|
|
30076
30099
|
const expandable = (lineItem == null ? void 0 : lineItem.lineItems) && lineItem.lineItems.length > 0 ? true : false;
|
|
30077
30100
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
30078
|
-
return /* @__PURE__ */ jsxs150(
|
|
30101
|
+
return /* @__PURE__ */ jsxs150(Fragment28, { children: [
|
|
30079
30102
|
/* @__PURE__ */ jsxs150(
|
|
30080
30103
|
TableRow,
|
|
30081
30104
|
{
|
|
@@ -30109,7 +30132,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
30109
30132
|
return /* @__PURE__ */ jsxs150(Table, { borderCollapse: "collapse", bottomSpacing: false, children: [
|
|
30110
30133
|
/* @__PURE__ */ jsx246(TableHead, { children: selectedCompareOptions && selectedCompareOptions.length > 1 && /* @__PURE__ */ jsxs150(TableRow, { rowKey: "", children: [
|
|
30111
30134
|
/* @__PURE__ */ jsx246(TableCell, { isHeaderCell: true }),
|
|
30112
|
-
selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxs150(
|
|
30135
|
+
selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxs150(Fragment28, { children: [
|
|
30113
30136
|
/* @__PURE__ */ jsx246(TableCell, { primary: true, isHeaderCell: true, children: option.displayName }, option.displayName + "-" + i),
|
|
30114
30137
|
comparePeriods && Array.from({ length: comparePeriods - 1 }, (_, index) => /* @__PURE__ */ jsx246(TableCell, { isHeaderCell: true }, option.displayName + "-" + index))
|
|
30115
30138
|
] }, option.displayName + "-" + i))
|
|
@@ -30117,7 +30140,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
30117
30140
|
/* @__PURE__ */ jsxs150(TableBody, { children: [
|
|
30118
30141
|
comparePeriods && /* @__PURE__ */ jsxs150(TableRow, { rowKey: "", children: [
|
|
30119
30142
|
/* @__PURE__ */ jsx246(TableCell, { isHeaderCell: true }),
|
|
30120
|
-
selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsx246(
|
|
30143
|
+
selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsx246(Fragment28, { children: generateComparisonPeriods(
|
|
30121
30144
|
dateRange.startDate,
|
|
30122
30145
|
comparePeriods,
|
|
30123
30146
|
rangeDisplayMode
|
|
@@ -30125,7 +30148,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
30125
30148
|
month.label,
|
|
30126
30149
|
" ",
|
|
30127
30150
|
getBookkeepingPeriodStatus(month.date)
|
|
30128
|
-
] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsx246(
|
|
30151
|
+
] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsx246(Fragment28, { children: generateComparisonPeriods(
|
|
30129
30152
|
dateRange.startDate,
|
|
30130
30153
|
comparePeriods,
|
|
30131
30154
|
rangeDisplayMode
|
|
@@ -30157,7 +30180,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
30157
30180
|
};
|
|
30158
30181
|
|
|
30159
30182
|
// src/components/ProfitAndLossTable/ProfitAndLossTableComponent.tsx
|
|
30160
|
-
import { Fragment as
|
|
30183
|
+
import { Fragment as Fragment30, useContext as useContext41, useEffect as useEffect29 } from "react";
|
|
30161
30184
|
import classNames79 from "classnames";
|
|
30162
30185
|
import { jsx as jsx247, jsxs as jsxs151 } from "react/jsx-runtime";
|
|
30163
30186
|
var ProfitAndLossTableComponent = ({
|
|
@@ -30165,7 +30188,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
30165
30188
|
stringOverrides,
|
|
30166
30189
|
onLineItemClick
|
|
30167
30190
|
}) => {
|
|
30168
|
-
const { data, isLoading } =
|
|
30191
|
+
const { data, isLoading } = useContext41(ProfitAndLoss2.Context);
|
|
30169
30192
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
30170
30193
|
useEffect29(() => {
|
|
30171
30194
|
setIsOpen(["income", "cost_of_goods_sold", "expenses", "other_activity"]);
|
|
@@ -30198,7 +30221,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
30198
30221
|
...parentBreadcrumbs,
|
|
30199
30222
|
{ name: lineItem.name, display_name: lineItem.displayName }
|
|
30200
30223
|
];
|
|
30201
|
-
return /* @__PURE__ */ jsxs151(
|
|
30224
|
+
return /* @__PURE__ */ jsxs151(Fragment30, { children: [
|
|
30202
30225
|
/* @__PURE__ */ jsxs151(
|
|
30203
30226
|
TableRow,
|
|
30204
30227
|
{
|
|
@@ -30334,14 +30357,14 @@ var ProfitAndLossTableComponent = ({
|
|
|
30334
30357
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
30335
30358
|
import { jsx as jsx248 } from "react/jsx-runtime";
|
|
30336
30359
|
var ProfitAndLossTableWithProvider = (props) => {
|
|
30337
|
-
const { compareModeActive } =
|
|
30360
|
+
const { compareModeActive } = useContext42(ProfitAndLoss2.ComparisonContext);
|
|
30338
30361
|
return /* @__PURE__ */ jsx248(TableProvider, { children: compareModeActive ? /* @__PURE__ */ jsx248("div", { className: "Layer__compare__table__wrapper", children: /* @__PURE__ */ jsx248(ProfitAndLossCompareTable, __spreadValues({}, props)) }) : /* @__PURE__ */ jsx248(ProfitAndLossTableComponent, __spreadValues({}, props)) });
|
|
30339
30362
|
};
|
|
30340
30363
|
|
|
30341
30364
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
30342
30365
|
import { endOfMonth as endOfMonth7, startOfMonth as startOfMonth10 } from "date-fns";
|
|
30343
30366
|
import { jsx as jsx249 } from "react/jsx-runtime";
|
|
30344
|
-
var PNLContext =
|
|
30367
|
+
var PNLContext = createContext22({
|
|
30345
30368
|
data: void 0,
|
|
30346
30369
|
filteredDataRevenue: [],
|
|
30347
30370
|
filteredTotalRevenue: void 0,
|
|
@@ -30520,7 +30543,7 @@ var BalanceSheetExpandAllButton = ({
|
|
|
30520
30543
|
};
|
|
30521
30544
|
|
|
30522
30545
|
// src/components/BalanceSheetTable/BalanceSheetTable.tsx
|
|
30523
|
-
import { Fragment as
|
|
30546
|
+
import { Fragment as Fragment31, useEffect as useEffect30 } from "react";
|
|
30524
30547
|
import { jsx as jsx252, jsxs as jsxs152 } from "react/jsx-runtime";
|
|
30525
30548
|
var BalanceSheetTable = ({
|
|
30526
30549
|
data,
|
|
@@ -30544,7 +30567,7 @@ var BalanceSheetTable = ({
|
|
|
30544
30567
|
if (expandable) {
|
|
30545
30568
|
allRowKeys.push(rowKey);
|
|
30546
30569
|
}
|
|
30547
|
-
return /* @__PURE__ */ jsxs152(
|
|
30570
|
+
return /* @__PURE__ */ jsxs152(Fragment31, { children: [
|
|
30548
30571
|
/* @__PURE__ */ jsxs152(
|
|
30549
30572
|
TableRow,
|
|
30550
30573
|
{
|
|
@@ -30595,7 +30618,7 @@ var BalanceSheetTable = ({
|
|
|
30595
30618
|
/* @__PURE__ */ jsx252(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.typeColumnHeader) || "Type" }),
|
|
30596
30619
|
/* @__PURE__ */ jsx252(TableCell, { isHeaderCell: true, align: "right" /* RIGHT */, children: (stringOverrides == null ? void 0 : stringOverrides.totalColumnHeader) || "Total" })
|
|
30597
30620
|
] }) }),
|
|
30598
|
-
/* @__PURE__ */ jsx252(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx252(
|
|
30621
|
+
/* @__PURE__ */ jsx252(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx252(Fragment31, { children: data[row.lineItem] && renderLineItem(
|
|
30599
30622
|
data[row.lineItem],
|
|
30600
30623
|
0,
|
|
30601
30624
|
row.lineItem,
|
|
@@ -30669,7 +30692,7 @@ function useBalanceSheetDownload({
|
|
|
30669
30692
|
}
|
|
30670
30693
|
|
|
30671
30694
|
// src/components/BalanceSheet/download/BalanceSheetDownloadButton.tsx
|
|
30672
|
-
import { Fragment as
|
|
30695
|
+
import { Fragment as Fragment32, jsx as jsx253, jsxs as jsxs153 } from "react/jsx-runtime";
|
|
30673
30696
|
function BalanceSheetDownloadButton({
|
|
30674
30697
|
effectiveDate,
|
|
30675
30698
|
iconOnly
|
|
@@ -30679,7 +30702,7 @@ function BalanceSheetDownloadButton({
|
|
|
30679
30702
|
effectiveDate,
|
|
30680
30703
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
30681
30704
|
});
|
|
30682
|
-
return /* @__PURE__ */ jsxs153(
|
|
30705
|
+
return /* @__PURE__ */ jsxs153(Fragment32, { children: [
|
|
30683
30706
|
/* @__PURE__ */ jsx253(
|
|
30684
30707
|
DownloadButton,
|
|
30685
30708
|
{
|
|
@@ -30726,7 +30749,7 @@ var BalanceSheetView = ({
|
|
|
30726
30749
|
{
|
|
30727
30750
|
type: "panel",
|
|
30728
30751
|
ref: containerRef,
|
|
30729
|
-
header: /* @__PURE__ */ jsx254(
|
|
30752
|
+
header: /* @__PURE__ */ jsx254(Header4, { children: /* @__PURE__ */ jsxs154(HeaderRow, { children: [
|
|
30730
30753
|
/* @__PURE__ */ jsx254(HeaderCol, { children: /* @__PURE__ */ jsx254(BalanceSheetDatePicker, {}) }),
|
|
30731
30754
|
withExpandAllButton && /* @__PURE__ */ jsx254(HeaderCol, { children: /* @__PURE__ */ jsx254(BalanceSheetExpandAllButton, { view }) })
|
|
30732
30755
|
] }) }),
|
|
@@ -30746,7 +30769,7 @@ var BalanceSheetView = ({
|
|
|
30746
30769
|
{
|
|
30747
30770
|
type: "panel",
|
|
30748
30771
|
ref: containerRef,
|
|
30749
|
-
header: /* @__PURE__ */ jsx254(
|
|
30772
|
+
header: /* @__PURE__ */ jsx254(Header4, { children: /* @__PURE__ */ jsxs154(HeaderRow, { children: [
|
|
30750
30773
|
/* @__PURE__ */ jsx254(HeaderCol, { children: /* @__PURE__ */ jsx254(BalanceSheetDatePicker, {}) }),
|
|
30751
30774
|
/* @__PURE__ */ jsxs154(HeaderCol, { children: [
|
|
30752
30775
|
withExpandAllButton && /* @__PURE__ */ jsx254(BalanceSheetExpandAllButton, { view }),
|
|
@@ -30772,7 +30795,7 @@ var BalanceSheetView = ({
|
|
|
30772
30795
|
};
|
|
30773
30796
|
|
|
30774
30797
|
// src/components/StatementOfCashFlowTable/StatementOfCashFlowTable.tsx
|
|
30775
|
-
import { Fragment as
|
|
30798
|
+
import { Fragment as Fragment33 } from "react";
|
|
30776
30799
|
import { jsx as jsx255, jsxs as jsxs155 } from "react/jsx-runtime";
|
|
30777
30800
|
var StatementOfCashFlowTable = ({
|
|
30778
30801
|
data,
|
|
@@ -30783,7 +30806,7 @@ var StatementOfCashFlowTable = ({
|
|
|
30783
30806
|
const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
|
|
30784
30807
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
30785
30808
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
30786
|
-
return /* @__PURE__ */ jsxs155(
|
|
30809
|
+
return /* @__PURE__ */ jsxs155(Fragment33, { children: [
|
|
30787
30810
|
/* @__PURE__ */ jsxs155(
|
|
30788
30811
|
TableRow,
|
|
30789
30812
|
{
|
|
@@ -30835,7 +30858,7 @@ var StatementOfCashFlowTable = ({
|
|
|
30835
30858
|
] }) }),
|
|
30836
30859
|
/* @__PURE__ */ jsx255(TableBody, { children: config.map((row, idx) => {
|
|
30837
30860
|
if (row.type === "line_item") {
|
|
30838
|
-
return /* @__PURE__ */ jsx255(
|
|
30861
|
+
return /* @__PURE__ */ jsx255(Fragment33, { children: data[row.lineItem] && renderLineItem(
|
|
30839
30862
|
data[row.lineItem],
|
|
30840
30863
|
0,
|
|
30841
30864
|
row.lineItem ? row.lineItem : "",
|
|
@@ -30961,7 +30984,7 @@ function useCashflowStatementDownload({
|
|
|
30961
30984
|
}
|
|
30962
30985
|
|
|
30963
30986
|
// src/components/StatementOfCashFlow/download/CashflowStatementDownloadButton.tsx
|
|
30964
|
-
import { Fragment as
|
|
30987
|
+
import { Fragment as Fragment34, jsx as jsx256, jsxs as jsxs156 } from "react/jsx-runtime";
|
|
30965
30988
|
function CashflowStatementDownloadButton({
|
|
30966
30989
|
startDate,
|
|
30967
30990
|
endDate,
|
|
@@ -30973,7 +30996,7 @@ function CashflowStatementDownloadButton({
|
|
|
30973
30996
|
endDate,
|
|
30974
30997
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
30975
30998
|
});
|
|
30976
|
-
return /* @__PURE__ */ jsxs156(
|
|
30999
|
+
return /* @__PURE__ */ jsxs156(Fragment34, { children: [
|
|
30977
31000
|
/* @__PURE__ */ jsx256(
|
|
30978
31001
|
DownloadButton,
|
|
30979
31002
|
{
|
|
@@ -31104,7 +31127,7 @@ var StatementOfCashFlowView = ({
|
|
|
31104
31127
|
{
|
|
31105
31128
|
type: "panel",
|
|
31106
31129
|
ref: containerRef,
|
|
31107
|
-
header: /* @__PURE__ */ jsx258(
|
|
31130
|
+
header: /* @__PURE__ */ jsx258(Header4, { children: /* @__PURE__ */ jsxs157(HeaderRow, { children: [
|
|
31108
31131
|
/* @__PURE__ */ jsx258(HeaderCol, { children: /* @__PURE__ */ jsx258(
|
|
31109
31132
|
StatementOfCashFlowDatePicker,
|
|
31110
31133
|
{
|
|
@@ -31135,12 +31158,12 @@ var StatementOfCashFlowView = ({
|
|
|
31135
31158
|
};
|
|
31136
31159
|
|
|
31137
31160
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
31138
|
-
import { useContext as
|
|
31161
|
+
import { useContext as useContext49 } from "react";
|
|
31139
31162
|
|
|
31140
31163
|
// src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
|
|
31141
|
-
import { createContext as
|
|
31164
|
+
import { createContext as createContext23 } from "react";
|
|
31142
31165
|
import { endOfMonth as endOfMonth9, startOfMonth as startOfMonth12 } from "date-fns";
|
|
31143
|
-
var ChartOfAccountsContext =
|
|
31166
|
+
var ChartOfAccountsContext = createContext23(
|
|
31144
31167
|
{
|
|
31145
31168
|
data: void 0,
|
|
31146
31169
|
isLoading: false,
|
|
@@ -32104,7 +32127,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
32104
32127
|
};
|
|
32105
32128
|
|
|
32106
32129
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
|
|
32107
|
-
import { useContext as
|
|
32130
|
+
import { useContext as useContext46, useState as useState66 } from "react";
|
|
32108
32131
|
|
|
32109
32132
|
// src/icons/Plus.tsx
|
|
32110
32133
|
import { jsx as jsx259, jsxs as jsxs158 } from "react/jsx-runtime";
|
|
@@ -32145,11 +32168,11 @@ var Plus = (_a) => {
|
|
|
32145
32168
|
var Plus_default = Plus;
|
|
32146
32169
|
|
|
32147
32170
|
// src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
|
|
32148
|
-
import { useContext as
|
|
32171
|
+
import { useContext as useContext43 } from "react";
|
|
32149
32172
|
import { endOfMonth as endOfMonth11, startOfMonth as startOfMonth14 } from "date-fns";
|
|
32150
32173
|
import { jsx as jsx260 } from "react/jsx-runtime";
|
|
32151
32174
|
var ChartOfAccountsDatePicker = () => {
|
|
32152
|
-
const { changeDateRange, dateRange } =
|
|
32175
|
+
const { changeDateRange, dateRange } = useContext43(ChartOfAccountsContext);
|
|
32153
32176
|
return /* @__PURE__ */ jsx260(
|
|
32154
32177
|
DatePicker,
|
|
32155
32178
|
{
|
|
@@ -32168,7 +32191,7 @@ var ChartOfAccountsDatePicker = () => {
|
|
|
32168
32191
|
};
|
|
32169
32192
|
|
|
32170
32193
|
// src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
|
|
32171
|
-
import { useContext as
|
|
32194
|
+
import { useContext as useContext44, useMemo as useMemo61 } from "react";
|
|
32172
32195
|
|
|
32173
32196
|
// src/components/ChartOfAccountsForm/useParentOptions.ts
|
|
32174
32197
|
import { useMemo as useMemo60 } from "react";
|
|
@@ -32199,7 +32222,7 @@ var ChartOfAccountsForm = ({
|
|
|
32199
32222
|
submitForm,
|
|
32200
32223
|
sendingForm,
|
|
32201
32224
|
apiError
|
|
32202
|
-
} =
|
|
32225
|
+
} = useContext44(ChartOfAccountsContext);
|
|
32203
32226
|
const parentOptions = useParentOptions(data);
|
|
32204
32227
|
const entry = useMemo61(() => {
|
|
32205
32228
|
if ((form == null ? void 0 : form.action) === "edit" && form.accountId) {
|
|
@@ -32221,7 +32244,7 @@ var ChartOfAccountsForm = ({
|
|
|
32221
32244
|
submitForm();
|
|
32222
32245
|
},
|
|
32223
32246
|
children: [
|
|
32224
|
-
/* @__PURE__ */ jsx261(
|
|
32247
|
+
/* @__PURE__ */ jsx261(Header4, { className: "Layer__chart-of-accounts__sidebar__header", children: /* @__PURE__ */ jsxs159(HeaderRow, { children: [
|
|
32225
32248
|
/* @__PURE__ */ jsx261(HeaderCol, { children: /* @__PURE__ */ jsx261(Heading, { size: "secondary" /* secondary */, className: "title", children: (form == null ? void 0 : form.action) === "edit" ? (stringOverrides == null ? void 0 : stringOverrides.editModeHeader) || "Edit Account" : (stringOverrides == null ? void 0 : stringOverrides.createModeHeader) || "Add New Account" }) }),
|
|
32226
32249
|
/* @__PURE__ */ jsxs159(HeaderCol, { className: "actions", children: [
|
|
32227
32250
|
/* @__PURE__ */ jsx261(
|
|
@@ -32414,7 +32437,7 @@ var ChartOfAccountsSidebar = ({
|
|
|
32414
32437
|
};
|
|
32415
32438
|
|
|
32416
32439
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
32417
|
-
import { Fragment as
|
|
32440
|
+
import { Fragment as Fragment35, useContext as useContext45, useEffect as useEffect33, useMemo as useMemo62, useState as useState65 } from "react";
|
|
32418
32441
|
|
|
32419
32442
|
// src/icons/Edit2.tsx
|
|
32420
32443
|
import { jsx as jsx263 } from "react/jsx-runtime";
|
|
@@ -32593,7 +32616,7 @@ var getMatchedTextIndices = ({
|
|
|
32593
32616
|
};
|
|
32594
32617
|
|
|
32595
32618
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
32596
|
-
import { Fragment as
|
|
32619
|
+
import { Fragment as Fragment36, jsx as jsx264, jsxs as jsxs160 } from "react/jsx-runtime";
|
|
32597
32620
|
var highlightMatch = ({ text, query, isMatching }) => {
|
|
32598
32621
|
const matchedTextIndices = getMatchedTextIndices({ text, query, isMatching });
|
|
32599
32622
|
if (matchedTextIndices === null) {
|
|
@@ -32634,8 +32657,8 @@ var ChartOfAccountsTableContent = ({
|
|
|
32634
32657
|
expandAll,
|
|
32635
32658
|
templateAccountsEditable
|
|
32636
32659
|
}) => {
|
|
32637
|
-
const { setSelectedAccount } =
|
|
32638
|
-
const { editAccount, deleteAccount } =
|
|
32660
|
+
const { setSelectedAccount } = useContext45(LedgerAccountsContext);
|
|
32661
|
+
const { editAccount, deleteAccount } = useContext45(ChartOfAccountsContext);
|
|
32639
32662
|
const [toggledKeys, setToggledKeys] = useState65({});
|
|
32640
32663
|
const [accountToDelete, setAccountToDelete] = useState65(null);
|
|
32641
32664
|
const sortedAccounts = useMemo62(() => sortAccountsRecursive(data.accounts), [data.accounts]);
|
|
@@ -32719,7 +32742,7 @@ var ChartOfAccountsTableContent = ({
|
|
|
32719
32742
|
e.stopPropagation();
|
|
32720
32743
|
setAccountToDelete(account);
|
|
32721
32744
|
};
|
|
32722
|
-
return /* @__PURE__ */ jsxs160(
|
|
32745
|
+
return /* @__PURE__ */ jsxs160(Fragment35, { children: [
|
|
32723
32746
|
/* @__PURE__ */ jsxs160(
|
|
32724
32747
|
TableRow,
|
|
32725
32748
|
{
|
|
@@ -32815,7 +32838,7 @@ var ChartOfAccountsTableContent = ({
|
|
|
32815
32838
|
}
|
|
32816
32839
|
) });
|
|
32817
32840
|
}
|
|
32818
|
-
return /* @__PURE__ */ jsxs160(
|
|
32841
|
+
return /* @__PURE__ */ jsxs160(Fragment36, { children: [
|
|
32819
32842
|
/* @__PURE__ */ jsxs160(Table, { componentName: "chart-of-accounts", children: [
|
|
32820
32843
|
/* @__PURE__ */ jsxs160("colgroup", { children: [
|
|
32821
32844
|
/* @__PURE__ */ jsx264("col", { className: "Layer__chart-of-accounts--name" }),
|
|
@@ -32915,7 +32938,7 @@ function useAccountBalancesDownload({
|
|
|
32915
32938
|
}
|
|
32916
32939
|
|
|
32917
32940
|
// src/components/ChartOfAccounts/download/AccountBalancesDownloadButton.tsx
|
|
32918
|
-
import { Fragment as
|
|
32941
|
+
import { Fragment as Fragment37, jsx as jsx265, jsxs as jsxs161 } from "react/jsx-runtime";
|
|
32919
32942
|
function AccountBalancesDownloadButton({
|
|
32920
32943
|
startCutoff,
|
|
32921
32944
|
endCutoff,
|
|
@@ -32927,7 +32950,7 @@ function AccountBalancesDownloadButton({
|
|
|
32927
32950
|
endCutoff,
|
|
32928
32951
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
32929
32952
|
});
|
|
32930
|
-
return /* @__PURE__ */ jsxs161(
|
|
32953
|
+
return /* @__PURE__ */ jsxs161(Fragment37, { children: [
|
|
32931
32954
|
/* @__PURE__ */ jsx265(
|
|
32932
32955
|
DownloadButton,
|
|
32933
32956
|
{
|
|
@@ -32958,7 +32981,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
32958
32981
|
stringOverrides,
|
|
32959
32982
|
templateAccountsEditable
|
|
32960
32983
|
}) => {
|
|
32961
|
-
const { data, isLoading, addAccount, error, isValidating, refetch, form } =
|
|
32984
|
+
const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext46(ChartOfAccountsContext);
|
|
32962
32985
|
const [expandAll, setExpandAll] = useState66();
|
|
32963
32986
|
const { inputValue, searchQuery, handleInputChange } = useDebouncedSearchInput({ initialInputState: "" });
|
|
32964
32987
|
return /* @__PURE__ */ jsxs162(
|
|
@@ -32974,7 +32997,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
32974
32997
|
sidebarIsOpen: Boolean(form),
|
|
32975
32998
|
parentRef: containerRef,
|
|
32976
32999
|
children: [
|
|
32977
|
-
/* @__PURE__ */ jsx266(
|
|
33000
|
+
/* @__PURE__ */ jsx266(Header4, { className: `Layer__${COMPONENT_NAME7}__header`, asHeader: true, rounded: true, children: /* @__PURE__ */ jsx266(HeaderRow, { children: /* @__PURE__ */ jsx266(HeaderCol, { children: /* @__PURE__ */ jsx266(
|
|
32978
33001
|
Heading,
|
|
32979
33002
|
{
|
|
32980
33003
|
className: `Layer__${COMPONENT_NAME7}__title`,
|
|
@@ -32982,7 +33005,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
32982
33005
|
children: (stringOverrides == null ? void 0 : stringOverrides.headerText) || "Chart of Accounts"
|
|
32983
33006
|
}
|
|
32984
33007
|
) }) }) }),
|
|
32985
|
-
/* @__PURE__ */ jsx266(
|
|
33008
|
+
/* @__PURE__ */ jsx266(Header4, { className: `Layer__${COMPONENT_NAME7}__header`, sticky: true, children: /* @__PURE__ */ jsxs162(HeaderRow, { children: [
|
|
32986
33009
|
/* @__PURE__ */ jsx266(HeaderCol, { children: /* @__PURE__ */ jsx266(
|
|
32987
33010
|
Heading,
|
|
32988
33011
|
{
|
|
@@ -33053,13 +33076,13 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
33053
33076
|
|
|
33054
33077
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
33055
33078
|
import {
|
|
33056
|
-
useContext as
|
|
33079
|
+
useContext as useContext48,
|
|
33057
33080
|
useMemo as useMemo64,
|
|
33058
33081
|
useState as useState67
|
|
33059
33082
|
} from "react";
|
|
33060
33083
|
|
|
33061
33084
|
// src/components/LedgerAccount/LedgerAccountRow.tsx
|
|
33062
|
-
import { useContext as
|
|
33085
|
+
import { useContext as useContext47, useMemo as useMemo63 } from "react";
|
|
33063
33086
|
import classNames80 from "classnames";
|
|
33064
33087
|
import { parseISO as parseISO14, format as formatTime11 } from "date-fns";
|
|
33065
33088
|
import { jsx as jsx267, jsxs as jsxs163 } from "react/jsx-runtime";
|
|
@@ -33070,7 +33093,7 @@ var LedgerAccountRow = ({
|
|
|
33070
33093
|
nodeType
|
|
33071
33094
|
}) => {
|
|
33072
33095
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
33073
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } =
|
|
33096
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext47(LedgerAccountsContext);
|
|
33074
33097
|
const ledgerEntrySource = useMemo63(() => {
|
|
33075
33098
|
return row.source ? decodeLedgerEntrySource(row.source) : void 0;
|
|
33076
33099
|
}, [row.source]);
|
|
@@ -33194,7 +33217,7 @@ var LedgerAccountRow = ({
|
|
|
33194
33217
|
|
|
33195
33218
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
33196
33219
|
import classNames81 from "classnames";
|
|
33197
|
-
import { Fragment as
|
|
33220
|
+
import { Fragment as Fragment38, jsx as jsx268, jsxs as jsxs164 } from "react/jsx-runtime";
|
|
33198
33221
|
var LedgerAccount = ({
|
|
33199
33222
|
containerRef,
|
|
33200
33223
|
pageSize = 15,
|
|
@@ -33215,7 +33238,7 @@ var LedgerAccount = ({
|
|
|
33215
33238
|
refetch,
|
|
33216
33239
|
hasMore,
|
|
33217
33240
|
fetchMore
|
|
33218
|
-
} =
|
|
33241
|
+
} = useContext48(LedgerAccountsContext);
|
|
33219
33242
|
const baseClassName = classNames81(
|
|
33220
33243
|
"Layer__ledger-account__index",
|
|
33221
33244
|
selectedAccount && "open"
|
|
@@ -33255,7 +33278,7 @@ var LedgerAccount = ({
|
|
|
33255
33278
|
parentRef: containerRef,
|
|
33256
33279
|
className: "Layer__ledger-account__panel",
|
|
33257
33280
|
children: /* @__PURE__ */ jsxs164("div", { className: baseClassName, children: [
|
|
33258
|
-
/* @__PURE__ */ jsx268(
|
|
33281
|
+
/* @__PURE__ */ jsx268(Header4, { className: "Layer__ledger-account__header", children: /* @__PURE__ */ jsx268(HeaderRow, { children: /* @__PURE__ */ jsxs164(HeaderCol, { children: [
|
|
33259
33282
|
/* @__PURE__ */ jsx268(BackButton, { onClick: close2 }),
|
|
33260
33283
|
/* @__PURE__ */ jsxs164("div", { className: "Layer__ledger-account__title-container", children: [
|
|
33261
33284
|
/* @__PURE__ */ jsx268(
|
|
@@ -33292,13 +33315,13 @@ var LedgerAccount = ({
|
|
|
33292
33315
|
/* @__PURE__ */ jsxs164("table", { className: "Layer__table Layer__table--hover-effect Layer__ledger-account-table", children: [
|
|
33293
33316
|
/* @__PURE__ */ jsx268("thead", { children: /* @__PURE__ */ jsxs164("tr", { children: [
|
|
33294
33317
|
view !== "desktop" && /* @__PURE__ */ jsx268("th", {}),
|
|
33295
|
-
view === "desktop" && /* @__PURE__ */ jsxs164(
|
|
33318
|
+
view === "desktop" && /* @__PURE__ */ jsxs164(Fragment38, { children: [
|
|
33296
33319
|
/* @__PURE__ */ jsx268("th", { className: "Layer__table-header", children: ((_b = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _b.dateColumnHeader) || "Date" }),
|
|
33297
33320
|
/* @__PURE__ */ jsx268("th", { className: "Layer__table-header", children: ((_c = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _c.journalIdColumnHeader) || "Journal ID #" }),
|
|
33298
33321
|
/* @__PURE__ */ jsx268("th", { className: "Layer__table-header", children: ((_d = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _d.sourceColumnHeader) || "Source" }),
|
|
33299
33322
|
nodeType !== "Leaf" /* Leaf */ && /* @__PURE__ */ jsx268("th", { className: "Layer__table-header", children: ((_e = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _e.accountColumnHeader) || "Account" })
|
|
33300
33323
|
] }),
|
|
33301
|
-
view !== "mobile" && /* @__PURE__ */ jsxs164(
|
|
33324
|
+
view !== "mobile" && /* @__PURE__ */ jsxs164(Fragment38, { children: [
|
|
33302
33325
|
/* @__PURE__ */ jsx268("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_f = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _f.debitColumnHeader) || "Debit" }),
|
|
33303
33326
|
/* @__PURE__ */ jsx268("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_g = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _g.creditColumnHeader) || "Credit" }),
|
|
33304
33327
|
/* @__PURE__ */ jsx268("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_h = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _h.runningBalanceColumnHeader) || "Running balance" })
|
|
@@ -33370,7 +33393,7 @@ var ChartOfAccountsContent = ({
|
|
|
33370
33393
|
templateAccountsEditable,
|
|
33371
33394
|
showAddAccountButton
|
|
33372
33395
|
}) => {
|
|
33373
|
-
const { selectedAccount } =
|
|
33396
|
+
const { selectedAccount } = useContext49(LedgerAccountsContext);
|
|
33374
33397
|
const { view, containerRef } = useElementViewSize();
|
|
33375
33398
|
return /* @__PURE__ */ jsx269(Container, { name: "chart-of-accounts", ref: containerRef, asWidget, children: selectedAccount ? /* @__PURE__ */ jsx269(
|
|
33376
33399
|
LedgerAccount,
|
|
@@ -33395,8 +33418,8 @@ var ChartOfAccountsContent = ({
|
|
|
33395
33418
|
};
|
|
33396
33419
|
|
|
33397
33420
|
// src/contexts/JournalContext/JournalContext.tsx
|
|
33398
|
-
import { createContext as
|
|
33399
|
-
var JournalContext =
|
|
33421
|
+
import { createContext as createContext24 } from "react";
|
|
33422
|
+
var JournalContext = createContext24({
|
|
33400
33423
|
refetch: () => {
|
|
33401
33424
|
},
|
|
33402
33425
|
setSelectedEntryId: () => {
|
|
@@ -33807,13 +33830,13 @@ var useJournal = () => {
|
|
|
33807
33830
|
};
|
|
33808
33831
|
|
|
33809
33832
|
// src/components/JournalTable/JournalTableWithPanel.tsx
|
|
33810
|
-
import { useContext as
|
|
33833
|
+
import { useContext as useContext55, useMemo as useMemo69, useState as useState70 } from "react";
|
|
33811
33834
|
|
|
33812
33835
|
// src/components/JournalSidebar/JournalSidebar.tsx
|
|
33813
|
-
import { useContext as
|
|
33836
|
+
import { useContext as useContext53 } from "react";
|
|
33814
33837
|
|
|
33815
33838
|
// src/components/JournalEntryDetails/JournalEntryDetails.tsx
|
|
33816
|
-
import { useContext as
|
|
33839
|
+
import { useContext as useContext50, useMemo as useMemo67, useState as useState69 } from "react";
|
|
33817
33840
|
import { jsx as jsx270, jsxs as jsxs165 } from "react/jsx-runtime";
|
|
33818
33841
|
var JournalEntryDetails = () => {
|
|
33819
33842
|
var _a, _b;
|
|
@@ -33825,7 +33848,7 @@ var JournalEntryDetails = () => {
|
|
|
33825
33848
|
selectedEntryId,
|
|
33826
33849
|
reverseEntry,
|
|
33827
33850
|
refetch
|
|
33828
|
-
} =
|
|
33851
|
+
} = useContext50(JournalContext);
|
|
33829
33852
|
const { renderInAppLink } = useInAppLinkContext();
|
|
33830
33853
|
const [reverseEntryProcessing, setReverseEntryProcessing] = useState69(false);
|
|
33831
33854
|
const [reverseEntryError, setReverseEntryError] = useState69();
|
|
@@ -33873,7 +33896,7 @@ var JournalEntryDetails = () => {
|
|
|
33873
33896
|
}
|
|
33874
33897
|
});
|
|
33875
33898
|
return /* @__PURE__ */ jsxs165("div", { className: "Layer__journal__entry-details", children: [
|
|
33876
|
-
/* @__PURE__ */ jsx270(
|
|
33899
|
+
/* @__PURE__ */ jsx270(Header4, { className: "Layer__journal__entry-details__mobile-header", children: /* @__PURE__ */ jsxs165(HeaderRow, { children: [
|
|
33877
33900
|
/* @__PURE__ */ jsxs165(HeaderCol, { className: "Layer__hidden-lg Layer__hidden-xl", children: [
|
|
33878
33901
|
/* @__PURE__ */ jsx270(BackButton, { onClick: closeSelectedEntry }),
|
|
33879
33902
|
/* @__PURE__ */ jsx270(Heading, { size: "secondary" /* secondary */, children: "Transaction details" })
|
|
@@ -34029,11 +34052,11 @@ var JournalEntryDetails = () => {
|
|
|
34029
34052
|
};
|
|
34030
34053
|
|
|
34031
34054
|
// src/components/JournalForm/JournalForm.tsx
|
|
34032
|
-
import { useContext as
|
|
34055
|
+
import { useContext as useContext52 } from "react";
|
|
34033
34056
|
|
|
34034
34057
|
// src/components/JournalForm/JournalFormEntryLines.tsx
|
|
34035
|
-
import { useContext as
|
|
34036
|
-
import { Fragment as
|
|
34058
|
+
import { useContext as useContext51, useMemo as useMemo68 } from "react";
|
|
34059
|
+
import { Fragment as Fragment39, jsx as jsx271, jsxs as jsxs166 } from "react/jsx-runtime";
|
|
34037
34060
|
function recursiveFlattenCategories(accounts) {
|
|
34038
34061
|
const flattenedResult = accounts.flatMap((a) => {
|
|
34039
34062
|
var _a;
|
|
@@ -34053,7 +34076,7 @@ var JournalFormEntryLines = ({
|
|
|
34053
34076
|
config
|
|
34054
34077
|
}) => {
|
|
34055
34078
|
const { data: categories } = useCategories({ mode: "ALL" });
|
|
34056
|
-
const { form } =
|
|
34079
|
+
const { form } = useContext51(JournalContext);
|
|
34057
34080
|
const { flattenedCategories, parentOptions } = useMemo68(() => {
|
|
34058
34081
|
const flattenedCategories2 = recursiveFlattenCategories(categories != null ? categories : []);
|
|
34059
34082
|
const parentOptions2 = [...flattenedCategories2].sort((a, b) => a.display_name.localeCompare(b.display_name)).map((account) => {
|
|
@@ -34135,7 +34158,7 @@ var JournalFormEntryLines = ({
|
|
|
34135
34158
|
]
|
|
34136
34159
|
);
|
|
34137
34160
|
};
|
|
34138
|
-
return /* @__PURE__ */ jsx271(
|
|
34161
|
+
return /* @__PURE__ */ jsx271(Fragment39, { children: ["DEBIT", "CREDIT"].map((direction, idx) => {
|
|
34139
34162
|
return /* @__PURE__ */ jsxs166(
|
|
34140
34163
|
"div",
|
|
34141
34164
|
{
|
|
@@ -34266,7 +34289,7 @@ var JournalForm = ({
|
|
|
34266
34289
|
changeFormData,
|
|
34267
34290
|
addEntryLine,
|
|
34268
34291
|
removeEntryLine
|
|
34269
|
-
} =
|
|
34292
|
+
} = useContext52(JournalContext);
|
|
34270
34293
|
return /* @__PURE__ */ jsxs167(
|
|
34271
34294
|
"form",
|
|
34272
34295
|
{
|
|
@@ -34276,7 +34299,7 @@ var JournalForm = ({
|
|
|
34276
34299
|
submitForm();
|
|
34277
34300
|
},
|
|
34278
34301
|
children: [
|
|
34279
|
-
/* @__PURE__ */ jsx272(
|
|
34302
|
+
/* @__PURE__ */ jsx272(Header4, { className: "Layer__journal__sidebar__header", children: /* @__PURE__ */ jsxs167(HeaderRow, { children: [
|
|
34280
34303
|
/* @__PURE__ */ jsx272(HeaderCol, { children: /* @__PURE__ */ jsx272(Heading, { size: "secondary" /* secondary */, className: "title", children: (_a = stringOverrides == null ? void 0 : stringOverrides.header) != null ? _a : "Add New Entry" }) }),
|
|
34281
34304
|
/* @__PURE__ */ jsxs167(HeaderCol, { className: "actions", children: [
|
|
34282
34305
|
/* @__PURE__ */ jsx272(
|
|
@@ -34414,7 +34437,7 @@ var JournalSidebar = ({
|
|
|
34414
34437
|
config,
|
|
34415
34438
|
stringOverrides
|
|
34416
34439
|
}) => {
|
|
34417
|
-
const { selectedEntryId } =
|
|
34440
|
+
const { selectedEntryId } = useContext53(JournalContext);
|
|
34418
34441
|
if (selectedEntryId !== "new") {
|
|
34419
34442
|
return /* @__PURE__ */ jsx273(JournalEntryDetails, {});
|
|
34420
34443
|
}
|
|
@@ -34422,7 +34445,7 @@ var JournalSidebar = ({
|
|
|
34422
34445
|
};
|
|
34423
34446
|
|
|
34424
34447
|
// src/components/JournalTable/JournalTable.tsx
|
|
34425
|
-
import { Fragment as
|
|
34448
|
+
import { Fragment as Fragment40, useContext as useContext54, useLayoutEffect as useLayoutEffect4 } from "react";
|
|
34426
34449
|
import { parseISO as parseISO15, format as formatTime12 } from "date-fns";
|
|
34427
34450
|
import { jsx as jsx274, jsxs as jsxs168 } from "react/jsx-runtime";
|
|
34428
34451
|
var accountName = (row) => {
|
|
@@ -34450,7 +34473,7 @@ var JournalTableContent = ({
|
|
|
34450
34473
|
data,
|
|
34451
34474
|
stringOverrides
|
|
34452
34475
|
}) => {
|
|
34453
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } =
|
|
34476
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext54(JournalContext);
|
|
34454
34477
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
34455
34478
|
useLayoutEffect4(() => {
|
|
34456
34479
|
if (data.length > 0) {
|
|
@@ -34460,7 +34483,7 @@ var JournalTableContent = ({
|
|
|
34460
34483
|
const renderJournalRow = (row, index, rowKey, depth) => {
|
|
34461
34484
|
const expandable = !!row.line_items && row.line_items.length > 0;
|
|
34462
34485
|
const expanded = !expandable || isOpen(rowKey);
|
|
34463
|
-
return /* @__PURE__ */ jsxs168(
|
|
34486
|
+
return /* @__PURE__ */ jsxs168(Fragment40, { children: [
|
|
34464
34487
|
/* @__PURE__ */ jsxs168(
|
|
34465
34488
|
TableRow,
|
|
34466
34489
|
{
|
|
@@ -34596,7 +34619,7 @@ function useJournalEntriesDownload({
|
|
|
34596
34619
|
}
|
|
34597
34620
|
|
|
34598
34621
|
// src/components/Journal/download/JournalEntriesDownloadButton.tsx
|
|
34599
|
-
import { Fragment as
|
|
34622
|
+
import { Fragment as Fragment41, jsx as jsx275, jsxs as jsxs169 } from "react/jsx-runtime";
|
|
34600
34623
|
function JournalEntriesDownloadButton({
|
|
34601
34624
|
startCutoff,
|
|
34602
34625
|
endCutoff,
|
|
@@ -34608,7 +34631,7 @@ function JournalEntriesDownloadButton({
|
|
|
34608
34631
|
endCutoff,
|
|
34609
34632
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
34610
34633
|
});
|
|
34611
|
-
return /* @__PURE__ */ jsxs169(
|
|
34634
|
+
return /* @__PURE__ */ jsxs169(Fragment41, { children: [
|
|
34612
34635
|
/* @__PURE__ */ jsx275(
|
|
34613
34636
|
DownloadButton,
|
|
34614
34637
|
{
|
|
@@ -34647,7 +34670,7 @@ var JournalTableWithPanel = ({
|
|
|
34647
34670
|
addEntry,
|
|
34648
34671
|
hasMore,
|
|
34649
34672
|
fetchMore
|
|
34650
|
-
} =
|
|
34673
|
+
} = useContext55(JournalContext);
|
|
34651
34674
|
const data = useMemo69(
|
|
34652
34675
|
() => {
|
|
34653
34676
|
if (!rawData) return void 0;
|
|
@@ -34676,7 +34699,7 @@ var JournalTableWithPanel = ({
|
|
|
34676
34699
|
parentRef: containerRef,
|
|
34677
34700
|
children: [
|
|
34678
34701
|
/* @__PURE__ */ jsx276(
|
|
34679
|
-
|
|
34702
|
+
Header4,
|
|
34680
34703
|
{
|
|
34681
34704
|
className: `Layer__${COMPONENT_NAME8}__header`,
|
|
34682
34705
|
asHeader: true,
|
|
@@ -34692,7 +34715,7 @@ var JournalTableWithPanel = ({
|
|
|
34692
34715
|
) }) })
|
|
34693
34716
|
}
|
|
34694
34717
|
),
|
|
34695
|
-
/* @__PURE__ */ jsx276(
|
|
34718
|
+
/* @__PURE__ */ jsx276(Header4, { children: /* @__PURE__ */ jsxs170(HeaderRow, { children: [
|
|
34696
34719
|
/* @__PURE__ */ jsx276(HeaderCol, { children: /* @__PURE__ */ jsx276(
|
|
34697
34720
|
Heading,
|
|
34698
34721
|
{
|
|
@@ -35175,7 +35198,7 @@ function useUpdateTaskUploadDescription() {
|
|
|
35175
35198
|
}
|
|
35176
35199
|
|
|
35177
35200
|
// src/components/Tasks/TasksListItem.tsx
|
|
35178
|
-
import { Fragment as
|
|
35201
|
+
import { Fragment as Fragment42, jsx as jsx281, jsxs as jsxs172 } from "react/jsx-runtime";
|
|
35179
35202
|
var TasksListItem = ({
|
|
35180
35203
|
task,
|
|
35181
35204
|
defaultOpen
|
|
@@ -35231,7 +35254,7 @@ var TasksListItem = ({
|
|
|
35231
35254
|
}
|
|
35232
35255
|
);
|
|
35233
35256
|
} else {
|
|
35234
|
-
return /* @__PURE__ */ jsxs172(
|
|
35257
|
+
return /* @__PURE__ */ jsxs172(Fragment42, { children: [
|
|
35235
35258
|
/* @__PURE__ */ jsx281(
|
|
35236
35259
|
Button,
|
|
35237
35260
|
{
|
|
@@ -35456,7 +35479,7 @@ function usePaginatedList(list, pageSize) {
|
|
|
35456
35479
|
}
|
|
35457
35480
|
|
|
35458
35481
|
// src/components/Tasks/TasksList.tsx
|
|
35459
|
-
import { Fragment as
|
|
35482
|
+
import { Fragment as Fragment43, jsx as jsx284, jsxs as jsxs175 } from "react/jsx-runtime";
|
|
35460
35483
|
var TasksEmptyState = () => /* @__PURE__ */ jsxs175("div", { className: "Layer__tasks-empty-state", children: [
|
|
35461
35484
|
/* @__PURE__ */ jsx284("div", { className: "Layer__tasks-icon", children: /* @__PURE__ */ jsx284(SmileIcon_default, {}) }),
|
|
35462
35485
|
/* @__PURE__ */ jsxs175(Text, { size: "sm" /* sm */, children: [
|
|
@@ -35496,7 +35519,7 @@ function TasksList({ pageSize = 8, mobile }) {
|
|
|
35496
35519
|
}
|
|
35497
35520
|
);
|
|
35498
35521
|
}
|
|
35499
|
-
return /* @__PURE__ */ jsx284("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs175(
|
|
35522
|
+
return /* @__PURE__ */ jsx284("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs175(Fragment43, { children: [
|
|
35500
35523
|
pageItems.map((task, index) => /* @__PURE__ */ jsx284(
|
|
35501
35524
|
TasksListItem,
|
|
35502
35525
|
{
|
|
@@ -35533,7 +35556,7 @@ var BookkeepingStatusDescription = ({ monthNumber, status, incompleteTasksCount
|
|
|
35533
35556
|
};
|
|
35534
35557
|
|
|
35535
35558
|
// src/components/Tasks/TasksPending.tsx
|
|
35536
|
-
import { Fragment as
|
|
35559
|
+
import { Fragment as Fragment44, jsx as jsx286, jsxs as jsxs176 } from "react/jsx-runtime";
|
|
35537
35560
|
var TasksPending = () => {
|
|
35538
35561
|
var _a, _b, _c, _d;
|
|
35539
35562
|
const { date } = useGlobalDate();
|
|
@@ -35595,7 +35618,7 @@ var TasksPending = () => {
|
|
|
35595
35618
|
) })
|
|
35596
35619
|
] }) : null
|
|
35597
35620
|
] }),
|
|
35598
|
-
/* @__PURE__ */ jsx286("div", { className: "Layer__tasks-pending-main", children: activePeriod && /* @__PURE__ */ jsxs176(
|
|
35621
|
+
/* @__PURE__ */ jsx286("div", { className: "Layer__tasks-pending-main", children: activePeriod && /* @__PURE__ */ jsxs176(Fragment44, { children: [
|
|
35599
35622
|
/* @__PURE__ */ jsx286(BookkeepingStatus2, { status: activePeriod.status, monthNumber: activePeriod.month }),
|
|
35600
35623
|
/* @__PURE__ */ jsx286(
|
|
35601
35624
|
BookkeepingStatusDescription,
|
|
@@ -36155,7 +36178,7 @@ function TasksEmptyContainer({ children }) {
|
|
|
36155
36178
|
}
|
|
36156
36179
|
|
|
36157
36180
|
// src/components/Tasks/Tasks.tsx
|
|
36158
|
-
import { Fragment as
|
|
36181
|
+
import { Fragment as Fragment45, jsx as jsx296, jsxs as jsxs183 } from "react/jsx-runtime";
|
|
36159
36182
|
function Tasks({
|
|
36160
36183
|
mobile = false,
|
|
36161
36184
|
tasksHeader,
|
|
@@ -36188,7 +36211,7 @@ function Tasks({
|
|
|
36188
36211
|
/* @__PURE__ */ jsx296(Heading2, { size: "xs", level: 4, children: "Not Enrolled in Bookkeeping" }),
|
|
36189
36212
|
/* @__PURE__ */ jsx296(P, { children: "If you believe this is an error, please contact support." })
|
|
36190
36213
|
] }) }),
|
|
36191
|
-
children: () => /* @__PURE__ */ jsxs183(
|
|
36214
|
+
children: () => /* @__PURE__ */ jsxs183(Fragment45, { children: [
|
|
36192
36215
|
/* @__PURE__ */ jsx296(TasksYearsTabs, {}),
|
|
36193
36216
|
/* @__PURE__ */ jsx296(TasksMonthSelector, {}),
|
|
36194
36217
|
/* @__PURE__ */ jsx296(TasksPending, {}),
|
|
@@ -36202,10 +36225,10 @@ function Tasks({
|
|
|
36202
36225
|
}
|
|
36203
36226
|
|
|
36204
36227
|
// src/components/PlatformOnboarding/LinkAccounts.tsx
|
|
36205
|
-
import { useContext as
|
|
36228
|
+
import { useContext as useContext58 } from "react";
|
|
36206
36229
|
|
|
36207
36230
|
// src/components/PlatformOnboarding/Steps/LinkAccountsConfirmationStep.tsx
|
|
36208
|
-
import { useContext as
|
|
36231
|
+
import { useContext as useContext56 } from "react";
|
|
36209
36232
|
import { useForm as useForm3 } from "@tanstack/react-form";
|
|
36210
36233
|
|
|
36211
36234
|
// src/components/PlatformOnboarding/Container/LinkAccountsListContainer.tsx
|
|
@@ -36241,7 +36264,7 @@ function LinkAccountsConfirmationStep() {
|
|
|
36241
36264
|
data: linkedAccounts,
|
|
36242
36265
|
loadingStatus: linkedAccountsLoadingStatus,
|
|
36243
36266
|
refetchAccounts
|
|
36244
|
-
} =
|
|
36267
|
+
} = useContext56(LinkedAccountsContext);
|
|
36245
36268
|
const effectiveLinkedAccounts = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
|
|
36246
36269
|
const { trigger } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
|
|
36247
36270
|
const { previous, next } = useWizard();
|
|
@@ -36314,9 +36337,9 @@ function LinkAccountsConfirmationStep() {
|
|
|
36314
36337
|
}
|
|
36315
36338
|
|
|
36316
36339
|
// src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
|
|
36317
|
-
import { useContext as
|
|
36340
|
+
import { useContext as useContext57 } from "react";
|
|
36318
36341
|
import pluralize5 from "pluralize";
|
|
36319
|
-
import { Fragment as
|
|
36342
|
+
import { Fragment as Fragment46, jsx as jsx299, jsxs as jsxs185 } from "react/jsx-runtime";
|
|
36320
36343
|
function LinkAccountsLinkStep() {
|
|
36321
36344
|
const {
|
|
36322
36345
|
data,
|
|
@@ -36324,10 +36347,10 @@ function LinkAccountsLinkStep() {
|
|
|
36324
36347
|
error,
|
|
36325
36348
|
refetchAccounts,
|
|
36326
36349
|
addConnection
|
|
36327
|
-
} =
|
|
36350
|
+
} = useContext57(LinkedAccountsContext);
|
|
36328
36351
|
const { next } = useWizard();
|
|
36329
36352
|
const effectiveAccounts = data != null ? data : [];
|
|
36330
|
-
return /* @__PURE__ */ jsxs185(
|
|
36353
|
+
return /* @__PURE__ */ jsxs185(Fragment46, { children: [
|
|
36331
36354
|
/* @__PURE__ */ jsx299(
|
|
36332
36355
|
ConditionalList,
|
|
36333
36356
|
{
|
|
@@ -36387,7 +36410,7 @@ function LinkAccountsLinkStep() {
|
|
|
36387
36410
|
children: ({ item: account }) => /* @__PURE__ */ jsx299(BasicLinkedAccountContainer, { isSelected: true, children: /* @__PURE__ */ jsx299(BasicLinkedAccountContent, { account }) }, account.id)
|
|
36388
36411
|
}
|
|
36389
36412
|
),
|
|
36390
|
-
effectiveAccounts.length > 0 ? /* @__PURE__ */ jsxs185(
|
|
36413
|
+
effectiveAccounts.length > 0 ? /* @__PURE__ */ jsxs185(Fragment46, { children: [
|
|
36391
36414
|
/* @__PURE__ */ jsx299(Separator, { mbs: "lg", mbe: "lg" }),
|
|
36392
36415
|
/* @__PURE__ */ jsx299(HStack, { justify: "start", gap: "sm", children: /* @__PURE__ */ jsx299(Button, { onClick: () => {
|
|
36393
36416
|
void next();
|
|
@@ -36404,7 +36427,7 @@ function LinkAccounts(props) {
|
|
|
36404
36427
|
function LinkAccountsContent({
|
|
36405
36428
|
onComplete
|
|
36406
36429
|
}) {
|
|
36407
|
-
const { data: linkedAccounts, loadingStatus } =
|
|
36430
|
+
const { data: linkedAccounts, loadingStatus } = useContext58(LinkedAccountsContext);
|
|
36408
36431
|
const linkedAccountsNeedingConfirmation = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
|
|
36409
36432
|
const hideConfirmationStep = loadingStatus === "complete" && linkedAccountsNeedingConfirmation.length === 0;
|
|
36410
36433
|
return /* @__PURE__ */ jsx300("section", { className: "Layer__link-accounts Layer__component", children: /* @__PURE__ */ jsxs186(
|
|
@@ -36611,7 +36634,7 @@ var TrendingUp = (_a) => {
|
|
|
36611
36634
|
var TrendingUp_default = TrendingUp;
|
|
36612
36635
|
|
|
36613
36636
|
// src/components/PlatformOnboarding/Steps/WelcomeStep.tsx
|
|
36614
|
-
import { Fragment as
|
|
36637
|
+
import { Fragment as Fragment47, jsx as jsx304, jsxs as jsxs190 } from "react/jsx-runtime";
|
|
36615
36638
|
var defaultTitle = "Welcome";
|
|
36616
36639
|
var defaultDescription = "Welcome to the platform onboarding process";
|
|
36617
36640
|
var WelcomeStep = ({ onNext, title = defaultTitle, description, stepsEnabled }) => {
|
|
@@ -36632,7 +36655,7 @@ var WelcomeStep = ({ onNext, title = defaultTitle, description, stepsEnabled })
|
|
|
36632
36655
|
}
|
|
36633
36656
|
return defaultDescription;
|
|
36634
36657
|
};
|
|
36635
|
-
return /* @__PURE__ */ jsxs190(
|
|
36658
|
+
return /* @__PURE__ */ jsxs190(Fragment47, { children: [
|
|
36636
36659
|
/* @__PURE__ */ jsxs190("div", { className: "Layer__platform-onboarding__welcome", children: [
|
|
36637
36660
|
/* @__PURE__ */ jsx304(Heading, { className: "Layer__platform-onboarding__heading", align: "left", children: title }),
|
|
36638
36661
|
/* @__PURE__ */ jsx304(Text, { status: "disabled", children: buildDescription() })
|
|
@@ -36709,12 +36732,12 @@ var WelcomeStepFooter = () => {
|
|
|
36709
36732
|
};
|
|
36710
36733
|
|
|
36711
36734
|
// src/components/PlatformOnboarding/Steps/SummaryStep.tsx
|
|
36712
|
-
import { Fragment as
|
|
36735
|
+
import { Fragment as Fragment48, jsx as jsx305, jsxs as jsxs191 } from "react/jsx-runtime";
|
|
36713
36736
|
var defaultTitle2 = "You\u2019re all set!";
|
|
36714
36737
|
var defaultDescription2 = "We\u2019re syncing your accounts. This process may take a while to complete.";
|
|
36715
36738
|
var defaultNextBtnText = "Go to dashboard";
|
|
36716
36739
|
var SummaryStep = ({ onNext, title = defaultTitle2, description = defaultDescription2, nextBtnText = defaultNextBtnText }) => {
|
|
36717
|
-
return /* @__PURE__ */ jsxs191(
|
|
36740
|
+
return /* @__PURE__ */ jsxs191(Fragment48, { children: [
|
|
36718
36741
|
/* @__PURE__ */ jsxs191("div", { className: "Layer__platform-onboarding__summary", children: [
|
|
36719
36742
|
/* @__PURE__ */ jsx305(Heading, { className: "Layer__platform-onboarding__heading", align: "left", children: title }),
|
|
36720
36743
|
/* @__PURE__ */ jsx305(Text, { status: "disabled", children: description })
|
|
@@ -37229,7 +37252,7 @@ var PhoneInput = (_a) => {
|
|
|
37229
37252
|
|
|
37230
37253
|
// src/components/BusinessForm/BusinessForm.tsx
|
|
37231
37254
|
import { isPossiblePhoneNumber } from "libphonenumber-js";
|
|
37232
|
-
import { Fragment as
|
|
37255
|
+
import { Fragment as Fragment49, jsx as jsx310, jsxs as jsxs193 } from "react/jsx-runtime";
|
|
37233
37256
|
var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
37234
37257
|
var _a;
|
|
37235
37258
|
const { form, submitError, isFormValid } = useBusinessForm({ onSuccess });
|
|
@@ -37253,7 +37276,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
37253
37276
|
validators: {
|
|
37254
37277
|
onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Full name is required"
|
|
37255
37278
|
},
|
|
37256
|
-
children: (field) => /* @__PURE__ */ jsx310(
|
|
37279
|
+
children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "full_name", label: "Full name", children: /* @__PURE__ */ jsx310(
|
|
37257
37280
|
Input,
|
|
37258
37281
|
{
|
|
37259
37282
|
name: "full_name",
|
|
@@ -37266,7 +37289,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
37266
37289
|
) }) })
|
|
37267
37290
|
}
|
|
37268
37291
|
),
|
|
37269
|
-
/* @__PURE__ */ jsx310(form.Field, { name: "preferred_name", children: (field) => /* @__PURE__ */ jsx310(
|
|
37292
|
+
/* @__PURE__ */ jsx310(form.Field, { name: "preferred_name", children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "preferred_name", label: "Preferred name", children: /* @__PURE__ */ jsx310(
|
|
37270
37293
|
Input,
|
|
37271
37294
|
{
|
|
37272
37295
|
name: "preferred_name",
|
|
@@ -37283,7 +37306,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
37283
37306
|
validators: {
|
|
37284
37307
|
onSubmit: ({ value }) => validateEmailFormat(value, true) ? void 0 : "Email is invalid"
|
|
37285
37308
|
},
|
|
37286
|
-
children: (field) => /* @__PURE__ */ jsx310(
|
|
37309
|
+
children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(
|
|
37287
37310
|
InputGroup,
|
|
37288
37311
|
{
|
|
37289
37312
|
name: "email",
|
|
@@ -37310,7 +37333,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
37310
37333
|
validators: {
|
|
37311
37334
|
onSubmit: ({ value }) => isPossiblePhoneNumber(value != null ? value : "", "US") ? void 0 : "Phone number is invalid"
|
|
37312
37335
|
},
|
|
37313
|
-
children: (field) => /* @__PURE__ */ jsx310(
|
|
37336
|
+
children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(
|
|
37314
37337
|
InputGroup,
|
|
37315
37338
|
{
|
|
37316
37339
|
name: "phone_number",
|
|
@@ -37337,7 +37360,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
37337
37360
|
validators: {
|
|
37338
37361
|
onBlur: ({ value }) => notEmpty(value) ? void 0 : "Company name is required"
|
|
37339
37362
|
},
|
|
37340
|
-
children: (field) => /* @__PURE__ */ jsx310(
|
|
37363
|
+
children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "legal_name", label: "Company", children: /* @__PURE__ */ jsx310(
|
|
37341
37364
|
Input,
|
|
37342
37365
|
{
|
|
37343
37366
|
name: "legal_name",
|
|
@@ -37350,7 +37373,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
37350
37373
|
) }) })
|
|
37351
37374
|
}
|
|
37352
37375
|
),
|
|
37353
|
-
/* @__PURE__ */ jsx310(form.Field, { name: "dba", children: (field) => /* @__PURE__ */ jsx310(
|
|
37376
|
+
/* @__PURE__ */ jsx310(form.Field, { name: "dba", children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "dba", label: "DBA (optional)", children: /* @__PURE__ */ jsx310(
|
|
37354
37377
|
Input,
|
|
37355
37378
|
{
|
|
37356
37379
|
name: "dba",
|
|
@@ -37361,7 +37384,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
37361
37384
|
errorMessage: field.state.meta.errors.join(", ")
|
|
37362
37385
|
}
|
|
37363
37386
|
) }) }) }),
|
|
37364
|
-
/* @__PURE__ */ jsx310(form.Field, { name: "entity_type", children: (field) => /* @__PURE__ */ jsx310(
|
|
37387
|
+
/* @__PURE__ */ jsx310(form.Field, { name: "entity_type", children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "entity_type", label: "Entity type", children: /* @__PURE__ */ jsx310(
|
|
37365
37388
|
BusinessTypeSelect,
|
|
37366
37389
|
{
|
|
37367
37390
|
value: field.state.value,
|
|
@@ -37369,14 +37392,14 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
37369
37392
|
}
|
|
37370
37393
|
) }) }) }),
|
|
37371
37394
|
/* @__PURE__ */ jsxs193("div", { className: "Layer__business-form__state-tin-fields", children: [
|
|
37372
|
-
/* @__PURE__ */ jsx310(form.Field, { name: "us_state", children: (field) => /* @__PURE__ */ jsx310(
|
|
37395
|
+
/* @__PURE__ */ jsx310(form.Field, { name: "us_state", children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "us_state", label: "State", className: "Layer__business-form__state", children: /* @__PURE__ */ jsx310(
|
|
37373
37396
|
USStateSelect,
|
|
37374
37397
|
{
|
|
37375
37398
|
value: field.state.value,
|
|
37376
37399
|
onChange: (option) => field.handleChange(option.value)
|
|
37377
37400
|
}
|
|
37378
37401
|
) }) }) }),
|
|
37379
|
-
/* @__PURE__ */ jsx310(form.Field, { name: "tin", children: (field) => /* @__PURE__ */ jsx310(
|
|
37402
|
+
/* @__PURE__ */ jsx310(form.Field, { name: "tin", children: (field) => /* @__PURE__ */ jsx310(Fragment49, { children: /* @__PURE__ */ jsx310(InputGroup, { name: "tin", label: "Tax ID number (optional)", children: /* @__PURE__ */ jsx310(
|
|
37380
37403
|
Input,
|
|
37381
37404
|
{
|
|
37382
37405
|
name: "tin",
|
|
@@ -37407,10 +37430,10 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
37407
37430
|
};
|
|
37408
37431
|
|
|
37409
37432
|
// src/components/PlatformOnboarding/Steps/BusinessInfoStep.tsx
|
|
37410
|
-
import { Fragment as
|
|
37433
|
+
import { Fragment as Fragment50, jsx as jsx311, jsxs as jsxs194 } from "react/jsx-runtime";
|
|
37411
37434
|
var defaultTitle3 = "We\u2019ll use this information to contact you whenever we have questions on your books.";
|
|
37412
37435
|
var BusinessInfoStep = ({ title = defaultTitle3, onNext }) => {
|
|
37413
|
-
return /* @__PURE__ */ jsxs194(
|
|
37436
|
+
return /* @__PURE__ */ jsxs194(Fragment50, { children: [
|
|
37414
37437
|
/* @__PURE__ */ jsx311(Heading2, { children: title }),
|
|
37415
37438
|
/* @__PURE__ */ jsx311(BusinessForm2, { onSuccess: onNext })
|
|
37416
37439
|
] });
|
|
@@ -37837,7 +37860,7 @@ var AccountingOverview = ({
|
|
|
37837
37860
|
{
|
|
37838
37861
|
title,
|
|
37839
37862
|
showHeader: showTitle,
|
|
37840
|
-
header: /* @__PURE__ */ jsx317(
|
|
37863
|
+
header: /* @__PURE__ */ jsx317(Header4, { children: /* @__PURE__ */ jsx317(HeaderRow, { children: /* @__PURE__ */ jsx317(HeaderCol, { children: /* @__PURE__ */ jsx317(ProfitAndLoss2.DatePicker, {}) }) }) }),
|
|
37841
37864
|
children: [
|
|
37842
37865
|
enableOnboarding && /* @__PURE__ */ jsx317(
|
|
37843
37866
|
Onboarding,
|
|
@@ -38060,7 +38083,7 @@ var GeneralLedgerView = ({
|
|
|
38060
38083
|
// src/views/ProjectProfitability/ProjectProfitability.tsx
|
|
38061
38084
|
import { useState as useState80 } from "react";
|
|
38062
38085
|
import Select5 from "react-select";
|
|
38063
|
-
import { Fragment as
|
|
38086
|
+
import { Fragment as Fragment51, jsx as jsx320, jsxs as jsxs202 } from "react/jsx-runtime";
|
|
38064
38087
|
var ProjectProfitabilityView = ({
|
|
38065
38088
|
valueOptions,
|
|
38066
38089
|
showTitle,
|
|
@@ -38133,7 +38156,7 @@ var ProjectProfitabilityView = ({
|
|
|
38133
38156
|
}
|
|
38134
38157
|
)
|
|
38135
38158
|
] }),
|
|
38136
|
-
/* @__PURE__ */ jsx320(Container, { name: "project", children: /* @__PURE__ */ jsxs202(
|
|
38159
|
+
/* @__PURE__ */ jsx320(Container, { name: "project", children: /* @__PURE__ */ jsxs202(Fragment51, { children: [
|
|
38137
38160
|
activeTab === "overview" && /* @__PURE__ */ jsx320(
|
|
38138
38161
|
AccountingOverview,
|
|
38139
38162
|
{
|
|
@@ -38169,7 +38192,7 @@ var ProjectProfitabilityView = ({
|
|
|
38169
38192
|
};
|
|
38170
38193
|
|
|
38171
38194
|
// src/contexts/BillsContext.tsx
|
|
38172
|
-
import { createContext as
|
|
38195
|
+
import { createContext as createContext25, useContext as useContext59 } from "react";
|
|
38173
38196
|
|
|
38174
38197
|
// src/hooks/useBills.tsx
|
|
38175
38198
|
import { useMemo as useMemo76, useState as useState81 } from "react";
|
|
@@ -38561,7 +38584,7 @@ var useBillsRecordPayment = ({ refetchAllBills }) => {
|
|
|
38561
38584
|
// src/contexts/BillsContext.tsx
|
|
38562
38585
|
import { endOfMonth as endOfMonth13, startOfMonth as startOfMonth16 } from "date-fns";
|
|
38563
38586
|
import { jsx as jsx321 } from "react/jsx-runtime";
|
|
38564
|
-
var BillsContext =
|
|
38587
|
+
var BillsContext = createContext25({
|
|
38565
38588
|
data: [],
|
|
38566
38589
|
paginatedData: [],
|
|
38567
38590
|
currentPage: 1,
|
|
@@ -38592,7 +38615,7 @@ var BillsContext = createContext24({
|
|
|
38592
38615
|
refetch: () => {
|
|
38593
38616
|
}
|
|
38594
38617
|
});
|
|
38595
|
-
var BillsRecordPaymentContext =
|
|
38618
|
+
var BillsRecordPaymentContext = createContext25({
|
|
38596
38619
|
billsToPay: [],
|
|
38597
38620
|
setBill: () => {
|
|
38598
38621
|
},
|
|
@@ -38636,8 +38659,8 @@ var BillsRecordPaymentContext = createContext24({
|
|
|
38636
38659
|
isLoading: false,
|
|
38637
38660
|
apiError: void 0
|
|
38638
38661
|
});
|
|
38639
|
-
var useBillsContext = () =>
|
|
38640
|
-
var useBillsRecordPaymentContext = () =>
|
|
38662
|
+
var useBillsContext = () => useContext59(BillsContext);
|
|
38663
|
+
var useBillsRecordPaymentContext = () => useContext59(BillsRecordPaymentContext);
|
|
38641
38664
|
var BillsProvider = ({ children }) => {
|
|
38642
38665
|
const bills = useBills();
|
|
38643
38666
|
return /* @__PURE__ */ jsx321(BillsContext.Provider, { value: bills, children: /* @__PURE__ */ jsx321(BillContextWithRecordPayment, { children }) });
|
|
@@ -38899,7 +38922,7 @@ var useUnpaidBillsByVendor = ({ vendorId }) => {
|
|
|
38899
38922
|
};
|
|
38900
38923
|
|
|
38901
38924
|
// src/components/Bills/BillsRecordPayment.tsx
|
|
38902
|
-
import { Fragment as
|
|
38925
|
+
import { Fragment as Fragment52, jsx as jsx324, jsxs as jsxs204 } from "react/jsx-runtime";
|
|
38903
38926
|
var buildLabel = (bill, amount) => {
|
|
38904
38927
|
var _a, _b;
|
|
38905
38928
|
const amountNumber = amount !== void 0 ? Number(amount) : 0;
|
|
@@ -39098,7 +39121,7 @@ var BillsRecordPayment = ({
|
|
|
39098
39121
|
/* @__PURE__ */ jsx324(Text, { size: "md" /* md */, children: "Total" }),
|
|
39099
39122
|
/* @__PURE__ */ jsx324(Text, { size: "md" /* md */, children: convertNumberToCurrency(totalAmount) })
|
|
39100
39123
|
] }),
|
|
39101
|
-
/* @__PURE__ */ jsx324("div", { className: "Layer__bills__record-payment__submit-container", children: apiError ? /* @__PURE__ */ jsxs204(
|
|
39124
|
+
/* @__PURE__ */ jsx324("div", { className: "Layer__bills__record-payment__submit-container", children: apiError ? /* @__PURE__ */ jsxs204(Fragment52, { children: [
|
|
39102
39125
|
/* @__PURE__ */ jsx324(
|
|
39103
39126
|
RetryButton,
|
|
39104
39127
|
{
|
|
@@ -39131,7 +39154,7 @@ var BillsSidebar = () => {
|
|
|
39131
39154
|
};
|
|
39132
39155
|
|
|
39133
39156
|
// src/contexts/VendorsContext.tsx
|
|
39134
|
-
import { createContext as
|
|
39157
|
+
import { createContext as createContext26, useContext as useContext60 } from "react";
|
|
39135
39158
|
|
|
39136
39159
|
// src/hooks/useVendors.ts
|
|
39137
39160
|
import useSWR21 from "swr";
|
|
@@ -39156,10 +39179,10 @@ var useVendors = () => {
|
|
|
39156
39179
|
|
|
39157
39180
|
// src/contexts/VendorsContext.tsx
|
|
39158
39181
|
import { jsx as jsx326 } from "react/jsx-runtime";
|
|
39159
|
-
var VendorsContext =
|
|
39182
|
+
var VendorsContext = createContext26({
|
|
39160
39183
|
data: []
|
|
39161
39184
|
});
|
|
39162
|
-
var useVendorsContext = () =>
|
|
39185
|
+
var useVendorsContext = () => useContext60(VendorsContext);
|
|
39163
39186
|
var VendorsProvider = ({ children }) => {
|
|
39164
39187
|
const vendors = useVendors();
|
|
39165
39188
|
return /* @__PURE__ */ jsx326(VendorsContext.Provider, { value: vendors, children });
|
|
@@ -39273,8 +39296,8 @@ function buildDifference(due_at) {
|
|
|
39273
39296
|
if (isNaN(d)) {
|
|
39274
39297
|
return { text: "" };
|
|
39275
39298
|
}
|
|
39276
|
-
const
|
|
39277
|
-
const daysDiff = differenceInDays2(
|
|
39299
|
+
const today3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
|
|
39300
|
+
const daysDiff = differenceInDays2(today3, d);
|
|
39278
39301
|
if (daysDiff === 0) {
|
|
39279
39302
|
return {
|
|
39280
39303
|
text: "Due today",
|
|
@@ -39367,7 +39390,7 @@ var BillSummary = ({ bill }) => {
|
|
|
39367
39390
|
};
|
|
39368
39391
|
|
|
39369
39392
|
// src/components/Bills/BillsDetails.tsx
|
|
39370
|
-
import { Fragment as
|
|
39393
|
+
import { Fragment as Fragment53, jsx as jsx331, jsxs as jsxs207 } from "react/jsx-runtime";
|
|
39371
39394
|
var flattenCategories3 = (categories) => {
|
|
39372
39395
|
return categories.reduce((acc, category) => {
|
|
39373
39396
|
var _a;
|
|
@@ -39410,7 +39433,7 @@ var BillsDetails = ({
|
|
|
39410
39433
|
className: "Layer__bills-account__index",
|
|
39411
39434
|
floating: true,
|
|
39412
39435
|
children: [
|
|
39413
|
-
/* @__PURE__ */ jsx331(
|
|
39436
|
+
/* @__PURE__ */ jsx331(Header4, { className: "Layer__bills-account__header", children: /* @__PURE__ */ jsx331(HeaderRow, { children: /* @__PURE__ */ jsxs207(HeaderCol, { children: [
|
|
39414
39437
|
/* @__PURE__ */ jsx331(BackButton, { onClick: () => closeBillDetails() }),
|
|
39415
39438
|
/* @__PURE__ */ jsxs207("div", { className: "Layer__bills-account__title-container", children: [
|
|
39416
39439
|
/* @__PURE__ */ jsx331(
|
|
@@ -39490,7 +39513,7 @@ var BillsDetails = ({
|
|
|
39490
39513
|
validators: { onSubmit: ({ value }) => value ? void 0 : "Vendor is required" },
|
|
39491
39514
|
children: (field) => {
|
|
39492
39515
|
var _a, _b, _c;
|
|
39493
|
-
return /* @__PURE__ */ jsxs207(
|
|
39516
|
+
return /* @__PURE__ */ jsxs207(Fragment53, { children: [
|
|
39494
39517
|
/* @__PURE__ */ jsx331(InputGroup, { inline: true, label: "Vendor", children: /* @__PURE__ */ jsx331(
|
|
39495
39518
|
SelectVendor,
|
|
39496
39519
|
{
|
|
@@ -39688,7 +39711,7 @@ var BillsDetails = ({
|
|
|
39688
39711
|
import { useMemo as useMemo82 } from "react";
|
|
39689
39712
|
|
|
39690
39713
|
// src/components/Bills/BillsTable.tsx
|
|
39691
|
-
import { Fragment as
|
|
39714
|
+
import { Fragment as Fragment54 } from "react";
|
|
39692
39715
|
|
|
39693
39716
|
// src/components/DueStatus/DueStatus.tsx
|
|
39694
39717
|
import { useMemo as useMemo81 } from "react";
|
|
@@ -39752,8 +39775,8 @@ var getDiff = (refDate) => {
|
|
|
39752
39775
|
if (isNaN(d)) {
|
|
39753
39776
|
return null;
|
|
39754
39777
|
}
|
|
39755
|
-
const
|
|
39756
|
-
return differenceInDays3(
|
|
39778
|
+
const today3 = (/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0);
|
|
39779
|
+
return differenceInDays3(today3, d);
|
|
39757
39780
|
};
|
|
39758
39781
|
var DueStatus = ({ dueDate, paidAt, size = "md" }) => {
|
|
39759
39782
|
const date = useMemo81(() => {
|
|
@@ -39852,7 +39875,7 @@ var BillsTableContent = ({
|
|
|
39852
39875
|
"Layer__bills-table__actions-col",
|
|
39853
39876
|
status === "PAID" ? "Layer__bills-table__actions-col--narrow" : ""
|
|
39854
39877
|
);
|
|
39855
|
-
return /* @__PURE__ */ jsx334(
|
|
39878
|
+
return /* @__PURE__ */ jsx334(Fragment54, { children: /* @__PURE__ */ jsxs209(TableRow, { rowKey: rowKey + "-" + index, variant: "main", children: [
|
|
39856
39879
|
/* @__PURE__ */ jsxs209(TableCell, { primary: true, nowrap: true, className: "Layer__bills-table__vendor-col", children: [
|
|
39857
39880
|
bulkSelectionActive && status === "UNPAID" && /* @__PURE__ */ jsx334(
|
|
39858
39881
|
CheckboxWithTooltip,
|
|
@@ -39919,7 +39942,7 @@ var BillsTableContent = ({
|
|
|
39919
39942
|
|
|
39920
39943
|
// src/components/Bills/BillsList.tsx
|
|
39921
39944
|
import classNames91 from "classnames";
|
|
39922
|
-
import { Fragment as
|
|
39945
|
+
import { Fragment as Fragment55, jsx as jsx335, jsxs as jsxs210 } from "react/jsx-runtime";
|
|
39923
39946
|
var BillsList = ({
|
|
39924
39947
|
stringOverrides
|
|
39925
39948
|
}) => {
|
|
@@ -40041,8 +40064,8 @@ var BillsListItem = ({
|
|
|
40041
40064
|
] })
|
|
40042
40065
|
] }));
|
|
40043
40066
|
};
|
|
40044
|
-
var BillAmount = ({ bill }) => /* @__PURE__ */ jsxs210(
|
|
40045
|
-
bill.outstanding_balance !== 0 ? /* @__PURE__ */ jsxs210(
|
|
40067
|
+
var BillAmount = ({ bill }) => /* @__PURE__ */ jsxs210(Fragment55, { children: [
|
|
40068
|
+
bill.outstanding_balance !== 0 ? /* @__PURE__ */ jsxs210(Fragment55, { children: [
|
|
40046
40069
|
/* @__PURE__ */ jsx335(Text, { as: "span", status: "disabled", children: convertCentsToCurrency(bill.outstanding_balance) }),
|
|
40047
40070
|
/* @__PURE__ */ jsx335("span", { className: "Layer__bills-list-item__separator" })
|
|
40048
40071
|
] }) : null,
|
|
@@ -40050,7 +40073,7 @@ var BillAmount = ({ bill }) => /* @__PURE__ */ jsxs210(Fragment54, { children: [
|
|
|
40050
40073
|
] });
|
|
40051
40074
|
|
|
40052
40075
|
// src/components/Bills/BillsTableWithPanel.tsx
|
|
40053
|
-
import { Fragment as
|
|
40076
|
+
import { Fragment as Fragment56, jsx as jsx336, jsxs as jsxs211 } from "react/jsx-runtime";
|
|
40054
40077
|
var COMPONENT_NAME9 = "bills";
|
|
40055
40078
|
var BillsTableWithPanel = ({
|
|
40056
40079
|
containerRef,
|
|
@@ -40099,7 +40122,7 @@ var BillsTableWithPanel = ({
|
|
|
40099
40122
|
parentRef: containerRef,
|
|
40100
40123
|
children: [
|
|
40101
40124
|
/* @__PURE__ */ jsxs211(
|
|
40102
|
-
|
|
40125
|
+
Header4,
|
|
40103
40126
|
{
|
|
40104
40127
|
className: `Layer__${COMPONENT_NAME9}__header`,
|
|
40105
40128
|
asHeader: true,
|
|
@@ -40131,7 +40154,7 @@ var BillsTableWithPanel = ({
|
|
|
40131
40154
|
}
|
|
40132
40155
|
) }) }),
|
|
40133
40156
|
status === "UNPAID" && /* @__PURE__ */ jsxs211(HeaderRow, { direction: isMobile ? "col" : "row", children: [
|
|
40134
|
-
/* @__PURE__ */ jsx336(HeaderCol, { noPadding: true, children: bulkSelectionActive ? /* @__PURE__ */ jsxs211(
|
|
40157
|
+
/* @__PURE__ */ jsx336(HeaderCol, { noPadding: true, children: bulkSelectionActive ? /* @__PURE__ */ jsxs211(Fragment56, { children: [
|
|
40135
40158
|
/* @__PURE__ */ jsx336(
|
|
40136
40159
|
SelectVendor,
|
|
40137
40160
|
{
|
|
@@ -40283,7 +40306,7 @@ var BillsViewContent = ({
|
|
|
40283
40306
|
|
|
40284
40307
|
// src/views/Reports/Reports.tsx
|
|
40285
40308
|
import { useState as useState84 } from "react";
|
|
40286
|
-
import { Fragment as
|
|
40309
|
+
import { Fragment as Fragment57, jsx as jsx340, jsxs as jsxs212 } from "react/jsx-runtime";
|
|
40287
40310
|
var getOptions = (enabledReports) => {
|
|
40288
40311
|
return [
|
|
40289
40312
|
enabledReports.includes("profitAndLoss") ? {
|
|
@@ -40360,7 +40383,7 @@ var ReportsPanel = ({
|
|
|
40360
40383
|
view,
|
|
40361
40384
|
renderInAppLink
|
|
40362
40385
|
}) => {
|
|
40363
|
-
return /* @__PURE__ */ jsxs212(
|
|
40386
|
+
return /* @__PURE__ */ jsxs212(Fragment57, { children: [
|
|
40364
40387
|
openReport === "profitAndLoss" && /* @__PURE__ */ jsx340(
|
|
40365
40388
|
ProfitAndLossReport,
|
|
40366
40389
|
__spreadValues({
|
|
@@ -40380,8 +40403,8 @@ var ReportsPanel = ({
|
|
|
40380
40403
|
};
|
|
40381
40404
|
|
|
40382
40405
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
40383
|
-
import { useContext as
|
|
40384
|
-
import { Fragment as
|
|
40406
|
+
import { useContext as useContext61, useRef as useRef29 } from "react";
|
|
40407
|
+
import { Fragment as Fragment58, jsx as jsx341, jsxs as jsxs213 } from "react/jsx-runtime";
|
|
40385
40408
|
var COMPONENT_NAME10 = "profit-and-loss";
|
|
40386
40409
|
var ProfitAndLossView = (props) => {
|
|
40387
40410
|
const containerRef = useRef29(null);
|
|
@@ -40395,7 +40418,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
40395
40418
|
"containerRef",
|
|
40396
40419
|
"stringOverrides"
|
|
40397
40420
|
]);
|
|
40398
|
-
const { sidebarScope } =
|
|
40421
|
+
const { sidebarScope } = useContext61(ProfitAndLoss2.Context);
|
|
40399
40422
|
return /* @__PURE__ */ jsxs213(
|
|
40400
40423
|
Panel,
|
|
40401
40424
|
{
|
|
@@ -40426,7 +40449,7 @@ var Components = ({
|
|
|
40426
40449
|
hideTable = false,
|
|
40427
40450
|
stringOverrides
|
|
40428
40451
|
}) => {
|
|
40429
|
-
const { isError, isLoading, isValidating, refetch } =
|
|
40452
|
+
const { isError, isLoading, isValidating, refetch } = useContext61(
|
|
40430
40453
|
ProfitAndLoss2.Context
|
|
40431
40454
|
);
|
|
40432
40455
|
if (!isLoading && isError) {
|
|
@@ -40441,7 +40464,7 @@ var Components = ({
|
|
|
40441
40464
|
}
|
|
40442
40465
|
) });
|
|
40443
40466
|
}
|
|
40444
|
-
return /* @__PURE__ */ jsxs213(
|
|
40467
|
+
return /* @__PURE__ */ jsxs213(Fragment58, { children: [
|
|
40445
40468
|
!hideChart && /* @__PURE__ */ jsxs213("div", { className: `Layer__${COMPONENT_NAME10}__chart_with_summaries`, children: [
|
|
40446
40469
|
/* @__PURE__ */ jsxs213(
|
|
40447
40470
|
"div",
|
|
@@ -40477,7 +40500,7 @@ var Components = ({
|
|
|
40477
40500
|
};
|
|
40478
40501
|
|
|
40479
40502
|
// src/providers/InvoiceStore/InvoiceStoreProvider.tsx
|
|
40480
|
-
import { useState as useState86, createContext as
|
|
40503
|
+
import { useState as useState86, createContext as createContext27, useContext as useContext62, useMemo as useMemo86 } from "react";
|
|
40481
40504
|
import { createStore as createStore4, useStore as useStore7 } from "zustand";
|
|
40482
40505
|
|
|
40483
40506
|
// src/components/Invoices/InvoiceTable/InvoiceTable.tsx
|
|
@@ -40621,6 +40644,7 @@ var InvoiceStatus = /* @__PURE__ */ ((InvoiceStatus3) => {
|
|
|
40621
40644
|
InvoiceStatus3["PartiallyWrittenOff"] = "PARTIALLY_WRITTEN_OFF";
|
|
40622
40645
|
InvoiceStatus3["PartiallyPaid"] = "PARTIALLY_PAID";
|
|
40623
40646
|
InvoiceStatus3["Sent"] = "SENT";
|
|
40647
|
+
InvoiceStatus3["Refunded"] = "REFUNDED";
|
|
40624
40648
|
return InvoiceStatus3;
|
|
40625
40649
|
})(InvoiceStatus || {});
|
|
40626
40650
|
var InvoiceStatusSchema = Schema19.Enums(InvoiceStatus);
|
|
@@ -40747,8 +40771,7 @@ var UpsertInvoiceLineItemSchema = Schema19.Struct({
|
|
|
40747
40771
|
Schema19.fromKey("unit_price")
|
|
40748
40772
|
),
|
|
40749
40773
|
quantity: Schema19.BigDecimal,
|
|
40750
|
-
salesTaxes:
|
|
40751
|
-
Schema19.propertySignature(Schema19.UndefinedOr(Schema19.Array(UpsertInvoiceTaxLineItemSchema))),
|
|
40774
|
+
salesTaxes: Schema19.optional(Schema19.Array(UpsertInvoiceTaxLineItemSchema)).pipe(
|
|
40752
40775
|
Schema19.fromKey("sales_taxes")
|
|
40753
40776
|
)
|
|
40754
40777
|
});
|
|
@@ -40761,21 +40784,19 @@ var UpsertInvoiceSchema = Schema19.Struct({
|
|
|
40761
40784
|
Schema19.propertySignature(Schema19.Date),
|
|
40762
40785
|
Schema19.fromKey("due_at")
|
|
40763
40786
|
),
|
|
40764
|
-
invoiceNumber:
|
|
40765
|
-
Schema19.propertySignature(Schema19.UndefinedOr(Schema19.String)),
|
|
40787
|
+
invoiceNumber: Schema19.optional(Schema19.String).pipe(
|
|
40766
40788
|
Schema19.fromKey("invoice_number")
|
|
40767
40789
|
),
|
|
40768
40790
|
customerId: pipe11(
|
|
40769
40791
|
Schema19.propertySignature(Schema19.UUID),
|
|
40770
40792
|
Schema19.fromKey("customer_id")
|
|
40771
40793
|
),
|
|
40772
|
-
memo: Schema19.
|
|
40794
|
+
memo: Schema19.optional(Schema19.String),
|
|
40773
40795
|
lineItems: pipe11(
|
|
40774
40796
|
Schema19.propertySignature(Schema19.Array(UpsertInvoiceLineItemSchema)),
|
|
40775
40797
|
Schema19.fromKey("line_items")
|
|
40776
40798
|
),
|
|
40777
|
-
additionalDiscount:
|
|
40778
|
-
Schema19.propertySignature(Schema19.UndefinedOr(Schema19.Number)),
|
|
40799
|
+
additionalDiscount: Schema19.optional(Schema19.Number).pipe(
|
|
40779
40800
|
Schema19.fromKey("additional_discount")
|
|
40780
40801
|
)
|
|
40781
40802
|
});
|
|
@@ -40836,7 +40857,8 @@ var InvoiceSummaryStatsResponseSchema = Schema19.Struct({
|
|
|
40836
40857
|
var UpsertDedicatedInvoicePaymentSchema = Schema19.Struct({
|
|
40837
40858
|
amount: Schema19.Number,
|
|
40838
40859
|
method: PaymentMethodSchema,
|
|
40839
|
-
paidAt:
|
|
40860
|
+
paidAt: pipe11(
|
|
40861
|
+
Schema19.propertySignature(Schema19.Date),
|
|
40840
40862
|
Schema19.fromKey("paid_at")
|
|
40841
40863
|
),
|
|
40842
40864
|
referenceNumber: Schema19.optional(Schema19.String).pipe(
|
|
@@ -40847,7 +40869,7 @@ var UpsertDedicatedInvoicePaymentSchema = Schema19.Struct({
|
|
|
40847
40869
|
var DedicatedInvoicePaymentFormSchema = Schema19.Struct({
|
|
40848
40870
|
amount: Schema19.BigDecimal,
|
|
40849
40871
|
method: Schema19.NullOr(PaymentMethodSchema),
|
|
40850
|
-
paidAt: ZonedDateTimeFromSelf,
|
|
40872
|
+
paidAt: Schema19.NullOr(ZonedDateTimeFromSelf),
|
|
40851
40873
|
referenceNumber: Schema19.String,
|
|
40852
40874
|
memo: Schema19.String
|
|
40853
40875
|
});
|
|
@@ -41229,6 +41251,9 @@ var getDueStatusConfig = (invoice, { inline }) => {
|
|
|
41229
41251
|
case "PARTIALLY_WRITTEN_OFF" /* PartiallyWrittenOff */: {
|
|
41230
41252
|
return { text: "Partially Written Off" };
|
|
41231
41253
|
}
|
|
41254
|
+
case "REFUNDED" /* Refunded */: {
|
|
41255
|
+
return { text: "Refunded" };
|
|
41256
|
+
}
|
|
41232
41257
|
case "PAID" /* Paid */: {
|
|
41233
41258
|
return {
|
|
41234
41259
|
text: "Paid",
|
|
@@ -41294,6 +41319,7 @@ var InvoiceStatusOptionConfig = {
|
|
|
41294
41319
|
["Sent" /* Sent */]: { label: "Sent", value: "Sent" /* Sent */ },
|
|
41295
41320
|
["Paid" /* Paid */]: { label: "Paid", value: "Paid" /* Paid */ },
|
|
41296
41321
|
["Voided" /* Voided */]: { label: "Voided", value: "Voided" /* Voided */ },
|
|
41322
|
+
["Refunded" /* Refunded */]: { label: "Refunded", value: "Refunded" /* Refunded */ },
|
|
41297
41323
|
["Written Off" /* WrittenOff */]: { label: "Written Off", value: "Written Off" /* WrittenOff */ }
|
|
41298
41324
|
};
|
|
41299
41325
|
var ALL_OPTION = InvoiceStatusOptionConfig["All" /* All */];
|
|
@@ -41305,6 +41331,7 @@ var AmountCell = ({ invoice }) => {
|
|
|
41305
41331
|
case "PARTIALLY_WRITTEN_OFF" /* PartiallyWrittenOff */:
|
|
41306
41332
|
case "WRITTEN_OFF" /* WrittenOff */:
|
|
41307
41333
|
case "VOIDED" /* Voided */:
|
|
41334
|
+
case "REFUNDED" /* Refunded */:
|
|
41308
41335
|
case "SENT" /* Sent */: {
|
|
41309
41336
|
return /* @__PURE__ */ jsx348(VStack, { children: /* @__PURE__ */ jsx348(Span, { align: "right", children: totalAmount }) });
|
|
41310
41337
|
}
|
|
@@ -41380,6 +41407,8 @@ var getListInvoiceParams = ({ status }) => {
|
|
|
41380
41407
|
return { status: ["WRITTEN_OFF" /* WrittenOff */, "PARTIALLY_WRITTEN_OFF" /* PartiallyWrittenOff */] };
|
|
41381
41408
|
case "Voided" /* Voided */:
|
|
41382
41409
|
return { status: ["VOIDED" /* Voided */] };
|
|
41410
|
+
case "Refunded" /* Refunded */:
|
|
41411
|
+
return { status: ["REFUNDED" /* Refunded */] };
|
|
41383
41412
|
default:
|
|
41384
41413
|
unsafeAssertUnreachable({
|
|
41385
41414
|
value: statusFilter,
|
|
@@ -41689,7 +41718,7 @@ var useUpsertInvoice = (props) => {
|
|
|
41689
41718
|
|
|
41690
41719
|
// src/providers/InvoiceStore/InvoiceStoreProvider.tsx
|
|
41691
41720
|
import { jsx as jsx349 } from "react/jsx-runtime";
|
|
41692
|
-
var InvoiceStoreContext =
|
|
41721
|
+
var InvoiceStoreContext = createContext27(
|
|
41693
41722
|
createStore4(() => ({
|
|
41694
41723
|
routeState: { route: "Table" /* Table */ },
|
|
41695
41724
|
tableQuery: { status: ALL_OPTION },
|
|
@@ -41709,7 +41738,7 @@ var isInvoiceDetail = (routeState) => {
|
|
|
41709
41738
|
return routeState.route === "Detail" /* Detail */;
|
|
41710
41739
|
};
|
|
41711
41740
|
function useInvoiceRouteState() {
|
|
41712
|
-
const store =
|
|
41741
|
+
const store = useContext62(InvoiceStoreContext);
|
|
41713
41742
|
return useStore7(store, (state) => state.routeState);
|
|
41714
41743
|
}
|
|
41715
41744
|
function useInvoiceDetail() {
|
|
@@ -41719,13 +41748,13 @@ function useInvoiceDetail() {
|
|
|
41719
41748
|
return invoiceDetail;
|
|
41720
41749
|
}
|
|
41721
41750
|
function useInvoiceTableQuery() {
|
|
41722
|
-
const store =
|
|
41751
|
+
const store = useContext62(InvoiceStoreContext);
|
|
41723
41752
|
const query = useStore7(store, (state) => state.tableQuery);
|
|
41724
41753
|
const setQuery = useStore7(store, (state) => state.setTableQuery);
|
|
41725
41754
|
return useMemo86(() => ({ query, setQuery }), [query, setQuery]);
|
|
41726
41755
|
}
|
|
41727
41756
|
function useInvoiceNavigation() {
|
|
41728
|
-
const store =
|
|
41757
|
+
const store = useContext62(InvoiceStoreContext);
|
|
41729
41758
|
return useStore7(store, (state) => state.navigate);
|
|
41730
41759
|
}
|
|
41731
41760
|
function InvoiceStoreProvider(props) {
|
|
@@ -41770,7 +41799,7 @@ function InvoiceStoreProvider(props) {
|
|
|
41770
41799
|
}
|
|
41771
41800
|
|
|
41772
41801
|
// src/components/Invoices/InvoiceDetail/InvoiceDetail.tsx
|
|
41773
|
-
import { useCallback as
|
|
41802
|
+
import { useCallback as useCallback86, useMemo as useMemo92, useRef as useRef35, useState as useState91 } from "react";
|
|
41774
41803
|
|
|
41775
41804
|
// src/components/Invoices/InvoiceForm/InvoiceForm.tsx
|
|
41776
41805
|
import { forwardRef as forwardRef26, useCallback as useCallback72, useEffect as useEffect38, useImperativeHandle as useImperativeHandle4, useRef as useRef31 } from "react";
|
|
@@ -42435,7 +42464,7 @@ var DataPoint = ({ label, children }) => {
|
|
|
42435
42464
|
};
|
|
42436
42465
|
|
|
42437
42466
|
// src/components/Invoices/InvoiceDetail/InvoiceDetail.tsx
|
|
42438
|
-
import {
|
|
42467
|
+
import { HandCoins as HandCoins2, Save as Save2 } from "lucide-react";
|
|
42439
42468
|
|
|
42440
42469
|
// src/components/Invoices/InvoicePaymentForm/InvoicePaymentForm.tsx
|
|
42441
42470
|
import { useCallback as useCallback76 } from "react";
|
|
@@ -42584,7 +42613,7 @@ import { Schema as Schema25 } from "effect";
|
|
|
42584
42613
|
// src/components/Invoices/InvoicePaymentForm/formUtils.ts
|
|
42585
42614
|
import { BigDecimal as BD7 } from "effect";
|
|
42586
42615
|
import { formatDate as formatDate2, startOfToday as startOfToday3 } from "date-fns";
|
|
42587
|
-
import { getLocalTimeZone as getLocalTimeZone2, fromDate as fromDate3, toCalendarDate as toCalendarDate3 } from "@internationalized/date";
|
|
42616
|
+
import { getLocalTimeZone as getLocalTimeZone2, fromDate as fromDate3, toCalendarDate as toCalendarDate3, today } from "@internationalized/date";
|
|
42588
42617
|
var getInvoicePaymentFormDefaultValues = (invoice) => {
|
|
42589
42618
|
const paidAt = fromDate3(startOfToday3(), getLocalTimeZone2());
|
|
42590
42619
|
return {
|
|
@@ -42607,21 +42636,27 @@ var validateInvoicePaymentForm = ({ invoicePayment, invoice }) => {
|
|
|
42607
42636
|
if (paidAt === null) {
|
|
42608
42637
|
errors.push({ paidAt: "Payment date is a required field." });
|
|
42609
42638
|
}
|
|
42610
|
-
if (invoice.sentAt && toCalendarDate3(paidAt).compare(toCalendarDate3(fromDate3(invoice.sentAt, "UTC"))) < 0) {
|
|
42639
|
+
if (paidAt && invoice.sentAt && toCalendarDate3(paidAt).compare(toCalendarDate3(fromDate3(invoice.sentAt, "UTC"))) < 0) {
|
|
42611
42640
|
errors.push({ paidAt: `Payment date cannot be before the invoice date (${formatDate2(invoice.sentAt, DATE_FORMAT_SHORT)}).` });
|
|
42612
42641
|
}
|
|
42642
|
+
if (paidAt && toCalendarDate3(paidAt).compare(today(getLocalTimeZone2())) > 0) {
|
|
42643
|
+
errors.push({ paidAt: "Payment date cannot be in the future." });
|
|
42644
|
+
}
|
|
42613
42645
|
if (method === null) {
|
|
42614
42646
|
errors.push({ method: "Payment method is a required field." });
|
|
42615
42647
|
}
|
|
42616
42648
|
return errors.length > 0 ? errors : null;
|
|
42617
42649
|
};
|
|
42618
|
-
var convertInvoicePaymentFormToParams = (form) =>
|
|
42619
|
-
|
|
42620
|
-
|
|
42621
|
-
|
|
42622
|
-
|
|
42623
|
-
|
|
42624
|
-
|
|
42650
|
+
var convertInvoicePaymentFormToParams = (form) => {
|
|
42651
|
+
var _a;
|
|
42652
|
+
return {
|
|
42653
|
+
amount: convertBigDecimalToCents(form.amount),
|
|
42654
|
+
method: form.method,
|
|
42655
|
+
paidAt: (_a = form.paidAt) == null ? void 0 : _a.toDate(),
|
|
42656
|
+
referenceNumber: form.referenceNumber.trim() || void 0,
|
|
42657
|
+
memo: form.memo.trim() || void 0
|
|
42658
|
+
};
|
|
42659
|
+
};
|
|
42625
42660
|
|
|
42626
42661
|
// src/components/Invoices/InvoicePaymentForm/useInvoicePaymentForm.ts
|
|
42627
42662
|
var useInvoicePaymentForm = (props) => {
|
|
@@ -42770,40 +42805,788 @@ var InvoicePaymentForm = (props) => {
|
|
|
42770
42805
|
] });
|
|
42771
42806
|
};
|
|
42772
42807
|
|
|
42808
|
+
// src/components/Invoices/InvoiceDetail/InvoiceDetailHeaderMenu.tsx
|
|
42809
|
+
import { useCallback as useCallback85, useState as useState90 } from "react";
|
|
42810
|
+
import { Menu as MenuIcon } from "lucide-react";
|
|
42811
|
+
|
|
42812
|
+
// src/features/invoices/api/useVoidInvoice.tsx
|
|
42813
|
+
import { useCallback as useCallback77 } from "react";
|
|
42814
|
+
import useSWRMutation30 from "swr/mutation";
|
|
42815
|
+
import { Schema as Schema26 } from "effect";
|
|
42816
|
+
var VOID_INVOICE_TAG_KEY = "#void-invoice";
|
|
42817
|
+
var VoidInvoiceReturnSchema = Schema26.Struct({
|
|
42818
|
+
data: InvoiceSchema
|
|
42819
|
+
});
|
|
42820
|
+
var voidInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/void`);
|
|
42821
|
+
function buildKey46({
|
|
42822
|
+
access_token: accessToken,
|
|
42823
|
+
apiUrl,
|
|
42824
|
+
businessId,
|
|
42825
|
+
invoiceId
|
|
42826
|
+
}) {
|
|
42827
|
+
if (accessToken && apiUrl) {
|
|
42828
|
+
return {
|
|
42829
|
+
accessToken,
|
|
42830
|
+
apiUrl,
|
|
42831
|
+
businessId,
|
|
42832
|
+
invoiceId,
|
|
42833
|
+
tags: [VOID_INVOICE_TAG_KEY]
|
|
42834
|
+
};
|
|
42835
|
+
}
|
|
42836
|
+
}
|
|
42837
|
+
var VoidInvoiceSWRResponse = class {
|
|
42838
|
+
constructor(swrResponse) {
|
|
42839
|
+
__publicField(this, "swrResponse");
|
|
42840
|
+
this.swrResponse = swrResponse;
|
|
42841
|
+
}
|
|
42842
|
+
get data() {
|
|
42843
|
+
return this.swrResponse.data;
|
|
42844
|
+
}
|
|
42845
|
+
get trigger() {
|
|
42846
|
+
return this.swrResponse.trigger;
|
|
42847
|
+
}
|
|
42848
|
+
get isMutating() {
|
|
42849
|
+
return this.swrResponse.isMutating;
|
|
42850
|
+
}
|
|
42851
|
+
get isError() {
|
|
42852
|
+
return this.swrResponse.error !== void 0;
|
|
42853
|
+
}
|
|
42854
|
+
};
|
|
42855
|
+
var useVoidInvoice = ({ invoiceId }) => {
|
|
42856
|
+
const { data } = useAuth();
|
|
42857
|
+
const { businessId } = useLayerContext();
|
|
42858
|
+
const rawMutationResponse = useSWRMutation30(
|
|
42859
|
+
() => buildKey46(__spreadProps(__spreadValues({}, data), {
|
|
42860
|
+
businessId,
|
|
42861
|
+
invoiceId
|
|
42862
|
+
})),
|
|
42863
|
+
({ accessToken, apiUrl, businessId: businessId2, invoiceId: invoiceId2 }) => {
|
|
42864
|
+
return voidInvoice(
|
|
42865
|
+
apiUrl,
|
|
42866
|
+
accessToken,
|
|
42867
|
+
{ params: { businessId: businessId2, invoiceId: invoiceId2 } }
|
|
42868
|
+
).then(Schema26.decodeUnknownPromise(VoidInvoiceReturnSchema));
|
|
42869
|
+
},
|
|
42870
|
+
{
|
|
42871
|
+
revalidate: false,
|
|
42872
|
+
throwOnError: true
|
|
42873
|
+
}
|
|
42874
|
+
);
|
|
42875
|
+
const mutationResponse = new VoidInvoiceSWRResponse(rawMutationResponse);
|
|
42876
|
+
const { patchInvoiceByKey } = useInvoicesGlobalCacheActions();
|
|
42877
|
+
const { forceReloadInvoiceSummaryStats } = useInvoiceSummaryStatsCacheActions();
|
|
42878
|
+
const originalTrigger = mutationResponse.trigger;
|
|
42879
|
+
const stableProxiedTrigger = useCallback77(
|
|
42880
|
+
(...triggerParameters) => __async(null, null, function* () {
|
|
42881
|
+
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
42882
|
+
void patchInvoiceByKey(triggerResult.data);
|
|
42883
|
+
void forceReloadInvoiceSummaryStats();
|
|
42884
|
+
return triggerResult;
|
|
42885
|
+
}),
|
|
42886
|
+
[originalTrigger, patchInvoiceByKey, forceReloadInvoiceSummaryStats]
|
|
42887
|
+
);
|
|
42888
|
+
return new Proxy(mutationResponse, {
|
|
42889
|
+
get(target, prop) {
|
|
42890
|
+
if (prop === "trigger") {
|
|
42891
|
+
return stableProxiedTrigger;
|
|
42892
|
+
}
|
|
42893
|
+
return Reflect.get(target, prop);
|
|
42894
|
+
}
|
|
42895
|
+
});
|
|
42896
|
+
};
|
|
42897
|
+
|
|
42898
|
+
// src/components/Invoices/Modal/InvoiceVoidModal.tsx
|
|
42899
|
+
import { useCallback as useCallback78 } from "react";
|
|
42900
|
+
import { jsx as jsx355 } from "react/jsx-runtime";
|
|
42901
|
+
function InvoiceVoidModal({ isOpen, onOpenChange, invoiceId, onSuccess }) {
|
|
42902
|
+
const { trigger: voidInvoice2 } = useVoidInvoice({ invoiceId });
|
|
42903
|
+
const onConfirm = useCallback78(() => __async(null, null, function* () {
|
|
42904
|
+
const { data: invoice } = yield voidInvoice2();
|
|
42905
|
+
onSuccess(invoice);
|
|
42906
|
+
}), [onSuccess, voidInvoice2]);
|
|
42907
|
+
return /* @__PURE__ */ jsx355(
|
|
42908
|
+
BaseConfirmationModal,
|
|
42909
|
+
{
|
|
42910
|
+
isOpen,
|
|
42911
|
+
onOpenChange,
|
|
42912
|
+
title: "Void invoice",
|
|
42913
|
+
description: "Voiding this invoice will mark it as cancelled, and you will no longer be able to apply payments to it. This action cannot be undone.",
|
|
42914
|
+
onConfirm,
|
|
42915
|
+
confirmLabel: "Void Invoice",
|
|
42916
|
+
errorText: "There was an error voiding this invoice. Please check your connection and try again in a few seconds."
|
|
42917
|
+
}
|
|
42918
|
+
);
|
|
42919
|
+
}
|
|
42920
|
+
|
|
42921
|
+
// src/features/invoices/api/useWriteoffInvoice.tsx
|
|
42922
|
+
import { Schema as Schema28 } from "effect";
|
|
42923
|
+
import { useCallback as useCallback79 } from "react";
|
|
42924
|
+
import useSWRMutation31 from "swr/mutation";
|
|
42925
|
+
|
|
42926
|
+
// src/features/invoices/invoiceWriteoffSchemas.ts
|
|
42927
|
+
import { Schema as Schema27, pipe as pipe12 } from "effect";
|
|
42928
|
+
var InvoiceWriteoffMode = /* @__PURE__ */ ((InvoiceWriteoffMode2) => {
|
|
42929
|
+
InvoiceWriteoffMode2["Expense"] = "EXPENSE";
|
|
42930
|
+
InvoiceWriteoffMode2["RevenueReversal"] = "REVENUE_REVERSAL";
|
|
42931
|
+
return InvoiceWriteoffMode2;
|
|
42932
|
+
})(InvoiceWriteoffMode || {});
|
|
42933
|
+
var InvoiceWriteoffModeSchema = Schema27.Enums(InvoiceWriteoffMode);
|
|
42934
|
+
var TransformedInvoiceWriteoffModeSchema = Schema27.transform(
|
|
42935
|
+
Schema27.NonEmptyTrimmedString,
|
|
42936
|
+
Schema27.typeSchema(InvoiceWriteoffModeSchema),
|
|
42937
|
+
{
|
|
42938
|
+
decode: (input) => {
|
|
42939
|
+
if (Object.values(InvoiceWriteoffModeSchema.enums).includes(input)) {
|
|
42940
|
+
return input;
|
|
42941
|
+
}
|
|
42942
|
+
return "EXPENSE" /* Expense */;
|
|
42943
|
+
},
|
|
42944
|
+
encode: (input) => input
|
|
42945
|
+
}
|
|
42946
|
+
);
|
|
42947
|
+
var CreateInvoiceWriteoffSchema = Schema27.Struct({
|
|
42948
|
+
externalId: Schema27.optional(Schema27.String).pipe(
|
|
42949
|
+
Schema27.fromKey("external_id")
|
|
42950
|
+
),
|
|
42951
|
+
amount: Schema27.Number,
|
|
42952
|
+
writeOffMode: Schema27.optional(InvoiceWriteoffModeSchema).pipe(
|
|
42953
|
+
Schema27.fromKey("write_off_mode")
|
|
42954
|
+
),
|
|
42955
|
+
writeOffAt: pipe12(
|
|
42956
|
+
Schema27.propertySignature(Schema27.Date),
|
|
42957
|
+
Schema27.fromKey("write_off_at")
|
|
42958
|
+
),
|
|
42959
|
+
referenceNumber: Schema27.optional(Schema27.String).pipe(
|
|
42960
|
+
Schema27.fromKey("reference_number")
|
|
42961
|
+
),
|
|
42962
|
+
memo: Schema27.optional(Schema27.String)
|
|
42963
|
+
});
|
|
42964
|
+
var InvoiceWriteoffSchema = Schema27.Struct({
|
|
42965
|
+
invoiceId: pipe12(
|
|
42966
|
+
Schema27.propertySignature(Schema27.UUID),
|
|
42967
|
+
Schema27.fromKey("invoice_id")
|
|
42968
|
+
),
|
|
42969
|
+
externalId: pipe12(
|
|
42970
|
+
Schema27.propertySignature(Schema27.NullOr(Schema27.String)),
|
|
42971
|
+
Schema27.fromKey("external_id")
|
|
42972
|
+
),
|
|
42973
|
+
amount: Schema27.Number,
|
|
42974
|
+
writeOffMode: pipe12(
|
|
42975
|
+
Schema27.propertySignature(TransformedInvoiceWriteoffModeSchema),
|
|
42976
|
+
Schema27.fromKey("write_off_mode")
|
|
42977
|
+
),
|
|
42978
|
+
writeOffAt: pipe12(
|
|
42979
|
+
Schema27.propertySignature(Schema27.Date),
|
|
42980
|
+
Schema27.fromKey("write_off_at")
|
|
42981
|
+
),
|
|
42982
|
+
referenceNumber: pipe12(
|
|
42983
|
+
Schema27.propertySignature(Schema27.NullOr(Schema27.String)),
|
|
42984
|
+
Schema27.fromKey("reference_number")
|
|
42985
|
+
),
|
|
42986
|
+
memo: Schema27.NullOr(Schema27.String)
|
|
42987
|
+
});
|
|
42988
|
+
|
|
42989
|
+
// src/features/invoices/api/useWriteoffInvoice.tsx
|
|
42990
|
+
var CREATE_INVOICE_WRITEOFF_TAG_KEY = "#writeoff-invoice";
|
|
42991
|
+
var writeoffInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/write-off`);
|
|
42992
|
+
function buildKey47({
|
|
42993
|
+
access_token: accessToken,
|
|
42994
|
+
apiUrl,
|
|
42995
|
+
businessId,
|
|
42996
|
+
invoiceId,
|
|
42997
|
+
invoiceWriteoffId = void 0
|
|
42998
|
+
}) {
|
|
42999
|
+
if (accessToken && apiUrl) {
|
|
43000
|
+
return {
|
|
43001
|
+
accessToken,
|
|
43002
|
+
apiUrl,
|
|
43003
|
+
businessId,
|
|
43004
|
+
invoiceId,
|
|
43005
|
+
invoiceWriteoffId,
|
|
43006
|
+
tags: [CREATE_INVOICE_WRITEOFF_TAG_KEY]
|
|
43007
|
+
};
|
|
43008
|
+
}
|
|
43009
|
+
}
|
|
43010
|
+
var WriteoffInvoiceReturnSchema = Schema28.Struct({
|
|
43011
|
+
data: InvoiceWriteoffSchema
|
|
43012
|
+
});
|
|
43013
|
+
var WriteoffInvoiceSWRResponse = class {
|
|
43014
|
+
constructor(swrResponse) {
|
|
43015
|
+
__publicField(this, "swrResponse");
|
|
43016
|
+
this.swrResponse = swrResponse;
|
|
43017
|
+
}
|
|
43018
|
+
get data() {
|
|
43019
|
+
return this.swrResponse.data;
|
|
43020
|
+
}
|
|
43021
|
+
get trigger() {
|
|
43022
|
+
return this.swrResponse.trigger;
|
|
43023
|
+
}
|
|
43024
|
+
get isMutating() {
|
|
43025
|
+
return this.swrResponse.isMutating;
|
|
43026
|
+
}
|
|
43027
|
+
get isError() {
|
|
43028
|
+
return this.swrResponse.error !== void 0;
|
|
43029
|
+
}
|
|
43030
|
+
};
|
|
43031
|
+
var updateInvoiceWithWriteoff = (invoice) => {
|
|
43032
|
+
const status = invoice.status === "PARTIALLY_PAID" /* PartiallyPaid */ ? "PARTIALLY_WRITTEN_OFF" /* PartiallyWrittenOff */ : "WRITTEN_OFF" /* WrittenOff */;
|
|
43033
|
+
return __spreadProps(__spreadValues({}, invoice), { status, outstandingBalance: 0 });
|
|
43034
|
+
};
|
|
43035
|
+
var useWriteoffInvoice = ({ invoiceId }) => {
|
|
43036
|
+
const { data } = useAuth();
|
|
43037
|
+
const { businessId } = useLayerContext();
|
|
43038
|
+
const applyWriteoffToInvoice = useCallback79(() => (invoice) => {
|
|
43039
|
+
if (invoice.id !== invoiceId) return invoice;
|
|
43040
|
+
return updateInvoiceWithWriteoff(invoice);
|
|
43041
|
+
}, [invoiceId]);
|
|
43042
|
+
const rawMutationResponse = useSWRMutation31(
|
|
43043
|
+
() => buildKey47(__spreadProps(__spreadValues({}, data), {
|
|
43044
|
+
businessId,
|
|
43045
|
+
invoiceId
|
|
43046
|
+
})),
|
|
43047
|
+
({ accessToken, apiUrl, businessId: businessId2, invoiceId: invoiceId2 }, { arg: decodedBody }) => {
|
|
43048
|
+
const body = Schema28.encodeSync(CreateInvoiceWriteoffSchema)(decodedBody);
|
|
43049
|
+
return writeoffInvoice(
|
|
43050
|
+
apiUrl,
|
|
43051
|
+
accessToken,
|
|
43052
|
+
{ params: { businessId: businessId2, invoiceId: invoiceId2 }, body }
|
|
43053
|
+
).then(Schema28.decodeUnknownPromise(WriteoffInvoiceReturnSchema));
|
|
43054
|
+
},
|
|
43055
|
+
{
|
|
43056
|
+
revalidate: false,
|
|
43057
|
+
throwOnError: true
|
|
43058
|
+
}
|
|
43059
|
+
);
|
|
43060
|
+
const mutationResponse = new WriteoffInvoiceSWRResponse(rawMutationResponse);
|
|
43061
|
+
const { patchInvoiceWithTransformation } = useInvoicesGlobalCacheActions();
|
|
43062
|
+
const { forceReloadInvoiceSummaryStats } = useInvoiceSummaryStatsCacheActions();
|
|
43063
|
+
const originalTrigger = mutationResponse.trigger;
|
|
43064
|
+
const stableProxiedTrigger = useCallback79(
|
|
43065
|
+
(...triggerParameters) => __async(null, null, function* () {
|
|
43066
|
+
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
43067
|
+
void patchInvoiceWithTransformation(applyWriteoffToInvoice());
|
|
43068
|
+
void forceReloadInvoiceSummaryStats();
|
|
43069
|
+
return triggerResult;
|
|
43070
|
+
}),
|
|
43071
|
+
[originalTrigger, patchInvoiceWithTransformation, applyWriteoffToInvoice, forceReloadInvoiceSummaryStats]
|
|
43072
|
+
);
|
|
43073
|
+
return new Proxy(mutationResponse, {
|
|
43074
|
+
get(target, prop) {
|
|
43075
|
+
if (prop === "trigger") {
|
|
43076
|
+
return stableProxiedTrigger;
|
|
43077
|
+
}
|
|
43078
|
+
return Reflect.get(target, prop);
|
|
43079
|
+
}
|
|
43080
|
+
});
|
|
43081
|
+
};
|
|
43082
|
+
|
|
43083
|
+
// src/components/Invoices/Modal/InvoiceWriteoffModal.tsx
|
|
43084
|
+
import { useCallback as useCallback80 } from "react";
|
|
43085
|
+
import { jsx as jsx356 } from "react/jsx-runtime";
|
|
43086
|
+
function InvoiceWriteoffModal({ isOpen, onOpenChange, invoice, onSuccess }) {
|
|
43087
|
+
const { trigger: writeoffInvoice2 } = useWriteoffInvoice({ invoiceId: invoice.id });
|
|
43088
|
+
const onConfirm = useCallback80(() => __async(null, null, function* () {
|
|
43089
|
+
yield writeoffInvoice2({
|
|
43090
|
+
writeOffAt: /* @__PURE__ */ new Date(),
|
|
43091
|
+
amount: invoice.outstandingBalance
|
|
43092
|
+
});
|
|
43093
|
+
onSuccess(updateInvoiceWithWriteoff(invoice));
|
|
43094
|
+
}), [invoice, onSuccess, writeoffInvoice2]);
|
|
43095
|
+
return /* @__PURE__ */ jsx356(
|
|
43096
|
+
BaseConfirmationModal,
|
|
43097
|
+
{
|
|
43098
|
+
isOpen,
|
|
43099
|
+
onOpenChange,
|
|
43100
|
+
title: "Write off invoice",
|
|
43101
|
+
description: "Writing off this invoice will record it as bad debt, and you will no longer be able to apply payments to it. This action cannot be undone.",
|
|
43102
|
+
onConfirm,
|
|
43103
|
+
confirmLabel: "Write Off Invoice",
|
|
43104
|
+
errorText: "There was an error writing off this invoice. Please check your connection and try again in a few seconds."
|
|
43105
|
+
}
|
|
43106
|
+
);
|
|
43107
|
+
}
|
|
43108
|
+
|
|
43109
|
+
// src/components/Invoices/Modal/InvoiceResetModal.tsx
|
|
43110
|
+
import { jsx as jsx357 } from "react/jsx-runtime";
|
|
43111
|
+
function InvoiceResetModal({ isOpen, onOpenChange, invoiceId: _invoiceId }) {
|
|
43112
|
+
return /* @__PURE__ */ jsx357(
|
|
43113
|
+
BaseConfirmationModal,
|
|
43114
|
+
{
|
|
43115
|
+
isOpen,
|
|
43116
|
+
onOpenChange,
|
|
43117
|
+
title: "Reset invoice to sent",
|
|
43118
|
+
description: "Resetting this invoice will delete all payments, refunds, and write offs associated with it. This action cannot be undone.",
|
|
43119
|
+
onConfirm: () => {
|
|
43120
|
+
},
|
|
43121
|
+
confirmLabel: "Reset Invoice",
|
|
43122
|
+
errorText: "There was an error resetting this invoice. Please check your connection and try again in a few seconds."
|
|
43123
|
+
}
|
|
43124
|
+
);
|
|
43125
|
+
}
|
|
43126
|
+
|
|
43127
|
+
// src/components/Invoices/Modal/InvoiceRefundModal.tsx
|
|
43128
|
+
import { useCallback as useCallback84, useMemo as useMemo91, useRef as useRef34 } from "react";
|
|
43129
|
+
|
|
43130
|
+
// src/components/Invoices/InvoiceRefundForm/InvoiceRefundForm.tsx
|
|
43131
|
+
import { forwardRef as forwardRef27, useCallback as useCallback83, useImperativeHandle as useImperativeHandle5 } from "react";
|
|
43132
|
+
import { AlertTriangle as AlertTriangle3 } from "lucide-react";
|
|
43133
|
+
|
|
43134
|
+
// src/components/Invoices/InvoiceRefundForm/useInvoiceRefundForm.ts
|
|
43135
|
+
import { useCallback as useCallback82, useMemo as useMemo90, useState as useState89, useRef as useRef33 } from "react";
|
|
43136
|
+
import { revalidateLogic as revalidateLogic3 } from "@tanstack/react-form";
|
|
43137
|
+
import { Schema as Schema31 } from "effect";
|
|
43138
|
+
|
|
43139
|
+
// src/components/Invoices/InvoiceRefundForm/formUtils.ts
|
|
43140
|
+
import { formatDate as formatDate3, startOfToday as startOfToday4 } from "date-fns";
|
|
43141
|
+
import { getLocalTimeZone as getLocalTimeZone3, fromDate as fromDate4, toCalendarDate as toCalendarDate4, today as today2 } from "@internationalized/date";
|
|
43142
|
+
var getInvoiceRefundFormDefaultValues = (invoice) => {
|
|
43143
|
+
const completedAt = fromDate4(startOfToday4(), getLocalTimeZone3());
|
|
43144
|
+
return {
|
|
43145
|
+
amount: convertCentsToBigDecimal(invoice.totalAmount),
|
|
43146
|
+
method: null,
|
|
43147
|
+
completedAt
|
|
43148
|
+
};
|
|
43149
|
+
};
|
|
43150
|
+
var validateInvoiceRefundForm = ({ invoiceRefund, invoice }) => {
|
|
43151
|
+
const { completedAt, method } = invoiceRefund;
|
|
43152
|
+
const errors = [];
|
|
43153
|
+
if (completedAt === null) {
|
|
43154
|
+
errors.push({ completedAt: "Refund date is a required field." });
|
|
43155
|
+
}
|
|
43156
|
+
if (completedAt && invoice.paidAt && toCalendarDate4(completedAt).compare(toCalendarDate4(fromDate4(invoice.paidAt, "UTC"))) < 0) {
|
|
43157
|
+
errors.push({ completedAt: `Refund date cannot be before the last invoice payment (${formatDate3(invoice.paidAt, DATE_FORMAT_SHORT)}).` });
|
|
43158
|
+
}
|
|
43159
|
+
if (completedAt && toCalendarDate4(completedAt).compare(today2(getLocalTimeZone3())) > 0) {
|
|
43160
|
+
errors.push({ completedAt: "Refund date cannot be in the future." });
|
|
43161
|
+
}
|
|
43162
|
+
if (method === null) {
|
|
43163
|
+
errors.push({ method: "Payment method is a required field." });
|
|
43164
|
+
}
|
|
43165
|
+
return errors.length > 0 ? errors : null;
|
|
43166
|
+
};
|
|
43167
|
+
var convertInvoiceRefundFormToParams = (form) => {
|
|
43168
|
+
var _a;
|
|
43169
|
+
return {
|
|
43170
|
+
amount: convertBigDecimalToCents(form.amount),
|
|
43171
|
+
method: form.method,
|
|
43172
|
+
completedAt: (_a = form.completedAt) == null ? void 0 : _a.toDate()
|
|
43173
|
+
};
|
|
43174
|
+
};
|
|
43175
|
+
|
|
43176
|
+
// src/features/invoices/customerRefundSchemas.ts
|
|
43177
|
+
import { Schema as Schema29, pipe as pipe13 } from "effect";
|
|
43178
|
+
var CustomerRefundStatus = /* @__PURE__ */ ((CustomerRefundStatus2) => {
|
|
43179
|
+
CustomerRefundStatus2["Paid"] = "PAID";
|
|
43180
|
+
CustomerRefundStatus2["PartiallyPaid"] = "PARTIALLY_PAID";
|
|
43181
|
+
CustomerRefundStatus2["Sent"] = "SENT";
|
|
43182
|
+
return CustomerRefundStatus2;
|
|
43183
|
+
})(CustomerRefundStatus || {});
|
|
43184
|
+
var CustomerRefundStatusSchema = Schema29.Enums(CustomerRefundStatus);
|
|
43185
|
+
var TransformedCustomerRefundStatusSchema = Schema29.transform(
|
|
43186
|
+
Schema29.NonEmptyTrimmedString,
|
|
43187
|
+
Schema29.typeSchema(CustomerRefundStatusSchema),
|
|
43188
|
+
{
|
|
43189
|
+
decode: (input) => {
|
|
43190
|
+
if (Object.values(CustomerRefundStatusSchema.enums).includes(input)) {
|
|
43191
|
+
return input;
|
|
43192
|
+
}
|
|
43193
|
+
return "SENT" /* Sent */;
|
|
43194
|
+
},
|
|
43195
|
+
encode: (input) => input
|
|
43196
|
+
}
|
|
43197
|
+
);
|
|
43198
|
+
var CreateCustomerRefundSchema = Schema29.Struct({
|
|
43199
|
+
externalId: Schema29.optional(Schema29.String).pipe(
|
|
43200
|
+
Schema29.fromKey("external_id")
|
|
43201
|
+
),
|
|
43202
|
+
refundedAmount: Schema29.optional(Schema29.Number).pipe(
|
|
43203
|
+
Schema29.fromKey("refunded_amount")
|
|
43204
|
+
),
|
|
43205
|
+
completedAt: pipe13(
|
|
43206
|
+
Schema29.propertySignature(Schema29.Date),
|
|
43207
|
+
Schema29.fromKey("completed_at")
|
|
43208
|
+
),
|
|
43209
|
+
method: PaymentMethodSchema,
|
|
43210
|
+
referenceNumber: Schema29.optional(Schema29.String).pipe(
|
|
43211
|
+
Schema29.fromKey("reference_number")
|
|
43212
|
+
),
|
|
43213
|
+
memo: Schema29.optional(Schema29.String)
|
|
43214
|
+
});
|
|
43215
|
+
var CustomerRefundSchema = Schema29.Struct({
|
|
43216
|
+
externalId: pipe13(
|
|
43217
|
+
Schema29.propertySignature(Schema29.UndefinedOr(Schema29.String)),
|
|
43218
|
+
Schema29.fromKey("external_id")
|
|
43219
|
+
),
|
|
43220
|
+
refundedAmount: pipe13(
|
|
43221
|
+
Schema29.propertySignature(Schema29.Number),
|
|
43222
|
+
Schema29.fromKey("refunded_amount")
|
|
43223
|
+
),
|
|
43224
|
+
status: TransformedCustomerRefundStatusSchema,
|
|
43225
|
+
completedAt: pipe13(
|
|
43226
|
+
Schema29.propertySignature(Schema29.Date),
|
|
43227
|
+
Schema29.fromKey("completed_at")
|
|
43228
|
+
),
|
|
43229
|
+
isDedicated: pipe13(
|
|
43230
|
+
Schema29.propertySignature(Schema29.Boolean),
|
|
43231
|
+
Schema29.fromKey("is_dedicated")
|
|
43232
|
+
),
|
|
43233
|
+
referenceNumber: pipe13(
|
|
43234
|
+
Schema29.propertySignature(Schema29.NullOr(Schema29.String)),
|
|
43235
|
+
Schema29.fromKey("reference_number")
|
|
43236
|
+
),
|
|
43237
|
+
memo: Schema29.NullOr(Schema29.String)
|
|
43238
|
+
});
|
|
43239
|
+
|
|
43240
|
+
// src/features/invoices/api/useRefundInvoice.tsx
|
|
43241
|
+
import { useCallback as useCallback81 } from "react";
|
|
43242
|
+
import useSWRMutation32 from "swr/mutation";
|
|
43243
|
+
import { Schema as Schema30 } from "effect";
|
|
43244
|
+
var REFUND_INVOICE_TAG_KEY = "#refund-invoice";
|
|
43245
|
+
var RefundInvoiceReturnSchema = Schema30.Struct({
|
|
43246
|
+
data: CustomerRefundSchema
|
|
43247
|
+
});
|
|
43248
|
+
var refundInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/refund`);
|
|
43249
|
+
function buildKey48({
|
|
43250
|
+
access_token: accessToken,
|
|
43251
|
+
apiUrl,
|
|
43252
|
+
businessId,
|
|
43253
|
+
invoiceId
|
|
43254
|
+
}) {
|
|
43255
|
+
if (accessToken && apiUrl) {
|
|
43256
|
+
return {
|
|
43257
|
+
accessToken,
|
|
43258
|
+
apiUrl,
|
|
43259
|
+
businessId,
|
|
43260
|
+
invoiceId,
|
|
43261
|
+
tags: [REFUND_INVOICE_TAG_KEY]
|
|
43262
|
+
};
|
|
43263
|
+
}
|
|
43264
|
+
}
|
|
43265
|
+
var RefundInvoiceSWRResponse = class {
|
|
43266
|
+
constructor(swrResponse) {
|
|
43267
|
+
__publicField(this, "swrResponse");
|
|
43268
|
+
this.swrResponse = swrResponse;
|
|
43269
|
+
}
|
|
43270
|
+
get data() {
|
|
43271
|
+
return this.swrResponse.data;
|
|
43272
|
+
}
|
|
43273
|
+
get trigger() {
|
|
43274
|
+
return this.swrResponse.trigger;
|
|
43275
|
+
}
|
|
43276
|
+
get isMutating() {
|
|
43277
|
+
return this.swrResponse.isMutating;
|
|
43278
|
+
}
|
|
43279
|
+
get isError() {
|
|
43280
|
+
return this.swrResponse.error !== void 0;
|
|
43281
|
+
}
|
|
43282
|
+
};
|
|
43283
|
+
var updateInvoiceWithRefund = (invoice) => {
|
|
43284
|
+
return __spreadProps(__spreadValues({}, invoice), { status: "REFUNDED" /* Refunded */ });
|
|
43285
|
+
};
|
|
43286
|
+
var useRefundInvoice = ({ invoiceId }) => {
|
|
43287
|
+
const { data } = useAuth();
|
|
43288
|
+
const { businessId } = useLayerContext();
|
|
43289
|
+
const applyRefundToInvoice = useCallback81(() => (invoice) => {
|
|
43290
|
+
if (invoice.id !== invoiceId) return invoice;
|
|
43291
|
+
return updateInvoiceWithRefund(invoice);
|
|
43292
|
+
}, [invoiceId]);
|
|
43293
|
+
const rawMutationResponse = useSWRMutation32(
|
|
43294
|
+
() => buildKey48(__spreadProps(__spreadValues({}, data), {
|
|
43295
|
+
businessId,
|
|
43296
|
+
invoiceId
|
|
43297
|
+
})),
|
|
43298
|
+
({ accessToken, apiUrl, businessId: businessId2, invoiceId: invoiceId2 }, { arg: body }) => {
|
|
43299
|
+
return refundInvoice(
|
|
43300
|
+
apiUrl,
|
|
43301
|
+
accessToken,
|
|
43302
|
+
{ params: { businessId: businessId2, invoiceId: invoiceId2 }, body }
|
|
43303
|
+
).then(Schema30.decodeUnknownPromise(RefundInvoiceReturnSchema));
|
|
43304
|
+
},
|
|
43305
|
+
{
|
|
43306
|
+
revalidate: false,
|
|
43307
|
+
throwOnError: true
|
|
43308
|
+
}
|
|
43309
|
+
);
|
|
43310
|
+
const mutationResponse = new RefundInvoiceSWRResponse(rawMutationResponse);
|
|
43311
|
+
const { patchInvoiceWithTransformation } = useInvoicesGlobalCacheActions();
|
|
43312
|
+
const { forceReloadInvoiceSummaryStats } = useInvoiceSummaryStatsCacheActions();
|
|
43313
|
+
const originalTrigger = mutationResponse.trigger;
|
|
43314
|
+
const stableProxiedTrigger = useCallback81(
|
|
43315
|
+
(...triggerParameters) => __async(null, null, function* () {
|
|
43316
|
+
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
43317
|
+
void patchInvoiceWithTransformation(applyRefundToInvoice());
|
|
43318
|
+
void forceReloadInvoiceSummaryStats();
|
|
43319
|
+
return triggerResult;
|
|
43320
|
+
}),
|
|
43321
|
+
[originalTrigger, patchInvoiceWithTransformation, applyRefundToInvoice, forceReloadInvoiceSummaryStats]
|
|
43322
|
+
);
|
|
43323
|
+
return new Proxy(mutationResponse, {
|
|
43324
|
+
get(target, prop) {
|
|
43325
|
+
if (prop === "trigger") {
|
|
43326
|
+
return stableProxiedTrigger;
|
|
43327
|
+
}
|
|
43328
|
+
return Reflect.get(target, prop);
|
|
43329
|
+
}
|
|
43330
|
+
});
|
|
43331
|
+
};
|
|
43332
|
+
|
|
43333
|
+
// src/components/Invoices/InvoiceRefundForm/useInvoiceRefundForm.ts
|
|
43334
|
+
var useInvoiceRefundForm = ({ onSuccess, invoice }) => {
|
|
43335
|
+
const [submitError, setSubmitError] = useState89(void 0);
|
|
43336
|
+
const { trigger: refundInvoice2 } = useRefundInvoice({ invoiceId: invoice.id });
|
|
43337
|
+
const defaultValuesRef = useRef33(getInvoiceRefundFormDefaultValues(invoice));
|
|
43338
|
+
const defaultValues = defaultValuesRef.current;
|
|
43339
|
+
const onSubmit = useCallback82((_0) => __async(null, [_0], function* ({ value }) {
|
|
43340
|
+
try {
|
|
43341
|
+
const customerRefundParams = convertInvoiceRefundFormToParams(value);
|
|
43342
|
+
const refundInvoiceRequest = Schema31.encodeUnknownSync(CreateCustomerRefundSchema)(customerRefundParams);
|
|
43343
|
+
const { data: refund } = yield refundInvoice2(refundInvoiceRequest);
|
|
43344
|
+
setSubmitError(void 0);
|
|
43345
|
+
onSuccess(refund);
|
|
43346
|
+
} catch (e) {
|
|
43347
|
+
console.error(e);
|
|
43348
|
+
setSubmitError("Something went wrong. Please try again.");
|
|
43349
|
+
}
|
|
43350
|
+
}), [onSuccess, refundInvoice2]);
|
|
43351
|
+
const onDynamic = useCallback82(({ value }) => {
|
|
43352
|
+
return validateInvoiceRefundForm({ invoiceRefund: value, invoice });
|
|
43353
|
+
}, [invoice]);
|
|
43354
|
+
const validators = useMemo90(() => ({ onDynamic }), [onDynamic]);
|
|
43355
|
+
const form = useAppForm({
|
|
43356
|
+
defaultValues,
|
|
43357
|
+
onSubmit,
|
|
43358
|
+
validators,
|
|
43359
|
+
validationLogic: revalidateLogic3({
|
|
43360
|
+
mode: "submit",
|
|
43361
|
+
modeAfterSubmission: "submit"
|
|
43362
|
+
}),
|
|
43363
|
+
canSubmitWhenInvalid: true
|
|
43364
|
+
});
|
|
43365
|
+
return useMemo90(
|
|
43366
|
+
() => ({ form, submitError }),
|
|
43367
|
+
[form, submitError]
|
|
43368
|
+
);
|
|
43369
|
+
};
|
|
43370
|
+
|
|
43371
|
+
// src/components/Invoices/InvoiceRefundForm/InvoiceRefundForm.tsx
|
|
43372
|
+
import { jsx as jsx358, jsxs as jsxs226 } from "react/jsx-runtime";
|
|
43373
|
+
var INVOICE_REFUND_FORM_CSS_PREFIX = "Layer__InvoiceRefundForm";
|
|
43374
|
+
var INVOICE_REFUND_FORM_FIELD_CSS_PREFIX = `${INVOICE_REFUND_FORM_CSS_PREFIX}__Field`;
|
|
43375
|
+
var InvoiceRefundForm = forwardRef27(({ onSuccess, invoice }, ref) => {
|
|
43376
|
+
const { form, submitError } = useInvoiceRefundForm({ onSuccess, invoice });
|
|
43377
|
+
const blockNativeOnSubmit = useCallback83((e) => {
|
|
43378
|
+
e.preventDefault();
|
|
43379
|
+
e.stopPropagation();
|
|
43380
|
+
}, []);
|
|
43381
|
+
useImperativeHandle5(ref, () => ({
|
|
43382
|
+
submit: () => form.handleSubmit()
|
|
43383
|
+
}));
|
|
43384
|
+
return /* @__PURE__ */ jsxs226(Form, { className: INVOICE_REFUND_FORM_CSS_PREFIX, onSubmit: blockNativeOnSubmit, children: [
|
|
43385
|
+
/* @__PURE__ */ jsx358(form.Subscribe, { selector: (state) => state.errorMap, children: (errorMap) => {
|
|
43386
|
+
const validationErrors = flattenValidationErrors(errorMap);
|
|
43387
|
+
if (validationErrors.length > 0 || submitError) {
|
|
43388
|
+
return /* @__PURE__ */ jsx358(HStack, { className: `${INVOICE_REFUND_FORM_CSS_PREFIX}__FormError`, children: /* @__PURE__ */ jsx358(
|
|
43389
|
+
DataState,
|
|
43390
|
+
{
|
|
43391
|
+
icon: /* @__PURE__ */ jsx358(AlertTriangle3, { size: 16 }),
|
|
43392
|
+
status: "failed" /* failed */,
|
|
43393
|
+
title: validationErrors[0] || submitError,
|
|
43394
|
+
titleSize: "md" /* md */,
|
|
43395
|
+
inline: true
|
|
43396
|
+
}
|
|
43397
|
+
) });
|
|
43398
|
+
}
|
|
43399
|
+
} }),
|
|
43400
|
+
/* @__PURE__ */ jsxs226(VStack, { className: `${INVOICE_REFUND_FORM_CSS_PREFIX}__Section`, gap: "sm", children: [
|
|
43401
|
+
/* @__PURE__ */ jsxs226(HStack, { className: `${INVOICE_REFUND_FORM_FIELD_CSS_PREFIX}__InvoiceNo`, gap: "xs", align: "center", children: [
|
|
43402
|
+
/* @__PURE__ */ jsx358(Span, { size: "sm", children: "Invoice" }),
|
|
43403
|
+
/* @__PURE__ */ jsxs226(Span, { size: "md", weight: "bold", children: [
|
|
43404
|
+
"#",
|
|
43405
|
+
invoice.invoiceNumber
|
|
43406
|
+
] })
|
|
43407
|
+
] }),
|
|
43408
|
+
/* @__PURE__ */ jsx358(form.AppField, { name: "completedAt", children: (field) => /* @__PURE__ */ jsx358(field.FormDateField, { label: "Refund date", inline: true, className: `${INVOICE_REFUND_FORM_FIELD_CSS_PREFIX}__CompletedAt` }) }),
|
|
43409
|
+
/* @__PURE__ */ jsx358(form.Field, { name: "method", children: (field) => /* @__PURE__ */ jsx358(
|
|
43410
|
+
PaymentMethodComboBox,
|
|
43411
|
+
{
|
|
43412
|
+
className: `${INVOICE_REFUND_FORM_FIELD_CSS_PREFIX}__PaymentMethod`,
|
|
43413
|
+
value: field.state.value,
|
|
43414
|
+
onValueChange: field.handleChange,
|
|
43415
|
+
inline: true
|
|
43416
|
+
}
|
|
43417
|
+
) }),
|
|
43418
|
+
/* @__PURE__ */ jsx358(form.AppField, { name: "amount", children: (field) => /* @__PURE__ */ jsx358(field.FormBigDecimalField, { label: "Amount", inline: true, className: `${INVOICE_REFUND_FORM_FIELD_CSS_PREFIX}__Amount`, mode: "currency", isReadOnly: true }) })
|
|
43419
|
+
] })
|
|
43420
|
+
] });
|
|
43421
|
+
});
|
|
43422
|
+
InvoiceRefundForm.displayName = "InvoiceRefundForm";
|
|
43423
|
+
|
|
43424
|
+
// src/components/Invoices/Modal/InvoiceRefundModal.tsx
|
|
43425
|
+
import { jsx as jsx359 } from "react/jsx-runtime";
|
|
43426
|
+
function InvoiceRefundModal({ isOpen, onOpenChange, invoice, onSuccess }) {
|
|
43427
|
+
const formRef = useRef34(null);
|
|
43428
|
+
const onConfirm = useCallback84(() => {
|
|
43429
|
+
var _a;
|
|
43430
|
+
return (_a = formRef.current) == null ? void 0 : _a.submit();
|
|
43431
|
+
}, []);
|
|
43432
|
+
const onSuccessForm = useCallback84(() => {
|
|
43433
|
+
onSuccess(updateInvoiceWithRefund(invoice));
|
|
43434
|
+
onOpenChange == null ? void 0 : onOpenChange(false);
|
|
43435
|
+
}, [invoice, onOpenChange, onSuccess]);
|
|
43436
|
+
const content = useMemo91(() => /* @__PURE__ */ jsx359(InvoiceRefundForm, { invoice, onSuccess: onSuccessForm, ref: formRef }), [invoice, onSuccessForm]);
|
|
43437
|
+
return /* @__PURE__ */ jsx359(
|
|
43438
|
+
BaseConfirmationModal,
|
|
43439
|
+
{
|
|
43440
|
+
isOpen,
|
|
43441
|
+
onOpenChange,
|
|
43442
|
+
title: "Issue refund",
|
|
43443
|
+
content,
|
|
43444
|
+
onConfirm,
|
|
43445
|
+
confirmLabel: "Refund Invoice",
|
|
43446
|
+
errorText: "There was an error issuing a refund for this invoice. Please check your connection and try again in a few seconds.",
|
|
43447
|
+
closeOnConfirm: false
|
|
43448
|
+
}
|
|
43449
|
+
);
|
|
43450
|
+
}
|
|
43451
|
+
|
|
43452
|
+
// src/components/Invoices/InvoiceDetail/InvoiceDetailHeaderMenu.tsx
|
|
43453
|
+
import { Fragment as Fragment59, jsx as jsx360, jsxs as jsxs227 } from "react/jsx-runtime";
|
|
43454
|
+
var availableActions = {
|
|
43455
|
+
["SENT" /* Sent */]: [
|
|
43456
|
+
"Edit" /* Edit */,
|
|
43457
|
+
"Void" /* Void */,
|
|
43458
|
+
"Writeoff" /* Writeoff */
|
|
43459
|
+
],
|
|
43460
|
+
["PARTIALLY_PAID" /* PartiallyPaid */]: [
|
|
43461
|
+
"Writeoff" /* Writeoff */,
|
|
43462
|
+
"Reset" /* Reset */
|
|
43463
|
+
],
|
|
43464
|
+
["PAID" /* Paid */]: [
|
|
43465
|
+
"Refund" /* Refund */,
|
|
43466
|
+
"Reset" /* Reset */
|
|
43467
|
+
],
|
|
43468
|
+
["VOIDED" /* Voided */]: [],
|
|
43469
|
+
["PARTIALLY_WRITTEN_OFF" /* PartiallyWrittenOff */]: ["Reset" /* Reset */],
|
|
43470
|
+
["WRITTEN_OFF" /* WrittenOff */]: ["Reset" /* Reset */],
|
|
43471
|
+
["REFUNDED" /* Refunded */]: ["Reset" /* Reset */]
|
|
43472
|
+
};
|
|
43473
|
+
var getInvoiceActions = (invoice) => {
|
|
43474
|
+
return availableActions[invoice.status];
|
|
43475
|
+
};
|
|
43476
|
+
var InvoiceDetailHeaderMenu = ({ onEditInvoice }) => {
|
|
43477
|
+
const viewState = useInvoiceDetail();
|
|
43478
|
+
const { toViewInvoice } = useInvoiceNavigation();
|
|
43479
|
+
const [openModal, setOpenModal] = useState90();
|
|
43480
|
+
const onSuccessUpdateInvoice = useCallback85((updatedInvoice) => {
|
|
43481
|
+
toViewInvoice(updatedInvoice);
|
|
43482
|
+
}, [toViewInvoice]);
|
|
43483
|
+
const onOpenChangeByMode = useCallback85(
|
|
43484
|
+
(mode) => (isOpen = true) => {
|
|
43485
|
+
if (isOpen) {
|
|
43486
|
+
setOpenModal(mode);
|
|
43487
|
+
} else {
|
|
43488
|
+
setOpenModal(void 0);
|
|
43489
|
+
}
|
|
43490
|
+
},
|
|
43491
|
+
[]
|
|
43492
|
+
);
|
|
43493
|
+
const Trigger = useCallback85(() => {
|
|
43494
|
+
return /* @__PURE__ */ jsx360(Button2, { icon: true, variant: "outlined", children: /* @__PURE__ */ jsx360(MenuIcon, { size: 14 }) });
|
|
43495
|
+
}, []);
|
|
43496
|
+
if (viewState.mode === "Create" /* Create */) return null;
|
|
43497
|
+
const invoice = viewState.invoice;
|
|
43498
|
+
const invoiceActions = getInvoiceActions(invoice);
|
|
43499
|
+
if (!invoiceActions.length) return null;
|
|
43500
|
+
return /* @__PURE__ */ jsxs227(Fragment59, { children: [
|
|
43501
|
+
/* @__PURE__ */ jsx360(
|
|
43502
|
+
DropdownMenu,
|
|
43503
|
+
{
|
|
43504
|
+
ariaLabel: "Additional invoice actions",
|
|
43505
|
+
slots: { Trigger },
|
|
43506
|
+
slotProps: { Dialog: { width: 160 } },
|
|
43507
|
+
variant: "compact",
|
|
43508
|
+
children: /* @__PURE__ */ jsxs227(MenuList, { children: [
|
|
43509
|
+
invoiceActions.includes("Edit" /* Edit */) && /* @__PURE__ */ jsx360(MenuItem3, { onClick: onEditInvoice, children: /* @__PURE__ */ jsx360(Span, { size: "sm", children: "Edit details" }) }, "Edit" /* Edit */),
|
|
43510
|
+
invoiceActions.includes("Refund" /* Refund */) && /* @__PURE__ */ jsx360(MenuItem3, { onClick: onOpenChangeByMode("Refund" /* Refund */), children: /* @__PURE__ */ jsx360(Span, { size: "sm", children: "Issue refund" }) }, "Refund" /* Refund */),
|
|
43511
|
+
invoiceActions.includes("Void" /* Void */) && /* @__PURE__ */ jsx360(MenuItem3, { onClick: onOpenChangeByMode("Void" /* Void */), children: /* @__PURE__ */ jsx360(Span, { size: "sm", children: "Cancel/Void" }) }, "Void" /* Void */),
|
|
43512
|
+
invoiceActions.includes("Writeoff" /* Writeoff */) && /* @__PURE__ */ jsx360(MenuItem3, { onClick: onOpenChangeByMode("Writeoff" /* Writeoff */), children: /* @__PURE__ */ jsx360(Span, { size: "sm", children: "Write off" }) }, "Writeoff" /* Writeoff */),
|
|
43513
|
+
invoiceActions.includes("Reset" /* Reset */) && /* @__PURE__ */ jsx360(MenuItem3, { onClick: onOpenChangeByMode("Reset" /* Reset */), children: /* @__PURE__ */ jsx360(Span, { size: "sm", children: "Reset to sent" }) }, "Reset" /* Reset */)
|
|
43514
|
+
] })
|
|
43515
|
+
}
|
|
43516
|
+
),
|
|
43517
|
+
/* @__PURE__ */ jsx360(
|
|
43518
|
+
InvoiceRefundModal,
|
|
43519
|
+
{
|
|
43520
|
+
isOpen: openModal === "Refund" /* Refund */,
|
|
43521
|
+
onOpenChange: onOpenChangeByMode("Refund" /* Refund */),
|
|
43522
|
+
invoice,
|
|
43523
|
+
onSuccess: onSuccessUpdateInvoice
|
|
43524
|
+
}
|
|
43525
|
+
),
|
|
43526
|
+
/* @__PURE__ */ jsx360(
|
|
43527
|
+
InvoiceVoidModal,
|
|
43528
|
+
{
|
|
43529
|
+
isOpen: openModal === "Void" /* Void */,
|
|
43530
|
+
onOpenChange: onOpenChangeByMode("Void" /* Void */),
|
|
43531
|
+
invoiceId: invoice.id,
|
|
43532
|
+
onSuccess: onSuccessUpdateInvoice
|
|
43533
|
+
}
|
|
43534
|
+
),
|
|
43535
|
+
/* @__PURE__ */ jsx360(
|
|
43536
|
+
InvoiceWriteoffModal,
|
|
43537
|
+
{
|
|
43538
|
+
isOpen: openModal === "Writeoff" /* Writeoff */,
|
|
43539
|
+
onOpenChange: onOpenChangeByMode("Writeoff" /* Writeoff */),
|
|
43540
|
+
invoice,
|
|
43541
|
+
onSuccess: onSuccessUpdateInvoice
|
|
43542
|
+
}
|
|
43543
|
+
),
|
|
43544
|
+
/* @__PURE__ */ jsx360(
|
|
43545
|
+
InvoiceResetModal,
|
|
43546
|
+
{
|
|
43547
|
+
isOpen: openModal === "Reset" /* Reset */,
|
|
43548
|
+
onOpenChange: onOpenChangeByMode("Reset" /* Reset */),
|
|
43549
|
+
invoiceId: invoice.id,
|
|
43550
|
+
onSuccess: onSuccessUpdateInvoice
|
|
43551
|
+
}
|
|
43552
|
+
)
|
|
43553
|
+
] });
|
|
43554
|
+
};
|
|
43555
|
+
|
|
42773
43556
|
// src/components/Invoices/InvoiceDetail/InvoiceDetail.tsx
|
|
42774
|
-
import { Fragment as
|
|
43557
|
+
import { Fragment as Fragment60, jsx as jsx361, jsxs as jsxs228 } from "react/jsx-runtime";
|
|
42775
43558
|
var InvoiceDetail = () => {
|
|
42776
43559
|
const viewState = useInvoiceDetail();
|
|
42777
|
-
const [isPaymentDrawerOpen, setIsPaymentDrawerOpen] =
|
|
42778
|
-
const [isDiscardChangesModalOpen, setIsDiscardChangesModalOpen] =
|
|
43560
|
+
const [isPaymentDrawerOpen, setIsPaymentDrawerOpen] = useState91(false);
|
|
43561
|
+
const [isDiscardChangesModalOpen, setIsDiscardChangesModalOpen] = useState91(false);
|
|
42779
43562
|
const { toViewInvoice, toInvoiceTable } = useInvoiceNavigation();
|
|
42780
43563
|
const { addToast } = useLayerContext();
|
|
42781
|
-
const formRef =
|
|
42782
|
-
const [isReadOnly, setIsReadOnly] =
|
|
42783
|
-
const onUpsertInvoiceSuccess =
|
|
43564
|
+
const formRef = useRef35(null);
|
|
43565
|
+
const [isReadOnly, setIsReadOnly] = useState91(viewState.mode === "Update" /* Update */);
|
|
43566
|
+
const onUpsertInvoiceSuccess = useCallback86((invoice) => {
|
|
42784
43567
|
const toastContent = viewState.mode === "Update" /* Update */ ? "Invoice updated successfully" : "Invoice created successfully";
|
|
42785
43568
|
addToast({ content: toastContent, type: "success" });
|
|
42786
43569
|
toViewInvoice(invoice);
|
|
42787
43570
|
setIsReadOnly(true);
|
|
42788
43571
|
}, [viewState.mode, addToast, toViewInvoice]);
|
|
42789
|
-
const onUpsertInvoicePaymentSuccess =
|
|
43572
|
+
const onUpsertInvoicePaymentSuccess = useCallback86((invoice, invoicePayment) => {
|
|
42790
43573
|
addToast({ content: "Invoice paid successfully", type: "success" });
|
|
42791
43574
|
const updatedInvoice = updateInvoiceWithPayment(invoice, invoicePayment);
|
|
42792
43575
|
toViewInvoice(updatedInvoice);
|
|
42793
43576
|
}, [addToast, toViewInvoice]);
|
|
42794
|
-
const onSubmit =
|
|
43577
|
+
const onSubmit = useCallback86(() => {
|
|
42795
43578
|
var _a;
|
|
42796
43579
|
return void ((_a = formRef.current) == null ? void 0 : _a.submit());
|
|
42797
43580
|
}, []);
|
|
42798
|
-
const [formState, setFormState] =
|
|
43581
|
+
const [formState, setFormState] = useState91({
|
|
42799
43582
|
isDirty: false,
|
|
42800
43583
|
isSubmitting: false
|
|
42801
43584
|
});
|
|
42802
|
-
const onChangeFormState =
|
|
43585
|
+
const onChangeFormState = useCallback86((nextState) => {
|
|
42803
43586
|
setFormState(nextState);
|
|
42804
43587
|
}, []);
|
|
42805
|
-
const
|
|
42806
|
-
return /* @__PURE__ */
|
|
43588
|
+
const Header5 = useCallback86(() => {
|
|
43589
|
+
return /* @__PURE__ */ jsx361(
|
|
42807
43590
|
InvoiceDetailHeader,
|
|
42808
43591
|
{
|
|
42809
43592
|
onSubmit,
|
|
@@ -42815,17 +43598,17 @@ var InvoiceDetail = () => {
|
|
|
42815
43598
|
);
|
|
42816
43599
|
}, [onSubmit, isReadOnly, formState]);
|
|
42817
43600
|
const hasChanges = !isReadOnly && formState.isDirty;
|
|
42818
|
-
const onGoBack =
|
|
43601
|
+
const onGoBack = useCallback86(() => {
|
|
42819
43602
|
if (hasChanges) {
|
|
42820
43603
|
setIsDiscardChangesModalOpen(true);
|
|
42821
43604
|
} else {
|
|
42822
43605
|
toInvoiceTable();
|
|
42823
43606
|
}
|
|
42824
43607
|
}, [hasChanges, toInvoiceTable]);
|
|
42825
|
-
return /* @__PURE__ */
|
|
42826
|
-
/* @__PURE__ */
|
|
42827
|
-
viewState.mode === "Update" /* Update */ && /* @__PURE__ */
|
|
42828
|
-
/* @__PURE__ */
|
|
43608
|
+
return /* @__PURE__ */ jsxs228(Fragment60, { children: [
|
|
43609
|
+
/* @__PURE__ */ jsxs228(BaseDetailView, { slots: { Header: Header5, BackIcon: hasChanges ? X_default : BackArrow_default }, name: "Invoice Detail View", onGoBack, children: [
|
|
43610
|
+
viewState.mode === "Update" /* Update */ && /* @__PURE__ */ jsx361(InvoiceDetailSubHeader, { invoice: viewState.invoice }),
|
|
43611
|
+
/* @__PURE__ */ jsx361(
|
|
42829
43612
|
InvoiceForm,
|
|
42830
43613
|
{
|
|
42831
43614
|
isReadOnly,
|
|
@@ -42835,7 +43618,7 @@ var InvoiceDetail = () => {
|
|
|
42835
43618
|
}
|
|
42836
43619
|
)
|
|
42837
43620
|
] }),
|
|
42838
|
-
/* @__PURE__ */
|
|
43621
|
+
/* @__PURE__ */ jsx361(
|
|
42839
43622
|
BaseConfirmationModal,
|
|
42840
43623
|
{
|
|
42841
43624
|
isOpen: isDiscardChangesModalOpen,
|
|
@@ -42847,15 +43630,15 @@ var InvoiceDetail = () => {
|
|
|
42847
43630
|
cancelLabel: "Keep editing"
|
|
42848
43631
|
}
|
|
42849
43632
|
),
|
|
42850
|
-
viewState.mode === "Update" /* Update */ && /* @__PURE__ */
|
|
42851
|
-
/* @__PURE__ */
|
|
43633
|
+
viewState.mode === "Update" /* Update */ && /* @__PURE__ */ jsx361(Drawer, { isOpen: isPaymentDrawerOpen, onOpenChange: setIsPaymentDrawerOpen, children: ({ close: close2 }) => /* @__PURE__ */ jsxs228(VStack, { pb: "lg", gap: "lg", children: [
|
|
43634
|
+
/* @__PURE__ */ jsx361(VStack, { pi: "md", children: /* @__PURE__ */ jsx361(
|
|
42852
43635
|
ModalTitleWithClose,
|
|
42853
43636
|
{
|
|
42854
|
-
heading: /* @__PURE__ */
|
|
43637
|
+
heading: /* @__PURE__ */ jsx361(ModalHeading, { size: "lg", children: "Record invoice payment" }),
|
|
42855
43638
|
onClose: close2
|
|
42856
43639
|
}
|
|
42857
43640
|
) }),
|
|
42858
|
-
/* @__PURE__ */
|
|
43641
|
+
/* @__PURE__ */ jsx361(
|
|
42859
43642
|
InvoicePaymentForm,
|
|
42860
43643
|
{
|
|
42861
43644
|
onSuccess: (invoicePayment) => {
|
|
@@ -42872,73 +43655,60 @@ var InvoiceDetail = () => {
|
|
|
42872
43655
|
var InvoiceDetailHeader = ({ onSubmit, formState, isReadOnly, setIsReadOnly, openInvoicePaymentDrawer }) => {
|
|
42873
43656
|
const viewState = useInvoiceDetail();
|
|
42874
43657
|
const { isSubmitting } = formState;
|
|
42875
|
-
const
|
|
42876
|
-
|
|
42877
|
-
}, []);
|
|
42878
|
-
const saveButton =
|
|
43658
|
+
const onEditInvoice = useCallback86(() => {
|
|
43659
|
+
setIsReadOnly(false);
|
|
43660
|
+
}, [setIsReadOnly]);
|
|
43661
|
+
const saveButton = useMemo92(() => /* @__PURE__ */ jsxs228(Button2, { isPending: isSubmitting, onPress: onSubmit, children: [
|
|
42879
43662
|
"Save",
|
|
42880
|
-
/* @__PURE__ */
|
|
43663
|
+
/* @__PURE__ */ jsx361(Save2, { size: 14 })
|
|
42881
43664
|
] }), [isSubmitting, onSubmit]);
|
|
42882
43665
|
if (viewState.mode === "Create" /* Create */) {
|
|
42883
|
-
return /* @__PURE__ */
|
|
42884
|
-
/* @__PURE__ */
|
|
43666
|
+
return /* @__PURE__ */ jsxs228(HStack, { justify: "space-between", align: "center", fluid: true, pie: "md", children: [
|
|
43667
|
+
/* @__PURE__ */ jsx361(Heading2, { children: "Create Invoice" }),
|
|
42885
43668
|
saveButton
|
|
42886
43669
|
] });
|
|
42887
43670
|
}
|
|
42888
43671
|
const invoiceNumber = viewState.invoice.invoiceNumber;
|
|
42889
43672
|
const headingContent = isReadOnly ? invoiceNumber ? `Invoice #${invoiceNumber}` : "View Invoice" : invoiceNumber ? `Editing Invoice #${invoiceNumber}` : "Editing Invoice";
|
|
42890
43673
|
const canMarkAsPaid = viewState.mode === "Update" /* Update */ && (viewState.invoice.status === "SENT" /* Sent */ || viewState.invoice.status === "PARTIALLY_PAID" /* PartiallyPaid */);
|
|
42891
|
-
return /* @__PURE__ */
|
|
42892
|
-
/* @__PURE__ */
|
|
42893
|
-
isReadOnly ? /* @__PURE__ */
|
|
42894
|
-
canMarkAsPaid && /* @__PURE__ */
|
|
43674
|
+
return /* @__PURE__ */ jsxs228(HStack, { justify: "space-between", align: "center", fluid: true, pie: "md", children: [
|
|
43675
|
+
/* @__PURE__ */ jsx361(Heading2, { children: headingContent }),
|
|
43676
|
+
isReadOnly ? /* @__PURE__ */ jsxs228(HStack, { gap: "xs", children: [
|
|
43677
|
+
canMarkAsPaid && /* @__PURE__ */ jsxs228(Button2, { onPress: openInvoicePaymentDrawer, children: [
|
|
42895
43678
|
"Mark as paid",
|
|
42896
|
-
/* @__PURE__ */
|
|
43679
|
+
/* @__PURE__ */ jsx361(HandCoins2, { size: 14 })
|
|
42897
43680
|
] }),
|
|
42898
|
-
/* @__PURE__ */
|
|
42899
|
-
DropdownMenu,
|
|
42900
|
-
{
|
|
42901
|
-
ariaLabel: "Invoice actions",
|
|
42902
|
-
slots: { Trigger: MenuButton },
|
|
42903
|
-
slotProps: { Dialog: { width: 280 } },
|
|
42904
|
-
children: /* @__PURE__ */ jsx355(MenuList, { children: /* @__PURE__ */ jsxs226(MenuItem3, { onClick: () => {
|
|
42905
|
-
setIsReadOnly(false);
|
|
42906
|
-
}, children: [
|
|
42907
|
-
/* @__PURE__ */ jsx355(SquarePen, { size: 14 }),
|
|
42908
|
-
/* @__PURE__ */ jsx355(Span, { size: "sm", children: "Edit invoice" })
|
|
42909
|
-
] }, "edit-invoice") })
|
|
42910
|
-
}
|
|
42911
|
-
)
|
|
43681
|
+
/* @__PURE__ */ jsx361(InvoiceDetailHeaderMenu, { onEditInvoice })
|
|
42912
43682
|
] }) : saveButton
|
|
42913
43683
|
] });
|
|
42914
43684
|
};
|
|
42915
43685
|
var InvoiceDetailSubHeader = ({ invoice }) => {
|
|
42916
43686
|
const { outstandingBalance, totalAmount } = invoice;
|
|
42917
|
-
return /* @__PURE__ */
|
|
42918
|
-
/* @__PURE__ */
|
|
42919
|
-
/* @__PURE__ */
|
|
42920
|
-
/* @__PURE__ */
|
|
43687
|
+
return /* @__PURE__ */ jsx361(HStack, { className: "Layer__InvoiceDetail__SubHeader", children: /* @__PURE__ */ jsxs228(HStack, { gap: "5xl", children: [
|
|
43688
|
+
/* @__PURE__ */ jsx361(DataPoint, { label: "Balance due", children: /* @__PURE__ */ jsx361(Span, { children: convertCentsToCurrency(outstandingBalance) }) }),
|
|
43689
|
+
/* @__PURE__ */ jsx361(DataPoint, { label: "Open balance", children: /* @__PURE__ */ jsx361(Span, { children: convertCentsToCurrency(totalAmount) }) }),
|
|
43690
|
+
/* @__PURE__ */ jsx361(DataPoint, { label: "Status", children: /* @__PURE__ */ jsx361(InvoiceStatusCell, { invoice, inline: true }) })
|
|
42921
43691
|
] }) });
|
|
42922
43692
|
};
|
|
42923
43693
|
|
|
42924
43694
|
// src/components/ui/Meter/Meter.tsx
|
|
42925
|
-
import { forwardRef as
|
|
43695
|
+
import { forwardRef as forwardRef28 } from "react";
|
|
42926
43696
|
import { Meter as ReactAriaMeter } from "react-aria-components";
|
|
42927
43697
|
import classNames95 from "classnames";
|
|
42928
|
-
import { jsx as
|
|
43698
|
+
import { jsx as jsx362, jsxs as jsxs229 } from "react/jsx-runtime";
|
|
42929
43699
|
var getClassnameForSubComponent = (className, suffix) => {
|
|
42930
43700
|
return classNames95(`${METER_CLASS_NAME}__${suffix}`, className && `${className}__${suffix}`);
|
|
42931
43701
|
};
|
|
42932
43702
|
var METER_CLASS_NAME = "Layer__Meter";
|
|
42933
|
-
var Meter =
|
|
43703
|
+
var Meter = forwardRef28(
|
|
42934
43704
|
function Meter2(_a, ref) {
|
|
42935
43705
|
var _b = _a, { className, label, meterOnly } = _b, restProps = __objRest(_b, ["className", "label", "meterOnly"]);
|
|
42936
|
-
return /* @__PURE__ */
|
|
42937
|
-
!meterOnly && /* @__PURE__ */
|
|
42938
|
-
/* @__PURE__ */
|
|
42939
|
-
/* @__PURE__ */
|
|
43706
|
+
return /* @__PURE__ */ jsx362(ReactAriaMeter, __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, restProps), { className: classNames95(METER_CLASS_NAME, className), ref }), meterOnly && { "aria-label": label }), { children: ({ percentage, valueText }) => /* @__PURE__ */ jsxs229(VStack, { gap: "3xs", fluid: true, children: [
|
|
43707
|
+
!meterOnly && /* @__PURE__ */ jsxs229(HStack, { justify: "space-between", children: [
|
|
43708
|
+
/* @__PURE__ */ jsx362(Label, { slot: "label", children: label }),
|
|
43709
|
+
/* @__PURE__ */ jsx362(Span, { slot: "value", children: valueText })
|
|
42940
43710
|
] }),
|
|
42941
|
-
/* @__PURE__ */
|
|
43711
|
+
/* @__PURE__ */ jsx362(HStack, { slot: "bar", children: /* @__PURE__ */ jsxs229(
|
|
42942
43712
|
"svg",
|
|
42943
43713
|
{
|
|
42944
43714
|
className: getClassnameForSubComponent(className, "svg"),
|
|
@@ -42947,7 +43717,7 @@ var Meter = forwardRef27(
|
|
|
42947
43717
|
"aria-hidden": "true",
|
|
42948
43718
|
focusable: "false",
|
|
42949
43719
|
children: [
|
|
42950
|
-
/* @__PURE__ */
|
|
43720
|
+
/* @__PURE__ */ jsx362(
|
|
42951
43721
|
"rect",
|
|
42952
43722
|
{
|
|
42953
43723
|
className: getClassnameForSubComponent(className, "track"),
|
|
@@ -42957,7 +43727,7 @@ var Meter = forwardRef27(
|
|
|
42957
43727
|
height: "4"
|
|
42958
43728
|
}
|
|
42959
43729
|
),
|
|
42960
|
-
/* @__PURE__ */
|
|
43730
|
+
/* @__PURE__ */ jsx362(
|
|
42961
43731
|
"rect",
|
|
42962
43732
|
{
|
|
42963
43733
|
className: getClassnameForSubComponent(className, "fill"),
|
|
@@ -42976,7 +43746,7 @@ var Meter = forwardRef27(
|
|
|
42976
43746
|
|
|
42977
43747
|
// src/components/Invoices/InvoiceSummaryStats/InvoiceSummaryStats.tsx
|
|
42978
43748
|
import { BigDecimal as BD9 } from "effect";
|
|
42979
|
-
import { jsx as
|
|
43749
|
+
import { jsx as jsx363, jsxs as jsxs230 } from "react/jsx-runtime";
|
|
42980
43750
|
var getPercentageOverdue = (sentTotal, overdueTotal) => {
|
|
42981
43751
|
if (!sentTotal && !overdueTotal) return 50;
|
|
42982
43752
|
if (!sentTotal) return 100;
|
|
@@ -42995,68 +43765,68 @@ var InvoiceSummaryStats = () => {
|
|
|
42995
43765
|
const { overdueCount, overdueTotal, sentCount, sentTotal } = (_b = data == null ? void 0 : data.invoices) != null ? _b : {};
|
|
42996
43766
|
const invoicesTotal = (overdueTotal || BigInt(0)) + (sentTotal || BigInt(0));
|
|
42997
43767
|
const percentageOverdue = getPercentageOverdue(sentTotal, overdueTotal);
|
|
42998
|
-
return /* @__PURE__ */
|
|
42999
|
-
/* @__PURE__ */
|
|
43000
|
-
/* @__PURE__ */
|
|
43001
|
-
/* @__PURE__ */
|
|
43768
|
+
return /* @__PURE__ */ jsxs230(HStack, { className: "Layer__InvoiceSummaryStats__Container", gap: "lg", children: [
|
|
43769
|
+
/* @__PURE__ */ jsxs230(VStack, { className: "Layer__InvoiceSummaryStats__Payments", gap: "3xs", children: [
|
|
43770
|
+
/* @__PURE__ */ jsxs230(HStack, { align: "center", children: [
|
|
43771
|
+
/* @__PURE__ */ jsx363(Span, { size: "sm", children: "Paid" }),
|
|
43002
43772
|
"\xA0",
|
|
43003
|
-
/* @__PURE__ */
|
|
43773
|
+
/* @__PURE__ */ jsx363(Span, { size: "sm", variant: "subtle", children: "last 30 days" })
|
|
43004
43774
|
] }),
|
|
43005
|
-
/* @__PURE__ */
|
|
43006
|
-
/* @__PURE__ */
|
|
43007
|
-
/* @__PURE__ */
|
|
43775
|
+
/* @__PURE__ */ jsxs230(HStack, { align: "center", gap: "xs", children: [
|
|
43776
|
+
/* @__PURE__ */ jsx363(Badge, { variant: "success" /* SUCCESS */, size: "xs" /* EXTRA_SMALL */, icon: /* @__PURE__ */ jsx363(Check_default, { size: 11 }), iconOnly: true }),
|
|
43777
|
+
/* @__PURE__ */ jsx363(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "24px", width: "120px", children: /* @__PURE__ */ jsx363(Span, { size: "xl", children: invoicePaymentsTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(invoicePaymentsTotal), { mode: "currency" }) }) })
|
|
43008
43778
|
] })
|
|
43009
43779
|
] }),
|
|
43010
|
-
/* @__PURE__ */
|
|
43011
|
-
/* @__PURE__ */
|
|
43012
|
-
/* @__PURE__ */
|
|
43013
|
-
/* @__PURE__ */
|
|
43780
|
+
/* @__PURE__ */ jsxs230(VStack, { gap: "sm", fluid: true, children: [
|
|
43781
|
+
/* @__PURE__ */ jsxs230(HStack, { gap: "md", align: "end", children: [
|
|
43782
|
+
/* @__PURE__ */ jsxs230(HStack, { align: "center", children: [
|
|
43783
|
+
/* @__PURE__ */ jsx363(Span, { size: "sm", pbe: "3xs", children: "Owed to you" }),
|
|
43014
43784
|
"\xA0",
|
|
43015
|
-
/* @__PURE__ */
|
|
43785
|
+
/* @__PURE__ */ jsx363(Span, { size: "sm", pbe: "3xs", variant: "subtle", children: "last 12 months" })
|
|
43016
43786
|
] }),
|
|
43017
|
-
/* @__PURE__ */
|
|
43787
|
+
/* @__PURE__ */ jsx363(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "24px", width: "120px", children: /* @__PURE__ */ jsx363(Span, { size: "xl", children: invoicesTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(invoicesTotal), { mode: "currency" }) }) })
|
|
43018
43788
|
] }),
|
|
43019
|
-
/* @__PURE__ */
|
|
43020
|
-
/* @__PURE__ */
|
|
43021
|
-
/* @__PURE__ */
|
|
43022
|
-
!showSkeleton && overdueCount !== void 0 ? /* @__PURE__ */
|
|
43789
|
+
/* @__PURE__ */ jsxs230(HStack, { justify: "space-between", children: [
|
|
43790
|
+
/* @__PURE__ */ jsxs230(HStack, { gap: "xs", align: "center", children: [
|
|
43791
|
+
/* @__PURE__ */ jsx363(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "17px", width: "80px", children: /* @__PURE__ */ jsx363(Span, { size: "md", children: overdueTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(overdueTotal), { mode: "currency" }) }) }),
|
|
43792
|
+
!showSkeleton && overdueCount !== void 0 ? /* @__PURE__ */ jsx363(Badge, { variant: "warning" /* WARNING */, size: "small" /* SMALL */, children: `Overdue invoices: ${overdueCount}` }) : /* @__PURE__ */ jsx363(BadgeLoader, { variant: "warning" /* WARNING */, showLoading: true })
|
|
43023
43793
|
] }),
|
|
43024
|
-
/* @__PURE__ */
|
|
43025
|
-
!showSkeleton && sentCount !== void 0 ? /* @__PURE__ */
|
|
43026
|
-
/* @__PURE__ */
|
|
43794
|
+
/* @__PURE__ */ jsxs230(HStack, { gap: "xs", align: "center", children: [
|
|
43795
|
+
!showSkeleton && sentCount !== void 0 ? /* @__PURE__ */ jsx363(Badge, { variant: "info" /* INFO */, size: "small" /* SMALL */, children: `Upcoming invoices: ${sentCount}` }) : /* @__PURE__ */ jsx363(BadgeLoader, { variant: "info" /* INFO */, showLoading: true }),
|
|
43796
|
+
/* @__PURE__ */ jsx363(FallbackWithSkeletonLoader, { isLoading: showSkeleton, height: "17px", width: "80px", children: /* @__PURE__ */ jsx363(Span, { size: "md", children: sentTotal !== void 0 && formatBigDecimalToString(convertBigIntCentsToBigDecimal(sentTotal), { mode: "currency" }) }) })
|
|
43027
43797
|
] })
|
|
43028
43798
|
] }),
|
|
43029
|
-
/* @__PURE__ */
|
|
43799
|
+
/* @__PURE__ */ jsx363(Meter, { label: "Invoices meter", minValue: 0, maxValue: 100, value: percentageOverdue, meterOnly: true, className: "Layer__InvoiceSummaryStats__Meter" })
|
|
43030
43800
|
] })
|
|
43031
43801
|
] });
|
|
43032
43802
|
};
|
|
43033
43803
|
|
|
43034
43804
|
// src/components/Invoices/InvoiceOverview/InvoiceOverview.tsx
|
|
43035
|
-
import { jsx as
|
|
43805
|
+
import { jsx as jsx364, jsxs as jsxs231 } from "react/jsx-runtime";
|
|
43036
43806
|
var InvoiceOverview = () => {
|
|
43037
|
-
return /* @__PURE__ */
|
|
43038
|
-
/* @__PURE__ */
|
|
43039
|
-
/* @__PURE__ */
|
|
43807
|
+
return /* @__PURE__ */ jsxs231(VStack, { children: [
|
|
43808
|
+
/* @__PURE__ */ jsx364(InvoiceSummaryStats, {}),
|
|
43809
|
+
/* @__PURE__ */ jsx364(InvoiceTable, {})
|
|
43040
43810
|
] });
|
|
43041
43811
|
};
|
|
43042
43812
|
|
|
43043
43813
|
// src/components/Invoices/Invoices.tsx
|
|
43044
|
-
import { jsx as
|
|
43814
|
+
import { jsx as jsx365 } from "react/jsx-runtime";
|
|
43045
43815
|
var unstable_Invoices = ({ showTitle = true, stringOverrides }) => {
|
|
43046
|
-
return /* @__PURE__ */
|
|
43816
|
+
return /* @__PURE__ */ jsx365(InvoiceStoreProvider, { children: /* @__PURE__ */ jsx365(View, { title: (stringOverrides == null ? void 0 : stringOverrides.title) || "Invoices", showHeader: showTitle, children: /* @__PURE__ */ jsx365(InvoicesContent, {}) }) });
|
|
43047
43817
|
};
|
|
43048
43818
|
var InvoicesContent = () => {
|
|
43049
43819
|
const routeState = useInvoiceRouteState();
|
|
43050
|
-
return routeState.route === "Detail" /* Detail */ ? /* @__PURE__ */
|
|
43820
|
+
return routeState.route === "Detail" /* Detail */ ? /* @__PURE__ */ jsx365(InvoiceDetail, {}) : /* @__PURE__ */ jsx365(InvoiceOverview, {});
|
|
43051
43821
|
};
|
|
43052
43822
|
|
|
43053
43823
|
// src/providers/BankTransactionsProvider/BankTransactionsProvider.tsx
|
|
43054
|
-
import { jsx as
|
|
43824
|
+
import { jsx as jsx366 } from "react/jsx-runtime";
|
|
43055
43825
|
var BankTransactionsProvider = ({
|
|
43056
43826
|
children
|
|
43057
43827
|
}) => {
|
|
43058
43828
|
const bankTransactionsContextData = useAugmentedBankTransactions();
|
|
43059
|
-
return /* @__PURE__ */
|
|
43829
|
+
return /* @__PURE__ */ jsx366(BankTransactionsContext.Provider, { value: bankTransactionsContextData, children });
|
|
43060
43830
|
};
|
|
43061
43831
|
export {
|
|
43062
43832
|
AccountingOverview,
|