@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/index.js
CHANGED
|
@@ -304,6 +304,11 @@ var matchBankTransaction = put(
|
|
|
304
304
|
// src/api/layer/categories.ts
|
|
305
305
|
var getCategories = get(({ businessId }) => `/v1/businesses/${businessId}/categories`);
|
|
306
306
|
|
|
307
|
+
// src/api/layer/linked_accounts.ts
|
|
308
|
+
var getLinkedAccounts = get(
|
|
309
|
+
({ businessId }) => `/v1/businesses/${businessId}/external-accounts`
|
|
310
|
+
);
|
|
311
|
+
|
|
307
312
|
// src/api/layer/ledger_accounts.ts
|
|
308
313
|
var getLedgerAccounts = get(
|
|
309
314
|
({ businessId }) => `/v1/businesses/${businessId}/ledger/accounts`
|
|
@@ -311,6 +316,9 @@ var getLedgerAccounts = get(
|
|
|
311
316
|
var createAccount = post(
|
|
312
317
|
({ businessId }) => `/v1/businesses/${businessId}/ledger/accounts`
|
|
313
318
|
);
|
|
319
|
+
var updateAccount = put(
|
|
320
|
+
({ businessId, accountId }) => `/v1/businesses/${businessId}/ledger/accounts/${accountId}`
|
|
321
|
+
);
|
|
314
322
|
|
|
315
323
|
// src/api/layer/profit_and_loss.ts
|
|
316
324
|
var getProfitAndLoss = get(
|
|
@@ -323,11 +331,13 @@ var Layer = {
|
|
|
323
331
|
categorizeBankTransaction,
|
|
324
332
|
matchBankTransaction,
|
|
325
333
|
createAccount,
|
|
334
|
+
updateAccount,
|
|
326
335
|
getBalanceSheet,
|
|
327
336
|
getBankTransactions,
|
|
328
337
|
getCategories,
|
|
329
338
|
getLedgerAccounts,
|
|
330
|
-
getProfitAndLoss
|
|
339
|
+
getProfitAndLoss,
|
|
340
|
+
getLinkedAccounts
|
|
331
341
|
};
|
|
332
342
|
|
|
333
343
|
// src/hooks/useLayerContext/useLayerContext.tsx
|
|
@@ -778,6 +788,7 @@ var debounce = (fnc, timeout = 300) => {
|
|
|
778
788
|
}, timeout);
|
|
779
789
|
};
|
|
780
790
|
};
|
|
791
|
+
var convertToStableName = (name) => name.replace(/[`~!@#$%^&*()_|+\-=?;:'",.<>\{\}\[\]\\\/]/gi, "").replace(/\W+/g, " ").split(/ |\B(?=[A-Z])/).map((word) => word.toLowerCase()).join("_");
|
|
781
792
|
|
|
782
793
|
// src/components/BankTransactionListItem/BankTransactionListItem.tsx
|
|
783
794
|
var import_react36 = __toESM(require("react"));
|
|
@@ -983,7 +994,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React10.createElemen
|
|
|
983
994
|
var Scissors_default = Scissors;
|
|
984
995
|
|
|
985
996
|
// src/components/Badge/Badge.tsx
|
|
986
|
-
var
|
|
997
|
+
var import_react18 = __toESM(require("react"));
|
|
987
998
|
|
|
988
999
|
// src/components/Button/Button.tsx
|
|
989
1000
|
var import_react8 = __toESM(require("react"));
|
|
@@ -1502,8 +1513,47 @@ var TextButton = ({
|
|
|
1502
1513
|
return /* @__PURE__ */ import_react16.default.createElement("button", { ...props, className: baseClassName }, children);
|
|
1503
1514
|
};
|
|
1504
1515
|
|
|
1505
|
-
// src/components/
|
|
1516
|
+
// src/components/Button/BackButton.tsx
|
|
1517
|
+
var import_react17 = __toESM(require("react"));
|
|
1518
|
+
|
|
1519
|
+
// src/icons/BackArrow.tsx
|
|
1520
|
+
var React22 = __toESM(require("react"));
|
|
1521
|
+
var BackArrow = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createElement(
|
|
1522
|
+
"svg",
|
|
1523
|
+
{
|
|
1524
|
+
viewBox: "0 0 12 12",
|
|
1525
|
+
fill: "none",
|
|
1526
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1527
|
+
...props,
|
|
1528
|
+
width: size,
|
|
1529
|
+
height: size
|
|
1530
|
+
},
|
|
1531
|
+
/* @__PURE__ */ React22.createElement(
|
|
1532
|
+
"path",
|
|
1533
|
+
{
|
|
1534
|
+
d: "M7.375 8.75L4.625 6L7.375 3.25",
|
|
1535
|
+
stroke: "#1A130D",
|
|
1536
|
+
strokeLinecap: "round",
|
|
1537
|
+
strokeLinejoin: "round"
|
|
1538
|
+
}
|
|
1539
|
+
)
|
|
1540
|
+
);
|
|
1541
|
+
var BackArrow_default = BackArrow;
|
|
1542
|
+
|
|
1543
|
+
// src/components/Button/BackButton.tsx
|
|
1506
1544
|
var import_classnames6 = __toESM(require("classnames"));
|
|
1545
|
+
var BackButton = ({
|
|
1546
|
+
className,
|
|
1547
|
+
children,
|
|
1548
|
+
textOnly = false,
|
|
1549
|
+
...props
|
|
1550
|
+
}) => {
|
|
1551
|
+
const baseClassName = (0, import_classnames6.default)("Layer__btn", "Layer__back-btn", className);
|
|
1552
|
+
return /* @__PURE__ */ import_react17.default.createElement("button", { ...props, className: baseClassName }, textOnly ? "Back" : /* @__PURE__ */ import_react17.default.createElement(BackArrow_default, { size: 16 }));
|
|
1553
|
+
};
|
|
1554
|
+
|
|
1555
|
+
// src/components/Badge/Badge.tsx
|
|
1556
|
+
var import_classnames7 = __toESM(require("classnames"));
|
|
1507
1557
|
var Badge = ({
|
|
1508
1558
|
icon,
|
|
1509
1559
|
onClick,
|
|
@@ -1512,7 +1562,7 @@ var Badge = ({
|
|
|
1512
1562
|
size = "medium" /* MEDIUM */
|
|
1513
1563
|
}) => {
|
|
1514
1564
|
const baseProps = {
|
|
1515
|
-
className: (0,
|
|
1565
|
+
className: (0, import_classnames7.default)(
|
|
1516
1566
|
"Layer__badge",
|
|
1517
1567
|
onClick || tooltip ? "Layer__badge--clickable" : "",
|
|
1518
1568
|
`Layer__badge--${size}`
|
|
@@ -1520,21 +1570,21 @@ var Badge = ({
|
|
|
1520
1570
|
onClick,
|
|
1521
1571
|
children
|
|
1522
1572
|
};
|
|
1523
|
-
let content = /* @__PURE__ */
|
|
1524
|
-
content = onClick ? /* @__PURE__ */
|
|
1573
|
+
let content = /* @__PURE__ */ import_react18.default.createElement(import_react18.default.Fragment, null, icon && /* @__PURE__ */ import_react18.default.createElement("span", { className: "Layer__badge__icon" }, icon), children);
|
|
1574
|
+
content = onClick ? /* @__PURE__ */ import_react18.default.createElement(Button, { ...baseProps }, content) : /* @__PURE__ */ import_react18.default.createElement("span", { ...baseProps }, content);
|
|
1525
1575
|
if (tooltip) {
|
|
1526
|
-
return /* @__PURE__ */
|
|
1576
|
+
return /* @__PURE__ */ import_react18.default.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ import_react18.default.createElement(TooltipTrigger, null, content), /* @__PURE__ */ import_react18.default.createElement(TooltipContent, { className: "Layer__tooltip" }, tooltip));
|
|
1527
1577
|
}
|
|
1528
1578
|
return content;
|
|
1529
1579
|
};
|
|
1530
1580
|
|
|
1531
1581
|
// src/components/CategorySelect/CategorySelect.tsx
|
|
1532
|
-
var
|
|
1582
|
+
var import_react19 = __toESM(require("react"));
|
|
1533
1583
|
var import_react_select = __toESM(require("react-select"));
|
|
1534
1584
|
|
|
1535
1585
|
// src/icons/Check.tsx
|
|
1536
|
-
var
|
|
1537
|
-
var Check = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
1586
|
+
var React25 = __toESM(require("react"));
|
|
1587
|
+
var Check = ({ size = 18, ...props }) => /* @__PURE__ */ React25.createElement(
|
|
1538
1588
|
"svg",
|
|
1539
1589
|
{
|
|
1540
1590
|
viewBox: "0 0 18 18",
|
|
@@ -1544,7 +1594,7 @@ var Check = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createElement(
|
|
|
1544
1594
|
width: size,
|
|
1545
1595
|
height: size
|
|
1546
1596
|
},
|
|
1547
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ React25.createElement(
|
|
1548
1598
|
"path",
|
|
1549
1599
|
{
|
|
1550
1600
|
d: "M15 4.5L6.75 12.75L3 9",
|
|
@@ -1557,8 +1607,8 @@ var Check = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createElement(
|
|
|
1557
1607
|
var Check_default = Check;
|
|
1558
1608
|
|
|
1559
1609
|
// src/icons/MinimizeTwo.tsx
|
|
1560
|
-
var
|
|
1561
|
-
var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
1610
|
+
var React26 = __toESM(require("react"));
|
|
1611
|
+
var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React26.createElement(
|
|
1562
1612
|
"svg",
|
|
1563
1613
|
{
|
|
1564
1614
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1568,7 +1618,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createEle
|
|
|
1568
1618
|
width: size,
|
|
1569
1619
|
height: size
|
|
1570
1620
|
},
|
|
1571
|
-
/* @__PURE__ */
|
|
1621
|
+
/* @__PURE__ */ React26.createElement(
|
|
1572
1622
|
"path",
|
|
1573
1623
|
{
|
|
1574
1624
|
d: "M3 10.5H7.5V15",
|
|
@@ -1577,7 +1627,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createEle
|
|
|
1577
1627
|
strokeLinejoin: "round"
|
|
1578
1628
|
}
|
|
1579
1629
|
),
|
|
1580
|
-
/* @__PURE__ */
|
|
1630
|
+
/* @__PURE__ */ React26.createElement(
|
|
1581
1631
|
"path",
|
|
1582
1632
|
{
|
|
1583
1633
|
d: "M15 7.5H10.5V3",
|
|
@@ -1586,7 +1636,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createEle
|
|
|
1586
1636
|
strokeLinejoin: "round"
|
|
1587
1637
|
}
|
|
1588
1638
|
),
|
|
1589
|
-
/* @__PURE__ */
|
|
1639
|
+
/* @__PURE__ */ React26.createElement(
|
|
1590
1640
|
"path",
|
|
1591
1641
|
{
|
|
1592
1642
|
d: "M10.5 7.5L15.75 2.25",
|
|
@@ -1595,7 +1645,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createEle
|
|
|
1595
1645
|
strokeLinejoin: "round"
|
|
1596
1646
|
}
|
|
1597
1647
|
),
|
|
1598
|
-
/* @__PURE__ */
|
|
1648
|
+
/* @__PURE__ */ React26.createElement(
|
|
1599
1649
|
"path",
|
|
1600
1650
|
{
|
|
1601
1651
|
d: "M2.25 15.75L7.5 10.5",
|
|
@@ -1608,7 +1658,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createEle
|
|
|
1608
1658
|
var MinimizeTwo_default = MinimizeTwo;
|
|
1609
1659
|
|
|
1610
1660
|
// src/components/CategorySelect/CategorySelect.tsx
|
|
1611
|
-
var
|
|
1661
|
+
var import_classnames8 = __toESM(require("classnames"));
|
|
1612
1662
|
var import_date_fns4 = require("date-fns");
|
|
1613
1663
|
var mapCategoryToOption = (category) => {
|
|
1614
1664
|
return {
|
|
@@ -1636,13 +1686,13 @@ var mapSuggestedMatchToOption = (record) => {
|
|
|
1636
1686
|
};
|
|
1637
1687
|
};
|
|
1638
1688
|
var DropdownIndicator = (props) => {
|
|
1639
|
-
return /* @__PURE__ */
|
|
1689
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_react_select.components.DropdownIndicator, { ...props }, /* @__PURE__ */ import_react19.default.createElement(ChevronDown_default, null));
|
|
1640
1690
|
};
|
|
1641
1691
|
var GroupHeading = (props) => {
|
|
1642
|
-
return /* @__PURE__ */
|
|
1692
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1643
1693
|
import_react_select.components.GroupHeading,
|
|
1644
1694
|
{
|
|
1645
|
-
className: (0,
|
|
1695
|
+
className: (0, import_classnames8.default)(
|
|
1646
1696
|
props.className,
|
|
1647
1697
|
props.children === "Match" || props.children === "All categories" ? "Layer__select__group-heading--main" : ""
|
|
1648
1698
|
),
|
|
@@ -1655,24 +1705,24 @@ var Option = (props) => {
|
|
|
1655
1705
|
return;
|
|
1656
1706
|
}
|
|
1657
1707
|
if (props.data.type === "match") {
|
|
1658
|
-
return /* @__PURE__ */
|
|
1708
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1659
1709
|
import_react_select.components.Option,
|
|
1660
1710
|
{
|
|
1661
1711
|
...props,
|
|
1662
1712
|
className: `${props.className} Layer__select__option-content__match`
|
|
1663
1713
|
},
|
|
1664
|
-
/* @__PURE__ */
|
|
1665
|
-
/* @__PURE__ */
|
|
1714
|
+
/* @__PURE__ */ import_react19.default.createElement("div", { className: "Layer__select__option-content__match__main-row" }, /* @__PURE__ */ import_react19.default.createElement("span", { className: "Layer__select__option-content__match__date" }, props.data.payload.date && (0, import_date_fns4.format)((0, import_date_fns4.parseISO)(props.data.payload.date), DATE_FORMAT)), /* @__PURE__ */ import_react19.default.createElement("span", { className: "Layer__select__option-content__match__description" }, props.data.payload.display_name)),
|
|
1715
|
+
/* @__PURE__ */ import_react19.default.createElement("div", { className: "Layer__select__option-content__match__amount-row" }, /* @__PURE__ */ import_react19.default.createElement("span", { className: "Layer__select__option-content__match__amount" }, "$", centsToDollars(props.data.payload.amount)))
|
|
1666
1716
|
);
|
|
1667
1717
|
}
|
|
1668
|
-
return /* @__PURE__ */
|
|
1718
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1669
1719
|
import_react_select.components.Option,
|
|
1670
1720
|
{
|
|
1671
1721
|
...props,
|
|
1672
1722
|
className: `Layer__select__option-menu-content ${props.className}`
|
|
1673
1723
|
},
|
|
1674
|
-
/* @__PURE__ */
|
|
1675
|
-
props.isSelected ? /* @__PURE__ */
|
|
1724
|
+
/* @__PURE__ */ import_react19.default.createElement("div", null, props.data.payload.display_name),
|
|
1725
|
+
props.isSelected ? /* @__PURE__ */ import_react19.default.createElement("span", { className: "Layer__select__option-menu-content-check" }, /* @__PURE__ */ import_react19.default.createElement(Check_default, { size: 16 })) : null
|
|
1676
1726
|
);
|
|
1677
1727
|
};
|
|
1678
1728
|
var allCategoriesDivider = [
|
|
@@ -1755,17 +1805,20 @@ var CategorySelect = ({
|
|
|
1755
1805
|
];
|
|
1756
1806
|
const selected = value ? value : matchOptions?.length === 1 && matchOptions[0].options.length === 1 ? matchOptions[0].options[0] : void 0;
|
|
1757
1807
|
const placeholder = matchOptions?.length === 1 && matchOptions[0].options.length > 1 ? `${matchOptions[0].options.length} possible matches...` : "Categorize or match...";
|
|
1758
|
-
return /* @__PURE__ */
|
|
1808
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1759
1809
|
import_react_select.default,
|
|
1760
1810
|
{
|
|
1761
1811
|
name,
|
|
1762
1812
|
className: `Layer__category-menu Layer__select ${className ?? ""}`,
|
|
1763
1813
|
classNamePrefix: "Layer__select",
|
|
1814
|
+
classNames: {
|
|
1815
|
+
menu: () => "Layer__select__menu--lg"
|
|
1816
|
+
},
|
|
1764
1817
|
options,
|
|
1765
1818
|
isSearchable: true,
|
|
1766
1819
|
placeholder,
|
|
1767
1820
|
defaultValue: selected,
|
|
1768
|
-
formatOptionLabel: (props) => /* @__PURE__ */
|
|
1821
|
+
formatOptionLabel: (props) => /* @__PURE__ */ import_react19.default.createElement("div", { className: "Layer__select__option-label" }, props.type === "match" && /* @__PURE__ */ import_react19.default.createElement(Badge, { size: "small" /* SMALL */, icon: /* @__PURE__ */ import_react19.default.createElement(MinimizeTwo_default, { size: 11 }) }, "Match"), /* @__PURE__ */ import_react19.default.createElement("span", null, props.payload.display_name)),
|
|
1769
1822
|
value,
|
|
1770
1823
|
onChange: (newValue) => newValue && onChange(newValue),
|
|
1771
1824
|
getOptionLabel: (category) => category.payload.display_name,
|
|
@@ -1785,8 +1838,8 @@ var CategorySelect = ({
|
|
|
1785
1838
|
var import_react32 = __toESM(require("react"));
|
|
1786
1839
|
|
|
1787
1840
|
// src/icons/ScissorsFullOpen.tsx
|
|
1788
|
-
var
|
|
1789
|
-
var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */
|
|
1841
|
+
var React28 = __toESM(require("react"));
|
|
1842
|
+
var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React28.createElement(
|
|
1790
1843
|
"svg",
|
|
1791
1844
|
{
|
|
1792
1845
|
viewBox: "0 0 12 12",
|
|
@@ -1796,7 +1849,7 @@ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.crea
|
|
|
1796
1849
|
width: size,
|
|
1797
1850
|
height: size
|
|
1798
1851
|
},
|
|
1799
|
-
/* @__PURE__ */
|
|
1852
|
+
/* @__PURE__ */ React28.createElement("g", { id: "scissors" }, /* @__PURE__ */ React28.createElement(
|
|
1800
1853
|
"path",
|
|
1801
1854
|
{
|
|
1802
1855
|
id: "Vector",
|
|
@@ -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_2",
|
|
@@ -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_3",
|
|
@@ -1823,7 +1876,7 @@ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.crea
|
|
|
1823
1876
|
strokeLinecap: "round",
|
|
1824
1877
|
strokeLinejoin: "round"
|
|
1825
1878
|
}
|
|
1826
|
-
), /* @__PURE__ */
|
|
1879
|
+
), /* @__PURE__ */ React28.createElement(
|
|
1827
1880
|
"path",
|
|
1828
1881
|
{
|
|
1829
1882
|
id: "Vector_4",
|
|
@@ -1832,7 +1885,7 @@ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.crea
|
|
|
1832
1885
|
strokeLinecap: "round",
|
|
1833
1886
|
strokeLinejoin: "round"
|
|
1834
1887
|
}
|
|
1835
|
-
), /* @__PURE__ */
|
|
1888
|
+
), /* @__PURE__ */ React28.createElement(
|
|
1836
1889
|
"path",
|
|
1837
1890
|
{
|
|
1838
1891
|
id: "Vector_5",
|
|
@@ -1846,8 +1899,8 @@ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.crea
|
|
|
1846
1899
|
var ScissorsFullOpen_default = ScissorsFullOpen;
|
|
1847
1900
|
|
|
1848
1901
|
// src/icons/Trash.tsx
|
|
1849
|
-
var
|
|
1850
|
-
var Trash = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
1902
|
+
var React29 = __toESM(require("react"));
|
|
1903
|
+
var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React29.createElement(
|
|
1851
1904
|
"svg",
|
|
1852
1905
|
{
|
|
1853
1906
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1857,7 +1910,7 @@ var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
|
|
|
1857
1910
|
width: size,
|
|
1858
1911
|
height: size
|
|
1859
1912
|
},
|
|
1860
|
-
/* @__PURE__ */
|
|
1913
|
+
/* @__PURE__ */ React29.createElement(
|
|
1861
1914
|
"path",
|
|
1862
1915
|
{
|
|
1863
1916
|
d: "M2.25 4.5H3.75H15.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: "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",
|
|
@@ -1875,7 +1928,7 @@ var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
|
|
|
1875
1928
|
strokeLinejoin: "round"
|
|
1876
1929
|
}
|
|
1877
1930
|
),
|
|
1878
|
-
/* @__PURE__ */
|
|
1931
|
+
/* @__PURE__ */ React29.createElement(
|
|
1879
1932
|
"path",
|
|
1880
1933
|
{
|
|
1881
1934
|
d: "M7.5 8.25V12.75",
|
|
@@ -1884,7 +1937,7 @@ var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
|
|
|
1884
1937
|
strokeLinejoin: "round"
|
|
1885
1938
|
}
|
|
1886
1939
|
),
|
|
1887
|
-
/* @__PURE__ */
|
|
1940
|
+
/* @__PURE__ */ React29.createElement(
|
|
1888
1941
|
"path",
|
|
1889
1942
|
{
|
|
1890
1943
|
d: "M10.5 8.25V12.75",
|
|
@@ -1896,63 +1949,9 @@ var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
|
|
|
1896
1949
|
);
|
|
1897
1950
|
var Trash_default = Trash;
|
|
1898
1951
|
|
|
1899
|
-
// src/components/CategoryMenu/CategoryMenu.tsx
|
|
1900
|
-
var import_react19 = __toESM(require("react"));
|
|
1901
|
-
var import_react_select2 = __toESM(require("react-select"));
|
|
1902
|
-
var DropdownIndicator2 = (props) => {
|
|
1903
|
-
return /* @__PURE__ */ import_react19.default.createElement(import_react_select2.components.DropdownIndicator, { ...props }, /* @__PURE__ */ import_react19.default.createElement(ChevronDown_default, null));
|
|
1904
|
-
};
|
|
1905
|
-
var CategoryMenu = ({
|
|
1906
|
-
bankTransaction,
|
|
1907
|
-
name,
|
|
1908
|
-
value,
|
|
1909
|
-
onChange,
|
|
1910
|
-
disabled,
|
|
1911
|
-
className
|
|
1912
|
-
}) => {
|
|
1913
|
-
const { categories } = useLayerContext();
|
|
1914
|
-
const suggestedOptions = hasSuggestions(bankTransaction.categorization_flow) ? [
|
|
1915
|
-
{
|
|
1916
|
-
label: "Suggested",
|
|
1917
|
-
options: bankTransaction.categorization_flow.suggestions
|
|
1918
|
-
}
|
|
1919
|
-
] : [];
|
|
1920
|
-
const categoryOptions = (categories || []).map((category) => {
|
|
1921
|
-
if (category?.subCategories && category?.subCategories?.length > 0) {
|
|
1922
|
-
return {
|
|
1923
|
-
label: category.display_name,
|
|
1924
|
-
options: category.subCategories
|
|
1925
|
-
};
|
|
1926
|
-
}
|
|
1927
|
-
return {
|
|
1928
|
-
label: category.display_name,
|
|
1929
|
-
options: [category]
|
|
1930
|
-
};
|
|
1931
|
-
}).filter((x) => x);
|
|
1932
|
-
const options = [...suggestedOptions, ...categoryOptions];
|
|
1933
|
-
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1934
|
-
import_react_select2.default,
|
|
1935
|
-
{
|
|
1936
|
-
name,
|
|
1937
|
-
className: `Layer__category-menu Layer__select ${className ?? ""}`,
|
|
1938
|
-
classNamePrefix: "Layer__select",
|
|
1939
|
-
options,
|
|
1940
|
-
isSearchable: true,
|
|
1941
|
-
value,
|
|
1942
|
-
onChange: (newValue) => newValue && onChange(newValue),
|
|
1943
|
-
getOptionLabel: (category) => category.display_name,
|
|
1944
|
-
getOptionValue: (category) => category.stable_name || category.category,
|
|
1945
|
-
menuPortalTarget: document.body,
|
|
1946
|
-
styles: { menuPortal: (base) => ({ ...base, zIndex: 9999 }) },
|
|
1947
|
-
components: { DropdownIndicator: DropdownIndicator2 },
|
|
1948
|
-
isDisabled: disabled
|
|
1949
|
-
}
|
|
1950
|
-
);
|
|
1951
|
-
};
|
|
1952
|
-
|
|
1953
1952
|
// src/components/Input/Input.tsx
|
|
1954
1953
|
var import_react20 = __toESM(require("react"));
|
|
1955
|
-
var
|
|
1954
|
+
var import_classnames9 = __toESM(require("classnames"));
|
|
1956
1955
|
var Input = ({
|
|
1957
1956
|
className,
|
|
1958
1957
|
isInvalid,
|
|
@@ -1960,7 +1959,7 @@ var Input = ({
|
|
|
1960
1959
|
leftText,
|
|
1961
1960
|
...props
|
|
1962
1961
|
}) => {
|
|
1963
|
-
const baseClassName = (0,
|
|
1962
|
+
const baseClassName = (0, import_classnames9.default)(
|
|
1964
1963
|
"Layer__input",
|
|
1965
1964
|
isInvalid ? "Layer__input--error" : "",
|
|
1966
1965
|
leftText ? "Layer__input--with-left-text" : "",
|
|
@@ -1974,7 +1973,7 @@ var import_react24 = __toESM(require("react"));
|
|
|
1974
1973
|
|
|
1975
1974
|
// src/components/Typography/Text.tsx
|
|
1976
1975
|
var import_react21 = __toESM(require("react"));
|
|
1977
|
-
var
|
|
1976
|
+
var import_classnames10 = __toESM(require("classnames"));
|
|
1978
1977
|
var Text = ({
|
|
1979
1978
|
as: Component = "p",
|
|
1980
1979
|
className,
|
|
@@ -1984,7 +1983,7 @@ var Text = ({
|
|
|
1984
1983
|
withTooltip,
|
|
1985
1984
|
...props
|
|
1986
1985
|
}) => {
|
|
1987
|
-
const baseClassName = (0,
|
|
1986
|
+
const baseClassName = (0, import_classnames10.default)(
|
|
1988
1987
|
`Layer__text Layer__text--${size} Layer__text--${weight}`,
|
|
1989
1988
|
className
|
|
1990
1989
|
);
|
|
@@ -2032,7 +2031,7 @@ var TextWithTooltip = ({
|
|
|
2032
2031
|
[]
|
|
2033
2032
|
);
|
|
2034
2033
|
const [hoverStatus, setHover] = (0, import_react21.useState)(false);
|
|
2035
|
-
const contentClassName = (0,
|
|
2034
|
+
const contentClassName = (0, import_classnames10.default)(
|
|
2036
2035
|
"Layer__tooltip",
|
|
2037
2036
|
tooltipOptions?.contentClassName
|
|
2038
2037
|
);
|
|
@@ -2050,14 +2049,14 @@ var TextWithTooltip = ({
|
|
|
2050
2049
|
|
|
2051
2050
|
// src/components/Typography/Heading.tsx
|
|
2052
2051
|
var import_react22 = __toESM(require("react"));
|
|
2053
|
-
var
|
|
2052
|
+
var import_classnames11 = __toESM(require("classnames"));
|
|
2054
2053
|
var Heading = ({
|
|
2055
2054
|
as: Component = "h2",
|
|
2056
2055
|
className,
|
|
2057
2056
|
children,
|
|
2058
2057
|
size = "primary" /* primary */
|
|
2059
2058
|
}) => {
|
|
2060
|
-
const baseClassName = (0,
|
|
2059
|
+
const baseClassName = (0, import_classnames11.default)(
|
|
2061
2060
|
`Layer__heading Layer__heading--${size}`,
|
|
2062
2061
|
className
|
|
2063
2062
|
);
|
|
@@ -2066,14 +2065,14 @@ var Heading = ({
|
|
|
2066
2065
|
|
|
2067
2066
|
// src/components/Typography/ErrorText.tsx
|
|
2068
2067
|
var import_react23 = __toESM(require("react"));
|
|
2069
|
-
var
|
|
2068
|
+
var import_classnames12 = __toESM(require("classnames"));
|
|
2070
2069
|
var ErrorText = ({ className, ...props }) => {
|
|
2071
|
-
const baseClassName = (0,
|
|
2070
|
+
const baseClassName = (0, import_classnames12.default)("Layer__text--error", className);
|
|
2072
2071
|
return /* @__PURE__ */ import_react23.default.createElement(Text, { ...props, className: baseClassName });
|
|
2073
2072
|
};
|
|
2074
2073
|
|
|
2075
2074
|
// src/components/Input/InputGroup.tsx
|
|
2076
|
-
var
|
|
2075
|
+
var import_classnames13 = __toESM(require("classnames"));
|
|
2077
2076
|
var InputGroup = ({
|
|
2078
2077
|
label,
|
|
2079
2078
|
name,
|
|
@@ -2081,7 +2080,7 @@ var InputGroup = ({
|
|
|
2081
2080
|
inline,
|
|
2082
2081
|
children
|
|
2083
2082
|
}) => {
|
|
2084
|
-
const baseClassName = (0,
|
|
2083
|
+
const baseClassName = (0, import_classnames13.default)(
|
|
2085
2084
|
"Layer__input-group",
|
|
2086
2085
|
className,
|
|
2087
2086
|
inline && "Layer__input-group--inline"
|
|
@@ -2102,8 +2101,8 @@ var InputGroup = ({
|
|
|
2102
2101
|
var import_react25 = __toESM(require("react"));
|
|
2103
2102
|
|
|
2104
2103
|
// src/icons/UploadCloud.tsx
|
|
2105
|
-
var
|
|
2106
|
-
var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2104
|
+
var React35 = __toESM(require("react"));
|
|
2105
|
+
var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React35.createElement(
|
|
2107
2106
|
"svg",
|
|
2108
2107
|
{
|
|
2109
2108
|
viewBox: "0 0 18 18",
|
|
@@ -2113,7 +2112,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React34.createEle
|
|
|
2113
2112
|
width: size,
|
|
2114
2113
|
height: size
|
|
2115
2114
|
},
|
|
2116
|
-
/* @__PURE__ */
|
|
2115
|
+
/* @__PURE__ */ React35.createElement(
|
|
2117
2116
|
"path",
|
|
2118
2117
|
{
|
|
2119
2118
|
d: "M12 12L9 9L6 12",
|
|
@@ -2122,7 +2121,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React34.createEle
|
|
|
2122
2121
|
strokeLinejoin: "round"
|
|
2123
2122
|
}
|
|
2124
2123
|
),
|
|
2125
|
-
/* @__PURE__ */
|
|
2124
|
+
/* @__PURE__ */ React35.createElement(
|
|
2126
2125
|
"path",
|
|
2127
2126
|
{
|
|
2128
2127
|
d: "M9 9V15.75",
|
|
@@ -2131,7 +2130,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React34.createEle
|
|
|
2131
2130
|
strokeLinejoin: "round"
|
|
2132
2131
|
}
|
|
2133
2132
|
),
|
|
2134
|
-
/* @__PURE__ */
|
|
2133
|
+
/* @__PURE__ */ React35.createElement(
|
|
2135
2134
|
"path",
|
|
2136
2135
|
{
|
|
2137
2136
|
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",
|
|
@@ -2140,7 +2139,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React34.createEle
|
|
|
2140
2139
|
strokeLinejoin: "round"
|
|
2141
2140
|
}
|
|
2142
2141
|
),
|
|
2143
|
-
/* @__PURE__ */
|
|
2142
|
+
/* @__PURE__ */ React35.createElement(
|
|
2144
2143
|
"path",
|
|
2145
2144
|
{
|
|
2146
2145
|
d: "M12 12L9 9L6 12",
|
|
@@ -2187,11 +2186,11 @@ var FileInput = ({ text = "Upload", onUpload }) => {
|
|
|
2187
2186
|
|
|
2188
2187
|
// src/components/Input/Select.tsx
|
|
2189
2188
|
var import_react26 = __toESM(require("react"));
|
|
2190
|
-
var
|
|
2191
|
-
var
|
|
2192
|
-
return /* @__PURE__ */ import_react26.default.createElement(
|
|
2189
|
+
var import_react_select2 = __toESM(require("react-select"));
|
|
2190
|
+
var DropdownIndicator2 = (props) => {
|
|
2191
|
+
return /* @__PURE__ */ import_react26.default.createElement(import_react_select2.components.DropdownIndicator, { ...props }, /* @__PURE__ */ import_react26.default.createElement(ChevronDownFill_default, null));
|
|
2193
2192
|
};
|
|
2194
|
-
var
|
|
2193
|
+
var Select2 = ({
|
|
2195
2194
|
name,
|
|
2196
2195
|
options,
|
|
2197
2196
|
className,
|
|
@@ -2201,7 +2200,7 @@ var Select3 = ({
|
|
|
2201
2200
|
disabled
|
|
2202
2201
|
}) => {
|
|
2203
2202
|
return /* @__PURE__ */ import_react26.default.createElement(
|
|
2204
|
-
|
|
2203
|
+
import_react_select2.default,
|
|
2205
2204
|
{
|
|
2206
2205
|
name,
|
|
2207
2206
|
className: `Layer__select ${className ?? ""}`,
|
|
@@ -2211,7 +2210,7 @@ var Select3 = ({
|
|
|
2211
2210
|
onChange: (newValue) => newValue && onChange(newValue),
|
|
2212
2211
|
menuPortalTarget: document.body,
|
|
2213
2212
|
styles: { menuPortal: (base) => ({ ...base, zIndex: 9999 }) },
|
|
2214
|
-
components: { DropdownIndicator:
|
|
2213
|
+
components: { DropdownIndicator: DropdownIndicator2 },
|
|
2215
2214
|
isDisabled: disabled
|
|
2216
2215
|
}
|
|
2217
2216
|
);
|
|
@@ -2230,12 +2229,12 @@ var MatchBadge = ({
|
|
|
2230
2229
|
text = "Match"
|
|
2231
2230
|
}) => {
|
|
2232
2231
|
if (bankTransaction.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction.match) {
|
|
2233
|
-
const { date, amount
|
|
2232
|
+
const { date, amount } = bankTransaction.match.bank_transaction;
|
|
2234
2233
|
return /* @__PURE__ */ import_react27.default.createElement(
|
|
2235
2234
|
Badge,
|
|
2236
2235
|
{
|
|
2237
2236
|
icon: /* @__PURE__ */ import_react27.default.createElement(MinimizeTwo_default, { size: 11 }),
|
|
2238
|
-
tooltip: /* @__PURE__ */ import_react27.default.createElement("span", { className: `${classNamePrefix}__match-tooltip` }, /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-tooltip__date` }, (0, import_date_fns5.format)((0, import_date_fns5.parseISO)(date), dateFormat)), /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-tooltip__description` }, description), /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-tooltip__amount` }, "$", centsToDollars(amount)))
|
|
2237
|
+
tooltip: /* @__PURE__ */ import_react27.default.createElement("span", { className: `${classNamePrefix}__match-tooltip` }, /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-tooltip__date` }, (0, import_date_fns5.format)((0, import_date_fns5.parseISO)(date), dateFormat)), /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-tooltip__description` }, bankTransaction.match?.details?.description ?? ""), /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-tooltip__amount` }, "$", centsToDollars(amount)))
|
|
2239
2238
|
},
|
|
2240
2239
|
text
|
|
2241
2240
|
);
|
|
@@ -2244,7 +2243,7 @@ var MatchBadge = ({
|
|
|
2244
2243
|
};
|
|
2245
2244
|
|
|
2246
2245
|
// src/components/MatchForm/MatchForm.tsx
|
|
2247
|
-
var
|
|
2246
|
+
var import_classnames14 = __toESM(require("classnames"));
|
|
2248
2247
|
var import_date_fns6 = require("date-fns");
|
|
2249
2248
|
var MatchForm = ({
|
|
2250
2249
|
classNamePrefix,
|
|
@@ -2263,7 +2262,7 @@ var MatchForm = ({
|
|
|
2263
2262
|
"div",
|
|
2264
2263
|
{
|
|
2265
2264
|
key: idx,
|
|
2266
|
-
className: (0,
|
|
2265
|
+
className: (0, import_classnames14.default)(
|
|
2267
2266
|
`${classNamePrefix}__match-row`,
|
|
2268
2267
|
match.id === selectedMatchId ? `${classNamePrefix}__match-row--selected` : ""
|
|
2269
2268
|
),
|
|
@@ -2322,18 +2321,18 @@ var MatchForm = ({
|
|
|
2322
2321
|
|
|
2323
2322
|
// src/components/Textarea/Textarea.tsx
|
|
2324
2323
|
var import_react29 = __toESM(require("react"));
|
|
2325
|
-
var
|
|
2324
|
+
var import_classnames15 = __toESM(require("classnames"));
|
|
2326
2325
|
var Textarea = ({
|
|
2327
2326
|
className,
|
|
2328
2327
|
...props
|
|
2329
2328
|
}) => {
|
|
2330
|
-
const baseClassName = (0,
|
|
2329
|
+
const baseClassName = (0, import_classnames15.default)("Layer__textarea", className);
|
|
2331
2330
|
return /* @__PURE__ */ import_react29.default.createElement("textarea", { ...props, className: baseClassName });
|
|
2332
2331
|
};
|
|
2333
2332
|
|
|
2334
2333
|
// src/components/Toggle/Toggle.tsx
|
|
2335
2334
|
var import_react30 = __toESM(require("react"));
|
|
2336
|
-
var
|
|
2335
|
+
var import_classnames16 = __toESM(require("classnames"));
|
|
2337
2336
|
var Toggle = ({
|
|
2338
2337
|
name,
|
|
2339
2338
|
options,
|
|
@@ -2350,7 +2349,7 @@ var Toggle = ({
|
|
|
2350
2349
|
}
|
|
2351
2350
|
});
|
|
2352
2351
|
const selectedValue = selected || options[0].value;
|
|
2353
|
-
const baseClassName = (0,
|
|
2352
|
+
const baseClassName = (0, import_classnames16.default)(
|
|
2354
2353
|
"Layer__toggle",
|
|
2355
2354
|
`Layer__toggle--${size}`,
|
|
2356
2355
|
initialized ? "Layer__toggle--initialized" : ""
|
|
@@ -2455,8 +2454,8 @@ var ToggleOption = ({
|
|
|
2455
2454
|
var import_react31 = __toESM(require("react"));
|
|
2456
2455
|
|
|
2457
2456
|
// src/icons/AlertOctagon.tsx
|
|
2458
|
-
var
|
|
2459
|
-
var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2457
|
+
var React42 = __toESM(require("react"));
|
|
2458
|
+
var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React42.createElement(
|
|
2460
2459
|
"svg",
|
|
2461
2460
|
{
|
|
2462
2461
|
viewBox: "0 0 18 18",
|
|
@@ -2466,7 +2465,7 @@ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React41.createEl
|
|
|
2466
2465
|
width: size,
|
|
2467
2466
|
height: size
|
|
2468
2467
|
},
|
|
2469
|
-
/* @__PURE__ */
|
|
2468
|
+
/* @__PURE__ */ React42.createElement(
|
|
2470
2469
|
"path",
|
|
2471
2470
|
{
|
|
2472
2471
|
d: "M5.895 1.5H12.105L16.5 5.895V12.105L12.105 16.5H5.895L1.5 12.105V5.895L5.895 1.5Z",
|
|
@@ -2475,7 +2474,7 @@ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React41.createEl
|
|
|
2475
2474
|
strokeLinejoin: "round"
|
|
2476
2475
|
}
|
|
2477
2476
|
),
|
|
2478
|
-
/* @__PURE__ */
|
|
2477
|
+
/* @__PURE__ */ React42.createElement(
|
|
2479
2478
|
"path",
|
|
2480
2479
|
{
|
|
2481
2480
|
d: "M9 6V9",
|
|
@@ -2484,7 +2483,7 @@ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React41.createEl
|
|
|
2484
2483
|
strokeLinejoin: "round"
|
|
2485
2484
|
}
|
|
2486
2485
|
),
|
|
2487
|
-
/* @__PURE__ */
|
|
2486
|
+
/* @__PURE__ */ React42.createElement(
|
|
2488
2487
|
"path",
|
|
2489
2488
|
{
|
|
2490
2489
|
d: "M9 12H9.0075",
|
|
@@ -2599,7 +2598,7 @@ var Notification = ({
|
|
|
2599
2598
|
};
|
|
2600
2599
|
|
|
2601
2600
|
// src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
|
|
2602
|
-
var
|
|
2601
|
+
var import_classnames17 = __toESM(require("classnames"));
|
|
2603
2602
|
var hasMatch = (bankTransaction) => {
|
|
2604
2603
|
return Boolean(
|
|
2605
2604
|
bankTransaction?.suggested_matches && bankTransaction?.suggested_matches?.length > 0 || bankTransaction?.match
|
|
@@ -2629,6 +2628,7 @@ var ExpandedBankTransactionRow = (0, import_react32.forwardRef)(
|
|
|
2629
2628
|
({
|
|
2630
2629
|
bankTransaction,
|
|
2631
2630
|
isOpen = false,
|
|
2631
|
+
close,
|
|
2632
2632
|
editable,
|
|
2633
2633
|
asListItem = false,
|
|
2634
2634
|
submitBtnText = "Save",
|
|
@@ -2656,13 +2656,13 @@ var ExpandedBankTransactionRow = (0, import_react32.forwardRef)(
|
|
|
2656
2656
|
return {
|
|
2657
2657
|
amount: c.amount || 0,
|
|
2658
2658
|
inputValue: centsToDollars(c.amount),
|
|
2659
|
-
category: c.category
|
|
2659
|
+
category: mapCategoryToOption(c.category)
|
|
2660
2660
|
};
|
|
2661
2661
|
}) : [
|
|
2662
2662
|
{
|
|
2663
2663
|
amount: bankTransaction.amount,
|
|
2664
2664
|
inputValue: centsToDollars(bankTransaction.amount),
|
|
2665
|
-
category: defaultCategory
|
|
2665
|
+
category: mapCategoryToOption(defaultCategory)
|
|
2666
2666
|
}
|
|
2667
2667
|
],
|
|
2668
2668
|
description: "",
|
|
@@ -2673,7 +2673,11 @@ var ExpandedBankTransactionRow = (0, import_react32.forwardRef)(
|
|
|
2673
2673
|
...rowState,
|
|
2674
2674
|
splits: [
|
|
2675
2675
|
...rowState.splits,
|
|
2676
|
-
{
|
|
2676
|
+
{
|
|
2677
|
+
amount: 0,
|
|
2678
|
+
inputValue: "0.00",
|
|
2679
|
+
category: mapCategoryToOption(defaultCategory)
|
|
2680
|
+
}
|
|
2677
2681
|
]
|
|
2678
2682
|
});
|
|
2679
2683
|
setSplitFormError(void 0);
|
|
@@ -2728,7 +2732,7 @@ var ExpandedBankTransactionRow = (0, import_react32.forwardRef)(
|
|
|
2728
2732
|
updateRowState({ ...rowState });
|
|
2729
2733
|
setSplitFormError(void 0);
|
|
2730
2734
|
};
|
|
2731
|
-
const save = () => {
|
|
2735
|
+
const save = async () => {
|
|
2732
2736
|
if (purpose === "match" /* match */) {
|
|
2733
2737
|
if (!selectedMatchId) {
|
|
2734
2738
|
setMatchFormError("Select an option to match the transaction");
|
|
@@ -2747,34 +2751,36 @@ var ExpandedBankTransactionRow = (0, import_react32.forwardRef)(
|
|
|
2747
2751
|
}
|
|
2748
2752
|
return;
|
|
2749
2753
|
}
|
|
2750
|
-
categorizeBankTransaction2(
|
|
2754
|
+
await categorizeBankTransaction2(
|
|
2751
2755
|
bankTransaction.id,
|
|
2752
2756
|
rowState.splits.length === 1 ? {
|
|
2753
2757
|
type: "Category",
|
|
2754
2758
|
category: {
|
|
2755
2759
|
type: "StableName",
|
|
2756
|
-
stable_name: rowState?.splits[0].category?.stable_name
|
|
2760
|
+
stable_name: rowState?.splits[0].category?.payload.stable_name
|
|
2757
2761
|
}
|
|
2758
2762
|
} : {
|
|
2759
2763
|
type: "Split",
|
|
2760
2764
|
entries: rowState.splits.map((split) => ({
|
|
2761
|
-
category: split.category?.stable_name
|
|
2765
|
+
category: split.category?.payload.stable_name,
|
|
2762
2766
|
amount: split.amount
|
|
2763
2767
|
}))
|
|
2764
2768
|
}
|
|
2765
2769
|
);
|
|
2770
|
+
close();
|
|
2766
2771
|
};
|
|
2767
2772
|
(0, import_react32.useImperativeHandle)(ref, () => ({
|
|
2768
2773
|
save
|
|
2769
2774
|
}));
|
|
2770
|
-
const onMatchSubmit = (matchId) => {
|
|
2775
|
+
const onMatchSubmit = async (matchId) => {
|
|
2771
2776
|
const foundMatch = bankTransaction.suggested_matches?.find(
|
|
2772
2777
|
(x) => x.id === matchId
|
|
2773
2778
|
);
|
|
2774
2779
|
if (!foundMatch) {
|
|
2775
2780
|
return;
|
|
2776
2781
|
}
|
|
2777
|
-
matchBankTransaction2(bankTransaction.id, foundMatch.id);
|
|
2782
|
+
await matchBankTransaction2(bankTransaction.id, foundMatch.id);
|
|
2783
|
+
close();
|
|
2778
2784
|
};
|
|
2779
2785
|
const getDivHeight = (0, import_react32.useCallback)(() => {
|
|
2780
2786
|
const { height: height2 } = bodyRef.current ? bodyRef.current.getBoundingClientRect() : { height: void 0 };
|
|
@@ -2844,7 +2850,7 @@ var ExpandedBankTransactionRow = (0, import_react32.forwardRef)(
|
|
|
2844
2850
|
/* @__PURE__ */ import_react32.default.createElement("div", { className: `${className}__content-panels` }, /* @__PURE__ */ import_react32.default.createElement(
|
|
2845
2851
|
"div",
|
|
2846
2852
|
{
|
|
2847
|
-
className: (0,
|
|
2853
|
+
className: (0, import_classnames17.default)(
|
|
2848
2854
|
`${className}__match`,
|
|
2849
2855
|
`${className}__content-panel`,
|
|
2850
2856
|
purpose === "match" /* match */ ? `${className}__content-panel--active` : ""
|
|
@@ -2866,7 +2872,7 @@ var ExpandedBankTransactionRow = (0, import_react32.forwardRef)(
|
|
|
2866
2872
|
), /* @__PURE__ */ import_react32.default.createElement(
|
|
2867
2873
|
"div",
|
|
2868
2874
|
{
|
|
2869
|
-
className: (0,
|
|
2875
|
+
className: (0, import_classnames17.default)(
|
|
2870
2876
|
`${className}__splits`,
|
|
2871
2877
|
`${className}__content-panel`,
|
|
2872
2878
|
purpose === "categorize" /* categorize */ ? `${className}__content-panel--active` : ""
|
|
@@ -2897,13 +2903,14 @@ var ExpandedBankTransactionRow = (0, import_react32.forwardRef)(
|
|
|
2897
2903
|
className: `${className}__table-cell--split-entry__right-col`
|
|
2898
2904
|
},
|
|
2899
2905
|
/* @__PURE__ */ import_react32.default.createElement(
|
|
2900
|
-
|
|
2906
|
+
CategorySelect,
|
|
2901
2907
|
{
|
|
2902
2908
|
bankTransaction,
|
|
2903
|
-
name: `category-${
|
|
2909
|
+
name: `category-${bankTransaction.id}`,
|
|
2904
2910
|
value: split.category,
|
|
2905
2911
|
onChange: (value) => changeCategory(index, value),
|
|
2906
|
-
className: "Layer__category-menu--full"
|
|
2912
|
+
className: "Layer__category-menu--full",
|
|
2913
|
+
disabled: bankTransaction.processing
|
|
2907
2914
|
}
|
|
2908
2915
|
),
|
|
2909
2916
|
index > 0 && /* @__PURE__ */ import_react32.default.createElement(
|
|
@@ -3004,7 +3011,7 @@ var SplitTooltipDetails = ({
|
|
|
3004
3011
|
};
|
|
3005
3012
|
|
|
3006
3013
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
3007
|
-
var
|
|
3014
|
+
var import_classnames18 = __toESM(require("classnames"));
|
|
3008
3015
|
var import_date_fns7 = require("date-fns");
|
|
3009
3016
|
var isCredit = ({ direction }) => direction === "CREDIT" /* CREDIT */;
|
|
3010
3017
|
var extractDescriptionForSplit = (category) => {
|
|
@@ -3023,7 +3030,8 @@ var BankTransactionRow = ({
|
|
|
3023
3030
|
bankTransaction,
|
|
3024
3031
|
editable,
|
|
3025
3032
|
removeTransaction,
|
|
3026
|
-
containerWidth
|
|
3033
|
+
containerWidth,
|
|
3034
|
+
initialLoad
|
|
3027
3035
|
}) => {
|
|
3028
3036
|
const expandedRowRef = (0, import_react34.useRef)(null);
|
|
3029
3037
|
const [showRetry, setShowRetry] = (0, import_react34.useState)(false);
|
|
@@ -3050,10 +3058,14 @@ var BankTransactionRow = ({
|
|
|
3050
3058
|
};
|
|
3051
3059
|
const [showComponent, setShowComponent] = (0, import_react34.useState)(false);
|
|
3052
3060
|
(0, import_react34.useEffect)(() => {
|
|
3053
|
-
|
|
3061
|
+
if (initialLoad) {
|
|
3062
|
+
const timeoutId = setTimeout(() => {
|
|
3063
|
+
setShowComponent(true);
|
|
3064
|
+
}, index * 10);
|
|
3065
|
+
return () => clearTimeout(timeoutId);
|
|
3066
|
+
} else {
|
|
3054
3067
|
setShowComponent(true);
|
|
3055
|
-
}
|
|
3056
|
-
return () => clearTimeout(timeoutId);
|
|
3068
|
+
}
|
|
3057
3069
|
}, []);
|
|
3058
3070
|
(0, import_react34.useEffect)(() => {
|
|
3059
3071
|
if (bankTransaction.error) {
|
|
@@ -3069,26 +3081,32 @@ var BankTransactionRow = ({
|
|
|
3069
3081
|
return;
|
|
3070
3082
|
}
|
|
3071
3083
|
if (selectedCategory.type === "match") {
|
|
3072
|
-
matchBankTransaction2(
|
|
3084
|
+
await matchBankTransaction2(
|
|
3085
|
+
bankTransaction.id,
|
|
3086
|
+
selectedCategory.payload.id
|
|
3087
|
+
);
|
|
3088
|
+
setOpen(false);
|
|
3073
3089
|
return;
|
|
3074
3090
|
}
|
|
3075
|
-
categorizeBankTransaction2(bankTransaction.id, {
|
|
3091
|
+
await categorizeBankTransaction2(bankTransaction.id, {
|
|
3076
3092
|
type: "Category",
|
|
3077
3093
|
category: {
|
|
3078
3094
|
type: "StableName",
|
|
3079
3095
|
stable_name: selectedCategory?.payload.stable_name || ""
|
|
3080
3096
|
}
|
|
3081
3097
|
});
|
|
3098
|
+
setOpen(false);
|
|
3082
3099
|
};
|
|
3083
3100
|
if (removed) {
|
|
3084
3101
|
return null;
|
|
3085
3102
|
}
|
|
3086
3103
|
const className = "Layer__bank-transaction-row";
|
|
3087
3104
|
const openClassName = open ? `${className}--expanded` : "";
|
|
3088
|
-
const rowClassName = (0,
|
|
3105
|
+
const rowClassName = (0, import_classnames18.default)(
|
|
3089
3106
|
className,
|
|
3090
|
-
bankTransaction.recently_categorized ? "Layer__bank-transaction-row--removing" : "",
|
|
3107
|
+
bankTransaction.recently_categorized && editable ? "Layer__bank-transaction-row--removing" : "",
|
|
3091
3108
|
open ? openClassName : "",
|
|
3109
|
+
initialLoad ? "initial-load" : "",
|
|
3092
3110
|
showComponent ? "show" : ""
|
|
3093
3111
|
);
|
|
3094
3112
|
return /* @__PURE__ */ import_react34.default.createElement(import_react34.default.Fragment, null, /* @__PURE__ */ import_react34.default.createElement(
|
|
@@ -3098,7 +3116,9 @@ var BankTransactionRow = ({
|
|
|
3098
3116
|
onTransitionEnd: ({ propertyName }) => {
|
|
3099
3117
|
if (propertyName === "top") {
|
|
3100
3118
|
setRemoved(true);
|
|
3101
|
-
|
|
3119
|
+
if (editable) {
|
|
3120
|
+
removeTransaction(bankTransaction.id);
|
|
3121
|
+
}
|
|
3102
3122
|
}
|
|
3103
3123
|
}
|
|
3104
3124
|
},
|
|
@@ -3156,7 +3176,7 @@ var BankTransactionRow = ({
|
|
|
3156
3176
|
/* @__PURE__ */ import_react34.default.createElement(
|
|
3157
3177
|
"td",
|
|
3158
3178
|
{
|
|
3159
|
-
className: (0,
|
|
3179
|
+
className: (0, import_classnames18.default)(
|
|
3160
3180
|
"Layer__table-cell",
|
|
3161
3181
|
"Layer__table-cell__category-col",
|
|
3162
3182
|
`${className}__actions-cell`,
|
|
@@ -3204,7 +3224,7 @@ var BankTransactionRow = ({
|
|
|
3204
3224
|
), /* @__PURE__ */ import_react34.default.createElement("span", { className: `${className}__category-text__text` }, `${(0, import_date_fns7.format)(
|
|
3205
3225
|
(0, import_date_fns7.parseISO)(bankTransaction.match.bank_transaction.date),
|
|
3206
3226
|
dateFormat
|
|
3207
|
-
)}, ${bankTransaction.match
|
|
3227
|
+
)}, ${bankTransaction.match?.details?.description}`)), bankTransaction?.categorization_status !== "MATCHED" /* MATCHED */ && bankTransaction?.categorization_status !== "SPLIT" /* SPLIT */ && /* @__PURE__ */ import_react34.default.createElement("span", { className: `${className}__category-text__text` }, bankTransaction?.category?.display_name)) : null,
|
|
3208
3228
|
editable && !open && showRetry ? /* @__PURE__ */ import_react34.default.createElement(
|
|
3209
3229
|
RetryButton,
|
|
3210
3230
|
{
|
|
@@ -3266,6 +3286,7 @@ var BankTransactionRow = ({
|
|
|
3266
3286
|
ref: expandedRowRef,
|
|
3267
3287
|
bankTransaction,
|
|
3268
3288
|
isOpen: open,
|
|
3289
|
+
close: () => setOpen(false),
|
|
3269
3290
|
containerWidth,
|
|
3270
3291
|
editable
|
|
3271
3292
|
}
|
|
@@ -3310,7 +3331,7 @@ var Assignment = ({ bankTransaction }) => {
|
|
|
3310
3331
|
};
|
|
3311
3332
|
|
|
3312
3333
|
// src/components/BankTransactionListItem/BankTransactionListItem.tsx
|
|
3313
|
-
var
|
|
3334
|
+
var import_classnames19 = __toESM(require("classnames"));
|
|
3314
3335
|
var import_date_fns9 = require("date-fns");
|
|
3315
3336
|
var isCredit2 = ({ direction }) => direction === "CREDIT" /* CREDIT */;
|
|
3316
3337
|
var BankTransactionListItem = ({
|
|
@@ -3369,7 +3390,7 @@ var BankTransactionListItem = ({
|
|
|
3369
3390
|
}
|
|
3370
3391
|
const className = "Layer__bank-transaction-list-item";
|
|
3371
3392
|
const openClassName = open ? `${className}--expanded` : "";
|
|
3372
|
-
const rowClassName = (0,
|
|
3393
|
+
const rowClassName = (0, import_classnames19.default)(
|
|
3373
3394
|
className,
|
|
3374
3395
|
bankTransaction.recently_categorized ? "Layer__bank-transaction-row--removing" : "",
|
|
3375
3396
|
open ? openClassName : "",
|
|
@@ -3400,6 +3421,7 @@ var BankTransactionListItem = ({
|
|
|
3400
3421
|
ref: expandedRowRef,
|
|
3401
3422
|
bankTransaction,
|
|
3402
3423
|
isOpen: open,
|
|
3424
|
+
close: () => setOpen(false),
|
|
3403
3425
|
editable,
|
|
3404
3426
|
asListItem: true,
|
|
3405
3427
|
submitBtnText: editable ? "Approve" : "Update",
|
|
@@ -3675,10 +3697,10 @@ var hslToHex = (hsl) => {
|
|
|
3675
3697
|
};
|
|
3676
3698
|
|
|
3677
3699
|
// src/components/Container/Container.tsx
|
|
3678
|
-
var
|
|
3700
|
+
var import_classnames20 = __toESM(require("classnames"));
|
|
3679
3701
|
var Container = (0, import_react37.forwardRef)(
|
|
3680
3702
|
({ name, className, children, asWidget }, ref) => {
|
|
3681
|
-
const baseClassName = (0,
|
|
3703
|
+
const baseClassName = (0, import_classnames20.default)(
|
|
3682
3704
|
"Layer__component Layer__component-container",
|
|
3683
3705
|
`Layer__${name}`,
|
|
3684
3706
|
asWidget ? "Layer__component--as-widget" : "",
|
|
@@ -3692,10 +3714,10 @@ var Container = (0, import_react37.forwardRef)(
|
|
|
3692
3714
|
|
|
3693
3715
|
// src/components/Container/Header.tsx
|
|
3694
3716
|
var import_react38 = __toESM(require("react"));
|
|
3695
|
-
var
|
|
3717
|
+
var import_classnames21 = __toESM(require("classnames"));
|
|
3696
3718
|
var Header = (0, import_react38.forwardRef)(
|
|
3697
3719
|
({ className, children, style }, ref) => {
|
|
3698
|
-
const baseClassName = (0,
|
|
3720
|
+
const baseClassName = (0, import_classnames21.default)("Layer__component-header", className);
|
|
3699
3721
|
return /* @__PURE__ */ import_react38.default.createElement("header", { ref, className: baseClassName, style }, children);
|
|
3700
3722
|
}
|
|
3701
3723
|
);
|
|
@@ -3795,8 +3817,8 @@ var usePagination = ({
|
|
|
3795
3817
|
};
|
|
3796
3818
|
|
|
3797
3819
|
// src/icons/ChevronLeft.tsx
|
|
3798
|
-
var
|
|
3799
|
-
var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
3820
|
+
var React53 = __toESM(require("react"));
|
|
3821
|
+
var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React53.createElement(
|
|
3800
3822
|
"svg",
|
|
3801
3823
|
{
|
|
3802
3824
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3806,7 +3828,7 @@ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React52.createEle
|
|
|
3806
3828
|
fill: "none",
|
|
3807
3829
|
...props
|
|
3808
3830
|
},
|
|
3809
|
-
/* @__PURE__ */
|
|
3831
|
+
/* @__PURE__ */ React53.createElement(
|
|
3810
3832
|
"path",
|
|
3811
3833
|
{
|
|
3812
3834
|
d: "M11.25 13.5L6.75 9L11.25 4.5",
|
|
@@ -3819,8 +3841,8 @@ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React52.createEle
|
|
|
3819
3841
|
var ChevronLeft_default = ChevronLeft;
|
|
3820
3842
|
|
|
3821
3843
|
// src/icons/ChevronRight.tsx
|
|
3822
|
-
var
|
|
3823
|
-
var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
3844
|
+
var React54 = __toESM(require("react"));
|
|
3845
|
+
var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React54.createElement(
|
|
3824
3846
|
"svg",
|
|
3825
3847
|
{
|
|
3826
3848
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3830,7 +3852,7 @@ var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React53.createEl
|
|
|
3830
3852
|
fill: "none",
|
|
3831
3853
|
...props
|
|
3832
3854
|
},
|
|
3833
|
-
/* @__PURE__ */
|
|
3855
|
+
/* @__PURE__ */ React54.createElement(
|
|
3834
3856
|
"path",
|
|
3835
3857
|
{
|
|
3836
3858
|
d: "M6.75 13.5L11.25 9L6.75 4.5",
|
|
@@ -3843,7 +3865,7 @@ var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React53.createEl
|
|
|
3843
3865
|
var ChevronRight_default = ChavronRight;
|
|
3844
3866
|
|
|
3845
3867
|
// src/components/Pagination/Pagination.tsx
|
|
3846
|
-
var
|
|
3868
|
+
var import_classnames22 = __toESM(require("classnames"));
|
|
3847
3869
|
var Pagination = ({
|
|
3848
3870
|
onPageChange,
|
|
3849
3871
|
totalCount,
|
|
@@ -3868,7 +3890,7 @@ var Pagination = ({
|
|
|
3868
3890
|
"li",
|
|
3869
3891
|
{
|
|
3870
3892
|
key: `page-prev`,
|
|
3871
|
-
className: (0,
|
|
3893
|
+
className: (0, import_classnames22.default)(
|
|
3872
3894
|
"Layer__pagination-item Layer__pagination-arrow Layer__pagination-arrow--previous",
|
|
3873
3895
|
{
|
|
3874
3896
|
disabled: currentPage === 1
|
|
@@ -3879,13 +3901,20 @@ var Pagination = ({
|
|
|
3879
3901
|
/* @__PURE__ */ import_react42.default.createElement(ChevronLeft_default, { size: 12 })
|
|
3880
3902
|
), paginationRange.map((pageNumber) => {
|
|
3881
3903
|
if (pageNumber === DOTS) {
|
|
3882
|
-
return /* @__PURE__ */ import_react42.default.createElement(
|
|
3904
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
3905
|
+
"li",
|
|
3906
|
+
{
|
|
3907
|
+
key: `page-${pageNumber}`,
|
|
3908
|
+
className: "Layer__pagination-item Layer__pagination-dots"
|
|
3909
|
+
},
|
|
3910
|
+
"\u2026"
|
|
3911
|
+
);
|
|
3883
3912
|
}
|
|
3884
3913
|
return /* @__PURE__ */ import_react42.default.createElement(
|
|
3885
3914
|
"li",
|
|
3886
3915
|
{
|
|
3887
3916
|
key: `page-${pageNumber}`,
|
|
3888
|
-
className: (0,
|
|
3917
|
+
className: (0, import_classnames22.default)("Layer__pagination-item", {
|
|
3889
3918
|
selected: pageNumber === currentPage
|
|
3890
3919
|
}),
|
|
3891
3920
|
onClick: () => {
|
|
@@ -3900,7 +3929,7 @@ var Pagination = ({
|
|
|
3900
3929
|
"li",
|
|
3901
3930
|
{
|
|
3902
3931
|
key: `page-last`,
|
|
3903
|
-
className: (0,
|
|
3932
|
+
className: (0, import_classnames22.default)(
|
|
3904
3933
|
"Layer__pagination-item Layer__pagination-arrow Layer__pagination-arrow--next",
|
|
3905
3934
|
{
|
|
3906
3935
|
disabled: currentPage === lastPage
|
|
@@ -3928,20 +3957,32 @@ var filterVisibility = (display, bankTransaction) => {
|
|
|
3928
3957
|
const categorized = CategorizedCategories.includes(
|
|
3929
3958
|
bankTransaction.categorization_status
|
|
3930
3959
|
);
|
|
3931
|
-
const inReview = ReviewCategories.includes(bankTransaction.categorization_status)
|
|
3960
|
+
const inReview = ReviewCategories.includes(bankTransaction.categorization_status) && !bankTransaction.recently_categorized;
|
|
3932
3961
|
return display === "review" /* review */ && inReview || display === "categorized" /* categorized */ && categorized;
|
|
3933
3962
|
};
|
|
3934
3963
|
var BankTransactions = ({
|
|
3935
3964
|
asWidget = false,
|
|
3936
|
-
pageSize = 15
|
|
3965
|
+
pageSize = 15,
|
|
3966
|
+
categorizedOnly = false
|
|
3937
3967
|
}) => {
|
|
3938
|
-
const [display, setDisplay] = (0, import_react43.useState)(
|
|
3968
|
+
const [display, setDisplay] = (0, import_react43.useState)(
|
|
3969
|
+
categorizedOnly ? "categorized" /* categorized */ : "review" /* review */
|
|
3970
|
+
);
|
|
3939
3971
|
const [currentPage, setCurrentPage] = (0, import_react43.useState)(1);
|
|
3940
3972
|
const [removedTxs, setRemovedTxs] = (0, import_react43.useState)([]);
|
|
3973
|
+
const [initialLoad, setInitialLoad] = (0, import_react43.useState)(true);
|
|
3941
3974
|
const { data, isLoading, error, isValidating, refetch } = useBankTransactions();
|
|
3942
3975
|
const bankTransactionsByFilter = data?.filter(
|
|
3943
3976
|
(tx) => !removedTxs.includes(tx.id) && filterVisibility(display, tx)
|
|
3944
3977
|
);
|
|
3978
|
+
(0, import_react43.useEffect)(() => {
|
|
3979
|
+
if (!isLoading) {
|
|
3980
|
+
const timeoutLoad = setTimeout(() => {
|
|
3981
|
+
setInitialLoad(false);
|
|
3982
|
+
}, 1e3);
|
|
3983
|
+
return () => clearTimeout(timeoutLoad);
|
|
3984
|
+
}
|
|
3985
|
+
}, [isLoading]);
|
|
3945
3986
|
const bankTransactions = (0, import_react43.useMemo)(() => {
|
|
3946
3987
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
3947
3988
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
@@ -3995,7 +4036,7 @@ var BankTransactions = ({
|
|
|
3995
4036
|
style: { top: shiftStickyHeader }
|
|
3996
4037
|
},
|
|
3997
4038
|
/* @__PURE__ */ import_react43.default.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
|
|
3998
|
-
/* @__PURE__ */ import_react43.default.createElement(
|
|
4039
|
+
!categorizedOnly && /* @__PURE__ */ import_react43.default.createElement(
|
|
3999
4040
|
Toggle,
|
|
4000
4041
|
{
|
|
4001
4042
|
name: "bank-transaction-display",
|
|
@@ -4019,6 +4060,7 @@ var BankTransactions = ({
|
|
|
4019
4060
|
(bankTransaction, index) => /* @__PURE__ */ import_react43.default.createElement(
|
|
4020
4061
|
BankTransactionRow,
|
|
4021
4062
|
{
|
|
4063
|
+
initialLoad,
|
|
4022
4064
|
index,
|
|
4023
4065
|
key: bankTransaction.id,
|
|
4024
4066
|
dateFormat: DATE_FORMAT,
|
|
@@ -4091,109 +4133,682 @@ var Hello = ({ user }) => {
|
|
|
4091
4133
|
};
|
|
4092
4134
|
|
|
4093
4135
|
// src/components/LinkedAccounts/LinkedAccounts.tsx
|
|
4094
|
-
var
|
|
4136
|
+
var import_react49 = __toESM(require("react"));
|
|
4095
4137
|
|
|
4096
4138
|
// src/hooks/useLinkedAccounts/useLinkedAccounts.ts
|
|
4097
|
-
var
|
|
4139
|
+
var import_swr4 = __toESM(require("swr"));
|
|
4098
4140
|
var MOCK_DATA = [
|
|
4099
4141
|
{
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4142
|
+
id: "1",
|
|
4143
|
+
external_account_name: "Citi Double Cash\xAE Card",
|
|
4144
|
+
external_account_number: "1234",
|
|
4145
|
+
latest_balance_timestamp: {
|
|
4146
|
+
external_account_external_id: "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq",
|
|
4147
|
+
external_account_source: "PLAID",
|
|
4148
|
+
balance: 435121,
|
|
4149
|
+
at: "2024-04-03T13:00:00Z",
|
|
4150
|
+
created_at: "2024-04-06T16:44:35.715458Z"
|
|
4151
|
+
},
|
|
4152
|
+
current_ledger_balance: 373717,
|
|
4153
|
+
institution: "Chase",
|
|
4154
|
+
institutionLogo: ""
|
|
4155
|
+
},
|
|
4156
|
+
{
|
|
4157
|
+
id: "2",
|
|
4158
|
+
external_account_name: "Citi Double Cash\xAE Card",
|
|
4159
|
+
external_account_number: "1234",
|
|
4160
|
+
latest_balance_timestamp: {
|
|
4161
|
+
external_account_external_id: "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq",
|
|
4162
|
+
external_account_source: "PLAID",
|
|
4163
|
+
balance: 435121,
|
|
4164
|
+
at: "2024-04-03T13:00:00Z",
|
|
4165
|
+
created_at: "2024-04-06T16:44:35.715458Z"
|
|
4166
|
+
},
|
|
4167
|
+
current_ledger_balance: 373717,
|
|
4168
|
+
institution: "Chase",
|
|
4169
|
+
institutionLogo: ""
|
|
4103
4170
|
},
|
|
4104
4171
|
{
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4172
|
+
id: "3",
|
|
4173
|
+
external_account_name: "Citi Double Cash\xAE Card",
|
|
4174
|
+
external_account_number: "1234",
|
|
4175
|
+
latest_balance_timestamp: {
|
|
4176
|
+
external_account_external_id: "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq",
|
|
4177
|
+
external_account_source: "PLAID",
|
|
4178
|
+
balance: 435121,
|
|
4179
|
+
at: "2024-04-03T13:00:00Z",
|
|
4180
|
+
created_at: "2024-04-06T16:44:35.715458Z"
|
|
4181
|
+
},
|
|
4182
|
+
current_ledger_balance: 373717,
|
|
4183
|
+
institution: "Chase",
|
|
4184
|
+
institutionLogo: ""
|
|
4108
4185
|
},
|
|
4109
4186
|
{
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4187
|
+
id: "4",
|
|
4188
|
+
external_account_name: "Citi Double Cash\xAE Card",
|
|
4189
|
+
external_account_number: "1234",
|
|
4190
|
+
latest_balance_timestamp: {
|
|
4191
|
+
external_account_external_id: "0Br385JmgbTryJn8nEBnUb4A5ydv06U9Vbqqq",
|
|
4192
|
+
external_account_source: "PLAID",
|
|
4193
|
+
balance: 435121,
|
|
4194
|
+
at: "2024-04-03T13:00:00Z",
|
|
4195
|
+
created_at: "2024-04-06T16:44:35.715458Z"
|
|
4196
|
+
},
|
|
4197
|
+
current_ledger_balance: 373717,
|
|
4198
|
+
institution: "Chase",
|
|
4199
|
+
institutionLogo: ""
|
|
4113
4200
|
}
|
|
4114
4201
|
];
|
|
4115
4202
|
var useLinkedAccounts = () => {
|
|
4116
4203
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
4117
|
-
const [isLoading, setIsLoading] = (0, import_react45.useState)(true);
|
|
4118
|
-
(0, import_react45.useEffect)(() => {
|
|
4119
|
-
const timer = setTimeout(() => {
|
|
4120
|
-
setIsLoading(false);
|
|
4121
|
-
}, 2e3);
|
|
4122
|
-
}, []);
|
|
4123
|
-
const responseData = { data: MOCK_DATA, meta: {}, error: void 0 };
|
|
4124
|
-
const isValidating = false;
|
|
4125
4204
|
const {
|
|
4126
|
-
data
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4205
|
+
// data: responseData,
|
|
4206
|
+
isLoading,
|
|
4207
|
+
isValidating,
|
|
4208
|
+
error: responseError,
|
|
4209
|
+
mutate
|
|
4210
|
+
} = (0, import_swr4.default)(
|
|
4211
|
+
businessId && auth?.access_token && `linked-accounts-${businessId}`,
|
|
4212
|
+
Layer.getLinkedAccounts(apiUrl, auth?.access_token, {
|
|
4213
|
+
params: { businessId }
|
|
4214
|
+
})
|
|
4215
|
+
);
|
|
4216
|
+
const responseData = { data: MOCK_DATA, meta: {}, error: void 0 };
|
|
4217
|
+
const addAccount = () => {
|
|
4218
|
+
console.log("add account...");
|
|
4219
|
+
};
|
|
4220
|
+
const unlinkAccount = () => {
|
|
4221
|
+
console.log("unlink account...");
|
|
4222
|
+
};
|
|
4223
|
+
const renewLinkAccount = () => {
|
|
4224
|
+
console.log("relink account...");
|
|
4225
|
+
};
|
|
4130
4226
|
const refetch = () => {
|
|
4131
4227
|
console.log("refetch...");
|
|
4132
4228
|
};
|
|
4133
4229
|
return {
|
|
4134
|
-
data,
|
|
4135
|
-
|
|
4230
|
+
// data: responseData?.data.external_accounts,
|
|
4231
|
+
data: responseData.data,
|
|
4136
4232
|
isLoading,
|
|
4137
4233
|
isValidating,
|
|
4138
|
-
error,
|
|
4139
|
-
refetch
|
|
4234
|
+
error: responseError,
|
|
4235
|
+
refetch,
|
|
4236
|
+
addAccount,
|
|
4237
|
+
unlinkAccount,
|
|
4238
|
+
renewLinkAccount
|
|
4140
4239
|
};
|
|
4141
4240
|
};
|
|
4142
4241
|
|
|
4143
|
-
// src/
|
|
4144
|
-
var
|
|
4145
|
-
var
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
4149
|
-
|
|
4150
|
-
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4154
|
-
|
|
4242
|
+
// src/icons/PlusIcon.tsx
|
|
4243
|
+
var React58 = __toESM(require("react"));
|
|
4244
|
+
var PlusIcon = ({ size = 14, ...props }) => /* @__PURE__ */ React58.createElement(
|
|
4245
|
+
"svg",
|
|
4246
|
+
{
|
|
4247
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4248
|
+
viewBox: "0 0 16 16",
|
|
4249
|
+
fill: "none",
|
|
4250
|
+
...props,
|
|
4251
|
+
width: size,
|
|
4252
|
+
height: size
|
|
4253
|
+
},
|
|
4254
|
+
/* @__PURE__ */ React58.createElement(
|
|
4255
|
+
"path",
|
|
4155
4256
|
{
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4257
|
+
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",
|
|
4258
|
+
stroke: "currentColor",
|
|
4259
|
+
strokeLinecap: "round",
|
|
4260
|
+
strokeLinejoin: "round"
|
|
4261
|
+
}
|
|
4262
|
+
),
|
|
4263
|
+
/* @__PURE__ */ React58.createElement(
|
|
4264
|
+
"path",
|
|
4162
4265
|
{
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
isLoading: isValidating
|
|
4266
|
+
d: "M5.33337 8.5L10.6667 8.5",
|
|
4267
|
+
stroke: "currentColor",
|
|
4268
|
+
strokeLinecap: "round",
|
|
4269
|
+
strokeLinejoin: "round"
|
|
4168
4270
|
}
|
|
4169
|
-
)
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4271
|
+
),
|
|
4272
|
+
/* @__PURE__ */ React58.createElement(
|
|
4273
|
+
"path",
|
|
4274
|
+
{
|
|
4275
|
+
d: "M8 11.1666L8 5.83329",
|
|
4276
|
+
stroke: "currentColor",
|
|
4277
|
+
strokeLinecap: "round",
|
|
4278
|
+
strokeLinejoin: "round"
|
|
4279
|
+
}
|
|
4280
|
+
)
|
|
4281
|
+
);
|
|
4282
|
+
var PlusIcon_default = PlusIcon;
|
|
4174
4283
|
|
|
4175
|
-
// src/
|
|
4176
|
-
var
|
|
4284
|
+
// src/components/LinkedAccountOptions/LinkedAccountOptions.tsx
|
|
4285
|
+
var import_react47 = __toESM(require("react"));
|
|
4177
4286
|
|
|
4178
|
-
// src/
|
|
4179
|
-
var
|
|
4180
|
-
|
|
4287
|
+
// src/icons/MoreVertical.tsx
|
|
4288
|
+
var import_react45 = __toESM(require("react"));
|
|
4289
|
+
var MoreVertical = ({ size = 18, ...props }) => {
|
|
4290
|
+
return /* @__PURE__ */ import_react45.default.createElement(
|
|
4291
|
+
"svg",
|
|
4292
|
+
{
|
|
4293
|
+
viewBox: "0 0 16 14",
|
|
4294
|
+
fill: "none",
|
|
4295
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4296
|
+
...props,
|
|
4297
|
+
width: size,
|
|
4298
|
+
height: size
|
|
4299
|
+
},
|
|
4300
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
|
4301
|
+
"path",
|
|
4302
|
+
{
|
|
4303
|
+
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",
|
|
4304
|
+
fill: "currentColor",
|
|
4305
|
+
stroke: "currentColor",
|
|
4306
|
+
strokeLinecap: "round",
|
|
4307
|
+
strokeLinejoin: "round"
|
|
4308
|
+
}
|
|
4309
|
+
),
|
|
4310
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
|
4311
|
+
"path",
|
|
4312
|
+
{
|
|
4313
|
+
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",
|
|
4314
|
+
fill: "currentColor",
|
|
4315
|
+
stroke: "currentColor",
|
|
4316
|
+
strokeLinecap: "round",
|
|
4317
|
+
strokeLinejoin: "round"
|
|
4318
|
+
}
|
|
4319
|
+
),
|
|
4320
|
+
/* @__PURE__ */ import_react45.default.createElement(
|
|
4321
|
+
"path",
|
|
4322
|
+
{
|
|
4323
|
+
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",
|
|
4324
|
+
fill: "currentColor",
|
|
4325
|
+
stroke: "currentColor",
|
|
4326
|
+
strokeLinecap: "round",
|
|
4327
|
+
strokeLinejoin: "round"
|
|
4328
|
+
}
|
|
4329
|
+
)
|
|
4330
|
+
);
|
|
4181
4331
|
};
|
|
4182
|
-
var
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
4195
|
-
|
|
4196
|
-
|
|
4332
|
+
var MoreVertical_default = MoreVertical;
|
|
4333
|
+
|
|
4334
|
+
// src/components/HoverMenu/HoverMenu.tsx
|
|
4335
|
+
var import_react46 = __toESM(require("react"));
|
|
4336
|
+
var import_classnames23 = __toESM(require("classnames"));
|
|
4337
|
+
var HoverMenu = ({ children, config }) => {
|
|
4338
|
+
const [openMenu, setOpenMenu] = (0, import_react46.useState)(false);
|
|
4339
|
+
const hoverMenuRef = (0, import_react46.useRef)(null);
|
|
4340
|
+
const hoverMenuClassName = (0, import_classnames23.default)(
|
|
4341
|
+
"Layer__hover-menu",
|
|
4342
|
+
openMenu && "--open"
|
|
4343
|
+
);
|
|
4344
|
+
(0, import_react46.useEffect)(() => {
|
|
4345
|
+
function handleClickOutside(event) {
|
|
4346
|
+
if (hoverMenuRef.current && !hoverMenuRef.current.contains(event.target)) {
|
|
4347
|
+
setOpenMenu(false);
|
|
4348
|
+
}
|
|
4349
|
+
}
|
|
4350
|
+
document.addEventListener("click", handleClickOutside);
|
|
4351
|
+
return () => {
|
|
4352
|
+
document.removeEventListener("click", handleClickOutside);
|
|
4353
|
+
};
|
|
4354
|
+
}, []);
|
|
4355
|
+
return /* @__PURE__ */ import_react46.default.createElement(
|
|
4356
|
+
"div",
|
|
4357
|
+
{
|
|
4358
|
+
className: hoverMenuClassName,
|
|
4359
|
+
ref: hoverMenuRef,
|
|
4360
|
+
onMouseLeave: () => setOpenMenu(false)
|
|
4361
|
+
},
|
|
4362
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
|
4363
|
+
"div",
|
|
4364
|
+
{
|
|
4365
|
+
className: "Layer__hover-menu__children",
|
|
4366
|
+
role: "button",
|
|
4367
|
+
onMouseEnter: () => setOpenMenu(true),
|
|
4368
|
+
onClick: () => setOpenMenu(true)
|
|
4369
|
+
},
|
|
4370
|
+
children
|
|
4371
|
+
),
|
|
4372
|
+
/* @__PURE__ */ import_react46.default.createElement("div", { className: "Layer__hover-menu__list-wrapper" }, /* @__PURE__ */ import_react46.default.createElement("ul", { className: "Layer__hover-menu__list" }, config && config.length > 0 && config.map((item) => /* @__PURE__ */ import_react46.default.createElement(
|
|
4373
|
+
"li",
|
|
4374
|
+
{
|
|
4375
|
+
key: `hover-menu-${item.name}`,
|
|
4376
|
+
className: "Layer__hover-menu__list-item"
|
|
4377
|
+
},
|
|
4378
|
+
/* @__PURE__ */ import_react46.default.createElement(
|
|
4379
|
+
"button",
|
|
4380
|
+
{
|
|
4381
|
+
className: "Layer__hover-menu__list-item-button",
|
|
4382
|
+
onClick: () => item.action()
|
|
4383
|
+
},
|
|
4384
|
+
item.name
|
|
4385
|
+
)
|
|
4386
|
+
))))
|
|
4387
|
+
);
|
|
4388
|
+
};
|
|
4389
|
+
|
|
4390
|
+
// src/components/LinkedAccountOptions/LinkedAccountOptions.tsx
|
|
4391
|
+
var LinkedAccountOptions = ({
|
|
4392
|
+
children,
|
|
4393
|
+
config
|
|
4394
|
+
}) => {
|
|
4395
|
+
return /* @__PURE__ */ import_react47.default.createElement("div", { className: "Layer__linked-accounts__options" }, /* @__PURE__ */ import_react47.default.createElement("div", { className: "Layer__linked-accounts__options-overlay" }, /* @__PURE__ */ import_react47.default.createElement("div", { className: "Layer__linked-accounts__options-overlay-button" }, /* @__PURE__ */ import_react47.default.createElement(HoverMenu, { config }, /* @__PURE__ */ import_react47.default.createElement(MoreVertical_default, { size: 16 })))), children);
|
|
4396
|
+
};
|
|
4397
|
+
|
|
4398
|
+
// src/components/LinkedAccountThumb/LinkedAccountThumb.tsx
|
|
4399
|
+
var import_react48 = __toESM(require("react"));
|
|
4400
|
+
|
|
4401
|
+
// src/icons/InstitutionIcon.tsx
|
|
4402
|
+
var React62 = __toESM(require("react"));
|
|
4403
|
+
var InstitutionIcon = ({ size = 18, ...props }) => /* @__PURE__ */ React62.createElement(
|
|
4404
|
+
"svg",
|
|
4405
|
+
{
|
|
4406
|
+
viewBox: "0 0 27 28",
|
|
4407
|
+
fill: "none",
|
|
4408
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
4409
|
+
...props,
|
|
4410
|
+
width: size,
|
|
4411
|
+
height: size
|
|
4412
|
+
},
|
|
4413
|
+
/* @__PURE__ */ React62.createElement("g", { filter: "url(#filter0_i_2320_122784)" }, /* @__PURE__ */ React62.createElement(
|
|
4414
|
+
"path",
|
|
4415
|
+
{
|
|
4416
|
+
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",
|
|
4417
|
+
fill: "currentColor"
|
|
4418
|
+
}
|
|
4419
|
+
)),
|
|
4420
|
+
/* @__PURE__ */ React62.createElement("g", { filter: "url(#filter1_i_2320_122784)" }, /* @__PURE__ */ React62.createElement(
|
|
4421
|
+
"path",
|
|
4422
|
+
{
|
|
4423
|
+
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",
|
|
4424
|
+
fill: "currentColor"
|
|
4425
|
+
}
|
|
4426
|
+
)),
|
|
4427
|
+
/* @__PURE__ */ React62.createElement("g", { filter: "url(#filter2_i_2320_122784)" }, /* @__PURE__ */ React62.createElement(
|
|
4428
|
+
"path",
|
|
4429
|
+
{
|
|
4430
|
+
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",
|
|
4431
|
+
fill: "currentColor"
|
|
4432
|
+
}
|
|
4433
|
+
)),
|
|
4434
|
+
/* @__PURE__ */ React62.createElement("g", { filter: "url(#filter3_i_2320_122784)" }, /* @__PURE__ */ React62.createElement(
|
|
4435
|
+
"path",
|
|
4436
|
+
{
|
|
4437
|
+
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",
|
|
4438
|
+
fill: "currentColor"
|
|
4439
|
+
}
|
|
4440
|
+
)),
|
|
4441
|
+
/* @__PURE__ */ React62.createElement("g", { filter: "url(#filter4_i_2320_122784)" }, /* @__PURE__ */ React62.createElement(
|
|
4442
|
+
"path",
|
|
4443
|
+
{
|
|
4444
|
+
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",
|
|
4445
|
+
fill: "currentColor"
|
|
4446
|
+
}
|
|
4447
|
+
)),
|
|
4448
|
+
/* @__PURE__ */ React62.createElement("defs", null, /* @__PURE__ */ React62.createElement(
|
|
4449
|
+
"filter",
|
|
4450
|
+
{
|
|
4451
|
+
id: "filter0_i_2320_122784",
|
|
4452
|
+
x: "0",
|
|
4453
|
+
y: "0.847168",
|
|
4454
|
+
width: "27",
|
|
4455
|
+
height: "9.86707",
|
|
4456
|
+
filterUnits: "userSpaceOnUse",
|
|
4457
|
+
colorInterpolationFilters: "sRGB"
|
|
4458
|
+
},
|
|
4459
|
+
/* @__PURE__ */ React62.createElement("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
4460
|
+
/* @__PURE__ */ React62.createElement(
|
|
4461
|
+
"feBlend",
|
|
4462
|
+
{
|
|
4463
|
+
mode: "normal",
|
|
4464
|
+
in: "SourceGraphic",
|
|
4465
|
+
in2: "BackgroundImageFix",
|
|
4466
|
+
result: "shape"
|
|
4467
|
+
}
|
|
4468
|
+
),
|
|
4469
|
+
/* @__PURE__ */ React62.createElement(
|
|
4470
|
+
"feColorMatrix",
|
|
4471
|
+
{
|
|
4472
|
+
in: "SourceAlpha",
|
|
4473
|
+
type: "matrix",
|
|
4474
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
4475
|
+
result: "hardAlpha"
|
|
4476
|
+
}
|
|
4477
|
+
),
|
|
4478
|
+
/* @__PURE__ */ React62.createElement("feOffset", null),
|
|
4479
|
+
/* @__PURE__ */ React62.createElement("feGaussianBlur", { stdDeviation: "0.5" }),
|
|
4480
|
+
/* @__PURE__ */ React62.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
4481
|
+
/* @__PURE__ */ React62.createElement(
|
|
4482
|
+
"feColorMatrix",
|
|
4483
|
+
{
|
|
4484
|
+
type: "matrix",
|
|
4485
|
+
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"
|
|
4486
|
+
}
|
|
4487
|
+
),
|
|
4488
|
+
/* @__PURE__ */ React62.createElement(
|
|
4489
|
+
"feBlend",
|
|
4490
|
+
{
|
|
4491
|
+
mode: "normal",
|
|
4492
|
+
in2: "shape",
|
|
4493
|
+
result: "effect1_innerShadow_2320_122784"
|
|
4494
|
+
}
|
|
4495
|
+
)
|
|
4496
|
+
), /* @__PURE__ */ React62.createElement(
|
|
4497
|
+
"filter",
|
|
4498
|
+
{
|
|
4499
|
+
id: "filter1_i_2320_122784",
|
|
4500
|
+
x: "3",
|
|
4501
|
+
y: "12",
|
|
4502
|
+
width: "5",
|
|
4503
|
+
height: "9",
|
|
4504
|
+
filterUnits: "userSpaceOnUse",
|
|
4505
|
+
colorInterpolationFilters: "sRGB"
|
|
4506
|
+
},
|
|
4507
|
+
/* @__PURE__ */ React62.createElement("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
4508
|
+
/* @__PURE__ */ React62.createElement(
|
|
4509
|
+
"feBlend",
|
|
4510
|
+
{
|
|
4511
|
+
mode: "normal",
|
|
4512
|
+
in: "SourceGraphic",
|
|
4513
|
+
in2: "BackgroundImageFix",
|
|
4514
|
+
result: "shape"
|
|
4515
|
+
}
|
|
4516
|
+
),
|
|
4517
|
+
/* @__PURE__ */ React62.createElement(
|
|
4518
|
+
"feColorMatrix",
|
|
4519
|
+
{
|
|
4520
|
+
in: "SourceAlpha",
|
|
4521
|
+
type: "matrix",
|
|
4522
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
4523
|
+
result: "hardAlpha"
|
|
4524
|
+
}
|
|
4525
|
+
),
|
|
4526
|
+
/* @__PURE__ */ React62.createElement("feOffset", null),
|
|
4527
|
+
/* @__PURE__ */ React62.createElement("feGaussianBlur", { stdDeviation: "0.5" }),
|
|
4528
|
+
/* @__PURE__ */ React62.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
4529
|
+
/* @__PURE__ */ React62.createElement(
|
|
4530
|
+
"feColorMatrix",
|
|
4531
|
+
{
|
|
4532
|
+
type: "matrix",
|
|
4533
|
+
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"
|
|
4534
|
+
}
|
|
4535
|
+
),
|
|
4536
|
+
/* @__PURE__ */ React62.createElement(
|
|
4537
|
+
"feBlend",
|
|
4538
|
+
{
|
|
4539
|
+
mode: "normal",
|
|
4540
|
+
in2: "shape",
|
|
4541
|
+
result: "effect1_innerShadow_2320_122784"
|
|
4542
|
+
}
|
|
4543
|
+
)
|
|
4544
|
+
), /* @__PURE__ */ React62.createElement(
|
|
4545
|
+
"filter",
|
|
4546
|
+
{
|
|
4547
|
+
id: "filter2_i_2320_122784",
|
|
4548
|
+
x: "11",
|
|
4549
|
+
y: "12",
|
|
4550
|
+
width: "5",
|
|
4551
|
+
height: "9",
|
|
4552
|
+
filterUnits: "userSpaceOnUse",
|
|
4553
|
+
colorInterpolationFilters: "sRGB"
|
|
4554
|
+
},
|
|
4555
|
+
/* @__PURE__ */ React62.createElement("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
4556
|
+
/* @__PURE__ */ React62.createElement(
|
|
4557
|
+
"feBlend",
|
|
4558
|
+
{
|
|
4559
|
+
mode: "normal",
|
|
4560
|
+
in: "SourceGraphic",
|
|
4561
|
+
in2: "BackgroundImageFix",
|
|
4562
|
+
result: "shape"
|
|
4563
|
+
}
|
|
4564
|
+
),
|
|
4565
|
+
/* @__PURE__ */ React62.createElement(
|
|
4566
|
+
"feColorMatrix",
|
|
4567
|
+
{
|
|
4568
|
+
in: "SourceAlpha",
|
|
4569
|
+
type: "matrix",
|
|
4570
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
4571
|
+
result: "hardAlpha"
|
|
4572
|
+
}
|
|
4573
|
+
),
|
|
4574
|
+
/* @__PURE__ */ React62.createElement("feOffset", null),
|
|
4575
|
+
/* @__PURE__ */ React62.createElement("feGaussianBlur", { stdDeviation: "0.5" }),
|
|
4576
|
+
/* @__PURE__ */ React62.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
4577
|
+
/* @__PURE__ */ React62.createElement(
|
|
4578
|
+
"feColorMatrix",
|
|
4579
|
+
{
|
|
4580
|
+
type: "matrix",
|
|
4581
|
+
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"
|
|
4582
|
+
}
|
|
4583
|
+
),
|
|
4584
|
+
/* @__PURE__ */ React62.createElement(
|
|
4585
|
+
"feBlend",
|
|
4586
|
+
{
|
|
4587
|
+
mode: "normal",
|
|
4588
|
+
in2: "shape",
|
|
4589
|
+
result: "effect1_innerShadow_2320_122784"
|
|
4590
|
+
}
|
|
4591
|
+
)
|
|
4592
|
+
), /* @__PURE__ */ React62.createElement(
|
|
4593
|
+
"filter",
|
|
4594
|
+
{
|
|
4595
|
+
id: "filter3_i_2320_122784",
|
|
4596
|
+
x: "19",
|
|
4597
|
+
y: "12",
|
|
4598
|
+
width: "5",
|
|
4599
|
+
height: "9",
|
|
4600
|
+
filterUnits: "userSpaceOnUse",
|
|
4601
|
+
colorInterpolationFilters: "sRGB"
|
|
4602
|
+
},
|
|
4603
|
+
/* @__PURE__ */ React62.createElement("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
4604
|
+
/* @__PURE__ */ React62.createElement(
|
|
4605
|
+
"feBlend",
|
|
4606
|
+
{
|
|
4607
|
+
mode: "normal",
|
|
4608
|
+
in: "SourceGraphic",
|
|
4609
|
+
in2: "BackgroundImageFix",
|
|
4610
|
+
result: "shape"
|
|
4611
|
+
}
|
|
4612
|
+
),
|
|
4613
|
+
/* @__PURE__ */ React62.createElement(
|
|
4614
|
+
"feColorMatrix",
|
|
4615
|
+
{
|
|
4616
|
+
in: "SourceAlpha",
|
|
4617
|
+
type: "matrix",
|
|
4618
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
4619
|
+
result: "hardAlpha"
|
|
4620
|
+
}
|
|
4621
|
+
),
|
|
4622
|
+
/* @__PURE__ */ React62.createElement("feOffset", null),
|
|
4623
|
+
/* @__PURE__ */ React62.createElement("feGaussianBlur", { stdDeviation: "0.5" }),
|
|
4624
|
+
/* @__PURE__ */ React62.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
4625
|
+
/* @__PURE__ */ React62.createElement(
|
|
4626
|
+
"feColorMatrix",
|
|
4627
|
+
{
|
|
4628
|
+
type: "matrix",
|
|
4629
|
+
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"
|
|
4630
|
+
}
|
|
4631
|
+
),
|
|
4632
|
+
/* @__PURE__ */ React62.createElement(
|
|
4633
|
+
"feBlend",
|
|
4634
|
+
{
|
|
4635
|
+
mode: "normal",
|
|
4636
|
+
in2: "shape",
|
|
4637
|
+
result: "effect1_innerShadow_2320_122784"
|
|
4638
|
+
}
|
|
4639
|
+
)
|
|
4640
|
+
), /* @__PURE__ */ React62.createElement(
|
|
4641
|
+
"filter",
|
|
4642
|
+
{
|
|
4643
|
+
id: "filter4_i_2320_122784",
|
|
4644
|
+
x: "1",
|
|
4645
|
+
y: "22.2856",
|
|
4646
|
+
width: "25",
|
|
4647
|
+
height: "5",
|
|
4648
|
+
filterUnits: "userSpaceOnUse",
|
|
4649
|
+
colorInterpolationFilters: "sRGB"
|
|
4650
|
+
},
|
|
4651
|
+
/* @__PURE__ */ React62.createElement("feFlood", { floodOpacity: "0", result: "BackgroundImageFix" }),
|
|
4652
|
+
/* @__PURE__ */ React62.createElement(
|
|
4653
|
+
"feBlend",
|
|
4654
|
+
{
|
|
4655
|
+
mode: "normal",
|
|
4656
|
+
in: "SourceGraphic",
|
|
4657
|
+
in2: "BackgroundImageFix",
|
|
4658
|
+
result: "shape"
|
|
4659
|
+
}
|
|
4660
|
+
),
|
|
4661
|
+
/* @__PURE__ */ React62.createElement(
|
|
4662
|
+
"feColorMatrix",
|
|
4663
|
+
{
|
|
4664
|
+
in: "SourceAlpha",
|
|
4665
|
+
type: "matrix",
|
|
4666
|
+
values: "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0",
|
|
4667
|
+
result: "hardAlpha"
|
|
4668
|
+
}
|
|
4669
|
+
),
|
|
4670
|
+
/* @__PURE__ */ React62.createElement("feOffset", null),
|
|
4671
|
+
/* @__PURE__ */ React62.createElement("feGaussianBlur", { stdDeviation: "0.5" }),
|
|
4672
|
+
/* @__PURE__ */ React62.createElement("feComposite", { in2: "hardAlpha", operator: "arithmetic", k2: "-1", k3: "1" }),
|
|
4673
|
+
/* @__PURE__ */ React62.createElement(
|
|
4674
|
+
"feColorMatrix",
|
|
4675
|
+
{
|
|
4676
|
+
type: "matrix",
|
|
4677
|
+
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"
|
|
4678
|
+
}
|
|
4679
|
+
),
|
|
4680
|
+
/* @__PURE__ */ React62.createElement(
|
|
4681
|
+
"feBlend",
|
|
4682
|
+
{
|
|
4683
|
+
mode: "normal",
|
|
4684
|
+
in2: "shape",
|
|
4685
|
+
result: "effect1_innerShadow_2320_122784"
|
|
4686
|
+
}
|
|
4687
|
+
)
|
|
4688
|
+
))
|
|
4689
|
+
);
|
|
4690
|
+
var InstitutionIcon_default = InstitutionIcon;
|
|
4691
|
+
|
|
4692
|
+
// src/components/LinkedAccountThumb/LinkedAccountThumb.tsx
|
|
4693
|
+
var import_classnames24 = __toESM(require("classnames"));
|
|
4694
|
+
var AccountNumber = ({ accountNumber }) => /* @__PURE__ */ import_react48.default.createElement("div", { className: "account-number" }, /* @__PURE__ */ import_react48.default.createElement(Text, { size: "sm" }, "\u2022\u2022\u2022", accountNumber));
|
|
4695
|
+
var LinkedAccountThumb = ({
|
|
4696
|
+
account,
|
|
4697
|
+
asWidget
|
|
4698
|
+
}) => {
|
|
4699
|
+
const linkedAccountThumbClassName = (0, import_classnames24.default)(
|
|
4700
|
+
"Layer__linked-account-thumb",
|
|
4701
|
+
asWidget && "--as-widget"
|
|
4702
|
+
);
|
|
4703
|
+
return /* @__PURE__ */ import_react48.default.createElement("div", { className: linkedAccountThumbClassName }, /* @__PURE__ */ import_react48.default.createElement("div", { className: "topbar" }, /* @__PURE__ */ import_react48.default.createElement("div", { className: "topbar-details" }, /* @__PURE__ */ import_react48.default.createElement(Text, { as: "span", className: "account-name" }, account.external_account_name), !asWidget && /* @__PURE__ */ import_react48.default.createElement(AccountNumber, { accountNumber: account.external_account_number }), /* @__PURE__ */ import_react48.default.createElement(
|
|
4704
|
+
Text,
|
|
4705
|
+
{
|
|
4706
|
+
as: "span",
|
|
4707
|
+
className: "account-institution",
|
|
4708
|
+
size: "sm"
|
|
4709
|
+
},
|
|
4710
|
+
account.institution
|
|
4711
|
+
)), /* @__PURE__ */ import_react48.default.createElement("div", { className: "topbar-logo" }, !account.institutionLogo && /* @__PURE__ */ import_react48.default.createElement(InstitutionIcon_default, null))), !asWidget && /* @__PURE__ */ import_react48.default.createElement("div", { className: "middlebar" }, /* @__PURE__ */ import_react48.default.createElement(
|
|
4712
|
+
Text,
|
|
4713
|
+
{
|
|
4714
|
+
as: "span",
|
|
4715
|
+
className: "account-balance-text",
|
|
4716
|
+
size: "sm"
|
|
4717
|
+
},
|
|
4718
|
+
"Bank balance"
|
|
4719
|
+
), /* @__PURE__ */ import_react48.default.createElement(Text, { as: "span", className: "account-balance" }, "$", centsToDollars(account.latest_balance_timestamp.balance))), /* @__PURE__ */ import_react48.default.createElement("div", { className: "bottombar" }, asWidget ? /* @__PURE__ */ import_react48.default.createElement(AccountNumber, { accountNumber: account.external_account_number }) : /* @__PURE__ */ import_react48.default.createElement(
|
|
4720
|
+
Text,
|
|
4721
|
+
{
|
|
4722
|
+
as: "span",
|
|
4723
|
+
className: "account-balance-text",
|
|
4724
|
+
size: "sm"
|
|
4725
|
+
},
|
|
4726
|
+
"General ledger balance"
|
|
4727
|
+
), /* @__PURE__ */ import_react48.default.createElement(Text, { as: "span", className: "account-balance" }, "$", centsToDollars(account.current_ledger_balance))));
|
|
4728
|
+
};
|
|
4729
|
+
|
|
4730
|
+
// src/components/LinkedAccounts/LinkedAccounts.tsx
|
|
4731
|
+
var import_classnames25 = __toESM(require("classnames"));
|
|
4732
|
+
var COMPONENT_NAME2 = "linked-accounts";
|
|
4733
|
+
var LinkedAccounts = ({ asWidget }) => {
|
|
4734
|
+
const {
|
|
4735
|
+
data,
|
|
4736
|
+
isLoading,
|
|
4737
|
+
error,
|
|
4738
|
+
isValidating,
|
|
4739
|
+
refetch,
|
|
4740
|
+
addAccount,
|
|
4741
|
+
unlinkAccount,
|
|
4742
|
+
renewLinkAccount
|
|
4743
|
+
} = useLinkedAccounts();
|
|
4744
|
+
const linkedAccountOptionsConfig = [
|
|
4745
|
+
{ name: "Renew link", action: renewLinkAccount },
|
|
4746
|
+
{ name: "Unlink", action: unlinkAccount }
|
|
4747
|
+
];
|
|
4748
|
+
const linkedAccountsNewAccountClassName = (0, import_classnames25.default)(
|
|
4749
|
+
"Layer__linked-accounts__new-account",
|
|
4750
|
+
asWidget && "--as-widget"
|
|
4751
|
+
);
|
|
4752
|
+
return /* @__PURE__ */ import_react49.default.createElement(Container, { name: COMPONENT_NAME2 }, /* @__PURE__ */ import_react49.default.createElement(Header, { className: "Layer__linked-accounts__header" }, /* @__PURE__ */ import_react49.default.createElement(
|
|
4753
|
+
Heading,
|
|
4754
|
+
{
|
|
4755
|
+
className: "Layer__linked-accounts__title",
|
|
4756
|
+
size: "secondary" /* secondary */
|
|
4757
|
+
},
|
|
4758
|
+
"Linked Accounts"
|
|
4759
|
+
)), isLoading && /* @__PURE__ */ import_react49.default.createElement("div", { className: "Layer__linked-accounts__loader-container" }, /* @__PURE__ */ import_react49.default.createElement(Loader2, null)), error && !isLoading ? /* @__PURE__ */ import_react49.default.createElement(
|
|
4760
|
+
DataState,
|
|
4761
|
+
{
|
|
4762
|
+
status: "failed" /* failed */,
|
|
4763
|
+
title: "Something went wrong",
|
|
4764
|
+
description: "We couldn\u2019t load your data.",
|
|
4765
|
+
onRefresh: () => refetch(),
|
|
4766
|
+
isLoading: isValidating
|
|
4767
|
+
}
|
|
4768
|
+
) : null, !error && !isLoading ? /* @__PURE__ */ import_react49.default.createElement("div", { className: "Layer__linked-accounts__list" }, data?.map((account, index) => /* @__PURE__ */ import_react49.default.createElement(
|
|
4769
|
+
LinkedAccountOptions,
|
|
4770
|
+
{
|
|
4771
|
+
key: `linked-acc-${index}`,
|
|
4772
|
+
config: linkedAccountOptionsConfig
|
|
4773
|
+
},
|
|
4774
|
+
/* @__PURE__ */ import_react49.default.createElement(LinkedAccountThumb, { account, asWidget })
|
|
4775
|
+
)), /* @__PURE__ */ import_react49.default.createElement(
|
|
4776
|
+
"div",
|
|
4777
|
+
{
|
|
4778
|
+
role: "button",
|
|
4779
|
+
tabIndex: 0,
|
|
4780
|
+
"aria-label": "new-account",
|
|
4781
|
+
onClick: () => addAccount(),
|
|
4782
|
+
className: linkedAccountsNewAccountClassName
|
|
4783
|
+
},
|
|
4784
|
+
/* @__PURE__ */ import_react49.default.createElement("div", { className: "Layer__linked-accounts__new-account-label" }, /* @__PURE__ */ import_react49.default.createElement(PlusIcon_default, { size: 15 }), /* @__PURE__ */ import_react49.default.createElement(Text, { as: "span", size: "sm" }, "New account"))
|
|
4785
|
+
)) : null);
|
|
4786
|
+
};
|
|
4787
|
+
|
|
4788
|
+
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
4789
|
+
var import_react59 = __toESM(require("react"));
|
|
4790
|
+
|
|
4791
|
+
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
4792
|
+
var import_react50 = require("react");
|
|
4793
|
+
|
|
4794
|
+
// src/utils/profitAndLossUtils.ts
|
|
4795
|
+
var doesLineItemQualifies = (item) => {
|
|
4796
|
+
return !(item.is_contra || item.value === void 0 || item.value === null || isNaN(item.value) || item.value === -Infinity || item.value === Infinity || item.value < 0);
|
|
4797
|
+
};
|
|
4798
|
+
var collectSubItems = (type, item) => {
|
|
4799
|
+
if (!item) {
|
|
4800
|
+
return [];
|
|
4801
|
+
}
|
|
4802
|
+
const items = [];
|
|
4803
|
+
item?.line_items?.forEach((item2) => {
|
|
4804
|
+
if (doesLineItemQualifies(item2)) {
|
|
4805
|
+
items.push({
|
|
4806
|
+
name: item2.name,
|
|
4807
|
+
display_name: item2.display_name,
|
|
4808
|
+
value: item2.value || 0,
|
|
4809
|
+
type
|
|
4810
|
+
});
|
|
4811
|
+
}
|
|
4197
4812
|
});
|
|
4198
4813
|
return items;
|
|
4199
4814
|
};
|
|
@@ -4231,7 +4846,7 @@ var applyShare = (items, total) => {
|
|
|
4231
4846
|
|
|
4232
4847
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
4233
4848
|
var import_date_fns10 = require("date-fns");
|
|
4234
|
-
var
|
|
4849
|
+
var import_swr5 = __toESM(require("swr"));
|
|
4235
4850
|
var useProfitAndLoss = ({
|
|
4236
4851
|
startDate: initialStartDate,
|
|
4237
4852
|
endDate: initialEndDate,
|
|
@@ -4242,24 +4857,24 @@ var useProfitAndLoss = ({
|
|
|
4242
4857
|
endDate: (0, import_date_fns10.endOfMonth)(/* @__PURE__ */ new Date())
|
|
4243
4858
|
}) => {
|
|
4244
4859
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
4245
|
-
const [startDate, setStartDate] = (0,
|
|
4860
|
+
const [startDate, setStartDate] = (0, import_react50.useState)(
|
|
4246
4861
|
initialStartDate || (0, import_date_fns10.startOfMonth)(Date.now())
|
|
4247
4862
|
);
|
|
4248
|
-
const [endDate, setEndDate] = (0,
|
|
4863
|
+
const [endDate, setEndDate] = (0, import_react50.useState)(
|
|
4249
4864
|
initialEndDate || (0, import_date_fns10.endOfMonth)(Date.now())
|
|
4250
4865
|
);
|
|
4251
|
-
const [filters, setFilters] = (0,
|
|
4866
|
+
const [filters, setFilters] = (0, import_react50.useState)({
|
|
4252
4867
|
expenses: void 0,
|
|
4253
4868
|
revenue: void 0
|
|
4254
4869
|
});
|
|
4255
|
-
const [sidebarScope, setSidebarScope] = (0,
|
|
4870
|
+
const [sidebarScope, setSidebarScope] = (0, import_react50.useState)(void 0);
|
|
4256
4871
|
const {
|
|
4257
4872
|
data: rawData,
|
|
4258
4873
|
isLoading,
|
|
4259
4874
|
isValidating,
|
|
4260
4875
|
error: rawError,
|
|
4261
4876
|
mutate
|
|
4262
|
-
} = (0,
|
|
4877
|
+
} = (0, import_swr5.default)(
|
|
4263
4878
|
businessId && startDate && endDate && auth?.access_token && `profit-and-loss-${businessId}-${startDate.valueOf()}-${endDate.valueOf()}-${tagFilter?.key}-${tagFilter?.values?.join(
|
|
4264
4879
|
","
|
|
4265
4880
|
)}-${reportingBasis}`,
|
|
@@ -4275,7 +4890,7 @@ var useProfitAndLoss = ({
|
|
|
4275
4890
|
})
|
|
4276
4891
|
);
|
|
4277
4892
|
const { data, error } = rawData || {};
|
|
4278
|
-
const { filteredData, filteredTotal } = (0,
|
|
4893
|
+
const { filteredData, filteredTotal } = (0, import_react50.useMemo)(() => {
|
|
4279
4894
|
if (!data) {
|
|
4280
4895
|
return { filteredData: [], filteredTotal: void 0 };
|
|
4281
4896
|
}
|
|
@@ -4360,7 +4975,7 @@ var useProfitAndLoss = ({
|
|
|
4360
4975
|
};
|
|
4361
4976
|
|
|
4362
4977
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
4363
|
-
var
|
|
4978
|
+
var import_react52 = __toESM(require("react"));
|
|
4364
4979
|
|
|
4365
4980
|
// src/utils/format.ts
|
|
4366
4981
|
var capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
@@ -4398,7 +5013,7 @@ var formatPercent = (value, options) => {
|
|
|
4398
5013
|
};
|
|
4399
5014
|
|
|
4400
5015
|
// src/components/ProfitAndLossChart/Indicator.tsx
|
|
4401
|
-
var
|
|
5016
|
+
var import_react51 = __toESM(require("react"));
|
|
4402
5017
|
var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
|
|
4403
5018
|
var Indicator = ({
|
|
4404
5019
|
viewBox = {},
|
|
@@ -4415,11 +5030,11 @@ var Indicator = ({
|
|
|
4415
5030
|
const multiplier = width > 12 ? 1.2 : 1;
|
|
4416
5031
|
const xOffset = (boxWidth * multiplier - boxWidth) / 2;
|
|
4417
5032
|
const borderRadius = width > 16 ? 8 : width / 2;
|
|
4418
|
-
(0,
|
|
5033
|
+
(0, import_react51.useEffect)(() => {
|
|
4419
5034
|
setAnimateFrom(animateTo);
|
|
4420
5035
|
}, [animateTo]);
|
|
4421
5036
|
const actualX = animateFrom === -1 ? animateTo : animateFrom;
|
|
4422
|
-
return /* @__PURE__ */
|
|
5037
|
+
return /* @__PURE__ */ import_react51.default.createElement(
|
|
4423
5038
|
"rect",
|
|
4424
5039
|
{
|
|
4425
5040
|
className: "Layer__profit-and-loss-chart__selection-indicator",
|
|
@@ -4443,7 +5058,7 @@ var barGap = 4;
|
|
|
4443
5058
|
var barSize = 20;
|
|
4444
5059
|
var ProfitAndLossChart = () => {
|
|
4445
5060
|
const { getColor } = useLayerContext();
|
|
4446
|
-
const { changeDateRange, dateRange } = (0,
|
|
5061
|
+
const { changeDateRange, dateRange } = (0, import_react52.useContext)(ProfitAndLoss.Context);
|
|
4447
5062
|
const thisMonth = (0, import_date_fns11.startOfMonth)(Date.now());
|
|
4448
5063
|
const startSelectionMonth = dateRange.startDate.getMonth();
|
|
4449
5064
|
const endSelectionMonth = dateRange.endDate.getMonth();
|
|
@@ -4546,13 +5161,13 @@ var ProfitAndLossChart = () => {
|
|
|
4546
5161
|
if (active && payload && payload.length) {
|
|
4547
5162
|
const netProfit = payload[0].payload.netProfit ?? 0;
|
|
4548
5163
|
const netProfitClass = netProfit > 0 ? "positive" : netProfit < 0 ? "negative" : "";
|
|
4549
|
-
return /* @__PURE__ */
|
|
5164
|
+
return /* @__PURE__ */ import_react52.default.createElement("div", { className: "Layer__chart__tooltip" }, /* @__PURE__ */ import_react52.default.createElement("ul", { className: "Layer__chart__tooltip-list" }, /* @__PURE__ */ import_react52.default.createElement("li", null, /* @__PURE__ */ import_react52.default.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[0].name ?? "")), /* @__PURE__ */ import_react52.default.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[0].value ?? 0)))), /* @__PURE__ */ import_react52.default.createElement("li", null, /* @__PURE__ */ import_react52.default.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[1].name ?? "")), /* @__PURE__ */ import_react52.default.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[1].value ?? 0)))), /* @__PURE__ */ import_react52.default.createElement("li", null, /* @__PURE__ */ import_react52.default.createElement("label", { className: "Layer__chart__tooltip-label" }, "Net Profit"), /* @__PURE__ */ import_react52.default.createElement("span", { className: `Layer__chart__tooltip-value ${netProfitClass}` }, "$", centsToDollars(netProfit)))));
|
|
4550
5165
|
}
|
|
4551
5166
|
return null;
|
|
4552
5167
|
};
|
|
4553
5168
|
const CustomizedCursor = (props) => {
|
|
4554
5169
|
const { x, width, height } = props;
|
|
4555
|
-
return /* @__PURE__ */
|
|
5170
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
4556
5171
|
import_recharts.Rectangle,
|
|
4557
5172
|
{
|
|
4558
5173
|
fill: getColor(900)?.hex ?? "#333",
|
|
@@ -4566,7 +5181,7 @@ var ProfitAndLossChart = () => {
|
|
|
4566
5181
|
}
|
|
4567
5182
|
);
|
|
4568
5183
|
};
|
|
4569
|
-
const data = (0,
|
|
5184
|
+
const data = (0, import_react52.useMemo)(
|
|
4570
5185
|
() => monthData.map(summarizePnL),
|
|
4571
5186
|
[
|
|
4572
5187
|
startSelectionMonth,
|
|
@@ -4574,8 +5189,8 @@ var ProfitAndLossChart = () => {
|
|
|
4574
5189
|
...monthData.map((m) => m?.net_profit)
|
|
4575
5190
|
]
|
|
4576
5191
|
);
|
|
4577
|
-
const [animateFrom, setAnimateFrom] = (0,
|
|
4578
|
-
return /* @__PURE__ */
|
|
5192
|
+
const [animateFrom, setAnimateFrom] = (0, import_react52.useState)(-1);
|
|
5193
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
4579
5194
|
import_recharts.ResponsiveContainer,
|
|
4580
5195
|
{
|
|
4581
5196
|
className: "Layer__chart-container",
|
|
@@ -4583,7 +5198,7 @@ var ProfitAndLossChart = () => {
|
|
|
4583
5198
|
height: "100%",
|
|
4584
5199
|
minHeight: 200
|
|
4585
5200
|
},
|
|
4586
|
-
/* @__PURE__ */
|
|
5201
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
4587
5202
|
import_recharts.BarChart,
|
|
4588
5203
|
{
|
|
4589
5204
|
margin: { left: 12, right: 12, bottom: 12 },
|
|
@@ -4592,17 +5207,17 @@ var ProfitAndLossChart = () => {
|
|
|
4592
5207
|
barGap,
|
|
4593
5208
|
className: "Layer__profit-and-loss-chart"
|
|
4594
5209
|
},
|
|
4595
|
-
/* @__PURE__ */
|
|
5210
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
4596
5211
|
import_recharts.Tooltip,
|
|
4597
5212
|
{
|
|
4598
5213
|
wrapperClassName: "Layer__chart__tooltip-wrapper",
|
|
4599
|
-
content: /* @__PURE__ */
|
|
4600
|
-
cursor: /* @__PURE__ */
|
|
5214
|
+
content: /* @__PURE__ */ import_react52.default.createElement(CustomTooltip, null),
|
|
5215
|
+
cursor: /* @__PURE__ */ import_react52.default.createElement(CustomizedCursor, null),
|
|
4601
5216
|
animationDuration: 100,
|
|
4602
5217
|
animationEasing: "ease-out"
|
|
4603
5218
|
}
|
|
4604
5219
|
),
|
|
4605
|
-
/* @__PURE__ */
|
|
5220
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
4606
5221
|
import_recharts.CartesianGrid,
|
|
4607
5222
|
{
|
|
4608
5223
|
vertical: false,
|
|
@@ -4610,7 +5225,7 @@ var ProfitAndLossChart = () => {
|
|
|
4610
5225
|
strokeDasharray: "5 5"
|
|
4611
5226
|
}
|
|
4612
5227
|
),
|
|
4613
|
-
/* @__PURE__ */
|
|
5228
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
4614
5229
|
import_recharts.Legend,
|
|
4615
5230
|
{
|
|
4616
5231
|
verticalAlign: "top",
|
|
@@ -4630,8 +5245,8 @@ var ProfitAndLossChart = () => {
|
|
|
4630
5245
|
]
|
|
4631
5246
|
}
|
|
4632
5247
|
),
|
|
4633
|
-
/* @__PURE__ */
|
|
4634
|
-
/* @__PURE__ */
|
|
5248
|
+
/* @__PURE__ */ import_react52.default.createElement(import_recharts.XAxis, { dataKey: "name", tickLine: false }),
|
|
5249
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
4635
5250
|
import_recharts.Bar,
|
|
4636
5251
|
{
|
|
4637
5252
|
dataKey: "revenue",
|
|
@@ -4640,10 +5255,10 @@ var ProfitAndLossChart = () => {
|
|
|
4640
5255
|
radius: [2, 2, 0, 0],
|
|
4641
5256
|
className: "Layer__profit-and-loss-chart__bar--income"
|
|
4642
5257
|
},
|
|
4643
|
-
/* @__PURE__ */
|
|
5258
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
4644
5259
|
import_recharts.LabelList,
|
|
4645
5260
|
{
|
|
4646
|
-
content: /* @__PURE__ */
|
|
5261
|
+
content: /* @__PURE__ */ import_react52.default.createElement(
|
|
4647
5262
|
Indicator,
|
|
4648
5263
|
{
|
|
4649
5264
|
animateFrom,
|
|
@@ -4652,7 +5267,7 @@ var ProfitAndLossChart = () => {
|
|
|
4652
5267
|
)
|
|
4653
5268
|
}
|
|
4654
5269
|
),
|
|
4655
|
-
data.map((entry) => /* @__PURE__ */
|
|
5270
|
+
data.map((entry) => /* @__PURE__ */ import_react52.default.createElement(
|
|
4656
5271
|
import_recharts.Cell,
|
|
4657
5272
|
{
|
|
4658
5273
|
key: entry.name,
|
|
@@ -4660,7 +5275,7 @@ var ProfitAndLossChart = () => {
|
|
|
4660
5275
|
}
|
|
4661
5276
|
))
|
|
4662
5277
|
),
|
|
4663
|
-
/* @__PURE__ */
|
|
5278
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
4664
5279
|
import_recharts.Bar,
|
|
4665
5280
|
{
|
|
4666
5281
|
dataKey: "expenses",
|
|
@@ -4669,7 +5284,7 @@ var ProfitAndLossChart = () => {
|
|
|
4669
5284
|
radius: [2, 2, 0, 0],
|
|
4670
5285
|
className: "Layer__profit-and-loss-chart__bar--expenses"
|
|
4671
5286
|
},
|
|
4672
|
-
data.map((entry) => /* @__PURE__ */
|
|
5287
|
+
data.map((entry) => /* @__PURE__ */ import_react52.default.createElement(
|
|
4673
5288
|
import_recharts.Cell,
|
|
4674
5289
|
{
|
|
4675
5290
|
key: entry.name,
|
|
@@ -4682,72 +5297,132 @@ var ProfitAndLossChart = () => {
|
|
|
4682
5297
|
};
|
|
4683
5298
|
|
|
4684
5299
|
// src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
|
|
4685
|
-
var
|
|
5300
|
+
var import_react53 = __toESM(require("react"));
|
|
4686
5301
|
var import_date_fns12 = require("date-fns");
|
|
4687
5302
|
var ProfitAndLossDatePicker = () => {
|
|
4688
|
-
const { changeDateRange, dateRange } = (0,
|
|
4689
|
-
const
|
|
4690
|
-
const
|
|
4691
|
-
const
|
|
4692
|
-
|
|
5303
|
+
const { changeDateRange, dateRange } = (0, import_react53.useContext)(ProfitAndLoss.Context);
|
|
5304
|
+
const [isAnimating, setIsAnimating] = (0, import_react53.useState)(false);
|
|
5305
|
+
const [localDate, setLocalDate] = (0, import_react53.useState)(dateRange.startDate);
|
|
5306
|
+
const [nextOpacity, setNextOpacity] = (0, import_react53.useState)(0);
|
|
5307
|
+
const [currentOpacity, setCurrentOpacity] = (0, import_react53.useState)(1);
|
|
5308
|
+
const [transformStyle, setTransformStyle] = (0, import_react53.useState)({
|
|
5309
|
+
transform: "translateX(33%)",
|
|
5310
|
+
transition: "ease"
|
|
5311
|
+
});
|
|
5312
|
+
(0, import_react53.useEffect)(() => {
|
|
5313
|
+
if (dateRange.startDate !== localDate && !isAnimating) {
|
|
5314
|
+
setLocalDate(dateRange.startDate);
|
|
5315
|
+
setTransformStyle({ transform: "translateX(33%)", transition: "none" });
|
|
5316
|
+
}
|
|
5317
|
+
}, [dateRange.startDate, localDate, isAnimating]);
|
|
5318
|
+
const change = (monthsToAdd) => {
|
|
5319
|
+
if (isAnimating)
|
|
5320
|
+
return;
|
|
5321
|
+
setIsAnimating(true);
|
|
5322
|
+
setNextOpacity(1);
|
|
5323
|
+
const newDate = (0, import_date_fns12.add)(localDate, { months: monthsToAdd });
|
|
5324
|
+
if (monthsToAdd === -1) {
|
|
5325
|
+
setCurrentOpacity(0);
|
|
5326
|
+
}
|
|
4693
5327
|
changeDateRange({
|
|
4694
5328
|
startDate: (0, import_date_fns12.startOfMonth)(newDate),
|
|
4695
5329
|
endDate: (0, import_date_fns12.endOfMonth)(newDate)
|
|
4696
5330
|
});
|
|
5331
|
+
const translateXValue = monthsToAdd > 0 ? "0%" : "66%";
|
|
5332
|
+
setTransformStyle({
|
|
5333
|
+
transform: `translateX(${translateXValue})`,
|
|
5334
|
+
transition: "transform 0.4s ease"
|
|
5335
|
+
});
|
|
5336
|
+
setTimeout(() => {
|
|
5337
|
+
setCurrentOpacity(1);
|
|
5338
|
+
}, 300);
|
|
5339
|
+
setTimeout(() => {
|
|
5340
|
+
setLocalDate(newDate);
|
|
5341
|
+
setTransformStyle({ transform: "translateX(33%)", transition: "none" });
|
|
5342
|
+
setIsAnimating(false);
|
|
5343
|
+
setNextOpacity(0);
|
|
5344
|
+
setCurrentOpacity(1);
|
|
5345
|
+
}, 300);
|
|
4697
5346
|
};
|
|
4698
|
-
const
|
|
4699
|
-
const
|
|
4700
|
-
|
|
4701
|
-
|
|
5347
|
+
const currentLabel = (0, import_date_fns12.format)(localDate, "LLLL, y");
|
|
5348
|
+
const prevLabel = (0, import_date_fns12.format)((0, import_date_fns12.add)(localDate, { months: -1 }), "LLLL, y");
|
|
5349
|
+
const nextLabel = (0, import_date_fns12.format)((0, import_date_fns12.add)(localDate, { months: 1 }), "LLLL, y");
|
|
5350
|
+
return /* @__PURE__ */ import_react53.default.createElement(
|
|
5351
|
+
"div",
|
|
4702
5352
|
{
|
|
4703
|
-
|
|
4704
|
-
className: "Layer__profit-and-loss-date-picker__button",
|
|
4705
|
-
onClick: previousMonth
|
|
5353
|
+
className: "Layer__profit-and-loss-date-picker"
|
|
4706
5354
|
},
|
|
4707
|
-
/* @__PURE__ */
|
|
4708
|
-
|
|
5355
|
+
/* @__PURE__ */ import_react53.default.createElement("div", { className: "Layer__profit-and-loss-date-picker__labels-container", style: transformStyle }, /* @__PURE__ */ import_react53.default.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, prevLabel), /* @__PURE__ */ import_react53.default.createElement(
|
|
5356
|
+
"span",
|
|
4709
5357
|
{
|
|
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__ */ import_react51.default.createElement(
|
|
4722
|
-
ChevronRight_default,
|
|
5358
|
+
className: "Layer__profit-and-loss-date-picker__label",
|
|
5359
|
+
style: { opacity: currentOpacity }
|
|
5360
|
+
},
|
|
5361
|
+
currentLabel
|
|
5362
|
+
), /* @__PURE__ */ import_react53.default.createElement(
|
|
5363
|
+
"span",
|
|
4723
5364
|
{
|
|
4724
|
-
className: "Layer__profit-and-loss-date-
|
|
4725
|
-
|
|
4726
|
-
}
|
|
4727
|
-
|
|
4728
|
-
|
|
5365
|
+
className: "Layer__profit-and-loss-date-picker__label",
|
|
5366
|
+
style: { opacity: nextOpacity }
|
|
5367
|
+
},
|
|
5368
|
+
nextLabel
|
|
5369
|
+
)),
|
|
5370
|
+
/* @__PURE__ */ import_react53.default.createElement(
|
|
5371
|
+
"button",
|
|
5372
|
+
{
|
|
5373
|
+
"aria-label": "View Previous Month",
|
|
5374
|
+
className: "Layer__profit-and-loss-date-picker__button",
|
|
5375
|
+
onClick: () => change(-1),
|
|
5376
|
+
disabled: isAnimating
|
|
5377
|
+
},
|
|
5378
|
+
/* @__PURE__ */ import_react53.default.createElement(
|
|
5379
|
+
ChevronLeft_default,
|
|
5380
|
+
{
|
|
5381
|
+
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
5382
|
+
size: 16
|
|
5383
|
+
}
|
|
5384
|
+
)
|
|
5385
|
+
),
|
|
5386
|
+
/* @__PURE__ */ import_react53.default.createElement(
|
|
5387
|
+
"button",
|
|
5388
|
+
{
|
|
5389
|
+
"aria-label": "View Next Month",
|
|
5390
|
+
className: "Layer__profit-and-loss-date-picker__button",
|
|
5391
|
+
onClick: () => change(1),
|
|
5392
|
+
disabled: isAnimating
|
|
5393
|
+
},
|
|
5394
|
+
/* @__PURE__ */ import_react53.default.createElement(
|
|
5395
|
+
ChevronRight_default,
|
|
5396
|
+
{
|
|
5397
|
+
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
5398
|
+
size: 16
|
|
5399
|
+
}
|
|
5400
|
+
)
|
|
5401
|
+
),
|
|
5402
|
+
/* @__PURE__ */ import_react53.default.createElement("div", { className: "Layer__profit-and-loss-date-picker__effect-blur" })
|
|
5403
|
+
);
|
|
4729
5404
|
};
|
|
4730
5405
|
|
|
4731
5406
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
4732
|
-
var
|
|
5407
|
+
var import_react56 = __toESM(require("react"));
|
|
4733
5408
|
|
|
4734
5409
|
// src/components/SkeletonLoader/SkeletonLoader.tsx
|
|
4735
|
-
var
|
|
4736
|
-
var
|
|
5410
|
+
var import_react54 = __toESM(require("react"));
|
|
5411
|
+
var import_classnames26 = __toESM(require("classnames"));
|
|
4737
5412
|
var SkeletonLoader = ({
|
|
4738
5413
|
height,
|
|
4739
5414
|
width,
|
|
4740
5415
|
className
|
|
4741
5416
|
}) => {
|
|
4742
|
-
const baseClassName = (0,
|
|
5417
|
+
const baseClassName = (0, import_classnames26.default)(
|
|
4743
5418
|
"Layer__skeleton-loader Layer__anim--skeleton-loading",
|
|
4744
5419
|
className
|
|
4745
5420
|
);
|
|
4746
|
-
return /* @__PURE__ */
|
|
5421
|
+
return /* @__PURE__ */ import_react54.default.createElement("div", { className: baseClassName, style: { width, height } });
|
|
4747
5422
|
};
|
|
4748
5423
|
|
|
4749
5424
|
// src/components/ProfitAndLossSummaries/MiniChart.tsx
|
|
4750
|
-
var
|
|
5425
|
+
var import_react55 = __toESM(require("react"));
|
|
4751
5426
|
|
|
4752
5427
|
// src/config/charts.ts
|
|
4753
5428
|
var INACTIVE_OPACITY_LEVELS = [
|
|
@@ -4838,7 +5513,7 @@ var DEFAULT_CHART_COLORS = [
|
|
|
4838
5513
|
// src/components/ProfitAndLossSummaries/MiniChart.tsx
|
|
4839
5514
|
var import_recharts2 = require("recharts");
|
|
4840
5515
|
var MiniChart = ({ data }) => {
|
|
4841
|
-
return /* @__PURE__ */
|
|
5516
|
+
return /* @__PURE__ */ import_react55.default.createElement(import_recharts2.PieChart, { width: 48, height: 48, className: "mini-chart" }, /* @__PURE__ */ import_react55.default.createElement(
|
|
4842
5517
|
import_recharts2.Pie,
|
|
4843
5518
|
{
|
|
4844
5519
|
data,
|
|
@@ -4857,7 +5532,7 @@ var MiniChart = ({ data }) => {
|
|
|
4857
5532
|
},
|
|
4858
5533
|
data.map((entry, index) => {
|
|
4859
5534
|
const colorConfig = DEFAULT_CHART_COLORS[index % DEFAULT_CHART_COLORS.length];
|
|
4860
|
-
return /* @__PURE__ */
|
|
5535
|
+
return /* @__PURE__ */ import_react55.default.createElement(
|
|
4861
5536
|
import_recharts2.Cell,
|
|
4862
5537
|
{
|
|
4863
5538
|
key: `cell-${index}`,
|
|
@@ -4871,7 +5546,7 @@ var MiniChart = ({ data }) => {
|
|
|
4871
5546
|
};
|
|
4872
5547
|
|
|
4873
5548
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
4874
|
-
var
|
|
5549
|
+
var import_classnames27 = __toESM(require("classnames"));
|
|
4875
5550
|
var CHART_PLACEHOLDER = [
|
|
4876
5551
|
{
|
|
4877
5552
|
name: "placeholder",
|
|
@@ -4907,34 +5582,34 @@ var ProfitAndLossSummaries = ({
|
|
|
4907
5582
|
isLoading,
|
|
4908
5583
|
setSidebarScope,
|
|
4909
5584
|
sidebarScope
|
|
4910
|
-
} = (0,
|
|
4911
|
-
const expensesChartData = (0,
|
|
5585
|
+
} = (0, import_react56.useContext)(ProfitAndLoss.Context);
|
|
5586
|
+
const expensesChartData = (0, import_react56.useMemo)(() => {
|
|
4912
5587
|
return buildMiniChartData("expenses", storedData);
|
|
4913
5588
|
}, [storedData]);
|
|
4914
|
-
const revenueChartData = (0,
|
|
5589
|
+
const revenueChartData = (0, import_react56.useMemo)(() => {
|
|
4915
5590
|
return buildMiniChartData("revenue", storedData);
|
|
4916
5591
|
}, [storedData]);
|
|
4917
5592
|
const data = storedData ? storedData : { income: { value: NaN }, net_profit: NaN };
|
|
4918
5593
|
const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
4919
5594
|
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
5595
|
const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
4921
|
-
return /* @__PURE__ */
|
|
5596
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
4922
5597
|
"div",
|
|
4923
5598
|
{
|
|
4924
5599
|
className: `Layer__profit-and-loss-summaries ${vertical ? "flex-col" : ""}`
|
|
4925
5600
|
},
|
|
4926
|
-
/* @__PURE__ */
|
|
5601
|
+
/* @__PURE__ */ import_react56.default.createElement(
|
|
4927
5602
|
"div",
|
|
4928
5603
|
{
|
|
4929
|
-
className: (0,
|
|
5604
|
+
className: (0, import_classnames27.default)(
|
|
4930
5605
|
"Layer__profit-and-loss-summaries__summary Layer__actionable",
|
|
4931
5606
|
"Layer__profit-and-loss-summaries__summary--income",
|
|
4932
5607
|
sidebarScope === "revenue" ? "active" : ""
|
|
4933
5608
|
),
|
|
4934
5609
|
onClick: () => setSidebarScope("revenue")
|
|
4935
5610
|
},
|
|
4936
|
-
/* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
5611
|
+
/* @__PURE__ */ import_react56.default.createElement(MiniChart, { data: revenueChartData }),
|
|
5612
|
+
/* @__PURE__ */ import_react56.default.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ import_react56.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, revenueLabel), isLoading || storedData === void 0 ? /* @__PURE__ */ import_react56.default.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ import_react56.default.createElement(SkeletonLoader, null)) : /* @__PURE__ */ import_react56.default.createElement(
|
|
4938
5613
|
"span",
|
|
4939
5614
|
{
|
|
4940
5615
|
className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
|
|
@@ -4942,18 +5617,18 @@ var ProfitAndLossSummaries = ({
|
|
|
4942
5617
|
centsToDollars(Math.abs(data?.income?.value ?? NaN))
|
|
4943
5618
|
))
|
|
4944
5619
|
),
|
|
4945
|
-
/* @__PURE__ */
|
|
5620
|
+
/* @__PURE__ */ import_react56.default.createElement(
|
|
4946
5621
|
"div",
|
|
4947
5622
|
{
|
|
4948
|
-
className: (0,
|
|
5623
|
+
className: (0, import_classnames27.default)(
|
|
4949
5624
|
"Layer__profit-and-loss-summaries__summary Layer__actionable",
|
|
4950
5625
|
"Layer__profit-and-loss-summaries__summary--expenses",
|
|
4951
5626
|
sidebarScope === "expenses" ? "active" : ""
|
|
4952
5627
|
),
|
|
4953
5628
|
onClick: () => setSidebarScope("expenses")
|
|
4954
5629
|
},
|
|
4955
|
-
/* @__PURE__ */
|
|
4956
|
-
/* @__PURE__ */
|
|
5630
|
+
/* @__PURE__ */ import_react56.default.createElement(MiniChart, { data: expensesChartData }),
|
|
5631
|
+
/* @__PURE__ */ import_react56.default.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ import_react56.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"), isLoading || storedData === void 0 ? /* @__PURE__ */ import_react56.default.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ import_react56.default.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ import_react56.default.createElement(
|
|
4957
5632
|
"span",
|
|
4958
5633
|
{
|
|
4959
5634
|
className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
|
|
@@ -4963,7 +5638,7 @@ var ProfitAndLossSummaries = ({
|
|
|
4963
5638
|
)
|
|
4964
5639
|
))
|
|
4965
5640
|
),
|
|
4966
|
-
/* @__PURE__ */
|
|
5641
|
+
/* @__PURE__ */ import_react56.default.createElement("div", { className: "Layer__profit-and-loss-summaries__summary net-profit Layer__profit-and-loss-summaries__summary--net-profit" }, /* @__PURE__ */ import_react56.default.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ import_react56.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), isLoading || storedData === void 0 ? /* @__PURE__ */ import_react56.default.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ import_react56.default.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ import_react56.default.createElement(
|
|
4967
5642
|
"span",
|
|
4968
5643
|
{
|
|
4969
5644
|
className: `Layer__profit-and-loss-summaries__amount ${netProfitDirectionClass}`
|
|
@@ -4974,14 +5649,14 @@ var ProfitAndLossSummaries = ({
|
|
|
4974
5649
|
};
|
|
4975
5650
|
|
|
4976
5651
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
4977
|
-
var
|
|
5652
|
+
var import_react58 = __toESM(require("react"));
|
|
4978
5653
|
|
|
4979
5654
|
// src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
|
|
4980
|
-
var
|
|
5655
|
+
var import_react57 = __toESM(require("react"));
|
|
4981
5656
|
|
|
4982
5657
|
// src/icons/PieChart.tsx
|
|
4983
|
-
var
|
|
4984
|
-
var PieChart2 = ({ size = 12, ...props }) => /* @__PURE__ */
|
|
5658
|
+
var React71 = __toESM(require("react"));
|
|
5659
|
+
var PieChart2 = ({ size = 12, ...props }) => /* @__PURE__ */ React71.createElement(
|
|
4985
5660
|
"svg",
|
|
4986
5661
|
{
|
|
4987
5662
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -4991,21 +5666,21 @@ var PieChart2 = ({ size = 12, ...props }) => /* @__PURE__ */ React65.createEleme
|
|
|
4991
5666
|
width: size,
|
|
4992
5667
|
height: size
|
|
4993
5668
|
},
|
|
4994
|
-
/* @__PURE__ */
|
|
5669
|
+
/* @__PURE__ */ React71.createElement("g", null, /* @__PURE__ */ React71.createElement(
|
|
4995
5670
|
"path",
|
|
4996
5671
|
{
|
|
4997
5672
|
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
5673
|
stroke: "currentColor",
|
|
4999
|
-
|
|
5000
|
-
|
|
5674
|
+
strokeLinecap: "round",
|
|
5675
|
+
strokeLinejoin: "round"
|
|
5001
5676
|
}
|
|
5002
|
-
), /* @__PURE__ */
|
|
5677
|
+
), /* @__PURE__ */ React71.createElement(
|
|
5003
5678
|
"path",
|
|
5004
5679
|
{
|
|
5005
5680
|
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
5681
|
stroke: "currentColor",
|
|
5007
|
-
|
|
5008
|
-
|
|
5682
|
+
strokeLinecap: "round",
|
|
5683
|
+
strokeLinejoin: "round"
|
|
5009
5684
|
}
|
|
5010
5685
|
))
|
|
5011
5686
|
);
|
|
@@ -5026,7 +5701,7 @@ var ProfitAndLossRow = ({
|
|
|
5026
5701
|
return null;
|
|
5027
5702
|
}
|
|
5028
5703
|
const { value, display_name, line_items } = lineItem;
|
|
5029
|
-
const [expanded, setExpanded] = (0,
|
|
5704
|
+
const [expanded, setExpanded] = (0, import_react57.useState)(true);
|
|
5030
5705
|
const amount = value ?? 0;
|
|
5031
5706
|
const amountString = centsToDollars(Math.abs(amount));
|
|
5032
5707
|
const labelClasses = [
|
|
@@ -5057,20 +5732,20 @@ var ProfitAndLossRow = ({
|
|
|
5057
5732
|
);
|
|
5058
5733
|
displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
|
|
5059
5734
|
displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
|
|
5060
|
-
return /* @__PURE__ */
|
|
5735
|
+
return /* @__PURE__ */ import_react57.default.createElement(import_react57.default.Fragment, null, /* @__PURE__ */ import_react57.default.createElement(
|
|
5061
5736
|
"div",
|
|
5062
5737
|
{
|
|
5063
5738
|
className: labelClasses.join(" "),
|
|
5064
5739
|
onClick: () => !lockExpanded && toggleExpanded()
|
|
5065
5740
|
},
|
|
5066
|
-
/* @__PURE__ */
|
|
5741
|
+
/* @__PURE__ */ import_react57.default.createElement("span", { className: "Layer__profit-and-loss-row__label__title" }, !lockExpanded && variant !== "summation" ? /* @__PURE__ */ import_react57.default.createElement(
|
|
5067
5742
|
ChevronDownFill_default,
|
|
5068
5743
|
{
|
|
5069
5744
|
size: 16,
|
|
5070
5745
|
className: "Layer__profit-and-loss-row__label__chevron"
|
|
5071
5746
|
}
|
|
5072
|
-
) : null, /* @__PURE__ */
|
|
5073
|
-
setSidebarScope && /* @__PURE__ */
|
|
5747
|
+
) : null, /* @__PURE__ */ import_react57.default.createElement(Text, null, display_name)),
|
|
5748
|
+
setSidebarScope && /* @__PURE__ */ import_react57.default.createElement(
|
|
5074
5749
|
"span",
|
|
5075
5750
|
{
|
|
5076
5751
|
className: "Layer__profit-and-loss-row__detailed-chart-btn",
|
|
@@ -5079,14 +5754,14 @@ var ProfitAndLossRow = ({
|
|
|
5079
5754
|
setSidebarScope && setSidebarScope(scope ?? "expenses");
|
|
5080
5755
|
}
|
|
5081
5756
|
},
|
|
5082
|
-
/* @__PURE__ */
|
|
5757
|
+
/* @__PURE__ */ import_react57.default.createElement(PieChart_default, null)
|
|
5083
5758
|
)
|
|
5084
|
-
), /* @__PURE__ */
|
|
5759
|
+
), /* @__PURE__ */ import_react57.default.createElement("div", { className: valueClasses.join(" ") }, /* @__PURE__ */ import_react57.default.createElement(Text, null, amountString)), canGoDeeper && hasChildren && /* @__PURE__ */ import_react57.default.createElement(
|
|
5085
5760
|
"div",
|
|
5086
5761
|
{
|
|
5087
5762
|
className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
|
|
5088
5763
|
},
|
|
5089
|
-
/* @__PURE__ */
|
|
5764
|
+
/* @__PURE__ */ import_react57.default.createElement("div", { className: "Layer__profit-and-loss-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ import_react57.default.createElement(
|
|
5090
5765
|
ProfitAndLossRow,
|
|
5091
5766
|
{
|
|
5092
5767
|
key: line_item.display_name,
|
|
@@ -5153,12 +5828,12 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5153
5828
|
data: actualData,
|
|
5154
5829
|
isLoading,
|
|
5155
5830
|
setSidebarScope
|
|
5156
|
-
} = (0,
|
|
5831
|
+
} = (0, import_react58.useContext)(ProfitAndLoss.Context);
|
|
5157
5832
|
const data = !actualData || isLoading ? empty_profit_and_loss_report_default : actualData;
|
|
5158
5833
|
if (isLoading || actualData === void 0) {
|
|
5159
|
-
return /* @__PURE__ */
|
|
5834
|
+
return /* @__PURE__ */ import_react58.default.createElement("div", { className: "Layer__profit-and-loss-table__loader-container" }, /* @__PURE__ */ import_react58.default.createElement(Loader2, null));
|
|
5160
5835
|
}
|
|
5161
|
-
return /* @__PURE__ */
|
|
5836
|
+
return /* @__PURE__ */ import_react58.default.createElement(import_react58.default.Fragment, null, /* @__PURE__ */ import_react58.default.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table--main" }, /* @__PURE__ */ import_react58.default.createElement(
|
|
5162
5837
|
ProfitAndLossRow,
|
|
5163
5838
|
{
|
|
5164
5839
|
lineItem: data.income,
|
|
@@ -5167,7 +5842,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5167
5842
|
scope: "revenue",
|
|
5168
5843
|
setSidebarScope
|
|
5169
5844
|
}
|
|
5170
|
-
), /* @__PURE__ */
|
|
5845
|
+
), /* @__PURE__ */ import_react58.default.createElement(
|
|
5171
5846
|
ProfitAndLossRow,
|
|
5172
5847
|
{
|
|
5173
5848
|
lineItem: data.cost_of_goods_sold,
|
|
@@ -5176,7 +5851,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5176
5851
|
scope: "expenses",
|
|
5177
5852
|
setSidebarScope
|
|
5178
5853
|
}
|
|
5179
|
-
), /* @__PURE__ */
|
|
5854
|
+
), /* @__PURE__ */ import_react58.default.createElement(
|
|
5180
5855
|
ProfitAndLossRow,
|
|
5181
5856
|
{
|
|
5182
5857
|
lineItem: {
|
|
@@ -5189,7 +5864,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5189
5864
|
scope: "revenue",
|
|
5190
5865
|
setSidebarScope
|
|
5191
5866
|
}
|
|
5192
|
-
), /* @__PURE__ */
|
|
5867
|
+
), /* @__PURE__ */ import_react58.default.createElement(
|
|
5193
5868
|
ProfitAndLossRow,
|
|
5194
5869
|
{
|
|
5195
5870
|
lineItem: data.expenses,
|
|
@@ -5198,7 +5873,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5198
5873
|
scope: "expenses",
|
|
5199
5874
|
setSidebarScope
|
|
5200
5875
|
}
|
|
5201
|
-
), /* @__PURE__ */
|
|
5876
|
+
), /* @__PURE__ */ import_react58.default.createElement(
|
|
5202
5877
|
ProfitAndLossRow,
|
|
5203
5878
|
{
|
|
5204
5879
|
lineItem: {
|
|
@@ -5211,7 +5886,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5211
5886
|
scope: "revenue",
|
|
5212
5887
|
setSidebarScope
|
|
5213
5888
|
}
|
|
5214
|
-
), /* @__PURE__ */
|
|
5889
|
+
), /* @__PURE__ */ import_react58.default.createElement(
|
|
5215
5890
|
ProfitAndLossRow,
|
|
5216
5891
|
{
|
|
5217
5892
|
lineItem: data.taxes,
|
|
@@ -5220,7 +5895,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5220
5895
|
scope: "expenses",
|
|
5221
5896
|
setSidebarScope
|
|
5222
5897
|
}
|
|
5223
|
-
), /* @__PURE__ */
|
|
5898
|
+
), /* @__PURE__ */ import_react58.default.createElement(
|
|
5224
5899
|
ProfitAndLossRow,
|
|
5225
5900
|
{
|
|
5226
5901
|
lineItem: {
|
|
@@ -5231,14 +5906,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5231
5906
|
direction: "CREDIT" /* CREDIT */,
|
|
5232
5907
|
lockExpanded
|
|
5233
5908
|
}
|
|
5234
|
-
)), data.other_outflows || data.personal_expenses ? /* @__PURE__ */
|
|
5909
|
+
)), data.other_outflows || data.personal_expenses ? /* @__PURE__ */ import_react58.default.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ import_react58.default.createElement(
|
|
5235
5910
|
ProfitAndLossRow,
|
|
5236
5911
|
{
|
|
5237
5912
|
lineItem: data.other_outflows,
|
|
5238
5913
|
direction: "DEBIT" /* DEBIT */,
|
|
5239
5914
|
lockExpanded
|
|
5240
5915
|
}
|
|
5241
|
-
), /* @__PURE__ */
|
|
5916
|
+
), /* @__PURE__ */ import_react58.default.createElement(
|
|
5242
5917
|
ProfitAndLossRow,
|
|
5243
5918
|
{
|
|
5244
5919
|
lineItem: data.personal_expenses,
|
|
@@ -5250,7 +5925,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
5250
5925
|
|
|
5251
5926
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
5252
5927
|
var import_date_fns13 = require("date-fns");
|
|
5253
|
-
var PNLContext = (0,
|
|
5928
|
+
var PNLContext = (0, import_react59.createContext)({
|
|
5254
5929
|
data: void 0,
|
|
5255
5930
|
filteredData: [],
|
|
5256
5931
|
filteredTotal: void 0,
|
|
@@ -5279,7 +5954,7 @@ var PNLContext = (0, import_react57.createContext)({
|
|
|
5279
5954
|
});
|
|
5280
5955
|
var ProfitAndLoss = ({ children, tagFilter, reportingBasis }) => {
|
|
5281
5956
|
const contextData = useProfitAndLoss({ tagFilter, reportingBasis });
|
|
5282
|
-
return /* @__PURE__ */
|
|
5957
|
+
return /* @__PURE__ */ import_react59.default.createElement(PNLContext.Provider, { value: contextData }, /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__component Layer__profit-and-loss" }, children));
|
|
5283
5958
|
};
|
|
5284
5959
|
ProfitAndLoss.Chart = ProfitAndLossChart;
|
|
5285
5960
|
ProfitAndLoss.Context = PNLContext;
|
|
@@ -5288,14 +5963,14 @@ ProfitAndLoss.Summaries = ProfitAndLossSummaries;
|
|
|
5288
5963
|
ProfitAndLoss.Table = ProfitAndLossTable;
|
|
5289
5964
|
|
|
5290
5965
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
5291
|
-
var
|
|
5966
|
+
var import_react64 = __toESM(require("react"));
|
|
5292
5967
|
|
|
5293
5968
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
5294
|
-
var
|
|
5969
|
+
var import_react63 = __toESM(require("react"));
|
|
5295
5970
|
|
|
5296
5971
|
// src/icons/X.tsx
|
|
5297
|
-
var
|
|
5298
|
-
var X = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
5972
|
+
var React75 = __toESM(require("react"));
|
|
5973
|
+
var X = ({ size = 18, ...props }) => /* @__PURE__ */ React75.createElement(
|
|
5299
5974
|
"svg",
|
|
5300
5975
|
{
|
|
5301
5976
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5305,7 +5980,7 @@ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React69.createElement(
|
|
|
5305
5980
|
width: size,
|
|
5306
5981
|
height: size
|
|
5307
5982
|
},
|
|
5308
|
-
/* @__PURE__ */
|
|
5983
|
+
/* @__PURE__ */ React75.createElement(
|
|
5309
5984
|
"path",
|
|
5310
5985
|
{
|
|
5311
5986
|
d: "M13.5 4.5L4.5 13.5",
|
|
@@ -5314,7 +5989,7 @@ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React69.createElement(
|
|
|
5314
5989
|
strokeLinejoin: "round"
|
|
5315
5990
|
}
|
|
5316
5991
|
),
|
|
5317
|
-
/* @__PURE__ */
|
|
5992
|
+
/* @__PURE__ */ React75.createElement(
|
|
5318
5993
|
"path",
|
|
5319
5994
|
{
|
|
5320
5995
|
d: "M4.5 4.5L13.5 13.5",
|
|
@@ -5327,7 +6002,7 @@ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React69.createElement(
|
|
|
5327
6002
|
var X_default = X;
|
|
5328
6003
|
|
|
5329
6004
|
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
5330
|
-
var
|
|
6005
|
+
var import_react60 = __toESM(require("react"));
|
|
5331
6006
|
var import_recharts3 = require("recharts");
|
|
5332
6007
|
var DetailedChart = ({
|
|
5333
6008
|
filteredData,
|
|
@@ -5337,7 +6012,7 @@ var DetailedChart = ({
|
|
|
5337
6012
|
sidebarScope,
|
|
5338
6013
|
date
|
|
5339
6014
|
}) => {
|
|
5340
|
-
const chartData = (0,
|
|
6015
|
+
const chartData = (0, import_react60.useMemo)(() => {
|
|
5341
6016
|
if (!filteredData) {
|
|
5342
6017
|
return [];
|
|
5343
6018
|
}
|
|
@@ -5354,7 +6029,7 @@ var DetailedChart = ({
|
|
|
5354
6029
|
};
|
|
5355
6030
|
});
|
|
5356
6031
|
}, [filteredData]);
|
|
5357
|
-
return /* @__PURE__ */
|
|
6032
|
+
return /* @__PURE__ */ import_react60.default.createElement("div", { className: "chart-field" }, /* @__PURE__ */ import_react60.default.createElement("div", { className: "header--tablet" }, /* @__PURE__ */ import_react60.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(sidebarScope)), /* @__PURE__ */ import_react60.default.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ import_react60.default.createElement("div", { className: "chart-container" }, /* @__PURE__ */ import_react60.default.createElement(import_recharts3.ResponsiveContainer, null, /* @__PURE__ */ import_react60.default.createElement(import_recharts3.PieChart, null, /* @__PURE__ */ import_react60.default.createElement(
|
|
5358
6033
|
import_recharts3.Pie,
|
|
5359
6034
|
{
|
|
5360
6035
|
data: chartData,
|
|
@@ -5379,7 +6054,7 @@ var DetailedChart = ({
|
|
|
5379
6054
|
fill = void 0;
|
|
5380
6055
|
opacity = INACTIVE_OPACITY_LEVELS[index % INACTIVE_OPACITY_LEVELS.length];
|
|
5381
6056
|
}
|
|
5382
|
-
return /* @__PURE__ */
|
|
6057
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
5383
6058
|
import_recharts3.Cell,
|
|
5384
6059
|
{
|
|
5385
6060
|
key: `cell-${index}`,
|
|
@@ -5391,7 +6066,7 @@ var DetailedChart = ({
|
|
|
5391
6066
|
}
|
|
5392
6067
|
);
|
|
5393
6068
|
}),
|
|
5394
|
-
/* @__PURE__ */
|
|
6069
|
+
/* @__PURE__ */ import_react60.default.createElement(
|
|
5395
6070
|
import_recharts3.Label,
|
|
5396
6071
|
{
|
|
5397
6072
|
position: "center",
|
|
@@ -5412,7 +6087,7 @@ var DetailedChart = ({
|
|
|
5412
6087
|
if (hoveredItem) {
|
|
5413
6088
|
text = hoveredItem;
|
|
5414
6089
|
}
|
|
5415
|
-
return /* @__PURE__ */
|
|
6090
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
5416
6091
|
import_recharts3.Text,
|
|
5417
6092
|
{
|
|
5418
6093
|
...positioningProps,
|
|
@@ -5423,7 +6098,7 @@ var DetailedChart = ({
|
|
|
5423
6098
|
}
|
|
5424
6099
|
}
|
|
5425
6100
|
),
|
|
5426
|
-
/* @__PURE__ */
|
|
6101
|
+
/* @__PURE__ */ import_react60.default.createElement(
|
|
5427
6102
|
import_recharts3.Label,
|
|
5428
6103
|
{
|
|
5429
6104
|
position: "center",
|
|
@@ -5446,7 +6121,7 @@ var DetailedChart = ({
|
|
|
5446
6121
|
(x) => x.display_name === hoveredItem
|
|
5447
6122
|
)?.value;
|
|
5448
6123
|
}
|
|
5449
|
-
return /* @__PURE__ */
|
|
6124
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
5450
6125
|
import_recharts3.Text,
|
|
5451
6126
|
{
|
|
5452
6127
|
...positioningProps,
|
|
@@ -5457,7 +6132,7 @@ var DetailedChart = ({
|
|
|
5457
6132
|
}
|
|
5458
6133
|
}
|
|
5459
6134
|
),
|
|
5460
|
-
/* @__PURE__ */
|
|
6135
|
+
/* @__PURE__ */ import_react60.default.createElement(
|
|
5461
6136
|
import_recharts3.Label,
|
|
5462
6137
|
{
|
|
5463
6138
|
position: "center",
|
|
@@ -5476,7 +6151,7 @@ var DetailedChart = ({
|
|
|
5476
6151
|
verticalAnchor: "middle"
|
|
5477
6152
|
};
|
|
5478
6153
|
if (hoveredItem) {
|
|
5479
|
-
return /* @__PURE__ */
|
|
6154
|
+
return /* @__PURE__ */ import_react60.default.createElement(
|
|
5480
6155
|
import_recharts3.Text,
|
|
5481
6156
|
{
|
|
5482
6157
|
...positioningProps,
|
|
@@ -5495,11 +6170,11 @@ var DetailedChart = ({
|
|
|
5495
6170
|
};
|
|
5496
6171
|
|
|
5497
6172
|
// src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
|
|
5498
|
-
var
|
|
6173
|
+
var import_react61 = __toESM(require("react"));
|
|
5499
6174
|
|
|
5500
6175
|
// src/icons/SortArrows.tsx
|
|
5501
|
-
var
|
|
5502
|
-
var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */
|
|
6176
|
+
var React77 = __toESM(require("react"));
|
|
6177
|
+
var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React77.createElement(
|
|
5503
6178
|
"svg",
|
|
5504
6179
|
{
|
|
5505
6180
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5509,44 +6184,44 @@ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React71.createElem
|
|
|
5509
6184
|
width: size,
|
|
5510
6185
|
height: size
|
|
5511
6186
|
},
|
|
5512
|
-
/* @__PURE__ */
|
|
6187
|
+
/* @__PURE__ */ React77.createElement("g", { "clip-path": "url(#clip0_1758_75388)" }, /* @__PURE__ */ React77.createElement(
|
|
5513
6188
|
"path",
|
|
5514
6189
|
{
|
|
5515
6190
|
d: "M1.33325 8.5L3.99992 11.1667L6.66659 8.5",
|
|
5516
6191
|
stroke: "currentColor",
|
|
5517
|
-
|
|
5518
|
-
|
|
6192
|
+
strokeLinecap: "round",
|
|
6193
|
+
strokeLinejoin: "round",
|
|
5519
6194
|
className: "desc-arrow"
|
|
5520
6195
|
}
|
|
5521
|
-
), /* @__PURE__ */
|
|
6196
|
+
), /* @__PURE__ */ React77.createElement(
|
|
5522
6197
|
"path",
|
|
5523
6198
|
{
|
|
5524
6199
|
d: "M4 2.5L4 11.1667",
|
|
5525
6200
|
stroke: "currentColor",
|
|
5526
|
-
|
|
5527
|
-
|
|
6201
|
+
strokeLinecap: "round",
|
|
6202
|
+
strokeLinejoin: "round",
|
|
5528
6203
|
className: "desc-arrow"
|
|
5529
6204
|
}
|
|
5530
|
-
), /* @__PURE__ */
|
|
6205
|
+
), /* @__PURE__ */ React77.createElement(
|
|
5531
6206
|
"path",
|
|
5532
6207
|
{
|
|
5533
6208
|
d: "M5.99988 5.16602L8.66654 2.49935L11.3332 5.16602",
|
|
5534
6209
|
stroke: "currentColor",
|
|
5535
|
-
|
|
5536
|
-
|
|
6210
|
+
strokeLinecap: "round",
|
|
6211
|
+
strokeLinejoin: "round",
|
|
5537
6212
|
className: "asc-arrow"
|
|
5538
6213
|
}
|
|
5539
|
-
), /* @__PURE__ */
|
|
6214
|
+
), /* @__PURE__ */ React77.createElement(
|
|
5540
6215
|
"path",
|
|
5541
6216
|
{
|
|
5542
6217
|
d: "M8.66663 11.166L8.66663 2.49935",
|
|
5543
6218
|
stroke: "currentColor",
|
|
5544
|
-
|
|
5545
|
-
|
|
6219
|
+
strokeLinecap: "round",
|
|
6220
|
+
strokeLinejoin: "round",
|
|
5546
6221
|
className: "asc-arrow"
|
|
5547
6222
|
}
|
|
5548
6223
|
)),
|
|
5549
|
-
/* @__PURE__ */
|
|
6224
|
+
/* @__PURE__ */ React77.createElement("defs", null, /* @__PURE__ */ React77.createElement("clipPath", { id: "clip0_1758_75388" }, /* @__PURE__ */ React77.createElement(
|
|
5550
6225
|
"rect",
|
|
5551
6226
|
{
|
|
5552
6227
|
width: "12",
|
|
@@ -5559,7 +6234,7 @@ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React71.createElem
|
|
|
5559
6234
|
var SortArrows_default = SortArrows;
|
|
5560
6235
|
|
|
5561
6236
|
// src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
|
|
5562
|
-
var
|
|
6237
|
+
var import_classnames28 = __toESM(require("classnames"));
|
|
5563
6238
|
var DetailedTable = ({
|
|
5564
6239
|
filteredData,
|
|
5565
6240
|
sidebarScope,
|
|
@@ -5569,52 +6244,52 @@ var DetailedTable = ({
|
|
|
5569
6244
|
setHoveredItem
|
|
5570
6245
|
}) => {
|
|
5571
6246
|
const buildColClass = (column) => {
|
|
5572
|
-
return (0,
|
|
6247
|
+
return (0, import_classnames28.default)(
|
|
5573
6248
|
"Layer__sortable-col",
|
|
5574
6249
|
sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
|
|
5575
6250
|
);
|
|
5576
6251
|
};
|
|
5577
|
-
return /* @__PURE__ */
|
|
6252
|
+
return /* @__PURE__ */ import_react61.default.createElement("div", { className: "details-container" }, /* @__PURE__ */ import_react61.default.createElement("div", { className: "table" }, /* @__PURE__ */ import_react61.default.createElement("table", null, /* @__PURE__ */ import_react61.default.createElement("thead", null, /* @__PURE__ */ import_react61.default.createElement("tr", null, /* @__PURE__ */ import_react61.default.createElement(
|
|
5578
6253
|
"th",
|
|
5579
6254
|
{
|
|
5580
6255
|
className: buildColClass("category"),
|
|
5581
6256
|
onClick: () => sortBy(sidebarScope ?? "expenses", "category")
|
|
5582
6257
|
},
|
|
5583
6258
|
"Expense/Sale ",
|
|
5584
|
-
/* @__PURE__ */
|
|
5585
|
-
), /* @__PURE__ */
|
|
6259
|
+
/* @__PURE__ */ import_react61.default.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
6260
|
+
), /* @__PURE__ */ import_react61.default.createElement(
|
|
5586
6261
|
"th",
|
|
5587
6262
|
{
|
|
5588
6263
|
className: buildColClass("type"),
|
|
5589
6264
|
onClick: () => sortBy(sidebarScope ?? "expenses", "type")
|
|
5590
6265
|
},
|
|
5591
6266
|
"Type ",
|
|
5592
|
-
/* @__PURE__ */
|
|
5593
|
-
), /* @__PURE__ */
|
|
6267
|
+
/* @__PURE__ */ import_react61.default.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
6268
|
+
), /* @__PURE__ */ import_react61.default.createElement("th", null), /* @__PURE__ */ import_react61.default.createElement(
|
|
5594
6269
|
"th",
|
|
5595
6270
|
{
|
|
5596
6271
|
className: buildColClass("value"),
|
|
5597
6272
|
onClick: () => sortBy(sidebarScope ?? "expenses", "value")
|
|
5598
6273
|
},
|
|
5599
6274
|
"Value ",
|
|
5600
|
-
/* @__PURE__ */
|
|
5601
|
-
))), /* @__PURE__ */
|
|
6275
|
+
/* @__PURE__ */ import_react61.default.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
6276
|
+
))), /* @__PURE__ */ import_react61.default.createElement("tbody", null, filteredData.filter((x) => !x.hidden).map((item, idx) => {
|
|
5602
6277
|
const colorConfig = DEFAULT_CHART_COLORS[idx % DEFAULT_CHART_COLORS.length];
|
|
5603
|
-
return /* @__PURE__ */
|
|
6278
|
+
return /* @__PURE__ */ import_react61.default.createElement(
|
|
5604
6279
|
"tr",
|
|
5605
6280
|
{
|
|
5606
6281
|
key: `pl-side-table-item-${idx}`,
|
|
5607
|
-
className: (0,
|
|
6282
|
+
className: (0, import_classnames28.default)(
|
|
5608
6283
|
"Layer__profit-and-loss-detailed-table__row",
|
|
5609
6284
|
hoveredItem && hoveredItem === item.display_name ? "active" : ""
|
|
5610
6285
|
),
|
|
5611
6286
|
onMouseEnter: () => setHoveredItem(item.display_name),
|
|
5612
6287
|
onMouseLeave: () => setHoveredItem(void 0)
|
|
5613
6288
|
},
|
|
5614
|
-
/* @__PURE__ */
|
|
5615
|
-
/* @__PURE__ */
|
|
5616
|
-
/* @__PURE__ */
|
|
5617
|
-
/* @__PURE__ */
|
|
6289
|
+
/* @__PURE__ */ import_react61.default.createElement("td", { className: "category-col" }, item.display_name),
|
|
6290
|
+
/* @__PURE__ */ import_react61.default.createElement("td", { className: "type-col" }, item.type),
|
|
6291
|
+
/* @__PURE__ */ import_react61.default.createElement("td", { className: "value-col" }, "$", centsToDollars(item.value)),
|
|
6292
|
+
/* @__PURE__ */ import_react61.default.createElement("td", { className: "share-col" }, /* @__PURE__ */ import_react61.default.createElement("span", { className: "share-cell-content" }, formatPercent(item.share), "%", /* @__PURE__ */ import_react61.default.createElement(
|
|
5618
6293
|
"div",
|
|
5619
6294
|
{
|
|
5620
6295
|
className: "share-icon",
|
|
@@ -5629,16 +6304,16 @@ var DetailedTable = ({
|
|
|
5629
6304
|
};
|
|
5630
6305
|
|
|
5631
6306
|
// src/components/ProfitAndLossDetailedCharts/Filters.tsx
|
|
5632
|
-
var
|
|
5633
|
-
var
|
|
6307
|
+
var import_react62 = __toESM(require("react"));
|
|
6308
|
+
var import_react_select3 = __toESM(require("react-select"));
|
|
5634
6309
|
var Filters = ({
|
|
5635
6310
|
filteredData,
|
|
5636
6311
|
sidebarScope,
|
|
5637
6312
|
filters,
|
|
5638
6313
|
setFilterTypes
|
|
5639
6314
|
}) => {
|
|
5640
|
-
return /* @__PURE__ */
|
|
5641
|
-
|
|
6315
|
+
return /* @__PURE__ */ import_react62.default.createElement("div", { className: "filters" }, /* @__PURE__ */ import_react62.default.createElement(Text, { size: "sm" /* sm */, className: "Layer__label" }, "Filters"), /* @__PURE__ */ import_react62.default.createElement(
|
|
6316
|
+
import_react_select3.default,
|
|
5642
6317
|
{
|
|
5643
6318
|
className: "Layer__select type-select",
|
|
5644
6319
|
classNamePrefix: "Layer__select",
|
|
@@ -5659,15 +6334,15 @@ var Filters = ({
|
|
|
5659
6334
|
);
|
|
5660
6335
|
},
|
|
5661
6336
|
components: {
|
|
5662
|
-
DropdownIndicator: (props) => /* @__PURE__ */
|
|
5663
|
-
Placeholder: (props) => /* @__PURE__ */
|
|
6337
|
+
DropdownIndicator: (props) => /* @__PURE__ */ import_react62.default.createElement(import_react_select3.components.DropdownIndicator, { ...props }, /* @__PURE__ */ import_react62.default.createElement(ChevronDown_default, null)),
|
|
6338
|
+
Placeholder: (props) => /* @__PURE__ */ import_react62.default.createElement(import_react_select3.components.Placeholder, { ...props }, /* @__PURE__ */ import_react62.default.createElement("div", { className: "Layer__select__multi-all-placeholder-badge" }, "All"))
|
|
5664
6339
|
}
|
|
5665
6340
|
}
|
|
5666
6341
|
));
|
|
5667
6342
|
};
|
|
5668
6343
|
|
|
5669
6344
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
5670
|
-
var
|
|
6345
|
+
var import_classnames29 = __toESM(require("classnames"));
|
|
5671
6346
|
var import_date_fns14 = require("date-fns");
|
|
5672
6347
|
var ProfitAndLossDetailedCharts = () => {
|
|
5673
6348
|
const {
|
|
@@ -5680,32 +6355,25 @@ var ProfitAndLossDetailedCharts = () => {
|
|
|
5680
6355
|
sidebarScope,
|
|
5681
6356
|
setSidebarScope,
|
|
5682
6357
|
setFilterTypes
|
|
5683
|
-
} = (0,
|
|
5684
|
-
const [hoveredItem, setHoveredItem] = (0,
|
|
5685
|
-
return /* @__PURE__ */
|
|
6358
|
+
} = (0, import_react63.useContext)(ProfitAndLoss.Context);
|
|
6359
|
+
const [hoveredItem, setHoveredItem] = (0, import_react63.useState)();
|
|
6360
|
+
return /* @__PURE__ */ import_react63.default.createElement(
|
|
5686
6361
|
"div",
|
|
5687
6362
|
{
|
|
5688
|
-
className: (0,
|
|
6363
|
+
className: (0, import_classnames29.default)(
|
|
5689
6364
|
"Layer__profit-and-loss__side-panel",
|
|
5690
6365
|
sidebarScope && "open"
|
|
5691
6366
|
)
|
|
5692
6367
|
},
|
|
5693
|
-
/* @__PURE__ */
|
|
6368
|
+
/* @__PURE__ */ import_react63.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts" }, /* @__PURE__ */ import_react63.default.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header" }, /* @__PURE__ */ import_react63.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ import_react63.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(sidebarScope)), /* @__PURE__ */ import_react63.default.createElement(Text, { size: "sm" /* sm */, className: "date" }, (0, import_date_fns14.format)(dateRange.startDate, "LLLL, y")), /* @__PURE__ */ import_react63.default.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ import_react63.default.createElement(
|
|
5694
6369
|
Button,
|
|
5695
6370
|
{
|
|
5696
|
-
rightIcon: /* @__PURE__ */
|
|
6371
|
+
rightIcon: /* @__PURE__ */ import_react63.default.createElement(X_default, null),
|
|
5697
6372
|
iconOnly: true,
|
|
5698
6373
|
onClick: () => setSidebarScope(void 0),
|
|
5699
6374
|
variant: "secondary" /* secondary */
|
|
5700
6375
|
}
|
|
5701
|
-
)), /* @__PURE__ */
|
|
5702
|
-
Button,
|
|
5703
|
-
{
|
|
5704
|
-
onClick: () => setSidebarScope(void 0),
|
|
5705
|
-
variant: "secondary" /* secondary */
|
|
5706
|
-
},
|
|
5707
|
-
"Back"
|
|
5708
|
-
)), /* @__PURE__ */ import_react61.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__content" }, /* @__PURE__ */ import_react61.default.createElement(
|
|
6376
|
+
)), /* @__PURE__ */ import_react63.default.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header--tablet" }, /* @__PURE__ */ import_react63.default.createElement(BackButton, { onClick: () => setSidebarScope(void 0) })), /* @__PURE__ */ import_react63.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__content" }, /* @__PURE__ */ import_react63.default.createElement(
|
|
5709
6377
|
DetailedChart,
|
|
5710
6378
|
{
|
|
5711
6379
|
filteredData,
|
|
@@ -5715,7 +6383,7 @@ var ProfitAndLossDetailedCharts = () => {
|
|
|
5715
6383
|
sidebarScope,
|
|
5716
6384
|
date: dateRange.startDate
|
|
5717
6385
|
}
|
|
5718
|
-
), /* @__PURE__ */
|
|
6386
|
+
), /* @__PURE__ */ import_react63.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__table-wrapper" }, /* @__PURE__ */ import_react63.default.createElement(
|
|
5719
6387
|
Filters,
|
|
5720
6388
|
{
|
|
5721
6389
|
filteredData,
|
|
@@ -5723,7 +6391,7 @@ var ProfitAndLossDetailedCharts = () => {
|
|
|
5723
6391
|
filters,
|
|
5724
6392
|
setFilterTypes
|
|
5725
6393
|
}
|
|
5726
|
-
), /* @__PURE__ */
|
|
6394
|
+
), /* @__PURE__ */ import_react63.default.createElement(
|
|
5727
6395
|
DetailedTable,
|
|
5728
6396
|
{
|
|
5729
6397
|
filteredData,
|
|
@@ -5740,17 +6408,17 @@ var ProfitAndLossDetailedCharts = () => {
|
|
|
5740
6408
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
5741
6409
|
var COMPONENT_NAME3 = "profit-and-loss";
|
|
5742
6410
|
var ProfitAndLossView = (props) => {
|
|
5743
|
-
return /* @__PURE__ */
|
|
6411
|
+
return /* @__PURE__ */ import_react64.default.createElement(Container, { name: COMPONENT_NAME3 }, /* @__PURE__ */ import_react64.default.createElement(ProfitAndLoss, null, /* @__PURE__ */ import_react64.default.createElement("div", { className: `Layer__${COMPONENT_NAME3}__main-panel` }, /* @__PURE__ */ import_react64.default.createElement(Header, { className: `Layer__${COMPONENT_NAME3}__header` }, /* @__PURE__ */ import_react64.default.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Profit & Loss")), /* @__PURE__ */ import_react64.default.createElement(Components, { ...props })), props.showDetailedCharts !== false && /* @__PURE__ */ import_react64.default.createElement(ProfitAndLossDetailedCharts, null)));
|
|
5744
6412
|
};
|
|
5745
6413
|
var Components = ({
|
|
5746
6414
|
hideChart = false,
|
|
5747
6415
|
hideTable = false
|
|
5748
6416
|
}) => {
|
|
5749
|
-
const { error, isLoading, isValidating, refetch } = (0,
|
|
6417
|
+
const { error, isLoading, isValidating, refetch } = (0, import_react64.useContext)(
|
|
5750
6418
|
ProfitAndLoss.Context
|
|
5751
6419
|
);
|
|
5752
6420
|
if (!isLoading && error) {
|
|
5753
|
-
return /* @__PURE__ */
|
|
6421
|
+
return /* @__PURE__ */ import_react64.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react64.default.createElement(
|
|
5754
6422
|
DataState,
|
|
5755
6423
|
{
|
|
5756
6424
|
status: "failed" /* failed */,
|
|
@@ -5761,49 +6429,123 @@ var Components = ({
|
|
|
5761
6429
|
}
|
|
5762
6430
|
));
|
|
5763
6431
|
}
|
|
5764
|
-
return /* @__PURE__ */
|
|
6432
|
+
return /* @__PURE__ */ import_react64.default.createElement(import_react64.default.Fragment, null, !hideChart && /* @__PURE__ */ import_react64.default.createElement("div", { className: `Layer__${COMPONENT_NAME3}__chart_with_summaries` }, /* @__PURE__ */ import_react64.default.createElement(
|
|
5765
6433
|
"div",
|
|
5766
6434
|
{
|
|
5767
6435
|
className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__summary-col`
|
|
5768
6436
|
},
|
|
5769
|
-
/* @__PURE__ */
|
|
5770
|
-
/* @__PURE__ */
|
|
5771
|
-
), /* @__PURE__ */
|
|
6437
|
+
/* @__PURE__ */ import_react64.default.createElement(ProfitAndLoss.DatePicker, null),
|
|
6438
|
+
/* @__PURE__ */ import_react64.default.createElement(ProfitAndLoss.Summaries, { vertical: true })
|
|
6439
|
+
), /* @__PURE__ */ import_react64.default.createElement(
|
|
5772
6440
|
"div",
|
|
5773
6441
|
{
|
|
5774
6442
|
className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__chart-col`
|
|
5775
6443
|
},
|
|
5776
|
-
/* @__PURE__ */
|
|
5777
|
-
)), !hideTable && /* @__PURE__ */
|
|
6444
|
+
/* @__PURE__ */ import_react64.default.createElement(ProfitAndLoss.Chart, null)
|
|
6445
|
+
)), !hideTable && /* @__PURE__ */ import_react64.default.createElement(ProfitAndLoss.Table, null));
|
|
5778
6446
|
};
|
|
5779
6447
|
|
|
5780
6448
|
// src/components/LedgerAccounts/LedgerAccounts.tsx
|
|
5781
|
-
var
|
|
6449
|
+
var import_react70 = __toESM(require("react"));
|
|
5782
6450
|
|
|
5783
6451
|
// src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
|
|
5784
|
-
var
|
|
5785
|
-
var
|
|
6452
|
+
var import_react65 = require("react");
|
|
6453
|
+
var import_swr6 = __toESM(require("swr"));
|
|
6454
|
+
var validate = (formData) => {
|
|
6455
|
+
const errors = [];
|
|
6456
|
+
const nameError = validateName(formData);
|
|
6457
|
+
if (nameError) {
|
|
6458
|
+
errors.push(nameError);
|
|
6459
|
+
}
|
|
6460
|
+
return errors;
|
|
6461
|
+
};
|
|
6462
|
+
var revalidateField = (fieldName, formData) => {
|
|
6463
|
+
switch (fieldName) {
|
|
6464
|
+
case "name":
|
|
6465
|
+
const nameError = validateName(formData);
|
|
6466
|
+
if (nameError) {
|
|
6467
|
+
return (formData?.errors || []).filter((x) => x.field !== fieldName).concat([nameError]);
|
|
6468
|
+
}
|
|
6469
|
+
return (formData?.errors || []).filter((x) => x.field !== fieldName);
|
|
6470
|
+
default:
|
|
6471
|
+
return formData?.errors;
|
|
6472
|
+
}
|
|
6473
|
+
};
|
|
6474
|
+
var validateName = (formData) => {
|
|
6475
|
+
if (!formData?.data.name?.trim()) {
|
|
6476
|
+
return {
|
|
6477
|
+
field: "name",
|
|
6478
|
+
message: "Cannot be blank"
|
|
6479
|
+
};
|
|
6480
|
+
}
|
|
6481
|
+
return;
|
|
6482
|
+
};
|
|
5786
6483
|
var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.sub_accounts || [])]).flat().filter((id) => id);
|
|
5787
6484
|
var useLedgerAccounts = () => {
|
|
5788
6485
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
5789
|
-
const [form, setForm] = (0,
|
|
5790
|
-
const [
|
|
5791
|
-
const
|
|
6486
|
+
const [form, setForm] = (0, import_react65.useState)();
|
|
6487
|
+
const [sendingForm, setSendingForm] = (0, import_react65.useState)(false);
|
|
6488
|
+
const [apiError, setApiError] = (0, import_react65.useState)(void 0);
|
|
6489
|
+
const [showARForAccountId, setShowARForAccountId] = (0, import_react65.useState)();
|
|
6490
|
+
const { data, isLoading, isValidating, error, mutate } = (0, import_swr6.default)(
|
|
5792
6491
|
businessId && auth?.access_token && `ledger-accounts-${businessId}`,
|
|
5793
6492
|
Layer.getLedgerAccounts(apiUrl, auth?.access_token, {
|
|
5794
6493
|
params: { businessId }
|
|
5795
6494
|
})
|
|
5796
6495
|
);
|
|
5797
|
-
const create = (newAccount) => {
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
6496
|
+
const create = async (newAccount) => {
|
|
6497
|
+
setSendingForm(true);
|
|
6498
|
+
setApiError(void 0);
|
|
6499
|
+
try {
|
|
6500
|
+
await Layer.createAccount(apiUrl, auth?.access_token, {
|
|
6501
|
+
params: { businessId },
|
|
6502
|
+
body: newAccount
|
|
6503
|
+
});
|
|
6504
|
+
await refetch();
|
|
6505
|
+
setForm(void 0);
|
|
6506
|
+
} catch (_err) {
|
|
6507
|
+
setApiError("Submit failed. Please, check your connection and try again.");
|
|
6508
|
+
} finally {
|
|
6509
|
+
setSendingForm(false);
|
|
6510
|
+
}
|
|
6511
|
+
};
|
|
6512
|
+
const update = async (accountData, accountId) => {
|
|
6513
|
+
setSendingForm(true);
|
|
6514
|
+
setApiError(void 0);
|
|
6515
|
+
const stable_name = convertToStableName(accountData.name);
|
|
6516
|
+
const newAccountData = {
|
|
6517
|
+
...accountData,
|
|
6518
|
+
stable_name,
|
|
6519
|
+
pnl_category: "INCOME",
|
|
6520
|
+
//this field will be deprecated soon, but is still required
|
|
6521
|
+
always_show_in_pnl: false
|
|
6522
|
+
//this field will be deprecated soon, but is still required
|
|
6523
|
+
};
|
|
6524
|
+
try {
|
|
6525
|
+
await Layer.updateAccount(apiUrl, auth?.access_token, {
|
|
6526
|
+
params: { businessId, accountId },
|
|
6527
|
+
body: newAccountData
|
|
6528
|
+
});
|
|
6529
|
+
await refetch();
|
|
6530
|
+
setForm(void 0);
|
|
6531
|
+
} catch (_err) {
|
|
6532
|
+
setApiError("Submit failed. Please, check your connection and try again.");
|
|
6533
|
+
} finally {
|
|
6534
|
+
setSendingForm(false);
|
|
6535
|
+
}
|
|
5802
6536
|
};
|
|
5803
6537
|
const submitForm = () => {
|
|
5804
6538
|
if (!form || !form.action) {
|
|
5805
6539
|
return;
|
|
5806
6540
|
}
|
|
6541
|
+
const errors = validate(form);
|
|
6542
|
+
if (errors.length > 0) {
|
|
6543
|
+
setForm({
|
|
6544
|
+
...form,
|
|
6545
|
+
errors
|
|
6546
|
+
});
|
|
6547
|
+
return;
|
|
6548
|
+
}
|
|
5807
6549
|
const data2 = {
|
|
5808
6550
|
name: form.data.name || "Test name",
|
|
5809
6551
|
normality: form.data.subType?.value,
|
|
@@ -5818,6 +6560,7 @@ var useLedgerAccounts = () => {
|
|
|
5818
6560
|
return;
|
|
5819
6561
|
}
|
|
5820
6562
|
if (form.action === "edit" && form.accountId) {
|
|
6563
|
+
update(data2, form.accountId);
|
|
5821
6564
|
return;
|
|
5822
6565
|
}
|
|
5823
6566
|
};
|
|
@@ -5867,12 +6610,17 @@ var useLedgerAccounts = () => {
|
|
|
5867
6610
|
if (!form) {
|
|
5868
6611
|
return;
|
|
5869
6612
|
}
|
|
5870
|
-
|
|
6613
|
+
const newFormData = {
|
|
5871
6614
|
...form,
|
|
5872
6615
|
data: {
|
|
5873
6616
|
...form.data,
|
|
5874
6617
|
[fieldName]: value
|
|
5875
6618
|
}
|
|
6619
|
+
};
|
|
6620
|
+
const errors = revalidateField(fieldName, newFormData);
|
|
6621
|
+
setForm({
|
|
6622
|
+
...newFormData,
|
|
6623
|
+
errors
|
|
5876
6624
|
});
|
|
5877
6625
|
};
|
|
5878
6626
|
const refetch = () => mutate();
|
|
@@ -5884,6 +6632,8 @@ var useLedgerAccounts = () => {
|
|
|
5884
6632
|
refetch,
|
|
5885
6633
|
create,
|
|
5886
6634
|
form,
|
|
6635
|
+
sendingForm,
|
|
6636
|
+
apiError,
|
|
5887
6637
|
addAccount,
|
|
5888
6638
|
editAccount,
|
|
5889
6639
|
cancelForm,
|
|
@@ -5895,45 +6645,45 @@ var useLedgerAccounts = () => {
|
|
|
5895
6645
|
};
|
|
5896
6646
|
|
|
5897
6647
|
// src/components/AccountsReceivable/AccountsReceivableIndex.tsx
|
|
5898
|
-
var
|
|
5899
|
-
var
|
|
6648
|
+
var import_react66 = __toESM(require("react"));
|
|
6649
|
+
var import_classnames30 = __toESM(require("classnames"));
|
|
5900
6650
|
var import_date_fns15 = require("date-fns");
|
|
5901
6651
|
var AccountsReceivable = () => {
|
|
5902
|
-
const { data, showARForAccountId, setShowARForAccountId } = (0,
|
|
6652
|
+
const { data, showARForAccountId, setShowARForAccountId } = (0, import_react66.useContext)(
|
|
5903
6653
|
LedgerAccountsContext
|
|
5904
6654
|
);
|
|
5905
|
-
const entry = (0,
|
|
6655
|
+
const entry = (0, import_react66.useMemo)(() => {
|
|
5906
6656
|
return flattenAccounts(data?.accounts || []).find(
|
|
5907
6657
|
(x) => x.id === showARForAccountId
|
|
5908
6658
|
);
|
|
5909
6659
|
}, [showARForAccountId]);
|
|
5910
|
-
const baseClassName = (0,
|
|
6660
|
+
const baseClassName = (0, import_classnames30.default)(
|
|
5911
6661
|
"Layer__accounts-receivable__index",
|
|
5912
6662
|
showARForAccountId && "open"
|
|
5913
6663
|
);
|
|
5914
6664
|
const close = () => setShowARForAccountId(void 0);
|
|
5915
|
-
return /* @__PURE__ */
|
|
6665
|
+
return /* @__PURE__ */ import_react66.default.createElement("div", { className: baseClassName }, /* @__PURE__ */ import_react66.default.createElement("div", { className: "Layer__accounts-receivable__header" }, /* @__PURE__ */ import_react66.default.createElement(BackButton, { onClick: close }), /* @__PURE__ */ import_react66.default.createElement("div", { className: "Layer__accounts-receivable__title-container" }, /* @__PURE__ */ import_react66.default.createElement(
|
|
5916
6666
|
Text,
|
|
5917
6667
|
{
|
|
5918
6668
|
weight: "bold" /* bold */,
|
|
5919
6669
|
className: "Layer__accounts-receivable__title"
|
|
5920
6670
|
},
|
|
5921
6671
|
entry?.name || ""
|
|
5922
|
-
), /* @__PURE__ */
|
|
6672
|
+
), /* @__PURE__ */ import_react66.default.createElement(
|
|
5923
6673
|
Button,
|
|
5924
6674
|
{
|
|
5925
6675
|
variant: "secondary" /* secondary */,
|
|
5926
|
-
rightIcon: /* @__PURE__ */
|
|
6676
|
+
rightIcon: /* @__PURE__ */ import_react66.default.createElement(DownloadCloud_default, { size: 12 })
|
|
5927
6677
|
},
|
|
5928
6678
|
"Download"
|
|
5929
|
-
)), /* @__PURE__ */
|
|
6679
|
+
)), /* @__PURE__ */ import_react66.default.createElement("div", { className: "Layer__accounts-receivable__balance-container" }, /* @__PURE__ */ import_react66.default.createElement(
|
|
5930
6680
|
Text,
|
|
5931
6681
|
{
|
|
5932
6682
|
weight: "bold" /* bold */,
|
|
5933
6683
|
className: "Layer__accounts-receivable__balance-label"
|
|
5934
6684
|
},
|
|
5935
6685
|
"Current balance"
|
|
5936
|
-
), /* @__PURE__ */
|
|
6686
|
+
), /* @__PURE__ */ import_react66.default.createElement(
|
|
5937
6687
|
Text,
|
|
5938
6688
|
{
|
|
5939
6689
|
weight: "bold" /* bold */,
|
|
@@ -5941,17 +6691,17 @@ var AccountsReceivable = () => {
|
|
|
5941
6691
|
},
|
|
5942
6692
|
"$",
|
|
5943
6693
|
centsToDollars(entry?.balance || 0)
|
|
5944
|
-
))), /* @__PURE__ */
|
|
5945
|
-
return /* @__PURE__ */
|
|
6694
|
+
))), /* @__PURE__ */ import_react66.default.createElement("table", { className: "Layer__table Layer__accounts-receivable-table" }, /* @__PURE__ */ import_react66.default.createElement("thead", null, /* @__PURE__ */ import_react66.default.createElement("tr", null, /* @__PURE__ */ import_react66.default.createElement("th", { className: "Layer__table-header" }, "Date"), /* @__PURE__ */ import_react66.default.createElement("th", { className: "Layer__table-header" }, "Journal id #"), /* @__PURE__ */ import_react66.default.createElement("th", { className: "Layer__table-header" }, "Source"), /* @__PURE__ */ import_react66.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Debit"), /* @__PURE__ */ import_react66.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Credit"), /* @__PURE__ */ import_react66.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Running balance"))), /* @__PURE__ */ import_react66.default.createElement("tbody", null, entry?.entries?.map((x) => {
|
|
6695
|
+
return /* @__PURE__ */ import_react66.default.createElement("tr", { key: x.id }, /* @__PURE__ */ import_react66.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react66.default.createElement("span", { className: "Layer__table-cell-content" }, x.createdAt && (0, import_date_fns15.format)((0, import_date_fns15.parseISO)(x.createdAt), DATE_FORMAT))), /* @__PURE__ */ import_react66.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react66.default.createElement("span", { className: "Layer__table-cell-content" }, "#123")), /* @__PURE__ */ import_react66.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react66.default.createElement("span", { className: "Layer__table-cell-content" }, "Invoice")), /* @__PURE__ */ import_react66.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, /* @__PURE__ */ import_react66.default.createElement("span", { className: "Layer__table-cell-content" }, x.direction, " $X,XXX.XX")), /* @__PURE__ */ import_react66.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, /* @__PURE__ */ import_react66.default.createElement("span", { className: "Layer__table-cell-content" }, "$X,XXX.XX")), /* @__PURE__ */ import_react66.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, /* @__PURE__ */ import_react66.default.createElement("span", { className: "Layer__table-cell-content" }, "$X,XXX.XX")));
|
|
5946
6696
|
}))));
|
|
5947
6697
|
};
|
|
5948
6698
|
|
|
5949
6699
|
// src/components/LedgerAccountsRow/LedgerAccountsRow.tsx
|
|
5950
|
-
var
|
|
6700
|
+
var import_react67 = __toESM(require("react"));
|
|
5951
6701
|
|
|
5952
6702
|
// src/icons/ArrowRightCircle.tsx
|
|
5953
|
-
var
|
|
5954
|
-
var ArrowRightCircle = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
6703
|
+
var React83 = __toESM(require("react"));
|
|
6704
|
+
var ArrowRightCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React83.createElement(
|
|
5955
6705
|
"svg",
|
|
5956
6706
|
{
|
|
5957
6707
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -5961,39 +6711,39 @@ var ArrowRightCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React77.crea
|
|
|
5961
6711
|
width: size,
|
|
5962
6712
|
height: size
|
|
5963
6713
|
},
|
|
5964
|
-
/* @__PURE__ */
|
|
6714
|
+
/* @__PURE__ */ React83.createElement(
|
|
5965
6715
|
"path",
|
|
5966
6716
|
{
|
|
5967
6717
|
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",
|
|
5968
6718
|
stroke: "currentColor",
|
|
5969
|
-
|
|
5970
|
-
|
|
6719
|
+
strokeLinecap: "round",
|
|
6720
|
+
strokeLinejoin: "round"
|
|
5971
6721
|
}
|
|
5972
6722
|
),
|
|
5973
|
-
/* @__PURE__ */
|
|
6723
|
+
/* @__PURE__ */ React83.createElement(
|
|
5974
6724
|
"path",
|
|
5975
6725
|
{
|
|
5976
6726
|
d: "M9 12L12 9L9 6",
|
|
5977
6727
|
stroke: "currentColor",
|
|
5978
|
-
|
|
5979
|
-
|
|
6728
|
+
strokeLinecap: "round",
|
|
6729
|
+
strokeLinejoin: "round"
|
|
5980
6730
|
}
|
|
5981
6731
|
),
|
|
5982
|
-
/* @__PURE__ */
|
|
6732
|
+
/* @__PURE__ */ React83.createElement(
|
|
5983
6733
|
"path",
|
|
5984
6734
|
{
|
|
5985
6735
|
d: "M6 9H12",
|
|
5986
6736
|
stroke: "currentColor",
|
|
5987
|
-
|
|
5988
|
-
|
|
6737
|
+
strokeLinecap: "round",
|
|
6738
|
+
strokeLinejoin: "round"
|
|
5989
6739
|
}
|
|
5990
6740
|
)
|
|
5991
6741
|
);
|
|
5992
6742
|
var ArrowRightCircle_default = ArrowRightCircle;
|
|
5993
6743
|
|
|
5994
6744
|
// src/icons/Edit2.tsx
|
|
5995
|
-
var
|
|
5996
|
-
var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
6745
|
+
var React84 = __toESM(require("react"));
|
|
6746
|
+
var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React84.createElement(
|
|
5997
6747
|
"svg",
|
|
5998
6748
|
{
|
|
5999
6749
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -6003,54 +6753,97 @@ var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React78.createElement(
|
|
|
6003
6753
|
width: size,
|
|
6004
6754
|
height: size
|
|
6005
6755
|
},
|
|
6006
|
-
/* @__PURE__ */
|
|
6756
|
+
/* @__PURE__ */ React84.createElement(
|
|
6007
6757
|
"path",
|
|
6008
6758
|
{
|
|
6009
6759
|
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",
|
|
6010
6760
|
stroke: "currentColor",
|
|
6011
|
-
|
|
6012
|
-
|
|
6761
|
+
strokeLinecap: "round",
|
|
6762
|
+
strokeLinejoin: "round"
|
|
6013
6763
|
}
|
|
6014
6764
|
)
|
|
6015
6765
|
);
|
|
6016
6766
|
var Edit2_default = Edit2;
|
|
6017
6767
|
|
|
6018
6768
|
// src/components/LedgerAccountsRow/LedgerAccountsRow.tsx
|
|
6019
|
-
var
|
|
6769
|
+
var import_classnames31 = __toESM(require("classnames"));
|
|
6020
6770
|
var INDENTATION = 12;
|
|
6771
|
+
var EXPANDED_STYLE = {
|
|
6772
|
+
height: 52,
|
|
6773
|
+
paddingTop: 12,
|
|
6774
|
+
paddingBottom: 12,
|
|
6775
|
+
opacity: 1
|
|
6776
|
+
};
|
|
6777
|
+
var COLLAPSED_STYLE = {
|
|
6778
|
+
height: 0,
|
|
6779
|
+
paddingTop: 0,
|
|
6780
|
+
paddingBottom: 0,
|
|
6781
|
+
opacity: 0.5
|
|
6782
|
+
};
|
|
6021
6783
|
var LedgerAccountsRow = ({
|
|
6022
6784
|
account,
|
|
6023
|
-
depth = 0
|
|
6785
|
+
depth = 0,
|
|
6786
|
+
index,
|
|
6787
|
+
cumulativeIndex = 0,
|
|
6788
|
+
expanded = false,
|
|
6789
|
+
defaultOpen = false,
|
|
6790
|
+
acountsLength
|
|
6024
6791
|
}) => {
|
|
6025
|
-
const { form, editAccount, setShowARForAccountId } = (0,
|
|
6792
|
+
const { form, editAccount, setShowARForAccountId } = (0, import_react67.useContext)(
|
|
6026
6793
|
LedgerAccountsContext
|
|
6027
6794
|
);
|
|
6028
|
-
const [isOpen, setIsOpen] = (0,
|
|
6029
|
-
const
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6795
|
+
const [isOpen, setIsOpen] = (0, import_react67.useState)(defaultOpen);
|
|
6796
|
+
const style = expanded ? {
|
|
6797
|
+
...EXPANDED_STYLE,
|
|
6798
|
+
transitionDelay: `${15 * index}ms`
|
|
6799
|
+
} : {
|
|
6800
|
+
...COLLAPSED_STYLE,
|
|
6801
|
+
transitionDelay: `${acountsLength - 15 * index}ms`
|
|
6802
|
+
};
|
|
6803
|
+
const [showComponent, setShowComponent] = (0, import_react67.useState)(false);
|
|
6804
|
+
(0, import_react67.useEffect)(() => {
|
|
6805
|
+
const timeoutId = setTimeout(() => {
|
|
6806
|
+
setShowComponent(true);
|
|
6807
|
+
}, cumulativeIndex * 50);
|
|
6808
|
+
return () => clearTimeout(timeoutId);
|
|
6809
|
+
}, []);
|
|
6810
|
+
const baseClass = (0, import_classnames31.default)(
|
|
6811
|
+
"Layer__table-row",
|
|
6812
|
+
isOpen ? "Layer__table-row--expanded" : "Layer__table-row--collapsed",
|
|
6813
|
+
!expanded && "Layer__table-row--hidden",
|
|
6814
|
+
`Layer__table-row--depth-${depth}`,
|
|
6815
|
+
form?.accountId === account.id && "Layer__table-row--active",
|
|
6816
|
+
!showComponent && "Layer__table-row--anim-starting-state"
|
|
6034
6817
|
);
|
|
6035
|
-
return /* @__PURE__ */
|
|
6036
|
-
"
|
|
6818
|
+
return /* @__PURE__ */ import_react67.default.createElement(import_react67.default.Fragment, null, /* @__PURE__ */ import_react67.default.createElement("tr", { className: baseClass, onClick: () => setIsOpen(!isOpen) }, /* @__PURE__ */ import_react67.default.createElement("td", { className: "Layer__table-cell Layer__coa__name" }, /* @__PURE__ */ import_react67.default.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ import_react67.default.createElement(
|
|
6819
|
+
"span",
|
|
6037
6820
|
{
|
|
6038
|
-
className: "
|
|
6039
|
-
style: {
|
|
6821
|
+
className: "Layer__table-cell-content-indentation",
|
|
6822
|
+
style: {
|
|
6823
|
+
paddingLeft: INDENTATION * depth + 16
|
|
6824
|
+
}
|
|
6040
6825
|
},
|
|
6041
|
-
account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */
|
|
6826
|
+
account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ import_react67.default.createElement(
|
|
6042
6827
|
ChevronDownFill_default,
|
|
6043
6828
|
{
|
|
6044
6829
|
size: 16,
|
|
6045
|
-
className: "
|
|
6830
|
+
className: "Layer__table__expand-icon"
|
|
6046
6831
|
}
|
|
6047
6832
|
),
|
|
6048
|
-
/* @__PURE__ */
|
|
6049
|
-
), /* @__PURE__ */
|
|
6833
|
+
/* @__PURE__ */ import_react67.default.createElement("span", { className: "Layer__coa__name__text" }, account.name)
|
|
6834
|
+
))), /* @__PURE__ */ import_react67.default.createElement("td", { className: "Layer__table-cell Layer__coa__type" }, /* @__PURE__ */ import_react67.default.createElement("span", { className: "Layer__table-cell-content", style }, account.normality)), /* @__PURE__ */ import_react67.default.createElement("td", { className: "Layer__table-cell Layer__coa__subtype" }, /* @__PURE__ */ import_react67.default.createElement("span", { className: "Layer__table-cell-content", style }, "Sub-Type")), /* @__PURE__ */ import_react67.default.createElement("td", { className: "Layer__table-cell Layer__coa__balance" }, /* @__PURE__ */ import_react67.default.createElement(
|
|
6835
|
+
"span",
|
|
6836
|
+
{
|
|
6837
|
+
className: "Layer__table-cell-content Layer__table-cell--amount",
|
|
6838
|
+
style
|
|
6839
|
+
},
|
|
6840
|
+
"$",
|
|
6841
|
+
centsToDollars(Math.abs(account.balance || 0))
|
|
6842
|
+
)), /* @__PURE__ */ import_react67.default.createElement("td", { className: "Layer__table-cell Layer__coa__actions" }, /* @__PURE__ */ import_react67.default.createElement("span", { className: "Layer__table-cell-content", style }, /* @__PURE__ */ import_react67.default.createElement(
|
|
6050
6843
|
Button,
|
|
6051
6844
|
{
|
|
6052
6845
|
variant: "secondary" /* secondary */,
|
|
6053
|
-
rightIcon: /* @__PURE__ */
|
|
6846
|
+
rightIcon: /* @__PURE__ */ import_react67.default.createElement(Edit2_default, { size: 12 }),
|
|
6054
6847
|
onClick: (e) => {
|
|
6055
6848
|
e.preventDefault();
|
|
6056
6849
|
e.stopPropagation();
|
|
@@ -6058,11 +6851,11 @@ var LedgerAccountsRow = ({
|
|
|
6058
6851
|
}
|
|
6059
6852
|
},
|
|
6060
6853
|
"Edit"
|
|
6061
|
-
), /* @__PURE__ */
|
|
6854
|
+
), /* @__PURE__ */ import_react67.default.createElement(
|
|
6062
6855
|
Button,
|
|
6063
6856
|
{
|
|
6064
6857
|
variant: "secondary" /* secondary */,
|
|
6065
|
-
rightIcon: /* @__PURE__ */
|
|
6858
|
+
rightIcon: /* @__PURE__ */ import_react67.default.createElement(ArrowRightCircle_default, { size: 12 }),
|
|
6066
6859
|
onClick: (e) => {
|
|
6067
6860
|
e.preventDefault();
|
|
6068
6861
|
e.stopPropagation();
|
|
@@ -6070,21 +6863,25 @@ var LedgerAccountsRow = ({
|
|
|
6070
6863
|
}
|
|
6071
6864
|
},
|
|
6072
6865
|
"Open"
|
|
6073
|
-
))),
|
|
6866
|
+
)))), (account.sub_accounts || []).map((subAccount, idx) => /* @__PURE__ */ import_react67.default.createElement(
|
|
6074
6867
|
LedgerAccountsRow,
|
|
6075
6868
|
{
|
|
6076
6869
|
key: subAccount.id,
|
|
6077
6870
|
account: subAccount,
|
|
6078
|
-
depth: depth + 1
|
|
6871
|
+
depth: depth + 1,
|
|
6872
|
+
index: idx,
|
|
6873
|
+
expanded: isOpen && expanded,
|
|
6874
|
+
cumulativeIndex: cumulativeIndex + idx + 1,
|
|
6875
|
+
acountsLength: (account.sub_accounts ?? []).length
|
|
6079
6876
|
}
|
|
6080
6877
|
)));
|
|
6081
6878
|
};
|
|
6082
6879
|
|
|
6083
6880
|
// src/components/LedgerAccountsSidebar/LedgerAccountsSidebar.tsx
|
|
6084
|
-
var
|
|
6881
|
+
var import_react69 = __toESM(require("react"));
|
|
6085
6882
|
|
|
6086
6883
|
// src/components/LedgerAccountsForm/LedgerAccountsForm.tsx
|
|
6087
|
-
var
|
|
6884
|
+
var import_react68 = __toESM(require("react"));
|
|
6088
6885
|
var SUB_TYPE_OPTIONS = [
|
|
6089
6886
|
{
|
|
6090
6887
|
value: "DEBIT" /* DEBIT */,
|
|
@@ -6096,10 +6893,16 @@ var SUB_TYPE_OPTIONS = [
|
|
|
6096
6893
|
}
|
|
6097
6894
|
];
|
|
6098
6895
|
var LedgerAccountsForm = () => {
|
|
6099
|
-
const {
|
|
6100
|
-
|
|
6101
|
-
|
|
6102
|
-
|
|
6896
|
+
const {
|
|
6897
|
+
form,
|
|
6898
|
+
data,
|
|
6899
|
+
changeFormData,
|
|
6900
|
+
cancelForm,
|
|
6901
|
+
submitForm,
|
|
6902
|
+
sendingForm,
|
|
6903
|
+
apiError
|
|
6904
|
+
} = (0, import_react68.useContext)(LedgerAccountsContext);
|
|
6905
|
+
const parentOptions = (0, import_react68.useMemo)(
|
|
6103
6906
|
() => flattenAccounts(data?.accounts || []).sort((a, b) => a?.name && b?.name ? a.name.localeCompare(b.name) : 0).map((x) => {
|
|
6104
6907
|
return {
|
|
6105
6908
|
label: x.name,
|
|
@@ -6108,7 +6911,7 @@ var LedgerAccountsForm = () => {
|
|
|
6108
6911
|
}),
|
|
6109
6912
|
[data?.accounts?.length]
|
|
6110
6913
|
);
|
|
6111
|
-
const entry = (0,
|
|
6914
|
+
const entry = (0, import_react68.useMemo)(() => {
|
|
6112
6915
|
if (form?.action === "edit" && form.accountId) {
|
|
6113
6916
|
return flattenAccounts(data?.accounts || []).find(
|
|
6114
6917
|
(x) => x.id === form.accountId
|
|
@@ -6116,87 +6919,121 @@ var LedgerAccountsForm = () => {
|
|
|
6116
6919
|
}
|
|
6117
6920
|
return;
|
|
6118
6921
|
}, [data, form?.accountId]);
|
|
6119
|
-
console.log(entry);
|
|
6120
6922
|
if (!form) {
|
|
6121
6923
|
return;
|
|
6122
6924
|
}
|
|
6123
|
-
return /* @__PURE__ */
|
|
6925
|
+
return /* @__PURE__ */ import_react68.default.createElement(
|
|
6124
6926
|
"form",
|
|
6125
6927
|
{
|
|
6928
|
+
className: "Layer__form",
|
|
6126
6929
|
onSubmit: (e) => {
|
|
6127
6930
|
e.preventDefault();
|
|
6128
6931
|
submitForm();
|
|
6129
6932
|
}
|
|
6130
6933
|
},
|
|
6131
|
-
/* @__PURE__ */
|
|
6934
|
+
/* @__PURE__ */ import_react68.default.createElement("div", { className: "Layer__ledger-accounts__sidebar__header" }, /* @__PURE__ */ import_react68.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, form?.action === "edit" ? "Edit" : "Add New", " Account"), /* @__PURE__ */ import_react68.default.createElement("div", { className: "actions" }, /* @__PURE__ */ import_react68.default.createElement(
|
|
6132
6935
|
Button,
|
|
6133
6936
|
{
|
|
6134
6937
|
type: "button",
|
|
6135
6938
|
onClick: cancelForm,
|
|
6136
|
-
variant: "secondary" /* secondary
|
|
6939
|
+
variant: "secondary" /* secondary */,
|
|
6940
|
+
disabled: sendingForm
|
|
6137
6941
|
},
|
|
6138
6942
|
"Cancel"
|
|
6139
|
-
), /* @__PURE__ */
|
|
6140
|
-
|
|
6141
|
-
|
|
6142
|
-
|
|
6943
|
+
), apiError && /* @__PURE__ */ import_react68.default.createElement(
|
|
6944
|
+
RetryButton,
|
|
6945
|
+
{
|
|
6946
|
+
type: "submit",
|
|
6947
|
+
processing: sendingForm,
|
|
6948
|
+
error: "Check connection and retry in few seconds.",
|
|
6949
|
+
disabled: sendingForm
|
|
6950
|
+
},
|
|
6951
|
+
"Retry"
|
|
6952
|
+
), !apiError && /* @__PURE__ */ import_react68.default.createElement(
|
|
6953
|
+
SubmitButton,
|
|
6954
|
+
{
|
|
6955
|
+
type: "submit",
|
|
6956
|
+
noIcon: true,
|
|
6957
|
+
active: true,
|
|
6958
|
+
disabled: sendingForm
|
|
6959
|
+
},
|
|
6960
|
+
"Save"
|
|
6961
|
+
))),
|
|
6962
|
+
apiError && /* @__PURE__ */ import_react68.default.createElement(
|
|
6963
|
+
Text,
|
|
6964
|
+
{
|
|
6965
|
+
size: "sm" /* sm */,
|
|
6966
|
+
className: "Layer__ledger-accounts__form__error-message"
|
|
6967
|
+
},
|
|
6968
|
+
apiError
|
|
6969
|
+
),
|
|
6970
|
+
entry && /* @__PURE__ */ import_react68.default.createElement("div", { className: "Layer__ledger-accounts__form-edit-entry" }, /* @__PURE__ */ import_react68.default.createElement(Text, { weight: "bold" /* bold */ }, entry.name), /* @__PURE__ */ import_react68.default.createElement(Text, { weight: "bold" /* bold */ }, "$", centsToDollars(entry.balance || 0))),
|
|
6971
|
+
/* @__PURE__ */ import_react68.default.createElement("div", { className: "Layer__ledger-accounts__form" }, /* @__PURE__ */ import_react68.default.createElement(InputGroup, { name: "parent", label: "Parent", inline: true }, /* @__PURE__ */ import_react68.default.createElement(
|
|
6972
|
+
Select2,
|
|
6143
6973
|
{
|
|
6144
6974
|
options: parentOptions,
|
|
6145
6975
|
value: form?.data.parent,
|
|
6146
|
-
onChange: (sel) => changeFormData("parent", sel)
|
|
6976
|
+
onChange: (sel) => changeFormData("parent", sel),
|
|
6977
|
+
disabled: sendingForm
|
|
6147
6978
|
}
|
|
6148
|
-
)), /* @__PURE__ */
|
|
6979
|
+
)), /* @__PURE__ */ import_react68.default.createElement(InputGroup, { name: "name", label: "Name", inline: true }, /* @__PURE__ */ import_react68.default.createElement(
|
|
6149
6980
|
Input,
|
|
6150
6981
|
{
|
|
6151
6982
|
name: "name",
|
|
6983
|
+
placeholder: "Enter name...",
|
|
6152
6984
|
value: form?.data.name,
|
|
6985
|
+
isInvalid: Boolean(form?.errors?.find((x) => x.field === "name")),
|
|
6986
|
+
errorMessage: form?.errors?.find((x) => x.field === "name")?.message,
|
|
6987
|
+
disabled: sendingForm,
|
|
6153
6988
|
onChange: (e) => changeFormData("name", e.target.value)
|
|
6154
6989
|
}
|
|
6155
|
-
)), /* @__PURE__ */
|
|
6156
|
-
|
|
6990
|
+
)), /* @__PURE__ */ import_react68.default.createElement(InputGroup, { name: "type", label: "Type", inline: true }, /* @__PURE__ */ import_react68.default.createElement(
|
|
6991
|
+
Select2,
|
|
6157
6992
|
{
|
|
6158
6993
|
options: [],
|
|
6159
6994
|
disabled: true,
|
|
6160
6995
|
value: form?.data.type,
|
|
6161
6996
|
onChange: (sel) => changeFormData("type", sel)
|
|
6162
6997
|
}
|
|
6163
|
-
)), /* @__PURE__ */
|
|
6164
|
-
|
|
6998
|
+
)), /* @__PURE__ */ import_react68.default.createElement(InputGroup, { name: "subType", label: "Sub-Type", inline: true }, /* @__PURE__ */ import_react68.default.createElement(
|
|
6999
|
+
Select2,
|
|
6165
7000
|
{
|
|
6166
7001
|
options: SUB_TYPE_OPTIONS,
|
|
6167
7002
|
value: form?.data.subType,
|
|
6168
|
-
onChange: (sel) => changeFormData("subType", sel)
|
|
7003
|
+
onChange: (sel) => changeFormData("subType", sel),
|
|
7004
|
+
disabled: sendingForm
|
|
6169
7005
|
}
|
|
6170
|
-
)), /* @__PURE__ */
|
|
6171
|
-
|
|
7006
|
+
)), /* @__PURE__ */ import_react68.default.createElement(InputGroup, { name: "category", label: "Category", inline: true }, /* @__PURE__ */ import_react68.default.createElement(
|
|
7007
|
+
Select2,
|
|
6172
7008
|
{
|
|
6173
7009
|
options: [],
|
|
6174
7010
|
value: form?.data.category,
|
|
6175
|
-
onChange: (sel) => changeFormData("category", sel)
|
|
7011
|
+
onChange: (sel) => changeFormData("category", sel),
|
|
7012
|
+
disabled: sendingForm
|
|
6176
7013
|
}
|
|
6177
7014
|
)))
|
|
6178
7015
|
);
|
|
6179
7016
|
};
|
|
6180
7017
|
|
|
6181
7018
|
// src/components/LedgerAccountsSidebar/LedgerAccountsSidebar.tsx
|
|
6182
|
-
var
|
|
7019
|
+
var import_classnames32 = __toESM(require("classnames"));
|
|
6183
7020
|
var LedgerAccountsSidebar = () => {
|
|
6184
|
-
const { form } = (0,
|
|
6185
|
-
return /* @__PURE__ */
|
|
7021
|
+
const { form } = (0, import_react69.useContext)(LedgerAccountsContext);
|
|
7022
|
+
return /* @__PURE__ */ import_react69.default.createElement(
|
|
6186
7023
|
"div",
|
|
6187
7024
|
{
|
|
6188
|
-
className: (0,
|
|
7025
|
+
className: (0, import_classnames32.default)(
|
|
6189
7026
|
"Layer__ledger-accounts__sidebar",
|
|
6190
7027
|
form ? "open" : ""
|
|
6191
7028
|
)
|
|
6192
7029
|
},
|
|
6193
|
-
/* @__PURE__ */
|
|
7030
|
+
/* @__PURE__ */ import_react69.default.createElement("div", { className: "Layer__ledger-accounts__sidebar-content" }, /* @__PURE__ */ import_react69.default.createElement(LedgerAccountsForm, null))
|
|
6194
7031
|
);
|
|
6195
7032
|
};
|
|
6196
7033
|
|
|
6197
7034
|
// src/components/LedgerAccounts/LedgerAccounts.tsx
|
|
6198
7035
|
var COMPONENT_NAME4 = "ledger-accounts";
|
|
6199
|
-
var LedgerAccountsContext = (0,
|
|
7036
|
+
var LedgerAccountsContext = (0, import_react70.createContext)({
|
|
6200
7037
|
data: void 0,
|
|
6201
7038
|
isLoading: false,
|
|
6202
7039
|
isValidating: false,
|
|
@@ -6206,6 +7043,8 @@ var LedgerAccountsContext = (0, import_react68.createContext)({
|
|
|
6206
7043
|
create: () => {
|
|
6207
7044
|
},
|
|
6208
7045
|
form: void 0,
|
|
7046
|
+
sendingForm: false,
|
|
7047
|
+
apiError: void 0,
|
|
6209
7048
|
addAccount: () => {
|
|
6210
7049
|
},
|
|
6211
7050
|
editAccount: () => {
|
|
@@ -6222,19 +7061,37 @@ var LedgerAccountsContext = (0, import_react68.createContext)({
|
|
|
6222
7061
|
});
|
|
6223
7062
|
var LedgerAccounts = () => {
|
|
6224
7063
|
const contextData = useLedgerAccounts();
|
|
6225
|
-
return /* @__PURE__ */
|
|
7064
|
+
return /* @__PURE__ */ import_react70.default.createElement(LedgerAccountsContext.Provider, { value: contextData }, /* @__PURE__ */ import_react70.default.createElement(LedgerAccountsContent, null));
|
|
6226
7065
|
};
|
|
6227
7066
|
var LedgerAccountsContent = () => {
|
|
6228
|
-
const { data, isLoading, addAccount, error, isValidating, refetch } = (0,
|
|
6229
|
-
|
|
7067
|
+
const { data, isLoading, addAccount, error, isValidating, refetch } = (0, import_react70.useContext)(LedgerAccountsContext);
|
|
7068
|
+
let cumulativeIndex = 0;
|
|
7069
|
+
const accountsLength = data?.accounts.length ?? 0;
|
|
7070
|
+
return /* @__PURE__ */ import_react70.default.createElement(Container, { name: COMPONENT_NAME4 }, /* @__PURE__ */ import_react70.default.createElement("div", { className: `Layer__${COMPONENT_NAME4}__main-panel` }, /* @__PURE__ */ import_react70.default.createElement(Header, { className: `Layer__${COMPONENT_NAME4}__header` }, /* @__PURE__ */ import_react70.default.createElement(Heading, { className: `Layer__${COMPONENT_NAME4}__title` }, "Chart of Accounts"), /* @__PURE__ */ import_react70.default.createElement("div", { className: `Layer__${COMPONENT_NAME4}__actions` }, /* @__PURE__ */ import_react70.default.createElement(
|
|
6230
7071
|
Button,
|
|
6231
7072
|
{
|
|
6232
7073
|
variant: "secondary" /* secondary */,
|
|
6233
7074
|
disabled: isLoading,
|
|
6234
|
-
rightIcon: /* @__PURE__ */
|
|
7075
|
+
rightIcon: /* @__PURE__ */ import_react70.default.createElement(DownloadCloud_default, { size: 12 })
|
|
6235
7076
|
},
|
|
6236
7077
|
"Download"
|
|
6237
|
-
), /* @__PURE__ */
|
|
7078
|
+
), /* @__PURE__ */ import_react70.default.createElement(Button, { onClick: () => addAccount(), disabled: isLoading }, "Add Account"))), /* @__PURE__ */ import_react70.default.createElement("table", { className: `Layer__${COMPONENT_NAME4}__table` }, /* @__PURE__ */ import_react70.default.createElement("thead", null, /* @__PURE__ */ import_react70.default.createElement("tr", { className: "Layer__table-row--header" }, /* @__PURE__ */ import_react70.default.createElement("th", { className: "Layer__table-header Layer__coa__name" }, "Name"), /* @__PURE__ */ import_react70.default.createElement("th", { className: "Layer__table-header Layer__coa__type" }, "Type"), /* @__PURE__ */ import_react70.default.createElement("th", { className: "Layer__table-header Layer__coa__subtype" }, "Sub-Type"), /* @__PURE__ */ import_react70.default.createElement("th", { className: "Layer__table-header Layer__coa__balance" }, "Balance"), /* @__PURE__ */ import_react70.default.createElement("th", { className: "Layer__table-header Layer__coa__actions" }))), /* @__PURE__ */ import_react70.default.createElement("tbody", null, !error && data?.accounts.map((account, idx) => {
|
|
7079
|
+
const currentCumulativeIndex = cumulativeIndex;
|
|
7080
|
+
cumulativeIndex = (account.sub_accounts?.length || 0) + cumulativeIndex + 1;
|
|
7081
|
+
return /* @__PURE__ */ import_react70.default.createElement(
|
|
7082
|
+
LedgerAccountsRow,
|
|
7083
|
+
{
|
|
7084
|
+
key: account.id,
|
|
7085
|
+
account,
|
|
7086
|
+
depth: 0,
|
|
7087
|
+
index: idx,
|
|
7088
|
+
cumulativeIndex: currentCumulativeIndex,
|
|
7089
|
+
expanded: true,
|
|
7090
|
+
defaultOpen: true,
|
|
7091
|
+
acountsLength: accountsLength
|
|
7092
|
+
}
|
|
7093
|
+
);
|
|
7094
|
+
}))), error ? /* @__PURE__ */ import_react70.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react70.default.createElement(
|
|
6238
7095
|
DataState,
|
|
6239
7096
|
{
|
|
6240
7097
|
status: "failed" /* failed */,
|
|
@@ -6243,7 +7100,7 @@ var LedgerAccountsContent = () => {
|
|
|
6243
7100
|
onRefresh: () => refetch(),
|
|
6244
7101
|
isLoading: isValidating || isLoading
|
|
6245
7102
|
}
|
|
6246
|
-
)) : null, (!data || isLoading) && !error ? /* @__PURE__ */
|
|
7103
|
+
)) : null, (!data || isLoading) && !error ? /* @__PURE__ */ import_react70.default.createElement("div", { className: `Layer__${COMPONENT_NAME4}__loader-container` }, /* @__PURE__ */ import_react70.default.createElement(Loader2, null)) : null, !isLoading && !error && data?.accounts.length === 0 ? /* @__PURE__ */ import_react70.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react70.default.createElement(
|
|
6247
7104
|
DataState,
|
|
6248
7105
|
{
|
|
6249
7106
|
status: "info" /* info */,
|
|
@@ -6252,13 +7109,13 @@ var LedgerAccountsContent = () => {
|
|
|
6252
7109
|
onRefresh: () => refetch(),
|
|
6253
7110
|
isLoading: isValidating
|
|
6254
7111
|
}
|
|
6255
|
-
)) : null)
|
|
7112
|
+
)) : null), /* @__PURE__ */ import_react70.default.createElement(LedgerAccountsSidebar, null), /* @__PURE__ */ import_react70.default.createElement(AccountsReceivable, null));
|
|
6256
7113
|
};
|
|
6257
7114
|
|
|
6258
7115
|
// src/providers/LayerProvider/LayerProvider.tsx
|
|
6259
|
-
var
|
|
7116
|
+
var import_react71 = __toESM(require("react"));
|
|
6260
7117
|
var import_date_fns16 = require("date-fns");
|
|
6261
|
-
var
|
|
7118
|
+
var import_swr7 = __toESM(require("swr"));
|
|
6262
7119
|
var reducer = (state, action) => {
|
|
6263
7120
|
switch (action.type) {
|
|
6264
7121
|
case "LayerContext.setAuth" /* setAuth */:
|
|
@@ -6298,7 +7155,7 @@ var LayerProvider = ({
|
|
|
6298
7155
|
};
|
|
6299
7156
|
const colors = buildColorsPalette(theme);
|
|
6300
7157
|
const { url, scope, apiUrl } = LayerEnvironment[environment];
|
|
6301
|
-
const [state, dispatch] = (0,
|
|
7158
|
+
const [state, dispatch] = (0, import_react71.useReducer)(reducer, {
|
|
6302
7159
|
auth: {
|
|
6303
7160
|
access_token: "",
|
|
6304
7161
|
token_type: "",
|
|
@@ -6311,7 +7168,7 @@ var LayerProvider = ({
|
|
|
6311
7168
|
theme,
|
|
6312
7169
|
colors
|
|
6313
7170
|
});
|
|
6314
|
-
const { data: auth } = appId !== void 0 && appSecret !== void 0 ? (0,
|
|
7171
|
+
const { data: auth } = appId !== void 0 && appSecret !== void 0 ? (0, import_swr7.default)(
|
|
6315
7172
|
businessAccessToken === void 0 && appId !== void 0 && appSecret !== void 0 && (0, import_date_fns16.isBefore)(state.auth.expires_at, /* @__PURE__ */ new Date()) && "authenticate",
|
|
6316
7173
|
Layer.authenticate({
|
|
6317
7174
|
appId,
|
|
@@ -6321,7 +7178,7 @@ var LayerProvider = ({
|
|
|
6321
7178
|
}),
|
|
6322
7179
|
defaultSWRConfig
|
|
6323
7180
|
) : { data: void 0 };
|
|
6324
|
-
(0,
|
|
7181
|
+
(0, import_react71.useEffect)(() => {
|
|
6325
7182
|
if (businessAccessToken) {
|
|
6326
7183
|
dispatch({
|
|
6327
7184
|
type: "LayerContext.setAuth" /* setAuth */,
|
|
@@ -6346,7 +7203,7 @@ var LayerProvider = ({
|
|
|
6346
7203
|
});
|
|
6347
7204
|
}
|
|
6348
7205
|
}, [businessAccessToken, auth?.access_token]);
|
|
6349
|
-
(0,
|
|
7206
|
+
(0, import_swr7.default)(
|
|
6350
7207
|
businessId && auth?.access_token && `categories-${businessId}`,
|
|
6351
7208
|
Layer.getCategories(apiUrl, auth?.access_token, { params: { businessId } }),
|
|
6352
7209
|
{
|
|
@@ -6371,7 +7228,7 @@ var LayerProvider = ({
|
|
|
6371
7228
|
}
|
|
6372
7229
|
return;
|
|
6373
7230
|
};
|
|
6374
|
-
return /* @__PURE__ */
|
|
7231
|
+
return /* @__PURE__ */ import_react71.default.createElement(import_swr7.SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ import_react71.default.createElement(LayerContext.Provider, { value: { ...state, setTheme, getColor } }, children));
|
|
6375
7232
|
};
|
|
6376
7233
|
// Annotate the CommonJS export names for ESM import in node:
|
|
6377
7234
|
0 && (module.exports = {
|