@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/cjs/index.cjs
CHANGED
|
@@ -119,7 +119,7 @@ var import_react16 = require("react");
|
|
|
119
119
|
var import_react14 = require("react");
|
|
120
120
|
|
|
121
121
|
// package.json
|
|
122
|
-
var version = "0.1.
|
|
122
|
+
var version = "0.1.88-alpha.1";
|
|
123
123
|
|
|
124
124
|
// src/models/APIError.ts
|
|
125
125
|
var APIError = class _APIError extends Error {
|
|
@@ -341,7 +341,10 @@ var uploadBankTransactionDocument = (baseUrl, accessToken) => ({
|
|
|
341
341
|
var getBusiness = get(({ businessId }) => `/v1/businesses/${businessId}`);
|
|
342
342
|
|
|
343
343
|
// src/api/layer/categories.ts
|
|
344
|
-
var getCategories = get(({ businessId }) =>
|
|
344
|
+
var getCategories = get(({ businessId, mode }) => {
|
|
345
|
+
const parameters = toDefinedSearchParameters({ mode });
|
|
346
|
+
return `/v1/businesses/${businessId}/categories?${parameters}`;
|
|
347
|
+
});
|
|
345
348
|
|
|
346
349
|
// src/api/layer/chart_of_accounts.ts
|
|
347
350
|
var getChartOfAccounts = get(
|
|
@@ -2464,10 +2467,13 @@ var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
|
2464
2467
|
function startOfNextDay(date) {
|
|
2465
2468
|
return (0, import_date_fns2.startOfDay)((0, import_date_fns2.addDays)(date, 1));
|
|
2466
2469
|
}
|
|
2470
|
+
function clampToPresentOrPast(date, cutoff = (0, import_date_fns2.endOfDay)(/* @__PURE__ */ new Date())) {
|
|
2471
|
+
return (0, import_date_fns2.min)([date, cutoff]);
|
|
2472
|
+
}
|
|
2467
2473
|
function withShiftedEnd(fn) {
|
|
2468
2474
|
return ({ currentStart, currentEnd, newEnd }) => {
|
|
2469
2475
|
const shiftedCurrentEnd = startOfNextDay(currentEnd);
|
|
2470
|
-
const shiftedNewEnd = startOfNextDay(newEnd);
|
|
2476
|
+
const shiftedNewEnd = clampToPresentOrPast(startOfNextDay(newEnd), startOfNextDay(/* @__PURE__ */ new Date()));
|
|
2471
2477
|
return fn({ currentStart, shiftedCurrentEnd, shiftedNewEnd });
|
|
2472
2478
|
};
|
|
2473
2479
|
}
|
|
@@ -2478,14 +2484,14 @@ var RANGE_MODE_LOOKUP = {
|
|
|
2478
2484
|
const fullDayCount = (0, import_date_fns2.differenceInDays)(shiftedCurrentEnd, currentStart);
|
|
2479
2485
|
return (0, import_date_fns2.subDays)(shiftedNewEnd, fullDayCount);
|
|
2480
2486
|
}),
|
|
2481
|
-
getEnd: ({ end }) => end
|
|
2487
|
+
getEnd: ({ end }) => clampToPresentOrPast((0, import_date_fns2.endOfDay)(end))
|
|
2482
2488
|
},
|
|
2483
2489
|
monthPicker: {
|
|
2484
2490
|
getStart: ({ start }) => (0, import_date_fns2.startOfMonth)(start),
|
|
2485
2491
|
getShiftedStart: withShiftedEnd(({ shiftedNewEnd }) => {
|
|
2486
2492
|
return (0, import_date_fns2.subMonths)(shiftedNewEnd, 1);
|
|
2487
2493
|
}),
|
|
2488
|
-
getEnd: ({ end }) => (0, import_date_fns2.endOfMonth)(end)
|
|
2494
|
+
getEnd: ({ end }) => clampToPresentOrPast((0, import_date_fns2.endOfMonth)(end))
|
|
2489
2495
|
},
|
|
2490
2496
|
monthRangePicker: {
|
|
2491
2497
|
getStart: ({ start }) => (0, import_date_fns2.startOfMonth)(start),
|
|
@@ -2493,14 +2499,14 @@ var RANGE_MODE_LOOKUP = {
|
|
|
2493
2499
|
const fullMonthCount = (0, import_date_fns2.differenceInMonths)(shiftedCurrentEnd, currentStart);
|
|
2494
2500
|
return (0, import_date_fns2.subMonths)(shiftedNewEnd, fullMonthCount);
|
|
2495
2501
|
}),
|
|
2496
|
-
getEnd: ({ end }) => (0, import_date_fns2.endOfMonth)(end)
|
|
2502
|
+
getEnd: ({ end }) => clampToPresentOrPast((0, import_date_fns2.endOfMonth)(end))
|
|
2497
2503
|
},
|
|
2498
2504
|
yearPicker: {
|
|
2499
2505
|
getStart: ({ start }) => (0, import_date_fns2.startOfYear)(start),
|
|
2500
2506
|
getShiftedStart: withShiftedEnd(({ shiftedNewEnd }) => {
|
|
2501
2507
|
return (0, import_date_fns2.subYears)(shiftedNewEnd, 1);
|
|
2502
2508
|
}),
|
|
2503
|
-
getEnd: ({ end }) => (0, import_date_fns2.endOfYear)(end)
|
|
2509
|
+
getEnd: ({ end }) => clampToPresentOrPast((0, import_date_fns2.endOfYear)(end))
|
|
2504
2510
|
}
|
|
2505
2511
|
};
|
|
2506
2512
|
function withCorrectedRange(fn) {
|
|
@@ -2517,29 +2523,29 @@ function buildStore() {
|
|
|
2517
2523
|
return (0, import_zustand2.createStore)((set2, get2) => {
|
|
2518
2524
|
const setRange = withCorrectedRange(({ start, end }) => {
|
|
2519
2525
|
set2({
|
|
2520
|
-
start: (
|
|
2521
|
-
end: (
|
|
2526
|
+
start: RANGE_MODE_LOOKUP.dayRangePicker.getStart({ start }),
|
|
2527
|
+
end: RANGE_MODE_LOOKUP.dayRangePicker.getEnd({ end }),
|
|
2522
2528
|
rangeDisplayMode: "dayRangePicker"
|
|
2523
2529
|
});
|
|
2524
2530
|
});
|
|
2525
2531
|
const setMonth = ({ start }) => {
|
|
2526
2532
|
set2({
|
|
2527
|
-
start: (
|
|
2528
|
-
end: (
|
|
2533
|
+
start: RANGE_MODE_LOOKUP.monthPicker.getStart({ start }),
|
|
2534
|
+
end: RANGE_MODE_LOOKUP.monthPicker.getEnd({ end: start }),
|
|
2529
2535
|
rangeDisplayMode: "monthPicker"
|
|
2530
2536
|
});
|
|
2531
2537
|
};
|
|
2532
2538
|
const setMonthRange = withCorrectedRange(({ start, end }) => {
|
|
2533
2539
|
set2({
|
|
2534
|
-
start: (
|
|
2535
|
-
end: (
|
|
2540
|
+
start: RANGE_MODE_LOOKUP.monthRangePicker.getStart({ start }),
|
|
2541
|
+
end: RANGE_MODE_LOOKUP.monthRangePicker.getEnd({ end }),
|
|
2536
2542
|
rangeDisplayMode: "monthRangePicker"
|
|
2537
2543
|
});
|
|
2538
2544
|
});
|
|
2539
2545
|
const setYear = ({ start }) => {
|
|
2540
2546
|
set2({
|
|
2541
|
-
start: (
|
|
2542
|
-
end: (
|
|
2547
|
+
start: RANGE_MODE_LOOKUP.yearPicker.getStart({ start }),
|
|
2548
|
+
end: RANGE_MODE_LOOKUP.yearPicker.getEnd({ end: start }),
|
|
2543
2549
|
rangeDisplayMode: "yearPicker"
|
|
2544
2550
|
});
|
|
2545
2551
|
};
|
|
@@ -2567,7 +2573,7 @@ function buildStore() {
|
|
|
2567
2573
|
};
|
|
2568
2574
|
return {
|
|
2569
2575
|
start: (0, import_date_fns2.startOfMonth)(now),
|
|
2570
|
-
end: (0, import_date_fns2.endOfMonth)(now),
|
|
2576
|
+
end: clampToPresentOrPast((0, import_date_fns2.endOfMonth)(now)),
|
|
2571
2577
|
displayMode: "dayPicker",
|
|
2572
2578
|
rangeDisplayMode: "monthPicker",
|
|
2573
2579
|
actions: {
|
|
@@ -2577,7 +2583,7 @@ function buildStore() {
|
|
|
2577
2583
|
end: currentEnd,
|
|
2578
2584
|
rangeDisplayMode: currentRangeDisplayMode
|
|
2579
2585
|
}) => {
|
|
2580
|
-
const newEnd = (
|
|
2586
|
+
const newEnd = RANGE_MODE_LOOKUP.dayRangePicker.getEnd({ end: date });
|
|
2581
2587
|
return {
|
|
2582
2588
|
start: RANGE_MODE_LOOKUP[currentRangeDisplayMode].getShiftedStart({
|
|
2583
2589
|
currentStart,
|
|
@@ -3214,11 +3220,11 @@ var Loader_default = Loader;
|
|
|
3214
3220
|
var import_react22 = require("react");
|
|
3215
3221
|
|
|
3216
3222
|
// src/components/Tooltip/useTooltip.ts
|
|
3217
|
-
var import_react20 =
|
|
3223
|
+
var import_react20 = require("react");
|
|
3218
3224
|
var import_react21 = require("@floating-ui/react");
|
|
3219
|
-
var TooltipContext = import_react20.
|
|
3225
|
+
var TooltipContext = (0, import_react20.createContext)(null);
|
|
3220
3226
|
var useTooltipContext = () => {
|
|
3221
|
-
const context = import_react20.
|
|
3227
|
+
const context = (0, import_react20.useContext)(TooltipContext);
|
|
3222
3228
|
if (context == null) {
|
|
3223
3229
|
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
3224
3230
|
}
|
|
@@ -3271,7 +3277,7 @@ var useTooltip = ({
|
|
|
3271
3277
|
},
|
|
3272
3278
|
duration: 300
|
|
3273
3279
|
});
|
|
3274
|
-
return import_react20.
|
|
3280
|
+
return (0, import_react20.useMemo)(
|
|
3275
3281
|
() => __spreadValues(__spreadValues({
|
|
3276
3282
|
open,
|
|
3277
3283
|
setOpen,
|
|
@@ -5670,7 +5676,8 @@ function LinkedAccountToConfirm({
|
|
|
5670
5676
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(VStack, { children: [
|
|
5671
5677
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(Heading2, { level: 3, size: "sm", children: account.external_account_name }),
|
|
5672
5678
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsxs)(P, { slot: "mask", children: [
|
|
5673
|
-
"\u2022\u2022\u2022
|
|
5679
|
+
"\u2022\u2022\u2022",
|
|
5680
|
+
" ",
|
|
5674
5681
|
account.mask
|
|
5675
5682
|
] }),
|
|
5676
5683
|
/* @__PURE__ */ (0, import_jsx_runtime72.jsx)(P, { slot: "institution", children: account.institution.name })
|
|
@@ -7669,7 +7676,7 @@ var ActionableList = ({
|
|
|
7669
7676
|
children: [
|
|
7670
7677
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsxs)("div", { className: "Layer__actionable-list__content", children: [
|
|
7671
7678
|
/* @__PURE__ */ (0, import_jsx_runtime97.jsx)(Text, { size: "sm" /* sm */, children: x.label }),
|
|
7672
|
-
/*TODO: Replace 'See all categories' with something more generic*/
|
|
7679
|
+
/* TODO: Replace 'See all categories' with something more generic */
|
|
7673
7680
|
showDescriptions && x.description && x.label !== "See all categories" && /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
7674
7681
|
Text,
|
|
7675
7682
|
{
|
|
@@ -7702,20 +7709,20 @@ var ActionableList = ({
|
|
|
7702
7709
|
|
|
7703
7710
|
// src/components/BankTransactionMobileList/utils.ts
|
|
7704
7711
|
var mapCategoryToOption = (category) => {
|
|
7705
|
-
var _a, _b;
|
|
7712
|
+
var _a, _b, _c;
|
|
7706
7713
|
return {
|
|
7707
7714
|
label: category.display_name,
|
|
7708
|
-
id: category.id,
|
|
7715
|
+
id: "id" in category ? category.id : category.stable_name,
|
|
7709
7716
|
description: (_a = category.description) != null ? _a : void 0,
|
|
7710
7717
|
value: {
|
|
7711
7718
|
type: "CATEGORY",
|
|
7712
7719
|
payload: {
|
|
7713
|
-
id: category.id,
|
|
7720
|
+
id: "id" in category ? category.id : "",
|
|
7714
7721
|
option_type: "category" /* CATEGORY */,
|
|
7715
7722
|
display_name: category.display_name,
|
|
7716
7723
|
type: category.type,
|
|
7717
7724
|
description: (_b = category.description) != null ? _b : void 0,
|
|
7718
|
-
stable_name: category.stable_name,
|
|
7725
|
+
stable_name: "stable_name" in category ? (_c = category.stable_name) != null ? _c : "" : "",
|
|
7719
7726
|
entries: category.entries,
|
|
7720
7727
|
subCategories: category.subCategories
|
|
7721
7728
|
}
|
|
@@ -7730,7 +7737,7 @@ var flattenCategories = (categories) => {
|
|
|
7730
7737
|
return [
|
|
7731
7738
|
{
|
|
7732
7739
|
label: category.display_name,
|
|
7733
|
-
id: category.id,
|
|
7740
|
+
id: "id" in category ? category.id : category.stable_name,
|
|
7734
7741
|
value: {
|
|
7735
7742
|
type: "GROUP",
|
|
7736
7743
|
items: category.subCategories.map((x) => mapCategoryToOption(x))
|
|
@@ -7750,7 +7757,7 @@ var getAssignedValue = (bankTransaction) => {
|
|
|
7750
7757
|
if (bankTransaction.categorization_status === "MATCHED" /* MATCHED */ || (bankTransaction == null ? void 0 : bankTransaction.categorization_status) === "SPLIT" /* SPLIT */) {
|
|
7751
7758
|
return;
|
|
7752
7759
|
}
|
|
7753
|
-
if (bankTransaction.category && bankTransaction.category.type != "
|
|
7760
|
+
if (bankTransaction.category && bankTransaction.category.type != "ExclusionNested") {
|
|
7754
7761
|
return mapCategoryToOption(bankTransaction.category);
|
|
7755
7762
|
}
|
|
7756
7763
|
if (hasSuggestions(bankTransaction.categorization_flow)) {
|
|
@@ -7873,16 +7880,16 @@ var import_classnames33 = __toESM(require("classnames"));
|
|
|
7873
7880
|
var import_date_fns9 = require("date-fns");
|
|
7874
7881
|
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
7875
7882
|
var mapCategoryToOption2 = (category) => {
|
|
7876
|
-
var _a;
|
|
7883
|
+
var _a, _b;
|
|
7877
7884
|
return {
|
|
7878
7885
|
type: "category" /* CATEGORY */,
|
|
7879
7886
|
payload: {
|
|
7880
|
-
id: category.id,
|
|
7887
|
+
id: "id" in category ? category.id : "",
|
|
7881
7888
|
option_type: "category" /* CATEGORY */,
|
|
7882
7889
|
display_name: category.display_name,
|
|
7883
7890
|
type: category.type,
|
|
7884
7891
|
description: (_a = category.description) != null ? _a : void 0,
|
|
7885
|
-
stable_name: category.stable_name,
|
|
7892
|
+
stable_name: "stable_name" in category ? (_b = category.stable_name) != null ? _b : "" : "",
|
|
7886
7893
|
entries: category.entries,
|
|
7887
7894
|
subCategories: category.subCategories
|
|
7888
7895
|
}
|
|
@@ -7896,7 +7903,7 @@ var mapCategoryToExclusionOption = (category) => {
|
|
|
7896
7903
|
option_type: "category" /* CATEGORY */,
|
|
7897
7904
|
display_name: category.display_name,
|
|
7898
7905
|
type: "ExclusionNested",
|
|
7899
|
-
stable_name:
|
|
7906
|
+
stable_name: "",
|
|
7900
7907
|
entries: category.entries,
|
|
7901
7908
|
subCategories: category.subCategories
|
|
7902
7909
|
}
|
|
@@ -7909,7 +7916,8 @@ var mapSuggestedMatchToOption = (record) => {
|
|
|
7909
7916
|
id: record.id,
|
|
7910
7917
|
option_type: "match" /* MATCH */,
|
|
7911
7918
|
display_name: record.details.description,
|
|
7912
|
-
amount: record.details.amount
|
|
7919
|
+
amount: record.details.amount,
|
|
7920
|
+
subCategories: null
|
|
7913
7921
|
}
|
|
7914
7922
|
};
|
|
7915
7923
|
};
|
|
@@ -7983,7 +7991,8 @@ var allCategoriesDivider = [
|
|
|
7983
7991
|
payload: {
|
|
7984
7992
|
id: "all_categories",
|
|
7985
7993
|
option_type: "hidden" /* HIDDEN */,
|
|
7986
|
-
display_name: "ALL CATEGORIES"
|
|
7994
|
+
display_name: "ALL CATEGORIES",
|
|
7995
|
+
subCategories: null
|
|
7987
7996
|
}
|
|
7988
7997
|
}
|
|
7989
7998
|
]
|
|
@@ -8029,7 +8038,8 @@ var CategorySelect = ({
|
|
|
8029
8038
|
option_type: "match" /* MATCH */,
|
|
8030
8039
|
display_name: x.details.description,
|
|
8031
8040
|
date: x.details.date,
|
|
8032
|
-
amount: x.details.amount
|
|
8041
|
+
amount: x.details.amount,
|
|
8042
|
+
subCategories: null
|
|
8033
8043
|
}
|
|
8034
8044
|
};
|
|
8035
8045
|
})
|
|
@@ -9187,7 +9197,7 @@ var ExpandedBankTransactionRow = (0, import_react59.forwardRef)(
|
|
|
9187
9197
|
const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && ((_e = (_d = bankTransaction.categorization_flow) == null ? void 0 : _d.suggestions) == null ? void 0 : _e[0]);
|
|
9188
9198
|
const [rowState, updateRowState] = (0, import_react59.useState)({
|
|
9189
9199
|
splits: ((_f = bankTransaction.category) == null ? void 0 : _f.entries) ? (_g = bankTransaction.category) == null ? void 0 : _g.entries.map((c) => {
|
|
9190
|
-
return c.type === "ExclusionSplitEntry" ? {
|
|
9200
|
+
return c.type === "ExclusionSplitEntry" && c.category.type === "ExclusionNested" ? {
|
|
9191
9201
|
amount: c.amount || 0,
|
|
9192
9202
|
inputValue: centsToDollars(c.amount),
|
|
9193
9203
|
category: mapCategoryToExclusionOption(c.category)
|
|
@@ -10816,7 +10826,7 @@ var SplitForm = ({
|
|
|
10816
10826
|
const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && ((_b = (_a = bankTransaction.categorization_flow) == null ? void 0 : _a.suggestions) == null ? void 0 : _b[0]);
|
|
10817
10827
|
const [rowState, updateRowState] = (0, import_react66.useState)({
|
|
10818
10828
|
splits: ((_c = bankTransaction.category) == null ? void 0 : _c.entries) ? (_d = bankTransaction.category) == null ? void 0 : _d.entries.map((c) => {
|
|
10819
|
-
return c.type === "ExclusionSplitEntry" ? {
|
|
10829
|
+
return c.type === "ExclusionSplitEntry" && c.category.type === "ExclusionNested" ? {
|
|
10820
10830
|
amount: c.amount || 0,
|
|
10821
10831
|
inputValue: centsToDollars(c.amount),
|
|
10822
10832
|
category: mapCategoryToExclusionOption(c.category)
|
|
@@ -11229,7 +11239,7 @@ var BankTransactionMobileListItem = ({
|
|
|
11229
11239
|
const itemRef = (0, import_react69.useRef)(null);
|
|
11230
11240
|
const [removeAnim, setRemoveAnim] = (0, import_react69.useState)(false);
|
|
11231
11241
|
const [purpose, setPurpose] = (0, import_react69.useState)(
|
|
11232
|
-
bankTransaction.category ? bankTransaction.category.type === "
|
|
11242
|
+
bankTransaction.category ? bankTransaction.category.type === "ExclusionNested" ? "personal" /* personal */ : bankTransaction.categorization_status === "SPLIT" /* SPLIT */ ? "more" /* more */ : "business" /* business */ : hasMatch(bankTransaction) ? "more" /* more */ : "business" /* business */
|
|
11233
11243
|
);
|
|
11234
11244
|
const [open, setOpen] = (0, import_react69.useState)(isFirstItem);
|
|
11235
11245
|
const [showComponent, setShowComponent] = (0, import_react69.useState)(!initialLoad);
|
|
@@ -11462,7 +11472,7 @@ var SkeletonTableLoader = ({
|
|
|
11462
11472
|
{
|
|
11463
11473
|
colSpan: col.colSpan,
|
|
11464
11474
|
className: "Layer__skeleton-loader__row",
|
|
11465
|
-
children: col.colComponent ? col.colComponent : col.parts && col.parts > 1 ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "Layer__skeleton-loader__row__group", children:
|
|
11475
|
+
children: col.colComponent ? col.colComponent : col.parts && col.parts > 1 ? /* @__PURE__ */ (0, import_jsx_runtime131.jsx)("span", { className: "Layer__skeleton-loader__row__group", children: Array(col.parts).map((_part, partIndex) => /* @__PURE__ */ (0, import_jsx_runtime131.jsx)(
|
|
11466
11476
|
SkeletonLoader,
|
|
11467
11477
|
{
|
|
11468
11478
|
width: "100%",
|
|
@@ -15596,7 +15606,7 @@ var TableProvider = ({ children }) => {
|
|
|
15596
15606
|
};
|
|
15597
15607
|
|
|
15598
15608
|
// src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
|
|
15599
|
-
var import_react101 =
|
|
15609
|
+
var import_react101 = require("react");
|
|
15600
15610
|
|
|
15601
15611
|
// src/hooks/useTableExpandRow/useTableExpandRow.tsx
|
|
15602
15612
|
var import_react99 = require("react");
|
|
@@ -15922,7 +15932,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
15922
15932
|
}
|
|
15923
15933
|
const expandable = (lineItem == null ? void 0 : lineItem.line_items) && lineItem.line_items.length > 0 ? true : false;
|
|
15924
15934
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
15925
|
-
return /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_react101.
|
|
15935
|
+
return /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_react101.Fragment, { children: [
|
|
15926
15936
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(
|
|
15927
15937
|
TableRow,
|
|
15928
15938
|
{
|
|
@@ -15956,7 +15966,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
15956
15966
|
return /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(Table, { borderCollapse: "collapse", bottomSpacing: false, children: [
|
|
15957
15967
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(TableHead, { children: compareOptions && compareOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(TableRow, { rowKey: "", children: [
|
|
15958
15968
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(TableCell, { isHeaderCell: true }),
|
|
15959
|
-
compareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_react101.
|
|
15969
|
+
compareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(import_react101.Fragment, { children: [
|
|
15960
15970
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(TableCell, { primary: true, isHeaderCell: true, children: option.displayName }, option + "-" + i),
|
|
15961
15971
|
compareMonths && Array.from({ length: compareMonths - 1 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(TableCell, { isHeaderCell: true }, option + "-" + index))
|
|
15962
15972
|
] }, option + "-" + i))
|
|
@@ -15964,10 +15974,10 @@ var ProfitAndLossCompareTable = ({
|
|
|
15964
15974
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(TableBody, { children: [
|
|
15965
15975
|
compareMonths && /* @__PURE__ */ (0, import_jsx_runtime177.jsxs)(TableRow, { rowKey: "", children: [
|
|
15966
15976
|
/* @__PURE__ */ (0, import_jsx_runtime177.jsx)(TableCell, { isHeaderCell: true }),
|
|
15967
|
-
compareOptions && compareOptions.length > 0 ? compareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_react101.
|
|
15977
|
+
compareOptions && compareOptions.length > 0 ? compareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_react101.Fragment, { children: generatComparisonMonths(
|
|
15968
15978
|
dateRange.startDate,
|
|
15969
15979
|
compareMonths
|
|
15970
|
-
).map((month, index) => /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(TableCell, { isHeaderCell: true, children: month }, option + "-" + index)) }, option + "-" + i)) : /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_react101.
|
|
15980
|
+
).map((month, index) => /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(TableCell, { isHeaderCell: true, children: month }, option + "-" + index)) }, option + "-" + i)) : /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(import_react101.Fragment, { children: generatComparisonMonths(
|
|
15971
15981
|
dateRange.startDate,
|
|
15972
15982
|
compareMonths
|
|
15973
15983
|
).map((month, index) => /* @__PURE__ */ (0, import_jsx_runtime177.jsx)(TableCell, { isHeaderCell: true, children: month }, "total-" + index + "-cell")) }, "total-1")
|
|
@@ -15998,7 +16008,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
15998
16008
|
};
|
|
15999
16009
|
|
|
16000
16010
|
// src/components/ProfitAndLossTable/ProfitAndLossTableComponent.tsx
|
|
16001
|
-
var import_react102 =
|
|
16011
|
+
var import_react102 = require("react");
|
|
16002
16012
|
|
|
16003
16013
|
// src/icons/PieChart.tsx
|
|
16004
16014
|
var import_jsx_runtime178 = require("react/jsx-runtime");
|
|
@@ -16119,7 +16129,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
16119
16129
|
const renderLineItem = (lineItem, depth, rowKey, rowIndex, scope, setSidebarScope2, variant) => {
|
|
16120
16130
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
16121
16131
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
16122
|
-
return /* @__PURE__ */ (0, import_jsx_runtime179.jsxs)(import_react102.
|
|
16132
|
+
return /* @__PURE__ */ (0, import_jsx_runtime179.jsxs)(import_react102.Fragment, { children: [
|
|
16123
16133
|
/* @__PURE__ */ (0, import_jsx_runtime179.jsxs)(
|
|
16124
16134
|
TableRow,
|
|
16125
16135
|
{
|
|
@@ -16229,8 +16239,8 @@ var ProfitAndLossTableComponent = ({
|
|
|
16229
16239
|
void 0,
|
|
16230
16240
|
"summation"
|
|
16231
16241
|
),
|
|
16232
|
-
data.personal_expenses ?
|
|
16233
|
-
data.other_outflows ?
|
|
16242
|
+
data.personal_expenses ? renderLineItem(data.personal_expenses, 0, "personal_expenses", 7) : null,
|
|
16243
|
+
data.other_outflows ? renderLineItem(data.other_outflows, 0, "other_outflows", 6) : null
|
|
16234
16244
|
] }) });
|
|
16235
16245
|
};
|
|
16236
16246
|
|
|
@@ -16416,7 +16426,7 @@ var BalanceSheetExpandAllButton = ({
|
|
|
16416
16426
|
};
|
|
16417
16427
|
|
|
16418
16428
|
// src/components/BalanceSheetTable/BalanceSheetTable.tsx
|
|
16419
|
-
var import_react108 =
|
|
16429
|
+
var import_react108 = require("react");
|
|
16420
16430
|
var import_jsx_runtime184 = require("react/jsx-runtime");
|
|
16421
16431
|
var BalanceSheetTable = ({
|
|
16422
16432
|
data,
|
|
@@ -16440,7 +16450,7 @@ var BalanceSheetTable = ({
|
|
|
16440
16450
|
if (expandable) {
|
|
16441
16451
|
allRowKeys.push(rowKey);
|
|
16442
16452
|
}
|
|
16443
|
-
return /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_react108.
|
|
16453
|
+
return /* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(import_react108.Fragment, { children: [
|
|
16444
16454
|
/* @__PURE__ */ (0, import_jsx_runtime184.jsxs)(
|
|
16445
16455
|
TableRow,
|
|
16446
16456
|
{
|
|
@@ -16491,7 +16501,7 @@ var BalanceSheetTable = ({
|
|
|
16491
16501
|
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.typeColumnHeader) || "Type" }),
|
|
16492
16502
|
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)(TableCell, { isHeaderCell: true, align: "right" /* RIGHT */, children: (stringOverrides == null ? void 0 : stringOverrides.totalColumnHeader) || "Total" })
|
|
16493
16503
|
] }) }),
|
|
16494
|
-
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(import_react108.
|
|
16504
|
+
/* @__PURE__ */ (0, import_jsx_runtime184.jsx)(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ (0, import_jsx_runtime184.jsx)(import_react108.Fragment, { children: data[row.lineItem] && renderLineItem(
|
|
16495
16505
|
data[row.lineItem],
|
|
16496
16506
|
0,
|
|
16497
16507
|
row.lineItem,
|
|
@@ -16531,7 +16541,7 @@ function useInvisibleDownload() {
|
|
|
16531
16541
|
const invisibleDownloadRef = (0, import_react109.useRef)(null);
|
|
16532
16542
|
const triggerInvisibleDownload = (0, import_react109.useCallback)((options) => {
|
|
16533
16543
|
var _a;
|
|
16534
|
-
(_a = invisibleDownloadRef.current) == null ? void 0 : _a.trigger(options);
|
|
16544
|
+
void ((_a = invisibleDownloadRef.current) == null ? void 0 : _a.trigger(options));
|
|
16535
16545
|
}, []);
|
|
16536
16546
|
return { invisibleDownloadRef, triggerInvisibleDownload };
|
|
16537
16547
|
}
|
|
@@ -16758,7 +16768,7 @@ var useStatementOfCashFlow = (startDate = /* @__PURE__ */ new Date(), endDate =
|
|
|
16758
16768
|
};
|
|
16759
16769
|
|
|
16760
16770
|
// src/components/StatementOfCashFlowTable/StatementOfCashFlowTable.tsx
|
|
16761
|
-
var import_react112 =
|
|
16771
|
+
var import_react112 = require("react");
|
|
16762
16772
|
var import_jsx_runtime188 = require("react/jsx-runtime");
|
|
16763
16773
|
var StatementOfCashFlowTable = ({
|
|
16764
16774
|
data,
|
|
@@ -16769,7 +16779,7 @@ var StatementOfCashFlowTable = ({
|
|
|
16769
16779
|
const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
|
|
16770
16780
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
16771
16781
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
16772
|
-
return /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)(import_react112.
|
|
16782
|
+
return /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)(import_react112.Fragment, { children: [
|
|
16773
16783
|
/* @__PURE__ */ (0, import_jsx_runtime188.jsxs)(
|
|
16774
16784
|
TableRow,
|
|
16775
16785
|
{
|
|
@@ -16821,7 +16831,7 @@ var StatementOfCashFlowTable = ({
|
|
|
16821
16831
|
] }) }),
|
|
16822
16832
|
/* @__PURE__ */ (0, import_jsx_runtime188.jsx)(TableBody, { children: config.map((row, idx) => {
|
|
16823
16833
|
if (row.type === "line_item") {
|
|
16824
|
-
return /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(import_react112.
|
|
16834
|
+
return /* @__PURE__ */ (0, import_jsx_runtime188.jsx)(import_react112.Fragment, { children: data[row.lineItem] && renderLineItem(
|
|
16825
16835
|
data[row.lineItem],
|
|
16826
16836
|
0,
|
|
16827
16837
|
row.lineItem ? row.lineItem : "",
|
|
@@ -18021,7 +18031,7 @@ var ChartOfAccountsSidebar = ({
|
|
|
18021
18031
|
};
|
|
18022
18032
|
|
|
18023
18033
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
18024
|
-
var import_react120 =
|
|
18034
|
+
var import_react120 = require("react");
|
|
18025
18035
|
|
|
18026
18036
|
// src/icons/Edit2.tsx
|
|
18027
18037
|
var import_jsx_runtime196 = require("react/jsx-runtime");
|
|
@@ -18111,7 +18121,7 @@ var ChartOfAccountsTableContent = ({
|
|
|
18111
18121
|
var _a, _b;
|
|
18112
18122
|
const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
18113
18123
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
18114
|
-
return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(import_react120.
|
|
18124
|
+
return /* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(import_react120.Fragment, { children: [
|
|
18115
18125
|
/* @__PURE__ */ (0, import_jsx_runtime197.jsxs)(
|
|
18116
18126
|
TableRow,
|
|
18117
18127
|
{
|
|
@@ -18400,18 +18410,18 @@ var import_react122 = require("react");
|
|
|
18400
18410
|
|
|
18401
18411
|
// src/utils/journal.ts
|
|
18402
18412
|
var getAccountIdentifierPayload = (journalLineItem) => {
|
|
18403
|
-
if (journalLineItem.account_identifier.id) {
|
|
18404
|
-
return {
|
|
18405
|
-
type: "AccountId",
|
|
18406
|
-
id: journalLineItem.account_identifier.id
|
|
18407
|
-
};
|
|
18408
|
-
}
|
|
18409
18413
|
if (journalLineItem.account_identifier.stable_name) {
|
|
18410
18414
|
return {
|
|
18411
18415
|
type: "StableName",
|
|
18412
18416
|
stable_name: journalLineItem.account_identifier.stable_name
|
|
18413
18417
|
};
|
|
18414
18418
|
}
|
|
18419
|
+
if (journalLineItem.account_identifier.id) {
|
|
18420
|
+
return {
|
|
18421
|
+
type: "AccountId",
|
|
18422
|
+
id: journalLineItem.account_identifier.id
|
|
18423
|
+
};
|
|
18424
|
+
}
|
|
18415
18425
|
throw new Error("Invalid account identifier");
|
|
18416
18426
|
};
|
|
18417
18427
|
var entryNumber = (entry) => {
|
|
@@ -19227,7 +19237,7 @@ var useJournal = () => {
|
|
|
19227
19237
|
setForm({
|
|
19228
19238
|
action: "new",
|
|
19229
19239
|
data: {
|
|
19230
|
-
entry_at:
|
|
19240
|
+
entry_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
19231
19241
|
created_by: "Test API Integration",
|
|
19232
19242
|
memo: "",
|
|
19233
19243
|
line_items: [
|
|
@@ -19654,7 +19664,56 @@ var import_react130 = require("react");
|
|
|
19654
19664
|
|
|
19655
19665
|
// src/components/JournalForm/JournalFormEntryLines.tsx
|
|
19656
19666
|
var import_react129 = require("react");
|
|
19667
|
+
|
|
19668
|
+
// src/hooks/categories/useAllCategories.ts
|
|
19669
|
+
var import_swr12 = __toESM(require("swr"));
|
|
19670
|
+
function buildKey7({
|
|
19671
|
+
access_token: accessToken,
|
|
19672
|
+
apiUrl,
|
|
19673
|
+
businessId
|
|
19674
|
+
}) {
|
|
19675
|
+
if (accessToken && apiUrl) {
|
|
19676
|
+
return {
|
|
19677
|
+
accessToken,
|
|
19678
|
+
apiUrl,
|
|
19679
|
+
businessId,
|
|
19680
|
+
mode: "ALL",
|
|
19681
|
+
tags: ["#categories"]
|
|
19682
|
+
};
|
|
19683
|
+
}
|
|
19684
|
+
}
|
|
19685
|
+
function useAllCategories() {
|
|
19686
|
+
const { data: auth } = useAuth();
|
|
19687
|
+
const { businessId } = useLayerContext();
|
|
19688
|
+
return (0, import_swr12.default)(
|
|
19689
|
+
() => buildKey7(__spreadProps(__spreadValues({}, auth), {
|
|
19690
|
+
businessId
|
|
19691
|
+
})),
|
|
19692
|
+
({ accessToken, apiUrl, businessId: businessId2, mode }) => getCategories(
|
|
19693
|
+
apiUrl,
|
|
19694
|
+
accessToken,
|
|
19695
|
+
{
|
|
19696
|
+
params: {
|
|
19697
|
+
businessId: businessId2,
|
|
19698
|
+
mode
|
|
19699
|
+
}
|
|
19700
|
+
}
|
|
19701
|
+
)().then(({ data }) => data.categories)
|
|
19702
|
+
);
|
|
19703
|
+
}
|
|
19704
|
+
|
|
19705
|
+
// src/components/JournalForm/JournalFormEntryLines.tsx
|
|
19657
19706
|
var import_jsx_runtime209 = require("react/jsx-runtime");
|
|
19707
|
+
function recursiveFlattenCategories(accounts) {
|
|
19708
|
+
const flattenedResult = accounts.flatMap((a) => {
|
|
19709
|
+
var _a;
|
|
19710
|
+
return [
|
|
19711
|
+
a,
|
|
19712
|
+
recursiveFlattenCategories((_a = a.subCategories) != null ? _a : [])
|
|
19713
|
+
];
|
|
19714
|
+
}).flat();
|
|
19715
|
+
return flattenedResult;
|
|
19716
|
+
}
|
|
19658
19717
|
var JournalFormEntryLines = ({
|
|
19659
19718
|
entrylineItems,
|
|
19660
19719
|
addEntryLine,
|
|
@@ -19663,9 +19722,82 @@ var JournalFormEntryLines = ({
|
|
|
19663
19722
|
sendingForm,
|
|
19664
19723
|
config
|
|
19665
19724
|
}) => {
|
|
19666
|
-
const { data
|
|
19725
|
+
const { data } = useAllCategories();
|
|
19667
19726
|
const { form } = (0, import_react129.useContext)(JournalContext);
|
|
19668
|
-
const parentOptions =
|
|
19727
|
+
const { flattenedCategories, parentOptions } = (0, import_react129.useMemo)(() => {
|
|
19728
|
+
const flattenedCategories2 = recursiveFlattenCategories(data != null ? data : []);
|
|
19729
|
+
const parentOptions2 = [...flattenedCategories2].sort((a, b) => a.display_name.localeCompare(b.display_name)).map((account) => {
|
|
19730
|
+
switch (account.type) {
|
|
19731
|
+
case "AccountNested":
|
|
19732
|
+
return {
|
|
19733
|
+
label: account.display_name,
|
|
19734
|
+
value: account.id
|
|
19735
|
+
};
|
|
19736
|
+
case "OptionalAccountNested":
|
|
19737
|
+
return {
|
|
19738
|
+
label: account.display_name,
|
|
19739
|
+
value: account.stable_name
|
|
19740
|
+
};
|
|
19741
|
+
case "ExclusionNested":
|
|
19742
|
+
return {
|
|
19743
|
+
label: account.display_name,
|
|
19744
|
+
value: account.id
|
|
19745
|
+
};
|
|
19746
|
+
default:
|
|
19747
|
+
safeAssertUnreachable(account, "Unexpected account type");
|
|
19748
|
+
}
|
|
19749
|
+
});
|
|
19750
|
+
return { flattenedCategories: flattenedCategories2, parentOptions: parentOptions2 };
|
|
19751
|
+
}, [data]);
|
|
19752
|
+
const handleChangeParent = ({
|
|
19753
|
+
lineItemIndex,
|
|
19754
|
+
value
|
|
19755
|
+
}) => {
|
|
19756
|
+
var _a;
|
|
19757
|
+
const relevantCategory = flattenedCategories.find((x) => {
|
|
19758
|
+
switch (x.type) {
|
|
19759
|
+
case "AccountNested":
|
|
19760
|
+
return x.id === value.value;
|
|
19761
|
+
case "OptionalAccountNested":
|
|
19762
|
+
return x.stable_name === value.value;
|
|
19763
|
+
case "ExclusionNested":
|
|
19764
|
+
return x.id === value.value;
|
|
19765
|
+
default:
|
|
19766
|
+
safeAssertUnreachable(x, "Unexpected account type");
|
|
19767
|
+
}
|
|
19768
|
+
});
|
|
19769
|
+
if (!relevantCategory) {
|
|
19770
|
+
return;
|
|
19771
|
+
}
|
|
19772
|
+
const baseFields = relevantCategory.type === "OptionalAccountNested" ? {
|
|
19773
|
+
id: relevantCategory.stable_name,
|
|
19774
|
+
stable_name: relevantCategory.stable_name,
|
|
19775
|
+
account_type: {
|
|
19776
|
+
value: relevantCategory.stable_name,
|
|
19777
|
+
display_name: relevantCategory.display_name
|
|
19778
|
+
}
|
|
19779
|
+
} : {
|
|
19780
|
+
id: relevantCategory.id,
|
|
19781
|
+
stable_name: "stable_name" in relevantCategory ? (_a = relevantCategory.stable_name) != null ? _a : "" : "",
|
|
19782
|
+
account_type: {
|
|
19783
|
+
value: relevantCategory.id,
|
|
19784
|
+
display_name: relevantCategory.display_name
|
|
19785
|
+
}
|
|
19786
|
+
};
|
|
19787
|
+
return changeFormData(
|
|
19788
|
+
"parent",
|
|
19789
|
+
value,
|
|
19790
|
+
lineItemIndex,
|
|
19791
|
+
[
|
|
19792
|
+
__spreadProps(__spreadValues({}, baseFields), {
|
|
19793
|
+
name: relevantCategory.display_name,
|
|
19794
|
+
sub_accounts: [],
|
|
19795
|
+
balance: 0,
|
|
19796
|
+
normality: "DEBIT" /* DEBIT */
|
|
19797
|
+
})
|
|
19798
|
+
]
|
|
19799
|
+
);
|
|
19800
|
+
};
|
|
19669
19801
|
return /* @__PURE__ */ (0, import_jsx_runtime209.jsx)(import_jsx_runtime209.Fragment, { children: ["DEBIT", "CREDIT"].map((direction, idx) => {
|
|
19670
19802
|
return /* @__PURE__ */ (0, import_jsx_runtime209.jsxs)(
|
|
19671
19803
|
"div",
|
|
@@ -19678,9 +19810,11 @@ var JournalFormEntryLines = ({
|
|
|
19678
19810
|
className: "Layer__journal__form__input-group__title",
|
|
19679
19811
|
size: "lg" /* lg */,
|
|
19680
19812
|
children: [
|
|
19681
|
-
"Add
|
|
19813
|
+
"Add",
|
|
19814
|
+
" ",
|
|
19682
19815
|
humanizeEnum(direction),
|
|
19683
|
-
"
|
|
19816
|
+
" ",
|
|
19817
|
+
"Account"
|
|
19684
19818
|
]
|
|
19685
19819
|
}
|
|
19686
19820
|
),
|
|
@@ -19735,12 +19869,10 @@ var JournalFormEntryLines = ({
|
|
|
19735
19869
|
value: item.account_identifier.id,
|
|
19736
19870
|
label: item.account_identifier.name
|
|
19737
19871
|
},
|
|
19738
|
-
onChange: (
|
|
19739
|
-
|
|
19740
|
-
|
|
19741
|
-
|
|
19742
|
-
accountsData == null ? void 0 : accountsData.accounts
|
|
19743
|
-
),
|
|
19872
|
+
onChange: (value) => handleChangeParent({
|
|
19873
|
+
lineItemIndex: idx2,
|
|
19874
|
+
value
|
|
19875
|
+
}),
|
|
19744
19876
|
isInvalid: Boolean(
|
|
19745
19877
|
(_d = form == null ? void 0 : form.errors) == null ? void 0 : _d.lineItems.find(
|
|
19746
19878
|
(x) => x.id === idx2 && x.field === "account"
|
|
@@ -19954,7 +20086,7 @@ var JournalSidebar = ({
|
|
|
19954
20086
|
};
|
|
19955
20087
|
|
|
19956
20088
|
// src/components/JournalTable/JournalTable.tsx
|
|
19957
|
-
var import_react132 =
|
|
20089
|
+
var import_react132 = require("react");
|
|
19958
20090
|
var import_date_fns35 = require("date-fns");
|
|
19959
20091
|
var import_jsx_runtime212 = require("react/jsx-runtime");
|
|
19960
20092
|
var accountName = (row) => {
|
|
@@ -19992,7 +20124,7 @@ var JournalTableContent = ({
|
|
|
19992
20124
|
const renderJournalRow = (row, index, rowKey, depth) => {
|
|
19993
20125
|
const expandable = !!row.line_items && row.line_items.length > 0;
|
|
19994
20126
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
19995
|
-
return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(import_react132.
|
|
20127
|
+
return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(import_react132.Fragment, { children: [
|
|
19996
20128
|
/* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(
|
|
19997
20129
|
TableRow,
|
|
19998
20130
|
{
|
|
@@ -20074,7 +20206,7 @@ var JournalTableContent = ({
|
|
|
20074
20206
|
|
|
20075
20207
|
// src/components/Journal/download/useJournalEntriesDownload.ts
|
|
20076
20208
|
var import_mutation6 = __toESM(require("swr/mutation"));
|
|
20077
|
-
function
|
|
20209
|
+
function buildKey8({
|
|
20078
20210
|
access_token: accessToken,
|
|
20079
20211
|
apiUrl,
|
|
20080
20212
|
businessId,
|
|
@@ -20100,7 +20232,7 @@ function useJournalEntriesDownload({
|
|
|
20100
20232
|
const { data: auth } = useAuth();
|
|
20101
20233
|
const { businessId } = useLayerContext();
|
|
20102
20234
|
return (0, import_mutation6.default)(
|
|
20103
|
-
() =>
|
|
20235
|
+
() => buildKey8(__spreadProps(__spreadValues({}, auth), {
|
|
20104
20236
|
businessId,
|
|
20105
20237
|
startCutoff,
|
|
20106
20238
|
endCutoff
|
|
@@ -20384,7 +20516,7 @@ var mockData = [
|
|
|
20384
20516
|
];
|
|
20385
20517
|
|
|
20386
20518
|
// src/hooks/useTasks/useTasks.tsx
|
|
20387
|
-
var
|
|
20519
|
+
var import_swr13 = __toESM(require("swr"));
|
|
20388
20520
|
var import_date_fns37 = require("date-fns");
|
|
20389
20521
|
var DEBUG_MODE = false;
|
|
20390
20522
|
var useTasks = ({
|
|
@@ -20401,7 +20533,7 @@ var useTasks = ({
|
|
|
20401
20533
|
});
|
|
20402
20534
|
const [currentDate, setCurrentDate] = (0, import_react135.useState)(/* @__PURE__ */ new Date());
|
|
20403
20535
|
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `tasks-${businessId}-${dateRange.startDate}-${dateRange.endDate}`;
|
|
20404
|
-
const { data, isLoading, isValidating, error, mutate } = (0,
|
|
20536
|
+
const { data, isLoading, isValidating, error, mutate } = (0, import_swr13.default)(
|
|
20405
20537
|
queryKey,
|
|
20406
20538
|
Layer.getTasks(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
20407
20539
|
params: {
|