@layerfi/components 0.1.9 → 0.1.10
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 +1538 -683
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +161 -42
- package/dist/index.js +1415 -558
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +502 -219
- package/dist/styles/index.css.map +3 -3
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -261,6 +261,11 @@ var matchBankTransaction = put(
|
|
|
261
261
|
// src/api/layer/categories.ts
|
|
262
262
|
var getCategories = get(({ businessId }) => `/v1/businesses/${businessId}/categories`);
|
|
263
263
|
|
|
264
|
+
// src/api/layer/linked_accounts.ts
|
|
265
|
+
var getLinkedAccounts = get(
|
|
266
|
+
({ businessId }) => `/v1/businesses/${businessId}/external-accounts`
|
|
267
|
+
);
|
|
268
|
+
|
|
264
269
|
// src/api/layer/ledger_accounts.ts
|
|
265
270
|
var getLedgerAccounts = get(
|
|
266
271
|
({ businessId }) => `/v1/businesses/${businessId}/ledger/accounts`
|
|
@@ -268,6 +273,9 @@ var getLedgerAccounts = get(
|
|
|
268
273
|
var createAccount = post(
|
|
269
274
|
({ businessId }) => `/v1/businesses/${businessId}/ledger/accounts`
|
|
270
275
|
);
|
|
276
|
+
var updateAccount = put(
|
|
277
|
+
({ businessId, accountId }) => `/v1/businesses/${businessId}/ledger/accounts/${accountId}`
|
|
278
|
+
);
|
|
271
279
|
|
|
272
280
|
// src/api/layer/profit_and_loss.ts
|
|
273
281
|
var getProfitAndLoss = get(
|
|
@@ -280,11 +288,13 @@ var Layer = {
|
|
|
280
288
|
categorizeBankTransaction,
|
|
281
289
|
matchBankTransaction,
|
|
282
290
|
createAccount,
|
|
291
|
+
updateAccount,
|
|
283
292
|
getBalanceSheet,
|
|
284
293
|
getBankTransactions,
|
|
285
294
|
getCategories,
|
|
286
295
|
getLedgerAccounts,
|
|
287
|
-
getProfitAndLoss
|
|
296
|
+
getProfitAndLoss,
|
|
297
|
+
getLinkedAccounts
|
|
288
298
|
};
|
|
289
299
|
|
|
290
300
|
// src/hooks/useLayerContext/useLayerContext.tsx
|
|
@@ -581,7 +591,7 @@ var BalanceSheet = () => {
|
|
|
581
591
|
};
|
|
582
592
|
|
|
583
593
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
584
|
-
import
|
|
594
|
+
import React56, { useState as useState10, useMemo as useMemo2, useEffect as useEffect7 } from "react";
|
|
585
595
|
|
|
586
596
|
// src/config/general.ts
|
|
587
597
|
var DATE_FORMAT = "LLL d, yyyy";
|
|
@@ -735,9 +745,10 @@ var debounce = (fnc, timeout = 300) => {
|
|
|
735
745
|
}, timeout);
|
|
736
746
|
};
|
|
737
747
|
};
|
|
748
|
+
var convertToStableName = (name) => name.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "").replace(/\W+/g, " ").split(/ |\B(?=[A-Z])/).map((word) => word.toLowerCase()).join("_");
|
|
738
749
|
|
|
739
750
|
// src/components/BankTransactionListItem/BankTransactionListItem.tsx
|
|
740
|
-
import
|
|
751
|
+
import React48, { useEffect as useEffect6, useRef as useRef11, useState as useState9 } from "react";
|
|
741
752
|
|
|
742
753
|
// src/icons/ChevronDownFill.tsx
|
|
743
754
|
import * as React8 from "react";
|
|
@@ -765,7 +776,7 @@ var ChevronDownFill = ({ size = 18, ...props }) => /* @__PURE__ */ React8.create
|
|
|
765
776
|
var ChevronDownFill_default = ChevronDownFill;
|
|
766
777
|
|
|
767
778
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
768
|
-
import
|
|
779
|
+
import React46, { useEffect as useEffect5, useRef as useRef10, useState as useState8 } from "react";
|
|
769
780
|
|
|
770
781
|
// src/icons/AlertCircle.tsx
|
|
771
782
|
import * as React9 from "react";
|
|
@@ -940,7 +951,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React10.createElemen
|
|
|
940
951
|
var Scissors_default = Scissors;
|
|
941
952
|
|
|
942
953
|
// src/components/Badge/Badge.tsx
|
|
943
|
-
import
|
|
954
|
+
import React24 from "react";
|
|
944
955
|
|
|
945
956
|
// src/components/Button/Button.tsx
|
|
946
957
|
import React11, { useRef as useRef3 } from "react";
|
|
@@ -1475,8 +1486,47 @@ var TextButton = ({
|
|
|
1475
1486
|
return /* @__PURE__ */ React21.createElement("button", { ...props, className: baseClassName }, children);
|
|
1476
1487
|
};
|
|
1477
1488
|
|
|
1478
|
-
// src/components/
|
|
1489
|
+
// src/components/Button/BackButton.tsx
|
|
1490
|
+
import React23 from "react";
|
|
1491
|
+
|
|
1492
|
+
// src/icons/BackArrow.tsx
|
|
1493
|
+
import * as React22 from "react";
|
|
1494
|
+
var BackArrow = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createElement(
|
|
1495
|
+
"svg",
|
|
1496
|
+
{
|
|
1497
|
+
viewBox: "0 0 12 12",
|
|
1498
|
+
fill: "none",
|
|
1499
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1500
|
+
...props,
|
|
1501
|
+
width: size,
|
|
1502
|
+
height: size
|
|
1503
|
+
},
|
|
1504
|
+
/* @__PURE__ */ React22.createElement(
|
|
1505
|
+
"path",
|
|
1506
|
+
{
|
|
1507
|
+
d: "M7.375 8.75L4.625 6L7.375 3.25",
|
|
1508
|
+
stroke: "#1A130D",
|
|
1509
|
+
strokeLinecap: "round",
|
|
1510
|
+
strokeLinejoin: "round"
|
|
1511
|
+
}
|
|
1512
|
+
)
|
|
1513
|
+
);
|
|
1514
|
+
var BackArrow_default = BackArrow;
|
|
1515
|
+
|
|
1516
|
+
// src/components/Button/BackButton.tsx
|
|
1479
1517
|
import classNames6 from "classnames";
|
|
1518
|
+
var BackButton = ({
|
|
1519
|
+
className,
|
|
1520
|
+
children,
|
|
1521
|
+
textOnly = false,
|
|
1522
|
+
...props
|
|
1523
|
+
}) => {
|
|
1524
|
+
const baseClassName = classNames6("Layer__btn", "Layer__back-btn", className);
|
|
1525
|
+
return /* @__PURE__ */ React23.createElement("button", { ...props, className: baseClassName }, textOnly ? "Back" : /* @__PURE__ */ React23.createElement(BackArrow_default, { size: 16 }));
|
|
1526
|
+
};
|
|
1527
|
+
|
|
1528
|
+
// src/components/Badge/Badge.tsx
|
|
1529
|
+
import classNames7 from "classnames";
|
|
1480
1530
|
var Badge = ({
|
|
1481
1531
|
icon,
|
|
1482
1532
|
onClick,
|
|
@@ -1485,7 +1535,7 @@ var Badge = ({
|
|
|
1485
1535
|
size = "medium" /* MEDIUM */
|
|
1486
1536
|
}) => {
|
|
1487
1537
|
const baseProps = {
|
|
1488
|
-
className:
|
|
1538
|
+
className: classNames7(
|
|
1489
1539
|
"Layer__badge",
|
|
1490
1540
|
onClick || tooltip ? "Layer__badge--clickable" : "",
|
|
1491
1541
|
`Layer__badge--${size}`
|
|
@@ -1493,23 +1543,23 @@ var Badge = ({
|
|
|
1493
1543
|
onClick,
|
|
1494
1544
|
children
|
|
1495
1545
|
};
|
|
1496
|
-
let content = /* @__PURE__ */
|
|
1497
|
-
content = onClick ? /* @__PURE__ */
|
|
1546
|
+
let content = /* @__PURE__ */ React24.createElement(React24.Fragment, null, icon && /* @__PURE__ */ React24.createElement("span", { className: "Layer__badge__icon" }, icon), children);
|
|
1547
|
+
content = onClick ? /* @__PURE__ */ React24.createElement(Button, { ...baseProps }, content) : /* @__PURE__ */ React24.createElement("span", { ...baseProps }, content);
|
|
1498
1548
|
if (tooltip) {
|
|
1499
|
-
return /* @__PURE__ */
|
|
1549
|
+
return /* @__PURE__ */ React24.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ React24.createElement(TooltipTrigger, null, content), /* @__PURE__ */ React24.createElement(TooltipContent, { className: "Layer__tooltip" }, tooltip));
|
|
1500
1550
|
}
|
|
1501
1551
|
return content;
|
|
1502
1552
|
};
|
|
1503
1553
|
|
|
1504
1554
|
// src/components/CategorySelect/CategorySelect.tsx
|
|
1505
|
-
import
|
|
1555
|
+
import React27 from "react";
|
|
1506
1556
|
import Select, {
|
|
1507
1557
|
components
|
|
1508
1558
|
} from "react-select";
|
|
1509
1559
|
|
|
1510
1560
|
// src/icons/Check.tsx
|
|
1511
|
-
import * as
|
|
1512
|
-
var Check = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
1561
|
+
import * as React25 from "react";
|
|
1562
|
+
var Check = ({ size = 18, ...props }) => /* @__PURE__ */ React25.createElement(
|
|
1513
1563
|
"svg",
|
|
1514
1564
|
{
|
|
1515
1565
|
viewBox: "0 0 18 18",
|
|
@@ -1519,7 +1569,7 @@ var Check = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createElement(
|
|
|
1519
1569
|
width: size,
|
|
1520
1570
|
height: size
|
|
1521
1571
|
},
|
|
1522
|
-
/* @__PURE__ */
|
|
1572
|
+
/* @__PURE__ */ React25.createElement(
|
|
1523
1573
|
"path",
|
|
1524
1574
|
{
|
|
1525
1575
|
d: "M15 4.5L6.75 12.75L3 9",
|
|
@@ -1532,8 +1582,8 @@ var Check = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createElement(
|
|
|
1532
1582
|
var Check_default = Check;
|
|
1533
1583
|
|
|
1534
1584
|
// src/icons/MinimizeTwo.tsx
|
|
1535
|
-
import * as
|
|
1536
|
-
var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
1585
|
+
import * as React26 from "react";
|
|
1586
|
+
var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React26.createElement(
|
|
1537
1587
|
"svg",
|
|
1538
1588
|
{
|
|
1539
1589
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1543,7 +1593,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createEle
|
|
|
1543
1593
|
width: size,
|
|
1544
1594
|
height: size
|
|
1545
1595
|
},
|
|
1546
|
-
/* @__PURE__ */
|
|
1596
|
+
/* @__PURE__ */ React26.createElement(
|
|
1547
1597
|
"path",
|
|
1548
1598
|
{
|
|
1549
1599
|
d: "M3 10.5H7.5V15",
|
|
@@ -1552,7 +1602,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createEle
|
|
|
1552
1602
|
strokeLinejoin: "round"
|
|
1553
1603
|
}
|
|
1554
1604
|
),
|
|
1555
|
-
/* @__PURE__ */
|
|
1605
|
+
/* @__PURE__ */ React26.createElement(
|
|
1556
1606
|
"path",
|
|
1557
1607
|
{
|
|
1558
1608
|
d: "M15 7.5H10.5V3",
|
|
@@ -1561,7 +1611,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createEle
|
|
|
1561
1611
|
strokeLinejoin: "round"
|
|
1562
1612
|
}
|
|
1563
1613
|
),
|
|
1564
|
-
/* @__PURE__ */
|
|
1614
|
+
/* @__PURE__ */ React26.createElement(
|
|
1565
1615
|
"path",
|
|
1566
1616
|
{
|
|
1567
1617
|
d: "M10.5 7.5L15.75 2.25",
|
|
@@ -1570,7 +1620,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createEle
|
|
|
1570
1620
|
strokeLinejoin: "round"
|
|
1571
1621
|
}
|
|
1572
1622
|
),
|
|
1573
|
-
/* @__PURE__ */
|
|
1623
|
+
/* @__PURE__ */ React26.createElement(
|
|
1574
1624
|
"path",
|
|
1575
1625
|
{
|
|
1576
1626
|
d: "M2.25 15.75L7.5 10.5",
|
|
@@ -1583,7 +1633,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createEle
|
|
|
1583
1633
|
var MinimizeTwo_default = MinimizeTwo;
|
|
1584
1634
|
|
|
1585
1635
|
// src/components/CategorySelect/CategorySelect.tsx
|
|
1586
|
-
import
|
|
1636
|
+
import classNames8 from "classnames";
|
|
1587
1637
|
import { parseISO as parseISO2, format as formatTime } from "date-fns";
|
|
1588
1638
|
var mapCategoryToOption = (category) => {
|
|
1589
1639
|
return {
|
|
@@ -1611,13 +1661,13 @@ var mapSuggestedMatchToOption = (record) => {
|
|
|
1611
1661
|
};
|
|
1612
1662
|
};
|
|
1613
1663
|
var DropdownIndicator = (props) => {
|
|
1614
|
-
return /* @__PURE__ */
|
|
1664
|
+
return /* @__PURE__ */ React27.createElement(components.DropdownIndicator, { ...props }, /* @__PURE__ */ React27.createElement(ChevronDown_default, null));
|
|
1615
1665
|
};
|
|
1616
1666
|
var GroupHeading = (props) => {
|
|
1617
|
-
return /* @__PURE__ */
|
|
1667
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1618
1668
|
components.GroupHeading,
|
|
1619
1669
|
{
|
|
1620
|
-
className:
|
|
1670
|
+
className: classNames8(
|
|
1621
1671
|
props.className,
|
|
1622
1672
|
props.children === "Match" || props.children === "All categories" ? "Layer__select__group-heading--main" : ""
|
|
1623
1673
|
),
|
|
@@ -1630,24 +1680,24 @@ var Option = (props) => {
|
|
|
1630
1680
|
return;
|
|
1631
1681
|
}
|
|
1632
1682
|
if (props.data.type === "match") {
|
|
1633
|
-
return /* @__PURE__ */
|
|
1683
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1634
1684
|
components.Option,
|
|
1635
1685
|
{
|
|
1636
1686
|
...props,
|
|
1637
1687
|
className: `${props.className} Layer__select__option-content__match`
|
|
1638
1688
|
},
|
|
1639
|
-
/* @__PURE__ */
|
|
1640
|
-
/* @__PURE__ */
|
|
1689
|
+
/* @__PURE__ */ React27.createElement("div", { className: "Layer__select__option-content__match__main-row" }, /* @__PURE__ */ React27.createElement("span", { className: "Layer__select__option-content__match__date" }, props.data.payload.date && formatTime(parseISO2(props.data.payload.date), DATE_FORMAT)), /* @__PURE__ */ React27.createElement("span", { className: "Layer__select__option-content__match__description" }, props.data.payload.display_name)),
|
|
1690
|
+
/* @__PURE__ */ React27.createElement("div", { className: "Layer__select__option-content__match__amount-row" }, /* @__PURE__ */ React27.createElement("span", { className: "Layer__select__option-content__match__amount" }, "$", centsToDollars(props.data.payload.amount)))
|
|
1641
1691
|
);
|
|
1642
1692
|
}
|
|
1643
|
-
return /* @__PURE__ */
|
|
1693
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1644
1694
|
components.Option,
|
|
1645
1695
|
{
|
|
1646
1696
|
...props,
|
|
1647
1697
|
className: `Layer__select__option-menu-content ${props.className}`
|
|
1648
1698
|
},
|
|
1649
|
-
/* @__PURE__ */
|
|
1650
|
-
props.isSelected ? /* @__PURE__ */
|
|
1699
|
+
/* @__PURE__ */ React27.createElement("div", null, props.data.payload.display_name),
|
|
1700
|
+
props.isSelected ? /* @__PURE__ */ React27.createElement("span", { className: "Layer__select__option-menu-content-check" }, /* @__PURE__ */ React27.createElement(Check_default, { size: 16 })) : null
|
|
1651
1701
|
);
|
|
1652
1702
|
};
|
|
1653
1703
|
var allCategoriesDivider = [
|
|
@@ -1730,17 +1780,20 @@ var CategorySelect = ({
|
|
|
1730
1780
|
];
|
|
1731
1781
|
const selected = value ? value : matchOptions?.length === 1 && matchOptions[0].options.length === 1 ? matchOptions[0].options[0] : void 0;
|
|
1732
1782
|
const placeholder = matchOptions?.length === 1 && matchOptions[0].options.length > 1 ? `${matchOptions[0].options.length} possible matches...` : "Categorize or match...";
|
|
1733
|
-
return /* @__PURE__ */
|
|
1783
|
+
return /* @__PURE__ */ React27.createElement(
|
|
1734
1784
|
Select,
|
|
1735
1785
|
{
|
|
1736
1786
|
name,
|
|
1737
1787
|
className: `Layer__category-menu Layer__select ${className ?? ""}`,
|
|
1738
1788
|
classNamePrefix: "Layer__select",
|
|
1789
|
+
classNames: {
|
|
1790
|
+
menu: () => "Layer__select__menu--lg"
|
|
1791
|
+
},
|
|
1739
1792
|
options,
|
|
1740
1793
|
isSearchable: true,
|
|
1741
1794
|
placeholder,
|
|
1742
1795
|
defaultValue: selected,
|
|
1743
|
-
formatOptionLabel: (props) => /* @__PURE__ */
|
|
1796
|
+
formatOptionLabel: (props) => /* @__PURE__ */ React27.createElement("div", { className: "Layer__select__option-label" }, props.type === "match" && /* @__PURE__ */ React27.createElement(Badge, { size: "small" /* SMALL */, icon: /* @__PURE__ */ React27.createElement(MinimizeTwo_default, { size: 11 }) }, "Match"), /* @__PURE__ */ React27.createElement("span", null, props.payload.display_name)),
|
|
1744
1797
|
value,
|
|
1745
1798
|
onChange: (newValue) => newValue && onChange(newValue),
|
|
1746
1799
|
getOptionLabel: (category) => category.payload.display_name,
|
|
@@ -1757,7 +1810,7 @@ var CategorySelect = ({
|
|
|
1757
1810
|
};
|
|
1758
1811
|
|
|
1759
1812
|
// src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
|
|
1760
|
-
import
|
|
1813
|
+
import React44, {
|
|
1761
1814
|
forwardRef as forwardRef2,
|
|
1762
1815
|
useImperativeHandle,
|
|
1763
1816
|
useState as useState7,
|
|
@@ -1767,8 +1820,8 @@ import React43, {
|
|
|
1767
1820
|
} from "react";
|
|
1768
1821
|
|
|
1769
1822
|
// src/icons/ScissorsFullOpen.tsx
|
|
1770
|
-
import * as
|
|
1771
|
-
var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */
|
|
1823
|
+
import * as React28 from "react";
|
|
1824
|
+
var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React28.createElement(
|
|
1772
1825
|
"svg",
|
|
1773
1826
|
{
|
|
1774
1827
|
viewBox: "0 0 12 12",
|
|
@@ -1778,7 +1831,7 @@ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.crea
|
|
|
1778
1831
|
width: size,
|
|
1779
1832
|
height: size
|
|
1780
1833
|
},
|
|
1781
|
-
/* @__PURE__ */
|
|
1834
|
+
/* @__PURE__ */ React28.createElement("g", { id: "scissors" }, /* @__PURE__ */ React28.createElement(
|
|
1782
1835
|
"path",
|
|
1783
1836
|
{
|
|
1784
1837
|
id: "Vector",
|
|
@@ -1787,7 +1840,7 @@ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.crea
|
|
|
1787
1840
|
strokeLinecap: "round",
|
|
1788
1841
|
strokeLinejoin: "round"
|
|
1789
1842
|
}
|
|
1790
|
-
), /* @__PURE__ */
|
|
1843
|
+
), /* @__PURE__ */ React28.createElement(
|
|
1791
1844
|
"path",
|
|
1792
1845
|
{
|
|
1793
1846
|
id: "Vector_2",
|
|
@@ -1796,7 +1849,7 @@ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.crea
|
|
|
1796
1849
|
strokeLinecap: "round",
|
|
1797
1850
|
strokeLinejoin: "round"
|
|
1798
1851
|
}
|
|
1799
|
-
), /* @__PURE__ */
|
|
1852
|
+
), /* @__PURE__ */ React28.createElement(
|
|
1800
1853
|
"path",
|
|
1801
1854
|
{
|
|
1802
1855
|
id: "Vector_3",
|
|
@@ -1805,7 +1858,7 @@ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.crea
|
|
|
1805
1858
|
strokeLinecap: "round",
|
|
1806
1859
|
strokeLinejoin: "round"
|
|
1807
1860
|
}
|
|
1808
|
-
), /* @__PURE__ */
|
|
1861
|
+
), /* @__PURE__ */ React28.createElement(
|
|
1809
1862
|
"path",
|
|
1810
1863
|
{
|
|
1811
1864
|
id: "Vector_4",
|
|
@@ -1814,7 +1867,7 @@ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.crea
|
|
|
1814
1867
|
strokeLinecap: "round",
|
|
1815
1868
|
strokeLinejoin: "round"
|
|
1816
1869
|
}
|
|
1817
|
-
), /* @__PURE__ */
|
|
1870
|
+
), /* @__PURE__ */ React28.createElement(
|
|
1818
1871
|
"path",
|
|
1819
1872
|
{
|
|
1820
1873
|
id: "Vector_5",
|
|
@@ -1828,8 +1881,8 @@ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.crea
|
|
|
1828
1881
|
var ScissorsFullOpen_default = ScissorsFullOpen;
|
|
1829
1882
|
|
|
1830
1883
|
// src/icons/Trash.tsx
|
|
1831
|
-
import * as
|
|
1832
|
-
var Trash = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
1884
|
+
import * as React29 from "react";
|
|
1885
|
+
var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React29.createElement(
|
|
1833
1886
|
"svg",
|
|
1834
1887
|
{
|
|
1835
1888
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1839,7 +1892,7 @@ var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
|
|
|
1839
1892
|
width: size,
|
|
1840
1893
|
height: size
|
|
1841
1894
|
},
|
|
1842
|
-
/* @__PURE__ */
|
|
1895
|
+
/* @__PURE__ */ React29.createElement(
|
|
1843
1896
|
"path",
|
|
1844
1897
|
{
|
|
1845
1898
|
d: "M2.25 4.5H3.75H15.75",
|
|
@@ -1848,7 +1901,7 @@ var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
|
|
|
1848
1901
|
strokeLinejoin: "round"
|
|
1849
1902
|
}
|
|
1850
1903
|
),
|
|
1851
|
-
/* @__PURE__ */
|
|
1904
|
+
/* @__PURE__ */ React29.createElement(
|
|
1852
1905
|
"path",
|
|
1853
1906
|
{
|
|
1854
1907
|
d: "M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",
|
|
@@ -1857,7 +1910,7 @@ var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
|
|
|
1857
1910
|
strokeLinejoin: "round"
|
|
1858
1911
|
}
|
|
1859
1912
|
),
|
|
1860
|
-
/* @__PURE__ */
|
|
1913
|
+
/* @__PURE__ */ React29.createElement(
|
|
1861
1914
|
"path",
|
|
1862
1915
|
{
|
|
1863
1916
|
d: "M7.5 8.25V12.75",
|
|
@@ -1866,7 +1919,7 @@ var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
|
|
|
1866
1919
|
strokeLinejoin: "round"
|
|
1867
1920
|
}
|
|
1868
1921
|
),
|
|
1869
|
-
/* @__PURE__ */
|
|
1922
|
+
/* @__PURE__ */ React29.createElement(
|
|
1870
1923
|
"path",
|
|
1871
1924
|
{
|
|
1872
1925
|
d: "M10.5 8.25V12.75",
|
|
@@ -1878,65 +1931,9 @@ var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
|
|
|
1878
1931
|
);
|
|
1879
1932
|
var Trash_default = Trash;
|
|
1880
1933
|
|
|
1881
|
-
// src/components/CategoryMenu/CategoryMenu.tsx
|
|
1882
|
-
import React28 from "react";
|
|
1883
|
-
import Select2, {
|
|
1884
|
-
components as components2
|
|
1885
|
-
} from "react-select";
|
|
1886
|
-
var DropdownIndicator2 = (props) => {
|
|
1887
|
-
return /* @__PURE__ */ React28.createElement(components2.DropdownIndicator, { ...props }, /* @__PURE__ */ React28.createElement(ChevronDown_default, null));
|
|
1888
|
-
};
|
|
1889
|
-
var CategoryMenu = ({
|
|
1890
|
-
bankTransaction,
|
|
1891
|
-
name,
|
|
1892
|
-
value,
|
|
1893
|
-
onChange,
|
|
1894
|
-
disabled,
|
|
1895
|
-
className
|
|
1896
|
-
}) => {
|
|
1897
|
-
const { categories } = useLayerContext();
|
|
1898
|
-
const suggestedOptions = hasSuggestions(bankTransaction.categorization_flow) ? [
|
|
1899
|
-
{
|
|
1900
|
-
label: "Suggested",
|
|
1901
|
-
options: bankTransaction.categorization_flow.suggestions
|
|
1902
|
-
}
|
|
1903
|
-
] : [];
|
|
1904
|
-
const categoryOptions = (categories || []).map((category) => {
|
|
1905
|
-
if (category?.subCategories && category?.subCategories?.length > 0) {
|
|
1906
|
-
return {
|
|
1907
|
-
label: category.display_name,
|
|
1908
|
-
options: category.subCategories
|
|
1909
|
-
};
|
|
1910
|
-
}
|
|
1911
|
-
return {
|
|
1912
|
-
label: category.display_name,
|
|
1913
|
-
options: [category]
|
|
1914
|
-
};
|
|
1915
|
-
}).filter((x) => x);
|
|
1916
|
-
const options = [...suggestedOptions, ...categoryOptions];
|
|
1917
|
-
return /* @__PURE__ */ React28.createElement(
|
|
1918
|
-
Select2,
|
|
1919
|
-
{
|
|
1920
|
-
name,
|
|
1921
|
-
className: `Layer__category-menu Layer__select ${className ?? ""}`,
|
|
1922
|
-
classNamePrefix: "Layer__select",
|
|
1923
|
-
options,
|
|
1924
|
-
isSearchable: true,
|
|
1925
|
-
value,
|
|
1926
|
-
onChange: (newValue) => newValue && onChange(newValue),
|
|
1927
|
-
getOptionLabel: (category) => category.display_name,
|
|
1928
|
-
getOptionValue: (category) => category.stable_name || category.category,
|
|
1929
|
-
menuPortalTarget: document.body,
|
|
1930
|
-
styles: { menuPortal: (base) => ({ ...base, zIndex: 9999 }) },
|
|
1931
|
-
components: { DropdownIndicator: DropdownIndicator2 },
|
|
1932
|
-
isDisabled: disabled
|
|
1933
|
-
}
|
|
1934
|
-
);
|
|
1935
|
-
};
|
|
1936
|
-
|
|
1937
1934
|
// src/components/Input/Input.tsx
|
|
1938
|
-
import
|
|
1939
|
-
import
|
|
1935
|
+
import React30 from "react";
|
|
1936
|
+
import classNames9 from "classnames";
|
|
1940
1937
|
var Input = ({
|
|
1941
1938
|
className,
|
|
1942
1939
|
isInvalid,
|
|
@@ -1944,21 +1941,21 @@ var Input = ({
|
|
|
1944
1941
|
leftText,
|
|
1945
1942
|
...props
|
|
1946
1943
|
}) => {
|
|
1947
|
-
const baseClassName =
|
|
1944
|
+
const baseClassName = classNames9(
|
|
1948
1945
|
"Layer__input",
|
|
1949
1946
|
isInvalid ? "Layer__input--error" : "",
|
|
1950
1947
|
leftText ? "Layer__input--with-left-text" : "",
|
|
1951
1948
|
className
|
|
1952
1949
|
);
|
|
1953
|
-
return /* @__PURE__ */
|
|
1950
|
+
return /* @__PURE__ */ React30.createElement(Tooltip, { disabled: !isInvalid || !errorMessage }, /* @__PURE__ */ React30.createElement(TooltipTrigger, { className: "Layer__input-tooltip" }, /* @__PURE__ */ React30.createElement("input", { ...props, className: baseClassName }), leftText && /* @__PURE__ */ React30.createElement("span", { className: "Layer__input-left-text" }, leftText)), /* @__PURE__ */ React30.createElement(TooltipContent, { className: "Layer__tooltip" }, errorMessage));
|
|
1954
1951
|
};
|
|
1955
1952
|
|
|
1956
1953
|
// src/components/Input/InputGroup.tsx
|
|
1957
|
-
import
|
|
1954
|
+
import React34 from "react";
|
|
1958
1955
|
|
|
1959
1956
|
// src/components/Typography/Text.tsx
|
|
1960
|
-
import
|
|
1961
|
-
import
|
|
1957
|
+
import React31, { useRef as useRef6, useState as useState4, useEffect } from "react";
|
|
1958
|
+
import classNames10 from "classnames";
|
|
1962
1959
|
var Text = ({
|
|
1963
1960
|
as: Component = "p",
|
|
1964
1961
|
className,
|
|
@@ -1968,12 +1965,12 @@ var Text = ({
|
|
|
1968
1965
|
withTooltip,
|
|
1969
1966
|
...props
|
|
1970
1967
|
}) => {
|
|
1971
|
-
const baseClassName =
|
|
1968
|
+
const baseClassName = classNames10(
|
|
1972
1969
|
`Layer__text Layer__text--${size} Layer__text--${weight}`,
|
|
1973
1970
|
className
|
|
1974
1971
|
);
|
|
1975
1972
|
if (withTooltip) {
|
|
1976
|
-
return /* @__PURE__ */
|
|
1973
|
+
return /* @__PURE__ */ React31.createElement(
|
|
1977
1974
|
TextWithTooltip,
|
|
1978
1975
|
{
|
|
1979
1976
|
as: Component,
|
|
@@ -1986,7 +1983,7 @@ var Text = ({
|
|
|
1986
1983
|
children
|
|
1987
1984
|
);
|
|
1988
1985
|
}
|
|
1989
|
-
return /* @__PURE__ */
|
|
1986
|
+
return /* @__PURE__ */ React31.createElement(Component, { ...props, className: baseClassName }, children);
|
|
1990
1987
|
};
|
|
1991
1988
|
var TextWithTooltip = ({
|
|
1992
1989
|
as: Component = "p",
|
|
@@ -2016,48 +2013,48 @@ var TextWithTooltip = ({
|
|
|
2016
2013
|
[]
|
|
2017
2014
|
);
|
|
2018
2015
|
const [hoverStatus, setHover] = useState4(false);
|
|
2019
|
-
const contentClassName =
|
|
2016
|
+
const contentClassName = classNames10(
|
|
2020
2017
|
"Layer__tooltip",
|
|
2021
2018
|
tooltipOptions?.contentClassName
|
|
2022
2019
|
);
|
|
2023
|
-
return /* @__PURE__ */
|
|
2020
|
+
return /* @__PURE__ */ React31.createElement(
|
|
2024
2021
|
Tooltip,
|
|
2025
2022
|
{
|
|
2026
2023
|
disabled: !hoverStatus,
|
|
2027
2024
|
offset: tooltipOptions?.offset,
|
|
2028
2025
|
shift: tooltipOptions?.shift
|
|
2029
2026
|
},
|
|
2030
|
-
/* @__PURE__ */
|
|
2031
|
-
/* @__PURE__ */
|
|
2027
|
+
/* @__PURE__ */ React31.createElement(TooltipTrigger, null, /* @__PURE__ */ React31.createElement(Component, { className, ref: textElementRef, ...props }, children)),
|
|
2028
|
+
/* @__PURE__ */ React31.createElement(TooltipContent, { className: contentClassName }, children)
|
|
2032
2029
|
);
|
|
2033
2030
|
};
|
|
2034
2031
|
|
|
2035
2032
|
// src/components/Typography/Heading.tsx
|
|
2036
|
-
import
|
|
2037
|
-
import
|
|
2033
|
+
import React32 from "react";
|
|
2034
|
+
import classNames11 from "classnames";
|
|
2038
2035
|
var Heading = ({
|
|
2039
2036
|
as: Component = "h2",
|
|
2040
2037
|
className,
|
|
2041
2038
|
children,
|
|
2042
2039
|
size = "primary" /* primary */
|
|
2043
2040
|
}) => {
|
|
2044
|
-
const baseClassName =
|
|
2041
|
+
const baseClassName = classNames11(
|
|
2045
2042
|
`Layer__heading Layer__heading--${size}`,
|
|
2046
2043
|
className
|
|
2047
2044
|
);
|
|
2048
|
-
return /* @__PURE__ */
|
|
2045
|
+
return /* @__PURE__ */ React32.createElement(Component, { className: baseClassName }, children);
|
|
2049
2046
|
};
|
|
2050
2047
|
|
|
2051
2048
|
// src/components/Typography/ErrorText.tsx
|
|
2052
|
-
import
|
|
2053
|
-
import
|
|
2049
|
+
import React33 from "react";
|
|
2050
|
+
import classNames12 from "classnames";
|
|
2054
2051
|
var ErrorText = ({ className, ...props }) => {
|
|
2055
|
-
const baseClassName =
|
|
2056
|
-
return /* @__PURE__ */
|
|
2052
|
+
const baseClassName = classNames12("Layer__text--error", className);
|
|
2053
|
+
return /* @__PURE__ */ React33.createElement(Text, { ...props, className: baseClassName });
|
|
2057
2054
|
};
|
|
2058
2055
|
|
|
2059
2056
|
// src/components/Input/InputGroup.tsx
|
|
2060
|
-
import
|
|
2057
|
+
import classNames13 from "classnames";
|
|
2061
2058
|
var InputGroup = ({
|
|
2062
2059
|
label,
|
|
2063
2060
|
name,
|
|
@@ -2065,12 +2062,12 @@ var InputGroup = ({
|
|
|
2065
2062
|
inline,
|
|
2066
2063
|
children
|
|
2067
2064
|
}) => {
|
|
2068
|
-
const baseClassName =
|
|
2065
|
+
const baseClassName = classNames13(
|
|
2069
2066
|
"Layer__input-group",
|
|
2070
2067
|
className,
|
|
2071
2068
|
inline && "Layer__input-group--inline"
|
|
2072
2069
|
);
|
|
2073
|
-
return /* @__PURE__ */
|
|
2070
|
+
return /* @__PURE__ */ React34.createElement("div", { className: baseClassName }, label && /* @__PURE__ */ React34.createElement(
|
|
2074
2071
|
Text,
|
|
2075
2072
|
{
|
|
2076
2073
|
as: "label",
|
|
@@ -2083,11 +2080,11 @@ var InputGroup = ({
|
|
|
2083
2080
|
};
|
|
2084
2081
|
|
|
2085
2082
|
// src/components/Input/FileInput.tsx
|
|
2086
|
-
import
|
|
2083
|
+
import React36, { useRef as useRef7 } from "react";
|
|
2087
2084
|
|
|
2088
2085
|
// src/icons/UploadCloud.tsx
|
|
2089
|
-
import * as
|
|
2090
|
-
var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2086
|
+
import * as React35 from "react";
|
|
2087
|
+
var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React35.createElement(
|
|
2091
2088
|
"svg",
|
|
2092
2089
|
{
|
|
2093
2090
|
viewBox: "0 0 18 18",
|
|
@@ -2097,7 +2094,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React34.createEle
|
|
|
2097
2094
|
width: size,
|
|
2098
2095
|
height: size
|
|
2099
2096
|
},
|
|
2100
|
-
/* @__PURE__ */
|
|
2097
|
+
/* @__PURE__ */ React35.createElement(
|
|
2101
2098
|
"path",
|
|
2102
2099
|
{
|
|
2103
2100
|
d: "M12 12L9 9L6 12",
|
|
@@ -2106,7 +2103,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React34.createEle
|
|
|
2106
2103
|
strokeLinejoin: "round"
|
|
2107
2104
|
}
|
|
2108
2105
|
),
|
|
2109
|
-
/* @__PURE__ */
|
|
2106
|
+
/* @__PURE__ */ React35.createElement(
|
|
2110
2107
|
"path",
|
|
2111
2108
|
{
|
|
2112
2109
|
d: "M9 9V15.75",
|
|
@@ -2115,7 +2112,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React34.createEle
|
|
|
2115
2112
|
strokeLinejoin: "round"
|
|
2116
2113
|
}
|
|
2117
2114
|
),
|
|
2118
|
-
/* @__PURE__ */
|
|
2115
|
+
/* @__PURE__ */ React35.createElement(
|
|
2119
2116
|
"path",
|
|
2120
2117
|
{
|
|
2121
2118
|
d: "M15.2925 13.7925C16.024 13.3937 16.6019 12.7626 16.9349 11.999C17.2679 11.2353 17.3372 10.3824 17.1317 9.57501C16.9262 8.7676 16.4576 8.05162 15.8 7.54007C15.1424 7.02852 14.3332 6.75054 13.5 6.74999H12.555C12.328 5.87192 11.9049 5.05674 11.3175 4.36573C10.7301 3.67473 9.99364 3.12588 9.16358 2.76044C8.33352 2.39501 7.43141 2.22251 6.52509 2.2559C5.61876 2.28929 4.7318 2.52771 3.93088 2.95324C3.12997 3.37876 2.43593 3.98032 1.90097 4.71267C1.366 5.44503 1.00402 6.28914 0.842236 7.18153C0.680453 8.07393 0.72308 8.99139 0.966911 9.86493C1.21074 10.7385 1.64943 11.5454 2.25 12.225",
|
|
@@ -2124,7 +2121,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React34.createEle
|
|
|
2124
2121
|
strokeLinejoin: "round"
|
|
2125
2122
|
}
|
|
2126
2123
|
),
|
|
2127
|
-
/* @__PURE__ */
|
|
2124
|
+
/* @__PURE__ */ React35.createElement(
|
|
2128
2125
|
"path",
|
|
2129
2126
|
{
|
|
2130
2127
|
d: "M12 12L9 9L6 12",
|
|
@@ -2150,15 +2147,15 @@ var FileInput = ({ text = "Upload", onUpload }) => {
|
|
|
2150
2147
|
onUpload(fileUploaded);
|
|
2151
2148
|
}
|
|
2152
2149
|
};
|
|
2153
|
-
return /* @__PURE__ */
|
|
2150
|
+
return /* @__PURE__ */ React36.createElement(React36.Fragment, null, /* @__PURE__ */ React36.createElement(
|
|
2154
2151
|
Button,
|
|
2155
2152
|
{
|
|
2156
2153
|
onClick,
|
|
2157
2154
|
variant: "secondary" /* secondary */,
|
|
2158
|
-
rightIcon: /* @__PURE__ */
|
|
2155
|
+
rightIcon: /* @__PURE__ */ React36.createElement(UploadCloud_default, null)
|
|
2159
2156
|
},
|
|
2160
2157
|
text
|
|
2161
|
-
), /* @__PURE__ */
|
|
2158
|
+
), /* @__PURE__ */ React36.createElement(
|
|
2162
2159
|
"input",
|
|
2163
2160
|
{
|
|
2164
2161
|
type: "file",
|
|
@@ -2170,14 +2167,14 @@ var FileInput = ({ text = "Upload", onUpload }) => {
|
|
|
2170
2167
|
};
|
|
2171
2168
|
|
|
2172
2169
|
// src/components/Input/Select.tsx
|
|
2173
|
-
import
|
|
2170
|
+
import React37 from "react";
|
|
2174
2171
|
import ReactSelect, {
|
|
2175
|
-
components as
|
|
2172
|
+
components as components2
|
|
2176
2173
|
} from "react-select";
|
|
2177
|
-
var
|
|
2178
|
-
return /* @__PURE__ */
|
|
2174
|
+
var DropdownIndicator2 = (props) => {
|
|
2175
|
+
return /* @__PURE__ */ React37.createElement(components2.DropdownIndicator, { ...props }, /* @__PURE__ */ React37.createElement(ChevronDownFill_default, null));
|
|
2179
2176
|
};
|
|
2180
|
-
var
|
|
2177
|
+
var Select2 = ({
|
|
2181
2178
|
name,
|
|
2182
2179
|
options,
|
|
2183
2180
|
className,
|
|
@@ -2186,7 +2183,7 @@ var Select3 = ({
|
|
|
2186
2183
|
onChange,
|
|
2187
2184
|
disabled
|
|
2188
2185
|
}) => {
|
|
2189
|
-
return /* @__PURE__ */
|
|
2186
|
+
return /* @__PURE__ */ React37.createElement(
|
|
2190
2187
|
ReactSelect,
|
|
2191
2188
|
{
|
|
2192
2189
|
name,
|
|
@@ -2197,17 +2194,17 @@ var Select3 = ({
|
|
|
2197
2194
|
onChange: (newValue) => newValue && onChange(newValue),
|
|
2198
2195
|
menuPortalTarget: document.body,
|
|
2199
2196
|
styles: { menuPortal: (base) => ({ ...base, zIndex: 9999 }) },
|
|
2200
|
-
components: { DropdownIndicator:
|
|
2197
|
+
components: { DropdownIndicator: DropdownIndicator2 },
|
|
2201
2198
|
isDisabled: disabled
|
|
2202
2199
|
}
|
|
2203
2200
|
);
|
|
2204
2201
|
};
|
|
2205
2202
|
|
|
2206
2203
|
// src/components/MatchForm/MatchForm.tsx
|
|
2207
|
-
import
|
|
2204
|
+
import React39 from "react";
|
|
2208
2205
|
|
|
2209
2206
|
// src/components/BankTransactionRow/MatchBadge.tsx
|
|
2210
|
-
import
|
|
2207
|
+
import React38 from "react";
|
|
2211
2208
|
import { parseISO as parseISO3, format as formatTime2 } from "date-fns";
|
|
2212
2209
|
var MatchBadge = ({
|
|
2213
2210
|
bankTransaction,
|
|
@@ -2216,12 +2213,12 @@ var MatchBadge = ({
|
|
|
2216
2213
|
text = "Match"
|
|
2217
2214
|
}) => {
|
|
2218
2215
|
if (bankTransaction.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction.match) {
|
|
2219
|
-
const { date, amount
|
|
2220
|
-
return /* @__PURE__ */
|
|
2216
|
+
const { date, amount } = bankTransaction.match.bank_transaction;
|
|
2217
|
+
return /* @__PURE__ */ React38.createElement(
|
|
2221
2218
|
Badge,
|
|
2222
2219
|
{
|
|
2223
|
-
icon: /* @__PURE__ */
|
|
2224
|
-
tooltip: /* @__PURE__ */
|
|
2220
|
+
icon: /* @__PURE__ */ React38.createElement(MinimizeTwo_default, { size: 11 }),
|
|
2221
|
+
tooltip: /* @__PURE__ */ React38.createElement("span", { className: `${classNamePrefix}__match-tooltip` }, /* @__PURE__ */ React38.createElement("div", { className: `${classNamePrefix}__match-tooltip__date` }, formatTime2(parseISO3(date), dateFormat)), /* @__PURE__ */ React38.createElement("div", { className: `${classNamePrefix}__match-tooltip__description` }, bankTransaction.match?.details?.description ?? ""), /* @__PURE__ */ React38.createElement("div", { className: `${classNamePrefix}__match-tooltip__amount` }, "$", centsToDollars(amount)))
|
|
2225
2222
|
},
|
|
2226
2223
|
text
|
|
2227
2224
|
);
|
|
@@ -2230,7 +2227,7 @@ var MatchBadge = ({
|
|
|
2230
2227
|
};
|
|
2231
2228
|
|
|
2232
2229
|
// src/components/MatchForm/MatchForm.tsx
|
|
2233
|
-
import
|
|
2230
|
+
import classNames14 from "classnames";
|
|
2234
2231
|
import { parseISO as parseISO4, format as formatTime3 } from "date-fns";
|
|
2235
2232
|
var MatchForm = ({
|
|
2236
2233
|
classNamePrefix,
|
|
@@ -2239,17 +2236,17 @@ var MatchForm = ({
|
|
|
2239
2236
|
setSelectedMatchId,
|
|
2240
2237
|
matchFormError
|
|
2241
2238
|
}) => {
|
|
2242
|
-
return /* @__PURE__ */
|
|
2239
|
+
return /* @__PURE__ */ React39.createElement("div", { className: `${classNamePrefix}__match-table` }, /* @__PURE__ */ React39.createElement("div", { className: `${classNamePrefix}__match-table__header` }, /* @__PURE__ */ React39.createElement("div", { className: `${classNamePrefix}__match-table__date` }, "Date"), /* @__PURE__ */ React39.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, "Description"), /* @__PURE__ */ React39.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "Amount"), /* @__PURE__ */ React39.createElement(
|
|
2243
2240
|
"div",
|
|
2244
2241
|
{
|
|
2245
2242
|
className: `${classNamePrefix}__match-table__status ${bankTransaction.match ? "" : "no-match"}`
|
|
2246
2243
|
}
|
|
2247
2244
|
)), bankTransaction.suggested_matches?.map((match, idx) => {
|
|
2248
|
-
return /* @__PURE__ */
|
|
2245
|
+
return /* @__PURE__ */ React39.createElement(
|
|
2249
2246
|
"div",
|
|
2250
2247
|
{
|
|
2251
2248
|
key: idx,
|
|
2252
|
-
className:
|
|
2249
|
+
className: classNames14(
|
|
2253
2250
|
`${classNamePrefix}__match-row`,
|
|
2254
2251
|
match.id === selectedMatchId ? `${classNamePrefix}__match-row--selected` : ""
|
|
2255
2252
|
),
|
|
@@ -2261,15 +2258,15 @@ var MatchForm = ({
|
|
|
2261
2258
|
setSelectedMatchId(match.id);
|
|
2262
2259
|
}
|
|
2263
2260
|
},
|
|
2264
|
-
/* @__PURE__ */
|
|
2261
|
+
/* @__PURE__ */ React39.createElement(
|
|
2265
2262
|
"div",
|
|
2266
2263
|
{
|
|
2267
2264
|
className: `Layer__nowrap ${classNamePrefix}__match-table__date`
|
|
2268
2265
|
},
|
|
2269
|
-
/* @__PURE__ */
|
|
2270
|
-
/* @__PURE__ */
|
|
2266
|
+
/* @__PURE__ */ React39.createElement("span", null, formatTime3(parseISO4(match.details.date), DATE_FORMAT)),
|
|
2267
|
+
/* @__PURE__ */ React39.createElement("span", { className: "amount-next-to-date" }, "$", centsToDollars(match.details.amount))
|
|
2271
2268
|
),
|
|
2272
|
-
/* @__PURE__ */
|
|
2269
|
+
/* @__PURE__ */ React39.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, /* @__PURE__ */ React39.createElement(
|
|
2273
2270
|
Text,
|
|
2274
2271
|
{
|
|
2275
2272
|
className: `${classNamePrefix}__match-table__desc-tooltip`,
|
|
@@ -2277,7 +2274,7 @@ var MatchForm = ({
|
|
|
2277
2274
|
as: "span"
|
|
2278
2275
|
},
|
|
2279
2276
|
match.details.description
|
|
2280
|
-
), match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */
|
|
2277
|
+
), match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ React39.createElement("span", { className: "match-badge" }, /* @__PURE__ */ React39.createElement(
|
|
2281
2278
|
MatchBadge,
|
|
2282
2279
|
{
|
|
2283
2280
|
classNamePrefix,
|
|
@@ -2286,13 +2283,13 @@ var MatchForm = ({
|
|
|
2286
2283
|
text: "Matched"
|
|
2287
2284
|
}
|
|
2288
2285
|
))),
|
|
2289
|
-
/* @__PURE__ */
|
|
2290
|
-
/* @__PURE__ */
|
|
2286
|
+
/* @__PURE__ */ React39.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "$", centsToDollars(match.details.amount)),
|
|
2287
|
+
/* @__PURE__ */ React39.createElement(
|
|
2291
2288
|
"div",
|
|
2292
2289
|
{
|
|
2293
2290
|
className: `${classNamePrefix}__match-table__status ${bankTransaction.match ? "" : "no-match"}`
|
|
2294
2291
|
},
|
|
2295
|
-
match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */
|
|
2292
|
+
match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ React39.createElement(
|
|
2296
2293
|
MatchBadge,
|
|
2297
2294
|
{
|
|
2298
2295
|
classNamePrefix,
|
|
@@ -2303,26 +2300,26 @@ var MatchForm = ({
|
|
|
2303
2300
|
)
|
|
2304
2301
|
)
|
|
2305
2302
|
);
|
|
2306
|
-
}), matchFormError && /* @__PURE__ */
|
|
2303
|
+
}), matchFormError && /* @__PURE__ */ React39.createElement(ErrorText, null, matchFormError));
|
|
2307
2304
|
};
|
|
2308
2305
|
|
|
2309
2306
|
// src/components/Textarea/Textarea.tsx
|
|
2310
|
-
import
|
|
2311
|
-
import
|
|
2307
|
+
import React40 from "react";
|
|
2308
|
+
import classNames15 from "classnames";
|
|
2312
2309
|
var Textarea = ({
|
|
2313
2310
|
className,
|
|
2314
2311
|
...props
|
|
2315
2312
|
}) => {
|
|
2316
|
-
const baseClassName =
|
|
2317
|
-
return /* @__PURE__ */
|
|
2313
|
+
const baseClassName = classNames15("Layer__textarea", className);
|
|
2314
|
+
return /* @__PURE__ */ React40.createElement("textarea", { ...props, className: baseClassName });
|
|
2318
2315
|
};
|
|
2319
2316
|
|
|
2320
2317
|
// src/components/Toggle/Toggle.tsx
|
|
2321
|
-
import
|
|
2318
|
+
import React41, {
|
|
2322
2319
|
useEffect as useEffect2,
|
|
2323
2320
|
useState as useState5
|
|
2324
2321
|
} from "react";
|
|
2325
|
-
import
|
|
2322
|
+
import classNames16 from "classnames";
|
|
2326
2323
|
var Toggle = ({
|
|
2327
2324
|
name,
|
|
2328
2325
|
options,
|
|
@@ -2339,7 +2336,7 @@ var Toggle = ({
|
|
|
2339
2336
|
}
|
|
2340
2337
|
});
|
|
2341
2338
|
const selectedValue = selected || options[0].value;
|
|
2342
|
-
const baseClassName =
|
|
2339
|
+
const baseClassName = classNames16(
|
|
2343
2340
|
"Layer__toggle",
|
|
2344
2341
|
`Layer__toggle--${size}`,
|
|
2345
2342
|
initialized ? "Layer__toggle--initialized" : ""
|
|
@@ -2387,7 +2384,7 @@ var Toggle = ({
|
|
|
2387
2384
|
}
|
|
2388
2385
|
return selectedIndex;
|
|
2389
2386
|
};
|
|
2390
|
-
return /* @__PURE__ */
|
|
2387
|
+
return /* @__PURE__ */ React41.createElement("div", { className: baseClassName, ref: toggleRef }, options.map((option, index) => /* @__PURE__ */ React41.createElement(
|
|
2391
2388
|
ToggleOption,
|
|
2392
2389
|
{
|
|
2393
2390
|
...option,
|
|
@@ -2399,7 +2396,7 @@ var Toggle = ({
|
|
|
2399
2396
|
disabled: option.disabled ?? false,
|
|
2400
2397
|
index
|
|
2401
2398
|
}
|
|
2402
|
-
)), /* @__PURE__ */
|
|
2399
|
+
)), /* @__PURE__ */ React41.createElement("span", { className: "Layer__toggle__thumb", style: { ...thumbPos } }));
|
|
2403
2400
|
};
|
|
2404
2401
|
var ToggleOption = ({
|
|
2405
2402
|
checked,
|
|
@@ -2413,7 +2410,7 @@ var ToggleOption = ({
|
|
|
2413
2410
|
index
|
|
2414
2411
|
}) => {
|
|
2415
2412
|
if (disabled) {
|
|
2416
|
-
return /* @__PURE__ */
|
|
2413
|
+
return /* @__PURE__ */ React41.createElement(Tooltip, null, /* @__PURE__ */ React41.createElement(TooltipTrigger, null, /* @__PURE__ */ React41.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ React41.createElement(
|
|
2417
2414
|
"input",
|
|
2418
2415
|
{
|
|
2419
2416
|
type: "radio",
|
|
@@ -2424,9 +2421,9 @@ var ToggleOption = ({
|
|
|
2424
2421
|
disabled: disabled ?? false,
|
|
2425
2422
|
"data-idx": index
|
|
2426
2423
|
}
|
|
2427
|
-
), /* @__PURE__ */
|
|
2424
|
+
), /* @__PURE__ */ React41.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ React41.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ React41.createElement("span", null, label)))), /* @__PURE__ */ React41.createElement(TooltipContent, { className: "Layer__tooltip" }, "We could not find matching transactions"));
|
|
2428
2425
|
}
|
|
2429
|
-
return /* @__PURE__ */
|
|
2426
|
+
return /* @__PURE__ */ React41.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ React41.createElement(
|
|
2430
2427
|
"input",
|
|
2431
2428
|
{
|
|
2432
2429
|
type: "radio",
|
|
@@ -2437,15 +2434,15 @@ var ToggleOption = ({
|
|
|
2437
2434
|
disabled: disabled ?? false,
|
|
2438
2435
|
"data-idx": index
|
|
2439
2436
|
}
|
|
2440
|
-
), /* @__PURE__ */
|
|
2437
|
+
), /* @__PURE__ */ React41.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ React41.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ React41.createElement("span", null, label)));
|
|
2441
2438
|
};
|
|
2442
2439
|
|
|
2443
2440
|
// src/components/ExpandedBankTransactionRow/APIErrorNotifications.tsx
|
|
2444
|
-
import
|
|
2441
|
+
import React43, { useEffect as useEffect3, useState as useState6 } from "react";
|
|
2445
2442
|
|
|
2446
2443
|
// src/icons/AlertOctagon.tsx
|
|
2447
|
-
import * as
|
|
2448
|
-
var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2444
|
+
import * as React42 from "react";
|
|
2445
|
+
var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React42.createElement(
|
|
2449
2446
|
"svg",
|
|
2450
2447
|
{
|
|
2451
2448
|
viewBox: "0 0 18 18",
|
|
@@ -2455,7 +2452,7 @@ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React41.createEl
|
|
|
2455
2452
|
width: size,
|
|
2456
2453
|
height: size
|
|
2457
2454
|
},
|
|
2458
|
-
/* @__PURE__ */
|
|
2455
|
+
/* @__PURE__ */ React42.createElement(
|
|
2459
2456
|
"path",
|
|
2460
2457
|
{
|
|
2461
2458
|
d: "M5.895 1.5H12.105L16.5 5.895V12.105L12.105 16.5H5.895L1.5 12.105V5.895L5.895 1.5Z",
|
|
@@ -2464,7 +2461,7 @@ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React41.createEl
|
|
|
2464
2461
|
strokeLinejoin: "round"
|
|
2465
2462
|
}
|
|
2466
2463
|
),
|
|
2467
|
-
/* @__PURE__ */
|
|
2464
|
+
/* @__PURE__ */ React42.createElement(
|
|
2468
2465
|
"path",
|
|
2469
2466
|
{
|
|
2470
2467
|
d: "M9 6V9",
|
|
@@ -2473,7 +2470,7 @@ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React41.createEl
|
|
|
2473
2470
|
strokeLinejoin: "round"
|
|
2474
2471
|
}
|
|
2475
2472
|
),
|
|
2476
|
-
/* @__PURE__ */
|
|
2473
|
+
/* @__PURE__ */ React42.createElement(
|
|
2477
2474
|
"path",
|
|
2478
2475
|
{
|
|
2479
2476
|
d: "M9 12H9.0075",
|
|
@@ -2529,13 +2526,13 @@ var APIErrorNotifications = ({
|
|
|
2529
2526
|
pushNotification(ERROR_TITLE, ERROR_MESSAGE);
|
|
2530
2527
|
}
|
|
2531
2528
|
}, [bankTransaction.error]);
|
|
2532
|
-
return /* @__PURE__ */
|
|
2529
|
+
return /* @__PURE__ */ React43.createElement(
|
|
2533
2530
|
"div",
|
|
2534
2531
|
{
|
|
2535
2532
|
className: "Layer__bank-transactions__notifications",
|
|
2536
2533
|
style: containerWidth ? { left: containerWidth - 324 } : {}
|
|
2537
2534
|
},
|
|
2538
|
-
notifications.filter((n) => n.bankTransactionId === bankTransaction.id).map((notification) => /* @__PURE__ */
|
|
2535
|
+
notifications.filter((n) => n.bankTransactionId === bankTransaction.id).map((notification) => /* @__PURE__ */ React43.createElement(
|
|
2539
2536
|
Notification,
|
|
2540
2537
|
{
|
|
2541
2538
|
key: notification.timestamp,
|
|
@@ -2563,20 +2560,20 @@ var Notification = ({
|
|
|
2563
2560
|
deleteNotification(notification.timestamp);
|
|
2564
2561
|
}, FADE_OUT_TIME_WAIT);
|
|
2565
2562
|
};
|
|
2566
|
-
return /* @__PURE__ */
|
|
2563
|
+
return /* @__PURE__ */ React43.createElement(
|
|
2567
2564
|
"div",
|
|
2568
2565
|
{
|
|
2569
2566
|
className: `Layer__bank-transactions__notification ${visible ? "notification-enter" : "notification-exit"}`,
|
|
2570
2567
|
onClick: hideNotification
|
|
2571
2568
|
},
|
|
2572
|
-
/* @__PURE__ */
|
|
2569
|
+
/* @__PURE__ */ React43.createElement("div", { className: "Layer__bank-transactions__notification-content" }, /* @__PURE__ */ React43.createElement("div", { className: "Layer__bank-transactions__notification-icon" }, /* @__PURE__ */ React43.createElement(AlertOctagon_default, { size: 14 })), /* @__PURE__ */ React43.createElement("div", { className: "Layer__bank-transactions__notification-text" }, /* @__PURE__ */ React43.createElement(
|
|
2573
2570
|
Text,
|
|
2574
2571
|
{
|
|
2575
2572
|
as: "span",
|
|
2576
2573
|
className: "Layer__bank-transactions__notification-title"
|
|
2577
2574
|
},
|
|
2578
2575
|
notification.title
|
|
2579
|
-
), /* @__PURE__ */
|
|
2576
|
+
), /* @__PURE__ */ React43.createElement(
|
|
2580
2577
|
Text,
|
|
2581
2578
|
{
|
|
2582
2579
|
as: "span",
|
|
@@ -2588,7 +2585,7 @@ var Notification = ({
|
|
|
2588
2585
|
};
|
|
2589
2586
|
|
|
2590
2587
|
// src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
|
|
2591
|
-
import
|
|
2588
|
+
import classNames17 from "classnames";
|
|
2592
2589
|
var hasMatch = (bankTransaction) => {
|
|
2593
2590
|
return Boolean(
|
|
2594
2591
|
bankTransaction?.suggested_matches && bankTransaction?.suggested_matches?.length > 0 || bankTransaction?.match
|
|
@@ -2618,6 +2615,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2618
2615
|
({
|
|
2619
2616
|
bankTransaction,
|
|
2620
2617
|
isOpen = false,
|
|
2618
|
+
close,
|
|
2621
2619
|
editable,
|
|
2622
2620
|
asListItem = false,
|
|
2623
2621
|
submitBtnText = "Save",
|
|
@@ -2645,13 +2643,13 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2645
2643
|
return {
|
|
2646
2644
|
amount: c.amount || 0,
|
|
2647
2645
|
inputValue: centsToDollars(c.amount),
|
|
2648
|
-
category: c.category
|
|
2646
|
+
category: mapCategoryToOption(c.category)
|
|
2649
2647
|
};
|
|
2650
2648
|
}) : [
|
|
2651
2649
|
{
|
|
2652
2650
|
amount: bankTransaction.amount,
|
|
2653
2651
|
inputValue: centsToDollars(bankTransaction.amount),
|
|
2654
|
-
category: defaultCategory
|
|
2652
|
+
category: mapCategoryToOption(defaultCategory)
|
|
2655
2653
|
}
|
|
2656
2654
|
],
|
|
2657
2655
|
description: "",
|
|
@@ -2662,7 +2660,11 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2662
2660
|
...rowState,
|
|
2663
2661
|
splits: [
|
|
2664
2662
|
...rowState.splits,
|
|
2665
|
-
{
|
|
2663
|
+
{
|
|
2664
|
+
amount: 0,
|
|
2665
|
+
inputValue: "0.00",
|
|
2666
|
+
category: mapCategoryToOption(defaultCategory)
|
|
2667
|
+
}
|
|
2666
2668
|
]
|
|
2667
2669
|
});
|
|
2668
2670
|
setSplitFormError(void 0);
|
|
@@ -2717,7 +2719,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2717
2719
|
updateRowState({ ...rowState });
|
|
2718
2720
|
setSplitFormError(void 0);
|
|
2719
2721
|
};
|
|
2720
|
-
const save = () => {
|
|
2722
|
+
const save = async () => {
|
|
2721
2723
|
if (purpose === "match" /* match */) {
|
|
2722
2724
|
if (!selectedMatchId) {
|
|
2723
2725
|
setMatchFormError("Select an option to match the transaction");
|
|
@@ -2736,34 +2738,36 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2736
2738
|
}
|
|
2737
2739
|
return;
|
|
2738
2740
|
}
|
|
2739
|
-
categorizeBankTransaction2(
|
|
2741
|
+
await categorizeBankTransaction2(
|
|
2740
2742
|
bankTransaction.id,
|
|
2741
2743
|
rowState.splits.length === 1 ? {
|
|
2742
2744
|
type: "Category",
|
|
2743
2745
|
category: {
|
|
2744
2746
|
type: "StableName",
|
|
2745
|
-
stable_name: rowState?.splits[0].category?.stable_name
|
|
2747
|
+
stable_name: rowState?.splits[0].category?.payload.stable_name
|
|
2746
2748
|
}
|
|
2747
2749
|
} : {
|
|
2748
2750
|
type: "Split",
|
|
2749
2751
|
entries: rowState.splits.map((split) => ({
|
|
2750
|
-
category: split.category?.stable_name
|
|
2752
|
+
category: split.category?.payload.stable_name,
|
|
2751
2753
|
amount: split.amount
|
|
2752
2754
|
}))
|
|
2753
2755
|
}
|
|
2754
2756
|
);
|
|
2757
|
+
close();
|
|
2755
2758
|
};
|
|
2756
2759
|
useImperativeHandle(ref, () => ({
|
|
2757
2760
|
save
|
|
2758
2761
|
}));
|
|
2759
|
-
const onMatchSubmit = (matchId) => {
|
|
2762
|
+
const onMatchSubmit = async (matchId) => {
|
|
2760
2763
|
const foundMatch = bankTransaction.suggested_matches?.find(
|
|
2761
2764
|
(x) => x.id === matchId
|
|
2762
2765
|
);
|
|
2763
2766
|
if (!foundMatch) {
|
|
2764
2767
|
return;
|
|
2765
2768
|
}
|
|
2766
|
-
matchBankTransaction2(bankTransaction.id, foundMatch.id);
|
|
2769
|
+
await matchBankTransaction2(bankTransaction.id, foundMatch.id);
|
|
2770
|
+
close();
|
|
2767
2771
|
};
|
|
2768
2772
|
const getDivHeight = useCallback(() => {
|
|
2769
2773
|
const { height: height2 } = bodyRef.current ? bodyRef.current.getBoundingClientRect() : { height: void 0 };
|
|
@@ -2798,14 +2802,14 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2798
2802
|
}, []);
|
|
2799
2803
|
const className = "Layer__expanded-bank-transaction-row";
|
|
2800
2804
|
const shouldHide = !isOpen && isOver;
|
|
2801
|
-
return /* @__PURE__ */
|
|
2805
|
+
return /* @__PURE__ */ React44.createElement(
|
|
2802
2806
|
"span",
|
|
2803
2807
|
{
|
|
2804
2808
|
className: `${className} ${className}--${isOpen ? "expanded" : "collapsed"}`,
|
|
2805
2809
|
style: { height },
|
|
2806
2810
|
onTransitionEnd: handleTransitionEnd
|
|
2807
2811
|
},
|
|
2808
|
-
shouldHide ? null : /* @__PURE__ */
|
|
2812
|
+
shouldHide ? null : /* @__PURE__ */ React44.createElement("span", { className: `${className}__wrapper`, ref: bodyRef }, /* @__PURE__ */ React44.createElement("div", { className: `${className}__content-toggle` }, /* @__PURE__ */ React44.createElement(
|
|
2809
2813
|
Toggle,
|
|
2810
2814
|
{
|
|
2811
2815
|
name: `purpose-${bankTransaction.id}${asListItem ? "-li" : ""}`,
|
|
@@ -2824,22 +2828,22 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2824
2828
|
selected: purpose,
|
|
2825
2829
|
onChange: onChangePurpose
|
|
2826
2830
|
}
|
|
2827
|
-
)), /* @__PURE__ */
|
|
2831
|
+
)), /* @__PURE__ */ React44.createElement(
|
|
2828
2832
|
"div",
|
|
2829
2833
|
{
|
|
2830
2834
|
className: `${className}__content`,
|
|
2831
2835
|
id: `expanded-${bankTransaction.id}`
|
|
2832
2836
|
},
|
|
2833
|
-
/* @__PURE__ */
|
|
2837
|
+
/* @__PURE__ */ React44.createElement("div", { className: `${className}__content-panels` }, /* @__PURE__ */ React44.createElement(
|
|
2834
2838
|
"div",
|
|
2835
2839
|
{
|
|
2836
|
-
className:
|
|
2840
|
+
className: classNames17(
|
|
2837
2841
|
`${className}__match`,
|
|
2838
2842
|
`${className}__content-panel`,
|
|
2839
2843
|
purpose === "match" /* match */ ? `${className}__content-panel--active` : ""
|
|
2840
2844
|
)
|
|
2841
2845
|
},
|
|
2842
|
-
/* @__PURE__ */
|
|
2846
|
+
/* @__PURE__ */ React44.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ React44.createElement(
|
|
2843
2847
|
MatchForm,
|
|
2844
2848
|
{
|
|
2845
2849
|
classNamePrefix: className,
|
|
@@ -2852,22 +2856,22 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2852
2856
|
matchFormError
|
|
2853
2857
|
}
|
|
2854
2858
|
))
|
|
2855
|
-
), /* @__PURE__ */
|
|
2859
|
+
), /* @__PURE__ */ React44.createElement(
|
|
2856
2860
|
"div",
|
|
2857
2861
|
{
|
|
2858
|
-
className:
|
|
2862
|
+
className: classNames17(
|
|
2859
2863
|
`${className}__splits`,
|
|
2860
2864
|
`${className}__content-panel`,
|
|
2861
2865
|
purpose === "categorize" /* categorize */ ? `${className}__content-panel--active` : ""
|
|
2862
2866
|
)
|
|
2863
2867
|
},
|
|
2864
|
-
/* @__PURE__ */
|
|
2868
|
+
/* @__PURE__ */ React44.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ React44.createElement("div", { className: `${className}__splits-inputs` }, rowState.splits.map((split, index) => /* @__PURE__ */ React44.createElement(
|
|
2865
2869
|
"div",
|
|
2866
2870
|
{
|
|
2867
2871
|
className: `${className}__table-cell--split-entry`,
|
|
2868
2872
|
key: `split-${index}`
|
|
2869
2873
|
},
|
|
2870
|
-
/* @__PURE__ */
|
|
2874
|
+
/* @__PURE__ */ React44.createElement(
|
|
2871
2875
|
Input,
|
|
2872
2876
|
{
|
|
2873
2877
|
type: "text",
|
|
@@ -2880,33 +2884,34 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2880
2884
|
errorMessage: "Negative values are not allowed"
|
|
2881
2885
|
}
|
|
2882
2886
|
),
|
|
2883
|
-
/* @__PURE__ */
|
|
2887
|
+
/* @__PURE__ */ React44.createElement(
|
|
2884
2888
|
"div",
|
|
2885
2889
|
{
|
|
2886
2890
|
className: `${className}__table-cell--split-entry__right-col`
|
|
2887
2891
|
},
|
|
2888
|
-
/* @__PURE__ */
|
|
2889
|
-
|
|
2892
|
+
/* @__PURE__ */ React44.createElement(
|
|
2893
|
+
CategorySelect,
|
|
2890
2894
|
{
|
|
2891
2895
|
bankTransaction,
|
|
2892
|
-
name: `category-${
|
|
2896
|
+
name: `category-${bankTransaction.id}`,
|
|
2893
2897
|
value: split.category,
|
|
2894
2898
|
onChange: (value) => changeCategory(index, value),
|
|
2895
|
-
className: "Layer__category-menu--full"
|
|
2899
|
+
className: "Layer__category-menu--full",
|
|
2900
|
+
disabled: bankTransaction.processing
|
|
2896
2901
|
}
|
|
2897
2902
|
),
|
|
2898
|
-
index > 0 && /* @__PURE__ */
|
|
2903
|
+
index > 0 && /* @__PURE__ */ React44.createElement(
|
|
2899
2904
|
Button,
|
|
2900
2905
|
{
|
|
2901
2906
|
className: `${className}__table-cell--split-entry__merge-btn`,
|
|
2902
2907
|
onClick: () => removeSplit(index),
|
|
2903
|
-
rightIcon: /* @__PURE__ */
|
|
2908
|
+
rightIcon: /* @__PURE__ */ React44.createElement(Trash_default, { size: 18 }),
|
|
2904
2909
|
variant: "secondary" /* secondary */,
|
|
2905
2910
|
iconOnly: true
|
|
2906
2911
|
}
|
|
2907
2912
|
)
|
|
2908
2913
|
)
|
|
2909
|
-
))), splitFormError && /* @__PURE__ */
|
|
2914
|
+
))), splitFormError && /* @__PURE__ */ React44.createElement(ErrorText, null, splitFormError), /* @__PURE__ */ React44.createElement("div", { className: `${className}__total-and-btns` }, rowState.splits.length > 1 && /* @__PURE__ */ React44.createElement(
|
|
2910
2915
|
Input,
|
|
2911
2916
|
{
|
|
2912
2917
|
disabled: true,
|
|
@@ -2918,43 +2923,43 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2918
2923
|
)
|
|
2919
2924
|
)}`
|
|
2920
2925
|
}
|
|
2921
|
-
), /* @__PURE__ */
|
|
2926
|
+
), /* @__PURE__ */ React44.createElement("div", { className: `${className}__splits-buttons` }, rowState.splits.length > 1 ? /* @__PURE__ */ React44.createElement(
|
|
2922
2927
|
TextButton,
|
|
2923
2928
|
{
|
|
2924
2929
|
onClick: addSplit,
|
|
2925
2930
|
disabled: rowState.splits.length > 5
|
|
2926
2931
|
},
|
|
2927
2932
|
"Add new split"
|
|
2928
|
-
) : /* @__PURE__ */
|
|
2933
|
+
) : /* @__PURE__ */ React44.createElement(
|
|
2929
2934
|
Button,
|
|
2930
2935
|
{
|
|
2931
2936
|
onClick: addSplit,
|
|
2932
|
-
rightIcon: /* @__PURE__ */
|
|
2937
|
+
rightIcon: /* @__PURE__ */ React44.createElement(ScissorsFullOpen_default, { size: 14 }),
|
|
2933
2938
|
variant: "secondary" /* secondary */,
|
|
2934
2939
|
disabled: rowState.splits.length > 5
|
|
2935
2940
|
},
|
|
2936
2941
|
"Split"
|
|
2937
2942
|
))))
|
|
2938
2943
|
)),
|
|
2939
|
-
/* @__PURE__ */
|
|
2944
|
+
/* @__PURE__ */ React44.createElement(
|
|
2940
2945
|
InputGroup,
|
|
2941
2946
|
{
|
|
2942
2947
|
className: `${className}__description`,
|
|
2943
2948
|
name: "description"
|
|
2944
2949
|
},
|
|
2945
|
-
/* @__PURE__ */
|
|
2950
|
+
/* @__PURE__ */ React44.createElement(Textarea, { name: "description", placeholder: "Add description" })
|
|
2946
2951
|
),
|
|
2947
|
-
/* @__PURE__ */
|
|
2948
|
-
asListItem ? /* @__PURE__ */
|
|
2952
|
+
/* @__PURE__ */ React44.createElement("div", { className: `${className}__file-upload` }, /* @__PURE__ */ React44.createElement(FileInput, { text: "Upload receipt" })),
|
|
2953
|
+
asListItem ? /* @__PURE__ */ React44.createElement("div", { className: `${className}__submit-btn` }, bankTransaction.error ? /* @__PURE__ */ React44.createElement(
|
|
2949
2954
|
Text,
|
|
2950
2955
|
{
|
|
2951
2956
|
as: "span",
|
|
2952
2957
|
size: "md" /* md */,
|
|
2953
2958
|
className: "Layer__unsaved-info"
|
|
2954
2959
|
},
|
|
2955
|
-
/* @__PURE__ */
|
|
2956
|
-
/* @__PURE__ */
|
|
2957
|
-
) : null, /* @__PURE__ */
|
|
2960
|
+
/* @__PURE__ */ React44.createElement("span", null, "Unsaved"),
|
|
2961
|
+
/* @__PURE__ */ React44.createElement(AlertCircle_default, { size: 12 })
|
|
2962
|
+
) : null, /* @__PURE__ */ React44.createElement(
|
|
2958
2963
|
SubmitButton,
|
|
2959
2964
|
{
|
|
2960
2965
|
onClick: () => {
|
|
@@ -2969,7 +2974,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2969
2974
|
},
|
|
2970
2975
|
submitBtnText
|
|
2971
2976
|
)) : null
|
|
2972
|
-
), /* @__PURE__ */
|
|
2977
|
+
), /* @__PURE__ */ React44.createElement(
|
|
2973
2978
|
APIErrorNotifications,
|
|
2974
2979
|
{
|
|
2975
2980
|
bankTransaction,
|
|
@@ -2981,7 +2986,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
2981
2986
|
);
|
|
2982
2987
|
|
|
2983
2988
|
// src/components/BankTransactionRow/SplitTooltipDetails.tsx
|
|
2984
|
-
import
|
|
2989
|
+
import React45 from "react";
|
|
2985
2990
|
var SplitTooltipDetails = ({
|
|
2986
2991
|
classNamePrefix,
|
|
2987
2992
|
category
|
|
@@ -2989,11 +2994,11 @@ var SplitTooltipDetails = ({
|
|
|
2989
2994
|
if (!category.entries) {
|
|
2990
2995
|
return;
|
|
2991
2996
|
}
|
|
2992
|
-
return /* @__PURE__ */
|
|
2997
|
+
return /* @__PURE__ */ React45.createElement("span", { className: `${classNamePrefix}__split-tooltip` }, /* @__PURE__ */ React45.createElement("ul", null, category.entries.map((entry, idx) => /* @__PURE__ */ React45.createElement("li", { key: idx }, /* @__PURE__ */ React45.createElement("span", { className: `${classNamePrefix}__split-tooltip__label` }, entry.category.display_name), /* @__PURE__ */ React45.createElement("span", { className: `${classNamePrefix}__split-tooltip__value` }, "$", centsToDollars(entry.amount))))));
|
|
2993
2998
|
};
|
|
2994
2999
|
|
|
2995
3000
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
2996
|
-
import
|
|
3001
|
+
import classNames18 from "classnames";
|
|
2997
3002
|
import { parseISO as parseISO5, format as formatTime4 } from "date-fns";
|
|
2998
3003
|
var isCredit = ({ direction }) => direction === "CREDIT" /* CREDIT */;
|
|
2999
3004
|
var extractDescriptionForSplit = (category) => {
|
|
@@ -3012,7 +3017,8 @@ var BankTransactionRow = ({
|
|
|
3012
3017
|
bankTransaction,
|
|
3013
3018
|
editable,
|
|
3014
3019
|
removeTransaction,
|
|
3015
|
-
containerWidth
|
|
3020
|
+
containerWidth,
|
|
3021
|
+
initialLoad
|
|
3016
3022
|
}) => {
|
|
3017
3023
|
const expandedRowRef = useRef10(null);
|
|
3018
3024
|
const [showRetry, setShowRetry] = useState8(false);
|
|
@@ -3039,10 +3045,14 @@ var BankTransactionRow = ({
|
|
|
3039
3045
|
};
|
|
3040
3046
|
const [showComponent, setShowComponent] = useState8(false);
|
|
3041
3047
|
useEffect5(() => {
|
|
3042
|
-
|
|
3048
|
+
if (initialLoad) {
|
|
3049
|
+
const timeoutId = setTimeout(() => {
|
|
3050
|
+
setShowComponent(true);
|
|
3051
|
+
}, index * 10);
|
|
3052
|
+
return () => clearTimeout(timeoutId);
|
|
3053
|
+
} else {
|
|
3043
3054
|
setShowComponent(true);
|
|
3044
|
-
}
|
|
3045
|
-
return () => clearTimeout(timeoutId);
|
|
3055
|
+
}
|
|
3046
3056
|
}, []);
|
|
3047
3057
|
useEffect5(() => {
|
|
3048
3058
|
if (bankTransaction.error) {
|
|
@@ -3058,54 +3068,62 @@ var BankTransactionRow = ({
|
|
|
3058
3068
|
return;
|
|
3059
3069
|
}
|
|
3060
3070
|
if (selectedCategory.type === "match") {
|
|
3061
|
-
matchBankTransaction2(
|
|
3071
|
+
await matchBankTransaction2(
|
|
3072
|
+
bankTransaction.id,
|
|
3073
|
+
selectedCategory.payload.id
|
|
3074
|
+
);
|
|
3075
|
+
setOpen(false);
|
|
3062
3076
|
return;
|
|
3063
3077
|
}
|
|
3064
|
-
categorizeBankTransaction2(bankTransaction.id, {
|
|
3078
|
+
await categorizeBankTransaction2(bankTransaction.id, {
|
|
3065
3079
|
type: "Category",
|
|
3066
3080
|
category: {
|
|
3067
3081
|
type: "StableName",
|
|
3068
3082
|
stable_name: selectedCategory?.payload.stable_name || ""
|
|
3069
3083
|
}
|
|
3070
3084
|
});
|
|
3085
|
+
setOpen(false);
|
|
3071
3086
|
};
|
|
3072
3087
|
if (removed) {
|
|
3073
3088
|
return null;
|
|
3074
3089
|
}
|
|
3075
3090
|
const className = "Layer__bank-transaction-row";
|
|
3076
3091
|
const openClassName = open ? `${className}--expanded` : "";
|
|
3077
|
-
const rowClassName =
|
|
3092
|
+
const rowClassName = classNames18(
|
|
3078
3093
|
className,
|
|
3079
|
-
bankTransaction.recently_categorized ? "Layer__bank-transaction-row--removing" : "",
|
|
3094
|
+
bankTransaction.recently_categorized && editable ? "Layer__bank-transaction-row--removing" : "",
|
|
3080
3095
|
open ? openClassName : "",
|
|
3096
|
+
initialLoad ? "initial-load" : "",
|
|
3081
3097
|
showComponent ? "show" : ""
|
|
3082
3098
|
);
|
|
3083
|
-
return /* @__PURE__ */
|
|
3099
|
+
return /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(
|
|
3084
3100
|
"tr",
|
|
3085
3101
|
{
|
|
3086
3102
|
className: rowClassName,
|
|
3087
3103
|
onTransitionEnd: ({ propertyName }) => {
|
|
3088
3104
|
if (propertyName === "top") {
|
|
3089
3105
|
setRemoved(true);
|
|
3090
|
-
|
|
3106
|
+
if (editable) {
|
|
3107
|
+
removeTransaction(bankTransaction.id);
|
|
3108
|
+
}
|
|
3091
3109
|
}
|
|
3092
3110
|
}
|
|
3093
3111
|
},
|
|
3094
|
-
/* @__PURE__ */
|
|
3112
|
+
/* @__PURE__ */ React46.createElement(
|
|
3095
3113
|
"td",
|
|
3096
3114
|
{
|
|
3097
3115
|
className: "Layer__table-cell Layer__bank-transaction-table__date-col",
|
|
3098
3116
|
...openRow
|
|
3099
3117
|
},
|
|
3100
|
-
/* @__PURE__ */
|
|
3118
|
+
/* @__PURE__ */ React46.createElement("span", { className: "Layer__table-cell-content" }, formatTime4(parseISO5(bankTransaction.date), dateFormat))
|
|
3101
3119
|
),
|
|
3102
|
-
/* @__PURE__ */
|
|
3120
|
+
/* @__PURE__ */ React46.createElement(
|
|
3103
3121
|
"td",
|
|
3104
3122
|
{
|
|
3105
3123
|
className: "Layer__table-cell Layer__bank-transactions__tx-col",
|
|
3106
3124
|
...openRow
|
|
3107
3125
|
},
|
|
3108
|
-
/* @__PURE__ */
|
|
3126
|
+
/* @__PURE__ */ React46.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React46.createElement(
|
|
3109
3127
|
Text,
|
|
3110
3128
|
{
|
|
3111
3129
|
as: "span",
|
|
@@ -3118,13 +3136,13 @@ var BankTransactionRow = ({
|
|
|
3118
3136
|
bankTransaction.counterparty_name ?? bankTransaction.description
|
|
3119
3137
|
))
|
|
3120
3138
|
),
|
|
3121
|
-
/* @__PURE__ */
|
|
3139
|
+
/* @__PURE__ */ React46.createElement(
|
|
3122
3140
|
"td",
|
|
3123
3141
|
{
|
|
3124
3142
|
className: "Layer__table-cell Layer__bank-transactions__account-col",
|
|
3125
3143
|
...openRow
|
|
3126
3144
|
},
|
|
3127
|
-
/* @__PURE__ */
|
|
3145
|
+
/* @__PURE__ */ React46.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React46.createElement(
|
|
3128
3146
|
Text,
|
|
3129
3147
|
{
|
|
3130
3148
|
as: "span",
|
|
@@ -3134,30 +3152,30 @@ var BankTransactionRow = ({
|
|
|
3134
3152
|
bankTransaction.account_name ?? ""
|
|
3135
3153
|
))
|
|
3136
3154
|
),
|
|
3137
|
-
/* @__PURE__ */
|
|
3155
|
+
/* @__PURE__ */ React46.createElement(
|
|
3138
3156
|
"td",
|
|
3139
3157
|
{
|
|
3140
3158
|
className: `Layer__table-cell Layer__table-cell__amount-col Layer__bank-transactions__amount-col Layer__table-cell--amount ${className}__table-cell--amount-${isCredit(bankTransaction) ? "credit" : "debit"}`,
|
|
3141
3159
|
...openRow
|
|
3142
3160
|
},
|
|
3143
|
-
/* @__PURE__ */
|
|
3161
|
+
/* @__PURE__ */ React46.createElement("span", { className: "Layer__table-cell-content" }, isCredit(bankTransaction) ? "+$" : " $", centsToDollars(bankTransaction.amount))
|
|
3144
3162
|
),
|
|
3145
|
-
/* @__PURE__ */
|
|
3163
|
+
/* @__PURE__ */ React46.createElement(
|
|
3146
3164
|
"td",
|
|
3147
3165
|
{
|
|
3148
|
-
className:
|
|
3166
|
+
className: classNames18(
|
|
3149
3167
|
"Layer__table-cell",
|
|
3150
3168
|
"Layer__table-cell__category-col",
|
|
3151
3169
|
`${className}__actions-cell`,
|
|
3152
3170
|
`${className}__actions-cell--${open ? "open" : "close"}`
|
|
3153
3171
|
)
|
|
3154
3172
|
},
|
|
3155
|
-
/* @__PURE__ */
|
|
3173
|
+
/* @__PURE__ */ React46.createElement(
|
|
3156
3174
|
"span",
|
|
3157
3175
|
{
|
|
3158
3176
|
className: `${className}__actions-container Layer__table-cell-content`
|
|
3159
3177
|
},
|
|
3160
|
-
editable && !open ? /* @__PURE__ */
|
|
3178
|
+
editable && !open ? /* @__PURE__ */ React46.createElement(
|
|
3161
3179
|
CategorySelect,
|
|
3162
3180
|
{
|
|
3163
3181
|
bankTransaction,
|
|
@@ -3170,11 +3188,11 @@ var BankTransactionRow = ({
|
|
|
3170
3188
|
disabled: bankTransaction.processing
|
|
3171
3189
|
}
|
|
3172
3190
|
) : null,
|
|
3173
|
-
!editable && !open ? /* @__PURE__ */
|
|
3191
|
+
!editable && !open ? /* @__PURE__ */ React46.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction.categorization_status === "SPLIT" /* SPLIT */ && /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(
|
|
3174
3192
|
Badge,
|
|
3175
3193
|
{
|
|
3176
|
-
icon: /* @__PURE__ */
|
|
3177
|
-
tooltip: /* @__PURE__ */
|
|
3194
|
+
icon: /* @__PURE__ */ React46.createElement(Scissors_default, { size: 11 }),
|
|
3195
|
+
tooltip: /* @__PURE__ */ React46.createElement(
|
|
3178
3196
|
SplitTooltipDetails,
|
|
3179
3197
|
{
|
|
3180
3198
|
classNamePrefix: className,
|
|
@@ -3183,18 +3201,18 @@ var BankTransactionRow = ({
|
|
|
3183
3201
|
)
|
|
3184
3202
|
},
|
|
3185
3203
|
"Split"
|
|
3186
|
-
), /* @__PURE__ */
|
|
3204
|
+
), /* @__PURE__ */ React46.createElement("span", { className: `${className}__category-text__text` }, extractDescriptionForSplit(bankTransaction.category))), bankTransaction?.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction?.match && /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(
|
|
3187
3205
|
MatchBadge,
|
|
3188
3206
|
{
|
|
3189
3207
|
classNamePrefix: className,
|
|
3190
3208
|
bankTransaction,
|
|
3191
3209
|
dateFormat
|
|
3192
3210
|
}
|
|
3193
|
-
), /* @__PURE__ */
|
|
3211
|
+
), /* @__PURE__ */ React46.createElement("span", { className: `${className}__category-text__text` }, `${formatTime4(
|
|
3194
3212
|
parseISO5(bankTransaction.match.bank_transaction.date),
|
|
3195
3213
|
dateFormat
|
|
3196
|
-
)}, ${bankTransaction.match
|
|
3197
|
-
editable && !open && showRetry ? /* @__PURE__ */
|
|
3214
|
+
)}, ${bankTransaction.match?.details?.description}`)), bankTransaction?.categorization_status !== "MATCHED" /* MATCHED */ && bankTransaction?.categorization_status !== "SPLIT" /* SPLIT */ && /* @__PURE__ */ React46.createElement("span", { className: `${className}__category-text__text` }, bankTransaction?.category?.display_name)) : null,
|
|
3215
|
+
editable && !open && showRetry ? /* @__PURE__ */ React46.createElement(
|
|
3198
3216
|
RetryButton,
|
|
3199
3217
|
{
|
|
3200
3218
|
onClick: () => {
|
|
@@ -3208,17 +3226,17 @@ var BankTransactionRow = ({
|
|
|
3208
3226
|
},
|
|
3209
3227
|
"Retry"
|
|
3210
3228
|
) : null,
|
|
3211
|
-
open && bankTransaction.error ? /* @__PURE__ */
|
|
3229
|
+
open && bankTransaction.error ? /* @__PURE__ */ React46.createElement(
|
|
3212
3230
|
Text,
|
|
3213
3231
|
{
|
|
3214
3232
|
as: "span",
|
|
3215
3233
|
size: "md" /* md */,
|
|
3216
3234
|
className: "Layer__unsaved-info"
|
|
3217
3235
|
},
|
|
3218
|
-
/* @__PURE__ */
|
|
3219
|
-
/* @__PURE__ */
|
|
3236
|
+
/* @__PURE__ */ React46.createElement("span", null, "Unsaved"),
|
|
3237
|
+
/* @__PURE__ */ React46.createElement(AlertCircle_default, { size: 12 })
|
|
3220
3238
|
) : null,
|
|
3221
|
-
editable && (open || !open && !showRetry) || !editable && open ? /* @__PURE__ */
|
|
3239
|
+
editable && (open || !open && !showRetry) || !editable && open ? /* @__PURE__ */ React46.createElement(
|
|
3222
3240
|
SubmitButton,
|
|
3223
3241
|
{
|
|
3224
3242
|
onClick: () => {
|
|
@@ -3233,13 +3251,13 @@ var BankTransactionRow = ({
|
|
|
3233
3251
|
},
|
|
3234
3252
|
editable ? "Approve" : "Update"
|
|
3235
3253
|
) : null,
|
|
3236
|
-
/* @__PURE__ */
|
|
3254
|
+
/* @__PURE__ */ React46.createElement(
|
|
3237
3255
|
IconButton,
|
|
3238
3256
|
{
|
|
3239
3257
|
onClick: toggleOpen,
|
|
3240
3258
|
className: "Layer__bank-transaction-row__expand-button",
|
|
3241
3259
|
active: open,
|
|
3242
|
-
icon: /* @__PURE__ */
|
|
3260
|
+
icon: /* @__PURE__ */ React46.createElement(
|
|
3243
3261
|
ChevronDownFill_default,
|
|
3244
3262
|
{
|
|
3245
3263
|
className: `Layer__chevron ${open ? "Layer__chevron__up" : "Layer__chevron__down"}`
|
|
@@ -3249,12 +3267,13 @@ var BankTransactionRow = ({
|
|
|
3249
3267
|
)
|
|
3250
3268
|
)
|
|
3251
3269
|
)
|
|
3252
|
-
), /* @__PURE__ */
|
|
3270
|
+
), /* @__PURE__ */ React46.createElement("tr", null, /* @__PURE__ */ React46.createElement("td", { colSpan: 5, className: "Layer__bank-transaction-row__expanded-td" }, /* @__PURE__ */ React46.createElement(
|
|
3253
3271
|
ExpandedBankTransactionRow,
|
|
3254
3272
|
{
|
|
3255
3273
|
ref: expandedRowRef,
|
|
3256
3274
|
bankTransaction,
|
|
3257
3275
|
isOpen: open,
|
|
3276
|
+
close: () => setOpen(false),
|
|
3258
3277
|
containerWidth,
|
|
3259
3278
|
editable
|
|
3260
3279
|
}
|
|
@@ -3262,11 +3281,11 @@ var BankTransactionRow = ({
|
|
|
3262
3281
|
};
|
|
3263
3282
|
|
|
3264
3283
|
// src/components/BankTransactionListItem/Assignment.tsx
|
|
3265
|
-
import
|
|
3284
|
+
import React47 from "react";
|
|
3266
3285
|
import { parseISO as parseISO6, format as formatTime5 } from "date-fns";
|
|
3267
3286
|
var Assignment = ({ bankTransaction }) => {
|
|
3268
3287
|
if (bankTransaction.match && bankTransaction.categorization_status === "MATCHED" /* MATCHED */) {
|
|
3269
|
-
return /* @__PURE__ */
|
|
3288
|
+
return /* @__PURE__ */ React47.createElement(React47.Fragment, null, /* @__PURE__ */ React47.createElement(
|
|
3270
3289
|
MatchBadge,
|
|
3271
3290
|
{
|
|
3272
3291
|
classNamePrefix: "Layer__bank-transaction-list-item",
|
|
@@ -3274,17 +3293,17 @@ var Assignment = ({ bankTransaction }) => {
|
|
|
3274
3293
|
dateFormat: DATE_FORMAT,
|
|
3275
3294
|
text: "Matched"
|
|
3276
3295
|
}
|
|
3277
|
-
), /* @__PURE__ */
|
|
3296
|
+
), /* @__PURE__ */ React47.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, `${formatTime5(
|
|
3278
3297
|
parseISO6(bankTransaction.match.bank_transaction.date),
|
|
3279
3298
|
DATE_FORMAT
|
|
3280
3299
|
)}, ${bankTransaction.match.bank_transaction.description}`));
|
|
3281
3300
|
}
|
|
3282
3301
|
if (bankTransaction.categorization_status === "SPLIT" /* SPLIT */) {
|
|
3283
|
-
return /* @__PURE__ */
|
|
3302
|
+
return /* @__PURE__ */ React47.createElement(React47.Fragment, null, /* @__PURE__ */ React47.createElement(
|
|
3284
3303
|
Badge,
|
|
3285
3304
|
{
|
|
3286
|
-
icon: /* @__PURE__ */
|
|
3287
|
-
tooltip: /* @__PURE__ */
|
|
3305
|
+
icon: /* @__PURE__ */ React47.createElement(Scissors_default, { size: 11 }),
|
|
3306
|
+
tooltip: /* @__PURE__ */ React47.createElement(
|
|
3288
3307
|
SplitTooltipDetails,
|
|
3289
3308
|
{
|
|
3290
3309
|
classNamePrefix: "Layer__bank-transaction-list-item",
|
|
@@ -3293,13 +3312,13 @@ var Assignment = ({ bankTransaction }) => {
|
|
|
3293
3312
|
)
|
|
3294
3313
|
},
|
|
3295
3314
|
"Split"
|
|
3296
|
-
), /* @__PURE__ */
|
|
3315
|
+
), /* @__PURE__ */ React47.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, extractDescriptionForSplit(bankTransaction.category)));
|
|
3297
3316
|
}
|
|
3298
|
-
return /* @__PURE__ */
|
|
3317
|
+
return /* @__PURE__ */ React47.createElement(Text, null, bankTransaction?.category?.display_name);
|
|
3299
3318
|
};
|
|
3300
3319
|
|
|
3301
3320
|
// src/components/BankTransactionListItem/BankTransactionListItem.tsx
|
|
3302
|
-
import
|
|
3321
|
+
import classNames19 from "classnames";
|
|
3303
3322
|
import { parseISO as parseISO7, format as formatTime6 } from "date-fns";
|
|
3304
3323
|
var isCredit2 = ({ direction }) => direction === "CREDIT" /* CREDIT */;
|
|
3305
3324
|
var BankTransactionListItem = ({
|
|
@@ -3358,43 +3377,44 @@ var BankTransactionListItem = ({
|
|
|
3358
3377
|
}
|
|
3359
3378
|
const className = "Layer__bank-transaction-list-item";
|
|
3360
3379
|
const openClassName = open ? `${className}--expanded` : "";
|
|
3361
|
-
const rowClassName =
|
|
3380
|
+
const rowClassName = classNames19(
|
|
3362
3381
|
className,
|
|
3363
3382
|
bankTransaction.recently_categorized ? "Layer__bank-transaction-row--removing" : "",
|
|
3364
3383
|
open ? openClassName : "",
|
|
3365
3384
|
showComponent ? "show" : ""
|
|
3366
3385
|
);
|
|
3367
|
-
return /* @__PURE__ */
|
|
3386
|
+
return /* @__PURE__ */ React48.createElement("li", { className: rowClassName }, /* @__PURE__ */ React48.createElement("span", { className: `${className}__heading` }, /* @__PURE__ */ React48.createElement("div", { className: `${className}__heading__main` }, /* @__PURE__ */ React48.createElement("span", { className: `${className}__heading-date` }, formatTime6(parseISO7(bankTransaction.date), dateFormat)), /* @__PURE__ */ React48.createElement("span", { className: `${className}__heading-separator` }), /* @__PURE__ */ React48.createElement("span", { className: `${className}__heading-account-name` }, bankTransaction.account_name ?? "")), /* @__PURE__ */ React48.createElement(
|
|
3368
3387
|
"div",
|
|
3369
3388
|
{
|
|
3370
3389
|
onClick: toggleOpen,
|
|
3371
3390
|
className: "Layer__bank-transaction-row__expand-button"
|
|
3372
3391
|
},
|
|
3373
|
-
/* @__PURE__ */
|
|
3392
|
+
/* @__PURE__ */ React48.createElement(
|
|
3374
3393
|
ChevronDownFill_default,
|
|
3375
3394
|
{
|
|
3376
3395
|
className: `Layer__chevron ${open ? "Layer__chevron__up" : "Layer__chevron__down"}`
|
|
3377
3396
|
}
|
|
3378
3397
|
)
|
|
3379
|
-
)), /* @__PURE__ */
|
|
3398
|
+
)), /* @__PURE__ */ React48.createElement("span", { className: `${className}__body` }, /* @__PURE__ */ React48.createElement("span", { className: `${className}__body__name` }, /* @__PURE__ */ React48.createElement(Text, { as: "span", withTooltip: "whenTruncated" /* whenTruncated */ }, bankTransaction.counterparty_name ?? bankTransaction.description)), /* @__PURE__ */ React48.createElement(
|
|
3380
3399
|
"span",
|
|
3381
3400
|
{
|
|
3382
3401
|
className: `${className}__amount-${isCredit2(bankTransaction) ? "credit" : "debit"}`
|
|
3383
3402
|
},
|
|
3384
3403
|
isCredit2(bankTransaction) ? "+$" : " $",
|
|
3385
3404
|
centsToDollars(bankTransaction.amount)
|
|
3386
|
-
)), /* @__PURE__ */
|
|
3405
|
+
)), /* @__PURE__ */ React48.createElement("span", { className: `${className}__expanded-row` }, /* @__PURE__ */ React48.createElement(
|
|
3387
3406
|
ExpandedBankTransactionRow,
|
|
3388
3407
|
{
|
|
3389
3408
|
ref: expandedRowRef,
|
|
3390
3409
|
bankTransaction,
|
|
3391
3410
|
isOpen: open,
|
|
3411
|
+
close: () => setOpen(false),
|
|
3392
3412
|
editable,
|
|
3393
3413
|
asListItem: true,
|
|
3394
3414
|
submitBtnText: editable ? "Approve" : "Update",
|
|
3395
3415
|
containerWidth
|
|
3396
3416
|
}
|
|
3397
|
-
)), /* @__PURE__ */
|
|
3417
|
+
)), /* @__PURE__ */ React48.createElement("span", { className: `${className}__base-row` }, editable ? /* @__PURE__ */ React48.createElement(
|
|
3398
3418
|
CategorySelect,
|
|
3399
3419
|
{
|
|
3400
3420
|
bankTransaction,
|
|
@@ -3406,7 +3426,7 @@ var BankTransactionListItem = ({
|
|
|
3406
3426
|
},
|
|
3407
3427
|
disabled: bankTransaction.processing
|
|
3408
3428
|
}
|
|
3409
|
-
) : null, !editable ? /* @__PURE__ */
|
|
3429
|
+
) : null, !editable ? /* @__PURE__ */ React48.createElement(Assignment, { bankTransaction }) : null, editable && !showRetry ? /* @__PURE__ */ React48.createElement(
|
|
3410
3430
|
SubmitButton,
|
|
3411
3431
|
{
|
|
3412
3432
|
onClick: () => {
|
|
@@ -3419,7 +3439,7 @@ var BankTransactionListItem = ({
|
|
|
3419
3439
|
action: editable ? "save" /* SAVE */ : "update" /* UPDATE */
|
|
3420
3440
|
},
|
|
3421
3441
|
editable ? "Approve" : "Update"
|
|
3422
|
-
) : null, editable && showRetry ? /* @__PURE__ */
|
|
3442
|
+
) : null, editable && showRetry ? /* @__PURE__ */ React48.createElement(
|
|
3423
3443
|
RetryButton,
|
|
3424
3444
|
{
|
|
3425
3445
|
onClick: () => {
|
|
@@ -3432,11 +3452,11 @@ var BankTransactionListItem = ({
|
|
|
3432
3452
|
error: "Approval failed. Check connection and retry in few seconds."
|
|
3433
3453
|
},
|
|
3434
3454
|
"Retry"
|
|
3435
|
-
) : null), bankTransaction.error && showRetry ? /* @__PURE__ */
|
|
3455
|
+
) : null), bankTransaction.error && showRetry ? /* @__PURE__ */ React48.createElement(ErrorText, null, "Approval failed. Check connection and retry in few seconds.") : null);
|
|
3436
3456
|
};
|
|
3437
3457
|
|
|
3438
3458
|
// src/components/Container/Container.tsx
|
|
3439
|
-
import
|
|
3459
|
+
import React49, { forwardRef as forwardRef3 } from "react";
|
|
3440
3460
|
|
|
3441
3461
|
// src/config/theme.ts
|
|
3442
3462
|
var SHADES = {
|
|
@@ -3664,10 +3684,10 @@ var hslToHex = (hsl) => {
|
|
|
3664
3684
|
};
|
|
3665
3685
|
|
|
3666
3686
|
// src/components/Container/Container.tsx
|
|
3667
|
-
import
|
|
3687
|
+
import classNames20 from "classnames";
|
|
3668
3688
|
var Container = forwardRef3(
|
|
3669
3689
|
({ name, className, children, asWidget }, ref) => {
|
|
3670
|
-
const baseClassName =
|
|
3690
|
+
const baseClassName = classNames20(
|
|
3671
3691
|
"Layer__component Layer__component-container",
|
|
3672
3692
|
`Layer__${name}`,
|
|
3673
3693
|
asWidget ? "Layer__component--as-widget" : "",
|
|
@@ -3675,30 +3695,30 @@ var Container = forwardRef3(
|
|
|
3675
3695
|
);
|
|
3676
3696
|
const { theme } = useLayerContext();
|
|
3677
3697
|
const styles = parseStylesFromThemeConfig(theme);
|
|
3678
|
-
return /* @__PURE__ */
|
|
3698
|
+
return /* @__PURE__ */ React49.createElement("div", { ref, className: baseClassName, style: { ...styles } }, children);
|
|
3679
3699
|
}
|
|
3680
3700
|
);
|
|
3681
3701
|
|
|
3682
3702
|
// src/components/Container/Header.tsx
|
|
3683
|
-
import
|
|
3684
|
-
import
|
|
3703
|
+
import React50, { forwardRef as forwardRef4 } from "react";
|
|
3704
|
+
import classNames21 from "classnames";
|
|
3685
3705
|
var Header = forwardRef4(
|
|
3686
3706
|
({ className, children, style }, ref) => {
|
|
3687
|
-
const baseClassName =
|
|
3688
|
-
return /* @__PURE__ */
|
|
3707
|
+
const baseClassName = classNames21("Layer__component-header", className);
|
|
3708
|
+
return /* @__PURE__ */ React50.createElement("header", { ref, className: baseClassName, style }, children);
|
|
3689
3709
|
}
|
|
3690
3710
|
);
|
|
3691
3711
|
|
|
3692
3712
|
// src/components/DataState/DataState.tsx
|
|
3693
|
-
import
|
|
3713
|
+
import React51 from "react";
|
|
3694
3714
|
var getIcon = (status) => {
|
|
3695
3715
|
switch (status) {
|
|
3696
3716
|
case "failed" /* failed */:
|
|
3697
|
-
return /* @__PURE__ */
|
|
3717
|
+
return /* @__PURE__ */ React51.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--error" }, /* @__PURE__ */ React51.createElement(AlertOctagon_default, { size: 12 }));
|
|
3698
3718
|
case "info" /* info */:
|
|
3699
|
-
return /* @__PURE__ */
|
|
3719
|
+
return /* @__PURE__ */ React51.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ React51.createElement(AlertOctagon_default, { size: 12 }));
|
|
3700
3720
|
default:
|
|
3701
|
-
return /* @__PURE__ */
|
|
3721
|
+
return /* @__PURE__ */ React51.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ React51.createElement(CheckCircle_default, { size: 12 }));
|
|
3702
3722
|
}
|
|
3703
3723
|
};
|
|
3704
3724
|
var DataState = ({
|
|
@@ -3708,7 +3728,7 @@ var DataState = ({
|
|
|
3708
3728
|
onRefresh,
|
|
3709
3729
|
isLoading
|
|
3710
3730
|
}) => {
|
|
3711
|
-
return /* @__PURE__ */
|
|
3731
|
+
return /* @__PURE__ */ React51.createElement("div", { className: "Layer__data-state" }, getIcon(status), /* @__PURE__ */ React51.createElement(
|
|
3712
3732
|
Text,
|
|
3713
3733
|
{
|
|
3714
3734
|
as: "span",
|
|
@@ -3717,11 +3737,11 @@ var DataState = ({
|
|
|
3717
3737
|
className: "Layer__data-state__title"
|
|
3718
3738
|
},
|
|
3719
3739
|
title
|
|
3720
|
-
), /* @__PURE__ */
|
|
3740
|
+
), /* @__PURE__ */ React51.createElement(Text, { as: "span", className: "Layer__data-state__description" }, description), onRefresh && /* @__PURE__ */ React51.createElement("span", { className: "Layer__data-state__btn" }, /* @__PURE__ */ React51.createElement(
|
|
3721
3741
|
Button,
|
|
3722
3742
|
{
|
|
3723
3743
|
variant: "secondary" /* secondary */,
|
|
3724
|
-
rightIcon: isLoading ? /* @__PURE__ */
|
|
3744
|
+
rightIcon: isLoading ? /* @__PURE__ */ React51.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" }) : /* @__PURE__ */ React51.createElement(RefreshCcw_default, { size: 12 }),
|
|
3725
3745
|
onClick: onRefresh,
|
|
3726
3746
|
disabled: isLoading
|
|
3727
3747
|
},
|
|
@@ -3730,13 +3750,13 @@ var DataState = ({
|
|
|
3730
3750
|
};
|
|
3731
3751
|
|
|
3732
3752
|
// src/components/Loader/Loader.tsx
|
|
3733
|
-
import
|
|
3753
|
+
import React52 from "react";
|
|
3734
3754
|
var Loader2 = ({ children }) => {
|
|
3735
|
-
return /* @__PURE__ */
|
|
3755
|
+
return /* @__PURE__ */ React52.createElement("span", { className: "Layer__loader" }, /* @__PURE__ */ React52.createElement(Loader_default, { size: 28, className: "Layer__anim--rotating" }), children);
|
|
3736
3756
|
};
|
|
3737
3757
|
|
|
3738
3758
|
// src/components/Pagination/Pagination.tsx
|
|
3739
|
-
import
|
|
3759
|
+
import React55 from "react";
|
|
3740
3760
|
|
|
3741
3761
|
// src/hooks/usePagination/usePagination.ts
|
|
3742
3762
|
import { useMemo } from "react";
|
|
@@ -3784,8 +3804,8 @@ var usePagination = ({
|
|
|
3784
3804
|
};
|
|
3785
3805
|
|
|
3786
3806
|
// src/icons/ChevronLeft.tsx
|
|
3787
|
-
import * as
|
|
3788
|
-
var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
3807
|
+
import * as React53 from "react";
|
|
3808
|
+
var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React53.createElement(
|
|
3789
3809
|
"svg",
|
|
3790
3810
|
{
|
|
3791
3811
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3795,7 +3815,7 @@ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React52.createEle
|
|
|
3795
3815
|
fill: "none",
|
|
3796
3816
|
...props
|
|
3797
3817
|
},
|
|
3798
|
-
/* @__PURE__ */
|
|
3818
|
+
/* @__PURE__ */ React53.createElement(
|
|
3799
3819
|
"path",
|
|
3800
3820
|
{
|
|
3801
3821
|
d: "M11.25 13.5L6.75 9L11.25 4.5",
|
|
@@ -3808,8 +3828,8 @@ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React52.createEle
|
|
|
3808
3828
|
var ChevronLeft_default = ChevronLeft;
|
|
3809
3829
|
|
|
3810
3830
|
// src/icons/ChevronRight.tsx
|
|
3811
|
-
import * as
|
|
3812
|
-
var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
3831
|
+
import * as React54 from "react";
|
|
3832
|
+
var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React54.createElement(
|
|
3813
3833
|
"svg",
|
|
3814
3834
|
{
|
|
3815
3835
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3819,7 +3839,7 @@ var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React53.createEl
|
|
|
3819
3839
|
fill: "none",
|
|
3820
3840
|
...props
|
|
3821
3841
|
},
|
|
3822
|
-
/* @__PURE__ */
|
|
3842
|
+
/* @__PURE__ */ React54.createElement(
|
|
3823
3843
|
"path",
|
|
3824
3844
|
{
|
|
3825
3845
|
d: "M6.75 13.5L11.25 9L6.75 4.5",
|
|
@@ -3853,7 +3873,7 @@ var Pagination = ({
|
|
|
3853
3873
|
return;
|
|
3854
3874
|
}
|
|
3855
3875
|
let lastPage = paginationRange[paginationRange.length - 1];
|
|
3856
|
-
return /* @__PURE__ */
|
|
3876
|
+
return /* @__PURE__ */ React55.createElement("ul", { className: "Layer__pagination" }, /* @__PURE__ */ React55.createElement(
|
|
3857
3877
|
"li",
|
|
3858
3878
|
{
|
|
3859
3879
|
key: `page-prev`,
|
|
@@ -3865,12 +3885,19 @@ var Pagination = ({
|
|
|
3865
3885
|
),
|
|
3866
3886
|
onClick: () => onPageChange(currentPage - 1)
|
|
3867
3887
|
},
|
|
3868
|
-
/* @__PURE__ */
|
|
3888
|
+
/* @__PURE__ */ React55.createElement(ChevronLeft_default, { size: 12 })
|
|
3869
3889
|
), paginationRange.map((pageNumber) => {
|
|
3870
3890
|
if (pageNumber === DOTS) {
|
|
3871
|
-
return /* @__PURE__ */
|
|
3891
|
+
return /* @__PURE__ */ React55.createElement(
|
|
3892
|
+
"li",
|
|
3893
|
+
{
|
|
3894
|
+
key: `page-${pageNumber}`,
|
|
3895
|
+
className: "Layer__pagination-item Layer__pagination-dots"
|
|
3896
|
+
},
|
|
3897
|
+
"\u2026"
|
|
3898
|
+
);
|
|
3872
3899
|
}
|
|
3873
|
-
return /* @__PURE__ */
|
|
3900
|
+
return /* @__PURE__ */ React55.createElement(
|
|
3874
3901
|
"li",
|
|
3875
3902
|
{
|
|
3876
3903
|
key: `page-${pageNumber}`,
|
|
@@ -3885,7 +3912,7 @@ var Pagination = ({
|
|
|
3885
3912
|
},
|
|
3886
3913
|
pageNumber
|
|
3887
3914
|
);
|
|
3888
|
-
}), /* @__PURE__ */
|
|
3915
|
+
}), /* @__PURE__ */ React55.createElement(
|
|
3889
3916
|
"li",
|
|
3890
3917
|
{
|
|
3891
3918
|
key: `page-last`,
|
|
@@ -3897,7 +3924,7 @@ var Pagination = ({
|
|
|
3897
3924
|
),
|
|
3898
3925
|
onClick: () => onPageChange(currentPage + 1)
|
|
3899
3926
|
},
|
|
3900
|
-
/* @__PURE__ */
|
|
3927
|
+
/* @__PURE__ */ React55.createElement(ChevronRight_default, { size: 12 })
|
|
3901
3928
|
));
|
|
3902
3929
|
};
|
|
3903
3930
|
|
|
@@ -3917,20 +3944,32 @@ var filterVisibility = (display, bankTransaction) => {
|
|
|
3917
3944
|
const categorized = CategorizedCategories.includes(
|
|
3918
3945
|
bankTransaction.categorization_status
|
|
3919
3946
|
);
|
|
3920
|
-
const inReview = ReviewCategories.includes(bankTransaction.categorization_status)
|
|
3947
|
+
const inReview = ReviewCategories.includes(bankTransaction.categorization_status) && !bankTransaction.recently_categorized;
|
|
3921
3948
|
return display === "review" /* review */ && inReview || display === "categorized" /* categorized */ && categorized;
|
|
3922
3949
|
};
|
|
3923
3950
|
var BankTransactions = ({
|
|
3924
3951
|
asWidget = false,
|
|
3925
|
-
pageSize = 15
|
|
3952
|
+
pageSize = 15,
|
|
3953
|
+
categorizedOnly = false
|
|
3926
3954
|
}) => {
|
|
3927
|
-
const [display, setDisplay] = useState10(
|
|
3955
|
+
const [display, setDisplay] = useState10(
|
|
3956
|
+
categorizedOnly ? "categorized" /* categorized */ : "review" /* review */
|
|
3957
|
+
);
|
|
3928
3958
|
const [currentPage, setCurrentPage] = useState10(1);
|
|
3929
3959
|
const [removedTxs, setRemovedTxs] = useState10([]);
|
|
3960
|
+
const [initialLoad, setInitialLoad] = useState10(true);
|
|
3930
3961
|
const { data, isLoading, error, isValidating, refetch } = useBankTransactions();
|
|
3931
3962
|
const bankTransactionsByFilter = data?.filter(
|
|
3932
3963
|
(tx) => !removedTxs.includes(tx.id) && filterVisibility(display, tx)
|
|
3933
3964
|
);
|
|
3965
|
+
useEffect7(() => {
|
|
3966
|
+
if (!isLoading) {
|
|
3967
|
+
const timeoutLoad = setTimeout(() => {
|
|
3968
|
+
setInitialLoad(false);
|
|
3969
|
+
}, 1e3);
|
|
3970
|
+
return () => clearTimeout(timeoutLoad);
|
|
3971
|
+
}
|
|
3972
|
+
}, [isLoading]);
|
|
3934
3973
|
const bankTransactions = useMemo2(() => {
|
|
3935
3974
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
3936
3975
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
@@ -3969,7 +4008,7 @@ var BankTransactions = ({
|
|
|
3969
4008
|
debounceContainerWidth(size?.width);
|
|
3970
4009
|
});
|
|
3971
4010
|
const editable = display === "review" /* review */;
|
|
3972
|
-
return /* @__PURE__ */
|
|
4011
|
+
return /* @__PURE__ */ React56.createElement(
|
|
3973
4012
|
Container,
|
|
3974
4013
|
{
|
|
3975
4014
|
className: editable ? "Layer__bank-transactions--to-review" : "Layer__bank-transactions--categorized",
|
|
@@ -3977,14 +4016,14 @@ var BankTransactions = ({
|
|
|
3977
4016
|
asWidget,
|
|
3978
4017
|
ref: containerRef
|
|
3979
4018
|
},
|
|
3980
|
-
/* @__PURE__ */
|
|
4019
|
+
/* @__PURE__ */ React56.createElement(
|
|
3981
4020
|
Header,
|
|
3982
4021
|
{
|
|
3983
4022
|
className: "Layer__bank-transactions__header",
|
|
3984
4023
|
style: { top: shiftStickyHeader }
|
|
3985
4024
|
},
|
|
3986
|
-
/* @__PURE__ */
|
|
3987
|
-
/* @__PURE__ */
|
|
4025
|
+
/* @__PURE__ */ React56.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
|
|
4026
|
+
!categorizedOnly && /* @__PURE__ */ React56.createElement(
|
|
3988
4027
|
Toggle,
|
|
3989
4028
|
{
|
|
3990
4029
|
name: "bank-transaction-display",
|
|
@@ -3997,17 +4036,18 @@ var BankTransactions = ({
|
|
|
3997
4036
|
}
|
|
3998
4037
|
)
|
|
3999
4038
|
),
|
|
4000
|
-
!listView && /* @__PURE__ */
|
|
4039
|
+
!listView && /* @__PURE__ */ React56.createElement(
|
|
4001
4040
|
"table",
|
|
4002
4041
|
{
|
|
4003
4042
|
width: "100%",
|
|
4004
4043
|
className: "Layer__table Layer__bank-transactions__table with-cell-separators"
|
|
4005
4044
|
},
|
|
4006
|
-
/* @__PURE__ */
|
|
4007
|
-
/* @__PURE__ */
|
|
4008
|
-
(bankTransaction, index) => /* @__PURE__ */
|
|
4045
|
+
/* @__PURE__ */ React56.createElement("thead", null, /* @__PURE__ */ React56.createElement("tr", null, /* @__PURE__ */ React56.createElement("th", { className: "Layer__table-header Layer__bank-transactions__date-col" }, "Date"), /* @__PURE__ */ React56.createElement("th", { className: "Layer__table-header Layer__bank-transactions__tx-col" }, "Transaction"), /* @__PURE__ */ React56.createElement("th", { className: "Layer__table-header Layer__bank-transactions__account-col" }, "Account"), /* @__PURE__ */ React56.createElement("th", { className: "Layer__table-header Layer__table-cell--amount Layer__table-cell__amount-col" }, "Amount"), editable ? /* @__PURE__ */ React56.createElement("th", { className: "Layer__table-header Layer__table-header--primary Layer__table-cell__category-col" }, "Categorize") : /* @__PURE__ */ React56.createElement("th", { className: "Layer__table-header Layer__table-cell__category-col" }, "Category"))),
|
|
4046
|
+
/* @__PURE__ */ React56.createElement("tbody", null, !isLoading && bankTransactions?.map(
|
|
4047
|
+
(bankTransaction, index) => /* @__PURE__ */ React56.createElement(
|
|
4009
4048
|
BankTransactionRow,
|
|
4010
4049
|
{
|
|
4050
|
+
initialLoad,
|
|
4011
4051
|
index,
|
|
4012
4052
|
key: bankTransaction.id,
|
|
4013
4053
|
dateFormat: DATE_FORMAT,
|
|
@@ -4019,9 +4059,9 @@ var BankTransactions = ({
|
|
|
4019
4059
|
)
|
|
4020
4060
|
))
|
|
4021
4061
|
),
|
|
4022
|
-
isLoading && !bankTransactions ? /* @__PURE__ */
|
|
4023
|
-
!isLoading && listView ? /* @__PURE__ */
|
|
4024
|
-
(bankTransaction, index) => /* @__PURE__ */
|
|
4062
|
+
isLoading && !bankTransactions ? /* @__PURE__ */ React56.createElement("div", { className: "Layer__bank-transactions__loader-container" }, /* @__PURE__ */ React56.createElement(Loader2, null)) : null,
|
|
4063
|
+
!isLoading && listView ? /* @__PURE__ */ React56.createElement("ul", { className: "Layer__bank-transactions__list" }, bankTransactions?.map(
|
|
4064
|
+
(bankTransaction, index) => /* @__PURE__ */ React56.createElement(
|
|
4025
4065
|
BankTransactionListItem,
|
|
4026
4066
|
{
|
|
4027
4067
|
index,
|
|
@@ -4034,7 +4074,7 @@ var BankTransactions = ({
|
|
|
4034
4074
|
}
|
|
4035
4075
|
)
|
|
4036
4076
|
)) : null,
|
|
4037
|
-
!isLoading && !error && (bankTransactions === void 0 || bankTransactions !== void 0 && bankTransactions.length === 0) ? /* @__PURE__ */
|
|
4077
|
+
!isLoading && !error && (bankTransactions === void 0 || bankTransactions !== void 0 && bankTransactions.length === 0) ? /* @__PURE__ */ React56.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React56.createElement(
|
|
4038
4078
|
DataState,
|
|
4039
4079
|
{
|
|
4040
4080
|
status: "allDone" /* allDone */,
|
|
@@ -4044,7 +4084,7 @@ var BankTransactions = ({
|
|
|
4044
4084
|
isLoading: isValidating
|
|
4045
4085
|
}
|
|
4046
4086
|
)) : null,
|
|
4047
|
-
!isLoading && error ? /* @__PURE__ */
|
|
4087
|
+
!isLoading && error ? /* @__PURE__ */ React56.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React56.createElement(
|
|
4048
4088
|
DataState,
|
|
4049
4089
|
{
|
|
4050
4090
|
status: "failed" /* failed */,
|
|
@@ -4054,7 +4094,7 @@ var BankTransactions = ({
|
|
|
4054
4094
|
isLoading: isValidating
|
|
4055
4095
|
}
|
|
4056
4096
|
)) : null,
|
|
4057
|
-
/* @__PURE__ */
|
|
4097
|
+
/* @__PURE__ */ React56.createElement("div", { className: "Layer__bank-transactions__pagination" }, /* @__PURE__ */ React56.createElement(
|
|
4058
4098
|
Pagination,
|
|
4059
4099
|
{
|
|
4060
4100
|
currentPage,
|
|
@@ -4067,7 +4107,7 @@ var BankTransactions = ({
|
|
|
4067
4107
|
};
|
|
4068
4108
|
|
|
4069
4109
|
// src/components/Hello/Hello.tsx
|
|
4070
|
-
import
|
|
4110
|
+
import React57 from "react";
|
|
4071
4111
|
import useSWR3 from "swr";
|
|
4072
4112
|
var fetcher = (url) => fetch(url).then((res) => res.json());
|
|
4073
4113
|
var Hello = ({ user }) => {
|
|
@@ -4076,112 +4116,685 @@ var Hello = ({ user }) => {
|
|
|
4076
4116
|
fetcher
|
|
4077
4117
|
);
|
|
4078
4118
|
const name = (isLoading ? "..." : data?.name) || "User";
|
|
4079
|
-
return /* @__PURE__ */
|
|
4119
|
+
return /* @__PURE__ */ React57.createElement(React57.Fragment, null, /* @__PURE__ */ React57.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
|
|
4080
4120
|
};
|
|
4081
4121
|
|
|
4082
4122
|
// src/components/LinkedAccounts/LinkedAccounts.tsx
|
|
4083
|
-
import
|
|
4123
|
+
import React64 from "react";
|
|
4084
4124
|
|
|
4085
4125
|
// src/hooks/useLinkedAccounts/useLinkedAccounts.ts
|
|
4086
|
-
import
|
|
4126
|
+
import useSWR4 from "swr";
|
|
4087
4127
|
var MOCK_DATA = [
|
|
4088
4128
|
{
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4129
|
+
id: "1",
|
|
4130
|
+
external_account_name: "Citi Double Cash\xAE Card",
|
|
4131
|
+
external_account_number: "1234",
|
|
4132
|
+
latest_balance_timestamp: {
|
|
4133
|
+
external_account_external_id: "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq",
|
|
4134
|
+
external_account_source: "PLAID",
|
|
4135
|
+
balance: 435121,
|
|
4136
|
+
at: "2024-04-03T13:00:00Z",
|
|
4137
|
+
created_at: "2024-04-06T16:44:35.715458Z"
|
|
4138
|
+
},
|
|
4139
|
+
current_ledger_balance: 373717,
|
|
4140
|
+
institution: "Chase",
|
|
4141
|
+
institutionLogo: ""
|
|
4142
|
+
},
|
|
4143
|
+
{
|
|
4144
|
+
id: "2",
|
|
4145
|
+
external_account_name: "Citi Double Cash\xAE Card",
|
|
4146
|
+
external_account_number: "1234",
|
|
4147
|
+
latest_balance_timestamp: {
|
|
4148
|
+
external_account_external_id: "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq",
|
|
4149
|
+
external_account_source: "PLAID",
|
|
4150
|
+
balance: 435121,
|
|
4151
|
+
at: "2024-04-03T13:00:00Z",
|
|
4152
|
+
created_at: "2024-04-06T16:44:35.715458Z"
|
|
4153
|
+
},
|
|
4154
|
+
current_ledger_balance: 373717,
|
|
4155
|
+
institution: "Chase",
|
|
4156
|
+
institutionLogo: ""
|
|
4092
4157
|
},
|
|
4093
4158
|
{
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4159
|
+
id: "3",
|
|
4160
|
+
external_account_name: "Citi Double Cash\xAE Card",
|
|
4161
|
+
external_account_number: "1234",
|
|
4162
|
+
latest_balance_timestamp: {
|
|
4163
|
+
external_account_external_id: "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq",
|
|
4164
|
+
external_account_source: "PLAID",
|
|
4165
|
+
balance: 435121,
|
|
4166
|
+
at: "2024-04-03T13:00:00Z",
|
|
4167
|
+
created_at: "2024-04-06T16:44:35.715458Z"
|
|
4168
|
+
},
|
|
4169
|
+
current_ledger_balance: 373717,
|
|
4170
|
+
institution: "Chase",
|
|
4171
|
+
institutionLogo: ""
|
|
4097
4172
|
},
|
|
4098
4173
|
{
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4174
|
+
id: "4",
|
|
4175
|
+
external_account_name: "Citi Double Cash\xAE Card",
|
|
4176
|
+
external_account_number: "1234",
|
|
4177
|
+
latest_balance_timestamp: {
|
|
4178
|
+
external_account_external_id: "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq",
|
|
4179
|
+
external_account_source: "PLAID",
|
|
4180
|
+
balance: 435121,
|
|
4181
|
+
at: "2024-04-03T13:00:00Z",
|
|
4182
|
+
created_at: "2024-04-06T16:44:35.715458Z"
|
|
4183
|
+
},
|
|
4184
|
+
current_ledger_balance: 373717,
|
|
4185
|
+
institution: "Chase",
|
|
4186
|
+
institutionLogo: ""
|
|
4102
4187
|
}
|
|
4103
4188
|
];
|
|
4104
4189
|
var useLinkedAccounts = () => {
|
|
4105
4190
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
4106
|
-
const [isLoading, setIsLoading] = useState11(true);
|
|
4107
|
-
useEffect7(() => {
|
|
4108
|
-
const timer = setTimeout(() => {
|
|
4109
|
-
setIsLoading(false);
|
|
4110
|
-
}, 2e3);
|
|
4111
|
-
}, []);
|
|
4112
|
-
const responseData = { data: MOCK_DATA, meta: {}, error: void 0 };
|
|
4113
|
-
const isValidating = false;
|
|
4114
4191
|
const {
|
|
4115
|
-
data
|
|
4116
|
-
|
|
4117
|
-
|
|
4118
|
-
|
|
4192
|
+
// data: responseData,
|
|
4193
|
+
isLoading,
|
|
4194
|
+
isValidating,
|
|
4195
|
+
error: responseError,
|
|
4196
|
+
mutate
|
|
4197
|
+
} = useSWR4(
|
|
4198
|
+
businessId && auth?.access_token && `linked-accounts-${businessId}`,
|
|
4199
|
+
Layer.getLinkedAccounts(apiUrl, auth?.access_token, {
|
|
4200
|
+
params: { businessId }
|
|
4201
|
+
})
|
|
4202
|
+
);
|
|
4203
|
+
const responseData = { data: MOCK_DATA, meta: {}, error: void 0 };
|
|
4204
|
+
const addAccount = () => {
|
|
4205
|
+
console.log("add account...");
|
|
4206
|
+
};
|
|
4207
|
+
const unlinkAccount = () => {
|
|
4208
|
+
console.log("unlink account...");
|
|
4209
|
+
};
|
|
4210
|
+
const renewLinkAccount = () => {
|
|
4211
|
+
console.log("relink account...");
|
|
4212
|
+
};
|
|
4119
4213
|
const refetch = () => {
|
|
4120
4214
|
console.log("refetch...");
|
|
4121
4215
|
};
|
|
4122
4216
|
return {
|
|
4123
|
-
data,
|
|
4124
|
-
|
|
4217
|
+
// data: responseData?.data.external_accounts,
|
|
4218
|
+
data: responseData.data,
|
|
4125
4219
|
isLoading,
|
|
4126
4220
|
isValidating,
|
|
4127
|
-
error,
|
|
4128
|
-
refetch
|
|
4221
|
+
error: responseError,
|
|
4222
|
+
refetch,
|
|
4223
|
+
addAccount,
|
|
4224
|
+
unlinkAccount,
|
|
4225
|
+
renewLinkAccount
|
|
4129
4226
|
};
|
|
4130
4227
|
};
|
|
4131
4228
|
|
|
4132
|
-
// src/
|
|
4133
|
-
import
|
|
4134
|
-
var
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4229
|
+
// src/icons/PlusIcon.tsx
|
|
4230
|
+
import * as React58 from "react";
|
|
4231
|
+
var PlusIcon = ({ size = 14, ...props }) => /* @__PURE__ */ React58.createElement(
|
|
4232
|
+
"svg",
|
|
4233
|
+
{
|
|
4234
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4235
|
+
viewBox: "0 0 16 16",
|
|
4236
|
+
fill: "none",
|
|
4237
|
+
...props,
|
|
4238
|
+
width: size,
|
|
4239
|
+
height: size
|
|
4240
|
+
},
|
|
4241
|
+
/* @__PURE__ */ React58.createElement(
|
|
4242
|
+
"path",
|
|
4144
4243
|
{
|
|
4145
|
-
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4244
|
+
d: "M14.6667 8.49996C14.6667 4.81806 11.6819 1.83329 8.00004 1.83329C4.31814 1.83329 1.33337 4.81806 1.33337 8.49996C1.33337 12.1819 4.31814 15.1666 8.00004 15.1666C11.6819 15.1666 14.6667 12.1819 14.6667 8.49996Z",
|
|
4245
|
+
stroke: "currentColor",
|
|
4246
|
+
strokeLinecap: "round",
|
|
4247
|
+
strokeLinejoin: "round"
|
|
4248
|
+
}
|
|
4249
|
+
),
|
|
4250
|
+
/* @__PURE__ */ React58.createElement(
|
|
4251
|
+
"path",
|
|
4151
4252
|
{
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
isLoading: isValidating
|
|
4253
|
+
d: "M5.33337 8.5L10.6667 8.5",
|
|
4254
|
+
stroke: "currentColor",
|
|
4255
|
+
strokeLinecap: "round",
|
|
4256
|
+
strokeLinejoin: "round"
|
|
4157
4257
|
}
|
|
4158
|
-
)
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4258
|
+
),
|
|
4259
|
+
/* @__PURE__ */ React58.createElement(
|
|
4260
|
+
"path",
|
|
4261
|
+
{
|
|
4262
|
+
d: "M8 11.1666L8 5.83329",
|
|
4263
|
+
stroke: "currentColor",
|
|
4264
|
+
strokeLinecap: "round",
|
|
4265
|
+
strokeLinejoin: "round"
|
|
4266
|
+
}
|
|
4267
|
+
)
|
|
4268
|
+
);
|
|
4269
|
+
var PlusIcon_default = PlusIcon;
|
|
4163
4270
|
|
|
4164
|
-
// src/
|
|
4165
|
-
import
|
|
4271
|
+
// src/components/LinkedAccountOptions/LinkedAccountOptions.tsx
|
|
4272
|
+
import React61 from "react";
|
|
4166
4273
|
|
|
4167
|
-
// src/
|
|
4168
|
-
|
|
4169
|
-
|
|
4274
|
+
// src/icons/MoreVertical.tsx
|
|
4275
|
+
import React59 from "react";
|
|
4276
|
+
var MoreVertical = ({ size = 18, ...props }) => {
|
|
4277
|
+
return /* @__PURE__ */ React59.createElement(
|
|
4278
|
+
"svg",
|
|
4279
|
+
{
|
|
4280
|
+
viewBox: "0 0 16 14",
|
|
4281
|
+
fill: "none",
|
|
4282
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4283
|
+
...props,
|
|
4284
|
+
width: size,
|
|
4285
|
+
height: size
|
|
4286
|
+
},
|
|
4287
|
+
/* @__PURE__ */ React59.createElement(
|
|
4288
|
+
"path",
|
|
4289
|
+
{
|
|
4290
|
+
d: "M8.66659 8C8.66659 7.63181 8.36811 7.33333 7.99992 7.33333C7.63173 7.33333 7.33325 7.63181 7.33325 8C7.33325 8.36819 7.63173 8.66667 7.99992 8.66667C8.36811 8.66667 8.66659 8.36819 8.66659 8Z",
|
|
4291
|
+
fill: "currentColor",
|
|
4292
|
+
stroke: "currentColor",
|
|
4293
|
+
strokeLinecap: "round",
|
|
4294
|
+
strokeLinejoin: "round"
|
|
4295
|
+
}
|
|
4296
|
+
),
|
|
4297
|
+
/* @__PURE__ */ React59.createElement(
|
|
4298
|
+
"path",
|
|
4299
|
+
{
|
|
4300
|
+
d: "M8.66659 3.33333C8.66659 2.96514 8.36811 2.66667 7.99992 2.66667C7.63173 2.66667 7.33325 2.96514 7.33325 3.33333C7.33325 3.70152 7.63173 4 7.99992 4C8.36811 4 8.66659 3.70152 8.66659 3.33333Z",
|
|
4301
|
+
fill: "currentColor",
|
|
4302
|
+
stroke: "currentColor",
|
|
4303
|
+
strokeLinecap: "round",
|
|
4304
|
+
strokeLinejoin: "round"
|
|
4305
|
+
}
|
|
4306
|
+
),
|
|
4307
|
+
/* @__PURE__ */ React59.createElement(
|
|
4308
|
+
"path",
|
|
4309
|
+
{
|
|
4310
|
+
d: "M8.66659 12.6667C8.66659 12.2985 8.36811 12 7.99992 12C7.63173 12 7.33325 12.2985 7.33325 12.6667C7.33325 13.0349 7.63173 13.3333 7.99992 13.3333C8.36811 13.3333 8.66659 13.0349 8.66659 12.6667Z",
|
|
4311
|
+
fill: "currentColor",
|
|
4312
|
+
stroke: "currentColor",
|
|
4313
|
+
strokeLinecap: "round",
|
|
4314
|
+
strokeLinejoin: "round"
|
|
4315
|
+
}
|
|
4316
|
+
)
|
|
4317
|
+
);
|
|
4170
4318
|
};
|
|
4171
|
-
var
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4319
|
+
var MoreVertical_default = MoreVertical;
|
|
4320
|
+
|
|
4321
|
+
// src/components/HoverMenu/HoverMenu.tsx
|
|
4322
|
+
import React60, { useEffect as useEffect8, useRef as useRef12, useState as useState11 } from "react";
|
|
4323
|
+
import classNames22 from "classnames";
|
|
4324
|
+
var HoverMenu = ({ children, config }) => {
|
|
4325
|
+
const [openMenu, setOpenMenu] = useState11(false);
|
|
4326
|
+
const hoverMenuRef = useRef12(null);
|
|
4327
|
+
const hoverMenuClassName = classNames22(
|
|
4328
|
+
"Layer__hover-menu",
|
|
4329
|
+
openMenu && "--open"
|
|
4330
|
+
);
|
|
4331
|
+
useEffect8(() => {
|
|
4332
|
+
function handleClickOutside(event) {
|
|
4333
|
+
if (hoverMenuRef.current && !hoverMenuRef.current.contains(event.target)) {
|
|
4334
|
+
setOpenMenu(false);
|
|
4335
|
+
}
|
|
4336
|
+
}
|
|
4337
|
+
document.addEventListener("click", handleClickOutside);
|
|
4338
|
+
return () => {
|
|
4339
|
+
document.removeEventListener("click", handleClickOutside);
|
|
4340
|
+
};
|
|
4341
|
+
}, []);
|
|
4342
|
+
return /* @__PURE__ */ React60.createElement(
|
|
4343
|
+
"div",
|
|
4344
|
+
{
|
|
4345
|
+
className: hoverMenuClassName,
|
|
4346
|
+
ref: hoverMenuRef,
|
|
4347
|
+
onMouseLeave: () => setOpenMenu(false)
|
|
4348
|
+
},
|
|
4349
|
+
/* @__PURE__ */ React60.createElement(
|
|
4350
|
+
"div",
|
|
4351
|
+
{
|
|
4352
|
+
className: "Layer__hover-menu__children",
|
|
4353
|
+
role: "button",
|
|
4354
|
+
onMouseEnter: () => setOpenMenu(true),
|
|
4355
|
+
onClick: () => setOpenMenu(true)
|
|
4356
|
+
},
|
|
4357
|
+
children
|
|
4358
|
+
),
|
|
4359
|
+
/* @__PURE__ */ React60.createElement("div", { className: "Layer__hover-menu__list-wrapper" }, /* @__PURE__ */ React60.createElement("ul", { className: "Layer__hover-menu__list" }, config && config.length > 0 && config.map((item) => /* @__PURE__ */ React60.createElement(
|
|
4360
|
+
"li",
|
|
4361
|
+
{
|
|
4362
|
+
key: `hover-menu-${item.name}`,
|
|
4363
|
+
className: "Layer__hover-menu__list-item"
|
|
4364
|
+
},
|
|
4365
|
+
/* @__PURE__ */ React60.createElement(
|
|
4366
|
+
"button",
|
|
4367
|
+
{
|
|
4368
|
+
className: "Layer__hover-menu__list-item-button",
|
|
4369
|
+
onClick: () => item.action()
|
|
4370
|
+
},
|
|
4371
|
+
item.name
|
|
4372
|
+
)
|
|
4373
|
+
))))
|
|
4374
|
+
);
|
|
4375
|
+
};
|
|
4376
|
+
|
|
4377
|
+
// src/components/LinkedAccountOptions/LinkedAccountOptions.tsx
|
|
4378
|
+
var LinkedAccountOptions = ({
|
|
4379
|
+
children,
|
|
4380
|
+
config
|
|
4381
|
+
}) => {
|
|
4382
|
+
return /* @__PURE__ */ React61.createElement("div", { className: "Layer__linked-accounts__options" }, /* @__PURE__ */ React61.createElement("div", { className: "Layer__linked-accounts__options-overlay" }, /* @__PURE__ */ React61.createElement("div", { className: "Layer__linked-accounts__options-overlay-button" }, /* @__PURE__ */ React61.createElement(HoverMenu, { config }, /* @__PURE__ */ React61.createElement(MoreVertical_default, { size: 16 })))), children);
|
|
4383
|
+
};
|
|
4384
|
+
|
|
4385
|
+
// src/components/LinkedAccountThumb/LinkedAccountThumb.tsx
|
|
4386
|
+
import React63 from "react";
|
|
4387
|
+
|
|
4388
|
+
// src/icons/InstitutionIcon.tsx
|
|
4389
|
+
import * as React62 from "react";
|
|
4390
|
+
var InstitutionIcon = ({ size = 18, ...props }) => /* @__PURE__ */ React62.createElement(
|
|
4391
|
+
"svg",
|
|
4392
|
+
{
|
|
4393
|
+
viewBox: "0 0 27 28",
|
|
4394
|
+
fill: "none",
|
|
4395
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4396
|
+
...props,
|
|
4397
|
+
width: size,
|
|
4398
|
+
height: size
|
|
4399
|
+
},
|
|
4400
|
+
/* @__PURE__ */ React62.createElement("g", { filter: "url(#filter0_i_2320_122784)" }, /* @__PURE__ */ React62.createElement(
|
|
4401
|
+
"path",
|
|
4402
|
+
{
|
|
4403
|
+
d: "M0 8.50225C0 8.13268 0.20383 7.79324 0.530047 7.61956L13.03 0.964441C13.3238 0.80803 13.6762 0.808029 13.97 0.964441L26.47 7.61956C26.7962 7.79324 27 8.13268 27 8.50225V9.71423C27 10.2665 26.5523 10.7142 26 10.7142H0.999999C0.447715 10.7142 0 10.2665 0 9.71423V8.50225Z",
|
|
4404
|
+
fill: "currentColor"
|
|
4405
|
+
}
|
|
4406
|
+
)),
|
|
4407
|
+
/* @__PURE__ */ React62.createElement("g", { filter: "url(#filter1_i_2320_122784)" }, /* @__PURE__ */ React62.createElement(
|
|
4408
|
+
"path",
|
|
4409
|
+
{
|
|
4410
|
+
d: "M3 13C3 12.4477 3.44772 12 4 12H7C7.55228 12 8 12.4477 8 13V20C8 20.5523 7.55228 21 7 21H4C3.44772 21 3 20.5523 3 20L3 13Z",
|
|
4411
|
+
fill: "currentColor"
|
|
4412
|
+
}
|
|
4413
|
+
)),
|
|
4414
|
+
/* @__PURE__ */ React62.createElement("g", { filter: "url(#filter2_i_2320_122784)" }, /* @__PURE__ */ React62.createElement(
|
|
4415
|
+
"path",
|
|
4416
|
+
{
|
|
4417
|
+
d: "M11 13C11 12.4477 11.4477 12 12 12H15C15.5523 12 16 12.4477 16 13V20C16 20.5523 15.5523 21 15 21H12C11.4477 21 11 20.5523 11 20L11 13Z",
|
|
4418
|
+
fill: "currentColor"
|
|
4419
|
+
}
|
|
4420
|
+
)),
|
|
4421
|
+
/* @__PURE__ */ React62.createElement("g", { filter: "url(#filter3_i_2320_122784)" }, /* @__PURE__ */ React62.createElement(
|
|
4422
|
+
"path",
|
|
4423
|
+
{
|
|
4424
|
+
d: "M19 13C19 12.4477 19.4477 12 20 12H23C23.5523 12 24 12.4477 24 13V20C24 20.5523 23.5523 21 23 21H20C19.4477 21 19 20.5523 19 20L19 13Z",
|
|
4425
|
+
fill: "currentColor"
|
|
4426
|
+
}
|
|
4427
|
+
)),
|
|
4428
|
+
/* @__PURE__ */ React62.createElement("g", { filter: "url(#filter4_i_2320_122784)" }, /* @__PURE__ */ React62.createElement(
|
|
4429
|
+
"path",
|
|
4430
|
+
{
|
|
4431
|
+
d: "M1 23.2856C1 22.7334 1.44772 22.2856 2 22.2856H25C25.5523 22.2856 26 22.7334 26 23.2856V26.2856C26 26.8379 25.5523 27.2856 25 27.2856H2C1.44772 27.2856 1 26.8379 1 26.2856L1 23.2856Z",
|
|
4432
|
+
fill: "currentColor"
|
|
4433
|
+
}
|
|
4434
|
+
)),
|
|
4435
|
+
/* @__PURE__ */ React62.createElement("defs", null, /* @__PURE__ */ React62.createElement(
|
|
4436
|
+
"filter",
|
|
4437
|
+
{
|
|
4438
|
+
id: "filter0_i_2320_122784",
|
|
4439
|
+
x: "0",
|
|
4440
|
+
y: "0.847168",
|
|
4441
|
+
width: "27",
|
|
4442
|
+
height: "9.86707",
|
|
4443
|
+
filterUnits: "userSpaceOnUse",
|
|
4444
|
+
colorInterpolationFilters: "sRGB"
|
|
4445
|
+
},
|
|
4446
|
+
/* @__PURE__ */ React62.createElement("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
4447
|
+
/* @__PURE__ */ React62.createElement(
|
|
4448
|
+
"feBlend",
|
|
4449
|
+
{
|
|
4450
|
+
mode: "normal",
|
|
4451
|
+
in: "SourceGraphic",
|
|
4452
|
+
in2: "BackgroundImageFix",
|
|
4453
|
+
result: "shape"
|
|
4454
|
+
}
|
|
4455
|
+
),
|
|
4456
|
+
/* @__PURE__ */ React62.createElement(
|
|
4457
|
+
"feColorMatrix",
|
|
4458
|
+
{
|
|
4459
|
+
in: "SourceAlpha",
|
|
4460
|
+
type: "matrix",
|
|
4461
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
4462
|
+
result: "hardAlpha"
|
|
4463
|
+
}
|
|
4464
|
+
),
|
|
4465
|
+
/* @__PURE__ */ React62.createElement("feOffset", null),
|
|
4466
|
+
/* @__PURE__ */ React62.createElement("feGaussianBlur", { stdDeviation: "0.5" }),
|
|
4467
|
+
/* @__PURE__ */ React62.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
4468
|
+
/* @__PURE__ */ React62.createElement(
|
|
4469
|
+
"feColorMatrix",
|
|
4470
|
+
{
|
|
4471
|
+
type: "matrix",
|
|
4472
|
+
values: "0 0 0 0 0.0627451 0 0 0 0 0.0941176 0 0 0 0 0.156863 0 0 0 0.04 0"
|
|
4473
|
+
}
|
|
4474
|
+
),
|
|
4475
|
+
/* @__PURE__ */ React62.createElement(
|
|
4476
|
+
"feBlend",
|
|
4477
|
+
{
|
|
4478
|
+
mode: "normal",
|
|
4479
|
+
in2: "shape",
|
|
4480
|
+
result: "effect1_innerShadow_2320_122784"
|
|
4481
|
+
}
|
|
4482
|
+
)
|
|
4483
|
+
), /* @__PURE__ */ React62.createElement(
|
|
4484
|
+
"filter",
|
|
4485
|
+
{
|
|
4486
|
+
id: "filter1_i_2320_122784",
|
|
4487
|
+
x: "3",
|
|
4488
|
+
y: "12",
|
|
4489
|
+
width: "5",
|
|
4490
|
+
height: "9",
|
|
4491
|
+
filterUnits: "userSpaceOnUse",
|
|
4492
|
+
colorInterpolationFilters: "sRGB"
|
|
4493
|
+
},
|
|
4494
|
+
/* @__PURE__ */ React62.createElement("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
4495
|
+
/* @__PURE__ */ React62.createElement(
|
|
4496
|
+
"feBlend",
|
|
4497
|
+
{
|
|
4498
|
+
mode: "normal",
|
|
4499
|
+
in: "SourceGraphic",
|
|
4500
|
+
in2: "BackgroundImageFix",
|
|
4501
|
+
result: "shape"
|
|
4502
|
+
}
|
|
4503
|
+
),
|
|
4504
|
+
/* @__PURE__ */ React62.createElement(
|
|
4505
|
+
"feColorMatrix",
|
|
4506
|
+
{
|
|
4507
|
+
in: "SourceAlpha",
|
|
4508
|
+
type: "matrix",
|
|
4509
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
4510
|
+
result: "hardAlpha"
|
|
4511
|
+
}
|
|
4512
|
+
),
|
|
4513
|
+
/* @__PURE__ */ React62.createElement("feOffset", null),
|
|
4514
|
+
/* @__PURE__ */ React62.createElement("feGaussianBlur", { stdDeviation: "0.5" }),
|
|
4515
|
+
/* @__PURE__ */ React62.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
4516
|
+
/* @__PURE__ */ React62.createElement(
|
|
4517
|
+
"feColorMatrix",
|
|
4518
|
+
{
|
|
4519
|
+
type: "matrix",
|
|
4520
|
+
values: "0 0 0 0 0.0627451 0 0 0 0 0.0941176 0 0 0 0 0.156863 0 0 0 0.04 0"
|
|
4521
|
+
}
|
|
4522
|
+
),
|
|
4523
|
+
/* @__PURE__ */ React62.createElement(
|
|
4524
|
+
"feBlend",
|
|
4525
|
+
{
|
|
4526
|
+
mode: "normal",
|
|
4527
|
+
in2: "shape",
|
|
4528
|
+
result: "effect1_innerShadow_2320_122784"
|
|
4529
|
+
}
|
|
4530
|
+
)
|
|
4531
|
+
), /* @__PURE__ */ React62.createElement(
|
|
4532
|
+
"filter",
|
|
4533
|
+
{
|
|
4534
|
+
id: "filter2_i_2320_122784",
|
|
4535
|
+
x: "11",
|
|
4536
|
+
y: "12",
|
|
4537
|
+
width: "5",
|
|
4538
|
+
height: "9",
|
|
4539
|
+
filterUnits: "userSpaceOnUse",
|
|
4540
|
+
colorInterpolationFilters: "sRGB"
|
|
4541
|
+
},
|
|
4542
|
+
/* @__PURE__ */ React62.createElement("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
4543
|
+
/* @__PURE__ */ React62.createElement(
|
|
4544
|
+
"feBlend",
|
|
4545
|
+
{
|
|
4546
|
+
mode: "normal",
|
|
4547
|
+
in: "SourceGraphic",
|
|
4548
|
+
in2: "BackgroundImageFix",
|
|
4549
|
+
result: "shape"
|
|
4550
|
+
}
|
|
4551
|
+
),
|
|
4552
|
+
/* @__PURE__ */ React62.createElement(
|
|
4553
|
+
"feColorMatrix",
|
|
4554
|
+
{
|
|
4555
|
+
in: "SourceAlpha",
|
|
4556
|
+
type: "matrix",
|
|
4557
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
4558
|
+
result: "hardAlpha"
|
|
4559
|
+
}
|
|
4560
|
+
),
|
|
4561
|
+
/* @__PURE__ */ React62.createElement("feOffset", null),
|
|
4562
|
+
/* @__PURE__ */ React62.createElement("feGaussianBlur", { stdDeviation: "0.5" }),
|
|
4563
|
+
/* @__PURE__ */ React62.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
4564
|
+
/* @__PURE__ */ React62.createElement(
|
|
4565
|
+
"feColorMatrix",
|
|
4566
|
+
{
|
|
4567
|
+
type: "matrix",
|
|
4568
|
+
values: "0 0 0 0 0.0627451 0 0 0 0 0.0941176 0 0 0 0 0.156863 0 0 0 0.04 0"
|
|
4569
|
+
}
|
|
4570
|
+
),
|
|
4571
|
+
/* @__PURE__ */ React62.createElement(
|
|
4572
|
+
"feBlend",
|
|
4573
|
+
{
|
|
4574
|
+
mode: "normal",
|
|
4575
|
+
in2: "shape",
|
|
4576
|
+
result: "effect1_innerShadow_2320_122784"
|
|
4577
|
+
}
|
|
4578
|
+
)
|
|
4579
|
+
), /* @__PURE__ */ React62.createElement(
|
|
4580
|
+
"filter",
|
|
4581
|
+
{
|
|
4582
|
+
id: "filter3_i_2320_122784",
|
|
4583
|
+
x: "19",
|
|
4584
|
+
y: "12",
|
|
4585
|
+
width: "5",
|
|
4586
|
+
height: "9",
|
|
4587
|
+
filterUnits: "userSpaceOnUse",
|
|
4588
|
+
colorInterpolationFilters: "sRGB"
|
|
4589
|
+
},
|
|
4590
|
+
/* @__PURE__ */ React62.createElement("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
4591
|
+
/* @__PURE__ */ React62.createElement(
|
|
4592
|
+
"feBlend",
|
|
4593
|
+
{
|
|
4594
|
+
mode: "normal",
|
|
4595
|
+
in: "SourceGraphic",
|
|
4596
|
+
in2: "BackgroundImageFix",
|
|
4597
|
+
result: "shape"
|
|
4598
|
+
}
|
|
4599
|
+
),
|
|
4600
|
+
/* @__PURE__ */ React62.createElement(
|
|
4601
|
+
"feColorMatrix",
|
|
4602
|
+
{
|
|
4603
|
+
in: "SourceAlpha",
|
|
4604
|
+
type: "matrix",
|
|
4605
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
4606
|
+
result: "hardAlpha"
|
|
4607
|
+
}
|
|
4608
|
+
),
|
|
4609
|
+
/* @__PURE__ */ React62.createElement("feOffset", null),
|
|
4610
|
+
/* @__PURE__ */ React62.createElement("feGaussianBlur", { stdDeviation: "0.5" }),
|
|
4611
|
+
/* @__PURE__ */ React62.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
4612
|
+
/* @__PURE__ */ React62.createElement(
|
|
4613
|
+
"feColorMatrix",
|
|
4614
|
+
{
|
|
4615
|
+
type: "matrix",
|
|
4616
|
+
values: "0 0 0 0 0.0627451 0 0 0 0 0.0941176 0 0 0 0 0.156863 0 0 0 0.04 0"
|
|
4617
|
+
}
|
|
4618
|
+
),
|
|
4619
|
+
/* @__PURE__ */ React62.createElement(
|
|
4620
|
+
"feBlend",
|
|
4621
|
+
{
|
|
4622
|
+
mode: "normal",
|
|
4623
|
+
in2: "shape",
|
|
4624
|
+
result: "effect1_innerShadow_2320_122784"
|
|
4625
|
+
}
|
|
4626
|
+
)
|
|
4627
|
+
), /* @__PURE__ */ React62.createElement(
|
|
4628
|
+
"filter",
|
|
4629
|
+
{
|
|
4630
|
+
id: "filter4_i_2320_122784",
|
|
4631
|
+
x: "1",
|
|
4632
|
+
y: "22.2856",
|
|
4633
|
+
width: "25",
|
|
4634
|
+
height: "5",
|
|
4635
|
+
filterUnits: "userSpaceOnUse",
|
|
4636
|
+
colorInterpolationFilters: "sRGB"
|
|
4637
|
+
},
|
|
4638
|
+
/* @__PURE__ */ React62.createElement("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
4639
|
+
/* @__PURE__ */ React62.createElement(
|
|
4640
|
+
"feBlend",
|
|
4641
|
+
{
|
|
4642
|
+
mode: "normal",
|
|
4643
|
+
in: "SourceGraphic",
|
|
4644
|
+
in2: "BackgroundImageFix",
|
|
4645
|
+
result: "shape"
|
|
4646
|
+
}
|
|
4647
|
+
),
|
|
4648
|
+
/* @__PURE__ */ React62.createElement(
|
|
4649
|
+
"feColorMatrix",
|
|
4650
|
+
{
|
|
4651
|
+
in: "SourceAlpha",
|
|
4652
|
+
type: "matrix",
|
|
4653
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
4654
|
+
result: "hardAlpha"
|
|
4655
|
+
}
|
|
4656
|
+
),
|
|
4657
|
+
/* @__PURE__ */ React62.createElement("feOffset", null),
|
|
4658
|
+
/* @__PURE__ */ React62.createElement("feGaussianBlur", { stdDeviation: "0.5" }),
|
|
4659
|
+
/* @__PURE__ */ React62.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
4660
|
+
/* @__PURE__ */ React62.createElement(
|
|
4661
|
+
"feColorMatrix",
|
|
4662
|
+
{
|
|
4663
|
+
type: "matrix",
|
|
4664
|
+
values: "0 0 0 0 0.0627451 0 0 0 0 0.0941176 0 0 0 0 0.156863 0 0 0 0.04 0"
|
|
4665
|
+
}
|
|
4666
|
+
),
|
|
4667
|
+
/* @__PURE__ */ React62.createElement(
|
|
4668
|
+
"feBlend",
|
|
4669
|
+
{
|
|
4670
|
+
mode: "normal",
|
|
4671
|
+
in2: "shape",
|
|
4672
|
+
result: "effect1_innerShadow_2320_122784"
|
|
4673
|
+
}
|
|
4674
|
+
)
|
|
4675
|
+
))
|
|
4676
|
+
);
|
|
4677
|
+
var InstitutionIcon_default = InstitutionIcon;
|
|
4678
|
+
|
|
4679
|
+
// src/components/LinkedAccountThumb/LinkedAccountThumb.tsx
|
|
4680
|
+
import classNames23 from "classnames";
|
|
4681
|
+
var AccountNumber = ({ accountNumber }) => /* @__PURE__ */ React63.createElement("div", { className: "account-number" }, /* @__PURE__ */ React63.createElement(Text, { size: "sm" }, "\u2022\u2022\u2022", accountNumber));
|
|
4682
|
+
var LinkedAccountThumb = ({
|
|
4683
|
+
account,
|
|
4684
|
+
asWidget
|
|
4685
|
+
}) => {
|
|
4686
|
+
const linkedAccountThumbClassName = classNames23(
|
|
4687
|
+
"Layer__linked-account-thumb",
|
|
4688
|
+
asWidget && "--as-widget"
|
|
4689
|
+
);
|
|
4690
|
+
return /* @__PURE__ */ React63.createElement("div", { className: linkedAccountThumbClassName }, /* @__PURE__ */ React63.createElement("div", { className: "topbar" }, /* @__PURE__ */ React63.createElement("div", { className: "topbar-details" }, /* @__PURE__ */ React63.createElement(Text, { as: "span", className: "account-name" }, account.external_account_name), !asWidget && /* @__PURE__ */ React63.createElement(AccountNumber, { accountNumber: account.external_account_number }), /* @__PURE__ */ React63.createElement(
|
|
4691
|
+
Text,
|
|
4692
|
+
{
|
|
4693
|
+
as: "span",
|
|
4694
|
+
className: "account-institution",
|
|
4695
|
+
size: "sm"
|
|
4696
|
+
},
|
|
4697
|
+
account.institution
|
|
4698
|
+
)), /* @__PURE__ */ React63.createElement("div", { className: "topbar-logo" }, !account.institutionLogo && /* @__PURE__ */ React63.createElement(InstitutionIcon_default, null))), !asWidget && /* @__PURE__ */ React63.createElement("div", { className: "middlebar" }, /* @__PURE__ */ React63.createElement(
|
|
4699
|
+
Text,
|
|
4700
|
+
{
|
|
4701
|
+
as: "span",
|
|
4702
|
+
className: "account-balance-text",
|
|
4703
|
+
size: "sm"
|
|
4704
|
+
},
|
|
4705
|
+
"Bank balance"
|
|
4706
|
+
), /* @__PURE__ */ React63.createElement(Text, { as: "span", className: "account-balance" }, "$", centsToDollars(account.latest_balance_timestamp.balance))), /* @__PURE__ */ React63.createElement("div", { className: "bottombar" }, asWidget ? /* @__PURE__ */ React63.createElement(AccountNumber, { accountNumber: account.external_account_number }) : /* @__PURE__ */ React63.createElement(
|
|
4707
|
+
Text,
|
|
4708
|
+
{
|
|
4709
|
+
as: "span",
|
|
4710
|
+
className: "account-balance-text",
|
|
4711
|
+
size: "sm"
|
|
4712
|
+
},
|
|
4713
|
+
"General ledger balance"
|
|
4714
|
+
), /* @__PURE__ */ React63.createElement(Text, { as: "span", className: "account-balance" }, "$", centsToDollars(account.current_ledger_balance))));
|
|
4715
|
+
};
|
|
4716
|
+
|
|
4717
|
+
// src/components/LinkedAccounts/LinkedAccounts.tsx
|
|
4718
|
+
import classNames24 from "classnames";
|
|
4719
|
+
var COMPONENT_NAME2 = "linked-accounts";
|
|
4720
|
+
var LinkedAccounts = ({ asWidget }) => {
|
|
4721
|
+
const {
|
|
4722
|
+
data,
|
|
4723
|
+
isLoading,
|
|
4724
|
+
error,
|
|
4725
|
+
isValidating,
|
|
4726
|
+
refetch,
|
|
4727
|
+
addAccount,
|
|
4728
|
+
unlinkAccount,
|
|
4729
|
+
renewLinkAccount
|
|
4730
|
+
} = useLinkedAccounts();
|
|
4731
|
+
const linkedAccountOptionsConfig = [
|
|
4732
|
+
{ name: "Renew link", action: renewLinkAccount },
|
|
4733
|
+
{ name: "Unlink", action: unlinkAccount }
|
|
4734
|
+
];
|
|
4735
|
+
const linkedAccountsNewAccountClassName = classNames24(
|
|
4736
|
+
"Layer__linked-accounts__new-account",
|
|
4737
|
+
asWidget && "--as-widget"
|
|
4738
|
+
);
|
|
4739
|
+
return /* @__PURE__ */ React64.createElement(Container, { name: COMPONENT_NAME2 }, /* @__PURE__ */ React64.createElement(Header, { className: "Layer__linked-accounts__header" }, /* @__PURE__ */ React64.createElement(
|
|
4740
|
+
Heading,
|
|
4741
|
+
{
|
|
4742
|
+
className: "Layer__linked-accounts__title",
|
|
4743
|
+
size: "secondary" /* secondary */
|
|
4744
|
+
},
|
|
4745
|
+
"Linked Accounts"
|
|
4746
|
+
)), isLoading && /* @__PURE__ */ React64.createElement("div", { className: "Layer__linked-accounts__loader-container" }, /* @__PURE__ */ React64.createElement(Loader2, null)), error && !isLoading ? /* @__PURE__ */ React64.createElement(
|
|
4747
|
+
DataState,
|
|
4748
|
+
{
|
|
4749
|
+
status: "failed" /* failed */,
|
|
4750
|
+
title: "Something went wrong",
|
|
4751
|
+
description: "We couldn\u2019t load your data.",
|
|
4752
|
+
onRefresh: () => refetch(),
|
|
4753
|
+
isLoading: isValidating
|
|
4754
|
+
}
|
|
4755
|
+
) : null, !error && !isLoading ? /* @__PURE__ */ React64.createElement("div", { className: "Layer__linked-accounts__list" }, data?.map((account, index) => /* @__PURE__ */ React64.createElement(
|
|
4756
|
+
LinkedAccountOptions,
|
|
4757
|
+
{
|
|
4758
|
+
key: `linked-acc-${index}`,
|
|
4759
|
+
config: linkedAccountOptionsConfig
|
|
4760
|
+
},
|
|
4761
|
+
/* @__PURE__ */ React64.createElement(LinkedAccountThumb, { account, asWidget })
|
|
4762
|
+
)), /* @__PURE__ */ React64.createElement(
|
|
4763
|
+
"div",
|
|
4764
|
+
{
|
|
4765
|
+
role: "button",
|
|
4766
|
+
tabIndex: 0,
|
|
4767
|
+
"aria-label": "new-account",
|
|
4768
|
+
onClick: () => addAccount(),
|
|
4769
|
+
className: linkedAccountsNewAccountClassName
|
|
4770
|
+
},
|
|
4771
|
+
/* @__PURE__ */ React64.createElement("div", { className: "Layer__linked-accounts__new-account-label" }, /* @__PURE__ */ React64.createElement(PlusIcon_default, { size: 15 }), /* @__PURE__ */ React64.createElement(Text, { as: "span", size: "sm" }, "New account"))
|
|
4772
|
+
)) : null);
|
|
4773
|
+
};
|
|
4774
|
+
|
|
4775
|
+
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
4776
|
+
import React74, { createContext as createContext2 } from "react";
|
|
4777
|
+
|
|
4778
|
+
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
4779
|
+
import { useMemo as useMemo3, useState as useState12 } from "react";
|
|
4780
|
+
|
|
4781
|
+
// src/utils/profitAndLossUtils.ts
|
|
4782
|
+
var doesLineItemQualifies = (item) => {
|
|
4783
|
+
return !(item.is_contra || item.value === void 0 || item.value === null || isNaN(item.value) || item.value === -Infinity || item.value === Infinity || item.value < 0);
|
|
4784
|
+
};
|
|
4785
|
+
var collectSubItems = (type, item) => {
|
|
4786
|
+
if (!item) {
|
|
4787
|
+
return [];
|
|
4788
|
+
}
|
|
4789
|
+
const items = [];
|
|
4790
|
+
item?.line_items?.forEach((item2) => {
|
|
4791
|
+
if (doesLineItemQualifies(item2)) {
|
|
4792
|
+
items.push({
|
|
4793
|
+
name: item2.name,
|
|
4794
|
+
display_name: item2.display_name,
|
|
4795
|
+
value: item2.value || 0,
|
|
4796
|
+
type
|
|
4797
|
+
});
|
|
4185
4798
|
}
|
|
4186
4799
|
});
|
|
4187
4800
|
return items;
|
|
@@ -4220,7 +4833,7 @@ var applyShare = (items, total) => {
|
|
|
4220
4833
|
|
|
4221
4834
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
4222
4835
|
import { startOfMonth, endOfMonth, formatISO } from "date-fns";
|
|
4223
|
-
import
|
|
4836
|
+
import useSWR5 from "swr";
|
|
4224
4837
|
var useProfitAndLoss = ({
|
|
4225
4838
|
startDate: initialStartDate,
|
|
4226
4839
|
endDate: initialEndDate,
|
|
@@ -4248,7 +4861,7 @@ var useProfitAndLoss = ({
|
|
|
4248
4861
|
isValidating,
|
|
4249
4862
|
error: rawError,
|
|
4250
4863
|
mutate
|
|
4251
|
-
} =
|
|
4864
|
+
} = useSWR5(
|
|
4252
4865
|
businessId && startDate && endDate && auth?.access_token && `profit-and-loss-${businessId}-${startDate.valueOf()}-${endDate.valueOf()}-${tagFilter?.key}-${tagFilter?.values?.join(
|
|
4253
4866
|
","
|
|
4254
4867
|
)}-${reportingBasis}`,
|
|
@@ -4349,7 +4962,7 @@ var useProfitAndLoss = ({
|
|
|
4349
4962
|
};
|
|
4350
4963
|
|
|
4351
4964
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
4352
|
-
import
|
|
4965
|
+
import React66, { useContext as useContext2, useMemo as useMemo4, useState as useState13 } from "react";
|
|
4353
4966
|
|
|
4354
4967
|
// src/utils/format.ts
|
|
4355
4968
|
var capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
@@ -4387,7 +5000,7 @@ var formatPercent = (value, options) => {
|
|
|
4387
5000
|
};
|
|
4388
5001
|
|
|
4389
5002
|
// src/components/ProfitAndLossChart/Indicator.tsx
|
|
4390
|
-
import
|
|
5003
|
+
import React65, { useEffect as useEffect9 } from "react";
|
|
4391
5004
|
var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
|
|
4392
5005
|
var Indicator = ({
|
|
4393
5006
|
viewBox = {},
|
|
@@ -4404,11 +5017,11 @@ var Indicator = ({
|
|
|
4404
5017
|
const multiplier = width > 12 ? 1.2 : 1;
|
|
4405
5018
|
const xOffset = (boxWidth * multiplier - boxWidth) / 2;
|
|
4406
5019
|
const borderRadius = width > 16 ? 8 : width / 2;
|
|
4407
|
-
|
|
5020
|
+
useEffect9(() => {
|
|
4408
5021
|
setAnimateFrom(animateTo);
|
|
4409
5022
|
}, [animateTo]);
|
|
4410
5023
|
const actualX = animateFrom === -1 ? animateTo : animateFrom;
|
|
4411
|
-
return /* @__PURE__ */
|
|
5024
|
+
return /* @__PURE__ */ React65.createElement(
|
|
4412
5025
|
"rect",
|
|
4413
5026
|
{
|
|
4414
5027
|
className: "Layer__profit-and-loss-chart__selection-indicator",
|
|
@@ -4546,13 +5159,13 @@ var ProfitAndLossChart = () => {
|
|
|
4546
5159
|
if (active && payload && payload.length) {
|
|
4547
5160
|
const netProfit = payload[0].payload.netProfit ?? 0;
|
|
4548
5161
|
const netProfitClass = netProfit > 0 ? "positive" : netProfit < 0 ? "negative" : "";
|
|
4549
|
-
return /* @__PURE__ */
|
|
5162
|
+
return /* @__PURE__ */ React66.createElement("div", { className: "Layer__chart__tooltip" }, /* @__PURE__ */ React66.createElement("ul", { className: "Layer__chart__tooltip-list" }, /* @__PURE__ */ React66.createElement("li", null, /* @__PURE__ */ React66.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[0].name ?? "")), /* @__PURE__ */ React66.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[0].value ?? 0)))), /* @__PURE__ */ React66.createElement("li", null, /* @__PURE__ */ React66.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[1].name ?? "")), /* @__PURE__ */ React66.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[1].value ?? 0)))), /* @__PURE__ */ React66.createElement("li", null, /* @__PURE__ */ React66.createElement("label", { className: "Layer__chart__tooltip-label" }, "Net Profit"), /* @__PURE__ */ React66.createElement("span", { className: `Layer__chart__tooltip-value ${netProfitClass}` }, "$", centsToDollars(netProfit)))));
|
|
4550
5163
|
}
|
|
4551
5164
|
return null;
|
|
4552
5165
|
};
|
|
4553
5166
|
const CustomizedCursor = (props) => {
|
|
4554
5167
|
const { x, width, height } = props;
|
|
4555
|
-
return /* @__PURE__ */
|
|
5168
|
+
return /* @__PURE__ */ React66.createElement(
|
|
4556
5169
|
Rectangle,
|
|
4557
5170
|
{
|
|
4558
5171
|
fill: getColor(900)?.hex ?? "#333",
|
|
@@ -4575,7 +5188,7 @@ var ProfitAndLossChart = () => {
|
|
|
4575
5188
|
]
|
|
4576
5189
|
);
|
|
4577
5190
|
const [animateFrom, setAnimateFrom] = useState13(-1);
|
|
4578
|
-
return /* @__PURE__ */
|
|
5191
|
+
return /* @__PURE__ */ React66.createElement(
|
|
4579
5192
|
ResponsiveContainer,
|
|
4580
5193
|
{
|
|
4581
5194
|
className: "Layer__chart-container",
|
|
@@ -4583,7 +5196,7 @@ var ProfitAndLossChart = () => {
|
|
|
4583
5196
|
height: "100%",
|
|
4584
5197
|
minHeight: 200
|
|
4585
5198
|
},
|
|
4586
|
-
/* @__PURE__ */
|
|
5199
|
+
/* @__PURE__ */ React66.createElement(
|
|
4587
5200
|
BarChart,
|
|
4588
5201
|
{
|
|
4589
5202
|
margin: { left: 12, right: 12, bottom: 12 },
|
|
@@ -4592,17 +5205,17 @@ var ProfitAndLossChart = () => {
|
|
|
4592
5205
|
barGap,
|
|
4593
5206
|
className: "Layer__profit-and-loss-chart"
|
|
4594
5207
|
},
|
|
4595
|
-
/* @__PURE__ */
|
|
5208
|
+
/* @__PURE__ */ React66.createElement(
|
|
4596
5209
|
Tooltip2,
|
|
4597
5210
|
{
|
|
4598
5211
|
wrapperClassName: "Layer__chart__tooltip-wrapper",
|
|
4599
|
-
content: /* @__PURE__ */
|
|
4600
|
-
cursor: /* @__PURE__ */
|
|
5212
|
+
content: /* @__PURE__ */ React66.createElement(CustomTooltip, null),
|
|
5213
|
+
cursor: /* @__PURE__ */ React66.createElement(CustomizedCursor, null),
|
|
4601
5214
|
animationDuration: 100,
|
|
4602
5215
|
animationEasing: "ease-out"
|
|
4603
5216
|
}
|
|
4604
5217
|
),
|
|
4605
|
-
/* @__PURE__ */
|
|
5218
|
+
/* @__PURE__ */ React66.createElement(
|
|
4606
5219
|
CartesianGrid,
|
|
4607
5220
|
{
|
|
4608
5221
|
vertical: false,
|
|
@@ -4610,7 +5223,7 @@ var ProfitAndLossChart = () => {
|
|
|
4610
5223
|
strokeDasharray: "5 5"
|
|
4611
5224
|
}
|
|
4612
5225
|
),
|
|
4613
|
-
/* @__PURE__ */
|
|
5226
|
+
/* @__PURE__ */ React66.createElement(
|
|
4614
5227
|
Legend,
|
|
4615
5228
|
{
|
|
4616
5229
|
verticalAlign: "top",
|
|
@@ -4630,8 +5243,8 @@ var ProfitAndLossChart = () => {
|
|
|
4630
5243
|
]
|
|
4631
5244
|
}
|
|
4632
5245
|
),
|
|
4633
|
-
/* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
5246
|
+
/* @__PURE__ */ React66.createElement(XAxis, { dataKey: "name", tickLine: false }),
|
|
5247
|
+
/* @__PURE__ */ React66.createElement(
|
|
4635
5248
|
Bar,
|
|
4636
5249
|
{
|
|
4637
5250
|
dataKey: "revenue",
|
|
@@ -4640,10 +5253,10 @@ var ProfitAndLossChart = () => {
|
|
|
4640
5253
|
radius: [2, 2, 0, 0],
|
|
4641
5254
|
className: "Layer__profit-and-loss-chart__bar--income"
|
|
4642
5255
|
},
|
|
4643
|
-
/* @__PURE__ */
|
|
5256
|
+
/* @__PURE__ */ React66.createElement(
|
|
4644
5257
|
LabelList,
|
|
4645
5258
|
{
|
|
4646
|
-
content: /* @__PURE__ */
|
|
5259
|
+
content: /* @__PURE__ */ React66.createElement(
|
|
4647
5260
|
Indicator,
|
|
4648
5261
|
{
|
|
4649
5262
|
animateFrom,
|
|
@@ -4652,7 +5265,7 @@ var ProfitAndLossChart = () => {
|
|
|
4652
5265
|
)
|
|
4653
5266
|
}
|
|
4654
5267
|
),
|
|
4655
|
-
data.map((entry) => /* @__PURE__ */
|
|
5268
|
+
data.map((entry) => /* @__PURE__ */ React66.createElement(
|
|
4656
5269
|
Cell,
|
|
4657
5270
|
{
|
|
4658
5271
|
key: entry.name,
|
|
@@ -4660,7 +5273,7 @@ var ProfitAndLossChart = () => {
|
|
|
4660
5273
|
}
|
|
4661
5274
|
))
|
|
4662
5275
|
),
|
|
4663
|
-
/* @__PURE__ */
|
|
5276
|
+
/* @__PURE__ */ React66.createElement(
|
|
4664
5277
|
Bar,
|
|
4665
5278
|
{
|
|
4666
5279
|
dataKey: "expenses",
|
|
@@ -4669,7 +5282,7 @@ var ProfitAndLossChart = () => {
|
|
|
4669
5282
|
radius: [2, 2, 0, 0],
|
|
4670
5283
|
className: "Layer__profit-and-loss-chart__bar--expenses"
|
|
4671
5284
|
},
|
|
4672
|
-
data.map((entry) => /* @__PURE__ */
|
|
5285
|
+
data.map((entry) => /* @__PURE__ */ React66.createElement(
|
|
4673
5286
|
Cell,
|
|
4674
5287
|
{
|
|
4675
5288
|
key: entry.name,
|
|
@@ -4682,72 +5295,132 @@ var ProfitAndLossChart = () => {
|
|
|
4682
5295
|
};
|
|
4683
5296
|
|
|
4684
5297
|
// src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
|
|
4685
|
-
import
|
|
5298
|
+
import React67, { useContext as useContext3, useState as useState14, useEffect as useEffect10 } from "react";
|
|
4686
5299
|
import { add, endOfMonth as endOfMonth3, format as format5, startOfMonth as startOfMonth3 } from "date-fns";
|
|
4687
5300
|
var ProfitAndLossDatePicker = () => {
|
|
4688
5301
|
const { changeDateRange, dateRange } = useContext3(ProfitAndLoss.Context);
|
|
4689
|
-
const
|
|
4690
|
-
const
|
|
4691
|
-
const
|
|
4692
|
-
|
|
5302
|
+
const [isAnimating, setIsAnimating] = useState14(false);
|
|
5303
|
+
const [localDate, setLocalDate] = useState14(dateRange.startDate);
|
|
5304
|
+
const [nextOpacity, setNextOpacity] = useState14(0);
|
|
5305
|
+
const [currentOpacity, setCurrentOpacity] = useState14(1);
|
|
5306
|
+
const [transformStyle, setTransformStyle] = useState14({
|
|
5307
|
+
transform: "translateX(33%)",
|
|
5308
|
+
transition: "ease"
|
|
5309
|
+
});
|
|
5310
|
+
useEffect10(() => {
|
|
5311
|
+
if (dateRange.startDate !== localDate && !isAnimating) {
|
|
5312
|
+
setLocalDate(dateRange.startDate);
|
|
5313
|
+
setTransformStyle({ transform: "translateX(33%)", transition: "none" });
|
|
5314
|
+
}
|
|
5315
|
+
}, [dateRange.startDate, localDate, isAnimating]);
|
|
5316
|
+
const change = (monthsToAdd) => {
|
|
5317
|
+
if (isAnimating)
|
|
5318
|
+
return;
|
|
5319
|
+
setIsAnimating(true);
|
|
5320
|
+
setNextOpacity(1);
|
|
5321
|
+
const newDate = add(localDate, { months: monthsToAdd });
|
|
5322
|
+
if (monthsToAdd === -1) {
|
|
5323
|
+
setCurrentOpacity(0);
|
|
5324
|
+
}
|
|
4693
5325
|
changeDateRange({
|
|
4694
5326
|
startDate: startOfMonth3(newDate),
|
|
4695
5327
|
endDate: endOfMonth3(newDate)
|
|
4696
5328
|
});
|
|
5329
|
+
const translateXValue = monthsToAdd > 0 ? "0%" : "66%";
|
|
5330
|
+
setTransformStyle({
|
|
5331
|
+
transform: `translateX(${translateXValue})`,
|
|
5332
|
+
transition: "transform 0.4s ease"
|
|
5333
|
+
});
|
|
5334
|
+
setTimeout(() => {
|
|
5335
|
+
setCurrentOpacity(1);
|
|
5336
|
+
}, 300);
|
|
5337
|
+
setTimeout(() => {
|
|
5338
|
+
setLocalDate(newDate);
|
|
5339
|
+
setTransformStyle({ transform: "translateX(33%)", transition: "none" });
|
|
5340
|
+
setIsAnimating(false);
|
|
5341
|
+
setNextOpacity(0);
|
|
5342
|
+
setCurrentOpacity(1);
|
|
5343
|
+
}, 300);
|
|
4697
5344
|
};
|
|
4698
|
-
const
|
|
4699
|
-
const
|
|
4700
|
-
|
|
4701
|
-
|
|
5345
|
+
const currentLabel = format5(localDate, "LLLL, y");
|
|
5346
|
+
const prevLabel = format5(add(localDate, { months: -1 }), "LLLL, y");
|
|
5347
|
+
const nextLabel = format5(add(localDate, { months: 1 }), "LLLL, y");
|
|
5348
|
+
return /* @__PURE__ */ React67.createElement(
|
|
5349
|
+
"div",
|
|
4702
5350
|
{
|
|
4703
|
-
|
|
4704
|
-
className: "Layer__profit-and-loss-date-picker__button",
|
|
4705
|
-
onClick: previousMonth
|
|
5351
|
+
className: "Layer__profit-and-loss-date-picker"
|
|
4706
5352
|
},
|
|
4707
|
-
/* @__PURE__ */
|
|
4708
|
-
|
|
5353
|
+
/* @__PURE__ */ React67.createElement("div", { className: "Layer__profit-and-loss-date-picker__labels-container", style: transformStyle }, /* @__PURE__ */ React67.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, prevLabel), /* @__PURE__ */ React67.createElement(
|
|
5354
|
+
"span",
|
|
4709
5355
|
{
|
|
4710
|
-
className: "Layer__profit-and-loss-date-
|
|
4711
|
-
|
|
4712
|
-
}
|
|
4713
|
-
|
|
4714
|
-
|
|
4715
|
-
|
|
4716
|
-
{
|
|
4717
|
-
"aria-label": "View Next Month",
|
|
4718
|
-
className: "Layer__profit-and-loss-date-picker__button",
|
|
4719
|
-
onClick: nextMonth
|
|
4720
|
-
},
|
|
4721
|
-
/* @__PURE__ */ React61.createElement(
|
|
4722
|
-
ChevronRight_default,
|
|
5356
|
+
className: "Layer__profit-and-loss-date-picker__label",
|
|
5357
|
+
style: { opacity: currentOpacity }
|
|
5358
|
+
},
|
|
5359
|
+
currentLabel
|
|
5360
|
+
), /* @__PURE__ */ React67.createElement(
|
|
5361
|
+
"span",
|
|
4723
5362
|
{
|
|
4724
|
-
className: "Layer__profit-and-loss-date-
|
|
4725
|
-
|
|
4726
|
-
}
|
|
4727
|
-
|
|
4728
|
-
|
|
5363
|
+
className: "Layer__profit-and-loss-date-picker__label",
|
|
5364
|
+
style: { opacity: nextOpacity }
|
|
5365
|
+
},
|
|
5366
|
+
nextLabel
|
|
5367
|
+
)),
|
|
5368
|
+
/* @__PURE__ */ React67.createElement(
|
|
5369
|
+
"button",
|
|
5370
|
+
{
|
|
5371
|
+
"aria-label": "View Previous Month",
|
|
5372
|
+
className: "Layer__profit-and-loss-date-picker__button",
|
|
5373
|
+
onClick: () => change(-1),
|
|
5374
|
+
disabled: isAnimating
|
|
5375
|
+
},
|
|
5376
|
+
/* @__PURE__ */ React67.createElement(
|
|
5377
|
+
ChevronLeft_default,
|
|
5378
|
+
{
|
|
5379
|
+
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
5380
|
+
size: 16
|
|
5381
|
+
}
|
|
5382
|
+
)
|
|
5383
|
+
),
|
|
5384
|
+
/* @__PURE__ */ React67.createElement(
|
|
5385
|
+
"button",
|
|
5386
|
+
{
|
|
5387
|
+
"aria-label": "View Next Month",
|
|
5388
|
+
className: "Layer__profit-and-loss-date-picker__button",
|
|
5389
|
+
onClick: () => change(1),
|
|
5390
|
+
disabled: isAnimating
|
|
5391
|
+
},
|
|
5392
|
+
/* @__PURE__ */ React67.createElement(
|
|
5393
|
+
ChevronRight_default,
|
|
5394
|
+
{
|
|
5395
|
+
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
5396
|
+
size: 16
|
|
5397
|
+
}
|
|
5398
|
+
)
|
|
5399
|
+
),
|
|
5400
|
+
/* @__PURE__ */ React67.createElement("div", { className: "Layer__profit-and-loss-date-picker__effect-blur" })
|
|
5401
|
+
);
|
|
4729
5402
|
};
|
|
4730
5403
|
|
|
4731
5404
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
4732
|
-
import
|
|
5405
|
+
import React70, { useContext as useContext4, useMemo as useMemo5 } from "react";
|
|
4733
5406
|
|
|
4734
5407
|
// src/components/SkeletonLoader/SkeletonLoader.tsx
|
|
4735
|
-
import
|
|
4736
|
-
import
|
|
5408
|
+
import React68 from "react";
|
|
5409
|
+
import classNames25 from "classnames";
|
|
4737
5410
|
var SkeletonLoader = ({
|
|
4738
5411
|
height,
|
|
4739
5412
|
width,
|
|
4740
5413
|
className
|
|
4741
5414
|
}) => {
|
|
4742
|
-
const baseClassName =
|
|
5415
|
+
const baseClassName = classNames25(
|
|
4743
5416
|
"Layer__skeleton-loader Layer__anim--skeleton-loading",
|
|
4744
5417
|
className
|
|
4745
5418
|
);
|
|
4746
|
-
return /* @__PURE__ */
|
|
5419
|
+
return /* @__PURE__ */ React68.createElement("div", { className: baseClassName, style: { width, height } });
|
|
4747
5420
|
};
|
|
4748
5421
|
|
|
4749
5422
|
// src/components/ProfitAndLossSummaries/MiniChart.tsx
|
|
4750
|
-
import
|
|
5423
|
+
import React69 from "react";
|
|
4751
5424
|
|
|
4752
5425
|
// src/config/charts.ts
|
|
4753
5426
|
var INACTIVE_OPACITY_LEVELS = [
|
|
@@ -4838,7 +5511,7 @@ var DEFAULT_CHART_COLORS = [
|
|
|
4838
5511
|
// src/components/ProfitAndLossSummaries/MiniChart.tsx
|
|
4839
5512
|
import { PieChart, Pie, Cell as Cell2 } from "recharts";
|
|
4840
5513
|
var MiniChart = ({ data }) => {
|
|
4841
|
-
return /* @__PURE__ */
|
|
5514
|
+
return /* @__PURE__ */ React69.createElement(PieChart, { width: 48, height: 48, className: "mini-chart" }, /* @__PURE__ */ React69.createElement(
|
|
4842
5515
|
Pie,
|
|
4843
5516
|
{
|
|
4844
5517
|
data,
|
|
@@ -4857,7 +5530,7 @@ var MiniChart = ({ data }) => {
|
|
|
4857
5530
|
},
|
|
4858
5531
|
data.map((entry, index) => {
|
|
4859
5532
|
const colorConfig = DEFAULT_CHART_COLORS[index % DEFAULT_CHART_COLORS.length];
|
|
4860
|
-
return /* @__PURE__ */
|
|
5533
|
+
return /* @__PURE__ */ React69.createElement(
|
|
4861
5534
|
Cell2,
|
|
4862
5535
|
{
|
|
4863
5536
|
key: `cell-${index}`,
|
|
@@ -4871,7 +5544,7 @@ var MiniChart = ({ data }) => {
|
|
|
4871
5544
|
};
|
|
4872
5545
|
|
|
4873
5546
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
4874
|
-
import
|
|
5547
|
+
import classNames26 from "classnames";
|
|
4875
5548
|
var CHART_PLACEHOLDER = [
|
|
4876
5549
|
{
|
|
4877
5550
|
name: "placeholder",
|
|
@@ -4918,23 +5591,23 @@ var ProfitAndLossSummaries = ({
|
|
|
4918
5591
|
const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
4919
5592
|
const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
4920
5593
|
const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
4921
|
-
return /* @__PURE__ */
|
|
5594
|
+
return /* @__PURE__ */ React70.createElement(
|
|
4922
5595
|
"div",
|
|
4923
5596
|
{
|
|
4924
5597
|
className: `Layer__profit-and-loss-summaries ${vertical ? "flex-col" : ""}`
|
|
4925
5598
|
},
|
|
4926
|
-
/* @__PURE__ */
|
|
5599
|
+
/* @__PURE__ */ React70.createElement(
|
|
4927
5600
|
"div",
|
|
4928
5601
|
{
|
|
4929
|
-
className:
|
|
5602
|
+
className: classNames26(
|
|
4930
5603
|
"Layer__profit-and-loss-summaries__summary Layer__actionable",
|
|
4931
5604
|
"Layer__profit-and-loss-summaries__summary--income",
|
|
4932
5605
|
sidebarScope === "revenue" ? "active" : ""
|
|
4933
5606
|
),
|
|
4934
5607
|
onClick: () => setSidebarScope("revenue")
|
|
4935
5608
|
},
|
|
4936
|
-
/* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
5609
|
+
/* @__PURE__ */ React70.createElement(MiniChart, { data: revenueChartData }),
|
|
5610
|
+
/* @__PURE__ */ React70.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ React70.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, revenueLabel), isLoading || storedData === void 0 ? /* @__PURE__ */ React70.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React70.createElement(SkeletonLoader, null)) : /* @__PURE__ */ React70.createElement(
|
|
4938
5611
|
"span",
|
|
4939
5612
|
{
|
|
4940
5613
|
className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
|
|
@@ -4942,18 +5615,18 @@ var ProfitAndLossSummaries = ({
|
|
|
4942
5615
|
centsToDollars(Math.abs(data?.income?.value ?? NaN))
|
|
4943
5616
|
))
|
|
4944
5617
|
),
|
|
4945
|
-
/* @__PURE__ */
|
|
5618
|
+
/* @__PURE__ */ React70.createElement(
|
|
4946
5619
|
"div",
|
|
4947
5620
|
{
|
|
4948
|
-
className:
|
|
5621
|
+
className: classNames26(
|
|
4949
5622
|
"Layer__profit-and-loss-summaries__summary Layer__actionable",
|
|
4950
5623
|
"Layer__profit-and-loss-summaries__summary--expenses",
|
|
4951
5624
|
sidebarScope === "expenses" ? "active" : ""
|
|
4952
5625
|
),
|
|
4953
5626
|
onClick: () => setSidebarScope("expenses")
|
|
4954
5627
|
},
|
|
4955
|
-
/* @__PURE__ */
|
|
4956
|
-
/* @__PURE__ */
|
|
5628
|
+
/* @__PURE__ */ React70.createElement(MiniChart, { data: expensesChartData }),
|
|
5629
|
+
/* @__PURE__ */ React70.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ React70.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"), isLoading || storedData === void 0 ? /* @__PURE__ */ React70.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React70.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ React70.createElement(
|
|
4957
5630
|
"span",
|
|
4958
5631
|
{
|
|
4959
5632
|
className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
|
|
@@ -4963,7 +5636,7 @@ var ProfitAndLossSummaries = ({
|
|
|
4963
5636
|
)
|
|
4964
5637
|
))
|
|
4965
5638
|
),
|
|
4966
|
-
/* @__PURE__ */
|
|
5639
|
+
/* @__PURE__ */ React70.createElement("div", { className: "Layer__profit-and-loss-summaries__summary net-profit Layer__profit-and-loss-summaries__summary--net-profit" }, /* @__PURE__ */ React70.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ React70.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), isLoading || storedData === void 0 ? /* @__PURE__ */ React70.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React70.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ React70.createElement(
|
|
4967
5640
|
"span",
|
|
4968
5641
|
{
|
|
4969
5642
|
className: `Layer__profit-and-loss-summaries__amount ${netProfitDirectionClass}`
|
|
@@ -4974,14 +5647,14 @@ var ProfitAndLossSummaries = ({
|
|
|
4974
5647
|
};
|
|
4975
5648
|
|
|
4976
5649
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
4977
|
-
import
|
|
5650
|
+
import React73, { useContext as useContext5 } from "react";
|
|
4978
5651
|
|
|
4979
5652
|
// src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
|
|
4980
|
-
import
|
|
5653
|
+
import React72, { useState as useState15 } from "react";
|
|
4981
5654
|
|
|
4982
5655
|
// src/icons/PieChart.tsx
|
|
4983
|
-
import * as
|
|
4984
|
-
var PieChart2 = ({ size = 12, ...props }) => /* @__PURE__ */
|
|
5656
|
+
import * as React71 from "react";
|
|
5657
|
+
var PieChart2 = ({ size = 12, ...props }) => /* @__PURE__ */ React71.createElement(
|
|
4985
5658
|
"svg",
|
|
4986
5659
|
{
|
|
4987
5660
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4991,21 +5664,21 @@ var PieChart2 = ({ size = 12, ...props }) => /* @__PURE__ */ React65.createEleme
|
|
|
4991
5664
|
width: size,
|
|
4992
5665
|
height: size
|
|
4993
5666
|
},
|
|
4994
|
-
/* @__PURE__ */
|
|
5667
|
+
/* @__PURE__ */ React71.createElement("g", null, /* @__PURE__ */ React71.createElement(
|
|
4995
5668
|
"path",
|
|
4996
5669
|
{
|
|
4997
5670
|
d: "M10.2213 7.78271C9.92969 8.47226 9.47363 9.07989 8.89297 9.55247C8.3123 10.0251 7.62471 10.3482 6.89031 10.4936C6.1559 10.6391 5.39705 10.6024 4.68009 10.3869C3.96313 10.1713 3.30989 9.78337 2.77749 9.25701C2.24509 8.73065 1.84973 8.08189 1.62598 7.36744C1.40223 6.65298 1.3569 5.8946 1.49396 5.15858C1.63102 4.42257 1.94629 3.73133 2.41221 3.14531C2.87813 2.55928 3.48051 2.09631 4.16669 1.79688",
|
|
4998
5671
|
stroke: "currentColor",
|
|
4999
|
-
|
|
5000
|
-
|
|
5672
|
+
strokeLinecap: "round",
|
|
5673
|
+
strokeLinejoin: "round"
|
|
5001
5674
|
}
|
|
5002
|
-
), /* @__PURE__ */
|
|
5675
|
+
), /* @__PURE__ */ React71.createElement(
|
|
5003
5676
|
"path",
|
|
5004
5677
|
{
|
|
5005
5678
|
d: "M10.5833 6.00033C10.5833 5.39843 10.4648 4.80244 10.2344 4.24636C10.0041 3.69028 9.66651 3.18502 9.24091 2.75942C8.8153 2.33382 8.31004 1.99621 7.75397 1.76588C7.19789 1.53554 6.60189 1.41699 6 1.41699V6.00033H10.5833Z",
|
|
5006
5679
|
stroke: "currentColor",
|
|
5007
|
-
|
|
5008
|
-
|
|
5680
|
+
strokeLinecap: "round",
|
|
5681
|
+
strokeLinejoin: "round"
|
|
5009
5682
|
}
|
|
5010
5683
|
))
|
|
5011
5684
|
);
|
|
@@ -5026,7 +5699,7 @@ var ProfitAndLossRow = ({
|
|
|
5026
5699
|
return null;
|
|
5027
5700
|
}
|
|
5028
5701
|
const { value, display_name, line_items } = lineItem;
|
|
5029
|
-
const [expanded, setExpanded] =
|
|
5702
|
+
const [expanded, setExpanded] = useState15(true);
|
|
5030
5703
|
const amount = value ?? 0;
|
|
5031
5704
|
const amountString = centsToDollars(Math.abs(amount));
|
|
5032
5705
|
const labelClasses = [
|
|
@@ -5057,20 +5730,20 @@ var ProfitAndLossRow = ({
|
|
|
5057
5730
|
);
|
|
5058
5731
|
displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
|
|
5059
5732
|
displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
|
|
5060
|
-
return /* @__PURE__ */
|
|
5733
|
+
return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
|
|
5061
5734
|
"div",
|
|
5062
5735
|
{
|
|
5063
5736
|
className: labelClasses.join(" "),
|
|
5064
5737
|
onClick: () => !lockExpanded && toggleExpanded()
|
|
5065
5738
|
},
|
|
5066
|
-
/* @__PURE__ */
|
|
5739
|
+
/* @__PURE__ */ React72.createElement("span", { className: "Layer__profit-and-loss-row__label__title" }, !lockExpanded && variant !== "summation" ? /* @__PURE__ */ React72.createElement(
|
|
5067
5740
|
ChevronDownFill_default,
|
|
5068
5741
|
{
|
|
5069
5742
|
size: 16,
|
|
5070
5743
|
className: "Layer__profit-and-loss-row__label__chevron"
|
|
5071
5744
|
}
|
|
5072
|
-
) : null, /* @__PURE__ */
|
|
5073
|
-
setSidebarScope && /* @__PURE__ */
|
|
5745
|
+
) : null, /* @__PURE__ */ React72.createElement(Text, null, display_name)),
|
|
5746
|
+
setSidebarScope && /* @__PURE__ */ React72.createElement(
|
|
5074
5747
|
"span",
|
|
5075
5748
|
{
|
|
5076
5749
|
className: "Layer__profit-and-loss-row__detailed-chart-btn",
|
|
@@ -5079,14 +5752,14 @@ var ProfitAndLossRow = ({
|
|
|
5079
5752
|
setSidebarScope && setSidebarScope(scope ?? "expenses");
|
|
5080
5753
|
}
|
|
5081
5754
|
},
|
|
5082
|
-
/* @__PURE__ */
|
|
5755
|
+
/* @__PURE__ */ React72.createElement(PieChart_default, null)
|
|
5083
5756
|
)
|
|
5084
|
-
), /* @__PURE__ */
|
|
5757
|
+
), /* @__PURE__ */ React72.createElement("div", { className: valueClasses.join(" ") }, /* @__PURE__ */ React72.createElement(Text, null, amountString)), canGoDeeper && hasChildren && /* @__PURE__ */ React72.createElement(
|
|
5085
5758
|
"div",
|
|
5086
5759
|
{
|
|
5087
5760
|
className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
|
|
5088
5761
|
},
|
|
5089
|
-
/* @__PURE__ */
|
|
5762
|
+
/* @__PURE__ */ React72.createElement("div", { className: "Layer__profit-and-loss-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ React72.createElement(
|
|
5090
5763
|
ProfitAndLossRow,
|
|
5091
5764
|
{
|
|
5092
5765
|
key: line_item.display_name,
|
|
@@ -5156,9 +5829,9 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5156
5829
|
} = useContext5(ProfitAndLoss.Context);
|
|
5157
5830
|
const data = !actualData || isLoading ? empty_profit_and_loss_report_default : actualData;
|
|
5158
5831
|
if (isLoading || actualData === void 0) {
|
|
5159
|
-
return /* @__PURE__ */
|
|
5832
|
+
return /* @__PURE__ */ React73.createElement("div", { className: "Layer__profit-and-loss-table__loader-container" }, /* @__PURE__ */ React73.createElement(Loader2, null));
|
|
5160
5833
|
}
|
|
5161
|
-
return /* @__PURE__ */
|
|
5834
|
+
return /* @__PURE__ */ React73.createElement(React73.Fragment, null, /* @__PURE__ */ React73.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table--main" }, /* @__PURE__ */ React73.createElement(
|
|
5162
5835
|
ProfitAndLossRow,
|
|
5163
5836
|
{
|
|
5164
5837
|
lineItem: data.income,
|
|
@@ -5167,7 +5840,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5167
5840
|
scope: "revenue",
|
|
5168
5841
|
setSidebarScope
|
|
5169
5842
|
}
|
|
5170
|
-
), /* @__PURE__ */
|
|
5843
|
+
), /* @__PURE__ */ React73.createElement(
|
|
5171
5844
|
ProfitAndLossRow,
|
|
5172
5845
|
{
|
|
5173
5846
|
lineItem: data.cost_of_goods_sold,
|
|
@@ -5176,7 +5849,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5176
5849
|
scope: "expenses",
|
|
5177
5850
|
setSidebarScope
|
|
5178
5851
|
}
|
|
5179
|
-
), /* @__PURE__ */
|
|
5852
|
+
), /* @__PURE__ */ React73.createElement(
|
|
5180
5853
|
ProfitAndLossRow,
|
|
5181
5854
|
{
|
|
5182
5855
|
lineItem: {
|
|
@@ -5189,7 +5862,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5189
5862
|
scope: "revenue",
|
|
5190
5863
|
setSidebarScope
|
|
5191
5864
|
}
|
|
5192
|
-
), /* @__PURE__ */
|
|
5865
|
+
), /* @__PURE__ */ React73.createElement(
|
|
5193
5866
|
ProfitAndLossRow,
|
|
5194
5867
|
{
|
|
5195
5868
|
lineItem: data.expenses,
|
|
@@ -5198,7 +5871,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5198
5871
|
scope: "expenses",
|
|
5199
5872
|
setSidebarScope
|
|
5200
5873
|
}
|
|
5201
|
-
), /* @__PURE__ */
|
|
5874
|
+
), /* @__PURE__ */ React73.createElement(
|
|
5202
5875
|
ProfitAndLossRow,
|
|
5203
5876
|
{
|
|
5204
5877
|
lineItem: {
|
|
@@ -5211,7 +5884,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5211
5884
|
scope: "revenue",
|
|
5212
5885
|
setSidebarScope
|
|
5213
5886
|
}
|
|
5214
|
-
), /* @__PURE__ */
|
|
5887
|
+
), /* @__PURE__ */ React73.createElement(
|
|
5215
5888
|
ProfitAndLossRow,
|
|
5216
5889
|
{
|
|
5217
5890
|
lineItem: data.taxes,
|
|
@@ -5220,7 +5893,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5220
5893
|
scope: "expenses",
|
|
5221
5894
|
setSidebarScope
|
|
5222
5895
|
}
|
|
5223
|
-
), /* @__PURE__ */
|
|
5896
|
+
), /* @__PURE__ */ React73.createElement(
|
|
5224
5897
|
ProfitAndLossRow,
|
|
5225
5898
|
{
|
|
5226
5899
|
lineItem: {
|
|
@@ -5231,14 +5904,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5231
5904
|
direction: "CREDIT" /* CREDIT */,
|
|
5232
5905
|
lockExpanded
|
|
5233
5906
|
}
|
|
5234
|
-
)), data.other_outflows || data.personal_expenses ? /* @__PURE__ */
|
|
5907
|
+
)), data.other_outflows || data.personal_expenses ? /* @__PURE__ */ React73.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ React73.createElement(
|
|
5235
5908
|
ProfitAndLossRow,
|
|
5236
5909
|
{
|
|
5237
5910
|
lineItem: data.other_outflows,
|
|
5238
5911
|
direction: "DEBIT" /* DEBIT */,
|
|
5239
5912
|
lockExpanded
|
|
5240
5913
|
}
|
|
5241
|
-
), /* @__PURE__ */
|
|
5914
|
+
), /* @__PURE__ */ React73.createElement(
|
|
5242
5915
|
ProfitAndLossRow,
|
|
5243
5916
|
{
|
|
5244
5917
|
lineItem: data.personal_expenses,
|
|
@@ -5279,7 +5952,7 @@ var PNLContext = createContext2({
|
|
|
5279
5952
|
});
|
|
5280
5953
|
var ProfitAndLoss = ({ children, tagFilter, reportingBasis }) => {
|
|
5281
5954
|
const contextData = useProfitAndLoss({ tagFilter, reportingBasis });
|
|
5282
|
-
return /* @__PURE__ */
|
|
5955
|
+
return /* @__PURE__ */ React74.createElement(PNLContext.Provider, { value: contextData }, /* @__PURE__ */ React74.createElement("div", { className: "Layer__component Layer__profit-and-loss" }, children));
|
|
5283
5956
|
};
|
|
5284
5957
|
ProfitAndLoss.Chart = ProfitAndLossChart;
|
|
5285
5958
|
ProfitAndLoss.Context = PNLContext;
|
|
@@ -5288,14 +5961,14 @@ ProfitAndLoss.Summaries = ProfitAndLossSummaries;
|
|
|
5288
5961
|
ProfitAndLoss.Table = ProfitAndLossTable;
|
|
5289
5962
|
|
|
5290
5963
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
5291
|
-
import
|
|
5964
|
+
import React81, { useContext as useContext7 } from "react";
|
|
5292
5965
|
|
|
5293
5966
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
5294
|
-
import
|
|
5967
|
+
import React80, { useContext as useContext6, useState as useState16 } from "react";
|
|
5295
5968
|
|
|
5296
5969
|
// src/icons/X.tsx
|
|
5297
|
-
import * as
|
|
5298
|
-
var X = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
5970
|
+
import * as React75 from "react";
|
|
5971
|
+
var X = ({ size = 18, ...props }) => /* @__PURE__ */ React75.createElement(
|
|
5299
5972
|
"svg",
|
|
5300
5973
|
{
|
|
5301
5974
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5305,7 +5978,7 @@ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React69.createElement(
|
|
|
5305
5978
|
width: size,
|
|
5306
5979
|
height: size
|
|
5307
5980
|
},
|
|
5308
|
-
/* @__PURE__ */
|
|
5981
|
+
/* @__PURE__ */ React75.createElement(
|
|
5309
5982
|
"path",
|
|
5310
5983
|
{
|
|
5311
5984
|
d: "M13.5 4.5L4.5 13.5",
|
|
@@ -5314,7 +5987,7 @@ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React69.createElement(
|
|
|
5314
5987
|
strokeLinejoin: "round"
|
|
5315
5988
|
}
|
|
5316
5989
|
),
|
|
5317
|
-
/* @__PURE__ */
|
|
5990
|
+
/* @__PURE__ */ React75.createElement(
|
|
5318
5991
|
"path",
|
|
5319
5992
|
{
|
|
5320
5993
|
d: "M4.5 4.5L13.5 13.5",
|
|
@@ -5327,7 +6000,7 @@ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React69.createElement(
|
|
|
5327
6000
|
var X_default = X;
|
|
5328
6001
|
|
|
5329
6002
|
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
5330
|
-
import
|
|
6003
|
+
import React76, { useMemo as useMemo6 } from "react";
|
|
5331
6004
|
import {
|
|
5332
6005
|
PieChart as PieChart3,
|
|
5333
6006
|
Pie as Pie2,
|
|
@@ -5361,7 +6034,7 @@ var DetailedChart = ({
|
|
|
5361
6034
|
};
|
|
5362
6035
|
});
|
|
5363
6036
|
}, [filteredData]);
|
|
5364
|
-
return /* @__PURE__ */
|
|
6037
|
+
return /* @__PURE__ */ React76.createElement("div", { className: "chart-field" }, /* @__PURE__ */ React76.createElement("div", { className: "header--tablet" }, /* @__PURE__ */ React76.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(sidebarScope)), /* @__PURE__ */ React76.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ React76.createElement("div", { className: "chart-container" }, /* @__PURE__ */ React76.createElement(ResponsiveContainer2, null, /* @__PURE__ */ React76.createElement(PieChart3, null, /* @__PURE__ */ React76.createElement(
|
|
5365
6038
|
Pie2,
|
|
5366
6039
|
{
|
|
5367
6040
|
data: chartData,
|
|
@@ -5386,7 +6059,7 @@ var DetailedChart = ({
|
|
|
5386
6059
|
fill = void 0;
|
|
5387
6060
|
opacity = INACTIVE_OPACITY_LEVELS[index % INACTIVE_OPACITY_LEVELS.length];
|
|
5388
6061
|
}
|
|
5389
|
-
return /* @__PURE__ */
|
|
6062
|
+
return /* @__PURE__ */ React76.createElement(
|
|
5390
6063
|
Cell3,
|
|
5391
6064
|
{
|
|
5392
6065
|
key: `cell-${index}`,
|
|
@@ -5398,7 +6071,7 @@ var DetailedChart = ({
|
|
|
5398
6071
|
}
|
|
5399
6072
|
);
|
|
5400
6073
|
}),
|
|
5401
|
-
/* @__PURE__ */
|
|
6074
|
+
/* @__PURE__ */ React76.createElement(
|
|
5402
6075
|
Label,
|
|
5403
6076
|
{
|
|
5404
6077
|
position: "center",
|
|
@@ -5419,7 +6092,7 @@ var DetailedChart = ({
|
|
|
5419
6092
|
if (hoveredItem) {
|
|
5420
6093
|
text = hoveredItem;
|
|
5421
6094
|
}
|
|
5422
|
-
return /* @__PURE__ */
|
|
6095
|
+
return /* @__PURE__ */ React76.createElement(
|
|
5423
6096
|
ChartText,
|
|
5424
6097
|
{
|
|
5425
6098
|
...positioningProps,
|
|
@@ -5430,7 +6103,7 @@ var DetailedChart = ({
|
|
|
5430
6103
|
}
|
|
5431
6104
|
}
|
|
5432
6105
|
),
|
|
5433
|
-
/* @__PURE__ */
|
|
6106
|
+
/* @__PURE__ */ React76.createElement(
|
|
5434
6107
|
Label,
|
|
5435
6108
|
{
|
|
5436
6109
|
position: "center",
|
|
@@ -5453,7 +6126,7 @@ var DetailedChart = ({
|
|
|
5453
6126
|
(x) => x.display_name === hoveredItem
|
|
5454
6127
|
)?.value;
|
|
5455
6128
|
}
|
|
5456
|
-
return /* @__PURE__ */
|
|
6129
|
+
return /* @__PURE__ */ React76.createElement(
|
|
5457
6130
|
ChartText,
|
|
5458
6131
|
{
|
|
5459
6132
|
...positioningProps,
|
|
@@ -5464,7 +6137,7 @@ var DetailedChart = ({
|
|
|
5464
6137
|
}
|
|
5465
6138
|
}
|
|
5466
6139
|
),
|
|
5467
|
-
/* @__PURE__ */
|
|
6140
|
+
/* @__PURE__ */ React76.createElement(
|
|
5468
6141
|
Label,
|
|
5469
6142
|
{
|
|
5470
6143
|
position: "center",
|
|
@@ -5483,7 +6156,7 @@ var DetailedChart = ({
|
|
|
5483
6156
|
verticalAnchor: "middle"
|
|
5484
6157
|
};
|
|
5485
6158
|
if (hoveredItem) {
|
|
5486
|
-
return /* @__PURE__ */
|
|
6159
|
+
return /* @__PURE__ */ React76.createElement(
|
|
5487
6160
|
ChartText,
|
|
5488
6161
|
{
|
|
5489
6162
|
...positioningProps,
|
|
@@ -5502,11 +6175,11 @@ var DetailedChart = ({
|
|
|
5502
6175
|
};
|
|
5503
6176
|
|
|
5504
6177
|
// src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
|
|
5505
|
-
import
|
|
6178
|
+
import React78 from "react";
|
|
5506
6179
|
|
|
5507
6180
|
// src/icons/SortArrows.tsx
|
|
5508
|
-
import * as
|
|
5509
|
-
var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */
|
|
6181
|
+
import * as React77 from "react";
|
|
6182
|
+
var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React77.createElement(
|
|
5510
6183
|
"svg",
|
|
5511
6184
|
{
|
|
5512
6185
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5516,44 +6189,44 @@ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React71.createElem
|
|
|
5516
6189
|
width: size,
|
|
5517
6190
|
height: size
|
|
5518
6191
|
},
|
|
5519
|
-
/* @__PURE__ */
|
|
6192
|
+
/* @__PURE__ */ React77.createElement("g", { "clip-path": "url(#clip0_1758_75388)" }, /* @__PURE__ */ React77.createElement(
|
|
5520
6193
|
"path",
|
|
5521
6194
|
{
|
|
5522
6195
|
d: "M1.33325 8.5L3.99992 11.1667L6.66659 8.5",
|
|
5523
6196
|
stroke: "currentColor",
|
|
5524
|
-
|
|
5525
|
-
|
|
6197
|
+
strokeLinecap: "round",
|
|
6198
|
+
strokeLinejoin: "round",
|
|
5526
6199
|
className: "desc-arrow"
|
|
5527
6200
|
}
|
|
5528
|
-
), /* @__PURE__ */
|
|
6201
|
+
), /* @__PURE__ */ React77.createElement(
|
|
5529
6202
|
"path",
|
|
5530
6203
|
{
|
|
5531
6204
|
d: "M4 2.5L4 11.1667",
|
|
5532
6205
|
stroke: "currentColor",
|
|
5533
|
-
|
|
5534
|
-
|
|
6206
|
+
strokeLinecap: "round",
|
|
6207
|
+
strokeLinejoin: "round",
|
|
5535
6208
|
className: "desc-arrow"
|
|
5536
6209
|
}
|
|
5537
|
-
), /* @__PURE__ */
|
|
6210
|
+
), /* @__PURE__ */ React77.createElement(
|
|
5538
6211
|
"path",
|
|
5539
6212
|
{
|
|
5540
6213
|
d: "M5.99988 5.16602L8.66654 2.49935L11.3332 5.16602",
|
|
5541
6214
|
stroke: "currentColor",
|
|
5542
|
-
|
|
5543
|
-
|
|
6215
|
+
strokeLinecap: "round",
|
|
6216
|
+
strokeLinejoin: "round",
|
|
5544
6217
|
className: "asc-arrow"
|
|
5545
6218
|
}
|
|
5546
|
-
), /* @__PURE__ */
|
|
6219
|
+
), /* @__PURE__ */ React77.createElement(
|
|
5547
6220
|
"path",
|
|
5548
6221
|
{
|
|
5549
6222
|
d: "M8.66663 11.166L8.66663 2.49935",
|
|
5550
6223
|
stroke: "currentColor",
|
|
5551
|
-
|
|
5552
|
-
|
|
6224
|
+
strokeLinecap: "round",
|
|
6225
|
+
strokeLinejoin: "round",
|
|
5553
6226
|
className: "asc-arrow"
|
|
5554
6227
|
}
|
|
5555
6228
|
)),
|
|
5556
|
-
/* @__PURE__ */
|
|
6229
|
+
/* @__PURE__ */ React77.createElement("defs", null, /* @__PURE__ */ React77.createElement("clipPath", { id: "clip0_1758_75388" }, /* @__PURE__ */ React77.createElement(
|
|
5557
6230
|
"rect",
|
|
5558
6231
|
{
|
|
5559
6232
|
width: "12",
|
|
@@ -5566,7 +6239,7 @@ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React71.createElem
|
|
|
5566
6239
|
var SortArrows_default = SortArrows;
|
|
5567
6240
|
|
|
5568
6241
|
// src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
|
|
5569
|
-
import
|
|
6242
|
+
import classNames27 from "classnames";
|
|
5570
6243
|
var DetailedTable = ({
|
|
5571
6244
|
filteredData,
|
|
5572
6245
|
sidebarScope,
|
|
@@ -5576,52 +6249,52 @@ var DetailedTable = ({
|
|
|
5576
6249
|
setHoveredItem
|
|
5577
6250
|
}) => {
|
|
5578
6251
|
const buildColClass = (column) => {
|
|
5579
|
-
return
|
|
6252
|
+
return classNames27(
|
|
5580
6253
|
"Layer__sortable-col",
|
|
5581
6254
|
sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
|
|
5582
6255
|
);
|
|
5583
6256
|
};
|
|
5584
|
-
return /* @__PURE__ */
|
|
6257
|
+
return /* @__PURE__ */ React78.createElement("div", { className: "details-container" }, /* @__PURE__ */ React78.createElement("div", { className: "table" }, /* @__PURE__ */ React78.createElement("table", null, /* @__PURE__ */ React78.createElement("thead", null, /* @__PURE__ */ React78.createElement("tr", null, /* @__PURE__ */ React78.createElement(
|
|
5585
6258
|
"th",
|
|
5586
6259
|
{
|
|
5587
6260
|
className: buildColClass("category"),
|
|
5588
6261
|
onClick: () => sortBy(sidebarScope ?? "expenses", "category")
|
|
5589
6262
|
},
|
|
5590
6263
|
"Expense/Sale ",
|
|
5591
|
-
/* @__PURE__ */
|
|
5592
|
-
), /* @__PURE__ */
|
|
6264
|
+
/* @__PURE__ */ React78.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
6265
|
+
), /* @__PURE__ */ React78.createElement(
|
|
5593
6266
|
"th",
|
|
5594
6267
|
{
|
|
5595
6268
|
className: buildColClass("type"),
|
|
5596
6269
|
onClick: () => sortBy(sidebarScope ?? "expenses", "type")
|
|
5597
6270
|
},
|
|
5598
6271
|
"Type ",
|
|
5599
|
-
/* @__PURE__ */
|
|
5600
|
-
), /* @__PURE__ */
|
|
6272
|
+
/* @__PURE__ */ React78.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
6273
|
+
), /* @__PURE__ */ React78.createElement("th", null), /* @__PURE__ */ React78.createElement(
|
|
5601
6274
|
"th",
|
|
5602
6275
|
{
|
|
5603
6276
|
className: buildColClass("value"),
|
|
5604
6277
|
onClick: () => sortBy(sidebarScope ?? "expenses", "value")
|
|
5605
6278
|
},
|
|
5606
6279
|
"Value ",
|
|
5607
|
-
/* @__PURE__ */
|
|
5608
|
-
))), /* @__PURE__ */
|
|
6280
|
+
/* @__PURE__ */ React78.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
6281
|
+
))), /* @__PURE__ */ React78.createElement("tbody", null, filteredData.filter((x) => !x.hidden).map((item, idx) => {
|
|
5609
6282
|
const colorConfig = DEFAULT_CHART_COLORS[idx % DEFAULT_CHART_COLORS.length];
|
|
5610
|
-
return /* @__PURE__ */
|
|
6283
|
+
return /* @__PURE__ */ React78.createElement(
|
|
5611
6284
|
"tr",
|
|
5612
6285
|
{
|
|
5613
6286
|
key: `pl-side-table-item-${idx}`,
|
|
5614
|
-
className:
|
|
6287
|
+
className: classNames27(
|
|
5615
6288
|
"Layer__profit-and-loss-detailed-table__row",
|
|
5616
6289
|
hoveredItem && hoveredItem === item.display_name ? "active" : ""
|
|
5617
6290
|
),
|
|
5618
6291
|
onMouseEnter: () => setHoveredItem(item.display_name),
|
|
5619
6292
|
onMouseLeave: () => setHoveredItem(void 0)
|
|
5620
6293
|
},
|
|
5621
|
-
/* @__PURE__ */
|
|
5622
|
-
/* @__PURE__ */
|
|
5623
|
-
/* @__PURE__ */
|
|
5624
|
-
/* @__PURE__ */
|
|
6294
|
+
/* @__PURE__ */ React78.createElement("td", { className: "category-col" }, item.display_name),
|
|
6295
|
+
/* @__PURE__ */ React78.createElement("td", { className: "type-col" }, item.type),
|
|
6296
|
+
/* @__PURE__ */ React78.createElement("td", { className: "value-col" }, "$", centsToDollars(item.value)),
|
|
6297
|
+
/* @__PURE__ */ React78.createElement("td", { className: "share-col" }, /* @__PURE__ */ React78.createElement("span", { className: "share-cell-content" }, formatPercent(item.share), "%", /* @__PURE__ */ React78.createElement(
|
|
5625
6298
|
"div",
|
|
5626
6299
|
{
|
|
5627
6300
|
className: "share-icon",
|
|
@@ -5636,16 +6309,16 @@ var DetailedTable = ({
|
|
|
5636
6309
|
};
|
|
5637
6310
|
|
|
5638
6311
|
// src/components/ProfitAndLossDetailedCharts/Filters.tsx
|
|
5639
|
-
import
|
|
5640
|
-
import
|
|
6312
|
+
import React79 from "react";
|
|
6313
|
+
import Select3, { components as components3 } from "react-select";
|
|
5641
6314
|
var Filters = ({
|
|
5642
6315
|
filteredData,
|
|
5643
6316
|
sidebarScope,
|
|
5644
6317
|
filters,
|
|
5645
6318
|
setFilterTypes
|
|
5646
6319
|
}) => {
|
|
5647
|
-
return /* @__PURE__ */
|
|
5648
|
-
|
|
6320
|
+
return /* @__PURE__ */ React79.createElement("div", { className: "filters" }, /* @__PURE__ */ React79.createElement(Text, { size: "sm" /* sm */, className: "Layer__label" }, "Filters"), /* @__PURE__ */ React79.createElement(
|
|
6321
|
+
Select3,
|
|
5649
6322
|
{
|
|
5650
6323
|
className: "Layer__select type-select",
|
|
5651
6324
|
classNamePrefix: "Layer__select",
|
|
@@ -5666,15 +6339,15 @@ var Filters = ({
|
|
|
5666
6339
|
);
|
|
5667
6340
|
},
|
|
5668
6341
|
components: {
|
|
5669
|
-
DropdownIndicator: (props) => /* @__PURE__ */
|
|
5670
|
-
Placeholder: (props) => /* @__PURE__ */
|
|
6342
|
+
DropdownIndicator: (props) => /* @__PURE__ */ React79.createElement(components3.DropdownIndicator, { ...props }, /* @__PURE__ */ React79.createElement(ChevronDown_default, null)),
|
|
6343
|
+
Placeholder: (props) => /* @__PURE__ */ React79.createElement(components3.Placeholder, { ...props }, /* @__PURE__ */ React79.createElement("div", { className: "Layer__select__multi-all-placeholder-badge" }, "All"))
|
|
5671
6344
|
}
|
|
5672
6345
|
}
|
|
5673
6346
|
));
|
|
5674
6347
|
};
|
|
5675
6348
|
|
|
5676
6349
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
5677
|
-
import
|
|
6350
|
+
import classNames28 from "classnames";
|
|
5678
6351
|
import { format as format6 } from "date-fns";
|
|
5679
6352
|
var ProfitAndLossDetailedCharts = () => {
|
|
5680
6353
|
const {
|
|
@@ -5688,31 +6361,24 @@ var ProfitAndLossDetailedCharts = () => {
|
|
|
5688
6361
|
setSidebarScope,
|
|
5689
6362
|
setFilterTypes
|
|
5690
6363
|
} = useContext6(ProfitAndLoss.Context);
|
|
5691
|
-
const [hoveredItem, setHoveredItem] =
|
|
5692
|
-
return /* @__PURE__ */
|
|
6364
|
+
const [hoveredItem, setHoveredItem] = useState16();
|
|
6365
|
+
return /* @__PURE__ */ React80.createElement(
|
|
5693
6366
|
"div",
|
|
5694
6367
|
{
|
|
5695
|
-
className:
|
|
6368
|
+
className: classNames28(
|
|
5696
6369
|
"Layer__profit-and-loss__side-panel",
|
|
5697
6370
|
sidebarScope && "open"
|
|
5698
6371
|
)
|
|
5699
6372
|
},
|
|
5700
|
-
/* @__PURE__ */
|
|
6373
|
+
/* @__PURE__ */ React80.createElement("div", { className: "Layer__profit-and-loss-detailed-charts" }, /* @__PURE__ */ React80.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header" }, /* @__PURE__ */ React80.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ React80.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(sidebarScope)), /* @__PURE__ */ React80.createElement(Text, { size: "sm" /* sm */, className: "date" }, format6(dateRange.startDate, "LLLL, y")), /* @__PURE__ */ React80.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ React80.createElement(
|
|
5701
6374
|
Button,
|
|
5702
6375
|
{
|
|
5703
|
-
rightIcon: /* @__PURE__ */
|
|
6376
|
+
rightIcon: /* @__PURE__ */ React80.createElement(X_default, null),
|
|
5704
6377
|
iconOnly: true,
|
|
5705
6378
|
onClick: () => setSidebarScope(void 0),
|
|
5706
6379
|
variant: "secondary" /* secondary */
|
|
5707
6380
|
}
|
|
5708
|
-
)), /* @__PURE__ */
|
|
5709
|
-
Button,
|
|
5710
|
-
{
|
|
5711
|
-
onClick: () => setSidebarScope(void 0),
|
|
5712
|
-
variant: "secondary" /* secondary */
|
|
5713
|
-
},
|
|
5714
|
-
"Back"
|
|
5715
|
-
)), /* @__PURE__ */ React74.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__content" }, /* @__PURE__ */ React74.createElement(
|
|
6381
|
+
)), /* @__PURE__ */ React80.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header--tablet" }, /* @__PURE__ */ React80.createElement(BackButton, { onClick: () => setSidebarScope(void 0) })), /* @__PURE__ */ React80.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__content" }, /* @__PURE__ */ React80.createElement(
|
|
5716
6382
|
DetailedChart,
|
|
5717
6383
|
{
|
|
5718
6384
|
filteredData,
|
|
@@ -5722,7 +6388,7 @@ var ProfitAndLossDetailedCharts = () => {
|
|
|
5722
6388
|
sidebarScope,
|
|
5723
6389
|
date: dateRange.startDate
|
|
5724
6390
|
}
|
|
5725
|
-
), /* @__PURE__ */
|
|
6391
|
+
), /* @__PURE__ */ React80.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__table-wrapper" }, /* @__PURE__ */ React80.createElement(
|
|
5726
6392
|
Filters,
|
|
5727
6393
|
{
|
|
5728
6394
|
filteredData,
|
|
@@ -5730,7 +6396,7 @@ var ProfitAndLossDetailedCharts = () => {
|
|
|
5730
6396
|
filters,
|
|
5731
6397
|
setFilterTypes
|
|
5732
6398
|
}
|
|
5733
|
-
), /* @__PURE__ */
|
|
6399
|
+
), /* @__PURE__ */ React80.createElement(
|
|
5734
6400
|
DetailedTable,
|
|
5735
6401
|
{
|
|
5736
6402
|
filteredData,
|
|
@@ -5747,7 +6413,7 @@ var ProfitAndLossDetailedCharts = () => {
|
|
|
5747
6413
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
5748
6414
|
var COMPONENT_NAME3 = "profit-and-loss";
|
|
5749
6415
|
var ProfitAndLossView = (props) => {
|
|
5750
|
-
return /* @__PURE__ */
|
|
6416
|
+
return /* @__PURE__ */ React81.createElement(Container, { name: COMPONENT_NAME3 }, /* @__PURE__ */ React81.createElement(ProfitAndLoss, null, /* @__PURE__ */ React81.createElement("div", { className: `Layer__${COMPONENT_NAME3}__main-panel` }, /* @__PURE__ */ React81.createElement(Header, { className: `Layer__${COMPONENT_NAME3}__header` }, /* @__PURE__ */ React81.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Profit & Loss")), /* @__PURE__ */ React81.createElement(Components, { ...props })), props.showDetailedCharts !== false && /* @__PURE__ */ React81.createElement(ProfitAndLossDetailedCharts, null)));
|
|
5751
6417
|
};
|
|
5752
6418
|
var Components = ({
|
|
5753
6419
|
hideChart = false,
|
|
@@ -5757,7 +6423,7 @@ var Components = ({
|
|
|
5757
6423
|
ProfitAndLoss.Context
|
|
5758
6424
|
);
|
|
5759
6425
|
if (!isLoading && error) {
|
|
5760
|
-
return /* @__PURE__ */
|
|
6426
|
+
return /* @__PURE__ */ React81.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React81.createElement(
|
|
5761
6427
|
DataState,
|
|
5762
6428
|
{
|
|
5763
6429
|
status: "failed" /* failed */,
|
|
@@ -5768,49 +6434,123 @@ var Components = ({
|
|
|
5768
6434
|
}
|
|
5769
6435
|
));
|
|
5770
6436
|
}
|
|
5771
|
-
return /* @__PURE__ */
|
|
6437
|
+
return /* @__PURE__ */ React81.createElement(React81.Fragment, null, !hideChart && /* @__PURE__ */ React81.createElement("div", { className: `Layer__${COMPONENT_NAME3}__chart_with_summaries` }, /* @__PURE__ */ React81.createElement(
|
|
5772
6438
|
"div",
|
|
5773
6439
|
{
|
|
5774
6440
|
className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__summary-col`
|
|
5775
6441
|
},
|
|
5776
|
-
/* @__PURE__ */
|
|
5777
|
-
/* @__PURE__ */
|
|
5778
|
-
), /* @__PURE__ */
|
|
6442
|
+
/* @__PURE__ */ React81.createElement(ProfitAndLoss.DatePicker, null),
|
|
6443
|
+
/* @__PURE__ */ React81.createElement(ProfitAndLoss.Summaries, { vertical: true })
|
|
6444
|
+
), /* @__PURE__ */ React81.createElement(
|
|
5779
6445
|
"div",
|
|
5780
6446
|
{
|
|
5781
6447
|
className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__chart-col`
|
|
5782
6448
|
},
|
|
5783
|
-
/* @__PURE__ */
|
|
5784
|
-
)), !hideTable && /* @__PURE__ */
|
|
6449
|
+
/* @__PURE__ */ React81.createElement(ProfitAndLoss.Chart, null)
|
|
6450
|
+
)), !hideTable && /* @__PURE__ */ React81.createElement(ProfitAndLoss.Table, null));
|
|
5785
6451
|
};
|
|
5786
6452
|
|
|
5787
6453
|
// src/components/LedgerAccounts/LedgerAccounts.tsx
|
|
5788
|
-
import
|
|
6454
|
+
import React88, { createContext as createContext3, useContext as useContext12 } from "react";
|
|
5789
6455
|
|
|
5790
6456
|
// src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
|
|
5791
|
-
import { useState as
|
|
5792
|
-
import
|
|
6457
|
+
import { useState as useState17 } from "react";
|
|
6458
|
+
import useSWR6 from "swr";
|
|
6459
|
+
var validate = (formData) => {
|
|
6460
|
+
const errors = [];
|
|
6461
|
+
const nameError = validateName(formData);
|
|
6462
|
+
if (nameError) {
|
|
6463
|
+
errors.push(nameError);
|
|
6464
|
+
}
|
|
6465
|
+
return errors;
|
|
6466
|
+
};
|
|
6467
|
+
var revalidateField = (fieldName, formData) => {
|
|
6468
|
+
switch (fieldName) {
|
|
6469
|
+
case "name":
|
|
6470
|
+
const nameError = validateName(formData);
|
|
6471
|
+
if (nameError) {
|
|
6472
|
+
return (formData?.errors || []).filter((x) => x.field !== fieldName).concat([nameError]);
|
|
6473
|
+
}
|
|
6474
|
+
return (formData?.errors || []).filter((x) => x.field !== fieldName);
|
|
6475
|
+
default:
|
|
6476
|
+
return formData?.errors;
|
|
6477
|
+
}
|
|
6478
|
+
};
|
|
6479
|
+
var validateName = (formData) => {
|
|
6480
|
+
if (!formData?.data.name?.trim()) {
|
|
6481
|
+
return {
|
|
6482
|
+
field: "name",
|
|
6483
|
+
message: "Cannot be blank"
|
|
6484
|
+
};
|
|
6485
|
+
}
|
|
6486
|
+
return;
|
|
6487
|
+
};
|
|
5793
6488
|
var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.sub_accounts || [])]).flat().filter((id) => id);
|
|
5794
6489
|
var useLedgerAccounts = () => {
|
|
5795
6490
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
5796
|
-
const [form, setForm] =
|
|
5797
|
-
const [
|
|
5798
|
-
const
|
|
6491
|
+
const [form, setForm] = useState17();
|
|
6492
|
+
const [sendingForm, setSendingForm] = useState17(false);
|
|
6493
|
+
const [apiError, setApiError] = useState17(void 0);
|
|
6494
|
+
const [showARForAccountId, setShowARForAccountId] = useState17();
|
|
6495
|
+
const { data, isLoading, isValidating, error, mutate } = useSWR6(
|
|
5799
6496
|
businessId && auth?.access_token && `ledger-accounts-${businessId}`,
|
|
5800
6497
|
Layer.getLedgerAccounts(apiUrl, auth?.access_token, {
|
|
5801
6498
|
params: { businessId }
|
|
5802
6499
|
})
|
|
5803
6500
|
);
|
|
5804
|
-
const create = (newAccount) => {
|
|
5805
|
-
|
|
5806
|
-
|
|
5807
|
-
|
|
5808
|
-
|
|
6501
|
+
const create = async (newAccount) => {
|
|
6502
|
+
setSendingForm(true);
|
|
6503
|
+
setApiError(void 0);
|
|
6504
|
+
try {
|
|
6505
|
+
await Layer.createAccount(apiUrl, auth?.access_token, {
|
|
6506
|
+
params: { businessId },
|
|
6507
|
+
body: newAccount
|
|
6508
|
+
});
|
|
6509
|
+
await refetch();
|
|
6510
|
+
setForm(void 0);
|
|
6511
|
+
} catch (_err) {
|
|
6512
|
+
setApiError("Submit failed. Please, check your connection and try again.");
|
|
6513
|
+
} finally {
|
|
6514
|
+
setSendingForm(false);
|
|
6515
|
+
}
|
|
6516
|
+
};
|
|
6517
|
+
const update = async (accountData, accountId) => {
|
|
6518
|
+
setSendingForm(true);
|
|
6519
|
+
setApiError(void 0);
|
|
6520
|
+
const stable_name = convertToStableName(accountData.name);
|
|
6521
|
+
const newAccountData = {
|
|
6522
|
+
...accountData,
|
|
6523
|
+
stable_name,
|
|
6524
|
+
pnl_category: "INCOME",
|
|
6525
|
+
//this field will be deprecated soon, but is still required
|
|
6526
|
+
always_show_in_pnl: false
|
|
6527
|
+
//this field will be deprecated soon, but is still required
|
|
6528
|
+
};
|
|
6529
|
+
try {
|
|
6530
|
+
await Layer.updateAccount(apiUrl, auth?.access_token, {
|
|
6531
|
+
params: { businessId, accountId },
|
|
6532
|
+
body: newAccountData
|
|
6533
|
+
});
|
|
6534
|
+
await refetch();
|
|
6535
|
+
setForm(void 0);
|
|
6536
|
+
} catch (_err) {
|
|
6537
|
+
setApiError("Submit failed. Please, check your connection and try again.");
|
|
6538
|
+
} finally {
|
|
6539
|
+
setSendingForm(false);
|
|
6540
|
+
}
|
|
5809
6541
|
};
|
|
5810
6542
|
const submitForm = () => {
|
|
5811
6543
|
if (!form || !form.action) {
|
|
5812
6544
|
return;
|
|
5813
6545
|
}
|
|
6546
|
+
const errors = validate(form);
|
|
6547
|
+
if (errors.length > 0) {
|
|
6548
|
+
setForm({
|
|
6549
|
+
...form,
|
|
6550
|
+
errors
|
|
6551
|
+
});
|
|
6552
|
+
return;
|
|
6553
|
+
}
|
|
5814
6554
|
const data2 = {
|
|
5815
6555
|
name: form.data.name || "Test name",
|
|
5816
6556
|
normality: form.data.subType?.value,
|
|
@@ -5825,6 +6565,7 @@ var useLedgerAccounts = () => {
|
|
|
5825
6565
|
return;
|
|
5826
6566
|
}
|
|
5827
6567
|
if (form.action === "edit" && form.accountId) {
|
|
6568
|
+
update(data2, form.accountId);
|
|
5828
6569
|
return;
|
|
5829
6570
|
}
|
|
5830
6571
|
};
|
|
@@ -5874,12 +6615,17 @@ var useLedgerAccounts = () => {
|
|
|
5874
6615
|
if (!form) {
|
|
5875
6616
|
return;
|
|
5876
6617
|
}
|
|
5877
|
-
|
|
6618
|
+
const newFormData = {
|
|
5878
6619
|
...form,
|
|
5879
6620
|
data: {
|
|
5880
6621
|
...form.data,
|
|
5881
6622
|
[fieldName]: value
|
|
5882
6623
|
}
|
|
6624
|
+
};
|
|
6625
|
+
const errors = revalidateField(fieldName, newFormData);
|
|
6626
|
+
setForm({
|
|
6627
|
+
...newFormData,
|
|
6628
|
+
errors
|
|
5883
6629
|
});
|
|
5884
6630
|
};
|
|
5885
6631
|
const refetch = () => mutate();
|
|
@@ -5891,6 +6637,8 @@ var useLedgerAccounts = () => {
|
|
|
5891
6637
|
refetch,
|
|
5892
6638
|
create,
|
|
5893
6639
|
form,
|
|
6640
|
+
sendingForm,
|
|
6641
|
+
apiError,
|
|
5894
6642
|
addAccount,
|
|
5895
6643
|
editAccount,
|
|
5896
6644
|
cancelForm,
|
|
@@ -5902,8 +6650,8 @@ var useLedgerAccounts = () => {
|
|
|
5902
6650
|
};
|
|
5903
6651
|
|
|
5904
6652
|
// src/components/AccountsReceivable/AccountsReceivableIndex.tsx
|
|
5905
|
-
import
|
|
5906
|
-
import
|
|
6653
|
+
import React82, { useContext as useContext8, useMemo as useMemo7 } from "react";
|
|
6654
|
+
import classNames29 from "classnames";
|
|
5907
6655
|
import { parseISO as parseISO9, format as formatTime7 } from "date-fns";
|
|
5908
6656
|
var AccountsReceivable = () => {
|
|
5909
6657
|
const { data, showARForAccountId, setShowARForAccountId } = useContext8(
|
|
@@ -5914,33 +6662,33 @@ var AccountsReceivable = () => {
|
|
|
5914
6662
|
(x) => x.id === showARForAccountId
|
|
5915
6663
|
);
|
|
5916
6664
|
}, [showARForAccountId]);
|
|
5917
|
-
const baseClassName =
|
|
6665
|
+
const baseClassName = classNames29(
|
|
5918
6666
|
"Layer__accounts-receivable__index",
|
|
5919
6667
|
showARForAccountId && "open"
|
|
5920
6668
|
);
|
|
5921
6669
|
const close = () => setShowARForAccountId(void 0);
|
|
5922
|
-
return /* @__PURE__ */
|
|
6670
|
+
return /* @__PURE__ */ React82.createElement("div", { className: baseClassName }, /* @__PURE__ */ React82.createElement("div", { className: "Layer__accounts-receivable__header" }, /* @__PURE__ */ React82.createElement(BackButton, { onClick: close }), /* @__PURE__ */ React82.createElement("div", { className: "Layer__accounts-receivable__title-container" }, /* @__PURE__ */ React82.createElement(
|
|
5923
6671
|
Text,
|
|
5924
6672
|
{
|
|
5925
6673
|
weight: "bold" /* bold */,
|
|
5926
6674
|
className: "Layer__accounts-receivable__title"
|
|
5927
6675
|
},
|
|
5928
6676
|
entry?.name || ""
|
|
5929
|
-
), /* @__PURE__ */
|
|
6677
|
+
), /* @__PURE__ */ React82.createElement(
|
|
5930
6678
|
Button,
|
|
5931
6679
|
{
|
|
5932
6680
|
variant: "secondary" /* secondary */,
|
|
5933
|
-
rightIcon: /* @__PURE__ */
|
|
6681
|
+
rightIcon: /* @__PURE__ */ React82.createElement(DownloadCloud_default, { size: 12 })
|
|
5934
6682
|
},
|
|
5935
6683
|
"Download"
|
|
5936
|
-
)), /* @__PURE__ */
|
|
6684
|
+
)), /* @__PURE__ */ React82.createElement("div", { className: "Layer__accounts-receivable__balance-container" }, /* @__PURE__ */ React82.createElement(
|
|
5937
6685
|
Text,
|
|
5938
6686
|
{
|
|
5939
6687
|
weight: "bold" /* bold */,
|
|
5940
6688
|
className: "Layer__accounts-receivable__balance-label"
|
|
5941
6689
|
},
|
|
5942
6690
|
"Current balance"
|
|
5943
|
-
), /* @__PURE__ */
|
|
6691
|
+
), /* @__PURE__ */ React82.createElement(
|
|
5944
6692
|
Text,
|
|
5945
6693
|
{
|
|
5946
6694
|
weight: "bold" /* bold */,
|
|
@@ -5948,17 +6696,17 @@ var AccountsReceivable = () => {
|
|
|
5948
6696
|
},
|
|
5949
6697
|
"$",
|
|
5950
6698
|
centsToDollars(entry?.balance || 0)
|
|
5951
|
-
))), /* @__PURE__ */
|
|
5952
|
-
return /* @__PURE__ */
|
|
6699
|
+
))), /* @__PURE__ */ React82.createElement("table", { className: "Layer__table Layer__accounts-receivable-table" }, /* @__PURE__ */ React82.createElement("thead", null, /* @__PURE__ */ React82.createElement("tr", null, /* @__PURE__ */ React82.createElement("th", { className: "Layer__table-header" }, "Date"), /* @__PURE__ */ React82.createElement("th", { className: "Layer__table-header" }, "Journal id #"), /* @__PURE__ */ React82.createElement("th", { className: "Layer__table-header" }, "Source"), /* @__PURE__ */ React82.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Debit"), /* @__PURE__ */ React82.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Credit"), /* @__PURE__ */ React82.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Running balance"))), /* @__PURE__ */ React82.createElement("tbody", null, entry?.entries?.map((x) => {
|
|
6700
|
+
return /* @__PURE__ */ React82.createElement("tr", { key: x.id }, /* @__PURE__ */ React82.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React82.createElement("span", { className: "Layer__table-cell-content" }, x.createdAt && formatTime7(parseISO9(x.createdAt), DATE_FORMAT))), /* @__PURE__ */ React82.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React82.createElement("span", { className: "Layer__table-cell-content" }, "#123")), /* @__PURE__ */ React82.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React82.createElement("span", { className: "Layer__table-cell-content" }, "Invoice")), /* @__PURE__ */ React82.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, /* @__PURE__ */ React82.createElement("span", { className: "Layer__table-cell-content" }, x.direction, " $X,XXX.XX")), /* @__PURE__ */ React82.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, /* @__PURE__ */ React82.createElement("span", { className: "Layer__table-cell-content" }, "$X,XXX.XX")), /* @__PURE__ */ React82.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, /* @__PURE__ */ React82.createElement("span", { className: "Layer__table-cell-content" }, "$X,XXX.XX")));
|
|
5953
6701
|
}))));
|
|
5954
6702
|
};
|
|
5955
6703
|
|
|
5956
6704
|
// src/components/LedgerAccountsRow/LedgerAccountsRow.tsx
|
|
5957
|
-
import
|
|
6705
|
+
import React85, { useContext as useContext9, useEffect as useEffect11, useState as useState18 } from "react";
|
|
5958
6706
|
|
|
5959
6707
|
// src/icons/ArrowRightCircle.tsx
|
|
5960
|
-
import * as
|
|
5961
|
-
var ArrowRightCircle = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
6708
|
+
import * as React83 from "react";
|
|
6709
|
+
var ArrowRightCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React83.createElement(
|
|
5962
6710
|
"svg",
|
|
5963
6711
|
{
|
|
5964
6712
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5968,39 +6716,39 @@ var ArrowRightCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React77.crea
|
|
|
5968
6716
|
width: size,
|
|
5969
6717
|
height: size
|
|
5970
6718
|
},
|
|
5971
|
-
/* @__PURE__ */
|
|
6719
|
+
/* @__PURE__ */ React83.createElement(
|
|
5972
6720
|
"path",
|
|
5973
6721
|
{
|
|
5974
6722
|
d: "M9 16.5C13.1421 16.5 16.5 13.1421 16.5 9C16.5 4.85786 13.1421 1.5 9 1.5C4.85786 1.5 1.5 4.85786 1.5 9C1.5 13.1421 4.85786 16.5 9 16.5Z",
|
|
5975
6723
|
stroke: "currentColor",
|
|
5976
|
-
|
|
5977
|
-
|
|
6724
|
+
strokeLinecap: "round",
|
|
6725
|
+
strokeLinejoin: "round"
|
|
5978
6726
|
}
|
|
5979
6727
|
),
|
|
5980
|
-
/* @__PURE__ */
|
|
6728
|
+
/* @__PURE__ */ React83.createElement(
|
|
5981
6729
|
"path",
|
|
5982
6730
|
{
|
|
5983
6731
|
d: "M9 12L12 9L9 6",
|
|
5984
6732
|
stroke: "currentColor",
|
|
5985
|
-
|
|
5986
|
-
|
|
6733
|
+
strokeLinecap: "round",
|
|
6734
|
+
strokeLinejoin: "round"
|
|
5987
6735
|
}
|
|
5988
6736
|
),
|
|
5989
|
-
/* @__PURE__ */
|
|
6737
|
+
/* @__PURE__ */ React83.createElement(
|
|
5990
6738
|
"path",
|
|
5991
6739
|
{
|
|
5992
6740
|
d: "M6 9H12",
|
|
5993
6741
|
stroke: "currentColor",
|
|
5994
|
-
|
|
5995
|
-
|
|
6742
|
+
strokeLinecap: "round",
|
|
6743
|
+
strokeLinejoin: "round"
|
|
5996
6744
|
}
|
|
5997
6745
|
)
|
|
5998
6746
|
);
|
|
5999
6747
|
var ArrowRightCircle_default = ArrowRightCircle;
|
|
6000
6748
|
|
|
6001
6749
|
// src/icons/Edit2.tsx
|
|
6002
|
-
import * as
|
|
6003
|
-
var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
6750
|
+
import * as React84 from "react";
|
|
6751
|
+
var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React84.createElement(
|
|
6004
6752
|
"svg",
|
|
6005
6753
|
{
|
|
6006
6754
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6010,54 +6758,97 @@ var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React78.createElement(
|
|
|
6010
6758
|
width: size,
|
|
6011
6759
|
height: size
|
|
6012
6760
|
},
|
|
6013
|
-
/* @__PURE__ */
|
|
6761
|
+
/* @__PURE__ */ React84.createElement(
|
|
6014
6762
|
"path",
|
|
6015
6763
|
{
|
|
6016
6764
|
d: "M12.75 2.25C12.947 2.05301 13.1808 1.89676 13.4382 1.79015C13.6956 1.68355 13.9714 1.62868 14.25 1.62868C14.5286 1.62868 14.8044 1.68355 15.0618 1.79015C15.3192 1.89676 15.553 2.05301 15.75 2.25C15.947 2.44698 16.1032 2.68083 16.2098 2.9382C16.3165 3.19557 16.3713 3.47142 16.3713 3.75C16.3713 4.02857 16.3165 4.30442 16.2098 4.56179C16.1032 4.81916 15.947 5.05302 15.75 5.25L5.625 15.375L1.5 16.5L2.625 12.375L12.75 2.25Z",
|
|
6017
6765
|
stroke: "currentColor",
|
|
6018
|
-
|
|
6019
|
-
|
|
6766
|
+
strokeLinecap: "round",
|
|
6767
|
+
strokeLinejoin: "round"
|
|
6020
6768
|
}
|
|
6021
6769
|
)
|
|
6022
6770
|
);
|
|
6023
6771
|
var Edit2_default = Edit2;
|
|
6024
6772
|
|
|
6025
6773
|
// src/components/LedgerAccountsRow/LedgerAccountsRow.tsx
|
|
6026
|
-
import
|
|
6774
|
+
import classNames30 from "classnames";
|
|
6027
6775
|
var INDENTATION = 12;
|
|
6776
|
+
var EXPANDED_STYLE = {
|
|
6777
|
+
height: 52,
|
|
6778
|
+
paddingTop: 12,
|
|
6779
|
+
paddingBottom: 12,
|
|
6780
|
+
opacity: 1
|
|
6781
|
+
};
|
|
6782
|
+
var COLLAPSED_STYLE = {
|
|
6783
|
+
height: 0,
|
|
6784
|
+
paddingTop: 0,
|
|
6785
|
+
paddingBottom: 0,
|
|
6786
|
+
opacity: 0.5
|
|
6787
|
+
};
|
|
6028
6788
|
var LedgerAccountsRow = ({
|
|
6029
6789
|
account,
|
|
6030
|
-
depth = 0
|
|
6790
|
+
depth = 0,
|
|
6791
|
+
index,
|
|
6792
|
+
cumulativeIndex = 0,
|
|
6793
|
+
expanded = false,
|
|
6794
|
+
defaultOpen = false,
|
|
6795
|
+
acountsLength
|
|
6031
6796
|
}) => {
|
|
6032
6797
|
const { form, editAccount, setShowARForAccountId } = useContext9(
|
|
6033
6798
|
LedgerAccountsContext
|
|
6034
6799
|
);
|
|
6035
|
-
const [isOpen, setIsOpen] =
|
|
6036
|
-
const
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6800
|
+
const [isOpen, setIsOpen] = useState18(defaultOpen);
|
|
6801
|
+
const style = expanded ? {
|
|
6802
|
+
...EXPANDED_STYLE,
|
|
6803
|
+
transitionDelay: `${15 * index}ms`
|
|
6804
|
+
} : {
|
|
6805
|
+
...COLLAPSED_STYLE,
|
|
6806
|
+
transitionDelay: `${acountsLength - 15 * index}ms`
|
|
6807
|
+
};
|
|
6808
|
+
const [showComponent, setShowComponent] = useState18(false);
|
|
6809
|
+
useEffect11(() => {
|
|
6810
|
+
const timeoutId = setTimeout(() => {
|
|
6811
|
+
setShowComponent(true);
|
|
6812
|
+
}, cumulativeIndex * 50);
|
|
6813
|
+
return () => clearTimeout(timeoutId);
|
|
6814
|
+
}, []);
|
|
6815
|
+
const baseClass = classNames30(
|
|
6816
|
+
"Layer__table-row",
|
|
6817
|
+
isOpen ? "Layer__table-row--expanded" : "Layer__table-row--collapsed",
|
|
6818
|
+
!expanded && "Layer__table-row--hidden",
|
|
6819
|
+
`Layer__table-row--depth-${depth}`,
|
|
6820
|
+
form?.accountId === account.id && "Layer__table-row--active",
|
|
6821
|
+
!showComponent && "Layer__table-row--anim-starting-state"
|
|
6041
6822
|
);
|
|
6042
|
-
return /* @__PURE__ */
|
|
6043
|
-
"
|
|
6823
|
+
return /* @__PURE__ */ React85.createElement(React85.Fragment, null, /* @__PURE__ */ React85.createElement("tr", { className: baseClass, onClick: () => setIsOpen(!isOpen) }, /* @__PURE__ */ React85.createElement("td", { className: "Layer__table-cell Layer__coa__name" }, /* @__PURE__ */ React85.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React85.createElement(
|
|
6824
|
+
"span",
|
|
6044
6825
|
{
|
|
6045
|
-
className: "
|
|
6046
|
-
style: {
|
|
6826
|
+
className: "Layer__table-cell-content-indentation",
|
|
6827
|
+
style: {
|
|
6828
|
+
paddingLeft: INDENTATION * depth + 16
|
|
6829
|
+
}
|
|
6047
6830
|
},
|
|
6048
|
-
account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */
|
|
6831
|
+
account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ React85.createElement(
|
|
6049
6832
|
ChevronDownFill_default,
|
|
6050
6833
|
{
|
|
6051
6834
|
size: 16,
|
|
6052
|
-
className: "
|
|
6835
|
+
className: "Layer__table__expand-icon"
|
|
6053
6836
|
}
|
|
6054
6837
|
),
|
|
6055
|
-
/* @__PURE__ */
|
|
6056
|
-
), /* @__PURE__ */
|
|
6838
|
+
/* @__PURE__ */ React85.createElement("span", { className: "Layer__coa__name__text" }, account.name)
|
|
6839
|
+
))), /* @__PURE__ */ React85.createElement("td", { className: "Layer__table-cell Layer__coa__type" }, /* @__PURE__ */ React85.createElement("span", { className: "Layer__table-cell-content", style }, account.normality)), /* @__PURE__ */ React85.createElement("td", { className: "Layer__table-cell Layer__coa__subtype" }, /* @__PURE__ */ React85.createElement("span", { className: "Layer__table-cell-content", style }, "Sub-Type")), /* @__PURE__ */ React85.createElement("td", { className: "Layer__table-cell Layer__coa__balance" }, /* @__PURE__ */ React85.createElement(
|
|
6840
|
+
"span",
|
|
6841
|
+
{
|
|
6842
|
+
className: "Layer__table-cell-content Layer__table-cell--amount",
|
|
6843
|
+
style
|
|
6844
|
+
},
|
|
6845
|
+
"$",
|
|
6846
|
+
centsToDollars(Math.abs(account.balance || 0))
|
|
6847
|
+
)), /* @__PURE__ */ React85.createElement("td", { className: "Layer__table-cell Layer__coa__actions" }, /* @__PURE__ */ React85.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ React85.createElement(
|
|
6057
6848
|
Button,
|
|
6058
6849
|
{
|
|
6059
6850
|
variant: "secondary" /* secondary */,
|
|
6060
|
-
rightIcon: /* @__PURE__ */
|
|
6851
|
+
rightIcon: /* @__PURE__ */ React85.createElement(Edit2_default, { size: 12 }),
|
|
6061
6852
|
onClick: (e) => {
|
|
6062
6853
|
e.preventDefault();
|
|
6063
6854
|
e.stopPropagation();
|
|
@@ -6065,11 +6856,11 @@ var LedgerAccountsRow = ({
|
|
|
6065
6856
|
}
|
|
6066
6857
|
},
|
|
6067
6858
|
"Edit"
|
|
6068
|
-
), /* @__PURE__ */
|
|
6859
|
+
), /* @__PURE__ */ React85.createElement(
|
|
6069
6860
|
Button,
|
|
6070
6861
|
{
|
|
6071
6862
|
variant: "secondary" /* secondary */,
|
|
6072
|
-
rightIcon: /* @__PURE__ */
|
|
6863
|
+
rightIcon: /* @__PURE__ */ React85.createElement(ArrowRightCircle_default, { size: 12 }),
|
|
6073
6864
|
onClick: (e) => {
|
|
6074
6865
|
e.preventDefault();
|
|
6075
6866
|
e.stopPropagation();
|
|
@@ -6077,21 +6868,25 @@ var LedgerAccountsRow = ({
|
|
|
6077
6868
|
}
|
|
6078
6869
|
},
|
|
6079
6870
|
"Open"
|
|
6080
|
-
))),
|
|
6871
|
+
)))), (account.sub_accounts || []).map((subAccount, idx) => /* @__PURE__ */ React85.createElement(
|
|
6081
6872
|
LedgerAccountsRow,
|
|
6082
6873
|
{
|
|
6083
6874
|
key: subAccount.id,
|
|
6084
6875
|
account: subAccount,
|
|
6085
|
-
depth: depth + 1
|
|
6876
|
+
depth: depth + 1,
|
|
6877
|
+
index: idx,
|
|
6878
|
+
expanded: isOpen && expanded,
|
|
6879
|
+
cumulativeIndex: cumulativeIndex + idx + 1,
|
|
6880
|
+
acountsLength: (account.sub_accounts ?? []).length
|
|
6086
6881
|
}
|
|
6087
6882
|
)));
|
|
6088
6883
|
};
|
|
6089
6884
|
|
|
6090
6885
|
// src/components/LedgerAccountsSidebar/LedgerAccountsSidebar.tsx
|
|
6091
|
-
import
|
|
6886
|
+
import React87, { useContext as useContext11 } from "react";
|
|
6092
6887
|
|
|
6093
6888
|
// src/components/LedgerAccountsForm/LedgerAccountsForm.tsx
|
|
6094
|
-
import
|
|
6889
|
+
import React86, { useContext as useContext10, useMemo as useMemo8 } from "react";
|
|
6095
6890
|
var SUB_TYPE_OPTIONS = [
|
|
6096
6891
|
{
|
|
6097
6892
|
value: "DEBIT" /* DEBIT */,
|
|
@@ -6103,9 +6898,15 @@ var SUB_TYPE_OPTIONS = [
|
|
|
6103
6898
|
}
|
|
6104
6899
|
];
|
|
6105
6900
|
var LedgerAccountsForm = () => {
|
|
6106
|
-
const {
|
|
6107
|
-
|
|
6108
|
-
|
|
6901
|
+
const {
|
|
6902
|
+
form,
|
|
6903
|
+
data,
|
|
6904
|
+
changeFormData,
|
|
6905
|
+
cancelForm,
|
|
6906
|
+
submitForm,
|
|
6907
|
+
sendingForm,
|
|
6908
|
+
apiError
|
|
6909
|
+
} = useContext10(LedgerAccountsContext);
|
|
6109
6910
|
const parentOptions = useMemo8(
|
|
6110
6911
|
() => flattenAccounts(data?.accounts || []).sort((a, b) => a?.name && b?.name ? a.name.localeCompare(b.name) : 0).map((x) => {
|
|
6111
6912
|
return {
|
|
@@ -6123,81 +6924,115 @@ var LedgerAccountsForm = () => {
|
|
|
6123
6924
|
}
|
|
6124
6925
|
return;
|
|
6125
6926
|
}, [data, form?.accountId]);
|
|
6126
|
-
console.log(entry);
|
|
6127
6927
|
if (!form) {
|
|
6128
6928
|
return;
|
|
6129
6929
|
}
|
|
6130
|
-
return /* @__PURE__ */
|
|
6930
|
+
return /* @__PURE__ */ React86.createElement(
|
|
6131
6931
|
"form",
|
|
6132
6932
|
{
|
|
6933
|
+
className: "Layer__form",
|
|
6133
6934
|
onSubmit: (e) => {
|
|
6134
6935
|
e.preventDefault();
|
|
6135
6936
|
submitForm();
|
|
6136
6937
|
}
|
|
6137
6938
|
},
|
|
6138
|
-
/* @__PURE__ */
|
|
6939
|
+
/* @__PURE__ */ React86.createElement("div", { className: "Layer__ledger-accounts__sidebar__header" }, /* @__PURE__ */ React86.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, form?.action === "edit" ? "Edit" : "Add New", " Account"), /* @__PURE__ */ React86.createElement("div", { className: "actions" }, /* @__PURE__ */ React86.createElement(
|
|
6139
6940
|
Button,
|
|
6140
6941
|
{
|
|
6141
6942
|
type: "button",
|
|
6142
6943
|
onClick: cancelForm,
|
|
6143
|
-
variant: "secondary" /* secondary
|
|
6944
|
+
variant: "secondary" /* secondary */,
|
|
6945
|
+
disabled: sendingForm
|
|
6144
6946
|
},
|
|
6145
6947
|
"Cancel"
|
|
6146
|
-
), /* @__PURE__ */
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
|
|
6948
|
+
), apiError && /* @__PURE__ */ React86.createElement(
|
|
6949
|
+
RetryButton,
|
|
6950
|
+
{
|
|
6951
|
+
type: "submit",
|
|
6952
|
+
processing: sendingForm,
|
|
6953
|
+
error: "Check connection and retry in few seconds.",
|
|
6954
|
+
disabled: sendingForm
|
|
6955
|
+
},
|
|
6956
|
+
"Retry"
|
|
6957
|
+
), !apiError && /* @__PURE__ */ React86.createElement(
|
|
6958
|
+
SubmitButton,
|
|
6959
|
+
{
|
|
6960
|
+
type: "submit",
|
|
6961
|
+
noIcon: true,
|
|
6962
|
+
active: true,
|
|
6963
|
+
disabled: sendingForm
|
|
6964
|
+
},
|
|
6965
|
+
"Save"
|
|
6966
|
+
))),
|
|
6967
|
+
apiError && /* @__PURE__ */ React86.createElement(
|
|
6968
|
+
Text,
|
|
6969
|
+
{
|
|
6970
|
+
size: "sm" /* sm */,
|
|
6971
|
+
className: "Layer__ledger-accounts__form__error-message"
|
|
6972
|
+
},
|
|
6973
|
+
apiError
|
|
6974
|
+
),
|
|
6975
|
+
entry && /* @__PURE__ */ React86.createElement("div", { className: "Layer__ledger-accounts__form-edit-entry" }, /* @__PURE__ */ React86.createElement(Text, { weight: "bold" /* bold */ }, entry.name), /* @__PURE__ */ React86.createElement(Text, { weight: "bold" /* bold */ }, "$", centsToDollars(entry.balance || 0))),
|
|
6976
|
+
/* @__PURE__ */ React86.createElement("div", { className: "Layer__ledger-accounts__form" }, /* @__PURE__ */ React86.createElement(InputGroup, { name: "parent", label: "Parent", inline: true }, /* @__PURE__ */ React86.createElement(
|
|
6977
|
+
Select2,
|
|
6150
6978
|
{
|
|
6151
6979
|
options: parentOptions,
|
|
6152
6980
|
value: form?.data.parent,
|
|
6153
|
-
onChange: (sel) => changeFormData("parent", sel)
|
|
6981
|
+
onChange: (sel) => changeFormData("parent", sel),
|
|
6982
|
+
disabled: sendingForm
|
|
6154
6983
|
}
|
|
6155
|
-
)), /* @__PURE__ */
|
|
6984
|
+
)), /* @__PURE__ */ React86.createElement(InputGroup, { name: "name", label: "Name", inline: true }, /* @__PURE__ */ React86.createElement(
|
|
6156
6985
|
Input,
|
|
6157
6986
|
{
|
|
6158
6987
|
name: "name",
|
|
6988
|
+
placeholder: "Enter name...",
|
|
6159
6989
|
value: form?.data.name,
|
|
6990
|
+
isInvalid: Boolean(form?.errors?.find((x) => x.field === "name")),
|
|
6991
|
+
errorMessage: form?.errors?.find((x) => x.field === "name")?.message,
|
|
6992
|
+
disabled: sendingForm,
|
|
6160
6993
|
onChange: (e) => changeFormData("name", e.target.value)
|
|
6161
6994
|
}
|
|
6162
|
-
)), /* @__PURE__ */
|
|
6163
|
-
|
|
6995
|
+
)), /* @__PURE__ */ React86.createElement(InputGroup, { name: "type", label: "Type", inline: true }, /* @__PURE__ */ React86.createElement(
|
|
6996
|
+
Select2,
|
|
6164
6997
|
{
|
|
6165
6998
|
options: [],
|
|
6166
6999
|
disabled: true,
|
|
6167
7000
|
value: form?.data.type,
|
|
6168
7001
|
onChange: (sel) => changeFormData("type", sel)
|
|
6169
7002
|
}
|
|
6170
|
-
)), /* @__PURE__ */
|
|
6171
|
-
|
|
7003
|
+
)), /* @__PURE__ */ React86.createElement(InputGroup, { name: "subType", label: "Sub-Type", inline: true }, /* @__PURE__ */ React86.createElement(
|
|
7004
|
+
Select2,
|
|
6172
7005
|
{
|
|
6173
7006
|
options: SUB_TYPE_OPTIONS,
|
|
6174
7007
|
value: form?.data.subType,
|
|
6175
|
-
onChange: (sel) => changeFormData("subType", sel)
|
|
7008
|
+
onChange: (sel) => changeFormData("subType", sel),
|
|
7009
|
+
disabled: sendingForm
|
|
6176
7010
|
}
|
|
6177
|
-
)), /* @__PURE__ */
|
|
6178
|
-
|
|
7011
|
+
)), /* @__PURE__ */ React86.createElement(InputGroup, { name: "category", label: "Category", inline: true }, /* @__PURE__ */ React86.createElement(
|
|
7012
|
+
Select2,
|
|
6179
7013
|
{
|
|
6180
7014
|
options: [],
|
|
6181
7015
|
value: form?.data.category,
|
|
6182
|
-
onChange: (sel) => changeFormData("category", sel)
|
|
7016
|
+
onChange: (sel) => changeFormData("category", sel),
|
|
7017
|
+
disabled: sendingForm
|
|
6183
7018
|
}
|
|
6184
7019
|
)))
|
|
6185
7020
|
);
|
|
6186
7021
|
};
|
|
6187
7022
|
|
|
6188
7023
|
// src/components/LedgerAccountsSidebar/LedgerAccountsSidebar.tsx
|
|
6189
|
-
import
|
|
7024
|
+
import classNames31 from "classnames";
|
|
6190
7025
|
var LedgerAccountsSidebar = () => {
|
|
6191
7026
|
const { form } = useContext11(LedgerAccountsContext);
|
|
6192
|
-
return /* @__PURE__ */
|
|
7027
|
+
return /* @__PURE__ */ React87.createElement(
|
|
6193
7028
|
"div",
|
|
6194
7029
|
{
|
|
6195
|
-
className:
|
|
7030
|
+
className: classNames31(
|
|
6196
7031
|
"Layer__ledger-accounts__sidebar",
|
|
6197
7032
|
form ? "open" : ""
|
|
6198
7033
|
)
|
|
6199
7034
|
},
|
|
6200
|
-
/* @__PURE__ */
|
|
7035
|
+
/* @__PURE__ */ React87.createElement("div", { className: "Layer__ledger-accounts__sidebar-content" }, /* @__PURE__ */ React87.createElement(LedgerAccountsForm, null))
|
|
6201
7036
|
);
|
|
6202
7037
|
};
|
|
6203
7038
|
|
|
@@ -6213,6 +7048,8 @@ var LedgerAccountsContext = createContext3({
|
|
|
6213
7048
|
create: () => {
|
|
6214
7049
|
},
|
|
6215
7050
|
form: void 0,
|
|
7051
|
+
sendingForm: false,
|
|
7052
|
+
apiError: void 0,
|
|
6216
7053
|
addAccount: () => {
|
|
6217
7054
|
},
|
|
6218
7055
|
editAccount: () => {
|
|
@@ -6229,19 +7066,37 @@ var LedgerAccountsContext = createContext3({
|
|
|
6229
7066
|
});
|
|
6230
7067
|
var LedgerAccounts = () => {
|
|
6231
7068
|
const contextData = useLedgerAccounts();
|
|
6232
|
-
return /* @__PURE__ */
|
|
7069
|
+
return /* @__PURE__ */ React88.createElement(LedgerAccountsContext.Provider, { value: contextData }, /* @__PURE__ */ React88.createElement(LedgerAccountsContent, null));
|
|
6233
7070
|
};
|
|
6234
7071
|
var LedgerAccountsContent = () => {
|
|
6235
7072
|
const { data, isLoading, addAccount, error, isValidating, refetch } = useContext12(LedgerAccountsContext);
|
|
6236
|
-
|
|
7073
|
+
let cumulativeIndex = 0;
|
|
7074
|
+
const accountsLength = data?.accounts.length ?? 0;
|
|
7075
|
+
return /* @__PURE__ */ React88.createElement(Container, { name: COMPONENT_NAME4 }, /* @__PURE__ */ React88.createElement("div", { className: `Layer__${COMPONENT_NAME4}__main-panel` }, /* @__PURE__ */ React88.createElement(Header, { className: `Layer__${COMPONENT_NAME4}__header` }, /* @__PURE__ */ React88.createElement(Heading, { className: `Layer__${COMPONENT_NAME4}__title` }, "Chart of Accounts"), /* @__PURE__ */ React88.createElement("div", { className: `Layer__${COMPONENT_NAME4}__actions` }, /* @__PURE__ */ React88.createElement(
|
|
6237
7076
|
Button,
|
|
6238
7077
|
{
|
|
6239
7078
|
variant: "secondary" /* secondary */,
|
|
6240
7079
|
disabled: isLoading,
|
|
6241
|
-
rightIcon: /* @__PURE__ */
|
|
7080
|
+
rightIcon: /* @__PURE__ */ React88.createElement(DownloadCloud_default, { size: 12 })
|
|
6242
7081
|
},
|
|
6243
7082
|
"Download"
|
|
6244
|
-
), /* @__PURE__ */
|
|
7083
|
+
), /* @__PURE__ */ React88.createElement(Button, { onClick: () => addAccount(), disabled: isLoading }, "Add Account"))), /* @__PURE__ */ React88.createElement("table", { className: `Layer__${COMPONENT_NAME4}__table` }, /* @__PURE__ */ React88.createElement("thead", null, /* @__PURE__ */ React88.createElement("tr", { className: "Layer__table-row--header" }, /* @__PURE__ */ React88.createElement("th", { className: "Layer__table-header Layer__coa__name" }, "Name"), /* @__PURE__ */ React88.createElement("th", { className: "Layer__table-header Layer__coa__type" }, "Type"), /* @__PURE__ */ React88.createElement("th", { className: "Layer__table-header Layer__coa__subtype" }, "Sub-Type"), /* @__PURE__ */ React88.createElement("th", { className: "Layer__table-header Layer__coa__balance" }, "Balance"), /* @__PURE__ */ React88.createElement("th", { className: "Layer__table-header Layer__coa__actions" }))), /* @__PURE__ */ React88.createElement("tbody", null, !error && data?.accounts.map((account, idx) => {
|
|
7084
|
+
const currentCumulativeIndex = cumulativeIndex;
|
|
7085
|
+
cumulativeIndex = (account.sub_accounts?.length || 0) + cumulativeIndex + 1;
|
|
7086
|
+
return /* @__PURE__ */ React88.createElement(
|
|
7087
|
+
LedgerAccountsRow,
|
|
7088
|
+
{
|
|
7089
|
+
key: account.id,
|
|
7090
|
+
account,
|
|
7091
|
+
depth: 0,
|
|
7092
|
+
index: idx,
|
|
7093
|
+
cumulativeIndex: currentCumulativeIndex,
|
|
7094
|
+
expanded: true,
|
|
7095
|
+
defaultOpen: true,
|
|
7096
|
+
acountsLength: accountsLength
|
|
7097
|
+
}
|
|
7098
|
+
);
|
|
7099
|
+
}))), error ? /* @__PURE__ */ React88.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React88.createElement(
|
|
6245
7100
|
DataState,
|
|
6246
7101
|
{
|
|
6247
7102
|
status: "failed" /* failed */,
|
|
@@ -6250,7 +7105,7 @@ var LedgerAccountsContent = () => {
|
|
|
6250
7105
|
onRefresh: () => refetch(),
|
|
6251
7106
|
isLoading: isValidating || isLoading
|
|
6252
7107
|
}
|
|
6253
|
-
)) : null, (!data || isLoading) && !error ? /* @__PURE__ */
|
|
7108
|
+
)) : null, (!data || isLoading) && !error ? /* @__PURE__ */ React88.createElement("div", { className: `Layer__${COMPONENT_NAME4}__loader-container` }, /* @__PURE__ */ React88.createElement(Loader2, null)) : null, !isLoading && !error && data?.accounts.length === 0 ? /* @__PURE__ */ React88.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React88.createElement(
|
|
6254
7109
|
DataState,
|
|
6255
7110
|
{
|
|
6256
7111
|
status: "info" /* info */,
|
|
@@ -6259,13 +7114,13 @@ var LedgerAccountsContent = () => {
|
|
|
6259
7114
|
onRefresh: () => refetch(),
|
|
6260
7115
|
isLoading: isValidating
|
|
6261
7116
|
}
|
|
6262
|
-
)) : null)
|
|
7117
|
+
)) : null), /* @__PURE__ */ React88.createElement(LedgerAccountsSidebar, null), /* @__PURE__ */ React88.createElement(AccountsReceivable, null));
|
|
6263
7118
|
};
|
|
6264
7119
|
|
|
6265
7120
|
// src/providers/LayerProvider/LayerProvider.tsx
|
|
6266
|
-
import
|
|
7121
|
+
import React89, { useReducer, useEffect as useEffect12 } from "react";
|
|
6267
7122
|
import { add as add2, isBefore } from "date-fns";
|
|
6268
|
-
import
|
|
7123
|
+
import useSWR7, { SWRConfig } from "swr";
|
|
6269
7124
|
var reducer = (state, action) => {
|
|
6270
7125
|
switch (action.type) {
|
|
6271
7126
|
case "LayerContext.setAuth" /* setAuth */:
|
|
@@ -6318,7 +7173,7 @@ var LayerProvider = ({
|
|
|
6318
7173
|
theme,
|
|
6319
7174
|
colors
|
|
6320
7175
|
});
|
|
6321
|
-
const { data: auth } = appId !== void 0 && appSecret !== void 0 ?
|
|
7176
|
+
const { data: auth } = appId !== void 0 && appSecret !== void 0 ? useSWR7(
|
|
6322
7177
|
businessAccessToken === void 0 && appId !== void 0 && appSecret !== void 0 && isBefore(state.auth.expires_at, /* @__PURE__ */ new Date()) && "authenticate",
|
|
6323
7178
|
Layer.authenticate({
|
|
6324
7179
|
appId,
|
|
@@ -6328,7 +7183,7 @@ var LayerProvider = ({
|
|
|
6328
7183
|
}),
|
|
6329
7184
|
defaultSWRConfig
|
|
6330
7185
|
) : { data: void 0 };
|
|
6331
|
-
|
|
7186
|
+
useEffect12(() => {
|
|
6332
7187
|
if (businessAccessToken) {
|
|
6333
7188
|
dispatch({
|
|
6334
7189
|
type: "LayerContext.setAuth" /* setAuth */,
|
|
@@ -6353,7 +7208,7 @@ var LayerProvider = ({
|
|
|
6353
7208
|
});
|
|
6354
7209
|
}
|
|
6355
7210
|
}, [businessAccessToken, auth?.access_token]);
|
|
6356
|
-
|
|
7211
|
+
useSWR7(
|
|
6357
7212
|
businessId && auth?.access_token && `categories-${businessId}`,
|
|
6358
7213
|
Layer.getCategories(apiUrl, auth?.access_token, { params: { businessId } }),
|
|
6359
7214
|
{
|
|
@@ -6378,7 +7233,7 @@ var LayerProvider = ({
|
|
|
6378
7233
|
}
|
|
6379
7234
|
return;
|
|
6380
7235
|
};
|
|
6381
|
-
return /* @__PURE__ */
|
|
7236
|
+
return /* @__PURE__ */ React89.createElement(SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ React89.createElement(LayerContext.Provider, { value: { ...state, setTheme, getColor } }, children));
|
|
6382
7237
|
};
|
|
6383
7238
|
export {
|
|
6384
7239
|
BalanceSheet,
|