@layerfi/components 0.1.102-alpha → 0.1.102-alpha.1
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 +564 -539
- package/dist/esm/index.mjs +103 -78
- package/dist/index.css +1 -0
- 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.1";
|
|
5606
5606
|
|
|
5607
5607
|
// src/models/APIError.ts
|
|
5608
5608
|
var APIError = class _APIError extends Error {
|
|
@@ -13249,7 +13249,7 @@ var LinkedAccountsComponent = ({
|
|
|
13249
13249
|
};
|
|
13250
13250
|
|
|
13251
13251
|
// src/components/UploadTransactions/UploadTransactions.tsx
|
|
13252
|
-
var
|
|
13252
|
+
var import_react62 = require("react");
|
|
13253
13253
|
|
|
13254
13254
|
// src/components/Wizard/Wizard.tsx
|
|
13255
13255
|
var import_react52 = require("react");
|
|
@@ -13631,7 +13631,7 @@ var CustomAccountForm = ({ initialAccountName, onCancel, onSuccess }) => {
|
|
|
13631
13631
|
submitError && /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(ErrorText, { pb: "xs", children: submitError }),
|
|
13632
13632
|
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(Spacer, {}),
|
|
13633
13633
|
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:
|
|
13634
|
+
/* @__PURE__ */ (0, import_jsx_runtime95.jsx)(SubmitButton, { type: "submit", processing: isSubmitting, noIcon: !isSubmitting, withRetry: true, error: submitError, children: "Submit" })
|
|
13635
13635
|
] })
|
|
13636
13636
|
] })
|
|
13637
13637
|
}
|
|
@@ -13953,7 +13953,6 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
|
|
|
13953
13953
|
"Layer__upload-transactions__select-account-name-input",
|
|
13954
13954
|
!!customAccountsError && "Layer__upload-transactions__select-account-name-input--error"
|
|
13955
13955
|
);
|
|
13956
|
-
const hasSelectedAccount = selectedAccount && selectedAccount.value !== "new_account";
|
|
13957
13956
|
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(VStack, { gap: "lg", children: [
|
|
13958
13957
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(HStack, { fluid: true, align: "center", gap: "lg", className: "Layer__upload-transactions__select-account-name-field", children: [
|
|
13959
13958
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Label, { htmlFor: "account_name", children: "Account name" }),
|
|
@@ -13978,7 +13977,7 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
|
|
|
13978
13977
|
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)(
|
|
13979
13978
|
CustomAccountForm,
|
|
13980
13979
|
{
|
|
13981
|
-
initialAccountName: (_a = selectedAccount.createdAccountName) != null ? _a : "",
|
|
13980
|
+
initialAccountName: (_a = selectedAccount == null ? void 0 : selectedAccount.createdAccountName) != null ? _a : "",
|
|
13982
13981
|
onCancel: onCancelCreateAccount,
|
|
13983
13982
|
onSuccess: onCreateAccountSuccess
|
|
13984
13983
|
}
|
|
@@ -14006,8 +14005,8 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
|
|
|
14006
14005
|
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14007
14006
|
SubmitButton,
|
|
14008
14007
|
{
|
|
14009
|
-
tooltip: selectedFile && !
|
|
14010
|
-
disabled: !
|
|
14008
|
+
tooltip: selectedFile && (!selectedAccount || selectedAccount.value === "new_account") ? "Select an account" : null,
|
|
14009
|
+
disabled: !selectedAccount || selectedAccount.value === "new_account" || !selectedFile,
|
|
14011
14010
|
processing: isParsingCsv,
|
|
14012
14011
|
error: hasParseCsvError,
|
|
14013
14012
|
onClick: onClickContinue,
|
|
@@ -14021,11 +14020,13 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
|
|
|
14021
14020
|
}
|
|
14022
14021
|
|
|
14023
14022
|
// src/components/UploadTransactions/UploadTransactionsValidateCsvStep.tsx
|
|
14024
|
-
var
|
|
14023
|
+
var import_react61 = require("react");
|
|
14025
14024
|
var import_lucide_react8 = require("lucide-react");
|
|
14026
14025
|
|
|
14027
14026
|
// src/hooks/customAccounts/useCreateCustomAccountTransactions.ts
|
|
14027
|
+
var import_react59 = require("react");
|
|
14028
14028
|
var import_mutation7 = __toESM(require("swr/mutation"));
|
|
14029
|
+
var import_swr10 = require("swr");
|
|
14029
14030
|
var createCustomAccountTransactions = post(({ businessId, customAccountId }) => `/v1/businesses/${businessId}/custom-accounts/${customAccountId}/transactions`);
|
|
14030
14031
|
function buildKey11({
|
|
14031
14032
|
access_token: accessToken,
|
|
@@ -14044,7 +14045,8 @@ function buildKey11({
|
|
|
14044
14045
|
function useCreateCustomAccountTransactions() {
|
|
14045
14046
|
const { data } = useAuth();
|
|
14046
14047
|
const { businessId } = useLayerContext();
|
|
14047
|
-
|
|
14048
|
+
const { mutate } = (0, import_swr10.useSWRConfig)();
|
|
14049
|
+
const mutationResponse = (0, import_mutation7.default)(
|
|
14048
14050
|
() => buildKey11(__spreadProps(__spreadValues({}, data), {
|
|
14049
14051
|
businessId
|
|
14050
14052
|
})),
|
|
@@ -14067,10 +14069,33 @@ function useCreateCustomAccountTransactions() {
|
|
|
14067
14069
|
throwOnError: false
|
|
14068
14070
|
}
|
|
14069
14071
|
);
|
|
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
|
+
});
|
|
14070
14095
|
}
|
|
14071
14096
|
|
|
14072
14097
|
// src/components/CsvUpload/ValidateCsvTable.tsx
|
|
14073
|
-
var
|
|
14098
|
+
var import_react60 = require("react");
|
|
14074
14099
|
var import_classnames35 = __toESM(require("classnames"));
|
|
14075
14100
|
var import_react_table = require("@tanstack/react-table");
|
|
14076
14101
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
@@ -14078,7 +14103,7 @@ var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
|
14078
14103
|
var ROW_HEIGHT = 52;
|
|
14079
14104
|
var BODY_HEIGHT = ROW_HEIGHT * 10;
|
|
14080
14105
|
function ValidateCsvTable({ data, headers, formatters: formatters2, className }) {
|
|
14081
|
-
const columns = (0,
|
|
14106
|
+
const columns = (0, import_react60.useMemo)(
|
|
14082
14107
|
() => {
|
|
14083
14108
|
const baseCellClassName = "Layer__table-cell-content Layer__csv-upload__validate-csv-table__cell-content";
|
|
14084
14109
|
const columnDefs = [{
|
|
@@ -14119,7 +14144,7 @@ function ValidateCsvTable({ data, headers, formatters: formatters2, className })
|
|
|
14119
14144
|
},
|
|
14120
14145
|
[headers, formatters2]
|
|
14121
14146
|
);
|
|
14122
|
-
const state = (0,
|
|
14147
|
+
const state = (0, import_react60.useMemo)(() => ({
|
|
14123
14148
|
sorting: [{ id: "is_valid", desc: false }],
|
|
14124
14149
|
columnVisibility: {
|
|
14125
14150
|
["is_valid"]: false
|
|
@@ -14132,7 +14157,7 @@ function ValidateCsvTable({ data, headers, formatters: formatters2, className })
|
|
|
14132
14157
|
getCoreRowModel: (0, import_react_table.getCoreRowModel)(),
|
|
14133
14158
|
getSortedRowModel: (0, import_react_table.getSortedRowModel)()
|
|
14134
14159
|
});
|
|
14135
|
-
const tableContainerRef = (0,
|
|
14160
|
+
const tableContainerRef = (0, import_react60.useRef)(null);
|
|
14136
14161
|
return /* @__PURE__ */ (0, import_jsx_runtime101.jsxs)("div", { className: `${className} Layer__csv-upload__validate-csv-table__container`, children: [
|
|
14137
14162
|
/* @__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) => {
|
|
14138
14163
|
const headerCellClassName = (0, import_classnames35.default)(
|
|
@@ -14212,7 +14237,7 @@ function UploadTransactionsValidateCsvStep({ parseCsvResponse, selectedAccountId
|
|
|
14212
14237
|
new_transactions_preview: transactionsPreview,
|
|
14213
14238
|
new_transactions_request: transactionsRequest
|
|
14214
14239
|
} = parseCsvResponse;
|
|
14215
|
-
const onClickUploadTransactions = (0,
|
|
14240
|
+
const onClickUploadTransactions = (0, import_react61.useCallback)(() => {
|
|
14216
14241
|
void uploadTransactions(__spreadProps(__spreadValues({}, transactionsRequest), {
|
|
14217
14242
|
customAccountId: selectedAccountId
|
|
14218
14243
|
}));
|
|
@@ -14248,7 +14273,7 @@ function UploadTransactionsValidateCsvStep({ parseCsvResponse, selectedAccountId
|
|
|
14248
14273
|
onClick: onClickUploadTransactions,
|
|
14249
14274
|
action: "upload" /* UPLOAD */,
|
|
14250
14275
|
withRetry: true,
|
|
14251
|
-
children:
|
|
14276
|
+
children: "Upload transactions"
|
|
14252
14277
|
}
|
|
14253
14278
|
)
|
|
14254
14279
|
] })
|
|
@@ -14258,25 +14283,25 @@ function UploadTransactionsValidateCsvStep({ parseCsvResponse, selectedAccountId
|
|
|
14258
14283
|
// src/components/UploadTransactions/UploadTransactions.tsx
|
|
14259
14284
|
var import_jsx_runtime103 = require("react/jsx-runtime");
|
|
14260
14285
|
function UploadTransactions({ onComplete }) {
|
|
14261
|
-
const [currentStep, setCurrentStep] = (0,
|
|
14262
|
-
const [selectedAccount, setSelectedAccount] = (0,
|
|
14263
|
-
const [file, setFile] = (0,
|
|
14264
|
-
const [parseCsvResponse, setParseCsvResponse] = (0,
|
|
14286
|
+
const [currentStep, setCurrentStep] = (0, import_react62.useState)(0 /* UploadCsv */);
|
|
14287
|
+
const [selectedAccount, setSelectedAccount] = (0, import_react62.useState)(null);
|
|
14288
|
+
const [file, setFile] = (0, import_react62.useState)(null);
|
|
14289
|
+
const [parseCsvResponse, setParseCsvResponse] = (0, import_react62.useState)(null);
|
|
14265
14290
|
const isValid2 = parseCsvResponse == null ? void 0 : parseCsvResponse.is_valid;
|
|
14266
|
-
const onSelectAccount = (0,
|
|
14291
|
+
const onSelectAccount = (0, import_react62.useCallback)((account) => {
|
|
14267
14292
|
setSelectedAccount(account);
|
|
14268
14293
|
}, []);
|
|
14269
|
-
const onSelectFile = (0,
|
|
14294
|
+
const onSelectFile = (0, import_react62.useCallback)((file2) => {
|
|
14270
14295
|
setFile(file2);
|
|
14271
14296
|
setParseCsvResponse(null);
|
|
14272
14297
|
}, []);
|
|
14273
|
-
const goBack = (0,
|
|
14274
|
-
const goForward = (0,
|
|
14275
|
-
const onParseCsv = (0,
|
|
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
|
+
const onParseCsv = (0, import_react62.useCallback)((parseCsvResponse2) => {
|
|
14276
14301
|
setParseCsvResponse(parseCsvResponse2);
|
|
14277
14302
|
goForward();
|
|
14278
14303
|
}, [goForward]);
|
|
14279
|
-
const onReupload = (0,
|
|
14304
|
+
const onReupload = (0, import_react62.useCallback)(() => {
|
|
14280
14305
|
setFile(null);
|
|
14281
14306
|
setParseCsvResponse(null);
|
|
14282
14307
|
goBack();
|
|
@@ -14327,14 +14352,14 @@ function UploadTransactions({ onComplete }) {
|
|
|
14327
14352
|
|
|
14328
14353
|
// src/components/BankTransactions/BankTransactions.tsx
|
|
14329
14354
|
var import_lodash2 = __toESM(require_lodash());
|
|
14330
|
-
var
|
|
14355
|
+
var import_react93 = require("react");
|
|
14331
14356
|
|
|
14332
14357
|
// src/hooks/useElementSize/useElementSize.ts
|
|
14333
|
-
var
|
|
14358
|
+
var import_react63 = require("react");
|
|
14334
14359
|
var useElementSize = (callback) => {
|
|
14335
|
-
const ref = (0,
|
|
14336
|
-
const resizeTimeout = (0,
|
|
14337
|
-
(0,
|
|
14360
|
+
const ref = (0, import_react63.useRef)(null);
|
|
14361
|
+
const resizeTimeout = (0, import_react63.useRef)(null);
|
|
14362
|
+
(0, import_react63.useLayoutEffect)(() => {
|
|
14338
14363
|
const element = ref == null ? void 0 : ref.current;
|
|
14339
14364
|
if (!element) {
|
|
14340
14365
|
return;
|
|
@@ -14365,10 +14390,10 @@ var useElementSize = (callback) => {
|
|
|
14365
14390
|
};
|
|
14366
14391
|
|
|
14367
14392
|
// src/hooks/useIsVisible/useIsVisible.ts
|
|
14368
|
-
var
|
|
14393
|
+
var import_react64 = require("react");
|
|
14369
14394
|
var useIsVisible = (ref) => {
|
|
14370
|
-
const [isIntersecting, setIntersecting] = (0,
|
|
14371
|
-
(0,
|
|
14395
|
+
const [isIntersecting, setIntersecting] = (0, import_react64.useState)(false);
|
|
14396
|
+
(0, import_react64.useEffect)(() => {
|
|
14372
14397
|
if (!ref.current) {
|
|
14373
14398
|
return;
|
|
14374
14399
|
}
|
|
@@ -14384,7 +14409,7 @@ var useIsVisible = (ref) => {
|
|
|
14384
14409
|
};
|
|
14385
14410
|
|
|
14386
14411
|
// src/components/BankTransactionList/BankTransactionListItem.tsx
|
|
14387
|
-
var
|
|
14412
|
+
var import_react78 = require("react");
|
|
14388
14413
|
|
|
14389
14414
|
// src/icons/File.tsx
|
|
14390
14415
|
var import_jsx_runtime104 = require("react/jsx-runtime");
|
|
@@ -14452,7 +14477,7 @@ var File = (_a) => {
|
|
|
14452
14477
|
var File_default = File;
|
|
14453
14478
|
|
|
14454
14479
|
// src/components/BankTransactionRow/BankTransactionRow.tsx
|
|
14455
|
-
var
|
|
14480
|
+
var import_react77 = require("react");
|
|
14456
14481
|
|
|
14457
14482
|
// src/icons/Scissors.tsx
|
|
14458
14483
|
var import_jsx_runtime105 = require("react/jsx-runtime");
|
|
@@ -14753,10 +14778,10 @@ var MinimizeTwo = (_a) => {
|
|
|
14753
14778
|
var MinimizeTwo_default = MinimizeTwo;
|
|
14754
14779
|
|
|
14755
14780
|
// src/components/CategorySelect/CategorySelectDrawer.tsx
|
|
14756
|
-
var
|
|
14781
|
+
var import_react66 = require("react");
|
|
14757
14782
|
|
|
14758
14783
|
// src/components/BankTransactionMobileList/BusinessCategories.tsx
|
|
14759
|
-
var
|
|
14784
|
+
var import_react65 = require("react");
|
|
14760
14785
|
|
|
14761
14786
|
// src/components/ActionableList/ActionableList.tsx
|
|
14762
14787
|
var import_classnames36 = __toESM(require("classnames"));
|
|
@@ -14872,7 +14897,7 @@ var getAssignedValue = (bankTransaction) => {
|
|
|
14872
14897
|
};
|
|
14873
14898
|
|
|
14874
14899
|
// src/hooks/categories/useCategories.ts
|
|
14875
|
-
var
|
|
14900
|
+
var import_swr11 = __toESM(require("swr"));
|
|
14876
14901
|
var CATEGORIES_TAG_KEY = "#categories";
|
|
14877
14902
|
function buildKey12({
|
|
14878
14903
|
access_token: accessToken,
|
|
@@ -14893,7 +14918,7 @@ function buildKey12({
|
|
|
14893
14918
|
function useCategories({ mode } = {}) {
|
|
14894
14919
|
const { data: auth } = useAuth();
|
|
14895
14920
|
const { businessId } = useLayerContext();
|
|
14896
|
-
return (0,
|
|
14921
|
+
return (0, import_swr11.default)(
|
|
14897
14922
|
() => buildKey12(__spreadProps(__spreadValues({}, auth), {
|
|
14898
14923
|
businessId,
|
|
14899
14924
|
mode
|
|
@@ -14922,8 +14947,8 @@ var BusinessCategories = ({
|
|
|
14922
14947
|
const categoryOptions = flattenCategories(
|
|
14923
14948
|
(categories != null ? categories : []).filter((category) => category.type != "ExclusionNested")
|
|
14924
14949
|
);
|
|
14925
|
-
const [optionsToShow, setOptionsToShow] = (0,
|
|
14926
|
-
const [selectedGroup, setSelectedGroup] = (0,
|
|
14950
|
+
const [optionsToShow, setOptionsToShow] = (0, import_react65.useState)(categoryOptions);
|
|
14951
|
+
const [selectedGroup, setSelectedGroup] = (0, import_react65.useState)();
|
|
14927
14952
|
const onCategorySelect = (v) => {
|
|
14928
14953
|
if (v.value.type === "GROUP" && v.value.items) {
|
|
14929
14954
|
setOptionsToShow(v.value.items);
|
|
@@ -14962,7 +14987,7 @@ var CategorySelectDrawer = ({
|
|
|
14962
14987
|
showTooltips: _showTooltips
|
|
14963
14988
|
}) => {
|
|
14964
14989
|
var _a, _b;
|
|
14965
|
-
const { setContent, close: close2 } = (0,
|
|
14990
|
+
const { setContent, close: close2 } = (0, import_react66.useContext)(DrawerContext);
|
|
14966
14991
|
const onDrawerCategorySelect = (value) => {
|
|
14967
14992
|
close2();
|
|
14968
14993
|
onSelect(value);
|
|
@@ -15257,7 +15282,7 @@ var CategorySelect = ({
|
|
|
15257
15282
|
};
|
|
15258
15283
|
|
|
15259
15284
|
// src/components/ExpandedBankTransactionRow/ExpandedBankTransactionRow.tsx
|
|
15260
|
-
var
|
|
15285
|
+
var import_react75 = require("react");
|
|
15261
15286
|
|
|
15262
15287
|
// src/icons/ScissorsFullOpen.tsx
|
|
15263
15288
|
var import_jsx_runtime114 = require("react/jsx-runtime");
|
|
@@ -15386,19 +15411,19 @@ var Trash = (_a) => {
|
|
|
15386
15411
|
var Trash_default = Trash;
|
|
15387
15412
|
|
|
15388
15413
|
// src/components/BankTransactionReceipts/BankTransactionReceipts.tsx
|
|
15389
|
-
var
|
|
15414
|
+
var import_react69 = require("react");
|
|
15390
15415
|
|
|
15391
15416
|
// src/contexts/ReceiptsContext/ReceiptsContext.ts
|
|
15392
|
-
var
|
|
15393
|
-
var ReceiptsContext = (0,
|
|
15417
|
+
var import_react67 = require("react");
|
|
15418
|
+
var ReceiptsContext = (0, import_react67.createContext)({
|
|
15394
15419
|
receiptUrls: [],
|
|
15395
15420
|
uploadReceipt: () => Promise.resolve(),
|
|
15396
15421
|
archiveDocument: () => Promise.resolve()
|
|
15397
15422
|
});
|
|
15398
|
-
var useReceiptsContext = () => (0,
|
|
15423
|
+
var useReceiptsContext = () => (0, import_react67.useContext)(ReceiptsContext);
|
|
15399
15424
|
|
|
15400
15425
|
// src/hooks/useReceipts/useReceipts.ts
|
|
15401
|
-
var
|
|
15426
|
+
var import_react68 = require("react");
|
|
15402
15427
|
var import_date_fns13 = require("date-fns");
|
|
15403
15428
|
var readDate = (date) => {
|
|
15404
15429
|
if (!date) return void 0;
|
|
@@ -15412,8 +15437,8 @@ var useReceipts = ({
|
|
|
15412
15437
|
const { apiUrl } = useEnvironment();
|
|
15413
15438
|
const { data: auth } = useAuth();
|
|
15414
15439
|
const { updateOneLocal: updateBankTransaction } = useBankTransactionsContext();
|
|
15415
|
-
const [receiptUrls, setReceiptUrls] = (0,
|
|
15416
|
-
(0,
|
|
15440
|
+
const [receiptUrls, setReceiptUrls] = (0, import_react68.useState)([]);
|
|
15441
|
+
(0, import_react68.useEffect)(() => {
|
|
15417
15442
|
if (isActive && receiptUrls.length === 0 && hasReceipts(bankTransaction)) {
|
|
15418
15443
|
void fetchDocuments();
|
|
15419
15444
|
}
|
|
@@ -15706,12 +15731,12 @@ var openReceiptInNewTab = (url, index) => (e) => {
|
|
|
15706
15731
|
`);
|
|
15707
15732
|
}
|
|
15708
15733
|
};
|
|
15709
|
-
var BankTransactionReceiptsWithProvider = (0,
|
|
15734
|
+
var BankTransactionReceiptsWithProvider = (0, import_react69.forwardRef)((_a, ref) => {
|
|
15710
15735
|
var _b = _a, { bankTransaction, isActive } = _b, props = __objRest(_b, ["bankTransaction", "isActive"]);
|
|
15711
15736
|
return /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(ReceiptsProvider, { bankTransaction, isActive, children: /* @__PURE__ */ (0, import_jsx_runtime119.jsx)(BankTransactionReceipts, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
15712
15737
|
});
|
|
15713
15738
|
BankTransactionReceiptsWithProvider.displayName = "BankTransactionReceiptsWithProvider";
|
|
15714
|
-
var BankTransactionReceipts = (0,
|
|
15739
|
+
var BankTransactionReceipts = (0, import_react69.forwardRef)(
|
|
15715
15740
|
({
|
|
15716
15741
|
classNamePrefix = "Layer",
|
|
15717
15742
|
floatingActions = false,
|
|
@@ -15719,7 +15744,7 @@ var BankTransactionReceipts = (0, import_react68.forwardRef)(
|
|
|
15719
15744
|
label
|
|
15720
15745
|
}, ref) => {
|
|
15721
15746
|
const { receiptUrls, uploadReceipt, archiveDocument } = useReceiptsContext();
|
|
15722
|
-
(0,
|
|
15747
|
+
(0, import_react69.useImperativeHandle)(ref, () => ({
|
|
15723
15748
|
uploadReceipt
|
|
15724
15749
|
}));
|
|
15725
15750
|
return /* @__PURE__ */ (0, import_jsx_runtime119.jsxs)("div", { className: `${classNamePrefix}__file-upload`, children: [
|
|
@@ -15760,22 +15785,22 @@ var BankTransactionReceipts = (0, import_react68.forwardRef)(
|
|
|
15760
15785
|
BankTransactionReceipts.displayName = "BankTransactionReceipts";
|
|
15761
15786
|
|
|
15762
15787
|
// src/hooks/bookkeeping/useBookkeepingStatus.ts
|
|
15763
|
-
var
|
|
15788
|
+
var import_swr12 = __toESM(require("swr"));
|
|
15764
15789
|
|
|
15765
15790
|
// src/providers/LegacyModeProvider/LegacyModeProvider.tsx
|
|
15766
|
-
var
|
|
15791
|
+
var import_react70 = require("react");
|
|
15767
15792
|
var import_jsx_runtime120 = require("react/jsx-runtime");
|
|
15768
|
-
var LegacyModeContext = (0,
|
|
15793
|
+
var LegacyModeContext = (0, import_react70.createContext)({
|
|
15769
15794
|
overrideMode: void 0
|
|
15770
15795
|
});
|
|
15771
15796
|
function useLegacyMode() {
|
|
15772
|
-
return (0,
|
|
15797
|
+
return (0, import_react70.useContext)(LegacyModeContext);
|
|
15773
15798
|
}
|
|
15774
15799
|
function LegacyModeProvider({
|
|
15775
15800
|
overrideMode,
|
|
15776
15801
|
children
|
|
15777
15802
|
}) {
|
|
15778
|
-
const memoizedValue = (0,
|
|
15803
|
+
const memoizedValue = (0, import_react70.useMemo)(() => ({ overrideMode }), [overrideMode]);
|
|
15779
15804
|
return /* @__PURE__ */ (0, import_jsx_runtime120.jsx)(LegacyModeContext.Provider, { value: memoizedValue, children });
|
|
15780
15805
|
}
|
|
15781
15806
|
|
|
@@ -15819,7 +15844,7 @@ function buildKey13({
|
|
|
15819
15844
|
function useBookkeepingStatus() {
|
|
15820
15845
|
const { data: auth } = useAuth();
|
|
15821
15846
|
const { businessId } = useLayerContext();
|
|
15822
|
-
return (0,
|
|
15847
|
+
return (0, import_swr12.default)(
|
|
15823
15848
|
() => buildKey13(__spreadProps(__spreadValues({}, auth), {
|
|
15824
15849
|
businessId
|
|
15825
15850
|
})),
|
|
@@ -16088,10 +16113,10 @@ var MatchFormMobile = ({
|
|
|
16088
16113
|
};
|
|
16089
16114
|
|
|
16090
16115
|
// src/components/Toggle/Toggle.tsx
|
|
16091
|
-
var
|
|
16116
|
+
var import_react71 = require("react");
|
|
16092
16117
|
var import_classnames42 = __toESM(require("classnames"));
|
|
16093
16118
|
var import_jsx_runtime124 = require("react/jsx-runtime");
|
|
16094
|
-
var
|
|
16119
|
+
var import_react72 = require("react");
|
|
16095
16120
|
var Toggle = ({
|
|
16096
16121
|
name,
|
|
16097
16122
|
options,
|
|
@@ -16099,10 +16124,10 @@ var Toggle = ({
|
|
|
16099
16124
|
onChange,
|
|
16100
16125
|
size = "medium" /* medium */
|
|
16101
16126
|
}) => {
|
|
16102
|
-
const [currentWidth, setCurrentWidth] = (0,
|
|
16103
|
-
const [thumbPos, setThumbPos] = (0,
|
|
16104
|
-
const [initialized, setInitialized] = (0,
|
|
16105
|
-
const activeOption = (0,
|
|
16127
|
+
const [currentWidth, setCurrentWidth] = (0, import_react71.useState)(0);
|
|
16128
|
+
const [thumbPos, setThumbPos] = (0, import_react71.useState)({ left: 0, width: 0 });
|
|
16129
|
+
const [initialized, setInitialized] = (0, import_react71.useState)(false);
|
|
16130
|
+
const activeOption = (0, import_react71.useMemo)(() => {
|
|
16106
16131
|
return selected ? selected : options.length > 0 ? options[0].value : void 0;
|
|
16107
16132
|
}, [selected, options]);
|
|
16108
16133
|
const toggleRef = useElementSize((_a, _b, c) => {
|
|
@@ -16142,14 +16167,14 @@ var Toggle = ({
|
|
|
16142
16167
|
shift2 = shift2 + (size === "medium" /* medium */ ? 2 : 1.5);
|
|
16143
16168
|
setThumbPos({ left: shift2, width });
|
|
16144
16169
|
};
|
|
16145
|
-
(0,
|
|
16170
|
+
(0, import_react71.useEffect)(() => {
|
|
16146
16171
|
const selectedIndex = getSelectedIndex();
|
|
16147
16172
|
updateThumbPosition(selectedIndex);
|
|
16148
16173
|
setTimeout(() => {
|
|
16149
16174
|
setInitialized(true);
|
|
16150
16175
|
}, 400);
|
|
16151
16176
|
}, []);
|
|
16152
|
-
(0,
|
|
16177
|
+
(0, import_react71.useEffect)(() => {
|
|
16153
16178
|
const selectedIndex = getSelectedIndex();
|
|
16154
16179
|
updateThumbPosition(selectedIndex);
|
|
16155
16180
|
}, [currentWidth]);
|
|
@@ -16165,7 +16190,7 @@ var Toggle = ({
|
|
|
16165
16190
|
return /* @__PURE__ */ (0, import_jsx_runtime124.jsxs)("div", { className: baseClassName, ref: toggleRef, children: [
|
|
16166
16191
|
options.map((option, index) => {
|
|
16167
16192
|
var _a;
|
|
16168
|
-
return /* @__PURE__ */ (0,
|
|
16193
|
+
return /* @__PURE__ */ (0, import_react72.createElement)(
|
|
16169
16194
|
ToggleOption,
|
|
16170
16195
|
__spreadProps(__spreadValues({}, option), {
|
|
16171
16196
|
size,
|
|
@@ -16250,7 +16275,7 @@ var ToggleOption = ({
|
|
|
16250
16275
|
};
|
|
16251
16276
|
|
|
16252
16277
|
// src/components/ExpandedBankTransactionRow/APIErrorNotifications.tsx
|
|
16253
|
-
var
|
|
16278
|
+
var import_react73 = require("react");
|
|
16254
16279
|
var import_jsx_runtime125 = require("react/jsx-runtime");
|
|
16255
16280
|
var ERROR_TITLE = "Approval Failed";
|
|
16256
16281
|
var ERROR_MESSAGE = "Something went wrong, try again later";
|
|
@@ -16261,7 +16286,7 @@ var APIErrorNotifications = ({
|
|
|
16261
16286
|
bankTransaction,
|
|
16262
16287
|
containerWidth
|
|
16263
16288
|
}) => {
|
|
16264
|
-
const [notifications, setNotifications] = (0,
|
|
16289
|
+
const [notifications, setNotifications] = (0, import_react73.useState)([]);
|
|
16265
16290
|
const pushNotification = (title, message) => {
|
|
16266
16291
|
const timestamp = (/* @__PURE__ */ new Date()).valueOf();
|
|
16267
16292
|
if (notificationsCache.find(
|
|
@@ -16290,7 +16315,7 @@ var APIErrorNotifications = ({
|
|
|
16290
16315
|
);
|
|
16291
16316
|
setNotifications(notificationsCache.concat());
|
|
16292
16317
|
};
|
|
16293
|
-
(0,
|
|
16318
|
+
(0, import_react73.useEffect)(() => {
|
|
16294
16319
|
if (bankTransaction.error) {
|
|
16295
16320
|
pushNotification(ERROR_TITLE, ERROR_MESSAGE);
|
|
16296
16321
|
}
|
|
@@ -16315,8 +16340,8 @@ var Notification = ({
|
|
|
16315
16340
|
notification,
|
|
16316
16341
|
deleteNotification
|
|
16317
16342
|
}) => {
|
|
16318
|
-
const [visible, setVisible] = (0,
|
|
16319
|
-
(0,
|
|
16343
|
+
const [visible, setVisible] = (0, import_react73.useState)(false);
|
|
16344
|
+
(0, import_react73.useEffect)(() => {
|
|
16320
16345
|
setVisible(true);
|
|
16321
16346
|
const timer = setTimeout(() => {
|
|
16322
16347
|
hideNotification();
|
|
@@ -16390,7 +16415,7 @@ var Textarea = (_a) => {
|
|
|
16390
16415
|
var import_react_form2 = require("@tanstack/react-form");
|
|
16391
16416
|
|
|
16392
16417
|
// src/hooks/useBankTransactions/useBankTransactionsMetadata.ts
|
|
16393
|
-
var
|
|
16418
|
+
var import_swr13 = __toESM(require("swr"));
|
|
16394
16419
|
var GET_BANK_TRANSACTION_METADATA_TAG_KEY = "#bank-transaction-metadata";
|
|
16395
16420
|
function buildKey14({
|
|
16396
16421
|
access_token: accessToken,
|
|
@@ -16411,7 +16436,7 @@ function buildKey14({
|
|
|
16411
16436
|
function useBankTransactionMetadata({ bankTransactionId }) {
|
|
16412
16437
|
const { data: auth } = useAuth();
|
|
16413
16438
|
const { businessId } = useLayerContext();
|
|
16414
|
-
return (0,
|
|
16439
|
+
return (0, import_swr13.default)(
|
|
16415
16440
|
() => buildKey14(__spreadProps(__spreadValues({}, auth), {
|
|
16416
16441
|
businessId,
|
|
16417
16442
|
bankTransactionId
|
|
@@ -16426,8 +16451,8 @@ function useBankTransactionMetadata({ bankTransactionId }) {
|
|
|
16426
16451
|
|
|
16427
16452
|
// src/hooks/useBankTransactions/useUpdateBankTransactionMetadata.ts
|
|
16428
16453
|
var import_mutation8 = __toESM(require("swr/mutation"));
|
|
16429
|
-
var
|
|
16430
|
-
var
|
|
16454
|
+
var import_swr14 = require("swr");
|
|
16455
|
+
var import_react74 = require("react");
|
|
16431
16456
|
var UPDATE_BANK_TRANSACTION_METADATA_TAG_KEY = "#update-bank-transaction-metadata";
|
|
16432
16457
|
function buildKey15({
|
|
16433
16458
|
access_token: accessToken,
|
|
@@ -16448,7 +16473,7 @@ function buildKey15({
|
|
|
16448
16473
|
function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
|
|
16449
16474
|
const { data: auth } = useAuth();
|
|
16450
16475
|
const { businessId } = useLayerContext();
|
|
16451
|
-
const { mutate } = (0,
|
|
16476
|
+
const { mutate } = (0, import_swr14.useSWRConfig)();
|
|
16452
16477
|
const mutationResponse = (0, import_mutation8.default)(
|
|
16453
16478
|
() => buildKey15({
|
|
16454
16479
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
@@ -16476,7 +16501,7 @@ function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
|
|
|
16476
16501
|
}
|
|
16477
16502
|
);
|
|
16478
16503
|
const { trigger: originalTrigger } = mutationResponse;
|
|
16479
|
-
const stableProxiedTrigger = (0,
|
|
16504
|
+
const stableProxiedTrigger = (0, import_react74.useCallback)(
|
|
16480
16505
|
(...triggerParameters) => __async(null, null, function* () {
|
|
16481
16506
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
16482
16507
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -16571,7 +16596,7 @@ var validateSplit = (splitData) => {
|
|
|
16571
16596
|
});
|
|
16572
16597
|
return valid;
|
|
16573
16598
|
};
|
|
16574
|
-
var ExpandedBankTransactionRow = (0,
|
|
16599
|
+
var ExpandedBankTransactionRow = (0, import_react75.forwardRef)(
|
|
16575
16600
|
({
|
|
16576
16601
|
bankTransaction,
|
|
16577
16602
|
isOpen = false,
|
|
@@ -16589,19 +16614,19 @@ var ExpandedBankTransactionRow = (0, import_react74.forwardRef)(
|
|
|
16589
16614
|
categorize: categorizeBankTransaction2,
|
|
16590
16615
|
match: matchBankTransaction2
|
|
16591
16616
|
} = useBankTransactionsContext();
|
|
16592
|
-
const [purpose, setPurpose] = (0,
|
|
16617
|
+
const [purpose, setPurpose] = (0, import_react75.useState)(
|
|
16593
16618
|
bankTransaction.category ? "categorize" /* categorize */ : hasMatch(bankTransaction) ? "match" /* match */ : "categorize" /* categorize */
|
|
16594
16619
|
);
|
|
16595
|
-
const [selectedMatchId, setSelectedMatchId] = (0,
|
|
16620
|
+
const [selectedMatchId, setSelectedMatchId] = (0, import_react75.useState)(
|
|
16596
16621
|
(_c = isAlreadyMatched2(bankTransaction)) != null ? _c : (_b = (_a = bankTransaction == null ? void 0 : bankTransaction.suggested_matches) == null ? void 0 : _a[0]) == null ? void 0 : _b.id
|
|
16597
16622
|
);
|
|
16598
|
-
const [matchFormError, setMatchFormError] = (0,
|
|
16599
|
-
const [splitFormError, setSplitFormError] = (0,
|
|
16600
|
-
const [height, setHeight] = (0,
|
|
16601
|
-
const [isOver, setOver] = (0,
|
|
16602
|
-
const bodyRef = (0,
|
|
16623
|
+
const [matchFormError, setMatchFormError] = (0, import_react75.useState)();
|
|
16624
|
+
const [splitFormError, setSplitFormError] = (0, import_react75.useState)();
|
|
16625
|
+
const [height, setHeight] = (0, import_react75.useState)(0);
|
|
16626
|
+
const [isOver, setOver] = (0, import_react75.useState)(false);
|
|
16627
|
+
const bodyRef = (0, import_react75.useRef)(null);
|
|
16603
16628
|
const defaultCategory = bankTransaction.category ? bankTransaction.category : hasSuggestions(bankTransaction.categorization_flow) ? (_d = bankTransaction.categorization_flow) == null ? void 0 : _d.suggestions.at(0) : void 0;
|
|
16604
|
-
const [rowState, updateRowState] = (0,
|
|
16629
|
+
const [rowState, updateRowState] = (0, import_react75.useState)({
|
|
16605
16630
|
splits: ((_e = bankTransaction.category) == null ? void 0 : _e.entries) ? (_f = bankTransaction.category) == null ? void 0 : _f.entries.map((c) => {
|
|
16606
16631
|
return c.type === "ExclusionSplitEntry" && c.category.type === "ExclusionNested" ? {
|
|
16607
16632
|
amount: c.amount || 0,
|
|
@@ -16732,7 +16757,7 @@ var ExpandedBankTransactionRow = (0, import_react74.forwardRef)(
|
|
|
16732
16757
|
);
|
|
16733
16758
|
close2();
|
|
16734
16759
|
});
|
|
16735
|
-
(0,
|
|
16760
|
+
(0, import_react75.useImperativeHandle)(ref, () => ({
|
|
16736
16761
|
save
|
|
16737
16762
|
}));
|
|
16738
16763
|
const onMatchSubmit = (matchId) => __async(null, null, function* () {
|
|
@@ -16746,11 +16771,11 @@ var ExpandedBankTransactionRow = (0, import_react74.forwardRef)(
|
|
|
16746
16771
|
yield matchBankTransaction2(bankTransaction.id, foundMatch.id);
|
|
16747
16772
|
close2();
|
|
16748
16773
|
});
|
|
16749
|
-
const getDivHeight = (0,
|
|
16774
|
+
const getDivHeight = (0, import_react75.useCallback)(() => {
|
|
16750
16775
|
const { height: height2 } = bodyRef.current ? bodyRef.current.getBoundingClientRect() : { height: void 0 };
|
|
16751
16776
|
return height2 || 0;
|
|
16752
16777
|
}, []);
|
|
16753
|
-
const handleTransitionEnd = (0,
|
|
16778
|
+
const handleTransitionEnd = (0, import_react75.useCallback)(
|
|
16754
16779
|
(e) => {
|
|
16755
16780
|
if (e.propertyName === "height") {
|
|
16756
16781
|
setHeight(isOpen ? "auto" : 0);
|
|
@@ -16761,7 +16786,7 @@ var ExpandedBankTransactionRow = (0, import_react74.forwardRef)(
|
|
|
16761
16786
|
},
|
|
16762
16787
|
[isOpen]
|
|
16763
16788
|
);
|
|
16764
|
-
(0,
|
|
16789
|
+
(0, import_react75.useEffect)(() => {
|
|
16765
16790
|
setHeight(getDivHeight());
|
|
16766
16791
|
setOver(false);
|
|
16767
16792
|
if (!isOpen) {
|
|
@@ -17020,7 +17045,7 @@ var import_classnames45 = __toESM(require("classnames"));
|
|
|
17020
17045
|
var import_date_fns17 = require("date-fns");
|
|
17021
17046
|
|
|
17022
17047
|
// src/hooks/bookkeeping/periods/useBookkeepingPeriods.ts
|
|
17023
|
-
var
|
|
17048
|
+
var import_swr15 = __toESM(require("swr"));
|
|
17024
17049
|
|
|
17025
17050
|
// src/utils/bookkeeping/bookkeepingStatusFilters.ts
|
|
17026
17051
|
function isActiveBookkeepingStatus(status) {
|
|
@@ -17103,7 +17128,7 @@ function useBookkeepingPeriods() {
|
|
|
17103
17128
|
const { businessId } = useLayerContext();
|
|
17104
17129
|
const { data, isLoading: isLoadingBookkeepingStatus } = useBookkeepingStatus();
|
|
17105
17130
|
const isActiveOrPaused = data ? isActiveOrPausedBookkeepingStatus(data.status) : false;
|
|
17106
|
-
const swrResponse = (0,
|
|
17131
|
+
const swrResponse = (0, import_swr15.default)(
|
|
17107
17132
|
() => buildKey16(__spreadProps(__spreadValues({}, auth), {
|
|
17108
17133
|
businessId,
|
|
17109
17134
|
isActiveOrPaused
|
|
@@ -17265,13 +17290,13 @@ var BankTransactionProcessingInfo = () => /* @__PURE__ */ (0, import_jsx_runtime
|
|
|
17265
17290
|
] });
|
|
17266
17291
|
|
|
17267
17292
|
// src/hooks/visibility/useDelayedVisibility.ts
|
|
17268
|
-
var
|
|
17293
|
+
var import_react76 = require("react");
|
|
17269
17294
|
function useDelayedVisibility({
|
|
17270
17295
|
delay,
|
|
17271
17296
|
initialVisibility = false
|
|
17272
17297
|
}) {
|
|
17273
|
-
const [isVisible, setIsVisible] = (0,
|
|
17274
|
-
(0,
|
|
17298
|
+
const [isVisible, setIsVisible] = (0, import_react76.useState)(initialVisibility);
|
|
17299
|
+
(0, import_react76.useEffect)(
|
|
17275
17300
|
() => {
|
|
17276
17301
|
const timer = setTimeout(() => {
|
|
17277
17302
|
setIsVisible(true);
|
|
@@ -17320,17 +17345,17 @@ var BankTransactionRow = ({
|
|
|
17320
17345
|
stringOverrides
|
|
17321
17346
|
}) => {
|
|
17322
17347
|
var _a, _b, _c, _d, _e, _f;
|
|
17323
|
-
const expandedRowRef = (0,
|
|
17324
|
-
const [showRetry, setShowRetry] = (0,
|
|
17348
|
+
const expandedRowRef = (0, import_react77.useRef)(null);
|
|
17349
|
+
const [showRetry, setShowRetry] = (0, import_react77.useState)(false);
|
|
17325
17350
|
const {
|
|
17326
17351
|
categorize: categorizeBankTransaction2,
|
|
17327
17352
|
match: matchBankTransaction2,
|
|
17328
17353
|
shouldHideAfterCategorize
|
|
17329
17354
|
} = useBankTransactionsContext();
|
|
17330
|
-
const [selectedCategory, setSelectedCategory] = (0,
|
|
17355
|
+
const [selectedCategory, setSelectedCategory] = (0, import_react77.useState)(
|
|
17331
17356
|
getDefaultSelectedCategory(bankTransaction)
|
|
17332
17357
|
);
|
|
17333
|
-
const [open2, setOpen] = (0,
|
|
17358
|
+
const [open2, setOpen] = (0, import_react77.useState)(false);
|
|
17334
17359
|
const toggleOpen = () => {
|
|
17335
17360
|
setShowRetry(false);
|
|
17336
17361
|
setOpen(!open2);
|
|
@@ -17346,12 +17371,12 @@ var BankTransactionRow = ({
|
|
|
17346
17371
|
}
|
|
17347
17372
|
}
|
|
17348
17373
|
};
|
|
17349
|
-
(0,
|
|
17374
|
+
(0, import_react77.useEffect)(() => {
|
|
17350
17375
|
if (bankTransaction.error) {
|
|
17351
17376
|
setShowRetry(true);
|
|
17352
17377
|
}
|
|
17353
17378
|
}, [bankTransaction.error]);
|
|
17354
|
-
(0,
|
|
17379
|
+
(0, import_react77.useEffect)(() => {
|
|
17355
17380
|
if (editable && bankTransaction.recently_categorized && shouldHideAfterCategorize()) {
|
|
17356
17381
|
setTimeout(() => {
|
|
17357
17382
|
removeTransaction(bankTransaction);
|
|
@@ -17394,7 +17419,7 @@ var BankTransactionRow = ({
|
|
|
17394
17419
|
initialLoad ? "initial-load" : "",
|
|
17395
17420
|
isVisible ? "show" : ""
|
|
17396
17421
|
);
|
|
17397
|
-
const showReceiptDataProperties = (0,
|
|
17422
|
+
const showReceiptDataProperties = (0, import_react77.useMemo)(
|
|
17398
17423
|
() => toDataProperties({ "show-receipt-upload-column": showReceiptUploadColumn }),
|
|
17399
17424
|
[showReceiptUploadColumn]
|
|
17400
17425
|
);
|
|
@@ -17664,17 +17689,17 @@ var BankTransactionListItem = ({
|
|
|
17664
17689
|
stringOverrides
|
|
17665
17690
|
}) => {
|
|
17666
17691
|
var _a, _b;
|
|
17667
|
-
const expandedRowRef = (0,
|
|
17668
|
-
const [showRetry, setShowRetry] = (0,
|
|
17692
|
+
const expandedRowRef = (0, import_react78.useRef)(null);
|
|
17693
|
+
const [showRetry, setShowRetry] = (0, import_react78.useState)(false);
|
|
17669
17694
|
const {
|
|
17670
17695
|
categorize: categorizeBankTransaction2,
|
|
17671
17696
|
match: matchBankTransaction2,
|
|
17672
17697
|
shouldHideAfterCategorize
|
|
17673
17698
|
} = useBankTransactionsContext();
|
|
17674
|
-
const [selectedCategory, setSelectedCategory] = (0,
|
|
17699
|
+
const [selectedCategory, setSelectedCategory] = (0, import_react78.useState)(
|
|
17675
17700
|
getDefaultSelectedCategory(bankTransaction)
|
|
17676
17701
|
);
|
|
17677
|
-
const [open2, setOpen] = (0,
|
|
17702
|
+
const [open2, setOpen] = (0, import_react78.useState)(false);
|
|
17678
17703
|
const toggleOpen = () => {
|
|
17679
17704
|
setShowRetry(false);
|
|
17680
17705
|
setOpen(!open2);
|
|
@@ -17682,12 +17707,12 @@ var BankTransactionListItem = ({
|
|
|
17682
17707
|
const bookkeepingStatus = useEffectiveBookkeepingStatus();
|
|
17683
17708
|
const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
|
|
17684
17709
|
const { isVisible } = useDelayedVisibility({ delay: index * 80 });
|
|
17685
|
-
(0,
|
|
17710
|
+
(0, import_react78.useEffect)(() => {
|
|
17686
17711
|
if (bankTransaction.error) {
|
|
17687
17712
|
setShowRetry(true);
|
|
17688
17713
|
}
|
|
17689
17714
|
}, [bankTransaction.error]);
|
|
17690
|
-
(0,
|
|
17715
|
+
(0, import_react78.useEffect)(() => {
|
|
17691
17716
|
if (editable && bankTransaction.recently_categorized && shouldHideAfterCategorize()) {
|
|
17692
17717
|
setTimeout(() => {
|
|
17693
17718
|
removeTransaction(bankTransaction);
|
|
@@ -17855,10 +17880,10 @@ var BankTransactionList = ({
|
|
|
17855
17880
|
};
|
|
17856
17881
|
|
|
17857
17882
|
// src/components/BankTransactionMobileList/BankTransactionMobileListItem.tsx
|
|
17858
|
-
var
|
|
17883
|
+
var import_react85 = require("react");
|
|
17859
17884
|
|
|
17860
17885
|
// src/components/BankTransactionMobileList/BusinessForm.tsx
|
|
17861
|
-
var
|
|
17886
|
+
var import_react79 = require("react");
|
|
17862
17887
|
|
|
17863
17888
|
// src/icons/Paperclip.tsx
|
|
17864
17889
|
var import_jsx_runtime139 = require("react/jsx-runtime");
|
|
@@ -17897,19 +17922,19 @@ var BusinessForm = ({
|
|
|
17897
17922
|
showReceiptUploads,
|
|
17898
17923
|
showDescriptions
|
|
17899
17924
|
}) => {
|
|
17900
|
-
const receiptsRef = (0,
|
|
17901
|
-
const { setContent, close: close2 } = (0,
|
|
17925
|
+
const receiptsRef = (0, import_react79.useRef)(null);
|
|
17926
|
+
const { setContent, close: close2 } = (0, import_react79.useContext)(DrawerContext);
|
|
17902
17927
|
const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
|
|
17903
|
-
const [selectedCategory, setSelectedCategory] = (0,
|
|
17928
|
+
const [selectedCategory, setSelectedCategory] = (0, import_react79.useState)(
|
|
17904
17929
|
getAssignedValue(bankTransaction)
|
|
17905
17930
|
);
|
|
17906
|
-
const [showRetry, setShowRetry] = (0,
|
|
17907
|
-
(0,
|
|
17931
|
+
const [showRetry, setShowRetry] = (0, import_react79.useState)(false);
|
|
17932
|
+
(0, import_react79.useEffect)(() => {
|
|
17908
17933
|
if (bankTransaction.error) {
|
|
17909
17934
|
setShowRetry(true);
|
|
17910
17935
|
}
|
|
17911
17936
|
}, [bankTransaction.error]);
|
|
17912
|
-
const options = (0,
|
|
17937
|
+
const options = (0, import_react79.useMemo)(() => {
|
|
17913
17938
|
var _a;
|
|
17914
17939
|
const options2 = ((_a = bankTransaction == null ? void 0 : bankTransaction.categorization_flow) == null ? void 0 : _a.type) === "ASK_FROM_SUGGESTIONS" /* ASK_FROM_SUGGESTIONS */ ? bankTransaction.categorization_flow.suggestions.map(
|
|
17915
17940
|
(x) => mapCategoryToOption(x)
|
|
@@ -18045,7 +18070,7 @@ var BusinessForm = ({
|
|
|
18045
18070
|
};
|
|
18046
18071
|
|
|
18047
18072
|
// src/components/BankTransactionMobileList/PersonalForm.tsx
|
|
18048
|
-
var
|
|
18073
|
+
var import_react80 = require("react");
|
|
18049
18074
|
|
|
18050
18075
|
// src/components/BankTransactionMobileList/constants.ts
|
|
18051
18076
|
var PersonalCategories = /* @__PURE__ */ ((PersonalCategories2) => {
|
|
@@ -18073,10 +18098,10 @@ var PersonalForm = ({
|
|
|
18073
18098
|
showDescriptions,
|
|
18074
18099
|
showCategorization
|
|
18075
18100
|
}) => {
|
|
18076
|
-
const receiptsRef = (0,
|
|
18101
|
+
const receiptsRef = (0, import_react80.useRef)(null);
|
|
18077
18102
|
const { categorize: categorizeBankTransaction2, isLoading } = useBankTransactionsContext();
|
|
18078
|
-
const [showRetry, setShowRetry] = (0,
|
|
18079
|
-
(0,
|
|
18103
|
+
const [showRetry, setShowRetry] = (0, import_react80.useState)(false);
|
|
18104
|
+
(0, import_react80.useEffect)(() => {
|
|
18080
18105
|
if (bankTransaction.error) {
|
|
18081
18106
|
setShowRetry(true);
|
|
18082
18107
|
}
|
|
@@ -18146,10 +18171,10 @@ var PersonalForm = ({
|
|
|
18146
18171
|
};
|
|
18147
18172
|
|
|
18148
18173
|
// src/components/BankTransactionMobileList/SplitAndMatchForm.tsx
|
|
18149
|
-
var
|
|
18174
|
+
var import_react83 = require("react");
|
|
18150
18175
|
|
|
18151
18176
|
// src/components/BankTransactionMobileList/MatchForm.tsx
|
|
18152
|
-
var
|
|
18177
|
+
var import_react81 = require("react");
|
|
18153
18178
|
var import_classnames49 = __toESM(require("classnames"));
|
|
18154
18179
|
var import_jsx_runtime142 = require("react/jsx-runtime");
|
|
18155
18180
|
var MatchForm2 = ({
|
|
@@ -18159,14 +18184,14 @@ var MatchForm2 = ({
|
|
|
18159
18184
|
showCategorization
|
|
18160
18185
|
}) => {
|
|
18161
18186
|
var _a, _b;
|
|
18162
|
-
const receiptsRef = (0,
|
|
18187
|
+
const receiptsRef = (0, import_react81.useRef)(null);
|
|
18163
18188
|
const { match: matchBankTransaction2, isLoading } = useBankTransactionsContext();
|
|
18164
|
-
const [selectedMatchId, setSelectedMatchId] = (0,
|
|
18189
|
+
const [selectedMatchId, setSelectedMatchId] = (0, import_react81.useState)(
|
|
18165
18190
|
(_b = isAlreadyMatched(bankTransaction)) != null ? _b : bankTransaction.suggested_matches && ((_a = bankTransaction.suggested_matches) == null ? void 0 : _a.length) > 0 ? bankTransaction.suggested_matches[0].id : void 0
|
|
18166
18191
|
);
|
|
18167
|
-
const [formError, setFormError] = (0,
|
|
18168
|
-
const [showRetry, setShowRetry] = (0,
|
|
18169
|
-
(0,
|
|
18192
|
+
const [formError, setFormError] = (0, import_react81.useState)();
|
|
18193
|
+
const [showRetry, setShowRetry] = (0, import_react81.useState)(false);
|
|
18194
|
+
(0, import_react81.useEffect)(() => {
|
|
18170
18195
|
if (bankTransaction.error) {
|
|
18171
18196
|
setShowRetry(true);
|
|
18172
18197
|
} else if (showRetry) {
|
|
@@ -18257,7 +18282,7 @@ var MatchForm2 = ({
|
|
|
18257
18282
|
};
|
|
18258
18283
|
|
|
18259
18284
|
// src/components/BankTransactionMobileList/SplitForm.tsx
|
|
18260
|
-
var
|
|
18285
|
+
var import_react82 = require("react");
|
|
18261
18286
|
var import_classnames50 = __toESM(require("classnames"));
|
|
18262
18287
|
var import_jsx_runtime143 = require("react/jsx-runtime");
|
|
18263
18288
|
var SplitForm = ({
|
|
@@ -18268,13 +18293,13 @@ var SplitForm = ({
|
|
|
18268
18293
|
showDescriptions
|
|
18269
18294
|
}) => {
|
|
18270
18295
|
var _a, _b, _c, _d;
|
|
18271
|
-
const receiptsRef = (0,
|
|
18296
|
+
const receiptsRef = (0, import_react82.useRef)(null);
|
|
18272
18297
|
const {
|
|
18273
18298
|
categorize: categorizeBankTransaction2,
|
|
18274
18299
|
isLoading
|
|
18275
18300
|
} = useBankTransactionsContext();
|
|
18276
18301
|
const defaultCategory = bankTransaction.category || hasSuggestions(bankTransaction.categorization_flow) && ((_b = (_a = bankTransaction.categorization_flow) == null ? void 0 : _a.suggestions) == null ? void 0 : _b[0]);
|
|
18277
|
-
const [rowState, updateRowState] = (0,
|
|
18302
|
+
const [rowState, updateRowState] = (0, import_react82.useState)({
|
|
18278
18303
|
splits: ((_c = bankTransaction.category) == null ? void 0 : _c.entries) ? (_d = bankTransaction.category) == null ? void 0 : _d.entries.map((c) => {
|
|
18279
18304
|
return c.type === "ExclusionSplitEntry" && c.category.type === "ExclusionNested" ? {
|
|
18280
18305
|
amount: c.amount || 0,
|
|
@@ -18300,9 +18325,9 @@ var SplitForm = ({
|
|
|
18300
18325
|
description: "",
|
|
18301
18326
|
file: void 0
|
|
18302
18327
|
});
|
|
18303
|
-
const [formError, setFormError] = (0,
|
|
18304
|
-
const [showRetry, setShowRetry] = (0,
|
|
18305
|
-
(0,
|
|
18328
|
+
const [formError, setFormError] = (0, import_react82.useState)();
|
|
18329
|
+
const [showRetry, setShowRetry] = (0, import_react82.useState)(false);
|
|
18330
|
+
(0, import_react82.useEffect)(() => {
|
|
18306
18331
|
if (bankTransaction.error) {
|
|
18307
18332
|
setShowRetry(true);
|
|
18308
18333
|
}
|
|
@@ -18526,7 +18551,7 @@ var SplitAndMatchForm = ({
|
|
|
18526
18551
|
showCategorization
|
|
18527
18552
|
}) => {
|
|
18528
18553
|
const anyMatch = hasMatch(bankTransaction);
|
|
18529
|
-
const [formType, setFormType] = (0,
|
|
18554
|
+
const [formType, setFormType] = (0, import_react83.useState)(
|
|
18530
18555
|
bankTransaction.category ? "categorize" /* categorize */ : anyMatch ? "match" /* match */ : "categorize" /* categorize */
|
|
18531
18556
|
);
|
|
18532
18557
|
return /* @__PURE__ */ (0, import_jsx_runtime144.jsxs)("div", { className: "Layer__bank-transaction-mobile-list-item__split-and-match-form", children: [
|
|
@@ -18606,9 +18631,9 @@ var BankTransactionMobileForms = ({
|
|
|
18606
18631
|
};
|
|
18607
18632
|
|
|
18608
18633
|
// src/components/BankTransactionMobileList/TransactionToOpenContext.ts
|
|
18609
|
-
var
|
|
18634
|
+
var import_react84 = require("react");
|
|
18610
18635
|
var useTransactionToOpen = () => {
|
|
18611
|
-
const [transactionIdToOpen, setTransactionIdToOpen] = (0,
|
|
18636
|
+
const [transactionIdToOpen, setTransactionIdToOpen] = (0, import_react84.useState)(void 0);
|
|
18612
18637
|
const clearTransactionIdToOpen = () => setTransactionIdToOpen(void 0);
|
|
18613
18638
|
return {
|
|
18614
18639
|
transactionIdToOpen,
|
|
@@ -18616,7 +18641,7 @@ var useTransactionToOpen = () => {
|
|
|
18616
18641
|
clearTransactionIdToOpen
|
|
18617
18642
|
};
|
|
18618
18643
|
};
|
|
18619
|
-
var TransactionToOpenContext = (0,
|
|
18644
|
+
var TransactionToOpenContext = (0, import_react84.createContext)({
|
|
18620
18645
|
transactionIdToOpen: void 0,
|
|
18621
18646
|
setTransactionIdToOpen: () => void 0,
|
|
18622
18647
|
clearTransactionIdToOpen: () => void 0
|
|
@@ -18653,7 +18678,7 @@ var BankTransactionMobileListItem = ({
|
|
|
18653
18678
|
transactionIdToOpen,
|
|
18654
18679
|
setTransactionIdToOpen,
|
|
18655
18680
|
clearTransactionIdToOpen
|
|
18656
|
-
} = (0,
|
|
18681
|
+
} = (0, import_react85.useContext)(TransactionToOpenContext);
|
|
18657
18682
|
const { shouldHideAfterCategorize } = useBankTransactionsContext();
|
|
18658
18683
|
const formRowRef = useElementSize(
|
|
18659
18684
|
(_a2, _b, { height: height2 }) => setHeight(height2)
|
|
@@ -18661,14 +18686,14 @@ var BankTransactionMobileListItem = ({
|
|
|
18661
18686
|
const headingRowRef = useElementSize((_a2, _b, { height: height2 }) => {
|
|
18662
18687
|
setHeadingHeight(height2);
|
|
18663
18688
|
});
|
|
18664
|
-
const itemRef = (0,
|
|
18665
|
-
const [removeAnim, setRemoveAnim] = (0,
|
|
18666
|
-
const [purpose, setPurpose] = (0,
|
|
18689
|
+
const itemRef = (0, import_react85.useRef)(null);
|
|
18690
|
+
const [removeAnim, setRemoveAnim] = (0, import_react85.useState)(false);
|
|
18691
|
+
const [purpose, setPurpose] = (0, import_react85.useState)(
|
|
18667
18692
|
bankTransaction.category ? bankTransaction.category.type === "ExclusionNested" ? "personal" /* personal */ : bankTransaction.categorization_status === "SPLIT" /* SPLIT */ ? "more" /* more */ : "business" /* business */ : hasMatch(bankTransaction) ? "more" /* more */ : "business" /* business */
|
|
18668
18693
|
);
|
|
18669
|
-
const [open2, setOpen] = (0,
|
|
18670
|
-
const [height, setHeight] = (0,
|
|
18671
|
-
const [headingHeight, setHeadingHeight] = (0,
|
|
18694
|
+
const [open2, setOpen] = (0, import_react85.useState)(isFirstItem);
|
|
18695
|
+
const [height, setHeight] = (0, import_react85.useState)(0);
|
|
18696
|
+
const [headingHeight, setHeadingHeight] = (0, import_react85.useState)(63);
|
|
18672
18697
|
const openNext = () => {
|
|
18673
18698
|
if (editable && itemRef.current && itemRef.current.nextSibling) {
|
|
18674
18699
|
const txId = itemRef.current.nextSibling.getAttribute(
|
|
@@ -18679,13 +18704,13 @@ var BankTransactionMobileListItem = ({
|
|
|
18679
18704
|
}
|
|
18680
18705
|
}
|
|
18681
18706
|
};
|
|
18682
|
-
(0,
|
|
18707
|
+
(0, import_react85.useEffect)(() => {
|
|
18683
18708
|
if (transactionIdToOpen && transactionIdToOpen === bankTransaction.id) {
|
|
18684
18709
|
setOpen(true);
|
|
18685
18710
|
clearTransactionIdToOpen();
|
|
18686
18711
|
}
|
|
18687
18712
|
}, [transactionIdToOpen]);
|
|
18688
|
-
(0,
|
|
18713
|
+
(0, import_react85.useEffect)(() => {
|
|
18689
18714
|
if (!removeAnim && bankTransaction.recently_categorized) {
|
|
18690
18715
|
if (editable && shouldHideAfterCategorize()) {
|
|
18691
18716
|
setRemoveAnim(true);
|
|
@@ -18709,7 +18734,7 @@ var BankTransactionMobileListItem = ({
|
|
|
18709
18734
|
setOpen(false);
|
|
18710
18735
|
setHeight(0);
|
|
18711
18736
|
};
|
|
18712
|
-
(0,
|
|
18737
|
+
(0, import_react85.useEffect)(() => {
|
|
18713
18738
|
if (editable && bankTransaction.recently_categorized && shouldHideAfterCategorize()) {
|
|
18714
18739
|
setTimeout(() => {
|
|
18715
18740
|
removeTransaction(bankTransaction);
|
|
@@ -18856,7 +18881,7 @@ var BankTransactionMobileList = ({
|
|
|
18856
18881
|
};
|
|
18857
18882
|
|
|
18858
18883
|
// src/components/BankTransactionsTable/BankTransactionsTable.tsx
|
|
18859
|
-
var
|
|
18884
|
+
var import_react86 = require("react");
|
|
18860
18885
|
|
|
18861
18886
|
// src/components/SkeletonLoader/SkeletonLoader.tsx
|
|
18862
18887
|
var import_classnames52 = __toESM(require("classnames"));
|
|
@@ -19028,7 +19053,7 @@ var BankTransactionsTable = ({
|
|
|
19028
19053
|
return ((_a2 = transaction.document_ids) == null ? void 0 : _a2.length) > 0;
|
|
19029
19054
|
}
|
|
19030
19055
|
))) != null ? _a : false;
|
|
19031
|
-
const showReceiptDataProperties = (0,
|
|
19056
|
+
const showReceiptDataProperties = (0, import_react86.useMemo)(
|
|
19032
19057
|
() => toDataProperties({ "show-receipt-upload-column": showReceiptColumn }),
|
|
19033
19058
|
[showReceiptColumn]
|
|
19034
19059
|
);
|
|
@@ -19093,7 +19118,7 @@ var BankTransactionsTable = ({
|
|
|
19093
19118
|
};
|
|
19094
19119
|
|
|
19095
19120
|
// src/components/ErrorBoundary/ErrorBoundary.tsx
|
|
19096
|
-
var
|
|
19121
|
+
var import_react87 = require("react");
|
|
19097
19122
|
|
|
19098
19123
|
// src/components/ErrorBoundary/ErrorBoundaryMessage.tsx
|
|
19099
19124
|
var import_jsx_runtime153 = require("react/jsx-runtime");
|
|
@@ -19110,7 +19135,7 @@ var ErrorBoundaryMessage = () => {
|
|
|
19110
19135
|
|
|
19111
19136
|
// src/components/ErrorBoundary/ErrorBoundary.tsx
|
|
19112
19137
|
var import_jsx_runtime154 = require("react/jsx-runtime");
|
|
19113
|
-
var ErrorBoundary = class extends
|
|
19138
|
+
var ErrorBoundary = class extends import_react87.Component {
|
|
19114
19139
|
constructor(props) {
|
|
19115
19140
|
super(props);
|
|
19116
19141
|
__publicField(this, "onError");
|
|
@@ -19136,7 +19161,7 @@ var ErrorBoundary = class extends import_react86.Component {
|
|
|
19136
19161
|
};
|
|
19137
19162
|
|
|
19138
19163
|
// src/hooks/usePagination/usePagination.ts
|
|
19139
|
-
var
|
|
19164
|
+
var import_react88 = require("react");
|
|
19140
19165
|
|
|
19141
19166
|
// src/utils/helpers.ts
|
|
19142
19167
|
var range = (start, end) => {
|
|
@@ -19152,7 +19177,7 @@ var usePagination = ({
|
|
|
19152
19177
|
siblingCount = 1,
|
|
19153
19178
|
currentPage
|
|
19154
19179
|
}) => {
|
|
19155
|
-
const paginationRange = (0,
|
|
19180
|
+
const paginationRange = (0, import_react88.useMemo)(() => {
|
|
19156
19181
|
const totalPageCount = Math.ceil(totalCount / pageSize);
|
|
19157
19182
|
const totalPageNumbers = siblingCount + 5;
|
|
19158
19183
|
if (totalPageNumbers >= totalPageCount) {
|
|
@@ -19288,21 +19313,21 @@ var PaginationContent = ({
|
|
|
19288
19313
|
};
|
|
19289
19314
|
|
|
19290
19315
|
// src/components/BankTransactions/BankTransactionsHeader.tsx
|
|
19291
|
-
var
|
|
19316
|
+
var import_react91 = require("react");
|
|
19292
19317
|
var import_classnames55 = __toESM(require("classnames"));
|
|
19293
19318
|
var import_date_fns21 = require("date-fns");
|
|
19294
19319
|
|
|
19295
19320
|
// src/hooks/useDebounce/useDebounce.ts
|
|
19296
|
-
var
|
|
19321
|
+
var import_react89 = require("react");
|
|
19297
19322
|
var import_lodash = __toESM(require_lodash());
|
|
19298
19323
|
var DEFAULT_WAIT = 300;
|
|
19299
19324
|
var DEFAULT_MAX_WAIT = 2 * DEFAULT_WAIT;
|
|
19300
19325
|
function useDebounce(fn) {
|
|
19301
|
-
const internalFnRef = (0,
|
|
19302
|
-
(0,
|
|
19326
|
+
const internalFnRef = (0, import_react89.useRef)(fn);
|
|
19327
|
+
(0, import_react89.useEffect)(() => {
|
|
19303
19328
|
internalFnRef.current = fn;
|
|
19304
19329
|
}, [fn]);
|
|
19305
|
-
const debouncedCallback = (0,
|
|
19330
|
+
const debouncedCallback = (0, import_react89.useMemo)(() => {
|
|
19306
19331
|
const internalFn = (...args) => {
|
|
19307
19332
|
internalFnRef.current(...args);
|
|
19308
19333
|
};
|
|
@@ -19421,7 +19446,7 @@ function useBankTransactionsDownload() {
|
|
|
19421
19446
|
}
|
|
19422
19447
|
|
|
19423
19448
|
// src/components/utility/InvisibleDownload.tsx
|
|
19424
|
-
var
|
|
19449
|
+
var import_react90 = require("react");
|
|
19425
19450
|
|
|
19426
19451
|
// src/utils/delay/runDelayed.ts
|
|
19427
19452
|
var DEFAULT_DELAY_MS = 50;
|
|
@@ -19434,17 +19459,17 @@ function runDelayedSync(block, delayMs = DEFAULT_DELAY_MS) {
|
|
|
19434
19459
|
// src/components/utility/InvisibleDownload.tsx
|
|
19435
19460
|
var import_jsx_runtime159 = require("react/jsx-runtime");
|
|
19436
19461
|
function useInvisibleDownload() {
|
|
19437
|
-
const invisibleDownloadRef = (0,
|
|
19438
|
-
const triggerInvisibleDownload = (0,
|
|
19462
|
+
const invisibleDownloadRef = (0, import_react90.useRef)(null);
|
|
19463
|
+
const triggerInvisibleDownload = (0, import_react90.useCallback)((options) => {
|
|
19439
19464
|
var _a;
|
|
19440
19465
|
void ((_a = invisibleDownloadRef.current) == null ? void 0 : _a.trigger(options));
|
|
19441
19466
|
}, []);
|
|
19442
19467
|
return { invisibleDownloadRef, triggerInvisibleDownload };
|
|
19443
19468
|
}
|
|
19444
19469
|
var CLASS_NAME9 = "Layer__InvisibleDownload";
|
|
19445
|
-
var InvisibleDownload = (0,
|
|
19446
|
-
const internalRef = (0,
|
|
19447
|
-
(0,
|
|
19470
|
+
var InvisibleDownload = (0, import_react90.forwardRef)((_props, ref) => {
|
|
19471
|
+
const internalRef = (0, import_react90.useRef)(null);
|
|
19472
|
+
(0, import_react90.useImperativeHandle)(ref, () => ({
|
|
19448
19473
|
trigger: (_0) => __async(null, [_0], function* ({ url }) {
|
|
19449
19474
|
var _a;
|
|
19450
19475
|
(_a = internalRef.current) == null ? void 0 : _a.setAttribute("href", url);
|
|
@@ -19454,7 +19479,7 @@ var InvisibleDownload = (0, import_react89.forwardRef)((_props, ref) => {
|
|
|
19454
19479
|
});
|
|
19455
19480
|
})
|
|
19456
19481
|
}));
|
|
19457
|
-
const handleContainClick = (0,
|
|
19482
|
+
const handleContainClick = (0, import_react90.useCallback)((event) => {
|
|
19458
19483
|
event.stopPropagation();
|
|
19459
19484
|
}, []);
|
|
19460
19485
|
return /* @__PURE__ */ (0, import_jsx_runtime159.jsx)("a", { download: true, className: CLASS_NAME9, ref: internalRef, onClick: handleContainClick });
|
|
@@ -19466,14 +19491,14 @@ var InvisibleDownload_default = InvisibleDownload;
|
|
|
19466
19491
|
var import_jsx_runtime160 = require("react/jsx-runtime");
|
|
19467
19492
|
function TransactionsSearch({ slot }) {
|
|
19468
19493
|
const { filters, setFilters } = useBankTransactionsContext();
|
|
19469
|
-
const [localSearch, setLocalSearch] = (0,
|
|
19494
|
+
const [localSearch, setLocalSearch] = (0, import_react91.useState)(() => {
|
|
19470
19495
|
var _a;
|
|
19471
19496
|
return (_a = filters == null ? void 0 : filters.descriptionFilter) != null ? _a : "";
|
|
19472
19497
|
});
|
|
19473
19498
|
const debouncedSetDescription = useDebounce((value) => {
|
|
19474
19499
|
setFilters({ descriptionFilter: value });
|
|
19475
19500
|
});
|
|
19476
|
-
const handleSearch = (0,
|
|
19501
|
+
const handleSearch = (0, import_react91.useCallback)((value) => {
|
|
19477
19502
|
setLocalSearch(value);
|
|
19478
19503
|
void debouncedSetDescription(value);
|
|
19479
19504
|
}, [debouncedSetDescription]);
|
|
@@ -19605,7 +19630,7 @@ var BankTransactionsHeader = ({
|
|
|
19605
19630
|
};
|
|
19606
19631
|
|
|
19607
19632
|
// src/components/BankTransactions/BankTransactionsTableEmptyState.tsx
|
|
19608
|
-
var
|
|
19633
|
+
var import_react92 = require("react");
|
|
19609
19634
|
|
|
19610
19635
|
// src/icons/Inbox.tsx
|
|
19611
19636
|
var import_jsx_runtime161 = require("react/jsx-runtime");
|
|
@@ -19655,7 +19680,7 @@ function BankTransactionsTableEmptyStates({
|
|
|
19655
19680
|
isFiltered,
|
|
19656
19681
|
isLoadingWithoutData
|
|
19657
19682
|
}) {
|
|
19658
|
-
const StateComponent = (0,
|
|
19683
|
+
const StateComponent = (0, import_react92.useMemo)(() => {
|
|
19659
19684
|
if (isError) {
|
|
19660
19685
|
return /* @__PURE__ */ (0, import_jsx_runtime162.jsx)(
|
|
19661
19686
|
DataState,
|
|
@@ -19728,13 +19753,13 @@ var BankTransactionsContent = ({
|
|
|
19728
19753
|
stringOverrides
|
|
19729
19754
|
}) => {
|
|
19730
19755
|
var _a;
|
|
19731
|
-
const [defaultDateRange] = (0,
|
|
19756
|
+
const [defaultDateRange] = (0, import_react93.useState)(() => ({
|
|
19732
19757
|
startDate: (0, import_date_fns22.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
19733
19758
|
endDate: (0, import_date_fns22.endOfMonth)(/* @__PURE__ */ new Date())
|
|
19734
19759
|
}));
|
|
19735
|
-
const scrollPaginationRef = (0,
|
|
19760
|
+
const scrollPaginationRef = (0, import_react93.useRef)(null);
|
|
19736
19761
|
const isVisible = useIsVisible(scrollPaginationRef);
|
|
19737
|
-
const [currentPage, setCurrentPage] = (0,
|
|
19762
|
+
const [currentPage, setCurrentPage] = (0, import_react93.useState)(1);
|
|
19738
19763
|
const effectiveBookkeepingStatus = useEffectiveBookkeepingStatus();
|
|
19739
19764
|
const categorizationEnabled = isCategorizationEnabledForStatus(effectiveBookkeepingStatus);
|
|
19740
19765
|
const categorizeView = categorizeViewProp != null ? categorizeViewProp : categorizationEnabled;
|
|
@@ -19751,21 +19776,21 @@ var BankTransactionsContent = ({
|
|
|
19751
19776
|
removeAfterCategorize
|
|
19752
19777
|
} = useBankTransactionsContext();
|
|
19753
19778
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
19754
|
-
const isSyncing = (0,
|
|
19779
|
+
const isSyncing = (0, import_react93.useMemo)(
|
|
19755
19780
|
() => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
|
|
19756
19781
|
[linkedAccounts]
|
|
19757
19782
|
);
|
|
19758
|
-
(0,
|
|
19783
|
+
(0, import_react93.useEffect)(() => {
|
|
19759
19784
|
if (!monthlyView && (filters == null ? void 0 : filters.dateRange)) {
|
|
19760
19785
|
setFilters(__spreadProps(__spreadValues({}, filters), { dateRange: void 0 }));
|
|
19761
19786
|
}
|
|
19762
19787
|
}, [monthlyView]);
|
|
19763
|
-
(0,
|
|
19788
|
+
(0, import_react93.useEffect)(() => {
|
|
19764
19789
|
if (monthlyView && isVisible && !isLoading && hasMore) {
|
|
19765
19790
|
fetchMore();
|
|
19766
19791
|
}
|
|
19767
19792
|
}, [monthlyView, isVisible, isLoading, hasMore]);
|
|
19768
|
-
(0,
|
|
19793
|
+
(0, import_react93.useEffect)(() => {
|
|
19769
19794
|
if (JSON.stringify(inputFilters) !== JSON.stringify(filters)) {
|
|
19770
19795
|
if (effectiveBookkeepingStatus === "ACTIVE" /* ACTIVE */) {
|
|
19771
19796
|
setFilters(__spreadProps(__spreadValues(__spreadValues({}, filters), inputFilters), {
|
|
@@ -19792,10 +19817,10 @@ var BankTransactionsContent = ({
|
|
|
19792
19817
|
});
|
|
19793
19818
|
}
|
|
19794
19819
|
}, [inputFilters, categorizeView, categorizationEnabled]);
|
|
19795
|
-
(0,
|
|
19820
|
+
(0, import_react93.useEffect)(() => {
|
|
19796
19821
|
setCurrentPage(1);
|
|
19797
19822
|
}, [filters]);
|
|
19798
|
-
const bankTransactions = (0,
|
|
19823
|
+
const bankTransactions = (0, import_react93.useMemo)(() => {
|
|
19799
19824
|
if (monthlyView) {
|
|
19800
19825
|
return data;
|
|
19801
19826
|
}
|
|
@@ -19809,10 +19834,10 @@ var BankTransactionsContent = ({
|
|
|
19809
19834
|
});
|
|
19810
19835
|
setCurrentPage(1);
|
|
19811
19836
|
};
|
|
19812
|
-
const [shiftStickyHeader, setShiftStickyHeader] = (0,
|
|
19837
|
+
const [shiftStickyHeader, setShiftStickyHeader] = (0, import_react93.useState)(0);
|
|
19813
19838
|
const debounceShiftStickyHeader = (0, import_lodash2.debounce)(setShiftStickyHeader, 500);
|
|
19814
|
-
const [listView, setListView] = (0,
|
|
19815
|
-
const [containerWidth, setContainerWidth] = (0,
|
|
19839
|
+
const [listView, setListView] = (0, import_react93.useState)(false);
|
|
19840
|
+
const [containerWidth, setContainerWidth] = (0, import_react93.useState)(0);
|
|
19816
19841
|
const debounceContainerWidth = (0, import_lodash2.debounce)(setContainerWidth, 500);
|
|
19817
19842
|
const removeTransaction = (bankTransaction) => removeAfterCategorize(bankTransaction);
|
|
19818
19843
|
const containerRef = useElementSize((_el, _en, size) => {
|
|
@@ -19938,13 +19963,13 @@ var BankTransactionsContent = ({
|
|
|
19938
19963
|
};
|
|
19939
19964
|
|
|
19940
19965
|
// src/components/Integrations/Integrations.tsx
|
|
19941
|
-
var
|
|
19966
|
+
var import_react102 = require("react");
|
|
19942
19967
|
|
|
19943
19968
|
// src/components/Integrations/IntegrationsContent.tsx
|
|
19944
|
-
var
|
|
19969
|
+
var import_react98 = require("react");
|
|
19945
19970
|
|
|
19946
19971
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumb.tsx
|
|
19947
|
-
var
|
|
19972
|
+
var import_react97 = require("react");
|
|
19948
19973
|
|
|
19949
19974
|
// src/icons/QuickbooksIcon.tsx
|
|
19950
19975
|
var import_jsx_runtime164 = require("react/jsx-runtime");
|
|
@@ -20030,8 +20055,8 @@ var Card = ({ children, className }) => {
|
|
|
20030
20055
|
};
|
|
20031
20056
|
|
|
20032
20057
|
// src/contexts/QuickbooksContext/QuickbooksContext.tsx
|
|
20033
|
-
var
|
|
20034
|
-
var QuickbooksContext = (0,
|
|
20058
|
+
var import_react94 = require("react");
|
|
20059
|
+
var QuickbooksContext = (0, import_react94.createContext)({
|
|
20035
20060
|
linkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
|
|
20036
20061
|
unlinkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
|
|
20037
20062
|
syncFromQuickbooks: () => {
|
|
@@ -20041,7 +20066,7 @@ var QuickbooksContext = (0, import_react93.createContext)({
|
|
|
20041
20066
|
});
|
|
20042
20067
|
|
|
20043
20068
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumbFooter.tsx
|
|
20044
|
-
var
|
|
20069
|
+
var import_react95 = require("react");
|
|
20045
20070
|
var import_date_fns23 = require("date-fns");
|
|
20046
20071
|
|
|
20047
20072
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/utils.ts
|
|
@@ -20099,7 +20124,7 @@ var getFooterConfig = (quickbooksUiState, lastSyncedAt) => {
|
|
|
20099
20124
|
}
|
|
20100
20125
|
};
|
|
20101
20126
|
var IntegrationsQuickbooksItemThumbFooter = ({ quickbooksUiState }) => {
|
|
20102
|
-
const { quickbooksConnectionStatus } = (0,
|
|
20127
|
+
const { quickbooksConnectionStatus } = (0, import_react95.useContext)(QuickbooksContext);
|
|
20103
20128
|
if (!quickbooksConnectionStatus) return null;
|
|
20104
20129
|
const { title, description, badgeVariant } = getFooterConfig(quickbooksUiState, quickbooksConnectionStatus.last_synced_at);
|
|
20105
20130
|
return /* @__PURE__ */ (0, import_jsx_runtime168.jsxs)(HStack, { className: "loadingbar", children: [
|
|
@@ -20116,14 +20141,14 @@ var IntegrationsQuickbooksItemThumbFooter = ({ quickbooksUiState }) => {
|
|
|
20116
20141
|
var import_lucide_react11 = require("lucide-react");
|
|
20117
20142
|
|
|
20118
20143
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksUnlinkConfirmationModal.tsx
|
|
20119
|
-
var
|
|
20144
|
+
var import_react96 = require("react");
|
|
20120
20145
|
var import_jsx_runtime169 = require("react/jsx-runtime");
|
|
20121
20146
|
function IntegrationsQuickbooksUnlinkConfirmationModalContent({ onClose }) {
|
|
20122
|
-
const { unlinkQuickbooks } = (0,
|
|
20123
|
-
const [isProcessing, setIsProcessing] = (0,
|
|
20124
|
-
const [hasFailed, setHasFailed] = (0,
|
|
20147
|
+
const { unlinkQuickbooks } = (0, import_react96.useContext)(QuickbooksContext);
|
|
20148
|
+
const [isProcessing, setIsProcessing] = (0, import_react96.useState)(false);
|
|
20149
|
+
const [hasFailed, setHasFailed] = (0, import_react96.useState)(false);
|
|
20125
20150
|
const unlinkErrorText = "Unlink failed. Check connection and retry in few seconds.";
|
|
20126
|
-
const onClickUnlinkQuickbooks = (0,
|
|
20151
|
+
const onClickUnlinkQuickbooks = (0, import_react96.useCallback)(() => {
|
|
20127
20152
|
setIsProcessing(true);
|
|
20128
20153
|
unlinkQuickbooks().then(() => {
|
|
20129
20154
|
onClose();
|
|
@@ -20202,14 +20227,14 @@ var getBadgeConfig = (quickbooksUiState, hasSynced) => {
|
|
|
20202
20227
|
}
|
|
20203
20228
|
};
|
|
20204
20229
|
var IntegrationsQuickbooksItemThumb = () => {
|
|
20205
|
-
const { quickbooksConnectionStatus, syncFromQuickbooks: syncFromQuickbooks2 } = (0,
|
|
20206
|
-
const [hasSynced, setHasSynced] = (0,
|
|
20207
|
-
const [isConfirmationModalOpen, setIsConfirmationModalOpen] = (0,
|
|
20208
|
-
const onSync = (0,
|
|
20230
|
+
const { quickbooksConnectionStatus, syncFromQuickbooks: syncFromQuickbooks2 } = (0, import_react97.useContext)(QuickbooksContext);
|
|
20231
|
+
const [hasSynced, setHasSynced] = (0, import_react97.useState)(false);
|
|
20232
|
+
const [isConfirmationModalOpen, setIsConfirmationModalOpen] = (0, import_react97.useState)(false);
|
|
20233
|
+
const onSync = (0, import_react97.useCallback)(() => {
|
|
20209
20234
|
setHasSynced(true);
|
|
20210
20235
|
syncFromQuickbooks2();
|
|
20211
20236
|
}, [syncFromQuickbooks2]);
|
|
20212
|
-
const menuConfig = (0,
|
|
20237
|
+
const menuConfig = (0, import_react97.useMemo)(() => {
|
|
20213
20238
|
return [
|
|
20214
20239
|
{
|
|
20215
20240
|
name: "Unlink account",
|
|
@@ -20251,28 +20276,28 @@ var IntegrationsQuickbooksItemThumb = () => {
|
|
|
20251
20276
|
// src/components/Integrations/IntegrationsContent.tsx
|
|
20252
20277
|
var import_jsx_runtime171 = require("react/jsx-runtime");
|
|
20253
20278
|
var IntegrationsContent = () => {
|
|
20254
|
-
const { quickbooksConnectionStatus } = (0,
|
|
20279
|
+
const { quickbooksConnectionStatus } = (0, import_react98.useContext)(QuickbooksContext);
|
|
20255
20280
|
return /* @__PURE__ */ (0, import_jsx_runtime171.jsx)("div", { className: "Layer__linked-accounts__list", children: (quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected) && /* @__PURE__ */ (0, import_jsx_runtime171.jsx)(IntegrationsQuickbooksItemThumb, {}) });
|
|
20256
20281
|
};
|
|
20257
20282
|
|
|
20258
20283
|
// src/hooks/useQuickbooks/useQuickbooks.ts
|
|
20259
|
-
var
|
|
20284
|
+
var import_react99 = require("react");
|
|
20260
20285
|
var import_date_fns24 = require("date-fns");
|
|
20261
20286
|
var useQuickbooks = () => {
|
|
20262
20287
|
var _a;
|
|
20263
20288
|
const { businessId } = useLayerContext();
|
|
20264
20289
|
const { apiUrl } = useEnvironment();
|
|
20265
20290
|
const { data: auth } = useAuth();
|
|
20266
|
-
const [quickbooksConnectionStatus, setQuickbooksConnectionStatus] = (0,
|
|
20291
|
+
const [quickbooksConnectionStatus, setQuickbooksConnectionStatus] = (0, import_react99.useState)(void 0);
|
|
20267
20292
|
const isSyncingFromQuickbooks = (_a = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_syncing) != null ? _a : false;
|
|
20268
|
-
const syncStatusIntervalRef = (0,
|
|
20269
|
-
const fetchQuickbooksConnectionStatus = (0,
|
|
20293
|
+
const syncStatusIntervalRef = (0, import_react99.useRef)(null);
|
|
20294
|
+
const fetchQuickbooksConnectionStatus = (0, import_react99.useCallback)(() => __async(null, null, function* () {
|
|
20270
20295
|
const newQuickbooksConnectionStatus = (yield Layer.statusOfQuickbooksConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
20271
20296
|
params: { businessId }
|
|
20272
20297
|
})()).data;
|
|
20273
20298
|
setQuickbooksConnectionStatus(newQuickbooksConnectionStatus);
|
|
20274
20299
|
}), [apiUrl, auth == null ? void 0 : auth.access_token, businessId, setQuickbooksConnectionStatus]);
|
|
20275
|
-
(0,
|
|
20300
|
+
(0, import_react99.useEffect)(() => {
|
|
20276
20301
|
if (isSyncingFromQuickbooks && syncStatusIntervalRef.current === null) {
|
|
20277
20302
|
const interval = window.setInterval(() => void fetchQuickbooksConnectionStatus(), 2e3);
|
|
20278
20303
|
syncStatusIntervalRef.current = interval;
|
|
@@ -20282,12 +20307,12 @@ var useQuickbooks = () => {
|
|
|
20282
20307
|
syncStatusIntervalRef.current = null;
|
|
20283
20308
|
}
|
|
20284
20309
|
}, [fetchQuickbooksConnectionStatus, isSyncingFromQuickbooks]);
|
|
20285
|
-
(0,
|
|
20310
|
+
(0, import_react99.useEffect)(() => {
|
|
20286
20311
|
if (auth == null ? void 0 : auth.access_token) {
|
|
20287
20312
|
void fetchQuickbooksConnectionStatus();
|
|
20288
20313
|
}
|
|
20289
20314
|
}, [auth == null ? void 0 : auth.access_token, fetchQuickbooksConnectionStatus]);
|
|
20290
|
-
const handleSyncError = (0,
|
|
20315
|
+
const handleSyncError = (0, import_react99.useCallback)(() => {
|
|
20291
20316
|
setQuickbooksConnectionStatus({
|
|
20292
20317
|
is_connected: true,
|
|
20293
20318
|
is_syncing: false,
|
|
@@ -20295,19 +20320,19 @@ var useQuickbooks = () => {
|
|
|
20295
20320
|
last_synced_at: (0, import_date_fns24.format)(/* @__PURE__ */ new Date(), "yyyy-MM-dd'T'HH:mm:ss")
|
|
20296
20321
|
});
|
|
20297
20322
|
}, []);
|
|
20298
|
-
const syncFromQuickbooks2 = (0,
|
|
20323
|
+
const syncFromQuickbooks2 = (0, import_react99.useCallback)(() => {
|
|
20299
20324
|
const newQuickbooksConnectionStatus = quickbooksConnectionStatus ? __spreadProps(__spreadValues({}, quickbooksConnectionStatus), { is_syncing: true }) : void 0;
|
|
20300
20325
|
setQuickbooksConnectionStatus(newQuickbooksConnectionStatus);
|
|
20301
20326
|
void Layer.syncFromQuickbooks(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
20302
20327
|
params: { businessId }
|
|
20303
20328
|
}).catch(handleSyncError);
|
|
20304
20329
|
}, [apiUrl, auth == null ? void 0 : auth.access_token, businessId, quickbooksConnectionStatus, handleSyncError]);
|
|
20305
|
-
const linkQuickbooks = (0,
|
|
20330
|
+
const linkQuickbooks = (0, import_react99.useCallback)(() => __async(null, null, function* () {
|
|
20306
20331
|
return Layer.initQuickbooksOAuth(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
20307
20332
|
params: { businessId }
|
|
20308
20333
|
}).then((res) => res.data.redirect_url);
|
|
20309
20334
|
}), [apiUrl, auth == null ? void 0 : auth.access_token, businessId]);
|
|
20310
|
-
const unlinkQuickbooks = (0,
|
|
20335
|
+
const unlinkQuickbooks = (0, import_react99.useCallback)(() => __async(null, null, function* () {
|
|
20311
20336
|
return Layer.unlinkQuickbooksConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
20312
20337
|
params: { businessId }
|
|
20313
20338
|
}).then(() => fetchQuickbooksConnectionStatus());
|
|
@@ -20328,7 +20353,7 @@ function QuickbooksContextProvider({ children }) {
|
|
|
20328
20353
|
}
|
|
20329
20354
|
|
|
20330
20355
|
// src/components/Integrations/IntegrationsConnectMenu/IntegrationsConnectMenu.tsx
|
|
20331
|
-
var
|
|
20356
|
+
var import_react101 = require("react");
|
|
20332
20357
|
|
|
20333
20358
|
// src/components/ui/DropdownMenu/DropdownMenu.tsx
|
|
20334
20359
|
var import_react_aria_components11 = require("react-aria-components");
|
|
@@ -20347,11 +20372,11 @@ var DropdownMenu = ({ children, ariaLabel, slots, slotProps }) => {
|
|
|
20347
20372
|
};
|
|
20348
20373
|
|
|
20349
20374
|
// src/icons/Cog.tsx
|
|
20350
|
-
var
|
|
20375
|
+
var import_react100 = require("react");
|
|
20351
20376
|
var import_jsx_runtime174 = require("react/jsx-runtime");
|
|
20352
20377
|
var Cog = (_a) => {
|
|
20353
20378
|
var _b = _a, { size = 12 } = _b, props = __objRest(_b, ["size"]);
|
|
20354
|
-
const id = (0,
|
|
20379
|
+
const id = (0, import_react100.useId)();
|
|
20355
20380
|
return /* @__PURE__ */ (0, import_jsx_runtime174.jsxs)(
|
|
20356
20381
|
"svg",
|
|
20357
20382
|
__spreadProps(__spreadValues({
|
|
@@ -20381,10 +20406,10 @@ var MenuTriggerButton = () => /* @__PURE__ */ (0, import_jsx_runtime175.jsxs)(Bu
|
|
|
20381
20406
|
] });
|
|
20382
20407
|
var IntegrationsConnectMenu = () => {
|
|
20383
20408
|
const { addToast } = useLayerContext();
|
|
20384
|
-
const { quickbooksConnectionStatus, linkQuickbooks } = (0,
|
|
20409
|
+
const { quickbooksConnectionStatus, linkQuickbooks } = (0, import_react101.useContext)(QuickbooksContext);
|
|
20385
20410
|
const quickbooksIsConnected = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected;
|
|
20386
|
-
const [isLinkQuickbooksError, setIsLinkQuickbooksError] = (0,
|
|
20387
|
-
const initiateQuickbooksOAuth = (0,
|
|
20411
|
+
const [isLinkQuickbooksError, setIsLinkQuickbooksError] = (0, import_react101.useState)(false);
|
|
20412
|
+
const initiateQuickbooksOAuth = (0, import_react101.useCallback)(() => {
|
|
20388
20413
|
linkQuickbooks().then((res) => {
|
|
20389
20414
|
window.location.href = res;
|
|
20390
20415
|
}).catch(() => {
|
|
@@ -20426,7 +20451,7 @@ var IntegrationsComponent = ({
|
|
|
20426
20451
|
elevated,
|
|
20427
20452
|
stringOverrides
|
|
20428
20453
|
}) => {
|
|
20429
|
-
const { quickbooksConnectionStatus } = (0,
|
|
20454
|
+
const { quickbooksConnectionStatus } = (0, import_react102.useContext)(QuickbooksContext);
|
|
20430
20455
|
const isLoading = quickbooksConnectionStatus === void 0;
|
|
20431
20456
|
return /* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(Container, { name: COMPONENT_NAME3, elevated, children: [
|
|
20432
20457
|
/* @__PURE__ */ (0, import_jsx_runtime176.jsxs)(Header, { className: "Layer__linked-accounts__header", children: [
|
|
@@ -20453,11 +20478,11 @@ var IntegrationsComponent = ({
|
|
|
20453
20478
|
};
|
|
20454
20479
|
|
|
20455
20480
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
20456
|
-
var
|
|
20481
|
+
var import_react130 = require("react");
|
|
20457
20482
|
|
|
20458
20483
|
// src/contexts/ProfitAndLossComparisonContext/ProfitAndLossComparisonContext.tsx
|
|
20459
|
-
var
|
|
20460
|
-
var PNLComparisonContext = (0,
|
|
20484
|
+
var import_react103 = require("react");
|
|
20485
|
+
var PNLComparisonContext = (0, import_react103.createContext)({
|
|
20461
20486
|
data: void 0,
|
|
20462
20487
|
isLoading: true,
|
|
20463
20488
|
isValidating: false,
|
|
@@ -20478,7 +20503,7 @@ var PNLComparisonContext = (0, import_react102.createContext)({
|
|
|
20478
20503
|
});
|
|
20479
20504
|
|
|
20480
20505
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
20481
|
-
var
|
|
20506
|
+
var import_react106 = require("react");
|
|
20482
20507
|
|
|
20483
20508
|
// src/utils/profitAndLossUtils.ts
|
|
20484
20509
|
var doesLineItemQualifies = (item) => {
|
|
@@ -20534,9 +20559,9 @@ var applyShare = (items, total) => {
|
|
|
20534
20559
|
};
|
|
20535
20560
|
|
|
20536
20561
|
// src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
|
|
20537
|
-
var
|
|
20562
|
+
var import_react104 = require("react");
|
|
20538
20563
|
var import_date_fns25 = require("date-fns");
|
|
20539
|
-
var
|
|
20564
|
+
var import_swr16 = __toESM(require("swr"));
|
|
20540
20565
|
var buildDates = ({ currentDate }) => {
|
|
20541
20566
|
return {
|
|
20542
20567
|
startYear: (0, import_date_fns25.startOfMonth)(currentDate).getFullYear() - 1,
|
|
@@ -20562,10 +20587,10 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
20562
20587
|
const { businessId, syncTimestamps, read, hasBeenTouched } = useLayerContext();
|
|
20563
20588
|
const { apiUrl } = useEnvironment();
|
|
20564
20589
|
const { data: auth } = useAuth();
|
|
20565
|
-
const [date, setDate] = (0,
|
|
20566
|
-
const [loaded, setLoaded] = (0,
|
|
20567
|
-
const [data, setData] = (0,
|
|
20568
|
-
const { startYear, startMonth, endYear, endMonth } = (0,
|
|
20590
|
+
const [date, setDate] = (0, import_react104.useState)(currentDate);
|
|
20591
|
+
const [loaded, setLoaded] = (0, import_react104.useState)("initial");
|
|
20592
|
+
const [data, setData] = (0, import_react104.useState)([]);
|
|
20593
|
+
const { startYear, startMonth, endYear, endMonth } = (0, import_react104.useMemo)(() => {
|
|
20569
20594
|
return buildDates({ currentDate: date });
|
|
20570
20595
|
}, [date, businessId, tagFilter, reportingBasis]);
|
|
20571
20596
|
const queryKey = businessId && Boolean(startYear) && Boolean(startMonth) && Boolean(endYear) && Boolean(endMonth) && (auth == null ? void 0 : auth.access_token) && `profit-and-loss-summaries-${businessId}-${startYear.toString()}-${startMonth.toString()}-${tagFilter == null ? void 0 : tagFilter.key}-${(_a = tagFilter == null ? void 0 : tagFilter.values) == null ? void 0 : _a.join(
|
|
@@ -20577,7 +20602,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
20577
20602
|
isValidating,
|
|
20578
20603
|
error,
|
|
20579
20604
|
mutate
|
|
20580
|
-
} = (0,
|
|
20605
|
+
} = (0, import_swr16.default)(
|
|
20581
20606
|
queryKey,
|
|
20582
20607
|
Layer.getProfitAndLossSummaries(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
20583
20608
|
params: {
|
|
@@ -20592,7 +20617,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
20592
20617
|
}
|
|
20593
20618
|
})
|
|
20594
20619
|
);
|
|
20595
|
-
(0,
|
|
20620
|
+
(0, import_react104.useEffect)(() => {
|
|
20596
20621
|
const newData = data.slice();
|
|
20597
20622
|
const newPeriod = buildMonthsArray((0, import_date_fns25.sub)(date, { years: 1 }), date);
|
|
20598
20623
|
if (newData && newPeriod) {
|
|
@@ -20628,7 +20653,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
20628
20653
|
);
|
|
20629
20654
|
}
|
|
20630
20655
|
}, [startYear, startMonth, tagFilter]);
|
|
20631
|
-
(0,
|
|
20656
|
+
(0, import_react104.useEffect)(() => {
|
|
20632
20657
|
var _a2, _b2;
|
|
20633
20658
|
const newData = (_b2 = (_a2 = rawData == null ? void 0 : rawData.data) == null ? void 0 : _a2.months) == null ? void 0 : _b2.slice();
|
|
20634
20659
|
if (data && newData) {
|
|
@@ -20646,7 +20671,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
20646
20671
|
);
|
|
20647
20672
|
}
|
|
20648
20673
|
}, [rawData]);
|
|
20649
|
-
(0,
|
|
20674
|
+
(0, import_react104.useEffect)(() => {
|
|
20650
20675
|
if (isLoading && loaded === "initial") {
|
|
20651
20676
|
setLoaded("loading");
|
|
20652
20677
|
return;
|
|
@@ -20656,12 +20681,12 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
20656
20681
|
}
|
|
20657
20682
|
}, [data, isLoading]);
|
|
20658
20683
|
const pullData = (date2) => setDate(date2);
|
|
20659
|
-
(0,
|
|
20684
|
+
(0, import_react104.useEffect)(() => {
|
|
20660
20685
|
if (queryKey && (isLoading || isValidating)) {
|
|
20661
20686
|
read("PROFIT_AND_LOSS" /* PROFIT_AND_LOSS */, queryKey);
|
|
20662
20687
|
}
|
|
20663
20688
|
}, [isLoading, isValidating]);
|
|
20664
|
-
(0,
|
|
20689
|
+
(0, import_react104.useEffect)(() => {
|
|
20665
20690
|
if (queryKey && hasBeenTouched(queryKey)) {
|
|
20666
20691
|
mutate();
|
|
20667
20692
|
}
|
|
@@ -20688,9 +20713,9 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
20688
20713
|
};
|
|
20689
20714
|
|
|
20690
20715
|
// src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
|
|
20691
|
-
var
|
|
20716
|
+
var import_react105 = require("react");
|
|
20692
20717
|
var import_date_fns26 = require("date-fns");
|
|
20693
|
-
var
|
|
20718
|
+
var import_swr17 = __toESM(require("swr"));
|
|
20694
20719
|
var useProfitAndLossQuery = ({
|
|
20695
20720
|
startDate,
|
|
20696
20721
|
endDate,
|
|
@@ -20713,7 +20738,7 @@ var useProfitAndLossQuery = ({
|
|
|
20713
20738
|
isValidating,
|
|
20714
20739
|
error: rawError,
|
|
20715
20740
|
mutate
|
|
20716
|
-
} = (0,
|
|
20741
|
+
} = (0, import_swr17.default)(
|
|
20717
20742
|
queryKey,
|
|
20718
20743
|
Layer.getProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
20719
20744
|
businessId,
|
|
@@ -20727,12 +20752,12 @@ var useProfitAndLossQuery = ({
|
|
|
20727
20752
|
const refetch = () => {
|
|
20728
20753
|
mutate();
|
|
20729
20754
|
};
|
|
20730
|
-
(0,
|
|
20755
|
+
(0, import_react105.useEffect)(() => {
|
|
20731
20756
|
if (queryKey && (isLoading || isValidating)) {
|
|
20732
20757
|
read("PROFIT_AND_LOSS" /* PROFIT_AND_LOSS */, queryKey);
|
|
20733
20758
|
}
|
|
20734
20759
|
}, [isLoading, isValidating]);
|
|
20735
|
-
(0,
|
|
20760
|
+
(0, import_react105.useEffect)(() => {
|
|
20736
20761
|
if (queryKey && hasBeenTouched(queryKey)) {
|
|
20737
20762
|
refetch();
|
|
20738
20763
|
}
|
|
@@ -20755,16 +20780,16 @@ var useProfitAndLoss = ({
|
|
|
20755
20780
|
}) => {
|
|
20756
20781
|
const { start, end } = useGlobalDateRange();
|
|
20757
20782
|
const { setRange } = useGlobalDateRangeActions();
|
|
20758
|
-
const dateRange = (0,
|
|
20759
|
-
const changeDateRange = (0,
|
|
20783
|
+
const dateRange = (0, import_react106.useMemo)(() => ({ startDate: start, endDate: end }), [start, end]);
|
|
20784
|
+
const changeDateRange = (0, import_react106.useCallback)(
|
|
20760
20785
|
({ startDate: start2, endDate: end2 }) => setRange({ start: start2, end: end2 }),
|
|
20761
20786
|
[setRange]
|
|
20762
20787
|
);
|
|
20763
|
-
const [filters, setFilters] = (0,
|
|
20788
|
+
const [filters, setFilters] = (0, import_react106.useState)({
|
|
20764
20789
|
expenses: void 0,
|
|
20765
20790
|
revenue: void 0
|
|
20766
20791
|
});
|
|
20767
|
-
const [sidebarScope, setSidebarScope] = (0,
|
|
20792
|
+
const [sidebarScope, setSidebarScope] = (0, import_react106.useState)(void 0);
|
|
20768
20793
|
const { data, isLoading, isValidating, error, refetch } = useProfitAndLossQuery({
|
|
20769
20794
|
startDate: start,
|
|
20770
20795
|
endDate: end,
|
|
@@ -20791,7 +20816,7 @@ var useProfitAndLoss = ({
|
|
|
20791
20816
|
})
|
|
20792
20817
|
}));
|
|
20793
20818
|
};
|
|
20794
|
-
const { filteredDataRevenue, filteredTotalRevenue } = (0,
|
|
20819
|
+
const { filteredDataRevenue, filteredTotalRevenue } = (0, import_react106.useMemo)(() => {
|
|
20795
20820
|
var _a;
|
|
20796
20821
|
if (!data) {
|
|
20797
20822
|
return { filteredDataRevenue: [], filteredTotalRevenue: void 0 };
|
|
@@ -20843,7 +20868,7 @@ var useProfitAndLoss = ({
|
|
|
20843
20868
|
const withShare = applyShare(sorted, total);
|
|
20844
20869
|
return { filteredDataRevenue: withShare, filteredTotalRevenue: total };
|
|
20845
20870
|
}, [data, start, filters, summaryData]);
|
|
20846
|
-
const { filteredDataExpenses, filteredTotalExpenses } = (0,
|
|
20871
|
+
const { filteredDataExpenses, filteredTotalExpenses } = (0, import_react106.useMemo)(() => {
|
|
20847
20872
|
var _a;
|
|
20848
20873
|
if (!data) {
|
|
20849
20874
|
return { filteredDataExpenses: [], filteredTotalExpenses: void 0 };
|
|
@@ -20917,7 +20942,7 @@ var useProfitAndLoss = ({
|
|
|
20917
20942
|
};
|
|
20918
20943
|
|
|
20919
20944
|
// src/hooks/useProfitAndLossComparison/useProfitAndLossComparison.tsx
|
|
20920
|
-
var
|
|
20945
|
+
var import_react107 = require("react");
|
|
20921
20946
|
|
|
20922
20947
|
// src/hooks/useProfitAndLossComparison/utils.ts
|
|
20923
20948
|
var import_date_fns27 = require("date-fns");
|
|
@@ -21040,7 +21065,7 @@ function preparePeriodsBody(dateRange, comparePeriods, rangeDisplayMode) {
|
|
|
21040
21065
|
}
|
|
21041
21066
|
|
|
21042
21067
|
// src/hooks/useProfitAndLossComparison/useProfitAndLossComparison.tsx
|
|
21043
|
-
var
|
|
21068
|
+
var import_swr18 = __toESM(require("swr"));
|
|
21044
21069
|
var COMPARE_MODES_SUPPORTING_MULTI_PERIOD = ["monthPicker", "yearPicker"];
|
|
21045
21070
|
var isNotOnlyNoneTag = (compareOptions) => {
|
|
21046
21071
|
return Boolean(
|
|
@@ -21071,15 +21096,15 @@ function useProfitAndLossComparison({
|
|
|
21071
21096
|
comparisonConfig
|
|
21072
21097
|
}) {
|
|
21073
21098
|
var _a, _b;
|
|
21074
|
-
const [comparePeriods, setComparePeriods] = (0,
|
|
21075
|
-
const [selectedCompareOptions, setSelectedCompareOptionsState] = (0,
|
|
21099
|
+
const [comparePeriods, setComparePeriods] = (0, import_react107.useState)((_a = comparisonConfig == null ? void 0 : comparisonConfig.defaultPeriods) != null ? _a : 1);
|
|
21100
|
+
const [selectedCompareOptions, setSelectedCompareOptionsState] = (0, import_react107.useState)(
|
|
21076
21101
|
(comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter) ? [comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter] : []
|
|
21077
21102
|
);
|
|
21078
21103
|
const { rangeDisplayMode, start, end } = useGlobalDateRange();
|
|
21079
21104
|
const dateRange = { startDate: start, endDate: end };
|
|
21080
21105
|
const isPeriodsSelectEnabled = COMPARE_MODES_SUPPORTING_MULTI_PERIOD.includes(rangeDisplayMode);
|
|
21081
21106
|
const effectiveComparePeriods = isPeriodsSelectEnabled ? comparePeriods : 1;
|
|
21082
|
-
const compareModeActive = (0,
|
|
21107
|
+
const compareModeActive = (0, import_react107.useMemo)(() => effectiveComparePeriods > 1 || selectedCompareOptions.length > 1 || selectedCompareOptions.length === 1 && isNotOnlyNoneTag(selectedCompareOptions), [effectiveComparePeriods, selectedCompareOptions]);
|
|
21083
21108
|
const setSelectedCompareOptions = (values) => {
|
|
21084
21109
|
const options = values.map(
|
|
21085
21110
|
(option) => comparisonConfig == null ? void 0 : comparisonConfig.tagComparisonOptions.find(
|
|
@@ -21104,7 +21129,7 @@ function useProfitAndLossComparison({
|
|
|
21104
21129
|
reportingBasis,
|
|
21105
21130
|
compareModeActive
|
|
21106
21131
|
}));
|
|
21107
|
-
const { data, isLoading, isValidating } = (0,
|
|
21132
|
+
const { data, isLoading, isValidating } = (0, import_swr18.default)(
|
|
21108
21133
|
queryKey,
|
|
21109
21134
|
() => __async(null, null, function* () {
|
|
21110
21135
|
const response = yield Layer.compareProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
@@ -21152,7 +21177,7 @@ function useProfitAndLossComparison({
|
|
|
21152
21177
|
}
|
|
21153
21178
|
|
|
21154
21179
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
21155
|
-
var
|
|
21180
|
+
var import_react108 = require("react");
|
|
21156
21181
|
|
|
21157
21182
|
// src/icons/BarChart2.tsx
|
|
21158
21183
|
var import_jsx_runtime177 = require("react/jsx-runtime");
|
|
@@ -21335,32 +21360,32 @@ var ProfitAndLossChart = ({
|
|
|
21335
21360
|
tagFilter = void 0
|
|
21336
21361
|
}) => {
|
|
21337
21362
|
var _c, _d, _e, _f, _g, _h;
|
|
21338
|
-
const [compactView, setCompactView] = (0,
|
|
21363
|
+
const [compactView, setCompactView] = (0, import_react108.useState)(false);
|
|
21339
21364
|
const barSize = compactView ? 10 : 20;
|
|
21340
21365
|
const { getColor, business } = useLayerContext();
|
|
21341
21366
|
const { start, end, rangeDisplayMode } = useGlobalDateRange();
|
|
21342
21367
|
const { setMonth } = useGlobalDateRangeActions();
|
|
21343
21368
|
const showIndicator = rangeDisplayMode === "monthPicker";
|
|
21344
|
-
const dateRange = (0,
|
|
21345
|
-
const [localDateRange, setLocalDateRange] = (0,
|
|
21346
|
-
const [customCursorSize, setCustomCursorSize] = (0,
|
|
21369
|
+
const dateRange = (0, import_react108.useMemo)(() => ({ startDate: start, endDate: end }), [start, end]);
|
|
21370
|
+
const [localDateRange, setLocalDateRange] = (0, import_react108.useState)(dateRange);
|
|
21371
|
+
const [customCursorSize, setCustomCursorSize] = (0, import_react108.useState)({
|
|
21347
21372
|
width: 0,
|
|
21348
21373
|
height: 0,
|
|
21349
21374
|
x: 0
|
|
21350
21375
|
});
|
|
21351
|
-
const [barAnimActive, setBarAnimActive] = (0,
|
|
21352
|
-
const [chartWindow, setChartWindow] = (0,
|
|
21376
|
+
const [barAnimActive, setBarAnimActive] = (0, import_react108.useState)(true);
|
|
21377
|
+
const [chartWindow, setChartWindow] = (0, import_react108.useState)({
|
|
21353
21378
|
start: (0, import_date_fns28.startOfMonth)((0, import_date_fns28.sub)(Date.now(), { months: 11 })),
|
|
21354
21379
|
end: (0, import_date_fns28.endOfMonth)(Date.now())
|
|
21355
21380
|
});
|
|
21356
|
-
const selectionMonth = (0,
|
|
21381
|
+
const selectionMonth = (0, import_react108.useMemo)(
|
|
21357
21382
|
() => ({
|
|
21358
21383
|
year: localDateRange.startDate.getFullYear(),
|
|
21359
21384
|
month: localDateRange.startDate.getMonth()
|
|
21360
21385
|
}),
|
|
21361
21386
|
[localDateRange]
|
|
21362
21387
|
);
|
|
21363
|
-
(0,
|
|
21388
|
+
(0, import_react108.useEffect)(() => {
|
|
21364
21389
|
if (Number(dateRange.startDate) !== Number(localDateRange.startDate) || Number(dateRange.endDate) !== Number(localDateRange.endDate)) {
|
|
21365
21390
|
setLocalDateRange(dateRange);
|
|
21366
21391
|
}
|
|
@@ -21369,7 +21394,7 @@ var ProfitAndLossChart = ({
|
|
|
21369
21394
|
currentDate: (0, import_date_fns28.startOfMonth)(Date.now()),
|
|
21370
21395
|
tagFilter
|
|
21371
21396
|
});
|
|
21372
|
-
const anyData = (0,
|
|
21397
|
+
const anyData = (0, import_react108.useMemo)(() => {
|
|
21373
21398
|
return Boolean(
|
|
21374
21399
|
data == null ? void 0 : data.find(
|
|
21375
21400
|
(x) => x.income !== 0 || x.costOfGoodsSold !== 0 || x.grossProfit !== 0 || x.operatingExpenses !== 0 || x.profitBeforeTaxes !== 0 || x.taxes !== 0 || x.totalExpenses !== 0 || x.uncategorizedInflows !== 0 || x.uncategorizedOutflows !== 0
|
|
@@ -21377,12 +21402,12 @@ var ProfitAndLossChart = ({
|
|
|
21377
21402
|
);
|
|
21378
21403
|
}, [data]);
|
|
21379
21404
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
21380
|
-
const isSyncing = (0,
|
|
21405
|
+
const isSyncing = (0, import_react108.useMemo)(
|
|
21381
21406
|
() => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
|
|
21382
21407
|
[linkedAccounts]
|
|
21383
21408
|
);
|
|
21384
|
-
const loadingValue = (0,
|
|
21385
|
-
(0,
|
|
21409
|
+
const loadingValue = (0, import_react108.useMemo)(() => getLoadingValue(data), [data]);
|
|
21410
|
+
(0, import_react108.useEffect)(() => {
|
|
21386
21411
|
if (loaded === "complete" && data) {
|
|
21387
21412
|
const foundCurrent = data.find(
|
|
21388
21413
|
(x) => Number((0, import_date_fns28.startOfMonth)(new Date(x.year, x.month - 1, 1))) >= Number(localDateRange.startDate) && Number((0, import_date_fns28.startOfMonth)(new Date(x.year, x.month - 1, 1))) < Number(localDateRange.endDate)
|
|
@@ -21403,7 +21428,7 @@ var ProfitAndLossChart = ({
|
|
|
21403
21428
|
}
|
|
21404
21429
|
}
|
|
21405
21430
|
}, [localDateRange]);
|
|
21406
|
-
(0,
|
|
21431
|
+
(0, import_react108.useEffect)(() => {
|
|
21407
21432
|
const newChartWindow = getChartWindow({
|
|
21408
21433
|
chartWindow,
|
|
21409
21434
|
currentYear: localDateRange.startDate.getFullYear(),
|
|
@@ -21413,7 +21438,7 @@ var ProfitAndLossChart = ({
|
|
|
21413
21438
|
setChartWindow(newChartWindow);
|
|
21414
21439
|
}
|
|
21415
21440
|
}, [localDateRange]);
|
|
21416
|
-
(0,
|
|
21441
|
+
(0, import_react108.useEffect)(() => {
|
|
21417
21442
|
if (loaded === "complete") {
|
|
21418
21443
|
setTimeout(() => {
|
|
21419
21444
|
setBarAnimActive(false);
|
|
@@ -21440,7 +21465,7 @@ var ProfitAndLossChart = ({
|
|
|
21440
21465
|
loading: (pnl == null ? void 0 : pnl.isLoading) ? loadingValue : 0,
|
|
21441
21466
|
loadingExpenses: (pnl == null ? void 0 : pnl.isLoading) ? -loadingValue : 0
|
|
21442
21467
|
});
|
|
21443
|
-
const theData = (0,
|
|
21468
|
+
const theData = (0, import_react108.useMemo)(() => {
|
|
21444
21469
|
var _a;
|
|
21445
21470
|
if (loaded !== "complete" || loaded === "complete" && !anyData) {
|
|
21446
21471
|
const loadingData = [];
|
|
@@ -21971,7 +21996,7 @@ var ProfitAndLossChart = ({
|
|
|
21971
21996
|
};
|
|
21972
21997
|
|
|
21973
21998
|
// src/components/ProfitAndLossCompareOptions/ProfitAndLossCompareOptions.tsx
|
|
21974
|
-
var
|
|
21999
|
+
var import_react109 = require("react");
|
|
21975
22000
|
var import_jsx_runtime181 = require("react/jsx-runtime");
|
|
21976
22001
|
var selectStyles = {
|
|
21977
22002
|
valueContainer: (styles) => {
|
|
@@ -22011,9 +22036,9 @@ var ProfitAndLossCompareOptions = () => {
|
|
|
22011
22036
|
compareOptions,
|
|
22012
22037
|
selectedCompareOptions,
|
|
22013
22038
|
comparisonConfig
|
|
22014
|
-
} = (0,
|
|
22039
|
+
} = (0, import_react109.useContext)(ProfitAndLoss.ComparisonContext);
|
|
22015
22040
|
const { rangeDisplayMode } = useGlobalDateRange();
|
|
22016
|
-
const periods = (0,
|
|
22041
|
+
const periods = (0, import_react109.useMemo)(
|
|
22017
22042
|
() => comparePeriods !== 0 ? comparePeriods : 1,
|
|
22018
22043
|
[comparePeriods]
|
|
22019
22044
|
);
|
|
@@ -22106,7 +22131,7 @@ function DatePickerModeSelector({
|
|
|
22106
22131
|
}
|
|
22107
22132
|
|
|
22108
22133
|
// src/providers/GlobalDateStore/useGlobalDateRangePicker.ts
|
|
22109
|
-
var
|
|
22134
|
+
var import_react110 = require("react");
|
|
22110
22135
|
function useGlobalDateRangePicker({
|
|
22111
22136
|
allowedDatePickerModes,
|
|
22112
22137
|
defaultDatePickerMode,
|
|
@@ -22123,7 +22148,7 @@ function useGlobalDateRangePicker({
|
|
|
22123
22148
|
DEFAULT_ALLOWED_PICKER_MODES
|
|
22124
22149
|
);
|
|
22125
22150
|
const desiredRangeMode = allowedDateRangePickerModes.includes(rangeDisplayMode) ? rangeDisplayMode : allowedDateRangePickerModes[0];
|
|
22126
|
-
const { dateFormat, selected } = (0,
|
|
22151
|
+
const { dateFormat, selected } = (0, import_react110.useMemo)(() => {
|
|
22127
22152
|
if (rangeDisplayMode === "monthPicker") {
|
|
22128
22153
|
return {
|
|
22129
22154
|
selected: start,
|
|
@@ -22143,7 +22168,7 @@ function useGlobalDateRangePicker({
|
|
|
22143
22168
|
end,
|
|
22144
22169
|
rangeDisplayMode
|
|
22145
22170
|
]);
|
|
22146
|
-
const { setSelected } = (0,
|
|
22171
|
+
const { setSelected } = (0, import_react110.useMemo)(() => {
|
|
22147
22172
|
if (desiredRangeMode === "monthPicker") {
|
|
22148
22173
|
return {
|
|
22149
22174
|
setSelected: ({ start: start2 }) => {
|
|
@@ -22223,10 +22248,10 @@ var ProfitAndLossDatePicker = ({
|
|
|
22223
22248
|
};
|
|
22224
22249
|
|
|
22225
22250
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
22226
|
-
var
|
|
22251
|
+
var import_react112 = require("react");
|
|
22227
22252
|
|
|
22228
22253
|
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
22229
|
-
var
|
|
22254
|
+
var import_react111 = require("react");
|
|
22230
22255
|
|
|
22231
22256
|
// src/config/charts.ts
|
|
22232
22257
|
var DEFAULT_CHART_COLOR_TYPE = [
|
|
@@ -22511,7 +22536,7 @@ var DetailedChart = ({
|
|
|
22511
22536
|
isLoading,
|
|
22512
22537
|
showDatePicker = true
|
|
22513
22538
|
}) => {
|
|
22514
|
-
const chartData = (0,
|
|
22539
|
+
const chartData = (0, import_react111.useMemo)(() => {
|
|
22515
22540
|
if (!filteredData) {
|
|
22516
22541
|
return [];
|
|
22517
22542
|
}
|
|
@@ -22883,11 +22908,11 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
22883
22908
|
sidebarScope,
|
|
22884
22909
|
setSidebarScope,
|
|
22885
22910
|
setFilterTypes
|
|
22886
|
-
} = (0,
|
|
22911
|
+
} = (0, import_react112.useContext)(ProfitAndLoss.Context);
|
|
22887
22912
|
const theScope = scope ? scope : sidebarScope;
|
|
22888
22913
|
const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
|
|
22889
22914
|
const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
|
|
22890
|
-
const [hoveredItem, setHoveredItem] = (0,
|
|
22915
|
+
const [hoveredItem, setHoveredItem] = (0, import_react112.useState)();
|
|
22891
22916
|
return /* @__PURE__ */ (0, import_jsx_runtime188.jsxs)("div", { className: "Layer__profit-and-loss-detailed-charts", children: [
|
|
22892
22917
|
/* @__PURE__ */ (0, import_jsx_runtime188.jsxs)("header", { className: "Layer__profit-and-loss-detailed-charts__header", children: [
|
|
22893
22918
|
/* @__PURE__ */ (0, import_jsx_runtime188.jsxs)("div", { className: "Layer__profit-and-loss-detailed-charts__head", children: [
|
|
@@ -22956,7 +22981,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
22956
22981
|
};
|
|
22957
22982
|
|
|
22958
22983
|
// src/components/ProfitAndLossDownloadButton/ProfitAndLossDownloadButton.tsx
|
|
22959
|
-
var
|
|
22984
|
+
var import_react113 = require("react");
|
|
22960
22985
|
var import_jsx_runtime189 = require("react/jsx-runtime");
|
|
22961
22986
|
var ProfitAndLossDownloadButton = ({
|
|
22962
22987
|
stringOverrides,
|
|
@@ -22964,15 +22989,15 @@ var ProfitAndLossDownloadButton = ({
|
|
|
22964
22989
|
moneyFormat,
|
|
22965
22990
|
view
|
|
22966
22991
|
}) => {
|
|
22967
|
-
const { dateRange, tagFilter } = (0,
|
|
22968
|
-
const { getProfitAndLossComparisonCsv } = (0,
|
|
22992
|
+
const { dateRange, tagFilter } = (0, import_react113.useContext)(ProfitAndLoss.Context);
|
|
22993
|
+
const { getProfitAndLossComparisonCsv } = (0, import_react113.useContext)(
|
|
22969
22994
|
ProfitAndLoss.ComparisonContext
|
|
22970
22995
|
);
|
|
22971
22996
|
const { businessId } = useLayerContext();
|
|
22972
22997
|
const { apiUrl } = useEnvironment();
|
|
22973
22998
|
const { data: auth } = useAuth();
|
|
22974
|
-
const [requestFailed, setRequestFailed] = (0,
|
|
22975
|
-
const [isDownloading, setIsDownloading] = (0,
|
|
22999
|
+
const [requestFailed, setRequestFailed] = (0, import_react113.useState)(false);
|
|
23000
|
+
const [isDownloading, setIsDownloading] = (0, import_react113.useState)(false);
|
|
22976
23001
|
const handleClick = () => __async(null, null, function* () {
|
|
22977
23002
|
var _a;
|
|
22978
23003
|
setIsDownloading(true);
|
|
@@ -23016,7 +23041,7 @@ var ProfitAndLossDownloadButton = ({
|
|
|
23016
23041
|
};
|
|
23017
23042
|
|
|
23018
23043
|
// src/components/ProfitAndLossHeader/ProfitAndLossHeader.tsx
|
|
23019
|
-
var
|
|
23044
|
+
var import_react115 = require("react");
|
|
23020
23045
|
|
|
23021
23046
|
// src/components/SyncingBadge/SyncingBadge.tsx
|
|
23022
23047
|
var import_jsx_runtime190 = require("react/jsx-runtime");
|
|
@@ -23033,13 +23058,13 @@ var SyncingBadge = () => {
|
|
|
23033
23058
|
};
|
|
23034
23059
|
|
|
23035
23060
|
// src/hooks/bookkeeping/periods/useActiveBookkeepingPeriod.ts
|
|
23036
|
-
var
|
|
23061
|
+
var import_react114 = require("react");
|
|
23037
23062
|
function useActiveBookkeepingPeriod() {
|
|
23038
23063
|
const { date } = useGlobalDate();
|
|
23039
23064
|
const { data, isLoading } = useBookkeepingPeriods();
|
|
23040
23065
|
const currentMonth = date.getMonth() + 1;
|
|
23041
23066
|
const currentYear = date.getFullYear();
|
|
23042
|
-
const activePeriod = (0,
|
|
23067
|
+
const activePeriod = (0, import_react114.useMemo)(
|
|
23043
23068
|
() => data == null ? void 0 : data.find((period) => currentYear === period.year && currentMonth === period.month),
|
|
23044
23069
|
[data, currentMonth, currentYear]
|
|
23045
23070
|
);
|
|
@@ -23058,7 +23083,7 @@ var ProfitAndLossHeader = ({
|
|
|
23058
23083
|
const { data: linkedAccounts } = useLinkedAccounts();
|
|
23059
23084
|
const { activePeriod } = useActiveBookkeepingPeriod();
|
|
23060
23085
|
const activePeriodStatus = activePeriod == null ? void 0 : activePeriod.status;
|
|
23061
|
-
const isSyncing = (0,
|
|
23086
|
+
const isSyncing = (0, import_react115.useMemo)(
|
|
23062
23087
|
() => Boolean(linkedAccounts == null ? void 0 : linkedAccounts.some((item) => item.is_syncing)),
|
|
23063
23088
|
[linkedAccounts]
|
|
23064
23089
|
);
|
|
@@ -23073,13 +23098,13 @@ var ProfitAndLossHeader = ({
|
|
|
23073
23098
|
};
|
|
23074
23099
|
|
|
23075
23100
|
// src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
|
|
23076
|
-
var
|
|
23101
|
+
var import_react119 = require("react");
|
|
23077
23102
|
|
|
23078
23103
|
// src/components/Header/Header.tsx
|
|
23079
|
-
var
|
|
23104
|
+
var import_react116 = require("react");
|
|
23080
23105
|
var import_classnames60 = __toESM(require("classnames"));
|
|
23081
23106
|
var import_jsx_runtime192 = require("react/jsx-runtime");
|
|
23082
|
-
var Header3 = (0,
|
|
23107
|
+
var Header3 = (0, import_react116.forwardRef)(
|
|
23083
23108
|
({ className, children, style, sticky, asHeader, rounded }, ref) => {
|
|
23084
23109
|
const baseClassName = (0, import_classnames60.default)(
|
|
23085
23110
|
"Layer__header",
|
|
@@ -23120,7 +23145,7 @@ var HeaderCol = ({ className, children, style, noPadding = false }) => {
|
|
|
23120
23145
|
};
|
|
23121
23146
|
|
|
23122
23147
|
// src/components/Panel/Panel.tsx
|
|
23123
|
-
var
|
|
23148
|
+
var import_react117 = require("react");
|
|
23124
23149
|
var import_classnames63 = __toESM(require("classnames"));
|
|
23125
23150
|
var import_jsx_runtime195 = require("react/jsx-runtime");
|
|
23126
23151
|
var Panel = ({
|
|
@@ -23134,8 +23159,8 @@ var Panel = ({
|
|
|
23134
23159
|
floating = false
|
|
23135
23160
|
}) => {
|
|
23136
23161
|
var _a;
|
|
23137
|
-
const [sidebarHeight, setSidebarHeight] = (0,
|
|
23138
|
-
(0,
|
|
23162
|
+
const [sidebarHeight, setSidebarHeight] = (0, import_react117.useState)(0);
|
|
23163
|
+
(0, import_react117.useEffect)(() => {
|
|
23139
23164
|
var _a2, _b;
|
|
23140
23165
|
if ((_a2 = parentRef == null ? void 0 : parentRef.current) == null ? void 0 : _a2.offsetHeight) {
|
|
23141
23166
|
setSidebarHeight((_b = parentRef == null ? void 0 : parentRef.current) == null ? void 0 : _b.offsetHeight);
|
|
@@ -23175,7 +23200,7 @@ var Panel = ({
|
|
|
23175
23200
|
};
|
|
23176
23201
|
|
|
23177
23202
|
// src/components/View/View.tsx
|
|
23178
|
-
var
|
|
23203
|
+
var import_react118 = require("react");
|
|
23179
23204
|
|
|
23180
23205
|
// src/components/ViewHeader/ViewHeader.tsx
|
|
23181
23206
|
var import_classnames64 = __toESM(require("classnames"));
|
|
@@ -23190,7 +23215,7 @@ var ViewHeader = ({ title, className, children }) => {
|
|
|
23190
23215
|
// src/components/View/View.tsx
|
|
23191
23216
|
var import_classnames65 = __toESM(require("classnames"));
|
|
23192
23217
|
var import_jsx_runtime197 = require("react/jsx-runtime");
|
|
23193
|
-
var View = (0,
|
|
23218
|
+
var View = (0, import_react118.forwardRef)(
|
|
23194
23219
|
({
|
|
23195
23220
|
title,
|
|
23196
23221
|
showHeader = true,
|
|
@@ -23241,8 +23266,8 @@ var ProfitAndLossReport = ({
|
|
|
23241
23266
|
view
|
|
23242
23267
|
}) => {
|
|
23243
23268
|
var _a, _b;
|
|
23244
|
-
const { sidebarScope } = (0,
|
|
23245
|
-
const { comparisonConfig } = (0,
|
|
23269
|
+
const { sidebarScope } = (0, import_react119.useContext)(ProfitAndLoss.Context);
|
|
23270
|
+
const { comparisonConfig } = (0, import_react119.useContext)(ProfitAndLoss.ComparisonContext);
|
|
23246
23271
|
return /* @__PURE__ */ (0, import_jsx_runtime198.jsx)(
|
|
23247
23272
|
View,
|
|
23248
23273
|
{
|
|
@@ -23299,10 +23324,10 @@ var ProfitAndLossReport = ({
|
|
|
23299
23324
|
};
|
|
23300
23325
|
|
|
23301
23326
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
23302
|
-
var
|
|
23327
|
+
var import_react123 = require("react");
|
|
23303
23328
|
|
|
23304
23329
|
// src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesList.tsx
|
|
23305
|
-
var
|
|
23330
|
+
var import_react120 = require("react");
|
|
23306
23331
|
var import_jsx_runtime199 = require("react/jsx-runtime");
|
|
23307
23332
|
var LIST_ITEM_CLASS_NAME = "Layer__ProfitAndLossSummariesListItem";
|
|
23308
23333
|
function ProfitAndLossSummariesListItem({
|
|
@@ -23310,7 +23335,7 @@ function ProfitAndLossSummariesListItem({
|
|
|
23310
23335
|
isActive,
|
|
23311
23336
|
onClick
|
|
23312
23337
|
}) {
|
|
23313
|
-
const dataProperties = (0,
|
|
23338
|
+
const dataProperties = (0, import_react120.useMemo)(
|
|
23314
23339
|
() => toDataProperties({ active: isActive, clickable: !!onClick }),
|
|
23315
23340
|
[isActive]
|
|
23316
23341
|
);
|
|
@@ -23321,7 +23346,7 @@ function ProfitAndLossSummariesList({
|
|
|
23321
23346
|
children,
|
|
23322
23347
|
itemCount
|
|
23323
23348
|
}) {
|
|
23324
|
-
const dataProperties = (0,
|
|
23349
|
+
const dataProperties = (0, import_react120.useMemo)(
|
|
23325
23350
|
() => toDataProperties({ ["column-count"]: itemCount }),
|
|
23326
23351
|
[itemCount]
|
|
23327
23352
|
);
|
|
@@ -23414,10 +23439,10 @@ function ProfitAndLossSummariesMiniChart({
|
|
|
23414
23439
|
}
|
|
23415
23440
|
|
|
23416
23441
|
// src/components/ui/Typography/MoneyText.tsx
|
|
23417
|
-
var
|
|
23442
|
+
var import_react121 = require("react");
|
|
23418
23443
|
var import_jsx_runtime201 = require("react/jsx-runtime");
|
|
23419
23444
|
var CLASS_NAME10 = "Layer__MoneyText";
|
|
23420
|
-
var MoneySpan = (0,
|
|
23445
|
+
var MoneySpan = (0, import_react121.forwardRef)(
|
|
23421
23446
|
(_a, ref) => {
|
|
23422
23447
|
var _b = _a, { amount, bold, size } = _b, restProps = __objRest(_b, ["amount", "bold", "size"]);
|
|
23423
23448
|
const dataProperties = toDataProperties({
|
|
@@ -23464,7 +23489,7 @@ function ProfitAndLossSummariesSummary({
|
|
|
23464
23489
|
}
|
|
23465
23490
|
|
|
23466
23491
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
23467
|
-
var
|
|
23492
|
+
var import_react122 = require("react");
|
|
23468
23493
|
var import_date_fns30 = require("date-fns");
|
|
23469
23494
|
var import_jsx_runtime204 = require("react/jsx-runtime");
|
|
23470
23495
|
var CLASS_NAME12 = "Layer__TransactionsToReview";
|
|
@@ -23475,17 +23500,17 @@ function TransactionsToReview({
|
|
|
23475
23500
|
variants
|
|
23476
23501
|
}) {
|
|
23477
23502
|
const { size = "sm" } = variants != null ? variants : {};
|
|
23478
|
-
const { dateRange: contextDateRange } = (0,
|
|
23503
|
+
const { dateRange: contextDateRange } = (0, import_react122.useContext)(ProfitAndLoss.Context);
|
|
23479
23504
|
const dateRange = usePnlDateRange ? contextDateRange : void 0;
|
|
23480
|
-
const [toReview, setToReview] = (0,
|
|
23505
|
+
const [toReview, setToReview] = (0, import_react122.useState)(0);
|
|
23481
23506
|
const { data, loaded, error, refetch } = useProfitAndLossLTM({
|
|
23482
23507
|
currentDate: dateRange ? dateRange.startDate : (0, import_date_fns30.startOfMonth)(/* @__PURE__ */ new Date()),
|
|
23483
23508
|
tagFilter
|
|
23484
23509
|
});
|
|
23485
|
-
(0,
|
|
23510
|
+
(0, import_react122.useEffect)(() => {
|
|
23486
23511
|
checkTransactionsToReview();
|
|
23487
23512
|
}, []);
|
|
23488
|
-
(0,
|
|
23513
|
+
(0, import_react122.useEffect)(() => {
|
|
23489
23514
|
checkTransactionsToReview();
|
|
23490
23515
|
}, [dateRange, loaded]);
|
|
23491
23516
|
const checkTransactionsToReview = () => {
|
|
@@ -23566,8 +23591,8 @@ function Internal_ProfitAndLossSummaries({
|
|
|
23566
23591
|
isLoading,
|
|
23567
23592
|
setSidebarScope,
|
|
23568
23593
|
sidebarScope
|
|
23569
|
-
} = (0,
|
|
23570
|
-
const { revenueChartData, expensesChartData } = (0,
|
|
23594
|
+
} = (0, import_react123.useContext)(ProfitAndLoss.Context);
|
|
23595
|
+
const { revenueChartData, expensesChartData } = (0, import_react123.useMemo)(
|
|
23571
23596
|
() => ({
|
|
23572
23597
|
revenueChartData: toMiniChartData({ scope: "revenue", data }),
|
|
23573
23598
|
expensesChartData: toMiniChartData({ scope: "expenses", data })
|
|
@@ -23669,10 +23694,10 @@ function ProfitAndLossSummaries(_a) {
|
|
|
23669
23694
|
}
|
|
23670
23695
|
|
|
23671
23696
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
23672
|
-
var
|
|
23697
|
+
var import_react129 = require("react");
|
|
23673
23698
|
|
|
23674
23699
|
// src/contexts/TableContext/TableContext.tsx
|
|
23675
|
-
var
|
|
23700
|
+
var import_react124 = require("react");
|
|
23676
23701
|
var import_jsx_runtime206 = require("react/jsx-runtime");
|
|
23677
23702
|
var defaultValue = {
|
|
23678
23703
|
expandedRows: [],
|
|
@@ -23684,10 +23709,10 @@ var defaultValue = {
|
|
|
23684
23709
|
setExpandedAllRows: () => {
|
|
23685
23710
|
}
|
|
23686
23711
|
};
|
|
23687
|
-
var TableContext = (0,
|
|
23712
|
+
var TableContext = (0, import_react124.createContext)(defaultValue);
|
|
23688
23713
|
var TableProvider = ({ children }) => {
|
|
23689
|
-
const [expandedRows, setExpandedRowsState] = (0,
|
|
23690
|
-
const [expandedAllRows, setExpandedAllRows] = (0,
|
|
23714
|
+
const [expandedRows, setExpandedRowsState] = (0, import_react124.useState)([]);
|
|
23715
|
+
const [expandedAllRows, setExpandedAllRows] = (0, import_react124.useState)(false);
|
|
23691
23716
|
const toggleRow = (rowKey) => {
|
|
23692
23717
|
setExpandedRowsState((prevRows) => {
|
|
23693
23718
|
const rows = [...prevRows];
|
|
@@ -23713,10 +23738,10 @@ var TableProvider = ({ children }) => {
|
|
|
23713
23738
|
};
|
|
23714
23739
|
|
|
23715
23740
|
// src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
|
|
23716
|
-
var
|
|
23741
|
+
var import_react127 = require("react");
|
|
23717
23742
|
|
|
23718
23743
|
// src/hooks/useTableExpandRow/useTableExpandRow.tsx
|
|
23719
|
-
var
|
|
23744
|
+
var import_react125 = require("react");
|
|
23720
23745
|
var useTableExpandRow = () => {
|
|
23721
23746
|
const {
|
|
23722
23747
|
expandedAllRows,
|
|
@@ -23724,7 +23749,7 @@ var useTableExpandRow = () => {
|
|
|
23724
23749
|
expandAllRows,
|
|
23725
23750
|
expandedRows,
|
|
23726
23751
|
setExpandedRows
|
|
23727
|
-
} = (0,
|
|
23752
|
+
} = (0, import_react125.useContext)(TableContext);
|
|
23728
23753
|
const toggleAllRows = () => {
|
|
23729
23754
|
if (expandedAllRows) {
|
|
23730
23755
|
setIsOpen([]);
|
|
@@ -23945,7 +23970,7 @@ var TableRow = ({
|
|
|
23945
23970
|
};
|
|
23946
23971
|
|
|
23947
23972
|
// src/components/Table/Table.tsx
|
|
23948
|
-
var
|
|
23973
|
+
var import_react126 = require("react");
|
|
23949
23974
|
var import_classnames68 = __toESM(require("classnames"));
|
|
23950
23975
|
var import_jsx_runtime211 = require("react/jsx-runtime");
|
|
23951
23976
|
var Table2 = ({
|
|
@@ -23954,9 +23979,9 @@ var Table2 = ({
|
|
|
23954
23979
|
borderCollapse = "separate",
|
|
23955
23980
|
bottomSpacing = true
|
|
23956
23981
|
}) => {
|
|
23957
|
-
const tableRef = (0,
|
|
23958
|
-
const prevChildrenRef = (0,
|
|
23959
|
-
(0,
|
|
23982
|
+
const tableRef = (0, import_react126.useRef)(null);
|
|
23983
|
+
const prevChildrenRef = (0, import_react126.useRef)([]);
|
|
23984
|
+
(0, import_react126.useEffect)(() => {
|
|
23960
23985
|
if (tableRef.current) {
|
|
23961
23986
|
const tbody = tableRef.current.querySelector("tbody");
|
|
23962
23987
|
const rows = tbody ? Array.from(tbody.querySelectorAll("tr")) : [];
|
|
@@ -24005,17 +24030,17 @@ var import_jsx_runtime212 = require("react/jsx-runtime");
|
|
|
24005
24030
|
var ProfitAndLossCompareTable = ({
|
|
24006
24031
|
stringOverrides
|
|
24007
24032
|
}) => {
|
|
24008
|
-
const { dateRange } = (0,
|
|
24033
|
+
const { dateRange } = (0, import_react127.useContext)(ProfitAndLoss.Context);
|
|
24009
24034
|
const {
|
|
24010
24035
|
data: comparisonData,
|
|
24011
24036
|
isLoading,
|
|
24012
24037
|
comparePeriods,
|
|
24013
24038
|
selectedCompareOptions
|
|
24014
|
-
} = (0,
|
|
24039
|
+
} = (0, import_react127.useContext)(ProfitAndLoss.ComparisonContext);
|
|
24015
24040
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
24016
24041
|
const { rangeDisplayMode } = useGlobalDateRange();
|
|
24017
24042
|
const { data: bookkeepingPeriods } = useBookkeepingPeriods();
|
|
24018
|
-
(0,
|
|
24043
|
+
(0, import_react127.useEffect)(() => {
|
|
24019
24044
|
setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
|
|
24020
24045
|
}, []);
|
|
24021
24046
|
if (isLoading || comparisonData === void 0) {
|
|
@@ -24059,7 +24084,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
24059
24084
|
}
|
|
24060
24085
|
const expandable = (lineItem == null ? void 0 : lineItem.line_items) && lineItem.line_items.length > 0 ? true : false;
|
|
24061
24086
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
24062
|
-
return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(
|
|
24087
|
+
return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(import_react127.Fragment, { children: [
|
|
24063
24088
|
/* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(
|
|
24064
24089
|
TableRow,
|
|
24065
24090
|
{
|
|
@@ -24093,7 +24118,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
24093
24118
|
return /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(Table2, { borderCollapse: "collapse", bottomSpacing: false, children: [
|
|
24094
24119
|
/* @__PURE__ */ (0, import_jsx_runtime212.jsx)(TableHead, { children: selectedCompareOptions && selectedCompareOptions.length > 1 && /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(TableRow, { rowKey: "", children: [
|
|
24095
24120
|
/* @__PURE__ */ (0, import_jsx_runtime212.jsx)(TableCell, { isHeaderCell: true }),
|
|
24096
|
-
selectedCompareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(
|
|
24121
|
+
selectedCompareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(import_react127.Fragment, { children: [
|
|
24097
24122
|
/* @__PURE__ */ (0, import_jsx_runtime212.jsx)(TableCell, { primary: true, isHeaderCell: true, children: option.displayName }, option.displayName + "-" + i),
|
|
24098
24123
|
comparePeriods && Array.from({ length: comparePeriods - 1 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(TableCell, { isHeaderCell: true }, option.displayName + "-" + index))
|
|
24099
24124
|
] }, option.displayName + "-" + i))
|
|
@@ -24101,7 +24126,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
24101
24126
|
/* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(TableBody, { children: [
|
|
24102
24127
|
comparePeriods && /* @__PURE__ */ (0, import_jsx_runtime212.jsxs)(TableRow, { rowKey: "", children: [
|
|
24103
24128
|
/* @__PURE__ */ (0, import_jsx_runtime212.jsx)(TableCell, { isHeaderCell: true }),
|
|
24104
|
-
selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(
|
|
24129
|
+
selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(import_react127.Fragment, { children: generateComparisonPeriods(
|
|
24105
24130
|
dateRange.startDate,
|
|
24106
24131
|
comparePeriods,
|
|
24107
24132
|
rangeDisplayMode
|
|
@@ -24109,7 +24134,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
24109
24134
|
month.label,
|
|
24110
24135
|
" ",
|
|
24111
24136
|
getBookkeepingPeriodStatus(month.date)
|
|
24112
|
-
] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(
|
|
24137
|
+
] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ (0, import_jsx_runtime212.jsx)(import_react127.Fragment, { children: generateComparisonPeriods(
|
|
24113
24138
|
dateRange.startDate,
|
|
24114
24139
|
comparePeriods,
|
|
24115
24140
|
rangeDisplayMode
|
|
@@ -24141,7 +24166,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
24141
24166
|
};
|
|
24142
24167
|
|
|
24143
24168
|
// src/components/ProfitAndLossTable/ProfitAndLossTableComponent.tsx
|
|
24144
|
-
var
|
|
24169
|
+
var import_react128 = require("react");
|
|
24145
24170
|
|
|
24146
24171
|
// src/icons/PieChart.tsx
|
|
24147
24172
|
var import_jsx_runtime213 = require("react/jsx-runtime");
|
|
@@ -24240,9 +24265,9 @@ var ProfitAndLossTableComponent = ({
|
|
|
24240
24265
|
data: actualData,
|
|
24241
24266
|
isLoading,
|
|
24242
24267
|
setSidebarScope
|
|
24243
|
-
} = (0,
|
|
24268
|
+
} = (0, import_react128.useContext)(ProfitAndLoss.Context);
|
|
24244
24269
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
24245
|
-
(0,
|
|
24270
|
+
(0, import_react128.useEffect)(() => {
|
|
24246
24271
|
setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
|
|
24247
24272
|
}, []);
|
|
24248
24273
|
const currentData = Array.isArray(actualData) ? actualData[actualData.length - 1] : actualData;
|
|
@@ -24262,7 +24287,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
24262
24287
|
const renderLineItem = (lineItem, depth, rowKey, rowIndex, scope, setSidebarScope2, variant) => {
|
|
24263
24288
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
24264
24289
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
24265
|
-
return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(
|
|
24290
|
+
return /* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(import_react128.Fragment, { children: [
|
|
24266
24291
|
/* @__PURE__ */ (0, import_jsx_runtime214.jsxs)(
|
|
24267
24292
|
TableRow,
|
|
24268
24293
|
{
|
|
@@ -24386,14 +24411,14 @@ var ProfitAndLossTableComponent = ({
|
|
|
24386
24411
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
24387
24412
|
var import_jsx_runtime215 = require("react/jsx-runtime");
|
|
24388
24413
|
var ProfitAndLossTableWithProvider = (props) => {
|
|
24389
|
-
const { compareModeActive } = (0,
|
|
24414
|
+
const { compareModeActive } = (0, import_react129.useContext)(ProfitAndLoss.ComparisonContext);
|
|
24390
24415
|
return /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(TableProvider, { children: compareModeActive ? /* @__PURE__ */ (0, import_jsx_runtime215.jsx)("div", { className: "Layer__compare__table__wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(ProfitAndLossCompareTable, __spreadValues({}, props)) }) : /* @__PURE__ */ (0, import_jsx_runtime215.jsx)(ProfitAndLossTableComponent, __spreadValues({}, props)) });
|
|
24391
24416
|
};
|
|
24392
24417
|
|
|
24393
24418
|
// src/components/ProfitAndLoss/ProfitAndLoss.tsx
|
|
24394
24419
|
var import_date_fns32 = require("date-fns");
|
|
24395
24420
|
var import_jsx_runtime216 = require("react/jsx-runtime");
|
|
24396
|
-
var PNLContext = (0,
|
|
24421
|
+
var PNLContext = (0, import_react130.createContext)({
|
|
24397
24422
|
data: void 0,
|
|
24398
24423
|
filteredDataRevenue: [],
|
|
24399
24424
|
filteredTotalRevenue: void 0,
|
|
@@ -24447,7 +24472,7 @@ ProfitAndLoss.Report = ProfitAndLossReport;
|
|
|
24447
24472
|
ProfitAndLoss.DownloadButton = ProfitAndLossDownloadButton;
|
|
24448
24473
|
|
|
24449
24474
|
// src/hooks/balanceSheet/useBalanceSheet.ts
|
|
24450
|
-
var
|
|
24475
|
+
var import_swr19 = __toESM(require("swr"));
|
|
24451
24476
|
var import_date_fns33 = require("date-fns");
|
|
24452
24477
|
function buildKey19({
|
|
24453
24478
|
access_token: accessToken,
|
|
@@ -24471,7 +24496,7 @@ function useBalanceSheet({
|
|
|
24471
24496
|
const { data: auth } = useAuth();
|
|
24472
24497
|
const { apiUrl } = useEnvironment();
|
|
24473
24498
|
const { businessId } = useLayerContext();
|
|
24474
|
-
return (0,
|
|
24499
|
+
return (0, import_swr19.default)(
|
|
24475
24500
|
() => buildKey19(__spreadProps(__spreadValues({}, auth), {
|
|
24476
24501
|
apiUrl,
|
|
24477
24502
|
businessId,
|
|
@@ -24491,12 +24516,12 @@ function useBalanceSheet({
|
|
|
24491
24516
|
}
|
|
24492
24517
|
|
|
24493
24518
|
// src/hooks/useElementViewSize/useElementViewSize.tsx
|
|
24494
|
-
var
|
|
24519
|
+
var import_react131 = require("react");
|
|
24495
24520
|
var useElementViewSize = () => {
|
|
24496
|
-
const containerRef = (0,
|
|
24497
|
-
const [view, setView] = (0,
|
|
24498
|
-
const resizeTimeout = (0,
|
|
24499
|
-
(0,
|
|
24521
|
+
const containerRef = (0, import_react131.useRef)(null);
|
|
24522
|
+
const [view, setView] = (0, import_react131.useState)("desktop");
|
|
24523
|
+
const resizeTimeout = (0, import_react131.useRef)(null);
|
|
24524
|
+
(0, import_react131.useLayoutEffect)(() => {
|
|
24500
24525
|
const element = containerRef == null ? void 0 : containerRef.current;
|
|
24501
24526
|
if (!element) {
|
|
24502
24527
|
return;
|
|
@@ -24565,7 +24590,7 @@ var BalanceSheetExpandAllButton = ({
|
|
|
24565
24590
|
};
|
|
24566
24591
|
|
|
24567
24592
|
// src/components/BalanceSheetTable/BalanceSheetTable.tsx
|
|
24568
|
-
var
|
|
24593
|
+
var import_react132 = require("react");
|
|
24569
24594
|
var import_jsx_runtime219 = require("react/jsx-runtime");
|
|
24570
24595
|
var BalanceSheetTable = ({
|
|
24571
24596
|
data,
|
|
@@ -24574,12 +24599,12 @@ var BalanceSheetTable = ({
|
|
|
24574
24599
|
}) => {
|
|
24575
24600
|
const { isOpen, setIsOpen, expandedAllRows } = useTableExpandRow();
|
|
24576
24601
|
const allRowKeys = [];
|
|
24577
|
-
(0,
|
|
24602
|
+
(0, import_react132.useEffect)(() => {
|
|
24578
24603
|
if (expandedAllRows) {
|
|
24579
24604
|
setIsOpen(allRowKeys, true);
|
|
24580
24605
|
}
|
|
24581
24606
|
}, [expandedAllRows]);
|
|
24582
|
-
(0,
|
|
24607
|
+
(0, import_react132.useEffect)(() => {
|
|
24583
24608
|
setIsOpen(["assets"]);
|
|
24584
24609
|
}, []);
|
|
24585
24610
|
const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
|
|
@@ -24589,7 +24614,7 @@ var BalanceSheetTable = ({
|
|
|
24589
24614
|
if (expandable) {
|
|
24590
24615
|
allRowKeys.push(rowKey);
|
|
24591
24616
|
}
|
|
24592
|
-
return /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(
|
|
24617
|
+
return /* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(import_react132.Fragment, { children: [
|
|
24593
24618
|
/* @__PURE__ */ (0, import_jsx_runtime219.jsxs)(
|
|
24594
24619
|
TableRow,
|
|
24595
24620
|
{
|
|
@@ -24640,7 +24665,7 @@ var BalanceSheetTable = ({
|
|
|
24640
24665
|
/* @__PURE__ */ (0, import_jsx_runtime219.jsx)(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.typeColumnHeader) || "Type" }),
|
|
24641
24666
|
/* @__PURE__ */ (0, import_jsx_runtime219.jsx)(TableCell, { isHeaderCell: true, align: "right" /* RIGHT */, children: (stringOverrides == null ? void 0 : stringOverrides.totalColumnHeader) || "Total" })
|
|
24642
24667
|
] }) }),
|
|
24643
|
-
/* @__PURE__ */ (0, import_jsx_runtime219.jsx)(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(
|
|
24668
|
+
/* @__PURE__ */ (0, import_jsx_runtime219.jsx)(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ (0, import_jsx_runtime219.jsx)(import_react132.Fragment, { children: data[row.lineItem] && renderLineItem(
|
|
24644
24669
|
data[row.lineItem],
|
|
24645
24670
|
0,
|
|
24646
24671
|
row.lineItem,
|
|
@@ -24814,7 +24839,7 @@ var BalanceSheetView = ({
|
|
|
24814
24839
|
};
|
|
24815
24840
|
|
|
24816
24841
|
// src/components/StatementOfCashFlowTable/StatementOfCashFlowTable.tsx
|
|
24817
|
-
var
|
|
24842
|
+
var import_react133 = require("react");
|
|
24818
24843
|
var import_jsx_runtime222 = require("react/jsx-runtime");
|
|
24819
24844
|
var StatementOfCashFlowTable = ({
|
|
24820
24845
|
data,
|
|
@@ -24825,7 +24850,7 @@ var StatementOfCashFlowTable = ({
|
|
|
24825
24850
|
const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
|
|
24826
24851
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
24827
24852
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
24828
|
-
return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)(
|
|
24853
|
+
return /* @__PURE__ */ (0, import_jsx_runtime222.jsxs)(import_react133.Fragment, { children: [
|
|
24829
24854
|
/* @__PURE__ */ (0, import_jsx_runtime222.jsxs)(
|
|
24830
24855
|
TableRow,
|
|
24831
24856
|
{
|
|
@@ -24877,7 +24902,7 @@ var StatementOfCashFlowTable = ({
|
|
|
24877
24902
|
] }) }),
|
|
24878
24903
|
/* @__PURE__ */ (0, import_jsx_runtime222.jsx)(TableBody, { children: config.map((row, idx) => {
|
|
24879
24904
|
if (row.type === "line_item") {
|
|
24880
|
-
return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(
|
|
24905
|
+
return /* @__PURE__ */ (0, import_jsx_runtime222.jsx)(import_react133.Fragment, { children: data[row.lineItem] && renderLineItem(
|
|
24881
24906
|
data[row.lineItem],
|
|
24882
24907
|
0,
|
|
24883
24908
|
row.lineItem ? row.lineItem : "",
|
|
@@ -25080,7 +25105,7 @@ function StatementOfCashFlowDatePicker({
|
|
|
25080
25105
|
}
|
|
25081
25106
|
|
|
25082
25107
|
// src/hooks/useStatementOfCashFlow/useStatementOfCashFlow.tsx
|
|
25083
|
-
var
|
|
25108
|
+
var import_swr20 = __toESM(require("swr"));
|
|
25084
25109
|
var import_date_fns34 = require("date-fns");
|
|
25085
25110
|
function buildKey22({
|
|
25086
25111
|
access_token: accessToken,
|
|
@@ -25107,7 +25132,7 @@ function useStatementOfCashFlow({
|
|
|
25107
25132
|
const { data: auth } = useAuth();
|
|
25108
25133
|
const { apiUrl } = useEnvironment();
|
|
25109
25134
|
const { businessId } = useLayerContext();
|
|
25110
|
-
return (0,
|
|
25135
|
+
return (0, import_swr20.default)(
|
|
25111
25136
|
buildKey22(__spreadProps(__spreadValues({}, auth), {
|
|
25112
25137
|
apiUrl,
|
|
25113
25138
|
businessId,
|
|
@@ -25177,12 +25202,12 @@ var StatementOfCashFlowView = ({
|
|
|
25177
25202
|
};
|
|
25178
25203
|
|
|
25179
25204
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
25180
|
-
var
|
|
25205
|
+
var import_react147 = require("react");
|
|
25181
25206
|
|
|
25182
25207
|
// src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
|
|
25183
|
-
var
|
|
25208
|
+
var import_react134 = require("react");
|
|
25184
25209
|
var import_date_fns35 = require("date-fns");
|
|
25185
|
-
var ChartOfAccountsContext = (0,
|
|
25210
|
+
var ChartOfAccountsContext = (0, import_react134.createContext)(
|
|
25186
25211
|
{
|
|
25187
25212
|
data: void 0,
|
|
25188
25213
|
isLoading: false,
|
|
@@ -25213,8 +25238,8 @@ var ChartOfAccountsContext = (0, import_react133.createContext)(
|
|
|
25213
25238
|
);
|
|
25214
25239
|
|
|
25215
25240
|
// src/contexts/LedgerAccountsContext/LedgerAccountsContext.tsx
|
|
25216
|
-
var
|
|
25217
|
-
var LedgerAccountsContext = (0,
|
|
25241
|
+
var import_react135 = require("react");
|
|
25242
|
+
var LedgerAccountsContext = (0, import_react135.createContext)({
|
|
25218
25243
|
data: void 0,
|
|
25219
25244
|
entryData: void 0,
|
|
25220
25245
|
isLoading: false,
|
|
@@ -25236,7 +25261,7 @@ var LedgerAccountsContext = (0, import_react134.createContext)({
|
|
|
25236
25261
|
});
|
|
25237
25262
|
|
|
25238
25263
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
25239
|
-
var
|
|
25264
|
+
var import_react136 = require("react");
|
|
25240
25265
|
|
|
25241
25266
|
// src/components/ChartOfAccountsForm/constants.ts
|
|
25242
25267
|
var LEDGER_ACCOUNT_TYPES = [
|
|
@@ -25441,7 +25466,7 @@ var LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE = {
|
|
|
25441
25466
|
|
|
25442
25467
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
25443
25468
|
var import_date_fns36 = require("date-fns");
|
|
25444
|
-
var
|
|
25469
|
+
var import_swr21 = __toESM(require("swr"));
|
|
25445
25470
|
var validate = (formData) => {
|
|
25446
25471
|
const errors = [];
|
|
25447
25472
|
const nameError = validateName(formData);
|
|
@@ -25536,17 +25561,17 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
25536
25561
|
} = useLayerContext();
|
|
25537
25562
|
const { apiUrl } = useEnvironment();
|
|
25538
25563
|
const { data: auth } = useAuth();
|
|
25539
|
-
const [form, setForm] = (0,
|
|
25540
|
-
const [sendingForm, setSendingForm] = (0,
|
|
25541
|
-
const [apiError, setApiError] = (0,
|
|
25542
|
-
const [startDate, setStartDate] = (0,
|
|
25564
|
+
const [form, setForm] = (0, import_react136.useState)();
|
|
25565
|
+
const [sendingForm, setSendingForm] = (0, import_react136.useState)(false);
|
|
25566
|
+
const [apiError, setApiError] = (0, import_react136.useState)(void 0);
|
|
25567
|
+
const [startDate, setStartDate] = (0, import_react136.useState)(
|
|
25543
25568
|
initialStartDate != null ? initialStartDate : (0, import_date_fns36.startOfMonth)(Date.now())
|
|
25544
25569
|
);
|
|
25545
|
-
const [endDate, setEndDate] = (0,
|
|
25570
|
+
const [endDate, setEndDate] = (0, import_react136.useState)(
|
|
25546
25571
|
initialEndDate != null ? initialEndDate : (0, import_date_fns36.endOfMonth)(Date.now())
|
|
25547
25572
|
);
|
|
25548
25573
|
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()}`;
|
|
25549
|
-
const { data, isLoading, isValidating, error, mutate } = (0,
|
|
25574
|
+
const { data, isLoading, isValidating, error, mutate } = (0, import_swr21.default)(
|
|
25550
25575
|
queryKey,
|
|
25551
25576
|
Layer.getLedgerAccountBalances(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
25552
25577
|
params: {
|
|
@@ -25724,12 +25749,12 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
25724
25749
|
newEndDate && setEndDate(newEndDate);
|
|
25725
25750
|
};
|
|
25726
25751
|
const refetch = () => mutate();
|
|
25727
|
-
(0,
|
|
25752
|
+
(0, import_react136.useEffect)(() => {
|
|
25728
25753
|
if (queryKey && (isLoading || isValidating)) {
|
|
25729
25754
|
read("CHART_OF_ACCOUNTS" /* CHART_OF_ACCOUNTS */, queryKey);
|
|
25730
25755
|
}
|
|
25731
25756
|
}, [isLoading, isValidating]);
|
|
25732
|
-
(0,
|
|
25757
|
+
(0, import_react136.useEffect)(() => {
|
|
25733
25758
|
if (queryKey && hasBeenTouched(queryKey)) {
|
|
25734
25759
|
refetch();
|
|
25735
25760
|
}
|
|
@@ -25756,20 +25781,20 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
25756
25781
|
|
|
25757
25782
|
// src/hooks/useChartOfAccounts/useCreateChildAccount.tsx
|
|
25758
25783
|
var import_mutation12 = __toESM(require("swr/mutation"));
|
|
25759
|
-
var
|
|
25760
|
-
var
|
|
25784
|
+
var import_swr22 = require("swr");
|
|
25785
|
+
var import_react137 = require("react");
|
|
25761
25786
|
|
|
25762
25787
|
// src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
|
|
25763
|
-
var
|
|
25764
|
-
var
|
|
25788
|
+
var import_react138 = require("react");
|
|
25789
|
+
var import_swr23 = __toESM(require("swr"));
|
|
25765
25790
|
var useLedgerAccounts = (showReversalEntries = false) => {
|
|
25766
25791
|
const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
25767
25792
|
const { apiUrl } = useEnvironment();
|
|
25768
25793
|
const { data: auth } = useAuth();
|
|
25769
|
-
const [accountId, setAccountId] = (0,
|
|
25770
|
-
const [selectedEntryId, setSelectedEntryId] = (0,
|
|
25794
|
+
const [accountId, setAccountId] = (0, import_react138.useState)();
|
|
25795
|
+
const [selectedEntryId, setSelectedEntryId] = (0, import_react138.useState)();
|
|
25771
25796
|
const queryKey = businessId && accountId && (auth == null ? void 0 : auth.access_token) && `ledger-accounts-lines-${businessId}-${accountId}`;
|
|
25772
|
-
const { data, isLoading, isValidating, error, mutate } = (0,
|
|
25797
|
+
const { data, isLoading, isValidating, error, mutate } = (0, import_swr23.default)(
|
|
25773
25798
|
queryKey,
|
|
25774
25799
|
Layer.getLedgerAccountsLines(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
25775
25800
|
params: {
|
|
@@ -25785,7 +25810,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
25785
25810
|
isLoading: isLoadingEntry,
|
|
25786
25811
|
isValidating: isValdiatingEntry,
|
|
25787
25812
|
error: errorEntry
|
|
25788
|
-
} = (0,
|
|
25813
|
+
} = (0, import_swr23.default)(
|
|
25789
25814
|
businessId && selectedEntryId && (auth == null ? void 0 : auth.access_token) && `ledger-accounts-entry-${businessId}-${selectedEntryId}}`,
|
|
25790
25815
|
Layer.getLedgerAccountsEntry(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
25791
25816
|
params: { businessId, entryId: selectedEntryId }
|
|
@@ -25796,12 +25821,12 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
25796
25821
|
setSelectedEntryId(void 0);
|
|
25797
25822
|
mutateEntryData();
|
|
25798
25823
|
};
|
|
25799
|
-
(0,
|
|
25824
|
+
(0, import_react138.useEffect)(() => {
|
|
25800
25825
|
if (queryKey && (isLoading || isValidating)) {
|
|
25801
25826
|
read("LEDGER_ACCOUNTS" /* LEDGER_ACCOUNTS */, queryKey);
|
|
25802
25827
|
}
|
|
25803
25828
|
}, [isLoading, isValidating]);
|
|
25804
|
-
(0,
|
|
25829
|
+
(0, import_react138.useEffect)(() => {
|
|
25805
25830
|
if (queryKey && hasBeenTouched(queryKey)) {
|
|
25806
25831
|
refetch();
|
|
25807
25832
|
}
|
|
@@ -25825,7 +25850,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
25825
25850
|
};
|
|
25826
25851
|
|
|
25827
25852
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
|
|
25828
|
-
var
|
|
25853
|
+
var import_react143 = require("react");
|
|
25829
25854
|
|
|
25830
25855
|
// src/icons/Plus.tsx
|
|
25831
25856
|
var import_jsx_runtime226 = require("react/jsx-runtime");
|
|
@@ -25866,11 +25891,11 @@ var Plus = (_a) => {
|
|
|
25866
25891
|
var Plus_default = Plus;
|
|
25867
25892
|
|
|
25868
25893
|
// src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
|
|
25869
|
-
var
|
|
25894
|
+
var import_react139 = require("react");
|
|
25870
25895
|
var import_date_fns37 = require("date-fns");
|
|
25871
25896
|
var import_jsx_runtime227 = require("react/jsx-runtime");
|
|
25872
25897
|
var ChartOfAccountsDatePicker = () => {
|
|
25873
|
-
const { changeDateRange, dateRange } = (0,
|
|
25898
|
+
const { changeDateRange, dateRange } = (0, import_react139.useContext)(ChartOfAccountsContext);
|
|
25874
25899
|
return /* @__PURE__ */ (0, import_jsx_runtime227.jsx)(
|
|
25875
25900
|
DatePicker,
|
|
25876
25901
|
{
|
|
@@ -25889,13 +25914,13 @@ var ChartOfAccountsDatePicker = () => {
|
|
|
25889
25914
|
};
|
|
25890
25915
|
|
|
25891
25916
|
// src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
|
|
25892
|
-
var
|
|
25917
|
+
var import_react141 = require("react");
|
|
25893
25918
|
|
|
25894
25919
|
// src/components/ChartOfAccountsForm/useParentOptions.ts
|
|
25895
|
-
var
|
|
25920
|
+
var import_react140 = require("react");
|
|
25896
25921
|
var useParentOptions = (data) => {
|
|
25897
25922
|
var _a;
|
|
25898
|
-
return (0,
|
|
25923
|
+
return (0, import_react140.useMemo)(
|
|
25899
25924
|
() => flattenAccounts((data == null ? void 0 : data.accounts) || []).sort((a, b) => (a == null ? void 0 : a.name) && (b == null ? void 0 : b.name) ? a.name.localeCompare(b.name) : 0).map((x) => {
|
|
25900
25925
|
return {
|
|
25901
25926
|
label: x.name,
|
|
@@ -25920,9 +25945,9 @@ var ChartOfAccountsForm = ({
|
|
|
25920
25945
|
submitForm,
|
|
25921
25946
|
sendingForm,
|
|
25922
25947
|
apiError
|
|
25923
|
-
} = (0,
|
|
25948
|
+
} = (0, import_react141.useContext)(ChartOfAccountsContext);
|
|
25924
25949
|
const parentOptions = useParentOptions(data);
|
|
25925
|
-
const entry = (0,
|
|
25950
|
+
const entry = (0, import_react141.useMemo)(() => {
|
|
25926
25951
|
if ((form == null ? void 0 : form.action) === "edit" && form.accountId) {
|
|
25927
25952
|
return flattenAccounts((data == null ? void 0 : data.accounts) || []).find(
|
|
25928
25953
|
(x) => x.id === form.accountId
|
|
@@ -26135,7 +26160,7 @@ var ChartOfAccountsSidebar = ({
|
|
|
26135
26160
|
};
|
|
26136
26161
|
|
|
26137
26162
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
26138
|
-
var
|
|
26163
|
+
var import_react142 = require("react");
|
|
26139
26164
|
|
|
26140
26165
|
// src/icons/Edit2.tsx
|
|
26141
26166
|
var import_jsx_runtime230 = require("react/jsx-runtime");
|
|
@@ -26195,18 +26220,18 @@ var ChartOfAccountsTableContent = ({
|
|
|
26195
26220
|
expandAll,
|
|
26196
26221
|
templateAccountsEditable
|
|
26197
26222
|
}) => {
|
|
26198
|
-
const { setAccountId } = (0,
|
|
26199
|
-
const { editAccount } = (0,
|
|
26223
|
+
const { setAccountId } = (0, import_react142.useContext)(LedgerAccountsContext);
|
|
26224
|
+
const { editAccount } = (0, import_react142.useContext)(ChartOfAccountsContext);
|
|
26200
26225
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
26201
|
-
const [accountsRowKeys, setAccountsRowKeys] = (0,
|
|
26202
|
-
(0,
|
|
26226
|
+
const [accountsRowKeys, setAccountsRowKeys] = (0, import_react142.useState)([]);
|
|
26227
|
+
(0, import_react142.useEffect)(() => {
|
|
26203
26228
|
if (expandAll === "expanded") {
|
|
26204
26229
|
setIsOpen(accountsRowKeys);
|
|
26205
26230
|
} else if (expandAll === "collapsed") {
|
|
26206
26231
|
setIsOpen([]);
|
|
26207
26232
|
}
|
|
26208
26233
|
}, [expandAll]);
|
|
26209
|
-
(0,
|
|
26234
|
+
(0, import_react142.useEffect)(() => {
|
|
26210
26235
|
const defaultExpanded = data.accounts.map(
|
|
26211
26236
|
(account) => "coa-row-" + account.id
|
|
26212
26237
|
);
|
|
@@ -26225,7 +26250,7 @@ var ChartOfAccountsTableContent = ({
|
|
|
26225
26250
|
var _a, _b;
|
|
26226
26251
|
const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
26227
26252
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
26228
|
-
return /* @__PURE__ */ (0, import_jsx_runtime231.jsxs)(
|
|
26253
|
+
return /* @__PURE__ */ (0, import_jsx_runtime231.jsxs)(import_react142.Fragment, { children: [
|
|
26229
26254
|
/* @__PURE__ */ (0, import_jsx_runtime231.jsxs)(
|
|
26230
26255
|
TableRow,
|
|
26231
26256
|
{
|
|
@@ -26401,8 +26426,8 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
26401
26426
|
templateAccountsEditable
|
|
26402
26427
|
}) => {
|
|
26403
26428
|
var _a;
|
|
26404
|
-
const { data, isLoading, addAccount, error, isValidating, refetch, form } = (0,
|
|
26405
|
-
const [expandAll, setExpandAll] = (0,
|
|
26429
|
+
const { data, isLoading, addAccount, error, isValidating, refetch, form } = (0, import_react143.useContext)(ChartOfAccountsContext);
|
|
26430
|
+
const [expandAll, setExpandAll] = (0, import_react143.useState)();
|
|
26406
26431
|
const cumulativeIndex = 0;
|
|
26407
26432
|
const accountsLength = (_a = data == null ? void 0 : data.accounts.length) != null ? _a : 0;
|
|
26408
26433
|
return /* @__PURE__ */ (0, import_jsx_runtime233.jsxs)(
|
|
@@ -26507,10 +26532,10 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
26507
26532
|
};
|
|
26508
26533
|
|
|
26509
26534
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
26510
|
-
var
|
|
26535
|
+
var import_react146 = require("react");
|
|
26511
26536
|
|
|
26512
26537
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
26513
|
-
var
|
|
26538
|
+
var import_react144 = require("react");
|
|
26514
26539
|
|
|
26515
26540
|
// src/utils/journal.ts
|
|
26516
26541
|
var getAccountIdentifierPayload = (journalLineItem) => {
|
|
@@ -26754,8 +26779,8 @@ var LedgerAccountEntryDetails = ({
|
|
|
26754
26779
|
stringOverrides
|
|
26755
26780
|
}) => {
|
|
26756
26781
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
26757
|
-
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = (0,
|
|
26758
|
-
const { totalDebit, totalCredit } = (0,
|
|
26782
|
+
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = (0, import_react144.useContext)(LedgerAccountsContext);
|
|
26783
|
+
const { totalDebit, totalCredit } = (0, import_react144.useMemo)(() => {
|
|
26759
26784
|
var _a2;
|
|
26760
26785
|
let totalDebit2 = 0;
|
|
26761
26786
|
let totalCredit2 = 0;
|
|
@@ -26901,7 +26926,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
26901
26926
|
};
|
|
26902
26927
|
|
|
26903
26928
|
// src/components/LedgerAccount/LedgerAccountRow.tsx
|
|
26904
|
-
var
|
|
26929
|
+
var import_react145 = require("react");
|
|
26905
26930
|
var import_classnames72 = __toESM(require("classnames"));
|
|
26906
26931
|
var import_date_fns39 = require("date-fns");
|
|
26907
26932
|
var import_jsx_runtime238 = require("react/jsx-runtime");
|
|
@@ -26912,9 +26937,9 @@ var LedgerAccountRow = ({
|
|
|
26912
26937
|
view
|
|
26913
26938
|
}) => {
|
|
26914
26939
|
var _a, _b, _c, _d, _e, _f;
|
|
26915
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0,
|
|
26916
|
-
const [showComponent, setShowComponent] = (0,
|
|
26917
|
-
(0,
|
|
26940
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react145.useContext)(LedgerAccountsContext);
|
|
26941
|
+
const [showComponent, setShowComponent] = (0, import_react145.useState)(false);
|
|
26942
|
+
(0, import_react145.useEffect)(() => {
|
|
26918
26943
|
if (initialLoad) {
|
|
26919
26944
|
const timeoutId = setTimeout(() => {
|
|
26920
26945
|
setShowComponent(true);
|
|
@@ -27058,9 +27083,9 @@ var LedgerAccount = ({
|
|
|
27058
27083
|
stringOverrides
|
|
27059
27084
|
}) => {
|
|
27060
27085
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
27061
|
-
const [currentPage, setCurrentPage] = (0,
|
|
27062
|
-
const [initialLoad, setInitialLoad] = (0,
|
|
27063
|
-
const { data: accountData } = (0,
|
|
27086
|
+
const [currentPage, setCurrentPage] = (0, import_react146.useState)(1);
|
|
27087
|
+
const [initialLoad, setInitialLoad] = (0, import_react146.useState)(true);
|
|
27088
|
+
const { data: accountData } = (0, import_react146.useContext)(ChartOfAccountsContext);
|
|
27064
27089
|
const {
|
|
27065
27090
|
data: rawData,
|
|
27066
27091
|
error,
|
|
@@ -27071,8 +27096,8 @@ var LedgerAccount = ({
|
|
|
27071
27096
|
selectedEntryId,
|
|
27072
27097
|
closeSelectedEntry,
|
|
27073
27098
|
refetch
|
|
27074
|
-
} = (0,
|
|
27075
|
-
(0,
|
|
27099
|
+
} = (0, import_react146.useContext)(LedgerAccountsContext);
|
|
27100
|
+
(0, import_react146.useEffect)(() => {
|
|
27076
27101
|
if (!isLoading) {
|
|
27077
27102
|
const timeoutLoad = setTimeout(() => {
|
|
27078
27103
|
setInitialLoad(false);
|
|
@@ -27084,12 +27109,12 @@ var LedgerAccount = ({
|
|
|
27084
27109
|
"Layer__ledger-account__index",
|
|
27085
27110
|
accountId && "open"
|
|
27086
27111
|
);
|
|
27087
|
-
const account = (0,
|
|
27112
|
+
const account = (0, import_react146.useMemo)(() => {
|
|
27088
27113
|
return flattenAccounts((accountData == null ? void 0 : accountData.accounts) || []).find(
|
|
27089
27114
|
(x) => x.id === accountId
|
|
27090
27115
|
);
|
|
27091
27116
|
}, [accountId]);
|
|
27092
|
-
const data = (0,
|
|
27117
|
+
const data = (0, import_react146.useMemo)(() => {
|
|
27093
27118
|
var _a2;
|
|
27094
27119
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
27095
27120
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
@@ -27227,7 +27252,7 @@ var ChartOfAccountsContent = ({
|
|
|
27227
27252
|
templateAccountsEditable,
|
|
27228
27253
|
showAddAccountButton
|
|
27229
27254
|
}) => {
|
|
27230
|
-
const { accountId } = (0,
|
|
27255
|
+
const { accountId } = (0, import_react147.useContext)(LedgerAccountsContext);
|
|
27231
27256
|
const { view, containerRef } = useElementViewSize();
|
|
27232
27257
|
return /* @__PURE__ */ (0, import_jsx_runtime240.jsx)(Container, { name: "chart-of-accounts", ref: containerRef, asWidget, children: accountId ? /* @__PURE__ */ (0, import_jsx_runtime240.jsx)(
|
|
27233
27258
|
LedgerAccount,
|
|
@@ -27252,8 +27277,8 @@ var ChartOfAccountsContent = ({
|
|
|
27252
27277
|
};
|
|
27253
27278
|
|
|
27254
27279
|
// src/contexts/JournalContext/JournalContext.tsx
|
|
27255
|
-
var
|
|
27256
|
-
var JournalContext = (0,
|
|
27280
|
+
var import_react148 = require("react");
|
|
27281
|
+
var JournalContext = (0, import_react148.createContext)({
|
|
27257
27282
|
data: void 0,
|
|
27258
27283
|
isLoading: false,
|
|
27259
27284
|
error: void 0,
|
|
@@ -27287,8 +27312,8 @@ var JournalContext = (0, import_react147.createContext)({
|
|
|
27287
27312
|
});
|
|
27288
27313
|
|
|
27289
27314
|
// src/hooks/useJournal/useJournal.tsx
|
|
27290
|
-
var
|
|
27291
|
-
var
|
|
27315
|
+
var import_react149 = require("react");
|
|
27316
|
+
var import_swr24 = __toESM(require("swr"));
|
|
27292
27317
|
var useJournal = () => {
|
|
27293
27318
|
const {
|
|
27294
27319
|
businessId,
|
|
@@ -27299,13 +27324,13 @@ var useJournal = () => {
|
|
|
27299
27324
|
} = useLayerContext();
|
|
27300
27325
|
const { apiUrl } = useEnvironment();
|
|
27301
27326
|
const { data: auth } = useAuth();
|
|
27302
|
-
const [selectedEntryId, setSelectedEntryId] = (0,
|
|
27303
|
-
const [form, setForm] = (0,
|
|
27304
|
-
const [addingEntry, setAddingEntry] = (0,
|
|
27305
|
-
const [sendingForm, setSendingForm] = (0,
|
|
27306
|
-
const [apiError, setApiError] = (0,
|
|
27327
|
+
const [selectedEntryId, setSelectedEntryId] = (0, import_react149.useState)();
|
|
27328
|
+
const [form, setForm] = (0, import_react149.useState)();
|
|
27329
|
+
const [addingEntry, setAddingEntry] = (0, import_react149.useState)(false);
|
|
27330
|
+
const [sendingForm, setSendingForm] = (0, import_react149.useState)(false);
|
|
27331
|
+
const [apiError, setApiError] = (0, import_react149.useState)(void 0);
|
|
27307
27332
|
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `journal-lines-${businessId}`;
|
|
27308
|
-
const { data, isLoading, isValidating, error, mutate } = (0,
|
|
27333
|
+
const { data, isLoading, isValidating, error, mutate } = (0, import_swr24.default)(
|
|
27309
27334
|
queryKey,
|
|
27310
27335
|
Layer.getJournal(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
27311
27336
|
params: { businessId }
|
|
@@ -27519,12 +27544,12 @@ var useJournal = () => {
|
|
|
27519
27544
|
params: { businessId, entryId }
|
|
27520
27545
|
});
|
|
27521
27546
|
});
|
|
27522
|
-
(0,
|
|
27547
|
+
(0, import_react149.useEffect)(() => {
|
|
27523
27548
|
if (queryKey && (isLoading || isValidating)) {
|
|
27524
27549
|
read("JOURNAL" /* JOURNAL */, queryKey);
|
|
27525
27550
|
}
|
|
27526
27551
|
}, [isLoading, isValidating]);
|
|
27527
|
-
(0,
|
|
27552
|
+
(0, import_react149.useEffect)(() => {
|
|
27528
27553
|
if (queryKey && hasBeenTouched(queryKey)) {
|
|
27529
27554
|
refetch();
|
|
27530
27555
|
}
|
|
@@ -27556,13 +27581,13 @@ var useJournal = () => {
|
|
|
27556
27581
|
};
|
|
27557
27582
|
|
|
27558
27583
|
// src/components/JournalTable/JournalTableWithPanel.tsx
|
|
27559
|
-
var
|
|
27584
|
+
var import_react155 = require("react");
|
|
27560
27585
|
|
|
27561
27586
|
// src/components/JournalSidebar/JournalSidebar.tsx
|
|
27562
|
-
var
|
|
27587
|
+
var import_react153 = require("react");
|
|
27563
27588
|
|
|
27564
27589
|
// src/components/JournalEntryDetails/JournalEntryDetails.tsx
|
|
27565
|
-
var
|
|
27590
|
+
var import_react150 = require("react");
|
|
27566
27591
|
var import_jsx_runtime241 = require("react/jsx-runtime");
|
|
27567
27592
|
var JournalEntryDetails = () => {
|
|
27568
27593
|
var _a, _b, _c, _d;
|
|
@@ -27574,16 +27599,16 @@ var JournalEntryDetails = () => {
|
|
|
27574
27599
|
selectedEntryId,
|
|
27575
27600
|
reverseEntry,
|
|
27576
27601
|
refetch
|
|
27577
|
-
} = (0,
|
|
27578
|
-
const [reverseEntryProcessing, setReverseEntryProcessing] = (0,
|
|
27579
|
-
const [reverseEntryError, setReverseEntryError] = (0,
|
|
27580
|
-
const entry = (0,
|
|
27602
|
+
} = (0, import_react150.useContext)(JournalContext);
|
|
27603
|
+
const [reverseEntryProcessing, setReverseEntryProcessing] = (0, import_react150.useState)(false);
|
|
27604
|
+
const [reverseEntryError, setReverseEntryError] = (0, import_react150.useState)();
|
|
27605
|
+
const entry = (0, import_react150.useMemo)(() => {
|
|
27581
27606
|
if (selectedEntryId && data) {
|
|
27582
27607
|
return data.find((x) => x.id === selectedEntryId);
|
|
27583
27608
|
}
|
|
27584
27609
|
return;
|
|
27585
27610
|
}, [data, selectedEntryId]);
|
|
27586
|
-
const sortedLineItems = (0,
|
|
27611
|
+
const sortedLineItems = (0, import_react150.useMemo)(
|
|
27587
27612
|
() => {
|
|
27588
27613
|
var _a2;
|
|
27589
27614
|
return (_a2 = entry == null ? void 0 : entry.line_items) == null ? void 0 : _a2.sort(
|
|
@@ -27761,10 +27786,10 @@ var JournalEntryDetails = () => {
|
|
|
27761
27786
|
};
|
|
27762
27787
|
|
|
27763
27788
|
// src/components/JournalForm/JournalForm.tsx
|
|
27764
|
-
var
|
|
27789
|
+
var import_react152 = require("react");
|
|
27765
27790
|
|
|
27766
27791
|
// src/components/JournalForm/JournalFormEntryLines.tsx
|
|
27767
|
-
var
|
|
27792
|
+
var import_react151 = require("react");
|
|
27768
27793
|
var import_jsx_runtime242 = require("react/jsx-runtime");
|
|
27769
27794
|
function recursiveFlattenCategories(accounts) {
|
|
27770
27795
|
const flattenedResult = accounts.flatMap((a) => {
|
|
@@ -27785,8 +27810,8 @@ var JournalFormEntryLines = ({
|
|
|
27785
27810
|
config
|
|
27786
27811
|
}) => {
|
|
27787
27812
|
const { data: categories } = useCategories({ mode: "ALL" });
|
|
27788
|
-
const { form } = (0,
|
|
27789
|
-
const { flattenedCategories, parentOptions } = (0,
|
|
27813
|
+
const { form } = (0, import_react151.useContext)(JournalContext);
|
|
27814
|
+
const { flattenedCategories, parentOptions } = (0, import_react151.useMemo)(() => {
|
|
27790
27815
|
const flattenedCategories2 = recursiveFlattenCategories(categories != null ? categories : []);
|
|
27791
27816
|
const parentOptions2 = [...flattenedCategories2].sort((a, b) => a.display_name.localeCompare(b.display_name)).map((account) => {
|
|
27792
27817
|
switch (account.type) {
|
|
@@ -27998,7 +28023,7 @@ var JournalForm = ({
|
|
|
27998
28023
|
changeFormData,
|
|
27999
28024
|
addEntryLine,
|
|
28000
28025
|
removeEntryLine
|
|
28001
|
-
} = (0,
|
|
28026
|
+
} = (0, import_react152.useContext)(JournalContext);
|
|
28002
28027
|
return /* @__PURE__ */ (0, import_jsx_runtime243.jsxs)(
|
|
28003
28028
|
"form",
|
|
28004
28029
|
{
|
|
@@ -28146,7 +28171,7 @@ var JournalSidebar = ({
|
|
|
28146
28171
|
config,
|
|
28147
28172
|
stringOverrides
|
|
28148
28173
|
}) => {
|
|
28149
|
-
const { selectedEntryId } = (0,
|
|
28174
|
+
const { selectedEntryId } = (0, import_react153.useContext)(JournalContext);
|
|
28150
28175
|
if (selectedEntryId !== "new") {
|
|
28151
28176
|
return /* @__PURE__ */ (0, import_jsx_runtime244.jsx)(JournalEntryDetails, {});
|
|
28152
28177
|
}
|
|
@@ -28154,7 +28179,7 @@ var JournalSidebar = ({
|
|
|
28154
28179
|
};
|
|
28155
28180
|
|
|
28156
28181
|
// src/components/JournalTable/JournalTable.tsx
|
|
28157
|
-
var
|
|
28182
|
+
var import_react154 = require("react");
|
|
28158
28183
|
var import_date_fns40 = require("date-fns");
|
|
28159
28184
|
var import_jsx_runtime245 = require("react/jsx-runtime");
|
|
28160
28185
|
var accountName = (row) => {
|
|
@@ -28182,9 +28207,9 @@ var JournalTableContent = ({
|
|
|
28182
28207
|
data,
|
|
28183
28208
|
stringOverrides
|
|
28184
28209
|
}) => {
|
|
28185
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0,
|
|
28210
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = (0, import_react154.useContext)(JournalContext);
|
|
28186
28211
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
28187
|
-
(0,
|
|
28212
|
+
(0, import_react154.useEffect)(() => {
|
|
28188
28213
|
if (data.length > 0) {
|
|
28189
28214
|
setIsOpen(data.map((x) => `journal-row-${x.id}`));
|
|
28190
28215
|
}
|
|
@@ -28192,7 +28217,7 @@ var JournalTableContent = ({
|
|
|
28192
28217
|
const renderJournalRow = (row, index, rowKey, depth) => {
|
|
28193
28218
|
const expandable = !!row.line_items && row.line_items.length > 0;
|
|
28194
28219
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
28195
|
-
return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(
|
|
28220
|
+
return /* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(import_react154.Fragment, { children: [
|
|
28196
28221
|
/* @__PURE__ */ (0, import_jsx_runtime245.jsxs)(
|
|
28197
28222
|
TableRow,
|
|
28198
28223
|
{
|
|
@@ -28368,7 +28393,7 @@ var JournalTableWithPanel = ({
|
|
|
28368
28393
|
stringOverrides,
|
|
28369
28394
|
view
|
|
28370
28395
|
}) => {
|
|
28371
|
-
const [currentPage, setCurrentPage] = (0,
|
|
28396
|
+
const [currentPage, setCurrentPage] = (0, import_react155.useState)(1);
|
|
28372
28397
|
const {
|
|
28373
28398
|
data: rawData,
|
|
28374
28399
|
isLoading,
|
|
@@ -28377,8 +28402,8 @@ var JournalTableWithPanel = ({
|
|
|
28377
28402
|
refetch,
|
|
28378
28403
|
selectedEntryId,
|
|
28379
28404
|
addEntry
|
|
28380
|
-
} = (0,
|
|
28381
|
-
const data = (0,
|
|
28405
|
+
} = (0, import_react155.useContext)(JournalContext);
|
|
28406
|
+
const data = (0, import_react155.useMemo)(() => {
|
|
28382
28407
|
var _a;
|
|
28383
28408
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
28384
28409
|
const lastPageIndex = firstPageIndex + pageSize;
|
|
@@ -28515,7 +28540,7 @@ var TasksHeader = ({
|
|
|
28515
28540
|
};
|
|
28516
28541
|
|
|
28517
28542
|
// src/components/Tasks/TasksList.tsx
|
|
28518
|
-
var
|
|
28543
|
+
var import_react163 = require("react");
|
|
28519
28544
|
|
|
28520
28545
|
// src/icons/SmileIcon.tsx
|
|
28521
28546
|
var import_jsx_runtime250 = require("react/jsx-runtime");
|
|
@@ -28574,7 +28599,7 @@ var SmileIcon = (_a) => {
|
|
|
28574
28599
|
var SmileIcon_default = SmileIcon;
|
|
28575
28600
|
|
|
28576
28601
|
// src/components/Tasks/TasksListItem.tsx
|
|
28577
|
-
var
|
|
28602
|
+
var import_react160 = require("react");
|
|
28578
28603
|
var import_classnames74 = __toESM(require("classnames"));
|
|
28579
28604
|
|
|
28580
28605
|
// src/utils/bookkeeping/tasks/getBookkeepingTaskStatusIcon.tsx
|
|
@@ -28598,7 +28623,7 @@ function getIconForTask(task) {
|
|
|
28598
28623
|
}
|
|
28599
28624
|
|
|
28600
28625
|
// src/hooks/bookkeeping/periods/tasks/useSubmitResponseForTask.ts
|
|
28601
|
-
var
|
|
28626
|
+
var import_swr25 = require("swr");
|
|
28602
28627
|
var import_mutation15 = __toESM(require("swr/mutation"));
|
|
28603
28628
|
|
|
28604
28629
|
// src/api/layer/tasks.ts
|
|
@@ -28632,7 +28657,7 @@ function completeTaskWithUpload(baseUrl, accessToken, {
|
|
|
28632
28657
|
}
|
|
28633
28658
|
|
|
28634
28659
|
// src/hooks/bookkeeping/periods/tasks/useSubmitResponseForTask.ts
|
|
28635
|
-
var
|
|
28660
|
+
var import_react156 = require("react");
|
|
28636
28661
|
function buildKey25({
|
|
28637
28662
|
access_token: accessToken,
|
|
28638
28663
|
apiUrl,
|
|
@@ -28650,7 +28675,7 @@ function buildKey25({
|
|
|
28650
28675
|
function useSubmitUserResponseForTask() {
|
|
28651
28676
|
const { data: auth } = useAuth();
|
|
28652
28677
|
const { businessId } = useLayerContext();
|
|
28653
|
-
const { mutate } = (0,
|
|
28678
|
+
const { mutate } = (0, import_swr25.useSWRConfig)();
|
|
28654
28679
|
const mutationResponse = (0, import_mutation15.default)(
|
|
28655
28680
|
() => buildKey25(__spreadProps(__spreadValues({}, auth), {
|
|
28656
28681
|
businessId
|
|
@@ -28675,7 +28700,7 @@ function useSubmitUserResponseForTask() {
|
|
|
28675
28700
|
}
|
|
28676
28701
|
);
|
|
28677
28702
|
const { trigger: originalTrigger } = mutationResponse;
|
|
28678
|
-
const stableProxiedTrigger = (0,
|
|
28703
|
+
const stableProxiedTrigger = (0, import_react156.useCallback)(
|
|
28679
28704
|
(...triggerParameters) => __async(null, null, function* () {
|
|
28680
28705
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
28681
28706
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -28700,9 +28725,9 @@ function useSubmitUserResponseForTask() {
|
|
|
28700
28725
|
}
|
|
28701
28726
|
|
|
28702
28727
|
// src/hooks/bookkeeping/periods/tasks/useUploadDocumentsForTask.ts
|
|
28703
|
-
var
|
|
28728
|
+
var import_swr26 = require("swr");
|
|
28704
28729
|
var import_mutation16 = __toESM(require("swr/mutation"));
|
|
28705
|
-
var
|
|
28730
|
+
var import_react157 = require("react");
|
|
28706
28731
|
function buildKey26({
|
|
28707
28732
|
access_token: accessToken,
|
|
28708
28733
|
apiUrl,
|
|
@@ -28720,7 +28745,7 @@ function buildKey26({
|
|
|
28720
28745
|
function useUploadDocumentsForTask() {
|
|
28721
28746
|
const { data: auth } = useAuth();
|
|
28722
28747
|
const { businessId } = useLayerContext();
|
|
28723
|
-
const { mutate } = (0,
|
|
28748
|
+
const { mutate } = (0, import_swr26.useSWRConfig)();
|
|
28724
28749
|
const mutationResponse = (0, import_mutation16.default)(
|
|
28725
28750
|
() => buildKey26(__spreadProps(__spreadValues({}, auth), {
|
|
28726
28751
|
businessId
|
|
@@ -28741,7 +28766,7 @@ function useUploadDocumentsForTask() {
|
|
|
28741
28766
|
}
|
|
28742
28767
|
);
|
|
28743
28768
|
const { trigger: originalTrigger } = mutationResponse;
|
|
28744
|
-
const stableProxiedTrigger = (0,
|
|
28769
|
+
const stableProxiedTrigger = (0, import_react157.useCallback)(
|
|
28745
28770
|
(...triggerParameters) => __async(null, null, function* () {
|
|
28746
28771
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
28747
28772
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -28766,9 +28791,9 @@ function useUploadDocumentsForTask() {
|
|
|
28766
28791
|
}
|
|
28767
28792
|
|
|
28768
28793
|
// src/hooks/bookkeeping/periods/tasks/useDeleteUploadsOnTask.ts
|
|
28769
|
-
var
|
|
28794
|
+
var import_swr27 = require("swr");
|
|
28770
28795
|
var import_mutation17 = __toESM(require("swr/mutation"));
|
|
28771
|
-
var
|
|
28796
|
+
var import_react158 = require("react");
|
|
28772
28797
|
function buildKey27({
|
|
28773
28798
|
access_token: accessToken,
|
|
28774
28799
|
apiUrl,
|
|
@@ -28786,7 +28811,7 @@ function buildKey27({
|
|
|
28786
28811
|
function useDeleteUploadsOnTask() {
|
|
28787
28812
|
const { data: auth } = useAuth();
|
|
28788
28813
|
const { businessId } = useLayerContext();
|
|
28789
|
-
const { mutate } = (0,
|
|
28814
|
+
const { mutate } = (0, import_swr27.useSWRConfig)();
|
|
28790
28815
|
const mutationResponse = (0, import_mutation17.default)(
|
|
28791
28816
|
() => buildKey27(__spreadProps(__spreadValues({}, auth), {
|
|
28792
28817
|
businessId
|
|
@@ -28804,7 +28829,7 @@ function useDeleteUploadsOnTask() {
|
|
|
28804
28829
|
}
|
|
28805
28830
|
);
|
|
28806
28831
|
const { trigger: originalTrigger } = mutationResponse;
|
|
28807
|
-
const stableProxiedTrigger = (0,
|
|
28832
|
+
const stableProxiedTrigger = (0, import_react158.useCallback)(
|
|
28808
28833
|
(...triggerParameters) => __async(null, null, function* () {
|
|
28809
28834
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
28810
28835
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -28829,9 +28854,9 @@ function useDeleteUploadsOnTask() {
|
|
|
28829
28854
|
}
|
|
28830
28855
|
|
|
28831
28856
|
// src/hooks/bookkeeping/periods/tasks/useUpdateTaskUploadDescription.ts
|
|
28832
|
-
var
|
|
28857
|
+
var import_swr28 = require("swr");
|
|
28833
28858
|
var import_mutation18 = __toESM(require("swr/mutation"));
|
|
28834
|
-
var
|
|
28859
|
+
var import_react159 = require("react");
|
|
28835
28860
|
function buildKey28({
|
|
28836
28861
|
access_token: accessToken,
|
|
28837
28862
|
apiUrl,
|
|
@@ -28849,7 +28874,7 @@ function buildKey28({
|
|
|
28849
28874
|
function useUpdateTaskUploadDescription() {
|
|
28850
28875
|
const { data: auth } = useAuth();
|
|
28851
28876
|
const { businessId } = useLayerContext();
|
|
28852
|
-
const { mutate } = (0,
|
|
28877
|
+
const { mutate } = (0, import_swr28.useSWRConfig)();
|
|
28853
28878
|
const mutationResponse = (0, import_mutation18.default)(
|
|
28854
28879
|
() => buildKey28(__spreadProps(__spreadValues({}, auth), {
|
|
28855
28880
|
businessId
|
|
@@ -28871,7 +28896,7 @@ function useUpdateTaskUploadDescription() {
|
|
|
28871
28896
|
}
|
|
28872
28897
|
);
|
|
28873
28898
|
const { trigger: originalTrigger } = mutationResponse;
|
|
28874
|
-
const stableProxiedTrigger = (0,
|
|
28899
|
+
const stableProxiedTrigger = (0, import_react159.useCallback)(
|
|
28875
28900
|
(...triggerParameters) => __async(null, null, function* () {
|
|
28876
28901
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
28877
28902
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -28902,9 +28927,9 @@ var TasksListItem = ({
|
|
|
28902
28927
|
defaultOpen
|
|
28903
28928
|
}) => {
|
|
28904
28929
|
var _a, _b;
|
|
28905
|
-
const [isOpen, setIsOpen] = (0,
|
|
28906
|
-
const [userResponse, setUserResponse] = (0,
|
|
28907
|
-
const [selectedFiles, setSelectedFiles] = (0,
|
|
28930
|
+
const [isOpen, setIsOpen] = (0, import_react160.useState)(defaultOpen);
|
|
28931
|
+
const [userResponse, setUserResponse] = (0, import_react160.useState)((_a = task.user_response) != null ? _a : "");
|
|
28932
|
+
const [selectedFiles, setSelectedFiles] = (0, import_react160.useState)();
|
|
28908
28933
|
const { trigger: handleSubmitUserResponseForTask } = useSubmitUserResponseForTask();
|
|
28909
28934
|
const { trigger: handleUploadDocumentsForTask } = useUploadDocumentsForTask();
|
|
28910
28935
|
const { trigger: handleDeleteUploadsOnTask } = useDeleteUploadsOnTask();
|
|
@@ -28922,7 +28947,7 @@ var TasksListItem = ({
|
|
|
28922
28947
|
"Layer__tasks-list-item",
|
|
28923
28948
|
isOpen && "Layer__tasks-list-item__expanded"
|
|
28924
28949
|
);
|
|
28925
|
-
(0,
|
|
28950
|
+
(0, import_react160.useEffect)(() => {
|
|
28926
28951
|
setIsOpen(defaultOpen);
|
|
28927
28952
|
}, [defaultOpen]);
|
|
28928
28953
|
const submit = () => __async(null, null, function* () {
|
|
@@ -28937,7 +28962,7 @@ var TasksListItem = ({
|
|
|
28937
28962
|
setIsOpen(false);
|
|
28938
28963
|
setSelectedFiles(void 0);
|
|
28939
28964
|
});
|
|
28940
|
-
const uploadDocumentAction = (0,
|
|
28965
|
+
const uploadDocumentAction = (0, import_react160.useMemo)(() => {
|
|
28941
28966
|
if (task.user_response_type === "UPLOAD_DOCUMENT") {
|
|
28942
28967
|
if (task.status === "TODO") {
|
|
28943
28968
|
if (!selectedFiles) {
|
|
@@ -29082,7 +29107,7 @@ var MobilePanel = ({ header, children, open: open2, onClose, className }) => {
|
|
|
29082
29107
|
};
|
|
29083
29108
|
|
|
29084
29109
|
// src/components/Tasks/TasksListMobile.tsx
|
|
29085
|
-
var
|
|
29110
|
+
var import_react161 = require("react");
|
|
29086
29111
|
var import_jsx_runtime254 = require("react/jsx-runtime");
|
|
29087
29112
|
var MOBILE_SHOW_UNRESOLVED_TASKS_COUNT = 2;
|
|
29088
29113
|
var TasksListMobile = ({
|
|
@@ -29093,7 +29118,7 @@ var TasksListMobile = ({
|
|
|
29093
29118
|
pageSize,
|
|
29094
29119
|
setCurrentPage
|
|
29095
29120
|
}) => {
|
|
29096
|
-
const [showMobilePanel, setShowMobilePanel] = (0,
|
|
29121
|
+
const [showMobilePanel, setShowMobilePanel] = (0, import_react161.useState)(false);
|
|
29097
29122
|
const unresolvedTasks = getIncompleteTasks(sortedTasks).slice(0, MOBILE_SHOW_UNRESOLVED_TASKS_COUNT);
|
|
29098
29123
|
return /* @__PURE__ */ (0, import_jsx_runtime254.jsxs)("div", { className: "Layer__tasks-list", children: [
|
|
29099
29124
|
unresolvedTasks.map((task, index) => /* @__PURE__ */ (0, import_jsx_runtime254.jsx)(
|
|
@@ -29141,27 +29166,27 @@ var TasksListMobile = ({
|
|
|
29141
29166
|
};
|
|
29142
29167
|
|
|
29143
29168
|
// src/hooks/array/usePaginatedList.ts
|
|
29144
|
-
var
|
|
29169
|
+
var import_react162 = require("react");
|
|
29145
29170
|
function usePaginatedList(list, pageSize) {
|
|
29146
|
-
const [internalPageIndex, setInternalPageIndex] = (0,
|
|
29171
|
+
const [internalPageIndex, setInternalPageIndex] = (0, import_react162.useState)(0);
|
|
29147
29172
|
const pageCount = Math.max(0, Math.ceil(list.length / pageSize));
|
|
29148
29173
|
const effectivePageIndex = Math.max(0, Math.min(internalPageIndex, pageCount - 1));
|
|
29149
|
-
const pageItems = (0,
|
|
29174
|
+
const pageItems = (0, import_react162.useMemo)(() => {
|
|
29150
29175
|
return list.slice(
|
|
29151
29176
|
effectivePageIndex * pageSize,
|
|
29152
29177
|
(effectivePageIndex + 1) * pageSize
|
|
29153
29178
|
);
|
|
29154
29179
|
}, [list, effectivePageIndex, pageSize]);
|
|
29155
|
-
const next = (0,
|
|
29180
|
+
const next = (0, import_react162.useCallback)(() => {
|
|
29156
29181
|
setInternalPageIndex(Math.min(effectivePageIndex + 1, pageCount - 1));
|
|
29157
29182
|
}, [effectivePageIndex, pageCount]);
|
|
29158
|
-
const set2 = (0,
|
|
29183
|
+
const set2 = (0, import_react162.useCallback)((pageIndex) => {
|
|
29159
29184
|
setInternalPageIndex(Math.max(0, Math.min(pageIndex, pageCount - 1)));
|
|
29160
29185
|
}, [pageCount]);
|
|
29161
|
-
const previous = (0,
|
|
29186
|
+
const previous = (0, import_react162.useCallback)(() => {
|
|
29162
29187
|
setInternalPageIndex(Math.max(effectivePageIndex - 1, 0));
|
|
29163
29188
|
}, [effectivePageIndex]);
|
|
29164
|
-
const reset = (0,
|
|
29189
|
+
const reset = (0, import_react162.useCallback)(() => {
|
|
29165
29190
|
setInternalPageIndex(0);
|
|
29166
29191
|
}, []);
|
|
29167
29192
|
return {
|
|
@@ -29189,7 +29214,7 @@ var TasksEmptyState = () => /* @__PURE__ */ (0, import_jsx_runtime255.jsxs)("div
|
|
|
29189
29214
|
] });
|
|
29190
29215
|
function TasksList({ pageSize = 8, mobile }) {
|
|
29191
29216
|
const { activePeriod } = useActiveBookkeepingPeriod();
|
|
29192
|
-
const sortedTasks = (0,
|
|
29217
|
+
const sortedTasks = (0, import_react163.useMemo)(() => {
|
|
29193
29218
|
var _a;
|
|
29194
29219
|
const tasksInPeriod = (_a = activePeriod == null ? void 0 : activePeriod.tasks) != null ? _a : [];
|
|
29195
29220
|
return tasksInPeriod.sort((taskA, taskB) => {
|
|
@@ -29331,7 +29356,7 @@ var TasksPending = () => {
|
|
|
29331
29356
|
};
|
|
29332
29357
|
|
|
29333
29358
|
// src/components/Tasks/TasksMonthSelector.tsx
|
|
29334
|
-
var
|
|
29359
|
+
var import_react164 = require("react");
|
|
29335
29360
|
var import_date_fns42 = require("date-fns");
|
|
29336
29361
|
|
|
29337
29362
|
// src/components/Tasks/TaskStatusBadge.tsx
|
|
@@ -29433,7 +29458,7 @@ function useActiveYearBookkeepingPeriods() {
|
|
|
29433
29458
|
const { date } = useGlobalDate();
|
|
29434
29459
|
const { data } = useBookkeepingPeriods();
|
|
29435
29460
|
const activeYear = (0, import_date_fns42.getYear)(date);
|
|
29436
|
-
const periodsInActiveYear = (0,
|
|
29461
|
+
const periodsInActiveYear = (0, import_react164.useMemo)(() => {
|
|
29437
29462
|
return data == null ? void 0 : data.filter((period) => period.year === activeYear);
|
|
29438
29463
|
}, [data, activeYear]);
|
|
29439
29464
|
return { periodsInActiveYear };
|
|
@@ -29444,7 +29469,7 @@ function TasksMonthSelector() {
|
|
|
29444
29469
|
const { periodsInActiveYear } = useActiveYearBookkeepingPeriods();
|
|
29445
29470
|
const activeMonthNumber = (0, import_date_fns42.getMonth)(date) + 1;
|
|
29446
29471
|
const activeYear = (0, import_date_fns42.getYear)(date);
|
|
29447
|
-
const monthsData = (0,
|
|
29472
|
+
const monthsData = (0, import_react164.useMemo)(() => {
|
|
29448
29473
|
return Array.from({ length: 12 }, (_, index) => {
|
|
29449
29474
|
var _a, _b;
|
|
29450
29475
|
const date2 = (0, import_date_fns42.set)(
|
|
@@ -29494,13 +29519,13 @@ var import_classnames78 = __toESM(require("classnames"));
|
|
|
29494
29519
|
var import_pluralize3 = __toESM(require("pluralize"));
|
|
29495
29520
|
|
|
29496
29521
|
// src/hooks/bookkeeping/periods/useBookkeepingYearsStatus.ts
|
|
29497
|
-
var
|
|
29522
|
+
var import_react165 = require("react");
|
|
29498
29523
|
var import_date_fns43 = require("date-fns");
|
|
29499
29524
|
var useBookkeepingYearsStatus = () => {
|
|
29500
29525
|
const { business } = useLayerContext();
|
|
29501
29526
|
const activationDate = getActivationDate(business);
|
|
29502
29527
|
const { data, isLoading } = useBookkeepingPeriods();
|
|
29503
|
-
const yearStatuses = (0,
|
|
29528
|
+
const yearStatuses = (0, import_react165.useMemo)(() => {
|
|
29504
29529
|
const startYear = (0, import_date_fns43.getYear)(activationDate != null ? activationDate : /* @__PURE__ */ new Date());
|
|
29505
29530
|
const currentYear = (/* @__PURE__ */ new Date()).getFullYear();
|
|
29506
29531
|
const count = currentYear - startYear + 1;
|
|
@@ -29515,7 +29540,7 @@ var useBookkeepingYearsStatus = () => {
|
|
|
29515
29540
|
};
|
|
29516
29541
|
}).filter(({ year }) => data == null ? void 0 : data.some((period) => period.year === year)).sort((a, b) => b.year - a.year);
|
|
29517
29542
|
}, [activationDate, data]);
|
|
29518
|
-
const earliestIncompletePeriod = (0,
|
|
29543
|
+
const earliestIncompletePeriod = (0, import_react165.useMemo)(
|
|
29519
29544
|
() => [...data != null ? data : []].sort((a, b) => {
|
|
29520
29545
|
if (a.year === b.year) {
|
|
29521
29546
|
return b.month - a.month;
|
|
@@ -29658,10 +29683,10 @@ var TasksPanelNotification = ({
|
|
|
29658
29683
|
};
|
|
29659
29684
|
|
|
29660
29685
|
// src/components/Tasks/TasksYearsTabs.tsx
|
|
29661
|
-
var
|
|
29686
|
+
var import_react168 = require("react");
|
|
29662
29687
|
|
|
29663
29688
|
// src/components/Tabs/Tabs.tsx
|
|
29664
|
-
var
|
|
29689
|
+
var import_react166 = require("react");
|
|
29665
29690
|
|
|
29666
29691
|
// src/components/Tabs/Tab.tsx
|
|
29667
29692
|
var import_jsx_runtime263 = require("react/jsx-runtime");
|
|
@@ -29725,12 +29750,12 @@ var Tab = ({
|
|
|
29725
29750
|
// src/components/Tabs/Tabs.tsx
|
|
29726
29751
|
var import_classnames77 = __toESM(require("classnames"));
|
|
29727
29752
|
var import_jsx_runtime264 = require("react/jsx-runtime");
|
|
29728
|
-
var
|
|
29753
|
+
var import_react167 = require("react");
|
|
29729
29754
|
var STARTING_PADDING = 12;
|
|
29730
29755
|
var Tabs = ({ name, options, selected, onChange }) => {
|
|
29731
|
-
const [initialized, setInitialized] = (0,
|
|
29732
|
-
const [thumbPos, setThumbPos] = (0,
|
|
29733
|
-
const [currentWidth, setCurrentWidth] = (0,
|
|
29756
|
+
const [initialized, setInitialized] = (0, import_react166.useState)(false);
|
|
29757
|
+
const [thumbPos, setThumbPos] = (0, import_react166.useState)({ left: 0, width: 0 });
|
|
29758
|
+
const [currentWidth, setCurrentWidth] = (0, import_react166.useState)(0);
|
|
29734
29759
|
const selectedValue = selected || options[0].value;
|
|
29735
29760
|
const baseClassName = (0, import_classnames77.default)(
|
|
29736
29761
|
"Layer__tabs",
|
|
@@ -29765,14 +29790,14 @@ var Tabs = ({ name, options, selected, onChange }) => {
|
|
|
29765
29790
|
shift2 = shift2 + STARTING_PADDING;
|
|
29766
29791
|
setThumbPos({ left: shift2, width });
|
|
29767
29792
|
};
|
|
29768
|
-
(0,
|
|
29793
|
+
(0, import_react166.useEffect)(() => {
|
|
29769
29794
|
const selectedIndex = getSelectedIndex();
|
|
29770
29795
|
updateSelectPosition(selectedIndex);
|
|
29771
29796
|
setTimeout(() => {
|
|
29772
29797
|
setInitialized(true);
|
|
29773
29798
|
}, 400);
|
|
29774
29799
|
}, []);
|
|
29775
|
-
(0,
|
|
29800
|
+
(0, import_react166.useEffect)(() => {
|
|
29776
29801
|
const selectedIndex = getSelectedIndex();
|
|
29777
29802
|
updateSelectPosition(selectedIndex);
|
|
29778
29803
|
}, [selectedValue, currentWidth]);
|
|
@@ -29788,7 +29813,7 @@ var Tabs = ({ name, options, selected, onChange }) => {
|
|
|
29788
29813
|
return /* @__PURE__ */ (0, import_jsx_runtime264.jsx)("div", { className: "Layer__tabs__container", children: /* @__PURE__ */ (0, import_jsx_runtime264.jsxs)("div", { className: baseClassName, ref: elementRef, children: [
|
|
29789
29814
|
options.map((option, index) => {
|
|
29790
29815
|
var _a;
|
|
29791
|
-
return /* @__PURE__ */ (0,
|
|
29816
|
+
return /* @__PURE__ */ (0, import_react167.createElement)(
|
|
29792
29817
|
Tab,
|
|
29793
29818
|
__spreadProps(__spreadValues({}, option), {
|
|
29794
29819
|
key: option.value,
|
|
@@ -29820,7 +29845,7 @@ var TasksYearsTabs = () => {
|
|
|
29820
29845
|
yearNumber: Number(year)
|
|
29821
29846
|
});
|
|
29822
29847
|
};
|
|
29823
|
-
const yearsList = (0,
|
|
29848
|
+
const yearsList = (0, import_react168.useMemo)(() => {
|
|
29824
29849
|
return yearStatuses == null ? void 0 : yearStatuses.sort((a, b) => a.year - b.year).map((y) => {
|
|
29825
29850
|
return {
|
|
29826
29851
|
value: `${y.year}`,
|
|
@@ -29923,10 +29948,10 @@ function Tasks({
|
|
|
29923
29948
|
}
|
|
29924
29949
|
|
|
29925
29950
|
// src/components/PlatformOnboarding/LinkAccounts.tsx
|
|
29926
|
-
var
|
|
29951
|
+
var import_react171 = require("react");
|
|
29927
29952
|
|
|
29928
29953
|
// src/components/PlatformOnboarding/Steps/LinkAccountsConfirmationStep.tsx
|
|
29929
|
-
var
|
|
29954
|
+
var import_react169 = require("react");
|
|
29930
29955
|
var import_react_form3 = require("@tanstack/react-form");
|
|
29931
29956
|
|
|
29932
29957
|
// src/components/PlatformOnboarding/Container/LinkAccountsListContainer.tsx
|
|
@@ -29962,7 +29987,7 @@ function LinkAccountsConfirmationStep() {
|
|
|
29962
29987
|
data: linkedAccounts,
|
|
29963
29988
|
loadingStatus: linkedAccountsLoadingStatus,
|
|
29964
29989
|
refetchAccounts
|
|
29965
|
-
} = (0,
|
|
29990
|
+
} = (0, import_react169.useContext)(LinkedAccountsContext);
|
|
29966
29991
|
const effectiveLinkedAccounts = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
|
|
29967
29992
|
const { trigger } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
|
|
29968
29993
|
const { previous, next } = useWizard();
|
|
@@ -30035,7 +30060,7 @@ function LinkAccountsConfirmationStep() {
|
|
|
30035
30060
|
}
|
|
30036
30061
|
|
|
30037
30062
|
// src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
|
|
30038
|
-
var
|
|
30063
|
+
var import_react170 = require("react");
|
|
30039
30064
|
var import_pluralize4 = __toESM(require("pluralize"));
|
|
30040
30065
|
var import_jsx_runtime270 = require("react/jsx-runtime");
|
|
30041
30066
|
function LinkAccountsLinkStep() {
|
|
@@ -30045,7 +30070,7 @@ function LinkAccountsLinkStep() {
|
|
|
30045
30070
|
error,
|
|
30046
30071
|
refetchAccounts,
|
|
30047
30072
|
addConnection
|
|
30048
|
-
} = (0,
|
|
30073
|
+
} = (0, import_react170.useContext)(LinkedAccountsContext);
|
|
30049
30074
|
const { next } = useWizard();
|
|
30050
30075
|
const effectiveAccounts = data != null ? data : [];
|
|
30051
30076
|
return /* @__PURE__ */ (0, import_jsx_runtime270.jsxs)(import_jsx_runtime270.Fragment, { children: [
|
|
@@ -30125,7 +30150,7 @@ function LinkAccounts(props) {
|
|
|
30125
30150
|
function LinkAccountsContent({
|
|
30126
30151
|
onComplete
|
|
30127
30152
|
}) {
|
|
30128
|
-
const { data: linkedAccounts, loadingStatus } = (0,
|
|
30153
|
+
const { data: linkedAccounts, loadingStatus } = (0, import_react171.useContext)(LinkedAccountsContext);
|
|
30129
30154
|
const linkedAccountsNeedingConfirmation = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
|
|
30130
30155
|
const hideConfirmationStep = loadingStatus === "complete" && linkedAccountsNeedingConfirmation.length === 0;
|
|
30131
30156
|
return /* @__PURE__ */ (0, import_jsx_runtime271.jsx)("section", { className: "Layer__link-accounts Layer__component", children: /* @__PURE__ */ (0, import_jsx_runtime271.jsxs)(
|
|
@@ -30143,7 +30168,7 @@ function LinkAccountsContent({
|
|
|
30143
30168
|
}
|
|
30144
30169
|
|
|
30145
30170
|
// src/components/PlatformOnboarding/PlatformOnboarding.tsx
|
|
30146
|
-
var
|
|
30171
|
+
var import_react176 = require("react");
|
|
30147
30172
|
|
|
30148
30173
|
// src/components/ProgressSteps/ProgressSteps.tsx
|
|
30149
30174
|
var import_jsx_runtime272 = require("react/jsx-runtime");
|
|
@@ -30448,7 +30473,7 @@ var SummaryStep = ({ onNext, title = defaultTitle2, description = defaultDescrip
|
|
|
30448
30473
|
var import_react_form4 = require("@tanstack/react-form");
|
|
30449
30474
|
|
|
30450
30475
|
// src/hooks/businessPersonnel/useBusinessPersonnel.ts
|
|
30451
|
-
var
|
|
30476
|
+
var import_swr29 = __toESM(require("swr"));
|
|
30452
30477
|
|
|
30453
30478
|
// src/utils/array/readonlyTransformations.ts
|
|
30454
30479
|
function mapReadonly(array, callbackFn) {
|
|
@@ -30484,7 +30509,7 @@ var getBusinessPersonnel = get(({ businessId }) => `/v1/businesses/${businessId}
|
|
|
30484
30509
|
function useBusinessPersonnel() {
|
|
30485
30510
|
const { data } = useAuth();
|
|
30486
30511
|
const { businessId } = useLayerContext();
|
|
30487
|
-
return (0,
|
|
30512
|
+
return (0, import_swr29.default)(
|
|
30488
30513
|
() => buildKey29(__spreadProps(__spreadValues({}, data), {
|
|
30489
30514
|
businessId
|
|
30490
30515
|
})),
|
|
@@ -30525,8 +30550,8 @@ function useBusinessPersonnel() {
|
|
|
30525
30550
|
|
|
30526
30551
|
// src/hooks/businessPersonnel/useCreateBusinessPersonnel.ts
|
|
30527
30552
|
var import_mutation19 = __toESM(require("swr/mutation"));
|
|
30528
|
-
var
|
|
30529
|
-
var
|
|
30553
|
+
var import_swr30 = require("swr");
|
|
30554
|
+
var import_react172 = require("react");
|
|
30530
30555
|
var createBusinessPersonnel = post(({ businessId }) => `/v1/businesses/${businessId}/personnel`);
|
|
30531
30556
|
function buildKey30({
|
|
30532
30557
|
access_token: accessToken,
|
|
@@ -30545,7 +30570,7 @@ function buildKey30({
|
|
|
30545
30570
|
function useCreateBusinessPersonnel() {
|
|
30546
30571
|
const { data } = useAuth();
|
|
30547
30572
|
const { businessId } = useLayerContext();
|
|
30548
|
-
const { mutate } = (0,
|
|
30573
|
+
const { mutate } = (0, import_swr30.useSWRConfig)();
|
|
30549
30574
|
const mutationResponse = (0, import_mutation19.default)(
|
|
30550
30575
|
() => buildKey30(__spreadProps(__spreadValues({}, data), {
|
|
30551
30576
|
businessId
|
|
@@ -30564,7 +30589,7 @@ function useCreateBusinessPersonnel() {
|
|
|
30564
30589
|
}
|
|
30565
30590
|
);
|
|
30566
30591
|
const { trigger: originalTrigger } = mutationResponse;
|
|
30567
|
-
const stableProxiedTrigger = (0,
|
|
30592
|
+
const stableProxiedTrigger = (0, import_react172.useCallback)(
|
|
30568
30593
|
(...triggerParameters) => __async(null, null, function* () {
|
|
30569
30594
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
30570
30595
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -30590,7 +30615,7 @@ function useCreateBusinessPersonnel() {
|
|
|
30590
30615
|
|
|
30591
30616
|
// src/hooks/businessPersonnel/useUpdateBusinessPersonnel.ts
|
|
30592
30617
|
var import_mutation20 = __toESM(require("swr/mutation"));
|
|
30593
|
-
var
|
|
30618
|
+
var import_swr31 = require("swr");
|
|
30594
30619
|
|
|
30595
30620
|
// src/api/layer/businessPersonnel/updateBusinessPersonnel.ts
|
|
30596
30621
|
var updateBusinessPersonnel = post(({ businessId, businessPersonnelId }) => {
|
|
@@ -30598,7 +30623,7 @@ var updateBusinessPersonnel = post(({ businessId, businessPersonnelId }) => {
|
|
|
30598
30623
|
});
|
|
30599
30624
|
|
|
30600
30625
|
// src/hooks/businessPersonnel/useUpdateBusinessPersonnel.ts
|
|
30601
|
-
var
|
|
30626
|
+
var import_react173 = require("react");
|
|
30602
30627
|
function buildKey31({
|
|
30603
30628
|
access_token: accessToken,
|
|
30604
30629
|
apiUrl,
|
|
@@ -30618,7 +30643,7 @@ function buildKey31({
|
|
|
30618
30643
|
function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
30619
30644
|
const { data } = useAuth();
|
|
30620
30645
|
const { businessId } = useLayerContext();
|
|
30621
|
-
const { mutate } = (0,
|
|
30646
|
+
const { mutate } = (0, import_swr31.useSWRConfig)();
|
|
30622
30647
|
const mutationResponse = (0, import_mutation20.default)(
|
|
30623
30648
|
() => buildKey31(__spreadProps(__spreadValues({}, data), {
|
|
30624
30649
|
businessId,
|
|
@@ -30641,7 +30666,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
|
30641
30666
|
}
|
|
30642
30667
|
);
|
|
30643
30668
|
const { trigger: originalTrigger } = mutationResponse;
|
|
30644
|
-
const stableProxiedTrigger = (0,
|
|
30669
|
+
const stableProxiedTrigger = (0, import_react173.useCallback)(
|
|
30645
30670
|
(...triggerParameters) => __async(null, null, function* () {
|
|
30646
30671
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
30647
30672
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -30667,8 +30692,8 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
|
30667
30692
|
|
|
30668
30693
|
// src/hooks/business/useUpdateBusiness.ts
|
|
30669
30694
|
var import_mutation21 = __toESM(require("swr/mutation"));
|
|
30670
|
-
var
|
|
30671
|
-
var
|
|
30695
|
+
var import_swr32 = require("swr");
|
|
30696
|
+
var import_react174 = require("react");
|
|
30672
30697
|
var BUSINESS_TAG_KEY = "business";
|
|
30673
30698
|
function buildKey32({
|
|
30674
30699
|
access_token: accessToken,
|
|
@@ -30687,7 +30712,7 @@ function buildKey32({
|
|
|
30687
30712
|
function useUpdateBusiness() {
|
|
30688
30713
|
const { data } = useAuth();
|
|
30689
30714
|
const { businessId } = useLayerContext();
|
|
30690
|
-
const { mutate } = (0,
|
|
30715
|
+
const { mutate } = (0, import_swr32.useSWRConfig)();
|
|
30691
30716
|
const mutationResponse = (0, import_mutation21.default)(
|
|
30692
30717
|
() => buildKey32(__spreadProps(__spreadValues({}, data), {
|
|
30693
30718
|
businessId
|
|
@@ -30706,7 +30731,7 @@ function useUpdateBusiness() {
|
|
|
30706
30731
|
}
|
|
30707
30732
|
);
|
|
30708
30733
|
const { trigger: originalTrigger } = mutationResponse;
|
|
30709
|
-
const stableProxiedTrigger = (0,
|
|
30734
|
+
const stableProxiedTrigger = (0, import_react174.useCallback)(
|
|
30710
30735
|
(...triggerParameters) => __async(null, null, function* () {
|
|
30711
30736
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
30712
30737
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -30731,7 +30756,7 @@ function useUpdateBusiness() {
|
|
|
30731
30756
|
}
|
|
30732
30757
|
|
|
30733
30758
|
// src/components/BusinessForm/useBusinessForm.ts
|
|
30734
|
-
var
|
|
30759
|
+
var import_react175 = require("react");
|
|
30735
30760
|
var getPerson = (personnel) => {
|
|
30736
30761
|
const owners = personnel == null ? void 0 : personnel.filter((p) => p.roles.find((x) => x.role === "OWNER"));
|
|
30737
30762
|
if (owners && owners.length > 0) {
|
|
@@ -30742,7 +30767,7 @@ var getPerson = (personnel) => {
|
|
|
30742
30767
|
var useBusinessForm = ({ onSuccess }) => {
|
|
30743
30768
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
30744
30769
|
const { business } = useLayerContext();
|
|
30745
|
-
const [submitError, setSubmitError] = (0,
|
|
30770
|
+
const [submitError, setSubmitError] = (0, import_react175.useState)(void 0);
|
|
30746
30771
|
const { data: personnel } = useBusinessPersonnel();
|
|
30747
30772
|
const person = getPerson(personnel);
|
|
30748
30773
|
const { trigger: createBusinessPersonnel2 } = useCreateBusinessPersonnel();
|
|
@@ -31158,7 +31183,7 @@ var PLATFORM_ONBOARDING_STEPS = [
|
|
|
31158
31183
|
}
|
|
31159
31184
|
];
|
|
31160
31185
|
var PlatformOnboarding = ({ onComplete }) => {
|
|
31161
|
-
const [step, setStep] = (0,
|
|
31186
|
+
const [step, setStep] = (0, import_react176.useState)(PLATFORM_ONBOARDING_STEPS[0].id);
|
|
31162
31187
|
const isFirstStep = PLATFORM_ONBOARDING_STEPS[0].id === step;
|
|
31163
31188
|
const nextStep = () => {
|
|
31164
31189
|
const currentStepIndex = PLATFORM_ONBOARDING_STEPS.findIndex((s) => s.id === step);
|
|
@@ -31320,7 +31345,7 @@ var BookkeepingUpsellBar = ({
|
|
|
31320
31345
|
};
|
|
31321
31346
|
|
|
31322
31347
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
31323
|
-
var
|
|
31348
|
+
var import_react178 = require("react");
|
|
31324
31349
|
|
|
31325
31350
|
// src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
|
|
31326
31351
|
var import_jsx_runtime286 = require("react/jsx-runtime");
|
|
@@ -31335,15 +31360,15 @@ function BookkeepingProfitAndLossSummariesContainer({
|
|
|
31335
31360
|
var import_classnames79 = __toESM(require("classnames"));
|
|
31336
31361
|
|
|
31337
31362
|
// src/views/BookkeepingOverview/useKeepInMobileViewport.tsx
|
|
31338
|
-
var
|
|
31363
|
+
var import_react177 = require("react");
|
|
31339
31364
|
var TASKS_MOBILE_VIEWPORT_WIDTH = 1100;
|
|
31340
31365
|
var useKeepInMobileViewport = () => {
|
|
31341
|
-
const upperContentRef = (0,
|
|
31342
|
-
const targetElementRef = (0,
|
|
31343
|
-
const lastKnownSizeRef = (0,
|
|
31344
|
-
const lastKnownTargetPositionRef = (0,
|
|
31345
|
-
const upperElementInFocus = (0,
|
|
31346
|
-
(0,
|
|
31366
|
+
const upperContentRef = (0, import_react177.useRef)(null);
|
|
31367
|
+
const targetElementRef = (0, import_react177.useRef)(null);
|
|
31368
|
+
const lastKnownSizeRef = (0, import_react177.useRef)(null);
|
|
31369
|
+
const lastKnownTargetPositionRef = (0, import_react177.useRef)(null);
|
|
31370
|
+
const upperElementInFocus = (0, import_react177.useRef)(false);
|
|
31371
|
+
(0, import_react177.useEffect)(() => {
|
|
31347
31372
|
if (!upperContentRef.current || !targetElementRef.current) return;
|
|
31348
31373
|
lastKnownSizeRef.current = upperContentRef.current.getBoundingClientRect().height;
|
|
31349
31374
|
lastKnownTargetPositionRef.current = targetElementRef.current.getBoundingClientRect().top;
|
|
@@ -31400,7 +31425,7 @@ var BookkeepingOverview = ({
|
|
|
31400
31425
|
slotProps
|
|
31401
31426
|
}) => {
|
|
31402
31427
|
var _a, _b, _c, _d, _e, _f;
|
|
31403
|
-
const [pnlToggle, setPnlToggle] = (0,
|
|
31428
|
+
const [pnlToggle, setPnlToggle] = (0, import_react178.useState)("expenses");
|
|
31404
31429
|
const [width] = useWindowSize();
|
|
31405
31430
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
31406
31431
|
const { upperContentRef, targetElementRef, upperElementInFocus } = useKeepInMobileViewport();
|
|
@@ -31531,7 +31556,7 @@ var BookkeepingOverview = ({
|
|
|
31531
31556
|
};
|
|
31532
31557
|
|
|
31533
31558
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
31534
|
-
var
|
|
31559
|
+
var import_react179 = require("react");
|
|
31535
31560
|
var import_classnames80 = __toESM(require("classnames"));
|
|
31536
31561
|
var import_jsx_runtime288 = require("react/jsx-runtime");
|
|
31537
31562
|
var AccountingOverview = ({
|
|
@@ -31547,7 +31572,7 @@ var AccountingOverview = ({
|
|
|
31547
31572
|
slotProps
|
|
31548
31573
|
}) => {
|
|
31549
31574
|
var _a, _b, _c, _d, _e;
|
|
31550
|
-
const [pnlToggle, setPnlToggle] = (0,
|
|
31575
|
+
const [pnlToggle, setPnlToggle] = (0, import_react179.useState)("expenses");
|
|
31551
31576
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
31552
31577
|
return /* @__PURE__ */ (0, import_jsx_runtime288.jsx)(
|
|
31553
31578
|
ProfitAndLoss,
|
|
@@ -31714,7 +31739,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
31714
31739
|
};
|
|
31715
31740
|
|
|
31716
31741
|
// src/views/GeneralLedger/GeneralLedger.tsx
|
|
31717
|
-
var
|
|
31742
|
+
var import_react180 = require("react");
|
|
31718
31743
|
var import_jsx_runtime290 = require("react/jsx-runtime");
|
|
31719
31744
|
var GeneralLedgerView = ({
|
|
31720
31745
|
title,
|
|
@@ -31723,7 +31748,7 @@ var GeneralLedgerView = ({
|
|
|
31723
31748
|
stringOverrides,
|
|
31724
31749
|
chartOfAccountsOptions
|
|
31725
31750
|
}) => {
|
|
31726
|
-
const [activeTab, setActiveTab] = (0,
|
|
31751
|
+
const [activeTab, setActiveTab] = (0, import_react180.useState)("chartOfAccounts");
|
|
31727
31752
|
return /* @__PURE__ */ (0, import_jsx_runtime290.jsx)(ProfitAndLoss, { asContainer: false, children: /* @__PURE__ */ (0, import_jsx_runtime290.jsxs)(
|
|
31728
31753
|
View,
|
|
31729
31754
|
{
|
|
@@ -31765,7 +31790,7 @@ var GeneralLedgerView = ({
|
|
|
31765
31790
|
};
|
|
31766
31791
|
|
|
31767
31792
|
// src/views/ProjectProfitability/ProjectProfitability.tsx
|
|
31768
|
-
var
|
|
31793
|
+
var import_react181 = require("react");
|
|
31769
31794
|
var import_react_select6 = __toESM(require("react-select"));
|
|
31770
31795
|
var import_jsx_runtime291 = require("react/jsx-runtime");
|
|
31771
31796
|
var ProjectProfitabilityView = ({
|
|
@@ -31775,9 +31800,9 @@ var ProjectProfitabilityView = ({
|
|
|
31775
31800
|
datePickerMode = "monthPicker",
|
|
31776
31801
|
csvMoneyFormat = "DOLLAR_STRING"
|
|
31777
31802
|
}) => {
|
|
31778
|
-
const [activeTab, setActiveTab] = (0,
|
|
31779
|
-
const [tagFilter, setTagFilter] = (0,
|
|
31780
|
-
const [pnlTagFilter, setPnlTagFilter] = (0,
|
|
31803
|
+
const [activeTab, setActiveTab] = (0, import_react181.useState)("overview");
|
|
31804
|
+
const [tagFilter, setTagFilter] = (0, import_react181.useState)(null);
|
|
31805
|
+
const [pnlTagFilter, setPnlTagFilter] = (0, import_react181.useState)(
|
|
31781
31806
|
void 0
|
|
31782
31807
|
);
|
|
31783
31808
|
const isOptionSelected = (option, selectValue) => {
|
|
@@ -31876,7 +31901,7 @@ var ProjectProfitabilityView = ({
|
|
|
31876
31901
|
};
|
|
31877
31902
|
|
|
31878
31903
|
// src/views/Reports/Reports.tsx
|
|
31879
|
-
var
|
|
31904
|
+
var import_react182 = require("react");
|
|
31880
31905
|
var import_jsx_runtime292 = require("react/jsx-runtime");
|
|
31881
31906
|
var getOptions = (enabledReports) => {
|
|
31882
31907
|
return [
|
|
@@ -31904,7 +31929,7 @@ var Reports = ({
|
|
|
31904
31929
|
statementOfCashFlowConfig
|
|
31905
31930
|
}) => {
|
|
31906
31931
|
var _a;
|
|
31907
|
-
const [activeTab, setActiveTab] = (0,
|
|
31932
|
+
const [activeTab, setActiveTab] = (0, import_react182.useState)(enabledReports[0]);
|
|
31908
31933
|
const { view, containerRef } = useElementViewSize();
|
|
31909
31934
|
const options = getOptions(enabledReports);
|
|
31910
31935
|
const defaultTitle4 = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
|
|
@@ -31966,11 +31991,11 @@ var ReportsPanel = ({
|
|
|
31966
31991
|
};
|
|
31967
31992
|
|
|
31968
31993
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
31969
|
-
var
|
|
31994
|
+
var import_react183 = require("react");
|
|
31970
31995
|
var import_jsx_runtime293 = require("react/jsx-runtime");
|
|
31971
31996
|
var COMPONENT_NAME8 = "profit-and-loss";
|
|
31972
31997
|
var ProfitAndLossView = (props) => {
|
|
31973
|
-
const containerRef = (0,
|
|
31998
|
+
const containerRef = (0, import_react183.useRef)(null);
|
|
31974
31999
|
return /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(Container, { name: COMPONENT_NAME8, ref: containerRef, children: /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(ProfitAndLoss, { children: /* @__PURE__ */ (0, import_jsx_runtime293.jsx)(ProfitAndLossPanel, __spreadValues({ containerRef }, props)) }) });
|
|
31975
32000
|
};
|
|
31976
32001
|
var ProfitAndLossPanel = (_a) => {
|
|
@@ -31981,7 +32006,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
31981
32006
|
"containerRef",
|
|
31982
32007
|
"stringOverrides"
|
|
31983
32008
|
]);
|
|
31984
|
-
const { sidebarScope } = (0,
|
|
32009
|
+
const { sidebarScope } = (0, import_react183.useContext)(ProfitAndLoss.Context);
|
|
31985
32010
|
return /* @__PURE__ */ (0, import_jsx_runtime293.jsxs)(
|
|
31986
32011
|
Panel,
|
|
31987
32012
|
{
|
|
@@ -32012,7 +32037,7 @@ var Components = ({
|
|
|
32012
32037
|
hideTable = false,
|
|
32013
32038
|
stringOverrides
|
|
32014
32039
|
}) => {
|
|
32015
|
-
const { error, isLoading, isValidating, refetch } = (0,
|
|
32040
|
+
const { error, isLoading, isValidating, refetch } = (0, import_react183.useContext)(
|
|
32016
32041
|
ProfitAndLoss.Context
|
|
32017
32042
|
);
|
|
32018
32043
|
if (!isLoading && error) {
|