@layerfi/components 0.1.81 → 0.1.82
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 +690 -351
- package/dist/esm/index.mjs +630 -291
- package/dist/index.css +1323 -56
- package/dist/index.d.ts +180 -38
- package/eslint.config.mjs +100 -0
- package/package.json +9 -6
- package/.eslintrc.js +0 -82
package/dist/esm/index.mjs
CHANGED
|
@@ -57,7 +57,7 @@ import React9, { useState as useState7 } from "react";
|
|
|
57
57
|
import React8, { useReducer, useEffect as useEffect4 } from "react";
|
|
58
58
|
|
|
59
59
|
// package.json
|
|
60
|
-
var version = "0.1.
|
|
60
|
+
var version = "0.1.82";
|
|
61
61
|
|
|
62
62
|
// src/models/APIError.ts
|
|
63
63
|
var APIError = class _APIError extends Error {
|
|
@@ -398,21 +398,29 @@ var getCashflowStatementCSV = get(
|
|
|
398
398
|
|
|
399
399
|
// src/api/layer/tasks.ts
|
|
400
400
|
var getTasks = get(
|
|
401
|
-
({ businessId }) => `/v1/businesses/${businessId}/tasks`
|
|
401
|
+
({ businessId, startDate, endDate }) => `/v1/businesses/${businessId}/tasks?${startDate ? `&start_date=${encodeURIComponent(startDate)}` : ""}${endDate ? `&end_date=${encodeURIComponent(endDate)}` : ""}`
|
|
402
402
|
);
|
|
403
403
|
var submitResponseToTask = post(
|
|
404
404
|
({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/user-response`
|
|
405
405
|
);
|
|
406
|
+
var updateUploadDocumentTaskDescription = post(
|
|
407
|
+
({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/upload/update-description`
|
|
408
|
+
);
|
|
406
409
|
var markTaskAsComplete = post(
|
|
407
410
|
({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/complete`
|
|
408
411
|
);
|
|
412
|
+
var deleteTaskUploads = post(
|
|
413
|
+
({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/upload/delete`
|
|
414
|
+
);
|
|
409
415
|
var completeTaskWithUpload = (baseUrl, accessToken) => ({
|
|
410
416
|
businessId,
|
|
411
417
|
taskId,
|
|
412
|
-
|
|
418
|
+
files,
|
|
419
|
+
description
|
|
413
420
|
}) => {
|
|
414
421
|
const formData = new FormData();
|
|
415
|
-
formData.append("file", file);
|
|
422
|
+
files.forEach((file) => formData.append("file", file));
|
|
423
|
+
description && formData.append("description", description);
|
|
416
424
|
const endpoint = `/v1/businesses/${businessId}/tasks/${taskId}/upload`;
|
|
417
425
|
return postWithFormData(
|
|
418
426
|
endpoint,
|
|
@@ -462,6 +470,8 @@ var Layer = {
|
|
|
462
470
|
getTasks,
|
|
463
471
|
completeTaskWithUpload,
|
|
464
472
|
submitResponseToTask,
|
|
473
|
+
deleteTaskUploads,
|
|
474
|
+
updateUploadDocumentTaskDescription,
|
|
465
475
|
breakPlaidItemConnection,
|
|
466
476
|
syncConnection,
|
|
467
477
|
updateConnectionStatus,
|
|
@@ -1366,12 +1376,12 @@ function AccountConfirmationStoreProvider({
|
|
|
1366
1376
|
initialVisibility = "DEFAULT"
|
|
1367
1377
|
}) {
|
|
1368
1378
|
const [store] = useState4(
|
|
1369
|
-
() => createStore((
|
|
1379
|
+
() => createStore((set2) => ({
|
|
1370
1380
|
visibility: initialVisibility,
|
|
1371
1381
|
actions: {
|
|
1372
|
-
dismiss: () =>
|
|
1373
|
-
preload: () =>
|
|
1374
|
-
reset: () =>
|
|
1382
|
+
dismiss: () => set2((state) => __spreadProps(__spreadValues({}, state), { visibility: "DISMISSED" })),
|
|
1383
|
+
preload: () => set2((state) => __spreadProps(__spreadValues({}, state), { visibility: "PRELOADED" })),
|
|
1384
|
+
reset: () => set2((state) => __spreadProps(__spreadValues({}, state), { visibility: "DEFAULT" }))
|
|
1375
1385
|
}
|
|
1376
1386
|
}))
|
|
1377
1387
|
);
|
|
@@ -5433,7 +5443,7 @@ var LinkedAccountsComponent = ({
|
|
|
5433
5443
|
};
|
|
5434
5444
|
|
|
5435
5445
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
5436
|
-
import React138, { useEffect as useEffect23, useMemo as
|
|
5446
|
+
import React138, { useEffect as useEffect23, useMemo as useMemo15, useRef as useRef17, useState as useState32 } from "react";
|
|
5437
5447
|
|
|
5438
5448
|
// src/hooks/useElementSize/useElementSize.ts
|
|
5439
5449
|
import { useLayoutEffect as useLayoutEffect2, useRef as useRef6 } from "react";
|
|
@@ -6865,7 +6875,8 @@ var FileInput = ({
|
|
|
6865
6875
|
disabled = false,
|
|
6866
6876
|
secondary,
|
|
6867
6877
|
iconOnly = false,
|
|
6868
|
-
icon
|
|
6878
|
+
icon,
|
|
6879
|
+
allowMultipleUploads = false
|
|
6869
6880
|
}) => {
|
|
6870
6881
|
const hiddenFileInput = useRef7(null);
|
|
6871
6882
|
const onClick = () => {
|
|
@@ -6875,8 +6886,8 @@ var FileInput = ({
|
|
|
6875
6886
|
};
|
|
6876
6887
|
const onChange = (event) => {
|
|
6877
6888
|
if (event.target.files && event.target.files.length > 0 && onUpload) {
|
|
6878
|
-
const
|
|
6879
|
-
onUpload(
|
|
6889
|
+
const filesUploaded = Array.from(event.target.files);
|
|
6890
|
+
onUpload(filesUploaded);
|
|
6880
6891
|
}
|
|
6881
6892
|
};
|
|
6882
6893
|
if (secondary) {
|
|
@@ -6884,6 +6895,7 @@ var FileInput = ({
|
|
|
6884
6895
|
"input",
|
|
6885
6896
|
{
|
|
6886
6897
|
type: "file",
|
|
6898
|
+
multiple: allowMultipleUploads,
|
|
6887
6899
|
onChange,
|
|
6888
6900
|
ref: hiddenFileInput,
|
|
6889
6901
|
style: { display: "none" }
|
|
@@ -6904,6 +6916,7 @@ var FileInput = ({
|
|
|
6904
6916
|
"input",
|
|
6905
6917
|
{
|
|
6906
6918
|
type: "file",
|
|
6919
|
+
multiple: allowMultipleUploads,
|
|
6907
6920
|
onChange,
|
|
6908
6921
|
ref: hiddenFileInput,
|
|
6909
6922
|
style: { display: "none" }
|
|
@@ -7063,7 +7076,7 @@ var BankTransactionReceipts = forwardRef9(
|
|
|
7063
7076
|
useImperativeHandle(ref, () => ({
|
|
7064
7077
|
uploadReceipt
|
|
7065
7078
|
}));
|
|
7066
|
-
return /* @__PURE__ */ React100.createElement("div", { className: `${classNamePrefix}__file-upload` }, receiptUrls && receiptUrls.length > 0 && label ? /* @__PURE__ */ React100.createElement(Text, { size: "sm" /* sm */, className: "Layer__file-upload__label" }, label) : null, !hideUploadButtons && (!receiptUrls || receiptUrls.length === 0) ? /* @__PURE__ */ React100.createElement(FileInput, { onUpload: uploadReceipt, text: "Upload receipt" }) : null, receiptUrls.map((url, index) => {
|
|
7079
|
+
return /* @__PURE__ */ React100.createElement("div", { className: `${classNamePrefix}__file-upload` }, receiptUrls && receiptUrls.length > 0 && label ? /* @__PURE__ */ React100.createElement(Text, { size: "sm" /* sm */, className: "Layer__file-upload__label" }, label) : null, !hideUploadButtons && (!receiptUrls || receiptUrls.length === 0) ? /* @__PURE__ */ React100.createElement(FileInput, { onUpload: (files) => uploadReceipt(files[0]), text: "Upload receipt" }) : null, receiptUrls.map((url, index) => {
|
|
7067
7080
|
var _a;
|
|
7068
7081
|
return /* @__PURE__ */ React100.createElement(
|
|
7069
7082
|
FileThumb,
|
|
@@ -7087,7 +7100,7 @@ var BankTransactionReceipts = forwardRef9(
|
|
|
7087
7100
|
FileInput,
|
|
7088
7101
|
{
|
|
7089
7102
|
secondary: true,
|
|
7090
|
-
onUpload: uploadReceipt,
|
|
7103
|
+
onUpload: (files) => uploadReceipt(files[0]),
|
|
7091
7104
|
text: "Add next receipt"
|
|
7092
7105
|
}
|
|
7093
7106
|
) : null);
|
|
@@ -8691,7 +8704,6 @@ var BusinessForm = ({
|
|
|
8691
8704
|
showReceiptUploads,
|
|
8692
8705
|
showDescriptions
|
|
8693
8706
|
}) => {
|
|
8694
|
-
var _a;
|
|
8695
8707
|
const receiptsRef = useRef11(null);
|
|
8696
8708
|
const { setContent, close } = useContext16(DrawerContext);
|
|
8697
8709
|
const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
|
|
@@ -8706,8 +8718,8 @@ var BusinessForm = ({
|
|
|
8706
8718
|
}
|
|
8707
8719
|
}, [bankTransaction.error]);
|
|
8708
8720
|
const options = useMemo11(() => {
|
|
8709
|
-
var
|
|
8710
|
-
const options2 = ((
|
|
8721
|
+
var _a;
|
|
8722
|
+
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(
|
|
8711
8723
|
(x) => mapCategoryToOption(x)
|
|
8712
8724
|
) : [];
|
|
8713
8725
|
if (selectedCategory && !options2.find((x) => x.id === (selectedCategory == null ? void 0 : selectedCategory.id))) {
|
|
@@ -8743,11 +8755,11 @@ var BusinessForm = ({
|
|
|
8743
8755
|
);
|
|
8744
8756
|
};
|
|
8745
8757
|
const onCategorySelect = (category) => {
|
|
8746
|
-
var
|
|
8758
|
+
var _a, _b;
|
|
8747
8759
|
if (category.value.type === "SELECT_CATEGORY") {
|
|
8748
8760
|
openDrawer();
|
|
8749
8761
|
} else {
|
|
8750
|
-
if (selectedCategory && ((
|
|
8762
|
+
if (selectedCategory && ((_a = category.value.payload) == null ? void 0 : _a.id) === ((_b = selectedCategory.value.payload) == null ? void 0 : _b.id)) {
|
|
8751
8763
|
setSelectedCategory(void 0);
|
|
8752
8764
|
} else {
|
|
8753
8765
|
setSelectedCategory(category);
|
|
@@ -8755,14 +8767,14 @@ var BusinessForm = ({
|
|
|
8755
8767
|
}
|
|
8756
8768
|
};
|
|
8757
8769
|
const save = () => {
|
|
8758
|
-
var
|
|
8770
|
+
var _a, _b, _c;
|
|
8759
8771
|
if (showDescriptions && memoText !== void 0) {
|
|
8760
8772
|
saveMemoText();
|
|
8761
8773
|
}
|
|
8762
8774
|
if (!selectedCategory || !selectedCategory.value.payload) {
|
|
8763
8775
|
return;
|
|
8764
8776
|
}
|
|
8765
|
-
const payload = ((_b = (
|
|
8777
|
+
const payload = ((_b = (_a = selectedCategory == null ? void 0 : selectedCategory.value) == null ? void 0 : _a.payload) == null ? void 0 : _b.id) ? {
|
|
8766
8778
|
type: "AccountId",
|
|
8767
8779
|
id: selectedCategory.value.payload.id
|
|
8768
8780
|
} : {
|
|
@@ -8829,7 +8841,10 @@ var BusinessForm = ({
|
|
|
8829
8841
|
), /* @__PURE__ */ React116.createElement("div", { className: "Layer__bank-transaction-mobile-list-item__actions" }, showReceiptUploads && /* @__PURE__ */ React116.createElement(
|
|
8830
8842
|
FileInput,
|
|
8831
8843
|
{
|
|
8832
|
-
onUpload: (
|
|
8844
|
+
onUpload: (files) => {
|
|
8845
|
+
var _a;
|
|
8846
|
+
return (_a = receiptsRef.current) == null ? void 0 : _a.uploadReceipt(files[0]);
|
|
8847
|
+
},
|
|
8833
8848
|
text: "Upload receipt",
|
|
8834
8849
|
iconOnly: true,
|
|
8835
8850
|
icon: /* @__PURE__ */ React116.createElement(Paperclip_default, null)
|
|
@@ -8880,7 +8895,6 @@ var PersonalForm = ({
|
|
|
8880
8895
|
showReceiptUploads,
|
|
8881
8896
|
showDescriptions
|
|
8882
8897
|
}) => {
|
|
8883
|
-
var _a;
|
|
8884
8898
|
const receiptsRef = useRef12(null);
|
|
8885
8899
|
const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
|
|
8886
8900
|
const [showRetry, setShowRetry] = useState24(false);
|
|
@@ -8950,7 +8964,10 @@ var PersonalForm = ({
|
|
|
8950
8964
|
), /* @__PURE__ */ React117.createElement("div", { className: "Layer__bank-transaction-mobile-list-item__actions" }, showReceiptUploads && /* @__PURE__ */ React117.createElement(
|
|
8951
8965
|
FileInput,
|
|
8952
8966
|
{
|
|
8953
|
-
onUpload: (
|
|
8967
|
+
onUpload: (files) => {
|
|
8968
|
+
var _a;
|
|
8969
|
+
return (_a = receiptsRef.current) == null ? void 0 : _a.uploadReceipt(files[0]);
|
|
8970
|
+
},
|
|
8954
8971
|
text: "Upload receipt",
|
|
8955
8972
|
iconOnly: true,
|
|
8956
8973
|
icon: /* @__PURE__ */ React117.createElement(Paperclip_default, null)
|
|
@@ -8977,7 +8994,7 @@ var MatchForm2 = ({
|
|
|
8977
8994
|
showReceiptUploads,
|
|
8978
8995
|
showDescriptions
|
|
8979
8996
|
}) => {
|
|
8980
|
-
var _a, _b
|
|
8997
|
+
var _a, _b;
|
|
8981
8998
|
const receiptsRef = useRef13(null);
|
|
8982
8999
|
const { match: matchBankTransaction2, isLoading } = useBankTransactionsContext();
|
|
8983
9000
|
const { memoText, setMemoText, saveMemoText } = useMemoTextContext();
|
|
@@ -9068,7 +9085,10 @@ var MatchForm2 = ({
|
|
|
9068
9085
|
), /* @__PURE__ */ React118.createElement("div", { className: "Layer__bank-transaction-mobile-list-item__actions" }, showReceiptUploads && /* @__PURE__ */ React118.createElement(
|
|
9069
9086
|
FileInput,
|
|
9070
9087
|
{
|
|
9071
|
-
onUpload: (
|
|
9088
|
+
onUpload: (files) => {
|
|
9089
|
+
var _a2;
|
|
9090
|
+
return (_a2 = receiptsRef.current) == null ? void 0 : _a2.uploadReceipt(files[0]);
|
|
9091
|
+
},
|
|
9072
9092
|
text: "Upload receipt",
|
|
9073
9093
|
iconOnly: true,
|
|
9074
9094
|
icon: /* @__PURE__ */ React118.createElement(Paperclip_default, null)
|
|
@@ -9094,7 +9114,7 @@ var SplitForm = ({
|
|
|
9094
9114
|
showReceiptUploads,
|
|
9095
9115
|
showDescriptions
|
|
9096
9116
|
}) => {
|
|
9097
|
-
var _a, _b, _c, _d
|
|
9117
|
+
var _a, _b, _c, _d;
|
|
9098
9118
|
const receiptsRef = useRef14(null);
|
|
9099
9119
|
const {
|
|
9100
9120
|
categorize: categorizeBankTransaction2,
|
|
@@ -9329,7 +9349,10 @@ var SplitForm = ({
|
|
|
9329
9349
|
), /* @__PURE__ */ React119.createElement("div", { className: "Layer__bank-transaction-mobile-list-item__actions" }, showReceiptUploads && /* @__PURE__ */ React119.createElement(
|
|
9330
9350
|
FileInput,
|
|
9331
9351
|
{
|
|
9332
|
-
onUpload: (
|
|
9352
|
+
onUpload: (files) => {
|
|
9353
|
+
var _a2;
|
|
9354
|
+
return (_a2 = receiptsRef.current) == null ? void 0 : _a2.uploadReceipt(files[0]);
|
|
9355
|
+
},
|
|
9333
9356
|
text: "Upload receipt",
|
|
9334
9357
|
iconOnly: true,
|
|
9335
9358
|
icon: /* @__PURE__ */ React119.createElement(Paperclip_default, null)
|
|
@@ -10118,7 +10141,7 @@ var isDateAllowedToBrowse = (date, business) => {
|
|
|
10118
10141
|
};
|
|
10119
10142
|
|
|
10120
10143
|
// src/components/DatePicker/DatePicker.tsx
|
|
10121
|
-
import React134, { useEffect as useEffect22, useRef as useRef16, useState as useState30 } from "react";
|
|
10144
|
+
import React134, { useEffect as useEffect22, useMemo as useMemo14, useRef as useRef16, useState as useState30 } from "react";
|
|
10122
10145
|
import * as RDP from "react-datepicker";
|
|
10123
10146
|
|
|
10124
10147
|
// src/components/DatePicker/DatePickerOptions.tsx
|
|
@@ -10191,6 +10214,7 @@ var DatePickerOptions = ({
|
|
|
10191
10214
|
|
|
10192
10215
|
// src/components/DatePicker/DatePicker.tsx
|
|
10193
10216
|
import classNames46 from "classnames";
|
|
10217
|
+
import { endOfDay, endOfMonth as endOfMonth3, endOfYear as endOfYear2 } from "date-fns";
|
|
10194
10218
|
var ReactDatePicker = RDP.default.default || RDP.default || RDP;
|
|
10195
10219
|
var getDefaultRangeDate = (date, mode, selected) => {
|
|
10196
10220
|
try {
|
|
@@ -10206,10 +10230,14 @@ var getDefaultRangeDate = (date, mode, selected) => {
|
|
|
10206
10230
|
}
|
|
10207
10231
|
};
|
|
10208
10232
|
var isRangeMode = (mode) => mode === "dayRangePicker" || mode === "monthRangePicker";
|
|
10233
|
+
var showNavigationArrows = (navigateArrows, isDesktop) => {
|
|
10234
|
+
return navigateArrows && (isDesktop && navigateArrows.includes("desktop") || !isDesktop && navigateArrows.includes("mobile"));
|
|
10235
|
+
};
|
|
10209
10236
|
var DatePicker = (_a) => {
|
|
10210
10237
|
var _b = _a, {
|
|
10211
10238
|
selected,
|
|
10212
10239
|
onChange,
|
|
10240
|
+
disabled,
|
|
10213
10241
|
mode = "dayPicker",
|
|
10214
10242
|
allowedModes,
|
|
10215
10243
|
dateFormat = mode === "monthPicker" || mode === "monthRangePicker" ? "MMM, yyyy" : mode === "timePicker" ? "h:mm aa" : "MMM d, yyyy",
|
|
@@ -10223,12 +10251,13 @@ var DatePicker = (_a) => {
|
|
|
10223
10251
|
minDate,
|
|
10224
10252
|
maxDate = /* @__PURE__ */ new Date(),
|
|
10225
10253
|
currentDateOption = true,
|
|
10226
|
-
navigateArrows = mode === "monthPicker",
|
|
10254
|
+
navigateArrows = mode === "monthPicker" ? ["mobile"] : void 0,
|
|
10227
10255
|
onChangeMode,
|
|
10228
10256
|
slots
|
|
10229
10257
|
} = _b, props = __objRest(_b, [
|
|
10230
10258
|
"selected",
|
|
10231
10259
|
"onChange",
|
|
10260
|
+
"disabled",
|
|
10232
10261
|
"mode",
|
|
10233
10262
|
"allowedModes",
|
|
10234
10263
|
"dateFormat",
|
|
@@ -10293,7 +10322,7 @@ var DatePicker = (_a) => {
|
|
|
10293
10322
|
const wrapperClassNames = classNames46(
|
|
10294
10323
|
"Layer__datepicker__wrapper",
|
|
10295
10324
|
mode === "timePicker" && "Layer__datepicker__time__wrapper",
|
|
10296
|
-
navigateArrows && "Layer__datepicker__wrapper--arrows"
|
|
10325
|
+
showNavigationArrows(navigateArrows, isDesktop) && "Layer__datepicker__wrapper--arrows"
|
|
10297
10326
|
);
|
|
10298
10327
|
const datePickerWrapperClassNames = classNames46(
|
|
10299
10328
|
"Layer__datepicker",
|
|
@@ -10324,6 +10353,8 @@ var DatePicker = (_a) => {
|
|
|
10324
10353
|
return selectedDates instanceof Date && selectedDates.toDateString() === currentDate.toDateString();
|
|
10325
10354
|
} else if (mode === "monthPicker") {
|
|
10326
10355
|
return selectedDates instanceof Date && selectedDates.getMonth() === currentDate.getMonth() && selectedDates.getFullYear() === currentDate.getFullYear();
|
|
10356
|
+
} else if (mode === "yearPicker") {
|
|
10357
|
+
return selectedDates instanceof Date && selectedDates.getFullYear() === currentDate.getFullYear();
|
|
10327
10358
|
}
|
|
10328
10359
|
return false;
|
|
10329
10360
|
};
|
|
@@ -10335,11 +10366,32 @@ var DatePicker = (_a) => {
|
|
|
10335
10366
|
setSelectedDates(
|
|
10336
10367
|
new Date(currentDate.getFullYear(), currentDate.getMonth(), 1)
|
|
10337
10368
|
);
|
|
10369
|
+
} else if (mode === "yearPicker") {
|
|
10370
|
+
setSelectedDates(
|
|
10371
|
+
new Date(currentDate.getFullYear(), 0, 1)
|
|
10372
|
+
);
|
|
10338
10373
|
}
|
|
10339
10374
|
};
|
|
10340
|
-
const isTodayOrAfter =
|
|
10341
|
-
|
|
10342
|
-
|
|
10375
|
+
const isTodayOrAfter = useMemo14(() => {
|
|
10376
|
+
switch (mode) {
|
|
10377
|
+
case "dayPicker":
|
|
10378
|
+
return Boolean(
|
|
10379
|
+
selectedDates instanceof Date && (endOfDay(selectedDates) >= endOfDay(/* @__PURE__ */ new Date()) || endOfDay(selectedDates) >= maxDate)
|
|
10380
|
+
);
|
|
10381
|
+
case "monthPicker":
|
|
10382
|
+
return Boolean(
|
|
10383
|
+
selectedDates instanceof Date && (endOfMonth3(selectedDates) >= endOfMonth3(/* @__PURE__ */ new Date()) || endOfMonth3(selectedDates) >= maxDate)
|
|
10384
|
+
);
|
|
10385
|
+
case "yearPicker":
|
|
10386
|
+
return Boolean(
|
|
10387
|
+
selectedDates instanceof Date && (endOfYear2(selectedDates) >= endOfYear2(/* @__PURE__ */ new Date()) || endOfYear2(selectedDates) >= maxDate)
|
|
10388
|
+
);
|
|
10389
|
+
default:
|
|
10390
|
+
return Boolean(
|
|
10391
|
+
selectedDates instanceof Date && (selectedDates >= /* @__PURE__ */ new Date() || selectedDates >= maxDate)
|
|
10392
|
+
);
|
|
10393
|
+
}
|
|
10394
|
+
}, [selectedDates, maxDate, mode]);
|
|
10343
10395
|
const isBeforeMinDate = Boolean(
|
|
10344
10396
|
minDate && selectedDates instanceof Date && selectedDates <= minDate
|
|
10345
10397
|
);
|
|
@@ -10360,6 +10412,14 @@ var DatePicker = (_a) => {
|
|
|
10360
10412
|
)
|
|
10361
10413
|
)
|
|
10362
10414
|
);
|
|
10415
|
+
} else if (mode === "yearPicker") {
|
|
10416
|
+
setSelectedDates(
|
|
10417
|
+
new Date(
|
|
10418
|
+
selectedDates.setFullYear(
|
|
10419
|
+
selectedDates.getFullYear() + value
|
|
10420
|
+
)
|
|
10421
|
+
)
|
|
10422
|
+
);
|
|
10363
10423
|
}
|
|
10364
10424
|
};
|
|
10365
10425
|
const onChangeModeInternal = (mode2) => {
|
|
@@ -10394,6 +10454,7 @@ var DatePicker = (_a) => {
|
|
|
10394
10454
|
popperPlacement: "bottom-start",
|
|
10395
10455
|
selectsRange: isRangeMode(mode),
|
|
10396
10456
|
showMonthYearPicker: mode === "monthPicker" || mode === "monthRangePicker",
|
|
10457
|
+
showYearPicker: mode === "yearPicker",
|
|
10397
10458
|
dateFormat,
|
|
10398
10459
|
renderDayContents: (day) => /* @__PURE__ */ React134.createElement("span", { className: "Layer__datepicker__day-contents" }, day),
|
|
10399
10460
|
timeIntervals,
|
|
@@ -10426,7 +10487,8 @@ var DatePicker = (_a) => {
|
|
|
10426
10487
|
if (pickerRef.current && !isDesktop) {
|
|
10427
10488
|
pickerRef.current.setOpen(!pickerRef.current.isCalendarOpen());
|
|
10428
10489
|
}
|
|
10429
|
-
}
|
|
10490
|
+
},
|
|
10491
|
+
disabled
|
|
10430
10492
|
}, props),
|
|
10431
10493
|
ModeSelector && /* @__PURE__ */ React134.createElement(
|
|
10432
10494
|
ModeSelector,
|
|
@@ -10443,7 +10505,7 @@ var DatePicker = (_a) => {
|
|
|
10443
10505
|
setSelectedDate: setSelectedDates
|
|
10444
10506
|
}
|
|
10445
10507
|
)
|
|
10446
|
-
), navigateArrows
|
|
10508
|
+
), showNavigationArrows(navigateArrows, isDesktop) && /* @__PURE__ */ React134.createElement(React134.Fragment, null, /* @__PURE__ */ React134.createElement(
|
|
10447
10509
|
Button,
|
|
10448
10510
|
{
|
|
10449
10511
|
"aria-label": "Previous Date",
|
|
@@ -10453,7 +10515,7 @@ var DatePicker = (_a) => {
|
|
|
10453
10515
|
),
|
|
10454
10516
|
onClick: () => changeDate(-1),
|
|
10455
10517
|
variant: "secondary" /* secondary */,
|
|
10456
|
-
disabled: isBeforeMinDate
|
|
10518
|
+
disabled: isBeforeMinDate || disabled
|
|
10457
10519
|
},
|
|
10458
10520
|
/* @__PURE__ */ React134.createElement(ChevronLeft_default, { className: "Layer__datepicker__button-icon", size: 16 })
|
|
10459
10521
|
), /* @__PURE__ */ React134.createElement(
|
|
@@ -10466,7 +10528,7 @@ var DatePicker = (_a) => {
|
|
|
10466
10528
|
isTodayOrAfter ? "Layer__datepicker__button--disabled" : void 0
|
|
10467
10529
|
),
|
|
10468
10530
|
onClick: () => changeDate(1),
|
|
10469
|
-
disabled: isTodayOrAfter
|
|
10531
|
+
disabled: isTodayOrAfter || disabled
|
|
10470
10532
|
},
|
|
10471
10533
|
/* @__PURE__ */ React134.createElement(
|
|
10472
10534
|
ChevronRight_default,
|
|
@@ -10475,13 +10537,13 @@ var DatePicker = (_a) => {
|
|
|
10475
10537
|
size: 16
|
|
10476
10538
|
}
|
|
10477
10539
|
)
|
|
10478
|
-
)), currentDateOption && (mode === "dayPicker" || mode === "monthPicker") && /* @__PURE__ */ React134.createElement(
|
|
10540
|
+
)), currentDateOption && (mode === "dayPicker" || mode === "monthPicker" || mode === "yearPicker") && /* @__PURE__ */ React134.createElement(
|
|
10479
10541
|
Button,
|
|
10480
10542
|
{
|
|
10481
10543
|
className: "Layer__datepicker__current-button",
|
|
10482
10544
|
onClick: setCurrentDate,
|
|
10483
10545
|
variant: "secondary" /* secondary */,
|
|
10484
|
-
disabled: isCurrentDate()
|
|
10546
|
+
disabled: isCurrentDate() || disabled
|
|
10485
10547
|
},
|
|
10486
10548
|
mode === "dayPicker" ? "Today" : "Current"
|
|
10487
10549
|
));
|
|
@@ -10489,7 +10551,7 @@ var DatePicker = (_a) => {
|
|
|
10489
10551
|
|
|
10490
10552
|
// src/components/BankTransactions/BankTransactionsHeader.tsx
|
|
10491
10553
|
import classNames47 from "classnames";
|
|
10492
|
-
import { endOfMonth as
|
|
10554
|
+
import { endOfMonth as endOfMonth4, startOfMonth as startOfMonth4 } from "date-fns";
|
|
10493
10555
|
var DownloadButton2 = ({
|
|
10494
10556
|
downloadButtonTextOverride,
|
|
10495
10557
|
iconOnly
|
|
@@ -10587,7 +10649,7 @@ var BankTransactionsHeader = ({
|
|
|
10587
10649
|
if (!Array.isArray(date)) {
|
|
10588
10650
|
setDateRange({
|
|
10589
10651
|
startDate: startOfMonth4(date),
|
|
10590
|
-
endDate:
|
|
10652
|
+
endDate: endOfMonth4(date)
|
|
10591
10653
|
});
|
|
10592
10654
|
}
|
|
10593
10655
|
},
|
|
@@ -10690,7 +10752,7 @@ var DataStates = ({
|
|
|
10690
10752
|
};
|
|
10691
10753
|
|
|
10692
10754
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
10693
|
-
import { endOfMonth as
|
|
10755
|
+
import { endOfMonth as endOfMonth5, startOfMonth as startOfMonth5 } from "date-fns";
|
|
10694
10756
|
var COMPONENT_NAME2 = "bank-transactions";
|
|
10695
10757
|
var categorizationEnabled = (mode) => {
|
|
10696
10758
|
if (mode === "bookkeeping-client") {
|
|
@@ -10723,7 +10785,7 @@ var BankTransactionsContent = ({
|
|
|
10723
10785
|
}) => {
|
|
10724
10786
|
const [defaultDateRange] = useState32(() => ({
|
|
10725
10787
|
startDate: startOfMonth5(/* @__PURE__ */ new Date()),
|
|
10726
|
-
endDate:
|
|
10788
|
+
endDate: endOfMonth5(/* @__PURE__ */ new Date())
|
|
10727
10789
|
}));
|
|
10728
10790
|
const scrollPaginationRef = useRef17(null);
|
|
10729
10791
|
const isVisible = useIsVisible(scrollPaginationRef);
|
|
@@ -10746,7 +10808,7 @@ var BankTransactionsContent = ({
|
|
|
10746
10808
|
removeAfterCategorize
|
|
10747
10809
|
} = useBankTransactionsContext();
|
|
10748
10810
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
10749
|
-
const isSyncing =
|
|
10811
|
+
const isSyncing = useMemo15(
|
|
10750
10812
|
() => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
|
|
10751
10813
|
[linkedAccounts]
|
|
10752
10814
|
);
|
|
@@ -10797,7 +10859,7 @@ var BankTransactionsContent = ({
|
|
|
10797
10859
|
return () => clearTimeout(timeoutLoad);
|
|
10798
10860
|
}
|
|
10799
10861
|
}, [loadingStatus]);
|
|
10800
|
-
const bankTransactions =
|
|
10862
|
+
const bankTransactions = useMemo15(() => {
|
|
10801
10863
|
if (monthlyView) {
|
|
10802
10864
|
return data;
|
|
10803
10865
|
}
|
|
@@ -11067,7 +11129,7 @@ var PNLComparisonContext = createContext11({
|
|
|
11067
11129
|
});
|
|
11068
11130
|
|
|
11069
11131
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
11070
|
-
import { useMemo as
|
|
11132
|
+
import { useMemo as useMemo17, useState as useState35 } from "react";
|
|
11071
11133
|
|
|
11072
11134
|
// src/utils/profitAndLossUtils.ts
|
|
11073
11135
|
var doesLineItemQualifies = (item) => {
|
|
@@ -11123,7 +11185,7 @@ var applyShare = (items, total) => {
|
|
|
11123
11185
|
};
|
|
11124
11186
|
|
|
11125
11187
|
// src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
|
|
11126
|
-
import { useEffect as useEffect25, useMemo as
|
|
11188
|
+
import { useEffect as useEffect25, useMemo as useMemo16, useState as useState34 } from "react";
|
|
11127
11189
|
import { startOfMonth as startOfMonth6, sub } from "date-fns";
|
|
11128
11190
|
import useSWR4 from "swr";
|
|
11129
11191
|
var buildDates = ({ currentDate }) => {
|
|
@@ -11154,7 +11216,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
11154
11216
|
const [date, setDate] = useState34(currentDate);
|
|
11155
11217
|
const [loaded, setLoaded] = useState34("initial");
|
|
11156
11218
|
const [data, setData] = useState34([]);
|
|
11157
|
-
const { startYear, startMonth, endYear, endMonth } =
|
|
11219
|
+
const { startYear, startMonth, endYear, endMonth } = useMemo16(() => {
|
|
11158
11220
|
return buildDates({ currentDate: date });
|
|
11159
11221
|
}, [date, businessId, tagFilter, reportingBasis]);
|
|
11160
11222
|
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(
|
|
@@ -11278,7 +11340,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
11278
11340
|
|
|
11279
11341
|
// src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
|
|
11280
11342
|
import { useEffect as useEffect26 } from "react";
|
|
11281
|
-
import { startOfMonth as startOfMonth7, endOfMonth as
|
|
11343
|
+
import { startOfMonth as startOfMonth7, endOfMonth as endOfMonth6, formatISO } from "date-fns";
|
|
11282
11344
|
import useSWR5 from "swr";
|
|
11283
11345
|
var useProfitAndLossQuery = ({
|
|
11284
11346
|
startDate,
|
|
@@ -11287,7 +11349,7 @@ var useProfitAndLossQuery = ({
|
|
|
11287
11349
|
reportingBasis
|
|
11288
11350
|
} = {
|
|
11289
11351
|
startDate: startOfMonth7(/* @__PURE__ */ new Date()),
|
|
11290
|
-
endDate:
|
|
11352
|
+
endDate: endOfMonth6(/* @__PURE__ */ new Date())
|
|
11291
11353
|
}) => {
|
|
11292
11354
|
var _a, _b;
|
|
11293
11355
|
const { businessId, syncTimestamps, read, hasBeenTouched } = useLayerContext();
|
|
@@ -11340,7 +11402,7 @@ var useProfitAndLossQuery = ({
|
|
|
11340
11402
|
};
|
|
11341
11403
|
|
|
11342
11404
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
11343
|
-
import { startOfMonth as startOfMonth8, endOfMonth as
|
|
11405
|
+
import { startOfMonth as startOfMonth8, endOfMonth as endOfMonth7 } from "date-fns";
|
|
11344
11406
|
var useProfitAndLoss = ({
|
|
11345
11407
|
startDate: initialStartDate,
|
|
11346
11408
|
endDate: initialEndDate,
|
|
@@ -11348,13 +11410,13 @@ var useProfitAndLoss = ({
|
|
|
11348
11410
|
reportingBasis
|
|
11349
11411
|
} = {
|
|
11350
11412
|
startDate: startOfMonth8(/* @__PURE__ */ new Date()),
|
|
11351
|
-
endDate:
|
|
11413
|
+
endDate: endOfMonth7(/* @__PURE__ */ new Date())
|
|
11352
11414
|
}) => {
|
|
11353
11415
|
const [startDate, setStartDate] = useState35(
|
|
11354
11416
|
initialStartDate || startOfMonth8(Date.now())
|
|
11355
11417
|
);
|
|
11356
11418
|
const [endDate, setEndDate] = useState35(
|
|
11357
|
-
initialEndDate ||
|
|
11419
|
+
initialEndDate || endOfMonth7(Date.now())
|
|
11358
11420
|
);
|
|
11359
11421
|
const [filters, setFilters] = useState35({
|
|
11360
11422
|
expenses: void 0,
|
|
@@ -11394,7 +11456,7 @@ var useProfitAndLoss = ({
|
|
|
11394
11456
|
})
|
|
11395
11457
|
}));
|
|
11396
11458
|
};
|
|
11397
|
-
const { filteredDataRevenue, filteredTotalRevenue } =
|
|
11459
|
+
const { filteredDataRevenue, filteredTotalRevenue } = useMemo17(() => {
|
|
11398
11460
|
var _a;
|
|
11399
11461
|
if (!data) {
|
|
11400
11462
|
return { filteredDataRevenue: [], filteredTotalRevenue: void 0 };
|
|
@@ -11446,7 +11508,7 @@ var useProfitAndLoss = ({
|
|
|
11446
11508
|
const withShare = applyShare(sorted, total);
|
|
11447
11509
|
return { filteredDataRevenue: withShare, filteredTotalRevenue: total };
|
|
11448
11510
|
}, [data, startDate, filters, sidebarScope, summaryData]);
|
|
11449
|
-
const { filteredDataExpenses, filteredTotalExpenses } =
|
|
11511
|
+
const { filteredDataExpenses, filteredTotalExpenses } = useMemo17(() => {
|
|
11450
11512
|
var _a;
|
|
11451
11513
|
if (!data) {
|
|
11452
11514
|
return { filteredDataExpenses: [], filteredTotalExpenses: void 0 };
|
|
@@ -11676,7 +11738,7 @@ var useProfitAndLossComparison = ({
|
|
|
11676
11738
|
};
|
|
11677
11739
|
|
|
11678
11740
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
11679
|
-
import React143, { useContext as useContext18, useEffect as useEffect29, useMemo as
|
|
11741
|
+
import React143, { useContext as useContext18, useEffect as useEffect29, useMemo as useMemo18, useState as useState38 } from "react";
|
|
11680
11742
|
|
|
11681
11743
|
// src/components/ProfitAndLossChart/ChartStateCard.tsx
|
|
11682
11744
|
import React141 from "react";
|
|
@@ -11803,7 +11865,7 @@ import classNames48 from "classnames";
|
|
|
11803
11865
|
import {
|
|
11804
11866
|
add,
|
|
11805
11867
|
differenceInMonths,
|
|
11806
|
-
endOfMonth as
|
|
11868
|
+
endOfMonth as endOfMonth8,
|
|
11807
11869
|
format,
|
|
11808
11870
|
startOfMonth as startOfMonth10,
|
|
11809
11871
|
sub as sub2
|
|
@@ -11837,37 +11899,37 @@ var getChartWindow = ({
|
|
|
11837
11899
|
if (differenceInMonths(startOfMonth10(chartWindow.start), current) === 0) {
|
|
11838
11900
|
return {
|
|
11839
11901
|
start: startOfMonth10(sub2(current, { months: 1 })),
|
|
11840
|
-
end:
|
|
11902
|
+
end: endOfMonth8(add(current, { months: 11 }))
|
|
11841
11903
|
};
|
|
11842
11904
|
}
|
|
11843
|
-
if (differenceInMonths(
|
|
11905
|
+
if (differenceInMonths(endOfMonth8(chartWindow.end), endOfMonth8(current)) === 1 && differenceInMonths(today, current) >= 1) {
|
|
11844
11906
|
return {
|
|
11845
11907
|
start: startOfMonth10(sub2(current, { months: 10 })),
|
|
11846
|
-
end:
|
|
11908
|
+
end: endOfMonth8(add(current, { months: 2 }))
|
|
11847
11909
|
};
|
|
11848
11910
|
}
|
|
11849
11911
|
if (differenceInMonths(current, startOfMonth10(chartWindow.end)) === 0 && differenceInMonths(current, startOfMonth10(today)) > 0) {
|
|
11850
11912
|
return {
|
|
11851
11913
|
start: startOfMonth10(sub2(current, { months: 11 })),
|
|
11852
|
-
end:
|
|
11914
|
+
end: endOfMonth8(add(current, { months: 1 }))
|
|
11853
11915
|
};
|
|
11854
11916
|
}
|
|
11855
11917
|
if (current >= yearAgo) {
|
|
11856
11918
|
return {
|
|
11857
11919
|
start: startOfMonth10(yearAgo),
|
|
11858
|
-
end:
|
|
11920
|
+
end: endOfMonth8(today)
|
|
11859
11921
|
};
|
|
11860
11922
|
}
|
|
11861
11923
|
if (Number(current) > Number(chartWindow.end)) {
|
|
11862
11924
|
return {
|
|
11863
11925
|
start: startOfMonth10(sub2(current, { months: 12 })),
|
|
11864
|
-
end:
|
|
11926
|
+
end: endOfMonth8(current)
|
|
11865
11927
|
};
|
|
11866
11928
|
}
|
|
11867
11929
|
if (differenceInMonths(current, startOfMonth10(chartWindow.start)) < 0) {
|
|
11868
11930
|
return {
|
|
11869
11931
|
start: startOfMonth10(current),
|
|
11870
|
-
end:
|
|
11932
|
+
end: endOfMonth8(add(current, { months: 11 }))
|
|
11871
11933
|
};
|
|
11872
11934
|
}
|
|
11873
11935
|
return chartWindow;
|
|
@@ -11906,9 +11968,9 @@ var ProfitAndLossChart = ({
|
|
|
11906
11968
|
const [barAnimActive, setBarAnimActive] = useState38(true);
|
|
11907
11969
|
const [chartWindow, setChartWindow] = useState38({
|
|
11908
11970
|
start: startOfMonth10(sub2(Date.now(), { months: 11 })),
|
|
11909
|
-
end:
|
|
11971
|
+
end: endOfMonth8(Date.now())
|
|
11910
11972
|
});
|
|
11911
|
-
const selectionMonth =
|
|
11973
|
+
const selectionMonth = useMemo18(
|
|
11912
11974
|
() => ({
|
|
11913
11975
|
year: localDateRange.startDate.getFullYear(),
|
|
11914
11976
|
month: localDateRange.startDate.getMonth()
|
|
@@ -11924,7 +11986,7 @@ var ProfitAndLossChart = ({
|
|
|
11924
11986
|
currentDate: startOfMonth10(Date.now()),
|
|
11925
11987
|
tagFilter
|
|
11926
11988
|
});
|
|
11927
|
-
const anyData =
|
|
11989
|
+
const anyData = useMemo18(() => {
|
|
11928
11990
|
return Boolean(
|
|
11929
11991
|
data == null ? void 0 : data.find(
|
|
11930
11992
|
(x) => x.income !== 0 || x.costOfGoodsSold !== 0 || x.grossProfit !== 0 || x.operatingExpenses !== 0 || x.profitBeforeTaxes !== 0 || x.taxes !== 0 || x.totalExpenses !== 0
|
|
@@ -11932,11 +11994,11 @@ var ProfitAndLossChart = ({
|
|
|
11932
11994
|
);
|
|
11933
11995
|
}, [data]);
|
|
11934
11996
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
11935
|
-
const isSyncing =
|
|
11997
|
+
const isSyncing = useMemo18(
|
|
11936
11998
|
() => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
|
|
11937
11999
|
[linkedAccounts]
|
|
11938
12000
|
);
|
|
11939
|
-
const loadingValue =
|
|
12001
|
+
const loadingValue = useMemo18(() => getLoadingValue(data), [data]);
|
|
11940
12002
|
useEffect29(() => {
|
|
11941
12003
|
if (loaded === "complete" && data) {
|
|
11942
12004
|
const foundCurrent = data.find(
|
|
@@ -11995,7 +12057,7 @@ var ProfitAndLossChart = ({
|
|
|
11995
12057
|
loading: (pnl == null ? void 0 : pnl.isLoading) ? loadingValue : 0,
|
|
11996
12058
|
loadingExpenses: (pnl == null ? void 0 : pnl.isLoading) ? -loadingValue : 0
|
|
11997
12059
|
});
|
|
11998
|
-
const theData =
|
|
12060
|
+
const theData = useMemo18(() => {
|
|
11999
12061
|
var _a;
|
|
12000
12062
|
if (loaded !== "complete" || loaded === "complete" && !anyData) {
|
|
12001
12063
|
const loadingData = [];
|
|
@@ -12061,7 +12123,7 @@ var ProfitAndLossChart = ({
|
|
|
12061
12123
|
if (isMonthAllowed) {
|
|
12062
12124
|
changeDateRange({
|
|
12063
12125
|
startDate: new Date(year, month - 1, 1),
|
|
12064
|
-
endDate:
|
|
12126
|
+
endDate: endOfMonth8(new Date(year, month - 1, 1))
|
|
12065
12127
|
});
|
|
12066
12128
|
}
|
|
12067
12129
|
}
|
|
@@ -12615,7 +12677,8 @@ var DATE_RANGE_MODE_CONFIG = {
|
|
|
12615
12677
|
dayPicker: { label: "Day" },
|
|
12616
12678
|
dayRangePicker: { label: "Select dates" },
|
|
12617
12679
|
monthPicker: { label: "Month" },
|
|
12618
|
-
monthRangePicker: { label: "Select months" }
|
|
12680
|
+
monthRangePicker: { label: "Select months" },
|
|
12681
|
+
yearPicker: { label: "Year" }
|
|
12619
12682
|
};
|
|
12620
12683
|
function toToggleOptions(allowedModes) {
|
|
12621
12684
|
return allowedModes.map((mode) => ({
|
|
@@ -12649,7 +12712,7 @@ function DatePickerModeSelector({
|
|
|
12649
12712
|
}
|
|
12650
12713
|
|
|
12651
12714
|
// src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
|
|
12652
|
-
import { endOfMonth as
|
|
12715
|
+
import { endOfMonth as endOfMonth9, startOfMonth as startOfMonth11 } from "date-fns";
|
|
12653
12716
|
var ProfitAndLossDatePicker = ({
|
|
12654
12717
|
allowedDatePickerModes,
|
|
12655
12718
|
datePickerMode: deprecated_datePickerMode,
|
|
@@ -12669,7 +12732,7 @@ var ProfitAndLossDatePicker = ({
|
|
|
12669
12732
|
if (compareMode && compareMonths > 0) {
|
|
12670
12733
|
refetch({
|
|
12671
12734
|
startDate: startOfMonth11(date),
|
|
12672
|
-
endDate:
|
|
12735
|
+
endDate: endOfMonth9(date)
|
|
12673
12736
|
});
|
|
12674
12737
|
}
|
|
12675
12738
|
};
|
|
@@ -12713,7 +12776,7 @@ var ProfitAndLossDatePicker = ({
|
|
|
12713
12776
|
getComparisonData(date);
|
|
12714
12777
|
changeDateRange({
|
|
12715
12778
|
startDate: startOfMonth11(date),
|
|
12716
|
-
endDate:
|
|
12779
|
+
endDate: endOfMonth9(date)
|
|
12717
12780
|
});
|
|
12718
12781
|
}
|
|
12719
12782
|
},
|
|
@@ -12765,7 +12828,7 @@ var X2 = (_a) => {
|
|
|
12765
12828
|
var X_default = X2;
|
|
12766
12829
|
|
|
12767
12830
|
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
12768
|
-
import React150, { useMemo as
|
|
12831
|
+
import React150, { useMemo as useMemo19 } from "react";
|
|
12769
12832
|
|
|
12770
12833
|
// src/utils/format.ts
|
|
12771
12834
|
var capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
@@ -13067,7 +13130,7 @@ var DetailedChart = ({
|
|
|
13067
13130
|
isLoading,
|
|
13068
13131
|
showDatePicker = true
|
|
13069
13132
|
}) => {
|
|
13070
|
-
const chartData =
|
|
13133
|
+
const chartData = useMemo19(() => {
|
|
13071
13134
|
if (!filteredData) {
|
|
13072
13135
|
return [];
|
|
13073
13136
|
}
|
|
@@ -13525,7 +13588,7 @@ var ProfitAndLossDownloadButton = ({
|
|
|
13525
13588
|
};
|
|
13526
13589
|
|
|
13527
13590
|
// src/components/ProfitAndLossHeader/ProfitAndLossHeader.tsx
|
|
13528
|
-
import React155, { useMemo as
|
|
13591
|
+
import React155, { useMemo as useMemo20 } from "react";
|
|
13529
13592
|
|
|
13530
13593
|
// src/components/SyncingBadge/SyncingBadge.tsx
|
|
13531
13594
|
import React154 from "react";
|
|
@@ -13549,7 +13612,7 @@ var ProfitAndLossHeader = ({
|
|
|
13549
13612
|
withDatePicker
|
|
13550
13613
|
}) => {
|
|
13551
13614
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
13552
|
-
const isSyncing =
|
|
13615
|
+
const isSyncing = useMemo20(
|
|
13553
13616
|
() => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
|
|
13554
13617
|
[linkedAccounts]
|
|
13555
13618
|
);
|
|
@@ -13763,17 +13826,17 @@ var ProfitAndLossReport = ({
|
|
|
13763
13826
|
};
|
|
13764
13827
|
|
|
13765
13828
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
13766
|
-
import React167, { useContext as useContext24, useMemo as
|
|
13829
|
+
import React167, { useContext as useContext24, useMemo as useMemo24 } from "react";
|
|
13767
13830
|
|
|
13768
13831
|
// src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesList.tsx
|
|
13769
|
-
import React163, { useMemo as
|
|
13832
|
+
import React163, { useMemo as useMemo21 } from "react";
|
|
13770
13833
|
var LIST_ITEM_CLASS_NAME = "Layer__ProfitAndLossSummariesListItem";
|
|
13771
13834
|
function ProfitAndLossSummariesListItem({
|
|
13772
13835
|
children,
|
|
13773
13836
|
isActive,
|
|
13774
13837
|
onClick
|
|
13775
13838
|
}) {
|
|
13776
|
-
const dataProperties =
|
|
13839
|
+
const dataProperties = useMemo21(
|
|
13777
13840
|
() => toDataProperties({ active: isActive, clickable: !!onClick }),
|
|
13778
13841
|
[isActive]
|
|
13779
13842
|
);
|
|
@@ -13784,7 +13847,7 @@ function ProfitAndLossSummariesList({
|
|
|
13784
13847
|
children,
|
|
13785
13848
|
itemCount
|
|
13786
13849
|
}) {
|
|
13787
|
-
const dataProperties =
|
|
13850
|
+
const dataProperties = useMemo21(
|
|
13788
13851
|
() => toDataProperties({ ["column-count"]: itemCount }),
|
|
13789
13852
|
[itemCount]
|
|
13790
13853
|
);
|
|
@@ -13877,10 +13940,10 @@ function ProfitAndLossSummariesMiniChart({
|
|
|
13877
13940
|
}
|
|
13878
13941
|
|
|
13879
13942
|
// src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesSummary.tsx
|
|
13880
|
-
import React166, { useMemo as
|
|
13943
|
+
import React166, { useMemo as useMemo23 } from "react";
|
|
13881
13944
|
|
|
13882
13945
|
// src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesHeading.tsx
|
|
13883
|
-
import { useMemo as
|
|
13946
|
+
import { useMemo as useMemo22 } from "react";
|
|
13884
13947
|
import React165 from "react";
|
|
13885
13948
|
var HEADING_CLASS_NAME2 = "Layer__ProfitAndLossSummariesSummaryHeading";
|
|
13886
13949
|
function ProfitAndLossSummariesHeading({
|
|
@@ -13888,7 +13951,7 @@ function ProfitAndLossSummariesHeading({
|
|
|
13888
13951
|
children
|
|
13889
13952
|
}) {
|
|
13890
13953
|
const { size = "sm" } = variants != null ? variants : {};
|
|
13891
|
-
const labelDataProperties =
|
|
13954
|
+
const labelDataProperties = useMemo22(() => toDataProperties({ size }), [size]);
|
|
13892
13955
|
return /* @__PURE__ */ React165.createElement("h3", __spreadValues({ className: HEADING_CLASS_NAME2 }, labelDataProperties), children);
|
|
13893
13956
|
}
|
|
13894
13957
|
|
|
@@ -13905,8 +13968,8 @@ function ProfitAndLossSummariesSummary({
|
|
|
13905
13968
|
}) {
|
|
13906
13969
|
const { Chart } = slots != null ? slots : {};
|
|
13907
13970
|
const { size = "sm" } = variants != null ? variants : {};
|
|
13908
|
-
const dataProperties =
|
|
13909
|
-
const amountDataProperties =
|
|
13971
|
+
const dataProperties = useMemo23(() => toDataProperties({ size }), [size]);
|
|
13972
|
+
const amountDataProperties = useMemo23(
|
|
13910
13973
|
() => toDataProperties({
|
|
13911
13974
|
positive: amount >= 0,
|
|
13912
13975
|
negative: amount < 0,
|
|
@@ -13936,7 +13999,7 @@ function Internal_ProfitAndLossSummaries({
|
|
|
13936
13999
|
sidebarScope
|
|
13937
14000
|
} = useContext24(ProfitAndLoss.Context);
|
|
13938
14001
|
const dataItem = Array.isArray(storedData) ? storedData[storedData.length - 1] : storedData;
|
|
13939
|
-
const { revenueChartData, expensesChartData } =
|
|
14002
|
+
const { revenueChartData, expensesChartData } = useMemo24(
|
|
13940
14003
|
() => ({
|
|
13941
14004
|
revenueChartData: toMiniChartData({ scope: "revenue", data: dataItem }),
|
|
13942
14005
|
expensesChartData: toMiniChartData({ scope: "expenses", data: dataItem })
|
|
@@ -14638,7 +14701,7 @@ var ProfitAndLossTableWithProvider = (props) => {
|
|
|
14638
14701
|
};
|
|
14639
14702
|
|
|
14640
14703
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
14641
|
-
import { endOfMonth as
|
|
14704
|
+
import { endOfMonth as endOfMonth10, startOfMonth as startOfMonth12 } from "date-fns";
|
|
14642
14705
|
var PNLContext = createContext13({
|
|
14643
14706
|
data: void 0,
|
|
14644
14707
|
filteredDataRevenue: [],
|
|
@@ -14650,7 +14713,7 @@ var PNLContext = createContext13({
|
|
|
14650
14713
|
error: void 0,
|
|
14651
14714
|
dateRange: {
|
|
14652
14715
|
startDate: startOfMonth12(/* @__PURE__ */ new Date()),
|
|
14653
|
-
endDate:
|
|
14716
|
+
endDate: endOfMonth10(/* @__PURE__ */ new Date())
|
|
14654
14717
|
},
|
|
14655
14718
|
changeDateRange: () => {
|
|
14656
14719
|
},
|
|
@@ -15266,7 +15329,7 @@ var STATEMENT_OF_CASH_FLOW_ROWS = [
|
|
|
15266
15329
|
];
|
|
15267
15330
|
|
|
15268
15331
|
// src/components/StatementOfCashFlow/StatementOfCashFlow.tsx
|
|
15269
|
-
import { endOfMonth as
|
|
15332
|
+
import { endOfMonth as endOfMonth11, startOfDay as startOfDay4, startOfMonth as startOfMonth13, subWeeks } from "date-fns";
|
|
15270
15333
|
|
|
15271
15334
|
// src/components/StatementOfCashFlow/download/CashflowStatementDownloadButton.tsx
|
|
15272
15335
|
import React186 from "react";
|
|
@@ -15396,7 +15459,7 @@ var StatementOfCashFlowView = ({
|
|
|
15396
15459
|
onChange: (dates) => {
|
|
15397
15460
|
if (!Array.isArray(dates)) {
|
|
15398
15461
|
const date = dates;
|
|
15399
|
-
handleDateChange([startOfMonth13(date),
|
|
15462
|
+
handleDateChange([startOfMonth13(date), endOfMonth11(date)]);
|
|
15400
15463
|
}
|
|
15401
15464
|
},
|
|
15402
15465
|
dateFormat: "MMM",
|
|
@@ -15452,7 +15515,7 @@ import React202, { useContext as useContext36 } from "react";
|
|
|
15452
15515
|
|
|
15453
15516
|
// src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
|
|
15454
15517
|
import { createContext as createContext16 } from "react";
|
|
15455
|
-
import { endOfMonth as
|
|
15518
|
+
import { endOfMonth as endOfMonth12, startOfMonth as startOfMonth14 } from "date-fns";
|
|
15456
15519
|
var ChartOfAccountsContext = createContext16(
|
|
15457
15520
|
{
|
|
15458
15521
|
data: void 0,
|
|
@@ -15476,7 +15539,7 @@ var ChartOfAccountsContext = createContext16(
|
|
|
15476
15539
|
},
|
|
15477
15540
|
dateRange: {
|
|
15478
15541
|
startDate: startOfMonth14(/* @__PURE__ */ new Date()),
|
|
15479
|
-
endDate:
|
|
15542
|
+
endDate: endOfMonth12(/* @__PURE__ */ new Date())
|
|
15480
15543
|
},
|
|
15481
15544
|
changeDateRange: () => {
|
|
15482
15545
|
}
|
|
@@ -15711,7 +15774,7 @@ var LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE = {
|
|
|
15711
15774
|
};
|
|
15712
15775
|
|
|
15713
15776
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
15714
|
-
import { endOfMonth as
|
|
15777
|
+
import { endOfMonth as endOfMonth13, formatISO as formatISO2, startOfMonth as startOfMonth15 } from "date-fns";
|
|
15715
15778
|
import useSWR8 from "swr";
|
|
15716
15779
|
var validate = (formData) => {
|
|
15717
15780
|
const errors = [];
|
|
@@ -15796,7 +15859,7 @@ var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(
|
|
|
15796
15859
|
var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: initialEndDate } = {
|
|
15797
15860
|
withDates: false,
|
|
15798
15861
|
startDate: startOfMonth15(/* @__PURE__ */ new Date()),
|
|
15799
|
-
endDate:
|
|
15862
|
+
endDate: endOfMonth13(/* @__PURE__ */ new Date())
|
|
15800
15863
|
}) => {
|
|
15801
15864
|
const {
|
|
15802
15865
|
businessId,
|
|
@@ -15814,7 +15877,7 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
15814
15877
|
initialStartDate != null ? initialStartDate : startOfMonth15(Date.now())
|
|
15815
15878
|
);
|
|
15816
15879
|
const [endDate, setEndDate] = useState48(
|
|
15817
|
-
initialEndDate != null ? initialEndDate :
|
|
15880
|
+
initialEndDate != null ? initialEndDate : endOfMonth13(Date.now())
|
|
15818
15881
|
);
|
|
15819
15882
|
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `chart-of-accounts-${businessId}-${startDate == null ? void 0 : startDate.valueOf()}-${endDate == null ? void 0 : endDate.valueOf()}`;
|
|
15820
15883
|
const { data, isLoading, isValidating, error, mutate } = useSWR8(
|
|
@@ -16131,7 +16194,7 @@ var Plus_default = Plus;
|
|
|
16131
16194
|
|
|
16132
16195
|
// src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
|
|
16133
16196
|
import React189, { useContext as useContext29 } from "react";
|
|
16134
|
-
import { endOfMonth as
|
|
16197
|
+
import { endOfMonth as endOfMonth14, startOfMonth as startOfMonth16 } from "date-fns";
|
|
16135
16198
|
var ChartOfAccountsDatePicker = () => {
|
|
16136
16199
|
const { changeDateRange, dateRange } = useContext29(ChartOfAccountsContext);
|
|
16137
16200
|
return /* @__PURE__ */ React189.createElement(
|
|
@@ -16143,7 +16206,7 @@ var ChartOfAccountsDatePicker = () => {
|
|
|
16143
16206
|
if (!Array.isArray(date)) {
|
|
16144
16207
|
changeDateRange({
|
|
16145
16208
|
startDate: startOfMonth16(date),
|
|
16146
|
-
endDate:
|
|
16209
|
+
endDate: endOfMonth14(date)
|
|
16147
16210
|
});
|
|
16148
16211
|
}
|
|
16149
16212
|
}
|
|
@@ -16155,13 +16218,13 @@ var ChartOfAccountsDatePicker = () => {
|
|
|
16155
16218
|
import React191 from "react";
|
|
16156
16219
|
|
|
16157
16220
|
// src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
|
|
16158
|
-
import React190, { useContext as useContext30, useMemo as
|
|
16221
|
+
import React190, { useContext as useContext30, useMemo as useMemo26 } from "react";
|
|
16159
16222
|
|
|
16160
16223
|
// src/components/ChartOfAccountsForm/useParentOptions.ts
|
|
16161
|
-
import { useMemo as
|
|
16224
|
+
import { useMemo as useMemo25 } from "react";
|
|
16162
16225
|
var useParentOptions = (data) => {
|
|
16163
16226
|
var _a;
|
|
16164
|
-
return
|
|
16227
|
+
return useMemo25(
|
|
16165
16228
|
() => 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) => {
|
|
16166
16229
|
return {
|
|
16167
16230
|
label: x.name,
|
|
@@ -16187,7 +16250,7 @@ var ChartOfAccountsForm = ({
|
|
|
16187
16250
|
apiError
|
|
16188
16251
|
} = useContext30(ChartOfAccountsContext);
|
|
16189
16252
|
const parentOptions = useParentOptions(data);
|
|
16190
|
-
const entry =
|
|
16253
|
+
const entry = useMemo26(() => {
|
|
16191
16254
|
if ((form == null ? void 0 : form.action) === "edit" && form.accountId) {
|
|
16192
16255
|
return flattenAccounts((data == null ? void 0 : data.accounts) || []).find(
|
|
16193
16256
|
(x) => x.id === form.accountId
|
|
@@ -16629,12 +16692,12 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
16629
16692
|
import React201, {
|
|
16630
16693
|
useContext as useContext35,
|
|
16631
16694
|
useEffect as useEffect43,
|
|
16632
|
-
useMemo as
|
|
16695
|
+
useMemo as useMemo28,
|
|
16633
16696
|
useState as useState53
|
|
16634
16697
|
} from "react";
|
|
16635
16698
|
|
|
16636
16699
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
16637
|
-
import React199, { useContext as useContext33, useMemo as
|
|
16700
|
+
import React199, { useContext as useContext33, useMemo as useMemo27 } from "react";
|
|
16638
16701
|
|
|
16639
16702
|
// src/utils/journal.ts
|
|
16640
16703
|
var getAccountIdentifierPayload = (journalLineItem) => {
|
|
@@ -16669,14 +16732,14 @@ import React196 from "react";
|
|
|
16669
16732
|
import { parseISO as parseISO12, format as formatTime10 } from "date-fns";
|
|
16670
16733
|
var DateTime = ({
|
|
16671
16734
|
value,
|
|
16672
|
-
format:
|
|
16735
|
+
format: format9,
|
|
16673
16736
|
dateFormat,
|
|
16674
16737
|
timeFormat,
|
|
16675
16738
|
onlyDate,
|
|
16676
16739
|
onlyTime
|
|
16677
16740
|
}) => {
|
|
16678
|
-
if (
|
|
16679
|
-
return /* @__PURE__ */ React196.createElement(Text, { className: "Layer__datetime" }, formatTime10(parseISO12(value),
|
|
16741
|
+
if (format9) {
|
|
16742
|
+
return /* @__PURE__ */ React196.createElement(Text, { className: "Layer__datetime" }, formatTime10(parseISO12(value), format9));
|
|
16680
16743
|
}
|
|
16681
16744
|
const date = formatTime10(parseISO12(value), dateFormat != null ? dateFormat : DATE_FORMAT);
|
|
16682
16745
|
const time = formatTime10(parseISO12(value), timeFormat != null ? timeFormat : TIME_FORMAT);
|
|
@@ -16843,7 +16906,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
16843
16906
|
}) => {
|
|
16844
16907
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
16845
16908
|
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = useContext33(LedgerAccountsContext);
|
|
16846
|
-
const { totalDebit, totalCredit } =
|
|
16909
|
+
const { totalDebit, totalCredit } = useMemo27(() => {
|
|
16847
16910
|
var _a2;
|
|
16848
16911
|
let totalDebit2 = 0;
|
|
16849
16912
|
let totalCredit2 = 0;
|
|
@@ -17102,12 +17165,12 @@ var LedgerAccount = ({
|
|
|
17102
17165
|
"Layer__ledger-account__index",
|
|
17103
17166
|
accountId && "open"
|
|
17104
17167
|
);
|
|
17105
|
-
const account =
|
|
17168
|
+
const account = useMemo28(() => {
|
|
17106
17169
|
return flattenAccounts((accountData == null ? void 0 : accountData.accounts) || []).find(
|
|
17107
17170
|
(x) => x.id === accountId
|
|
17108
17171
|
);
|
|
17109
17172
|
}, [accountId]);
|
|
17110
|
-
const data =
|
|
17173
|
+
const data = useMemo28(() => {
|
|
17111
17174
|
var _a2;
|
|
17112
17175
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
17113
17176
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
@@ -17541,13 +17604,13 @@ var useJournal = () => {
|
|
|
17541
17604
|
};
|
|
17542
17605
|
|
|
17543
17606
|
// src/components/JournalTable/JournalTableWithPanel.tsx
|
|
17544
|
-
import React208, { useContext as useContext42, useMemo as
|
|
17607
|
+
import React208, { useContext as useContext42, useMemo as useMemo30, useState as useState56 } from "react";
|
|
17545
17608
|
|
|
17546
17609
|
// src/components/JournalSidebar/JournalSidebar.tsx
|
|
17547
17610
|
import React206, { useContext as useContext40 } from "react";
|
|
17548
17611
|
|
|
17549
17612
|
// src/components/JournalEntryDetails/JournalEntryDetails.tsx
|
|
17550
|
-
import React203, { useContext as useContext37, useMemo as
|
|
17613
|
+
import React203, { useContext as useContext37, useMemo as useMemo29, useState as useState55 } from "react";
|
|
17551
17614
|
var JournalEntryDetails = () => {
|
|
17552
17615
|
var _a, _b, _c, _d;
|
|
17553
17616
|
const {
|
|
@@ -17561,13 +17624,13 @@ var JournalEntryDetails = () => {
|
|
|
17561
17624
|
} = useContext37(JournalContext);
|
|
17562
17625
|
const [reverseEntryProcessing, setReverseEntryProcessing] = useState55(false);
|
|
17563
17626
|
const [reverseEntryError, setReverseEntryError] = useState55();
|
|
17564
|
-
const entry =
|
|
17627
|
+
const entry = useMemo29(() => {
|
|
17565
17628
|
if (selectedEntryId && data) {
|
|
17566
17629
|
return data.find((x) => x.id === selectedEntryId);
|
|
17567
17630
|
}
|
|
17568
17631
|
return;
|
|
17569
17632
|
}, [data, selectedEntryId]);
|
|
17570
|
-
const sortedLineItems =
|
|
17633
|
+
const sortedLineItems = useMemo29(
|
|
17571
17634
|
() => {
|
|
17572
17635
|
var _a2;
|
|
17573
17636
|
return (_a2 = entry == null ? void 0 : entry.line_items) == null ? void 0 : _a2.sort(
|
|
@@ -18099,7 +18162,7 @@ var JournalTableWithPanel = ({
|
|
|
18099
18162
|
selectedEntryId,
|
|
18100
18163
|
addEntry
|
|
18101
18164
|
} = useContext42(JournalContext);
|
|
18102
|
-
const data =
|
|
18165
|
+
const data = useMemo30(() => {
|
|
18103
18166
|
var _a;
|
|
18104
18167
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
18105
18168
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
@@ -18214,31 +18277,47 @@ var JournalContent = ({
|
|
|
18214
18277
|
};
|
|
18215
18278
|
|
|
18216
18279
|
// src/components/Tasks/Tasks.tsx
|
|
18217
|
-
import
|
|
18280
|
+
import React218, {
|
|
18218
18281
|
createContext as createContext20,
|
|
18219
18282
|
useContext as useContext47,
|
|
18220
18283
|
useEffect as useEffect48,
|
|
18221
|
-
useMemo as
|
|
18284
|
+
useMemo as useMemo36,
|
|
18222
18285
|
useState as useState60
|
|
18223
18286
|
} from "react";
|
|
18224
18287
|
|
|
18225
18288
|
// src/contexts/TasksContext/TasksContext.tsx
|
|
18226
18289
|
import { createContext as createContext19 } from "react";
|
|
18290
|
+
import { endOfYear as endOfYear3, startOfYear as startOfYear2 } from "date-fns";
|
|
18227
18291
|
var TasksContext = createContext19({
|
|
18228
18292
|
data: void 0,
|
|
18229
18293
|
isLoading: false,
|
|
18230
18294
|
loadedStatus: "initial",
|
|
18231
18295
|
error: void 0,
|
|
18296
|
+
currentDate: /* @__PURE__ */ new Date(),
|
|
18297
|
+
setCurrentDate: () => {
|
|
18298
|
+
},
|
|
18299
|
+
dateRange: { startDate: startOfYear2(/* @__PURE__ */ new Date()), endDate: endOfYear3(/* @__PURE__ */ new Date()) },
|
|
18300
|
+
setDateRange: () => {
|
|
18301
|
+
},
|
|
18232
18302
|
refetch: () => {
|
|
18233
18303
|
},
|
|
18234
18304
|
submitResponseToTask: () => {
|
|
18235
18305
|
},
|
|
18236
|
-
|
|
18306
|
+
updateDocUploadTaskDescription: () => {
|
|
18307
|
+
},
|
|
18308
|
+
uploadDocumentsForTask: () => Promise.resolve(),
|
|
18309
|
+
deleteUploadsForTask: () => {
|
|
18237
18310
|
}
|
|
18238
18311
|
});
|
|
18239
18312
|
|
|
18240
18313
|
// src/hooks/useTasks/useTasks.tsx
|
|
18241
|
-
import { useEffect as useEffect46, useState as useState57 } from "react";
|
|
18314
|
+
import { useEffect as useEffect46, useMemo as useMemo31, useState as useState57 } from "react";
|
|
18315
|
+
|
|
18316
|
+
// src/types/tasks.ts
|
|
18317
|
+
var COMPLETED_TASK_TYPES = ["COMPLETED", "USER_MARKED_COMPLETED"];
|
|
18318
|
+
function isComplete(taskType) {
|
|
18319
|
+
return COMPLETED_TASK_TYPES.includes(taskType);
|
|
18320
|
+
}
|
|
18242
18321
|
|
|
18243
18322
|
// src/hooks/useTasks/mockData.ts
|
|
18244
18323
|
var mockData = [
|
|
@@ -18256,7 +18335,9 @@ var mockData = [
|
|
|
18256
18335
|
completed_at: null,
|
|
18257
18336
|
created_at: "2024-09-12T05:56:49.360176Z",
|
|
18258
18337
|
updated_at: "2024-09-12T05:56:49.360176Z",
|
|
18259
|
-
|
|
18338
|
+
effective_date: "2024-09-12T05:56:49.360176Z",
|
|
18339
|
+
document_type: "LOAN_STATEMENT",
|
|
18340
|
+
documents: []
|
|
18260
18341
|
},
|
|
18261
18342
|
{
|
|
18262
18343
|
id: "f49e6eb2-52d4-4872-b34a-2baf387b8593",
|
|
@@ -18272,25 +18353,67 @@ var mockData = [
|
|
|
18272
18353
|
completed_at: null,
|
|
18273
18354
|
created_at: "2024-09-12T05:56:49.360176Z",
|
|
18274
18355
|
updated_at: "2024-09-12T05:56:49.360176Z",
|
|
18275
|
-
|
|
18356
|
+
effective_date: "2024-09-12T05:56:49.360176Z",
|
|
18357
|
+
document_type: "BANK_STATEMENT",
|
|
18358
|
+
documents: []
|
|
18276
18359
|
}
|
|
18277
18360
|
];
|
|
18278
18361
|
|
|
18279
18362
|
// src/hooks/useTasks/useTasks.tsx
|
|
18280
18363
|
import useSWR11 from "swr";
|
|
18364
|
+
import { endOfYear as endOfYear4, formatISO as formatISO3, getMonth as getMonth2, getYear as getYear2, parseISO as parseISO15, startOfYear as startOfYear3 } from "date-fns";
|
|
18281
18365
|
var DEBUG_MODE = false;
|
|
18282
|
-
var useTasks = (
|
|
18366
|
+
var useTasks = ({
|
|
18367
|
+
startDate: initialStartDate = startOfYear3(/* @__PURE__ */ new Date()),
|
|
18368
|
+
endDate: initialEndDate = endOfYear4(/* @__PURE__ */ new Date())
|
|
18369
|
+
} = {}) => {
|
|
18283
18370
|
const [loadedStatus, setLoadedStatus] = useState57("initial");
|
|
18284
18371
|
const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
18285
18372
|
const { apiUrl } = useEnvironment();
|
|
18286
18373
|
const { data: auth } = useAuth();
|
|
18287
|
-
const
|
|
18374
|
+
const [dateRange, setDateRange] = useState57({
|
|
18375
|
+
startDate: initialStartDate,
|
|
18376
|
+
endDate: initialEndDate
|
|
18377
|
+
});
|
|
18378
|
+
const [currentDate, setCurrentDate] = useState57(/* @__PURE__ */ new Date());
|
|
18379
|
+
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `tasks-${businessId}-${dateRange.startDate}-${dateRange.endDate}`;
|
|
18288
18380
|
const { data, isLoading, isValidating, error, mutate } = useSWR11(
|
|
18289
18381
|
queryKey,
|
|
18290
18382
|
Layer.getTasks(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18291
|
-
params: {
|
|
18383
|
+
params: {
|
|
18384
|
+
businessId,
|
|
18385
|
+
startDate: formatISO3(dateRange.startDate.valueOf()),
|
|
18386
|
+
endDate: formatISO3(dateRange.endDate.valueOf())
|
|
18387
|
+
}
|
|
18292
18388
|
})
|
|
18293
18389
|
);
|
|
18390
|
+
const monthlyData = useMemo31(() => {
|
|
18391
|
+
if (data == null ? void 0 : data.data) {
|
|
18392
|
+
const grouped = data.data.reduce((acc, task) => {
|
|
18393
|
+
const effectiveDate = task.effective_date ? parseISO15(task.effective_date) : parseISO15(task.created_at);
|
|
18394
|
+
const year = getYear2(effectiveDate);
|
|
18395
|
+
const month = getMonth2(effectiveDate);
|
|
18396
|
+
const key = `${year}-${month}`;
|
|
18397
|
+
if (!acc[key]) {
|
|
18398
|
+
acc[key] = {
|
|
18399
|
+
year,
|
|
18400
|
+
month,
|
|
18401
|
+
total: 0,
|
|
18402
|
+
completed: 0,
|
|
18403
|
+
tasks: []
|
|
18404
|
+
};
|
|
18405
|
+
}
|
|
18406
|
+
acc[key].tasks.push(task);
|
|
18407
|
+
if (isComplete(task.status)) {
|
|
18408
|
+
acc[key].completed += 1;
|
|
18409
|
+
}
|
|
18410
|
+
acc[key].total += 1;
|
|
18411
|
+
return acc;
|
|
18412
|
+
}, {});
|
|
18413
|
+
return Object.values(grouped);
|
|
18414
|
+
}
|
|
18415
|
+
return [];
|
|
18416
|
+
}, [data]);
|
|
18294
18417
|
useEffect46(() => {
|
|
18295
18418
|
if (isLoading && loadedStatus === "initial") {
|
|
18296
18419
|
setLoadedStatus("loading");
|
|
@@ -18299,17 +18422,18 @@ var useTasks = () => {
|
|
|
18299
18422
|
}
|
|
18300
18423
|
}, [isLoading]);
|
|
18301
18424
|
const refetch = () => mutate();
|
|
18302
|
-
const
|
|
18303
|
-
const
|
|
18425
|
+
const uploadDocumentsForTask = (taskId, files, description) => __async(void 0, null, function* () {
|
|
18426
|
+
const uploadDocuments = Layer.completeTaskWithUpload(
|
|
18304
18427
|
apiUrl,
|
|
18305
18428
|
auth == null ? void 0 : auth.access_token
|
|
18306
18429
|
);
|
|
18307
|
-
|
|
18430
|
+
yield uploadDocuments({
|
|
18308
18431
|
businessId,
|
|
18309
18432
|
taskId,
|
|
18310
|
-
|
|
18433
|
+
files,
|
|
18434
|
+
description
|
|
18311
18435
|
}).then(refetch);
|
|
18312
|
-
};
|
|
18436
|
+
});
|
|
18313
18437
|
const submitResponseToTask2 = (taskId, userResponse) => {
|
|
18314
18438
|
if (!taskId || !userResponse || userResponse.length === 0)
|
|
18315
18439
|
return;
|
|
@@ -18322,6 +18446,21 @@ var useTasks = () => {
|
|
|
18322
18446
|
body: data2
|
|
18323
18447
|
}).then(() => refetch());
|
|
18324
18448
|
};
|
|
18449
|
+
const deleteUploadsForTask = (taskId) => {
|
|
18450
|
+
Layer.deleteTaskUploads(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18451
|
+
params: { businessId, taskId }
|
|
18452
|
+
}).then(() => refetch());
|
|
18453
|
+
};
|
|
18454
|
+
const updateDocUploadTaskDescription = (taskId, userResponse) => {
|
|
18455
|
+
const data2 = {
|
|
18456
|
+
type: "FreeResponse",
|
|
18457
|
+
user_response: userResponse
|
|
18458
|
+
};
|
|
18459
|
+
Layer.updateUploadDocumentTaskDescription(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18460
|
+
params: { businessId, taskId },
|
|
18461
|
+
body: data2
|
|
18462
|
+
}).then(() => refetch());
|
|
18463
|
+
};
|
|
18325
18464
|
useEffect46(() => {
|
|
18326
18465
|
if (queryKey && (isLoading || isValidating)) {
|
|
18327
18466
|
read("TASKS" /* TASKS */, queryKey);
|
|
@@ -18334,22 +18473,23 @@ var useTasks = () => {
|
|
|
18334
18473
|
}, [syncTimestamps]);
|
|
18335
18474
|
return {
|
|
18336
18475
|
data: DEBUG_MODE ? mockData : data == null ? void 0 : data.data,
|
|
18476
|
+
monthlyData,
|
|
18337
18477
|
isLoading,
|
|
18338
18478
|
loadedStatus,
|
|
18339
18479
|
isValidating,
|
|
18340
18480
|
error,
|
|
18481
|
+
currentDate,
|
|
18482
|
+
setCurrentDate,
|
|
18483
|
+
dateRange,
|
|
18484
|
+
setDateRange,
|
|
18341
18485
|
refetch,
|
|
18342
18486
|
submitResponseToTask: submitResponseToTask2,
|
|
18343
|
-
|
|
18487
|
+
uploadDocumentsForTask,
|
|
18488
|
+
deleteUploadsForTask,
|
|
18489
|
+
updateDocUploadTaskDescription
|
|
18344
18490
|
};
|
|
18345
18491
|
};
|
|
18346
18492
|
|
|
18347
|
-
// src/types/tasks.ts
|
|
18348
|
-
var COMPLETED_TASK_TYPES = ["COMPLETED", "USER_MARKED_COMPLETED"];
|
|
18349
|
-
function isComplete(taskType) {
|
|
18350
|
-
return COMPLETED_TASK_TYPES.includes(taskType);
|
|
18351
|
-
}
|
|
18352
|
-
|
|
18353
18493
|
// src/components/TasksHeader/TasksHeader.tsx
|
|
18354
18494
|
import React211, { useContext as useContext43 } from "react";
|
|
18355
18495
|
|
|
@@ -18444,6 +18584,8 @@ var ProgressIcon = (_a) => {
|
|
|
18444
18584
|
var ProgressIcon_default = ProgressIcon;
|
|
18445
18585
|
|
|
18446
18586
|
// src/components/TasksHeader/TasksHeader.tsx
|
|
18587
|
+
import { endOfYear as endOfYear5, getYear as getYear3, startOfYear as startOfYear4 } from "date-fns";
|
|
18588
|
+
import classNames66 from "classnames";
|
|
18447
18589
|
var ICONS = {
|
|
18448
18590
|
loading: {
|
|
18449
18591
|
icon: /* @__PURE__ */ React211.createElement(ProgressIcon_default, { size: 12, className: "Layer__anim--rotating" }),
|
|
@@ -18472,10 +18614,19 @@ var TasksHeader = ({
|
|
|
18472
18614
|
open,
|
|
18473
18615
|
toggleContent
|
|
18474
18616
|
}) => {
|
|
18475
|
-
const {
|
|
18617
|
+
const {
|
|
18618
|
+
data: tasks,
|
|
18619
|
+
loadedStatus,
|
|
18620
|
+
refetch,
|
|
18621
|
+
error,
|
|
18622
|
+
dateRange,
|
|
18623
|
+
setDateRange
|
|
18624
|
+
} = useContext43(TasksContext);
|
|
18625
|
+
const { business } = useLayerContext();
|
|
18476
18626
|
const completedTasks = tasks == null ? void 0 : tasks.filter((task) => isComplete(task.status)).length;
|
|
18477
18627
|
const badgeVariant = completedTasks === (tasks == null ? void 0 : tasks.length) ? ICONS.done : ICONS.pending;
|
|
18478
|
-
|
|
18628
|
+
const minDate = getEarliestDateToBrowse(business);
|
|
18629
|
+
return /* @__PURE__ */ React211.createElement("div", { className: classNames66("Layer__tasks-header", collapsable && "Layer__tasks-header--collapsable") }, /* @__PURE__ */ React211.createElement("div", { className: "Layer__tasks-header__left-col" }, /* @__PURE__ */ React211.createElement("div", { className: "Layer__tasks-header__left-col__title" }, /* @__PURE__ */ React211.createElement(Text, { size: "lg" /* lg */ }, tasksHeader), loadedStatus !== "complete" && !open ? /* @__PURE__ */ React211.createElement(Badge, { variant: ICONS.loading.badge, icon: ICONS.loading.icon }, ICONS.loading.text) : loadedStatus === "complete" && !open && (!tasks || error) ? /* @__PURE__ */ React211.createElement(
|
|
18479
18630
|
Badge,
|
|
18480
18631
|
{
|
|
18481
18632
|
onClick: () => refetch(),
|
|
@@ -18483,11 +18634,31 @@ var TasksHeader = ({
|
|
|
18483
18634
|
icon: ICONS.refresh.icon
|
|
18484
18635
|
},
|
|
18485
18636
|
ICONS.refresh.text
|
|
18486
|
-
) : loadedStatus === "complete" ? /* @__PURE__ */ React211.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text) : open ? null : /* @__PURE__ */ React211.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text)),
|
|
18637
|
+
) : loadedStatus === "complete" && !open ? /* @__PURE__ */ React211.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text) : open ? null : /* @__PURE__ */ React211.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text)), /* @__PURE__ */ React211.createElement("div", { className: "Layer__tasks-header__left-col__controls" }, /* @__PURE__ */ React211.createElement(
|
|
18638
|
+
DatePicker,
|
|
18639
|
+
{
|
|
18640
|
+
selected: dateRange.startDate,
|
|
18641
|
+
onChange: (dates) => {
|
|
18642
|
+
if (!Array.isArray(dates)) {
|
|
18643
|
+
setDateRange({
|
|
18644
|
+
startDate: startOfYear4(dates),
|
|
18645
|
+
endDate: endOfYear5(dates)
|
|
18646
|
+
});
|
|
18647
|
+
}
|
|
18648
|
+
},
|
|
18649
|
+
dateFormat: "YYYY",
|
|
18650
|
+
mode: "yearPicker",
|
|
18651
|
+
minDate,
|
|
18652
|
+
maxDate: endOfYear5(/* @__PURE__ */ new Date()),
|
|
18653
|
+
currentDateOption: false,
|
|
18654
|
+
navigateArrows: ["mobile", "desktop"],
|
|
18655
|
+
disabled: minDate && getYear3(minDate) === getYear3(/* @__PURE__ */ new Date())
|
|
18656
|
+
}
|
|
18657
|
+
), collapsable && /* @__PURE__ */ React211.createElement("div", { className: "Layer__tasks-header__left-col__expand" }, /* @__PURE__ */ React211.createElement(ExpandButton, { onClick: toggleContent, collapsed: !open })))));
|
|
18487
18658
|
};
|
|
18488
18659
|
|
|
18489
18660
|
// src/components/TasksList/TasksList.tsx
|
|
18490
|
-
import React214, { useContext as useContext45, useMemo as
|
|
18661
|
+
import React214, { useContext as useContext45, useMemo as useMemo33, useState as useState59 } from "react";
|
|
18491
18662
|
|
|
18492
18663
|
// src/icons/SmileIcon.tsx
|
|
18493
18664
|
import * as React212 from "react";
|
|
@@ -18544,32 +18715,97 @@ var SmileIcon = (_a) => {
|
|
|
18544
18715
|
var SmileIcon_default = SmileIcon;
|
|
18545
18716
|
|
|
18546
18717
|
// src/components/TasksListItem/TasksListItem.tsx
|
|
18547
|
-
import React213, { useContext as useContext44, useEffect as useEffect47, useState as useState58 } from "react";
|
|
18548
|
-
import
|
|
18718
|
+
import React213, { useContext as useContext44, useEffect as useEffect47, useMemo as useMemo32, useState as useState58 } from "react";
|
|
18719
|
+
import classNames67 from "classnames";
|
|
18549
18720
|
var TasksListItem = ({
|
|
18550
18721
|
task,
|
|
18551
18722
|
goToNextPageIfAllComplete,
|
|
18552
18723
|
defaultOpen
|
|
18553
18724
|
}) => {
|
|
18725
|
+
var _a;
|
|
18554
18726
|
const [isOpen, setIsOpen] = useState58(defaultOpen);
|
|
18555
18727
|
const [userResponse, setUserResponse] = useState58(task.user_response || "");
|
|
18556
|
-
const
|
|
18557
|
-
const
|
|
18728
|
+
const [selectedFiles, setSelectedFiles] = useState58();
|
|
18729
|
+
const {
|
|
18730
|
+
submitResponseToTask: submitResponseToTask2,
|
|
18731
|
+
uploadDocumentsForTask,
|
|
18732
|
+
deleteUploadsForTask,
|
|
18733
|
+
updateDocUploadTaskDescription
|
|
18734
|
+
} = useContext44(TasksContext);
|
|
18735
|
+
const taskBodyClassName = classNames67(
|
|
18558
18736
|
"Layer__tasks-list-item__body",
|
|
18559
18737
|
isOpen && "Layer__tasks-list-item__body--expanded",
|
|
18560
18738
|
isComplete(task.status) && "Layer__tasks-list-item--completed"
|
|
18561
18739
|
);
|
|
18562
|
-
const taskHeadClassName =
|
|
18740
|
+
const taskHeadClassName = classNames67(
|
|
18563
18741
|
"Layer__tasks-list-item__head-info",
|
|
18564
18742
|
isComplete(task.status) ? "Layer__tasks-list-item--completed" : "Layer__tasks-list-item--pending"
|
|
18565
18743
|
);
|
|
18566
|
-
const taskItemClassName =
|
|
18744
|
+
const taskItemClassName = classNames67(
|
|
18567
18745
|
"Layer__tasks-list-item",
|
|
18568
18746
|
isOpen && "Layer__tasks-list-item__expanded"
|
|
18569
18747
|
);
|
|
18570
18748
|
useEffect47(() => {
|
|
18571
18749
|
setIsOpen(defaultOpen);
|
|
18572
18750
|
}, [defaultOpen]);
|
|
18751
|
+
const uploadDocumentAction = useMemo32(() => {
|
|
18752
|
+
if (task.user_response_type === "UPLOAD_DOCUMENT") {
|
|
18753
|
+
if (task.status === "TODO") {
|
|
18754
|
+
if (!selectedFiles) {
|
|
18755
|
+
return /* @__PURE__ */ React213.createElement(
|
|
18756
|
+
FileInput,
|
|
18757
|
+
{
|
|
18758
|
+
onUpload: (files) => {
|
|
18759
|
+
setSelectedFiles(files);
|
|
18760
|
+
},
|
|
18761
|
+
text: "Select file(s)",
|
|
18762
|
+
allowMultipleUploads: true
|
|
18763
|
+
}
|
|
18764
|
+
);
|
|
18765
|
+
} else {
|
|
18766
|
+
return /* @__PURE__ */ React213.createElement(
|
|
18767
|
+
Button,
|
|
18768
|
+
{
|
|
18769
|
+
variant: "secondary" /* secondary */,
|
|
18770
|
+
onClick: () => __async(void 0, null, function* () {
|
|
18771
|
+
yield uploadDocumentsForTask(task.id, selectedFiles, userResponse);
|
|
18772
|
+
setIsOpen(false);
|
|
18773
|
+
goToNextPageIfAllComplete(task);
|
|
18774
|
+
setSelectedFiles(void 0);
|
|
18775
|
+
})
|
|
18776
|
+
},
|
|
18777
|
+
"Submit"
|
|
18778
|
+
);
|
|
18779
|
+
}
|
|
18780
|
+
} else if (task.status === "USER_MARKED_COMPLETED") {
|
|
18781
|
+
if (task.user_response && task.user_response != userResponse) {
|
|
18782
|
+
return /* @__PURE__ */ React213.createElement(
|
|
18783
|
+
Button,
|
|
18784
|
+
{
|
|
18785
|
+
variant: "secondary" /* secondary */,
|
|
18786
|
+
onClick: () => {
|
|
18787
|
+
updateDocUploadTaskDescription(task.id, userResponse);
|
|
18788
|
+
}
|
|
18789
|
+
},
|
|
18790
|
+
"Update"
|
|
18791
|
+
);
|
|
18792
|
+
} else {
|
|
18793
|
+
return /* @__PURE__ */ React213.createElement(
|
|
18794
|
+
Button,
|
|
18795
|
+
{
|
|
18796
|
+
variant: "secondary" /* secondary */,
|
|
18797
|
+
onClick: () => {
|
|
18798
|
+
deleteUploadsForTask(task.id);
|
|
18799
|
+
}
|
|
18800
|
+
},
|
|
18801
|
+
"Delete Uploads"
|
|
18802
|
+
);
|
|
18803
|
+
}
|
|
18804
|
+
} else {
|
|
18805
|
+
return null;
|
|
18806
|
+
}
|
|
18807
|
+
}
|
|
18808
|
+
}, [task, selectedFiles, userResponse]);
|
|
18573
18809
|
return /* @__PURE__ */ React213.createElement("div", { className: "Layer__tasks-list-item-wrapper" }, /* @__PURE__ */ React213.createElement("div", { className: taskItemClassName }, /* @__PURE__ */ React213.createElement(
|
|
18574
18810
|
"div",
|
|
18575
18811
|
{
|
|
@@ -18587,24 +18823,14 @@ var TasksListItem = ({
|
|
|
18587
18823
|
}
|
|
18588
18824
|
}
|
|
18589
18825
|
)
|
|
18590
|
-
), /* @__PURE__ */ React213.createElement("div", { className: taskBodyClassName }, /* @__PURE__ */ React213.createElement("div", { className: "Layer__tasks-list-item__body-info" }, /* @__PURE__ */ React213.createElement(Text, { size: "sm" /* sm */ }, task.question),
|
|
18826
|
+
), /* @__PURE__ */ React213.createElement("div", { className: taskBodyClassName }, /* @__PURE__ */ React213.createElement("div", { className: "Layer__tasks-list-item__body-info" }, /* @__PURE__ */ React213.createElement(Text, { size: "sm" /* sm */ }, task.question), /* @__PURE__ */ React213.createElement(
|
|
18591
18827
|
Textarea,
|
|
18592
18828
|
{
|
|
18593
18829
|
value: userResponse,
|
|
18830
|
+
placeholder: task.user_response_type === "UPLOAD_DOCUMENT" ? "Optional description" : "",
|
|
18594
18831
|
onChange: (e) => setUserResponse(e.target.value)
|
|
18595
18832
|
}
|
|
18596
|
-
) : null, /* @__PURE__ */ React213.createElement("div", { className: "Layer__tasks-list-item__actions" }, task.user_response_type === "UPLOAD_DOCUMENT" ? /* @__PURE__ */ React213.createElement(
|
|
18597
|
-
FileInput,
|
|
18598
|
-
{
|
|
18599
|
-
onUpload: (file) => {
|
|
18600
|
-
uploadDocumentForTask(task.id, file);
|
|
18601
|
-
setIsOpen(false);
|
|
18602
|
-
goToNextPageIfAllComplete(task);
|
|
18603
|
-
},
|
|
18604
|
-
text: "Upload file",
|
|
18605
|
-
disabled: task.completed_at != null || task.user_marked_completed_at != null || task.archived_at != null
|
|
18606
|
-
}
|
|
18607
|
-
) : /* @__PURE__ */ React213.createElement(
|
|
18833
|
+
), task.user_response_type === "UPLOAD_DOCUMENT" ? /* @__PURE__ */ React213.createElement("div", { className: "Layer__tasks-list__link-list" }, selectedFiles ? /* @__PURE__ */ React213.createElement("div", { className: "Layer__tasks-list__link-list-header" }, "Selected Files:") : task.documents ? /* @__PURE__ */ React213.createElement("div", { className: "Layer__tasks-list__link-list-header" }, "Uploaded Files:") : null, /* @__PURE__ */ React213.createElement("ul", { className: "Layer__tasks-list__links-list" }, (_a = task.documents) == null ? void 0 : _a.map((document2, idx) => /* @__PURE__ */ React213.createElement("li", { key: `uploaded-doc-name-${idx}` }, /* @__PURE__ */ React213.createElement("a", { className: "Layer__tasks-list-item__link", href: document2.presigned_url.presignedUrl }, document2.file_name))), selectedFiles == null ? void 0 : selectedFiles.map((file, idx) => /* @__PURE__ */ React213.createElement("li", { key: `selected-file-name-${idx}` }, /* @__PURE__ */ React213.createElement("a", { className: "Layer__tasks-list-item__link" }, file.name))))) : null, /* @__PURE__ */ React213.createElement("div", { className: "Layer__tasks-list-item__actions" }, task.user_response_type === "UPLOAD_DOCUMENT" ? uploadDocumentAction : /* @__PURE__ */ React213.createElement(
|
|
18608
18834
|
Button,
|
|
18609
18835
|
{
|
|
18610
18836
|
disabled: userResponse.length === 0 || userResponse === task.user_response,
|
|
@@ -18615,11 +18841,12 @@ var TasksListItem = ({
|
|
|
18615
18841
|
goToNextPageIfAllComplete(task);
|
|
18616
18842
|
}
|
|
18617
18843
|
},
|
|
18618
|
-
|
|
18844
|
+
task.user_response && task.user_response !== userResponse ? "Update" : "Save"
|
|
18619
18845
|
))))));
|
|
18620
18846
|
};
|
|
18621
18847
|
|
|
18622
18848
|
// src/components/TasksList/TasksList.tsx
|
|
18849
|
+
import { endOfMonth as endOfMonth15, isAfter, isBefore, parseISO as parseISO16, startOfMonth as startOfMonth17 } from "date-fns";
|
|
18623
18850
|
function paginateArray(array, chunkSize = 10) {
|
|
18624
18851
|
const result = [];
|
|
18625
18852
|
for (let i = 0; i < array.length; i += chunkSize) {
|
|
@@ -18630,7 +18857,13 @@ function paginateArray(array, chunkSize = 10) {
|
|
|
18630
18857
|
}
|
|
18631
18858
|
var TasksEmptyState = () => /* @__PURE__ */ React214.createElement("div", { className: "Layer__tasks-empty-state" }, /* @__PURE__ */ React214.createElement("div", { className: "Layer__tasks-icon" }, /* @__PURE__ */ React214.createElement(SmileIcon_default, null)), /* @__PURE__ */ React214.createElement(Text, { size: "sm" /* sm */ }, "There are no pending tasks!", /* @__PURE__ */ React214.createElement("br", null), " Great job!"));
|
|
18632
18859
|
var TasksList = ({ pageSize = 10 }) => {
|
|
18633
|
-
const { data:
|
|
18860
|
+
const { data: rawData, error, currentDate } = useContext45(TasksContext);
|
|
18861
|
+
const tasks = useMemo33(() => {
|
|
18862
|
+
return rawData == null ? void 0 : rawData.filter((x) => {
|
|
18863
|
+
const d = x.effective_date ? parseISO16(x.effective_date) : parseISO16(x.created_at);
|
|
18864
|
+
return !isBefore(d, startOfMonth17(currentDate)) && !isAfter(d, endOfMonth15(currentDate));
|
|
18865
|
+
});
|
|
18866
|
+
}, [rawData, currentDate]);
|
|
18634
18867
|
const firstPageWithIincompleteTasks = paginateArray(
|
|
18635
18868
|
tasks || [],
|
|
18636
18869
|
pageSize
|
|
@@ -18638,10 +18871,10 @@ var TasksList = ({ pageSize = 10 }) => {
|
|
|
18638
18871
|
const [currentPage, setCurrentPage] = useState59(
|
|
18639
18872
|
firstPageWithIincompleteTasks === -1 ? 1 : firstPageWithIincompleteTasks + 1
|
|
18640
18873
|
);
|
|
18641
|
-
const sortedTasks =
|
|
18874
|
+
const sortedTasks = useMemo33(() => {
|
|
18642
18875
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
18643
18876
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
18644
|
-
return tasks == null ? void 0 : tasks.slice(firstPageIndex, lastPageIndex);
|
|
18877
|
+
return tasks == null ? void 0 : tasks.sort((x) => isComplete(x.status) ? 1 : -1).slice(firstPageIndex, lastPageIndex);
|
|
18645
18878
|
}, [tasks, currentPage]);
|
|
18646
18879
|
const indexFirstIncomplete = sortedTasks == null ? void 0 : sortedTasks.findIndex(
|
|
18647
18880
|
(task) => !isComplete(task.status)
|
|
@@ -18672,12 +18905,18 @@ var TasksList = ({ pageSize = 10 }) => {
|
|
|
18672
18905
|
};
|
|
18673
18906
|
|
|
18674
18907
|
// src/components/TasksPending/TasksPending.tsx
|
|
18675
|
-
import React215, { useContext as useContext46 } from "react";
|
|
18676
|
-
import
|
|
18677
|
-
import { format as format7 } from "date-fns";
|
|
18908
|
+
import React215, { useContext as useContext46, useMemo as useMemo34 } from "react";
|
|
18909
|
+
import classNames68 from "classnames";
|
|
18910
|
+
import { endOfMonth as endOfMonth16, format as format7, isAfter as isAfter2, isBefore as isBefore2, parseISO as parseISO17, startOfMonth as startOfMonth18 } from "date-fns";
|
|
18678
18911
|
import { Cell as Cell4, Pie as Pie3, PieChart as PieChart4 } from "recharts";
|
|
18679
18912
|
var TasksPending = () => {
|
|
18680
|
-
const { data } = useContext46(TasksContext);
|
|
18913
|
+
const { data: rawData, currentDate } = useContext46(TasksContext);
|
|
18914
|
+
const data = useMemo34(() => {
|
|
18915
|
+
return rawData == null ? void 0 : rawData.filter((x) => {
|
|
18916
|
+
const d = x.effective_date ? parseISO17(x.effective_date) : parseISO17(x.created_at);
|
|
18917
|
+
return !isBefore2(d, startOfMonth18(currentDate)) && !isAfter2(d, endOfMonth16(currentDate));
|
|
18918
|
+
});
|
|
18919
|
+
}, [rawData, currentDate]);
|
|
18681
18920
|
const completedTasks = data == null ? void 0 : data.filter((task) => isComplete(task.status)).length;
|
|
18682
18921
|
const chartData = [
|
|
18683
18922
|
{
|
|
@@ -18689,10 +18928,10 @@ var TasksPending = () => {
|
|
|
18689
18928
|
value: data == null ? void 0 : data.filter((task) => !isComplete(task.status)).length
|
|
18690
18929
|
}
|
|
18691
18930
|
];
|
|
18692
|
-
const taskStatusClassName =
|
|
18931
|
+
const taskStatusClassName = classNames68(
|
|
18693
18932
|
completedTasks && completedTasks > 0 ? "Layer__tasks-pending-bar__status--done" : "Layer__tasks-pending-bar__status--pending"
|
|
18694
18933
|
);
|
|
18695
|
-
return /* @__PURE__ */ React215.createElement("div", { className: "Layer__tasks-pending" }, /* @__PURE__ */ React215.createElement(Text, { size: "lg" /* lg */ }, format7(
|
|
18934
|
+
return /* @__PURE__ */ React215.createElement("div", { className: "Layer__tasks-pending" }, /* @__PURE__ */ React215.createElement(Text, { size: "lg" /* lg */ }, format7(currentDate, "MMMM")), data && (data == null ? void 0 : data.length) > 0 ? /* @__PURE__ */ React215.createElement("div", { className: "Layer__tasks-pending-bar" }, /* @__PURE__ */ React215.createElement(Text, { size: "sm" /* sm */ }, /* @__PURE__ */ React215.createElement("span", { className: taskStatusClassName }, completedTasks), "/", data == null ? void 0 : data.length, " done"), /* @__PURE__ */ React215.createElement(PieChart4, { width: 24, height: 24, className: "mini-chart" }, /* @__PURE__ */ React215.createElement(
|
|
18696
18935
|
Pie3,
|
|
18697
18936
|
{
|
|
18698
18937
|
data: chartData,
|
|
@@ -18719,11 +18958,86 @@ var TasksPending = () => {
|
|
|
18719
18958
|
}
|
|
18720
18959
|
);
|
|
18721
18960
|
})
|
|
18722
|
-
))));
|
|
18961
|
+
))) : null);
|
|
18962
|
+
};
|
|
18963
|
+
|
|
18964
|
+
// src/components/TasksMonthSelector/TasksMonthSelector.tsx
|
|
18965
|
+
import React217, { useMemo as useMemo35 } from "react";
|
|
18966
|
+
import { endOfMonth as endOfMonth17, format as format8, getMonth as getMonth3, getYear as getYear4, isAfter as isAfter3, isBefore as isBefore3, set, startOfMonth as startOfMonth19 } from "date-fns";
|
|
18967
|
+
|
|
18968
|
+
// src/components/TasksMonthSelector/TaskMonthTile.tsx
|
|
18969
|
+
import React216 from "react";
|
|
18970
|
+
import classNames69 from "classnames";
|
|
18971
|
+
var TaskMonthTile = ({ monthData, onClick, active, disabled }) => {
|
|
18972
|
+
const isCompleted = monthData.total === monthData.completed;
|
|
18973
|
+
const baseClass = classNames69(
|
|
18974
|
+
"Layer__tasks-month-selector__month",
|
|
18975
|
+
isCompleted && "Layer__tasks-month-selector__month--completed",
|
|
18976
|
+
active && "Layer__tasks-month-selector__month--active",
|
|
18977
|
+
disabled && "Layer__tasks-month-selector__month--disabled"
|
|
18978
|
+
);
|
|
18979
|
+
return /* @__PURE__ */ React216.createElement("div", { className: baseClass, onClick: () => !disabled && onClick(monthData.startDate) }, /* @__PURE__ */ React216.createElement(Text, { size: "sm" /* sm */, className: "Layer__tasks-month-selector__month__str" }, monthData.monthStr), /* @__PURE__ */ React216.createElement(Text, { size: "sm" /* sm */, className: "Layer__tasks-month-selector__month__total" }, monthData.total > 0 && isCompleted ? monthData.total : ""), isCompleted && monthData.total > 0 && /* @__PURE__ */ React216.createElement("span", { className: "Layer__tasks-month-selector__month__completed" }, /* @__PURE__ */ React216.createElement(Check_default, { size: 12 })), !isCompleted && monthData.total > 0 && /* @__PURE__ */ React216.createElement("span", { className: "Layer__tasks-month-selector__month__incompleted" }, /* @__PURE__ */ React216.createElement(Text, { size: "sm" /* sm */ }, monthData.total), /* @__PURE__ */ React216.createElement(AlertCircle_default, { size: 12 })));
|
|
18980
|
+
};
|
|
18981
|
+
|
|
18982
|
+
// src/components/TasksMonthSelector/TasksMonthSelector.tsx
|
|
18983
|
+
var DEFAULT_TASK_DATA = {
|
|
18984
|
+
total: 0,
|
|
18985
|
+
completed: 0,
|
|
18986
|
+
tasks: []
|
|
18987
|
+
};
|
|
18988
|
+
var isCurrentMonth = (monthDate, currentDate) => getMonth3(currentDate) === getMonth3(monthDate) && getYear4(currentDate) === getYear4(monthDate);
|
|
18989
|
+
var TasksMonthSelector = ({ tasks, year, currentDate, onClick }) => {
|
|
18990
|
+
const { business } = useLayerContext();
|
|
18991
|
+
const minDate = useMemo35(() => {
|
|
18992
|
+
if (business) {
|
|
18993
|
+
const date = getEarliestDateToBrowse(business);
|
|
18994
|
+
if (date) {
|
|
18995
|
+
return startOfMonth19(date);
|
|
18996
|
+
}
|
|
18997
|
+
}
|
|
18998
|
+
return;
|
|
18999
|
+
}, [business]);
|
|
19000
|
+
const months = useMemo35(() => {
|
|
19001
|
+
return Array.from({ length: 12 }, (_, i) => {
|
|
19002
|
+
var _a;
|
|
19003
|
+
const startDate = set(
|
|
19004
|
+
/* @__PURE__ */ new Date(),
|
|
19005
|
+
{ year, month: i, date: 1, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }
|
|
19006
|
+
);
|
|
19007
|
+
const endDate = endOfMonth17(startDate);
|
|
19008
|
+
const disabled = minDate && isBefore3(startDate, minDate) || isAfter3(startDate, startOfMonth19(/* @__PURE__ */ new Date()));
|
|
19009
|
+
const taskData = (_a = tasks == null ? void 0 : tasks.find((x) => x.month === i && x.year === year)) != null ? _a : __spreadValues({
|
|
19010
|
+
monthStr: format8(startDate, "MMM"),
|
|
19011
|
+
year,
|
|
19012
|
+
month: i,
|
|
19013
|
+
startDate,
|
|
19014
|
+
endDate
|
|
19015
|
+
}, DEFAULT_TASK_DATA);
|
|
19016
|
+
return __spreadValues({
|
|
19017
|
+
monthStr: format8(startDate, "MMM"),
|
|
19018
|
+
startDate,
|
|
19019
|
+
endDate,
|
|
19020
|
+
disabled
|
|
19021
|
+
}, taskData);
|
|
19022
|
+
});
|
|
19023
|
+
}, [tasks, year, minDate]);
|
|
19024
|
+
return /* @__PURE__ */ React217.createElement("div", { className: "Layer__tasks-month-selector" }, months.map((month, idx) => {
|
|
19025
|
+
return /* @__PURE__ */ React217.createElement(
|
|
19026
|
+
TaskMonthTile,
|
|
19027
|
+
{
|
|
19028
|
+
key: idx,
|
|
19029
|
+
onClick,
|
|
19030
|
+
monthData: month,
|
|
19031
|
+
active: isCurrentMonth(month.startDate, currentDate),
|
|
19032
|
+
disabled: month.disabled
|
|
19033
|
+
}
|
|
19034
|
+
);
|
|
19035
|
+
}));
|
|
18723
19036
|
};
|
|
18724
19037
|
|
|
18725
19038
|
// src/components/Tasks/Tasks.tsx
|
|
18726
|
-
import
|
|
19039
|
+
import classNames70 from "classnames";
|
|
19040
|
+
import { endOfYear as endOfYear6, getYear as getYear5, startOfYear as startOfYear5 } from "date-fns";
|
|
18727
19041
|
var UseTasksContext = createContext20({
|
|
18728
19042
|
data: void 0,
|
|
18729
19043
|
isLoading: void 0,
|
|
@@ -18734,7 +19048,16 @@ var UseTasksContext = createContext20({
|
|
|
18734
19048
|
},
|
|
18735
19049
|
submitResponseToTask: () => {
|
|
18736
19050
|
},
|
|
18737
|
-
|
|
19051
|
+
uploadDocumentsForTask: () => Promise.resolve(),
|
|
19052
|
+
deleteUploadsForTask: () => {
|
|
19053
|
+
},
|
|
19054
|
+
updateDocUploadTaskDescription: () => {
|
|
19055
|
+
},
|
|
19056
|
+
currentDate: /* @__PURE__ */ new Date(),
|
|
19057
|
+
setCurrentDate: () => {
|
|
19058
|
+
},
|
|
19059
|
+
dateRange: { startDate: startOfYear5(/* @__PURE__ */ new Date()), endDate: endOfYear6(/* @__PURE__ */ new Date()) },
|
|
19060
|
+
setDateRange: () => {
|
|
18738
19061
|
}
|
|
18739
19062
|
});
|
|
18740
19063
|
var Tasks = ({
|
|
@@ -18745,7 +19068,7 @@ var Tasks = ({
|
|
|
18745
19068
|
// deprecated
|
|
18746
19069
|
stringOverrides
|
|
18747
19070
|
}) => {
|
|
18748
|
-
return /* @__PURE__ */
|
|
19071
|
+
return /* @__PURE__ */ React218.createElement(TasksProvider, null, /* @__PURE__ */ React218.createElement(
|
|
18749
19072
|
TasksComponent,
|
|
18750
19073
|
{
|
|
18751
19074
|
collapsable,
|
|
@@ -18758,7 +19081,7 @@ var Tasks = ({
|
|
|
18758
19081
|
};
|
|
18759
19082
|
var TasksProvider = ({ children }) => {
|
|
18760
19083
|
const contextData = useTasks();
|
|
18761
|
-
return /* @__PURE__ */
|
|
19084
|
+
return /* @__PURE__ */ React218.createElement(TasksContext.Provider, { value: contextData }, children);
|
|
18762
19085
|
};
|
|
18763
19086
|
var TasksComponent = ({
|
|
18764
19087
|
collapsable = false,
|
|
@@ -18768,8 +19091,16 @@ var TasksComponent = ({
|
|
|
18768
19091
|
// deprecated
|
|
18769
19092
|
stringOverrides
|
|
18770
19093
|
}) => {
|
|
18771
|
-
const {
|
|
18772
|
-
|
|
19094
|
+
const {
|
|
19095
|
+
isLoading,
|
|
19096
|
+
loadedStatus,
|
|
19097
|
+
data,
|
|
19098
|
+
monthlyData,
|
|
19099
|
+
currentDate,
|
|
19100
|
+
setCurrentDate,
|
|
19101
|
+
dateRange
|
|
19102
|
+
} = useContext47(TasksContext);
|
|
19103
|
+
const allComplete = useMemo36(() => {
|
|
18773
19104
|
if (!data) {
|
|
18774
19105
|
return void 0;
|
|
18775
19106
|
}
|
|
@@ -18786,7 +19117,7 @@ var TasksComponent = ({
|
|
|
18786
19117
|
setOpen(false);
|
|
18787
19118
|
}
|
|
18788
19119
|
}, [allComplete]);
|
|
18789
|
-
return /* @__PURE__ */
|
|
19120
|
+
return /* @__PURE__ */ React218.createElement("div", { className: "Layer__tasks-component" }, /* @__PURE__ */ React218.createElement(
|
|
18790
19121
|
TasksHeader,
|
|
18791
19122
|
{
|
|
18792
19123
|
tasksHeader: (stringOverrides == null ? void 0 : stringOverrides.header) || tasksHeader,
|
|
@@ -18794,29 +19125,37 @@ var TasksComponent = ({
|
|
|
18794
19125
|
open,
|
|
18795
19126
|
toggleContent: () => setOpen(!open)
|
|
18796
19127
|
}
|
|
18797
|
-
), /* @__PURE__ */
|
|
19128
|
+
), /* @__PURE__ */ React218.createElement(
|
|
18798
19129
|
"div",
|
|
18799
19130
|
{
|
|
18800
|
-
className:
|
|
19131
|
+
className: classNames70(
|
|
18801
19132
|
"Layer__tasks__content",
|
|
18802
19133
|
!open && "Layer__tasks__content--collapsed"
|
|
18803
19134
|
)
|
|
18804
19135
|
},
|
|
18805
|
-
isLoading || !data ? /* @__PURE__ */
|
|
19136
|
+
isLoading || !data ? /* @__PURE__ */ React218.createElement("div", { className: "Layer__tasks__loader-container" }, /* @__PURE__ */ React218.createElement(Loader2, null)) : /* @__PURE__ */ React218.createElement(React218.Fragment, null, /* @__PURE__ */ React218.createElement(
|
|
19137
|
+
TasksMonthSelector,
|
|
19138
|
+
{
|
|
19139
|
+
tasks: monthlyData,
|
|
19140
|
+
currentDate,
|
|
19141
|
+
onClick: setCurrentDate,
|
|
19142
|
+
year: getYear5(dateRange.startDate)
|
|
19143
|
+
}
|
|
19144
|
+
), /* @__PURE__ */ React218.createElement(TasksPending, null), /* @__PURE__ */ React218.createElement(TasksList, null))
|
|
18806
19145
|
));
|
|
18807
19146
|
};
|
|
18808
19147
|
|
|
18809
19148
|
// src/components/PlatformOnboarding/LinkAccounts.tsx
|
|
18810
|
-
import
|
|
19149
|
+
import React219, { useContext as useContext48, useMemo as useMemo37 } from "react";
|
|
18811
19150
|
var LinkAccounts = (_a) => {
|
|
18812
19151
|
var _b = _a, { inBox } = _b, props = __objRest(_b, ["inBox"]);
|
|
18813
|
-
const content =
|
|
19152
|
+
const content = useMemo37(() => {
|
|
18814
19153
|
if (inBox) {
|
|
18815
|
-
return /* @__PURE__ */
|
|
19154
|
+
return /* @__PURE__ */ React219.createElement("div", { className: "Layer__link-accounts__box" }, /* @__PURE__ */ React219.createElement(LinkAccountsContent, __spreadValues({}, props)));
|
|
18816
19155
|
}
|
|
18817
|
-
return /* @__PURE__ */
|
|
19156
|
+
return /* @__PURE__ */ React219.createElement(LinkAccountsContent, __spreadValues({}, props));
|
|
18818
19157
|
}, [inBox, props]);
|
|
18819
|
-
return /* @__PURE__ */
|
|
19158
|
+
return /* @__PURE__ */ React219.createElement(LinkedAccountsProvider, null, content);
|
|
18820
19159
|
};
|
|
18821
19160
|
var LinkAccountsContent = ({
|
|
18822
19161
|
title,
|
|
@@ -18831,7 +19170,7 @@ var LinkAccountsContent = ({
|
|
|
18831
19170
|
}) => {
|
|
18832
19171
|
var _a;
|
|
18833
19172
|
const { data, loadingStatus, error, refetchAccounts, addConnection } = useContext48(LinkedAccountsContext);
|
|
18834
|
-
return /* @__PURE__ */
|
|
19173
|
+
return /* @__PURE__ */ React219.createElement("div", { className: "Layer__link-accounts Layer__component" }, title && /* @__PURE__ */ React219.createElement(Heading, { size: "view" /* view */ }, title), data && data.length === 0 ? /* @__PURE__ */ React219.createElement("div", { className: "Layer__link-accounts__data-status-container" }, !hideLoading && loadingStatus !== "complete" ? /* @__PURE__ */ React219.createElement(Loader2, null) : null, Boolean(error) && /* @__PURE__ */ React219.createElement(
|
|
18835
19174
|
DataState,
|
|
18836
19175
|
{
|
|
18837
19176
|
status: "failed" /* failed */,
|
|
@@ -18839,7 +19178,7 @@ var LinkAccountsContent = ({
|
|
|
18839
19178
|
description: "Please try again later",
|
|
18840
19179
|
onRefresh: refetchAccounts
|
|
18841
19180
|
}
|
|
18842
|
-
)) : null, data && data.length > 0 ? /* @__PURE__ */
|
|
19181
|
+
)) : null, data && data.length > 0 ? /* @__PURE__ */ React219.createElement("div", { className: "Layer__link-accounts__list" }, data == null ? void 0 : data.map((account, index) => /* @__PURE__ */ React219.createElement(
|
|
18843
19182
|
LinkedAccountItemThumb,
|
|
18844
19183
|
{
|
|
18845
19184
|
key: index,
|
|
@@ -18849,33 +19188,33 @@ var LinkAccountsContent = ({
|
|
|
18849
19188
|
showBreakConnection,
|
|
18850
19189
|
asWidget
|
|
18851
19190
|
}
|
|
18852
|
-
))) : null, /* @__PURE__ */
|
|
19191
|
+
))) : null, /* @__PURE__ */ React219.createElement(
|
|
18853
19192
|
ActionableRow,
|
|
18854
19193
|
{
|
|
18855
|
-
iconBox: /* @__PURE__ */
|
|
19194
|
+
iconBox: /* @__PURE__ */ React219.createElement(PlaidIcon_default, null),
|
|
18856
19195
|
title: data && data.length > 0 ? "Connect my next business account" : "Connect accounts",
|
|
18857
19196
|
description: "Import data with one simple integration.",
|
|
18858
|
-
button: /* @__PURE__ */
|
|
19197
|
+
button: /* @__PURE__ */ React219.createElement(
|
|
18859
19198
|
Button,
|
|
18860
19199
|
{
|
|
18861
19200
|
onClick: () => addConnection("PLAID"),
|
|
18862
|
-
rightIcon: /* @__PURE__ */
|
|
19201
|
+
rightIcon: /* @__PURE__ */ React219.createElement(Link_default, { size: 12 }),
|
|
18863
19202
|
disabled: loadingStatus !== "complete"
|
|
18864
19203
|
},
|
|
18865
19204
|
data && data.length > 0 ? "Connect next" : "Connect"
|
|
18866
19205
|
)
|
|
18867
19206
|
}
|
|
18868
|
-
), /* @__PURE__ */
|
|
19207
|
+
), /* @__PURE__ */ React219.createElement(LinkedAccountsConfirmationModal, null), onBack || onNext ? /* @__PURE__ */ React219.createElement("div", { className: "Layer__link-accounts__footer" }, onBack && /* @__PURE__ */ React219.createElement(Button, { onClick: onBack, variant: "secondary" /* secondary */ }, (_a = stringOverrides == null ? void 0 : stringOverrides.backButtonText) != null ? _a : "Back"), onNext && /* @__PURE__ */ React219.createElement(Button, { onClick: onNext }, (stringOverrides == null ? void 0 : stringOverrides.nextButtonText) || "I\u2019m done connecting my business accounts")) : null);
|
|
18869
19208
|
};
|
|
18870
19209
|
|
|
18871
19210
|
// src/components/UpsellBanner/BookkeepingUpsellBar.tsx
|
|
18872
|
-
import
|
|
19211
|
+
import React221 from "react";
|
|
18873
19212
|
|
|
18874
19213
|
// src/icons/Coffee.tsx
|
|
18875
|
-
import * as
|
|
19214
|
+
import * as React220 from "react";
|
|
18876
19215
|
var CoffeeIcon = (_a) => {
|
|
18877
19216
|
var _b = _a, { size = 11 } = _b, props = __objRest(_b, ["size"]);
|
|
18878
|
-
return /* @__PURE__ */
|
|
19217
|
+
return /* @__PURE__ */ React220.createElement(
|
|
18879
19218
|
"svg",
|
|
18880
19219
|
__spreadProps(__spreadValues({
|
|
18881
19220
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -18885,7 +19224,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18885
19224
|
width: size,
|
|
18886
19225
|
height: size
|
|
18887
19226
|
}),
|
|
18888
|
-
/* @__PURE__ */
|
|
19227
|
+
/* @__PURE__ */ React220.createElement("g", { clipPath: "url(#clip0_5018_10141)" }, /* @__PURE__ */ React220.createElement(
|
|
18889
19228
|
"path",
|
|
18890
19229
|
{
|
|
18891
19230
|
d: "M3.25 4.16666H2.79167C2.30544 4.16666 1.83912 4.35981 1.4953 4.70363C1.15149 5.04744 0.958333 5.51376 0.958333 5.99999C0.958333 6.48622 1.15149 6.95254 1.4953 7.29635C1.83912 7.64017 2.30544 7.83332 2.79167 7.83332H3.25",
|
|
@@ -18893,7 +19232,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18893
19232
|
strokeLinecap: "round",
|
|
18894
19233
|
strokeLinejoin: "round"
|
|
18895
19234
|
}
|
|
18896
|
-
), /* @__PURE__ */
|
|
19235
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18897
19236
|
"path",
|
|
18898
19237
|
{
|
|
18899
19238
|
d: "M10.5834 4.16666H3.25004V8.29166C3.25004 8.77789 3.4432 9.2442 3.78701 9.58802C4.13083 9.93184 4.59714 10.125 5.08337 10.125H8.75004C9.23627 10.125 9.70259 9.93184 10.0464 9.58802C10.3902 9.2442 10.5834 8.77789 10.5834 8.29166V4.16666Z",
|
|
@@ -18901,7 +19240,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18901
19240
|
strokeLinecap: "round",
|
|
18902
19241
|
strokeLinejoin: "round"
|
|
18903
19242
|
}
|
|
18904
|
-
), /* @__PURE__ */
|
|
19243
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18905
19244
|
"path",
|
|
18906
19245
|
{
|
|
18907
19246
|
d: "M8.75 0.958344V2.33334",
|
|
@@ -18909,7 +19248,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18909
19248
|
strokeLinecap: "round",
|
|
18910
19249
|
strokeLinejoin: "round"
|
|
18911
19250
|
}
|
|
18912
|
-
), /* @__PURE__ */
|
|
19251
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18913
19252
|
"path",
|
|
18914
19253
|
{
|
|
18915
19254
|
d: "M6.91663 0.958344V2.33334",
|
|
@@ -18917,7 +19256,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18917
19256
|
strokeLinecap: "round",
|
|
18918
19257
|
strokeLinejoin: "round"
|
|
18919
19258
|
}
|
|
18920
|
-
), /* @__PURE__ */
|
|
19259
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18921
19260
|
"path",
|
|
18922
19261
|
{
|
|
18923
19262
|
d: "M5.08337 0.958344V2.33334",
|
|
@@ -18926,7 +19265,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18926
19265
|
strokeLinejoin: "round"
|
|
18927
19266
|
}
|
|
18928
19267
|
)),
|
|
18929
|
-
/* @__PURE__ */
|
|
19268
|
+
/* @__PURE__ */ React220.createElement("defs", null, /* @__PURE__ */ React220.createElement("clipPath", { id: "clip0_5018_10141" }, /* @__PURE__ */ React220.createElement(
|
|
18930
19269
|
"rect",
|
|
18931
19270
|
{
|
|
18932
19271
|
width: "11",
|
|
@@ -18944,30 +19283,30 @@ var BookkeepingUpsellBar = ({
|
|
|
18944
19283
|
onClick,
|
|
18945
19284
|
href
|
|
18946
19285
|
}) => {
|
|
18947
|
-
return /* @__PURE__ */
|
|
19286
|
+
return /* @__PURE__ */ React221.createElement("div", { className: "Layer__bar-banner Layer__bar-banner--bookkeeping" }, /* @__PURE__ */ React221.createElement("div", { className: "Layer__bar-banner__left-col" }, /* @__PURE__ */ React221.createElement(IconBox, null, /* @__PURE__ */ React221.createElement(Coffee_default, null)), /* @__PURE__ */ React221.createElement("div", { className: "Layer__bar-banner__text-container" }, /* @__PURE__ */ React221.createElement(Text, { size: "md" /* md */, weight: "bold" /* bold */ }, "Need help with your books?"), /* @__PURE__ */ React221.createElement(
|
|
18948
19287
|
Text,
|
|
18949
19288
|
{
|
|
18950
19289
|
size: "sm" /* sm */,
|
|
18951
19290
|
className: "Layer__bar-banner__text-container__desc"
|
|
18952
19291
|
},
|
|
18953
19292
|
"Order bookkeeping service supported by real humans."
|
|
18954
|
-
))), onClick ? /* @__PURE__ */
|
|
19293
|
+
))), onClick ? /* @__PURE__ */ React221.createElement(Button, { variant: "secondary" /* secondary */, onClick }, "Schedule a demo") : href ? /* @__PURE__ */ React221.createElement(Link2, { href, target: "_blank", variant: "secondary" /* secondary */ }, "Schedule a demo") : null);
|
|
18955
19294
|
};
|
|
18956
19295
|
|
|
18957
19296
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
18958
|
-
import
|
|
19297
|
+
import React223, { useState as useState61 } from "react";
|
|
18959
19298
|
|
|
18960
19299
|
// src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
|
|
18961
|
-
import
|
|
19300
|
+
import React222 from "react";
|
|
18962
19301
|
var CLASS_NAME7 = "Layer__BookkeepingProfitAndLossSummariesContainer";
|
|
18963
19302
|
function BookkeepingProfitAndLossSummariesContainer({
|
|
18964
19303
|
children
|
|
18965
19304
|
}) {
|
|
18966
|
-
return /* @__PURE__ */
|
|
19305
|
+
return /* @__PURE__ */ React222.createElement("div", { className: CLASS_NAME7 }, children);
|
|
18967
19306
|
}
|
|
18968
19307
|
|
|
18969
19308
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
18970
|
-
import
|
|
19309
|
+
import classNames71 from "classnames";
|
|
18971
19310
|
var BookkeepingOverview = ({
|
|
18972
19311
|
title,
|
|
18973
19312
|
showTitle = true,
|
|
@@ -18978,16 +19317,16 @@ var BookkeepingOverview = ({
|
|
|
18978
19317
|
const [pnlToggle, setPnlToggle] = useState61("expenses");
|
|
18979
19318
|
const [width] = useWindowSize();
|
|
18980
19319
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
18981
|
-
return /* @__PURE__ */
|
|
19320
|
+
return /* @__PURE__ */ React223.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React223.createElement(TasksProvider, null, /* @__PURE__ */ React223.createElement(
|
|
18982
19321
|
View,
|
|
18983
19322
|
{
|
|
18984
19323
|
viewClassName: "Layer__bookkeeping-overview--view",
|
|
18985
19324
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || "Bookkeeping overview",
|
|
18986
19325
|
withSidebar: width > 1100,
|
|
18987
|
-
sidebar: /* @__PURE__ */
|
|
19326
|
+
sidebar: /* @__PURE__ */ React223.createElement(TasksComponent, { stringOverrides: stringOverrides == null ? void 0 : stringOverrides.tasks }),
|
|
18988
19327
|
showHeader: showTitle
|
|
18989
19328
|
},
|
|
18990
|
-
width <= 1100 && /* @__PURE__ */
|
|
19329
|
+
width <= 1100 && /* @__PURE__ */ React223.createElement(
|
|
18991
19330
|
TasksComponent,
|
|
18992
19331
|
{
|
|
18993
19332
|
collapsable: true,
|
|
@@ -18995,30 +19334,30 @@ var BookkeepingOverview = ({
|
|
|
18995
19334
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.tasks
|
|
18996
19335
|
}
|
|
18997
19336
|
),
|
|
18998
|
-
/* @__PURE__ */
|
|
19337
|
+
/* @__PURE__ */ React223.createElement(
|
|
18999
19338
|
Container,
|
|
19000
19339
|
{
|
|
19001
19340
|
name: "bookkeeping-overview-profit-and-loss",
|
|
19002
19341
|
asWidget: true,
|
|
19003
19342
|
elevated: true
|
|
19004
19343
|
},
|
|
19005
|
-
/* @__PURE__ */
|
|
19344
|
+
/* @__PURE__ */ React223.createElement(
|
|
19006
19345
|
ProfitAndLoss.Header,
|
|
19007
19346
|
{
|
|
19008
19347
|
text: ((_c = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _c.header) || "Profit & Loss",
|
|
19009
19348
|
withDatePicker: true
|
|
19010
19349
|
}
|
|
19011
19350
|
),
|
|
19012
|
-
/* @__PURE__ */
|
|
19351
|
+
/* @__PURE__ */ React223.createElement(BookkeepingProfitAndLossSummariesContainer, null, /* @__PURE__ */ React223.createElement(
|
|
19013
19352
|
ProfitAndLoss.Summaries,
|
|
19014
19353
|
{
|
|
19015
19354
|
stringOverrides: (_d = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _d.summaries,
|
|
19016
19355
|
variants: profitAndLossSummariesVariants
|
|
19017
19356
|
}
|
|
19018
19357
|
)),
|
|
19019
|
-
/* @__PURE__ */
|
|
19358
|
+
/* @__PURE__ */ React223.createElement(ProfitAndLoss.Chart, null)
|
|
19020
19359
|
),
|
|
19021
|
-
/* @__PURE__ */
|
|
19360
|
+
/* @__PURE__ */ React223.createElement("div", { className: "Layer__bookkeeping-overview-profit-and-loss-charts" }, /* @__PURE__ */ React223.createElement(
|
|
19022
19361
|
Toggle,
|
|
19023
19362
|
{
|
|
19024
19363
|
name: "pnl-detailed-charts",
|
|
@@ -19035,15 +19374,15 @@ var BookkeepingOverview = ({
|
|
|
19035
19374
|
selected: pnlToggle,
|
|
19036
19375
|
onChange: (e) => setPnlToggle(e.target.value)
|
|
19037
19376
|
}
|
|
19038
|
-
), /* @__PURE__ */
|
|
19377
|
+
), /* @__PURE__ */ React223.createElement(
|
|
19039
19378
|
Container,
|
|
19040
19379
|
{
|
|
19041
|
-
name:
|
|
19380
|
+
name: classNames71(
|
|
19042
19381
|
"bookkeeping-overview-profit-and-loss-chart",
|
|
19043
19382
|
pnlToggle !== "revenue" && "bookkeeping-overview-profit-and-loss-chart--hidden"
|
|
19044
19383
|
)
|
|
19045
19384
|
},
|
|
19046
|
-
/* @__PURE__ */
|
|
19385
|
+
/* @__PURE__ */ React223.createElement(
|
|
19047
19386
|
ProfitAndLoss.DetailedCharts,
|
|
19048
19387
|
{
|
|
19049
19388
|
scope: "revenue",
|
|
@@ -19051,15 +19390,15 @@ var BookkeepingOverview = ({
|
|
|
19051
19390
|
stringOverrides: (_e = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _e.detailedCharts
|
|
19052
19391
|
}
|
|
19053
19392
|
)
|
|
19054
|
-
), /* @__PURE__ */
|
|
19393
|
+
), /* @__PURE__ */ React223.createElement(
|
|
19055
19394
|
Container,
|
|
19056
19395
|
{
|
|
19057
|
-
name:
|
|
19396
|
+
name: classNames71(
|
|
19058
19397
|
"bookkeeping-overview-profit-and-loss-chart",
|
|
19059
19398
|
pnlToggle !== "expenses" && "bookkeeping-overview-profit-and-loss-chart--hidden"
|
|
19060
19399
|
)
|
|
19061
19400
|
},
|
|
19062
|
-
/* @__PURE__ */
|
|
19401
|
+
/* @__PURE__ */ React223.createElement(
|
|
19063
19402
|
ProfitAndLoss.DetailedCharts,
|
|
19064
19403
|
{
|
|
19065
19404
|
scope: "expenses",
|
|
@@ -19072,19 +19411,19 @@ var BookkeepingOverview = ({
|
|
|
19072
19411
|
};
|
|
19073
19412
|
|
|
19074
19413
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
19075
|
-
import
|
|
19414
|
+
import React226, { useState as useState63 } from "react";
|
|
19076
19415
|
|
|
19077
19416
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
19078
|
-
import
|
|
19417
|
+
import React225, { useContext as useContext49, useEffect as useEffect49, useState as useState62 } from "react";
|
|
19079
19418
|
|
|
19080
19419
|
// src/components/BadgeLoader/BadgeLoader.tsx
|
|
19081
|
-
import
|
|
19420
|
+
import React224 from "react";
|
|
19082
19421
|
var BadgeLoader = ({ children }) => {
|
|
19083
|
-
return /* @__PURE__ */
|
|
19422
|
+
return /* @__PURE__ */ React224.createElement("span", { className: "Layer__loader Layer__loader--as-badge" }, /* @__PURE__ */ React224.createElement(Loader_default, { size: 11, className: "Layer__anim--rotating" }), children);
|
|
19084
19423
|
};
|
|
19085
19424
|
|
|
19086
19425
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
19087
|
-
import { getMonth as
|
|
19426
|
+
import { getMonth as getMonth4, getYear as getYear6, startOfMonth as startOfMonth20 } from "date-fns";
|
|
19088
19427
|
var CLASS_NAME8 = "Layer__TransactionsToReview";
|
|
19089
19428
|
function TransactionsToReview({
|
|
19090
19429
|
onClick,
|
|
@@ -19097,7 +19436,7 @@ function TransactionsToReview({
|
|
|
19097
19436
|
const dateRange = usePnlDateRange ? contextDateRange : void 0;
|
|
19098
19437
|
const [toReview, setToReview] = useState62(0);
|
|
19099
19438
|
const { data, loaded, error, refetch } = useProfitAndLossLTM({
|
|
19100
|
-
currentDate: dateRange ? dateRange.startDate :
|
|
19439
|
+
currentDate: dateRange ? dateRange.startDate : startOfMonth20(/* @__PURE__ */ new Date()),
|
|
19101
19440
|
tagFilter
|
|
19102
19441
|
});
|
|
19103
19442
|
useEffect49(() => {
|
|
@@ -19109,7 +19448,7 @@ function TransactionsToReview({
|
|
|
19109
19448
|
const checkTransactionsToReview = () => {
|
|
19110
19449
|
if (data && dateRange) {
|
|
19111
19450
|
const monthTx = data.filter(
|
|
19112
|
-
(x) => x.month - 1 ===
|
|
19451
|
+
(x) => x.month - 1 === getMonth4(dateRange.startDate) && x.year === getYear6(dateRange.startDate)
|
|
19113
19452
|
);
|
|
19114
19453
|
if (monthTx.length > 0) {
|
|
19115
19454
|
setToReview(monthTx[0].uncategorized_transactions);
|
|
@@ -19125,37 +19464,37 @@ function TransactionsToReview({
|
|
|
19125
19464
|
verticalGap = "sm";
|
|
19126
19465
|
break;
|
|
19127
19466
|
}
|
|
19128
|
-
return /* @__PURE__ */
|
|
19467
|
+
return /* @__PURE__ */ React225.createElement("div", { onClick, className: CLASS_NAME8 }, /* @__PURE__ */ React225.createElement(VStack, { gap: verticalGap, align: "start" }, /* @__PURE__ */ React225.createElement(ProfitAndLossSummariesHeading, { variants }, "Transactions to review"), loaded === "initial" || loaded === "loading" ? /* @__PURE__ */ React225.createElement(BadgeLoader, null) : null, loaded === "complete" && error ? /* @__PURE__ */ React225.createElement(
|
|
19129
19468
|
Badge,
|
|
19130
19469
|
{
|
|
19131
19470
|
variant: "error" /* ERROR */,
|
|
19132
19471
|
size: "small" /* SMALL */,
|
|
19133
|
-
icon: /* @__PURE__ */
|
|
19472
|
+
icon: /* @__PURE__ */ React225.createElement(RefreshCcw_default, { size: 12 }),
|
|
19134
19473
|
onClick: () => refetch()
|
|
19135
19474
|
},
|
|
19136
19475
|
"Refresh"
|
|
19137
|
-
) : null, loaded === "complete" && !error && toReview > 0 ? /* @__PURE__ */
|
|
19476
|
+
) : null, loaded === "complete" && !error && toReview > 0 ? /* @__PURE__ */ React225.createElement(
|
|
19138
19477
|
Badge,
|
|
19139
19478
|
{
|
|
19140
19479
|
variant: "warning" /* WARNING */,
|
|
19141
19480
|
size: "small" /* SMALL */,
|
|
19142
|
-
icon: /* @__PURE__ */
|
|
19481
|
+
icon: /* @__PURE__ */ React225.createElement(Bell_default, { size: 12 })
|
|
19143
19482
|
},
|
|
19144
19483
|
toReview,
|
|
19145
19484
|
" pending"
|
|
19146
|
-
) : null, loaded === "complete" && !error && toReview === 0 ? /* @__PURE__ */
|
|
19485
|
+
) : null, loaded === "complete" && !error && toReview === 0 ? /* @__PURE__ */ React225.createElement(
|
|
19147
19486
|
Badge,
|
|
19148
19487
|
{
|
|
19149
19488
|
variant: "success" /* SUCCESS */,
|
|
19150
19489
|
size: "small" /* SMALL */,
|
|
19151
|
-
icon: /* @__PURE__ */
|
|
19490
|
+
icon: /* @__PURE__ */ React225.createElement(Check_default, { size: 12 })
|
|
19152
19491
|
},
|
|
19153
19492
|
"All done"
|
|
19154
|
-
) : null), /* @__PURE__ */
|
|
19493
|
+
) : null), /* @__PURE__ */ React225.createElement(IconButton, { icon: /* @__PURE__ */ React225.createElement(ChevronRight_default, null), withBorder: true, onClick }));
|
|
19155
19494
|
}
|
|
19156
19495
|
|
|
19157
19496
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
19158
|
-
import
|
|
19497
|
+
import classNames72 from "classnames";
|
|
19159
19498
|
var AccountingOverview = ({
|
|
19160
19499
|
title = "Accounting overview",
|
|
19161
19500
|
showTitle = true,
|
|
@@ -19172,34 +19511,34 @@ var AccountingOverview = ({
|
|
|
19172
19511
|
var _a, _b, _c, _d, _e;
|
|
19173
19512
|
const [pnlToggle, setPnlToggle] = useState63("expenses");
|
|
19174
19513
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
19175
|
-
return /* @__PURE__ */
|
|
19514
|
+
return /* @__PURE__ */ React226.createElement(
|
|
19176
19515
|
ProfitAndLoss,
|
|
19177
19516
|
{
|
|
19178
19517
|
asContainer: false,
|
|
19179
19518
|
tagFilter: tagFilter ? { key: tagFilter.tagKey, values: tagFilter.tagValues } : void 0
|
|
19180
19519
|
},
|
|
19181
|
-
/* @__PURE__ */
|
|
19520
|
+
/* @__PURE__ */ React226.createElement(
|
|
19182
19521
|
View,
|
|
19183
19522
|
{
|
|
19184
19523
|
title,
|
|
19185
19524
|
showHeader: showTitle,
|
|
19186
|
-
header: /* @__PURE__ */
|
|
19525
|
+
header: /* @__PURE__ */ React226.createElement(Header2, null, /* @__PURE__ */ React226.createElement(HeaderRow, null, /* @__PURE__ */ React226.createElement(HeaderCol, null, /* @__PURE__ */ React226.createElement(ProfitAndLoss.DatePicker, null))))
|
|
19187
19526
|
},
|
|
19188
|
-
enableOnboarding && /* @__PURE__ */
|
|
19527
|
+
enableOnboarding && /* @__PURE__ */ React226.createElement(
|
|
19189
19528
|
Onboarding,
|
|
19190
19529
|
{
|
|
19191
19530
|
onTransactionsToReviewClick,
|
|
19192
19531
|
onboardingStepOverride
|
|
19193
19532
|
}
|
|
19194
19533
|
),
|
|
19195
|
-
/* @__PURE__ */
|
|
19534
|
+
/* @__PURE__ */ React226.createElement(
|
|
19196
19535
|
Internal_ProfitAndLossSummaries,
|
|
19197
19536
|
{
|
|
19198
19537
|
stringOverrides: (_c = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _c.summaries,
|
|
19199
19538
|
chartColorsList,
|
|
19200
19539
|
slots: {
|
|
19201
19540
|
unstable_AdditionalListItems: showTransactionsToReview ? [
|
|
19202
|
-
/* @__PURE__ */
|
|
19541
|
+
/* @__PURE__ */ React226.createElement(
|
|
19203
19542
|
TransactionsToReview,
|
|
19204
19543
|
{
|
|
19205
19544
|
key: "transactions-to-review",
|
|
@@ -19213,28 +19552,28 @@ var AccountingOverview = ({
|
|
|
19213
19552
|
variants: profitAndLossSummariesVariants
|
|
19214
19553
|
}
|
|
19215
19554
|
),
|
|
19216
|
-
/* @__PURE__ */
|
|
19555
|
+
/* @__PURE__ */ React226.createElement(
|
|
19217
19556
|
Container,
|
|
19218
19557
|
{
|
|
19219
19558
|
name: "accounting-overview-profit-and-loss",
|
|
19220
19559
|
asWidget: true,
|
|
19221
19560
|
elevated: true
|
|
19222
19561
|
},
|
|
19223
|
-
/* @__PURE__ */
|
|
19562
|
+
/* @__PURE__ */ React226.createElement(
|
|
19224
19563
|
ProfitAndLoss.Header,
|
|
19225
19564
|
{
|
|
19226
19565
|
text: (stringOverrides == null ? void 0 : stringOverrides.header) || "Profit & Loss"
|
|
19227
19566
|
}
|
|
19228
19567
|
),
|
|
19229
|
-
/* @__PURE__ */
|
|
19568
|
+
/* @__PURE__ */ React226.createElement(
|
|
19230
19569
|
ProfitAndLoss.Chart,
|
|
19231
19570
|
{
|
|
19232
19571
|
tagFilter: tagFilter ? { key: tagFilter.tagKey, values: tagFilter.tagValues } : void 0
|
|
19233
19572
|
}
|
|
19234
19573
|
)
|
|
19235
19574
|
),
|
|
19236
|
-
middleBanner && /* @__PURE__ */
|
|
19237
|
-
/* @__PURE__ */
|
|
19575
|
+
middleBanner && /* @__PURE__ */ React226.createElement(Container, { name: "accounting-overview-middle-banner" }, middleBanner),
|
|
19576
|
+
/* @__PURE__ */ React226.createElement("div", { className: "Layer__accounting-overview-profit-and-loss-charts" }, /* @__PURE__ */ React226.createElement(
|
|
19238
19577
|
Toggle,
|
|
19239
19578
|
{
|
|
19240
19579
|
name: "pnl-detailed-charts",
|
|
@@ -19251,15 +19590,15 @@ var AccountingOverview = ({
|
|
|
19251
19590
|
selected: pnlToggle,
|
|
19252
19591
|
onChange: (e) => setPnlToggle(e.target.value)
|
|
19253
19592
|
}
|
|
19254
|
-
), /* @__PURE__ */
|
|
19593
|
+
), /* @__PURE__ */ React226.createElement(
|
|
19255
19594
|
Container,
|
|
19256
19595
|
{
|
|
19257
|
-
name:
|
|
19596
|
+
name: classNames72(
|
|
19258
19597
|
"accounting-overview-profit-and-loss-chart",
|
|
19259
19598
|
pnlToggle !== "revenue" && "accounting-overview-profit-and-loss-chart--hidden"
|
|
19260
19599
|
)
|
|
19261
19600
|
},
|
|
19262
|
-
/* @__PURE__ */
|
|
19601
|
+
/* @__PURE__ */ React226.createElement(
|
|
19263
19602
|
ProfitAndLoss.DetailedCharts,
|
|
19264
19603
|
{
|
|
19265
19604
|
scope: "revenue",
|
|
@@ -19268,15 +19607,15 @@ var AccountingOverview = ({
|
|
|
19268
19607
|
chartColorsList
|
|
19269
19608
|
}
|
|
19270
19609
|
)
|
|
19271
|
-
), /* @__PURE__ */
|
|
19610
|
+
), /* @__PURE__ */ React226.createElement(
|
|
19272
19611
|
Container,
|
|
19273
19612
|
{
|
|
19274
|
-
name:
|
|
19613
|
+
name: classNames72(
|
|
19275
19614
|
"accounting-overview-profit-and-loss-chart",
|
|
19276
19615
|
pnlToggle !== "expenses" && "accounting-overview-profit-and-loss-chart--hidden"
|
|
19277
19616
|
)
|
|
19278
19617
|
},
|
|
19279
|
-
/* @__PURE__ */
|
|
19618
|
+
/* @__PURE__ */ React226.createElement(
|
|
19280
19619
|
ProfitAndLoss.DetailedCharts,
|
|
19281
19620
|
{
|
|
19282
19621
|
scope: "expenses",
|
|
@@ -19291,7 +19630,7 @@ var AccountingOverview = ({
|
|
|
19291
19630
|
};
|
|
19292
19631
|
|
|
19293
19632
|
// src/views/BankTransactionsWithLinkedAccounts/BankTransactionsWithLinkedAccounts.tsx
|
|
19294
|
-
import
|
|
19633
|
+
import React227 from "react";
|
|
19295
19634
|
var BankTransactionsWithLinkedAccounts = ({
|
|
19296
19635
|
title,
|
|
19297
19636
|
// deprecated
|
|
@@ -19307,13 +19646,13 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
19307
19646
|
mobileComponent,
|
|
19308
19647
|
stringOverrides
|
|
19309
19648
|
}) => {
|
|
19310
|
-
return /* @__PURE__ */
|
|
19649
|
+
return /* @__PURE__ */ React227.createElement(
|
|
19311
19650
|
View,
|
|
19312
19651
|
{
|
|
19313
19652
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || "Bank transactions",
|
|
19314
19653
|
showHeader: showTitle
|
|
19315
19654
|
},
|
|
19316
|
-
/* @__PURE__ */
|
|
19655
|
+
/* @__PURE__ */ React227.createElement(
|
|
19317
19656
|
LinkedAccounts,
|
|
19318
19657
|
{
|
|
19319
19658
|
elevated: elevatedLinkedAccounts,
|
|
@@ -19323,7 +19662,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
19323
19662
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.linkedAccounts
|
|
19324
19663
|
}
|
|
19325
19664
|
),
|
|
19326
|
-
/* @__PURE__ */
|
|
19665
|
+
/* @__PURE__ */ React227.createElement(
|
|
19327
19666
|
BankTransactions,
|
|
19328
19667
|
{
|
|
19329
19668
|
asWidget: true,
|
|
@@ -19339,7 +19678,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
19339
19678
|
};
|
|
19340
19679
|
|
|
19341
19680
|
// src/views/GeneralLedger/GeneralLedger.tsx
|
|
19342
|
-
import
|
|
19681
|
+
import React228, { useState as useState64 } from "react";
|
|
19343
19682
|
var GeneralLedgerView = ({
|
|
19344
19683
|
title,
|
|
19345
19684
|
// deprecated
|
|
@@ -19348,13 +19687,13 @@ var GeneralLedgerView = ({
|
|
|
19348
19687
|
chartOfAccountsOptions
|
|
19349
19688
|
}) => {
|
|
19350
19689
|
const [activeTab, setActiveTab] = useState64("chartOfAccounts");
|
|
19351
|
-
return /* @__PURE__ */
|
|
19690
|
+
return /* @__PURE__ */ React228.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React228.createElement(
|
|
19352
19691
|
View,
|
|
19353
19692
|
{
|
|
19354
19693
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || "General Ledger",
|
|
19355
19694
|
showHeader: showTitle
|
|
19356
19695
|
},
|
|
19357
|
-
/* @__PURE__ */
|
|
19696
|
+
/* @__PURE__ */ React228.createElement(
|
|
19358
19697
|
Toggle,
|
|
19359
19698
|
{
|
|
19360
19699
|
name: "general-ledger-tabs",
|
|
@@ -19372,7 +19711,7 @@ var GeneralLedgerView = ({
|
|
|
19372
19711
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
19373
19712
|
}
|
|
19374
19713
|
),
|
|
19375
|
-
activeTab === "chartOfAccounts" ? /* @__PURE__ */
|
|
19714
|
+
activeTab === "chartOfAccounts" ? /* @__PURE__ */ React228.createElement(
|
|
19376
19715
|
ChartOfAccounts,
|
|
19377
19716
|
{
|
|
19378
19717
|
asWidget: true,
|
|
@@ -19381,12 +19720,12 @@ var GeneralLedgerView = ({
|
|
|
19381
19720
|
templateAccountsEditable: chartOfAccountsOptions == null ? void 0 : chartOfAccountsOptions.templateAccountsEditable,
|
|
19382
19721
|
showReversalEntries: chartOfAccountsOptions == null ? void 0 : chartOfAccountsOptions.showReversalEntries
|
|
19383
19722
|
}
|
|
19384
|
-
) : /* @__PURE__ */
|
|
19723
|
+
) : /* @__PURE__ */ React228.createElement(Journal, { stringOverrides: stringOverrides == null ? void 0 : stringOverrides.journal })
|
|
19385
19724
|
));
|
|
19386
19725
|
};
|
|
19387
19726
|
|
|
19388
19727
|
// src/views/ProjectProfitability/ProjectProfitability.tsx
|
|
19389
|
-
import
|
|
19728
|
+
import React229, { useState as useState65 } from "react";
|
|
19390
19729
|
import Select4 from "react-select";
|
|
19391
19730
|
var ProjectProfitabilityView = ({
|
|
19392
19731
|
valueOptions,
|
|
@@ -19411,14 +19750,14 @@ var ProjectProfitabilityView = ({
|
|
|
19411
19750
|
values: tagFilter2.tagValues
|
|
19412
19751
|
} : void 0;
|
|
19413
19752
|
};
|
|
19414
|
-
return /* @__PURE__ */
|
|
19753
|
+
return /* @__PURE__ */ React229.createElement(
|
|
19415
19754
|
View,
|
|
19416
19755
|
{
|
|
19417
19756
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || "",
|
|
19418
19757
|
showHeader: showTitle,
|
|
19419
19758
|
viewClassName: "Layer__project-view"
|
|
19420
19759
|
},
|
|
19421
|
-
/* @__PURE__ */
|
|
19760
|
+
/* @__PURE__ */ React229.createElement("div", { className: "Layer__component Layer__header__actions" }, /* @__PURE__ */ React229.createElement("div", { className: "Layer__component" }, /* @__PURE__ */ React229.createElement(
|
|
19422
19761
|
Toggle,
|
|
19423
19762
|
{
|
|
19424
19763
|
name: "project-tabs",
|
|
@@ -19439,7 +19778,7 @@ var ProjectProfitabilityView = ({
|
|
|
19439
19778
|
selected: activeTab,
|
|
19440
19779
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
19441
19780
|
}
|
|
19442
|
-
)), /* @__PURE__ */
|
|
19781
|
+
)), /* @__PURE__ */ React229.createElement(
|
|
19443
19782
|
Select4,
|
|
19444
19783
|
{
|
|
19445
19784
|
className: "Layer__category-menu Layer__select",
|
|
@@ -19457,7 +19796,7 @@ var ProjectProfitabilityView = ({
|
|
|
19457
19796
|
}
|
|
19458
19797
|
}
|
|
19459
19798
|
)),
|
|
19460
|
-
/* @__PURE__ */
|
|
19799
|
+
/* @__PURE__ */ React229.createElement(Container, { name: "project" }, /* @__PURE__ */ React229.createElement(React229.Fragment, null, activeTab === "overview" && /* @__PURE__ */ React229.createElement(
|
|
19461
19800
|
AccountingOverview,
|
|
19462
19801
|
{
|
|
19463
19802
|
stringOverrides: { header: "Project Overview" },
|
|
@@ -19467,7 +19806,7 @@ var ProjectProfitabilityView = ({
|
|
|
19467
19806
|
showTransactionsToReview: false,
|
|
19468
19807
|
showTitle: false
|
|
19469
19808
|
}
|
|
19470
|
-
), activeTab === "transactions" && /* @__PURE__ */
|
|
19809
|
+
), activeTab === "transactions" && /* @__PURE__ */ React229.createElement(
|
|
19471
19810
|
BankTransactions,
|
|
19472
19811
|
{
|
|
19473
19812
|
hideHeader: true,
|
|
@@ -19476,7 +19815,7 @@ var ProjectProfitabilityView = ({
|
|
|
19476
19815
|
tagFilter: tagFilter != null ? tagFilter : void 0
|
|
19477
19816
|
}
|
|
19478
19817
|
}
|
|
19479
|
-
), activeTab === "report" && /* @__PURE__ */
|
|
19818
|
+
), activeTab === "report" && /* @__PURE__ */ React229.createElement(ProfitAndLoss, { asContainer: false, tagFilter: pnlTagFilter }, /* @__PURE__ */ React229.createElement(
|
|
19480
19819
|
ProfitAndLoss.Report,
|
|
19481
19820
|
{
|
|
19482
19821
|
stringOverrides,
|
|
@@ -19488,7 +19827,7 @@ var ProjectProfitabilityView = ({
|
|
|
19488
19827
|
};
|
|
19489
19828
|
|
|
19490
19829
|
// src/views/Reports/Reports.tsx
|
|
19491
|
-
import
|
|
19830
|
+
import React230, { useState as useState66 } from "react";
|
|
19492
19831
|
var getOptions = (enabledReports) => {
|
|
19493
19832
|
return [
|
|
19494
19833
|
enabledReports.includes("profitAndLoss") ? {
|
|
@@ -19519,13 +19858,13 @@ var Reports = ({
|
|
|
19519
19858
|
const { view, containerRef } = useElementViewSize();
|
|
19520
19859
|
const options = getOptions(enabledReports);
|
|
19521
19860
|
const defaultTitle = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
|
|
19522
|
-
return /* @__PURE__ */
|
|
19861
|
+
return /* @__PURE__ */ React230.createElement(
|
|
19523
19862
|
View,
|
|
19524
19863
|
{
|
|
19525
19864
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || defaultTitle,
|
|
19526
19865
|
showHeader: showTitle
|
|
19527
19866
|
},
|
|
19528
|
-
enabledReports.length > 1 && /* @__PURE__ */
|
|
19867
|
+
enabledReports.length > 1 && /* @__PURE__ */ React230.createElement("div", { className: "Layer__component Layer__header__actions" }, /* @__PURE__ */ React230.createElement(
|
|
19529
19868
|
Toggle,
|
|
19530
19869
|
{
|
|
19531
19870
|
name: "reports-tabs",
|
|
@@ -19534,7 +19873,7 @@ var Reports = ({
|
|
|
19534
19873
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
19535
19874
|
}
|
|
19536
19875
|
)),
|
|
19537
|
-
/* @__PURE__ */
|
|
19876
|
+
/* @__PURE__ */ React230.createElement(Container, { name: "reports", ref: containerRef }, /* @__PURE__ */ React230.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ React230.createElement(
|
|
19538
19877
|
ReportsPanel,
|
|
19539
19878
|
{
|
|
19540
19879
|
containerRef,
|
|
@@ -19557,7 +19896,7 @@ var ReportsPanel = ({
|
|
|
19557
19896
|
statementOfCashFlowConfig,
|
|
19558
19897
|
view
|
|
19559
19898
|
}) => {
|
|
19560
|
-
return /* @__PURE__ */
|
|
19899
|
+
return /* @__PURE__ */ React230.createElement(React230.Fragment, null, openReport === "profitAndLoss" && /* @__PURE__ */ React230.createElement(
|
|
19561
19900
|
ProfitAndLoss.Report,
|
|
19562
19901
|
__spreadValues({
|
|
19563
19902
|
stringOverrides,
|
|
@@ -19565,7 +19904,7 @@ var ReportsPanel = ({
|
|
|
19565
19904
|
parentRef: containerRef,
|
|
19566
19905
|
view
|
|
19567
19906
|
}, profitAndLossConfig)
|
|
19568
|
-
), openReport === "balanceSheet" && /* @__PURE__ */
|
|
19907
|
+
), openReport === "balanceSheet" && /* @__PURE__ */ React230.createElement(BalanceSheet, { stringOverrides: stringOverrides == null ? void 0 : stringOverrides.balanceSheet }), openReport === "statementOfCashFlow" && /* @__PURE__ */ React230.createElement(
|
|
19569
19908
|
StatementOfCashFlow,
|
|
19570
19909
|
__spreadValues({
|
|
19571
19910
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.statementOfCashflow
|
|
@@ -19574,11 +19913,11 @@ var ReportsPanel = ({
|
|
|
19574
19913
|
};
|
|
19575
19914
|
|
|
19576
19915
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
19577
|
-
import
|
|
19916
|
+
import React231, { useContext as useContext50, useRef as useRef23 } from "react";
|
|
19578
19917
|
var COMPONENT_NAME7 = "profit-and-loss";
|
|
19579
19918
|
var ProfitAndLossView = (props) => {
|
|
19580
19919
|
const containerRef = useRef23(null);
|
|
19581
|
-
return /* @__PURE__ */
|
|
19920
|
+
return /* @__PURE__ */ React231.createElement(Container, { name: COMPONENT_NAME7, ref: containerRef }, /* @__PURE__ */ React231.createElement(ProfitAndLoss, null, /* @__PURE__ */ React231.createElement(ProfitAndLossPanel, __spreadValues({ containerRef }, props))));
|
|
19582
19921
|
};
|
|
19583
19922
|
var ProfitAndLossPanel = (_a) => {
|
|
19584
19923
|
var _b = _a, {
|
|
@@ -19589,10 +19928,10 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
19589
19928
|
"stringOverrides"
|
|
19590
19929
|
]);
|
|
19591
19930
|
const { sidebarScope } = useContext50(ProfitAndLoss.Context);
|
|
19592
|
-
return /* @__PURE__ */
|
|
19931
|
+
return /* @__PURE__ */ React231.createElement(
|
|
19593
19932
|
Panel,
|
|
19594
19933
|
{
|
|
19595
|
-
sidebar: /* @__PURE__ */
|
|
19934
|
+
sidebar: /* @__PURE__ */ React231.createElement(
|
|
19596
19935
|
ProfitAndLossDetailedCharts,
|
|
19597
19936
|
{
|
|
19598
19937
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.profitAndLossDetailedCharts
|
|
@@ -19601,7 +19940,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
19601
19940
|
sidebarIsOpen: Boolean(sidebarScope),
|
|
19602
19941
|
parentRef: containerRef
|
|
19603
19942
|
},
|
|
19604
|
-
/* @__PURE__ */
|
|
19943
|
+
/* @__PURE__ */ React231.createElement(
|
|
19605
19944
|
ProfitAndLoss.Header,
|
|
19606
19945
|
{
|
|
19607
19946
|
text: (stringOverrides == null ? void 0 : stringOverrides.header) || "Profit & Loss",
|
|
@@ -19609,7 +19948,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
19609
19948
|
headingClassName: "Layer__profit-and-loss__title"
|
|
19610
19949
|
}
|
|
19611
19950
|
),
|
|
19612
|
-
/* @__PURE__ */
|
|
19951
|
+
/* @__PURE__ */ React231.createElement(Components, __spreadValues({ stringOverrides }, props))
|
|
19613
19952
|
);
|
|
19614
19953
|
};
|
|
19615
19954
|
var Components = ({
|
|
@@ -19621,7 +19960,7 @@ var Components = ({
|
|
|
19621
19960
|
ProfitAndLoss.Context
|
|
19622
19961
|
);
|
|
19623
19962
|
if (!isLoading && error) {
|
|
19624
|
-
return /* @__PURE__ */
|
|
19963
|
+
return /* @__PURE__ */ React231.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React231.createElement(
|
|
19625
19964
|
DataState,
|
|
19626
19965
|
{
|
|
19627
19966
|
status: "failed" /* failed */,
|
|
@@ -19632,26 +19971,26 @@ var Components = ({
|
|
|
19632
19971
|
}
|
|
19633
19972
|
));
|
|
19634
19973
|
}
|
|
19635
|
-
return /* @__PURE__ */
|
|
19974
|
+
return /* @__PURE__ */ React231.createElement(React231.Fragment, null, !hideChart && /* @__PURE__ */ React231.createElement("div", { className: `Layer__${COMPONENT_NAME7}__chart_with_summaries` }, /* @__PURE__ */ React231.createElement(
|
|
19636
19975
|
"div",
|
|
19637
19976
|
{
|
|
19638
19977
|
className: `Layer__${COMPONENT_NAME7}__chart_with_summaries__summary-col`
|
|
19639
19978
|
},
|
|
19640
|
-
/* @__PURE__ */
|
|
19641
|
-
/* @__PURE__ */
|
|
19979
|
+
/* @__PURE__ */ React231.createElement(ProfitAndLoss.DatePicker, null),
|
|
19980
|
+
/* @__PURE__ */ React231.createElement(
|
|
19642
19981
|
ProfitAndLoss.Summaries,
|
|
19643
19982
|
{
|
|
19644
19983
|
actionable: true,
|
|
19645
19984
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.profitAndLossSummaries
|
|
19646
19985
|
}
|
|
19647
19986
|
)
|
|
19648
|
-
), /* @__PURE__ */
|
|
19987
|
+
), /* @__PURE__ */ React231.createElement(
|
|
19649
19988
|
"div",
|
|
19650
19989
|
{
|
|
19651
19990
|
className: `Layer__${COMPONENT_NAME7}__chart_with_summaries__chart-col`
|
|
19652
19991
|
},
|
|
19653
|
-
/* @__PURE__ */
|
|
19654
|
-
)), !hideTable && /* @__PURE__ */
|
|
19992
|
+
/* @__PURE__ */ React231.createElement(ProfitAndLoss.Chart, null)
|
|
19993
|
+
)), !hideTable && /* @__PURE__ */ React231.createElement(
|
|
19655
19994
|
ProfitAndLoss.Table,
|
|
19656
19995
|
{
|
|
19657
19996
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.profitAndLossTable
|