@layerfi/components 0.1.81 → 0.1.83
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 +695 -355
- package/dist/esm/index.mjs +635 -295
- package/dist/esm/index.mjs.map +4 -4
- package/dist/index.css +1324 -57
- package/dist/index.css.map +3 -3
- package/dist/index.d.ts +180 -38
- package/eslint.config.mjs +101 -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.83";
|
|
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) => {
|
|
@@ -11754,6 +11816,9 @@ var Indicator = ({
|
|
|
11754
11816
|
setCustomCursorSize,
|
|
11755
11817
|
viewBox = {}
|
|
11756
11818
|
}) => {
|
|
11819
|
+
if (!(className == null ? void 0 : className.match(/selected/))) {
|
|
11820
|
+
return null;
|
|
11821
|
+
}
|
|
11757
11822
|
const [opacityIndicator, setOpacityIndicator] = (0, import_react133.useState)(0);
|
|
11758
11823
|
const { x: animateTo = 0, width = 0 } = "x" in viewBox ? viewBox : emptyViewBox;
|
|
11759
11824
|
const margin = width > 12 ? 12 : 6;
|
|
@@ -11771,9 +11836,6 @@ var Indicator = ({
|
|
|
11771
11836
|
setOpacityIndicator(1);
|
|
11772
11837
|
}, 200);
|
|
11773
11838
|
}, [animateTo]);
|
|
11774
|
-
if (!(className == null ? void 0 : className.match(/selected/))) {
|
|
11775
|
-
return null;
|
|
11776
|
-
}
|
|
11777
11839
|
const rectRef = (ref) => {
|
|
11778
11840
|
if (ref) {
|
|
11779
11841
|
const refRectWidth = ref.getBoundingClientRect().width;
|
|
@@ -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,14 +18838,15 @@ 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)
|
|
18612
18845
|
);
|
|
18613
18846
|
const goToNextPage = (task) => {
|
|
18614
18847
|
const allComplete = sortedTasks == null ? void 0 : sortedTasks.filter((taskInList) => taskInList.id !== task.id).every((task2) => isComplete(task2.status));
|
|
18615
|
-
|
|
18848
|
+
const hasMorePages = sortedTasks ? sortedTasks.length > pageSize * currentPage : false;
|
|
18849
|
+
if (allComplete && hasMorePages) {
|
|
18616
18850
|
setCurrentPage(currentPage + 1);
|
|
18617
18851
|
}
|
|
18618
18852
|
};
|
|
@@ -18637,11 +18871,17 @@ var TasksList = ({ pageSize = 10 }) => {
|
|
|
18637
18871
|
|
|
18638
18872
|
// src/components/TasksPending/TasksPending.tsx
|
|
18639
18873
|
var import_react215 = __toESM(require("react"));
|
|
18640
|
-
var
|
|
18641
|
-
var
|
|
18874
|
+
var import_classnames69 = __toESM(require("classnames"));
|
|
18875
|
+
var import_date_fns40 = require("date-fns");
|
|
18642
18876
|
var import_recharts4 = require("recharts");
|
|
18643
18877
|
var TasksPending = () => {
|
|
18644
|
-
const { data } = (0, import_react215.useContext)(TasksContext);
|
|
18878
|
+
const { data: rawData, currentDate } = (0, import_react215.useContext)(TasksContext);
|
|
18879
|
+
const data = (0, import_react215.useMemo)(() => {
|
|
18880
|
+
return rawData == null ? void 0 : rawData.filter((x) => {
|
|
18881
|
+
const d = x.effective_date ? (0, import_date_fns40.parseISO)(x.effective_date) : (0, import_date_fns40.parseISO)(x.created_at);
|
|
18882
|
+
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));
|
|
18883
|
+
});
|
|
18884
|
+
}, [rawData, currentDate]);
|
|
18645
18885
|
const completedTasks = data == null ? void 0 : data.filter((task) => isComplete(task.status)).length;
|
|
18646
18886
|
const chartData = [
|
|
18647
18887
|
{
|
|
@@ -18653,10 +18893,10 @@ var TasksPending = () => {
|
|
|
18653
18893
|
value: data == null ? void 0 : data.filter((task) => !isComplete(task.status)).length
|
|
18654
18894
|
}
|
|
18655
18895
|
];
|
|
18656
|
-
const taskStatusClassName = (0,
|
|
18896
|
+
const taskStatusClassName = (0, import_classnames69.default)(
|
|
18657
18897
|
completedTasks && completedTasks > 0 ? "Layer__tasks-pending-bar__status--done" : "Layer__tasks-pending-bar__status--pending"
|
|
18658
18898
|
);
|
|
18659
|
-
return /* @__PURE__ */ import_react215.default.createElement("div", { className: "Layer__tasks-pending" }, /* @__PURE__ */ import_react215.default.createElement(Text, { size: "lg" /* lg */ }, (0,
|
|
18899
|
+
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
18900
|
import_recharts4.Pie,
|
|
18661
18901
|
{
|
|
18662
18902
|
data: chartData,
|
|
@@ -18683,12 +18923,87 @@ var TasksPending = () => {
|
|
|
18683
18923
|
}
|
|
18684
18924
|
);
|
|
18685
18925
|
})
|
|
18686
|
-
))));
|
|
18926
|
+
))) : null);
|
|
18927
|
+
};
|
|
18928
|
+
|
|
18929
|
+
// src/components/TasksMonthSelector/TasksMonthSelector.tsx
|
|
18930
|
+
var import_react217 = __toESM(require("react"));
|
|
18931
|
+
var import_date_fns41 = require("date-fns");
|
|
18932
|
+
|
|
18933
|
+
// src/components/TasksMonthSelector/TaskMonthTile.tsx
|
|
18934
|
+
var import_react216 = __toESM(require("react"));
|
|
18935
|
+
var import_classnames70 = __toESM(require("classnames"));
|
|
18936
|
+
var TaskMonthTile = ({ monthData, onClick, active, disabled }) => {
|
|
18937
|
+
const isCompleted = monthData.total === monthData.completed;
|
|
18938
|
+
const baseClass = (0, import_classnames70.default)(
|
|
18939
|
+
"Layer__tasks-month-selector__month",
|
|
18940
|
+
isCompleted && "Layer__tasks-month-selector__month--completed",
|
|
18941
|
+
active && "Layer__tasks-month-selector__month--active",
|
|
18942
|
+
disabled && "Layer__tasks-month-selector__month--disabled"
|
|
18943
|
+
);
|
|
18944
|
+
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 })));
|
|
18945
|
+
};
|
|
18946
|
+
|
|
18947
|
+
// src/components/TasksMonthSelector/TasksMonthSelector.tsx
|
|
18948
|
+
var DEFAULT_TASK_DATA = {
|
|
18949
|
+
total: 0,
|
|
18950
|
+
completed: 0,
|
|
18951
|
+
tasks: []
|
|
18952
|
+
};
|
|
18953
|
+
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);
|
|
18954
|
+
var TasksMonthSelector = ({ tasks, year, currentDate, onClick }) => {
|
|
18955
|
+
const { business } = useLayerContext();
|
|
18956
|
+
const minDate = (0, import_react217.useMemo)(() => {
|
|
18957
|
+
if (business) {
|
|
18958
|
+
const date = getEarliestDateToBrowse(business);
|
|
18959
|
+
if (date) {
|
|
18960
|
+
return (0, import_date_fns41.startOfMonth)(date);
|
|
18961
|
+
}
|
|
18962
|
+
}
|
|
18963
|
+
return;
|
|
18964
|
+
}, [business]);
|
|
18965
|
+
const months = (0, import_react217.useMemo)(() => {
|
|
18966
|
+
return Array.from({ length: 12 }, (_, i) => {
|
|
18967
|
+
var _a;
|
|
18968
|
+
const startDate = (0, import_date_fns41.set)(
|
|
18969
|
+
/* @__PURE__ */ new Date(),
|
|
18970
|
+
{ year, month: i, date: 1, hours: 0, minutes: 0, seconds: 0, milliseconds: 0 }
|
|
18971
|
+
);
|
|
18972
|
+
const endDate = (0, import_date_fns41.endOfMonth)(startDate);
|
|
18973
|
+
const disabled = minDate && (0, import_date_fns41.isBefore)(startDate, minDate) || (0, import_date_fns41.isAfter)(startDate, (0, import_date_fns41.startOfMonth)(/* @__PURE__ */ new Date()));
|
|
18974
|
+
const taskData = (_a = tasks == null ? void 0 : tasks.find((x) => x.month === i && x.year === year)) != null ? _a : __spreadValues({
|
|
18975
|
+
monthStr: (0, import_date_fns41.format)(startDate, "MMM"),
|
|
18976
|
+
year,
|
|
18977
|
+
month: i,
|
|
18978
|
+
startDate,
|
|
18979
|
+
endDate
|
|
18980
|
+
}, DEFAULT_TASK_DATA);
|
|
18981
|
+
return __spreadValues({
|
|
18982
|
+
monthStr: (0, import_date_fns41.format)(startDate, "MMM"),
|
|
18983
|
+
startDate,
|
|
18984
|
+
endDate,
|
|
18985
|
+
disabled
|
|
18986
|
+
}, taskData);
|
|
18987
|
+
});
|
|
18988
|
+
}, [tasks, year, minDate]);
|
|
18989
|
+
return /* @__PURE__ */ import_react217.default.createElement("div", { className: "Layer__tasks-month-selector" }, months.map((month, idx) => {
|
|
18990
|
+
return /* @__PURE__ */ import_react217.default.createElement(
|
|
18991
|
+
TaskMonthTile,
|
|
18992
|
+
{
|
|
18993
|
+
key: idx,
|
|
18994
|
+
onClick,
|
|
18995
|
+
monthData: month,
|
|
18996
|
+
active: isCurrentMonth(month.startDate, currentDate),
|
|
18997
|
+
disabled: month.disabled
|
|
18998
|
+
}
|
|
18999
|
+
);
|
|
19000
|
+
}));
|
|
18687
19001
|
};
|
|
18688
19002
|
|
|
18689
19003
|
// src/components/Tasks/Tasks.tsx
|
|
18690
|
-
var
|
|
18691
|
-
var
|
|
19004
|
+
var import_classnames71 = __toESM(require("classnames"));
|
|
19005
|
+
var import_date_fns42 = require("date-fns");
|
|
19006
|
+
var UseTasksContext = (0, import_react218.createContext)({
|
|
18692
19007
|
data: void 0,
|
|
18693
19008
|
isLoading: void 0,
|
|
18694
19009
|
loadedStatus: "initial",
|
|
@@ -18698,7 +19013,16 @@ var UseTasksContext = (0, import_react216.createContext)({
|
|
|
18698
19013
|
},
|
|
18699
19014
|
submitResponseToTask: () => {
|
|
18700
19015
|
},
|
|
18701
|
-
|
|
19016
|
+
uploadDocumentsForTask: () => Promise.resolve(),
|
|
19017
|
+
deleteUploadsForTask: () => {
|
|
19018
|
+
},
|
|
19019
|
+
updateDocUploadTaskDescription: () => {
|
|
19020
|
+
},
|
|
19021
|
+
currentDate: /* @__PURE__ */ new Date(),
|
|
19022
|
+
setCurrentDate: () => {
|
|
19023
|
+
},
|
|
19024
|
+
dateRange: { startDate: (0, import_date_fns42.startOfYear)(/* @__PURE__ */ new Date()), endDate: (0, import_date_fns42.endOfYear)(/* @__PURE__ */ new Date()) },
|
|
19025
|
+
setDateRange: () => {
|
|
18702
19026
|
}
|
|
18703
19027
|
});
|
|
18704
19028
|
var Tasks = ({
|
|
@@ -18709,7 +19033,7 @@ var Tasks = ({
|
|
|
18709
19033
|
// deprecated
|
|
18710
19034
|
stringOverrides
|
|
18711
19035
|
}) => {
|
|
18712
|
-
return /* @__PURE__ */
|
|
19036
|
+
return /* @__PURE__ */ import_react218.default.createElement(TasksProvider, null, /* @__PURE__ */ import_react218.default.createElement(
|
|
18713
19037
|
TasksComponent,
|
|
18714
19038
|
{
|
|
18715
19039
|
collapsable,
|
|
@@ -18722,7 +19046,7 @@ var Tasks = ({
|
|
|
18722
19046
|
};
|
|
18723
19047
|
var TasksProvider = ({ children }) => {
|
|
18724
19048
|
const contextData = useTasks();
|
|
18725
|
-
return /* @__PURE__ */
|
|
19049
|
+
return /* @__PURE__ */ import_react218.default.createElement(TasksContext.Provider, { value: contextData }, children);
|
|
18726
19050
|
};
|
|
18727
19051
|
var TasksComponent = ({
|
|
18728
19052
|
collapsable = false,
|
|
@@ -18732,8 +19056,16 @@ var TasksComponent = ({
|
|
|
18732
19056
|
// deprecated
|
|
18733
19057
|
stringOverrides
|
|
18734
19058
|
}) => {
|
|
18735
|
-
const {
|
|
18736
|
-
|
|
19059
|
+
const {
|
|
19060
|
+
isLoading,
|
|
19061
|
+
loadedStatus,
|
|
19062
|
+
data,
|
|
19063
|
+
monthlyData,
|
|
19064
|
+
currentDate,
|
|
19065
|
+
setCurrentDate,
|
|
19066
|
+
dateRange
|
|
19067
|
+
} = (0, import_react218.useContext)(TasksContext);
|
|
19068
|
+
const allComplete = (0, import_react218.useMemo)(() => {
|
|
18737
19069
|
if (!data) {
|
|
18738
19070
|
return void 0;
|
|
18739
19071
|
}
|
|
@@ -18742,15 +19074,15 @@ var TasksComponent = ({
|
|
|
18742
19074
|
}
|
|
18743
19075
|
return false;
|
|
18744
19076
|
}, [data, isLoading]);
|
|
18745
|
-
const [open, setOpen] = (0,
|
|
19077
|
+
const [open, setOpen] = (0, import_react218.useState)(
|
|
18746
19078
|
defaultCollapsed || collapsedWhenComplete ? false : true
|
|
18747
19079
|
);
|
|
18748
|
-
(0,
|
|
19080
|
+
(0, import_react218.useEffect)(() => {
|
|
18749
19081
|
if (allComplete && open && collapsedWhenComplete && loadedStatus === "complete") {
|
|
18750
19082
|
setOpen(false);
|
|
18751
19083
|
}
|
|
18752
19084
|
}, [allComplete]);
|
|
18753
|
-
return /* @__PURE__ */
|
|
19085
|
+
return /* @__PURE__ */ import_react218.default.createElement("div", { className: "Layer__tasks-component" }, /* @__PURE__ */ import_react218.default.createElement(
|
|
18754
19086
|
TasksHeader,
|
|
18755
19087
|
{
|
|
18756
19088
|
tasksHeader: (stringOverrides == null ? void 0 : stringOverrides.header) || tasksHeader,
|
|
@@ -18758,29 +19090,37 @@ var TasksComponent = ({
|
|
|
18758
19090
|
open,
|
|
18759
19091
|
toggleContent: () => setOpen(!open)
|
|
18760
19092
|
}
|
|
18761
|
-
), /* @__PURE__ */
|
|
19093
|
+
), /* @__PURE__ */ import_react218.default.createElement(
|
|
18762
19094
|
"div",
|
|
18763
19095
|
{
|
|
18764
|
-
className: (0,
|
|
19096
|
+
className: (0, import_classnames71.default)(
|
|
18765
19097
|
"Layer__tasks__content",
|
|
18766
19098
|
!open && "Layer__tasks__content--collapsed"
|
|
18767
19099
|
)
|
|
18768
19100
|
},
|
|
18769
|
-
isLoading || !data ? /* @__PURE__ */
|
|
19101
|
+
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(
|
|
19102
|
+
TasksMonthSelector,
|
|
19103
|
+
{
|
|
19104
|
+
tasks: monthlyData,
|
|
19105
|
+
currentDate,
|
|
19106
|
+
onClick: setCurrentDate,
|
|
19107
|
+
year: (0, import_date_fns42.getYear)(dateRange.startDate)
|
|
19108
|
+
}
|
|
19109
|
+
), /* @__PURE__ */ import_react218.default.createElement(TasksPending, null), /* @__PURE__ */ import_react218.default.createElement(TasksList, null))
|
|
18770
19110
|
));
|
|
18771
19111
|
};
|
|
18772
19112
|
|
|
18773
19113
|
// src/components/PlatformOnboarding/LinkAccounts.tsx
|
|
18774
|
-
var
|
|
19114
|
+
var import_react219 = __toESM(require("react"));
|
|
18775
19115
|
var LinkAccounts = (_a) => {
|
|
18776
19116
|
var _b = _a, { inBox } = _b, props = __objRest(_b, ["inBox"]);
|
|
18777
|
-
const content = (0,
|
|
19117
|
+
const content = (0, import_react219.useMemo)(() => {
|
|
18778
19118
|
if (inBox) {
|
|
18779
|
-
return /* @__PURE__ */
|
|
19119
|
+
return /* @__PURE__ */ import_react219.default.createElement("div", { className: "Layer__link-accounts__box" }, /* @__PURE__ */ import_react219.default.createElement(LinkAccountsContent, __spreadValues({}, props)));
|
|
18780
19120
|
}
|
|
18781
|
-
return /* @__PURE__ */
|
|
19121
|
+
return /* @__PURE__ */ import_react219.default.createElement(LinkAccountsContent, __spreadValues({}, props));
|
|
18782
19122
|
}, [inBox, props]);
|
|
18783
|
-
return /* @__PURE__ */
|
|
19123
|
+
return /* @__PURE__ */ import_react219.default.createElement(LinkedAccountsProvider, null, content);
|
|
18784
19124
|
};
|
|
18785
19125
|
var LinkAccountsContent = ({
|
|
18786
19126
|
title,
|
|
@@ -18794,8 +19134,8 @@ var LinkAccountsContent = ({
|
|
|
18794
19134
|
onNext
|
|
18795
19135
|
}) => {
|
|
18796
19136
|
var _a;
|
|
18797
|
-
const { data, loadingStatus, error, refetchAccounts, addConnection } = (0,
|
|
18798
|
-
return /* @__PURE__ */
|
|
19137
|
+
const { data, loadingStatus, error, refetchAccounts, addConnection } = (0, import_react219.useContext)(LinkedAccountsContext);
|
|
19138
|
+
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
19139
|
DataState,
|
|
18800
19140
|
{
|
|
18801
19141
|
status: "failed" /* failed */,
|
|
@@ -18803,7 +19143,7 @@ var LinkAccountsContent = ({
|
|
|
18803
19143
|
description: "Please try again later",
|
|
18804
19144
|
onRefresh: refetchAccounts
|
|
18805
19145
|
}
|
|
18806
|
-
)) : null, data && data.length > 0 ? /* @__PURE__ */
|
|
19146
|
+
)) : 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
19147
|
LinkedAccountItemThumb,
|
|
18808
19148
|
{
|
|
18809
19149
|
key: index,
|
|
@@ -18813,33 +19153,33 @@ var LinkAccountsContent = ({
|
|
|
18813
19153
|
showBreakConnection,
|
|
18814
19154
|
asWidget
|
|
18815
19155
|
}
|
|
18816
|
-
))) : null, /* @__PURE__ */
|
|
19156
|
+
))) : null, /* @__PURE__ */ import_react219.default.createElement(
|
|
18817
19157
|
ActionableRow,
|
|
18818
19158
|
{
|
|
18819
|
-
iconBox: /* @__PURE__ */
|
|
19159
|
+
iconBox: /* @__PURE__ */ import_react219.default.createElement(PlaidIcon_default, null),
|
|
18820
19160
|
title: data && data.length > 0 ? "Connect my next business account" : "Connect accounts",
|
|
18821
19161
|
description: "Import data with one simple integration.",
|
|
18822
|
-
button: /* @__PURE__ */
|
|
19162
|
+
button: /* @__PURE__ */ import_react219.default.createElement(
|
|
18823
19163
|
Button,
|
|
18824
19164
|
{
|
|
18825
19165
|
onClick: () => addConnection("PLAID"),
|
|
18826
|
-
rightIcon: /* @__PURE__ */
|
|
19166
|
+
rightIcon: /* @__PURE__ */ import_react219.default.createElement(Link_default, { size: 12 }),
|
|
18827
19167
|
disabled: loadingStatus !== "complete"
|
|
18828
19168
|
},
|
|
18829
19169
|
data && data.length > 0 ? "Connect next" : "Connect"
|
|
18830
19170
|
)
|
|
18831
19171
|
}
|
|
18832
|
-
), /* @__PURE__ */
|
|
19172
|
+
), /* @__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
19173
|
};
|
|
18834
19174
|
|
|
18835
19175
|
// src/components/UpsellBanner/BookkeepingUpsellBar.tsx
|
|
18836
|
-
var
|
|
19176
|
+
var import_react220 = __toESM(require("react"));
|
|
18837
19177
|
|
|
18838
19178
|
// src/icons/Coffee.tsx
|
|
18839
|
-
var
|
|
19179
|
+
var React220 = __toESM(require("react"));
|
|
18840
19180
|
var CoffeeIcon = (_a) => {
|
|
18841
19181
|
var _b = _a, { size = 11 } = _b, props = __objRest(_b, ["size"]);
|
|
18842
|
-
return /* @__PURE__ */
|
|
19182
|
+
return /* @__PURE__ */ React220.createElement(
|
|
18843
19183
|
"svg",
|
|
18844
19184
|
__spreadProps(__spreadValues({
|
|
18845
19185
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -18849,7 +19189,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18849
19189
|
width: size,
|
|
18850
19190
|
height: size
|
|
18851
19191
|
}),
|
|
18852
|
-
/* @__PURE__ */
|
|
19192
|
+
/* @__PURE__ */ React220.createElement("g", { clipPath: "url(#clip0_5018_10141)" }, /* @__PURE__ */ React220.createElement(
|
|
18853
19193
|
"path",
|
|
18854
19194
|
{
|
|
18855
19195
|
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 +19197,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18857
19197
|
strokeLinecap: "round",
|
|
18858
19198
|
strokeLinejoin: "round"
|
|
18859
19199
|
}
|
|
18860
|
-
), /* @__PURE__ */
|
|
19200
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18861
19201
|
"path",
|
|
18862
19202
|
{
|
|
18863
19203
|
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 +19205,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18865
19205
|
strokeLinecap: "round",
|
|
18866
19206
|
strokeLinejoin: "round"
|
|
18867
19207
|
}
|
|
18868
|
-
), /* @__PURE__ */
|
|
19208
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18869
19209
|
"path",
|
|
18870
19210
|
{
|
|
18871
19211
|
d: "M8.75 0.958344V2.33334",
|
|
@@ -18873,7 +19213,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18873
19213
|
strokeLinecap: "round",
|
|
18874
19214
|
strokeLinejoin: "round"
|
|
18875
19215
|
}
|
|
18876
|
-
), /* @__PURE__ */
|
|
19216
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18877
19217
|
"path",
|
|
18878
19218
|
{
|
|
18879
19219
|
d: "M6.91663 0.958344V2.33334",
|
|
@@ -18881,7 +19221,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18881
19221
|
strokeLinecap: "round",
|
|
18882
19222
|
strokeLinejoin: "round"
|
|
18883
19223
|
}
|
|
18884
|
-
), /* @__PURE__ */
|
|
19224
|
+
), /* @__PURE__ */ React220.createElement(
|
|
18885
19225
|
"path",
|
|
18886
19226
|
{
|
|
18887
19227
|
d: "M5.08337 0.958344V2.33334",
|
|
@@ -18890,7 +19230,7 @@ var CoffeeIcon = (_a) => {
|
|
|
18890
19230
|
strokeLinejoin: "round"
|
|
18891
19231
|
}
|
|
18892
19232
|
)),
|
|
18893
|
-
/* @__PURE__ */
|
|
19233
|
+
/* @__PURE__ */ React220.createElement("defs", null, /* @__PURE__ */ React220.createElement("clipPath", { id: "clip0_5018_10141" }, /* @__PURE__ */ React220.createElement(
|
|
18894
19234
|
"rect",
|
|
18895
19235
|
{
|
|
18896
19236
|
width: "11",
|
|
@@ -18908,30 +19248,30 @@ var BookkeepingUpsellBar = ({
|
|
|
18908
19248
|
onClick,
|
|
18909
19249
|
href
|
|
18910
19250
|
}) => {
|
|
18911
|
-
return /* @__PURE__ */
|
|
19251
|
+
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
19252
|
Text,
|
|
18913
19253
|
{
|
|
18914
19254
|
size: "sm" /* sm */,
|
|
18915
19255
|
className: "Layer__bar-banner__text-container__desc"
|
|
18916
19256
|
},
|
|
18917
19257
|
"Order bookkeeping service supported by real humans."
|
|
18918
|
-
))), onClick ? /* @__PURE__ */
|
|
19258
|
+
))), 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
19259
|
};
|
|
18920
19260
|
|
|
18921
19261
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
18922
|
-
var
|
|
19262
|
+
var import_react222 = __toESM(require("react"));
|
|
18923
19263
|
|
|
18924
19264
|
// src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
|
|
18925
|
-
var
|
|
19265
|
+
var import_react221 = __toESM(require("react"));
|
|
18926
19266
|
var CLASS_NAME7 = "Layer__BookkeepingProfitAndLossSummariesContainer";
|
|
18927
19267
|
function BookkeepingProfitAndLossSummariesContainer({
|
|
18928
19268
|
children
|
|
18929
19269
|
}) {
|
|
18930
|
-
return /* @__PURE__ */
|
|
19270
|
+
return /* @__PURE__ */ import_react221.default.createElement("div", { className: CLASS_NAME7 }, children);
|
|
18931
19271
|
}
|
|
18932
19272
|
|
|
18933
19273
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
18934
|
-
var
|
|
19274
|
+
var import_classnames72 = __toESM(require("classnames"));
|
|
18935
19275
|
var BookkeepingOverview = ({
|
|
18936
19276
|
title,
|
|
18937
19277
|
showTitle = true,
|
|
@@ -18939,19 +19279,19 @@ var BookkeepingOverview = ({
|
|
|
18939
19279
|
slotProps
|
|
18940
19280
|
}) => {
|
|
18941
19281
|
var _a, _b, _c, _d, _e, _f;
|
|
18942
|
-
const [pnlToggle, setPnlToggle] = (0,
|
|
19282
|
+
const [pnlToggle, setPnlToggle] = (0, import_react222.useState)("expenses");
|
|
18943
19283
|
const [width] = useWindowSize();
|
|
18944
19284
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
18945
|
-
return /* @__PURE__ */
|
|
19285
|
+
return /* @__PURE__ */ import_react222.default.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ import_react222.default.createElement(TasksProvider, null, /* @__PURE__ */ import_react222.default.createElement(
|
|
18946
19286
|
View,
|
|
18947
19287
|
{
|
|
18948
19288
|
viewClassName: "Layer__bookkeeping-overview--view",
|
|
18949
19289
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || "Bookkeeping overview",
|
|
18950
19290
|
withSidebar: width > 1100,
|
|
18951
|
-
sidebar: /* @__PURE__ */
|
|
19291
|
+
sidebar: /* @__PURE__ */ import_react222.default.createElement(TasksComponent, { stringOverrides: stringOverrides == null ? void 0 : stringOverrides.tasks }),
|
|
18952
19292
|
showHeader: showTitle
|
|
18953
19293
|
},
|
|
18954
|
-
width <= 1100 && /* @__PURE__ */
|
|
19294
|
+
width <= 1100 && /* @__PURE__ */ import_react222.default.createElement(
|
|
18955
19295
|
TasksComponent,
|
|
18956
19296
|
{
|
|
18957
19297
|
collapsable: true,
|
|
@@ -18959,30 +19299,30 @@ var BookkeepingOverview = ({
|
|
|
18959
19299
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.tasks
|
|
18960
19300
|
}
|
|
18961
19301
|
),
|
|
18962
|
-
/* @__PURE__ */
|
|
19302
|
+
/* @__PURE__ */ import_react222.default.createElement(
|
|
18963
19303
|
Container,
|
|
18964
19304
|
{
|
|
18965
19305
|
name: "bookkeeping-overview-profit-and-loss",
|
|
18966
19306
|
asWidget: true,
|
|
18967
19307
|
elevated: true
|
|
18968
19308
|
},
|
|
18969
|
-
/* @__PURE__ */
|
|
19309
|
+
/* @__PURE__ */ import_react222.default.createElement(
|
|
18970
19310
|
ProfitAndLoss.Header,
|
|
18971
19311
|
{
|
|
18972
19312
|
text: ((_c = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _c.header) || "Profit & Loss",
|
|
18973
19313
|
withDatePicker: true
|
|
18974
19314
|
}
|
|
18975
19315
|
),
|
|
18976
|
-
/* @__PURE__ */
|
|
19316
|
+
/* @__PURE__ */ import_react222.default.createElement(BookkeepingProfitAndLossSummariesContainer, null, /* @__PURE__ */ import_react222.default.createElement(
|
|
18977
19317
|
ProfitAndLoss.Summaries,
|
|
18978
19318
|
{
|
|
18979
19319
|
stringOverrides: (_d = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _d.summaries,
|
|
18980
19320
|
variants: profitAndLossSummariesVariants
|
|
18981
19321
|
}
|
|
18982
19322
|
)),
|
|
18983
|
-
/* @__PURE__ */
|
|
19323
|
+
/* @__PURE__ */ import_react222.default.createElement(ProfitAndLoss.Chart, null)
|
|
18984
19324
|
),
|
|
18985
|
-
/* @__PURE__ */
|
|
19325
|
+
/* @__PURE__ */ import_react222.default.createElement("div", { className: "Layer__bookkeeping-overview-profit-and-loss-charts" }, /* @__PURE__ */ import_react222.default.createElement(
|
|
18986
19326
|
Toggle,
|
|
18987
19327
|
{
|
|
18988
19328
|
name: "pnl-detailed-charts",
|
|
@@ -18999,15 +19339,15 @@ var BookkeepingOverview = ({
|
|
|
18999
19339
|
selected: pnlToggle,
|
|
19000
19340
|
onChange: (e) => setPnlToggle(e.target.value)
|
|
19001
19341
|
}
|
|
19002
|
-
), /* @__PURE__ */
|
|
19342
|
+
), /* @__PURE__ */ import_react222.default.createElement(
|
|
19003
19343
|
Container,
|
|
19004
19344
|
{
|
|
19005
|
-
name: (0,
|
|
19345
|
+
name: (0, import_classnames72.default)(
|
|
19006
19346
|
"bookkeeping-overview-profit-and-loss-chart",
|
|
19007
19347
|
pnlToggle !== "revenue" && "bookkeeping-overview-profit-and-loss-chart--hidden"
|
|
19008
19348
|
)
|
|
19009
19349
|
},
|
|
19010
|
-
/* @__PURE__ */
|
|
19350
|
+
/* @__PURE__ */ import_react222.default.createElement(
|
|
19011
19351
|
ProfitAndLoss.DetailedCharts,
|
|
19012
19352
|
{
|
|
19013
19353
|
scope: "revenue",
|
|
@@ -19015,15 +19355,15 @@ var BookkeepingOverview = ({
|
|
|
19015
19355
|
stringOverrides: (_e = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _e.detailedCharts
|
|
19016
19356
|
}
|
|
19017
19357
|
)
|
|
19018
|
-
), /* @__PURE__ */
|
|
19358
|
+
), /* @__PURE__ */ import_react222.default.createElement(
|
|
19019
19359
|
Container,
|
|
19020
19360
|
{
|
|
19021
|
-
name: (0,
|
|
19361
|
+
name: (0, import_classnames72.default)(
|
|
19022
19362
|
"bookkeeping-overview-profit-and-loss-chart",
|
|
19023
19363
|
pnlToggle !== "expenses" && "bookkeeping-overview-profit-and-loss-chart--hidden"
|
|
19024
19364
|
)
|
|
19025
19365
|
},
|
|
19026
|
-
/* @__PURE__ */
|
|
19366
|
+
/* @__PURE__ */ import_react222.default.createElement(
|
|
19027
19367
|
ProfitAndLoss.DetailedCharts,
|
|
19028
19368
|
{
|
|
19029
19369
|
scope: "expenses",
|
|
@@ -19036,19 +19376,19 @@ var BookkeepingOverview = ({
|
|
|
19036
19376
|
};
|
|
19037
19377
|
|
|
19038
19378
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
19039
|
-
var
|
|
19379
|
+
var import_react225 = __toESM(require("react"));
|
|
19040
19380
|
|
|
19041
19381
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
19042
|
-
var
|
|
19382
|
+
var import_react224 = __toESM(require("react"));
|
|
19043
19383
|
|
|
19044
19384
|
// src/components/BadgeLoader/BadgeLoader.tsx
|
|
19045
|
-
var
|
|
19385
|
+
var import_react223 = __toESM(require("react"));
|
|
19046
19386
|
var BadgeLoader = ({ children }) => {
|
|
19047
|
-
return /* @__PURE__ */
|
|
19387
|
+
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
19388
|
};
|
|
19049
19389
|
|
|
19050
19390
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
19051
|
-
var
|
|
19391
|
+
var import_date_fns43 = require("date-fns");
|
|
19052
19392
|
var CLASS_NAME8 = "Layer__TransactionsToReview";
|
|
19053
19393
|
function TransactionsToReview({
|
|
19054
19394
|
onClick,
|
|
@@ -19057,23 +19397,23 @@ function TransactionsToReview({
|
|
|
19057
19397
|
variants
|
|
19058
19398
|
}) {
|
|
19059
19399
|
const { size = "sm" } = variants != null ? variants : {};
|
|
19060
|
-
const { dateRange: contextDateRange } = (0,
|
|
19400
|
+
const { dateRange: contextDateRange } = (0, import_react224.useContext)(ProfitAndLoss.Context);
|
|
19061
19401
|
const dateRange = usePnlDateRange ? contextDateRange : void 0;
|
|
19062
|
-
const [toReview, setToReview] = (0,
|
|
19402
|
+
const [toReview, setToReview] = (0, import_react224.useState)(0);
|
|
19063
19403
|
const { data, loaded, error, refetch } = useProfitAndLossLTM({
|
|
19064
|
-
currentDate: dateRange ? dateRange.startDate : (0,
|
|
19404
|
+
currentDate: dateRange ? dateRange.startDate : (0, import_date_fns43.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
19065
19405
|
tagFilter
|
|
19066
19406
|
});
|
|
19067
|
-
(0,
|
|
19407
|
+
(0, import_react224.useEffect)(() => {
|
|
19068
19408
|
checkTransactionsToReview();
|
|
19069
19409
|
}, []);
|
|
19070
|
-
(0,
|
|
19410
|
+
(0, import_react224.useEffect)(() => {
|
|
19071
19411
|
checkTransactionsToReview();
|
|
19072
19412
|
}, [dateRange, loaded]);
|
|
19073
19413
|
const checkTransactionsToReview = () => {
|
|
19074
19414
|
if (data && dateRange) {
|
|
19075
19415
|
const monthTx = data.filter(
|
|
19076
|
-
(x) => x.month - 1 === (0,
|
|
19416
|
+
(x) => x.month - 1 === (0, import_date_fns43.getMonth)(dateRange.startDate) && x.year === (0, import_date_fns43.getYear)(dateRange.startDate)
|
|
19077
19417
|
);
|
|
19078
19418
|
if (monthTx.length > 0) {
|
|
19079
19419
|
setToReview(monthTx[0].uncategorized_transactions);
|
|
@@ -19089,37 +19429,37 @@ function TransactionsToReview({
|
|
|
19089
19429
|
verticalGap = "sm";
|
|
19090
19430
|
break;
|
|
19091
19431
|
}
|
|
19092
|
-
return /* @__PURE__ */
|
|
19432
|
+
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
19433
|
Badge,
|
|
19094
19434
|
{
|
|
19095
19435
|
variant: "error" /* ERROR */,
|
|
19096
19436
|
size: "small" /* SMALL */,
|
|
19097
|
-
icon: /* @__PURE__ */
|
|
19437
|
+
icon: /* @__PURE__ */ import_react224.default.createElement(RefreshCcw_default, { size: 12 }),
|
|
19098
19438
|
onClick: () => refetch()
|
|
19099
19439
|
},
|
|
19100
19440
|
"Refresh"
|
|
19101
|
-
) : null, loaded === "complete" && !error && toReview > 0 ? /* @__PURE__ */
|
|
19441
|
+
) : null, loaded === "complete" && !error && toReview > 0 ? /* @__PURE__ */ import_react224.default.createElement(
|
|
19102
19442
|
Badge,
|
|
19103
19443
|
{
|
|
19104
19444
|
variant: "warning" /* WARNING */,
|
|
19105
19445
|
size: "small" /* SMALL */,
|
|
19106
|
-
icon: /* @__PURE__ */
|
|
19446
|
+
icon: /* @__PURE__ */ import_react224.default.createElement(Bell_default, { size: 12 })
|
|
19107
19447
|
},
|
|
19108
19448
|
toReview,
|
|
19109
19449
|
" pending"
|
|
19110
|
-
) : null, loaded === "complete" && !error && toReview === 0 ? /* @__PURE__ */
|
|
19450
|
+
) : null, loaded === "complete" && !error && toReview === 0 ? /* @__PURE__ */ import_react224.default.createElement(
|
|
19111
19451
|
Badge,
|
|
19112
19452
|
{
|
|
19113
19453
|
variant: "success" /* SUCCESS */,
|
|
19114
19454
|
size: "small" /* SMALL */,
|
|
19115
|
-
icon: /* @__PURE__ */
|
|
19455
|
+
icon: /* @__PURE__ */ import_react224.default.createElement(Check_default, { size: 12 })
|
|
19116
19456
|
},
|
|
19117
19457
|
"All done"
|
|
19118
|
-
) : null), /* @__PURE__ */
|
|
19458
|
+
) : null), /* @__PURE__ */ import_react224.default.createElement(IconButton, { icon: /* @__PURE__ */ import_react224.default.createElement(ChevronRight_default, null), withBorder: true, onClick }));
|
|
19119
19459
|
}
|
|
19120
19460
|
|
|
19121
19461
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
19122
|
-
var
|
|
19462
|
+
var import_classnames73 = __toESM(require("classnames"));
|
|
19123
19463
|
var AccountingOverview = ({
|
|
19124
19464
|
title = "Accounting overview",
|
|
19125
19465
|
showTitle = true,
|
|
@@ -19134,36 +19474,36 @@ var AccountingOverview = ({
|
|
|
19134
19474
|
slotProps
|
|
19135
19475
|
}) => {
|
|
19136
19476
|
var _a, _b, _c, _d, _e;
|
|
19137
|
-
const [pnlToggle, setPnlToggle] = (0,
|
|
19477
|
+
const [pnlToggle, setPnlToggle] = (0, import_react225.useState)("expenses");
|
|
19138
19478
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
19139
|
-
return /* @__PURE__ */
|
|
19479
|
+
return /* @__PURE__ */ import_react225.default.createElement(
|
|
19140
19480
|
ProfitAndLoss,
|
|
19141
19481
|
{
|
|
19142
19482
|
asContainer: false,
|
|
19143
19483
|
tagFilter: tagFilter ? { key: tagFilter.tagKey, values: tagFilter.tagValues } : void 0
|
|
19144
19484
|
},
|
|
19145
|
-
/* @__PURE__ */
|
|
19485
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19146
19486
|
View,
|
|
19147
19487
|
{
|
|
19148
19488
|
title,
|
|
19149
19489
|
showHeader: showTitle,
|
|
19150
|
-
header: /* @__PURE__ */
|
|
19490
|
+
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
19491
|
},
|
|
19152
|
-
enableOnboarding && /* @__PURE__ */
|
|
19492
|
+
enableOnboarding && /* @__PURE__ */ import_react225.default.createElement(
|
|
19153
19493
|
Onboarding,
|
|
19154
19494
|
{
|
|
19155
19495
|
onTransactionsToReviewClick,
|
|
19156
19496
|
onboardingStepOverride
|
|
19157
19497
|
}
|
|
19158
19498
|
),
|
|
19159
|
-
/* @__PURE__ */
|
|
19499
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19160
19500
|
Internal_ProfitAndLossSummaries,
|
|
19161
19501
|
{
|
|
19162
19502
|
stringOverrides: (_c = stringOverrides == null ? void 0 : stringOverrides.profitAndLoss) == null ? void 0 : _c.summaries,
|
|
19163
19503
|
chartColorsList,
|
|
19164
19504
|
slots: {
|
|
19165
19505
|
unstable_AdditionalListItems: showTransactionsToReview ? [
|
|
19166
|
-
/* @__PURE__ */
|
|
19506
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19167
19507
|
TransactionsToReview,
|
|
19168
19508
|
{
|
|
19169
19509
|
key: "transactions-to-review",
|
|
@@ -19177,28 +19517,28 @@ var AccountingOverview = ({
|
|
|
19177
19517
|
variants: profitAndLossSummariesVariants
|
|
19178
19518
|
}
|
|
19179
19519
|
),
|
|
19180
|
-
/* @__PURE__ */
|
|
19520
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19181
19521
|
Container,
|
|
19182
19522
|
{
|
|
19183
19523
|
name: "accounting-overview-profit-and-loss",
|
|
19184
19524
|
asWidget: true,
|
|
19185
19525
|
elevated: true
|
|
19186
19526
|
},
|
|
19187
|
-
/* @__PURE__ */
|
|
19527
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19188
19528
|
ProfitAndLoss.Header,
|
|
19189
19529
|
{
|
|
19190
19530
|
text: (stringOverrides == null ? void 0 : stringOverrides.header) || "Profit & Loss"
|
|
19191
19531
|
}
|
|
19192
19532
|
),
|
|
19193
|
-
/* @__PURE__ */
|
|
19533
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19194
19534
|
ProfitAndLoss.Chart,
|
|
19195
19535
|
{
|
|
19196
19536
|
tagFilter: tagFilter ? { key: tagFilter.tagKey, values: tagFilter.tagValues } : void 0
|
|
19197
19537
|
}
|
|
19198
19538
|
)
|
|
19199
19539
|
),
|
|
19200
|
-
middleBanner && /* @__PURE__ */
|
|
19201
|
-
/* @__PURE__ */
|
|
19540
|
+
middleBanner && /* @__PURE__ */ import_react225.default.createElement(Container, { name: "accounting-overview-middle-banner" }, middleBanner),
|
|
19541
|
+
/* @__PURE__ */ import_react225.default.createElement("div", { className: "Layer__accounting-overview-profit-and-loss-charts" }, /* @__PURE__ */ import_react225.default.createElement(
|
|
19202
19542
|
Toggle,
|
|
19203
19543
|
{
|
|
19204
19544
|
name: "pnl-detailed-charts",
|
|
@@ -19215,15 +19555,15 @@ var AccountingOverview = ({
|
|
|
19215
19555
|
selected: pnlToggle,
|
|
19216
19556
|
onChange: (e) => setPnlToggle(e.target.value)
|
|
19217
19557
|
}
|
|
19218
|
-
), /* @__PURE__ */
|
|
19558
|
+
), /* @__PURE__ */ import_react225.default.createElement(
|
|
19219
19559
|
Container,
|
|
19220
19560
|
{
|
|
19221
|
-
name: (0,
|
|
19561
|
+
name: (0, import_classnames73.default)(
|
|
19222
19562
|
"accounting-overview-profit-and-loss-chart",
|
|
19223
19563
|
pnlToggle !== "revenue" && "accounting-overview-profit-and-loss-chart--hidden"
|
|
19224
19564
|
)
|
|
19225
19565
|
},
|
|
19226
|
-
/* @__PURE__ */
|
|
19566
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19227
19567
|
ProfitAndLoss.DetailedCharts,
|
|
19228
19568
|
{
|
|
19229
19569
|
scope: "revenue",
|
|
@@ -19232,15 +19572,15 @@ var AccountingOverview = ({
|
|
|
19232
19572
|
chartColorsList
|
|
19233
19573
|
}
|
|
19234
19574
|
)
|
|
19235
|
-
), /* @__PURE__ */
|
|
19575
|
+
), /* @__PURE__ */ import_react225.default.createElement(
|
|
19236
19576
|
Container,
|
|
19237
19577
|
{
|
|
19238
|
-
name: (0,
|
|
19578
|
+
name: (0, import_classnames73.default)(
|
|
19239
19579
|
"accounting-overview-profit-and-loss-chart",
|
|
19240
19580
|
pnlToggle !== "expenses" && "accounting-overview-profit-and-loss-chart--hidden"
|
|
19241
19581
|
)
|
|
19242
19582
|
},
|
|
19243
|
-
/* @__PURE__ */
|
|
19583
|
+
/* @__PURE__ */ import_react225.default.createElement(
|
|
19244
19584
|
ProfitAndLoss.DetailedCharts,
|
|
19245
19585
|
{
|
|
19246
19586
|
scope: "expenses",
|
|
@@ -19255,7 +19595,7 @@ var AccountingOverview = ({
|
|
|
19255
19595
|
};
|
|
19256
19596
|
|
|
19257
19597
|
// src/views/BankTransactionsWithLinkedAccounts/BankTransactionsWithLinkedAccounts.tsx
|
|
19258
|
-
var
|
|
19598
|
+
var import_react226 = __toESM(require("react"));
|
|
19259
19599
|
var BankTransactionsWithLinkedAccounts = ({
|
|
19260
19600
|
title,
|
|
19261
19601
|
// deprecated
|
|
@@ -19271,13 +19611,13 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
19271
19611
|
mobileComponent,
|
|
19272
19612
|
stringOverrides
|
|
19273
19613
|
}) => {
|
|
19274
|
-
return /* @__PURE__ */
|
|
19614
|
+
return /* @__PURE__ */ import_react226.default.createElement(
|
|
19275
19615
|
View,
|
|
19276
19616
|
{
|
|
19277
19617
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || "Bank transactions",
|
|
19278
19618
|
showHeader: showTitle
|
|
19279
19619
|
},
|
|
19280
|
-
/* @__PURE__ */
|
|
19620
|
+
/* @__PURE__ */ import_react226.default.createElement(
|
|
19281
19621
|
LinkedAccounts,
|
|
19282
19622
|
{
|
|
19283
19623
|
elevated: elevatedLinkedAccounts,
|
|
@@ -19287,7 +19627,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
19287
19627
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.linkedAccounts
|
|
19288
19628
|
}
|
|
19289
19629
|
),
|
|
19290
|
-
/* @__PURE__ */
|
|
19630
|
+
/* @__PURE__ */ import_react226.default.createElement(
|
|
19291
19631
|
BankTransactions,
|
|
19292
19632
|
{
|
|
19293
19633
|
asWidget: true,
|
|
@@ -19303,7 +19643,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
19303
19643
|
};
|
|
19304
19644
|
|
|
19305
19645
|
// src/views/GeneralLedger/GeneralLedger.tsx
|
|
19306
|
-
var
|
|
19646
|
+
var import_react227 = __toESM(require("react"));
|
|
19307
19647
|
var GeneralLedgerView = ({
|
|
19308
19648
|
title,
|
|
19309
19649
|
// deprecated
|
|
@@ -19311,14 +19651,14 @@ var GeneralLedgerView = ({
|
|
|
19311
19651
|
stringOverrides,
|
|
19312
19652
|
chartOfAccountsOptions
|
|
19313
19653
|
}) => {
|
|
19314
|
-
const [activeTab, setActiveTab] = (0,
|
|
19315
|
-
return /* @__PURE__ */
|
|
19654
|
+
const [activeTab, setActiveTab] = (0, import_react227.useState)("chartOfAccounts");
|
|
19655
|
+
return /* @__PURE__ */ import_react227.default.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ import_react227.default.createElement(
|
|
19316
19656
|
View,
|
|
19317
19657
|
{
|
|
19318
19658
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || "General Ledger",
|
|
19319
19659
|
showHeader: showTitle
|
|
19320
19660
|
},
|
|
19321
|
-
/* @__PURE__ */
|
|
19661
|
+
/* @__PURE__ */ import_react227.default.createElement(
|
|
19322
19662
|
Toggle,
|
|
19323
19663
|
{
|
|
19324
19664
|
name: "general-ledger-tabs",
|
|
@@ -19336,7 +19676,7 @@ var GeneralLedgerView = ({
|
|
|
19336
19676
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
19337
19677
|
}
|
|
19338
19678
|
),
|
|
19339
|
-
activeTab === "chartOfAccounts" ? /* @__PURE__ */
|
|
19679
|
+
activeTab === "chartOfAccounts" ? /* @__PURE__ */ import_react227.default.createElement(
|
|
19340
19680
|
ChartOfAccounts,
|
|
19341
19681
|
{
|
|
19342
19682
|
asWidget: true,
|
|
@@ -19345,12 +19685,12 @@ var GeneralLedgerView = ({
|
|
|
19345
19685
|
templateAccountsEditable: chartOfAccountsOptions == null ? void 0 : chartOfAccountsOptions.templateAccountsEditable,
|
|
19346
19686
|
showReversalEntries: chartOfAccountsOptions == null ? void 0 : chartOfAccountsOptions.showReversalEntries
|
|
19347
19687
|
}
|
|
19348
|
-
) : /* @__PURE__ */
|
|
19688
|
+
) : /* @__PURE__ */ import_react227.default.createElement(Journal, { stringOverrides: stringOverrides == null ? void 0 : stringOverrides.journal })
|
|
19349
19689
|
));
|
|
19350
19690
|
};
|
|
19351
19691
|
|
|
19352
19692
|
// src/views/ProjectProfitability/ProjectProfitability.tsx
|
|
19353
|
-
var
|
|
19693
|
+
var import_react228 = __toESM(require("react"));
|
|
19354
19694
|
var import_react_select5 = __toESM(require("react-select"));
|
|
19355
19695
|
var ProjectProfitabilityView = ({
|
|
19356
19696
|
valueOptions,
|
|
@@ -19359,9 +19699,9 @@ var ProjectProfitabilityView = ({
|
|
|
19359
19699
|
datePickerMode = "monthPicker",
|
|
19360
19700
|
csvMoneyFormat = "DOLLAR_STRING"
|
|
19361
19701
|
}) => {
|
|
19362
|
-
const [activeTab, setActiveTab] = (0,
|
|
19363
|
-
const [tagFilter, setTagFilter] = (0,
|
|
19364
|
-
const [pnlTagFilter, setPnlTagFilter] = (0,
|
|
19702
|
+
const [activeTab, setActiveTab] = (0, import_react228.useState)("overview");
|
|
19703
|
+
const [tagFilter, setTagFilter] = (0, import_react228.useState)(null);
|
|
19704
|
+
const [pnlTagFilter, setPnlTagFilter] = (0, import_react228.useState)(
|
|
19365
19705
|
void 0
|
|
19366
19706
|
);
|
|
19367
19707
|
const isOptionSelected = (option, selectValue) => {
|
|
@@ -19375,14 +19715,14 @@ var ProjectProfitabilityView = ({
|
|
|
19375
19715
|
values: tagFilter2.tagValues
|
|
19376
19716
|
} : void 0;
|
|
19377
19717
|
};
|
|
19378
|
-
return /* @__PURE__ */
|
|
19718
|
+
return /* @__PURE__ */ import_react228.default.createElement(
|
|
19379
19719
|
View,
|
|
19380
19720
|
{
|
|
19381
19721
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || "",
|
|
19382
19722
|
showHeader: showTitle,
|
|
19383
19723
|
viewClassName: "Layer__project-view"
|
|
19384
19724
|
},
|
|
19385
|
-
/* @__PURE__ */
|
|
19725
|
+
/* @__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
19726
|
Toggle,
|
|
19387
19727
|
{
|
|
19388
19728
|
name: "project-tabs",
|
|
@@ -19403,7 +19743,7 @@ var ProjectProfitabilityView = ({
|
|
|
19403
19743
|
selected: activeTab,
|
|
19404
19744
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
19405
19745
|
}
|
|
19406
|
-
)), /* @__PURE__ */
|
|
19746
|
+
)), /* @__PURE__ */ import_react228.default.createElement(
|
|
19407
19747
|
import_react_select5.default,
|
|
19408
19748
|
{
|
|
19409
19749
|
className: "Layer__category-menu Layer__select",
|
|
@@ -19421,7 +19761,7 @@ var ProjectProfitabilityView = ({
|
|
|
19421
19761
|
}
|
|
19422
19762
|
}
|
|
19423
19763
|
)),
|
|
19424
|
-
/* @__PURE__ */
|
|
19764
|
+
/* @__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
19765
|
AccountingOverview,
|
|
19426
19766
|
{
|
|
19427
19767
|
stringOverrides: { header: "Project Overview" },
|
|
@@ -19431,7 +19771,7 @@ var ProjectProfitabilityView = ({
|
|
|
19431
19771
|
showTransactionsToReview: false,
|
|
19432
19772
|
showTitle: false
|
|
19433
19773
|
}
|
|
19434
|
-
), activeTab === "transactions" && /* @__PURE__ */
|
|
19774
|
+
), activeTab === "transactions" && /* @__PURE__ */ import_react228.default.createElement(
|
|
19435
19775
|
BankTransactions,
|
|
19436
19776
|
{
|
|
19437
19777
|
hideHeader: true,
|
|
@@ -19440,7 +19780,7 @@ var ProjectProfitabilityView = ({
|
|
|
19440
19780
|
tagFilter: tagFilter != null ? tagFilter : void 0
|
|
19441
19781
|
}
|
|
19442
19782
|
}
|
|
19443
|
-
), activeTab === "report" && /* @__PURE__ */
|
|
19783
|
+
), activeTab === "report" && /* @__PURE__ */ import_react228.default.createElement(ProfitAndLoss, { asContainer: false, tagFilter: pnlTagFilter }, /* @__PURE__ */ import_react228.default.createElement(
|
|
19444
19784
|
ProfitAndLoss.Report,
|
|
19445
19785
|
{
|
|
19446
19786
|
stringOverrides,
|
|
@@ -19452,7 +19792,7 @@ var ProjectProfitabilityView = ({
|
|
|
19452
19792
|
};
|
|
19453
19793
|
|
|
19454
19794
|
// src/views/Reports/Reports.tsx
|
|
19455
|
-
var
|
|
19795
|
+
var import_react229 = __toESM(require("react"));
|
|
19456
19796
|
var getOptions = (enabledReports) => {
|
|
19457
19797
|
return [
|
|
19458
19798
|
enabledReports.includes("profitAndLoss") ? {
|
|
@@ -19479,17 +19819,17 @@ var Reports = ({
|
|
|
19479
19819
|
statementOfCashFlowConfig
|
|
19480
19820
|
}) => {
|
|
19481
19821
|
var _a;
|
|
19482
|
-
const [activeTab, setActiveTab] = (0,
|
|
19822
|
+
const [activeTab, setActiveTab] = (0, import_react229.useState)(enabledReports[0]);
|
|
19483
19823
|
const { view, containerRef } = useElementViewSize();
|
|
19484
19824
|
const options = getOptions(enabledReports);
|
|
19485
19825
|
const defaultTitle = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
|
|
19486
|
-
return /* @__PURE__ */
|
|
19826
|
+
return /* @__PURE__ */ import_react229.default.createElement(
|
|
19487
19827
|
View,
|
|
19488
19828
|
{
|
|
19489
19829
|
title: (stringOverrides == null ? void 0 : stringOverrides.title) || title || defaultTitle,
|
|
19490
19830
|
showHeader: showTitle
|
|
19491
19831
|
},
|
|
19492
|
-
enabledReports.length > 1 && /* @__PURE__ */
|
|
19832
|
+
enabledReports.length > 1 && /* @__PURE__ */ import_react229.default.createElement("div", { className: "Layer__component Layer__header__actions" }, /* @__PURE__ */ import_react229.default.createElement(
|
|
19493
19833
|
Toggle,
|
|
19494
19834
|
{
|
|
19495
19835
|
name: "reports-tabs",
|
|
@@ -19498,7 +19838,7 @@ var Reports = ({
|
|
|
19498
19838
|
onChange: (opt) => setActiveTab(opt.target.value)
|
|
19499
19839
|
}
|
|
19500
19840
|
)),
|
|
19501
|
-
/* @__PURE__ */
|
|
19841
|
+
/* @__PURE__ */ import_react229.default.createElement(Container, { name: "reports", ref: containerRef }, /* @__PURE__ */ import_react229.default.createElement(ProfitAndLoss, { asContainer: false }, /* @__PURE__ */ import_react229.default.createElement(
|
|
19502
19842
|
ReportsPanel,
|
|
19503
19843
|
{
|
|
19504
19844
|
containerRef,
|
|
@@ -19521,7 +19861,7 @@ var ReportsPanel = ({
|
|
|
19521
19861
|
statementOfCashFlowConfig,
|
|
19522
19862
|
view
|
|
19523
19863
|
}) => {
|
|
19524
|
-
return /* @__PURE__ */
|
|
19864
|
+
return /* @__PURE__ */ import_react229.default.createElement(import_react229.default.Fragment, null, openReport === "profitAndLoss" && /* @__PURE__ */ import_react229.default.createElement(
|
|
19525
19865
|
ProfitAndLoss.Report,
|
|
19526
19866
|
__spreadValues({
|
|
19527
19867
|
stringOverrides,
|
|
@@ -19529,7 +19869,7 @@ var ReportsPanel = ({
|
|
|
19529
19869
|
parentRef: containerRef,
|
|
19530
19870
|
view
|
|
19531
19871
|
}, profitAndLossConfig)
|
|
19532
|
-
), openReport === "balanceSheet" && /* @__PURE__ */
|
|
19872
|
+
), openReport === "balanceSheet" && /* @__PURE__ */ import_react229.default.createElement(BalanceSheet, { stringOverrides: stringOverrides == null ? void 0 : stringOverrides.balanceSheet }), openReport === "statementOfCashFlow" && /* @__PURE__ */ import_react229.default.createElement(
|
|
19533
19873
|
StatementOfCashFlow,
|
|
19534
19874
|
__spreadValues({
|
|
19535
19875
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.statementOfCashflow
|
|
@@ -19538,11 +19878,11 @@ var ReportsPanel = ({
|
|
|
19538
19878
|
};
|
|
19539
19879
|
|
|
19540
19880
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
19541
|
-
var
|
|
19881
|
+
var import_react230 = __toESM(require("react"));
|
|
19542
19882
|
var COMPONENT_NAME7 = "profit-and-loss";
|
|
19543
19883
|
var ProfitAndLossView = (props) => {
|
|
19544
|
-
const containerRef = (0,
|
|
19545
|
-
return /* @__PURE__ */
|
|
19884
|
+
const containerRef = (0, import_react230.useRef)(null);
|
|
19885
|
+
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
19886
|
};
|
|
19547
19887
|
var ProfitAndLossPanel = (_a) => {
|
|
19548
19888
|
var _b = _a, {
|
|
@@ -19552,11 +19892,11 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
19552
19892
|
"containerRef",
|
|
19553
19893
|
"stringOverrides"
|
|
19554
19894
|
]);
|
|
19555
|
-
const { sidebarScope } = (0,
|
|
19556
|
-
return /* @__PURE__ */
|
|
19895
|
+
const { sidebarScope } = (0, import_react230.useContext)(ProfitAndLoss.Context);
|
|
19896
|
+
return /* @__PURE__ */ import_react230.default.createElement(
|
|
19557
19897
|
Panel,
|
|
19558
19898
|
{
|
|
19559
|
-
sidebar: /* @__PURE__ */
|
|
19899
|
+
sidebar: /* @__PURE__ */ import_react230.default.createElement(
|
|
19560
19900
|
ProfitAndLossDetailedCharts,
|
|
19561
19901
|
{
|
|
19562
19902
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.profitAndLossDetailedCharts
|
|
@@ -19565,7 +19905,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
19565
19905
|
sidebarIsOpen: Boolean(sidebarScope),
|
|
19566
19906
|
parentRef: containerRef
|
|
19567
19907
|
},
|
|
19568
|
-
/* @__PURE__ */
|
|
19908
|
+
/* @__PURE__ */ import_react230.default.createElement(
|
|
19569
19909
|
ProfitAndLoss.Header,
|
|
19570
19910
|
{
|
|
19571
19911
|
text: (stringOverrides == null ? void 0 : stringOverrides.header) || "Profit & Loss",
|
|
@@ -19573,7 +19913,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
19573
19913
|
headingClassName: "Layer__profit-and-loss__title"
|
|
19574
19914
|
}
|
|
19575
19915
|
),
|
|
19576
|
-
/* @__PURE__ */
|
|
19916
|
+
/* @__PURE__ */ import_react230.default.createElement(Components, __spreadValues({ stringOverrides }, props))
|
|
19577
19917
|
);
|
|
19578
19918
|
};
|
|
19579
19919
|
var Components = ({
|
|
@@ -19581,11 +19921,11 @@ var Components = ({
|
|
|
19581
19921
|
hideTable = false,
|
|
19582
19922
|
stringOverrides
|
|
19583
19923
|
}) => {
|
|
19584
|
-
const { error, isLoading, isValidating, refetch } = (0,
|
|
19924
|
+
const { error, isLoading, isValidating, refetch } = (0, import_react230.useContext)(
|
|
19585
19925
|
ProfitAndLoss.Context
|
|
19586
19926
|
);
|
|
19587
19927
|
if (!isLoading && error) {
|
|
19588
|
-
return /* @__PURE__ */
|
|
19928
|
+
return /* @__PURE__ */ import_react230.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react230.default.createElement(
|
|
19589
19929
|
DataState,
|
|
19590
19930
|
{
|
|
19591
19931
|
status: "failed" /* failed */,
|
|
@@ -19596,26 +19936,26 @@ var Components = ({
|
|
|
19596
19936
|
}
|
|
19597
19937
|
));
|
|
19598
19938
|
}
|
|
19599
|
-
return /* @__PURE__ */
|
|
19939
|
+
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
19940
|
"div",
|
|
19601
19941
|
{
|
|
19602
19942
|
className: `Layer__${COMPONENT_NAME7}__chart_with_summaries__summary-col`
|
|
19603
19943
|
},
|
|
19604
|
-
/* @__PURE__ */
|
|
19605
|
-
/* @__PURE__ */
|
|
19944
|
+
/* @__PURE__ */ import_react230.default.createElement(ProfitAndLoss.DatePicker, null),
|
|
19945
|
+
/* @__PURE__ */ import_react230.default.createElement(
|
|
19606
19946
|
ProfitAndLoss.Summaries,
|
|
19607
19947
|
{
|
|
19608
19948
|
actionable: true,
|
|
19609
19949
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.profitAndLossSummaries
|
|
19610
19950
|
}
|
|
19611
19951
|
)
|
|
19612
|
-
), /* @__PURE__ */
|
|
19952
|
+
), /* @__PURE__ */ import_react230.default.createElement(
|
|
19613
19953
|
"div",
|
|
19614
19954
|
{
|
|
19615
19955
|
className: `Layer__${COMPONENT_NAME7}__chart_with_summaries__chart-col`
|
|
19616
19956
|
},
|
|
19617
|
-
/* @__PURE__ */
|
|
19618
|
-
)), !hideTable && /* @__PURE__ */
|
|
19957
|
+
/* @__PURE__ */ import_react230.default.createElement(ProfitAndLoss.Chart, null)
|
|
19958
|
+
)), !hideTable && /* @__PURE__ */ import_react230.default.createElement(
|
|
19619
19959
|
ProfitAndLoss.Table,
|
|
19620
19960
|
{
|
|
19621
19961
|
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.profitAndLossTable
|