@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/cjs/index.cjs
CHANGED
|
@@ -115,7 +115,7 @@ var import_react17 = __toESM(require("react"));
|
|
|
115
115
|
var import_react16 = __toESM(require("react"));
|
|
116
116
|
|
|
117
117
|
// package.json
|
|
118
|
-
var version = "0.1.
|
|
118
|
+
var version = "0.1.82";
|
|
119
119
|
|
|
120
120
|
// src/models/APIError.ts
|
|
121
121
|
var APIError = class _APIError extends Error {
|
|
@@ -456,21 +456,29 @@ var getCashflowStatementCSV = get(
|
|
|
456
456
|
|
|
457
457
|
// src/api/layer/tasks.ts
|
|
458
458
|
var getTasks = get(
|
|
459
|
-
({ businessId }) => `/v1/businesses/${businessId}/tasks`
|
|
459
|
+
({ businessId, startDate, endDate }) => `/v1/businesses/${businessId}/tasks?${startDate ? `&start_date=${encodeURIComponent(startDate)}` : ""}${endDate ? `&end_date=${encodeURIComponent(endDate)}` : ""}`
|
|
460
460
|
);
|
|
461
461
|
var submitResponseToTask = post(
|
|
462
462
|
({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/user-response`
|
|
463
463
|
);
|
|
464
|
+
var updateUploadDocumentTaskDescription = post(
|
|
465
|
+
({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/upload/update-description`
|
|
466
|
+
);
|
|
464
467
|
var markTaskAsComplete = post(
|
|
465
468
|
({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/complete`
|
|
466
469
|
);
|
|
470
|
+
var deleteTaskUploads = post(
|
|
471
|
+
({ businessId, taskId }) => `/v1/businesses/${businessId}/tasks/${taskId}/upload/delete`
|
|
472
|
+
);
|
|
467
473
|
var completeTaskWithUpload = (baseUrl, accessToken) => ({
|
|
468
474
|
businessId,
|
|
469
475
|
taskId,
|
|
470
|
-
|
|
476
|
+
files,
|
|
477
|
+
description
|
|
471
478
|
}) => {
|
|
472
479
|
const formData = new FormData();
|
|
473
|
-
formData.append("file", file);
|
|
480
|
+
files.forEach((file) => formData.append("file", file));
|
|
481
|
+
description && formData.append("description", description);
|
|
474
482
|
const endpoint = `/v1/businesses/${businessId}/tasks/${taskId}/upload`;
|
|
475
483
|
return postWithFormData(
|
|
476
484
|
endpoint,
|
|
@@ -520,6 +528,8 @@ var Layer = {
|
|
|
520
528
|
getTasks,
|
|
521
529
|
completeTaskWithUpload,
|
|
522
530
|
submitResponseToTask,
|
|
531
|
+
deleteTaskUploads,
|
|
532
|
+
updateUploadDocumentTaskDescription,
|
|
523
533
|
breakPlaidItemConnection,
|
|
524
534
|
syncConnection,
|
|
525
535
|
updateConnectionStatus,
|
|
@@ -1424,12 +1434,12 @@ function AccountConfirmationStoreProvider({
|
|
|
1424
1434
|
initialVisibility = "DEFAULT"
|
|
1425
1435
|
}) {
|
|
1426
1436
|
const [store] = (0, import_react12.useState)(
|
|
1427
|
-
() => (0, import_zustand.createStore)((
|
|
1437
|
+
() => (0, import_zustand.createStore)((set2) => ({
|
|
1428
1438
|
visibility: initialVisibility,
|
|
1429
1439
|
actions: {
|
|
1430
|
-
dismiss: () =>
|
|
1431
|
-
preload: () =>
|
|
1432
|
-
reset: () =>
|
|
1440
|
+
dismiss: () => set2((state) => __spreadProps(__spreadValues({}, state), { visibility: "DISMISSED" })),
|
|
1441
|
+
preload: () => set2((state) => __spreadProps(__spreadValues({}, state), { visibility: "PRELOADED" })),
|
|
1442
|
+
reset: () => set2((state) => __spreadProps(__spreadValues({}, state), { visibility: "DEFAULT" }))
|
|
1433
1443
|
}
|
|
1434
1444
|
}))
|
|
1435
1445
|
);
|
|
@@ -6892,7 +6902,8 @@ var FileInput = ({
|
|
|
6892
6902
|
disabled = false,
|
|
6893
6903
|
secondary,
|
|
6894
6904
|
iconOnly = false,
|
|
6895
|
-
icon
|
|
6905
|
+
icon,
|
|
6906
|
+
allowMultipleUploads = false
|
|
6896
6907
|
}) => {
|
|
6897
6908
|
const hiddenFileInput = (0, import_react82.useRef)(null);
|
|
6898
6909
|
const onClick = () => {
|
|
@@ -6902,8 +6913,8 @@ var FileInput = ({
|
|
|
6902
6913
|
};
|
|
6903
6914
|
const onChange = (event) => {
|
|
6904
6915
|
if (event.target.files && event.target.files.length > 0 && onUpload) {
|
|
6905
|
-
const
|
|
6906
|
-
onUpload(
|
|
6916
|
+
const filesUploaded = Array.from(event.target.files);
|
|
6917
|
+
onUpload(filesUploaded);
|
|
6907
6918
|
}
|
|
6908
6919
|
};
|
|
6909
6920
|
if (secondary) {
|
|
@@ -6911,6 +6922,7 @@ var FileInput = ({
|
|
|
6911
6922
|
"input",
|
|
6912
6923
|
{
|
|
6913
6924
|
type: "file",
|
|
6925
|
+
multiple: allowMultipleUploads,
|
|
6914
6926
|
onChange,
|
|
6915
6927
|
ref: hiddenFileInput,
|
|
6916
6928
|
style: { display: "none" }
|
|
@@ -6931,6 +6943,7 @@ var FileInput = ({
|
|
|
6931
6943
|
"input",
|
|
6932
6944
|
{
|
|
6933
6945
|
type: "file",
|
|
6946
|
+
multiple: allowMultipleUploads,
|
|
6934
6947
|
onChange,
|
|
6935
6948
|
ref: hiddenFileInput,
|
|
6936
6949
|
style: { display: "none" }
|
|
@@ -7086,7 +7099,7 @@ var BankTransactionReceipts = (0, import_react86.forwardRef)(
|
|
|
7086
7099
|
(0, import_react86.useImperativeHandle)(ref, () => ({
|
|
7087
7100
|
uploadReceipt
|
|
7088
7101
|
}));
|
|
7089
|
-
return /* @__PURE__ */ import_react86.default.createElement("div", { className: `${classNamePrefix}__file-upload` }, receiptUrls && receiptUrls.length > 0 && label ? /* @__PURE__ */ import_react86.default.createElement(Text, { size: "sm" /* sm */, className: "Layer__file-upload__label" }, label) : null, !hideUploadButtons && (!receiptUrls || receiptUrls.length === 0) ? /* @__PURE__ */ import_react86.default.createElement(FileInput, { onUpload: uploadReceipt, text: "Upload receipt" }) : null, receiptUrls.map((url, index) => {
|
|
7102
|
+
return /* @__PURE__ */ import_react86.default.createElement("div", { className: `${classNamePrefix}__file-upload` }, receiptUrls && receiptUrls.length > 0 && label ? /* @__PURE__ */ import_react86.default.createElement(Text, { size: "sm" /* sm */, className: "Layer__file-upload__label" }, label) : null, !hideUploadButtons && (!receiptUrls || receiptUrls.length === 0) ? /* @__PURE__ */ import_react86.default.createElement(FileInput, { onUpload: (files) => uploadReceipt(files[0]), text: "Upload receipt" }) : null, receiptUrls.map((url, index) => {
|
|
7090
7103
|
var _a;
|
|
7091
7104
|
return /* @__PURE__ */ import_react86.default.createElement(
|
|
7092
7105
|
FileThumb,
|
|
@@ -7110,7 +7123,7 @@ var BankTransactionReceipts = (0, import_react86.forwardRef)(
|
|
|
7110
7123
|
FileInput,
|
|
7111
7124
|
{
|
|
7112
7125
|
secondary: true,
|
|
7113
|
-
onUpload: uploadReceipt,
|
|
7126
|
+
onUpload: (files) => uploadReceipt(files[0]),
|
|
7114
7127
|
text: "Add next receipt"
|
|
7115
7128
|
}
|
|
7116
7129
|
) : null);
|
|
@@ -8706,7 +8719,6 @@ var BusinessForm = ({
|
|
|
8706
8719
|
showReceiptUploads,
|
|
8707
8720
|
showDescriptions
|
|
8708
8721
|
}) => {
|
|
8709
|
-
var _a;
|
|
8710
8722
|
const receiptsRef = (0, import_react102.useRef)(null);
|
|
8711
8723
|
const { setContent, close } = (0, import_react102.useContext)(DrawerContext);
|
|
8712
8724
|
const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
|
|
@@ -8721,8 +8733,8 @@ var BusinessForm = ({
|
|
|
8721
8733
|
}
|
|
8722
8734
|
}, [bankTransaction.error]);
|
|
8723
8735
|
const options = (0, import_react102.useMemo)(() => {
|
|
8724
|
-
var
|
|
8725
|
-
const options2 = ((
|
|
8736
|
+
var _a;
|
|
8737
|
+
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(
|
|
8726
8738
|
(x) => mapCategoryToOption(x)
|
|
8727
8739
|
) : [];
|
|
8728
8740
|
if (selectedCategory && !options2.find((x) => x.id === (selectedCategory == null ? void 0 : selectedCategory.id))) {
|
|
@@ -8758,11 +8770,11 @@ var BusinessForm = ({
|
|
|
8758
8770
|
);
|
|
8759
8771
|
};
|
|
8760
8772
|
const onCategorySelect = (category) => {
|
|
8761
|
-
var
|
|
8773
|
+
var _a, _b;
|
|
8762
8774
|
if (category.value.type === "SELECT_CATEGORY") {
|
|
8763
8775
|
openDrawer();
|
|
8764
8776
|
} else {
|
|
8765
|
-
if (selectedCategory && ((
|
|
8777
|
+
if (selectedCategory && ((_a = category.value.payload) == null ? void 0 : _a.id) === ((_b = selectedCategory.value.payload) == null ? void 0 : _b.id)) {
|
|
8766
8778
|
setSelectedCategory(void 0);
|
|
8767
8779
|
} else {
|
|
8768
8780
|
setSelectedCategory(category);
|
|
@@ -8770,14 +8782,14 @@ var BusinessForm = ({
|
|
|
8770
8782
|
}
|
|
8771
8783
|
};
|
|
8772
8784
|
const save = () => {
|
|
8773
|
-
var
|
|
8785
|
+
var _a, _b, _c;
|
|
8774
8786
|
if (showDescriptions && memoText !== void 0) {
|
|
8775
8787
|
saveMemoText();
|
|
8776
8788
|
}
|
|
8777
8789
|
if (!selectedCategory || !selectedCategory.value.payload) {
|
|
8778
8790
|
return;
|
|
8779
8791
|
}
|
|
8780
|
-
const payload = ((_b = (
|
|
8792
|
+
const payload = ((_b = (_a = selectedCategory == null ? void 0 : selectedCategory.value) == null ? void 0 : _a.payload) == null ? void 0 : _b.id) ? {
|
|
8781
8793
|
type: "AccountId",
|
|
8782
8794
|
id: selectedCategory.value.payload.id
|
|
8783
8795
|
} : {
|
|
@@ -8844,7 +8856,10 @@ var BusinessForm = ({
|
|
|
8844
8856
|
), /* @__PURE__ */ import_react102.default.createElement("div", { className: "Layer__bank-transaction-mobile-list-item__actions" }, showReceiptUploads && /* @__PURE__ */ import_react102.default.createElement(
|
|
8845
8857
|
FileInput,
|
|
8846
8858
|
{
|
|
8847
|
-
onUpload: (
|
|
8859
|
+
onUpload: (files) => {
|
|
8860
|
+
var _a;
|
|
8861
|
+
return (_a = receiptsRef.current) == null ? void 0 : _a.uploadReceipt(files[0]);
|
|
8862
|
+
},
|
|
8848
8863
|
text: "Upload receipt",
|
|
8849
8864
|
iconOnly: true,
|
|
8850
8865
|
icon: /* @__PURE__ */ import_react102.default.createElement(Paperclip_default, null)
|
|
@@ -8895,7 +8910,6 @@ var PersonalForm = ({
|
|
|
8895
8910
|
showReceiptUploads,
|
|
8896
8911
|
showDescriptions
|
|
8897
8912
|
}) => {
|
|
8898
|
-
var _a;
|
|
8899
8913
|
const receiptsRef = (0, import_react103.useRef)(null);
|
|
8900
8914
|
const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
|
|
8901
8915
|
const [showRetry, setShowRetry] = (0, import_react103.useState)(false);
|
|
@@ -8965,7 +8979,10 @@ var PersonalForm = ({
|
|
|
8965
8979
|
), /* @__PURE__ */ import_react103.default.createElement("div", { className: "Layer__bank-transaction-mobile-list-item__actions" }, showReceiptUploads && /* @__PURE__ */ import_react103.default.createElement(
|
|
8966
8980
|
FileInput,
|
|
8967
8981
|
{
|
|
8968
|
-
onUpload: (
|
|
8982
|
+
onUpload: (files) => {
|
|
8983
|
+
var _a;
|
|
8984
|
+
return (_a = receiptsRef.current) == null ? void 0 : _a.uploadReceipt(files[0]);
|
|
8985
|
+
},
|
|
8969
8986
|
text: "Upload receipt",
|
|
8970
8987
|
iconOnly: true,
|
|
8971
8988
|
icon: /* @__PURE__ */ import_react103.default.createElement(Paperclip_default, null)
|
|
@@ -8992,7 +9009,7 @@ var MatchForm2 = ({
|
|
|
8992
9009
|
showReceiptUploads,
|
|
8993
9010
|
showDescriptions
|
|
8994
9011
|
}) => {
|
|
8995
|
-
var _a, _b
|
|
9012
|
+
var _a, _b;
|
|
8996
9013
|
const receiptsRef = (0, import_react104.useRef)(null);
|
|
8997
9014
|
const { match: matchBankTransaction2, isLoading } = useBankTransactionsContext();
|
|
8998
9015
|
const { memoText, setMemoText, saveMemoText } = useMemoTextContext();
|
|
@@ -9083,7 +9100,10 @@ var MatchForm2 = ({
|
|
|
9083
9100
|
), /* @__PURE__ */ import_react104.default.createElement("div", { className: "Layer__bank-transaction-mobile-list-item__actions" }, showReceiptUploads && /* @__PURE__ */ import_react104.default.createElement(
|
|
9084
9101
|
FileInput,
|
|
9085
9102
|
{
|
|
9086
|
-
onUpload: (
|
|
9103
|
+
onUpload: (files) => {
|
|
9104
|
+
var _a2;
|
|
9105
|
+
return (_a2 = receiptsRef.current) == null ? void 0 : _a2.uploadReceipt(files[0]);
|
|
9106
|
+
},
|
|
9087
9107
|
text: "Upload receipt",
|
|
9088
9108
|
iconOnly: true,
|
|
9089
9109
|
icon: /* @__PURE__ */ import_react104.default.createElement(Paperclip_default, null)
|
|
@@ -9109,7 +9129,7 @@ var SplitForm = ({
|
|
|
9109
9129
|
showReceiptUploads,
|
|
9110
9130
|
showDescriptions
|
|
9111
9131
|
}) => {
|
|
9112
|
-
var _a, _b, _c, _d
|
|
9132
|
+
var _a, _b, _c, _d;
|
|
9113
9133
|
const receiptsRef = (0, import_react105.useRef)(null);
|
|
9114
9134
|
const {
|
|
9115
9135
|
categorize: categorizeBankTransaction2,
|
|
@@ -9344,7 +9364,10 @@ var SplitForm = ({
|
|
|
9344
9364
|
), /* @__PURE__ */ import_react105.default.createElement("div", { className: "Layer__bank-transaction-mobile-list-item__actions" }, showReceiptUploads && /* @__PURE__ */ import_react105.default.createElement(
|
|
9345
9365
|
FileInput,
|
|
9346
9366
|
{
|
|
9347
|
-
onUpload: (
|
|
9367
|
+
onUpload: (files) => {
|
|
9368
|
+
var _a2;
|
|
9369
|
+
return (_a2 = receiptsRef.current) == null ? void 0 : _a2.uploadReceipt(files[0]);
|
|
9370
|
+
},
|
|
9348
9371
|
text: "Upload receipt",
|
|
9349
9372
|
iconOnly: true,
|
|
9350
9373
|
icon: /* @__PURE__ */ import_react105.default.createElement(Paperclip_default, null)
|
|
@@ -10196,6 +10219,7 @@ var DatePickerOptions = ({
|
|
|
10196
10219
|
|
|
10197
10220
|
// src/components/DatePicker/DatePicker.tsx
|
|
10198
10221
|
var import_classnames47 = __toESM(require("classnames"));
|
|
10222
|
+
var import_date_fns14 = require("date-fns");
|
|
10199
10223
|
var ReactDatePicker = RDP.default.default || RDP.default || RDP;
|
|
10200
10224
|
var getDefaultRangeDate = (date, mode, selected) => {
|
|
10201
10225
|
try {
|
|
@@ -10211,10 +10235,14 @@ var getDefaultRangeDate = (date, mode, selected) => {
|
|
|
10211
10235
|
}
|
|
10212
10236
|
};
|
|
10213
10237
|
var isRangeMode = (mode) => mode === "dayRangePicker" || mode === "monthRangePicker";
|
|
10238
|
+
var showNavigationArrows = (navigateArrows, isDesktop) => {
|
|
10239
|
+
return navigateArrows && (isDesktop && navigateArrows.includes("desktop") || !isDesktop && navigateArrows.includes("mobile"));
|
|
10240
|
+
};
|
|
10214
10241
|
var DatePicker = (_a) => {
|
|
10215
10242
|
var _b = _a, {
|
|
10216
10243
|
selected,
|
|
10217
10244
|
onChange,
|
|
10245
|
+
disabled,
|
|
10218
10246
|
mode = "dayPicker",
|
|
10219
10247
|
allowedModes,
|
|
10220
10248
|
dateFormat = mode === "monthPicker" || mode === "monthRangePicker" ? "MMM, yyyy" : mode === "timePicker" ? "h:mm aa" : "MMM d, yyyy",
|
|
@@ -10228,12 +10256,13 @@ var DatePicker = (_a) => {
|
|
|
10228
10256
|
minDate,
|
|
10229
10257
|
maxDate = /* @__PURE__ */ new Date(),
|
|
10230
10258
|
currentDateOption = true,
|
|
10231
|
-
navigateArrows = mode === "monthPicker",
|
|
10259
|
+
navigateArrows = mode === "monthPicker" ? ["mobile"] : void 0,
|
|
10232
10260
|
onChangeMode,
|
|
10233
10261
|
slots
|
|
10234
10262
|
} = _b, props = __objRest(_b, [
|
|
10235
10263
|
"selected",
|
|
10236
10264
|
"onChange",
|
|
10265
|
+
"disabled",
|
|
10237
10266
|
"mode",
|
|
10238
10267
|
"allowedModes",
|
|
10239
10268
|
"dateFormat",
|
|
@@ -10298,7 +10327,7 @@ var DatePicker = (_a) => {
|
|
|
10298
10327
|
const wrapperClassNames = (0, import_classnames47.default)(
|
|
10299
10328
|
"Layer__datepicker__wrapper",
|
|
10300
10329
|
mode === "timePicker" && "Layer__datepicker__time__wrapper",
|
|
10301
|
-
navigateArrows && "Layer__datepicker__wrapper--arrows"
|
|
10330
|
+
showNavigationArrows(navigateArrows, isDesktop) && "Layer__datepicker__wrapper--arrows"
|
|
10302
10331
|
);
|
|
10303
10332
|
const datePickerWrapperClassNames = (0, import_classnames47.default)(
|
|
10304
10333
|
"Layer__datepicker",
|
|
@@ -10329,6 +10358,8 @@ var DatePicker = (_a) => {
|
|
|
10329
10358
|
return selectedDates instanceof Date && selectedDates.toDateString() === currentDate.toDateString();
|
|
10330
10359
|
} else if (mode === "monthPicker") {
|
|
10331
10360
|
return selectedDates instanceof Date && selectedDates.getMonth() === currentDate.getMonth() && selectedDates.getFullYear() === currentDate.getFullYear();
|
|
10361
|
+
} else if (mode === "yearPicker") {
|
|
10362
|
+
return selectedDates instanceof Date && selectedDates.getFullYear() === currentDate.getFullYear();
|
|
10332
10363
|
}
|
|
10333
10364
|
return false;
|
|
10334
10365
|
};
|
|
@@ -10340,11 +10371,32 @@ var DatePicker = (_a) => {
|
|
|
10340
10371
|
setSelectedDates(
|
|
10341
10372
|
new Date(currentDate.getFullYear(), currentDate.getMonth(), 1)
|
|
10342
10373
|
);
|
|
10374
|
+
} else if (mode === "yearPicker") {
|
|
10375
|
+
setSelectedDates(
|
|
10376
|
+
new Date(currentDate.getFullYear(), 0, 1)
|
|
10377
|
+
);
|
|
10343
10378
|
}
|
|
10344
10379
|
};
|
|
10345
|
-
const isTodayOrAfter =
|
|
10346
|
-
|
|
10347
|
-
|
|
10380
|
+
const isTodayOrAfter = (0, import_react121.useMemo)(() => {
|
|
10381
|
+
switch (mode) {
|
|
10382
|
+
case "dayPicker":
|
|
10383
|
+
return Boolean(
|
|
10384
|
+
selectedDates instanceof Date && ((0, import_date_fns14.endOfDay)(selectedDates) >= (0, import_date_fns14.endOfDay)(/* @__PURE__ */ new Date()) || (0, import_date_fns14.endOfDay)(selectedDates) >= maxDate)
|
|
10385
|
+
);
|
|
10386
|
+
case "monthPicker":
|
|
10387
|
+
return Boolean(
|
|
10388
|
+
selectedDates instanceof Date && ((0, import_date_fns14.endOfMonth)(selectedDates) >= (0, import_date_fns14.endOfMonth)(/* @__PURE__ */ new Date()) || (0, import_date_fns14.endOfMonth)(selectedDates) >= maxDate)
|
|
10389
|
+
);
|
|
10390
|
+
case "yearPicker":
|
|
10391
|
+
return Boolean(
|
|
10392
|
+
selectedDates instanceof Date && ((0, import_date_fns14.endOfYear)(selectedDates) >= (0, import_date_fns14.endOfYear)(/* @__PURE__ */ new Date()) || (0, import_date_fns14.endOfYear)(selectedDates) >= maxDate)
|
|
10393
|
+
);
|
|
10394
|
+
default:
|
|
10395
|
+
return Boolean(
|
|
10396
|
+
selectedDates instanceof Date && (selectedDates >= /* @__PURE__ */ new Date() || selectedDates >= maxDate)
|
|
10397
|
+
);
|
|
10398
|
+
}
|
|
10399
|
+
}, [selectedDates, maxDate, mode]);
|
|
10348
10400
|
const isBeforeMinDate = Boolean(
|
|
10349
10401
|
minDate && selectedDates instanceof Date && selectedDates <= minDate
|
|
10350
10402
|
);
|
|
@@ -10365,6 +10417,14 @@ var DatePicker = (_a) => {
|
|
|
10365
10417
|
)
|
|
10366
10418
|
)
|
|
10367
10419
|
);
|
|
10420
|
+
} else if (mode === "yearPicker") {
|
|
10421
|
+
setSelectedDates(
|
|
10422
|
+
new Date(
|
|
10423
|
+
selectedDates.setFullYear(
|
|
10424
|
+
selectedDates.getFullYear() + value
|
|
10425
|
+
)
|
|
10426
|
+
)
|
|
10427
|
+
);
|
|
10368
10428
|
}
|
|
10369
10429
|
};
|
|
10370
10430
|
const onChangeModeInternal = (mode2) => {
|
|
@@ -10399,6 +10459,7 @@ var DatePicker = (_a) => {
|
|
|
10399
10459
|
popperPlacement: "bottom-start",
|
|
10400
10460
|
selectsRange: isRangeMode(mode),
|
|
10401
10461
|
showMonthYearPicker: mode === "monthPicker" || mode === "monthRangePicker",
|
|
10462
|
+
showYearPicker: mode === "yearPicker",
|
|
10402
10463
|
dateFormat,
|
|
10403
10464
|
renderDayContents: (day) => /* @__PURE__ */ import_react121.default.createElement("span", { className: "Layer__datepicker__day-contents" }, day),
|
|
10404
10465
|
timeIntervals,
|
|
@@ -10431,7 +10492,8 @@ var DatePicker = (_a) => {
|
|
|
10431
10492
|
if (pickerRef.current && !isDesktop) {
|
|
10432
10493
|
pickerRef.current.setOpen(!pickerRef.current.isCalendarOpen());
|
|
10433
10494
|
}
|
|
10434
|
-
}
|
|
10495
|
+
},
|
|
10496
|
+
disabled
|
|
10435
10497
|
}, props),
|
|
10436
10498
|
ModeSelector && /* @__PURE__ */ import_react121.default.createElement(
|
|
10437
10499
|
ModeSelector,
|
|
@@ -10448,7 +10510,7 @@ var DatePicker = (_a) => {
|
|
|
10448
10510
|
setSelectedDate: setSelectedDates
|
|
10449
10511
|
}
|
|
10450
10512
|
)
|
|
10451
|
-
), navigateArrows
|
|
10513
|
+
), showNavigationArrows(navigateArrows, isDesktop) && /* @__PURE__ */ import_react121.default.createElement(import_react121.default.Fragment, null, /* @__PURE__ */ import_react121.default.createElement(
|
|
10452
10514
|
Button,
|
|
10453
10515
|
{
|
|
10454
10516
|
"aria-label": "Previous Date",
|
|
@@ -10458,7 +10520,7 @@ var DatePicker = (_a) => {
|
|
|
10458
10520
|
),
|
|
10459
10521
|
onClick: () => changeDate(-1),
|
|
10460
10522
|
variant: "secondary" /* secondary */,
|
|
10461
|
-
disabled: isBeforeMinDate
|
|
10523
|
+
disabled: isBeforeMinDate || disabled
|
|
10462
10524
|
},
|
|
10463
10525
|
/* @__PURE__ */ import_react121.default.createElement(ChevronLeft_default, { className: "Layer__datepicker__button-icon", size: 16 })
|
|
10464
10526
|
), /* @__PURE__ */ import_react121.default.createElement(
|
|
@@ -10471,7 +10533,7 @@ var DatePicker = (_a) => {
|
|
|
10471
10533
|
isTodayOrAfter ? "Layer__datepicker__button--disabled" : void 0
|
|
10472
10534
|
),
|
|
10473
10535
|
onClick: () => changeDate(1),
|
|
10474
|
-
disabled: isTodayOrAfter
|
|
10536
|
+
disabled: isTodayOrAfter || disabled
|
|
10475
10537
|
},
|
|
10476
10538
|
/* @__PURE__ */ import_react121.default.createElement(
|
|
10477
10539
|
ChevronRight_default,
|
|
@@ -10480,13 +10542,13 @@ var DatePicker = (_a) => {
|
|
|
10480
10542
|
size: 16
|
|
10481
10543
|
}
|
|
10482
10544
|
)
|
|
10483
|
-
)), currentDateOption && (mode === "dayPicker" || mode === "monthPicker") && /* @__PURE__ */ import_react121.default.createElement(
|
|
10545
|
+
)), currentDateOption && (mode === "dayPicker" || mode === "monthPicker" || mode === "yearPicker") && /* @__PURE__ */ import_react121.default.createElement(
|
|
10484
10546
|
Button,
|
|
10485
10547
|
{
|
|
10486
10548
|
className: "Layer__datepicker__current-button",
|
|
10487
10549
|
onClick: setCurrentDate,
|
|
10488
10550
|
variant: "secondary" /* secondary */,
|
|
10489
|
-
disabled: isCurrentDate()
|
|
10551
|
+
disabled: isCurrentDate() || disabled
|
|
10490
10552
|
},
|
|
10491
10553
|
mode === "dayPicker" ? "Today" : "Current"
|
|
10492
10554
|
));
|
|
@@ -10494,7 +10556,7 @@ var DatePicker = (_a) => {
|
|
|
10494
10556
|
|
|
10495
10557
|
// src/components/BankTransactions/BankTransactionsHeader.tsx
|
|
10496
10558
|
var import_classnames48 = __toESM(require("classnames"));
|
|
10497
|
-
var
|
|
10559
|
+
var import_date_fns15 = require("date-fns");
|
|
10498
10560
|
var DownloadButton2 = ({
|
|
10499
10561
|
downloadButtonTextOverride,
|
|
10500
10562
|
iconOnly
|
|
@@ -10591,8 +10653,8 @@ var BankTransactionsHeader = ({
|
|
|
10591
10653
|
onChange: (date) => {
|
|
10592
10654
|
if (!Array.isArray(date)) {
|
|
10593
10655
|
setDateRange({
|
|
10594
|
-
startDate: (0,
|
|
10595
|
-
endDate: (0,
|
|
10656
|
+
startDate: (0, import_date_fns15.startOfMonth)(date),
|
|
10657
|
+
endDate: (0, import_date_fns15.endOfMonth)(date)
|
|
10596
10658
|
});
|
|
10597
10659
|
}
|
|
10598
10660
|
},
|
|
@@ -10695,7 +10757,7 @@ var DataStates = ({
|
|
|
10695
10757
|
};
|
|
10696
10758
|
|
|
10697
10759
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
10698
|
-
var
|
|
10760
|
+
var import_date_fns16 = require("date-fns");
|
|
10699
10761
|
var COMPONENT_NAME2 = "bank-transactions";
|
|
10700
10762
|
var categorizationEnabled = (mode) => {
|
|
10701
10763
|
if (mode === "bookkeeping-client") {
|
|
@@ -10727,8 +10789,8 @@ var BankTransactionsContent = ({
|
|
|
10727
10789
|
stringOverrides
|
|
10728
10790
|
}) => {
|
|
10729
10791
|
const [defaultDateRange] = (0, import_react124.useState)(() => ({
|
|
10730
|
-
startDate: (0,
|
|
10731
|
-
endDate: (0,
|
|
10792
|
+
startDate: (0, import_date_fns16.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
10793
|
+
endDate: (0, import_date_fns16.endOfMonth)(/* @__PURE__ */ new Date())
|
|
10732
10794
|
}));
|
|
10733
10795
|
const scrollPaginationRef = (0, import_react124.useRef)(null);
|
|
10734
10796
|
const isVisible = useIsVisible(scrollPaginationRef);
|
|
@@ -11129,14 +11191,14 @@ var applyShare = (items, total) => {
|
|
|
11129
11191
|
|
|
11130
11192
|
// src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
|
|
11131
11193
|
var import_react128 = require("react");
|
|
11132
|
-
var
|
|
11194
|
+
var import_date_fns17 = require("date-fns");
|
|
11133
11195
|
var import_swr5 = __toESM(require("swr"));
|
|
11134
11196
|
var buildDates = ({ currentDate }) => {
|
|
11135
11197
|
return {
|
|
11136
|
-
startYear: (0,
|
|
11137
|
-
startMonth: (0,
|
|
11138
|
-
endYear: (0,
|
|
11139
|
-
endMonth: (0,
|
|
11198
|
+
startYear: (0, import_date_fns17.startOfMonth)(currentDate).getFullYear() - 1,
|
|
11199
|
+
startMonth: (0, import_date_fns17.startOfMonth)(currentDate).getMonth() + 1,
|
|
11200
|
+
endYear: (0, import_date_fns17.startOfMonth)(currentDate).getFullYear(),
|
|
11201
|
+
endMonth: (0, import_date_fns17.startOfMonth)(currentDate).getMonth() + 1
|
|
11140
11202
|
};
|
|
11141
11203
|
};
|
|
11142
11204
|
var buildMonthsArray = (startDate, endDate) => {
|
|
@@ -11150,7 +11212,7 @@ var buildMonthsArray = (startDate, endDate) => {
|
|
|
11150
11212
|
return dates;
|
|
11151
11213
|
};
|
|
11152
11214
|
var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
11153
|
-
currentDate: (0,
|
|
11215
|
+
currentDate: (0, import_date_fns17.startOfMonth)(Date.now())
|
|
11154
11216
|
}) => {
|
|
11155
11217
|
var _a, _b;
|
|
11156
11218
|
const { businessId, syncTimestamps, read, hasBeenTouched } = useLayerContext();
|
|
@@ -11188,7 +11250,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
11188
11250
|
);
|
|
11189
11251
|
(0, import_react128.useEffect)(() => {
|
|
11190
11252
|
const newData = data.slice();
|
|
11191
|
-
const newPeriod = buildMonthsArray((0,
|
|
11253
|
+
const newPeriod = buildMonthsArray((0, import_date_fns17.sub)(date, { years: 1 }), date);
|
|
11192
11254
|
if (newData && newPeriod) {
|
|
11193
11255
|
newPeriod.forEach((x) => {
|
|
11194
11256
|
if (!(newData == null ? void 0 : newData.find(
|
|
@@ -11283,7 +11345,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
11283
11345
|
|
|
11284
11346
|
// src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
|
|
11285
11347
|
var import_react129 = require("react");
|
|
11286
|
-
var
|
|
11348
|
+
var import_date_fns18 = require("date-fns");
|
|
11287
11349
|
var import_swr6 = __toESM(require("swr"));
|
|
11288
11350
|
var useProfitAndLossQuery = ({
|
|
11289
11351
|
startDate,
|
|
@@ -11291,8 +11353,8 @@ var useProfitAndLossQuery = ({
|
|
|
11291
11353
|
tagFilter,
|
|
11292
11354
|
reportingBasis
|
|
11293
11355
|
} = {
|
|
11294
|
-
startDate: (0,
|
|
11295
|
-
endDate: (0,
|
|
11356
|
+
startDate: (0, import_date_fns18.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
11357
|
+
endDate: (0, import_date_fns18.endOfMonth)(/* @__PURE__ */ new Date())
|
|
11296
11358
|
}) => {
|
|
11297
11359
|
var _a, _b;
|
|
11298
11360
|
const { businessId, syncTimestamps, read, hasBeenTouched } = useLayerContext();
|
|
@@ -11312,8 +11374,8 @@ var useProfitAndLossQuery = ({
|
|
|
11312
11374
|
Layer.getProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
11313
11375
|
params: {
|
|
11314
11376
|
businessId,
|
|
11315
|
-
startDate: (0,
|
|
11316
|
-
endDate: (0,
|
|
11377
|
+
startDate: (0, import_date_fns18.formatISO)(startDate.valueOf()),
|
|
11378
|
+
endDate: (0, import_date_fns18.formatISO)(endDate.valueOf()),
|
|
11317
11379
|
tagKey: tagFilter == null ? void 0 : tagFilter.key,
|
|
11318
11380
|
tagValues: (_b = tagFilter == null ? void 0 : tagFilter.values) == null ? void 0 : _b.join(","),
|
|
11319
11381
|
reportingBasis
|
|
@@ -11345,21 +11407,21 @@ var useProfitAndLossQuery = ({
|
|
|
11345
11407
|
};
|
|
11346
11408
|
|
|
11347
11409
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
11348
|
-
var
|
|
11410
|
+
var import_date_fns19 = require("date-fns");
|
|
11349
11411
|
var useProfitAndLoss = ({
|
|
11350
11412
|
startDate: initialStartDate,
|
|
11351
11413
|
endDate: initialEndDate,
|
|
11352
11414
|
tagFilter,
|
|
11353
11415
|
reportingBasis
|
|
11354
11416
|
} = {
|
|
11355
|
-
startDate: (0,
|
|
11356
|
-
endDate: (0,
|
|
11417
|
+
startDate: (0, import_date_fns19.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
11418
|
+
endDate: (0, import_date_fns19.endOfMonth)(/* @__PURE__ */ new Date())
|
|
11357
11419
|
}) => {
|
|
11358
11420
|
const [startDate, setStartDate] = (0, import_react130.useState)(
|
|
11359
|
-
initialStartDate || (0,
|
|
11421
|
+
initialStartDate || (0, import_date_fns19.startOfMonth)(Date.now())
|
|
11360
11422
|
);
|
|
11361
11423
|
const [endDate, setEndDate] = (0, import_react130.useState)(
|
|
11362
|
-
initialEndDate || (0,
|
|
11424
|
+
initialEndDate || (0, import_date_fns19.endOfMonth)(Date.now())
|
|
11363
11425
|
);
|
|
11364
11426
|
const [filters, setFilters] = (0, import_react130.useState)({
|
|
11365
11427
|
expenses: void 0,
|
|
@@ -11373,7 +11435,7 @@ var useProfitAndLoss = ({
|
|
|
11373
11435
|
reportingBasis
|
|
11374
11436
|
});
|
|
11375
11437
|
const { data: summaryData } = useProfitAndLossLTM({
|
|
11376
|
-
currentDate: startDate ? startDate : (0,
|
|
11438
|
+
currentDate: startDate ? startDate : (0, import_date_fns19.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
11377
11439
|
tagFilter
|
|
11378
11440
|
});
|
|
11379
11441
|
const changeDateRange = ({
|
|
@@ -11526,7 +11588,7 @@ var useProfitAndLoss = ({
|
|
|
11526
11588
|
|
|
11527
11589
|
// src/hooks/useProfitAndLossComparison/useProfitAndLossComparison.tsx
|
|
11528
11590
|
var import_react131 = require("react");
|
|
11529
|
-
var
|
|
11591
|
+
var import_date_fns20 = require("date-fns");
|
|
11530
11592
|
var initialFetchDone = false;
|
|
11531
11593
|
var useProfitAndLossComparison = ({
|
|
11532
11594
|
reportingBasis
|
|
@@ -11583,12 +11645,12 @@ var useProfitAndLossComparison = ({
|
|
|
11583
11645
|
type: "Comparison_Months",
|
|
11584
11646
|
months: []
|
|
11585
11647
|
};
|
|
11586
|
-
const adjustedStartDate = (0,
|
|
11648
|
+
const adjustedStartDate = (0, import_date_fns20.startOfMonth)(dateRange.startDate);
|
|
11587
11649
|
for (let i = 0; i < compareMonths2; i++) {
|
|
11588
|
-
const currentMonth = (0,
|
|
11650
|
+
const currentMonth = (0, import_date_fns20.subMonths)(adjustedStartDate, i);
|
|
11589
11651
|
periods.months.push({
|
|
11590
|
-
year: (0,
|
|
11591
|
-
month: (0,
|
|
11652
|
+
year: (0, import_date_fns20.getYear)(currentMonth),
|
|
11653
|
+
month: (0, import_date_fns20.getMonth)(currentMonth) + 1
|
|
11592
11654
|
});
|
|
11593
11655
|
}
|
|
11594
11656
|
periods.months.sort((a, b) => {
|
|
@@ -11805,53 +11867,53 @@ var Indicator = ({
|
|
|
11805
11867
|
|
|
11806
11868
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
11807
11869
|
var import_classnames49 = __toESM(require("classnames"));
|
|
11808
|
-
var
|
|
11870
|
+
var import_date_fns21 = require("date-fns");
|
|
11809
11871
|
var import_recharts = require("recharts");
|
|
11810
11872
|
var getChartWindow = ({
|
|
11811
11873
|
chartWindow,
|
|
11812
11874
|
currentYear,
|
|
11813
11875
|
currentMonth
|
|
11814
11876
|
}) => {
|
|
11815
|
-
const today = (0,
|
|
11816
|
-
const yearAgo = (0,
|
|
11817
|
-
const current = (0,
|
|
11818
|
-
if ((0,
|
|
11877
|
+
const today = (0, import_date_fns21.startOfMonth)(Date.now());
|
|
11878
|
+
const yearAgo = (0, import_date_fns21.sub)(today, { months: 11 });
|
|
11879
|
+
const current = (0, import_date_fns21.startOfMonth)(new Date(currentYear, currentMonth - 1, 1));
|
|
11880
|
+
if ((0, import_date_fns21.differenceInMonths)((0, import_date_fns21.startOfMonth)(chartWindow.start), current) < 0 && (0, import_date_fns21.differenceInMonths)((0, import_date_fns21.startOfMonth)(chartWindow.end), current) > 1) {
|
|
11819
11881
|
return chartWindow;
|
|
11820
11882
|
}
|
|
11821
|
-
if ((0,
|
|
11883
|
+
if ((0, import_date_fns21.differenceInMonths)((0, import_date_fns21.startOfMonth)(chartWindow.start), current) === 0) {
|
|
11822
11884
|
return {
|
|
11823
|
-
start: (0,
|
|
11824
|
-
end: (0,
|
|
11885
|
+
start: (0, import_date_fns21.startOfMonth)((0, import_date_fns21.sub)(current, { months: 1 })),
|
|
11886
|
+
end: (0, import_date_fns21.endOfMonth)((0, import_date_fns21.add)(current, { months: 11 }))
|
|
11825
11887
|
};
|
|
11826
11888
|
}
|
|
11827
|
-
if ((0,
|
|
11889
|
+
if ((0, import_date_fns21.differenceInMonths)((0, import_date_fns21.endOfMonth)(chartWindow.end), (0, import_date_fns21.endOfMonth)(current)) === 1 && (0, import_date_fns21.differenceInMonths)(today, current) >= 1) {
|
|
11828
11890
|
return {
|
|
11829
|
-
start: (0,
|
|
11830
|
-
end: (0,
|
|
11891
|
+
start: (0, import_date_fns21.startOfMonth)((0, import_date_fns21.sub)(current, { months: 10 })),
|
|
11892
|
+
end: (0, import_date_fns21.endOfMonth)((0, import_date_fns21.add)(current, { months: 2 }))
|
|
11831
11893
|
};
|
|
11832
11894
|
}
|
|
11833
|
-
if ((0,
|
|
11895
|
+
if ((0, import_date_fns21.differenceInMonths)(current, (0, import_date_fns21.startOfMonth)(chartWindow.end)) === 0 && (0, import_date_fns21.differenceInMonths)(current, (0, import_date_fns21.startOfMonth)(today)) > 0) {
|
|
11834
11896
|
return {
|
|
11835
|
-
start: (0,
|
|
11836
|
-
end: (0,
|
|
11897
|
+
start: (0, import_date_fns21.startOfMonth)((0, import_date_fns21.sub)(current, { months: 11 })),
|
|
11898
|
+
end: (0, import_date_fns21.endOfMonth)((0, import_date_fns21.add)(current, { months: 1 }))
|
|
11837
11899
|
};
|
|
11838
11900
|
}
|
|
11839
11901
|
if (current >= yearAgo) {
|
|
11840
11902
|
return {
|
|
11841
|
-
start: (0,
|
|
11842
|
-
end: (0,
|
|
11903
|
+
start: (0, import_date_fns21.startOfMonth)(yearAgo),
|
|
11904
|
+
end: (0, import_date_fns21.endOfMonth)(today)
|
|
11843
11905
|
};
|
|
11844
11906
|
}
|
|
11845
11907
|
if (Number(current) > Number(chartWindow.end)) {
|
|
11846
11908
|
return {
|
|
11847
|
-
start: (0,
|
|
11848
|
-
end: (0,
|
|
11909
|
+
start: (0, import_date_fns21.startOfMonth)((0, import_date_fns21.sub)(current, { months: 12 })),
|
|
11910
|
+
end: (0, import_date_fns21.endOfMonth)(current)
|
|
11849
11911
|
};
|
|
11850
11912
|
}
|
|
11851
|
-
if ((0,
|
|
11913
|
+
if ((0, import_date_fns21.differenceInMonths)(current, (0, import_date_fns21.startOfMonth)(chartWindow.start)) < 0) {
|
|
11852
11914
|
return {
|
|
11853
|
-
start: (0,
|
|
11854
|
-
end: (0,
|
|
11915
|
+
start: (0, import_date_fns21.startOfMonth)(current),
|
|
11916
|
+
end: (0, import_date_fns21.endOfMonth)((0, import_date_fns21.add)(current, { months: 11 }))
|
|
11855
11917
|
};
|
|
11856
11918
|
}
|
|
11857
11919
|
return chartWindow;
|
|
@@ -11889,8 +11951,8 @@ var ProfitAndLossChart = ({
|
|
|
11889
11951
|
});
|
|
11890
11952
|
const [barAnimActive, setBarAnimActive] = (0, import_react134.useState)(true);
|
|
11891
11953
|
const [chartWindow, setChartWindow] = (0, import_react134.useState)({
|
|
11892
|
-
start: (0,
|
|
11893
|
-
end: (0,
|
|
11954
|
+
start: (0, import_date_fns21.startOfMonth)((0, import_date_fns21.sub)(Date.now(), { months: 11 })),
|
|
11955
|
+
end: (0, import_date_fns21.endOfMonth)(Date.now())
|
|
11894
11956
|
});
|
|
11895
11957
|
const selectionMonth = (0, import_react134.useMemo)(
|
|
11896
11958
|
() => ({
|
|
@@ -11905,7 +11967,7 @@ var ProfitAndLossChart = ({
|
|
|
11905
11967
|
}
|
|
11906
11968
|
}, [dateRange]);
|
|
11907
11969
|
const { data, loaded, pullData } = useProfitAndLossLTM({
|
|
11908
|
-
currentDate: (0,
|
|
11970
|
+
currentDate: (0, import_date_fns21.startOfMonth)(Date.now()),
|
|
11909
11971
|
tagFilter
|
|
11910
11972
|
});
|
|
11911
11973
|
const anyData = (0, import_react134.useMemo)(() => {
|
|
@@ -11924,19 +11986,19 @@ var ProfitAndLossChart = ({
|
|
|
11924
11986
|
(0, import_react134.useEffect)(() => {
|
|
11925
11987
|
if (loaded === "complete" && data) {
|
|
11926
11988
|
const foundCurrent = data.find(
|
|
11927
|
-
(x) => Number((0,
|
|
11989
|
+
(x) => Number((0, import_date_fns21.startOfMonth)(new Date(x.year, x.month - 1, 1))) >= Number(localDateRange.startDate) && Number((0, import_date_fns21.startOfMonth)(new Date(x.year, x.month - 1, 1))) < Number(localDateRange.endDate)
|
|
11928
11990
|
);
|
|
11929
11991
|
if (!foundCurrent) {
|
|
11930
|
-
const newDate = (0,
|
|
11992
|
+
const newDate = (0, import_date_fns21.startOfMonth)(localDateRange.startDate);
|
|
11931
11993
|
pullData(newDate);
|
|
11932
11994
|
return;
|
|
11933
11995
|
}
|
|
11934
11996
|
const foundBefore = data.find(
|
|
11935
|
-
(x) => Number((0,
|
|
11997
|
+
(x) => Number((0, import_date_fns21.startOfMonth)(new Date(x.year, x.month - 1, 1))) >= Number((0, import_date_fns21.sub)(localDateRange.startDate, { months: 1 })) && Number((0, import_date_fns21.startOfMonth)(new Date(x.year, x.month - 1, 1))) < Number((0, import_date_fns21.sub)(localDateRange.endDate, { months: 1 }))
|
|
11936
11998
|
);
|
|
11937
11999
|
if (!foundBefore) {
|
|
11938
|
-
const newDate = (0,
|
|
11939
|
-
(0,
|
|
12000
|
+
const newDate = (0, import_date_fns21.startOfMonth)(
|
|
12001
|
+
(0, import_date_fns21.sub)(localDateRange.startDate, { months: 1 })
|
|
11940
12002
|
);
|
|
11941
12003
|
pullData(newDate);
|
|
11942
12004
|
}
|
|
@@ -11959,7 +12021,7 @@ var ProfitAndLossChart = ({
|
|
|
11959
12021
|
}, 2e3);
|
|
11960
12022
|
}
|
|
11961
12023
|
}, [loaded]);
|
|
11962
|
-
const getMonthName = (pnl) => pnl ? (0,
|
|
12024
|
+
const getMonthName = (pnl) => pnl ? (0, import_date_fns21.format)(
|
|
11963
12025
|
new Date(pnl.year, pnl.month - 1, 1),
|
|
11964
12026
|
compactView ? "LLLLL" : "LLL"
|
|
11965
12027
|
) : "";
|
|
@@ -11985,9 +12047,9 @@ var ProfitAndLossChart = ({
|
|
|
11985
12047
|
const loadingData = [];
|
|
11986
12048
|
const today = Date.now();
|
|
11987
12049
|
for (let i = 11; i >= 0; i--) {
|
|
11988
|
-
const currentDate = (0,
|
|
12050
|
+
const currentDate = (0, import_date_fns21.sub)(today, { months: i });
|
|
11989
12051
|
loadingData.push({
|
|
11990
|
-
name: (0,
|
|
12052
|
+
name: (0, import_date_fns21.format)(currentDate, compactView ? "LLLLL" : "LLL"),
|
|
11991
12053
|
revenue: 0,
|
|
11992
12054
|
revenueUncategorized: 0,
|
|
11993
12055
|
totalExpensesInverse: 0,
|
|
@@ -12017,18 +12079,18 @@ var ProfitAndLossChart = ({
|
|
|
12017
12079
|
}
|
|
12018
12080
|
return x;
|
|
12019
12081
|
})) == null ? void 0 : _a.filter(
|
|
12020
|
-
(x) => (0,
|
|
12021
|
-
(0,
|
|
12082
|
+
(x) => (0, import_date_fns21.differenceInMonths)(
|
|
12083
|
+
(0, import_date_fns21.startOfMonth)(new Date(x.year, x.month - 1, 1)),
|
|
12022
12084
|
chartWindow.start
|
|
12023
|
-
) >= 0 && (0,
|
|
12024
|
-
(0,
|
|
12085
|
+
) >= 0 && (0, import_date_fns21.differenceInMonths)(
|
|
12086
|
+
(0, import_date_fns21.startOfMonth)(new Date(x.year, x.month - 1, 1)),
|
|
12025
12087
|
chartWindow.start
|
|
12026
|
-
) < 12 && (0,
|
|
12088
|
+
) < 12 && (0, import_date_fns21.differenceInMonths)(
|
|
12027
12089
|
chartWindow.end,
|
|
12028
|
-
(0,
|
|
12029
|
-
) >= 0 && (0,
|
|
12090
|
+
(0, import_date_fns21.startOfMonth)(new Date(x.year, x.month - 1, 1))
|
|
12091
|
+
) >= 0 && (0, import_date_fns21.differenceInMonths)(
|
|
12030
12092
|
chartWindow.end,
|
|
12031
|
-
(0,
|
|
12093
|
+
(0, import_date_fns21.startOfMonth)(new Date(x.year, x.month - 1, 1))
|
|
12032
12094
|
) <= 12
|
|
12033
12095
|
).map((x) => summarizePnL(x));
|
|
12034
12096
|
}, [selectionMonth, chartWindow, data, loaded, compactView]);
|
|
@@ -12045,7 +12107,7 @@ var ProfitAndLossChart = ({
|
|
|
12045
12107
|
if (isMonthAllowed) {
|
|
12046
12108
|
changeDateRange({
|
|
12047
12109
|
startDate: new Date(year, month - 1, 1),
|
|
12048
|
-
endDate: (0,
|
|
12110
|
+
endDate: (0, import_date_fns21.endOfMonth)(new Date(year, month - 1, 1))
|
|
12049
12111
|
});
|
|
12050
12112
|
}
|
|
12051
12113
|
}
|
|
@@ -12599,7 +12661,8 @@ var DATE_RANGE_MODE_CONFIG = {
|
|
|
12599
12661
|
dayPicker: { label: "Day" },
|
|
12600
12662
|
dayRangePicker: { label: "Select dates" },
|
|
12601
12663
|
monthPicker: { label: "Month" },
|
|
12602
|
-
monthRangePicker: { label: "Select months" }
|
|
12664
|
+
monthRangePicker: { label: "Select months" },
|
|
12665
|
+
yearPicker: { label: "Year" }
|
|
12603
12666
|
};
|
|
12604
12667
|
function toToggleOptions(allowedModes) {
|
|
12605
12668
|
return allowedModes.map((mode) => ({
|
|
@@ -12633,7 +12696,7 @@ function DatePickerModeSelector({
|
|
|
12633
12696
|
}
|
|
12634
12697
|
|
|
12635
12698
|
// src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
|
|
12636
|
-
var
|
|
12699
|
+
var import_date_fns22 = require("date-fns");
|
|
12637
12700
|
var ProfitAndLossDatePicker = ({
|
|
12638
12701
|
allowedDatePickerModes,
|
|
12639
12702
|
datePickerMode: deprecated_datePickerMode,
|
|
@@ -12652,8 +12715,8 @@ var ProfitAndLossDatePicker = ({
|
|
|
12652
12715
|
const getComparisonData = (date) => {
|
|
12653
12716
|
if (compareMode && compareMonths > 0) {
|
|
12654
12717
|
refetch({
|
|
12655
|
-
startDate: (0,
|
|
12656
|
-
endDate: (0,
|
|
12718
|
+
startDate: (0, import_date_fns22.startOfMonth)(date),
|
|
12719
|
+
endDate: (0, import_date_fns22.endOfMonth)(date)
|
|
12657
12720
|
});
|
|
12658
12721
|
}
|
|
12659
12722
|
};
|
|
@@ -12696,8 +12759,8 @@ var ProfitAndLossDatePicker = ({
|
|
|
12696
12759
|
if (!Array.isArray(date)) {
|
|
12697
12760
|
getComparisonData(date);
|
|
12698
12761
|
changeDateRange({
|
|
12699
|
-
startDate: (0,
|
|
12700
|
-
endDate: (0,
|
|
12762
|
+
startDate: (0, import_date_fns22.startOfMonth)(date),
|
|
12763
|
+
endDate: (0, import_date_fns22.endOfMonth)(date)
|
|
12701
12764
|
});
|
|
12702
12765
|
}
|
|
12703
12766
|
},
|
|
@@ -13371,7 +13434,7 @@ var Filters = ({
|
|
|
13371
13434
|
};
|
|
13372
13435
|
|
|
13373
13436
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
13374
|
-
var
|
|
13437
|
+
var import_date_fns23 = require("date-fns");
|
|
13375
13438
|
var ProfitAndLossDetailedCharts = ({
|
|
13376
13439
|
scope,
|
|
13377
13440
|
hideClose = false,
|
|
@@ -13396,7 +13459,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
13396
13459
|
const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
|
|
13397
13460
|
const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
|
|
13398
13461
|
const [hoveredItem, setHoveredItem] = (0, import_react141.useState)();
|
|
13399
|
-
return /* @__PURE__ */ import_react141.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts" }, /* @__PURE__ */ import_react141.default.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header" }, /* @__PURE__ */ import_react141.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ import_react141.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(theScope)), /* @__PURE__ */ import_react141.default.createElement(Text, { size: "sm" /* sm */, className: "date" }, (0,
|
|
13462
|
+
return /* @__PURE__ */ import_react141.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts" }, /* @__PURE__ */ import_react141.default.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header" }, /* @__PURE__ */ import_react141.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ import_react141.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(theScope)), /* @__PURE__ */ import_react141.default.createElement(Text, { size: "sm" /* sm */, className: "date" }, (0, import_date_fns23.format)(dateRange.startDate, "LLLL, y")), showDatePicker && /* @__PURE__ */ import_react141.default.createElement(ProfitAndLossDatePicker, null)), !hideClose && /* @__PURE__ */ import_react141.default.createElement(
|
|
13400
13463
|
Button,
|
|
13401
13464
|
{
|
|
13402
13465
|
rightIcon: /* @__PURE__ */ import_react141.default.createElement(X_default, null),
|
|
@@ -13404,7 +13467,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
13404
13467
|
onClick: () => setSidebarScope(void 0),
|
|
13405
13468
|
variant: "secondary" /* secondary */
|
|
13406
13469
|
}
|
|
13407
|
-
)), /* @__PURE__ */ import_react141.default.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header--tablet" }, !hideClose && /* @__PURE__ */ import_react141.default.createElement(BackButton, { onClick: () => setSidebarScope(void 0) }), /* @__PURE__ */ import_react141.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ import_react141.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(theScope)), /* @__PURE__ */ import_react141.default.createElement(Text, { size: "sm" /* sm */, className: "date" }, (0,
|
|
13470
|
+
)), /* @__PURE__ */ import_react141.default.createElement("header", { className: "Layer__profit-and-loss-detailed-charts__header--tablet" }, !hideClose && /* @__PURE__ */ import_react141.default.createElement(BackButton, { onClick: () => setSidebarScope(void 0) }), /* @__PURE__ */ import_react141.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ import_react141.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(theScope)), /* @__PURE__ */ import_react141.default.createElement(Text, { size: "sm" /* sm */, className: "date" }, (0, import_date_fns23.format)(dateRange.startDate, "LLLL, y")))), /* @__PURE__ */ import_react141.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__content" }, /* @__PURE__ */ import_react141.default.createElement(
|
|
13408
13471
|
DetailedChart,
|
|
13409
13472
|
{
|
|
13410
13473
|
filteredData: data,
|
|
@@ -14066,11 +14129,11 @@ var useTableExpandRow = () => {
|
|
|
14066
14129
|
};
|
|
14067
14130
|
|
|
14068
14131
|
// src/utils/profitAndLossComparisonUtils.ts
|
|
14069
|
-
var
|
|
14132
|
+
var import_date_fns24 = require("date-fns");
|
|
14070
14133
|
var generatComparisonMonths = (startDate, numberOfMonths) => {
|
|
14071
14134
|
return Array.from({ length: numberOfMonths }, (_, index) => {
|
|
14072
|
-
const currentMonth = (0,
|
|
14073
|
-
return (0,
|
|
14135
|
+
const currentMonth = (0, import_date_fns24.subMonths)(startDate, numberOfMonths - index - 1);
|
|
14136
|
+
return (0, import_date_fns24.format)(currentMonth, "MMM");
|
|
14074
14137
|
});
|
|
14075
14138
|
};
|
|
14076
14139
|
var getComparisonValue = (name, depth, cellData) => {
|
|
@@ -14613,7 +14676,7 @@ var ProfitAndLossTableWithProvider = (props) => {
|
|
|
14613
14676
|
};
|
|
14614
14677
|
|
|
14615
14678
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
14616
|
-
var
|
|
14679
|
+
var import_date_fns25 = require("date-fns");
|
|
14617
14680
|
var PNLContext = (0, import_react168.createContext)({
|
|
14618
14681
|
data: void 0,
|
|
14619
14682
|
filteredDataRevenue: [],
|
|
@@ -14624,8 +14687,8 @@ var PNLContext = (0, import_react168.createContext)({
|
|
|
14624
14687
|
isValidating: false,
|
|
14625
14688
|
error: void 0,
|
|
14626
14689
|
dateRange: {
|
|
14627
|
-
startDate: (0,
|
|
14628
|
-
endDate: (0,
|
|
14690
|
+
startDate: (0, import_date_fns25.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
14691
|
+
endDate: (0, import_date_fns25.endOfMonth)(/* @__PURE__ */ new Date())
|
|
14629
14692
|
},
|
|
14630
14693
|
changeDateRange: () => {
|
|
14631
14694
|
},
|
|
@@ -14681,13 +14744,13 @@ var BalanceSheetContext = (0, import_react169.createContext)({
|
|
|
14681
14744
|
|
|
14682
14745
|
// src/hooks/useBalanceSheet/useBalanceSheet.tsx
|
|
14683
14746
|
var import_react170 = require("react");
|
|
14684
|
-
var
|
|
14747
|
+
var import_date_fns26 = require("date-fns");
|
|
14685
14748
|
var import_swr7 = __toESM(require("swr"));
|
|
14686
14749
|
var useBalanceSheet = (date = /* @__PURE__ */ new Date()) => {
|
|
14687
14750
|
const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
14688
14751
|
const { apiUrl } = useEnvironment();
|
|
14689
14752
|
const { data: auth } = useAuth();
|
|
14690
|
-
const dateString = (0,
|
|
14753
|
+
const dateString = (0, import_date_fns26.format)((0, import_date_fns26.startOfDay)(date), "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
14691
14754
|
const queryKey = businessId && dateString && (auth == null ? void 0 : auth.access_token) && `balance-sheet-${businessId}-${dateString}`;
|
|
14692
14755
|
const { data, isLoading, isValidating, error, mutate } = (0, import_swr7.default)(
|
|
14693
14756
|
queryKey,
|
|
@@ -14870,7 +14933,7 @@ var BALANCE_SHEET_ROWS = [
|
|
|
14870
14933
|
];
|
|
14871
14934
|
|
|
14872
14935
|
// src/components/BalanceSheet/BalanceSheet.tsx
|
|
14873
|
-
var
|
|
14936
|
+
var import_date_fns27 = require("date-fns");
|
|
14874
14937
|
|
|
14875
14938
|
// src/components/BalanceSheet/download/BalanceSheetDownloadButton.tsx
|
|
14876
14939
|
var import_react176 = __toESM(require("react"));
|
|
@@ -15008,14 +15071,14 @@ var BalanceSheetView = ({
|
|
|
15008
15071
|
asWidget = false,
|
|
15009
15072
|
stringOverrides
|
|
15010
15073
|
}) => {
|
|
15011
|
-
const [effectiveDate, setEffectiveDate] = (0, import_react177.useState)((0,
|
|
15074
|
+
const [effectiveDate, setEffectiveDate] = (0, import_react177.useState)((0, import_date_fns27.startOfDay)(/* @__PURE__ */ new Date()));
|
|
15012
15075
|
const { data, isLoading, refetch } = useBalanceSheet(effectiveDate);
|
|
15013
15076
|
const { view, containerRef } = useElementViewSize();
|
|
15014
15077
|
(0, import_react177.useEffect)(() => {
|
|
15015
|
-
const d1 = effectiveDate && (0,
|
|
15016
|
-
const d2 = (data == null ? void 0 : data.effective_date) && (0,
|
|
15017
|
-
(0,
|
|
15018
|
-
(0,
|
|
15078
|
+
const d1 = effectiveDate && (0, import_date_fns27.format)((0, import_date_fns27.startOfDay)(effectiveDate), "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
15079
|
+
const d2 = (data == null ? void 0 : data.effective_date) && (0, import_date_fns27.format)(
|
|
15080
|
+
(0, import_date_fns27.startOfDay)(
|
|
15081
|
+
(0, import_date_fns27.parse)(data.effective_date, "yyyy-MM-dd'T'HH:mm:ssXXX", /* @__PURE__ */ new Date())
|
|
15019
15082
|
),
|
|
15020
15083
|
"yyyy-MM-dd'T'HH:mm:ssXXX"
|
|
15021
15084
|
);
|
|
@@ -15092,17 +15155,17 @@ var StatementOfCashFlowContext = (0, import_react178.createContext)({
|
|
|
15092
15155
|
|
|
15093
15156
|
// src/hooks/useStatementOfCashFlow/useStatementOfCashFlow.tsx
|
|
15094
15157
|
var import_react179 = require("react");
|
|
15095
|
-
var
|
|
15158
|
+
var import_date_fns28 = require("date-fns");
|
|
15096
15159
|
var import_swr8 = __toESM(require("swr"));
|
|
15097
15160
|
var useStatementOfCashFlow = (startDate = /* @__PURE__ */ new Date(), endDate = /* @__PURE__ */ new Date()) => {
|
|
15098
15161
|
const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
15099
15162
|
const { apiUrl } = useEnvironment();
|
|
15100
15163
|
const { data: auth } = useAuth();
|
|
15101
|
-
const startDateString = (0,
|
|
15102
|
-
(0,
|
|
15164
|
+
const startDateString = (0, import_date_fns28.format)(
|
|
15165
|
+
(0, import_date_fns28.startOfDay)(startDate),
|
|
15103
15166
|
"yyyy-MM-dd'T'HH:mm:ssXXX"
|
|
15104
15167
|
);
|
|
15105
|
-
const endDateString = (0,
|
|
15168
|
+
const endDateString = (0, import_date_fns28.format)((0, import_date_fns28.startOfDay)(endDate), "yyyy-MM-dd'T'HH:mm:ssXXX");
|
|
15106
15169
|
const queryKey = businessId && startDateString && endDateString && (auth == null ? void 0 : auth.access_token) && `statement-of-cash-${businessId}-${startDateString}-${endDateString}`;
|
|
15107
15170
|
const { data, isLoading, isValidating, error, mutate } = (0, import_swr8.default)(
|
|
15108
15171
|
queryKey,
|
|
@@ -15241,7 +15304,7 @@ var STATEMENT_OF_CASH_FLOW_ROWS = [
|
|
|
15241
15304
|
];
|
|
15242
15305
|
|
|
15243
15306
|
// src/components/StatementOfCashFlow/StatementOfCashFlow.tsx
|
|
15244
|
-
var
|
|
15307
|
+
var import_date_fns29 = require("date-fns");
|
|
15245
15308
|
|
|
15246
15309
|
// src/components/StatementOfCashFlow/download/CashflowStatementDownloadButton.tsx
|
|
15247
15310
|
var import_react181 = __toESM(require("react"));
|
|
@@ -15342,9 +15405,9 @@ var StatementOfCashFlowView = ({
|
|
|
15342
15405
|
customDateRanges
|
|
15343
15406
|
}) => {
|
|
15344
15407
|
const [startDate, setStartDate] = (0, import_react182.useState)(
|
|
15345
|
-
(0,
|
|
15408
|
+
(0, import_date_fns29.startOfDay)((0, import_date_fns29.subWeeks)(/* @__PURE__ */ new Date(), 4))
|
|
15346
15409
|
);
|
|
15347
|
-
const [endDate, setEndDate] = (0, import_react182.useState)((0,
|
|
15410
|
+
const [endDate, setEndDate] = (0, import_react182.useState)((0, import_date_fns29.startOfDay)(/* @__PURE__ */ new Date()));
|
|
15348
15411
|
const { data, isLoading, refetch } = useStatementOfCashFlow(
|
|
15349
15412
|
startDate,
|
|
15350
15413
|
endDate
|
|
@@ -15355,10 +15418,10 @@ var StatementOfCashFlowView = ({
|
|
|
15355
15418
|
);
|
|
15356
15419
|
const handleDateChange = (dates) => {
|
|
15357
15420
|
if (dates[0]) {
|
|
15358
|
-
setStartDate((0,
|
|
15421
|
+
setStartDate((0, import_date_fns29.startOfDay)(dates[0]));
|
|
15359
15422
|
}
|
|
15360
15423
|
if (dates[1]) {
|
|
15361
|
-
setEndDate((0,
|
|
15424
|
+
setEndDate((0, import_date_fns29.startOfDay)(dates[1]));
|
|
15362
15425
|
}
|
|
15363
15426
|
if (dates[0] && dates[1]) {
|
|
15364
15427
|
refetch();
|
|
@@ -15371,7 +15434,7 @@ var StatementOfCashFlowView = ({
|
|
|
15371
15434
|
onChange: (dates) => {
|
|
15372
15435
|
if (!Array.isArray(dates)) {
|
|
15373
15436
|
const date = dates;
|
|
15374
|
-
handleDateChange([(0,
|
|
15437
|
+
handleDateChange([(0, import_date_fns29.startOfMonth)(date), (0, import_date_fns29.endOfMonth)(date)]);
|
|
15375
15438
|
}
|
|
15376
15439
|
},
|
|
15377
15440
|
dateFormat: "MMM",
|
|
@@ -15427,7 +15490,7 @@ var import_react200 = __toESM(require("react"));
|
|
|
15427
15490
|
|
|
15428
15491
|
// src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
|
|
15429
15492
|
var import_react183 = require("react");
|
|
15430
|
-
var
|
|
15493
|
+
var import_date_fns30 = require("date-fns");
|
|
15431
15494
|
var ChartOfAccountsContext = (0, import_react183.createContext)(
|
|
15432
15495
|
{
|
|
15433
15496
|
data: void 0,
|
|
@@ -15450,8 +15513,8 @@ var ChartOfAccountsContext = (0, import_react183.createContext)(
|
|
|
15450
15513
|
submitForm: () => {
|
|
15451
15514
|
},
|
|
15452
15515
|
dateRange: {
|
|
15453
|
-
startDate: (0,
|
|
15454
|
-
endDate: (0,
|
|
15516
|
+
startDate: (0, import_date_fns30.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
15517
|
+
endDate: (0, import_date_fns30.endOfMonth)(/* @__PURE__ */ new Date())
|
|
15455
15518
|
},
|
|
15456
15519
|
changeDateRange: () => {
|
|
15457
15520
|
}
|
|
@@ -15686,7 +15749,7 @@ var LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE = {
|
|
|
15686
15749
|
};
|
|
15687
15750
|
|
|
15688
15751
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
15689
|
-
var
|
|
15752
|
+
var import_date_fns31 = require("date-fns");
|
|
15690
15753
|
var import_swr9 = __toESM(require("swr"));
|
|
15691
15754
|
var validate = (formData) => {
|
|
15692
15755
|
const errors = [];
|
|
@@ -15770,8 +15833,8 @@ var validateName = (formData) => {
|
|
|
15770
15833
|
var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.sub_accounts || [])]).flat().filter((id) => id);
|
|
15771
15834
|
var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: initialEndDate } = {
|
|
15772
15835
|
withDates: false,
|
|
15773
|
-
startDate: (0,
|
|
15774
|
-
endDate: (0,
|
|
15836
|
+
startDate: (0, import_date_fns31.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
15837
|
+
endDate: (0, import_date_fns31.endOfMonth)(/* @__PURE__ */ new Date())
|
|
15775
15838
|
}) => {
|
|
15776
15839
|
const {
|
|
15777
15840
|
businessId,
|
|
@@ -15786,10 +15849,10 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
15786
15849
|
const [sendingForm, setSendingForm] = (0, import_react185.useState)(false);
|
|
15787
15850
|
const [apiError, setApiError] = (0, import_react185.useState)(void 0);
|
|
15788
15851
|
const [startDate, setStartDate] = (0, import_react185.useState)(
|
|
15789
|
-
initialStartDate != null ? initialStartDate : (0,
|
|
15852
|
+
initialStartDate != null ? initialStartDate : (0, import_date_fns31.startOfMonth)(Date.now())
|
|
15790
15853
|
);
|
|
15791
15854
|
const [endDate, setEndDate] = (0, import_react185.useState)(
|
|
15792
|
-
initialEndDate != null ? initialEndDate : (0,
|
|
15855
|
+
initialEndDate != null ? initialEndDate : (0, import_date_fns31.endOfMonth)(Date.now())
|
|
15793
15856
|
);
|
|
15794
15857
|
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()}`;
|
|
15795
15858
|
const { data, isLoading, isValidating, error, mutate } = (0, import_swr9.default)(
|
|
@@ -15797,8 +15860,8 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
15797
15860
|
Layer.getLedgerAccountBalances(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
15798
15861
|
params: {
|
|
15799
15862
|
businessId,
|
|
15800
|
-
startDate: withDates && startDate ? (0,
|
|
15801
|
-
endDate: withDates && endDate ? (0,
|
|
15863
|
+
startDate: withDates && startDate ? (0, import_date_fns31.formatISO)(startDate.valueOf()) : void 0,
|
|
15864
|
+
endDate: withDates && endDate ? (0, import_date_fns31.formatISO)(endDate.valueOf()) : void 0
|
|
15802
15865
|
}
|
|
15803
15866
|
})
|
|
15804
15867
|
);
|
|
@@ -16106,7 +16169,7 @@ var Plus_default = Plus;
|
|
|
16106
16169
|
|
|
16107
16170
|
// src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
|
|
16108
16171
|
var import_react187 = __toESM(require("react"));
|
|
16109
|
-
var
|
|
16172
|
+
var import_date_fns32 = require("date-fns");
|
|
16110
16173
|
var ChartOfAccountsDatePicker = () => {
|
|
16111
16174
|
const { changeDateRange, dateRange } = (0, import_react187.useContext)(ChartOfAccountsContext);
|
|
16112
16175
|
return /* @__PURE__ */ import_react187.default.createElement(
|
|
@@ -16117,8 +16180,8 @@ var ChartOfAccountsDatePicker = () => {
|
|
|
16117
16180
|
onChange: (date) => {
|
|
16118
16181
|
if (!Array.isArray(date)) {
|
|
16119
16182
|
changeDateRange({
|
|
16120
|
-
startDate: (0,
|
|
16121
|
-
endDate: (0,
|
|
16183
|
+
startDate: (0, import_date_fns32.startOfMonth)(date),
|
|
16184
|
+
endDate: (0, import_date_fns32.endOfMonth)(date)
|
|
16122
16185
|
});
|
|
16123
16186
|
}
|
|
16124
16187
|
}
|
|
@@ -16636,20 +16699,20 @@ var Card = ({ children, className }) => {
|
|
|
16636
16699
|
|
|
16637
16700
|
// src/components/DateTime/DateTime.tsx
|
|
16638
16701
|
var import_react194 = __toESM(require("react"));
|
|
16639
|
-
var
|
|
16702
|
+
var import_date_fns33 = require("date-fns");
|
|
16640
16703
|
var DateTime = ({
|
|
16641
16704
|
value,
|
|
16642
|
-
format:
|
|
16705
|
+
format: format9,
|
|
16643
16706
|
dateFormat,
|
|
16644
16707
|
timeFormat,
|
|
16645
16708
|
onlyDate,
|
|
16646
16709
|
onlyTime
|
|
16647
16710
|
}) => {
|
|
16648
|
-
if (
|
|
16649
|
-
return /* @__PURE__ */ import_react194.default.createElement(Text, { className: "Layer__datetime" }, (0,
|
|
16711
|
+
if (format9) {
|
|
16712
|
+
return /* @__PURE__ */ import_react194.default.createElement(Text, { className: "Layer__datetime" }, (0, import_date_fns33.format)((0, import_date_fns33.parseISO)(value), format9));
|
|
16650
16713
|
}
|
|
16651
|
-
const date = (0,
|
|
16652
|
-
const time = (0,
|
|
16714
|
+
const date = (0, import_date_fns33.format)((0, import_date_fns33.parseISO)(value), dateFormat != null ? dateFormat : DATE_FORMAT);
|
|
16715
|
+
const time = (0, import_date_fns33.format)((0, import_date_fns33.parseISO)(value), timeFormat != null ? timeFormat : TIME_FORMAT);
|
|
16653
16716
|
return /* @__PURE__ */ import_react194.default.createElement(Text, { className: "Layer__datetime" }, !onlyTime && /* @__PURE__ */ import_react194.default.createElement(
|
|
16654
16717
|
Text,
|
|
16655
16718
|
{
|
|
@@ -16926,7 +16989,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
16926
16989
|
// src/components/LedgerAccount/LedgerAccountRow.tsx
|
|
16927
16990
|
var import_react198 = __toESM(require("react"));
|
|
16928
16991
|
var import_classnames65 = __toESM(require("classnames"));
|
|
16929
|
-
var
|
|
16992
|
+
var import_date_fns34 = require("date-fns");
|
|
16930
16993
|
var LedgerAccountRow = ({
|
|
16931
16994
|
row,
|
|
16932
16995
|
index,
|
|
@@ -16966,7 +17029,7 @@ var LedgerAccountRow = ({
|
|
|
16966
17029
|
}
|
|
16967
17030
|
}
|
|
16968
17031
|
},
|
|
16969
|
-
/* @__PURE__ */ import_react198.default.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ import_react198.default.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ import_react198.default.createElement(Text, null, row.date && (0,
|
|
17032
|
+
/* @__PURE__ */ import_react198.default.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ import_react198.default.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ import_react198.default.createElement(Text, null, row.date && (0, import_date_fns34.format)((0, import_date_fns34.parseISO)(row.date), DATE_FORMAT)), /* @__PURE__ */ import_react198.default.createElement(
|
|
16970
17033
|
Text,
|
|
16971
17034
|
{
|
|
16972
17035
|
weight: "normal" /* normal */,
|
|
@@ -16999,7 +17062,7 @@ var LedgerAccountRow = ({
|
|
|
16999
17062
|
}
|
|
17000
17063
|
}
|
|
17001
17064
|
},
|
|
17002
|
-
/* @__PURE__ */ import_react198.default.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ import_react198.default.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ import_react198.default.createElement(Text, null, row.date && (0,
|
|
17065
|
+
/* @__PURE__ */ import_react198.default.createElement("td", { className: "Layer__table-cell Layer__ledger-account-table__tablet-main-col" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ import_react198.default.createElement("div", { className: "Layer__ledger-account-table__tablet-main-col__date" }, /* @__PURE__ */ import_react198.default.createElement(Text, null, row.date && (0, import_date_fns34.format)((0, import_date_fns34.parseISO)(row.date), DATE_FORMAT)), /* @__PURE__ */ import_react198.default.createElement(
|
|
17003
17066
|
Text,
|
|
17004
17067
|
{
|
|
17005
17068
|
weight: "normal" /* normal */,
|
|
@@ -17028,7 +17091,7 @@ var LedgerAccountRow = ({
|
|
|
17028
17091
|
}
|
|
17029
17092
|
}
|
|
17030
17093
|
},
|
|
17031
|
-
/* @__PURE__ */ import_react198.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "Layer__table-cell-content" }, row.date && (0,
|
|
17094
|
+
/* @__PURE__ */ import_react198.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "Layer__table-cell-content" }, row.date && (0, import_date_fns34.format)((0, import_date_fns34.parseISO)(row.date), DATE_FORMAT))),
|
|
17032
17095
|
/* @__PURE__ */ import_react198.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "Layer__table-cell-content" }, entryNumber(row))),
|
|
17033
17096
|
/* @__PURE__ */ import_react198.default.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "Layer__table-cell-content" }, (_f = (_e = row.source) == null ? void 0 : _e.display_description) != null ? _f : "")),
|
|
17034
17097
|
/* @__PURE__ */ import_react198.default.createElement("td", { className: "Layer__table-cell Layer__table-cell--primary" }, /* @__PURE__ */ import_react198.default.createElement("span", { className: "Layer__table-cell-content Layer__table-cell--amount" }, row.direction === "DEBIT" /* DEBIT */ && `$${centsToDollars((row == null ? void 0 : row.amount) || 0)}`)),
|
|
@@ -17955,7 +18018,7 @@ var JournalSidebar = ({
|
|
|
17955
18018
|
|
|
17956
18019
|
// src/components/JournalTable/JournalTable.tsx
|
|
17957
18020
|
var import_react207 = __toESM(require("react"));
|
|
17958
|
-
var
|
|
18021
|
+
var import_date_fns35 = require("date-fns");
|
|
17959
18022
|
var accountName = (row) => {
|
|
17960
18023
|
if ("account" in row) {
|
|
17961
18024
|
return row.account.name;
|
|
@@ -18020,7 +18083,7 @@ var JournalTableContent = ({
|
|
|
18020
18083
|
},
|
|
18021
18084
|
entryNumber(row)
|
|
18022
18085
|
),
|
|
18023
|
-
/* @__PURE__ */ import_react207.default.createElement(TableCell, null, row.entry_at && (0,
|
|
18086
|
+
/* @__PURE__ */ import_react207.default.createElement(TableCell, null, row.entry_at && (0, import_date_fns35.format)((0, import_date_fns35.parseISO)(row.entry_at), DATE_FORMAT)),
|
|
18024
18087
|
/* @__PURE__ */ import_react207.default.createElement(TableCell, null, humanizeEnum(row.entry_type)),
|
|
18025
18088
|
/* @__PURE__ */ import_react207.default.createElement(TableCell, null, "(", row.line_items.length, ")"),
|
|
18026
18089
|
/* @__PURE__ */ import_react207.default.createElement(TableCell, { isCurrency: true, primary: true, align: "right" /* RIGHT */ }, "line_items" in row && Math.abs(
|
|
@@ -18184,26 +18247,42 @@ var JournalContent = ({
|
|
|
18184
18247
|
};
|
|
18185
18248
|
|
|
18186
18249
|
// src/components/Tasks/Tasks.tsx
|
|
18187
|
-
var
|
|
18250
|
+
var import_react218 = __toESM(require("react"));
|
|
18188
18251
|
|
|
18189
18252
|
// src/contexts/TasksContext/TasksContext.tsx
|
|
18190
18253
|
var import_react210 = require("react");
|
|
18254
|
+
var import_date_fns36 = require("date-fns");
|
|
18191
18255
|
var TasksContext = (0, import_react210.createContext)({
|
|
18192
18256
|
data: void 0,
|
|
18193
18257
|
isLoading: false,
|
|
18194
18258
|
loadedStatus: "initial",
|
|
18195
18259
|
error: void 0,
|
|
18260
|
+
currentDate: /* @__PURE__ */ new Date(),
|
|
18261
|
+
setCurrentDate: () => {
|
|
18262
|
+
},
|
|
18263
|
+
dateRange: { startDate: (0, import_date_fns36.startOfYear)(/* @__PURE__ */ new Date()), endDate: (0, import_date_fns36.endOfYear)(/* @__PURE__ */ new Date()) },
|
|
18264
|
+
setDateRange: () => {
|
|
18265
|
+
},
|
|
18196
18266
|
refetch: () => {
|
|
18197
18267
|
},
|
|
18198
18268
|
submitResponseToTask: () => {
|
|
18199
18269
|
},
|
|
18200
|
-
|
|
18270
|
+
updateDocUploadTaskDescription: () => {
|
|
18271
|
+
},
|
|
18272
|
+
uploadDocumentsForTask: () => Promise.resolve(),
|
|
18273
|
+
deleteUploadsForTask: () => {
|
|
18201
18274
|
}
|
|
18202
18275
|
});
|
|
18203
18276
|
|
|
18204
18277
|
// src/hooks/useTasks/useTasks.tsx
|
|
18205
18278
|
var import_react211 = require("react");
|
|
18206
18279
|
|
|
18280
|
+
// src/types/tasks.ts
|
|
18281
|
+
var COMPLETED_TASK_TYPES = ["COMPLETED", "USER_MARKED_COMPLETED"];
|
|
18282
|
+
function isComplete(taskType) {
|
|
18283
|
+
return COMPLETED_TASK_TYPES.includes(taskType);
|
|
18284
|
+
}
|
|
18285
|
+
|
|
18207
18286
|
// src/hooks/useTasks/mockData.ts
|
|
18208
18287
|
var mockData = [
|
|
18209
18288
|
{
|
|
@@ -18220,7 +18299,9 @@ var mockData = [
|
|
|
18220
18299
|
completed_at: null,
|
|
18221
18300
|
created_at: "2024-09-12T05:56:49.360176Z",
|
|
18222
18301
|
updated_at: "2024-09-12T05:56:49.360176Z",
|
|
18223
|
-
|
|
18302
|
+
effective_date: "2024-09-12T05:56:49.360176Z",
|
|
18303
|
+
document_type: "LOAN_STATEMENT",
|
|
18304
|
+
documents: []
|
|
18224
18305
|
},
|
|
18225
18306
|
{
|
|
18226
18307
|
id: "f49e6eb2-52d4-4872-b34a-2baf387b8593",
|
|
@@ -18236,25 +18317,67 @@ var mockData = [
|
|
|
18236
18317
|
completed_at: null,
|
|
18237
18318
|
created_at: "2024-09-12T05:56:49.360176Z",
|
|
18238
18319
|
updated_at: "2024-09-12T05:56:49.360176Z",
|
|
18239
|
-
|
|
18320
|
+
effective_date: "2024-09-12T05:56:49.360176Z",
|
|
18321
|
+
document_type: "BANK_STATEMENT",
|
|
18322
|
+
documents: []
|
|
18240
18323
|
}
|
|
18241
18324
|
];
|
|
18242
18325
|
|
|
18243
18326
|
// src/hooks/useTasks/useTasks.tsx
|
|
18244
18327
|
var import_swr12 = __toESM(require("swr"));
|
|
18328
|
+
var import_date_fns37 = require("date-fns");
|
|
18245
18329
|
var DEBUG_MODE = false;
|
|
18246
|
-
var useTasks = (
|
|
18330
|
+
var useTasks = ({
|
|
18331
|
+
startDate: initialStartDate = (0, import_date_fns37.startOfYear)(/* @__PURE__ */ new Date()),
|
|
18332
|
+
endDate: initialEndDate = (0, import_date_fns37.endOfYear)(/* @__PURE__ */ new Date())
|
|
18333
|
+
} = {}) => {
|
|
18247
18334
|
const [loadedStatus, setLoadedStatus] = (0, import_react211.useState)("initial");
|
|
18248
18335
|
const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
18249
18336
|
const { apiUrl } = useEnvironment();
|
|
18250
18337
|
const { data: auth } = useAuth();
|
|
18251
|
-
const
|
|
18338
|
+
const [dateRange, setDateRange] = (0, import_react211.useState)({
|
|
18339
|
+
startDate: initialStartDate,
|
|
18340
|
+
endDate: initialEndDate
|
|
18341
|
+
});
|
|
18342
|
+
const [currentDate, setCurrentDate] = (0, import_react211.useState)(/* @__PURE__ */ new Date());
|
|
18343
|
+
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `tasks-${businessId}-${dateRange.startDate}-${dateRange.endDate}`;
|
|
18252
18344
|
const { data, isLoading, isValidating, error, mutate } = (0, import_swr12.default)(
|
|
18253
18345
|
queryKey,
|
|
18254
18346
|
Layer.getTasks(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18255
|
-
params: {
|
|
18347
|
+
params: {
|
|
18348
|
+
businessId,
|
|
18349
|
+
startDate: (0, import_date_fns37.formatISO)(dateRange.startDate.valueOf()),
|
|
18350
|
+
endDate: (0, import_date_fns37.formatISO)(dateRange.endDate.valueOf())
|
|
18351
|
+
}
|
|
18256
18352
|
})
|
|
18257
18353
|
);
|
|
18354
|
+
const monthlyData = (0, import_react211.useMemo)(() => {
|
|
18355
|
+
if (data == null ? void 0 : data.data) {
|
|
18356
|
+
const grouped = data.data.reduce((acc, task) => {
|
|
18357
|
+
const effectiveDate = task.effective_date ? (0, import_date_fns37.parseISO)(task.effective_date) : (0, import_date_fns37.parseISO)(task.created_at);
|
|
18358
|
+
const year = (0, import_date_fns37.getYear)(effectiveDate);
|
|
18359
|
+
const month = (0, import_date_fns37.getMonth)(effectiveDate);
|
|
18360
|
+
const key = `${year}-${month}`;
|
|
18361
|
+
if (!acc[key]) {
|
|
18362
|
+
acc[key] = {
|
|
18363
|
+
year,
|
|
18364
|
+
month,
|
|
18365
|
+
total: 0,
|
|
18366
|
+
completed: 0,
|
|
18367
|
+
tasks: []
|
|
18368
|
+
};
|
|
18369
|
+
}
|
|
18370
|
+
acc[key].tasks.push(task);
|
|
18371
|
+
if (isComplete(task.status)) {
|
|
18372
|
+
acc[key].completed += 1;
|
|
18373
|
+
}
|
|
18374
|
+
acc[key].total += 1;
|
|
18375
|
+
return acc;
|
|
18376
|
+
}, {});
|
|
18377
|
+
return Object.values(grouped);
|
|
18378
|
+
}
|
|
18379
|
+
return [];
|
|
18380
|
+
}, [data]);
|
|
18258
18381
|
(0, import_react211.useEffect)(() => {
|
|
18259
18382
|
if (isLoading && loadedStatus === "initial") {
|
|
18260
18383
|
setLoadedStatus("loading");
|
|
@@ -18263,17 +18386,18 @@ var useTasks = () => {
|
|
|
18263
18386
|
}
|
|
18264
18387
|
}, [isLoading]);
|
|
18265
18388
|
const refetch = () => mutate();
|
|
18266
|
-
const
|
|
18267
|
-
const
|
|
18389
|
+
const uploadDocumentsForTask = (taskId, files, description) => __async(void 0, null, function* () {
|
|
18390
|
+
const uploadDocuments = Layer.completeTaskWithUpload(
|
|
18268
18391
|
apiUrl,
|
|
18269
18392
|
auth == null ? void 0 : auth.access_token
|
|
18270
18393
|
);
|
|
18271
|
-
|
|
18394
|
+
yield uploadDocuments({
|
|
18272
18395
|
businessId,
|
|
18273
18396
|
taskId,
|
|
18274
|
-
|
|
18397
|
+
files,
|
|
18398
|
+
description
|
|
18275
18399
|
}).then(refetch);
|
|
18276
|
-
};
|
|
18400
|
+
});
|
|
18277
18401
|
const submitResponseToTask2 = (taskId, userResponse) => {
|
|
18278
18402
|
if (!taskId || !userResponse || userResponse.length === 0)
|
|
18279
18403
|
return;
|
|
@@ -18286,6 +18410,21 @@ var useTasks = () => {
|
|
|
18286
18410
|
body: data2
|
|
18287
18411
|
}).then(() => refetch());
|
|
18288
18412
|
};
|
|
18413
|
+
const deleteUploadsForTask = (taskId) => {
|
|
18414
|
+
Layer.deleteTaskUploads(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18415
|
+
params: { businessId, taskId }
|
|
18416
|
+
}).then(() => refetch());
|
|
18417
|
+
};
|
|
18418
|
+
const updateDocUploadTaskDescription = (taskId, userResponse) => {
|
|
18419
|
+
const data2 = {
|
|
18420
|
+
type: "FreeResponse",
|
|
18421
|
+
user_response: userResponse
|
|
18422
|
+
};
|
|
18423
|
+
Layer.updateUploadDocumentTaskDescription(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18424
|
+
params: { businessId, taskId },
|
|
18425
|
+
body: data2
|
|
18426
|
+
}).then(() => refetch());
|
|
18427
|
+
};
|
|
18289
18428
|
(0, import_react211.useEffect)(() => {
|
|
18290
18429
|
if (queryKey && (isLoading || isValidating)) {
|
|
18291
18430
|
read("TASKS" /* TASKS */, queryKey);
|
|
@@ -18298,22 +18437,23 @@ var useTasks = () => {
|
|
|
18298
18437
|
}, [syncTimestamps]);
|
|
18299
18438
|
return {
|
|
18300
18439
|
data: DEBUG_MODE ? mockData : data == null ? void 0 : data.data,
|
|
18440
|
+
monthlyData,
|
|
18301
18441
|
isLoading,
|
|
18302
18442
|
loadedStatus,
|
|
18303
18443
|
isValidating,
|
|
18304
18444
|
error,
|
|
18445
|
+
currentDate,
|
|
18446
|
+
setCurrentDate,
|
|
18447
|
+
dateRange,
|
|
18448
|
+
setDateRange,
|
|
18305
18449
|
refetch,
|
|
18306
18450
|
submitResponseToTask: submitResponseToTask2,
|
|
18307
|
-
|
|
18451
|
+
uploadDocumentsForTask,
|
|
18452
|
+
deleteUploadsForTask,
|
|
18453
|
+
updateDocUploadTaskDescription
|
|
18308
18454
|
};
|
|
18309
18455
|
};
|
|
18310
18456
|
|
|
18311
|
-
// src/types/tasks.ts
|
|
18312
|
-
var COMPLETED_TASK_TYPES = ["COMPLETED", "USER_MARKED_COMPLETED"];
|
|
18313
|
-
function isComplete(taskType) {
|
|
18314
|
-
return COMPLETED_TASK_TYPES.includes(taskType);
|
|
18315
|
-
}
|
|
18316
|
-
|
|
18317
18457
|
// src/components/TasksHeader/TasksHeader.tsx
|
|
18318
18458
|
var import_react212 = __toESM(require("react"));
|
|
18319
18459
|
|
|
@@ -18408,6 +18548,8 @@ var ProgressIcon = (_a) => {
|
|
|
18408
18548
|
var ProgressIcon_default = ProgressIcon;
|
|
18409
18549
|
|
|
18410
18550
|
// src/components/TasksHeader/TasksHeader.tsx
|
|
18551
|
+
var import_date_fns38 = require("date-fns");
|
|
18552
|
+
var import_classnames67 = __toESM(require("classnames"));
|
|
18411
18553
|
var ICONS = {
|
|
18412
18554
|
loading: {
|
|
18413
18555
|
icon: /* @__PURE__ */ import_react212.default.createElement(ProgressIcon_default, { size: 12, className: "Layer__anim--rotating" }),
|
|
@@ -18436,10 +18578,19 @@ var TasksHeader = ({
|
|
|
18436
18578
|
open,
|
|
18437
18579
|
toggleContent
|
|
18438
18580
|
}) => {
|
|
18439
|
-
const {
|
|
18581
|
+
const {
|
|
18582
|
+
data: tasks,
|
|
18583
|
+
loadedStatus,
|
|
18584
|
+
refetch,
|
|
18585
|
+
error,
|
|
18586
|
+
dateRange,
|
|
18587
|
+
setDateRange
|
|
18588
|
+
} = (0, import_react212.useContext)(TasksContext);
|
|
18589
|
+
const { business } = useLayerContext();
|
|
18440
18590
|
const completedTasks = tasks == null ? void 0 : tasks.filter((task) => isComplete(task.status)).length;
|
|
18441
18591
|
const badgeVariant = completedTasks === (tasks == null ? void 0 : tasks.length) ? ICONS.done : ICONS.pending;
|
|
18442
|
-
|
|
18592
|
+
const minDate = getEarliestDateToBrowse(business);
|
|
18593
|
+
return /* @__PURE__ */ import_react212.default.createElement("div", { className: (0, import_classnames67.default)("Layer__tasks-header", collapsable && "Layer__tasks-header--collapsable") }, /* @__PURE__ */ import_react212.default.createElement("div", { className: "Layer__tasks-header__left-col" }, /* @__PURE__ */ import_react212.default.createElement("div", { className: "Layer__tasks-header__left-col__title" }, /* @__PURE__ */ import_react212.default.createElement(Text, { size: "lg" /* lg */ }, tasksHeader), loadedStatus !== "complete" && !open ? /* @__PURE__ */ import_react212.default.createElement(Badge, { variant: ICONS.loading.badge, icon: ICONS.loading.icon }, ICONS.loading.text) : loadedStatus === "complete" && !open && (!tasks || error) ? /* @__PURE__ */ import_react212.default.createElement(
|
|
18443
18594
|
Badge,
|
|
18444
18595
|
{
|
|
18445
18596
|
onClick: () => refetch(),
|
|
@@ -18447,7 +18598,27 @@ var TasksHeader = ({
|
|
|
18447
18598
|
icon: ICONS.refresh.icon
|
|
18448
18599
|
},
|
|
18449
18600
|
ICONS.refresh.text
|
|
18450
|
-
) : loadedStatus === "complete" ? /* @__PURE__ */ import_react212.default.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text) : open ? null : /* @__PURE__ */ import_react212.default.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text)),
|
|
18601
|
+
) : loadedStatus === "complete" && !open ? /* @__PURE__ */ import_react212.default.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text) : open ? null : /* @__PURE__ */ import_react212.default.createElement(Badge, { variant: badgeVariant.badge, icon: badgeVariant.icon }, badgeVariant.text)), /* @__PURE__ */ import_react212.default.createElement("div", { className: "Layer__tasks-header__left-col__controls" }, /* @__PURE__ */ import_react212.default.createElement(
|
|
18602
|
+
DatePicker,
|
|
18603
|
+
{
|
|
18604
|
+
selected: dateRange.startDate,
|
|
18605
|
+
onChange: (dates) => {
|
|
18606
|
+
if (!Array.isArray(dates)) {
|
|
18607
|
+
setDateRange({
|
|
18608
|
+
startDate: (0, import_date_fns38.startOfYear)(dates),
|
|
18609
|
+
endDate: (0, import_date_fns38.endOfYear)(dates)
|
|
18610
|
+
});
|
|
18611
|
+
}
|
|
18612
|
+
},
|
|
18613
|
+
dateFormat: "YYYY",
|
|
18614
|
+
mode: "yearPicker",
|
|
18615
|
+
minDate,
|
|
18616
|
+
maxDate: (0, import_date_fns38.endOfYear)(/* @__PURE__ */ new Date()),
|
|
18617
|
+
currentDateOption: false,
|
|
18618
|
+
navigateArrows: ["mobile", "desktop"],
|
|
18619
|
+
disabled: minDate && (0, import_date_fns38.getYear)(minDate) === (0, import_date_fns38.getYear)(/* @__PURE__ */ new Date())
|
|
18620
|
+
}
|
|
18621
|
+
), collapsable && /* @__PURE__ */ import_react212.default.createElement("div", { className: "Layer__tasks-header__left-col__expand" }, /* @__PURE__ */ import_react212.default.createElement(ExpandButton, { onClick: toggleContent, collapsed: !open })))));
|
|
18451
18622
|
};
|
|
18452
18623
|
|
|
18453
18624
|
// src/components/TasksList/TasksList.tsx
|
|
@@ -18509,31 +18680,96 @@ var SmileIcon_default = SmileIcon;
|
|
|
18509
18680
|
|
|
18510
18681
|
// src/components/TasksListItem/TasksListItem.tsx
|
|
18511
18682
|
var import_react213 = __toESM(require("react"));
|
|
18512
|
-
var
|
|
18683
|
+
var import_classnames68 = __toESM(require("classnames"));
|
|
18513
18684
|
var TasksListItem = ({
|
|
18514
18685
|
task,
|
|
18515
18686
|
goToNextPageIfAllComplete,
|
|
18516
18687
|
defaultOpen
|
|
18517
18688
|
}) => {
|
|
18689
|
+
var _a;
|
|
18518
18690
|
const [isOpen, setIsOpen] = (0, import_react213.useState)(defaultOpen);
|
|
18519
18691
|
const [userResponse, setUserResponse] = (0, import_react213.useState)(task.user_response || "");
|
|
18520
|
-
const
|
|
18521
|
-
const
|
|
18692
|
+
const [selectedFiles, setSelectedFiles] = (0, import_react213.useState)();
|
|
18693
|
+
const {
|
|
18694
|
+
submitResponseToTask: submitResponseToTask2,
|
|
18695
|
+
uploadDocumentsForTask,
|
|
18696
|
+
deleteUploadsForTask,
|
|
18697
|
+
updateDocUploadTaskDescription
|
|
18698
|
+
} = (0, import_react213.useContext)(TasksContext);
|
|
18699
|
+
const taskBodyClassName = (0, import_classnames68.default)(
|
|
18522
18700
|
"Layer__tasks-list-item__body",
|
|
18523
18701
|
isOpen && "Layer__tasks-list-item__body--expanded",
|
|
18524
18702
|
isComplete(task.status) && "Layer__tasks-list-item--completed"
|
|
18525
18703
|
);
|
|
18526
|
-
const taskHeadClassName = (0,
|
|
18704
|
+
const taskHeadClassName = (0, import_classnames68.default)(
|
|
18527
18705
|
"Layer__tasks-list-item__head-info",
|
|
18528
18706
|
isComplete(task.status) ? "Layer__tasks-list-item--completed" : "Layer__tasks-list-item--pending"
|
|
18529
18707
|
);
|
|
18530
|
-
const taskItemClassName = (0,
|
|
18708
|
+
const taskItemClassName = (0, import_classnames68.default)(
|
|
18531
18709
|
"Layer__tasks-list-item",
|
|
18532
18710
|
isOpen && "Layer__tasks-list-item__expanded"
|
|
18533
18711
|
);
|
|
18534
18712
|
(0, import_react213.useEffect)(() => {
|
|
18535
18713
|
setIsOpen(defaultOpen);
|
|
18536
18714
|
}, [defaultOpen]);
|
|
18715
|
+
const uploadDocumentAction = (0, import_react213.useMemo)(() => {
|
|
18716
|
+
if (task.user_response_type === "UPLOAD_DOCUMENT") {
|
|
18717
|
+
if (task.status === "TODO") {
|
|
18718
|
+
if (!selectedFiles) {
|
|
18719
|
+
return /* @__PURE__ */ import_react213.default.createElement(
|
|
18720
|
+
FileInput,
|
|
18721
|
+
{
|
|
18722
|
+
onUpload: (files) => {
|
|
18723
|
+
setSelectedFiles(files);
|
|
18724
|
+
},
|
|
18725
|
+
text: "Select file(s)",
|
|
18726
|
+
allowMultipleUploads: true
|
|
18727
|
+
}
|
|
18728
|
+
);
|
|
18729
|
+
} else {
|
|
18730
|
+
return /* @__PURE__ */ import_react213.default.createElement(
|
|
18731
|
+
Button,
|
|
18732
|
+
{
|
|
18733
|
+
variant: "secondary" /* secondary */,
|
|
18734
|
+
onClick: () => __async(void 0, null, function* () {
|
|
18735
|
+
yield uploadDocumentsForTask(task.id, selectedFiles, userResponse);
|
|
18736
|
+
setIsOpen(false);
|
|
18737
|
+
goToNextPageIfAllComplete(task);
|
|
18738
|
+
setSelectedFiles(void 0);
|
|
18739
|
+
})
|
|
18740
|
+
},
|
|
18741
|
+
"Submit"
|
|
18742
|
+
);
|
|
18743
|
+
}
|
|
18744
|
+
} else if (task.status === "USER_MARKED_COMPLETED") {
|
|
18745
|
+
if (task.user_response && task.user_response != userResponse) {
|
|
18746
|
+
return /* @__PURE__ */ import_react213.default.createElement(
|
|
18747
|
+
Button,
|
|
18748
|
+
{
|
|
18749
|
+
variant: "secondary" /* secondary */,
|
|
18750
|
+
onClick: () => {
|
|
18751
|
+
updateDocUploadTaskDescription(task.id, userResponse);
|
|
18752
|
+
}
|
|
18753
|
+
},
|
|
18754
|
+
"Update"
|
|
18755
|
+
);
|
|
18756
|
+
} else {
|
|
18757
|
+
return /* @__PURE__ */ import_react213.default.createElement(
|
|
18758
|
+
Button,
|
|
18759
|
+
{
|
|
18760
|
+
variant: "secondary" /* secondary */,
|
|
18761
|
+
onClick: () => {
|
|
18762
|
+
deleteUploadsForTask(task.id);
|
|
18763
|
+
}
|
|
18764
|
+
},
|
|
18765
|
+
"Delete Uploads"
|
|
18766
|
+
);
|
|
18767
|
+
}
|
|
18768
|
+
} else {
|
|
18769
|
+
return null;
|
|
18770
|
+
}
|
|
18771
|
+
}
|
|
18772
|
+
}, [task, selectedFiles, userResponse]);
|
|
18537
18773
|
return /* @__PURE__ */ import_react213.default.createElement("div", { className: "Layer__tasks-list-item-wrapper" }, /* @__PURE__ */ import_react213.default.createElement("div", { className: taskItemClassName }, /* @__PURE__ */ import_react213.default.createElement(
|
|
18538
18774
|
"div",
|
|
18539
18775
|
{
|
|
@@ -18551,24 +18787,14 @@ var TasksListItem = ({
|
|
|
18551
18787
|
}
|
|
18552
18788
|
}
|
|
18553
18789
|
)
|
|
18554
|
-
), /* @__PURE__ */ import_react213.default.createElement("div", { className: taskBodyClassName }, /* @__PURE__ */ import_react213.default.createElement("div", { className: "Layer__tasks-list-item__body-info" }, /* @__PURE__ */ import_react213.default.createElement(Text, { size: "sm" /* sm */ }, task.question),
|
|
18790
|
+
), /* @__PURE__ */ import_react213.default.createElement("div", { className: taskBodyClassName }, /* @__PURE__ */ import_react213.default.createElement("div", { className: "Layer__tasks-list-item__body-info" }, /* @__PURE__ */ import_react213.default.createElement(Text, { size: "sm" /* sm */ }, task.question), /* @__PURE__ */ import_react213.default.createElement(
|
|
18555
18791
|
Textarea,
|
|
18556
18792
|
{
|
|
18557
18793
|
value: userResponse,
|
|
18794
|
+
placeholder: task.user_response_type === "UPLOAD_DOCUMENT" ? "Optional description" : "",
|
|
18558
18795
|
onChange: (e) => setUserResponse(e.target.value)
|
|
18559
18796
|
}
|
|
18560
|
-
) : null, /* @__PURE__ */ import_react213.default.createElement("div", { className: "Layer__tasks-list-item__actions" }, task.user_response_type === "UPLOAD_DOCUMENT" ? /* @__PURE__ */ import_react213.default.createElement(
|
|
18561
|
-
FileInput,
|
|
18562
|
-
{
|
|
18563
|
-
onUpload: (file) => {
|
|
18564
|
-
uploadDocumentForTask(task.id, file);
|
|
18565
|
-
setIsOpen(false);
|
|
18566
|
-
goToNextPageIfAllComplete(task);
|
|
18567
|
-
},
|
|
18568
|
-
text: "Upload file",
|
|
18569
|
-
disabled: task.completed_at != null || task.user_marked_completed_at != null || task.archived_at != null
|
|
18570
|
-
}
|
|
18571
|
-
) : /* @__PURE__ */ import_react213.default.createElement(
|
|
18797
|
+
), task.user_response_type === "UPLOAD_DOCUMENT" ? /* @__PURE__ */ import_react213.default.createElement("div", { className: "Layer__tasks-list__link-list" }, selectedFiles ? /* @__PURE__ */ import_react213.default.createElement("div", { className: "Layer__tasks-list__link-list-header" }, "Selected Files:") : task.documents ? /* @__PURE__ */ import_react213.default.createElement("div", { className: "Layer__tasks-list__link-list-header" }, "Uploaded Files:") : null, /* @__PURE__ */ import_react213.default.createElement("ul", { className: "Layer__tasks-list__links-list" }, (_a = task.documents) == null ? void 0 : _a.map((document2, idx) => /* @__PURE__ */ import_react213.default.createElement("li", { key: `uploaded-doc-name-${idx}` }, /* @__PURE__ */ import_react213.default.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__ */ import_react213.default.createElement("li", { key: `selected-file-name-${idx}` }, /* @__PURE__ */ import_react213.default.createElement("a", { className: "Layer__tasks-list-item__link" }, file.name))))) : null, /* @__PURE__ */ import_react213.default.createElement("div", { className: "Layer__tasks-list-item__actions" }, task.user_response_type === "UPLOAD_DOCUMENT" ? uploadDocumentAction : /* @__PURE__ */ import_react213.default.createElement(
|
|
18572
18798
|
Button,
|
|
18573
18799
|
{
|
|
18574
18800
|
disabled: userResponse.length === 0 || userResponse === task.user_response,
|
|
@@ -18579,11 +18805,12 @@ var TasksListItem = ({
|
|
|
18579
18805
|
goToNextPageIfAllComplete(task);
|
|
18580
18806
|
}
|
|
18581
18807
|
},
|
|
18582
|
-
|
|
18808
|
+
task.user_response && task.user_response !== userResponse ? "Update" : "Save"
|
|
18583
18809
|
))))));
|
|
18584
18810
|
};
|
|
18585
18811
|
|
|
18586
18812
|
// src/components/TasksList/TasksList.tsx
|
|
18813
|
+
var import_date_fns39 = require("date-fns");
|
|
18587
18814
|
function paginateArray(array, chunkSize = 10) {
|
|
18588
18815
|
const result = [];
|
|
18589
18816
|
for (let i = 0; i < array.length; i += chunkSize) {
|
|
@@ -18594,7 +18821,13 @@ function paginateArray(array, chunkSize = 10) {
|
|
|
18594
18821
|
}
|
|
18595
18822
|
var TasksEmptyState = () => /* @__PURE__ */ import_react214.default.createElement("div", { className: "Layer__tasks-empty-state" }, /* @__PURE__ */ import_react214.default.createElement("div", { className: "Layer__tasks-icon" }, /* @__PURE__ */ import_react214.default.createElement(SmileIcon_default, null)), /* @__PURE__ */ import_react214.default.createElement(Text, { size: "sm" /* sm */ }, "There are no pending tasks!", /* @__PURE__ */ import_react214.default.createElement("br", null), " Great job!"));
|
|
18596
18823
|
var TasksList = ({ pageSize = 10 }) => {
|
|
18597
|
-
const { data:
|
|
18824
|
+
const { data: rawData, error, currentDate } = (0, import_react214.useContext)(TasksContext);
|
|
18825
|
+
const tasks = (0, import_react214.useMemo)(() => {
|
|
18826
|
+
return rawData == null ? void 0 : rawData.filter((x) => {
|
|
18827
|
+
const d = x.effective_date ? (0, import_date_fns39.parseISO)(x.effective_date) : (0, import_date_fns39.parseISO)(x.created_at);
|
|
18828
|
+
return !(0, import_date_fns39.isBefore)(d, (0, import_date_fns39.startOfMonth)(currentDate)) && !(0, import_date_fns39.isAfter)(d, (0, import_date_fns39.endOfMonth)(currentDate));
|
|
18829
|
+
});
|
|
18830
|
+
}, [rawData, currentDate]);
|
|
18598
18831
|
const firstPageWithIincompleteTasks = paginateArray(
|
|
18599
18832
|
tasks || [],
|
|
18600
18833
|
pageSize
|
|
@@ -18605,7 +18838,7 @@ var TasksList = ({ pageSize = 10 }) => {
|
|
|
18605
18838
|
const sortedTasks = (0, import_react214.useMemo)(() => {
|
|
18606
18839
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
18607
18840
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
18608
|
-
return tasks == null ? void 0 : tasks.slice(firstPageIndex, lastPageIndex);
|
|
18841
|
+
return tasks == null ? void 0 : tasks.sort((x) => isComplete(x.status) ? 1 : -1).slice(firstPageIndex, lastPageIndex);
|
|
18609
18842
|
}, [tasks, currentPage]);
|
|
18610
18843
|
const indexFirstIncomplete = sortedTasks == null ? void 0 : sortedTasks.findIndex(
|
|
18611
18844
|
(task) => !isComplete(task.status)
|
|
@@ -18637,11 +18870,17 @@ var TasksList = ({ pageSize = 10 }) => {
|
|
|
18637
18870
|
|
|
18638
18871
|
// src/components/TasksPending/TasksPending.tsx
|
|
18639
18872
|
var import_react215 = __toESM(require("react"));
|
|
18640
|
-
var
|
|
18641
|
-
var
|
|
18873
|
+
var import_classnames69 = __toESM(require("classnames"));
|
|
18874
|
+
var import_date_fns40 = require("date-fns");
|
|
18642
18875
|
var import_recharts4 = require("recharts");
|
|
18643
18876
|
var TasksPending = () => {
|
|
18644
|
-
const { data } = (0, import_react215.useContext)(TasksContext);
|
|
18877
|
+
const { data: rawData, currentDate } = (0, import_react215.useContext)(TasksContext);
|
|
18878
|
+
const data = (0, import_react215.useMemo)(() => {
|
|
18879
|
+
return rawData == null ? void 0 : rawData.filter((x) => {
|
|
18880
|
+
const d = x.effective_date ? (0, import_date_fns40.parseISO)(x.effective_date) : (0, import_date_fns40.parseISO)(x.created_at);
|
|
18881
|
+
return !(0, import_date_fns40.isBefore)(d, (0, import_date_fns40.startOfMonth)(currentDate)) && !(0, import_date_fns40.isAfter)(d, (0, import_date_fns40.endOfMonth)(currentDate));
|
|
18882
|
+
});
|
|
18883
|
+
}, [rawData, currentDate]);
|
|
18645
18884
|
const completedTasks = data == null ? void 0 : data.filter((task) => isComplete(task.status)).length;
|
|
18646
18885
|
const chartData = [
|
|
18647
18886
|
{
|
|
@@ -18653,10 +18892,10 @@ var TasksPending = () => {
|
|
|
18653
18892
|
value: data == null ? void 0 : data.filter((task) => !isComplete(task.status)).length
|
|
18654
18893
|
}
|
|
18655
18894
|
];
|
|
18656
|
-
const taskStatusClassName = (0,
|
|
18895
|
+
const taskStatusClassName = (0, import_classnames69.default)(
|
|
18657
18896
|
completedTasks && completedTasks > 0 ? "Layer__tasks-pending-bar__status--done" : "Layer__tasks-pending-bar__status--pending"
|
|
18658
18897
|
);
|
|
18659
|
-
return /* @__PURE__ */ import_react215.default.createElement("div", { className: "Layer__tasks-pending" }, /* @__PURE__ */ import_react215.default.createElement(Text, { size: "lg" /* lg */ }, (0,
|
|
18898
|
+
return /* @__PURE__ */ import_react215.default.createElement("div", { className: "Layer__tasks-pending" }, /* @__PURE__ */ import_react215.default.createElement(Text, { size: "lg" /* lg */ }, (0, import_date_fns40.format)(currentDate, "MMMM")), data && (data == null ? void 0 : data.length) > 0 ? /* @__PURE__ */ import_react215.default.createElement("div", { className: "Layer__tasks-pending-bar" }, /* @__PURE__ */ import_react215.default.createElement(Text, { size: "sm" /* sm */ }, /* @__PURE__ */ import_react215.default.createElement("span", { className: taskStatusClassName }, completedTasks), "/", data == null ? void 0 : data.length, " done"), /* @__PURE__ */ import_react215.default.createElement(import_recharts4.PieChart, { width: 24, height: 24, className: "mini-chart" }, /* @__PURE__ */ import_react215.default.createElement(
|
|
18660
18899
|
import_recharts4.Pie,
|
|
18661
18900
|
{
|
|
18662
18901
|
data: chartData,
|
|
@@ -18683,12 +18922,87 @@ var TasksPending = () => {
|
|
|
18683
18922
|
}
|
|
18684
18923
|
);
|
|
18685
18924
|
})
|
|
18686
|
-
))));
|
|
18925
|
+
))) : null);
|
|
18926
|
+
};
|
|
18927
|
+
|
|
18928
|
+
// src/components/TasksMonthSelector/TasksMonthSelector.tsx
|
|
18929
|
+
var import_react217 = __toESM(require("react"));
|
|
18930
|
+
var import_date_fns41 = require("date-fns");
|
|
18931
|
+
|
|
18932
|
+
// src/components/TasksMonthSelector/TaskMonthTile.tsx
|
|
18933
|
+
var import_react216 = __toESM(require("react"));
|
|
18934
|
+
var import_classnames70 = __toESM(require("classnames"));
|
|
18935
|
+
var TaskMonthTile = ({ monthData, onClick, active, disabled }) => {
|
|
18936
|
+
const isCompleted = monthData.total === monthData.completed;
|
|
18937
|
+
const baseClass = (0, import_classnames70.default)(
|
|
18938
|
+
"Layer__tasks-month-selector__month",
|
|
18939
|
+
isCompleted && "Layer__tasks-month-selector__month--completed",
|
|
18940
|
+
active && "Layer__tasks-month-selector__month--active",
|
|
18941
|
+
disabled && "Layer__tasks-month-selector__month--disabled"
|
|
18942
|
+
);
|
|
18943
|
+
return /* @__PURE__ */ import_react216.default.createElement("div", { className: baseClass, onClick: () => !disabled && onClick(monthData.startDate) }, /* @__PURE__ */ import_react216.default.createElement(Text, { size: "sm" /* sm */, className: "Layer__tasks-month-selector__month__str" }, monthData.monthStr), /* @__PURE__ */ import_react216.default.createElement(Text, { size: "sm" /* sm */, className: "Layer__tasks-month-selector__month__total" }, monthData.total > 0 && isCompleted ? monthData.total : ""), isCompleted && monthData.total > 0 && /* @__PURE__ */ import_react216.default.createElement("span", { className: "Layer__tasks-month-selector__month__completed" }, /* @__PURE__ */ import_react216.default.createElement(Check_default, { size: 12 })), !isCompleted && monthData.total > 0 && /* @__PURE__ */ import_react216.default.createElement("span", { className: "Layer__tasks-month-selector__month__incompleted" }, /* @__PURE__ */ import_react216.default.createElement(Text, { size: "sm" /* sm */ }, monthData.total), /* @__PURE__ */ import_react216.default.createElement(AlertCircle_default, { size: 12 })));
|
|
18944
|
+
};
|
|
18945
|
+
|
|
18946
|
+
// src/components/TasksMonthSelector/TasksMonthSelector.tsx
|
|
18947
|
+
var DEFAULT_TASK_DATA = {
|
|
18948
|
+
total: 0,
|
|
18949
|
+
completed: 0,
|
|
18950
|
+
tasks: []
|
|
18951
|
+
};
|
|
18952
|
+
var isCurrentMonth = (monthDate, currentDate) => (0, import_date_fns41.getMonth)(currentDate) === (0, import_date_fns41.getMonth)(monthDate) && (0, import_date_fns41.getYear)(currentDate) === (0, import_date_fns41.getYear)(monthDate);
|
|
18953
|
+
var TasksMonthSelector = ({ tasks, year, currentDate, onClick }) => {
|
|
18954
|
+
const { business } = useLayerContext();
|
|
18955
|
+
const minDate = (0, import_react217.useMemo)(() => {
|
|
18956
|
+
if (business) {
|
|
18957
|
+
const date = getEarliestDateToBrowse(business);
|
|
18958
|
+
if (date) {
|
|
18959
|
+
return (0, import_date_fns41.startOfMonth)(date);
|
|
18960
|
+
}
|
|
18961
|
+
}
|
|
18962
|
+
return;
|
|
18963
|
+
}, [business]);
|
|
18964
|
+
const months = (0, import_react217.useMemo)(() => {
|
|
18965
|
+
return Array.from({ length: 12 }, (_, i) => {
|
|
18966
|
+
var _a;
|
|
18967
|
+
const startDate = (0, import_date_fns41.set)(
|
|
18968
|
+
/* @__PURE__ */ new Date(),
|
|
18969
|
+
{ year, month: i, date: 1, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }
|
|
18970
|
+
);
|
|
18971
|
+
const endDate = (0, import_date_fns41.endOfMonth)(startDate);
|
|
18972
|
+
const disabled = minDate && (0, import_date_fns41.isBefore)(startDate, minDate) || (0, import_date_fns41.isAfter)(startDate, (0, import_date_fns41.startOfMonth)(/* @__PURE__ */ new Date()));
|
|
18973
|
+
const taskData = (_a = tasks == null ? void 0 : tasks.find((x) => x.month === i && x.year === year)) != null ? _a : __spreadValues({
|
|
18974
|
+
monthStr: (0, import_date_fns41.format)(startDate, "MMM"),
|
|
18975
|
+
year,
|
|
18976
|
+
month: i,
|
|
18977
|
+
startDate,
|
|
18978
|
+
endDate
|
|
18979
|
+
}, DEFAULT_TASK_DATA);
|
|
18980
|
+
return __spreadValues({
|
|
18981
|
+
monthStr: (0, import_date_fns41.format)(startDate, "MMM"),
|
|
18982
|
+
startDate,
|
|
18983
|
+
endDate,
|
|
18984
|
+
disabled
|
|
18985
|
+
}, taskData);
|
|
18986
|
+
});
|
|
18987
|
+
}, [tasks, year, minDate]);
|
|
18988
|
+
return /* @__PURE__ */ import_react217.default.createElement("div", { className: "Layer__tasks-month-selector" }, months.map((month, idx) => {
|
|
18989
|
+
return /* @__PURE__ */ import_react217.default.createElement(
|
|
18990
|
+
TaskMonthTile,
|
|
18991
|
+
{
|
|
18992
|
+
key: idx,
|
|
18993
|
+
onClick,
|
|
18994
|
+
monthData: month,
|
|
18995
|
+
active: isCurrentMonth(month.startDate, currentDate),
|
|
18996
|
+
disabled: month.disabled
|
|
18997
|
+
}
|
|
18998
|
+
);
|
|
18999
|
+
}));
|
|
18687
19000
|
};
|
|
18688
19001
|
|
|
18689
19002
|
// src/components/Tasks/Tasks.tsx
|
|
18690
|
-
var
|
|
18691
|
-
var
|
|
19003
|
+
var import_classnames71 = __toESM(require("classnames"));
|
|
19004
|
+
var import_date_fns42 = require("date-fns");
|
|
19005
|
+
var UseTasksContext = (0, import_react218.createContext)({
|
|
18692
19006
|
data: void 0,
|
|
18693
19007
|
isLoading: void 0,
|
|
18694
19008
|
loadedStatus: "initial",
|
|
@@ -18698,7 +19012,16 @@ var UseTasksContext = (0, import_react216.createContext)({
|
|
|
18698
19012
|
},
|
|
18699
19013
|
submitResponseToTask: () => {
|
|
18700
19014
|
},
|
|
18701
|
-
|
|
19015
|
+
uploadDocumentsForTask: () => Promise.resolve(),
|
|
19016
|
+
deleteUploadsForTask: () => {
|
|
19017
|
+
},
|
|
19018
|
+
updateDocUploadTaskDescription: () => {
|
|
19019
|
+
},
|
|
19020
|
+
currentDate: /* @__PURE__ */ new Date(),
|
|
19021
|
+
setCurrentDate: () => {
|
|
19022
|
+
},
|
|
19023
|
+
dateRange: { startDate: (0, import_date_fns42.startOfYear)(/* @__PURE__ */ new Date()), endDate: (0, import_date_fns42.endOfYear)(/* @__PURE__ */ new Date()) },
|
|
19024
|
+
setDateRange: () => {
|
|
18702
19025
|
}
|
|
18703
19026
|
});
|
|
18704
19027
|
var Tasks = ({
|
|
@@ -18709,7 +19032,7 @@ var Tasks = ({
|
|
|
18709
19032
|
// deprecated
|
|
18710
19033
|
stringOverrides
|
|
18711
19034
|
}) => {
|
|
18712
|
-
return /* @__PURE__ */
|
|
19035
|
+
return /* @__PURE__ */ import_react218.default.createElement(TasksProvider, null, /* @__PURE__ */ import_react218.default.createElement(
|
|
18713
19036
|
TasksComponent,
|
|
18714
19037
|
{
|
|
18715
19038
|
collapsable,
|
|
@@ -18722,7 +19045,7 @@ var Tasks = ({
|
|
|
18722
19045
|
};
|
|
18723
19046
|
var TasksProvider = ({ children }) => {
|
|
18724
19047
|
const contextData = useTasks();
|
|
18725
|
-
return /* @__PURE__ */
|
|
19048
|
+
return /* @__PURE__ */ import_react218.default.createElement(TasksContext.Provider, { value: contextData }, children);
|
|
18726
19049
|
};
|
|
18727
19050
|
var TasksComponent = ({
|
|
18728
19051
|
collapsable = false,
|
|
@@ -18732,8 +19055,16 @@ var TasksComponent = ({
|
|
|
18732
19055
|
// deprecated
|
|
18733
19056
|
stringOverrides
|
|
18734
19057
|
}) => {
|
|
18735
|
-
const {
|
|
18736
|
-
|
|
19058
|
+
const {
|
|
19059
|
+
isLoading,
|
|
19060
|
+
loadedStatus,
|
|
19061
|
+
data,
|
|
19062
|
+
monthlyData,
|
|
19063
|
+
currentDate,
|
|
19064
|
+
setCurrentDate,
|
|
19065
|
+
dateRange
|
|
19066
|
+
} = (0, import_react218.useContext)(TasksContext);
|
|
19067
|
+
const allComplete = (0, import_react218.useMemo)(() => {
|
|
18737
19068
|
if (!data) {
|
|
18738
19069
|
return void 0;
|
|
18739
19070
|
}
|
|
@@ -18742,15 +19073,15 @@ var TasksComponent = ({
|
|
|
18742
19073
|
}
|
|
18743
19074
|
return false;
|
|
18744
19075
|
}, [data, isLoading]);
|
|
18745
|
-
const [open, setOpen] = (0,
|
|
19076
|
+
const [open, setOpen] = (0, import_react218.useState)(
|
|
18746
19077
|
defaultCollapsed || collapsedWhenComplete ? false : true
|
|
18747
19078
|
);
|
|
18748
|
-
(0,
|
|
19079
|
+
(0, import_react218.useEffect)(() => {
|
|
18749
19080
|
if (allComplete && open && collapsedWhenComplete && loadedStatus === "complete") {
|
|
18750
19081
|
setOpen(false);
|
|
18751
19082
|
}
|
|
18752
19083
|
}, [allComplete]);
|
|
18753
|
-
return /* @__PURE__ */
|
|
19084
|
+
return /* @__PURE__ */ import_react218.default.createElement("div", { className: "Layer__tasks-component" }, /* @__PURE__ */ import_react218.default.createElement(
|
|
18754
19085
|
TasksHeader,
|
|
18755
19086
|
{
|
|
18756
19087
|
tasksHeader: (stringOverrides == null ? void 0 : stringOverrides.header) || tasksHeader,
|
|
@@ -18758,29 +19089,37 @@ var TasksComponent = ({
|
|
|
18758
19089
|
open,
|
|
18759
19090
|
toggleContent: () => setOpen(!open)
|
|
18760
19091
|
}
|
|
18761
|
-
), /* @__PURE__ */
|
|
19092
|
+
), /* @__PURE__ */ import_react218.default.createElement(
|
|
18762
19093
|
"div",
|
|
18763
19094
|
{
|
|
18764
|
-
className: (0,
|
|
19095
|
+
className: (0, import_classnames71.default)(
|
|
18765
19096
|
"Layer__tasks__content",
|
|
18766
19097
|
!open && "Layer__tasks__content--collapsed"
|
|
18767
19098
|
)
|
|
18768
19099
|
},
|
|
18769
|
-
isLoading || !data ? /* @__PURE__ */
|
|
19100
|
+
isLoading || !data ? /* @__PURE__ */ import_react218.default.createElement("div", { className: "Layer__tasks__loader-container" }, /* @__PURE__ */ import_react218.default.createElement(Loader2, null)) : /* @__PURE__ */ import_react218.default.createElement(import_react218.default.Fragment, null, /* @__PURE__ */ import_react218.default.createElement(
|
|
19101
|
+
TasksMonthSelector,
|
|
19102
|
+
{
|
|
19103
|
+
tasks: monthlyData,
|
|
19104
|
+
currentDate,
|
|
19105
|
+
onClick: setCurrentDate,
|
|
19106
|
+
year: (0, import_date_fns42.getYear)(dateRange.startDate)
|
|
19107
|
+
}
|
|
19108
|
+
), /* @__PURE__ */ import_react218.default.createElement(TasksPending, null), /* @__PURE__ */ import_react218.default.createElement(TasksList, null))
|
|
18770
19109
|
));
|
|
18771
19110
|
};
|
|
18772
19111
|
|
|
18773
19112
|
// src/components/PlatformOnboarding/LinkAccounts.tsx
|
|
18774
|
-
var
|
|
19113
|
+
var import_react219 = __toESM(require("react"));
|
|
18775
19114
|
var LinkAccounts = (_a) => {
|
|
18776
19115
|
var _b = _a, { inBox } = _b, props = __objRest(_b, ["inBox"]);
|
|
18777
|
-
const content = (0,
|
|
19116
|
+
const content = (0, import_react219.useMemo)(() => {
|
|
18778
19117
|
if (inBox) {
|
|
18779
|
-
return /* @__PURE__ */
|
|
19118
|
+
return /* @__PURE__ */ import_react219.default.createElement("div", { className: "Layer__link-accounts__box" }, /* @__PURE__ */ import_react219.default.createElement(LinkAccountsContent, __spreadValues({}, props)));
|
|
18780
19119
|
}
|
|
18781
|
-
return /* @__PURE__ */
|
|
19120
|
+
return /* @__PURE__ */ import_react219.default.createElement(LinkAccountsContent, __spreadValues({}, props));
|
|
18782
19121
|
}, [inBox, props]);
|
|
18783
|
-
return /* @__PURE__ */
|
|
19122
|
+
return /* @__PURE__ */ import_react219.default.createElement(LinkedAccountsProvider, null, content);
|
|
18784
19123
|
};
|
|
18785
19124
|
var LinkAccountsContent = ({
|
|
18786
19125
|
title,
|
|
@@ -18794,8 +19133,8 @@ var LinkAccountsContent = ({
|
|
|
18794
19133
|
onNext
|
|
18795
19134
|
}) => {
|
|
18796
19135
|
var _a;
|
|
18797
|
-
const { data, loadingStatus, error, refetchAccounts, addConnection } = (0,
|
|
18798
|
-
return /* @__PURE__ */
|
|
19136
|
+
const { data, loadingStatus, error, refetchAccounts, addConnection } = (0, import_react219.useContext)(LinkedAccountsContext);
|
|
19137
|
+
return /* @__PURE__ */ import_react219.default.createElement("div", { className: "Layer__link-accounts Layer__component" }, title && /* @__PURE__ */ import_react219.default.createElement(Heading, { size: "view" /* view */ }, title), data && data.length === 0 ? /* @__PURE__ */ import_react219.default.createElement("div", { className: "Layer__link-accounts__data-status-container" }, !hideLoading && loadingStatus !== "complete" ? /* @__PURE__ */ import_react219.default.createElement(Loader2, null) : null, Boolean(error) && /* @__PURE__ */ import_react219.default.createElement(
|
|
18799
19138
|
DataState,
|
|
18800
19139
|
{
|
|
18801
19140
|
status: "failed" /* failed */,
|
|
@@ -18803,7 +19142,7 @@ var LinkAccountsContent = ({
|
|
|
18803
19142
|
description: "Please try again later",
|
|
18804
19143
|
onRefresh: refetchAccounts
|
|
18805
19144
|
}
|
|
18806
|
-
)) : null, data && data.length > 0 ? /* @__PURE__ */
|
|
19145
|
+
)) : null, data && data.length > 0 ? /* @__PURE__ */ import_react219.default.createElement("div", { className: "Layer__link-accounts__list" }, data == null ? void 0 : data.map((account, index) => /* @__PURE__ */ import_react219.default.createElement(
|
|
18807
19146
|
LinkedAccountItemThumb,
|
|
18808
19147
|
{
|
|
18809
19148
|
key: index,
|
|
@@ -18813,33 +19152,33 @@ var LinkAccountsContent = ({
|
|
|
18813
19152
|
showBreakConnection,
|
|
18814
19153
|
asWidget
|
|
18815
19154
|
}
|
|
18816
|
-
))) : null, /* @__PURE__ */
|
|
19155
|
+
))) : null, /* @__PURE__ */ import_react219.default.createElement(
|
|
18817
19156
|
ActionableRow,
|
|
18818
19157
|
{
|
|
18819
|
-
iconBox: /* @__PURE__ */
|
|
19158
|
+
iconBox: /* @__PURE__ */ import_react219.default.createElement(PlaidIcon_default, null),
|
|
18820
19159
|
title: data && data.length > 0 ? "Connect my next business account" : "Connect accounts",
|
|
18821
19160
|
description: "Import data with one simple integration.",
|
|
18822
|
-
button: /* @__PURE__ */
|
|
19161
|
+
button: /* @__PURE__ */ import_react219.default.createElement(
|
|
18823
19162
|
Button,
|
|
18824
19163
|
{
|
|
18825
19164
|
onClick: () => addConnection("PLAID"),
|
|
18826
|
-
rightIcon: /* @__PURE__ */
|
|
19165
|
+
rightIcon: /* @__PURE__ */ import_react219.default.createElement(Link_default, { size: 12 }),
|
|
18827
19166
|
disabled: loadingStatus !== "complete"
|
|
18828
19167
|
},
|
|
18829
19168
|
data && data.length > 0 ? "Connect next" : "Connect"
|
|
18830
19169
|
)
|
|
18831
19170
|
}
|
|
18832
|
-
), /* @__PURE__ */
|
|
19171
|
+
), /* @__PURE__ */ import_react219.default.createElement(LinkedAccountsConfirmationModal, null), onBack || onNext ? /* @__PURE__ */ import_react219.default.createElement("div", { className: "Layer__link-accounts__footer" }, onBack && /* @__PURE__ */ import_react219.default.createElement(Button, { onClick: onBack, variant: "secondary" /* secondary */ }, (_a = stringOverrides == null ? void 0 : stringOverrides.backButtonText) != null ? _a : "Back"), onNext && /* @__PURE__ */ import_react219.default.createElement(Button, { onClick: onNext }, (stringOverrides == null ? void 0 : stringOverrides.nextButtonText) || "I\u2019m done connecting my business accounts")) : null);
|
|
18833
19172
|
};
|
|
18834
19173
|
|
|
18835
19174
|
// src/components/UpsellBanner/BookkeepingUpsellBar.tsx
|
|
18836
|
-
var
|
|
19175
|
+
var import_react220 = __toESM(require("react"));
|
|
18837
19176
|
|
|
18838
19177
|
// src/icons/Coffee.tsx
|
|
18839
|
-
var
|
|
19178
|
+
var React220 = __toESM(require("react"));
|
|
18840
19179
|
var CoffeeIcon = (_a) => {
|
|
18841
19180
|
var _b = _a, { size = 11 } = _b, props = __objRest(_b, ["size"]);
|
|
18842
|
-
return /* @__PURE__ */
|
|
19181
|
+
return /* @__PURE__ */ React220.createElement(
|
|
18843
19182
|
"svg",
|
|
18844
19183
|
__spreadProps(__spreadValues({
|
|
18845
19184
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -18849,7 +19188,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18849
19188
|
width: size,
|
|
18850
19189
|
height: size
|
|
18851
19190
|
}),
|
|
18852
|
-
/* @__PURE__ */
|
|
19191
|
+
/* @__PURE__ */ React220.createElement("g", { clipPath: "url(#clip0_5018_10141)" }, /* @__PURE__ */ React220.createElement(
|
|
18853
19192
|
"path",
|
|
18854
19193
|
{
|
|
18855
19194
|
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",
|
|
@@ -18857,7 +19196,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18857
19196
|
strokeLinecap: "round",
|
|
18858
19197
|
strokeLinejoin: "round"
|
|
18859
19198
|
}
|
|
18860
|
-
), /* @__PURE__ */
|
|
19199
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18861
19200
|
"path",
|
|
18862
19201
|
{
|
|
18863
19202
|
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",
|
|
@@ -18865,7 +19204,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18865
19204
|
strokeLinecap: "round",
|
|
18866
19205
|
strokeLinejoin: "round"
|
|
18867
19206
|
}
|
|
18868
|
-
), /* @__PURE__ */
|
|
19207
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18869
19208
|
"path",
|
|
18870
19209
|
{
|
|
18871
19210
|
d: "M8.75 0.958344V2.33334",
|
|
@@ -18873,7 +19212,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18873
19212
|
strokeLinecap: "round",
|
|
18874
19213
|
strokeLinejoin: "round"
|
|
18875
19214
|
}
|
|
18876
|
-
), /* @__PURE__ */
|
|
19215
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18877
19216
|
"path",
|
|
18878
19217
|
{
|
|
18879
19218
|
d: "M6.91663 0.958344V2.33334",
|
|
@@ -18881,7 +19220,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18881
19220
|
strokeLinecap: "round",
|
|
18882
19221
|
strokeLinejoin: "round"
|
|
18883
19222
|
}
|
|
18884
|
-
), /* @__PURE__ */
|
|
19223
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18885
19224
|
"path",
|
|
18886
19225
|
{
|
|
18887
19226
|
d: "M5.08337 0.958344V2.33334",
|
|
@@ -18890,7 +19229,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18890
19229
|
strokeLinejoin: "round"
|
|
18891
19230
|
}
|
|
18892
19231
|
)),
|
|
18893
|
-
/* @__PURE__ */
|
|
19232
|
+
/* @__PURE__ */ React220.createElement("defs", null, /* @__PURE__ */ React220.createElement("clipPath", { id: "clip0_5018_10141" }, /* @__PURE__ */ React220.createElement(
|
|
18894
19233
|
"rect",
|
|
18895
19234
|
{
|
|
18896
19235
|
width: "11",
|
|
@@ -18908,30 +19247,30 @@ var BookkeepingUpsellBar = ({
|
|
|
18908
19247
|
onClick,
|
|
18909
19248
|
href
|
|
18910
19249
|
}) => {
|
|
18911
|
-
return /* @__PURE__ */
|
|
19250
|
+
return /* @__PURE__ */ import_react220.default.createElement("div", { className: "Layer__bar-banner Layer__bar-banner--bookkeeping" }, /* @__PURE__ */ import_react220.default.createElement("div", { className: "Layer__bar-banner__left-col" }, /* @__PURE__ */ import_react220.default.createElement(IconBox, null, /* @__PURE__ */ import_react220.default.createElement(Coffee_default, null)), /* @__PURE__ */ import_react220.default.createElement("div", { className: "Layer__bar-banner__text-container" }, /* @__PURE__ */ import_react220.default.createElement(Text, { size: "md" /* md */, weight: "bold" /* bold */ }, "Need help with your books?"), /* @__PURE__ */ import_react220.default.createElement(
|
|
18912
19251
|
Text,
|
|
18913
19252
|
{
|
|
18914
19253
|
size: "sm" /* sm */,
|
|
18915
19254
|
className: "Layer__bar-banner__text-container__desc"
|
|
18916
19255
|
},
|
|
18917
19256
|
"Order bookkeeping service supported by real humans."
|
|
18918
|
-
))), onClick ? /* @__PURE__ */
|
|
19257
|
+
))), onClick ? /* @__PURE__ */ import_react220.default.createElement(Button, { variant: "secondary" /* secondary */, onClick }, "Schedule a demo") : href ? /* @__PURE__ */ import_react220.default.createElement(Link2, { href, target: "_blank", variant: "secondary" /* secondary */ }, "Schedule a demo") : null);
|
|
18919
19258
|
};
|
|
18920
19259
|
|
|
18921
19260
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
18922
|
-
var
|
|
19261
|
+
var import_react222 = __toESM(require("react"));
|
|
18923
19262
|
|
|
18924
19263
|
// src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
|
|
18925
|
-
var
|
|
19264
|
+
var import_react221 = __toESM(require("react"));
|
|
18926
19265
|
var CLASS_NAME7 = "Layer__BookkeepingProfitAndLossSummariesContainer";
|
|
18927
19266
|
function BookkeepingProfitAndLossSummariesContainer({
|
|
18928
19267
|
children
|
|
18929
19268
|
}) {
|
|
18930
|
-
return /* @__PURE__ */
|
|
19269
|
+
return /* @__PURE__ */ import_react221.default.createElement("div", { className: CLASS_NAME7 }, children);
|
|
18931
19270
|
}
|
|
18932
19271
|
|
|
18933
19272
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
18934
|
-
var
|
|
19273
|
+
var import_classnames72 = __toESM(require("classnames"));
|
|
18935
19274
|
var BookkeepingOverview = ({
|
|
18936
19275
|
title,
|
|
18937
19276
|
showTitle = true,
|
|
@@ -18939,19 +19278,19 @@ var BookkeepingOverview = ({
|
|
|
18939
19278
|
slotProps
|
|
18940
19279
|
}) => {
|
|
18941
19280
|
var _a, _b, _c, _d, _e, _f;
|
|
18942
|
-
const [pnlToggle, setPnlToggle] = (0,
|
|
19281
|
+
const [pnlToggle, setPnlToggle] = (0, import_react222.useState)("expenses");
|
|
18943
19282
|
const [width] = useWindowSize();
|
|
18944
19283
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
18945
|
-
return /* @__PURE__ */
|
|
19284
|
+
return /* @__PURE__ */ import_react222.default.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ import_react222.default.createElement(TasksProvider, null, /* @__PURE__ */ import_react222.default.createElement(
|
|
18946
19285
|
View,
|
|
18947
19286
|
{
|
|
18948
19287
|
viewClassName: "Layer__bookkeeping-overview--view",
|
|
18949
19288
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || "Bookkeeping overview",
|
|
18950
19289
|
withSidebar: width > 1100,
|
|
18951
|
-
sidebar: /* @__PURE__ */
|
|
19290
|
+
sidebar: /* @__PURE__ */ import_react222.default.createElement(TasksComponent, { stringOverrides: stringOverrides == null ? void 0 : stringOverrides.tasks }),
|
|
18952
19291
|
showHeader: showTitle
|
|
18953
19292
|
},
|
|
18954
|
-
width <= 1100 && /* @__PURE__ */
|
|
19293
|
+
width <= 1100 && /* @__PURE__ */ import_react222.default.createElement(
|
|
18955
19294
|
TasksComponent,
|
|
18956
19295
|
{
|
|
18957
19296
|
collapsable: true,
|
|
@@ -18959,30 +19298,30 @@ var BookkeepingOverview = ({
|
|
|
18959
19298
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.tasks
|
|
18960
19299
|
}
|
|
18961
19300
|
),
|
|
18962
|
-
/* @__PURE__ */
|
|
19301
|
+
/* @__PURE__ */ import_react222.default.createElement(
|
|
18963
19302
|
Container,
|
|
18964
19303
|
{
|
|
18965
19304
|
name: "bookkeeping-overview-profit-and-loss",
|
|
18966
19305
|
asWidget: true,
|
|
18967
19306
|
elevated: true
|
|
18968
19307
|
},
|
|
18969
|
-
/* @__PURE__ */
|
|
19308
|
+
/* @__PURE__ */ import_react222.default.createElement(
|
|
18970
19309
|
ProfitAndLoss.Header,
|
|
18971
19310
|
{
|
|
18972
19311
|
text: ((_c = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _c.header) || "Profit & Loss",
|
|
18973
19312
|
withDatePicker: true
|
|
18974
19313
|
}
|
|
18975
19314
|
),
|
|
18976
|
-
/* @__PURE__ */
|
|
19315
|
+
/* @__PURE__ */ import_react222.default.createElement(BookkeepingProfitAndLossSummariesContainer, null, /* @__PURE__ */ import_react222.default.createElement(
|
|
18977
19316
|
ProfitAndLoss.Summaries,
|
|
18978
19317
|
{
|
|
18979
19318
|
stringOverrides: (_d = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _d.summaries,
|
|
18980
19319
|
variants: profitAndLossSummariesVariants
|
|
18981
19320
|
}
|
|
18982
19321
|
)),
|
|
18983
|
-
/* @__PURE__ */
|
|
19322
|
+
/* @__PURE__ */ import_react222.default.createElement(ProfitAndLoss.Chart, null)
|
|
18984
19323
|
),
|
|
18985
|
-
/* @__PURE__ */
|
|
19324
|
+
/* @__PURE__ */ import_react222.default.createElement("div", { className: "Layer__bookkeeping-overview-profit-and-loss-charts" }, /* @__PURE__ */ import_react222.default.createElement(
|
|
18986
19325
|
Toggle,
|
|
18987
19326
|
{
|
|
18988
19327
|
name: "pnl-detailed-charts",
|
|
@@ -18999,15 +19338,15 @@ var BookkeepingOverview = ({
|
|
|
18999
19338
|
selected: pnlToggle,
|
|
19000
19339
|
onChange: (e) => setPnlToggle(e.target.value)
|
|
19001
19340
|
}
|
|
19002
|
-
), /* @__PURE__ */
|
|
19341
|
+
), /* @__PURE__ */ import_react222.default.createElement(
|
|
19003
19342
|
Container,
|
|
19004
19343
|
{
|
|
19005
|
-
name: (0,
|
|
19344
|
+
name: (0, import_classnames72.default)(
|
|
19006
19345
|
"bookkeeping-overview-profit-and-loss-chart",
|
|
19007
19346
|
pnlToggle !== "revenue" && "bookkeeping-overview-profit-and-loss-chart--hidden"
|
|
19008
19347
|
)
|
|
19009
19348
|
},
|
|
19010
|
-
/* @__PURE__ */
|
|
19349
|
+
/* @__PURE__ */ import_react222.default.createElement(
|
|
19011
19350
|
ProfitAndLoss.DetailedCharts,
|
|
19012
19351
|
{
|
|
19013
19352
|
scope: "revenue",
|
|
@@ -19015,15 +19354,15 @@ var BookkeepingOverview = ({
|
|
|
19015
19354
|
stringOverrides: (_e = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _e.detailedCharts
|
|
19016
19355
|
}
|
|
19017
19356
|
)
|
|
19018
|
-
), /* @__PURE__ */
|
|
19357
|
+
), /* @__PURE__ */ import_react222.default.createElement(
|
|
19019
19358
|
Container,
|
|
19020
19359
|
{
|
|
19021
|
-
name: (0,
|
|
19360
|
+
name: (0, import_classnames72.default)(
|
|
19022
19361
|
"bookkeeping-overview-profit-and-loss-chart",
|
|
19023
19362
|
pnlToggle !== "expenses" && "bookkeeping-overview-profit-and-loss-chart--hidden"
|
|
19024
19363
|
)
|
|
19025
19364
|
},
|
|
19026
|
-
/* @__PURE__ */
|
|
19365
|
+
/* @__PURE__ */ import_react222.default.createElement(
|
|
19027
19366
|
ProfitAndLoss.DetailedCharts,
|
|
19028
19367
|
{
|
|
19029
19368
|
scope: "expenses",
|
|
@@ -19036,19 +19375,19 @@ var BookkeepingOverview = ({
|
|
|
19036
19375
|
};
|
|
19037
19376
|
|
|
19038
19377
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
19039
|
-
var
|
|
19378
|
+
var import_react225 = __toESM(require("react"));
|
|
19040
19379
|
|
|
19041
19380
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
19042
|
-
var
|
|
19381
|
+
var import_react224 = __toESM(require("react"));
|
|
19043
19382
|
|
|
19044
19383
|
// src/components/BadgeLoader/BadgeLoader.tsx
|
|
19045
|
-
var
|
|
19384
|
+
var import_react223 = __toESM(require("react"));
|
|
19046
19385
|
var BadgeLoader = ({ children }) => {
|
|
19047
|
-
return /* @__PURE__ */
|
|
19386
|
+
return /* @__PURE__ */ import_react223.default.createElement("span", { className: "Layer__loader Layer__loader--as-badge" }, /* @__PURE__ */ import_react223.default.createElement(Loader_default, { size: 11, className: "Layer__anim--rotating" }), children);
|
|
19048
19387
|
};
|
|
19049
19388
|
|
|
19050
19389
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
19051
|
-
var
|
|
19390
|
+
var import_date_fns43 = require("date-fns");
|
|
19052
19391
|
var CLASS_NAME8 = "Layer__TransactionsToReview";
|
|
19053
19392
|
function TransactionsToReview({
|
|
19054
19393
|
onClick,
|
|
@@ -19057,23 +19396,23 @@ function TransactionsToReview({
|
|
|
19057
19396
|
variants
|
|
19058
19397
|
}) {
|
|
19059
19398
|
const { size = "sm" } = variants != null ? variants : {};
|
|
19060
|
-
const { dateRange: contextDateRange } = (0,
|
|
19399
|
+
const { dateRange: contextDateRange } = (0, import_react224.useContext)(ProfitAndLoss.Context);
|
|
19061
19400
|
const dateRange = usePnlDateRange ? contextDateRange : void 0;
|
|
19062
|
-
const [toReview, setToReview] = (0,
|
|
19401
|
+
const [toReview, setToReview] = (0, import_react224.useState)(0);
|
|
19063
19402
|
const { data, loaded, error, refetch } = useProfitAndLossLTM({
|
|
19064
|
-
currentDate: dateRange ? dateRange.startDate : (0,
|
|
19403
|
+
currentDate: dateRange ? dateRange.startDate : (0, import_date_fns43.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
19065
19404
|
tagFilter
|
|
19066
19405
|
});
|
|
19067
|
-
(0,
|
|
19406
|
+
(0, import_react224.useEffect)(() => {
|
|
19068
19407
|
checkTransactionsToReview();
|
|
19069
19408
|
}, []);
|
|
19070
|
-
(0,
|
|
19409
|
+
(0, import_react224.useEffect)(() => {
|
|
19071
19410
|
checkTransactionsToReview();
|
|
19072
19411
|
}, [dateRange, loaded]);
|
|
19073
19412
|
const checkTransactionsToReview = () => {
|
|
19074
19413
|
if (data && dateRange) {
|
|
19075
19414
|
const monthTx = data.filter(
|
|
19076
|
-
(x) => x.month - 1 === (0,
|
|
19415
|
+
(x) => x.month - 1 === (0, import_date_fns43.getMonth)(dateRange.startDate) && x.year === (0, import_date_fns43.getYear)(dateRange.startDate)
|
|
19077
19416
|
);
|
|
19078
19417
|
if (monthTx.length > 0) {
|
|
19079
19418
|
setToReview(monthTx[0].uncategorized_transactions);
|
|
@@ -19089,37 +19428,37 @@ function TransactionsToReview({
|
|
|
19089
19428
|
verticalGap = "sm";
|
|
19090
19429
|
break;
|
|
19091
19430
|
}
|
|
19092
|
-
return /* @__PURE__ */
|
|
19431
|
+
return /* @__PURE__ */ import_react224.default.createElement("div", { onClick, className: CLASS_NAME8 }, /* @__PURE__ */ import_react224.default.createElement(VStack, { gap: verticalGap, align: "start" }, /* @__PURE__ */ import_react224.default.createElement(ProfitAndLossSummariesHeading, { variants }, "Transactions to review"), loaded === "initial" || loaded === "loading" ? /* @__PURE__ */ import_react224.default.createElement(BadgeLoader, null) : null, loaded === "complete" && error ? /* @__PURE__ */ import_react224.default.createElement(
|
|
19093
19432
|
Badge,
|
|
19094
19433
|
{
|
|
19095
19434
|
variant: "error" /* ERROR */,
|
|
19096
19435
|
size: "small" /* SMALL */,
|
|
19097
|
-
icon: /* @__PURE__ */
|
|
19436
|
+
icon: /* @__PURE__ */ import_react224.default.createElement(RefreshCcw_default, { size: 12 }),
|
|
19098
19437
|
onClick: () => refetch()
|
|
19099
19438
|
},
|
|
19100
19439
|
"Refresh"
|
|
19101
|
-
) : null, loaded === "complete" && !error && toReview > 0 ? /* @__PURE__ */
|
|
19440
|
+
) : null, loaded === "complete" && !error && toReview > 0 ? /* @__PURE__ */ import_react224.default.createElement(
|
|
19102
19441
|
Badge,
|
|
19103
19442
|
{
|
|
19104
19443
|
variant: "warning" /* WARNING */,
|
|
19105
19444
|
size: "small" /* SMALL */,
|
|
19106
|
-
icon: /* @__PURE__ */
|
|
19445
|
+
icon: /* @__PURE__ */ import_react224.default.createElement(Bell_default, { size: 12 })
|
|
19107
19446
|
},
|
|
19108
19447
|
toReview,
|
|
19109
19448
|
" pending"
|
|
19110
|
-
) : null, loaded === "complete" && !error && toReview === 0 ? /* @__PURE__ */
|
|
19449
|
+
) : null, loaded === "complete" && !error && toReview === 0 ? /* @__PURE__ */ import_react224.default.createElement(
|
|
19111
19450
|
Badge,
|
|
19112
19451
|
{
|
|
19113
19452
|
variant: "success" /* SUCCESS */,
|
|
19114
19453
|
size: "small" /* SMALL */,
|
|
19115
|
-
icon: /* @__PURE__ */
|
|
19454
|
+
icon: /* @__PURE__ */ import_react224.default.createElement(Check_default, { size: 12 })
|
|
19116
19455
|
},
|
|
19117
19456
|
"All done"
|
|
19118
|
-
) : null), /* @__PURE__ */
|
|
19457
|
+
) : null), /* @__PURE__ */ import_react224.default.createElement(IconButton, { icon: /* @__PURE__ */ import_react224.default.createElement(ChevronRight_default, null), withBorder: true, onClick }));
|
|
19119
19458
|
}
|
|
19120
19459
|
|
|
19121
19460
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
19122
|
-
var
|
|
19461
|
+
var import_classnames73 = __toESM(require("classnames"));
|
|
19123
19462
|
var AccountingOverview = ({
|
|
19124
19463
|
title = "Accounting overview",
|
|
19125
19464
|
showTitle = true,
|
|
@@ -19134,36 +19473,36 @@ var AccountingOverview = ({
|
|
|
19134
19473
|
slotProps
|
|
19135
19474
|
}) => {
|
|
19136
19475
|
var _a, _b, _c, _d, _e;
|
|
19137
|
-
const [pnlToggle, setPnlToggle] = (0,
|
|
19476
|
+
const [pnlToggle, setPnlToggle] = (0, import_react225.useState)("expenses");
|
|
19138
19477
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
19139
|
-
return /* @__PURE__ */
|
|
19478
|
+
return /* @__PURE__ */ import_react225.default.createElement(
|
|
19140
19479
|
ProfitAndLoss,
|
|
19141
19480
|
{
|
|
19142
19481
|
asContainer: false,
|
|
19143
19482
|
tagFilter: tagFilter ? { key: tagFilter.tagKey, values: tagFilter.tagValues } : void 0
|
|
19144
19483
|
},
|
|
19145
|
-
/* @__PURE__ */
|
|
19484
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19146
19485
|
View,
|
|
19147
19486
|
{
|
|
19148
19487
|
title,
|
|
19149
19488
|
showHeader: showTitle,
|
|
19150
|
-
header: /* @__PURE__ */
|
|
19489
|
+
header: /* @__PURE__ */ import_react225.default.createElement(Header2, null, /* @__PURE__ */ import_react225.default.createElement(HeaderRow, null, /* @__PURE__ */ import_react225.default.createElement(HeaderCol, null, /* @__PURE__ */ import_react225.default.createElement(ProfitAndLoss.DatePicker, null))))
|
|
19151
19490
|
},
|
|
19152
|
-
enableOnboarding && /* @__PURE__ */
|
|
19491
|
+
enableOnboarding && /* @__PURE__ */ import_react225.default.createElement(
|
|
19153
19492
|
Onboarding,
|
|
19154
19493
|
{
|
|
19155
19494
|
onTransactionsToReviewClick,
|
|
19156
19495
|
onboardingStepOverride
|
|
19157
19496
|
}
|
|
19158
19497
|
),
|
|
19159
|
-
/* @__PURE__ */
|
|
19498
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19160
19499
|
Internal_ProfitAndLossSummaries,
|
|
19161
19500
|
{
|
|
19162
19501
|
stringOverrides: (_c = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _c.summaries,
|
|
19163
19502
|
chartColorsList,
|
|
19164
19503
|
slots: {
|
|
19165
19504
|
unstable_AdditionalListItems: showTransactionsToReview ? [
|
|
19166
|
-
/* @__PURE__ */
|
|
19505
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19167
19506
|
TransactionsToReview,
|
|
19168
19507
|
{
|
|
19169
19508
|
key: "transactions-to-review",
|
|
@@ -19177,28 +19516,28 @@ var AccountingOverview = ({
|
|
|
19177
19516
|
variants: profitAndLossSummariesVariants
|
|
19178
19517
|
}
|
|
19179
19518
|
),
|
|
19180
|
-
/* @__PURE__ */
|
|
19519
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19181
19520
|
Container,
|
|
19182
19521
|
{
|
|
19183
19522
|
name: "accounting-overview-profit-and-loss",
|
|
19184
19523
|
asWidget: true,
|
|
19185
19524
|
elevated: true
|
|
19186
19525
|
},
|
|
19187
|
-
/* @__PURE__ */
|
|
19526
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19188
19527
|
ProfitAndLoss.Header,
|
|
19189
19528
|
{
|
|
19190
19529
|
text: (stringOverrides == null ? void 0 : stringOverrides.header) || "Profit & Loss"
|
|
19191
19530
|
}
|
|
19192
19531
|
),
|
|
19193
|
-
/* @__PURE__ */
|
|
19532
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19194
19533
|
ProfitAndLoss.Chart,
|
|
19195
19534
|
{
|
|
19196
19535
|
tagFilter: tagFilter ? { key: tagFilter.tagKey, values: tagFilter.tagValues } : void 0
|
|
19197
19536
|
}
|
|
19198
19537
|
)
|
|
19199
19538
|
),
|
|
19200
|
-
middleBanner && /* @__PURE__ */
|
|
19201
|
-
/* @__PURE__ */
|
|
19539
|
+
middleBanner && /* @__PURE__ */ import_react225.default.createElement(Container, { name: "accounting-overview-middle-banner" }, middleBanner),
|
|
19540
|
+
/* @__PURE__ */ import_react225.default.createElement("div", { className: "Layer__accounting-overview-profit-and-loss-charts" }, /* @__PURE__ */ import_react225.default.createElement(
|
|
19202
19541
|
Toggle,
|
|
19203
19542
|
{
|
|
19204
19543
|
name: "pnl-detailed-charts",
|
|
@@ -19215,15 +19554,15 @@ var AccountingOverview = ({
|
|
|
19215
19554
|
selected: pnlToggle,
|
|
19216
19555
|
onChange: (e) => setPnlToggle(e.target.value)
|
|
19217
19556
|
}
|
|
19218
|
-
), /* @__PURE__ */
|
|
19557
|
+
), /* @__PURE__ */ import_react225.default.createElement(
|
|
19219
19558
|
Container,
|
|
19220
19559
|
{
|
|
19221
|
-
name: (0,
|
|
19560
|
+
name: (0, import_classnames73.default)(
|
|
19222
19561
|
"accounting-overview-profit-and-loss-chart",
|
|
19223
19562
|
pnlToggle !== "revenue" && "accounting-overview-profit-and-loss-chart--hidden"
|
|
19224
19563
|
)
|
|
19225
19564
|
},
|
|
19226
|
-
/* @__PURE__ */
|
|
19565
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19227
19566
|
ProfitAndLoss.DetailedCharts,
|
|
19228
19567
|
{
|
|
19229
19568
|
scope: "revenue",
|
|
@@ -19232,15 +19571,15 @@ var AccountingOverview = ({
|
|
|
19232
19571
|
chartColorsList
|
|
19233
19572
|
}
|
|
19234
19573
|
)
|
|
19235
|
-
), /* @__PURE__ */
|
|
19574
|
+
), /* @__PURE__ */ import_react225.default.createElement(
|
|
19236
19575
|
Container,
|
|
19237
19576
|
{
|
|
19238
|
-
name: (0,
|
|
19577
|
+
name: (0, import_classnames73.default)(
|
|
19239
19578
|
"accounting-overview-profit-and-loss-chart",
|
|
19240
19579
|
pnlToggle !== "expenses" && "accounting-overview-profit-and-loss-chart--hidden"
|
|
19241
19580
|
)
|
|
19242
19581
|
},
|
|
19243
|
-
/* @__PURE__ */
|
|
19582
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19244
19583
|
ProfitAndLoss.DetailedCharts,
|
|
19245
19584
|
{
|
|
19246
19585
|
scope: "expenses",
|
|
@@ -19255,7 +19594,7 @@ var AccountingOverview = ({
|
|
|
19255
19594
|
};
|
|
19256
19595
|
|
|
19257
19596
|
// src/views/BankTransactionsWithLinkedAccounts/BankTransactionsWithLinkedAccounts.tsx
|
|
19258
|
-
var
|
|
19597
|
+
var import_react226 = __toESM(require("react"));
|
|
19259
19598
|
var BankTransactionsWithLinkedAccounts = ({
|
|
19260
19599
|
title,
|
|
19261
19600
|
// deprecated
|
|
@@ -19271,13 +19610,13 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
19271
19610
|
mobileComponent,
|
|
19272
19611
|
stringOverrides
|
|
19273
19612
|
}) => {
|
|
19274
|
-
return /* @__PURE__ */
|
|
19613
|
+
return /* @__PURE__ */ import_react226.default.createElement(
|
|
19275
19614
|
View,
|
|
19276
19615
|
{
|
|
19277
19616
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || "Bank transactions",
|
|
19278
19617
|
showHeader: showTitle
|
|
19279
19618
|
},
|
|
19280
|
-
/* @__PURE__ */
|
|
19619
|
+
/* @__PURE__ */ import_react226.default.createElement(
|
|
19281
19620
|
LinkedAccounts,
|
|
19282
19621
|
{
|
|
19283
19622
|
elevated: elevatedLinkedAccounts,
|
|
@@ -19287,7 +19626,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
19287
19626
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.linkedAccounts
|
|
19288
19627
|
}
|
|
19289
19628
|
),
|
|
19290
|
-
/* @__PURE__ */
|
|
19629
|
+
/* @__PURE__ */ import_react226.default.createElement(
|
|
19291
19630
|
BankTransactions,
|
|
19292
19631
|
{
|
|
19293
19632
|
asWidget: true,
|
|
@@ -19303,7 +19642,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
19303
19642
|
};
|
|
19304
19643
|
|
|
19305
19644
|
// src/views/GeneralLedger/GeneralLedger.tsx
|
|
19306
|
-
var
|
|
19645
|
+
var import_react227 = __toESM(require("react"));
|
|
19307
19646
|
var GeneralLedgerView = ({
|
|
19308
19647
|
title,
|
|
19309
19648
|
// deprecated
|
|
@@ -19311,14 +19650,14 @@ var GeneralLedgerView = ({
|
|
|
19311
19650
|
stringOverrides,
|
|
19312
19651
|
chartOfAccountsOptions
|
|
19313
19652
|
}) => {
|
|
19314
|
-
const [activeTab, setActiveTab] = (0,
|
|
19315
|
-
return /* @__PURE__ */
|
|
19653
|
+
const [activeTab, setActiveTab] = (0, import_react227.useState)("chartOfAccounts");
|
|
19654
|
+
return /* @__PURE__ */ import_react227.default.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ import_react227.default.createElement(
|
|
19316
19655
|
View,
|
|
19317
19656
|
{
|
|
19318
19657
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || "General Ledger",
|
|
19319
19658
|
showHeader: showTitle
|
|
19320
19659
|
},
|
|
19321
|
-
/* @__PURE__ */
|
|
19660
|
+
/* @__PURE__ */ import_react227.default.createElement(
|
|
19322
19661
|
Toggle,
|
|
19323
19662
|
{
|
|
19324
19663
|
name: "general-ledger-tabs",
|
|
@@ -19336,7 +19675,7 @@ var GeneralLedgerView = ({
|
|
|
19336
19675
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
19337
19676
|
}
|
|
19338
19677
|
),
|
|
19339
|
-
activeTab === "chartOfAccounts" ? /* @__PURE__ */
|
|
19678
|
+
activeTab === "chartOfAccounts" ? /* @__PURE__ */ import_react227.default.createElement(
|
|
19340
19679
|
ChartOfAccounts,
|
|
19341
19680
|
{
|
|
19342
19681
|
asWidget: true,
|
|
@@ -19345,12 +19684,12 @@ var GeneralLedgerView = ({
|
|
|
19345
19684
|
templateAccountsEditable: chartOfAccountsOptions == null ? void 0 : chartOfAccountsOptions.templateAccountsEditable,
|
|
19346
19685
|
showReversalEntries: chartOfAccountsOptions == null ? void 0 : chartOfAccountsOptions.showReversalEntries
|
|
19347
19686
|
}
|
|
19348
|
-
) : /* @__PURE__ */
|
|
19687
|
+
) : /* @__PURE__ */ import_react227.default.createElement(Journal, { stringOverrides: stringOverrides == null ? void 0 : stringOverrides.journal })
|
|
19349
19688
|
));
|
|
19350
19689
|
};
|
|
19351
19690
|
|
|
19352
19691
|
// src/views/ProjectProfitability/ProjectProfitability.tsx
|
|
19353
|
-
var
|
|
19692
|
+
var import_react228 = __toESM(require("react"));
|
|
19354
19693
|
var import_react_select5 = __toESM(require("react-select"));
|
|
19355
19694
|
var ProjectProfitabilityView = ({
|
|
19356
19695
|
valueOptions,
|
|
@@ -19359,9 +19698,9 @@ var ProjectProfitabilityView = ({
|
|
|
19359
19698
|
datePickerMode = "monthPicker",
|
|
19360
19699
|
csvMoneyFormat = "DOLLAR_STRING"
|
|
19361
19700
|
}) => {
|
|
19362
|
-
const [activeTab, setActiveTab] = (0,
|
|
19363
|
-
const [tagFilter, setTagFilter] = (0,
|
|
19364
|
-
const [pnlTagFilter, setPnlTagFilter] = (0,
|
|
19701
|
+
const [activeTab, setActiveTab] = (0, import_react228.useState)("overview");
|
|
19702
|
+
const [tagFilter, setTagFilter] = (0, import_react228.useState)(null);
|
|
19703
|
+
const [pnlTagFilter, setPnlTagFilter] = (0, import_react228.useState)(
|
|
19365
19704
|
void 0
|
|
19366
19705
|
);
|
|
19367
19706
|
const isOptionSelected = (option, selectValue) => {
|
|
@@ -19375,14 +19714,14 @@ var ProjectProfitabilityView = ({
|
|
|
19375
19714
|
values: tagFilter2.tagValues
|
|
19376
19715
|
} : void 0;
|
|
19377
19716
|
};
|
|
19378
|
-
return /* @__PURE__ */
|
|
19717
|
+
return /* @__PURE__ */ import_react228.default.createElement(
|
|
19379
19718
|
View,
|
|
19380
19719
|
{
|
|
19381
19720
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || "",
|
|
19382
19721
|
showHeader: showTitle,
|
|
19383
19722
|
viewClassName: "Layer__project-view"
|
|
19384
19723
|
},
|
|
19385
|
-
/* @__PURE__ */
|
|
19724
|
+
/* @__PURE__ */ import_react228.default.createElement("div", { className: "Layer__component Layer__header__actions" }, /* @__PURE__ */ import_react228.default.createElement("div", { className: "Layer__component" }, /* @__PURE__ */ import_react228.default.createElement(
|
|
19386
19725
|
Toggle,
|
|
19387
19726
|
{
|
|
19388
19727
|
name: "project-tabs",
|
|
@@ -19403,7 +19742,7 @@ var ProjectProfitabilityView = ({
|
|
|
19403
19742
|
selected: activeTab,
|
|
19404
19743
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
19405
19744
|
}
|
|
19406
|
-
)), /* @__PURE__ */
|
|
19745
|
+
)), /* @__PURE__ */ import_react228.default.createElement(
|
|
19407
19746
|
import_react_select5.default,
|
|
19408
19747
|
{
|
|
19409
19748
|
className: "Layer__category-menu Layer__select",
|
|
@@ -19421,7 +19760,7 @@ var ProjectProfitabilityView = ({
|
|
|
19421
19760
|
}
|
|
19422
19761
|
}
|
|
19423
19762
|
)),
|
|
19424
|
-
/* @__PURE__ */
|
|
19763
|
+
/* @__PURE__ */ import_react228.default.createElement(Container, { name: "project" }, /* @__PURE__ */ import_react228.default.createElement(import_react228.default.Fragment, null, activeTab === "overview" && /* @__PURE__ */ import_react228.default.createElement(
|
|
19425
19764
|
AccountingOverview,
|
|
19426
19765
|
{
|
|
19427
19766
|
stringOverrides: { header: "Project Overview" },
|
|
@@ -19431,7 +19770,7 @@ var ProjectProfitabilityView = ({
|
|
|
19431
19770
|
showTransactionsToReview: false,
|
|
19432
19771
|
showTitle: false
|
|
19433
19772
|
}
|
|
19434
|
-
), activeTab === "transactions" && /* @__PURE__ */
|
|
19773
|
+
), activeTab === "transactions" && /* @__PURE__ */ import_react228.default.createElement(
|
|
19435
19774
|
BankTransactions,
|
|
19436
19775
|
{
|
|
19437
19776
|
hideHeader: true,
|
|
@@ -19440,7 +19779,7 @@ var ProjectProfitabilityView = ({
|
|
|
19440
19779
|
tagFilter: tagFilter != null ? tagFilter : void 0
|
|
19441
19780
|
}
|
|
19442
19781
|
}
|
|
19443
|
-
), activeTab === "report" && /* @__PURE__ */
|
|
19782
|
+
), activeTab === "report" && /* @__PURE__ */ import_react228.default.createElement(ProfitAndLoss, { asContainer: false, tagFilter: pnlTagFilter }, /* @__PURE__ */ import_react228.default.createElement(
|
|
19444
19783
|
ProfitAndLoss.Report,
|
|
19445
19784
|
{
|
|
19446
19785
|
stringOverrides,
|
|
@@ -19452,7 +19791,7 @@ var ProjectProfitabilityView = ({
|
|
|
19452
19791
|
};
|
|
19453
19792
|
|
|
19454
19793
|
// src/views/Reports/Reports.tsx
|
|
19455
|
-
var
|
|
19794
|
+
var import_react229 = __toESM(require("react"));
|
|
19456
19795
|
var getOptions = (enabledReports) => {
|
|
19457
19796
|
return [
|
|
19458
19797
|
enabledReports.includes("profitAndLoss") ? {
|
|
@@ -19479,17 +19818,17 @@ var Reports = ({
|
|
|
19479
19818
|
statementOfCashFlowConfig
|
|
19480
19819
|
}) => {
|
|
19481
19820
|
var _a;
|
|
19482
|
-
const [activeTab, setActiveTab] = (0,
|
|
19821
|
+
const [activeTab, setActiveTab] = (0, import_react229.useState)(enabledReports[0]);
|
|
19483
19822
|
const { view, containerRef } = useElementViewSize();
|
|
19484
19823
|
const options = getOptions(enabledReports);
|
|
19485
19824
|
const defaultTitle = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
|
|
19486
|
-
return /* @__PURE__ */
|
|
19825
|
+
return /* @__PURE__ */ import_react229.default.createElement(
|
|
19487
19826
|
View,
|
|
19488
19827
|
{
|
|
19489
19828
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || defaultTitle,
|
|
19490
19829
|
showHeader: showTitle
|
|
19491
19830
|
},
|
|
19492
|
-
enabledReports.length > 1 && /* @__PURE__ */
|
|
19831
|
+
enabledReports.length > 1 && /* @__PURE__ */ import_react229.default.createElement("div", { className: "Layer__component Layer__header__actions" }, /* @__PURE__ */ import_react229.default.createElement(
|
|
19493
19832
|
Toggle,
|
|
19494
19833
|
{
|
|
19495
19834
|
name: "reports-tabs",
|
|
@@ -19498,7 +19837,7 @@ var Reports = ({
|
|
|
19498
19837
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
19499
19838
|
}
|
|
19500
19839
|
)),
|
|
19501
|
-
/* @__PURE__ */
|
|
19840
|
+
/* @__PURE__ */ import_react229.default.createElement(Container, { name: "reports", ref: containerRef }, /* @__PURE__ */ import_react229.default.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ import_react229.default.createElement(
|
|
19502
19841
|
ReportsPanel,
|
|
19503
19842
|
{
|
|
19504
19843
|
containerRef,
|
|
@@ -19521,7 +19860,7 @@ var ReportsPanel = ({
|
|
|
19521
19860
|
statementOfCashFlowConfig,
|
|
19522
19861
|
view
|
|
19523
19862
|
}) => {
|
|
19524
|
-
return /* @__PURE__ */
|
|
19863
|
+
return /* @__PURE__ */ import_react229.default.createElement(import_react229.default.Fragment, null, openReport === "profitAndLoss" && /* @__PURE__ */ import_react229.default.createElement(
|
|
19525
19864
|
ProfitAndLoss.Report,
|
|
19526
19865
|
__spreadValues({
|
|
19527
19866
|
stringOverrides,
|
|
@@ -19529,7 +19868,7 @@ var ReportsPanel = ({
|
|
|
19529
19868
|
parentRef: containerRef,
|
|
19530
19869
|
view
|
|
19531
19870
|
}, profitAndLossConfig)
|
|
19532
|
-
), openReport === "balanceSheet" && /* @__PURE__ */
|
|
19871
|
+
), openReport === "balanceSheet" && /* @__PURE__ */ import_react229.default.createElement(BalanceSheet, { stringOverrides: stringOverrides == null ? void 0 : stringOverrides.balanceSheet }), openReport === "statementOfCashFlow" && /* @__PURE__ */ import_react229.default.createElement(
|
|
19533
19872
|
StatementOfCashFlow,
|
|
19534
19873
|
__spreadValues({
|
|
19535
19874
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.statementOfCashflow
|
|
@@ -19538,11 +19877,11 @@ var ReportsPanel = ({
|
|
|
19538
19877
|
};
|
|
19539
19878
|
|
|
19540
19879
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
19541
|
-
var
|
|
19880
|
+
var import_react230 = __toESM(require("react"));
|
|
19542
19881
|
var COMPONENT_NAME7 = "profit-and-loss";
|
|
19543
19882
|
var ProfitAndLossView = (props) => {
|
|
19544
|
-
const containerRef = (0,
|
|
19545
|
-
return /* @__PURE__ */
|
|
19883
|
+
const containerRef = (0, import_react230.useRef)(null);
|
|
19884
|
+
return /* @__PURE__ */ import_react230.default.createElement(Container, { name: COMPONENT_NAME7, ref: containerRef }, /* @__PURE__ */ import_react230.default.createElement(ProfitAndLoss, null, /* @__PURE__ */ import_react230.default.createElement(ProfitAndLossPanel, __spreadValues({ containerRef }, props))));
|
|
19546
19885
|
};
|
|
19547
19886
|
var ProfitAndLossPanel = (_a) => {
|
|
19548
19887
|
var _b = _a, {
|
|
@@ -19552,11 +19891,11 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
19552
19891
|
"containerRef",
|
|
19553
19892
|
"stringOverrides"
|
|
19554
19893
|
]);
|
|
19555
|
-
const { sidebarScope } = (0,
|
|
19556
|
-
return /* @__PURE__ */
|
|
19894
|
+
const { sidebarScope } = (0, import_react230.useContext)(ProfitAndLoss.Context);
|
|
19895
|
+
return /* @__PURE__ */ import_react230.default.createElement(
|
|
19557
19896
|
Panel,
|
|
19558
19897
|
{
|
|
19559
|
-
sidebar: /* @__PURE__ */
|
|
19898
|
+
sidebar: /* @__PURE__ */ import_react230.default.createElement(
|
|
19560
19899
|
ProfitAndLossDetailedCharts,
|
|
19561
19900
|
{
|
|
19562
19901
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.profitAndLossDetailedCharts
|
|
@@ -19565,7 +19904,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
19565
19904
|
sidebarIsOpen: Boolean(sidebarScope),
|
|
19566
19905
|
parentRef: containerRef
|
|
19567
19906
|
},
|
|
19568
|
-
/* @__PURE__ */
|
|
19907
|
+
/* @__PURE__ */ import_react230.default.createElement(
|
|
19569
19908
|
ProfitAndLoss.Header,
|
|
19570
19909
|
{
|
|
19571
19910
|
text: (stringOverrides == null ? void 0 : stringOverrides.header) || "Profit & Loss",
|
|
@@ -19573,7 +19912,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
19573
19912
|
headingClassName: "Layer__profit-and-loss__title"
|
|
19574
19913
|
}
|
|
19575
19914
|
),
|
|
19576
|
-
/* @__PURE__ */
|
|
19915
|
+
/* @__PURE__ */ import_react230.default.createElement(Components, __spreadValues({ stringOverrides }, props))
|
|
19577
19916
|
);
|
|
19578
19917
|
};
|
|
19579
19918
|
var Components = ({
|
|
@@ -19581,11 +19920,11 @@ var Components = ({
|
|
|
19581
19920
|
hideTable = false,
|
|
19582
19921
|
stringOverrides
|
|
19583
19922
|
}) => {
|
|
19584
|
-
const { error, isLoading, isValidating, refetch } = (0,
|
|
19923
|
+
const { error, isLoading, isValidating, refetch } = (0, import_react230.useContext)(
|
|
19585
19924
|
ProfitAndLoss.Context
|
|
19586
19925
|
);
|
|
19587
19926
|
if (!isLoading && error) {
|
|
19588
|
-
return /* @__PURE__ */
|
|
19927
|
+
return /* @__PURE__ */ import_react230.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react230.default.createElement(
|
|
19589
19928
|
DataState,
|
|
19590
19929
|
{
|
|
19591
19930
|
status: "failed" /* failed */,
|
|
@@ -19596,26 +19935,26 @@ var Components = ({
|
|
|
19596
19935
|
}
|
|
19597
19936
|
));
|
|
19598
19937
|
}
|
|
19599
|
-
return /* @__PURE__ */
|
|
19938
|
+
return /* @__PURE__ */ import_react230.default.createElement(import_react230.default.Fragment, null, !hideChart && /* @__PURE__ */ import_react230.default.createElement("div", { className: `Layer__${COMPONENT_NAME7}__chart_with_summaries` }, /* @__PURE__ */ import_react230.default.createElement(
|
|
19600
19939
|
"div",
|
|
19601
19940
|
{
|
|
19602
19941
|
className: `Layer__${COMPONENT_NAME7}__chart_with_summaries__summary-col`
|
|
19603
19942
|
},
|
|
19604
|
-
/* @__PURE__ */
|
|
19605
|
-
/* @__PURE__ */
|
|
19943
|
+
/* @__PURE__ */ import_react230.default.createElement(ProfitAndLoss.DatePicker, null),
|
|
19944
|
+
/* @__PURE__ */ import_react230.default.createElement(
|
|
19606
19945
|
ProfitAndLoss.Summaries,
|
|
19607
19946
|
{
|
|
19608
19947
|
actionable: true,
|
|
19609
19948
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.profitAndLossSummaries
|
|
19610
19949
|
}
|
|
19611
19950
|
)
|
|
19612
|
-
), /* @__PURE__ */
|
|
19951
|
+
), /* @__PURE__ */ import_react230.default.createElement(
|
|
19613
19952
|
"div",
|
|
19614
19953
|
{
|
|
19615
19954
|
className: `Layer__${COMPONENT_NAME7}__chart_with_summaries__chart-col`
|
|
19616
19955
|
},
|
|
19617
|
-
/* @__PURE__ */
|
|
19618
|
-
)), !hideTable && /* @__PURE__ */
|
|
19956
|
+
/* @__PURE__ */ import_react230.default.createElement(ProfitAndLoss.Chart, null)
|
|
19957
|
+
)), !hideTable && /* @__PURE__ */ import_react230.default.createElement(
|
|
19619
19958
|
ProfitAndLoss.Table,
|
|
19620
19959
|
{
|
|
19621
19960
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.profitAndLossTable
|