@layerfi/components 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/esm/index.js CHANGED
@@ -563,7 +563,7 @@ var BalanceSheet = () => {
563
563
  };
564
564
 
565
565
  // src/components/BankTransactions/BankTransactions.tsx
566
- import React50, { useState as useState9, useMemo as useMemo2 } from "react";
566
+ import React54, { useState as useState10, useMemo as useMemo2 } from "react";
567
567
 
568
568
  // src/config/general.ts
569
569
  var DATE_FORMAT = "LLL d, yyyy";
@@ -703,15 +703,97 @@ function hasSuggestions(categorization) {
703
703
  return categorization.suggestions !== void 0;
704
704
  }
705
705
 
706
+ // src/utils/helpers.ts
707
+ var range = (start, end) => {
708
+ let length = end - start + 1;
709
+ return Array.from({ length }, (_, idx) => idx + start);
710
+ };
711
+ var debounce = (fnc, timeout = 300) => {
712
+ let timer;
713
+ return (...args) => {
714
+ clearTimeout(timer);
715
+ timer = setTimeout(() => {
716
+ fnc.apply(void 0, args);
717
+ }, timeout);
718
+ };
719
+ };
720
+
706
721
  // src/components/BankTransactionListItem/BankTransactionListItem.tsx
707
- import React40, { useRef as useRef11, useState as useState8 } from "react";
722
+ import React46, { useEffect as useEffect6, useRef as useRef11, useState as useState9 } from "react";
723
+
724
+ // src/icons/ChevronDownFill.tsx
725
+ import * as React8 from "react";
726
+ var ChevronDownFill = ({ size = 18, ...props }) => /* @__PURE__ */ React8.createElement(
727
+ "svg",
728
+ {
729
+ xmlns: "http://www.w3.org/2000/svg",
730
+ viewBox: "0 0 18 18",
731
+ fill: "none",
732
+ ...props,
733
+ width: size,
734
+ height: size
735
+ },
736
+ /* @__PURE__ */ React8.createElement("path", { d: "M4.5 6.75L9 11.25L13.5 6.75", fill: "currentColor" }),
737
+ /* @__PURE__ */ React8.createElement(
738
+ "path",
739
+ {
740
+ d: "M4.5 6.75L9 11.25L13.5 6.75H4.5Z",
741
+ stroke: "currentColor",
742
+ strokeLinecap: "round",
743
+ strokeLinejoin: "round"
744
+ }
745
+ )
746
+ );
747
+ var ChevronDownFill_default = ChevronDownFill;
708
748
 
709
749
  // src/components/BankTransactionRow/BankTransactionRow.tsx
710
- import React38, { useRef as useRef10, useState as useState7 } from "react";
750
+ import React44, { useEffect as useEffect5, useRef as useRef10, useState as useState8 } from "react";
751
+
752
+ // src/icons/AlertCircle.tsx
753
+ import * as React9 from "react";
754
+ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React9.createElement(
755
+ "svg",
756
+ {
757
+ viewBox: "0 0 18 18",
758
+ fill: "none",
759
+ xmlns: "http://www.w3.org/2000/svg",
760
+ ...props,
761
+ width: size,
762
+ height: size
763
+ },
764
+ /* @__PURE__ */ React9.createElement(
765
+ "path",
766
+ {
767
+ d: "M9 16.5C13.1421 16.5 16.5 13.1421 16.5 9C16.5 4.85786 13.1421 1.5 9 1.5C4.85786 1.5 1.5 4.85786 1.5 9C1.5 13.1421 4.85786 16.5 9 16.5Z",
768
+ stroke: "currentColor",
769
+ strokeLinecap: "round",
770
+ strokeLinejoin: "round"
771
+ }
772
+ ),
773
+ /* @__PURE__ */ React9.createElement(
774
+ "path",
775
+ {
776
+ d: "M9 6V9",
777
+ stroke: "currentColor",
778
+ strokeLinecap: "round",
779
+ strokeLinejoin: "round"
780
+ }
781
+ ),
782
+ /* @__PURE__ */ React9.createElement(
783
+ "path",
784
+ {
785
+ d: "M9 12H9.0075",
786
+ stroke: "currentColor",
787
+ strokeLinecap: "round",
788
+ strokeLinejoin: "round"
789
+ }
790
+ )
791
+ );
792
+ var AlertCircle_default = AlertCircle;
711
793
 
712
794
  // src/icons/Scissors.tsx
713
- import * as React8 from "react";
714
- var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement(
795
+ import * as React10 from "react";
796
+ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React10.createElement(
715
797
  "svg",
716
798
  {
717
799
  viewBox: "0 0 11 11",
@@ -721,7 +803,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
721
803
  width: size,
722
804
  height: size
723
805
  },
724
- /* @__PURE__ */ React8.createElement(
806
+ /* @__PURE__ */ React10.createElement(
725
807
  "path",
726
808
  {
727
809
  d: "M2.75 4.125C3.50939 4.125 4.125 3.50939 4.125 2.75C4.125 1.99061 3.50939 1.375 2.75 1.375C1.99061 1.375 1.375 1.99061 1.375 2.75C1.375 3.50939 1.99061 4.125 2.75 4.125Z",
@@ -729,7 +811,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
729
811
  strokeLinecap: "round",
730
812
  strokeLinejoin: "round"
731
813
  },
732
- /* @__PURE__ */ React8.createElement(
814
+ /* @__PURE__ */ React10.createElement(
733
815
  "animate",
734
816
  {
735
817
  attributeName: "d",
@@ -744,7 +826,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
744
826
  }
745
827
  )
746
828
  ),
747
- /* @__PURE__ */ React8.createElement(
829
+ /* @__PURE__ */ React10.createElement(
748
830
  "path",
749
831
  {
750
832
  d: "M2.75 9.625C3.50939 9.625 4.125 9.00939 4.125 8.25C4.125 7.49061 3.50939 6.875 2.75 6.875C1.99061 6.875 1.375 7.49061 1.375 8.25C1.375 9.00939 1.99061 9.625 2.75 9.625Z",
@@ -752,7 +834,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
752
834
  strokeLinecap: "round",
753
835
  strokeLinejoin: "round"
754
836
  },
755
- /* @__PURE__ */ React8.createElement(
837
+ /* @__PURE__ */ React10.createElement(
756
838
  "animate",
757
839
  {
758
840
  attributeName: "d",
@@ -767,7 +849,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
767
849
  }
768
850
  )
769
851
  ),
770
- /* @__PURE__ */ React8.createElement(
852
+ /* @__PURE__ */ React10.createElement(
771
853
  "path",
772
854
  {
773
855
  d: "M9.16668 1.83325L3.72168 7.27825",
@@ -775,7 +857,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
775
857
  strokeLinecap: "round",
776
858
  strokeLinejoin: "round"
777
859
  },
778
- /* @__PURE__ */ React8.createElement(
860
+ /* @__PURE__ */ React10.createElement(
779
861
  "animate",
780
862
  {
781
863
  attributeName: "d",
@@ -790,7 +872,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
790
872
  }
791
873
  )
792
874
  ),
793
- /* @__PURE__ */ React8.createElement(
875
+ /* @__PURE__ */ React10.createElement(
794
876
  "path",
795
877
  {
796
878
  d: "M6.63232 6.63672L9.16691 9.16672",
@@ -798,7 +880,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
798
880
  strokeLinecap: "round",
799
881
  strokeLinejoin: "round"
800
882
  },
801
- /* @__PURE__ */ React8.createElement(
883
+ /* @__PURE__ */ React10.createElement(
802
884
  "animate",
803
885
  {
804
886
  attributeName: "d",
@@ -813,7 +895,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
813
895
  }
814
896
  )
815
897
  ),
816
- /* @__PURE__ */ React8.createElement(
898
+ /* @__PURE__ */ React10.createElement(
817
899
  "path",
818
900
  {
819
901
  d: "M3.72168 3.72168L5.50001 5.50001",
@@ -821,7 +903,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
821
903
  strokeLinecap: "round",
822
904
  strokeLinejoin: "round"
823
905
  },
824
- /* @__PURE__ */ React8.createElement(
906
+ /* @__PURE__ */ React10.createElement(
825
907
  "animate",
826
908
  {
827
909
  attributeName: "d",
@@ -839,44 +921,11 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
839
921
  );
840
922
  var Scissors_default = Scissors;
841
923
 
842
- // src/icons/X.tsx
843
- import * as React9 from "react";
844
- var X = ({ size = 18, ...props }) => /* @__PURE__ */ React9.createElement(
845
- "svg",
846
- {
847
- xmlns: "http://www.w3.org/2000/svg",
848
- viewBox: "0 0 18 18",
849
- fill: "none",
850
- ...props,
851
- width: size,
852
- height: size
853
- },
854
- /* @__PURE__ */ React9.createElement(
855
- "path",
856
- {
857
- d: "M13.5 4.5L4.5 13.5",
858
- stroke: "currentColor",
859
- strokeLinecap: "round",
860
- strokeLinejoin: "round"
861
- }
862
- ),
863
- /* @__PURE__ */ React9.createElement(
864
- "path",
865
- {
866
- d: "M4.5 4.5L13.5 13.5",
867
- stroke: "currentColor",
868
- strokeLinecap: "round",
869
- strokeLinejoin: "round"
870
- }
871
- )
872
- );
873
- var X_default = X;
874
-
875
924
  // src/components/Badge/Badge.tsx
876
- import React21 from "react";
925
+ import React22 from "react";
877
926
 
878
927
  // src/components/Button/Button.tsx
879
- import React10, { useRef as useRef3 } from "react";
928
+ import React11, { useRef as useRef3 } from "react";
880
929
  import classNames from "classnames";
881
930
  var Button = ({
882
931
  className,
@@ -886,16 +935,19 @@ var Button = ({
886
935
  rightIcon,
887
936
  iconOnly,
888
937
  iconAsPrimary = false,
938
+ justify = "center",
889
939
  ...props
890
940
  }) => {
891
941
  const buttonRef = useRef3(null);
892
- let justify = "center";
893
- if (leftIcon && rightIcon) {
894
- justify = "space-between";
942
+ let justifyContent = "center";
943
+ if (justify) {
944
+ justifyContent = justify;
945
+ } else if (leftIcon && rightIcon) {
946
+ justifyContent = "space-between";
895
947
  } else if (rightIcon) {
896
- justify = "space-between";
948
+ justifyContent = "space-between";
897
949
  } else if (leftIcon) {
898
- justify = "start";
950
+ justifyContent = "start";
899
951
  }
900
952
  const baseClassName = classNames(
901
953
  "Layer__btn",
@@ -910,7 +962,7 @@ var Button = ({
910
962
  const stopAnimation = () => buttonRef.current && [...buttonRef.current.getElementsByClassName("animateOnHover")].forEach(
911
963
  (el) => el.endElement()
912
964
  );
913
- return /* @__PURE__ */ React10.createElement(
965
+ return /* @__PURE__ */ React11.createElement(
914
966
  "button",
915
967
  {
916
968
  ...props,
@@ -919,7 +971,7 @@ var Button = ({
919
971
  onMouseLeave: stopAnimation,
920
972
  ref: buttonRef
921
973
  },
922
- /* @__PURE__ */ React10.createElement("span", { className: `Layer__btn-content Layer__justify--${justify}` }, leftIcon && /* @__PURE__ */ React10.createElement(
974
+ /* @__PURE__ */ React11.createElement("span", { className: `Layer__btn-content Layer__justify--${justifyContent}` }, leftIcon && /* @__PURE__ */ React11.createElement(
923
975
  "span",
924
976
  {
925
977
  className: classNames(
@@ -928,7 +980,7 @@ var Button = ({
928
980
  )
929
981
  },
930
982
  leftIcon
931
- ), !iconOnly && /* @__PURE__ */ React10.createElement("span", { className: "Layer__btn-text" }, children), rightIcon && /* @__PURE__ */ React10.createElement(
983
+ ), !iconOnly && /* @__PURE__ */ React11.createElement("span", { className: "Layer__btn-text" }, children), rightIcon && /* @__PURE__ */ React11.createElement(
932
984
  "span",
933
985
  {
934
986
  className: classNames(
@@ -941,12 +993,30 @@ var Button = ({
941
993
  );
942
994
  };
943
995
 
944
- // src/components/Button/SubmitButton.tsx
945
- import React18 from "react";
996
+ // src/components/Button/IconButton.tsx
997
+ import React12 from "react";
998
+ import classNames2 from "classnames";
999
+ var IconButton = ({
1000
+ className,
1001
+ children,
1002
+ icon,
1003
+ active,
1004
+ ...props
1005
+ }) => {
1006
+ const baseClassName = classNames2(
1007
+ "Layer__icon-btn",
1008
+ `Layer__icon-btn--${active ? "active" : "inactive"}`,
1009
+ className
1010
+ );
1011
+ return /* @__PURE__ */ React12.createElement("button", { ...props, className: baseClassName }, icon);
1012
+ };
946
1013
 
947
- // src/icons/AlertCircle.tsx
948
- import * as React11 from "react";
949
- var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React11.createElement(
1014
+ // src/components/Button/RetryButton.tsx
1015
+ import React14 from "react";
1016
+
1017
+ // src/icons/RefreshCcw.tsx
1018
+ import * as React13 from "react";
1019
+ var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React13.createElement(
950
1020
  "svg",
951
1021
  {
952
1022
  viewBox: "0 0 18 18",
@@ -956,63 +1026,71 @@ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React11.createEle
956
1026
  width: size,
957
1027
  height: size
958
1028
  },
959
- /* @__PURE__ */ React11.createElement(
1029
+ /* @__PURE__ */ React13.createElement(
960
1030
  "path",
961
1031
  {
962
- d: "M9 16.5C13.1421 16.5 16.5 13.1421 16.5 9C16.5 4.85786 13.1421 1.5 9 1.5C4.85786 1.5 1.5 4.85786 1.5 9C1.5 13.1421 4.85786 16.5 9 16.5Z",
1032
+ d: "M0.75 3V7.5H5.25",
963
1033
  stroke: "currentColor",
964
1034
  strokeLinecap: "round",
965
1035
  strokeLinejoin: "round"
966
1036
  }
967
1037
  ),
968
- /* @__PURE__ */ React11.createElement(
1038
+ /* @__PURE__ */ React13.createElement(
969
1039
  "path",
970
1040
  {
971
- d: "M9 6V9",
1041
+ d: "M17.25 15V10.5H12.75",
972
1042
  stroke: "currentColor",
973
1043
  strokeLinecap: "round",
974
1044
  strokeLinejoin: "round"
975
1045
  }
976
1046
  ),
977
- /* @__PURE__ */ React11.createElement(
1047
+ /* @__PURE__ */ React13.createElement(
978
1048
  "path",
979
1049
  {
980
- d: "M9 12H9.0075",
1050
+ d: "M15.3675 6.75C14.9871 5.67508 14.3407 4.71405 13.4884 3.95656C12.6361 3.19907 11.6059 2.66982 10.4938 2.41819C9.38167 2.16656 8.22393 2.20075 7.12861 2.51758C6.03328 2.8344 5.03606 3.42353 4.23 4.23L0.75 7.5M17.25 10.5L13.77 13.77C12.9639 14.5765 11.9667 15.1656 10.8714 15.4824C9.77607 15.7992 8.61833 15.8334 7.50621 15.5818C6.3941 15.3302 5.36385 14.8009 4.5116 14.0434C3.65935 13.2859 3.01288 12.3249 2.6325 11.25",
981
1051
  stroke: "currentColor",
982
1052
  strokeLinecap: "round",
983
1053
  strokeLinejoin: "round"
984
1054
  }
985
1055
  )
986
1056
  );
987
- var AlertCircle_default = AlertCircle;
1057
+ var RefreshCcw_default = RefreshCcw;
988
1058
 
989
- // src/icons/Check.tsx
990
- import * as React12 from "react";
991
- var Check = ({ size = 18, ...props }) => /* @__PURE__ */ React12.createElement(
992
- "svg",
993
- {
994
- viewBox: "0 0 18 18",
995
- fill: "none",
996
- xmlns: "http://www.w3.org/2000/svg",
997
- ...props,
998
- width: size,
999
- height: size
1000
- },
1001
- /* @__PURE__ */ React12.createElement(
1002
- "path",
1059
+ // src/components/Button/RetryButton.tsx
1060
+ import classNames3 from "classnames";
1061
+ var RetryButton = ({
1062
+ className,
1063
+ processing,
1064
+ disabled,
1065
+ error,
1066
+ children,
1067
+ ...props
1068
+ }) => {
1069
+ const baseClassName = classNames3(
1070
+ "Layer__retry-btn",
1071
+ processing ? "Layer__btn--processing" : "",
1072
+ className
1073
+ );
1074
+ return /* @__PURE__ */ React14.createElement(
1075
+ Button,
1003
1076
  {
1004
- d: "M15 4.5L6.75 12.75L3 9",
1005
- stroke: "currentColor",
1006
- strokeLinecap: "round",
1007
- strokeLinejoin: "round"
1008
- }
1009
- )
1010
- );
1011
- var Check_default = Check;
1077
+ ...props,
1078
+ className: baseClassName,
1079
+ variant: "secondary" /* secondary */,
1080
+ disabled: processing || disabled,
1081
+ rightIcon: /* @__PURE__ */ React14.createElement(RefreshCcw_default, { size: 12 }),
1082
+ justify: "center"
1083
+ },
1084
+ children
1085
+ );
1086
+ };
1087
+
1088
+ // src/components/Button/SubmitButton.tsx
1089
+ import React20 from "react";
1012
1090
 
1013
1091
  // src/icons/CheckCircle.tsx
1014
- import * as React13 from "react";
1015
- var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React13.createElement(
1092
+ import * as React15 from "react";
1093
+ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
1016
1094
  "svg",
1017
1095
  {
1018
1096
  viewBox: "0 0 18 18",
@@ -1022,7 +1100,7 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React13.createEle
1022
1100
  width: size,
1023
1101
  height: size
1024
1102
  },
1025
- /* @__PURE__ */ React13.createElement(
1103
+ /* @__PURE__ */ React15.createElement(
1026
1104
  "path",
1027
1105
  {
1028
1106
  d: "M16.5 8.30999V8.99999C16.4991 10.6173 15.9754 12.191 15.007 13.4864C14.0386 14.7817 12.6775 15.7293 11.1265 16.1879C9.57557 16.6465 7.91794 16.5914 6.40085 16.0309C4.88375 15.4704 3.58848 14.4346 2.70821 13.0778C1.82794 11.721 1.40984 10.116 1.51625 8.50223C1.62266 6.88841 2.2479 5.35223 3.2987 4.12279C4.34951 2.89335 5.76958 2.03653 7.34713 1.6801C8.92469 1.32367 10.5752 1.48674 12.0525 2.14499",
@@ -1031,7 +1109,7 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React13.createEle
1031
1109
  strokeLinejoin: "round"
1032
1110
  }
1033
1111
  ),
1034
- /* @__PURE__ */ React13.createElement(
1112
+ /* @__PURE__ */ React15.createElement(
1035
1113
  "path",
1036
1114
  {
1037
1115
  d: "M16.5 3L9 10.5075L6.75 8.2575",
@@ -1044,8 +1122,8 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React13.createEle
1044
1122
  var CheckCircle_default = CheckCircle;
1045
1123
 
1046
1124
  // src/icons/Loader.tsx
1047
- import * as React14 from "react";
1048
- var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
1125
+ import * as React16 from "react";
1126
+ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React16.createElement(
1049
1127
  "svg",
1050
1128
  {
1051
1129
  viewBox: "0 0 18 18",
@@ -1055,7 +1133,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
1055
1133
  width: size,
1056
1134
  height: size
1057
1135
  },
1058
- /* @__PURE__ */ React14.createElement(
1136
+ /* @__PURE__ */ React16.createElement(
1059
1137
  "path",
1060
1138
  {
1061
1139
  d: "M9 1.5V4.5",
@@ -1064,7 +1142,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
1064
1142
  strokeLinejoin: "round"
1065
1143
  }
1066
1144
  ),
1067
- /* @__PURE__ */ React14.createElement(
1145
+ /* @__PURE__ */ React16.createElement(
1068
1146
  "path",
1069
1147
  {
1070
1148
  d: "M9 13.5V16.5",
@@ -1073,7 +1151,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
1073
1151
  strokeLinejoin: "round"
1074
1152
  }
1075
1153
  ),
1076
- /* @__PURE__ */ React14.createElement(
1154
+ /* @__PURE__ */ React16.createElement(
1077
1155
  "path",
1078
1156
  {
1079
1157
  d: "M3.6975 3.6975L5.82 5.82",
@@ -1082,7 +1160,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
1082
1160
  strokeLinejoin: "round"
1083
1161
  }
1084
1162
  ),
1085
- /* @__PURE__ */ React14.createElement(
1163
+ /* @__PURE__ */ React16.createElement(
1086
1164
  "path",
1087
1165
  {
1088
1166
  d: "M12.18 12.18L14.3025 14.3025",
@@ -1091,7 +1169,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
1091
1169
  strokeLinejoin: "round"
1092
1170
  }
1093
1171
  ),
1094
- /* @__PURE__ */ React14.createElement(
1172
+ /* @__PURE__ */ React16.createElement(
1095
1173
  "path",
1096
1174
  {
1097
1175
  d: "M1.5 9H4.5",
@@ -1100,7 +1178,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
1100
1178
  strokeLinejoin: "round"
1101
1179
  }
1102
1180
  ),
1103
- /* @__PURE__ */ React14.createElement(
1181
+ /* @__PURE__ */ React16.createElement(
1104
1182
  "path",
1105
1183
  {
1106
1184
  d: "M13.5 9H16.5",
@@ -1109,7 +1187,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
1109
1187
  strokeLinejoin: "round"
1110
1188
  }
1111
1189
  ),
1112
- /* @__PURE__ */ React14.createElement(
1190
+ /* @__PURE__ */ React16.createElement(
1113
1191
  "path",
1114
1192
  {
1115
1193
  d: "M3.6975 14.3025L5.82 12.18",
@@ -1118,7 +1196,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
1118
1196
  strokeLinejoin: "round"
1119
1197
  }
1120
1198
  ),
1121
- /* @__PURE__ */ React14.createElement(
1199
+ /* @__PURE__ */ React16.createElement(
1122
1200
  "path",
1123
1201
  {
1124
1202
  d: "M12.18 5.82L14.3025 3.6975",
@@ -1131,8 +1209,8 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
1131
1209
  var Loader_default = Loader;
1132
1210
 
1133
1211
  // src/icons/Save.tsx
1134
- import * as React15 from "react";
1135
- var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
1212
+ import * as React17 from "react";
1213
+ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React17.createElement(
1136
1214
  "svg",
1137
1215
  {
1138
1216
  xmlns: "http://www.w3.org/2000/svg",
@@ -1142,7 +1220,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
1142
1220
  width: size,
1143
1221
  height: size
1144
1222
  },
1145
- /* @__PURE__ */ React15.createElement(
1223
+ /* @__PURE__ */ React17.createElement(
1146
1224
  "path",
1147
1225
  {
1148
1226
  d: "M14.25 15.75H3.75C3.35218 15.75 2.97064 15.592 2.68934 15.3107C2.40804 15.0294 2.25 14.6478 2.25 14.25V3.75C2.25 3.35218 2.40804 2.97064 2.68934 2.68934C2.97064 2.40804 3.35218 2.25 3.75 2.25H12L15.75 6V14.25C15.75 14.6478 15.592 15.0294 15.3107 15.3107C15.0294 15.592 14.6478 15.75 14.25 15.75Z",
@@ -1151,7 +1229,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
1151
1229
  strokeLinejoin: "round"
1152
1230
  }
1153
1231
  ),
1154
- /* @__PURE__ */ React15.createElement(
1232
+ /* @__PURE__ */ React17.createElement(
1155
1233
  "path",
1156
1234
  {
1157
1235
  d: "M12.75 15.75V9.75H5.25V15.75",
@@ -1160,7 +1238,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
1160
1238
  strokeLinejoin: "round"
1161
1239
  }
1162
1240
  ),
1163
- /* @__PURE__ */ React15.createElement(
1241
+ /* @__PURE__ */ React17.createElement(
1164
1242
  "path",
1165
1243
  {
1166
1244
  d: "M5.25 2.25V6H11.25",
@@ -1173,14 +1251,14 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
1173
1251
  var Save_default = Save;
1174
1252
 
1175
1253
  // src/components/Tooltip/Tooltip.tsx
1176
- import React17, {
1254
+ import React19, {
1177
1255
  forwardRef,
1178
1256
  isValidElement,
1179
1257
  cloneElement
1180
1258
  } from "react";
1181
1259
 
1182
1260
  // src/components/Tooltip/useTooltip.ts
1183
- import React16, { useState as useState3 } from "react";
1261
+ import React18, { useState as useState3 } from "react";
1184
1262
  import {
1185
1263
  useFloating,
1186
1264
  autoUpdate,
@@ -1194,9 +1272,9 @@ import {
1194
1272
  useInteractions,
1195
1273
  useTransitionStyles
1196
1274
  } from "@floating-ui/react";
1197
- var TooltipContext = React16.createContext(null);
1275
+ var TooltipContext = React18.createContext(null);
1198
1276
  var useTooltipContext = () => {
1199
- const context = React16.useContext(TooltipContext);
1277
+ const context = React18.useContext(TooltipContext);
1200
1278
  if (context == null) {
1201
1279
  throw new Error("Tooltip components must be wrapped in <Tooltip />");
1202
1280
  }
@@ -1248,7 +1326,7 @@ var useTooltip = ({
1248
1326
  },
1249
1327
  duration: 300
1250
1328
  });
1251
- return React16.useMemo(
1329
+ return React18.useMemo(
1252
1330
  () => ({
1253
1331
  open,
1254
1332
  setOpen,
@@ -1269,7 +1347,7 @@ var Tooltip = ({
1269
1347
  ...options
1270
1348
  }) => {
1271
1349
  const tooltip = useTooltip(options);
1272
- return /* @__PURE__ */ React17.createElement(TooltipContext.Provider, { value: tooltip }, children);
1350
+ return /* @__PURE__ */ React19.createElement(TooltipContext.Provider, { value: tooltip }, children);
1273
1351
  };
1274
1352
  var TooltipTrigger = forwardRef(function TooltipTrigger2({ children, asChild = false, ...props }, propRef) {
1275
1353
  const context = useTooltipContext();
@@ -1286,7 +1364,7 @@ var TooltipTrigger = forwardRef(function TooltipTrigger2({ children, asChild = f
1286
1364
  })
1287
1365
  );
1288
1366
  }
1289
- return /* @__PURE__ */ React17.createElement(
1367
+ return /* @__PURE__ */ React19.createElement(
1290
1368
  "span",
1291
1369
  {
1292
1370
  ref,
@@ -1302,7 +1380,7 @@ var TooltipContent = forwardRef(function TooltipContent2({ style, className, ...
1302
1380
  const ref = useMergeRefs([context.refs.setFloating, propRef]);
1303
1381
  if (!context.open || context.disabled)
1304
1382
  return null;
1305
- return /* @__PURE__ */ React17.createElement(FloatingPortal, null, /* @__PURE__ */ React17.createElement(
1383
+ return /* @__PURE__ */ React19.createElement(FloatingPortal, null, /* @__PURE__ */ React19.createElement(
1306
1384
  "div",
1307
1385
  {
1308
1386
  ref,
@@ -1312,34 +1390,27 @@ var TooltipContent = forwardRef(function TooltipContent2({ style, className, ...
1312
1390
  },
1313
1391
  ...context.getFloatingProps(props)
1314
1392
  },
1315
- /* @__PURE__ */ React17.createElement("div", { className: "Layer__tooltip-content ", style: { ...context.styles } }, props.children)
1393
+ /* @__PURE__ */ React19.createElement("div", { className: "Layer__tooltip-content ", style: { ...context.styles } }, props.children)
1316
1394
  ));
1317
1395
  });
1318
1396
 
1319
1397
  // src/components/Button/SubmitButton.tsx
1320
- import classNames2 from "classnames";
1398
+ import classNames4 from "classnames";
1321
1399
  var buildRightIcon = ({
1322
1400
  processing,
1323
1401
  error,
1324
1402
  action
1325
1403
  }) => {
1326
1404
  if (processing) {
1327
- return /* @__PURE__ */ React18.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" });
1405
+ return /* @__PURE__ */ React20.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" });
1328
1406
  }
1329
1407
  if (error) {
1330
- return /* @__PURE__ */ React18.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ React18.createElement(TooltipTrigger, null, /* @__PURE__ */ React18.createElement(AlertCircle_default, { size: 14 })), /* @__PURE__ */ React18.createElement(TooltipContent, { className: "Layer__tooltip" }, error));
1408
+ return /* @__PURE__ */ React20.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ React20.createElement(TooltipTrigger, null, /* @__PURE__ */ React20.createElement(AlertCircle_default, { size: 14 })), /* @__PURE__ */ React20.createElement(TooltipContent, { className: "Layer__tooltip" }, error));
1331
1409
  }
1332
1410
  if (action === "update" /* UPDATE */) {
1333
- return /* @__PURE__ */ React18.createElement("span", { className: "Layer__pt-2" }, /* @__PURE__ */ React18.createElement(Save_default, { size: 14 }));
1411
+ return /* @__PURE__ */ React20.createElement("span", { className: "Layer__pt-2" }, /* @__PURE__ */ React20.createElement(Save_default, { size: 14 }));
1334
1412
  }
1335
- return /* @__PURE__ */ React18.createElement("span", null, /* @__PURE__ */ React18.createElement(Check_default, { className: "Layer__btn-icon--on-active", size: 14 }), /* @__PURE__ */ React18.createElement(
1336
- CheckCircle_default,
1337
- {
1338
- className: "Layer__btn-icon--on-inactive",
1339
- size: 14,
1340
- style: { paddingTop: 4 }
1341
- }
1342
- ));
1413
+ return /* @__PURE__ */ React20.createElement("span", null, /* @__PURE__ */ React20.createElement(CheckCircle_default, { size: 14, style: { paddingTop: 4 } }));
1343
1414
  };
1344
1415
  var SubmitButton = ({
1345
1416
  active,
@@ -1351,11 +1422,11 @@ var SubmitButton = ({
1351
1422
  action = "save" /* SAVE */,
1352
1423
  ...props
1353
1424
  }) => {
1354
- const baseClassName = classNames2(
1425
+ const baseClassName = classNames4(
1355
1426
  active ? "Layer__btn--active" : "",
1356
1427
  className
1357
1428
  );
1358
- return /* @__PURE__ */ React18.createElement(
1429
+ return /* @__PURE__ */ React20.createElement(
1359
1430
  Button,
1360
1431
  {
1361
1432
  ...props,
@@ -1369,38 +1440,20 @@ var SubmitButton = ({
1369
1440
  );
1370
1441
  };
1371
1442
 
1372
- // src/components/Button/IconButton.tsx
1373
- import React19 from "react";
1374
- import classNames3 from "classnames";
1375
- var IconButton = ({
1376
- className,
1377
- children,
1378
- icon,
1379
- active,
1380
- ...props
1381
- }) => {
1382
- const baseClassName = classNames3(
1383
- "Layer__icon-btn",
1384
- `Layer__icon-btn--${active ? "active" : "inactive"}`,
1385
- className
1386
- );
1387
- return /* @__PURE__ */ React19.createElement("button", { ...props, className: baseClassName }, icon);
1388
- };
1389
-
1390
1443
  // src/components/Button/TextButton.tsx
1391
- import React20 from "react";
1392
- import classNames4 from "classnames";
1444
+ import React21 from "react";
1445
+ import classNames5 from "classnames";
1393
1446
  var TextButton = ({
1394
1447
  className,
1395
1448
  children,
1396
1449
  ...props
1397
1450
  }) => {
1398
- const baseClassName = classNames4("Layer__text-btn", className);
1399
- return /* @__PURE__ */ React20.createElement("button", { ...props, className: baseClassName }, children);
1451
+ const baseClassName = classNames5("Layer__text-btn", className);
1452
+ return /* @__PURE__ */ React21.createElement("button", { ...props, className: baseClassName }, children);
1400
1453
  };
1401
1454
 
1402
1455
  // src/components/Badge/Badge.tsx
1403
- import classNames5 from "classnames";
1456
+ import classNames6 from "classnames";
1404
1457
  var Badge = ({
1405
1458
  icon,
1406
1459
  onClick,
@@ -1409,7 +1462,7 @@ var Badge = ({
1409
1462
  size = "medium" /* MEDIUM */
1410
1463
  }) => {
1411
1464
  const baseProps = {
1412
- className: classNames5(
1465
+ className: classNames6(
1413
1466
  "Layer__badge",
1414
1467
  onClick || tooltip ? "Layer__badge--clickable" : "",
1415
1468
  `Layer__badge--${size}`
@@ -1417,23 +1470,47 @@ var Badge = ({
1417
1470
  onClick,
1418
1471
  children
1419
1472
  };
1420
- let content = /* @__PURE__ */ React21.createElement(React21.Fragment, null, icon && /* @__PURE__ */ React21.createElement("span", { className: "Layer__badge__icon" }, icon), children);
1421
- content = onClick ? /* @__PURE__ */ React21.createElement(Button, { ...baseProps }, content) : /* @__PURE__ */ React21.createElement("span", { ...baseProps }, content);
1473
+ let content = /* @__PURE__ */ React22.createElement(React22.Fragment, null, icon && /* @__PURE__ */ React22.createElement("span", { className: "Layer__badge__icon" }, icon), children);
1474
+ content = onClick ? /* @__PURE__ */ React22.createElement(Button, { ...baseProps }, content) : /* @__PURE__ */ React22.createElement("span", { ...baseProps }, content);
1422
1475
  if (tooltip) {
1423
- return /* @__PURE__ */ React21.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ React21.createElement(TooltipTrigger, null, content), /* @__PURE__ */ React21.createElement(TooltipContent, { className: "Layer__tooltip" }, tooltip));
1476
+ return /* @__PURE__ */ React22.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ React22.createElement(TooltipTrigger, null, content), /* @__PURE__ */ React22.createElement(TooltipContent, { className: "Layer__tooltip" }, tooltip));
1424
1477
  }
1425
1478
  return content;
1426
1479
  };
1427
1480
 
1428
1481
  // src/components/CategorySelect/CategorySelect.tsx
1429
- import React23 from "react";
1482
+ import React25 from "react";
1430
1483
  import Select, {
1431
1484
  components
1432
1485
  } from "react-select";
1433
1486
 
1487
+ // src/icons/Check.tsx
1488
+ import * as React23 from "react";
1489
+ var Check = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createElement(
1490
+ "svg",
1491
+ {
1492
+ viewBox: "0 0 18 18",
1493
+ fill: "none",
1494
+ xmlns: "http://www.w3.org/2000/svg",
1495
+ ...props,
1496
+ width: size,
1497
+ height: size
1498
+ },
1499
+ /* @__PURE__ */ React23.createElement(
1500
+ "path",
1501
+ {
1502
+ d: "M15 4.5L6.75 12.75L3 9",
1503
+ stroke: "currentColor",
1504
+ strokeLinecap: "round",
1505
+ strokeLinejoin: "round"
1506
+ }
1507
+ )
1508
+ );
1509
+ var Check_default = Check;
1510
+
1434
1511
  // src/icons/MinimizeTwo.tsx
1435
- import * as React22 from "react";
1436
- var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createElement(
1512
+ import * as React24 from "react";
1513
+ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
1437
1514
  "svg",
1438
1515
  {
1439
1516
  xmlns: "http://www.w3.org/2000/svg",
@@ -1443,7 +1520,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
1443
1520
  width: size,
1444
1521
  height: size
1445
1522
  },
1446
- /* @__PURE__ */ React22.createElement(
1523
+ /* @__PURE__ */ React24.createElement(
1447
1524
  "path",
1448
1525
  {
1449
1526
  d: "M3 10.5H7.5V15",
@@ -1452,7 +1529,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
1452
1529
  strokeLinejoin: "round"
1453
1530
  }
1454
1531
  ),
1455
- /* @__PURE__ */ React22.createElement(
1532
+ /* @__PURE__ */ React24.createElement(
1456
1533
  "path",
1457
1534
  {
1458
1535
  d: "M15 7.5H10.5V3",
@@ -1461,7 +1538,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
1461
1538
  strokeLinejoin: "round"
1462
1539
  }
1463
1540
  ),
1464
- /* @__PURE__ */ React22.createElement(
1541
+ /* @__PURE__ */ React24.createElement(
1465
1542
  "path",
1466
1543
  {
1467
1544
  d: "M10.5 7.5L15.75 2.25",
@@ -1470,7 +1547,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
1470
1547
  strokeLinejoin: "round"
1471
1548
  }
1472
1549
  ),
1473
- /* @__PURE__ */ React22.createElement(
1550
+ /* @__PURE__ */ React24.createElement(
1474
1551
  "path",
1475
1552
  {
1476
1553
  d: "M2.25 15.75L7.5 10.5",
@@ -1483,7 +1560,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
1483
1560
  var MinimizeTwo_default = MinimizeTwo;
1484
1561
 
1485
1562
  // src/components/CategorySelect/CategorySelect.tsx
1486
- import classNames6 from "classnames";
1563
+ import classNames7 from "classnames";
1487
1564
  import { parseISO as parseISO2, format as formatTime } from "date-fns";
1488
1565
  var mapCategoryToOption = (category) => {
1489
1566
  return {
@@ -1511,13 +1588,13 @@ var mapSuggestedMatchToOption = (record) => {
1511
1588
  };
1512
1589
  };
1513
1590
  var DropdownIndicator = (props) => {
1514
- return /* @__PURE__ */ React23.createElement(components.DropdownIndicator, { ...props }, /* @__PURE__ */ React23.createElement(ChevronDown_default, null));
1591
+ return /* @__PURE__ */ React25.createElement(components.DropdownIndicator, { ...props }, /* @__PURE__ */ React25.createElement(ChevronDown_default, null));
1515
1592
  };
1516
1593
  var GroupHeading = (props) => {
1517
- return /* @__PURE__ */ React23.createElement(
1594
+ return /* @__PURE__ */ React25.createElement(
1518
1595
  components.GroupHeading,
1519
1596
  {
1520
- className: classNames6(
1597
+ className: classNames7(
1521
1598
  props.className,
1522
1599
  props.children === "Match" || props.children === "All categories" ? "Layer__select__group-heading--main" : ""
1523
1600
  ),
@@ -1530,24 +1607,24 @@ var Option = (props) => {
1530
1607
  return;
1531
1608
  }
1532
1609
  if (props.data.type === "match") {
1533
- return /* @__PURE__ */ React23.createElement(
1610
+ return /* @__PURE__ */ React25.createElement(
1534
1611
  components.Option,
1535
1612
  {
1536
1613
  ...props,
1537
1614
  className: `${props.className} Layer__select__option-content__match`
1538
1615
  },
1539
- /* @__PURE__ */ React23.createElement("div", { className: "Layer__select__option-content__match__main-row" }, /* @__PURE__ */ React23.createElement("span", { className: "Layer__select__option-content__match__date" }, props.data.payload.date && formatTime(parseISO2(props.data.payload.date), DATE_FORMAT)), /* @__PURE__ */ React23.createElement("span", { className: "Layer__select__option-content__match__description" }, props.data.payload.display_name)),
1540
- /* @__PURE__ */ React23.createElement("div", { className: "Layer__select__option-content__match__amount-row" }, /* @__PURE__ */ React23.createElement("span", { className: "Layer__select__option-content__match__amount" }, "$", centsToDollars(props.data.payload.amount)))
1616
+ /* @__PURE__ */ React25.createElement("div", { className: "Layer__select__option-content__match__main-row" }, /* @__PURE__ */ React25.createElement("span", { className: "Layer__select__option-content__match__date" }, props.data.payload.date && formatTime(parseISO2(props.data.payload.date), DATE_FORMAT)), /* @__PURE__ */ React25.createElement("span", { className: "Layer__select__option-content__match__description" }, props.data.payload.display_name)),
1617
+ /* @__PURE__ */ React25.createElement("div", { className: "Layer__select__option-content__match__amount-row" }, /* @__PURE__ */ React25.createElement("span", { className: "Layer__select__option-content__match__amount" }, "$", centsToDollars(props.data.payload.amount)))
1541
1618
  );
1542
1619
  }
1543
- return /* @__PURE__ */ React23.createElement(
1620
+ return /* @__PURE__ */ React25.createElement(
1544
1621
  components.Option,
1545
1622
  {
1546
1623
  ...props,
1547
1624
  className: `Layer__select__option-menu-content ${props.className}`
1548
1625
  },
1549
- /* @__PURE__ */ React23.createElement("div", null, props.data.payload.display_name),
1550
- props.isSelected ? /* @__PURE__ */ React23.createElement("span", { className: "Layer__select__option-menu-content-check" }, /* @__PURE__ */ React23.createElement(Check_default, { size: 16 })) : null
1626
+ /* @__PURE__ */ React25.createElement("div", null, props.data.payload.display_name),
1627
+ props.isSelected ? /* @__PURE__ */ React25.createElement("span", { className: "Layer__select__option-menu-content-check" }, /* @__PURE__ */ React25.createElement(Check_default, { size: 16 })) : null
1551
1628
  );
1552
1629
  };
1553
1630
  var allCategoriesDivider = [
@@ -1630,7 +1707,7 @@ var CategorySelect = ({
1630
1707
  ];
1631
1708
  const selected = value ? value : matchOptions?.length === 1 && matchOptions[0].options.length === 1 ? matchOptions[0].options[0] : void 0;
1632
1709
  const placeholder = matchOptions?.length === 1 && matchOptions[0].options.length > 1 ? `${matchOptions[0].options.length} possible matches...` : "Categorize or match...";
1633
- return /* @__PURE__ */ React23.createElement(
1710
+ return /* @__PURE__ */ React25.createElement(
1634
1711
  Select,
1635
1712
  {
1636
1713
  name,
@@ -1640,7 +1717,7 @@ var CategorySelect = ({
1640
1717
  isSearchable: true,
1641
1718
  placeholder,
1642
1719
  defaultValue: selected,
1643
- formatOptionLabel: (props) => /* @__PURE__ */ React23.createElement("div", { className: "Layer__select__option-label" }, props.type === "match" && /* @__PURE__ */ React23.createElement(Badge, { size: "small" /* SMALL */, icon: /* @__PURE__ */ React23.createElement(MinimizeTwo_default, { size: 11 }) }, "Match"), /* @__PURE__ */ React23.createElement("span", null, props.payload.display_name)),
1720
+ formatOptionLabel: (props) => /* @__PURE__ */ React25.createElement("div", { className: "Layer__select__option-label" }, props.type === "match" && /* @__PURE__ */ React25.createElement(Badge, { size: "small" /* SMALL */, icon: /* @__PURE__ */ React25.createElement(MinimizeTwo_default, { size: 11 }) }, "Match"), /* @__PURE__ */ React25.createElement("span", null, props.payload.display_name)),
1644
1721
  value,
1645
1722
  onChange: (newValue) => newValue && onChange(newValue),
1646
1723
  getOptionLabel: (category) => category.payload.display_name,
@@ -1657,55 +1734,134 @@ var CategorySelect = ({
1657
1734
  };
1658
1735
 
1659
1736
  // src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
1660
- import React36, {
1737
+ import React42, {
1661
1738
  forwardRef as forwardRef2,
1662
1739
  useImperativeHandle,
1663
- useState as useState6,
1740
+ useState as useState7,
1664
1741
  useCallback,
1665
- useEffect as useEffect3,
1742
+ useEffect as useEffect4,
1666
1743
  useRef as useRef9
1667
1744
  } from "react";
1668
1745
 
1669
- // src/icons/Link.tsx
1670
- import * as React24 from "react";
1671
- var Link = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
1746
+ // src/icons/ScissorsFullOpen.tsx
1747
+ import * as React26 from "react";
1748
+ var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.createElement(
1672
1749
  "svg",
1673
1750
  {
1674
- xmlns: "http://www.w3.org/2000/svg",
1675
- viewBox: "0 0 18 18",
1751
+ viewBox: "0 0 12 12",
1676
1752
  fill: "none",
1753
+ xmlns: "http://www.w3.org/2000/svg",
1677
1754
  ...props,
1678
1755
  width: size,
1679
1756
  height: size
1680
1757
  },
1681
- /* @__PURE__ */ React24.createElement(
1758
+ /* @__PURE__ */ React26.createElement("g", { id: "scissors" }, /* @__PURE__ */ React26.createElement(
1682
1759
  "path",
1683
1760
  {
1684
- d: "M7.5 9.75C7.82209 10.1806 8.23302 10.5369 8.70491 10.7947C9.17681 11.0525 9.69863 11.2058 10.235 11.2442C10.7713 11.2827 11.3097 11.2053 11.8135 11.0173C12.3173 10.8294 12.7748 10.5353 13.155 10.155L15.405 7.905C16.0881 7.19774 16.4661 6.25048 16.4575 5.26724C16.449 4.284 16.0546 3.34346 15.3593 2.64818C14.664 1.9529 13.7235 1.55851 12.7403 1.54997C11.757 1.54143 10.8098 1.9194 10.1025 2.6025L8.8125 3.885",
1761
+ id: "Vector",
1762
+ d: "M3 4.5C3.82843 4.5 4.5 3.82843 4.5 3C4.5 2.17157 3.82843 1.5 3 1.5C2.17157 1.5 1.5 2.17157 1.5 3C1.5 3.82843 2.17157 4.5 3 4.5Z",
1763
+ stroke: "currentColor",
1764
+ strokeLinecap: "round",
1765
+ strokeLinejoin: "round"
1766
+ }
1767
+ ), /* @__PURE__ */ React26.createElement(
1768
+ "path",
1769
+ {
1770
+ id: "Vector_2",
1771
+ d: "M3 10.5C3.82843 10.5 4.5 9.82843 4.5 9C4.5 8.17157 3.82843 7.5 3 7.5C2.17157 7.5 1.5 8.17157 1.5 9C1.5 9.82843 2.17157 10.5 3 10.5Z",
1772
+ stroke: "currentColor",
1773
+ strokeLinecap: "round",
1774
+ strokeLinejoin: "round"
1775
+ }
1776
+ ), /* @__PURE__ */ React26.createElement(
1777
+ "path",
1778
+ {
1779
+ id: "Vector_3",
1780
+ d: "M10 2L4.06 7.94",
1781
+ stroke: "currentColor",
1782
+ strokeLinecap: "round",
1783
+ strokeLinejoin: "round"
1784
+ }
1785
+ ), /* @__PURE__ */ React26.createElement(
1786
+ "path",
1787
+ {
1788
+ id: "Vector_4",
1789
+ d: "M7.235 7.23999L10 9.99999",
1790
+ stroke: "currentColor",
1791
+ strokeLinecap: "round",
1792
+ strokeLinejoin: "round"
1793
+ }
1794
+ ), /* @__PURE__ */ React26.createElement(
1795
+ "path",
1796
+ {
1797
+ id: "Vector_5",
1798
+ d: "M4.06 4.06006L6 6.00006",
1799
+ stroke: "currentColor",
1800
+ strokeLinecap: "round",
1801
+ strokeLinejoin: "round"
1802
+ }
1803
+ ))
1804
+ );
1805
+ var ScissorsFullOpen_default = ScissorsFullOpen;
1806
+
1807
+ // src/icons/Trash.tsx
1808
+ import * as React27 from "react";
1809
+ var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
1810
+ "svg",
1811
+ {
1812
+ xmlns: "http://www.w3.org/2000/svg",
1813
+ viewBox: "0 0 18 18",
1814
+ fill: "none",
1815
+ ...props,
1816
+ width: size,
1817
+ height: size
1818
+ },
1819
+ /* @__PURE__ */ React27.createElement(
1820
+ "path",
1821
+ {
1822
+ d: "M2.25 4.5H3.75H15.75",
1685
1823
  stroke: "currentColor",
1686
1824
  strokeLinecap: "round",
1687
1825
  strokeLinejoin: "round"
1688
1826
  }
1689
1827
  ),
1690
- /* @__PURE__ */ React24.createElement(
1828
+ /* @__PURE__ */ React27.createElement(
1691
1829
  "path",
1692
1830
  {
1693
- d: "M10.5 8.25C10.1779 7.8194 9.76698 7.46311 9.29508 7.2053C8.82319 6.94748 8.30137 6.79416 7.76501 6.75575C7.22865 6.71734 6.69031 6.79473 6.18649 6.98266C5.68267 7.1706 5.22516 7.4647 4.845 7.845L2.595 10.095C1.9119 10.8023 1.53393 11.7495 1.54247 12.7328C1.55101 13.716 1.9454 14.6565 2.64068 15.3518C3.33596 16.0471 4.2765 16.4415 5.25974 16.45C6.24298 16.4586 7.19024 16.0806 7.8975 15.3975L9.18 14.115",
1831
+ d: "M14.25 4.5V15C14.25 15.3978 14.092 15.7794 13.8107 16.0607C13.5294 16.342 13.1478 16.5 12.75 16.5H5.25C4.85218 16.5 4.47064 16.342 4.18934 16.0607C3.90804 15.7794 3.75 15.3978 3.75 15V4.5M6 4.5V3C6 2.60218 6.15804 2.22064 6.43934 1.93934C6.72064 1.65804 7.10218 1.5 7.5 1.5H10.5C10.8978 1.5 11.2794 1.65804 11.5607 1.93934C11.842 2.22064 12 2.60218 12 3V4.5",
1832
+ stroke: "currentColor",
1833
+ strokeLinecap: "round",
1834
+ strokeLinejoin: "round"
1835
+ }
1836
+ ),
1837
+ /* @__PURE__ */ React27.createElement(
1838
+ "path",
1839
+ {
1840
+ d: "M7.5 8.25V12.75",
1841
+ stroke: "currentColor",
1842
+ strokeLinecap: "round",
1843
+ strokeLinejoin: "round"
1844
+ }
1845
+ ),
1846
+ /* @__PURE__ */ React27.createElement(
1847
+ "path",
1848
+ {
1849
+ d: "M10.5 8.25V12.75",
1694
1850
  stroke: "currentColor",
1695
1851
  strokeLinecap: "round",
1696
1852
  strokeLinejoin: "round"
1697
1853
  }
1698
1854
  )
1699
1855
  );
1700
- var Link_default = Link;
1856
+ var Trash_default = Trash;
1701
1857
 
1702
1858
  // src/components/CategoryMenu/CategoryMenu.tsx
1703
- import React25 from "react";
1859
+ import React28 from "react";
1704
1860
  import Select2, {
1705
1861
  components as components2
1706
1862
  } from "react-select";
1707
1863
  var DropdownIndicator2 = (props) => {
1708
- return /* @__PURE__ */ React25.createElement(components2.DropdownIndicator, { ...props }, /* @__PURE__ */ React25.createElement(ChevronDown_default, null));
1864
+ return /* @__PURE__ */ React28.createElement(components2.DropdownIndicator, { ...props }, /* @__PURE__ */ React28.createElement(ChevronDown_default, null));
1709
1865
  };
1710
1866
  var CategoryMenu = ({
1711
1867
  bankTransaction,
@@ -1735,7 +1891,7 @@ var CategoryMenu = ({
1735
1891
  };
1736
1892
  }).filter((x) => x);
1737
1893
  const options = [...suggestedOptions, ...categoryOptions];
1738
- return /* @__PURE__ */ React25.createElement(
1894
+ return /* @__PURE__ */ React28.createElement(
1739
1895
  Select2,
1740
1896
  {
1741
1897
  name,
@@ -1756,28 +1912,30 @@ var CategoryMenu = ({
1756
1912
  };
1757
1913
 
1758
1914
  // src/components/Input/Input.tsx
1759
- import React26 from "react";
1760
- import classNames7 from "classnames";
1915
+ import React29 from "react";
1916
+ import classNames8 from "classnames";
1761
1917
  var Input = ({
1762
1918
  className,
1763
1919
  isInvalid,
1764
1920
  errorMessage,
1921
+ leftText,
1765
1922
  ...props
1766
1923
  }) => {
1767
- const baseClassName = classNames7(
1924
+ const baseClassName = classNames8(
1768
1925
  "Layer__input",
1769
1926
  isInvalid ? "Layer__input--error" : "",
1927
+ leftText ? "Layer__input--with-left-text" : "",
1770
1928
  className
1771
1929
  );
1772
- return /* @__PURE__ */ React26.createElement(Tooltip, { disabled: !isInvalid || !errorMessage }, /* @__PURE__ */ React26.createElement(TooltipTrigger, { className: "Layer__input-tooltip" }, /* @__PURE__ */ React26.createElement("input", { ...props, className: baseClassName })), /* @__PURE__ */ React26.createElement(TooltipContent, { className: "Layer__tooltip" }, errorMessage));
1930
+ return /* @__PURE__ */ React29.createElement(Tooltip, { disabled: !isInvalid || !errorMessage }, /* @__PURE__ */ React29.createElement(TooltipTrigger, { className: "Layer__input-tooltip" }, /* @__PURE__ */ React29.createElement("input", { ...props, className: baseClassName }), leftText && /* @__PURE__ */ React29.createElement("span", { className: "Layer__input-left-text" }, leftText)), /* @__PURE__ */ React29.createElement(TooltipContent, { className: "Layer__tooltip" }, errorMessage));
1773
1931
  };
1774
1932
 
1775
1933
  // src/components/Input/InputGroup.tsx
1776
- import React29 from "react";
1934
+ import React33 from "react";
1777
1935
 
1778
1936
  // src/components/Typography/Text.tsx
1779
- import React27, { useRef as useRef6, useState as useState4, useEffect } from "react";
1780
- import classNames8 from "classnames";
1937
+ import React30, { useRef as useRef6, useState as useState4, useEffect } from "react";
1938
+ import classNames9 from "classnames";
1781
1939
  var Text = ({
1782
1940
  as: Component = "p",
1783
1941
  className,
@@ -1787,12 +1945,12 @@ var Text = ({
1787
1945
  withTooltip,
1788
1946
  ...props
1789
1947
  }) => {
1790
- const baseClassName = classNames8(
1948
+ const baseClassName = classNames9(
1791
1949
  `Layer__text Layer__text--${size} Layer__text--${weight}`,
1792
1950
  className
1793
1951
  );
1794
1952
  if (withTooltip) {
1795
- return /* @__PURE__ */ React27.createElement(
1953
+ return /* @__PURE__ */ React30.createElement(
1796
1954
  TextWithTooltip,
1797
1955
  {
1798
1956
  as: Component,
@@ -1805,7 +1963,7 @@ var Text = ({
1805
1963
  children
1806
1964
  );
1807
1965
  }
1808
- return /* @__PURE__ */ React27.createElement(Component, { ...props, className: baseClassName }, children);
1966
+ return /* @__PURE__ */ React30.createElement(Component, { ...props, className: baseClassName }, children);
1809
1967
  };
1810
1968
  var TextWithTooltip = ({
1811
1969
  as: Component = "p",
@@ -1835,48 +1993,56 @@ var TextWithTooltip = ({
1835
1993
  []
1836
1994
  );
1837
1995
  const [hoverStatus, setHover] = useState4(false);
1838
- const contentClassName = classNames8(
1996
+ const contentClassName = classNames9(
1839
1997
  "Layer__tooltip",
1840
1998
  tooltipOptions?.contentClassName
1841
1999
  );
1842
- return /* @__PURE__ */ React27.createElement(
2000
+ return /* @__PURE__ */ React30.createElement(
1843
2001
  Tooltip,
1844
2002
  {
1845
2003
  disabled: !hoverStatus,
1846
2004
  offset: tooltipOptions?.offset,
1847
2005
  shift: tooltipOptions?.shift
1848
2006
  },
1849
- /* @__PURE__ */ React27.createElement(TooltipTrigger, null, /* @__PURE__ */ React27.createElement(Component, { className, ref: textElementRef, ...props }, children)),
1850
- /* @__PURE__ */ React27.createElement(TooltipContent, { className: contentClassName }, children)
2007
+ /* @__PURE__ */ React30.createElement(TooltipTrigger, null, /* @__PURE__ */ React30.createElement(Component, { className, ref: textElementRef, ...props }, children)),
2008
+ /* @__PURE__ */ React30.createElement(TooltipContent, { className: contentClassName }, children)
1851
2009
  );
1852
2010
  };
1853
2011
 
1854
2012
  // src/components/Typography/Heading.tsx
1855
- import React28 from "react";
1856
- import classNames9 from "classnames";
2013
+ import React31 from "react";
2014
+ import classNames10 from "classnames";
1857
2015
  var Heading = ({
1858
2016
  as: Component = "h2",
1859
2017
  className,
1860
2018
  children,
1861
2019
  size = "primary" /* primary */
1862
2020
  }) => {
1863
- const baseClassName = classNames9(
2021
+ const baseClassName = classNames10(
1864
2022
  `Layer__heading Layer__heading--${size}`,
1865
2023
  className
1866
2024
  );
1867
- return /* @__PURE__ */ React28.createElement(Component, { className: baseClassName }, children);
2025
+ return /* @__PURE__ */ React31.createElement(Component, { className: baseClassName }, children);
2026
+ };
2027
+
2028
+ // src/components/Typography/ErrorText.tsx
2029
+ import React32 from "react";
2030
+ import classNames11 from "classnames";
2031
+ var ErrorText = ({ className, ...props }) => {
2032
+ const baseClassName = classNames11("Layer__text--error", className);
2033
+ return /* @__PURE__ */ React32.createElement(Text, { ...props, className: baseClassName });
1868
2034
  };
1869
2035
 
1870
2036
  // src/components/Input/InputGroup.tsx
1871
- import classNames10 from "classnames";
2037
+ import classNames12 from "classnames";
1872
2038
  var InputGroup = ({
1873
2039
  label,
1874
2040
  name,
1875
2041
  className,
1876
2042
  children
1877
2043
  }) => {
1878
- const baseClassName = classNames10("Layer__input-group", className);
1879
- return /* @__PURE__ */ React29.createElement("div", { className: baseClassName }, label && /* @__PURE__ */ React29.createElement(
2044
+ const baseClassName = classNames12("Layer__input-group", className);
2045
+ return /* @__PURE__ */ React33.createElement("div", { className: baseClassName }, label && /* @__PURE__ */ React33.createElement(
1880
2046
  Text,
1881
2047
  {
1882
2048
  as: "label",
@@ -1889,11 +2055,11 @@ var InputGroup = ({
1889
2055
  };
1890
2056
 
1891
2057
  // src/components/Input/FileInput.tsx
1892
- import React31, { useRef as useRef7 } from "react";
2058
+ import React35, { useRef as useRef7 } from "react";
1893
2059
 
1894
2060
  // src/icons/UploadCloud.tsx
1895
- import * as React30 from "react";
1896
- var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React30.createElement(
2061
+ import * as React34 from "react";
2062
+ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React34.createElement(
1897
2063
  "svg",
1898
2064
  {
1899
2065
  viewBox: "0 0 18 18",
@@ -1903,7 +2069,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React30.createEle
1903
2069
  width: size,
1904
2070
  height: size
1905
2071
  },
1906
- /* @__PURE__ */ React30.createElement(
2072
+ /* @__PURE__ */ React34.createElement(
1907
2073
  "path",
1908
2074
  {
1909
2075
  d: "M12 12L9 9L6 12",
@@ -1912,7 +2078,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React30.createEle
1912
2078
  strokeLinejoin: "round"
1913
2079
  }
1914
2080
  ),
1915
- /* @__PURE__ */ React30.createElement(
2081
+ /* @__PURE__ */ React34.createElement(
1916
2082
  "path",
1917
2083
  {
1918
2084
  d: "M9 9V15.75",
@@ -1921,7 +2087,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React30.createEle
1921
2087
  strokeLinejoin: "round"
1922
2088
  }
1923
2089
  ),
1924
- /* @__PURE__ */ React30.createElement(
2090
+ /* @__PURE__ */ React34.createElement(
1925
2091
  "path",
1926
2092
  {
1927
2093
  d: "M15.2925 13.7925C16.024 13.3937 16.6019 12.7626 16.9349 11.999C17.2679 11.2353 17.3372 10.3824 17.1317 9.57501C16.9262 8.7676 16.4576 8.05162 15.8 7.54007C15.1424 7.02852 14.3332 6.75054 13.5 6.74999H12.555C12.328 5.87192 11.9049 5.05674 11.3175 4.36573C10.7301 3.67473 9.99364 3.12588 9.16358 2.76044C8.33352 2.39501 7.43141 2.22251 6.52509 2.2559C5.61876 2.28929 4.7318 2.52771 3.93088 2.95324C3.12997 3.37876 2.43593 3.98032 1.90097 4.71267C1.366 5.44503 1.00402 6.28914 0.842236 7.18153C0.680453 8.07393 0.72308 8.99139 0.966911 9.86493C1.21074 10.7385 1.64943 11.5454 2.25 12.225",
@@ -1930,7 +2096,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React30.createEle
1930
2096
  strokeLinejoin: "round"
1931
2097
  }
1932
2098
  ),
1933
- /* @__PURE__ */ React30.createElement(
2099
+ /* @__PURE__ */ React34.createElement(
1934
2100
  "path",
1935
2101
  {
1936
2102
  d: "M12 12L9 9L6 12",
@@ -1956,15 +2122,15 @@ var FileInput = ({ text = "Upload", onUpload }) => {
1956
2122
  onUpload(fileUploaded);
1957
2123
  }
1958
2124
  };
1959
- return /* @__PURE__ */ React31.createElement(React31.Fragment, null, /* @__PURE__ */ React31.createElement(
2125
+ return /* @__PURE__ */ React35.createElement(React35.Fragment, null, /* @__PURE__ */ React35.createElement(
1960
2126
  Button,
1961
2127
  {
1962
2128
  onClick,
1963
2129
  variant: "secondary" /* secondary */,
1964
- rightIcon: /* @__PURE__ */ React31.createElement(UploadCloud_default, null)
2130
+ rightIcon: /* @__PURE__ */ React35.createElement(UploadCloud_default, null)
1965
2131
  },
1966
2132
  text
1967
- ), /* @__PURE__ */ React31.createElement(
2133
+ ), /* @__PURE__ */ React35.createElement(
1968
2134
  "input",
1969
2135
  {
1970
2136
  type: "file",
@@ -1976,10 +2142,10 @@ var FileInput = ({ text = "Upload", onUpload }) => {
1976
2142
  };
1977
2143
 
1978
2144
  // src/components/MatchForm/MatchForm.tsx
1979
- import React33 from "react";
2145
+ import React37 from "react";
1980
2146
 
1981
2147
  // src/components/BankTransactionRow/MatchBadge.tsx
1982
- import React32 from "react";
2148
+ import React36 from "react";
1983
2149
  import { parseISO as parseISO3, format as formatTime2 } from "date-fns";
1984
2150
  var MatchBadge = ({
1985
2151
  bankTransaction,
@@ -1989,11 +2155,11 @@ var MatchBadge = ({
1989
2155
  }) => {
1990
2156
  if (bankTransaction.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction.match) {
1991
2157
  const { date, amount, description } = bankTransaction.match.bank_transaction;
1992
- return /* @__PURE__ */ React32.createElement(
2158
+ return /* @__PURE__ */ React36.createElement(
1993
2159
  Badge,
1994
2160
  {
1995
- icon: /* @__PURE__ */ React32.createElement(MinimizeTwo_default, { size: 11 }),
1996
- tooltip: /* @__PURE__ */ React32.createElement("span", { className: `${classNamePrefix}__match-tooltip` }, /* @__PURE__ */ React32.createElement("div", { className: `${classNamePrefix}__match-tooltip__date` }, formatTime2(parseISO3(date), dateFormat)), /* @__PURE__ */ React32.createElement("div", { className: `${classNamePrefix}__match-tooltip__description` }, description), /* @__PURE__ */ React32.createElement("div", { className: `${classNamePrefix}__match-tooltip__amount` }, "$", centsToDollars(amount)))
2161
+ icon: /* @__PURE__ */ React36.createElement(MinimizeTwo_default, { size: 11 }),
2162
+ tooltip: /* @__PURE__ */ React36.createElement("span", { className: `${classNamePrefix}__match-tooltip` }, /* @__PURE__ */ React36.createElement("div", { className: `${classNamePrefix}__match-tooltip__date` }, formatTime2(parseISO3(date), dateFormat)), /* @__PURE__ */ React36.createElement("div", { className: `${classNamePrefix}__match-tooltip__description` }, description), /* @__PURE__ */ React36.createElement("div", { className: `${classNamePrefix}__match-tooltip__amount` }, "$", centsToDollars(amount)))
1997
2163
  },
1998
2164
  text
1999
2165
  );
@@ -2002,20 +2168,26 @@ var MatchBadge = ({
2002
2168
  };
2003
2169
 
2004
2170
  // src/components/MatchForm/MatchForm.tsx
2005
- import classNames11 from "classnames";
2171
+ import classNames13 from "classnames";
2006
2172
  import { parseISO as parseISO4, format as formatTime3 } from "date-fns";
2007
2173
  var MatchForm = ({
2008
2174
  classNamePrefix,
2009
2175
  bankTransaction,
2010
2176
  selectedMatchId,
2011
- setSelectedMatchId
2177
+ setSelectedMatchId,
2178
+ matchFormError
2012
2179
  }) => {
2013
- return /* @__PURE__ */ React33.createElement("div", { className: `${classNamePrefix}__match-table` }, /* @__PURE__ */ React33.createElement("div", { className: `${classNamePrefix}__match-table__header` }, /* @__PURE__ */ React33.createElement("div", { className: `${classNamePrefix}__match-table__date` }, "Date"), /* @__PURE__ */ React33.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, "Description"), /* @__PURE__ */ React33.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "Amount"), /* @__PURE__ */ React33.createElement("div", { className: `${classNamePrefix}__match-table__status` })), bankTransaction.suggested_matches?.map((match, idx) => {
2014
- return /* @__PURE__ */ React33.createElement(
2180
+ return /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table` }, /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__header` }, /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__date` }, "Date"), /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, "Description"), /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "Amount"), /* @__PURE__ */ React37.createElement(
2181
+ "div",
2182
+ {
2183
+ className: `${classNamePrefix}__match-table__status ${bankTransaction.match ? "" : "no-match"}`
2184
+ }
2185
+ )), bankTransaction.suggested_matches?.map((match, idx) => {
2186
+ return /* @__PURE__ */ React37.createElement(
2015
2187
  "div",
2016
2188
  {
2017
2189
  key: idx,
2018
- className: classNames11(
2190
+ className: classNames13(
2019
2191
  `${classNamePrefix}__match-row`,
2020
2192
  match.id === selectedMatchId ? `${classNamePrefix}__match-row--selected` : ""
2021
2193
  ),
@@ -2027,14 +2199,15 @@ var MatchForm = ({
2027
2199
  setSelectedMatchId(match.id);
2028
2200
  }
2029
2201
  },
2030
- /* @__PURE__ */ React33.createElement(
2202
+ /* @__PURE__ */ React37.createElement(
2031
2203
  "div",
2032
2204
  {
2033
2205
  className: `Layer__nowrap ${classNamePrefix}__match-table__date`
2034
2206
  },
2035
- formatTime3(parseISO4(match.details.date), DATE_FORMAT)
2207
+ /* @__PURE__ */ React37.createElement("span", null, formatTime3(parseISO4(match.details.date), DATE_FORMAT)),
2208
+ /* @__PURE__ */ React37.createElement("span", { className: "amount-next-to-date" }, "$", centsToDollars(match.details.amount))
2036
2209
  ),
2037
- /* @__PURE__ */ React33.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, /* @__PURE__ */ React33.createElement(
2210
+ /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, /* @__PURE__ */ React37.createElement(
2038
2211
  Text,
2039
2212
  {
2040
2213
  className: `${classNamePrefix}__match-table__desc-tooltip`,
@@ -2042,9 +2215,7 @@ var MatchForm = ({
2042
2215
  as: "span"
2043
2216
  },
2044
2217
  match.details.description
2045
- )),
2046
- /* @__PURE__ */ React33.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "$", centsToDollars(match.details.amount)),
2047
- /* @__PURE__ */ React33.createElement("div", { className: `${classNamePrefix}__match-table__status` }, match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ React33.createElement(
2218
+ ), match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ React37.createElement("span", { className: "match-badge" }, /* @__PURE__ */ React37.createElement(
2048
2219
  MatchBadge,
2049
2220
  {
2050
2221
  classNamePrefix,
@@ -2052,28 +2223,44 @@ var MatchForm = ({
2052
2223
  dateFormat: DATE_FORMAT,
2053
2224
  text: "Matched"
2054
2225
  }
2055
- ))
2226
+ ))),
2227
+ /* @__PURE__ */ React37.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "$", centsToDollars(match.details.amount)),
2228
+ /* @__PURE__ */ React37.createElement(
2229
+ "div",
2230
+ {
2231
+ className: `${classNamePrefix}__match-table__status ${bankTransaction.match ? "" : "no-match"}`
2232
+ },
2233
+ match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ React37.createElement(
2234
+ MatchBadge,
2235
+ {
2236
+ classNamePrefix,
2237
+ bankTransaction,
2238
+ dateFormat: DATE_FORMAT,
2239
+ text: "Matched"
2240
+ }
2241
+ )
2242
+ )
2056
2243
  );
2057
- }));
2244
+ }), matchFormError && /* @__PURE__ */ React37.createElement(ErrorText, null, matchFormError));
2058
2245
  };
2059
2246
 
2060
2247
  // src/components/Textarea/Textarea.tsx
2061
- import React34 from "react";
2062
- import classNames12 from "classnames";
2248
+ import React38 from "react";
2249
+ import classNames14 from "classnames";
2063
2250
  var Textarea = ({
2064
2251
  className,
2065
2252
  ...props
2066
2253
  }) => {
2067
- const baseClassName = classNames12("Layer__textarea", className);
2068
- return /* @__PURE__ */ React34.createElement("textarea", { ...props, className: baseClassName });
2254
+ const baseClassName = classNames14("Layer__textarea", className);
2255
+ return /* @__PURE__ */ React38.createElement("textarea", { ...props, className: baseClassName });
2069
2256
  };
2070
2257
 
2071
2258
  // src/components/Toggle/Toggle.tsx
2072
- import React35, {
2259
+ import React39, {
2073
2260
  useEffect as useEffect2,
2074
2261
  useState as useState5
2075
2262
  } from "react";
2076
- import classNames13 from "classnames";
2263
+ import classNames15 from "classnames";
2077
2264
  var Toggle = ({
2078
2265
  name,
2079
2266
  options,
@@ -2090,7 +2277,7 @@ var Toggle = ({
2090
2277
  }
2091
2278
  });
2092
2279
  const selectedValue = selected || options[0].value;
2093
- const baseClassName = classNames13(
2280
+ const baseClassName = classNames15(
2094
2281
  "Layer__toggle",
2095
2282
  `Layer__toggle--${size}`,
2096
2283
  initialized ? "Layer__toggle--initialized" : ""
@@ -2138,7 +2325,7 @@ var Toggle = ({
2138
2325
  }
2139
2326
  return selectedIndex;
2140
2327
  };
2141
- return /* @__PURE__ */ React35.createElement("div", { className: baseClassName, ref: toggleRef }, options.map((option, index) => /* @__PURE__ */ React35.createElement(
2328
+ return /* @__PURE__ */ React39.createElement("div", { className: baseClassName, ref: toggleRef }, options.map((option, index) => /* @__PURE__ */ React39.createElement(
2142
2329
  ToggleOption,
2143
2330
  {
2144
2331
  ...option,
@@ -2150,7 +2337,7 @@ var Toggle = ({
2150
2337
  disabled: option.disabled ?? false,
2151
2338
  index
2152
2339
  }
2153
- )), /* @__PURE__ */ React35.createElement("span", { className: "Layer__toggle__thumb", style: { ...thumbPos } }));
2340
+ )), /* @__PURE__ */ React39.createElement("span", { className: "Layer__toggle__thumb", style: { ...thumbPos } }));
2154
2341
  };
2155
2342
  var ToggleOption = ({
2156
2343
  checked,
@@ -2163,7 +2350,21 @@ var ToggleOption = ({
2163
2350
  disabled,
2164
2351
  index
2165
2352
  }) => {
2166
- return /* @__PURE__ */ React35.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ React35.createElement(
2353
+ if (disabled) {
2354
+ return /* @__PURE__ */ React39.createElement(Tooltip, null, /* @__PURE__ */ React39.createElement(TooltipTrigger, null, /* @__PURE__ */ React39.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ React39.createElement(
2355
+ "input",
2356
+ {
2357
+ type: "radio",
2358
+ checked,
2359
+ name,
2360
+ onChange,
2361
+ value,
2362
+ disabled: disabled ?? false,
2363
+ "data-idx": index
2364
+ }
2365
+ ), /* @__PURE__ */ React39.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ React39.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ React39.createElement("span", null, label)))), /* @__PURE__ */ React39.createElement(TooltipContent, { className: "Layer__tooltip" }, "We could not find matching transactions"));
2366
+ }
2367
+ return /* @__PURE__ */ React39.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ React39.createElement(
2167
2368
  "input",
2168
2369
  {
2169
2370
  type: "radio",
@@ -2174,11 +2375,158 @@ var ToggleOption = ({
2174
2375
  disabled: disabled ?? false,
2175
2376
  "data-idx": index
2176
2377
  }
2177
- ), /* @__PURE__ */ React35.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ React35.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ React35.createElement("span", null, label)));
2378
+ ), /* @__PURE__ */ React39.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ React39.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ React39.createElement("span", null, label)));
2379
+ };
2380
+
2381
+ // src/components/ExpandedBankTransactionRow/APIErrorNotifications.tsx
2382
+ import React41, { useEffect as useEffect3, useState as useState6 } from "react";
2383
+
2384
+ // src/icons/AlertOctagon.tsx
2385
+ import * as React40 from "react";
2386
+ var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React40.createElement(
2387
+ "svg",
2388
+ {
2389
+ viewBox: "0 0 18 18",
2390
+ fill: "none",
2391
+ xmlns: "http://www.w3.org/2000/svg",
2392
+ ...props,
2393
+ width: size,
2394
+ height: size
2395
+ },
2396
+ /* @__PURE__ */ React40.createElement(
2397
+ "path",
2398
+ {
2399
+ d: "M5.895 1.5H12.105L16.5 5.895V12.105L12.105 16.5H5.895L1.5 12.105V5.895L5.895 1.5Z",
2400
+ stroke: "currentColor",
2401
+ strokeLinecap: "round",
2402
+ strokeLinejoin: "round"
2403
+ }
2404
+ ),
2405
+ /* @__PURE__ */ React40.createElement(
2406
+ "path",
2407
+ {
2408
+ d: "M9 6V9",
2409
+ stroke: "currentColor",
2410
+ strokeLinecap: "round",
2411
+ strokeLinejoin: "round"
2412
+ }
2413
+ ),
2414
+ /* @__PURE__ */ React40.createElement(
2415
+ "path",
2416
+ {
2417
+ d: "M9 12H9.0075",
2418
+ stroke: "currentColor",
2419
+ strokeLinecap: "round",
2420
+ strokeLinejoin: "round"
2421
+ }
2422
+ )
2423
+ );
2424
+ var AlertOctagon_default = AlertOctagon;
2425
+
2426
+ // src/components/ExpandedBankTransactionRow/APIErrorNotifications.tsx
2427
+ var ERROR_TITLE = "Approval Failed";
2428
+ var ERROR_MESSAGE = "Something went wrong, try again later";
2429
+ var NOTIFICATION_TIME = 4e3;
2430
+ var FADE_OUT_TIME_WAIT = 1e3;
2431
+ var notificationsCache = [];
2432
+ var APIErrorNotifications = ({
2433
+ bankTransaction,
2434
+ containerWidth
2435
+ }) => {
2436
+ const [notifications, setNotifications] = useState6([]);
2437
+ const pushNotification = (title, message) => {
2438
+ const timestamp = (/* @__PURE__ */ new Date()).valueOf();
2439
+ if (notificationsCache.find(
2440
+ (n) => n.timestamp === timestamp && n.bankTransactionId !== bankTransaction.id
2441
+ )) {
2442
+ return;
2443
+ }
2444
+ notificationsCache = notificationsCache.concat({
2445
+ bankTransactionId: bankTransaction.id,
2446
+ timestamp,
2447
+ title,
2448
+ message
2449
+ });
2450
+ const ids = notificationsCache.map(
2451
+ ({ bankTransactionId }) => bankTransactionId
2452
+ );
2453
+ const timestamps = notificationsCache.map(({ timestamp: timestamp2 }) => timestamp2);
2454
+ notificationsCache = notificationsCache.filter(
2455
+ ({ bankTransactionId, timestamp: timestamp2 }, index) => !ids.includes(bankTransactionId, index + 1) && !timestamps.includes(timestamp2, index + 1)
2456
+ );
2457
+ setNotifications(notificationsCache.concat());
2458
+ };
2459
+ const deleteNotification = (timestamp) => {
2460
+ notificationsCache = notificationsCache.filter(
2461
+ (n) => n.timestamp !== timestamp
2462
+ );
2463
+ setNotifications(notificationsCache.concat());
2464
+ };
2465
+ useEffect3(() => {
2466
+ if (bankTransaction.error) {
2467
+ pushNotification(ERROR_TITLE, ERROR_MESSAGE);
2468
+ }
2469
+ }, [bankTransaction.error]);
2470
+ return /* @__PURE__ */ React41.createElement(
2471
+ "div",
2472
+ {
2473
+ className: "Layer__bank-transactions__notifications",
2474
+ style: containerWidth ? { left: containerWidth - 324 } : {}
2475
+ },
2476
+ notifications.filter((n) => n.bankTransactionId === bankTransaction.id).map((notification) => /* @__PURE__ */ React41.createElement(
2477
+ Notification,
2478
+ {
2479
+ key: notification.timestamp,
2480
+ notification,
2481
+ deleteNotification
2482
+ }
2483
+ ))
2484
+ );
2485
+ };
2486
+ var Notification = ({
2487
+ notification,
2488
+ deleteNotification
2489
+ }) => {
2490
+ const [visible, setVisible] = useState6(false);
2491
+ useEffect3(() => {
2492
+ setVisible(true);
2493
+ const timer = setTimeout(() => {
2494
+ hideNotification();
2495
+ }, NOTIFICATION_TIME);
2496
+ return () => clearTimeout(timer);
2497
+ }, []);
2498
+ const hideNotification = () => {
2499
+ setVisible(false);
2500
+ setTimeout(() => {
2501
+ deleteNotification(notification.timestamp);
2502
+ }, FADE_OUT_TIME_WAIT);
2503
+ };
2504
+ return /* @__PURE__ */ React41.createElement(
2505
+ "div",
2506
+ {
2507
+ className: `Layer__bank-transactions__notification ${visible ? "notification-enter" : "notification-exit"}`,
2508
+ onClick: hideNotification
2509
+ },
2510
+ /* @__PURE__ */ React41.createElement("div", { className: "Layer__bank-transactions__notification-content" }, /* @__PURE__ */ React41.createElement("div", { className: "Layer__bank-transactions__notification-icon" }, /* @__PURE__ */ React41.createElement(AlertOctagon_default, { size: 14 })), /* @__PURE__ */ React41.createElement("div", { className: "Layer__bank-transactions__notification-text" }, /* @__PURE__ */ React41.createElement(
2511
+ Text,
2512
+ {
2513
+ as: "span",
2514
+ className: "Layer__bank-transactions__notification-title"
2515
+ },
2516
+ notification.title
2517
+ ), /* @__PURE__ */ React41.createElement(
2518
+ Text,
2519
+ {
2520
+ as: "span",
2521
+ className: "Layer__bank-transactions__notification-message"
2522
+ },
2523
+ notification.message
2524
+ )))
2525
+ );
2178
2526
  };
2179
2527
 
2180
2528
  // src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
2181
- import classNames14 from "classnames";
2529
+ import classNames16 from "classnames";
2182
2530
  var hasMatch = (bankTransaction) => {
2183
2531
  return Boolean(
2184
2532
  bankTransaction?.suggested_matches && bankTransaction?.suggested_matches?.length > 0 || bankTransaction?.match
@@ -2193,29 +2541,44 @@ var isAlreadyMatched = (bankTransaction) => {
2193
2541
  }
2194
2542
  return void 0;
2195
2543
  };
2544
+ var validateSplit = (splitData) => {
2545
+ let valid = true;
2546
+ splitData.splits.forEach((split) => {
2547
+ if (split.amount <= 0) {
2548
+ valid = false;
2549
+ } else if (!split.category) {
2550
+ valid = false;
2551
+ }
2552
+ });
2553
+ return valid;
2554
+ };
2196
2555
  var ExpandedBankTransactionRow = forwardRef2(
2197
2556
  ({
2198
2557
  bankTransaction,
2199
2558
  isOpen = false,
2559
+ editable,
2200
2560
  asListItem = false,
2201
- submitBtnText = "Save"
2561
+ submitBtnText = "Save",
2562
+ containerWidth
2202
2563
  }, ref) => {
2203
2564
  const {
2204
2565
  categorize: categorizeBankTransaction2,
2205
2566
  match: matchBankTransaction2
2206
2567
  } = useBankTransactions();
2207
- const [purpose, setPurpose] = useState6(
2568
+ const [purpose, setPurpose] = useState7(
2208
2569
  bankTransaction.category ? "categorize" /* categorize */ : hasMatch(bankTransaction) ? "match" /* match */ : "categorize" /* categorize */
2209
2570
  );
2210
- const [selectedMatchId, setSelectedMatchId] = useState6(
2571
+ const [selectedMatchId, setSelectedMatchId] = useState7(
2211
2572
  isAlreadyMatched(bankTransaction)
2212
2573
  );
2213
- const [height, setHeight] = useState6(0);
2214
- const [isOver, setOver] = useState6(false);
2574
+ const [matchFormError, setMatchFormError] = useState7();
2575
+ const [splitFormError, setSplitFormError] = useState7();
2576
+ const [height, setHeight] = useState7(0);
2577
+ const [isOver, setOver] = useState7(false);
2215
2578
  const bodyRef = useRef9(null);
2216
- const [isLoaded, setIsLoaded] = useState6(false);
2579
+ const [isLoaded, setIsLoaded] = useState7(false);
2217
2580
  const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && bankTransaction.categorization_flow?.suggestions?.[0];
2218
- const [rowState, updateRowState] = useState6({
2581
+ const [rowState, updateRowState] = useState7({
2219
2582
  splits: bankTransaction.category?.entries ? bankTransaction.category?.entries.map((c) => {
2220
2583
  return {
2221
2584
  amount: c.amount || 0,
@@ -2232,13 +2595,16 @@ var ExpandedBankTransactionRow = forwardRef2(
2232
2595
  description: "",
2233
2596
  file: void 0
2234
2597
  });
2235
- const addSplit = () => updateRowState({
2236
- ...rowState,
2237
- splits: [
2238
- ...rowState.splits,
2239
- { amount: 0, inputValue: "0.00", category: defaultCategory }
2240
- ]
2241
- });
2598
+ const addSplit = () => {
2599
+ updateRowState({
2600
+ ...rowState,
2601
+ splits: [
2602
+ ...rowState.splits,
2603
+ { amount: 0, inputValue: "0.00", category: defaultCategory }
2604
+ ]
2605
+ });
2606
+ setSplitFormError(void 0);
2607
+ };
2242
2608
  const removeSplit = (index) => {
2243
2609
  const newSplits = rowState.splits.filter((_v, idx) => idx !== index);
2244
2610
  const splitTotal = newSplits.reduce((sum, split, index2) => {
@@ -2252,6 +2618,7 @@ var ExpandedBankTransactionRow = forwardRef2(
2252
2618
  ...rowState,
2253
2619
  splits: newSplits
2254
2620
  });
2621
+ setSplitFormError(void 0);
2255
2622
  };
2256
2623
  const updateAmounts = (rowNumber) => (event) => {
2257
2624
  const newAmount = dollarsToCents(event.target.value) || 0;
@@ -2266,28 +2633,47 @@ var ExpandedBankTransactionRow = forwardRef2(
2266
2633
  rowState.splits[0].amount = remaining;
2267
2634
  rowState.splits[0].inputValue = centsToDollars(remaining);
2268
2635
  updateRowState({ ...rowState });
2636
+ setSplitFormError(void 0);
2269
2637
  };
2270
2638
  const onBlur = (event) => {
2271
2639
  if (event.target.value === "") {
2272
2640
  const [_, index] = event.target.name.split("-");
2273
2641
  rowState.splits[parseInt(index)].inputValue = "0.00";
2274
2642
  updateRowState({ ...rowState });
2643
+ setSplitFormError(void 0);
2275
2644
  }
2276
2645
  };
2277
- const onChangePurpose = (event) => setPurpose(
2278
- event.target.value === "match" /* match */ ? "match" /* match */ : "categorize" /* categorize */
2279
- );
2646
+ const onChangePurpose = (event) => {
2647
+ setPurpose(
2648
+ event.target.value === "match" /* match */ ? "match" /* match */ : "categorize" /* categorize */
2649
+ );
2650
+ setSplitFormError(void 0);
2651
+ setMatchFormError(void 0);
2652
+ };
2280
2653
  const changeCategory = (index, newValue) => {
2281
2654
  rowState.splits[index].category = newValue;
2282
2655
  updateRowState({ ...rowState });
2656
+ setSplitFormError(void 0);
2283
2657
  };
2284
2658
  const save = () => {
2285
2659
  if (purpose === "match" /* match */) {
2286
- if (selectedMatchId && selectedMatchId !== isAlreadyMatched(bankTransaction)) {
2660
+ if (!selectedMatchId) {
2661
+ setMatchFormError("Select an option to match the transaction");
2662
+ } else if (selectedMatchId && selectedMatchId !== isAlreadyMatched(bankTransaction)) {
2287
2663
  onMatchSubmit(selectedMatchId);
2288
2664
  }
2289
2665
  return;
2290
2666
  }
2667
+ if (!validateSplit(rowState)) {
2668
+ if (rowState.splits.length > 1) {
2669
+ setSplitFormError(
2670
+ "Use only positive amounts and select category for each entry"
2671
+ );
2672
+ } else {
2673
+ setSplitFormError("Category is required");
2674
+ }
2675
+ return;
2676
+ }
2291
2677
  categorizeBankTransaction2(
2292
2678
  bankTransaction.id,
2293
2679
  rowState.splits.length === 1 ? {
@@ -2303,7 +2689,7 @@ var ExpandedBankTransactionRow = forwardRef2(
2303
2689
  amount: split.amount
2304
2690
  }))
2305
2691
  }
2306
- ).catch((e) => console.error(e));
2692
+ );
2307
2693
  };
2308
2694
  useImperativeHandle(ref, () => ({
2309
2695
  save
@@ -2332,7 +2718,7 @@ var ExpandedBankTransactionRow = forwardRef2(
2332
2718
  },
2333
2719
  [isOpen]
2334
2720
  );
2335
- useEffect3(() => {
2721
+ useEffect4(() => {
2336
2722
  if (!isLoaded) {
2337
2723
  return;
2338
2724
  }
@@ -2344,20 +2730,20 @@ var ExpandedBankTransactionRow = forwardRef2(
2344
2730
  });
2345
2731
  }
2346
2732
  }, [getDivHeight, isOpen]);
2347
- useEffect3(() => {
2733
+ useEffect4(() => {
2348
2734
  setIsLoaded(true);
2349
2735
  setOver(true);
2350
2736
  }, []);
2351
2737
  const className = "Layer__expanded-bank-transaction-row";
2352
2738
  const shouldHide = !isOpen && isOver;
2353
- return /* @__PURE__ */ React36.createElement(
2739
+ return /* @__PURE__ */ React42.createElement(
2354
2740
  "span",
2355
2741
  {
2356
2742
  className: `${className} ${className}--${isOpen ? "expanded" : "collapsed"}`,
2357
2743
  style: { height },
2358
2744
  onTransitionEnd: handleTransitionEnd
2359
2745
  },
2360
- shouldHide ? null : /* @__PURE__ */ React36.createElement("span", { className: `${className}__wrapper`, ref: bodyRef }, /* @__PURE__ */ React36.createElement("div", { className: `${className}__content-toggle` }, /* @__PURE__ */ React36.createElement(
2746
+ shouldHide ? null : /* @__PURE__ */ React42.createElement("span", { className: `${className}__wrapper`, ref: bodyRef }, /* @__PURE__ */ React42.createElement("div", { className: `${className}__content-toggle` }, /* @__PURE__ */ React42.createElement(
2361
2747
  Toggle,
2362
2748
  {
2363
2749
  name: `purpose-${bankTransaction.id}${asListItem ? "-li" : ""}`,
@@ -2376,46 +2762,50 @@ var ExpandedBankTransactionRow = forwardRef2(
2376
2762
  selected: purpose,
2377
2763
  onChange: onChangePurpose
2378
2764
  }
2379
- )), /* @__PURE__ */ React36.createElement(
2765
+ )), /* @__PURE__ */ React42.createElement(
2380
2766
  "div",
2381
2767
  {
2382
2768
  className: `${className}__content`,
2383
2769
  id: `expanded-${bankTransaction.id}`
2384
2770
  },
2385
- /* @__PURE__ */ React36.createElement("div", { className: `${className}__content-panels` }, /* @__PURE__ */ React36.createElement(
2771
+ /* @__PURE__ */ React42.createElement("div", { className: `${className}__content-panels` }, /* @__PURE__ */ React42.createElement(
2386
2772
  "div",
2387
2773
  {
2388
- className: classNames14(
2774
+ className: classNames16(
2389
2775
  `${className}__match`,
2390
2776
  `${className}__content-panel`,
2391
2777
  purpose === "match" /* match */ ? `${className}__content-panel--active` : ""
2392
2778
  )
2393
2779
  },
2394
- /* @__PURE__ */ React36.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ React36.createElement(
2780
+ /* @__PURE__ */ React42.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ React42.createElement(
2395
2781
  MatchForm,
2396
2782
  {
2397
2783
  classNamePrefix: className,
2398
2784
  bankTransaction,
2399
2785
  selectedMatchId,
2400
- setSelectedMatchId
2786
+ setSelectedMatchId: (id) => {
2787
+ setMatchFormError(void 0);
2788
+ setSelectedMatchId(id);
2789
+ },
2790
+ matchFormError
2401
2791
  }
2402
2792
  ))
2403
- ), /* @__PURE__ */ React36.createElement(
2793
+ ), /* @__PURE__ */ React42.createElement(
2404
2794
  "div",
2405
2795
  {
2406
- className: classNames14(
2796
+ className: classNames16(
2407
2797
  `${className}__splits`,
2408
2798
  `${className}__content-panel`,
2409
2799
  purpose === "categorize" /* categorize */ ? `${className}__content-panel--active` : ""
2410
2800
  )
2411
2801
  },
2412
- /* @__PURE__ */ React36.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ React36.createElement("div", { className: `${className}__splits-inputs` }, rowState.splits.map((split, index) => /* @__PURE__ */ React36.createElement(
2802
+ /* @__PURE__ */ React42.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ React42.createElement("div", { className: `${className}__splits-inputs` }, rowState.splits.map((split, index) => /* @__PURE__ */ React42.createElement(
2413
2803
  "div",
2414
2804
  {
2415
2805
  className: `${className}__table-cell--split-entry`,
2416
2806
  key: `split-${index}`
2417
2807
  },
2418
- /* @__PURE__ */ React36.createElement(
2808
+ /* @__PURE__ */ React42.createElement(
2419
2809
  Input,
2420
2810
  {
2421
2811
  type: "text",
@@ -2428,66 +2818,81 @@ var ExpandedBankTransactionRow = forwardRef2(
2428
2818
  errorMessage: "Negative values are not allowed"
2429
2819
  }
2430
2820
  ),
2431
- /* @__PURE__ */ React36.createElement(
2432
- CategoryMenu,
2821
+ /* @__PURE__ */ React42.createElement(
2822
+ "div",
2433
2823
  {
2434
- bankTransaction,
2435
- name: `category-${index}${asListItem ? "-li" : ""}`,
2436
- value: split.category,
2437
- onChange: (value) => changeCategory(index, value),
2438
- className: "Layer__category-menu--full"
2439
- }
2440
- ),
2441
- index > 0 && /* @__PURE__ */ React36.createElement(
2442
- Button,
2443
- {
2444
- onClick: () => removeSplit(index),
2445
- rightIcon: /* @__PURE__ */ React36.createElement(Link_default, { size: 14 }),
2446
- variant: "secondary" /* secondary */
2824
+ className: `${className}__table-cell--split-entry__right-col`
2447
2825
  },
2448
- "Merge"
2826
+ /* @__PURE__ */ React42.createElement(
2827
+ CategoryMenu,
2828
+ {
2829
+ bankTransaction,
2830
+ name: `category-${index}${asListItem ? "-li" : ""}`,
2831
+ value: split.category,
2832
+ onChange: (value) => changeCategory(index, value),
2833
+ className: "Layer__category-menu--full"
2834
+ }
2835
+ ),
2836
+ index > 0 && /* @__PURE__ */ React42.createElement(
2837
+ Button,
2838
+ {
2839
+ className: `${className}__table-cell--split-entry__merge-btn`,
2840
+ onClick: () => removeSplit(index),
2841
+ rightIcon: /* @__PURE__ */ React42.createElement(Trash_default, { size: 18 }),
2842
+ variant: "secondary" /* secondary */,
2843
+ iconOnly: true
2844
+ }
2845
+ )
2449
2846
  )
2450
- ))), /* @__PURE__ */ React36.createElement("div", { className: `${className}__splits-buttons` }, rowState.splits.length > 1 ? /* @__PURE__ */ React36.createElement(
2847
+ ))), splitFormError && /* @__PURE__ */ React42.createElement(ErrorText, null, splitFormError), /* @__PURE__ */ React42.createElement("div", { className: `${className}__total-and-btns` }, rowState.splits.length > 1 && /* @__PURE__ */ React42.createElement(
2848
+ Input,
2849
+ {
2850
+ disabled: true,
2851
+ leftText: "Total",
2852
+ value: `$${centsToDollars(
2853
+ rowState.splits.reduce(
2854
+ (x, { amount }) => x + amount,
2855
+ 0
2856
+ )
2857
+ )}`
2858
+ }
2859
+ ), /* @__PURE__ */ React42.createElement("div", { className: `${className}__splits-buttons` }, rowState.splits.length > 1 ? /* @__PURE__ */ React42.createElement(
2451
2860
  TextButton,
2452
2861
  {
2453
2862
  onClick: addSplit,
2454
2863
  disabled: rowState.splits.length > 5
2455
2864
  },
2456
2865
  "Add new split"
2457
- ) : /* @__PURE__ */ React36.createElement(
2866
+ ) : /* @__PURE__ */ React42.createElement(
2458
2867
  Button,
2459
2868
  {
2460
2869
  onClick: addSplit,
2461
- rightIcon: /* @__PURE__ */ React36.createElement(Scissors_default, { size: 14 }),
2870
+ rightIcon: /* @__PURE__ */ React42.createElement(ScissorsFullOpen_default, { size: 14 }),
2462
2871
  variant: "secondary" /* secondary */,
2463
2872
  disabled: rowState.splits.length > 5
2464
2873
  },
2465
2874
  "Split"
2466
- )), rowState.splits.length > 1 && /* @__PURE__ */ React36.createElement(
2467
- Text,
2468
- {
2469
- size: "sm" /* sm */,
2470
- className: `${className}__splits-total`
2471
- },
2472
- "Total: $",
2473
- centsToDollars(
2474
- rowState.splits.reduce(
2475
- (x, { amount }) => x + amount,
2476
- 0
2477
- )
2478
- )
2479
- ))
2875
+ ))))
2480
2876
  )),
2481
- /* @__PURE__ */ React36.createElement(
2877
+ /* @__PURE__ */ React42.createElement(
2482
2878
  InputGroup,
2483
2879
  {
2484
2880
  className: `${className}__description`,
2485
2881
  name: "description"
2486
2882
  },
2487
- /* @__PURE__ */ React36.createElement(Textarea, { name: "description", placeholder: "Add description" })
2883
+ /* @__PURE__ */ React42.createElement(Textarea, { name: "description", placeholder: "Add description" })
2488
2884
  ),
2489
- /* @__PURE__ */ React36.createElement("div", { className: `${className}__file-upload` }, /* @__PURE__ */ React36.createElement(FileInput, { text: "Upload receipt" })),
2490
- asListItem ? /* @__PURE__ */ React36.createElement("div", { className: `${className}__submit-btn` }, /* @__PURE__ */ React36.createElement(
2885
+ /* @__PURE__ */ React42.createElement("div", { className: `${className}__file-upload` }, /* @__PURE__ */ React42.createElement(FileInput, { text: "Upload receipt" })),
2886
+ asListItem ? /* @__PURE__ */ React42.createElement("div", { className: `${className}__submit-btn` }, bankTransaction.error ? /* @__PURE__ */ React42.createElement(
2887
+ Text,
2888
+ {
2889
+ as: "span",
2890
+ size: "md" /* md */,
2891
+ className: "Layer__unsaved-info"
2892
+ },
2893
+ /* @__PURE__ */ React42.createElement("span", null, "Unsaved"),
2894
+ /* @__PURE__ */ React42.createElement(AlertCircle_default, { size: 12 })
2895
+ ) : null, /* @__PURE__ */ React42.createElement(
2491
2896
  SubmitButton,
2492
2897
  {
2493
2898
  onClick: () => {
@@ -2497,18 +2902,24 @@ var ExpandedBankTransactionRow = forwardRef2(
2497
2902
  },
2498
2903
  className: "Layer__bank-transaction__submit-btn",
2499
2904
  processing: bankTransaction.processing,
2500
- error: bankTransaction.error,
2501
- active: true
2905
+ active: true,
2906
+ action: editable ? "save" /* SAVE */ : "update" /* UPDATE */
2502
2907
  },
2503
2908
  submitBtnText
2504
2909
  )) : null
2910
+ ), /* @__PURE__ */ React42.createElement(
2911
+ APIErrorNotifications,
2912
+ {
2913
+ bankTransaction,
2914
+ containerWidth
2915
+ }
2505
2916
  ))
2506
2917
  );
2507
2918
  }
2508
2919
  );
2509
2920
 
2510
2921
  // src/components/BankTransactionRow/SplitTooltipDetails.tsx
2511
- import React37 from "react";
2922
+ import React43 from "react";
2512
2923
  var SplitTooltipDetails = ({
2513
2924
  classNamePrefix,
2514
2925
  category
@@ -2516,11 +2927,11 @@ var SplitTooltipDetails = ({
2516
2927
  if (!category.entries) {
2517
2928
  return;
2518
2929
  }
2519
- return /* @__PURE__ */ React37.createElement("span", { className: `${classNamePrefix}__split-tooltip` }, /* @__PURE__ */ React37.createElement("ul", null, category.entries.map((entry, idx) => /* @__PURE__ */ React37.createElement("li", { key: idx }, /* @__PURE__ */ React37.createElement("span", { className: `${classNamePrefix}__split-tooltip__label` }, entry.category.display_name), /* @__PURE__ */ React37.createElement("span", { className: `${classNamePrefix}__split-tooltip__value` }, "$", centsToDollars(entry.amount))))));
2930
+ return /* @__PURE__ */ React43.createElement("span", { className: `${classNamePrefix}__split-tooltip` }, /* @__PURE__ */ React43.createElement("ul", null, category.entries.map((entry, idx) => /* @__PURE__ */ React43.createElement("li", { key: idx }, /* @__PURE__ */ React43.createElement("span", { className: `${classNamePrefix}__split-tooltip__label` }, entry.category.display_name), /* @__PURE__ */ React43.createElement("span", { className: `${classNamePrefix}__split-tooltip__value` }, "$", centsToDollars(entry.amount))))));
2520
2931
  };
2521
2932
 
2522
2933
  // src/components/BankTransactionRow/BankTransactionRow.tsx
2523
- import classNames15 from "classnames";
2934
+ import classNames17 from "classnames";
2524
2935
  import { parseISO as parseISO5, format as formatTime4 } from "date-fns";
2525
2936
  var isCredit = ({ direction }) => direction === "CREDIT" /* CREDIT */;
2526
2937
  var extractDescriptionForSplit = (category) => {
@@ -2532,23 +2943,53 @@ var extractDescriptionForSplit = (category) => {
2532
2943
  var getDefaultSelectedCategory = (bankTransaction) => {
2533
2944
  return hasSuggestions(bankTransaction.categorization_flow) ? mapCategoryToOption(bankTransaction.categorization_flow.suggestions[0]) : bankTransaction.suggested_matches?.length === 1 ? mapSuggestedMatchToOption(bankTransaction.suggested_matches[0]) : void 0;
2534
2945
  };
2946
+ var clickTimer = Date.now();
2535
2947
  var BankTransactionRow = ({
2948
+ index = 0,
2536
2949
  dateFormat,
2537
2950
  bankTransaction,
2538
- editable
2951
+ editable,
2952
+ removeTransaction,
2953
+ containerWidth
2539
2954
  }) => {
2540
2955
  const expandedRowRef = useRef10(null);
2541
- const [removed, setRemoved] = useState7(false);
2956
+ const [showRetry, setShowRetry] = useState8(false);
2957
+ const [removed, setRemoved] = useState8(false);
2542
2958
  const { categorize: categorizeBankTransaction2, match: matchBankTransaction2 } = useBankTransactions();
2543
- const [selectedCategory, setSelectedCategory] = useState7(
2959
+ const [selectedCategory, setSelectedCategory] = useState8(
2544
2960
  getDefaultSelectedCategory(bankTransaction)
2545
2961
  );
2546
- const [open, setOpen] = useState7(false);
2547
- const toggleOpen = () => setOpen(!open);
2548
- const save = () => {
2962
+ const [open, setOpen] = useState8(false);
2963
+ const toggleOpen = () => {
2964
+ setShowRetry(false);
2965
+ setOpen(!open);
2966
+ };
2967
+ const openRow = {
2968
+ onMouseDown: () => {
2969
+ clickTimer = Date.now();
2970
+ },
2971
+ onMouseUp: () => {
2972
+ if (Date.now() - clickTimer < 100 && !open) {
2973
+ setShowRetry(false);
2974
+ setOpen(true);
2975
+ }
2976
+ }
2977
+ };
2978
+ const [showComponent, setShowComponent] = useState8(false);
2979
+ useEffect5(() => {
2980
+ const timeoutId = setTimeout(() => {
2981
+ setShowComponent(true);
2982
+ }, index * 80);
2983
+ return () => clearTimeout(timeoutId);
2984
+ }, []);
2985
+ useEffect5(() => {
2986
+ if (bankTransaction.error) {
2987
+ setShowRetry(true);
2988
+ }
2989
+ }, [bankTransaction.error]);
2990
+ const save = async () => {
2549
2991
  if (open && expandedRowRef?.current) {
2550
2992
  expandedRowRef?.current?.save();
2551
- setOpen(false);
2552
2993
  return;
2553
2994
  }
2554
2995
  if (!selectedCategory) {
@@ -2571,80 +3012,107 @@ var BankTransactionRow = ({
2571
3012
  }
2572
3013
  const className = "Layer__bank-transaction-row";
2573
3014
  const openClassName = open ? `${className}--expanded` : "";
2574
- const rowClassName = classNames15(
3015
+ const rowClassName = classNames17(
2575
3016
  className,
2576
3017
  bankTransaction.recently_categorized ? "Layer__bank-transaction-row--removing" : "",
2577
- open ? openClassName : ""
3018
+ open ? openClassName : "",
3019
+ showComponent ? "show" : ""
2578
3020
  );
2579
- return /* @__PURE__ */ React38.createElement(React38.Fragment, null, /* @__PURE__ */ React38.createElement(
3021
+ return /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(
2580
3022
  "tr",
2581
3023
  {
2582
3024
  className: rowClassName,
2583
3025
  onTransitionEnd: ({ propertyName }) => {
2584
3026
  if (propertyName === "top") {
2585
3027
  setRemoved(true);
3028
+ removeTransaction(bankTransaction.id);
2586
3029
  }
2587
3030
  }
2588
3031
  },
2589
- /* @__PURE__ */ React38.createElement("td", { className: "Layer__table-cell" }, /* @__PURE__ */ React38.createElement("span", { className: "Layer__table-cell-content" }, formatTime4(parseISO5(bankTransaction.date), dateFormat))),
2590
- /* @__PURE__ */ React38.createElement("td", { className: "Layer__table-cell Layer__bank-transactions__tx-col" }, /* @__PURE__ */ React38.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React38.createElement(
2591
- Text,
3032
+ /* @__PURE__ */ React44.createElement(
3033
+ "td",
2592
3034
  {
2593
- as: "span",
2594
- className: "Layer__bank-transactions__tx-text",
2595
- withTooltip: "whenTruncated" /* whenTruncated */,
2596
- tooltipOptions: {
2597
- contentClassName: "Layer__bank-transactions__tx-tooltip"
2598
- }
3035
+ className: "Layer__table-cell Layer__bank-transaction-table__date-col",
3036
+ ...openRow
2599
3037
  },
2600
- bankTransaction.counterparty_name ?? bankTransaction.description
2601
- ))),
2602
- /* @__PURE__ */ React38.createElement("td", { className: "Layer__table-cell Layer__bank-transactions__account-col" }, /* @__PURE__ */ React38.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React38.createElement(
2603
- Text,
3038
+ /* @__PURE__ */ React44.createElement("span", { className: "Layer__table-cell-content" }, formatTime4(parseISO5(bankTransaction.date), dateFormat))
3039
+ ),
3040
+ /* @__PURE__ */ React44.createElement(
3041
+ "td",
2604
3042
  {
2605
- as: "span",
2606
- className: "Layer__bank-transactions__account-text",
2607
- withTooltip: "whenTruncated" /* whenTruncated */
3043
+ className: "Layer__table-cell Layer__bank-transactions__tx-col",
3044
+ ...openRow
2608
3045
  },
2609
- bankTransaction.account_name ?? ""
2610
- ))),
2611
- /* @__PURE__ */ React38.createElement(
3046
+ /* @__PURE__ */ React44.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React44.createElement(
3047
+ Text,
3048
+ {
3049
+ as: "span",
3050
+ className: "Layer__bank-transactions__tx-text",
3051
+ withTooltip: "whenTruncated" /* whenTruncated */,
3052
+ tooltipOptions: {
3053
+ contentClassName: "Layer__bank-transactions__tx-tooltip"
3054
+ }
3055
+ },
3056
+ bankTransaction.counterparty_name ?? bankTransaction.description
3057
+ ))
3058
+ ),
3059
+ /* @__PURE__ */ React44.createElement(
3060
+ "td",
3061
+ {
3062
+ className: "Layer__table-cell Layer__bank-transactions__account-col",
3063
+ ...openRow
3064
+ },
3065
+ /* @__PURE__ */ React44.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ React44.createElement(
3066
+ Text,
3067
+ {
3068
+ as: "span",
3069
+ className: "Layer__bank-transactions__account-text",
3070
+ withTooltip: "whenTruncated" /* whenTruncated */
3071
+ },
3072
+ bankTransaction.account_name ?? ""
3073
+ ))
3074
+ ),
3075
+ /* @__PURE__ */ React44.createElement(
2612
3076
  "td",
2613
3077
  {
2614
- className: `Layer__table-cell Layer__table-cell__amount-col Layer__table-cell--amount ${className}__table-cell--amount-${isCredit(bankTransaction) ? "credit" : "debit"}`
3078
+ className: `Layer__table-cell Layer__table-cell__amount-col Layer__bank-transactions__amount-col Layer__table-cell--amount ${className}__table-cell--amount-${isCredit(bankTransaction) ? "credit" : "debit"}`,
3079
+ ...openRow
2615
3080
  },
2616
- /* @__PURE__ */ React38.createElement("span", { className: "Layer__table-cell-content" }, isCredit(bankTransaction) ? "+$" : " $", centsToDollars(bankTransaction.amount))
3081
+ /* @__PURE__ */ React44.createElement("span", { className: "Layer__table-cell-content" }, isCredit(bankTransaction) ? "+$" : " $", centsToDollars(bankTransaction.amount))
2617
3082
  ),
2618
- /* @__PURE__ */ React38.createElement(
3083
+ /* @__PURE__ */ React44.createElement(
2619
3084
  "td",
2620
3085
  {
2621
- className: classNames15(
3086
+ className: classNames17(
2622
3087
  "Layer__table-cell",
2623
3088
  "Layer__table-cell__category-col",
2624
3089
  `${className}__actions-cell`,
2625
3090
  `${className}__actions-cell--${open ? "open" : "close"}`
2626
3091
  )
2627
3092
  },
2628
- /* @__PURE__ */ React38.createElement(
3093
+ /* @__PURE__ */ React44.createElement(
2629
3094
  "span",
2630
3095
  {
2631
3096
  className: `${className}__actions-container Layer__table-cell-content`
2632
3097
  },
2633
- editable && !open ? /* @__PURE__ */ React38.createElement(
3098
+ editable && !open ? /* @__PURE__ */ React44.createElement(
2634
3099
  CategorySelect,
2635
3100
  {
2636
3101
  bankTransaction,
2637
3102
  name: `category-${bankTransaction.id}`,
2638
3103
  value: selectedCategory,
2639
- onChange: setSelectedCategory,
3104
+ onChange: (category) => {
3105
+ setSelectedCategory(category);
3106
+ setShowRetry(false);
3107
+ },
2640
3108
  disabled: bankTransaction.processing
2641
3109
  }
2642
3110
  ) : null,
2643
- !editable && !open ? /* @__PURE__ */ React38.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction.categorization_status === "SPLIT" /* SPLIT */ && /* @__PURE__ */ React38.createElement(React38.Fragment, null, /* @__PURE__ */ React38.createElement(
3111
+ !editable && !open ? /* @__PURE__ */ React44.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction.categorization_status === "SPLIT" /* SPLIT */ && /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(
2644
3112
  Badge,
2645
3113
  {
2646
- icon: /* @__PURE__ */ React38.createElement(Scissors_default, { size: 11 }),
2647
- tooltip: /* @__PURE__ */ React38.createElement(
3114
+ icon: /* @__PURE__ */ React44.createElement(Scissors_default, { size: 11 }),
3115
+ tooltip: /* @__PURE__ */ React44.createElement(
2648
3116
  SplitTooltipDetails,
2649
3117
  {
2650
3118
  classNamePrefix: className,
@@ -2653,18 +3121,42 @@ var BankTransactionRow = ({
2653
3121
  )
2654
3122
  },
2655
3123
  "Split"
2656
- ), /* @__PURE__ */ React38.createElement("span", { className: `${className}__category-text__text` }, extractDescriptionForSplit(bankTransaction.category))), bankTransaction?.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction?.match && /* @__PURE__ */ React38.createElement(React38.Fragment, null, /* @__PURE__ */ React38.createElement(
3124
+ ), /* @__PURE__ */ React44.createElement("span", { className: `${className}__category-text__text` }, extractDescriptionForSplit(bankTransaction.category))), bankTransaction?.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction?.match && /* @__PURE__ */ React44.createElement(React44.Fragment, null, /* @__PURE__ */ React44.createElement(
2657
3125
  MatchBadge,
2658
3126
  {
2659
3127
  classNamePrefix: className,
2660
3128
  bankTransaction,
2661
3129
  dateFormat
2662
3130
  }
2663
- ), /* @__PURE__ */ React38.createElement("span", { className: `${className}__category-text__text` }, `${formatTime4(
3131
+ ), /* @__PURE__ */ React44.createElement("span", { className: `${className}__category-text__text` }, `${formatTime4(
2664
3132
  parseISO5(bankTransaction.match.bank_transaction.date),
2665
3133
  dateFormat
2666
- )}, ${bankTransaction.match.bank_transaction.description}`)), bankTransaction?.categorization_status !== "MATCHED" /* MATCHED */ && bankTransaction?.categorization_status !== "SPLIT" /* SPLIT */ && /* @__PURE__ */ React38.createElement("span", { className: `${className}__category-text__text` }, bankTransaction?.category?.display_name)) : null,
2667
- editable || open ? /* @__PURE__ */ React38.createElement(
3134
+ )}, ${bankTransaction.match.bank_transaction.description}`)), bankTransaction?.categorization_status !== "MATCHED" /* MATCHED */ && bankTransaction?.categorization_status !== "SPLIT" /* SPLIT */ && /* @__PURE__ */ React44.createElement("span", { className: `${className}__category-text__text` }, bankTransaction?.category?.display_name)) : null,
3135
+ editable && !open && showRetry ? /* @__PURE__ */ React44.createElement(
3136
+ RetryButton,
3137
+ {
3138
+ onClick: () => {
3139
+ if (!bankTransaction.processing) {
3140
+ save();
3141
+ }
3142
+ },
3143
+ className: "Layer__bank-transaction__retry-btn",
3144
+ processing: bankTransaction.processing,
3145
+ error: "Approval failed. Check connection and retry in few seconds."
3146
+ },
3147
+ "Retry"
3148
+ ) : null,
3149
+ open && bankTransaction.error ? /* @__PURE__ */ React44.createElement(
3150
+ Text,
3151
+ {
3152
+ as: "span",
3153
+ size: "md" /* md */,
3154
+ className: "Layer__unsaved-info"
3155
+ },
3156
+ /* @__PURE__ */ React44.createElement("span", null, "Unsaved"),
3157
+ /* @__PURE__ */ React44.createElement(AlertCircle_default, { size: 12 })
3158
+ ) : null,
3159
+ editable && (open || !open && !showRetry) || !editable && open ? /* @__PURE__ */ React44.createElement(
2668
3160
  SubmitButton,
2669
3161
  {
2670
3162
  onClick: () => {
@@ -2674,39 +3166,45 @@ var BankTransactionRow = ({
2674
3166
  },
2675
3167
  className: "Layer__bank-transaction__submit-btn",
2676
3168
  processing: bankTransaction.processing,
2677
- error: bankTransaction.error,
2678
3169
  active: open,
2679
3170
  action: editable ? "save" /* SAVE */ : "update" /* UPDATE */
2680
3171
  },
2681
3172
  editable ? "Approve" : "Update"
2682
3173
  ) : null,
2683
- /* @__PURE__ */ React38.createElement(
3174
+ /* @__PURE__ */ React44.createElement(
2684
3175
  IconButton,
2685
3176
  {
2686
3177
  onClick: toggleOpen,
2687
3178
  className: "Layer__bank-transaction-row__expand-button",
2688
3179
  active: open,
2689
- icon: open ? /* @__PURE__ */ React38.createElement(X_default, null) : /* @__PURE__ */ React38.createElement(ChevronDown_default, { className: "Layer__chevron Layer__chevron__down" })
3180
+ icon: /* @__PURE__ */ React44.createElement(
3181
+ ChevronDownFill_default,
3182
+ {
3183
+ className: `Layer__chevron ${open ? "Layer__chevron__up" : "Layer__chevron__down"}`
3184
+ }
3185
+ )
2690
3186
  }
2691
3187
  )
2692
3188
  )
2693
3189
  )
2694
- ), /* @__PURE__ */ React38.createElement("tr", null, /* @__PURE__ */ React38.createElement("td", { colSpan: 5, className: "Layer__bank-transaction-row__expanded-td" }, /* @__PURE__ */ React38.createElement(
3190
+ ), /* @__PURE__ */ React44.createElement("tr", null, /* @__PURE__ */ React44.createElement("td", { colSpan: 5, className: "Layer__bank-transaction-row__expanded-td" }, /* @__PURE__ */ React44.createElement(
2695
3191
  ExpandedBankTransactionRow,
2696
3192
  {
2697
3193
  ref: expandedRowRef,
2698
3194
  bankTransaction,
2699
- isOpen: open
3195
+ isOpen: open,
3196
+ containerWidth,
3197
+ editable
2700
3198
  }
2701
3199
  ))));
2702
3200
  };
2703
3201
 
2704
3202
  // src/components/BankTransactionListItem/Assignment.tsx
2705
- import React39 from "react";
3203
+ import React45 from "react";
2706
3204
  import { parseISO as parseISO6, format as formatTime5 } from "date-fns";
2707
3205
  var Assignment = ({ bankTransaction }) => {
2708
3206
  if (bankTransaction.match && bankTransaction.categorization_status === "MATCHED" /* MATCHED */) {
2709
- return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(
3207
+ return /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement(
2710
3208
  MatchBadge,
2711
3209
  {
2712
3210
  classNamePrefix: "Layer__bank-transaction-list-item",
@@ -2714,17 +3212,17 @@ var Assignment = ({ bankTransaction }) => {
2714
3212
  dateFormat: DATE_FORMAT,
2715
3213
  text: "Matched"
2716
3214
  }
2717
- ), /* @__PURE__ */ React39.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, `${formatTime5(
3215
+ ), /* @__PURE__ */ React45.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, `${formatTime5(
2718
3216
  parseISO6(bankTransaction.match.bank_transaction.date),
2719
3217
  DATE_FORMAT
2720
3218
  )}, ${bankTransaction.match.bank_transaction.description}`));
2721
3219
  }
2722
3220
  if (bankTransaction.categorization_status === "SPLIT" /* SPLIT */) {
2723
- return /* @__PURE__ */ React39.createElement(React39.Fragment, null, /* @__PURE__ */ React39.createElement(
3221
+ return /* @__PURE__ */ React45.createElement(React45.Fragment, null, /* @__PURE__ */ React45.createElement(
2724
3222
  Badge,
2725
3223
  {
2726
- icon: /* @__PURE__ */ React39.createElement(Scissors_default, { size: 11 }),
2727
- tooltip: /* @__PURE__ */ React39.createElement(
3224
+ icon: /* @__PURE__ */ React45.createElement(Scissors_default, { size: 11 }),
3225
+ tooltip: /* @__PURE__ */ React45.createElement(
2728
3226
  SplitTooltipDetails,
2729
3227
  {
2730
3228
  classNamePrefix: "Layer__bank-transaction-list-item",
@@ -2733,32 +3231,49 @@ var Assignment = ({ bankTransaction }) => {
2733
3231
  )
2734
3232
  },
2735
3233
  "Split"
2736
- ), /* @__PURE__ */ React39.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, extractDescriptionForSplit(bankTransaction.category)));
3234
+ ), /* @__PURE__ */ React45.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, extractDescriptionForSplit(bankTransaction.category)));
2737
3235
  }
2738
- return /* @__PURE__ */ React39.createElement(Text, null, bankTransaction?.category?.display_name);
3236
+ return /* @__PURE__ */ React45.createElement(Text, null, bankTransaction?.category?.display_name);
2739
3237
  };
2740
3238
 
2741
3239
  // src/components/BankTransactionListItem/BankTransactionListItem.tsx
2742
- import classNames16 from "classnames";
3240
+ import classNames18 from "classnames";
2743
3241
  import { parseISO as parseISO7, format as formatTime6 } from "date-fns";
2744
3242
  var isCredit2 = ({ direction }) => direction === "CREDIT" /* CREDIT */;
2745
3243
  var BankTransactionListItem = ({
3244
+ index = 0,
2746
3245
  dateFormat,
2747
3246
  bankTransaction,
2748
- editable
3247
+ editable,
3248
+ containerWidth
2749
3249
  }) => {
2750
3250
  const expandedRowRef = useRef11(null);
2751
- const [removed, setRemoved] = useState8(false);
3251
+ const [showRetry, setShowRetry] = useState9(false);
3252
+ const [removed, setRemoved] = useState9(false);
2752
3253
  const { categorize: categorizeBankTransaction2, match: matchBankTransaction2 } = useBankTransactions();
2753
- const [selectedCategory, setSelectedCategory] = useState8(
3254
+ const [selectedCategory, setSelectedCategory] = useState9(
2754
3255
  getDefaultSelectedCategory(bankTransaction)
2755
3256
  );
2756
- const [open, setOpen] = useState8(false);
2757
- const toggleOpen = () => setOpen(!open);
3257
+ const [open, setOpen] = useState9(false);
3258
+ const toggleOpen = () => {
3259
+ setShowRetry(false);
3260
+ setOpen(!open);
3261
+ };
3262
+ const [showComponent, setShowComponent] = useState9(false);
3263
+ useEffect6(() => {
3264
+ const timeoutId = setTimeout(() => {
3265
+ setShowComponent(true);
3266
+ }, index * 80);
3267
+ return () => clearTimeout(timeoutId);
3268
+ }, []);
3269
+ useEffect6(() => {
3270
+ if (bankTransaction.error) {
3271
+ setShowRetry(true);
3272
+ }
3273
+ }, [bankTransaction.error]);
2758
3274
  const save = () => {
2759
3275
  if (open && expandedRowRef?.current) {
2760
3276
  expandedRowRef?.current?.save();
2761
- setOpen(false);
2762
3277
  return;
2763
3278
  }
2764
3279
  if (!selectedCategory) {
@@ -2781,50 +3296,55 @@ var BankTransactionListItem = ({
2781
3296
  }
2782
3297
  const className = "Layer__bank-transaction-list-item";
2783
3298
  const openClassName = open ? `${className}--expanded` : "";
2784
- const rowClassName = classNames16(
3299
+ const rowClassName = classNames18(
2785
3300
  className,
2786
3301
  bankTransaction.recently_categorized ? "Layer__bank-transaction-row--removing" : "",
2787
- open ? openClassName : ""
3302
+ open ? openClassName : "",
3303
+ showComponent ? "show" : ""
2788
3304
  );
2789
- return /* @__PURE__ */ React40.createElement("li", { className: rowClassName }, /* @__PURE__ */ React40.createElement("span", { className: `${className}__heading` }, /* @__PURE__ */ React40.createElement("span", { className: `${className}__heading-date` }, formatTime6(parseISO7(bankTransaction.date), dateFormat)), /* @__PURE__ */ React40.createElement("span", { className: `${className}__heading-separator` }), /* @__PURE__ */ React40.createElement("span", { className: `${className}__heading-account-name` }, bankTransaction.account_name ?? "")), /* @__PURE__ */ React40.createElement("span", { className: `${className}__body` }, /* @__PURE__ */ React40.createElement("span", { className: `${className}__body__name` }, bankTransaction.counterparty_name), /* @__PURE__ */ React40.createElement(
2790
- "span",
2791
- {
2792
- className: `${className}__amount-${isCredit2(bankTransaction) ? "credit" : "debit"}`
2793
- },
2794
- isCredit2(bankTransaction) ? "+$" : " $",
2795
- centsToDollars(bankTransaction.amount)
2796
- ), /* @__PURE__ */ React40.createElement(
3305
+ return /* @__PURE__ */ React46.createElement("li", { className: rowClassName }, /* @__PURE__ */ React46.createElement("span", { className: `${className}__heading` }, /* @__PURE__ */ React46.createElement("div", { className: `${className}__heading__main` }, /* @__PURE__ */ React46.createElement("span", { className: `${className}__heading-date` }, formatTime6(parseISO7(bankTransaction.date), dateFormat)), /* @__PURE__ */ React46.createElement("span", { className: `${className}__heading-separator` }), /* @__PURE__ */ React46.createElement("span", { className: `${className}__heading-account-name` }, bankTransaction.account_name ?? "")), /* @__PURE__ */ React46.createElement(
2797
3306
  "div",
2798
3307
  {
2799
3308
  onClick: toggleOpen,
2800
3309
  className: "Layer__bank-transaction-row__expand-button"
2801
3310
  },
2802
- /* @__PURE__ */ React40.createElement(
2803
- ChevronDown_default,
3311
+ /* @__PURE__ */ React46.createElement(
3312
+ ChevronDownFill_default,
2804
3313
  {
2805
3314
  className: `Layer__chevron ${open ? "Layer__chevron__up" : "Layer__chevron__down"}`
2806
3315
  }
2807
3316
  )
2808
- )), /* @__PURE__ */ React40.createElement("span", { className: `${className}__expanded-row` }, /* @__PURE__ */ React40.createElement(
3317
+ )), /* @__PURE__ */ React46.createElement("span", { className: `${className}__body` }, /* @__PURE__ */ React46.createElement("span", { className: `${className}__body__name` }, /* @__PURE__ */ React46.createElement(Text, { as: "span", withTooltip: "whenTruncated" /* whenTruncated */ }, bankTransaction.counterparty_name ?? bankTransaction.description)), /* @__PURE__ */ React46.createElement(
3318
+ "span",
3319
+ {
3320
+ className: `${className}__amount-${isCredit2(bankTransaction) ? "credit" : "debit"}`
3321
+ },
3322
+ isCredit2(bankTransaction) ? "+$" : " $",
3323
+ centsToDollars(bankTransaction.amount)
3324
+ )), /* @__PURE__ */ React46.createElement("span", { className: `${className}__expanded-row` }, /* @__PURE__ */ React46.createElement(
2809
3325
  ExpandedBankTransactionRow,
2810
3326
  {
2811
3327
  ref: expandedRowRef,
2812
3328
  bankTransaction,
2813
- close: toggleOpen,
2814
3329
  isOpen: open,
3330
+ editable,
2815
3331
  asListItem: true,
2816
- submitBtnText: editable ? "Approve" : "Save"
3332
+ submitBtnText: editable ? "Approve" : "Update",
3333
+ containerWidth
2817
3334
  }
2818
- )), /* @__PURE__ */ React40.createElement("span", { className: `${className}__base-row` }, editable ? /* @__PURE__ */ React40.createElement(
3335
+ )), /* @__PURE__ */ React46.createElement("span", { className: `${className}__base-row` }, editable ? /* @__PURE__ */ React46.createElement(
2819
3336
  CategorySelect,
2820
3337
  {
2821
3338
  bankTransaction,
2822
3339
  name: `category-${bankTransaction.id}`,
2823
3340
  value: selectedCategory,
2824
- onChange: setSelectedCategory,
3341
+ onChange: (category) => {
3342
+ setShowRetry(false);
3343
+ setSelectedCategory(category);
3344
+ },
2825
3345
  disabled: bankTransaction.processing
2826
3346
  }
2827
- ) : null, !editable ? /* @__PURE__ */ React40.createElement(Assignment, { bankTransaction }) : null, editable && /* @__PURE__ */ React40.createElement(
3347
+ ) : null, !editable ? /* @__PURE__ */ React46.createElement(Assignment, { bankTransaction }) : null, editable && !showRetry ? /* @__PURE__ */ React46.createElement(
2828
3348
  SubmitButton,
2829
3349
  {
2830
3350
  onClick: () => {
@@ -2834,14 +3354,27 @@ var BankTransactionListItem = ({
2834
3354
  },
2835
3355
  className: "Layer__bank-transaction__submit-btn",
2836
3356
  processing: bankTransaction.processing,
2837
- error: bankTransaction.error,
2838
- iconOnly: true
2839
- }
2840
- )));
3357
+ action: editable ? "save" /* SAVE */ : "update" /* UPDATE */
3358
+ },
3359
+ editable ? "Approve" : "Update"
3360
+ ) : null, editable && showRetry ? /* @__PURE__ */ React46.createElement(
3361
+ RetryButton,
3362
+ {
3363
+ onClick: () => {
3364
+ if (!bankTransaction.processing) {
3365
+ save();
3366
+ }
3367
+ },
3368
+ className: "Layer__bank-transaction__retry-btn",
3369
+ processing: bankTransaction.processing,
3370
+ error: "Approval failed. Check connection and retry in few seconds."
3371
+ },
3372
+ "Retry"
3373
+ ) : null), bankTransaction.error && showRetry ? /* @__PURE__ */ React46.createElement(ErrorText, null, "Approval failed. Check connection and retry in few seconds.") : null);
2841
3374
  };
2842
3375
 
2843
3376
  // src/components/Container/Container.tsx
2844
- import React41, { forwardRef as forwardRef3 } from "react";
3377
+ import React47, { forwardRef as forwardRef3 } from "react";
2845
3378
 
2846
3379
  // src/config/theme.ts
2847
3380
  var SHADES = {
@@ -3069,10 +3602,10 @@ var hslToHex = (hsl) => {
3069
3602
  };
3070
3603
 
3071
3604
  // src/components/Container/Container.tsx
3072
- import classNames17 from "classnames";
3605
+ import classNames19 from "classnames";
3073
3606
  var Container = forwardRef3(
3074
3607
  ({ name, className, children, asWidget }, ref) => {
3075
- const baseClassName = classNames17(
3608
+ const baseClassName = classNames19(
3076
3609
  "Layer__component Layer__component-container",
3077
3610
  `Layer__${name}`,
3078
3611
  asWidget ? "Layer__component--as-widget" : "",
@@ -3080,114 +3613,28 @@ var Container = forwardRef3(
3080
3613
  );
3081
3614
  const { theme } = useLayerContext();
3082
3615
  const styles = parseStylesFromThemeConfig(theme);
3083
- return /* @__PURE__ */ React41.createElement("div", { ref, className: baseClassName, style: { ...styles } }, children);
3616
+ return /* @__PURE__ */ React47.createElement("div", { ref, className: baseClassName, style: { ...styles } }, children);
3084
3617
  }
3085
3618
  );
3086
3619
 
3087
3620
  // src/components/Container/Header.tsx
3088
- import React42, { forwardRef as forwardRef4 } from "react";
3089
- import classNames18 from "classnames";
3621
+ import React48, { forwardRef as forwardRef4 } from "react";
3622
+ import classNames20 from "classnames";
3090
3623
  var Header = forwardRef4(
3091
3624
  ({ className, children, style }, ref) => {
3092
- const baseClassName = classNames18("Layer__component-header", className);
3093
- return /* @__PURE__ */ React42.createElement("header", { ref, className: baseClassName, style }, children);
3625
+ const baseClassName = classNames20("Layer__component-header", className);
3626
+ return /* @__PURE__ */ React48.createElement("header", { ref, className: baseClassName, style }, children);
3094
3627
  }
3095
3628
  );
3096
3629
 
3097
3630
  // src/components/DataState/DataState.tsx
3098
- import React45 from "react";
3099
-
3100
- // src/icons/AlertOctagon.tsx
3101
- import * as React43 from "react";
3102
- var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React43.createElement(
3103
- "svg",
3104
- {
3105
- viewBox: "0 0 18 18",
3106
- fill: "none",
3107
- xmlns: "http://www.w3.org/2000/svg",
3108
- ...props,
3109
- width: size,
3110
- height: size
3111
- },
3112
- /* @__PURE__ */ React43.createElement(
3113
- "path",
3114
- {
3115
- d: "M5.895 1.5H12.105L16.5 5.895V12.105L12.105 16.5H5.895L1.5 12.105V5.895L5.895 1.5Z",
3116
- stroke: "currentColor",
3117
- strokeLinecap: "round",
3118
- strokeLinejoin: "round"
3119
- }
3120
- ),
3121
- /* @__PURE__ */ React43.createElement(
3122
- "path",
3123
- {
3124
- d: "M9 6V9",
3125
- stroke: "currentColor",
3126
- strokeLinecap: "round",
3127
- strokeLinejoin: "round"
3128
- }
3129
- ),
3130
- /* @__PURE__ */ React43.createElement(
3131
- "path",
3132
- {
3133
- d: "M9 12H9.0075",
3134
- stroke: "currentColor",
3135
- strokeLinecap: "round",
3136
- strokeLinejoin: "round"
3137
- }
3138
- )
3139
- );
3140
- var AlertOctagon_default = AlertOctagon;
3141
-
3142
- // src/icons/RefreshCcw.tsx
3143
- import * as React44 from "react";
3144
- var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React44.createElement(
3145
- "svg",
3146
- {
3147
- viewBox: "0 0 18 18",
3148
- fill: "none",
3149
- xmlns: "http://www.w3.org/2000/svg",
3150
- ...props,
3151
- width: size,
3152
- height: size
3153
- },
3154
- /* @__PURE__ */ React44.createElement(
3155
- "path",
3156
- {
3157
- d: "M0.75 3V7.5H5.25",
3158
- stroke: "currentColor",
3159
- strokeLinecap: "round",
3160
- strokeLinejoin: "round"
3161
- }
3162
- ),
3163
- /* @__PURE__ */ React44.createElement(
3164
- "path",
3165
- {
3166
- d: "M17.25 15V10.5H12.75",
3167
- stroke: "currentColor",
3168
- strokeLinecap: "round",
3169
- strokeLinejoin: "round"
3170
- }
3171
- ),
3172
- /* @__PURE__ */ React44.createElement(
3173
- "path",
3174
- {
3175
- d: "M15.3675 6.75C14.9871 5.67508 14.3407 4.71405 13.4884 3.95656C12.6361 3.19907 11.6059 2.66982 10.4938 2.41819C9.38167 2.16656 8.22393 2.20075 7.12861 2.51758C6.03328 2.8344 5.03606 3.42353 4.23 4.23L0.75 7.5M17.25 10.5L13.77 13.77C12.9639 14.5765 11.9667 15.1656 10.8714 15.4824C9.77607 15.7992 8.61833 15.8334 7.50621 15.5818C6.3941 15.3302 5.36385 14.8009 4.5116 14.0434C3.65935 13.2859 3.01288 12.3249 2.6325 11.25",
3176
- stroke: "currentColor",
3177
- strokeLinecap: "round",
3178
- strokeLinejoin: "round"
3179
- }
3180
- )
3181
- );
3182
- var RefreshCcw_default = RefreshCcw;
3183
-
3184
- // src/components/DataState/DataState.tsx
3631
+ import React49 from "react";
3185
3632
  var getIcon = (status) => {
3186
3633
  switch (status) {
3187
3634
  case "failed" /* failed */:
3188
- return /* @__PURE__ */ React45.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--error" }, /* @__PURE__ */ React45.createElement(AlertOctagon_default, { size: 12 }));
3635
+ return /* @__PURE__ */ React49.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--error" }, /* @__PURE__ */ React49.createElement(AlertOctagon_default, { size: 12 }));
3189
3636
  default:
3190
- return /* @__PURE__ */ React45.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ React45.createElement(CheckCircle_default, { size: 12 }));
3637
+ return /* @__PURE__ */ React49.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ React49.createElement(CheckCircle_default, { size: 12 }));
3191
3638
  }
3192
3639
  };
3193
3640
  var DataState = ({
@@ -3197,7 +3644,7 @@ var DataState = ({
3197
3644
  onRefresh,
3198
3645
  isLoading
3199
3646
  }) => {
3200
- return /* @__PURE__ */ React45.createElement("div", { className: "Layer__data-state" }, getIcon(status), /* @__PURE__ */ React45.createElement(
3647
+ return /* @__PURE__ */ React49.createElement("div", { className: "Layer__data-state" }, getIcon(status), /* @__PURE__ */ React49.createElement(
3201
3648
  Text,
3202
3649
  {
3203
3650
  as: "span",
@@ -3206,11 +3653,11 @@ var DataState = ({
3206
3653
  className: "Layer__data-state__title"
3207
3654
  },
3208
3655
  title
3209
- ), /* @__PURE__ */ React45.createElement(Text, { as: "span", className: "Layer__data-state__description" }, description), onRefresh && /* @__PURE__ */ React45.createElement("span", { className: "Layer__data-state__btn" }, /* @__PURE__ */ React45.createElement(
3656
+ ), /* @__PURE__ */ React49.createElement(Text, { as: "span", className: "Layer__data-state__description" }, description), onRefresh && /* @__PURE__ */ React49.createElement("span", { className: "Layer__data-state__btn" }, /* @__PURE__ */ React49.createElement(
3210
3657
  Button,
3211
3658
  {
3212
3659
  variant: "secondary" /* secondary */,
3213
- rightIcon: isLoading ? /* @__PURE__ */ React45.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" }) : /* @__PURE__ */ React45.createElement(RefreshCcw_default, { size: 12 }),
3660
+ rightIcon: isLoading ? /* @__PURE__ */ React49.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" }) : /* @__PURE__ */ React49.createElement(RefreshCcw_default, { size: 12 }),
3214
3661
  onClick: onRefresh,
3215
3662
  disabled: isLoading
3216
3663
  },
@@ -3219,24 +3666,16 @@ var DataState = ({
3219
3666
  };
3220
3667
 
3221
3668
  // src/components/Loader/Loader.tsx
3222
- import React46 from "react";
3669
+ import React50 from "react";
3223
3670
  var Loader2 = ({ children }) => {
3224
- return /* @__PURE__ */ React46.createElement("span", { className: "Layer__loader" }, /* @__PURE__ */ React46.createElement(Loader_default, { size: 28, className: "Layer__anim--rotating" }), children);
3671
+ return /* @__PURE__ */ React50.createElement("span", { className: "Layer__loader" }, /* @__PURE__ */ React50.createElement(Loader_default, { size: 28, className: "Layer__anim--rotating" }), children);
3225
3672
  };
3226
3673
 
3227
3674
  // src/components/Pagination/Pagination.tsx
3228
- import React49 from "react";
3675
+ import React53 from "react";
3229
3676
 
3230
3677
  // src/hooks/usePagination/usePagination.ts
3231
3678
  import { useMemo } from "react";
3232
-
3233
- // src/utils/helpers.ts
3234
- var range = (start, end) => {
3235
- let length = end - start + 1;
3236
- return Array.from({ length }, (_, idx) => idx + start);
3237
- };
3238
-
3239
- // src/hooks/usePagination/usePagination.ts
3240
3679
  var DOTS = "...";
3241
3680
  var usePagination = ({
3242
3681
  totalCount,
@@ -3281,8 +3720,8 @@ var usePagination = ({
3281
3720
  };
3282
3721
 
3283
3722
  // src/icons/ChevronLeft.tsx
3284
- import * as React47 from "react";
3285
- var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React47.createElement(
3723
+ import * as React51 from "react";
3724
+ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React51.createElement(
3286
3725
  "svg",
3287
3726
  {
3288
3727
  xmlns: "http://www.w3.org/2000/svg",
@@ -3292,7 +3731,7 @@ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React47.createEle
3292
3731
  fill: "none",
3293
3732
  ...props
3294
3733
  },
3295
- /* @__PURE__ */ React47.createElement(
3734
+ /* @__PURE__ */ React51.createElement(
3296
3735
  "path",
3297
3736
  {
3298
3737
  d: "M11.25 13.5L6.75 9L11.25 4.5",
@@ -3305,8 +3744,8 @@ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React47.createEle
3305
3744
  var ChevronLeft_default = ChevronLeft;
3306
3745
 
3307
3746
  // src/icons/ChevronRight.tsx
3308
- import * as React48 from "react";
3309
- var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React48.createElement(
3747
+ import * as React52 from "react";
3748
+ var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React52.createElement(
3310
3749
  "svg",
3311
3750
  {
3312
3751
  xmlns: "http://www.w3.org/2000/svg",
@@ -3316,7 +3755,7 @@ var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React48.createEl
3316
3755
  fill: "none",
3317
3756
  ...props
3318
3757
  },
3319
- /* @__PURE__ */ React48.createElement(
3758
+ /* @__PURE__ */ React52.createElement(
3320
3759
  "path",
3321
3760
  {
3322
3761
  d: "M6.75 13.5L11.25 9L6.75 4.5",
@@ -3350,9 +3789,10 @@ var Pagination = ({
3350
3789
  return;
3351
3790
  }
3352
3791
  let lastPage = paginationRange[paginationRange.length - 1];
3353
- return /* @__PURE__ */ React49.createElement("ul", { className: "Layer__pagination" }, /* @__PURE__ */ React49.createElement(
3792
+ return /* @__PURE__ */ React53.createElement("ul", { className: "Layer__pagination" }, /* @__PURE__ */ React53.createElement(
3354
3793
  "li",
3355
3794
  {
3795
+ key: `page-prev`,
3356
3796
  className: classnames(
3357
3797
  "Layer__pagination-item Layer__pagination-arrow Layer__pagination-arrow--previous",
3358
3798
  {
@@ -3361,14 +3801,15 @@ var Pagination = ({
3361
3801
  ),
3362
3802
  onClick: () => onPageChange(currentPage - 1)
3363
3803
  },
3364
- /* @__PURE__ */ React49.createElement(ChevronLeft_default, { size: 12 })
3804
+ /* @__PURE__ */ React53.createElement(ChevronLeft_default, { size: 12 })
3365
3805
  ), paginationRange.map((pageNumber) => {
3366
3806
  if (pageNumber === DOTS) {
3367
- return /* @__PURE__ */ React49.createElement("li", { className: "Layer__pagination-item Layer__pagination-dots" }, "\u2026");
3807
+ return /* @__PURE__ */ React53.createElement("li", { className: "Layer__pagination-item Layer__pagination-dots" }, "\u2026");
3368
3808
  }
3369
- return /* @__PURE__ */ React49.createElement(
3809
+ return /* @__PURE__ */ React53.createElement(
3370
3810
  "li",
3371
3811
  {
3812
+ key: `page-${pageNumber}`,
3372
3813
  className: classnames("Layer__pagination-item", {
3373
3814
  selected: pageNumber === currentPage
3374
3815
  }),
@@ -3380,9 +3821,10 @@ var Pagination = ({
3380
3821
  },
3381
3822
  pageNumber
3382
3823
  );
3383
- }), /* @__PURE__ */ React49.createElement(
3824
+ }), /* @__PURE__ */ React53.createElement(
3384
3825
  "li",
3385
3826
  {
3827
+ key: `page-last`,
3386
3828
  className: classnames(
3387
3829
  "Layer__pagination-item Layer__pagination-arrow Layer__pagination-arrow--next",
3388
3830
  {
@@ -3391,7 +3833,7 @@ var Pagination = ({
3391
3833
  ),
3392
3834
  onClick: () => onPageChange(currentPage + 1)
3393
3835
  },
3394
- /* @__PURE__ */ React49.createElement(ChevronRight_default, { size: 12 })
3836
+ /* @__PURE__ */ React53.createElement(ChevronRight_default, { size: 12 })
3395
3837
  ));
3396
3838
  };
3397
3839
 
@@ -3407,7 +3849,7 @@ var ReviewCategories = [
3407
3849
  "READY_FOR_INPUT" /* READY_FOR_INPUT */,
3408
3850
  "LAYER_REVIEW" /* LAYER_REVIEW */
3409
3851
  ];
3410
- var filterVisibility = (display) => (bankTransaction) => {
3852
+ var filterVisibility = (display, bankTransaction) => {
3411
3853
  const categorized = CategorizedCategories.includes(
3412
3854
  bankTransaction.categorization_status
3413
3855
  );
@@ -3418,113 +3860,150 @@ var BankTransactions = ({
3418
3860
  asWidget = false,
3419
3861
  pageSize = 15
3420
3862
  }) => {
3421
- const [display, setDisplay] = useState9("review" /* review */);
3422
- const [currentPage, setCurrentPage] = useState9(1);
3863
+ const [display, setDisplay] = useState10("review" /* review */);
3864
+ const [currentPage, setCurrentPage] = useState10(1);
3865
+ const [removedTxs, setRemovedTxs] = useState10([]);
3423
3866
  const { data, isLoading, error, isValidating, refetch } = useBankTransactions();
3424
- const bankTransactionsByFilter = data?.filter(filterVisibility(display));
3867
+ const bankTransactionsByFilter = data?.filter(
3868
+ (tx) => !removedTxs.includes(tx.id) && filterVisibility(display, tx)
3869
+ );
3425
3870
  const bankTransactions = useMemo2(() => {
3426
3871
  const firstPageIndex = (currentPage - 1) * pageSize;
3427
3872
  const lastPageIndex = firstPageIndex + pageSize;
3428
3873
  return bankTransactionsByFilter?.slice(firstPageIndex, lastPageIndex);
3429
- }, [currentPage, bankTransactionsByFilter]);
3874
+ }, [currentPage, bankTransactionsByFilter, removedTxs]);
3430
3875
  const onCategorizationDisplayChange = (event) => {
3431
3876
  setDisplay(
3432
3877
  event.target.value === "categorized" /* categorized */ ? "categorized" /* categorized */ : "review" /* review */
3433
3878
  );
3434
3879
  setCurrentPage(1);
3435
3880
  };
3436
- const [shiftStickyHeader, setShiftStickyHeader] = useState9(0);
3437
- const [listView, setListView] = useState9(false);
3881
+ const [shiftStickyHeader, setShiftStickyHeader] = useState10(0);
3882
+ const debounceShiftStickyHeader = debounce(setShiftStickyHeader, 500);
3883
+ const [listView, setListView] = useState10(false);
3884
+ const [containerWidth, setContainerWidth] = useState10(0);
3885
+ const debounceContainerWidth = debounce(setContainerWidth, 500);
3886
+ const removeTransaction = (id) => {
3887
+ const newTxs = removedTxs.slice();
3888
+ newTxs.push(id);
3889
+ setRemovedTxs(newTxs);
3890
+ };
3438
3891
  const containerRef = useElementSize((_el, _en, size) => {
3439
3892
  if (size?.height && size?.height >= 90) {
3440
3893
  const newShift = -Math.floor(size.height / 2) + 6;
3441
3894
  if (newShift !== shiftStickyHeader) {
3442
- setShiftStickyHeader(newShift);
3895
+ debounceShiftStickyHeader(newShift);
3443
3896
  }
3444
3897
  } else if (size?.height > 0 && shiftStickyHeader !== 0) {
3445
- setShiftStickyHeader(0);
3898
+ debounceShiftStickyHeader(0);
3446
3899
  }
3447
3900
  if (size.width > 700 && listView) {
3448
3901
  setListView(false);
3449
3902
  } else if (size.width <= 700 && !listView) {
3450
3903
  setListView(true);
3451
3904
  }
3905
+ debounceContainerWidth(size?.width);
3452
3906
  });
3453
3907
  const editable = display === "review" /* review */;
3454
- return /* @__PURE__ */ React50.createElement(Container, { name: COMPONENT_NAME, asWidget, ref: containerRef }, /* @__PURE__ */ React50.createElement(
3455
- Header,
3908
+ return /* @__PURE__ */ React54.createElement(
3909
+ Container,
3456
3910
  {
3457
- className: "Layer__bank-transactions__header",
3458
- style: { top: shiftStickyHeader }
3911
+ className: editable ? "Layer__bank-transactions--to-review" : "Layer__bank-transactions--categorized",
3912
+ name: COMPONENT_NAME,
3913
+ asWidget,
3914
+ ref: containerRef
3459
3915
  },
3460
- /* @__PURE__ */ React50.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
3461
- /* @__PURE__ */ React50.createElement(
3462
- Toggle,
3916
+ /* @__PURE__ */ React54.createElement(
3917
+ Header,
3918
+ {
3919
+ className: "Layer__bank-transactions__header",
3920
+ style: { top: shiftStickyHeader }
3921
+ },
3922
+ /* @__PURE__ */ React54.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
3923
+ /* @__PURE__ */ React54.createElement(
3924
+ Toggle,
3925
+ {
3926
+ name: "bank-transaction-display",
3927
+ options: [
3928
+ { label: "To Review", value: "review" /* review */ },
3929
+ { label: "Categorized", value: "categorized" /* categorized */ }
3930
+ ],
3931
+ selected: display,
3932
+ onChange: onCategorizationDisplayChange
3933
+ }
3934
+ )
3935
+ ),
3936
+ !listView && /* @__PURE__ */ React54.createElement(
3937
+ "table",
3463
3938
  {
3464
- name: "bank-transaction-display",
3465
- options: [
3466
- { label: "To Review", value: "review" /* review */ },
3467
- { label: "Categorized", value: "categorized" /* categorized */ }
3468
- ],
3469
- selected: display,
3470
- onChange: onCategorizationDisplayChange
3939
+ width: "100%",
3940
+ className: "Layer__table Layer__bank-transactions__table with-cell-separators"
3941
+ },
3942
+ /* @__PURE__ */ React54.createElement("thead", null, /* @__PURE__ */ React54.createElement("tr", null, /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__bank-transactions__date-col" }, "Date"), /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__bank-transactions__tx-col" }, "Transaction"), /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__bank-transactions__account-col" }, "Account"), /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__table-cell--amount Layer__table-cell__amount-col" }, "Amount"), editable ? /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__table-header--primary Layer__table-cell__category-col" }, "Categorize") : /* @__PURE__ */ React54.createElement("th", { className: "Layer__table-header Layer__table-cell__category-col" }, "Category"))),
3943
+ /* @__PURE__ */ React54.createElement("tbody", null, !isLoading && bankTransactions?.map(
3944
+ (bankTransaction, index) => /* @__PURE__ */ React54.createElement(
3945
+ BankTransactionRow,
3946
+ {
3947
+ index,
3948
+ key: bankTransaction.id,
3949
+ dateFormat: DATE_FORMAT,
3950
+ bankTransaction,
3951
+ editable,
3952
+ removeTransaction,
3953
+ containerWidth
3954
+ }
3955
+ )
3956
+ ))
3957
+ ),
3958
+ isLoading && !bankTransactions ? /* @__PURE__ */ React54.createElement("div", { className: "Layer__bank-transactions__loader-container" }, /* @__PURE__ */ React54.createElement(Loader2, null)) : null,
3959
+ !isLoading && listView ? /* @__PURE__ */ React54.createElement("ul", { className: "Layer__bank-transactions__list" }, bankTransactions?.map(
3960
+ (bankTransaction, index) => /* @__PURE__ */ React54.createElement(
3961
+ BankTransactionListItem,
3962
+ {
3963
+ index,
3964
+ key: bankTransaction.id,
3965
+ dateFormat: DATE_FORMAT,
3966
+ bankTransaction,
3967
+ editable,
3968
+ removeTransaction,
3969
+ containerWidth
3970
+ }
3971
+ )
3972
+ )) : null,
3973
+ !isLoading && !error && (bankTransactions === void 0 || bankTransactions !== void 0 && bankTransactions.length === 0) ? /* @__PURE__ */ React54.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React54.createElement(
3974
+ DataState,
3975
+ {
3976
+ status: "allDone" /* allDone */,
3977
+ title: "You are up to date with transactions!",
3978
+ description: "All uncategorized transaction will be displayed here",
3979
+ onRefresh: () => refetch(),
3980
+ isLoading: isValidating
3471
3981
  }
3472
- )
3473
- ), !listView && /* @__PURE__ */ React50.createElement(
3474
- "table",
3475
- {
3476
- width: "100%",
3477
- className: "Layer__table Layer__bank-transactions__table with-cell-separators"
3478
- },
3479
- /* @__PURE__ */ React50.createElement("thead", null, /* @__PURE__ */ React50.createElement("tr", null, /* @__PURE__ */ React50.createElement("th", { className: "Layer__table-header Layer__bank-transactions__date-col" }, "Date"), /* @__PURE__ */ React50.createElement("th", { className: "Layer__table-header Layer__bank-transactions__tx-col" }, "Transaction"), /* @__PURE__ */ React50.createElement("th", { className: "Layer__table-header Layer__bank-transactions__account-col" }, "Account"), /* @__PURE__ */ React50.createElement("th", { className: "Layer__table-header Layer__table-cell--amount Layer__table-cell__amount-col" }, "Amount"), editable ? /* @__PURE__ */ React50.createElement("th", { className: "Layer__table-header Layer__table-header--primary Layer__table-cell__category-col" }, "Categorize") : /* @__PURE__ */ React50.createElement("th", { className: "Layer__table-header Layer__table-cell__category-col" }, "Category"))),
3480
- /* @__PURE__ */ React50.createElement("tbody", null, !isLoading && bankTransactions?.map((bankTransaction) => /* @__PURE__ */ React50.createElement(
3481
- BankTransactionRow,
3982
+ )) : null,
3983
+ !isLoading && error ? /* @__PURE__ */ React54.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React54.createElement(
3984
+ DataState,
3482
3985
  {
3483
- key: bankTransaction.id,
3484
- dateFormat: DATE_FORMAT,
3485
- bankTransaction,
3486
- editable
3986
+ status: "failed" /* failed */,
3987
+ title: "Something went wrong",
3988
+ description: "We couldn\u2019t load your data.",
3989
+ onRefresh: () => refetch(),
3990
+ isLoading: isValidating
3487
3991
  }
3488
- )))
3489
- ), isLoading && !bankTransactions ? /* @__PURE__ */ React50.createElement("div", { className: "Layer__bank-transactions__loader-container" }, /* @__PURE__ */ React50.createElement(Loader2, null)) : null, !isLoading && listView ? /* @__PURE__ */ React50.createElement("ul", { className: "Layer__bank-transactions__list" }, bankTransactions?.map((bankTransaction) => /* @__PURE__ */ React50.createElement(
3490
- BankTransactionListItem,
3491
- {
3492
- key: bankTransaction.id,
3493
- dateFormat: DATE_FORMAT,
3494
- bankTransaction,
3495
- editable
3496
- }
3497
- ))) : null, !isLoading && !error && (bankTransactions === void 0 || bankTransactions !== void 0 && bankTransactions.length === 0) ? /* @__PURE__ */ React50.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React50.createElement(
3498
- DataState,
3499
- {
3500
- status: "allDone" /* allDone */,
3501
- title: "You are up to date with transactions!",
3502
- description: "All uncategorized transaction will be displayed here",
3503
- onRefresh: () => refetch(),
3504
- isLoading: isValidating
3505
- }
3506
- )) : null, !isLoading && error ? /* @__PURE__ */ React50.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React50.createElement(
3507
- DataState,
3508
- {
3509
- status: "failed" /* failed */,
3510
- title: "Something went wrong",
3511
- description: "We couldn\u2019t load your data.",
3512
- onRefresh: () => refetch(),
3513
- isLoading: isValidating
3514
- }
3515
- )) : null, /* @__PURE__ */ React50.createElement("div", { className: "Layer__bank-transactions__pagination" }, /* @__PURE__ */ React50.createElement(
3516
- Pagination,
3517
- {
3518
- currentPage,
3519
- totalCount: bankTransactionsByFilter?.length || 0,
3520
- pageSize,
3521
- onPageChange: (page) => setCurrentPage(page)
3522
- }
3523
- )));
3992
+ )) : null,
3993
+ /* @__PURE__ */ React54.createElement("div", { className: "Layer__bank-transactions__pagination" }, /* @__PURE__ */ React54.createElement(
3994
+ Pagination,
3995
+ {
3996
+ currentPage,
3997
+ totalCount: bankTransactionsByFilter?.length || 0,
3998
+ pageSize,
3999
+ onPageChange: (page) => setCurrentPage(page)
4000
+ }
4001
+ ))
4002
+ );
3524
4003
  };
3525
4004
 
3526
4005
  // src/components/Hello/Hello.tsx
3527
- import React51 from "react";
4006
+ import React55 from "react";
3528
4007
  import useSWR3 from "swr";
3529
4008
  var fetcher = (url) => fetch(url).then((res) => res.json());
3530
4009
  var Hello = ({ user }) => {
@@ -3533,14 +4012,149 @@ var Hello = ({ user }) => {
3533
4012
  fetcher
3534
4013
  );
3535
4014
  const name = (isLoading ? "..." : data?.name) || "User";
3536
- return /* @__PURE__ */ React51.createElement(React51.Fragment, null, /* @__PURE__ */ React51.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
4015
+ return /* @__PURE__ */ React55.createElement(React55.Fragment, null, /* @__PURE__ */ React55.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
4016
+ };
4017
+
4018
+ // src/components/LinkedAccounts/LinkedAccounts.tsx
4019
+ import React57 from "react";
4020
+
4021
+ // src/hooks/useLinkedAccounts/useLinkedAccounts.ts
4022
+ import { useEffect as useEffect7, useState as useState11 } from "react";
4023
+ var MOCK_DATA = [
4024
+ {
4025
+ name: "Business Checking",
4026
+ account: "1234",
4027
+ amount: 1220620
4028
+ },
4029
+ {
4030
+ name: "Business Savings",
4031
+ account: "5678",
4032
+ amount: 10002062e-1
4033
+ },
4034
+ {
4035
+ name: "Account",
4036
+ account: "4321",
4037
+ amount: 801.91
4038
+ }
4039
+ ];
4040
+ var useLinkedAccounts = () => {
4041
+ const { auth, businessId, apiUrl } = useLayerContext();
4042
+ const [isLoading, setIsLoading] = useState11(true);
4043
+ useEffect7(() => {
4044
+ const timer = setTimeout(() => {
4045
+ setIsLoading(false);
4046
+ }, 2e3);
4047
+ }, []);
4048
+ const responseData = { data: MOCK_DATA, meta: {}, error: void 0 };
4049
+ const isValidating = false;
4050
+ const {
4051
+ data = void 0,
4052
+ meta: metadata = {},
4053
+ error = void 0
4054
+ } = responseData || {};
4055
+ const refetch = () => {
4056
+ console.log("refetch...");
4057
+ };
4058
+ return {
4059
+ data,
4060
+ metadata,
4061
+ isLoading,
4062
+ isValidating,
4063
+ error,
4064
+ refetch
4065
+ };
4066
+ };
4067
+
4068
+ // src/components/LinkedAccounts/LinkedAccountThumb.tsx
4069
+ import React56 from "react";
4070
+ var LinkedAccountThumb = ({ account }) => {
4071
+ return /* @__PURE__ */ React56.createElement("div", { className: "Layer__linked-account-thumb" }, /* @__PURE__ */ React56.createElement("div", { className: "topbar" }, /* @__PURE__ */ React56.createElement(Text, { as: "span", className: "account-name" }, account.name), /* @__PURE__ */ React56.createElement(Text, { as: "span", className: "account-number" }, "\u2022\u2022\u2022", account.account)), /* @__PURE__ */ React56.createElement("div", { className: "bottombar" }, /* @__PURE__ */ React56.createElement(Text, { as: "span", className: "account-amount" }, "$", centsToDollars(account.amount))));
4072
+ };
4073
+
4074
+ // src/components/LinkedAccounts/LinkedAccounts.tsx
4075
+ var COMPONENT_NAME2 = "linked-accounts";
4076
+ var LinkedAccounts = () => {
4077
+ const { data, isLoading, error, isValidating, refetch } = useLinkedAccounts();
4078
+ return /* @__PURE__ */ React57.createElement(Container, { name: COMPONENT_NAME2 }, /* @__PURE__ */ React57.createElement(Header, { className: "Layer__linked-accounts__header" }, /* @__PURE__ */ React57.createElement(
4079
+ Heading,
4080
+ {
4081
+ className: "Layer__linked-accounts__title",
4082
+ size: "secondary" /* secondary */
4083
+ },
4084
+ "Linked Accounts"
4085
+ )), isLoading && /* @__PURE__ */ React57.createElement("div", { className: "Layer__linked-accounts__loader-container" }, /* @__PURE__ */ React57.createElement(Loader2, null)), error && !isLoading ? /* @__PURE__ */ React57.createElement(
4086
+ DataState,
4087
+ {
4088
+ status: "failed" /* failed */,
4089
+ title: "Something went wrong",
4090
+ description: "We couldn\u2019t load your data.",
4091
+ onRefresh: () => refetch(),
4092
+ isLoading: isValidating
4093
+ }
4094
+ ) : null, !error && !isLoading ? /* @__PURE__ */ React57.createElement("div", { className: "Layer__linked-accounts__list" }, data?.map((account, index) => /* @__PURE__ */ React57.createElement(LinkedAccountThumb, { account, key: `linked-acc-${index}` }))) : null);
3537
4095
  };
3538
4096
 
3539
4097
  // src/components/ProfitAndLoss/ProfitAndLoss.tsx
3540
- import React59, { createContext as createContext2 } from "react";
4098
+ import React65, { createContext as createContext2 } from "react";
4099
+
4100
+ // src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
4101
+ import { useMemo as useMemo3, useState as useState12 } from "react";
4102
+
4103
+ // src/utils/profitAndLossUtils.ts
4104
+ var doesLineItemQualifies = (item) => {
4105
+ return !(item.is_contra || item.value === void 0 || item.value === null || isNaN(item.value) || item.value === -Infinity || item.value === Infinity || item.value < 0);
4106
+ };
4107
+ var collectSubItems = (type, item) => {
4108
+ if (!item) {
4109
+ return [];
4110
+ }
4111
+ const items = [];
4112
+ item?.line_items?.forEach((item2) => {
4113
+ if (doesLineItemQualifies(item2)) {
4114
+ items.push({
4115
+ name: item2.name,
4116
+ display_name: item2.display_name,
4117
+ value: Math.abs(item2.value || 0),
4118
+ // @TODO - confirm that's safe to do this
4119
+ type
4120
+ });
4121
+ }
4122
+ });
4123
+ return items;
4124
+ };
4125
+ var collectExpensesItems = (data) => {
4126
+ const cogs = collectSubItems("Cost of Goods Sold", data.cost_of_goods_sold);
4127
+ const expenses = collectSubItems("Operating Expenses", data.expenses);
4128
+ const taxes = collectSubItems("Taxes & Licenses", data.taxes);
4129
+ return [].concat(cogs).concat(expenses).concat(taxes);
4130
+ };
4131
+ var collectRevenueItems = (data) => {
4132
+ const income = collectSubItems("Income", data.income);
4133
+ return [].concat(income);
4134
+ };
4135
+ var humanizeTitle = (sidebarView) => {
4136
+ switch (sidebarView) {
4137
+ case "expenses":
4138
+ return "Expenses";
4139
+ case "revenue":
4140
+ return "Revenue";
4141
+ default:
4142
+ return "Profit & Loss";
4143
+ }
4144
+ };
4145
+ var applyShare = (items, total) => {
4146
+ return items.map((item) => {
4147
+ if (total === 0) {
4148
+ return item;
4149
+ }
4150
+ return {
4151
+ ...item,
4152
+ share: item.value / total
4153
+ };
4154
+ });
4155
+ };
3541
4156
 
3542
4157
  // src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
3543
- import { useState as useState10 } from "react";
3544
4158
  import { startOfMonth, endOfMonth, formatISO } from "date-fns";
3545
4159
  import useSWR4 from "swr";
3546
4160
  var useProfitAndLoss = ({
@@ -3553,12 +4167,17 @@ var useProfitAndLoss = ({
3553
4167
  endDate: endOfMonth(/* @__PURE__ */ new Date())
3554
4168
  }) => {
3555
4169
  const { auth, businessId, apiUrl } = useLayerContext();
3556
- const [startDate, setStartDate] = useState10(
4170
+ const [startDate, setStartDate] = useState12(
3557
4171
  initialStartDate || startOfMonth(Date.now())
3558
4172
  );
3559
- const [endDate, setEndDate] = useState10(
4173
+ const [endDate, setEndDate] = useState12(
3560
4174
  initialEndDate || endOfMonth(Date.now())
3561
4175
  );
4176
+ const [filters, setFilters] = useState12({
4177
+ expenses: void 0,
4178
+ revenue: void 0
4179
+ });
4180
+ const [sidebarScope, setSidebarScope] = useState12("expenses");
3562
4181
  const {
3563
4182
  data: rawData,
3564
4183
  isLoading,
@@ -3581,6 +4200,43 @@ var useProfitAndLoss = ({
3581
4200
  })
3582
4201
  );
3583
4202
  const { data, error } = rawData || {};
4203
+ const { filteredData, filteredTotal } = useMemo3(() => {
4204
+ if (!data) {
4205
+ return { filteredData: [], filteredTotal: void 0 };
4206
+ }
4207
+ const items = sidebarScope === "revenue" ? collectRevenueItems(data) : collectExpensesItems(data);
4208
+ const filtered = items.map((x) => {
4209
+ if (sidebarScope && filters[sidebarScope]?.types && filters[sidebarScope].types.length > 0 && !filters[sidebarScope]?.types?.includes(x.type)) {
4210
+ return {
4211
+ ...x,
4212
+ hidden: true
4213
+ };
4214
+ }
4215
+ return x;
4216
+ });
4217
+ const sorted = filtered.sort((a, b) => {
4218
+ switch (filters[sidebarScope ?? "expenses"]?.sortBy) {
4219
+ case "category":
4220
+ if (filters[sidebarScope ?? "expenses"]?.sortDirection === "asc") {
4221
+ return a.display_name.localeCompare(b.display_name);
4222
+ }
4223
+ return b.display_name.localeCompare(a.display_name);
4224
+ case "type":
4225
+ if (filters[sidebarScope ?? "expenses"]?.sortDirection === "asc") {
4226
+ return a.type.localeCompare(b.type);
4227
+ }
4228
+ return b.type.localeCompare(a.type);
4229
+ default:
4230
+ if (filters[sidebarScope ?? "expenses"]?.sortDirection === "asc") {
4231
+ return a.value - b.value;
4232
+ }
4233
+ return b.value - a.value;
4234
+ }
4235
+ });
4236
+ const total = sorted.filter((x) => !x.hidden).reduce((x, { value }) => x + value, 0);
4237
+ const withShare = applyShare(sorted, total);
4238
+ return { filteredData: withShare, filteredTotal: total };
4239
+ }, [data, startDate, filters, sidebarScope]);
3584
4240
  const changeDateRange = ({
3585
4241
  startDate: newStartDate,
3586
4242
  endDate: newEndDate
@@ -3591,25 +4247,83 @@ var useProfitAndLoss = ({
3591
4247
  const refetch = () => {
3592
4248
  mutate();
3593
4249
  };
4250
+ const sortBy = (scope, field, direction) => {
4251
+ setFilters({
4252
+ ...filters,
4253
+ [scope]: {
4254
+ ...filters[scope],
4255
+ sortBy: field,
4256
+ sortDirection: direction ?? filters[scope]?.sortDirection === "desc" ? "asc" : "desc"
4257
+ }
4258
+ });
4259
+ };
4260
+ const setFilterTypes = (scope, types) => {
4261
+ setFilters({
4262
+ ...filters,
4263
+ [scope]: {
4264
+ ...filters[scope],
4265
+ types
4266
+ }
4267
+ });
4268
+ };
3594
4269
  return {
3595
4270
  data,
4271
+ filteredData,
4272
+ filteredTotal,
3596
4273
  isLoading,
3597
4274
  isValidating,
3598
4275
  error: error || rawError,
3599
4276
  dateRange: { startDate, endDate },
3600
4277
  refetch,
3601
- changeDateRange
4278
+ changeDateRange,
4279
+ sidebarScope,
4280
+ setSidebarScope,
4281
+ sortBy,
4282
+ filters,
4283
+ setFilterTypes
3602
4284
  };
3603
4285
  };
3604
4286
 
3605
4287
  // src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
3606
- import React53, { useContext as useContext2, useMemo as useMemo3, useState as useState11 } from "react";
4288
+ import React59, { useContext as useContext2, useMemo as useMemo4, useState as useState13 } from "react";
3607
4289
 
3608
4290
  // src/utils/format.ts
3609
4291
  var capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
4292
+ var formatPercent = (value, options) => {
4293
+ if (!value && value !== 0) {
4294
+ return;
4295
+ }
4296
+ const val = value * 100;
4297
+ let defaultOptions = {
4298
+ minimumFractionDigits: 0,
4299
+ maximumFractionDigits: 0
4300
+ };
4301
+ if (Math.abs(val) < 10) {
4302
+ defaultOptions = {
4303
+ minimumFractionDigits: 1,
4304
+ maximumFractionDigits: 1
4305
+ };
4306
+ }
4307
+ if (Math.abs(val) < 1) {
4308
+ defaultOptions = {
4309
+ minimumFractionDigits: 1,
4310
+ maximumFractionDigits: 1
4311
+ };
4312
+ }
4313
+ if (val === 0) {
4314
+ defaultOptions = {
4315
+ minimumFractionDigits: 0,
4316
+ maximumFractionDigits: 0
4317
+ };
4318
+ }
4319
+ return val.toLocaleString("en-US", {
4320
+ ...defaultOptions,
4321
+ ...options
4322
+ });
4323
+ };
3610
4324
 
3611
4325
  // src/components/ProfitAndLossChart/Indicator.tsx
3612
- import React52, { useEffect as useEffect4 } from "react";
4326
+ import React58, { useEffect as useEffect8 } from "react";
3613
4327
  var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
3614
4328
  var Indicator = ({
3615
4329
  viewBox = {},
@@ -3624,11 +4338,11 @@ var Indicator = ({
3624
4338
  const boxWidth = width * 2 + 4;
3625
4339
  const multiplier = 1.5;
3626
4340
  const xOffset = (boxWidth * multiplier - boxWidth) / 2;
3627
- useEffect4(() => {
4341
+ useEffect8(() => {
3628
4342
  setAnimateFrom(animateTo);
3629
4343
  }, [animateTo]);
3630
4344
  const actualX = animateFrom === -1 ? animateTo : animateFrom;
3631
- return /* @__PURE__ */ React52.createElement(
4345
+ return /* @__PURE__ */ React58.createElement(
3632
4346
  "rect",
3633
4347
  {
3634
4348
  className: "Layer__profit-and-loss-chart__selection-indicator",
@@ -3638,9 +4352,9 @@ var Indicator = ({
3638
4352
  width: `${boxWidth * multiplier}px`,
3639
4353
  // @ts-expect-error -- y is fine but x apparently isn't!
3640
4354
  x: actualX - xOffset,
3641
- y: 5,
4355
+ y: 22,
3642
4356
  borderRadius: 8,
3643
- height: "calc(100% - 10px)"
4357
+ height: "calc(100% - 38px)"
3644
4358
  }
3645
4359
  }
3646
4360
  );
@@ -3764,13 +4478,13 @@ var ProfitAndLossChart = () => {
3764
4478
  label
3765
4479
  }) => {
3766
4480
  if (active && payload && payload.length) {
3767
- return /* @__PURE__ */ React53.createElement("div", { className: "Layer__chart__tooltip" }, /* @__PURE__ */ React53.createElement("ul", { className: "Layer__chart__tooltip-list" }, /* @__PURE__ */ React53.createElement("li", null, /* @__PURE__ */ React53.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[0].name ?? "")), /* @__PURE__ */ React53.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[0].value ?? 0)))), /* @__PURE__ */ React53.createElement("li", null, /* @__PURE__ */ React53.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[1].name ?? "")), /* @__PURE__ */ React53.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[1].value ?? 0))))));
4481
+ return /* @__PURE__ */ React59.createElement("div", { className: "Layer__chart__tooltip" }, /* @__PURE__ */ React59.createElement("ul", { className: "Layer__chart__tooltip-list" }, /* @__PURE__ */ React59.createElement("li", null, /* @__PURE__ */ React59.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[0].name ?? "")), /* @__PURE__ */ React59.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[0].value ?? 0)))), /* @__PURE__ */ React59.createElement("li", null, /* @__PURE__ */ React59.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[1].name ?? "")), /* @__PURE__ */ React59.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[1].value ?? 0))))));
3768
4482
  }
3769
4483
  return null;
3770
4484
  };
3771
4485
  const CustomizedCursor = (props) => {
3772
4486
  const { x, y, width, height } = props;
3773
- return /* @__PURE__ */ React53.createElement(
4487
+ return /* @__PURE__ */ React59.createElement(
3774
4488
  Rectangle,
3775
4489
  {
3776
4490
  fill: getColor(100)?.hex ?? "#F5F4F3",
@@ -3784,7 +4498,7 @@ var ProfitAndLossChart = () => {
3784
4498
  }
3785
4499
  );
3786
4500
  };
3787
- const data = useMemo3(
4501
+ const data = useMemo4(
3788
4502
  () => monthData.map(summarizePnL),
3789
4503
  [
3790
4504
  startSelectionMonth,
@@ -3792,8 +4506,8 @@ var ProfitAndLossChart = () => {
3792
4506
  ...monthData.map((m) => m?.net_profit)
3793
4507
  ]
3794
4508
  );
3795
- const [animateFrom, setAnimateFrom] = useState11(-1);
3796
- return /* @__PURE__ */ React53.createElement(
4509
+ const [animateFrom, setAnimateFrom] = useState13(-1);
4510
+ return /* @__PURE__ */ React59.createElement(
3797
4511
  ResponsiveContainer,
3798
4512
  {
3799
4513
  className: "Layer__chart-container",
@@ -3801,7 +4515,7 @@ var ProfitAndLossChart = () => {
3801
4515
  height: "100%",
3802
4516
  minHeight: 200
3803
4517
  },
3804
- /* @__PURE__ */ React53.createElement(
4518
+ /* @__PURE__ */ React59.createElement(
3805
4519
  BarChart,
3806
4520
  {
3807
4521
  margin: { left: 12, right: 12, bottom: 12 },
@@ -3810,15 +4524,17 @@ var ProfitAndLossChart = () => {
3810
4524
  barGap,
3811
4525
  className: "Layer__profit-and-loss-chart"
3812
4526
  },
3813
- /* @__PURE__ */ React53.createElement(
4527
+ /* @__PURE__ */ React59.createElement(
3814
4528
  Tooltip2,
3815
4529
  {
3816
4530
  wrapperClassName: "Layer__chart__tooltip-wrapper",
3817
- content: /* @__PURE__ */ React53.createElement(CustomTooltip, null),
3818
- cursor: /* @__PURE__ */ React53.createElement(CustomizedCursor, null)
4531
+ content: /* @__PURE__ */ React59.createElement(CustomTooltip, null),
4532
+ cursor: /* @__PURE__ */ React59.createElement(CustomizedCursor, null),
4533
+ animationDuration: 100,
4534
+ animationEasing: "ease-out"
3819
4535
  }
3820
4536
  ),
3821
- /* @__PURE__ */ React53.createElement(
4537
+ /* @__PURE__ */ React59.createElement(
3822
4538
  CartesianGrid,
3823
4539
  {
3824
4540
  vertical: false,
@@ -3826,7 +4542,7 @@ var ProfitAndLossChart = () => {
3826
4542
  strokeDasharray: "5 5"
3827
4543
  }
3828
4544
  ),
3829
- /* @__PURE__ */ React53.createElement(
4545
+ /* @__PURE__ */ React59.createElement(
3830
4546
  Legend,
3831
4547
  {
3832
4548
  verticalAlign: "top",
@@ -3846,8 +4562,8 @@ var ProfitAndLossChart = () => {
3846
4562
  ]
3847
4563
  }
3848
4564
  ),
3849
- /* @__PURE__ */ React53.createElement(XAxis, { dataKey: "name", tickLine: false }),
3850
- /* @__PURE__ */ React53.createElement(
4565
+ /* @__PURE__ */ React59.createElement(XAxis, { dataKey: "name", tickLine: false }),
4566
+ /* @__PURE__ */ React59.createElement(
3851
4567
  Bar,
3852
4568
  {
3853
4569
  dataKey: "revenue",
@@ -3856,10 +4572,10 @@ var ProfitAndLossChart = () => {
3856
4572
  radius: [barSize / 4, barSize / 4, 0, 0],
3857
4573
  className: "Layer__profit-and-loss-chart__bar--income"
3858
4574
  },
3859
- /* @__PURE__ */ React53.createElement(
4575
+ /* @__PURE__ */ React59.createElement(
3860
4576
  LabelList,
3861
4577
  {
3862
- content: /* @__PURE__ */ React53.createElement(
4578
+ content: /* @__PURE__ */ React59.createElement(
3863
4579
  Indicator,
3864
4580
  {
3865
4581
  animateFrom,
@@ -3868,7 +4584,7 @@ var ProfitAndLossChart = () => {
3868
4584
  )
3869
4585
  }
3870
4586
  ),
3871
- data.map((entry) => /* @__PURE__ */ React53.createElement(
4587
+ data.map((entry) => /* @__PURE__ */ React59.createElement(
3872
4588
  Cell,
3873
4589
  {
3874
4590
  key: entry.name,
@@ -3876,7 +4592,7 @@ var ProfitAndLossChart = () => {
3876
4592
  }
3877
4593
  ))
3878
4594
  ),
3879
- /* @__PURE__ */ React53.createElement(
4595
+ /* @__PURE__ */ React59.createElement(
3880
4596
  Bar,
3881
4597
  {
3882
4598
  dataKey: "expenses",
@@ -3885,7 +4601,7 @@ var ProfitAndLossChart = () => {
3885
4601
  radius: [barSize / 4, barSize / 4, 0, 0],
3886
4602
  className: "Layer__profit-and-loss-chart__bar--expenses"
3887
4603
  },
3888
- data.map((entry) => /* @__PURE__ */ React53.createElement(
4604
+ data.map((entry) => /* @__PURE__ */ React59.createElement(
3889
4605
  Cell,
3890
4606
  {
3891
4607
  key: entry.name,
@@ -3898,7 +4614,7 @@ var ProfitAndLossChart = () => {
3898
4614
  };
3899
4615
 
3900
4616
  // src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
3901
- import React54, { useContext as useContext3 } from "react";
4617
+ import React60, { useContext as useContext3 } from "react";
3902
4618
  import { add, endOfMonth as endOfMonth3, format as format5, startOfMonth as startOfMonth3 } from "date-fns";
3903
4619
  var ProfitAndLossDatePicker = () => {
3904
4620
  const { changeDateRange, dateRange } = useContext3(ProfitAndLoss.Context);
@@ -3913,28 +4629,28 @@ var ProfitAndLossDatePicker = () => {
3913
4629
  };
3914
4630
  const previousMonth = () => change({ months: -1 });
3915
4631
  const nextMonth = () => change({ months: 1 });
3916
- return /* @__PURE__ */ React54.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ React54.createElement(
4632
+ return /* @__PURE__ */ React60.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ React60.createElement(
3917
4633
  "button",
3918
4634
  {
3919
4635
  "aria-label": "View Previous Month",
3920
4636
  className: "Layer__profit-and-loss-date-picker__button",
3921
4637
  onClick: previousMonth
3922
4638
  },
3923
- /* @__PURE__ */ React54.createElement(
4639
+ /* @__PURE__ */ React60.createElement(
3924
4640
  ChevronLeft_default,
3925
4641
  {
3926
4642
  className: "Layer__profit-and-loss-date-picker__button-icon",
3927
4643
  size: 18
3928
4644
  }
3929
4645
  )
3930
- ), /* @__PURE__ */ React54.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, label), /* @__PURE__ */ React54.createElement(
4646
+ ), /* @__PURE__ */ React60.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, label), /* @__PURE__ */ React60.createElement(
3931
4647
  "button",
3932
4648
  {
3933
4649
  "aria-label": "View Next Month",
3934
4650
  className: "Layer__profit-and-loss-date-picker__button",
3935
4651
  onClick: nextMonth
3936
4652
  },
3937
- /* @__PURE__ */ React54.createElement(
4653
+ /* @__PURE__ */ React60.createElement(
3938
4654
  ChevronRight_default,
3939
4655
  {
3940
4656
  className: "Layer__profit-and-loss-date-picker__button-icon",
@@ -3945,53 +4661,83 @@ var ProfitAndLossDatePicker = () => {
3945
4661
  };
3946
4662
 
3947
4663
  // src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
3948
- import React56, { useContext as useContext4 } from "react";
4664
+ import React62, { useContext as useContext4 } from "react";
3949
4665
 
3950
4666
  // src/components/SkeletonLoader/SkeletonLoader.tsx
3951
- import React55 from "react";
3952
- import classNames19 from "classnames";
4667
+ import React61 from "react";
4668
+ import classNames21 from "classnames";
3953
4669
  var SkeletonLoader = ({
3954
4670
  height,
3955
4671
  width,
3956
4672
  className
3957
4673
  }) => {
3958
- const baseClassName = classNames19(
4674
+ const baseClassName = classNames21(
3959
4675
  "Layer__skeleton-loader Layer__anim--skeleton-loading",
3960
4676
  className
3961
4677
  );
3962
- return /* @__PURE__ */ React55.createElement("div", { className: baseClassName, style: { width, height } });
4678
+ return /* @__PURE__ */ React61.createElement("div", { className: baseClassName, style: { width, height } });
3963
4679
  };
3964
4680
 
3965
4681
  // src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
4682
+ import classNames22 from "classnames";
3966
4683
  var ProfitAndLossSummaries = ({
3967
4684
  vertical,
3968
4685
  revenueLabel = "Revenue"
3969
4686
  }) => {
3970
- const { data: storedData, isLoading } = useContext4(ProfitAndLoss.Context);
4687
+ const {
4688
+ data: storedData,
4689
+ isLoading,
4690
+ setSidebarScope,
4691
+ sidebarScope
4692
+ } = useContext4(ProfitAndLoss.Context);
3971
4693
  const data = storedData ? storedData : { income: { value: NaN }, net_profit: NaN };
3972
- const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
3973
- const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
3974
- const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
3975
- return /* @__PURE__ */ React56.createElement(
4694
+ const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
4695
+ const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
4696
+ const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
4697
+ return /* @__PURE__ */ React62.createElement(
3976
4698
  "div",
3977
4699
  {
3978
4700
  className: `Layer__profit-and-loss-summaries ${vertical ? "flex-col" : ""}`
3979
4701
  },
3980
- /* @__PURE__ */ React56.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--income" }, /* @__PURE__ */ React56.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, revenueLabel), isLoading || storedData === void 0 ? /* @__PURE__ */ React56.createElement(SkeletonLoader, null) : /* @__PURE__ */ React56.createElement(
3981
- "span",
4702
+ /* @__PURE__ */ React62.createElement(
4703
+ "div",
3982
4704
  {
3983
- className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
4705
+ className: classNames22(
4706
+ "Layer__profit-and-loss-summaries__summary Layer__actionable",
4707
+ "Layer__profit-and-loss-summaries__summary--income",
4708
+ sidebarScope === "revenue" ? "active" : ""
4709
+ ),
4710
+ onClick: () => setSidebarScope("revenue")
3984
4711
  },
3985
- centsToDollars(Math.abs(data?.income?.value ?? NaN))
3986
- )),
3987
- /* @__PURE__ */ React56.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--expenses" }, /* @__PURE__ */ React56.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"), isLoading || storedData === void 0 ? /* @__PURE__ */ React56.createElement(SkeletonLoader, null) : /* @__PURE__ */ React56.createElement(
3988
- "span",
4712
+ /* @__PURE__ */ React62.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, revenueLabel),
4713
+ isLoading || storedData === void 0 ? /* @__PURE__ */ React62.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React62.createElement(SkeletonLoader, null)) : /* @__PURE__ */ React62.createElement(
4714
+ "span",
4715
+ {
4716
+ className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
4717
+ },
4718
+ centsToDollars(Math.abs(data?.income?.value ?? NaN))
4719
+ )
4720
+ ),
4721
+ /* @__PURE__ */ React62.createElement(
4722
+ "div",
3989
4723
  {
3990
- className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
4724
+ className: classNames22(
4725
+ "Layer__profit-and-loss-summaries__summary Layer__actionable",
4726
+ "Layer__profit-and-loss-summaries__summary--expenses",
4727
+ sidebarScope === "expenses" ? "active" : ""
4728
+ ),
4729
+ onClick: () => setSidebarScope("expenses")
3991
4730
  },
3992
- centsToDollars(Math.abs((data.income.value ?? 0) - data.net_profit))
3993
- )),
3994
- /* @__PURE__ */ React56.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--net-profit" }, /* @__PURE__ */ React56.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), isLoading || storedData === void 0 ? /* @__PURE__ */ React56.createElement(SkeletonLoader, null) : /* @__PURE__ */ React56.createElement(
4731
+ /* @__PURE__ */ React62.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"),
4732
+ isLoading || storedData === void 0 ? /* @__PURE__ */ React62.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React62.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ React62.createElement(
4733
+ "span",
4734
+ {
4735
+ className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
4736
+ },
4737
+ centsToDollars(Math.abs((data.income.value ?? 0) - data.net_profit))
4738
+ )
4739
+ ),
4740
+ /* @__PURE__ */ React62.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--net-profit" }, /* @__PURE__ */ React62.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), isLoading || storedData === void 0 ? /* @__PURE__ */ React62.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ React62.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ React62.createElement(
3995
4741
  "span",
3996
4742
  {
3997
4743
  className: `Layer__profit-and-loss-summaries__amount ${netProfitDirectionClass}`
@@ -4002,10 +4748,10 @@ var ProfitAndLossSummaries = ({
4002
4748
  };
4003
4749
 
4004
4750
  // src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
4005
- import React58, { useContext as useContext5 } from "react";
4751
+ import React64, { useContext as useContext5 } from "react";
4006
4752
 
4007
4753
  // src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
4008
- import React57, { useState as useState12 } from "react";
4754
+ import React63, { useState as useState14 } from "react";
4009
4755
  var ProfitAndLossRow = ({
4010
4756
  variant,
4011
4757
  lineItem,
@@ -4018,7 +4764,7 @@ var ProfitAndLossRow = ({
4018
4764
  return null;
4019
4765
  }
4020
4766
  const { value, display_name, line_items } = lineItem;
4021
- const [expanded, setExpanded] = useState12(true);
4767
+ const [expanded, setExpanded] = useState14(true);
4022
4768
  const amount = value ?? 0;
4023
4769
  const amountString = centsToDollars(Math.abs(amount));
4024
4770
  const labelClasses = [
@@ -4049,20 +4795,20 @@ var ProfitAndLossRow = ({
4049
4795
  );
4050
4796
  displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
4051
4797
  displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
4052
- return /* @__PURE__ */ React57.createElement(React57.Fragment, null, /* @__PURE__ */ React57.createElement(
4798
+ return /* @__PURE__ */ React63.createElement(React63.Fragment, null, /* @__PURE__ */ React63.createElement(
4053
4799
  "div",
4054
4800
  {
4055
4801
  className: labelClasses.join(" "),
4056
4802
  onClick: () => !lockExpanded && toggleExpanded()
4057
4803
  },
4058
- !lockExpanded && /* @__PURE__ */ React57.createElement(ChevronDown_default, { size: 16 }),
4059
- /* @__PURE__ */ React57.createElement(Text, null, display_name)
4060
- ), /* @__PURE__ */ React57.createElement("div", { className: valueClasses.join(" ") }, /* @__PURE__ */ React57.createElement(Text, null, amountString)), canGoDeeper && hasChildren && /* @__PURE__ */ React57.createElement(
4804
+ !lockExpanded && variant !== "summation" ? /* @__PURE__ */ React63.createElement(ChevronDownFill_default, { size: 16 }) : null,
4805
+ /* @__PURE__ */ React63.createElement(Text, null, display_name)
4806
+ ), /* @__PURE__ */ React63.createElement("div", { className: valueClasses.join(" ") }, /* @__PURE__ */ React63.createElement(Text, null, amountString)), canGoDeeper && hasChildren && /* @__PURE__ */ React63.createElement(
4061
4807
  "div",
4062
4808
  {
4063
4809
  className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
4064
4810
  },
4065
- /* @__PURE__ */ React57.createElement("div", { className: "Layer__profit-and-loss-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ React57.createElement(
4811
+ /* @__PURE__ */ React63.createElement("div", { className: "Layer__profit-and-loss-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ React63.createElement(
4066
4812
  ProfitAndLossRow,
4067
4813
  {
4068
4814
  key: line_item.display_name,
@@ -4128,23 +4874,23 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
4128
4874
  const { data: actualData, isLoading } = useContext5(ProfitAndLoss.Context);
4129
4875
  const data = !actualData || isLoading ? empty_profit_and_loss_report_default : actualData;
4130
4876
  if (isLoading || actualData === void 0) {
4131
- return /* @__PURE__ */ React58.createElement("div", { className: "Layer__bank-transactions__loader-container" }, /* @__PURE__ */ React58.createElement(Loader2, null));
4877
+ return /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-table__loader-container" }, /* @__PURE__ */ React64.createElement(Loader2, null));
4132
4878
  }
4133
- return /* @__PURE__ */ React58.createElement(React58.Fragment, null, /* @__PURE__ */ React58.createElement("div", { className: "Layer__profit-and-loss-table" }, /* @__PURE__ */ React58.createElement(
4879
+ return /* @__PURE__ */ React64.createElement(React64.Fragment, null, /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table--main" }, /* @__PURE__ */ React64.createElement(
4134
4880
  ProfitAndLossRow,
4135
4881
  {
4136
4882
  lineItem: data.income,
4137
4883
  direction: "CREDIT" /* CREDIT */,
4138
4884
  lockExpanded
4139
4885
  }
4140
- ), /* @__PURE__ */ React58.createElement(
4886
+ ), /* @__PURE__ */ React64.createElement(
4141
4887
  ProfitAndLossRow,
4142
4888
  {
4143
4889
  lineItem: data.cost_of_goods_sold,
4144
4890
  direction: "DEBIT" /* DEBIT */,
4145
4891
  lockExpanded
4146
4892
  }
4147
- ), /* @__PURE__ */ React58.createElement(
4893
+ ), /* @__PURE__ */ React64.createElement(
4148
4894
  ProfitAndLossRow,
4149
4895
  {
4150
4896
  lineItem: {
@@ -4155,14 +4901,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
4155
4901
  direction: "CREDIT" /* CREDIT */,
4156
4902
  lockExpanded
4157
4903
  }
4158
- ), /* @__PURE__ */ React58.createElement(
4904
+ ), /* @__PURE__ */ React64.createElement(
4159
4905
  ProfitAndLossRow,
4160
4906
  {
4161
4907
  lineItem: data.expenses,
4162
4908
  direction: "DEBIT" /* DEBIT */,
4163
4909
  lockExpanded
4164
4910
  }
4165
- ), /* @__PURE__ */ React58.createElement(
4911
+ ), /* @__PURE__ */ React64.createElement(
4166
4912
  ProfitAndLossRow,
4167
4913
  {
4168
4914
  lineItem: {
@@ -4173,14 +4919,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
4173
4919
  direction: "CREDIT" /* CREDIT */,
4174
4920
  lockExpanded
4175
4921
  }
4176
- ), /* @__PURE__ */ React58.createElement(
4922
+ ), /* @__PURE__ */ React64.createElement(
4177
4923
  ProfitAndLossRow,
4178
4924
  {
4179
4925
  lineItem: data.taxes,
4180
4926
  direction: "DEBIT" /* DEBIT */,
4181
4927
  lockExpanded
4182
4928
  }
4183
- ), /* @__PURE__ */ React58.createElement(
4929
+ ), /* @__PURE__ */ React64.createElement(
4184
4930
  ProfitAndLossRow,
4185
4931
  {
4186
4932
  lineItem: {
@@ -4191,14 +4937,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
4191
4937
  direction: "CREDIT" /* CREDIT */,
4192
4938
  lockExpanded
4193
4939
  }
4194
- )), /* @__PURE__ */ React58.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ React58.createElement(
4940
+ )), /* @__PURE__ */ React64.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ React64.createElement(
4195
4941
  ProfitAndLossRow,
4196
4942
  {
4197
4943
  lineItem: data.other_outflows,
4198
4944
  direction: "DEBIT" /* DEBIT */,
4199
4945
  lockExpanded
4200
4946
  }
4201
- ), /* @__PURE__ */ React58.createElement(
4947
+ ), /* @__PURE__ */ React64.createElement(
4202
4948
  ProfitAndLossRow,
4203
4949
  {
4204
4950
  lineItem: data.personal_expenses,
@@ -4212,6 +4958,8 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
4212
4958
  import { endOfMonth as endOfMonth4, startOfMonth as startOfMonth4 } from "date-fns";
4213
4959
  var PNLContext = createContext2({
4214
4960
  data: void 0,
4961
+ filteredData: [],
4962
+ filteredTotal: void 0,
4215
4963
  isLoading: true,
4216
4964
  isValidating: false,
4217
4965
  error: void 0,
@@ -4222,11 +4970,22 @@ var PNLContext = createContext2({
4222
4970
  changeDateRange: () => {
4223
4971
  },
4224
4972
  refetch: () => {
4973
+ },
4974
+ sidebarScope: void 0,
4975
+ setSidebarScope: () => {
4976
+ },
4977
+ sortBy: () => {
4978
+ },
4979
+ setFilterTypes: () => {
4980
+ },
4981
+ filters: {
4982
+ expenses: void 0,
4983
+ revenue: void 0
4225
4984
  }
4226
4985
  });
4227
4986
  var ProfitAndLoss = ({ children, tagFilter, reportingBasis }) => {
4228
4987
  const contextData = useProfitAndLoss({ tagFilter, reportingBasis });
4229
- return /* @__PURE__ */ React59.createElement(PNLContext.Provider, { value: contextData }, /* @__PURE__ */ React59.createElement("div", { className: "Layer__component Layer__profit-and-loss" }, children));
4988
+ return /* @__PURE__ */ React65.createElement(PNLContext.Provider, { value: contextData }, /* @__PURE__ */ React65.createElement("div", { className: "Layer__component Layer__profit-and-loss" }, children));
4230
4989
  };
4231
4990
  ProfitAndLoss.Chart = ProfitAndLossChart;
4232
4991
  ProfitAndLoss.Context = PNLContext;
@@ -4235,17 +4994,473 @@ ProfitAndLoss.Summaries = ProfitAndLossSummaries;
4235
4994
  ProfitAndLoss.Table = ProfitAndLossTable;
4236
4995
 
4237
4996
  // src/components/ProfitAndLossView/ProfitAndLossView.tsx
4238
- import React60, { useContext as useContext6 } from "react";
4239
- var COMPONENT_NAME2 = "profit-and-loss";
4240
- var ProfitAndLossView = () => {
4241
- return /* @__PURE__ */ React60.createElement(Container, { name: COMPONENT_NAME2 }, /* @__PURE__ */ React60.createElement(Header, { className: `Layer__${COMPONENT_NAME2}__header` }, /* @__PURE__ */ React60.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Profit And Loss")), /* @__PURE__ */ React60.createElement(ProfitAndLoss, null, /* @__PURE__ */ React60.createElement(Components, null)));
4997
+ import React69, { useContext as useContext7 } from "react";
4998
+
4999
+ // src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
5000
+ import React68, { useContext as useContext6, useMemo as useMemo5, useState as useState15 } from "react";
5001
+ import Select3 from "react-select";
5002
+
5003
+ // src/icons/SortArrows.tsx
5004
+ import * as React66 from "react";
5005
+ var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React66.createElement(
5006
+ "svg",
5007
+ {
5008
+ xmlns: "http://www.w3.org/2000/svg",
5009
+ viewBox: "0 0 12 13",
5010
+ fill: "none",
5011
+ ...props,
5012
+ width: size,
5013
+ height: size
5014
+ },
5015
+ /* @__PURE__ */ React66.createElement("g", { "clip-path": "url(#clip0_1758_75388)" }, /* @__PURE__ */ React66.createElement(
5016
+ "path",
5017
+ {
5018
+ d: "M1.33325 8.5L3.99992 11.1667L6.66659 8.5",
5019
+ stroke: "currentColor",
5020
+ "stroke-linecap": "round",
5021
+ "stroke-linejoin": "round",
5022
+ className: "desc-arrow"
5023
+ }
5024
+ ), /* @__PURE__ */ React66.createElement(
5025
+ "path",
5026
+ {
5027
+ d: "M4 2.5L4 11.1667",
5028
+ stroke: "currentColor",
5029
+ "stroke-linecap": "round",
5030
+ "stroke-linejoin": "round",
5031
+ className: "desc-arrow"
5032
+ }
5033
+ ), /* @__PURE__ */ React66.createElement(
5034
+ "path",
5035
+ {
5036
+ d: "M5.99988 5.16602L8.66654 2.49935L11.3332 5.16602",
5037
+ stroke: "currentColor",
5038
+ "stroke-linecap": "round",
5039
+ "stroke-linejoin": "round",
5040
+ className: "asc-arrow"
5041
+ }
5042
+ ), /* @__PURE__ */ React66.createElement(
5043
+ "path",
5044
+ {
5045
+ d: "M8.66663 11.166L8.66663 2.49935",
5046
+ stroke: "currentColor",
5047
+ "stroke-linecap": "round",
5048
+ "stroke-linejoin": "round",
5049
+ className: "asc-arrow"
5050
+ }
5051
+ )),
5052
+ /* @__PURE__ */ React66.createElement("defs", null, /* @__PURE__ */ React66.createElement("clipPath", { id: "clip0_1758_75388" }, /* @__PURE__ */ React66.createElement(
5053
+ "rect",
5054
+ {
5055
+ width: "12",
5056
+ height: "12",
5057
+ fill: "white",
5058
+ transform: "translate(0 0.5)"
5059
+ }
5060
+ )))
5061
+ );
5062
+ var SortArrows_default = SortArrows;
5063
+
5064
+ // src/icons/X.tsx
5065
+ import * as React67 from "react";
5066
+ var X = ({ size = 18, ...props }) => /* @__PURE__ */ React67.createElement(
5067
+ "svg",
5068
+ {
5069
+ xmlns: "http://www.w3.org/2000/svg",
5070
+ viewBox: "0 0 18 18",
5071
+ fill: "none",
5072
+ ...props,
5073
+ width: size,
5074
+ height: size
5075
+ },
5076
+ /* @__PURE__ */ React67.createElement(
5077
+ "path",
5078
+ {
5079
+ d: "M13.5 4.5L4.5 13.5",
5080
+ stroke: "currentColor",
5081
+ strokeLinecap: "round",
5082
+ strokeLinejoin: "round"
5083
+ }
5084
+ ),
5085
+ /* @__PURE__ */ React67.createElement(
5086
+ "path",
5087
+ {
5088
+ d: "M4.5 4.5L13.5 13.5",
5089
+ stroke: "currentColor",
5090
+ strokeLinecap: "round",
5091
+ strokeLinejoin: "round"
5092
+ }
5093
+ )
5094
+ );
5095
+ var X_default = X;
5096
+
5097
+ // src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
5098
+ import classNames23 from "classnames";
5099
+ import { format as format6 } from "date-fns";
5100
+ import {
5101
+ PieChart,
5102
+ Pie,
5103
+ Cell as Cell2,
5104
+ ResponsiveContainer as ResponsiveContainer2,
5105
+ Label,
5106
+ Text as ChartText
5107
+ } from "recharts";
5108
+ var INACTIVE_OPACITY_LEVELS = [0.85, 0.7, 0.66, 0.55, 0.4, 0.33, 0.25, 0.15];
5109
+ var DEFAULT_CHART_COLORS = [
5110
+ {
5111
+ color: "#7417B3",
5112
+ opacity: 1
5113
+ },
5114
+ {
5115
+ color: "#7417B3",
5116
+ opacity: 0.8
5117
+ },
5118
+ {
5119
+ color: "#7417B3",
5120
+ opacity: 0.6
5121
+ },
5122
+ {
5123
+ color: "#7417B3",
5124
+ opacity: 0.4
5125
+ },
5126
+ {
5127
+ color: "#7417B3",
5128
+ opacity: 0.2
5129
+ },
5130
+ {
5131
+ color: "#7417B3",
5132
+ opacity: 0.1
5133
+ },
5134
+ {
5135
+ color: "#006A80",
5136
+ opacity: 1
5137
+ },
5138
+ {
5139
+ color: "#006A80",
5140
+ opacity: 0.8
5141
+ },
5142
+ {
5143
+ color: "#006A80",
5144
+ opacity: 0.6
5145
+ },
5146
+ {
5147
+ color: "#006A80",
5148
+ opacity: 0.4
5149
+ },
5150
+ {
5151
+ color: "#006A80",
5152
+ opacity: 0.2
5153
+ },
5154
+ {
5155
+ color: "#006A80",
5156
+ opacity: 0.1
5157
+ },
5158
+ {
5159
+ color: "#009930",
5160
+ opacity: 1
5161
+ },
5162
+ {
5163
+ color: "#009930",
5164
+ opacity: 0.8
5165
+ },
5166
+ {
5167
+ color: "#009930",
5168
+ opacity: 0.6
5169
+ },
5170
+ {
5171
+ color: "#009930",
5172
+ opacity: 0.4
5173
+ },
5174
+ {
5175
+ color: "#009930",
5176
+ opacity: 0.2
5177
+ },
5178
+ {
5179
+ color: "#009930",
5180
+ opacity: 0.1
5181
+ }
5182
+ ];
5183
+ var ProfitAndLossDetailedCharts = () => {
5184
+ const {
5185
+ data,
5186
+ filteredData,
5187
+ filteredTotal,
5188
+ sortBy,
5189
+ filters,
5190
+ isLoading,
5191
+ dateRange,
5192
+ sidebarScope,
5193
+ setSidebarScope,
5194
+ setFilterTypes
5195
+ } = useContext6(ProfitAndLoss.Context);
5196
+ const [hoveredItem, setHoveredItem] = useState15();
5197
+ const chartData = useMemo5(() => {
5198
+ if (!filteredData) {
5199
+ return [];
5200
+ }
5201
+ return filteredData.map((x) => {
5202
+ if (x.hidden) {
5203
+ return {
5204
+ name: x.display_name,
5205
+ value: 0
5206
+ };
5207
+ }
5208
+ return {
5209
+ name: x.display_name,
5210
+ value: x.value
5211
+ };
5212
+ });
5213
+ }, [filteredData]);
5214
+ const buildColClass = (column) => {
5215
+ return classNames23(
5216
+ "Layer__sortable-col",
5217
+ sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
5218
+ );
5219
+ };
5220
+ return /* @__PURE__ */ React68.createElement(
5221
+ "div",
5222
+ {
5223
+ className: classNames23(
5224
+ "Layer__profit-and-loss__side-panel",
5225
+ sidebarScope && "open"
5226
+ )
5227
+ },
5228
+ /* @__PURE__ */ React68.createElement("div", { className: "Layer__profit-and-loss-detailed-charts" }, /* @__PURE__ */ React68.createElement("header", null, /* @__PURE__ */ React68.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ React68.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(sidebarScope)), /* @__PURE__ */ React68.createElement(Text, { size: "sm" /* sm */, className: "date" }, format6(dateRange.startDate, "LLLL, y"))), /* @__PURE__ */ React68.createElement(
5229
+ Button,
5230
+ {
5231
+ rightIcon: /* @__PURE__ */ React68.createElement(X_default, null),
5232
+ iconOnly: true,
5233
+ onClick: () => setSidebarScope(void 0),
5234
+ variant: "secondary" /* secondary */
5235
+ }
5236
+ )), /* @__PURE__ */ React68.createElement("div", { className: "chart-container" }, /* @__PURE__ */ React68.createElement(ResponsiveContainer2, null, /* @__PURE__ */ React68.createElement(PieChart, null, /* @__PURE__ */ React68.createElement(
5237
+ Pie,
5238
+ {
5239
+ data: chartData,
5240
+ dataKey: "value",
5241
+ nameKey: "name",
5242
+ cx: "50%",
5243
+ cy: "50%",
5244
+ innerRadius: 105,
5245
+ outerRadius: 120,
5246
+ paddingAngle: 0.5,
5247
+ fill: "#8884d8"
5248
+ },
5249
+ chartData.map((entry, index) => {
5250
+ const colorConfig = DEFAULT_CHART_COLORS[index % DEFAULT_CHART_COLORS.length];
5251
+ let fill = colorConfig.color;
5252
+ let opacity = colorConfig.opacity;
5253
+ let active = true;
5254
+ if (hoveredItem && entry.name !== hoveredItem) {
5255
+ active = false;
5256
+ fill = void 0;
5257
+ opacity = INACTIVE_OPACITY_LEVELS[index % INACTIVE_OPACITY_LEVELS.length];
5258
+ }
5259
+ return /* @__PURE__ */ React68.createElement(
5260
+ Cell2,
5261
+ {
5262
+ key: `cell-${index}`,
5263
+ className: `Layer__profit-and-loss-detailed-charts__pie ${hoveredItem && active ? "active" : "inactive"}`,
5264
+ style: { fill },
5265
+ opacity,
5266
+ onMouseEnter: () => setHoveredItem(entry.name),
5267
+ onMouseLeave: () => setHoveredItem(void 0)
5268
+ }
5269
+ );
5270
+ }),
5271
+ /* @__PURE__ */ React68.createElement(
5272
+ Label,
5273
+ {
5274
+ position: "center",
5275
+ value: "Total",
5276
+ className: "pie-center-label-title",
5277
+ content: (props) => {
5278
+ const { cx, cy } = props.viewBox ?? {
5279
+ cx: 0,
5280
+ cy: 0
5281
+ };
5282
+ const positioningProps = {
5283
+ x: cx,
5284
+ y: (cy || 0) - 15,
5285
+ textAnchor: "middle",
5286
+ verticalAnchor: "middle"
5287
+ };
5288
+ let text = "Total";
5289
+ if (hoveredItem) {
5290
+ text = hoveredItem;
5291
+ }
5292
+ return /* @__PURE__ */ React68.createElement(
5293
+ ChartText,
5294
+ {
5295
+ ...positioningProps,
5296
+ className: "pie-center-label__title"
5297
+ },
5298
+ text
5299
+ );
5300
+ }
5301
+ }
5302
+ ),
5303
+ /* @__PURE__ */ React68.createElement(
5304
+ Label,
5305
+ {
5306
+ position: "center",
5307
+ value: "Total",
5308
+ className: "pie-center-label-title",
5309
+ content: (props) => {
5310
+ const { cx, cy } = props.viewBox ?? {
5311
+ cx: 0,
5312
+ cy: 0
5313
+ };
5314
+ const positioningProps = {
5315
+ x: cx,
5316
+ y: (cy || 0) + 5,
5317
+ textAnchor: "middle",
5318
+ verticalAnchor: "middle"
5319
+ };
5320
+ let value = filteredTotal;
5321
+ if (hoveredItem) {
5322
+ value = filteredData.find(
5323
+ (x) => x.display_name === hoveredItem
5324
+ )?.value;
5325
+ }
5326
+ return /* @__PURE__ */ React68.createElement(
5327
+ ChartText,
5328
+ {
5329
+ ...positioningProps,
5330
+ className: "pie-center-label__value"
5331
+ },
5332
+ `$${centsToDollars(value)}`
5333
+ );
5334
+ }
5335
+ }
5336
+ ),
5337
+ /* @__PURE__ */ React68.createElement(
5338
+ Label,
5339
+ {
5340
+ position: "center",
5341
+ value: "Total",
5342
+ className: "pie-center-label-title",
5343
+ content: (props) => {
5344
+ const { cx, cy } = props.viewBox ?? {
5345
+ cx: 0,
5346
+ cy: 0
5347
+ };
5348
+ const positioningProps = {
5349
+ x: cx,
5350
+ y: (cy || 0) + 25,
5351
+ height: 20,
5352
+ textAnchor: "middle",
5353
+ verticalAnchor: "middle"
5354
+ };
5355
+ if (hoveredItem) {
5356
+ return /* @__PURE__ */ React68.createElement(
5357
+ ChartText,
5358
+ {
5359
+ ...positioningProps,
5360
+ className: "pie-center-label__share"
5361
+ },
5362
+ `${formatPercent(
5363
+ filteredData.find(
5364
+ (x) => x.display_name === hoveredItem
5365
+ )?.share
5366
+ )}%`
5367
+ );
5368
+ }
5369
+ return;
5370
+ }
5371
+ }
5372
+ )
5373
+ )))), /* @__PURE__ */ React68.createElement("div", { className: "filters" }, /* @__PURE__ */ React68.createElement(Text, { size: "sm" /* sm */, className: "Layer__label" }, "Filters"), /* @__PURE__ */ React68.createElement(
5374
+ Select3,
5375
+ {
5376
+ className: "type-select",
5377
+ classNamePrefix: "Layer__select",
5378
+ value: sidebarScope && filters[sidebarScope]?.types ? sidebarScope && filters[sidebarScope]?.types?.map((x) => ({
5379
+ value: x,
5380
+ label: x
5381
+ })) : [],
5382
+ isMulti: true,
5383
+ isClearable: false,
5384
+ options: [...new Set(filteredData?.map((x) => x.type))].map((x) => ({
5385
+ label: x,
5386
+ value: x
5387
+ })),
5388
+ onChange: (selected) => {
5389
+ setFilterTypes(
5390
+ sidebarScope ?? "expenses",
5391
+ selected.map((x) => x.value)
5392
+ );
5393
+ }
5394
+ }
5395
+ )), /* @__PURE__ */ React68.createElement("div", { className: "details-container" }, /* @__PURE__ */ React68.createElement("div", { className: "table" }, /* @__PURE__ */ React68.createElement("table", null, /* @__PURE__ */ React68.createElement("thead", null, /* @__PURE__ */ React68.createElement("tr", null, /* @__PURE__ */ React68.createElement(
5396
+ "th",
5397
+ {
5398
+ className: buildColClass("category"),
5399
+ onClick: () => sortBy(sidebarScope ?? "expenses", "category")
5400
+ },
5401
+ "Expense/Sale ",
5402
+ /* @__PURE__ */ React68.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
5403
+ ), /* @__PURE__ */ React68.createElement(
5404
+ "th",
5405
+ {
5406
+ className: buildColClass("type"),
5407
+ onClick: () => sortBy(sidebarScope ?? "expenses", "type")
5408
+ },
5409
+ "Type ",
5410
+ /* @__PURE__ */ React68.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
5411
+ ), /* @__PURE__ */ React68.createElement("th", null), /* @__PURE__ */ React68.createElement(
5412
+ "th",
5413
+ {
5414
+ className: buildColClass("value"),
5415
+ onClick: () => sortBy(sidebarScope ?? "expenses", "value")
5416
+ },
5417
+ "Value ",
5418
+ /* @__PURE__ */ React68.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
5419
+ ))), /* @__PURE__ */ React68.createElement("tbody", null, filteredData.filter((x) => !x.hidden).map((item, idx) => {
5420
+ const colorConfig = DEFAULT_CHART_COLORS[idx % DEFAULT_CHART_COLORS.length];
5421
+ return /* @__PURE__ */ React68.createElement(
5422
+ "tr",
5423
+ {
5424
+ key: `pl-side-table-item-${idx}`,
5425
+ className: classNames23(
5426
+ "Layer__profit-and-loss-detailed-table__row",
5427
+ hoveredItem && hoveredItem !== item.display_name ? "inactive" : ""
5428
+ ),
5429
+ onMouseEnter: () => setHoveredItem(item.display_name),
5430
+ onMouseLeave: () => setHoveredItem(void 0)
5431
+ },
5432
+ /* @__PURE__ */ React68.createElement("td", { className: "category-col" }, item.display_name),
5433
+ /* @__PURE__ */ React68.createElement("td", { className: "type-col" }, item.type),
5434
+ /* @__PURE__ */ React68.createElement("td", { className: "value-col" }, "$", centsToDollars(item.value)),
5435
+ /* @__PURE__ */ React68.createElement("td", { className: "share-col" }, /* @__PURE__ */ React68.createElement("span", { className: "share-cell-content" }, formatPercent(item.share), "%", /* @__PURE__ */ React68.createElement(
5436
+ "div",
5437
+ {
5438
+ className: "share-icon",
5439
+ style: {
5440
+ background: colorConfig.color,
5441
+ opacity: colorConfig.opacity
5442
+ }
5443
+ }
5444
+ )))
5445
+ );
5446
+ }))))))
5447
+ );
5448
+ };
5449
+
5450
+ // src/components/ProfitAndLossView/ProfitAndLossView.tsx
5451
+ var COMPONENT_NAME3 = "profit-and-loss";
5452
+ var ProfitAndLossView = (props) => {
5453
+ return /* @__PURE__ */ React69.createElement(Container, { name: COMPONENT_NAME3 }, /* @__PURE__ */ React69.createElement(ProfitAndLoss, null, /* @__PURE__ */ React69.createElement("div", { className: `Layer__${COMPONENT_NAME3}__main-panel` }, /* @__PURE__ */ React69.createElement(Header, { className: `Layer__${COMPONENT_NAME3}__header` }, /* @__PURE__ */ React69.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Profit & Loss")), /* @__PURE__ */ React69.createElement(Components, { ...props })), props.showDetailedCharts !== false && /* @__PURE__ */ React69.createElement(ProfitAndLossDetailedCharts, null)));
4242
5454
  };
4243
- var Components = () => {
4244
- const { error, isLoading, isValidating, refetch } = useContext6(
5455
+ var Components = ({
5456
+ hideChart = false,
5457
+ hideTable = false
5458
+ }) => {
5459
+ const { error, isLoading, isValidating, refetch } = useContext7(
4245
5460
  ProfitAndLoss.Context
4246
5461
  );
4247
5462
  if (!isLoading && error) {
4248
- return /* @__PURE__ */ React60.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React60.createElement(
5463
+ return /* @__PURE__ */ React69.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ React69.createElement(
4249
5464
  DataState,
4250
5465
  {
4251
5466
  status: "failed" /* failed */,
@@ -4256,24 +5471,24 @@ var Components = () => {
4256
5471
  }
4257
5472
  ));
4258
5473
  }
4259
- return /* @__PURE__ */ React60.createElement(React60.Fragment, null, /* @__PURE__ */ React60.createElement("div", { className: `Layer__${COMPONENT_NAME2}__chart_with_summaries` }, /* @__PURE__ */ React60.createElement(
5474
+ return /* @__PURE__ */ React69.createElement(React69.Fragment, null, !hideChart && /* @__PURE__ */ React69.createElement("div", { className: `Layer__${COMPONENT_NAME3}__chart_with_summaries` }, /* @__PURE__ */ React69.createElement(
4260
5475
  "div",
4261
5476
  {
4262
- className: `Layer__${COMPONENT_NAME2}__chart_with_summaries__summary-col`
5477
+ className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__summary-col`
4263
5478
  },
4264
- /* @__PURE__ */ React60.createElement(ProfitAndLoss.DatePicker, null),
4265
- /* @__PURE__ */ React60.createElement(ProfitAndLoss.Summaries, { vertical: true })
4266
- ), /* @__PURE__ */ React60.createElement(
5479
+ /* @__PURE__ */ React69.createElement(ProfitAndLoss.DatePicker, null),
5480
+ /* @__PURE__ */ React69.createElement(ProfitAndLoss.Summaries, { vertical: true })
5481
+ ), /* @__PURE__ */ React69.createElement(
4267
5482
  "div",
4268
5483
  {
4269
- className: `Layer__${COMPONENT_NAME2}__chart_with_summaries__chart-col`
5484
+ className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__chart-col`
4270
5485
  },
4271
- /* @__PURE__ */ React60.createElement(ProfitAndLoss.Chart, null)
4272
- )), /* @__PURE__ */ React60.createElement(ProfitAndLoss.Table, null));
5486
+ /* @__PURE__ */ React69.createElement(ProfitAndLoss.Chart, null)
5487
+ )), !hideTable && /* @__PURE__ */ React69.createElement(ProfitAndLoss.Table, null));
4273
5488
  };
4274
5489
 
4275
5490
  // src/providers/LayerProvider/LayerProvider.tsx
4276
- import React61, { useReducer, useEffect as useEffect5 } from "react";
5491
+ import React70, { useReducer, useEffect as useEffect9 } from "react";
4277
5492
  import { add as add2, isBefore } from "date-fns";
4278
5493
  import useSWR5, { SWRConfig } from "swr";
4279
5494
  var reducer = (state, action) => {
@@ -4338,7 +5553,7 @@ var LayerProvider = ({
4338
5553
  }),
4339
5554
  defaultSWRConfig
4340
5555
  ) : { data: void 0 };
4341
- useEffect5(() => {
5556
+ useEffect9(() => {
4342
5557
  if (businessAccessToken) {
4343
5558
  dispatch({
4344
5559
  type: "LayerContext.setAuth" /* setAuth */,
@@ -4388,11 +5603,11 @@ var LayerProvider = ({
4388
5603
  }
4389
5604
  return;
4390
5605
  };
4391
- return /* @__PURE__ */ React61.createElement(SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ React61.createElement(LayerContext.Provider, { value: { ...state, setTheme, getColor } }, children));
5606
+ return /* @__PURE__ */ React70.createElement(SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ React70.createElement(LayerContext.Provider, { value: { ...state, setTheme, getColor } }, children));
4392
5607
  };
4393
5608
 
4394
5609
  // src/components/ChartOfAccounts/ChartOfAccounts.tsx
4395
- import React64, { useState as useState14 } from "react";
5610
+ import React73, { useState as useState17 } from "react";
4396
5611
 
4397
5612
  // src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
4398
5613
  import useSWR6 from "swr";
@@ -4412,21 +5627,21 @@ var useChartOfAccounts = () => {
4412
5627
  };
4413
5628
 
4414
5629
  // src/components/ChartOfAccountsNewForm/ChartOfAccountsNewForm.tsx
4415
- import React62, { useMemo as useMemo4, useState as useState13 } from "react";
4416
- import Select3 from "react-select";
5630
+ import React71, { useMemo as useMemo6, useState as useState16 } from "react";
5631
+ import Select4 from "react-select";
4417
5632
  var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.subAccounts || [])]).flat().filter((id) => id);
4418
5633
  var ChartOfAccountsNewForm = () => {
4419
5634
  const { data, create: createAccount2 } = useChartOfAccounts();
4420
- const accountOptions = useMemo4(
5635
+ const accountOptions = useMemo6(
4421
5636
  () => flattenAccounts(data?.accounts || []).sort(
4422
5637
  (a, b) => a?.name && b?.name ? a.name.localeCompare(b.name) : 0
4423
5638
  ),
4424
5639
  [data?.accounts?.length]
4425
5640
  );
4426
- const [name, setName] = useState13("");
4427
- const [description, setDescription] = useState13("");
4428
- const [normality, setNormality] = useState13("DEBIT" /* DEBIT */);
4429
- const [parentAccount, setParentAccount] = useState13(
5641
+ const [name, setName] = useState16("");
5642
+ const [description, setDescription] = useState16("");
5643
+ const [normality, setNormality] = useState16("DEBIT" /* DEBIT */);
5644
+ const [parentAccount, setParentAccount] = useState16(
4430
5645
  data?.accounts[0]
4431
5646
  );
4432
5647
  const save = () => {
@@ -4440,22 +5655,22 @@ var ChartOfAccountsNewForm = () => {
4440
5655
  description
4441
5656
  });
4442
5657
  };
4443
- return /* @__PURE__ */ React62.createElement("div", { className: "Layer__chart-of-accounts-new-form" }, /* @__PURE__ */ React62.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React62.createElement("span", null, "Name"), /* @__PURE__ */ React62.createElement(
5658
+ return /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form" }, /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React71.createElement("span", null, "Name"), /* @__PURE__ */ React71.createElement(
4444
5659
  "input",
4445
5660
  {
4446
5661
  name: "name",
4447
5662
  value: name,
4448
5663
  onChange: (event) => setName(event.target.value)
4449
5664
  }
4450
- )), /* @__PURE__ */ React62.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React62.createElement("span", null, "Description"), /* @__PURE__ */ React62.createElement(
5665
+ )), /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React71.createElement("span", null, "Description"), /* @__PURE__ */ React71.createElement(
4451
5666
  "input",
4452
5667
  {
4453
5668
  name: "description",
4454
5669
  value: description,
4455
5670
  onChange: (event) => setDescription(event.target.value)
4456
5671
  }
4457
- )), /* @__PURE__ */ React62.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React62.createElement("span", null, "Normality"), /* @__PURE__ */ React62.createElement(
4458
- Select3,
5672
+ )), /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React71.createElement("span", null, "Normality"), /* @__PURE__ */ React71.createElement(
5673
+ Select4,
4459
5674
  {
4460
5675
  isSearchable: false,
4461
5676
  onChange: (value) => value && setNormality(value.value),
@@ -4464,8 +5679,8 @@ var ChartOfAccountsNewForm = () => {
4464
5679
  { label: "Debit", value: "DEBIT" /* DEBIT */ }
4465
5680
  ]
4466
5681
  }
4467
- )), /* @__PURE__ */ React62.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React62.createElement("span", null, "Parent Account"), /* @__PURE__ */ React62.createElement(
4468
- Select3,
5682
+ )), /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ React71.createElement("span", null, "Parent Account"), /* @__PURE__ */ React71.createElement(
5683
+ Select4,
4469
5684
  {
4470
5685
  isSearchable: true,
4471
5686
  value: parentAccount,
@@ -4474,49 +5689,49 @@ var ChartOfAccountsNewForm = () => {
4474
5689
  getOptionValue: (a) => a.id,
4475
5690
  options: accountOptions
4476
5691
  }
4477
- )), /* @__PURE__ */ React62.createElement("div", { className: "Layer__chart-of-accounts-new-form__field Layer__chart-of-accounts-new-form__field--actions" }, /* @__PURE__ */ React62.createElement("button", { onClick: save }, "Save")));
5692
+ )), /* @__PURE__ */ React71.createElement("div", { className: "Layer__chart-of-accounts-new-form__field Layer__chart-of-accounts-new-form__field--actions" }, /* @__PURE__ */ React71.createElement("button", { onClick: save }, "Save")));
4478
5693
  };
4479
5694
 
4480
5695
  // src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
4481
- import React63 from "react";
5696
+ import React72 from "react";
4482
5697
  var ChartOfAccountsRow = ({ account, depth = 0 }) => {
4483
- const classNames20 = [
5698
+ const classNames24 = [
4484
5699
  "Layer__chart-of-accounts-row__table-cell",
4485
5700
  depth > 0 && `Layer__chart-of-accounts-row__table-cell--depth-${depth}`
4486
5701
  ];
4487
- const className = classNames20.filter((id) => id).join(" ");
5702
+ const className = classNames24.filter((id) => id).join(" ");
4488
5703
  const amountClassName = account.balance < 0 ? "Layer__chart-of-accounts-row__table-cell--amount-negative" : "Layer__chart-of-accounts-row__table-cell--amount-positive";
4489
- return /* @__PURE__ */ React63.createElement(React63.Fragment, null, /* @__PURE__ */ React63.createElement(
5704
+ return /* @__PURE__ */ React72.createElement(React72.Fragment, null, /* @__PURE__ */ React72.createElement(
4490
5705
  "div",
4491
5706
  {
4492
5707
  className: `${className} Layer__chart-of-accounts-row__table-cell--name`
4493
5708
  },
4494
5709
  account.name
4495
- ), /* @__PURE__ */ React63.createElement(
5710
+ ), /* @__PURE__ */ React72.createElement(
4496
5711
  "div",
4497
5712
  {
4498
5713
  className: `${className} Layer__chart-of-accounts-row__table-cell--type`
4499
5714
  },
4500
5715
  "Assets"
4501
- ), /* @__PURE__ */ React63.createElement(
5716
+ ), /* @__PURE__ */ React72.createElement(
4502
5717
  "div",
4503
5718
  {
4504
5719
  className: `${className} Layer__chart-of-accounts-row__table-cell--subtype`
4505
5720
  },
4506
5721
  "Cash"
4507
- ), /* @__PURE__ */ React63.createElement(
5722
+ ), /* @__PURE__ */ React72.createElement(
4508
5723
  "div",
4509
5724
  {
4510
5725
  className: `${className} Layer__chart-of-accounts-row__table-cell--balance ${amountClassName}`
4511
5726
  },
4512
5727
  centsToDollars(Math.abs(account.balance || 0))
4513
- ), /* @__PURE__ */ React63.createElement(
5728
+ ), /* @__PURE__ */ React72.createElement(
4514
5729
  "div",
4515
5730
  {
4516
5731
  className: `${className} Layer__chart-of-accounts-row__table-cell--actions`
4517
5732
  },
4518
- /* @__PURE__ */ React63.createElement("button", { className: "Layer__chart-of-accounts-row__view-entries-button" }, "View Entries")
4519
- ), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */ React63.createElement(
5733
+ /* @__PURE__ */ React72.createElement("button", { className: "Layer__chart-of-accounts-row__view-entries-button" }, "View Entries")
5734
+ ), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */ React72.createElement(
4520
5735
  ChartOfAccountsRow,
4521
5736
  {
4522
5737
  key: subAccount.id,
@@ -4529,15 +5744,15 @@ var ChartOfAccountsRow = ({ account, depth = 0 }) => {
4529
5744
  // src/components/ChartOfAccounts/ChartOfAccounts.tsx
4530
5745
  var ChartOfAccounts = () => {
4531
5746
  const { data, isLoading } = useChartOfAccounts();
4532
- const [showingForm, setShowingForm] = useState14(false);
4533
- return /* @__PURE__ */ React64.createElement("div", { className: "Layer__component Layer__chart-of-accounts" }, !data || isLoading ? "Loading." : /* @__PURE__ */ React64.createElement(React64.Fragment, null, /* @__PURE__ */ React64.createElement("div", { className: "Layer__chart-of-accounts__header" }, /* @__PURE__ */ React64.createElement("h2", { className: "Layer__chart-of-accounts__title" }, "Chart of Accounts"), /* @__PURE__ */ React64.createElement("div", { className: "Layer__chart-of-accounts__actions" }, /* @__PURE__ */ React64.createElement("button", { className: "Layer__chart-of-accounts__download-button" }, /* @__PURE__ */ React64.createElement(DownloadCloud_default, null), "Download"), /* @__PURE__ */ React64.createElement(
5747
+ const [showingForm, setShowingForm] = useState17(false);
5748
+ return /* @__PURE__ */ React73.createElement("div", { className: "Layer__component Layer__chart-of-accounts" }, !data || isLoading ? "Loading." : /* @__PURE__ */ React73.createElement(React73.Fragment, null, /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__header" }, /* @__PURE__ */ React73.createElement("h2", { className: "Layer__chart-of-accounts__title" }, "Chart of Accounts"), /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__actions" }, /* @__PURE__ */ React73.createElement("button", { className: "Layer__chart-of-accounts__download-button" }, /* @__PURE__ */ React73.createElement(DownloadCloud_default, null), "Download"), /* @__PURE__ */ React73.createElement(
4534
5749
  "button",
4535
5750
  {
4536
5751
  className: "Layer__chart-of-accounts__edit-accounts-button",
4537
5752
  onClick: () => setShowingForm(!showingForm)
4538
5753
  },
4539
5754
  "Edit Accounts"
4540
- ))), showingForm && /* @__PURE__ */ React64.createElement(ChartOfAccountsNewForm, null), /* @__PURE__ */ React64.createElement("div", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ React64.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Name"), /* @__PURE__ */ React64.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Type"), /* @__PURE__ */ React64.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Sub-Type"), /* @__PURE__ */ React64.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header Layer__chart-of-accounts__table-cell--header-balance" }, "Balance"), /* @__PURE__ */ React64.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }), data.accounts.map((account) => /* @__PURE__ */ React64.createElement(
5755
+ ))), showingForm && /* @__PURE__ */ React73.createElement(ChartOfAccountsNewForm, null), /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Name"), /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Type"), /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Sub-Type"), /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header Layer__chart-of-accounts__table-cell--header-balance" }, "Balance"), /* @__PURE__ */ React73.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }), data.accounts.map((account) => /* @__PURE__ */ React73.createElement(
4541
5756
  ChartOfAccountsRow,
4542
5757
  {
4543
5758
  key: account.id,
@@ -4552,6 +5767,7 @@ export {
4552
5767
  ChartOfAccounts,
4553
5768
  Hello,
4554
5769
  LayerProvider,
5770
+ LinkedAccounts,
4555
5771
  ProfitAndLoss,
4556
5772
  ProfitAndLossView
4557
5773
  };