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