@layerfi/components 0.1.2 → 0.1.4
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 +351 -151
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +42 -7
- package/dist/index.js +366 -166
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +64 -1
- package/dist/styles/index.css.map +3 -3
- package/package.json +1 -1
package/dist/esm/index.js
CHANGED
|
@@ -249,7 +249,7 @@ var getBankTransactions = get(
|
|
|
249
249
|
businessId,
|
|
250
250
|
sortBy = "date",
|
|
251
251
|
sortOrder = "DESC"
|
|
252
|
-
}) => `/v1/businesses/${businessId}/bank-transactions?sort_by=${sortBy}&sort_order=${sortOrder}`
|
|
252
|
+
}) => `/v1/businesses/${businessId}/bank-transactions?sort_by=${sortBy}&sort_order=${sortOrder}&limit=200`
|
|
253
253
|
);
|
|
254
254
|
var categorizeBankTransaction = put(
|
|
255
255
|
({ businessId, bankTransactionId }) => `/v1/businesses/${businessId}/bank-transactions/${bankTransactionId}/categorize`
|
|
@@ -557,7 +557,7 @@ var BalanceSheet = () => {
|
|
|
557
557
|
};
|
|
558
558
|
|
|
559
559
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
560
|
-
import
|
|
560
|
+
import React38, { useState as useState9 } from "react";
|
|
561
561
|
|
|
562
562
|
// src/hooks/useBankTransactions/useBankTransactions.tsx
|
|
563
563
|
import useSWR2 from "swr";
|
|
@@ -566,6 +566,7 @@ var useBankTransactions = () => {
|
|
|
566
566
|
const {
|
|
567
567
|
data: responseData,
|
|
568
568
|
isLoading,
|
|
569
|
+
isValidating,
|
|
569
570
|
error: responseError,
|
|
570
571
|
mutate
|
|
571
572
|
} = useSWR2(
|
|
@@ -575,12 +576,12 @@ var useBankTransactions = () => {
|
|
|
575
576
|
})
|
|
576
577
|
);
|
|
577
578
|
const {
|
|
578
|
-
data =
|
|
579
|
+
data = void 0,
|
|
579
580
|
meta: metadata = {},
|
|
580
581
|
error = void 0
|
|
581
582
|
} = responseData || {};
|
|
582
583
|
const categorize = (id, newCategory) => {
|
|
583
|
-
const foundBT = data
|
|
584
|
+
const foundBT = data?.find((x) => x.business_id === businessId && x.id === id);
|
|
584
585
|
if (foundBT) {
|
|
585
586
|
updateOneLocal({ ...foundBT, processing: true, error: void 0 });
|
|
586
587
|
}
|
|
@@ -597,7 +598,7 @@ var useBankTransactions = () => {
|
|
|
597
598
|
throw errors;
|
|
598
599
|
}
|
|
599
600
|
}).catch((err) => {
|
|
600
|
-
const newBT = data
|
|
601
|
+
const newBT = data?.find(
|
|
601
602
|
(x) => x.business_id === businessId && x.id === id
|
|
602
603
|
);
|
|
603
604
|
if (newBT) {
|
|
@@ -610,15 +611,20 @@ var useBankTransactions = () => {
|
|
|
610
611
|
});
|
|
611
612
|
};
|
|
612
613
|
const updateOneLocal = (newBankTransaction) => {
|
|
613
|
-
const updatedData = data
|
|
614
|
+
const updatedData = data?.map(
|
|
614
615
|
(bt) => bt.id === newBankTransaction.id ? newBankTransaction : bt
|
|
615
616
|
);
|
|
616
617
|
mutate({ data: updatedData }, { revalidate: false });
|
|
617
618
|
};
|
|
619
|
+
const refetch = () => {
|
|
620
|
+
mutate();
|
|
621
|
+
};
|
|
618
622
|
return {
|
|
619
623
|
data,
|
|
620
624
|
metadata,
|
|
621
625
|
isLoading,
|
|
626
|
+
isValidating,
|
|
627
|
+
refetch,
|
|
622
628
|
error: responseError || error,
|
|
623
629
|
categorize,
|
|
624
630
|
updateOneLocal
|
|
@@ -648,11 +654,16 @@ var useElementSize = (callback) => {
|
|
|
648
654
|
return ref;
|
|
649
655
|
};
|
|
650
656
|
|
|
657
|
+
// src/types/categories.ts
|
|
658
|
+
function hasSuggestions(categorization) {
|
|
659
|
+
return categorization.suggestions !== void 0;
|
|
660
|
+
}
|
|
661
|
+
|
|
651
662
|
// src/components/BankTransactionListItem/BankTransactionListItem.tsx
|
|
652
|
-
import React31, { useRef as
|
|
663
|
+
import React31, { useRef as useRef7, useState as useState7 } from "react";
|
|
653
664
|
|
|
654
665
|
// src/components/Button/Button.tsx
|
|
655
|
-
import React8 from "react";
|
|
666
|
+
import React8, { useRef as useRef3 } from "react";
|
|
656
667
|
import classNames from "classnames";
|
|
657
668
|
var Button = ({
|
|
658
669
|
className,
|
|
@@ -663,6 +674,7 @@ var Button = ({
|
|
|
663
674
|
iconOnly,
|
|
664
675
|
...props
|
|
665
676
|
}) => {
|
|
677
|
+
const buttonRef = useRef3(null);
|
|
666
678
|
let justify = "center";
|
|
667
679
|
if (leftIcon && rightIcon) {
|
|
668
680
|
justify = "space-between";
|
|
@@ -677,7 +689,23 @@ var Button = ({
|
|
|
677
689
|
iconOnly ? "Layer__btn--icon-only" : "",
|
|
678
690
|
className
|
|
679
691
|
);
|
|
680
|
-
|
|
692
|
+
const startAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
|
|
693
|
+
(el) => el.beginElement()
|
|
694
|
+
);
|
|
695
|
+
const stopAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
|
|
696
|
+
(el) => el.endElement()
|
|
697
|
+
);
|
|
698
|
+
return /* @__PURE__ */ React8.createElement(
|
|
699
|
+
"button",
|
|
700
|
+
{
|
|
701
|
+
...props,
|
|
702
|
+
className: baseClassName,
|
|
703
|
+
onMouseEnter: startAnimation,
|
|
704
|
+
onMouseLeave: stopAnimation,
|
|
705
|
+
ref: buttonRef
|
|
706
|
+
},
|
|
707
|
+
/* @__PURE__ */ React8.createElement("span", { className: `Layer__btn-content Layer__justify--${justify}` }, leftIcon && /* @__PURE__ */ React8.createElement("span", { className: "Layer__btn-icon Layer__btn-icon--left" }, leftIcon), !iconOnly && /* @__PURE__ */ React8.createElement("span", { className: "Layer__btn-text" }, children), rightIcon && /* @__PURE__ */ React8.createElement("span", { className: "Layer__btn-icon Layer__btn-icon--right" }, rightIcon))
|
|
708
|
+
);
|
|
681
709
|
};
|
|
682
710
|
|
|
683
711
|
// src/components/Button/SubmitButton.tsx
|
|
@@ -1076,7 +1104,7 @@ var CategoryMenu = ({
|
|
|
1076
1104
|
className
|
|
1077
1105
|
}) => {
|
|
1078
1106
|
const { categories } = useLayerContext();
|
|
1079
|
-
const suggestedOptions = bankTransaction
|
|
1107
|
+
const suggestedOptions = hasSuggestions(bankTransaction.categorization_flow) ? [
|
|
1080
1108
|
{
|
|
1081
1109
|
label: "Suggested",
|
|
1082
1110
|
options: bankTransaction.categorization_flow.suggestions
|
|
@@ -1094,6 +1122,7 @@ var CategoryMenu = ({
|
|
|
1094
1122
|
options: [category]
|
|
1095
1123
|
};
|
|
1096
1124
|
}).filter((x) => x);
|
|
1125
|
+
console.log("categoryOptions", categoryOptions);
|
|
1097
1126
|
const options = [...suggestedOptions, ...categoryOptions];
|
|
1098
1127
|
return /* @__PURE__ */ React16.createElement(
|
|
1099
1128
|
Select,
|
|
@@ -1235,66 +1264,135 @@ var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React19.createElem
|
|
|
1235
1264
|
);
|
|
1236
1265
|
var RefreshCcw_default = RefreshCcw;
|
|
1237
1266
|
|
|
1238
|
-
// src/icons/
|
|
1267
|
+
// src/icons/Scissors.tsx
|
|
1239
1268
|
import * as React20 from "react";
|
|
1240
|
-
var
|
|
1269
|
+
var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React20.createElement(
|
|
1241
1270
|
"svg",
|
|
1242
1271
|
{
|
|
1243
|
-
viewBox: "0 0
|
|
1272
|
+
viewBox: "0 0 11 11",
|
|
1244
1273
|
fill: "none",
|
|
1245
1274
|
xmlns: "http://www.w3.org/2000/svg",
|
|
1246
1275
|
...props,
|
|
1247
1276
|
width: size,
|
|
1248
1277
|
height: size
|
|
1249
1278
|
},
|
|
1250
|
-
/* @__PURE__ */ React20.createElement(
|
|
1279
|
+
/* @__PURE__ */ React20.createElement(
|
|
1251
1280
|
"path",
|
|
1252
1281
|
{
|
|
1253
|
-
|
|
1254
|
-
d: "M3 4.5C3.82843 4.5 4.5 3.82843 4.5 3C4.5 2.17157 3.82843 1.5 3 1.5C2.17157 1.5 1.5 2.17157 1.5 3C1.5 3.82843 2.17157 4.5 3 4.5Z",
|
|
1282
|
+
d: "M2.75 4.125C3.50939 4.125 4.125 3.50939 4.125 2.75C4.125 1.99061 3.50939 1.375 2.75 1.375C1.99061 1.375 1.375 1.99061 1.375 2.75C1.375 3.50939 1.99061 4.125 2.75 4.125Z",
|
|
1255
1283
|
stroke: "currentColor",
|
|
1256
1284
|
strokeLinecap: "round",
|
|
1257
1285
|
strokeLinejoin: "round"
|
|
1258
|
-
}
|
|
1259
|
-
|
|
1286
|
+
},
|
|
1287
|
+
/* @__PURE__ */ React20.createElement(
|
|
1288
|
+
"animate",
|
|
1289
|
+
{
|
|
1290
|
+
attributeName: "d",
|
|
1291
|
+
className: "animateOnHover",
|
|
1292
|
+
values: "M2.75 4.125C3.50939 4.125 4.125 3.50939 4.125 2.75C4.125 1.99061 3.50939 1.375 2.75 1.375C1.99061 1.375 1.375 1.99061 1.375 2.75C1.375 3.50939 1.99061 4.125 2.75 4.125Z;M2.50519 5.21436C3.20276 4.91424 3.52494 4.10544 3.22481 3.40788C2.92468 2.71031 2.11589 2.38813 1.41833 2.68826C0.720762 2.98839 0.398577 3.79718 0.698706 4.49474C0.998836 5.19231 1.80763 5.51449 2.50519 5.21436Z;M2.75 4.125C3.50939 4.125 4.125 3.50939 4.125 2.75C4.125 1.99061 3.50939 1.375 2.75 1.375C1.99061 1.375 1.375 1.99061 1.375 2.75C1.375 3.50939 1.99061 4.125 2.75 4.125Z",
|
|
1293
|
+
begin: "indefinite",
|
|
1294
|
+
dur: "400ms",
|
|
1295
|
+
repeatCount: "1",
|
|
1296
|
+
fill: "freeze",
|
|
1297
|
+
calcMode: "linear",
|
|
1298
|
+
keyTimes: "0;0.5;1"
|
|
1299
|
+
}
|
|
1300
|
+
)
|
|
1301
|
+
),
|
|
1302
|
+
/* @__PURE__ */ React20.createElement(
|
|
1260
1303
|
"path",
|
|
1261
1304
|
{
|
|
1262
|
-
|
|
1263
|
-
d: "M3 10.5C3.82843 10.5 4.5 9.82843 4.5 9C4.5 8.17157 3.82843 7.5 3 7.5C2.17157 7.5 1.5 8.17157 1.5 9C1.5 9.82843 2.17157 10.5 3 10.5Z",
|
|
1305
|
+
d: "M2.75 9.625C3.50939 9.625 4.125 9.00939 4.125 8.25C4.125 7.49061 3.50939 6.875 2.75 6.875C1.99061 6.875 1.375 7.49061 1.375 8.25C1.375 9.00939 1.99061 9.625 2.75 9.625Z",
|
|
1264
1306
|
stroke: "currentColor",
|
|
1265
1307
|
strokeLinecap: "round",
|
|
1266
1308
|
strokeLinejoin: "round"
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1309
|
+
},
|
|
1310
|
+
/* @__PURE__ */ React20.createElement(
|
|
1311
|
+
"animate",
|
|
1312
|
+
{
|
|
1313
|
+
attributeName: "d",
|
|
1314
|
+
className: "animateOnHover",
|
|
1315
|
+
values: "M2.75 9.625C3.50939 9.625 4.125 9.00939 4.125 8.25C4.125 7.49061 3.50939 6.875 2.75 6.875C1.99061 6.875 1.375 7.49061 1.375 8.25C1.375 9.00939 1.99061 9.625 2.75 9.625Z;M1.43277 8.38576C2.13615 8.67201 2.9384 8.33386 3.22465 7.63049C3.5109 6.92711 3.17275 6.12486 2.46937 5.83861C1.766 5.55236 0.96375 5.89051 0.6775 6.59389C0.391251 7.29726 0.729398 8.09951 1.43277 8.38576Z;M2.75 9.625C3.50939 9.625 4.125 9.00939 4.125 8.25C4.125 7.49061 3.50939 6.875 2.75 6.875C1.99061 6.875 1.375 7.49061 1.375 8.25C1.375 9.00939 1.99061 9.625 2.75 9.625Z",
|
|
1316
|
+
begin: "indefinite",
|
|
1317
|
+
dur: "400ms",
|
|
1318
|
+
repeatCount: "1",
|
|
1319
|
+
fill: "freeze",
|
|
1320
|
+
calcMode: "linear",
|
|
1321
|
+
keyTimes: "0;0.5;1"
|
|
1322
|
+
}
|
|
1323
|
+
)
|
|
1324
|
+
),
|
|
1325
|
+
/* @__PURE__ */ React20.createElement(
|
|
1269
1326
|
"path",
|
|
1270
1327
|
{
|
|
1271
|
-
|
|
1272
|
-
d: "M10 2L4.06 7.94",
|
|
1328
|
+
d: "M9.16668 1.83325L3.72168 7.27825",
|
|
1273
1329
|
stroke: "currentColor",
|
|
1274
1330
|
strokeLinecap: "round",
|
|
1275
1331
|
strokeLinejoin: "round"
|
|
1276
|
-
}
|
|
1277
|
-
|
|
1332
|
+
},
|
|
1333
|
+
/* @__PURE__ */ React20.createElement(
|
|
1334
|
+
"animate",
|
|
1335
|
+
{
|
|
1336
|
+
attributeName: "d",
|
|
1337
|
+
className: "animateOnHover",
|
|
1338
|
+
values: "M9.16668 1.83325L3.72168 7.27825;M10.3129 3.58763L3.21706 6.57851;M9.16668 1.83325L3.72168 7.27825",
|
|
1339
|
+
begin: "indefinite",
|
|
1340
|
+
dur: "400ms",
|
|
1341
|
+
repeatCount: "1",
|
|
1342
|
+
fill: "freeze",
|
|
1343
|
+
calcMode: "linear",
|
|
1344
|
+
keyTimes: "0;0.5;1"
|
|
1345
|
+
}
|
|
1346
|
+
)
|
|
1347
|
+
),
|
|
1348
|
+
/* @__PURE__ */ React20.createElement(
|
|
1278
1349
|
"path",
|
|
1279
1350
|
{
|
|
1280
|
-
|
|
1281
|
-
d: "M7.235 7.23999L10 9.99999",
|
|
1351
|
+
d: "M6.63232 6.63672L9.16691 9.16672",
|
|
1282
1352
|
stroke: "currentColor",
|
|
1283
1353
|
strokeLinecap: "round",
|
|
1284
1354
|
strokeLinejoin: "round"
|
|
1285
|
-
}
|
|
1286
|
-
|
|
1355
|
+
},
|
|
1356
|
+
/* @__PURE__ */ React20.createElement(
|
|
1357
|
+
"animate",
|
|
1358
|
+
{
|
|
1359
|
+
attributeName: "d",
|
|
1360
|
+
className: "animateOnHover",
|
|
1361
|
+
values: "M6.63232 6.63672L9.16691 9.16672;M7.06396 5.9873L10.3921 7.3096;M6.63232 6.63672L9.16691 9.16672",
|
|
1362
|
+
begin: "indefinite",
|
|
1363
|
+
dur: "400ms",
|
|
1364
|
+
repeatCount: "1",
|
|
1365
|
+
fill: "freeze",
|
|
1366
|
+
calcMode: "linear",
|
|
1367
|
+
keyTimes: "0;0.5;1"
|
|
1368
|
+
}
|
|
1369
|
+
)
|
|
1370
|
+
),
|
|
1371
|
+
/* @__PURE__ */ React20.createElement(
|
|
1287
1372
|
"path",
|
|
1288
1373
|
{
|
|
1289
|
-
|
|
1290
|
-
d: "M4.06 4.06006L6 6.00006",
|
|
1374
|
+
d: "M3.72168 3.72168L5.50001 5.50001",
|
|
1291
1375
|
stroke: "currentColor",
|
|
1292
1376
|
strokeLinecap: "round",
|
|
1293
1377
|
strokeLinejoin: "round"
|
|
1294
|
-
}
|
|
1295
|
-
|
|
1378
|
+
},
|
|
1379
|
+
/* @__PURE__ */ React20.createElement(
|
|
1380
|
+
"animate",
|
|
1381
|
+
{
|
|
1382
|
+
attributeName: "d",
|
|
1383
|
+
className: "animateOnHover",
|
|
1384
|
+
values: "M3.72168 3.72168L5.50001 5.50001;M3.23828 4.45996L5.57467 5.39067;M3.72168 3.72168L5.50001 5.50001",
|
|
1385
|
+
begin: "indefinite",
|
|
1386
|
+
dur: "400ms",
|
|
1387
|
+
repeatCount: "1",
|
|
1388
|
+
fill: "freeze",
|
|
1389
|
+
calcMode: "linear",
|
|
1390
|
+
keyTimes: "0;0.5;1"
|
|
1391
|
+
}
|
|
1392
|
+
)
|
|
1393
|
+
)
|
|
1296
1394
|
);
|
|
1297
|
-
var
|
|
1395
|
+
var Scissors_default = Scissors;
|
|
1298
1396
|
|
|
1299
1397
|
// src/components/Input/Input.tsx
|
|
1300
1398
|
import React21 from "react";
|
|
@@ -1308,7 +1406,7 @@ var Input = ({ className, ...props }) => {
|
|
|
1308
1406
|
import React24 from "react";
|
|
1309
1407
|
|
|
1310
1408
|
// src/components/Typography/Text.tsx
|
|
1311
|
-
import React22, { useRef as
|
|
1409
|
+
import React22, { useRef as useRef4, useState as useState4, useEffect } from "react";
|
|
1312
1410
|
import classNames4 from "classnames";
|
|
1313
1411
|
var Text = ({
|
|
1314
1412
|
as: Component = "p",
|
|
@@ -1349,7 +1447,7 @@ var TextWithTooltip = ({
|
|
|
1349
1447
|
tooltipOptions,
|
|
1350
1448
|
...props
|
|
1351
1449
|
}) => {
|
|
1352
|
-
const textElementRef =
|
|
1450
|
+
const textElementRef = useRef4();
|
|
1353
1451
|
const compareSize = () => {
|
|
1354
1452
|
if (textElementRef.current) {
|
|
1355
1453
|
const compare = textElementRef.current.children[0].scrollWidth > textElementRef.current.children[0].clientWidth;
|
|
@@ -1421,7 +1519,7 @@ var InputGroup = ({
|
|
|
1421
1519
|
};
|
|
1422
1520
|
|
|
1423
1521
|
// src/components/Input/FileInput.tsx
|
|
1424
|
-
import React26, { useRef as
|
|
1522
|
+
import React26, { useRef as useRef5 } from "react";
|
|
1425
1523
|
|
|
1426
1524
|
// src/icons/UploadCloud.tsx
|
|
1427
1525
|
import * as React25 from "react";
|
|
@@ -1476,7 +1574,7 @@ var UploadCloud_default = UploadCloud;
|
|
|
1476
1574
|
|
|
1477
1575
|
// src/components/Input/FileInput.tsx
|
|
1478
1576
|
var FileInput = ({ text = "Upload", onUpload }) => {
|
|
1479
|
-
const hiddenFileInput =
|
|
1577
|
+
const hiddenFileInput = useRef5(null);
|
|
1480
1578
|
const onClick = () => {
|
|
1481
1579
|
if (hiddenFileInput.current) {
|
|
1482
1580
|
hiddenFileInput.current.click();
|
|
@@ -1633,11 +1731,11 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
1633
1731
|
bankTransaction,
|
|
1634
1732
|
isOpen = false,
|
|
1635
1733
|
asListItem = false,
|
|
1636
|
-
|
|
1734
|
+
submitBtnText = "Save"
|
|
1637
1735
|
}, ref) => {
|
|
1638
1736
|
const { categorize: categorizeBankTransaction2 } = useBankTransactions();
|
|
1639
1737
|
const [purpose, setPurpose] = useState6("categorize" /* categorize */);
|
|
1640
|
-
const defaultCategory = bankTransaction.category || bankTransaction.categorization_flow
|
|
1738
|
+
const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && bankTransaction.categorization_flow?.suggestions?.[0];
|
|
1641
1739
|
const [rowState, updateRowState] = useState6({
|
|
1642
1740
|
splits: [
|
|
1643
1741
|
{
|
|
@@ -1772,7 +1870,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
1772
1870
|
Button,
|
|
1773
1871
|
{
|
|
1774
1872
|
onClick: addSplit,
|
|
1775
|
-
leftIcon: /* @__PURE__ */ React29.createElement(
|
|
1873
|
+
leftIcon: /* @__PURE__ */ React29.createElement(Scissors_default, { size: 14 }),
|
|
1776
1874
|
variant: "secondary" /* secondary */
|
|
1777
1875
|
},
|
|
1778
1876
|
"Split"
|
|
@@ -1795,7 +1893,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
1795
1893
|
/* @__PURE__ */ React29.createElement(Textarea, { name: "description", placeholder: "Enter description" })
|
|
1796
1894
|
),
|
|
1797
1895
|
/* @__PURE__ */ React29.createElement("div", { className: `${className}__file-upload` }, /* @__PURE__ */ React29.createElement(FileInput, { text: "Upload receipt" })),
|
|
1798
|
-
asListItem
|
|
1896
|
+
asListItem ? /* @__PURE__ */ React29.createElement("div", { className: `${className}__submit-btn` }, /* @__PURE__ */ React29.createElement(
|
|
1799
1897
|
SubmitButton,
|
|
1800
1898
|
{
|
|
1801
1899
|
onClick: () => {
|
|
@@ -1808,7 +1906,7 @@ var ExpandedBankTransactionRow = forwardRef2(
|
|
|
1808
1906
|
error: bankTransaction.error,
|
|
1809
1907
|
active: true
|
|
1810
1908
|
},
|
|
1811
|
-
|
|
1909
|
+
submitBtnText
|
|
1812
1910
|
)) : null
|
|
1813
1911
|
))
|
|
1814
1912
|
);
|
|
@@ -1830,11 +1928,11 @@ var BankTransactionListItem = ({
|
|
|
1830
1928
|
toggleOpen,
|
|
1831
1929
|
editable
|
|
1832
1930
|
}) => {
|
|
1833
|
-
const expandedRowRef =
|
|
1931
|
+
const expandedRowRef = useRef7(null);
|
|
1834
1932
|
const [removed, setRemoved] = useState7(false);
|
|
1835
1933
|
const { categorize: categorizeBankTransaction2 } = useBankTransactions();
|
|
1836
1934
|
const [selectedCategory, setSelectedCategory] = useState7(
|
|
1837
|
-
bankTransaction.categorization_flow
|
|
1935
|
+
hasSuggestions(bankTransaction.categorization_flow) ? bankTransaction.categorization_flow.suggestions[0] : void 0
|
|
1838
1936
|
);
|
|
1839
1937
|
const save = () => {
|
|
1840
1938
|
if (isOpen && expandedRowRef?.current) {
|
|
@@ -1886,7 +1984,8 @@ var BankTransactionListItem = ({
|
|
|
1886
1984
|
bankTransaction,
|
|
1887
1985
|
close: () => toggleOpen(bankTransaction.id),
|
|
1888
1986
|
isOpen,
|
|
1889
|
-
asListItem: true
|
|
1987
|
+
asListItem: true,
|
|
1988
|
+
submitBtnText: editable ? "Approve" : "Save"
|
|
1890
1989
|
}
|
|
1891
1990
|
)), /* @__PURE__ */ React31.createElement("span", { className: `${className}__base-row` }, editable ? /* @__PURE__ */ React31.createElement(
|
|
1892
1991
|
CategoryMenu,
|
|
@@ -1914,7 +2013,7 @@ var BankTransactionListItem = ({
|
|
|
1914
2013
|
};
|
|
1915
2014
|
|
|
1916
2015
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
1917
|
-
import React32, { useRef as
|
|
2016
|
+
import React32, { useRef as useRef8, useState as useState8 } from "react";
|
|
1918
2017
|
import classNames10 from "classnames";
|
|
1919
2018
|
import { parseISO as parseISO3, format as formatTime2 } from "date-fns";
|
|
1920
2019
|
var isCredit2 = ({ direction }) => direction === "CREDIT" /* CREDIT */;
|
|
@@ -1925,11 +2024,11 @@ var BankTransactionRow = ({
|
|
|
1925
2024
|
toggleOpen,
|
|
1926
2025
|
editable
|
|
1927
2026
|
}) => {
|
|
1928
|
-
const expandedRowRef =
|
|
2027
|
+
const expandedRowRef = useRef8(null);
|
|
1929
2028
|
const [removed, setRemoved] = useState8(false);
|
|
1930
2029
|
const { categorize: categorizeBankTransaction2 } = useBankTransactions();
|
|
1931
2030
|
const [selectedCategory, setSelectedCategory] = useState8(
|
|
1932
|
-
bankTransaction.categorization_flow
|
|
2031
|
+
hasSuggestions(bankTransaction.categorization_flow) ? bankTransaction.categorization_flow.suggestions[0] : void 0
|
|
1933
2032
|
);
|
|
1934
2033
|
const save = () => {
|
|
1935
2034
|
if (isOpen && expandedRowRef?.current) {
|
|
@@ -1976,7 +2075,7 @@ var BankTransactionRow = ({
|
|
|
1976
2075
|
contentClassName: "Layer__bank-transactions__tx-tooltip"
|
|
1977
2076
|
}
|
|
1978
2077
|
},
|
|
1979
|
-
bankTransaction.counterparty_name
|
|
2078
|
+
bankTransaction.counterparty_name ?? bankTransaction.description
|
|
1980
2079
|
))),
|
|
1981
2080
|
/* @__PURE__ */ React32.createElement("td", { className: "Layer__table-cell Layer__bank-transactions__account-col" }, /* @__PURE__ */ React32.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React32.createElement(
|
|
1982
2081
|
Text,
|
|
@@ -2019,8 +2118,8 @@ var BankTransactionRow = ({
|
|
|
2019
2118
|
disabled: bankTransaction.processing
|
|
2020
2119
|
}
|
|
2021
2120
|
) : null,
|
|
2022
|
-
!editable ? /* @__PURE__ */ React32.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction?.category?.display_name) : null,
|
|
2023
|
-
editable
|
|
2121
|
+
!editable && !isOpen ? /* @__PURE__ */ React32.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction?.category?.display_name) : null,
|
|
2122
|
+
editable || isOpen ? /* @__PURE__ */ React32.createElement(
|
|
2024
2123
|
SubmitButton,
|
|
2025
2124
|
{
|
|
2026
2125
|
onClick: () => {
|
|
@@ -2033,8 +2132,8 @@ var BankTransactionRow = ({
|
|
|
2033
2132
|
error: bankTransaction.error,
|
|
2034
2133
|
active: isOpen
|
|
2035
2134
|
},
|
|
2036
|
-
"Approve"
|
|
2037
|
-
),
|
|
2135
|
+
editable ? "Approve" : "Save"
|
|
2136
|
+
) : null,
|
|
2038
2137
|
/* @__PURE__ */ React32.createElement(
|
|
2039
2138
|
"div",
|
|
2040
2139
|
{
|
|
@@ -2056,8 +2155,7 @@ var BankTransactionRow = ({
|
|
|
2056
2155
|
ref: expandedRowRef,
|
|
2057
2156
|
bankTransaction,
|
|
2058
2157
|
close: () => toggleOpen(bankTransaction.id),
|
|
2059
|
-
isOpen
|
|
2060
|
-
showSubmitButton: !editable
|
|
2158
|
+
isOpen
|
|
2061
2159
|
}
|
|
2062
2160
|
))));
|
|
2063
2161
|
};
|
|
@@ -2084,7 +2182,6 @@ var parseColorFromTheme = (colorName, color) => {
|
|
|
2084
2182
|
}
|
|
2085
2183
|
try {
|
|
2086
2184
|
if ("h" in color && "s" in color && "l" in color) {
|
|
2087
|
-
console.log("its hsl", color);
|
|
2088
2185
|
return {
|
|
2089
2186
|
[`--color-${colorName}-h`]: color.h,
|
|
2090
2187
|
[`--color-${colorName}-s`]: color.s,
|
|
@@ -2093,7 +2190,6 @@ var parseColorFromTheme = (colorName, color) => {
|
|
|
2093
2190
|
}
|
|
2094
2191
|
if ("r" in color && "g" in color && "b" in color) {
|
|
2095
2192
|
const { h, s, l } = rgbToHsl(color);
|
|
2096
|
-
console.log("its rgb", h, s, l);
|
|
2097
2193
|
return {
|
|
2098
2194
|
[`--color-${colorName}-h`]: h,
|
|
2099
2195
|
[`--color-${colorName}-s`]: `${s}%`,
|
|
@@ -2101,7 +2197,6 @@ var parseColorFromTheme = (colorName, color) => {
|
|
|
2101
2197
|
};
|
|
2102
2198
|
}
|
|
2103
2199
|
if ("hex" in color) {
|
|
2104
|
-
console.log("its hex");
|
|
2105
2200
|
const rgb = hexToRgb(color.hex);
|
|
2106
2201
|
if (!rgb) {
|
|
2107
2202
|
return {};
|
|
@@ -2111,7 +2206,6 @@ var parseColorFromTheme = (colorName, color) => {
|
|
|
2111
2206
|
g: rgb.g.toString(),
|
|
2112
2207
|
b: rgb.b.toString()
|
|
2113
2208
|
});
|
|
2114
|
-
console.log("its hex", h, s, l);
|
|
2115
2209
|
return {
|
|
2116
2210
|
[`--color-${colorName}-h`]: h,
|
|
2117
2211
|
[`--color-${colorName}-s`]: `${s}%`,
|
|
@@ -2155,34 +2249,120 @@ var hexToRgb = (hex) => {
|
|
|
2155
2249
|
};
|
|
2156
2250
|
|
|
2157
2251
|
// src/components/Container/Container.tsx
|
|
2158
|
-
|
|
2159
|
-
|
|
2252
|
+
import classNames11 from "classnames";
|
|
2253
|
+
var Container = ({
|
|
2254
|
+
name,
|
|
2255
|
+
className,
|
|
2256
|
+
children,
|
|
2257
|
+
asWidget
|
|
2258
|
+
}) => {
|
|
2259
|
+
const baseClassName = classNames11(
|
|
2260
|
+
"Layer__component Layer__component-container",
|
|
2261
|
+
`Layer__${name}`,
|
|
2262
|
+
asWidget ? "Layer__component--as-widget" : "",
|
|
2263
|
+
className
|
|
2264
|
+
);
|
|
2160
2265
|
const { theme } = useLayerContext();
|
|
2161
2266
|
const styles = parseStylesFromThemeConfig(theme);
|
|
2162
|
-
return /* @__PURE__ */ React33.createElement(
|
|
2163
|
-
"div",
|
|
2164
|
-
{
|
|
2165
|
-
className: `Layer__component Layer__component-container ${baseClassName}`,
|
|
2166
|
-
style: { ...styles }
|
|
2167
|
-
},
|
|
2168
|
-
children
|
|
2169
|
-
);
|
|
2267
|
+
return /* @__PURE__ */ React33.createElement("div", { className: baseClassName, style: { ...styles } }, children);
|
|
2170
2268
|
};
|
|
2171
2269
|
|
|
2172
2270
|
// src/components/Container/Header.tsx
|
|
2173
2271
|
import React34, { forwardRef as forwardRef3 } from "react";
|
|
2174
|
-
import
|
|
2272
|
+
import classNames12 from "classnames";
|
|
2175
2273
|
var Header = forwardRef3(
|
|
2176
2274
|
({ className, children, style }, ref) => {
|
|
2177
|
-
const baseClassName =
|
|
2275
|
+
const baseClassName = classNames12("Layer__component-header", className);
|
|
2178
2276
|
return /* @__PURE__ */ React34.createElement("header", { ref, className: baseClassName, style }, children);
|
|
2179
2277
|
}
|
|
2180
2278
|
);
|
|
2181
2279
|
|
|
2280
|
+
// src/components/DataState/DataState.tsx
|
|
2281
|
+
import React36 from "react";
|
|
2282
|
+
|
|
2283
|
+
// src/icons/AlertOctagon.tsx
|
|
2284
|
+
import * as React35 from "react";
|
|
2285
|
+
var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React35.createElement(
|
|
2286
|
+
"svg",
|
|
2287
|
+
{
|
|
2288
|
+
viewBox: "0 0 18 18",
|
|
2289
|
+
fill: "none",
|
|
2290
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2291
|
+
...props,
|
|
2292
|
+
width: size,
|
|
2293
|
+
height: size
|
|
2294
|
+
},
|
|
2295
|
+
/* @__PURE__ */ React35.createElement(
|
|
2296
|
+
"path",
|
|
2297
|
+
{
|
|
2298
|
+
d: "M5.895 1.5H12.105L16.5 5.895V12.105L12.105 16.5H5.895L1.5 12.105V5.895L5.895 1.5Z",
|
|
2299
|
+
stroke: "currentColor",
|
|
2300
|
+
strokeLinecap: "round",
|
|
2301
|
+
strokeLinejoin: "round"
|
|
2302
|
+
}
|
|
2303
|
+
),
|
|
2304
|
+
/* @__PURE__ */ React35.createElement(
|
|
2305
|
+
"path",
|
|
2306
|
+
{
|
|
2307
|
+
d: "M9 6V9",
|
|
2308
|
+
stroke: "currentColor",
|
|
2309
|
+
strokeLinecap: "round",
|
|
2310
|
+
strokeLinejoin: "round"
|
|
2311
|
+
}
|
|
2312
|
+
),
|
|
2313
|
+
/* @__PURE__ */ React35.createElement(
|
|
2314
|
+
"path",
|
|
2315
|
+
{
|
|
2316
|
+
d: "M9 12H9.0075",
|
|
2317
|
+
stroke: "currentColor",
|
|
2318
|
+
strokeLinecap: "round",
|
|
2319
|
+
strokeLinejoin: "round"
|
|
2320
|
+
}
|
|
2321
|
+
)
|
|
2322
|
+
);
|
|
2323
|
+
var AlertOctagon_default = AlertOctagon;
|
|
2324
|
+
|
|
2325
|
+
// src/components/DataState/DataState.tsx
|
|
2326
|
+
var getIcon = (status) => {
|
|
2327
|
+
switch (status) {
|
|
2328
|
+
case "failed" /* failed */:
|
|
2329
|
+
return /* @__PURE__ */ React36.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--error" }, /* @__PURE__ */ React36.createElement(AlertOctagon_default, { size: 12 }));
|
|
2330
|
+
default:
|
|
2331
|
+
return /* @__PURE__ */ React36.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ React36.createElement(CheckCircle_default, { size: 12 }));
|
|
2332
|
+
}
|
|
2333
|
+
};
|
|
2334
|
+
var DataState = ({
|
|
2335
|
+
status,
|
|
2336
|
+
title,
|
|
2337
|
+
description,
|
|
2338
|
+
onRefresh,
|
|
2339
|
+
isLoading
|
|
2340
|
+
}) => {
|
|
2341
|
+
return /* @__PURE__ */ React36.createElement("div", { className: "Layer__data-state" }, getIcon(status), /* @__PURE__ */ React36.createElement(
|
|
2342
|
+
Text,
|
|
2343
|
+
{
|
|
2344
|
+
as: "span",
|
|
2345
|
+
size: "lg" /* lg */,
|
|
2346
|
+
weight: "bold" /* bold */,
|
|
2347
|
+
className: "Layer__data-state__title"
|
|
2348
|
+
},
|
|
2349
|
+
title
|
|
2350
|
+
), /* @__PURE__ */ React36.createElement(Text, { as: "span", className: "Layer__data-state__description" }, description), onRefresh && /* @__PURE__ */ React36.createElement("span", { className: "Layer__data-state__btn" }, /* @__PURE__ */ React36.createElement(
|
|
2351
|
+
Button,
|
|
2352
|
+
{
|
|
2353
|
+
variant: "secondary" /* secondary */,
|
|
2354
|
+
rightIcon: isLoading ? /* @__PURE__ */ React36.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" }) : /* @__PURE__ */ React36.createElement(RefreshCcw_default, { size: 12 }),
|
|
2355
|
+
onClick: onRefresh,
|
|
2356
|
+
disabled: isLoading
|
|
2357
|
+
},
|
|
2358
|
+
"Refresh"
|
|
2359
|
+
)));
|
|
2360
|
+
};
|
|
2361
|
+
|
|
2182
2362
|
// src/components/Loader/Loader.tsx
|
|
2183
|
-
import
|
|
2363
|
+
import React37 from "react";
|
|
2184
2364
|
var Loader2 = ({ children }) => {
|
|
2185
|
-
return /* @__PURE__ */
|
|
2365
|
+
return /* @__PURE__ */ React37.createElement("span", { className: "Layer__loader" }, /* @__PURE__ */ React37.createElement(Loader_default, { size: 28, className: "Layer__anim--rotating" }), children);
|
|
2186
2366
|
};
|
|
2187
2367
|
|
|
2188
2368
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
@@ -2204,10 +2384,12 @@ var filterVisibility = (display) => (bankTransaction) => {
|
|
|
2204
2384
|
const inReview = ReviewCategories.includes(bankTransaction.categorization_status) || bankTransaction.recently_categorized;
|
|
2205
2385
|
return display === "review" /* review */ && inReview || display === "categorized" /* categorized */ && categorized;
|
|
2206
2386
|
};
|
|
2207
|
-
var BankTransactions = (
|
|
2387
|
+
var BankTransactions = ({
|
|
2388
|
+
asWidget = false
|
|
2389
|
+
}) => {
|
|
2208
2390
|
const [display, setDisplay] = useState9("review" /* review */);
|
|
2209
|
-
const { data, isLoading } = useBankTransactions();
|
|
2210
|
-
const bankTransactions = data
|
|
2391
|
+
const { data, isLoading, error, isValidating, refetch } = useBankTransactions();
|
|
2392
|
+
const bankTransactions = data?.filter(filterVisibility(display));
|
|
2211
2393
|
const onCategorizationDisplayChange = (event) => setDisplay(
|
|
2212
2394
|
event.target.value === "categorized" /* categorized */ ? "categorized" /* categorized */ : "review" /* review */
|
|
2213
2395
|
);
|
|
@@ -2225,15 +2407,15 @@ var BankTransactions = () => {
|
|
|
2225
2407
|
}
|
|
2226
2408
|
});
|
|
2227
2409
|
const editable = display === "review" /* review */;
|
|
2228
|
-
return /* @__PURE__ */
|
|
2410
|
+
return /* @__PURE__ */ React38.createElement(Container, { name: COMPONENT_NAME, asWidget }, /* @__PURE__ */ React38.createElement(
|
|
2229
2411
|
Header,
|
|
2230
2412
|
{
|
|
2231
2413
|
ref: headerRef,
|
|
2232
2414
|
className: "Layer__bank-transactions__header",
|
|
2233
2415
|
style: { top: shiftStickyHeader }
|
|
2234
2416
|
},
|
|
2235
|
-
/* @__PURE__ */
|
|
2236
|
-
/* @__PURE__ */
|
|
2417
|
+
/* @__PURE__ */ React38.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
|
|
2418
|
+
/* @__PURE__ */ React38.createElement(
|
|
2237
2419
|
Toggle,
|
|
2238
2420
|
{
|
|
2239
2421
|
name: "bank-transaction-display",
|
|
@@ -2245,14 +2427,14 @@ var BankTransactions = () => {
|
|
|
2245
2427
|
onChange: onCategorizationDisplayChange
|
|
2246
2428
|
}
|
|
2247
2429
|
)
|
|
2248
|
-
), /* @__PURE__ */
|
|
2430
|
+
), /* @__PURE__ */ React38.createElement(
|
|
2249
2431
|
"table",
|
|
2250
2432
|
{
|
|
2251
2433
|
width: "100%",
|
|
2252
2434
|
className: "Layer__table Layer__bank-transactions__table"
|
|
2253
2435
|
},
|
|
2254
|
-
/* @__PURE__ */
|
|
2255
|
-
/* @__PURE__ */
|
|
2436
|
+
/* @__PURE__ */ React38.createElement("thead", null, /* @__PURE__ */ React38.createElement("tr", null, /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__bank-transactions__date-col" }, "Date"), /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__bank-transactions__tx-col" }, "Transaction"), /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__bank-transactions__account-col" }, "Account"), /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__table-cell--amount Layer__table-cell__amount-col" }, "Amount"), editable ? /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__table-header--primary Layer__table-cell__category-col" }, "Categorize") : /* @__PURE__ */ React38.createElement("th", { className: "Layer__table-header Layer__table-cell__category-col" }, "Category"))),
|
|
2437
|
+
/* @__PURE__ */ React38.createElement("tbody", null, !isLoading && bankTransactions?.map((bankTransaction) => /* @__PURE__ */ React38.createElement(
|
|
2256
2438
|
BankTransactionRow,
|
|
2257
2439
|
{
|
|
2258
2440
|
key: bankTransaction.id,
|
|
@@ -2263,7 +2445,7 @@ var BankTransactions = () => {
|
|
|
2263
2445
|
editable
|
|
2264
2446
|
}
|
|
2265
2447
|
)))
|
|
2266
|
-
), isLoading
|
|
2448
|
+
), isLoading && !bankTransactions ? /* @__PURE__ */ React38.createElement("div", { className: "Layer__bank-transactions__loader-container" }, /* @__PURE__ */ React38.createElement(Loader2, null)) : null, !isLoading && /* @__PURE__ */ React38.createElement("ul", { className: "Layer__bank-transactions__list" }, bankTransactions?.map((bankTransaction) => /* @__PURE__ */ React38.createElement(
|
|
2267
2449
|
BankTransactionListItem,
|
|
2268
2450
|
{
|
|
2269
2451
|
key: bankTransaction.id,
|
|
@@ -2273,11 +2455,29 @@ var BankTransactions = () => {
|
|
|
2273
2455
|
toggleOpen,
|
|
2274
2456
|
editable
|
|
2275
2457
|
}
|
|
2276
|
-
))))
|
|
2458
|
+
))), !isLoading && !error && (bankTransactions === void 0 || bankTransactions !== void 0 && bankTransactions.length === 0) ? /* @__PURE__ */ React38.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React38.createElement(
|
|
2459
|
+
DataState,
|
|
2460
|
+
{
|
|
2461
|
+
status: "allDone" /* allDone */,
|
|
2462
|
+
title: "You are up to date with transactions!",
|
|
2463
|
+
description: "All uncategorized transaction will be displayed here",
|
|
2464
|
+
onRefresh: () => refetch(),
|
|
2465
|
+
isLoading: isValidating
|
|
2466
|
+
}
|
|
2467
|
+
)) : null, !isLoading && error ? /* @__PURE__ */ React38.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React38.createElement(
|
|
2468
|
+
DataState,
|
|
2469
|
+
{
|
|
2470
|
+
status: "failed" /* failed */,
|
|
2471
|
+
title: "Something went wrong",
|
|
2472
|
+
description: "We couldn\u2019t load your data.",
|
|
2473
|
+
onRefresh: () => refetch(),
|
|
2474
|
+
isLoading: isValidating
|
|
2475
|
+
}
|
|
2476
|
+
)) : null);
|
|
2277
2477
|
};
|
|
2278
2478
|
|
|
2279
2479
|
// src/components/Hello/Hello.tsx
|
|
2280
|
-
import
|
|
2480
|
+
import React39 from "react";
|
|
2281
2481
|
import useSWR3 from "swr";
|
|
2282
2482
|
var fetcher = (url) => fetch(url).then((res) => res.json());
|
|
2283
2483
|
var Hello = ({ user }) => {
|
|
@@ -2286,11 +2486,11 @@ var Hello = ({ user }) => {
|
|
|
2286
2486
|
fetcher
|
|
2287
2487
|
);
|
|
2288
2488
|
const name = (isLoading ? "..." : data?.name) || "User";
|
|
2289
|
-
return /* @__PURE__ */
|
|
2489
|
+
return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
|
|
2290
2490
|
};
|
|
2291
2491
|
|
|
2292
2492
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
2293
|
-
import
|
|
2493
|
+
import React48, { createContext as createContext2 } from "react";
|
|
2294
2494
|
|
|
2295
2495
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
2296
2496
|
import { useState as useState10 } from "react";
|
|
@@ -2339,10 +2539,10 @@ var useProfitAndLoss = ({ startDate: initialStartDate, endDate: initialEndDate }
|
|
|
2339
2539
|
};
|
|
2340
2540
|
|
|
2341
2541
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
2342
|
-
import
|
|
2542
|
+
import React41, { useContext as useContext2, useMemo, useState as useState11 } from "react";
|
|
2343
2543
|
|
|
2344
2544
|
// src/components/ProfitAndLossChart/Indicator.tsx
|
|
2345
|
-
import
|
|
2545
|
+
import React40, { useEffect as useEffect3 } from "react";
|
|
2346
2546
|
var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
|
|
2347
2547
|
var Indicator = ({
|
|
2348
2548
|
viewBox = {},
|
|
@@ -2366,7 +2566,7 @@ var Indicator = ({
|
|
|
2366
2566
|
setAnimateFrom(animateTo);
|
|
2367
2567
|
}, [animateTo]);
|
|
2368
2568
|
const actualX = animateFrom === -1 ? animateTo : animateFrom;
|
|
2369
|
-
return /* @__PURE__ */
|
|
2569
|
+
return /* @__PURE__ */ React40.createElement(
|
|
2370
2570
|
"rect",
|
|
2371
2571
|
{
|
|
2372
2572
|
className: "Layer__profit-and-loss-chart__selection-indicator",
|
|
@@ -2498,7 +2698,7 @@ var ProfitAndLossChart = () => {
|
|
|
2498
2698
|
]
|
|
2499
2699
|
);
|
|
2500
2700
|
const [animateFrom, setAnimateFrom] = useState11(-1);
|
|
2501
|
-
return /* @__PURE__ */
|
|
2701
|
+
return /* @__PURE__ */ React41.createElement(ResponsiveContainer, { width: "100%", height: 250 }, /* @__PURE__ */ React41.createElement(
|
|
2502
2702
|
BarChart,
|
|
2503
2703
|
{
|
|
2504
2704
|
margin: { left: 24, right: 24, bottom: 24 },
|
|
@@ -2507,8 +2707,8 @@ var ProfitAndLossChart = () => {
|
|
|
2507
2707
|
barGap,
|
|
2508
2708
|
className: "Layer__profit-and-loss-chart"
|
|
2509
2709
|
},
|
|
2510
|
-
/* @__PURE__ */
|
|
2511
|
-
/* @__PURE__ */
|
|
2710
|
+
/* @__PURE__ */ React41.createElement(CartesianGrid, { vertical: false }),
|
|
2711
|
+
/* @__PURE__ */ React41.createElement(
|
|
2512
2712
|
Legend,
|
|
2513
2713
|
{
|
|
2514
2714
|
verticalAlign: "top",
|
|
@@ -2519,8 +2719,8 @@ var ProfitAndLossChart = () => {
|
|
|
2519
2719
|
]
|
|
2520
2720
|
}
|
|
2521
2721
|
),
|
|
2522
|
-
/* @__PURE__ */
|
|
2523
|
-
/* @__PURE__ */
|
|
2722
|
+
/* @__PURE__ */ React41.createElement(XAxis, { dataKey: "name", tickLine: false }),
|
|
2723
|
+
/* @__PURE__ */ React41.createElement(
|
|
2524
2724
|
Bar,
|
|
2525
2725
|
{
|
|
2526
2726
|
dataKey: "revenue",
|
|
@@ -2529,10 +2729,10 @@ var ProfitAndLossChart = () => {
|
|
|
2529
2729
|
radius: [barSize / 4, barSize / 4, 0, 0],
|
|
2530
2730
|
className: "Layer__profit-and-loss-chart__bar--income"
|
|
2531
2731
|
},
|
|
2532
|
-
/* @__PURE__ */
|
|
2732
|
+
/* @__PURE__ */ React41.createElement(
|
|
2533
2733
|
LabelList,
|
|
2534
2734
|
{
|
|
2535
|
-
content: /* @__PURE__ */
|
|
2735
|
+
content: /* @__PURE__ */ React41.createElement(
|
|
2536
2736
|
Indicator,
|
|
2537
2737
|
{
|
|
2538
2738
|
animateFrom,
|
|
@@ -2541,7 +2741,7 @@ var ProfitAndLossChart = () => {
|
|
|
2541
2741
|
)
|
|
2542
2742
|
}
|
|
2543
2743
|
),
|
|
2544
|
-
data.map((entry) => /* @__PURE__ */
|
|
2744
|
+
data.map((entry) => /* @__PURE__ */ React41.createElement(
|
|
2545
2745
|
Cell,
|
|
2546
2746
|
{
|
|
2547
2747
|
key: entry.name,
|
|
@@ -2549,7 +2749,7 @@ var ProfitAndLossChart = () => {
|
|
|
2549
2749
|
}
|
|
2550
2750
|
))
|
|
2551
2751
|
),
|
|
2552
|
-
/* @__PURE__ */
|
|
2752
|
+
/* @__PURE__ */ React41.createElement(
|
|
2553
2753
|
Bar,
|
|
2554
2754
|
{
|
|
2555
2755
|
dataKey: "expenses",
|
|
@@ -2558,7 +2758,7 @@ var ProfitAndLossChart = () => {
|
|
|
2558
2758
|
radius: [barSize / 4, barSize / 4, 0, 0],
|
|
2559
2759
|
className: "Layer__profit-and-loss-chart__bar--expenses"
|
|
2560
2760
|
},
|
|
2561
|
-
data.map((entry) => /* @__PURE__ */
|
|
2761
|
+
data.map((entry) => /* @__PURE__ */ React41.createElement(
|
|
2562
2762
|
Cell,
|
|
2563
2763
|
{
|
|
2564
2764
|
key: entry.name,
|
|
@@ -2570,15 +2770,15 @@ var ProfitAndLossChart = () => {
|
|
|
2570
2770
|
};
|
|
2571
2771
|
|
|
2572
2772
|
// src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
|
|
2573
|
-
import
|
|
2773
|
+
import React44, { useContext as useContext3 } from "react";
|
|
2574
2774
|
|
|
2575
2775
|
// src/icons/ChevronLeft.tsx
|
|
2576
|
-
import * as
|
|
2776
|
+
import * as React42 from "react";
|
|
2577
2777
|
var ChevronLeft = ({
|
|
2578
2778
|
strokeColor,
|
|
2579
2779
|
size,
|
|
2580
2780
|
...props
|
|
2581
|
-
}) => /* @__PURE__ */
|
|
2781
|
+
}) => /* @__PURE__ */ React42.createElement(
|
|
2582
2782
|
"svg",
|
|
2583
2783
|
{
|
|
2584
2784
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2588,7 +2788,7 @@ var ChevronLeft = ({
|
|
|
2588
2788
|
viewBox: "0 0 24 24",
|
|
2589
2789
|
...props
|
|
2590
2790
|
},
|
|
2591
|
-
/* @__PURE__ */
|
|
2791
|
+
/* @__PURE__ */ React42.createElement(
|
|
2592
2792
|
"path",
|
|
2593
2793
|
{
|
|
2594
2794
|
stroke: strokeColor ?? "#000",
|
|
@@ -2602,8 +2802,8 @@ var ChevronLeft = ({
|
|
|
2602
2802
|
var ChevronLeft_default = ChevronLeft;
|
|
2603
2803
|
|
|
2604
2804
|
// src/icons/ChevronRight.tsx
|
|
2605
|
-
import * as
|
|
2606
|
-
var ChavronRight = ({ size, ...props }) => /* @__PURE__ */
|
|
2805
|
+
import * as React43 from "react";
|
|
2806
|
+
var ChavronRight = ({ size, ...props }) => /* @__PURE__ */ React43.createElement(
|
|
2607
2807
|
"svg",
|
|
2608
2808
|
{
|
|
2609
2809
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -2613,7 +2813,7 @@ var ChavronRight = ({ size, ...props }) => /* @__PURE__ */ React41.createElement
|
|
|
2613
2813
|
viewBox: "0 0 24 24",
|
|
2614
2814
|
...props
|
|
2615
2815
|
},
|
|
2616
|
-
/* @__PURE__ */
|
|
2816
|
+
/* @__PURE__ */ React43.createElement(
|
|
2617
2817
|
"path",
|
|
2618
2818
|
{
|
|
2619
2819
|
stroke: "#000",
|
|
@@ -2641,28 +2841,28 @@ var ProfitAndLossDatePicker = () => {
|
|
|
2641
2841
|
};
|
|
2642
2842
|
const previousMonth = () => change({ months: -1 });
|
|
2643
2843
|
const nextMonth = () => change({ months: 1 });
|
|
2644
|
-
return /* @__PURE__ */
|
|
2844
|
+
return /* @__PURE__ */ React44.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ React44.createElement(
|
|
2645
2845
|
"button",
|
|
2646
2846
|
{
|
|
2647
2847
|
"aria-label": "View Previous Month",
|
|
2648
2848
|
className: "Layer__profit-and-loss-date-picker__button",
|
|
2649
2849
|
onClick: previousMonth
|
|
2650
2850
|
},
|
|
2651
|
-
/* @__PURE__ */
|
|
2851
|
+
/* @__PURE__ */ React44.createElement(
|
|
2652
2852
|
ChevronLeft_default,
|
|
2653
2853
|
{
|
|
2654
2854
|
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
2655
2855
|
size: 18
|
|
2656
2856
|
}
|
|
2657
2857
|
)
|
|
2658
|
-
), /* @__PURE__ */
|
|
2858
|
+
), /* @__PURE__ */ React44.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, label), /* @__PURE__ */ React44.createElement(
|
|
2659
2859
|
"button",
|
|
2660
2860
|
{
|
|
2661
2861
|
"aria-label": "View Next Month",
|
|
2662
2862
|
className: "Layer__profit-and-loss-date-picker__button",
|
|
2663
2863
|
onClick: nextMonth
|
|
2664
2864
|
},
|
|
2665
|
-
/* @__PURE__ */
|
|
2865
|
+
/* @__PURE__ */ React44.createElement(
|
|
2666
2866
|
ChevronRight_default,
|
|
2667
2867
|
{
|
|
2668
2868
|
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
@@ -2673,26 +2873,26 @@ var ProfitAndLossDatePicker = () => {
|
|
|
2673
2873
|
};
|
|
2674
2874
|
|
|
2675
2875
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
2676
|
-
import
|
|
2876
|
+
import React45, { useContext as useContext4 } from "react";
|
|
2677
2877
|
var ProfitAndLossSummaries = () => {
|
|
2678
2878
|
const { data: storedData } = useContext4(ProfitAndLoss.Context);
|
|
2679
2879
|
const data = storedData ? storedData : { income: { value: NaN }, net_profit: NaN };
|
|
2680
2880
|
const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
|
|
2681
2881
|
const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
|
|
2682
2882
|
const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
|
|
2683
|
-
return /* @__PURE__ */
|
|
2883
|
+
return /* @__PURE__ */ React45.createElement("div", { className: "Layer__profit-and-loss-summaries" }, /* @__PURE__ */ React45.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--income" }, /* @__PURE__ */ React45.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Revenue"), /* @__PURE__ */ React45.createElement(
|
|
2684
2884
|
"span",
|
|
2685
2885
|
{
|
|
2686
2886
|
className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
|
|
2687
2887
|
},
|
|
2688
2888
|
centsToDollars(Math.abs(data?.income?.value ?? NaN))
|
|
2689
|
-
)), /* @__PURE__ */
|
|
2889
|
+
)), /* @__PURE__ */ React45.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--expenses" }, /* @__PURE__ */ React45.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"), /* @__PURE__ */ React45.createElement(
|
|
2690
2890
|
"span",
|
|
2691
2891
|
{
|
|
2692
2892
|
className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
|
|
2693
2893
|
},
|
|
2694
2894
|
centsToDollars(Math.abs((data.income.value ?? 0) - data.net_profit))
|
|
2695
|
-
)), /* @__PURE__ */
|
|
2895
|
+
)), /* @__PURE__ */ React45.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--net-profit" }, /* @__PURE__ */ React45.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), /* @__PURE__ */ React45.createElement(
|
|
2696
2896
|
"span",
|
|
2697
2897
|
{
|
|
2698
2898
|
className: `Layer__profit-and-loss-summaries__amount ${netProfitDirectionClass}`
|
|
@@ -2702,10 +2902,10 @@ var ProfitAndLossSummaries = () => {
|
|
|
2702
2902
|
};
|
|
2703
2903
|
|
|
2704
2904
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
2705
|
-
import
|
|
2905
|
+
import React47, { useContext as useContext5 } from "react";
|
|
2706
2906
|
|
|
2707
2907
|
// src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
|
|
2708
|
-
import
|
|
2908
|
+
import React46, { useState as useState12 } from "react";
|
|
2709
2909
|
var ProfitAndLossRow = ({
|
|
2710
2910
|
variant,
|
|
2711
2911
|
lineItem,
|
|
@@ -2749,12 +2949,12 @@ var ProfitAndLossRow = ({
|
|
|
2749
2949
|
);
|
|
2750
2950
|
displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
|
|
2751
2951
|
displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
|
|
2752
|
-
return /* @__PURE__ */
|
|
2952
|
+
return /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement("div", { className: labelClasses.join(" "), onClick: toggleExpanded }, /* @__PURE__ */ React46.createElement(ChevronDown_default, { size: 16 }), display_name), /* @__PURE__ */ React46.createElement("div", { className: valueClasses.join(" ") }, amountString), canGoDeeper && hasChildren && /* @__PURE__ */ React46.createElement(
|
|
2753
2953
|
"div",
|
|
2754
2954
|
{
|
|
2755
2955
|
className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
|
|
2756
2956
|
},
|
|
2757
|
-
/* @__PURE__ */
|
|
2957
|
+
/* @__PURE__ */ React46.createElement("div", { className: "Layer__balance-sheet-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ React46.createElement(
|
|
2758
2958
|
ProfitAndLossRow,
|
|
2759
2959
|
{
|
|
2760
2960
|
key: line_item.display_name,
|
|
@@ -2763,7 +2963,7 @@ var ProfitAndLossRow = ({
|
|
|
2763
2963
|
maxDepth,
|
|
2764
2964
|
direction
|
|
2765
2965
|
}
|
|
2766
|
-
)), summarize && /* @__PURE__ */
|
|
2966
|
+
)), summarize && /* @__PURE__ */ React46.createElement(
|
|
2767
2967
|
ProfitAndLossRow,
|
|
2768
2968
|
{
|
|
2769
2969
|
key: display_name,
|
|
@@ -2828,13 +3028,13 @@ var empty_profit_and_loss_report_default = {
|
|
|
2828
3028
|
var ProfitAndLossTable = () => {
|
|
2829
3029
|
const { data: actualData, isLoading } = useContext5(ProfitAndLoss.Context);
|
|
2830
3030
|
const data = !actualData || isLoading ? empty_profit_and_loss_report_default : actualData;
|
|
2831
|
-
return /* @__PURE__ */
|
|
3031
|
+
return /* @__PURE__ */ React47.createElement(React47.Fragment, null, /* @__PURE__ */ React47.createElement("div", { className: "Layer__profit-and-loss-table" }, /* @__PURE__ */ React47.createElement(ProfitAndLossRow, { lineItem: data.income, direction: "CREDIT" /* CREDIT */ }), /* @__PURE__ */ React47.createElement(
|
|
2832
3032
|
ProfitAndLossRow,
|
|
2833
3033
|
{
|
|
2834
3034
|
lineItem: data.cost_of_goods_sold,
|
|
2835
3035
|
direction: "DEBIT" /* DEBIT */
|
|
2836
3036
|
}
|
|
2837
|
-
), /* @__PURE__ */
|
|
3037
|
+
), /* @__PURE__ */ React47.createElement(
|
|
2838
3038
|
ProfitAndLossRow,
|
|
2839
3039
|
{
|
|
2840
3040
|
lineItem: {
|
|
@@ -2844,13 +3044,13 @@ var ProfitAndLossTable = () => {
|
|
|
2844
3044
|
variant: "summation",
|
|
2845
3045
|
direction: "CREDIT" /* CREDIT */
|
|
2846
3046
|
}
|
|
2847
|
-
), /* @__PURE__ */
|
|
3047
|
+
), /* @__PURE__ */ React47.createElement(
|
|
2848
3048
|
ProfitAndLossRow,
|
|
2849
3049
|
{
|
|
2850
3050
|
lineItem: data.expenses,
|
|
2851
3051
|
direction: "DEBIT" /* DEBIT */
|
|
2852
3052
|
}
|
|
2853
|
-
), /* @__PURE__ */
|
|
3053
|
+
), /* @__PURE__ */ React47.createElement(
|
|
2854
3054
|
ProfitAndLossRow,
|
|
2855
3055
|
{
|
|
2856
3056
|
lineItem: {
|
|
@@ -2860,7 +3060,7 @@ var ProfitAndLossTable = () => {
|
|
|
2860
3060
|
variant: "summation",
|
|
2861
3061
|
direction: "CREDIT" /* CREDIT */
|
|
2862
3062
|
}
|
|
2863
|
-
), /* @__PURE__ */
|
|
3063
|
+
), /* @__PURE__ */ React47.createElement(ProfitAndLossRow, { lineItem: data.taxes, direction: "DEBIT" /* DEBIT */ }), /* @__PURE__ */ React47.createElement(
|
|
2864
3064
|
ProfitAndLossRow,
|
|
2865
3065
|
{
|
|
2866
3066
|
lineItem: {
|
|
@@ -2870,13 +3070,13 @@ var ProfitAndLossTable = () => {
|
|
|
2870
3070
|
variant: "summation",
|
|
2871
3071
|
direction: "CREDIT" /* CREDIT */
|
|
2872
3072
|
}
|
|
2873
|
-
)), /* @__PURE__ */
|
|
3073
|
+
)), /* @__PURE__ */ React47.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ React47.createElement(
|
|
2874
3074
|
ProfitAndLossRow,
|
|
2875
3075
|
{
|
|
2876
3076
|
lineItem: data.other_outflows,
|
|
2877
3077
|
direction: "DEBIT" /* DEBIT */
|
|
2878
3078
|
}
|
|
2879
|
-
), /* @__PURE__ */
|
|
3079
|
+
), /* @__PURE__ */ React47.createElement(
|
|
2880
3080
|
ProfitAndLossRow,
|
|
2881
3081
|
{
|
|
2882
3082
|
lineItem: data.personal_expenses,
|
|
@@ -2900,7 +3100,7 @@ var PNLContext = createContext2({
|
|
|
2900
3100
|
});
|
|
2901
3101
|
var ProfitAndLoss = ({ children }) => {
|
|
2902
3102
|
const contextData = useProfitAndLoss();
|
|
2903
|
-
return /* @__PURE__ */
|
|
3103
|
+
return /* @__PURE__ */ React48.createElement(PNLContext.Provider, { value: contextData }, /* @__PURE__ */ React48.createElement("div", { className: "Layer__component Layer__profit-and-loss" }, /* @__PURE__ */ React48.createElement("h2", { className: "Layer__profit-and-loss__title" }, "Profit & Loss"), children));
|
|
2904
3104
|
};
|
|
2905
3105
|
ProfitAndLoss.Chart = ProfitAndLossChart;
|
|
2906
3106
|
ProfitAndLoss.Context = PNLContext;
|
|
@@ -2909,7 +3109,7 @@ ProfitAndLoss.Summaries = ProfitAndLossSummaries;
|
|
|
2909
3109
|
ProfitAndLoss.Table = ProfitAndLossTable;
|
|
2910
3110
|
|
|
2911
3111
|
// src/providers/LayerProvider/LayerProvider.tsx
|
|
2912
|
-
import
|
|
3112
|
+
import React49, { useReducer, useEffect as useEffect4 } from "react";
|
|
2913
3113
|
import { add as add2, isBefore } from "date-fns";
|
|
2914
3114
|
import useSWR5, { SWRConfig } from "swr";
|
|
2915
3115
|
var reducer = (state, action) => {
|
|
@@ -3014,11 +3214,11 @@ var LayerProvider = ({
|
|
|
3014
3214
|
type: "LayerContext.setTheme" /* setTheme */,
|
|
3015
3215
|
payload: { theme: theme2 }
|
|
3016
3216
|
});
|
|
3017
|
-
return /* @__PURE__ */
|
|
3217
|
+
return /* @__PURE__ */ React49.createElement(SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ React49.createElement(LayerContext.Provider, { value: { ...state, setTheme } }, children));
|
|
3018
3218
|
};
|
|
3019
3219
|
|
|
3020
3220
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
3021
|
-
import
|
|
3221
|
+
import React52, { useState as useState14 } from "react";
|
|
3022
3222
|
|
|
3023
3223
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
3024
3224
|
import useSWR6 from "swr";
|
|
@@ -3038,7 +3238,7 @@ var useChartOfAccounts = () => {
|
|
|
3038
3238
|
};
|
|
3039
3239
|
|
|
3040
3240
|
// src/components/ChartOfAccountsNewForm/ChartOfAccountsNewForm.tsx
|
|
3041
|
-
import
|
|
3241
|
+
import React50, { useMemo as useMemo2, useState as useState13 } from "react";
|
|
3042
3242
|
import Select2 from "react-select";
|
|
3043
3243
|
var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.subAccounts || [])]).flat().filter((id) => id);
|
|
3044
3244
|
var ChartOfAccountsNewForm = () => {
|
|
@@ -3066,21 +3266,21 @@ var ChartOfAccountsNewForm = () => {
|
|
|
3066
3266
|
description
|
|
3067
3267
|
});
|
|
3068
3268
|
};
|
|
3069
|
-
return /* @__PURE__ */
|
|
3269
|
+
return /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form" }, /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Name"), /* @__PURE__ */ React50.createElement(
|
|
3070
3270
|
"input",
|
|
3071
3271
|
{
|
|
3072
3272
|
name: "name",
|
|
3073
3273
|
value: name,
|
|
3074
3274
|
onChange: (event) => setName(event.target.value)
|
|
3075
3275
|
}
|
|
3076
|
-
)), /* @__PURE__ */
|
|
3276
|
+
)), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Description"), /* @__PURE__ */ React50.createElement(
|
|
3077
3277
|
"input",
|
|
3078
3278
|
{
|
|
3079
3279
|
name: "description",
|
|
3080
3280
|
value: description,
|
|
3081
3281
|
onChange: (event) => setDescription(event.target.value)
|
|
3082
3282
|
}
|
|
3083
|
-
)), /* @__PURE__ */
|
|
3283
|
+
)), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Normality"), /* @__PURE__ */ React50.createElement(
|
|
3084
3284
|
Select2,
|
|
3085
3285
|
{
|
|
3086
3286
|
isSearchable: false,
|
|
@@ -3090,7 +3290,7 @@ var ChartOfAccountsNewForm = () => {
|
|
|
3090
3290
|
{ label: "Debit", value: "DEBIT" /* DEBIT */ }
|
|
3091
3291
|
]
|
|
3092
3292
|
}
|
|
3093
|
-
)), /* @__PURE__ */
|
|
3293
|
+
)), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Parent Account"), /* @__PURE__ */ React50.createElement(
|
|
3094
3294
|
Select2,
|
|
3095
3295
|
{
|
|
3096
3296
|
isSearchable: true,
|
|
@@ -3100,49 +3300,49 @@ var ChartOfAccountsNewForm = () => {
|
|
|
3100
3300
|
getOptionValue: (a) => a.id,
|
|
3101
3301
|
options: accountOptions
|
|
3102
3302
|
}
|
|
3103
|
-
)), /* @__PURE__ */
|
|
3303
|
+
)), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field Layer__chart-of-accounts-new-form__field--actions" }, /* @__PURE__ */ React50.createElement("button", { onClick: save }, "Save")));
|
|
3104
3304
|
};
|
|
3105
3305
|
|
|
3106
3306
|
// src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
|
|
3107
|
-
import
|
|
3307
|
+
import React51 from "react";
|
|
3108
3308
|
var ChartOfAccountsRow = ({ account, depth = 0 }) => {
|
|
3109
|
-
const
|
|
3309
|
+
const classNames13 = [
|
|
3110
3310
|
"Layer__chart-of-accounts-row__table-cell",
|
|
3111
3311
|
depth > 0 && `Layer__chart-of-accounts-row__table-cell--depth-${depth}`
|
|
3112
3312
|
];
|
|
3113
|
-
const className =
|
|
3313
|
+
const className = classNames13.filter((id) => id).join(" ");
|
|
3114
3314
|
const amountClassName = account.balance < 0 ? "Layer__chart-of-accounts-row__table-cell--amount-negative" : "Layer__chart-of-accounts-row__table-cell--amount-positive";
|
|
3115
|
-
return /* @__PURE__ */
|
|
3315
|
+
return /* @__PURE__ */ React51.createElement(React51.Fragment, null, /* @__PURE__ */ React51.createElement(
|
|
3116
3316
|
"div",
|
|
3117
3317
|
{
|
|
3118
3318
|
className: `${className} Layer__chart-of-accounts-row__table-cell--name`
|
|
3119
3319
|
},
|
|
3120
3320
|
account.name
|
|
3121
|
-
), /* @__PURE__ */
|
|
3321
|
+
), /* @__PURE__ */ React51.createElement(
|
|
3122
3322
|
"div",
|
|
3123
3323
|
{
|
|
3124
3324
|
className: `${className} Layer__chart-of-accounts-row__table-cell--type`
|
|
3125
3325
|
},
|
|
3126
3326
|
"Assets"
|
|
3127
|
-
), /* @__PURE__ */
|
|
3327
|
+
), /* @__PURE__ */ React51.createElement(
|
|
3128
3328
|
"div",
|
|
3129
3329
|
{
|
|
3130
3330
|
className: `${className} Layer__chart-of-accounts-row__table-cell--subtype`
|
|
3131
3331
|
},
|
|
3132
3332
|
"Cash"
|
|
3133
|
-
), /* @__PURE__ */
|
|
3333
|
+
), /* @__PURE__ */ React51.createElement(
|
|
3134
3334
|
"div",
|
|
3135
3335
|
{
|
|
3136
3336
|
className: `${className} Layer__chart-of-accounts-row__table-cell--balance ${amountClassName}`
|
|
3137
3337
|
},
|
|
3138
3338
|
centsToDollars(Math.abs(account.balance || 0))
|
|
3139
|
-
), /* @__PURE__ */
|
|
3339
|
+
), /* @__PURE__ */ React51.createElement(
|
|
3140
3340
|
"div",
|
|
3141
3341
|
{
|
|
3142
3342
|
className: `${className} Layer__chart-of-accounts-row__table-cell--actions`
|
|
3143
3343
|
},
|
|
3144
|
-
/* @__PURE__ */
|
|
3145
|
-
), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */
|
|
3344
|
+
/* @__PURE__ */ React51.createElement("button", { className: "Layer__chart-of-accounts-row__view-entries-button" }, "View Entries")
|
|
3345
|
+
), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */ React51.createElement(
|
|
3146
3346
|
ChartOfAccountsRow,
|
|
3147
3347
|
{
|
|
3148
3348
|
key: subAccount.id,
|
|
@@ -3156,14 +3356,14 @@ var ChartOfAccountsRow = ({ account, depth = 0 }) => {
|
|
|
3156
3356
|
var ChartOfAccounts = () => {
|
|
3157
3357
|
const { data, isLoading } = useChartOfAccounts();
|
|
3158
3358
|
const [showingForm, setShowingForm] = useState14(false);
|
|
3159
|
-
return /* @__PURE__ */
|
|
3359
|
+
return /* @__PURE__ */ React52.createElement("div", { className: "Layer__component Layer__chart-of-accounts" }, !data || isLoading ? "Loading." : /* @__PURE__ */ React52.createElement(React52.Fragment, null, /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__header" }, /* @__PURE__ */ React52.createElement("h2", { className: "Layer__chart-of-accounts__title" }, "Chart of Accounts"), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__actions" }, /* @__PURE__ */ React52.createElement("button", { className: "Layer__chart-of-accounts__download-button" }, /* @__PURE__ */ React52.createElement(DownloadCloud_default, null), "Download"), /* @__PURE__ */ React52.createElement(
|
|
3160
3360
|
"button",
|
|
3161
3361
|
{
|
|
3162
3362
|
className: "Layer__chart-of-accounts__edit-accounts-button",
|
|
3163
3363
|
onClick: () => setShowingForm(!showingForm)
|
|
3164
3364
|
},
|
|
3165
3365
|
"Edit Accounts"
|
|
3166
|
-
))), showingForm && /* @__PURE__ */
|
|
3366
|
+
))), showingForm && /* @__PURE__ */ React52.createElement(ChartOfAccountsNewForm, null), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Name"), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Type"), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Sub-Type"), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header Layer__chart-of-accounts__table-cell--header-balance" }, "Balance"), /* @__PURE__ */ React52.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }), data.accounts.map((account) => /* @__PURE__ */ React52.createElement(
|
|
3167
3367
|
ChartOfAccountsRow,
|
|
3168
3368
|
{
|
|
3169
3369
|
key: account.id,
|