@layerfi/components 0.1.7 → 0.1.9

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
@@ -261,8 +261,8 @@ var matchBankTransaction = put(
261
261
  // src/api/layer/categories.ts
262
262
  var getCategories = get(({ businessId }) => `/v1/businesses/${businessId}/categories`);
263
263
 
264
- // src/api/layer/chart_of_accounts.ts
265
- var getChartOfAccounts = get(
264
+ // src/api/layer/ledger_accounts.ts
265
+ var getLedgerAccounts = get(
266
266
  ({ businessId }) => `/v1/businesses/${businessId}/ledger/accounts`
267
267
  );
268
268
  var createAccount = post(
@@ -283,7 +283,7 @@ var Layer = {
283
283
  getBalanceSheet,
284
284
  getBankTransactions,
285
285
  getCategories,
286
- getChartOfAccounts,
286
+ getLedgerAccounts,
287
287
  getProfitAndLoss
288
288
  };
289
289
 
@@ -328,23 +328,41 @@ var useBalanceSheet = (date = /* @__PURE__ */ new Date()) => {
328
328
 
329
329
  // src/icons/DownloadCloud.tsx
330
330
  import * as React from "react";
331
- var DownloadCloud = (props) => /* @__PURE__ */ React.createElement(
331
+ var DownloadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React.createElement(
332
332
  "svg",
333
333
  {
334
334
  xmlns: "http://www.w3.org/2000/svg",
335
- width: 24,
336
- height: 24,
335
+ viewBox: "0 0 18 18",
337
336
  fill: "none",
338
- ...props
337
+ ...props,
338
+ width: size,
339
+ height: size
339
340
  },
340
341
  /* @__PURE__ */ React.createElement(
341
342
  "path",
342
343
  {
343
- stroke: "#000",
344
+ d: "M6 12.75L9 15.75L12 12.75",
345
+ stroke: "currentColor",
344
346
  strokeLinecap: "round",
345
- strokeLinejoin: "round",
346
- strokeWidth: 2,
347
- d: "M4 16.242A4.5 4.5 0 0 1 6.08 8.02a6.002 6.002 0 0 1 11.84 0A4.5 4.5 0 0 1 20 16.242M8 17l4 4m0 0 4-4m-4 4v-9"
347
+ strokeLinejoin: "round"
348
+ }
349
+ ),
350
+ /* @__PURE__ */ React.createElement(
351
+ "path",
352
+ {
353
+ d: "M9 9V15.75",
354
+ stroke: "currentColor",
355
+ strokeLinecap: "round",
356
+ strokeLinejoin: "round"
357
+ }
358
+ ),
359
+ /* @__PURE__ */ React.createElement(
360
+ "path",
361
+ {
362
+ d: "M15.66 13.5675C16.3121 13.109 16.801 12.4546 17.056 11.6994C17.3109 10.9441 17.3186 10.1273 17.0778 9.36737C16.837 8.60748 16.3604 7.94407 15.7171 7.47342C15.0737 7.00278 14.2971 6.74938 13.5 6.75H12.555C12.3294 5.87091 11.9074 5.05444 11.3206 4.36206C10.7338 3.66969 9.99762 3.11945 9.16742 2.75277C8.33721 2.38609 7.43464 2.21252 6.52766 2.24514C5.62067 2.27776 4.7329 2.51571 3.93118 2.94107C3.12946 3.36644 2.43468 3.96814 1.89915 4.70087C1.36362 5.43361 1.0013 6.27829 0.839456 7.17132C0.677613 8.06434 0.720468 8.98245 0.964796 9.85652C1.20912 10.7306 1.64856 11.5378 2.25001 12.2175",
363
+ stroke: "currentColor",
364
+ strokeLinecap: "round",
365
+ strokeLinejoin: "round"
348
366
  }
349
367
  )
350
368
  );
@@ -563,7 +581,7 @@ var BalanceSheet = () => {
563
581
  };
564
582
 
565
583
  // src/components/BankTransactions/BankTransactions.tsx
566
- import React54, { useState as useState10, useMemo as useMemo2 } from "react";
584
+ import React55, { useState as useState10, useMemo as useMemo2 } from "react";
567
585
 
568
586
  // src/config/general.ts
569
587
  var DATE_FORMAT = "LLL d, yyyy";
@@ -719,7 +737,7 @@ var debounce = (fnc, timeout = 300) => {
719
737
  };
720
738
 
721
739
  // src/components/BankTransactionListItem/BankTransactionListItem.tsx
722
- import React46, { useEffect as useEffect6, useRef as useRef11, useState as useState9 } from "react";
740
+ import React47, { useEffect as useEffect6, useRef as useRef11, useState as useState9 } from "react";
723
741
 
724
742
  // src/icons/ChevronDownFill.tsx
725
743
  import * as React8 from "react";
@@ -747,7 +765,7 @@ var ChevronDownFill = ({ size = 18, ...props }) => /* @__PURE__ */ React8.create
747
765
  var ChevronDownFill_default = ChevronDownFill;
748
766
 
749
767
  // src/components/BankTransactionRow/BankTransactionRow.tsx
750
- import React44, { useEffect as useEffect5, useRef as useRef10, useState as useState8 } from "react";
768
+ import React45, { useEffect as useEffect5, useRef as useRef10, useState as useState8 } from "react";
751
769
 
752
770
  // src/icons/AlertCircle.tsx
753
771
  import * as React9 from "react";
@@ -1399,8 +1417,12 @@ import classNames4 from "classnames";
1399
1417
  var buildRightIcon = ({
1400
1418
  processing,
1401
1419
  error,
1402
- action
1420
+ action,
1421
+ noIcon
1403
1422
  }) => {
1423
+ if (noIcon) {
1424
+ return;
1425
+ }
1404
1426
  if (processing) {
1405
1427
  return /* @__PURE__ */ React20.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" });
1406
1428
  }
@@ -1420,6 +1442,7 @@ var SubmitButton = ({
1420
1442
  error,
1421
1443
  children,
1422
1444
  action = "save" /* SAVE */,
1445
+ noIcon,
1423
1446
  ...props
1424
1447
  }) => {
1425
1448
  const baseClassName = classNames4(
@@ -1433,7 +1456,7 @@ var SubmitButton = ({
1433
1456
  className: baseClassName,
1434
1457
  variant: "primary" /* primary */,
1435
1458
  disabled: processing || disabled,
1436
- rightIcon: buildRightIcon({ processing, error, action }),
1459
+ rightIcon: buildRightIcon({ processing, error, action, noIcon }),
1437
1460
  iconAsPrimary: true
1438
1461
  },
1439
1462
  children
@@ -1734,7 +1757,7 @@ var CategorySelect = ({
1734
1757
  };
1735
1758
 
1736
1759
  // src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
1737
- import React42, {
1760
+ import React43, {
1738
1761
  forwardRef as forwardRef2,
1739
1762
  useImperativeHandle,
1740
1763
  useState as useState7,
@@ -2039,9 +2062,14 @@ var InputGroup = ({
2039
2062
  label,
2040
2063
  name,
2041
2064
  className,
2065
+ inline,
2042
2066
  children
2043
2067
  }) => {
2044
- const baseClassName = classNames12("Layer__input-group", className);
2068
+ const baseClassName = classNames12(
2069
+ "Layer__input-group",
2070
+ className,
2071
+ inline && "Layer__input-group--inline"
2072
+ );
2045
2073
  return /* @__PURE__ */ React33.createElement("div", { className: baseClassName }, label && /* @__PURE__ */ React33.createElement(
2046
2074
  Text,
2047
2075
  {
@@ -2141,11 +2169,45 @@ var FileInput = ({ text = "Upload", onUpload }) => {
2141
2169
  ));
2142
2170
  };
2143
2171
 
2172
+ // src/components/Input/Select.tsx
2173
+ import React36 from "react";
2174
+ import ReactSelect, {
2175
+ components as components3
2176
+ } from "react-select";
2177
+ var DropdownIndicator3 = (props) => {
2178
+ return /* @__PURE__ */ React36.createElement(components3.DropdownIndicator, { ...props }, /* @__PURE__ */ React36.createElement(ChevronDownFill_default, null));
2179
+ };
2180
+ var Select3 = ({
2181
+ name,
2182
+ options,
2183
+ className,
2184
+ classNamePrefix = "Layer__select",
2185
+ value,
2186
+ onChange,
2187
+ disabled
2188
+ }) => {
2189
+ return /* @__PURE__ */ React36.createElement(
2190
+ ReactSelect,
2191
+ {
2192
+ name,
2193
+ className: `Layer__select ${className ?? ""}`,
2194
+ classNamePrefix,
2195
+ options,
2196
+ value,
2197
+ onChange: (newValue) => newValue && onChange(newValue),
2198
+ menuPortalTarget: document.body,
2199
+ styles: { menuPortal: (base) => ({ ...base, zIndex: 9999 }) },
2200
+ components: { DropdownIndicator: DropdownIndicator3 },
2201
+ isDisabled: disabled
2202
+ }
2203
+ );
2204
+ };
2205
+
2144
2206
  // src/components/MatchForm/MatchForm.tsx
2145
- import React37 from "react";
2207
+ import React38 from "react";
2146
2208
 
2147
2209
  // src/components/BankTransactionRow/MatchBadge.tsx
2148
- import React36 from "react";
2210
+ import React37 from "react";
2149
2211
  import { parseISO as parseISO3, format as formatTime2 } from "date-fns";
2150
2212
  var MatchBadge = ({
2151
2213
  bankTransaction,
@@ -2155,11 +2217,11 @@ var MatchBadge = ({
2155
2217
  }) => {
2156
2218
  if (bankTransaction.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction.match) {
2157
2219
  const { date, amount, description } = bankTransaction.match.bank_transaction;
2158
- return /* @__PURE__ */ React36.createElement(
2220
+ return /* @__PURE__ */ React37.createElement(
2159
2221
  Badge,
2160
2222
  {
2161
- icon: /* @__PURE__ */ React36.createElement(MinimizeTwo_default, { size: 11 }),
2162
- tooltip: /* @__PURE__ */ React36.createElement("span", { className: `${classNamePrefix}__match-tooltip` }, /* @__PURE__ */ React36.createElement("div", { className: `${classNamePrefix}__match-tooltip__date` }, formatTime2(parseISO3(date), dateFormat)), /* @__PURE__ */ React36.createElement("div", { className: `${classNamePrefix}__match-tooltip__description` }, description), /* @__PURE__ */ React36.createElement("div", { className: `${classNamePrefix}__match-tooltip__amount` }, "$", centsToDollars(amount)))
2223
+ icon: /* @__PURE__ */ React37.createElement(MinimizeTwo_default, { size: 11 }),
2224
+ tooltip: /* @__PURE__ */ React37.createElement("span", { className: `${classNamePrefix}__match-tooltip` }, /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-tooltip__date` }, formatTime2(parseISO3(date), dateFormat)), /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-tooltip__description` }, description), /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-tooltip__amount` }, "$", centsToDollars(amount)))
2163
2225
  },
2164
2226
  text
2165
2227
  );
@@ -2177,13 +2239,13 @@ var MatchForm = ({
2177
2239
  setSelectedMatchId,
2178
2240
  matchFormError
2179
2241
  }) => {
2180
- return /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table` }, /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__header` }, /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__date` }, "Date"), /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, "Description"), /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "Amount"), /* @__PURE__ */ React37.createElement(
2242
+ return /* @__PURE__ */ React38.createElement("div", { className: `${classNamePrefix}__match-table` }, /* @__PURE__ */ React38.createElement("div", { className: `${classNamePrefix}__match-table__header` }, /* @__PURE__ */ React38.createElement("div", { className: `${classNamePrefix}__match-table__date` }, "Date"), /* @__PURE__ */ React38.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, "Description"), /* @__PURE__ */ React38.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "Amount"), /* @__PURE__ */ React38.createElement(
2181
2243
  "div",
2182
2244
  {
2183
2245
  className: `${classNamePrefix}__match-table__status ${bankTransaction.match ? "" : "no-match"}`
2184
2246
  }
2185
2247
  )), bankTransaction.suggested_matches?.map((match, idx) => {
2186
- return /* @__PURE__ */ React37.createElement(
2248
+ return /* @__PURE__ */ React38.createElement(
2187
2249
  "div",
2188
2250
  {
2189
2251
  key: idx,
@@ -2199,15 +2261,15 @@ var MatchForm = ({
2199
2261
  setSelectedMatchId(match.id);
2200
2262
  }
2201
2263
  },
2202
- /* @__PURE__ */ React37.createElement(
2264
+ /* @__PURE__ */ React38.createElement(
2203
2265
  "div",
2204
2266
  {
2205
2267
  className: `Layer__nowrap ${classNamePrefix}__match-table__date`
2206
2268
  },
2207
- /* @__PURE__ */ React37.createElement("span", null, formatTime3(parseISO4(match.details.date), DATE_FORMAT)),
2208
- /* @__PURE__ */ React37.createElement("span", { className: "amount-next-to-date" }, "$", centsToDollars(match.details.amount))
2269
+ /* @__PURE__ */ React38.createElement("span", null, formatTime3(parseISO4(match.details.date), DATE_FORMAT)),
2270
+ /* @__PURE__ */ React38.createElement("span", { className: "amount-next-to-date" }, "$", centsToDollars(match.details.amount))
2209
2271
  ),
2210
- /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, /* @__PURE__ */ React37.createElement(
2272
+ /* @__PURE__ */ React38.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, /* @__PURE__ */ React38.createElement(
2211
2273
  Text,
2212
2274
  {
2213
2275
  className: `${classNamePrefix}__match-table__desc-tooltip`,
@@ -2215,7 +2277,7 @@ var MatchForm = ({
2215
2277
  as: "span"
2216
2278
  },
2217
2279
  match.details.description
2218
- ), match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ React37.createElement("span", { className: "match-badge" }, /* @__PURE__ */ React37.createElement(
2280
+ ), match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ React38.createElement("span", { className: "match-badge" }, /* @__PURE__ */ React38.createElement(
2219
2281
  MatchBadge,
2220
2282
  {
2221
2283
  classNamePrefix,
@@ -2224,13 +2286,13 @@ var MatchForm = ({
2224
2286
  text: "Matched"
2225
2287
  }
2226
2288
  ))),
2227
- /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "$", centsToDollars(match.details.amount)),
2228
- /* @__PURE__ */ React37.createElement(
2289
+ /* @__PURE__ */ React38.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "$", centsToDollars(match.details.amount)),
2290
+ /* @__PURE__ */ React38.createElement(
2229
2291
  "div",
2230
2292
  {
2231
2293
  className: `${classNamePrefix}__match-table__status ${bankTransaction.match ? "" : "no-match"}`
2232
2294
  },
2233
- match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ React37.createElement(
2295
+ match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ React38.createElement(
2234
2296
  MatchBadge,
2235
2297
  {
2236
2298
  classNamePrefix,
@@ -2241,22 +2303,22 @@ var MatchForm = ({
2241
2303
  )
2242
2304
  )
2243
2305
  );
2244
- }), matchFormError && /* @__PURE__ */ React37.createElement(ErrorText, null, matchFormError));
2306
+ }), matchFormError && /* @__PURE__ */ React38.createElement(ErrorText, null, matchFormError));
2245
2307
  };
2246
2308
 
2247
2309
  // src/components/Textarea/Textarea.tsx
2248
- import React38 from "react";
2310
+ import React39 from "react";
2249
2311
  import classNames14 from "classnames";
2250
2312
  var Textarea = ({
2251
2313
  className,
2252
2314
  ...props
2253
2315
  }) => {
2254
2316
  const baseClassName = classNames14("Layer__textarea", className);
2255
- return /* @__PURE__ */ React38.createElement("textarea", { ...props, className: baseClassName });
2317
+ return /* @__PURE__ */ React39.createElement("textarea", { ...props, className: baseClassName });
2256
2318
  };
2257
2319
 
2258
2320
  // src/components/Toggle/Toggle.tsx
2259
- import React39, {
2321
+ import React40, {
2260
2322
  useEffect as useEffect2,
2261
2323
  useState as useState5
2262
2324
  } from "react";
@@ -2325,7 +2387,7 @@ var Toggle = ({
2325
2387
  }
2326
2388
  return selectedIndex;
2327
2389
  };
2328
- return /* @__PURE__ */ React39.createElement("div", { className: baseClassName, ref: toggleRef }, options.map((option, index) => /* @__PURE__ */ React39.createElement(
2390
+ return /* @__PURE__ */ React40.createElement("div", { className: baseClassName, ref: toggleRef }, options.map((option, index) => /* @__PURE__ */ React40.createElement(
2329
2391
  ToggleOption,
2330
2392
  {
2331
2393
  ...option,
@@ -2337,7 +2399,7 @@ var Toggle = ({
2337
2399
  disabled: option.disabled ?? false,
2338
2400
  index
2339
2401
  }
2340
- )), /* @__PURE__ */ React39.createElement("span", { className: "Layer__toggle__thumb", style: { ...thumbPos } }));
2402
+ )), /* @__PURE__ */ React40.createElement("span", { className: "Layer__toggle__thumb", style: { ...thumbPos } }));
2341
2403
  };
2342
2404
  var ToggleOption = ({
2343
2405
  checked,
@@ -2351,7 +2413,7 @@ var ToggleOption = ({
2351
2413
  index
2352
2414
  }) => {
2353
2415
  if (disabled) {
2354
- return /* @__PURE__ */ React39.createElement(Tooltip, null, /* @__PURE__ */ React39.createElement(TooltipTrigger, null, /* @__PURE__ */ React39.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ React39.createElement(
2416
+ return /* @__PURE__ */ React40.createElement(Tooltip, null, /* @__PURE__ */ React40.createElement(TooltipTrigger, null, /* @__PURE__ */ React40.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ React40.createElement(
2355
2417
  "input",
2356
2418
  {
2357
2419
  type: "radio",
@@ -2362,9 +2424,9 @@ var ToggleOption = ({
2362
2424
  disabled: disabled ?? false,
2363
2425
  "data-idx": index
2364
2426
  }
2365
- ), /* @__PURE__ */ React39.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ React39.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ React39.createElement("span", null, label)))), /* @__PURE__ */ React39.createElement(TooltipContent, { className: "Layer__tooltip" }, "We could not find matching transactions"));
2427
+ ), /* @__PURE__ */ React40.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ React40.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ React40.createElement("span", null, label)))), /* @__PURE__ */ React40.createElement(TooltipContent, { className: "Layer__tooltip" }, "We could not find matching transactions"));
2366
2428
  }
2367
- return /* @__PURE__ */ React39.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ React39.createElement(
2429
+ return /* @__PURE__ */ React40.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ React40.createElement(
2368
2430
  "input",
2369
2431
  {
2370
2432
  type: "radio",
@@ -2375,15 +2437,15 @@ var ToggleOption = ({
2375
2437
  disabled: disabled ?? false,
2376
2438
  "data-idx": index
2377
2439
  }
2378
- ), /* @__PURE__ */ React39.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ React39.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ React39.createElement("span", null, label)));
2440
+ ), /* @__PURE__ */ React40.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ React40.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ React40.createElement("span", null, label)));
2379
2441
  };
2380
2442
 
2381
2443
  // src/components/ExpandedBankTransactionRow/APIErrorNotifications.tsx
2382
- import React41, { useEffect as useEffect3, useState as useState6 } from "react";
2444
+ import React42, { useEffect as useEffect3, useState as useState6 } from "react";
2383
2445
 
2384
2446
  // src/icons/AlertOctagon.tsx
2385
- import * as React40 from "react";
2386
- var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React40.createElement(
2447
+ import * as React41 from "react";
2448
+ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React41.createElement(
2387
2449
  "svg",
2388
2450
  {
2389
2451
  viewBox: "0 0 18 18",
@@ -2393,7 +2455,7 @@ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React40.createEl
2393
2455
  width: size,
2394
2456
  height: size
2395
2457
  },
2396
- /* @__PURE__ */ React40.createElement(
2458
+ /* @__PURE__ */ React41.createElement(
2397
2459
  "path",
2398
2460
  {
2399
2461
  d: "M5.895 1.5H12.105L16.5 5.895V12.105L12.105 16.5H5.895L1.5 12.105V5.895L5.895 1.5Z",
@@ -2402,7 +2464,7 @@ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React40.createEl
2402
2464
  strokeLinejoin: "round"
2403
2465
  }
2404
2466
  ),
2405
- /* @__PURE__ */ React40.createElement(
2467
+ /* @__PURE__ */ React41.createElement(
2406
2468
  "path",
2407
2469
  {
2408
2470
  d: "M9 6V9",
@@ -2411,7 +2473,7 @@ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React40.createEl
2411
2473
  strokeLinejoin: "round"
2412
2474
  }
2413
2475
  ),
2414
- /* @__PURE__ */ React40.createElement(
2476
+ /* @__PURE__ */ React41.createElement(
2415
2477
  "path",
2416
2478
  {
2417
2479
  d: "M9 12H9.0075",
@@ -2467,13 +2529,13 @@ var APIErrorNotifications = ({
2467
2529
  pushNotification(ERROR_TITLE, ERROR_MESSAGE);
2468
2530
  }
2469
2531
  }, [bankTransaction.error]);
2470
- return /* @__PURE__ */ React41.createElement(
2532
+ return /* @__PURE__ */ React42.createElement(
2471
2533
  "div",
2472
2534
  {
2473
2535
  className: "Layer__bank-transactions__notifications",
2474
2536
  style: containerWidth ? { left: containerWidth - 324 } : {}
2475
2537
  },
2476
- notifications.filter((n) => n.bankTransactionId === bankTransaction.id).map((notification) => /* @__PURE__ */ React41.createElement(
2538
+ notifications.filter((n) => n.bankTransactionId === bankTransaction.id).map((notification) => /* @__PURE__ */ React42.createElement(
2477
2539
  Notification,
2478
2540
  {
2479
2541
  key: notification.timestamp,
@@ -2501,20 +2563,20 @@ var Notification = ({
2501
2563
  deleteNotification(notification.timestamp);
2502
2564
  }, FADE_OUT_TIME_WAIT);
2503
2565
  };
2504
- return /* @__PURE__ */ React41.createElement(
2566
+ return /* @__PURE__ */ React42.createElement(
2505
2567
  "div",
2506
2568
  {
2507
2569
  className: `Layer__bank-transactions__notification ${visible ? "notification-enter" : "notification-exit"}`,
2508
2570
  onClick: hideNotification
2509
2571
  },
2510
- /* @__PURE__ */ React41.createElement("div", { className: "Layer__bank-transactions__notification-content" }, /* @__PURE__ */ React41.createElement("div", { className: "Layer__bank-transactions__notification-icon" }, /* @__PURE__ */ React41.createElement(AlertOctagon_default, { size: 14 })), /* @__PURE__ */ React41.createElement("div", { className: "Layer__bank-transactions__notification-text" }, /* @__PURE__ */ React41.createElement(
2572
+ /* @__PURE__ */ React42.createElement("div", { className: "Layer__bank-transactions__notification-content" }, /* @__PURE__ */ React42.createElement("div", { className: "Layer__bank-transactions__notification-icon" }, /* @__PURE__ */ React42.createElement(AlertOctagon_default, { size: 14 })), /* @__PURE__ */ React42.createElement("div", { className: "Layer__bank-transactions__notification-text" }, /* @__PURE__ */ React42.createElement(
2511
2573
  Text,
2512
2574
  {
2513
2575
  as: "span",
2514
2576
  className: "Layer__bank-transactions__notification-title"
2515
2577
  },
2516
2578
  notification.title
2517
- ), /* @__PURE__ */ React41.createElement(
2579
+ ), /* @__PURE__ */ React42.createElement(
2518
2580
  Text,
2519
2581
  {
2520
2582
  as: "span",
@@ -2736,14 +2798,14 @@ var ExpandedBankTransactionRow = forwardRef2(
2736
2798
  }, []);
2737
2799
  const className = "Layer__expanded-bank-transaction-row";
2738
2800
  const shouldHide = !isOpen && isOver;
2739
- return /* @__PURE__ */ React42.createElement(
2801
+ return /* @__PURE__ */ React43.createElement(
2740
2802
  "span",
2741
2803
  {
2742
2804
  className: `${className} ${className}--${isOpen ? "expanded" : "collapsed"}`,
2743
2805
  style: { height },
2744
2806
  onTransitionEnd: handleTransitionEnd
2745
2807
  },
2746
- shouldHide ? null : /* @__PURE__ */ React42.createElement("span", { className: `${className}__wrapper`, ref: bodyRef }, /* @__PURE__ */ React42.createElement("div", { className: `${className}__content-toggle` }, /* @__PURE__ */ React42.createElement(
2808
+ shouldHide ? null : /* @__PURE__ */ React43.createElement("span", { className: `${className}__wrapper`, ref: bodyRef }, /* @__PURE__ */ React43.createElement("div", { className: `${className}__content-toggle` }, /* @__PURE__ */ React43.createElement(
2747
2809
  Toggle,
2748
2810
  {
2749
2811
  name: `purpose-${bankTransaction.id}${asListItem ? "-li" : ""}`,
@@ -2762,13 +2824,13 @@ var ExpandedBankTransactionRow = forwardRef2(
2762
2824
  selected: purpose,
2763
2825
  onChange: onChangePurpose
2764
2826
  }
2765
- )), /* @__PURE__ */ React42.createElement(
2827
+ )), /* @__PURE__ */ React43.createElement(
2766
2828
  "div",
2767
2829
  {
2768
2830
  className: `${className}__content`,
2769
2831
  id: `expanded-${bankTransaction.id}`
2770
2832
  },
2771
- /* @__PURE__ */ React42.createElement("div", { className: `${className}__content-panels` }, /* @__PURE__ */ React42.createElement(
2833
+ /* @__PURE__ */ React43.createElement("div", { className: `${className}__content-panels` }, /* @__PURE__ */ React43.createElement(
2772
2834
  "div",
2773
2835
  {
2774
2836
  className: classNames16(
@@ -2777,7 +2839,7 @@ var ExpandedBankTransactionRow = forwardRef2(
2777
2839
  purpose === "match" /* match */ ? `${className}__content-panel--active` : ""
2778
2840
  )
2779
2841
  },
2780
- /* @__PURE__ */ React42.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ React42.createElement(
2842
+ /* @__PURE__ */ React43.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ React43.createElement(
2781
2843
  MatchForm,
2782
2844
  {
2783
2845
  classNamePrefix: className,
@@ -2790,7 +2852,7 @@ var ExpandedBankTransactionRow = forwardRef2(
2790
2852
  matchFormError
2791
2853
  }
2792
2854
  ))
2793
- ), /* @__PURE__ */ React42.createElement(
2855
+ ), /* @__PURE__ */ React43.createElement(
2794
2856
  "div",
2795
2857
  {
2796
2858
  className: classNames16(
@@ -2799,13 +2861,13 @@ var ExpandedBankTransactionRow = forwardRef2(
2799
2861
  purpose === "categorize" /* categorize */ ? `${className}__content-panel--active` : ""
2800
2862
  )
2801
2863
  },
2802
- /* @__PURE__ */ React42.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ React42.createElement("div", { className: `${className}__splits-inputs` }, rowState.splits.map((split, index) => /* @__PURE__ */ React42.createElement(
2864
+ /* @__PURE__ */ React43.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ React43.createElement("div", { className: `${className}__splits-inputs` }, rowState.splits.map((split, index) => /* @__PURE__ */ React43.createElement(
2803
2865
  "div",
2804
2866
  {
2805
2867
  className: `${className}__table-cell--split-entry`,
2806
2868
  key: `split-${index}`
2807
2869
  },
2808
- /* @__PURE__ */ React42.createElement(
2870
+ /* @__PURE__ */ React43.createElement(
2809
2871
  Input,
2810
2872
  {
2811
2873
  type: "text",
@@ -2818,12 +2880,12 @@ var ExpandedBankTransactionRow = forwardRef2(
2818
2880
  errorMessage: "Negative values are not allowed"
2819
2881
  }
2820
2882
  ),
2821
- /* @__PURE__ */ React42.createElement(
2883
+ /* @__PURE__ */ React43.createElement(
2822
2884
  "div",
2823
2885
  {
2824
2886
  className: `${className}__table-cell--split-entry__right-col`
2825
2887
  },
2826
- /* @__PURE__ */ React42.createElement(
2888
+ /* @__PURE__ */ React43.createElement(
2827
2889
  CategoryMenu,
2828
2890
  {
2829
2891
  bankTransaction,
@@ -2833,18 +2895,18 @@ var ExpandedBankTransactionRow = forwardRef2(
2833
2895
  className: "Layer__category-menu--full"
2834
2896
  }
2835
2897
  ),
2836
- index > 0 && /* @__PURE__ */ React42.createElement(
2898
+ index > 0 && /* @__PURE__ */ React43.createElement(
2837
2899
  Button,
2838
2900
  {
2839
2901
  className: `${className}__table-cell--split-entry__merge-btn`,
2840
2902
  onClick: () => removeSplit(index),
2841
- rightIcon: /* @__PURE__ */ React42.createElement(Trash_default, { size: 18 }),
2903
+ rightIcon: /* @__PURE__ */ React43.createElement(Trash_default, { size: 18 }),
2842
2904
  variant: "secondary" /* secondary */,
2843
2905
  iconOnly: true
2844
2906
  }
2845
2907
  )
2846
2908
  )
2847
- ))), splitFormError && /* @__PURE__ */ React42.createElement(ErrorText, null, splitFormError), /* @__PURE__ */ React42.createElement("div", { className: `${className}__total-and-btns` }, rowState.splits.length > 1 && /* @__PURE__ */ React42.createElement(
2909
+ ))), splitFormError && /* @__PURE__ */ React43.createElement(ErrorText, null, splitFormError), /* @__PURE__ */ React43.createElement("div", { className: `${className}__total-and-btns` }, rowState.splits.length > 1 && /* @__PURE__ */ React43.createElement(
2848
2910
  Input,
2849
2911
  {
2850
2912
  disabled: true,
@@ -2856,43 +2918,43 @@ var ExpandedBankTransactionRow = forwardRef2(
2856
2918
  )
2857
2919
  )}`
2858
2920
  }
2859
- ), /* @__PURE__ */ React42.createElement("div", { className: `${className}__splits-buttons` }, rowState.splits.length > 1 ? /* @__PURE__ */ React42.createElement(
2921
+ ), /* @__PURE__ */ React43.createElement("div", { className: `${className}__splits-buttons` }, rowState.splits.length > 1 ? /* @__PURE__ */ React43.createElement(
2860
2922
  TextButton,
2861
2923
  {
2862
2924
  onClick: addSplit,
2863
2925
  disabled: rowState.splits.length > 5
2864
2926
  },
2865
2927
  "Add new split"
2866
- ) : /* @__PURE__ */ React42.createElement(
2928
+ ) : /* @__PURE__ */ React43.createElement(
2867
2929
  Button,
2868
2930
  {
2869
2931
  onClick: addSplit,
2870
- rightIcon: /* @__PURE__ */ React42.createElement(ScissorsFullOpen_default, { size: 14 }),
2932
+ rightIcon: /* @__PURE__ */ React43.createElement(ScissorsFullOpen_default, { size: 14 }),
2871
2933
  variant: "secondary" /* secondary */,
2872
2934
  disabled: rowState.splits.length > 5
2873
2935
  },
2874
2936
  "Split"
2875
2937
  ))))
2876
2938
  )),
2877
- /* @__PURE__ */ React42.createElement(
2939
+ /* @__PURE__ */ React43.createElement(
2878
2940
  InputGroup,
2879
2941
  {
2880
2942
  className: `${className}__description`,
2881
2943
  name: "description"
2882
2944
  },
2883
- /* @__PURE__ */ React42.createElement(Textarea, { name: "description", placeholder: "Add description" })
2945
+ /* @__PURE__ */ React43.createElement(Textarea, { name: "description", placeholder: "Add description" })
2884
2946
  ),
2885
- /* @__PURE__ */ React42.createElement("div", { className: `${className}__file-upload` }, /* @__PURE__ */ React42.createElement(FileInput, { text: "Upload receipt" })),
2886
- asListItem ? /* @__PURE__ */ React42.createElement("div", { className: `${className}__submit-btn` }, bankTransaction.error ? /* @__PURE__ */ React42.createElement(
2947
+ /* @__PURE__ */ React43.createElement("div", { className: `${className}__file-upload` }, /* @__PURE__ */ React43.createElement(FileInput, { text: "Upload receipt" })),
2948
+ asListItem ? /* @__PURE__ */ React43.createElement("div", { className: `${className}__submit-btn` }, bankTransaction.error ? /* @__PURE__ */ React43.createElement(
2887
2949
  Text,
2888
2950
  {
2889
2951
  as: "span",
2890
2952
  size: "md" /* md */,
2891
2953
  className: "Layer__unsaved-info"
2892
2954
  },
2893
- /* @__PURE__ */ React42.createElement("span", null, "Unsaved"),
2894
- /* @__PURE__ */ React42.createElement(AlertCircle_default, { size: 12 })
2895
- ) : null, /* @__PURE__ */ React42.createElement(
2955
+ /* @__PURE__ */ React43.createElement("span", null, "Unsaved"),
2956
+ /* @__PURE__ */ React43.createElement(AlertCircle_default, { size: 12 })
2957
+ ) : null, /* @__PURE__ */ React43.createElement(
2896
2958
  SubmitButton,
2897
2959
  {
2898
2960
  onClick: () => {
@@ -2907,7 +2969,7 @@ var ExpandedBankTransactionRow = forwardRef2(
2907
2969
  },
2908
2970
  submitBtnText
2909
2971
  )) : null
2910
- ), /* @__PURE__ */ React42.createElement(
2972
+ ), /* @__PURE__ */ React43.createElement(
2911
2973
  APIErrorNotifications,
2912
2974
  {
2913
2975
  bankTransaction,
@@ -2919,7 +2981,7 @@ var ExpandedBankTransactionRow = forwardRef2(
2919
2981
  );
2920
2982
 
2921
2983
  // src/components/BankTransactionRow/SplitTooltipDetails.tsx
2922
- import React43 from "react";
2984
+ import React44 from "react";
2923
2985
  var SplitTooltipDetails = ({
2924
2986
  classNamePrefix,
2925
2987
  category
@@ -2927,7 +2989,7 @@ var SplitTooltipDetails = ({
2927
2989
  if (!category.entries) {
2928
2990
  return;
2929
2991
  }
2930
- return /* @__PURE__ */ React43.createElement("span", { className: `${classNamePrefix}__split-tooltip` }, /* @__PURE__ */ React43.createElement("ul", null, category.entries.map((entry, idx) => /* @__PURE__ */ React43.createElement("li", { key: idx }, /* @__PURE__ */ React43.createElement("span", { className: `${classNamePrefix}__split-tooltip__label` }, entry.category.display_name), /* @__PURE__ */ React43.createElement("span", { className: `${classNamePrefix}__split-tooltip__value` }, "$", centsToDollars(entry.amount))))));
2992
+ return /* @__PURE__ */ React44.createElement("span", { className: `${classNamePrefix}__split-tooltip` }, /* @__PURE__ */ React44.createElement("ul", null, category.entries.map((entry, idx) => /* @__PURE__ */ React44.createElement("li", { key: idx }, /* @__PURE__ */ React44.createElement("span", { className: `${classNamePrefix}__split-tooltip__label` }, entry.category.display_name), /* @__PURE__ */ React44.createElement("span", { className: `${classNamePrefix}__split-tooltip__value` }, "$", centsToDollars(entry.amount))))));
2931
2993
  };
2932
2994
 
2933
2995
  // src/components/BankTransactionRow/BankTransactionRow.tsx
@@ -3018,7 +3080,7 @@ var BankTransactionRow = ({
3018
3080
  open ? openClassName : "",
3019
3081
  showComponent ? "show" : ""
3020
3082
  );
3021
- return /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(
3083
+ return /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement(
3022
3084
  "tr",
3023
3085
  {
3024
3086
  className: rowClassName,
@@ -3029,21 +3091,21 @@ var BankTransactionRow = ({
3029
3091
  }
3030
3092
  }
3031
3093
  },
3032
- /* @__PURE__ */ React44.createElement(
3094
+ /* @__PURE__ */ React45.createElement(
3033
3095
  "td",
3034
3096
  {
3035
3097
  className: "Layer__table-cell Layer__bank-transaction-table__date-col",
3036
3098
  ...openRow
3037
3099
  },
3038
- /* @__PURE__ */ React44.createElement("span", { className: "Layer__table-cell-content" }, formatTime4(parseISO5(bankTransaction.date), dateFormat))
3100
+ /* @__PURE__ */ React45.createElement("span", { className: "Layer__table-cell-content" }, formatTime4(parseISO5(bankTransaction.date), dateFormat))
3039
3101
  ),
3040
- /* @__PURE__ */ React44.createElement(
3102
+ /* @__PURE__ */ React45.createElement(
3041
3103
  "td",
3042
3104
  {
3043
3105
  className: "Layer__table-cell Layer__bank-transactions__tx-col",
3044
3106
  ...openRow
3045
3107
  },
3046
- /* @__PURE__ */ React44.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React44.createElement(
3108
+ /* @__PURE__ */ React45.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React45.createElement(
3047
3109
  Text,
3048
3110
  {
3049
3111
  as: "span",
@@ -3056,13 +3118,13 @@ var BankTransactionRow = ({
3056
3118
  bankTransaction.counterparty_name ?? bankTransaction.description
3057
3119
  ))
3058
3120
  ),
3059
- /* @__PURE__ */ React44.createElement(
3121
+ /* @__PURE__ */ React45.createElement(
3060
3122
  "td",
3061
3123
  {
3062
3124
  className: "Layer__table-cell Layer__bank-transactions__account-col",
3063
3125
  ...openRow
3064
3126
  },
3065
- /* @__PURE__ */ React44.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React44.createElement(
3127
+ /* @__PURE__ */ React45.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React45.createElement(
3066
3128
  Text,
3067
3129
  {
3068
3130
  as: "span",
@@ -3072,15 +3134,15 @@ var BankTransactionRow = ({
3072
3134
  bankTransaction.account_name ?? ""
3073
3135
  ))
3074
3136
  ),
3075
- /* @__PURE__ */ React44.createElement(
3137
+ /* @__PURE__ */ React45.createElement(
3076
3138
  "td",
3077
3139
  {
3078
3140
  className: `Layer__table-cell Layer__table-cell__amount-col Layer__bank-transactions__amount-col Layer__table-cell--amount ${className}__table-cell--amount-${isCredit(bankTransaction) ? "credit" : "debit"}`,
3079
3141
  ...openRow
3080
3142
  },
3081
- /* @__PURE__ */ React44.createElement("span", { className: "Layer__table-cell-content" }, isCredit(bankTransaction) ? "+$" : " $", centsToDollars(bankTransaction.amount))
3143
+ /* @__PURE__ */ React45.createElement("span", { className: "Layer__table-cell-content" }, isCredit(bankTransaction) ? "+$" : " $", centsToDollars(bankTransaction.amount))
3082
3144
  ),
3083
- /* @__PURE__ */ React44.createElement(
3145
+ /* @__PURE__ */ React45.createElement(
3084
3146
  "td",
3085
3147
  {
3086
3148
  className: classNames17(
@@ -3090,12 +3152,12 @@ var BankTransactionRow = ({
3090
3152
  `${className}__actions-cell--${open ? "open" : "close"}`
3091
3153
  )
3092
3154
  },
3093
- /* @__PURE__ */ React44.createElement(
3155
+ /* @__PURE__ */ React45.createElement(
3094
3156
  "span",
3095
3157
  {
3096
3158
  className: `${className}__actions-container Layer__table-cell-content`
3097
3159
  },
3098
- editable && !open ? /* @__PURE__ */ React44.createElement(
3160
+ editable && !open ? /* @__PURE__ */ React45.createElement(
3099
3161
  CategorySelect,
3100
3162
  {
3101
3163
  bankTransaction,
@@ -3108,11 +3170,11 @@ var BankTransactionRow = ({
3108
3170
  disabled: bankTransaction.processing
3109
3171
  }
3110
3172
  ) : null,
3111
- !editable && !open ? /* @__PURE__ */ React44.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction.categorization_status === "SPLIT" /* SPLIT */ && /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(
3173
+ !editable && !open ? /* @__PURE__ */ React45.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction.categorization_status === "SPLIT" /* SPLIT */ && /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement(
3112
3174
  Badge,
3113
3175
  {
3114
- icon: /* @__PURE__ */ React44.createElement(Scissors_default, { size: 11 }),
3115
- tooltip: /* @__PURE__ */ React44.createElement(
3176
+ icon: /* @__PURE__ */ React45.createElement(Scissors_default, { size: 11 }),
3177
+ tooltip: /* @__PURE__ */ React45.createElement(
3116
3178
  SplitTooltipDetails,
3117
3179
  {
3118
3180
  classNamePrefix: className,
@@ -3121,18 +3183,18 @@ var BankTransactionRow = ({
3121
3183
  )
3122
3184
  },
3123
3185
  "Split"
3124
- ), /* @__PURE__ */ React44.createElement("span", { className: `${className}__category-text__text` }, extractDescriptionForSplit(bankTransaction.category))), bankTransaction?.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction?.match && /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(
3186
+ ), /* @__PURE__ */ React45.createElement("span", { className: `${className}__category-text__text` }, extractDescriptionForSplit(bankTransaction.category))), bankTransaction?.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction?.match && /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement(
3125
3187
  MatchBadge,
3126
3188
  {
3127
3189
  classNamePrefix: className,
3128
3190
  bankTransaction,
3129
3191
  dateFormat
3130
3192
  }
3131
- ), /* @__PURE__ */ React44.createElement("span", { className: `${className}__category-text__text` }, `${formatTime4(
3193
+ ), /* @__PURE__ */ React45.createElement("span", { className: `${className}__category-text__text` }, `${formatTime4(
3132
3194
  parseISO5(bankTransaction.match.bank_transaction.date),
3133
3195
  dateFormat
3134
- )}, ${bankTransaction.match.bank_transaction.description}`)), bankTransaction?.categorization_status !== "MATCHED" /* MATCHED */ && bankTransaction?.categorization_status !== "SPLIT" /* SPLIT */ && /* @__PURE__ */ React44.createElement("span", { className: `${className}__category-text__text` }, bankTransaction?.category?.display_name)) : null,
3135
- editable && !open && showRetry ? /* @__PURE__ */ React44.createElement(
3196
+ )}, ${bankTransaction.match.bank_transaction.description}`)), bankTransaction?.categorization_status !== "MATCHED" /* MATCHED */ && bankTransaction?.categorization_status !== "SPLIT" /* SPLIT */ && /* @__PURE__ */ React45.createElement("span", { className: `${className}__category-text__text` }, bankTransaction?.category?.display_name)) : null,
3197
+ editable && !open && showRetry ? /* @__PURE__ */ React45.createElement(
3136
3198
  RetryButton,
3137
3199
  {
3138
3200
  onClick: () => {
@@ -3146,17 +3208,17 @@ var BankTransactionRow = ({
3146
3208
  },
3147
3209
  "Retry"
3148
3210
  ) : null,
3149
- open && bankTransaction.error ? /* @__PURE__ */ React44.createElement(
3211
+ open && bankTransaction.error ? /* @__PURE__ */ React45.createElement(
3150
3212
  Text,
3151
3213
  {
3152
3214
  as: "span",
3153
3215
  size: "md" /* md */,
3154
3216
  className: "Layer__unsaved-info"
3155
3217
  },
3156
- /* @__PURE__ */ React44.createElement("span", null, "Unsaved"),
3157
- /* @__PURE__ */ React44.createElement(AlertCircle_default, { size: 12 })
3218
+ /* @__PURE__ */ React45.createElement("span", null, "Unsaved"),
3219
+ /* @__PURE__ */ React45.createElement(AlertCircle_default, { size: 12 })
3158
3220
  ) : null,
3159
- editable && (open || !open && !showRetry) || !editable && open ? /* @__PURE__ */ React44.createElement(
3221
+ editable && (open || !open && !showRetry) || !editable && open ? /* @__PURE__ */ React45.createElement(
3160
3222
  SubmitButton,
3161
3223
  {
3162
3224
  onClick: () => {
@@ -3171,13 +3233,13 @@ var BankTransactionRow = ({
3171
3233
  },
3172
3234
  editable ? "Approve" : "Update"
3173
3235
  ) : null,
3174
- /* @__PURE__ */ React44.createElement(
3236
+ /* @__PURE__ */ React45.createElement(
3175
3237
  IconButton,
3176
3238
  {
3177
3239
  onClick: toggleOpen,
3178
3240
  className: "Layer__bank-transaction-row__expand-button",
3179
3241
  active: open,
3180
- icon: /* @__PURE__ */ React44.createElement(
3242
+ icon: /* @__PURE__ */ React45.createElement(
3181
3243
  ChevronDownFill_default,
3182
3244
  {
3183
3245
  className: `Layer__chevron ${open ? "Layer__chevron__up" : "Layer__chevron__down"}`
@@ -3187,7 +3249,7 @@ var BankTransactionRow = ({
3187
3249
  )
3188
3250
  )
3189
3251
  )
3190
- ), /* @__PURE__ */ React44.createElement("tr", null, /* @__PURE__ */ React44.createElement("td", { colSpan: 5, className: "Layer__bank-transaction-row__expanded-td" }, /* @__PURE__ */ React44.createElement(
3252
+ ), /* @__PURE__ */ React45.createElement("tr", null, /* @__PURE__ */ React45.createElement("td", { colSpan: 5, className: "Layer__bank-transaction-row__expanded-td" }, /* @__PURE__ */ React45.createElement(
3191
3253
  ExpandedBankTransactionRow,
3192
3254
  {
3193
3255
  ref: expandedRowRef,
@@ -3200,11 +3262,11 @@ var BankTransactionRow = ({
3200
3262
  };
3201
3263
 
3202
3264
  // src/components/BankTransactionListItem/Assignment.tsx
3203
- import React45 from "react";
3265
+ import React46 from "react";
3204
3266
  import { parseISO as parseISO6, format as formatTime5 } from "date-fns";
3205
3267
  var Assignment = ({ bankTransaction }) => {
3206
3268
  if (bankTransaction.match && bankTransaction.categorization_status === "MATCHED" /* MATCHED */) {
3207
- return /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement(
3269
+ return /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(
3208
3270
  MatchBadge,
3209
3271
  {
3210
3272
  classNamePrefix: "Layer__bank-transaction-list-item",
@@ -3212,17 +3274,17 @@ var Assignment = ({ bankTransaction }) => {
3212
3274
  dateFormat: DATE_FORMAT,
3213
3275
  text: "Matched"
3214
3276
  }
3215
- ), /* @__PURE__ */ React45.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, `${formatTime5(
3277
+ ), /* @__PURE__ */ React46.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, `${formatTime5(
3216
3278
  parseISO6(bankTransaction.match.bank_transaction.date),
3217
3279
  DATE_FORMAT
3218
3280
  )}, ${bankTransaction.match.bank_transaction.description}`));
3219
3281
  }
3220
3282
  if (bankTransaction.categorization_status === "SPLIT" /* SPLIT */) {
3221
- return /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement(
3283
+ return /* @__PURE__ */ React46.createElement(React46.Fragment, null, /* @__PURE__ */ React46.createElement(
3222
3284
  Badge,
3223
3285
  {
3224
- icon: /* @__PURE__ */ React45.createElement(Scissors_default, { size: 11 }),
3225
- tooltip: /* @__PURE__ */ React45.createElement(
3286
+ icon: /* @__PURE__ */ React46.createElement(Scissors_default, { size: 11 }),
3287
+ tooltip: /* @__PURE__ */ React46.createElement(
3226
3288
  SplitTooltipDetails,
3227
3289
  {
3228
3290
  classNamePrefix: "Layer__bank-transaction-list-item",
@@ -3231,9 +3293,9 @@ var Assignment = ({ bankTransaction }) => {
3231
3293
  )
3232
3294
  },
3233
3295
  "Split"
3234
- ), /* @__PURE__ */ React45.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, extractDescriptionForSplit(bankTransaction.category)));
3296
+ ), /* @__PURE__ */ React46.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, extractDescriptionForSplit(bankTransaction.category)));
3235
3297
  }
3236
- return /* @__PURE__ */ React45.createElement(Text, null, bankTransaction?.category?.display_name);
3298
+ return /* @__PURE__ */ React46.createElement(Text, null, bankTransaction?.category?.display_name);
3237
3299
  };
3238
3300
 
3239
3301
  // src/components/BankTransactionListItem/BankTransactionListItem.tsx
@@ -3302,26 +3364,26 @@ var BankTransactionListItem = ({
3302
3364
  open ? openClassName : "",
3303
3365
  showComponent ? "show" : ""
3304
3366
  );
3305
- return /* @__PURE__ */ React46.createElement("li", { className: rowClassName }, /* @__PURE__ */ React46.createElement("span", { className: `${className}__heading` }, /* @__PURE__ */ React46.createElement("div", { className: `${className}__heading__main` }, /* @__PURE__ */ React46.createElement("span", { className: `${className}__heading-date` }, formatTime6(parseISO7(bankTransaction.date), dateFormat)), /* @__PURE__ */ React46.createElement("span", { className: `${className}__heading-separator` }), /* @__PURE__ */ React46.createElement("span", { className: `${className}__heading-account-name` }, bankTransaction.account_name ?? "")), /* @__PURE__ */ React46.createElement(
3367
+ return /* @__PURE__ */ React47.createElement("li", { className: rowClassName }, /* @__PURE__ */ React47.createElement("span", { className: `${className}__heading` }, /* @__PURE__ */ React47.createElement("div", { className: `${className}__heading__main` }, /* @__PURE__ */ React47.createElement("span", { className: `${className}__heading-date` }, formatTime6(parseISO7(bankTransaction.date), dateFormat)), /* @__PURE__ */ React47.createElement("span", { className: `${className}__heading-separator` }), /* @__PURE__ */ React47.createElement("span", { className: `${className}__heading-account-name` }, bankTransaction.account_name ?? "")), /* @__PURE__ */ React47.createElement(
3306
3368
  "div",
3307
3369
  {
3308
3370
  onClick: toggleOpen,
3309
3371
  className: "Layer__bank-transaction-row__expand-button"
3310
3372
  },
3311
- /* @__PURE__ */ React46.createElement(
3373
+ /* @__PURE__ */ React47.createElement(
3312
3374
  ChevronDownFill_default,
3313
3375
  {
3314
3376
  className: `Layer__chevron ${open ? "Layer__chevron__up" : "Layer__chevron__down"}`
3315
3377
  }
3316
3378
  )
3317
- )), /* @__PURE__ */ React46.createElement("span", { className: `${className}__body` }, /* @__PURE__ */ React46.createElement("span", { className: `${className}__body__name` }, /* @__PURE__ */ React46.createElement(Text, { as: "span", withTooltip: "whenTruncated" /* whenTruncated */ }, bankTransaction.counterparty_name ?? bankTransaction.description)), /* @__PURE__ */ React46.createElement(
3379
+ )), /* @__PURE__ */ React47.createElement("span", { className: `${className}__body` }, /* @__PURE__ */ React47.createElement("span", { className: `${className}__body__name` }, /* @__PURE__ */ React47.createElement(Text, { as: "span", withTooltip: "whenTruncated" /* whenTruncated */ }, bankTransaction.counterparty_name ?? bankTransaction.description)), /* @__PURE__ */ React47.createElement(
3318
3380
  "span",
3319
3381
  {
3320
3382
  className: `${className}__amount-${isCredit2(bankTransaction) ? "credit" : "debit"}`
3321
3383
  },
3322
3384
  isCredit2(bankTransaction) ? "+$" : " $",
3323
3385
  centsToDollars(bankTransaction.amount)
3324
- )), /* @__PURE__ */ React46.createElement("span", { className: `${className}__expanded-row` }, /* @__PURE__ */ React46.createElement(
3386
+ )), /* @__PURE__ */ React47.createElement("span", { className: `${className}__expanded-row` }, /* @__PURE__ */ React47.createElement(
3325
3387
  ExpandedBankTransactionRow,
3326
3388
  {
3327
3389
  ref: expandedRowRef,
@@ -3332,7 +3394,7 @@ var BankTransactionListItem = ({
3332
3394
  submitBtnText: editable ? "Approve" : "Update",
3333
3395
  containerWidth
3334
3396
  }
3335
- )), /* @__PURE__ */ React46.createElement("span", { className: `${className}__base-row` }, editable ? /* @__PURE__ */ React46.createElement(
3397
+ )), /* @__PURE__ */ React47.createElement("span", { className: `${className}__base-row` }, editable ? /* @__PURE__ */ React47.createElement(
3336
3398
  CategorySelect,
3337
3399
  {
3338
3400
  bankTransaction,
@@ -3344,7 +3406,7 @@ var BankTransactionListItem = ({
3344
3406
  },
3345
3407
  disabled: bankTransaction.processing
3346
3408
  }
3347
- ) : null, !editable ? /* @__PURE__ */ React46.createElement(Assignment, { bankTransaction }) : null, editable && !showRetry ? /* @__PURE__ */ React46.createElement(
3409
+ ) : null, !editable ? /* @__PURE__ */ React47.createElement(Assignment, { bankTransaction }) : null, editable && !showRetry ? /* @__PURE__ */ React47.createElement(
3348
3410
  SubmitButton,
3349
3411
  {
3350
3412
  onClick: () => {
@@ -3357,7 +3419,7 @@ var BankTransactionListItem = ({
3357
3419
  action: editable ? "save" /* SAVE */ : "update" /* UPDATE */
3358
3420
  },
3359
3421
  editable ? "Approve" : "Update"
3360
- ) : null, editable && showRetry ? /* @__PURE__ */ React46.createElement(
3422
+ ) : null, editable && showRetry ? /* @__PURE__ */ React47.createElement(
3361
3423
  RetryButton,
3362
3424
  {
3363
3425
  onClick: () => {
@@ -3370,11 +3432,11 @@ var BankTransactionListItem = ({
3370
3432
  error: "Approval failed. Check connection and retry in few seconds."
3371
3433
  },
3372
3434
  "Retry"
3373
- ) : null), bankTransaction.error && showRetry ? /* @__PURE__ */ React46.createElement(ErrorText, null, "Approval failed. Check connection and retry in few seconds.") : null);
3435
+ ) : null), bankTransaction.error && showRetry ? /* @__PURE__ */ React47.createElement(ErrorText, null, "Approval failed. Check connection and retry in few seconds.") : null);
3374
3436
  };
3375
3437
 
3376
3438
  // src/components/Container/Container.tsx
3377
- import React47, { forwardRef as forwardRef3 } from "react";
3439
+ import React48, { forwardRef as forwardRef3 } from "react";
3378
3440
 
3379
3441
  // src/config/theme.ts
3380
3442
  var SHADES = {
@@ -3613,28 +3675,30 @@ var Container = forwardRef3(
3613
3675
  );
3614
3676
  const { theme } = useLayerContext();
3615
3677
  const styles = parseStylesFromThemeConfig(theme);
3616
- return /* @__PURE__ */ React47.createElement("div", { ref, className: baseClassName, style: { ...styles } }, children);
3678
+ return /* @__PURE__ */ React48.createElement("div", { ref, className: baseClassName, style: { ...styles } }, children);
3617
3679
  }
3618
3680
  );
3619
3681
 
3620
3682
  // src/components/Container/Header.tsx
3621
- import React48, { forwardRef as forwardRef4 } from "react";
3683
+ import React49, { forwardRef as forwardRef4 } from "react";
3622
3684
  import classNames20 from "classnames";
3623
3685
  var Header = forwardRef4(
3624
3686
  ({ className, children, style }, ref) => {
3625
3687
  const baseClassName = classNames20("Layer__component-header", className);
3626
- return /* @__PURE__ */ React48.createElement("header", { ref, className: baseClassName, style }, children);
3688
+ return /* @__PURE__ */ React49.createElement("header", { ref, className: baseClassName, style }, children);
3627
3689
  }
3628
3690
  );
3629
3691
 
3630
3692
  // src/components/DataState/DataState.tsx
3631
- import React49 from "react";
3693
+ import React50 from "react";
3632
3694
  var getIcon = (status) => {
3633
3695
  switch (status) {
3634
3696
  case "failed" /* failed */:
3635
- return /* @__PURE__ */ React49.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--error" }, /* @__PURE__ */ React49.createElement(AlertOctagon_default, { size: 12 }));
3697
+ return /* @__PURE__ */ React50.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--error" }, /* @__PURE__ */ React50.createElement(AlertOctagon_default, { size: 12 }));
3698
+ case "info" /* info */:
3699
+ return /* @__PURE__ */ React50.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ React50.createElement(AlertOctagon_default, { size: 12 }));
3636
3700
  default:
3637
- return /* @__PURE__ */ React49.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ React49.createElement(CheckCircle_default, { size: 12 }));
3701
+ return /* @__PURE__ */ React50.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ React50.createElement(CheckCircle_default, { size: 12 }));
3638
3702
  }
3639
3703
  };
3640
3704
  var DataState = ({
@@ -3644,7 +3708,7 @@ var DataState = ({
3644
3708
  onRefresh,
3645
3709
  isLoading
3646
3710
  }) => {
3647
- return /* @__PURE__ */ React49.createElement("div", { className: "Layer__data-state" }, getIcon(status), /* @__PURE__ */ React49.createElement(
3711
+ return /* @__PURE__ */ React50.createElement("div", { className: "Layer__data-state" }, getIcon(status), /* @__PURE__ */ React50.createElement(
3648
3712
  Text,
3649
3713
  {
3650
3714
  as: "span",
@@ -3653,11 +3717,11 @@ var DataState = ({
3653
3717
  className: "Layer__data-state__title"
3654
3718
  },
3655
3719
  title
3656
- ), /* @__PURE__ */ React49.createElement(Text, { as: "span", className: "Layer__data-state__description" }, description), onRefresh && /* @__PURE__ */ React49.createElement("span", { className: "Layer__data-state__btn" }, /* @__PURE__ */ React49.createElement(
3720
+ ), /* @__PURE__ */ React50.createElement(Text, { as: "span", className: "Layer__data-state__description" }, description), onRefresh && /* @__PURE__ */ React50.createElement("span", { className: "Layer__data-state__btn" }, /* @__PURE__ */ React50.createElement(
3657
3721
  Button,
3658
3722
  {
3659
3723
  variant: "secondary" /* secondary */,
3660
- rightIcon: isLoading ? /* @__PURE__ */ React49.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" }) : /* @__PURE__ */ React49.createElement(RefreshCcw_default, { size: 12 }),
3724
+ rightIcon: isLoading ? /* @__PURE__ */ React50.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" }) : /* @__PURE__ */ React50.createElement(RefreshCcw_default, { size: 12 }),
3661
3725
  onClick: onRefresh,
3662
3726
  disabled: isLoading
3663
3727
  },
@@ -3666,13 +3730,13 @@ var DataState = ({
3666
3730
  };
3667
3731
 
3668
3732
  // src/components/Loader/Loader.tsx
3669
- import React50 from "react";
3733
+ import React51 from "react";
3670
3734
  var Loader2 = ({ children }) => {
3671
- return /* @__PURE__ */ React50.createElement("span", { className: "Layer__loader" }, /* @__PURE__ */ React50.createElement(Loader_default, { size: 28, className: "Layer__anim--rotating" }), children);
3735
+ return /* @__PURE__ */ React51.createElement("span", { className: "Layer__loader" }, /* @__PURE__ */ React51.createElement(Loader_default, { size: 28, className: "Layer__anim--rotating" }), children);
3672
3736
  };
3673
3737
 
3674
3738
  // src/components/Pagination/Pagination.tsx
3675
- import React53 from "react";
3739
+ import React54 from "react";
3676
3740
 
3677
3741
  // src/hooks/usePagination/usePagination.ts
3678
3742
  import { useMemo } from "react";
@@ -3720,8 +3784,8 @@ var usePagination = ({
3720
3784
  };
3721
3785
 
3722
3786
  // src/icons/ChevronLeft.tsx
3723
- import * as React51 from "react";
3724
- var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React51.createElement(
3787
+ import * as React52 from "react";
3788
+ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React52.createElement(
3725
3789
  "svg",
3726
3790
  {
3727
3791
  xmlns: "http://www.w3.org/2000/svg",
@@ -3731,7 +3795,7 @@ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React51.createEle
3731
3795
  fill: "none",
3732
3796
  ...props
3733
3797
  },
3734
- /* @__PURE__ */ React51.createElement(
3798
+ /* @__PURE__ */ React52.createElement(
3735
3799
  "path",
3736
3800
  {
3737
3801
  d: "M11.25 13.5L6.75 9L11.25 4.5",
@@ -3744,8 +3808,8 @@ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React51.createEle
3744
3808
  var ChevronLeft_default = ChevronLeft;
3745
3809
 
3746
3810
  // src/icons/ChevronRight.tsx
3747
- import * as React52 from "react";
3748
- var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React52.createElement(
3811
+ import * as React53 from "react";
3812
+ var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React53.createElement(
3749
3813
  "svg",
3750
3814
  {
3751
3815
  xmlns: "http://www.w3.org/2000/svg",
@@ -3755,7 +3819,7 @@ var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React52.createEl
3755
3819
  fill: "none",
3756
3820
  ...props
3757
3821
  },
3758
- /* @__PURE__ */ React52.createElement(
3822
+ /* @__PURE__ */ React53.createElement(
3759
3823
  "path",
3760
3824
  {
3761
3825
  d: "M6.75 13.5L11.25 9L6.75 4.5",
@@ -3789,7 +3853,7 @@ var Pagination = ({
3789
3853
  return;
3790
3854
  }
3791
3855
  let lastPage = paginationRange[paginationRange.length - 1];
3792
- return /* @__PURE__ */ React53.createElement("ul", { className: "Layer__pagination" }, /* @__PURE__ */ React53.createElement(
3856
+ return /* @__PURE__ */ React54.createElement("ul", { className: "Layer__pagination" }, /* @__PURE__ */ React54.createElement(
3793
3857
  "li",
3794
3858
  {
3795
3859
  key: `page-prev`,
@@ -3801,12 +3865,12 @@ var Pagination = ({
3801
3865
  ),
3802
3866
  onClick: () => onPageChange(currentPage - 1)
3803
3867
  },
3804
- /* @__PURE__ */ React53.createElement(ChevronLeft_default, { size: 12 })
3868
+ /* @__PURE__ */ React54.createElement(ChevronLeft_default, { size: 12 })
3805
3869
  ), paginationRange.map((pageNumber) => {
3806
3870
  if (pageNumber === DOTS) {
3807
- return /* @__PURE__ */ React53.createElement("li", { className: "Layer__pagination-item Layer__pagination-dots" }, "\u2026");
3871
+ return /* @__PURE__ */ React54.createElement("li", { className: "Layer__pagination-item Layer__pagination-dots" }, "\u2026");
3808
3872
  }
3809
- return /* @__PURE__ */ React53.createElement(
3873
+ return /* @__PURE__ */ React54.createElement(
3810
3874
  "li",
3811
3875
  {
3812
3876
  key: `page-${pageNumber}`,
@@ -3821,7 +3885,7 @@ var Pagination = ({
3821
3885
  },
3822
3886
  pageNumber
3823
3887
  );
3824
- }), /* @__PURE__ */ React53.createElement(
3888
+ }), /* @__PURE__ */ React54.createElement(
3825
3889
  "li",
3826
3890
  {
3827
3891
  key: `page-last`,
@@ -3833,7 +3897,7 @@ var Pagination = ({
3833
3897
  ),
3834
3898
  onClick: () => onPageChange(currentPage + 1)
3835
3899
  },
3836
- /* @__PURE__ */ React53.createElement(ChevronRight_default, { size: 12 })
3900
+ /* @__PURE__ */ React54.createElement(ChevronRight_default, { size: 12 })
3837
3901
  ));
3838
3902
  };
3839
3903
 
@@ -3905,7 +3969,7 @@ var BankTransactions = ({
3905
3969
  debounceContainerWidth(size?.width);
3906
3970
  });
3907
3971
  const editable = display === "review" /* review */;
3908
- return /* @__PURE__ */ React54.createElement(
3972
+ return /* @__PURE__ */ React55.createElement(
3909
3973
  Container,
3910
3974
  {
3911
3975
  className: editable ? "Layer__bank-transactions--to-review" : "Layer__bank-transactions--categorized",
@@ -3913,14 +3977,14 @@ var BankTransactions = ({
3913
3977
  asWidget,
3914
3978
  ref: containerRef
3915
3979
  },
3916
- /* @__PURE__ */ React54.createElement(
3980
+ /* @__PURE__ */ React55.createElement(
3917
3981
  Header,
3918
3982
  {
3919
3983
  className: "Layer__bank-transactions__header",
3920
3984
  style: { top: shiftStickyHeader }
3921
3985
  },
3922
- /* @__PURE__ */ React54.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
3923
- /* @__PURE__ */ React54.createElement(
3986
+ /* @__PURE__ */ React55.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
3987
+ /* @__PURE__ */ React55.createElement(
3924
3988
  Toggle,
3925
3989
  {
3926
3990
  name: "bank-transaction-display",
@@ -3933,15 +3997,15 @@ var BankTransactions = ({
3933
3997
  }
3934
3998
  )
3935
3999
  ),
3936
- !listView && /* @__PURE__ */ React54.createElement(
4000
+ !listView && /* @__PURE__ */ React55.createElement(
3937
4001
  "table",
3938
4002
  {
3939
4003
  width: "100%",
3940
4004
  className: "Layer__table Layer__bank-transactions__table with-cell-separators"
3941
4005
  },
3942
- /* @__PURE__ */ React54.createElement("thead", null, /* @__PURE__ */ React54.createElement("tr", null, /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__bank-transactions__date-col" }, "Date"), /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__bank-transactions__tx-col" }, "Transaction"), /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__bank-transactions__account-col" }, "Account"), /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__table-cell--amount Layer__table-cell__amount-col" }, "Amount"), editable ? /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__table-header--primary Layer__table-cell__category-col" }, "Categorize") : /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__table-cell__category-col" }, "Category"))),
3943
- /* @__PURE__ */ React54.createElement("tbody", null, !isLoading && bankTransactions?.map(
3944
- (bankTransaction, index) => /* @__PURE__ */ React54.createElement(
4006
+ /* @__PURE__ */ React55.createElement("thead", null, /* @__PURE__ */ React55.createElement("tr", null, /* @__PURE__ */ React55.createElement("th", { className: "Layer__table-header Layer__bank-transactions__date-col" }, "Date"), /* @__PURE__ */ React55.createElement("th", { className: "Layer__table-header Layer__bank-transactions__tx-col" }, "Transaction"), /* @__PURE__ */ React55.createElement("th", { className: "Layer__table-header Layer__bank-transactions__account-col" }, "Account"), /* @__PURE__ */ React55.createElement("th", { className: "Layer__table-header Layer__table-cell--amount Layer__table-cell__amount-col" }, "Amount"), editable ? /* @__PURE__ */ React55.createElement("th", { className: "Layer__table-header Layer__table-header--primary Layer__table-cell__category-col" }, "Categorize") : /* @__PURE__ */ React55.createElement("th", { className: "Layer__table-header Layer__table-cell__category-col" }, "Category"))),
4007
+ /* @__PURE__ */ React55.createElement("tbody", null, !isLoading && bankTransactions?.map(
4008
+ (bankTransaction, index) => /* @__PURE__ */ React55.createElement(
3945
4009
  BankTransactionRow,
3946
4010
  {
3947
4011
  index,
@@ -3955,9 +4019,9 @@ var BankTransactions = ({
3955
4019
  )
3956
4020
  ))
3957
4021
  ),
3958
- isLoading && !bankTransactions ? /* @__PURE__ */ React54.createElement("div", { className: "Layer__bank-transactions__loader-container" }, /* @__PURE__ */ React54.createElement(Loader2, null)) : null,
3959
- !isLoading && listView ? /* @__PURE__ */ React54.createElement("ul", { className: "Layer__bank-transactions__list" }, bankTransactions?.map(
3960
- (bankTransaction, index) => /* @__PURE__ */ React54.createElement(
4022
+ isLoading && !bankTransactions ? /* @__PURE__ */ React55.createElement("div", { className: "Layer__bank-transactions__loader-container" }, /* @__PURE__ */ React55.createElement(Loader2, null)) : null,
4023
+ !isLoading && listView ? /* @__PURE__ */ React55.createElement("ul", { className: "Layer__bank-transactions__list" }, bankTransactions?.map(
4024
+ (bankTransaction, index) => /* @__PURE__ */ React55.createElement(
3961
4025
  BankTransactionListItem,
3962
4026
  {
3963
4027
  index,
@@ -3970,7 +4034,7 @@ var BankTransactions = ({
3970
4034
  }
3971
4035
  )
3972
4036
  )) : null,
3973
- !isLoading && !error && (bankTransactions === void 0 || bankTransactions !== void 0 && bankTransactions.length === 0) ? /* @__PURE__ */ React54.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React54.createElement(
4037
+ !isLoading && !error && (bankTransactions === void 0 || bankTransactions !== void 0 && bankTransactions.length === 0) ? /* @__PURE__ */ React55.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React55.createElement(
3974
4038
  DataState,
3975
4039
  {
3976
4040
  status: "allDone" /* allDone */,
@@ -3980,7 +4044,7 @@ var BankTransactions = ({
3980
4044
  isLoading: isValidating
3981
4045
  }
3982
4046
  )) : null,
3983
- !isLoading && error ? /* @__PURE__ */ React54.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React54.createElement(
4047
+ !isLoading && error ? /* @__PURE__ */ React55.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React55.createElement(
3984
4048
  DataState,
3985
4049
  {
3986
4050
  status: "failed" /* failed */,
@@ -3990,7 +4054,7 @@ var BankTransactions = ({
3990
4054
  isLoading: isValidating
3991
4055
  }
3992
4056
  )) : null,
3993
- /* @__PURE__ */ React54.createElement("div", { className: "Layer__bank-transactions__pagination" }, /* @__PURE__ */ React54.createElement(
4057
+ /* @__PURE__ */ React55.createElement("div", { className: "Layer__bank-transactions__pagination" }, /* @__PURE__ */ React55.createElement(
3994
4058
  Pagination,
3995
4059
  {
3996
4060
  currentPage,
@@ -4003,7 +4067,7 @@ var BankTransactions = ({
4003
4067
  };
4004
4068
 
4005
4069
  // src/components/Hello/Hello.tsx
4006
- import React55 from "react";
4070
+ import React56 from "react";
4007
4071
  import useSWR3 from "swr";
4008
4072
  var fetcher = (url) => fetch(url).then((res) => res.json());
4009
4073
  var Hello = ({ user }) => {
@@ -4012,11 +4076,11 @@ var Hello = ({ user }) => {
4012
4076
  fetcher
4013
4077
  );
4014
4078
  const name = (isLoading ? "..." : data?.name) || "User";
4015
- return /* @__PURE__ */ React55.createElement(React55.Fragment, null, /* @__PURE__ */ React55.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
4079
+ return /* @__PURE__ */ React56.createElement(React56.Fragment, null, /* @__PURE__ */ React56.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
4016
4080
  };
4017
4081
 
4018
4082
  // src/components/LinkedAccounts/LinkedAccounts.tsx
4019
- import React57 from "react";
4083
+ import React58 from "react";
4020
4084
 
4021
4085
  // src/hooks/useLinkedAccounts/useLinkedAccounts.ts
4022
4086
  import { useEffect as useEffect7, useState as useState11 } from "react";
@@ -4034,7 +4098,7 @@ var MOCK_DATA = [
4034
4098
  {
4035
4099
  name: "Account",
4036
4100
  account: "4321",
4037
- amount: 801.91
4101
+ amount: 4400020620
4038
4102
  }
4039
4103
  ];
4040
4104
  var useLinkedAccounts = () => {
@@ -4066,23 +4130,23 @@ var useLinkedAccounts = () => {
4066
4130
  };
4067
4131
 
4068
4132
  // src/components/LinkedAccounts/LinkedAccountThumb.tsx
4069
- import React56 from "react";
4133
+ import React57 from "react";
4070
4134
  var LinkedAccountThumb = ({ account }) => {
4071
- return /* @__PURE__ */ React56.createElement("div", { className: "Layer__linked-account-thumb" }, /* @__PURE__ */ React56.createElement("div", { className: "topbar" }, /* @__PURE__ */ React56.createElement(Text, { as: "span", className: "account-name" }, account.name), /* @__PURE__ */ React56.createElement(Text, { as: "span", className: "account-number" }, "\u2022\u2022\u2022", account.account)), /* @__PURE__ */ React56.createElement("div", { className: "bottombar" }, /* @__PURE__ */ React56.createElement(Text, { as: "span", className: "account-amount" }, "$", centsToDollars(account.amount))));
4135
+ return /* @__PURE__ */ React57.createElement("div", { className: "Layer__linked-account-thumb" }, /* @__PURE__ */ React57.createElement("div", { className: "topbar" }, /* @__PURE__ */ React57.createElement(Text, { as: "span", className: "account-name" }, account.name), /* @__PURE__ */ React57.createElement(Text, { as: "span", className: "account-number" }, "\u2022\u2022\u2022", account.account)), /* @__PURE__ */ React57.createElement("div", { className: "bottombar" }, /* @__PURE__ */ React57.createElement(Text, { as: "span", className: "account-amount" }, "$", centsToDollars(account.amount))));
4072
4136
  };
4073
4137
 
4074
4138
  // src/components/LinkedAccounts/LinkedAccounts.tsx
4075
4139
  var COMPONENT_NAME2 = "linked-accounts";
4076
4140
  var LinkedAccounts = () => {
4077
4141
  const { data, isLoading, error, isValidating, refetch } = useLinkedAccounts();
4078
- return /* @__PURE__ */ React57.createElement(Container, { name: COMPONENT_NAME2 }, /* @__PURE__ */ React57.createElement(Header, { className: "Layer__linked-accounts__header" }, /* @__PURE__ */ React57.createElement(
4142
+ return /* @__PURE__ */ React58.createElement(Container, { name: COMPONENT_NAME2 }, /* @__PURE__ */ React58.createElement(Header, { className: "Layer__linked-accounts__header" }, /* @__PURE__ */ React58.createElement(
4079
4143
  Heading,
4080
4144
  {
4081
4145
  className: "Layer__linked-accounts__title",
4082
4146
  size: "secondary" /* secondary */
4083
4147
  },
4084
4148
  "Linked Accounts"
4085
- )), isLoading && /* @__PURE__ */ React57.createElement("div", { className: "Layer__linked-accounts__loader-container" }, /* @__PURE__ */ React57.createElement(Loader2, null)), error && !isLoading ? /* @__PURE__ */ React57.createElement(
4149
+ )), isLoading && /* @__PURE__ */ React58.createElement("div", { className: "Layer__linked-accounts__loader-container" }, /* @__PURE__ */ React58.createElement(Loader2, null)), error && !isLoading ? /* @__PURE__ */ React58.createElement(
4086
4150
  DataState,
4087
4151
  {
4088
4152
  status: "failed" /* failed */,
@@ -4091,11 +4155,11 @@ var LinkedAccounts = () => {
4091
4155
  onRefresh: () => refetch(),
4092
4156
  isLoading: isValidating
4093
4157
  }
4094
- ) : null, !error && !isLoading ? /* @__PURE__ */ React57.createElement("div", { className: "Layer__linked-accounts__list" }, data?.map((account, index) => /* @__PURE__ */ React57.createElement(LinkedAccountThumb, { account, key: `linked-acc-${index}` }))) : null);
4158
+ ) : null, !error && !isLoading ? /* @__PURE__ */ React58.createElement("div", { className: "Layer__linked-accounts__list" }, data?.map((account, index) => /* @__PURE__ */ React58.createElement(LinkedAccountThumb, { account, key: `linked-acc-${index}` }))) : null);
4095
4159
  };
4096
4160
 
4097
4161
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
4098
- import React65, { createContext as createContext2 } from "react";
4162
+ import React68, { createContext as createContext2 } from "react";
4099
4163
 
4100
4164
  // src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
4101
4165
  import { useMemo as useMemo3, useState as useState12 } from "react";
@@ -4177,7 +4241,7 @@ var useProfitAndLoss = ({
4177
4241
  expenses: void 0,
4178
4242
  revenue: void 0
4179
4243
  });
4180
- const [sidebarScope, setSidebarScope] = useState12("expenses");
4244
+ const [sidebarScope, setSidebarScope] = useState12(void 0);
4181
4245
  const {
4182
4246
  data: rawData,
4183
4247
  isLoading,
@@ -4285,7 +4349,7 @@ var useProfitAndLoss = ({
4285
4349
  };
4286
4350
 
4287
4351
  // src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
4288
- import React59, { useContext as useContext2, useMemo as useMemo4, useState as useState13 } from "react";
4352
+ import React60, { useContext as useContext2, useMemo as useMemo4, useState as useState13 } from "react";
4289
4353
 
4290
4354
  // src/utils/format.ts
4291
4355
  var capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
@@ -4323,7 +4387,7 @@ var formatPercent = (value, options) => {
4323
4387
  };
4324
4388
 
4325
4389
  // src/components/ProfitAndLossChart/Indicator.tsx
4326
- import React58, { useEffect as useEffect8 } from "react";
4390
+ import React59, { useEffect as useEffect8 } from "react";
4327
4391
  var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
4328
4392
  var Indicator = ({
4329
4393
  viewBox = {},
@@ -4335,25 +4399,26 @@ var Indicator = ({
4335
4399
  return null;
4336
4400
  }
4337
4401
  const { x: animateTo = 0, width = 0 } = "x" in viewBox ? viewBox : emptyViewBox;
4338
- const boxWidth = width * 2 + 4;
4339
- const multiplier = 1.5;
4402
+ const margin = width > 12 ? 4 : 1;
4403
+ const boxWidth = width * 2 + margin;
4404
+ const multiplier = width > 12 ? 1.2 : 1;
4340
4405
  const xOffset = (boxWidth * multiplier - boxWidth) / 2;
4406
+ const borderRadius = width > 16 ? 8 : width / 2;
4341
4407
  useEffect8(() => {
4342
4408
  setAnimateFrom(animateTo);
4343
4409
  }, [animateTo]);
4344
4410
  const actualX = animateFrom === -1 ? animateTo : animateFrom;
4345
- return /* @__PURE__ */ React58.createElement(
4411
+ return /* @__PURE__ */ React59.createElement(
4346
4412
  "rect",
4347
4413
  {
4348
4414
  className: "Layer__profit-and-loss-chart__selection-indicator",
4349
- rx: "8",
4350
- ry: "8",
4415
+ rx: borderRadius,
4416
+ ry: borderRadius,
4351
4417
  style: {
4352
4418
  width: `${boxWidth * multiplier}px`,
4353
4419
  // @ts-expect-error -- y is fine but x apparently isn't!
4354
4420
  x: actualX - xOffset,
4355
4421
  y: 22,
4356
- borderRadius: 8,
4357
4422
  height: "calc(100% - 38px)"
4358
4423
  }
4359
4424
  }
@@ -4460,6 +4525,7 @@ var ProfitAndLossChart = () => {
4460
4525
  name: getMonthName(pnl),
4461
4526
  revenue: pnl?.income.value || 0,
4462
4527
  expenses: Math.abs((pnl?.income.value || 0) - (pnl?.net_profit || 0)),
4528
+ netProfit: pnl?.net_profit || 0,
4463
4529
  selected: !!pnl && parseISO8(pnl.start_date).getMonth() >= startSelectionMonth && parseISO8(pnl.end_date).getMonth() <= endSelectionMonth
4464
4530
  });
4465
4531
  const onClick = ({ activeTooltipIndex }) => {
@@ -4478,22 +4544,24 @@ var ProfitAndLossChart = () => {
4478
4544
  label
4479
4545
  }) => {
4480
4546
  if (active && payload && payload.length) {
4481
- return /* @__PURE__ */ React59.createElement("div", { className: "Layer__chart__tooltip" }, /* @__PURE__ */ React59.createElement("ul", { className: "Layer__chart__tooltip-list" }, /* @__PURE__ */ React59.createElement("li", null, /* @__PURE__ */ React59.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[0].name ?? "")), /* @__PURE__ */ React59.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[0].value ?? 0)))), /* @__PURE__ */ React59.createElement("li", null, /* @__PURE__ */ React59.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[1].name ?? "")), /* @__PURE__ */ React59.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[1].value ?? 0))))));
4547
+ const netProfit = payload[0].payload.netProfit ?? 0;
4548
+ const netProfitClass = netProfit > 0 ? "positive" : netProfit < 0 ? "negative" : "";
4549
+ return /* @__PURE__ */ React60.createElement("div", { className: "Layer__chart__tooltip" }, /* @__PURE__ */ React60.createElement("ul", { className: "Layer__chart__tooltip-list" }, /* @__PURE__ */ React60.createElement("li", null, /* @__PURE__ */ React60.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[0].name ?? "")), /* @__PURE__ */ React60.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[0].value ?? 0)))), /* @__PURE__ */ React60.createElement("li", null, /* @__PURE__ */ React60.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[1].name ?? "")), /* @__PURE__ */ React60.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[1].value ?? 0)))), /* @__PURE__ */ React60.createElement("li", null, /* @__PURE__ */ React60.createElement("label", { className: "Layer__chart__tooltip-label" }, "Net Profit"), /* @__PURE__ */ React60.createElement("span", { className: `Layer__chart__tooltip-value ${netProfitClass}` }, "$", centsToDollars(netProfit)))));
4482
4550
  }
4483
4551
  return null;
4484
4552
  };
4485
4553
  const CustomizedCursor = (props) => {
4486
- const { x, y, width, height } = props;
4487
- return /* @__PURE__ */ React59.createElement(
4554
+ const { x, width, height } = props;
4555
+ return /* @__PURE__ */ React60.createElement(
4488
4556
  Rectangle,
4489
4557
  {
4490
- fill: getColor(100)?.hex ?? "#F5F4F3",
4558
+ fill: getColor(900)?.hex ?? "#333",
4491
4559
  stroke: "none",
4492
- x,
4493
- y,
4494
- radius: 8,
4495
- width,
4496
- height: height + 24,
4560
+ x: x + width / 2 - 11,
4561
+ y: height + 44,
4562
+ radius: 2,
4563
+ width: 22,
4564
+ height: 2,
4497
4565
  className: "Layer__chart__tooltip-cursor"
4498
4566
  }
4499
4567
  );
@@ -4507,7 +4575,7 @@ var ProfitAndLossChart = () => {
4507
4575
  ]
4508
4576
  );
4509
4577
  const [animateFrom, setAnimateFrom] = useState13(-1);
4510
- return /* @__PURE__ */ React59.createElement(
4578
+ return /* @__PURE__ */ React60.createElement(
4511
4579
  ResponsiveContainer,
4512
4580
  {
4513
4581
  className: "Layer__chart-container",
@@ -4515,7 +4583,7 @@ var ProfitAndLossChart = () => {
4515
4583
  height: "100%",
4516
4584
  minHeight: 200
4517
4585
  },
4518
- /* @__PURE__ */ React59.createElement(
4586
+ /* @__PURE__ */ React60.createElement(
4519
4587
  BarChart,
4520
4588
  {
4521
4589
  margin: { left: 12, right: 12, bottom: 12 },
@@ -4524,17 +4592,17 @@ var ProfitAndLossChart = () => {
4524
4592
  barGap,
4525
4593
  className: "Layer__profit-and-loss-chart"
4526
4594
  },
4527
- /* @__PURE__ */ React59.createElement(
4595
+ /* @__PURE__ */ React60.createElement(
4528
4596
  Tooltip2,
4529
4597
  {
4530
4598
  wrapperClassName: "Layer__chart__tooltip-wrapper",
4531
- content: /* @__PURE__ */ React59.createElement(CustomTooltip, null),
4532
- cursor: /* @__PURE__ */ React59.createElement(CustomizedCursor, null),
4599
+ content: /* @__PURE__ */ React60.createElement(CustomTooltip, null),
4600
+ cursor: /* @__PURE__ */ React60.createElement(CustomizedCursor, null),
4533
4601
  animationDuration: 100,
4534
4602
  animationEasing: "ease-out"
4535
4603
  }
4536
4604
  ),
4537
- /* @__PURE__ */ React59.createElement(
4605
+ /* @__PURE__ */ React60.createElement(
4538
4606
  CartesianGrid,
4539
4607
  {
4540
4608
  vertical: false,
@@ -4542,7 +4610,7 @@ var ProfitAndLossChart = () => {
4542
4610
  strokeDasharray: "5 5"
4543
4611
  }
4544
4612
  ),
4545
- /* @__PURE__ */ React59.createElement(
4613
+ /* @__PURE__ */ React60.createElement(
4546
4614
  Legend,
4547
4615
  {
4548
4616
  verticalAlign: "top",
@@ -4550,7 +4618,7 @@ var ProfitAndLossChart = () => {
4550
4618
  wrapperStyle: { top: -24 },
4551
4619
  payload: [
4552
4620
  {
4553
- value: "Income",
4621
+ value: "Revenue",
4554
4622
  type: "circle",
4555
4623
  id: "IncomeLegend"
4556
4624
  },
@@ -4562,20 +4630,20 @@ var ProfitAndLossChart = () => {
4562
4630
  ]
4563
4631
  }
4564
4632
  ),
4565
- /* @__PURE__ */ React59.createElement(XAxis, { dataKey: "name", tickLine: false }),
4566
- /* @__PURE__ */ React59.createElement(
4633
+ /* @__PURE__ */ React60.createElement(XAxis, { dataKey: "name", tickLine: false }),
4634
+ /* @__PURE__ */ React60.createElement(
4567
4635
  Bar,
4568
4636
  {
4569
4637
  dataKey: "revenue",
4570
4638
  barSize,
4571
4639
  isAnimationActive: false,
4572
- radius: [barSize / 4, barSize / 4, 0, 0],
4640
+ radius: [2, 2, 0, 0],
4573
4641
  className: "Layer__profit-and-loss-chart__bar--income"
4574
4642
  },
4575
- /* @__PURE__ */ React59.createElement(
4643
+ /* @__PURE__ */ React60.createElement(
4576
4644
  LabelList,
4577
4645
  {
4578
- content: /* @__PURE__ */ React59.createElement(
4646
+ content: /* @__PURE__ */ React60.createElement(
4579
4647
  Indicator,
4580
4648
  {
4581
4649
  animateFrom,
@@ -4584,7 +4652,7 @@ var ProfitAndLossChart = () => {
4584
4652
  )
4585
4653
  }
4586
4654
  ),
4587
- data.map((entry) => /* @__PURE__ */ React59.createElement(
4655
+ data.map((entry) => /* @__PURE__ */ React60.createElement(
4588
4656
  Cell,
4589
4657
  {
4590
4658
  key: entry.name,
@@ -4592,16 +4660,16 @@ var ProfitAndLossChart = () => {
4592
4660
  }
4593
4661
  ))
4594
4662
  ),
4595
- /* @__PURE__ */ React59.createElement(
4663
+ /* @__PURE__ */ React60.createElement(
4596
4664
  Bar,
4597
4665
  {
4598
4666
  dataKey: "expenses",
4599
4667
  barSize,
4600
4668
  isAnimationActive: false,
4601
- radius: [barSize / 4, barSize / 4, 0, 0],
4669
+ radius: [2, 2, 0, 0],
4602
4670
  className: "Layer__profit-and-loss-chart__bar--expenses"
4603
4671
  },
4604
- data.map((entry) => /* @__PURE__ */ React59.createElement(
4672
+ data.map((entry) => /* @__PURE__ */ React60.createElement(
4605
4673
  Cell,
4606
4674
  {
4607
4675
  key: entry.name,
@@ -4614,7 +4682,7 @@ var ProfitAndLossChart = () => {
4614
4682
  };
4615
4683
 
4616
4684
  // src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
4617
- import React60, { useContext as useContext3 } from "react";
4685
+ import React61, { useContext as useContext3 } from "react";
4618
4686
  import { add, endOfMonth as endOfMonth3, format as format5, startOfMonth as startOfMonth3 } from "date-fns";
4619
4687
  var ProfitAndLossDatePicker = () => {
4620
4688
  const { changeDateRange, dateRange } = useContext3(ProfitAndLoss.Context);
@@ -4629,42 +4697,42 @@ var ProfitAndLossDatePicker = () => {
4629
4697
  };
4630
4698
  const previousMonth = () => change({ months: -1 });
4631
4699
  const nextMonth = () => change({ months: 1 });
4632
- return /* @__PURE__ */ React60.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ React60.createElement(
4700
+ return /* @__PURE__ */ React61.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ React61.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, label), /* @__PURE__ */ React61.createElement(
4633
4701
  "button",
4634
4702
  {
4635
4703
  "aria-label": "View Previous Month",
4636
4704
  className: "Layer__profit-and-loss-date-picker__button",
4637
4705
  onClick: previousMonth
4638
4706
  },
4639
- /* @__PURE__ */ React60.createElement(
4707
+ /* @__PURE__ */ React61.createElement(
4640
4708
  ChevronLeft_default,
4641
4709
  {
4642
4710
  className: "Layer__profit-and-loss-date-picker__button-icon",
4643
- size: 18
4711
+ size: 16
4644
4712
  }
4645
4713
  )
4646
- ), /* @__PURE__ */ React60.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, label), /* @__PURE__ */ React60.createElement(
4714
+ ), /* @__PURE__ */ React61.createElement(
4647
4715
  "button",
4648
4716
  {
4649
4717
  "aria-label": "View Next Month",
4650
4718
  className: "Layer__profit-and-loss-date-picker__button",
4651
4719
  onClick: nextMonth
4652
4720
  },
4653
- /* @__PURE__ */ React60.createElement(
4721
+ /* @__PURE__ */ React61.createElement(
4654
4722
  ChevronRight_default,
4655
4723
  {
4656
4724
  className: "Layer__profit-and-loss-date-picker__button-icon",
4657
- size: 18
4725
+ size: 16
4658
4726
  }
4659
4727
  )
4660
4728
  ));
4661
4729
  };
4662
4730
 
4663
4731
  // src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
4664
- import React62, { useContext as useContext4 } from "react";
4732
+ import React64, { useContext as useContext4, useMemo as useMemo5 } from "react";
4665
4733
 
4666
4734
  // src/components/SkeletonLoader/SkeletonLoader.tsx
4667
- import React61 from "react";
4735
+ import React62 from "react";
4668
4736
  import classNames21 from "classnames";
4669
4737
  var SkeletonLoader = ({
4670
4738
  height,
@@ -4675,11 +4743,161 @@ var SkeletonLoader = ({
4675
4743
  "Layer__skeleton-loader Layer__anim--skeleton-loading",
4676
4744
  className
4677
4745
  );
4678
- return /* @__PURE__ */ React61.createElement("div", { className: baseClassName, style: { width, height } });
4746
+ return /* @__PURE__ */ React62.createElement("div", { className: baseClassName, style: { width, height } });
4747
+ };
4748
+
4749
+ // src/components/ProfitAndLossSummaries/MiniChart.tsx
4750
+ import React63 from "react";
4751
+
4752
+ // src/config/charts.ts
4753
+ var INACTIVE_OPACITY_LEVELS = [
4754
+ 0.85,
4755
+ 0.7,
4756
+ 0.66,
4757
+ 0.55,
4758
+ 0.4,
4759
+ 0.33,
4760
+ 0.25,
4761
+ 0.15
4762
+ ];
4763
+ var DEFAULT_CHART_COLORS = [
4764
+ {
4765
+ color: "#7417B3",
4766
+ opacity: 1
4767
+ },
4768
+ {
4769
+ color: "#7417B3",
4770
+ opacity: 0.8
4771
+ },
4772
+ {
4773
+ color: "#7417B3",
4774
+ opacity: 0.6
4775
+ },
4776
+ {
4777
+ color: "#7417B3",
4778
+ opacity: 0.4
4779
+ },
4780
+ {
4781
+ color: "#7417B3",
4782
+ opacity: 0.2
4783
+ },
4784
+ {
4785
+ color: "#7417B3",
4786
+ opacity: 0.1
4787
+ },
4788
+ {
4789
+ color: "#006A80",
4790
+ opacity: 1
4791
+ },
4792
+ {
4793
+ color: "#006A80",
4794
+ opacity: 0.8
4795
+ },
4796
+ {
4797
+ color: "#006A80",
4798
+ opacity: 0.6
4799
+ },
4800
+ {
4801
+ color: "#006A80",
4802
+ opacity: 0.4
4803
+ },
4804
+ {
4805
+ color: "#006A80",
4806
+ opacity: 0.2
4807
+ },
4808
+ {
4809
+ color: "#006A80",
4810
+ opacity: 0.1
4811
+ },
4812
+ {
4813
+ color: "#009930",
4814
+ opacity: 1
4815
+ },
4816
+ {
4817
+ color: "#009930",
4818
+ opacity: 0.8
4819
+ },
4820
+ {
4821
+ color: "#009930",
4822
+ opacity: 0.6
4823
+ },
4824
+ {
4825
+ color: "#009930",
4826
+ opacity: 0.4
4827
+ },
4828
+ {
4829
+ color: "#009930",
4830
+ opacity: 0.2
4831
+ },
4832
+ {
4833
+ color: "#009930",
4834
+ opacity: 0.1
4835
+ }
4836
+ ];
4837
+
4838
+ // src/components/ProfitAndLossSummaries/MiniChart.tsx
4839
+ import { PieChart, Pie, Cell as Cell2 } from "recharts";
4840
+ var MiniChart = ({ data }) => {
4841
+ return /* @__PURE__ */ React63.createElement(PieChart, { width: 48, height: 48, className: "mini-chart" }, /* @__PURE__ */ React63.createElement(
4842
+ Pie,
4843
+ {
4844
+ data,
4845
+ dataKey: "value",
4846
+ nameKey: "name",
4847
+ cx: "50%",
4848
+ cy: "50%",
4849
+ innerRadius: 10,
4850
+ outerRadius: 16,
4851
+ paddingAngle: 0.2,
4852
+ fill: "#8884d8",
4853
+ width: 24,
4854
+ height: 24,
4855
+ animationDuration: 250,
4856
+ animationEasing: "ease-in-out"
4857
+ },
4858
+ data.map((entry, index) => {
4859
+ const colorConfig = DEFAULT_CHART_COLORS[index % DEFAULT_CHART_COLORS.length];
4860
+ return /* @__PURE__ */ React63.createElement(
4861
+ Cell2,
4862
+ {
4863
+ key: `cell-${index}`,
4864
+ className: `Layer__profit-and-loss-detailed-charts__pie`,
4865
+ fill: entry.name === "placeholder" ? "#e6e6e6" : colorConfig.color,
4866
+ opacity: colorConfig.opacity
4867
+ }
4868
+ );
4869
+ })
4870
+ ));
4679
4871
  };
4680
4872
 
4681
4873
  // src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
4682
4874
  import classNames22 from "classnames";
4875
+ var CHART_PLACEHOLDER = [
4876
+ {
4877
+ name: "placeholder",
4878
+ display_name: "placeholder",
4879
+ value: 1,
4880
+ type: "placeholder",
4881
+ share: 1
4882
+ }
4883
+ ];
4884
+ var buildMiniChartData = (scope, data) => {
4885
+ if (!data) {
4886
+ return CHART_PLACEHOLDER;
4887
+ }
4888
+ let items = [];
4889
+ switch (scope) {
4890
+ case "revenue":
4891
+ items = collectRevenueItems(data);
4892
+ break;
4893
+ default:
4894
+ items = collectExpensesItems(data);
4895
+ }
4896
+ if (!items || items.length === 0 || !items.find((x) => Math.abs(x.value) !== 0)) {
4897
+ return CHART_PLACEHOLDER;
4898
+ }
4899
+ return items.slice();
4900
+ };
4683
4901
  var ProfitAndLossSummaries = ({
4684
4902
  vertical,
4685
4903
  revenueLabel = "Revenue"
@@ -4690,16 +4908,22 @@ var ProfitAndLossSummaries = ({
4690
4908
  setSidebarScope,
4691
4909
  sidebarScope
4692
4910
  } = useContext4(ProfitAndLoss.Context);
4911
+ const expensesChartData = useMemo5(() => {
4912
+ return buildMiniChartData("expenses", storedData);
4913
+ }, [storedData]);
4914
+ const revenueChartData = useMemo5(() => {
4915
+ return buildMiniChartData("revenue", storedData);
4916
+ }, [storedData]);
4693
4917
  const data = storedData ? storedData : { income: { value: NaN }, net_profit: NaN };
4694
4918
  const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
4695
4919
  const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
4696
4920
  const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
4697
- return /* @__PURE__ */ React62.createElement(
4921
+ return /* @__PURE__ */ React64.createElement(
4698
4922
  "div",
4699
4923
  {
4700
4924
  className: `Layer__profit-and-loss-summaries ${vertical ? "flex-col" : ""}`
4701
4925
  },
4702
- /* @__PURE__ */ React62.createElement(
4926
+ /* @__PURE__ */ React64.createElement(
4703
4927
  "div",
4704
4928
  {
4705
4929
  className: classNames22(
@@ -4709,16 +4933,16 @@ var ProfitAndLossSummaries = ({
4709
4933
  ),
4710
4934
  onClick: () => setSidebarScope("revenue")
4711
4935
  },
4712
- /* @__PURE__ */ React62.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, revenueLabel),
4713
- isLoading || storedData === void 0 ? /* @__PURE__ */ React62.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React62.createElement(SkeletonLoader, null)) : /* @__PURE__ */ React62.createElement(
4936
+ /* @__PURE__ */ React64.createElement(MiniChart, { data: revenueChartData }),
4937
+ /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ React64.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, revenueLabel), isLoading || storedData === void 0 ? /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React64.createElement(SkeletonLoader, null)) : /* @__PURE__ */ React64.createElement(
4714
4938
  "span",
4715
4939
  {
4716
4940
  className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
4717
4941
  },
4718
4942
  centsToDollars(Math.abs(data?.income?.value ?? NaN))
4719
- )
4943
+ ))
4720
4944
  ),
4721
- /* @__PURE__ */ React62.createElement(
4945
+ /* @__PURE__ */ React64.createElement(
4722
4946
  "div",
4723
4947
  {
4724
4948
  className: classNames22(
@@ -4728,37 +4952,75 @@ var ProfitAndLossSummaries = ({
4728
4952
  ),
4729
4953
  onClick: () => setSidebarScope("expenses")
4730
4954
  },
4731
- /* @__PURE__ */ React62.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"),
4732
- isLoading || storedData === void 0 ? /* @__PURE__ */ React62.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React62.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ React62.createElement(
4955
+ /* @__PURE__ */ React64.createElement(MiniChart, { data: expensesChartData }),
4956
+ /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ React64.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"), isLoading || storedData === void 0 ? /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React64.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ React64.createElement(
4733
4957
  "span",
4734
4958
  {
4735
4959
  className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
4736
4960
  },
4737
- centsToDollars(Math.abs((data.income.value ?? 0) - data.net_profit))
4738
- )
4961
+ centsToDollars(
4962
+ Math.abs((data.income.value ?? 0) - data.net_profit)
4963
+ )
4964
+ ))
4739
4965
  ),
4740
- /* @__PURE__ */ React62.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--net-profit" }, /* @__PURE__ */ React62.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), isLoading || storedData === void 0 ? /* @__PURE__ */ React62.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React62.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ React62.createElement(
4966
+ /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-summaries__summary net-profit Layer__profit-and-loss-summaries__summary--net-profit" }, /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-summaries__text" }, /* @__PURE__ */ React64.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), isLoading || storedData === void 0 ? /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React64.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ React64.createElement(
4741
4967
  "span",
4742
4968
  {
4743
4969
  className: `Layer__profit-and-loss-summaries__amount ${netProfitDirectionClass}`
4744
4970
  },
4745
4971
  centsToDollars(Math.abs(data.net_profit))
4746
- ))
4972
+ )))
4747
4973
  );
4748
4974
  };
4749
4975
 
4750
4976
  // src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
4751
- import React64, { useContext as useContext5 } from "react";
4977
+ import React67, { useContext as useContext5 } from "react";
4978
+
4979
+ // src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
4980
+ import React66, { useState as useState14 } from "react";
4981
+
4982
+ // src/icons/PieChart.tsx
4983
+ import * as React65 from "react";
4984
+ var PieChart2 = ({ size = 12, ...props }) => /* @__PURE__ */ React65.createElement(
4985
+ "svg",
4986
+ {
4987
+ xmlns: "http://www.w3.org/2000/svg",
4988
+ viewBox: "0 0 12 12",
4989
+ fill: "none",
4990
+ ...props,
4991
+ width: size,
4992
+ height: size
4993
+ },
4994
+ /* @__PURE__ */ React65.createElement("g", null, /* @__PURE__ */ React65.createElement(
4995
+ "path",
4996
+ {
4997
+ d: "M10.2213 7.78271C9.92969 8.47226 9.47363 9.07989 8.89297 9.55247C8.3123 10.0251 7.62471 10.3482 6.89031 10.4936C6.1559 10.6391 5.39705 10.6024 4.68009 10.3869C3.96313 10.1713 3.30989 9.78337 2.77749 9.25701C2.24509 8.73065 1.84973 8.08189 1.62598 7.36744C1.40223 6.65298 1.3569 5.8946 1.49396 5.15858C1.63102 4.42257 1.94629 3.73133 2.41221 3.14531C2.87813 2.55928 3.48051 2.09631 4.16669 1.79688",
4998
+ stroke: "currentColor",
4999
+ "stroke-linecap": "round",
5000
+ "stroke-linejoin": "round"
5001
+ }
5002
+ ), /* @__PURE__ */ React65.createElement(
5003
+ "path",
5004
+ {
5005
+ d: "M10.5833 6.00033C10.5833 5.39843 10.4648 4.80244 10.2344 4.24636C10.0041 3.69028 9.66651 3.18502 9.24091 2.75942C8.8153 2.33382 8.31004 1.99621 7.75397 1.76588C7.19789 1.53554 6.60189 1.41699 6 1.41699V6.00033H10.5833Z",
5006
+ stroke: "currentColor",
5007
+ "stroke-linecap": "round",
5008
+ "stroke-linejoin": "round"
5009
+ }
5010
+ ))
5011
+ );
5012
+ var PieChart_default = PieChart2;
4752
5013
 
4753
5014
  // src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
4754
- import React63, { useState as useState14 } from "react";
4755
5015
  var ProfitAndLossRow = ({
4756
5016
  variant,
4757
5017
  lineItem,
4758
5018
  depth = 0,
4759
5019
  maxDepth = 1,
4760
5020
  direction = "DEBIT" /* DEBIT */,
4761
- lockExpanded = false
5021
+ lockExpanded = false,
5022
+ scope,
5023
+ setSidebarScope
4762
5024
  }) => {
4763
5025
  if (!lineItem) {
4764
5026
  return null;
@@ -4795,20 +5057,36 @@ var ProfitAndLossRow = ({
4795
5057
  );
4796
5058
  displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
4797
5059
  displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
4798
- return /* @__PURE__ */ React63.createElement(React63.Fragment, null, /* @__PURE__ */ React63.createElement(
5060
+ return /* @__PURE__ */ React66.createElement(React66.Fragment, null, /* @__PURE__ */ React66.createElement(
4799
5061
  "div",
4800
5062
  {
4801
5063
  className: labelClasses.join(" "),
4802
5064
  onClick: () => !lockExpanded && toggleExpanded()
4803
5065
  },
4804
- !lockExpanded && variant !== "summation" ? /* @__PURE__ */ React63.createElement(ChevronDownFill_default, { size: 16 }) : null,
4805
- /* @__PURE__ */ React63.createElement(Text, null, display_name)
4806
- ), /* @__PURE__ */ React63.createElement("div", { className: valueClasses.join(" ") }, /* @__PURE__ */ React63.createElement(Text, null, amountString)), canGoDeeper && hasChildren && /* @__PURE__ */ React63.createElement(
5066
+ /* @__PURE__ */ React66.createElement("span", { className: "Layer__profit-and-loss-row__label__title" }, !lockExpanded && variant !== "summation" ? /* @__PURE__ */ React66.createElement(
5067
+ ChevronDownFill_default,
5068
+ {
5069
+ size: 16,
5070
+ className: "Layer__profit-and-loss-row__label__chevron"
5071
+ }
5072
+ ) : null, /* @__PURE__ */ React66.createElement(Text, null, display_name)),
5073
+ setSidebarScope && /* @__PURE__ */ React66.createElement(
5074
+ "span",
5075
+ {
5076
+ className: "Layer__profit-and-loss-row__detailed-chart-btn",
5077
+ onClick: (e) => {
5078
+ e.stopPropagation();
5079
+ setSidebarScope && setSidebarScope(scope ?? "expenses");
5080
+ }
5081
+ },
5082
+ /* @__PURE__ */ React66.createElement(PieChart_default, null)
5083
+ )
5084
+ ), /* @__PURE__ */ React66.createElement("div", { className: valueClasses.join(" ") }, /* @__PURE__ */ React66.createElement(Text, null, amountString)), canGoDeeper && hasChildren && /* @__PURE__ */ React66.createElement(
4807
5085
  "div",
4808
5086
  {
4809
5087
  className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
4810
5088
  },
4811
- /* @__PURE__ */ React63.createElement("div", { className: "Layer__profit-and-loss-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ React63.createElement(
5089
+ /* @__PURE__ */ React66.createElement("div", { className: "Layer__profit-and-loss-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ React66.createElement(
4812
5090
  ProfitAndLossRow,
4813
5091
  {
4814
5092
  key: line_item.display_name,
@@ -4871,26 +5149,34 @@ var empty_profit_and_loss_report_default = {
4871
5149
 
4872
5150
  // src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
4873
5151
  var ProfitAndLossTable = ({ lockExpanded }) => {
4874
- const { data: actualData, isLoading } = useContext5(ProfitAndLoss.Context);
5152
+ const {
5153
+ data: actualData,
5154
+ isLoading,
5155
+ setSidebarScope
5156
+ } = useContext5(ProfitAndLoss.Context);
4875
5157
  const data = !actualData || isLoading ? empty_profit_and_loss_report_default : actualData;
4876
5158
  if (isLoading || actualData === void 0) {
4877
- return /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-table__loader-container" }, /* @__PURE__ */ React64.createElement(Loader2, null));
5159
+ return /* @__PURE__ */ React67.createElement("div", { className: "Layer__profit-and-loss-table__loader-container" }, /* @__PURE__ */ React67.createElement(Loader2, null));
4878
5160
  }
4879
- return /* @__PURE__ */ React64.createElement(React64.Fragment, null, /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table--main" }, /* @__PURE__ */ React64.createElement(
5161
+ return /* @__PURE__ */ React67.createElement(React67.Fragment, null, /* @__PURE__ */ React67.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table--main" }, /* @__PURE__ */ React67.createElement(
4880
5162
  ProfitAndLossRow,
4881
5163
  {
4882
5164
  lineItem: data.income,
4883
5165
  direction: "CREDIT" /* CREDIT */,
4884
- lockExpanded
5166
+ lockExpanded,
5167
+ scope: "revenue",
5168
+ setSidebarScope
4885
5169
  }
4886
- ), /* @__PURE__ */ React64.createElement(
5170
+ ), /* @__PURE__ */ React67.createElement(
4887
5171
  ProfitAndLossRow,
4888
5172
  {
4889
5173
  lineItem: data.cost_of_goods_sold,
4890
5174
  direction: "DEBIT" /* DEBIT */,
4891
- lockExpanded
5175
+ lockExpanded,
5176
+ scope: "expenses",
5177
+ setSidebarScope
4892
5178
  }
4893
- ), /* @__PURE__ */ React64.createElement(
5179
+ ), /* @__PURE__ */ React67.createElement(
4894
5180
  ProfitAndLossRow,
4895
5181
  {
4896
5182
  lineItem: {
@@ -4899,16 +5185,20 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
4899
5185
  },
4900
5186
  variant: "summation",
4901
5187
  direction: "CREDIT" /* CREDIT */,
4902
- lockExpanded
5188
+ lockExpanded,
5189
+ scope: "revenue",
5190
+ setSidebarScope
4903
5191
  }
4904
- ), /* @__PURE__ */ React64.createElement(
5192
+ ), /* @__PURE__ */ React67.createElement(
4905
5193
  ProfitAndLossRow,
4906
5194
  {
4907
5195
  lineItem: data.expenses,
4908
5196
  direction: "DEBIT" /* DEBIT */,
4909
- lockExpanded
5197
+ lockExpanded,
5198
+ scope: "expenses",
5199
+ setSidebarScope
4910
5200
  }
4911
- ), /* @__PURE__ */ React64.createElement(
5201
+ ), /* @__PURE__ */ React67.createElement(
4912
5202
  ProfitAndLossRow,
4913
5203
  {
4914
5204
  lineItem: {
@@ -4917,16 +5207,20 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
4917
5207
  },
4918
5208
  variant: "summation",
4919
5209
  direction: "CREDIT" /* CREDIT */,
4920
- lockExpanded
5210
+ lockExpanded,
5211
+ scope: "revenue",
5212
+ setSidebarScope
4921
5213
  }
4922
- ), /* @__PURE__ */ React64.createElement(
5214
+ ), /* @__PURE__ */ React67.createElement(
4923
5215
  ProfitAndLossRow,
4924
5216
  {
4925
5217
  lineItem: data.taxes,
4926
5218
  direction: "DEBIT" /* DEBIT */,
4927
- lockExpanded
5219
+ lockExpanded,
5220
+ scope: "expenses",
5221
+ setSidebarScope
4928
5222
  }
4929
- ), /* @__PURE__ */ React64.createElement(
5223
+ ), /* @__PURE__ */ React67.createElement(
4930
5224
  ProfitAndLossRow,
4931
5225
  {
4932
5226
  lineItem: {
@@ -4937,21 +5231,21 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
4937
5231
  direction: "CREDIT" /* CREDIT */,
4938
5232
  lockExpanded
4939
5233
  }
4940
- )), /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ React64.createElement(
5234
+ )), data.other_outflows || data.personal_expenses ? /* @__PURE__ */ React67.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ React67.createElement(
4941
5235
  ProfitAndLossRow,
4942
5236
  {
4943
5237
  lineItem: data.other_outflows,
4944
5238
  direction: "DEBIT" /* DEBIT */,
4945
5239
  lockExpanded
4946
5240
  }
4947
- ), /* @__PURE__ */ React64.createElement(
5241
+ ), /* @__PURE__ */ React67.createElement(
4948
5242
  ProfitAndLossRow,
4949
5243
  {
4950
5244
  lineItem: data.personal_expenses,
4951
5245
  direction: "DEBIT" /* DEBIT */,
4952
5246
  lockExpanded
4953
5247
  }
4954
- )));
5248
+ )) : null);
4955
5249
  };
4956
5250
 
4957
5251
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
@@ -4985,7 +5279,7 @@ var PNLContext = createContext2({
4985
5279
  });
4986
5280
  var ProfitAndLoss = ({ children, tagFilter, reportingBasis }) => {
4987
5281
  const contextData = useProfitAndLoss({ tagFilter, reportingBasis });
4988
- return /* @__PURE__ */ React65.createElement(PNLContext.Provider, { value: contextData }, /* @__PURE__ */ React65.createElement("div", { className: "Layer__component Layer__profit-and-loss" }, children));
5282
+ return /* @__PURE__ */ React68.createElement(PNLContext.Provider, { value: contextData }, /* @__PURE__ */ React68.createElement("div", { className: "Layer__component Layer__profit-and-loss" }, children));
4989
5283
  };
4990
5284
  ProfitAndLoss.Chart = ProfitAndLossChart;
4991
5285
  ProfitAndLoss.Context = PNLContext;
@@ -4994,62 +5288,272 @@ ProfitAndLoss.Summaries = ProfitAndLossSummaries;
4994
5288
  ProfitAndLoss.Table = ProfitAndLossTable;
4995
5289
 
4996
5290
  // src/components/ProfitAndLossView/ProfitAndLossView.tsx
4997
- import React69, { useContext as useContext7 } from "react";
5291
+ import React75, { useContext as useContext7 } from "react";
4998
5292
 
4999
5293
  // src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
5000
- import React68, { useContext as useContext6, useMemo as useMemo5, useState as useState15 } from "react";
5001
- import Select3 from "react-select";
5294
+ import React74, { useContext as useContext6, useState as useState15 } from "react";
5002
5295
 
5003
- // src/icons/SortArrows.tsx
5004
- import * as React66 from "react";
5005
- var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React66.createElement(
5296
+ // src/icons/X.tsx
5297
+ import * as React69 from "react";
5298
+ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React69.createElement(
5006
5299
  "svg",
5007
5300
  {
5008
5301
  xmlns: "http://www.w3.org/2000/svg",
5009
- viewBox: "0 0 12 13",
5302
+ viewBox: "0 0 18 18",
5010
5303
  fill: "none",
5011
5304
  ...props,
5012
5305
  width: size,
5013
5306
  height: size
5014
5307
  },
5015
- /* @__PURE__ */ React66.createElement("g", { "clip-path": "url(#clip0_1758_75388)" }, /* @__PURE__ */ React66.createElement(
5308
+ /* @__PURE__ */ React69.createElement(
5016
5309
  "path",
5017
5310
  {
5018
- d: "M1.33325 8.5L3.99992 11.1667L6.66659 8.5",
5311
+ d: "M13.5 4.5L4.5 13.5",
5019
5312
  stroke: "currentColor",
5020
- "stroke-linecap": "round",
5021
- "stroke-linejoin": "round",
5022
- className: "desc-arrow"
5313
+ strokeLinecap: "round",
5314
+ strokeLinejoin: "round"
5023
5315
  }
5024
- ), /* @__PURE__ */ React66.createElement(
5316
+ ),
5317
+ /* @__PURE__ */ React69.createElement(
5025
5318
  "path",
5026
5319
  {
5027
- d: "M4 2.5L4 11.1667",
5320
+ d: "M4.5 4.5L13.5 13.5",
5028
5321
  stroke: "currentColor",
5029
- "stroke-linecap": "round",
5030
- "stroke-linejoin": "round",
5031
- className: "desc-arrow"
5322
+ strokeLinecap: "round",
5323
+ strokeLinejoin: "round"
5032
5324
  }
5033
- ), /* @__PURE__ */ React66.createElement(
5034
- "path",
5035
- {
5036
- d: "M5.99988 5.16602L8.66654 2.49935L11.3332 5.16602",
5037
- stroke: "currentColor",
5038
- "stroke-linecap": "round",
5039
- "stroke-linejoin": "round",
5040
- className: "asc-arrow"
5325
+ )
5326
+ );
5327
+ var X_default = X;
5328
+
5329
+ // src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
5330
+ import React70, { useMemo as useMemo6 } from "react";
5331
+ import {
5332
+ PieChart as PieChart3,
5333
+ Pie as Pie2,
5334
+ Cell as Cell3,
5335
+ ResponsiveContainer as ResponsiveContainer2,
5336
+ Label,
5337
+ Text as ChartText
5338
+ } from "recharts";
5339
+ var DetailedChart = ({
5340
+ filteredData,
5341
+ filteredTotal,
5342
+ hoveredItem,
5343
+ setHoveredItem,
5344
+ sidebarScope,
5345
+ date
5346
+ }) => {
5347
+ const chartData = useMemo6(() => {
5348
+ if (!filteredData) {
5349
+ return [];
5041
5350
  }
5042
- ), /* @__PURE__ */ React66.createElement(
5043
- "path",
5044
- {
5045
- d: "M8.66663 11.166L8.66663 2.49935",
5351
+ return filteredData.map((x) => {
5352
+ if (x.hidden) {
5353
+ return {
5354
+ name: x.display_name,
5355
+ value: 0
5356
+ };
5357
+ }
5358
+ return {
5359
+ name: x.display_name,
5360
+ value: x.value
5361
+ };
5362
+ });
5363
+ }, [filteredData]);
5364
+ return /* @__PURE__ */ React70.createElement("div", { className: "chart-field" }, /* @__PURE__ */ React70.createElement("div", { className: "header--tablet" }, /* @__PURE__ */ React70.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(sidebarScope)), /* @__PURE__ */ React70.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ React70.createElement("div", { className: "chart-container" }, /* @__PURE__ */ React70.createElement(ResponsiveContainer2, null, /* @__PURE__ */ React70.createElement(PieChart3, null, /* @__PURE__ */ React70.createElement(
5365
+ Pie2,
5366
+ {
5367
+ data: chartData,
5368
+ dataKey: "value",
5369
+ nameKey: "name",
5370
+ cx: "50%",
5371
+ cy: "50%",
5372
+ innerRadius: 105,
5373
+ outerRadius: 120,
5374
+ paddingAngle: 0.5,
5375
+ fill: "#8884d8",
5376
+ animationDuration: 200,
5377
+ animationEasing: "ease-in-out"
5378
+ },
5379
+ chartData.map((entry, index) => {
5380
+ const colorConfig = DEFAULT_CHART_COLORS[index % DEFAULT_CHART_COLORS.length];
5381
+ let fill = colorConfig.color;
5382
+ let opacity = colorConfig.opacity;
5383
+ let active = true;
5384
+ if (hoveredItem && entry.name !== hoveredItem) {
5385
+ active = false;
5386
+ fill = void 0;
5387
+ opacity = INACTIVE_OPACITY_LEVELS[index % INACTIVE_OPACITY_LEVELS.length];
5388
+ }
5389
+ return /* @__PURE__ */ React70.createElement(
5390
+ Cell3,
5391
+ {
5392
+ key: `cell-${index}`,
5393
+ className: `Layer__profit-and-loss-detailed-charts__pie ${hoveredItem && active ? "active" : "inactive"}`,
5394
+ style: { fill },
5395
+ opacity,
5396
+ onMouseEnter: () => setHoveredItem(entry.name),
5397
+ onMouseLeave: () => setHoveredItem(void 0)
5398
+ }
5399
+ );
5400
+ }),
5401
+ /* @__PURE__ */ React70.createElement(
5402
+ Label,
5403
+ {
5404
+ position: "center",
5405
+ value: "Total",
5406
+ className: "pie-center-label-title",
5407
+ content: (props) => {
5408
+ const { cx, cy } = props.viewBox ?? {
5409
+ cx: 0,
5410
+ cy: 0
5411
+ };
5412
+ const positioningProps = {
5413
+ x: cx,
5414
+ y: (cy || 0) - 15,
5415
+ textAnchor: "middle",
5416
+ verticalAnchor: "middle"
5417
+ };
5418
+ let text = "Total";
5419
+ if (hoveredItem) {
5420
+ text = hoveredItem;
5421
+ }
5422
+ return /* @__PURE__ */ React70.createElement(
5423
+ ChartText,
5424
+ {
5425
+ ...positioningProps,
5426
+ className: "pie-center-label__title"
5427
+ },
5428
+ text
5429
+ );
5430
+ }
5431
+ }
5432
+ ),
5433
+ /* @__PURE__ */ React70.createElement(
5434
+ Label,
5435
+ {
5436
+ position: "center",
5437
+ value: "Total",
5438
+ className: "pie-center-label-title",
5439
+ content: (props) => {
5440
+ const { cx, cy } = props.viewBox ?? {
5441
+ cx: 0,
5442
+ cy: 0
5443
+ };
5444
+ const positioningProps = {
5445
+ x: cx,
5446
+ y: (cy || 0) + 5,
5447
+ textAnchor: "middle",
5448
+ verticalAnchor: "middle"
5449
+ };
5450
+ let value = filteredTotal;
5451
+ if (hoveredItem) {
5452
+ value = filteredData.find(
5453
+ (x) => x.display_name === hoveredItem
5454
+ )?.value;
5455
+ }
5456
+ return /* @__PURE__ */ React70.createElement(
5457
+ ChartText,
5458
+ {
5459
+ ...positioningProps,
5460
+ className: "pie-center-label__value"
5461
+ },
5462
+ `$${centsToDollars(value)}`
5463
+ );
5464
+ }
5465
+ }
5466
+ ),
5467
+ /* @__PURE__ */ React70.createElement(
5468
+ Label,
5469
+ {
5470
+ position: "center",
5471
+ value: "Total",
5472
+ className: "pie-center-label-title",
5473
+ content: (props) => {
5474
+ const { cx, cy } = props.viewBox ?? {
5475
+ cx: 0,
5476
+ cy: 0
5477
+ };
5478
+ const positioningProps = {
5479
+ x: cx,
5480
+ y: (cy || 0) + 25,
5481
+ height: 20,
5482
+ textAnchor: "middle",
5483
+ verticalAnchor: "middle"
5484
+ };
5485
+ if (hoveredItem) {
5486
+ return /* @__PURE__ */ React70.createElement(
5487
+ ChartText,
5488
+ {
5489
+ ...positioningProps,
5490
+ className: "pie-center-label__share"
5491
+ },
5492
+ `${formatPercent(
5493
+ filteredData.find((x) => x.display_name === hoveredItem)?.share
5494
+ )}%`
5495
+ );
5496
+ }
5497
+ return;
5498
+ }
5499
+ }
5500
+ )
5501
+ )))));
5502
+ };
5503
+
5504
+ // src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
5505
+ import React72 from "react";
5506
+
5507
+ // src/icons/SortArrows.tsx
5508
+ import * as React71 from "react";
5509
+ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React71.createElement(
5510
+ "svg",
5511
+ {
5512
+ xmlns: "http://www.w3.org/2000/svg",
5513
+ viewBox: "0 0 12 13",
5514
+ fill: "none",
5515
+ ...props,
5516
+ width: size,
5517
+ height: size
5518
+ },
5519
+ /* @__PURE__ */ React71.createElement("g", { "clip-path": "url(#clip0_1758_75388)" }, /* @__PURE__ */ React71.createElement(
5520
+ "path",
5521
+ {
5522
+ d: "M1.33325 8.5L3.99992 11.1667L6.66659 8.5",
5523
+ stroke: "currentColor",
5524
+ "stroke-linecap": "round",
5525
+ "stroke-linejoin": "round",
5526
+ className: "desc-arrow"
5527
+ }
5528
+ ), /* @__PURE__ */ React71.createElement(
5529
+ "path",
5530
+ {
5531
+ d: "M4 2.5L4 11.1667",
5532
+ stroke: "currentColor",
5533
+ "stroke-linecap": "round",
5534
+ "stroke-linejoin": "round",
5535
+ className: "desc-arrow"
5536
+ }
5537
+ ), /* @__PURE__ */ React71.createElement(
5538
+ "path",
5539
+ {
5540
+ d: "M5.99988 5.16602L8.66654 2.49935L11.3332 5.16602",
5541
+ stroke: "currentColor",
5542
+ "stroke-linecap": "round",
5543
+ "stroke-linejoin": "round",
5544
+ className: "asc-arrow"
5545
+ }
5546
+ ), /* @__PURE__ */ React71.createElement(
5547
+ "path",
5548
+ {
5549
+ d: "M8.66663 11.166L8.66663 2.49935",
5046
5550
  stroke: "currentColor",
5047
5551
  "stroke-linecap": "round",
5048
5552
  "stroke-linejoin": "round",
5049
5553
  className: "asc-arrow"
5050
5554
  }
5051
5555
  )),
5052
- /* @__PURE__ */ React66.createElement("defs", null, /* @__PURE__ */ React66.createElement("clipPath", { id: "clip0_1758_75388" }, /* @__PURE__ */ React66.createElement(
5556
+ /* @__PURE__ */ React71.createElement("defs", null, /* @__PURE__ */ React71.createElement("clipPath", { id: "clip0_1758_75388" }, /* @__PURE__ */ React71.createElement(
5053
5557
  "rect",
5054
5558
  {
5055
5559
  width: "12",
@@ -5061,9 +5565,400 @@ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React66.createElem
5061
5565
  );
5062
5566
  var SortArrows_default = SortArrows;
5063
5567
 
5064
- // src/icons/X.tsx
5065
- import * as React67 from "react";
5066
- var X = ({ size = 18, ...props }) => /* @__PURE__ */ React67.createElement(
5568
+ // src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
5569
+ import classNames23 from "classnames";
5570
+ var DetailedTable = ({
5571
+ filteredData,
5572
+ sidebarScope,
5573
+ filters,
5574
+ sortBy,
5575
+ hoveredItem,
5576
+ setHoveredItem
5577
+ }) => {
5578
+ const buildColClass = (column) => {
5579
+ return classNames23(
5580
+ "Layer__sortable-col",
5581
+ sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
5582
+ );
5583
+ };
5584
+ return /* @__PURE__ */ React72.createElement("div", { className: "details-container" }, /* @__PURE__ */ React72.createElement("div", { className: "table" }, /* @__PURE__ */ React72.createElement("table", null, /* @__PURE__ */ React72.createElement("thead", null, /* @__PURE__ */ React72.createElement("tr", null, /* @__PURE__ */ React72.createElement(
5585
+ "th",
5586
+ {
5587
+ className: buildColClass("category"),
5588
+ onClick: () => sortBy(sidebarScope ?? "expenses", "category")
5589
+ },
5590
+ "Expense/Sale ",
5591
+ /* @__PURE__ */ React72.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
5592
+ ), /* @__PURE__ */ React72.createElement(
5593
+ "th",
5594
+ {
5595
+ className: buildColClass("type"),
5596
+ onClick: () => sortBy(sidebarScope ?? "expenses", "type")
5597
+ },
5598
+ "Type ",
5599
+ /* @__PURE__ */ React72.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
5600
+ ), /* @__PURE__ */ React72.createElement("th", null), /* @__PURE__ */ React72.createElement(
5601
+ "th",
5602
+ {
5603
+ className: buildColClass("value"),
5604
+ onClick: () => sortBy(sidebarScope ?? "expenses", "value")
5605
+ },
5606
+ "Value ",
5607
+ /* @__PURE__ */ React72.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
5608
+ ))), /* @__PURE__ */ React72.createElement("tbody", null, filteredData.filter((x) => !x.hidden).map((item, idx) => {
5609
+ const colorConfig = DEFAULT_CHART_COLORS[idx % DEFAULT_CHART_COLORS.length];
5610
+ return /* @__PURE__ */ React72.createElement(
5611
+ "tr",
5612
+ {
5613
+ key: `pl-side-table-item-${idx}`,
5614
+ className: classNames23(
5615
+ "Layer__profit-and-loss-detailed-table__row",
5616
+ hoveredItem && hoveredItem === item.display_name ? "active" : ""
5617
+ ),
5618
+ onMouseEnter: () => setHoveredItem(item.display_name),
5619
+ onMouseLeave: () => setHoveredItem(void 0)
5620
+ },
5621
+ /* @__PURE__ */ React72.createElement("td", { className: "category-col" }, item.display_name),
5622
+ /* @__PURE__ */ React72.createElement("td", { className: "type-col" }, item.type),
5623
+ /* @__PURE__ */ React72.createElement("td", { className: "value-col" }, "$", centsToDollars(item.value)),
5624
+ /* @__PURE__ */ React72.createElement("td", { className: "share-col" }, /* @__PURE__ */ React72.createElement("span", { className: "share-cell-content" }, formatPercent(item.share), "%", /* @__PURE__ */ React72.createElement(
5625
+ "div",
5626
+ {
5627
+ className: "share-icon",
5628
+ style: {
5629
+ background: colorConfig.color,
5630
+ opacity: colorConfig.opacity
5631
+ }
5632
+ }
5633
+ )))
5634
+ );
5635
+ })))));
5636
+ };
5637
+
5638
+ // src/components/ProfitAndLossDetailedCharts/Filters.tsx
5639
+ import React73 from "react";
5640
+ import Select4, { components as components4 } from "react-select";
5641
+ var Filters = ({
5642
+ filteredData,
5643
+ sidebarScope,
5644
+ filters,
5645
+ setFilterTypes
5646
+ }) => {
5647
+ return /* @__PURE__ */ React73.createElement("div", { className: "filters" }, /* @__PURE__ */ React73.createElement(Text, { size: "sm" /* sm */, className: "Layer__label" }, "Filters"), /* @__PURE__ */ React73.createElement(
5648
+ Select4,
5649
+ {
5650
+ className: "Layer__select type-select",
5651
+ classNamePrefix: "Layer__select",
5652
+ value: sidebarScope && filters[sidebarScope]?.types ? sidebarScope && filters[sidebarScope]?.types?.map((x) => ({
5653
+ value: x,
5654
+ label: x
5655
+ })) : [],
5656
+ isMulti: true,
5657
+ isClearable: false,
5658
+ options: [...new Set(filteredData?.map((x) => x.type))].map((x) => ({
5659
+ label: x,
5660
+ value: x
5661
+ })),
5662
+ onChange: (selected) => {
5663
+ setFilterTypes(
5664
+ sidebarScope ?? "expenses",
5665
+ selected.map((x) => x.value)
5666
+ );
5667
+ },
5668
+ components: {
5669
+ DropdownIndicator: (props) => /* @__PURE__ */ React73.createElement(components4.DropdownIndicator, { ...props }, /* @__PURE__ */ React73.createElement(ChevronDown_default, null)),
5670
+ Placeholder: (props) => /* @__PURE__ */ React73.createElement(components4.Placeholder, { ...props }, /* @__PURE__ */ React73.createElement("div", { className: "Layer__select__multi-all-placeholder-badge" }, "All"))
5671
+ }
5672
+ }
5673
+ ));
5674
+ };
5675
+
5676
+ // src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
5677
+ import classNames24 from "classnames";
5678
+ import { format as format6 } from "date-fns";
5679
+ var ProfitAndLossDetailedCharts = () => {
5680
+ const {
5681
+ filteredData,
5682
+ filteredTotal,
5683
+ sortBy,
5684
+ filters,
5685
+ isLoading,
5686
+ dateRange,
5687
+ sidebarScope,
5688
+ setSidebarScope,
5689
+ setFilterTypes
5690
+ } = useContext6(ProfitAndLoss.Context);
5691
+ const [hoveredItem, setHoveredItem] = useState15();
5692
+ return /* @__PURE__ */ React74.createElement(
5693
+ "div",
5694
+ {
5695
+ className: classNames24(
5696
+ "Layer__profit-and-loss__side-panel",
5697
+ sidebarScope && "open"
5698
+ )
5699
+ },
5700
+ /* @__PURE__ */ React74.createElement("div", { className: "Layer__profit-and-loss-detailed-charts" }, /* @__PURE__ */ React74.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header" }, /* @__PURE__ */ React74.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ React74.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(sidebarScope)), /* @__PURE__ */ React74.createElement(Text, { size: "sm" /* sm */, className: "date" }, format6(dateRange.startDate, "LLLL, y")), /* @__PURE__ */ React74.createElement(ProfitAndLossDatePicker, null)), /* @__PURE__ */ React74.createElement(
5701
+ Button,
5702
+ {
5703
+ rightIcon: /* @__PURE__ */ React74.createElement(X_default, null),
5704
+ iconOnly: true,
5705
+ onClick: () => setSidebarScope(void 0),
5706
+ variant: "secondary" /* secondary */
5707
+ }
5708
+ )), /* @__PURE__ */ React74.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header--tablet" }, /* @__PURE__ */ React74.createElement(
5709
+ Button,
5710
+ {
5711
+ onClick: () => setSidebarScope(void 0),
5712
+ variant: "secondary" /* secondary */
5713
+ },
5714
+ "Back"
5715
+ )), /* @__PURE__ */ React74.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__content" }, /* @__PURE__ */ React74.createElement(
5716
+ DetailedChart,
5717
+ {
5718
+ filteredData,
5719
+ filteredTotal,
5720
+ hoveredItem,
5721
+ setHoveredItem,
5722
+ sidebarScope,
5723
+ date: dateRange.startDate
5724
+ }
5725
+ ), /* @__PURE__ */ React74.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__table-wrapper" }, /* @__PURE__ */ React74.createElement(
5726
+ Filters,
5727
+ {
5728
+ filteredData,
5729
+ sidebarScope,
5730
+ filters,
5731
+ setFilterTypes
5732
+ }
5733
+ ), /* @__PURE__ */ React74.createElement(
5734
+ DetailedTable,
5735
+ {
5736
+ filteredData,
5737
+ sidebarScope,
5738
+ filters,
5739
+ sortBy,
5740
+ hoveredItem,
5741
+ setHoveredItem
5742
+ }
5743
+ ))))
5744
+ );
5745
+ };
5746
+
5747
+ // src/components/ProfitAndLossView/ProfitAndLossView.tsx
5748
+ var COMPONENT_NAME3 = "profit-and-loss";
5749
+ var ProfitAndLossView = (props) => {
5750
+ return /* @__PURE__ */ React75.createElement(Container, { name: COMPONENT_NAME3 }, /* @__PURE__ */ React75.createElement(ProfitAndLoss, null, /* @__PURE__ */ React75.createElement("div", { className: `Layer__${COMPONENT_NAME3}__main-panel` }, /* @__PURE__ */ React75.createElement(Header, { className: `Layer__${COMPONENT_NAME3}__header` }, /* @__PURE__ */ React75.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Profit & Loss")), /* @__PURE__ */ React75.createElement(Components, { ...props })), props.showDetailedCharts !== false && /* @__PURE__ */ React75.createElement(ProfitAndLossDetailedCharts, null)));
5751
+ };
5752
+ var Components = ({
5753
+ hideChart = false,
5754
+ hideTable = false
5755
+ }) => {
5756
+ const { error, isLoading, isValidating, refetch } = useContext7(
5757
+ ProfitAndLoss.Context
5758
+ );
5759
+ if (!isLoading && error) {
5760
+ return /* @__PURE__ */ React75.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React75.createElement(
5761
+ DataState,
5762
+ {
5763
+ status: "failed" /* failed */,
5764
+ title: "Something went wrong",
5765
+ description: "We couldn\u2019t load your data.",
5766
+ onRefresh: () => refetch(),
5767
+ isLoading: isValidating
5768
+ }
5769
+ ));
5770
+ }
5771
+ return /* @__PURE__ */ React75.createElement(React75.Fragment, null, !hideChart && /* @__PURE__ */ React75.createElement("div", { className: `Layer__${COMPONENT_NAME3}__chart_with_summaries` }, /* @__PURE__ */ React75.createElement(
5772
+ "div",
5773
+ {
5774
+ className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__summary-col`
5775
+ },
5776
+ /* @__PURE__ */ React75.createElement(ProfitAndLoss.DatePicker, null),
5777
+ /* @__PURE__ */ React75.createElement(ProfitAndLoss.Summaries, { vertical: true })
5778
+ ), /* @__PURE__ */ React75.createElement(
5779
+ "div",
5780
+ {
5781
+ className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__chart-col`
5782
+ },
5783
+ /* @__PURE__ */ React75.createElement(ProfitAndLoss.Chart, null)
5784
+ )), !hideTable && /* @__PURE__ */ React75.createElement(ProfitAndLoss.Table, null));
5785
+ };
5786
+
5787
+ // src/components/LedgerAccounts/LedgerAccounts.tsx
5788
+ import React82, { createContext as createContext3, useContext as useContext12 } from "react";
5789
+
5790
+ // src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
5791
+ import { useState as useState16 } from "react";
5792
+ import useSWR5 from "swr";
5793
+ var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.sub_accounts || [])]).flat().filter((id) => id);
5794
+ var useLedgerAccounts = () => {
5795
+ const { auth, businessId, apiUrl } = useLayerContext();
5796
+ const [form, setForm] = useState16();
5797
+ const [showARForAccountId, setShowARForAccountId] = useState16();
5798
+ const { data, isLoading, isValidating, error, mutate } = useSWR5(
5799
+ businessId && auth?.access_token && `ledger-accounts-${businessId}`,
5800
+ Layer.getLedgerAccounts(apiUrl, auth?.access_token, {
5801
+ params: { businessId }
5802
+ })
5803
+ );
5804
+ const create = (newAccount) => {
5805
+ Layer.createAccount(apiUrl, auth?.access_token, {
5806
+ params: { businessId },
5807
+ body: newAccount
5808
+ }).then(({ data: data2 }) => (mutate(), data2));
5809
+ };
5810
+ const submitForm = () => {
5811
+ if (!form || !form.action) {
5812
+ return;
5813
+ }
5814
+ const data2 = {
5815
+ name: form.data.name || "Test name",
5816
+ normality: form.data.subType?.value,
5817
+ parent_id: form.data.parent ? {
5818
+ type: "AccountId",
5819
+ id: form.data.parent.value
5820
+ } : void 0,
5821
+ description: form.data.type?.value.toString() || "Test description"
5822
+ };
5823
+ if (form.action === "new") {
5824
+ create(data2);
5825
+ return;
5826
+ }
5827
+ if (form.action === "edit" && form.accountId) {
5828
+ return;
5829
+ }
5830
+ };
5831
+ const addAccount = () => setForm({
5832
+ action: "new",
5833
+ accountId: void 0,
5834
+ data: {
5835
+ parent: void 0,
5836
+ name: void 0,
5837
+ type: {
5838
+ value: "assets",
5839
+ label: "Assets"
5840
+ },
5841
+ subType: void 0,
5842
+ category: void 0
5843
+ }
5844
+ });
5845
+ const editAccount = (id) => {
5846
+ const allAccounts = flattenAccounts(data?.data?.accounts || []);
5847
+ const found = allAccounts?.find((x) => x.id === id);
5848
+ if (!found) {
5849
+ return;
5850
+ }
5851
+ const parent = allAccounts.find(
5852
+ (x) => x.sub_accounts?.find((el) => el.id === found.id)
5853
+ );
5854
+ setForm({
5855
+ action: "edit",
5856
+ accountId: id,
5857
+ data: {
5858
+ parent: parent ? {
5859
+ value: parent.id,
5860
+ label: parent.name
5861
+ } : void 0,
5862
+ name: found.name,
5863
+ type: {
5864
+ value: "assets",
5865
+ label: "Assets"
5866
+ },
5867
+ subType: void 0,
5868
+ category: void 0
5869
+ }
5870
+ });
5871
+ };
5872
+ const cancelForm = () => setForm(void 0);
5873
+ const changeFormData = (fieldName, value) => {
5874
+ if (!form) {
5875
+ return;
5876
+ }
5877
+ setForm({
5878
+ ...form,
5879
+ data: {
5880
+ ...form.data,
5881
+ [fieldName]: value
5882
+ }
5883
+ });
5884
+ };
5885
+ const refetch = () => mutate();
5886
+ return {
5887
+ data: data?.data,
5888
+ isLoading,
5889
+ isValidating,
5890
+ error,
5891
+ refetch,
5892
+ create,
5893
+ form,
5894
+ addAccount,
5895
+ editAccount,
5896
+ cancelForm,
5897
+ changeFormData,
5898
+ submitForm,
5899
+ showARForAccountId,
5900
+ setShowARForAccountId
5901
+ };
5902
+ };
5903
+
5904
+ // src/components/AccountsReceivable/AccountsReceivableIndex.tsx
5905
+ import React76, { useContext as useContext8, useMemo as useMemo7 } from "react";
5906
+ import classNames25 from "classnames";
5907
+ import { parseISO as parseISO9, format as formatTime7 } from "date-fns";
5908
+ var AccountsReceivable = () => {
5909
+ const { data, showARForAccountId, setShowARForAccountId } = useContext8(
5910
+ LedgerAccountsContext
5911
+ );
5912
+ const entry = useMemo7(() => {
5913
+ return flattenAccounts(data?.accounts || []).find(
5914
+ (x) => x.id === showARForAccountId
5915
+ );
5916
+ }, [showARForAccountId]);
5917
+ const baseClassName = classNames25(
5918
+ "Layer__accounts-receivable__index",
5919
+ showARForAccountId && "open"
5920
+ );
5921
+ const close = () => setShowARForAccountId(void 0);
5922
+ return /* @__PURE__ */ React76.createElement("div", { className: baseClassName }, /* @__PURE__ */ React76.createElement("div", { className: "Layer__accounts-receivable__header" }, /* @__PURE__ */ React76.createElement(Button, { onClick: close, variant: "secondary" /* secondary */ }, "Back"), /* @__PURE__ */ React76.createElement("div", { className: "Layer__accounts-receivable__title-container" }, /* @__PURE__ */ React76.createElement(
5923
+ Text,
5924
+ {
5925
+ weight: "bold" /* bold */,
5926
+ className: "Layer__accounts-receivable__title"
5927
+ },
5928
+ entry?.name || ""
5929
+ ), /* @__PURE__ */ React76.createElement(
5930
+ Button,
5931
+ {
5932
+ variant: "secondary" /* secondary */,
5933
+ rightIcon: /* @__PURE__ */ React76.createElement(DownloadCloud_default, { size: 12 })
5934
+ },
5935
+ "Download"
5936
+ )), /* @__PURE__ */ React76.createElement("div", { className: "Layer__accounts-receivable__balance-container" }, /* @__PURE__ */ React76.createElement(
5937
+ Text,
5938
+ {
5939
+ weight: "bold" /* bold */,
5940
+ className: "Layer__accounts-receivable__balance-label"
5941
+ },
5942
+ "Current balance"
5943
+ ), /* @__PURE__ */ React76.createElement(
5944
+ Text,
5945
+ {
5946
+ weight: "bold" /* bold */,
5947
+ className: "Layer__accounts-receivable__balance-value"
5948
+ },
5949
+ "$",
5950
+ centsToDollars(entry?.balance || 0)
5951
+ ))), /* @__PURE__ */ React76.createElement("table", { className: "Layer__table Layer__accounts-receivable-table" }, /* @__PURE__ */ React76.createElement("thead", null, /* @__PURE__ */ React76.createElement("tr", null, /* @__PURE__ */ React76.createElement("th", { className: "Layer__table-header" }, "Date"), /* @__PURE__ */ React76.createElement("th", { className: "Layer__table-header" }, "Journal id #"), /* @__PURE__ */ React76.createElement("th", { className: "Layer__table-header" }, "Source"), /* @__PURE__ */ React76.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Debit"), /* @__PURE__ */ React76.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Credit"), /* @__PURE__ */ React76.createElement("th", { className: "Layer__table-header Layer__table-cell--amount" }, "Running balance"))), /* @__PURE__ */ React76.createElement("tbody", null, entry?.entries?.map((x) => {
5952
+ return /* @__PURE__ */ React76.createElement("tr", { key: x.id }, /* @__PURE__ */ React76.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React76.createElement("span", { className: "Layer__table-cell-content" }, x.createdAt && formatTime7(parseISO9(x.createdAt), DATE_FORMAT))), /* @__PURE__ */ React76.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React76.createElement("span", { className: "Layer__table-cell-content" }, "TBD")), /* @__PURE__ */ React76.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React76.createElement("span", { className: "Layer__table-cell-content" }, "TBD")), /* @__PURE__ */ React76.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, /* @__PURE__ */ React76.createElement("span", { className: "Layer__table-cell-content" }, x.direction, " TBD")), /* @__PURE__ */ React76.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, /* @__PURE__ */ React76.createElement("span", { className: "Layer__table-cell-content" }, "TBD")), /* @__PURE__ */ React76.createElement("td", { className: "Layer__table-cell Layer__table-cell--amount" }, /* @__PURE__ */ React76.createElement("span", { className: "Layer__table-cell-content" }, "TBD")));
5953
+ }))));
5954
+ };
5955
+
5956
+ // src/components/LedgerAccountsRow/LedgerAccountsRow.tsx
5957
+ import React79, { useContext as useContext9, useState as useState17 } from "react";
5958
+
5959
+ // src/icons/ArrowRightCircle.tsx
5960
+ import * as React77 from "react";
5961
+ var ArrowRightCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React77.createElement(
5067
5962
  "svg",
5068
5963
  {
5069
5964
  xmlns: "http://www.w3.org/2000/svg",
@@ -5073,424 +5968,304 @@ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React67.createElement(
5073
5968
  width: size,
5074
5969
  height: size
5075
5970
  },
5076
- /* @__PURE__ */ React67.createElement(
5971
+ /* @__PURE__ */ React77.createElement(
5077
5972
  "path",
5078
5973
  {
5079
- d: "M13.5 4.5L4.5 13.5",
5974
+ d: "M9 16.5C13.1421 16.5 16.5 13.1421 16.5 9C16.5 4.85786 13.1421 1.5 9 1.5C4.85786 1.5 1.5 4.85786 1.5 9C1.5 13.1421 4.85786 16.5 9 16.5Z",
5080
5975
  stroke: "currentColor",
5081
- strokeLinecap: "round",
5082
- strokeLinejoin: "round"
5976
+ "stroke-linecap": "round",
5977
+ "stroke-linejoin": "round"
5083
5978
  }
5084
5979
  ),
5085
- /* @__PURE__ */ React67.createElement(
5980
+ /* @__PURE__ */ React77.createElement(
5086
5981
  "path",
5087
5982
  {
5088
- d: "M4.5 4.5L13.5 13.5",
5983
+ d: "M9 12L12 9L9 6",
5089
5984
  stroke: "currentColor",
5090
- strokeLinecap: "round",
5091
- strokeLinejoin: "round"
5985
+ "stroke-linecap": "round",
5986
+ "stroke-linejoin": "round"
5987
+ }
5988
+ ),
5989
+ /* @__PURE__ */ React77.createElement(
5990
+ "path",
5991
+ {
5992
+ d: "M6 9H12",
5993
+ stroke: "currentColor",
5994
+ "stroke-linecap": "round",
5995
+ "stroke-linejoin": "round"
5092
5996
  }
5093
5997
  )
5094
5998
  );
5095
- var X_default = X;
5999
+ var ArrowRightCircle_default = ArrowRightCircle;
5096
6000
 
5097
- // src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
5098
- import classNames23 from "classnames";
5099
- import { format as format6 } from "date-fns";
5100
- import {
5101
- PieChart,
5102
- Pie,
5103
- Cell as Cell2,
5104
- ResponsiveContainer as ResponsiveContainer2,
5105
- Label,
5106
- Text as ChartText
5107
- } from "recharts";
5108
- var INACTIVE_OPACITY_LEVELS = [0.85, 0.7, 0.66, 0.55, 0.4, 0.33, 0.25, 0.15];
5109
- var DEFAULT_CHART_COLORS = [
5110
- {
5111
- color: "#7417B3",
5112
- opacity: 1
5113
- },
5114
- {
5115
- color: "#7417B3",
5116
- opacity: 0.8
5117
- },
5118
- {
5119
- color: "#7417B3",
5120
- opacity: 0.6
5121
- },
5122
- {
5123
- color: "#7417B3",
5124
- opacity: 0.4
5125
- },
5126
- {
5127
- color: "#7417B3",
5128
- opacity: 0.2
5129
- },
5130
- {
5131
- color: "#7417B3",
5132
- opacity: 0.1
5133
- },
5134
- {
5135
- color: "#006A80",
5136
- opacity: 1
5137
- },
5138
- {
5139
- color: "#006A80",
5140
- opacity: 0.8
5141
- },
5142
- {
5143
- color: "#006A80",
5144
- opacity: 0.6
5145
- },
5146
- {
5147
- color: "#006A80",
5148
- opacity: 0.4
5149
- },
5150
- {
5151
- color: "#006A80",
5152
- opacity: 0.2
5153
- },
5154
- {
5155
- color: "#006A80",
5156
- opacity: 0.1
5157
- },
5158
- {
5159
- color: "#009930",
5160
- opacity: 1
5161
- },
5162
- {
5163
- color: "#009930",
5164
- opacity: 0.8
5165
- },
5166
- {
5167
- color: "#009930",
5168
- opacity: 0.6
5169
- },
6001
+ // src/icons/Edit2.tsx
6002
+ import * as React78 from "react";
6003
+ var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React78.createElement(
6004
+ "svg",
5170
6005
  {
5171
- color: "#009930",
5172
- opacity: 0.4
6006
+ xmlns: "http://www.w3.org/2000/svg",
6007
+ viewBox: "0 0 18 18",
6008
+ fill: "none",
6009
+ ...props,
6010
+ width: size,
6011
+ height: size
5173
6012
  },
6013
+ /* @__PURE__ */ React78.createElement(
6014
+ "path",
6015
+ {
6016
+ d: "M12.75 2.25C12.947 2.05301 13.1808 1.89676 13.4382 1.79015C13.6956 1.68355 13.9714 1.62868 14.25 1.62868C14.5286 1.62868 14.8044 1.68355 15.0618 1.79015C15.3192 1.89676 15.553 2.05301 15.75 2.25C15.947 2.44698 16.1032 2.68083 16.2098 2.9382C16.3165 3.19557 16.3713 3.47142 16.3713 3.75C16.3713 4.02857 16.3165 4.30442 16.2098 4.56179C16.1032 4.81916 15.947 5.05302 15.75 5.25L5.625 15.375L1.5 16.5L2.625 12.375L12.75 2.25Z",
6017
+ stroke: "currentColor",
6018
+ "stroke-linecap": "round",
6019
+ "stroke-linejoin": "round"
6020
+ }
6021
+ )
6022
+ );
6023
+ var Edit2_default = Edit2;
6024
+
6025
+ // src/components/LedgerAccountsRow/LedgerAccountsRow.tsx
6026
+ import classNames26 from "classnames";
6027
+ var INDENTATION = 12;
6028
+ var LedgerAccountsRow = ({
6029
+ account,
6030
+ depth = 0
6031
+ }) => {
6032
+ const { form, editAccount, setShowARForAccountId } = useContext9(
6033
+ LedgerAccountsContext
6034
+ );
6035
+ const [isOpen, setIsOpen] = useState17(false);
6036
+ const baseClass = classNames26(
6037
+ "Layer__alt-table-row",
6038
+ isOpen ? "Layer__alt-table-row--expanded" : "Layer__alt-table-row--collapsed",
6039
+ `Layer__alt-table-row--depth-${depth}`,
6040
+ form?.accountId === account.id && "active"
6041
+ );
6042
+ return /* @__PURE__ */ React79.createElement(React79.Fragment, null, /* @__PURE__ */ React79.createElement("div", { className: baseClass, onClick: () => setIsOpen(!isOpen) }, /* @__PURE__ */ React79.createElement(
6043
+ "div",
6044
+ {
6045
+ className: "Layer__alt-table__cell Layer__coa__name",
6046
+ style: { paddingLeft: INDENTATION * depth + 16 }
6047
+ },
6048
+ account.sub_accounts && account.sub_accounts.length > 0 && /* @__PURE__ */ React79.createElement(
6049
+ ChevronDownFill_default,
6050
+ {
6051
+ size: 16,
6052
+ className: "Layer__alt-table__expand-icon"
6053
+ }
6054
+ ),
6055
+ /* @__PURE__ */ React79.createElement("span", { className: "Layer__coa__name__text" }, account.name)
6056
+ ), /* @__PURE__ */ React79.createElement("div", { className: "Layer__alt-table__cell Layer__coa__type" }, account.normality), /* @__PURE__ */ React79.createElement("div", { className: "Layer__alt-table__cell Layer__coa__subtype" }, "Sub-Type"), /* @__PURE__ */ React79.createElement("div", { className: "Layer__alt-table__cell Layer__coa__balance" }, "$", centsToDollars(Math.abs(account.balance || 0))), /* @__PURE__ */ React79.createElement("div", { className: "Layer__alt-table__cell Layer__coa__actions" }, /* @__PURE__ */ React79.createElement(
6057
+ Button,
6058
+ {
6059
+ variant: "secondary" /* secondary */,
6060
+ rightIcon: /* @__PURE__ */ React79.createElement(Edit2_default, { size: 12 }),
6061
+ onClick: (e) => {
6062
+ e.preventDefault();
6063
+ e.stopPropagation();
6064
+ editAccount(account.id);
6065
+ }
6066
+ },
6067
+ "Edit"
6068
+ ), /* @__PURE__ */ React79.createElement(
6069
+ Button,
6070
+ {
6071
+ variant: "secondary" /* secondary */,
6072
+ rightIcon: /* @__PURE__ */ React79.createElement(ArrowRightCircle_default, { size: 12 }),
6073
+ onClick: (e) => {
6074
+ e.preventDefault();
6075
+ e.stopPropagation();
6076
+ setShowARForAccountId(account.id);
6077
+ }
6078
+ },
6079
+ "Open"
6080
+ ))), isOpen && (account.sub_accounts || []).map((subAccount) => /* @__PURE__ */ React79.createElement(
6081
+ LedgerAccountsRow,
6082
+ {
6083
+ key: subAccount.id,
6084
+ account: subAccount,
6085
+ depth: depth + 1
6086
+ }
6087
+ )));
6088
+ };
6089
+
6090
+ // src/components/LedgerAccountsSidebar/LedgerAccountsSidebar.tsx
6091
+ import React81, { useContext as useContext11 } from "react";
6092
+
6093
+ // src/components/LedgerAccountsForm/LedgerAccountsForm.tsx
6094
+ import React80, { useContext as useContext10, useMemo as useMemo8 } from "react";
6095
+ var SUB_TYPE_OPTIONS = [
5174
6096
  {
5175
- color: "#009930",
5176
- opacity: 0.2
6097
+ value: "DEBIT" /* DEBIT */,
6098
+ label: "Debit"
5177
6099
  },
5178
6100
  {
5179
- color: "#009930",
5180
- opacity: 0.1
6101
+ value: "CREDIT" /* CREDIT */,
6102
+ label: "Credit"
5181
6103
  }
5182
6104
  ];
5183
- var ProfitAndLossDetailedCharts = () => {
5184
- const {
5185
- data,
5186
- filteredData,
5187
- filteredTotal,
5188
- sortBy,
5189
- filters,
5190
- isLoading,
5191
- dateRange,
5192
- sidebarScope,
5193
- setSidebarScope,
5194
- setFilterTypes
5195
- } = useContext6(ProfitAndLoss.Context);
5196
- const [hoveredItem, setHoveredItem] = useState15();
5197
- const chartData = useMemo5(() => {
5198
- if (!filteredData) {
5199
- return [];
5200
- }
5201
- return filteredData.map((x) => {
5202
- if (x.hidden) {
5203
- return {
5204
- name: x.display_name,
5205
- value: 0
5206
- };
5207
- }
6105
+ var LedgerAccountsForm = () => {
6106
+ const { form, data, changeFormData, cancelForm, submitForm } = useContext10(
6107
+ LedgerAccountsContext
6108
+ );
6109
+ const parentOptions = useMemo8(
6110
+ () => flattenAccounts(data?.accounts || []).sort((a, b) => a?.name && b?.name ? a.name.localeCompare(b.name) : 0).map((x) => {
5208
6111
  return {
5209
- name: x.display_name,
5210
- value: x.value
6112
+ label: x.name,
6113
+ value: x.id
5211
6114
  };
5212
- });
5213
- }, [filteredData]);
5214
- const buildColClass = (column) => {
5215
- return classNames23(
5216
- "Layer__sortable-col",
5217
- sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
5218
- );
5219
- };
5220
- return /* @__PURE__ */ React68.createElement(
5221
- "div",
6115
+ }),
6116
+ [data?.accounts?.length]
6117
+ );
6118
+ const entry = useMemo8(() => {
6119
+ if (form?.action === "edit" && form.accountId) {
6120
+ return flattenAccounts(data?.accounts || []).find(
6121
+ (x) => x.id === form.accountId
6122
+ );
6123
+ }
6124
+ return;
6125
+ }, [data, form?.accountId]);
6126
+ console.log(entry);
6127
+ if (!form) {
6128
+ return;
6129
+ }
6130
+ return /* @__PURE__ */ React80.createElement(
6131
+ "form",
5222
6132
  {
5223
- className: classNames23(
5224
- "Layer__profit-and-loss__side-panel",
5225
- sidebarScope && "open"
5226
- )
6133
+ onSubmit: (e) => {
6134
+ e.preventDefault();
6135
+ submitForm();
6136
+ }
5227
6137
  },
5228
- /* @__PURE__ */ React68.createElement("div", { className: "Layer__profit-and-loss-detailed-charts" }, /* @__PURE__ */ React68.createElement("header", null, /* @__PURE__ */ React68.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ React68.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(sidebarScope)), /* @__PURE__ */ React68.createElement(Text, { size: "sm" /* sm */, className: "date" }, format6(dateRange.startDate, "LLLL, y"))), /* @__PURE__ */ React68.createElement(
6138
+ /* @__PURE__ */ React80.createElement("div", { className: "Layer__ledger-accounts__sidebar__header" }, /* @__PURE__ */ React80.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, form?.action === "edit" ? "Edit" : "Add New", " Account"), /* @__PURE__ */ React80.createElement("div", { className: "actions" }, /* @__PURE__ */ React80.createElement(
5229
6139
  Button,
5230
6140
  {
5231
- rightIcon: /* @__PURE__ */ React68.createElement(X_default, null),
5232
- iconOnly: true,
5233
- onClick: () => setSidebarScope(void 0),
6141
+ type: "button",
6142
+ onClick: cancelForm,
5234
6143
  variant: "secondary" /* secondary */
5235
- }
5236
- )), /* @__PURE__ */ React68.createElement("div", { className: "chart-container" }, /* @__PURE__ */ React68.createElement(ResponsiveContainer2, null, /* @__PURE__ */ React68.createElement(PieChart, null, /* @__PURE__ */ React68.createElement(
5237
- Pie,
5238
- {
5239
- data: chartData,
5240
- dataKey: "value",
5241
- nameKey: "name",
5242
- cx: "50%",
5243
- cy: "50%",
5244
- innerRadius: 105,
5245
- outerRadius: 120,
5246
- paddingAngle: 0.5,
5247
- fill: "#8884d8"
5248
6144
  },
5249
- chartData.map((entry, index) => {
5250
- const colorConfig = DEFAULT_CHART_COLORS[index % DEFAULT_CHART_COLORS.length];
5251
- let fill = colorConfig.color;
5252
- let opacity = colorConfig.opacity;
5253
- let active = true;
5254
- if (hoveredItem && entry.name !== hoveredItem) {
5255
- active = false;
5256
- fill = void 0;
5257
- opacity = INACTIVE_OPACITY_LEVELS[index % INACTIVE_OPACITY_LEVELS.length];
5258
- }
5259
- return /* @__PURE__ */ React68.createElement(
5260
- Cell2,
5261
- {
5262
- key: `cell-${index}`,
5263
- className: `Layer__profit-and-loss-detailed-charts__pie ${hoveredItem && active ? "active" : "inactive"}`,
5264
- style: { fill },
5265
- opacity,
5266
- onMouseEnter: () => setHoveredItem(entry.name),
5267
- onMouseLeave: () => setHoveredItem(void 0)
5268
- }
5269
- );
5270
- }),
5271
- /* @__PURE__ */ React68.createElement(
5272
- Label,
5273
- {
5274
- position: "center",
5275
- value: "Total",
5276
- className: "pie-center-label-title",
5277
- content: (props) => {
5278
- const { cx, cy } = props.viewBox ?? {
5279
- cx: 0,
5280
- cy: 0
5281
- };
5282
- const positioningProps = {
5283
- x: cx,
5284
- y: (cy || 0) - 15,
5285
- textAnchor: "middle",
5286
- verticalAnchor: "middle"
5287
- };
5288
- let text = "Total";
5289
- if (hoveredItem) {
5290
- text = hoveredItem;
5291
- }
5292
- return /* @__PURE__ */ React68.createElement(
5293
- ChartText,
5294
- {
5295
- ...positioningProps,
5296
- className: "pie-center-label__title"
5297
- },
5298
- text
5299
- );
5300
- }
5301
- }
5302
- ),
5303
- /* @__PURE__ */ React68.createElement(
5304
- Label,
5305
- {
5306
- position: "center",
5307
- value: "Total",
5308
- className: "pie-center-label-title",
5309
- content: (props) => {
5310
- const { cx, cy } = props.viewBox ?? {
5311
- cx: 0,
5312
- cy: 0
5313
- };
5314
- const positioningProps = {
5315
- x: cx,
5316
- y: (cy || 0) + 5,
5317
- textAnchor: "middle",
5318
- verticalAnchor: "middle"
5319
- };
5320
- let value = filteredTotal;
5321
- if (hoveredItem) {
5322
- value = filteredData.find(
5323
- (x) => x.display_name === hoveredItem
5324
- )?.value;
5325
- }
5326
- return /* @__PURE__ */ React68.createElement(
5327
- ChartText,
5328
- {
5329
- ...positioningProps,
5330
- className: "pie-center-label__value"
5331
- },
5332
- `$${centsToDollars(value)}`
5333
- );
5334
- }
5335
- }
5336
- ),
5337
- /* @__PURE__ */ React68.createElement(
5338
- Label,
5339
- {
5340
- position: "center",
5341
- value: "Total",
5342
- className: "pie-center-label-title",
5343
- content: (props) => {
5344
- const { cx, cy } = props.viewBox ?? {
5345
- cx: 0,
5346
- cy: 0
5347
- };
5348
- const positioningProps = {
5349
- x: cx,
5350
- y: (cy || 0) + 25,
5351
- height: 20,
5352
- textAnchor: "middle",
5353
- verticalAnchor: "middle"
5354
- };
5355
- if (hoveredItem) {
5356
- return /* @__PURE__ */ React68.createElement(
5357
- ChartText,
5358
- {
5359
- ...positioningProps,
5360
- className: "pie-center-label__share"
5361
- },
5362
- `${formatPercent(
5363
- filteredData.find(
5364
- (x) => x.display_name === hoveredItem
5365
- )?.share
5366
- )}%`
5367
- );
5368
- }
5369
- return;
5370
- }
5371
- }
5372
- )
5373
- )))), /* @__PURE__ */ React68.createElement("div", { className: "filters" }, /* @__PURE__ */ React68.createElement(Text, { size: "sm" /* sm */, className: "Layer__label" }, "Filters"), /* @__PURE__ */ React68.createElement(
6145
+ "Cancel"
6146
+ ), /* @__PURE__ */ React80.createElement(SubmitButton, { type: "submit", noIcon: true, active: true }, "Save"))),
6147
+ entry && /* @__PURE__ */ React80.createElement("div", { className: "Layer__ledger-accounts__form-edit-entry" }, /* @__PURE__ */ React80.createElement(Text, { weight: "bold" /* bold */ }, entry.name), /* @__PURE__ */ React80.createElement(Text, { weight: "bold" /* bold */ }, "$", centsToDollars(entry.balance || 0))),
6148
+ /* @__PURE__ */ React80.createElement("div", { className: "Layer__ledger-accounts__form" }, /* @__PURE__ */ React80.createElement(InputGroup, { name: "parent", label: "Parent", inline: true }, /* @__PURE__ */ React80.createElement(
5374
6149
  Select3,
5375
6150
  {
5376
- className: "type-select",
5377
- classNamePrefix: "Layer__select",
5378
- value: sidebarScope && filters[sidebarScope]?.types ? sidebarScope && filters[sidebarScope]?.types?.map((x) => ({
5379
- value: x,
5380
- label: x
5381
- })) : [],
5382
- isMulti: true,
5383
- isClearable: false,
5384
- options: [...new Set(filteredData?.map((x) => x.type))].map((x) => ({
5385
- label: x,
5386
- value: x
5387
- })),
5388
- onChange: (selected) => {
5389
- setFilterTypes(
5390
- sidebarScope ?? "expenses",
5391
- selected.map((x) => x.value)
5392
- );
5393
- }
6151
+ options: parentOptions,
6152
+ value: form?.data.parent,
6153
+ onChange: (sel) => changeFormData("parent", sel)
5394
6154
  }
5395
- )), /* @__PURE__ */ React68.createElement("div", { className: "details-container" }, /* @__PURE__ */ React68.createElement("div", { className: "table" }, /* @__PURE__ */ React68.createElement("table", null, /* @__PURE__ */ React68.createElement("thead", null, /* @__PURE__ */ React68.createElement("tr", null, /* @__PURE__ */ React68.createElement(
5396
- "th",
6155
+ )), /* @__PURE__ */ React80.createElement(InputGroup, { name: "name", label: "Name", inline: true }, /* @__PURE__ */ React80.createElement(
6156
+ Input,
5397
6157
  {
5398
- className: buildColClass("category"),
5399
- onClick: () => sortBy(sidebarScope ?? "expenses", "category")
5400
- },
5401
- "Expense/Sale ",
5402
- /* @__PURE__ */ React68.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
5403
- ), /* @__PURE__ */ React68.createElement(
5404
- "th",
6158
+ name: "name",
6159
+ value: form?.data.name,
6160
+ onChange: (e) => changeFormData("name", e.target.value)
6161
+ }
6162
+ )), /* @__PURE__ */ React80.createElement(InputGroup, { name: "type", label: "Type", inline: true }, /* @__PURE__ */ React80.createElement(
6163
+ Select3,
5405
6164
  {
5406
- className: buildColClass("type"),
5407
- onClick: () => sortBy(sidebarScope ?? "expenses", "type")
5408
- },
5409
- "Type ",
5410
- /* @__PURE__ */ React68.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
5411
- ), /* @__PURE__ */ React68.createElement("th", null), /* @__PURE__ */ React68.createElement(
5412
- "th",
6165
+ options: [],
6166
+ disabled: true,
6167
+ value: form?.data.type,
6168
+ onChange: (sel) => changeFormData("type", sel)
6169
+ }
6170
+ )), /* @__PURE__ */ React80.createElement(InputGroup, { name: "subType", label: "Sub-Type", inline: true }, /* @__PURE__ */ React80.createElement(
6171
+ Select3,
5413
6172
  {
5414
- className: buildColClass("value"),
5415
- onClick: () => sortBy(sidebarScope ?? "expenses", "value")
5416
- },
5417
- "Value ",
5418
- /* @__PURE__ */ React68.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
5419
- ))), /* @__PURE__ */ React68.createElement("tbody", null, filteredData.filter((x) => !x.hidden).map((item, idx) => {
5420
- const colorConfig = DEFAULT_CHART_COLORS[idx % DEFAULT_CHART_COLORS.length];
5421
- return /* @__PURE__ */ React68.createElement(
5422
- "tr",
5423
- {
5424
- key: `pl-side-table-item-${idx}`,
5425
- className: classNames23(
5426
- "Layer__profit-and-loss-detailed-table__row",
5427
- hoveredItem && hoveredItem !== item.display_name ? "inactive" : ""
5428
- ),
5429
- onMouseEnter: () => setHoveredItem(item.display_name),
5430
- onMouseLeave: () => setHoveredItem(void 0)
5431
- },
5432
- /* @__PURE__ */ React68.createElement("td", { className: "category-col" }, item.display_name),
5433
- /* @__PURE__ */ React68.createElement("td", { className: "type-col" }, item.type),
5434
- /* @__PURE__ */ React68.createElement("td", { className: "value-col" }, "$", centsToDollars(item.value)),
5435
- /* @__PURE__ */ React68.createElement("td", { className: "share-col" }, /* @__PURE__ */ React68.createElement("span", { className: "share-cell-content" }, formatPercent(item.share), "%", /* @__PURE__ */ React68.createElement(
5436
- "div",
5437
- {
5438
- className: "share-icon",
5439
- style: {
5440
- background: colorConfig.color,
5441
- opacity: colorConfig.opacity
5442
- }
5443
- }
5444
- )))
5445
- );
5446
- }))))))
6173
+ options: SUB_TYPE_OPTIONS,
6174
+ value: form?.data.subType,
6175
+ onChange: (sel) => changeFormData("subType", sel)
6176
+ }
6177
+ )), /* @__PURE__ */ React80.createElement(InputGroup, { name: "category", label: "Category", inline: true }, /* @__PURE__ */ React80.createElement(
6178
+ Select3,
6179
+ {
6180
+ options: [],
6181
+ value: form?.data.category,
6182
+ onChange: (sel) => changeFormData("category", sel)
6183
+ }
6184
+ )))
5447
6185
  );
5448
6186
  };
5449
6187
 
5450
- // src/components/ProfitAndLossView/ProfitAndLossView.tsx
5451
- var COMPONENT_NAME3 = "profit-and-loss";
5452
- var ProfitAndLossView = (props) => {
5453
- return /* @__PURE__ */ React69.createElement(Container, { name: COMPONENT_NAME3 }, /* @__PURE__ */ React69.createElement(ProfitAndLoss, null, /* @__PURE__ */ React69.createElement("div", { className: `Layer__${COMPONENT_NAME3}__main-panel` }, /* @__PURE__ */ React69.createElement(Header, { className: `Layer__${COMPONENT_NAME3}__header` }, /* @__PURE__ */ React69.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Profit & Loss")), /* @__PURE__ */ React69.createElement(Components, { ...props })), props.showDetailedCharts !== false && /* @__PURE__ */ React69.createElement(ProfitAndLossDetailedCharts, null)));
5454
- };
5455
- var Components = ({
5456
- hideChart = false,
5457
- hideTable = false
5458
- }) => {
5459
- const { error, isLoading, isValidating, refetch } = useContext7(
5460
- ProfitAndLoss.Context
5461
- );
5462
- if (!isLoading && error) {
5463
- return /* @__PURE__ */ React69.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React69.createElement(
5464
- DataState,
5465
- {
5466
- status: "failed" /* failed */,
5467
- title: "Something went wrong",
5468
- description: "We couldn\u2019t load your data.",
5469
- onRefresh: () => refetch(),
5470
- isLoading: isValidating
5471
- }
5472
- ));
5473
- }
5474
- return /* @__PURE__ */ React69.createElement(React69.Fragment, null, !hideChart && /* @__PURE__ */ React69.createElement("div", { className: `Layer__${COMPONENT_NAME3}__chart_with_summaries` }, /* @__PURE__ */ React69.createElement(
6188
+ // src/components/LedgerAccountsSidebar/LedgerAccountsSidebar.tsx
6189
+ import classNames27 from "classnames";
6190
+ var LedgerAccountsSidebar = () => {
6191
+ const { form } = useContext11(LedgerAccountsContext);
6192
+ return /* @__PURE__ */ React81.createElement(
5475
6193
  "div",
5476
6194
  {
5477
- className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__summary-col`
6195
+ className: classNames27(
6196
+ "Layer__ledger-accounts__sidebar",
6197
+ form ? "open" : ""
6198
+ )
5478
6199
  },
5479
- /* @__PURE__ */ React69.createElement(ProfitAndLoss.DatePicker, null),
5480
- /* @__PURE__ */ React69.createElement(ProfitAndLoss.Summaries, { vertical: true })
5481
- ), /* @__PURE__ */ React69.createElement(
5482
- "div",
6200
+ /* @__PURE__ */ React81.createElement("div", { className: "Layer__ledger-accounts__sidebar-content" }, /* @__PURE__ */ React81.createElement(LedgerAccountsForm, null))
6201
+ );
6202
+ };
6203
+
6204
+ // src/components/LedgerAccounts/LedgerAccounts.tsx
6205
+ var COMPONENT_NAME4 = "ledger-accounts";
6206
+ var LedgerAccountsContext = createContext3({
6207
+ data: void 0,
6208
+ isLoading: false,
6209
+ isValidating: false,
6210
+ error: void 0,
6211
+ refetch: () => {
6212
+ },
6213
+ create: () => {
6214
+ },
6215
+ form: void 0,
6216
+ addAccount: () => {
6217
+ },
6218
+ editAccount: () => {
6219
+ },
6220
+ cancelForm: () => {
6221
+ },
6222
+ changeFormData: () => {
6223
+ },
6224
+ submitForm: () => {
6225
+ },
6226
+ showARForAccountId: void 0,
6227
+ setShowARForAccountId: () => {
6228
+ }
6229
+ });
6230
+ var LedgerAccounts = () => {
6231
+ const contextData = useLedgerAccounts();
6232
+ return /* @__PURE__ */ React82.createElement(LedgerAccountsContext.Provider, { value: contextData }, /* @__PURE__ */ React82.createElement(LedgerAccountsContent, null));
6233
+ };
6234
+ var LedgerAccountsContent = () => {
6235
+ const { data, isLoading, addAccount, error, isValidating, refetch } = useContext12(LedgerAccountsContext);
6236
+ return /* @__PURE__ */ React82.createElement(Container, { name: COMPONENT_NAME4 }, /* @__PURE__ */ React82.createElement("div", { className: `Layer__${COMPONENT_NAME4}__main-panel` }, /* @__PURE__ */ React82.createElement(Header, { className: `Layer__${COMPONENT_NAME4}__header` }, /* @__PURE__ */ React82.createElement(Heading, { className: `Layer__${COMPONENT_NAME4}__title` }, "Chart of Accounts"), /* @__PURE__ */ React82.createElement("div", { className: `Layer__${COMPONENT_NAME4}__actions` }, /* @__PURE__ */ React82.createElement(
6237
+ Button,
5483
6238
  {
5484
- className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__chart-col`
6239
+ variant: "secondary" /* secondary */,
6240
+ disabled: isLoading,
6241
+ rightIcon: /* @__PURE__ */ React82.createElement(DownloadCloud_default, { size: 12 })
5485
6242
  },
5486
- /* @__PURE__ */ React69.createElement(ProfitAndLoss.Chart, null)
5487
- )), !hideTable && /* @__PURE__ */ React69.createElement(ProfitAndLoss.Table, null));
6243
+ "Download"
6244
+ ), /* @__PURE__ */ React82.createElement(Button, { onClick: () => addAccount(), disabled: isLoading }, "Add Account"))), /* @__PURE__ */ React82.createElement("div", { className: `Layer__${COMPONENT_NAME4}__table` }, /* @__PURE__ */ React82.createElement("div", { className: "Layer__alt-table-row Layer__alt-table-row--header" }, /* @__PURE__ */ React82.createElement("div", { className: "Layer__alt-table__head-cell Layer__coa__name" }, "Name"), /* @__PURE__ */ React82.createElement("div", { className: "Layer__alt-table__head-cell Layer__coa__type" }, "Type"), /* @__PURE__ */ React82.createElement("div", { className: "Layer__alt-table__head-cell Layer__coa__subtype" }, "Sub-Type"), /* @__PURE__ */ React82.createElement("div", { className: "Layer__alt-table__head-cell Layer__coa__balance" }, "Balance"), /* @__PURE__ */ React82.createElement("div", { className: "Layer__alt-table__head-cell Layer__coa__actions" })), error ? /* @__PURE__ */ React82.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React82.createElement(
6245
+ DataState,
6246
+ {
6247
+ status: "failed" /* failed */,
6248
+ title: "Something went wrong",
6249
+ description: "We couldn\u2019t load your data.",
6250
+ onRefresh: () => refetch(),
6251
+ isLoading: isValidating || isLoading
6252
+ }
6253
+ )) : null, (!data || isLoading) && !error ? /* @__PURE__ */ React82.createElement("div", { className: `Layer__${COMPONENT_NAME4}__loader-container` }, /* @__PURE__ */ React82.createElement(Loader2, null)) : null, !error && data?.accounts.map((account) => /* @__PURE__ */ React82.createElement(LedgerAccountsRow, { key: account.id, account, depth: 0 })), !isLoading && !error && data?.accounts.length === 0 ? /* @__PURE__ */ React82.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React82.createElement(
6254
+ DataState,
6255
+ {
6256
+ status: "info" /* info */,
6257
+ title: "Accounts were not found",
6258
+ description: 'New account can be created with "Add Account".',
6259
+ onRefresh: () => refetch(),
6260
+ isLoading: isValidating
6261
+ }
6262
+ )) : null)), /* @__PURE__ */ React82.createElement(LedgerAccountsSidebar, null), /* @__PURE__ */ React82.createElement(AccountsReceivable, null));
5488
6263
  };
5489
6264
 
5490
6265
  // src/providers/LayerProvider/LayerProvider.tsx
5491
- import React70, { useReducer, useEffect as useEffect9 } from "react";
6266
+ import React83, { useReducer, useEffect as useEffect9 } from "react";
5492
6267
  import { add as add2, isBefore } from "date-fns";
5493
- import useSWR5, { SWRConfig } from "swr";
6268
+ import useSWR6, { SWRConfig } from "swr";
5494
6269
  var reducer = (state, action) => {
5495
6270
  switch (action.type) {
5496
6271
  case "LayerContext.setAuth" /* setAuth */:
@@ -5543,7 +6318,7 @@ var LayerProvider = ({
5543
6318
  theme,
5544
6319
  colors
5545
6320
  });
5546
- const { data: auth } = appId !== void 0 && appSecret !== void 0 ? useSWR5(
6321
+ const { data: auth } = appId !== void 0 && appSecret !== void 0 ? useSWR6(
5547
6322
  businessAccessToken === void 0 && appId !== void 0 && appSecret !== void 0 && isBefore(state.auth.expires_at, /* @__PURE__ */ new Date()) && "authenticate",
5548
6323
  Layer.authenticate({
5549
6324
  appId,
@@ -5578,7 +6353,7 @@ var LayerProvider = ({
5578
6353
  });
5579
6354
  }
5580
6355
  }, [businessAccessToken, auth?.access_token]);
5581
- useSWR5(
6356
+ useSWR6(
5582
6357
  businessId && auth?.access_token && `categories-${businessId}`,
5583
6358
  Layer.getCategories(apiUrl, auth?.access_token, { params: { businessId } }),
5584
6359
  {
@@ -5603,170 +6378,14 @@ var LayerProvider = ({
5603
6378
  }
5604
6379
  return;
5605
6380
  };
5606
- return /* @__PURE__ */ React70.createElement(SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ React70.createElement(LayerContext.Provider, { value: { ...state, setTheme, getColor } }, children));
5607
- };
5608
-
5609
- // src/components/ChartOfAccounts/ChartOfAccounts.tsx
5610
- import React73, { useState as useState17 } from "react";
5611
-
5612
- // src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
5613
- import useSWR6 from "swr";
5614
- var useChartOfAccounts = () => {
5615
- const { auth, businessId, apiUrl } = useLayerContext();
5616
- const { data, isLoading, error, mutate } = useSWR6(
5617
- businessId && auth?.access_token && `chart-of-accounts-${businessId}`,
5618
- Layer.getChartOfAccounts(apiUrl, auth?.access_token, {
5619
- params: { businessId }
5620
- })
5621
- );
5622
- const create = (newAccount) => Layer.createAccount(apiUrl, auth?.access_token, {
5623
- params: { businessId },
5624
- body: newAccount
5625
- }).then(({ data: data2 }) => (mutate(), data2));
5626
- return { data: data?.data, isLoading, error, create };
5627
- };
5628
-
5629
- // src/components/ChartOfAccountsNewForm/ChartOfAccountsNewForm.tsx
5630
- import React71, { useMemo as useMemo6, useState as useState16 } from "react";
5631
- import Select4 from "react-select";
5632
- var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.subAccounts || [])]).flat().filter((id) => id);
5633
- var ChartOfAccountsNewForm = () => {
5634
- const { data, create: createAccount2 } = useChartOfAccounts();
5635
- const accountOptions = useMemo6(
5636
- () => flattenAccounts(data?.accounts || []).sort(
5637
- (a, b) => a?.name && b?.name ? a.name.localeCompare(b.name) : 0
5638
- ),
5639
- [data?.accounts?.length]
5640
- );
5641
- const [name, setName] = useState16("");
5642
- const [description, setDescription] = useState16("");
5643
- const [normality, setNormality] = useState16("DEBIT" /* DEBIT */);
5644
- const [parentAccount, setParentAccount] = useState16(
5645
- data?.accounts[0]
5646
- );
5647
- const save = () => {
5648
- createAccount2({
5649
- name,
5650
- normality,
5651
- parent_id: {
5652
- type: "AccountId",
5653
- id: parentAccount?.id || ""
5654
- },
5655
- description
5656
- });
5657
- };
5658
- return /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form" }, /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React71.createElement("span", null, "Name"), /* @__PURE__ */ React71.createElement(
5659
- "input",
5660
- {
5661
- name: "name",
5662
- value: name,
5663
- onChange: (event) => setName(event.target.value)
5664
- }
5665
- )), /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React71.createElement("span", null, "Description"), /* @__PURE__ */ React71.createElement(
5666
- "input",
5667
- {
5668
- name: "description",
5669
- value: description,
5670
- onChange: (event) => setDescription(event.target.value)
5671
- }
5672
- )), /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React71.createElement("span", null, "Normality"), /* @__PURE__ */ React71.createElement(
5673
- Select4,
5674
- {
5675
- isSearchable: false,
5676
- onChange: (value) => value && setNormality(value.value),
5677
- options: [
5678
- { label: "Credit", value: "CREDIT" /* CREDIT */ },
5679
- { label: "Debit", value: "DEBIT" /* DEBIT */ }
5680
- ]
5681
- }
5682
- )), /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React71.createElement("span", null, "Parent Account"), /* @__PURE__ */ React71.createElement(
5683
- Select4,
5684
- {
5685
- isSearchable: true,
5686
- value: parentAccount,
5687
- onChange: (value) => value && setParentAccount(value),
5688
- getOptionLabel: (a) => a.name,
5689
- getOptionValue: (a) => a.id,
5690
- options: accountOptions
5691
- }
5692
- )), /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form__field Layer__chart-of-accounts-new-form__field--actions" }, /* @__PURE__ */ React71.createElement("button", { onClick: save }, "Save")));
5693
- };
5694
-
5695
- // src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
5696
- import React72 from "react";
5697
- var ChartOfAccountsRow = ({ account, depth = 0 }) => {
5698
- const classNames24 = [
5699
- "Layer__chart-of-accounts-row__table-cell",
5700
- depth > 0 && `Layer__chart-of-accounts-row__table-cell--depth-${depth}`
5701
- ];
5702
- const className = classNames24.filter((id) => id).join(" ");
5703
- const amountClassName = account.balance < 0 ? "Layer__chart-of-accounts-row__table-cell--amount-negative" : "Layer__chart-of-accounts-row__table-cell--amount-positive";
5704
- return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
5705
- "div",
5706
- {
5707
- className: `${className} Layer__chart-of-accounts-row__table-cell--name`
5708
- },
5709
- account.name
5710
- ), /* @__PURE__ */ React72.createElement(
5711
- "div",
5712
- {
5713
- className: `${className} Layer__chart-of-accounts-row__table-cell--type`
5714
- },
5715
- "Assets"
5716
- ), /* @__PURE__ */ React72.createElement(
5717
- "div",
5718
- {
5719
- className: `${className} Layer__chart-of-accounts-row__table-cell--subtype`
5720
- },
5721
- "Cash"
5722
- ), /* @__PURE__ */ React72.createElement(
5723
- "div",
5724
- {
5725
- className: `${className} Layer__chart-of-accounts-row__table-cell--balance ${amountClassName}`
5726
- },
5727
- centsToDollars(Math.abs(account.balance || 0))
5728
- ), /* @__PURE__ */ React72.createElement(
5729
- "div",
5730
- {
5731
- className: `${className} Layer__chart-of-accounts-row__table-cell--actions`
5732
- },
5733
- /* @__PURE__ */ React72.createElement("button", { className: "Layer__chart-of-accounts-row__view-entries-button" }, "View Entries")
5734
- ), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */ React72.createElement(
5735
- ChartOfAccountsRow,
5736
- {
5737
- key: subAccount.id,
5738
- account: subAccount,
5739
- depth: depth + 1
5740
- }
5741
- )));
5742
- };
5743
-
5744
- // src/components/ChartOfAccounts/ChartOfAccounts.tsx
5745
- var ChartOfAccounts = () => {
5746
- const { data, isLoading } = useChartOfAccounts();
5747
- const [showingForm, setShowingForm] = useState17(false);
5748
- return /* @__PURE__ */ React73.createElement("div", { className: "Layer__component Layer__chart-of-accounts" }, !data || isLoading ? "Loading." : /* @__PURE__ */ React73.createElement(React73.Fragment, null, /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__header" }, /* @__PURE__ */ React73.createElement("h2", { className: "Layer__chart-of-accounts__title" }, "Chart of Accounts"), /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__actions" }, /* @__PURE__ */ React73.createElement("button", { className: "Layer__chart-of-accounts__download-button" }, /* @__PURE__ */ React73.createElement(DownloadCloud_default, null), "Download"), /* @__PURE__ */ React73.createElement(
5749
- "button",
5750
- {
5751
- className: "Layer__chart-of-accounts__edit-accounts-button",
5752
- onClick: () => setShowingForm(!showingForm)
5753
- },
5754
- "Edit Accounts"
5755
- ))), showingForm && /* @__PURE__ */ React73.createElement(ChartOfAccountsNewForm, null), /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Name"), /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Type"), /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Sub-Type"), /* @__PURE__ */ React73.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__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }), data.accounts.map((account) => /* @__PURE__ */ React73.createElement(
5756
- ChartOfAccountsRow,
5757
- {
5758
- key: account.id,
5759
- account,
5760
- depth: 0
5761
- }
5762
- )))));
6381
+ return /* @__PURE__ */ React83.createElement(SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ React83.createElement(LayerContext.Provider, { value: { ...state, setTheme, getColor } }, children));
5763
6382
  };
5764
6383
  export {
5765
6384
  BalanceSheet,
5766
6385
  BankTransactions,
5767
- ChartOfAccounts,
5768
6386
  Hello,
5769
6387
  LayerProvider,
6388
+ LedgerAccounts,
5770
6389
  LinkedAccounts,
5771
6390
  ProfitAndLoss,
5772
6391
  ProfitAndLossView