@layerfi/components 0.1.114-alpha.5 → 0.1.114
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +293 -258
- package/dist/esm/index.mjs +295 -260
- package/dist/index.css +57 -57
- package/package.json +1 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -51,7 +51,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
});
|
|
52
52
|
};
|
|
53
53
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
54
|
-
import { createContext, useState, useContext, useMemo, useEffect, forwardRef, useCallback, useRef, isValidElement, cloneElement, useLayoutEffect, useId, Children,
|
|
54
|
+
import { createContext, useState, useContext, useMemo, useEffect, forwardRef, useCallback, useRef, isValidElement, cloneElement, useLayoutEffect, useId, Children, useImperativeHandle, createElement, Component, Fragment as Fragment$1, useReducer } from "react";
|
|
55
55
|
import { createStore, useStore } from "zustand";
|
|
56
56
|
import { usePlaidLink } from "react-plaid-link";
|
|
57
57
|
import { formatISO, differenceInDays, isWithinInterval, parseISO, endOfDay, startOfMonth, endOfMonth, min, max, differenceInCalendarMonths, format, isValid, startOfYear, subMonths, getYear, getMonth, subYears, differenceInCalendarYears, sub, differenceInMonths, add, startOfDay, endOfToday, isEqual, addYears, endOfYear, subQuarters, addQuarters, endOfQuarter, startOfQuarter, addMonths, set, startOfToday, endOfYesterday, formatDate as formatDate$1 } from "date-fns";
|
|
@@ -65,7 +65,7 @@ import useSWRInfinite from "swr/infinite";
|
|
|
65
65
|
import useSWRMutation from "swr/mutation";
|
|
66
66
|
import { useStoreWithEqualityFn } from "zustand/traditional";
|
|
67
67
|
import { useFloating, offset, flip, shift, autoUpdate, useHover, useFocus, useDismiss, useRole, useInteractions, useTransitionStyles, useMergeRefs, FloatingPortal } from "@floating-ui/react";
|
|
68
|
-
import { Button as Button$2, Header as Header$3, Label as Label$1, Text as Text$1, ModalOverlay as ModalOverlay$1, Modal as Modal$1, Dialog as Dialog$1, Heading as Heading$2, Group, SearchField as SearchField$1, Input as Input$2, Form as Form$1, TextField as TextField$1, FieldError as FieldError$1, Checkbox as Checkbox$1, DateField as DateField$1, DateInput as DateInput$1, DateSegment as DateSegment$1, DatePicker as DatePicker$2, NumberField as NumberField$1, TextArea as TextArea$1, MenuTrigger, Popover as Popover$1, Menu as Menu$1, MenuItem as MenuItem$2, GridList, GridListItem, DialogTrigger, Table as Table$2, Column as Column$1, Cell as Cell$1, TableHeader as TableHeader$1, TableBody as TableBody$2, Row as Row$1, Switch as Switch$1,
|
|
68
|
+
import { Button as Button$2, Header as Header$3, Label as Label$1, Text as Text$1, ModalOverlay as ModalOverlay$1, Modal as Modal$1, Dialog as Dialog$1, Heading as Heading$2, Group, SearchField as SearchField$1, Input as Input$2, Form as Form$1, TextField as TextField$1, FieldError as FieldError$1, Checkbox as Checkbox$1, DateField as DateField$1, DateInput as DateInput$1, DateSegment as DateSegment$1, DatePicker as DatePicker$2, NumberField as NumberField$1, TextArea as TextArea$1, MenuTrigger, Popover as Popover$1, Menu as Menu$1, MenuItem as MenuItem$2, GridList, GridListItem, DialogTrigger, ToggleButton, SelectionIndicator, ToggleButtonGroup, Table as Table$2, Column as Column$1, Cell as Cell$1, TableHeader as TableHeader$1, TableBody as TableBody$2, Row as Row$1, Switch as Switch$1, Calendar as Calendar$1, CalendarGrid as CalendarGrid$1, CalendarGridBody as CalendarGridBody$1, CalendarCell as CalendarCell$1, CalendarGridHeader as CalendarGridHeader$1, CalendarHeaderCell as CalendarHeaderCell$1, Meter as Meter$1, Link as Link$3 } from "react-aria-components";
|
|
69
69
|
import { LoaderCircle, X as X$1, ChevronDown as ChevronDown$1, Layers2Icon, UploadCloud as UploadCloud$1, Search, ChevronLeft as ChevronLeft$1, CopyIcon, FileSpreadsheet, FileDownIcon, Minus, Check as Check$1, RefreshCcw as RefreshCcw$1, MenuIcon, ChevronRight as ChevronRight$1, PencilRuler, SearchX, Trash2, CheckIcon, AlertCircle as AlertCircle$1, TriangleAlert, List, AlertTriangle, Save as Save$1, Plus as Plus$1, HandCoins, Menu as Menu$2, Trash as Trash$1, Send, Calendar as Calendar$2, Download, Users, Milestone, Video, Clock as Clock$1, Link as Link$4, Car } from "lucide-react";
|
|
70
70
|
import pluralize from "pluralize";
|
|
71
71
|
import { mergeRefs } from "react-merge-refs";
|
|
@@ -202,7 +202,7 @@ class ErrorHandlerClass {
|
|
|
202
202
|
}
|
|
203
203
|
const errorHandler = new ErrorHandlerClass();
|
|
204
204
|
const reportError = (payload) => errorHandler.onError(payload);
|
|
205
|
-
const version = "0.1.114
|
|
205
|
+
const version = "0.1.114";
|
|
206
206
|
const pkg = {
|
|
207
207
|
version
|
|
208
208
|
};
|
|
@@ -7498,7 +7498,7 @@ function buildCustomDropdownIndicator() {
|
|
|
7498
7498
|
components.DropdownIndicator,
|
|
7499
7499
|
__spreadProps(__spreadValues({}, restProps), {
|
|
7500
7500
|
className: COMBO_BOX_CLASS_NAMES.DROPDOWN_INDICATOR,
|
|
7501
|
-
children: !isDisabled
|
|
7501
|
+
children: !isDisabled ? /* @__PURE__ */ jsx(ChevronDown$1, { size: 16 }) : /* @__PURE__ */ jsx(Fragment, {})
|
|
7502
7502
|
})
|
|
7503
7503
|
);
|
|
7504
7504
|
};
|
|
@@ -8947,7 +8947,7 @@ const BankTransactionsCategorizeAllModal = ({
|
|
|
8947
8947
|
const { selectedIds } = useSelectedIds();
|
|
8948
8948
|
const { clearSelection } = useBulkSelectionActions();
|
|
8949
8949
|
const [selectedCategory, setSelectedCategory] = useState(null);
|
|
8950
|
-
const { trigger } = useBulkCategorize();
|
|
8950
|
+
const { trigger, isMutating } = useBulkCategorize();
|
|
8951
8951
|
const handleCategorizeModalClose = useCallback((isOpen2) => {
|
|
8952
8952
|
onOpenChange(isOpen2);
|
|
8953
8953
|
if (!isOpen2) {
|
|
@@ -8983,7 +8983,7 @@ const BankTransactionsCategorizeAllModal = ({
|
|
|
8983
8983
|
title: mode === "Categorize" ? "Categorize all selected transactions?" : "Recategorize all selected transactions?",
|
|
8984
8984
|
content: /* @__PURE__ */ jsxs(VStack, { gap: "xs", children: [
|
|
8985
8985
|
/* @__PURE__ */ jsxs(VStack, { gap: "3xs", children: [
|
|
8986
|
-
/* @__PURE__ */ jsx(Label, { htmlFor: categorySelectId, children: "Select category" }),
|
|
8986
|
+
/* @__PURE__ */ jsx(Label, { size: "sm", htmlFor: categorySelectId, children: "Select category" }),
|
|
8987
8987
|
useCategorySelectDrawer ? /* @__PURE__ */ jsx(
|
|
8988
8988
|
CategorySelectDrawerWithTrigger,
|
|
8989
8989
|
{
|
|
@@ -8998,7 +8998,8 @@ const BankTransactionsCategorizeAllModal = ({
|
|
|
8998
8998
|
inputId: categorySelectId,
|
|
8999
8999
|
selectedValue: selectedCategory,
|
|
9000
9000
|
onSelectedValueChange: setSelectedCategory,
|
|
9001
|
-
includeSuggestedMatches: false
|
|
9001
|
+
includeSuggestedMatches: false,
|
|
9002
|
+
isDisabled: isMutating
|
|
9002
9003
|
}
|
|
9003
9004
|
)
|
|
9004
9005
|
] }),
|
|
@@ -11868,6 +11869,37 @@ const MonthPicker = ({
|
|
|
11868
11869
|
) }) })
|
|
11869
11870
|
] });
|
|
11870
11871
|
};
|
|
11872
|
+
const NewToggleOption = ({
|
|
11873
|
+
label,
|
|
11874
|
+
value
|
|
11875
|
+
}) => {
|
|
11876
|
+
return /* @__PURE__ */ jsxs(ToggleButton, { id: value, className: "Layer__NewToggleOption", children: [
|
|
11877
|
+
/* @__PURE__ */ jsx(SelectionIndicator, { className: "Layer__NewToggleOption-SelectionIndicator" }),
|
|
11878
|
+
/* @__PURE__ */ jsx(Span, { className: "Layer__NewToggle-Option-Content", children: /* @__PURE__ */ jsx(Span, { noWrap: true, children: label }) })
|
|
11879
|
+
] });
|
|
11880
|
+
};
|
|
11881
|
+
const NewToggle = ({
|
|
11882
|
+
options: options2,
|
|
11883
|
+
selectedKey,
|
|
11884
|
+
onSelectionChange
|
|
11885
|
+
}) => {
|
|
11886
|
+
const selectedKeys = selectedKey !== void 0 ? /* @__PURE__ */ new Set([selectedKey]) : /* @__PURE__ */ new Set();
|
|
11887
|
+
return /* @__PURE__ */ jsx(
|
|
11888
|
+
ToggleButtonGroup,
|
|
11889
|
+
{
|
|
11890
|
+
className: "Layer__NewToggle",
|
|
11891
|
+
selectionMode: "single",
|
|
11892
|
+
selectedKeys,
|
|
11893
|
+
onSelectionChange: (keys) => {
|
|
11894
|
+
const selectedKeysArray = Array.from(keys);
|
|
11895
|
+
if (selectedKeysArray.length > 0 && onSelectionChange) {
|
|
11896
|
+
onSelectionChange(selectedKeysArray[0]);
|
|
11897
|
+
}
|
|
11898
|
+
},
|
|
11899
|
+
children: options2.map((option) => /* @__PURE__ */ jsx(NewToggleOption, __spreadValues({}, option), option.value))
|
|
11900
|
+
}
|
|
11901
|
+
);
|
|
11902
|
+
};
|
|
11871
11903
|
const SmallLoader = ({ size = 28 }) => {
|
|
11872
11904
|
return /* @__PURE__ */ jsx(
|
|
11873
11905
|
"span",
|
|
@@ -11912,169 +11944,6 @@ const SyncingComponent = ({
|
|
|
11912
11944
|
}
|
|
11913
11945
|
);
|
|
11914
11946
|
};
|
|
11915
|
-
var ToggleSize = /* @__PURE__ */ ((ToggleSize2) => {
|
|
11916
|
-
ToggleSize2["medium"] = "medium";
|
|
11917
|
-
ToggleSize2["small"] = "small";
|
|
11918
|
-
ToggleSize2["xsmall"] = "xsmall";
|
|
11919
|
-
return ToggleSize2;
|
|
11920
|
-
})(ToggleSize || {});
|
|
11921
|
-
const Toggle = ({
|
|
11922
|
-
name,
|
|
11923
|
-
options: options2,
|
|
11924
|
-
selected,
|
|
11925
|
-
onChange,
|
|
11926
|
-
size = "medium"
|
|
11927
|
-
/* medium */
|
|
11928
|
-
}) => {
|
|
11929
|
-
const [currentWidth, setCurrentWidth] = useState(0);
|
|
11930
|
-
const [thumbPos, setThumbPos] = useState({ left: 0, width: 0 });
|
|
11931
|
-
const [initialized, setInitialized] = useState(false);
|
|
11932
|
-
const activeOption = useMemo(() => {
|
|
11933
|
-
return selected ? selected : options2.length > 0 ? options2[0].value : void 0;
|
|
11934
|
-
}, [selected, options2]);
|
|
11935
|
-
const toggleRef = useElementSize((_a, _b, c) => {
|
|
11936
|
-
if (c.width && (c == null ? void 0 : c.width) !== currentWidth) {
|
|
11937
|
-
setCurrentWidth(c.width);
|
|
11938
|
-
}
|
|
11939
|
-
});
|
|
11940
|
-
const baseClassName2 = classNames(
|
|
11941
|
-
"Layer__toggle",
|
|
11942
|
-
`Layer__toggle--${size}`,
|
|
11943
|
-
initialized ? "Layer__toggle--initialized" : ""
|
|
11944
|
-
);
|
|
11945
|
-
const handleChange = (e) => {
|
|
11946
|
-
var _a;
|
|
11947
|
-
updateThumbPosition(Number((_a = e.target.getAttribute("data-idx")) != null ? _a : 0));
|
|
11948
|
-
onChange(e);
|
|
11949
|
-
};
|
|
11950
|
-
const updateThumbPosition = (active) => {
|
|
11951
|
-
if (!(toggleRef == null ? void 0 : toggleRef.current)) {
|
|
11952
|
-
return;
|
|
11953
|
-
}
|
|
11954
|
-
const optionsNodes = [...toggleRef.current.children].map((x) => {
|
|
11955
|
-
if (x.className.includes("Layer__tooltip-trigger") && x.children && x.children.length > 0) {
|
|
11956
|
-
return x.children[0];
|
|
11957
|
-
}
|
|
11958
|
-
return x;
|
|
11959
|
-
}).filter((c) => c.className.includes("Layer__toggle-option"));
|
|
11960
|
-
let shift2 = 0;
|
|
11961
|
-
let width = thumbPos.width;
|
|
11962
|
-
optionsNodes.forEach((c, i) => {
|
|
11963
|
-
if (i < active) {
|
|
11964
|
-
shift2 = shift2 + c.offsetWidth;
|
|
11965
|
-
} else if (i === active) {
|
|
11966
|
-
width = c.offsetWidth;
|
|
11967
|
-
}
|
|
11968
|
-
});
|
|
11969
|
-
shift2 = shift2 + (size === "medium" ? 2 : 1.5);
|
|
11970
|
-
setThumbPos({ left: shift2, width });
|
|
11971
|
-
};
|
|
11972
|
-
useEffect(() => {
|
|
11973
|
-
const selectedIndex = getSelectedIndex();
|
|
11974
|
-
updateThumbPosition(selectedIndex);
|
|
11975
|
-
setTimeout(() => {
|
|
11976
|
-
setInitialized(true);
|
|
11977
|
-
}, 400);
|
|
11978
|
-
}, []);
|
|
11979
|
-
useEffect(() => {
|
|
11980
|
-
const selectedIndex = getSelectedIndex();
|
|
11981
|
-
updateThumbPosition(selectedIndex);
|
|
11982
|
-
}, [currentWidth]);
|
|
11983
|
-
const getSelectedIndex = () => {
|
|
11984
|
-
const selectedIndex = options2.findIndex(
|
|
11985
|
-
(option) => option.value === activeOption
|
|
11986
|
-
);
|
|
11987
|
-
if (selectedIndex === -1) {
|
|
11988
|
-
return 0;
|
|
11989
|
-
}
|
|
11990
|
-
return selectedIndex;
|
|
11991
|
-
};
|
|
11992
|
-
return /* @__PURE__ */ jsxs("div", { className: baseClassName2, ref: toggleRef, children: [
|
|
11993
|
-
options2.map((option, index) => {
|
|
11994
|
-
var _a;
|
|
11995
|
-
return /* @__PURE__ */ createElement(
|
|
11996
|
-
ToggleOption,
|
|
11997
|
-
__spreadProps(__spreadValues({}, option), {
|
|
11998
|
-
size,
|
|
11999
|
-
key: option.value,
|
|
12000
|
-
name,
|
|
12001
|
-
checked: activeOption === option.value,
|
|
12002
|
-
onChange: handleChange,
|
|
12003
|
-
disabled: (_a = option.disabled) != null ? _a : false,
|
|
12004
|
-
disabledMessage: option.disabledMessage,
|
|
12005
|
-
index
|
|
12006
|
-
})
|
|
12007
|
-
);
|
|
12008
|
-
}),
|
|
12009
|
-
/* @__PURE__ */ jsx("span", { className: "Layer__toggle__thumb", style: __spreadValues({}, thumbPos) })
|
|
12010
|
-
] });
|
|
12011
|
-
};
|
|
12012
|
-
const ToggleOption = ({
|
|
12013
|
-
checked,
|
|
12014
|
-
label,
|
|
12015
|
-
name,
|
|
12016
|
-
onChange,
|
|
12017
|
-
value,
|
|
12018
|
-
size: _size,
|
|
12019
|
-
leftIcon,
|
|
12020
|
-
disabled,
|
|
12021
|
-
disabledMessage = "Disabled",
|
|
12022
|
-
style,
|
|
12023
|
-
index
|
|
12024
|
-
}) => {
|
|
12025
|
-
const optionClassName = classNames("Layer__toggle-option", {
|
|
12026
|
-
"Layer__toggle-option--active": checked
|
|
12027
|
-
});
|
|
12028
|
-
if (disabled) {
|
|
12029
|
-
return /* @__PURE__ */ jsxs(DeprecatedTooltip, { children: [
|
|
12030
|
-
/* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsxs(
|
|
12031
|
-
"label",
|
|
12032
|
-
{
|
|
12033
|
-
className: optionClassName,
|
|
12034
|
-
"data-checked": checked,
|
|
12035
|
-
style,
|
|
12036
|
-
children: [
|
|
12037
|
-
/* @__PURE__ */ jsx(
|
|
12038
|
-
"input",
|
|
12039
|
-
{
|
|
12040
|
-
type: "radio",
|
|
12041
|
-
checked,
|
|
12042
|
-
name,
|
|
12043
|
-
onChange,
|
|
12044
|
-
value,
|
|
12045
|
-
disabled,
|
|
12046
|
-
"data-idx": index
|
|
12047
|
-
}
|
|
12048
|
-
),
|
|
12049
|
-
/* @__PURE__ */ jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
12050
|
-
leftIcon && /* @__PURE__ */ jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
12051
|
-
/* @__PURE__ */ jsx(Span, { noWrap: true, children: label })
|
|
12052
|
-
] })
|
|
12053
|
-
]
|
|
12054
|
-
}
|
|
12055
|
-
) }),
|
|
12056
|
-
/* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: disabledMessage })
|
|
12057
|
-
] });
|
|
12058
|
-
}
|
|
12059
|
-
return /* @__PURE__ */ jsxs("label", { className: optionClassName, "data-checked": checked, style, children: [
|
|
12060
|
-
/* @__PURE__ */ jsx(
|
|
12061
|
-
"input",
|
|
12062
|
-
{
|
|
12063
|
-
type: "radio",
|
|
12064
|
-
checked,
|
|
12065
|
-
name,
|
|
12066
|
-
onChange,
|
|
12067
|
-
value,
|
|
12068
|
-
disabled,
|
|
12069
|
-
"data-idx": index
|
|
12070
|
-
}
|
|
12071
|
-
),
|
|
12072
|
-
/* @__PURE__ */ jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
12073
|
-
leftIcon && /* @__PURE__ */ jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
12074
|
-
/* @__PURE__ */ jsx(Span, { noWrap: true, children: label })
|
|
12075
|
-
] })
|
|
12076
|
-
] });
|
|
12077
|
-
};
|
|
12078
11947
|
var HeadingSize = /* @__PURE__ */ ((HeadingSize2) => {
|
|
12079
11948
|
HeadingSize2["primary"] = "primary";
|
|
12080
11949
|
HeadingSize2["secondary"] = "secondary";
|
|
@@ -12261,9 +12130,9 @@ const BankTransactionsHeader = ({
|
|
|
12261
12130
|
stringOverrides == null ? void 0 : stringOverrides.header,
|
|
12262
12131
|
withDatePicker
|
|
12263
12132
|
]);
|
|
12264
|
-
const onCategorizationDisplayChange = (
|
|
12133
|
+
const onCategorizationDisplayChange = (value) => {
|
|
12265
12134
|
setFilters({
|
|
12266
|
-
categorizationStatus:
|
|
12135
|
+
categorizationStatus: value === "categorized" ? DisplayState.categorized : value === "all" ? DisplayState.all : DisplayState.review
|
|
12267
12136
|
});
|
|
12268
12137
|
};
|
|
12269
12138
|
const headerMenuActions = useMemo(() => {
|
|
@@ -12299,16 +12168,14 @@ const BankTransactionsHeader = ({
|
|
|
12299
12168
|
) : /* @__PURE__ */ jsxs(HStack, { slot: "toggle", justify: "center", gap: "xs", children: [
|
|
12300
12169
|
collapseHeader && headerTopRow,
|
|
12301
12170
|
!categorizedOnly && categorizeView && showStatusToggle && /* @__PURE__ */ jsx(
|
|
12302
|
-
|
|
12171
|
+
NewToggle,
|
|
12303
12172
|
{
|
|
12304
|
-
name: "bank-transaction-display",
|
|
12305
|
-
size: mobileComponent === "mobileList" ? ToggleSize.small : ToggleSize.medium,
|
|
12306
12173
|
options: [
|
|
12307
12174
|
{ label: "To Review", value: DisplayState.review },
|
|
12308
12175
|
{ label: "Categorized", value: DisplayState.categorized }
|
|
12309
12176
|
],
|
|
12310
|
-
|
|
12311
|
-
|
|
12177
|
+
selectedKey: display,
|
|
12178
|
+
onSelectionChange: onCategorizationDisplayChange
|
|
12312
12179
|
}
|
|
12313
12180
|
)
|
|
12314
12181
|
] }),
|
|
@@ -14622,6 +14489,169 @@ const MatchForm = ({
|
|
|
14622
14489
|
matchFormError && /* @__PURE__ */ jsx(ErrorText, { children: matchFormError })
|
|
14623
14490
|
] });
|
|
14624
14491
|
};
|
|
14492
|
+
var ToggleSize = /* @__PURE__ */ ((ToggleSize2) => {
|
|
14493
|
+
ToggleSize2["medium"] = "medium";
|
|
14494
|
+
ToggleSize2["small"] = "small";
|
|
14495
|
+
ToggleSize2["xsmall"] = "xsmall";
|
|
14496
|
+
return ToggleSize2;
|
|
14497
|
+
})(ToggleSize || {});
|
|
14498
|
+
const Toggle = ({
|
|
14499
|
+
name,
|
|
14500
|
+
options: options2,
|
|
14501
|
+
selected,
|
|
14502
|
+
onChange,
|
|
14503
|
+
size = "medium"
|
|
14504
|
+
/* medium */
|
|
14505
|
+
}) => {
|
|
14506
|
+
const [currentWidth, setCurrentWidth] = useState(0);
|
|
14507
|
+
const [thumbPos, setThumbPos] = useState({ left: 0, width: 0 });
|
|
14508
|
+
const [initialized, setInitialized] = useState(false);
|
|
14509
|
+
const activeOption = useMemo(() => {
|
|
14510
|
+
return selected ? selected : options2.length > 0 ? options2[0].value : void 0;
|
|
14511
|
+
}, [selected, options2]);
|
|
14512
|
+
const toggleRef = useElementSize((_a, _b, c) => {
|
|
14513
|
+
if (c.width && (c == null ? void 0 : c.width) !== currentWidth) {
|
|
14514
|
+
setCurrentWidth(c.width);
|
|
14515
|
+
}
|
|
14516
|
+
});
|
|
14517
|
+
const baseClassName2 = classNames(
|
|
14518
|
+
"Layer__toggle",
|
|
14519
|
+
`Layer__toggle--${size}`,
|
|
14520
|
+
initialized ? "Layer__toggle--initialized" : ""
|
|
14521
|
+
);
|
|
14522
|
+
const handleChange = (e) => {
|
|
14523
|
+
var _a;
|
|
14524
|
+
updateThumbPosition(Number((_a = e.target.getAttribute("data-idx")) != null ? _a : 0));
|
|
14525
|
+
onChange(e);
|
|
14526
|
+
};
|
|
14527
|
+
const updateThumbPosition = (active) => {
|
|
14528
|
+
if (!(toggleRef == null ? void 0 : toggleRef.current)) {
|
|
14529
|
+
return;
|
|
14530
|
+
}
|
|
14531
|
+
const optionsNodes = [...toggleRef.current.children].map((x) => {
|
|
14532
|
+
if (x.className.includes("Layer__tooltip-trigger") && x.children && x.children.length > 0) {
|
|
14533
|
+
return x.children[0];
|
|
14534
|
+
}
|
|
14535
|
+
return x;
|
|
14536
|
+
}).filter((c) => c.className.includes("Layer__toggle-option"));
|
|
14537
|
+
let shift2 = 0;
|
|
14538
|
+
let width = thumbPos.width;
|
|
14539
|
+
optionsNodes.forEach((c, i) => {
|
|
14540
|
+
if (i < active) {
|
|
14541
|
+
shift2 = shift2 + c.offsetWidth;
|
|
14542
|
+
} else if (i === active) {
|
|
14543
|
+
width = c.offsetWidth;
|
|
14544
|
+
}
|
|
14545
|
+
});
|
|
14546
|
+
shift2 = shift2 + (size === "medium" ? 2 : 1.5);
|
|
14547
|
+
setThumbPos({ left: shift2, width });
|
|
14548
|
+
};
|
|
14549
|
+
useEffect(() => {
|
|
14550
|
+
const selectedIndex = getSelectedIndex();
|
|
14551
|
+
updateThumbPosition(selectedIndex);
|
|
14552
|
+
setTimeout(() => {
|
|
14553
|
+
setInitialized(true);
|
|
14554
|
+
}, 400);
|
|
14555
|
+
}, []);
|
|
14556
|
+
useEffect(() => {
|
|
14557
|
+
const selectedIndex = getSelectedIndex();
|
|
14558
|
+
updateThumbPosition(selectedIndex);
|
|
14559
|
+
}, [currentWidth]);
|
|
14560
|
+
const getSelectedIndex = () => {
|
|
14561
|
+
const selectedIndex = options2.findIndex(
|
|
14562
|
+
(option) => option.value === activeOption
|
|
14563
|
+
);
|
|
14564
|
+
if (selectedIndex === -1) {
|
|
14565
|
+
return 0;
|
|
14566
|
+
}
|
|
14567
|
+
return selectedIndex;
|
|
14568
|
+
};
|
|
14569
|
+
return /* @__PURE__ */ jsxs("div", { className: baseClassName2, ref: toggleRef, children: [
|
|
14570
|
+
options2.map((option, index) => {
|
|
14571
|
+
var _a;
|
|
14572
|
+
return /* @__PURE__ */ createElement(
|
|
14573
|
+
ToggleOption,
|
|
14574
|
+
__spreadProps(__spreadValues({}, option), {
|
|
14575
|
+
size,
|
|
14576
|
+
key: option.value,
|
|
14577
|
+
name,
|
|
14578
|
+
checked: activeOption === option.value,
|
|
14579
|
+
onChange: handleChange,
|
|
14580
|
+
disabled: (_a = option.disabled) != null ? _a : false,
|
|
14581
|
+
disabledMessage: option.disabledMessage,
|
|
14582
|
+
index
|
|
14583
|
+
})
|
|
14584
|
+
);
|
|
14585
|
+
}),
|
|
14586
|
+
/* @__PURE__ */ jsx("span", { className: "Layer__toggle__thumb", style: __spreadValues({}, thumbPos) })
|
|
14587
|
+
] });
|
|
14588
|
+
};
|
|
14589
|
+
const ToggleOption = ({
|
|
14590
|
+
checked,
|
|
14591
|
+
label,
|
|
14592
|
+
name,
|
|
14593
|
+
onChange,
|
|
14594
|
+
value,
|
|
14595
|
+
size: _size,
|
|
14596
|
+
leftIcon,
|
|
14597
|
+
disabled,
|
|
14598
|
+
disabledMessage = "Disabled",
|
|
14599
|
+
style,
|
|
14600
|
+
index
|
|
14601
|
+
}) => {
|
|
14602
|
+
const optionClassName = classNames("Layer__toggle-option", {
|
|
14603
|
+
"Layer__toggle-option--active": checked
|
|
14604
|
+
});
|
|
14605
|
+
if (disabled) {
|
|
14606
|
+
return /* @__PURE__ */ jsxs(DeprecatedTooltip, { children: [
|
|
14607
|
+
/* @__PURE__ */ jsx(DeprecatedTooltipTrigger, { children: /* @__PURE__ */ jsxs(
|
|
14608
|
+
"label",
|
|
14609
|
+
{
|
|
14610
|
+
className: optionClassName,
|
|
14611
|
+
"data-checked": checked,
|
|
14612
|
+
style,
|
|
14613
|
+
children: [
|
|
14614
|
+
/* @__PURE__ */ jsx(
|
|
14615
|
+
"input",
|
|
14616
|
+
{
|
|
14617
|
+
type: "radio",
|
|
14618
|
+
checked,
|
|
14619
|
+
name,
|
|
14620
|
+
onChange,
|
|
14621
|
+
value,
|
|
14622
|
+
disabled,
|
|
14623
|
+
"data-idx": index
|
|
14624
|
+
}
|
|
14625
|
+
),
|
|
14626
|
+
/* @__PURE__ */ jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
14627
|
+
leftIcon && /* @__PURE__ */ jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
14628
|
+
/* @__PURE__ */ jsx(Span, { noWrap: true, children: label })
|
|
14629
|
+
] })
|
|
14630
|
+
]
|
|
14631
|
+
}
|
|
14632
|
+
) }),
|
|
14633
|
+
/* @__PURE__ */ jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: disabledMessage })
|
|
14634
|
+
] });
|
|
14635
|
+
}
|
|
14636
|
+
return /* @__PURE__ */ jsxs("label", { className: optionClassName, "data-checked": checked, style, children: [
|
|
14637
|
+
/* @__PURE__ */ jsx(
|
|
14638
|
+
"input",
|
|
14639
|
+
{
|
|
14640
|
+
type: "radio",
|
|
14641
|
+
checked,
|
|
14642
|
+
name,
|
|
14643
|
+
onChange,
|
|
14644
|
+
value,
|
|
14645
|
+
disabled,
|
|
14646
|
+
"data-idx": index
|
|
14647
|
+
}
|
|
14648
|
+
),
|
|
14649
|
+
/* @__PURE__ */ jsxs("span", { className: "Layer__toggle-option-content", children: [
|
|
14650
|
+
leftIcon && /* @__PURE__ */ jsx("span", { className: "Layer__toggle-option__icon", children: leftIcon }),
|
|
14651
|
+
/* @__PURE__ */ jsx(Span, { noWrap: true, children: label })
|
|
14652
|
+
] })
|
|
14653
|
+
] });
|
|
14654
|
+
};
|
|
14625
14655
|
const GET_BANK_TRANSACTION_METADATA_TAG_KEY = "#bank-transaction-metadata";
|
|
14626
14656
|
function buildKey$I({
|
|
14627
14657
|
access_token: accessToken,
|
|
@@ -14655,6 +14685,24 @@ function useBankTransactionMetadata({ bankTransactionId }) {
|
|
|
14655
14685
|
);
|
|
14656
14686
|
}
|
|
14657
14687
|
const UPDATE_BANK_TRANSACTION_METADATA_TAG_KEY = "#update-bank-transaction-metadata";
|
|
14688
|
+
class UpdateBankTransactionMetadataSWRResponse {
|
|
14689
|
+
constructor(swrResponse) {
|
|
14690
|
+
__publicField(this, "swrResponse");
|
|
14691
|
+
this.swrResponse = swrResponse;
|
|
14692
|
+
}
|
|
14693
|
+
get data() {
|
|
14694
|
+
return this.swrResponse.data;
|
|
14695
|
+
}
|
|
14696
|
+
get trigger() {
|
|
14697
|
+
return this.swrResponse.trigger;
|
|
14698
|
+
}
|
|
14699
|
+
get isMutating() {
|
|
14700
|
+
return this.swrResponse.isMutating;
|
|
14701
|
+
}
|
|
14702
|
+
get isError() {
|
|
14703
|
+
return this.swrResponse.error !== void 0;
|
|
14704
|
+
}
|
|
14705
|
+
}
|
|
14658
14706
|
function buildKey$H({
|
|
14659
14707
|
access_token: accessToken,
|
|
14660
14708
|
apiUrl,
|
|
@@ -14675,7 +14723,7 @@ function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
|
|
|
14675
14723
|
const { data: auth } = useAuth();
|
|
14676
14724
|
const { businessId } = useLayerContext();
|
|
14677
14725
|
const { mutate } = useSWRConfig();
|
|
14678
|
-
const
|
|
14726
|
+
const rawMutationResponse = useSWRMutation(
|
|
14679
14727
|
() => buildKey$H({
|
|
14680
14728
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
14681
14729
|
apiUrl: auth == null ? void 0 : auth.apiUrl,
|
|
@@ -14701,6 +14749,7 @@ function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
|
|
|
14701
14749
|
throwOnError: false
|
|
14702
14750
|
}
|
|
14703
14751
|
);
|
|
14752
|
+
const mutationResponse = new UpdateBankTransactionMetadataSWRResponse(rawMutationResponse);
|
|
14704
14753
|
const { trigger: originalTrigger } = mutationResponse;
|
|
14705
14754
|
const stableProxiedTrigger = useCallback(
|
|
14706
14755
|
(...triggerParameters) => __async(null, null, function* () {
|
|
@@ -14726,21 +14775,37 @@ function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
|
|
|
14726
14775
|
});
|
|
14727
14776
|
}
|
|
14728
14777
|
const useBankTransactionMemo = ({ bankTransactionId }) => {
|
|
14729
|
-
const {
|
|
14730
|
-
|
|
14778
|
+
const {
|
|
14779
|
+
trigger: updateBankTransactionMetadata2,
|
|
14780
|
+
isMutating: isUpdatingMemo,
|
|
14781
|
+
isError: isErrorUpdatingMemo,
|
|
14782
|
+
data: updateResult
|
|
14783
|
+
} = useUpdateBankTransactionMetadata({ bankTransactionId });
|
|
14784
|
+
const { data: bankTransactionMetadata, mutate: mutateBankTransactionMetadata } = useBankTransactionMetadata({ bankTransactionId });
|
|
14731
14785
|
const form = useForm$1({
|
|
14732
14786
|
defaultValues: {
|
|
14733
14787
|
memo: bankTransactionMetadata == null ? void 0 : bankTransactionMetadata.memo
|
|
14734
14788
|
},
|
|
14735
14789
|
onSubmit: (_0) => __async(null, [_0], function* ({ value }) {
|
|
14736
|
-
var _a;
|
|
14790
|
+
var _a, _b;
|
|
14737
14791
|
if (value.memo !== void 0 && form.state.isDirty) {
|
|
14738
|
-
|
|
14739
|
-
|
|
14792
|
+
const result = yield mutateBankTransactionMetadata(
|
|
14793
|
+
updateBankTransactionMetadata2({ memo: (_a = value.memo) != null ? _a : "" }),
|
|
14794
|
+
{ optimisticData: { memo: (_b = value.memo) != null ? _b : "" }, revalidate: false }
|
|
14795
|
+
);
|
|
14796
|
+
if (result !== void 0) {
|
|
14797
|
+
form.reset(value);
|
|
14798
|
+
}
|
|
14740
14799
|
}
|
|
14741
14800
|
})
|
|
14742
14801
|
});
|
|
14743
|
-
|
|
14802
|
+
const isSaved = !isUpdatingMemo && !isErrorUpdatingMemo && updateResult !== void 0 && !form.state.isDirty;
|
|
14803
|
+
return useMemo(() => ({
|
|
14804
|
+
form,
|
|
14805
|
+
isUpdatingMemo,
|
|
14806
|
+
isErrorUpdatingMemo,
|
|
14807
|
+
isSaved
|
|
14808
|
+
}), [form, isErrorUpdatingMemo, isUpdatingMemo, isSaved]);
|
|
14744
14809
|
};
|
|
14745
14810
|
const Textarea = (_Pb) => {
|
|
14746
14811
|
var _Qb = _Pb, {
|
|
@@ -14763,24 +14828,26 @@ const Textarea = (_Pb) => {
|
|
|
14763
14828
|
] });
|
|
14764
14829
|
};
|
|
14765
14830
|
const BankTransactionMemo = ({ bankTransactionId }) => {
|
|
14766
|
-
const form = useBankTransactionMemo({ bankTransactionId });
|
|
14831
|
+
const { form, isUpdatingMemo, isErrorUpdatingMemo, isSaved } = useBankTransactionMemo({ bankTransactionId });
|
|
14767
14832
|
return /* @__PURE__ */ jsx("form", { onBlur: () => void form.handleSubmit(), children: /* @__PURE__ */ jsx(form.Field, { name: "memo", children: (field) => {
|
|
14768
14833
|
var _a;
|
|
14769
|
-
return /* @__PURE__ */
|
|
14770
|
-
|
|
14771
|
-
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
14775
|
-
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
14779
|
-
|
|
14780
|
-
|
|
14781
|
-
|
|
14782
|
-
|
|
14783
|
-
|
|
14834
|
+
return /* @__PURE__ */ jsxs(VStack, { gap: "3xs", children: [
|
|
14835
|
+
/* @__PURE__ */ jsxs(HStack, { justify: "space-between", align: "baseline", children: [
|
|
14836
|
+
/* @__PURE__ */ jsx(Label, { htmlFor: "memo", size: "sm", weight: "bold", children: "Description" }),
|
|
14837
|
+
isUpdatingMemo && /* @__PURE__ */ jsx(Span, { size: "sm", weight: "bold", variant: "subtle", children: "Saving..." }),
|
|
14838
|
+
!isUpdatingMemo && isSaved && /* @__PURE__ */ jsx(Span, { size: "sm", status: "success", children: "Saved" }),
|
|
14839
|
+
!isUpdatingMemo && !isSaved && isErrorUpdatingMemo && /* @__PURE__ */ jsx(Span, { size: "sm", weight: "bold", status: "error", children: "Error saving" })
|
|
14840
|
+
] }),
|
|
14841
|
+
/* @__PURE__ */ jsx(
|
|
14842
|
+
Textarea,
|
|
14843
|
+
{
|
|
14844
|
+
name: "memo",
|
|
14845
|
+
placeholder: "Add description",
|
|
14846
|
+
value: (_a = field.state.value) != null ? _a : void 0,
|
|
14847
|
+
onChange: (e) => field.handleChange(e.target.value)
|
|
14848
|
+
}
|
|
14849
|
+
)
|
|
14850
|
+
] });
|
|
14784
14851
|
} }) });
|
|
14785
14852
|
};
|
|
14786
14853
|
const range$1 = (start, end) => {
|
|
@@ -15920,10 +15987,7 @@ function BankTransactionFormFields({
|
|
|
15920
15987
|
isReadOnly
|
|
15921
15988
|
}
|
|
15922
15989
|
),
|
|
15923
|
-
showDescriptions && /* @__PURE__ */
|
|
15924
|
-
/* @__PURE__ */ jsx(Span, { size: "sm", weight: "bold", children: "Description" }),
|
|
15925
|
-
/* @__PURE__ */ jsx(BankTransactionMemo, { bankTransactionId: bankTransaction.id })
|
|
15926
|
-
] })
|
|
15990
|
+
showDescriptions && /* @__PURE__ */ jsx(VStack, { gap: "sm", children: /* @__PURE__ */ jsx(BankTransactionMemo, { bankTransactionId: bankTransaction.id }) })
|
|
15927
15991
|
] });
|
|
15928
15992
|
}
|
|
15929
15993
|
const ExpandedBankTransactionRow = forwardRef(
|
|
@@ -16152,8 +16216,7 @@ const ExpandedBankTransactionRow = forwardRef(
|
|
|
16152
16216
|
onSelectedValueChange: (value) => {
|
|
16153
16217
|
changeCategoryForSplitAtIndex(index, value);
|
|
16154
16218
|
},
|
|
16155
|
-
|
|
16156
|
-
isDisabled: !categorizationEnabled,
|
|
16219
|
+
isDisabled: !categorizationEnabled || bankTransaction.processing,
|
|
16157
16220
|
includeSuggestedMatches: false
|
|
16158
16221
|
}
|
|
16159
16222
|
),
|
|
@@ -16332,6 +16395,7 @@ const BankTransactionRow = ({
|
|
|
16332
16395
|
const { setTransactionCategory } = useBankTransactionsCategoryActions();
|
|
16333
16396
|
const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
|
|
16334
16397
|
const { saveBankTransactionRow } = useSaveBankTransactionRow();
|
|
16398
|
+
const displayAsCategorized = bankTransaction.recently_categorized && shouldHideAfterCategorize() ? false : categorized;
|
|
16335
16399
|
useEffect(() => {
|
|
16336
16400
|
if (bankTransaction.error) {
|
|
16337
16401
|
setShowRetry(true);
|
|
@@ -16474,12 +16538,12 @@ const BankTransactionRow = ({
|
|
|
16474
16538
|
className: "Layer__bank-transaction__submit-btn",
|
|
16475
16539
|
processing: bankTransaction.processing,
|
|
16476
16540
|
active: open,
|
|
16477
|
-
action:
|
|
16541
|
+
action: displayAsCategorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
|
|
16478
16542
|
disabled: selectedCategory === null,
|
|
16479
|
-
children:
|
|
16543
|
+
children: displayAsCategorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Confirm"
|
|
16480
16544
|
}
|
|
16481
16545
|
),
|
|
16482
|
-
!categorizationEnabled && !
|
|
16546
|
+
!categorizationEnabled && !displayAsCategorized && /* @__PURE__ */ jsx(VStack, { pis: "lg", fluid: true, children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }),
|
|
16483
16547
|
/* @__PURE__ */ jsx(
|
|
16484
16548
|
IconButton,
|
|
16485
16549
|
{
|
|
@@ -16501,7 +16565,7 @@ const BankTransactionRow = ({
|
|
|
16501
16565
|
variant: "fade",
|
|
16502
16566
|
isOpen: categorizationEnabled && !categorized,
|
|
16503
16567
|
className: "Layer__BankTransactionRow__CategoryComboBoxMotionContent",
|
|
16504
|
-
slotProps: { AnimatePresence: { mode: "wait" } },
|
|
16568
|
+
slotProps: { AnimatePresence: { mode: "wait", initial: false } },
|
|
16505
16569
|
children: /* @__PURE__ */ jsx(
|
|
16506
16570
|
BankTransactionCategoryComboBox,
|
|
16507
16571
|
{
|
|
@@ -16511,20 +16575,20 @@ const BankTransactionRow = ({
|
|
|
16511
16575
|
setTransactionCategory(bankTransaction.id, selectedCategory2);
|
|
16512
16576
|
setShowRetry(false);
|
|
16513
16577
|
},
|
|
16514
|
-
|
|
16578
|
+
isDisabled: bankTransaction.processing
|
|
16515
16579
|
}
|
|
16516
16580
|
)
|
|
16517
16581
|
},
|
|
16518
16582
|
"category-combobox"
|
|
16519
16583
|
),
|
|
16520
|
-
|
|
16584
|
+
displayAsCategorized && /* @__PURE__ */ jsx(
|
|
16521
16585
|
BankTransactionsCategorizedSelectedValue,
|
|
16522
16586
|
{
|
|
16523
16587
|
bankTransaction,
|
|
16524
16588
|
className: "Layer__bank-transaction-row__category"
|
|
16525
16589
|
}
|
|
16526
16590
|
),
|
|
16527
|
-
|
|
16591
|
+
!displayAsCategorized && categorizationEnabled && showRetry && /* @__PURE__ */ jsx(
|
|
16528
16592
|
RetryButton,
|
|
16529
16593
|
{
|
|
16530
16594
|
onClick: () => {
|
|
@@ -16538,7 +16602,7 @@ const BankTransactionRow = ({
|
|
|
16538
16602
|
children: "Retry"
|
|
16539
16603
|
}
|
|
16540
16604
|
),
|
|
16541
|
-
!
|
|
16605
|
+
!displayAsCategorized && categorizationEnabled && !showRetry && /* @__PURE__ */ jsx(
|
|
16542
16606
|
SubmitButton,
|
|
16543
16607
|
{
|
|
16544
16608
|
onClick: () => {
|
|
@@ -16550,11 +16614,11 @@ const BankTransactionRow = ({
|
|
|
16550
16614
|
processing: bankTransaction.processing,
|
|
16551
16615
|
active: open,
|
|
16552
16616
|
disabled: selectedCategory === null,
|
|
16553
|
-
action:
|
|
16554
|
-
children:
|
|
16617
|
+
action: displayAsCategorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
|
|
16618
|
+
children: displayAsCategorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Confirm"
|
|
16555
16619
|
}
|
|
16556
16620
|
),
|
|
16557
|
-
!categorizationEnabled && !
|
|
16621
|
+
!categorizationEnabled && !displayAsCategorized && /* @__PURE__ */ jsx(VStack, { pis: "xs", fluid: true, children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }),
|
|
16558
16622
|
/* @__PURE__ */ jsx(
|
|
16559
16623
|
IconButton,
|
|
16560
16624
|
{
|
|
@@ -16578,7 +16642,7 @@ const BankTransactionRow = ({
|
|
|
16578
16642
|
{
|
|
16579
16643
|
ref: expandedRowRef,
|
|
16580
16644
|
bankTransaction,
|
|
16581
|
-
categorized,
|
|
16645
|
+
categorized: displayAsCategorized,
|
|
16582
16646
|
isOpen: open,
|
|
16583
16647
|
close: () => setOpen(false),
|
|
16584
16648
|
containerWidth,
|
|
@@ -16684,6 +16748,7 @@ const BankTransactionsListItem = ({
|
|
|
16684
16748
|
const bookkeepingStatus = useEffectiveBookkeepingStatus();
|
|
16685
16749
|
const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
|
|
16686
16750
|
const categorized = isCategorized(bankTransaction);
|
|
16751
|
+
const displayAsCategorized = bankTransaction.recently_categorized && shouldHideAfterCategorize() ? false : categorized;
|
|
16687
16752
|
const { isVisible } = useDelayedVisibility({ delay: index * 80 });
|
|
16688
16753
|
const { select, deselect } = useBulkSelectionActions();
|
|
16689
16754
|
const isSelected = useIdIsSelected();
|
|
@@ -16780,7 +16845,7 @@ const BankTransactionsListItem = ({
|
|
|
16780
16845
|
}
|
|
16781
16846
|
)
|
|
16782
16847
|
] }),
|
|
16783
|
-
!categorizationEnabled && !
|
|
16848
|
+
!categorizationEnabled && !displayAsCategorized && /* @__PURE__ */ jsx("span", { className: "Layer__bank-transaction-list-item__processing-info", children: /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, {}) }),
|
|
16784
16849
|
/* @__PURE__ */ jsx("span", { className: "Layer__bank-transaction-list-item__expanded-row", onClick: preventRowExpansion, children: /* @__PURE__ */ jsx(AnimatedPresenceDiv, { variant: "expand", isOpen: openExpandedRow, children: /* @__PURE__ */ jsx(
|
|
16785
16850
|
ExpandedBankTransactionRow,
|
|
16786
16851
|
{
|
|
@@ -16788,9 +16853,9 @@ const BankTransactionsListItem = ({
|
|
|
16788
16853
|
bankTransaction,
|
|
16789
16854
|
isOpen: openExpandedRow,
|
|
16790
16855
|
close: () => setOpenExpandedRow(false),
|
|
16791
|
-
categorized,
|
|
16856
|
+
categorized: displayAsCategorized,
|
|
16792
16857
|
asListItem: true,
|
|
16793
|
-
submitBtnText:
|
|
16858
|
+
submitBtnText: displayAsCategorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Approve",
|
|
16794
16859
|
containerWidth,
|
|
16795
16860
|
showDescriptions,
|
|
16796
16861
|
showReceiptUploads,
|
|
@@ -16798,7 +16863,7 @@ const BankTransactionsListItem = ({
|
|
|
16798
16863
|
variant: "list"
|
|
16799
16864
|
}
|
|
16800
16865
|
) }, `expanded-${bankTransaction.id}`) }),
|
|
16801
|
-
!openExpandedRow && categorizationEnabled && !
|
|
16866
|
+
!openExpandedRow && categorizationEnabled && !displayAsCategorized && /* @__PURE__ */ jsx("div", { onClick: preventRowExpansion, children: /* @__PURE__ */ jsxs(HStack, { pi: "md", gap: "md", pb: "md", children: [
|
|
16802
16867
|
/* @__PURE__ */ jsx(
|
|
16803
16868
|
BankTransactionCategoryComboBox,
|
|
16804
16869
|
{
|
|
@@ -16808,7 +16873,7 @@ const BankTransactionsListItem = ({
|
|
|
16808
16873
|
setTransactionCategory(bankTransaction.id, selectedCategory2);
|
|
16809
16874
|
setShowRetry(false);
|
|
16810
16875
|
},
|
|
16811
|
-
|
|
16876
|
+
isDisabled: bankTransaction.processing
|
|
16812
16877
|
}
|
|
16813
16878
|
),
|
|
16814
16879
|
/* @__PURE__ */ jsx(
|
|
@@ -16818,14 +16883,14 @@ const BankTransactionsListItem = ({
|
|
|
16818
16883
|
onClick: handleSave,
|
|
16819
16884
|
className: showRetry ? "Layer__bank-transaction__retry-btn" : "Layer__bank-transaction__submit-btn",
|
|
16820
16885
|
processing: bankTransaction.processing,
|
|
16821
|
-
action: !
|
|
16886
|
+
action: !displayAsCategorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
|
|
16822
16887
|
withRetry: true,
|
|
16823
16888
|
error: showRetry ? "Approval failed. Check connection and retry in few seconds." : void 0,
|
|
16824
|
-
children: showRetry ? "Retry" : !
|
|
16889
|
+
children: showRetry ? "Retry" : !displayAsCategorized ? (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Approve" : (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update"
|
|
16825
16890
|
}
|
|
16826
16891
|
)
|
|
16827
16892
|
] }) }),
|
|
16828
|
-
!openExpandedRow &&
|
|
16893
|
+
!openExpandedRow && displayAsCategorized && /* @__PURE__ */ jsx(
|
|
16829
16894
|
BankTransactionsListItemCategory,
|
|
16830
16895
|
{
|
|
16831
16896
|
bankTransaction
|
|
@@ -17806,37 +17871,6 @@ const BankTransactionsMobileForms = ({
|
|
|
17806
17871
|
};
|
|
17807
17872
|
return /* @__PURE__ */ jsx(ReceiptsProvider, { bankTransaction, isActive: isOpen, children: getContent() });
|
|
17808
17873
|
};
|
|
17809
|
-
const NewToggleOption = ({
|
|
17810
|
-
label,
|
|
17811
|
-
value
|
|
17812
|
-
}) => {
|
|
17813
|
-
return /* @__PURE__ */ jsxs(ToggleButton, { id: value, className: "Layer__NewToggleOption", children: [
|
|
17814
|
-
/* @__PURE__ */ jsx(SelectionIndicator, { className: "Layer__NewToggleOption-SelectionIndicator" }),
|
|
17815
|
-
/* @__PURE__ */ jsx(Span, { className: "Layer__NewToggle-Option-Content", children: /* @__PURE__ */ jsx(Span, { noWrap: true, children: label }) })
|
|
17816
|
-
] });
|
|
17817
|
-
};
|
|
17818
|
-
const NewToggle = ({
|
|
17819
|
-
options: options2,
|
|
17820
|
-
selectedKey,
|
|
17821
|
-
onSelectionChange
|
|
17822
|
-
}) => {
|
|
17823
|
-
const selectedKeys = selectedKey !== void 0 ? /* @__PURE__ */ new Set([selectedKey]) : /* @__PURE__ */ new Set();
|
|
17824
|
-
return /* @__PURE__ */ jsx(
|
|
17825
|
-
ToggleButtonGroup,
|
|
17826
|
-
{
|
|
17827
|
-
className: "Layer__NewToggle",
|
|
17828
|
-
selectionMode: "single",
|
|
17829
|
-
selectedKeys,
|
|
17830
|
-
onSelectionChange: (keys) => {
|
|
17831
|
-
const selectedKeysArray = Array.from(keys);
|
|
17832
|
-
if (selectedKeysArray.length > 0 && onSelectionChange) {
|
|
17833
|
-
onSelectionChange(selectedKeysArray[0]);
|
|
17834
|
-
}
|
|
17835
|
-
},
|
|
17836
|
-
children: options2.map((option) => /* @__PURE__ */ jsx(NewToggleOption, __spreadValues({}, option), option.value))
|
|
17837
|
-
}
|
|
17838
|
-
);
|
|
17839
|
-
};
|
|
17840
17874
|
const PURPOSE_TOGGLE_OPTIONS = [
|
|
17841
17875
|
{
|
|
17842
17876
|
value: "business",
|
|
@@ -17950,6 +17984,7 @@ const BankTransactionsMobileListItem = ({
|
|
|
17950
17984
|
const { shouldHideAfterCategorize } = useBankTransactionsContext();
|
|
17951
17985
|
const categorized = isCategorized(bankTransaction);
|
|
17952
17986
|
const itemRef = useRef(null);
|
|
17987
|
+
const displayAsCategorized = bankTransaction.recently_categorized && shouldHideAfterCategorize() ? false : categorized;
|
|
17953
17988
|
const [open, setOpen] = useState(isFirstItem);
|
|
17954
17989
|
const openNext = () => {
|
|
17955
17990
|
if (editable && itemRef.current && itemRef.current.nextSibling) {
|
|
@@ -18036,11 +18071,11 @@ const BankTransactionsMobileListItem = ({
|
|
|
18036
18071
|
const isTransactionSelected = isSelected(bankTransaction.id);
|
|
18037
18072
|
const { renderInAppLink } = useInAppLinkContext();
|
|
18038
18073
|
const inAppLink = useMemo(() => {
|
|
18039
|
-
if (!
|
|
18074
|
+
if (!displayAsCategorized) {
|
|
18040
18075
|
return null;
|
|
18041
18076
|
}
|
|
18042
18077
|
return getInAppLink(bankTransaction, renderInAppLink);
|
|
18043
|
-
}, [
|
|
18078
|
+
}, [displayAsCategorized, bankTransaction, renderInAppLink]);
|
|
18044
18079
|
const { isVisible } = useDelayedVisibility({ delay: index * 20, initialVisibility: Boolean(initialLoad) });
|
|
18045
18080
|
const className = "Layer__bank-transaction-mobile-list-item";
|
|
18046
18081
|
const openClassName = open ? `${className}--expanded` : "";
|
|
@@ -18107,7 +18142,7 @@ const BankTransactionsMobileListItem = ({
|
|
|
18107
18142
|
]
|
|
18108
18143
|
}
|
|
18109
18144
|
),
|
|
18110
|
-
!open && (!categorizationEnabled && !
|
|
18145
|
+
!open && (!categorizationEnabled && !displayAsCategorized ? /* @__PURE__ */ jsx(BankTransactionsProcessingInfo, { showAsBadge: true }) : /* @__PURE__ */ jsx(
|
|
18111
18146
|
BankTransactionsListItemCategory,
|
|
18112
18147
|
{
|
|
18113
18148
|
bankTransaction,
|