@layerfi/components 0.1.1 → 0.1.3

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 CHANGED
@@ -9,7 +9,6 @@ var authenticate = ({
9
9
  appId,
10
10
  appSecret,
11
11
  authenticationUrl = "https://auth.layerfi.com/oauth2/token",
12
- clientId,
13
12
  scope
14
13
  }) => () => fetch(authenticationUrl, {
15
14
  method: "POST",
@@ -20,7 +19,7 @@ var authenticate = ({
20
19
  body: formStringFromObject({
21
20
  grant_type: "client_credentials",
22
21
  scope,
23
- client_id: clientId
22
+ client_id: appId
24
23
  })
25
24
  }).then((res) => res.json());
26
25
 
@@ -558,7 +557,7 @@ var BalanceSheet = () => {
558
557
  };
559
558
 
560
559
  // src/components/BankTransactions/BankTransactions.tsx
561
- import React36, { useState as useState9 } from "react";
560
+ import React38, { useState as useState9 } from "react";
562
561
 
563
562
  // src/hooks/useBankTransactions/useBankTransactions.tsx
564
563
  import useSWR2 from "swr";
@@ -567,6 +566,7 @@ var useBankTransactions = () => {
567
566
  const {
568
567
  data: responseData,
569
568
  isLoading,
569
+ isValidating,
570
570
  error: responseError,
571
571
  mutate
572
572
  } = useSWR2(
@@ -576,12 +576,12 @@ var useBankTransactions = () => {
576
576
  })
577
577
  );
578
578
  const {
579
- data = [],
579
+ data = void 0,
580
580
  meta: metadata = {},
581
581
  error = void 0
582
582
  } = responseData || {};
583
583
  const categorize = (id, newCategory) => {
584
- const foundBT = data.find((x) => x.business_id === businessId && x.id === id);
584
+ const foundBT = data?.find((x) => x.business_id === businessId && x.id === id);
585
585
  if (foundBT) {
586
586
  updateOneLocal({ ...foundBT, processing: true, error: void 0 });
587
587
  }
@@ -598,7 +598,7 @@ var useBankTransactions = () => {
598
598
  throw errors;
599
599
  }
600
600
  }).catch((err) => {
601
- const newBT = data.find(
601
+ const newBT = data?.find(
602
602
  (x) => x.business_id === businessId && x.id === id
603
603
  );
604
604
  if (newBT) {
@@ -611,15 +611,20 @@ var useBankTransactions = () => {
611
611
  });
612
612
  };
613
613
  const updateOneLocal = (newBankTransaction) => {
614
- const updatedData = data.map(
614
+ const updatedData = data?.map(
615
615
  (bt) => bt.id === newBankTransaction.id ? newBankTransaction : bt
616
616
  );
617
617
  mutate({ data: updatedData }, { revalidate: false });
618
618
  };
619
+ const refetch = () => {
620
+ mutate();
621
+ };
619
622
  return {
620
623
  data,
621
624
  metadata,
622
625
  isLoading,
626
+ isValidating,
627
+ refetch,
623
628
  error: responseError || error,
624
629
  categorize,
625
630
  updateOneLocal
@@ -650,10 +655,10 @@ var useElementSize = (callback) => {
650
655
  };
651
656
 
652
657
  // src/components/BankTransactionListItem/BankTransactionListItem.tsx
653
- import React31, { useRef as useRef6, useState as useState7 } from "react";
658
+ import React31, { useRef as useRef7, useState as useState7 } from "react";
654
659
 
655
660
  // src/components/Button/Button.tsx
656
- import React8 from "react";
661
+ import React8, { useRef as useRef3 } from "react";
657
662
  import classNames from "classnames";
658
663
  var Button = ({
659
664
  className,
@@ -664,6 +669,7 @@ var Button = ({
664
669
  iconOnly,
665
670
  ...props
666
671
  }) => {
672
+ const buttonRef = useRef3(null);
667
673
  let justify = "center";
668
674
  if (leftIcon && rightIcon) {
669
675
  justify = "space-between";
@@ -678,7 +684,23 @@ var Button = ({
678
684
  iconOnly ? "Layer__btn--icon-only" : "",
679
685
  className
680
686
  );
681
- return /* @__PURE__ */ React8.createElement("button", { ...props, className: baseClassName }, /* @__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)));
687
+ const startAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
688
+ (el) => el.beginElement()
689
+ );
690
+ const stopAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
691
+ (el) => el.endElement()
692
+ );
693
+ return /* @__PURE__ */ React8.createElement(
694
+ "button",
695
+ {
696
+ ...props,
697
+ className: baseClassName,
698
+ onMouseEnter: startAnimation,
699
+ onMouseLeave: stopAnimation,
700
+ ref: buttonRef
701
+ },
702
+ /* @__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))
703
+ );
682
704
  };
683
705
 
684
706
  // src/components/Button/SubmitButton.tsx
@@ -1236,66 +1258,135 @@ var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React19.createElem
1236
1258
  );
1237
1259
  var RefreshCcw_default = RefreshCcw;
1238
1260
 
1239
- // src/icons/ScissorsFullOpen.tsx
1261
+ // src/icons/Scissors.tsx
1240
1262
  import * as React20 from "react";
1241
- var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React20.createElement(
1263
+ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React20.createElement(
1242
1264
  "svg",
1243
1265
  {
1244
- viewBox: "0 0 12 12",
1266
+ viewBox: "0 0 11 11",
1245
1267
  fill: "none",
1246
1268
  xmlns: "http://www.w3.org/2000/svg",
1247
1269
  ...props,
1248
1270
  width: size,
1249
1271
  height: size
1250
1272
  },
1251
- /* @__PURE__ */ React20.createElement("g", { id: "scissors" }, /* @__PURE__ */ React20.createElement(
1273
+ /* @__PURE__ */ React20.createElement(
1252
1274
  "path",
1253
1275
  {
1254
- id: "Vector",
1255
- 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",
1276
+ 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",
1256
1277
  stroke: "currentColor",
1257
1278
  strokeLinecap: "round",
1258
1279
  strokeLinejoin: "round"
1259
- }
1260
- ), /* @__PURE__ */ React20.createElement(
1280
+ },
1281
+ /* @__PURE__ */ React20.createElement(
1282
+ "animate",
1283
+ {
1284
+ attributeName: "d",
1285
+ className: "animateOnHover",
1286
+ 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",
1287
+ begin: "indefinite",
1288
+ dur: "400ms",
1289
+ repeatCount: "1",
1290
+ fill: "freeze",
1291
+ calcMode: "linear",
1292
+ keyTimes: "0;0.5;1"
1293
+ }
1294
+ )
1295
+ ),
1296
+ /* @__PURE__ */ React20.createElement(
1261
1297
  "path",
1262
1298
  {
1263
- id: "Vector_2",
1264
- 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",
1299
+ 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",
1265
1300
  stroke: "currentColor",
1266
1301
  strokeLinecap: "round",
1267
1302
  strokeLinejoin: "round"
1268
- }
1269
- ), /* @__PURE__ */ React20.createElement(
1303
+ },
1304
+ /* @__PURE__ */ React20.createElement(
1305
+ "animate",
1306
+ {
1307
+ attributeName: "d",
1308
+ className: "animateOnHover",
1309
+ 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",
1310
+ begin: "indefinite",
1311
+ dur: "400ms",
1312
+ repeatCount: "1",
1313
+ fill: "freeze",
1314
+ calcMode: "linear",
1315
+ keyTimes: "0;0.5;1"
1316
+ }
1317
+ )
1318
+ ),
1319
+ /* @__PURE__ */ React20.createElement(
1270
1320
  "path",
1271
1321
  {
1272
- id: "Vector_3",
1273
- d: "M10 2L4.06 7.94",
1322
+ d: "M9.16668 1.83325L3.72168 7.27825",
1274
1323
  stroke: "currentColor",
1275
1324
  strokeLinecap: "round",
1276
1325
  strokeLinejoin: "round"
1277
- }
1278
- ), /* @__PURE__ */ React20.createElement(
1326
+ },
1327
+ /* @__PURE__ */ React20.createElement(
1328
+ "animate",
1329
+ {
1330
+ attributeName: "d",
1331
+ className: "animateOnHover",
1332
+ values: "M9.16668 1.83325L3.72168 7.27825;M10.3129 3.58763L3.21706 6.57851;M9.16668 1.83325L3.72168 7.27825",
1333
+ begin: "indefinite",
1334
+ dur: "400ms",
1335
+ repeatCount: "1",
1336
+ fill: "freeze",
1337
+ calcMode: "linear",
1338
+ keyTimes: "0;0.5;1"
1339
+ }
1340
+ )
1341
+ ),
1342
+ /* @__PURE__ */ React20.createElement(
1279
1343
  "path",
1280
1344
  {
1281
- id: "Vector_4",
1282
- d: "M7.235 7.23999L10 9.99999",
1345
+ d: "M6.63232 6.63672L9.16691 9.16672",
1283
1346
  stroke: "currentColor",
1284
1347
  strokeLinecap: "round",
1285
1348
  strokeLinejoin: "round"
1286
- }
1287
- ), /* @__PURE__ */ React20.createElement(
1349
+ },
1350
+ /* @__PURE__ */ React20.createElement(
1351
+ "animate",
1352
+ {
1353
+ attributeName: "d",
1354
+ className: "animateOnHover",
1355
+ values: "M6.63232 6.63672L9.16691 9.16672;M7.06396 5.9873L10.3921 7.3096;M6.63232 6.63672L9.16691 9.16672",
1356
+ begin: "indefinite",
1357
+ dur: "400ms",
1358
+ repeatCount: "1",
1359
+ fill: "freeze",
1360
+ calcMode: "linear",
1361
+ keyTimes: "0;0.5;1"
1362
+ }
1363
+ )
1364
+ ),
1365
+ /* @__PURE__ */ React20.createElement(
1288
1366
  "path",
1289
1367
  {
1290
- id: "Vector_5",
1291
- d: "M4.06 4.06006L6 6.00006",
1368
+ d: "M3.72168 3.72168L5.50001 5.50001",
1292
1369
  stroke: "currentColor",
1293
1370
  strokeLinecap: "round",
1294
1371
  strokeLinejoin: "round"
1295
- }
1296
- ))
1372
+ },
1373
+ /* @__PURE__ */ React20.createElement(
1374
+ "animate",
1375
+ {
1376
+ attributeName: "d",
1377
+ className: "animateOnHover",
1378
+ values: "M3.72168 3.72168L5.50001 5.50001;M3.23828 4.45996L5.57467 5.39067;M3.72168 3.72168L5.50001 5.50001",
1379
+ begin: "indefinite",
1380
+ dur: "400ms",
1381
+ repeatCount: "1",
1382
+ fill: "freeze",
1383
+ calcMode: "linear",
1384
+ keyTimes: "0;0.5;1"
1385
+ }
1386
+ )
1387
+ )
1297
1388
  );
1298
- var ScissorsFullOpen_default = ScissorsFullOpen;
1389
+ var Scissors_default = Scissors;
1299
1390
 
1300
1391
  // src/components/Input/Input.tsx
1301
1392
  import React21 from "react";
@@ -1309,7 +1400,7 @@ var Input = ({ className, ...props }) => {
1309
1400
  import React24 from "react";
1310
1401
 
1311
1402
  // src/components/Typography/Text.tsx
1312
- import React22, { useRef as useRef3, useState as useState4, useEffect } from "react";
1403
+ import React22, { useRef as useRef4, useState as useState4, useEffect } from "react";
1313
1404
  import classNames4 from "classnames";
1314
1405
  var Text = ({
1315
1406
  as: Component = "p",
@@ -1350,7 +1441,7 @@ var TextWithTooltip = ({
1350
1441
  tooltipOptions,
1351
1442
  ...props
1352
1443
  }) => {
1353
- const textElementRef = useRef3();
1444
+ const textElementRef = useRef4();
1354
1445
  const compareSize = () => {
1355
1446
  if (textElementRef.current) {
1356
1447
  const compare = textElementRef.current.children[0].scrollWidth > textElementRef.current.children[0].clientWidth;
@@ -1422,7 +1513,7 @@ var InputGroup = ({
1422
1513
  };
1423
1514
 
1424
1515
  // src/components/Input/FileInput.tsx
1425
- import React26, { useRef as useRef4 } from "react";
1516
+ import React26, { useRef as useRef5 } from "react";
1426
1517
 
1427
1518
  // src/icons/UploadCloud.tsx
1428
1519
  import * as React25 from "react";
@@ -1477,7 +1568,7 @@ var UploadCloud_default = UploadCloud;
1477
1568
 
1478
1569
  // src/components/Input/FileInput.tsx
1479
1570
  var FileInput = ({ text = "Upload", onUpload }) => {
1480
- const hiddenFileInput = useRef4(null);
1571
+ const hiddenFileInput = useRef5(null);
1481
1572
  const onClick = () => {
1482
1573
  if (hiddenFileInput.current) {
1483
1574
  hiddenFileInput.current.click();
@@ -1634,7 +1725,7 @@ var ExpandedBankTransactionRow = forwardRef2(
1634
1725
  bankTransaction,
1635
1726
  isOpen = false,
1636
1727
  asListItem = false,
1637
- showSubmitButton = false
1728
+ submitBtnText = "Save"
1638
1729
  }, ref) => {
1639
1730
  const { categorize: categorizeBankTransaction2 } = useBankTransactions();
1640
1731
  const [purpose, setPurpose] = useState6("categorize" /* categorize */);
@@ -1773,7 +1864,7 @@ var ExpandedBankTransactionRow = forwardRef2(
1773
1864
  Button,
1774
1865
  {
1775
1866
  onClick: addSplit,
1776
- leftIcon: /* @__PURE__ */ React29.createElement(ScissorsFullOpen_default, { size: 14 }),
1867
+ leftIcon: /* @__PURE__ */ React29.createElement(Scissors_default, { size: 14 }),
1777
1868
  variant: "secondary" /* secondary */
1778
1869
  },
1779
1870
  "Split"
@@ -1796,7 +1887,7 @@ var ExpandedBankTransactionRow = forwardRef2(
1796
1887
  /* @__PURE__ */ React29.createElement(Textarea, { name: "description", placeholder: "Enter description" })
1797
1888
  ),
1798
1889
  /* @__PURE__ */ React29.createElement("div", { className: `${className}__file-upload` }, /* @__PURE__ */ React29.createElement(FileInput, { text: "Upload receipt" })),
1799
- asListItem || showSubmitButton ? /* @__PURE__ */ React29.createElement("div", { className: `${className}__submit-btn` }, /* @__PURE__ */ React29.createElement(
1890
+ asListItem ? /* @__PURE__ */ React29.createElement("div", { className: `${className}__submit-btn` }, /* @__PURE__ */ React29.createElement(
1800
1891
  SubmitButton,
1801
1892
  {
1802
1893
  onClick: () => {
@@ -1809,7 +1900,7 @@ var ExpandedBankTransactionRow = forwardRef2(
1809
1900
  error: bankTransaction.error,
1810
1901
  active: true
1811
1902
  },
1812
- "Approve"
1903
+ submitBtnText
1813
1904
  )) : null
1814
1905
  ))
1815
1906
  );
@@ -1831,7 +1922,7 @@ var BankTransactionListItem = ({
1831
1922
  toggleOpen,
1832
1923
  editable
1833
1924
  }) => {
1834
- const expandedRowRef = useRef6(null);
1925
+ const expandedRowRef = useRef7(null);
1835
1926
  const [removed, setRemoved] = useState7(false);
1836
1927
  const { categorize: categorizeBankTransaction2 } = useBankTransactions();
1837
1928
  const [selectedCategory, setSelectedCategory] = useState7(
@@ -1887,7 +1978,8 @@ var BankTransactionListItem = ({
1887
1978
  bankTransaction,
1888
1979
  close: () => toggleOpen(bankTransaction.id),
1889
1980
  isOpen,
1890
- asListItem: true
1981
+ asListItem: true,
1982
+ submitBtnText: editable ? "Approve" : "Save"
1891
1983
  }
1892
1984
  )), /* @__PURE__ */ React31.createElement("span", { className: `${className}__base-row` }, editable ? /* @__PURE__ */ React31.createElement(
1893
1985
  CategoryMenu,
@@ -1915,7 +2007,7 @@ var BankTransactionListItem = ({
1915
2007
  };
1916
2008
 
1917
2009
  // src/components/BankTransactionRow/BankTransactionRow.tsx
1918
- import React32, { useRef as useRef7, useState as useState8 } from "react";
2010
+ import React32, { useRef as useRef8, useState as useState8 } from "react";
1919
2011
  import classNames10 from "classnames";
1920
2012
  import { parseISO as parseISO3, format as formatTime2 } from "date-fns";
1921
2013
  var isCredit2 = ({ direction }) => direction === "CREDIT" /* CREDIT */;
@@ -1926,7 +2018,7 @@ var BankTransactionRow = ({
1926
2018
  toggleOpen,
1927
2019
  editable
1928
2020
  }) => {
1929
- const expandedRowRef = useRef7(null);
2021
+ const expandedRowRef = useRef8(null);
1930
2022
  const [removed, setRemoved] = useState8(false);
1931
2023
  const { categorize: categorizeBankTransaction2 } = useBankTransactions();
1932
2024
  const [selectedCategory, setSelectedCategory] = useState8(
@@ -2020,8 +2112,8 @@ var BankTransactionRow = ({
2020
2112
  disabled: bankTransaction.processing
2021
2113
  }
2022
2114
  ) : null,
2023
- !editable ? /* @__PURE__ */ React32.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction?.category?.display_name) : null,
2024
- editable && /* @__PURE__ */ React32.createElement(
2115
+ !editable && !isOpen ? /* @__PURE__ */ React32.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction?.category?.display_name) : null,
2116
+ editable || isOpen ? /* @__PURE__ */ React32.createElement(
2025
2117
  SubmitButton,
2026
2118
  {
2027
2119
  onClick: () => {
@@ -2034,8 +2126,8 @@ var BankTransactionRow = ({
2034
2126
  error: bankTransaction.error,
2035
2127
  active: isOpen
2036
2128
  },
2037
- "Approve"
2038
- ),
2129
+ editable ? "Approve" : "Save"
2130
+ ) : null,
2039
2131
  /* @__PURE__ */ React32.createElement(
2040
2132
  "div",
2041
2133
  {
@@ -2057,8 +2149,7 @@ var BankTransactionRow = ({
2057
2149
  ref: expandedRowRef,
2058
2150
  bankTransaction,
2059
2151
  close: () => toggleOpen(bankTransaction.id),
2060
- isOpen,
2061
- showSubmitButton: !editable
2152
+ isOpen
2062
2153
  }
2063
2154
  ))));
2064
2155
  };
@@ -2085,7 +2176,6 @@ var parseColorFromTheme = (colorName, color) => {
2085
2176
  }
2086
2177
  try {
2087
2178
  if ("h" in color && "s" in color && "l" in color) {
2088
- console.log("its hsl", color);
2089
2179
  return {
2090
2180
  [`--color-${colorName}-h`]: color.h,
2091
2181
  [`--color-${colorName}-s`]: color.s,
@@ -2094,7 +2184,6 @@ var parseColorFromTheme = (colorName, color) => {
2094
2184
  }
2095
2185
  if ("r" in color && "g" in color && "b" in color) {
2096
2186
  const { h, s, l } = rgbToHsl(color);
2097
- console.log("its rgb", h, s, l);
2098
2187
  return {
2099
2188
  [`--color-${colorName}-h`]: h,
2100
2189
  [`--color-${colorName}-s`]: `${s}%`,
@@ -2102,7 +2191,6 @@ var parseColorFromTheme = (colorName, color) => {
2102
2191
  };
2103
2192
  }
2104
2193
  if ("hex" in color) {
2105
- console.log("its hex");
2106
2194
  const rgb = hexToRgb(color.hex);
2107
2195
  if (!rgb) {
2108
2196
  return {};
@@ -2112,7 +2200,6 @@ var parseColorFromTheme = (colorName, color) => {
2112
2200
  g: rgb.g.toString(),
2113
2201
  b: rgb.b.toString()
2114
2202
  });
2115
- console.log("its hex", h, s, l);
2116
2203
  return {
2117
2204
  [`--color-${colorName}-h`]: h,
2118
2205
  [`--color-${colorName}-s`]: `${s}%`,
@@ -2156,34 +2243,120 @@ var hexToRgb = (hex) => {
2156
2243
  };
2157
2244
 
2158
2245
  // src/components/Container/Container.tsx
2159
- var Container = ({ name, className, children }) => {
2160
- const baseClassName = `Layer__${name} ${className ?? ""}`;
2246
+ import classNames11 from "classnames";
2247
+ var Container = ({
2248
+ name,
2249
+ className,
2250
+ children,
2251
+ asWidget
2252
+ }) => {
2253
+ const baseClassName = classNames11(
2254
+ "Layer__component Layer__component-container",
2255
+ `Layer__${name}`,
2256
+ asWidget ? "Layer__component--as-widget" : "",
2257
+ className
2258
+ );
2161
2259
  const { theme } = useLayerContext();
2162
2260
  const styles = parseStylesFromThemeConfig(theme);
2163
- return /* @__PURE__ */ React33.createElement(
2164
- "div",
2165
- {
2166
- className: `Layer__component Layer__component-container ${baseClassName}`,
2167
- style: { ...styles }
2168
- },
2169
- children
2170
- );
2261
+ return /* @__PURE__ */ React33.createElement("div", { className: baseClassName, style: { ...styles } }, children);
2171
2262
  };
2172
2263
 
2173
2264
  // src/components/Container/Header.tsx
2174
2265
  import React34, { forwardRef as forwardRef3 } from "react";
2175
- import classNames11 from "classnames";
2266
+ import classNames12 from "classnames";
2176
2267
  var Header = forwardRef3(
2177
2268
  ({ className, children, style }, ref) => {
2178
- const baseClassName = classNames11("Layer__component-header", className);
2269
+ const baseClassName = classNames12("Layer__component-header", className);
2179
2270
  return /* @__PURE__ */ React34.createElement("header", { ref, className: baseClassName, style }, children);
2180
2271
  }
2181
2272
  );
2182
2273
 
2274
+ // src/components/DataState/DataState.tsx
2275
+ import React36 from "react";
2276
+
2277
+ // src/icons/AlertOctagon.tsx
2278
+ import * as React35 from "react";
2279
+ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React35.createElement(
2280
+ "svg",
2281
+ {
2282
+ viewBox: "0 0 18 18",
2283
+ fill: "none",
2284
+ xmlns: "http://www.w3.org/2000/svg",
2285
+ ...props,
2286
+ width: size,
2287
+ height: size
2288
+ },
2289
+ /* @__PURE__ */ React35.createElement(
2290
+ "path",
2291
+ {
2292
+ d: "M5.895 1.5H12.105L16.5 5.895V12.105L12.105 16.5H5.895L1.5 12.105V5.895L5.895 1.5Z",
2293
+ stroke: "currentColor",
2294
+ strokeLinecap: "round",
2295
+ strokeLinejoin: "round"
2296
+ }
2297
+ ),
2298
+ /* @__PURE__ */ React35.createElement(
2299
+ "path",
2300
+ {
2301
+ d: "M9 6V9",
2302
+ stroke: "currentColor",
2303
+ strokeLinecap: "round",
2304
+ strokeLinejoin: "round"
2305
+ }
2306
+ ),
2307
+ /* @__PURE__ */ React35.createElement(
2308
+ "path",
2309
+ {
2310
+ d: "M9 12H9.0075",
2311
+ stroke: "currentColor",
2312
+ strokeLinecap: "round",
2313
+ strokeLinejoin: "round"
2314
+ }
2315
+ )
2316
+ );
2317
+ var AlertOctagon_default = AlertOctagon;
2318
+
2319
+ // src/components/DataState/DataState.tsx
2320
+ var getIcon = (status) => {
2321
+ switch (status) {
2322
+ case "failed" /* failed */:
2323
+ return /* @__PURE__ */ React36.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--error" }, /* @__PURE__ */ React36.createElement(AlertOctagon_default, { size: 12 }));
2324
+ default:
2325
+ return /* @__PURE__ */ React36.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ React36.createElement(CheckCircle_default, { size: 12 }));
2326
+ }
2327
+ };
2328
+ var DataState = ({
2329
+ status,
2330
+ title,
2331
+ description,
2332
+ onRefresh,
2333
+ isLoading
2334
+ }) => {
2335
+ return /* @__PURE__ */ React36.createElement("div", { className: "Layer__data-state" }, getIcon(status), /* @__PURE__ */ React36.createElement(
2336
+ Text,
2337
+ {
2338
+ as: "span",
2339
+ size: "lg" /* lg */,
2340
+ weight: "bold" /* bold */,
2341
+ className: "Layer__data-state__title"
2342
+ },
2343
+ title
2344
+ ), /* @__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(
2345
+ Button,
2346
+ {
2347
+ variant: "secondary" /* secondary */,
2348
+ rightIcon: isLoading ? /* @__PURE__ */ React36.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" }) : /* @__PURE__ */ React36.createElement(RefreshCcw_default, { size: 12 }),
2349
+ onClick: onRefresh,
2350
+ disabled: isLoading
2351
+ },
2352
+ "Refresh"
2353
+ )));
2354
+ };
2355
+
2183
2356
  // src/components/Loader/Loader.tsx
2184
- import React35 from "react";
2357
+ import React37 from "react";
2185
2358
  var Loader2 = ({ children }) => {
2186
- return /* @__PURE__ */ React35.createElement("span", { className: "Layer__loader" }, /* @__PURE__ */ React35.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" }), children ?? "Loading...");
2359
+ return /* @__PURE__ */ React37.createElement("span", { className: "Layer__loader" }, /* @__PURE__ */ React37.createElement(Loader_default, { size: 28, className: "Layer__anim--rotating" }), children);
2187
2360
  };
2188
2361
 
2189
2362
  // src/components/BankTransactions/BankTransactions.tsx
@@ -2205,10 +2378,12 @@ var filterVisibility = (display) => (bankTransaction) => {
2205
2378
  const inReview = ReviewCategories.includes(bankTransaction.categorization_status) || bankTransaction.recently_categorized;
2206
2379
  return display === "review" /* review */ && inReview || display === "categorized" /* categorized */ && categorized;
2207
2380
  };
2208
- var BankTransactions = () => {
2381
+ var BankTransactions = ({
2382
+ asWidget = false
2383
+ }) => {
2209
2384
  const [display, setDisplay] = useState9("review" /* review */);
2210
- const { data, isLoading } = useBankTransactions();
2211
- const bankTransactions = data.filter(filterVisibility(display));
2385
+ const { data, isLoading, error, isValidating, refetch } = useBankTransactions();
2386
+ const bankTransactions = data?.filter(filterVisibility(display));
2212
2387
  const onCategorizationDisplayChange = (event) => setDisplay(
2213
2388
  event.target.value === "categorized" /* categorized */ ? "categorized" /* categorized */ : "review" /* review */
2214
2389
  );
@@ -2226,15 +2401,15 @@ var BankTransactions = () => {
2226
2401
  }
2227
2402
  });
2228
2403
  const editable = display === "review" /* review */;
2229
- return /* @__PURE__ */ React36.createElement(Container, { name: COMPONENT_NAME }, /* @__PURE__ */ React36.createElement(
2404
+ return /* @__PURE__ */ React38.createElement(Container, { name: COMPONENT_NAME, asWidget }, /* @__PURE__ */ React38.createElement(
2230
2405
  Header,
2231
2406
  {
2232
2407
  ref: headerRef,
2233
2408
  className: "Layer__bank-transactions__header",
2234
2409
  style: { top: shiftStickyHeader }
2235
2410
  },
2236
- /* @__PURE__ */ React36.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
2237
- /* @__PURE__ */ React36.createElement(
2411
+ /* @__PURE__ */ React38.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
2412
+ /* @__PURE__ */ React38.createElement(
2238
2413
  Toggle,
2239
2414
  {
2240
2415
  name: "bank-transaction-display",
@@ -2246,14 +2421,14 @@ var BankTransactions = () => {
2246
2421
  onChange: onCategorizationDisplayChange
2247
2422
  }
2248
2423
  )
2249
- ), /* @__PURE__ */ React36.createElement(
2424
+ ), /* @__PURE__ */ React38.createElement(
2250
2425
  "table",
2251
2426
  {
2252
2427
  width: "100%",
2253
2428
  className: "Layer__table Layer__bank-transactions__table"
2254
2429
  },
2255
- /* @__PURE__ */ React36.createElement("thead", null, /* @__PURE__ */ React36.createElement("tr", null, /* @__PURE__ */ React36.createElement("th", { className: "Layer__table-header Layer__bank-transactions__date-col" }, "Date"), /* @__PURE__ */ React36.createElement("th", { className: "Layer__table-header Layer__bank-transactions__tx-col" }, "Transaction"), /* @__PURE__ */ React36.createElement("th", { className: "Layer__table-header Layer__bank-transactions__account-col" }, "Account"), /* @__PURE__ */ React36.createElement("th", { className: "Layer__table-header Layer__table-cell--amount Layer__table-cell__amount-col" }, "Amount"), editable ? /* @__PURE__ */ React36.createElement("th", { className: "Layer__table-header Layer__table-header--primary Layer__table-cell__category-col" }, "Categorize") : /* @__PURE__ */ React36.createElement("th", { className: "Layer__table-header Layer__table-cell__category-col" }, "Category"))),
2256
- /* @__PURE__ */ React36.createElement("tbody", null, !isLoading && bankTransactions.map((bankTransaction) => /* @__PURE__ */ React36.createElement(
2430
+ /* @__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"))),
2431
+ /* @__PURE__ */ React38.createElement("tbody", null, !isLoading && bankTransactions?.map((bankTransaction) => /* @__PURE__ */ React38.createElement(
2257
2432
  BankTransactionRow,
2258
2433
  {
2259
2434
  key: bankTransaction.id,
@@ -2264,7 +2439,7 @@ var BankTransactions = () => {
2264
2439
  editable
2265
2440
  }
2266
2441
  )))
2267
- ), isLoading || !bankTransactions || bankTransactions?.length === 0 ? /* @__PURE__ */ React36.createElement(Loader2, null) : null, !isLoading && /* @__PURE__ */ React36.createElement("ul", { className: "Layer__bank-transactions__list" }, bankTransactions.map((bankTransaction) => /* @__PURE__ */ React36.createElement(
2442
+ ), 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(
2268
2443
  BankTransactionListItem,
2269
2444
  {
2270
2445
  key: bankTransaction.id,
@@ -2274,11 +2449,29 @@ var BankTransactions = () => {
2274
2449
  toggleOpen,
2275
2450
  editable
2276
2451
  }
2277
- ))));
2452
+ ))), !isLoading && !error && (bankTransactions === void 0 || bankTransactions !== void 0 && bankTransactions.length === 0) ? /* @__PURE__ */ React38.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React38.createElement(
2453
+ DataState,
2454
+ {
2455
+ status: "allDone" /* allDone */,
2456
+ title: "You are up to date with transactions!",
2457
+ description: "All uncategorized transaction will be displayed here",
2458
+ onRefresh: () => refetch(),
2459
+ isLoading: isValidating
2460
+ }
2461
+ )) : null, !isLoading && error ? /* @__PURE__ */ React38.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React38.createElement(
2462
+ DataState,
2463
+ {
2464
+ status: "failed" /* failed */,
2465
+ title: "Something went wrong",
2466
+ description: "We couldn\u2019t load your data.",
2467
+ onRefresh: () => refetch(),
2468
+ isLoading: isValidating
2469
+ }
2470
+ )) : null);
2278
2471
  };
2279
2472
 
2280
2473
  // src/components/Hello/Hello.tsx
2281
- import React37 from "react";
2474
+ import React39 from "react";
2282
2475
  import useSWR3 from "swr";
2283
2476
  var fetcher = (url) => fetch(url).then((res) => res.json());
2284
2477
  var Hello = ({ user }) => {
@@ -2287,11 +2480,11 @@ var Hello = ({ user }) => {
2287
2480
  fetcher
2288
2481
  );
2289
2482
  const name = (isLoading ? "..." : data?.name) || "User";
2290
- return /* @__PURE__ */ React37.createElement(React37.Fragment, null, /* @__PURE__ */ React37.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
2483
+ return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
2291
2484
  };
2292
2485
 
2293
2486
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
2294
- import React46, { createContext as createContext2 } from "react";
2487
+ import React48, { createContext as createContext2 } from "react";
2295
2488
 
2296
2489
  // src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
2297
2490
  import { useState as useState10 } from "react";
@@ -2340,10 +2533,10 @@ var useProfitAndLoss = ({ startDate: initialStartDate, endDate: initialEndDate }
2340
2533
  };
2341
2534
 
2342
2535
  // src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
2343
- import React39, { useContext as useContext2, useMemo, useState as useState11 } from "react";
2536
+ import React41, { useContext as useContext2, useMemo, useState as useState11 } from "react";
2344
2537
 
2345
2538
  // src/components/ProfitAndLossChart/Indicator.tsx
2346
- import React38, { useEffect as useEffect3 } from "react";
2539
+ import React40, { useEffect as useEffect3 } from "react";
2347
2540
  var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
2348
2541
  var Indicator = ({
2349
2542
  viewBox = {},
@@ -2367,7 +2560,7 @@ var Indicator = ({
2367
2560
  setAnimateFrom(animateTo);
2368
2561
  }, [animateTo]);
2369
2562
  const actualX = animateFrom === -1 ? animateTo : animateFrom;
2370
- return /* @__PURE__ */ React38.createElement(
2563
+ return /* @__PURE__ */ React40.createElement(
2371
2564
  "rect",
2372
2565
  {
2373
2566
  className: "Layer__profit-and-loss-chart__selection-indicator",
@@ -2499,7 +2692,7 @@ var ProfitAndLossChart = () => {
2499
2692
  ]
2500
2693
  );
2501
2694
  const [animateFrom, setAnimateFrom] = useState11(-1);
2502
- return /* @__PURE__ */ React39.createElement(ResponsiveContainer, { width: "100%", height: 250 }, /* @__PURE__ */ React39.createElement(
2695
+ return /* @__PURE__ */ React41.createElement(ResponsiveContainer, { width: "100%", height: 250 }, /* @__PURE__ */ React41.createElement(
2503
2696
  BarChart,
2504
2697
  {
2505
2698
  margin: { left: 24, right: 24, bottom: 24 },
@@ -2508,8 +2701,8 @@ var ProfitAndLossChart = () => {
2508
2701
  barGap,
2509
2702
  className: "Layer__profit-and-loss-chart"
2510
2703
  },
2511
- /* @__PURE__ */ React39.createElement(CartesianGrid, { vertical: false }),
2512
- /* @__PURE__ */ React39.createElement(
2704
+ /* @__PURE__ */ React41.createElement(CartesianGrid, { vertical: false }),
2705
+ /* @__PURE__ */ React41.createElement(
2513
2706
  Legend,
2514
2707
  {
2515
2708
  verticalAlign: "top",
@@ -2520,8 +2713,8 @@ var ProfitAndLossChart = () => {
2520
2713
  ]
2521
2714
  }
2522
2715
  ),
2523
- /* @__PURE__ */ React39.createElement(XAxis, { dataKey: "name", tickLine: false }),
2524
- /* @__PURE__ */ React39.createElement(
2716
+ /* @__PURE__ */ React41.createElement(XAxis, { dataKey: "name", tickLine: false }),
2717
+ /* @__PURE__ */ React41.createElement(
2525
2718
  Bar,
2526
2719
  {
2527
2720
  dataKey: "revenue",
@@ -2530,10 +2723,10 @@ var ProfitAndLossChart = () => {
2530
2723
  radius: [barSize / 4, barSize / 4, 0, 0],
2531
2724
  className: "Layer__profit-and-loss-chart__bar--income"
2532
2725
  },
2533
- /* @__PURE__ */ React39.createElement(
2726
+ /* @__PURE__ */ React41.createElement(
2534
2727
  LabelList,
2535
2728
  {
2536
- content: /* @__PURE__ */ React39.createElement(
2729
+ content: /* @__PURE__ */ React41.createElement(
2537
2730
  Indicator,
2538
2731
  {
2539
2732
  animateFrom,
@@ -2542,7 +2735,7 @@ var ProfitAndLossChart = () => {
2542
2735
  )
2543
2736
  }
2544
2737
  ),
2545
- data.map((entry) => /* @__PURE__ */ React39.createElement(
2738
+ data.map((entry) => /* @__PURE__ */ React41.createElement(
2546
2739
  Cell,
2547
2740
  {
2548
2741
  key: entry.name,
@@ -2550,7 +2743,7 @@ var ProfitAndLossChart = () => {
2550
2743
  }
2551
2744
  ))
2552
2745
  ),
2553
- /* @__PURE__ */ React39.createElement(
2746
+ /* @__PURE__ */ React41.createElement(
2554
2747
  Bar,
2555
2748
  {
2556
2749
  dataKey: "expenses",
@@ -2559,7 +2752,7 @@ var ProfitAndLossChart = () => {
2559
2752
  radius: [barSize / 4, barSize / 4, 0, 0],
2560
2753
  className: "Layer__profit-and-loss-chart__bar--expenses"
2561
2754
  },
2562
- data.map((entry) => /* @__PURE__ */ React39.createElement(
2755
+ data.map((entry) => /* @__PURE__ */ React41.createElement(
2563
2756
  Cell,
2564
2757
  {
2565
2758
  key: entry.name,
@@ -2571,15 +2764,15 @@ var ProfitAndLossChart = () => {
2571
2764
  };
2572
2765
 
2573
2766
  // src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
2574
- import React42, { useContext as useContext3 } from "react";
2767
+ import React44, { useContext as useContext3 } from "react";
2575
2768
 
2576
2769
  // src/icons/ChevronLeft.tsx
2577
- import * as React40 from "react";
2770
+ import * as React42 from "react";
2578
2771
  var ChevronLeft = ({
2579
2772
  strokeColor,
2580
2773
  size,
2581
2774
  ...props
2582
- }) => /* @__PURE__ */ React40.createElement(
2775
+ }) => /* @__PURE__ */ React42.createElement(
2583
2776
  "svg",
2584
2777
  {
2585
2778
  xmlns: "http://www.w3.org/2000/svg",
@@ -2589,7 +2782,7 @@ var ChevronLeft = ({
2589
2782
  viewBox: "0 0 24 24",
2590
2783
  ...props
2591
2784
  },
2592
- /* @__PURE__ */ React40.createElement(
2785
+ /* @__PURE__ */ React42.createElement(
2593
2786
  "path",
2594
2787
  {
2595
2788
  stroke: strokeColor ?? "#000",
@@ -2603,8 +2796,8 @@ var ChevronLeft = ({
2603
2796
  var ChevronLeft_default = ChevronLeft;
2604
2797
 
2605
2798
  // src/icons/ChevronRight.tsx
2606
- import * as React41 from "react";
2607
- var ChavronRight = ({ size, ...props }) => /* @__PURE__ */ React41.createElement(
2799
+ import * as React43 from "react";
2800
+ var ChavronRight = ({ size, ...props }) => /* @__PURE__ */ React43.createElement(
2608
2801
  "svg",
2609
2802
  {
2610
2803
  xmlns: "http://www.w3.org/2000/svg",
@@ -2614,7 +2807,7 @@ var ChavronRight = ({ size, ...props }) => /* @__PURE__ */ React41.createElement
2614
2807
  viewBox: "0 0 24 24",
2615
2808
  ...props
2616
2809
  },
2617
- /* @__PURE__ */ React41.createElement(
2810
+ /* @__PURE__ */ React43.createElement(
2618
2811
  "path",
2619
2812
  {
2620
2813
  stroke: "#000",
@@ -2642,28 +2835,28 @@ var ProfitAndLossDatePicker = () => {
2642
2835
  };
2643
2836
  const previousMonth = () => change({ months: -1 });
2644
2837
  const nextMonth = () => change({ months: 1 });
2645
- return /* @__PURE__ */ React42.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ React42.createElement(
2838
+ return /* @__PURE__ */ React44.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ React44.createElement(
2646
2839
  "button",
2647
2840
  {
2648
2841
  "aria-label": "View Previous Month",
2649
2842
  className: "Layer__profit-and-loss-date-picker__button",
2650
2843
  onClick: previousMonth
2651
2844
  },
2652
- /* @__PURE__ */ React42.createElement(
2845
+ /* @__PURE__ */ React44.createElement(
2653
2846
  ChevronLeft_default,
2654
2847
  {
2655
2848
  className: "Layer__profit-and-loss-date-picker__button-icon",
2656
2849
  size: 18
2657
2850
  }
2658
2851
  )
2659
- ), /* @__PURE__ */ React42.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, label), /* @__PURE__ */ React42.createElement(
2852
+ ), /* @__PURE__ */ React44.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, label), /* @__PURE__ */ React44.createElement(
2660
2853
  "button",
2661
2854
  {
2662
2855
  "aria-label": "View Next Month",
2663
2856
  className: "Layer__profit-and-loss-date-picker__button",
2664
2857
  onClick: nextMonth
2665
2858
  },
2666
- /* @__PURE__ */ React42.createElement(
2859
+ /* @__PURE__ */ React44.createElement(
2667
2860
  ChevronRight_default,
2668
2861
  {
2669
2862
  className: "Layer__profit-and-loss-date-picker__button-icon",
@@ -2674,26 +2867,26 @@ var ProfitAndLossDatePicker = () => {
2674
2867
  };
2675
2868
 
2676
2869
  // src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
2677
- import React43, { useContext as useContext4 } from "react";
2870
+ import React45, { useContext as useContext4 } from "react";
2678
2871
  var ProfitAndLossSummaries = () => {
2679
2872
  const { data: storedData } = useContext4(ProfitAndLoss.Context);
2680
2873
  const data = storedData ? storedData : { income: { value: NaN }, net_profit: NaN };
2681
2874
  const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
2682
2875
  const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
2683
2876
  const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
2684
- return /* @__PURE__ */ React43.createElement("div", { className: "Layer__profit-and-loss-summaries" }, /* @__PURE__ */ React43.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--income" }, /* @__PURE__ */ React43.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Revenue"), /* @__PURE__ */ React43.createElement(
2877
+ 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(
2685
2878
  "span",
2686
2879
  {
2687
2880
  className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
2688
2881
  },
2689
2882
  centsToDollars(Math.abs(data?.income?.value ?? NaN))
2690
- )), /* @__PURE__ */ React43.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--expenses" }, /* @__PURE__ */ React43.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"), /* @__PURE__ */ React43.createElement(
2883
+ )), /* @__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(
2691
2884
  "span",
2692
2885
  {
2693
2886
  className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
2694
2887
  },
2695
2888
  centsToDollars(Math.abs((data.income.value ?? 0) - data.net_profit))
2696
- )), /* @__PURE__ */ React43.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--net-profit" }, /* @__PURE__ */ React43.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), /* @__PURE__ */ React43.createElement(
2889
+ )), /* @__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(
2697
2890
  "span",
2698
2891
  {
2699
2892
  className: `Layer__profit-and-loss-summaries__amount ${netProfitDirectionClass}`
@@ -2703,10 +2896,10 @@ var ProfitAndLossSummaries = () => {
2703
2896
  };
2704
2897
 
2705
2898
  // src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
2706
- import React45, { useContext as useContext5 } from "react";
2899
+ import React47, { useContext as useContext5 } from "react";
2707
2900
 
2708
2901
  // src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
2709
- import React44, { useState as useState12 } from "react";
2902
+ import React46, { useState as useState12 } from "react";
2710
2903
  var ProfitAndLossRow = ({
2711
2904
  variant,
2712
2905
  lineItem,
@@ -2750,12 +2943,12 @@ var ProfitAndLossRow = ({
2750
2943
  );
2751
2944
  displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
2752
2945
  displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
2753
- return /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement("div", { className: labelClasses.join(" "), onClick: toggleExpanded }, /* @__PURE__ */ React44.createElement(ChevronDown_default, { size: 16 }), display_name), /* @__PURE__ */ React44.createElement("div", { className: valueClasses.join(" ") }, amountString), canGoDeeper && hasChildren && /* @__PURE__ */ React44.createElement(
2946
+ 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(
2754
2947
  "div",
2755
2948
  {
2756
2949
  className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
2757
2950
  },
2758
- /* @__PURE__ */ React44.createElement("div", { className: "Layer__balance-sheet-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ React44.createElement(
2951
+ /* @__PURE__ */ React46.createElement("div", { className: "Layer__balance-sheet-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ React46.createElement(
2759
2952
  ProfitAndLossRow,
2760
2953
  {
2761
2954
  key: line_item.display_name,
@@ -2764,7 +2957,7 @@ var ProfitAndLossRow = ({
2764
2957
  maxDepth,
2765
2958
  direction
2766
2959
  }
2767
- )), summarize && /* @__PURE__ */ React44.createElement(
2960
+ )), summarize && /* @__PURE__ */ React46.createElement(
2768
2961
  ProfitAndLossRow,
2769
2962
  {
2770
2963
  key: display_name,
@@ -2829,13 +3022,13 @@ var empty_profit_and_loss_report_default = {
2829
3022
  var ProfitAndLossTable = () => {
2830
3023
  const { data: actualData, isLoading } = useContext5(ProfitAndLoss.Context);
2831
3024
  const data = !actualData || isLoading ? empty_profit_and_loss_report_default : actualData;
2832
- return /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement("div", { className: "Layer__profit-and-loss-table" }, /* @__PURE__ */ React45.createElement(ProfitAndLossRow, { lineItem: data.income, direction: "CREDIT" /* CREDIT */ }), /* @__PURE__ */ React45.createElement(
3025
+ 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(
2833
3026
  ProfitAndLossRow,
2834
3027
  {
2835
3028
  lineItem: data.cost_of_goods_sold,
2836
3029
  direction: "DEBIT" /* DEBIT */
2837
3030
  }
2838
- ), /* @__PURE__ */ React45.createElement(
3031
+ ), /* @__PURE__ */ React47.createElement(
2839
3032
  ProfitAndLossRow,
2840
3033
  {
2841
3034
  lineItem: {
@@ -2845,13 +3038,13 @@ var ProfitAndLossTable = () => {
2845
3038
  variant: "summation",
2846
3039
  direction: "CREDIT" /* CREDIT */
2847
3040
  }
2848
- ), /* @__PURE__ */ React45.createElement(
3041
+ ), /* @__PURE__ */ React47.createElement(
2849
3042
  ProfitAndLossRow,
2850
3043
  {
2851
3044
  lineItem: data.expenses,
2852
3045
  direction: "DEBIT" /* DEBIT */
2853
3046
  }
2854
- ), /* @__PURE__ */ React45.createElement(
3047
+ ), /* @__PURE__ */ React47.createElement(
2855
3048
  ProfitAndLossRow,
2856
3049
  {
2857
3050
  lineItem: {
@@ -2861,7 +3054,7 @@ var ProfitAndLossTable = () => {
2861
3054
  variant: "summation",
2862
3055
  direction: "CREDIT" /* CREDIT */
2863
3056
  }
2864
- ), /* @__PURE__ */ React45.createElement(ProfitAndLossRow, { lineItem: data.taxes, direction: "DEBIT" /* DEBIT */ }), /* @__PURE__ */ React45.createElement(
3057
+ ), /* @__PURE__ */ React47.createElement(ProfitAndLossRow, { lineItem: data.taxes, direction: "DEBIT" /* DEBIT */ }), /* @__PURE__ */ React47.createElement(
2865
3058
  ProfitAndLossRow,
2866
3059
  {
2867
3060
  lineItem: {
@@ -2871,13 +3064,13 @@ var ProfitAndLossTable = () => {
2871
3064
  variant: "summation",
2872
3065
  direction: "CREDIT" /* CREDIT */
2873
3066
  }
2874
- )), /* @__PURE__ */ React45.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ React45.createElement(
3067
+ )), /* @__PURE__ */ React47.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ React47.createElement(
2875
3068
  ProfitAndLossRow,
2876
3069
  {
2877
3070
  lineItem: data.other_outflows,
2878
3071
  direction: "DEBIT" /* DEBIT */
2879
3072
  }
2880
- ), /* @__PURE__ */ React45.createElement(
3073
+ ), /* @__PURE__ */ React47.createElement(
2881
3074
  ProfitAndLossRow,
2882
3075
  {
2883
3076
  lineItem: data.personal_expenses,
@@ -2901,7 +3094,7 @@ var PNLContext = createContext2({
2901
3094
  });
2902
3095
  var ProfitAndLoss = ({ children }) => {
2903
3096
  const contextData = useProfitAndLoss();
2904
- return /* @__PURE__ */ React46.createElement(PNLContext.Provider, { value: contextData }, /* @__PURE__ */ React46.createElement("div", { className: "Layer__component Layer__profit-and-loss" }, /* @__PURE__ */ React46.createElement("h2", { className: "Layer__profit-and-loss__title" }, "Profit & Loss"), children));
3097
+ 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));
2905
3098
  };
2906
3099
  ProfitAndLoss.Chart = ProfitAndLossChart;
2907
3100
  ProfitAndLoss.Context = PNLContext;
@@ -2910,7 +3103,7 @@ ProfitAndLoss.Summaries = ProfitAndLossSummaries;
2910
3103
  ProfitAndLoss.Table = ProfitAndLossTable;
2911
3104
 
2912
3105
  // src/providers/LayerProvider/LayerProvider.tsx
2913
- import React47, { useReducer, useEffect as useEffect4 } from "react";
3106
+ import React49, { useReducer, useEffect as useEffect4 } from "react";
2914
3107
  import { add as add2, isBefore } from "date-fns";
2915
3108
  import useSWR5, { SWRConfig } from "swr";
2916
3109
  var reducer = (state, action) => {
@@ -2940,7 +3133,7 @@ var LayerProvider = ({
2940
3133
  appSecret,
2941
3134
  businessId,
2942
3135
  children,
2943
- clientId,
3136
+ businessAccessToken,
2944
3137
  environment = "production",
2945
3138
  theme
2946
3139
  }) => {
@@ -2963,19 +3156,30 @@ var LayerProvider = ({
2963
3156
  apiUrl,
2964
3157
  theme
2965
3158
  });
2966
- const { data: auth } = useSWR5(
2967
- isBefore(state.auth.expires_at, /* @__PURE__ */ new Date()) && "authenticate",
3159
+ const { data: auth } = appId !== void 0 && appSecret !== void 0 ? useSWR5(
3160
+ businessAccessToken === void 0 && appId !== void 0 && appSecret !== void 0 && isBefore(state.auth.expires_at, /* @__PURE__ */ new Date()) && "authenticate",
2968
3161
  Layer.authenticate({
2969
3162
  appId,
2970
3163
  appSecret,
2971
3164
  authenticationUrl: url,
2972
- scope,
2973
- clientId
3165
+ scope
2974
3166
  }),
2975
3167
  defaultSWRConfig
2976
- );
3168
+ ) : { data: void 0 };
2977
3169
  useEffect4(() => {
2978
- if (auth?.access_token) {
3170
+ if (businessAccessToken) {
3171
+ dispatch({
3172
+ type: "LayerContext.setAuth" /* setAuth */,
3173
+ payload: {
3174
+ auth: {
3175
+ access_token: businessAccessToken,
3176
+ token_type: "Bearer",
3177
+ expires_in: 3600,
3178
+ expires_at: add2(/* @__PURE__ */ new Date(), { seconds: 3600 })
3179
+ }
3180
+ }
3181
+ });
3182
+ } else if (auth?.access_token) {
2979
3183
  dispatch({
2980
3184
  type: "LayerContext.setAuth" /* setAuth */,
2981
3185
  payload: {
@@ -2986,7 +3190,7 @@ var LayerProvider = ({
2986
3190
  }
2987
3191
  });
2988
3192
  }
2989
- }, [auth?.access_token]);
3193
+ }, [businessAccessToken, auth?.access_token]);
2990
3194
  const { data: categories } = useSWR5(
2991
3195
  businessId && auth?.access_token && `categories-${businessId}`,
2992
3196
  Layer.getCategories(apiUrl, auth?.access_token, { params: { businessId } }),
@@ -3004,11 +3208,11 @@ var LayerProvider = ({
3004
3208
  type: "LayerContext.setTheme" /* setTheme */,
3005
3209
  payload: { theme: theme2 }
3006
3210
  });
3007
- return /* @__PURE__ */ React47.createElement(SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ React47.createElement(LayerContext.Provider, { value: { ...state, setTheme } }, children));
3211
+ return /* @__PURE__ */ React49.createElement(SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ React49.createElement(LayerContext.Provider, { value: { ...state, setTheme } }, children));
3008
3212
  };
3009
3213
 
3010
3214
  // src/components/ChartOfAccounts/ChartOfAccounts.tsx
3011
- import React50, { useState as useState14 } from "react";
3215
+ import React52, { useState as useState14 } from "react";
3012
3216
 
3013
3217
  // src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
3014
3218
  import useSWR6 from "swr";
@@ -3028,7 +3232,7 @@ var useChartOfAccounts = () => {
3028
3232
  };
3029
3233
 
3030
3234
  // src/components/ChartOfAccountsNewForm/ChartOfAccountsNewForm.tsx
3031
- import React48, { useMemo as useMemo2, useState as useState13 } from "react";
3235
+ import React50, { useMemo as useMemo2, useState as useState13 } from "react";
3032
3236
  import Select2 from "react-select";
3033
3237
  var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.subAccounts || [])]).flat().filter((id) => id);
3034
3238
  var ChartOfAccountsNewForm = () => {
@@ -3056,21 +3260,21 @@ var ChartOfAccountsNewForm = () => {
3056
3260
  description
3057
3261
  });
3058
3262
  };
3059
- return /* @__PURE__ */ React48.createElement("div", { className: "Layer__chart-of-accounts-new-form" }, /* @__PURE__ */ React48.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React48.createElement("span", null, "Name"), /* @__PURE__ */ React48.createElement(
3263
+ 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(
3060
3264
  "input",
3061
3265
  {
3062
3266
  name: "name",
3063
3267
  value: name,
3064
3268
  onChange: (event) => setName(event.target.value)
3065
3269
  }
3066
- )), /* @__PURE__ */ React48.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React48.createElement("span", null, "Description"), /* @__PURE__ */ React48.createElement(
3270
+ )), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Description"), /* @__PURE__ */ React50.createElement(
3067
3271
  "input",
3068
3272
  {
3069
3273
  name: "description",
3070
3274
  value: description,
3071
3275
  onChange: (event) => setDescription(event.target.value)
3072
3276
  }
3073
- )), /* @__PURE__ */ React48.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React48.createElement("span", null, "Normality"), /* @__PURE__ */ React48.createElement(
3277
+ )), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Normality"), /* @__PURE__ */ React50.createElement(
3074
3278
  Select2,
3075
3279
  {
3076
3280
  isSearchable: false,
@@ -3080,7 +3284,7 @@ var ChartOfAccountsNewForm = () => {
3080
3284
  { label: "Debit", value: "DEBIT" /* DEBIT */ }
3081
3285
  ]
3082
3286
  }
3083
- )), /* @__PURE__ */ React48.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React48.createElement("span", null, "Parent Account"), /* @__PURE__ */ React48.createElement(
3287
+ )), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React50.createElement("span", null, "Parent Account"), /* @__PURE__ */ React50.createElement(
3084
3288
  Select2,
3085
3289
  {
3086
3290
  isSearchable: true,
@@ -3090,49 +3294,49 @@ var ChartOfAccountsNewForm = () => {
3090
3294
  getOptionValue: (a) => a.id,
3091
3295
  options: accountOptions
3092
3296
  }
3093
- )), /* @__PURE__ */ React48.createElement("div", { className: "Layer__chart-of-accounts-new-form__field Layer__chart-of-accounts-new-form__field--actions" }, /* @__PURE__ */ React48.createElement("button", { onClick: save }, "Save")));
3297
+ )), /* @__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")));
3094
3298
  };
3095
3299
 
3096
3300
  // src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
3097
- import React49 from "react";
3301
+ import React51 from "react";
3098
3302
  var ChartOfAccountsRow = ({ account, depth = 0 }) => {
3099
- const classNames12 = [
3303
+ const classNames13 = [
3100
3304
  "Layer__chart-of-accounts-row__table-cell",
3101
3305
  depth > 0 && `Layer__chart-of-accounts-row__table-cell--depth-${depth}`
3102
3306
  ];
3103
- const className = classNames12.filter((id) => id).join(" ");
3307
+ const className = classNames13.filter((id) => id).join(" ");
3104
3308
  const amountClassName = account.balance < 0 ? "Layer__chart-of-accounts-row__table-cell--amount-negative" : "Layer__chart-of-accounts-row__table-cell--amount-positive";
3105
- return /* @__PURE__ */ React49.createElement(React49.Fragment, null, /* @__PURE__ */ React49.createElement(
3309
+ return /* @__PURE__ */ React51.createElement(React51.Fragment, null, /* @__PURE__ */ React51.createElement(
3106
3310
  "div",
3107
3311
  {
3108
3312
  className: `${className} Layer__chart-of-accounts-row__table-cell--name`
3109
3313
  },
3110
3314
  account.name
3111
- ), /* @__PURE__ */ React49.createElement(
3315
+ ), /* @__PURE__ */ React51.createElement(
3112
3316
  "div",
3113
3317
  {
3114
3318
  className: `${className} Layer__chart-of-accounts-row__table-cell--type`
3115
3319
  },
3116
3320
  "Assets"
3117
- ), /* @__PURE__ */ React49.createElement(
3321
+ ), /* @__PURE__ */ React51.createElement(
3118
3322
  "div",
3119
3323
  {
3120
3324
  className: `${className} Layer__chart-of-accounts-row__table-cell--subtype`
3121
3325
  },
3122
3326
  "Cash"
3123
- ), /* @__PURE__ */ React49.createElement(
3327
+ ), /* @__PURE__ */ React51.createElement(
3124
3328
  "div",
3125
3329
  {
3126
3330
  className: `${className} Layer__chart-of-accounts-row__table-cell--balance ${amountClassName}`
3127
3331
  },
3128
3332
  centsToDollars(Math.abs(account.balance || 0))
3129
- ), /* @__PURE__ */ React49.createElement(
3333
+ ), /* @__PURE__ */ React51.createElement(
3130
3334
  "div",
3131
3335
  {
3132
3336
  className: `${className} Layer__chart-of-accounts-row__table-cell--actions`
3133
3337
  },
3134
- /* @__PURE__ */ React49.createElement("button", { className: "Layer__chart-of-accounts-row__view-entries-button" }, "View Entries")
3135
- ), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */ React49.createElement(
3338
+ /* @__PURE__ */ React51.createElement("button", { className: "Layer__chart-of-accounts-row__view-entries-button" }, "View Entries")
3339
+ ), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */ React51.createElement(
3136
3340
  ChartOfAccountsRow,
3137
3341
  {
3138
3342
  key: subAccount.id,
@@ -3146,14 +3350,14 @@ var ChartOfAccountsRow = ({ account, depth = 0 }) => {
3146
3350
  var ChartOfAccounts = () => {
3147
3351
  const { data, isLoading } = useChartOfAccounts();
3148
3352
  const [showingForm, setShowingForm] = useState14(false);
3149
- return /* @__PURE__ */ React50.createElement("div", { className: "Layer__component Layer__chart-of-accounts" }, !data || isLoading ? "Loading." : /* @__PURE__ */ React50.createElement(React50.Fragment, null, /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts__header" }, /* @__PURE__ */ React50.createElement("h2", { className: "Layer__chart-of-accounts__title" }, "Chart of Accounts"), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts__actions" }, /* @__PURE__ */ React50.createElement("button", { className: "Layer__chart-of-accounts__download-button" }, /* @__PURE__ */ React50.createElement(DownloadCloud_default, null), "Download"), /* @__PURE__ */ React50.createElement(
3353
+ 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(
3150
3354
  "button",
3151
3355
  {
3152
3356
  className: "Layer__chart-of-accounts__edit-accounts-button",
3153
3357
  onClick: () => setShowingForm(!showingForm)
3154
3358
  },
3155
3359
  "Edit Accounts"
3156
- ))), showingForm && /* @__PURE__ */ React50.createElement(ChartOfAccountsNewForm, null), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Name"), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Type"), /* @__PURE__ */ React50.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Sub-Type"), /* @__PURE__ */ React50.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__ */ React50.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }), data.accounts.map((account) => /* @__PURE__ */ React50.createElement(
3360
+ ))), 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(
3157
3361
  ChartOfAccountsRow,
3158
3362
  {
3159
3363
  key: account.id,