@layerfi/components 0.1.87 → 0.1.88-alpha.1
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/cjs/index.cjs +213 -81
- package/dist/esm/index.mjs +445 -312
- package/dist/index.d.ts +119 -105
- package/package.json +1 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -61,7 +61,7 @@ import { useState as useState8 } from "react";
|
|
|
61
61
|
import { useReducer, useEffect as useEffect4 } from "react";
|
|
62
62
|
|
|
63
63
|
// package.json
|
|
64
|
-
var version = "0.1.
|
|
64
|
+
var version = "0.1.88-alpha.1";
|
|
65
65
|
|
|
66
66
|
// src/models/APIError.ts
|
|
67
67
|
var APIError = class _APIError extends Error {
|
|
@@ -283,7 +283,10 @@ var uploadBankTransactionDocument = (baseUrl, accessToken) => ({
|
|
|
283
283
|
var getBusiness = get(({ businessId }) => `/v1/businesses/${businessId}`);
|
|
284
284
|
|
|
285
285
|
// src/api/layer/categories.ts
|
|
286
|
-
var getCategories = get(({ businessId }) =>
|
|
286
|
+
var getCategories = get(({ businessId, mode }) => {
|
|
287
|
+
const parameters = toDefinedSearchParameters({ mode });
|
|
288
|
+
return `/v1/businesses/${businessId}/categories?${parameters}`;
|
|
289
|
+
});
|
|
287
290
|
|
|
288
291
|
// src/api/layer/chart_of_accounts.ts
|
|
289
292
|
var getChartOfAccounts = get(
|
|
@@ -2389,6 +2392,7 @@ import {
|
|
|
2389
2392
|
endOfDay,
|
|
2390
2393
|
endOfMonth as endOfMonth2,
|
|
2391
2394
|
endOfYear,
|
|
2395
|
+
min,
|
|
2392
2396
|
startOfDay,
|
|
2393
2397
|
startOfMonth as startOfMonth2,
|
|
2394
2398
|
startOfYear,
|
|
@@ -2419,10 +2423,13 @@ import { jsx as jsx9 } from "react/jsx-runtime";
|
|
|
2419
2423
|
function startOfNextDay(date) {
|
|
2420
2424
|
return startOfDay(addDays(date, 1));
|
|
2421
2425
|
}
|
|
2426
|
+
function clampToPresentOrPast(date, cutoff = endOfDay(/* @__PURE__ */ new Date())) {
|
|
2427
|
+
return min([date, cutoff]);
|
|
2428
|
+
}
|
|
2422
2429
|
function withShiftedEnd(fn) {
|
|
2423
2430
|
return ({ currentStart, currentEnd, newEnd }) => {
|
|
2424
2431
|
const shiftedCurrentEnd = startOfNextDay(currentEnd);
|
|
2425
|
-
const shiftedNewEnd = startOfNextDay(newEnd);
|
|
2432
|
+
const shiftedNewEnd = clampToPresentOrPast(startOfNextDay(newEnd), startOfNextDay(/* @__PURE__ */ new Date()));
|
|
2426
2433
|
return fn({ currentStart, shiftedCurrentEnd, shiftedNewEnd });
|
|
2427
2434
|
};
|
|
2428
2435
|
}
|
|
@@ -2433,14 +2440,14 @@ var RANGE_MODE_LOOKUP = {
|
|
|
2433
2440
|
const fullDayCount = differenceInDays(shiftedCurrentEnd, currentStart);
|
|
2434
2441
|
return subDays(shiftedNewEnd, fullDayCount);
|
|
2435
2442
|
}),
|
|
2436
|
-
getEnd: ({ end }) => end
|
|
2443
|
+
getEnd: ({ end }) => clampToPresentOrPast(endOfDay(end))
|
|
2437
2444
|
},
|
|
2438
2445
|
monthPicker: {
|
|
2439
2446
|
getStart: ({ start }) => startOfMonth2(start),
|
|
2440
2447
|
getShiftedStart: withShiftedEnd(({ shiftedNewEnd }) => {
|
|
2441
2448
|
return subMonths(shiftedNewEnd, 1);
|
|
2442
2449
|
}),
|
|
2443
|
-
getEnd: ({ end }) => endOfMonth2(end)
|
|
2450
|
+
getEnd: ({ end }) => clampToPresentOrPast(endOfMonth2(end))
|
|
2444
2451
|
},
|
|
2445
2452
|
monthRangePicker: {
|
|
2446
2453
|
getStart: ({ start }) => startOfMonth2(start),
|
|
@@ -2448,14 +2455,14 @@ var RANGE_MODE_LOOKUP = {
|
|
|
2448
2455
|
const fullMonthCount = differenceInMonths(shiftedCurrentEnd, currentStart);
|
|
2449
2456
|
return subMonths(shiftedNewEnd, fullMonthCount);
|
|
2450
2457
|
}),
|
|
2451
|
-
getEnd: ({ end }) => endOfMonth2(end)
|
|
2458
|
+
getEnd: ({ end }) => clampToPresentOrPast(endOfMonth2(end))
|
|
2452
2459
|
},
|
|
2453
2460
|
yearPicker: {
|
|
2454
2461
|
getStart: ({ start }) => startOfYear(start),
|
|
2455
2462
|
getShiftedStart: withShiftedEnd(({ shiftedNewEnd }) => {
|
|
2456
2463
|
return subYears(shiftedNewEnd, 1);
|
|
2457
2464
|
}),
|
|
2458
|
-
getEnd: ({ end }) => endOfYear(end)
|
|
2465
|
+
getEnd: ({ end }) => clampToPresentOrPast(endOfYear(end))
|
|
2459
2466
|
}
|
|
2460
2467
|
};
|
|
2461
2468
|
function withCorrectedRange(fn) {
|
|
@@ -2472,29 +2479,29 @@ function buildStore() {
|
|
|
2472
2479
|
return createStore2((set2, get2) => {
|
|
2473
2480
|
const setRange = withCorrectedRange(({ start, end }) => {
|
|
2474
2481
|
set2({
|
|
2475
|
-
start:
|
|
2476
|
-
end:
|
|
2482
|
+
start: RANGE_MODE_LOOKUP.dayRangePicker.getStart({ start }),
|
|
2483
|
+
end: RANGE_MODE_LOOKUP.dayRangePicker.getEnd({ end }),
|
|
2477
2484
|
rangeDisplayMode: "dayRangePicker"
|
|
2478
2485
|
});
|
|
2479
2486
|
});
|
|
2480
2487
|
const setMonth = ({ start }) => {
|
|
2481
2488
|
set2({
|
|
2482
|
-
start:
|
|
2483
|
-
end:
|
|
2489
|
+
start: RANGE_MODE_LOOKUP.monthPicker.getStart({ start }),
|
|
2490
|
+
end: RANGE_MODE_LOOKUP.monthPicker.getEnd({ end: start }),
|
|
2484
2491
|
rangeDisplayMode: "monthPicker"
|
|
2485
2492
|
});
|
|
2486
2493
|
};
|
|
2487
2494
|
const setMonthRange = withCorrectedRange(({ start, end }) => {
|
|
2488
2495
|
set2({
|
|
2489
|
-
start:
|
|
2490
|
-
end:
|
|
2496
|
+
start: RANGE_MODE_LOOKUP.monthRangePicker.getStart({ start }),
|
|
2497
|
+
end: RANGE_MODE_LOOKUP.monthRangePicker.getEnd({ end }),
|
|
2491
2498
|
rangeDisplayMode: "monthRangePicker"
|
|
2492
2499
|
});
|
|
2493
2500
|
});
|
|
2494
2501
|
const setYear = ({ start }) => {
|
|
2495
2502
|
set2({
|
|
2496
|
-
start:
|
|
2497
|
-
end:
|
|
2503
|
+
start: RANGE_MODE_LOOKUP.yearPicker.getStart({ start }),
|
|
2504
|
+
end: RANGE_MODE_LOOKUP.yearPicker.getEnd({ end: start }),
|
|
2498
2505
|
rangeDisplayMode: "yearPicker"
|
|
2499
2506
|
});
|
|
2500
2507
|
};
|
|
@@ -2522,7 +2529,7 @@ function buildStore() {
|
|
|
2522
2529
|
};
|
|
2523
2530
|
return {
|
|
2524
2531
|
start: startOfMonth2(now),
|
|
2525
|
-
end: endOfMonth2(now),
|
|
2532
|
+
end: clampToPresentOrPast(endOfMonth2(now)),
|
|
2526
2533
|
displayMode: "dayPicker",
|
|
2527
2534
|
rangeDisplayMode: "monthPicker",
|
|
2528
2535
|
actions: {
|
|
@@ -2532,7 +2539,7 @@ function buildStore() {
|
|
|
2532
2539
|
end: currentEnd,
|
|
2533
2540
|
rangeDisplayMode: currentRangeDisplayMode
|
|
2534
2541
|
}) => {
|
|
2535
|
-
const newEnd =
|
|
2542
|
+
const newEnd = RANGE_MODE_LOOKUP.dayRangePicker.getEnd({ end: date });
|
|
2536
2543
|
return {
|
|
2537
2544
|
start: RANGE_MODE_LOOKUP[currentRangeDisplayMode].getShiftedStart({
|
|
2538
2545
|
currentStart,
|
|
@@ -2639,7 +2646,7 @@ var LayerProvider = (_a) => {
|
|
|
2639
2646
|
};
|
|
2640
2647
|
|
|
2641
2648
|
// src/components/Onboarding/Onboarding.tsx
|
|
2642
|
-
import { useContext as
|
|
2649
|
+
import { useContext as useContext11, useEffect as useEffect7, useState as useState12 } from "react";
|
|
2643
2650
|
|
|
2644
2651
|
// src/contexts/LinkedAccountsContext/LinkedAccountsContext.ts
|
|
2645
2652
|
import { createContext as createContext8 } from "react";
|
|
@@ -2740,7 +2747,7 @@ var Header = forwardRef2(
|
|
|
2740
2747
|
Header.displayName = "Header";
|
|
2741
2748
|
|
|
2742
2749
|
// src/components/Onboarding/ConnectAccount.tsx
|
|
2743
|
-
import { useContext as
|
|
2750
|
+
import { useContext as useContext10, useMemo as useMemo6 } from "react";
|
|
2744
2751
|
|
|
2745
2752
|
// src/icons/Bell.tsx
|
|
2746
2753
|
import { jsx as jsx14, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
@@ -3173,7 +3180,7 @@ import {
|
|
|
3173
3180
|
} from "react";
|
|
3174
3181
|
|
|
3175
3182
|
// src/components/Tooltip/useTooltip.ts
|
|
3176
|
-
import
|
|
3183
|
+
import { useMemo as useMemo5, useState as useState9, createContext as createContext9, useContext as useContext9 } from "react";
|
|
3177
3184
|
import {
|
|
3178
3185
|
useFloating,
|
|
3179
3186
|
autoUpdate,
|
|
@@ -3187,9 +3194,9 @@ import {
|
|
|
3187
3194
|
useInteractions,
|
|
3188
3195
|
useTransitionStyles
|
|
3189
3196
|
} from "@floating-ui/react";
|
|
3190
|
-
var TooltipContext =
|
|
3197
|
+
var TooltipContext = createContext9(null);
|
|
3191
3198
|
var useTooltipContext = () => {
|
|
3192
|
-
const context =
|
|
3199
|
+
const context = useContext9(TooltipContext);
|
|
3193
3200
|
if (context == null) {
|
|
3194
3201
|
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
3195
3202
|
}
|
|
@@ -3242,7 +3249,7 @@ var useTooltip = ({
|
|
|
3242
3249
|
},
|
|
3243
3250
|
duration: 300
|
|
3244
3251
|
});
|
|
3245
|
-
return
|
|
3252
|
+
return useMemo5(
|
|
3246
3253
|
() => __spreadValues(__spreadValues({
|
|
3247
3254
|
open,
|
|
3248
3255
|
setOpen,
|
|
@@ -4462,11 +4469,11 @@ var ConnectAccount = ({
|
|
|
4462
4469
|
onboardingStep,
|
|
4463
4470
|
onTransactionsToReviewClick
|
|
4464
4471
|
}) => {
|
|
4465
|
-
const { addConnection } =
|
|
4472
|
+
const { addConnection } = useContext10(LinkedAccountsContext);
|
|
4466
4473
|
const { data, isLoading } = useBankTransactions({
|
|
4467
4474
|
scope: "review" /* review */
|
|
4468
4475
|
});
|
|
4469
|
-
const transactionsToReview =
|
|
4476
|
+
const transactionsToReview = useMemo6(
|
|
4470
4477
|
() => countTransactionsToReview({ transactions: data }),
|
|
4471
4478
|
[data, isLoading]
|
|
4472
4479
|
);
|
|
@@ -4562,7 +4569,7 @@ var OnboardingContent = ({
|
|
|
4562
4569
|
const [style, setStyle] = useState12(
|
|
4563
4570
|
onboardingStep ? EXPANDED_STYLE : COLLAPSED_STYLE
|
|
4564
4571
|
);
|
|
4565
|
-
const { data, loadingStatus } =
|
|
4572
|
+
const { data, loadingStatus } = useContext11(LinkedAccountsContext);
|
|
4566
4573
|
useEffect7(() => {
|
|
4567
4574
|
if (data && (data == null ? void 0 : data.length) === 0 && loadingStatus === "complete" && !onboardingStep) {
|
|
4568
4575
|
setOnboardingStep("connectAccount");
|
|
@@ -4592,7 +4599,7 @@ var OnboardingContent = ({
|
|
|
4592
4599
|
};
|
|
4593
4600
|
|
|
4594
4601
|
// src/components/LinkedAccounts/LinkedAccounts.tsx
|
|
4595
|
-
import { useContext as
|
|
4602
|
+
import { useContext as useContext15 } from "react";
|
|
4596
4603
|
|
|
4597
4604
|
// src/components/Loader/Loader.tsx
|
|
4598
4605
|
import { jsx as jsx53, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
@@ -4617,7 +4624,7 @@ var SmallLoader = ({ size = 28 }) => {
|
|
|
4617
4624
|
};
|
|
4618
4625
|
|
|
4619
4626
|
// src/components/LinkedAccounts/LinkedAccountsContent.tsx
|
|
4620
|
-
import { useContext as
|
|
4627
|
+
import { useContext as useContext13 } from "react";
|
|
4621
4628
|
|
|
4622
4629
|
// src/icons/PlusIcon.tsx
|
|
4623
4630
|
import { jsx as jsx55, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
@@ -4667,7 +4674,7 @@ var PlusIcon = (_a) => {
|
|
|
4667
4674
|
var PlusIcon_default = PlusIcon;
|
|
4668
4675
|
|
|
4669
4676
|
// src/components/LinkedAccounts/LinkedAccountItemThumb.tsx
|
|
4670
|
-
import { useContext as
|
|
4677
|
+
import { useContext as useContext12 } from "react";
|
|
4671
4678
|
|
|
4672
4679
|
// src/icons/MoreVertical.tsx
|
|
4673
4680
|
import { jsx as jsx56, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
@@ -5264,7 +5271,7 @@ var LinkedAccountItemThumb = ({
|
|
|
5264
5271
|
excludeAccount: excludeAccount2,
|
|
5265
5272
|
breakConnection,
|
|
5266
5273
|
setAccountsToAddOpeningBalanceInModal
|
|
5267
|
-
} =
|
|
5274
|
+
} = useContext12(LinkedAccountsContext);
|
|
5268
5275
|
const { environment } = useEnvironment();
|
|
5269
5276
|
let pillConfig;
|
|
5270
5277
|
if (accountNeedsUniquenessConfirmation(account)) {
|
|
@@ -5377,7 +5384,7 @@ import classNames23 from "classnames";
|
|
|
5377
5384
|
import { useState as useState14 } from "react";
|
|
5378
5385
|
|
|
5379
5386
|
// src/components/ui/Modal/Modal.tsx
|
|
5380
|
-
import { forwardRef as forwardRef4, useMemo as
|
|
5387
|
+
import { forwardRef as forwardRef4, useMemo as useMemo7 } from "react";
|
|
5381
5388
|
import {
|
|
5382
5389
|
Dialog as ReactAriaDialog,
|
|
5383
5390
|
Modal as ReactAriaModal,
|
|
@@ -5413,7 +5420,7 @@ var ModalOverlay = forwardRef4(
|
|
|
5413
5420
|
ModalOverlay.displayName = "ModalOverlay";
|
|
5414
5421
|
var MODAL_CLASS_NAME = "Layer__Modal";
|
|
5415
5422
|
var InternalModal = forwardRef4(({ children, size }, ref) => {
|
|
5416
|
-
const dataProperties =
|
|
5423
|
+
const dataProperties = useMemo7(() => toDataProperties({ size }), [size]);
|
|
5417
5424
|
return /* @__PURE__ */ jsx64(
|
|
5418
5425
|
ReactAriaModal,
|
|
5419
5426
|
__spreadProps(__spreadValues({}, dataProperties), {
|
|
@@ -5452,7 +5459,7 @@ import { forwardRef as forwardRef8 } from "react";
|
|
|
5452
5459
|
import { X } from "lucide-react";
|
|
5453
5460
|
|
|
5454
5461
|
// src/components/ui/Button/Button.tsx
|
|
5455
|
-
import { forwardRef as forwardRef5, useMemo as
|
|
5462
|
+
import { forwardRef as forwardRef5, useMemo as useMemo8 } from "react";
|
|
5456
5463
|
import { Button as ReactAriaButton } from "react-aria-components";
|
|
5457
5464
|
import { jsx as jsx65 } from "react/jsx-runtime";
|
|
5458
5465
|
var BUTTON_CLASS_NAME = "Layer__UI__Button";
|
|
@@ -5468,7 +5475,7 @@ var Button2 = forwardRef5((_a, ref) => {
|
|
|
5468
5475
|
"variant",
|
|
5469
5476
|
"children"
|
|
5470
5477
|
]);
|
|
5471
|
-
const dataProperties =
|
|
5478
|
+
const dataProperties = useMemo8(() => toDataProperties({
|
|
5472
5479
|
icon,
|
|
5473
5480
|
size,
|
|
5474
5481
|
variant
|
|
@@ -5485,14 +5492,14 @@ var Button2 = forwardRef5((_a, ref) => {
|
|
|
5485
5492
|
Button2.displayName = "IconButton";
|
|
5486
5493
|
|
|
5487
5494
|
// src/components/ui/Typography/Heading.tsx
|
|
5488
|
-
import { useMemo as
|
|
5495
|
+
import { useMemo as useMemo9 } from "react";
|
|
5489
5496
|
import { forwardRef as forwardRef6 } from "react";
|
|
5490
5497
|
import { Heading as ReactAriaHeading } from "react-aria-components";
|
|
5491
5498
|
import { jsx as jsx66 } from "react/jsx-runtime";
|
|
5492
5499
|
var HEADING_CLASS_NAME = "Layer__UI__Heading";
|
|
5493
5500
|
var Heading2 = forwardRef6((_a, ref) => {
|
|
5494
5501
|
var _b = _a, { size, pbe } = _b, restProps = __objRest(_b, ["size", "pbe"]);
|
|
5495
|
-
const dataProperties =
|
|
5502
|
+
const dataProperties = useMemo9(() => toDataProperties({ size, pbe }), [size, pbe]);
|
|
5496
5503
|
return /* @__PURE__ */ jsx66(
|
|
5497
5504
|
ReactAriaHeading,
|
|
5498
5505
|
__spreadProps(__spreadValues(__spreadValues({}, restProps), dataProperties), {
|
|
@@ -5504,13 +5511,13 @@ var Heading2 = forwardRef6((_a, ref) => {
|
|
|
5504
5511
|
Heading2.displayName = "Heading";
|
|
5505
5512
|
|
|
5506
5513
|
// src/components/ui/Typography/Text.tsx
|
|
5507
|
-
import { forwardRef as forwardRef7, useMemo as
|
|
5514
|
+
import { forwardRef as forwardRef7, useMemo as useMemo10 } from "react";
|
|
5508
5515
|
import { jsx as jsx67 } from "react/jsx-runtime";
|
|
5509
5516
|
var P_CLASS_NAME = "Layer__P";
|
|
5510
5517
|
var P = forwardRef7(
|
|
5511
5518
|
(_a, ref) => {
|
|
5512
5519
|
var _b = _a, { align, children, pbe, size } = _b, restProps = __objRest(_b, ["align", "children", "pbe", "size"]);
|
|
5513
|
-
const dataProperties =
|
|
5520
|
+
const dataProperties = useMemo10(() => toDataProperties({
|
|
5514
5521
|
align,
|
|
5515
5522
|
pbe,
|
|
5516
5523
|
size
|
|
@@ -5567,12 +5574,12 @@ function ModalActions({ children }) {
|
|
|
5567
5574
|
}
|
|
5568
5575
|
|
|
5569
5576
|
// src/components/ui/Stack/Stack.tsx
|
|
5570
|
-
import { useMemo as
|
|
5577
|
+
import { useMemo as useMemo11 } from "react";
|
|
5571
5578
|
import { jsx as jsx69 } from "react/jsx-runtime";
|
|
5572
5579
|
var CLASS_NAME = "Layer__Stack";
|
|
5573
5580
|
function Stack(_a) {
|
|
5574
5581
|
var _b = _a, { align, children, direction, gap, justify } = _b, restProps = __objRest(_b, ["align", "children", "direction", "gap", "justify"]);
|
|
5575
|
-
const dataProperties =
|
|
5582
|
+
const dataProperties = useMemo11(
|
|
5576
5583
|
() => toDataProperties({ align, gap, justify, direction }),
|
|
5577
5584
|
[align, direction, gap, justify]
|
|
5578
5585
|
);
|
|
@@ -5604,7 +5611,7 @@ function ConditionalList({
|
|
|
5604
5611
|
|
|
5605
5612
|
// src/components/ui/Checkbox/Checkbox.tsx
|
|
5606
5613
|
import { Check } from "lucide-react";
|
|
5607
|
-
import { useMemo as
|
|
5614
|
+
import { useMemo as useMemo12 } from "react";
|
|
5608
5615
|
import { Checkbox as ReactAriaCheckbox } from "react-aria-components";
|
|
5609
5616
|
|
|
5610
5617
|
// src/components/utility/withRenderProp.tsx
|
|
@@ -5620,7 +5627,7 @@ import { Fragment as Fragment8, jsx as jsx71, jsxs as jsxs35 } from "react/jsx-r
|
|
|
5620
5627
|
var CLASS_NAME2 = "Layer__Checkbox";
|
|
5621
5628
|
function Checkbox(_a) {
|
|
5622
5629
|
var _b = _a, { children } = _b, props = __objRest(_b, ["children"]);
|
|
5623
|
-
const dataProperties =
|
|
5630
|
+
const dataProperties = useMemo12(() => toDataProperties({
|
|
5624
5631
|
labeled: typeof children === "string" && children.length > 0
|
|
5625
5632
|
}), [children]);
|
|
5626
5633
|
return /* @__PURE__ */ jsx71(
|
|
@@ -5647,7 +5654,8 @@ function LinkedAccountToConfirm({
|
|
|
5647
5654
|
/* @__PURE__ */ jsxs36(VStack, { children: [
|
|
5648
5655
|
/* @__PURE__ */ jsx72(Heading2, { level: 3, size: "sm", children: account.external_account_name }),
|
|
5649
5656
|
/* @__PURE__ */ jsxs36(P, { slot: "mask", children: [
|
|
5650
|
-
"\u2022\u2022\u2022
|
|
5657
|
+
"\u2022\u2022\u2022",
|
|
5658
|
+
" ",
|
|
5651
5659
|
account.mask
|
|
5652
5660
|
] }),
|
|
5653
5661
|
/* @__PURE__ */ jsx72(P, { slot: "institution", children: account.institution.name })
|
|
@@ -5887,7 +5895,7 @@ var LinkedAccountsContent = ({
|
|
|
5887
5895
|
showUnlinkItem,
|
|
5888
5896
|
showBreakConnection
|
|
5889
5897
|
}) => {
|
|
5890
|
-
const { data, addConnection } =
|
|
5898
|
+
const { data, addConnection } = useContext13(LinkedAccountsContext);
|
|
5891
5899
|
const linkedAccountsNewAccountClassName = classNames23(
|
|
5892
5900
|
"Layer__linked-accounts__new-account",
|
|
5893
5901
|
asWidget && "--as-widget",
|
|
@@ -5928,7 +5936,7 @@ var LinkedAccountsContent = ({
|
|
|
5928
5936
|
};
|
|
5929
5937
|
|
|
5930
5938
|
// src/components/LinkedAccounts/OpeningBalanceModal/OpeningBalanceModal.tsx
|
|
5931
|
-
import { useContext as
|
|
5939
|
+
import { useContext as useContext14, useMemo as useMemo15, useState as useState16 } from "react";
|
|
5932
5940
|
|
|
5933
5941
|
// src/utils/business.ts
|
|
5934
5942
|
import { differenceInCalendarMonths, parseISO as parseISO2, startOfMonth as startOfMonth3 } from "date-fns";
|
|
@@ -5961,7 +5969,7 @@ var isDateAllowedToBrowse = (date, business) => {
|
|
|
5961
5969
|
};
|
|
5962
5970
|
|
|
5963
5971
|
// src/components/LinkedAccounts/AccountFormBox/AccountFormBox.tsx
|
|
5964
|
-
import { useMemo as
|
|
5972
|
+
import { useMemo as useMemo14 } from "react";
|
|
5965
5973
|
|
|
5966
5974
|
// src/components/Input/Input.tsx
|
|
5967
5975
|
import classNames24 from "classnames";
|
|
@@ -6361,7 +6369,7 @@ var AmountInput = (_a) => {
|
|
|
6361
6369
|
};
|
|
6362
6370
|
|
|
6363
6371
|
// src/components/DatePicker/DatePicker.tsx
|
|
6364
|
-
import { useMemo as
|
|
6372
|
+
import { useMemo as useMemo13, useRef as useRef7, useState as useState15 } from "react";
|
|
6365
6373
|
import * as RDP from "react-datepicker";
|
|
6366
6374
|
|
|
6367
6375
|
// src/icons/ChevronLeft.tsx
|
|
@@ -6512,7 +6520,7 @@ var DatePicker = (_a) => {
|
|
|
6512
6520
|
]);
|
|
6513
6521
|
const { ModeSelector } = slots != null ? slots : {};
|
|
6514
6522
|
const pickerRef = useRef7(null);
|
|
6515
|
-
const pickerMode =
|
|
6523
|
+
const pickerMode = useMemo13(() => {
|
|
6516
6524
|
var _a2;
|
|
6517
6525
|
if (!allowedModes) {
|
|
6518
6526
|
return displayMode;
|
|
@@ -6525,7 +6533,7 @@ var DatePicker = (_a) => {
|
|
|
6525
6533
|
}
|
|
6526
6534
|
return (_a2 = allowedModes[0]) != null ? _a2 : displayMode;
|
|
6527
6535
|
}, [displayMode, allowedModes]);
|
|
6528
|
-
const [firstDate, secondDate] =
|
|
6536
|
+
const [firstDate, secondDate] = useMemo13(() => {
|
|
6529
6537
|
if (selected instanceof Date) {
|
|
6530
6538
|
return [selected, null];
|
|
6531
6539
|
}
|
|
@@ -6610,7 +6618,7 @@ var DatePicker = (_a) => {
|
|
|
6610
6618
|
break;
|
|
6611
6619
|
}
|
|
6612
6620
|
};
|
|
6613
|
-
const isTodayOrAfter =
|
|
6621
|
+
const isTodayOrAfter = useMemo13(() => {
|
|
6614
6622
|
switch (displayMode) {
|
|
6615
6623
|
case "dayPicker":
|
|
6616
6624
|
return firstDate >= endOfDay2(/* @__PURE__ */ new Date()) || firstDate >= maxDate;
|
|
@@ -6778,7 +6786,7 @@ var AccountFormBox = ({
|
|
|
6778
6786
|
errors = []
|
|
6779
6787
|
}) => {
|
|
6780
6788
|
var _a, _b, _c, _d, _e;
|
|
6781
|
-
const dataProps =
|
|
6789
|
+
const dataProps = useMemo14(() => toDataProperties({
|
|
6782
6790
|
saved: isSaved,
|
|
6783
6791
|
confirmed: value.isConfirmed
|
|
6784
6792
|
}), [isSaved, value.isConfirmed]);
|
|
@@ -7044,7 +7052,7 @@ function LinkedAccountsOpeningBalanceModalContent({
|
|
|
7044
7052
|
openingDate: (_a2 = getActivationDate(business)) != null ? _a2 : startOfYear3(/* @__PURE__ */ new Date())
|
|
7045
7053
|
};
|
|
7046
7054
|
}));
|
|
7047
|
-
const formsDataToSave =
|
|
7055
|
+
const formsDataToSave = useMemo15(
|
|
7048
7056
|
() => ignoreAlreadySaved(formsData, results),
|
|
7049
7057
|
[formsData, results]
|
|
7050
7058
|
);
|
|
@@ -7111,7 +7119,7 @@ function OpeningBalanceModal({
|
|
|
7111
7119
|
const {
|
|
7112
7120
|
accountsToAddOpeningBalanceInModal,
|
|
7113
7121
|
setAccountsToAddOpeningBalanceInModal
|
|
7114
|
-
} =
|
|
7122
|
+
} = useContext14(LinkedAccountsContext);
|
|
7115
7123
|
const shouldShowModal = Boolean(accountsToAddOpeningBalanceInModal.length);
|
|
7116
7124
|
if (!shouldShowModal) {
|
|
7117
7125
|
return null;
|
|
@@ -7157,7 +7165,7 @@ var LinkedAccountsComponent = ({
|
|
|
7157
7165
|
error,
|
|
7158
7166
|
isValidating,
|
|
7159
7167
|
refetchAccounts
|
|
7160
|
-
} =
|
|
7168
|
+
} = useContext15(LinkedAccountsContext);
|
|
7161
7169
|
return /* @__PURE__ */ jsxs51(Container, { name: COMPONENT_NAME, elevated, children: [
|
|
7162
7170
|
/* @__PURE__ */ jsx90(Header, { className: "Layer__linked-accounts__header", children: /* @__PURE__ */ jsx90(
|
|
7163
7171
|
Heading,
|
|
@@ -7192,7 +7200,7 @@ var LinkedAccountsComponent = ({
|
|
|
7192
7200
|
};
|
|
7193
7201
|
|
|
7194
7202
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
7195
|
-
import { useEffect as useEffect22, useMemo as
|
|
7203
|
+
import { useEffect as useEffect22, useMemo as useMemo20, useRef as useRef17, useState as useState34 } from "react";
|
|
7196
7204
|
|
|
7197
7205
|
// src/hooks/useElementSize/useElementSize.ts
|
|
7198
7206
|
import { useLayoutEffect as useLayoutEffect2, useRef as useRef8 } from "react";
|
|
@@ -7332,7 +7340,7 @@ var File = (_a) => {
|
|
|
7332
7340
|
var File_default = File;
|
|
7333
7341
|
|
|
7334
7342
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
7335
|
-
import { useEffect as useEffect14, useMemo as
|
|
7343
|
+
import { useEffect as useEffect14, useMemo as useMemo16, useRef as useRef10, useState as useState23 } from "react";
|
|
7336
7344
|
|
|
7337
7345
|
// src/icons/Scissors.tsx
|
|
7338
7346
|
import { jsx as jsx92, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
@@ -7635,7 +7643,7 @@ var MinimizeTwo = (_a) => {
|
|
|
7635
7643
|
var MinimizeTwo_default = MinimizeTwo;
|
|
7636
7644
|
|
|
7637
7645
|
// src/components/CategorySelect/CategorySelectDrawer.tsx
|
|
7638
|
-
import { useContext as
|
|
7646
|
+
import { useContext as useContext16 } from "react";
|
|
7639
7647
|
|
|
7640
7648
|
// src/components/BankTransactionMobileList/BusinessCategories.tsx
|
|
7641
7649
|
import { useState as useState18 } from "react";
|
|
@@ -7662,7 +7670,7 @@ var ActionableList = ({
|
|
|
7662
7670
|
children: [
|
|
7663
7671
|
/* @__PURE__ */ jsxs56("div", { className: "Layer__actionable-list__content", children: [
|
|
7664
7672
|
/* @__PURE__ */ jsx97(Text, { size: "sm" /* sm */, children: x.label }),
|
|
7665
|
-
/*TODO: Replace 'See all categories' with something more generic*/
|
|
7673
|
+
/* TODO: Replace 'See all categories' with something more generic */
|
|
7666
7674
|
showDescriptions && x.description && x.label !== "See all categories" && /* @__PURE__ */ jsx97(
|
|
7667
7675
|
Text,
|
|
7668
7676
|
{
|
|
@@ -7695,20 +7703,20 @@ var ActionableList = ({
|
|
|
7695
7703
|
|
|
7696
7704
|
// src/components/BankTransactionMobileList/utils.ts
|
|
7697
7705
|
var mapCategoryToOption = (category) => {
|
|
7698
|
-
var _a, _b;
|
|
7706
|
+
var _a, _b, _c;
|
|
7699
7707
|
return {
|
|
7700
7708
|
label: category.display_name,
|
|
7701
|
-
id: category.id,
|
|
7709
|
+
id: "id" in category ? category.id : category.stable_name,
|
|
7702
7710
|
description: (_a = category.description) != null ? _a : void 0,
|
|
7703
7711
|
value: {
|
|
7704
7712
|
type: "CATEGORY",
|
|
7705
7713
|
payload: {
|
|
7706
|
-
id: category.id,
|
|
7714
|
+
id: "id" in category ? category.id : "",
|
|
7707
7715
|
option_type: "category" /* CATEGORY */,
|
|
7708
7716
|
display_name: category.display_name,
|
|
7709
7717
|
type: category.type,
|
|
7710
7718
|
description: (_b = category.description) != null ? _b : void 0,
|
|
7711
|
-
stable_name: category.stable_name,
|
|
7719
|
+
stable_name: "stable_name" in category ? (_c = category.stable_name) != null ? _c : "" : "",
|
|
7712
7720
|
entries: category.entries,
|
|
7713
7721
|
subCategories: category.subCategories
|
|
7714
7722
|
}
|
|
@@ -7723,7 +7731,7 @@ var flattenCategories = (categories) => {
|
|
|
7723
7731
|
return [
|
|
7724
7732
|
{
|
|
7725
7733
|
label: category.display_name,
|
|
7726
|
-
id: category.id,
|
|
7734
|
+
id: "id" in category ? category.id : category.stable_name,
|
|
7727
7735
|
value: {
|
|
7728
7736
|
type: "GROUP",
|
|
7729
7737
|
items: category.subCategories.map((x) => mapCategoryToOption(x))
|
|
@@ -7743,7 +7751,7 @@ var getAssignedValue = (bankTransaction) => {
|
|
|
7743
7751
|
if (bankTransaction.categorization_status === "MATCHED" /* MATCHED */ || (bankTransaction == null ? void 0 : bankTransaction.categorization_status) === "SPLIT" /* SPLIT */) {
|
|
7744
7752
|
return;
|
|
7745
7753
|
}
|
|
7746
|
-
if (bankTransaction.category && bankTransaction.category.type != "
|
|
7754
|
+
if (bankTransaction.category && bankTransaction.category.type != "ExclusionNested") {
|
|
7747
7755
|
return mapCategoryToOption(bankTransaction.category);
|
|
7748
7756
|
}
|
|
7749
7757
|
if (hasSuggestions(bankTransaction.categorization_flow)) {
|
|
@@ -7804,7 +7812,7 @@ var CategorySelectDrawer = ({
|
|
|
7804
7812
|
showTooltips: _showTooltips
|
|
7805
7813
|
}) => {
|
|
7806
7814
|
var _a, _b;
|
|
7807
|
-
const { setContent, close } =
|
|
7815
|
+
const { setContent, close } = useContext16(DrawerContext);
|
|
7808
7816
|
const onDrawerCategorySelect = (value) => {
|
|
7809
7817
|
close();
|
|
7810
7818
|
onSelect(value);
|
|
@@ -7866,16 +7874,16 @@ import classNames33 from "classnames";
|
|
|
7866
7874
|
import { parseISO as parseISO3, format as formatTime } from "date-fns";
|
|
7867
7875
|
import { jsx as jsx100, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
7868
7876
|
var mapCategoryToOption2 = (category) => {
|
|
7869
|
-
var _a;
|
|
7877
|
+
var _a, _b;
|
|
7870
7878
|
return {
|
|
7871
7879
|
type: "category" /* CATEGORY */,
|
|
7872
7880
|
payload: {
|
|
7873
|
-
id: category.id,
|
|
7881
|
+
id: "id" in category ? category.id : "",
|
|
7874
7882
|
option_type: "category" /* CATEGORY */,
|
|
7875
7883
|
display_name: category.display_name,
|
|
7876
7884
|
type: category.type,
|
|
7877
7885
|
description: (_a = category.description) != null ? _a : void 0,
|
|
7878
|
-
stable_name: category.stable_name,
|
|
7886
|
+
stable_name: "stable_name" in category ? (_b = category.stable_name) != null ? _b : "" : "",
|
|
7879
7887
|
entries: category.entries,
|
|
7880
7888
|
subCategories: category.subCategories
|
|
7881
7889
|
}
|
|
@@ -7889,7 +7897,7 @@ var mapCategoryToExclusionOption = (category) => {
|
|
|
7889
7897
|
option_type: "category" /* CATEGORY */,
|
|
7890
7898
|
display_name: category.display_name,
|
|
7891
7899
|
type: "ExclusionNested",
|
|
7892
|
-
stable_name:
|
|
7900
|
+
stable_name: "",
|
|
7893
7901
|
entries: category.entries,
|
|
7894
7902
|
subCategories: category.subCategories
|
|
7895
7903
|
}
|
|
@@ -7902,7 +7910,8 @@ var mapSuggestedMatchToOption = (record) => {
|
|
|
7902
7910
|
id: record.id,
|
|
7903
7911
|
option_type: "match" /* MATCH */,
|
|
7904
7912
|
display_name: record.details.description,
|
|
7905
|
-
amount: record.details.amount
|
|
7913
|
+
amount: record.details.amount,
|
|
7914
|
+
subCategories: null
|
|
7906
7915
|
}
|
|
7907
7916
|
};
|
|
7908
7917
|
};
|
|
@@ -7976,7 +7985,8 @@ var allCategoriesDivider = [
|
|
|
7976
7985
|
payload: {
|
|
7977
7986
|
id: "all_categories",
|
|
7978
7987
|
option_type: "hidden" /* HIDDEN */,
|
|
7979
|
-
display_name: "ALL CATEGORIES"
|
|
7988
|
+
display_name: "ALL CATEGORIES",
|
|
7989
|
+
subCategories: null
|
|
7980
7990
|
}
|
|
7981
7991
|
}
|
|
7982
7992
|
]
|
|
@@ -8022,7 +8032,8 @@ var CategorySelect = ({
|
|
|
8022
8032
|
option_type: "match" /* MATCH */,
|
|
8023
8033
|
display_name: x.details.description,
|
|
8024
8034
|
date: x.details.date,
|
|
8025
|
-
amount: x.details.amount
|
|
8035
|
+
amount: x.details.amount,
|
|
8036
|
+
subCategories: null
|
|
8026
8037
|
}
|
|
8027
8038
|
};
|
|
8028
8039
|
})
|
|
@@ -8235,15 +8246,15 @@ var Trash_default = Trash;
|
|
|
8235
8246
|
import { forwardRef as forwardRef9, useImperativeHandle } from "react";
|
|
8236
8247
|
|
|
8237
8248
|
// src/contexts/ReceiptsContext/ReceiptsContext.ts
|
|
8238
|
-
import { createContext as
|
|
8239
|
-
var ReceiptsContext =
|
|
8249
|
+
import { createContext as createContext10, useContext as useContext17 } from "react";
|
|
8250
|
+
var ReceiptsContext = createContext10({
|
|
8240
8251
|
receiptUrls: [],
|
|
8241
8252
|
uploadReceipt: () => {
|
|
8242
8253
|
},
|
|
8243
8254
|
archiveDocument: () => {
|
|
8244
8255
|
}
|
|
8245
8256
|
});
|
|
8246
|
-
var useReceiptsContext = () =>
|
|
8257
|
+
var useReceiptsContext = () => useContext17(ReceiptsContext);
|
|
8247
8258
|
|
|
8248
8259
|
// src/hooks/useReceipts/useReceipts.ts
|
|
8249
8260
|
import { useEffect as useEffect10, useState as useState19 } from "react";
|
|
@@ -9190,7 +9201,7 @@ var ExpandedBankTransactionRow = forwardRef10(
|
|
|
9190
9201
|
const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && ((_e = (_d = bankTransaction.categorization_flow) == null ? void 0 : _d.suggestions) == null ? void 0 : _e[0]);
|
|
9191
9202
|
const [rowState, updateRowState] = useState22({
|
|
9192
9203
|
splits: ((_f = bankTransaction.category) == null ? void 0 : _f.entries) ? (_g = bankTransaction.category) == null ? void 0 : _g.entries.map((c) => {
|
|
9193
|
-
return c.type === "ExclusionSplitEntry" ? {
|
|
9204
|
+
return c.type === "ExclusionSplitEntry" && c.category.type === "ExclusionNested" ? {
|
|
9194
9205
|
amount: c.amount || 0,
|
|
9195
9206
|
inputValue: centsToDollars(c.amount),
|
|
9196
9207
|
category: mapCategoryToExclusionOption(c.category)
|
|
@@ -9778,7 +9789,7 @@ var BankTransactionRow = ({
|
|
|
9778
9789
|
initialLoad ? "initial-load" : "",
|
|
9779
9790
|
showComponent ? "show" : ""
|
|
9780
9791
|
);
|
|
9781
|
-
const showReceiptDataProperties =
|
|
9792
|
+
const showReceiptDataProperties = useMemo16(
|
|
9782
9793
|
() => toDataProperties({ "show-receipt-upload-column": showReceiptUploadColumn }),
|
|
9783
9794
|
[showReceiptUploadColumn]
|
|
9784
9795
|
);
|
|
@@ -10246,10 +10257,10 @@ var BankTransactionList = ({
|
|
|
10246
10257
|
};
|
|
10247
10258
|
|
|
10248
10259
|
// src/components/BankTransactionMobileList/BankTransactionMobileListItem.tsx
|
|
10249
|
-
import { useContext as
|
|
10260
|
+
import { useContext as useContext20, useEffect as useEffect21, useRef as useRef16, useState as useState32 } from "react";
|
|
10250
10261
|
|
|
10251
10262
|
// src/components/BankTransactionMobileList/BusinessForm.tsx
|
|
10252
|
-
import { useContext as
|
|
10263
|
+
import { useContext as useContext19, useEffect as useEffect17, useMemo as useMemo17, useRef as useRef12, useState as useState26 } from "react";
|
|
10253
10264
|
|
|
10254
10265
|
// src/icons/Paperclip.tsx
|
|
10255
10266
|
import { jsx as jsx120 } from "react/jsx-runtime";
|
|
@@ -10280,19 +10291,19 @@ var Paperclip_default = Paperclip;
|
|
|
10280
10291
|
|
|
10281
10292
|
// src/components/BankTransactionMobileList/useMemoText.tsx
|
|
10282
10293
|
import {
|
|
10283
|
-
createContext as
|
|
10284
|
-
useContext as
|
|
10294
|
+
createContext as createContext11,
|
|
10295
|
+
useContext as useContext18,
|
|
10285
10296
|
useEffect as useEffect16,
|
|
10286
10297
|
useState as useState25
|
|
10287
10298
|
} from "react";
|
|
10288
10299
|
import { jsx as jsx121 } from "react/jsx-runtime";
|
|
10289
|
-
var MemoTextContext =
|
|
10300
|
+
var MemoTextContext = createContext11({
|
|
10290
10301
|
memoText: void 0,
|
|
10291
10302
|
setMemoText: () => {
|
|
10292
10303
|
},
|
|
10293
10304
|
saveMemoText: () => Promise.resolve()
|
|
10294
10305
|
});
|
|
10295
|
-
var useMemoTextContext = () =>
|
|
10306
|
+
var useMemoTextContext = () => useContext18(MemoTextContext);
|
|
10296
10307
|
var useMemoText = ({ bankTransaction, isActive }) => {
|
|
10297
10308
|
const { businessId } = useLayerContext();
|
|
10298
10309
|
const { apiUrl } = useEnvironment();
|
|
@@ -10367,7 +10378,7 @@ var BusinessForm = ({
|
|
|
10367
10378
|
showDescriptions
|
|
10368
10379
|
}) => {
|
|
10369
10380
|
const receiptsRef = useRef12(null);
|
|
10370
|
-
const { setContent, close } =
|
|
10381
|
+
const { setContent, close } = useContext19(DrawerContext);
|
|
10371
10382
|
const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
|
|
10372
10383
|
const [selectedCategory, setSelectedCategory] = useState26(
|
|
10373
10384
|
getAssignedValue(bankTransaction)
|
|
@@ -10379,7 +10390,7 @@ var BusinessForm = ({
|
|
|
10379
10390
|
setShowRetry(true);
|
|
10380
10391
|
}
|
|
10381
10392
|
}, [bankTransaction.error]);
|
|
10382
|
-
const options =
|
|
10393
|
+
const options = useMemo17(() => {
|
|
10383
10394
|
var _a;
|
|
10384
10395
|
const options2 = ((_a = bankTransaction == null ? void 0 : bankTransaction.categorization_flow) == null ? void 0 : _a.type) === "ASK_FROM_SUGGESTIONS" /* ASK_FROM_SUGGESTIONS */ ? bankTransaction.categorization_flow.suggestions.map(
|
|
10385
10396
|
(x) => mapCategoryToOption(x)
|
|
@@ -10824,7 +10835,7 @@ var SplitForm = ({
|
|
|
10824
10835
|
const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && ((_b = (_a = bankTransaction.categorization_flow) == null ? void 0 : _a.suggestions) == null ? void 0 : _b[0]);
|
|
10825
10836
|
const [rowState, updateRowState] = useState29({
|
|
10826
10837
|
splits: ((_c = bankTransaction.category) == null ? void 0 : _c.entries) ? (_d = bankTransaction.category) == null ? void 0 : _d.entries.map((c) => {
|
|
10827
|
-
return c.type === "ExclusionSplitEntry" ? {
|
|
10838
|
+
return c.type === "ExclusionSplitEntry" && c.category.type === "ExclusionNested" ? {
|
|
10828
10839
|
amount: c.amount || 0,
|
|
10829
10840
|
inputValue: centsToDollars(c.amount),
|
|
10830
10841
|
category: mapCategoryToExclusionOption(c.category)
|
|
@@ -11178,7 +11189,7 @@ var BankTransactionMobileForms = ({
|
|
|
11178
11189
|
};
|
|
11179
11190
|
|
|
11180
11191
|
// src/components/BankTransactionMobileList/TransactionToOpenContext.ts
|
|
11181
|
-
import { createContext as
|
|
11192
|
+
import { createContext as createContext12, useState as useState31 } from "react";
|
|
11182
11193
|
var useTransactionToOpen = () => {
|
|
11183
11194
|
const [transactionIdToOpen, setTransactionIdToOpen] = useState31(void 0);
|
|
11184
11195
|
const clearTransactionIdToOpen = () => setTransactionIdToOpen(void 0);
|
|
@@ -11188,7 +11199,7 @@ var useTransactionToOpen = () => {
|
|
|
11188
11199
|
clearTransactionIdToOpen
|
|
11189
11200
|
};
|
|
11190
11201
|
};
|
|
11191
|
-
var TransactionToOpenContext =
|
|
11202
|
+
var TransactionToOpenContext = createContext12({
|
|
11192
11203
|
transactionIdToOpen: void 0,
|
|
11193
11204
|
setTransactionIdToOpen: () => void 0,
|
|
11194
11205
|
clearTransactionIdToOpen: () => void 0
|
|
@@ -11226,7 +11237,7 @@ var BankTransactionMobileListItem = ({
|
|
|
11226
11237
|
transactionIdToOpen,
|
|
11227
11238
|
setTransactionIdToOpen,
|
|
11228
11239
|
clearTransactionIdToOpen
|
|
11229
|
-
} =
|
|
11240
|
+
} = useContext20(TransactionToOpenContext);
|
|
11230
11241
|
const { shouldHideAfterCategorize } = useBankTransactionsContext();
|
|
11231
11242
|
const formRowRef = useElementSize(
|
|
11232
11243
|
(_a2, _b, { height: height2 }) => setHeight(height2)
|
|
@@ -11237,7 +11248,7 @@ var BankTransactionMobileListItem = ({
|
|
|
11237
11248
|
const itemRef = useRef16(null);
|
|
11238
11249
|
const [removeAnim, setRemoveAnim] = useState32(false);
|
|
11239
11250
|
const [purpose, setPurpose] = useState32(
|
|
11240
|
-
bankTransaction.category ? bankTransaction.category.type === "
|
|
11251
|
+
bankTransaction.category ? bankTransaction.category.type === "ExclusionNested" ? "personal" /* personal */ : bankTransaction.categorization_status === "SPLIT" /* SPLIT */ ? "more" /* more */ : "business" /* business */ : hasMatch(bankTransaction) ? "more" /* more */ : "business" /* business */
|
|
11241
11252
|
);
|
|
11242
11253
|
const [open, setOpen] = useState32(isFirstItem);
|
|
11243
11254
|
const [showComponent, setShowComponent] = useState32(!initialLoad);
|
|
@@ -11438,7 +11449,7 @@ var BankTransactionMobileList = ({
|
|
|
11438
11449
|
};
|
|
11439
11450
|
|
|
11440
11451
|
// src/components/BankTransactionsTable/BankTransactionsTable.tsx
|
|
11441
|
-
import { useMemo as
|
|
11452
|
+
import { useMemo as useMemo18 } from "react";
|
|
11442
11453
|
|
|
11443
11454
|
// src/components/SkeletonLoader/SkeletonLoader.tsx
|
|
11444
11455
|
import classNames47 from "classnames";
|
|
@@ -11470,7 +11481,7 @@ var SkeletonTableLoader = ({
|
|
|
11470
11481
|
{
|
|
11471
11482
|
colSpan: col.colSpan,
|
|
11472
11483
|
className: "Layer__skeleton-loader__row",
|
|
11473
|
-
children: col.colComponent ? col.colComponent : col.parts && col.parts > 1 ? /* @__PURE__ */ jsx131("span", { className: "Layer__skeleton-loader__row__group", children:
|
|
11484
|
+
children: col.colComponent ? col.colComponent : col.parts && col.parts > 1 ? /* @__PURE__ */ jsx131("span", { className: "Layer__skeleton-loader__row__group", children: Array(col.parts).map((_part, partIndex) => /* @__PURE__ */ jsx131(
|
|
11474
11485
|
SkeletonLoader,
|
|
11475
11486
|
{
|
|
11476
11487
|
width: "100%",
|
|
@@ -11612,7 +11623,7 @@ var BankTransactionsTable = ({
|
|
|
11612
11623
|
return ((_a2 = transaction.document_ids) == null ? void 0 : _a2.length) > 0;
|
|
11613
11624
|
}
|
|
11614
11625
|
))) != null ? _a : false;
|
|
11615
|
-
const showReceiptDataProperties =
|
|
11626
|
+
const showReceiptDataProperties = useMemo18(
|
|
11616
11627
|
() => toDataProperties({ "show-receipt-upload-column": showReceiptColumn }),
|
|
11617
11628
|
[showReceiptColumn]
|
|
11618
11629
|
);
|
|
@@ -11722,7 +11733,7 @@ var ErrorBoundary = class extends Component {
|
|
|
11722
11733
|
};
|
|
11723
11734
|
|
|
11724
11735
|
// src/hooks/usePagination/usePagination.ts
|
|
11725
|
-
import { useMemo as
|
|
11736
|
+
import { useMemo as useMemo19 } from "react";
|
|
11726
11737
|
var DOTS = "...";
|
|
11727
11738
|
var usePagination = ({
|
|
11728
11739
|
totalCount,
|
|
@@ -11730,7 +11741,7 @@ var usePagination = ({
|
|
|
11730
11741
|
siblingCount = 1,
|
|
11731
11742
|
currentPage
|
|
11732
11743
|
}) => {
|
|
11733
|
-
const paginationRange =
|
|
11744
|
+
const paginationRange = useMemo19(() => {
|
|
11734
11745
|
const totalPageCount = Math.ceil(totalCount / pageSize);
|
|
11735
11746
|
const totalPageNumbers = siblingCount + 5;
|
|
11736
11747
|
if (totalPageNumbers >= totalPageCount) {
|
|
@@ -12138,7 +12149,7 @@ var BankTransactionsContent = ({
|
|
|
12138
12149
|
removeAfterCategorize
|
|
12139
12150
|
} = useBankTransactionsContext();
|
|
12140
12151
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
12141
|
-
const isSyncing =
|
|
12152
|
+
const isSyncing = useMemo20(
|
|
12142
12153
|
() => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
|
|
12143
12154
|
[linkedAccounts]
|
|
12144
12155
|
);
|
|
@@ -12189,7 +12200,7 @@ var BankTransactionsContent = ({
|
|
|
12189
12200
|
return () => clearTimeout(timeoutLoad);
|
|
12190
12201
|
}
|
|
12191
12202
|
}, [loadingStatus]);
|
|
12192
|
-
const bankTransactions =
|
|
12203
|
+
const bankTransactions = useMemo20(() => {
|
|
12193
12204
|
if (monthlyView) {
|
|
12194
12205
|
return data;
|
|
12195
12206
|
}
|
|
@@ -12436,11 +12447,11 @@ var Quickbooks = () => {
|
|
|
12436
12447
|
};
|
|
12437
12448
|
|
|
12438
12449
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
12439
|
-
import { createContext as
|
|
12450
|
+
import { createContext as createContext15 } from "react";
|
|
12440
12451
|
|
|
12441
12452
|
// src/contexts/ProfitAndLossComparisonContext/ProfitAndLossComparisonContext.tsx
|
|
12442
|
-
import { createContext as
|
|
12443
|
-
var PNLComparisonContext =
|
|
12453
|
+
import { createContext as createContext13 } from "react";
|
|
12454
|
+
var PNLComparisonContext = createContext13({
|
|
12444
12455
|
data: void 0,
|
|
12445
12456
|
isLoading: true,
|
|
12446
12457
|
isValidating: false,
|
|
@@ -12464,7 +12475,7 @@ var PNLComparisonContext = createContext12({
|
|
|
12464
12475
|
});
|
|
12465
12476
|
|
|
12466
12477
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
12467
|
-
import { useCallback as useCallback4, useMemo as
|
|
12478
|
+
import { useCallback as useCallback4, useMemo as useMemo22, useState as useState37 } from "react";
|
|
12468
12479
|
|
|
12469
12480
|
// src/utils/profitAndLossUtils.ts
|
|
12470
12481
|
var doesLineItemQualifies = (item) => {
|
|
@@ -12520,7 +12531,7 @@ var applyShare = (items, total) => {
|
|
|
12520
12531
|
};
|
|
12521
12532
|
|
|
12522
12533
|
// src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
|
|
12523
|
-
import { useEffect as useEffect24, useMemo as
|
|
12534
|
+
import { useEffect as useEffect24, useMemo as useMemo21, useState as useState36 } from "react";
|
|
12524
12535
|
import { startOfMonth as startOfMonth7, sub } from "date-fns";
|
|
12525
12536
|
import useSWR4 from "swr";
|
|
12526
12537
|
var buildDates = ({ currentDate }) => {
|
|
@@ -12551,7 +12562,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
12551
12562
|
const [date, setDate] = useState36(currentDate);
|
|
12552
12563
|
const [loaded, setLoaded] = useState36("initial");
|
|
12553
12564
|
const [data, setData] = useState36([]);
|
|
12554
|
-
const { startYear, startMonth, endYear, endMonth } =
|
|
12565
|
+
const { startYear, startMonth, endYear, endMonth } = useMemo21(() => {
|
|
12555
12566
|
return buildDates({ currentDate: date });
|
|
12556
12567
|
}, [date, businessId, tagFilter, reportingBasis]);
|
|
12557
12568
|
const queryKey = businessId && Boolean(startYear) && Boolean(startMonth) && Boolean(endYear) && Boolean(endMonth) && (auth == null ? void 0 : auth.access_token) && `profit-and-loss-summaries-${businessId}-${startYear.toString()}-${startMonth.toString()}-${tagFilter == null ? void 0 : tagFilter.key}-${(_a = tagFilter == null ? void 0 : tagFilter.values) == null ? void 0 : _a.join(
|
|
@@ -12743,7 +12754,7 @@ var useProfitAndLoss = ({
|
|
|
12743
12754
|
}) => {
|
|
12744
12755
|
const { start, end } = useGlobalDateRange();
|
|
12745
12756
|
const { setRange } = useGlobalDateRangeActions();
|
|
12746
|
-
const dateRange =
|
|
12757
|
+
const dateRange = useMemo22(() => ({ startDate: start, endDate: end }), [start, end]);
|
|
12747
12758
|
const changeDateRange = useCallback4(
|
|
12748
12759
|
({ startDate: start2, endDate: end2 }) => setRange({ start: start2, end: end2 }),
|
|
12749
12760
|
[setRange]
|
|
@@ -12779,7 +12790,7 @@ var useProfitAndLoss = ({
|
|
|
12779
12790
|
})
|
|
12780
12791
|
}));
|
|
12781
12792
|
};
|
|
12782
|
-
const { filteredDataRevenue, filteredTotalRevenue } =
|
|
12793
|
+
const { filteredDataRevenue, filteredTotalRevenue } = useMemo22(() => {
|
|
12783
12794
|
var _a;
|
|
12784
12795
|
if (!data) {
|
|
12785
12796
|
return { filteredDataRevenue: [], filteredTotalRevenue: void 0 };
|
|
@@ -12831,7 +12842,7 @@ var useProfitAndLoss = ({
|
|
|
12831
12842
|
const withShare = applyShare(sorted, total);
|
|
12832
12843
|
return { filteredDataRevenue: withShare, filteredTotalRevenue: total };
|
|
12833
12844
|
}, [data, start, filters, summaryData]);
|
|
12834
|
-
const { filteredDataExpenses, filteredTotalExpenses } =
|
|
12845
|
+
const { filteredDataExpenses, filteredTotalExpenses } = useMemo22(() => {
|
|
12835
12846
|
var _a;
|
|
12836
12847
|
if (!data) {
|
|
12837
12848
|
return { filteredDataExpenses: [], filteredTotalExpenses: void 0 };
|
|
@@ -13061,7 +13072,7 @@ function useProfitAndLossComparison({
|
|
|
13061
13072
|
}
|
|
13062
13073
|
|
|
13063
13074
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
13064
|
-
import { useEffect as useEffect28, useMemo as
|
|
13075
|
+
import { useEffect as useEffect28, useMemo as useMemo23, useState as useState40 } from "react";
|
|
13065
13076
|
|
|
13066
13077
|
// src/icons/BarChart2.tsx
|
|
13067
13078
|
import { jsx as jsx143, jsxs as jsxs91 } from "react/jsx-runtime";
|
|
@@ -13291,7 +13302,7 @@ var ProfitAndLossChart = ({
|
|
|
13291
13302
|
const { getColor, business } = useLayerContext();
|
|
13292
13303
|
const { start, end } = useGlobalDateRange();
|
|
13293
13304
|
const { setMonth } = useGlobalDateRangeActions();
|
|
13294
|
-
const dateRange =
|
|
13305
|
+
const dateRange = useMemo23(() => ({ startDate: start, endDate: end }), [start, end]);
|
|
13295
13306
|
const [localDateRange, setLocalDateRange] = useState40(dateRange);
|
|
13296
13307
|
const [customCursorSize, setCustomCursorSize] = useState40({
|
|
13297
13308
|
width: 0,
|
|
@@ -13303,7 +13314,7 @@ var ProfitAndLossChart = ({
|
|
|
13303
13314
|
start: startOfMonth10(sub2(Date.now(), { months: 11 })),
|
|
13304
13315
|
end: endOfMonth8(Date.now())
|
|
13305
13316
|
});
|
|
13306
|
-
const selectionMonth =
|
|
13317
|
+
const selectionMonth = useMemo23(
|
|
13307
13318
|
() => ({
|
|
13308
13319
|
year: localDateRange.startDate.getFullYear(),
|
|
13309
13320
|
month: localDateRange.startDate.getMonth()
|
|
@@ -13319,7 +13330,7 @@ var ProfitAndLossChart = ({
|
|
|
13319
13330
|
currentDate: startOfMonth10(Date.now()),
|
|
13320
13331
|
tagFilter
|
|
13321
13332
|
});
|
|
13322
|
-
const anyData =
|
|
13333
|
+
const anyData = useMemo23(() => {
|
|
13323
13334
|
return Boolean(
|
|
13324
13335
|
data == null ? void 0 : data.find(
|
|
13325
13336
|
(x) => x.income !== 0 || x.costOfGoodsSold !== 0 || x.grossProfit !== 0 || x.operatingExpenses !== 0 || x.profitBeforeTaxes !== 0 || x.taxes !== 0 || x.totalExpenses !== 0
|
|
@@ -13327,11 +13338,11 @@ var ProfitAndLossChart = ({
|
|
|
13327
13338
|
);
|
|
13328
13339
|
}, [data]);
|
|
13329
13340
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
13330
|
-
const isSyncing =
|
|
13341
|
+
const isSyncing = useMemo23(
|
|
13331
13342
|
() => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
|
|
13332
13343
|
[linkedAccounts]
|
|
13333
13344
|
);
|
|
13334
|
-
const loadingValue =
|
|
13345
|
+
const loadingValue = useMemo23(() => getLoadingValue(data), [data]);
|
|
13335
13346
|
useEffect28(() => {
|
|
13336
13347
|
if (loaded === "complete" && data) {
|
|
13337
13348
|
const foundCurrent = data.find(
|
|
@@ -13390,7 +13401,7 @@ var ProfitAndLossChart = ({
|
|
|
13390
13401
|
loading: (pnl == null ? void 0 : pnl.isLoading) ? loadingValue : 0,
|
|
13391
13402
|
loadingExpenses: (pnl == null ? void 0 : pnl.isLoading) ? -loadingValue : 0
|
|
13392
13403
|
});
|
|
13393
|
-
const theData =
|
|
13404
|
+
const theData = useMemo23(() => {
|
|
13394
13405
|
var _a;
|
|
13395
13406
|
if (loaded !== "complete" || loaded === "complete" && !anyData) {
|
|
13396
13407
|
const loadingData = [];
|
|
@@ -13924,7 +13935,7 @@ var ProfitAndLossChart = ({
|
|
|
13924
13935
|
};
|
|
13925
13936
|
|
|
13926
13937
|
// src/components/ProfitAndLossCompareOptions/ProfitAndLossCompareOptions.tsx
|
|
13927
|
-
import { useContext as
|
|
13938
|
+
import { useContext as useContext21, useEffect as useEffect29, useState as useState41 } from "react";
|
|
13928
13939
|
import { jsx as jsx147, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
13929
13940
|
var selectStyles = {
|
|
13930
13941
|
valueContainer: (styles) => {
|
|
@@ -13944,8 +13955,8 @@ var ProfitAndLossCompareOptions = ({
|
|
|
13944
13955
|
refetch,
|
|
13945
13956
|
compareMonths,
|
|
13946
13957
|
compareOptions
|
|
13947
|
-
} =
|
|
13948
|
-
const { dateRange } =
|
|
13958
|
+
} = useContext21(ProfitAndLoss.ComparisonContext);
|
|
13959
|
+
const { dateRange } = useContext21(ProfitAndLoss.Context);
|
|
13949
13960
|
const [initialDone, setInitialDone] = useState41(false);
|
|
13950
13961
|
useEffect29(() => {
|
|
13951
13962
|
if (initialDone) {
|
|
@@ -14038,7 +14049,7 @@ var ProfitAndLossCompareOptions = ({
|
|
|
14038
14049
|
};
|
|
14039
14050
|
|
|
14040
14051
|
// src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
|
|
14041
|
-
import { useCallback as useCallback6, useContext as
|
|
14052
|
+
import { useCallback as useCallback6, useContext as useContext22 } from "react";
|
|
14042
14053
|
|
|
14043
14054
|
// src/components/DatePicker/ModeSelector/DatePickerModeSelector.tsx
|
|
14044
14055
|
import { jsx as jsx148 } from "react/jsx-runtime";
|
|
@@ -14085,7 +14096,7 @@ function DatePickerModeSelector({
|
|
|
14085
14096
|
import { endOfMonth as endOfMonth9, startOfMonth as startOfMonth11 } from "date-fns";
|
|
14086
14097
|
|
|
14087
14098
|
// src/providers/GlobalDateStore/useGlobalDateRangePicker.ts
|
|
14088
|
-
import { useMemo as
|
|
14099
|
+
import { useMemo as useMemo24 } from "react";
|
|
14089
14100
|
|
|
14090
14101
|
// src/utils/array/getArrayWithAtLeastOneOrFallback.ts
|
|
14091
14102
|
function getArrayWithAtLeastOneOrFallback(list, fallback) {
|
|
@@ -14112,7 +14123,7 @@ function useGlobalDateRangePicker({
|
|
|
14112
14123
|
DEFAULT_ALLOWED_PICKER_MODES
|
|
14113
14124
|
);
|
|
14114
14125
|
const desiredRangeMode = allowedDateRangePickerModes.includes(rangeDisplayMode) ? rangeDisplayMode : allowedDateRangePickerModes[0];
|
|
14115
|
-
const { dateFormat, selected } =
|
|
14126
|
+
const { dateFormat, selected } = useMemo24(() => {
|
|
14116
14127
|
if (rangeDisplayMode === "monthPicker") {
|
|
14117
14128
|
return {
|
|
14118
14129
|
selected: start,
|
|
@@ -14132,7 +14143,7 @@ function useGlobalDateRangePicker({
|
|
|
14132
14143
|
end,
|
|
14133
14144
|
rangeDisplayMode
|
|
14134
14145
|
]);
|
|
14135
|
-
const { setSelected } =
|
|
14146
|
+
const { setSelected } = useMemo24(() => {
|
|
14136
14147
|
if (desiredRangeMode === "monthPicker") {
|
|
14137
14148
|
return {
|
|
14138
14149
|
setSelected: ({ start: start2 }) => {
|
|
@@ -14170,7 +14181,7 @@ var ProfitAndLossDatePicker = ({
|
|
|
14170
14181
|
defaultDatePickerMode
|
|
14171
14182
|
}) => {
|
|
14172
14183
|
const { business } = useLayerContext();
|
|
14173
|
-
const { refetch, compareMode, compareMonths } =
|
|
14184
|
+
const { refetch, compareMode, compareMonths } = useContext22(ProfitAndLoss.ComparisonContext);
|
|
14174
14185
|
const getComparisonData = useCallback6((date) => {
|
|
14175
14186
|
if (compareMode && compareMonths > 0) {
|
|
14176
14187
|
refetch({
|
|
@@ -14226,7 +14237,7 @@ var ProfitAndLossDatePicker = ({
|
|
|
14226
14237
|
};
|
|
14227
14238
|
|
|
14228
14239
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
14229
|
-
import { useContext as
|
|
14240
|
+
import { useContext as useContext23, useState as useState42 } from "react";
|
|
14230
14241
|
|
|
14231
14242
|
// src/icons/X.tsx
|
|
14232
14243
|
import { jsx as jsx150, jsxs as jsxs95 } from "react/jsx-runtime";
|
|
@@ -14267,7 +14278,7 @@ var X2 = (_a) => {
|
|
|
14267
14278
|
var X_default = X2;
|
|
14268
14279
|
|
|
14269
14280
|
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
14270
|
-
import { useMemo as
|
|
14281
|
+
import { useMemo as useMemo25 } from "react";
|
|
14271
14282
|
|
|
14272
14283
|
// src/config/charts.ts
|
|
14273
14284
|
var DEFAULT_CHART_COLOR_TYPE = [
|
|
@@ -14558,7 +14569,7 @@ var DetailedChart = ({
|
|
|
14558
14569
|
isLoading,
|
|
14559
14570
|
showDatePicker = true
|
|
14560
14571
|
}) => {
|
|
14561
|
-
const chartData =
|
|
14572
|
+
const chartData = useMemo25(() => {
|
|
14562
14573
|
if (!filteredData) {
|
|
14563
14574
|
return [];
|
|
14564
14575
|
}
|
|
@@ -14928,7 +14939,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
14928
14939
|
sidebarScope,
|
|
14929
14940
|
setSidebarScope,
|
|
14930
14941
|
setFilterTypes
|
|
14931
|
-
} =
|
|
14942
|
+
} = useContext23(ProfitAndLoss.Context);
|
|
14932
14943
|
const theScope = scope ? scope : sidebarScope;
|
|
14933
14944
|
const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
|
|
14934
14945
|
const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
|
|
@@ -15001,7 +15012,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
15001
15012
|
};
|
|
15002
15013
|
|
|
15003
15014
|
// src/components/ProfitAndLossDownloadButton/ProfitAndLossDownloadButton.tsx
|
|
15004
|
-
import { useContext as
|
|
15015
|
+
import { useContext as useContext24, useState as useState43 } from "react";
|
|
15005
15016
|
import { jsx as jsx156 } from "react/jsx-runtime";
|
|
15006
15017
|
var ProfitAndLossDownloadButton = ({
|
|
15007
15018
|
stringOverrides,
|
|
@@ -15009,8 +15020,8 @@ var ProfitAndLossDownloadButton = ({
|
|
|
15009
15020
|
moneyFormat,
|
|
15010
15021
|
view
|
|
15011
15022
|
}) => {
|
|
15012
|
-
const { dateRange, tagFilter } =
|
|
15013
|
-
const { getProfitAndLossComparisonCsv } =
|
|
15023
|
+
const { dateRange, tagFilter } = useContext24(ProfitAndLoss.Context);
|
|
15024
|
+
const { getProfitAndLossComparisonCsv } = useContext24(
|
|
15014
15025
|
ProfitAndLoss.ComparisonContext
|
|
15015
15026
|
);
|
|
15016
15027
|
const { businessId } = useLayerContext();
|
|
@@ -15063,7 +15074,7 @@ var ProfitAndLossDownloadButton = ({
|
|
|
15063
15074
|
};
|
|
15064
15075
|
|
|
15065
15076
|
// src/components/ProfitAndLossHeader/ProfitAndLossHeader.tsx
|
|
15066
|
-
import { useMemo as
|
|
15077
|
+
import { useMemo as useMemo26 } from "react";
|
|
15067
15078
|
|
|
15068
15079
|
// src/components/SyncingBadge/SyncingBadge.tsx
|
|
15069
15080
|
import { jsx as jsx157 } from "react/jsx-runtime";
|
|
@@ -15088,7 +15099,7 @@ var ProfitAndLossHeader = ({
|
|
|
15088
15099
|
withDatePicker
|
|
15089
15100
|
}) => {
|
|
15090
15101
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
15091
|
-
const isSyncing =
|
|
15102
|
+
const isSyncing = useMemo26(
|
|
15092
15103
|
() => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
|
|
15093
15104
|
[linkedAccounts]
|
|
15094
15105
|
);
|
|
@@ -15102,7 +15113,7 @@ var ProfitAndLossHeader = ({
|
|
|
15102
15113
|
};
|
|
15103
15114
|
|
|
15104
15115
|
// src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
|
|
15105
|
-
import { useContext as
|
|
15116
|
+
import { useContext as useContext25 } from "react";
|
|
15106
15117
|
|
|
15107
15118
|
// src/components/Header/Header.tsx
|
|
15108
15119
|
import {
|
|
@@ -15263,7 +15274,7 @@ var ProfitAndLossReport = ({
|
|
|
15263
15274
|
view
|
|
15264
15275
|
}) => {
|
|
15265
15276
|
var _a, _b;
|
|
15266
|
-
const { sidebarScope } =
|
|
15277
|
+
const { sidebarScope } = useContext25(ProfitAndLoss.Context);
|
|
15267
15278
|
return /* @__PURE__ */ jsx165(
|
|
15268
15279
|
View,
|
|
15269
15280
|
{
|
|
@@ -15332,10 +15343,10 @@ var ProfitAndLossReport = ({
|
|
|
15332
15343
|
};
|
|
15333
15344
|
|
|
15334
15345
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
15335
|
-
import { useContext as
|
|
15346
|
+
import { useContext as useContext26, useMemo as useMemo30 } from "react";
|
|
15336
15347
|
|
|
15337
15348
|
// src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesList.tsx
|
|
15338
|
-
import { useMemo as
|
|
15349
|
+
import { useMemo as useMemo27 } from "react";
|
|
15339
15350
|
import { jsx as jsx166 } from "react/jsx-runtime";
|
|
15340
15351
|
var LIST_ITEM_CLASS_NAME = "Layer__ProfitAndLossSummariesListItem";
|
|
15341
15352
|
function ProfitAndLossSummariesListItem({
|
|
@@ -15343,7 +15354,7 @@ function ProfitAndLossSummariesListItem({
|
|
|
15343
15354
|
isActive,
|
|
15344
15355
|
onClick
|
|
15345
15356
|
}) {
|
|
15346
|
-
const dataProperties =
|
|
15357
|
+
const dataProperties = useMemo27(
|
|
15347
15358
|
() => toDataProperties({ active: isActive, clickable: !!onClick }),
|
|
15348
15359
|
[isActive]
|
|
15349
15360
|
);
|
|
@@ -15354,7 +15365,7 @@ function ProfitAndLossSummariesList({
|
|
|
15354
15365
|
children,
|
|
15355
15366
|
itemCount
|
|
15356
15367
|
}) {
|
|
15357
|
-
const dataProperties =
|
|
15368
|
+
const dataProperties = useMemo27(
|
|
15358
15369
|
() => toDataProperties({ ["column-count"]: itemCount }),
|
|
15359
15370
|
[itemCount]
|
|
15360
15371
|
);
|
|
@@ -15447,10 +15458,10 @@ function ProfitAndLossSummariesMiniChart({
|
|
|
15447
15458
|
}
|
|
15448
15459
|
|
|
15449
15460
|
// src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesSummary.tsx
|
|
15450
|
-
import { useMemo as
|
|
15461
|
+
import { useMemo as useMemo29 } from "react";
|
|
15451
15462
|
|
|
15452
15463
|
// src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesHeading.tsx
|
|
15453
|
-
import { useMemo as
|
|
15464
|
+
import { useMemo as useMemo28 } from "react";
|
|
15454
15465
|
import { jsx as jsx168 } from "react/jsx-runtime";
|
|
15455
15466
|
var HEADING_CLASS_NAME2 = "Layer__ProfitAndLossSummariesSummaryHeading";
|
|
15456
15467
|
function ProfitAndLossSummariesHeading({
|
|
@@ -15458,7 +15469,7 @@ function ProfitAndLossSummariesHeading({
|
|
|
15458
15469
|
children
|
|
15459
15470
|
}) {
|
|
15460
15471
|
const { size = "sm" } = variants != null ? variants : {};
|
|
15461
|
-
const labelDataProperties =
|
|
15472
|
+
const labelDataProperties = useMemo28(() => toDataProperties({ size }), [size]);
|
|
15462
15473
|
return /* @__PURE__ */ jsx168("h3", __spreadProps(__spreadValues({ className: HEADING_CLASS_NAME2 }, labelDataProperties), { children }));
|
|
15463
15474
|
}
|
|
15464
15475
|
|
|
@@ -15476,8 +15487,8 @@ function ProfitAndLossSummariesSummary({
|
|
|
15476
15487
|
}) {
|
|
15477
15488
|
const { Chart } = slots != null ? slots : {};
|
|
15478
15489
|
const { size = "sm" } = variants != null ? variants : {};
|
|
15479
|
-
const dataProperties =
|
|
15480
|
-
const amountDataProperties =
|
|
15490
|
+
const dataProperties = useMemo29(() => toDataProperties({ size }), [size]);
|
|
15491
|
+
const amountDataProperties = useMemo29(
|
|
15481
15492
|
() => toDataProperties({
|
|
15482
15493
|
positive: amount >= 0,
|
|
15483
15494
|
negative: amount < 0,
|
|
@@ -15510,9 +15521,9 @@ function Internal_ProfitAndLossSummaries({
|
|
|
15510
15521
|
isLoading,
|
|
15511
15522
|
setSidebarScope,
|
|
15512
15523
|
sidebarScope
|
|
15513
|
-
} =
|
|
15524
|
+
} = useContext26(ProfitAndLoss.Context);
|
|
15514
15525
|
const dataItem = Array.isArray(storedData) ? storedData[storedData.length - 1] : storedData;
|
|
15515
|
-
const { revenueChartData, expensesChartData } =
|
|
15526
|
+
const { revenueChartData, expensesChartData } = useMemo30(
|
|
15516
15527
|
() => ({
|
|
15517
15528
|
revenueChartData: toMiniChartData({ scope: "revenue", data: dataItem }),
|
|
15518
15529
|
expensesChartData: toMiniChartData({ scope: "expenses", data: dataItem })
|
|
@@ -15590,10 +15601,10 @@ function Internal_ProfitAndLossSummaries({
|
|
|
15590
15601
|
var ProfitAndLossSummaries = (props) => Internal_ProfitAndLossSummaries(props);
|
|
15591
15602
|
|
|
15592
15603
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
15593
|
-
import { useContext as
|
|
15604
|
+
import { useContext as useContext30 } from "react";
|
|
15594
15605
|
|
|
15595
15606
|
// src/contexts/TableContext/TableContext.tsx
|
|
15596
|
-
import { createContext as
|
|
15607
|
+
import { createContext as createContext14, useState as useState45 } from "react";
|
|
15597
15608
|
import { jsx as jsx171 } from "react/jsx-runtime";
|
|
15598
15609
|
var defaultValue = {
|
|
15599
15610
|
expandedRows: [],
|
|
@@ -15605,7 +15616,7 @@ var defaultValue = {
|
|
|
15605
15616
|
setExpandedAllRows: () => {
|
|
15606
15617
|
}
|
|
15607
15618
|
};
|
|
15608
|
-
var TableContext =
|
|
15619
|
+
var TableContext = createContext14(defaultValue);
|
|
15609
15620
|
var TableProvider = ({ children }) => {
|
|
15610
15621
|
const [expandedRows, setExpandedRowsState] = useState45([]);
|
|
15611
15622
|
const [expandedAllRows, setExpandedAllRows] = useState45(false);
|
|
@@ -15634,10 +15645,10 @@ var TableProvider = ({ children }) => {
|
|
|
15634
15645
|
};
|
|
15635
15646
|
|
|
15636
15647
|
// src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
|
|
15637
|
-
import
|
|
15648
|
+
import { Fragment as Fragment22, useContext as useContext28, useEffect as useEffect32 } from "react";
|
|
15638
15649
|
|
|
15639
15650
|
// src/hooks/useTableExpandRow/useTableExpandRow.tsx
|
|
15640
|
-
import { useContext as
|
|
15651
|
+
import { useContext as useContext27 } from "react";
|
|
15641
15652
|
var useTableExpandRow = () => {
|
|
15642
15653
|
const {
|
|
15643
15654
|
expandedAllRows,
|
|
@@ -15645,7 +15656,7 @@ var useTableExpandRow = () => {
|
|
|
15645
15656
|
expandAllRows,
|
|
15646
15657
|
expandedRows,
|
|
15647
15658
|
setExpandedRows
|
|
15648
|
-
} =
|
|
15659
|
+
} = useContext27(TableContext);
|
|
15649
15660
|
const toggleAllRows = () => {
|
|
15650
15661
|
if (expandedAllRows) {
|
|
15651
15662
|
setIsOpen([]);
|
|
@@ -15906,18 +15917,18 @@ var Table = ({
|
|
|
15906
15917
|
|
|
15907
15918
|
// src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
|
|
15908
15919
|
import classNames62 from "classnames";
|
|
15909
|
-
import { Fragment as
|
|
15920
|
+
import { Fragment as Fragment23, jsx as jsx177, jsxs as jsxs110 } from "react/jsx-runtime";
|
|
15910
15921
|
var ProfitAndLossCompareTable = ({
|
|
15911
15922
|
stringOverrides
|
|
15912
15923
|
}) => {
|
|
15913
|
-
const { dateRange } =
|
|
15924
|
+
const { dateRange } = useContext28(ProfitAndLoss.Context);
|
|
15914
15925
|
const {
|
|
15915
15926
|
data: comparisonData,
|
|
15916
15927
|
isLoading,
|
|
15917
15928
|
compareMonths,
|
|
15918
15929
|
compareOptions,
|
|
15919
15930
|
refetch
|
|
15920
|
-
} =
|
|
15931
|
+
} = useContext28(ProfitAndLoss.ComparisonContext);
|
|
15921
15932
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
15922
15933
|
useEffect32(() => {
|
|
15923
15934
|
setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
|
|
@@ -15951,7 +15962,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
15951
15962
|
}
|
|
15952
15963
|
});
|
|
15953
15964
|
if (rowData.length === 0) {
|
|
15954
|
-
return /* @__PURE__ */ jsx177(
|
|
15965
|
+
return /* @__PURE__ */ jsx177(Fragment23, {});
|
|
15955
15966
|
}
|
|
15956
15967
|
const mergedLineItems = mergeComparisonLineItemsAtDepth(
|
|
15957
15968
|
rowData
|
|
@@ -15960,7 +15971,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
15960
15971
|
}
|
|
15961
15972
|
const expandable = (lineItem == null ? void 0 : lineItem.line_items) && lineItem.line_items.length > 0 ? true : false;
|
|
15962
15973
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
15963
|
-
return /* @__PURE__ */ jsxs110(
|
|
15974
|
+
return /* @__PURE__ */ jsxs110(Fragment22, { children: [
|
|
15964
15975
|
/* @__PURE__ */ jsxs110(
|
|
15965
15976
|
TableRow,
|
|
15966
15977
|
{
|
|
@@ -15994,7 +16005,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
15994
16005
|
return /* @__PURE__ */ jsxs110(Table, { borderCollapse: "collapse", bottomSpacing: false, children: [
|
|
15995
16006
|
/* @__PURE__ */ jsx177(TableHead, { children: compareOptions && compareOptions.length > 1 && /* @__PURE__ */ jsxs110(TableRow, { rowKey: "", children: [
|
|
15996
16007
|
/* @__PURE__ */ jsx177(TableCell, { isHeaderCell: true }),
|
|
15997
|
-
compareOptions.map((option, i) => /* @__PURE__ */ jsxs110(
|
|
16008
|
+
compareOptions.map((option, i) => /* @__PURE__ */ jsxs110(Fragment22, { children: [
|
|
15998
16009
|
/* @__PURE__ */ jsx177(TableCell, { primary: true, isHeaderCell: true, children: option.displayName }, option + "-" + i),
|
|
15999
16010
|
compareMonths && Array.from({ length: compareMonths - 1 }, (_, index) => /* @__PURE__ */ jsx177(TableCell, { isHeaderCell: true }, option + "-" + index))
|
|
16000
16011
|
] }, option + "-" + i))
|
|
@@ -16002,10 +16013,10 @@ var ProfitAndLossCompareTable = ({
|
|
|
16002
16013
|
/* @__PURE__ */ jsxs110(TableBody, { children: [
|
|
16003
16014
|
compareMonths && /* @__PURE__ */ jsxs110(TableRow, { rowKey: "", children: [
|
|
16004
16015
|
/* @__PURE__ */ jsx177(TableCell, { isHeaderCell: true }),
|
|
16005
|
-
compareOptions && compareOptions.length > 0 ? compareOptions.map((option, i) => /* @__PURE__ */ jsx177(
|
|
16016
|
+
compareOptions && compareOptions.length > 0 ? compareOptions.map((option, i) => /* @__PURE__ */ jsx177(Fragment22, { children: generatComparisonMonths(
|
|
16006
16017
|
dateRange.startDate,
|
|
16007
16018
|
compareMonths
|
|
16008
|
-
).map((month, index) => /* @__PURE__ */ jsx177(TableCell, { isHeaderCell: true, children: month }, option + "-" + index)) }, option + "-" + i)) : /* @__PURE__ */ jsx177(
|
|
16019
|
+
).map((month, index) => /* @__PURE__ */ jsx177(TableCell, { isHeaderCell: true, children: month }, option + "-" + index)) }, option + "-" + i)) : /* @__PURE__ */ jsx177(Fragment22, { children: generatComparisonMonths(
|
|
16009
16020
|
dateRange.startDate,
|
|
16010
16021
|
compareMonths
|
|
16011
16022
|
).map((month, index) => /* @__PURE__ */ jsx177(TableCell, { isHeaderCell: true, children: month }, "total-" + index + "-cell")) }, "total-1")
|
|
@@ -16036,7 +16047,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
16036
16047
|
};
|
|
16037
16048
|
|
|
16038
16049
|
// src/components/ProfitAndLossTable/ProfitAndLossTableComponent.tsx
|
|
16039
|
-
import
|
|
16050
|
+
import { Fragment as Fragment24, useContext as useContext29, useEffect as useEffect33 } from "react";
|
|
16040
16051
|
|
|
16041
16052
|
// src/icons/PieChart.tsx
|
|
16042
16053
|
import { jsx as jsx178, jsxs as jsxs111 } from "react/jsx-runtime";
|
|
@@ -16135,7 +16146,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
16135
16146
|
data: actualData,
|
|
16136
16147
|
isLoading,
|
|
16137
16148
|
setSidebarScope
|
|
16138
|
-
} =
|
|
16149
|
+
} = useContext29(ProfitAndLoss.Context);
|
|
16139
16150
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
16140
16151
|
useEffect33(() => {
|
|
16141
16152
|
setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
|
|
@@ -16157,7 +16168,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
16157
16168
|
const renderLineItem = (lineItem, depth, rowKey, rowIndex, scope, setSidebarScope2, variant) => {
|
|
16158
16169
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
16159
16170
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
16160
|
-
return /* @__PURE__ */ jsxs112(
|
|
16171
|
+
return /* @__PURE__ */ jsxs112(Fragment24, { children: [
|
|
16161
16172
|
/* @__PURE__ */ jsxs112(
|
|
16162
16173
|
TableRow,
|
|
16163
16174
|
{
|
|
@@ -16267,22 +16278,22 @@ var ProfitAndLossTableComponent = ({
|
|
|
16267
16278
|
void 0,
|
|
16268
16279
|
"summation"
|
|
16269
16280
|
),
|
|
16270
|
-
data.personal_expenses ?
|
|
16271
|
-
data.other_outflows ?
|
|
16281
|
+
data.personal_expenses ? renderLineItem(data.personal_expenses, 0, "personal_expenses", 7) : null,
|
|
16282
|
+
data.other_outflows ? renderLineItem(data.other_outflows, 0, "other_outflows", 6) : null
|
|
16272
16283
|
] }) });
|
|
16273
16284
|
};
|
|
16274
16285
|
|
|
16275
16286
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
16276
16287
|
import { jsx as jsx180 } from "react/jsx-runtime";
|
|
16277
16288
|
var ProfitAndLossTableWithProvider = (props) => {
|
|
16278
|
-
const { compareMode } =
|
|
16289
|
+
const { compareMode } = useContext30(ProfitAndLoss.ComparisonContext);
|
|
16279
16290
|
return /* @__PURE__ */ jsx180(TableProvider, { children: compareMode ? /* @__PURE__ */ jsx180("div", { className: "Layer__compare__table__wrapper", children: /* @__PURE__ */ jsx180(ProfitAndLossCompareTable, __spreadValues({}, props)) }) : /* @__PURE__ */ jsx180(ProfitAndLossTableComponent, __spreadValues({}, props)) });
|
|
16280
16291
|
};
|
|
16281
16292
|
|
|
16282
16293
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
16283
16294
|
import { endOfMonth as endOfMonth10, startOfMonth as startOfMonth12 } from "date-fns";
|
|
16284
16295
|
import { jsx as jsx181 } from "react/jsx-runtime";
|
|
16285
|
-
var PNLContext =
|
|
16296
|
+
var PNLContext = createContext15({
|
|
16286
16297
|
data: void 0,
|
|
16287
16298
|
filteredDataRevenue: [],
|
|
16288
16299
|
filteredTotalRevenue: void 0,
|
|
@@ -16335,8 +16346,8 @@ ProfitAndLoss.Report = ProfitAndLossReport;
|
|
|
16335
16346
|
ProfitAndLoss.DownloadButton = ProfitAndLossDownloadButton;
|
|
16336
16347
|
|
|
16337
16348
|
// src/contexts/BalanceSheetContext/BalanceSheetContext.tsx
|
|
16338
|
-
import { createContext as
|
|
16339
|
-
var BalanceSheetContext =
|
|
16349
|
+
import { createContext as createContext16 } from "react";
|
|
16350
|
+
var BalanceSheetContext = createContext16({
|
|
16340
16351
|
data: void 0,
|
|
16341
16352
|
isLoading: false,
|
|
16342
16353
|
error: void 0,
|
|
@@ -16454,7 +16465,7 @@ var BalanceSheetExpandAllButton = ({
|
|
|
16454
16465
|
};
|
|
16455
16466
|
|
|
16456
16467
|
// src/components/BalanceSheetTable/BalanceSheetTable.tsx
|
|
16457
|
-
import
|
|
16468
|
+
import { Fragment as Fragment25, useEffect as useEffect35 } from "react";
|
|
16458
16469
|
import { jsx as jsx184, jsxs as jsxs113 } from "react/jsx-runtime";
|
|
16459
16470
|
var BalanceSheetTable = ({
|
|
16460
16471
|
data,
|
|
@@ -16478,7 +16489,7 @@ var BalanceSheetTable = ({
|
|
|
16478
16489
|
if (expandable) {
|
|
16479
16490
|
allRowKeys.push(rowKey);
|
|
16480
16491
|
}
|
|
16481
|
-
return /* @__PURE__ */ jsxs113(
|
|
16492
|
+
return /* @__PURE__ */ jsxs113(Fragment25, { children: [
|
|
16482
16493
|
/* @__PURE__ */ jsxs113(
|
|
16483
16494
|
TableRow,
|
|
16484
16495
|
{
|
|
@@ -16529,7 +16540,7 @@ var BalanceSheetTable = ({
|
|
|
16529
16540
|
/* @__PURE__ */ jsx184(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.typeColumnHeader) || "Type" }),
|
|
16530
16541
|
/* @__PURE__ */ jsx184(TableCell, { isHeaderCell: true, align: "right" /* RIGHT */, children: (stringOverrides == null ? void 0 : stringOverrides.totalColumnHeader) || "Total" })
|
|
16531
16542
|
] }) }),
|
|
16532
|
-
/* @__PURE__ */ jsx184(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx184(
|
|
16543
|
+
/* @__PURE__ */ jsx184(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx184(Fragment25, { children: data[row.lineItem] && renderLineItem(
|
|
16533
16544
|
data[row.lineItem],
|
|
16534
16545
|
0,
|
|
16535
16546
|
row.lineItem,
|
|
@@ -16569,7 +16580,7 @@ function useInvisibleDownload() {
|
|
|
16569
16580
|
const invisibleDownloadRef = useRef22(null);
|
|
16570
16581
|
const triggerInvisibleDownload = useCallback7((options) => {
|
|
16571
16582
|
var _a;
|
|
16572
|
-
(_a = invisibleDownloadRef.current) == null ? void 0 : _a.trigger(options);
|
|
16583
|
+
void ((_a = invisibleDownloadRef.current) == null ? void 0 : _a.trigger(options));
|
|
16573
16584
|
}, []);
|
|
16574
16585
|
return { invisibleDownloadRef, triggerInvisibleDownload };
|
|
16575
16586
|
}
|
|
@@ -16645,7 +16656,7 @@ function useBalanceSheetDownload({
|
|
|
16645
16656
|
}
|
|
16646
16657
|
|
|
16647
16658
|
// src/components/BalanceSheet/download/BalanceSheetDownloadButton.tsx
|
|
16648
|
-
import { Fragment as
|
|
16659
|
+
import { Fragment as Fragment26, jsx as jsx186, jsxs as jsxs114 } from "react/jsx-runtime";
|
|
16649
16660
|
function BalanceSheetDownloadButton({
|
|
16650
16661
|
effectiveDate,
|
|
16651
16662
|
iconOnly
|
|
@@ -16655,7 +16666,7 @@ function BalanceSheetDownloadButton({
|
|
|
16655
16666
|
effectiveDate,
|
|
16656
16667
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
16657
16668
|
});
|
|
16658
|
-
return /* @__PURE__ */ jsxs114(
|
|
16669
|
+
return /* @__PURE__ */ jsxs114(Fragment26, { children: [
|
|
16659
16670
|
/* @__PURE__ */ jsx186(
|
|
16660
16671
|
DownloadButton,
|
|
16661
16672
|
{
|
|
@@ -16746,8 +16757,8 @@ var BalanceSheetView = ({
|
|
|
16746
16757
|
};
|
|
16747
16758
|
|
|
16748
16759
|
// src/contexts/StatementOfCashContext/StatementOfCashFlowContext.tsx
|
|
16749
|
-
import { createContext as
|
|
16750
|
-
var StatementOfCashFlowContext =
|
|
16760
|
+
import { createContext as createContext17 } from "react";
|
|
16761
|
+
var StatementOfCashFlowContext = createContext17({
|
|
16751
16762
|
data: void 0,
|
|
16752
16763
|
isLoading: false,
|
|
16753
16764
|
error: void 0,
|
|
@@ -16796,7 +16807,7 @@ var useStatementOfCashFlow = (startDate = /* @__PURE__ */ new Date(), endDate =
|
|
|
16796
16807
|
};
|
|
16797
16808
|
|
|
16798
16809
|
// src/components/StatementOfCashFlowTable/StatementOfCashFlowTable.tsx
|
|
16799
|
-
import
|
|
16810
|
+
import { Fragment as Fragment27 } from "react";
|
|
16800
16811
|
import { jsx as jsx188, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
16801
16812
|
var StatementOfCashFlowTable = ({
|
|
16802
16813
|
data,
|
|
@@ -16807,7 +16818,7 @@ var StatementOfCashFlowTable = ({
|
|
|
16807
16818
|
const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
|
|
16808
16819
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
16809
16820
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
16810
|
-
return /* @__PURE__ */ jsxs116(
|
|
16821
|
+
return /* @__PURE__ */ jsxs116(Fragment27, { children: [
|
|
16811
16822
|
/* @__PURE__ */ jsxs116(
|
|
16812
16823
|
TableRow,
|
|
16813
16824
|
{
|
|
@@ -16859,7 +16870,7 @@ var StatementOfCashFlowTable = ({
|
|
|
16859
16870
|
] }) }),
|
|
16860
16871
|
/* @__PURE__ */ jsx188(TableBody, { children: config.map((row, idx) => {
|
|
16861
16872
|
if (row.type === "line_item") {
|
|
16862
|
-
return /* @__PURE__ */ jsx188(
|
|
16873
|
+
return /* @__PURE__ */ jsx188(Fragment27, { children: data[row.lineItem] && renderLineItem(
|
|
16863
16874
|
data[row.lineItem],
|
|
16864
16875
|
0,
|
|
16865
16876
|
row.lineItem ? row.lineItem : "",
|
|
@@ -16978,7 +16989,7 @@ function useCashflowStatementDownload({
|
|
|
16978
16989
|
}
|
|
16979
16990
|
|
|
16980
16991
|
// src/components/StatementOfCashFlow/download/CashflowStatementDownloadButton.tsx
|
|
16981
|
-
import { Fragment as
|
|
16992
|
+
import { Fragment as Fragment28, jsx as jsx189, jsxs as jsxs117 } from "react/jsx-runtime";
|
|
16982
16993
|
function CashflowStatementDownloadButton({
|
|
16983
16994
|
startDate,
|
|
16984
16995
|
endDate,
|
|
@@ -16990,7 +17001,7 @@ function CashflowStatementDownloadButton({
|
|
|
16990
17001
|
endDate,
|
|
16991
17002
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
16992
17003
|
});
|
|
16993
|
-
return /* @__PURE__ */ jsxs117(
|
|
17004
|
+
return /* @__PURE__ */ jsxs117(Fragment28, { children: [
|
|
16994
17005
|
/* @__PURE__ */ jsx189(
|
|
16995
17006
|
DownloadButton,
|
|
16996
17007
|
{
|
|
@@ -17106,12 +17117,12 @@ var StatementOfCashFlowView = ({
|
|
|
17106
17117
|
};
|
|
17107
17118
|
|
|
17108
17119
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
17109
|
-
import { useContext as
|
|
17120
|
+
import { useContext as useContext38 } from "react";
|
|
17110
17121
|
|
|
17111
17122
|
// src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
|
|
17112
|
-
import { createContext as
|
|
17123
|
+
import { createContext as createContext18 } from "react";
|
|
17113
17124
|
import { endOfMonth as endOfMonth11, startOfMonth as startOfMonth13 } from "date-fns";
|
|
17114
|
-
var ChartOfAccountsContext =
|
|
17125
|
+
var ChartOfAccountsContext = createContext18(
|
|
17115
17126
|
{
|
|
17116
17127
|
data: void 0,
|
|
17117
17128
|
isLoading: false,
|
|
@@ -17142,8 +17153,8 @@ var ChartOfAccountsContext = createContext17(
|
|
|
17142
17153
|
);
|
|
17143
17154
|
|
|
17144
17155
|
// src/contexts/LedgerAccountsContext/LedgerAccountsContext.tsx
|
|
17145
|
-
import { createContext as
|
|
17146
|
-
var LedgerAccountsContext =
|
|
17156
|
+
import { createContext as createContext19 } from "react";
|
|
17157
|
+
var LedgerAccountsContext = createContext19({
|
|
17147
17158
|
data: void 0,
|
|
17148
17159
|
entryData: void 0,
|
|
17149
17160
|
isLoading: false,
|
|
@@ -17749,7 +17760,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
17749
17760
|
};
|
|
17750
17761
|
|
|
17751
17762
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
|
|
17752
|
-
import { useContext as
|
|
17763
|
+
import { useContext as useContext34, useState as useState50 } from "react";
|
|
17753
17764
|
|
|
17754
17765
|
// src/icons/Plus.tsx
|
|
17755
17766
|
import { jsx as jsx192, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
@@ -17790,11 +17801,11 @@ var Plus = (_a) => {
|
|
|
17790
17801
|
var Plus_default = Plus;
|
|
17791
17802
|
|
|
17792
17803
|
// src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
|
|
17793
|
-
import { useContext as
|
|
17804
|
+
import { useContext as useContext31 } from "react";
|
|
17794
17805
|
import { endOfMonth as endOfMonth13, startOfMonth as startOfMonth15 } from "date-fns";
|
|
17795
17806
|
import { jsx as jsx193 } from "react/jsx-runtime";
|
|
17796
17807
|
var ChartOfAccountsDatePicker = () => {
|
|
17797
|
-
const { changeDateRange, dateRange } =
|
|
17808
|
+
const { changeDateRange, dateRange } = useContext31(ChartOfAccountsContext);
|
|
17798
17809
|
return /* @__PURE__ */ jsx193(
|
|
17799
17810
|
DatePicker,
|
|
17800
17811
|
{
|
|
@@ -17813,13 +17824,13 @@ var ChartOfAccountsDatePicker = () => {
|
|
|
17813
17824
|
};
|
|
17814
17825
|
|
|
17815
17826
|
// src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
|
|
17816
|
-
import { useContext as
|
|
17827
|
+
import { useContext as useContext32, useMemo as useMemo32 } from "react";
|
|
17817
17828
|
|
|
17818
17829
|
// src/components/ChartOfAccountsForm/useParentOptions.ts
|
|
17819
|
-
import { useMemo as
|
|
17830
|
+
import { useMemo as useMemo31 } from "react";
|
|
17820
17831
|
var useParentOptions = (data) => {
|
|
17821
17832
|
var _a;
|
|
17822
|
-
return
|
|
17833
|
+
return useMemo31(
|
|
17823
17834
|
() => flattenAccounts((data == null ? void 0 : data.accounts) || []).sort((a, b) => (a == null ? void 0 : a.name) && (b == null ? void 0 : b.name) ? a.name.localeCompare(b.name) : 0).map((x) => {
|
|
17824
17835
|
return {
|
|
17825
17836
|
label: x.name,
|
|
@@ -17844,9 +17855,9 @@ var ChartOfAccountsForm = ({
|
|
|
17844
17855
|
submitForm,
|
|
17845
17856
|
sendingForm,
|
|
17846
17857
|
apiError
|
|
17847
|
-
} =
|
|
17858
|
+
} = useContext32(ChartOfAccountsContext);
|
|
17848
17859
|
const parentOptions = useParentOptions(data);
|
|
17849
|
-
const entry =
|
|
17860
|
+
const entry = useMemo32(() => {
|
|
17850
17861
|
if ((form == null ? void 0 : form.action) === "edit" && form.accountId) {
|
|
17851
17862
|
return flattenAccounts((data == null ? void 0 : data.accounts) || []).find(
|
|
17852
17863
|
(x) => x.id === form.accountId
|
|
@@ -18059,7 +18070,7 @@ var ChartOfAccountsSidebar = ({
|
|
|
18059
18070
|
};
|
|
18060
18071
|
|
|
18061
18072
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
18062
|
-
import
|
|
18073
|
+
import { Fragment as Fragment29, useContext as useContext33, useEffect as useEffect39, useState as useState49 } from "react";
|
|
18063
18074
|
|
|
18064
18075
|
// src/icons/Edit2.tsx
|
|
18065
18076
|
import { jsx as jsx196 } from "react/jsx-runtime";
|
|
@@ -18119,8 +18130,8 @@ var ChartOfAccountsTableContent = ({
|
|
|
18119
18130
|
expandAll,
|
|
18120
18131
|
templateAccountsEditable
|
|
18121
18132
|
}) => {
|
|
18122
|
-
const { setAccountId } =
|
|
18123
|
-
const { editAccount } =
|
|
18133
|
+
const { setAccountId } = useContext33(LedgerAccountsContext);
|
|
18134
|
+
const { editAccount } = useContext33(ChartOfAccountsContext);
|
|
18124
18135
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
18125
18136
|
const [accountsRowKeys, setAccountsRowKeys] = useState49([]);
|
|
18126
18137
|
useEffect39(() => {
|
|
@@ -18149,7 +18160,7 @@ var ChartOfAccountsTableContent = ({
|
|
|
18149
18160
|
var _a, _b;
|
|
18150
18161
|
const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
18151
18162
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
18152
|
-
return /* @__PURE__ */ jsxs121(
|
|
18163
|
+
return /* @__PURE__ */ jsxs121(Fragment29, { children: [
|
|
18153
18164
|
/* @__PURE__ */ jsxs121(
|
|
18154
18165
|
TableRow,
|
|
18155
18166
|
{
|
|
@@ -18281,7 +18292,7 @@ function useAccountBalancesDownload({
|
|
|
18281
18292
|
}
|
|
18282
18293
|
|
|
18283
18294
|
// src/components/ChartOfAccounts/download/AccountBalancesDownloadButton.tsx
|
|
18284
|
-
import { Fragment as
|
|
18295
|
+
import { Fragment as Fragment30, jsx as jsx198, jsxs as jsxs122 } from "react/jsx-runtime";
|
|
18285
18296
|
function AccountBalancesDownloadButton({
|
|
18286
18297
|
startCutoff,
|
|
18287
18298
|
endCutoff,
|
|
@@ -18293,7 +18304,7 @@ function AccountBalancesDownloadButton({
|
|
|
18293
18304
|
endCutoff,
|
|
18294
18305
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
18295
18306
|
});
|
|
18296
|
-
return /* @__PURE__ */ jsxs122(
|
|
18307
|
+
return /* @__PURE__ */ jsxs122(Fragment30, { children: [
|
|
18297
18308
|
/* @__PURE__ */ jsx198(
|
|
18298
18309
|
DownloadButton,
|
|
18299
18310
|
{
|
|
@@ -18325,7 +18336,7 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
18325
18336
|
templateAccountsEditable
|
|
18326
18337
|
}) => {
|
|
18327
18338
|
var _a;
|
|
18328
|
-
const { data, isLoading, addAccount, error, isValidating, refetch, form } =
|
|
18339
|
+
const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext34(ChartOfAccountsContext);
|
|
18329
18340
|
const [expandAll, setExpandAll] = useState50();
|
|
18330
18341
|
const cumulativeIndex = 0;
|
|
18331
18342
|
const accountsLength = (_a = data == null ? void 0 : data.accounts.length) != null ? _a : 0;
|
|
@@ -18432,29 +18443,29 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
18432
18443
|
|
|
18433
18444
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
18434
18445
|
import {
|
|
18435
|
-
useContext as
|
|
18446
|
+
useContext as useContext37,
|
|
18436
18447
|
useEffect as useEffect41,
|
|
18437
|
-
useMemo as
|
|
18448
|
+
useMemo as useMemo34,
|
|
18438
18449
|
useState as useState52
|
|
18439
18450
|
} from "react";
|
|
18440
18451
|
|
|
18441
18452
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
18442
|
-
import { useContext as
|
|
18453
|
+
import { useContext as useContext35, useMemo as useMemo33 } from "react";
|
|
18443
18454
|
|
|
18444
18455
|
// src/utils/journal.ts
|
|
18445
18456
|
var getAccountIdentifierPayload = (journalLineItem) => {
|
|
18446
|
-
if (journalLineItem.account_identifier.id) {
|
|
18447
|
-
return {
|
|
18448
|
-
type: "AccountId",
|
|
18449
|
-
id: journalLineItem.account_identifier.id
|
|
18450
|
-
};
|
|
18451
|
-
}
|
|
18452
18457
|
if (journalLineItem.account_identifier.stable_name) {
|
|
18453
18458
|
return {
|
|
18454
18459
|
type: "StableName",
|
|
18455
18460
|
stable_name: journalLineItem.account_identifier.stable_name
|
|
18456
18461
|
};
|
|
18457
18462
|
}
|
|
18463
|
+
if (journalLineItem.account_identifier.id) {
|
|
18464
|
+
return {
|
|
18465
|
+
type: "AccountId",
|
|
18466
|
+
id: journalLineItem.account_identifier.id
|
|
18467
|
+
};
|
|
18468
|
+
}
|
|
18458
18469
|
throw new Error("Invalid account identifier");
|
|
18459
18470
|
};
|
|
18460
18471
|
var entryNumber = (entry) => {
|
|
@@ -18548,7 +18559,7 @@ var DetailsListItem = ({
|
|
|
18548
18559
|
};
|
|
18549
18560
|
|
|
18550
18561
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
18551
|
-
import { Fragment as
|
|
18562
|
+
import { Fragment as Fragment31, jsx as jsx204, jsxs as jsxs127 } from "react/jsx-runtime";
|
|
18552
18563
|
var SourceDetailView = ({
|
|
18553
18564
|
source,
|
|
18554
18565
|
stringOverrides
|
|
@@ -18556,7 +18567,7 @@ var SourceDetailView = ({
|
|
|
18556
18567
|
switch (source.type) {
|
|
18557
18568
|
case "Transaction_Ledger_Entry_Source": {
|
|
18558
18569
|
const transactionSource = source;
|
|
18559
|
-
return /* @__PURE__ */ jsxs127(
|
|
18570
|
+
return /* @__PURE__ */ jsxs127(Fragment31, { children: [
|
|
18560
18571
|
/* @__PURE__ */ jsx204(
|
|
18561
18572
|
DetailsListItem,
|
|
18562
18573
|
{
|
|
@@ -18584,7 +18595,7 @@ var SourceDetailView = ({
|
|
|
18584
18595
|
}
|
|
18585
18596
|
case "Invoice_Ledger_Entry_Source": {
|
|
18586
18597
|
const invoiceSource = source;
|
|
18587
|
-
return /* @__PURE__ */ jsxs127(
|
|
18598
|
+
return /* @__PURE__ */ jsxs127(Fragment31, { children: [
|
|
18588
18599
|
/* @__PURE__ */ jsx204(
|
|
18589
18600
|
DetailsListItem,
|
|
18590
18601
|
{
|
|
@@ -18605,7 +18616,7 @@ var SourceDetailView = ({
|
|
|
18605
18616
|
}
|
|
18606
18617
|
case "Manual_Ledger_Entry_Source": {
|
|
18607
18618
|
const manualSource = source;
|
|
18608
|
-
return /* @__PURE__ */ jsxs127(
|
|
18619
|
+
return /* @__PURE__ */ jsxs127(Fragment31, { children: [
|
|
18609
18620
|
/* @__PURE__ */ jsx204(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.memoLabel) || "Memo", children: manualSource.memo }),
|
|
18610
18621
|
/* @__PURE__ */ jsx204(
|
|
18611
18622
|
DetailsListItem,
|
|
@@ -18618,7 +18629,7 @@ var SourceDetailView = ({
|
|
|
18618
18629
|
}
|
|
18619
18630
|
case "Invoice_Payment_Ledger_Entry_Source": {
|
|
18620
18631
|
const invoicePaymentSource = source;
|
|
18621
|
-
return /* @__PURE__ */ jsxs127(
|
|
18632
|
+
return /* @__PURE__ */ jsxs127(Fragment31, { children: [
|
|
18622
18633
|
/* @__PURE__ */ jsx204(
|
|
18623
18634
|
DetailsListItem,
|
|
18624
18635
|
{
|
|
@@ -18631,7 +18642,7 @@ var SourceDetailView = ({
|
|
|
18631
18642
|
}
|
|
18632
18643
|
case "Refund_Ledger_Entry_Source": {
|
|
18633
18644
|
const refundSource = source;
|
|
18634
|
-
return /* @__PURE__ */ jsxs127(
|
|
18645
|
+
return /* @__PURE__ */ jsxs127(Fragment31, { children: [
|
|
18635
18646
|
/* @__PURE__ */ jsx204(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(refundSource.refunded_to_customer_amount)}` }),
|
|
18636
18647
|
/* @__PURE__ */ jsx204(
|
|
18637
18648
|
DetailsListItem,
|
|
@@ -18644,7 +18655,7 @@ var SourceDetailView = ({
|
|
|
18644
18655
|
}
|
|
18645
18656
|
case "Refund_Payment_Ledger_Entry_Source": {
|
|
18646
18657
|
const refundSource = source;
|
|
18647
|
-
return /* @__PURE__ */ jsxs127(
|
|
18658
|
+
return /* @__PURE__ */ jsxs127(Fragment31, { children: [
|
|
18648
18659
|
/* @__PURE__ */ jsx204(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(refundSource.refunded_to_customer_amount)}` }),
|
|
18649
18660
|
/* @__PURE__ */ jsx204(
|
|
18650
18661
|
DetailsListItem,
|
|
@@ -18657,7 +18668,7 @@ var SourceDetailView = ({
|
|
|
18657
18668
|
}
|
|
18658
18669
|
case "Opening_Balance_Ledger_Entry_Source": {
|
|
18659
18670
|
const openingBalanceSource = source;
|
|
18660
|
-
return /* @__PURE__ */ jsx204(
|
|
18671
|
+
return /* @__PURE__ */ jsx204(Fragment31, { children: /* @__PURE__ */ jsx204(
|
|
18661
18672
|
DetailsListItem,
|
|
18662
18673
|
{
|
|
18663
18674
|
label: (stringOverrides == null ? void 0 : stringOverrides.accountNameLabel) || "Account name",
|
|
@@ -18667,7 +18678,7 @@ var SourceDetailView = ({
|
|
|
18667
18678
|
}
|
|
18668
18679
|
case "Payout_Ledger_Entry_Source": {
|
|
18669
18680
|
const payoutSource = source;
|
|
18670
|
-
return /* @__PURE__ */ jsxs127(
|
|
18681
|
+
return /* @__PURE__ */ jsxs127(Fragment31, { children: [
|
|
18671
18682
|
/* @__PURE__ */ jsx204(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(payoutSource.paid_out_amount)}` }),
|
|
18672
18683
|
/* @__PURE__ */ jsx204(
|
|
18673
18684
|
DetailsListItem,
|
|
@@ -18686,8 +18697,8 @@ var LedgerAccountEntryDetails = ({
|
|
|
18686
18697
|
stringOverrides
|
|
18687
18698
|
}) => {
|
|
18688
18699
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
18689
|
-
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } =
|
|
18690
|
-
const { totalDebit, totalCredit } =
|
|
18700
|
+
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = useContext35(LedgerAccountsContext);
|
|
18701
|
+
const { totalDebit, totalCredit } = useMemo33(() => {
|
|
18691
18702
|
var _a2;
|
|
18692
18703
|
let totalDebit2 = 0;
|
|
18693
18704
|
let totalCredit2 = 0;
|
|
@@ -18833,7 +18844,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
18833
18844
|
};
|
|
18834
18845
|
|
|
18835
18846
|
// src/components/LedgerAccount/LedgerAccountRow.tsx
|
|
18836
|
-
import { useContext as
|
|
18847
|
+
import { useContext as useContext36, useEffect as useEffect40, useState as useState51 } from "react";
|
|
18837
18848
|
import classNames66 from "classnames";
|
|
18838
18849
|
import { parseISO as parseISO13, format as formatTime11 } from "date-fns";
|
|
18839
18850
|
import { jsx as jsx205, jsxs as jsxs128 } from "react/jsx-runtime";
|
|
@@ -18844,7 +18855,7 @@ var LedgerAccountRow = ({
|
|
|
18844
18855
|
view
|
|
18845
18856
|
}) => {
|
|
18846
18857
|
var _a, _b, _c, _d, _e, _f;
|
|
18847
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } =
|
|
18858
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext36(LedgerAccountsContext);
|
|
18848
18859
|
const [showComponent, setShowComponent] = useState51(false);
|
|
18849
18860
|
useEffect40(() => {
|
|
18850
18861
|
if (initialLoad) {
|
|
@@ -18982,7 +18993,7 @@ var LedgerAccountRow = ({
|
|
|
18982
18993
|
|
|
18983
18994
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
18984
18995
|
import classNames67 from "classnames";
|
|
18985
|
-
import { Fragment as
|
|
18996
|
+
import { Fragment as Fragment32, jsx as jsx206, jsxs as jsxs129 } from "react/jsx-runtime";
|
|
18986
18997
|
var LedgerAccount = ({
|
|
18987
18998
|
containerRef,
|
|
18988
18999
|
pageSize = 15,
|
|
@@ -18992,7 +19003,7 @@ var LedgerAccount = ({
|
|
|
18992
19003
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
18993
19004
|
const [currentPage, setCurrentPage] = useState52(1);
|
|
18994
19005
|
const [initialLoad, setInitialLoad] = useState52(true);
|
|
18995
|
-
const { data: accountData } =
|
|
19006
|
+
const { data: accountData } = useContext37(ChartOfAccountsContext);
|
|
18996
19007
|
const {
|
|
18997
19008
|
data: rawData,
|
|
18998
19009
|
error,
|
|
@@ -19003,7 +19014,7 @@ var LedgerAccount = ({
|
|
|
19003
19014
|
selectedEntryId,
|
|
19004
19015
|
closeSelectedEntry,
|
|
19005
19016
|
refetch
|
|
19006
|
-
} =
|
|
19017
|
+
} = useContext37(LedgerAccountsContext);
|
|
19007
19018
|
useEffect41(() => {
|
|
19008
19019
|
if (!isLoading) {
|
|
19009
19020
|
const timeoutLoad = setTimeout(() => {
|
|
@@ -19016,12 +19027,12 @@ var LedgerAccount = ({
|
|
|
19016
19027
|
"Layer__ledger-account__index",
|
|
19017
19028
|
accountId && "open"
|
|
19018
19029
|
);
|
|
19019
|
-
const account =
|
|
19030
|
+
const account = useMemo34(() => {
|
|
19020
19031
|
return flattenAccounts((accountData == null ? void 0 : accountData.accounts) || []).find(
|
|
19021
19032
|
(x) => x.id === accountId
|
|
19022
19033
|
);
|
|
19023
19034
|
}, [accountId]);
|
|
19024
|
-
const data =
|
|
19035
|
+
const data = useMemo34(() => {
|
|
19025
19036
|
var _a2;
|
|
19026
19037
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
19027
19038
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
@@ -19081,12 +19092,12 @@ var LedgerAccount = ({
|
|
|
19081
19092
|
/* @__PURE__ */ jsxs129("table", { className: "Layer__table Layer__table--hover-effect Layer__ledger-account-table", children: [
|
|
19082
19093
|
/* @__PURE__ */ jsx206("thead", { children: /* @__PURE__ */ jsxs129("tr", { children: [
|
|
19083
19094
|
view !== "desktop" && /* @__PURE__ */ jsx206("th", {}),
|
|
19084
|
-
view === "desktop" && /* @__PURE__ */ jsxs129(
|
|
19095
|
+
view === "desktop" && /* @__PURE__ */ jsxs129(Fragment32, { children: [
|
|
19085
19096
|
/* @__PURE__ */ jsx206("th", { className: "Layer__table-header", children: ((_b = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _b.dateColumnHeader) || "Date" }),
|
|
19086
19097
|
/* @__PURE__ */ jsx206("th", { className: "Layer__table-header", children: ((_c = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _c.journalIdColumnHeader) || "Journal id #" }),
|
|
19087
19098
|
/* @__PURE__ */ jsx206("th", { className: "Layer__table-header", children: ((_d = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _d.sourceColumnHeader) || "Source" })
|
|
19088
19099
|
] }),
|
|
19089
|
-
view !== "mobile" && /* @__PURE__ */ jsxs129(
|
|
19100
|
+
view !== "mobile" && /* @__PURE__ */ jsxs129(Fragment32, { children: [
|
|
19090
19101
|
/* @__PURE__ */ jsx206("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_e = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _e.debitColumnHeader) || "Debit" }),
|
|
19091
19102
|
/* @__PURE__ */ jsx206("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_f = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _f.creditColumnHeader) || "Credit" }),
|
|
19092
19103
|
/* @__PURE__ */ jsx206("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_g = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _g.runningBalanceColumnHeader) || "Running balance" })
|
|
@@ -19159,7 +19170,7 @@ var ChartOfAccountsContent = ({
|
|
|
19159
19170
|
templateAccountsEditable,
|
|
19160
19171
|
showAddAccountButton
|
|
19161
19172
|
}) => {
|
|
19162
|
-
const { accountId } =
|
|
19173
|
+
const { accountId } = useContext38(LedgerAccountsContext);
|
|
19163
19174
|
const { view, containerRef } = useElementViewSize();
|
|
19164
19175
|
return /* @__PURE__ */ jsx207(Container, { name: "chart-of-accounts", ref: containerRef, asWidget, children: accountId ? /* @__PURE__ */ jsx207(
|
|
19165
19176
|
LedgerAccount,
|
|
@@ -19184,8 +19195,8 @@ var ChartOfAccountsContent = ({
|
|
|
19184
19195
|
};
|
|
19185
19196
|
|
|
19186
19197
|
// src/contexts/JournalContext/JournalContext.tsx
|
|
19187
|
-
import { createContext as
|
|
19188
|
-
var JournalContext =
|
|
19198
|
+
import { createContext as createContext20 } from "react";
|
|
19199
|
+
var JournalContext = createContext20({
|
|
19189
19200
|
data: void 0,
|
|
19190
19201
|
isLoading: false,
|
|
19191
19202
|
error: void 0,
|
|
@@ -19270,7 +19281,7 @@ var useJournal = () => {
|
|
|
19270
19281
|
setForm({
|
|
19271
19282
|
action: "new",
|
|
19272
19283
|
data: {
|
|
19273
|
-
entry_at:
|
|
19284
|
+
entry_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
19274
19285
|
created_by: "Test API Integration",
|
|
19275
19286
|
memo: "",
|
|
19276
19287
|
line_items: [
|
|
@@ -19488,13 +19499,13 @@ var useJournal = () => {
|
|
|
19488
19499
|
};
|
|
19489
19500
|
|
|
19490
19501
|
// src/components/JournalTable/JournalTableWithPanel.tsx
|
|
19491
|
-
import { useContext as
|
|
19502
|
+
import { useContext as useContext44, useMemo as useMemo37, useState as useState55 } from "react";
|
|
19492
19503
|
|
|
19493
19504
|
// src/components/JournalSidebar/JournalSidebar.tsx
|
|
19494
|
-
import { useContext as
|
|
19505
|
+
import { useContext as useContext42 } from "react";
|
|
19495
19506
|
|
|
19496
19507
|
// src/components/JournalEntryDetails/JournalEntryDetails.tsx
|
|
19497
|
-
import { useContext as
|
|
19508
|
+
import { useContext as useContext39, useMemo as useMemo35, useState as useState54 } from "react";
|
|
19498
19509
|
import { jsx as jsx208, jsxs as jsxs130 } from "react/jsx-runtime";
|
|
19499
19510
|
var JournalEntryDetails = () => {
|
|
19500
19511
|
var _a, _b, _c, _d;
|
|
@@ -19506,16 +19517,16 @@ var JournalEntryDetails = () => {
|
|
|
19506
19517
|
selectedEntryId,
|
|
19507
19518
|
reverseEntry,
|
|
19508
19519
|
refetch
|
|
19509
|
-
} =
|
|
19520
|
+
} = useContext39(JournalContext);
|
|
19510
19521
|
const [reverseEntryProcessing, setReverseEntryProcessing] = useState54(false);
|
|
19511
19522
|
const [reverseEntryError, setReverseEntryError] = useState54();
|
|
19512
|
-
const entry =
|
|
19523
|
+
const entry = useMemo35(() => {
|
|
19513
19524
|
if (selectedEntryId && data) {
|
|
19514
19525
|
return data.find((x) => x.id === selectedEntryId);
|
|
19515
19526
|
}
|
|
19516
19527
|
return;
|
|
19517
19528
|
}, [data, selectedEntryId]);
|
|
19518
|
-
const sortedLineItems =
|
|
19529
|
+
const sortedLineItems = useMemo35(
|
|
19519
19530
|
() => {
|
|
19520
19531
|
var _a2;
|
|
19521
19532
|
return (_a2 = entry == null ? void 0 : entry.line_items) == null ? void 0 : _a2.sort(
|
|
@@ -19693,11 +19704,60 @@ var JournalEntryDetails = () => {
|
|
|
19693
19704
|
};
|
|
19694
19705
|
|
|
19695
19706
|
// src/components/JournalForm/JournalForm.tsx
|
|
19696
|
-
import { useContext as
|
|
19707
|
+
import { useContext as useContext41 } from "react";
|
|
19697
19708
|
|
|
19698
19709
|
// src/components/JournalForm/JournalFormEntryLines.tsx
|
|
19699
|
-
import { useContext as
|
|
19700
|
-
|
|
19710
|
+
import { useContext as useContext40, useMemo as useMemo36 } from "react";
|
|
19711
|
+
|
|
19712
|
+
// src/hooks/categories/useAllCategories.ts
|
|
19713
|
+
import useSWR11 from "swr";
|
|
19714
|
+
function buildKey7({
|
|
19715
|
+
access_token: accessToken,
|
|
19716
|
+
apiUrl,
|
|
19717
|
+
businessId
|
|
19718
|
+
}) {
|
|
19719
|
+
if (accessToken && apiUrl) {
|
|
19720
|
+
return {
|
|
19721
|
+
accessToken,
|
|
19722
|
+
apiUrl,
|
|
19723
|
+
businessId,
|
|
19724
|
+
mode: "ALL",
|
|
19725
|
+
tags: ["#categories"]
|
|
19726
|
+
};
|
|
19727
|
+
}
|
|
19728
|
+
}
|
|
19729
|
+
function useAllCategories() {
|
|
19730
|
+
const { data: auth } = useAuth();
|
|
19731
|
+
const { businessId } = useLayerContext();
|
|
19732
|
+
return useSWR11(
|
|
19733
|
+
() => buildKey7(__spreadProps(__spreadValues({}, auth), {
|
|
19734
|
+
businessId
|
|
19735
|
+
})),
|
|
19736
|
+
({ accessToken, apiUrl, businessId: businessId2, mode }) => getCategories(
|
|
19737
|
+
apiUrl,
|
|
19738
|
+
accessToken,
|
|
19739
|
+
{
|
|
19740
|
+
params: {
|
|
19741
|
+
businessId: businessId2,
|
|
19742
|
+
mode
|
|
19743
|
+
}
|
|
19744
|
+
}
|
|
19745
|
+
)().then(({ data }) => data.categories)
|
|
19746
|
+
);
|
|
19747
|
+
}
|
|
19748
|
+
|
|
19749
|
+
// src/components/JournalForm/JournalFormEntryLines.tsx
|
|
19750
|
+
import { Fragment as Fragment33, jsx as jsx209, jsxs as jsxs131 } from "react/jsx-runtime";
|
|
19751
|
+
function recursiveFlattenCategories(accounts) {
|
|
19752
|
+
const flattenedResult = accounts.flatMap((a) => {
|
|
19753
|
+
var _a;
|
|
19754
|
+
return [
|
|
19755
|
+
a,
|
|
19756
|
+
recursiveFlattenCategories((_a = a.subCategories) != null ? _a : [])
|
|
19757
|
+
];
|
|
19758
|
+
}).flat();
|
|
19759
|
+
return flattenedResult;
|
|
19760
|
+
}
|
|
19701
19761
|
var JournalFormEntryLines = ({
|
|
19702
19762
|
entrylineItems,
|
|
19703
19763
|
addEntryLine,
|
|
@@ -19706,10 +19766,83 @@ var JournalFormEntryLines = ({
|
|
|
19706
19766
|
sendingForm,
|
|
19707
19767
|
config
|
|
19708
19768
|
}) => {
|
|
19709
|
-
const { data
|
|
19710
|
-
const { form } =
|
|
19711
|
-
const parentOptions =
|
|
19712
|
-
|
|
19769
|
+
const { data } = useAllCategories();
|
|
19770
|
+
const { form } = useContext40(JournalContext);
|
|
19771
|
+
const { flattenedCategories, parentOptions } = useMemo36(() => {
|
|
19772
|
+
const flattenedCategories2 = recursiveFlattenCategories(data != null ? data : []);
|
|
19773
|
+
const parentOptions2 = [...flattenedCategories2].sort((a, b) => a.display_name.localeCompare(b.display_name)).map((account) => {
|
|
19774
|
+
switch (account.type) {
|
|
19775
|
+
case "AccountNested":
|
|
19776
|
+
return {
|
|
19777
|
+
label: account.display_name,
|
|
19778
|
+
value: account.id
|
|
19779
|
+
};
|
|
19780
|
+
case "OptionalAccountNested":
|
|
19781
|
+
return {
|
|
19782
|
+
label: account.display_name,
|
|
19783
|
+
value: account.stable_name
|
|
19784
|
+
};
|
|
19785
|
+
case "ExclusionNested":
|
|
19786
|
+
return {
|
|
19787
|
+
label: account.display_name,
|
|
19788
|
+
value: account.id
|
|
19789
|
+
};
|
|
19790
|
+
default:
|
|
19791
|
+
safeAssertUnreachable(account, "Unexpected account type");
|
|
19792
|
+
}
|
|
19793
|
+
});
|
|
19794
|
+
return { flattenedCategories: flattenedCategories2, parentOptions: parentOptions2 };
|
|
19795
|
+
}, [data]);
|
|
19796
|
+
const handleChangeParent = ({
|
|
19797
|
+
lineItemIndex,
|
|
19798
|
+
value
|
|
19799
|
+
}) => {
|
|
19800
|
+
var _a;
|
|
19801
|
+
const relevantCategory = flattenedCategories.find((x) => {
|
|
19802
|
+
switch (x.type) {
|
|
19803
|
+
case "AccountNested":
|
|
19804
|
+
return x.id === value.value;
|
|
19805
|
+
case "OptionalAccountNested":
|
|
19806
|
+
return x.stable_name === value.value;
|
|
19807
|
+
case "ExclusionNested":
|
|
19808
|
+
return x.id === value.value;
|
|
19809
|
+
default:
|
|
19810
|
+
safeAssertUnreachable(x, "Unexpected account type");
|
|
19811
|
+
}
|
|
19812
|
+
});
|
|
19813
|
+
if (!relevantCategory) {
|
|
19814
|
+
return;
|
|
19815
|
+
}
|
|
19816
|
+
const baseFields = relevantCategory.type === "OptionalAccountNested" ? {
|
|
19817
|
+
id: relevantCategory.stable_name,
|
|
19818
|
+
stable_name: relevantCategory.stable_name,
|
|
19819
|
+
account_type: {
|
|
19820
|
+
value: relevantCategory.stable_name,
|
|
19821
|
+
display_name: relevantCategory.display_name
|
|
19822
|
+
}
|
|
19823
|
+
} : {
|
|
19824
|
+
id: relevantCategory.id,
|
|
19825
|
+
stable_name: "stable_name" in relevantCategory ? (_a = relevantCategory.stable_name) != null ? _a : "" : "",
|
|
19826
|
+
account_type: {
|
|
19827
|
+
value: relevantCategory.id,
|
|
19828
|
+
display_name: relevantCategory.display_name
|
|
19829
|
+
}
|
|
19830
|
+
};
|
|
19831
|
+
return changeFormData(
|
|
19832
|
+
"parent",
|
|
19833
|
+
value,
|
|
19834
|
+
lineItemIndex,
|
|
19835
|
+
[
|
|
19836
|
+
__spreadProps(__spreadValues({}, baseFields), {
|
|
19837
|
+
name: relevantCategory.display_name,
|
|
19838
|
+
sub_accounts: [],
|
|
19839
|
+
balance: 0,
|
|
19840
|
+
normality: "DEBIT" /* DEBIT */
|
|
19841
|
+
})
|
|
19842
|
+
]
|
|
19843
|
+
);
|
|
19844
|
+
};
|
|
19845
|
+
return /* @__PURE__ */ jsx209(Fragment33, { children: ["DEBIT", "CREDIT"].map((direction, idx) => {
|
|
19713
19846
|
return /* @__PURE__ */ jsxs131(
|
|
19714
19847
|
"div",
|
|
19715
19848
|
{
|
|
@@ -19721,9 +19854,11 @@ var JournalFormEntryLines = ({
|
|
|
19721
19854
|
className: "Layer__journal__form__input-group__title",
|
|
19722
19855
|
size: "lg" /* lg */,
|
|
19723
19856
|
children: [
|
|
19724
|
-
"Add
|
|
19857
|
+
"Add",
|
|
19858
|
+
" ",
|
|
19725
19859
|
humanizeEnum(direction),
|
|
19726
|
-
"
|
|
19860
|
+
" ",
|
|
19861
|
+
"Account"
|
|
19727
19862
|
]
|
|
19728
19863
|
}
|
|
19729
19864
|
),
|
|
@@ -19778,12 +19913,10 @@ var JournalFormEntryLines = ({
|
|
|
19778
19913
|
value: item.account_identifier.id,
|
|
19779
19914
|
label: item.account_identifier.name
|
|
19780
19915
|
},
|
|
19781
|
-
onChange: (
|
|
19782
|
-
|
|
19783
|
-
|
|
19784
|
-
|
|
19785
|
-
accountsData == null ? void 0 : accountsData.accounts
|
|
19786
|
-
),
|
|
19916
|
+
onChange: (value) => handleChangeParent({
|
|
19917
|
+
lineItemIndex: idx2,
|
|
19918
|
+
value
|
|
19919
|
+
}),
|
|
19787
19920
|
isInvalid: Boolean(
|
|
19788
19921
|
(_d = form == null ? void 0 : form.errors) == null ? void 0 : _d.lineItems.find(
|
|
19789
19922
|
(x) => x.id === idx2 && x.field === "account"
|
|
@@ -19841,7 +19974,7 @@ var JournalForm = ({
|
|
|
19841
19974
|
changeFormData,
|
|
19842
19975
|
addEntryLine,
|
|
19843
19976
|
removeEntryLine
|
|
19844
|
-
} =
|
|
19977
|
+
} = useContext41(JournalContext);
|
|
19845
19978
|
return /* @__PURE__ */ jsxs132(
|
|
19846
19979
|
"form",
|
|
19847
19980
|
{
|
|
@@ -19989,7 +20122,7 @@ var JournalSidebar = ({
|
|
|
19989
20122
|
config,
|
|
19990
20123
|
stringOverrides
|
|
19991
20124
|
}) => {
|
|
19992
|
-
const { selectedEntryId } =
|
|
20125
|
+
const { selectedEntryId } = useContext42(JournalContext);
|
|
19993
20126
|
if (selectedEntryId !== "new") {
|
|
19994
20127
|
return /* @__PURE__ */ jsx211(JournalEntryDetails, {});
|
|
19995
20128
|
}
|
|
@@ -19997,7 +20130,7 @@ var JournalSidebar = ({
|
|
|
19997
20130
|
};
|
|
19998
20131
|
|
|
19999
20132
|
// src/components/JournalTable/JournalTable.tsx
|
|
20000
|
-
import
|
|
20133
|
+
import { Fragment as Fragment34, useContext as useContext43, useEffect as useEffect43 } from "react";
|
|
20001
20134
|
import { parseISO as parseISO14, format as formatTime12 } from "date-fns";
|
|
20002
20135
|
import { jsx as jsx212, jsxs as jsxs133 } from "react/jsx-runtime";
|
|
20003
20136
|
var accountName = (row) => {
|
|
@@ -20025,7 +20158,7 @@ var JournalTableContent = ({
|
|
|
20025
20158
|
data,
|
|
20026
20159
|
stringOverrides
|
|
20027
20160
|
}) => {
|
|
20028
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } =
|
|
20161
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext43(JournalContext);
|
|
20029
20162
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
20030
20163
|
useEffect43(() => {
|
|
20031
20164
|
if (data.length > 0) {
|
|
@@ -20035,7 +20168,7 @@ var JournalTableContent = ({
|
|
|
20035
20168
|
const renderJournalRow = (row, index, rowKey, depth) => {
|
|
20036
20169
|
const expandable = !!row.line_items && row.line_items.length > 0;
|
|
20037
20170
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
20038
|
-
return /* @__PURE__ */ jsxs133(
|
|
20171
|
+
return /* @__PURE__ */ jsxs133(Fragment34, { children: [
|
|
20039
20172
|
/* @__PURE__ */ jsxs133(
|
|
20040
20173
|
TableRow,
|
|
20041
20174
|
{
|
|
@@ -20117,7 +20250,7 @@ var JournalTableContent = ({
|
|
|
20117
20250
|
|
|
20118
20251
|
// src/components/Journal/download/useJournalEntriesDownload.ts
|
|
20119
20252
|
import useSWRMutation6 from "swr/mutation";
|
|
20120
|
-
function
|
|
20253
|
+
function buildKey8({
|
|
20121
20254
|
access_token: accessToken,
|
|
20122
20255
|
apiUrl,
|
|
20123
20256
|
businessId,
|
|
@@ -20143,7 +20276,7 @@ function useJournalEntriesDownload({
|
|
|
20143
20276
|
const { data: auth } = useAuth();
|
|
20144
20277
|
const { businessId } = useLayerContext();
|
|
20145
20278
|
return useSWRMutation6(
|
|
20146
|
-
() =>
|
|
20279
|
+
() => buildKey8(__spreadProps(__spreadValues({}, auth), {
|
|
20147
20280
|
businessId,
|
|
20148
20281
|
startCutoff,
|
|
20149
20282
|
endCutoff
|
|
@@ -20171,7 +20304,7 @@ function useJournalEntriesDownload({
|
|
|
20171
20304
|
}
|
|
20172
20305
|
|
|
20173
20306
|
// src/components/Journal/download/JournalEntriesDownloadButton.tsx
|
|
20174
|
-
import { Fragment as
|
|
20307
|
+
import { Fragment as Fragment35, jsx as jsx213, jsxs as jsxs134 } from "react/jsx-runtime";
|
|
20175
20308
|
function JournalEntriesDownloadButton({
|
|
20176
20309
|
startCutoff,
|
|
20177
20310
|
endCutoff,
|
|
@@ -20183,7 +20316,7 @@ function JournalEntriesDownloadButton({
|
|
|
20183
20316
|
endCutoff,
|
|
20184
20317
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
20185
20318
|
});
|
|
20186
|
-
return /* @__PURE__ */ jsxs134(
|
|
20319
|
+
return /* @__PURE__ */ jsxs134(Fragment35, { children: [
|
|
20187
20320
|
/* @__PURE__ */ jsx213(
|
|
20188
20321
|
DownloadButton,
|
|
20189
20322
|
{
|
|
@@ -20220,8 +20353,8 @@ var JournalTableWithPanel = ({
|
|
|
20220
20353
|
refetch,
|
|
20221
20354
|
selectedEntryId,
|
|
20222
20355
|
addEntry
|
|
20223
|
-
} =
|
|
20224
|
-
const data =
|
|
20356
|
+
} = useContext44(JournalContext);
|
|
20357
|
+
const data = useMemo37(() => {
|
|
20225
20358
|
var _a;
|
|
20226
20359
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
20227
20360
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
@@ -20351,17 +20484,17 @@ var JournalContent = ({
|
|
|
20351
20484
|
|
|
20352
20485
|
// src/components/Tasks/Tasks.tsx
|
|
20353
20486
|
import {
|
|
20354
|
-
createContext as
|
|
20355
|
-
useContext as
|
|
20487
|
+
createContext as createContext22,
|
|
20488
|
+
useContext as useContext49,
|
|
20356
20489
|
useEffect as useEffect46,
|
|
20357
|
-
useMemo as
|
|
20490
|
+
useMemo as useMemo43,
|
|
20358
20491
|
useState as useState59
|
|
20359
20492
|
} from "react";
|
|
20360
20493
|
|
|
20361
20494
|
// src/contexts/TasksContext/TasksContext.tsx
|
|
20362
|
-
import { createContext as
|
|
20495
|
+
import { createContext as createContext21 } from "react";
|
|
20363
20496
|
import { endOfYear as endOfYear4, startOfYear as startOfYear4 } from "date-fns";
|
|
20364
|
-
var TasksContext =
|
|
20497
|
+
var TasksContext = createContext21({
|
|
20365
20498
|
data: void 0,
|
|
20366
20499
|
isLoading: false,
|
|
20367
20500
|
loadedStatus: "initial",
|
|
@@ -20384,7 +20517,7 @@ var TasksContext = createContext20({
|
|
|
20384
20517
|
});
|
|
20385
20518
|
|
|
20386
20519
|
// src/hooks/useTasks/useTasks.tsx
|
|
20387
|
-
import { useEffect as useEffect44, useMemo as
|
|
20520
|
+
import { useEffect as useEffect44, useMemo as useMemo38, useState as useState56 } from "react";
|
|
20388
20521
|
|
|
20389
20522
|
// src/types/tasks.ts
|
|
20390
20523
|
var COMPLETED_TASK_TYPES = ["COMPLETED", "USER_MARKED_COMPLETED"];
|
|
@@ -20433,7 +20566,7 @@ var mockData = [
|
|
|
20433
20566
|
];
|
|
20434
20567
|
|
|
20435
20568
|
// src/hooks/useTasks/useTasks.tsx
|
|
20436
|
-
import
|
|
20569
|
+
import useSWR12 from "swr";
|
|
20437
20570
|
import { endOfYear as endOfYear5, formatISO as formatISO3, getMonth as getMonth2, getYear as getYear2, parseISO as parseISO15, startOfYear as startOfYear5 } from "date-fns";
|
|
20438
20571
|
var DEBUG_MODE = false;
|
|
20439
20572
|
var useTasks = ({
|
|
@@ -20450,7 +20583,7 @@ var useTasks = ({
|
|
|
20450
20583
|
});
|
|
20451
20584
|
const [currentDate, setCurrentDate] = useState56(/* @__PURE__ */ new Date());
|
|
20452
20585
|
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `tasks-${businessId}-${dateRange.startDate}-${dateRange.endDate}`;
|
|
20453
|
-
const { data, isLoading, isValidating, error, mutate } =
|
|
20586
|
+
const { data, isLoading, isValidating, error, mutate } = useSWR12(
|
|
20454
20587
|
queryKey,
|
|
20455
20588
|
Layer.getTasks(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
20456
20589
|
params: {
|
|
@@ -20460,7 +20593,7 @@ var useTasks = ({
|
|
|
20460
20593
|
}
|
|
20461
20594
|
})
|
|
20462
20595
|
);
|
|
20463
|
-
const monthlyData =
|
|
20596
|
+
const monthlyData = useMemo38(() => {
|
|
20464
20597
|
if (data == null ? void 0 : data.data) {
|
|
20465
20598
|
const grouped = data.data.reduce((acc, task) => {
|
|
20466
20599
|
const effectiveDate = task.effective_date ? parseISO15(task.effective_date) : parseISO15(task.created_at);
|
|
@@ -20564,7 +20697,7 @@ var useTasks = ({
|
|
|
20564
20697
|
};
|
|
20565
20698
|
|
|
20566
20699
|
// src/components/TasksHeader/TasksHeader.tsx
|
|
20567
|
-
import { useContext as
|
|
20700
|
+
import { useContext as useContext45 } from "react";
|
|
20568
20701
|
|
|
20569
20702
|
// src/icons/ProgressIcon.tsx
|
|
20570
20703
|
import { jsx as jsx216, jsxs as jsxs136 } from "react/jsx-runtime";
|
|
@@ -20697,7 +20830,7 @@ var TasksHeader = ({
|
|
|
20697
20830
|
error,
|
|
20698
20831
|
dateRange,
|
|
20699
20832
|
setDateRange
|
|
20700
|
-
} =
|
|
20833
|
+
} = useContext45(TasksContext);
|
|
20701
20834
|
const { business } = useLayerContext();
|
|
20702
20835
|
const completedTasks = tasks == null ? void 0 : tasks.filter((task) => isComplete(task.status)).length;
|
|
20703
20836
|
const badgeVariant = completedTasks === (tasks == null ? void 0 : tasks.length) ? ICONS.done : ICONS.pending;
|
|
@@ -20743,7 +20876,7 @@ var TasksHeader = ({
|
|
|
20743
20876
|
};
|
|
20744
20877
|
|
|
20745
20878
|
// src/components/TasksList/TasksList.tsx
|
|
20746
|
-
import { useContext as
|
|
20879
|
+
import { useContext as useContext47, useMemo as useMemo40, useState as useState58 } from "react";
|
|
20747
20880
|
|
|
20748
20881
|
// src/icons/SmileIcon.tsx
|
|
20749
20882
|
import { jsx as jsx218, jsxs as jsxs138 } from "react/jsx-runtime";
|
|
@@ -20802,9 +20935,9 @@ var SmileIcon = (_a) => {
|
|
|
20802
20935
|
var SmileIcon_default = SmileIcon;
|
|
20803
20936
|
|
|
20804
20937
|
// src/components/TasksListItem/TasksListItem.tsx
|
|
20805
|
-
import { useContext as
|
|
20938
|
+
import { useContext as useContext46, useEffect as useEffect45, useMemo as useMemo39, useState as useState57 } from "react";
|
|
20806
20939
|
import classNames69 from "classnames";
|
|
20807
|
-
import { Fragment as
|
|
20940
|
+
import { Fragment as Fragment36, jsx as jsx219, jsxs as jsxs139 } from "react/jsx-runtime";
|
|
20808
20941
|
var TasksListItem = ({
|
|
20809
20942
|
task,
|
|
20810
20943
|
goToNextPageIfAllComplete,
|
|
@@ -20819,7 +20952,7 @@ var TasksListItem = ({
|
|
|
20819
20952
|
uploadDocumentsForTask,
|
|
20820
20953
|
deleteUploadsForTask,
|
|
20821
20954
|
updateDocUploadTaskDescription
|
|
20822
|
-
} =
|
|
20955
|
+
} = useContext46(TasksContext);
|
|
20823
20956
|
const taskBodyClassName = classNames69(
|
|
20824
20957
|
"Layer__tasks-list-item__body",
|
|
20825
20958
|
isOpen && "Layer__tasks-list-item__body--expanded",
|
|
@@ -20836,7 +20969,7 @@ var TasksListItem = ({
|
|
|
20836
20969
|
useEffect45(() => {
|
|
20837
20970
|
setIsOpen(defaultOpen);
|
|
20838
20971
|
}, [defaultOpen]);
|
|
20839
|
-
const uploadDocumentAction =
|
|
20972
|
+
const uploadDocumentAction = useMemo39(() => {
|
|
20840
20973
|
if (task.user_response_type === "UPLOAD_DOCUMENT") {
|
|
20841
20974
|
if (task.status === "TODO") {
|
|
20842
20975
|
if (!selectedFiles) {
|
|
@@ -20851,7 +20984,7 @@ var TasksListItem = ({
|
|
|
20851
20984
|
}
|
|
20852
20985
|
);
|
|
20853
20986
|
} else {
|
|
20854
|
-
return /* @__PURE__ */ jsxs139(
|
|
20987
|
+
return /* @__PURE__ */ jsxs139(Fragment36, { children: [
|
|
20855
20988
|
/* @__PURE__ */ jsx219(
|
|
20856
20989
|
Button,
|
|
20857
20990
|
{
|
|
@@ -20966,7 +21099,7 @@ var TasksListItem = ({
|
|
|
20966
21099
|
|
|
20967
21100
|
// src/components/TasksList/TasksList.tsx
|
|
20968
21101
|
import { endOfMonth as endOfMonth14, isAfter, isBefore, parseISO as parseISO16, startOfMonth as startOfMonth16 } from "date-fns";
|
|
20969
|
-
import { Fragment as
|
|
21102
|
+
import { Fragment as Fragment37, jsx as jsx220, jsxs as jsxs140 } from "react/jsx-runtime";
|
|
20970
21103
|
function paginateArray(array, chunkSize = 10) {
|
|
20971
21104
|
const result = [];
|
|
20972
21105
|
for (let i = 0; i < array.length; i += chunkSize) {
|
|
@@ -20984,8 +21117,8 @@ var TasksEmptyState = () => /* @__PURE__ */ jsxs140("div", { className: "Layer__
|
|
|
20984
21117
|
] })
|
|
20985
21118
|
] });
|
|
20986
21119
|
var TasksList = ({ pageSize = 10 }) => {
|
|
20987
|
-
const { data: rawData, error, currentDate } =
|
|
20988
|
-
const tasks =
|
|
21120
|
+
const { data: rawData, error, currentDate } = useContext47(TasksContext);
|
|
21121
|
+
const tasks = useMemo40(() => {
|
|
20989
21122
|
return rawData == null ? void 0 : rawData.filter((x) => {
|
|
20990
21123
|
const d = x.effective_date ? parseISO16(x.effective_date) : parseISO16(x.created_at);
|
|
20991
21124
|
return !isBefore(d, startOfMonth16(currentDate)) && !isAfter(d, endOfMonth14(currentDate));
|
|
@@ -20998,7 +21131,7 @@ var TasksList = ({ pageSize = 10 }) => {
|
|
|
20998
21131
|
const [currentPage, setCurrentPage] = useState58(
|
|
20999
21132
|
firstPageWithIincompleteTasks === -1 ? 1 : firstPageWithIincompleteTasks + 1
|
|
21000
21133
|
);
|
|
21001
|
-
const sortedTasks =
|
|
21134
|
+
const sortedTasks = useMemo40(() => {
|
|
21002
21135
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
21003
21136
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
21004
21137
|
return tasks == null ? void 0 : tasks.sort((x) => isComplete(x.status) ? 1 : -1).slice(firstPageIndex, lastPageIndex);
|
|
@@ -21013,7 +21146,7 @@ var TasksList = ({ pageSize = 10 }) => {
|
|
|
21013
21146
|
setCurrentPage(currentPage + 1);
|
|
21014
21147
|
}
|
|
21015
21148
|
};
|
|
21016
|
-
return /* @__PURE__ */ jsx220("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs140(
|
|
21149
|
+
return /* @__PURE__ */ jsx220("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs140(Fragment37, { children: [
|
|
21017
21150
|
sortedTasks.map((task, index) => /* @__PURE__ */ jsx220(
|
|
21018
21151
|
TasksListItem,
|
|
21019
21152
|
{
|
|
@@ -21032,18 +21165,18 @@ var TasksList = ({ pageSize = 10 }) => {
|
|
|
21032
21165
|
onPageChange: (page) => setCurrentPage(page)
|
|
21033
21166
|
}
|
|
21034
21167
|
) })
|
|
21035
|
-
] }) : /* @__PURE__ */ jsx220(
|
|
21168
|
+
] }) : /* @__PURE__ */ jsx220(Fragment37, { children: error ? /* @__PURE__ */ jsx220(ErrorText, { children: "Approval failed. Check connection and retry in few seconds." }) : /* @__PURE__ */ jsx220(TasksEmptyState, {}) }) });
|
|
21036
21169
|
};
|
|
21037
21170
|
|
|
21038
21171
|
// src/components/TasksPending/TasksPending.tsx
|
|
21039
|
-
import { useContext as
|
|
21172
|
+
import { useContext as useContext48, useMemo as useMemo41 } from "react";
|
|
21040
21173
|
import classNames70 from "classnames";
|
|
21041
21174
|
import { endOfMonth as endOfMonth15, format as format6, isAfter as isAfter2, isBefore as isBefore2, parseISO as parseISO17, startOfMonth as startOfMonth17 } from "date-fns";
|
|
21042
21175
|
import { Cell as Cell4, Pie as Pie3, PieChart as PieChart4 } from "recharts";
|
|
21043
21176
|
import { jsx as jsx221, jsxs as jsxs141 } from "react/jsx-runtime";
|
|
21044
21177
|
var TasksPending = () => {
|
|
21045
|
-
const { data: rawData, currentDate } =
|
|
21046
|
-
const data =
|
|
21178
|
+
const { data: rawData, currentDate } = useContext48(TasksContext);
|
|
21179
|
+
const data = useMemo41(() => {
|
|
21047
21180
|
return rawData == null ? void 0 : rawData.filter((x) => {
|
|
21048
21181
|
const d = x.effective_date ? parseISO17(x.effective_date) : parseISO17(x.created_at);
|
|
21049
21182
|
return !isBefore2(d, startOfMonth17(currentDate)) && !isAfter2(d, endOfMonth15(currentDate));
|
|
@@ -21105,7 +21238,7 @@ var TasksPending = () => {
|
|
|
21105
21238
|
};
|
|
21106
21239
|
|
|
21107
21240
|
// src/components/TasksMonthSelector/TasksMonthSelector.tsx
|
|
21108
|
-
import { useMemo as
|
|
21241
|
+
import { useMemo as useMemo42 } from "react";
|
|
21109
21242
|
import { endOfMonth as endOfMonth16, format as format7, getMonth as getMonth3, getYear as getYear4, isAfter as isAfter3, isBefore as isBefore3, set, startOfMonth as startOfMonth18 } from "date-fns";
|
|
21110
21243
|
|
|
21111
21244
|
// src/components/TasksMonthSelector/TaskMonthTile.tsx
|
|
@@ -21140,7 +21273,7 @@ var DEFAULT_TASK_DATA = {
|
|
|
21140
21273
|
var isCurrentMonth = (monthDate, currentDate) => getMonth3(currentDate) === getMonth3(monthDate) && getYear4(currentDate) === getYear4(monthDate);
|
|
21141
21274
|
var TasksMonthSelector = ({ tasks, year, currentDate, onClick }) => {
|
|
21142
21275
|
const { business } = useLayerContext();
|
|
21143
|
-
const minDate =
|
|
21276
|
+
const minDate = useMemo42(() => {
|
|
21144
21277
|
if (business) {
|
|
21145
21278
|
const date = getEarliestDateToBrowse(business);
|
|
21146
21279
|
if (date) {
|
|
@@ -21149,7 +21282,7 @@ var TasksMonthSelector = ({ tasks, year, currentDate, onClick }) => {
|
|
|
21149
21282
|
}
|
|
21150
21283
|
return;
|
|
21151
21284
|
}, [business]);
|
|
21152
|
-
const months =
|
|
21285
|
+
const months = useMemo42(() => {
|
|
21153
21286
|
return Array.from({ length: 12 }, (_, i) => {
|
|
21154
21287
|
var _a;
|
|
21155
21288
|
const startDate = set(
|
|
@@ -21190,8 +21323,8 @@ var TasksMonthSelector = ({ tasks, year, currentDate, onClick }) => {
|
|
|
21190
21323
|
// src/components/Tasks/Tasks.tsx
|
|
21191
21324
|
import classNames72 from "classnames";
|
|
21192
21325
|
import { endOfYear as endOfYear7, getYear as getYear5, startOfYear as startOfYear7 } from "date-fns";
|
|
21193
|
-
import { Fragment as
|
|
21194
|
-
var UseTasksContext =
|
|
21326
|
+
import { Fragment as Fragment38, jsx as jsx224, jsxs as jsxs143 } from "react/jsx-runtime";
|
|
21327
|
+
var UseTasksContext = createContext22({
|
|
21195
21328
|
data: void 0,
|
|
21196
21329
|
isLoading: void 0,
|
|
21197
21330
|
loadedStatus: "initial",
|
|
@@ -21252,8 +21385,8 @@ var TasksComponent = ({
|
|
|
21252
21385
|
currentDate,
|
|
21253
21386
|
setCurrentDate,
|
|
21254
21387
|
dateRange
|
|
21255
|
-
} =
|
|
21256
|
-
const allComplete =
|
|
21388
|
+
} = useContext49(TasksContext);
|
|
21389
|
+
const allComplete = useMemo43(() => {
|
|
21257
21390
|
if (!data) {
|
|
21258
21391
|
return void 0;
|
|
21259
21392
|
}
|
|
@@ -21287,7 +21420,7 @@ var TasksComponent = ({
|
|
|
21287
21420
|
"Layer__tasks__content",
|
|
21288
21421
|
!open && "Layer__tasks__content--collapsed"
|
|
21289
21422
|
),
|
|
21290
|
-
children: isLoading || !data ? /* @__PURE__ */ jsx224("div", { className: "Layer__tasks__loader-container", children: /* @__PURE__ */ jsx224(Loader2, {}) }) : /* @__PURE__ */ jsxs143(
|
|
21423
|
+
children: isLoading || !data ? /* @__PURE__ */ jsx224("div", { className: "Layer__tasks__loader-container", children: /* @__PURE__ */ jsx224(Loader2, {}) }) : /* @__PURE__ */ jsxs143(Fragment38, { children: [
|
|
21291
21424
|
/* @__PURE__ */ jsx224(
|
|
21292
21425
|
TasksMonthSelector,
|
|
21293
21426
|
{
|
|
@@ -21306,11 +21439,11 @@ var TasksComponent = ({
|
|
|
21306
21439
|
};
|
|
21307
21440
|
|
|
21308
21441
|
// src/components/PlatformOnboarding/LinkAccounts.tsx
|
|
21309
|
-
import { useContext as
|
|
21442
|
+
import { useContext as useContext50, useMemo as useMemo44 } from "react";
|
|
21310
21443
|
import { jsx as jsx225, jsxs as jsxs144 } from "react/jsx-runtime";
|
|
21311
21444
|
var LinkAccounts = (_a) => {
|
|
21312
21445
|
var _b = _a, { inBox } = _b, props = __objRest(_b, ["inBox"]);
|
|
21313
|
-
const content =
|
|
21446
|
+
const content = useMemo44(() => {
|
|
21314
21447
|
if (inBox) {
|
|
21315
21448
|
return /* @__PURE__ */ jsx225("div", { className: "Layer__link-accounts__box", children: /* @__PURE__ */ jsx225(LinkAccountsContent, __spreadValues({}, props)) });
|
|
21316
21449
|
}
|
|
@@ -21330,7 +21463,7 @@ var LinkAccountsContent = ({
|
|
|
21330
21463
|
onNext
|
|
21331
21464
|
}) => {
|
|
21332
21465
|
var _a;
|
|
21333
|
-
const { data, loadingStatus, error, refetchAccounts, addConnection } =
|
|
21466
|
+
const { data, loadingStatus, error, refetchAccounts, addConnection } = useContext50(LinkedAccountsContext);
|
|
21334
21467
|
return /* @__PURE__ */ jsxs144("div", { className: "Layer__link-accounts Layer__component", children: [
|
|
21335
21468
|
title && /* @__PURE__ */ jsx225(Heading, { size: "view" /* view */, children: title }),
|
|
21336
21469
|
data && data.length === 0 ? /* @__PURE__ */ jsxs144("div", { className: "Layer__link-accounts__data-status-container", children: [
|
|
@@ -21612,7 +21745,7 @@ var BookkeepingOverview = ({
|
|
|
21612
21745
|
import { useState as useState62 } from "react";
|
|
21613
21746
|
|
|
21614
21747
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
21615
|
-
import { useContext as
|
|
21748
|
+
import { useContext as useContext51, useEffect as useEffect47, useState as useState61 } from "react";
|
|
21616
21749
|
|
|
21617
21750
|
// src/components/BadgeLoader/BadgeLoader.tsx
|
|
21618
21751
|
import { jsx as jsx230, jsxs as jsxs148 } from "react/jsx-runtime";
|
|
@@ -21634,7 +21767,7 @@ function TransactionsToReview({
|
|
|
21634
21767
|
variants
|
|
21635
21768
|
}) {
|
|
21636
21769
|
const { size = "sm" } = variants != null ? variants : {};
|
|
21637
|
-
const { dateRange: contextDateRange } =
|
|
21770
|
+
const { dateRange: contextDateRange } = useContext51(ProfitAndLoss.Context);
|
|
21638
21771
|
const dateRange = usePnlDateRange ? contextDateRange : void 0;
|
|
21639
21772
|
const [toReview, setToReview] = useState61(0);
|
|
21640
21773
|
const { data, loaded, error, refetch } = useProfitAndLossLTM({
|
|
@@ -21956,7 +22089,7 @@ var GeneralLedgerView = ({
|
|
|
21956
22089
|
// src/views/ProjectProfitability/ProjectProfitability.tsx
|
|
21957
22090
|
import { useState as useState64 } from "react";
|
|
21958
22091
|
import Select4 from "react-select";
|
|
21959
|
-
import { Fragment as
|
|
22092
|
+
import { Fragment as Fragment39, jsx as jsx235, jsxs as jsxs153 } from "react/jsx-runtime";
|
|
21960
22093
|
var ProjectProfitabilityView = ({
|
|
21961
22094
|
valueOptions,
|
|
21962
22095
|
showTitle,
|
|
@@ -22029,7 +22162,7 @@ var ProjectProfitabilityView = ({
|
|
|
22029
22162
|
}
|
|
22030
22163
|
)
|
|
22031
22164
|
] }),
|
|
22032
|
-
/* @__PURE__ */ jsx235(Container, { name: "project", children: /* @__PURE__ */ jsxs153(
|
|
22165
|
+
/* @__PURE__ */ jsx235(Container, { name: "project", children: /* @__PURE__ */ jsxs153(Fragment39, { children: [
|
|
22033
22166
|
activeTab === "overview" && /* @__PURE__ */ jsx235(
|
|
22034
22167
|
AccountingOverview,
|
|
22035
22168
|
{
|
|
@@ -22067,7 +22200,7 @@ var ProjectProfitabilityView = ({
|
|
|
22067
22200
|
|
|
22068
22201
|
// src/views/Reports/Reports.tsx
|
|
22069
22202
|
import { useState as useState65 } from "react";
|
|
22070
|
-
import { Fragment as
|
|
22203
|
+
import { Fragment as Fragment40, jsx as jsx236, jsxs as jsxs154 } from "react/jsx-runtime";
|
|
22071
22204
|
var getOptions = (enabledReports) => {
|
|
22072
22205
|
return [
|
|
22073
22206
|
enabledReports.includes("profitAndLoss") ? {
|
|
@@ -22138,7 +22271,7 @@ var ReportsPanel = ({
|
|
|
22138
22271
|
statementOfCashFlowConfig,
|
|
22139
22272
|
view
|
|
22140
22273
|
}) => {
|
|
22141
|
-
return /* @__PURE__ */ jsxs154(
|
|
22274
|
+
return /* @__PURE__ */ jsxs154(Fragment40, { children: [
|
|
22142
22275
|
openReport === "profitAndLoss" && /* @__PURE__ */ jsx236(
|
|
22143
22276
|
ProfitAndLoss.Report,
|
|
22144
22277
|
__spreadValues({
|
|
@@ -22159,8 +22292,8 @@ var ReportsPanel = ({
|
|
|
22159
22292
|
};
|
|
22160
22293
|
|
|
22161
22294
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
22162
|
-
import { useContext as
|
|
22163
|
-
import { Fragment as
|
|
22295
|
+
import { useContext as useContext52, useRef as useRef23 } from "react";
|
|
22296
|
+
import { Fragment as Fragment41, jsx as jsx237, jsxs as jsxs155 } from "react/jsx-runtime";
|
|
22164
22297
|
var COMPONENT_NAME7 = "profit-and-loss";
|
|
22165
22298
|
var ProfitAndLossView = (props) => {
|
|
22166
22299
|
const containerRef = useRef23(null);
|
|
@@ -22174,7 +22307,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
22174
22307
|
"containerRef",
|
|
22175
22308
|
"stringOverrides"
|
|
22176
22309
|
]);
|
|
22177
|
-
const { sidebarScope } =
|
|
22310
|
+
const { sidebarScope } = useContext52(ProfitAndLoss.Context);
|
|
22178
22311
|
return /* @__PURE__ */ jsxs155(
|
|
22179
22312
|
Panel,
|
|
22180
22313
|
{
|
|
@@ -22205,7 +22338,7 @@ var Components = ({
|
|
|
22205
22338
|
hideTable = false,
|
|
22206
22339
|
stringOverrides
|
|
22207
22340
|
}) => {
|
|
22208
|
-
const { error, isLoading, isValidating, refetch } =
|
|
22341
|
+
const { error, isLoading, isValidating, refetch } = useContext52(
|
|
22209
22342
|
ProfitAndLoss.Context
|
|
22210
22343
|
);
|
|
22211
22344
|
if (!isLoading && error) {
|
|
@@ -22220,7 +22353,7 @@ var Components = ({
|
|
|
22220
22353
|
}
|
|
22221
22354
|
) });
|
|
22222
22355
|
}
|
|
22223
|
-
return /* @__PURE__ */ jsxs155(
|
|
22356
|
+
return /* @__PURE__ */ jsxs155(Fragment41, { children: [
|
|
22224
22357
|
!hideChart && /* @__PURE__ */ jsxs155("div", { className: `Layer__${COMPONENT_NAME7}__chart_with_summaries`, children: [
|
|
22225
22358
|
/* @__PURE__ */ jsxs155(
|
|
22226
22359
|
"div",
|