@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 +1950 -734
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +209 -17
- package/dist/index.js +2009 -799
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +896 -52
- package/dist/styles/index.css.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -35,6 +35,7 @@ __export(src_exports, {
|
|
|
35
35
|
ChartOfAccounts: () => ChartOfAccounts,
|
|
36
36
|
Hello: () => Hello,
|
|
37
37
|
LayerProvider: () => LayerProvider,
|
|
38
|
+
LinkedAccounts: () => LinkedAccounts,
|
|
38
39
|
ProfitAndLoss: () => ProfitAndLoss,
|
|
39
40
|
ProfitAndLossView: () => ProfitAndLossView
|
|
40
41
|
});
|
|
@@ -605,7 +606,7 @@ var BalanceSheet = () => {
|
|
|
605
606
|
};
|
|
606
607
|
|
|
607
608
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
608
|
-
var
|
|
609
|
+
var import_react42 = __toESM(require("react"));
|
|
609
610
|
|
|
610
611
|
// src/config/general.ts
|
|
611
612
|
var DATE_FORMAT = "LLL d, yyyy";
|
|
@@ -745,15 +746,97 @@ function hasSuggestions(categorization) {
|
|
|
745
746
|
return categorization.suggestions !== void 0;
|
|
746
747
|
}
|
|
747
748
|
|
|
749
|
+
// src/utils/helpers.ts
|
|
750
|
+
var range = (start, end) => {
|
|
751
|
+
let length = end - start + 1;
|
|
752
|
+
return Array.from({ length }, (_, idx) => idx + start);
|
|
753
|
+
};
|
|
754
|
+
var debounce = (fnc, timeout = 300) => {
|
|
755
|
+
let timer;
|
|
756
|
+
return (...args) => {
|
|
757
|
+
clearTimeout(timer);
|
|
758
|
+
timer = setTimeout(() => {
|
|
759
|
+
fnc.apply(void 0, args);
|
|
760
|
+
}, timeout);
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
|
|
748
764
|
// src/components/BankTransactionListItem/BankTransactionListItem.tsx
|
|
749
|
-
var
|
|
765
|
+
var import_react35 = __toESM(require("react"));
|
|
766
|
+
|
|
767
|
+
// src/icons/ChevronDownFill.tsx
|
|
768
|
+
var React8 = __toESM(require("react"));
|
|
769
|
+
var ChevronDownFill = ({ size = 18, ...props }) => /* @__PURE__ */ React8.createElement(
|
|
770
|
+
"svg",
|
|
771
|
+
{
|
|
772
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
773
|
+
viewBox: "0 0 18 18",
|
|
774
|
+
fill: "none",
|
|
775
|
+
...props,
|
|
776
|
+
width: size,
|
|
777
|
+
height: size
|
|
778
|
+
},
|
|
779
|
+
/* @__PURE__ */ React8.createElement("path", { d: "M4.5 6.75L9 11.25L13.5 6.75", fill: "currentColor" }),
|
|
780
|
+
/* @__PURE__ */ React8.createElement(
|
|
781
|
+
"path",
|
|
782
|
+
{
|
|
783
|
+
d: "M4.5 6.75L9 11.25L13.5 6.75H4.5Z",
|
|
784
|
+
stroke: "currentColor",
|
|
785
|
+
strokeLinecap: "round",
|
|
786
|
+
strokeLinejoin: "round"
|
|
787
|
+
}
|
|
788
|
+
)
|
|
789
|
+
);
|
|
790
|
+
var ChevronDownFill_default = ChevronDownFill;
|
|
750
791
|
|
|
751
792
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
752
|
-
var
|
|
793
|
+
var import_react33 = __toESM(require("react"));
|
|
794
|
+
|
|
795
|
+
// src/icons/AlertCircle.tsx
|
|
796
|
+
var React9 = __toESM(require("react"));
|
|
797
|
+
var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React9.createElement(
|
|
798
|
+
"svg",
|
|
799
|
+
{
|
|
800
|
+
viewBox: "0 0 18 18",
|
|
801
|
+
fill: "none",
|
|
802
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
803
|
+
...props,
|
|
804
|
+
width: size,
|
|
805
|
+
height: size
|
|
806
|
+
},
|
|
807
|
+
/* @__PURE__ */ React9.createElement(
|
|
808
|
+
"path",
|
|
809
|
+
{
|
|
810
|
+
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",
|
|
811
|
+
stroke: "currentColor",
|
|
812
|
+
strokeLinecap: "round",
|
|
813
|
+
strokeLinejoin: "round"
|
|
814
|
+
}
|
|
815
|
+
),
|
|
816
|
+
/* @__PURE__ */ React9.createElement(
|
|
817
|
+
"path",
|
|
818
|
+
{
|
|
819
|
+
d: "M9 6V9",
|
|
820
|
+
stroke: "currentColor",
|
|
821
|
+
strokeLinecap: "round",
|
|
822
|
+
strokeLinejoin: "round"
|
|
823
|
+
}
|
|
824
|
+
),
|
|
825
|
+
/* @__PURE__ */ React9.createElement(
|
|
826
|
+
"path",
|
|
827
|
+
{
|
|
828
|
+
d: "M9 12H9.0075",
|
|
829
|
+
stroke: "currentColor",
|
|
830
|
+
strokeLinecap: "round",
|
|
831
|
+
strokeLinejoin: "round"
|
|
832
|
+
}
|
|
833
|
+
)
|
|
834
|
+
);
|
|
835
|
+
var AlertCircle_default = AlertCircle;
|
|
753
836
|
|
|
754
837
|
// src/icons/Scissors.tsx
|
|
755
|
-
var
|
|
756
|
-
var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */
|
|
838
|
+
var React10 = __toESM(require("react"));
|
|
839
|
+
var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React10.createElement(
|
|
757
840
|
"svg",
|
|
758
841
|
{
|
|
759
842
|
viewBox: "0 0 11 11",
|
|
@@ -763,7 +846,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
763
846
|
width: size,
|
|
764
847
|
height: size
|
|
765
848
|
},
|
|
766
|
-
/* @__PURE__ */
|
|
849
|
+
/* @__PURE__ */ React10.createElement(
|
|
767
850
|
"path",
|
|
768
851
|
{
|
|
769
852
|
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",
|
|
@@ -771,7 +854,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
771
854
|
strokeLinecap: "round",
|
|
772
855
|
strokeLinejoin: "round"
|
|
773
856
|
},
|
|
774
|
-
/* @__PURE__ */
|
|
857
|
+
/* @__PURE__ */ React10.createElement(
|
|
775
858
|
"animate",
|
|
776
859
|
{
|
|
777
860
|
attributeName: "d",
|
|
@@ -786,7 +869,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
786
869
|
}
|
|
787
870
|
)
|
|
788
871
|
),
|
|
789
|
-
/* @__PURE__ */
|
|
872
|
+
/* @__PURE__ */ React10.createElement(
|
|
790
873
|
"path",
|
|
791
874
|
{
|
|
792
875
|
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",
|
|
@@ -794,7 +877,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
794
877
|
strokeLinecap: "round",
|
|
795
878
|
strokeLinejoin: "round"
|
|
796
879
|
},
|
|
797
|
-
/* @__PURE__ */
|
|
880
|
+
/* @__PURE__ */ React10.createElement(
|
|
798
881
|
"animate",
|
|
799
882
|
{
|
|
800
883
|
attributeName: "d",
|
|
@@ -809,7 +892,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
809
892
|
}
|
|
810
893
|
)
|
|
811
894
|
),
|
|
812
|
-
/* @__PURE__ */
|
|
895
|
+
/* @__PURE__ */ React10.createElement(
|
|
813
896
|
"path",
|
|
814
897
|
{
|
|
815
898
|
d: "M9.16668 1.83325L3.72168 7.27825",
|
|
@@ -817,7 +900,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
817
900
|
strokeLinecap: "round",
|
|
818
901
|
strokeLinejoin: "round"
|
|
819
902
|
},
|
|
820
|
-
/* @__PURE__ */
|
|
903
|
+
/* @__PURE__ */ React10.createElement(
|
|
821
904
|
"animate",
|
|
822
905
|
{
|
|
823
906
|
attributeName: "d",
|
|
@@ -832,7 +915,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
832
915
|
}
|
|
833
916
|
)
|
|
834
917
|
),
|
|
835
|
-
/* @__PURE__ */
|
|
918
|
+
/* @__PURE__ */ React10.createElement(
|
|
836
919
|
"path",
|
|
837
920
|
{
|
|
838
921
|
d: "M6.63232 6.63672L9.16691 9.16672",
|
|
@@ -840,7 +923,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
840
923
|
strokeLinecap: "round",
|
|
841
924
|
strokeLinejoin: "round"
|
|
842
925
|
},
|
|
843
|
-
/* @__PURE__ */
|
|
926
|
+
/* @__PURE__ */ React10.createElement(
|
|
844
927
|
"animate",
|
|
845
928
|
{
|
|
846
929
|
attributeName: "d",
|
|
@@ -855,7 +938,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
855
938
|
}
|
|
856
939
|
)
|
|
857
940
|
),
|
|
858
|
-
/* @__PURE__ */
|
|
941
|
+
/* @__PURE__ */ React10.createElement(
|
|
859
942
|
"path",
|
|
860
943
|
{
|
|
861
944
|
d: "M3.72168 3.72168L5.50001 5.50001",
|
|
@@ -863,7 +946,7 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
863
946
|
strokeLinecap: "round",
|
|
864
947
|
strokeLinejoin: "round"
|
|
865
948
|
},
|
|
866
|
-
/* @__PURE__ */
|
|
949
|
+
/* @__PURE__ */ React10.createElement(
|
|
867
950
|
"animate",
|
|
868
951
|
{
|
|
869
952
|
attributeName: "d",
|
|
@@ -881,41 +964,8 @@ var Scissors = ({ size = 11, ...props }) => /* @__PURE__ */ React8.createElement
|
|
|
881
964
|
);
|
|
882
965
|
var Scissors_default = Scissors;
|
|
883
966
|
|
|
884
|
-
// src/icons/X.tsx
|
|
885
|
-
var React9 = __toESM(require("react"));
|
|
886
|
-
var X = ({ size = 18, ...props }) => /* @__PURE__ */ React9.createElement(
|
|
887
|
-
"svg",
|
|
888
|
-
{
|
|
889
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
890
|
-
viewBox: "0 0 18 18",
|
|
891
|
-
fill: "none",
|
|
892
|
-
...props,
|
|
893
|
-
width: size,
|
|
894
|
-
height: size
|
|
895
|
-
},
|
|
896
|
-
/* @__PURE__ */ React9.createElement(
|
|
897
|
-
"path",
|
|
898
|
-
{
|
|
899
|
-
d: "M13.5 4.5L4.5 13.5",
|
|
900
|
-
stroke: "currentColor",
|
|
901
|
-
strokeLinecap: "round",
|
|
902
|
-
strokeLinejoin: "round"
|
|
903
|
-
}
|
|
904
|
-
),
|
|
905
|
-
/* @__PURE__ */ React9.createElement(
|
|
906
|
-
"path",
|
|
907
|
-
{
|
|
908
|
-
d: "M4.5 4.5L13.5 13.5",
|
|
909
|
-
stroke: "currentColor",
|
|
910
|
-
strokeLinecap: "round",
|
|
911
|
-
strokeLinejoin: "round"
|
|
912
|
-
}
|
|
913
|
-
)
|
|
914
|
-
);
|
|
915
|
-
var X_default = X;
|
|
916
|
-
|
|
917
967
|
// src/components/Badge/Badge.tsx
|
|
918
|
-
var
|
|
968
|
+
var import_react17 = __toESM(require("react"));
|
|
919
969
|
|
|
920
970
|
// src/components/Button/Button.tsx
|
|
921
971
|
var import_react8 = __toESM(require("react"));
|
|
@@ -928,16 +978,19 @@ var Button = ({
|
|
|
928
978
|
rightIcon,
|
|
929
979
|
iconOnly,
|
|
930
980
|
iconAsPrimary = false,
|
|
981
|
+
justify = "center",
|
|
931
982
|
...props
|
|
932
983
|
}) => {
|
|
933
984
|
const buttonRef = (0, import_react8.useRef)(null);
|
|
934
|
-
let
|
|
935
|
-
if (
|
|
936
|
-
|
|
985
|
+
let justifyContent = "center";
|
|
986
|
+
if (justify) {
|
|
987
|
+
justifyContent = justify;
|
|
988
|
+
} else if (leftIcon && rightIcon) {
|
|
989
|
+
justifyContent = "space-between";
|
|
937
990
|
} else if (rightIcon) {
|
|
938
|
-
|
|
991
|
+
justifyContent = "space-between";
|
|
939
992
|
} else if (leftIcon) {
|
|
940
|
-
|
|
993
|
+
justifyContent = "start";
|
|
941
994
|
}
|
|
942
995
|
const baseClassName = (0, import_classnames.default)(
|
|
943
996
|
"Layer__btn",
|
|
@@ -961,7 +1014,7 @@ var Button = ({
|
|
|
961
1014
|
onMouseLeave: stopAnimation,
|
|
962
1015
|
ref: buttonRef
|
|
963
1016
|
},
|
|
964
|
-
/* @__PURE__ */ import_react8.default.createElement("span", { className: `Layer__btn-content Layer__justify--${
|
|
1017
|
+
/* @__PURE__ */ import_react8.default.createElement("span", { className: `Layer__btn-content Layer__justify--${justifyContent}` }, leftIcon && /* @__PURE__ */ import_react8.default.createElement(
|
|
965
1018
|
"span",
|
|
966
1019
|
{
|
|
967
1020
|
className: (0, import_classnames.default)(
|
|
@@ -983,12 +1036,30 @@ var Button = ({
|
|
|
983
1036
|
);
|
|
984
1037
|
};
|
|
985
1038
|
|
|
986
|
-
// src/components/Button/
|
|
987
|
-
var
|
|
1039
|
+
// src/components/Button/IconButton.tsx
|
|
1040
|
+
var import_react9 = __toESM(require("react"));
|
|
1041
|
+
var import_classnames2 = __toESM(require("classnames"));
|
|
1042
|
+
var IconButton = ({
|
|
1043
|
+
className,
|
|
1044
|
+
children,
|
|
1045
|
+
icon,
|
|
1046
|
+
active,
|
|
1047
|
+
...props
|
|
1048
|
+
}) => {
|
|
1049
|
+
const baseClassName = (0, import_classnames2.default)(
|
|
1050
|
+
"Layer__icon-btn",
|
|
1051
|
+
`Layer__icon-btn--${active ? "active" : "inactive"}`,
|
|
1052
|
+
className
|
|
1053
|
+
);
|
|
1054
|
+
return /* @__PURE__ */ import_react9.default.createElement("button", { ...props, className: baseClassName }, icon);
|
|
1055
|
+
};
|
|
988
1056
|
|
|
989
|
-
// src/
|
|
990
|
-
var
|
|
991
|
-
|
|
1057
|
+
// src/components/Button/RetryButton.tsx
|
|
1058
|
+
var import_react10 = __toESM(require("react"));
|
|
1059
|
+
|
|
1060
|
+
// src/icons/RefreshCcw.tsx
|
|
1061
|
+
var React13 = __toESM(require("react"));
|
|
1062
|
+
var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React13.createElement(
|
|
992
1063
|
"svg",
|
|
993
1064
|
{
|
|
994
1065
|
viewBox: "0 0 18 18",
|
|
@@ -998,63 +1069,71 @@ var AlertCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React11.createEle
|
|
|
998
1069
|
width: size,
|
|
999
1070
|
height: size
|
|
1000
1071
|
},
|
|
1001
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ React13.createElement(
|
|
1002
1073
|
"path",
|
|
1003
1074
|
{
|
|
1004
|
-
d: "
|
|
1075
|
+
d: "M0.75 3V7.5H5.25",
|
|
1005
1076
|
stroke: "currentColor",
|
|
1006
1077
|
strokeLinecap: "round",
|
|
1007
1078
|
strokeLinejoin: "round"
|
|
1008
1079
|
}
|
|
1009
1080
|
),
|
|
1010
|
-
/* @__PURE__ */
|
|
1081
|
+
/* @__PURE__ */ React13.createElement(
|
|
1011
1082
|
"path",
|
|
1012
1083
|
{
|
|
1013
|
-
d: "
|
|
1084
|
+
d: "M17.25 15V10.5H12.75",
|
|
1014
1085
|
stroke: "currentColor",
|
|
1015
1086
|
strokeLinecap: "round",
|
|
1016
1087
|
strokeLinejoin: "round"
|
|
1017
1088
|
}
|
|
1018
1089
|
),
|
|
1019
|
-
/* @__PURE__ */
|
|
1090
|
+
/* @__PURE__ */ React13.createElement(
|
|
1020
1091
|
"path",
|
|
1021
1092
|
{
|
|
1022
|
-
d: "
|
|
1093
|
+
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",
|
|
1023
1094
|
stroke: "currentColor",
|
|
1024
1095
|
strokeLinecap: "round",
|
|
1025
1096
|
strokeLinejoin: "round"
|
|
1026
1097
|
}
|
|
1027
1098
|
)
|
|
1028
1099
|
);
|
|
1029
|
-
var
|
|
1100
|
+
var RefreshCcw_default = RefreshCcw;
|
|
1030
1101
|
|
|
1031
|
-
// src/
|
|
1032
|
-
var
|
|
1033
|
-
var
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1102
|
+
// src/components/Button/RetryButton.tsx
|
|
1103
|
+
var import_classnames3 = __toESM(require("classnames"));
|
|
1104
|
+
var RetryButton = ({
|
|
1105
|
+
className,
|
|
1106
|
+
processing,
|
|
1107
|
+
disabled,
|
|
1108
|
+
error,
|
|
1109
|
+
children,
|
|
1110
|
+
...props
|
|
1111
|
+
}) => {
|
|
1112
|
+
const baseClassName = (0, import_classnames3.default)(
|
|
1113
|
+
"Layer__retry-btn",
|
|
1114
|
+
processing ? "Layer__btn--processing" : "",
|
|
1115
|
+
className
|
|
1116
|
+
);
|
|
1117
|
+
return /* @__PURE__ */ import_react10.default.createElement(
|
|
1118
|
+
Button,
|
|
1045
1119
|
{
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1120
|
+
...props,
|
|
1121
|
+
className: baseClassName,
|
|
1122
|
+
variant: "secondary" /* secondary */,
|
|
1123
|
+
disabled: processing || disabled,
|
|
1124
|
+
rightIcon: /* @__PURE__ */ import_react10.default.createElement(RefreshCcw_default, { size: 12 }),
|
|
1125
|
+
justify: "center"
|
|
1126
|
+
},
|
|
1127
|
+
children
|
|
1128
|
+
);
|
|
1129
|
+
};
|
|
1130
|
+
|
|
1131
|
+
// src/components/Button/SubmitButton.tsx
|
|
1132
|
+
var import_react15 = __toESM(require("react"));
|
|
1054
1133
|
|
|
1055
1134
|
// src/icons/CheckCircle.tsx
|
|
1056
|
-
var
|
|
1057
|
-
var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
1135
|
+
var React15 = __toESM(require("react"));
|
|
1136
|
+
var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
|
|
1058
1137
|
"svg",
|
|
1059
1138
|
{
|
|
1060
1139
|
viewBox: "0 0 18 18",
|
|
@@ -1064,7 +1143,7 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React13.createEle
|
|
|
1064
1143
|
width: size,
|
|
1065
1144
|
height: size
|
|
1066
1145
|
},
|
|
1067
|
-
/* @__PURE__ */
|
|
1146
|
+
/* @__PURE__ */ React15.createElement(
|
|
1068
1147
|
"path",
|
|
1069
1148
|
{
|
|
1070
1149
|
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",
|
|
@@ -1073,7 +1152,7 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React13.createEle
|
|
|
1073
1152
|
strokeLinejoin: "round"
|
|
1074
1153
|
}
|
|
1075
1154
|
),
|
|
1076
|
-
/* @__PURE__ */
|
|
1155
|
+
/* @__PURE__ */ React15.createElement(
|
|
1077
1156
|
"path",
|
|
1078
1157
|
{
|
|
1079
1158
|
d: "M16.5 3L9 10.5075L6.75 8.2575",
|
|
@@ -1086,8 +1165,8 @@ var CheckCircle = ({ size = 18, ...props }) => /* @__PURE__ */ React13.createEle
|
|
|
1086
1165
|
var CheckCircle_default = CheckCircle;
|
|
1087
1166
|
|
|
1088
1167
|
// src/icons/Loader.tsx
|
|
1089
|
-
var
|
|
1090
|
-
var Loader = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
1168
|
+
var React16 = __toESM(require("react"));
|
|
1169
|
+
var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React16.createElement(
|
|
1091
1170
|
"svg",
|
|
1092
1171
|
{
|
|
1093
1172
|
viewBox: "0 0 18 18",
|
|
@@ -1097,7 +1176,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
|
|
|
1097
1176
|
width: size,
|
|
1098
1177
|
height: size
|
|
1099
1178
|
},
|
|
1100
|
-
/* @__PURE__ */
|
|
1179
|
+
/* @__PURE__ */ React16.createElement(
|
|
1101
1180
|
"path",
|
|
1102
1181
|
{
|
|
1103
1182
|
d: "M9 1.5V4.5",
|
|
@@ -1106,7 +1185,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
|
|
|
1106
1185
|
strokeLinejoin: "round"
|
|
1107
1186
|
}
|
|
1108
1187
|
),
|
|
1109
|
-
/* @__PURE__ */
|
|
1188
|
+
/* @__PURE__ */ React16.createElement(
|
|
1110
1189
|
"path",
|
|
1111
1190
|
{
|
|
1112
1191
|
d: "M9 13.5V16.5",
|
|
@@ -1115,7 +1194,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
|
|
|
1115
1194
|
strokeLinejoin: "round"
|
|
1116
1195
|
}
|
|
1117
1196
|
),
|
|
1118
|
-
/* @__PURE__ */
|
|
1197
|
+
/* @__PURE__ */ React16.createElement(
|
|
1119
1198
|
"path",
|
|
1120
1199
|
{
|
|
1121
1200
|
d: "M3.6975 3.6975L5.82 5.82",
|
|
@@ -1124,7 +1203,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
|
|
|
1124
1203
|
strokeLinejoin: "round"
|
|
1125
1204
|
}
|
|
1126
1205
|
),
|
|
1127
|
-
/* @__PURE__ */
|
|
1206
|
+
/* @__PURE__ */ React16.createElement(
|
|
1128
1207
|
"path",
|
|
1129
1208
|
{
|
|
1130
1209
|
d: "M12.18 12.18L14.3025 14.3025",
|
|
@@ -1133,7 +1212,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
|
|
|
1133
1212
|
strokeLinejoin: "round"
|
|
1134
1213
|
}
|
|
1135
1214
|
),
|
|
1136
|
-
/* @__PURE__ */
|
|
1215
|
+
/* @__PURE__ */ React16.createElement(
|
|
1137
1216
|
"path",
|
|
1138
1217
|
{
|
|
1139
1218
|
d: "M1.5 9H4.5",
|
|
@@ -1142,7 +1221,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
|
|
|
1142
1221
|
strokeLinejoin: "round"
|
|
1143
1222
|
}
|
|
1144
1223
|
),
|
|
1145
|
-
/* @__PURE__ */
|
|
1224
|
+
/* @__PURE__ */ React16.createElement(
|
|
1146
1225
|
"path",
|
|
1147
1226
|
{
|
|
1148
1227
|
d: "M13.5 9H16.5",
|
|
@@ -1151,7 +1230,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
|
|
|
1151
1230
|
strokeLinejoin: "round"
|
|
1152
1231
|
}
|
|
1153
1232
|
),
|
|
1154
|
-
/* @__PURE__ */
|
|
1233
|
+
/* @__PURE__ */ React16.createElement(
|
|
1155
1234
|
"path",
|
|
1156
1235
|
{
|
|
1157
1236
|
d: "M3.6975 14.3025L5.82 12.18",
|
|
@@ -1160,7 +1239,7 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
|
|
|
1160
1239
|
strokeLinejoin: "round"
|
|
1161
1240
|
}
|
|
1162
1241
|
),
|
|
1163
|
-
/* @__PURE__ */
|
|
1242
|
+
/* @__PURE__ */ React16.createElement(
|
|
1164
1243
|
"path",
|
|
1165
1244
|
{
|
|
1166
1245
|
d: "M12.18 5.82L14.3025 3.6975",
|
|
@@ -1173,8 +1252,8 @@ var Loader = ({ size = 18, ...props }) => /* @__PURE__ */ React14.createElement(
|
|
|
1173
1252
|
var Loader_default = Loader;
|
|
1174
1253
|
|
|
1175
1254
|
// src/icons/Save.tsx
|
|
1176
|
-
var
|
|
1177
|
-
var Save = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
1255
|
+
var React17 = __toESM(require("react"));
|
|
1256
|
+
var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React17.createElement(
|
|
1178
1257
|
"svg",
|
|
1179
1258
|
{
|
|
1180
1259
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1184,7 +1263,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
|
|
|
1184
1263
|
width: size,
|
|
1185
1264
|
height: size
|
|
1186
1265
|
},
|
|
1187
|
-
/* @__PURE__ */
|
|
1266
|
+
/* @__PURE__ */ React17.createElement(
|
|
1188
1267
|
"path",
|
|
1189
1268
|
{
|
|
1190
1269
|
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",
|
|
@@ -1193,7 +1272,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
|
|
|
1193
1272
|
strokeLinejoin: "round"
|
|
1194
1273
|
}
|
|
1195
1274
|
),
|
|
1196
|
-
/* @__PURE__ */
|
|
1275
|
+
/* @__PURE__ */ React17.createElement(
|
|
1197
1276
|
"path",
|
|
1198
1277
|
{
|
|
1199
1278
|
d: "M12.75 15.75V9.75H5.25V15.75",
|
|
@@ -1202,7 +1281,7 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
|
|
|
1202
1281
|
strokeLinejoin: "round"
|
|
1203
1282
|
}
|
|
1204
1283
|
),
|
|
1205
|
-
/* @__PURE__ */
|
|
1284
|
+
/* @__PURE__ */ React17.createElement(
|
|
1206
1285
|
"path",
|
|
1207
1286
|
{
|
|
1208
1287
|
d: "M5.25 2.25V6H11.25",
|
|
@@ -1215,14 +1294,14 @@ var Save = ({ size = 18, ...props }) => /* @__PURE__ */ React15.createElement(
|
|
|
1215
1294
|
var Save_default = Save;
|
|
1216
1295
|
|
|
1217
1296
|
// src/components/Tooltip/Tooltip.tsx
|
|
1218
|
-
var
|
|
1297
|
+
var import_react13 = __toESM(require("react"));
|
|
1219
1298
|
|
|
1220
1299
|
// src/components/Tooltip/useTooltip.ts
|
|
1221
|
-
var
|
|
1222
|
-
var
|
|
1223
|
-
var TooltipContext =
|
|
1300
|
+
var import_react11 = __toESM(require("react"));
|
|
1301
|
+
var import_react12 = require("@floating-ui/react");
|
|
1302
|
+
var TooltipContext = import_react11.default.createContext(null);
|
|
1224
1303
|
var useTooltipContext = () => {
|
|
1225
|
-
const context =
|
|
1304
|
+
const context = import_react11.default.useContext(TooltipContext);
|
|
1226
1305
|
if (context == null) {
|
|
1227
1306
|
throw new Error("Tooltip components must be wrapped in <Tooltip />");
|
|
1228
1307
|
}
|
|
@@ -1237,36 +1316,36 @@ var useTooltip = ({
|
|
|
1237
1316
|
offset: offsetProp = 5,
|
|
1238
1317
|
shift: shiftProp = { padding: 5 }
|
|
1239
1318
|
} = {}) => {
|
|
1240
|
-
const [uncontrolledOpen, setUncontrolledOpen] = (0,
|
|
1319
|
+
const [uncontrolledOpen, setUncontrolledOpen] = (0, import_react11.useState)(initialOpen);
|
|
1241
1320
|
const open = controlledOpen ?? uncontrolledOpen;
|
|
1242
1321
|
const setOpen = setControlledOpen ?? setUncontrolledOpen;
|
|
1243
|
-
const data = (0,
|
|
1322
|
+
const data = (0, import_react12.useFloating)({
|
|
1244
1323
|
placement,
|
|
1245
1324
|
open: disabled ? false : open,
|
|
1246
1325
|
onOpenChange: setOpen,
|
|
1247
|
-
whileElementsMounted:
|
|
1326
|
+
whileElementsMounted: import_react12.autoUpdate,
|
|
1248
1327
|
middleware: [
|
|
1249
|
-
(0,
|
|
1250
|
-
(0,
|
|
1328
|
+
(0, import_react12.offset)(offsetProp),
|
|
1329
|
+
(0, import_react12.flip)({
|
|
1251
1330
|
crossAxis: placement.includes("-"),
|
|
1252
1331
|
fallbackAxisSideDirection: "start",
|
|
1253
1332
|
padding: shiftProp?.padding ?? 5
|
|
1254
1333
|
}),
|
|
1255
|
-
(0,
|
|
1334
|
+
(0, import_react12.shift)(shiftProp)
|
|
1256
1335
|
]
|
|
1257
1336
|
});
|
|
1258
1337
|
const context = data.context;
|
|
1259
|
-
const hover = (0,
|
|
1338
|
+
const hover = (0, import_react12.useHover)(context, {
|
|
1260
1339
|
move: false,
|
|
1261
1340
|
enabled: controlledOpen == null
|
|
1262
1341
|
});
|
|
1263
|
-
const focus = (0,
|
|
1342
|
+
const focus = (0, import_react12.useFocus)(context, {
|
|
1264
1343
|
enabled: controlledOpen == null
|
|
1265
1344
|
});
|
|
1266
|
-
const dismiss = (0,
|
|
1267
|
-
const role = (0,
|
|
1268
|
-
const interactions = (0,
|
|
1269
|
-
const { isMounted, styles } = (0,
|
|
1345
|
+
const dismiss = (0, import_react12.useDismiss)(context);
|
|
1346
|
+
const role = (0, import_react12.useRole)(context, { role: "tooltip" });
|
|
1347
|
+
const interactions = (0, import_react12.useInteractions)([hover, focus, dismiss, role]);
|
|
1348
|
+
const { isMounted, styles } = (0, import_react12.useTransitionStyles)(context, {
|
|
1270
1349
|
initial: {
|
|
1271
1350
|
opacity: 0,
|
|
1272
1351
|
transform: "scale(0.7)",
|
|
@@ -1274,7 +1353,7 @@ var useTooltip = ({
|
|
|
1274
1353
|
},
|
|
1275
1354
|
duration: 300
|
|
1276
1355
|
});
|
|
1277
|
-
return
|
|
1356
|
+
return import_react11.default.useMemo(
|
|
1278
1357
|
() => ({
|
|
1279
1358
|
open,
|
|
1280
1359
|
setOpen,
|
|
@@ -1289,20 +1368,20 @@ var useTooltip = ({
|
|
|
1289
1368
|
};
|
|
1290
1369
|
|
|
1291
1370
|
// src/components/Tooltip/Tooltip.tsx
|
|
1292
|
-
var
|
|
1371
|
+
var import_react14 = require("@floating-ui/react");
|
|
1293
1372
|
var Tooltip = ({
|
|
1294
1373
|
children,
|
|
1295
1374
|
...options
|
|
1296
1375
|
}) => {
|
|
1297
1376
|
const tooltip = useTooltip(options);
|
|
1298
|
-
return /* @__PURE__ */
|
|
1377
|
+
return /* @__PURE__ */ import_react13.default.createElement(TooltipContext.Provider, { value: tooltip }, children);
|
|
1299
1378
|
};
|
|
1300
|
-
var TooltipTrigger = (0,
|
|
1379
|
+
var TooltipTrigger = (0, import_react13.forwardRef)(function TooltipTrigger2({ children, asChild = false, ...props }, propRef) {
|
|
1301
1380
|
const context = useTooltipContext();
|
|
1302
1381
|
const childrenRef = children.ref;
|
|
1303
|
-
const ref = (0,
|
|
1304
|
-
if (asChild && (0,
|
|
1305
|
-
return (0,
|
|
1382
|
+
const ref = (0, import_react14.useMergeRefs)([context.refs.setReference, propRef, childrenRef]);
|
|
1383
|
+
if (asChild && (0, import_react13.isValidElement)(children)) {
|
|
1384
|
+
return (0, import_react13.cloneElement)(
|
|
1306
1385
|
children,
|
|
1307
1386
|
context.getReferenceProps({
|
|
1308
1387
|
ref,
|
|
@@ -1312,7 +1391,7 @@ var TooltipTrigger = (0, import_react11.forwardRef)(function TooltipTrigger2({ c
|
|
|
1312
1391
|
})
|
|
1313
1392
|
);
|
|
1314
1393
|
}
|
|
1315
|
-
return /* @__PURE__ */
|
|
1394
|
+
return /* @__PURE__ */ import_react13.default.createElement(
|
|
1316
1395
|
"span",
|
|
1317
1396
|
{
|
|
1318
1397
|
ref,
|
|
@@ -1323,12 +1402,12 @@ var TooltipTrigger = (0, import_react11.forwardRef)(function TooltipTrigger2({ c
|
|
|
1323
1402
|
children
|
|
1324
1403
|
);
|
|
1325
1404
|
});
|
|
1326
|
-
var TooltipContent = (0,
|
|
1405
|
+
var TooltipContent = (0, import_react13.forwardRef)(function TooltipContent2({ style, className, ...props }, propRef) {
|
|
1327
1406
|
const context = useTooltipContext();
|
|
1328
|
-
const ref = (0,
|
|
1407
|
+
const ref = (0, import_react14.useMergeRefs)([context.refs.setFloating, propRef]);
|
|
1329
1408
|
if (!context.open || context.disabled)
|
|
1330
1409
|
return null;
|
|
1331
|
-
return /* @__PURE__ */
|
|
1410
|
+
return /* @__PURE__ */ import_react13.default.createElement(import_react14.FloatingPortal, null, /* @__PURE__ */ import_react13.default.createElement(
|
|
1332
1411
|
"div",
|
|
1333
1412
|
{
|
|
1334
1413
|
ref,
|
|
@@ -1338,34 +1417,27 @@ var TooltipContent = (0, import_react11.forwardRef)(function TooltipContent2({ s
|
|
|
1338
1417
|
},
|
|
1339
1418
|
...context.getFloatingProps(props)
|
|
1340
1419
|
},
|
|
1341
|
-
/* @__PURE__ */
|
|
1420
|
+
/* @__PURE__ */ import_react13.default.createElement("div", { className: "Layer__tooltip-content ", style: { ...context.styles } }, props.children)
|
|
1342
1421
|
));
|
|
1343
1422
|
});
|
|
1344
1423
|
|
|
1345
1424
|
// src/components/Button/SubmitButton.tsx
|
|
1346
|
-
var
|
|
1425
|
+
var import_classnames4 = __toESM(require("classnames"));
|
|
1347
1426
|
var buildRightIcon = ({
|
|
1348
1427
|
processing,
|
|
1349
1428
|
error,
|
|
1350
1429
|
action
|
|
1351
1430
|
}) => {
|
|
1352
1431
|
if (processing) {
|
|
1353
|
-
return /* @__PURE__ */
|
|
1432
|
+
return /* @__PURE__ */ import_react15.default.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" });
|
|
1354
1433
|
}
|
|
1355
1434
|
if (error) {
|
|
1356
|
-
return /* @__PURE__ */
|
|
1435
|
+
return /* @__PURE__ */ import_react15.default.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ import_react15.default.createElement(TooltipTrigger, null, /* @__PURE__ */ import_react15.default.createElement(AlertCircle_default, { size: 14 })), /* @__PURE__ */ import_react15.default.createElement(TooltipContent, { className: "Layer__tooltip" }, error));
|
|
1357
1436
|
}
|
|
1358
1437
|
if (action === "update" /* UPDATE */) {
|
|
1359
|
-
return /* @__PURE__ */
|
|
1438
|
+
return /* @__PURE__ */ import_react15.default.createElement("span", { className: "Layer__pt-2" }, /* @__PURE__ */ import_react15.default.createElement(Save_default, { size: 14 }));
|
|
1360
1439
|
}
|
|
1361
|
-
return /* @__PURE__ */
|
|
1362
|
-
CheckCircle_default,
|
|
1363
|
-
{
|
|
1364
|
-
className: "Layer__btn-icon--on-inactive",
|
|
1365
|
-
size: 14,
|
|
1366
|
-
style: { paddingTop: 4 }
|
|
1367
|
-
}
|
|
1368
|
-
));
|
|
1440
|
+
return /* @__PURE__ */ import_react15.default.createElement("span", null, /* @__PURE__ */ import_react15.default.createElement(CheckCircle_default, { size: 14, style: { paddingTop: 4 } }));
|
|
1369
1441
|
};
|
|
1370
1442
|
var SubmitButton = ({
|
|
1371
1443
|
active,
|
|
@@ -1377,11 +1449,11 @@ var SubmitButton = ({
|
|
|
1377
1449
|
action = "save" /* SAVE */,
|
|
1378
1450
|
...props
|
|
1379
1451
|
}) => {
|
|
1380
|
-
const baseClassName = (0,
|
|
1452
|
+
const baseClassName = (0, import_classnames4.default)(
|
|
1381
1453
|
active ? "Layer__btn--active" : "",
|
|
1382
1454
|
className
|
|
1383
1455
|
);
|
|
1384
|
-
return /* @__PURE__ */
|
|
1456
|
+
return /* @__PURE__ */ import_react15.default.createElement(
|
|
1385
1457
|
Button,
|
|
1386
1458
|
{
|
|
1387
1459
|
...props,
|
|
@@ -1395,38 +1467,20 @@ var SubmitButton = ({
|
|
|
1395
1467
|
);
|
|
1396
1468
|
};
|
|
1397
1469
|
|
|
1398
|
-
// src/components/Button/IconButton.tsx
|
|
1399
|
-
var import_react14 = __toESM(require("react"));
|
|
1400
|
-
var import_classnames3 = __toESM(require("classnames"));
|
|
1401
|
-
var IconButton = ({
|
|
1402
|
-
className,
|
|
1403
|
-
children,
|
|
1404
|
-
icon,
|
|
1405
|
-
active,
|
|
1406
|
-
...props
|
|
1407
|
-
}) => {
|
|
1408
|
-
const baseClassName = (0, import_classnames3.default)(
|
|
1409
|
-
"Layer__icon-btn",
|
|
1410
|
-
`Layer__icon-btn--${active ? "active" : "inactive"}`,
|
|
1411
|
-
className
|
|
1412
|
-
);
|
|
1413
|
-
return /* @__PURE__ */ import_react14.default.createElement("button", { ...props, className: baseClassName }, icon);
|
|
1414
|
-
};
|
|
1415
|
-
|
|
1416
1470
|
// src/components/Button/TextButton.tsx
|
|
1417
|
-
var
|
|
1418
|
-
var
|
|
1471
|
+
var import_react16 = __toESM(require("react"));
|
|
1472
|
+
var import_classnames5 = __toESM(require("classnames"));
|
|
1419
1473
|
var TextButton = ({
|
|
1420
1474
|
className,
|
|
1421
1475
|
children,
|
|
1422
1476
|
...props
|
|
1423
1477
|
}) => {
|
|
1424
|
-
const baseClassName = (0,
|
|
1425
|
-
return /* @__PURE__ */
|
|
1478
|
+
const baseClassName = (0, import_classnames5.default)("Layer__text-btn", className);
|
|
1479
|
+
return /* @__PURE__ */ import_react16.default.createElement("button", { ...props, className: baseClassName }, children);
|
|
1426
1480
|
};
|
|
1427
1481
|
|
|
1428
1482
|
// src/components/Badge/Badge.tsx
|
|
1429
|
-
var
|
|
1483
|
+
var import_classnames6 = __toESM(require("classnames"));
|
|
1430
1484
|
var Badge = ({
|
|
1431
1485
|
icon,
|
|
1432
1486
|
onClick,
|
|
@@ -1435,7 +1489,7 @@ var Badge = ({
|
|
|
1435
1489
|
size = "medium" /* MEDIUM */
|
|
1436
1490
|
}) => {
|
|
1437
1491
|
const baseProps = {
|
|
1438
|
-
className: (0,
|
|
1492
|
+
className: (0, import_classnames6.default)(
|
|
1439
1493
|
"Layer__badge",
|
|
1440
1494
|
onClick || tooltip ? "Layer__badge--clickable" : "",
|
|
1441
1495
|
`Layer__badge--${size}`
|
|
@@ -1443,58 +1497,82 @@ var Badge = ({
|
|
|
1443
1497
|
onClick,
|
|
1444
1498
|
children
|
|
1445
1499
|
};
|
|
1446
|
-
let content = /* @__PURE__ */
|
|
1447
|
-
content = onClick ? /* @__PURE__ */
|
|
1500
|
+
let content = /* @__PURE__ */ import_react17.default.createElement(import_react17.default.Fragment, null, icon && /* @__PURE__ */ import_react17.default.createElement("span", { className: "Layer__badge__icon" }, icon), children);
|
|
1501
|
+
content = onClick ? /* @__PURE__ */ import_react17.default.createElement(Button, { ...baseProps }, content) : /* @__PURE__ */ import_react17.default.createElement("span", { ...baseProps }, content);
|
|
1448
1502
|
if (tooltip) {
|
|
1449
|
-
return /* @__PURE__ */
|
|
1503
|
+
return /* @__PURE__ */ import_react17.default.createElement(Tooltip, { offset: 12 }, /* @__PURE__ */ import_react17.default.createElement(TooltipTrigger, null, content), /* @__PURE__ */ import_react17.default.createElement(TooltipContent, { className: "Layer__tooltip" }, tooltip));
|
|
1450
1504
|
}
|
|
1451
1505
|
return content;
|
|
1452
1506
|
};
|
|
1453
1507
|
|
|
1454
1508
|
// src/components/CategorySelect/CategorySelect.tsx
|
|
1455
|
-
var
|
|
1509
|
+
var import_react18 = __toESM(require("react"));
|
|
1456
1510
|
var import_react_select = __toESM(require("react-select"));
|
|
1457
1511
|
|
|
1458
|
-
// src/icons/
|
|
1459
|
-
var
|
|
1460
|
-
var
|
|
1512
|
+
// src/icons/Check.tsx
|
|
1513
|
+
var React23 = __toESM(require("react"));
|
|
1514
|
+
var Check = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createElement(
|
|
1461
1515
|
"svg",
|
|
1462
1516
|
{
|
|
1463
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
1464
1517
|
viewBox: "0 0 18 18",
|
|
1465
1518
|
fill: "none",
|
|
1519
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1466
1520
|
...props,
|
|
1467
1521
|
width: size,
|
|
1468
1522
|
height: size
|
|
1469
1523
|
},
|
|
1470
|
-
/* @__PURE__ */
|
|
1471
|
-
"path",
|
|
1472
|
-
{
|
|
1473
|
-
d: "M3 10.5H7.5V15",
|
|
1474
|
-
stroke: "currentColor",
|
|
1475
|
-
strokeLinecap: "round",
|
|
1476
|
-
strokeLinejoin: "round"
|
|
1477
|
-
}
|
|
1478
|
-
),
|
|
1479
|
-
/* @__PURE__ */ React22.createElement(
|
|
1524
|
+
/* @__PURE__ */ React23.createElement(
|
|
1480
1525
|
"path",
|
|
1481
1526
|
{
|
|
1482
|
-
d: "M15
|
|
1527
|
+
d: "M15 4.5L6.75 12.75L3 9",
|
|
1483
1528
|
stroke: "currentColor",
|
|
1484
1529
|
strokeLinecap: "round",
|
|
1485
1530
|
strokeLinejoin: "round"
|
|
1486
1531
|
}
|
|
1487
|
-
)
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1532
|
+
)
|
|
1533
|
+
);
|
|
1534
|
+
var Check_default = Check;
|
|
1535
|
+
|
|
1536
|
+
// src/icons/MinimizeTwo.tsx
|
|
1537
|
+
var React24 = __toESM(require("react"));
|
|
1538
|
+
var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
1539
|
+
"svg",
|
|
1540
|
+
{
|
|
1541
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1542
|
+
viewBox: "0 0 18 18",
|
|
1543
|
+
fill: "none",
|
|
1544
|
+
...props,
|
|
1545
|
+
width: size,
|
|
1546
|
+
height: size
|
|
1547
|
+
},
|
|
1548
|
+
/* @__PURE__ */ React24.createElement(
|
|
1549
|
+
"path",
|
|
1550
|
+
{
|
|
1551
|
+
d: "M3 10.5H7.5V15",
|
|
1552
|
+
stroke: "currentColor",
|
|
1553
|
+
strokeLinecap: "round",
|
|
1554
|
+
strokeLinejoin: "round"
|
|
1555
|
+
}
|
|
1556
|
+
),
|
|
1557
|
+
/* @__PURE__ */ React24.createElement(
|
|
1558
|
+
"path",
|
|
1559
|
+
{
|
|
1560
|
+
d: "M15 7.5H10.5V3",
|
|
1561
|
+
stroke: "currentColor",
|
|
1562
|
+
strokeLinecap: "round",
|
|
1563
|
+
strokeLinejoin: "round"
|
|
1564
|
+
}
|
|
1565
|
+
),
|
|
1566
|
+
/* @__PURE__ */ React24.createElement(
|
|
1567
|
+
"path",
|
|
1568
|
+
{
|
|
1569
|
+
d: "M10.5 7.5L15.75 2.25",
|
|
1492
1570
|
stroke: "currentColor",
|
|
1493
1571
|
strokeLinecap: "round",
|
|
1494
1572
|
strokeLinejoin: "round"
|
|
1495
1573
|
}
|
|
1496
1574
|
),
|
|
1497
|
-
/* @__PURE__ */
|
|
1575
|
+
/* @__PURE__ */ React24.createElement(
|
|
1498
1576
|
"path",
|
|
1499
1577
|
{
|
|
1500
1578
|
d: "M2.25 15.75L7.5 10.5",
|
|
@@ -1507,7 +1585,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
1507
1585
|
var MinimizeTwo_default = MinimizeTwo;
|
|
1508
1586
|
|
|
1509
1587
|
// src/components/CategorySelect/CategorySelect.tsx
|
|
1510
|
-
var
|
|
1588
|
+
var import_classnames7 = __toESM(require("classnames"));
|
|
1511
1589
|
var import_date_fns4 = require("date-fns");
|
|
1512
1590
|
var mapCategoryToOption = (category) => {
|
|
1513
1591
|
return {
|
|
@@ -1535,13 +1613,13 @@ var mapSuggestedMatchToOption = (record) => {
|
|
|
1535
1613
|
};
|
|
1536
1614
|
};
|
|
1537
1615
|
var DropdownIndicator = (props) => {
|
|
1538
|
-
return /* @__PURE__ */
|
|
1616
|
+
return /* @__PURE__ */ import_react18.default.createElement(import_react_select.components.DropdownIndicator, { ...props }, /* @__PURE__ */ import_react18.default.createElement(ChevronDown_default, null));
|
|
1539
1617
|
};
|
|
1540
1618
|
var GroupHeading = (props) => {
|
|
1541
|
-
return /* @__PURE__ */
|
|
1619
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
1542
1620
|
import_react_select.components.GroupHeading,
|
|
1543
1621
|
{
|
|
1544
|
-
className: (0,
|
|
1622
|
+
className: (0, import_classnames7.default)(
|
|
1545
1623
|
props.className,
|
|
1546
1624
|
props.children === "Match" || props.children === "All categories" ? "Layer__select__group-heading--main" : ""
|
|
1547
1625
|
),
|
|
@@ -1554,24 +1632,24 @@ var Option = (props) => {
|
|
|
1554
1632
|
return;
|
|
1555
1633
|
}
|
|
1556
1634
|
if (props.data.type === "match") {
|
|
1557
|
-
return /* @__PURE__ */
|
|
1635
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
1558
1636
|
import_react_select.components.Option,
|
|
1559
1637
|
{
|
|
1560
1638
|
...props,
|
|
1561
1639
|
className: `${props.className} Layer__select__option-content__match`
|
|
1562
1640
|
},
|
|
1563
|
-
/* @__PURE__ */
|
|
1564
|
-
/* @__PURE__ */
|
|
1641
|
+
/* @__PURE__ */ import_react18.default.createElement("div", { className: "Layer__select__option-content__match__main-row" }, /* @__PURE__ */ import_react18.default.createElement("span", { className: "Layer__select__option-content__match__date" }, props.data.payload.date && (0, import_date_fns4.format)((0, import_date_fns4.parseISO)(props.data.payload.date), DATE_FORMAT)), /* @__PURE__ */ import_react18.default.createElement("span", { className: "Layer__select__option-content__match__description" }, props.data.payload.display_name)),
|
|
1642
|
+
/* @__PURE__ */ import_react18.default.createElement("div", { className: "Layer__select__option-content__match__amount-row" }, /* @__PURE__ */ import_react18.default.createElement("span", { className: "Layer__select__option-content__match__amount" }, "$", centsToDollars(props.data.payload.amount)))
|
|
1565
1643
|
);
|
|
1566
1644
|
}
|
|
1567
|
-
return /* @__PURE__ */
|
|
1645
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
1568
1646
|
import_react_select.components.Option,
|
|
1569
1647
|
{
|
|
1570
1648
|
...props,
|
|
1571
1649
|
className: `Layer__select__option-menu-content ${props.className}`
|
|
1572
1650
|
},
|
|
1573
|
-
/* @__PURE__ */
|
|
1574
|
-
props.isSelected ? /* @__PURE__ */
|
|
1651
|
+
/* @__PURE__ */ import_react18.default.createElement("div", null, props.data.payload.display_name),
|
|
1652
|
+
props.isSelected ? /* @__PURE__ */ import_react18.default.createElement("span", { className: "Layer__select__option-menu-content-check" }, /* @__PURE__ */ import_react18.default.createElement(Check_default, { size: 16 })) : null
|
|
1575
1653
|
);
|
|
1576
1654
|
};
|
|
1577
1655
|
var allCategoriesDivider = [
|
|
@@ -1654,7 +1732,7 @@ var CategorySelect = ({
|
|
|
1654
1732
|
];
|
|
1655
1733
|
const selected = value ? value : matchOptions?.length === 1 && matchOptions[0].options.length === 1 ? matchOptions[0].options[0] : void 0;
|
|
1656
1734
|
const placeholder = matchOptions?.length === 1 && matchOptions[0].options.length > 1 ? `${matchOptions[0].options.length} possible matches...` : "Categorize or match...";
|
|
1657
|
-
return /* @__PURE__ */
|
|
1735
|
+
return /* @__PURE__ */ import_react18.default.createElement(
|
|
1658
1736
|
import_react_select.default,
|
|
1659
1737
|
{
|
|
1660
1738
|
name,
|
|
@@ -1664,7 +1742,7 @@ var CategorySelect = ({
|
|
|
1664
1742
|
isSearchable: true,
|
|
1665
1743
|
placeholder,
|
|
1666
1744
|
defaultValue: selected,
|
|
1667
|
-
formatOptionLabel: (props) => /* @__PURE__ */
|
|
1745
|
+
formatOptionLabel: (props) => /* @__PURE__ */ import_react18.default.createElement("div", { className: "Layer__select__option-label" }, props.type === "match" && /* @__PURE__ */ import_react18.default.createElement(Badge, { size: "small" /* SMALL */, icon: /* @__PURE__ */ import_react18.default.createElement(MinimizeTwo_default, { size: 11 }) }, "Match"), /* @__PURE__ */ import_react18.default.createElement("span", null, props.payload.display_name)),
|
|
1668
1746
|
value,
|
|
1669
1747
|
onChange: (newValue) => newValue && onChange(newValue),
|
|
1670
1748
|
getOptionLabel: (category) => category.payload.display_name,
|
|
@@ -1681,11 +1759,72 @@ var CategorySelect = ({
|
|
|
1681
1759
|
};
|
|
1682
1760
|
|
|
1683
1761
|
// src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
|
|
1684
|
-
var
|
|
1762
|
+
var import_react31 = __toESM(require("react"));
|
|
1685
1763
|
|
|
1686
|
-
// src/icons/
|
|
1687
|
-
var
|
|
1688
|
-
var
|
|
1764
|
+
// src/icons/ScissorsFullOpen.tsx
|
|
1765
|
+
var React26 = __toESM(require("react"));
|
|
1766
|
+
var ScissorsFullOpen = ({ size = 12, ...props }) => /* @__PURE__ */ React26.createElement(
|
|
1767
|
+
"svg",
|
|
1768
|
+
{
|
|
1769
|
+
viewBox: "0 0 12 12",
|
|
1770
|
+
fill: "none",
|
|
1771
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1772
|
+
...props,
|
|
1773
|
+
width: size,
|
|
1774
|
+
height: size
|
|
1775
|
+
},
|
|
1776
|
+
/* @__PURE__ */ React26.createElement("g", { id: "scissors" }, /* @__PURE__ */ React26.createElement(
|
|
1777
|
+
"path",
|
|
1778
|
+
{
|
|
1779
|
+
id: "Vector",
|
|
1780
|
+
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",
|
|
1781
|
+
stroke: "currentColor",
|
|
1782
|
+
strokeLinecap: "round",
|
|
1783
|
+
strokeLinejoin: "round"
|
|
1784
|
+
}
|
|
1785
|
+
), /* @__PURE__ */ React26.createElement(
|
|
1786
|
+
"path",
|
|
1787
|
+
{
|
|
1788
|
+
id: "Vector_2",
|
|
1789
|
+
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",
|
|
1790
|
+
stroke: "currentColor",
|
|
1791
|
+
strokeLinecap: "round",
|
|
1792
|
+
strokeLinejoin: "round"
|
|
1793
|
+
}
|
|
1794
|
+
), /* @__PURE__ */ React26.createElement(
|
|
1795
|
+
"path",
|
|
1796
|
+
{
|
|
1797
|
+
id: "Vector_3",
|
|
1798
|
+
d: "M10 2L4.06 7.94",
|
|
1799
|
+
stroke: "currentColor",
|
|
1800
|
+
strokeLinecap: "round",
|
|
1801
|
+
strokeLinejoin: "round"
|
|
1802
|
+
}
|
|
1803
|
+
), /* @__PURE__ */ React26.createElement(
|
|
1804
|
+
"path",
|
|
1805
|
+
{
|
|
1806
|
+
id: "Vector_4",
|
|
1807
|
+
d: "M7.235 7.23999L10 9.99999",
|
|
1808
|
+
stroke: "currentColor",
|
|
1809
|
+
strokeLinecap: "round",
|
|
1810
|
+
strokeLinejoin: "round"
|
|
1811
|
+
}
|
|
1812
|
+
), /* @__PURE__ */ React26.createElement(
|
|
1813
|
+
"path",
|
|
1814
|
+
{
|
|
1815
|
+
id: "Vector_5",
|
|
1816
|
+
d: "M4.06 4.06006L6 6.00006",
|
|
1817
|
+
stroke: "currentColor",
|
|
1818
|
+
strokeLinecap: "round",
|
|
1819
|
+
strokeLinejoin: "round"
|
|
1820
|
+
}
|
|
1821
|
+
))
|
|
1822
|
+
);
|
|
1823
|
+
var ScissorsFullOpen_default = ScissorsFullOpen;
|
|
1824
|
+
|
|
1825
|
+
// src/icons/Trash.tsx
|
|
1826
|
+
var React27 = __toESM(require("react"));
|
|
1827
|
+
var Trash = ({ size = 18, ...props }) => /* @__PURE__ */ React27.createElement(
|
|
1689
1828
|
"svg",
|
|
1690
1829
|
{
|
|
1691
1830
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1695,32 +1834,50 @@ var Link = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
|
1695
1834
|
width: size,
|
|
1696
1835
|
height: size
|
|
1697
1836
|
},
|
|
1698
|
-
/* @__PURE__ */
|
|
1837
|
+
/* @__PURE__ */ React27.createElement(
|
|
1699
1838
|
"path",
|
|
1700
1839
|
{
|
|
1701
|
-
d: "
|
|
1840
|
+
d: "M2.25 4.5H3.75H15.75",
|
|
1702
1841
|
stroke: "currentColor",
|
|
1703
1842
|
strokeLinecap: "round",
|
|
1704
1843
|
strokeLinejoin: "round"
|
|
1705
1844
|
}
|
|
1706
1845
|
),
|
|
1707
|
-
/* @__PURE__ */
|
|
1846
|
+
/* @__PURE__ */ React27.createElement(
|
|
1847
|
+
"path",
|
|
1848
|
+
{
|
|
1849
|
+
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",
|
|
1850
|
+
stroke: "currentColor",
|
|
1851
|
+
strokeLinecap: "round",
|
|
1852
|
+
strokeLinejoin: "round"
|
|
1853
|
+
}
|
|
1854
|
+
),
|
|
1855
|
+
/* @__PURE__ */ React27.createElement(
|
|
1856
|
+
"path",
|
|
1857
|
+
{
|
|
1858
|
+
d: "M7.5 8.25V12.75",
|
|
1859
|
+
stroke: "currentColor",
|
|
1860
|
+
strokeLinecap: "round",
|
|
1861
|
+
strokeLinejoin: "round"
|
|
1862
|
+
}
|
|
1863
|
+
),
|
|
1864
|
+
/* @__PURE__ */ React27.createElement(
|
|
1708
1865
|
"path",
|
|
1709
1866
|
{
|
|
1710
|
-
d: "M10.5 8.
|
|
1867
|
+
d: "M10.5 8.25V12.75",
|
|
1711
1868
|
stroke: "currentColor",
|
|
1712
1869
|
strokeLinecap: "round",
|
|
1713
1870
|
strokeLinejoin: "round"
|
|
1714
1871
|
}
|
|
1715
1872
|
)
|
|
1716
1873
|
);
|
|
1717
|
-
var
|
|
1874
|
+
var Trash_default = Trash;
|
|
1718
1875
|
|
|
1719
1876
|
// src/components/CategoryMenu/CategoryMenu.tsx
|
|
1720
|
-
var
|
|
1877
|
+
var import_react19 = __toESM(require("react"));
|
|
1721
1878
|
var import_react_select2 = __toESM(require("react-select"));
|
|
1722
1879
|
var DropdownIndicator2 = (props) => {
|
|
1723
|
-
return /* @__PURE__ */
|
|
1880
|
+
return /* @__PURE__ */ import_react19.default.createElement(import_react_select2.components.DropdownIndicator, { ...props }, /* @__PURE__ */ import_react19.default.createElement(ChevronDown_default, null));
|
|
1724
1881
|
};
|
|
1725
1882
|
var CategoryMenu = ({
|
|
1726
1883
|
bankTransaction,
|
|
@@ -1750,7 +1907,7 @@ var CategoryMenu = ({
|
|
|
1750
1907
|
};
|
|
1751
1908
|
}).filter((x) => x);
|
|
1752
1909
|
const options = [...suggestedOptions, ...categoryOptions];
|
|
1753
|
-
return /* @__PURE__ */
|
|
1910
|
+
return /* @__PURE__ */ import_react19.default.createElement(
|
|
1754
1911
|
import_react_select2.default,
|
|
1755
1912
|
{
|
|
1756
1913
|
name,
|
|
@@ -1771,28 +1928,30 @@ var CategoryMenu = ({
|
|
|
1771
1928
|
};
|
|
1772
1929
|
|
|
1773
1930
|
// src/components/Input/Input.tsx
|
|
1774
|
-
var
|
|
1775
|
-
var
|
|
1931
|
+
var import_react20 = __toESM(require("react"));
|
|
1932
|
+
var import_classnames8 = __toESM(require("classnames"));
|
|
1776
1933
|
var Input = ({
|
|
1777
1934
|
className,
|
|
1778
1935
|
isInvalid,
|
|
1779
1936
|
errorMessage,
|
|
1937
|
+
leftText,
|
|
1780
1938
|
...props
|
|
1781
1939
|
}) => {
|
|
1782
|
-
const baseClassName = (0,
|
|
1940
|
+
const baseClassName = (0, import_classnames8.default)(
|
|
1783
1941
|
"Layer__input",
|
|
1784
1942
|
isInvalid ? "Layer__input--error" : "",
|
|
1943
|
+
leftText ? "Layer__input--with-left-text" : "",
|
|
1785
1944
|
className
|
|
1786
1945
|
);
|
|
1787
|
-
return /* @__PURE__ */
|
|
1946
|
+
return /* @__PURE__ */ import_react20.default.createElement(Tooltip, { disabled: !isInvalid || !errorMessage }, /* @__PURE__ */ import_react20.default.createElement(TooltipTrigger, { className: "Layer__input-tooltip" }, /* @__PURE__ */ import_react20.default.createElement("input", { ...props, className: baseClassName }), leftText && /* @__PURE__ */ import_react20.default.createElement("span", { className: "Layer__input-left-text" }, leftText)), /* @__PURE__ */ import_react20.default.createElement(TooltipContent, { className: "Layer__tooltip" }, errorMessage));
|
|
1788
1947
|
};
|
|
1789
1948
|
|
|
1790
1949
|
// src/components/Input/InputGroup.tsx
|
|
1791
|
-
var
|
|
1950
|
+
var import_react24 = __toESM(require("react"));
|
|
1792
1951
|
|
|
1793
1952
|
// src/components/Typography/Text.tsx
|
|
1794
|
-
var
|
|
1795
|
-
var
|
|
1953
|
+
var import_react21 = __toESM(require("react"));
|
|
1954
|
+
var import_classnames9 = __toESM(require("classnames"));
|
|
1796
1955
|
var Text = ({
|
|
1797
1956
|
as: Component = "p",
|
|
1798
1957
|
className,
|
|
@@ -1802,12 +1961,12 @@ var Text = ({
|
|
|
1802
1961
|
withTooltip,
|
|
1803
1962
|
...props
|
|
1804
1963
|
}) => {
|
|
1805
|
-
const baseClassName = (0,
|
|
1964
|
+
const baseClassName = (0, import_classnames9.default)(
|
|
1806
1965
|
`Layer__text Layer__text--${size} Layer__text--${weight}`,
|
|
1807
1966
|
className
|
|
1808
1967
|
);
|
|
1809
1968
|
if (withTooltip) {
|
|
1810
|
-
return /* @__PURE__ */
|
|
1969
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
1811
1970
|
TextWithTooltip,
|
|
1812
1971
|
{
|
|
1813
1972
|
as: Component,
|
|
@@ -1820,7 +1979,7 @@ var Text = ({
|
|
|
1820
1979
|
children
|
|
1821
1980
|
);
|
|
1822
1981
|
}
|
|
1823
|
-
return /* @__PURE__ */
|
|
1982
|
+
return /* @__PURE__ */ import_react21.default.createElement(Component, { ...props, className: baseClassName }, children);
|
|
1824
1983
|
};
|
|
1825
1984
|
var TextWithTooltip = ({
|
|
1826
1985
|
as: Component = "p",
|
|
@@ -1832,66 +1991,74 @@ var TextWithTooltip = ({
|
|
|
1832
1991
|
tooltipOptions,
|
|
1833
1992
|
...props
|
|
1834
1993
|
}) => {
|
|
1835
|
-
const textElementRef = (0,
|
|
1994
|
+
const textElementRef = (0, import_react21.useRef)();
|
|
1836
1995
|
const compareSize = () => {
|
|
1837
1996
|
if (textElementRef.current) {
|
|
1838
1997
|
const compare = textElementRef.current.children[0].scrollWidth > textElementRef.current.children[0].clientWidth;
|
|
1839
1998
|
setHover(compare);
|
|
1840
1999
|
}
|
|
1841
2000
|
};
|
|
1842
|
-
(0,
|
|
2001
|
+
(0, import_react21.useEffect)(() => {
|
|
1843
2002
|
compareSize();
|
|
1844
2003
|
window.addEventListener("resize", compareSize);
|
|
1845
2004
|
}, []);
|
|
1846
|
-
(0,
|
|
2005
|
+
(0, import_react21.useEffect)(
|
|
1847
2006
|
() => () => {
|
|
1848
2007
|
window.removeEventListener("resize", compareSize);
|
|
1849
2008
|
},
|
|
1850
2009
|
[]
|
|
1851
2010
|
);
|
|
1852
|
-
const [hoverStatus, setHover] = (0,
|
|
1853
|
-
const contentClassName = (0,
|
|
2011
|
+
const [hoverStatus, setHover] = (0, import_react21.useState)(false);
|
|
2012
|
+
const contentClassName = (0, import_classnames9.default)(
|
|
1854
2013
|
"Layer__tooltip",
|
|
1855
2014
|
tooltipOptions?.contentClassName
|
|
1856
2015
|
);
|
|
1857
|
-
return /* @__PURE__ */
|
|
2016
|
+
return /* @__PURE__ */ import_react21.default.createElement(
|
|
1858
2017
|
Tooltip,
|
|
1859
2018
|
{
|
|
1860
2019
|
disabled: !hoverStatus,
|
|
1861
2020
|
offset: tooltipOptions?.offset,
|
|
1862
2021
|
shift: tooltipOptions?.shift
|
|
1863
2022
|
},
|
|
1864
|
-
/* @__PURE__ */
|
|
1865
|
-
/* @__PURE__ */
|
|
2023
|
+
/* @__PURE__ */ import_react21.default.createElement(TooltipTrigger, null, /* @__PURE__ */ import_react21.default.createElement(Component, { className, ref: textElementRef, ...props }, children)),
|
|
2024
|
+
/* @__PURE__ */ import_react21.default.createElement(TooltipContent, { className: contentClassName }, children)
|
|
1866
2025
|
);
|
|
1867
2026
|
};
|
|
1868
2027
|
|
|
1869
2028
|
// src/components/Typography/Heading.tsx
|
|
1870
|
-
var
|
|
1871
|
-
var
|
|
2029
|
+
var import_react22 = __toESM(require("react"));
|
|
2030
|
+
var import_classnames10 = __toESM(require("classnames"));
|
|
1872
2031
|
var Heading = ({
|
|
1873
2032
|
as: Component = "h2",
|
|
1874
2033
|
className,
|
|
1875
2034
|
children,
|
|
1876
2035
|
size = "primary" /* primary */
|
|
1877
2036
|
}) => {
|
|
1878
|
-
const baseClassName = (0,
|
|
2037
|
+
const baseClassName = (0, import_classnames10.default)(
|
|
1879
2038
|
`Layer__heading Layer__heading--${size}`,
|
|
1880
2039
|
className
|
|
1881
2040
|
);
|
|
1882
|
-
return /* @__PURE__ */
|
|
2041
|
+
return /* @__PURE__ */ import_react22.default.createElement(Component, { className: baseClassName }, children);
|
|
2042
|
+
};
|
|
2043
|
+
|
|
2044
|
+
// src/components/Typography/ErrorText.tsx
|
|
2045
|
+
var import_react23 = __toESM(require("react"));
|
|
2046
|
+
var import_classnames11 = __toESM(require("classnames"));
|
|
2047
|
+
var ErrorText = ({ className, ...props }) => {
|
|
2048
|
+
const baseClassName = (0, import_classnames11.default)("Layer__text--error", className);
|
|
2049
|
+
return /* @__PURE__ */ import_react23.default.createElement(Text, { ...props, className: baseClassName });
|
|
1883
2050
|
};
|
|
1884
2051
|
|
|
1885
2052
|
// src/components/Input/InputGroup.tsx
|
|
1886
|
-
var
|
|
2053
|
+
var import_classnames12 = __toESM(require("classnames"));
|
|
1887
2054
|
var InputGroup = ({
|
|
1888
2055
|
label,
|
|
1889
2056
|
name,
|
|
1890
2057
|
className,
|
|
1891
2058
|
children
|
|
1892
2059
|
}) => {
|
|
1893
|
-
const baseClassName = (0,
|
|
1894
|
-
return /* @__PURE__ */
|
|
2060
|
+
const baseClassName = (0, import_classnames12.default)("Layer__input-group", className);
|
|
2061
|
+
return /* @__PURE__ */ import_react24.default.createElement("div", { className: baseClassName }, label && /* @__PURE__ */ import_react24.default.createElement(
|
|
1895
2062
|
Text,
|
|
1896
2063
|
{
|
|
1897
2064
|
as: "label",
|
|
@@ -1904,11 +2071,11 @@ var InputGroup = ({
|
|
|
1904
2071
|
};
|
|
1905
2072
|
|
|
1906
2073
|
// src/components/Input/FileInput.tsx
|
|
1907
|
-
var
|
|
2074
|
+
var import_react25 = __toESM(require("react"));
|
|
1908
2075
|
|
|
1909
2076
|
// src/icons/UploadCloud.tsx
|
|
1910
|
-
var
|
|
1911
|
-
var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
2077
|
+
var React34 = __toESM(require("react"));
|
|
2078
|
+
var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React34.createElement(
|
|
1912
2079
|
"svg",
|
|
1913
2080
|
{
|
|
1914
2081
|
viewBox: "0 0 18 18",
|
|
@@ -1918,7 +2085,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React30.createEle
|
|
|
1918
2085
|
width: size,
|
|
1919
2086
|
height: size
|
|
1920
2087
|
},
|
|
1921
|
-
/* @__PURE__ */
|
|
2088
|
+
/* @__PURE__ */ React34.createElement(
|
|
1922
2089
|
"path",
|
|
1923
2090
|
{
|
|
1924
2091
|
d: "M12 12L9 9L6 12",
|
|
@@ -1927,7 +2094,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React30.createEle
|
|
|
1927
2094
|
strokeLinejoin: "round"
|
|
1928
2095
|
}
|
|
1929
2096
|
),
|
|
1930
|
-
/* @__PURE__ */
|
|
2097
|
+
/* @__PURE__ */ React34.createElement(
|
|
1931
2098
|
"path",
|
|
1932
2099
|
{
|
|
1933
2100
|
d: "M9 9V15.75",
|
|
@@ -1936,7 +2103,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React30.createEle
|
|
|
1936
2103
|
strokeLinejoin: "round"
|
|
1937
2104
|
}
|
|
1938
2105
|
),
|
|
1939
|
-
/* @__PURE__ */
|
|
2106
|
+
/* @__PURE__ */ React34.createElement(
|
|
1940
2107
|
"path",
|
|
1941
2108
|
{
|
|
1942
2109
|
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",
|
|
@@ -1945,7 +2112,7 @@ var UploadCloud = ({ size = 18, ...props }) => /* @__PURE__ */ React30.createEle
|
|
|
1945
2112
|
strokeLinejoin: "round"
|
|
1946
2113
|
}
|
|
1947
2114
|
),
|
|
1948
|
-
/* @__PURE__ */
|
|
2115
|
+
/* @__PURE__ */ React34.createElement(
|
|
1949
2116
|
"path",
|
|
1950
2117
|
{
|
|
1951
2118
|
d: "M12 12L9 9L6 12",
|
|
@@ -1959,7 +2126,7 @@ var UploadCloud_default = UploadCloud;
|
|
|
1959
2126
|
|
|
1960
2127
|
// src/components/Input/FileInput.tsx
|
|
1961
2128
|
var FileInput = ({ text = "Upload", onUpload }) => {
|
|
1962
|
-
const hiddenFileInput = (0,
|
|
2129
|
+
const hiddenFileInput = (0, import_react25.useRef)(null);
|
|
1963
2130
|
const onClick = () => {
|
|
1964
2131
|
if (hiddenFileInput.current) {
|
|
1965
2132
|
hiddenFileInput.current.click();
|
|
@@ -1971,15 +2138,15 @@ var FileInput = ({ text = "Upload", onUpload }) => {
|
|
|
1971
2138
|
onUpload(fileUploaded);
|
|
1972
2139
|
}
|
|
1973
2140
|
};
|
|
1974
|
-
return /* @__PURE__ */
|
|
2141
|
+
return /* @__PURE__ */ import_react25.default.createElement(import_react25.default.Fragment, null, /* @__PURE__ */ import_react25.default.createElement(
|
|
1975
2142
|
Button,
|
|
1976
2143
|
{
|
|
1977
2144
|
onClick,
|
|
1978
2145
|
variant: "secondary" /* secondary */,
|
|
1979
|
-
rightIcon: /* @__PURE__ */
|
|
2146
|
+
rightIcon: /* @__PURE__ */ import_react25.default.createElement(UploadCloud_default, null)
|
|
1980
2147
|
},
|
|
1981
2148
|
text
|
|
1982
|
-
), /* @__PURE__ */
|
|
2149
|
+
), /* @__PURE__ */ import_react25.default.createElement(
|
|
1983
2150
|
"input",
|
|
1984
2151
|
{
|
|
1985
2152
|
type: "file",
|
|
@@ -1991,10 +2158,10 @@ var FileInput = ({ text = "Upload", onUpload }) => {
|
|
|
1991
2158
|
};
|
|
1992
2159
|
|
|
1993
2160
|
// src/components/MatchForm/MatchForm.tsx
|
|
1994
|
-
var
|
|
2161
|
+
var import_react27 = __toESM(require("react"));
|
|
1995
2162
|
|
|
1996
2163
|
// src/components/BankTransactionRow/MatchBadge.tsx
|
|
1997
|
-
var
|
|
2164
|
+
var import_react26 = __toESM(require("react"));
|
|
1998
2165
|
var import_date_fns5 = require("date-fns");
|
|
1999
2166
|
var MatchBadge = ({
|
|
2000
2167
|
bankTransaction,
|
|
@@ -2004,11 +2171,11 @@ var MatchBadge = ({
|
|
|
2004
2171
|
}) => {
|
|
2005
2172
|
if (bankTransaction.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction.match) {
|
|
2006
2173
|
const { date, amount, description } = bankTransaction.match.bank_transaction;
|
|
2007
|
-
return /* @__PURE__ */
|
|
2174
|
+
return /* @__PURE__ */ import_react26.default.createElement(
|
|
2008
2175
|
Badge,
|
|
2009
2176
|
{
|
|
2010
|
-
icon: /* @__PURE__ */
|
|
2011
|
-
tooltip: /* @__PURE__ */
|
|
2177
|
+
icon: /* @__PURE__ */ import_react26.default.createElement(MinimizeTwo_default, { size: 11 }),
|
|
2178
|
+
tooltip: /* @__PURE__ */ import_react26.default.createElement("span", { className: `${classNamePrefix}__match-tooltip` }, /* @__PURE__ */ import_react26.default.createElement("div", { className: `${classNamePrefix}__match-tooltip__date` }, (0, import_date_fns5.format)((0, import_date_fns5.parseISO)(date), dateFormat)), /* @__PURE__ */ import_react26.default.createElement("div", { className: `${classNamePrefix}__match-tooltip__description` }, description), /* @__PURE__ */ import_react26.default.createElement("div", { className: `${classNamePrefix}__match-tooltip__amount` }, "$", centsToDollars(amount)))
|
|
2012
2179
|
},
|
|
2013
2180
|
text
|
|
2014
2181
|
);
|
|
@@ -2017,20 +2184,26 @@ var MatchBadge = ({
|
|
|
2017
2184
|
};
|
|
2018
2185
|
|
|
2019
2186
|
// src/components/MatchForm/MatchForm.tsx
|
|
2020
|
-
var
|
|
2187
|
+
var import_classnames13 = __toESM(require("classnames"));
|
|
2021
2188
|
var import_date_fns6 = require("date-fns");
|
|
2022
2189
|
var MatchForm = ({
|
|
2023
2190
|
classNamePrefix,
|
|
2024
2191
|
bankTransaction,
|
|
2025
2192
|
selectedMatchId,
|
|
2026
|
-
setSelectedMatchId
|
|
2193
|
+
setSelectedMatchId,
|
|
2194
|
+
matchFormError
|
|
2027
2195
|
}) => {
|
|
2028
|
-
return /* @__PURE__ */
|
|
2029
|
-
|
|
2196
|
+
return /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-table` }, /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-table__header` }, /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-table__date` }, "Date"), /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, "Description"), /* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "Amount"), /* @__PURE__ */ import_react27.default.createElement(
|
|
2197
|
+
"div",
|
|
2198
|
+
{
|
|
2199
|
+
className: `${classNamePrefix}__match-table__status ${bankTransaction.match ? "" : "no-match"}`
|
|
2200
|
+
}
|
|
2201
|
+
)), bankTransaction.suggested_matches?.map((match, idx) => {
|
|
2202
|
+
return /* @__PURE__ */ import_react27.default.createElement(
|
|
2030
2203
|
"div",
|
|
2031
2204
|
{
|
|
2032
2205
|
key: idx,
|
|
2033
|
-
className: (0,
|
|
2206
|
+
className: (0, import_classnames13.default)(
|
|
2034
2207
|
`${classNamePrefix}__match-row`,
|
|
2035
2208
|
match.id === selectedMatchId ? `${classNamePrefix}__match-row--selected` : ""
|
|
2036
2209
|
),
|
|
@@ -2042,14 +2215,15 @@ var MatchForm = ({
|
|
|
2042
2215
|
setSelectedMatchId(match.id);
|
|
2043
2216
|
}
|
|
2044
2217
|
},
|
|
2045
|
-
/* @__PURE__ */
|
|
2218
|
+
/* @__PURE__ */ import_react27.default.createElement(
|
|
2046
2219
|
"div",
|
|
2047
2220
|
{
|
|
2048
2221
|
className: `Layer__nowrap ${classNamePrefix}__match-table__date`
|
|
2049
2222
|
},
|
|
2050
|
-
(0, import_date_fns6.format)((0, import_date_fns6.parseISO)(match.details.date), DATE_FORMAT)
|
|
2223
|
+
/* @__PURE__ */ import_react27.default.createElement("span", null, (0, import_date_fns6.format)((0, import_date_fns6.parseISO)(match.details.date), DATE_FORMAT)),
|
|
2224
|
+
/* @__PURE__ */ import_react27.default.createElement("span", { className: "amount-next-to-date" }, "$", centsToDollars(match.details.amount))
|
|
2051
2225
|
),
|
|
2052
|
-
/* @__PURE__ */
|
|
2226
|
+
/* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-table__desc` }, /* @__PURE__ */ import_react27.default.createElement(
|
|
2053
2227
|
Text,
|
|
2054
2228
|
{
|
|
2055
2229
|
className: `${classNamePrefix}__match-table__desc-tooltip`,
|
|
@@ -2057,9 +2231,7 @@ var MatchForm = ({
|
|
|
2057
2231
|
as: "span"
|
|
2058
2232
|
},
|
|
2059
2233
|
match.details.description
|
|
2060
|
-
)
|
|
2061
|
-
/* @__PURE__ */ import_react25.default.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "$", centsToDollars(match.details.amount)),
|
|
2062
|
-
/* @__PURE__ */ import_react25.default.createElement("div", { className: `${classNamePrefix}__match-table__status` }, match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ import_react25.default.createElement(
|
|
2234
|
+
), match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ import_react27.default.createElement("span", { className: "match-badge" }, /* @__PURE__ */ import_react27.default.createElement(
|
|
2063
2235
|
MatchBadge,
|
|
2064
2236
|
{
|
|
2065
2237
|
classNamePrefix,
|
|
@@ -2067,25 +2239,41 @@ var MatchForm = ({
|
|
|
2067
2239
|
dateFormat: DATE_FORMAT,
|
|
2068
2240
|
text: "Matched"
|
|
2069
2241
|
}
|
|
2070
|
-
))
|
|
2242
|
+
))),
|
|
2243
|
+
/* @__PURE__ */ import_react27.default.createElement("div", { className: `${classNamePrefix}__match-table__amount` }, "$", centsToDollars(match.details.amount)),
|
|
2244
|
+
/* @__PURE__ */ import_react27.default.createElement(
|
|
2245
|
+
"div",
|
|
2246
|
+
{
|
|
2247
|
+
className: `${classNamePrefix}__match-table__status ${bankTransaction.match ? "" : "no-match"}`
|
|
2248
|
+
},
|
|
2249
|
+
match.details.id === bankTransaction.match?.details.id && /* @__PURE__ */ import_react27.default.createElement(
|
|
2250
|
+
MatchBadge,
|
|
2251
|
+
{
|
|
2252
|
+
classNamePrefix,
|
|
2253
|
+
bankTransaction,
|
|
2254
|
+
dateFormat: DATE_FORMAT,
|
|
2255
|
+
text: "Matched"
|
|
2256
|
+
}
|
|
2257
|
+
)
|
|
2258
|
+
)
|
|
2071
2259
|
);
|
|
2072
|
-
}));
|
|
2260
|
+
}), matchFormError && /* @__PURE__ */ import_react27.default.createElement(ErrorText, null, matchFormError));
|
|
2073
2261
|
};
|
|
2074
2262
|
|
|
2075
2263
|
// src/components/Textarea/Textarea.tsx
|
|
2076
|
-
var
|
|
2077
|
-
var
|
|
2264
|
+
var import_react28 = __toESM(require("react"));
|
|
2265
|
+
var import_classnames14 = __toESM(require("classnames"));
|
|
2078
2266
|
var Textarea = ({
|
|
2079
2267
|
className,
|
|
2080
2268
|
...props
|
|
2081
2269
|
}) => {
|
|
2082
|
-
const baseClassName = (0,
|
|
2083
|
-
return /* @__PURE__ */
|
|
2270
|
+
const baseClassName = (0, import_classnames14.default)("Layer__textarea", className);
|
|
2271
|
+
return /* @__PURE__ */ import_react28.default.createElement("textarea", { ...props, className: baseClassName });
|
|
2084
2272
|
};
|
|
2085
2273
|
|
|
2086
2274
|
// src/components/Toggle/Toggle.tsx
|
|
2087
|
-
var
|
|
2088
|
-
var
|
|
2275
|
+
var import_react29 = __toESM(require("react"));
|
|
2276
|
+
var import_classnames15 = __toESM(require("classnames"));
|
|
2089
2277
|
var Toggle = ({
|
|
2090
2278
|
name,
|
|
2091
2279
|
options,
|
|
@@ -2093,16 +2281,16 @@ var Toggle = ({
|
|
|
2093
2281
|
onChange,
|
|
2094
2282
|
size = "medium" /* medium */
|
|
2095
2283
|
}) => {
|
|
2096
|
-
const [currentWidth, setCurrentWidth] = (0,
|
|
2097
|
-
const [thumbPos, setThumbPos] = (0,
|
|
2098
|
-
const [initialized, setInitialized] = (0,
|
|
2284
|
+
const [currentWidth, setCurrentWidth] = (0, import_react29.useState)(0);
|
|
2285
|
+
const [thumbPos, setThumbPos] = (0, import_react29.useState)({ left: 0, width: 0 });
|
|
2286
|
+
const [initialized, setInitialized] = (0, import_react29.useState)(false);
|
|
2099
2287
|
const toggleRef = useElementSize((a, b, c) => {
|
|
2100
2288
|
if (c.width && c?.width !== currentWidth) {
|
|
2101
2289
|
setCurrentWidth(c.width);
|
|
2102
2290
|
}
|
|
2103
2291
|
});
|
|
2104
2292
|
const selectedValue = selected || options[0].value;
|
|
2105
|
-
const baseClassName = (0,
|
|
2293
|
+
const baseClassName = (0, import_classnames15.default)(
|
|
2106
2294
|
"Layer__toggle",
|
|
2107
2295
|
`Layer__toggle--${size}`,
|
|
2108
2296
|
initialized ? "Layer__toggle--initialized" : ""
|
|
@@ -2130,14 +2318,14 @@ var Toggle = ({
|
|
|
2130
2318
|
shift2 = shift2 + (size === "medium" /* medium */ ? 2 : 1.5);
|
|
2131
2319
|
setThumbPos({ left: shift2, width });
|
|
2132
2320
|
};
|
|
2133
|
-
(0,
|
|
2321
|
+
(0, import_react29.useEffect)(() => {
|
|
2134
2322
|
const selectedIndex = getSelectedIndex();
|
|
2135
2323
|
updateThumbPosition(selectedIndex);
|
|
2136
2324
|
setTimeout(() => {
|
|
2137
2325
|
setInitialized(true);
|
|
2138
2326
|
}, 400);
|
|
2139
2327
|
}, []);
|
|
2140
|
-
(0,
|
|
2328
|
+
(0, import_react29.useEffect)(() => {
|
|
2141
2329
|
const selectedIndex = getSelectedIndex();
|
|
2142
2330
|
updateThumbPosition(selectedIndex);
|
|
2143
2331
|
}, [currentWidth]);
|
|
@@ -2150,7 +2338,7 @@ var Toggle = ({
|
|
|
2150
2338
|
}
|
|
2151
2339
|
return selectedIndex;
|
|
2152
2340
|
};
|
|
2153
|
-
return /* @__PURE__ */
|
|
2341
|
+
return /* @__PURE__ */ import_react29.default.createElement("div", { className: baseClassName, ref: toggleRef }, options.map((option, index) => /* @__PURE__ */ import_react29.default.createElement(
|
|
2154
2342
|
ToggleOption,
|
|
2155
2343
|
{
|
|
2156
2344
|
...option,
|
|
@@ -2162,7 +2350,7 @@ var Toggle = ({
|
|
|
2162
2350
|
disabled: option.disabled ?? false,
|
|
2163
2351
|
index
|
|
2164
2352
|
}
|
|
2165
|
-
)), /* @__PURE__ */
|
|
2353
|
+
)), /* @__PURE__ */ import_react29.default.createElement("span", { className: "Layer__toggle__thumb", style: { ...thumbPos } }));
|
|
2166
2354
|
};
|
|
2167
2355
|
var ToggleOption = ({
|
|
2168
2356
|
checked,
|
|
@@ -2175,7 +2363,21 @@ var ToggleOption = ({
|
|
|
2175
2363
|
disabled,
|
|
2176
2364
|
index
|
|
2177
2365
|
}) => {
|
|
2178
|
-
|
|
2366
|
+
if (disabled) {
|
|
2367
|
+
return /* @__PURE__ */ import_react29.default.createElement(Tooltip, null, /* @__PURE__ */ import_react29.default.createElement(TooltipTrigger, null, /* @__PURE__ */ import_react29.default.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ import_react29.default.createElement(
|
|
2368
|
+
"input",
|
|
2369
|
+
{
|
|
2370
|
+
type: "radio",
|
|
2371
|
+
checked,
|
|
2372
|
+
name,
|
|
2373
|
+
onChange,
|
|
2374
|
+
value,
|
|
2375
|
+
disabled: disabled ?? false,
|
|
2376
|
+
"data-idx": index
|
|
2377
|
+
}
|
|
2378
|
+
), /* @__PURE__ */ import_react29.default.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ import_react29.default.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ import_react29.default.createElement("span", null, label)))), /* @__PURE__ */ import_react29.default.createElement(TooltipContent, { className: "Layer__tooltip" }, "We could not find matching transactions"));
|
|
2379
|
+
}
|
|
2380
|
+
return /* @__PURE__ */ import_react29.default.createElement("label", { className: `Layer__toggle-option`, "data-checked": checked }, /* @__PURE__ */ import_react29.default.createElement(
|
|
2179
2381
|
"input",
|
|
2180
2382
|
{
|
|
2181
2383
|
type: "radio",
|
|
@@ -2186,11 +2388,158 @@ var ToggleOption = ({
|
|
|
2186
2388
|
disabled: disabled ?? false,
|
|
2187
2389
|
"data-idx": index
|
|
2188
2390
|
}
|
|
2189
|
-
), /* @__PURE__ */
|
|
2391
|
+
), /* @__PURE__ */ import_react29.default.createElement("span", { className: "Layer__toggle-option-content" }, leftIcon && /* @__PURE__ */ import_react29.default.createElement("span", { className: "Layer__toggle-option__icon" }, leftIcon), /* @__PURE__ */ import_react29.default.createElement("span", null, label)));
|
|
2392
|
+
};
|
|
2393
|
+
|
|
2394
|
+
// src/components/ExpandedBankTransactionRow/APIErrorNotifications.tsx
|
|
2395
|
+
var import_react30 = __toESM(require("react"));
|
|
2396
|
+
|
|
2397
|
+
// src/icons/AlertOctagon.tsx
|
|
2398
|
+
var React40 = __toESM(require("react"));
|
|
2399
|
+
var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React40.createElement(
|
|
2400
|
+
"svg",
|
|
2401
|
+
{
|
|
2402
|
+
viewBox: "0 0 18 18",
|
|
2403
|
+
fill: "none",
|
|
2404
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
2405
|
+
...props,
|
|
2406
|
+
width: size,
|
|
2407
|
+
height: size
|
|
2408
|
+
},
|
|
2409
|
+
/* @__PURE__ */ React40.createElement(
|
|
2410
|
+
"path",
|
|
2411
|
+
{
|
|
2412
|
+
d: "M5.895 1.5H12.105L16.5 5.895V12.105L12.105 16.5H5.895L1.5 12.105V5.895L5.895 1.5Z",
|
|
2413
|
+
stroke: "currentColor",
|
|
2414
|
+
strokeLinecap: "round",
|
|
2415
|
+
strokeLinejoin: "round"
|
|
2416
|
+
}
|
|
2417
|
+
),
|
|
2418
|
+
/* @__PURE__ */ React40.createElement(
|
|
2419
|
+
"path",
|
|
2420
|
+
{
|
|
2421
|
+
d: "M9 6V9",
|
|
2422
|
+
stroke: "currentColor",
|
|
2423
|
+
strokeLinecap: "round",
|
|
2424
|
+
strokeLinejoin: "round"
|
|
2425
|
+
}
|
|
2426
|
+
),
|
|
2427
|
+
/* @__PURE__ */ React40.createElement(
|
|
2428
|
+
"path",
|
|
2429
|
+
{
|
|
2430
|
+
d: "M9 12H9.0075",
|
|
2431
|
+
stroke: "currentColor",
|
|
2432
|
+
strokeLinecap: "round",
|
|
2433
|
+
strokeLinejoin: "round"
|
|
2434
|
+
}
|
|
2435
|
+
)
|
|
2436
|
+
);
|
|
2437
|
+
var AlertOctagon_default = AlertOctagon;
|
|
2438
|
+
|
|
2439
|
+
// src/components/ExpandedBankTransactionRow/APIErrorNotifications.tsx
|
|
2440
|
+
var ERROR_TITLE = "Approval Failed";
|
|
2441
|
+
var ERROR_MESSAGE = "Something went wrong, try again later";
|
|
2442
|
+
var NOTIFICATION_TIME = 4e3;
|
|
2443
|
+
var FADE_OUT_TIME_WAIT = 1e3;
|
|
2444
|
+
var notificationsCache = [];
|
|
2445
|
+
var APIErrorNotifications = ({
|
|
2446
|
+
bankTransaction,
|
|
2447
|
+
containerWidth
|
|
2448
|
+
}) => {
|
|
2449
|
+
const [notifications, setNotifications] = (0, import_react30.useState)([]);
|
|
2450
|
+
const pushNotification = (title, message) => {
|
|
2451
|
+
const timestamp = (/* @__PURE__ */ new Date()).valueOf();
|
|
2452
|
+
if (notificationsCache.find(
|
|
2453
|
+
(n) => n.timestamp === timestamp && n.bankTransactionId !== bankTransaction.id
|
|
2454
|
+
)) {
|
|
2455
|
+
return;
|
|
2456
|
+
}
|
|
2457
|
+
notificationsCache = notificationsCache.concat({
|
|
2458
|
+
bankTransactionId: bankTransaction.id,
|
|
2459
|
+
timestamp,
|
|
2460
|
+
title,
|
|
2461
|
+
message
|
|
2462
|
+
});
|
|
2463
|
+
const ids = notificationsCache.map(
|
|
2464
|
+
({ bankTransactionId }) => bankTransactionId
|
|
2465
|
+
);
|
|
2466
|
+
const timestamps = notificationsCache.map(({ timestamp: timestamp2 }) => timestamp2);
|
|
2467
|
+
notificationsCache = notificationsCache.filter(
|
|
2468
|
+
({ bankTransactionId, timestamp: timestamp2 }, index) => !ids.includes(bankTransactionId, index + 1) && !timestamps.includes(timestamp2, index + 1)
|
|
2469
|
+
);
|
|
2470
|
+
setNotifications(notificationsCache.concat());
|
|
2471
|
+
};
|
|
2472
|
+
const deleteNotification = (timestamp) => {
|
|
2473
|
+
notificationsCache = notificationsCache.filter(
|
|
2474
|
+
(n) => n.timestamp !== timestamp
|
|
2475
|
+
);
|
|
2476
|
+
setNotifications(notificationsCache.concat());
|
|
2477
|
+
};
|
|
2478
|
+
(0, import_react30.useEffect)(() => {
|
|
2479
|
+
if (bankTransaction.error) {
|
|
2480
|
+
pushNotification(ERROR_TITLE, ERROR_MESSAGE);
|
|
2481
|
+
}
|
|
2482
|
+
}, [bankTransaction.error]);
|
|
2483
|
+
return /* @__PURE__ */ import_react30.default.createElement(
|
|
2484
|
+
"div",
|
|
2485
|
+
{
|
|
2486
|
+
className: "Layer__bank-transactions__notifications",
|
|
2487
|
+
style: containerWidth ? { left: containerWidth - 324 } : {}
|
|
2488
|
+
},
|
|
2489
|
+
notifications.filter((n) => n.bankTransactionId === bankTransaction.id).map((notification) => /* @__PURE__ */ import_react30.default.createElement(
|
|
2490
|
+
Notification,
|
|
2491
|
+
{
|
|
2492
|
+
key: notification.timestamp,
|
|
2493
|
+
notification,
|
|
2494
|
+
deleteNotification
|
|
2495
|
+
}
|
|
2496
|
+
))
|
|
2497
|
+
);
|
|
2498
|
+
};
|
|
2499
|
+
var Notification = ({
|
|
2500
|
+
notification,
|
|
2501
|
+
deleteNotification
|
|
2502
|
+
}) => {
|
|
2503
|
+
const [visible, setVisible] = (0, import_react30.useState)(false);
|
|
2504
|
+
(0, import_react30.useEffect)(() => {
|
|
2505
|
+
setVisible(true);
|
|
2506
|
+
const timer = setTimeout(() => {
|
|
2507
|
+
hideNotification();
|
|
2508
|
+
}, NOTIFICATION_TIME);
|
|
2509
|
+
return () => clearTimeout(timer);
|
|
2510
|
+
}, []);
|
|
2511
|
+
const hideNotification = () => {
|
|
2512
|
+
setVisible(false);
|
|
2513
|
+
setTimeout(() => {
|
|
2514
|
+
deleteNotification(notification.timestamp);
|
|
2515
|
+
}, FADE_OUT_TIME_WAIT);
|
|
2516
|
+
};
|
|
2517
|
+
return /* @__PURE__ */ import_react30.default.createElement(
|
|
2518
|
+
"div",
|
|
2519
|
+
{
|
|
2520
|
+
className: `Layer__bank-transactions__notification ${visible ? "notification-enter" : "notification-exit"}`,
|
|
2521
|
+
onClick: hideNotification
|
|
2522
|
+
},
|
|
2523
|
+
/* @__PURE__ */ import_react30.default.createElement("div", { className: "Layer__bank-transactions__notification-content" }, /* @__PURE__ */ import_react30.default.createElement("div", { className: "Layer__bank-transactions__notification-icon" }, /* @__PURE__ */ import_react30.default.createElement(AlertOctagon_default, { size: 14 })), /* @__PURE__ */ import_react30.default.createElement("div", { className: "Layer__bank-transactions__notification-text" }, /* @__PURE__ */ import_react30.default.createElement(
|
|
2524
|
+
Text,
|
|
2525
|
+
{
|
|
2526
|
+
as: "span",
|
|
2527
|
+
className: "Layer__bank-transactions__notification-title"
|
|
2528
|
+
},
|
|
2529
|
+
notification.title
|
|
2530
|
+
), /* @__PURE__ */ import_react30.default.createElement(
|
|
2531
|
+
Text,
|
|
2532
|
+
{
|
|
2533
|
+
as: "span",
|
|
2534
|
+
className: "Layer__bank-transactions__notification-message"
|
|
2535
|
+
},
|
|
2536
|
+
notification.message
|
|
2537
|
+
)))
|
|
2538
|
+
);
|
|
2190
2539
|
};
|
|
2191
2540
|
|
|
2192
2541
|
// src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
|
|
2193
|
-
var
|
|
2542
|
+
var import_classnames16 = __toESM(require("classnames"));
|
|
2194
2543
|
var hasMatch = (bankTransaction) => {
|
|
2195
2544
|
return Boolean(
|
|
2196
2545
|
bankTransaction?.suggested_matches && bankTransaction?.suggested_matches?.length > 0 || bankTransaction?.match
|
|
@@ -2205,29 +2554,44 @@ var isAlreadyMatched = (bankTransaction) => {
|
|
|
2205
2554
|
}
|
|
2206
2555
|
return void 0;
|
|
2207
2556
|
};
|
|
2208
|
-
var
|
|
2557
|
+
var validateSplit = (splitData) => {
|
|
2558
|
+
let valid = true;
|
|
2559
|
+
splitData.splits.forEach((split) => {
|
|
2560
|
+
if (split.amount <= 0) {
|
|
2561
|
+
valid = false;
|
|
2562
|
+
} else if (!split.category) {
|
|
2563
|
+
valid = false;
|
|
2564
|
+
}
|
|
2565
|
+
});
|
|
2566
|
+
return valid;
|
|
2567
|
+
};
|
|
2568
|
+
var ExpandedBankTransactionRow = (0, import_react31.forwardRef)(
|
|
2209
2569
|
({
|
|
2210
2570
|
bankTransaction,
|
|
2211
2571
|
isOpen = false,
|
|
2572
|
+
editable,
|
|
2212
2573
|
asListItem = false,
|
|
2213
|
-
submitBtnText = "Save"
|
|
2574
|
+
submitBtnText = "Save",
|
|
2575
|
+
containerWidth
|
|
2214
2576
|
}, ref) => {
|
|
2215
2577
|
const {
|
|
2216
2578
|
categorize: categorizeBankTransaction2,
|
|
2217
2579
|
match: matchBankTransaction2
|
|
2218
2580
|
} = useBankTransactions();
|
|
2219
|
-
const [purpose, setPurpose] = (0,
|
|
2581
|
+
const [purpose, setPurpose] = (0, import_react31.useState)(
|
|
2220
2582
|
bankTransaction.category ? "categorize" /* categorize */ : hasMatch(bankTransaction) ? "match" /* match */ : "categorize" /* categorize */
|
|
2221
2583
|
);
|
|
2222
|
-
const [selectedMatchId, setSelectedMatchId] = (0,
|
|
2584
|
+
const [selectedMatchId, setSelectedMatchId] = (0, import_react31.useState)(
|
|
2223
2585
|
isAlreadyMatched(bankTransaction)
|
|
2224
2586
|
);
|
|
2225
|
-
const [
|
|
2226
|
-
const [
|
|
2227
|
-
const
|
|
2228
|
-
const [
|
|
2587
|
+
const [matchFormError, setMatchFormError] = (0, import_react31.useState)();
|
|
2588
|
+
const [splitFormError, setSplitFormError] = (0, import_react31.useState)();
|
|
2589
|
+
const [height, setHeight] = (0, import_react31.useState)(0);
|
|
2590
|
+
const [isOver, setOver] = (0, import_react31.useState)(false);
|
|
2591
|
+
const bodyRef = (0, import_react31.useRef)(null);
|
|
2592
|
+
const [isLoaded, setIsLoaded] = (0, import_react31.useState)(false);
|
|
2229
2593
|
const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && bankTransaction.categorization_flow?.suggestions?.[0];
|
|
2230
|
-
const [rowState, updateRowState] = (0,
|
|
2594
|
+
const [rowState, updateRowState] = (0, import_react31.useState)({
|
|
2231
2595
|
splits: bankTransaction.category?.entries ? bankTransaction.category?.entries.map((c) => {
|
|
2232
2596
|
return {
|
|
2233
2597
|
amount: c.amount || 0,
|
|
@@ -2244,13 +2608,16 @@ var ExpandedBankTransactionRow = (0, import_react28.forwardRef)(
|
|
|
2244
2608
|
description: "",
|
|
2245
2609
|
file: void 0
|
|
2246
2610
|
});
|
|
2247
|
-
const addSplit = () =>
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2611
|
+
const addSplit = () => {
|
|
2612
|
+
updateRowState({
|
|
2613
|
+
...rowState,
|
|
2614
|
+
splits: [
|
|
2615
|
+
...rowState.splits,
|
|
2616
|
+
{ amount: 0, inputValue: "0.00", category: defaultCategory }
|
|
2617
|
+
]
|
|
2618
|
+
});
|
|
2619
|
+
setSplitFormError(void 0);
|
|
2620
|
+
};
|
|
2254
2621
|
const removeSplit = (index) => {
|
|
2255
2622
|
const newSplits = rowState.splits.filter((_v, idx) => idx !== index);
|
|
2256
2623
|
const splitTotal = newSplits.reduce((sum, split, index2) => {
|
|
@@ -2264,6 +2631,7 @@ var ExpandedBankTransactionRow = (0, import_react28.forwardRef)(
|
|
|
2264
2631
|
...rowState,
|
|
2265
2632
|
splits: newSplits
|
|
2266
2633
|
});
|
|
2634
|
+
setSplitFormError(void 0);
|
|
2267
2635
|
};
|
|
2268
2636
|
const updateAmounts = (rowNumber) => (event) => {
|
|
2269
2637
|
const newAmount = dollarsToCents(event.target.value) || 0;
|
|
@@ -2278,28 +2646,47 @@ var ExpandedBankTransactionRow = (0, import_react28.forwardRef)(
|
|
|
2278
2646
|
rowState.splits[0].amount = remaining;
|
|
2279
2647
|
rowState.splits[0].inputValue = centsToDollars(remaining);
|
|
2280
2648
|
updateRowState({ ...rowState });
|
|
2649
|
+
setSplitFormError(void 0);
|
|
2281
2650
|
};
|
|
2282
2651
|
const onBlur = (event) => {
|
|
2283
2652
|
if (event.target.value === "") {
|
|
2284
2653
|
const [_, index] = event.target.name.split("-");
|
|
2285
2654
|
rowState.splits[parseInt(index)].inputValue = "0.00";
|
|
2286
2655
|
updateRowState({ ...rowState });
|
|
2656
|
+
setSplitFormError(void 0);
|
|
2287
2657
|
}
|
|
2288
2658
|
};
|
|
2289
|
-
const onChangePurpose = (event) =>
|
|
2290
|
-
|
|
2291
|
-
|
|
2659
|
+
const onChangePurpose = (event) => {
|
|
2660
|
+
setPurpose(
|
|
2661
|
+
event.target.value === "match" /* match */ ? "match" /* match */ : "categorize" /* categorize */
|
|
2662
|
+
);
|
|
2663
|
+
setSplitFormError(void 0);
|
|
2664
|
+
setMatchFormError(void 0);
|
|
2665
|
+
};
|
|
2292
2666
|
const changeCategory = (index, newValue) => {
|
|
2293
2667
|
rowState.splits[index].category = newValue;
|
|
2294
2668
|
updateRowState({ ...rowState });
|
|
2669
|
+
setSplitFormError(void 0);
|
|
2295
2670
|
};
|
|
2296
2671
|
const save = () => {
|
|
2297
2672
|
if (purpose === "match" /* match */) {
|
|
2298
|
-
if (selectedMatchId
|
|
2673
|
+
if (!selectedMatchId) {
|
|
2674
|
+
setMatchFormError("Select an option to match the transaction");
|
|
2675
|
+
} else if (selectedMatchId && selectedMatchId !== isAlreadyMatched(bankTransaction)) {
|
|
2299
2676
|
onMatchSubmit(selectedMatchId);
|
|
2300
2677
|
}
|
|
2301
2678
|
return;
|
|
2302
2679
|
}
|
|
2680
|
+
if (!validateSplit(rowState)) {
|
|
2681
|
+
if (rowState.splits.length > 1) {
|
|
2682
|
+
setSplitFormError(
|
|
2683
|
+
"Use only positive amounts and select category for each entry"
|
|
2684
|
+
);
|
|
2685
|
+
} else {
|
|
2686
|
+
setSplitFormError("Category is required");
|
|
2687
|
+
}
|
|
2688
|
+
return;
|
|
2689
|
+
}
|
|
2303
2690
|
categorizeBankTransaction2(
|
|
2304
2691
|
bankTransaction.id,
|
|
2305
2692
|
rowState.splits.length === 1 ? {
|
|
@@ -2315,9 +2702,9 @@ var ExpandedBankTransactionRow = (0, import_react28.forwardRef)(
|
|
|
2315
2702
|
amount: split.amount
|
|
2316
2703
|
}))
|
|
2317
2704
|
}
|
|
2318
|
-
)
|
|
2705
|
+
);
|
|
2319
2706
|
};
|
|
2320
|
-
(0,
|
|
2707
|
+
(0, import_react31.useImperativeHandle)(ref, () => ({
|
|
2321
2708
|
save
|
|
2322
2709
|
}));
|
|
2323
2710
|
const onMatchSubmit = (matchId) => {
|
|
@@ -2329,11 +2716,11 @@ var ExpandedBankTransactionRow = (0, import_react28.forwardRef)(
|
|
|
2329
2716
|
}
|
|
2330
2717
|
matchBankTransaction2(bankTransaction.id, foundMatch.id);
|
|
2331
2718
|
};
|
|
2332
|
-
const getDivHeight = (0,
|
|
2719
|
+
const getDivHeight = (0, import_react31.useCallback)(() => {
|
|
2333
2720
|
const { height: height2 } = bodyRef.current ? bodyRef.current.getBoundingClientRect() : { height: void 0 };
|
|
2334
2721
|
return height2 || 0;
|
|
2335
2722
|
}, []);
|
|
2336
|
-
const handleTransitionEnd = (0,
|
|
2723
|
+
const handleTransitionEnd = (0, import_react31.useCallback)(
|
|
2337
2724
|
(e) => {
|
|
2338
2725
|
if (e.propertyName === "height") {
|
|
2339
2726
|
setHeight(isOpen ? "auto" : 0);
|
|
@@ -2344,7 +2731,7 @@ var ExpandedBankTransactionRow = (0, import_react28.forwardRef)(
|
|
|
2344
2731
|
},
|
|
2345
2732
|
[isOpen]
|
|
2346
2733
|
);
|
|
2347
|
-
(0,
|
|
2734
|
+
(0, import_react31.useEffect)(() => {
|
|
2348
2735
|
if (!isLoaded) {
|
|
2349
2736
|
return;
|
|
2350
2737
|
}
|
|
@@ -2356,20 +2743,20 @@ var ExpandedBankTransactionRow = (0, import_react28.forwardRef)(
|
|
|
2356
2743
|
});
|
|
2357
2744
|
}
|
|
2358
2745
|
}, [getDivHeight, isOpen]);
|
|
2359
|
-
(0,
|
|
2746
|
+
(0, import_react31.useEffect)(() => {
|
|
2360
2747
|
setIsLoaded(true);
|
|
2361
2748
|
setOver(true);
|
|
2362
2749
|
}, []);
|
|
2363
2750
|
const className = "Layer__expanded-bank-transaction-row";
|
|
2364
2751
|
const shouldHide = !isOpen && isOver;
|
|
2365
|
-
return /* @__PURE__ */
|
|
2752
|
+
return /* @__PURE__ */ import_react31.default.createElement(
|
|
2366
2753
|
"span",
|
|
2367
2754
|
{
|
|
2368
2755
|
className: `${className} ${className}--${isOpen ? "expanded" : "collapsed"}`,
|
|
2369
2756
|
style: { height },
|
|
2370
2757
|
onTransitionEnd: handleTransitionEnd
|
|
2371
2758
|
},
|
|
2372
|
-
shouldHide ? null : /* @__PURE__ */
|
|
2759
|
+
shouldHide ? null : /* @__PURE__ */ import_react31.default.createElement("span", { className: `${className}__wrapper`, ref: bodyRef }, /* @__PURE__ */ import_react31.default.createElement("div", { className: `${className}__content-toggle` }, /* @__PURE__ */ import_react31.default.createElement(
|
|
2373
2760
|
Toggle,
|
|
2374
2761
|
{
|
|
2375
2762
|
name: `purpose-${bankTransaction.id}${asListItem ? "-li" : ""}`,
|
|
@@ -2388,46 +2775,50 @@ var ExpandedBankTransactionRow = (0, import_react28.forwardRef)(
|
|
|
2388
2775
|
selected: purpose,
|
|
2389
2776
|
onChange: onChangePurpose
|
|
2390
2777
|
}
|
|
2391
|
-
)), /* @__PURE__ */
|
|
2778
|
+
)), /* @__PURE__ */ import_react31.default.createElement(
|
|
2392
2779
|
"div",
|
|
2393
2780
|
{
|
|
2394
2781
|
className: `${className}__content`,
|
|
2395
2782
|
id: `expanded-${bankTransaction.id}`
|
|
2396
2783
|
},
|
|
2397
|
-
/* @__PURE__ */
|
|
2784
|
+
/* @__PURE__ */ import_react31.default.createElement("div", { className: `${className}__content-panels` }, /* @__PURE__ */ import_react31.default.createElement(
|
|
2398
2785
|
"div",
|
|
2399
2786
|
{
|
|
2400
|
-
className: (0,
|
|
2787
|
+
className: (0, import_classnames16.default)(
|
|
2401
2788
|
`${className}__match`,
|
|
2402
2789
|
`${className}__content-panel`,
|
|
2403
2790
|
purpose === "match" /* match */ ? `${className}__content-panel--active` : ""
|
|
2404
2791
|
)
|
|
2405
2792
|
},
|
|
2406
|
-
/* @__PURE__ */
|
|
2793
|
+
/* @__PURE__ */ import_react31.default.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ import_react31.default.createElement(
|
|
2407
2794
|
MatchForm,
|
|
2408
2795
|
{
|
|
2409
2796
|
classNamePrefix: className,
|
|
2410
2797
|
bankTransaction,
|
|
2411
2798
|
selectedMatchId,
|
|
2412
|
-
setSelectedMatchId
|
|
2799
|
+
setSelectedMatchId: (id) => {
|
|
2800
|
+
setMatchFormError(void 0);
|
|
2801
|
+
setSelectedMatchId(id);
|
|
2802
|
+
},
|
|
2803
|
+
matchFormError
|
|
2413
2804
|
}
|
|
2414
2805
|
))
|
|
2415
|
-
), /* @__PURE__ */
|
|
2806
|
+
), /* @__PURE__ */ import_react31.default.createElement(
|
|
2416
2807
|
"div",
|
|
2417
2808
|
{
|
|
2418
|
-
className: (0,
|
|
2809
|
+
className: (0, import_classnames16.default)(
|
|
2419
2810
|
`${className}__splits`,
|
|
2420
2811
|
`${className}__content-panel`,
|
|
2421
2812
|
purpose === "categorize" /* categorize */ ? `${className}__content-panel--active` : ""
|
|
2422
2813
|
)
|
|
2423
2814
|
},
|
|
2424
|
-
/* @__PURE__ */
|
|
2815
|
+
/* @__PURE__ */ import_react31.default.createElement("div", { className: `${className}__content-panel-container` }, /* @__PURE__ */ import_react31.default.createElement("div", { className: `${className}__splits-inputs` }, rowState.splits.map((split, index) => /* @__PURE__ */ import_react31.default.createElement(
|
|
2425
2816
|
"div",
|
|
2426
2817
|
{
|
|
2427
2818
|
className: `${className}__table-cell--split-entry`,
|
|
2428
2819
|
key: `split-${index}`
|
|
2429
2820
|
},
|
|
2430
|
-
/* @__PURE__ */
|
|
2821
|
+
/* @__PURE__ */ import_react31.default.createElement(
|
|
2431
2822
|
Input,
|
|
2432
2823
|
{
|
|
2433
2824
|
type: "text",
|
|
@@ -2440,66 +2831,81 @@ var ExpandedBankTransactionRow = (0, import_react28.forwardRef)(
|
|
|
2440
2831
|
errorMessage: "Negative values are not allowed"
|
|
2441
2832
|
}
|
|
2442
2833
|
),
|
|
2443
|
-
/* @__PURE__ */
|
|
2444
|
-
|
|
2834
|
+
/* @__PURE__ */ import_react31.default.createElement(
|
|
2835
|
+
"div",
|
|
2445
2836
|
{
|
|
2446
|
-
|
|
2447
|
-
name: `category-${index}${asListItem ? "-li" : ""}`,
|
|
2448
|
-
value: split.category,
|
|
2449
|
-
onChange: (value) => changeCategory(index, value),
|
|
2450
|
-
className: "Layer__category-menu--full"
|
|
2451
|
-
}
|
|
2452
|
-
),
|
|
2453
|
-
index > 0 && /* @__PURE__ */ import_react28.default.createElement(
|
|
2454
|
-
Button,
|
|
2455
|
-
{
|
|
2456
|
-
onClick: () => removeSplit(index),
|
|
2457
|
-
rightIcon: /* @__PURE__ */ import_react28.default.createElement(Link_default, { size: 14 }),
|
|
2458
|
-
variant: "secondary" /* secondary */
|
|
2837
|
+
className: `${className}__table-cell--split-entry__right-col`
|
|
2459
2838
|
},
|
|
2460
|
-
|
|
2839
|
+
/* @__PURE__ */ import_react31.default.createElement(
|
|
2840
|
+
CategoryMenu,
|
|
2841
|
+
{
|
|
2842
|
+
bankTransaction,
|
|
2843
|
+
name: `category-${index}${asListItem ? "-li" : ""}`,
|
|
2844
|
+
value: split.category,
|
|
2845
|
+
onChange: (value) => changeCategory(index, value),
|
|
2846
|
+
className: "Layer__category-menu--full"
|
|
2847
|
+
}
|
|
2848
|
+
),
|
|
2849
|
+
index > 0 && /* @__PURE__ */ import_react31.default.createElement(
|
|
2850
|
+
Button,
|
|
2851
|
+
{
|
|
2852
|
+
className: `${className}__table-cell--split-entry__merge-btn`,
|
|
2853
|
+
onClick: () => removeSplit(index),
|
|
2854
|
+
rightIcon: /* @__PURE__ */ import_react31.default.createElement(Trash_default, { size: 18 }),
|
|
2855
|
+
variant: "secondary" /* secondary */,
|
|
2856
|
+
iconOnly: true
|
|
2857
|
+
}
|
|
2858
|
+
)
|
|
2461
2859
|
)
|
|
2462
|
-
))), /* @__PURE__ */
|
|
2860
|
+
))), splitFormError && /* @__PURE__ */ import_react31.default.createElement(ErrorText, null, splitFormError), /* @__PURE__ */ import_react31.default.createElement("div", { className: `${className}__total-and-btns` }, rowState.splits.length > 1 && /* @__PURE__ */ import_react31.default.createElement(
|
|
2861
|
+
Input,
|
|
2862
|
+
{
|
|
2863
|
+
disabled: true,
|
|
2864
|
+
leftText: "Total",
|
|
2865
|
+
value: `$${centsToDollars(
|
|
2866
|
+
rowState.splits.reduce(
|
|
2867
|
+
(x, { amount }) => x + amount,
|
|
2868
|
+
0
|
|
2869
|
+
)
|
|
2870
|
+
)}`
|
|
2871
|
+
}
|
|
2872
|
+
), /* @__PURE__ */ import_react31.default.createElement("div", { className: `${className}__splits-buttons` }, rowState.splits.length > 1 ? /* @__PURE__ */ import_react31.default.createElement(
|
|
2463
2873
|
TextButton,
|
|
2464
2874
|
{
|
|
2465
2875
|
onClick: addSplit,
|
|
2466
2876
|
disabled: rowState.splits.length > 5
|
|
2467
2877
|
},
|
|
2468
2878
|
"Add new split"
|
|
2469
|
-
) : /* @__PURE__ */
|
|
2879
|
+
) : /* @__PURE__ */ import_react31.default.createElement(
|
|
2470
2880
|
Button,
|
|
2471
2881
|
{
|
|
2472
2882
|
onClick: addSplit,
|
|
2473
|
-
rightIcon: /* @__PURE__ */
|
|
2883
|
+
rightIcon: /* @__PURE__ */ import_react31.default.createElement(ScissorsFullOpen_default, { size: 14 }),
|
|
2474
2884
|
variant: "secondary" /* secondary */,
|
|
2475
2885
|
disabled: rowState.splits.length > 5
|
|
2476
2886
|
},
|
|
2477
2887
|
"Split"
|
|
2478
|
-
))
|
|
2479
|
-
Text,
|
|
2480
|
-
{
|
|
2481
|
-
size: "sm" /* sm */,
|
|
2482
|
-
className: `${className}__splits-total`
|
|
2483
|
-
},
|
|
2484
|
-
"Total: $",
|
|
2485
|
-
centsToDollars(
|
|
2486
|
-
rowState.splits.reduce(
|
|
2487
|
-
(x, { amount }) => x + amount,
|
|
2488
|
-
0
|
|
2489
|
-
)
|
|
2490
|
-
)
|
|
2491
|
-
))
|
|
2888
|
+
))))
|
|
2492
2889
|
)),
|
|
2493
|
-
/* @__PURE__ */
|
|
2890
|
+
/* @__PURE__ */ import_react31.default.createElement(
|
|
2494
2891
|
InputGroup,
|
|
2495
2892
|
{
|
|
2496
2893
|
className: `${className}__description`,
|
|
2497
2894
|
name: "description"
|
|
2498
2895
|
},
|
|
2499
|
-
/* @__PURE__ */
|
|
2896
|
+
/* @__PURE__ */ import_react31.default.createElement(Textarea, { name: "description", placeholder: "Add description" })
|
|
2500
2897
|
),
|
|
2501
|
-
/* @__PURE__ */
|
|
2502
|
-
asListItem ? /* @__PURE__ */
|
|
2898
|
+
/* @__PURE__ */ import_react31.default.createElement("div", { className: `${className}__file-upload` }, /* @__PURE__ */ import_react31.default.createElement(FileInput, { text: "Upload receipt" })),
|
|
2899
|
+
asListItem ? /* @__PURE__ */ import_react31.default.createElement("div", { className: `${className}__submit-btn` }, bankTransaction.error ? /* @__PURE__ */ import_react31.default.createElement(
|
|
2900
|
+
Text,
|
|
2901
|
+
{
|
|
2902
|
+
as: "span",
|
|
2903
|
+
size: "md" /* md */,
|
|
2904
|
+
className: "Layer__unsaved-info"
|
|
2905
|
+
},
|
|
2906
|
+
/* @__PURE__ */ import_react31.default.createElement("span", null, "Unsaved"),
|
|
2907
|
+
/* @__PURE__ */ import_react31.default.createElement(AlertCircle_default, { size: 12 })
|
|
2908
|
+
) : null, /* @__PURE__ */ import_react31.default.createElement(
|
|
2503
2909
|
SubmitButton,
|
|
2504
2910
|
{
|
|
2505
2911
|
onClick: () => {
|
|
@@ -2509,18 +2915,24 @@ var ExpandedBankTransactionRow = (0, import_react28.forwardRef)(
|
|
|
2509
2915
|
},
|
|
2510
2916
|
className: "Layer__bank-transaction__submit-btn",
|
|
2511
2917
|
processing: bankTransaction.processing,
|
|
2512
|
-
|
|
2513
|
-
|
|
2918
|
+
active: true,
|
|
2919
|
+
action: editable ? "save" /* SAVE */ : "update" /* UPDATE */
|
|
2514
2920
|
},
|
|
2515
2921
|
submitBtnText
|
|
2516
2922
|
)) : null
|
|
2923
|
+
), /* @__PURE__ */ import_react31.default.createElement(
|
|
2924
|
+
APIErrorNotifications,
|
|
2925
|
+
{
|
|
2926
|
+
bankTransaction,
|
|
2927
|
+
containerWidth
|
|
2928
|
+
}
|
|
2517
2929
|
))
|
|
2518
2930
|
);
|
|
2519
2931
|
}
|
|
2520
2932
|
);
|
|
2521
2933
|
|
|
2522
2934
|
// src/components/BankTransactionRow/SplitTooltipDetails.tsx
|
|
2523
|
-
var
|
|
2935
|
+
var import_react32 = __toESM(require("react"));
|
|
2524
2936
|
var SplitTooltipDetails = ({
|
|
2525
2937
|
classNamePrefix,
|
|
2526
2938
|
category
|
|
@@ -2528,11 +2940,11 @@ var SplitTooltipDetails = ({
|
|
|
2528
2940
|
if (!category.entries) {
|
|
2529
2941
|
return;
|
|
2530
2942
|
}
|
|
2531
|
-
return /* @__PURE__ */
|
|
2943
|
+
return /* @__PURE__ */ import_react32.default.createElement("span", { className: `${classNamePrefix}__split-tooltip` }, /* @__PURE__ */ import_react32.default.createElement("ul", null, category.entries.map((entry, idx) => /* @__PURE__ */ import_react32.default.createElement("li", { key: idx }, /* @__PURE__ */ import_react32.default.createElement("span", { className: `${classNamePrefix}__split-tooltip__label` }, entry.category.display_name), /* @__PURE__ */ import_react32.default.createElement("span", { className: `${classNamePrefix}__split-tooltip__value` }, "$", centsToDollars(entry.amount))))));
|
|
2532
2944
|
};
|
|
2533
2945
|
|
|
2534
2946
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
2535
|
-
var
|
|
2947
|
+
var import_classnames17 = __toESM(require("classnames"));
|
|
2536
2948
|
var import_date_fns7 = require("date-fns");
|
|
2537
2949
|
var isCredit = ({ direction }) => direction === "CREDIT" /* CREDIT */;
|
|
2538
2950
|
var extractDescriptionForSplit = (category) => {
|
|
@@ -2544,23 +2956,53 @@ var extractDescriptionForSplit = (category) => {
|
|
|
2544
2956
|
var getDefaultSelectedCategory = (bankTransaction) => {
|
|
2545
2957
|
return hasSuggestions(bankTransaction.categorization_flow) ? mapCategoryToOption(bankTransaction.categorization_flow.suggestions[0]) : bankTransaction.suggested_matches?.length === 1 ? mapSuggestedMatchToOption(bankTransaction.suggested_matches[0]) : void 0;
|
|
2546
2958
|
};
|
|
2959
|
+
var clickTimer = Date.now();
|
|
2547
2960
|
var BankTransactionRow = ({
|
|
2961
|
+
index = 0,
|
|
2548
2962
|
dateFormat,
|
|
2549
2963
|
bankTransaction,
|
|
2550
|
-
editable
|
|
2964
|
+
editable,
|
|
2965
|
+
removeTransaction,
|
|
2966
|
+
containerWidth
|
|
2551
2967
|
}) => {
|
|
2552
|
-
const expandedRowRef = (0,
|
|
2553
|
-
const [
|
|
2968
|
+
const expandedRowRef = (0, import_react33.useRef)(null);
|
|
2969
|
+
const [showRetry, setShowRetry] = (0, import_react33.useState)(false);
|
|
2970
|
+
const [removed, setRemoved] = (0, import_react33.useState)(false);
|
|
2554
2971
|
const { categorize: categorizeBankTransaction2, match: matchBankTransaction2 } = useBankTransactions();
|
|
2555
|
-
const [selectedCategory, setSelectedCategory] = (0,
|
|
2972
|
+
const [selectedCategory, setSelectedCategory] = (0, import_react33.useState)(
|
|
2556
2973
|
getDefaultSelectedCategory(bankTransaction)
|
|
2557
2974
|
);
|
|
2558
|
-
const [open, setOpen] = (0,
|
|
2559
|
-
const toggleOpen = () =>
|
|
2560
|
-
|
|
2975
|
+
const [open, setOpen] = (0, import_react33.useState)(false);
|
|
2976
|
+
const toggleOpen = () => {
|
|
2977
|
+
setShowRetry(false);
|
|
2978
|
+
setOpen(!open);
|
|
2979
|
+
};
|
|
2980
|
+
const openRow = {
|
|
2981
|
+
onMouseDown: () => {
|
|
2982
|
+
clickTimer = Date.now();
|
|
2983
|
+
},
|
|
2984
|
+
onMouseUp: () => {
|
|
2985
|
+
if (Date.now() - clickTimer < 100 && !open) {
|
|
2986
|
+
setShowRetry(false);
|
|
2987
|
+
setOpen(true);
|
|
2988
|
+
}
|
|
2989
|
+
}
|
|
2990
|
+
};
|
|
2991
|
+
const [showComponent, setShowComponent] = (0, import_react33.useState)(false);
|
|
2992
|
+
(0, import_react33.useEffect)(() => {
|
|
2993
|
+
const timeoutId = setTimeout(() => {
|
|
2994
|
+
setShowComponent(true);
|
|
2995
|
+
}, index * 80);
|
|
2996
|
+
return () => clearTimeout(timeoutId);
|
|
2997
|
+
}, []);
|
|
2998
|
+
(0, import_react33.useEffect)(() => {
|
|
2999
|
+
if (bankTransaction.error) {
|
|
3000
|
+
setShowRetry(true);
|
|
3001
|
+
}
|
|
3002
|
+
}, [bankTransaction.error]);
|
|
3003
|
+
const save = async () => {
|
|
2561
3004
|
if (open && expandedRowRef?.current) {
|
|
2562
3005
|
expandedRowRef?.current?.save();
|
|
2563
|
-
setOpen(false);
|
|
2564
3006
|
return;
|
|
2565
3007
|
}
|
|
2566
3008
|
if (!selectedCategory) {
|
|
@@ -2583,80 +3025,107 @@ var BankTransactionRow = ({
|
|
|
2583
3025
|
}
|
|
2584
3026
|
const className = "Layer__bank-transaction-row";
|
|
2585
3027
|
const openClassName = open ? `${className}--expanded` : "";
|
|
2586
|
-
const rowClassName = (0,
|
|
3028
|
+
const rowClassName = (0, import_classnames17.default)(
|
|
2587
3029
|
className,
|
|
2588
3030
|
bankTransaction.recently_categorized ? "Layer__bank-transaction-row--removing" : "",
|
|
2589
|
-
open ? openClassName : ""
|
|
3031
|
+
open ? openClassName : "",
|
|
3032
|
+
showComponent ? "show" : ""
|
|
2590
3033
|
);
|
|
2591
|
-
return /* @__PURE__ */
|
|
3034
|
+
return /* @__PURE__ */ import_react33.default.createElement(import_react33.default.Fragment, null, /* @__PURE__ */ import_react33.default.createElement(
|
|
2592
3035
|
"tr",
|
|
2593
3036
|
{
|
|
2594
3037
|
className: rowClassName,
|
|
2595
3038
|
onTransitionEnd: ({ propertyName }) => {
|
|
2596
3039
|
if (propertyName === "top") {
|
|
2597
3040
|
setRemoved(true);
|
|
3041
|
+
removeTransaction(bankTransaction.id);
|
|
2598
3042
|
}
|
|
2599
3043
|
}
|
|
2600
3044
|
},
|
|
2601
|
-
/* @__PURE__ */
|
|
2602
|
-
|
|
2603
|
-
Text,
|
|
3045
|
+
/* @__PURE__ */ import_react33.default.createElement(
|
|
3046
|
+
"td",
|
|
2604
3047
|
{
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
withTooltip: "whenTruncated" /* whenTruncated */,
|
|
2608
|
-
tooltipOptions: {
|
|
2609
|
-
contentClassName: "Layer__bank-transactions__tx-tooltip"
|
|
2610
|
-
}
|
|
3048
|
+
className: "Layer__table-cell Layer__bank-transaction-table__date-col",
|
|
3049
|
+
...openRow
|
|
2611
3050
|
},
|
|
2612
|
-
|
|
2613
|
-
)
|
|
2614
|
-
/* @__PURE__ */
|
|
2615
|
-
|
|
3051
|
+
/* @__PURE__ */ import_react33.default.createElement("span", { className: "Layer__table-cell-content" }, (0, import_date_fns7.format)((0, import_date_fns7.parseISO)(bankTransaction.date), dateFormat))
|
|
3052
|
+
),
|
|
3053
|
+
/* @__PURE__ */ import_react33.default.createElement(
|
|
3054
|
+
"td",
|
|
2616
3055
|
{
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
3056
|
+
className: "Layer__table-cell Layer__bank-transactions__tx-col",
|
|
3057
|
+
...openRow
|
|
3058
|
+
},
|
|
3059
|
+
/* @__PURE__ */ import_react33.default.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ import_react33.default.createElement(
|
|
3060
|
+
Text,
|
|
3061
|
+
{
|
|
3062
|
+
as: "span",
|
|
3063
|
+
className: "Layer__bank-transactions__tx-text",
|
|
3064
|
+
withTooltip: "whenTruncated" /* whenTruncated */,
|
|
3065
|
+
tooltipOptions: {
|
|
3066
|
+
contentClassName: "Layer__bank-transactions__tx-tooltip"
|
|
3067
|
+
}
|
|
3068
|
+
},
|
|
3069
|
+
bankTransaction.counterparty_name ?? bankTransaction.description
|
|
3070
|
+
))
|
|
3071
|
+
),
|
|
3072
|
+
/* @__PURE__ */ import_react33.default.createElement(
|
|
3073
|
+
"td",
|
|
3074
|
+
{
|
|
3075
|
+
className: "Layer__table-cell Layer__bank-transactions__account-col",
|
|
3076
|
+
...openRow
|
|
2620
3077
|
},
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
3078
|
+
/* @__PURE__ */ import_react33.default.createElement("span", { className: "Layer__table-cell-content" }, /* @__PURE__ */ import_react33.default.createElement(
|
|
3079
|
+
Text,
|
|
3080
|
+
{
|
|
3081
|
+
as: "span",
|
|
3082
|
+
className: "Layer__bank-transactions__account-text",
|
|
3083
|
+
withTooltip: "whenTruncated" /* whenTruncated */
|
|
3084
|
+
},
|
|
3085
|
+
bankTransaction.account_name ?? ""
|
|
3086
|
+
))
|
|
3087
|
+
),
|
|
3088
|
+
/* @__PURE__ */ import_react33.default.createElement(
|
|
2624
3089
|
"td",
|
|
2625
3090
|
{
|
|
2626
|
-
className: `Layer__table-cell Layer__table-cell__amount-col Layer__table-cell--amount ${className}__table-cell--amount-${isCredit(bankTransaction) ? "credit" : "debit"}
|
|
3091
|
+
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"}`,
|
|
3092
|
+
...openRow
|
|
2627
3093
|
},
|
|
2628
|
-
/* @__PURE__ */
|
|
3094
|
+
/* @__PURE__ */ import_react33.default.createElement("span", { className: "Layer__table-cell-content" }, isCredit(bankTransaction) ? "+$" : " $", centsToDollars(bankTransaction.amount))
|
|
2629
3095
|
),
|
|
2630
|
-
/* @__PURE__ */
|
|
3096
|
+
/* @__PURE__ */ import_react33.default.createElement(
|
|
2631
3097
|
"td",
|
|
2632
3098
|
{
|
|
2633
|
-
className: (0,
|
|
3099
|
+
className: (0, import_classnames17.default)(
|
|
2634
3100
|
"Layer__table-cell",
|
|
2635
3101
|
"Layer__table-cell__category-col",
|
|
2636
3102
|
`${className}__actions-cell`,
|
|
2637
3103
|
`${className}__actions-cell--${open ? "open" : "close"}`
|
|
2638
3104
|
)
|
|
2639
3105
|
},
|
|
2640
|
-
/* @__PURE__ */
|
|
3106
|
+
/* @__PURE__ */ import_react33.default.createElement(
|
|
2641
3107
|
"span",
|
|
2642
3108
|
{
|
|
2643
3109
|
className: `${className}__actions-container Layer__table-cell-content`
|
|
2644
3110
|
},
|
|
2645
|
-
editable && !open ? /* @__PURE__ */
|
|
3111
|
+
editable && !open ? /* @__PURE__ */ import_react33.default.createElement(
|
|
2646
3112
|
CategorySelect,
|
|
2647
3113
|
{
|
|
2648
3114
|
bankTransaction,
|
|
2649
3115
|
name: `category-${bankTransaction.id}`,
|
|
2650
3116
|
value: selectedCategory,
|
|
2651
|
-
onChange:
|
|
3117
|
+
onChange: (category) => {
|
|
3118
|
+
setSelectedCategory(category);
|
|
3119
|
+
setShowRetry(false);
|
|
3120
|
+
},
|
|
2652
3121
|
disabled: bankTransaction.processing
|
|
2653
3122
|
}
|
|
2654
3123
|
) : null,
|
|
2655
|
-
!editable && !open ? /* @__PURE__ */
|
|
3124
|
+
!editable && !open ? /* @__PURE__ */ import_react33.default.createElement(Text, { as: "span", className: `${className}__category-text` }, bankTransaction.categorization_status === "SPLIT" /* SPLIT */ && /* @__PURE__ */ import_react33.default.createElement(import_react33.default.Fragment, null, /* @__PURE__ */ import_react33.default.createElement(
|
|
2656
3125
|
Badge,
|
|
2657
3126
|
{
|
|
2658
|
-
icon: /* @__PURE__ */
|
|
2659
|
-
tooltip: /* @__PURE__ */
|
|
3127
|
+
icon: /* @__PURE__ */ import_react33.default.createElement(Scissors_default, { size: 11 }),
|
|
3128
|
+
tooltip: /* @__PURE__ */ import_react33.default.createElement(
|
|
2660
3129
|
SplitTooltipDetails,
|
|
2661
3130
|
{
|
|
2662
3131
|
classNamePrefix: className,
|
|
@@ -2665,18 +3134,42 @@ var BankTransactionRow = ({
|
|
|
2665
3134
|
)
|
|
2666
3135
|
},
|
|
2667
3136
|
"Split"
|
|
2668
|
-
), /* @__PURE__ */
|
|
3137
|
+
), /* @__PURE__ */ import_react33.default.createElement("span", { className: `${className}__category-text__text` }, extractDescriptionForSplit(bankTransaction.category))), bankTransaction?.categorization_status === "MATCHED" /* MATCHED */ && bankTransaction?.match && /* @__PURE__ */ import_react33.default.createElement(import_react33.default.Fragment, null, /* @__PURE__ */ import_react33.default.createElement(
|
|
2669
3138
|
MatchBadge,
|
|
2670
3139
|
{
|
|
2671
3140
|
classNamePrefix: className,
|
|
2672
3141
|
bankTransaction,
|
|
2673
3142
|
dateFormat
|
|
2674
3143
|
}
|
|
2675
|
-
), /* @__PURE__ */
|
|
3144
|
+
), /* @__PURE__ */ import_react33.default.createElement("span", { className: `${className}__category-text__text` }, `${(0, import_date_fns7.format)(
|
|
2676
3145
|
(0, import_date_fns7.parseISO)(bankTransaction.match.bank_transaction.date),
|
|
2677
3146
|
dateFormat
|
|
2678
|
-
)}, ${bankTransaction.match.bank_transaction.description}`)), bankTransaction?.categorization_status !== "MATCHED" /* MATCHED */ && bankTransaction?.categorization_status !== "SPLIT" /* SPLIT */ && /* @__PURE__ */
|
|
2679
|
-
editable
|
|
3147
|
+
)}, ${bankTransaction.match.bank_transaction.description}`)), bankTransaction?.categorization_status !== "MATCHED" /* MATCHED */ && bankTransaction?.categorization_status !== "SPLIT" /* SPLIT */ && /* @__PURE__ */ import_react33.default.createElement("span", { className: `${className}__category-text__text` }, bankTransaction?.category?.display_name)) : null,
|
|
3148
|
+
editable && !open && showRetry ? /* @__PURE__ */ import_react33.default.createElement(
|
|
3149
|
+
RetryButton,
|
|
3150
|
+
{
|
|
3151
|
+
onClick: () => {
|
|
3152
|
+
if (!bankTransaction.processing) {
|
|
3153
|
+
save();
|
|
3154
|
+
}
|
|
3155
|
+
},
|
|
3156
|
+
className: "Layer__bank-transaction__retry-btn",
|
|
3157
|
+
processing: bankTransaction.processing,
|
|
3158
|
+
error: "Approval failed. Check connection and retry in few seconds."
|
|
3159
|
+
},
|
|
3160
|
+
"Retry"
|
|
3161
|
+
) : null,
|
|
3162
|
+
open && bankTransaction.error ? /* @__PURE__ */ import_react33.default.createElement(
|
|
3163
|
+
Text,
|
|
3164
|
+
{
|
|
3165
|
+
as: "span",
|
|
3166
|
+
size: "md" /* md */,
|
|
3167
|
+
className: "Layer__unsaved-info"
|
|
3168
|
+
},
|
|
3169
|
+
/* @__PURE__ */ import_react33.default.createElement("span", null, "Unsaved"),
|
|
3170
|
+
/* @__PURE__ */ import_react33.default.createElement(AlertCircle_default, { size: 12 })
|
|
3171
|
+
) : null,
|
|
3172
|
+
editable && (open || !open && !showRetry) || !editable && open ? /* @__PURE__ */ import_react33.default.createElement(
|
|
2680
3173
|
SubmitButton,
|
|
2681
3174
|
{
|
|
2682
3175
|
onClick: () => {
|
|
@@ -2686,39 +3179,45 @@ var BankTransactionRow = ({
|
|
|
2686
3179
|
},
|
|
2687
3180
|
className: "Layer__bank-transaction__submit-btn",
|
|
2688
3181
|
processing: bankTransaction.processing,
|
|
2689
|
-
error: bankTransaction.error,
|
|
2690
3182
|
active: open,
|
|
2691
3183
|
action: editable ? "save" /* SAVE */ : "update" /* UPDATE */
|
|
2692
3184
|
},
|
|
2693
3185
|
editable ? "Approve" : "Update"
|
|
2694
3186
|
) : null,
|
|
2695
|
-
/* @__PURE__ */
|
|
3187
|
+
/* @__PURE__ */ import_react33.default.createElement(
|
|
2696
3188
|
IconButton,
|
|
2697
3189
|
{
|
|
2698
3190
|
onClick: toggleOpen,
|
|
2699
3191
|
className: "Layer__bank-transaction-row__expand-button",
|
|
2700
3192
|
active: open,
|
|
2701
|
-
icon:
|
|
3193
|
+
icon: /* @__PURE__ */ import_react33.default.createElement(
|
|
3194
|
+
ChevronDownFill_default,
|
|
3195
|
+
{
|
|
3196
|
+
className: `Layer__chevron ${open ? "Layer__chevron__up" : "Layer__chevron__down"}`
|
|
3197
|
+
}
|
|
3198
|
+
)
|
|
2702
3199
|
}
|
|
2703
3200
|
)
|
|
2704
3201
|
)
|
|
2705
3202
|
)
|
|
2706
|
-
), /* @__PURE__ */
|
|
3203
|
+
), /* @__PURE__ */ import_react33.default.createElement("tr", null, /* @__PURE__ */ import_react33.default.createElement("td", { colSpan: 5, className: "Layer__bank-transaction-row__expanded-td" }, /* @__PURE__ */ import_react33.default.createElement(
|
|
2707
3204
|
ExpandedBankTransactionRow,
|
|
2708
3205
|
{
|
|
2709
3206
|
ref: expandedRowRef,
|
|
2710
3207
|
bankTransaction,
|
|
2711
|
-
isOpen: open
|
|
3208
|
+
isOpen: open,
|
|
3209
|
+
containerWidth,
|
|
3210
|
+
editable
|
|
2712
3211
|
}
|
|
2713
3212
|
))));
|
|
2714
3213
|
};
|
|
2715
3214
|
|
|
2716
3215
|
// src/components/BankTransactionListItem/Assignment.tsx
|
|
2717
|
-
var
|
|
3216
|
+
var import_react34 = __toESM(require("react"));
|
|
2718
3217
|
var import_date_fns8 = require("date-fns");
|
|
2719
3218
|
var Assignment = ({ bankTransaction }) => {
|
|
2720
3219
|
if (bankTransaction.match && bankTransaction.categorization_status === "MATCHED" /* MATCHED */) {
|
|
2721
|
-
return /* @__PURE__ */
|
|
3220
|
+
return /* @__PURE__ */ import_react34.default.createElement(import_react34.default.Fragment, null, /* @__PURE__ */ import_react34.default.createElement(
|
|
2722
3221
|
MatchBadge,
|
|
2723
3222
|
{
|
|
2724
3223
|
classNamePrefix: "Layer__bank-transaction-list-item",
|
|
@@ -2726,17 +3225,17 @@ var Assignment = ({ bankTransaction }) => {
|
|
|
2726
3225
|
dateFormat: DATE_FORMAT,
|
|
2727
3226
|
text: "Matched"
|
|
2728
3227
|
}
|
|
2729
|
-
), /* @__PURE__ */
|
|
3228
|
+
), /* @__PURE__ */ import_react34.default.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, `${(0, import_date_fns8.format)(
|
|
2730
3229
|
(0, import_date_fns8.parseISO)(bankTransaction.match.bank_transaction.date),
|
|
2731
3230
|
DATE_FORMAT
|
|
2732
3231
|
)}, ${bankTransaction.match.bank_transaction.description}`));
|
|
2733
3232
|
}
|
|
2734
3233
|
if (bankTransaction.categorization_status === "SPLIT" /* SPLIT */) {
|
|
2735
|
-
return /* @__PURE__ */
|
|
3234
|
+
return /* @__PURE__ */ import_react34.default.createElement(import_react34.default.Fragment, null, /* @__PURE__ */ import_react34.default.createElement(
|
|
2736
3235
|
Badge,
|
|
2737
3236
|
{
|
|
2738
|
-
icon: /* @__PURE__ */
|
|
2739
|
-
tooltip: /* @__PURE__ */
|
|
3237
|
+
icon: /* @__PURE__ */ import_react34.default.createElement(Scissors_default, { size: 11 }),
|
|
3238
|
+
tooltip: /* @__PURE__ */ import_react34.default.createElement(
|
|
2740
3239
|
SplitTooltipDetails,
|
|
2741
3240
|
{
|
|
2742
3241
|
classNamePrefix: "Layer__bank-transaction-list-item",
|
|
@@ -2745,32 +3244,49 @@ var Assignment = ({ bankTransaction }) => {
|
|
|
2745
3244
|
)
|
|
2746
3245
|
},
|
|
2747
3246
|
"Split"
|
|
2748
|
-
), /* @__PURE__ */
|
|
3247
|
+
), /* @__PURE__ */ import_react34.default.createElement(Text, { className: "Layer__bank-transaction-list-item__category-text__text" }, extractDescriptionForSplit(bankTransaction.category)));
|
|
2749
3248
|
}
|
|
2750
|
-
return /* @__PURE__ */
|
|
3249
|
+
return /* @__PURE__ */ import_react34.default.createElement(Text, null, bankTransaction?.category?.display_name);
|
|
2751
3250
|
};
|
|
2752
3251
|
|
|
2753
3252
|
// src/components/BankTransactionListItem/BankTransactionListItem.tsx
|
|
2754
|
-
var
|
|
3253
|
+
var import_classnames18 = __toESM(require("classnames"));
|
|
2755
3254
|
var import_date_fns9 = require("date-fns");
|
|
2756
3255
|
var isCredit2 = ({ direction }) => direction === "CREDIT" /* CREDIT */;
|
|
2757
3256
|
var BankTransactionListItem = ({
|
|
3257
|
+
index = 0,
|
|
2758
3258
|
dateFormat,
|
|
2759
3259
|
bankTransaction,
|
|
2760
|
-
editable
|
|
3260
|
+
editable,
|
|
3261
|
+
containerWidth
|
|
2761
3262
|
}) => {
|
|
2762
|
-
const expandedRowRef = (0,
|
|
2763
|
-
const [
|
|
3263
|
+
const expandedRowRef = (0, import_react35.useRef)(null);
|
|
3264
|
+
const [showRetry, setShowRetry] = (0, import_react35.useState)(false);
|
|
3265
|
+
const [removed, setRemoved] = (0, import_react35.useState)(false);
|
|
2764
3266
|
const { categorize: categorizeBankTransaction2, match: matchBankTransaction2 } = useBankTransactions();
|
|
2765
|
-
const [selectedCategory, setSelectedCategory] = (0,
|
|
3267
|
+
const [selectedCategory, setSelectedCategory] = (0, import_react35.useState)(
|
|
2766
3268
|
getDefaultSelectedCategory(bankTransaction)
|
|
2767
3269
|
);
|
|
2768
|
-
const [open, setOpen] = (0,
|
|
2769
|
-
const toggleOpen = () =>
|
|
3270
|
+
const [open, setOpen] = (0, import_react35.useState)(false);
|
|
3271
|
+
const toggleOpen = () => {
|
|
3272
|
+
setShowRetry(false);
|
|
3273
|
+
setOpen(!open);
|
|
3274
|
+
};
|
|
3275
|
+
const [showComponent, setShowComponent] = (0, import_react35.useState)(false);
|
|
3276
|
+
(0, import_react35.useEffect)(() => {
|
|
3277
|
+
const timeoutId = setTimeout(() => {
|
|
3278
|
+
setShowComponent(true);
|
|
3279
|
+
}, index * 80);
|
|
3280
|
+
return () => clearTimeout(timeoutId);
|
|
3281
|
+
}, []);
|
|
3282
|
+
(0, import_react35.useEffect)(() => {
|
|
3283
|
+
if (bankTransaction.error) {
|
|
3284
|
+
setShowRetry(true);
|
|
3285
|
+
}
|
|
3286
|
+
}, [bankTransaction.error]);
|
|
2770
3287
|
const save = () => {
|
|
2771
3288
|
if (open && expandedRowRef?.current) {
|
|
2772
3289
|
expandedRowRef?.current?.save();
|
|
2773
|
-
setOpen(false);
|
|
2774
3290
|
return;
|
|
2775
3291
|
}
|
|
2776
3292
|
if (!selectedCategory) {
|
|
@@ -2793,50 +3309,55 @@ var BankTransactionListItem = ({
|
|
|
2793
3309
|
}
|
|
2794
3310
|
const className = "Layer__bank-transaction-list-item";
|
|
2795
3311
|
const openClassName = open ? `${className}--expanded` : "";
|
|
2796
|
-
const rowClassName = (0,
|
|
3312
|
+
const rowClassName = (0, import_classnames18.default)(
|
|
2797
3313
|
className,
|
|
2798
3314
|
bankTransaction.recently_categorized ? "Layer__bank-transaction-row--removing" : "",
|
|
2799
|
-
open ? openClassName : ""
|
|
3315
|
+
open ? openClassName : "",
|
|
3316
|
+
showComponent ? "show" : ""
|
|
2800
3317
|
);
|
|
2801
|
-
return /* @__PURE__ */
|
|
2802
|
-
"span",
|
|
2803
|
-
{
|
|
2804
|
-
className: `${className}__amount-${isCredit2(bankTransaction) ? "credit" : "debit"}`
|
|
2805
|
-
},
|
|
2806
|
-
isCredit2(bankTransaction) ? "+$" : " $",
|
|
2807
|
-
centsToDollars(bankTransaction.amount)
|
|
2808
|
-
), /* @__PURE__ */ import_react32.default.createElement(
|
|
3318
|
+
return /* @__PURE__ */ import_react35.default.createElement("li", { className: rowClassName }, /* @__PURE__ */ import_react35.default.createElement("span", { className: `${className}__heading` }, /* @__PURE__ */ import_react35.default.createElement("div", { className: `${className}__heading__main` }, /* @__PURE__ */ import_react35.default.createElement("span", { className: `${className}__heading-date` }, (0, import_date_fns9.format)((0, import_date_fns9.parseISO)(bankTransaction.date), dateFormat)), /* @__PURE__ */ import_react35.default.createElement("span", { className: `${className}__heading-separator` }), /* @__PURE__ */ import_react35.default.createElement("span", { className: `${className}__heading-account-name` }, bankTransaction.account_name ?? "")), /* @__PURE__ */ import_react35.default.createElement(
|
|
2809
3319
|
"div",
|
|
2810
3320
|
{
|
|
2811
3321
|
onClick: toggleOpen,
|
|
2812
3322
|
className: "Layer__bank-transaction-row__expand-button"
|
|
2813
3323
|
},
|
|
2814
|
-
/* @__PURE__ */
|
|
2815
|
-
|
|
3324
|
+
/* @__PURE__ */ import_react35.default.createElement(
|
|
3325
|
+
ChevronDownFill_default,
|
|
2816
3326
|
{
|
|
2817
3327
|
className: `Layer__chevron ${open ? "Layer__chevron__up" : "Layer__chevron__down"}`
|
|
2818
3328
|
}
|
|
2819
3329
|
)
|
|
2820
|
-
)), /* @__PURE__ */
|
|
3330
|
+
)), /* @__PURE__ */ import_react35.default.createElement("span", { className: `${className}__body` }, /* @__PURE__ */ import_react35.default.createElement("span", { className: `${className}__body__name` }, /* @__PURE__ */ import_react35.default.createElement(Text, { as: "span", withTooltip: "whenTruncated" /* whenTruncated */ }, bankTransaction.counterparty_name ?? bankTransaction.description)), /* @__PURE__ */ import_react35.default.createElement(
|
|
3331
|
+
"span",
|
|
3332
|
+
{
|
|
3333
|
+
className: `${className}__amount-${isCredit2(bankTransaction) ? "credit" : "debit"}`
|
|
3334
|
+
},
|
|
3335
|
+
isCredit2(bankTransaction) ? "+$" : " $",
|
|
3336
|
+
centsToDollars(bankTransaction.amount)
|
|
3337
|
+
)), /* @__PURE__ */ import_react35.default.createElement("span", { className: `${className}__expanded-row` }, /* @__PURE__ */ import_react35.default.createElement(
|
|
2821
3338
|
ExpandedBankTransactionRow,
|
|
2822
3339
|
{
|
|
2823
3340
|
ref: expandedRowRef,
|
|
2824
3341
|
bankTransaction,
|
|
2825
|
-
close: toggleOpen,
|
|
2826
3342
|
isOpen: open,
|
|
3343
|
+
editable,
|
|
2827
3344
|
asListItem: true,
|
|
2828
|
-
submitBtnText: editable ? "Approve" : "
|
|
3345
|
+
submitBtnText: editable ? "Approve" : "Update",
|
|
3346
|
+
containerWidth
|
|
2829
3347
|
}
|
|
2830
|
-
)), /* @__PURE__ */
|
|
3348
|
+
)), /* @__PURE__ */ import_react35.default.createElement("span", { className: `${className}__base-row` }, editable ? /* @__PURE__ */ import_react35.default.createElement(
|
|
2831
3349
|
CategorySelect,
|
|
2832
3350
|
{
|
|
2833
3351
|
bankTransaction,
|
|
2834
3352
|
name: `category-${bankTransaction.id}`,
|
|
2835
3353
|
value: selectedCategory,
|
|
2836
|
-
onChange:
|
|
3354
|
+
onChange: (category) => {
|
|
3355
|
+
setShowRetry(false);
|
|
3356
|
+
setSelectedCategory(category);
|
|
3357
|
+
},
|
|
2837
3358
|
disabled: bankTransaction.processing
|
|
2838
3359
|
}
|
|
2839
|
-
) : null, !editable ? /* @__PURE__ */
|
|
3360
|
+
) : null, !editable ? /* @__PURE__ */ import_react35.default.createElement(Assignment, { bankTransaction }) : null, editable && !showRetry ? /* @__PURE__ */ import_react35.default.createElement(
|
|
2840
3361
|
SubmitButton,
|
|
2841
3362
|
{
|
|
2842
3363
|
onClick: () => {
|
|
@@ -2846,14 +3367,27 @@ var BankTransactionListItem = ({
|
|
|
2846
3367
|
},
|
|
2847
3368
|
className: "Layer__bank-transaction__submit-btn",
|
|
2848
3369
|
processing: bankTransaction.processing,
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
)
|
|
3370
|
+
action: editable ? "save" /* SAVE */ : "update" /* UPDATE */
|
|
3371
|
+
},
|
|
3372
|
+
editable ? "Approve" : "Update"
|
|
3373
|
+
) : null, editable && showRetry ? /* @__PURE__ */ import_react35.default.createElement(
|
|
3374
|
+
RetryButton,
|
|
3375
|
+
{
|
|
3376
|
+
onClick: () => {
|
|
3377
|
+
if (!bankTransaction.processing) {
|
|
3378
|
+
save();
|
|
3379
|
+
}
|
|
3380
|
+
},
|
|
3381
|
+
className: "Layer__bank-transaction__retry-btn",
|
|
3382
|
+
processing: bankTransaction.processing,
|
|
3383
|
+
error: "Approval failed. Check connection and retry in few seconds."
|
|
3384
|
+
},
|
|
3385
|
+
"Retry"
|
|
3386
|
+
) : null), bankTransaction.error && showRetry ? /* @__PURE__ */ import_react35.default.createElement(ErrorText, null, "Approval failed. Check connection and retry in few seconds.") : null);
|
|
2853
3387
|
};
|
|
2854
3388
|
|
|
2855
3389
|
// src/components/Container/Container.tsx
|
|
2856
|
-
var
|
|
3390
|
+
var import_react36 = __toESM(require("react"));
|
|
2857
3391
|
|
|
2858
3392
|
// src/config/theme.ts
|
|
2859
3393
|
var SHADES = {
|
|
@@ -3081,10 +3615,10 @@ var hslToHex = (hsl) => {
|
|
|
3081
3615
|
};
|
|
3082
3616
|
|
|
3083
3617
|
// src/components/Container/Container.tsx
|
|
3084
|
-
var
|
|
3085
|
-
var Container = (0,
|
|
3618
|
+
var import_classnames19 = __toESM(require("classnames"));
|
|
3619
|
+
var Container = (0, import_react36.forwardRef)(
|
|
3086
3620
|
({ name, className, children, asWidget }, ref) => {
|
|
3087
|
-
const baseClassName = (0,
|
|
3621
|
+
const baseClassName = (0, import_classnames19.default)(
|
|
3088
3622
|
"Layer__component Layer__component-container",
|
|
3089
3623
|
`Layer__${name}`,
|
|
3090
3624
|
asWidget ? "Layer__component--as-widget" : "",
|
|
@@ -3092,114 +3626,28 @@ var Container = (0, import_react33.forwardRef)(
|
|
|
3092
3626
|
);
|
|
3093
3627
|
const { theme } = useLayerContext();
|
|
3094
3628
|
const styles = parseStylesFromThemeConfig(theme);
|
|
3095
|
-
return /* @__PURE__ */
|
|
3629
|
+
return /* @__PURE__ */ import_react36.default.createElement("div", { ref, className: baseClassName, style: { ...styles } }, children);
|
|
3096
3630
|
}
|
|
3097
3631
|
);
|
|
3098
3632
|
|
|
3099
3633
|
// src/components/Container/Header.tsx
|
|
3100
|
-
var
|
|
3101
|
-
var
|
|
3102
|
-
var Header = (0,
|
|
3634
|
+
var import_react37 = __toESM(require("react"));
|
|
3635
|
+
var import_classnames20 = __toESM(require("classnames"));
|
|
3636
|
+
var Header = (0, import_react37.forwardRef)(
|
|
3103
3637
|
({ className, children, style }, ref) => {
|
|
3104
|
-
const baseClassName = (0,
|
|
3105
|
-
return /* @__PURE__ */
|
|
3638
|
+
const baseClassName = (0, import_classnames20.default)("Layer__component-header", className);
|
|
3639
|
+
return /* @__PURE__ */ import_react37.default.createElement("header", { ref, className: baseClassName, style }, children);
|
|
3106
3640
|
}
|
|
3107
3641
|
);
|
|
3108
3642
|
|
|
3109
3643
|
// src/components/DataState/DataState.tsx
|
|
3110
|
-
var
|
|
3111
|
-
|
|
3112
|
-
// src/icons/AlertOctagon.tsx
|
|
3113
|
-
var React43 = __toESM(require("react"));
|
|
3114
|
-
var AlertOctagon = ({ size = 18, ...props }) => /* @__PURE__ */ React43.createElement(
|
|
3115
|
-
"svg",
|
|
3116
|
-
{
|
|
3117
|
-
viewBox: "0 0 18 18",
|
|
3118
|
-
fill: "none",
|
|
3119
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3120
|
-
...props,
|
|
3121
|
-
width: size,
|
|
3122
|
-
height: size
|
|
3123
|
-
},
|
|
3124
|
-
/* @__PURE__ */ React43.createElement(
|
|
3125
|
-
"path",
|
|
3126
|
-
{
|
|
3127
|
-
d: "M5.895 1.5H12.105L16.5 5.895V12.105L12.105 16.5H5.895L1.5 12.105V5.895L5.895 1.5Z",
|
|
3128
|
-
stroke: "currentColor",
|
|
3129
|
-
strokeLinecap: "round",
|
|
3130
|
-
strokeLinejoin: "round"
|
|
3131
|
-
}
|
|
3132
|
-
),
|
|
3133
|
-
/* @__PURE__ */ React43.createElement(
|
|
3134
|
-
"path",
|
|
3135
|
-
{
|
|
3136
|
-
d: "M9 6V9",
|
|
3137
|
-
stroke: "currentColor",
|
|
3138
|
-
strokeLinecap: "round",
|
|
3139
|
-
strokeLinejoin: "round"
|
|
3140
|
-
}
|
|
3141
|
-
),
|
|
3142
|
-
/* @__PURE__ */ React43.createElement(
|
|
3143
|
-
"path",
|
|
3144
|
-
{
|
|
3145
|
-
d: "M9 12H9.0075",
|
|
3146
|
-
stroke: "currentColor",
|
|
3147
|
-
strokeLinecap: "round",
|
|
3148
|
-
strokeLinejoin: "round"
|
|
3149
|
-
}
|
|
3150
|
-
)
|
|
3151
|
-
);
|
|
3152
|
-
var AlertOctagon_default = AlertOctagon;
|
|
3153
|
-
|
|
3154
|
-
// src/icons/RefreshCcw.tsx
|
|
3155
|
-
var React44 = __toESM(require("react"));
|
|
3156
|
-
var RefreshCcw = ({ size = 18, ...props }) => /* @__PURE__ */ React44.createElement(
|
|
3157
|
-
"svg",
|
|
3158
|
-
{
|
|
3159
|
-
viewBox: "0 0 18 18",
|
|
3160
|
-
fill: "none",
|
|
3161
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
3162
|
-
...props,
|
|
3163
|
-
width: size,
|
|
3164
|
-
height: size
|
|
3165
|
-
},
|
|
3166
|
-
/* @__PURE__ */ React44.createElement(
|
|
3167
|
-
"path",
|
|
3168
|
-
{
|
|
3169
|
-
d: "M0.75 3V7.5H5.25",
|
|
3170
|
-
stroke: "currentColor",
|
|
3171
|
-
strokeLinecap: "round",
|
|
3172
|
-
strokeLinejoin: "round"
|
|
3173
|
-
}
|
|
3174
|
-
),
|
|
3175
|
-
/* @__PURE__ */ React44.createElement(
|
|
3176
|
-
"path",
|
|
3177
|
-
{
|
|
3178
|
-
d: "M17.25 15V10.5H12.75",
|
|
3179
|
-
stroke: "currentColor",
|
|
3180
|
-
strokeLinecap: "round",
|
|
3181
|
-
strokeLinejoin: "round"
|
|
3182
|
-
}
|
|
3183
|
-
),
|
|
3184
|
-
/* @__PURE__ */ React44.createElement(
|
|
3185
|
-
"path",
|
|
3186
|
-
{
|
|
3187
|
-
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",
|
|
3188
|
-
stroke: "currentColor",
|
|
3189
|
-
strokeLinecap: "round",
|
|
3190
|
-
strokeLinejoin: "round"
|
|
3191
|
-
}
|
|
3192
|
-
)
|
|
3193
|
-
);
|
|
3194
|
-
var RefreshCcw_default = RefreshCcw;
|
|
3195
|
-
|
|
3196
|
-
// src/components/DataState/DataState.tsx
|
|
3644
|
+
var import_react38 = __toESM(require("react"));
|
|
3197
3645
|
var getIcon = (status) => {
|
|
3198
3646
|
switch (status) {
|
|
3199
3647
|
case "failed" /* failed */:
|
|
3200
|
-
return /* @__PURE__ */
|
|
3648
|
+
return /* @__PURE__ */ import_react38.default.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--error" }, /* @__PURE__ */ import_react38.default.createElement(AlertOctagon_default, { size: 12 }));
|
|
3201
3649
|
default:
|
|
3202
|
-
return /* @__PURE__ */
|
|
3650
|
+
return /* @__PURE__ */ import_react38.default.createElement("span", { className: "Layer__data-state__icon Layer__data-state__icon--neutral" }, /* @__PURE__ */ import_react38.default.createElement(CheckCircle_default, { size: 12 }));
|
|
3203
3651
|
}
|
|
3204
3652
|
};
|
|
3205
3653
|
var DataState = ({
|
|
@@ -3209,7 +3657,7 @@ var DataState = ({
|
|
|
3209
3657
|
onRefresh,
|
|
3210
3658
|
isLoading
|
|
3211
3659
|
}) => {
|
|
3212
|
-
return /* @__PURE__ */
|
|
3660
|
+
return /* @__PURE__ */ import_react38.default.createElement("div", { className: "Layer__data-state" }, getIcon(status), /* @__PURE__ */ import_react38.default.createElement(
|
|
3213
3661
|
Text,
|
|
3214
3662
|
{
|
|
3215
3663
|
as: "span",
|
|
@@ -3218,11 +3666,11 @@ var DataState = ({
|
|
|
3218
3666
|
className: "Layer__data-state__title"
|
|
3219
3667
|
},
|
|
3220
3668
|
title
|
|
3221
|
-
), /* @__PURE__ */
|
|
3669
|
+
), /* @__PURE__ */ import_react38.default.createElement(Text, { as: "span", className: "Layer__data-state__description" }, description), onRefresh && /* @__PURE__ */ import_react38.default.createElement("span", { className: "Layer__data-state__btn" }, /* @__PURE__ */ import_react38.default.createElement(
|
|
3222
3670
|
Button,
|
|
3223
3671
|
{
|
|
3224
3672
|
variant: "secondary" /* secondary */,
|
|
3225
|
-
rightIcon: isLoading ? /* @__PURE__ */
|
|
3673
|
+
rightIcon: isLoading ? /* @__PURE__ */ import_react38.default.createElement(Loader_default, { size: 14, className: "Layer__anim--rotating" }) : /* @__PURE__ */ import_react38.default.createElement(RefreshCcw_default, { size: 12 }),
|
|
3226
3674
|
onClick: onRefresh,
|
|
3227
3675
|
disabled: isLoading
|
|
3228
3676
|
},
|
|
@@ -3231,24 +3679,16 @@ var DataState = ({
|
|
|
3231
3679
|
};
|
|
3232
3680
|
|
|
3233
3681
|
// src/components/Loader/Loader.tsx
|
|
3234
|
-
var
|
|
3682
|
+
var import_react39 = __toESM(require("react"));
|
|
3235
3683
|
var Loader2 = ({ children }) => {
|
|
3236
|
-
return /* @__PURE__ */
|
|
3684
|
+
return /* @__PURE__ */ import_react39.default.createElement("span", { className: "Layer__loader" }, /* @__PURE__ */ import_react39.default.createElement(Loader_default, { size: 28, className: "Layer__anim--rotating" }), children);
|
|
3237
3685
|
};
|
|
3238
3686
|
|
|
3239
3687
|
// src/components/Pagination/Pagination.tsx
|
|
3240
|
-
var
|
|
3241
|
-
|
|
3242
|
-
// src/hooks/usePagination/usePagination.ts
|
|
3243
|
-
var import_react37 = require("react");
|
|
3244
|
-
|
|
3245
|
-
// src/utils/helpers.ts
|
|
3246
|
-
var range = (start, end) => {
|
|
3247
|
-
let length = end - start + 1;
|
|
3248
|
-
return Array.from({ length }, (_, idx) => idx + start);
|
|
3249
|
-
};
|
|
3688
|
+
var import_react41 = __toESM(require("react"));
|
|
3250
3689
|
|
|
3251
3690
|
// src/hooks/usePagination/usePagination.ts
|
|
3691
|
+
var import_react40 = require("react");
|
|
3252
3692
|
var DOTS = "...";
|
|
3253
3693
|
var usePagination = ({
|
|
3254
3694
|
totalCount,
|
|
@@ -3256,7 +3696,7 @@ var usePagination = ({
|
|
|
3256
3696
|
siblingCount = 1,
|
|
3257
3697
|
currentPage
|
|
3258
3698
|
}) => {
|
|
3259
|
-
const paginationRange = (0,
|
|
3699
|
+
const paginationRange = (0, import_react40.useMemo)(() => {
|
|
3260
3700
|
const totalPageCount = Math.ceil(totalCount / pageSize);
|
|
3261
3701
|
const totalPageNumbers = siblingCount + 5;
|
|
3262
3702
|
if (totalPageNumbers >= totalPageCount) {
|
|
@@ -3293,8 +3733,8 @@ var usePagination = ({
|
|
|
3293
3733
|
};
|
|
3294
3734
|
|
|
3295
3735
|
// src/icons/ChevronLeft.tsx
|
|
3296
|
-
var
|
|
3297
|
-
var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
3736
|
+
var React51 = __toESM(require("react"));
|
|
3737
|
+
var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React51.createElement(
|
|
3298
3738
|
"svg",
|
|
3299
3739
|
{
|
|
3300
3740
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3304,7 +3744,7 @@ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React47.createEle
|
|
|
3304
3744
|
fill: "none",
|
|
3305
3745
|
...props
|
|
3306
3746
|
},
|
|
3307
|
-
/* @__PURE__ */
|
|
3747
|
+
/* @__PURE__ */ React51.createElement(
|
|
3308
3748
|
"path",
|
|
3309
3749
|
{
|
|
3310
3750
|
d: "M11.25 13.5L6.75 9L11.25 4.5",
|
|
@@ -3317,8 +3757,8 @@ var ChevronLeft = ({ size = 18, ...props }) => /* @__PURE__ */ React47.createEle
|
|
|
3317
3757
|
var ChevronLeft_default = ChevronLeft;
|
|
3318
3758
|
|
|
3319
3759
|
// src/icons/ChevronRight.tsx
|
|
3320
|
-
var
|
|
3321
|
-
var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
3760
|
+
var React52 = __toESM(require("react"));
|
|
3761
|
+
var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React52.createElement(
|
|
3322
3762
|
"svg",
|
|
3323
3763
|
{
|
|
3324
3764
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -3328,7 +3768,7 @@ var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React48.createEl
|
|
|
3328
3768
|
fill: "none",
|
|
3329
3769
|
...props
|
|
3330
3770
|
},
|
|
3331
|
-
/* @__PURE__ */
|
|
3771
|
+
/* @__PURE__ */ React52.createElement(
|
|
3332
3772
|
"path",
|
|
3333
3773
|
{
|
|
3334
3774
|
d: "M6.75 13.5L11.25 9L6.75 4.5",
|
|
@@ -3341,7 +3781,7 @@ var ChavronRight = ({ size = 18, ...props }) => /* @__PURE__ */ React48.createEl
|
|
|
3341
3781
|
var ChevronRight_default = ChavronRight;
|
|
3342
3782
|
|
|
3343
3783
|
// src/components/Pagination/Pagination.tsx
|
|
3344
|
-
var
|
|
3784
|
+
var import_classnames21 = __toESM(require("classnames"));
|
|
3345
3785
|
var Pagination = ({
|
|
3346
3786
|
onPageChange,
|
|
3347
3787
|
totalCount,
|
|
@@ -3362,10 +3802,11 @@ var Pagination = ({
|
|
|
3362
3802
|
return;
|
|
3363
3803
|
}
|
|
3364
3804
|
let lastPage = paginationRange[paginationRange.length - 1];
|
|
3365
|
-
return /* @__PURE__ */
|
|
3805
|
+
return /* @__PURE__ */ import_react41.default.createElement("ul", { className: "Layer__pagination" }, /* @__PURE__ */ import_react41.default.createElement(
|
|
3366
3806
|
"li",
|
|
3367
3807
|
{
|
|
3368
|
-
|
|
3808
|
+
key: `page-prev`,
|
|
3809
|
+
className: (0, import_classnames21.default)(
|
|
3369
3810
|
"Layer__pagination-item Layer__pagination-arrow Layer__pagination-arrow--previous",
|
|
3370
3811
|
{
|
|
3371
3812
|
disabled: currentPage === 1
|
|
@@ -3373,15 +3814,16 @@ var Pagination = ({
|
|
|
3373
3814
|
),
|
|
3374
3815
|
onClick: () => onPageChange(currentPage - 1)
|
|
3375
3816
|
},
|
|
3376
|
-
/* @__PURE__ */
|
|
3817
|
+
/* @__PURE__ */ import_react41.default.createElement(ChevronLeft_default, { size: 12 })
|
|
3377
3818
|
), paginationRange.map((pageNumber) => {
|
|
3378
3819
|
if (pageNumber === DOTS) {
|
|
3379
|
-
return /* @__PURE__ */
|
|
3820
|
+
return /* @__PURE__ */ import_react41.default.createElement("li", { className: "Layer__pagination-item Layer__pagination-dots" }, "\u2026");
|
|
3380
3821
|
}
|
|
3381
|
-
return /* @__PURE__ */
|
|
3822
|
+
return /* @__PURE__ */ import_react41.default.createElement(
|
|
3382
3823
|
"li",
|
|
3383
3824
|
{
|
|
3384
|
-
|
|
3825
|
+
key: `page-${pageNumber}`,
|
|
3826
|
+
className: (0, import_classnames21.default)("Layer__pagination-item", {
|
|
3385
3827
|
selected: pageNumber === currentPage
|
|
3386
3828
|
}),
|
|
3387
3829
|
onClick: () => {
|
|
@@ -3392,10 +3834,11 @@ var Pagination = ({
|
|
|
3392
3834
|
},
|
|
3393
3835
|
pageNumber
|
|
3394
3836
|
);
|
|
3395
|
-
}), /* @__PURE__ */
|
|
3837
|
+
}), /* @__PURE__ */ import_react41.default.createElement(
|
|
3396
3838
|
"li",
|
|
3397
3839
|
{
|
|
3398
|
-
|
|
3840
|
+
key: `page-last`,
|
|
3841
|
+
className: (0, import_classnames21.default)(
|
|
3399
3842
|
"Layer__pagination-item Layer__pagination-arrow Layer__pagination-arrow--next",
|
|
3400
3843
|
{
|
|
3401
3844
|
disabled: currentPage === lastPage
|
|
@@ -3403,7 +3846,7 @@ var Pagination = ({
|
|
|
3403
3846
|
),
|
|
3404
3847
|
onClick: () => onPageChange(currentPage + 1)
|
|
3405
3848
|
},
|
|
3406
|
-
/* @__PURE__ */
|
|
3849
|
+
/* @__PURE__ */ import_react41.default.createElement(ChevronRight_default, { size: 12 })
|
|
3407
3850
|
));
|
|
3408
3851
|
};
|
|
3409
3852
|
|
|
@@ -3419,7 +3862,7 @@ var ReviewCategories = [
|
|
|
3419
3862
|
"READY_FOR_INPUT" /* READY_FOR_INPUT */,
|
|
3420
3863
|
"LAYER_REVIEW" /* LAYER_REVIEW */
|
|
3421
3864
|
];
|
|
3422
|
-
var filterVisibility = (display
|
|
3865
|
+
var filterVisibility = (display, bankTransaction) => {
|
|
3423
3866
|
const categorized = CategorizedCategories.includes(
|
|
3424
3867
|
bankTransaction.categorization_status
|
|
3425
3868
|
);
|
|
@@ -3430,92 +3873,229 @@ var BankTransactions = ({
|
|
|
3430
3873
|
asWidget = false,
|
|
3431
3874
|
pageSize = 15
|
|
3432
3875
|
}) => {
|
|
3433
|
-
const [display, setDisplay] = (0,
|
|
3434
|
-
const [currentPage, setCurrentPage] = (0,
|
|
3876
|
+
const [display, setDisplay] = (0, import_react42.useState)("review" /* review */);
|
|
3877
|
+
const [currentPage, setCurrentPage] = (0, import_react42.useState)(1);
|
|
3878
|
+
const [removedTxs, setRemovedTxs] = (0, import_react42.useState)([]);
|
|
3435
3879
|
const { data, isLoading, error, isValidating, refetch } = useBankTransactions();
|
|
3436
|
-
const bankTransactionsByFilter = data?.filter(
|
|
3437
|
-
|
|
3880
|
+
const bankTransactionsByFilter = data?.filter(
|
|
3881
|
+
(tx) => !removedTxs.includes(tx.id) && filterVisibility(display, tx)
|
|
3882
|
+
);
|
|
3883
|
+
const bankTransactions = (0, import_react42.useMemo)(() => {
|
|
3438
3884
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
3439
3885
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
3440
3886
|
return bankTransactionsByFilter?.slice(firstPageIndex, lastPageIndex);
|
|
3441
|
-
}, [currentPage, bankTransactionsByFilter]);
|
|
3887
|
+
}, [currentPage, bankTransactionsByFilter, removedTxs]);
|
|
3442
3888
|
const onCategorizationDisplayChange = (event) => {
|
|
3443
3889
|
setDisplay(
|
|
3444
3890
|
event.target.value === "categorized" /* categorized */ ? "categorized" /* categorized */ : "review" /* review */
|
|
3445
3891
|
);
|
|
3446
3892
|
setCurrentPage(1);
|
|
3447
3893
|
};
|
|
3448
|
-
const [shiftStickyHeader, setShiftStickyHeader] = (0,
|
|
3449
|
-
const
|
|
3894
|
+
const [shiftStickyHeader, setShiftStickyHeader] = (0, import_react42.useState)(0);
|
|
3895
|
+
const debounceShiftStickyHeader = debounce(setShiftStickyHeader, 500);
|
|
3896
|
+
const [listView, setListView] = (0, import_react42.useState)(false);
|
|
3897
|
+
const [containerWidth, setContainerWidth] = (0, import_react42.useState)(0);
|
|
3898
|
+
const debounceContainerWidth = debounce(setContainerWidth, 500);
|
|
3899
|
+
const removeTransaction = (id) => {
|
|
3900
|
+
const newTxs = removedTxs.slice();
|
|
3901
|
+
newTxs.push(id);
|
|
3902
|
+
setRemovedTxs(newTxs);
|
|
3903
|
+
};
|
|
3450
3904
|
const containerRef = useElementSize((_el, _en, size) => {
|
|
3451
3905
|
if (size?.height && size?.height >= 90) {
|
|
3452
3906
|
const newShift = -Math.floor(size.height / 2) + 6;
|
|
3453
3907
|
if (newShift !== shiftStickyHeader) {
|
|
3454
|
-
|
|
3908
|
+
debounceShiftStickyHeader(newShift);
|
|
3455
3909
|
}
|
|
3456
3910
|
} else if (size?.height > 0 && shiftStickyHeader !== 0) {
|
|
3457
|
-
|
|
3911
|
+
debounceShiftStickyHeader(0);
|
|
3458
3912
|
}
|
|
3459
3913
|
if (size.width > 700 && listView) {
|
|
3460
3914
|
setListView(false);
|
|
3461
3915
|
} else if (size.width <= 700 && !listView) {
|
|
3462
3916
|
setListView(true);
|
|
3463
3917
|
}
|
|
3918
|
+
debounceContainerWidth(size?.width);
|
|
3464
3919
|
});
|
|
3465
3920
|
const editable = display === "review" /* review */;
|
|
3466
|
-
return /* @__PURE__ */
|
|
3467
|
-
|
|
3921
|
+
return /* @__PURE__ */ import_react42.default.createElement(
|
|
3922
|
+
Container,
|
|
3468
3923
|
{
|
|
3469
|
-
className: "Layer__bank-
|
|
3470
|
-
|
|
3924
|
+
className: editable ? "Layer__bank-transactions--to-review" : "Layer__bank-transactions--categorized",
|
|
3925
|
+
name: COMPONENT_NAME,
|
|
3926
|
+
asWidget,
|
|
3927
|
+
ref: containerRef
|
|
3471
3928
|
},
|
|
3472
|
-
/* @__PURE__ */
|
|
3473
|
-
|
|
3474
|
-
|
|
3929
|
+
/* @__PURE__ */ import_react42.default.createElement(
|
|
3930
|
+
Header,
|
|
3931
|
+
{
|
|
3932
|
+
className: "Layer__bank-transactions__header",
|
|
3933
|
+
style: { top: shiftStickyHeader }
|
|
3934
|
+
},
|
|
3935
|
+
/* @__PURE__ */ import_react42.default.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Transactions"),
|
|
3936
|
+
/* @__PURE__ */ import_react42.default.createElement(
|
|
3937
|
+
Toggle,
|
|
3938
|
+
{
|
|
3939
|
+
name: "bank-transaction-display",
|
|
3940
|
+
options: [
|
|
3941
|
+
{ label: "To Review", value: "review" /* review */ },
|
|
3942
|
+
{ label: "Categorized", value: "categorized" /* categorized */ }
|
|
3943
|
+
],
|
|
3944
|
+
selected: display,
|
|
3945
|
+
onChange: onCategorizationDisplayChange
|
|
3946
|
+
}
|
|
3947
|
+
)
|
|
3948
|
+
),
|
|
3949
|
+
!listView && /* @__PURE__ */ import_react42.default.createElement(
|
|
3950
|
+
"table",
|
|
3475
3951
|
{
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3952
|
+
width: "100%",
|
|
3953
|
+
className: "Layer__table Layer__bank-transactions__table with-cell-separators"
|
|
3954
|
+
},
|
|
3955
|
+
/* @__PURE__ */ import_react42.default.createElement("thead", null, /* @__PURE__ */ import_react42.default.createElement("tr", null, /* @__PURE__ */ import_react42.default.createElement("th", { className: "Layer__table-header Layer__bank-transactions__date-col" }, "Date"), /* @__PURE__ */ import_react42.default.createElement("th", { className: "Layer__table-header Layer__bank-transactions__tx-col" }, "Transaction"), /* @__PURE__ */ import_react42.default.createElement("th", { className: "Layer__table-header Layer__bank-transactions__account-col" }, "Account"), /* @__PURE__ */ import_react42.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount Layer__table-cell__amount-col" }, "Amount"), editable ? /* @__PURE__ */ import_react42.default.createElement("th", { className: "Layer__table-header Layer__table-header--primary Layer__table-cell__category-col" }, "Categorize") : /* @__PURE__ */ import_react42.default.createElement("th", { className: "Layer__table-header Layer__table-cell__category-col" }, "Category"))),
|
|
3956
|
+
/* @__PURE__ */ import_react42.default.createElement("tbody", null, !isLoading && bankTransactions?.map(
|
|
3957
|
+
(bankTransaction, index) => /* @__PURE__ */ import_react42.default.createElement(
|
|
3958
|
+
BankTransactionRow,
|
|
3959
|
+
{
|
|
3960
|
+
index,
|
|
3961
|
+
key: bankTransaction.id,
|
|
3962
|
+
dateFormat: DATE_FORMAT,
|
|
3963
|
+
bankTransaction,
|
|
3964
|
+
editable,
|
|
3965
|
+
removeTransaction,
|
|
3966
|
+
containerWidth
|
|
3967
|
+
}
|
|
3968
|
+
)
|
|
3969
|
+
))
|
|
3970
|
+
),
|
|
3971
|
+
isLoading && !bankTransactions ? /* @__PURE__ */ import_react42.default.createElement("div", { className: "Layer__bank-transactions__loader-container" }, /* @__PURE__ */ import_react42.default.createElement(Loader2, null)) : null,
|
|
3972
|
+
!isLoading && listView ? /* @__PURE__ */ import_react42.default.createElement("ul", { className: "Layer__bank-transactions__list" }, bankTransactions?.map(
|
|
3973
|
+
(bankTransaction, index) => /* @__PURE__ */ import_react42.default.createElement(
|
|
3974
|
+
BankTransactionListItem,
|
|
3975
|
+
{
|
|
3976
|
+
index,
|
|
3977
|
+
key: bankTransaction.id,
|
|
3978
|
+
dateFormat: DATE_FORMAT,
|
|
3979
|
+
bankTransaction,
|
|
3980
|
+
editable,
|
|
3981
|
+
removeTransaction,
|
|
3982
|
+
containerWidth
|
|
3983
|
+
}
|
|
3984
|
+
)
|
|
3985
|
+
)) : null,
|
|
3986
|
+
!isLoading && !error && (bankTransactions === void 0 || bankTransactions !== void 0 && bankTransactions.length === 0) ? /* @__PURE__ */ import_react42.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react42.default.createElement(
|
|
3987
|
+
DataState,
|
|
3988
|
+
{
|
|
3989
|
+
status: "allDone" /* allDone */,
|
|
3990
|
+
title: "You are up to date with transactions!",
|
|
3991
|
+
description: "All uncategorized transaction will be displayed here",
|
|
3992
|
+
onRefresh: () => refetch(),
|
|
3993
|
+
isLoading: isValidating
|
|
3483
3994
|
}
|
|
3484
|
-
)
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
{
|
|
3488
|
-
width: "100%",
|
|
3489
|
-
className: "Layer__table Layer__bank-transactions__table with-cell-separators"
|
|
3490
|
-
},
|
|
3491
|
-
/* @__PURE__ */ import_react39.default.createElement("thead", null, /* @__PURE__ */ import_react39.default.createElement("tr", null, /* @__PURE__ */ import_react39.default.createElement("th", { className: "Layer__table-header Layer__bank-transactions__date-col" }, "Date"), /* @__PURE__ */ import_react39.default.createElement("th", { className: "Layer__table-header Layer__bank-transactions__tx-col" }, "Transaction"), /* @__PURE__ */ import_react39.default.createElement("th", { className: "Layer__table-header Layer__bank-transactions__account-col" }, "Account"), /* @__PURE__ */ import_react39.default.createElement("th", { className: "Layer__table-header Layer__table-cell--amount Layer__table-cell__amount-col" }, "Amount"), editable ? /* @__PURE__ */ import_react39.default.createElement("th", { className: "Layer__table-header Layer__table-header--primary Layer__table-cell__category-col" }, "Categorize") : /* @__PURE__ */ import_react39.default.createElement("th", { className: "Layer__table-header Layer__table-cell__category-col" }, "Category"))),
|
|
3492
|
-
/* @__PURE__ */ import_react39.default.createElement("tbody", null, !isLoading && bankTransactions?.map((bankTransaction) => /* @__PURE__ */ import_react39.default.createElement(
|
|
3493
|
-
BankTransactionRow,
|
|
3995
|
+
)) : null,
|
|
3996
|
+
!isLoading && error ? /* @__PURE__ */ import_react42.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react42.default.createElement(
|
|
3997
|
+
DataState,
|
|
3494
3998
|
{
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3999
|
+
status: "failed" /* failed */,
|
|
4000
|
+
title: "Something went wrong",
|
|
4001
|
+
description: "We couldn\u2019t load your data.",
|
|
4002
|
+
onRefresh: () => refetch(),
|
|
4003
|
+
isLoading: isValidating
|
|
3499
4004
|
}
|
|
3500
|
-
))
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
|
|
4005
|
+
)) : null,
|
|
4006
|
+
/* @__PURE__ */ import_react42.default.createElement("div", { className: "Layer__bank-transactions__pagination" }, /* @__PURE__ */ import_react42.default.createElement(
|
|
4007
|
+
Pagination,
|
|
4008
|
+
{
|
|
4009
|
+
currentPage,
|
|
4010
|
+
totalCount: bankTransactionsByFilter?.length || 0,
|
|
4011
|
+
pageSize,
|
|
4012
|
+
onPageChange: (page) => setCurrentPage(page)
|
|
4013
|
+
}
|
|
4014
|
+
))
|
|
4015
|
+
);
|
|
4016
|
+
};
|
|
4017
|
+
|
|
4018
|
+
// src/components/Hello/Hello.tsx
|
|
4019
|
+
var import_react43 = __toESM(require("react"));
|
|
4020
|
+
var import_swr3 = __toESM(require("swr"));
|
|
4021
|
+
var fetcher = (url) => fetch(url).then((res) => res.json());
|
|
4022
|
+
var Hello = ({ user }) => {
|
|
4023
|
+
const { data, isLoading } = (0, import_swr3.default)(
|
|
4024
|
+
`https://api.github.com/users/${user || "jyurek"}`,
|
|
4025
|
+
fetcher
|
|
4026
|
+
);
|
|
4027
|
+
const name = (isLoading ? "..." : data?.name) || "User";
|
|
4028
|
+
return /* @__PURE__ */ import_react43.default.createElement(import_react43.default.Fragment, null, /* @__PURE__ */ import_react43.default.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
|
|
4029
|
+
};
|
|
4030
|
+
|
|
4031
|
+
// src/components/LinkedAccounts/LinkedAccounts.tsx
|
|
4032
|
+
var import_react46 = __toESM(require("react"));
|
|
4033
|
+
|
|
4034
|
+
// src/hooks/useLinkedAccounts/useLinkedAccounts.ts
|
|
4035
|
+
var import_react44 = require("react");
|
|
4036
|
+
var MOCK_DATA = [
|
|
4037
|
+
{
|
|
4038
|
+
name: "Business Checking",
|
|
4039
|
+
account: "1234",
|
|
4040
|
+
amount: 1220620
|
|
4041
|
+
},
|
|
4042
|
+
{
|
|
4043
|
+
name: "Business Savings",
|
|
4044
|
+
account: "5678",
|
|
4045
|
+
amount: 10002062e-1
|
|
4046
|
+
},
|
|
4047
|
+
{
|
|
4048
|
+
name: "Account",
|
|
4049
|
+
account: "4321",
|
|
4050
|
+
amount: 801.91
|
|
4051
|
+
}
|
|
4052
|
+
];
|
|
4053
|
+
var useLinkedAccounts = () => {
|
|
4054
|
+
const { auth, businessId, apiUrl } = useLayerContext();
|
|
4055
|
+
const [isLoading, setIsLoading] = (0, import_react44.useState)(true);
|
|
4056
|
+
(0, import_react44.useEffect)(() => {
|
|
4057
|
+
const timer = setTimeout(() => {
|
|
4058
|
+
setIsLoading(false);
|
|
4059
|
+
}, 2e3);
|
|
4060
|
+
}, []);
|
|
4061
|
+
const responseData = { data: MOCK_DATA, meta: {}, error: void 0 };
|
|
4062
|
+
const isValidating = false;
|
|
4063
|
+
const {
|
|
4064
|
+
data = void 0,
|
|
4065
|
+
meta: metadata = {},
|
|
4066
|
+
error = void 0
|
|
4067
|
+
} = responseData || {};
|
|
4068
|
+
const refetch = () => {
|
|
4069
|
+
console.log("refetch...");
|
|
4070
|
+
};
|
|
4071
|
+
return {
|
|
4072
|
+
data,
|
|
4073
|
+
metadata,
|
|
4074
|
+
isLoading,
|
|
4075
|
+
isValidating,
|
|
4076
|
+
error,
|
|
4077
|
+
refetch
|
|
4078
|
+
};
|
|
4079
|
+
};
|
|
4080
|
+
|
|
4081
|
+
// src/components/LinkedAccounts/LinkedAccountThumb.tsx
|
|
4082
|
+
var import_react45 = __toESM(require("react"));
|
|
4083
|
+
var LinkedAccountThumb = ({ account }) => {
|
|
4084
|
+
return /* @__PURE__ */ import_react45.default.createElement("div", { className: "Layer__linked-account-thumb" }, /* @__PURE__ */ import_react45.default.createElement("div", { className: "topbar" }, /* @__PURE__ */ import_react45.default.createElement(Text, { as: "span", className: "account-name" }, account.name), /* @__PURE__ */ import_react45.default.createElement(Text, { as: "span", className: "account-number" }, "\u2022\u2022\u2022", account.account)), /* @__PURE__ */ import_react45.default.createElement("div", { className: "bottombar" }, /* @__PURE__ */ import_react45.default.createElement(Text, { as: "span", className: "account-amount" }, "$", centsToDollars(account.amount))));
|
|
4085
|
+
};
|
|
4086
|
+
|
|
4087
|
+
// src/components/LinkedAccounts/LinkedAccounts.tsx
|
|
4088
|
+
var COMPONENT_NAME2 = "linked-accounts";
|
|
4089
|
+
var LinkedAccounts = () => {
|
|
4090
|
+
const { data, isLoading, error, isValidating, refetch } = useLinkedAccounts();
|
|
4091
|
+
return /* @__PURE__ */ import_react46.default.createElement(Container, { name: COMPONENT_NAME2 }, /* @__PURE__ */ import_react46.default.createElement(Header, { className: "Layer__linked-accounts__header" }, /* @__PURE__ */ import_react46.default.createElement(
|
|
4092
|
+
Heading,
|
|
3511
4093
|
{
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
}
|
|
3518
|
-
)) : null, !isLoading && error ? /* @__PURE__ */ import_react39.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react39.default.createElement(
|
|
4094
|
+
className: "Layer__linked-accounts__title",
|
|
4095
|
+
size: "secondary" /* secondary */
|
|
4096
|
+
},
|
|
4097
|
+
"Linked Accounts"
|
|
4098
|
+
)), isLoading && /* @__PURE__ */ import_react46.default.createElement("div", { className: "Layer__linked-accounts__loader-container" }, /* @__PURE__ */ import_react46.default.createElement(Loader2, null)), error && !isLoading ? /* @__PURE__ */ import_react46.default.createElement(
|
|
3519
4099
|
DataState,
|
|
3520
4100
|
{
|
|
3521
4101
|
status: "failed" /* failed */,
|
|
@@ -3524,35 +4104,70 @@ var BankTransactions = ({
|
|
|
3524
4104
|
onRefresh: () => refetch(),
|
|
3525
4105
|
isLoading: isValidating
|
|
3526
4106
|
}
|
|
3527
|
-
)
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
|
|
3532
|
-
|
|
3533
|
-
|
|
4107
|
+
) : null, !error && !isLoading ? /* @__PURE__ */ import_react46.default.createElement("div", { className: "Layer__linked-accounts__list" }, data?.map((account, index) => /* @__PURE__ */ import_react46.default.createElement(LinkedAccountThumb, { account, key: `linked-acc-${index}` }))) : null);
|
|
4108
|
+
};
|
|
4109
|
+
|
|
4110
|
+
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
4111
|
+
var import_react55 = __toESM(require("react"));
|
|
4112
|
+
|
|
4113
|
+
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
4114
|
+
var import_react47 = require("react");
|
|
4115
|
+
|
|
4116
|
+
// src/utils/profitAndLossUtils.ts
|
|
4117
|
+
var doesLineItemQualifies = (item) => {
|
|
4118
|
+
return !(item.is_contra || item.value === void 0 || item.value === null || isNaN(item.value) || item.value === -Infinity || item.value === Infinity || item.value < 0);
|
|
4119
|
+
};
|
|
4120
|
+
var collectSubItems = (type, item) => {
|
|
4121
|
+
if (!item) {
|
|
4122
|
+
return [];
|
|
4123
|
+
}
|
|
4124
|
+
const items = [];
|
|
4125
|
+
item?.line_items?.forEach((item2) => {
|
|
4126
|
+
if (doesLineItemQualifies(item2)) {
|
|
4127
|
+
items.push({
|
|
4128
|
+
name: item2.name,
|
|
4129
|
+
display_name: item2.display_name,
|
|
4130
|
+
value: Math.abs(item2.value || 0),
|
|
4131
|
+
// @TODO - confirm that's safe to do this
|
|
4132
|
+
type
|
|
4133
|
+
});
|
|
3534
4134
|
}
|
|
3535
|
-
)
|
|
4135
|
+
});
|
|
4136
|
+
return items;
|
|
4137
|
+
};
|
|
4138
|
+
var collectExpensesItems = (data) => {
|
|
4139
|
+
const cogs = collectSubItems("Cost of Goods Sold", data.cost_of_goods_sold);
|
|
4140
|
+
const expenses = collectSubItems("Operating Expenses", data.expenses);
|
|
4141
|
+
const taxes = collectSubItems("Taxes & Licenses", data.taxes);
|
|
4142
|
+
return [].concat(cogs).concat(expenses).concat(taxes);
|
|
4143
|
+
};
|
|
4144
|
+
var collectRevenueItems = (data) => {
|
|
4145
|
+
const income = collectSubItems("Income", data.income);
|
|
4146
|
+
return [].concat(income);
|
|
4147
|
+
};
|
|
4148
|
+
var humanizeTitle = (sidebarView) => {
|
|
4149
|
+
switch (sidebarView) {
|
|
4150
|
+
case "expenses":
|
|
4151
|
+
return "Expenses";
|
|
4152
|
+
case "revenue":
|
|
4153
|
+
return "Revenue";
|
|
4154
|
+
default:
|
|
4155
|
+
return "Profit & Loss";
|
|
4156
|
+
}
|
|
3536
4157
|
};
|
|
3537
|
-
|
|
3538
|
-
|
|
3539
|
-
|
|
3540
|
-
|
|
3541
|
-
|
|
3542
|
-
|
|
3543
|
-
|
|
3544
|
-
|
|
3545
|
-
|
|
3546
|
-
);
|
|
3547
|
-
const name = (isLoading ? "..." : data?.name) || "User";
|
|
3548
|
-
return /* @__PURE__ */ import_react40.default.createElement(import_react40.default.Fragment, null, /* @__PURE__ */ import_react40.default.createElement("div", { className: "hello" }, "Hello, ", name, "!"));
|
|
4158
|
+
var applyShare = (items, total) => {
|
|
4159
|
+
return items.map((item) => {
|
|
4160
|
+
if (total === 0) {
|
|
4161
|
+
return item;
|
|
4162
|
+
}
|
|
4163
|
+
return {
|
|
4164
|
+
...item,
|
|
4165
|
+
share: item.value / total
|
|
4166
|
+
};
|
|
4167
|
+
});
|
|
3549
4168
|
};
|
|
3550
4169
|
|
|
3551
|
-
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
3552
|
-
var import_react49 = __toESM(require("react"));
|
|
3553
|
-
|
|
3554
4170
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
3555
|
-
var import_react41 = require("react");
|
|
3556
4171
|
var import_date_fns10 = require("date-fns");
|
|
3557
4172
|
var import_swr4 = __toESM(require("swr"));
|
|
3558
4173
|
var useProfitAndLoss = ({
|
|
@@ -3565,12 +4180,17 @@ var useProfitAndLoss = ({
|
|
|
3565
4180
|
endDate: (0, import_date_fns10.endOfMonth)(/* @__PURE__ */ new Date())
|
|
3566
4181
|
}) => {
|
|
3567
4182
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
3568
|
-
const [startDate, setStartDate] = (0,
|
|
4183
|
+
const [startDate, setStartDate] = (0, import_react47.useState)(
|
|
3569
4184
|
initialStartDate || (0, import_date_fns10.startOfMonth)(Date.now())
|
|
3570
4185
|
);
|
|
3571
|
-
const [endDate, setEndDate] = (0,
|
|
4186
|
+
const [endDate, setEndDate] = (0, import_react47.useState)(
|
|
3572
4187
|
initialEndDate || (0, import_date_fns10.endOfMonth)(Date.now())
|
|
3573
4188
|
);
|
|
4189
|
+
const [filters, setFilters] = (0, import_react47.useState)({
|
|
4190
|
+
expenses: void 0,
|
|
4191
|
+
revenue: void 0
|
|
4192
|
+
});
|
|
4193
|
+
const [sidebarScope, setSidebarScope] = (0, import_react47.useState)("expenses");
|
|
3574
4194
|
const {
|
|
3575
4195
|
data: rawData,
|
|
3576
4196
|
isLoading,
|
|
@@ -3593,6 +4213,43 @@ var useProfitAndLoss = ({
|
|
|
3593
4213
|
})
|
|
3594
4214
|
);
|
|
3595
4215
|
const { data, error } = rawData || {};
|
|
4216
|
+
const { filteredData, filteredTotal } = (0, import_react47.useMemo)(() => {
|
|
4217
|
+
if (!data) {
|
|
4218
|
+
return { filteredData: [], filteredTotal: void 0 };
|
|
4219
|
+
}
|
|
4220
|
+
const items = sidebarScope === "revenue" ? collectRevenueItems(data) : collectExpensesItems(data);
|
|
4221
|
+
const filtered = items.map((x) => {
|
|
4222
|
+
if (sidebarScope && filters[sidebarScope]?.types && filters[sidebarScope].types.length > 0 && !filters[sidebarScope]?.types?.includes(x.type)) {
|
|
4223
|
+
return {
|
|
4224
|
+
...x,
|
|
4225
|
+
hidden: true
|
|
4226
|
+
};
|
|
4227
|
+
}
|
|
4228
|
+
return x;
|
|
4229
|
+
});
|
|
4230
|
+
const sorted = filtered.sort((a, b) => {
|
|
4231
|
+
switch (filters[sidebarScope ?? "expenses"]?.sortBy) {
|
|
4232
|
+
case "category":
|
|
4233
|
+
if (filters[sidebarScope ?? "expenses"]?.sortDirection === "asc") {
|
|
4234
|
+
return a.display_name.localeCompare(b.display_name);
|
|
4235
|
+
}
|
|
4236
|
+
return b.display_name.localeCompare(a.display_name);
|
|
4237
|
+
case "type":
|
|
4238
|
+
if (filters[sidebarScope ?? "expenses"]?.sortDirection === "asc") {
|
|
4239
|
+
return a.type.localeCompare(b.type);
|
|
4240
|
+
}
|
|
4241
|
+
return b.type.localeCompare(a.type);
|
|
4242
|
+
default:
|
|
4243
|
+
if (filters[sidebarScope ?? "expenses"]?.sortDirection === "asc") {
|
|
4244
|
+
return a.value - b.value;
|
|
4245
|
+
}
|
|
4246
|
+
return b.value - a.value;
|
|
4247
|
+
}
|
|
4248
|
+
});
|
|
4249
|
+
const total = sorted.filter((x) => !x.hidden).reduce((x, { value }) => x + value, 0);
|
|
4250
|
+
const withShare = applyShare(sorted, total);
|
|
4251
|
+
return { filteredData: withShare, filteredTotal: total };
|
|
4252
|
+
}, [data, startDate, filters, sidebarScope]);
|
|
3596
4253
|
const changeDateRange = ({
|
|
3597
4254
|
startDate: newStartDate,
|
|
3598
4255
|
endDate: newEndDate
|
|
@@ -3603,25 +4260,83 @@ var useProfitAndLoss = ({
|
|
|
3603
4260
|
const refetch = () => {
|
|
3604
4261
|
mutate();
|
|
3605
4262
|
};
|
|
4263
|
+
const sortBy = (scope, field, direction) => {
|
|
4264
|
+
setFilters({
|
|
4265
|
+
...filters,
|
|
4266
|
+
[scope]: {
|
|
4267
|
+
...filters[scope],
|
|
4268
|
+
sortBy: field,
|
|
4269
|
+
sortDirection: direction ?? filters[scope]?.sortDirection === "desc" ? "asc" : "desc"
|
|
4270
|
+
}
|
|
4271
|
+
});
|
|
4272
|
+
};
|
|
4273
|
+
const setFilterTypes = (scope, types) => {
|
|
4274
|
+
setFilters({
|
|
4275
|
+
...filters,
|
|
4276
|
+
[scope]: {
|
|
4277
|
+
...filters[scope],
|
|
4278
|
+
types
|
|
4279
|
+
}
|
|
4280
|
+
});
|
|
4281
|
+
};
|
|
3606
4282
|
return {
|
|
3607
4283
|
data,
|
|
4284
|
+
filteredData,
|
|
4285
|
+
filteredTotal,
|
|
3608
4286
|
isLoading,
|
|
3609
4287
|
isValidating,
|
|
3610
4288
|
error: error || rawError,
|
|
3611
4289
|
dateRange: { startDate, endDate },
|
|
3612
4290
|
refetch,
|
|
3613
|
-
changeDateRange
|
|
4291
|
+
changeDateRange,
|
|
4292
|
+
sidebarScope,
|
|
4293
|
+
setSidebarScope,
|
|
4294
|
+
sortBy,
|
|
4295
|
+
filters,
|
|
4296
|
+
setFilterTypes
|
|
3614
4297
|
};
|
|
3615
4298
|
};
|
|
3616
4299
|
|
|
3617
4300
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
3618
|
-
var
|
|
4301
|
+
var import_react49 = __toESM(require("react"));
|
|
3619
4302
|
|
|
3620
4303
|
// src/utils/format.ts
|
|
3621
4304
|
var capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
4305
|
+
var formatPercent = (value, options) => {
|
|
4306
|
+
if (!value && value !== 0) {
|
|
4307
|
+
return;
|
|
4308
|
+
}
|
|
4309
|
+
const val = value * 100;
|
|
4310
|
+
let defaultOptions = {
|
|
4311
|
+
minimumFractionDigits: 0,
|
|
4312
|
+
maximumFractionDigits: 0
|
|
4313
|
+
};
|
|
4314
|
+
if (Math.abs(val) < 10) {
|
|
4315
|
+
defaultOptions = {
|
|
4316
|
+
minimumFractionDigits: 1,
|
|
4317
|
+
maximumFractionDigits: 1
|
|
4318
|
+
};
|
|
4319
|
+
}
|
|
4320
|
+
if (Math.abs(val) < 1) {
|
|
4321
|
+
defaultOptions = {
|
|
4322
|
+
minimumFractionDigits: 1,
|
|
4323
|
+
maximumFractionDigits: 1
|
|
4324
|
+
};
|
|
4325
|
+
}
|
|
4326
|
+
if (val === 0) {
|
|
4327
|
+
defaultOptions = {
|
|
4328
|
+
minimumFractionDigits: 0,
|
|
4329
|
+
maximumFractionDigits: 0
|
|
4330
|
+
};
|
|
4331
|
+
}
|
|
4332
|
+
return val.toLocaleString("en-US", {
|
|
4333
|
+
...defaultOptions,
|
|
4334
|
+
...options
|
|
4335
|
+
});
|
|
4336
|
+
};
|
|
3622
4337
|
|
|
3623
4338
|
// src/components/ProfitAndLossChart/Indicator.tsx
|
|
3624
|
-
var
|
|
4339
|
+
var import_react48 = __toESM(require("react"));
|
|
3625
4340
|
var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
|
|
3626
4341
|
var Indicator = ({
|
|
3627
4342
|
viewBox = {},
|
|
@@ -3636,11 +4351,11 @@ var Indicator = ({
|
|
|
3636
4351
|
const boxWidth = width * 2 + 4;
|
|
3637
4352
|
const multiplier = 1.5;
|
|
3638
4353
|
const xOffset = (boxWidth * multiplier - boxWidth) / 2;
|
|
3639
|
-
(0,
|
|
4354
|
+
(0, import_react48.useEffect)(() => {
|
|
3640
4355
|
setAnimateFrom(animateTo);
|
|
3641
4356
|
}, [animateTo]);
|
|
3642
4357
|
const actualX = animateFrom === -1 ? animateTo : animateFrom;
|
|
3643
|
-
return /* @__PURE__ */
|
|
4358
|
+
return /* @__PURE__ */ import_react48.default.createElement(
|
|
3644
4359
|
"rect",
|
|
3645
4360
|
{
|
|
3646
4361
|
className: "Layer__profit-and-loss-chart__selection-indicator",
|
|
@@ -3650,9 +4365,9 @@ var Indicator = ({
|
|
|
3650
4365
|
width: `${boxWidth * multiplier}px`,
|
|
3651
4366
|
// @ts-expect-error -- y is fine but x apparently isn't!
|
|
3652
4367
|
x: actualX - xOffset,
|
|
3653
|
-
y:
|
|
4368
|
+
y: 22,
|
|
3654
4369
|
borderRadius: 8,
|
|
3655
|
-
height: "calc(100% -
|
|
4370
|
+
height: "calc(100% - 38px)"
|
|
3656
4371
|
}
|
|
3657
4372
|
}
|
|
3658
4373
|
);
|
|
@@ -3665,7 +4380,7 @@ var barGap = 4;
|
|
|
3665
4380
|
var barSize = 20;
|
|
3666
4381
|
var ProfitAndLossChart = () => {
|
|
3667
4382
|
const { getColor } = useLayerContext();
|
|
3668
|
-
const { changeDateRange, dateRange } = (0,
|
|
4383
|
+
const { changeDateRange, dateRange } = (0, import_react49.useContext)(ProfitAndLoss.Context);
|
|
3669
4384
|
const thisMonth = (0, import_date_fns11.startOfMonth)(Date.now());
|
|
3670
4385
|
const startSelectionMonth = dateRange.startDate.getMonth();
|
|
3671
4386
|
const endSelectionMonth = dateRange.endDate.getMonth();
|
|
@@ -3765,13 +4480,13 @@ var ProfitAndLossChart = () => {
|
|
|
3765
4480
|
label
|
|
3766
4481
|
}) => {
|
|
3767
4482
|
if (active && payload && payload.length) {
|
|
3768
|
-
return /* @__PURE__ */
|
|
4483
|
+
return /* @__PURE__ */ import_react49.default.createElement("div", { className: "Layer__chart__tooltip" }, /* @__PURE__ */ import_react49.default.createElement("ul", { className: "Layer__chart__tooltip-list" }, /* @__PURE__ */ import_react49.default.createElement("li", null, /* @__PURE__ */ import_react49.default.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[0].name ?? "")), /* @__PURE__ */ import_react49.default.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[0].value ?? 0)))), /* @__PURE__ */ import_react49.default.createElement("li", null, /* @__PURE__ */ import_react49.default.createElement("label", { className: "Layer__chart__tooltip-label" }, capitalizeFirstLetter(payload[1].name ?? "")), /* @__PURE__ */ import_react49.default.createElement("span", { className: "Layer__chart__tooltip-value" }, "$", centsToDollars(Math.abs(payload[1].value ?? 0))))));
|
|
3769
4484
|
}
|
|
3770
4485
|
return null;
|
|
3771
4486
|
};
|
|
3772
4487
|
const CustomizedCursor = (props) => {
|
|
3773
4488
|
const { x, y, width, height } = props;
|
|
3774
|
-
return /* @__PURE__ */
|
|
4489
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
|
3775
4490
|
import_recharts.Rectangle,
|
|
3776
4491
|
{
|
|
3777
4492
|
fill: getColor(100)?.hex ?? "#F5F4F3",
|
|
@@ -3785,7 +4500,7 @@ var ProfitAndLossChart = () => {
|
|
|
3785
4500
|
}
|
|
3786
4501
|
);
|
|
3787
4502
|
};
|
|
3788
|
-
const data = (0,
|
|
4503
|
+
const data = (0, import_react49.useMemo)(
|
|
3789
4504
|
() => monthData.map(summarizePnL),
|
|
3790
4505
|
[
|
|
3791
4506
|
startSelectionMonth,
|
|
@@ -3793,8 +4508,8 @@ var ProfitAndLossChart = () => {
|
|
|
3793
4508
|
...monthData.map((m) => m?.net_profit)
|
|
3794
4509
|
]
|
|
3795
4510
|
);
|
|
3796
|
-
const [animateFrom, setAnimateFrom] = (0,
|
|
3797
|
-
return /* @__PURE__ */
|
|
4511
|
+
const [animateFrom, setAnimateFrom] = (0, import_react49.useState)(-1);
|
|
4512
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
|
3798
4513
|
import_recharts.ResponsiveContainer,
|
|
3799
4514
|
{
|
|
3800
4515
|
className: "Layer__chart-container",
|
|
@@ -3802,7 +4517,7 @@ var ProfitAndLossChart = () => {
|
|
|
3802
4517
|
height: "100%",
|
|
3803
4518
|
minHeight: 200
|
|
3804
4519
|
},
|
|
3805
|
-
/* @__PURE__ */
|
|
4520
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3806
4521
|
import_recharts.BarChart,
|
|
3807
4522
|
{
|
|
3808
4523
|
margin: { left: 12, right: 12, bottom: 12 },
|
|
@@ -3811,15 +4526,17 @@ var ProfitAndLossChart = () => {
|
|
|
3811
4526
|
barGap,
|
|
3812
4527
|
className: "Layer__profit-and-loss-chart"
|
|
3813
4528
|
},
|
|
3814
|
-
/* @__PURE__ */
|
|
4529
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3815
4530
|
import_recharts.Tooltip,
|
|
3816
4531
|
{
|
|
3817
4532
|
wrapperClassName: "Layer__chart__tooltip-wrapper",
|
|
3818
|
-
content: /* @__PURE__ */
|
|
3819
|
-
cursor: /* @__PURE__ */
|
|
4533
|
+
content: /* @__PURE__ */ import_react49.default.createElement(CustomTooltip, null),
|
|
4534
|
+
cursor: /* @__PURE__ */ import_react49.default.createElement(CustomizedCursor, null),
|
|
4535
|
+
animationDuration: 100,
|
|
4536
|
+
animationEasing: "ease-out"
|
|
3820
4537
|
}
|
|
3821
4538
|
),
|
|
3822
|
-
/* @__PURE__ */
|
|
4539
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3823
4540
|
import_recharts.CartesianGrid,
|
|
3824
4541
|
{
|
|
3825
4542
|
vertical: false,
|
|
@@ -3827,7 +4544,7 @@ var ProfitAndLossChart = () => {
|
|
|
3827
4544
|
strokeDasharray: "5 5"
|
|
3828
4545
|
}
|
|
3829
4546
|
),
|
|
3830
|
-
/* @__PURE__ */
|
|
4547
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3831
4548
|
import_recharts.Legend,
|
|
3832
4549
|
{
|
|
3833
4550
|
verticalAlign: "top",
|
|
@@ -3847,8 +4564,8 @@ var ProfitAndLossChart = () => {
|
|
|
3847
4564
|
]
|
|
3848
4565
|
}
|
|
3849
4566
|
),
|
|
3850
|
-
/* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
4567
|
+
/* @__PURE__ */ import_react49.default.createElement(import_recharts.XAxis, { dataKey: "name", tickLine: false }),
|
|
4568
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3852
4569
|
import_recharts.Bar,
|
|
3853
4570
|
{
|
|
3854
4571
|
dataKey: "revenue",
|
|
@@ -3857,10 +4574,10 @@ var ProfitAndLossChart = () => {
|
|
|
3857
4574
|
radius: [barSize / 4, barSize / 4, 0, 0],
|
|
3858
4575
|
className: "Layer__profit-and-loss-chart__bar--income"
|
|
3859
4576
|
},
|
|
3860
|
-
/* @__PURE__ */
|
|
4577
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3861
4578
|
import_recharts.LabelList,
|
|
3862
4579
|
{
|
|
3863
|
-
content: /* @__PURE__ */
|
|
4580
|
+
content: /* @__PURE__ */ import_react49.default.createElement(
|
|
3864
4581
|
Indicator,
|
|
3865
4582
|
{
|
|
3866
4583
|
animateFrom,
|
|
@@ -3869,7 +4586,7 @@ var ProfitAndLossChart = () => {
|
|
|
3869
4586
|
)
|
|
3870
4587
|
}
|
|
3871
4588
|
),
|
|
3872
|
-
data.map((entry) => /* @__PURE__ */
|
|
4589
|
+
data.map((entry) => /* @__PURE__ */ import_react49.default.createElement(
|
|
3873
4590
|
import_recharts.Cell,
|
|
3874
4591
|
{
|
|
3875
4592
|
key: entry.name,
|
|
@@ -3877,7 +4594,7 @@ var ProfitAndLossChart = () => {
|
|
|
3877
4594
|
}
|
|
3878
4595
|
))
|
|
3879
4596
|
),
|
|
3880
|
-
/* @__PURE__ */
|
|
4597
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3881
4598
|
import_recharts.Bar,
|
|
3882
4599
|
{
|
|
3883
4600
|
dataKey: "expenses",
|
|
@@ -3886,7 +4603,7 @@ var ProfitAndLossChart = () => {
|
|
|
3886
4603
|
radius: [barSize / 4, barSize / 4, 0, 0],
|
|
3887
4604
|
className: "Layer__profit-and-loss-chart__bar--expenses"
|
|
3888
4605
|
},
|
|
3889
|
-
data.map((entry) => /* @__PURE__ */
|
|
4606
|
+
data.map((entry) => /* @__PURE__ */ import_react49.default.createElement(
|
|
3890
4607
|
import_recharts.Cell,
|
|
3891
4608
|
{
|
|
3892
4609
|
key: entry.name,
|
|
@@ -3899,10 +4616,10 @@ var ProfitAndLossChart = () => {
|
|
|
3899
4616
|
};
|
|
3900
4617
|
|
|
3901
4618
|
// src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
|
|
3902
|
-
var
|
|
4619
|
+
var import_react50 = __toESM(require("react"));
|
|
3903
4620
|
var import_date_fns12 = require("date-fns");
|
|
3904
4621
|
var ProfitAndLossDatePicker = () => {
|
|
3905
|
-
const { changeDateRange, dateRange } = (0,
|
|
4622
|
+
const { changeDateRange, dateRange } = (0, import_react50.useContext)(ProfitAndLoss.Context);
|
|
3906
4623
|
const date = dateRange.startDate;
|
|
3907
4624
|
const label = (0, import_date_fns12.format)(date, "LLLL y");
|
|
3908
4625
|
const change = (duration) => {
|
|
@@ -3914,28 +4631,28 @@ var ProfitAndLossDatePicker = () => {
|
|
|
3914
4631
|
};
|
|
3915
4632
|
const previousMonth = () => change({ months: -1 });
|
|
3916
4633
|
const nextMonth = () => change({ months: 1 });
|
|
3917
|
-
return /* @__PURE__ */
|
|
4634
|
+
return /* @__PURE__ */ import_react50.default.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ import_react50.default.createElement(
|
|
3918
4635
|
"button",
|
|
3919
4636
|
{
|
|
3920
4637
|
"aria-label": "View Previous Month",
|
|
3921
4638
|
className: "Layer__profit-and-loss-date-picker__button",
|
|
3922
4639
|
onClick: previousMonth
|
|
3923
4640
|
},
|
|
3924
|
-
/* @__PURE__ */
|
|
4641
|
+
/* @__PURE__ */ import_react50.default.createElement(
|
|
3925
4642
|
ChevronLeft_default,
|
|
3926
4643
|
{
|
|
3927
4644
|
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
3928
4645
|
size: 18
|
|
3929
4646
|
}
|
|
3930
4647
|
)
|
|
3931
|
-
), /* @__PURE__ */
|
|
4648
|
+
), /* @__PURE__ */ import_react50.default.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, label), /* @__PURE__ */ import_react50.default.createElement(
|
|
3932
4649
|
"button",
|
|
3933
4650
|
{
|
|
3934
4651
|
"aria-label": "View Next Month",
|
|
3935
4652
|
className: "Layer__profit-and-loss-date-picker__button",
|
|
3936
4653
|
onClick: nextMonth
|
|
3937
4654
|
},
|
|
3938
|
-
/* @__PURE__ */
|
|
4655
|
+
/* @__PURE__ */ import_react50.default.createElement(
|
|
3939
4656
|
ChevronRight_default,
|
|
3940
4657
|
{
|
|
3941
4658
|
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
@@ -3946,53 +4663,83 @@ var ProfitAndLossDatePicker = () => {
|
|
|
3946
4663
|
};
|
|
3947
4664
|
|
|
3948
4665
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
3949
|
-
var
|
|
4666
|
+
var import_react52 = __toESM(require("react"));
|
|
3950
4667
|
|
|
3951
4668
|
// src/components/SkeletonLoader/SkeletonLoader.tsx
|
|
3952
|
-
var
|
|
3953
|
-
var
|
|
4669
|
+
var import_react51 = __toESM(require("react"));
|
|
4670
|
+
var import_classnames22 = __toESM(require("classnames"));
|
|
3954
4671
|
var SkeletonLoader = ({
|
|
3955
4672
|
height,
|
|
3956
4673
|
width,
|
|
3957
4674
|
className
|
|
3958
4675
|
}) => {
|
|
3959
|
-
const baseClassName = (0,
|
|
4676
|
+
const baseClassName = (0, import_classnames22.default)(
|
|
3960
4677
|
"Layer__skeleton-loader Layer__anim--skeleton-loading",
|
|
3961
4678
|
className
|
|
3962
4679
|
);
|
|
3963
|
-
return /* @__PURE__ */
|
|
4680
|
+
return /* @__PURE__ */ import_react51.default.createElement("div", { className: baseClassName, style: { width, height } });
|
|
3964
4681
|
};
|
|
3965
4682
|
|
|
3966
4683
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
4684
|
+
var import_classnames23 = __toESM(require("classnames"));
|
|
3967
4685
|
var ProfitAndLossSummaries = ({
|
|
3968
4686
|
vertical,
|
|
3969
4687
|
revenueLabel = "Revenue"
|
|
3970
4688
|
}) => {
|
|
3971
|
-
const {
|
|
4689
|
+
const {
|
|
4690
|
+
data: storedData,
|
|
4691
|
+
isLoading,
|
|
4692
|
+
setSidebarScope,
|
|
4693
|
+
sidebarScope
|
|
4694
|
+
} = (0, import_react52.useContext)(ProfitAndLoss.Context);
|
|
3972
4695
|
const data = storedData ? storedData : { income: { value: NaN }, net_profit: NaN };
|
|
3973
|
-
const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--
|
|
3974
|
-
const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--
|
|
3975
|
-
const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--
|
|
3976
|
-
return /* @__PURE__ */
|
|
4696
|
+
const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
4697
|
+
const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
4698
|
+
const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--positive";
|
|
4699
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
3977
4700
|
"div",
|
|
3978
4701
|
{
|
|
3979
4702
|
className: `Layer__profit-and-loss-summaries ${vertical ? "flex-col" : ""}`
|
|
3980
4703
|
},
|
|
3981
|
-
/* @__PURE__ */
|
|
3982
|
-
"
|
|
4704
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
4705
|
+
"div",
|
|
3983
4706
|
{
|
|
3984
|
-
className:
|
|
4707
|
+
className: (0, import_classnames23.default)(
|
|
4708
|
+
"Layer__profit-and-loss-summaries__summary Layer__actionable",
|
|
4709
|
+
"Layer__profit-and-loss-summaries__summary--income",
|
|
4710
|
+
sidebarScope === "revenue" ? "active" : ""
|
|
4711
|
+
),
|
|
4712
|
+
onClick: () => setSidebarScope("revenue")
|
|
3985
4713
|
},
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
4714
|
+
/* @__PURE__ */ import_react52.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, revenueLabel),
|
|
4715
|
+
isLoading || storedData === void 0 ? /* @__PURE__ */ import_react52.default.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ import_react52.default.createElement(SkeletonLoader, null)) : /* @__PURE__ */ import_react52.default.createElement(
|
|
4716
|
+
"span",
|
|
4717
|
+
{
|
|
4718
|
+
className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
|
|
4719
|
+
},
|
|
4720
|
+
centsToDollars(Math.abs(data?.income?.value ?? NaN))
|
|
4721
|
+
)
|
|
4722
|
+
),
|
|
4723
|
+
/* @__PURE__ */ import_react52.default.createElement(
|
|
4724
|
+
"div",
|
|
3990
4725
|
{
|
|
3991
|
-
className:
|
|
4726
|
+
className: (0, import_classnames23.default)(
|
|
4727
|
+
"Layer__profit-and-loss-summaries__summary Layer__actionable",
|
|
4728
|
+
"Layer__profit-and-loss-summaries__summary--expenses",
|
|
4729
|
+
sidebarScope === "expenses" ? "active" : ""
|
|
4730
|
+
),
|
|
4731
|
+
onClick: () => setSidebarScope("expenses")
|
|
3992
4732
|
},
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
4733
|
+
/* @__PURE__ */ import_react52.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"),
|
|
4734
|
+
isLoading || storedData === void 0 ? /* @__PURE__ */ import_react52.default.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ import_react52.default.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ import_react52.default.createElement(
|
|
4735
|
+
"span",
|
|
4736
|
+
{
|
|
4737
|
+
className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
|
|
4738
|
+
},
|
|
4739
|
+
centsToDollars(Math.abs((data.income.value ?? 0) - data.net_profit))
|
|
4740
|
+
)
|
|
4741
|
+
),
|
|
4742
|
+
/* @__PURE__ */ import_react52.default.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--net-profit" }, /* @__PURE__ */ import_react52.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Net Profit"), isLoading || storedData === void 0 ? /* @__PURE__ */ import_react52.default.createElement("div", { className: "Layer__profit-and-loss-summaries__loader" }, /* @__PURE__ */ import_react52.default.createElement(SkeletonLoader, { className: "Layer__profit-and-loss-summaries__loader" })) : /* @__PURE__ */ import_react52.default.createElement(
|
|
3996
4743
|
"span",
|
|
3997
4744
|
{
|
|
3998
4745
|
className: `Layer__profit-and-loss-summaries__amount ${netProfitDirectionClass}`
|
|
@@ -4003,10 +4750,10 @@ var ProfitAndLossSummaries = ({
|
|
|
4003
4750
|
};
|
|
4004
4751
|
|
|
4005
4752
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
4006
|
-
var
|
|
4753
|
+
var import_react54 = __toESM(require("react"));
|
|
4007
4754
|
|
|
4008
4755
|
// src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
|
|
4009
|
-
var
|
|
4756
|
+
var import_react53 = __toESM(require("react"));
|
|
4010
4757
|
var ProfitAndLossRow = ({
|
|
4011
4758
|
variant,
|
|
4012
4759
|
lineItem,
|
|
@@ -4019,7 +4766,7 @@ var ProfitAndLossRow = ({
|
|
|
4019
4766
|
return null;
|
|
4020
4767
|
}
|
|
4021
4768
|
const { value, display_name, line_items } = lineItem;
|
|
4022
|
-
const [expanded, setExpanded] = (0,
|
|
4769
|
+
const [expanded, setExpanded] = (0, import_react53.useState)(true);
|
|
4023
4770
|
const amount = value ?? 0;
|
|
4024
4771
|
const amountString = centsToDollars(Math.abs(amount));
|
|
4025
4772
|
const labelClasses = [
|
|
@@ -4050,20 +4797,20 @@ var ProfitAndLossRow = ({
|
|
|
4050
4797
|
);
|
|
4051
4798
|
displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
|
|
4052
4799
|
displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
|
|
4053
|
-
return /* @__PURE__ */
|
|
4800
|
+
return /* @__PURE__ */ import_react53.default.createElement(import_react53.default.Fragment, null, /* @__PURE__ */ import_react53.default.createElement(
|
|
4054
4801
|
"div",
|
|
4055
4802
|
{
|
|
4056
4803
|
className: labelClasses.join(" "),
|
|
4057
4804
|
onClick: () => !lockExpanded && toggleExpanded()
|
|
4058
4805
|
},
|
|
4059
|
-
!lockExpanded && /* @__PURE__ */
|
|
4060
|
-
/* @__PURE__ */
|
|
4061
|
-
), /* @__PURE__ */
|
|
4806
|
+
!lockExpanded && variant !== "summation" ? /* @__PURE__ */ import_react53.default.createElement(ChevronDownFill_default, { size: 16 }) : null,
|
|
4807
|
+
/* @__PURE__ */ import_react53.default.createElement(Text, null, display_name)
|
|
4808
|
+
), /* @__PURE__ */ import_react53.default.createElement("div", { className: valueClasses.join(" ") }, /* @__PURE__ */ import_react53.default.createElement(Text, null, amountString)), canGoDeeper && hasChildren && /* @__PURE__ */ import_react53.default.createElement(
|
|
4062
4809
|
"div",
|
|
4063
4810
|
{
|
|
4064
4811
|
className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
|
|
4065
4812
|
},
|
|
4066
|
-
/* @__PURE__ */
|
|
4813
|
+
/* @__PURE__ */ import_react53.default.createElement("div", { className: "Layer__profit-and-loss-row__children--content" }, (line_items || []).map((line_item) => /* @__PURE__ */ import_react53.default.createElement(
|
|
4067
4814
|
ProfitAndLossRow,
|
|
4068
4815
|
{
|
|
4069
4816
|
key: line_item.display_name,
|
|
@@ -4126,26 +4873,26 @@ var empty_profit_and_loss_report_default = {
|
|
|
4126
4873
|
|
|
4127
4874
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
4128
4875
|
var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
4129
|
-
const { data: actualData, isLoading } = (0,
|
|
4876
|
+
const { data: actualData, isLoading } = (0, import_react54.useContext)(ProfitAndLoss.Context);
|
|
4130
4877
|
const data = !actualData || isLoading ? empty_profit_and_loss_report_default : actualData;
|
|
4131
4878
|
if (isLoading || actualData === void 0) {
|
|
4132
|
-
return /* @__PURE__ */
|
|
4879
|
+
return /* @__PURE__ */ import_react54.default.createElement("div", { className: "Layer__profit-and-loss-table__loader-container" }, /* @__PURE__ */ import_react54.default.createElement(Loader2, null));
|
|
4133
4880
|
}
|
|
4134
|
-
return /* @__PURE__ */
|
|
4881
|
+
return /* @__PURE__ */ import_react54.default.createElement(import_react54.default.Fragment, null, /* @__PURE__ */ import_react54.default.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table--main" }, /* @__PURE__ */ import_react54.default.createElement(
|
|
4135
4882
|
ProfitAndLossRow,
|
|
4136
4883
|
{
|
|
4137
4884
|
lineItem: data.income,
|
|
4138
4885
|
direction: "CREDIT" /* CREDIT */,
|
|
4139
4886
|
lockExpanded
|
|
4140
4887
|
}
|
|
4141
|
-
), /* @__PURE__ */
|
|
4888
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4142
4889
|
ProfitAndLossRow,
|
|
4143
4890
|
{
|
|
4144
4891
|
lineItem: data.cost_of_goods_sold,
|
|
4145
4892
|
direction: "DEBIT" /* DEBIT */,
|
|
4146
4893
|
lockExpanded
|
|
4147
4894
|
}
|
|
4148
|
-
), /* @__PURE__ */
|
|
4895
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4149
4896
|
ProfitAndLossRow,
|
|
4150
4897
|
{
|
|
4151
4898
|
lineItem: {
|
|
@@ -4156,14 +4903,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
4156
4903
|
direction: "CREDIT" /* CREDIT */,
|
|
4157
4904
|
lockExpanded
|
|
4158
4905
|
}
|
|
4159
|
-
), /* @__PURE__ */
|
|
4906
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4160
4907
|
ProfitAndLossRow,
|
|
4161
4908
|
{
|
|
4162
4909
|
lineItem: data.expenses,
|
|
4163
4910
|
direction: "DEBIT" /* DEBIT */,
|
|
4164
4911
|
lockExpanded
|
|
4165
4912
|
}
|
|
4166
|
-
), /* @__PURE__ */
|
|
4913
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4167
4914
|
ProfitAndLossRow,
|
|
4168
4915
|
{
|
|
4169
4916
|
lineItem: {
|
|
@@ -4174,14 +4921,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
4174
4921
|
direction: "CREDIT" /* CREDIT */,
|
|
4175
4922
|
lockExpanded
|
|
4176
4923
|
}
|
|
4177
|
-
), /* @__PURE__ */
|
|
4924
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4178
4925
|
ProfitAndLossRow,
|
|
4179
4926
|
{
|
|
4180
4927
|
lineItem: data.taxes,
|
|
4181
4928
|
direction: "DEBIT" /* DEBIT */,
|
|
4182
4929
|
lockExpanded
|
|
4183
4930
|
}
|
|
4184
|
-
), /* @__PURE__ */
|
|
4931
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4185
4932
|
ProfitAndLossRow,
|
|
4186
4933
|
{
|
|
4187
4934
|
lineItem: {
|
|
@@ -4192,14 +4939,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
4192
4939
|
direction: "CREDIT" /* CREDIT */,
|
|
4193
4940
|
lockExpanded
|
|
4194
4941
|
}
|
|
4195
|
-
)), /* @__PURE__ */
|
|
4942
|
+
)), /* @__PURE__ */ import_react54.default.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ import_react54.default.createElement(
|
|
4196
4943
|
ProfitAndLossRow,
|
|
4197
4944
|
{
|
|
4198
4945
|
lineItem: data.other_outflows,
|
|
4199
4946
|
direction: "DEBIT" /* DEBIT */,
|
|
4200
4947
|
lockExpanded
|
|
4201
4948
|
}
|
|
4202
|
-
), /* @__PURE__ */
|
|
4949
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4203
4950
|
ProfitAndLossRow,
|
|
4204
4951
|
{
|
|
4205
4952
|
lineItem: data.personal_expenses,
|
|
@@ -4211,8 +4958,10 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
4211
4958
|
|
|
4212
4959
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
4213
4960
|
var import_date_fns13 = require("date-fns");
|
|
4214
|
-
var PNLContext = (0,
|
|
4961
|
+
var PNLContext = (0, import_react55.createContext)({
|
|
4215
4962
|
data: void 0,
|
|
4963
|
+
filteredData: [],
|
|
4964
|
+
filteredTotal: void 0,
|
|
4216
4965
|
isLoading: true,
|
|
4217
4966
|
isValidating: false,
|
|
4218
4967
|
error: void 0,
|
|
@@ -4223,11 +4972,22 @@ var PNLContext = (0, import_react49.createContext)({
|
|
|
4223
4972
|
changeDateRange: () => {
|
|
4224
4973
|
},
|
|
4225
4974
|
refetch: () => {
|
|
4975
|
+
},
|
|
4976
|
+
sidebarScope: void 0,
|
|
4977
|
+
setSidebarScope: () => {
|
|
4978
|
+
},
|
|
4979
|
+
sortBy: () => {
|
|
4980
|
+
},
|
|
4981
|
+
setFilterTypes: () => {
|
|
4982
|
+
},
|
|
4983
|
+
filters: {
|
|
4984
|
+
expenses: void 0,
|
|
4985
|
+
revenue: void 0
|
|
4226
4986
|
}
|
|
4227
4987
|
});
|
|
4228
4988
|
var ProfitAndLoss = ({ children, tagFilter, reportingBasis }) => {
|
|
4229
4989
|
const contextData = useProfitAndLoss({ tagFilter, reportingBasis });
|
|
4230
|
-
return /* @__PURE__ */
|
|
4990
|
+
return /* @__PURE__ */ import_react55.default.createElement(PNLContext.Provider, { value: contextData }, /* @__PURE__ */ import_react55.default.createElement("div", { className: "Layer__component Layer__profit-and-loss" }, children));
|
|
4231
4991
|
};
|
|
4232
4992
|
ProfitAndLoss.Chart = ProfitAndLossChart;
|
|
4233
4993
|
ProfitAndLoss.Context = PNLContext;
|
|
@@ -4236,17 +4996,466 @@ ProfitAndLoss.Summaries = ProfitAndLossSummaries;
|
|
|
4236
4996
|
ProfitAndLoss.Table = ProfitAndLossTable;
|
|
4237
4997
|
|
|
4238
4998
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
4239
|
-
var
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4999
|
+
var import_react57 = __toESM(require("react"));
|
|
5000
|
+
|
|
5001
|
+
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
5002
|
+
var import_react56 = __toESM(require("react"));
|
|
5003
|
+
var import_react_select3 = __toESM(require("react-select"));
|
|
5004
|
+
|
|
5005
|
+
// src/icons/SortArrows.tsx
|
|
5006
|
+
var React66 = __toESM(require("react"));
|
|
5007
|
+
var SortArrows = ({ size = 13, ...props }) => /* @__PURE__ */ React66.createElement(
|
|
5008
|
+
"svg",
|
|
5009
|
+
{
|
|
5010
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5011
|
+
viewBox: "0 0 12 13",
|
|
5012
|
+
fill: "none",
|
|
5013
|
+
...props,
|
|
5014
|
+
width: size,
|
|
5015
|
+
height: size
|
|
5016
|
+
},
|
|
5017
|
+
/* @__PURE__ */ React66.createElement("g", { "clip-path": "url(#clip0_1758_75388)" }, /* @__PURE__ */ React66.createElement(
|
|
5018
|
+
"path",
|
|
5019
|
+
{
|
|
5020
|
+
d: "M1.33325 8.5L3.99992 11.1667L6.66659 8.5",
|
|
5021
|
+
stroke: "currentColor",
|
|
5022
|
+
"stroke-linecap": "round",
|
|
5023
|
+
"stroke-linejoin": "round",
|
|
5024
|
+
className: "desc-arrow"
|
|
5025
|
+
}
|
|
5026
|
+
), /* @__PURE__ */ React66.createElement(
|
|
5027
|
+
"path",
|
|
5028
|
+
{
|
|
5029
|
+
d: "M4 2.5L4 11.1667",
|
|
5030
|
+
stroke: "currentColor",
|
|
5031
|
+
"stroke-linecap": "round",
|
|
5032
|
+
"stroke-linejoin": "round",
|
|
5033
|
+
className: "desc-arrow"
|
|
5034
|
+
}
|
|
5035
|
+
), /* @__PURE__ */ React66.createElement(
|
|
5036
|
+
"path",
|
|
5037
|
+
{
|
|
5038
|
+
d: "M5.99988 5.16602L8.66654 2.49935L11.3332 5.16602",
|
|
5039
|
+
stroke: "currentColor",
|
|
5040
|
+
"stroke-linecap": "round",
|
|
5041
|
+
"stroke-linejoin": "round",
|
|
5042
|
+
className: "asc-arrow"
|
|
5043
|
+
}
|
|
5044
|
+
), /* @__PURE__ */ React66.createElement(
|
|
5045
|
+
"path",
|
|
5046
|
+
{
|
|
5047
|
+
d: "M8.66663 11.166L8.66663 2.49935",
|
|
5048
|
+
stroke: "currentColor",
|
|
5049
|
+
"stroke-linecap": "round",
|
|
5050
|
+
"stroke-linejoin": "round",
|
|
5051
|
+
className: "asc-arrow"
|
|
5052
|
+
}
|
|
5053
|
+
)),
|
|
5054
|
+
/* @__PURE__ */ React66.createElement("defs", null, /* @__PURE__ */ React66.createElement("clipPath", { id: "clip0_1758_75388" }, /* @__PURE__ */ React66.createElement(
|
|
5055
|
+
"rect",
|
|
5056
|
+
{
|
|
5057
|
+
width: "12",
|
|
5058
|
+
height: "12",
|
|
5059
|
+
fill: "white",
|
|
5060
|
+
transform: "translate(0 0.5)"
|
|
5061
|
+
}
|
|
5062
|
+
)))
|
|
5063
|
+
);
|
|
5064
|
+
var SortArrows_default = SortArrows;
|
|
5065
|
+
|
|
5066
|
+
// src/icons/X.tsx
|
|
5067
|
+
var React67 = __toESM(require("react"));
|
|
5068
|
+
var X = ({ size = 18, ...props }) => /* @__PURE__ */ React67.createElement(
|
|
5069
|
+
"svg",
|
|
5070
|
+
{
|
|
5071
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
5072
|
+
viewBox: "0 0 18 18",
|
|
5073
|
+
fill: "none",
|
|
5074
|
+
...props,
|
|
5075
|
+
width: size,
|
|
5076
|
+
height: size
|
|
5077
|
+
},
|
|
5078
|
+
/* @__PURE__ */ React67.createElement(
|
|
5079
|
+
"path",
|
|
5080
|
+
{
|
|
5081
|
+
d: "M13.5 4.5L4.5 13.5",
|
|
5082
|
+
stroke: "currentColor",
|
|
5083
|
+
strokeLinecap: "round",
|
|
5084
|
+
strokeLinejoin: "round"
|
|
5085
|
+
}
|
|
5086
|
+
),
|
|
5087
|
+
/* @__PURE__ */ React67.createElement(
|
|
5088
|
+
"path",
|
|
5089
|
+
{
|
|
5090
|
+
d: "M4.5 4.5L13.5 13.5",
|
|
5091
|
+
stroke: "currentColor",
|
|
5092
|
+
strokeLinecap: "round",
|
|
5093
|
+
strokeLinejoin: "round"
|
|
5094
|
+
}
|
|
5095
|
+
)
|
|
5096
|
+
);
|
|
5097
|
+
var X_default = X;
|
|
5098
|
+
|
|
5099
|
+
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
5100
|
+
var import_classnames24 = __toESM(require("classnames"));
|
|
5101
|
+
var import_date_fns14 = require("date-fns");
|
|
5102
|
+
var import_recharts2 = require("recharts");
|
|
5103
|
+
var INACTIVE_OPACITY_LEVELS = [0.85, 0.7, 0.66, 0.55, 0.4, 0.33, 0.25, 0.15];
|
|
5104
|
+
var DEFAULT_CHART_COLORS = [
|
|
5105
|
+
{
|
|
5106
|
+
color: "#7417B3",
|
|
5107
|
+
opacity: 1
|
|
5108
|
+
},
|
|
5109
|
+
{
|
|
5110
|
+
color: "#7417B3",
|
|
5111
|
+
opacity: 0.8
|
|
5112
|
+
},
|
|
5113
|
+
{
|
|
5114
|
+
color: "#7417B3",
|
|
5115
|
+
opacity: 0.6
|
|
5116
|
+
},
|
|
5117
|
+
{
|
|
5118
|
+
color: "#7417B3",
|
|
5119
|
+
opacity: 0.4
|
|
5120
|
+
},
|
|
5121
|
+
{
|
|
5122
|
+
color: "#7417B3",
|
|
5123
|
+
opacity: 0.2
|
|
5124
|
+
},
|
|
5125
|
+
{
|
|
5126
|
+
color: "#7417B3",
|
|
5127
|
+
opacity: 0.1
|
|
5128
|
+
},
|
|
5129
|
+
{
|
|
5130
|
+
color: "#006A80",
|
|
5131
|
+
opacity: 1
|
|
5132
|
+
},
|
|
5133
|
+
{
|
|
5134
|
+
color: "#006A80",
|
|
5135
|
+
opacity: 0.8
|
|
5136
|
+
},
|
|
5137
|
+
{
|
|
5138
|
+
color: "#006A80",
|
|
5139
|
+
opacity: 0.6
|
|
5140
|
+
},
|
|
5141
|
+
{
|
|
5142
|
+
color: "#006A80",
|
|
5143
|
+
opacity: 0.4
|
|
5144
|
+
},
|
|
5145
|
+
{
|
|
5146
|
+
color: "#006A80",
|
|
5147
|
+
opacity: 0.2
|
|
5148
|
+
},
|
|
5149
|
+
{
|
|
5150
|
+
color: "#006A80",
|
|
5151
|
+
opacity: 0.1
|
|
5152
|
+
},
|
|
5153
|
+
{
|
|
5154
|
+
color: "#009930",
|
|
5155
|
+
opacity: 1
|
|
5156
|
+
},
|
|
5157
|
+
{
|
|
5158
|
+
color: "#009930",
|
|
5159
|
+
opacity: 0.8
|
|
5160
|
+
},
|
|
5161
|
+
{
|
|
5162
|
+
color: "#009930",
|
|
5163
|
+
opacity: 0.6
|
|
5164
|
+
},
|
|
5165
|
+
{
|
|
5166
|
+
color: "#009930",
|
|
5167
|
+
opacity: 0.4
|
|
5168
|
+
},
|
|
5169
|
+
{
|
|
5170
|
+
color: "#009930",
|
|
5171
|
+
opacity: 0.2
|
|
5172
|
+
},
|
|
5173
|
+
{
|
|
5174
|
+
color: "#009930",
|
|
5175
|
+
opacity: 0.1
|
|
5176
|
+
}
|
|
5177
|
+
];
|
|
5178
|
+
var ProfitAndLossDetailedCharts = () => {
|
|
5179
|
+
const {
|
|
5180
|
+
data,
|
|
5181
|
+
filteredData,
|
|
5182
|
+
filteredTotal,
|
|
5183
|
+
sortBy,
|
|
5184
|
+
filters,
|
|
5185
|
+
isLoading,
|
|
5186
|
+
dateRange,
|
|
5187
|
+
sidebarScope,
|
|
5188
|
+
setSidebarScope,
|
|
5189
|
+
setFilterTypes
|
|
5190
|
+
} = (0, import_react56.useContext)(ProfitAndLoss.Context);
|
|
5191
|
+
const [hoveredItem, setHoveredItem] = (0, import_react56.useState)();
|
|
5192
|
+
const chartData = (0, import_react56.useMemo)(() => {
|
|
5193
|
+
if (!filteredData) {
|
|
5194
|
+
return [];
|
|
5195
|
+
}
|
|
5196
|
+
return filteredData.map((x) => {
|
|
5197
|
+
if (x.hidden) {
|
|
5198
|
+
return {
|
|
5199
|
+
name: x.display_name,
|
|
5200
|
+
value: 0
|
|
5201
|
+
};
|
|
5202
|
+
}
|
|
5203
|
+
return {
|
|
5204
|
+
name: x.display_name,
|
|
5205
|
+
value: x.value
|
|
5206
|
+
};
|
|
5207
|
+
});
|
|
5208
|
+
}, [filteredData]);
|
|
5209
|
+
const buildColClass = (column) => {
|
|
5210
|
+
return (0, import_classnames24.default)(
|
|
5211
|
+
"Layer__sortable-col",
|
|
5212
|
+
sidebarScope && filters[sidebarScope]?.sortBy === column ? `sort--${(sidebarScope && filters[sidebarScope]?.sortDirection) ?? "desc"}` : ""
|
|
5213
|
+
);
|
|
5214
|
+
};
|
|
5215
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5216
|
+
"div",
|
|
5217
|
+
{
|
|
5218
|
+
className: (0, import_classnames24.default)(
|
|
5219
|
+
"Layer__profit-and-loss__side-panel",
|
|
5220
|
+
sidebarScope && "open"
|
|
5221
|
+
)
|
|
5222
|
+
},
|
|
5223
|
+
/* @__PURE__ */ import_react56.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts" }, /* @__PURE__ */ import_react56.default.createElement("header", null, /* @__PURE__ */ import_react56.default.createElement("div", { className: "Layer__profit-and-loss-detailed-charts__head" }, /* @__PURE__ */ import_react56.default.createElement(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title" }, humanizeTitle(sidebarScope)), /* @__PURE__ */ import_react56.default.createElement(Text, { size: "sm" /* sm */, className: "date" }, (0, import_date_fns14.format)(dateRange.startDate, "LLLL, y"))), /* @__PURE__ */ import_react56.default.createElement(
|
|
5224
|
+
Button,
|
|
5225
|
+
{
|
|
5226
|
+
rightIcon: /* @__PURE__ */ import_react56.default.createElement(X_default, null),
|
|
5227
|
+
iconOnly: true,
|
|
5228
|
+
onClick: () => setSidebarScope(void 0),
|
|
5229
|
+
variant: "secondary" /* secondary */
|
|
5230
|
+
}
|
|
5231
|
+
)), /* @__PURE__ */ import_react56.default.createElement("div", { className: "chart-container" }, /* @__PURE__ */ import_react56.default.createElement(import_recharts2.ResponsiveContainer, null, /* @__PURE__ */ import_react56.default.createElement(import_recharts2.PieChart, null, /* @__PURE__ */ import_react56.default.createElement(
|
|
5232
|
+
import_recharts2.Pie,
|
|
5233
|
+
{
|
|
5234
|
+
data: chartData,
|
|
5235
|
+
dataKey: "value",
|
|
5236
|
+
nameKey: "name",
|
|
5237
|
+
cx: "50%",
|
|
5238
|
+
cy: "50%",
|
|
5239
|
+
innerRadius: 105,
|
|
5240
|
+
outerRadius: 120,
|
|
5241
|
+
paddingAngle: 0.5,
|
|
5242
|
+
fill: "#8884d8"
|
|
5243
|
+
},
|
|
5244
|
+
chartData.map((entry, index) => {
|
|
5245
|
+
const colorConfig = DEFAULT_CHART_COLORS[index % DEFAULT_CHART_COLORS.length];
|
|
5246
|
+
let fill = colorConfig.color;
|
|
5247
|
+
let opacity = colorConfig.opacity;
|
|
5248
|
+
let active = true;
|
|
5249
|
+
if (hoveredItem && entry.name !== hoveredItem) {
|
|
5250
|
+
active = false;
|
|
5251
|
+
fill = void 0;
|
|
5252
|
+
opacity = INACTIVE_OPACITY_LEVELS[index % INACTIVE_OPACITY_LEVELS.length];
|
|
5253
|
+
}
|
|
5254
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5255
|
+
import_recharts2.Cell,
|
|
5256
|
+
{
|
|
5257
|
+
key: `cell-${index}`,
|
|
5258
|
+
className: `Layer__profit-and-loss-detailed-charts__pie ${hoveredItem && active ? "active" : "inactive"}`,
|
|
5259
|
+
style: { fill },
|
|
5260
|
+
opacity,
|
|
5261
|
+
onMouseEnter: () => setHoveredItem(entry.name),
|
|
5262
|
+
onMouseLeave: () => setHoveredItem(void 0)
|
|
5263
|
+
}
|
|
5264
|
+
);
|
|
5265
|
+
}),
|
|
5266
|
+
/* @__PURE__ */ import_react56.default.createElement(
|
|
5267
|
+
import_recharts2.Label,
|
|
5268
|
+
{
|
|
5269
|
+
position: "center",
|
|
5270
|
+
value: "Total",
|
|
5271
|
+
className: "pie-center-label-title",
|
|
5272
|
+
content: (props) => {
|
|
5273
|
+
const { cx, cy } = props.viewBox ?? {
|
|
5274
|
+
cx: 0,
|
|
5275
|
+
cy: 0
|
|
5276
|
+
};
|
|
5277
|
+
const positioningProps = {
|
|
5278
|
+
x: cx,
|
|
5279
|
+
y: (cy || 0) - 15,
|
|
5280
|
+
textAnchor: "middle",
|
|
5281
|
+
verticalAnchor: "middle"
|
|
5282
|
+
};
|
|
5283
|
+
let text = "Total";
|
|
5284
|
+
if (hoveredItem) {
|
|
5285
|
+
text = hoveredItem;
|
|
5286
|
+
}
|
|
5287
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5288
|
+
import_recharts2.Text,
|
|
5289
|
+
{
|
|
5290
|
+
...positioningProps,
|
|
5291
|
+
className: "pie-center-label__title"
|
|
5292
|
+
},
|
|
5293
|
+
text
|
|
5294
|
+
);
|
|
5295
|
+
}
|
|
5296
|
+
}
|
|
5297
|
+
),
|
|
5298
|
+
/* @__PURE__ */ import_react56.default.createElement(
|
|
5299
|
+
import_recharts2.Label,
|
|
5300
|
+
{
|
|
5301
|
+
position: "center",
|
|
5302
|
+
value: "Total",
|
|
5303
|
+
className: "pie-center-label-title",
|
|
5304
|
+
content: (props) => {
|
|
5305
|
+
const { cx, cy } = props.viewBox ?? {
|
|
5306
|
+
cx: 0,
|
|
5307
|
+
cy: 0
|
|
5308
|
+
};
|
|
5309
|
+
const positioningProps = {
|
|
5310
|
+
x: cx,
|
|
5311
|
+
y: (cy || 0) + 5,
|
|
5312
|
+
textAnchor: "middle",
|
|
5313
|
+
verticalAnchor: "middle"
|
|
5314
|
+
};
|
|
5315
|
+
let value = filteredTotal;
|
|
5316
|
+
if (hoveredItem) {
|
|
5317
|
+
value = filteredData.find(
|
|
5318
|
+
(x) => x.display_name === hoveredItem
|
|
5319
|
+
)?.value;
|
|
5320
|
+
}
|
|
5321
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5322
|
+
import_recharts2.Text,
|
|
5323
|
+
{
|
|
5324
|
+
...positioningProps,
|
|
5325
|
+
className: "pie-center-label__value"
|
|
5326
|
+
},
|
|
5327
|
+
`$${centsToDollars(value)}`
|
|
5328
|
+
);
|
|
5329
|
+
}
|
|
5330
|
+
}
|
|
5331
|
+
),
|
|
5332
|
+
/* @__PURE__ */ import_react56.default.createElement(
|
|
5333
|
+
import_recharts2.Label,
|
|
5334
|
+
{
|
|
5335
|
+
position: "center",
|
|
5336
|
+
value: "Total",
|
|
5337
|
+
className: "pie-center-label-title",
|
|
5338
|
+
content: (props) => {
|
|
5339
|
+
const { cx, cy } = props.viewBox ?? {
|
|
5340
|
+
cx: 0,
|
|
5341
|
+
cy: 0
|
|
5342
|
+
};
|
|
5343
|
+
const positioningProps = {
|
|
5344
|
+
x: cx,
|
|
5345
|
+
y: (cy || 0) + 25,
|
|
5346
|
+
height: 20,
|
|
5347
|
+
textAnchor: "middle",
|
|
5348
|
+
verticalAnchor: "middle"
|
|
5349
|
+
};
|
|
5350
|
+
if (hoveredItem) {
|
|
5351
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5352
|
+
import_recharts2.Text,
|
|
5353
|
+
{
|
|
5354
|
+
...positioningProps,
|
|
5355
|
+
className: "pie-center-label__share"
|
|
5356
|
+
},
|
|
5357
|
+
`${formatPercent(
|
|
5358
|
+
filteredData.find(
|
|
5359
|
+
(x) => x.display_name === hoveredItem
|
|
5360
|
+
)?.share
|
|
5361
|
+
)}%`
|
|
5362
|
+
);
|
|
5363
|
+
}
|
|
5364
|
+
return;
|
|
5365
|
+
}
|
|
5366
|
+
}
|
|
5367
|
+
)
|
|
5368
|
+
)))), /* @__PURE__ */ import_react56.default.createElement("div", { className: "filters" }, /* @__PURE__ */ import_react56.default.createElement(Text, { size: "sm" /* sm */, className: "Layer__label" }, "Filters"), /* @__PURE__ */ import_react56.default.createElement(
|
|
5369
|
+
import_react_select3.default,
|
|
5370
|
+
{
|
|
5371
|
+
className: "type-select",
|
|
5372
|
+
classNamePrefix: "Layer__select",
|
|
5373
|
+
value: sidebarScope && filters[sidebarScope]?.types ? sidebarScope && filters[sidebarScope]?.types?.map((x) => ({
|
|
5374
|
+
value: x,
|
|
5375
|
+
label: x
|
|
5376
|
+
})) : [],
|
|
5377
|
+
isMulti: true,
|
|
5378
|
+
isClearable: false,
|
|
5379
|
+
options: [...new Set(filteredData?.map((x) => x.type))].map((x) => ({
|
|
5380
|
+
label: x,
|
|
5381
|
+
value: x
|
|
5382
|
+
})),
|
|
5383
|
+
onChange: (selected) => {
|
|
5384
|
+
setFilterTypes(
|
|
5385
|
+
sidebarScope ?? "expenses",
|
|
5386
|
+
selected.map((x) => x.value)
|
|
5387
|
+
);
|
|
5388
|
+
}
|
|
5389
|
+
}
|
|
5390
|
+
)), /* @__PURE__ */ import_react56.default.createElement("div", { className: "details-container" }, /* @__PURE__ */ import_react56.default.createElement("div", { className: "table" }, /* @__PURE__ */ import_react56.default.createElement("table", null, /* @__PURE__ */ import_react56.default.createElement("thead", null, /* @__PURE__ */ import_react56.default.createElement("tr", null, /* @__PURE__ */ import_react56.default.createElement(
|
|
5391
|
+
"th",
|
|
5392
|
+
{
|
|
5393
|
+
className: buildColClass("category"),
|
|
5394
|
+
onClick: () => sortBy(sidebarScope ?? "expenses", "category")
|
|
5395
|
+
},
|
|
5396
|
+
"Expense/Sale ",
|
|
5397
|
+
/* @__PURE__ */ import_react56.default.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
5398
|
+
), /* @__PURE__ */ import_react56.default.createElement(
|
|
5399
|
+
"th",
|
|
5400
|
+
{
|
|
5401
|
+
className: buildColClass("type"),
|
|
5402
|
+
onClick: () => sortBy(sidebarScope ?? "expenses", "type")
|
|
5403
|
+
},
|
|
5404
|
+
"Type ",
|
|
5405
|
+
/* @__PURE__ */ import_react56.default.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
5406
|
+
), /* @__PURE__ */ import_react56.default.createElement("th", null), /* @__PURE__ */ import_react56.default.createElement(
|
|
5407
|
+
"th",
|
|
5408
|
+
{
|
|
5409
|
+
className: buildColClass("value"),
|
|
5410
|
+
onClick: () => sortBy(sidebarScope ?? "expenses", "value")
|
|
5411
|
+
},
|
|
5412
|
+
"Value ",
|
|
5413
|
+
/* @__PURE__ */ import_react56.default.createElement(SortArrows_default, { className: "Layer__sort-arrows" })
|
|
5414
|
+
))), /* @__PURE__ */ import_react56.default.createElement("tbody", null, filteredData.filter((x) => !x.hidden).map((item, idx) => {
|
|
5415
|
+
const colorConfig = DEFAULT_CHART_COLORS[idx % DEFAULT_CHART_COLORS.length];
|
|
5416
|
+
return /* @__PURE__ */ import_react56.default.createElement(
|
|
5417
|
+
"tr",
|
|
5418
|
+
{
|
|
5419
|
+
key: `pl-side-table-item-${idx}`,
|
|
5420
|
+
className: (0, import_classnames24.default)(
|
|
5421
|
+
"Layer__profit-and-loss-detailed-table__row",
|
|
5422
|
+
hoveredItem && hoveredItem !== item.display_name ? "inactive" : ""
|
|
5423
|
+
),
|
|
5424
|
+
onMouseEnter: () => setHoveredItem(item.display_name),
|
|
5425
|
+
onMouseLeave: () => setHoveredItem(void 0)
|
|
5426
|
+
},
|
|
5427
|
+
/* @__PURE__ */ import_react56.default.createElement("td", { className: "category-col" }, item.display_name),
|
|
5428
|
+
/* @__PURE__ */ import_react56.default.createElement("td", { className: "type-col" }, item.type),
|
|
5429
|
+
/* @__PURE__ */ import_react56.default.createElement("td", { className: "value-col" }, "$", centsToDollars(item.value)),
|
|
5430
|
+
/* @__PURE__ */ import_react56.default.createElement("td", { className: "share-col" }, /* @__PURE__ */ import_react56.default.createElement("span", { className: "share-cell-content" }, formatPercent(item.share), "%", /* @__PURE__ */ import_react56.default.createElement(
|
|
5431
|
+
"div",
|
|
5432
|
+
{
|
|
5433
|
+
className: "share-icon",
|
|
5434
|
+
style: {
|
|
5435
|
+
background: colorConfig.color,
|
|
5436
|
+
opacity: colorConfig.opacity
|
|
5437
|
+
}
|
|
5438
|
+
}
|
|
5439
|
+
)))
|
|
5440
|
+
);
|
|
5441
|
+
}))))))
|
|
5442
|
+
);
|
|
5443
|
+
};
|
|
5444
|
+
|
|
5445
|
+
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
5446
|
+
var COMPONENT_NAME3 = "profit-and-loss";
|
|
5447
|
+
var ProfitAndLossView = (props) => {
|
|
5448
|
+
return /* @__PURE__ */ import_react57.default.createElement(Container, { name: COMPONENT_NAME3 }, /* @__PURE__ */ import_react57.default.createElement(ProfitAndLoss, null, /* @__PURE__ */ import_react57.default.createElement("div", { className: `Layer__${COMPONENT_NAME3}__main-panel` }, /* @__PURE__ */ import_react57.default.createElement(Header, { className: `Layer__${COMPONENT_NAME3}__header` }, /* @__PURE__ */ import_react57.default.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Profit & Loss")), /* @__PURE__ */ import_react57.default.createElement(Components, { ...props })), props.showDetailedCharts !== false && /* @__PURE__ */ import_react57.default.createElement(ProfitAndLossDetailedCharts, null)));
|
|
4243
5449
|
};
|
|
4244
|
-
var Components = (
|
|
4245
|
-
|
|
5450
|
+
var Components = ({
|
|
5451
|
+
hideChart = false,
|
|
5452
|
+
hideTable = false
|
|
5453
|
+
}) => {
|
|
5454
|
+
const { error, isLoading, isValidating, refetch } = (0, import_react57.useContext)(
|
|
4246
5455
|
ProfitAndLoss.Context
|
|
4247
5456
|
);
|
|
4248
5457
|
if (!isLoading && error) {
|
|
4249
|
-
return /* @__PURE__ */
|
|
5458
|
+
return /* @__PURE__ */ import_react57.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react57.default.createElement(
|
|
4250
5459
|
DataState,
|
|
4251
5460
|
{
|
|
4252
5461
|
status: "failed" /* failed */,
|
|
@@ -4257,25 +5466,25 @@ var Components = () => {
|
|
|
4257
5466
|
}
|
|
4258
5467
|
));
|
|
4259
5468
|
}
|
|
4260
|
-
return /* @__PURE__ */
|
|
5469
|
+
return /* @__PURE__ */ import_react57.default.createElement(import_react57.default.Fragment, null, !hideChart && /* @__PURE__ */ import_react57.default.createElement("div", { className: `Layer__${COMPONENT_NAME3}__chart_with_summaries` }, /* @__PURE__ */ import_react57.default.createElement(
|
|
4261
5470
|
"div",
|
|
4262
5471
|
{
|
|
4263
|
-
className: `Layer__${
|
|
5472
|
+
className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__summary-col`
|
|
4264
5473
|
},
|
|
4265
|
-
/* @__PURE__ */
|
|
4266
|
-
/* @__PURE__ */
|
|
4267
|
-
), /* @__PURE__ */
|
|
5474
|
+
/* @__PURE__ */ import_react57.default.createElement(ProfitAndLoss.DatePicker, null),
|
|
5475
|
+
/* @__PURE__ */ import_react57.default.createElement(ProfitAndLoss.Summaries, { vertical: true })
|
|
5476
|
+
), /* @__PURE__ */ import_react57.default.createElement(
|
|
4268
5477
|
"div",
|
|
4269
5478
|
{
|
|
4270
|
-
className: `Layer__${
|
|
5479
|
+
className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__chart-col`
|
|
4271
5480
|
},
|
|
4272
|
-
/* @__PURE__ */
|
|
4273
|
-
)), /* @__PURE__ */
|
|
5481
|
+
/* @__PURE__ */ import_react57.default.createElement(ProfitAndLoss.Chart, null)
|
|
5482
|
+
)), !hideTable && /* @__PURE__ */ import_react57.default.createElement(ProfitAndLoss.Table, null));
|
|
4274
5483
|
};
|
|
4275
5484
|
|
|
4276
5485
|
// src/providers/LayerProvider/LayerProvider.tsx
|
|
4277
|
-
var
|
|
4278
|
-
var
|
|
5486
|
+
var import_react58 = __toESM(require("react"));
|
|
5487
|
+
var import_date_fns15 = require("date-fns");
|
|
4279
5488
|
var import_swr5 = __toESM(require("swr"));
|
|
4280
5489
|
var reducer = (state, action) => {
|
|
4281
5490
|
switch (action.type) {
|
|
@@ -4316,7 +5525,7 @@ var LayerProvider = ({
|
|
|
4316
5525
|
};
|
|
4317
5526
|
const colors = buildColorsPalette(theme);
|
|
4318
5527
|
const { url, scope, apiUrl } = LayerEnvironment[environment];
|
|
4319
|
-
const [state, dispatch] = (0,
|
|
5528
|
+
const [state, dispatch] = (0, import_react58.useReducer)(reducer, {
|
|
4320
5529
|
auth: {
|
|
4321
5530
|
access_token: "",
|
|
4322
5531
|
token_type: "",
|
|
@@ -4330,7 +5539,7 @@ var LayerProvider = ({
|
|
|
4330
5539
|
colors
|
|
4331
5540
|
});
|
|
4332
5541
|
const { data: auth } = appId !== void 0 && appSecret !== void 0 ? (0, import_swr5.default)(
|
|
4333
|
-
businessAccessToken === void 0 && appId !== void 0 && appSecret !== void 0 && (0,
|
|
5542
|
+
businessAccessToken === void 0 && appId !== void 0 && appSecret !== void 0 && (0, import_date_fns15.isBefore)(state.auth.expires_at, /* @__PURE__ */ new Date()) && "authenticate",
|
|
4334
5543
|
Layer.authenticate({
|
|
4335
5544
|
appId,
|
|
4336
5545
|
appSecret,
|
|
@@ -4339,7 +5548,7 @@ var LayerProvider = ({
|
|
|
4339
5548
|
}),
|
|
4340
5549
|
defaultSWRConfig
|
|
4341
5550
|
) : { data: void 0 };
|
|
4342
|
-
(0,
|
|
5551
|
+
(0, import_react58.useEffect)(() => {
|
|
4343
5552
|
if (businessAccessToken) {
|
|
4344
5553
|
dispatch({
|
|
4345
5554
|
type: "LayerContext.setAuth" /* setAuth */,
|
|
@@ -4348,7 +5557,7 @@ var LayerProvider = ({
|
|
|
4348
5557
|
access_token: businessAccessToken,
|
|
4349
5558
|
token_type: "Bearer",
|
|
4350
5559
|
expires_in: 3600,
|
|
4351
|
-
expires_at: (0,
|
|
5560
|
+
expires_at: (0, import_date_fns15.add)(/* @__PURE__ */ new Date(), { seconds: 3600 })
|
|
4352
5561
|
}
|
|
4353
5562
|
}
|
|
4354
5563
|
});
|
|
@@ -4358,7 +5567,7 @@ var LayerProvider = ({
|
|
|
4358
5567
|
payload: {
|
|
4359
5568
|
auth: {
|
|
4360
5569
|
...auth,
|
|
4361
|
-
expires_at: (0,
|
|
5570
|
+
expires_at: (0, import_date_fns15.add)(/* @__PURE__ */ new Date(), { seconds: auth.expires_in })
|
|
4362
5571
|
}
|
|
4363
5572
|
}
|
|
4364
5573
|
});
|
|
@@ -4389,11 +5598,11 @@ var LayerProvider = ({
|
|
|
4389
5598
|
}
|
|
4390
5599
|
return;
|
|
4391
5600
|
};
|
|
4392
|
-
return /* @__PURE__ */
|
|
5601
|
+
return /* @__PURE__ */ import_react58.default.createElement(import_swr5.SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ import_react58.default.createElement(LayerContext.Provider, { value: { ...state, setTheme, getColor } }, children));
|
|
4393
5602
|
};
|
|
4394
5603
|
|
|
4395
5604
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
4396
|
-
var
|
|
5605
|
+
var import_react61 = __toESM(require("react"));
|
|
4397
5606
|
|
|
4398
5607
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
4399
5608
|
var import_swr6 = __toESM(require("swr"));
|
|
@@ -4413,21 +5622,21 @@ var useChartOfAccounts = () => {
|
|
|
4413
5622
|
};
|
|
4414
5623
|
|
|
4415
5624
|
// src/components/ChartOfAccountsNewForm/ChartOfAccountsNewForm.tsx
|
|
4416
|
-
var
|
|
4417
|
-
var
|
|
5625
|
+
var import_react59 = __toESM(require("react"));
|
|
5626
|
+
var import_react_select4 = __toESM(require("react-select"));
|
|
4418
5627
|
var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.subAccounts || [])]).flat().filter((id) => id);
|
|
4419
5628
|
var ChartOfAccountsNewForm = () => {
|
|
4420
5629
|
const { data, create: createAccount2 } = useChartOfAccounts();
|
|
4421
|
-
const accountOptions = (0,
|
|
5630
|
+
const accountOptions = (0, import_react59.useMemo)(
|
|
4422
5631
|
() => flattenAccounts(data?.accounts || []).sort(
|
|
4423
5632
|
(a, b) => a?.name && b?.name ? a.name.localeCompare(b.name) : 0
|
|
4424
5633
|
),
|
|
4425
5634
|
[data?.accounts?.length]
|
|
4426
5635
|
);
|
|
4427
|
-
const [name, setName] = (0,
|
|
4428
|
-
const [description, setDescription] = (0,
|
|
4429
|
-
const [normality, setNormality] = (0,
|
|
4430
|
-
const [parentAccount, setParentAccount] = (0,
|
|
5636
|
+
const [name, setName] = (0, import_react59.useState)("");
|
|
5637
|
+
const [description, setDescription] = (0, import_react59.useState)("");
|
|
5638
|
+
const [normality, setNormality] = (0, import_react59.useState)("DEBIT" /* DEBIT */);
|
|
5639
|
+
const [parentAccount, setParentAccount] = (0, import_react59.useState)(
|
|
4431
5640
|
data?.accounts[0]
|
|
4432
5641
|
);
|
|
4433
5642
|
const save = () => {
|
|
@@ -4441,22 +5650,22 @@ var ChartOfAccountsNewForm = () => {
|
|
|
4441
5650
|
description
|
|
4442
5651
|
});
|
|
4443
5652
|
};
|
|
4444
|
-
return /* @__PURE__ */
|
|
5653
|
+
return /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__chart-of-accounts-new-form" }, /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ import_react59.default.createElement("span", null, "Name"), /* @__PURE__ */ import_react59.default.createElement(
|
|
4445
5654
|
"input",
|
|
4446
5655
|
{
|
|
4447
5656
|
name: "name",
|
|
4448
5657
|
value: name,
|
|
4449
5658
|
onChange: (event) => setName(event.target.value)
|
|
4450
5659
|
}
|
|
4451
|
-
)), /* @__PURE__ */
|
|
5660
|
+
)), /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ import_react59.default.createElement("span", null, "Description"), /* @__PURE__ */ import_react59.default.createElement(
|
|
4452
5661
|
"input",
|
|
4453
5662
|
{
|
|
4454
5663
|
name: "description",
|
|
4455
5664
|
value: description,
|
|
4456
5665
|
onChange: (event) => setDescription(event.target.value)
|
|
4457
5666
|
}
|
|
4458
|
-
)), /* @__PURE__ */
|
|
4459
|
-
|
|
5667
|
+
)), /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ import_react59.default.createElement("span", null, "Normality"), /* @__PURE__ */ import_react59.default.createElement(
|
|
5668
|
+
import_react_select4.default,
|
|
4460
5669
|
{
|
|
4461
5670
|
isSearchable: false,
|
|
4462
5671
|
onChange: (value) => value && setNormality(value.value),
|
|
@@ -4465,8 +5674,8 @@ var ChartOfAccountsNewForm = () => {
|
|
|
4465
5674
|
{ label: "Debit", value: "DEBIT" /* DEBIT */ }
|
|
4466
5675
|
]
|
|
4467
5676
|
}
|
|
4468
|
-
)), /* @__PURE__ */
|
|
4469
|
-
|
|
5677
|
+
)), /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ import_react59.default.createElement("span", null, "Parent Account"), /* @__PURE__ */ import_react59.default.createElement(
|
|
5678
|
+
import_react_select4.default,
|
|
4470
5679
|
{
|
|
4471
5680
|
isSearchable: true,
|
|
4472
5681
|
value: parentAccount,
|
|
@@ -4475,49 +5684,49 @@ var ChartOfAccountsNewForm = () => {
|
|
|
4475
5684
|
getOptionValue: (a) => a.id,
|
|
4476
5685
|
options: accountOptions
|
|
4477
5686
|
}
|
|
4478
|
-
)), /* @__PURE__ */
|
|
5687
|
+
)), /* @__PURE__ */ import_react59.default.createElement("div", { className: "Layer__chart-of-accounts-new-form__field Layer__chart-of-accounts-new-form__field--actions" }, /* @__PURE__ */ import_react59.default.createElement("button", { onClick: save }, "Save")));
|
|
4479
5688
|
};
|
|
4480
5689
|
|
|
4481
5690
|
// src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
|
|
4482
|
-
var
|
|
5691
|
+
var import_react60 = __toESM(require("react"));
|
|
4483
5692
|
var ChartOfAccountsRow = ({ account, depth = 0 }) => {
|
|
4484
|
-
const
|
|
5693
|
+
const classNames24 = [
|
|
4485
5694
|
"Layer__chart-of-accounts-row__table-cell",
|
|
4486
5695
|
depth > 0 && `Layer__chart-of-accounts-row__table-cell--depth-${depth}`
|
|
4487
5696
|
];
|
|
4488
|
-
const className =
|
|
5697
|
+
const className = classNames24.filter((id) => id).join(" ");
|
|
4489
5698
|
const amountClassName = account.balance < 0 ? "Layer__chart-of-accounts-row__table-cell--amount-negative" : "Layer__chart-of-accounts-row__table-cell--amount-positive";
|
|
4490
|
-
return /* @__PURE__ */
|
|
5699
|
+
return /* @__PURE__ */ import_react60.default.createElement(import_react60.default.Fragment, null, /* @__PURE__ */ import_react60.default.createElement(
|
|
4491
5700
|
"div",
|
|
4492
5701
|
{
|
|
4493
5702
|
className: `${className} Layer__chart-of-accounts-row__table-cell--name`
|
|
4494
5703
|
},
|
|
4495
5704
|
account.name
|
|
4496
|
-
), /* @__PURE__ */
|
|
5705
|
+
), /* @__PURE__ */ import_react60.default.createElement(
|
|
4497
5706
|
"div",
|
|
4498
5707
|
{
|
|
4499
5708
|
className: `${className} Layer__chart-of-accounts-row__table-cell--type`
|
|
4500
5709
|
},
|
|
4501
5710
|
"Assets"
|
|
4502
|
-
), /* @__PURE__ */
|
|
5711
|
+
), /* @__PURE__ */ import_react60.default.createElement(
|
|
4503
5712
|
"div",
|
|
4504
5713
|
{
|
|
4505
5714
|
className: `${className} Layer__chart-of-accounts-row__table-cell--subtype`
|
|
4506
5715
|
},
|
|
4507
5716
|
"Cash"
|
|
4508
|
-
), /* @__PURE__ */
|
|
5717
|
+
), /* @__PURE__ */ import_react60.default.createElement(
|
|
4509
5718
|
"div",
|
|
4510
5719
|
{
|
|
4511
5720
|
className: `${className} Layer__chart-of-accounts-row__table-cell--balance ${amountClassName}`
|
|
4512
5721
|
},
|
|
4513
5722
|
centsToDollars(Math.abs(account.balance || 0))
|
|
4514
|
-
), /* @__PURE__ */
|
|
5723
|
+
), /* @__PURE__ */ import_react60.default.createElement(
|
|
4515
5724
|
"div",
|
|
4516
5725
|
{
|
|
4517
5726
|
className: `${className} Layer__chart-of-accounts-row__table-cell--actions`
|
|
4518
5727
|
},
|
|
4519
|
-
/* @__PURE__ */
|
|
4520
|
-
), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */
|
|
5728
|
+
/* @__PURE__ */ import_react60.default.createElement("button", { className: "Layer__chart-of-accounts-row__view-entries-button" }, "View Entries")
|
|
5729
|
+
), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */ import_react60.default.createElement(
|
|
4521
5730
|
ChartOfAccountsRow,
|
|
4522
5731
|
{
|
|
4523
5732
|
key: subAccount.id,
|
|
@@ -4530,15 +5739,15 @@ var ChartOfAccountsRow = ({ account, depth = 0 }) => {
|
|
|
4530
5739
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
4531
5740
|
var ChartOfAccounts = () => {
|
|
4532
5741
|
const { data, isLoading } = useChartOfAccounts();
|
|
4533
|
-
const [showingForm, setShowingForm] = (0,
|
|
4534
|
-
return /* @__PURE__ */
|
|
5742
|
+
const [showingForm, setShowingForm] = (0, import_react61.useState)(false);
|
|
5743
|
+
return /* @__PURE__ */ import_react61.default.createElement("div", { className: "Layer__component Layer__chart-of-accounts" }, !data || isLoading ? "Loading." : /* @__PURE__ */ import_react61.default.createElement(import_react61.default.Fragment, null, /* @__PURE__ */ import_react61.default.createElement("div", { className: "Layer__chart-of-accounts__header" }, /* @__PURE__ */ import_react61.default.createElement("h2", { className: "Layer__chart-of-accounts__title" }, "Chart of Accounts"), /* @__PURE__ */ import_react61.default.createElement("div", { className: "Layer__chart-of-accounts__actions" }, /* @__PURE__ */ import_react61.default.createElement("button", { className: "Layer__chart-of-accounts__download-button" }, /* @__PURE__ */ import_react61.default.createElement(DownloadCloud_default, null), "Download"), /* @__PURE__ */ import_react61.default.createElement(
|
|
4535
5744
|
"button",
|
|
4536
5745
|
{
|
|
4537
5746
|
className: "Layer__chart-of-accounts__edit-accounts-button",
|
|
4538
5747
|
onClick: () => setShowingForm(!showingForm)
|
|
4539
5748
|
},
|
|
4540
5749
|
"Edit Accounts"
|
|
4541
|
-
))), showingForm && /* @__PURE__ */
|
|
5750
|
+
))), showingForm && /* @__PURE__ */ import_react61.default.createElement(ChartOfAccountsNewForm, null), /* @__PURE__ */ import_react61.default.createElement("div", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ import_react61.default.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Name"), /* @__PURE__ */ import_react61.default.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Type"), /* @__PURE__ */ import_react61.default.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Sub-Type"), /* @__PURE__ */ import_react61.default.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__ */ import_react61.default.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }), data.accounts.map((account) => /* @__PURE__ */ import_react61.default.createElement(
|
|
4542
5751
|
ChartOfAccountsRow,
|
|
4543
5752
|
{
|
|
4544
5753
|
key: account.id,
|
|
@@ -4554,6 +5763,7 @@ var ChartOfAccounts = () => {
|
|
|
4554
5763
|
ChartOfAccounts,
|
|
4555
5764
|
Hello,
|
|
4556
5765
|
LayerProvider,
|
|
5766
|
+
LinkedAccounts,
|
|
4557
5767
|
ProfitAndLoss,
|
|
4558
5768
|
ProfitAndLossView
|
|
4559
5769
|
});
|