@layerfi/components 0.1.102-alpha.1 → 0.1.102-alpha.2
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 +190 -221
- package/dist/esm/index.mjs +167 -198
- package/dist/index.css +4 -2
- package/dist/index.d.ts +31 -3
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -5602,7 +5602,7 @@ var import_react18 = require("react");
|
|
|
5602
5602
|
var import_react16 = require("react");
|
|
5603
5603
|
|
|
5604
5604
|
// package.json
|
|
5605
|
-
var version = "0.1.102-alpha.
|
|
5605
|
+
var version = "0.1.102-alpha.2";
|
|
5606
5606
|
|
|
5607
5607
|
// src/models/APIError.ts
|
|
5608
5608
|
var APIError = class _APIError extends Error {
|
|
@@ -10448,7 +10448,7 @@ var OnboardingContent = ({
|
|
|
10448
10448
|
};
|
|
10449
10449
|
|
|
10450
10450
|
// src/components/LinkedAccounts/LinkedAccounts.tsx
|
|
10451
|
-
var
|
|
10451
|
+
var import_react52 = require("react");
|
|
10452
10452
|
|
|
10453
10453
|
// src/components/Loader/Loader.tsx
|
|
10454
10454
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
@@ -10473,7 +10473,7 @@ var SmallLoader = ({ size = 28 }) => {
|
|
|
10473
10473
|
};
|
|
10474
10474
|
|
|
10475
10475
|
// src/components/LinkedAccounts/LinkedAccountsContent.tsx
|
|
10476
|
-
var
|
|
10476
|
+
var import_react45 = require("react");
|
|
10477
10477
|
|
|
10478
10478
|
// src/icons/PlusIcon.tsx
|
|
10479
10479
|
var import_jsx_runtime55 = require("react/jsx-runtime");
|
|
@@ -11347,7 +11347,7 @@ var LinkedAccountItemThumb = ({
|
|
|
11347
11347
|
var import_classnames24 = __toESM(require("classnames"));
|
|
11348
11348
|
|
|
11349
11349
|
// src/components/LinkedAccounts/ConfirmationModal/LinkedAccountsConfirmationModal.tsx
|
|
11350
|
-
var
|
|
11350
|
+
var import_react44 = require("react");
|
|
11351
11351
|
|
|
11352
11352
|
// src/components/ui/Modal/Modal.tsx
|
|
11353
11353
|
var import_react38 = require("react");
|
|
@@ -11533,20 +11533,34 @@ function ModalActions({ children }) {
|
|
|
11533
11533
|
}
|
|
11534
11534
|
|
|
11535
11535
|
// src/components/ui/Stack/Stack.tsx
|
|
11536
|
+
var import_react42 = require("react");
|
|
11536
11537
|
var import_classnames22 = __toESM(require("classnames"));
|
|
11537
11538
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
11538
11539
|
var CLASS_NAME2 = "Layer__Stack";
|
|
11539
|
-
|
|
11540
|
-
|
|
11541
|
-
|
|
11542
|
-
|
|
11543
|
-
|
|
11544
|
-
|
|
11545
|
-
|
|
11546
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11540
|
+
var Stack = (0, import_react42.forwardRef)(
|
|
11541
|
+
(_a, ref) => {
|
|
11542
|
+
var _b = _a, { align, children, direction, gap, justify, pbs, pbe, pis, pie, fluid, className } = _b, restProps = __objRest(_b, ["align", "children", "direction", "gap", "justify", "pbs", "pbe", "pis", "pie", "fluid", "className"]);
|
|
11543
|
+
const dataProperties = toDataProperties({ align, direction, gap, justify, pbs, pbe, pis, pie, fluid });
|
|
11544
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
|
|
11545
|
+
"div",
|
|
11546
|
+
__spreadProps(__spreadValues(__spreadValues({
|
|
11547
|
+
ref
|
|
11548
|
+
}, restProps), dataProperties), {
|
|
11549
|
+
className: (0, import_classnames22.default)(CLASS_NAME2, className),
|
|
11550
|
+
children
|
|
11551
|
+
})
|
|
11552
|
+
);
|
|
11553
|
+
}
|
|
11554
|
+
);
|
|
11555
|
+
Stack.displayName = "Stack";
|
|
11556
|
+
var VStack = (0, import_react42.forwardRef)((props, ref) => {
|
|
11557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Stack, __spreadProps(__spreadValues({}, props), { ref, direction: "column" }));
|
|
11558
|
+
});
|
|
11559
|
+
VStack.displayName = "VStack";
|
|
11560
|
+
var HStack = (0, import_react42.forwardRef)((props, ref) => {
|
|
11561
|
+
return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Stack, __spreadProps(__spreadValues({}, props), { ref, direction: "row" }));
|
|
11562
|
+
});
|
|
11563
|
+
HStack.displayName = "HStack";
|
|
11550
11564
|
var Spacer = () => /* @__PURE__ */ (0, import_jsx_runtime71.jsx)("div", { className: "Layer__Spacer" });
|
|
11551
11565
|
|
|
11552
11566
|
// src/components/utility/ConditionalList.tsx
|
|
@@ -11576,14 +11590,14 @@ function ConditionalList({
|
|
|
11576
11590
|
|
|
11577
11591
|
// src/components/ui/Checkbox/Checkbox.tsx
|
|
11578
11592
|
var import_lucide_react4 = require("lucide-react");
|
|
11579
|
-
var
|
|
11593
|
+
var import_react43 = require("react");
|
|
11580
11594
|
var import_react_aria_components8 = require("react-aria-components");
|
|
11581
11595
|
var import_classnames23 = __toESM(require("classnames"));
|
|
11582
11596
|
var import_jsx_runtime73 = require("react/jsx-runtime");
|
|
11583
11597
|
var CLASS_NAME3 = "Layer__Checkbox";
|
|
11584
11598
|
function Checkbox(_a) {
|
|
11585
11599
|
var _b = _a, { children, className, variant = "default", size = "md" } = _b, props = __objRest(_b, ["children", "className", "variant", "size"]);
|
|
11586
|
-
const dataProperties = (0,
|
|
11600
|
+
const dataProperties = (0, import_react43.useMemo)(() => toDataProperties({
|
|
11587
11601
|
size,
|
|
11588
11602
|
variant,
|
|
11589
11603
|
labeled: typeof children === "string" && children.length > 0
|
|
@@ -11803,7 +11817,7 @@ function LinkedAccountsConfirmationModalPreloadedContent({ onClose }) {
|
|
|
11803
11817
|
}
|
|
11804
11818
|
function LinkedAccountsConfirmationModalContent({ onClose }) {
|
|
11805
11819
|
const { accounts, onFinish, refetchAccounts } = useLinkedAccountsConfirmationModal();
|
|
11806
|
-
const [formState, setFormState] = (0,
|
|
11820
|
+
const [formState, setFormState] = (0, import_react44.useState)(() => Object.fromEntries(
|
|
11807
11821
|
accounts.map(({ id }) => [id, true])
|
|
11808
11822
|
));
|
|
11809
11823
|
const { trigger, isMutating, error } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
|
|
@@ -11875,7 +11889,7 @@ var LinkedAccountsContent = ({
|
|
|
11875
11889
|
showUnlinkItem,
|
|
11876
11890
|
showBreakConnection
|
|
11877
11891
|
}) => {
|
|
11878
|
-
const { data, addConnection } = (0,
|
|
11892
|
+
const { data, addConnection } = (0, import_react45.useContext)(LinkedAccountsContext);
|
|
11879
11893
|
const linkedAccountsNewAccountClassName = (0, import_classnames24.default)(
|
|
11880
11894
|
"Layer__linked-accounts__new-account",
|
|
11881
11895
|
asWidget && "--as-widget",
|
|
@@ -11916,7 +11930,7 @@ var LinkedAccountsContent = ({
|
|
|
11916
11930
|
};
|
|
11917
11931
|
|
|
11918
11932
|
// src/components/LinkedAccounts/OpeningBalanceModal/OpeningBalanceModal.tsx
|
|
11919
|
-
var
|
|
11933
|
+
var import_react51 = require("react");
|
|
11920
11934
|
|
|
11921
11935
|
// src/utils/business.ts
|
|
11922
11936
|
var import_date_fns6 = require("date-fns");
|
|
@@ -11949,7 +11963,7 @@ var isDateAllowedToBrowse = (date, business) => {
|
|
|
11949
11963
|
};
|
|
11950
11964
|
|
|
11951
11965
|
// src/components/LinkedAccounts/AccountFormBox/AccountFormBox.tsx
|
|
11952
|
-
var
|
|
11966
|
+
var import_react50 = require("react");
|
|
11953
11967
|
|
|
11954
11968
|
// src/components/Input/Input.tsx
|
|
11955
11969
|
var import_classnames25 = __toESM(require("classnames"));
|
|
@@ -12012,7 +12026,7 @@ var InputGroup = ({
|
|
|
12012
12026
|
};
|
|
12013
12027
|
|
|
12014
12028
|
// src/components/Input/FileInput.tsx
|
|
12015
|
-
var
|
|
12029
|
+
var import_react46 = require("react");
|
|
12016
12030
|
|
|
12017
12031
|
// src/icons/UploadCloud.tsx
|
|
12018
12032
|
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
@@ -12081,7 +12095,7 @@ var FileInput = ({
|
|
|
12081
12095
|
icon,
|
|
12082
12096
|
allowMultipleUploads = false
|
|
12083
12097
|
}) => {
|
|
12084
|
-
const hiddenFileInput = (0,
|
|
12098
|
+
const hiddenFileInput = (0, import_react46.useRef)(null);
|
|
12085
12099
|
const onClick = () => {
|
|
12086
12100
|
if (hiddenFileInput.current) {
|
|
12087
12101
|
hiddenFileInput.current.click();
|
|
@@ -12134,7 +12148,7 @@ var FileInput = ({
|
|
|
12134
12148
|
};
|
|
12135
12149
|
|
|
12136
12150
|
// src/components/Input/Select.tsx
|
|
12137
|
-
var
|
|
12151
|
+
var import_react47 = require("react");
|
|
12138
12152
|
var import_react_select = __toESM(require("react-select"));
|
|
12139
12153
|
|
|
12140
12154
|
// src/icons/ChevronDownFill.tsx
|
|
@@ -12189,7 +12203,7 @@ var Select = ({
|
|
|
12189
12203
|
isInvalid ? "Layer__select--error" : "",
|
|
12190
12204
|
className
|
|
12191
12205
|
);
|
|
12192
|
-
const DropdownIndicator2 = (0,
|
|
12206
|
+
const DropdownIndicator2 = (0, import_react47.useCallback)((props) => /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(import_react_select.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(ChevronDownFill_default, {}) })), []);
|
|
12193
12207
|
return /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
|
|
12194
12208
|
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
12195
12209
|
import_react_select.default,
|
|
@@ -12216,42 +12230,9 @@ var Select = ({
|
|
|
12216
12230
|
// src/components/Input/InputWithBadge.tsx
|
|
12217
12231
|
var import_classnames28 = __toESM(require("classnames"));
|
|
12218
12232
|
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
12219
|
-
var InputWithBadge = (_a) => {
|
|
12220
|
-
var _b = _a, {
|
|
12221
|
-
className,
|
|
12222
|
-
isInvalid,
|
|
12223
|
-
errorMessage,
|
|
12224
|
-
leftText,
|
|
12225
|
-
badge,
|
|
12226
|
-
variant = "default" /* DEFAULT */
|
|
12227
|
-
} = _b, props = __objRest(_b, [
|
|
12228
|
-
"className",
|
|
12229
|
-
"isInvalid",
|
|
12230
|
-
"errorMessage",
|
|
12231
|
-
"leftText",
|
|
12232
|
-
"badge",
|
|
12233
|
-
"variant"
|
|
12234
|
-
]);
|
|
12235
|
-
const baseClassName = (0, import_classnames28.default)(
|
|
12236
|
-
"Layer__input",
|
|
12237
|
-
isInvalid ? "Layer__input--error" : "",
|
|
12238
|
-
leftText ? "Layer__input--with-left-text" : "",
|
|
12239
|
-
className
|
|
12240
|
-
);
|
|
12241
|
-
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
|
|
12242
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(TooltipTrigger, { className: "Layer__input-tooltip", children: [
|
|
12243
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "Layer__input-with-badge", children: [
|
|
12244
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("input", __spreadProps(__spreadValues({}, props), { className: baseClassName })),
|
|
12245
|
-
badge && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Badge, { variant, children: badge })
|
|
12246
|
-
] }),
|
|
12247
|
-
leftText && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "Layer__input-left-text", children: leftText })
|
|
12248
|
-
] }),
|
|
12249
|
-
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(TooltipContent, { className: "Layer__tooltip", children: errorMessage })
|
|
12250
|
-
] });
|
|
12251
|
-
};
|
|
12252
12233
|
|
|
12253
12234
|
// src/components/Input/MultiSelect.tsx
|
|
12254
|
-
var
|
|
12235
|
+
var import_react48 = require("react");
|
|
12255
12236
|
var import_react_select2 = __toESM(require("react-select"));
|
|
12256
12237
|
var import_classnames29 = __toESM(require("classnames"));
|
|
12257
12238
|
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
@@ -12276,7 +12257,7 @@ var MultiSelect = ({
|
|
|
12276
12257
|
isInvalid ? "Layer__select--error" : "",
|
|
12277
12258
|
className
|
|
12278
12259
|
);
|
|
12279
|
-
const DropdownIndicator2 = (0,
|
|
12260
|
+
const DropdownIndicator2 = (0, import_react48.useCallback)((props) => /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(import_react_select2.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(ChevronDownFill_default, {}) })), []);
|
|
12280
12261
|
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
|
|
12281
12262
|
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
12282
12263
|
import_react_select2.default,
|
|
@@ -12315,6 +12296,7 @@ var AmountInput = (_a) => {
|
|
|
12315
12296
|
leftText,
|
|
12316
12297
|
errorMessage,
|
|
12317
12298
|
isInvalid,
|
|
12299
|
+
badge,
|
|
12318
12300
|
placeholder = "$0.00"
|
|
12319
12301
|
} = _b, props = __objRest(_b, [
|
|
12320
12302
|
"onChange",
|
|
@@ -12322,30 +12304,38 @@ var AmountInput = (_a) => {
|
|
|
12322
12304
|
"leftText",
|
|
12323
12305
|
"errorMessage",
|
|
12324
12306
|
"isInvalid",
|
|
12307
|
+
"badge",
|
|
12325
12308
|
"placeholder"
|
|
12326
12309
|
]);
|
|
12327
12310
|
const baseClassName = (0, import_classnames30.default)(
|
|
12328
12311
|
"Layer__input Layer__amount-input",
|
|
12312
|
+
badge ? "Layer__amount-input--align-left" : "Layer__amount-input--align-right",
|
|
12329
12313
|
isInvalid ? "Layer__input--error" : "",
|
|
12330
12314
|
leftText ? "Layer__input--with-left-text" : "",
|
|
12331
12315
|
className
|
|
12332
12316
|
);
|
|
12317
|
+
const currencyInput = /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
12318
|
+
import_react_currency_input_field.default,
|
|
12319
|
+
__spreadProps(__spreadValues({}, props), {
|
|
12320
|
+
intlConfig: {
|
|
12321
|
+
locale: "en-US",
|
|
12322
|
+
currency: "USD"
|
|
12323
|
+
},
|
|
12324
|
+
prefix: "$",
|
|
12325
|
+
placeholder,
|
|
12326
|
+
decimalScale: 2,
|
|
12327
|
+
decimalsLimit: 2,
|
|
12328
|
+
disableAbbreviations: true,
|
|
12329
|
+
onValueChange: onChange,
|
|
12330
|
+
className: baseClassName
|
|
12331
|
+
})
|
|
12332
|
+
);
|
|
12333
12333
|
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
|
|
12334
12334
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsxs)(TooltipTrigger, { className: "Layer__input-tooltip", children: [
|
|
12335
|
-
/* @__PURE__ */ (0, import_jsx_runtime86.
|
|
12336
|
-
|
|
12337
|
-
|
|
12338
|
-
|
|
12339
|
-
locale: "en-US",
|
|
12340
|
-
currency: "USD"
|
|
12341
|
-
},
|
|
12342
|
-
prefix: "$",
|
|
12343
|
-
placeholder,
|
|
12344
|
-
decimalsLimit: 2,
|
|
12345
|
-
onValueChange: onChange,
|
|
12346
|
-
className: baseClassName
|
|
12347
|
-
})
|
|
12348
|
-
),
|
|
12335
|
+
badge ? /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: "Layer__input-with-badge", children: [
|
|
12336
|
+
currencyInput,
|
|
12337
|
+
badge
|
|
12338
|
+
] }) : currencyInput,
|
|
12349
12339
|
leftText && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("span", { className: "Layer__input-left-text", children: leftText })
|
|
12350
12340
|
] }),
|
|
12351
12341
|
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(TooltipContent, { className: "Layer__tooltip", children: errorMessage })
|
|
@@ -12353,7 +12343,7 @@ var AmountInput = (_a) => {
|
|
|
12353
12343
|
};
|
|
12354
12344
|
|
|
12355
12345
|
// src/components/DatePicker/DatePicker.tsx
|
|
12356
|
-
var
|
|
12346
|
+
var import_react49 = require("react");
|
|
12357
12347
|
var RDP = __toESM(require("react-datepicker"));
|
|
12358
12348
|
|
|
12359
12349
|
// src/icons/ChevronLeft.tsx
|
|
@@ -12524,8 +12514,8 @@ var DatePicker = (_a) => {
|
|
|
12524
12514
|
"slots"
|
|
12525
12515
|
]);
|
|
12526
12516
|
const { ModeSelector } = slots != null ? slots : {};
|
|
12527
|
-
const pickerRef = (0,
|
|
12528
|
-
const pickerMode = (0,
|
|
12517
|
+
const pickerRef = (0, import_react49.useRef)(null);
|
|
12518
|
+
const pickerMode = (0, import_react49.useMemo)(() => {
|
|
12529
12519
|
var _a2;
|
|
12530
12520
|
if (!allowedModes) {
|
|
12531
12521
|
return displayMode;
|
|
@@ -12538,7 +12528,7 @@ var DatePicker = (_a) => {
|
|
|
12538
12528
|
}
|
|
12539
12529
|
return (_a2 = allowedModes[0]) != null ? _a2 : displayMode;
|
|
12540
12530
|
}, [displayMode, allowedModes]);
|
|
12541
|
-
const [firstDate, secondDate] = (0,
|
|
12531
|
+
const [firstDate, secondDate] = (0, import_react49.useMemo)(() => {
|
|
12542
12532
|
if (selected instanceof Date) {
|
|
12543
12533
|
return [selected, null];
|
|
12544
12534
|
}
|
|
@@ -12567,8 +12557,8 @@ var DatePicker = (_a) => {
|
|
|
12567
12557
|
displayMode === "timePicker" && "Layer__datepicker__time__popper",
|
|
12568
12558
|
popperClassName
|
|
12569
12559
|
);
|
|
12570
|
-
const [internalStart, setInternalStart] = (0,
|
|
12571
|
-
const [internalEnd, setInternalEnd] = (0,
|
|
12560
|
+
const [internalStart, setInternalStart] = (0, import_react49.useState)(null);
|
|
12561
|
+
const [internalEnd, setInternalEnd] = (0, import_react49.useState)(null);
|
|
12572
12562
|
const isMidSelection = internalStart !== null && internalEnd === null;
|
|
12573
12563
|
const handleDateChange = (selectedDate) => {
|
|
12574
12564
|
if (selectedDate instanceof Date) {
|
|
@@ -12623,7 +12613,7 @@ var DatePicker = (_a) => {
|
|
|
12623
12613
|
break;
|
|
12624
12614
|
}
|
|
12625
12615
|
};
|
|
12626
|
-
const isTodayOrAfter = (0,
|
|
12616
|
+
const isTodayOrAfter = (0, import_react49.useMemo)(() => {
|
|
12627
12617
|
switch (displayMode) {
|
|
12628
12618
|
case "dayPicker":
|
|
12629
12619
|
return firstDate >= (0, import_date_fns8.endOfDay)(/* @__PURE__ */ new Date()) || maxDate && firstDate >= maxDate;
|
|
@@ -12803,7 +12793,7 @@ var AccountFormBox = ({
|
|
|
12803
12793
|
errors = []
|
|
12804
12794
|
}) => {
|
|
12805
12795
|
var _a, _b, _c, _d, _e;
|
|
12806
|
-
const dataProps = (0,
|
|
12796
|
+
const dataProps = (0, import_react50.useMemo)(() => toDataProperties({
|
|
12807
12797
|
saved: isSaved,
|
|
12808
12798
|
confirmed: value.isConfirmed
|
|
12809
12799
|
}), [isSaved, value.isConfirmed]);
|
|
@@ -13015,10 +13005,14 @@ var humanizeEnum = (text) => {
|
|
|
13015
13005
|
};
|
|
13016
13006
|
var convertNumberToCurrency = (amount) => {
|
|
13017
13007
|
if (typeof amount !== "number" || isNaN(amount)) return "";
|
|
13018
|
-
const formattedValue = amount.toLocaleString("en-US"
|
|
13019
|
-
|
|
13008
|
+
const formattedValue = amount.toLocaleString("en-US", {
|
|
13009
|
+
style: "currency",
|
|
13010
|
+
currency: "USD",
|
|
13011
|
+
minimumFractionDigits: 2,
|
|
13012
|
+
maximumFractionDigits: 2
|
|
13013
|
+
});
|
|
13014
|
+
return formattedValue;
|
|
13020
13015
|
};
|
|
13021
|
-
var convertCurrencyToNumber = (amount) => amount.replace("$", "").replace(",", "").replace(/[^\d.]/g, "").replace(/(?!^)-/g, "").replace(/(\..*)\./g, "$1").replace(/(\.\d{2})\d+/, "$1").replace(/^0(?!\.)/, "");
|
|
13022
13016
|
var convertToCents = (amount) => {
|
|
13023
13017
|
try {
|
|
13024
13018
|
if (amount === void 0 || amount === null) {
|
|
@@ -13090,9 +13084,9 @@ function LinkedAccountsOpeningBalanceModalContent({
|
|
|
13090
13084
|
var _a, _b;
|
|
13091
13085
|
const { business } = useLayerContext();
|
|
13092
13086
|
const { refetchAccounts } = useLinkedAccounts();
|
|
13093
|
-
const [touched, setTouched] = (0,
|
|
13094
|
-
const [results, setResults] = (0,
|
|
13095
|
-
const [formsData, setFormsData] = (0,
|
|
13087
|
+
const [touched, setTouched] = (0, import_react51.useState)(false);
|
|
13088
|
+
const [results, setResults] = (0, import_react51.useState)({});
|
|
13089
|
+
const [formsData, setFormsData] = (0, import_react51.useState)(accounts.map((item) => {
|
|
13096
13090
|
var _a2;
|
|
13097
13091
|
return {
|
|
13098
13092
|
account: item,
|
|
@@ -13100,7 +13094,7 @@ function LinkedAccountsOpeningBalanceModalContent({
|
|
|
13100
13094
|
openingDate: (_a2 = getActivationDate(business)) != null ? _a2 : (0, import_date_fns11.startOfYear)(/* @__PURE__ */ new Date())
|
|
13101
13095
|
};
|
|
13102
13096
|
}));
|
|
13103
|
-
const formsDataToSave = (0,
|
|
13097
|
+
const formsDataToSave = (0, import_react51.useMemo)(
|
|
13104
13098
|
() => ignoreAlreadySaved(formsData, results),
|
|
13105
13099
|
[formsData, results]
|
|
13106
13100
|
);
|
|
@@ -13167,7 +13161,7 @@ function OpeningBalanceModal({
|
|
|
13167
13161
|
const {
|
|
13168
13162
|
accountsToAddOpeningBalanceInModal,
|
|
13169
13163
|
setAccountsToAddOpeningBalanceInModal
|
|
13170
|
-
} = (0,
|
|
13164
|
+
} = (0, import_react51.useContext)(LinkedAccountsContext);
|
|
13171
13165
|
const shouldShowModal = Boolean(accountsToAddOpeningBalanceInModal.length);
|
|
13172
13166
|
if (!shouldShowModal) {
|
|
13173
13167
|
return null;
|
|
@@ -13214,7 +13208,7 @@ var LinkedAccountsComponent = ({
|
|
|
13214
13208
|
error,
|
|
13215
13209
|
isValidating,
|
|
13216
13210
|
refetchAccounts
|
|
13217
|
-
} = (0,
|
|
13211
|
+
} = (0, import_react52.useContext)(LinkedAccountsContext);
|
|
13218
13212
|
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(Container, { name: COMPONENT_NAME, elevated, children: [
|
|
13219
13213
|
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(Header, { className: "Layer__linked-accounts__header", children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
13220
13214
|
Heading,
|
|
@@ -13252,33 +13246,33 @@ var LinkedAccountsComponent = ({
|
|
|
13252
13246
|
var import_react62 = require("react");
|
|
13253
13247
|
|
|
13254
13248
|
// src/components/Wizard/Wizard.tsx
|
|
13255
|
-
var
|
|
13249
|
+
var import_react53 = require("react");
|
|
13256
13250
|
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
13257
13251
|
function useWizardStep({
|
|
13258
13252
|
steps,
|
|
13259
13253
|
onComplete
|
|
13260
13254
|
}) {
|
|
13261
13255
|
const stepCount = steps.length;
|
|
13262
|
-
const [activeStepIndex, setActiveStepIndex] = (0,
|
|
13263
|
-
const next = (0,
|
|
13256
|
+
const [activeStepIndex, setActiveStepIndex] = (0, import_react53.useState)(0);
|
|
13257
|
+
const next = (0, import_react53.useCallback)(() => __async(null, null, function* () {
|
|
13264
13258
|
setActiveStepIndex((stepIndex) => Math.min(stepIndex + 1, stepCount - 1));
|
|
13265
13259
|
if (activeStepIndex === stepCount - 1 && onComplete) {
|
|
13266
13260
|
yield onComplete == null ? void 0 : onComplete();
|
|
13267
13261
|
}
|
|
13268
13262
|
}), [stepCount, activeStepIndex, onComplete]);
|
|
13269
|
-
const previous = (0,
|
|
13263
|
+
const previous = (0, import_react53.useCallback)(() => setActiveStepIndex((stepIndex) => Math.max(stepIndex - 1, 0)), []);
|
|
13270
13264
|
const effectiveStepIndex = Math.min(activeStepIndex, stepCount - 1);
|
|
13271
13265
|
const currentStep = steps.at(effectiveStepIndex);
|
|
13272
13266
|
return { currentStep, next, previous };
|
|
13273
13267
|
}
|
|
13274
|
-
var WizardContext = (0,
|
|
13268
|
+
var WizardContext = (0, import_react53.createContext)({
|
|
13275
13269
|
next: () => {
|
|
13276
13270
|
},
|
|
13277
13271
|
previous: () => {
|
|
13278
13272
|
}
|
|
13279
13273
|
});
|
|
13280
13274
|
function useWizard() {
|
|
13281
|
-
return (0,
|
|
13275
|
+
return (0, import_react53.useContext)(WizardContext);
|
|
13282
13276
|
}
|
|
13283
13277
|
function Wizard({
|
|
13284
13278
|
Header: Header4,
|
|
@@ -13286,12 +13280,12 @@ function Wizard({
|
|
|
13286
13280
|
onComplete,
|
|
13287
13281
|
children
|
|
13288
13282
|
}) {
|
|
13289
|
-
const childrenArray =
|
|
13283
|
+
const childrenArray = import_react53.Children.toArray(children);
|
|
13290
13284
|
const { currentStep, next, previous } = useWizardStep({
|
|
13291
13285
|
steps: childrenArray,
|
|
13292
13286
|
onComplete
|
|
13293
13287
|
});
|
|
13294
|
-
const value = (0,
|
|
13288
|
+
const value = (0, import_react53.useMemo)(() => ({ next, previous }), [next, previous]);
|
|
13295
13289
|
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(WizardContext.Provider, { value, children: [
|
|
13296
13290
|
Header4,
|
|
13297
13291
|
currentStep,
|
|
@@ -13300,7 +13294,7 @@ function Wizard({
|
|
|
13300
13294
|
}
|
|
13301
13295
|
|
|
13302
13296
|
// src/components/UploadTransactions/UploadTransactionsUploadCsvStep.tsx
|
|
13303
|
-
var
|
|
13297
|
+
var import_react59 = require("react");
|
|
13304
13298
|
|
|
13305
13299
|
// src/hooks/customAccounts/useCustomAccounts.ts
|
|
13306
13300
|
var import_swr8 = __toESM(require("swr"));
|
|
@@ -13355,7 +13349,7 @@ function useCustomAccounts() {
|
|
|
13355
13349
|
}
|
|
13356
13350
|
|
|
13357
13351
|
// src/components/Input/CreatableSelect.tsx
|
|
13358
|
-
var
|
|
13352
|
+
var import_react54 = require("react");
|
|
13359
13353
|
var import_react_select3 = require("react-select");
|
|
13360
13354
|
var import_creatable = __toESM(require("react-select/creatable"));
|
|
13361
13355
|
var import_classnames32 = __toESM(require("classnames"));
|
|
@@ -13383,7 +13377,7 @@ var CreatableSelect = ({
|
|
|
13383
13377
|
isInvalid ? "Layer__select--error" : "",
|
|
13384
13378
|
className
|
|
13385
13379
|
);
|
|
13386
|
-
const DropdownIndicator2 = (0,
|
|
13380
|
+
const DropdownIndicator2 = (0, import_react54.useCallback)((props) => /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_select3.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(ChevronDownFill_default, {}) })), []);
|
|
13387
13381
|
return /* @__PURE__ */ (0, import_jsx_runtime94.jsxs)(Tooltip, { disabled: !isInvalid || !errorMessage, children: [
|
|
13388
13382
|
/* @__PURE__ */ (0, import_jsx_runtime94.jsx)(TooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
13389
13383
|
import_creatable.default,
|
|
@@ -13413,7 +13407,7 @@ var CreatableSelect = ({
|
|
|
13413
13407
|
};
|
|
13414
13408
|
|
|
13415
13409
|
// src/components/CustomAccountForm/CustomAccountForm.tsx
|
|
13416
|
-
var
|
|
13410
|
+
var import_react57 = require("react");
|
|
13417
13411
|
|
|
13418
13412
|
// src/utils/form.ts
|
|
13419
13413
|
var notEmpty = (value) => {
|
|
@@ -13430,11 +13424,11 @@ var validateEmailFormat = (email, required = false) => {
|
|
|
13430
13424
|
};
|
|
13431
13425
|
|
|
13432
13426
|
// src/components/CustomAccountForm/useCustomAccountForm.ts
|
|
13433
|
-
var
|
|
13427
|
+
var import_react56 = require("react");
|
|
13434
13428
|
var import_react_form = require("@tanstack/react-form");
|
|
13435
13429
|
|
|
13436
13430
|
// src/hooks/customAccounts/useCreateCustomAccount.ts
|
|
13437
|
-
var
|
|
13431
|
+
var import_react55 = require("react");
|
|
13438
13432
|
var import_mutation5 = __toESM(require("swr/mutation"));
|
|
13439
13433
|
var import_swr9 = require("swr");
|
|
13440
13434
|
var createCustomAccount = post(({ businessId }) => `/v1/businesses/${businessId}/custom-accounts`);
|
|
@@ -13473,7 +13467,7 @@ function useCreateCustomAccount() {
|
|
|
13473
13467
|
}
|
|
13474
13468
|
);
|
|
13475
13469
|
const { trigger: originalTrigger } = mutationResponse;
|
|
13476
|
-
const stableProxiedTrigger = (0,
|
|
13470
|
+
const stableProxiedTrigger = (0, import_react55.useCallback)(
|
|
13477
13471
|
(...triggerParameters) => __async(null, null, function* () {
|
|
13478
13472
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
13479
13473
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -13513,7 +13507,7 @@ var getCustomAccountTypeFromSubtype = (subtype) => {
|
|
|
13513
13507
|
}
|
|
13514
13508
|
};
|
|
13515
13509
|
var useCustomAccountForm = ({ onSuccess }) => {
|
|
13516
|
-
const [submitError, setSubmitError] = (0,
|
|
13510
|
+
const [submitError, setSubmitError] = (0, import_react56.useState)(void 0);
|
|
13517
13511
|
const { trigger: createCustomAccount2 } = useCreateCustomAccount();
|
|
13518
13512
|
const form = (0, import_react_form.useForm)({
|
|
13519
13513
|
defaultValues: {
|
|
@@ -13554,12 +13548,12 @@ var accountTypeOptions = [
|
|
|
13554
13548
|
var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
|
|
13555
13549
|
const { form, submitError, isFormValid } = useCustomAccountForm({ onSuccess });
|
|
13556
13550
|
const { isSubmitting } = form.state;
|
|
13557
|
-
const onSubmit = (0,
|
|
13551
|
+
const onSubmit = (0, import_react57.useCallback)((e) => {
|
|
13558
13552
|
e.preventDefault();
|
|
13559
13553
|
e.stopPropagation();
|
|
13560
13554
|
void form.handleSubmit();
|
|
13561
13555
|
}, [form]);
|
|
13562
|
-
(0,
|
|
13556
|
+
(0, import_react57.useEffect)(() => {
|
|
13563
13557
|
form.setFieldValue("account_name", initialAccountName);
|
|
13564
13558
|
}, [form, initialAccountName]);
|
|
13565
13559
|
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(
|
|
@@ -13631,7 +13625,7 @@ var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
|
|
|
13631
13625
|
submitError && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ErrorText, { pb: "xs", children: submitError }),
|
|
13632
13626
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Spacer, {}),
|
|
13633
13627
|
onCancel && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Button, { type: "button", variant: "secondary" /* secondary */, onClick: onCancel, children: "Cancel" }),
|
|
13634
|
-
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(SubmitButton, { type: "submit", processing: isSubmitting, noIcon: !isSubmitting, withRetry: true, error: submitError, children: "Submit" })
|
|
13628
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(SubmitButton, { type: "submit", processing: isSubmitting, noIcon: !isSubmitting, withRetry: true, error: submitError, children: submitError ? "Retry" : "Submit" })
|
|
13635
13629
|
] })
|
|
13636
13630
|
] })
|
|
13637
13631
|
}
|
|
@@ -13639,7 +13633,7 @@ var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
|
|
|
13639
13633
|
};
|
|
13640
13634
|
|
|
13641
13635
|
// src/components/CsvUpload/CsvUpload.tsx
|
|
13642
|
-
var
|
|
13636
|
+
var import_react58 = require("react");
|
|
13643
13637
|
var import_react_dropzone = require("react-dropzone");
|
|
13644
13638
|
var import_classnames33 = __toESM(require("classnames"));
|
|
13645
13639
|
var import_lucide_react5 = require("lucide-react");
|
|
@@ -13682,8 +13676,8 @@ var FileRow = ({ file, onClearFile, asDropTarget }) => {
|
|
|
13682
13676
|
] });
|
|
13683
13677
|
};
|
|
13684
13678
|
var CsvUpload = ({ file, onFileSelected, replaceDropTarget = false }) => {
|
|
13685
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
13686
|
-
const fileInputRef = (0,
|
|
13679
|
+
const [errorMessage, setErrorMessage] = (0, import_react58.useState)();
|
|
13680
|
+
const fileInputRef = (0, import_react58.useRef)(null);
|
|
13687
13681
|
const handleBrowseClick = (e) => {
|
|
13688
13682
|
var _a;
|
|
13689
13683
|
e.preventDefault();
|
|
@@ -13695,7 +13689,7 @@ var CsvUpload = ({ file, onFileSelected, replaceDropTarget = false }) => {
|
|
|
13695
13689
|
const fileArray = Array.from(files);
|
|
13696
13690
|
onDrop(fileArray);
|
|
13697
13691
|
};
|
|
13698
|
-
const onDrop = (0,
|
|
13692
|
+
const onDrop = (0, import_react58.useCallback)(
|
|
13699
13693
|
([firstFile, ...restFiles], rejections = []) => {
|
|
13700
13694
|
const hasTooManyFiles = rejections.some((r) => r.errors.some((e) => e.code === "too-many-files"));
|
|
13701
13695
|
if (restFiles.length > 0 || hasTooManyFiles) {
|
|
@@ -13907,38 +13901,38 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
|
|
|
13907
13901
|
var _a;
|
|
13908
13902
|
const { data: customAccounts, isLoading: isLoadingCustomAccounts, error: customAccountsError } = useCustomAccounts();
|
|
13909
13903
|
const { trigger: parseCsv2, isMutating: isParsingCsv } = useCustomAccountParseCsv();
|
|
13910
|
-
const [hasParseCsvError, setHasParseCsvError] = (0,
|
|
13911
|
-
const accountOptions = (0,
|
|
13904
|
+
const [hasParseCsvError, setHasParseCsvError] = (0, import_react59.useState)(false);
|
|
13905
|
+
const accountOptions = (0, import_react59.useMemo)(() => {
|
|
13912
13906
|
if (!customAccounts) return [];
|
|
13913
13907
|
return customAccounts.map((account) => ({
|
|
13914
13908
|
value: account.id,
|
|
13915
13909
|
label: account.accountName
|
|
13916
13910
|
}));
|
|
13917
13911
|
}, [customAccounts]);
|
|
13918
|
-
const onChange = (0,
|
|
13912
|
+
const onChange = (0, import_react59.useCallback)((option) => {
|
|
13919
13913
|
onSelectAccount(option);
|
|
13920
13914
|
}, [onSelectAccount]);
|
|
13921
|
-
const onCreateOption = (0,
|
|
13915
|
+
const onCreateOption = (0, import_react59.useCallback)((inputValue) => {
|
|
13922
13916
|
onSelectAccount({
|
|
13923
13917
|
value: "new_account",
|
|
13924
13918
|
label: "Create new account",
|
|
13925
13919
|
createdAccountName: inputValue
|
|
13926
13920
|
});
|
|
13927
13921
|
}, [onSelectAccount]);
|
|
13928
|
-
const onCancelCreateAccount = (0,
|
|
13922
|
+
const onCancelCreateAccount = (0, import_react59.useCallback)(() => {
|
|
13929
13923
|
onSelectAccount(null);
|
|
13930
13924
|
}, [onSelectAccount]);
|
|
13931
|
-
const onCreateAccountSuccess = (0,
|
|
13925
|
+
const onCreateAccountSuccess = (0, import_react59.useCallback)((account) => {
|
|
13932
13926
|
onSelectAccount({
|
|
13933
13927
|
value: account.id,
|
|
13934
13928
|
label: account.accountName
|
|
13935
13929
|
});
|
|
13936
13930
|
}, [onSelectAccount]);
|
|
13937
|
-
const onFileSelected = (0,
|
|
13931
|
+
const onFileSelected = (0, import_react59.useCallback)((file) => {
|
|
13938
13932
|
setHasParseCsvError(false);
|
|
13939
13933
|
onSelectFile(file);
|
|
13940
13934
|
}, [onSelectFile]);
|
|
13941
|
-
const onClickContinue = (0,
|
|
13935
|
+
const onClickContinue = (0, import_react59.useCallback)(() => {
|
|
13942
13936
|
if (!selectedAccount || selectedAccount.value === "new_account" || !selectedFile) return;
|
|
13943
13937
|
void parseCsv2({
|
|
13944
13938
|
customAccountId: selectedAccount.value,
|
|
@@ -13953,6 +13947,7 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
|
|
|
13953
13947
|
"Layer__upload-transactions__select-account-name-input",
|
|
13954
13948
|
!!customAccountsError && "Layer__upload-transactions__select-account-name-input--error"
|
|
13955
13949
|
);
|
|
13950
|
+
const hasSelectedAccount = selectedAccount && selectedAccount.value !== "new_account";
|
|
13956
13951
|
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(VStack, { gap: "lg", children: [
|
|
13957
13952
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(HStack, { fluid: true, align: "center", gap: "lg", className: "Layer__upload-transactions__select-account-name-field", children: [
|
|
13958
13953
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Label, { htmlFor: "account_name", children: "Account name" }),
|
|
@@ -13977,7 +13972,7 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
|
|
|
13977
13972
|
selectedAccount && selectedAccount.value === "new_account" && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(VStack, { className: "Layer__upload-transactions__create-account-form", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13978
13973
|
CustomAccountForm,
|
|
13979
13974
|
{
|
|
13980
|
-
initialAccountName: (_a = selectedAccount
|
|
13975
|
+
initialAccountName: (_a = selectedAccount.createdAccountName) != null ? _a : "",
|
|
13981
13976
|
onCancel: onCancelCreateAccount,
|
|
13982
13977
|
onSuccess: onCreateAccountSuccess
|
|
13983
13978
|
}
|
|
@@ -14005,8 +14000,8 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
|
|
|
14005
14000
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14006
14001
|
SubmitButton,
|
|
14007
14002
|
{
|
|
14008
|
-
tooltip: selectedFile &&
|
|
14009
|
-
disabled: !
|
|
14003
|
+
tooltip: selectedFile && !hasSelectedAccount ? "Select an account" : null,
|
|
14004
|
+
disabled: !hasSelectedAccount || !selectedFile,
|
|
14010
14005
|
processing: isParsingCsv,
|
|
14011
14006
|
error: hasParseCsvError,
|
|
14012
14007
|
onClick: onClickContinue,
|
|
@@ -14024,9 +14019,7 @@ var import_react61 = require("react");
|
|
|
14024
14019
|
var import_lucide_react8 = require("lucide-react");
|
|
14025
14020
|
|
|
14026
14021
|
// src/hooks/customAccounts/useCreateCustomAccountTransactions.ts
|
|
14027
|
-
var import_react59 = require("react");
|
|
14028
14022
|
var import_mutation7 = __toESM(require("swr/mutation"));
|
|
14029
|
-
var import_swr10 = require("swr");
|
|
14030
14023
|
var createCustomAccountTransactions = post(({ businessId, customAccountId }) => `/v1/businesses/${businessId}/custom-accounts/${customAccountId}/transactions`);
|
|
14031
14024
|
function buildKey11({
|
|
14032
14025
|
access_token: accessToken,
|
|
@@ -14045,8 +14038,7 @@ function buildKey11({
|
|
|
14045
14038
|
function useCreateCustomAccountTransactions() {
|
|
14046
14039
|
const { data } = useAuth();
|
|
14047
14040
|
const { businessId } = useLayerContext();
|
|
14048
|
-
|
|
14049
|
-
const mutationResponse = (0, import_mutation7.default)(
|
|
14041
|
+
return (0, import_mutation7.default)(
|
|
14050
14042
|
() => buildKey11(__spreadProps(__spreadValues({}, data), {
|
|
14051
14043
|
businessId
|
|
14052
14044
|
})),
|
|
@@ -14069,29 +14061,6 @@ function useCreateCustomAccountTransactions() {
|
|
|
14069
14061
|
throwOnError: false
|
|
14070
14062
|
}
|
|
14071
14063
|
);
|
|
14072
|
-
const { trigger: originalTrigger } = mutationResponse;
|
|
14073
|
-
const stableProxiedTrigger = (0, import_react59.useCallback)(
|
|
14074
|
-
(...triggerParameters) => __async(null, null, function* () {
|
|
14075
|
-
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
14076
|
-
void mutate((key) => withSWRKeyTags(
|
|
14077
|
-
key,
|
|
14078
|
-
(tags) => tags.includes(BANK_TRANSACTIONS_TAG_KEY)
|
|
14079
|
-
));
|
|
14080
|
-
return triggerResult;
|
|
14081
|
-
}),
|
|
14082
|
-
[
|
|
14083
|
-
originalTrigger,
|
|
14084
|
-
mutate
|
|
14085
|
-
]
|
|
14086
|
-
);
|
|
14087
|
-
return new Proxy(mutationResponse, {
|
|
14088
|
-
get(target, prop) {
|
|
14089
|
-
if (prop === "trigger") {
|
|
14090
|
-
return stableProxiedTrigger;
|
|
14091
|
-
}
|
|
14092
|
-
return Reflect.get(target, prop);
|
|
14093
|
-
}
|
|
14094
|
-
});
|
|
14095
14064
|
}
|
|
14096
14065
|
|
|
14097
14066
|
// src/components/CsvUpload/ValidateCsvTable.tsx
|
|
@@ -14157,7 +14126,6 @@ function ValidateCsvTable({ data, headers, formatters: formatters2, className })
|
|
|
14157
14126
|
getCoreRowModel: (0, import_react_table.getCoreRowModel)(),
|
|
14158
14127
|
getSortedRowModel: (0, import_react_table.getSortedRowModel)()
|
|
14159
14128
|
});
|
|
14160
|
-
const tableContainerRef = (0, import_react60.useRef)(null);
|
|
14161
14129
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: `${className} Layer__csv-upload__validate-csv-table__container`, children: [
|
|
14162
14130
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("table", { className: "Layer__table", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("thead", { className: "Layer__csv-upload__validate-csv-table__thead", children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("tr", { className: "Layer__csv-upload__validate-csv-table__header-row", children: headerGroup.headers.map((header) => {
|
|
14163
14131
|
const headerCellClassName = (0, import_classnames35.default)(
|
|
@@ -14167,19 +14135,20 @@ function ValidateCsvTable({ data, headers, formatters: formatters2, className })
|
|
|
14167
14135
|
);
|
|
14168
14136
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("th", { className: headerCellClassName, children: (0, import_react_table.flexRender)(header.column.columnDef.header, header.getContext()) }, header.id);
|
|
14169
14137
|
}) }, headerGroup.id)) }) }),
|
|
14170
|
-
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
14138
|
+
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)(ValidateCsvTableBody, { table })
|
|
14171
14139
|
] });
|
|
14172
14140
|
}
|
|
14173
|
-
function ValidateCsvTableBody({ table
|
|
14141
|
+
function ValidateCsvTableBody({ table }) {
|
|
14174
14142
|
const { rows } = table.getRowModel();
|
|
14143
|
+
const containerRef = (0, import_react60.useRef)(null);
|
|
14175
14144
|
const rowVirtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
14176
14145
|
count: rows.length,
|
|
14177
14146
|
estimateSize: () => ROW_HEIGHT,
|
|
14178
|
-
getScrollElement: () =>
|
|
14147
|
+
getScrollElement: () => containerRef.current,
|
|
14179
14148
|
measureElement: typeof window !== "undefined" && navigator.userAgent.indexOf("Firefox") === -1 ? (element) => element == null ? void 0 : element.getBoundingClientRect().height : void 0,
|
|
14180
14149
|
overscan: 5
|
|
14181
14150
|
});
|
|
14182
|
-
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("tbody", { children: [
|
|
14151
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("div", { ref: containerRef, className: "Layer__csv-upload__validate-csv-table__scroll_container", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("table", { className: "Layer__table", children: /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("tbody", { children: [
|
|
14183
14152
|
/* @__PURE__ */ (0, import_jsx_runtime101.jsx)("tr", { style: { height: BODY_HEIGHT }, children: /* @__PURE__ */ (0, import_jsx_runtime101.jsx)("td", { style: { height: BODY_HEIGHT, padding: 0 }, colSpan: table.getAllColumns().length - 1 }) }),
|
|
14184
14153
|
rowVirtualizer.getVirtualItems().map((virtualRow) => {
|
|
14185
14154
|
const row = rows[virtualRow.index];
|
|
@@ -14193,7 +14162,7 @@ function ValidateCsvTableBody({ table, tableContainerRef }) {
|
|
|
14193
14162
|
row.id
|
|
14194
14163
|
);
|
|
14195
14164
|
})
|
|
14196
|
-
] });
|
|
14165
|
+
] }) }) });
|
|
14197
14166
|
}
|
|
14198
14167
|
function ValidateCsvTableRow({ row, virtualRow, rowVirtualizer }) {
|
|
14199
14168
|
const tableRowClassName = (0, import_classnames35.default)(
|
|
@@ -14273,7 +14242,7 @@ function UploadTransactionsValidateCsvStep({ parseCsvResponse, selectedAccountId
|
|
|
14273
14242
|
onClick: onClickUploadTransactions,
|
|
14274
14243
|
action: "upload" /* UPLOAD */,
|
|
14275
14244
|
withRetry: true,
|
|
14276
|
-
children: "Upload transactions"
|
|
14245
|
+
children: uploadTransactionsError ? "Retry" : "Upload transactions"
|
|
14277
14246
|
}
|
|
14278
14247
|
)
|
|
14279
14248
|
] })
|
|
@@ -14295,17 +14264,18 @@ function UploadTransactions({ onComplete }) {
|
|
|
14295
14264
|
setFile(file2);
|
|
14296
14265
|
setParseCsvResponse(null);
|
|
14297
14266
|
}, []);
|
|
14298
|
-
const goBack = (0, import_react62.useCallback)((step = 1) => setCurrentStep(currentStep - step), [currentStep]);
|
|
14299
|
-
const goForward = (0, import_react62.useCallback)((step = 1) => setCurrentStep(currentStep + step), [currentStep]);
|
|
14300
14267
|
const onParseCsv = (0, import_react62.useCallback)((parseCsvResponse2) => {
|
|
14301
14268
|
setParseCsvResponse(parseCsvResponse2);
|
|
14302
|
-
|
|
14303
|
-
}, [
|
|
14269
|
+
setCurrentStep(1 /* ValidateCsv */);
|
|
14270
|
+
}, []);
|
|
14271
|
+
const goRestartFlow = (0, import_react62.useCallback)(() => {
|
|
14272
|
+
setCurrentStep(0 /* UploadCsv */);
|
|
14273
|
+
}, []);
|
|
14304
14274
|
const onReupload = (0, import_react62.useCallback)(() => {
|
|
14305
14275
|
setFile(null);
|
|
14306
14276
|
setParseCsvResponse(null);
|
|
14307
|
-
|
|
14308
|
-
}, [
|
|
14277
|
+
setCurrentStep(0 /* UploadCsv */);
|
|
14278
|
+
}, []);
|
|
14309
14279
|
return /* @__PURE__ */ (0, import_jsx_runtime103.jsx)("section", { className: "Layer__component", children: /* @__PURE__ */ (0, import_jsx_runtime103.jsxs)(
|
|
14310
14280
|
Wizard,
|
|
14311
14281
|
{
|
|
@@ -14341,7 +14311,7 @@ function UploadTransactions({ onComplete }) {
|
|
|
14341
14311
|
{
|
|
14342
14312
|
selectedAccountId: selectedAccount.value,
|
|
14343
14313
|
parseCsvResponse,
|
|
14344
|
-
onGoBack:
|
|
14314
|
+
onGoBack: goRestartFlow,
|
|
14345
14315
|
onReupload
|
|
14346
14316
|
}
|
|
14347
14317
|
)
|
|
@@ -14897,7 +14867,7 @@ var getAssignedValue = (bankTransaction) => {
|
|
|
14897
14867
|
};
|
|
14898
14868
|
|
|
14899
14869
|
// src/hooks/categories/useCategories.ts
|
|
14900
|
-
var
|
|
14870
|
+
var import_swr10 = __toESM(require("swr"));
|
|
14901
14871
|
var CATEGORIES_TAG_KEY = "#categories";
|
|
14902
14872
|
function buildKey12({
|
|
14903
14873
|
access_token: accessToken,
|
|
@@ -14918,7 +14888,7 @@ function buildKey12({
|
|
|
14918
14888
|
function useCategories({ mode } = {}) {
|
|
14919
14889
|
const { data: auth } = useAuth();
|
|
14920
14890
|
const { businessId } = useLayerContext();
|
|
14921
|
-
return (0,
|
|
14891
|
+
return (0, import_swr10.default)(
|
|
14922
14892
|
() => buildKey12(__spreadProps(__spreadValues({}, auth), {
|
|
14923
14893
|
businessId,
|
|
14924
14894
|
mode
|
|
@@ -15785,7 +15755,7 @@ var BankTransactionReceipts = (0, import_react69.forwardRef)(
|
|
|
15785
15755
|
BankTransactionReceipts.displayName = "BankTransactionReceipts";
|
|
15786
15756
|
|
|
15787
15757
|
// src/hooks/bookkeeping/useBookkeepingStatus.ts
|
|
15788
|
-
var
|
|
15758
|
+
var import_swr11 = __toESM(require("swr"));
|
|
15789
15759
|
|
|
15790
15760
|
// src/providers/LegacyModeProvider/LegacyModeProvider.tsx
|
|
15791
15761
|
var import_react70 = require("react");
|
|
@@ -15844,7 +15814,7 @@ function buildKey13({
|
|
|
15844
15814
|
function useBookkeepingStatus() {
|
|
15845
15815
|
const { data: auth } = useAuth();
|
|
15846
15816
|
const { businessId } = useLayerContext();
|
|
15847
|
-
return (0,
|
|
15817
|
+
return (0, import_swr11.default)(
|
|
15848
15818
|
() => buildKey13(__spreadProps(__spreadValues({}, auth), {
|
|
15849
15819
|
businessId
|
|
15850
15820
|
})),
|
|
@@ -16415,7 +16385,7 @@ var Textarea = (_a) => {
|
|
|
16415
16385
|
var import_react_form2 = require("@tanstack/react-form");
|
|
16416
16386
|
|
|
16417
16387
|
// src/hooks/useBankTransactions/useBankTransactionsMetadata.ts
|
|
16418
|
-
var
|
|
16388
|
+
var import_swr12 = __toESM(require("swr"));
|
|
16419
16389
|
var GET_BANK_TRANSACTION_METADATA_TAG_KEY = "#bank-transaction-metadata";
|
|
16420
16390
|
function buildKey14({
|
|
16421
16391
|
access_token: accessToken,
|
|
@@ -16436,7 +16406,7 @@ function buildKey14({
|
|
|
16436
16406
|
function useBankTransactionMetadata({ bankTransactionId }) {
|
|
16437
16407
|
const { data: auth } = useAuth();
|
|
16438
16408
|
const { businessId } = useLayerContext();
|
|
16439
|
-
return (0,
|
|
16409
|
+
return (0, import_swr12.default)(
|
|
16440
16410
|
() => buildKey14(__spreadProps(__spreadValues({}, auth), {
|
|
16441
16411
|
businessId,
|
|
16442
16412
|
bankTransactionId
|
|
@@ -16451,7 +16421,7 @@ function useBankTransactionMetadata({ bankTransactionId }) {
|
|
|
16451
16421
|
|
|
16452
16422
|
// src/hooks/useBankTransactions/useUpdateBankTransactionMetadata.ts
|
|
16453
16423
|
var import_mutation8 = __toESM(require("swr/mutation"));
|
|
16454
|
-
var
|
|
16424
|
+
var import_swr13 = require("swr");
|
|
16455
16425
|
var import_react74 = require("react");
|
|
16456
16426
|
var UPDATE_BANK_TRANSACTION_METADATA_TAG_KEY = "#update-bank-transaction-metadata";
|
|
16457
16427
|
function buildKey15({
|
|
@@ -16473,7 +16443,7 @@ function buildKey15({
|
|
|
16473
16443
|
function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
|
|
16474
16444
|
const { data: auth } = useAuth();
|
|
16475
16445
|
const { businessId } = useLayerContext();
|
|
16476
|
-
const { mutate } = (0,
|
|
16446
|
+
const { mutate } = (0, import_swr13.useSWRConfig)();
|
|
16477
16447
|
const mutationResponse = (0, import_mutation8.default)(
|
|
16478
16448
|
() => buildKey15({
|
|
16479
16449
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
@@ -17045,7 +17015,7 @@ var import_classnames45 = __toESM(require("classnames"));
|
|
|
17045
17015
|
var import_date_fns17 = require("date-fns");
|
|
17046
17016
|
|
|
17047
17017
|
// src/hooks/bookkeeping/periods/useBookkeepingPeriods.ts
|
|
17048
|
-
var
|
|
17018
|
+
var import_swr14 = __toESM(require("swr"));
|
|
17049
17019
|
|
|
17050
17020
|
// src/utils/bookkeeping/bookkeepingStatusFilters.ts
|
|
17051
17021
|
function isActiveBookkeepingStatus(status) {
|
|
@@ -17128,7 +17098,7 @@ function useBookkeepingPeriods() {
|
|
|
17128
17098
|
const { businessId } = useLayerContext();
|
|
17129
17099
|
const { data, isLoading: isLoadingBookkeepingStatus } = useBookkeepingStatus();
|
|
17130
17100
|
const isActiveOrPaused = data ? isActiveOrPausedBookkeepingStatus(data.status) : false;
|
|
17131
|
-
const swrResponse = (0,
|
|
17101
|
+
const swrResponse = (0, import_swr14.default)(
|
|
17132
17102
|
() => buildKey16(__spreadProps(__spreadValues({}, auth), {
|
|
17133
17103
|
businessId,
|
|
17134
17104
|
isActiveOrPaused
|
|
@@ -20561,7 +20531,7 @@ var applyShare = (items, total) => {
|
|
|
20561
20531
|
// src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
|
|
20562
20532
|
var import_react104 = require("react");
|
|
20563
20533
|
var import_date_fns25 = require("date-fns");
|
|
20564
|
-
var
|
|
20534
|
+
var import_swr15 = __toESM(require("swr"));
|
|
20565
20535
|
var buildDates = ({ currentDate }) => {
|
|
20566
20536
|
return {
|
|
20567
20537
|
startYear: (0, import_date_fns25.startOfMonth)(currentDate).getFullYear() - 1,
|
|
@@ -20602,7 +20572,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
20602
20572
|
isValidating,
|
|
20603
20573
|
error,
|
|
20604
20574
|
mutate
|
|
20605
|
-
} = (0,
|
|
20575
|
+
} = (0, import_swr15.default)(
|
|
20606
20576
|
queryKey,
|
|
20607
20577
|
Layer.getProfitAndLossSummaries(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
20608
20578
|
params: {
|
|
@@ -20715,7 +20685,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
20715
20685
|
// src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
|
|
20716
20686
|
var import_react105 = require("react");
|
|
20717
20687
|
var import_date_fns26 = require("date-fns");
|
|
20718
|
-
var
|
|
20688
|
+
var import_swr16 = __toESM(require("swr"));
|
|
20719
20689
|
var useProfitAndLossQuery = ({
|
|
20720
20690
|
startDate,
|
|
20721
20691
|
endDate,
|
|
@@ -20738,7 +20708,7 @@ var useProfitAndLossQuery = ({
|
|
|
20738
20708
|
isValidating,
|
|
20739
20709
|
error: rawError,
|
|
20740
20710
|
mutate
|
|
20741
|
-
} = (0,
|
|
20711
|
+
} = (0, import_swr16.default)(
|
|
20742
20712
|
queryKey,
|
|
20743
20713
|
Layer.getProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
20744
20714
|
businessId,
|
|
@@ -21065,7 +21035,7 @@ function preparePeriodsBody(dateRange, comparePeriods, rangeDisplayMode) {
|
|
|
21065
21035
|
}
|
|
21066
21036
|
|
|
21067
21037
|
// src/hooks/useProfitAndLossComparison/useProfitAndLossComparison.tsx
|
|
21068
|
-
var
|
|
21038
|
+
var import_swr17 = __toESM(require("swr"));
|
|
21069
21039
|
var COMPARE_MODES_SUPPORTING_MULTI_PERIOD = ["monthPicker", "yearPicker"];
|
|
21070
21040
|
var isNotOnlyNoneTag = (compareOptions) => {
|
|
21071
21041
|
return Boolean(
|
|
@@ -21129,7 +21099,7 @@ function useProfitAndLossComparison({
|
|
|
21129
21099
|
reportingBasis,
|
|
21130
21100
|
compareModeActive
|
|
21131
21101
|
}));
|
|
21132
|
-
const { data, isLoading, isValidating } = (0,
|
|
21102
|
+
const { data, isLoading, isValidating } = (0, import_swr17.default)(
|
|
21133
21103
|
queryKey,
|
|
21134
21104
|
() => __async(null, null, function* () {
|
|
21135
21105
|
const response = yield Layer.compareProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
@@ -24472,7 +24442,7 @@ ProfitAndLoss.Report = ProfitAndLossReport;
|
|
|
24472
24442
|
ProfitAndLoss.DownloadButton = ProfitAndLossDownloadButton;
|
|
24473
24443
|
|
|
24474
24444
|
// src/hooks/balanceSheet/useBalanceSheet.ts
|
|
24475
|
-
var
|
|
24445
|
+
var import_swr18 = __toESM(require("swr"));
|
|
24476
24446
|
var import_date_fns33 = require("date-fns");
|
|
24477
24447
|
function buildKey19({
|
|
24478
24448
|
access_token: accessToken,
|
|
@@ -24496,7 +24466,7 @@ function useBalanceSheet({
|
|
|
24496
24466
|
const { data: auth } = useAuth();
|
|
24497
24467
|
const { apiUrl } = useEnvironment();
|
|
24498
24468
|
const { businessId } = useLayerContext();
|
|
24499
|
-
return (0,
|
|
24469
|
+
return (0, import_swr18.default)(
|
|
24500
24470
|
() => buildKey19(__spreadProps(__spreadValues({}, auth), {
|
|
24501
24471
|
apiUrl,
|
|
24502
24472
|
businessId,
|
|
@@ -25105,7 +25075,7 @@ function StatementOfCashFlowDatePicker({
|
|
|
25105
25075
|
}
|
|
25106
25076
|
|
|
25107
25077
|
// src/hooks/useStatementOfCashFlow/useStatementOfCashFlow.tsx
|
|
25108
|
-
var
|
|
25078
|
+
var import_swr19 = __toESM(require("swr"));
|
|
25109
25079
|
var import_date_fns34 = require("date-fns");
|
|
25110
25080
|
function buildKey22({
|
|
25111
25081
|
access_token: accessToken,
|
|
@@ -25132,7 +25102,7 @@ function useStatementOfCashFlow({
|
|
|
25132
25102
|
const { data: auth } = useAuth();
|
|
25133
25103
|
const { apiUrl } = useEnvironment();
|
|
25134
25104
|
const { businessId } = useLayerContext();
|
|
25135
|
-
return (0,
|
|
25105
|
+
return (0, import_swr19.default)(
|
|
25136
25106
|
buildKey22(__spreadProps(__spreadValues({}, auth), {
|
|
25137
25107
|
apiUrl,
|
|
25138
25108
|
businessId,
|
|
@@ -25466,7 +25436,7 @@ var LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE = {
|
|
|
25466
25436
|
|
|
25467
25437
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
25468
25438
|
var import_date_fns36 = require("date-fns");
|
|
25469
|
-
var
|
|
25439
|
+
var import_swr20 = __toESM(require("swr"));
|
|
25470
25440
|
var validate = (formData) => {
|
|
25471
25441
|
const errors = [];
|
|
25472
25442
|
const nameError = validateName(formData);
|
|
@@ -25571,7 +25541,7 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
25571
25541
|
initialEndDate != null ? initialEndDate : (0, import_date_fns36.endOfMonth)(Date.now())
|
|
25572
25542
|
);
|
|
25573
25543
|
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `chart-of-accounts-${businessId}-${startDate == null ? void 0 : startDate.valueOf()}-${endDate == null ? void 0 : endDate.valueOf()}`;
|
|
25574
|
-
const { data, isLoading, isValidating, error, mutate } = (0,
|
|
25544
|
+
const { data, isLoading, isValidating, error, mutate } = (0, import_swr20.default)(
|
|
25575
25545
|
queryKey,
|
|
25576
25546
|
Layer.getLedgerAccountBalances(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
25577
25547
|
params: {
|
|
@@ -25781,12 +25751,12 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
25781
25751
|
|
|
25782
25752
|
// src/hooks/useChartOfAccounts/useCreateChildAccount.tsx
|
|
25783
25753
|
var import_mutation12 = __toESM(require("swr/mutation"));
|
|
25784
|
-
var
|
|
25754
|
+
var import_swr21 = require("swr");
|
|
25785
25755
|
var import_react137 = require("react");
|
|
25786
25756
|
|
|
25787
25757
|
// src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
|
|
25788
25758
|
var import_react138 = require("react");
|
|
25789
|
-
var
|
|
25759
|
+
var import_swr22 = __toESM(require("swr"));
|
|
25790
25760
|
var useLedgerAccounts = (showReversalEntries = false) => {
|
|
25791
25761
|
const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
25792
25762
|
const { apiUrl } = useEnvironment();
|
|
@@ -25794,7 +25764,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
25794
25764
|
const [accountId, setAccountId] = (0, import_react138.useState)();
|
|
25795
25765
|
const [selectedEntryId, setSelectedEntryId] = (0, import_react138.useState)();
|
|
25796
25766
|
const queryKey = businessId && accountId && (auth == null ? void 0 : auth.access_token) && `ledger-accounts-lines-${businessId}-${accountId}`;
|
|
25797
|
-
const { data, isLoading, isValidating, error, mutate } = (0,
|
|
25767
|
+
const { data, isLoading, isValidating, error, mutate } = (0, import_swr22.default)(
|
|
25798
25768
|
queryKey,
|
|
25799
25769
|
Layer.getLedgerAccountsLines(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
25800
25770
|
params: {
|
|
@@ -25810,7 +25780,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
25810
25780
|
isLoading: isLoadingEntry,
|
|
25811
25781
|
isValidating: isValdiatingEntry,
|
|
25812
25782
|
error: errorEntry
|
|
25813
|
-
} = (0,
|
|
25783
|
+
} = (0, import_swr22.default)(
|
|
25814
25784
|
businessId && selectedEntryId && (auth == null ? void 0 : auth.access_token) && `ledger-accounts-entry-${businessId}-${selectedEntryId}}`,
|
|
25815
25785
|
Layer.getLedgerAccountsEntry(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
25816
25786
|
params: { businessId, entryId: selectedEntryId }
|
|
@@ -27313,7 +27283,7 @@ var JournalContext = (0, import_react148.createContext)({
|
|
|
27313
27283
|
|
|
27314
27284
|
// src/hooks/useJournal/useJournal.tsx
|
|
27315
27285
|
var import_react149 = require("react");
|
|
27316
|
-
var
|
|
27286
|
+
var import_swr23 = __toESM(require("swr"));
|
|
27317
27287
|
var useJournal = () => {
|
|
27318
27288
|
const {
|
|
27319
27289
|
businessId,
|
|
@@ -27330,7 +27300,7 @@ var useJournal = () => {
|
|
|
27330
27300
|
const [sendingForm, setSendingForm] = (0, import_react149.useState)(false);
|
|
27331
27301
|
const [apiError, setApiError] = (0, import_react149.useState)(void 0);
|
|
27332
27302
|
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `journal-lines-${businessId}`;
|
|
27333
|
-
const { data, isLoading, isValidating, error, mutate } = (0,
|
|
27303
|
+
const { data, isLoading, isValidating, error, mutate } = (0, import_swr23.default)(
|
|
27334
27304
|
queryKey,
|
|
27335
27305
|
Layer.getJournal(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
27336
27306
|
params: { businessId }
|
|
@@ -27922,20 +27892,19 @@ var JournalFormEntryLines = ({
|
|
|
27922
27892
|
className: "Layer__journal__form__input-group__line-item",
|
|
27923
27893
|
children: [
|
|
27924
27894
|
/* @__PURE__ */ (0, import_jsx_runtime242.jsx)(InputGroup, { name: direction, label: "Amount", inline: true, children: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
|
|
27925
|
-
|
|
27895
|
+
AmountInput,
|
|
27926
27896
|
{
|
|
27927
27897
|
name: direction,
|
|
27928
|
-
|
|
27929
|
-
value:
|
|
27898
|
+
onChange: (value) => changeFormData("amount", value, idx2),
|
|
27899
|
+
value: item.amount,
|
|
27930
27900
|
disabled: sendingForm,
|
|
27931
|
-
|
|
27932
|
-
|
|
27933
|
-
|
|
27934
|
-
|
|
27935
|
-
|
|
27936
|
-
|
|
27937
|
-
|
|
27938
|
-
idx2
|
|
27901
|
+
allowNegativeValue: false,
|
|
27902
|
+
badge: /* @__PURE__ */ (0, import_jsx_runtime242.jsx)(
|
|
27903
|
+
Badge,
|
|
27904
|
+
{
|
|
27905
|
+
variant: item.direction === "CREDIT" ? "success" /* SUCCESS */ : "warning" /* WARNING */,
|
|
27906
|
+
children: humanizeEnum(direction)
|
|
27907
|
+
}
|
|
27939
27908
|
),
|
|
27940
27909
|
isInvalid: Boolean(
|
|
27941
27910
|
(_a = form == null ? void 0 : form.errors) == null ? void 0 : _a.lineItems.find(
|
|
@@ -28623,7 +28592,7 @@ function getIconForTask(task) {
|
|
|
28623
28592
|
}
|
|
28624
28593
|
|
|
28625
28594
|
// src/hooks/bookkeeping/periods/tasks/useSubmitResponseForTask.ts
|
|
28626
|
-
var
|
|
28595
|
+
var import_swr24 = require("swr");
|
|
28627
28596
|
var import_mutation15 = __toESM(require("swr/mutation"));
|
|
28628
28597
|
|
|
28629
28598
|
// src/api/layer/tasks.ts
|
|
@@ -28675,7 +28644,7 @@ function buildKey25({
|
|
|
28675
28644
|
function useSubmitUserResponseForTask() {
|
|
28676
28645
|
const { data: auth } = useAuth();
|
|
28677
28646
|
const { businessId } = useLayerContext();
|
|
28678
|
-
const { mutate } = (0,
|
|
28647
|
+
const { mutate } = (0, import_swr24.useSWRConfig)();
|
|
28679
28648
|
const mutationResponse = (0, import_mutation15.default)(
|
|
28680
28649
|
() => buildKey25(__spreadProps(__spreadValues({}, auth), {
|
|
28681
28650
|
businessId
|
|
@@ -28725,7 +28694,7 @@ function useSubmitUserResponseForTask() {
|
|
|
28725
28694
|
}
|
|
28726
28695
|
|
|
28727
28696
|
// src/hooks/bookkeeping/periods/tasks/useUploadDocumentsForTask.ts
|
|
28728
|
-
var
|
|
28697
|
+
var import_swr25 = require("swr");
|
|
28729
28698
|
var import_mutation16 = __toESM(require("swr/mutation"));
|
|
28730
28699
|
var import_react157 = require("react");
|
|
28731
28700
|
function buildKey26({
|
|
@@ -28745,7 +28714,7 @@ function buildKey26({
|
|
|
28745
28714
|
function useUploadDocumentsForTask() {
|
|
28746
28715
|
const { data: auth } = useAuth();
|
|
28747
28716
|
const { businessId } = useLayerContext();
|
|
28748
|
-
const { mutate } = (0,
|
|
28717
|
+
const { mutate } = (0, import_swr25.useSWRConfig)();
|
|
28749
28718
|
const mutationResponse = (0, import_mutation16.default)(
|
|
28750
28719
|
() => buildKey26(__spreadProps(__spreadValues({}, auth), {
|
|
28751
28720
|
businessId
|
|
@@ -28791,7 +28760,7 @@ function useUploadDocumentsForTask() {
|
|
|
28791
28760
|
}
|
|
28792
28761
|
|
|
28793
28762
|
// src/hooks/bookkeeping/periods/tasks/useDeleteUploadsOnTask.ts
|
|
28794
|
-
var
|
|
28763
|
+
var import_swr26 = require("swr");
|
|
28795
28764
|
var import_mutation17 = __toESM(require("swr/mutation"));
|
|
28796
28765
|
var import_react158 = require("react");
|
|
28797
28766
|
function buildKey27({
|
|
@@ -28811,7 +28780,7 @@ function buildKey27({
|
|
|
28811
28780
|
function useDeleteUploadsOnTask() {
|
|
28812
28781
|
const { data: auth } = useAuth();
|
|
28813
28782
|
const { businessId } = useLayerContext();
|
|
28814
|
-
const { mutate } = (0,
|
|
28783
|
+
const { mutate } = (0, import_swr26.useSWRConfig)();
|
|
28815
28784
|
const mutationResponse = (0, import_mutation17.default)(
|
|
28816
28785
|
() => buildKey27(__spreadProps(__spreadValues({}, auth), {
|
|
28817
28786
|
businessId
|
|
@@ -28854,7 +28823,7 @@ function useDeleteUploadsOnTask() {
|
|
|
28854
28823
|
}
|
|
28855
28824
|
|
|
28856
28825
|
// src/hooks/bookkeeping/periods/tasks/useUpdateTaskUploadDescription.ts
|
|
28857
|
-
var
|
|
28826
|
+
var import_swr27 = require("swr");
|
|
28858
28827
|
var import_mutation18 = __toESM(require("swr/mutation"));
|
|
28859
28828
|
var import_react159 = require("react");
|
|
28860
28829
|
function buildKey28({
|
|
@@ -28874,7 +28843,7 @@ function buildKey28({
|
|
|
28874
28843
|
function useUpdateTaskUploadDescription() {
|
|
28875
28844
|
const { data: auth } = useAuth();
|
|
28876
28845
|
const { businessId } = useLayerContext();
|
|
28877
|
-
const { mutate } = (0,
|
|
28846
|
+
const { mutate } = (0, import_swr27.useSWRConfig)();
|
|
28878
28847
|
const mutationResponse = (0, import_mutation18.default)(
|
|
28879
28848
|
() => buildKey28(__spreadProps(__spreadValues({}, auth), {
|
|
28880
28849
|
businessId
|
|
@@ -30473,7 +30442,7 @@ var SummaryStep = ({ onNext, title = defaultTitle2, description = defaultDescrip
|
|
|
30473
30442
|
var import_react_form4 = require("@tanstack/react-form");
|
|
30474
30443
|
|
|
30475
30444
|
// src/hooks/businessPersonnel/useBusinessPersonnel.ts
|
|
30476
|
-
var
|
|
30445
|
+
var import_swr28 = __toESM(require("swr"));
|
|
30477
30446
|
|
|
30478
30447
|
// src/utils/array/readonlyTransformations.ts
|
|
30479
30448
|
function mapReadonly(array, callbackFn) {
|
|
@@ -30509,7 +30478,7 @@ var getBusinessPersonnel = get(({ businessId }) => `/v1/businesses/${businessId}
|
|
|
30509
30478
|
function useBusinessPersonnel() {
|
|
30510
30479
|
const { data } = useAuth();
|
|
30511
30480
|
const { businessId } = useLayerContext();
|
|
30512
|
-
return (0,
|
|
30481
|
+
return (0, import_swr28.default)(
|
|
30513
30482
|
() => buildKey29(__spreadProps(__spreadValues({}, data), {
|
|
30514
30483
|
businessId
|
|
30515
30484
|
})),
|
|
@@ -30550,7 +30519,7 @@ function useBusinessPersonnel() {
|
|
|
30550
30519
|
|
|
30551
30520
|
// src/hooks/businessPersonnel/useCreateBusinessPersonnel.ts
|
|
30552
30521
|
var import_mutation19 = __toESM(require("swr/mutation"));
|
|
30553
|
-
var
|
|
30522
|
+
var import_swr29 = require("swr");
|
|
30554
30523
|
var import_react172 = require("react");
|
|
30555
30524
|
var createBusinessPersonnel = post(({ businessId }) => `/v1/businesses/${businessId}/personnel`);
|
|
30556
30525
|
function buildKey30({
|
|
@@ -30570,7 +30539,7 @@ function buildKey30({
|
|
|
30570
30539
|
function useCreateBusinessPersonnel() {
|
|
30571
30540
|
const { data } = useAuth();
|
|
30572
30541
|
const { businessId } = useLayerContext();
|
|
30573
|
-
const { mutate } = (0,
|
|
30542
|
+
const { mutate } = (0, import_swr29.useSWRConfig)();
|
|
30574
30543
|
const mutationResponse = (0, import_mutation19.default)(
|
|
30575
30544
|
() => buildKey30(__spreadProps(__spreadValues({}, data), {
|
|
30576
30545
|
businessId
|
|
@@ -30615,7 +30584,7 @@ function useCreateBusinessPersonnel() {
|
|
|
30615
30584
|
|
|
30616
30585
|
// src/hooks/businessPersonnel/useUpdateBusinessPersonnel.ts
|
|
30617
30586
|
var import_mutation20 = __toESM(require("swr/mutation"));
|
|
30618
|
-
var
|
|
30587
|
+
var import_swr30 = require("swr");
|
|
30619
30588
|
|
|
30620
30589
|
// src/api/layer/businessPersonnel/updateBusinessPersonnel.ts
|
|
30621
30590
|
var updateBusinessPersonnel = post(({ businessId, businessPersonnelId }) => {
|
|
@@ -30643,7 +30612,7 @@ function buildKey31({
|
|
|
30643
30612
|
function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
30644
30613
|
const { data } = useAuth();
|
|
30645
30614
|
const { businessId } = useLayerContext();
|
|
30646
|
-
const { mutate } = (0,
|
|
30615
|
+
const { mutate } = (0, import_swr30.useSWRConfig)();
|
|
30647
30616
|
const mutationResponse = (0, import_mutation20.default)(
|
|
30648
30617
|
() => buildKey31(__spreadProps(__spreadValues({}, data), {
|
|
30649
30618
|
businessId,
|
|
@@ -30692,7 +30661,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
|
30692
30661
|
|
|
30693
30662
|
// src/hooks/business/useUpdateBusiness.ts
|
|
30694
30663
|
var import_mutation21 = __toESM(require("swr/mutation"));
|
|
30695
|
-
var
|
|
30664
|
+
var import_swr31 = require("swr");
|
|
30696
30665
|
var import_react174 = require("react");
|
|
30697
30666
|
var BUSINESS_TAG_KEY = "business";
|
|
30698
30667
|
function buildKey32({
|
|
@@ -30712,7 +30681,7 @@ function buildKey32({
|
|
|
30712
30681
|
function useUpdateBusiness() {
|
|
30713
30682
|
const { data } = useAuth();
|
|
30714
30683
|
const { businessId } = useLayerContext();
|
|
30715
|
-
const { mutate } = (0,
|
|
30684
|
+
const { mutate } = (0, import_swr31.useSWRConfig)();
|
|
30716
30685
|
const mutationResponse = (0, import_mutation21.default)(
|
|
30717
30686
|
() => buildKey32(__spreadProps(__spreadValues({}, data), {
|
|
30718
30687
|
businessId
|