@layerfi/components 0.1.5 → 0.1.6
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 +1277 -713
- package/dist/esm/index.js.map +4 -4
- package/dist/index.d.ts +123 -22
- package/dist/index.js +1332 -767
- package/dist/index.js.map +4 -4
- package/dist/styles/index.css +655 -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,21 +1497,45 @@ 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
|
|
|
1512
|
+
// src/icons/Check.tsx
|
|
1513
|
+
var React23 = __toESM(require("react"));
|
|
1514
|
+
var Check = ({ size = 18, ...props }) => /* @__PURE__ */ React23.createElement(
|
|
1515
|
+
"svg",
|
|
1516
|
+
{
|
|
1517
|
+
viewBox: "0 0 18 18",
|
|
1518
|
+
fill: "none",
|
|
1519
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1520
|
+
...props,
|
|
1521
|
+
width: size,
|
|
1522
|
+
height: size
|
|
1523
|
+
},
|
|
1524
|
+
/* @__PURE__ */ React23.createElement(
|
|
1525
|
+
"path",
|
|
1526
|
+
{
|
|
1527
|
+
d: "M15 4.5L6.75 12.75L3 9",
|
|
1528
|
+
stroke: "currentColor",
|
|
1529
|
+
strokeLinecap: "round",
|
|
1530
|
+
strokeLinejoin: "round"
|
|
1531
|
+
}
|
|
1532
|
+
)
|
|
1533
|
+
);
|
|
1534
|
+
var Check_default = Check;
|
|
1535
|
+
|
|
1458
1536
|
// src/icons/MinimizeTwo.tsx
|
|
1459
|
-
var
|
|
1460
|
-
var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */
|
|
1537
|
+
var React24 = __toESM(require("react"));
|
|
1538
|
+
var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React24.createElement(
|
|
1461
1539
|
"svg",
|
|
1462
1540
|
{
|
|
1463
1541
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -1467,7 +1545,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
1467
1545
|
width: size,
|
|
1468
1546
|
height: size
|
|
1469
1547
|
},
|
|
1470
|
-
/* @__PURE__ */
|
|
1548
|
+
/* @__PURE__ */ React24.createElement(
|
|
1471
1549
|
"path",
|
|
1472
1550
|
{
|
|
1473
1551
|
d: "M3 10.5H7.5V15",
|
|
@@ -1476,7 +1554,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
1476
1554
|
strokeLinejoin: "round"
|
|
1477
1555
|
}
|
|
1478
1556
|
),
|
|
1479
|
-
/* @__PURE__ */
|
|
1557
|
+
/* @__PURE__ */ React24.createElement(
|
|
1480
1558
|
"path",
|
|
1481
1559
|
{
|
|
1482
1560
|
d: "M15 7.5H10.5V3",
|
|
@@ -1485,7 +1563,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
1485
1563
|
strokeLinejoin: "round"
|
|
1486
1564
|
}
|
|
1487
1565
|
),
|
|
1488
|
-
/* @__PURE__ */
|
|
1566
|
+
/* @__PURE__ */ React24.createElement(
|
|
1489
1567
|
"path",
|
|
1490
1568
|
{
|
|
1491
1569
|
d: "M10.5 7.5L15.75 2.25",
|
|
@@ -1494,7 +1572,7 @@ var MinimizeTwo = ({ size = 18, ...props }) => /* @__PURE__ */ React22.createEle
|
|
|
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,
|
|
@@ -1677,15 +1755,76 @@ var CategorySelect = ({
|
|
|
1677
1755
|
isDisabled: disabled,
|
|
1678
1756
|
isOptionDisabled: (option) => option.disabled ?? false
|
|
1679
1757
|
}
|
|
1680
|
-
);
|
|
1681
|
-
};
|
|
1682
|
-
|
|
1683
|
-
// src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
|
|
1684
|
-
var
|
|
1758
|
+
);
|
|
1759
|
+
};
|
|
1760
|
+
|
|
1761
|
+
// src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
|
|
1762
|
+
var import_react31 = __toESM(require("react"));
|
|
1763
|
+
|
|
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;
|
|
1685
1824
|
|
|
1686
|
-
// src/icons/
|
|
1687
|
-
var
|
|
1688
|
-
var
|
|
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,113 +3873,150 @@ 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",
|
|
3951
|
+
{
|
|
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,
|
|
3475
3988
|
{
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
selected: display,
|
|
3482
|
-
onChange: onCategorizationDisplayChange
|
|
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
|
-
|
|
3511
|
-
{
|
|
3512
|
-
status: "allDone" /* allDone */,
|
|
3513
|
-
title: "You are up to date with transactions!",
|
|
3514
|
-
description: "All uncategorized transaction will be displayed here",
|
|
3515
|
-
onRefresh: () => refetch(),
|
|
3516
|
-
isLoading: isValidating
|
|
3517
|
-
}
|
|
3518
|
-
)) : null, !isLoading && error ? /* @__PURE__ */ import_react39.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react39.default.createElement(
|
|
3519
|
-
DataState,
|
|
3520
|
-
{
|
|
3521
|
-
status: "failed" /* failed */,
|
|
3522
|
-
title: "Something went wrong",
|
|
3523
|
-
description: "We couldn\u2019t load your data.",
|
|
3524
|
-
onRefresh: () => refetch(),
|
|
3525
|
-
isLoading: isValidating
|
|
3526
|
-
}
|
|
3527
|
-
)) : null, /* @__PURE__ */ import_react39.default.createElement("div", { className: "Layer__bank-transactions__pagination" }, /* @__PURE__ */ import_react39.default.createElement(
|
|
3528
|
-
Pagination,
|
|
3529
|
-
{
|
|
3530
|
-
currentPage,
|
|
3531
|
-
totalCount: bankTransactionsByFilter?.length || 0,
|
|
3532
|
-
pageSize,
|
|
3533
|
-
onPageChange: (page) => setCurrentPage(page)
|
|
3534
|
-
}
|
|
3535
|
-
)));
|
|
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
|
+
);
|
|
3536
4016
|
};
|
|
3537
4017
|
|
|
3538
4018
|
// src/components/Hello/Hello.tsx
|
|
3539
|
-
var
|
|
4019
|
+
var import_react43 = __toESM(require("react"));
|
|
3540
4020
|
var import_swr3 = __toESM(require("swr"));
|
|
3541
4021
|
var fetcher = (url) => fetch(url).then((res) => res.json());
|
|
3542
4022
|
var Hello = ({ user }) => {
|
|
@@ -3545,14 +4025,93 @@ var Hello = ({ user }) => {
|
|
|
3545
4025
|
fetcher
|
|
3546
4026
|
);
|
|
3547
4027
|
const name = (isLoading ? "..." : data?.name) || "User";
|
|
3548
|
-
return /* @__PURE__ */
|
|
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: 4400020620
|
|
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,
|
|
4093
|
+
{
|
|
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(
|
|
4099
|
+
DataState,
|
|
4100
|
+
{
|
|
4101
|
+
status: "failed" /* failed */,
|
|
4102
|
+
title: "Something went wrong",
|
|
4103
|
+
description: "We couldn\u2019t load your data.",
|
|
4104
|
+
onRefresh: () => refetch(),
|
|
4105
|
+
isLoading: isValidating
|
|
4106
|
+
}
|
|
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);
|
|
3549
4108
|
};
|
|
3550
4109
|
|
|
3551
4110
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
3552
|
-
var
|
|
4111
|
+
var import_react55 = __toESM(require("react"));
|
|
3553
4112
|
|
|
3554
4113
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
3555
|
-
var
|
|
4114
|
+
var import_react47 = require("react");
|
|
3556
4115
|
var import_date_fns10 = require("date-fns");
|
|
3557
4116
|
var import_swr4 = __toESM(require("swr"));
|
|
3558
4117
|
var useProfitAndLoss = ({
|
|
@@ -3565,10 +4124,10 @@ var useProfitAndLoss = ({
|
|
|
3565
4124
|
endDate: (0, import_date_fns10.endOfMonth)(/* @__PURE__ */ new Date())
|
|
3566
4125
|
}) => {
|
|
3567
4126
|
const { auth, businessId, apiUrl } = useLayerContext();
|
|
3568
|
-
const [startDate, setStartDate] = (0,
|
|
4127
|
+
const [startDate, setStartDate] = (0, import_react47.useState)(
|
|
3569
4128
|
initialStartDate || (0, import_date_fns10.startOfMonth)(Date.now())
|
|
3570
4129
|
);
|
|
3571
|
-
const [endDate, setEndDate] = (0,
|
|
4130
|
+
const [endDate, setEndDate] = (0, import_react47.useState)(
|
|
3572
4131
|
initialEndDate || (0, import_date_fns10.endOfMonth)(Date.now())
|
|
3573
4132
|
);
|
|
3574
4133
|
const {
|
|
@@ -3615,13 +4174,13 @@ var useProfitAndLoss = ({
|
|
|
3615
4174
|
};
|
|
3616
4175
|
|
|
3617
4176
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
3618
|
-
var
|
|
4177
|
+
var import_react49 = __toESM(require("react"));
|
|
3619
4178
|
|
|
3620
4179
|
// src/utils/format.ts
|
|
3621
4180
|
var capitalizeFirstLetter = (text) => text.charAt(0).toUpperCase() + text.slice(1);
|
|
3622
4181
|
|
|
3623
4182
|
// src/components/ProfitAndLossChart/Indicator.tsx
|
|
3624
|
-
var
|
|
4183
|
+
var import_react48 = __toESM(require("react"));
|
|
3625
4184
|
var emptyViewBox = { x: 0, y: 0, width: 0, height: 0 };
|
|
3626
4185
|
var Indicator = ({
|
|
3627
4186
|
viewBox = {},
|
|
@@ -3636,11 +4195,11 @@ var Indicator = ({
|
|
|
3636
4195
|
const boxWidth = width * 2 + 4;
|
|
3637
4196
|
const multiplier = 1.5;
|
|
3638
4197
|
const xOffset = (boxWidth * multiplier - boxWidth) / 2;
|
|
3639
|
-
(0,
|
|
4198
|
+
(0, import_react48.useEffect)(() => {
|
|
3640
4199
|
setAnimateFrom(animateTo);
|
|
3641
4200
|
}, [animateTo]);
|
|
3642
4201
|
const actualX = animateFrom === -1 ? animateTo : animateFrom;
|
|
3643
|
-
return /* @__PURE__ */
|
|
4202
|
+
return /* @__PURE__ */ import_react48.default.createElement(
|
|
3644
4203
|
"rect",
|
|
3645
4204
|
{
|
|
3646
4205
|
className: "Layer__profit-and-loss-chart__selection-indicator",
|
|
@@ -3650,9 +4209,9 @@ var Indicator = ({
|
|
|
3650
4209
|
width: `${boxWidth * multiplier}px`,
|
|
3651
4210
|
// @ts-expect-error -- y is fine but x apparently isn't!
|
|
3652
4211
|
x: actualX - xOffset,
|
|
3653
|
-
y:
|
|
4212
|
+
y: 22,
|
|
3654
4213
|
borderRadius: 8,
|
|
3655
|
-
height: "calc(100% -
|
|
4214
|
+
height: "calc(100% - 38px)"
|
|
3656
4215
|
}
|
|
3657
4216
|
}
|
|
3658
4217
|
);
|
|
@@ -3665,7 +4224,7 @@ var barGap = 4;
|
|
|
3665
4224
|
var barSize = 20;
|
|
3666
4225
|
var ProfitAndLossChart = () => {
|
|
3667
4226
|
const { getColor } = useLayerContext();
|
|
3668
|
-
const { changeDateRange, dateRange } = (0,
|
|
4227
|
+
const { changeDateRange, dateRange } = (0, import_react49.useContext)(ProfitAndLoss.Context);
|
|
3669
4228
|
const thisMonth = (0, import_date_fns11.startOfMonth)(Date.now());
|
|
3670
4229
|
const startSelectionMonth = dateRange.startDate.getMonth();
|
|
3671
4230
|
const endSelectionMonth = dateRange.endDate.getMonth();
|
|
@@ -3765,13 +4324,13 @@ var ProfitAndLossChart = () => {
|
|
|
3765
4324
|
label
|
|
3766
4325
|
}) => {
|
|
3767
4326
|
if (active && payload && payload.length) {
|
|
3768
|
-
return /* @__PURE__ */
|
|
4327
|
+
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
4328
|
}
|
|
3770
4329
|
return null;
|
|
3771
4330
|
};
|
|
3772
4331
|
const CustomizedCursor = (props) => {
|
|
3773
4332
|
const { x, y, width, height } = props;
|
|
3774
|
-
return /* @__PURE__ */
|
|
4333
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
|
3775
4334
|
import_recharts.Rectangle,
|
|
3776
4335
|
{
|
|
3777
4336
|
fill: getColor(100)?.hex ?? "#F5F4F3",
|
|
@@ -3785,7 +4344,7 @@ var ProfitAndLossChart = () => {
|
|
|
3785
4344
|
}
|
|
3786
4345
|
);
|
|
3787
4346
|
};
|
|
3788
|
-
const data = (0,
|
|
4347
|
+
const data = (0, import_react49.useMemo)(
|
|
3789
4348
|
() => monthData.map(summarizePnL),
|
|
3790
4349
|
[
|
|
3791
4350
|
startSelectionMonth,
|
|
@@ -3793,8 +4352,8 @@ var ProfitAndLossChart = () => {
|
|
|
3793
4352
|
...monthData.map((m) => m?.net_profit)
|
|
3794
4353
|
]
|
|
3795
4354
|
);
|
|
3796
|
-
const [animateFrom, setAnimateFrom] = (0,
|
|
3797
|
-
return /* @__PURE__ */
|
|
4355
|
+
const [animateFrom, setAnimateFrom] = (0, import_react49.useState)(-1);
|
|
4356
|
+
return /* @__PURE__ */ import_react49.default.createElement(
|
|
3798
4357
|
import_recharts.ResponsiveContainer,
|
|
3799
4358
|
{
|
|
3800
4359
|
className: "Layer__chart-container",
|
|
@@ -3802,7 +4361,7 @@ var ProfitAndLossChart = () => {
|
|
|
3802
4361
|
height: "100%",
|
|
3803
4362
|
minHeight: 200
|
|
3804
4363
|
},
|
|
3805
|
-
/* @__PURE__ */
|
|
4364
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3806
4365
|
import_recharts.BarChart,
|
|
3807
4366
|
{
|
|
3808
4367
|
margin: { left: 12, right: 12, bottom: 12 },
|
|
@@ -3811,15 +4370,17 @@ var ProfitAndLossChart = () => {
|
|
|
3811
4370
|
barGap,
|
|
3812
4371
|
className: "Layer__profit-and-loss-chart"
|
|
3813
4372
|
},
|
|
3814
|
-
/* @__PURE__ */
|
|
4373
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3815
4374
|
import_recharts.Tooltip,
|
|
3816
4375
|
{
|
|
3817
4376
|
wrapperClassName: "Layer__chart__tooltip-wrapper",
|
|
3818
|
-
content: /* @__PURE__ */
|
|
3819
|
-
cursor: /* @__PURE__ */
|
|
4377
|
+
content: /* @__PURE__ */ import_react49.default.createElement(CustomTooltip, null),
|
|
4378
|
+
cursor: /* @__PURE__ */ import_react49.default.createElement(CustomizedCursor, null),
|
|
4379
|
+
animationDuration: 100,
|
|
4380
|
+
animationEasing: "ease-out"
|
|
3820
4381
|
}
|
|
3821
4382
|
),
|
|
3822
|
-
/* @__PURE__ */
|
|
4383
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3823
4384
|
import_recharts.CartesianGrid,
|
|
3824
4385
|
{
|
|
3825
4386
|
vertical: false,
|
|
@@ -3827,7 +4388,7 @@ var ProfitAndLossChart = () => {
|
|
|
3827
4388
|
strokeDasharray: "5 5"
|
|
3828
4389
|
}
|
|
3829
4390
|
),
|
|
3830
|
-
/* @__PURE__ */
|
|
4391
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3831
4392
|
import_recharts.Legend,
|
|
3832
4393
|
{
|
|
3833
4394
|
verticalAlign: "top",
|
|
@@ -3847,8 +4408,8 @@ var ProfitAndLossChart = () => {
|
|
|
3847
4408
|
]
|
|
3848
4409
|
}
|
|
3849
4410
|
),
|
|
3850
|
-
/* @__PURE__ */
|
|
3851
|
-
/* @__PURE__ */
|
|
4411
|
+
/* @__PURE__ */ import_react49.default.createElement(import_recharts.XAxis, { dataKey: "name", tickLine: false }),
|
|
4412
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3852
4413
|
import_recharts.Bar,
|
|
3853
4414
|
{
|
|
3854
4415
|
dataKey: "revenue",
|
|
@@ -3857,10 +4418,10 @@ var ProfitAndLossChart = () => {
|
|
|
3857
4418
|
radius: [barSize / 4, barSize / 4, 0, 0],
|
|
3858
4419
|
className: "Layer__profit-and-loss-chart__bar--income"
|
|
3859
4420
|
},
|
|
3860
|
-
/* @__PURE__ */
|
|
4421
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3861
4422
|
import_recharts.LabelList,
|
|
3862
4423
|
{
|
|
3863
|
-
content: /* @__PURE__ */
|
|
4424
|
+
content: /* @__PURE__ */ import_react49.default.createElement(
|
|
3864
4425
|
Indicator,
|
|
3865
4426
|
{
|
|
3866
4427
|
animateFrom,
|
|
@@ -3869,7 +4430,7 @@ var ProfitAndLossChart = () => {
|
|
|
3869
4430
|
)
|
|
3870
4431
|
}
|
|
3871
4432
|
),
|
|
3872
|
-
data.map((entry) => /* @__PURE__ */
|
|
4433
|
+
data.map((entry) => /* @__PURE__ */ import_react49.default.createElement(
|
|
3873
4434
|
import_recharts.Cell,
|
|
3874
4435
|
{
|
|
3875
4436
|
key: entry.name,
|
|
@@ -3877,7 +4438,7 @@ var ProfitAndLossChart = () => {
|
|
|
3877
4438
|
}
|
|
3878
4439
|
))
|
|
3879
4440
|
),
|
|
3880
|
-
/* @__PURE__ */
|
|
4441
|
+
/* @__PURE__ */ import_react49.default.createElement(
|
|
3881
4442
|
import_recharts.Bar,
|
|
3882
4443
|
{
|
|
3883
4444
|
dataKey: "expenses",
|
|
@@ -3886,7 +4447,7 @@ var ProfitAndLossChart = () => {
|
|
|
3886
4447
|
radius: [barSize / 4, barSize / 4, 0, 0],
|
|
3887
4448
|
className: "Layer__profit-and-loss-chart__bar--expenses"
|
|
3888
4449
|
},
|
|
3889
|
-
data.map((entry) => /* @__PURE__ */
|
|
4450
|
+
data.map((entry) => /* @__PURE__ */ import_react49.default.createElement(
|
|
3890
4451
|
import_recharts.Cell,
|
|
3891
4452
|
{
|
|
3892
4453
|
key: entry.name,
|
|
@@ -3899,10 +4460,10 @@ var ProfitAndLossChart = () => {
|
|
|
3899
4460
|
};
|
|
3900
4461
|
|
|
3901
4462
|
// src/components/ProfitAndLossDatePicker/ProfitAndLossDatePicker.tsx
|
|
3902
|
-
var
|
|
4463
|
+
var import_react50 = __toESM(require("react"));
|
|
3903
4464
|
var import_date_fns12 = require("date-fns");
|
|
3904
4465
|
var ProfitAndLossDatePicker = () => {
|
|
3905
|
-
const { changeDateRange, dateRange } = (0,
|
|
4466
|
+
const { changeDateRange, dateRange } = (0, import_react50.useContext)(ProfitAndLoss.Context);
|
|
3906
4467
|
const date = dateRange.startDate;
|
|
3907
4468
|
const label = (0, import_date_fns12.format)(date, "LLLL y");
|
|
3908
4469
|
const change = (duration) => {
|
|
@@ -3914,28 +4475,28 @@ var ProfitAndLossDatePicker = () => {
|
|
|
3914
4475
|
};
|
|
3915
4476
|
const previousMonth = () => change({ months: -1 });
|
|
3916
4477
|
const nextMonth = () => change({ months: 1 });
|
|
3917
|
-
return /* @__PURE__ */
|
|
4478
|
+
return /* @__PURE__ */ import_react50.default.createElement("div", { className: "Layer__profit-and-loss-date-picker" }, /* @__PURE__ */ import_react50.default.createElement(
|
|
3918
4479
|
"button",
|
|
3919
4480
|
{
|
|
3920
4481
|
"aria-label": "View Previous Month",
|
|
3921
4482
|
className: "Layer__profit-and-loss-date-picker__button",
|
|
3922
4483
|
onClick: previousMonth
|
|
3923
4484
|
},
|
|
3924
|
-
/* @__PURE__ */
|
|
4485
|
+
/* @__PURE__ */ import_react50.default.createElement(
|
|
3925
4486
|
ChevronLeft_default,
|
|
3926
4487
|
{
|
|
3927
4488
|
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
3928
4489
|
size: 18
|
|
3929
4490
|
}
|
|
3930
4491
|
)
|
|
3931
|
-
), /* @__PURE__ */
|
|
4492
|
+
), /* @__PURE__ */ import_react50.default.createElement("span", { className: "Layer__profit-and-loss-date-picker__label" }, label), /* @__PURE__ */ import_react50.default.createElement(
|
|
3932
4493
|
"button",
|
|
3933
4494
|
{
|
|
3934
4495
|
"aria-label": "View Next Month",
|
|
3935
4496
|
className: "Layer__profit-and-loss-date-picker__button",
|
|
3936
4497
|
onClick: nextMonth
|
|
3937
4498
|
},
|
|
3938
|
-
/* @__PURE__ */
|
|
4499
|
+
/* @__PURE__ */ import_react50.default.createElement(
|
|
3939
4500
|
ChevronRight_default,
|
|
3940
4501
|
{
|
|
3941
4502
|
className: "Layer__profit-and-loss-date-picker__button-icon",
|
|
@@ -3946,21 +4507,21 @@ var ProfitAndLossDatePicker = () => {
|
|
|
3946
4507
|
};
|
|
3947
4508
|
|
|
3948
4509
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
3949
|
-
var
|
|
4510
|
+
var import_react52 = __toESM(require("react"));
|
|
3950
4511
|
|
|
3951
4512
|
// src/components/SkeletonLoader/SkeletonLoader.tsx
|
|
3952
|
-
var
|
|
3953
|
-
var
|
|
4513
|
+
var import_react51 = __toESM(require("react"));
|
|
4514
|
+
var import_classnames22 = __toESM(require("classnames"));
|
|
3954
4515
|
var SkeletonLoader = ({
|
|
3955
4516
|
height,
|
|
3956
4517
|
width,
|
|
3957
4518
|
className
|
|
3958
4519
|
}) => {
|
|
3959
|
-
const baseClassName = (0,
|
|
4520
|
+
const baseClassName = (0, import_classnames22.default)(
|
|
3960
4521
|
"Layer__skeleton-loader Layer__anim--skeleton-loading",
|
|
3961
4522
|
className
|
|
3962
4523
|
);
|
|
3963
|
-
return /* @__PURE__ */
|
|
4524
|
+
return /* @__PURE__ */ import_react51.default.createElement("div", { className: baseClassName, style: { width, height } });
|
|
3964
4525
|
};
|
|
3965
4526
|
|
|
3966
4527
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
@@ -3968,31 +4529,31 @@ var ProfitAndLossSummaries = ({
|
|
|
3968
4529
|
vertical,
|
|
3969
4530
|
revenueLabel = "Revenue"
|
|
3970
4531
|
}) => {
|
|
3971
|
-
const { data: storedData, isLoading } = (0,
|
|
4532
|
+
const { data: storedData, isLoading } = (0, import_react52.useContext)(ProfitAndLoss.Context);
|
|
3972
4533
|
const data = storedData ? storedData : { income: { value: NaN }, net_profit: NaN };
|
|
3973
4534
|
const incomeDirectionClass = (data.income.value ?? NaN) < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
|
|
3974
4535
|
const expensesDirectionClass = (data?.income?.value ?? NaN) - data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
|
|
3975
4536
|
const netProfitDirectionClass = data.net_profit < 0 ? "Layer__profit-and-loss-summaries__amount--negative" : "Layer__profit-and-loss-summaries__amount--pasitive";
|
|
3976
|
-
return /* @__PURE__ */
|
|
4537
|
+
return /* @__PURE__ */ import_react52.default.createElement(
|
|
3977
4538
|
"div",
|
|
3978
4539
|
{
|
|
3979
4540
|
className: `Layer__profit-and-loss-summaries ${vertical ? "flex-col" : ""}`
|
|
3980
4541
|
},
|
|
3981
|
-
/* @__PURE__ */
|
|
4542
|
+
/* @__PURE__ */ import_react52.default.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--income" }, /* @__PURE__ */ import_react52.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, revenueLabel), 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(
|
|
3982
4543
|
"span",
|
|
3983
4544
|
{
|
|
3984
4545
|
className: `Layer__profit-and-loss-summaries__amount ${incomeDirectionClass}`
|
|
3985
4546
|
},
|
|
3986
4547
|
centsToDollars(Math.abs(data?.income?.value ?? NaN))
|
|
3987
4548
|
)),
|
|
3988
|
-
/* @__PURE__ */
|
|
4549
|
+
/* @__PURE__ */ import_react52.default.createElement("div", { className: "Layer__profit-and-loss-summaries__summary Layer__profit-and-loss-summaries__summary--expenses" }, /* @__PURE__ */ import_react52.default.createElement("span", { className: "Layer__profit-and-loss-summaries__title" }, "Expenses"), 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(
|
|
3989
4550
|
"span",
|
|
3990
4551
|
{
|
|
3991
4552
|
className: `Layer__profit-and-loss-summaries__amount ${expensesDirectionClass}`
|
|
3992
4553
|
},
|
|
3993
4554
|
centsToDollars(Math.abs((data.income.value ?? 0) - data.net_profit))
|
|
3994
4555
|
)),
|
|
3995
|
-
/* @__PURE__ */
|
|
4556
|
+
/* @__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
4557
|
"span",
|
|
3997
4558
|
{
|
|
3998
4559
|
className: `Layer__profit-and-loss-summaries__amount ${netProfitDirectionClass}`
|
|
@@ -4003,10 +4564,10 @@ var ProfitAndLossSummaries = ({
|
|
|
4003
4564
|
};
|
|
4004
4565
|
|
|
4005
4566
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
4006
|
-
var
|
|
4567
|
+
var import_react54 = __toESM(require("react"));
|
|
4007
4568
|
|
|
4008
4569
|
// src/components/ProfitAndLossRow/ProfitAndLossRow.tsx
|
|
4009
|
-
var
|
|
4570
|
+
var import_react53 = __toESM(require("react"));
|
|
4010
4571
|
var ProfitAndLossRow = ({
|
|
4011
4572
|
variant,
|
|
4012
4573
|
lineItem,
|
|
@@ -4019,7 +4580,7 @@ var ProfitAndLossRow = ({
|
|
|
4019
4580
|
return null;
|
|
4020
4581
|
}
|
|
4021
4582
|
const { value, display_name, line_items } = lineItem;
|
|
4022
|
-
const [expanded, setExpanded] = (0,
|
|
4583
|
+
const [expanded, setExpanded] = (0, import_react53.useState)(true);
|
|
4023
4584
|
const amount = value ?? 0;
|
|
4024
4585
|
const amountString = centsToDollars(Math.abs(amount));
|
|
4025
4586
|
const labelClasses = [
|
|
@@ -4050,20 +4611,20 @@ var ProfitAndLossRow = ({
|
|
|
4050
4611
|
);
|
|
4051
4612
|
displayChildren && expanded && labelClasses.push("Layer__profit-and-loss-row__label--expanded");
|
|
4052
4613
|
displayChildren && expanded && valueClasses.push("Layer__profit-and-loss-row__value--expanded");
|
|
4053
|
-
return /* @__PURE__ */
|
|
4614
|
+
return /* @__PURE__ */ import_react53.default.createElement(import_react53.default.Fragment, null, /* @__PURE__ */ import_react53.default.createElement(
|
|
4054
4615
|
"div",
|
|
4055
4616
|
{
|
|
4056
4617
|
className: labelClasses.join(" "),
|
|
4057
4618
|
onClick: () => !lockExpanded && toggleExpanded()
|
|
4058
4619
|
},
|
|
4059
|
-
!lockExpanded && /* @__PURE__ */
|
|
4060
|
-
/* @__PURE__ */
|
|
4061
|
-
), /* @__PURE__ */
|
|
4620
|
+
!lockExpanded && variant !== "summation" ? /* @__PURE__ */ import_react53.default.createElement(ChevronDownFill_default, { size: 16 }) : null,
|
|
4621
|
+
/* @__PURE__ */ import_react53.default.createElement(Text, null, display_name)
|
|
4622
|
+
), /* @__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
4623
|
"div",
|
|
4063
4624
|
{
|
|
4064
4625
|
className: `Layer__profit-and-loss-row__children ${expanded && "Layer__profit-and-loss-row__children--expanded"}`
|
|
4065
4626
|
},
|
|
4066
|
-
/* @__PURE__ */
|
|
4627
|
+
/* @__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
4628
|
ProfitAndLossRow,
|
|
4068
4629
|
{
|
|
4069
4630
|
key: line_item.display_name,
|
|
@@ -4126,26 +4687,26 @@ var empty_profit_and_loss_report_default = {
|
|
|
4126
4687
|
|
|
4127
4688
|
// src/components/ProfitAndLossTable/ProfitAndLossTable.tsx
|
|
4128
4689
|
var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
4129
|
-
const { data: actualData, isLoading } = (0,
|
|
4690
|
+
const { data: actualData, isLoading } = (0, import_react54.useContext)(ProfitAndLoss.Context);
|
|
4130
4691
|
const data = !actualData || isLoading ? empty_profit_and_loss_report_default : actualData;
|
|
4131
4692
|
if (isLoading || actualData === void 0) {
|
|
4132
|
-
return /* @__PURE__ */
|
|
4693
|
+
return /* @__PURE__ */ import_react54.default.createElement("div", { className: "Layer__profit-and-loss-table__loader-container" }, /* @__PURE__ */ import_react54.default.createElement(Loader2, null));
|
|
4133
4694
|
}
|
|
4134
|
-
return /* @__PURE__ */
|
|
4695
|
+
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
4696
|
ProfitAndLossRow,
|
|
4136
4697
|
{
|
|
4137
4698
|
lineItem: data.income,
|
|
4138
4699
|
direction: "CREDIT" /* CREDIT */,
|
|
4139
4700
|
lockExpanded
|
|
4140
4701
|
}
|
|
4141
|
-
), /* @__PURE__ */
|
|
4702
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4142
4703
|
ProfitAndLossRow,
|
|
4143
4704
|
{
|
|
4144
4705
|
lineItem: data.cost_of_goods_sold,
|
|
4145
4706
|
direction: "DEBIT" /* DEBIT */,
|
|
4146
4707
|
lockExpanded
|
|
4147
4708
|
}
|
|
4148
|
-
), /* @__PURE__ */
|
|
4709
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4149
4710
|
ProfitAndLossRow,
|
|
4150
4711
|
{
|
|
4151
4712
|
lineItem: {
|
|
@@ -4156,14 +4717,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
4156
4717
|
direction: "CREDIT" /* CREDIT */,
|
|
4157
4718
|
lockExpanded
|
|
4158
4719
|
}
|
|
4159
|
-
), /* @__PURE__ */
|
|
4720
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4160
4721
|
ProfitAndLossRow,
|
|
4161
4722
|
{
|
|
4162
4723
|
lineItem: data.expenses,
|
|
4163
4724
|
direction: "DEBIT" /* DEBIT */,
|
|
4164
4725
|
lockExpanded
|
|
4165
4726
|
}
|
|
4166
|
-
), /* @__PURE__ */
|
|
4727
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4167
4728
|
ProfitAndLossRow,
|
|
4168
4729
|
{
|
|
4169
4730
|
lineItem: {
|
|
@@ -4174,14 +4735,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
4174
4735
|
direction: "CREDIT" /* CREDIT */,
|
|
4175
4736
|
lockExpanded
|
|
4176
4737
|
}
|
|
4177
|
-
), /* @__PURE__ */
|
|
4738
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4178
4739
|
ProfitAndLossRow,
|
|
4179
4740
|
{
|
|
4180
4741
|
lineItem: data.taxes,
|
|
4181
4742
|
direction: "DEBIT" /* DEBIT */,
|
|
4182
4743
|
lockExpanded
|
|
4183
4744
|
}
|
|
4184
|
-
), /* @__PURE__ */
|
|
4745
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4185
4746
|
ProfitAndLossRow,
|
|
4186
4747
|
{
|
|
4187
4748
|
lineItem: {
|
|
@@ -4192,14 +4753,14 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
4192
4753
|
direction: "CREDIT" /* CREDIT */,
|
|
4193
4754
|
lockExpanded
|
|
4194
4755
|
}
|
|
4195
|
-
)), /* @__PURE__ */
|
|
4756
|
+
)), /* @__PURE__ */ import_react54.default.createElement("div", { className: "Layer__profit-and-loss-table Layer__profit-and-loss-table__outflows" }, /* @__PURE__ */ import_react54.default.createElement(
|
|
4196
4757
|
ProfitAndLossRow,
|
|
4197
4758
|
{
|
|
4198
4759
|
lineItem: data.other_outflows,
|
|
4199
4760
|
direction: "DEBIT" /* DEBIT */,
|
|
4200
4761
|
lockExpanded
|
|
4201
4762
|
}
|
|
4202
|
-
), /* @__PURE__ */
|
|
4763
|
+
), /* @__PURE__ */ import_react54.default.createElement(
|
|
4203
4764
|
ProfitAndLossRow,
|
|
4204
4765
|
{
|
|
4205
4766
|
lineItem: data.personal_expenses,
|
|
@@ -4211,7 +4772,7 @@ var ProfitAndLossTable = ({ lockExpanded }) => {
|
|
|
4211
4772
|
|
|
4212
4773
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
4213
4774
|
var import_date_fns13 = require("date-fns");
|
|
4214
|
-
var PNLContext = (0,
|
|
4775
|
+
var PNLContext = (0, import_react55.createContext)({
|
|
4215
4776
|
data: void 0,
|
|
4216
4777
|
isLoading: true,
|
|
4217
4778
|
isValidating: false,
|
|
@@ -4227,7 +4788,7 @@ var PNLContext = (0, import_react49.createContext)({
|
|
|
4227
4788
|
});
|
|
4228
4789
|
var ProfitAndLoss = ({ children, tagFilter, reportingBasis }) => {
|
|
4229
4790
|
const contextData = useProfitAndLoss({ tagFilter, reportingBasis });
|
|
4230
|
-
return /* @__PURE__ */
|
|
4791
|
+
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
4792
|
};
|
|
4232
4793
|
ProfitAndLoss.Chart = ProfitAndLossChart;
|
|
4233
4794
|
ProfitAndLoss.Context = PNLContext;
|
|
@@ -4236,17 +4797,20 @@ ProfitAndLoss.Summaries = ProfitAndLossSummaries;
|
|
|
4236
4797
|
ProfitAndLoss.Table = ProfitAndLossTable;
|
|
4237
4798
|
|
|
4238
4799
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
4239
|
-
var
|
|
4240
|
-
var
|
|
4241
|
-
var ProfitAndLossView = () => {
|
|
4242
|
-
return /* @__PURE__ */
|
|
4800
|
+
var import_react56 = __toESM(require("react"));
|
|
4801
|
+
var COMPONENT_NAME3 = "profit-and-loss";
|
|
4802
|
+
var ProfitAndLossView = (props) => {
|
|
4803
|
+
return /* @__PURE__ */ import_react56.default.createElement(Container, { name: COMPONENT_NAME3 }, /* @__PURE__ */ import_react56.default.createElement(Header, { className: `Layer__${COMPONENT_NAME3}__header` }, /* @__PURE__ */ import_react56.default.createElement(Heading, { className: "Layer__bank-transactions__title" }, "Profit & Loss")), /* @__PURE__ */ import_react56.default.createElement(ProfitAndLoss, null, /* @__PURE__ */ import_react56.default.createElement(Components, { ...props })));
|
|
4243
4804
|
};
|
|
4244
|
-
var Components = (
|
|
4245
|
-
|
|
4805
|
+
var Components = ({
|
|
4806
|
+
hideChart = false,
|
|
4807
|
+
hideTable = false
|
|
4808
|
+
}) => {
|
|
4809
|
+
const { error, isLoading, isValidating, refetch } = (0, import_react56.useContext)(
|
|
4246
4810
|
ProfitAndLoss.Context
|
|
4247
4811
|
);
|
|
4248
4812
|
if (!isLoading && error) {
|
|
4249
|
-
return /* @__PURE__ */
|
|
4813
|
+
return /* @__PURE__ */ import_react56.default.createElement("div", { className: "Layer__table-state-container" }, /* @__PURE__ */ import_react56.default.createElement(
|
|
4250
4814
|
DataState,
|
|
4251
4815
|
{
|
|
4252
4816
|
status: "failed" /* failed */,
|
|
@@ -4257,24 +4821,24 @@ var Components = () => {
|
|
|
4257
4821
|
}
|
|
4258
4822
|
));
|
|
4259
4823
|
}
|
|
4260
|
-
return /* @__PURE__ */
|
|
4824
|
+
return /* @__PURE__ */ import_react56.default.createElement(import_react56.default.Fragment, null, !hideChart && /* @__PURE__ */ import_react56.default.createElement("div", { className: `Layer__${COMPONENT_NAME3}__chart_with_summaries` }, /* @__PURE__ */ import_react56.default.createElement(
|
|
4261
4825
|
"div",
|
|
4262
4826
|
{
|
|
4263
|
-
className: `Layer__${
|
|
4827
|
+
className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__summary-col`
|
|
4264
4828
|
},
|
|
4265
|
-
/* @__PURE__ */
|
|
4266
|
-
/* @__PURE__ */
|
|
4267
|
-
), /* @__PURE__ */
|
|
4829
|
+
/* @__PURE__ */ import_react56.default.createElement(ProfitAndLoss.DatePicker, null),
|
|
4830
|
+
/* @__PURE__ */ import_react56.default.createElement(ProfitAndLoss.Summaries, { vertical: true })
|
|
4831
|
+
), /* @__PURE__ */ import_react56.default.createElement(
|
|
4268
4832
|
"div",
|
|
4269
4833
|
{
|
|
4270
|
-
className: `Layer__${
|
|
4834
|
+
className: `Layer__${COMPONENT_NAME3}__chart_with_summaries__chart-col`
|
|
4271
4835
|
},
|
|
4272
|
-
/* @__PURE__ */
|
|
4273
|
-
)), /* @__PURE__ */
|
|
4836
|
+
/* @__PURE__ */ import_react56.default.createElement(ProfitAndLoss.Chart, null)
|
|
4837
|
+
)), !hideTable && /* @__PURE__ */ import_react56.default.createElement(ProfitAndLoss.Table, null));
|
|
4274
4838
|
};
|
|
4275
4839
|
|
|
4276
4840
|
// src/providers/LayerProvider/LayerProvider.tsx
|
|
4277
|
-
var
|
|
4841
|
+
var import_react57 = __toESM(require("react"));
|
|
4278
4842
|
var import_date_fns14 = require("date-fns");
|
|
4279
4843
|
var import_swr5 = __toESM(require("swr"));
|
|
4280
4844
|
var reducer = (state, action) => {
|
|
@@ -4316,7 +4880,7 @@ var LayerProvider = ({
|
|
|
4316
4880
|
};
|
|
4317
4881
|
const colors = buildColorsPalette(theme);
|
|
4318
4882
|
const { url, scope, apiUrl } = LayerEnvironment[environment];
|
|
4319
|
-
const [state, dispatch] = (0,
|
|
4883
|
+
const [state, dispatch] = (0, import_react57.useReducer)(reducer, {
|
|
4320
4884
|
auth: {
|
|
4321
4885
|
access_token: "",
|
|
4322
4886
|
token_type: "",
|
|
@@ -4339,7 +4903,7 @@ var LayerProvider = ({
|
|
|
4339
4903
|
}),
|
|
4340
4904
|
defaultSWRConfig
|
|
4341
4905
|
) : { data: void 0 };
|
|
4342
|
-
(0,
|
|
4906
|
+
(0, import_react57.useEffect)(() => {
|
|
4343
4907
|
if (businessAccessToken) {
|
|
4344
4908
|
dispatch({
|
|
4345
4909
|
type: "LayerContext.setAuth" /* setAuth */,
|
|
@@ -4389,11 +4953,11 @@ var LayerProvider = ({
|
|
|
4389
4953
|
}
|
|
4390
4954
|
return;
|
|
4391
4955
|
};
|
|
4392
|
-
return /* @__PURE__ */
|
|
4956
|
+
return /* @__PURE__ */ import_react57.default.createElement(import_swr5.SWRConfig, { value: defaultSWRConfig }, /* @__PURE__ */ import_react57.default.createElement(LayerContext.Provider, { value: { ...state, setTheme, getColor } }, children));
|
|
4393
4957
|
};
|
|
4394
4958
|
|
|
4395
4959
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
4396
|
-
var
|
|
4960
|
+
var import_react60 = __toESM(require("react"));
|
|
4397
4961
|
|
|
4398
4962
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
4399
4963
|
var import_swr6 = __toESM(require("swr"));
|
|
@@ -4413,21 +4977,21 @@ var useChartOfAccounts = () => {
|
|
|
4413
4977
|
};
|
|
4414
4978
|
|
|
4415
4979
|
// src/components/ChartOfAccountsNewForm/ChartOfAccountsNewForm.tsx
|
|
4416
|
-
var
|
|
4980
|
+
var import_react58 = __toESM(require("react"));
|
|
4417
4981
|
var import_react_select3 = __toESM(require("react-select"));
|
|
4418
4982
|
var flattenAccounts = (accounts) => accounts.flatMap((a) => [a, flattenAccounts(a.subAccounts || [])]).flat().filter((id) => id);
|
|
4419
4983
|
var ChartOfAccountsNewForm = () => {
|
|
4420
4984
|
const { data, create: createAccount2 } = useChartOfAccounts();
|
|
4421
|
-
const accountOptions = (0,
|
|
4985
|
+
const accountOptions = (0, import_react58.useMemo)(
|
|
4422
4986
|
() => flattenAccounts(data?.accounts || []).sort(
|
|
4423
4987
|
(a, b) => a?.name && b?.name ? a.name.localeCompare(b.name) : 0
|
|
4424
4988
|
),
|
|
4425
4989
|
[data?.accounts?.length]
|
|
4426
4990
|
);
|
|
4427
|
-
const [name, setName] = (0,
|
|
4428
|
-
const [description, setDescription] = (0,
|
|
4429
|
-
const [normality, setNormality] = (0,
|
|
4430
|
-
const [parentAccount, setParentAccount] = (0,
|
|
4991
|
+
const [name, setName] = (0, import_react58.useState)("");
|
|
4992
|
+
const [description, setDescription] = (0, import_react58.useState)("");
|
|
4993
|
+
const [normality, setNormality] = (0, import_react58.useState)("DEBIT" /* DEBIT */);
|
|
4994
|
+
const [parentAccount, setParentAccount] = (0, import_react58.useState)(
|
|
4431
4995
|
data?.accounts[0]
|
|
4432
4996
|
);
|
|
4433
4997
|
const save = () => {
|
|
@@ -4441,21 +5005,21 @@ var ChartOfAccountsNewForm = () => {
|
|
|
4441
5005
|
description
|
|
4442
5006
|
});
|
|
4443
5007
|
};
|
|
4444
|
-
return /* @__PURE__ */
|
|
5008
|
+
return /* @__PURE__ */ import_react58.default.createElement("div", { className: "Layer__chart-of-accounts-new-form" }, /* @__PURE__ */ import_react58.default.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ import_react58.default.createElement("span", null, "Name"), /* @__PURE__ */ import_react58.default.createElement(
|
|
4445
5009
|
"input",
|
|
4446
5010
|
{
|
|
4447
5011
|
name: "name",
|
|
4448
5012
|
value: name,
|
|
4449
5013
|
onChange: (event) => setName(event.target.value)
|
|
4450
5014
|
}
|
|
4451
|
-
)), /* @__PURE__ */
|
|
5015
|
+
)), /* @__PURE__ */ import_react58.default.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ import_react58.default.createElement("span", null, "Description"), /* @__PURE__ */ import_react58.default.createElement(
|
|
4452
5016
|
"input",
|
|
4453
5017
|
{
|
|
4454
5018
|
name: "description",
|
|
4455
5019
|
value: description,
|
|
4456
5020
|
onChange: (event) => setDescription(event.target.value)
|
|
4457
5021
|
}
|
|
4458
|
-
)), /* @__PURE__ */
|
|
5022
|
+
)), /* @__PURE__ */ import_react58.default.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ import_react58.default.createElement("span", null, "Normality"), /* @__PURE__ */ import_react58.default.createElement(
|
|
4459
5023
|
import_react_select3.default,
|
|
4460
5024
|
{
|
|
4461
5025
|
isSearchable: false,
|
|
@@ -4465,7 +5029,7 @@ var ChartOfAccountsNewForm = () => {
|
|
|
4465
5029
|
{ label: "Debit", value: "DEBIT" /* DEBIT */ }
|
|
4466
5030
|
]
|
|
4467
5031
|
}
|
|
4468
|
-
)), /* @__PURE__ */
|
|
5032
|
+
)), /* @__PURE__ */ import_react58.default.createElement("div", { className: "Layer__chart-of-accounts-new-form__field" }, /* @__PURE__ */ import_react58.default.createElement("span", null, "Parent Account"), /* @__PURE__ */ import_react58.default.createElement(
|
|
4469
5033
|
import_react_select3.default,
|
|
4470
5034
|
{
|
|
4471
5035
|
isSearchable: true,
|
|
@@ -4475,49 +5039,49 @@ var ChartOfAccountsNewForm = () => {
|
|
|
4475
5039
|
getOptionValue: (a) => a.id,
|
|
4476
5040
|
options: accountOptions
|
|
4477
5041
|
}
|
|
4478
|
-
)), /* @__PURE__ */
|
|
5042
|
+
)), /* @__PURE__ */ import_react58.default.createElement("div", { className: "Layer__chart-of-accounts-new-form__field Layer__chart-of-accounts-new-form__field--actions" }, /* @__PURE__ */ import_react58.default.createElement("button", { onClick: save }, "Save")));
|
|
4479
5043
|
};
|
|
4480
5044
|
|
|
4481
5045
|
// src/components/ChartOfAccountsRow/ChartOfAccountsRow.tsx
|
|
4482
|
-
var
|
|
5046
|
+
var import_react59 = __toESM(require("react"));
|
|
4483
5047
|
var ChartOfAccountsRow = ({ account, depth = 0 }) => {
|
|
4484
|
-
const
|
|
5048
|
+
const classNames22 = [
|
|
4485
5049
|
"Layer__chart-of-accounts-row__table-cell",
|
|
4486
5050
|
depth > 0 && `Layer__chart-of-accounts-row__table-cell--depth-${depth}`
|
|
4487
5051
|
];
|
|
4488
|
-
const className =
|
|
5052
|
+
const className = classNames22.filter((id) => id).join(" ");
|
|
4489
5053
|
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__ */
|
|
5054
|
+
return /* @__PURE__ */ import_react59.default.createElement(import_react59.default.Fragment, null, /* @__PURE__ */ import_react59.default.createElement(
|
|
4491
5055
|
"div",
|
|
4492
5056
|
{
|
|
4493
5057
|
className: `${className} Layer__chart-of-accounts-row__table-cell--name`
|
|
4494
5058
|
},
|
|
4495
5059
|
account.name
|
|
4496
|
-
), /* @__PURE__ */
|
|
5060
|
+
), /* @__PURE__ */ import_react59.default.createElement(
|
|
4497
5061
|
"div",
|
|
4498
5062
|
{
|
|
4499
5063
|
className: `${className} Layer__chart-of-accounts-row__table-cell--type`
|
|
4500
5064
|
},
|
|
4501
5065
|
"Assets"
|
|
4502
|
-
), /* @__PURE__ */
|
|
5066
|
+
), /* @__PURE__ */ import_react59.default.createElement(
|
|
4503
5067
|
"div",
|
|
4504
5068
|
{
|
|
4505
5069
|
className: `${className} Layer__chart-of-accounts-row__table-cell--subtype`
|
|
4506
5070
|
},
|
|
4507
5071
|
"Cash"
|
|
4508
|
-
), /* @__PURE__ */
|
|
5072
|
+
), /* @__PURE__ */ import_react59.default.createElement(
|
|
4509
5073
|
"div",
|
|
4510
5074
|
{
|
|
4511
5075
|
className: `${className} Layer__chart-of-accounts-row__table-cell--balance ${amountClassName}`
|
|
4512
5076
|
},
|
|
4513
5077
|
centsToDollars(Math.abs(account.balance || 0))
|
|
4514
|
-
), /* @__PURE__ */
|
|
5078
|
+
), /* @__PURE__ */ import_react59.default.createElement(
|
|
4515
5079
|
"div",
|
|
4516
5080
|
{
|
|
4517
5081
|
className: `${className} Layer__chart-of-accounts-row__table-cell--actions`
|
|
4518
5082
|
},
|
|
4519
|
-
/* @__PURE__ */
|
|
4520
|
-
), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */
|
|
5083
|
+
/* @__PURE__ */ import_react59.default.createElement("button", { className: "Layer__chart-of-accounts-row__view-entries-button" }, "View Entries")
|
|
5084
|
+
), (account.subAccounts || []).map((subAccount) => /* @__PURE__ */ import_react59.default.createElement(
|
|
4521
5085
|
ChartOfAccountsRow,
|
|
4522
5086
|
{
|
|
4523
5087
|
key: subAccount.id,
|
|
@@ -4530,15 +5094,15 @@ var ChartOfAccountsRow = ({ account, depth = 0 }) => {
|
|
|
4530
5094
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
4531
5095
|
var ChartOfAccounts = () => {
|
|
4532
5096
|
const { data, isLoading } = useChartOfAccounts();
|
|
4533
|
-
const [showingForm, setShowingForm] = (0,
|
|
4534
|
-
return /* @__PURE__ */
|
|
5097
|
+
const [showingForm, setShowingForm] = (0, import_react60.useState)(false);
|
|
5098
|
+
return /* @__PURE__ */ import_react60.default.createElement("div", { className: "Layer__component Layer__chart-of-accounts" }, !data || isLoading ? "Loading." : /* @__PURE__ */ import_react60.default.createElement(import_react60.default.Fragment, null, /* @__PURE__ */ import_react60.default.createElement("div", { className: "Layer__chart-of-accounts__header" }, /* @__PURE__ */ import_react60.default.createElement("h2", { className: "Layer__chart-of-accounts__title" }, "Chart of Accounts"), /* @__PURE__ */ import_react60.default.createElement("div", { className: "Layer__chart-of-accounts__actions" }, /* @__PURE__ */ import_react60.default.createElement("button", { className: "Layer__chart-of-accounts__download-button" }, /* @__PURE__ */ import_react60.default.createElement(DownloadCloud_default, null), "Download"), /* @__PURE__ */ import_react60.default.createElement(
|
|
4535
5099
|
"button",
|
|
4536
5100
|
{
|
|
4537
5101
|
className: "Layer__chart-of-accounts__edit-accounts-button",
|
|
4538
5102
|
onClick: () => setShowingForm(!showingForm)
|
|
4539
5103
|
},
|
|
4540
5104
|
"Edit Accounts"
|
|
4541
|
-
))), showingForm && /* @__PURE__ */
|
|
5105
|
+
))), showingForm && /* @__PURE__ */ import_react60.default.createElement(ChartOfAccountsNewForm, null), /* @__PURE__ */ import_react60.default.createElement("div", { className: "Layer__chart-of-accounts__table" }, /* @__PURE__ */ import_react60.default.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Name"), /* @__PURE__ */ import_react60.default.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Type"), /* @__PURE__ */ import_react60.default.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }, "Sub-Type"), /* @__PURE__ */ import_react60.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_react60.default.createElement("div", { className: "Layer__chart-of-accounts__table-cell Layer__chart-of-accounts__table-cell--header" }), data.accounts.map((account) => /* @__PURE__ */ import_react60.default.createElement(
|
|
4542
5106
|
ChartOfAccountsRow,
|
|
4543
5107
|
{
|
|
4544
5108
|
key: account.id,
|
|
@@ -4554,6 +5118,7 @@ var ChartOfAccounts = () => {
|
|
|
4554
5118
|
ChartOfAccounts,
|
|
4555
5119
|
Hello,
|
|
4556
5120
|
LayerProvider,
|
|
5121
|
+
LinkedAccounts,
|
|
4557
5122
|
ProfitAndLoss,
|
|
4558
5123
|
ProfitAndLossView
|
|
4559
5124
|
});
|