@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/esm/index.js
CHANGED
|
@@ -5361,7 +5361,8 @@ var MatchForm = ({
|
|
|
5361
5361
|
bankTransaction,
|
|
5362
5362
|
selectedMatchId,
|
|
5363
5363
|
setSelectedMatchId,
|
|
5364
|
-
matchFormError
|
|
5364
|
+
matchFormError,
|
|
5365
|
+
readOnly = false
|
|
5365
5366
|
}) => {
|
|
5366
5367
|
return /* @__PURE__ */ React75.createElement("div", { className: `${classNamePrefix}__match-table` }, /* @__PURE__ */ React75.createElement("div", { className: `${classNamePrefix}__match-table__header` }, /* @__PURE__ */ React75.createElement("div", { className: `${classNamePrefix}__match-table__date` }, "Date"), /* @__PURE__ */ React75.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, "Description"), /* @__PURE__ */ React75.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "Amount"), /* @__PURE__ */ React75.createElement(
|
|
5367
5368
|
"div",
|
|
@@ -5378,6 +5379,9 @@ var MatchForm = ({
|
|
|
5378
5379
|
match.id === selectedMatchId ? `${classNamePrefix}__match-row--selected` : ""
|
|
5379
5380
|
),
|
|
5380
5381
|
onClick: () => {
|
|
5382
|
+
if (readOnly === true) {
|
|
5383
|
+
return;
|
|
5384
|
+
}
|
|
5381
5385
|
if (selectedMatchId === match.id) {
|
|
5382
5386
|
setSelectedMatchId(void 0);
|
|
5383
5387
|
return;
|
|
@@ -5789,6 +5793,7 @@ var ExpandedBankTransactionRow = forwardRef5(
|
|
|
5789
5793
|
submitBtnText = "Save",
|
|
5790
5794
|
containerWidth,
|
|
5791
5795
|
showDescriptions,
|
|
5796
|
+
mode,
|
|
5792
5797
|
showReceiptUploads,
|
|
5793
5798
|
hardRefreshPnlOnCategorize
|
|
5794
5799
|
}, ref) => {
|
|
@@ -5861,7 +5866,7 @@ var ExpandedBankTransactionRow = forwardRef5(
|
|
|
5861
5866
|
};
|
|
5862
5867
|
const sanitizeNumberInput = (input) => {
|
|
5863
5868
|
let sanitized = input.replace(/[^0-9.]/g, "");
|
|
5864
|
-
|
|
5869
|
+
const parts = sanitized.split(".");
|
|
5865
5870
|
if (parts.length > 2) {
|
|
5866
5871
|
sanitized = parts[0] + "." + parts.slice(1).join("");
|
|
5867
5872
|
}
|
|
@@ -6051,7 +6056,7 @@ var ExpandedBankTransactionRow = forwardRef5(
|
|
|
6051
6056
|
style: { height },
|
|
6052
6057
|
onTransitionEnd: handleTransitionEnd
|
|
6053
6058
|
},
|
|
6054
|
-
shouldHide ? null : /* @__PURE__ */ React80.createElement("span", { className: `${className}__wrapper`, ref: bodyRef }, /* @__PURE__ */ React80.createElement("div", { className: `${className}__content-toggle` }, /* @__PURE__ */ React80.createElement(
|
|
6059
|
+
shouldHide ? null : /* @__PURE__ */ React80.createElement("span", { className: `${className}__wrapper`, ref: bodyRef }, categorizationEnabled(mode) ? /* @__PURE__ */ React80.createElement("div", { className: `${className}__content-toggle` }, /* @__PURE__ */ React80.createElement(
|
|
6055
6060
|
Toggle,
|
|
6056
6061
|
{
|
|
6057
6062
|
name: `purpose-${bankTransaction.id}${asListItem ? "-li" : ""}`,
|
|
@@ -6071,7 +6076,7 @@ var ExpandedBankTransactionRow = forwardRef5(
|
|
|
6071
6076
|
selected: purpose,
|
|
6072
6077
|
onChange: onChangePurpose
|
|
6073
6078
|
}
|
|
6074
|
-
)), /* @__PURE__ */ React80.createElement(
|
|
6079
|
+
)) : /* @__PURE__ */ React80.createElement(React80.Fragment, null), /* @__PURE__ */ React80.createElement(
|
|
6075
6080
|
"div",
|
|
6076
6081
|
{
|
|
6077
6082
|
className: `${className}__content`,
|
|
@@ -6092,6 +6097,7 @@ var ExpandedBankTransactionRow = forwardRef5(
|
|
|
6092
6097
|
classNamePrefix: className,
|
|
6093
6098
|
bankTransaction,
|
|
6094
6099
|
selectedMatchId,
|
|
6100
|
+
readOnly: !categorizationEnabled(mode),
|
|
6095
6101
|
setSelectedMatchId: (id) => {
|
|
6096
6102
|
setMatchFormError(void 0);
|
|
6097
6103
|
setSelectedMatchId(id);
|
|
@@ -6119,7 +6125,7 @@ var ExpandedBankTransactionRow = forwardRef5(
|
|
|
6119
6125
|
{
|
|
6120
6126
|
type: "text",
|
|
6121
6127
|
name: `split-${index}${asListItem ? "-li" : ""}`,
|
|
6122
|
-
disabled: index === 0,
|
|
6128
|
+
disabled: index === 0 || !categorizationEnabled(mode),
|
|
6123
6129
|
onChange: updateAmounts(index),
|
|
6124
6130
|
value: split.inputValue,
|
|
6125
6131
|
onBlur,
|
|
@@ -6141,7 +6147,7 @@ var ExpandedBankTransactionRow = forwardRef5(
|
|
|
6141
6147
|
value: split.category,
|
|
6142
6148
|
onChange: (value) => changeCategory(index, value),
|
|
6143
6149
|
className: "Layer__category-menu--full",
|
|
6144
|
-
disabled: bankTransaction.processing,
|
|
6150
|
+
disabled: bankTransaction.processing || !categorizationEnabled(mode),
|
|
6145
6151
|
excludeMatches: true
|
|
6146
6152
|
}
|
|
6147
6153
|
),
|
|
@@ -6169,7 +6175,7 @@ var ExpandedBankTransactionRow = forwardRef5(
|
|
|
6169
6175
|
)
|
|
6170
6176
|
)}`
|
|
6171
6177
|
}
|
|
6172
|
-
), /* @__PURE__ */ React80.createElement("div", { className: `${className}__splits-buttons` }, rowState.splits.length > 1 ? /* @__PURE__ */ React80.createElement(
|
|
6178
|
+
), categorizationEnabled(mode) ? /* @__PURE__ */ React80.createElement("div", { className: `${className}__splits-buttons` }, rowState.splits.length > 1 ? /* @__PURE__ */ React80.createElement(
|
|
6173
6179
|
TextButton,
|
|
6174
6180
|
{
|
|
6175
6181
|
onClick: addSplit,
|
|
@@ -6185,7 +6191,7 @@ var ExpandedBankTransactionRow = forwardRef5(
|
|
|
6185
6191
|
disabled: rowState.splits.length > 5
|
|
6186
6192
|
},
|
|
6187
6193
|
"Split"
|
|
6188
|
-
))))
|
|
6194
|
+
)) : /* @__PURE__ */ React80.createElement(React80.Fragment, null)))
|
|
6189
6195
|
)),
|
|
6190
6196
|
showDescriptions && /* @__PURE__ */ React80.createElement(
|
|
6191
6197
|
InputGroup,
|
|
@@ -6305,6 +6311,7 @@ var BankTransactionRow = ({
|
|
|
6305
6311
|
editable,
|
|
6306
6312
|
dateFormat,
|
|
6307
6313
|
bankTransaction,
|
|
6314
|
+
mode,
|
|
6308
6315
|
removeTransaction,
|
|
6309
6316
|
containerWidth,
|
|
6310
6317
|
initialLoad,
|
|
@@ -6524,7 +6531,7 @@ var BankTransactionRow = ({
|
|
|
6524
6531
|
/* @__PURE__ */ React82.createElement("span", null, "Unsaved"),
|
|
6525
6532
|
/* @__PURE__ */ React82.createElement(AlertCircle_default, { size: 12 })
|
|
6526
6533
|
) : null,
|
|
6527
|
-
!categorized && (open || !open && !showRetry) || categorized && open ? /* @__PURE__ */ React82.createElement(
|
|
6534
|
+
!categorized && (open || !open && !showRetry) || categorizationEnabled(mode) && categorized && open ? /* @__PURE__ */ React82.createElement(
|
|
6528
6535
|
SubmitButton,
|
|
6529
6536
|
{
|
|
6530
6537
|
onClick: () => {
|
|
@@ -6561,6 +6568,7 @@ var BankTransactionRow = ({
|
|
|
6561
6568
|
bankTransaction,
|
|
6562
6569
|
categorized,
|
|
6563
6570
|
isOpen: open,
|
|
6571
|
+
mode,
|
|
6564
6572
|
close: () => setOpen(false),
|
|
6565
6573
|
containerWidth,
|
|
6566
6574
|
showDescriptions,
|
|
@@ -6615,6 +6623,7 @@ var BankTransactionListItem = ({
|
|
|
6615
6623
|
dateFormat,
|
|
6616
6624
|
bankTransaction,
|
|
6617
6625
|
editable,
|
|
6626
|
+
mode,
|
|
6618
6627
|
showDescriptions,
|
|
6619
6628
|
showReceiptUploads,
|
|
6620
6629
|
hardRefreshPnlOnCategorize,
|
|
@@ -6710,6 +6719,7 @@ var BankTransactionListItem = ({
|
|
|
6710
6719
|
ref: expandedRowRef,
|
|
6711
6720
|
bankTransaction,
|
|
6712
6721
|
isOpen: open,
|
|
6722
|
+
mode,
|
|
6713
6723
|
close: () => setOpen(false),
|
|
6714
6724
|
categorized,
|
|
6715
6725
|
asListItem: true,
|
|
@@ -6765,6 +6775,7 @@ var BankTransactionList = ({
|
|
|
6765
6775
|
bankTransactions,
|
|
6766
6776
|
editable,
|
|
6767
6777
|
removeTransaction,
|
|
6778
|
+
mode,
|
|
6768
6779
|
containerWidth,
|
|
6769
6780
|
showDescriptions = false,
|
|
6770
6781
|
showReceiptUploads = false,
|
|
@@ -6779,6 +6790,7 @@ var BankTransactionList = ({
|
|
|
6779
6790
|
key: bankTransaction.id,
|
|
6780
6791
|
dateFormat: DATE_FORMAT,
|
|
6781
6792
|
bankTransaction,
|
|
6793
|
+
mode,
|
|
6782
6794
|
editable,
|
|
6783
6795
|
removeTransaction,
|
|
6784
6796
|
containerWidth,
|
|
@@ -7287,6 +7299,7 @@ var BankTransactionMobileListItem = ({
|
|
|
7287
7299
|
bankTransaction,
|
|
7288
7300
|
removeTransaction,
|
|
7289
7301
|
editable,
|
|
7302
|
+
mode,
|
|
7290
7303
|
initialLoad,
|
|
7291
7304
|
hardRefreshPnlOnCategorize = false
|
|
7292
7305
|
}) => {
|
|
@@ -7377,31 +7390,29 @@ var BankTransactionMobileListItem = ({
|
|
|
7377
7390
|
open ? openClassName : "",
|
|
7378
7391
|
showComponent ? "show" : ""
|
|
7379
7392
|
);
|
|
7380
|
-
return /* @__PURE__ */ React92.createElement(
|
|
7381
|
-
"
|
|
7393
|
+
return /* @__PURE__ */ React92.createElement("li", { ref: itemRef, className: rowClassName, "data-item": bankTransaction.id }, /* @__PURE__ */ React92.createElement(
|
|
7394
|
+
"span",
|
|
7382
7395
|
{
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
"
|
|
7396
|
+
className: `${className}__heading`,
|
|
7397
|
+
onClick: toggleOpen,
|
|
7398
|
+
role: "button",
|
|
7399
|
+
style: { height: headingHeight }
|
|
7386
7400
|
},
|
|
7387
|
-
/* @__PURE__ */ React92.createElement(
|
|
7401
|
+
/* @__PURE__ */ React92.createElement("div", { className: `${className}__heading__content`, ref: headingRowRef }, /* @__PURE__ */ React92.createElement("div", { className: `${className}__heading__main` }, /* @__PURE__ */ React92.createElement(Text, { as: "span", className: `${className}__heading__tx-name` }, bankTransaction.counterparty_name ?? bankTransaction.description), /* @__PURE__ */ React92.createElement(Text, { as: "span", className: `${className}__heading__account-name` }, categorized && bankTransaction.categorization_status ? getAssignedValue2(bankTransaction) : null, !categorized && bankTransaction.account_name), categorized && open && /* @__PURE__ */ React92.createElement(Text, { as: "span", className: `${className}__categorized-name` }, bankTransaction.account_name)), /* @__PURE__ */ React92.createElement("div", { className: `${className}__heading__amount` }, /* @__PURE__ */ React92.createElement(
|
|
7388
7402
|
"span",
|
|
7389
7403
|
{
|
|
7390
|
-
className: `${className}
|
|
7391
|
-
onClick: toggleOpen,
|
|
7392
|
-
role: "button",
|
|
7393
|
-
style: { height: headingHeight }
|
|
7404
|
+
className: `${className}__amount-${isCredit(bankTransaction) ? "credit" : "debit"}`
|
|
7394
7405
|
},
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7406
|
+
isCredit(bankTransaction) ? "+$" : " $",
|
|
7407
|
+
centsToDollars(bankTransaction.amount)
|
|
7408
|
+
), /* @__PURE__ */ React92.createElement("span", { className: `${className}__heading__date` }, formatTime8(parseISO10(bankTransaction.date), DATE_FORMAT2))))
|
|
7409
|
+
), categorizationEnabled(mode) ? /* @__PURE__ */ React92.createElement(
|
|
7410
|
+
"div",
|
|
7411
|
+
{
|
|
7412
|
+
className: `${className}__expanded-row`,
|
|
7413
|
+
style: { height: !open || removeAnim ? 0 : height }
|
|
7414
|
+
},
|
|
7415
|
+
open && /* @__PURE__ */ React92.createElement(
|
|
7405
7416
|
"div",
|
|
7406
7417
|
{
|
|
7407
7418
|
className: `${className}__expanded-row__content`,
|
|
@@ -7416,17 +7427,20 @@ var BankTransactionMobileListItem = ({
|
|
|
7416
7427
|
{
|
|
7417
7428
|
value: "business",
|
|
7418
7429
|
label: "Business",
|
|
7419
|
-
style: { minWidth: 84 }
|
|
7430
|
+
style: { minWidth: 84 },
|
|
7431
|
+
disabled: categorizationEnabled(mode)
|
|
7420
7432
|
},
|
|
7421
7433
|
{
|
|
7422
7434
|
value: "personal",
|
|
7423
7435
|
label: "Personal",
|
|
7424
|
-
style: { minWidth: 84 }
|
|
7436
|
+
style: { minWidth: 84 },
|
|
7437
|
+
disabled: categorizationEnabled(mode)
|
|
7425
7438
|
},
|
|
7426
7439
|
{
|
|
7427
7440
|
value: "more",
|
|
7428
7441
|
label: "More",
|
|
7429
|
-
style: { minWidth: 84 }
|
|
7442
|
+
style: { minWidth: 84 },
|
|
7443
|
+
disabled: categorizationEnabled(mode)
|
|
7430
7444
|
}
|
|
7431
7445
|
],
|
|
7432
7446
|
selected: purpose,
|
|
@@ -7441,8 +7455,8 @@ var BankTransactionMobileListItem = ({
|
|
|
7441
7455
|
hardRefreshPnlOnCategorize
|
|
7442
7456
|
}
|
|
7443
7457
|
)
|
|
7444
|
-
)
|
|
7445
|
-
);
|
|
7458
|
+
)
|
|
7459
|
+
) : /* @__PURE__ */ React92.createElement(React92.Fragment, null));
|
|
7446
7460
|
};
|
|
7447
7461
|
|
|
7448
7462
|
// src/components/BankTransactionMobileList/BankTransactionMobileList.tsx
|
|
@@ -7451,6 +7465,7 @@ var BankTransactionMobileList = ({
|
|
|
7451
7465
|
removeTransaction,
|
|
7452
7466
|
editable,
|
|
7453
7467
|
initialLoad,
|
|
7468
|
+
mode,
|
|
7454
7469
|
hardRefreshPnlOnCategorize
|
|
7455
7470
|
}) => {
|
|
7456
7471
|
const transactionToOpenContextData = useTransactionToOpen();
|
|
@@ -7459,6 +7474,7 @@ var BankTransactionMobileList = ({
|
|
|
7459
7474
|
BankTransactionMobileListItem,
|
|
7460
7475
|
{
|
|
7461
7476
|
index,
|
|
7477
|
+
mode,
|
|
7462
7478
|
key: bankTransaction.id,
|
|
7463
7479
|
bankTransaction,
|
|
7464
7480
|
editable,
|
|
@@ -7598,6 +7614,7 @@ var BankTransactionsTable = ({
|
|
|
7598
7614
|
editable,
|
|
7599
7615
|
isLoading,
|
|
7600
7616
|
bankTransactions,
|
|
7617
|
+
mode,
|
|
7601
7618
|
initialLoad,
|
|
7602
7619
|
containerWidth,
|
|
7603
7620
|
removeTransaction,
|
|
@@ -7626,6 +7643,7 @@ var BankTransactionsTable = ({
|
|
|
7626
7643
|
initialLoad,
|
|
7627
7644
|
index,
|
|
7628
7645
|
editable,
|
|
7646
|
+
mode,
|
|
7629
7647
|
key: bankTransaction.id,
|
|
7630
7648
|
dateFormat: DATE_FORMAT,
|
|
7631
7649
|
bankTransaction,
|
|
@@ -8628,6 +8646,12 @@ import { endOfMonth as endOfMonth3, parseISO as parseISO12, startOfMonth as star
|
|
|
8628
8646
|
var COMPONENT_NAME2 = "bank-transactions";
|
|
8629
8647
|
var TEST_EMPTY_STATE = false;
|
|
8630
8648
|
var POLL_INTERVAL = 1e4;
|
|
8649
|
+
var categorizationEnabled = (mode) => {
|
|
8650
|
+
if (mode === "bookkeeping-client") {
|
|
8651
|
+
return false;
|
|
8652
|
+
}
|
|
8653
|
+
return true;
|
|
8654
|
+
};
|
|
8631
8655
|
var BankTransactions = ({
|
|
8632
8656
|
onError,
|
|
8633
8657
|
...props
|
|
@@ -8637,8 +8661,7 @@ var BankTransactions = ({
|
|
|
8637
8661
|
var BankTransactionsContent = ({
|
|
8638
8662
|
asWidget = false,
|
|
8639
8663
|
pageSize = 20,
|
|
8640
|
-
|
|
8641
|
-
categorizeView = true,
|
|
8664
|
+
mode = "self-serve",
|
|
8642
8665
|
showDescriptions = false,
|
|
8643
8666
|
showReceiptUploads = false,
|
|
8644
8667
|
hardRefreshPnlOnCategorize = false,
|
|
@@ -8654,6 +8677,7 @@ var BankTransactionsContent = ({
|
|
|
8654
8677
|
startDate: startOfMonth5(/* @__PURE__ */ new Date()),
|
|
8655
8678
|
endDate: endOfMonth3(/* @__PURE__ */ new Date())
|
|
8656
8679
|
});
|
|
8680
|
+
const categorizeView = categorizationEnabled(mode);
|
|
8657
8681
|
const {
|
|
8658
8682
|
activate,
|
|
8659
8683
|
data,
|
|
@@ -8713,7 +8737,7 @@ var BankTransactionsContent = ({
|
|
|
8713
8737
|
...inputFilters,
|
|
8714
8738
|
categorizationStatus: "review" /* review */
|
|
8715
8739
|
});
|
|
8716
|
-
} else if (!filters?.categorizationStatus &&
|
|
8740
|
+
} else if (!filters?.categorizationStatus && !categorizationEnabled(mode)) {
|
|
8717
8741
|
setFilters({
|
|
8718
8742
|
...filters,
|
|
8719
8743
|
...inputFilters,
|
|
@@ -8726,12 +8750,12 @@ var BankTransactionsContent = ({
|
|
|
8726
8750
|
setFilters({
|
|
8727
8751
|
categorizationStatus: "review" /* review */
|
|
8728
8752
|
});
|
|
8729
|
-
} else if (!filters?.categorizationStatus &&
|
|
8753
|
+
} else if (!filters?.categorizationStatus && !categorizationEnabled(mode)) {
|
|
8730
8754
|
setFilters({
|
|
8731
8755
|
categorizationStatus: "categorized" /* categorized */
|
|
8732
8756
|
});
|
|
8733
8757
|
}
|
|
8734
|
-
}, [inputFilters, categorizeView,
|
|
8758
|
+
}, [inputFilters, categorizeView, mode]);
|
|
8735
8759
|
useEffect21(() => {
|
|
8736
8760
|
if (loadingStatus === "complete") {
|
|
8737
8761
|
const timeoutLoad = setTimeout(() => {
|
|
@@ -8794,7 +8818,7 @@ var BankTransactionsContent = ({
|
|
|
8794
8818
|
{
|
|
8795
8819
|
shiftStickyHeader,
|
|
8796
8820
|
asWidget,
|
|
8797
|
-
categorizedOnly,
|
|
8821
|
+
categorizedOnly: !categorizationEnabled(mode),
|
|
8798
8822
|
categorizeView,
|
|
8799
8823
|
display,
|
|
8800
8824
|
onCategorizationDisplayChange,
|
|
@@ -8816,6 +8840,7 @@ var BankTransactionsContent = ({
|
|
|
8816
8840
|
isLoading,
|
|
8817
8841
|
isSyncing,
|
|
8818
8842
|
bankTransactions,
|
|
8843
|
+
mode,
|
|
8819
8844
|
initialLoad,
|
|
8820
8845
|
containerWidth,
|
|
8821
8846
|
removeTransaction,
|
|
@@ -8831,6 +8856,7 @@ var BankTransactionsContent = ({
|
|
|
8831
8856
|
!isLoading && listView && mobileComponent !== "mobileList" ? /* @__PURE__ */ React111.createElement(
|
|
8832
8857
|
BankTransactionList,
|
|
8833
8858
|
{
|
|
8859
|
+
mode,
|
|
8834
8860
|
bankTransactions,
|
|
8835
8861
|
editable,
|
|
8836
8862
|
removeTransaction,
|
|
@@ -8844,6 +8870,7 @@ var BankTransactionsContent = ({
|
|
|
8844
8870
|
{
|
|
8845
8871
|
bankTransactions,
|
|
8846
8872
|
editable,
|
|
8873
|
+
mode,
|
|
8847
8874
|
removeTransaction,
|
|
8848
8875
|
initialLoad,
|
|
8849
8876
|
hardRefreshPnlOnCategorize
|
|
@@ -9466,9 +9493,9 @@ var ProfitAndLossChart = ({
|
|
|
9466
9493
|
name: getMonthName(pnl),
|
|
9467
9494
|
revenue: pnl?.income || 0,
|
|
9468
9495
|
revenueUncategorized: pnl?.uncategorizedInflows || 0,
|
|
9469
|
-
expenses: -(pnl?.
|
|
9496
|
+
expenses: -(pnl?.totalExpenses || 0),
|
|
9470
9497
|
expensesUncategorized: -(pnl?.uncategorizedOutflows || 0),
|
|
9471
|
-
|
|
9498
|
+
totalExpensesInverse: pnl?.totalExpensesInverse || 0,
|
|
9472
9499
|
uncategorizedOutflowsInverse: pnl?.uncategorizedOutflowsInverse || 0,
|
|
9473
9500
|
netProfit: pnl?.netProfit || 0,
|
|
9474
9501
|
selected: !!pnl && pnl.month === selectionMonth.month + 1 && pnl.year === selectionMonth.year,
|
|
@@ -9488,7 +9515,7 @@ var ProfitAndLossChart = ({
|
|
|
9488
9515
|
name: format(currentDate, compactView ? "LLLLL" : "LLL"),
|
|
9489
9516
|
revenue: 0,
|
|
9490
9517
|
revenueUncategorized: 0,
|
|
9491
|
-
|
|
9518
|
+
totalExpensesInverse: 0,
|
|
9492
9519
|
uncategorizedOutflowsInverse: 0,
|
|
9493
9520
|
expenses: 0,
|
|
9494
9521
|
expensesUncategorized: 0,
|
|
@@ -9508,9 +9535,9 @@ var ProfitAndLossChart = ({
|
|
|
9508
9535
|
if (totalExpenses < 0 || x.uncategorizedOutflows < 0) {
|
|
9509
9536
|
return {
|
|
9510
9537
|
...x,
|
|
9511
|
-
|
|
9538
|
+
totalExpenses: totalExpenses < 0 ? 0 : totalExpenses,
|
|
9512
9539
|
uncategorizedOutflows: x.uncategorizedOutflows < 0 ? 0 : x.uncategorizedOutflows,
|
|
9513
|
-
|
|
9540
|
+
totalExpensesInverse: totalExpenses < 0 ? -totalExpenses : 0,
|
|
9514
9541
|
uncategorizedOutflowsInverse: x.uncategorizedOutflows < 0 ? -x.uncategorizedOutflows : 0
|
|
9515
9542
|
};
|
|
9516
9543
|
}
|
|
@@ -9806,7 +9833,7 @@ var ProfitAndLossChart = ({
|
|
|
9806
9833
|
/* @__PURE__ */ React114.createElement(
|
|
9807
9834
|
Bar,
|
|
9808
9835
|
{
|
|
9809
|
-
dataKey: "
|
|
9836
|
+
dataKey: "totalExpensesInverse",
|
|
9810
9837
|
barSize,
|
|
9811
9838
|
isAnimationActive: barAnimActive,
|
|
9812
9839
|
animationDuration: 100,
|
|
@@ -10919,17 +10946,18 @@ var ProfitAndLossRow = ({
|
|
|
10919
10946
|
variant,
|
|
10920
10947
|
lineItem,
|
|
10921
10948
|
depth = 0,
|
|
10922
|
-
maxDepth =
|
|
10949
|
+
maxDepth = 8,
|
|
10923
10950
|
direction = "DEBIT" /* DEBIT */,
|
|
10924
10951
|
lockExpanded = false,
|
|
10925
10952
|
scope,
|
|
10926
|
-
setSidebarScope
|
|
10953
|
+
setSidebarScope,
|
|
10954
|
+
defaultExpanded = false
|
|
10927
10955
|
}) => {
|
|
10928
10956
|
if (!lineItem) {
|
|
10929
10957
|
return null;
|
|
10930
10958
|
}
|
|
10931
10959
|
const { value, display_name, line_items } = lineItem;
|
|
10932
|
-
const [expanded, setExpanded] = useState34(
|
|
10960
|
+
const [expanded, setExpanded] = useState34(lockExpanded || defaultExpanded);
|
|
10933
10961
|
const amount = value ?? 0;
|
|
10934
10962
|
const amountString = centsToDollars(Math.abs(amount));
|
|
10935
10963
|
const labelClasses = [
|
|
@@ -10964,7 +10992,10 @@ var ProfitAndLossRow = ({
|
|
|
10964
10992
|
"div",
|
|
10965
10993
|
{
|
|
10966
10994
|
className: labelClasses.join(" "),
|
|
10967
|
-
onClick: () => !lockExpanded && toggleExpanded()
|
|
10995
|
+
onClick: () => !lockExpanded && toggleExpanded(),
|
|
10996
|
+
style: {
|
|
10997
|
+
paddingLeft: depth === 0 && !hasChildren ? 28 : 16 * (depth + 1) + 2
|
|
10998
|
+
}
|
|
10968
10999
|
},
|
|
10969
11000
|
/* @__PURE__ */ React125.createElement("span", { className: "Layer__profit-and-loss-row__label__title" }, !lockExpanded && variant !== "summation" ? /* @__PURE__ */ React125.createElement(
|
|
10970
11001
|
ChevronDownFill_default,
|
|
@@ -11052,7 +11083,11 @@ var empty_profit_and_loss_report_default = {
|
|
|
11052
11083
|
|
|
11053
11084
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
11054
11085
|
import classNames45 from "classnames";
|
|
11055
|
-
var ProfitAndLossTable = ({
|
|
11086
|
+
var ProfitAndLossTable = ({
|
|
11087
|
+
lockExpanded,
|
|
11088
|
+
asContainer,
|
|
11089
|
+
stringOverrides
|
|
11090
|
+
}) => {
|
|
11056
11091
|
const {
|
|
11057
11092
|
data: actualData,
|
|
11058
11093
|
isLoading,
|
|
@@ -11087,7 +11122,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11087
11122
|
direction: "CREDIT" /* CREDIT */,
|
|
11088
11123
|
lockExpanded,
|
|
11089
11124
|
scope: "revenue",
|
|
11090
|
-
setSidebarScope
|
|
11125
|
+
setSidebarScope,
|
|
11126
|
+
defaultExpanded: true
|
|
11091
11127
|
}
|
|
11092
11128
|
),
|
|
11093
11129
|
/* @__PURE__ */ React126.createElement(
|
|
@@ -11097,7 +11133,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11097
11133
|
direction: "DEBIT" /* DEBIT */,
|
|
11098
11134
|
lockExpanded,
|
|
11099
11135
|
scope: "expenses",
|
|
11100
|
-
setSidebarScope
|
|
11136
|
+
setSidebarScope,
|
|
11137
|
+
defaultExpanded: true
|
|
11101
11138
|
}
|
|
11102
11139
|
),
|
|
11103
11140
|
/* @__PURE__ */ React126.createElement(
|
|
@@ -11111,7 +11148,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11111
11148
|
direction: "CREDIT" /* CREDIT */,
|
|
11112
11149
|
lockExpanded,
|
|
11113
11150
|
scope: "revenue",
|
|
11114
|
-
setSidebarScope
|
|
11151
|
+
setSidebarScope,
|
|
11152
|
+
defaultExpanded: true
|
|
11115
11153
|
}
|
|
11116
11154
|
),
|
|
11117
11155
|
/* @__PURE__ */ React126.createElement(
|
|
@@ -11121,7 +11159,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11121
11159
|
direction: "DEBIT" /* DEBIT */,
|
|
11122
11160
|
lockExpanded,
|
|
11123
11161
|
scope: "expenses",
|
|
11124
|
-
setSidebarScope
|
|
11162
|
+
setSidebarScope,
|
|
11163
|
+
defaultExpanded: true
|
|
11125
11164
|
}
|
|
11126
11165
|
),
|
|
11127
11166
|
/* @__PURE__ */ React126.createElement(
|
|
@@ -11135,7 +11174,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11135
11174
|
direction: "CREDIT" /* CREDIT */,
|
|
11136
11175
|
lockExpanded,
|
|
11137
11176
|
scope: "revenue",
|
|
11138
|
-
setSidebarScope
|
|
11177
|
+
setSidebarScope,
|
|
11178
|
+
defaultExpanded: true
|
|
11139
11179
|
}
|
|
11140
11180
|
),
|
|
11141
11181
|
/* @__PURE__ */ React126.createElement(
|
|
@@ -11145,7 +11185,8 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer, stringOverrides }) => {
|
|
|
11145
11185
|
direction: "DEBIT" /* DEBIT */,
|
|
11146
11186
|
lockExpanded,
|
|
11147
11187
|
scope: "expenses",
|
|
11148
|
-
setSidebarScope
|
|
11188
|
+
setSidebarScope,
|
|
11189
|
+
defaultExpanded: true
|
|
11149
11190
|
}
|
|
11150
11191
|
),
|
|
11151
11192
|
/* @__PURE__ */ React126.createElement(
|
|
@@ -15435,7 +15476,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
15435
15476
|
showLedgerBalance = true,
|
|
15436
15477
|
showUnlinkItem = false,
|
|
15437
15478
|
showBreakConnection = false,
|
|
15438
|
-
|
|
15479
|
+
mode = "self-serve",
|
|
15439
15480
|
hardRefreshPnlOnCategorize = false,
|
|
15440
15481
|
showDescriptions,
|
|
15441
15482
|
showReceiptUploads,
|
|
@@ -15458,7 +15499,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
15458
15499
|
showDescriptions,
|
|
15459
15500
|
showReceiptUploads,
|
|
15460
15501
|
mobileComponent,
|
|
15461
|
-
|
|
15502
|
+
mode,
|
|
15462
15503
|
hardRefreshPnlOnCategorize,
|
|
15463
15504
|
stringOverrides: stringOverrides?.bankTransactions
|
|
15464
15505
|
}
|
|
@@ -15502,7 +15543,9 @@ var GeneralLedgerView = ({
|
|
|
15502
15543
|
|
|
15503
15544
|
// src/views/Reports/Reports.tsx
|
|
15504
15545
|
import React182, { useContext as useContext38, useRef as useRef16, useState as useState58 } from "react";
|
|
15505
|
-
var DownloadButton2 = ({
|
|
15546
|
+
var DownloadButton2 = ({
|
|
15547
|
+
stringOverrides
|
|
15548
|
+
}) => {
|
|
15506
15549
|
const { dateRange } = useContext38(ProfitAndLoss.Context);
|
|
15507
15550
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
15508
15551
|
const [requestFailed, setRequestFailed] = useState58(false);
|
|
@@ -15550,33 +15593,64 @@ var DownloadButton2 = ({ stringOverrides }) => {
|
|
|
15550
15593
|
stringOverrides?.downloadButtonText || "Download"
|
|
15551
15594
|
);
|
|
15552
15595
|
};
|
|
15553
|
-
var
|
|
15596
|
+
var getOptions = (enabledReports) => {
|
|
15597
|
+
return [
|
|
15598
|
+
enabledReports.includes("profitAndLoss") ? {
|
|
15599
|
+
value: "profitAndLoss",
|
|
15600
|
+
label: "Profit & Loss"
|
|
15601
|
+
} : null,
|
|
15602
|
+
enabledReports.includes("balanceSheet") ? {
|
|
15603
|
+
value: "balanceSheet",
|
|
15604
|
+
label: "Balance Sheet"
|
|
15605
|
+
} : null,
|
|
15606
|
+
enabledReports.includes("statementOfCashFlow") ? {
|
|
15607
|
+
value: "statementOfCashFlow",
|
|
15608
|
+
label: "Statement of Cash Flow"
|
|
15609
|
+
} : null
|
|
15610
|
+
].filter((o) => !!o);
|
|
15611
|
+
};
|
|
15612
|
+
var Reports = ({
|
|
15613
|
+
title,
|
|
15614
|
+
stringOverrides,
|
|
15615
|
+
enabledReports = ["profitAndLoss", "balanceSheet", "statementOfCashFlow"]
|
|
15616
|
+
}) => {
|
|
15554
15617
|
const containerRef = useRef16(null);
|
|
15555
|
-
const [activeTab, setActiveTab] = useState58(
|
|
15556
|
-
|
|
15618
|
+
const [activeTab, setActiveTab] = useState58(enabledReports[0]);
|
|
15619
|
+
const options = getOptions(enabledReports);
|
|
15620
|
+
const defaultTitle = enabledReports.length > 1 ? "Reports" : options.find((option) => option.value = enabledReports[0])?.label;
|
|
15621
|
+
return /* @__PURE__ */ React182.createElement(View, { title: stringOverrides?.title || title || defaultTitle }, enabledReports.length > 1 && /* @__PURE__ */ React182.createElement("div", { className: "Layer__component Layer__header__actions" }, /* @__PURE__ */ React182.createElement(
|
|
15557
15622
|
Toggle,
|
|
15558
15623
|
{
|
|
15559
15624
|
name: "reports-tabs",
|
|
15560
|
-
options
|
|
15561
|
-
{ value: "profitAndLoss", label: "Profit & loss" },
|
|
15562
|
-
{ value: "balanceSheet", label: "Balance sheet" },
|
|
15563
|
-
{
|
|
15564
|
-
value: "statementOfCashFlow",
|
|
15565
|
-
label: "Statement of Cash Flow"
|
|
15566
|
-
}
|
|
15567
|
-
],
|
|
15625
|
+
options,
|
|
15568
15626
|
selected: activeTab,
|
|
15569
15627
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
15570
15628
|
}
|
|
15571
|
-
)), /* @__PURE__ */ React182.createElement(Container, { name: "reports", ref: containerRef }, /* @__PURE__ */ React182.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React182.createElement(
|
|
15629
|
+
)), /* @__PURE__ */ React182.createElement(Container, { name: "reports", ref: containerRef }, /* @__PURE__ */ React182.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React182.createElement(
|
|
15630
|
+
ReportsPanel,
|
|
15631
|
+
{
|
|
15632
|
+
containerRef,
|
|
15633
|
+
openReport: activeTab,
|
|
15634
|
+
stringOverrides
|
|
15635
|
+
}
|
|
15636
|
+
))));
|
|
15572
15637
|
};
|
|
15573
|
-
var ReportsPanel = ({
|
|
15638
|
+
var ReportsPanel = ({
|
|
15639
|
+
containerRef,
|
|
15640
|
+
openReport,
|
|
15641
|
+
stringOverrides
|
|
15642
|
+
}) => {
|
|
15574
15643
|
const { sidebarScope } = useContext38(ProfitAndLoss.Context);
|
|
15575
15644
|
return /* @__PURE__ */ React182.createElement(React182.Fragment, null, openReport === "profitAndLoss" && /* @__PURE__ */ React182.createElement(
|
|
15576
15645
|
View,
|
|
15577
15646
|
{
|
|
15578
15647
|
type: "panel",
|
|
15579
|
-
headerControls: /* @__PURE__ */ React182.createElement(React182.Fragment, null, /* @__PURE__ */ React182.createElement(ProfitAndLoss.DatePicker, null), /* @__PURE__ */ React182.createElement(
|
|
15648
|
+
headerControls: /* @__PURE__ */ React182.createElement(React182.Fragment, null, /* @__PURE__ */ React182.createElement(ProfitAndLoss.DatePicker, null), /* @__PURE__ */ React182.createElement(
|
|
15649
|
+
DownloadButton2,
|
|
15650
|
+
{
|
|
15651
|
+
stringOverrides: stringOverrides?.downloadButton
|
|
15652
|
+
}
|
|
15653
|
+
))
|
|
15580
15654
|
},
|
|
15581
15655
|
/* @__PURE__ */ React182.createElement(
|
|
15582
15656
|
Panel,
|
|
@@ -15599,7 +15673,12 @@ var ReportsPanel = ({ containerRef, openReport, stringOverrides }) => {
|
|
|
15599
15673
|
}
|
|
15600
15674
|
)
|
|
15601
15675
|
)
|
|
15602
|
-
), openReport === "balanceSheet" && /* @__PURE__ */ React182.createElement(BalanceSheet, { stringOverrides: stringOverrides?.balanceSheet }), openReport === "statementOfCashFlow" && /* @__PURE__ */ React182.createElement(
|
|
15676
|
+
), openReport === "balanceSheet" && /* @__PURE__ */ React182.createElement(BalanceSheet, { stringOverrides: stringOverrides?.balanceSheet }), openReport === "statementOfCashFlow" && /* @__PURE__ */ React182.createElement(
|
|
15677
|
+
StatementOfCashFlow,
|
|
15678
|
+
{
|
|
15679
|
+
stringOverrides: stringOverrides?.statementOfCashflow
|
|
15680
|
+
}
|
|
15681
|
+
));
|
|
15603
15682
|
};
|
|
15604
15683
|
|
|
15605
15684
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|