@layerfi/components 0.1.14 → 0.1.15

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
@@ -4880,7 +4880,7 @@ var LinkedAccountThumb = ({
4880
4880
  size: "sm"
4881
4881
  },
4882
4882
  "Bank balance"
4883
- ), /* @__PURE__ */ React63.createElement(Text, { as: "span", className: "account-balance" }, "$", centsToDollars(account.latest_balance_timestamp.balance))), /* @__PURE__ */ React63.createElement("div", { className: "bottombar" }, asWidget ? /* @__PURE__ */ React63.createElement(
4883
+ ), /* @__PURE__ */ React63.createElement(Text, { as: "span", className: "account-balance" }, "$", centsToDollars(account.latest_balance_timestamp?.balance))), /* @__PURE__ */ React63.createElement("div", { className: "bottombar" }, asWidget ? /* @__PURE__ */ React63.createElement(
4884
4884
  AccountNumber,
4885
4885
  {
4886
4886
  accountNumber: "TODO"
@@ -5015,12 +5015,12 @@ var applyShare = (items, total) => {
5015
5015
  });
5016
5016
  };
5017
5017
 
5018
- // src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
5018
+ // src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
5019
5019
  import { startOfMonth, endOfMonth, formatISO } from "date-fns";
5020
5020
  import useSWR5 from "swr";
5021
- var useProfitAndLossQuery = ({
5022
- startDate,
5023
- endDate,
5021
+ var useProfitAndLoss = ({
5022
+ startDate: initialStartDate,
5023
+ endDate: initialEndDate,
5024
5024
  tagFilter,
5025
5025
  reportingBasis
5026
5026
  } = {
@@ -5028,6 +5028,17 @@ var useProfitAndLossQuery = ({
5028
5028
  endDate: endOfMonth(/* @__PURE__ */ new Date())
5029
5029
  }) => {
5030
5030
  const { auth, businessId, apiUrl } = useLayerContext();
5031
+ const [startDate, setStartDate] = useState13(
5032
+ initialStartDate || startOfMonth(Date.now())
5033
+ );
5034
+ const [endDate, setEndDate] = useState13(
5035
+ initialEndDate || endOfMonth(Date.now())
5036
+ );
5037
+ const [filters, setFilters] = useState13({
5038
+ expenses: void 0,
5039
+ revenue: void 0
5040
+ });
5041
+ const [sidebarScope, setSidebarScope] = useState13(void 0);
5031
5042
  const {
5032
5043
  data: rawData,
5033
5044
  isLoading,
@@ -5041,83 +5052,15 @@ var useProfitAndLossQuery = ({
5041
5052
  Layer.getProfitAndLoss(apiUrl, auth?.access_token, {
5042
5053
  params: {
5043
5054
  businessId,
5044
- startDate: formatISO(startDate.valueOf()),
5045
- endDate: formatISO(endDate.valueOf()),
5055
+ startDate: formatISO(startDate),
5056
+ endDate: formatISO(endDate),
5046
5057
  tagKey: tagFilter?.key,
5047
5058
  tagValues: tagFilter?.values?.join(","),
5048
5059
  reportingBasis
5049
5060
  }
5050
5061
  })
5051
5062
  );
5052
- const refetch = () => {
5053
- mutate();
5054
- };
5055
- return {
5056
- startDate,
5057
- endDate,
5058
- data: rawData?.data,
5059
- isLoading,
5060
- isValidating,
5061
- error: rawError,
5062
- refetch
5063
- };
5064
- };
5065
-
5066
- // src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
5067
- import { startOfMonth as startOfMonth2, endOfMonth as endOfMonth2 } from "date-fns";
5068
- var useProfitAndLoss = ({
5069
- startDate: initialStartDate,
5070
- endDate: initialEndDate,
5071
- tagFilter,
5072
- reportingBasis,
5073
- fetchMultipleMonths = false
5074
- } = {
5075
- startDate: startOfMonth2(/* @__PURE__ */ new Date()),
5076
- endDate: endOfMonth2(/* @__PURE__ */ new Date())
5077
- }) => {
5078
- const [startDate, setStartDate] = useState13(
5079
- initialStartDate || startOfMonth2(Date.now())
5080
- );
5081
- const [endDate, setEndDate] = useState13(
5082
- initialEndDate || endOfMonth2(Date.now())
5083
- );
5084
- const [filters, setFilters] = useState13({
5085
- expenses: void 0,
5086
- revenue: void 0
5087
- });
5088
- const [sidebarScope, setSidebarScope] = useState13(void 0);
5089
- const { data, isLoading, isValidating, error, refetch } = useProfitAndLossQuery({
5090
- startDate,
5091
- endDate,
5092
- tagFilter,
5093
- reportingBasis
5094
- });
5095
- const changeDateRange = ({
5096
- startDate: newStartDate,
5097
- endDate: newEndDate
5098
- }) => {
5099
- newStartDate && setStartDate(newStartDate);
5100
- newEndDate && setEndDate(newEndDate);
5101
- };
5102
- const sortBy = (scope, field, direction) => {
5103
- setFilters({
5104
- ...filters,
5105
- [scope]: {
5106
- ...filters[scope],
5107
- sortBy: field,
5108
- sortDirection: direction ?? filters[scope]?.sortDirection === "desc" ? "asc" : "desc"
5109
- }
5110
- });
5111
- };
5112
- const setFilterTypes = (scope, types) => {
5113
- setFilters({
5114
- ...filters,
5115
- [scope]: {
5116
- ...filters[scope],
5117
- types
5118
- }
5119
- });
5120
- };
5063
+ const { data, error } = rawData || {};
5121
5064
  const { filteredDataRevenue, filteredTotalRevenue } = useMemo3(() => {
5122
5065
  if (!data) {
5123
5066
  return { filteredDataRevenue: [], filteredTotalRevenue: void 0 };
@@ -5192,6 +5135,35 @@ var useProfitAndLoss = ({
5192
5135
  const withShare = applyShare(sorted, total);
5193
5136
  return { filteredDataExpenses: withShare, filteredTotalExpenses: total };
5194
5137
  }, [data, startDate, filters, sidebarScope]);
5138
+ const changeDateRange = ({
5139
+ startDate: newStartDate,
5140
+ endDate: newEndDate
5141
+ }) => {
5142
+ newStartDate && setStartDate(newStartDate);
5143
+ newEndDate && setEndDate(newEndDate);
5144
+ };
5145
+ const refetch = () => {
5146
+ mutate();
5147
+ };
5148
+ const sortBy = (scope, field, direction) => {
5149
+ setFilters({
5150
+ ...filters,
5151
+ [scope]: {
5152
+ ...filters[scope],
5153
+ sortBy: field,
5154
+ sortDirection: direction ?? filters[scope]?.sortDirection === "desc" ? "asc" : "desc"
5155
+ }
5156
+ });
5157
+ };
5158
+ const setFilterTypes = (scope, types) => {
5159
+ setFilters({
5160
+ ...filters,
5161
+ [scope]: {
5162
+ ...filters[scope],
5163
+ types
5164
+ }
5165
+ });
5166
+ };
5195
5167
  return {
5196
5168
  data,
5197
5169
  filteredDataRevenue,
@@ -5200,7 +5172,7 @@ var useProfitAndLoss = ({
5200
5172
  filteredTotalExpenses,
5201
5173
  isLoading,
5202
5174
  isValidating,
5203
- error,
5175
+ error: error || rawError,
5204
5176
  dateRange: { startDate, endDate },
5205
5177
  refetch,
5206
5178
  changeDateRange,
@@ -5213,350 +5185,7 @@ var useProfitAndLoss = ({
5213
5185
  };
5214
5186
 
5215
5187
  // src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
5216
- import React66, { useContext as useContext2, useEffect as useEffect12, useMemo as useMemo5, useState as useState16 } from "react";
5217
-
5218
- // src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
5219
- import { useEffect as useEffect10, useMemo as useMemo4, useState as useState14 } from "react";
5220
- import { startOfMonth as startOfMonth3, endOfMonth as endOfMonth3, sub } from "date-fns";
5221
- var buildDates = ({ currentDate }) => {
5222
- const list = [];
5223
- for (let i = 11; i > 0; i--) {
5224
- const startDateWithOffset = startOfMonth3(sub(currentDate, { months: i }));
5225
- const endDateWithOffset = endOfMonth3(sub(currentDate, { months: i }));
5226
- list.push({
5227
- startDate: startDateWithOffset,
5228
- endDate: endDateWithOffset
5229
- });
5230
- }
5231
- list.push({
5232
- startDate: startOfMonth3(currentDate),
5233
- endDate: endOfMonth3(currentDate)
5234
- });
5235
- return list;
5236
- };
5237
- var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
5238
- currentDate: /* @__PURE__ */ new Date()
5239
- }) => {
5240
- const { businessId } = useLayerContext();
5241
- const [loaded, setLoaded] = useState14("initial");
5242
- const dates = useMemo4(() => {
5243
- return buildDates({ currentDate });
5244
- }, [currentDate, businessId, tagFilter, reportingBasis]);
5245
- const {
5246
- data: data0,
5247
- isLoading: isLoading0,
5248
- error: error0,
5249
- startDate: startDate0,
5250
- endDate: endDate0
5251
- } = useProfitAndLossQuery({
5252
- startDate: dates[0].startDate,
5253
- endDate: dates[0].endDate,
5254
- tagFilter,
5255
- reportingBasis
5256
- });
5257
- const {
5258
- data: data1,
5259
- isLoading: isLoading1,
5260
- error: error1,
5261
- startDate: startDate1,
5262
- endDate: endDate1
5263
- } = useProfitAndLossQuery({
5264
- startDate: dates[1].startDate,
5265
- endDate: dates[1].endDate,
5266
- tagFilter,
5267
- reportingBasis
5268
- });
5269
- const {
5270
- data: data2,
5271
- isLoading: isLoading2,
5272
- error: error2,
5273
- startDate: startDate2,
5274
- endDate: endDate2
5275
- } = useProfitAndLossQuery({
5276
- startDate: dates[2].startDate,
5277
- endDate: dates[2].endDate,
5278
- tagFilter,
5279
- reportingBasis
5280
- });
5281
- const {
5282
- data: data3,
5283
- isLoading: isLoading3,
5284
- error: error3,
5285
- startDate: startDate3,
5286
- endDate: endDate3
5287
- } = useProfitAndLossQuery({
5288
- startDate: dates[3].startDate,
5289
- endDate: dates[3].endDate,
5290
- tagFilter,
5291
- reportingBasis
5292
- });
5293
- const {
5294
- data: data4,
5295
- isLoading: isLoading4,
5296
- error: error4,
5297
- startDate: startDate4,
5298
- endDate: endDate4
5299
- } = useProfitAndLossQuery({
5300
- startDate: dates[4].startDate,
5301
- endDate: dates[4].endDate,
5302
- tagFilter,
5303
- reportingBasis
5304
- });
5305
- const {
5306
- data: data5,
5307
- isLoading: isLoading5,
5308
- error: error5,
5309
- startDate: startDate5,
5310
- endDate: endDate5
5311
- } = useProfitAndLossQuery({
5312
- startDate: dates[5].startDate,
5313
- endDate: dates[5].endDate,
5314
- tagFilter,
5315
- reportingBasis
5316
- });
5317
- const {
5318
- data: data6,
5319
- isLoading: isLoading6,
5320
- error: error6,
5321
- startDate: startDate6,
5322
- endDate: endDate6
5323
- } = useProfitAndLossQuery({
5324
- startDate: dates[6].startDate,
5325
- endDate: dates[6].endDate,
5326
- tagFilter,
5327
- reportingBasis
5328
- });
5329
- const {
5330
- data: data7,
5331
- isLoading: isLoading7,
5332
- error: error7,
5333
- startDate: startDate7,
5334
- endDate: endDate7
5335
- } = useProfitAndLossQuery({
5336
- startDate: dates[7].startDate,
5337
- endDate: dates[7].endDate,
5338
- tagFilter,
5339
- reportingBasis
5340
- });
5341
- const {
5342
- data: data8,
5343
- isLoading: isLoading8,
5344
- error: error8,
5345
- startDate: startDate8,
5346
- endDate: endDate8
5347
- } = useProfitAndLossQuery({
5348
- startDate: dates[8].startDate,
5349
- endDate: dates[8].endDate,
5350
- tagFilter,
5351
- reportingBasis
5352
- });
5353
- const {
5354
- data: data9,
5355
- isLoading: isLoading9,
5356
- error: error9,
5357
- startDate: startDate9,
5358
- endDate: endDate9
5359
- } = useProfitAndLossQuery({
5360
- startDate: dates[9].startDate,
5361
- endDate: dates[9].endDate,
5362
- tagFilter,
5363
- reportingBasis
5364
- });
5365
- const {
5366
- data: data10,
5367
- isLoading: isLoading10,
5368
- error: error10,
5369
- startDate: startDate10,
5370
- endDate: endDate10
5371
- } = useProfitAndLossQuery({
5372
- startDate: dates[10].startDate,
5373
- endDate: dates[10].endDate,
5374
- tagFilter,
5375
- reportingBasis
5376
- });
5377
- const {
5378
- data: data11,
5379
- isLoading: isLoading11,
5380
- error: error11,
5381
- startDate: startDate11,
5382
- endDate: endDate11
5383
- } = useProfitAndLossQuery({
5384
- startDate: dates[11].startDate,
5385
- endDate: dates[11].endDate,
5386
- tagFilter,
5387
- reportingBasis
5388
- });
5389
- const { data, isLoading, error } = useMemo4(() => {
5390
- return {
5391
- data: [
5392
- {
5393
- data: data0,
5394
- isLoading: isLoading0,
5395
- error: error0,
5396
- startDate: startDate0,
5397
- endDate: endDate0
5398
- },
5399
- {
5400
- data: data1,
5401
- isLoading: isLoading1,
5402
- error: error1,
5403
- startDate: startDate1,
5404
- endDate: endDate1
5405
- },
5406
- {
5407
- data: data2,
5408
- isLoading: isLoading2,
5409
- error: error2,
5410
- startDate: startDate2,
5411
- endDate: endDate2
5412
- },
5413
- {
5414
- data: data3,
5415
- isLoading: isLoading3,
5416
- error: error3,
5417
- startDate: startDate3,
5418
- endDate: endDate3
5419
- },
5420
- {
5421
- data: data4,
5422
- isLoading: isLoading4,
5423
- error: error4,
5424
- startDate: startDate4,
5425
- endDate: endDate4
5426
- },
5427
- {
5428
- data: data5,
5429
- isLoading: isLoading5,
5430
- error: error5,
5431
- startDate: startDate5,
5432
- endDate: endDate5
5433
- },
5434
- {
5435
- data: data6,
5436
- isLoading: isLoading6,
5437
- error: error6,
5438
- startDate: startDate6,
5439
- endDate: endDate6
5440
- },
5441
- {
5442
- data: data7,
5443
- isLoading: isLoading7,
5444
- error: error7,
5445
- startDate: startDate7,
5446
- endDate: endDate7
5447
- },
5448
- {
5449
- data: data8,
5450
- isLoading: isLoading8,
5451
- error: error8,
5452
- startDate: startDate8,
5453
- endDate: endDate8
5454
- },
5455
- {
5456
- data: data9,
5457
- isLoading: isLoading9,
5458
- error: error9,
5459
- startDate: startDate9,
5460
- endDate: endDate9
5461
- },
5462
- {
5463
- data: data10,
5464
- isLoading: isLoading10,
5465
- error: error10,
5466
- startDate: startDate10,
5467
- endDate: endDate10
5468
- },
5469
- {
5470
- data: data11,
5471
- isLoading: isLoading11,
5472
- error: error11,
5473
- startDate: startDate11,
5474
- endDate: endDate11
5475
- }
5476
- ],
5477
- error: [
5478
- error0,
5479
- error1,
5480
- error2,
5481
- error3,
5482
- error4,
5483
- error5,
5484
- error6,
5485
- error7,
5486
- error8,
5487
- error9,
5488
- error10,
5489
- error11
5490
- ].find((x) => !!x),
5491
- isLoading: [
5492
- isLoading0,
5493
- isLoading1,
5494
- isLoading2,
5495
- isLoading3,
5496
- isLoading4,
5497
- isLoading5,
5498
- isLoading6,
5499
- isLoading7,
5500
- isLoading8,
5501
- isLoading9,
5502
- isLoading10,
5503
- isLoading11
5504
- ].find((x) => !!x)
5505
- };
5506
- }, [
5507
- data0,
5508
- data1,
5509
- data2,
5510
- data3,
5511
- data4,
5512
- data5,
5513
- data6,
5514
- data7,
5515
- data8,
5516
- data9,
5517
- data10,
5518
- data11,
5519
- isLoading0,
5520
- isLoading1,
5521
- isLoading2,
5522
- isLoading3,
5523
- isLoading4,
5524
- isLoading5,
5525
- isLoading6,
5526
- isLoading7,
5527
- isLoading8,
5528
- isLoading9,
5529
- isLoading10,
5530
- isLoading11,
5531
- error0,
5532
- error1,
5533
- error2,
5534
- error3,
5535
- error4,
5536
- error5,
5537
- error6,
5538
- error7,
5539
- error8,
5540
- error9,
5541
- error10,
5542
- error11
5543
- ]);
5544
- useEffect10(() => {
5545
- if (isLoading && loaded === "initial") {
5546
- setLoaded("loading");
5547
- return;
5548
- }
5549
- if (!isLoading && data && !data.find((x) => !x.data && !x.error)) {
5550
- setLoaded("complete");
5551
- }
5552
- }, [data, isLoading]);
5553
- return {
5554
- data,
5555
- isLoading,
5556
- loaded,
5557
- error
5558
- };
5559
- };
5188
+ import React66, { useContext as useContext2, useMemo as useMemo4, useState as useState14 } from "react";
5560
5189
 
5561
5190
  // src/utils/format.ts
5562
5191
  var capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
@@ -5597,69 +5226,46 @@ var humanizeEnum = (text) => {
5597
5226
  };
5598
5227
 
5599
5228
  // src/components/ProfitAndLossChart/Indicator.tsx
5600
- import React65, { useEffect as useEffect11, useState as useState15 } from "react";
5229
+ import React65, { useEffect as useEffect10 } from "react";
5601
5230
  var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
5602
5231
  var Indicator = ({
5232
+ viewBox = {},
5603
5233
  className,
5604
5234
  animateFrom,
5605
- setAnimateFrom,
5606
- customCursorSize,
5607
- setCustomCursorSize,
5608
- viewBox = {}
5235
+ setAnimateFrom
5609
5236
  }) => {
5610
5237
  if (!className?.match(/selected/)) {
5611
5238
  return null;
5612
5239
  }
5613
- const [opacityIndicator, setOpacityIndicator] = useState15(0);
5614
5240
  const { x: animateTo = 0, width = 0 } = "x" in viewBox ? viewBox : emptyViewBox;
5615
5241
  const margin = width > 12 ? 4 : 1;
5616
5242
  const boxWidth = width * 2 + margin;
5617
5243
  const multiplier = width > 12 ? 1.2 : 1;
5618
5244
  const xOffset = (boxWidth * multiplier - boxWidth) / 2;
5619
- const borderRadius = 6;
5620
- const rectWidth = `${boxWidth * multiplier}px`;
5621
- const rectHeight = "calc(100% - 38px)";
5622
- useEffect11(() => {
5623
- if (Math.abs(animateTo - animateFrom) < 30) {
5624
- setOpacityIndicator(0);
5625
- }
5245
+ const borderRadius = width > 16 ? 8 : width / 2;
5246
+ useEffect10(() => {
5626
5247
  setAnimateFrom(animateTo);
5627
- setTimeout(() => {
5628
- setOpacityIndicator(1);
5629
- }, 200);
5630
5248
  }, [animateTo]);
5631
- const rectRef = (ref) => {
5632
- if (ref) {
5633
- const refRectWidth = ref.getBoundingClientRect().width;
5634
- const refRectHeight = ref.getBoundingClientRect().height;
5635
- if (customCursorSize.width !== refRectWidth || customCursorSize.height !== refRectHeight) {
5636
- setCustomCursorSize(refRectWidth, refRectHeight, actualX - xOffset);
5637
- }
5638
- }
5639
- };
5640
5249
  const actualX = animateFrom === -1 ? animateTo : animateFrom;
5641
5250
  return /* @__PURE__ */ React65.createElement(
5642
5251
  "rect",
5643
5252
  {
5644
- ref: rectRef,
5645
5253
  className: "Layer__profit-and-loss-chart__selection-indicator",
5646
5254
  rx: borderRadius,
5647
5255
  ry: borderRadius,
5648
5256
  style: {
5649
- width: rectWidth,
5257
+ width: `${boxWidth * multiplier}px`,
5650
5258
  // @ts-expect-error -- y is fine but x apparently isn't!
5651
5259
  x: actualX - xOffset,
5652
- y: 1,
5653
- height: rectHeight,
5654
- opacity: opacityIndicator
5260
+ y: 22,
5261
+ height: "calc(100% - 38px)"
5655
5262
  }
5656
5263
  }
5657
5264
  );
5658
5265
  };
5659
5266
 
5660
5267
  // src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
5661
- import classNames26 from "classnames";
5662
- import { format as format4, parseISO as parseISO8, startOfMonth as startOfMonth4 } from "date-fns";
5268
+ import { endOfMonth as endOfMonth2, format as format4, parseISO as parseISO8, startOfMonth as startOfMonth2, sub } from "date-fns";
5663
5269
  import {
5664
5270
  BarChart,
5665
5271
  XAxis,
@@ -5677,24 +5283,82 @@ var barSize = 20;
5677
5283
  var ProfitAndLossChart = () => {
5678
5284
  const { getColor } = useLayerContext();
5679
5285
  const { changeDateRange, dateRange } = useContext2(ProfitAndLoss.Context);
5680
- const [customCursorSize, setCustomCursorSize] = useState16({
5681
- width: 0,
5682
- height: 0,
5683
- x: 0
5684
- });
5685
- const [barAnimActive, setBarAnimActive] = useState16(true);
5286
+ const thisMonth = startOfMonth2(Date.now());
5686
5287
  const startSelectionMonth = dateRange.startDate.getMonth();
5687
5288
  const endSelectionMonth = dateRange.endDate.getMonth();
5688
- const { data, loaded } = useProfitAndLossLTM({
5689
- currentDate: startOfMonth4(Date.now())
5690
- });
5691
- useEffect12(() => {
5692
- if (loaded === "complete") {
5693
- setTimeout(() => {
5694
- setBarAnimActive(false);
5695
- }, 1e3);
5696
- }
5697
- }, [loaded]);
5289
+ const monthData = [];
5290
+ monthData.push(
5291
+ useProfitAndLoss({
5292
+ startDate: startOfMonth2(sub(thisMonth, { months: 11 })),
5293
+ endDate: endOfMonth2(sub(thisMonth, { months: 11 }))
5294
+ })?.data
5295
+ );
5296
+ monthData.push(
5297
+ useProfitAndLoss({
5298
+ startDate: startOfMonth2(sub(thisMonth, { months: 10 })),
5299
+ endDate: endOfMonth2(sub(thisMonth, { months: 10 }))
5300
+ })?.data
5301
+ );
5302
+ monthData.push(
5303
+ useProfitAndLoss({
5304
+ startDate: startOfMonth2(sub(thisMonth, { months: 9 })),
5305
+ endDate: endOfMonth2(sub(thisMonth, { months: 9 }))
5306
+ })?.data
5307
+ );
5308
+ monthData.push(
5309
+ useProfitAndLoss({
5310
+ startDate: startOfMonth2(sub(thisMonth, { months: 8 })),
5311
+ endDate: endOfMonth2(sub(thisMonth, { months: 8 }))
5312
+ })?.data
5313
+ );
5314
+ monthData.push(
5315
+ useProfitAndLoss({
5316
+ startDate: startOfMonth2(sub(thisMonth, { months: 7 })),
5317
+ endDate: endOfMonth2(sub(thisMonth, { months: 7 }))
5318
+ })?.data
5319
+ );
5320
+ monthData.push(
5321
+ useProfitAndLoss({
5322
+ startDate: startOfMonth2(sub(thisMonth, { months: 6 })),
5323
+ endDate: endOfMonth2(sub(thisMonth, { months: 6 }))
5324
+ })?.data
5325
+ );
5326
+ monthData.push(
5327
+ useProfitAndLoss({
5328
+ startDate: startOfMonth2(sub(thisMonth, { months: 5 })),
5329
+ endDate: endOfMonth2(sub(thisMonth, { months: 5 }))
5330
+ })?.data
5331
+ );
5332
+ monthData.push(
5333
+ useProfitAndLoss({
5334
+ startDate: startOfMonth2(sub(thisMonth, { months: 4 })),
5335
+ endDate: endOfMonth2(sub(thisMonth, { months: 4 }))
5336
+ })?.data
5337
+ );
5338
+ monthData.push(
5339
+ useProfitAndLoss({
5340
+ startDate: startOfMonth2(sub(thisMonth, { months: 3 })),
5341
+ endDate: endOfMonth2(sub(thisMonth, { months: 3 }))
5342
+ })?.data
5343
+ );
5344
+ monthData.push(
5345
+ useProfitAndLoss({
5346
+ startDate: startOfMonth2(sub(thisMonth, { months: 2 })),
5347
+ endDate: endOfMonth2(sub(thisMonth, { months: 2 }))
5348
+ })?.data
5349
+ );
5350
+ monthData.push(
5351
+ useProfitAndLoss({
5352
+ startDate: startOfMonth2(sub(thisMonth, { months: 1 })),
5353
+ endDate: endOfMonth2(sub(thisMonth, { months: 1 }))
5354
+ })?.data
5355
+ );
5356
+ monthData.push(
5357
+ useProfitAndLoss({
5358
+ startDate: thisMonth,
5359
+ endDate: endOfMonth2(thisMonth)
5360
+ })?.data
5361
+ );
5698
5362
  const getMonthName = (pnl) => pnl ? format4(parseISO8(pnl.start_date), "LLL") : "";
5699
5363
  const summarizePnL = (pnl) => ({
5700
5364
  name: getMonthName(pnl),
@@ -5704,68 +5368,56 @@ var ProfitAndLossChart = () => {
5704
5368
  selected: !!pnl && parseISO8(pnl.start_date).getMonth() >= startSelectionMonth && parseISO8(pnl.end_date).getMonth() <= endSelectionMonth
5705
5369
  });
5706
5370
  const onClick = ({ activeTooltipIndex }) => {
5707
- const selection = data[activeTooltipIndex || -1];
5708
- if (selection && selection.data) {
5709
- const { start_date, end_date } = selection.data;
5371
+ const selection = monthData[activeTooltipIndex || -1];
5372
+ if (selection) {
5373
+ const { start_date: startDate, end_date: endDate } = selection;
5710
5374
  changeDateRange({
5711
- startDate: parseISO8(start_date),
5712
- endDate: parseISO8(end_date)
5375
+ startDate: parseISO8(startDate),
5376
+ endDate: parseISO8(endDate)
5713
5377
  });
5714
5378
  }
5715
5379
  };
5716
- const CustomTooltip = ({ active, payload }) => {
5380
+ const CustomTooltip = ({
5381
+ active,
5382
+ payload,
5383
+ label
5384
+ }) => {
5717
5385
  if (active && payload && payload.length) {
5718
5386
  const netProfit = payload[0].payload.netProfit ?? 0;
5719
5387
  const netProfitClass = netProfit > 0 ? "positive" : netProfit < 0 ? "negative" : "";
5720
- return /* @__PURE__ */ React66.createElement("div", { className: "Layer__chart__tooltip" }, loaded !== "complete" ? /* @__PURE__ */ React66.createElement(Text, null, "Loading...") : /* @__PURE__ */ React66.createElement("ul", { className: "Layer__chart__tooltip-list" }, /* @__PURE__ */ React66.createElement("li", null, /* @__PURE__ */ React66.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[0].name ?? "")), /* @__PURE__ */ React66.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[0].value ?? 0)))), /* @__PURE__ */ React66.createElement("li", null, /* @__PURE__ */ React66.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[1].name ?? "")), /* @__PURE__ */ React66.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[1].value ?? 0)))), /* @__PURE__ */ React66.createElement("li", null, /* @__PURE__ */ React66.createElement("label", { className: "Layer__chart__tooltip-label" }, "Net Profit"), /* @__PURE__ */ React66.createElement(
5721
- "span",
5722
- {
5723
- className: `Layer__chart__tooltip-value ${netProfitClass}`
5724
- },
5725
- "$",
5726
- centsToDollars(netProfit)
5727
- ))));
5388
+ return /* @__PURE__ */ React66.createElement("div", { className: "Layer__chart__tooltip" }, /* @__PURE__ */ React66.createElement("ul", { className: "Layer__chart__tooltip-list" }, /* @__PURE__ */ React66.createElement("li", null, /* @__PURE__ */ React66.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[0].name ?? "")), /* @__PURE__ */ React66.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[0].value ?? 0)))), /* @__PURE__ */ React66.createElement("li", null, /* @__PURE__ */ React66.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[1].name ?? "")), /* @__PURE__ */ React66.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[1].value ?? 0)))), /* @__PURE__ */ React66.createElement("li", null, /* @__PURE__ */ React66.createElement("label", { className: "Layer__chart__tooltip-label" }, "Net Profit"), /* @__PURE__ */ React66.createElement("span", { className: `Layer__chart__tooltip-value ${netProfitClass}` }, "$", centsToDollars(netProfit)))));
5728
5389
  }
5729
5390
  return null;
5730
5391
  };
5731
5392
  const CustomizedCursor = (props) => {
5732
- const { x, y } = props;
5733
- const { width, height } = customCursorSize;
5734
- const offsetX = width * 0.1;
5393
+ const { x, width, height } = props;
5735
5394
  return /* @__PURE__ */ React66.createElement(
5736
5395
  Rectangle,
5737
5396
  {
5738
- fill: "#F7F8FA",
5397
+ fill: getColor(900)?.hex ?? "#333",
5739
5398
  stroke: "none",
5740
- x: x + offsetX,
5741
- y,
5742
- width,
5743
- height,
5744
- radius: 6,
5399
+ x: x + width / 2 - 11,
5400
+ y: height + 44,
5401
+ radius: 2,
5402
+ width: 22,
5403
+ height: 2,
5745
5404
  className: "Layer__chart__tooltip-cursor"
5746
5405
  }
5747
5406
  );
5748
5407
  };
5749
- const theData = useMemo5(() => {
5750
- if (loaded !== "complete") {
5751
- return data?.map((x) => ({
5752
- name: format4(x.startDate, "LLL"),
5753
- revenue: 1,
5754
- expenses: 1,
5755
- netProfit: 0,
5756
- selected: false
5757
- }));
5758
- }
5759
- return data?.map((x) => summarizePnL(x.data));
5760
- }, [startSelectionMonth, endSelectionMonth, loaded]);
5761
- const [animateFrom, setAnimateFrom] = useState16(-1);
5408
+ const data = useMemo4(
5409
+ () => monthData.map(summarizePnL),
5410
+ [
5411
+ startSelectionMonth,
5412
+ endSelectionMonth,
5413
+ ...monthData.map((m) => m?.net_profit)
5414
+ ]
5415
+ );
5416
+ const [animateFrom, setAnimateFrom] = useState14(-1);
5762
5417
  return /* @__PURE__ */ React66.createElement(
5763
5418
  ResponsiveContainer,
5764
5419
  {
5765
- className: classNames26(
5766
- "Layer__chart-container",
5767
- loaded !== "complete" && "Layer__chart-container--loading"
5768
- ),
5420
+ className: "Layer__chart-container",
5769
5421
  width: "100%",
5770
5422
  height: "100%",
5771
5423
  minHeight: 200
@@ -5774,7 +5426,7 @@ var ProfitAndLossChart = () => {
5774
5426
  BarChart,
5775
5427
  {
5776
5428
  margin: { left: 12, right: 12, bottom: 12 },
5777
- data: theData,
5429
+ data,
5778
5430
  onClick,
5779
5431
  barGap,
5780
5432
  className: "Layer__profit-and-loss-chart"
@@ -5800,9 +5452,9 @@ var ProfitAndLossChart = () => {
5800
5452
  /* @__PURE__ */ React66.createElement(
5801
5453
  Legend,
5802
5454
  {
5803
- verticalAlign: "bottom",
5455
+ verticalAlign: "top",
5804
5456
  align: "left",
5805
- wrapperStyle: { bottom: 0 },
5457
+ wrapperStyle: { top: -24 },
5806
5458
  payload: [
5807
5459
  {
5808
5460
  value: "Revenue",
@@ -5823,7 +5475,7 @@ var ProfitAndLossChart = () => {
5823
5475
  {
5824
5476
  dataKey: "revenue",
5825
5477
  barSize,
5826
- isAnimationActive: barAnimActive,
5478
+ isAnimationActive: false,
5827
5479
  radius: [2, 2, 0, 0],
5828
5480
  className: "Layer__profit-and-loss-chart__bar--income"
5829
5481
  },
@@ -5833,34 +5485,30 @@ var ProfitAndLossChart = () => {
5833
5485
  content: /* @__PURE__ */ React66.createElement(
5834
5486
  Indicator,
5835
5487
  {
5836
- setCustomCursorSize: (width, height, x) => setCustomCursorSize({ width, height, x }),
5837
- customCursorSize,
5838
5488
  animateFrom,
5839
5489
  setAnimateFrom
5840
5490
  }
5841
5491
  )
5842
5492
  }
5843
5493
  ),
5844
- theData?.map((entry) => {
5845
- return /* @__PURE__ */ React66.createElement(
5846
- Cell,
5847
- {
5848
- key: entry.name,
5849
- className: entry.selected ? "Layer__profit-and-loss-chart__cell--selected" : ""
5850
- }
5851
- );
5852
- })
5494
+ data.map((entry) => /* @__PURE__ */ React66.createElement(
5495
+ Cell,
5496
+ {
5497
+ key: entry.name,
5498
+ className: entry.selected ? "Layer__profit-and-loss-chart__cell--selected" : ""
5499
+ }
5500
+ ))
5853
5501
  ),
5854
5502
  /* @__PURE__ */ React66.createElement(
5855
5503
  Bar,
5856
5504
  {
5857
5505
  dataKey: "expenses",
5858
5506
  barSize,
5859
- isAnimationActive: barAnimActive,
5507
+ isAnimationActive: false,
5860
5508
  radius: [2, 2, 0, 0],
5861
5509
  className: "Layer__profit-and-loss-chart__bar--expenses"
5862
5510
  },
5863
- theData.map((entry) => /* @__PURE__ */ React66.createElement(
5511
+ data.map((entry) => /* @__PURE__ */ React66.createElement(
5864
5512
  Cell,
5865
5513
  {
5866
5514
  key: entry.name,
@@ -5873,19 +5521,19 @@ var ProfitAndLossChart = () => {
5873
5521
  };
5874
5522
 
5875
5523
  // src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
5876
- import React67, { useContext as useContext3, useState as useState17, useEffect as useEffect13 } from "react";
5877
- import { add, endOfMonth as endOfMonth4, format as format5, startOfMonth as startOfMonth5 } from "date-fns";
5524
+ import React67, { useContext as useContext3, useState as useState15, useEffect as useEffect11 } from "react";
5525
+ import { add, endOfMonth as endOfMonth3, format as format5, startOfMonth as startOfMonth3 } from "date-fns";
5878
5526
  var ProfitAndLossDatePicker = () => {
5879
5527
  const { changeDateRange, dateRange } = useContext3(ProfitAndLoss.Context);
5880
- const [isAnimating, setIsAnimating] = useState17(false);
5881
- const [localDate, setLocalDate] = useState17(dateRange.startDate);
5882
- const [nextOpacity, setNextOpacity] = useState17(0);
5883
- const [currentOpacity, setCurrentOpacity] = useState17(1);
5884
- const [transformStyle, setTransformStyle] = useState17({
5528
+ const [isAnimating, setIsAnimating] = useState15(false);
5529
+ const [localDate, setLocalDate] = useState15(dateRange.startDate);
5530
+ const [nextOpacity, setNextOpacity] = useState15(0);
5531
+ const [currentOpacity, setCurrentOpacity] = useState15(1);
5532
+ const [transformStyle, setTransformStyle] = useState15({
5885
5533
  transform: "translateX(33%)",
5886
5534
  transition: "ease"
5887
5535
  });
5888
- useEffect13(() => {
5536
+ useEffect11(() => {
5889
5537
  if (dateRange.startDate !== localDate && !isAnimating) {
5890
5538
  setLocalDate(dateRange.startDate);
5891
5539
  setTransformStyle({ transform: "translateX(33%)", transition: "none" });
@@ -5901,8 +5549,8 @@ var ProfitAndLossDatePicker = () => {
5901
5549
  setCurrentOpacity(0);
5902
5550
  }
5903
5551
  changeDateRange({
5904
- startDate: startOfMonth5(newDate),
5905
- endDate: endOfMonth4(newDate)
5552
+ startDate: startOfMonth3(newDate),
5553
+ endDate: endOfMonth3(newDate)
5906
5554
  });
5907
5555
  const translateXValue = monthsToAdd > 0 ? "0%" : "66%";
5908
5556
  setTransformStyle({
@@ -5923,64 +5571,64 @@ var ProfitAndLossDatePicker = () => {
5923
5571
  const currentLabel = format5(localDate, "LLLL, y");
5924
5572
  const prevLabel = format5(add(localDate, { months: -1 }), "LLLL, y");
5925
5573
  const nextLabel = format5(add(localDate, { months: 1 }), "LLLL, y");
5926
- return /* @__PURE__ */ React67.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ React67.createElement(
5574
+ return /* @__PURE__ */ React67.createElement(
5927
5575
  "div",
5928
5576
  {
5929
- className: "Layer__profit-and-loss-date-picker__labels-container",
5930
- style: transformStyle
5577
+ className: "Layer__profit-and-loss-date-picker"
5931
5578
  },
5932
- /* @__PURE__ */ React67.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, prevLabel),
5933
- /* @__PURE__ */ React67.createElement(
5579
+ /* @__PURE__ */ React67.createElement("div", { className: "Layer__profit-and-loss-date-picker__labels-container", style: transformStyle }, /* @__PURE__ */ React67.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, prevLabel), /* @__PURE__ */ React67.createElement(
5934
5580
  "span",
5935
5581
  {
5936
5582
  className: "Layer__profit-and-loss-date-picker__label",
5937
5583
  style: { opacity: currentOpacity }
5938
5584
  },
5939
5585
  currentLabel
5940
- ),
5941
- /* @__PURE__ */ React67.createElement(
5586
+ ), /* @__PURE__ */ React67.createElement(
5942
5587
  "span",
5943
5588
  {
5944
5589
  className: "Layer__profit-and-loss-date-picker__label",
5945
5590
  style: { opacity: nextOpacity }
5946
5591
  },
5947
5592
  nextLabel
5948
- )
5949
- ), /* @__PURE__ */ React67.createElement(
5950
- "button",
5951
- {
5952
- "aria-label": "View Previous Month",
5953
- className: "Layer__profit-and-loss-date-picker__button",
5954
- onClick: () => change(-1),
5955
- disabled: isAnimating
5956
- },
5593
+ )),
5957
5594
  /* @__PURE__ */ React67.createElement(
5958
- ChevronLeft_default,
5595
+ "button",
5959
5596
  {
5960
- className: "Layer__profit-and-loss-date-picker__button-icon",
5961
- size: 16
5962
- }
5963
- )
5964
- ), /* @__PURE__ */ React67.createElement(
5965
- "button",
5966
- {
5967
- "aria-label": "View Next Month",
5968
- className: "Layer__profit-and-loss-date-picker__button",
5969
- onClick: () => change(1),
5970
- disabled: isAnimating
5971
- },
5597
+ "aria-label": "View Previous Month",
5598
+ className: "Layer__profit-and-loss-date-picker__button",
5599
+ onClick: () => change(-1),
5600
+ disabled: isAnimating
5601
+ },
5602
+ /* @__PURE__ */ React67.createElement(
5603
+ ChevronLeft_default,
5604
+ {
5605
+ className: "Layer__profit-and-loss-date-picker__button-icon",
5606
+ size: 16
5607
+ }
5608
+ )
5609
+ ),
5972
5610
  /* @__PURE__ */ React67.createElement(
5973
- ChevronRight_default,
5611
+ "button",
5974
5612
  {
5975
- className: "Layer__profit-and-loss-date-picker__button-icon",
5976
- size: 16
5977
- }
5978
- )
5979
- ), /* @__PURE__ */ React67.createElement("div", { className: "Layer__profit-and-loss-date-picker__effect-blur" }));
5613
+ "aria-label": "View Next Month",
5614
+ className: "Layer__profit-and-loss-date-picker__button",
5615
+ onClick: () => change(1),
5616
+ disabled: isAnimating
5617
+ },
5618
+ /* @__PURE__ */ React67.createElement(
5619
+ ChevronRight_default,
5620
+ {
5621
+ className: "Layer__profit-and-loss-date-picker__button-icon",
5622
+ size: 16
5623
+ }
5624
+ )
5625
+ ),
5626
+ /* @__PURE__ */ React67.createElement("div", { className: "Layer__profit-and-loss-date-picker__effect-blur" })
5627
+ );
5980
5628
  };
5981
5629
 
5982
5630
  // src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
5983
- import React73, { useContext as useContext4, useState as useState18 } from "react";
5631
+ import React73, { useContext as useContext4, useState as useState16 } from "react";
5984
5632
 
5985
5633
  // src/icons/X.tsx
5986
5634
  import * as React68 from "react";
@@ -6016,7 +5664,7 @@ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React68.createElement(
6016
5664
  var X_default = X;
6017
5665
 
6018
5666
  // src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
6019
- import React69, { useMemo as useMemo6 } from "react";
5667
+ import React69, { useMemo as useMemo5 } from "react";
6020
5668
 
6021
5669
  // src/config/charts.ts
6022
5670
  var INACTIVE_OPACITY_LEVELS = [
@@ -6122,7 +5770,7 @@ var DetailedChart = ({
6122
5770
  date,
6123
5771
  isLoading
6124
5772
  }) => {
6125
- const chartData = useMemo6(() => {
5773
+ const chartData = useMemo5(() => {
6126
5774
  if (!filteredData) {
6127
5775
  return [];
6128
5776
  }
@@ -6393,7 +6041,7 @@ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React70.createElem
6393
6041
  width: size,
6394
6042
  height: size
6395
6043
  },
6396
- /* @__PURE__ */ React70.createElement("g", { clipPath: "url(#clip0_1758_75388)" }, /* @__PURE__ */ React70.createElement(
6044
+ /* @__PURE__ */ React70.createElement("g", { "clip-path": "url(#clip0_1758_75388)" }, /* @__PURE__ */ React70.createElement(
6397
6045
  "path",
6398
6046
  {
6399
6047
  d: "M1.33325 8.5L3.99992 11.1667L6.66659 8.5",
@@ -6443,7 +6091,7 @@ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React70.createElem
6443
6091
  var SortArrows_default = SortArrows;
6444
6092
 
6445
6093
  // src/components/ProfitAndLossDetailedCharts/DetailedTable.tsx
6446
- import classNames27 from "classnames";
6094
+ import classNames26 from "classnames";
6447
6095
  var DetailedTable = ({
6448
6096
  filteredData,
6449
6097
  sidebarScope,
@@ -6453,7 +6101,7 @@ var DetailedTable = ({
6453
6101
  setHoveredItem
6454
6102
  }) => {
6455
6103
  const buildColClass = (column) => {
6456
- return classNames27(
6104
+ return classNames26(
6457
6105
  "Layer__sortable-col",
6458
6106
  sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
6459
6107
  );
@@ -6488,7 +6136,7 @@ var DetailedTable = ({
6488
6136
  "tr",
6489
6137
  {
6490
6138
  key: `pl-side-table-item-${idx}`,
6491
- className: classNames27(
6139
+ className: classNames26(
6492
6140
  "Layer__profit-and-loss-detailed-table__row",
6493
6141
  hoveredItem && hoveredItem === item.display_name ? "active" : ""
6494
6142
  ),
@@ -6573,7 +6221,7 @@ var ProfitAndLossDetailedCharts = ({
6573
6221
  const theScope = scope ? scope : sidebarScope;
6574
6222
  const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
6575
6223
  const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
6576
- const [hoveredItem, setHoveredItem] = useState18();
6224
+ const [hoveredItem, setHoveredItem] = useState16();
6577
6225
  return /* @__PURE__ */ React73.createElement("div", { className: "Layer__profit-and-loss-detailed-charts" }, /* @__PURE__ */ React73.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header" }, /* @__PURE__ */ React73.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ React73.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(theScope)), /* @__PURE__ */ React73.createElement(Text, { size: "sm" /* sm */, className: "date" }, format6(dateRange.startDate, "LLLL, y")), showDatePicker && /* @__PURE__ */ React73.createElement(ProfitAndLossDatePicker, null)), !hideClose && /* @__PURE__ */ React73.createElement(
6578
6226
  Button,
6579
6227
  {
@@ -6615,17 +6263,17 @@ var ProfitAndLossDetailedCharts = ({
6615
6263
  };
6616
6264
 
6617
6265
  // src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
6618
- import React76, { useContext as useContext5, useMemo as useMemo7 } from "react";
6266
+ import React76, { useContext as useContext5, useMemo as useMemo6 } from "react";
6619
6267
 
6620
6268
  // src/components/SkeletonLoader/SkeletonLoader.tsx
6621
6269
  import React74 from "react";
6622
- import classNames28 from "classnames";
6270
+ import classNames27 from "classnames";
6623
6271
  var SkeletonLoader = ({
6624
6272
  height,
6625
6273
  width,
6626
6274
  className
6627
6275
  }) => {
6628
- const baseClassName = classNames28(
6276
+ const baseClassName = classNames27(
6629
6277
  "Layer__skeleton-loader Layer__anim--skeleton-loading",
6630
6278
  className
6631
6279
  );
@@ -6669,7 +6317,7 @@ var MiniChart = ({ data }) => {
6669
6317
  };
6670
6318
 
6671
6319
  // src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
6672
- import classNames29 from "classnames";
6320
+ import classNames28 from "classnames";
6673
6321
  var CHART_PLACEHOLDER = [
6674
6322
  {
6675
6323
  name: "placeholder",
@@ -6707,14 +6355,13 @@ var ProfitAndLossSummaries = ({
6707
6355
  setSidebarScope,
6708
6356
  sidebarScope
6709
6357
  } = useContext5(ProfitAndLoss.Context);
6710
- const dataItem = Array.isArray(storedData) ? storedData[storedData.length - 1] : storedData;
6711
- const expensesChartData = useMemo7(() => {
6712
- return buildMiniChartData("expenses", dataItem);
6358
+ const expensesChartData = useMemo6(() => {
6359
+ return buildMiniChartData("expenses", storedData);
6713
6360
  }, [storedData]);
6714
- const revenueChartData = useMemo7(() => {
6715
- return buildMiniChartData("revenue", dataItem);
6361
+ const revenueChartData = useMemo6(() => {
6362
+ return buildMiniChartData("revenue", storedData);
6716
6363
  }, [storedData]);
6717
- const data = dataItem ? dataItem : { income: { value: NaN }, net_profit: NaN };
6364
+ const data = storedData ? storedData : { income: { value: NaN }, net_profit: NaN };
6718
6365
  const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
6719
6366
  const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
6720
6367
  const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
@@ -6726,7 +6373,7 @@ var ProfitAndLossSummaries = ({
6726
6373
  /* @__PURE__ */ React76.createElement(
6727
6374
  "div",
6728
6375
  {
6729
- className: classNames29(
6376
+ className: classNames28(
6730
6377
  "Layer__profit-and-loss-summaries__summary",
6731
6378
  actionable && "Layer__actionable",
6732
6379
  "Layer__profit-and-loss-summaries__summary--income",
@@ -6748,7 +6395,7 @@ var ProfitAndLossSummaries = ({
6748
6395
  /* @__PURE__ */ React76.createElement(
6749
6396
  "div",
6750
6397
  {
6751
- className: classNames29(
6398
+ className: classNames28(
6752
6399
  "Layer__profit-and-loss-summaries__summary",
6753
6400
  actionable && "Layer__actionable",
6754
6401
  "Layer__profit-and-loss-summaries__summary--expenses",
@@ -6772,7 +6419,7 @@ var ProfitAndLossSummaries = ({
6772
6419
  /* @__PURE__ */ React76.createElement(
6773
6420
  "div",
6774
6421
  {
6775
- className: classNames29(
6422
+ className: classNames28(
6776
6423
  "Layer__profit-and-loss-summaries__summary net-profit Layer__profit-and-loss-summaries__summary--net-profit",
6777
6424
  actionable && "Layer__actionable"
6778
6425
  )
@@ -6792,7 +6439,7 @@ var ProfitAndLossSummaries = ({
6792
6439
  import React79, { useContext as useContext6 } from "react";
6793
6440
 
6794
6441
  // src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
6795
- import React78, { useState as useState19 } from "react";
6442
+ import React78, { useState as useState17 } from "react";
6796
6443
 
6797
6444
  // src/icons/PieChart.tsx
6798
6445
  import * as React77 from "react";
@@ -6841,7 +6488,7 @@ var ProfitAndLossRow = ({
6841
6488
  return null;
6842
6489
  }
6843
6490
  const { value, display_name, line_items } = lineItem;
6844
- const [expanded, setExpanded] = useState19(true);
6491
+ const [expanded, setExpanded] = useState17(true);
6845
6492
  const amount = value ?? 0;
6846
6493
  const amountString = centsToDollars(Math.abs(amount));
6847
6494
  const labelClasses = [
@@ -6963,20 +6610,19 @@ var empty_profit_and_loss_report_default = {
6963
6610
  };
6964
6611
 
6965
6612
  // src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
6966
- import classNames30 from "classnames";
6613
+ import classNames29 from "classnames";
6967
6614
  var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
6968
6615
  const {
6969
6616
  data: actualData,
6970
6617
  isLoading,
6971
6618
  setSidebarScope
6972
6619
  } = useContext6(ProfitAndLoss.Context);
6973
- const currentData = Array.isArray(actualData) ? actualData[actualData.length - 1] : actualData;
6974
- const data = !currentData || isLoading ? empty_profit_and_loss_report_default : currentData;
6620
+ const data = !actualData || isLoading ? empty_profit_and_loss_report_default : actualData;
6975
6621
  if (isLoading || actualData === void 0) {
6976
6622
  return /* @__PURE__ */ React79.createElement(
6977
6623
  "div",
6978
6624
  {
6979
- className: classNames30(
6625
+ className: classNames29(
6980
6626
  "Layer__profit-and-loss-table__loader-container",
6981
6627
  asContainer && "Layer__component-container"
6982
6628
  )
@@ -6987,7 +6633,7 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
6987
6633
  return /* @__PURE__ */ React79.createElement(React79.Fragment, null, /* @__PURE__ */ React79.createElement(
6988
6634
  "div",
6989
6635
  {
6990
- className: classNames30(
6636
+ className: classNames29(
6991
6637
  "Layer__profit-and-loss-table Layer__profit-and-loss-table--main",
6992
6638
  asContainer && "Layer__component-container"
6993
6639
  )
@@ -7090,7 +6736,7 @@ var ProfitAndLossTable = ({ lockExpanded, asContainer }) => {
7090
6736
  };
7091
6737
 
7092
6738
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
7093
- import { endOfMonth as endOfMonth5, startOfMonth as startOfMonth6 } from "date-fns";
6739
+ import { endOfMonth as endOfMonth4, startOfMonth as startOfMonth4 } from "date-fns";
7094
6740
  var PNLContext = createContext2({
7095
6741
  data: void 0,
7096
6742
  filteredDataRevenue: [],
@@ -7101,8 +6747,8 @@ var PNLContext = createContext2({
7101
6747
  isValidating: false,
7102
6748
  error: void 0,
7103
6749
  dateRange: {
7104
- startDate: startOfMonth6(/* @__PURE__ */ new Date()),
7105
- endDate: endOfMonth5(/* @__PURE__ */ new Date())
6750
+ startDate: startOfMonth4(/* @__PURE__ */ new Date()),
6751
+ endDate: endOfMonth4(/* @__PURE__ */ new Date())
7106
6752
  },
7107
6753
  changeDateRange: () => {
7108
6754
  },
@@ -7140,8 +6786,8 @@ ProfitAndLoss.DetailedCharts = ProfitAndLossDetailedCharts;
7140
6786
  import React82, { useContext as useContext7, useRef as useRef14 } from "react";
7141
6787
 
7142
6788
  // src/components/Panel/Panel.tsx
7143
- import React81, { useEffect as useEffect14, useState as useState20 } from "react";
7144
- import classNames31 from "classnames";
6789
+ import React81, { useEffect as useEffect12, useState as useState18 } from "react";
6790
+ import classNames30 from "classnames";
7145
6791
  var Panel = ({
7146
6792
  children,
7147
6793
  className,
@@ -7150,8 +6796,8 @@ var Panel = ({
7150
6796
  sidebarIsOpen,
7151
6797
  parentRef
7152
6798
  }) => {
7153
- const [sidebarHeight, setSidebarHeight] = useState20(0);
7154
- useEffect14(() => {
6799
+ const [sidebarHeight, setSidebarHeight] = useState18(0);
6800
+ useEffect12(() => {
7155
6801
  if (parentRef?.current?.offsetHeight) {
7156
6802
  setSidebarHeight(parentRef?.current?.offsetHeight - 1);
7157
6803
  }
@@ -7159,7 +6805,7 @@ var Panel = ({
7159
6805
  return /* @__PURE__ */ React81.createElement(
7160
6806
  "div",
7161
6807
  {
7162
- className: classNames31(
6808
+ className: classNames30(
7163
6809
  "Layer__panel",
7164
6810
  className,
7165
6811
  sidebarIsOpen && "Layer__panel--open"
@@ -7237,10 +6883,10 @@ var Components = ({
7237
6883
  };
7238
6884
 
7239
6885
  // src/components/ChartOfAccounts/ChartOfAccounts.tsx
7240
- import React96, { createContext as createContext3, useContext as useContext14, useState as useState26 } from "react";
6886
+ import React96, { createContext as createContext3, useContext as useContext14, useState as useState24 } from "react";
7241
6887
 
7242
6888
  // src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
7243
- import { useState as useState21 } from "react";
6889
+ import { useState as useState19 } from "react";
7244
6890
 
7245
6891
  // src/components/ChartOfAccountsForm/constants.ts
7246
6892
  var LEDGER_ACCOUNT_TYPES = [
@@ -7524,9 +7170,9 @@ var validateName = (formData) => {
7524
7170
  var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.sub_accounts || [])]).flat().filter((id) => id);
7525
7171
  var useChartOfAccounts = () => {
7526
7172
  const { auth, businessId, apiUrl } = useLayerContext();
7527
- const [form, setForm] = useState21();
7528
- const [sendingForm, setSendingForm] = useState21(false);
7529
- const [apiError, setApiError] = useState21(void 0);
7173
+ const [form, setForm] = useState19();
7174
+ const [sendingForm, setSendingForm] = useState19(false);
7175
+ const [apiError, setApiError] = useState19(void 0);
7530
7176
  const { data, isLoading, isValidating, error, mutate } = useSWR6(
7531
7177
  businessId && auth?.access_token && `chart-of-accounts-${businessId}`,
7532
7178
  Layer.getLedgerAccountBalances(apiUrl, auth?.access_token, {
@@ -7710,12 +7356,12 @@ var useChartOfAccounts = () => {
7710
7356
  };
7711
7357
 
7712
7358
  // src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
7713
- import { useState as useState22 } from "react";
7359
+ import { useState as useState20 } from "react";
7714
7360
  import useSWR7 from "swr";
7715
7361
  var useLedgerAccounts = () => {
7716
7362
  const { auth, businessId, apiUrl } = useLayerContext();
7717
- const [accountId, setAccountId] = useState22();
7718
- const [selectedEntryId, setSelectedEntryId] = useState22();
7363
+ const [accountId, setAccountId] = useState20();
7364
+ const [selectedEntryId, setSelectedEntryId] = useState20();
7719
7365
  const { data, isLoading, isValidating, error, mutate } = useSWR7(
7720
7366
  businessId && accountId && auth?.access_token && `ledger-accounts-lines-${businessId}-${accountId}`,
7721
7367
  Layer.getLedgerAccountsLines(apiUrl, auth?.access_token, {
@@ -7761,7 +7407,7 @@ var useLedgerAccounts = () => {
7761
7407
  import React88, { useContext as useContext10 } from "react";
7762
7408
 
7763
7409
  // src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
7764
- import React84, { useContext as useContext8, useEffect as useEffect15, useState as useState23 } from "react";
7410
+ import React84, { useContext as useContext8, useEffect as useEffect13, useState as useState21 } from "react";
7765
7411
 
7766
7412
  // src/icons/Edit2.tsx
7767
7413
  import * as React83 from "react";
@@ -7788,7 +7434,7 @@ var Edit2 = ({ size = 18, ...props }) => /* @__PURE__ */ React83.createElement(
7788
7434
  var Edit2_default = Edit2;
7789
7435
 
7790
7436
  // src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
7791
- import classNames32 from "classnames";
7437
+ import classNames31 from "classnames";
7792
7438
  var INDENTATION = 24;
7793
7439
  var MOBILE_INDENTATION = 12;
7794
7440
  var EXPANDED_STYLE = {
@@ -7822,7 +7468,7 @@ var ChartOfAccountsRow = ({
7822
7468
  const { form, editAccount } = useContext8(ChartOfAccountsContext);
7823
7469
  const { setAccountId } = useContext8(LedgerAccountsContext);
7824
7470
  const baseStyle = view === "desktop" ? EXPANDED_STYLE : EXPANDED_MOBILE_STYLE;
7825
- const [isOpen, setIsOpen] = useState23(defaultOpen);
7471
+ const [isOpen, setIsOpen] = useState21(defaultOpen);
7826
7472
  const style = expanded ? {
7827
7473
  ...baseStyle,
7828
7474
  transitionDelay: `${15 * index}ms`
@@ -7830,14 +7476,14 @@ var ChartOfAccountsRow = ({
7830
7476
  ...COLLAPSED_STYLE,
7831
7477
  transitionDelay: `${acountsLength - 15 * index}ms`
7832
7478
  };
7833
- const [showComponent, setShowComponent] = useState23(false);
7834
- useEffect15(() => {
7479
+ const [showComponent, setShowComponent] = useState21(false);
7480
+ useEffect13(() => {
7835
7481
  const timeoutId = setTimeout(() => {
7836
7482
  setShowComponent(true);
7837
7483
  }, cumulativeIndex * 50);
7838
7484
  return () => clearTimeout(timeoutId);
7839
7485
  }, []);
7840
- const baseClass = classNames32(
7486
+ const baseClass = classNames31(
7841
7487
  "Layer__table-row",
7842
7488
  isOpen ? "Layer__table-row--expanded" : "Layer__table-row--collapsed",
7843
7489
  !expanded && "Layer__table-row--hidden",
@@ -7845,11 +7491,11 @@ var ChartOfAccountsRow = ({
7845
7491
  form?.accountId === account.id && "Layer__table-row--active",
7846
7492
  !showComponent && "Layer__table-row--anim-starting-state"
7847
7493
  );
7848
- const desktopRowClass = classNames32(
7494
+ const desktopRowClass = classNames31(
7849
7495
  baseClass,
7850
7496
  "Layer__chart-of-accounts__row---desktop"
7851
7497
  );
7852
- const mobileRowClass = classNames32(
7498
+ const mobileRowClass = classNames31(
7853
7499
  baseClass,
7854
7500
  "Layer__chart-of-accounts__row---mobile"
7855
7501
  );
@@ -8007,11 +7653,11 @@ var ChartOfAccountsRow = ({
8007
7653
  import React87 from "react";
8008
7654
 
8009
7655
  // src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
8010
- import React86, { useContext as useContext9, useMemo as useMemo9 } from "react";
7656
+ import React86, { useContext as useContext9, useMemo as useMemo8 } from "react";
8011
7657
 
8012
7658
  // src/components/ChartOfAccountsForm/useParentOptions.ts
8013
- import { useMemo as useMemo8 } from "react";
8014
- var useParentOptions = (data) => useMemo8(
7659
+ import { useMemo as useMemo7 } from "react";
7660
+ var useParentOptions = (data) => useMemo7(
8015
7661
  () => flattenAccounts(data?.accounts || []).sort((a, b) => a?.name && b?.name ? a.name.localeCompare(b.name) : 0).map((x) => {
8016
7662
  return {
8017
7663
  label: x.name,
@@ -8033,7 +7679,7 @@ var ChartOfAccountsForm = () => {
8033
7679
  apiError
8034
7680
  } = useContext9(ChartOfAccountsContext);
8035
7681
  const parentOptions = useParentOptions(data);
8036
- const entry = useMemo9(() => {
7682
+ const entry = useMemo8(() => {
8037
7683
  if (form?.action === "edit" && form.accountId) {
8038
7684
  return flattenAccounts(data?.accounts || []).find(
8039
7685
  (x) => x.id === form.accountId
@@ -8220,19 +7866,19 @@ var ChartOfAccountsTable = ({
8220
7866
  // src/components/LedgerAccount/LedgerAccountIndex.tsx
8221
7867
  import React95, {
8222
7868
  useContext as useContext13,
8223
- useEffect as useEffect17,
8224
- useMemo as useMemo11,
8225
- useState as useState25
7869
+ useEffect as useEffect15,
7870
+ useMemo as useMemo10,
7871
+ useState as useState23
8226
7872
  } from "react";
8227
7873
 
8228
7874
  // src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
8229
- import React93, { useContext as useContext11, useMemo as useMemo10 } from "react";
7875
+ import React93, { useContext as useContext11, useMemo as useMemo9 } from "react";
8230
7876
 
8231
7877
  // src/components/Card/Card.tsx
8232
7878
  import React89 from "react";
8233
- import classNames33 from "classnames";
7879
+ import classNames32 from "classnames";
8234
7880
  var Card = ({ children, className }) => {
8235
- return /* @__PURE__ */ React89.createElement("div", { className: classNames33("Layer__card", className) }, children);
7881
+ return /* @__PURE__ */ React89.createElement("div", { className: classNames32("Layer__card", className) }, children);
8236
7882
  };
8237
7883
 
8238
7884
  // src/components/DateTime/DateTime.tsx
@@ -8274,14 +7920,14 @@ var DateTime = ({
8274
7920
 
8275
7921
  // src/components/DetailsList/DetailsList.tsx
8276
7922
  import React91 from "react";
8277
- import classNames34 from "classnames";
7923
+ import classNames33 from "classnames";
8278
7924
  var DetailsList = ({
8279
7925
  title,
8280
7926
  children,
8281
7927
  className,
8282
7928
  actions
8283
7929
  }) => {
8284
- return /* @__PURE__ */ React91.createElement("div", { className: classNames34("Layer__details-list", className) }, title && /* @__PURE__ */ React91.createElement(Header, null, /* @__PURE__ */ React91.createElement(Heading, { size: "secondary" /* secondary */ }, title), actions && /* @__PURE__ */ React91.createElement("div", { className: "Layer__details-list__actions" }, actions)), /* @__PURE__ */ React91.createElement("ul", { className: "Layer__details-list__list" }, children));
7930
+ return /* @__PURE__ */ React91.createElement("div", { className: classNames33("Layer__details-list", className) }, title && /* @__PURE__ */ React91.createElement(Header, null, /* @__PURE__ */ React91.createElement(Heading, { size: "secondary" /* secondary */ }, title), actions && /* @__PURE__ */ React91.createElement("div", { className: "Layer__details-list__actions" }, actions)), /* @__PURE__ */ React91.createElement("ul", { className: "Layer__details-list__list" }, children));
8285
7931
  };
8286
7932
 
8287
7933
  // src/components/DetailsList/DetailsListItem.tsx
@@ -8337,7 +7983,7 @@ var SourceDetailView = ({ source }) => {
8337
7983
  };
8338
7984
  var LedgerAccountEntryDetails = () => {
8339
7985
  const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = useContext11(LedgerAccountsContext);
8340
- const { totalDebit, totalCredit } = useMemo10(() => {
7986
+ const { totalDebit, totalCredit } = useMemo9(() => {
8341
7987
  let totalDebit2 = 0;
8342
7988
  let totalCredit2 = 0;
8343
7989
  entryData?.line_items?.forEach((item) => {
@@ -8378,8 +8024,8 @@ var LedgerAccountEntryDetails = () => {
8378
8024
  };
8379
8025
 
8380
8026
  // src/components/LedgerAccount/LedgerAccountRow.tsx
8381
- import React94, { useContext as useContext12, useEffect as useEffect16, useState as useState24 } from "react";
8382
- import classNames35 from "classnames";
8027
+ import React94, { useContext as useContext12, useEffect as useEffect14, useState as useState22 } from "react";
8028
+ import classNames34 from "classnames";
8383
8029
  import { parseISO as parseISO10, format as formatTime8 } from "date-fns";
8384
8030
  var LedgerAccountRow = ({
8385
8031
  row,
@@ -8388,8 +8034,8 @@ var LedgerAccountRow = ({
8388
8034
  view
8389
8035
  }) => {
8390
8036
  const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext12(LedgerAccountsContext);
8391
- const [showComponent, setShowComponent] = useState24(false);
8392
- useEffect16(() => {
8037
+ const [showComponent, setShowComponent] = useState22(false);
8038
+ useEffect14(() => {
8393
8039
  if (initialLoad) {
8394
8040
  const timeoutId = setTimeout(() => {
8395
8041
  setShowComponent(true);
@@ -8403,7 +8049,7 @@ var LedgerAccountRow = ({
8403
8049
  return /* @__PURE__ */ React94.createElement(
8404
8050
  "tr",
8405
8051
  {
8406
- className: classNames35(
8052
+ className: classNames34(
8407
8053
  "Layer__table-row",
8408
8054
  row.entry_id === selectedEntryId && "Layer__table-row--active",
8409
8055
  initialLoad && "initial-load",
@@ -8436,7 +8082,7 @@ var LedgerAccountRow = ({
8436
8082
  return /* @__PURE__ */ React94.createElement(
8437
8083
  "tr",
8438
8084
  {
8439
- className: classNames35(
8085
+ className: classNames34(
8440
8086
  "Layer__table-row",
8441
8087
  row.entry_id === selectedEntryId && "Layer__table-row--active",
8442
8088
  initialLoad && "initial-load",
@@ -8465,7 +8111,7 @@ var LedgerAccountRow = ({
8465
8111
  return /* @__PURE__ */ React94.createElement(
8466
8112
  "tr",
8467
8113
  {
8468
- className: classNames35(
8114
+ className: classNames34(
8469
8115
  "Layer__table-row",
8470
8116
  row.entry_id === selectedEntryId && "Layer__table-row--active",
8471
8117
  initialLoad && "initial-load",
@@ -8491,14 +8137,14 @@ var LedgerAccountRow = ({
8491
8137
  };
8492
8138
 
8493
8139
  // src/components/LedgerAccount/LedgerAccountIndex.tsx
8494
- import classNames36 from "classnames";
8140
+ import classNames35 from "classnames";
8495
8141
  var LedgerAccount = ({
8496
8142
  containerRef,
8497
8143
  pageSize = 15,
8498
8144
  view
8499
8145
  }) => {
8500
- const [currentPage, setCurrentPage] = useState25(1);
8501
- const [initialLoad, setInitialLoad] = useState25(true);
8146
+ const [currentPage, setCurrentPage] = useState23(1);
8147
+ const [initialLoad, setInitialLoad] = useState23(true);
8502
8148
  const { data: accountData } = useContext13(ChartOfAccountsContext);
8503
8149
  const {
8504
8150
  data: rawData,
@@ -8511,7 +8157,7 @@ var LedgerAccount = ({
8511
8157
  closeSelectedEntry,
8512
8158
  refetch
8513
8159
  } = useContext13(LedgerAccountsContext);
8514
- useEffect17(() => {
8160
+ useEffect15(() => {
8515
8161
  if (!isLoading) {
8516
8162
  const timeoutLoad = setTimeout(() => {
8517
8163
  setInitialLoad(false);
@@ -8519,16 +8165,16 @@ var LedgerAccount = ({
8519
8165
  return () => clearTimeout(timeoutLoad);
8520
8166
  }
8521
8167
  }, [isLoading]);
8522
- const baseClassName = classNames36(
8168
+ const baseClassName = classNames35(
8523
8169
  "Layer__ledger-account__index",
8524
8170
  accountId && "open"
8525
8171
  );
8526
- const entry = useMemo11(() => {
8172
+ const entry = useMemo10(() => {
8527
8173
  return flattenAccounts(accountData?.accounts || []).find(
8528
8174
  (x) => x.id === accountId
8529
8175
  );
8530
8176
  }, [accountId]);
8531
- const data = useMemo11(() => {
8177
+ const data = useMemo10(() => {
8532
8178
  const firstPageIndex = (currentPage - 1) * pageSize;
8533
8179
  const lastPageIndex = firstPageIndex + pageSize;
8534
8180
  return rawData?.sort((a, b) => Date.parse(b.date) - Date.parse(a.date))?.slice(firstPageIndex, lastPageIndex);
@@ -8665,7 +8311,7 @@ var ChartOfAccounts = (props) => {
8665
8311
  };
8666
8312
  var ChartOfAccountsContent = ({ asWidget }) => {
8667
8313
  const { accountId } = useContext14(LedgerAccountsContext);
8668
- const [view, setView] = useState26("desktop");
8314
+ const [view, setView] = useState24("desktop");
8669
8315
  const containerRef = useElementSize((_a, _b, { width }) => {
8670
8316
  if (width) {
8671
8317
  if (width >= BREAKPOINTS.TABLET && view !== "desktop") {
@@ -8681,7 +8327,7 @@ var ChartOfAccountsContent = ({ asWidget }) => {
8681
8327
  };
8682
8328
 
8683
8329
  // src/providers/LayerProvider/LayerProvider.tsx
8684
- import React97, { useReducer, useEffect as useEffect18 } from "react";
8330
+ import React97, { useReducer, useEffect as useEffect16 } from "react";
8685
8331
  import { add as add2, isBefore } from "date-fns";
8686
8332
  import useSWR8, { SWRConfig } from "swr";
8687
8333
  var reducer = (state, action) => {
@@ -8746,7 +8392,7 @@ var LayerProvider = ({
8746
8392
  }),
8747
8393
  defaultSWRConfig
8748
8394
  ) : { data: void 0 };
8749
- useEffect18(() => {
8395
+ useEffect16(() => {
8750
8396
  if (businessAccessToken) {
8751
8397
  dispatch({
8752
8398
  type: "LayerContext.setAuth" /* setAuth */,