@layerfi/components 0.1.42 → 0.1.43
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/esm/index.js +154 -75
- package/dist/esm/index.js.map +2 -2
- package/dist/index.d.ts +36 -21
- package/dist/index.js +154 -75
- package/dist/index.js.map +2 -2
- package/dist/styles/index.css +4 -9
- package/dist/styles/index.css.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5389,7 +5389,8 @@ var MatchForm = ({
|
|
|
5389
5389
|
bankTransaction,
|
|
5390
5390
|
selectedMatchId,
|
|
5391
5391
|
setSelectedMatchId,
|
|
5392
|
-
matchFormError
|
|
5392
|
+
matchFormError,
|
|
5393
|
+
readOnly = false
|
|
5393
5394
|
}) => {
|
|
5394
5395
|
return /* @__PURE__ */ import_react62.default.createElement("div", { className: `${classNamePrefix}__match-table` }, /* @__PURE__ */ import_react62.default.createElement("div", { className: `${classNamePrefix}__match-table__header` }, /* @__PURE__ */ import_react62.default.createElement("div", { className: `${classNamePrefix}__match-table__date` }, "Date"), /* @__PURE__ */ import_react62.default.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, "Description"), /* @__PURE__ */ import_react62.default.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "Amount"), /* @__PURE__ */ import_react62.default.createElement(
|
|
5395
5396
|
"div",
|
|
@@ -5406,6 +5407,9 @@ var MatchForm = ({
|
|
|
5406
5407
|
match.id === selectedMatchId ? `${classNamePrefix}__match-row--selected` : ""
|
|
5407
5408
|
),
|
|
5408
5409
|
onClick: () => {
|
|
5410
|
+
if (readOnly === true) {
|
|
5411
|
+
return;
|
|
5412
|
+
}
|
|
5409
5413
|
if (selectedMatchId === match.id) {
|
|
5410
5414
|
setSelectedMatchId(void 0);
|
|
5411
5415
|
return;
|
|
@@ -5814,6 +5818,7 @@ var ExpandedBankTransactionRow = (0, import_react67.forwardRef)(
|
|
|
5814
5818
|
submitBtnText = "Save",
|
|
5815
5819
|
containerWidth,
|
|
5816
5820
|
showDescriptions,
|
|
5821
|
+
mode,
|
|
5817
5822
|
showReceiptUploads,
|
|
5818
5823
|
hardRefreshPnlOnCategorize
|
|
5819
5824
|
}, ref) => {
|
|
@@ -5886,7 +5891,7 @@ var ExpandedBankTransactionRow = (0, import_react67.forwardRef)(
|
|
|
5886
5891
|
};
|
|
5887
5892
|
const sanitizeNumberInput = (input) => {
|
|
5888
5893
|
let sanitized = input.replace(/[^0-9.]/g, "");
|
|
5889
|
-
|
|
5894
|
+
const parts = sanitized.split(".");
|
|
5890
5895
|
if (parts.length > 2) {
|
|
5891
5896
|
sanitized = parts[0] + "." + parts.slice(1).join("");
|
|
5892
5897
|
}
|
|
@@ -6076,7 +6081,7 @@ var ExpandedBankTransactionRow = (0, import_react67.forwardRef)(
|
|
|
6076
6081
|
style: { height },
|
|
6077
6082
|
onTransitionEnd: handleTransitionEnd
|
|
6078
6083
|
},
|
|
6079
|
-
shouldHide ? null : /* @__PURE__ */ import_react67.default.createElement("span", { className: `${className}__wrapper`, ref: bodyRef }, /* @__PURE__ */ import_react67.default.createElement("div", { className: `${className}__content-toggle` }, /* @__PURE__ */ import_react67.default.createElement(
|
|
6084
|
+
shouldHide ? null : /* @__PURE__ */ import_react67.default.createElement("span", { className: `${className}__wrapper`, ref: bodyRef }, categorizationEnabled(mode) ? /* @__PURE__ */ import_react67.default.createElement("div", { className: `${className}__content-toggle` }, /* @__PURE__ */ import_react67.default.createElement(
|
|
6080
6085
|
Toggle,
|
|
6081
6086
|
{
|
|
6082
6087
|
name: `purpose-${bankTransaction.id}${asListItem ? "-li" : ""}`,
|
|
@@ -6096,7 +6101,7 @@ var ExpandedBankTransactionRow = (0, import_react67.forwardRef)(
|
|
|
6096
6101
|
selected: purpose,
|
|
6097
6102
|
onChange: onChangePurpose
|
|
6098
6103
|
}
|
|
6099
|
-
)), /* @__PURE__ */ import_react67.default.createElement(
|
|
6104
|
+
)) : /* @__PURE__ */ import_react67.default.createElement(import_react67.default.Fragment, null), /* @__PURE__ */ import_react67.default.createElement(
|
|
6100
6105
|
"div",
|
|
6101
6106
|
{
|
|
6102
6107
|
className: `${className}__content`,
|
|
@@ -6117,6 +6122,7 @@ var ExpandedBankTransactionRow = (0, import_react67.forwardRef)(
|
|
|
6117
6122
|
classNamePrefix: className,
|
|
6118
6123
|
bankTransaction,
|
|
6119
6124
|
selectedMatchId,
|
|
6125
|
+
readOnly: !categorizationEnabled(mode),
|
|
6120
6126
|
setSelectedMatchId: (id) => {
|
|
6121
6127
|
setMatchFormError(void 0);
|
|
6122
6128
|
setSelectedMatchId(id);
|
|
@@ -6144,7 +6150,7 @@ var ExpandedBankTransactionRow = (0, import_react67.forwardRef)(
|
|
|
6144
6150
|
{
|
|
6145
6151
|
type: "text",
|
|
6146
6152
|
name: `split-${index}${asListItem ? "-li" : ""}`,
|
|
6147
|
-
disabled: index === 0,
|
|
6153
|
+
disabled: index === 0 || !categorizationEnabled(mode),
|
|
6148
6154
|
onChange: updateAmounts(index),
|
|
6149
6155
|
value: split.inputValue,
|
|
6150
6156
|
onBlur,
|
|
@@ -6166,7 +6172,7 @@ var ExpandedBankTransactionRow = (0, import_react67.forwardRef)(
|
|
|
6166
6172
|
value: split.category,
|
|
6167
6173
|
onChange: (value) => changeCategory(index, value),
|
|
6168
6174
|
className: "Layer__category-menu--full",
|
|
6169
|
-
disabled: bankTransaction.processing,
|
|
6175
|
+
disabled: bankTransaction.processing || !categorizationEnabled(mode),
|
|
6170
6176
|
excludeMatches: true
|
|
6171
6177
|
}
|
|
6172
6178
|
),
|
|
@@ -6194,7 +6200,7 @@ var ExpandedBankTransactionRow = (0, import_react67.forwardRef)(
|
|
|
6194
6200
|
)
|
|
6195
6201
|
)}`
|
|
6196
6202
|
}
|
|
6197
|
-
), /* @__PURE__ */ import_react67.default.createElement("div", { className: `${className}__splits-buttons` }, rowState.splits.length > 1 ? /* @__PURE__ */ import_react67.default.createElement(
|
|
6203
|
+
), categorizationEnabled(mode) ? /* @__PURE__ */ import_react67.default.createElement("div", { className: `${className}__splits-buttons` }, rowState.splits.length > 1 ? /* @__PURE__ */ import_react67.default.createElement(
|
|
6198
6204
|
TextButton,
|
|
6199
6205
|
{
|
|
6200
6206
|
onClick: addSplit,
|
|
@@ -6210,7 +6216,7 @@ var ExpandedBankTransactionRow = (0, import_react67.forwardRef)(
|
|
|
6210
6216
|
disabled: rowState.splits.length > 5
|
|
6211
6217
|
},
|
|
6212
6218
|
"Split"
|
|
6213
|
-
))))
|
|
6219
|
+
)) : /* @__PURE__ */ import_react67.default.createElement(import_react67.default.Fragment, null)))
|
|
6214
6220
|
)),
|
|
6215
6221
|
showDescriptions && /* @__PURE__ */ import_react67.default.createElement(
|
|
6216
6222
|
InputGroup,
|
|
@@ -6330,6 +6336,7 @@ var BankTransactionRow = ({
|
|
|
6330
6336
|
editable,
|
|
6331
6337
|
dateFormat,
|
|
6332
6338
|
bankTransaction,
|
|
6339
|
+
mode,
|
|
6333
6340
|
removeTransaction,
|
|
6334
6341
|
containerWidth,
|
|
6335
6342
|
initialLoad,
|
|
@@ -6549,7 +6556,7 @@ var BankTransactionRow = ({
|
|
|
6549
6556
|
/* @__PURE__ */ import_react69.default.createElement("span", null, "Unsaved"),
|
|
6550
6557
|
/* @__PURE__ */ import_react69.default.createElement(AlertCircle_default, { size: 12 })
|
|
6551
6558
|
) : null,
|
|
6552
|
-
!categorized && (open || !open && !showRetry) || categorized && open ? /* @__PURE__ */ import_react69.default.createElement(
|
|
6559
|
+
!categorized && (open || !open && !showRetry) || categorizationEnabled(mode) && categorized && open ? /* @__PURE__ */ import_react69.default.createElement(
|
|
6553
6560
|
SubmitButton,
|
|
6554
6561
|
{
|
|
6555
6562
|
onClick: () => {
|
|
@@ -6586,6 +6593,7 @@ var BankTransactionRow = ({
|
|
|
6586
6593
|
bankTransaction,
|
|
6587
6594
|
categorized,
|
|
6588
6595
|
isOpen: open,
|
|
6596
|
+
mode,
|
|
6589
6597
|
close: () => setOpen(false),
|
|
6590
6598
|
containerWidth,
|
|
6591
6599
|
showDescriptions,
|
|
@@ -6640,6 +6648,7 @@ var BankTransactionListItem = ({
|
|
|
6640
6648
|
dateFormat,
|
|
6641
6649
|
bankTransaction,
|
|
6642
6650
|
editable,
|
|
6651
|
+
mode,
|
|
6643
6652
|
showDescriptions,
|
|
6644
6653
|
showReceiptUploads,
|
|
6645
6654
|
hardRefreshPnlOnCategorize,
|
|
@@ -6735,6 +6744,7 @@ var BankTransactionListItem = ({
|
|
|
6735
6744
|
ref: expandedRowRef,
|
|
6736
6745
|
bankTransaction,
|
|
6737
6746
|
isOpen: open,
|
|
6747
|
+
mode,
|
|
6738
6748
|
close: () => setOpen(false),
|
|
6739
6749
|
categorized,
|
|
6740
6750
|
asListItem: true,
|
|
@@ -6790,6 +6800,7 @@ var BankTransactionList = ({
|
|
|
6790
6800
|
bankTransactions,
|
|
6791
6801
|
editable,
|
|
6792
6802
|
removeTransaction,
|
|
6803
|
+
mode,
|
|
6793
6804
|
containerWidth,
|
|
6794
6805
|
showDescriptions = false,
|
|
6795
6806
|
showReceiptUploads = false,
|
|
@@ -6804,6 +6815,7 @@ var BankTransactionList = ({
|
|
|
6804
6815
|
key: bankTransaction.id,
|
|
6805
6816
|
dateFormat: DATE_FORMAT,
|
|
6806
6817
|
bankTransaction,
|
|
6818
|
+
mode,
|
|
6807
6819
|
editable,
|
|
6808
6820
|
removeTransaction,
|
|
6809
6821
|
containerWidth,
|
|
@@ -7312,6 +7324,7 @@ var BankTransactionMobileListItem = ({
|
|
|
7312
7324
|
bankTransaction,
|
|
7313
7325
|
removeTransaction,
|
|
7314
7326
|
editable,
|
|
7327
|
+
mode,
|
|
7315
7328
|
initialLoad,
|
|
7316
7329
|
hardRefreshPnlOnCategorize = false
|
|
7317
7330
|
}) => {
|
|
@@ -7402,31 +7415,29 @@ var BankTransactionMobileListItem = ({
|
|
|
7402
7415
|
open ? openClassName : "",
|
|
7403
7416
|
showComponent ? "show" : ""
|
|
7404
7417
|
);
|
|
7405
|
-
return /* @__PURE__ */ import_react80.default.createElement(
|
|
7406
|
-
"
|
|
7418
|
+
return /* @__PURE__ */ import_react80.default.createElement("li", { ref: itemRef, className: rowClassName, "data-item": bankTransaction.id }, /* @__PURE__ */ import_react80.default.createElement(
|
|
7419
|
+
"span",
|
|
7407
7420
|
{
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
"
|
|
7421
|
+
className: `${className}__heading`,
|
|
7422
|
+
onClick: toggleOpen,
|
|
7423
|
+
role: "button",
|
|
7424
|
+
style: { height: headingHeight }
|
|
7411
7425
|
},
|
|
7412
|
-
/* @__PURE__ */ import_react80.default.createElement(
|
|
7426
|
+
/* @__PURE__ */ import_react80.default.createElement("div", { className: `${className}__heading__content`, ref: headingRowRef }, /* @__PURE__ */ import_react80.default.createElement("div", { className: `${className}__heading__main` }, /* @__PURE__ */ import_react80.default.createElement(Text, { as: "span", className: `${className}__heading__tx-name` }, bankTransaction.counterparty_name ?? bankTransaction.description), /* @__PURE__ */ import_react80.default.createElement(Text, { as: "span", className: `${className}__heading__account-name` }, categorized && bankTransaction.categorization_status ? getAssignedValue2(bankTransaction) : null, !categorized && bankTransaction.account_name), categorized && open && /* @__PURE__ */ import_react80.default.createElement(Text, { as: "span", className: `${className}__categorized-name` }, bankTransaction.account_name)), /* @__PURE__ */ import_react80.default.createElement("div", { className: `${className}__heading__amount` }, /* @__PURE__ */ import_react80.default.createElement(
|
|
7413
7427
|
"span",
|
|
7414
7428
|
{
|
|
7415
|
-
className: `${className}
|
|
7416
|
-
onClick: toggleOpen,
|
|
7417
|
-
role: "button",
|
|
7418
|
-
style: { height: headingHeight }
|
|
7429
|
+
className: `${className}__amount-${isCredit(bankTransaction) ? "credit" : "debit"}`
|
|
7419
7430
|
},
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7426
|
-
|
|
7427
|
-
|
|
7428
|
-
|
|
7429
|
-
|
|
7431
|
+
isCredit(bankTransaction) ? "+$" : " $",
|
|
7432
|
+
centsToDollars(bankTransaction.amount)
|
|
7433
|
+
), /* @__PURE__ */ import_react80.default.createElement("span", { className: `${className}__heading__date` }, (0, import_date_fns12.format)((0, import_date_fns12.parseISO)(bankTransaction.date), DATE_FORMAT2))))
|
|
7434
|
+
), categorizationEnabled(mode) ? /* @__PURE__ */ import_react80.default.createElement(
|
|
7435
|
+
"div",
|
|
7436
|
+
{
|
|
7437
|
+
className: `${className}__expanded-row`,
|
|
7438
|
+
style: { height: !open || removeAnim ? 0 : height }
|
|
7439
|
+
},
|
|
7440
|
+
open && /* @__PURE__ */ import_react80.default.createElement(
|
|
7430
7441
|
"div",
|
|
7431
7442
|
{
|
|
7432
7443
|
className: `${className}__expanded-row__content`,
|
|
@@ -7441,17 +7452,20 @@ var BankTransactionMobileListItem = ({
|
|
|
7441
7452
|
{
|
|
7442
7453
|
value: "business",
|
|
7443
7454
|
label: "Business",
|
|
7444
|
-
style: { minWidth: 84 }
|
|
7455
|
+
style: { minWidth: 84 },
|
|
7456
|
+
disabled: categorizationEnabled(mode)
|
|
7445
7457
|
},
|
|
7446
7458
|
{
|
|
7447
7459
|
value: "personal",
|
|
7448
7460
|
label: "Personal",
|
|
7449
|
-
style: { minWidth: 84 }
|
|
7461
|
+
style: { minWidth: 84 },
|
|
7462
|
+
disabled: categorizationEnabled(mode)
|
|
7450
7463
|
},
|
|
7451
7464
|
{
|
|
7452
7465
|
value: "more",
|
|
7453
7466
|
label: "More",
|
|
7454
|
-
style: { minWidth: 84 }
|
|
7467
|
+
style: { minWidth: 84 },
|
|
7468
|
+
disabled: categorizationEnabled(mode)
|
|
7455
7469
|
}
|
|
7456
7470
|
],
|
|
7457
7471
|
selected: purpose,
|
|
@@ -7466,8 +7480,8 @@ var BankTransactionMobileListItem = ({
|
|
|
7466
7480
|
hardRefreshPnlOnCategorize
|
|
7467
7481
|
}
|
|
7468
7482
|
)
|
|
7469
|
-
)
|
|
7470
|
-
);
|
|
7483
|
+
)
|
|
7484
|
+
) : /* @__PURE__ */ import_react80.default.createElement(import_react80.default.Fragment, null));
|
|
7471
7485
|
};
|
|
7472
7486
|
|
|
7473
7487
|
// src/components/BankTransactionMobileList/BankTransactionMobileList.tsx
|
|
@@ -7476,6 +7490,7 @@ var BankTransactionMobileList = ({
|
|
|
7476
7490
|
removeTransaction,
|
|
7477
7491
|
editable,
|
|
7478
7492
|
initialLoad,
|
|
7493
|
+
mode,
|
|
7479
7494
|
hardRefreshPnlOnCategorize
|
|
7480
7495
|
}) => {
|
|
7481
7496
|
const transactionToOpenContextData = useTransactionToOpen();
|
|
@@ -7484,6 +7499,7 @@ var BankTransactionMobileList = ({
|
|
|
7484
7499
|
BankTransactionMobileListItem,
|
|
7485
7500
|
{
|
|
7486
7501
|
index,
|
|
7502
|
+
mode,
|
|
7487
7503
|
key: bankTransaction.id,
|
|
7488
7504
|
bankTransaction,
|
|
7489
7505
|
editable,
|
|
@@ -7623,6 +7639,7 @@ var BankTransactionsTable = ({
|
|
|
7623
7639
|
editable,
|
|
7624
7640
|
isLoading,
|
|
7625
7641
|
bankTransactions,
|
|
7642
|
+
mode,
|
|
7626
7643
|
initialLoad,
|
|
7627
7644
|
containerWidth,
|
|
7628
7645
|
removeTransaction,
|
|
@@ -7651,6 +7668,7 @@ var BankTransactionsTable = ({
|
|
|
7651
7668
|
initialLoad,
|
|
7652
7669
|
index,
|
|
7653
7670
|
editable,
|
|
7671
|
+
mode,
|
|
7654
7672
|
key: bankTransaction.id,
|
|
7655
7673
|
dateFormat: DATE_FORMAT,
|
|
7656
7674
|
bankTransaction,
|
|
@@ -8643,6 +8661,12 @@ var import_date_fns16 = require("date-fns");
|
|
|
8643
8661
|
var COMPONENT_NAME2 = "bank-transactions";
|
|
8644
8662
|
var TEST_EMPTY_STATE = false;
|
|
8645
8663
|
var POLL_INTERVAL = 1e4;
|
|
8664
|
+
var categorizationEnabled = (mode) => {
|
|
8665
|
+
if (mode === "bookkeeping-client") {
|
|
8666
|
+
return false;
|
|
8667
|
+
}
|
|
8668
|
+
return true;
|
|
8669
|
+
};
|
|
8646
8670
|
var BankTransactions = ({
|
|
8647
8671
|
onError,
|
|
8648
8672
|
...props
|
|
@@ -8652,8 +8676,7 @@ var BankTransactions = ({
|
|
|
8652
8676
|
var BankTransactionsContent = ({
|
|
8653
8677
|
asWidget = false,
|
|
8654
8678
|
pageSize = 20,
|
|
8655
|
-
|
|
8656
|
-
categorizeView = true,
|
|
8679
|
+
mode = "self-serve",
|
|
8657
8680
|
showDescriptions = false,
|
|
8658
8681
|
showReceiptUploads = false,
|
|
8659
8682
|
hardRefreshPnlOnCategorize = false,
|
|
@@ -8669,6 +8692,7 @@ var BankTransactionsContent = ({
|
|
|
8669
8692
|
startDate: (0, import_date_fns16.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
8670
8693
|
endDate: (0, import_date_fns16.endOfMonth)(/* @__PURE__ */ new Date())
|
|
8671
8694
|
});
|
|
8695
|
+
const categorizeView = categorizationEnabled(mode);
|
|
8672
8696
|
const {
|
|
8673
8697
|
activate,
|
|
8674
8698
|
data,
|
|
@@ -8728,7 +8752,7 @@ var BankTransactionsContent = ({
|
|
|
8728
8752
|
...inputFilters,
|
|
8729
8753
|
categorizationStatus: "review" /* review */
|
|
8730
8754
|
});
|
|
8731
|
-
} else if (!filters?.categorizationStatus &&
|
|
8755
|
+
} else if (!filters?.categorizationStatus && !categorizationEnabled(mode)) {
|
|
8732
8756
|
setFilters({
|
|
8733
8757
|
...filters,
|
|
8734
8758
|
...inputFilters,
|
|
@@ -8741,12 +8765,12 @@ var BankTransactionsContent = ({
|
|
|
8741
8765
|
setFilters({
|
|
8742
8766
|
categorizationStatus: "review" /* review */
|
|
8743
8767
|
});
|
|
8744
|
-
} else if (!filters?.categorizationStatus &&
|
|
8768
|
+
} else if (!filters?.categorizationStatus && !categorizationEnabled(mode)) {
|
|
8745
8769
|
setFilters({
|
|
8746
8770
|
categorizationStatus: "categorized" /* categorized */
|
|
8747
8771
|
});
|
|
8748
8772
|
}
|
|
8749
|
-
}, [inputFilters, categorizeView,
|
|
8773
|
+
}, [inputFilters, categorizeView, mode]);
|
|
8750
8774
|
(0, import_react97.useEffect)(() => {
|
|
8751
8775
|
if (loadingStatus === "complete") {
|
|
8752
8776
|
const timeoutLoad = setTimeout(() => {
|
|
@@ -8809,7 +8833,7 @@ var BankTransactionsContent = ({
|
|
|
8809
8833
|
{
|
|
8810
8834
|
shiftStickyHeader,
|
|
8811
8835
|
asWidget,
|
|
8812
|
-
categorizedOnly,
|
|
8836
|
+
categorizedOnly: !categorizationEnabled(mode),
|
|
8813
8837
|
categorizeView,
|
|
8814
8838
|
display,
|
|
8815
8839
|
onCategorizationDisplayChange,
|
|
@@ -8831,6 +8855,7 @@ var BankTransactionsContent = ({
|
|
|
8831
8855
|
isLoading,
|
|
8832
8856
|
isSyncing,
|
|
8833
8857
|
bankTransactions,
|
|
8858
|
+
mode,
|
|
8834
8859
|
initialLoad,
|
|
8835
8860
|
containerWidth,
|
|
8836
8861
|
removeTransaction,
|
|
@@ -8846,6 +8871,7 @@ var BankTransactionsContent = ({
|
|
|
8846
8871
|
!isLoading && listView && mobileComponent !== "mobileList" ? /* @__PURE__ */ import_react97.default.createElement(
|
|
8847
8872
|
BankTransactionList,
|
|
8848
8873
|
{
|
|
8874
|
+
mode,
|
|
8849
8875
|
bankTransactions,
|
|
8850
8876
|
editable,
|
|
8851
8877
|
removeTransaction,
|
|
@@ -8859,6 +8885,7 @@ var BankTransactionsContent = ({
|
|
|
8859
8885
|
{
|
|
8860
8886
|
bankTransactions,
|
|
8861
8887
|
editable,
|
|
8888
|
+
mode,
|
|
8862
8889
|
removeTransaction,
|
|
8863
8890
|
initialLoad,
|
|
8864
8891
|
hardRefreshPnlOnCategorize
|
|
@@ -9460,9 +9487,9 @@ var ProfitAndLossChart = ({
|
|
|
9460
9487
|
name: getMonthName(pnl),
|
|
9461
9488
|
revenue: pnl?.income || 0,
|
|
9462
9489
|
revenueUncategorized: pnl?.uncategorizedInflows || 0,
|
|
9463
|
-
expenses: -(pnl?.
|
|
9490
|
+
expenses: -(pnl?.totalExpenses || 0),
|
|
9464
9491
|
expensesUncategorized: -(pnl?.uncategorizedOutflows || 0),
|
|
9465
|
-
|
|
9492
|
+
totalExpensesInverse: pnl?.totalExpensesInverse || 0,
|
|
9466
9493
|
uncategorizedOutflowsInverse: pnl?.uncategorizedOutflowsInverse || 0,
|
|
9467
9494
|
netProfit: pnl?.netProfit || 0,
|
|
9468
9495
|
selected: !!pnl && pnl.month === selectionMonth.month + 1 && pnl.year === selectionMonth.year,
|
|
@@ -9482,7 +9509,7 @@ var ProfitAndLossChart = ({
|
|
|
9482
9509
|
name: (0, import_date_fns19.format)(currentDate, compactView ? "LLLLL" : "LLL"),
|
|
9483
9510
|
revenue: 0,
|
|
9484
9511
|
revenueUncategorized: 0,
|
|
9485
|
-
|
|
9512
|
+
totalExpensesInverse: 0,
|
|
9486
9513
|
uncategorizedOutflowsInverse: 0,
|
|
9487
9514
|
expenses: 0,
|
|
9488
9515
|
expensesUncategorized: 0,
|
|
@@ -9502,9 +9529,9 @@ var ProfitAndLossChart = ({
|
|
|
9502
9529
|
if (totalExpenses < 0 || x.uncategorizedOutflows < 0) {
|
|
9503
9530
|
return {
|
|
9504
9531
|
...x,
|
|
9505
|
-
|
|
9532
|
+
totalExpenses: totalExpenses < 0 ? 0 : totalExpenses,
|
|
9506
9533
|
uncategorizedOutflows: x.uncategorizedOutflows < 0 ? 0 : x.uncategorizedOutflows,
|
|
9507
|
-
|
|
9534
|
+
totalExpensesInverse: totalExpenses < 0 ? -totalExpenses : 0,
|
|
9508
9535
|
uncategorizedOutflowsInverse: x.uncategorizedOutflows < 0 ? -x.uncategorizedOutflows : 0
|
|
9509
9536
|
};
|
|
9510
9537
|
}
|
|
@@ -9800,7 +9827,7 @@ var ProfitAndLossChart = ({
|
|
|
9800
9827
|
/* @__PURE__ */ import_react103.default.createElement(
|
|
9801
9828
|
import_recharts.Bar,
|
|
9802
9829
|
{
|
|
9803
|
-
dataKey: "
|
|
9830
|
+
dataKey: "totalExpensesInverse",
|
|
9804
9831
|
barSize,
|
|
9805
9832
|
isAnimationActive: barAnimActive,
|
|
9806
9833
|
animationDuration: 100,
|
|
@@ -10906,17 +10933,18 @@ var ProfitAndLossRow = ({
|
|
|
10906
10933
|
variant,
|
|
10907
10934
|
lineItem,
|
|
10908
10935
|
depth = 0,
|
|
10909
|
-
maxDepth =
|
|
10936
|
+
maxDepth = 8,
|
|
10910
10937
|
direction = "DEBIT" /* DEBIT */,
|
|
10911
10938
|
lockExpanded = false,
|
|
10912
10939
|
scope,
|
|
10913
|
-
setSidebarScope
|
|
10940
|
+
setSidebarScope,
|
|
10941
|
+
defaultExpanded = false
|
|
10914
10942
|
}) => {
|
|
10915
10943
|
if (!lineItem) {
|
|
10916
10944
|
return null;
|
|
10917
10945
|
}
|
|
10918
10946
|
const { value, display_name, line_items } = lineItem;
|
|
10919
|
-
const [expanded, setExpanded] = (0, import_react111.useState)(
|
|
10947
|
+
const [expanded, setExpanded] = (0, import_react111.useState)(lockExpanded || defaultExpanded);
|
|
10920
10948
|
const amount = value ?? 0;
|
|
10921
10949
|
const amountString = centsToDollars(Math.abs(amount));
|
|
10922
10950
|
const labelClasses = [
|
|
@@ -10951,7 +10979,10 @@ var ProfitAndLossRow = ({
|
|
|
10951
10979
|
"div",
|
|
10952
10980
|
{
|
|
10953
10981
|
className: labelClasses.join(" "),
|
|
10954
|
-
onClick: () => !lockExpanded && toggleExpanded()
|
|
10982
|
+
onClick: () => !lockExpanded && toggleExpanded(),
|
|
10983
|
+
style: {
|
|
10984
|
+
paddingLeft: depth === 0 && !hasChildren ? 28 : 16 * (depth + 1) + 2
|
|
10985
|
+
}
|
|
10955
10986
|
},
|
|
10956
10987
|
/* @__PURE__ */ import_react111.default.createElement("span", { className: "Layer__profit-and-loss-row__label__title" }, !lockExpanded && variant !== "summation" ? /* @__PURE__ */ import_react111.default.createElement(
|
|
10957
10988
|
ChevronDownFill_default,
|
|
@@ -11039,7 +11070,11 @@ var empty_profit_and_loss_report_default = {
|
|
|
11039
11070
|
|
|
11040
11071
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
11041
11072
|
var import_classnames46 = __toESM(require("classnames"));
|
|
11042
|
-
var ProfitAndLossTable = ({
|
|
11073
|
+
var ProfitAndLossTable = ({
|
|
11074
|
+
lockExpanded,
|
|
11075
|
+
asContainer,
|
|
11076
|
+
stringOverrides
|
|
11077
|
+
}) => {
|
|
11043
11078
|
const {
|
|
11044
11079
|
data: actualData,
|
|
11045
11080
|
isLoading,
|
|
@@ -11074,7 +11109,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11074
11109
|
direction: "CREDIT" /* CREDIT */,
|
|
11075
11110
|
lockExpanded,
|
|
11076
11111
|
scope: "revenue",
|
|
11077
|
-
setSidebarScope
|
|
11112
|
+
setSidebarScope,
|
|
11113
|
+
defaultExpanded: true
|
|
11078
11114
|
}
|
|
11079
11115
|
),
|
|
11080
11116
|
/* @__PURE__ */ import_react112.default.createElement(
|
|
@@ -11084,7 +11120,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11084
11120
|
direction: "DEBIT" /* DEBIT */,
|
|
11085
11121
|
lockExpanded,
|
|
11086
11122
|
scope: "expenses",
|
|
11087
|
-
setSidebarScope
|
|
11123
|
+
setSidebarScope,
|
|
11124
|
+
defaultExpanded: true
|
|
11088
11125
|
}
|
|
11089
11126
|
),
|
|
11090
11127
|
/* @__PURE__ */ import_react112.default.createElement(
|
|
@@ -11098,7 +11135,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11098
11135
|
direction: "CREDIT" /* CREDIT */,
|
|
11099
11136
|
lockExpanded,
|
|
11100
11137
|
scope: "revenue",
|
|
11101
|
-
setSidebarScope
|
|
11138
|
+
setSidebarScope,
|
|
11139
|
+
defaultExpanded: true
|
|
11102
11140
|
}
|
|
11103
11141
|
),
|
|
11104
11142
|
/* @__PURE__ */ import_react112.default.createElement(
|
|
@@ -11108,7 +11146,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11108
11146
|
direction: "DEBIT" /* DEBIT */,
|
|
11109
11147
|
lockExpanded,
|
|
11110
11148
|
scope: "expenses",
|
|
11111
|
-
setSidebarScope
|
|
11149
|
+
setSidebarScope,
|
|
11150
|
+
defaultExpanded: true
|
|
11112
11151
|
}
|
|
11113
11152
|
),
|
|
11114
11153
|
/* @__PURE__ */ import_react112.default.createElement(
|
|
@@ -11122,7 +11161,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11122
11161
|
direction: "CREDIT" /* CREDIT */,
|
|
11123
11162
|
lockExpanded,
|
|
11124
11163
|
scope: "revenue",
|
|
11125
|
-
setSidebarScope
|
|
11164
|
+
setSidebarScope,
|
|
11165
|
+
defaultExpanded: true
|
|
11126
11166
|
}
|
|
11127
11167
|
),
|
|
11128
11168
|
/* @__PURE__ */ import_react112.default.createElement(
|
|
@@ -11132,7 +11172,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11132
11172
|
direction: "DEBIT" /* DEBIT */,
|
|
11133
11173
|
lockExpanded,
|
|
11134
11174
|
scope: "expenses",
|
|
11135
|
-
setSidebarScope
|
|
11175
|
+
setSidebarScope,
|
|
11176
|
+
defaultExpanded: true
|
|
11136
11177
|
}
|
|
11137
11178
|
),
|
|
11138
11179
|
/* @__PURE__ */ import_react112.default.createElement(
|
|
@@ -15411,7 +15452,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
15411
15452
|
showLedgerBalance = true,
|
|
15412
15453
|
showUnlinkItem = false,
|
|
15413
15454
|
showBreakConnection = false,
|
|
15414
|
-
|
|
15455
|
+
mode = "self-serve",
|
|
15415
15456
|
hardRefreshPnlOnCategorize = false,
|
|
15416
15457
|
showDescriptions,
|
|
15417
15458
|
showReceiptUploads,
|
|
@@ -15434,7 +15475,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
15434
15475
|
showDescriptions,
|
|
15435
15476
|
showReceiptUploads,
|
|
15436
15477
|
mobileComponent,
|
|
15437
|
-
|
|
15478
|
+
mode,
|
|
15438
15479
|
hardRefreshPnlOnCategorize,
|
|
15439
15480
|
stringOverrides: stringOverrides?.bankTransactions
|
|
15440
15481
|
}
|
|
@@ -15478,7 +15519,9 @@ var GeneralLedgerView = ({
|
|
|
15478
15519
|
|
|
15479
15520
|
// src/views/Reports/Reports.tsx
|
|
15480
15521
|
var import_react177 = __toESM(require("react"));
|
|
15481
|
-
var DownloadButton2 = ({
|
|
15522
|
+
var DownloadButton2 = ({
|
|
15523
|
+
stringOverrides
|
|
15524
|
+
}) => {
|
|
15482
15525
|
const { dateRange } = (0, import_react177.useContext)(ProfitAndLoss.Context);
|
|
15483
15526
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
15484
15527
|
const [requestFailed, setRequestFailed] = (0, import_react177.useState)(false);
|
|
@@ -15526,33 +15569,64 @@ var DownloadButton2 = ({ stringOverrides }) => {
|
|
|
15526
15569
|
stringOverrides?.downloadButtonText || "Download"
|
|
15527
15570
|
);
|
|
15528
15571
|
};
|
|
15529
|
-
var
|
|
15572
|
+
var getOptions = (enabledReports) => {
|
|
15573
|
+
return [
|
|
15574
|
+
enabledReports.includes("profitAndLoss") ? {
|
|
15575
|
+
value: "profitAndLoss",
|
|
15576
|
+
label: "Profit & Loss"
|
|
15577
|
+
} : null,
|
|
15578
|
+
enabledReports.includes("balanceSheet") ? {
|
|
15579
|
+
value: "balanceSheet",
|
|
15580
|
+
label: "Balance Sheet"
|
|
15581
|
+
} : null,
|
|
15582
|
+
enabledReports.includes("statementOfCashFlow") ? {
|
|
15583
|
+
value: "statementOfCashFlow",
|
|
15584
|
+
label: "Statement of Cash Flow"
|
|
15585
|
+
} : null
|
|
15586
|
+
].filter((o) => !!o);
|
|
15587
|
+
};
|
|
15588
|
+
var Reports = ({
|
|
15589
|
+
title,
|
|
15590
|
+
stringOverrides,
|
|
15591
|
+
enabledReports = ["profitAndLoss", "balanceSheet", "statementOfCashFlow"]
|
|
15592
|
+
}) => {
|
|
15530
15593
|
const containerRef = (0, import_react177.useRef)(null);
|
|
15531
|
-
const [activeTab, setActiveTab] = (0, import_react177.useState)(
|
|
15532
|
-
|
|
15594
|
+
const [activeTab, setActiveTab] = (0, import_react177.useState)(enabledReports[0]);
|
|
15595
|
+
const options = getOptions(enabledReports);
|
|
15596
|
+
const defaultTitle = enabledReports.length > 1 ? "Reports" : options.find((option) => option.value = enabledReports[0])?.label;
|
|
15597
|
+
return /* @__PURE__ */ import_react177.default.createElement(View, { title: stringOverrides?.title || title || defaultTitle }, enabledReports.length > 1 && /* @__PURE__ */ import_react177.default.createElement("div", { className: "Layer__component Layer__header__actions" }, /* @__PURE__ */ import_react177.default.createElement(
|
|
15533
15598
|
Toggle,
|
|
15534
15599
|
{
|
|
15535
15600
|
name: "reports-tabs",
|
|
15536
|
-
options
|
|
15537
|
-
{ value: "profitAndLoss", label: "Profit & loss" },
|
|
15538
|
-
{ value: "balanceSheet", label: "Balance sheet" },
|
|
15539
|
-
{
|
|
15540
|
-
value: "statementOfCashFlow",
|
|
15541
|
-
label: "Statement of Cash Flow"
|
|
15542
|
-
}
|
|
15543
|
-
],
|
|
15601
|
+
options,
|
|
15544
15602
|
selected: activeTab,
|
|
15545
15603
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
15546
15604
|
}
|
|
15547
|
-
)), /* @__PURE__ */ import_react177.default.createElement(Container, { name: "reports", ref: containerRef }, /* @__PURE__ */ import_react177.default.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ import_react177.default.createElement(
|
|
15605
|
+
)), /* @__PURE__ */ import_react177.default.createElement(Container, { name: "reports", ref: containerRef }, /* @__PURE__ */ import_react177.default.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ import_react177.default.createElement(
|
|
15606
|
+
ReportsPanel,
|
|
15607
|
+
{
|
|
15608
|
+
containerRef,
|
|
15609
|
+
openReport: activeTab,
|
|
15610
|
+
stringOverrides
|
|
15611
|
+
}
|
|
15612
|
+
))));
|
|
15548
15613
|
};
|
|
15549
|
-
var ReportsPanel = ({
|
|
15614
|
+
var ReportsPanel = ({
|
|
15615
|
+
containerRef,
|
|
15616
|
+
openReport,
|
|
15617
|
+
stringOverrides
|
|
15618
|
+
}) => {
|
|
15550
15619
|
const { sidebarScope } = (0, import_react177.useContext)(ProfitAndLoss.Context);
|
|
15551
15620
|
return /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null, openReport === "profitAndLoss" && /* @__PURE__ */ import_react177.default.createElement(
|
|
15552
15621
|
View,
|
|
15553
15622
|
{
|
|
15554
15623
|
type: "panel",
|
|
15555
|
-
headerControls: /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null, /* @__PURE__ */ import_react177.default.createElement(ProfitAndLoss.DatePicker, null), /* @__PURE__ */ import_react177.default.createElement(
|
|
15624
|
+
headerControls: /* @__PURE__ */ import_react177.default.createElement(import_react177.default.Fragment, null, /* @__PURE__ */ import_react177.default.createElement(ProfitAndLoss.DatePicker, null), /* @__PURE__ */ import_react177.default.createElement(
|
|
15625
|
+
DownloadButton2,
|
|
15626
|
+
{
|
|
15627
|
+
stringOverrides: stringOverrides?.downloadButton
|
|
15628
|
+
}
|
|
15629
|
+
))
|
|
15556
15630
|
},
|
|
15557
15631
|
/* @__PURE__ */ import_react177.default.createElement(
|
|
15558
15632
|
Panel,
|
|
@@ -15575,7 +15649,12 @@ var ReportsPanel = ({ containerRef, openReport, stringOverrides }) => {
|
|
|
15575
15649
|
}
|
|
15576
15650
|
)
|
|
15577
15651
|
)
|
|
15578
|
-
), openReport === "balanceSheet" && /* @__PURE__ */ import_react177.default.createElement(BalanceSheet, { stringOverrides: stringOverrides?.balanceSheet }), openReport === "statementOfCashFlow" && /* @__PURE__ */ import_react177.default.createElement(
|
|
15652
|
+
), openReport === "balanceSheet" && /* @__PURE__ */ import_react177.default.createElement(BalanceSheet, { stringOverrides: stringOverrides?.balanceSheet }), openReport === "statementOfCashFlow" && /* @__PURE__ */ import_react177.default.createElement(
|
|
15653
|
+
StatementOfCashFlow,
|
|
15654
|
+
{
|
|
15655
|
+
stringOverrides: stringOverrides?.statementOfCashflow
|
|
15656
|
+
}
|
|
15657
|
+
));
|
|
15579
15658
|
};
|
|
15580
15659
|
|
|
15581
15660
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|