@layerfi/components 0.1.99-alpha.3 → 0.1.100
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 +908 -824
- package/dist/esm/index.mjs +739 -654
- package/dist/index.css +4 -3
- package/dist/index.d.ts +68 -60
- package/package.json +1 -1
package/dist/esm/index.mjs
CHANGED
|
@@ -5570,7 +5570,7 @@ import { useState as useState8 } from "react";
|
|
|
5570
5570
|
import { useReducer, useEffect as useEffect4 } from "react";
|
|
5571
5571
|
|
|
5572
5572
|
// package.json
|
|
5573
|
-
var version = "0.1.
|
|
5573
|
+
var version = "0.1.100";
|
|
5574
5574
|
|
|
5575
5575
|
// src/models/APIError.ts
|
|
5576
5576
|
var APIError = class _APIError extends Error {
|
|
@@ -5977,9 +5977,6 @@ var profitAndLossComparisonCsv = post(
|
|
|
5977
5977
|
|
|
5978
5978
|
// src/api/layer/quickbooks.ts
|
|
5979
5979
|
var syncFromQuickbooks = post(({ businessId }) => `/v1/businesses/${businessId}/quickbooks/sync-from`);
|
|
5980
|
-
var statusOfSyncFromQuickbooks = get(
|
|
5981
|
-
({ businessId }) => `/v1/businesses/${businessId}/quickbooks/sync-from/status`
|
|
5982
|
-
);
|
|
5983
5980
|
var initQuickbooksOAuth = post(({ businessId }) => `/v1/businesses/${businessId}/quickbooks/authorize`);
|
|
5984
5981
|
var unlinkQuickbooksConnection = post(({ businessId }) => `/v1/businesses/${businessId}/quickbooks/unlink`);
|
|
5985
5982
|
var statusOfQuickbooksConnection = get(
|
|
@@ -6053,7 +6050,6 @@ var Layer = {
|
|
|
6053
6050
|
updateOpeningBalance,
|
|
6054
6051
|
getStatementOfCashFlow,
|
|
6055
6052
|
syncFromQuickbooks,
|
|
6056
|
-
statusOfSyncFromQuickbooks,
|
|
6057
6053
|
statusOfQuickbooksConnection,
|
|
6058
6054
|
initQuickbooksOAuth,
|
|
6059
6055
|
unlinkQuickbooksConnection,
|
|
@@ -7442,9 +7438,53 @@ function withSWRKeyTags(key, predicate) {
|
|
|
7442
7438
|
return isStringArray(key.tags) ? predicate(key.tags) : false;
|
|
7443
7439
|
}
|
|
7444
7440
|
|
|
7441
|
+
// src/hooks/bookkeeping/useBankAccounts.ts
|
|
7442
|
+
import useSWR3 from "swr";
|
|
7443
|
+
var BANK_ACCOUNTS_TAG_KEY = "#bank-accounts";
|
|
7444
|
+
var getBankAccounts = get(
|
|
7445
|
+
({ businessId }) => `/v1/businesses/${businessId}/bank-accounts`
|
|
7446
|
+
);
|
|
7447
|
+
function buildKey3({
|
|
7448
|
+
access_token: accessToken,
|
|
7449
|
+
apiUrl,
|
|
7450
|
+
businessId
|
|
7451
|
+
}) {
|
|
7452
|
+
if (accessToken && apiUrl) {
|
|
7453
|
+
return {
|
|
7454
|
+
accessToken,
|
|
7455
|
+
apiUrl,
|
|
7456
|
+
businessId,
|
|
7457
|
+
tags: [BANK_ACCOUNTS_TAG_KEY]
|
|
7458
|
+
};
|
|
7459
|
+
}
|
|
7460
|
+
}
|
|
7461
|
+
var requiresNotification = (bankAccount) => bankAccount.is_disconnected && bankAccount.notify_when_disconnected;
|
|
7462
|
+
var useBankAccounts = () => {
|
|
7463
|
+
var _a, _b;
|
|
7464
|
+
const { businessId } = useLayerContext();
|
|
7465
|
+
const { apiUrl } = useEnvironment();
|
|
7466
|
+
const { data: auth } = useAuth();
|
|
7467
|
+
const { data, error, isLoading } = useSWR3(
|
|
7468
|
+
() => buildKey3(__spreadProps(__spreadValues({}, auth), {
|
|
7469
|
+
apiUrl,
|
|
7470
|
+
businessId
|
|
7471
|
+
})),
|
|
7472
|
+
({ accessToken, apiUrl: apiUrl2, businessId: businessId2 }) => getBankAccounts(apiUrl2, accessToken, { params: { businessId: businessId2 } })()
|
|
7473
|
+
);
|
|
7474
|
+
const disconnectedAccountsRequiringNotification = ((_a = data == null ? void 0 : data.data) != null ? _a : []).filter(
|
|
7475
|
+
(account) => requiresNotification(account)
|
|
7476
|
+
).length;
|
|
7477
|
+
return {
|
|
7478
|
+
bankAccounts: (_b = data == null ? void 0 : data.data) != null ? _b : [],
|
|
7479
|
+
isLoading,
|
|
7480
|
+
error,
|
|
7481
|
+
disconnectedAccountsRequiringNotification
|
|
7482
|
+
};
|
|
7483
|
+
};
|
|
7484
|
+
|
|
7445
7485
|
// src/hooks/useBankTransactions/useCategorizeBankTransaction.ts
|
|
7446
7486
|
var CATEGORIZE_BANK_TRANSACTION_TAG = "#categorize-bank-transaction";
|
|
7447
|
-
function
|
|
7487
|
+
function buildKey4({
|
|
7448
7488
|
access_token: accessToken,
|
|
7449
7489
|
apiUrl,
|
|
7450
7490
|
businessId
|
|
@@ -7465,7 +7505,7 @@ function useCategorizeBankTransaction({
|
|
|
7465
7505
|
const { businessId } = useLayerContext();
|
|
7466
7506
|
const { mutate } = useSWRConfig();
|
|
7467
7507
|
const mutationResponse = useSWRMutation(
|
|
7468
|
-
() =>
|
|
7508
|
+
() => buildKey4({
|
|
7469
7509
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
7470
7510
|
apiUrl: auth == null ? void 0 : auth.apiUrl,
|
|
7471
7511
|
businessId
|
|
@@ -7494,7 +7534,7 @@ function useCategorizeBankTransaction({
|
|
|
7494
7534
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
7495
7535
|
void mutate((key) => withSWRKeyTags(
|
|
7496
7536
|
key,
|
|
7497
|
-
(tags) => tags.includes(
|
|
7537
|
+
(tags) => tags.includes(BANK_ACCOUNTS_TAG_KEY) || tags.includes(EXTERNAL_ACCOUNTS_TAG_KEY)
|
|
7498
7538
|
));
|
|
7499
7539
|
void mutateBankTransactions(void 0, { revalidate: true });
|
|
7500
7540
|
return triggerResult;
|
|
@@ -7519,52 +7559,6 @@ function useCategorizeBankTransaction({
|
|
|
7519
7559
|
import { useCallback as useCallback2 } from "react";
|
|
7520
7560
|
import { useSWRConfig as useSWRConfig2 } from "swr";
|
|
7521
7561
|
import useSWRMutation2 from "swr/mutation";
|
|
7522
|
-
|
|
7523
|
-
// src/hooks/bookkeeping/useBankAccounts.ts
|
|
7524
|
-
import useSWR3 from "swr";
|
|
7525
|
-
var BANK_ACCOUNTS_TAG_KEY = "#bank-accounts";
|
|
7526
|
-
var getBankAccounts = get(
|
|
7527
|
-
({ businessId }) => `/v1/businesses/${businessId}/bank-accounts`
|
|
7528
|
-
);
|
|
7529
|
-
function buildKey4({
|
|
7530
|
-
access_token: accessToken,
|
|
7531
|
-
apiUrl,
|
|
7532
|
-
businessId
|
|
7533
|
-
}) {
|
|
7534
|
-
if (accessToken && apiUrl) {
|
|
7535
|
-
return {
|
|
7536
|
-
accessToken,
|
|
7537
|
-
apiUrl,
|
|
7538
|
-
businessId,
|
|
7539
|
-
tags: [BANK_ACCOUNTS_TAG_KEY]
|
|
7540
|
-
};
|
|
7541
|
-
}
|
|
7542
|
-
}
|
|
7543
|
-
var requiresNotification = (bankAccount) => bankAccount.is_disconnected && bankAccount.notify_when_disconnected;
|
|
7544
|
-
var useBankAccounts = () => {
|
|
7545
|
-
var _a, _b;
|
|
7546
|
-
const { businessId } = useLayerContext();
|
|
7547
|
-
const { apiUrl } = useEnvironment();
|
|
7548
|
-
const { data: auth } = useAuth();
|
|
7549
|
-
const { data, error, isLoading } = useSWR3(
|
|
7550
|
-
() => buildKey4(__spreadProps(__spreadValues({}, auth), {
|
|
7551
|
-
apiUrl,
|
|
7552
|
-
businessId
|
|
7553
|
-
})),
|
|
7554
|
-
({ accessToken, apiUrl: apiUrl2, businessId: businessId2 }) => getBankAccounts(apiUrl2, accessToken, { params: { businessId: businessId2 } })()
|
|
7555
|
-
);
|
|
7556
|
-
const disconnectedAccountsRequiringNotification = ((_a = data == null ? void 0 : data.data) != null ? _a : []).filter(
|
|
7557
|
-
(account) => requiresNotification(account)
|
|
7558
|
-
).length;
|
|
7559
|
-
return {
|
|
7560
|
-
bankAccounts: (_b = data == null ? void 0 : data.data) != null ? _b : [],
|
|
7561
|
-
isLoading,
|
|
7562
|
-
error,
|
|
7563
|
-
disconnectedAccountsRequiringNotification
|
|
7564
|
-
};
|
|
7565
|
-
};
|
|
7566
|
-
|
|
7567
|
-
// src/hooks/useBankTransactions/useMatchBankTransaction.ts
|
|
7568
7562
|
var MATCH_BANK_TRANSACTION_TAG = "#match-bank-transaction";
|
|
7569
7563
|
function buildKey5({
|
|
7570
7564
|
access_token: accessToken,
|
|
@@ -14689,17 +14683,22 @@ function LegacyModeProvider({
|
|
|
14689
14683
|
}
|
|
14690
14684
|
|
|
14691
14685
|
// src/hooks/bookkeeping/useBookkeepingStatus.ts
|
|
14692
|
-
var
|
|
14693
|
-
"NOT_PURCHASED"
|
|
14694
|
-
"ACTIVE"
|
|
14695
|
-
"ONBOARDING"
|
|
14696
|
-
"BOOKKEEPING_PAUSED"
|
|
14697
|
-
|
|
14686
|
+
var BookkeepingStatus = /* @__PURE__ */ ((BookkeepingStatus3) => {
|
|
14687
|
+
BookkeepingStatus3["NOT_PURCHASED"] = "NOT_PURCHASED";
|
|
14688
|
+
BookkeepingStatus3["ACTIVE"] = "ACTIVE";
|
|
14689
|
+
BookkeepingStatus3["ONBOARDING"] = "ONBOARDING";
|
|
14690
|
+
BookkeepingStatus3["BOOKKEEPING_PAUSED"] = "BOOKKEEPING_PAUSED";
|
|
14691
|
+
return BookkeepingStatus3;
|
|
14692
|
+
})(BookkeepingStatus || {});
|
|
14693
|
+
var BOOKKEEPING_STATUSES = Object.values(BookkeepingStatus);
|
|
14694
|
+
function isBookkeepingStatus(status) {
|
|
14695
|
+
return BOOKKEEPING_STATUSES.includes(status);
|
|
14696
|
+
}
|
|
14698
14697
|
function constrainToKnownBookkeepingStatus(status) {
|
|
14699
|
-
if (
|
|
14698
|
+
if (isBookkeepingStatus(status)) {
|
|
14700
14699
|
return status;
|
|
14701
14700
|
}
|
|
14702
|
-
return "NOT_PURCHASED"
|
|
14701
|
+
return "NOT_PURCHASED" /* NOT_PURCHASED */;
|
|
14703
14702
|
}
|
|
14704
14703
|
var getBookkeepingStatus = get(({ businessId }) => {
|
|
14705
14704
|
return `/v1/businesses/${businessId}/bookkeeping/status`;
|
|
@@ -14741,26 +14740,29 @@ function useEffectiveBookkeepingStatus() {
|
|
|
14741
14740
|
const { overrideMode } = useLegacyMode();
|
|
14742
14741
|
const { data } = useBookkeepingStatus();
|
|
14743
14742
|
if (overrideMode === "bookkeeping-client") {
|
|
14744
|
-
return "ACTIVE"
|
|
14743
|
+
return "ACTIVE" /* ACTIVE */;
|
|
14745
14744
|
}
|
|
14746
|
-
return (_a = data == null ? void 0 : data.status) != null ? _a : "NOT_PURCHASED"
|
|
14745
|
+
return (_a = data == null ? void 0 : data.status) != null ? _a : "NOT_PURCHASED" /* NOT_PURCHASED */;
|
|
14747
14746
|
}
|
|
14748
14747
|
|
|
14749
14748
|
// src/utils/bookkeeping/isCategorizationEnabled.ts
|
|
14750
14749
|
function isCategorizationEnabledForStatus(status) {
|
|
14751
14750
|
switch (status) {
|
|
14752
|
-
case "NOT_PURCHASED"
|
|
14753
|
-
case "ONBOARDING"
|
|
14754
|
-
case "BOOKKEEPING_PAUSED"
|
|
14751
|
+
case "NOT_PURCHASED" /* NOT_PURCHASED */:
|
|
14752
|
+
case "ONBOARDING" /* ONBOARDING */:
|
|
14753
|
+
case "BOOKKEEPING_PAUSED" /* BOOKKEEPING_PAUSED */: {
|
|
14755
14754
|
return true;
|
|
14756
|
-
|
|
14755
|
+
}
|
|
14756
|
+
case "ACTIVE" /* ACTIVE */: {
|
|
14757
14757
|
return false;
|
|
14758
|
-
|
|
14758
|
+
}
|
|
14759
|
+
default: {
|
|
14759
14760
|
return safeAssertUnreachable({
|
|
14760
14761
|
value: status,
|
|
14761
14762
|
message: "Unexpected bookkeeping status in `isCategorizationEnabledForStatus`",
|
|
14762
14763
|
fallbackValue: true
|
|
14763
14764
|
});
|
|
14765
|
+
}
|
|
14764
14766
|
}
|
|
14765
14767
|
}
|
|
14766
14768
|
|
|
@@ -15924,6 +15926,116 @@ var SplitTooltipDetails = ({
|
|
|
15924
15926
|
import classNames41 from "classnames";
|
|
15925
15927
|
import { parseISO as parseISO9, format as formatTime6 } from "date-fns";
|
|
15926
15928
|
|
|
15929
|
+
// src/hooks/bookkeeping/periods/useBookkeepingPeriods.ts
|
|
15930
|
+
import useSWR8 from "swr";
|
|
15931
|
+
|
|
15932
|
+
// src/utils/bookkeeping/bookkeepingStatusFilters.ts
|
|
15933
|
+
function isActiveBookkeepingStatus(status) {
|
|
15934
|
+
return status === "ACTIVE" /* ACTIVE */ || status === "ONBOARDING" /* ONBOARDING */;
|
|
15935
|
+
}
|
|
15936
|
+
function isActiveOrPausedBookkeepingStatus(status) {
|
|
15937
|
+
return isActiveBookkeepingStatus(status) || status === "BOOKKEEPING_PAUSED" /* BOOKKEEPING_PAUSED */;
|
|
15938
|
+
}
|
|
15939
|
+
|
|
15940
|
+
// src/utils/bookkeeping/tasks/bookkeepingTasksFilters.ts
|
|
15941
|
+
function isIncompleteTask(task) {
|
|
15942
|
+
const { status } = task;
|
|
15943
|
+
return status === "TODO";
|
|
15944
|
+
}
|
|
15945
|
+
function getIncompleteTasks(tasks) {
|
|
15946
|
+
return tasks.filter((task) => isIncompleteTask(task));
|
|
15947
|
+
}
|
|
15948
|
+
function isUserVisibleTask(task) {
|
|
15949
|
+
const { status } = task;
|
|
15950
|
+
return status !== "COMPLETED" && status !== "ARCHIVED";
|
|
15951
|
+
}
|
|
15952
|
+
function getUserVisibleTasks(tasks) {
|
|
15953
|
+
return tasks.filter((task) => isUserVisibleTask(task));
|
|
15954
|
+
}
|
|
15955
|
+
function isCompletedTask(task) {
|
|
15956
|
+
const { status } = task;
|
|
15957
|
+
return status === "USER_MARKED_COMPLETED" || status === "COMPLETED" || status === "ARCHIVED";
|
|
15958
|
+
}
|
|
15959
|
+
function getCompletedTasks(tasks) {
|
|
15960
|
+
return tasks.filter((task) => isCompletedTask(task));
|
|
15961
|
+
}
|
|
15962
|
+
|
|
15963
|
+
// src/utils/bookkeeping/periods/getFilteredBookkeepingPeriods.ts
|
|
15964
|
+
function isActiveBookkeepingPeriod(period) {
|
|
15965
|
+
return period.status !== "BOOKKEEPING_NOT_ACTIVE" /* BOOKKEEPING_NOT_ACTIVE */;
|
|
15966
|
+
}
|
|
15967
|
+
|
|
15968
|
+
// src/hooks/bookkeeping/periods/useBookkeepingPeriods.ts
|
|
15969
|
+
var BookkeepingPeriodStatus = /* @__PURE__ */ ((BookkeepingPeriodStatus2) => {
|
|
15970
|
+
BookkeepingPeriodStatus2["BOOKKEEPING_NOT_ACTIVE"] = "BOOKKEEPING_NOT_ACTIVE";
|
|
15971
|
+
BookkeepingPeriodStatus2["NOT_STARTED"] = "NOT_STARTED";
|
|
15972
|
+
BookkeepingPeriodStatus2["IN_PROGRESS_AWAITING_BOOKKEEPER"] = "IN_PROGRESS_AWAITING_BOOKKEEPER";
|
|
15973
|
+
BookkeepingPeriodStatus2["IN_PROGRESS_AWAITING_CUSTOMER"] = "IN_PROGRESS_AWAITING_CUSTOMER";
|
|
15974
|
+
BookkeepingPeriodStatus2["CLOSING_IN_REVIEW"] = "CLOSING_IN_REVIEW";
|
|
15975
|
+
BookkeepingPeriodStatus2["CLOSED_OPEN_TASKS"] = "CLOSED_OPEN_TASKS";
|
|
15976
|
+
BookkeepingPeriodStatus2["CLOSED_COMPLETE"] = "CLOSED_COMPLETE";
|
|
15977
|
+
return BookkeepingPeriodStatus2;
|
|
15978
|
+
})(BookkeepingPeriodStatus || {});
|
|
15979
|
+
var BOOKKEEPING_PERIOD_STATUSES = Object.values(BookkeepingPeriodStatus);
|
|
15980
|
+
function isBookkeepingPeriodStatus(status) {
|
|
15981
|
+
return BOOKKEEPING_PERIOD_STATUSES.includes(status);
|
|
15982
|
+
}
|
|
15983
|
+
function constrainToKnownBookkeepingPeriodStatus(status) {
|
|
15984
|
+
if (isBookkeepingPeriodStatus(status)) {
|
|
15985
|
+
return status;
|
|
15986
|
+
}
|
|
15987
|
+
return "BOOKKEEPING_NOT_ACTIVE" /* BOOKKEEPING_NOT_ACTIVE */;
|
|
15988
|
+
}
|
|
15989
|
+
var getBookkeepingPeriods = get(({ businessId }) => {
|
|
15990
|
+
return `/v1/businesses/${businessId}/bookkeeping/periods`;
|
|
15991
|
+
});
|
|
15992
|
+
var BOOKKEEPING_PERIODS_TAG_KEY = "#bookkeeping-periods";
|
|
15993
|
+
function buildKey12({
|
|
15994
|
+
access_token: accessToken,
|
|
15995
|
+
apiUrl,
|
|
15996
|
+
businessId,
|
|
15997
|
+
isActiveOrPaused
|
|
15998
|
+
}) {
|
|
15999
|
+
if (accessToken && apiUrl && isActiveOrPaused) {
|
|
16000
|
+
return {
|
|
16001
|
+
accessToken,
|
|
16002
|
+
apiUrl,
|
|
16003
|
+
businessId,
|
|
16004
|
+
tags: [BOOKKEEPING_TAG_KEY, BOOKKEEPING_PERIODS_TAG_KEY]
|
|
16005
|
+
};
|
|
16006
|
+
}
|
|
16007
|
+
}
|
|
16008
|
+
function useBookkeepingPeriods() {
|
|
16009
|
+
const { data: auth } = useAuth();
|
|
16010
|
+
const { businessId } = useLayerContext();
|
|
16011
|
+
const { data, isLoading: isLoadingBookkeepingStatus } = useBookkeepingStatus();
|
|
16012
|
+
const isActiveOrPaused = data ? isActiveOrPausedBookkeepingStatus(data.status) : false;
|
|
16013
|
+
const swrResponse = useSWR8(
|
|
16014
|
+
() => buildKey12(__spreadProps(__spreadValues({}, auth), {
|
|
16015
|
+
businessId,
|
|
16016
|
+
isActiveOrPaused
|
|
16017
|
+
})),
|
|
16018
|
+
({ accessToken, apiUrl, businessId: businessId2 }) => getBookkeepingPeriods(
|
|
16019
|
+
apiUrl,
|
|
16020
|
+
accessToken,
|
|
16021
|
+
{ params: { businessId: businessId2 } }
|
|
16022
|
+
)().then(
|
|
16023
|
+
({ data: { periods } }) => periods.map((period) => __spreadProps(__spreadValues({}, period), {
|
|
16024
|
+
status: constrainToKnownBookkeepingPeriodStatus(period.status),
|
|
16025
|
+
tasks: getUserVisibleTasks(period.tasks)
|
|
16026
|
+
})).filter((period) => isActiveBookkeepingPeriod(period))
|
|
16027
|
+
)
|
|
16028
|
+
);
|
|
16029
|
+
return new Proxy(swrResponse, {
|
|
16030
|
+
get(target, prop) {
|
|
16031
|
+
if (prop === "isLoading") {
|
|
16032
|
+
return isLoadingBookkeepingStatus || swrResponse.isLoading;
|
|
16033
|
+
}
|
|
16034
|
+
return Reflect.get(target, prop);
|
|
16035
|
+
}
|
|
16036
|
+
});
|
|
16037
|
+
}
|
|
16038
|
+
|
|
15927
16039
|
// src/utils/date.ts
|
|
15928
16040
|
var monthNames = [
|
|
15929
16041
|
"January",
|
|
@@ -15988,9 +16100,9 @@ function getBookkeepingStatusConfig({
|
|
|
15988
16100
|
const monthName = monthNumber !== void 0 ? getMonthNameFromNumber(monthNumber) : "";
|
|
15989
16101
|
const actionPhrase = incompleteTasksCount !== void 0 && incompleteTasksCount > 0 ? `Please complete the ${pluralize("open task", incompleteTasksCount, true)}.` : "No action is needed from you right now.";
|
|
15990
16102
|
switch (status) {
|
|
15991
|
-
case "IN_PROGRESS_AWAITING_BOOKKEEPER"
|
|
15992
|
-
case "NOT_STARTED"
|
|
15993
|
-
case "CLOSING_IN_REVIEW"
|
|
16103
|
+
case "IN_PROGRESS_AWAITING_BOOKKEEPER" /* IN_PROGRESS_AWAITING_BOOKKEEPER */:
|
|
16104
|
+
case "NOT_STARTED" /* NOT_STARTED */:
|
|
16105
|
+
case "CLOSING_IN_REVIEW" /* CLOSING_IN_REVIEW */: {
|
|
15994
16106
|
return {
|
|
15995
16107
|
label: "Books in progress",
|
|
15996
16108
|
description: `We're working on your ${monthName} books. ${actionPhrase}`,
|
|
@@ -15998,8 +16110,8 @@ function getBookkeepingStatusConfig({
|
|
|
15998
16110
|
icon: /* @__PURE__ */ jsx121(Clock_default, { size: 12 })
|
|
15999
16111
|
};
|
|
16000
16112
|
}
|
|
16001
|
-
case "IN_PROGRESS_AWAITING_CUSTOMER"
|
|
16002
|
-
case "CLOSED_OPEN_TASKS"
|
|
16113
|
+
case "IN_PROGRESS_AWAITING_CUSTOMER" /* IN_PROGRESS_AWAITING_CUSTOMER */:
|
|
16114
|
+
case "CLOSED_OPEN_TASKS" /* CLOSED_OPEN_TASKS */: {
|
|
16003
16115
|
return {
|
|
16004
16116
|
label: "Action required",
|
|
16005
16117
|
description: `Please respond to the below tasks to help us complete your ${monthName} books.`,
|
|
@@ -16007,7 +16119,7 @@ function getBookkeepingStatusConfig({
|
|
|
16007
16119
|
icon: /* @__PURE__ */ jsx121(AlertCircle_default, { size: 12 })
|
|
16008
16120
|
};
|
|
16009
16121
|
}
|
|
16010
|
-
case "CLOSED_COMPLETE"
|
|
16122
|
+
case "CLOSED_COMPLETE" /* CLOSED_COMPLETE */: {
|
|
16011
16123
|
return {
|
|
16012
16124
|
label: "Books completed",
|
|
16013
16125
|
description: `Your ${monthName} books are complete and ready to view!`,
|
|
@@ -16015,7 +16127,7 @@ function getBookkeepingStatusConfig({
|
|
|
16015
16127
|
icon: /* @__PURE__ */ jsx121(CheckCircle_default, { size: 12 })
|
|
16016
16128
|
};
|
|
16017
16129
|
}
|
|
16018
|
-
case "BOOKKEEPING_NOT_ACTIVE"
|
|
16130
|
+
case "BOOKKEEPING_NOT_ACTIVE" /* BOOKKEEPING_NOT_ACTIVE */: {
|
|
16019
16131
|
return;
|
|
16020
16132
|
}
|
|
16021
16133
|
default: {
|
|
@@ -16030,7 +16142,7 @@ function getBookkeepingStatusConfig({
|
|
|
16030
16142
|
|
|
16031
16143
|
// src/components/BookkeepingStatus/BookkeepingStatus.tsx
|
|
16032
16144
|
import { jsx as jsx122, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
16033
|
-
var
|
|
16145
|
+
var BookkeepingStatus2 = ({ status, text, monthNumber, iconOnly }) => {
|
|
16034
16146
|
if (!status) {
|
|
16035
16147
|
return;
|
|
16036
16148
|
}
|
|
@@ -16055,7 +16167,7 @@ var BookkeepingStatus = ({ status, text, monthNumber, iconOnly }) => {
|
|
|
16055
16167
|
// src/components/BankTransactionList/BankTransactionProcessingInfo.tsx
|
|
16056
16168
|
import { jsx as jsx123, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
16057
16169
|
var BankTransactionProcessingInfo = () => /* @__PURE__ */ jsxs77(Tooltip, { offset: 12, children: [
|
|
16058
|
-
/* @__PURE__ */ jsx123(TooltipTrigger, { children: /* @__PURE__ */ jsx123(
|
|
16170
|
+
/* @__PURE__ */ jsx123(TooltipTrigger, { children: /* @__PURE__ */ jsx123(BookkeepingStatus2, { status: "IN_PROGRESS_AWAITING_BOOKKEEPER" /* IN_PROGRESS_AWAITING_BOOKKEEPER */, text: "Processing" }) }),
|
|
16059
16171
|
/* @__PURE__ */ jsx123(TooltipContent, { className: "Layer__tooltip", width: "md", children: "Our team will review and categorize this transaction. We'll reach out if we have any questions about it." })
|
|
16060
16172
|
] });
|
|
16061
16173
|
|
|
@@ -18160,7 +18272,7 @@ function TransactionsActions({ children }) {
|
|
|
18160
18272
|
|
|
18161
18273
|
// src/hooks/useBankTransactions/useBankTransactionsDownload.ts
|
|
18162
18274
|
import useSWRMutation6 from "swr/mutation";
|
|
18163
|
-
function
|
|
18275
|
+
function buildKey13({
|
|
18164
18276
|
access_token: accessToken,
|
|
18165
18277
|
apiUrl,
|
|
18166
18278
|
businessId
|
|
@@ -18178,7 +18290,7 @@ function useBankTransactionsDownload() {
|
|
|
18178
18290
|
const { data } = useAuth();
|
|
18179
18291
|
const { businessId } = useLayerContext();
|
|
18180
18292
|
return useSWRMutation6(
|
|
18181
|
-
() =>
|
|
18293
|
+
() => buildKey13(__spreadProps(__spreadValues({}, data), {
|
|
18182
18294
|
businessId
|
|
18183
18295
|
})),
|
|
18184
18296
|
({
|
|
@@ -18565,7 +18677,7 @@ var BankTransactionsContent = ({
|
|
|
18565
18677
|
}, [monthlyView, isVisible, isLoading, hasMore]);
|
|
18566
18678
|
useEffect23(() => {
|
|
18567
18679
|
if (JSON.stringify(inputFilters) !== JSON.stringify(filters)) {
|
|
18568
|
-
if (effectiveBookkeepingStatus === "ACTIVE") {
|
|
18680
|
+
if (effectiveBookkeepingStatus === "ACTIVE" /* ACTIVE */) {
|
|
18569
18681
|
setFilters(__spreadProps(__spreadValues(__spreadValues({}, filters), inputFilters), {
|
|
18570
18682
|
categorizationStatus: "all" /* all */
|
|
18571
18683
|
}));
|
|
@@ -18736,13 +18848,13 @@ var BankTransactionsContent = ({
|
|
|
18736
18848
|
};
|
|
18737
18849
|
|
|
18738
18850
|
// src/components/Integrations/Integrations.tsx
|
|
18739
|
-
import { useContext as
|
|
18851
|
+
import { useContext as useContext26 } from "react";
|
|
18740
18852
|
|
|
18741
18853
|
// src/components/Integrations/IntegrationsContent.tsx
|
|
18742
|
-
import { useContext as
|
|
18854
|
+
import { useContext as useContext24 } from "react";
|
|
18743
18855
|
|
|
18744
18856
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumb.tsx
|
|
18745
|
-
import { useContext as
|
|
18857
|
+
import { useCallback as useCallback10, useContext as useContext23, useMemo as useMemo20, useState as useState37 } from "react";
|
|
18746
18858
|
|
|
18747
18859
|
// src/icons/QuickbooksIcon.tsx
|
|
18748
18860
|
import { jsx as jsx153, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
@@ -18831,214 +18943,326 @@ var Card = ({ children, className }) => {
|
|
|
18831
18943
|
import { createContext as createContext13 } from "react";
|
|
18832
18944
|
var QuickbooksContext = createContext13({
|
|
18833
18945
|
linkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
|
|
18834
|
-
unlinkQuickbooks: () =>
|
|
18835
|
-
throw new Error("QuickbooksContext used without Provider");
|
|
18836
|
-
},
|
|
18946
|
+
unlinkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
|
|
18837
18947
|
syncFromQuickbooks: () => {
|
|
18838
18948
|
throw new Error("QuickbooksContext used without Provider");
|
|
18839
18949
|
},
|
|
18840
|
-
|
|
18841
|
-
quickbooksIsConnected: false,
|
|
18842
|
-
quickbooksLastSyncedAt: void 0
|
|
18950
|
+
quickbooksConnectionStatus: void 0
|
|
18843
18951
|
});
|
|
18844
18952
|
|
|
18845
18953
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumbFooter.tsx
|
|
18846
18954
|
import { useContext as useContext21 } from "react";
|
|
18847
18955
|
import { format, isValid } from "date-fns";
|
|
18956
|
+
|
|
18957
|
+
// src/components/Integrations/IntegrationsQuickbooksItemThumb/utils.ts
|
|
18958
|
+
var getQuickbooksConnectionSyncUiState = (quickbooksConnectionStatus) => {
|
|
18959
|
+
var _a;
|
|
18960
|
+
const isSyncing = (_a = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_syncing) != null ? _a : false;
|
|
18961
|
+
const lastSyncedAt = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.last_synced_at;
|
|
18962
|
+
const syncFailed = (quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.last_sync_status) === "SYNC_FAILURE" /* SYNC_FAILURE */;
|
|
18963
|
+
if (isSyncing) {
|
|
18964
|
+
return "Syncing" /* Syncing */;
|
|
18965
|
+
}
|
|
18966
|
+
if (lastSyncedAt) {
|
|
18967
|
+
return syncFailed ? "SyncFailed" /* SyncFailed */ : "SyncSuccess" /* SyncSuccess */;
|
|
18968
|
+
}
|
|
18969
|
+
return "Connected" /* Connected */;
|
|
18970
|
+
};
|
|
18971
|
+
|
|
18972
|
+
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumbFooter.tsx
|
|
18848
18973
|
import { jsx as jsx157, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
18849
18974
|
var formatLastSyncedAt = (datetime) => {
|
|
18850
18975
|
const parsed = new Date(datetime);
|
|
18851
18976
|
if (!isValid(parsed)) return "";
|
|
18852
18977
|
return `${format(parsed, "MMMM d, yyyy")} at ${format(parsed, "h:mm a")}`;
|
|
18853
18978
|
};
|
|
18854
|
-
var
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
|
|
18859
|
-
|
|
18860
|
-
|
|
18861
|
-
|
|
18862
|
-
|
|
18863
|
-
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
|
|
18874
|
-
|
|
18875
|
-
|
|
18876
|
-
|
|
18877
|
-
|
|
18979
|
+
var getFooterConfig = (quickbooksUiState, lastSyncedAt) => {
|
|
18980
|
+
switch (quickbooksUiState) {
|
|
18981
|
+
case "Syncing" /* Syncing */: {
|
|
18982
|
+
return {
|
|
18983
|
+
title: "Syncing account data",
|
|
18984
|
+
description: "This may take up to 5 minutes",
|
|
18985
|
+
badgeVariant: "info"
|
|
18986
|
+
};
|
|
18987
|
+
}
|
|
18988
|
+
case "SyncFailed" /* SyncFailed */: {
|
|
18989
|
+
return {
|
|
18990
|
+
title: "Last sync failed at",
|
|
18991
|
+
description: formatLastSyncedAt(lastSyncedAt),
|
|
18992
|
+
badgeVariant: "error"
|
|
18993
|
+
};
|
|
18994
|
+
}
|
|
18995
|
+
case "SyncSuccess" /* SyncSuccess */: {
|
|
18996
|
+
return {
|
|
18997
|
+
title: "Last synced on",
|
|
18998
|
+
description: formatLastSyncedAt(lastSyncedAt),
|
|
18999
|
+
badgeVariant: "success"
|
|
19000
|
+
};
|
|
19001
|
+
}
|
|
19002
|
+
case "Connected" /* Connected */:
|
|
19003
|
+
default: {
|
|
19004
|
+
return {
|
|
19005
|
+
title: "Connected to QuickBooks",
|
|
19006
|
+
badgeVariant: "success"
|
|
19007
|
+
};
|
|
19008
|
+
}
|
|
18878
19009
|
}
|
|
19010
|
+
};
|
|
19011
|
+
var IntegrationsQuickbooksItemThumbFooter = ({ quickbooksUiState }) => {
|
|
19012
|
+
const { quickbooksConnectionStatus } = useContext21(QuickbooksContext);
|
|
19013
|
+
if (!quickbooksConnectionStatus) return null;
|
|
19014
|
+
const { title, description, badgeVariant } = getFooterConfig(quickbooksUiState, quickbooksConnectionStatus.last_synced_at);
|
|
18879
19015
|
return /* @__PURE__ */ jsxs99(HStack, { className: "loadingbar", children: [
|
|
18880
19016
|
/* @__PURE__ */ jsxs99(VStack, { children: [
|
|
18881
|
-
/* @__PURE__ */ jsx157(Text, { size: "sm" /* sm */, children:
|
|
18882
|
-
/* @__PURE__ */ jsx157(Text, { size: "sm" /* sm */, className: "syncing-data-description", children:
|
|
19017
|
+
/* @__PURE__ */ jsx157(Text, { size: "sm" /* sm */, children: title }),
|
|
19018
|
+
description && /* @__PURE__ */ jsx157(Text, { size: "sm" /* sm */, className: "syncing-data-description", children: description })
|
|
18883
19019
|
] }),
|
|
18884
19020
|
/* @__PURE__ */ jsx157(Spacer, {}),
|
|
18885
|
-
/* @__PURE__ */ jsx157(BadgeLoader, { variant:
|
|
19021
|
+
/* @__PURE__ */ jsx157(BadgeLoader, { variant: badgeVariant })
|
|
18886
19022
|
] });
|
|
18887
19023
|
};
|
|
18888
19024
|
|
|
18889
19025
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumb.tsx
|
|
18890
|
-
import {
|
|
19026
|
+
import { AlertCircle as AlertCircle2, CheckIcon } from "lucide-react";
|
|
19027
|
+
|
|
19028
|
+
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksUnlinkConfirmationModal.tsx
|
|
19029
|
+
import { useCallback as useCallback9, useContext as useContext22, useState as useState36 } from "react";
|
|
19030
|
+
import { Fragment as Fragment20, jsx as jsx158, jsxs as jsxs100 } from "react/jsx-runtime";
|
|
19031
|
+
function IntegrationsQuickbooksUnlinkConfirmationModalContent({ onClose }) {
|
|
19032
|
+
const { unlinkQuickbooks } = useContext22(QuickbooksContext);
|
|
19033
|
+
const [isProcessing, setIsProcessing] = useState36(false);
|
|
19034
|
+
const [hasFailed, setHasFailed] = useState36(false);
|
|
19035
|
+
const unlinkErrorText = "Unlink failed. Check connection and retry in few seconds.";
|
|
19036
|
+
const onClickUnlinkQuickbooks = useCallback9(() => {
|
|
19037
|
+
setIsProcessing(true);
|
|
19038
|
+
unlinkQuickbooks().then(() => {
|
|
19039
|
+
onClose();
|
|
19040
|
+
}).catch(() => {
|
|
19041
|
+
setHasFailed(true);
|
|
19042
|
+
setIsProcessing(false);
|
|
19043
|
+
});
|
|
19044
|
+
}, [unlinkQuickbooks, onClose]);
|
|
19045
|
+
return /* @__PURE__ */ jsxs100(Fragment20, { children: [
|
|
19046
|
+
/* @__PURE__ */ jsx158(ModalContextBar, { onClose }),
|
|
19047
|
+
/* @__PURE__ */ jsx158(ModalHeading, { pbe: "2xs", children: "Unlink QuickBooks" }),
|
|
19048
|
+
/* @__PURE__ */ jsx158(ModalContent, { children: /* @__PURE__ */ jsx158(P, { children: "Please confirm that you want to unlink QuickBooks." }) }),
|
|
19049
|
+
/* @__PURE__ */ jsx158(ModalActions, { children: /* @__PURE__ */ jsxs100(HStack, { gap: "md", children: [
|
|
19050
|
+
/* @__PURE__ */ jsx158(Spacer, {}),
|
|
19051
|
+
/* @__PURE__ */ jsx158(Button, { variant: "secondary" /* secondary */, onClick: onClose, children: "Cancel" }),
|
|
19052
|
+
!hasFailed ? /* @__PURE__ */ jsx158(
|
|
19053
|
+
Button,
|
|
19054
|
+
{
|
|
19055
|
+
variant: "primary" /* primary */,
|
|
19056
|
+
onClick: onClickUnlinkQuickbooks,
|
|
19057
|
+
isProcessing,
|
|
19058
|
+
disabled: isProcessing,
|
|
19059
|
+
children: "Unlink QuickBooks"
|
|
19060
|
+
}
|
|
19061
|
+
) : /* @__PURE__ */ jsx158(
|
|
19062
|
+
RetryButton,
|
|
19063
|
+
{
|
|
19064
|
+
onClick: onClickUnlinkQuickbooks,
|
|
19065
|
+
processing: isProcessing,
|
|
19066
|
+
disabled: isProcessing,
|
|
19067
|
+
error: unlinkErrorText,
|
|
19068
|
+
children: "Retry Unlink QuickBooks"
|
|
19069
|
+
}
|
|
19070
|
+
)
|
|
19071
|
+
] }) })
|
|
19072
|
+
] });
|
|
19073
|
+
}
|
|
19074
|
+
function IntegrationsQuickbooksUnlinkConfirmationModal({ isOpen, onOpenChange }) {
|
|
19075
|
+
return /* @__PURE__ */ jsx158(Modal, { flexBlock: true, isOpen, onOpenChange, children: ({ close: close2 }) => /* @__PURE__ */ jsx158(IntegrationsQuickbooksUnlinkConfirmationModalContent, { onClose: close2 }) });
|
|
19076
|
+
}
|
|
19077
|
+
|
|
19078
|
+
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumb.tsx
|
|
19079
|
+
import { jsx as jsx159, jsxs as jsxs101 } from "react/jsx-runtime";
|
|
19080
|
+
var getBadgeConfig = (quickbooksUiState, hasSynced) => {
|
|
19081
|
+
if (!hasSynced) {
|
|
19082
|
+
return {
|
|
19083
|
+
variant: "info" /* INFO */,
|
|
19084
|
+
text: "Sync",
|
|
19085
|
+
icon: /* @__PURE__ */ jsx159(RefreshCcw_default, { size: 12 })
|
|
19086
|
+
};
|
|
19087
|
+
}
|
|
19088
|
+
switch (quickbooksUiState) {
|
|
19089
|
+
case "SyncFailed" /* SyncFailed */: {
|
|
19090
|
+
return {
|
|
19091
|
+
variant: "error" /* ERROR */,
|
|
19092
|
+
text: "Retry Sync",
|
|
19093
|
+
icon: /* @__PURE__ */ jsx159(AlertCircle2, { size: 12 })
|
|
19094
|
+
};
|
|
19095
|
+
}
|
|
19096
|
+
case "Connected" /* Connected */:
|
|
19097
|
+
case "SyncSuccess" /* SyncSuccess */: {
|
|
19098
|
+
return {
|
|
19099
|
+
variant: "success" /* SUCCESS */,
|
|
19100
|
+
text: "Synced",
|
|
19101
|
+
icon: /* @__PURE__ */ jsx159(CheckIcon, { size: 12 })
|
|
19102
|
+
};
|
|
19103
|
+
}
|
|
19104
|
+
default:
|
|
19105
|
+
case "Syncing" /* Syncing */: {
|
|
19106
|
+
return {
|
|
19107
|
+
variant: "info" /* INFO */,
|
|
19108
|
+
text: "Sync",
|
|
19109
|
+
icon: /* @__PURE__ */ jsx159(RefreshCcw_default, { size: 12 })
|
|
19110
|
+
};
|
|
19111
|
+
}
|
|
19112
|
+
}
|
|
19113
|
+
};
|
|
18891
19114
|
var IntegrationsQuickbooksItemThumb = () => {
|
|
18892
|
-
const {
|
|
18893
|
-
|
|
18894
|
-
|
|
18895
|
-
|
|
18896
|
-
|
|
19115
|
+
const { quickbooksConnectionStatus, syncFromQuickbooks: syncFromQuickbooks2 } = useContext23(QuickbooksContext);
|
|
19116
|
+
const [hasSynced, setHasSynced] = useState37(false);
|
|
19117
|
+
const [isConfirmationModalOpen, setIsConfirmationModalOpen] = useState37(false);
|
|
19118
|
+
const onSync = useCallback10(() => {
|
|
19119
|
+
setHasSynced(true);
|
|
19120
|
+
syncFromQuickbooks2();
|
|
19121
|
+
}, [syncFromQuickbooks2]);
|
|
18897
19122
|
const menuConfig = useMemo20(() => {
|
|
18898
19123
|
return [
|
|
18899
19124
|
{
|
|
18900
19125
|
name: "Unlink account",
|
|
18901
19126
|
action: () => {
|
|
18902
|
-
|
|
18903
|
-
unlinkQuickbooks();
|
|
18904
|
-
}
|
|
19127
|
+
setIsConfirmationModalOpen(true);
|
|
18905
19128
|
}
|
|
18906
19129
|
}
|
|
18907
19130
|
];
|
|
18908
|
-
}, [
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
18923
|
-
|
|
18924
|
-
|
|
19131
|
+
}, []);
|
|
19132
|
+
if (!quickbooksConnectionStatus) return null;
|
|
19133
|
+
const quickbooksUiState = getQuickbooksConnectionSyncUiState(quickbooksConnectionStatus);
|
|
19134
|
+
const badgeConfig = getBadgeConfig(quickbooksUiState, hasSynced);
|
|
19135
|
+
return /* @__PURE__ */ jsxs101(LinkedAccountOptions, { config: menuConfig, children: [
|
|
19136
|
+
/* @__PURE__ */ jsxs101(Card, { className: "Layer__linked-account-thumb Layer__integrations-quickbooks-item-thumb", children: [
|
|
19137
|
+
/* @__PURE__ */ jsxs101("div", { className: "topbar", children: [
|
|
19138
|
+
/* @__PURE__ */ jsxs101(HStack, { gap: "xs", children: [
|
|
19139
|
+
/* @__PURE__ */ jsx159(Text, { size: "md" /* md */, children: "QuickBooks" }),
|
|
19140
|
+
quickbooksUiState === "Syncing" /* Syncing */ ? /* @__PURE__ */ jsx159(BadgeLoader, { variant: "info" /* INFO */ }) : /* @__PURE__ */ jsx159(
|
|
19141
|
+
Badge,
|
|
19142
|
+
{
|
|
19143
|
+
"aria-role": "button",
|
|
19144
|
+
icon: badgeConfig.icon,
|
|
19145
|
+
variant: badgeConfig.variant,
|
|
19146
|
+
onClick: onSync,
|
|
19147
|
+
size: "small" /* SMALL */,
|
|
19148
|
+
hoverable: true,
|
|
19149
|
+
children: badgeConfig.text
|
|
19150
|
+
}
|
|
19151
|
+
)
|
|
19152
|
+
] }),
|
|
19153
|
+
/* @__PURE__ */ jsx159("div", { className: "topbar-logo", children: /* @__PURE__ */ jsx159(QuickbooksIcon_default, { size: 28 }) })
|
|
18925
19154
|
] }),
|
|
18926
|
-
/* @__PURE__ */
|
|
19155
|
+
/* @__PURE__ */ jsx159(IntegrationsQuickbooksItemThumbFooter, { quickbooksUiState })
|
|
18927
19156
|
] }),
|
|
18928
|
-
/* @__PURE__ */
|
|
18929
|
-
] })
|
|
19157
|
+
/* @__PURE__ */ jsx159(IntegrationsQuickbooksUnlinkConfirmationModal, { isOpen: isConfirmationModalOpen, onOpenChange: setIsConfirmationModalOpen })
|
|
19158
|
+
] });
|
|
18930
19159
|
};
|
|
18931
19160
|
|
|
18932
19161
|
// src/components/Integrations/IntegrationsContent.tsx
|
|
18933
|
-
import { jsx as
|
|
19162
|
+
import { jsx as jsx160 } from "react/jsx-runtime";
|
|
18934
19163
|
var IntegrationsContent = () => {
|
|
18935
|
-
const {
|
|
18936
|
-
return /* @__PURE__ */
|
|
19164
|
+
const { quickbooksConnectionStatus } = useContext24(QuickbooksContext);
|
|
19165
|
+
return /* @__PURE__ */ jsx160("div", { className: "Layer__linked-accounts__list", children: (quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected) && /* @__PURE__ */ jsx160(IntegrationsQuickbooksItemThumb, {}) });
|
|
18937
19166
|
};
|
|
18938
19167
|
|
|
18939
19168
|
// src/hooks/useQuickbooks/useQuickbooks.ts
|
|
18940
|
-
import { useCallback as
|
|
19169
|
+
import { useCallback as useCallback11, useEffect as useEffect24, useRef as useRef20, useState as useState38 } from "react";
|
|
19170
|
+
import { format as format2 } from "date-fns";
|
|
18941
19171
|
var useQuickbooks = () => {
|
|
19172
|
+
var _a;
|
|
18942
19173
|
const { businessId } = useLayerContext();
|
|
18943
19174
|
const { apiUrl } = useEnvironment();
|
|
18944
19175
|
const { data: auth } = useAuth();
|
|
18945
|
-
const [
|
|
18946
|
-
const
|
|
19176
|
+
const [quickbooksConnectionStatus, setQuickbooksConnectionStatus] = useState38(void 0);
|
|
19177
|
+
const isSyncingFromQuickbooks = (_a = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_syncing) != null ? _a : false;
|
|
18947
19178
|
const syncStatusIntervalRef = useRef20(null);
|
|
18948
|
-
const
|
|
18949
|
-
const fetchQuickbooksConnectionStatus = useCallback9(() => __async(null, null, function* () {
|
|
19179
|
+
const fetchQuickbooksConnectionStatus = useCallback11(() => __async(null, null, function* () {
|
|
18950
19180
|
const newQuickbooksConnectionStatus = (yield Layer.statusOfQuickbooksConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18951
19181
|
params: { businessId }
|
|
18952
19182
|
})()).data;
|
|
18953
19183
|
setQuickbooksConnectionStatus(newQuickbooksConnectionStatus);
|
|
18954
19184
|
}), [apiUrl, auth == null ? void 0 : auth.access_token, businessId, setQuickbooksConnectionStatus]);
|
|
18955
|
-
const fetchIsSyncingFromQuickbooks = useCallback9(() => __async(null, null, function* () {
|
|
18956
|
-
const isSyncing = (yield Layer.statusOfSyncFromQuickbooks(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18957
|
-
params: { businessId }
|
|
18958
|
-
})()).data.is_syncing;
|
|
18959
|
-
const wasSyncing = wasSyncingFromQuickbooksRef.current;
|
|
18960
|
-
wasSyncingFromQuickbooksRef.current = isSyncing;
|
|
18961
|
-
setIsSyncingFromQuickbooks(isSyncing);
|
|
18962
|
-
if (!isSyncing && wasSyncing) {
|
|
18963
|
-
yield fetchQuickbooksConnectionStatus();
|
|
18964
|
-
}
|
|
18965
|
-
}), [apiUrl, auth == null ? void 0 : auth.access_token, businessId, setIsSyncingFromQuickbooks, fetchQuickbooksConnectionStatus]);
|
|
18966
19185
|
useEffect24(() => {
|
|
18967
19186
|
if (isSyncingFromQuickbooks && syncStatusIntervalRef.current === null) {
|
|
18968
|
-
const interval = window.setInterval(() => void
|
|
19187
|
+
const interval = window.setInterval(() => void fetchQuickbooksConnectionStatus(), 2e3);
|
|
18969
19188
|
syncStatusIntervalRef.current = interval;
|
|
18970
19189
|
return () => clearInterval(interval);
|
|
18971
19190
|
} else if (!isSyncingFromQuickbooks && syncStatusIntervalRef.current) {
|
|
18972
19191
|
clearInterval(syncStatusIntervalRef.current);
|
|
18973
19192
|
syncStatusIntervalRef.current = null;
|
|
18974
19193
|
}
|
|
18975
|
-
}, [
|
|
19194
|
+
}, [fetchQuickbooksConnectionStatus, isSyncingFromQuickbooks]);
|
|
18976
19195
|
useEffect24(() => {
|
|
18977
19196
|
if (auth == null ? void 0 : auth.access_token) {
|
|
18978
19197
|
void fetchQuickbooksConnectionStatus();
|
|
18979
19198
|
}
|
|
18980
19199
|
}, [auth == null ? void 0 : auth.access_token, fetchQuickbooksConnectionStatus]);
|
|
18981
|
-
const
|
|
18982
|
-
|
|
18983
|
-
|
|
19200
|
+
const handleSyncError = useCallback11(() => {
|
|
19201
|
+
setQuickbooksConnectionStatus({
|
|
19202
|
+
is_connected: true,
|
|
19203
|
+
is_syncing: false,
|
|
19204
|
+
last_sync_status: "SYNC_FAILURE" /* SYNC_FAILURE */,
|
|
19205
|
+
last_synced_at: format2(/* @__PURE__ */ new Date(), "yyyy-MM-dd'T'HH:mm:ss")
|
|
19206
|
+
});
|
|
19207
|
+
}, []);
|
|
19208
|
+
const syncFromQuickbooks2 = useCallback11(() => {
|
|
19209
|
+
const newQuickbooksConnectionStatus = quickbooksConnectionStatus ? __spreadProps(__spreadValues({}, quickbooksConnectionStatus), { is_syncing: true }) : void 0;
|
|
19210
|
+
setQuickbooksConnectionStatus(newQuickbooksConnectionStatus);
|
|
18984
19211
|
void Layer.syncFromQuickbooks(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18985
19212
|
params: { businessId }
|
|
18986
|
-
});
|
|
18987
|
-
}, [apiUrl, auth == null ? void 0 : auth.access_token, businessId,
|
|
18988
|
-
const linkQuickbooks =
|
|
18989
|
-
|
|
19213
|
+
}).catch(handleSyncError);
|
|
19214
|
+
}, [apiUrl, auth == null ? void 0 : auth.access_token, businessId, quickbooksConnectionStatus, handleSyncError]);
|
|
19215
|
+
const linkQuickbooks = useCallback11(() => __async(null, null, function* () {
|
|
19216
|
+
return Layer.initQuickbooksOAuth(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18990
19217
|
params: { businessId }
|
|
18991
|
-
});
|
|
18992
|
-
return res.data.redirect_url;
|
|
19218
|
+
}).then((res) => res.data.redirect_url);
|
|
18993
19219
|
}), [apiUrl, auth == null ? void 0 : auth.access_token, businessId]);
|
|
18994
|
-
const unlinkQuickbooks =
|
|
18995
|
-
|
|
19220
|
+
const unlinkQuickbooks = useCallback11(() => __async(null, null, function* () {
|
|
19221
|
+
return Layer.unlinkQuickbooksConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18996
19222
|
params: { businessId }
|
|
18997
19223
|
}).then(() => fetchQuickbooksConnectionStatus());
|
|
18998
|
-
}, [apiUrl, auth == null ? void 0 : auth.access_token, businessId, fetchQuickbooksConnectionStatus]);
|
|
19224
|
+
}), [apiUrl, auth == null ? void 0 : auth.access_token, businessId, fetchQuickbooksConnectionStatus]);
|
|
18999
19225
|
return {
|
|
19000
|
-
isSyncingFromQuickbooks,
|
|
19001
19226
|
syncFromQuickbooks: syncFromQuickbooks2,
|
|
19002
|
-
quickbooksIsConnected: quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected,
|
|
19003
|
-
quickbooksLastSyncedAt: quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.last_synced_at,
|
|
19004
19227
|
linkQuickbooks,
|
|
19005
|
-
unlinkQuickbooks
|
|
19228
|
+
unlinkQuickbooks,
|
|
19229
|
+
quickbooksConnectionStatus
|
|
19006
19230
|
};
|
|
19007
19231
|
};
|
|
19008
19232
|
|
|
19009
19233
|
// src/providers/QuickbooksContextProvider/QuickbooksContextProvider.tsx
|
|
19010
|
-
import { jsx as
|
|
19234
|
+
import { jsx as jsx161 } from "react/jsx-runtime";
|
|
19011
19235
|
function QuickbooksContextProvider({ children }) {
|
|
19012
19236
|
const quickbooksContextData = useQuickbooks();
|
|
19013
|
-
return /* @__PURE__ */
|
|
19237
|
+
return /* @__PURE__ */ jsx161(QuickbooksContext.Provider, { value: quickbooksContextData, children });
|
|
19014
19238
|
}
|
|
19015
19239
|
|
|
19016
19240
|
// src/components/Integrations/IntegrationsConnectMenu/IntegrationsConnectMenu.tsx
|
|
19017
|
-
import { useCallback as
|
|
19241
|
+
import { useCallback as useCallback12, useContext as useContext25, useState as useState39 } from "react";
|
|
19018
19242
|
|
|
19019
19243
|
// src/components/ui/DropdownMenu/DropdownMenu.tsx
|
|
19020
19244
|
import { Menu as Menu3, MenuItem as AriaMenuItem, MenuTrigger as MenuTrigger2, Popover as Popover2, Separator as AriaSeparator, Header as Header2, Dialog as Dialog2 } from "react-aria-components";
|
|
19021
|
-
import { jsx as
|
|
19022
|
-
var Heading3 = ({ children }) => /* @__PURE__ */
|
|
19023
|
-
var MenuItem3 = ({ children, onClick, isDisabled }) => /* @__PURE__ */
|
|
19024
|
-
var MenuList = ({ children }) => /* @__PURE__ */
|
|
19245
|
+
import { jsx as jsx162, jsxs as jsxs102 } from "react/jsx-runtime";
|
|
19246
|
+
var Heading3 = ({ children }) => /* @__PURE__ */ jsx162(Header2, { children: /* @__PURE__ */ jsx162(Text, { size: "sm" /* sm */, weight: "bold" /* bold */, className: "Layer__dropdown-menu__menu-item__heading", children }) });
|
|
19247
|
+
var MenuItem3 = ({ children, onClick, isDisabled }) => /* @__PURE__ */ jsx162(AriaMenuItem, { onAction: onClick, isDisabled, className: "Layer__dropdown-menu__menu-item", children });
|
|
19248
|
+
var MenuList = ({ children }) => /* @__PURE__ */ jsx162(Menu3, { className: "Layer__dropdown-menu__menu-list", children });
|
|
19025
19249
|
var DropdownMenu = ({ children, ariaLabel, slots, slotProps }) => {
|
|
19026
19250
|
var _a;
|
|
19027
19251
|
const { Trigger } = slots;
|
|
19028
19252
|
const width = (_a = slotProps == null ? void 0 : slotProps.Dialog) == null ? void 0 : _a.width;
|
|
19029
|
-
return /* @__PURE__ */
|
|
19030
|
-
/* @__PURE__ */
|
|
19031
|
-
/* @__PURE__ */
|
|
19253
|
+
return /* @__PURE__ */ jsxs102(MenuTrigger2, { children: [
|
|
19254
|
+
/* @__PURE__ */ jsx162(Trigger, { "aria-label": "Menu" }),
|
|
19255
|
+
/* @__PURE__ */ jsx162(Popover2, { placement: "bottom right", className: "Layer__dropdown-menu__popover Layer__variables", children: /* @__PURE__ */ jsx162(Dialog2, { className: "Layer__dropdown-menu__menu", "aria-label": ariaLabel, style: { width }, children }) })
|
|
19032
19256
|
] });
|
|
19033
19257
|
};
|
|
19034
19258
|
|
|
19035
19259
|
// src/icons/Cog.tsx
|
|
19036
19260
|
import { useId } from "react";
|
|
19037
|
-
import { jsx as
|
|
19261
|
+
import { jsx as jsx163, jsxs as jsxs103 } from "react/jsx-runtime";
|
|
19038
19262
|
var Cog = (_a) => {
|
|
19039
19263
|
var _b = _a, { size = 12 } = _b, props = __objRest(_b, ["size"]);
|
|
19040
19264
|
const id = useId();
|
|
19041
|
-
return /* @__PURE__ */
|
|
19265
|
+
return /* @__PURE__ */ jsxs103(
|
|
19042
19266
|
"svg",
|
|
19043
19267
|
__spreadProps(__spreadValues({
|
|
19044
19268
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -19048,11 +19272,11 @@ var Cog = (_a) => {
|
|
|
19048
19272
|
height: size
|
|
19049
19273
|
}, props), {
|
|
19050
19274
|
children: [
|
|
19051
|
-
/* @__PURE__ */
|
|
19052
|
-
/* @__PURE__ */
|
|
19053
|
-
/* @__PURE__ */
|
|
19275
|
+
/* @__PURE__ */ jsxs103("g", { clipPath: "url(#clip0_6610_12208)", children: [
|
|
19276
|
+
/* @__PURE__ */ jsx163("path", { d: "M6 7.5C6.82843 7.5 7.5 6.82843 7.5 6C7.5 5.17157 6.82843 4.5 6 4.5C5.17157 4.5 4.5 5.17157 4.5 6C4.5 6.82843 5.17157 7.5 6 7.5Z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" }),
|
|
19277
|
+
/* @__PURE__ */ jsx163("path", { d: "M9.7 7.5C9.63344 7.65081 9.61359 7.8181 9.643 7.98029C9.67241 8.14249 9.74973 8.29216 9.865 8.41L9.895 8.44C9.98798 8.53287 10.0617 8.64316 10.1121 8.76456C10.1624 8.88596 10.1883 9.01608 10.1883 9.1475C10.1883 9.27892 10.1624 9.40904 10.1121 9.53044C10.0617 9.65184 9.98798 9.76213 9.895 9.855C9.80213 9.94798 9.69184 10.0217 9.57044 10.0721C9.44904 10.1224 9.31892 10.1483 9.1875 10.1483C9.05608 10.1483 8.92596 10.1224 8.80456 10.0721C8.68316 10.0217 8.57287 9.94798 8.48 9.855L8.45 9.825C8.33216 9.70973 8.18249 9.63241 8.02029 9.603C7.8581 9.57359 7.69081 9.59344 7.54 9.66C7.39212 9.72338 7.26599 9.82862 7.17715 9.96277C7.08832 10.0969 7.04064 10.2541 7.04 10.415V10.5C7.04 10.7652 6.93464 11.0196 6.74711 11.2071C6.55957 11.3946 6.30522 11.5 6.04 11.5C5.77478 11.5 5.52043 11.3946 5.33289 11.2071C5.14536 11.0196 5.04 10.7652 5.04 10.5V10.455C5.03613 10.2895 4.98256 10.129 4.88626 9.99435C4.78995 9.8597 4.65537 9.75714 4.5 9.7C4.34919 9.63344 4.1819 9.61359 4.01971 9.643C3.85751 9.67241 3.70784 9.74973 3.59 9.865L3.56 9.895C3.46713 9.98798 3.35684 10.0617 3.23544 10.1121C3.11404 10.1624 2.98392 10.1883 2.8525 10.1883C2.72108 10.1883 2.59096 10.1624 2.46956 10.1121C2.34816 10.0617 2.23787 9.98798 2.145 9.895C2.05202 9.80213 1.97826 9.69184 1.92794 9.57044C1.87762 9.44904 1.85171 9.31892 1.85171 9.1875C1.85171 9.05608 1.87762 8.92596 1.92794 8.80456C1.97826 8.68316 2.05202 8.57287 2.145 8.48L2.175 8.45C2.29027 8.33216 2.36759 8.18249 2.397 8.02029C2.42641 7.8581 2.40656 7.69081 2.34 7.54C2.27662 7.39212 2.17138 7.26599 2.03723 7.17715C1.90309 7.08832 1.74589 7.04064 1.585 7.04H1.5C1.23478 7.04 0.98043 6.93464 0.792893 6.74711C0.605357 6.55957 0.5 6.30522 0.5 6.04C0.5 5.77478 0.605357 5.52043 0.792893 5.33289C0.98043 5.14536 1.23478 5.04 1.5 5.04H1.545C1.7105 5.03613 1.871 4.98256 2.00565 4.88626C2.1403 4.78995 2.24286 4.65537 2.3 4.5C2.36656 4.34919 2.38641 4.1819 2.357 4.01971C2.32759 3.85751 2.25027 3.70784 2.135 3.59L2.105 3.56C2.01202 3.46713 1.93826 3.35684 1.88794 3.23544C1.83762 3.11404 1.81171 2.98392 1.81171 2.8525C1.81171 2.72108 1.83762 2.59096 1.88794 2.46956C1.93826 2.34816 2.01202 2.23787 2.105 2.145C2.19787 2.05202 2.30816 1.97826 2.42956 1.92794C2.55096 1.87762 2.68108 1.85171 2.8125 1.85171C2.94392 1.85171 3.07404 1.87762 3.19544 1.92794C3.31684 1.97826 3.42713 2.05202 3.52 2.145L3.55 2.175C3.66784 2.29027 3.81751 2.36759 3.97971 2.397C4.1419 2.42641 4.30919 2.40656 4.46 2.34H4.5C4.64788 2.27662 4.77401 2.17138 4.86285 2.03723C4.95168 1.90309 4.99936 1.74589 5 1.585V1.5C5 1.23478 5.10536 0.98043 5.29289 0.792893C5.48043 0.605357 5.73478 0.5 6 0.5C6.26522 0.5 6.51957 0.605357 6.70711 0.792893C6.89464 0.98043 7 1.23478 7 1.5V1.545C7.00064 1.70589 7.04832 1.86309 7.13715 1.99723C7.22599 2.13138 7.35212 2.23662 7.5 2.3C7.65081 2.36656 7.8181 2.38641 7.98029 2.357C8.14249 2.32759 8.29216 2.25027 8.41 2.135L8.44 2.105C8.53287 2.01202 8.64316 1.93826 8.76456 1.88794C8.88596 1.83762 9.01608 1.81171 9.1475 1.81171C9.27892 1.81171 9.40904 1.83762 9.53044 1.88794C9.65184 1.93826 9.76213 2.01202 9.855 2.105C9.94798 2.19787 10.0217 2.30816 10.0721 2.42956C10.1224 2.55096 10.1483 2.68108 10.1483 2.8125C10.1483 2.94392 10.1224 3.07404 10.0721 3.19544C10.0217 3.31684 9.94798 3.42713 9.855 3.52L9.825 3.55C9.70973 3.66784 9.63241 3.81751 9.603 3.97971C9.57359 4.1419 9.59344 4.30919 9.66 4.46V4.5C9.72338 4.64788 9.82862 4.77401 9.96277 4.86285C10.0969 4.95168 10.2541 4.99936 10.415 5H10.5C10.7652 5 11.0196 5.10536 11.2071 5.29289C11.3946 5.48043 11.5 5.73478 11.5 6C11.5 6.26522 11.3946 6.51957 11.2071 6.70711C11.0196 6.89464 10.7652 7 10.5 7H10.455C10.2941 7.00064 10.1369 7.04832 10.0028 7.13715C9.86862 7.22599 9.76338 7.35212 9.7 7.5Z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round" })
|
|
19054
19278
|
] }),
|
|
19055
|
-
/* @__PURE__ */
|
|
19279
|
+
/* @__PURE__ */ jsx163("defs", { children: /* @__PURE__ */ jsx163("clipPath", { id, children: /* @__PURE__ */ jsx163("rect", { width: "12", height: "12", fill: "white" }) }) })
|
|
19056
19280
|
]
|
|
19057
19281
|
})
|
|
19058
19282
|
);
|
|
@@ -19060,38 +19284,42 @@ var Cog = (_a) => {
|
|
|
19060
19284
|
var Cog_default = Cog;
|
|
19061
19285
|
|
|
19062
19286
|
// src/components/Integrations/IntegrationsConnectMenu/IntegrationsConnectMenu.tsx
|
|
19063
|
-
import { jsx as
|
|
19064
|
-
var MenuTriggerButton = () => /* @__PURE__ */
|
|
19287
|
+
import { jsx as jsx164, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
19288
|
+
var MenuTriggerButton = () => /* @__PURE__ */ jsxs104(Button2, { variant: "ghost", children: [
|
|
19065
19289
|
"Manage",
|
|
19066
|
-
/* @__PURE__ */
|
|
19290
|
+
/* @__PURE__ */ jsx164(Cog_default, { size: 16 })
|
|
19067
19291
|
] });
|
|
19068
19292
|
var IntegrationsConnectMenu = () => {
|
|
19069
|
-
const {
|
|
19070
|
-
|
|
19071
|
-
|
|
19072
|
-
|
|
19073
|
-
const initiateQuickbooksOAuth =
|
|
19074
|
-
|
|
19075
|
-
|
|
19076
|
-
|
|
19077
|
-
|
|
19293
|
+
const { addToast } = useLayerContext();
|
|
19294
|
+
const { quickbooksConnectionStatus, linkQuickbooks } = useContext25(QuickbooksContext);
|
|
19295
|
+
const quickbooksIsConnected = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected;
|
|
19296
|
+
const [isLinkQuickbooksError, setIsLinkQuickbooksError] = useState39(false);
|
|
19297
|
+
const initiateQuickbooksOAuth = useCallback12(() => {
|
|
19298
|
+
linkQuickbooks().then((res) => {
|
|
19299
|
+
window.location.href = res;
|
|
19300
|
+
}).catch(() => {
|
|
19301
|
+
setIsLinkQuickbooksError(true);
|
|
19302
|
+
addToast({ content: "Failed to connect QuickBooks", type: "error" });
|
|
19303
|
+
});
|
|
19304
|
+
}, [linkQuickbooks, addToast]);
|
|
19305
|
+
return /* @__PURE__ */ jsxs104(
|
|
19078
19306
|
DropdownMenu,
|
|
19079
19307
|
{
|
|
19080
19308
|
ariaLabel: "Connect Integration",
|
|
19081
19309
|
slots: { Trigger: MenuTriggerButton },
|
|
19082
19310
|
slotProps: { Dialog: { width: 280 } },
|
|
19083
19311
|
children: [
|
|
19084
|
-
/* @__PURE__ */
|
|
19085
|
-
/* @__PURE__ */
|
|
19086
|
-
/* @__PURE__ */
|
|
19087
|
-
/* @__PURE__ */
|
|
19088
|
-
/* @__PURE__ */
|
|
19089
|
-
/* @__PURE__ */
|
|
19090
|
-
] }, "quickbooks-connected") : /* @__PURE__ */
|
|
19091
|
-
/* @__PURE__ */
|
|
19092
|
-
/* @__PURE__ */
|
|
19093
|
-
/* @__PURE__ */
|
|
19094
|
-
/* @__PURE__ */
|
|
19312
|
+
/* @__PURE__ */ jsx164(Heading3, { children: "Integrations" }),
|
|
19313
|
+
/* @__PURE__ */ jsx164(MenuList, { children: quickbooksIsConnected ? /* @__PURE__ */ jsxs104(MenuItem3, { isDisabled: true, children: [
|
|
19314
|
+
/* @__PURE__ */ jsx164(QuickbooksIcon_default, { size: 20 }),
|
|
19315
|
+
/* @__PURE__ */ jsx164(Text, { size: "sm" /* sm */, children: "QuickBooks connected" }),
|
|
19316
|
+
/* @__PURE__ */ jsx164(Spacer, {}),
|
|
19317
|
+
/* @__PURE__ */ jsx164(Check_default, { size: 16 })
|
|
19318
|
+
] }, "quickbooks-connected") : /* @__PURE__ */ jsxs104(MenuItem3, { onClick: initiateQuickbooksOAuth, children: [
|
|
19319
|
+
/* @__PURE__ */ jsx164(QuickbooksIcon_default, { size: 20 }),
|
|
19320
|
+
/* @__PURE__ */ jsx164(Text, __spreadProps(__spreadValues({}, isLinkQuickbooksError && { status: "error" }), { size: "sm" /* sm */, children: isLinkQuickbooksError ? "Retry Connect QuickBooks" : "Connect QuickBooks" })),
|
|
19321
|
+
/* @__PURE__ */ jsx164(Spacer, {}),
|
|
19322
|
+
/* @__PURE__ */ jsx164(Link_default, { size: 12 })
|
|
19095
19323
|
] }, "connect-quickbooks") })
|
|
19096
19324
|
]
|
|
19097
19325
|
}
|
|
@@ -19099,20 +19327,20 @@ var IntegrationsConnectMenu = () => {
|
|
|
19099
19327
|
};
|
|
19100
19328
|
|
|
19101
19329
|
// src/components/Integrations/Integrations.tsx
|
|
19102
|
-
import { jsx as
|
|
19330
|
+
import { jsx as jsx165, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
19103
19331
|
var COMPONENT_NAME3 = "integrations";
|
|
19104
19332
|
var Integrations = (props) => {
|
|
19105
|
-
return /* @__PURE__ */
|
|
19333
|
+
return /* @__PURE__ */ jsx165(QuickbooksContextProvider, { children: /* @__PURE__ */ jsx165(IntegrationsComponent, __spreadValues({}, props)) });
|
|
19106
19334
|
};
|
|
19107
19335
|
var IntegrationsComponent = ({
|
|
19108
19336
|
elevated,
|
|
19109
19337
|
stringOverrides
|
|
19110
19338
|
}) => {
|
|
19111
|
-
const {
|
|
19112
|
-
const isLoading =
|
|
19113
|
-
return /* @__PURE__ */
|
|
19114
|
-
/* @__PURE__ */
|
|
19115
|
-
/* @__PURE__ */
|
|
19339
|
+
const { quickbooksConnectionStatus } = useContext26(QuickbooksContext);
|
|
19340
|
+
const isLoading = quickbooksConnectionStatus === void 0;
|
|
19341
|
+
return /* @__PURE__ */ jsxs105(Container, { name: COMPONENT_NAME3, elevated, children: [
|
|
19342
|
+
/* @__PURE__ */ jsxs105(Header, { className: "Layer__linked-accounts__header", children: [
|
|
19343
|
+
/* @__PURE__ */ jsx165(
|
|
19116
19344
|
Heading,
|
|
19117
19345
|
{
|
|
19118
19346
|
className: "Layer__linked-accounts__title",
|
|
@@ -19120,52 +19348,17 @@ var IntegrationsComponent = ({
|
|
|
19120
19348
|
children: (stringOverrides == null ? void 0 : stringOverrides.title) || "Integrations"
|
|
19121
19349
|
}
|
|
19122
19350
|
),
|
|
19123
|
-
/* @__PURE__ */
|
|
19351
|
+
/* @__PURE__ */ jsx165(IntegrationsConnectMenu, {})
|
|
19124
19352
|
] }),
|
|
19125
|
-
isLoading && /* @__PURE__ */
|
|
19126
|
-
!isLoading && !
|
|
19353
|
+
isLoading && /* @__PURE__ */ jsx165("div", { className: "Layer__linked-accounts__loader-container", children: /* @__PURE__ */ jsx165(Loader2, {}) }),
|
|
19354
|
+
!isLoading && !quickbooksConnectionStatus.is_connected && /* @__PURE__ */ jsx165(
|
|
19127
19355
|
DataState,
|
|
19128
19356
|
{
|
|
19129
19357
|
status: "info" /* info */,
|
|
19130
19358
|
title: "No active integrations"
|
|
19131
19359
|
}
|
|
19132
19360
|
),
|
|
19133
|
-
|
|
19134
|
-
] });
|
|
19135
|
-
};
|
|
19136
|
-
|
|
19137
|
-
// src/components/Quickbooks/Quickbooks.tsx
|
|
19138
|
-
import { jsx as jsx165, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
19139
|
-
var Quickbooks = () => {
|
|
19140
|
-
const {
|
|
19141
|
-
syncFromQuickbooks: syncFromQuickbooks2,
|
|
19142
|
-
isSyncingFromQuickbooks,
|
|
19143
|
-
quickbooksIsConnected,
|
|
19144
|
-
linkQuickbooks,
|
|
19145
|
-
unlinkQuickbooks
|
|
19146
|
-
} = useQuickbooks();
|
|
19147
|
-
return /* @__PURE__ */ jsxs105("div", { children: [
|
|
19148
|
-
/* @__PURE__ */ jsxs105("div", { children: [
|
|
19149
|
-
"Quickbooks OAuth connection status:",
|
|
19150
|
-
" ",
|
|
19151
|
-
quickbooksIsConnected === void 0 ? "" : quickbooksIsConnected ? "established" : "not connected"
|
|
19152
|
-
] }),
|
|
19153
|
-
/* @__PURE__ */ jsx165("br", {}),
|
|
19154
|
-
quickbooksIsConnected === void 0 && "Loading...",
|
|
19155
|
-
quickbooksIsConnected === false && /* @__PURE__ */ jsx165(
|
|
19156
|
-
"button",
|
|
19157
|
-
{
|
|
19158
|
-
onClick: () => __async(null, null, function* () {
|
|
19159
|
-
const authorizationUrl = yield linkQuickbooks();
|
|
19160
|
-
window.location.href = authorizationUrl;
|
|
19161
|
-
}),
|
|
19162
|
-
children: "Link Quickbooks"
|
|
19163
|
-
}
|
|
19164
|
-
),
|
|
19165
|
-
quickbooksIsConnected === true && (isSyncingFromQuickbooks ? "Syncing data from Quickbooks..." : /* @__PURE__ */ jsxs105("div", { children: [
|
|
19166
|
-
/* @__PURE__ */ jsx165("button", { onClick: syncFromQuickbooks2, children: "Sync Quickbooks" }),
|
|
19167
|
-
/* @__PURE__ */ jsx165("button", { onClick: unlinkQuickbooks, children: "Unlink Quickbooks" })
|
|
19168
|
-
] }))
|
|
19361
|
+
(quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected) && /* @__PURE__ */ jsx165(IntegrationsContent, {})
|
|
19169
19362
|
] });
|
|
19170
19363
|
};
|
|
19171
19364
|
|
|
@@ -19195,7 +19388,7 @@ var PNLComparisonContext = createContext14({
|
|
|
19195
19388
|
});
|
|
19196
19389
|
|
|
19197
19390
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
19198
|
-
import { useCallback as
|
|
19391
|
+
import { useCallback as useCallback13, useMemo as useMemo22, useState as useState41 } from "react";
|
|
19199
19392
|
|
|
19200
19393
|
// src/utils/profitAndLossUtils.ts
|
|
19201
19394
|
var doesLineItemQualifies = (item) => {
|
|
@@ -19251,9 +19444,9 @@ var applyShare = (items, total) => {
|
|
|
19251
19444
|
};
|
|
19252
19445
|
|
|
19253
19446
|
// src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
|
|
19254
|
-
import { useEffect as useEffect25, useMemo as useMemo21, useState as
|
|
19447
|
+
import { useEffect as useEffect25, useMemo as useMemo21, useState as useState40 } from "react";
|
|
19255
19448
|
import { startOfMonth as startOfMonth7, sub } from "date-fns";
|
|
19256
|
-
import
|
|
19449
|
+
import useSWR9 from "swr";
|
|
19257
19450
|
var buildDates = ({ currentDate }) => {
|
|
19258
19451
|
return {
|
|
19259
19452
|
startYear: startOfMonth7(currentDate).getFullYear() - 1,
|
|
@@ -19279,9 +19472,9 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
19279
19472
|
const { businessId, syncTimestamps, read, hasBeenTouched } = useLayerContext();
|
|
19280
19473
|
const { apiUrl } = useEnvironment();
|
|
19281
19474
|
const { data: auth } = useAuth();
|
|
19282
|
-
const [date, setDate] =
|
|
19283
|
-
const [loaded, setLoaded] =
|
|
19284
|
-
const [data, setData] =
|
|
19475
|
+
const [date, setDate] = useState40(currentDate);
|
|
19476
|
+
const [loaded, setLoaded] = useState40("initial");
|
|
19477
|
+
const [data, setData] = useState40([]);
|
|
19285
19478
|
const { startYear, startMonth, endYear, endMonth } = useMemo21(() => {
|
|
19286
19479
|
return buildDates({ currentDate: date });
|
|
19287
19480
|
}, [date, businessId, tagFilter, reportingBasis]);
|
|
@@ -19294,7 +19487,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
19294
19487
|
isValidating,
|
|
19295
19488
|
error,
|
|
19296
19489
|
mutate
|
|
19297
|
-
} =
|
|
19490
|
+
} = useSWR9(
|
|
19298
19491
|
queryKey,
|
|
19299
19492
|
Layer.getProfitAndLossSummaries(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
19300
19493
|
params: {
|
|
@@ -19407,7 +19600,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
19407
19600
|
// src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
|
|
19408
19601
|
import { useEffect as useEffect26 } from "react";
|
|
19409
19602
|
import { startOfMonth as startOfMonth8, endOfMonth as endOfMonth7 } from "date-fns";
|
|
19410
|
-
import
|
|
19603
|
+
import useSWR10 from "swr";
|
|
19411
19604
|
var useProfitAndLossQuery = ({
|
|
19412
19605
|
startDate,
|
|
19413
19606
|
endDate,
|
|
@@ -19430,7 +19623,7 @@ var useProfitAndLossQuery = ({
|
|
|
19430
19623
|
isValidating,
|
|
19431
19624
|
error: rawError,
|
|
19432
19625
|
mutate
|
|
19433
|
-
} =
|
|
19626
|
+
} = useSWR10(
|
|
19434
19627
|
queryKey,
|
|
19435
19628
|
Layer.getProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
19436
19629
|
businessId,
|
|
@@ -19473,15 +19666,15 @@ var useProfitAndLoss = ({
|
|
|
19473
19666
|
const { start, end } = useGlobalDateRange();
|
|
19474
19667
|
const { setRange } = useGlobalDateRangeActions();
|
|
19475
19668
|
const dateRange = useMemo22(() => ({ startDate: start, endDate: end }), [start, end]);
|
|
19476
|
-
const changeDateRange =
|
|
19669
|
+
const changeDateRange = useCallback13(
|
|
19477
19670
|
({ startDate: start2, endDate: end2 }) => setRange({ start: start2, end: end2 }),
|
|
19478
19671
|
[setRange]
|
|
19479
19672
|
);
|
|
19480
|
-
const [filters, setFilters] =
|
|
19673
|
+
const [filters, setFilters] = useState41({
|
|
19481
19674
|
expenses: void 0,
|
|
19482
19675
|
revenue: void 0
|
|
19483
19676
|
});
|
|
19484
|
-
const [sidebarScope, setSidebarScope] =
|
|
19677
|
+
const [sidebarScope, setSidebarScope] = useState41(void 0);
|
|
19485
19678
|
const { data, isLoading, isValidating, error, refetch } = useProfitAndLossQuery({
|
|
19486
19679
|
startDate: start,
|
|
19487
19680
|
endDate: end,
|
|
@@ -19634,7 +19827,7 @@ var useProfitAndLoss = ({
|
|
|
19634
19827
|
};
|
|
19635
19828
|
|
|
19636
19829
|
// src/hooks/useProfitAndLossComparison/useProfitAndLossComparison.tsx
|
|
19637
|
-
import { useMemo as useMemo23, useState as
|
|
19830
|
+
import { useMemo as useMemo23, useState as useState42 } from "react";
|
|
19638
19831
|
|
|
19639
19832
|
// src/hooks/useProfitAndLossComparison/utils.ts
|
|
19640
19833
|
import { getMonth, getYear as getYear2, startOfMonth as startOfMonth9, startOfYear as startOfYear4, subMonths as subMonths3, subYears as subYears3 } from "date-fns";
|
|
@@ -19757,14 +19950,14 @@ function preparePeriodsBody(dateRange, comparePeriods, rangeDisplayMode) {
|
|
|
19757
19950
|
}
|
|
19758
19951
|
|
|
19759
19952
|
// src/hooks/useProfitAndLossComparison/useProfitAndLossComparison.tsx
|
|
19760
|
-
import
|
|
19953
|
+
import useSWR11 from "swr";
|
|
19761
19954
|
var COMPARE_MODES_SUPPORTING_MULTI_PERIOD = ["monthPicker", "yearPicker"];
|
|
19762
19955
|
var isNotOnlyNoneTag = (compareOptions) => {
|
|
19763
19956
|
return Boolean(
|
|
19764
19957
|
compareOptions == null ? void 0 : compareOptions.some((option) => option.tagFilterConfig.tagFilters !== "None")
|
|
19765
19958
|
);
|
|
19766
19959
|
};
|
|
19767
|
-
function
|
|
19960
|
+
function buildKey14({
|
|
19768
19961
|
access_token: accessToken,
|
|
19769
19962
|
apiUrl,
|
|
19770
19963
|
businessId,
|
|
@@ -19788,8 +19981,8 @@ function useProfitAndLossComparison({
|
|
|
19788
19981
|
comparisonConfig
|
|
19789
19982
|
}) {
|
|
19790
19983
|
var _a, _b;
|
|
19791
|
-
const [comparePeriods, setComparePeriods] =
|
|
19792
|
-
const [selectedCompareOptions, setSelectedCompareOptionsState] =
|
|
19984
|
+
const [comparePeriods, setComparePeriods] = useState42((_a = comparisonConfig == null ? void 0 : comparisonConfig.defaultPeriods) != null ? _a : 1);
|
|
19985
|
+
const [selectedCompareOptions, setSelectedCompareOptionsState] = useState42(
|
|
19793
19986
|
(comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter) ? [comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter] : []
|
|
19794
19987
|
);
|
|
19795
19988
|
const { rangeDisplayMode, start, end } = useGlobalDateRange();
|
|
@@ -19814,14 +20007,14 @@ function useProfitAndLossComparison({
|
|
|
19814
20007
|
const { data: auth } = useAuth();
|
|
19815
20008
|
const periods = preparePeriodsBody(dateRange, effectiveComparePeriods, rangeDisplayMode);
|
|
19816
20009
|
const tagFilters = prepareFiltersBody(selectedCompareOptions);
|
|
19817
|
-
const queryKey =
|
|
20010
|
+
const queryKey = buildKey14(__spreadProps(__spreadValues({}, auth), {
|
|
19818
20011
|
businessId,
|
|
19819
20012
|
periods,
|
|
19820
20013
|
tagFilters,
|
|
19821
20014
|
reportingBasis,
|
|
19822
20015
|
compareModeActive
|
|
19823
20016
|
}));
|
|
19824
|
-
const { data, isLoading, isValidating } =
|
|
20017
|
+
const { data, isLoading, isValidating } = useSWR11(
|
|
19825
20018
|
queryKey,
|
|
19826
20019
|
() => __async(null, null, function* () {
|
|
19827
20020
|
const response = yield Layer.compareProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
@@ -19869,7 +20062,7 @@ function useProfitAndLossComparison({
|
|
|
19869
20062
|
}
|
|
19870
20063
|
|
|
19871
20064
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
19872
|
-
import { useEffect as useEffect27, useMemo as useMemo24, useState as
|
|
20065
|
+
import { useEffect as useEffect27, useMemo as useMemo24, useState as useState43 } from "react";
|
|
19873
20066
|
|
|
19874
20067
|
// src/icons/BarChart2.tsx
|
|
19875
20068
|
import { jsx as jsx166, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
@@ -19983,7 +20176,7 @@ import {
|
|
|
19983
20176
|
add,
|
|
19984
20177
|
differenceInMonths as differenceInMonths2,
|
|
19985
20178
|
endOfMonth as endOfMonth8,
|
|
19986
|
-
format as
|
|
20179
|
+
format as format3,
|
|
19987
20180
|
startOfMonth as startOfMonth10,
|
|
19988
20181
|
sub as sub2
|
|
19989
20182
|
} from "date-fns";
|
|
@@ -20073,21 +20266,21 @@ var ProfitAndLossChart = ({
|
|
|
20073
20266
|
tagFilter = void 0
|
|
20074
20267
|
}) => {
|
|
20075
20268
|
var _c, _d, _e, _f, _g, _h;
|
|
20076
|
-
const [compactView, setCompactView] =
|
|
20269
|
+
const [compactView, setCompactView] = useState43(false);
|
|
20077
20270
|
const barSize = compactView ? 10 : 20;
|
|
20078
20271
|
const { getColor, business } = useLayerContext();
|
|
20079
20272
|
const { start, end, rangeDisplayMode } = useGlobalDateRange();
|
|
20080
20273
|
const { setMonth } = useGlobalDateRangeActions();
|
|
20081
20274
|
const showIndicator = rangeDisplayMode === "monthPicker";
|
|
20082
20275
|
const dateRange = useMemo24(() => ({ startDate: start, endDate: end }), [start, end]);
|
|
20083
|
-
const [localDateRange, setLocalDateRange] =
|
|
20084
|
-
const [customCursorSize, setCustomCursorSize] =
|
|
20276
|
+
const [localDateRange, setLocalDateRange] = useState43(dateRange);
|
|
20277
|
+
const [customCursorSize, setCustomCursorSize] = useState43({
|
|
20085
20278
|
width: 0,
|
|
20086
20279
|
height: 0,
|
|
20087
20280
|
x: 0
|
|
20088
20281
|
});
|
|
20089
|
-
const [barAnimActive, setBarAnimActive] =
|
|
20090
|
-
const [chartWindow, setChartWindow] =
|
|
20282
|
+
const [barAnimActive, setBarAnimActive] = useState43(true);
|
|
20283
|
+
const [chartWindow, setChartWindow] = useState43({
|
|
20091
20284
|
start: startOfMonth10(sub2(Date.now(), { months: 11 })),
|
|
20092
20285
|
end: endOfMonth8(Date.now())
|
|
20093
20286
|
});
|
|
@@ -20158,7 +20351,7 @@ var ProfitAndLossChart = ({
|
|
|
20158
20351
|
}, 2e3);
|
|
20159
20352
|
}
|
|
20160
20353
|
}, [loaded]);
|
|
20161
|
-
const getMonthName = (pnl) => pnl ?
|
|
20354
|
+
const getMonthName = (pnl) => pnl ? format3(
|
|
20162
20355
|
new Date(pnl.year, pnl.month - 1, 1),
|
|
20163
20356
|
compactView ? "LLLLL" : "LLL"
|
|
20164
20357
|
) : "";
|
|
@@ -20186,7 +20379,7 @@ var ProfitAndLossChart = ({
|
|
|
20186
20379
|
for (let i = 11; i >= 0; i--) {
|
|
20187
20380
|
const currentDate = sub2(today, { months: i });
|
|
20188
20381
|
loadingData.push({
|
|
20189
|
-
name:
|
|
20382
|
+
name: format3(currentDate, compactView ? "LLLLL" : "LLL"),
|
|
20190
20383
|
revenue: 0,
|
|
20191
20384
|
revenueUncategorized: 0,
|
|
20192
20385
|
totalExpensesInverse: 0,
|
|
@@ -20709,7 +20902,7 @@ var ProfitAndLossChart = ({
|
|
|
20709
20902
|
};
|
|
20710
20903
|
|
|
20711
20904
|
// src/components/ProfitAndLossCompareOptions/ProfitAndLossCompareOptions.tsx
|
|
20712
|
-
import { useContext as
|
|
20905
|
+
import { useContext as useContext27, useMemo as useMemo25 } from "react";
|
|
20713
20906
|
import { jsx as jsx170, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
20714
20907
|
var selectStyles = {
|
|
20715
20908
|
valueContainer: (styles) => {
|
|
@@ -20749,7 +20942,7 @@ var ProfitAndLossCompareOptions = () => {
|
|
|
20749
20942
|
compareOptions,
|
|
20750
20943
|
selectedCompareOptions,
|
|
20751
20944
|
comparisonConfig
|
|
20752
|
-
} =
|
|
20945
|
+
} = useContext27(ProfitAndLoss.ComparisonContext);
|
|
20753
20946
|
const { rangeDisplayMode } = useGlobalDateRange();
|
|
20754
20947
|
const periods = useMemo25(
|
|
20755
20948
|
() => comparePeriods !== 0 ? comparePeriods : 1,
|
|
@@ -20961,7 +21154,7 @@ var ProfitAndLossDatePicker = ({
|
|
|
20961
21154
|
};
|
|
20962
21155
|
|
|
20963
21156
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
20964
|
-
import { useContext as
|
|
21157
|
+
import { useContext as useContext28, useState as useState44 } from "react";
|
|
20965
21158
|
|
|
20966
21159
|
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
20967
21160
|
import { useMemo as useMemo27 } from "react";
|
|
@@ -21607,7 +21800,7 @@ var Filters = ({
|
|
|
21607
21800
|
};
|
|
21608
21801
|
|
|
21609
21802
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
21610
|
-
import { format as
|
|
21803
|
+
import { format as format4 } from "date-fns";
|
|
21611
21804
|
import { jsx as jsx177, jsxs as jsxs114 } from "react/jsx-runtime";
|
|
21612
21805
|
var ProfitAndLossDetailedCharts = ({
|
|
21613
21806
|
scope,
|
|
@@ -21628,16 +21821,16 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
21628
21821
|
sidebarScope,
|
|
21629
21822
|
setSidebarScope,
|
|
21630
21823
|
setFilterTypes
|
|
21631
|
-
} =
|
|
21824
|
+
} = useContext28(ProfitAndLoss.Context);
|
|
21632
21825
|
const theScope = scope ? scope : sidebarScope;
|
|
21633
21826
|
const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
|
|
21634
21827
|
const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
|
|
21635
|
-
const [hoveredItem, setHoveredItem] =
|
|
21828
|
+
const [hoveredItem, setHoveredItem] = useState44();
|
|
21636
21829
|
return /* @__PURE__ */ jsxs114("div", { className: "Layer__profit-and-loss-detailed-charts", children: [
|
|
21637
21830
|
/* @__PURE__ */ jsxs114("header", { className: "Layer__profit-and-loss-detailed-charts__header", children: [
|
|
21638
21831
|
/* @__PURE__ */ jsxs114("div", { className: "Layer__profit-and-loss-detailed-charts__head", children: [
|
|
21639
21832
|
/* @__PURE__ */ jsx177(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title", children: humanizeTitle(theScope) }),
|
|
21640
|
-
/* @__PURE__ */ jsx177(Text, { size: "sm" /* sm */, className: "date", children:
|
|
21833
|
+
/* @__PURE__ */ jsx177(Text, { size: "sm" /* sm */, className: "date", children: format4(dateRange.startDate, "LLLL, y") }),
|
|
21641
21834
|
showDatePicker && /* @__PURE__ */ jsx177(ProfitAndLossDatePicker, {})
|
|
21642
21835
|
] }),
|
|
21643
21836
|
!hideClose && /* @__PURE__ */ jsx177(
|
|
@@ -21654,7 +21847,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
21654
21847
|
!hideClose && /* @__PURE__ */ jsx177(BackButton, { onClick: () => setSidebarScope(void 0) }),
|
|
21655
21848
|
/* @__PURE__ */ jsxs114("div", { className: "Layer__profit-and-loss-detailed-charts__head", children: [
|
|
21656
21849
|
/* @__PURE__ */ jsx177(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title", children: humanizeTitle(theScope) }),
|
|
21657
|
-
/* @__PURE__ */ jsx177(Text, { size: "sm" /* sm */, className: "date", children:
|
|
21850
|
+
/* @__PURE__ */ jsx177(Text, { size: "sm" /* sm */, className: "date", children: format4(dateRange.startDate, "LLLL, y") })
|
|
21658
21851
|
] })
|
|
21659
21852
|
] }),
|
|
21660
21853
|
/* @__PURE__ */ jsxs114("div", { className: "Layer__profit-and-loss-detailed-charts__content", children: [
|
|
@@ -21701,7 +21894,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
21701
21894
|
};
|
|
21702
21895
|
|
|
21703
21896
|
// src/components/ProfitAndLossDownloadButton/ProfitAndLossDownloadButton.tsx
|
|
21704
|
-
import { useContext as
|
|
21897
|
+
import { useContext as useContext29, useState as useState45 } from "react";
|
|
21705
21898
|
import { jsx as jsx178 } from "react/jsx-runtime";
|
|
21706
21899
|
var ProfitAndLossDownloadButton = ({
|
|
21707
21900
|
stringOverrides,
|
|
@@ -21709,15 +21902,15 @@ var ProfitAndLossDownloadButton = ({
|
|
|
21709
21902
|
moneyFormat,
|
|
21710
21903
|
view
|
|
21711
21904
|
}) => {
|
|
21712
|
-
const { dateRange, tagFilter } =
|
|
21713
|
-
const { getProfitAndLossComparisonCsv } =
|
|
21905
|
+
const { dateRange, tagFilter } = useContext29(ProfitAndLoss.Context);
|
|
21906
|
+
const { getProfitAndLossComparisonCsv } = useContext29(
|
|
21714
21907
|
ProfitAndLoss.ComparisonContext
|
|
21715
21908
|
);
|
|
21716
21909
|
const { businessId } = useLayerContext();
|
|
21717
21910
|
const { apiUrl } = useEnvironment();
|
|
21718
21911
|
const { data: auth } = useAuth();
|
|
21719
|
-
const [requestFailed, setRequestFailed] =
|
|
21720
|
-
const [isDownloading, setIsDownloading] =
|
|
21912
|
+
const [requestFailed, setRequestFailed] = useState45(false);
|
|
21913
|
+
const [isDownloading, setIsDownloading] = useState45(false);
|
|
21721
21914
|
const handleClick = () => __async(null, null, function* () {
|
|
21722
21915
|
var _a;
|
|
21723
21916
|
setIsDownloading(true);
|
|
@@ -21779,113 +21972,6 @@ var SyncingBadge = () => {
|
|
|
21779
21972
|
|
|
21780
21973
|
// src/hooks/bookkeeping/periods/useActiveBookkeepingPeriod.ts
|
|
21781
21974
|
import { useMemo as useMemo28 } from "react";
|
|
21782
|
-
|
|
21783
|
-
// src/hooks/bookkeeping/periods/useBookkeepingPeriods.ts
|
|
21784
|
-
import useSWR11 from "swr";
|
|
21785
|
-
|
|
21786
|
-
// src/utils/bookkeeping/bookkeepingStatusFilters.ts
|
|
21787
|
-
function isActiveBookkeepingStatus(status) {
|
|
21788
|
-
return status === "ACTIVE" || status === "ONBOARDING";
|
|
21789
|
-
}
|
|
21790
|
-
function isActiveOrPausedBookkeepingStatus(status) {
|
|
21791
|
-
return isActiveBookkeepingStatus(status) || status === "BOOKKEEPING_PAUSED";
|
|
21792
|
-
}
|
|
21793
|
-
|
|
21794
|
-
// src/utils/bookkeeping/tasks/bookkeepingTasksFilters.ts
|
|
21795
|
-
function isIncompleteTask(task) {
|
|
21796
|
-
const { status } = task;
|
|
21797
|
-
return status === "TODO";
|
|
21798
|
-
}
|
|
21799
|
-
function getIncompleteTasks(tasks) {
|
|
21800
|
-
return tasks.filter((task) => isIncompleteTask(task));
|
|
21801
|
-
}
|
|
21802
|
-
function isUserVisibleTask(task) {
|
|
21803
|
-
const { status } = task;
|
|
21804
|
-
return status !== "COMPLETED" && status !== "ARCHIVED";
|
|
21805
|
-
}
|
|
21806
|
-
function getUserVisibleTasks(tasks) {
|
|
21807
|
-
return tasks.filter((task) => isUserVisibleTask(task));
|
|
21808
|
-
}
|
|
21809
|
-
function isCompletedTask(task) {
|
|
21810
|
-
const { status } = task;
|
|
21811
|
-
return status === "USER_MARKED_COMPLETED" || status === "COMPLETED" || status === "ARCHIVED";
|
|
21812
|
-
}
|
|
21813
|
-
function getCompletedTasks(tasks) {
|
|
21814
|
-
return tasks.filter((task) => isCompletedTask(task));
|
|
21815
|
-
}
|
|
21816
|
-
|
|
21817
|
-
// src/utils/bookkeeping/periods/getFilteredBookkeepingPeriods.ts
|
|
21818
|
-
function isActiveBookkeepingPeriod(period) {
|
|
21819
|
-
return period.status !== "BOOKKEEPING_NOT_ACTIVE";
|
|
21820
|
-
}
|
|
21821
|
-
|
|
21822
|
-
// src/hooks/bookkeeping/periods/useBookkeepingPeriods.ts
|
|
21823
|
-
var BOOKKEEPING_PERIOD_STATUSES = [
|
|
21824
|
-
"BOOKKEEPING_NOT_ACTIVE",
|
|
21825
|
-
"NOT_STARTED",
|
|
21826
|
-
"IN_PROGRESS_AWAITING_BOOKKEEPER",
|
|
21827
|
-
"IN_PROGRESS_AWAITING_CUSTOMER",
|
|
21828
|
-
"CLOSING_IN_REVIEW",
|
|
21829
|
-
"CLOSED_OPEN_TASKS",
|
|
21830
|
-
"CLOSED_COMPLETE"
|
|
21831
|
-
];
|
|
21832
|
-
function constrainToKnownBookkeepingPeriodStatus(status) {
|
|
21833
|
-
if (BOOKKEEPING_PERIOD_STATUSES.includes(status)) {
|
|
21834
|
-
return status;
|
|
21835
|
-
}
|
|
21836
|
-
return "BOOKKEEPING_NOT_ACTIVE";
|
|
21837
|
-
}
|
|
21838
|
-
var getBookkeepingPeriods = get(({ businessId }) => {
|
|
21839
|
-
return `/v1/businesses/${businessId}/bookkeeping/periods`;
|
|
21840
|
-
});
|
|
21841
|
-
var BOOKKEEPING_PERIODS_TAG_KEY = "#bookkeeping-periods";
|
|
21842
|
-
function buildKey14({
|
|
21843
|
-
access_token: accessToken,
|
|
21844
|
-
apiUrl,
|
|
21845
|
-
businessId,
|
|
21846
|
-
isActiveOrPaused
|
|
21847
|
-
}) {
|
|
21848
|
-
if (accessToken && apiUrl && isActiveOrPaused) {
|
|
21849
|
-
return {
|
|
21850
|
-
accessToken,
|
|
21851
|
-
apiUrl,
|
|
21852
|
-
businessId,
|
|
21853
|
-
tags: [BOOKKEEPING_TAG_KEY, BOOKKEEPING_PERIODS_TAG_KEY]
|
|
21854
|
-
};
|
|
21855
|
-
}
|
|
21856
|
-
}
|
|
21857
|
-
function useBookkeepingPeriods() {
|
|
21858
|
-
const { data: auth } = useAuth();
|
|
21859
|
-
const { businessId } = useLayerContext();
|
|
21860
|
-
const { data, isLoading: isLoadingBookkeepingStatus } = useBookkeepingStatus();
|
|
21861
|
-
const isActiveOrPaused = data ? isActiveOrPausedBookkeepingStatus(data.status) : false;
|
|
21862
|
-
const swrResponse = useSWR11(
|
|
21863
|
-
() => buildKey14(__spreadProps(__spreadValues({}, auth), {
|
|
21864
|
-
businessId,
|
|
21865
|
-
isActiveOrPaused
|
|
21866
|
-
})),
|
|
21867
|
-
({ accessToken, apiUrl, businessId: businessId2 }) => getBookkeepingPeriods(
|
|
21868
|
-
apiUrl,
|
|
21869
|
-
accessToken,
|
|
21870
|
-
{ params: { businessId: businessId2 } }
|
|
21871
|
-
)().then(
|
|
21872
|
-
({ data: { periods } }) => periods.map((period) => __spreadProps(__spreadValues({}, period), {
|
|
21873
|
-
status: constrainToKnownBookkeepingPeriodStatus(period.status),
|
|
21874
|
-
tasks: getUserVisibleTasks(period.tasks)
|
|
21875
|
-
})).filter((period) => isActiveBookkeepingPeriod(period))
|
|
21876
|
-
)
|
|
21877
|
-
);
|
|
21878
|
-
return new Proxy(swrResponse, {
|
|
21879
|
-
get(target, prop) {
|
|
21880
|
-
if (prop === "isLoading") {
|
|
21881
|
-
return isLoadingBookkeepingStatus || swrResponse.isLoading;
|
|
21882
|
-
}
|
|
21883
|
-
return Reflect.get(target, prop);
|
|
21884
|
-
}
|
|
21885
|
-
});
|
|
21886
|
-
}
|
|
21887
|
-
|
|
21888
|
-
// src/hooks/bookkeeping/periods/useActiveBookkeepingPeriod.ts
|
|
21889
21975
|
function useActiveBookkeepingPeriod() {
|
|
21890
21976
|
const { date } = useGlobalDate();
|
|
21891
21977
|
const { data, isLoading } = useBookkeepingPeriods();
|
|
@@ -21918,14 +22004,14 @@ var ProfitAndLossHeader = ({
|
|
|
21918
22004
|
/* @__PURE__ */ jsxs115("span", { className: "Layer__component-header__title-wrapper Layer__profit-and-loss__header", children: [
|
|
21919
22005
|
/* @__PURE__ */ jsx180(Heading, { size: "secondary" /* secondary */, className: headingClassName, align: "left", children: text || "Profit & Loss" }),
|
|
21920
22006
|
isSyncing && /* @__PURE__ */ jsx180(SyncingBadge, {}),
|
|
21921
|
-
withStatus && activePeriodStatus && /* @__PURE__ */ jsx180("span", { className: "Layer__profit-and-loss-header__bookkeeping-status", children: /* @__PURE__ */ jsx180(
|
|
22007
|
+
withStatus && activePeriodStatus && /* @__PURE__ */ jsx180("span", { className: "Layer__profit-and-loss-header__bookkeeping-status", children: /* @__PURE__ */ jsx180(BookkeepingStatus2, { status: activePeriodStatus, monthNumber: activePeriod.month }) })
|
|
21922
22008
|
] }),
|
|
21923
22009
|
withDatePicker && /* @__PURE__ */ jsx180(ProfitAndLoss.DatePicker, {})
|
|
21924
22010
|
] });
|
|
21925
22011
|
};
|
|
21926
22012
|
|
|
21927
22013
|
// src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
|
|
21928
|
-
import { useContext as
|
|
22014
|
+
import { useContext as useContext30 } from "react";
|
|
21929
22015
|
|
|
21930
22016
|
// src/components/Header/Header.tsx
|
|
21931
22017
|
import {
|
|
@@ -21974,7 +22060,7 @@ var HeaderCol = ({ className, children, style, noPadding = false }) => {
|
|
|
21974
22060
|
};
|
|
21975
22061
|
|
|
21976
22062
|
// src/components/Panel/Panel.tsx
|
|
21977
|
-
import { useEffect as useEffect28, useState as
|
|
22063
|
+
import { useEffect as useEffect28, useState as useState46 } from "react";
|
|
21978
22064
|
import classNames58 from "classnames";
|
|
21979
22065
|
import { jsx as jsx184, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
21980
22066
|
var Panel = ({
|
|
@@ -21988,7 +22074,7 @@ var Panel = ({
|
|
|
21988
22074
|
floating = false
|
|
21989
22075
|
}) => {
|
|
21990
22076
|
var _a;
|
|
21991
|
-
const [sidebarHeight, setSidebarHeight] =
|
|
22077
|
+
const [sidebarHeight, setSidebarHeight] = useState46(0);
|
|
21992
22078
|
useEffect28(() => {
|
|
21993
22079
|
var _a2, _b;
|
|
21994
22080
|
if ((_a2 = parentRef == null ? void 0 : parentRef.current) == null ? void 0 : _a2.offsetHeight) {
|
|
@@ -22083,7 +22169,7 @@ var View = forwardRef15(
|
|
|
22083
22169
|
View.displayName = "View";
|
|
22084
22170
|
|
|
22085
22171
|
// src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
|
|
22086
|
-
import { Fragment as
|
|
22172
|
+
import { Fragment as Fragment21, jsx as jsx187, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
22087
22173
|
var ProfitAndLossReport = ({
|
|
22088
22174
|
stringOverrides,
|
|
22089
22175
|
allowedDatePickerModes,
|
|
@@ -22095,15 +22181,15 @@ var ProfitAndLossReport = ({
|
|
|
22095
22181
|
view
|
|
22096
22182
|
}) => {
|
|
22097
22183
|
var _a, _b;
|
|
22098
|
-
const { sidebarScope } =
|
|
22099
|
-
const { comparisonConfig } =
|
|
22184
|
+
const { sidebarScope } = useContext30(ProfitAndLoss.Context);
|
|
22185
|
+
const { comparisonConfig } = useContext30(ProfitAndLoss.ComparisonContext);
|
|
22100
22186
|
return /* @__PURE__ */ jsx187(
|
|
22101
22187
|
View,
|
|
22102
22188
|
{
|
|
22103
22189
|
type: "panel",
|
|
22104
22190
|
header: /* @__PURE__ */ jsxs119(Header3, { children: [
|
|
22105
22191
|
/* @__PURE__ */ jsxs119(HeaderRow, { children: [
|
|
22106
|
-
/* @__PURE__ */ jsx187(HeaderCol, { children: /* @__PURE__ */ jsxs119(
|
|
22192
|
+
/* @__PURE__ */ jsx187(HeaderCol, { children: /* @__PURE__ */ jsxs119(Fragment21, { children: [
|
|
22107
22193
|
/* @__PURE__ */ jsx187(
|
|
22108
22194
|
ProfitAndLoss.DatePicker,
|
|
22109
22195
|
{
|
|
@@ -22153,7 +22239,7 @@ var ProfitAndLossReport = ({
|
|
|
22153
22239
|
};
|
|
22154
22240
|
|
|
22155
22241
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
22156
|
-
import { useContext as
|
|
22242
|
+
import { useContext as useContext32, useMemo as useMemo31 } from "react";
|
|
22157
22243
|
|
|
22158
22244
|
// src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesList.tsx
|
|
22159
22245
|
import { useMemo as useMemo30 } from "react";
|
|
@@ -22318,7 +22404,7 @@ function ProfitAndLossSummariesSummary({
|
|
|
22318
22404
|
}
|
|
22319
22405
|
|
|
22320
22406
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
22321
|
-
import { useContext as
|
|
22407
|
+
import { useContext as useContext31, useEffect as useEffect29, useState as useState47 } from "react";
|
|
22322
22408
|
import { getMonth as getMonth2, getYear as getYear3, startOfMonth as startOfMonth11 } from "date-fns";
|
|
22323
22409
|
import { jsx as jsx193, jsxs as jsxs121 } from "react/jsx-runtime";
|
|
22324
22410
|
var CLASS_NAME12 = "Layer__TransactionsToReview";
|
|
@@ -22329,9 +22415,9 @@ function TransactionsToReview({
|
|
|
22329
22415
|
variants
|
|
22330
22416
|
}) {
|
|
22331
22417
|
const { size = "sm" } = variants != null ? variants : {};
|
|
22332
|
-
const { dateRange: contextDateRange } =
|
|
22418
|
+
const { dateRange: contextDateRange } = useContext31(ProfitAndLoss.Context);
|
|
22333
22419
|
const dateRange = usePnlDateRange ? contextDateRange : void 0;
|
|
22334
|
-
const [toReview, setToReview] =
|
|
22420
|
+
const [toReview, setToReview] = useState47(0);
|
|
22335
22421
|
const { data, loaded, error, refetch } = useProfitAndLossLTM({
|
|
22336
22422
|
currentDate: dateRange ? dateRange.startDate : startOfMonth11(/* @__PURE__ */ new Date()),
|
|
22337
22423
|
tagFilter
|
|
@@ -22420,7 +22506,7 @@ function Internal_ProfitAndLossSummaries({
|
|
|
22420
22506
|
isLoading,
|
|
22421
22507
|
setSidebarScope,
|
|
22422
22508
|
sidebarScope
|
|
22423
|
-
} =
|
|
22509
|
+
} = useContext32(ProfitAndLoss.Context);
|
|
22424
22510
|
const { revenueChartData, expensesChartData } = useMemo31(
|
|
22425
22511
|
() => ({
|
|
22426
22512
|
revenueChartData: toMiniChartData({ scope: "revenue", data }),
|
|
@@ -22523,10 +22609,10 @@ function ProfitAndLossSummaries(_a) {
|
|
|
22523
22609
|
}
|
|
22524
22610
|
|
|
22525
22611
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
22526
|
-
import { useContext as
|
|
22612
|
+
import { useContext as useContext36 } from "react";
|
|
22527
22613
|
|
|
22528
22614
|
// src/contexts/TableContext/TableContext.tsx
|
|
22529
|
-
import { createContext as createContext15, useState as
|
|
22615
|
+
import { createContext as createContext15, useState as useState48 } from "react";
|
|
22530
22616
|
import { jsx as jsx195 } from "react/jsx-runtime";
|
|
22531
22617
|
var defaultValue = {
|
|
22532
22618
|
expandedRows: [],
|
|
@@ -22540,8 +22626,8 @@ var defaultValue = {
|
|
|
22540
22626
|
};
|
|
22541
22627
|
var TableContext = createContext15(defaultValue);
|
|
22542
22628
|
var TableProvider = ({ children }) => {
|
|
22543
|
-
const [expandedRows, setExpandedRowsState] =
|
|
22544
|
-
const [expandedAllRows, setExpandedAllRows] =
|
|
22629
|
+
const [expandedRows, setExpandedRowsState] = useState48([]);
|
|
22630
|
+
const [expandedAllRows, setExpandedAllRows] = useState48(false);
|
|
22545
22631
|
const toggleRow = (rowKey) => {
|
|
22546
22632
|
setExpandedRowsState((prevRows) => {
|
|
22547
22633
|
const rows = [...prevRows];
|
|
@@ -22567,10 +22653,10 @@ var TableProvider = ({ children }) => {
|
|
|
22567
22653
|
};
|
|
22568
22654
|
|
|
22569
22655
|
// src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
|
|
22570
|
-
import { Fragment as
|
|
22656
|
+
import { Fragment as Fragment23, useContext as useContext34, useEffect as useEffect31 } from "react";
|
|
22571
22657
|
|
|
22572
22658
|
// src/hooks/useTableExpandRow/useTableExpandRow.tsx
|
|
22573
|
-
import { useContext as
|
|
22659
|
+
import { useContext as useContext33 } from "react";
|
|
22574
22660
|
var useTableExpandRow = () => {
|
|
22575
22661
|
const {
|
|
22576
22662
|
expandedAllRows,
|
|
@@ -22578,7 +22664,7 @@ var useTableExpandRow = () => {
|
|
|
22578
22664
|
expandAllRows,
|
|
22579
22665
|
expandedRows,
|
|
22580
22666
|
setExpandedRows
|
|
22581
|
-
} =
|
|
22667
|
+
} = useContext33(TableContext);
|
|
22582
22668
|
const toggleAllRows = () => {
|
|
22583
22669
|
if (expandedAllRows) {
|
|
22584
22670
|
setIsOpen([]);
|
|
@@ -22606,7 +22692,7 @@ var useTableExpandRow = () => {
|
|
|
22606
22692
|
};
|
|
22607
22693
|
|
|
22608
22694
|
// src/utils/profitAndLossComparisonUtils.ts
|
|
22609
|
-
import { format as
|
|
22695
|
+
import { format as format5, subMonths as subMonths4, subYears as subYears4 } from "date-fns";
|
|
22610
22696
|
var generateComparisonPeriods = (startDate, numberOfPeriods, rangeDisplayMode) => {
|
|
22611
22697
|
switch (rangeDisplayMode) {
|
|
22612
22698
|
case "yearPicker":
|
|
@@ -22618,13 +22704,13 @@ var generateComparisonPeriods = (startDate, numberOfPeriods, rangeDisplayMode) =
|
|
|
22618
22704
|
var generateComparisonMonths = (startDate, numberOfMonths) => {
|
|
22619
22705
|
return Array.from({ length: numberOfMonths }, (_, index) => {
|
|
22620
22706
|
const currentMonth = subMonths4(startDate, numberOfMonths - index - 1);
|
|
22621
|
-
return { date: currentMonth, label:
|
|
22707
|
+
return { date: currentMonth, label: format5(currentMonth, "MMM") };
|
|
22622
22708
|
});
|
|
22623
22709
|
};
|
|
22624
22710
|
var generateComparisonYears = (startDate, numberOfYears) => {
|
|
22625
22711
|
return Array.from({ length: numberOfYears }, (_, index) => {
|
|
22626
22712
|
const currentMonth = subYears4(startDate, numberOfYears - index - 1);
|
|
22627
|
-
return { date: currentMonth, label:
|
|
22713
|
+
return { date: currentMonth, label: format5(currentMonth, "yyyy") };
|
|
22628
22714
|
});
|
|
22629
22715
|
};
|
|
22630
22716
|
var getComparisonValue = (name, depth, cellData) => {
|
|
@@ -22753,7 +22839,7 @@ var TableHead = ({ children }) => {
|
|
|
22753
22839
|
|
|
22754
22840
|
// src/components/TableRow/TableRow.tsx
|
|
22755
22841
|
import classNames62 from "classnames";
|
|
22756
|
-
import { Fragment as
|
|
22842
|
+
import { Fragment as Fragment22, jsx as jsx199, jsxs as jsxs124 } from "react/jsx-runtime";
|
|
22757
22843
|
var TableRow = ({
|
|
22758
22844
|
rowKey,
|
|
22759
22845
|
children,
|
|
@@ -22783,7 +22869,7 @@ var TableRow = ({
|
|
|
22783
22869
|
selected && "Layer__table-row--selected",
|
|
22784
22870
|
!isHeadRow && expandable && (isExpanded ? "Layer__table-row--expanded" : "Layer__table-row--collapsed")
|
|
22785
22871
|
]);
|
|
22786
|
-
return /* @__PURE__ */ jsxs124(
|
|
22872
|
+
return /* @__PURE__ */ jsxs124(Fragment22, { children: [
|
|
22787
22873
|
withDivider && withDividerPosition === "top" && /* @__PURE__ */ jsx199("tr", { className: "Layer__table-empty-row", children: /* @__PURE__ */ jsx199("td", { colSpan: Array.isArray(children) ? children.length : 1 }) }),
|
|
22788
22874
|
/* @__PURE__ */ jsx199(
|
|
22789
22875
|
"tr",
|
|
@@ -22855,17 +22941,17 @@ var Table = ({
|
|
|
22855
22941
|
|
|
22856
22942
|
// src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
|
|
22857
22943
|
import classNames64 from "classnames";
|
|
22858
|
-
import { Fragment as
|
|
22944
|
+
import { Fragment as Fragment24, jsx as jsx201, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
22859
22945
|
var ProfitAndLossCompareTable = ({
|
|
22860
22946
|
stringOverrides
|
|
22861
22947
|
}) => {
|
|
22862
|
-
const { dateRange } =
|
|
22948
|
+
const { dateRange } = useContext34(ProfitAndLoss.Context);
|
|
22863
22949
|
const {
|
|
22864
22950
|
data: comparisonData,
|
|
22865
22951
|
isLoading,
|
|
22866
22952
|
comparePeriods,
|
|
22867
22953
|
selectedCompareOptions
|
|
22868
|
-
} =
|
|
22954
|
+
} = useContext34(ProfitAndLoss.ComparisonContext);
|
|
22869
22955
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
22870
22956
|
const { rangeDisplayMode } = useGlobalDateRange();
|
|
22871
22957
|
const { data: bookkeepingPeriods } = useBookkeepingPeriods();
|
|
@@ -22893,7 +22979,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22893
22979
|
if (!period) {
|
|
22894
22980
|
return;
|
|
22895
22981
|
}
|
|
22896
|
-
return /* @__PURE__ */ jsx201(
|
|
22982
|
+
return /* @__PURE__ */ jsx201(BookkeepingStatus2, { status: period.status, monthNumber: currentMonth, iconOnly: true });
|
|
22897
22983
|
};
|
|
22898
22984
|
const renderRow = (rowKey, depth, rowDisplayName, lineItem, data) => {
|
|
22899
22985
|
const rowData = data ? data : [];
|
|
@@ -22904,7 +22990,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22904
22990
|
}
|
|
22905
22991
|
});
|
|
22906
22992
|
if (rowData.length === 0) {
|
|
22907
|
-
return /* @__PURE__ */ jsx201(
|
|
22993
|
+
return /* @__PURE__ */ jsx201(Fragment24, {});
|
|
22908
22994
|
}
|
|
22909
22995
|
const mergedLineItems = mergeComparisonLineItemsAtDepth(
|
|
22910
22996
|
rowData
|
|
@@ -22913,7 +22999,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22913
22999
|
}
|
|
22914
23000
|
const expandable = (lineItem == null ? void 0 : lineItem.line_items) && lineItem.line_items.length > 0 ? true : false;
|
|
22915
23001
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
22916
|
-
return /* @__PURE__ */ jsxs125(
|
|
23002
|
+
return /* @__PURE__ */ jsxs125(Fragment23, { children: [
|
|
22917
23003
|
/* @__PURE__ */ jsxs125(
|
|
22918
23004
|
TableRow,
|
|
22919
23005
|
{
|
|
@@ -22947,7 +23033,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22947
23033
|
return /* @__PURE__ */ jsxs125(Table, { borderCollapse: "collapse", bottomSpacing: false, children: [
|
|
22948
23034
|
/* @__PURE__ */ jsx201(TableHead, { children: selectedCompareOptions && selectedCompareOptions.length > 1 && /* @__PURE__ */ jsxs125(TableRow, { rowKey: "", children: [
|
|
22949
23035
|
/* @__PURE__ */ jsx201(TableCell, { isHeaderCell: true }),
|
|
22950
|
-
selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxs125(
|
|
23036
|
+
selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxs125(Fragment23, { children: [
|
|
22951
23037
|
/* @__PURE__ */ jsx201(TableCell, { primary: true, isHeaderCell: true, children: option.displayName }, option.displayName + "-" + i),
|
|
22952
23038
|
comparePeriods && Array.from({ length: comparePeriods - 1 }, (_, index) => /* @__PURE__ */ jsx201(TableCell, { isHeaderCell: true }, option.displayName + "-" + index))
|
|
22953
23039
|
] }, option.displayName + "-" + i))
|
|
@@ -22955,7 +23041,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22955
23041
|
/* @__PURE__ */ jsxs125(TableBody, { children: [
|
|
22956
23042
|
comparePeriods && /* @__PURE__ */ jsxs125(TableRow, { rowKey: "", children: [
|
|
22957
23043
|
/* @__PURE__ */ jsx201(TableCell, { isHeaderCell: true }),
|
|
22958
|
-
selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsx201(
|
|
23044
|
+
selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsx201(Fragment23, { children: generateComparisonPeriods(
|
|
22959
23045
|
dateRange.startDate,
|
|
22960
23046
|
comparePeriods,
|
|
22961
23047
|
rangeDisplayMode
|
|
@@ -22963,7 +23049,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22963
23049
|
month.label,
|
|
22964
23050
|
" ",
|
|
22965
23051
|
getBookkeepingPeriodStatus(month.date)
|
|
22966
|
-
] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsx201(
|
|
23052
|
+
] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsx201(Fragment23, { children: generateComparisonPeriods(
|
|
22967
23053
|
dateRange.startDate,
|
|
22968
23054
|
comparePeriods,
|
|
22969
23055
|
rangeDisplayMode
|
|
@@ -22995,7 +23081,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22995
23081
|
};
|
|
22996
23082
|
|
|
22997
23083
|
// src/components/ProfitAndLossTable/ProfitAndLossTableComponent.tsx
|
|
22998
|
-
import { Fragment as
|
|
23084
|
+
import { Fragment as Fragment25, useContext as useContext35, useEffect as useEffect32 } from "react";
|
|
22999
23085
|
|
|
23000
23086
|
// src/icons/PieChart.tsx
|
|
23001
23087
|
import { jsx as jsx202, jsxs as jsxs126 } from "react/jsx-runtime";
|
|
@@ -23094,7 +23180,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
23094
23180
|
data: actualData,
|
|
23095
23181
|
isLoading,
|
|
23096
23182
|
setSidebarScope
|
|
23097
|
-
} =
|
|
23183
|
+
} = useContext35(ProfitAndLoss.Context);
|
|
23098
23184
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
23099
23185
|
useEffect32(() => {
|
|
23100
23186
|
setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
|
|
@@ -23116,7 +23202,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
23116
23202
|
const renderLineItem = (lineItem, depth, rowKey, rowIndex, scope, setSidebarScope2, variant) => {
|
|
23117
23203
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
23118
23204
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
23119
|
-
return /* @__PURE__ */ jsxs127(
|
|
23205
|
+
return /* @__PURE__ */ jsxs127(Fragment25, { children: [
|
|
23120
23206
|
/* @__PURE__ */ jsxs127(
|
|
23121
23207
|
TableRow,
|
|
23122
23208
|
{
|
|
@@ -23234,7 +23320,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
23234
23320
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
23235
23321
|
import { jsx as jsx204 } from "react/jsx-runtime";
|
|
23236
23322
|
var ProfitAndLossTableWithProvider = (props) => {
|
|
23237
|
-
const { compareModeActive } =
|
|
23323
|
+
const { compareModeActive } = useContext36(ProfitAndLoss.ComparisonContext);
|
|
23238
23324
|
return /* @__PURE__ */ jsx204(TableProvider, { children: compareModeActive ? /* @__PURE__ */ jsx204("div", { className: "Layer__compare__table__wrapper", children: /* @__PURE__ */ jsx204(ProfitAndLossCompareTable, __spreadValues({}, props)) }) : /* @__PURE__ */ jsx204(ProfitAndLossTableComponent, __spreadValues({}, props)) });
|
|
23239
23325
|
};
|
|
23240
23326
|
|
|
@@ -23339,10 +23425,10 @@ function useBalanceSheet({
|
|
|
23339
23425
|
}
|
|
23340
23426
|
|
|
23341
23427
|
// src/hooks/useElementViewSize/useElementViewSize.tsx
|
|
23342
|
-
import { useLayoutEffect as useLayoutEffect3, useRef as useRef22, useState as
|
|
23428
|
+
import { useLayoutEffect as useLayoutEffect3, useRef as useRef22, useState as useState49 } from "react";
|
|
23343
23429
|
var useElementViewSize = () => {
|
|
23344
23430
|
const containerRef = useRef22(null);
|
|
23345
|
-
const [view, setView] =
|
|
23431
|
+
const [view, setView] = useState49("desktop");
|
|
23346
23432
|
const resizeTimeout = useRef22(null);
|
|
23347
23433
|
useLayoutEffect3(() => {
|
|
23348
23434
|
const element = containerRef == null ? void 0 : containerRef.current;
|
|
@@ -23413,7 +23499,7 @@ var BalanceSheetExpandAllButton = ({
|
|
|
23413
23499
|
};
|
|
23414
23500
|
|
|
23415
23501
|
// src/components/BalanceSheetTable/BalanceSheetTable.tsx
|
|
23416
|
-
import { Fragment as
|
|
23502
|
+
import { Fragment as Fragment26, useEffect as useEffect33 } from "react";
|
|
23417
23503
|
import { jsx as jsx208, jsxs as jsxs128 } from "react/jsx-runtime";
|
|
23418
23504
|
var BalanceSheetTable = ({
|
|
23419
23505
|
data,
|
|
@@ -23437,7 +23523,7 @@ var BalanceSheetTable = ({
|
|
|
23437
23523
|
if (expandable) {
|
|
23438
23524
|
allRowKeys.push(rowKey);
|
|
23439
23525
|
}
|
|
23440
|
-
return /* @__PURE__ */ jsxs128(
|
|
23526
|
+
return /* @__PURE__ */ jsxs128(Fragment26, { children: [
|
|
23441
23527
|
/* @__PURE__ */ jsxs128(
|
|
23442
23528
|
TableRow,
|
|
23443
23529
|
{
|
|
@@ -23488,7 +23574,7 @@ var BalanceSheetTable = ({
|
|
|
23488
23574
|
/* @__PURE__ */ jsx208(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.typeColumnHeader) || "Type" }),
|
|
23489
23575
|
/* @__PURE__ */ jsx208(TableCell, { isHeaderCell: true, align: "right" /* RIGHT */, children: (stringOverrides == null ? void 0 : stringOverrides.totalColumnHeader) || "Total" })
|
|
23490
23576
|
] }) }),
|
|
23491
|
-
/* @__PURE__ */ jsx208(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx208(
|
|
23577
|
+
/* @__PURE__ */ jsx208(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx208(Fragment26, { children: data[row.lineItem] && renderLineItem(
|
|
23492
23578
|
data[row.lineItem],
|
|
23493
23579
|
0,
|
|
23494
23580
|
row.lineItem,
|
|
@@ -23562,7 +23648,7 @@ function useBalanceSheetDownload({
|
|
|
23562
23648
|
}
|
|
23563
23649
|
|
|
23564
23650
|
// src/components/BalanceSheet/download/BalanceSheetDownloadButton.tsx
|
|
23565
|
-
import { Fragment as
|
|
23651
|
+
import { Fragment as Fragment27, jsx as jsx209, jsxs as jsxs129 } from "react/jsx-runtime";
|
|
23566
23652
|
function BalanceSheetDownloadButton({
|
|
23567
23653
|
effectiveDate,
|
|
23568
23654
|
iconOnly
|
|
@@ -23572,7 +23658,7 @@ function BalanceSheetDownloadButton({
|
|
|
23572
23658
|
effectiveDate,
|
|
23573
23659
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
23574
23660
|
});
|
|
23575
|
-
return /* @__PURE__ */ jsxs129(
|
|
23661
|
+
return /* @__PURE__ */ jsxs129(Fragment27, { children: [
|
|
23576
23662
|
/* @__PURE__ */ jsx209(
|
|
23577
23663
|
DownloadButton,
|
|
23578
23664
|
{
|
|
@@ -23662,7 +23748,7 @@ var BalanceSheetView = ({
|
|
|
23662
23748
|
};
|
|
23663
23749
|
|
|
23664
23750
|
// src/components/StatementOfCashFlowTable/StatementOfCashFlowTable.tsx
|
|
23665
|
-
import { Fragment as
|
|
23751
|
+
import { Fragment as Fragment28 } from "react";
|
|
23666
23752
|
import { jsx as jsx211, jsxs as jsxs131 } from "react/jsx-runtime";
|
|
23667
23753
|
var StatementOfCashFlowTable = ({
|
|
23668
23754
|
data,
|
|
@@ -23673,7 +23759,7 @@ var StatementOfCashFlowTable = ({
|
|
|
23673
23759
|
const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
|
|
23674
23760
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
23675
23761
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
23676
|
-
return /* @__PURE__ */ jsxs131(
|
|
23762
|
+
return /* @__PURE__ */ jsxs131(Fragment28, { children: [
|
|
23677
23763
|
/* @__PURE__ */ jsxs131(
|
|
23678
23764
|
TableRow,
|
|
23679
23765
|
{
|
|
@@ -23725,7 +23811,7 @@ var StatementOfCashFlowTable = ({
|
|
|
23725
23811
|
] }) }),
|
|
23726
23812
|
/* @__PURE__ */ jsx211(TableBody, { children: config.map((row, idx) => {
|
|
23727
23813
|
if (row.type === "line_item") {
|
|
23728
|
-
return /* @__PURE__ */ jsx211(
|
|
23814
|
+
return /* @__PURE__ */ jsx211(Fragment28, { children: data[row.lineItem] && renderLineItem(
|
|
23729
23815
|
data[row.lineItem],
|
|
23730
23816
|
0,
|
|
23731
23817
|
row.lineItem ? row.lineItem : "",
|
|
@@ -23851,7 +23937,7 @@ function useCashflowStatementDownload({
|
|
|
23851
23937
|
}
|
|
23852
23938
|
|
|
23853
23939
|
// src/components/StatementOfCashFlow/download/CashflowStatementDownloadButton.tsx
|
|
23854
|
-
import { Fragment as
|
|
23940
|
+
import { Fragment as Fragment29, jsx as jsx212, jsxs as jsxs132 } from "react/jsx-runtime";
|
|
23855
23941
|
function CashflowStatementDownloadButton({
|
|
23856
23942
|
startDate,
|
|
23857
23943
|
endDate,
|
|
@@ -23863,7 +23949,7 @@ function CashflowStatementDownloadButton({
|
|
|
23863
23949
|
endDate,
|
|
23864
23950
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
23865
23951
|
});
|
|
23866
|
-
return /* @__PURE__ */ jsxs132(
|
|
23952
|
+
return /* @__PURE__ */ jsxs132(Fragment29, { children: [
|
|
23867
23953
|
/* @__PURE__ */ jsx212(
|
|
23868
23954
|
DownloadButton,
|
|
23869
23955
|
{
|
|
@@ -24027,7 +24113,7 @@ var StatementOfCashFlowView = ({
|
|
|
24027
24113
|
};
|
|
24028
24114
|
|
|
24029
24115
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
24030
|
-
import { useContext as
|
|
24116
|
+
import { useContext as useContext44 } from "react";
|
|
24031
24117
|
|
|
24032
24118
|
// src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
|
|
24033
24119
|
import { createContext as createContext17 } from "react";
|
|
@@ -24086,7 +24172,7 @@ var LedgerAccountsContext = createContext18({
|
|
|
24086
24172
|
});
|
|
24087
24173
|
|
|
24088
24174
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
24089
|
-
import { useEffect as useEffect34, useState as
|
|
24175
|
+
import { useEffect as useEffect34, useState as useState50 } from "react";
|
|
24090
24176
|
|
|
24091
24177
|
// src/components/ChartOfAccountsForm/constants.ts
|
|
24092
24178
|
var LEDGER_ACCOUNT_TYPES = [
|
|
@@ -24386,13 +24472,13 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
24386
24472
|
} = useLayerContext();
|
|
24387
24473
|
const { apiUrl } = useEnvironment();
|
|
24388
24474
|
const { data: auth } = useAuth();
|
|
24389
|
-
const [form, setForm] =
|
|
24390
|
-
const [sendingForm, setSendingForm] =
|
|
24391
|
-
const [apiError, setApiError] =
|
|
24392
|
-
const [startDate, setStartDate] =
|
|
24475
|
+
const [form, setForm] = useState50();
|
|
24476
|
+
const [sendingForm, setSendingForm] = useState50(false);
|
|
24477
|
+
const [apiError, setApiError] = useState50(void 0);
|
|
24478
|
+
const [startDate, setStartDate] = useState50(
|
|
24393
24479
|
initialStartDate != null ? initialStartDate : startOfMonth15(Date.now())
|
|
24394
24480
|
);
|
|
24395
|
-
const [endDate, setEndDate] =
|
|
24481
|
+
const [endDate, setEndDate] = useState50(
|
|
24396
24482
|
initialEndDate != null ? initialEndDate : endOfMonth12(Date.now())
|
|
24397
24483
|
);
|
|
24398
24484
|
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()}`;
|
|
@@ -24607,17 +24693,17 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
24607
24693
|
// src/hooks/useChartOfAccounts/useCreateChildAccount.tsx
|
|
24608
24694
|
import useSWRMutation9 from "swr/mutation";
|
|
24609
24695
|
import { useSWRConfig as useSWRConfig4 } from "swr";
|
|
24610
|
-
import { useCallback as
|
|
24696
|
+
import { useCallback as useCallback14 } from "react";
|
|
24611
24697
|
|
|
24612
24698
|
// src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
|
|
24613
|
-
import { useEffect as useEffect35, useState as
|
|
24699
|
+
import { useEffect as useEffect35, useState as useState51 } from "react";
|
|
24614
24700
|
import useSWR15 from "swr";
|
|
24615
24701
|
var useLedgerAccounts = (showReversalEntries = false) => {
|
|
24616
24702
|
const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
24617
24703
|
const { apiUrl } = useEnvironment();
|
|
24618
24704
|
const { data: auth } = useAuth();
|
|
24619
|
-
const [accountId, setAccountId] =
|
|
24620
|
-
const [selectedEntryId, setSelectedEntryId] =
|
|
24705
|
+
const [accountId, setAccountId] = useState51();
|
|
24706
|
+
const [selectedEntryId, setSelectedEntryId] = useState51();
|
|
24621
24707
|
const queryKey = businessId && accountId && (auth == null ? void 0 : auth.access_token) && `ledger-accounts-lines-${businessId}-${accountId}`;
|
|
24622
24708
|
const { data, isLoading, isValidating, error, mutate } = useSWR15(
|
|
24623
24709
|
queryKey,
|
|
@@ -24675,7 +24761,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
24675
24761
|
};
|
|
24676
24762
|
|
|
24677
24763
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
|
|
24678
|
-
import { useContext as
|
|
24764
|
+
import { useContext as useContext40, useState as useState53 } from "react";
|
|
24679
24765
|
|
|
24680
24766
|
// src/icons/Plus.tsx
|
|
24681
24767
|
import { jsx as jsx215, jsxs as jsxs134 } from "react/jsx-runtime";
|
|
@@ -24716,11 +24802,11 @@ var Plus = (_a) => {
|
|
|
24716
24802
|
var Plus_default = Plus;
|
|
24717
24803
|
|
|
24718
24804
|
// src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
|
|
24719
|
-
import { useContext as
|
|
24805
|
+
import { useContext as useContext37 } from "react";
|
|
24720
24806
|
import { endOfMonth as endOfMonth13, startOfMonth as startOfMonth16 } from "date-fns";
|
|
24721
24807
|
import { jsx as jsx216 } from "react/jsx-runtime";
|
|
24722
24808
|
var ChartOfAccountsDatePicker = () => {
|
|
24723
|
-
const { changeDateRange, dateRange } =
|
|
24809
|
+
const { changeDateRange, dateRange } = useContext37(ChartOfAccountsContext);
|
|
24724
24810
|
return /* @__PURE__ */ jsx216(
|
|
24725
24811
|
DatePicker,
|
|
24726
24812
|
{
|
|
@@ -24739,7 +24825,7 @@ var ChartOfAccountsDatePicker = () => {
|
|
|
24739
24825
|
};
|
|
24740
24826
|
|
|
24741
24827
|
// src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
|
|
24742
|
-
import { useContext as
|
|
24828
|
+
import { useContext as useContext38, useMemo as useMemo33 } from "react";
|
|
24743
24829
|
|
|
24744
24830
|
// src/components/ChartOfAccountsForm/useParentOptions.ts
|
|
24745
24831
|
import { useMemo as useMemo32 } from "react";
|
|
@@ -24770,7 +24856,7 @@ var ChartOfAccountsForm = ({
|
|
|
24770
24856
|
submitForm,
|
|
24771
24857
|
sendingForm,
|
|
24772
24858
|
apiError
|
|
24773
|
-
} =
|
|
24859
|
+
} = useContext38(ChartOfAccountsContext);
|
|
24774
24860
|
const parentOptions = useParentOptions(data);
|
|
24775
24861
|
const entry = useMemo33(() => {
|
|
24776
24862
|
if ((form == null ? void 0 : form.action) === "edit" && form.accountId) {
|
|
@@ -24985,7 +25071,7 @@ var ChartOfAccountsSidebar = ({
|
|
|
24985
25071
|
};
|
|
24986
25072
|
|
|
24987
25073
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
24988
|
-
import { Fragment as
|
|
25074
|
+
import { Fragment as Fragment30, useContext as useContext39, useEffect as useEffect36, useState as useState52 } from "react";
|
|
24989
25075
|
|
|
24990
25076
|
// src/icons/Edit2.tsx
|
|
24991
25077
|
import { jsx as jsx219 } from "react/jsx-runtime";
|
|
@@ -25045,10 +25131,10 @@ var ChartOfAccountsTableContent = ({
|
|
|
25045
25131
|
expandAll,
|
|
25046
25132
|
templateAccountsEditable
|
|
25047
25133
|
}) => {
|
|
25048
|
-
const { setAccountId } =
|
|
25049
|
-
const { editAccount } =
|
|
25134
|
+
const { setAccountId } = useContext39(LedgerAccountsContext);
|
|
25135
|
+
const { editAccount } = useContext39(ChartOfAccountsContext);
|
|
25050
25136
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
25051
|
-
const [accountsRowKeys, setAccountsRowKeys] =
|
|
25137
|
+
const [accountsRowKeys, setAccountsRowKeys] = useState52([]);
|
|
25052
25138
|
useEffect36(() => {
|
|
25053
25139
|
if (expandAll === "expanded") {
|
|
25054
25140
|
setIsOpen(accountsRowKeys);
|
|
@@ -25075,7 +25161,7 @@ var ChartOfAccountsTableContent = ({
|
|
|
25075
25161
|
var _a, _b;
|
|
25076
25162
|
const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
25077
25163
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
25078
|
-
return /* @__PURE__ */ jsxs136(
|
|
25164
|
+
return /* @__PURE__ */ jsxs136(Fragment30, { children: [
|
|
25079
25165
|
/* @__PURE__ */ jsxs136(
|
|
25080
25166
|
TableRow,
|
|
25081
25167
|
{
|
|
@@ -25207,7 +25293,7 @@ function useAccountBalancesDownload({
|
|
|
25207
25293
|
}
|
|
25208
25294
|
|
|
25209
25295
|
// src/components/ChartOfAccounts/download/AccountBalancesDownloadButton.tsx
|
|
25210
|
-
import { Fragment as
|
|
25296
|
+
import { Fragment as Fragment31, jsx as jsx221, jsxs as jsxs137 } from "react/jsx-runtime";
|
|
25211
25297
|
function AccountBalancesDownloadButton({
|
|
25212
25298
|
startCutoff,
|
|
25213
25299
|
endCutoff,
|
|
@@ -25219,7 +25305,7 @@ function AccountBalancesDownloadButton({
|
|
|
25219
25305
|
endCutoff,
|
|
25220
25306
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
25221
25307
|
});
|
|
25222
|
-
return /* @__PURE__ */ jsxs137(
|
|
25308
|
+
return /* @__PURE__ */ jsxs137(Fragment31, { children: [
|
|
25223
25309
|
/* @__PURE__ */ jsx221(
|
|
25224
25310
|
DownloadButton,
|
|
25225
25311
|
{
|
|
@@ -25251,8 +25337,8 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
25251
25337
|
templateAccountsEditable
|
|
25252
25338
|
}) => {
|
|
25253
25339
|
var _a;
|
|
25254
|
-
const { data, isLoading, addAccount, error, isValidating, refetch, form } =
|
|
25255
|
-
const [expandAll, setExpandAll] =
|
|
25340
|
+
const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext40(ChartOfAccountsContext);
|
|
25341
|
+
const [expandAll, setExpandAll] = useState53();
|
|
25256
25342
|
const cumulativeIndex = 0;
|
|
25257
25343
|
const accountsLength = (_a = data == null ? void 0 : data.accounts.length) != null ? _a : 0;
|
|
25258
25344
|
return /* @__PURE__ */ jsxs138(
|
|
@@ -25358,14 +25444,14 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
25358
25444
|
|
|
25359
25445
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
25360
25446
|
import {
|
|
25361
|
-
useContext as
|
|
25447
|
+
useContext as useContext43,
|
|
25362
25448
|
useEffect as useEffect38,
|
|
25363
25449
|
useMemo as useMemo35,
|
|
25364
|
-
useState as
|
|
25450
|
+
useState as useState55
|
|
25365
25451
|
} from "react";
|
|
25366
25452
|
|
|
25367
25453
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
25368
|
-
import { useContext as
|
|
25454
|
+
import { useContext as useContext41, useMemo as useMemo34 } from "react";
|
|
25369
25455
|
|
|
25370
25456
|
// src/utils/journal.ts
|
|
25371
25457
|
var getAccountIdentifierPayload = (journalLineItem) => {
|
|
@@ -25397,14 +25483,14 @@ import { parseISO as parseISO13, format as formatTime10 } from "date-fns";
|
|
|
25397
25483
|
import { jsx as jsx223, jsxs as jsxs139 } from "react/jsx-runtime";
|
|
25398
25484
|
var DateTime = ({
|
|
25399
25485
|
value,
|
|
25400
|
-
format:
|
|
25486
|
+
format: format8,
|
|
25401
25487
|
dateFormat,
|
|
25402
25488
|
timeFormat,
|
|
25403
25489
|
onlyDate,
|
|
25404
25490
|
onlyTime
|
|
25405
25491
|
}) => {
|
|
25406
|
-
if (
|
|
25407
|
-
return /* @__PURE__ */ jsx223(Text, { className: "Layer__datetime", children: formatTime10(parseISO13(value),
|
|
25492
|
+
if (format8) {
|
|
25493
|
+
return /* @__PURE__ */ jsx223(Text, { className: "Layer__datetime", children: formatTime10(parseISO13(value), format8) });
|
|
25408
25494
|
}
|
|
25409
25495
|
const date = formatTime10(parseISO13(value), dateFormat != null ? dateFormat : DATE_FORMAT);
|
|
25410
25496
|
const time = formatTime10(parseISO13(value), timeFormat != null ? timeFormat : TIME_FORMAT);
|
|
@@ -25471,7 +25557,7 @@ var DetailsListItem = ({
|
|
|
25471
25557
|
};
|
|
25472
25558
|
|
|
25473
25559
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
25474
|
-
import { Fragment as
|
|
25560
|
+
import { Fragment as Fragment32, jsx as jsx226, jsxs as jsxs142 } from "react/jsx-runtime";
|
|
25475
25561
|
var SourceDetailView = ({
|
|
25476
25562
|
source,
|
|
25477
25563
|
stringOverrides
|
|
@@ -25479,7 +25565,7 @@ var SourceDetailView = ({
|
|
|
25479
25565
|
switch (source.type) {
|
|
25480
25566
|
case "Transaction_Ledger_Entry_Source": {
|
|
25481
25567
|
const transactionSource = source;
|
|
25482
|
-
return /* @__PURE__ */ jsxs142(
|
|
25568
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25483
25569
|
/* @__PURE__ */ jsx226(
|
|
25484
25570
|
DetailsListItem,
|
|
25485
25571
|
{
|
|
@@ -25507,7 +25593,7 @@ var SourceDetailView = ({
|
|
|
25507
25593
|
}
|
|
25508
25594
|
case "Invoice_Ledger_Entry_Source": {
|
|
25509
25595
|
const invoiceSource = source;
|
|
25510
|
-
return /* @__PURE__ */ jsxs142(
|
|
25596
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25511
25597
|
/* @__PURE__ */ jsx226(
|
|
25512
25598
|
DetailsListItem,
|
|
25513
25599
|
{
|
|
@@ -25528,7 +25614,7 @@ var SourceDetailView = ({
|
|
|
25528
25614
|
}
|
|
25529
25615
|
case "Manual_Ledger_Entry_Source": {
|
|
25530
25616
|
const manualSource = source;
|
|
25531
|
-
return /* @__PURE__ */ jsxs142(
|
|
25617
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25532
25618
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.memoLabel) || "Memo", children: manualSource.memo }),
|
|
25533
25619
|
/* @__PURE__ */ jsx226(
|
|
25534
25620
|
DetailsListItem,
|
|
@@ -25541,7 +25627,7 @@ var SourceDetailView = ({
|
|
|
25541
25627
|
}
|
|
25542
25628
|
case "Invoice_Payment_Ledger_Entry_Source": {
|
|
25543
25629
|
const invoicePaymentSource = source;
|
|
25544
|
-
return /* @__PURE__ */ jsxs142(
|
|
25630
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25545
25631
|
/* @__PURE__ */ jsx226(
|
|
25546
25632
|
DetailsListItem,
|
|
25547
25633
|
{
|
|
@@ -25554,7 +25640,7 @@ var SourceDetailView = ({
|
|
|
25554
25640
|
}
|
|
25555
25641
|
case "Refund_Ledger_Entry_Source": {
|
|
25556
25642
|
const refundSource = source;
|
|
25557
|
-
return /* @__PURE__ */ jsxs142(
|
|
25643
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25558
25644
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(refundSource.refunded_to_customer_amount)}` }),
|
|
25559
25645
|
/* @__PURE__ */ jsx226(
|
|
25560
25646
|
DetailsListItem,
|
|
@@ -25567,7 +25653,7 @@ var SourceDetailView = ({
|
|
|
25567
25653
|
}
|
|
25568
25654
|
case "Refund_Payment_Ledger_Entry_Source": {
|
|
25569
25655
|
const refundSource = source;
|
|
25570
|
-
return /* @__PURE__ */ jsxs142(
|
|
25656
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25571
25657
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(refundSource.refunded_to_customer_amount)}` }),
|
|
25572
25658
|
/* @__PURE__ */ jsx226(
|
|
25573
25659
|
DetailsListItem,
|
|
@@ -25580,7 +25666,7 @@ var SourceDetailView = ({
|
|
|
25580
25666
|
}
|
|
25581
25667
|
case "Opening_Balance_Ledger_Entry_Source": {
|
|
25582
25668
|
const openingBalanceSource = source;
|
|
25583
|
-
return /* @__PURE__ */ jsx226(
|
|
25669
|
+
return /* @__PURE__ */ jsx226(Fragment32, { children: /* @__PURE__ */ jsx226(
|
|
25584
25670
|
DetailsListItem,
|
|
25585
25671
|
{
|
|
25586
25672
|
label: (stringOverrides == null ? void 0 : stringOverrides.accountNameLabel) || "Account name",
|
|
@@ -25590,7 +25676,7 @@ var SourceDetailView = ({
|
|
|
25590
25676
|
}
|
|
25591
25677
|
case "Payout_Ledger_Entry_Source": {
|
|
25592
25678
|
const payoutSource = source;
|
|
25593
|
-
return /* @__PURE__ */ jsxs142(
|
|
25679
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25594
25680
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(payoutSource.paid_out_amount)}` }),
|
|
25595
25681
|
/* @__PURE__ */ jsx226(
|
|
25596
25682
|
DetailsListItem,
|
|
@@ -25609,7 +25695,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
25609
25695
|
stringOverrides
|
|
25610
25696
|
}) => {
|
|
25611
25697
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
25612
|
-
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } =
|
|
25698
|
+
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = useContext41(LedgerAccountsContext);
|
|
25613
25699
|
const { totalDebit, totalCredit } = useMemo34(() => {
|
|
25614
25700
|
var _a2;
|
|
25615
25701
|
let totalDebit2 = 0;
|
|
@@ -25756,7 +25842,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
25756
25842
|
};
|
|
25757
25843
|
|
|
25758
25844
|
// src/components/LedgerAccount/LedgerAccountRow.tsx
|
|
25759
|
-
import { useContext as
|
|
25845
|
+
import { useContext as useContext42, useEffect as useEffect37, useState as useState54 } from "react";
|
|
25760
25846
|
import classNames67 from "classnames";
|
|
25761
25847
|
import { parseISO as parseISO14, format as formatTime11 } from "date-fns";
|
|
25762
25848
|
import { jsx as jsx227, jsxs as jsxs143 } from "react/jsx-runtime";
|
|
@@ -25767,8 +25853,8 @@ var LedgerAccountRow = ({
|
|
|
25767
25853
|
view
|
|
25768
25854
|
}) => {
|
|
25769
25855
|
var _a, _b, _c, _d, _e, _f;
|
|
25770
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } =
|
|
25771
|
-
const [showComponent, setShowComponent] =
|
|
25856
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext42(LedgerAccountsContext);
|
|
25857
|
+
const [showComponent, setShowComponent] = useState54(false);
|
|
25772
25858
|
useEffect37(() => {
|
|
25773
25859
|
if (initialLoad) {
|
|
25774
25860
|
const timeoutId = setTimeout(() => {
|
|
@@ -25905,7 +25991,7 @@ var LedgerAccountRow = ({
|
|
|
25905
25991
|
|
|
25906
25992
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
25907
25993
|
import classNames68 from "classnames";
|
|
25908
|
-
import { Fragment as
|
|
25994
|
+
import { Fragment as Fragment33, jsx as jsx228, jsxs as jsxs144 } from "react/jsx-runtime";
|
|
25909
25995
|
var LedgerAccount = ({
|
|
25910
25996
|
containerRef,
|
|
25911
25997
|
pageSize = 15,
|
|
@@ -25913,9 +25999,9 @@ var LedgerAccount = ({
|
|
|
25913
25999
|
stringOverrides
|
|
25914
26000
|
}) => {
|
|
25915
26001
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
25916
|
-
const [currentPage, setCurrentPage] =
|
|
25917
|
-
const [initialLoad, setInitialLoad] =
|
|
25918
|
-
const { data: accountData } =
|
|
26002
|
+
const [currentPage, setCurrentPage] = useState55(1);
|
|
26003
|
+
const [initialLoad, setInitialLoad] = useState55(true);
|
|
26004
|
+
const { data: accountData } = useContext43(ChartOfAccountsContext);
|
|
25919
26005
|
const {
|
|
25920
26006
|
data: rawData,
|
|
25921
26007
|
error,
|
|
@@ -25926,7 +26012,7 @@ var LedgerAccount = ({
|
|
|
25926
26012
|
selectedEntryId,
|
|
25927
26013
|
closeSelectedEntry,
|
|
25928
26014
|
refetch
|
|
25929
|
-
} =
|
|
26015
|
+
} = useContext43(LedgerAccountsContext);
|
|
25930
26016
|
useEffect38(() => {
|
|
25931
26017
|
if (!isLoading) {
|
|
25932
26018
|
const timeoutLoad = setTimeout(() => {
|
|
@@ -26004,12 +26090,12 @@ var LedgerAccount = ({
|
|
|
26004
26090
|
/* @__PURE__ */ jsxs144("table", { className: "Layer__table Layer__table--hover-effect Layer__ledger-account-table", children: [
|
|
26005
26091
|
/* @__PURE__ */ jsx228("thead", { children: /* @__PURE__ */ jsxs144("tr", { children: [
|
|
26006
26092
|
view !== "desktop" && /* @__PURE__ */ jsx228("th", {}),
|
|
26007
|
-
view === "desktop" && /* @__PURE__ */ jsxs144(
|
|
26093
|
+
view === "desktop" && /* @__PURE__ */ jsxs144(Fragment33, { children: [
|
|
26008
26094
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header", children: ((_b = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _b.dateColumnHeader) || "Date" }),
|
|
26009
26095
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header", children: ((_c = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _c.journalIdColumnHeader) || "Journal id #" }),
|
|
26010
26096
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header", children: ((_d = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _d.sourceColumnHeader) || "Source" })
|
|
26011
26097
|
] }),
|
|
26012
|
-
view !== "mobile" && /* @__PURE__ */ jsxs144(
|
|
26098
|
+
view !== "mobile" && /* @__PURE__ */ jsxs144(Fragment33, { children: [
|
|
26013
26099
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_e = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _e.debitColumnHeader) || "Debit" }),
|
|
26014
26100
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_f = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _f.creditColumnHeader) || "Credit" }),
|
|
26015
26101
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_g = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _g.runningBalanceColumnHeader) || "Running balance" })
|
|
@@ -26082,7 +26168,7 @@ var ChartOfAccountsContent = ({
|
|
|
26082
26168
|
templateAccountsEditable,
|
|
26083
26169
|
showAddAccountButton
|
|
26084
26170
|
}) => {
|
|
26085
|
-
const { accountId } =
|
|
26171
|
+
const { accountId } = useContext44(LedgerAccountsContext);
|
|
26086
26172
|
const { view, containerRef } = useElementViewSize();
|
|
26087
26173
|
return /* @__PURE__ */ jsx229(Container, { name: "chart-of-accounts", ref: containerRef, asWidget, children: accountId ? /* @__PURE__ */ jsx229(
|
|
26088
26174
|
LedgerAccount,
|
|
@@ -26142,7 +26228,7 @@ var JournalContext = createContext19({
|
|
|
26142
26228
|
});
|
|
26143
26229
|
|
|
26144
26230
|
// src/hooks/useJournal/useJournal.tsx
|
|
26145
|
-
import { useEffect as useEffect39, useState as
|
|
26231
|
+
import { useEffect as useEffect39, useState as useState56 } from "react";
|
|
26146
26232
|
import useSWR16 from "swr";
|
|
26147
26233
|
var useJournal = () => {
|
|
26148
26234
|
const {
|
|
@@ -26154,11 +26240,11 @@ var useJournal = () => {
|
|
|
26154
26240
|
} = useLayerContext();
|
|
26155
26241
|
const { apiUrl } = useEnvironment();
|
|
26156
26242
|
const { data: auth } = useAuth();
|
|
26157
|
-
const [selectedEntryId, setSelectedEntryId] =
|
|
26158
|
-
const [form, setForm] =
|
|
26159
|
-
const [addingEntry, setAddingEntry] =
|
|
26160
|
-
const [sendingForm, setSendingForm] =
|
|
26161
|
-
const [apiError, setApiError] =
|
|
26243
|
+
const [selectedEntryId, setSelectedEntryId] = useState56();
|
|
26244
|
+
const [form, setForm] = useState56();
|
|
26245
|
+
const [addingEntry, setAddingEntry] = useState56(false);
|
|
26246
|
+
const [sendingForm, setSendingForm] = useState56(false);
|
|
26247
|
+
const [apiError, setApiError] = useState56(void 0);
|
|
26162
26248
|
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `journal-lines-${businessId}`;
|
|
26163
26249
|
const { data, isLoading, isValidating, error, mutate } = useSWR16(
|
|
26164
26250
|
queryKey,
|
|
@@ -26411,13 +26497,13 @@ var useJournal = () => {
|
|
|
26411
26497
|
};
|
|
26412
26498
|
|
|
26413
26499
|
// src/components/JournalTable/JournalTableWithPanel.tsx
|
|
26414
|
-
import { useContext as
|
|
26500
|
+
import { useContext as useContext50, useMemo as useMemo38, useState as useState58 } from "react";
|
|
26415
26501
|
|
|
26416
26502
|
// src/components/JournalSidebar/JournalSidebar.tsx
|
|
26417
|
-
import { useContext as
|
|
26503
|
+
import { useContext as useContext48 } from "react";
|
|
26418
26504
|
|
|
26419
26505
|
// src/components/JournalEntryDetails/JournalEntryDetails.tsx
|
|
26420
|
-
import { useContext as
|
|
26506
|
+
import { useContext as useContext45, useMemo as useMemo36, useState as useState57 } from "react";
|
|
26421
26507
|
import { jsx as jsx230, jsxs as jsxs145 } from "react/jsx-runtime";
|
|
26422
26508
|
var JournalEntryDetails = () => {
|
|
26423
26509
|
var _a, _b, _c, _d;
|
|
@@ -26429,9 +26515,9 @@ var JournalEntryDetails = () => {
|
|
|
26429
26515
|
selectedEntryId,
|
|
26430
26516
|
reverseEntry,
|
|
26431
26517
|
refetch
|
|
26432
|
-
} =
|
|
26433
|
-
const [reverseEntryProcessing, setReverseEntryProcessing] =
|
|
26434
|
-
const [reverseEntryError, setReverseEntryError] =
|
|
26518
|
+
} = useContext45(JournalContext);
|
|
26519
|
+
const [reverseEntryProcessing, setReverseEntryProcessing] = useState57(false);
|
|
26520
|
+
const [reverseEntryError, setReverseEntryError] = useState57();
|
|
26435
26521
|
const entry = useMemo36(() => {
|
|
26436
26522
|
if (selectedEntryId && data) {
|
|
26437
26523
|
return data.find((x) => x.id === selectedEntryId);
|
|
@@ -26616,11 +26702,11 @@ var JournalEntryDetails = () => {
|
|
|
26616
26702
|
};
|
|
26617
26703
|
|
|
26618
26704
|
// src/components/JournalForm/JournalForm.tsx
|
|
26619
|
-
import { useContext as
|
|
26705
|
+
import { useContext as useContext47 } from "react";
|
|
26620
26706
|
|
|
26621
26707
|
// src/components/JournalForm/JournalFormEntryLines.tsx
|
|
26622
|
-
import { useContext as
|
|
26623
|
-
import { Fragment as
|
|
26708
|
+
import { useContext as useContext46, useMemo as useMemo37 } from "react";
|
|
26709
|
+
import { Fragment as Fragment34, jsx as jsx231, jsxs as jsxs146 } from "react/jsx-runtime";
|
|
26624
26710
|
function recursiveFlattenCategories(accounts) {
|
|
26625
26711
|
const flattenedResult = accounts.flatMap((a) => {
|
|
26626
26712
|
var _a;
|
|
@@ -26640,7 +26726,7 @@ var JournalFormEntryLines = ({
|
|
|
26640
26726
|
config
|
|
26641
26727
|
}) => {
|
|
26642
26728
|
const { data: categories } = useCategories({ mode: "ALL" });
|
|
26643
|
-
const { form } =
|
|
26729
|
+
const { form } = useContext46(JournalContext);
|
|
26644
26730
|
const { flattenedCategories, parentOptions } = useMemo37(() => {
|
|
26645
26731
|
const flattenedCategories2 = recursiveFlattenCategories(categories != null ? categories : []);
|
|
26646
26732
|
const parentOptions2 = [...flattenedCategories2].sort((a, b) => a.display_name.localeCompare(b.display_name)).map((account) => {
|
|
@@ -26721,7 +26807,7 @@ var JournalFormEntryLines = ({
|
|
|
26721
26807
|
]
|
|
26722
26808
|
);
|
|
26723
26809
|
};
|
|
26724
|
-
return /* @__PURE__ */ jsx231(
|
|
26810
|
+
return /* @__PURE__ */ jsx231(Fragment34, { children: ["DEBIT", "CREDIT"].map((direction, idx) => {
|
|
26725
26811
|
return /* @__PURE__ */ jsxs146(
|
|
26726
26812
|
"div",
|
|
26727
26813
|
{
|
|
@@ -26853,7 +26939,7 @@ var JournalForm = ({
|
|
|
26853
26939
|
changeFormData,
|
|
26854
26940
|
addEntryLine,
|
|
26855
26941
|
removeEntryLine
|
|
26856
|
-
} =
|
|
26942
|
+
} = useContext47(JournalContext);
|
|
26857
26943
|
return /* @__PURE__ */ jsxs147(
|
|
26858
26944
|
"form",
|
|
26859
26945
|
{
|
|
@@ -27001,7 +27087,7 @@ var JournalSidebar = ({
|
|
|
27001
27087
|
config,
|
|
27002
27088
|
stringOverrides
|
|
27003
27089
|
}) => {
|
|
27004
|
-
const { selectedEntryId } =
|
|
27090
|
+
const { selectedEntryId } = useContext48(JournalContext);
|
|
27005
27091
|
if (selectedEntryId !== "new") {
|
|
27006
27092
|
return /* @__PURE__ */ jsx233(JournalEntryDetails, {});
|
|
27007
27093
|
}
|
|
@@ -27009,7 +27095,7 @@ var JournalSidebar = ({
|
|
|
27009
27095
|
};
|
|
27010
27096
|
|
|
27011
27097
|
// src/components/JournalTable/JournalTable.tsx
|
|
27012
|
-
import { Fragment as
|
|
27098
|
+
import { Fragment as Fragment35, useContext as useContext49, useEffect as useEffect40 } from "react";
|
|
27013
27099
|
import { parseISO as parseISO15, format as formatTime12 } from "date-fns";
|
|
27014
27100
|
import { jsx as jsx234, jsxs as jsxs148 } from "react/jsx-runtime";
|
|
27015
27101
|
var accountName = (row) => {
|
|
@@ -27037,7 +27123,7 @@ var JournalTableContent = ({
|
|
|
27037
27123
|
data,
|
|
27038
27124
|
stringOverrides
|
|
27039
27125
|
}) => {
|
|
27040
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } =
|
|
27126
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext49(JournalContext);
|
|
27041
27127
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
27042
27128
|
useEffect40(() => {
|
|
27043
27129
|
if (data.length > 0) {
|
|
@@ -27047,7 +27133,7 @@ var JournalTableContent = ({
|
|
|
27047
27133
|
const renderJournalRow = (row, index, rowKey, depth) => {
|
|
27048
27134
|
const expandable = !!row.line_items && row.line_items.length > 0;
|
|
27049
27135
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
27050
|
-
return /* @__PURE__ */ jsxs148(
|
|
27136
|
+
return /* @__PURE__ */ jsxs148(Fragment35, { children: [
|
|
27051
27137
|
/* @__PURE__ */ jsxs148(
|
|
27052
27138
|
TableRow,
|
|
27053
27139
|
{
|
|
@@ -27183,7 +27269,7 @@ function useJournalEntriesDownload({
|
|
|
27183
27269
|
}
|
|
27184
27270
|
|
|
27185
27271
|
// src/components/Journal/download/JournalEntriesDownloadButton.tsx
|
|
27186
|
-
import { Fragment as
|
|
27272
|
+
import { Fragment as Fragment36, jsx as jsx235, jsxs as jsxs149 } from "react/jsx-runtime";
|
|
27187
27273
|
function JournalEntriesDownloadButton({
|
|
27188
27274
|
startCutoff,
|
|
27189
27275
|
endCutoff,
|
|
@@ -27195,7 +27281,7 @@ function JournalEntriesDownloadButton({
|
|
|
27195
27281
|
endCutoff,
|
|
27196
27282
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
27197
27283
|
});
|
|
27198
|
-
return /* @__PURE__ */ jsxs149(
|
|
27284
|
+
return /* @__PURE__ */ jsxs149(Fragment36, { children: [
|
|
27199
27285
|
/* @__PURE__ */ jsx235(
|
|
27200
27286
|
DownloadButton,
|
|
27201
27287
|
{
|
|
@@ -27223,7 +27309,7 @@ var JournalTableWithPanel = ({
|
|
|
27223
27309
|
stringOverrides,
|
|
27224
27310
|
view
|
|
27225
27311
|
}) => {
|
|
27226
|
-
const [currentPage, setCurrentPage] =
|
|
27312
|
+
const [currentPage, setCurrentPage] = useState58(1);
|
|
27227
27313
|
const {
|
|
27228
27314
|
data: rawData,
|
|
27229
27315
|
isLoading,
|
|
@@ -27232,7 +27318,7 @@ var JournalTableWithPanel = ({
|
|
|
27232
27318
|
refetch,
|
|
27233
27319
|
selectedEntryId,
|
|
27234
27320
|
addEntry
|
|
27235
|
-
} =
|
|
27321
|
+
} = useContext50(JournalContext);
|
|
27236
27322
|
const data = useMemo38(() => {
|
|
27237
27323
|
var _a;
|
|
27238
27324
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
@@ -27429,7 +27515,7 @@ var SmileIcon = (_a) => {
|
|
|
27429
27515
|
var SmileIcon_default = SmileIcon;
|
|
27430
27516
|
|
|
27431
27517
|
// src/components/Tasks/TasksListItem.tsx
|
|
27432
|
-
import { useEffect as useEffect41, useMemo as useMemo39, useState as
|
|
27518
|
+
import { useEffect as useEffect41, useMemo as useMemo39, useState as useState59 } from "react";
|
|
27433
27519
|
import classNames69 from "classnames";
|
|
27434
27520
|
|
|
27435
27521
|
// src/utils/bookkeeping/tasks/getBookkeepingTaskStatusIcon.tsx
|
|
@@ -27487,7 +27573,7 @@ function completeTaskWithUpload(baseUrl, accessToken, {
|
|
|
27487
27573
|
}
|
|
27488
27574
|
|
|
27489
27575
|
// src/hooks/bookkeeping/periods/tasks/useSubmitResponseForTask.ts
|
|
27490
|
-
import { useCallback as
|
|
27576
|
+
import { useCallback as useCallback15 } from "react";
|
|
27491
27577
|
function buildKey21({
|
|
27492
27578
|
access_token: accessToken,
|
|
27493
27579
|
apiUrl,
|
|
@@ -27530,7 +27616,7 @@ function useSubmitUserResponseForTask() {
|
|
|
27530
27616
|
}
|
|
27531
27617
|
);
|
|
27532
27618
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27533
|
-
const stableProxiedTrigger =
|
|
27619
|
+
const stableProxiedTrigger = useCallback15(
|
|
27534
27620
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27535
27621
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27536
27622
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27557,7 +27643,7 @@ function useSubmitUserResponseForTask() {
|
|
|
27557
27643
|
// src/hooks/bookkeeping/periods/tasks/useUploadDocumentsForTask.ts
|
|
27558
27644
|
import { useSWRConfig as useSWRConfig6 } from "swr";
|
|
27559
27645
|
import useSWRMutation13 from "swr/mutation";
|
|
27560
|
-
import { useCallback as
|
|
27646
|
+
import { useCallback as useCallback16 } from "react";
|
|
27561
27647
|
function buildKey22({
|
|
27562
27648
|
access_token: accessToken,
|
|
27563
27649
|
apiUrl,
|
|
@@ -27596,7 +27682,7 @@ function useUploadDocumentsForTask() {
|
|
|
27596
27682
|
}
|
|
27597
27683
|
);
|
|
27598
27684
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27599
|
-
const stableProxiedTrigger =
|
|
27685
|
+
const stableProxiedTrigger = useCallback16(
|
|
27600
27686
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27601
27687
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27602
27688
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27623,7 +27709,7 @@ function useUploadDocumentsForTask() {
|
|
|
27623
27709
|
// src/hooks/bookkeeping/periods/tasks/useDeleteUploadsOnTask.ts
|
|
27624
27710
|
import { useSWRConfig as useSWRConfig7 } from "swr";
|
|
27625
27711
|
import useSWRMutation14 from "swr/mutation";
|
|
27626
|
-
import { useCallback as
|
|
27712
|
+
import { useCallback as useCallback17 } from "react";
|
|
27627
27713
|
function buildKey23({
|
|
27628
27714
|
access_token: accessToken,
|
|
27629
27715
|
apiUrl,
|
|
@@ -27659,7 +27745,7 @@ function useDeleteUploadsOnTask() {
|
|
|
27659
27745
|
}
|
|
27660
27746
|
);
|
|
27661
27747
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27662
|
-
const stableProxiedTrigger =
|
|
27748
|
+
const stableProxiedTrigger = useCallback17(
|
|
27663
27749
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27664
27750
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27665
27751
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27686,7 +27772,7 @@ function useDeleteUploadsOnTask() {
|
|
|
27686
27772
|
// src/hooks/bookkeeping/periods/tasks/useUpdateTaskUploadDescription.ts
|
|
27687
27773
|
import { useSWRConfig as useSWRConfig8 } from "swr";
|
|
27688
27774
|
import useSWRMutation15 from "swr/mutation";
|
|
27689
|
-
import { useCallback as
|
|
27775
|
+
import { useCallback as useCallback18 } from "react";
|
|
27690
27776
|
function buildKey24({
|
|
27691
27777
|
access_token: accessToken,
|
|
27692
27778
|
apiUrl,
|
|
@@ -27726,7 +27812,7 @@ function useUpdateTaskUploadDescription() {
|
|
|
27726
27812
|
}
|
|
27727
27813
|
);
|
|
27728
27814
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27729
|
-
const stableProxiedTrigger =
|
|
27815
|
+
const stableProxiedTrigger = useCallback18(
|
|
27730
27816
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27731
27817
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27732
27818
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27751,15 +27837,15 @@ function useUpdateTaskUploadDescription() {
|
|
|
27751
27837
|
}
|
|
27752
27838
|
|
|
27753
27839
|
// src/components/Tasks/TasksListItem.tsx
|
|
27754
|
-
import { Fragment as
|
|
27840
|
+
import { Fragment as Fragment37, jsx as jsx241, jsxs as jsxs152 } from "react/jsx-runtime";
|
|
27755
27841
|
var TasksListItem = ({
|
|
27756
27842
|
task,
|
|
27757
27843
|
defaultOpen
|
|
27758
27844
|
}) => {
|
|
27759
27845
|
var _a, _b;
|
|
27760
|
-
const [isOpen, setIsOpen] =
|
|
27761
|
-
const [userResponse, setUserResponse] =
|
|
27762
|
-
const [selectedFiles, setSelectedFiles] =
|
|
27846
|
+
const [isOpen, setIsOpen] = useState59(defaultOpen);
|
|
27847
|
+
const [userResponse, setUserResponse] = useState59((_a = task.user_response) != null ? _a : "");
|
|
27848
|
+
const [selectedFiles, setSelectedFiles] = useState59();
|
|
27763
27849
|
const { trigger: handleSubmitUserResponseForTask } = useSubmitUserResponseForTask();
|
|
27764
27850
|
const { trigger: handleUploadDocumentsForTask } = useUploadDocumentsForTask();
|
|
27765
27851
|
const { trigger: handleDeleteUploadsOnTask } = useDeleteUploadsOnTask();
|
|
@@ -27807,7 +27893,7 @@ var TasksListItem = ({
|
|
|
27807
27893
|
}
|
|
27808
27894
|
);
|
|
27809
27895
|
} else {
|
|
27810
|
-
return /* @__PURE__ */ jsxs152(
|
|
27896
|
+
return /* @__PURE__ */ jsxs152(Fragment37, { children: [
|
|
27811
27897
|
/* @__PURE__ */ jsx241(
|
|
27812
27898
|
Button,
|
|
27813
27899
|
{
|
|
@@ -27937,7 +28023,7 @@ var MobilePanel = ({ header, children, open: open2, onClose, className }) => {
|
|
|
27937
28023
|
};
|
|
27938
28024
|
|
|
27939
28025
|
// src/components/Tasks/TasksListMobile.tsx
|
|
27940
|
-
import { useState as
|
|
28026
|
+
import { useState as useState60 } from "react";
|
|
27941
28027
|
import { jsx as jsx243, jsxs as jsxs154 } from "react/jsx-runtime";
|
|
27942
28028
|
var MOBILE_SHOW_UNRESOLVED_TASKS_COUNT = 2;
|
|
27943
28029
|
var TasksListMobile = ({
|
|
@@ -27948,7 +28034,7 @@ var TasksListMobile = ({
|
|
|
27948
28034
|
pageSize,
|
|
27949
28035
|
setCurrentPage
|
|
27950
28036
|
}) => {
|
|
27951
|
-
const [showMobilePanel, setShowMobilePanel] =
|
|
28037
|
+
const [showMobilePanel, setShowMobilePanel] = useState60(false);
|
|
27952
28038
|
const unresolvedTasks = getIncompleteTasks(sortedTasks).slice(0, MOBILE_SHOW_UNRESOLVED_TASKS_COUNT);
|
|
27953
28039
|
return /* @__PURE__ */ jsxs154("div", { className: "Layer__tasks-list", children: [
|
|
27954
28040
|
unresolvedTasks.map((task, index) => /* @__PURE__ */ jsx243(
|
|
@@ -27996,9 +28082,9 @@ var TasksListMobile = ({
|
|
|
27996
28082
|
};
|
|
27997
28083
|
|
|
27998
28084
|
// src/hooks/array/usePaginatedList.ts
|
|
27999
|
-
import { useCallback as
|
|
28085
|
+
import { useCallback as useCallback19, useMemo as useMemo40, useState as useState61 } from "react";
|
|
28000
28086
|
function usePaginatedList(list, pageSize) {
|
|
28001
|
-
const [internalPageIndex, setInternalPageIndex] =
|
|
28087
|
+
const [internalPageIndex, setInternalPageIndex] = useState61(0);
|
|
28002
28088
|
const pageCount = Math.max(0, Math.ceil(list.length / pageSize));
|
|
28003
28089
|
const effectivePageIndex = Math.max(0, Math.min(internalPageIndex, pageCount - 1));
|
|
28004
28090
|
const pageItems = useMemo40(() => {
|
|
@@ -28007,16 +28093,16 @@ function usePaginatedList(list, pageSize) {
|
|
|
28007
28093
|
(effectivePageIndex + 1) * pageSize
|
|
28008
28094
|
);
|
|
28009
28095
|
}, [list, effectivePageIndex, pageSize]);
|
|
28010
|
-
const next =
|
|
28096
|
+
const next = useCallback19(() => {
|
|
28011
28097
|
setInternalPageIndex(Math.min(effectivePageIndex + 1, pageCount - 1));
|
|
28012
28098
|
}, [effectivePageIndex, pageCount]);
|
|
28013
|
-
const set2 =
|
|
28099
|
+
const set2 = useCallback19((pageIndex) => {
|
|
28014
28100
|
setInternalPageIndex(Math.max(0, Math.min(pageIndex, pageCount - 1)));
|
|
28015
28101
|
}, [pageCount]);
|
|
28016
|
-
const previous =
|
|
28102
|
+
const previous = useCallback19(() => {
|
|
28017
28103
|
setInternalPageIndex(Math.max(effectivePageIndex - 1, 0));
|
|
28018
28104
|
}, [effectivePageIndex]);
|
|
28019
|
-
const reset =
|
|
28105
|
+
const reset = useCallback19(() => {
|
|
28020
28106
|
setInternalPageIndex(0);
|
|
28021
28107
|
}, []);
|
|
28022
28108
|
return {
|
|
@@ -28032,7 +28118,7 @@ function usePaginatedList(list, pageSize) {
|
|
|
28032
28118
|
}
|
|
28033
28119
|
|
|
28034
28120
|
// src/components/Tasks/TasksList.tsx
|
|
28035
|
-
import { Fragment as
|
|
28121
|
+
import { Fragment as Fragment38, jsx as jsx244, jsxs as jsxs155 } from "react/jsx-runtime";
|
|
28036
28122
|
var TasksEmptyState = () => /* @__PURE__ */ jsxs155("div", { className: "Layer__tasks-empty-state", children: [
|
|
28037
28123
|
/* @__PURE__ */ jsx244("div", { className: "Layer__tasks-icon", children: /* @__PURE__ */ jsx244(SmileIcon_default, {}) }),
|
|
28038
28124
|
/* @__PURE__ */ jsxs155(Text, { size: "sm" /* sm */, children: [
|
|
@@ -28072,7 +28158,7 @@ function TasksList({ pageSize = 8, mobile }) {
|
|
|
28072
28158
|
}
|
|
28073
28159
|
);
|
|
28074
28160
|
}
|
|
28075
|
-
return /* @__PURE__ */ jsx244("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs155(
|
|
28161
|
+
return /* @__PURE__ */ jsx244("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs155(Fragment38, { children: [
|
|
28076
28162
|
pageItems.map((task, index) => /* @__PURE__ */ jsx244(
|
|
28077
28163
|
TasksListItem,
|
|
28078
28164
|
{
|
|
@@ -28095,7 +28181,7 @@ function TasksList({ pageSize = 8, mobile }) {
|
|
|
28095
28181
|
|
|
28096
28182
|
// src/components/Tasks/TasksPending.tsx
|
|
28097
28183
|
import { Cell as Cell4, Pie as Pie3, PieChart as PieChart4 } from "recharts";
|
|
28098
|
-
import { format as
|
|
28184
|
+
import { format as format6 } from "date-fns";
|
|
28099
28185
|
import classNames71 from "classnames";
|
|
28100
28186
|
|
|
28101
28187
|
// src/components/BookkeepingStatus/BookkeepingStatusDescription.tsx
|
|
@@ -28109,7 +28195,7 @@ var BookkeepingStatusDescription = ({ monthNumber, status, incompleteTasksCount
|
|
|
28109
28195
|
};
|
|
28110
28196
|
|
|
28111
28197
|
// src/components/Tasks/TasksPending.tsx
|
|
28112
|
-
import { Fragment as
|
|
28198
|
+
import { Fragment as Fragment39, jsx as jsx246, jsxs as jsxs156 } from "react/jsx-runtime";
|
|
28113
28199
|
var TasksPending = () => {
|
|
28114
28200
|
var _a, _b, _c, _d;
|
|
28115
28201
|
const { date } = useGlobalDate();
|
|
@@ -28132,7 +28218,7 @@ var TasksPending = () => {
|
|
|
28132
28218
|
);
|
|
28133
28219
|
return /* @__PURE__ */ jsxs156("div", { className: "Layer__tasks-pending", children: [
|
|
28134
28220
|
/* @__PURE__ */ jsxs156("div", { className: "Layer__tasks-pending-header", children: [
|
|
28135
|
-
/* @__PURE__ */ jsx246(Heading, { size: "secondary" /* secondary */, children:
|
|
28221
|
+
/* @__PURE__ */ jsx246(Heading, { size: "secondary" /* secondary */, children: format6(date, "MMMM yyyy") }),
|
|
28136
28222
|
(activePeriod == null ? void 0 : activePeriod.tasks) && activePeriod.tasks.length > 0 ? /* @__PURE__ */ jsxs156("div", { className: "Layer__tasks-pending-bar", children: [
|
|
28137
28223
|
/* @__PURE__ */ jsxs156(Text, { size: "sm" /* sm */, children: [
|
|
28138
28224
|
/* @__PURE__ */ jsx246("span", { className: taskStatusClassName, children: completedTaskCount }),
|
|
@@ -28171,8 +28257,8 @@ var TasksPending = () => {
|
|
|
28171
28257
|
) })
|
|
28172
28258
|
] }) : null
|
|
28173
28259
|
] }),
|
|
28174
|
-
/* @__PURE__ */ jsx246("div", { className: "Layer__tasks-pending-main", children: activePeriod && /* @__PURE__ */ jsxs156(
|
|
28175
|
-
/* @__PURE__ */ jsx246(
|
|
28260
|
+
/* @__PURE__ */ jsx246("div", { className: "Layer__tasks-pending-main", children: activePeriod && /* @__PURE__ */ jsxs156(Fragment39, { children: [
|
|
28261
|
+
/* @__PURE__ */ jsx246(BookkeepingStatus2, { status: activePeriod.status, monthNumber: activePeriod.month }),
|
|
28176
28262
|
/* @__PURE__ */ jsx246(
|
|
28177
28263
|
BookkeepingStatusDescription,
|
|
28178
28264
|
{
|
|
@@ -28187,16 +28273,16 @@ var TasksPending = () => {
|
|
|
28187
28273
|
|
|
28188
28274
|
// src/components/Tasks/TasksMonthSelector.tsx
|
|
28189
28275
|
import { useMemo as useMemo42 } from "react";
|
|
28190
|
-
import { format as
|
|
28276
|
+
import { format as format7, getMonth as getMonth3, getYear as getYear4, set } from "date-fns";
|
|
28191
28277
|
|
|
28192
28278
|
// src/components/Tasks/TaskStatusBadge.tsx
|
|
28193
28279
|
import pluralize2 from "pluralize";
|
|
28194
28280
|
import { jsx as jsx247, jsxs as jsxs157 } from "react/jsx-runtime";
|
|
28195
28281
|
var buildBadgeConfig = (status, tasksCount) => {
|
|
28196
28282
|
switch (status) {
|
|
28197
|
-
case "IN_PROGRESS_AWAITING_BOOKKEEPER"
|
|
28198
|
-
case "NOT_STARTED"
|
|
28199
|
-
case "CLOSING_IN_REVIEW"
|
|
28283
|
+
case "IN_PROGRESS_AWAITING_BOOKKEEPER" /* IN_PROGRESS_AWAITING_BOOKKEEPER */:
|
|
28284
|
+
case "NOT_STARTED" /* NOT_STARTED */:
|
|
28285
|
+
case "CLOSING_IN_REVIEW" /* CLOSING_IN_REVIEW */: {
|
|
28200
28286
|
return {
|
|
28201
28287
|
color: "info",
|
|
28202
28288
|
icon: /* @__PURE__ */ jsx247(Clock_default, { size: 12 }),
|
|
@@ -28204,8 +28290,8 @@ var buildBadgeConfig = (status, tasksCount) => {
|
|
|
28204
28290
|
labelShort: tasksCount ? `${tasksCount}` : void 0
|
|
28205
28291
|
};
|
|
28206
28292
|
}
|
|
28207
|
-
case "IN_PROGRESS_AWAITING_CUSTOMER"
|
|
28208
|
-
case "CLOSED_OPEN_TASKS"
|
|
28293
|
+
case "IN_PROGRESS_AWAITING_CUSTOMER" /* IN_PROGRESS_AWAITING_CUSTOMER */:
|
|
28294
|
+
case "CLOSED_OPEN_TASKS" /* CLOSED_OPEN_TASKS */: {
|
|
28209
28295
|
return {
|
|
28210
28296
|
color: "warning",
|
|
28211
28297
|
label: tasksCount ? pluralize2("task", tasksCount, true) : void 0,
|
|
@@ -28213,13 +28299,13 @@ var buildBadgeConfig = (status, tasksCount) => {
|
|
|
28213
28299
|
icon: /* @__PURE__ */ jsx247(AlertCircle_default, { size: 12 })
|
|
28214
28300
|
};
|
|
28215
28301
|
}
|
|
28216
|
-
case "CLOSED_COMPLETE"
|
|
28302
|
+
case "CLOSED_COMPLETE" /* CLOSED_COMPLETE */: {
|
|
28217
28303
|
return {
|
|
28218
28304
|
color: "success",
|
|
28219
28305
|
icon: /* @__PURE__ */ jsx247(CheckCircle_default, { size: 12 })
|
|
28220
28306
|
};
|
|
28221
28307
|
}
|
|
28222
|
-
case "BOOKKEEPING_NOT_ACTIVE"
|
|
28308
|
+
case "BOOKKEEPING_NOT_ACTIVE" /* BOOKKEEPING_NOT_ACTIVE */: {
|
|
28223
28309
|
return;
|
|
28224
28310
|
}
|
|
28225
28311
|
default: {
|
|
@@ -28313,12 +28399,12 @@ function TasksMonthSelector() {
|
|
|
28313
28399
|
year: activeYear,
|
|
28314
28400
|
month: index + 1,
|
|
28315
28401
|
tasks: [],
|
|
28316
|
-
status: "BOOKKEEPING_NOT_ACTIVE"
|
|
28402
|
+
status: "BOOKKEEPING_NOT_ACTIVE" /* BOOKKEEPING_NOT_ACTIVE */,
|
|
28317
28403
|
disabled: true
|
|
28318
28404
|
};
|
|
28319
28405
|
const total = (_b = (_a = taskData.tasks) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
28320
28406
|
return __spreadValues({
|
|
28321
|
-
monthStr:
|
|
28407
|
+
monthStr: format7(date2, "MMM"),
|
|
28322
28408
|
date: date2,
|
|
28323
28409
|
completed: getCompletedTasks(taskData.tasks).length,
|
|
28324
28410
|
total
|
|
@@ -28516,7 +28602,7 @@ var TasksPanelNotification = ({
|
|
|
28516
28602
|
import { useMemo as useMemo44 } from "react";
|
|
28517
28603
|
|
|
28518
28604
|
// src/components/Tabs/Tabs.tsx
|
|
28519
|
-
import { useEffect as useEffect42, useState as
|
|
28605
|
+
import { useEffect as useEffect42, useState as useState62 } from "react";
|
|
28520
28606
|
|
|
28521
28607
|
// src/components/Tabs/Tab.tsx
|
|
28522
28608
|
import { jsx as jsx252, jsxs as jsxs161 } from "react/jsx-runtime";
|
|
@@ -28583,9 +28669,9 @@ import { jsx as jsx253, jsxs as jsxs162 } from "react/jsx-runtime";
|
|
|
28583
28669
|
import { createElement as createElement2 } from "react";
|
|
28584
28670
|
var STARTING_PADDING = 12;
|
|
28585
28671
|
var Tabs = ({ name, options, selected, onChange }) => {
|
|
28586
|
-
const [initialized, setInitialized] =
|
|
28587
|
-
const [thumbPos, setThumbPos] =
|
|
28588
|
-
const [currentWidth, setCurrentWidth] =
|
|
28672
|
+
const [initialized, setInitialized] = useState62(false);
|
|
28673
|
+
const [thumbPos, setThumbPos] = useState62({ left: 0, width: 0 });
|
|
28674
|
+
const [currentWidth, setCurrentWidth] = useState62(0);
|
|
28589
28675
|
const selectedValue = selected || options[0].value;
|
|
28590
28676
|
const baseClassName = classNames72(
|
|
28591
28677
|
"Layer__tabs",
|
|
@@ -28683,7 +28769,7 @@ var TasksYearsTabs = () => {
|
|
|
28683
28769
|
badge: !y.completed && y.unresolvedTasks ? /* @__PURE__ */ jsx254(
|
|
28684
28770
|
TaskStatusBadge,
|
|
28685
28771
|
{
|
|
28686
|
-
status: y.unresolvedTasks ? "IN_PROGRESS_AWAITING_CUSTOMER" : "CLOSED_COMPLETE"
|
|
28772
|
+
status: y.unresolvedTasks ? "IN_PROGRESS_AWAITING_CUSTOMER" /* IN_PROGRESS_AWAITING_CUSTOMER */ : "CLOSED_COMPLETE" /* CLOSED_COMPLETE */,
|
|
28687
28773
|
tasksCount: y.unresolvedTasks
|
|
28688
28774
|
}
|
|
28689
28775
|
) : null
|
|
@@ -28731,7 +28817,7 @@ function TasksEmptyContainer({ children }) {
|
|
|
28731
28817
|
}
|
|
28732
28818
|
|
|
28733
28819
|
// src/components/Tasks/Tasks.tsx
|
|
28734
|
-
import { Fragment as
|
|
28820
|
+
import { Fragment as Fragment40, jsx as jsx256, jsxs as jsxs163 } from "react/jsx-runtime";
|
|
28735
28821
|
function Tasks({
|
|
28736
28822
|
mobile = false,
|
|
28737
28823
|
tasksHeader,
|
|
@@ -28764,7 +28850,7 @@ function Tasks({
|
|
|
28764
28850
|
/* @__PURE__ */ jsx256(Heading2, { size: "xs", level: 4, children: "Not Enrolled in Bookkeeping" }),
|
|
28765
28851
|
/* @__PURE__ */ jsx256(P, { children: "If you believe this is an error, please contact support." })
|
|
28766
28852
|
] }) }),
|
|
28767
|
-
children: () => /* @__PURE__ */ jsxs163(
|
|
28853
|
+
children: () => /* @__PURE__ */ jsxs163(Fragment40, { children: [
|
|
28768
28854
|
/* @__PURE__ */ jsx256(TasksYearsTabs, {}),
|
|
28769
28855
|
/* @__PURE__ */ jsx256(TasksMonthSelector, {}),
|
|
28770
28856
|
/* @__PURE__ */ jsx256(TasksPending, {}),
|
|
@@ -28778,20 +28864,20 @@ function Tasks({
|
|
|
28778
28864
|
}
|
|
28779
28865
|
|
|
28780
28866
|
// src/components/PlatformOnboarding/LinkAccounts.tsx
|
|
28781
|
-
import { useContext as
|
|
28867
|
+
import { useContext as useContext54 } from "react";
|
|
28782
28868
|
|
|
28783
28869
|
// src/components/PlatformOnboarding/Steps/LinkAccountsConfirmationStep.tsx
|
|
28784
|
-
import { useContext as
|
|
28870
|
+
import { useContext as useContext52 } from "react";
|
|
28785
28871
|
import { useForm as useForm2 } from "@tanstack/react-form";
|
|
28786
28872
|
|
|
28787
28873
|
// src/components/Wizard/Wizard.tsx
|
|
28788
28874
|
import {
|
|
28789
28875
|
Children,
|
|
28790
28876
|
createContext as createContext20,
|
|
28791
|
-
useCallback as
|
|
28792
|
-
useContext as
|
|
28877
|
+
useCallback as useCallback20,
|
|
28878
|
+
useContext as useContext51,
|
|
28793
28879
|
useMemo as useMemo45,
|
|
28794
|
-
useState as
|
|
28880
|
+
useState as useState63
|
|
28795
28881
|
} from "react";
|
|
28796
28882
|
import { jsxs as jsxs164 } from "react/jsx-runtime";
|
|
28797
28883
|
function useWizardStep({
|
|
@@ -28799,14 +28885,14 @@ function useWizardStep({
|
|
|
28799
28885
|
onComplete
|
|
28800
28886
|
}) {
|
|
28801
28887
|
const stepCount = steps.length;
|
|
28802
|
-
const [activeStepIndex, setActiveStepIndex] =
|
|
28803
|
-
const next =
|
|
28888
|
+
const [activeStepIndex, setActiveStepIndex] = useState63(0);
|
|
28889
|
+
const next = useCallback20(() => __async(null, null, function* () {
|
|
28804
28890
|
setActiveStepIndex((stepIndex) => Math.min(stepIndex + 1, stepCount - 1));
|
|
28805
28891
|
if (activeStepIndex === stepCount - 1 && onComplete) {
|
|
28806
28892
|
yield onComplete == null ? void 0 : onComplete();
|
|
28807
28893
|
}
|
|
28808
28894
|
}), [stepCount, activeStepIndex, onComplete]);
|
|
28809
|
-
const previous =
|
|
28895
|
+
const previous = useCallback20(() => setActiveStepIndex((stepIndex) => Math.max(stepIndex - 1, 0)), []);
|
|
28810
28896
|
const effectiveStepIndex = Math.min(activeStepIndex, stepCount - 1);
|
|
28811
28897
|
const currentStep = steps.at(effectiveStepIndex);
|
|
28812
28898
|
return { currentStep, next, previous };
|
|
@@ -28818,7 +28904,7 @@ var WizardContext = createContext20({
|
|
|
28818
28904
|
}
|
|
28819
28905
|
});
|
|
28820
28906
|
function useWizard() {
|
|
28821
|
-
return
|
|
28907
|
+
return useContext51(WizardContext);
|
|
28822
28908
|
}
|
|
28823
28909
|
function Wizard({
|
|
28824
28910
|
Header: Header4,
|
|
@@ -28872,7 +28958,7 @@ function LinkAccountsConfirmationStep() {
|
|
|
28872
28958
|
data: linkedAccounts,
|
|
28873
28959
|
loadingStatus: linkedAccountsLoadingStatus,
|
|
28874
28960
|
refetchAccounts
|
|
28875
|
-
} =
|
|
28961
|
+
} = useContext52(LinkedAccountsContext);
|
|
28876
28962
|
const effectiveLinkedAccounts = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
|
|
28877
28963
|
const { trigger } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
|
|
28878
28964
|
const { previous, next } = useWizard();
|
|
@@ -28945,7 +29031,7 @@ function LinkAccountsConfirmationStep() {
|
|
|
28945
29031
|
}
|
|
28946
29032
|
|
|
28947
29033
|
// src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
|
|
28948
|
-
import { useContext as
|
|
29034
|
+
import { useContext as useContext53 } from "react";
|
|
28949
29035
|
import pluralize4 from "pluralize";
|
|
28950
29036
|
|
|
28951
29037
|
// src/components/Separator/Separator.tsx
|
|
@@ -28956,7 +29042,7 @@ var Separator = ({ mbs, mbe }) => {
|
|
|
28956
29042
|
};
|
|
28957
29043
|
|
|
28958
29044
|
// src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
|
|
28959
|
-
import { Fragment as
|
|
29045
|
+
import { Fragment as Fragment41, jsx as jsx260, jsxs as jsxs166 } from "react/jsx-runtime";
|
|
28960
29046
|
function LinkAccountsLinkStep() {
|
|
28961
29047
|
const {
|
|
28962
29048
|
data,
|
|
@@ -28964,10 +29050,10 @@ function LinkAccountsLinkStep() {
|
|
|
28964
29050
|
error,
|
|
28965
29051
|
refetchAccounts,
|
|
28966
29052
|
addConnection
|
|
28967
|
-
} =
|
|
29053
|
+
} = useContext53(LinkedAccountsContext);
|
|
28968
29054
|
const { next } = useWizard();
|
|
28969
29055
|
const effectiveAccounts = data != null ? data : [];
|
|
28970
|
-
return /* @__PURE__ */ jsxs166(
|
|
29056
|
+
return /* @__PURE__ */ jsxs166(Fragment41, { children: [
|
|
28971
29057
|
/* @__PURE__ */ jsx260(
|
|
28972
29058
|
ConditionalList,
|
|
28973
29059
|
{
|
|
@@ -29027,7 +29113,7 @@ function LinkAccountsLinkStep() {
|
|
|
29027
29113
|
children: ({ item: account }) => /* @__PURE__ */ jsx260(BasicLinkedAccountContainer, { isSelected: true, children: /* @__PURE__ */ jsx260(BasicLinkedAccountContent, { account }) }, account.id)
|
|
29028
29114
|
}
|
|
29029
29115
|
),
|
|
29030
|
-
effectiveAccounts.length > 0 ? /* @__PURE__ */ jsxs166(
|
|
29116
|
+
effectiveAccounts.length > 0 ? /* @__PURE__ */ jsxs166(Fragment41, { children: [
|
|
29031
29117
|
/* @__PURE__ */ jsx260(Separator, { mbs: "lg", mbe: "lg" }),
|
|
29032
29118
|
/* @__PURE__ */ jsx260(HStack, { justify: "start", gap: "sm", children: /* @__PURE__ */ jsx260(Button, { onClick: () => {
|
|
29033
29119
|
void next();
|
|
@@ -29044,7 +29130,7 @@ function LinkAccounts(props) {
|
|
|
29044
29130
|
function LinkAccountsContent({
|
|
29045
29131
|
onComplete
|
|
29046
29132
|
}) {
|
|
29047
|
-
const { data: linkedAccounts, loadingStatus } =
|
|
29133
|
+
const { data: linkedAccounts, loadingStatus } = useContext54(LinkedAccountsContext);
|
|
29048
29134
|
const linkedAccountsNeedingConfirmation = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
|
|
29049
29135
|
const hideConfirmationStep = loadingStatus === "complete" && linkedAccountsNeedingConfirmation.length === 0;
|
|
29050
29136
|
return /* @__PURE__ */ jsx261("section", { className: "Layer__link-accounts Layer__component", children: /* @__PURE__ */ jsxs167(
|
|
@@ -29062,7 +29148,7 @@ function LinkAccountsContent({
|
|
|
29062
29148
|
}
|
|
29063
29149
|
|
|
29064
29150
|
// src/components/PlatformOnboarding/PlatformOnboarding.tsx
|
|
29065
|
-
import { useState as
|
|
29151
|
+
import { useState as useState65 } from "react";
|
|
29066
29152
|
|
|
29067
29153
|
// src/components/ProgressSteps/ProgressSteps.tsx
|
|
29068
29154
|
import { jsx as jsx262, jsxs as jsxs168 } from "react/jsx-runtime";
|
|
@@ -29251,7 +29337,7 @@ var TrendingUp = (_a) => {
|
|
|
29251
29337
|
var TrendingUp_default = TrendingUp;
|
|
29252
29338
|
|
|
29253
29339
|
// src/components/PlatformOnboarding/Steps/WelcomeStep.tsx
|
|
29254
|
-
import { Fragment as
|
|
29340
|
+
import { Fragment as Fragment42, jsx as jsx265, jsxs as jsxs171 } from "react/jsx-runtime";
|
|
29255
29341
|
var defaultTitle = "Welcome";
|
|
29256
29342
|
var defaultDescription = "Welcome to the platform onboarding process";
|
|
29257
29343
|
var WelcomeStep = ({ onNext, title = defaultTitle, description, stepsEnabled }) => {
|
|
@@ -29272,7 +29358,7 @@ var WelcomeStep = ({ onNext, title = defaultTitle, description, stepsEnabled })
|
|
|
29272
29358
|
}
|
|
29273
29359
|
return defaultDescription;
|
|
29274
29360
|
};
|
|
29275
|
-
return /* @__PURE__ */ jsxs171(
|
|
29361
|
+
return /* @__PURE__ */ jsxs171(Fragment42, { children: [
|
|
29276
29362
|
/* @__PURE__ */ jsxs171("div", { className: "Layer__platform-onboarding__welcome", children: [
|
|
29277
29363
|
/* @__PURE__ */ jsx265(Heading, { className: "Layer__platform-onboarding__heading", align: "left", children: title }),
|
|
29278
29364
|
/* @__PURE__ */ jsx265(Text, { status: "disabled", children: buildDescription() })
|
|
@@ -29349,12 +29435,12 @@ var WelcomeStepFooter = () => {
|
|
|
29349
29435
|
};
|
|
29350
29436
|
|
|
29351
29437
|
// src/components/PlatformOnboarding/Steps/SummaryStep.tsx
|
|
29352
|
-
import { Fragment as
|
|
29438
|
+
import { Fragment as Fragment43, jsx as jsx266, jsxs as jsxs172 } from "react/jsx-runtime";
|
|
29353
29439
|
var defaultTitle2 = "You\u2019re all set!";
|
|
29354
29440
|
var defaultDescription2 = "We\u2019re syncing your accounts. This process may take a while to complete.";
|
|
29355
29441
|
var defaultNextBtnText = "Go to dashboard";
|
|
29356
29442
|
var SummaryStep = ({ onNext, title = defaultTitle2, description = defaultDescription2, nextBtnText = defaultNextBtnText }) => {
|
|
29357
|
-
return /* @__PURE__ */ jsxs172(
|
|
29443
|
+
return /* @__PURE__ */ jsxs172(Fragment43, { children: [
|
|
29358
29444
|
/* @__PURE__ */ jsxs172("div", { className: "Layer__platform-onboarding__summary", children: [
|
|
29359
29445
|
/* @__PURE__ */ jsx266(Heading, { className: "Layer__platform-onboarding__heading", align: "left", children: title }),
|
|
29360
29446
|
/* @__PURE__ */ jsx266(Text, { status: "disabled", children: description })
|
|
@@ -29459,7 +29545,7 @@ function useBusinessPersonnel() {
|
|
|
29459
29545
|
// src/hooks/businessPersonnel/useCreateBusinessPersonnel.ts
|
|
29460
29546
|
import useSWRMutation16 from "swr/mutation";
|
|
29461
29547
|
import { useSWRConfig as useSWRConfig9 } from "swr";
|
|
29462
|
-
import { useCallback as
|
|
29548
|
+
import { useCallback as useCallback21 } from "react";
|
|
29463
29549
|
var createBusinessPersonnel = post(({ businessId }) => `/v1/businesses/${businessId}/personnel`);
|
|
29464
29550
|
function buildKey26({
|
|
29465
29551
|
access_token: accessToken,
|
|
@@ -29497,7 +29583,7 @@ function useCreateBusinessPersonnel() {
|
|
|
29497
29583
|
}
|
|
29498
29584
|
);
|
|
29499
29585
|
const { trigger: originalTrigger } = mutationResponse;
|
|
29500
|
-
const stableProxiedTrigger =
|
|
29586
|
+
const stableProxiedTrigger = useCallback21(
|
|
29501
29587
|
(...triggerParameters) => __async(null, null, function* () {
|
|
29502
29588
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
29503
29589
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -29531,7 +29617,7 @@ var updateBusinessPersonnel = post(({ businessId, businessPersonnelId }) => {
|
|
|
29531
29617
|
});
|
|
29532
29618
|
|
|
29533
29619
|
// src/hooks/businessPersonnel/useUpdateBusinessPersonnel.ts
|
|
29534
|
-
import { useCallback as
|
|
29620
|
+
import { useCallback as useCallback22 } from "react";
|
|
29535
29621
|
function buildKey27({
|
|
29536
29622
|
access_token: accessToken,
|
|
29537
29623
|
apiUrl,
|
|
@@ -29574,7 +29660,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
|
29574
29660
|
}
|
|
29575
29661
|
);
|
|
29576
29662
|
const { trigger: originalTrigger } = mutationResponse;
|
|
29577
|
-
const stableProxiedTrigger =
|
|
29663
|
+
const stableProxiedTrigger = useCallback22(
|
|
29578
29664
|
(...triggerParameters) => __async(null, null, function* () {
|
|
29579
29665
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
29580
29666
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -29601,7 +29687,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
|
29601
29687
|
// src/hooks/business/useUpdateBusiness.ts
|
|
29602
29688
|
import useSWRMutation18 from "swr/mutation";
|
|
29603
29689
|
import { useSWRConfig as useSWRConfig11 } from "swr";
|
|
29604
|
-
import { useCallback as
|
|
29690
|
+
import { useCallback as useCallback23 } from "react";
|
|
29605
29691
|
var BUSINESS_TAG_KEY = "business";
|
|
29606
29692
|
function buildKey28({
|
|
29607
29693
|
access_token: accessToken,
|
|
@@ -29639,7 +29725,7 @@ function useUpdateBusiness() {
|
|
|
29639
29725
|
}
|
|
29640
29726
|
);
|
|
29641
29727
|
const { trigger: originalTrigger } = mutationResponse;
|
|
29642
|
-
const stableProxiedTrigger =
|
|
29728
|
+
const stableProxiedTrigger = useCallback23(
|
|
29643
29729
|
(...triggerParameters) => __async(null, null, function* () {
|
|
29644
29730
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
29645
29731
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -29664,7 +29750,7 @@ function useUpdateBusiness() {
|
|
|
29664
29750
|
}
|
|
29665
29751
|
|
|
29666
29752
|
// src/components/BusinessForm/useBusinessForm.ts
|
|
29667
|
-
import { useState as
|
|
29753
|
+
import { useState as useState64 } from "react";
|
|
29668
29754
|
var getPerson = (personnel) => {
|
|
29669
29755
|
const owners = personnel == null ? void 0 : personnel.filter((p) => p.roles.find((x) => x.role === "OWNER"));
|
|
29670
29756
|
if (owners && owners.length > 0) {
|
|
@@ -29675,7 +29761,7 @@ var getPerson = (personnel) => {
|
|
|
29675
29761
|
var useBusinessForm = ({ onSuccess }) => {
|
|
29676
29762
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
29677
29763
|
const { business } = useLayerContext();
|
|
29678
|
-
const [submitError, setSubmitError] =
|
|
29764
|
+
const [submitError, setSubmitError] = useState64(void 0);
|
|
29679
29765
|
const { data: personnel } = useBusinessPersonnel();
|
|
29680
29766
|
const person = getPerson(personnel);
|
|
29681
29767
|
const { trigger: createBusinessPersonnel2 } = useCreateBusinessPersonnel();
|
|
@@ -29883,7 +29969,7 @@ var PhoneInput = (_a) => {
|
|
|
29883
29969
|
|
|
29884
29970
|
// src/components/BusinessForm/BusinessForm.tsx
|
|
29885
29971
|
import { isPossiblePhoneNumber } from "libphonenumber-js";
|
|
29886
|
-
import { Fragment as
|
|
29972
|
+
import { Fragment as Fragment44, jsx as jsx271, jsxs as jsxs174 } from "react/jsx-runtime";
|
|
29887
29973
|
var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
29888
29974
|
var _a;
|
|
29889
29975
|
const { form, submitError, isFormValid } = useBusinessForm({ onSuccess });
|
|
@@ -29907,7 +29993,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29907
29993
|
validators: {
|
|
29908
29994
|
onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Full name is required"
|
|
29909
29995
|
},
|
|
29910
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
29996
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "full_name", label: "Full name", children: /* @__PURE__ */ jsx271(
|
|
29911
29997
|
Input,
|
|
29912
29998
|
{
|
|
29913
29999
|
name: "full_name",
|
|
@@ -29920,7 +30006,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29920
30006
|
) }) })
|
|
29921
30007
|
}
|
|
29922
30008
|
),
|
|
29923
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "preferred_name", children: (field) => /* @__PURE__ */ jsx271(
|
|
30009
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "preferred_name", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "preferred_name", label: "Preferred name", children: /* @__PURE__ */ jsx271(
|
|
29924
30010
|
Input,
|
|
29925
30011
|
{
|
|
29926
30012
|
name: "preferred_name",
|
|
@@ -29937,7 +30023,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29937
30023
|
validators: {
|
|
29938
30024
|
onSubmit: ({ value }) => validateEmailFormat(value, true) ? void 0 : "Email is invalid"
|
|
29939
30025
|
},
|
|
29940
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
30026
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(
|
|
29941
30027
|
InputGroup,
|
|
29942
30028
|
{
|
|
29943
30029
|
name: "email",
|
|
@@ -29964,7 +30050,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29964
30050
|
validators: {
|
|
29965
30051
|
onSubmit: ({ value }) => isPossiblePhoneNumber(value != null ? value : "", "US") ? void 0 : "Phone number is invalid"
|
|
29966
30052
|
},
|
|
29967
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
30053
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(
|
|
29968
30054
|
InputGroup,
|
|
29969
30055
|
{
|
|
29970
30056
|
name: "phone_number",
|
|
@@ -29991,7 +30077,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29991
30077
|
validators: {
|
|
29992
30078
|
onBlur: ({ value }) => notEmpty(value) ? void 0 : "Company name is required"
|
|
29993
30079
|
},
|
|
29994
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
30080
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "legal_name", label: "Company", children: /* @__PURE__ */ jsx271(
|
|
29995
30081
|
Input,
|
|
29996
30082
|
{
|
|
29997
30083
|
name: "legal_name",
|
|
@@ -30004,7 +30090,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30004
30090
|
) }) })
|
|
30005
30091
|
}
|
|
30006
30092
|
),
|
|
30007
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "dba", children: (field) => /* @__PURE__ */ jsx271(
|
|
30093
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "dba", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "dba", label: "DBA (optional)", children: /* @__PURE__ */ jsx271(
|
|
30008
30094
|
Input,
|
|
30009
30095
|
{
|
|
30010
30096
|
name: "dba",
|
|
@@ -30015,7 +30101,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30015
30101
|
errorMessage: field.state.meta.errors.join(", ")
|
|
30016
30102
|
}
|
|
30017
30103
|
) }) }) }),
|
|
30018
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "entity_type", children: (field) => /* @__PURE__ */ jsx271(
|
|
30104
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "entity_type", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "entity_type", label: "Entity type", children: /* @__PURE__ */ jsx271(
|
|
30019
30105
|
BusinessTypeSelect,
|
|
30020
30106
|
{
|
|
30021
30107
|
value: field.state.value,
|
|
@@ -30023,14 +30109,14 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30023
30109
|
}
|
|
30024
30110
|
) }) }) }),
|
|
30025
30111
|
/* @__PURE__ */ jsxs174("div", { className: "Layer__business-form__state-tin-fields", children: [
|
|
30026
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "us_state", children: (field) => /* @__PURE__ */ jsx271(
|
|
30112
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "us_state", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "us_state", label: "State", className: "Layer__business-form__state", children: /* @__PURE__ */ jsx271(
|
|
30027
30113
|
USStateSelect,
|
|
30028
30114
|
{
|
|
30029
30115
|
value: field.state.value,
|
|
30030
30116
|
onChange: (option) => field.handleChange(option.value)
|
|
30031
30117
|
}
|
|
30032
30118
|
) }) }) }),
|
|
30033
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "tin", children: (field) => /* @__PURE__ */ jsx271(
|
|
30119
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "tin", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "tin", label: "Tax ID number (optional)", children: /* @__PURE__ */ jsx271(
|
|
30034
30120
|
Input,
|
|
30035
30121
|
{
|
|
30036
30122
|
name: "tin",
|
|
@@ -30061,10 +30147,10 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30061
30147
|
};
|
|
30062
30148
|
|
|
30063
30149
|
// src/components/PlatformOnboarding/Steps/BusinessInfoStep.tsx
|
|
30064
|
-
import { Fragment as
|
|
30150
|
+
import { Fragment as Fragment45, jsx as jsx272, jsxs as jsxs175 } from "react/jsx-runtime";
|
|
30065
30151
|
var defaultTitle3 = "We\u2019ll use this information to contact you whenever we have questions on your books.";
|
|
30066
30152
|
var BusinessInfoStep = ({ title = defaultTitle3, onNext }) => {
|
|
30067
|
-
return /* @__PURE__ */ jsxs175(
|
|
30153
|
+
return /* @__PURE__ */ jsxs175(Fragment45, { children: [
|
|
30068
30154
|
/* @__PURE__ */ jsx272(Heading2, { children: title }),
|
|
30069
30155
|
/* @__PURE__ */ jsx272(BusinessForm2, { onSuccess: onNext })
|
|
30070
30156
|
] });
|
|
@@ -30091,7 +30177,7 @@ var PLATFORM_ONBOARDING_STEPS = [
|
|
|
30091
30177
|
}
|
|
30092
30178
|
];
|
|
30093
30179
|
var PlatformOnboarding = ({ onComplete }) => {
|
|
30094
|
-
const [step, setStep] =
|
|
30180
|
+
const [step, setStep] = useState65(PLATFORM_ONBOARDING_STEPS[0].id);
|
|
30095
30181
|
const isFirstStep = PLATFORM_ONBOARDING_STEPS[0].id === step;
|
|
30096
30182
|
const nextStep = () => {
|
|
30097
30183
|
const currentStepIndex = PLATFORM_ONBOARDING_STEPS.findIndex((s) => s.id === step);
|
|
@@ -30253,7 +30339,7 @@ var BookkeepingUpsellBar = ({
|
|
|
30253
30339
|
};
|
|
30254
30340
|
|
|
30255
30341
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
30256
|
-
import { useState as
|
|
30342
|
+
import { useState as useState66 } from "react";
|
|
30257
30343
|
|
|
30258
30344
|
// src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
|
|
30259
30345
|
import { jsx as jsx276 } from "react/jsx-runtime";
|
|
@@ -30333,7 +30419,7 @@ var BookkeepingOverview = ({
|
|
|
30333
30419
|
slotProps
|
|
30334
30420
|
}) => {
|
|
30335
30421
|
var _a, _b, _c, _d, _e, _f;
|
|
30336
|
-
const [pnlToggle, setPnlToggle] =
|
|
30422
|
+
const [pnlToggle, setPnlToggle] = useState66("expenses");
|
|
30337
30423
|
const [width] = useWindowSize();
|
|
30338
30424
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
30339
30425
|
const { upperContentRef, targetElementRef, upperElementInFocus } = useKeepInMobileViewport();
|
|
@@ -30464,7 +30550,7 @@ var BookkeepingOverview = ({
|
|
|
30464
30550
|
};
|
|
30465
30551
|
|
|
30466
30552
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
30467
|
-
import { useState as
|
|
30553
|
+
import { useState as useState67 } from "react";
|
|
30468
30554
|
import classNames75 from "classnames";
|
|
30469
30555
|
import { jsx as jsx278, jsxs as jsxs180 } from "react/jsx-runtime";
|
|
30470
30556
|
var AccountingOverview = ({
|
|
@@ -30480,7 +30566,7 @@ var AccountingOverview = ({
|
|
|
30480
30566
|
slotProps
|
|
30481
30567
|
}) => {
|
|
30482
30568
|
var _a, _b, _c, _d, _e;
|
|
30483
|
-
const [pnlToggle, setPnlToggle] =
|
|
30569
|
+
const [pnlToggle, setPnlToggle] = useState67("expenses");
|
|
30484
30570
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
30485
30571
|
return /* @__PURE__ */ jsx278(
|
|
30486
30572
|
ProfitAndLoss,
|
|
@@ -30647,7 +30733,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
30647
30733
|
};
|
|
30648
30734
|
|
|
30649
30735
|
// src/views/GeneralLedger/GeneralLedger.tsx
|
|
30650
|
-
import { useState as
|
|
30736
|
+
import { useState as useState68 } from "react";
|
|
30651
30737
|
import { jsx as jsx280, jsxs as jsxs182 } from "react/jsx-runtime";
|
|
30652
30738
|
var GeneralLedgerView = ({
|
|
30653
30739
|
title,
|
|
@@ -30656,7 +30742,7 @@ var GeneralLedgerView = ({
|
|
|
30656
30742
|
stringOverrides,
|
|
30657
30743
|
chartOfAccountsOptions
|
|
30658
30744
|
}) => {
|
|
30659
|
-
const [activeTab, setActiveTab] =
|
|
30745
|
+
const [activeTab, setActiveTab] = useState68("chartOfAccounts");
|
|
30660
30746
|
return /* @__PURE__ */ jsx280(ProfitAndLoss, { asContainer: false, children: /* @__PURE__ */ jsxs182(
|
|
30661
30747
|
View,
|
|
30662
30748
|
{
|
|
@@ -30698,9 +30784,9 @@ var GeneralLedgerView = ({
|
|
|
30698
30784
|
};
|
|
30699
30785
|
|
|
30700
30786
|
// src/views/ProjectProfitability/ProjectProfitability.tsx
|
|
30701
|
-
import { useState as
|
|
30787
|
+
import { useState as useState69 } from "react";
|
|
30702
30788
|
import Select4 from "react-select";
|
|
30703
|
-
import { Fragment as
|
|
30789
|
+
import { Fragment as Fragment46, jsx as jsx281, jsxs as jsxs183 } from "react/jsx-runtime";
|
|
30704
30790
|
var ProjectProfitabilityView = ({
|
|
30705
30791
|
valueOptions,
|
|
30706
30792
|
showTitle,
|
|
@@ -30708,9 +30794,9 @@ var ProjectProfitabilityView = ({
|
|
|
30708
30794
|
datePickerMode = "monthPicker",
|
|
30709
30795
|
csvMoneyFormat = "DOLLAR_STRING"
|
|
30710
30796
|
}) => {
|
|
30711
|
-
const [activeTab, setActiveTab] =
|
|
30712
|
-
const [tagFilter, setTagFilter] =
|
|
30713
|
-
const [pnlTagFilter, setPnlTagFilter] =
|
|
30797
|
+
const [activeTab, setActiveTab] = useState69("overview");
|
|
30798
|
+
const [tagFilter, setTagFilter] = useState69(null);
|
|
30799
|
+
const [pnlTagFilter, setPnlTagFilter] = useState69(
|
|
30714
30800
|
void 0
|
|
30715
30801
|
);
|
|
30716
30802
|
const isOptionSelected = (option, selectValue) => {
|
|
@@ -30773,7 +30859,7 @@ var ProjectProfitabilityView = ({
|
|
|
30773
30859
|
}
|
|
30774
30860
|
)
|
|
30775
30861
|
] }),
|
|
30776
|
-
/* @__PURE__ */ jsx281(Container, { name: "project", children: /* @__PURE__ */ jsxs183(
|
|
30862
|
+
/* @__PURE__ */ jsx281(Container, { name: "project", children: /* @__PURE__ */ jsxs183(Fragment46, { children: [
|
|
30777
30863
|
activeTab === "overview" && /* @__PURE__ */ jsx281(
|
|
30778
30864
|
AccountingOverview,
|
|
30779
30865
|
{
|
|
@@ -30809,8 +30895,8 @@ var ProjectProfitabilityView = ({
|
|
|
30809
30895
|
};
|
|
30810
30896
|
|
|
30811
30897
|
// src/views/Reports/Reports.tsx
|
|
30812
|
-
import { useState as
|
|
30813
|
-
import { Fragment as
|
|
30898
|
+
import { useState as useState70 } from "react";
|
|
30899
|
+
import { Fragment as Fragment47, jsx as jsx282, jsxs as jsxs184 } from "react/jsx-runtime";
|
|
30814
30900
|
var getOptions = (enabledReports) => {
|
|
30815
30901
|
return [
|
|
30816
30902
|
enabledReports.includes("profitAndLoss") ? {
|
|
@@ -30837,7 +30923,7 @@ var Reports = ({
|
|
|
30837
30923
|
statementOfCashFlowConfig
|
|
30838
30924
|
}) => {
|
|
30839
30925
|
var _a;
|
|
30840
|
-
const [activeTab, setActiveTab] =
|
|
30926
|
+
const [activeTab, setActiveTab] = useState70(enabledReports[0]);
|
|
30841
30927
|
const { view, containerRef } = useElementViewSize();
|
|
30842
30928
|
const options = getOptions(enabledReports);
|
|
30843
30929
|
const defaultTitle4 = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
|
|
@@ -30879,7 +30965,7 @@ var ReportsPanel = ({
|
|
|
30879
30965
|
statementOfCashFlowConfig,
|
|
30880
30966
|
view
|
|
30881
30967
|
}) => {
|
|
30882
|
-
return /* @__PURE__ */ jsxs184(
|
|
30968
|
+
return /* @__PURE__ */ jsxs184(Fragment47, { children: [
|
|
30883
30969
|
openReport === "profitAndLoss" && /* @__PURE__ */ jsx282(
|
|
30884
30970
|
ProfitAndLoss.Report,
|
|
30885
30971
|
__spreadValues({
|
|
@@ -30899,8 +30985,8 @@ var ReportsPanel = ({
|
|
|
30899
30985
|
};
|
|
30900
30986
|
|
|
30901
30987
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
30902
|
-
import { useContext as
|
|
30903
|
-
import { Fragment as
|
|
30988
|
+
import { useContext as useContext55, useRef as useRef24 } from "react";
|
|
30989
|
+
import { Fragment as Fragment48, jsx as jsx283, jsxs as jsxs185 } from "react/jsx-runtime";
|
|
30904
30990
|
var COMPONENT_NAME8 = "profit-and-loss";
|
|
30905
30991
|
var ProfitAndLossView = (props) => {
|
|
30906
30992
|
const containerRef = useRef24(null);
|
|
@@ -30914,7 +31000,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
30914
31000
|
"containerRef",
|
|
30915
31001
|
"stringOverrides"
|
|
30916
31002
|
]);
|
|
30917
|
-
const { sidebarScope } =
|
|
31003
|
+
const { sidebarScope } = useContext55(ProfitAndLoss.Context);
|
|
30918
31004
|
return /* @__PURE__ */ jsxs185(
|
|
30919
31005
|
Panel,
|
|
30920
31006
|
{
|
|
@@ -30945,7 +31031,7 @@ var Components = ({
|
|
|
30945
31031
|
hideTable = false,
|
|
30946
31032
|
stringOverrides
|
|
30947
31033
|
}) => {
|
|
30948
|
-
const { error, isLoading, isValidating, refetch } =
|
|
31034
|
+
const { error, isLoading, isValidating, refetch } = useContext55(
|
|
30949
31035
|
ProfitAndLoss.Context
|
|
30950
31036
|
);
|
|
30951
31037
|
if (!isLoading && error) {
|
|
@@ -30960,7 +31046,7 @@ var Components = ({
|
|
|
30960
31046
|
}
|
|
30961
31047
|
) });
|
|
30962
31048
|
}
|
|
30963
|
-
return /* @__PURE__ */ jsxs185(
|
|
31049
|
+
return /* @__PURE__ */ jsxs185(Fragment48, { children: [
|
|
30964
31050
|
!hideChart && /* @__PURE__ */ jsxs185("div", { className: `Layer__${COMPONENT_NAME8}__chart_with_summaries`, children: [
|
|
30965
31051
|
/* @__PURE__ */ jsxs185(
|
|
30966
31052
|
"div",
|
|
@@ -31016,7 +31102,6 @@ export {
|
|
|
31016
31102
|
ProfitAndLoss,
|
|
31017
31103
|
ProfitAndLossView,
|
|
31018
31104
|
ProjectProfitabilityView,
|
|
31019
|
-
Quickbooks,
|
|
31020
31105
|
Reports,
|
|
31021
31106
|
StatementOfCashFlow,
|
|
31022
31107
|
Tasks,
|