@layerfi/components 0.1.99 → 0.1.101
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 +863 -773
- package/dist/esm/index.mjs +706 -615
- package/dist/index.css +107 -108
- package/dist/index.d.ts +70 -62
- 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.101";
|
|
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,
|
|
@@ -14687,17 +14683,22 @@ function LegacyModeProvider({
|
|
|
14687
14683
|
}
|
|
14688
14684
|
|
|
14689
14685
|
// src/hooks/bookkeeping/useBookkeepingStatus.ts
|
|
14690
|
-
var
|
|
14691
|
-
"NOT_PURCHASED"
|
|
14692
|
-
"ACTIVE"
|
|
14693
|
-
"ONBOARDING"
|
|
14694
|
-
"BOOKKEEPING_PAUSED"
|
|
14695
|
-
|
|
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
|
+
}
|
|
14696
14697
|
function constrainToKnownBookkeepingStatus(status) {
|
|
14697
|
-
if (
|
|
14698
|
+
if (isBookkeepingStatus(status)) {
|
|
14698
14699
|
return status;
|
|
14699
14700
|
}
|
|
14700
|
-
return "NOT_PURCHASED"
|
|
14701
|
+
return "NOT_PURCHASED" /* NOT_PURCHASED */;
|
|
14701
14702
|
}
|
|
14702
14703
|
var getBookkeepingStatus = get(({ businessId }) => {
|
|
14703
14704
|
return `/v1/businesses/${businessId}/bookkeeping/status`;
|
|
@@ -14739,26 +14740,29 @@ function useEffectiveBookkeepingStatus() {
|
|
|
14739
14740
|
const { overrideMode } = useLegacyMode();
|
|
14740
14741
|
const { data } = useBookkeepingStatus();
|
|
14741
14742
|
if (overrideMode === "bookkeeping-client") {
|
|
14742
|
-
return "ACTIVE"
|
|
14743
|
+
return "ACTIVE" /* ACTIVE */;
|
|
14743
14744
|
}
|
|
14744
|
-
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 */;
|
|
14745
14746
|
}
|
|
14746
14747
|
|
|
14747
14748
|
// src/utils/bookkeeping/isCategorizationEnabled.ts
|
|
14748
14749
|
function isCategorizationEnabledForStatus(status) {
|
|
14749
14750
|
switch (status) {
|
|
14750
|
-
case "NOT_PURCHASED"
|
|
14751
|
-
case "ONBOARDING"
|
|
14752
|
-
case "BOOKKEEPING_PAUSED"
|
|
14751
|
+
case "NOT_PURCHASED" /* NOT_PURCHASED */:
|
|
14752
|
+
case "ONBOARDING" /* ONBOARDING */:
|
|
14753
|
+
case "BOOKKEEPING_PAUSED" /* BOOKKEEPING_PAUSED */: {
|
|
14753
14754
|
return true;
|
|
14754
|
-
|
|
14755
|
+
}
|
|
14756
|
+
case "ACTIVE" /* ACTIVE */: {
|
|
14755
14757
|
return false;
|
|
14756
|
-
|
|
14758
|
+
}
|
|
14759
|
+
default: {
|
|
14757
14760
|
return safeAssertUnreachable({
|
|
14758
14761
|
value: status,
|
|
14759
14762
|
message: "Unexpected bookkeeping status in `isCategorizationEnabledForStatus`",
|
|
14760
14763
|
fallbackValue: true
|
|
14761
14764
|
});
|
|
14765
|
+
}
|
|
14762
14766
|
}
|
|
14763
14767
|
}
|
|
14764
14768
|
|
|
@@ -15922,6 +15926,116 @@ var SplitTooltipDetails = ({
|
|
|
15922
15926
|
import classNames41 from "classnames";
|
|
15923
15927
|
import { parseISO as parseISO9, format as formatTime6 } from "date-fns";
|
|
15924
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
|
+
|
|
15925
16039
|
// src/utils/date.ts
|
|
15926
16040
|
var monthNames = [
|
|
15927
16041
|
"January",
|
|
@@ -15986,9 +16100,9 @@ function getBookkeepingStatusConfig({
|
|
|
15986
16100
|
const monthName = monthNumber !== void 0 ? getMonthNameFromNumber(monthNumber) : "";
|
|
15987
16101
|
const actionPhrase = incompleteTasksCount !== void 0 && incompleteTasksCount > 0 ? `Please complete the ${pluralize("open task", incompleteTasksCount, true)}.` : "No action is needed from you right now.";
|
|
15988
16102
|
switch (status) {
|
|
15989
|
-
case "IN_PROGRESS_AWAITING_BOOKKEEPER"
|
|
15990
|
-
case "NOT_STARTED"
|
|
15991
|
-
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 */: {
|
|
15992
16106
|
return {
|
|
15993
16107
|
label: "Books in progress",
|
|
15994
16108
|
description: `We're working on your ${monthName} books. ${actionPhrase}`,
|
|
@@ -15996,8 +16110,8 @@ function getBookkeepingStatusConfig({
|
|
|
15996
16110
|
icon: /* @__PURE__ */ jsx121(Clock_default, { size: 12 })
|
|
15997
16111
|
};
|
|
15998
16112
|
}
|
|
15999
|
-
case "IN_PROGRESS_AWAITING_CUSTOMER"
|
|
16000
|
-
case "CLOSED_OPEN_TASKS"
|
|
16113
|
+
case "IN_PROGRESS_AWAITING_CUSTOMER" /* IN_PROGRESS_AWAITING_CUSTOMER */:
|
|
16114
|
+
case "CLOSED_OPEN_TASKS" /* CLOSED_OPEN_TASKS */: {
|
|
16001
16115
|
return {
|
|
16002
16116
|
label: "Action required",
|
|
16003
16117
|
description: `Please respond to the below tasks to help us complete your ${monthName} books.`,
|
|
@@ -16005,7 +16119,7 @@ function getBookkeepingStatusConfig({
|
|
|
16005
16119
|
icon: /* @__PURE__ */ jsx121(AlertCircle_default, { size: 12 })
|
|
16006
16120
|
};
|
|
16007
16121
|
}
|
|
16008
|
-
case "CLOSED_COMPLETE"
|
|
16122
|
+
case "CLOSED_COMPLETE" /* CLOSED_COMPLETE */: {
|
|
16009
16123
|
return {
|
|
16010
16124
|
label: "Books completed",
|
|
16011
16125
|
description: `Your ${monthName} books are complete and ready to view!`,
|
|
@@ -16013,7 +16127,7 @@ function getBookkeepingStatusConfig({
|
|
|
16013
16127
|
icon: /* @__PURE__ */ jsx121(CheckCircle_default, { size: 12 })
|
|
16014
16128
|
};
|
|
16015
16129
|
}
|
|
16016
|
-
case "BOOKKEEPING_NOT_ACTIVE"
|
|
16130
|
+
case "BOOKKEEPING_NOT_ACTIVE" /* BOOKKEEPING_NOT_ACTIVE */: {
|
|
16017
16131
|
return;
|
|
16018
16132
|
}
|
|
16019
16133
|
default: {
|
|
@@ -16028,7 +16142,7 @@ function getBookkeepingStatusConfig({
|
|
|
16028
16142
|
|
|
16029
16143
|
// src/components/BookkeepingStatus/BookkeepingStatus.tsx
|
|
16030
16144
|
import { jsx as jsx122, jsxs as jsxs76 } from "react/jsx-runtime";
|
|
16031
|
-
var
|
|
16145
|
+
var BookkeepingStatus2 = ({ status, text, monthNumber, iconOnly }) => {
|
|
16032
16146
|
if (!status) {
|
|
16033
16147
|
return;
|
|
16034
16148
|
}
|
|
@@ -16053,7 +16167,7 @@ var BookkeepingStatus = ({ status, text, monthNumber, iconOnly }) => {
|
|
|
16053
16167
|
// src/components/BankTransactionList/BankTransactionProcessingInfo.tsx
|
|
16054
16168
|
import { jsx as jsx123, jsxs as jsxs77 } from "react/jsx-runtime";
|
|
16055
16169
|
var BankTransactionProcessingInfo = () => /* @__PURE__ */ jsxs77(Tooltip, { offset: 12, children: [
|
|
16056
|
-
/* @__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" }) }),
|
|
16057
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." })
|
|
16058
16172
|
] });
|
|
16059
16173
|
|
|
@@ -18158,7 +18272,7 @@ function TransactionsActions({ children }) {
|
|
|
18158
18272
|
|
|
18159
18273
|
// src/hooks/useBankTransactions/useBankTransactionsDownload.ts
|
|
18160
18274
|
import useSWRMutation6 from "swr/mutation";
|
|
18161
|
-
function
|
|
18275
|
+
function buildKey13({
|
|
18162
18276
|
access_token: accessToken,
|
|
18163
18277
|
apiUrl,
|
|
18164
18278
|
businessId
|
|
@@ -18176,7 +18290,7 @@ function useBankTransactionsDownload() {
|
|
|
18176
18290
|
const { data } = useAuth();
|
|
18177
18291
|
const { businessId } = useLayerContext();
|
|
18178
18292
|
return useSWRMutation6(
|
|
18179
|
-
() =>
|
|
18293
|
+
() => buildKey13(__spreadProps(__spreadValues({}, data), {
|
|
18180
18294
|
businessId
|
|
18181
18295
|
})),
|
|
18182
18296
|
({
|
|
@@ -18563,7 +18677,7 @@ var BankTransactionsContent = ({
|
|
|
18563
18677
|
}, [monthlyView, isVisible, isLoading, hasMore]);
|
|
18564
18678
|
useEffect23(() => {
|
|
18565
18679
|
if (JSON.stringify(inputFilters) !== JSON.stringify(filters)) {
|
|
18566
|
-
if (effectiveBookkeepingStatus === "ACTIVE") {
|
|
18680
|
+
if (effectiveBookkeepingStatus === "ACTIVE" /* ACTIVE */) {
|
|
18567
18681
|
setFilters(__spreadProps(__spreadValues(__spreadValues({}, filters), inputFilters), {
|
|
18568
18682
|
categorizationStatus: "all" /* all */
|
|
18569
18683
|
}));
|
|
@@ -18734,13 +18848,13 @@ var BankTransactionsContent = ({
|
|
|
18734
18848
|
};
|
|
18735
18849
|
|
|
18736
18850
|
// src/components/Integrations/Integrations.tsx
|
|
18737
|
-
import { useContext as
|
|
18851
|
+
import { useContext as useContext26 } from "react";
|
|
18738
18852
|
|
|
18739
18853
|
// src/components/Integrations/IntegrationsContent.tsx
|
|
18740
|
-
import { useContext as
|
|
18854
|
+
import { useContext as useContext24 } from "react";
|
|
18741
18855
|
|
|
18742
18856
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumb.tsx
|
|
18743
|
-
import { useContext as
|
|
18857
|
+
import { useCallback as useCallback10, useContext as useContext23, useMemo as useMemo20, useState as useState37 } from "react";
|
|
18744
18858
|
|
|
18745
18859
|
// src/icons/QuickbooksIcon.tsx
|
|
18746
18860
|
import { jsx as jsx153, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
@@ -18829,214 +18943,326 @@ var Card = ({ children, className }) => {
|
|
|
18829
18943
|
import { createContext as createContext13 } from "react";
|
|
18830
18944
|
var QuickbooksContext = createContext13({
|
|
18831
18945
|
linkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
|
|
18832
|
-
unlinkQuickbooks: () =>
|
|
18833
|
-
throw new Error("QuickbooksContext used without Provider");
|
|
18834
|
-
},
|
|
18946
|
+
unlinkQuickbooks: () => Promise.reject(new Error("QuickbooksContext used without Provider")),
|
|
18835
18947
|
syncFromQuickbooks: () => {
|
|
18836
18948
|
throw new Error("QuickbooksContext used without Provider");
|
|
18837
18949
|
},
|
|
18838
|
-
|
|
18839
|
-
quickbooksIsConnected: false,
|
|
18840
|
-
quickbooksLastSyncedAt: void 0
|
|
18950
|
+
quickbooksConnectionStatus: void 0
|
|
18841
18951
|
});
|
|
18842
18952
|
|
|
18843
18953
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumbFooter.tsx
|
|
18844
18954
|
import { useContext as useContext21 } from "react";
|
|
18845
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
|
|
18846
18973
|
import { jsx as jsx157, jsxs as jsxs99 } from "react/jsx-runtime";
|
|
18847
18974
|
var formatLastSyncedAt = (datetime) => {
|
|
18848
18975
|
const parsed = new Date(datetime);
|
|
18849
18976
|
if (!isValid(parsed)) return "";
|
|
18850
18977
|
return `${format(parsed, "MMMM d, yyyy")} at ${format(parsed, "h:mm a")}`;
|
|
18851
18978
|
};
|
|
18852
|
-
var
|
|
18853
|
-
|
|
18854
|
-
|
|
18855
|
-
|
|
18856
|
-
|
|
18857
|
-
|
|
18858
|
-
|
|
18859
|
-
|
|
18860
|
-
|
|
18861
|
-
|
|
18862
|
-
|
|
18863
|
-
|
|
18864
|
-
|
|
18865
|
-
|
|
18866
|
-
|
|
18867
|
-
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
|
|
18874
|
-
|
|
18875
|
-
|
|
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
|
+
}
|
|
18876
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);
|
|
18877
19015
|
return /* @__PURE__ */ jsxs99(HStack, { className: "loadingbar", children: [
|
|
18878
19016
|
/* @__PURE__ */ jsxs99(VStack, { children: [
|
|
18879
|
-
/* @__PURE__ */ jsx157(Text, { size: "sm" /* sm */, children:
|
|
18880
|
-
/* @__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 })
|
|
18881
19019
|
] }),
|
|
18882
19020
|
/* @__PURE__ */ jsx157(Spacer, {}),
|
|
18883
|
-
/* @__PURE__ */ jsx157(BadgeLoader, { variant:
|
|
19021
|
+
/* @__PURE__ */ jsx157(BadgeLoader, { variant: badgeVariant })
|
|
18884
19022
|
] });
|
|
18885
19023
|
};
|
|
18886
19024
|
|
|
18887
19025
|
// src/components/Integrations/IntegrationsQuickbooksItemThumb/IntegrationsQuickbooksItemThumb.tsx
|
|
18888
|
-
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
|
+
};
|
|
18889
19114
|
var IntegrationsQuickbooksItemThumb = () => {
|
|
18890
|
-
const {
|
|
18891
|
-
|
|
18892
|
-
|
|
18893
|
-
|
|
18894
|
-
|
|
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]);
|
|
18895
19122
|
const menuConfig = useMemo20(() => {
|
|
18896
19123
|
return [
|
|
18897
19124
|
{
|
|
18898
19125
|
name: "Unlink account",
|
|
18899
19126
|
action: () => {
|
|
18900
|
-
|
|
18901
|
-
unlinkQuickbooks();
|
|
18902
|
-
}
|
|
19127
|
+
setIsConfirmationModalOpen(true);
|
|
18903
19128
|
}
|
|
18904
19129
|
}
|
|
18905
19130
|
];
|
|
18906
|
-
}, [
|
|
18907
|
-
|
|
18908
|
-
|
|
18909
|
-
|
|
18910
|
-
|
|
18911
|
-
|
|
18912
|
-
|
|
18913
|
-
|
|
18914
|
-
|
|
18915
|
-
|
|
18916
|
-
|
|
18917
|
-
|
|
18918
|
-
|
|
18919
|
-
|
|
18920
|
-
|
|
18921
|
-
|
|
18922
|
-
|
|
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 }) })
|
|
18923
19154
|
] }),
|
|
18924
|
-
/* @__PURE__ */
|
|
19155
|
+
/* @__PURE__ */ jsx159(IntegrationsQuickbooksItemThumbFooter, { quickbooksUiState })
|
|
18925
19156
|
] }),
|
|
18926
|
-
/* @__PURE__ */
|
|
18927
|
-
] })
|
|
19157
|
+
/* @__PURE__ */ jsx159(IntegrationsQuickbooksUnlinkConfirmationModal, { isOpen: isConfirmationModalOpen, onOpenChange: setIsConfirmationModalOpen })
|
|
19158
|
+
] });
|
|
18928
19159
|
};
|
|
18929
19160
|
|
|
18930
19161
|
// src/components/Integrations/IntegrationsContent.tsx
|
|
18931
|
-
import { jsx as
|
|
19162
|
+
import { jsx as jsx160 } from "react/jsx-runtime";
|
|
18932
19163
|
var IntegrationsContent = () => {
|
|
18933
|
-
const {
|
|
18934
|
-
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, {}) });
|
|
18935
19166
|
};
|
|
18936
19167
|
|
|
18937
19168
|
// src/hooks/useQuickbooks/useQuickbooks.ts
|
|
18938
|
-
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";
|
|
18939
19171
|
var useQuickbooks = () => {
|
|
19172
|
+
var _a;
|
|
18940
19173
|
const { businessId } = useLayerContext();
|
|
18941
19174
|
const { apiUrl } = useEnvironment();
|
|
18942
19175
|
const { data: auth } = useAuth();
|
|
18943
|
-
const [
|
|
18944
|
-
const
|
|
19176
|
+
const [quickbooksConnectionStatus, setQuickbooksConnectionStatus] = useState38(void 0);
|
|
19177
|
+
const isSyncingFromQuickbooks = (_a = quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_syncing) != null ? _a : false;
|
|
18945
19178
|
const syncStatusIntervalRef = useRef20(null);
|
|
18946
|
-
const
|
|
18947
|
-
const fetchQuickbooksConnectionStatus = useCallback9(() => __async(null, null, function* () {
|
|
19179
|
+
const fetchQuickbooksConnectionStatus = useCallback11(() => __async(null, null, function* () {
|
|
18948
19180
|
const newQuickbooksConnectionStatus = (yield Layer.statusOfQuickbooksConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18949
19181
|
params: { businessId }
|
|
18950
19182
|
})()).data;
|
|
18951
19183
|
setQuickbooksConnectionStatus(newQuickbooksConnectionStatus);
|
|
18952
19184
|
}), [apiUrl, auth == null ? void 0 : auth.access_token, businessId, setQuickbooksConnectionStatus]);
|
|
18953
|
-
const fetchIsSyncingFromQuickbooks = useCallback9(() => __async(null, null, function* () {
|
|
18954
|
-
const isSyncing = (yield Layer.statusOfSyncFromQuickbooks(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18955
|
-
params: { businessId }
|
|
18956
|
-
})()).data.is_syncing;
|
|
18957
|
-
const wasSyncing = wasSyncingFromQuickbooksRef.current;
|
|
18958
|
-
wasSyncingFromQuickbooksRef.current = isSyncing;
|
|
18959
|
-
setIsSyncingFromQuickbooks(isSyncing);
|
|
18960
|
-
if (!isSyncing && wasSyncing) {
|
|
18961
|
-
yield fetchQuickbooksConnectionStatus();
|
|
18962
|
-
}
|
|
18963
|
-
}), [apiUrl, auth == null ? void 0 : auth.access_token, businessId, setIsSyncingFromQuickbooks, fetchQuickbooksConnectionStatus]);
|
|
18964
19185
|
useEffect24(() => {
|
|
18965
19186
|
if (isSyncingFromQuickbooks && syncStatusIntervalRef.current === null) {
|
|
18966
|
-
const interval = window.setInterval(() => void
|
|
19187
|
+
const interval = window.setInterval(() => void fetchQuickbooksConnectionStatus(), 2e3);
|
|
18967
19188
|
syncStatusIntervalRef.current = interval;
|
|
18968
19189
|
return () => clearInterval(interval);
|
|
18969
19190
|
} else if (!isSyncingFromQuickbooks && syncStatusIntervalRef.current) {
|
|
18970
19191
|
clearInterval(syncStatusIntervalRef.current);
|
|
18971
19192
|
syncStatusIntervalRef.current = null;
|
|
18972
19193
|
}
|
|
18973
|
-
}, [
|
|
19194
|
+
}, [fetchQuickbooksConnectionStatus, isSyncingFromQuickbooks]);
|
|
18974
19195
|
useEffect24(() => {
|
|
18975
19196
|
if (auth == null ? void 0 : auth.access_token) {
|
|
18976
19197
|
void fetchQuickbooksConnectionStatus();
|
|
18977
19198
|
}
|
|
18978
19199
|
}, [auth == null ? void 0 : auth.access_token, fetchQuickbooksConnectionStatus]);
|
|
18979
|
-
const
|
|
18980
|
-
|
|
18981
|
-
|
|
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);
|
|
18982
19211
|
void Layer.syncFromQuickbooks(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18983
19212
|
params: { businessId }
|
|
18984
|
-
});
|
|
18985
|
-
}, [apiUrl, auth == null ? void 0 : auth.access_token, businessId,
|
|
18986
|
-
const linkQuickbooks =
|
|
18987
|
-
|
|
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, {
|
|
18988
19217
|
params: { businessId }
|
|
18989
|
-
});
|
|
18990
|
-
return res.data.redirect_url;
|
|
19218
|
+
}).then((res) => res.data.redirect_url);
|
|
18991
19219
|
}), [apiUrl, auth == null ? void 0 : auth.access_token, businessId]);
|
|
18992
|
-
const unlinkQuickbooks =
|
|
18993
|
-
|
|
19220
|
+
const unlinkQuickbooks = useCallback11(() => __async(null, null, function* () {
|
|
19221
|
+
return Layer.unlinkQuickbooksConnection(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
18994
19222
|
params: { businessId }
|
|
18995
19223
|
}).then(() => fetchQuickbooksConnectionStatus());
|
|
18996
|
-
}, [apiUrl, auth == null ? void 0 : auth.access_token, businessId, fetchQuickbooksConnectionStatus]);
|
|
19224
|
+
}), [apiUrl, auth == null ? void 0 : auth.access_token, businessId, fetchQuickbooksConnectionStatus]);
|
|
18997
19225
|
return {
|
|
18998
|
-
isSyncingFromQuickbooks,
|
|
18999
19226
|
syncFromQuickbooks: syncFromQuickbooks2,
|
|
19000
|
-
quickbooksIsConnected: quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected,
|
|
19001
|
-
quickbooksLastSyncedAt: quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.last_synced_at,
|
|
19002
19227
|
linkQuickbooks,
|
|
19003
|
-
unlinkQuickbooks
|
|
19228
|
+
unlinkQuickbooks,
|
|
19229
|
+
quickbooksConnectionStatus
|
|
19004
19230
|
};
|
|
19005
19231
|
};
|
|
19006
19232
|
|
|
19007
19233
|
// src/providers/QuickbooksContextProvider/QuickbooksContextProvider.tsx
|
|
19008
|
-
import { jsx as
|
|
19234
|
+
import { jsx as jsx161 } from "react/jsx-runtime";
|
|
19009
19235
|
function QuickbooksContextProvider({ children }) {
|
|
19010
19236
|
const quickbooksContextData = useQuickbooks();
|
|
19011
|
-
return /* @__PURE__ */
|
|
19237
|
+
return /* @__PURE__ */ jsx161(QuickbooksContext.Provider, { value: quickbooksContextData, children });
|
|
19012
19238
|
}
|
|
19013
19239
|
|
|
19014
19240
|
// src/components/Integrations/IntegrationsConnectMenu/IntegrationsConnectMenu.tsx
|
|
19015
|
-
import { useCallback as
|
|
19241
|
+
import { useCallback as useCallback12, useContext as useContext25, useState as useState39 } from "react";
|
|
19016
19242
|
|
|
19017
19243
|
// src/components/ui/DropdownMenu/DropdownMenu.tsx
|
|
19018
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";
|
|
19019
|
-
import { jsx as
|
|
19020
|
-
var Heading3 = ({ children }) => /* @__PURE__ */
|
|
19021
|
-
var MenuItem3 = ({ children, onClick, isDisabled }) => /* @__PURE__ */
|
|
19022
|
-
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 });
|
|
19023
19249
|
var DropdownMenu = ({ children, ariaLabel, slots, slotProps }) => {
|
|
19024
19250
|
var _a;
|
|
19025
19251
|
const { Trigger } = slots;
|
|
19026
19252
|
const width = (_a = slotProps == null ? void 0 : slotProps.Dialog) == null ? void 0 : _a.width;
|
|
19027
|
-
return /* @__PURE__ */
|
|
19028
|
-
/* @__PURE__ */
|
|
19029
|
-
/* @__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 }) })
|
|
19030
19256
|
] });
|
|
19031
19257
|
};
|
|
19032
19258
|
|
|
19033
19259
|
// src/icons/Cog.tsx
|
|
19034
19260
|
import { useId } from "react";
|
|
19035
|
-
import { jsx as
|
|
19261
|
+
import { jsx as jsx163, jsxs as jsxs103 } from "react/jsx-runtime";
|
|
19036
19262
|
var Cog = (_a) => {
|
|
19037
19263
|
var _b = _a, { size = 12 } = _b, props = __objRest(_b, ["size"]);
|
|
19038
19264
|
const id = useId();
|
|
19039
|
-
return /* @__PURE__ */
|
|
19265
|
+
return /* @__PURE__ */ jsxs103(
|
|
19040
19266
|
"svg",
|
|
19041
19267
|
__spreadProps(__spreadValues({
|
|
19042
19268
|
xmlns: "http://www.w3.org/2000/svg",
|
|
@@ -19046,11 +19272,11 @@ var Cog = (_a) => {
|
|
|
19046
19272
|
height: size
|
|
19047
19273
|
}, props), {
|
|
19048
19274
|
children: [
|
|
19049
|
-
/* @__PURE__ */
|
|
19050
|
-
/* @__PURE__ */
|
|
19051
|
-
/* @__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" })
|
|
19052
19278
|
] }),
|
|
19053
|
-
/* @__PURE__ */
|
|
19279
|
+
/* @__PURE__ */ jsx163("defs", { children: /* @__PURE__ */ jsx163("clipPath", { id, children: /* @__PURE__ */ jsx163("rect", { width: "12", height: "12", fill: "white" }) }) })
|
|
19054
19280
|
]
|
|
19055
19281
|
})
|
|
19056
19282
|
);
|
|
@@ -19058,38 +19284,42 @@ var Cog = (_a) => {
|
|
|
19058
19284
|
var Cog_default = Cog;
|
|
19059
19285
|
|
|
19060
19286
|
// src/components/Integrations/IntegrationsConnectMenu/IntegrationsConnectMenu.tsx
|
|
19061
|
-
import { jsx as
|
|
19062
|
-
var MenuTriggerButton = () => /* @__PURE__ */
|
|
19287
|
+
import { jsx as jsx164, jsxs as jsxs104 } from "react/jsx-runtime";
|
|
19288
|
+
var MenuTriggerButton = () => /* @__PURE__ */ jsxs104(Button2, { variant: "ghost", children: [
|
|
19063
19289
|
"Manage",
|
|
19064
|
-
/* @__PURE__ */
|
|
19290
|
+
/* @__PURE__ */ jsx164(Cog_default, { size: 16 })
|
|
19065
19291
|
] });
|
|
19066
19292
|
var IntegrationsConnectMenu = () => {
|
|
19067
|
-
const {
|
|
19068
|
-
|
|
19069
|
-
|
|
19070
|
-
|
|
19071
|
-
const initiateQuickbooksOAuth =
|
|
19072
|
-
|
|
19073
|
-
|
|
19074
|
-
|
|
19075
|
-
|
|
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(
|
|
19076
19306
|
DropdownMenu,
|
|
19077
19307
|
{
|
|
19078
19308
|
ariaLabel: "Connect Integration",
|
|
19079
19309
|
slots: { Trigger: MenuTriggerButton },
|
|
19080
19310
|
slotProps: { Dialog: { width: 280 } },
|
|
19081
19311
|
children: [
|
|
19082
|
-
/* @__PURE__ */
|
|
19083
|
-
/* @__PURE__ */
|
|
19084
|
-
/* @__PURE__ */
|
|
19085
|
-
/* @__PURE__ */
|
|
19086
|
-
/* @__PURE__ */
|
|
19087
|
-
/* @__PURE__ */
|
|
19088
|
-
] }, "quickbooks-connected") : /* @__PURE__ */
|
|
19089
|
-
/* @__PURE__ */
|
|
19090
|
-
/* @__PURE__ */
|
|
19091
|
-
/* @__PURE__ */
|
|
19092
|
-
/* @__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 })
|
|
19093
19323
|
] }, "connect-quickbooks") })
|
|
19094
19324
|
]
|
|
19095
19325
|
}
|
|
@@ -19097,20 +19327,20 @@ var IntegrationsConnectMenu = () => {
|
|
|
19097
19327
|
};
|
|
19098
19328
|
|
|
19099
19329
|
// src/components/Integrations/Integrations.tsx
|
|
19100
|
-
import { jsx as
|
|
19330
|
+
import { jsx as jsx165, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
19101
19331
|
var COMPONENT_NAME3 = "integrations";
|
|
19102
|
-
var
|
|
19103
|
-
return /* @__PURE__ */
|
|
19332
|
+
var Integrations = (props) => {
|
|
19333
|
+
return /* @__PURE__ */ jsx165(QuickbooksContextProvider, { children: /* @__PURE__ */ jsx165(IntegrationsComponent, __spreadValues({}, props)) });
|
|
19104
19334
|
};
|
|
19105
19335
|
var IntegrationsComponent = ({
|
|
19106
19336
|
elevated,
|
|
19107
19337
|
stringOverrides
|
|
19108
19338
|
}) => {
|
|
19109
|
-
const {
|
|
19110
|
-
const isLoading =
|
|
19111
|
-
return /* @__PURE__ */
|
|
19112
|
-
/* @__PURE__ */
|
|
19113
|
-
/* @__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(
|
|
19114
19344
|
Heading,
|
|
19115
19345
|
{
|
|
19116
19346
|
className: "Layer__linked-accounts__title",
|
|
@@ -19118,52 +19348,17 @@ var IntegrationsComponent = ({
|
|
|
19118
19348
|
children: (stringOverrides == null ? void 0 : stringOverrides.title) || "Integrations"
|
|
19119
19349
|
}
|
|
19120
19350
|
),
|
|
19121
|
-
/* @__PURE__ */
|
|
19351
|
+
/* @__PURE__ */ jsx165(IntegrationsConnectMenu, {})
|
|
19122
19352
|
] }),
|
|
19123
|
-
isLoading && /* @__PURE__ */
|
|
19124
|
-
!isLoading && !
|
|
19353
|
+
isLoading && /* @__PURE__ */ jsx165("div", { className: "Layer__linked-accounts__loader-container", children: /* @__PURE__ */ jsx165(Loader2, {}) }),
|
|
19354
|
+
!isLoading && !quickbooksConnectionStatus.is_connected && /* @__PURE__ */ jsx165(
|
|
19125
19355
|
DataState,
|
|
19126
19356
|
{
|
|
19127
19357
|
status: "info" /* info */,
|
|
19128
19358
|
title: "No active integrations"
|
|
19129
19359
|
}
|
|
19130
19360
|
),
|
|
19131
|
-
|
|
19132
|
-
] });
|
|
19133
|
-
};
|
|
19134
|
-
|
|
19135
|
-
// src/components/Quickbooks/Quickbooks.tsx
|
|
19136
|
-
import { jsx as jsx165, jsxs as jsxs105 } from "react/jsx-runtime";
|
|
19137
|
-
var Quickbooks = () => {
|
|
19138
|
-
const {
|
|
19139
|
-
syncFromQuickbooks: syncFromQuickbooks2,
|
|
19140
|
-
isSyncingFromQuickbooks,
|
|
19141
|
-
quickbooksIsConnected,
|
|
19142
|
-
linkQuickbooks,
|
|
19143
|
-
unlinkQuickbooks
|
|
19144
|
-
} = useQuickbooks();
|
|
19145
|
-
return /* @__PURE__ */ jsxs105("div", { children: [
|
|
19146
|
-
/* @__PURE__ */ jsxs105("div", { children: [
|
|
19147
|
-
"Quickbooks OAuth connection status:",
|
|
19148
|
-
" ",
|
|
19149
|
-
quickbooksIsConnected === void 0 ? "" : quickbooksIsConnected ? "established" : "not connected"
|
|
19150
|
-
] }),
|
|
19151
|
-
/* @__PURE__ */ jsx165("br", {}),
|
|
19152
|
-
quickbooksIsConnected === void 0 && "Loading...",
|
|
19153
|
-
quickbooksIsConnected === false && /* @__PURE__ */ jsx165(
|
|
19154
|
-
"button",
|
|
19155
|
-
{
|
|
19156
|
-
onClick: () => __async(null, null, function* () {
|
|
19157
|
-
const authorizationUrl = yield linkQuickbooks();
|
|
19158
|
-
window.location.href = authorizationUrl;
|
|
19159
|
-
}),
|
|
19160
|
-
children: "Link Quickbooks"
|
|
19161
|
-
}
|
|
19162
|
-
),
|
|
19163
|
-
quickbooksIsConnected === true && (isSyncingFromQuickbooks ? "Syncing data from Quickbooks..." : /* @__PURE__ */ jsxs105("div", { children: [
|
|
19164
|
-
/* @__PURE__ */ jsx165("button", { onClick: syncFromQuickbooks2, children: "Sync Quickbooks" }),
|
|
19165
|
-
/* @__PURE__ */ jsx165("button", { onClick: unlinkQuickbooks, children: "Unlink Quickbooks" })
|
|
19166
|
-
] }))
|
|
19361
|
+
(quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected) && /* @__PURE__ */ jsx165(IntegrationsContent, {})
|
|
19167
19362
|
] });
|
|
19168
19363
|
};
|
|
19169
19364
|
|
|
@@ -19193,7 +19388,7 @@ var PNLComparisonContext = createContext14({
|
|
|
19193
19388
|
});
|
|
19194
19389
|
|
|
19195
19390
|
// src/hooks/useProfitAndLoss/useProfitAndLoss.tsx
|
|
19196
|
-
import { useCallback as
|
|
19391
|
+
import { useCallback as useCallback13, useMemo as useMemo22, useState as useState41 } from "react";
|
|
19197
19392
|
|
|
19198
19393
|
// src/utils/profitAndLossUtils.ts
|
|
19199
19394
|
var doesLineItemQualifies = (item) => {
|
|
@@ -19249,9 +19444,9 @@ var applyShare = (items, total) => {
|
|
|
19249
19444
|
};
|
|
19250
19445
|
|
|
19251
19446
|
// src/hooks/useProfitAndLoss/useProfitAndLossLTM.tsx
|
|
19252
|
-
import { useEffect as useEffect25, useMemo as useMemo21, useState as
|
|
19447
|
+
import { useEffect as useEffect25, useMemo as useMemo21, useState as useState40 } from "react";
|
|
19253
19448
|
import { startOfMonth as startOfMonth7, sub } from "date-fns";
|
|
19254
|
-
import
|
|
19449
|
+
import useSWR9 from "swr";
|
|
19255
19450
|
var buildDates = ({ currentDate }) => {
|
|
19256
19451
|
return {
|
|
19257
19452
|
startYear: startOfMonth7(currentDate).getFullYear() - 1,
|
|
@@ -19277,9 +19472,9 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
19277
19472
|
const { businessId, syncTimestamps, read, hasBeenTouched } = useLayerContext();
|
|
19278
19473
|
const { apiUrl } = useEnvironment();
|
|
19279
19474
|
const { data: auth } = useAuth();
|
|
19280
|
-
const [date, setDate] =
|
|
19281
|
-
const [loaded, setLoaded] =
|
|
19282
|
-
const [data, setData] =
|
|
19475
|
+
const [date, setDate] = useState40(currentDate);
|
|
19476
|
+
const [loaded, setLoaded] = useState40("initial");
|
|
19477
|
+
const [data, setData] = useState40([]);
|
|
19283
19478
|
const { startYear, startMonth, endYear, endMonth } = useMemo21(() => {
|
|
19284
19479
|
return buildDates({ currentDate: date });
|
|
19285
19480
|
}, [date, businessId, tagFilter, reportingBasis]);
|
|
@@ -19292,7 +19487,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
19292
19487
|
isValidating,
|
|
19293
19488
|
error,
|
|
19294
19489
|
mutate
|
|
19295
|
-
} =
|
|
19490
|
+
} = useSWR9(
|
|
19296
19491
|
queryKey,
|
|
19297
19492
|
Layer.getProfitAndLossSummaries(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
19298
19493
|
params: {
|
|
@@ -19405,7 +19600,7 @@ var useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
19405
19600
|
// src/hooks/useProfitAndLoss/useProfitAndLossQuery.tsx
|
|
19406
19601
|
import { useEffect as useEffect26 } from "react";
|
|
19407
19602
|
import { startOfMonth as startOfMonth8, endOfMonth as endOfMonth7 } from "date-fns";
|
|
19408
|
-
import
|
|
19603
|
+
import useSWR10 from "swr";
|
|
19409
19604
|
var useProfitAndLossQuery = ({
|
|
19410
19605
|
startDate,
|
|
19411
19606
|
endDate,
|
|
@@ -19428,7 +19623,7 @@ var useProfitAndLossQuery = ({
|
|
|
19428
19623
|
isValidating,
|
|
19429
19624
|
error: rawError,
|
|
19430
19625
|
mutate
|
|
19431
|
-
} =
|
|
19626
|
+
} = useSWR10(
|
|
19432
19627
|
queryKey,
|
|
19433
19628
|
Layer.getProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
19434
19629
|
businessId,
|
|
@@ -19471,15 +19666,15 @@ var useProfitAndLoss = ({
|
|
|
19471
19666
|
const { start, end } = useGlobalDateRange();
|
|
19472
19667
|
const { setRange } = useGlobalDateRangeActions();
|
|
19473
19668
|
const dateRange = useMemo22(() => ({ startDate: start, endDate: end }), [start, end]);
|
|
19474
|
-
const changeDateRange =
|
|
19669
|
+
const changeDateRange = useCallback13(
|
|
19475
19670
|
({ startDate: start2, endDate: end2 }) => setRange({ start: start2, end: end2 }),
|
|
19476
19671
|
[setRange]
|
|
19477
19672
|
);
|
|
19478
|
-
const [filters, setFilters] =
|
|
19673
|
+
const [filters, setFilters] = useState41({
|
|
19479
19674
|
expenses: void 0,
|
|
19480
19675
|
revenue: void 0
|
|
19481
19676
|
});
|
|
19482
|
-
const [sidebarScope, setSidebarScope] =
|
|
19677
|
+
const [sidebarScope, setSidebarScope] = useState41(void 0);
|
|
19483
19678
|
const { data, isLoading, isValidating, error, refetch } = useProfitAndLossQuery({
|
|
19484
19679
|
startDate: start,
|
|
19485
19680
|
endDate: end,
|
|
@@ -19632,7 +19827,7 @@ var useProfitAndLoss = ({
|
|
|
19632
19827
|
};
|
|
19633
19828
|
|
|
19634
19829
|
// src/hooks/useProfitAndLossComparison/useProfitAndLossComparison.tsx
|
|
19635
|
-
import { useMemo as useMemo23, useState as
|
|
19830
|
+
import { useMemo as useMemo23, useState as useState42 } from "react";
|
|
19636
19831
|
|
|
19637
19832
|
// src/hooks/useProfitAndLossComparison/utils.ts
|
|
19638
19833
|
import { getMonth, getYear as getYear2, startOfMonth as startOfMonth9, startOfYear as startOfYear4, subMonths as subMonths3, subYears as subYears3 } from "date-fns";
|
|
@@ -19755,14 +19950,14 @@ function preparePeriodsBody(dateRange, comparePeriods, rangeDisplayMode) {
|
|
|
19755
19950
|
}
|
|
19756
19951
|
|
|
19757
19952
|
// src/hooks/useProfitAndLossComparison/useProfitAndLossComparison.tsx
|
|
19758
|
-
import
|
|
19953
|
+
import useSWR11 from "swr";
|
|
19759
19954
|
var COMPARE_MODES_SUPPORTING_MULTI_PERIOD = ["monthPicker", "yearPicker"];
|
|
19760
19955
|
var isNotOnlyNoneTag = (compareOptions) => {
|
|
19761
19956
|
return Boolean(
|
|
19762
19957
|
compareOptions == null ? void 0 : compareOptions.some((option) => option.tagFilterConfig.tagFilters !== "None")
|
|
19763
19958
|
);
|
|
19764
19959
|
};
|
|
19765
|
-
function
|
|
19960
|
+
function buildKey14({
|
|
19766
19961
|
access_token: accessToken,
|
|
19767
19962
|
apiUrl,
|
|
19768
19963
|
businessId,
|
|
@@ -19786,8 +19981,8 @@ function useProfitAndLossComparison({
|
|
|
19786
19981
|
comparisonConfig
|
|
19787
19982
|
}) {
|
|
19788
19983
|
var _a, _b;
|
|
19789
|
-
const [comparePeriods, setComparePeriods] =
|
|
19790
|
-
const [selectedCompareOptions, setSelectedCompareOptionsState] =
|
|
19984
|
+
const [comparePeriods, setComparePeriods] = useState42((_a = comparisonConfig == null ? void 0 : comparisonConfig.defaultPeriods) != null ? _a : 1);
|
|
19985
|
+
const [selectedCompareOptions, setSelectedCompareOptionsState] = useState42(
|
|
19791
19986
|
(comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter) ? [comparisonConfig == null ? void 0 : comparisonConfig.defaultTagFilter] : []
|
|
19792
19987
|
);
|
|
19793
19988
|
const { rangeDisplayMode, start, end } = useGlobalDateRange();
|
|
@@ -19812,14 +20007,14 @@ function useProfitAndLossComparison({
|
|
|
19812
20007
|
const { data: auth } = useAuth();
|
|
19813
20008
|
const periods = preparePeriodsBody(dateRange, effectiveComparePeriods, rangeDisplayMode);
|
|
19814
20009
|
const tagFilters = prepareFiltersBody(selectedCompareOptions);
|
|
19815
|
-
const queryKey =
|
|
20010
|
+
const queryKey = buildKey14(__spreadProps(__spreadValues({}, auth), {
|
|
19816
20011
|
businessId,
|
|
19817
20012
|
periods,
|
|
19818
20013
|
tagFilters,
|
|
19819
20014
|
reportingBasis,
|
|
19820
20015
|
compareModeActive
|
|
19821
20016
|
}));
|
|
19822
|
-
const { data, isLoading, isValidating } =
|
|
20017
|
+
const { data, isLoading, isValidating } = useSWR11(
|
|
19823
20018
|
queryKey,
|
|
19824
20019
|
() => __async(null, null, function* () {
|
|
19825
20020
|
const response = yield Layer.compareProfitAndLoss(apiUrl, auth == null ? void 0 : auth.access_token, {
|
|
@@ -19867,7 +20062,7 @@ function useProfitAndLossComparison({
|
|
|
19867
20062
|
}
|
|
19868
20063
|
|
|
19869
20064
|
// src/components/ProfitAndLossChart/ProfitAndLossChart.tsx
|
|
19870
|
-
import { useEffect as useEffect27, useMemo as useMemo24, useState as
|
|
20065
|
+
import { useEffect as useEffect27, useMemo as useMemo24, useState as useState43 } from "react";
|
|
19871
20066
|
|
|
19872
20067
|
// src/icons/BarChart2.tsx
|
|
19873
20068
|
import { jsx as jsx166, jsxs as jsxs106 } from "react/jsx-runtime";
|
|
@@ -19981,7 +20176,7 @@ import {
|
|
|
19981
20176
|
add,
|
|
19982
20177
|
differenceInMonths as differenceInMonths2,
|
|
19983
20178
|
endOfMonth as endOfMonth8,
|
|
19984
|
-
format as
|
|
20179
|
+
format as format3,
|
|
19985
20180
|
startOfMonth as startOfMonth10,
|
|
19986
20181
|
sub as sub2
|
|
19987
20182
|
} from "date-fns";
|
|
@@ -20071,21 +20266,21 @@ var ProfitAndLossChart = ({
|
|
|
20071
20266
|
tagFilter = void 0
|
|
20072
20267
|
}) => {
|
|
20073
20268
|
var _c, _d, _e, _f, _g, _h;
|
|
20074
|
-
const [compactView, setCompactView] =
|
|
20269
|
+
const [compactView, setCompactView] = useState43(false);
|
|
20075
20270
|
const barSize = compactView ? 10 : 20;
|
|
20076
20271
|
const { getColor, business } = useLayerContext();
|
|
20077
20272
|
const { start, end, rangeDisplayMode } = useGlobalDateRange();
|
|
20078
20273
|
const { setMonth } = useGlobalDateRangeActions();
|
|
20079
20274
|
const showIndicator = rangeDisplayMode === "monthPicker";
|
|
20080
20275
|
const dateRange = useMemo24(() => ({ startDate: start, endDate: end }), [start, end]);
|
|
20081
|
-
const [localDateRange, setLocalDateRange] =
|
|
20082
|
-
const [customCursorSize, setCustomCursorSize] =
|
|
20276
|
+
const [localDateRange, setLocalDateRange] = useState43(dateRange);
|
|
20277
|
+
const [customCursorSize, setCustomCursorSize] = useState43({
|
|
20083
20278
|
width: 0,
|
|
20084
20279
|
height: 0,
|
|
20085
20280
|
x: 0
|
|
20086
20281
|
});
|
|
20087
|
-
const [barAnimActive, setBarAnimActive] =
|
|
20088
|
-
const [chartWindow, setChartWindow] =
|
|
20282
|
+
const [barAnimActive, setBarAnimActive] = useState43(true);
|
|
20283
|
+
const [chartWindow, setChartWindow] = useState43({
|
|
20089
20284
|
start: startOfMonth10(sub2(Date.now(), { months: 11 })),
|
|
20090
20285
|
end: endOfMonth8(Date.now())
|
|
20091
20286
|
});
|
|
@@ -20156,7 +20351,7 @@ var ProfitAndLossChart = ({
|
|
|
20156
20351
|
}, 2e3);
|
|
20157
20352
|
}
|
|
20158
20353
|
}, [loaded]);
|
|
20159
|
-
const getMonthName = (pnl) => pnl ?
|
|
20354
|
+
const getMonthName = (pnl) => pnl ? format3(
|
|
20160
20355
|
new Date(pnl.year, pnl.month - 1, 1),
|
|
20161
20356
|
compactView ? "LLLLL" : "LLL"
|
|
20162
20357
|
) : "";
|
|
@@ -20184,7 +20379,7 @@ var ProfitAndLossChart = ({
|
|
|
20184
20379
|
for (let i = 11; i >= 0; i--) {
|
|
20185
20380
|
const currentDate = sub2(today, { months: i });
|
|
20186
20381
|
loadingData.push({
|
|
20187
|
-
name:
|
|
20382
|
+
name: format3(currentDate, compactView ? "LLLLL" : "LLL"),
|
|
20188
20383
|
revenue: 0,
|
|
20189
20384
|
revenueUncategorized: 0,
|
|
20190
20385
|
totalExpensesInverse: 0,
|
|
@@ -20707,7 +20902,7 @@ var ProfitAndLossChart = ({
|
|
|
20707
20902
|
};
|
|
20708
20903
|
|
|
20709
20904
|
// src/components/ProfitAndLossCompareOptions/ProfitAndLossCompareOptions.tsx
|
|
20710
|
-
import { useContext as
|
|
20905
|
+
import { useContext as useContext27, useMemo as useMemo25 } from "react";
|
|
20711
20906
|
import { jsx as jsx170, jsxs as jsxs109 } from "react/jsx-runtime";
|
|
20712
20907
|
var selectStyles = {
|
|
20713
20908
|
valueContainer: (styles) => {
|
|
@@ -20747,7 +20942,7 @@ var ProfitAndLossCompareOptions = () => {
|
|
|
20747
20942
|
compareOptions,
|
|
20748
20943
|
selectedCompareOptions,
|
|
20749
20944
|
comparisonConfig
|
|
20750
|
-
} =
|
|
20945
|
+
} = useContext27(ProfitAndLoss.ComparisonContext);
|
|
20751
20946
|
const { rangeDisplayMode } = useGlobalDateRange();
|
|
20752
20947
|
const periods = useMemo25(
|
|
20753
20948
|
() => comparePeriods !== 0 ? comparePeriods : 1,
|
|
@@ -20959,7 +21154,7 @@ var ProfitAndLossDatePicker = ({
|
|
|
20959
21154
|
};
|
|
20960
21155
|
|
|
20961
21156
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
20962
|
-
import { useContext as
|
|
21157
|
+
import { useContext as useContext28, useState as useState44 } from "react";
|
|
20963
21158
|
|
|
20964
21159
|
// src/components/ProfitAndLossDetailedCharts/DetailedChart.tsx
|
|
20965
21160
|
import { useMemo as useMemo27 } from "react";
|
|
@@ -21605,7 +21800,7 @@ var Filters = ({
|
|
|
21605
21800
|
};
|
|
21606
21801
|
|
|
21607
21802
|
// src/components/ProfitAndLossDetailedCharts/ProfitAndLossDetailedCharts.tsx
|
|
21608
|
-
import { format as
|
|
21803
|
+
import { format as format4 } from "date-fns";
|
|
21609
21804
|
import { jsx as jsx177, jsxs as jsxs114 } from "react/jsx-runtime";
|
|
21610
21805
|
var ProfitAndLossDetailedCharts = ({
|
|
21611
21806
|
scope,
|
|
@@ -21626,16 +21821,16 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
21626
21821
|
sidebarScope,
|
|
21627
21822
|
setSidebarScope,
|
|
21628
21823
|
setFilterTypes
|
|
21629
|
-
} =
|
|
21824
|
+
} = useContext28(ProfitAndLoss.Context);
|
|
21630
21825
|
const theScope = scope ? scope : sidebarScope;
|
|
21631
21826
|
const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
|
|
21632
21827
|
const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
|
|
21633
|
-
const [hoveredItem, setHoveredItem] =
|
|
21828
|
+
const [hoveredItem, setHoveredItem] = useState44();
|
|
21634
21829
|
return /* @__PURE__ */ jsxs114("div", { className: "Layer__profit-and-loss-detailed-charts", children: [
|
|
21635
21830
|
/* @__PURE__ */ jsxs114("header", { className: "Layer__profit-and-loss-detailed-charts__header", children: [
|
|
21636
21831
|
/* @__PURE__ */ jsxs114("div", { className: "Layer__profit-and-loss-detailed-charts__head", children: [
|
|
21637
21832
|
/* @__PURE__ */ jsx177(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title", children: humanizeTitle(theScope) }),
|
|
21638
|
-
/* @__PURE__ */ jsx177(Text, { size: "sm" /* sm */, className: "date", children:
|
|
21833
|
+
/* @__PURE__ */ jsx177(Text, { size: "sm" /* sm */, className: "date", children: format4(dateRange.startDate, "LLLL, y") }),
|
|
21639
21834
|
showDatePicker && /* @__PURE__ */ jsx177(ProfitAndLossDatePicker, {})
|
|
21640
21835
|
] }),
|
|
21641
21836
|
!hideClose && /* @__PURE__ */ jsx177(
|
|
@@ -21652,7 +21847,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
21652
21847
|
!hideClose && /* @__PURE__ */ jsx177(BackButton, { onClick: () => setSidebarScope(void 0) }),
|
|
21653
21848
|
/* @__PURE__ */ jsxs114("div", { className: "Layer__profit-and-loss-detailed-charts__head", children: [
|
|
21654
21849
|
/* @__PURE__ */ jsx177(Text, { size: "lg" /* lg */, weight: "bold" /* bold */, className: "title", children: humanizeTitle(theScope) }),
|
|
21655
|
-
/* @__PURE__ */ jsx177(Text, { size: "sm" /* sm */, className: "date", children:
|
|
21850
|
+
/* @__PURE__ */ jsx177(Text, { size: "sm" /* sm */, className: "date", children: format4(dateRange.startDate, "LLLL, y") })
|
|
21656
21851
|
] })
|
|
21657
21852
|
] }),
|
|
21658
21853
|
/* @__PURE__ */ jsxs114("div", { className: "Layer__profit-and-loss-detailed-charts__content", children: [
|
|
@@ -21699,7 +21894,7 @@ var ProfitAndLossDetailedCharts = ({
|
|
|
21699
21894
|
};
|
|
21700
21895
|
|
|
21701
21896
|
// src/components/ProfitAndLossDownloadButton/ProfitAndLossDownloadButton.tsx
|
|
21702
|
-
import { useContext as
|
|
21897
|
+
import { useContext as useContext29, useState as useState45 } from "react";
|
|
21703
21898
|
import { jsx as jsx178 } from "react/jsx-runtime";
|
|
21704
21899
|
var ProfitAndLossDownloadButton = ({
|
|
21705
21900
|
stringOverrides,
|
|
@@ -21707,15 +21902,15 @@ var ProfitAndLossDownloadButton = ({
|
|
|
21707
21902
|
moneyFormat,
|
|
21708
21903
|
view
|
|
21709
21904
|
}) => {
|
|
21710
|
-
const { dateRange, tagFilter } =
|
|
21711
|
-
const { getProfitAndLossComparisonCsv } =
|
|
21905
|
+
const { dateRange, tagFilter } = useContext29(ProfitAndLoss.Context);
|
|
21906
|
+
const { getProfitAndLossComparisonCsv } = useContext29(
|
|
21712
21907
|
ProfitAndLoss.ComparisonContext
|
|
21713
21908
|
);
|
|
21714
21909
|
const { businessId } = useLayerContext();
|
|
21715
21910
|
const { apiUrl } = useEnvironment();
|
|
21716
21911
|
const { data: auth } = useAuth();
|
|
21717
|
-
const [requestFailed, setRequestFailed] =
|
|
21718
|
-
const [isDownloading, setIsDownloading] =
|
|
21912
|
+
const [requestFailed, setRequestFailed] = useState45(false);
|
|
21913
|
+
const [isDownloading, setIsDownloading] = useState45(false);
|
|
21719
21914
|
const handleClick = () => __async(null, null, function* () {
|
|
21720
21915
|
var _a;
|
|
21721
21916
|
setIsDownloading(true);
|
|
@@ -21777,113 +21972,6 @@ var SyncingBadge = () => {
|
|
|
21777
21972
|
|
|
21778
21973
|
// src/hooks/bookkeeping/periods/useActiveBookkeepingPeriod.ts
|
|
21779
21974
|
import { useMemo as useMemo28 } from "react";
|
|
21780
|
-
|
|
21781
|
-
// src/hooks/bookkeeping/periods/useBookkeepingPeriods.ts
|
|
21782
|
-
import useSWR11 from "swr";
|
|
21783
|
-
|
|
21784
|
-
// src/utils/bookkeeping/bookkeepingStatusFilters.ts
|
|
21785
|
-
function isActiveBookkeepingStatus(status) {
|
|
21786
|
-
return status === "ACTIVE" || status === "ONBOARDING";
|
|
21787
|
-
}
|
|
21788
|
-
function isActiveOrPausedBookkeepingStatus(status) {
|
|
21789
|
-
return isActiveBookkeepingStatus(status) || status === "BOOKKEEPING_PAUSED";
|
|
21790
|
-
}
|
|
21791
|
-
|
|
21792
|
-
// src/utils/bookkeeping/tasks/bookkeepingTasksFilters.ts
|
|
21793
|
-
function isIncompleteTask(task) {
|
|
21794
|
-
const { status } = task;
|
|
21795
|
-
return status === "TODO";
|
|
21796
|
-
}
|
|
21797
|
-
function getIncompleteTasks(tasks) {
|
|
21798
|
-
return tasks.filter((task) => isIncompleteTask(task));
|
|
21799
|
-
}
|
|
21800
|
-
function isUserVisibleTask(task) {
|
|
21801
|
-
const { status } = task;
|
|
21802
|
-
return status !== "COMPLETED" && status !== "ARCHIVED";
|
|
21803
|
-
}
|
|
21804
|
-
function getUserVisibleTasks(tasks) {
|
|
21805
|
-
return tasks.filter((task) => isUserVisibleTask(task));
|
|
21806
|
-
}
|
|
21807
|
-
function isCompletedTask(task) {
|
|
21808
|
-
const { status } = task;
|
|
21809
|
-
return status === "USER_MARKED_COMPLETED" || status === "COMPLETED" || status === "ARCHIVED";
|
|
21810
|
-
}
|
|
21811
|
-
function getCompletedTasks(tasks) {
|
|
21812
|
-
return tasks.filter((task) => isCompletedTask(task));
|
|
21813
|
-
}
|
|
21814
|
-
|
|
21815
|
-
// src/utils/bookkeeping/periods/getFilteredBookkeepingPeriods.ts
|
|
21816
|
-
function isActiveBookkeepingPeriod(period) {
|
|
21817
|
-
return period.status !== "BOOKKEEPING_NOT_ACTIVE";
|
|
21818
|
-
}
|
|
21819
|
-
|
|
21820
|
-
// src/hooks/bookkeeping/periods/useBookkeepingPeriods.ts
|
|
21821
|
-
var BOOKKEEPING_PERIOD_STATUSES = [
|
|
21822
|
-
"BOOKKEEPING_NOT_ACTIVE",
|
|
21823
|
-
"NOT_STARTED",
|
|
21824
|
-
"IN_PROGRESS_AWAITING_BOOKKEEPER",
|
|
21825
|
-
"IN_PROGRESS_AWAITING_CUSTOMER",
|
|
21826
|
-
"CLOSING_IN_REVIEW",
|
|
21827
|
-
"CLOSED_OPEN_TASKS",
|
|
21828
|
-
"CLOSED_COMPLETE"
|
|
21829
|
-
];
|
|
21830
|
-
function constrainToKnownBookkeepingPeriodStatus(status) {
|
|
21831
|
-
if (BOOKKEEPING_PERIOD_STATUSES.includes(status)) {
|
|
21832
|
-
return status;
|
|
21833
|
-
}
|
|
21834
|
-
return "BOOKKEEPING_NOT_ACTIVE";
|
|
21835
|
-
}
|
|
21836
|
-
var getBookkeepingPeriods = get(({ businessId }) => {
|
|
21837
|
-
return `/v1/businesses/${businessId}/bookkeeping/periods`;
|
|
21838
|
-
});
|
|
21839
|
-
var BOOKKEEPING_PERIODS_TAG_KEY = "#bookkeeping-periods";
|
|
21840
|
-
function buildKey14({
|
|
21841
|
-
access_token: accessToken,
|
|
21842
|
-
apiUrl,
|
|
21843
|
-
businessId,
|
|
21844
|
-
isActiveOrPaused
|
|
21845
|
-
}) {
|
|
21846
|
-
if (accessToken && apiUrl && isActiveOrPaused) {
|
|
21847
|
-
return {
|
|
21848
|
-
accessToken,
|
|
21849
|
-
apiUrl,
|
|
21850
|
-
businessId,
|
|
21851
|
-
tags: [BOOKKEEPING_TAG_KEY, BOOKKEEPING_PERIODS_TAG_KEY]
|
|
21852
|
-
};
|
|
21853
|
-
}
|
|
21854
|
-
}
|
|
21855
|
-
function useBookkeepingPeriods() {
|
|
21856
|
-
const { data: auth } = useAuth();
|
|
21857
|
-
const { businessId } = useLayerContext();
|
|
21858
|
-
const { data, isLoading: isLoadingBookkeepingStatus } = useBookkeepingStatus();
|
|
21859
|
-
const isActiveOrPaused = data ? isActiveOrPausedBookkeepingStatus(data.status) : false;
|
|
21860
|
-
const swrResponse = useSWR11(
|
|
21861
|
-
() => buildKey14(__spreadProps(__spreadValues({}, auth), {
|
|
21862
|
-
businessId,
|
|
21863
|
-
isActiveOrPaused
|
|
21864
|
-
})),
|
|
21865
|
-
({ accessToken, apiUrl, businessId: businessId2 }) => getBookkeepingPeriods(
|
|
21866
|
-
apiUrl,
|
|
21867
|
-
accessToken,
|
|
21868
|
-
{ params: { businessId: businessId2 } }
|
|
21869
|
-
)().then(
|
|
21870
|
-
({ data: { periods } }) => periods.map((period) => __spreadProps(__spreadValues({}, period), {
|
|
21871
|
-
status: constrainToKnownBookkeepingPeriodStatus(period.status),
|
|
21872
|
-
tasks: getUserVisibleTasks(period.tasks)
|
|
21873
|
-
})).filter((period) => isActiveBookkeepingPeriod(period))
|
|
21874
|
-
)
|
|
21875
|
-
);
|
|
21876
|
-
return new Proxy(swrResponse, {
|
|
21877
|
-
get(target, prop) {
|
|
21878
|
-
if (prop === "isLoading") {
|
|
21879
|
-
return isLoadingBookkeepingStatus || swrResponse.isLoading;
|
|
21880
|
-
}
|
|
21881
|
-
return Reflect.get(target, prop);
|
|
21882
|
-
}
|
|
21883
|
-
});
|
|
21884
|
-
}
|
|
21885
|
-
|
|
21886
|
-
// src/hooks/bookkeeping/periods/useActiveBookkeepingPeriod.ts
|
|
21887
21975
|
function useActiveBookkeepingPeriod() {
|
|
21888
21976
|
const { date } = useGlobalDate();
|
|
21889
21977
|
const { data, isLoading } = useBookkeepingPeriods();
|
|
@@ -21916,14 +22004,14 @@ var ProfitAndLossHeader = ({
|
|
|
21916
22004
|
/* @__PURE__ */ jsxs115("span", { className: "Layer__component-header__title-wrapper Layer__profit-and-loss__header", children: [
|
|
21917
22005
|
/* @__PURE__ */ jsx180(Heading, { size: "secondary" /* secondary */, className: headingClassName, align: "left", children: text || "Profit & Loss" }),
|
|
21918
22006
|
isSyncing && /* @__PURE__ */ jsx180(SyncingBadge, {}),
|
|
21919
|
-
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 }) })
|
|
21920
22008
|
] }),
|
|
21921
22009
|
withDatePicker && /* @__PURE__ */ jsx180(ProfitAndLoss.DatePicker, {})
|
|
21922
22010
|
] });
|
|
21923
22011
|
};
|
|
21924
22012
|
|
|
21925
22013
|
// src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
|
|
21926
|
-
import { useContext as
|
|
22014
|
+
import { useContext as useContext30 } from "react";
|
|
21927
22015
|
|
|
21928
22016
|
// src/components/Header/Header.tsx
|
|
21929
22017
|
import {
|
|
@@ -21972,7 +22060,7 @@ var HeaderCol = ({ className, children, style, noPadding = false }) => {
|
|
|
21972
22060
|
};
|
|
21973
22061
|
|
|
21974
22062
|
// src/components/Panel/Panel.tsx
|
|
21975
|
-
import { useEffect as useEffect28, useState as
|
|
22063
|
+
import { useEffect as useEffect28, useState as useState46 } from "react";
|
|
21976
22064
|
import classNames58 from "classnames";
|
|
21977
22065
|
import { jsx as jsx184, jsxs as jsxs116 } from "react/jsx-runtime";
|
|
21978
22066
|
var Panel = ({
|
|
@@ -21986,7 +22074,7 @@ var Panel = ({
|
|
|
21986
22074
|
floating = false
|
|
21987
22075
|
}) => {
|
|
21988
22076
|
var _a;
|
|
21989
|
-
const [sidebarHeight, setSidebarHeight] =
|
|
22077
|
+
const [sidebarHeight, setSidebarHeight] = useState46(0);
|
|
21990
22078
|
useEffect28(() => {
|
|
21991
22079
|
var _a2, _b;
|
|
21992
22080
|
if ((_a2 = parentRef == null ? void 0 : parentRef.current) == null ? void 0 : _a2.offsetHeight) {
|
|
@@ -22081,7 +22169,7 @@ var View = forwardRef15(
|
|
|
22081
22169
|
View.displayName = "View";
|
|
22082
22170
|
|
|
22083
22171
|
// src/components/ProfitAndLossReport/ProfitAndLossReport.tsx
|
|
22084
|
-
import { Fragment as
|
|
22172
|
+
import { Fragment as Fragment21, jsx as jsx187, jsxs as jsxs119 } from "react/jsx-runtime";
|
|
22085
22173
|
var ProfitAndLossReport = ({
|
|
22086
22174
|
stringOverrides,
|
|
22087
22175
|
allowedDatePickerModes,
|
|
@@ -22093,15 +22181,15 @@ var ProfitAndLossReport = ({
|
|
|
22093
22181
|
view
|
|
22094
22182
|
}) => {
|
|
22095
22183
|
var _a, _b;
|
|
22096
|
-
const { sidebarScope } =
|
|
22097
|
-
const { comparisonConfig } =
|
|
22184
|
+
const { sidebarScope } = useContext30(ProfitAndLoss.Context);
|
|
22185
|
+
const { comparisonConfig } = useContext30(ProfitAndLoss.ComparisonContext);
|
|
22098
22186
|
return /* @__PURE__ */ jsx187(
|
|
22099
22187
|
View,
|
|
22100
22188
|
{
|
|
22101
22189
|
type: "panel",
|
|
22102
22190
|
header: /* @__PURE__ */ jsxs119(Header3, { children: [
|
|
22103
22191
|
/* @__PURE__ */ jsxs119(HeaderRow, { children: [
|
|
22104
|
-
/* @__PURE__ */ jsx187(HeaderCol, { children: /* @__PURE__ */ jsxs119(
|
|
22192
|
+
/* @__PURE__ */ jsx187(HeaderCol, { children: /* @__PURE__ */ jsxs119(Fragment21, { children: [
|
|
22105
22193
|
/* @__PURE__ */ jsx187(
|
|
22106
22194
|
ProfitAndLoss.DatePicker,
|
|
22107
22195
|
{
|
|
@@ -22151,7 +22239,7 @@ var ProfitAndLossReport = ({
|
|
|
22151
22239
|
};
|
|
22152
22240
|
|
|
22153
22241
|
// src/components/ProfitAndLossSummaries/ProfitAndLossSummaries.tsx
|
|
22154
|
-
import { useContext as
|
|
22242
|
+
import { useContext as useContext32, useMemo as useMemo31 } from "react";
|
|
22155
22243
|
|
|
22156
22244
|
// src/components/ProfitAndLossSummaries/internal/ProfitAndLossSummariesList.tsx
|
|
22157
22245
|
import { useMemo as useMemo30 } from "react";
|
|
@@ -22316,7 +22404,7 @@ function ProfitAndLossSummariesSummary({
|
|
|
22316
22404
|
}
|
|
22317
22405
|
|
|
22318
22406
|
// src/views/AccountingOverview/internal/TransactionsToReview.tsx
|
|
22319
|
-
import { useContext as
|
|
22407
|
+
import { useContext as useContext31, useEffect as useEffect29, useState as useState47 } from "react";
|
|
22320
22408
|
import { getMonth as getMonth2, getYear as getYear3, startOfMonth as startOfMonth11 } from "date-fns";
|
|
22321
22409
|
import { jsx as jsx193, jsxs as jsxs121 } from "react/jsx-runtime";
|
|
22322
22410
|
var CLASS_NAME12 = "Layer__TransactionsToReview";
|
|
@@ -22327,9 +22415,9 @@ function TransactionsToReview({
|
|
|
22327
22415
|
variants
|
|
22328
22416
|
}) {
|
|
22329
22417
|
const { size = "sm" } = variants != null ? variants : {};
|
|
22330
|
-
const { dateRange: contextDateRange } =
|
|
22418
|
+
const { dateRange: contextDateRange } = useContext31(ProfitAndLoss.Context);
|
|
22331
22419
|
const dateRange = usePnlDateRange ? contextDateRange : void 0;
|
|
22332
|
-
const [toReview, setToReview] =
|
|
22420
|
+
const [toReview, setToReview] = useState47(0);
|
|
22333
22421
|
const { data, loaded, error, refetch } = useProfitAndLossLTM({
|
|
22334
22422
|
currentDate: dateRange ? dateRange.startDate : startOfMonth11(/* @__PURE__ */ new Date()),
|
|
22335
22423
|
tagFilter
|
|
@@ -22418,7 +22506,7 @@ function Internal_ProfitAndLossSummaries({
|
|
|
22418
22506
|
isLoading,
|
|
22419
22507
|
setSidebarScope,
|
|
22420
22508
|
sidebarScope
|
|
22421
|
-
} =
|
|
22509
|
+
} = useContext32(ProfitAndLoss.Context);
|
|
22422
22510
|
const { revenueChartData, expensesChartData } = useMemo31(
|
|
22423
22511
|
() => ({
|
|
22424
22512
|
revenueChartData: toMiniChartData({ scope: "revenue", data }),
|
|
@@ -22521,10 +22609,10 @@ function ProfitAndLossSummaries(_a) {
|
|
|
22521
22609
|
}
|
|
22522
22610
|
|
|
22523
22611
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
22524
|
-
import { useContext as
|
|
22612
|
+
import { useContext as useContext36 } from "react";
|
|
22525
22613
|
|
|
22526
22614
|
// src/contexts/TableContext/TableContext.tsx
|
|
22527
|
-
import { createContext as createContext15, useState as
|
|
22615
|
+
import { createContext as createContext15, useState as useState48 } from "react";
|
|
22528
22616
|
import { jsx as jsx195 } from "react/jsx-runtime";
|
|
22529
22617
|
var defaultValue = {
|
|
22530
22618
|
expandedRows: [],
|
|
@@ -22538,8 +22626,8 @@ var defaultValue = {
|
|
|
22538
22626
|
};
|
|
22539
22627
|
var TableContext = createContext15(defaultValue);
|
|
22540
22628
|
var TableProvider = ({ children }) => {
|
|
22541
|
-
const [expandedRows, setExpandedRowsState] =
|
|
22542
|
-
const [expandedAllRows, setExpandedAllRows] =
|
|
22629
|
+
const [expandedRows, setExpandedRowsState] = useState48([]);
|
|
22630
|
+
const [expandedAllRows, setExpandedAllRows] = useState48(false);
|
|
22543
22631
|
const toggleRow = (rowKey) => {
|
|
22544
22632
|
setExpandedRowsState((prevRows) => {
|
|
22545
22633
|
const rows = [...prevRows];
|
|
@@ -22565,10 +22653,10 @@ var TableProvider = ({ children }) => {
|
|
|
22565
22653
|
};
|
|
22566
22654
|
|
|
22567
22655
|
// src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
|
|
22568
|
-
import { Fragment as
|
|
22656
|
+
import { Fragment as Fragment23, useContext as useContext34, useEffect as useEffect31 } from "react";
|
|
22569
22657
|
|
|
22570
22658
|
// src/hooks/useTableExpandRow/useTableExpandRow.tsx
|
|
22571
|
-
import { useContext as
|
|
22659
|
+
import { useContext as useContext33 } from "react";
|
|
22572
22660
|
var useTableExpandRow = () => {
|
|
22573
22661
|
const {
|
|
22574
22662
|
expandedAllRows,
|
|
@@ -22576,7 +22664,7 @@ var useTableExpandRow = () => {
|
|
|
22576
22664
|
expandAllRows,
|
|
22577
22665
|
expandedRows,
|
|
22578
22666
|
setExpandedRows
|
|
22579
|
-
} =
|
|
22667
|
+
} = useContext33(TableContext);
|
|
22580
22668
|
const toggleAllRows = () => {
|
|
22581
22669
|
if (expandedAllRows) {
|
|
22582
22670
|
setIsOpen([]);
|
|
@@ -22604,7 +22692,7 @@ var useTableExpandRow = () => {
|
|
|
22604
22692
|
};
|
|
22605
22693
|
|
|
22606
22694
|
// src/utils/profitAndLossComparisonUtils.ts
|
|
22607
|
-
import { format as
|
|
22695
|
+
import { format as format5, subMonths as subMonths4, subYears as subYears4 } from "date-fns";
|
|
22608
22696
|
var generateComparisonPeriods = (startDate, numberOfPeriods, rangeDisplayMode) => {
|
|
22609
22697
|
switch (rangeDisplayMode) {
|
|
22610
22698
|
case "yearPicker":
|
|
@@ -22616,13 +22704,13 @@ var generateComparisonPeriods = (startDate, numberOfPeriods, rangeDisplayMode) =
|
|
|
22616
22704
|
var generateComparisonMonths = (startDate, numberOfMonths) => {
|
|
22617
22705
|
return Array.from({ length: numberOfMonths }, (_, index) => {
|
|
22618
22706
|
const currentMonth = subMonths4(startDate, numberOfMonths - index - 1);
|
|
22619
|
-
return { date: currentMonth, label:
|
|
22707
|
+
return { date: currentMonth, label: format5(currentMonth, "MMM") };
|
|
22620
22708
|
});
|
|
22621
22709
|
};
|
|
22622
22710
|
var generateComparisonYears = (startDate, numberOfYears) => {
|
|
22623
22711
|
return Array.from({ length: numberOfYears }, (_, index) => {
|
|
22624
22712
|
const currentMonth = subYears4(startDate, numberOfYears - index - 1);
|
|
22625
|
-
return { date: currentMonth, label:
|
|
22713
|
+
return { date: currentMonth, label: format5(currentMonth, "yyyy") };
|
|
22626
22714
|
});
|
|
22627
22715
|
};
|
|
22628
22716
|
var getComparisonValue = (name, depth, cellData) => {
|
|
@@ -22751,7 +22839,7 @@ var TableHead = ({ children }) => {
|
|
|
22751
22839
|
|
|
22752
22840
|
// src/components/TableRow/TableRow.tsx
|
|
22753
22841
|
import classNames62 from "classnames";
|
|
22754
|
-
import { Fragment as
|
|
22842
|
+
import { Fragment as Fragment22, jsx as jsx199, jsxs as jsxs124 } from "react/jsx-runtime";
|
|
22755
22843
|
var TableRow = ({
|
|
22756
22844
|
rowKey,
|
|
22757
22845
|
children,
|
|
@@ -22781,7 +22869,7 @@ var TableRow = ({
|
|
|
22781
22869
|
selected && "Layer__table-row--selected",
|
|
22782
22870
|
!isHeadRow && expandable && (isExpanded ? "Layer__table-row--expanded" : "Layer__table-row--collapsed")
|
|
22783
22871
|
]);
|
|
22784
|
-
return /* @__PURE__ */ jsxs124(
|
|
22872
|
+
return /* @__PURE__ */ jsxs124(Fragment22, { children: [
|
|
22785
22873
|
withDivider && withDividerPosition === "top" && /* @__PURE__ */ jsx199("tr", { className: "Layer__table-empty-row", children: /* @__PURE__ */ jsx199("td", { colSpan: Array.isArray(children) ? children.length : 1 }) }),
|
|
22786
22874
|
/* @__PURE__ */ jsx199(
|
|
22787
22875
|
"tr",
|
|
@@ -22853,17 +22941,17 @@ var Table = ({
|
|
|
22853
22941
|
|
|
22854
22942
|
// src/components/ProfitAndLossTable/ProfitAndLossCompareTable.tsx
|
|
22855
22943
|
import classNames64 from "classnames";
|
|
22856
|
-
import { Fragment as
|
|
22944
|
+
import { Fragment as Fragment24, jsx as jsx201, jsxs as jsxs125 } from "react/jsx-runtime";
|
|
22857
22945
|
var ProfitAndLossCompareTable = ({
|
|
22858
22946
|
stringOverrides
|
|
22859
22947
|
}) => {
|
|
22860
|
-
const { dateRange } =
|
|
22948
|
+
const { dateRange } = useContext34(ProfitAndLoss.Context);
|
|
22861
22949
|
const {
|
|
22862
22950
|
data: comparisonData,
|
|
22863
22951
|
isLoading,
|
|
22864
22952
|
comparePeriods,
|
|
22865
22953
|
selectedCompareOptions
|
|
22866
|
-
} =
|
|
22954
|
+
} = useContext34(ProfitAndLoss.ComparisonContext);
|
|
22867
22955
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
22868
22956
|
const { rangeDisplayMode } = useGlobalDateRange();
|
|
22869
22957
|
const { data: bookkeepingPeriods } = useBookkeepingPeriods();
|
|
@@ -22891,7 +22979,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22891
22979
|
if (!period) {
|
|
22892
22980
|
return;
|
|
22893
22981
|
}
|
|
22894
|
-
return /* @__PURE__ */ jsx201(
|
|
22982
|
+
return /* @__PURE__ */ jsx201(BookkeepingStatus2, { status: period.status, monthNumber: currentMonth, iconOnly: true });
|
|
22895
22983
|
};
|
|
22896
22984
|
const renderRow = (rowKey, depth, rowDisplayName, lineItem, data) => {
|
|
22897
22985
|
const rowData = data ? data : [];
|
|
@@ -22902,7 +22990,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22902
22990
|
}
|
|
22903
22991
|
});
|
|
22904
22992
|
if (rowData.length === 0) {
|
|
22905
|
-
return /* @__PURE__ */ jsx201(
|
|
22993
|
+
return /* @__PURE__ */ jsx201(Fragment24, {});
|
|
22906
22994
|
}
|
|
22907
22995
|
const mergedLineItems = mergeComparisonLineItemsAtDepth(
|
|
22908
22996
|
rowData
|
|
@@ -22911,7 +22999,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22911
22999
|
}
|
|
22912
23000
|
const expandable = (lineItem == null ? void 0 : lineItem.line_items) && lineItem.line_items.length > 0 ? true : false;
|
|
22913
23001
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
22914
|
-
return /* @__PURE__ */ jsxs125(
|
|
23002
|
+
return /* @__PURE__ */ jsxs125(Fragment23, { children: [
|
|
22915
23003
|
/* @__PURE__ */ jsxs125(
|
|
22916
23004
|
TableRow,
|
|
22917
23005
|
{
|
|
@@ -22945,7 +23033,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22945
23033
|
return /* @__PURE__ */ jsxs125(Table, { borderCollapse: "collapse", bottomSpacing: false, children: [
|
|
22946
23034
|
/* @__PURE__ */ jsx201(TableHead, { children: selectedCompareOptions && selectedCompareOptions.length > 1 && /* @__PURE__ */ jsxs125(TableRow, { rowKey: "", children: [
|
|
22947
23035
|
/* @__PURE__ */ jsx201(TableCell, { isHeaderCell: true }),
|
|
22948
|
-
selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxs125(
|
|
23036
|
+
selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsxs125(Fragment23, { children: [
|
|
22949
23037
|
/* @__PURE__ */ jsx201(TableCell, { primary: true, isHeaderCell: true, children: option.displayName }, option.displayName + "-" + i),
|
|
22950
23038
|
comparePeriods && Array.from({ length: comparePeriods - 1 }, (_, index) => /* @__PURE__ */ jsx201(TableCell, { isHeaderCell: true }, option.displayName + "-" + index))
|
|
22951
23039
|
] }, option.displayName + "-" + i))
|
|
@@ -22953,7 +23041,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22953
23041
|
/* @__PURE__ */ jsxs125(TableBody, { children: [
|
|
22954
23042
|
comparePeriods && /* @__PURE__ */ jsxs125(TableRow, { rowKey: "", children: [
|
|
22955
23043
|
/* @__PURE__ */ jsx201(TableCell, { isHeaderCell: true }),
|
|
22956
|
-
selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsx201(
|
|
23044
|
+
selectedCompareOptions && selectedCompareOptions.length > 0 ? selectedCompareOptions.map((option, i) => /* @__PURE__ */ jsx201(Fragment23, { children: generateComparisonPeriods(
|
|
22957
23045
|
dateRange.startDate,
|
|
22958
23046
|
comparePeriods,
|
|
22959
23047
|
rangeDisplayMode
|
|
@@ -22961,7 +23049,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22961
23049
|
month.label,
|
|
22962
23050
|
" ",
|
|
22963
23051
|
getBookkeepingPeriodStatus(month.date)
|
|
22964
|
-
] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsx201(
|
|
23052
|
+
] }) }, option.displayName + "-" + index)) }, option.displayName + "-" + i)) : /* @__PURE__ */ jsx201(Fragment23, { children: generateComparisonPeriods(
|
|
22965
23053
|
dateRange.startDate,
|
|
22966
23054
|
comparePeriods,
|
|
22967
23055
|
rangeDisplayMode
|
|
@@ -22993,7 +23081,7 @@ var ProfitAndLossCompareTable = ({
|
|
|
22993
23081
|
};
|
|
22994
23082
|
|
|
22995
23083
|
// src/components/ProfitAndLossTable/ProfitAndLossTableComponent.tsx
|
|
22996
|
-
import { Fragment as
|
|
23084
|
+
import { Fragment as Fragment25, useContext as useContext35, useEffect as useEffect32 } from "react";
|
|
22997
23085
|
|
|
22998
23086
|
// src/icons/PieChart.tsx
|
|
22999
23087
|
import { jsx as jsx202, jsxs as jsxs126 } from "react/jsx-runtime";
|
|
@@ -23092,7 +23180,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
23092
23180
|
data: actualData,
|
|
23093
23181
|
isLoading,
|
|
23094
23182
|
setSidebarScope
|
|
23095
|
-
} =
|
|
23183
|
+
} = useContext35(ProfitAndLoss.Context);
|
|
23096
23184
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
23097
23185
|
useEffect32(() => {
|
|
23098
23186
|
setIsOpen(["income", "cost_of_goods_sold", "expenses"]);
|
|
@@ -23114,7 +23202,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
23114
23202
|
const renderLineItem = (lineItem, depth, rowKey, rowIndex, scope, setSidebarScope2, variant) => {
|
|
23115
23203
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
23116
23204
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
23117
|
-
return /* @__PURE__ */ jsxs127(
|
|
23205
|
+
return /* @__PURE__ */ jsxs127(Fragment25, { children: [
|
|
23118
23206
|
/* @__PURE__ */ jsxs127(
|
|
23119
23207
|
TableRow,
|
|
23120
23208
|
{
|
|
@@ -23187,8 +23275,8 @@ var ProfitAndLossTableComponent = ({
|
|
|
23187
23275
|
0,
|
|
23188
23276
|
"gross_profit",
|
|
23189
23277
|
2,
|
|
23190
|
-
|
|
23191
|
-
|
|
23278
|
+
void 0,
|
|
23279
|
+
void 0,
|
|
23192
23280
|
"summation"
|
|
23193
23281
|
),
|
|
23194
23282
|
renderLineItem(
|
|
@@ -23207,11 +23295,17 @@ var ProfitAndLossTableComponent = ({
|
|
|
23207
23295
|
0,
|
|
23208
23296
|
"profit_before_taxes",
|
|
23209
23297
|
4,
|
|
23210
|
-
|
|
23211
|
-
|
|
23298
|
+
void 0,
|
|
23299
|
+
void 0,
|
|
23212
23300
|
"summation"
|
|
23213
23301
|
),
|
|
23214
|
-
renderLineItem(
|
|
23302
|
+
renderLineItem(
|
|
23303
|
+
data.taxes,
|
|
23304
|
+
0,
|
|
23305
|
+
"taxes",
|
|
23306
|
+
5,
|
|
23307
|
+
"expenses"
|
|
23308
|
+
),
|
|
23215
23309
|
renderLineItem(
|
|
23216
23310
|
{
|
|
23217
23311
|
value: data.net_profit,
|
|
@@ -23232,7 +23326,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
23232
23326
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
23233
23327
|
import { jsx as jsx204 } from "react/jsx-runtime";
|
|
23234
23328
|
var ProfitAndLossTableWithProvider = (props) => {
|
|
23235
|
-
const { compareModeActive } =
|
|
23329
|
+
const { compareModeActive } = useContext36(ProfitAndLoss.ComparisonContext);
|
|
23236
23330
|
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)) });
|
|
23237
23331
|
};
|
|
23238
23332
|
|
|
@@ -23337,10 +23431,10 @@ function useBalanceSheet({
|
|
|
23337
23431
|
}
|
|
23338
23432
|
|
|
23339
23433
|
// src/hooks/useElementViewSize/useElementViewSize.tsx
|
|
23340
|
-
import { useLayoutEffect as useLayoutEffect3, useRef as useRef22, useState as
|
|
23434
|
+
import { useLayoutEffect as useLayoutEffect3, useRef as useRef22, useState as useState49 } from "react";
|
|
23341
23435
|
var useElementViewSize = () => {
|
|
23342
23436
|
const containerRef = useRef22(null);
|
|
23343
|
-
const [view, setView] =
|
|
23437
|
+
const [view, setView] = useState49("desktop");
|
|
23344
23438
|
const resizeTimeout = useRef22(null);
|
|
23345
23439
|
useLayoutEffect3(() => {
|
|
23346
23440
|
const element = containerRef == null ? void 0 : containerRef.current;
|
|
@@ -23411,7 +23505,7 @@ var BalanceSheetExpandAllButton = ({
|
|
|
23411
23505
|
};
|
|
23412
23506
|
|
|
23413
23507
|
// src/components/BalanceSheetTable/BalanceSheetTable.tsx
|
|
23414
|
-
import { Fragment as
|
|
23508
|
+
import { Fragment as Fragment26, useEffect as useEffect33 } from "react";
|
|
23415
23509
|
import { jsx as jsx208, jsxs as jsxs128 } from "react/jsx-runtime";
|
|
23416
23510
|
var BalanceSheetTable = ({
|
|
23417
23511
|
data,
|
|
@@ -23435,7 +23529,7 @@ var BalanceSheetTable = ({
|
|
|
23435
23529
|
if (expandable) {
|
|
23436
23530
|
allRowKeys.push(rowKey);
|
|
23437
23531
|
}
|
|
23438
|
-
return /* @__PURE__ */ jsxs128(
|
|
23532
|
+
return /* @__PURE__ */ jsxs128(Fragment26, { children: [
|
|
23439
23533
|
/* @__PURE__ */ jsxs128(
|
|
23440
23534
|
TableRow,
|
|
23441
23535
|
{
|
|
@@ -23486,7 +23580,7 @@ var BalanceSheetTable = ({
|
|
|
23486
23580
|
/* @__PURE__ */ jsx208(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.typeColumnHeader) || "Type" }),
|
|
23487
23581
|
/* @__PURE__ */ jsx208(TableCell, { isHeaderCell: true, align: "right" /* RIGHT */, children: (stringOverrides == null ? void 0 : stringOverrides.totalColumnHeader) || "Total" })
|
|
23488
23582
|
] }) }),
|
|
23489
|
-
/* @__PURE__ */ jsx208(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx208(
|
|
23583
|
+
/* @__PURE__ */ jsx208(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx208(Fragment26, { children: data[row.lineItem] && renderLineItem(
|
|
23490
23584
|
data[row.lineItem],
|
|
23491
23585
|
0,
|
|
23492
23586
|
row.lineItem,
|
|
@@ -23560,7 +23654,7 @@ function useBalanceSheetDownload({
|
|
|
23560
23654
|
}
|
|
23561
23655
|
|
|
23562
23656
|
// src/components/BalanceSheet/download/BalanceSheetDownloadButton.tsx
|
|
23563
|
-
import { Fragment as
|
|
23657
|
+
import { Fragment as Fragment27, jsx as jsx209, jsxs as jsxs129 } from "react/jsx-runtime";
|
|
23564
23658
|
function BalanceSheetDownloadButton({
|
|
23565
23659
|
effectiveDate,
|
|
23566
23660
|
iconOnly
|
|
@@ -23570,7 +23664,7 @@ function BalanceSheetDownloadButton({
|
|
|
23570
23664
|
effectiveDate,
|
|
23571
23665
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
23572
23666
|
});
|
|
23573
|
-
return /* @__PURE__ */ jsxs129(
|
|
23667
|
+
return /* @__PURE__ */ jsxs129(Fragment27, { children: [
|
|
23574
23668
|
/* @__PURE__ */ jsx209(
|
|
23575
23669
|
DownloadButton,
|
|
23576
23670
|
{
|
|
@@ -23660,7 +23754,7 @@ var BalanceSheetView = ({
|
|
|
23660
23754
|
};
|
|
23661
23755
|
|
|
23662
23756
|
// src/components/StatementOfCashFlowTable/StatementOfCashFlowTable.tsx
|
|
23663
|
-
import { Fragment as
|
|
23757
|
+
import { Fragment as Fragment28 } from "react";
|
|
23664
23758
|
import { jsx as jsx211, jsxs as jsxs131 } from "react/jsx-runtime";
|
|
23665
23759
|
var StatementOfCashFlowTable = ({
|
|
23666
23760
|
data,
|
|
@@ -23671,7 +23765,7 @@ var StatementOfCashFlowTable = ({
|
|
|
23671
23765
|
const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
|
|
23672
23766
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
23673
23767
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
23674
|
-
return /* @__PURE__ */ jsxs131(
|
|
23768
|
+
return /* @__PURE__ */ jsxs131(Fragment28, { children: [
|
|
23675
23769
|
/* @__PURE__ */ jsxs131(
|
|
23676
23770
|
TableRow,
|
|
23677
23771
|
{
|
|
@@ -23723,7 +23817,7 @@ var StatementOfCashFlowTable = ({
|
|
|
23723
23817
|
] }) }),
|
|
23724
23818
|
/* @__PURE__ */ jsx211(TableBody, { children: config.map((row, idx) => {
|
|
23725
23819
|
if (row.type === "line_item") {
|
|
23726
|
-
return /* @__PURE__ */ jsx211(
|
|
23820
|
+
return /* @__PURE__ */ jsx211(Fragment28, { children: data[row.lineItem] && renderLineItem(
|
|
23727
23821
|
data[row.lineItem],
|
|
23728
23822
|
0,
|
|
23729
23823
|
row.lineItem ? row.lineItem : "",
|
|
@@ -23849,7 +23943,7 @@ function useCashflowStatementDownload({
|
|
|
23849
23943
|
}
|
|
23850
23944
|
|
|
23851
23945
|
// src/components/StatementOfCashFlow/download/CashflowStatementDownloadButton.tsx
|
|
23852
|
-
import { Fragment as
|
|
23946
|
+
import { Fragment as Fragment29, jsx as jsx212, jsxs as jsxs132 } from "react/jsx-runtime";
|
|
23853
23947
|
function CashflowStatementDownloadButton({
|
|
23854
23948
|
startDate,
|
|
23855
23949
|
endDate,
|
|
@@ -23861,7 +23955,7 @@ function CashflowStatementDownloadButton({
|
|
|
23861
23955
|
endDate,
|
|
23862
23956
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
23863
23957
|
});
|
|
23864
|
-
return /* @__PURE__ */ jsxs132(
|
|
23958
|
+
return /* @__PURE__ */ jsxs132(Fragment29, { children: [
|
|
23865
23959
|
/* @__PURE__ */ jsx212(
|
|
23866
23960
|
DownloadButton,
|
|
23867
23961
|
{
|
|
@@ -23902,9 +23996,7 @@ function StatementOfCashFlowDatePicker({
|
|
|
23902
23996
|
selected,
|
|
23903
23997
|
onChange: (dates) => {
|
|
23904
23998
|
if (dates instanceof Date) {
|
|
23905
|
-
|
|
23906
|
-
setSelected({ start: dates, end: dates });
|
|
23907
|
-
}
|
|
23999
|
+
setSelected({ start: dates, end: dates });
|
|
23908
24000
|
return;
|
|
23909
24001
|
}
|
|
23910
24002
|
const [start, end] = dates;
|
|
@@ -24025,7 +24117,7 @@ var StatementOfCashFlowView = ({
|
|
|
24025
24117
|
};
|
|
24026
24118
|
|
|
24027
24119
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
24028
|
-
import { useContext as
|
|
24120
|
+
import { useContext as useContext44 } from "react";
|
|
24029
24121
|
|
|
24030
24122
|
// src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
|
|
24031
24123
|
import { createContext as createContext17 } from "react";
|
|
@@ -24084,7 +24176,7 @@ var LedgerAccountsContext = createContext18({
|
|
|
24084
24176
|
});
|
|
24085
24177
|
|
|
24086
24178
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
24087
|
-
import { useEffect as useEffect34, useState as
|
|
24179
|
+
import { useEffect as useEffect34, useState as useState50 } from "react";
|
|
24088
24180
|
|
|
24089
24181
|
// src/components/ChartOfAccountsForm/constants.ts
|
|
24090
24182
|
var LEDGER_ACCOUNT_TYPES = [
|
|
@@ -24384,13 +24476,13 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
24384
24476
|
} = useLayerContext();
|
|
24385
24477
|
const { apiUrl } = useEnvironment();
|
|
24386
24478
|
const { data: auth } = useAuth();
|
|
24387
|
-
const [form, setForm] =
|
|
24388
|
-
const [sendingForm, setSendingForm] =
|
|
24389
|
-
const [apiError, setApiError] =
|
|
24390
|
-
const [startDate, setStartDate] =
|
|
24479
|
+
const [form, setForm] = useState50();
|
|
24480
|
+
const [sendingForm, setSendingForm] = useState50(false);
|
|
24481
|
+
const [apiError, setApiError] = useState50(void 0);
|
|
24482
|
+
const [startDate, setStartDate] = useState50(
|
|
24391
24483
|
initialStartDate != null ? initialStartDate : startOfMonth15(Date.now())
|
|
24392
24484
|
);
|
|
24393
|
-
const [endDate, setEndDate] =
|
|
24485
|
+
const [endDate, setEndDate] = useState50(
|
|
24394
24486
|
initialEndDate != null ? initialEndDate : endOfMonth12(Date.now())
|
|
24395
24487
|
);
|
|
24396
24488
|
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()}`;
|
|
@@ -24605,17 +24697,17 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
24605
24697
|
// src/hooks/useChartOfAccounts/useCreateChildAccount.tsx
|
|
24606
24698
|
import useSWRMutation9 from "swr/mutation";
|
|
24607
24699
|
import { useSWRConfig as useSWRConfig4 } from "swr";
|
|
24608
|
-
import { useCallback as
|
|
24700
|
+
import { useCallback as useCallback14 } from "react";
|
|
24609
24701
|
|
|
24610
24702
|
// src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
|
|
24611
|
-
import { useEffect as useEffect35, useState as
|
|
24703
|
+
import { useEffect as useEffect35, useState as useState51 } from "react";
|
|
24612
24704
|
import useSWR15 from "swr";
|
|
24613
24705
|
var useLedgerAccounts = (showReversalEntries = false) => {
|
|
24614
24706
|
const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
24615
24707
|
const { apiUrl } = useEnvironment();
|
|
24616
24708
|
const { data: auth } = useAuth();
|
|
24617
|
-
const [accountId, setAccountId] =
|
|
24618
|
-
const [selectedEntryId, setSelectedEntryId] =
|
|
24709
|
+
const [accountId, setAccountId] = useState51();
|
|
24710
|
+
const [selectedEntryId, setSelectedEntryId] = useState51();
|
|
24619
24711
|
const queryKey = businessId && accountId && (auth == null ? void 0 : auth.access_token) && `ledger-accounts-lines-${businessId}-${accountId}`;
|
|
24620
24712
|
const { data, isLoading, isValidating, error, mutate } = useSWR15(
|
|
24621
24713
|
queryKey,
|
|
@@ -24673,7 +24765,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
24673
24765
|
};
|
|
24674
24766
|
|
|
24675
24767
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
|
|
24676
|
-
import { useContext as
|
|
24768
|
+
import { useContext as useContext40, useState as useState53 } from "react";
|
|
24677
24769
|
|
|
24678
24770
|
// src/icons/Plus.tsx
|
|
24679
24771
|
import { jsx as jsx215, jsxs as jsxs134 } from "react/jsx-runtime";
|
|
@@ -24714,11 +24806,11 @@ var Plus = (_a) => {
|
|
|
24714
24806
|
var Plus_default = Plus;
|
|
24715
24807
|
|
|
24716
24808
|
// src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
|
|
24717
|
-
import { useContext as
|
|
24809
|
+
import { useContext as useContext37 } from "react";
|
|
24718
24810
|
import { endOfMonth as endOfMonth13, startOfMonth as startOfMonth16 } from "date-fns";
|
|
24719
24811
|
import { jsx as jsx216 } from "react/jsx-runtime";
|
|
24720
24812
|
var ChartOfAccountsDatePicker = () => {
|
|
24721
|
-
const { changeDateRange, dateRange } =
|
|
24813
|
+
const { changeDateRange, dateRange } = useContext37(ChartOfAccountsContext);
|
|
24722
24814
|
return /* @__PURE__ */ jsx216(
|
|
24723
24815
|
DatePicker,
|
|
24724
24816
|
{
|
|
@@ -24737,7 +24829,7 @@ var ChartOfAccountsDatePicker = () => {
|
|
|
24737
24829
|
};
|
|
24738
24830
|
|
|
24739
24831
|
// src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
|
|
24740
|
-
import { useContext as
|
|
24832
|
+
import { useContext as useContext38, useMemo as useMemo33 } from "react";
|
|
24741
24833
|
|
|
24742
24834
|
// src/components/ChartOfAccountsForm/useParentOptions.ts
|
|
24743
24835
|
import { useMemo as useMemo32 } from "react";
|
|
@@ -24768,7 +24860,7 @@ var ChartOfAccountsForm = ({
|
|
|
24768
24860
|
submitForm,
|
|
24769
24861
|
sendingForm,
|
|
24770
24862
|
apiError
|
|
24771
|
-
} =
|
|
24863
|
+
} = useContext38(ChartOfAccountsContext);
|
|
24772
24864
|
const parentOptions = useParentOptions(data);
|
|
24773
24865
|
const entry = useMemo33(() => {
|
|
24774
24866
|
if ((form == null ? void 0 : form.action) === "edit" && form.accountId) {
|
|
@@ -24983,7 +25075,7 @@ var ChartOfAccountsSidebar = ({
|
|
|
24983
25075
|
};
|
|
24984
25076
|
|
|
24985
25077
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
24986
|
-
import { Fragment as
|
|
25078
|
+
import { Fragment as Fragment30, useContext as useContext39, useEffect as useEffect36, useState as useState52 } from "react";
|
|
24987
25079
|
|
|
24988
25080
|
// src/icons/Edit2.tsx
|
|
24989
25081
|
import { jsx as jsx219 } from "react/jsx-runtime";
|
|
@@ -25043,10 +25135,10 @@ var ChartOfAccountsTableContent = ({
|
|
|
25043
25135
|
expandAll,
|
|
25044
25136
|
templateAccountsEditable
|
|
25045
25137
|
}) => {
|
|
25046
|
-
const { setAccountId } =
|
|
25047
|
-
const { editAccount } =
|
|
25138
|
+
const { setAccountId } = useContext39(LedgerAccountsContext);
|
|
25139
|
+
const { editAccount } = useContext39(ChartOfAccountsContext);
|
|
25048
25140
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
25049
|
-
const [accountsRowKeys, setAccountsRowKeys] =
|
|
25141
|
+
const [accountsRowKeys, setAccountsRowKeys] = useState52([]);
|
|
25050
25142
|
useEffect36(() => {
|
|
25051
25143
|
if (expandAll === "expanded") {
|
|
25052
25144
|
setIsOpen(accountsRowKeys);
|
|
@@ -25073,7 +25165,7 @@ var ChartOfAccountsTableContent = ({
|
|
|
25073
25165
|
var _a, _b;
|
|
25074
25166
|
const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
25075
25167
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
25076
|
-
return /* @__PURE__ */ jsxs136(
|
|
25168
|
+
return /* @__PURE__ */ jsxs136(Fragment30, { children: [
|
|
25077
25169
|
/* @__PURE__ */ jsxs136(
|
|
25078
25170
|
TableRow,
|
|
25079
25171
|
{
|
|
@@ -25205,7 +25297,7 @@ function useAccountBalancesDownload({
|
|
|
25205
25297
|
}
|
|
25206
25298
|
|
|
25207
25299
|
// src/components/ChartOfAccounts/download/AccountBalancesDownloadButton.tsx
|
|
25208
|
-
import { Fragment as
|
|
25300
|
+
import { Fragment as Fragment31, jsx as jsx221, jsxs as jsxs137 } from "react/jsx-runtime";
|
|
25209
25301
|
function AccountBalancesDownloadButton({
|
|
25210
25302
|
startCutoff,
|
|
25211
25303
|
endCutoff,
|
|
@@ -25217,7 +25309,7 @@ function AccountBalancesDownloadButton({
|
|
|
25217
25309
|
endCutoff,
|
|
25218
25310
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
25219
25311
|
});
|
|
25220
|
-
return /* @__PURE__ */ jsxs137(
|
|
25312
|
+
return /* @__PURE__ */ jsxs137(Fragment31, { children: [
|
|
25221
25313
|
/* @__PURE__ */ jsx221(
|
|
25222
25314
|
DownloadButton,
|
|
25223
25315
|
{
|
|
@@ -25249,8 +25341,8 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
25249
25341
|
templateAccountsEditable
|
|
25250
25342
|
}) => {
|
|
25251
25343
|
var _a;
|
|
25252
|
-
const { data, isLoading, addAccount, error, isValidating, refetch, form } =
|
|
25253
|
-
const [expandAll, setExpandAll] =
|
|
25344
|
+
const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext40(ChartOfAccountsContext);
|
|
25345
|
+
const [expandAll, setExpandAll] = useState53();
|
|
25254
25346
|
const cumulativeIndex = 0;
|
|
25255
25347
|
const accountsLength = (_a = data == null ? void 0 : data.accounts.length) != null ? _a : 0;
|
|
25256
25348
|
return /* @__PURE__ */ jsxs138(
|
|
@@ -25356,14 +25448,14 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
25356
25448
|
|
|
25357
25449
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
25358
25450
|
import {
|
|
25359
|
-
useContext as
|
|
25451
|
+
useContext as useContext43,
|
|
25360
25452
|
useEffect as useEffect38,
|
|
25361
25453
|
useMemo as useMemo35,
|
|
25362
|
-
useState as
|
|
25454
|
+
useState as useState55
|
|
25363
25455
|
} from "react";
|
|
25364
25456
|
|
|
25365
25457
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
25366
|
-
import { useContext as
|
|
25458
|
+
import { useContext as useContext41, useMemo as useMemo34 } from "react";
|
|
25367
25459
|
|
|
25368
25460
|
// src/utils/journal.ts
|
|
25369
25461
|
var getAccountIdentifierPayload = (journalLineItem) => {
|
|
@@ -25395,14 +25487,14 @@ import { parseISO as parseISO13, format as formatTime10 } from "date-fns";
|
|
|
25395
25487
|
import { jsx as jsx223, jsxs as jsxs139 } from "react/jsx-runtime";
|
|
25396
25488
|
var DateTime = ({
|
|
25397
25489
|
value,
|
|
25398
|
-
format:
|
|
25490
|
+
format: format8,
|
|
25399
25491
|
dateFormat,
|
|
25400
25492
|
timeFormat,
|
|
25401
25493
|
onlyDate,
|
|
25402
25494
|
onlyTime
|
|
25403
25495
|
}) => {
|
|
25404
|
-
if (
|
|
25405
|
-
return /* @__PURE__ */ jsx223(Text, { className: "Layer__datetime", children: formatTime10(parseISO13(value),
|
|
25496
|
+
if (format8) {
|
|
25497
|
+
return /* @__PURE__ */ jsx223(Text, { className: "Layer__datetime", children: formatTime10(parseISO13(value), format8) });
|
|
25406
25498
|
}
|
|
25407
25499
|
const date = formatTime10(parseISO13(value), dateFormat != null ? dateFormat : DATE_FORMAT);
|
|
25408
25500
|
const time = formatTime10(parseISO13(value), timeFormat != null ? timeFormat : TIME_FORMAT);
|
|
@@ -25469,7 +25561,7 @@ var DetailsListItem = ({
|
|
|
25469
25561
|
};
|
|
25470
25562
|
|
|
25471
25563
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
25472
|
-
import { Fragment as
|
|
25564
|
+
import { Fragment as Fragment32, jsx as jsx226, jsxs as jsxs142 } from "react/jsx-runtime";
|
|
25473
25565
|
var SourceDetailView = ({
|
|
25474
25566
|
source,
|
|
25475
25567
|
stringOverrides
|
|
@@ -25477,7 +25569,7 @@ var SourceDetailView = ({
|
|
|
25477
25569
|
switch (source.type) {
|
|
25478
25570
|
case "Transaction_Ledger_Entry_Source": {
|
|
25479
25571
|
const transactionSource = source;
|
|
25480
|
-
return /* @__PURE__ */ jsxs142(
|
|
25572
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25481
25573
|
/* @__PURE__ */ jsx226(
|
|
25482
25574
|
DetailsListItem,
|
|
25483
25575
|
{
|
|
@@ -25505,7 +25597,7 @@ var SourceDetailView = ({
|
|
|
25505
25597
|
}
|
|
25506
25598
|
case "Invoice_Ledger_Entry_Source": {
|
|
25507
25599
|
const invoiceSource = source;
|
|
25508
|
-
return /* @__PURE__ */ jsxs142(
|
|
25600
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25509
25601
|
/* @__PURE__ */ jsx226(
|
|
25510
25602
|
DetailsListItem,
|
|
25511
25603
|
{
|
|
@@ -25526,7 +25618,7 @@ var SourceDetailView = ({
|
|
|
25526
25618
|
}
|
|
25527
25619
|
case "Manual_Ledger_Entry_Source": {
|
|
25528
25620
|
const manualSource = source;
|
|
25529
|
-
return /* @__PURE__ */ jsxs142(
|
|
25621
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25530
25622
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.memoLabel) || "Memo", children: manualSource.memo }),
|
|
25531
25623
|
/* @__PURE__ */ jsx226(
|
|
25532
25624
|
DetailsListItem,
|
|
@@ -25539,7 +25631,7 @@ var SourceDetailView = ({
|
|
|
25539
25631
|
}
|
|
25540
25632
|
case "Invoice_Payment_Ledger_Entry_Source": {
|
|
25541
25633
|
const invoicePaymentSource = source;
|
|
25542
|
-
return /* @__PURE__ */ jsxs142(
|
|
25634
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25543
25635
|
/* @__PURE__ */ jsx226(
|
|
25544
25636
|
DetailsListItem,
|
|
25545
25637
|
{
|
|
@@ -25552,7 +25644,7 @@ var SourceDetailView = ({
|
|
|
25552
25644
|
}
|
|
25553
25645
|
case "Refund_Ledger_Entry_Source": {
|
|
25554
25646
|
const refundSource = source;
|
|
25555
|
-
return /* @__PURE__ */ jsxs142(
|
|
25647
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25556
25648
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(refundSource.refunded_to_customer_amount)}` }),
|
|
25557
25649
|
/* @__PURE__ */ jsx226(
|
|
25558
25650
|
DetailsListItem,
|
|
@@ -25565,7 +25657,7 @@ var SourceDetailView = ({
|
|
|
25565
25657
|
}
|
|
25566
25658
|
case "Refund_Payment_Ledger_Entry_Source": {
|
|
25567
25659
|
const refundSource = source;
|
|
25568
|
-
return /* @__PURE__ */ jsxs142(
|
|
25660
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25569
25661
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(refundSource.refunded_to_customer_amount)}` }),
|
|
25570
25662
|
/* @__PURE__ */ jsx226(
|
|
25571
25663
|
DetailsListItem,
|
|
@@ -25578,7 +25670,7 @@ var SourceDetailView = ({
|
|
|
25578
25670
|
}
|
|
25579
25671
|
case "Opening_Balance_Ledger_Entry_Source": {
|
|
25580
25672
|
const openingBalanceSource = source;
|
|
25581
|
-
return /* @__PURE__ */ jsx226(
|
|
25673
|
+
return /* @__PURE__ */ jsx226(Fragment32, { children: /* @__PURE__ */ jsx226(
|
|
25582
25674
|
DetailsListItem,
|
|
25583
25675
|
{
|
|
25584
25676
|
label: (stringOverrides == null ? void 0 : stringOverrides.accountNameLabel) || "Account name",
|
|
@@ -25588,7 +25680,7 @@ var SourceDetailView = ({
|
|
|
25588
25680
|
}
|
|
25589
25681
|
case "Payout_Ledger_Entry_Source": {
|
|
25590
25682
|
const payoutSource = source;
|
|
25591
|
-
return /* @__PURE__ */ jsxs142(
|
|
25683
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25592
25684
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(payoutSource.paid_out_amount)}` }),
|
|
25593
25685
|
/* @__PURE__ */ jsx226(
|
|
25594
25686
|
DetailsListItem,
|
|
@@ -25607,7 +25699,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
25607
25699
|
stringOverrides
|
|
25608
25700
|
}) => {
|
|
25609
25701
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v;
|
|
25610
|
-
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } =
|
|
25702
|
+
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = useContext41(LedgerAccountsContext);
|
|
25611
25703
|
const { totalDebit, totalCredit } = useMemo34(() => {
|
|
25612
25704
|
var _a2;
|
|
25613
25705
|
let totalDebit2 = 0;
|
|
@@ -25754,7 +25846,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
25754
25846
|
};
|
|
25755
25847
|
|
|
25756
25848
|
// src/components/LedgerAccount/LedgerAccountRow.tsx
|
|
25757
|
-
import { useContext as
|
|
25849
|
+
import { useContext as useContext42, useEffect as useEffect37, useState as useState54 } from "react";
|
|
25758
25850
|
import classNames67 from "classnames";
|
|
25759
25851
|
import { parseISO as parseISO14, format as formatTime11 } from "date-fns";
|
|
25760
25852
|
import { jsx as jsx227, jsxs as jsxs143 } from "react/jsx-runtime";
|
|
@@ -25765,8 +25857,8 @@ var LedgerAccountRow = ({
|
|
|
25765
25857
|
view
|
|
25766
25858
|
}) => {
|
|
25767
25859
|
var _a, _b, _c, _d, _e, _f;
|
|
25768
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } =
|
|
25769
|
-
const [showComponent, setShowComponent] =
|
|
25860
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext42(LedgerAccountsContext);
|
|
25861
|
+
const [showComponent, setShowComponent] = useState54(false);
|
|
25770
25862
|
useEffect37(() => {
|
|
25771
25863
|
if (initialLoad) {
|
|
25772
25864
|
const timeoutId = setTimeout(() => {
|
|
@@ -25903,7 +25995,7 @@ var LedgerAccountRow = ({
|
|
|
25903
25995
|
|
|
25904
25996
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
25905
25997
|
import classNames68 from "classnames";
|
|
25906
|
-
import { Fragment as
|
|
25998
|
+
import { Fragment as Fragment33, jsx as jsx228, jsxs as jsxs144 } from "react/jsx-runtime";
|
|
25907
25999
|
var LedgerAccount = ({
|
|
25908
26000
|
containerRef,
|
|
25909
26001
|
pageSize = 15,
|
|
@@ -25911,9 +26003,9 @@ var LedgerAccount = ({
|
|
|
25911
26003
|
stringOverrides
|
|
25912
26004
|
}) => {
|
|
25913
26005
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
25914
|
-
const [currentPage, setCurrentPage] =
|
|
25915
|
-
const [initialLoad, setInitialLoad] =
|
|
25916
|
-
const { data: accountData } =
|
|
26006
|
+
const [currentPage, setCurrentPage] = useState55(1);
|
|
26007
|
+
const [initialLoad, setInitialLoad] = useState55(true);
|
|
26008
|
+
const { data: accountData } = useContext43(ChartOfAccountsContext);
|
|
25917
26009
|
const {
|
|
25918
26010
|
data: rawData,
|
|
25919
26011
|
error,
|
|
@@ -25924,7 +26016,7 @@ var LedgerAccount = ({
|
|
|
25924
26016
|
selectedEntryId,
|
|
25925
26017
|
closeSelectedEntry,
|
|
25926
26018
|
refetch
|
|
25927
|
-
} =
|
|
26019
|
+
} = useContext43(LedgerAccountsContext);
|
|
25928
26020
|
useEffect38(() => {
|
|
25929
26021
|
if (!isLoading) {
|
|
25930
26022
|
const timeoutLoad = setTimeout(() => {
|
|
@@ -26002,12 +26094,12 @@ var LedgerAccount = ({
|
|
|
26002
26094
|
/* @__PURE__ */ jsxs144("table", { className: "Layer__table Layer__table--hover-effect Layer__ledger-account-table", children: [
|
|
26003
26095
|
/* @__PURE__ */ jsx228("thead", { children: /* @__PURE__ */ jsxs144("tr", { children: [
|
|
26004
26096
|
view !== "desktop" && /* @__PURE__ */ jsx228("th", {}),
|
|
26005
|
-
view === "desktop" && /* @__PURE__ */ jsxs144(
|
|
26097
|
+
view === "desktop" && /* @__PURE__ */ jsxs144(Fragment33, { children: [
|
|
26006
26098
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header", children: ((_b = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _b.dateColumnHeader) || "Date" }),
|
|
26007
26099
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header", children: ((_c = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _c.journalIdColumnHeader) || "Journal id #" }),
|
|
26008
26100
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header", children: ((_d = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _d.sourceColumnHeader) || "Source" })
|
|
26009
26101
|
] }),
|
|
26010
|
-
view !== "mobile" && /* @__PURE__ */ jsxs144(
|
|
26102
|
+
view !== "mobile" && /* @__PURE__ */ jsxs144(Fragment33, { children: [
|
|
26011
26103
|
/* @__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" }),
|
|
26012
26104
|
/* @__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" }),
|
|
26013
26105
|
/* @__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" })
|
|
@@ -26080,7 +26172,7 @@ var ChartOfAccountsContent = ({
|
|
|
26080
26172
|
templateAccountsEditable,
|
|
26081
26173
|
showAddAccountButton
|
|
26082
26174
|
}) => {
|
|
26083
|
-
const { accountId } =
|
|
26175
|
+
const { accountId } = useContext44(LedgerAccountsContext);
|
|
26084
26176
|
const { view, containerRef } = useElementViewSize();
|
|
26085
26177
|
return /* @__PURE__ */ jsx229(Container, { name: "chart-of-accounts", ref: containerRef, asWidget, children: accountId ? /* @__PURE__ */ jsx229(
|
|
26086
26178
|
LedgerAccount,
|
|
@@ -26140,7 +26232,7 @@ var JournalContext = createContext19({
|
|
|
26140
26232
|
});
|
|
26141
26233
|
|
|
26142
26234
|
// src/hooks/useJournal/useJournal.tsx
|
|
26143
|
-
import { useEffect as useEffect39, useState as
|
|
26235
|
+
import { useEffect as useEffect39, useState as useState56 } from "react";
|
|
26144
26236
|
import useSWR16 from "swr";
|
|
26145
26237
|
var useJournal = () => {
|
|
26146
26238
|
const {
|
|
@@ -26152,11 +26244,11 @@ var useJournal = () => {
|
|
|
26152
26244
|
} = useLayerContext();
|
|
26153
26245
|
const { apiUrl } = useEnvironment();
|
|
26154
26246
|
const { data: auth } = useAuth();
|
|
26155
|
-
const [selectedEntryId, setSelectedEntryId] =
|
|
26156
|
-
const [form, setForm] =
|
|
26157
|
-
const [addingEntry, setAddingEntry] =
|
|
26158
|
-
const [sendingForm, setSendingForm] =
|
|
26159
|
-
const [apiError, setApiError] =
|
|
26247
|
+
const [selectedEntryId, setSelectedEntryId] = useState56();
|
|
26248
|
+
const [form, setForm] = useState56();
|
|
26249
|
+
const [addingEntry, setAddingEntry] = useState56(false);
|
|
26250
|
+
const [sendingForm, setSendingForm] = useState56(false);
|
|
26251
|
+
const [apiError, setApiError] = useState56(void 0);
|
|
26160
26252
|
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `journal-lines-${businessId}`;
|
|
26161
26253
|
const { data, isLoading, isValidating, error, mutate } = useSWR16(
|
|
26162
26254
|
queryKey,
|
|
@@ -26409,13 +26501,13 @@ var useJournal = () => {
|
|
|
26409
26501
|
};
|
|
26410
26502
|
|
|
26411
26503
|
// src/components/JournalTable/JournalTableWithPanel.tsx
|
|
26412
|
-
import { useContext as
|
|
26504
|
+
import { useContext as useContext50, useMemo as useMemo38, useState as useState58 } from "react";
|
|
26413
26505
|
|
|
26414
26506
|
// src/components/JournalSidebar/JournalSidebar.tsx
|
|
26415
|
-
import { useContext as
|
|
26507
|
+
import { useContext as useContext48 } from "react";
|
|
26416
26508
|
|
|
26417
26509
|
// src/components/JournalEntryDetails/JournalEntryDetails.tsx
|
|
26418
|
-
import { useContext as
|
|
26510
|
+
import { useContext as useContext45, useMemo as useMemo36, useState as useState57 } from "react";
|
|
26419
26511
|
import { jsx as jsx230, jsxs as jsxs145 } from "react/jsx-runtime";
|
|
26420
26512
|
var JournalEntryDetails = () => {
|
|
26421
26513
|
var _a, _b, _c, _d;
|
|
@@ -26427,9 +26519,9 @@ var JournalEntryDetails = () => {
|
|
|
26427
26519
|
selectedEntryId,
|
|
26428
26520
|
reverseEntry,
|
|
26429
26521
|
refetch
|
|
26430
|
-
} =
|
|
26431
|
-
const [reverseEntryProcessing, setReverseEntryProcessing] =
|
|
26432
|
-
const [reverseEntryError, setReverseEntryError] =
|
|
26522
|
+
} = useContext45(JournalContext);
|
|
26523
|
+
const [reverseEntryProcessing, setReverseEntryProcessing] = useState57(false);
|
|
26524
|
+
const [reverseEntryError, setReverseEntryError] = useState57();
|
|
26433
26525
|
const entry = useMemo36(() => {
|
|
26434
26526
|
if (selectedEntryId && data) {
|
|
26435
26527
|
return data.find((x) => x.id === selectedEntryId);
|
|
@@ -26614,11 +26706,11 @@ var JournalEntryDetails = () => {
|
|
|
26614
26706
|
};
|
|
26615
26707
|
|
|
26616
26708
|
// src/components/JournalForm/JournalForm.tsx
|
|
26617
|
-
import { useContext as
|
|
26709
|
+
import { useContext as useContext47 } from "react";
|
|
26618
26710
|
|
|
26619
26711
|
// src/components/JournalForm/JournalFormEntryLines.tsx
|
|
26620
|
-
import { useContext as
|
|
26621
|
-
import { Fragment as
|
|
26712
|
+
import { useContext as useContext46, useMemo as useMemo37 } from "react";
|
|
26713
|
+
import { Fragment as Fragment34, jsx as jsx231, jsxs as jsxs146 } from "react/jsx-runtime";
|
|
26622
26714
|
function recursiveFlattenCategories(accounts) {
|
|
26623
26715
|
const flattenedResult = accounts.flatMap((a) => {
|
|
26624
26716
|
var _a;
|
|
@@ -26638,7 +26730,7 @@ var JournalFormEntryLines = ({
|
|
|
26638
26730
|
config
|
|
26639
26731
|
}) => {
|
|
26640
26732
|
const { data: categories } = useCategories({ mode: "ALL" });
|
|
26641
|
-
const { form } =
|
|
26733
|
+
const { form } = useContext46(JournalContext);
|
|
26642
26734
|
const { flattenedCategories, parentOptions } = useMemo37(() => {
|
|
26643
26735
|
const flattenedCategories2 = recursiveFlattenCategories(categories != null ? categories : []);
|
|
26644
26736
|
const parentOptions2 = [...flattenedCategories2].sort((a, b) => a.display_name.localeCompare(b.display_name)).map((account) => {
|
|
@@ -26719,7 +26811,7 @@ var JournalFormEntryLines = ({
|
|
|
26719
26811
|
]
|
|
26720
26812
|
);
|
|
26721
26813
|
};
|
|
26722
|
-
return /* @__PURE__ */ jsx231(
|
|
26814
|
+
return /* @__PURE__ */ jsx231(Fragment34, { children: ["DEBIT", "CREDIT"].map((direction, idx) => {
|
|
26723
26815
|
return /* @__PURE__ */ jsxs146(
|
|
26724
26816
|
"div",
|
|
26725
26817
|
{
|
|
@@ -26851,7 +26943,7 @@ var JournalForm = ({
|
|
|
26851
26943
|
changeFormData,
|
|
26852
26944
|
addEntryLine,
|
|
26853
26945
|
removeEntryLine
|
|
26854
|
-
} =
|
|
26946
|
+
} = useContext47(JournalContext);
|
|
26855
26947
|
return /* @__PURE__ */ jsxs147(
|
|
26856
26948
|
"form",
|
|
26857
26949
|
{
|
|
@@ -26999,7 +27091,7 @@ var JournalSidebar = ({
|
|
|
26999
27091
|
config,
|
|
27000
27092
|
stringOverrides
|
|
27001
27093
|
}) => {
|
|
27002
|
-
const { selectedEntryId } =
|
|
27094
|
+
const { selectedEntryId } = useContext48(JournalContext);
|
|
27003
27095
|
if (selectedEntryId !== "new") {
|
|
27004
27096
|
return /* @__PURE__ */ jsx233(JournalEntryDetails, {});
|
|
27005
27097
|
}
|
|
@@ -27007,7 +27099,7 @@ var JournalSidebar = ({
|
|
|
27007
27099
|
};
|
|
27008
27100
|
|
|
27009
27101
|
// src/components/JournalTable/JournalTable.tsx
|
|
27010
|
-
import { Fragment as
|
|
27102
|
+
import { Fragment as Fragment35, useContext as useContext49, useEffect as useEffect40 } from "react";
|
|
27011
27103
|
import { parseISO as parseISO15, format as formatTime12 } from "date-fns";
|
|
27012
27104
|
import { jsx as jsx234, jsxs as jsxs148 } from "react/jsx-runtime";
|
|
27013
27105
|
var accountName = (row) => {
|
|
@@ -27035,7 +27127,7 @@ var JournalTableContent = ({
|
|
|
27035
27127
|
data,
|
|
27036
27128
|
stringOverrides
|
|
27037
27129
|
}) => {
|
|
27038
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } =
|
|
27130
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext49(JournalContext);
|
|
27039
27131
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
27040
27132
|
useEffect40(() => {
|
|
27041
27133
|
if (data.length > 0) {
|
|
@@ -27045,7 +27137,7 @@ var JournalTableContent = ({
|
|
|
27045
27137
|
const renderJournalRow = (row, index, rowKey, depth) => {
|
|
27046
27138
|
const expandable = !!row.line_items && row.line_items.length > 0;
|
|
27047
27139
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
27048
|
-
return /* @__PURE__ */ jsxs148(
|
|
27140
|
+
return /* @__PURE__ */ jsxs148(Fragment35, { children: [
|
|
27049
27141
|
/* @__PURE__ */ jsxs148(
|
|
27050
27142
|
TableRow,
|
|
27051
27143
|
{
|
|
@@ -27181,7 +27273,7 @@ function useJournalEntriesDownload({
|
|
|
27181
27273
|
}
|
|
27182
27274
|
|
|
27183
27275
|
// src/components/Journal/download/JournalEntriesDownloadButton.tsx
|
|
27184
|
-
import { Fragment as
|
|
27276
|
+
import { Fragment as Fragment36, jsx as jsx235, jsxs as jsxs149 } from "react/jsx-runtime";
|
|
27185
27277
|
function JournalEntriesDownloadButton({
|
|
27186
27278
|
startCutoff,
|
|
27187
27279
|
endCutoff,
|
|
@@ -27193,7 +27285,7 @@ function JournalEntriesDownloadButton({
|
|
|
27193
27285
|
endCutoff,
|
|
27194
27286
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
27195
27287
|
});
|
|
27196
|
-
return /* @__PURE__ */ jsxs149(
|
|
27288
|
+
return /* @__PURE__ */ jsxs149(Fragment36, { children: [
|
|
27197
27289
|
/* @__PURE__ */ jsx235(
|
|
27198
27290
|
DownloadButton,
|
|
27199
27291
|
{
|
|
@@ -27221,7 +27313,7 @@ var JournalTableWithPanel = ({
|
|
|
27221
27313
|
stringOverrides,
|
|
27222
27314
|
view
|
|
27223
27315
|
}) => {
|
|
27224
|
-
const [currentPage, setCurrentPage] =
|
|
27316
|
+
const [currentPage, setCurrentPage] = useState58(1);
|
|
27225
27317
|
const {
|
|
27226
27318
|
data: rawData,
|
|
27227
27319
|
isLoading,
|
|
@@ -27230,7 +27322,7 @@ var JournalTableWithPanel = ({
|
|
|
27230
27322
|
refetch,
|
|
27231
27323
|
selectedEntryId,
|
|
27232
27324
|
addEntry
|
|
27233
|
-
} =
|
|
27325
|
+
} = useContext50(JournalContext);
|
|
27234
27326
|
const data = useMemo38(() => {
|
|
27235
27327
|
var _a;
|
|
27236
27328
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
@@ -27427,7 +27519,7 @@ var SmileIcon = (_a) => {
|
|
|
27427
27519
|
var SmileIcon_default = SmileIcon;
|
|
27428
27520
|
|
|
27429
27521
|
// src/components/Tasks/TasksListItem.tsx
|
|
27430
|
-
import { useEffect as useEffect41, useMemo as useMemo39, useState as
|
|
27522
|
+
import { useEffect as useEffect41, useMemo as useMemo39, useState as useState59 } from "react";
|
|
27431
27523
|
import classNames69 from "classnames";
|
|
27432
27524
|
|
|
27433
27525
|
// src/utils/bookkeeping/tasks/getBookkeepingTaskStatusIcon.tsx
|
|
@@ -27485,7 +27577,7 @@ function completeTaskWithUpload(baseUrl, accessToken, {
|
|
|
27485
27577
|
}
|
|
27486
27578
|
|
|
27487
27579
|
// src/hooks/bookkeeping/periods/tasks/useSubmitResponseForTask.ts
|
|
27488
|
-
import { useCallback as
|
|
27580
|
+
import { useCallback as useCallback15 } from "react";
|
|
27489
27581
|
function buildKey21({
|
|
27490
27582
|
access_token: accessToken,
|
|
27491
27583
|
apiUrl,
|
|
@@ -27528,7 +27620,7 @@ function useSubmitUserResponseForTask() {
|
|
|
27528
27620
|
}
|
|
27529
27621
|
);
|
|
27530
27622
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27531
|
-
const stableProxiedTrigger =
|
|
27623
|
+
const stableProxiedTrigger = useCallback15(
|
|
27532
27624
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27533
27625
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27534
27626
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27555,7 +27647,7 @@ function useSubmitUserResponseForTask() {
|
|
|
27555
27647
|
// src/hooks/bookkeeping/periods/tasks/useUploadDocumentsForTask.ts
|
|
27556
27648
|
import { useSWRConfig as useSWRConfig6 } from "swr";
|
|
27557
27649
|
import useSWRMutation13 from "swr/mutation";
|
|
27558
|
-
import { useCallback as
|
|
27650
|
+
import { useCallback as useCallback16 } from "react";
|
|
27559
27651
|
function buildKey22({
|
|
27560
27652
|
access_token: accessToken,
|
|
27561
27653
|
apiUrl,
|
|
@@ -27594,7 +27686,7 @@ function useUploadDocumentsForTask() {
|
|
|
27594
27686
|
}
|
|
27595
27687
|
);
|
|
27596
27688
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27597
|
-
const stableProxiedTrigger =
|
|
27689
|
+
const stableProxiedTrigger = useCallback16(
|
|
27598
27690
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27599
27691
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27600
27692
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27621,7 +27713,7 @@ function useUploadDocumentsForTask() {
|
|
|
27621
27713
|
// src/hooks/bookkeeping/periods/tasks/useDeleteUploadsOnTask.ts
|
|
27622
27714
|
import { useSWRConfig as useSWRConfig7 } from "swr";
|
|
27623
27715
|
import useSWRMutation14 from "swr/mutation";
|
|
27624
|
-
import { useCallback as
|
|
27716
|
+
import { useCallback as useCallback17 } from "react";
|
|
27625
27717
|
function buildKey23({
|
|
27626
27718
|
access_token: accessToken,
|
|
27627
27719
|
apiUrl,
|
|
@@ -27657,7 +27749,7 @@ function useDeleteUploadsOnTask() {
|
|
|
27657
27749
|
}
|
|
27658
27750
|
);
|
|
27659
27751
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27660
|
-
const stableProxiedTrigger =
|
|
27752
|
+
const stableProxiedTrigger = useCallback17(
|
|
27661
27753
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27662
27754
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27663
27755
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27684,7 +27776,7 @@ function useDeleteUploadsOnTask() {
|
|
|
27684
27776
|
// src/hooks/bookkeeping/periods/tasks/useUpdateTaskUploadDescription.ts
|
|
27685
27777
|
import { useSWRConfig as useSWRConfig8 } from "swr";
|
|
27686
27778
|
import useSWRMutation15 from "swr/mutation";
|
|
27687
|
-
import { useCallback as
|
|
27779
|
+
import { useCallback as useCallback18 } from "react";
|
|
27688
27780
|
function buildKey24({
|
|
27689
27781
|
access_token: accessToken,
|
|
27690
27782
|
apiUrl,
|
|
@@ -27724,7 +27816,7 @@ function useUpdateTaskUploadDescription() {
|
|
|
27724
27816
|
}
|
|
27725
27817
|
);
|
|
27726
27818
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27727
|
-
const stableProxiedTrigger =
|
|
27819
|
+
const stableProxiedTrigger = useCallback18(
|
|
27728
27820
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27729
27821
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27730
27822
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27749,15 +27841,15 @@ function useUpdateTaskUploadDescription() {
|
|
|
27749
27841
|
}
|
|
27750
27842
|
|
|
27751
27843
|
// src/components/Tasks/TasksListItem.tsx
|
|
27752
|
-
import { Fragment as
|
|
27844
|
+
import { Fragment as Fragment37, jsx as jsx241, jsxs as jsxs152 } from "react/jsx-runtime";
|
|
27753
27845
|
var TasksListItem = ({
|
|
27754
27846
|
task,
|
|
27755
27847
|
defaultOpen
|
|
27756
27848
|
}) => {
|
|
27757
27849
|
var _a, _b;
|
|
27758
|
-
const [isOpen, setIsOpen] =
|
|
27759
|
-
const [userResponse, setUserResponse] =
|
|
27760
|
-
const [selectedFiles, setSelectedFiles] =
|
|
27850
|
+
const [isOpen, setIsOpen] = useState59(defaultOpen);
|
|
27851
|
+
const [userResponse, setUserResponse] = useState59((_a = task.user_response) != null ? _a : "");
|
|
27852
|
+
const [selectedFiles, setSelectedFiles] = useState59();
|
|
27761
27853
|
const { trigger: handleSubmitUserResponseForTask } = useSubmitUserResponseForTask();
|
|
27762
27854
|
const { trigger: handleUploadDocumentsForTask } = useUploadDocumentsForTask();
|
|
27763
27855
|
const { trigger: handleDeleteUploadsOnTask } = useDeleteUploadsOnTask();
|
|
@@ -27805,7 +27897,7 @@ var TasksListItem = ({
|
|
|
27805
27897
|
}
|
|
27806
27898
|
);
|
|
27807
27899
|
} else {
|
|
27808
|
-
return /* @__PURE__ */ jsxs152(
|
|
27900
|
+
return /* @__PURE__ */ jsxs152(Fragment37, { children: [
|
|
27809
27901
|
/* @__PURE__ */ jsx241(
|
|
27810
27902
|
Button,
|
|
27811
27903
|
{
|
|
@@ -27935,7 +28027,7 @@ var MobilePanel = ({ header, children, open: open2, onClose, className }) => {
|
|
|
27935
28027
|
};
|
|
27936
28028
|
|
|
27937
28029
|
// src/components/Tasks/TasksListMobile.tsx
|
|
27938
|
-
import { useState as
|
|
28030
|
+
import { useState as useState60 } from "react";
|
|
27939
28031
|
import { jsx as jsx243, jsxs as jsxs154 } from "react/jsx-runtime";
|
|
27940
28032
|
var MOBILE_SHOW_UNRESOLVED_TASKS_COUNT = 2;
|
|
27941
28033
|
var TasksListMobile = ({
|
|
@@ -27946,7 +28038,7 @@ var TasksListMobile = ({
|
|
|
27946
28038
|
pageSize,
|
|
27947
28039
|
setCurrentPage
|
|
27948
28040
|
}) => {
|
|
27949
|
-
const [showMobilePanel, setShowMobilePanel] =
|
|
28041
|
+
const [showMobilePanel, setShowMobilePanel] = useState60(false);
|
|
27950
28042
|
const unresolvedTasks = getIncompleteTasks(sortedTasks).slice(0, MOBILE_SHOW_UNRESOLVED_TASKS_COUNT);
|
|
27951
28043
|
return /* @__PURE__ */ jsxs154("div", { className: "Layer__tasks-list", children: [
|
|
27952
28044
|
unresolvedTasks.map((task, index) => /* @__PURE__ */ jsx243(
|
|
@@ -27994,9 +28086,9 @@ var TasksListMobile = ({
|
|
|
27994
28086
|
};
|
|
27995
28087
|
|
|
27996
28088
|
// src/hooks/array/usePaginatedList.ts
|
|
27997
|
-
import { useCallback as
|
|
28089
|
+
import { useCallback as useCallback19, useMemo as useMemo40, useState as useState61 } from "react";
|
|
27998
28090
|
function usePaginatedList(list, pageSize) {
|
|
27999
|
-
const [internalPageIndex, setInternalPageIndex] =
|
|
28091
|
+
const [internalPageIndex, setInternalPageIndex] = useState61(0);
|
|
28000
28092
|
const pageCount = Math.max(0, Math.ceil(list.length / pageSize));
|
|
28001
28093
|
const effectivePageIndex = Math.max(0, Math.min(internalPageIndex, pageCount - 1));
|
|
28002
28094
|
const pageItems = useMemo40(() => {
|
|
@@ -28005,16 +28097,16 @@ function usePaginatedList(list, pageSize) {
|
|
|
28005
28097
|
(effectivePageIndex + 1) * pageSize
|
|
28006
28098
|
);
|
|
28007
28099
|
}, [list, effectivePageIndex, pageSize]);
|
|
28008
|
-
const next =
|
|
28100
|
+
const next = useCallback19(() => {
|
|
28009
28101
|
setInternalPageIndex(Math.min(effectivePageIndex + 1, pageCount - 1));
|
|
28010
28102
|
}, [effectivePageIndex, pageCount]);
|
|
28011
|
-
const set2 =
|
|
28103
|
+
const set2 = useCallback19((pageIndex) => {
|
|
28012
28104
|
setInternalPageIndex(Math.max(0, Math.min(pageIndex, pageCount - 1)));
|
|
28013
28105
|
}, [pageCount]);
|
|
28014
|
-
const previous =
|
|
28106
|
+
const previous = useCallback19(() => {
|
|
28015
28107
|
setInternalPageIndex(Math.max(effectivePageIndex - 1, 0));
|
|
28016
28108
|
}, [effectivePageIndex]);
|
|
28017
|
-
const reset =
|
|
28109
|
+
const reset = useCallback19(() => {
|
|
28018
28110
|
setInternalPageIndex(0);
|
|
28019
28111
|
}, []);
|
|
28020
28112
|
return {
|
|
@@ -28030,7 +28122,7 @@ function usePaginatedList(list, pageSize) {
|
|
|
28030
28122
|
}
|
|
28031
28123
|
|
|
28032
28124
|
// src/components/Tasks/TasksList.tsx
|
|
28033
|
-
import { Fragment as
|
|
28125
|
+
import { Fragment as Fragment38, jsx as jsx244, jsxs as jsxs155 } from "react/jsx-runtime";
|
|
28034
28126
|
var TasksEmptyState = () => /* @__PURE__ */ jsxs155("div", { className: "Layer__tasks-empty-state", children: [
|
|
28035
28127
|
/* @__PURE__ */ jsx244("div", { className: "Layer__tasks-icon", children: /* @__PURE__ */ jsx244(SmileIcon_default, {}) }),
|
|
28036
28128
|
/* @__PURE__ */ jsxs155(Text, { size: "sm" /* sm */, children: [
|
|
@@ -28070,7 +28162,7 @@ function TasksList({ pageSize = 8, mobile }) {
|
|
|
28070
28162
|
}
|
|
28071
28163
|
);
|
|
28072
28164
|
}
|
|
28073
|
-
return /* @__PURE__ */ jsx244("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs155(
|
|
28165
|
+
return /* @__PURE__ */ jsx244("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs155(Fragment38, { children: [
|
|
28074
28166
|
pageItems.map((task, index) => /* @__PURE__ */ jsx244(
|
|
28075
28167
|
TasksListItem,
|
|
28076
28168
|
{
|
|
@@ -28093,7 +28185,7 @@ function TasksList({ pageSize = 8, mobile }) {
|
|
|
28093
28185
|
|
|
28094
28186
|
// src/components/Tasks/TasksPending.tsx
|
|
28095
28187
|
import { Cell as Cell4, Pie as Pie3, PieChart as PieChart4 } from "recharts";
|
|
28096
|
-
import { format as
|
|
28188
|
+
import { format as format6 } from "date-fns";
|
|
28097
28189
|
import classNames71 from "classnames";
|
|
28098
28190
|
|
|
28099
28191
|
// src/components/BookkeepingStatus/BookkeepingStatusDescription.tsx
|
|
@@ -28107,7 +28199,7 @@ var BookkeepingStatusDescription = ({ monthNumber, status, incompleteTasksCount
|
|
|
28107
28199
|
};
|
|
28108
28200
|
|
|
28109
28201
|
// src/components/Tasks/TasksPending.tsx
|
|
28110
|
-
import { Fragment as
|
|
28202
|
+
import { Fragment as Fragment39, jsx as jsx246, jsxs as jsxs156 } from "react/jsx-runtime";
|
|
28111
28203
|
var TasksPending = () => {
|
|
28112
28204
|
var _a, _b, _c, _d;
|
|
28113
28205
|
const { date } = useGlobalDate();
|
|
@@ -28130,7 +28222,7 @@ var TasksPending = () => {
|
|
|
28130
28222
|
);
|
|
28131
28223
|
return /* @__PURE__ */ jsxs156("div", { className: "Layer__tasks-pending", children: [
|
|
28132
28224
|
/* @__PURE__ */ jsxs156("div", { className: "Layer__tasks-pending-header", children: [
|
|
28133
|
-
/* @__PURE__ */ jsx246(Heading, { size: "secondary" /* secondary */, children:
|
|
28225
|
+
/* @__PURE__ */ jsx246(Heading, { size: "secondary" /* secondary */, children: format6(date, "MMMM yyyy") }),
|
|
28134
28226
|
(activePeriod == null ? void 0 : activePeriod.tasks) && activePeriod.tasks.length > 0 ? /* @__PURE__ */ jsxs156("div", { className: "Layer__tasks-pending-bar", children: [
|
|
28135
28227
|
/* @__PURE__ */ jsxs156(Text, { size: "sm" /* sm */, children: [
|
|
28136
28228
|
/* @__PURE__ */ jsx246("span", { className: taskStatusClassName, children: completedTaskCount }),
|
|
@@ -28169,8 +28261,8 @@ var TasksPending = () => {
|
|
|
28169
28261
|
) })
|
|
28170
28262
|
] }) : null
|
|
28171
28263
|
] }),
|
|
28172
|
-
/* @__PURE__ */ jsx246("div", { className: "Layer__tasks-pending-main", children: activePeriod && /* @__PURE__ */ jsxs156(
|
|
28173
|
-
/* @__PURE__ */ jsx246(
|
|
28264
|
+
/* @__PURE__ */ jsx246("div", { className: "Layer__tasks-pending-main", children: activePeriod && /* @__PURE__ */ jsxs156(Fragment39, { children: [
|
|
28265
|
+
/* @__PURE__ */ jsx246(BookkeepingStatus2, { status: activePeriod.status, monthNumber: activePeriod.month }),
|
|
28174
28266
|
/* @__PURE__ */ jsx246(
|
|
28175
28267
|
BookkeepingStatusDescription,
|
|
28176
28268
|
{
|
|
@@ -28185,16 +28277,16 @@ var TasksPending = () => {
|
|
|
28185
28277
|
|
|
28186
28278
|
// src/components/Tasks/TasksMonthSelector.tsx
|
|
28187
28279
|
import { useMemo as useMemo42 } from "react";
|
|
28188
|
-
import { format as
|
|
28280
|
+
import { format as format7, getMonth as getMonth3, getYear as getYear4, set } from "date-fns";
|
|
28189
28281
|
|
|
28190
28282
|
// src/components/Tasks/TaskStatusBadge.tsx
|
|
28191
28283
|
import pluralize2 from "pluralize";
|
|
28192
28284
|
import { jsx as jsx247, jsxs as jsxs157 } from "react/jsx-runtime";
|
|
28193
28285
|
var buildBadgeConfig = (status, tasksCount) => {
|
|
28194
28286
|
switch (status) {
|
|
28195
|
-
case "IN_PROGRESS_AWAITING_BOOKKEEPER"
|
|
28196
|
-
case "NOT_STARTED"
|
|
28197
|
-
case "CLOSING_IN_REVIEW"
|
|
28287
|
+
case "IN_PROGRESS_AWAITING_BOOKKEEPER" /* IN_PROGRESS_AWAITING_BOOKKEEPER */:
|
|
28288
|
+
case "NOT_STARTED" /* NOT_STARTED */:
|
|
28289
|
+
case "CLOSING_IN_REVIEW" /* CLOSING_IN_REVIEW */: {
|
|
28198
28290
|
return {
|
|
28199
28291
|
color: "info",
|
|
28200
28292
|
icon: /* @__PURE__ */ jsx247(Clock_default, { size: 12 }),
|
|
@@ -28202,8 +28294,8 @@ var buildBadgeConfig = (status, tasksCount) => {
|
|
|
28202
28294
|
labelShort: tasksCount ? `${tasksCount}` : void 0
|
|
28203
28295
|
};
|
|
28204
28296
|
}
|
|
28205
|
-
case "IN_PROGRESS_AWAITING_CUSTOMER"
|
|
28206
|
-
case "CLOSED_OPEN_TASKS"
|
|
28297
|
+
case "IN_PROGRESS_AWAITING_CUSTOMER" /* IN_PROGRESS_AWAITING_CUSTOMER */:
|
|
28298
|
+
case "CLOSED_OPEN_TASKS" /* CLOSED_OPEN_TASKS */: {
|
|
28207
28299
|
return {
|
|
28208
28300
|
color: "warning",
|
|
28209
28301
|
label: tasksCount ? pluralize2("task", tasksCount, true) : void 0,
|
|
@@ -28211,13 +28303,13 @@ var buildBadgeConfig = (status, tasksCount) => {
|
|
|
28211
28303
|
icon: /* @__PURE__ */ jsx247(AlertCircle_default, { size: 12 })
|
|
28212
28304
|
};
|
|
28213
28305
|
}
|
|
28214
|
-
case "CLOSED_COMPLETE"
|
|
28306
|
+
case "CLOSED_COMPLETE" /* CLOSED_COMPLETE */: {
|
|
28215
28307
|
return {
|
|
28216
28308
|
color: "success",
|
|
28217
28309
|
icon: /* @__PURE__ */ jsx247(CheckCircle_default, { size: 12 })
|
|
28218
28310
|
};
|
|
28219
28311
|
}
|
|
28220
|
-
case "BOOKKEEPING_NOT_ACTIVE"
|
|
28312
|
+
case "BOOKKEEPING_NOT_ACTIVE" /* BOOKKEEPING_NOT_ACTIVE */: {
|
|
28221
28313
|
return;
|
|
28222
28314
|
}
|
|
28223
28315
|
default: {
|
|
@@ -28311,12 +28403,12 @@ function TasksMonthSelector() {
|
|
|
28311
28403
|
year: activeYear,
|
|
28312
28404
|
month: index + 1,
|
|
28313
28405
|
tasks: [],
|
|
28314
|
-
status: "BOOKKEEPING_NOT_ACTIVE"
|
|
28406
|
+
status: "BOOKKEEPING_NOT_ACTIVE" /* BOOKKEEPING_NOT_ACTIVE */,
|
|
28315
28407
|
disabled: true
|
|
28316
28408
|
};
|
|
28317
28409
|
const total = (_b = (_a = taskData.tasks) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
28318
28410
|
return __spreadValues({
|
|
28319
|
-
monthStr:
|
|
28411
|
+
monthStr: format7(date2, "MMM"),
|
|
28320
28412
|
date: date2,
|
|
28321
28413
|
completed: getCompletedTasks(taskData.tasks).length,
|
|
28322
28414
|
total
|
|
@@ -28514,7 +28606,7 @@ var TasksPanelNotification = ({
|
|
|
28514
28606
|
import { useMemo as useMemo44 } from "react";
|
|
28515
28607
|
|
|
28516
28608
|
// src/components/Tabs/Tabs.tsx
|
|
28517
|
-
import { useEffect as useEffect42, useState as
|
|
28609
|
+
import { useEffect as useEffect42, useState as useState62 } from "react";
|
|
28518
28610
|
|
|
28519
28611
|
// src/components/Tabs/Tab.tsx
|
|
28520
28612
|
import { jsx as jsx252, jsxs as jsxs161 } from "react/jsx-runtime";
|
|
@@ -28581,9 +28673,9 @@ import { jsx as jsx253, jsxs as jsxs162 } from "react/jsx-runtime";
|
|
|
28581
28673
|
import { createElement as createElement2 } from "react";
|
|
28582
28674
|
var STARTING_PADDING = 12;
|
|
28583
28675
|
var Tabs = ({ name, options, selected, onChange }) => {
|
|
28584
|
-
const [initialized, setInitialized] =
|
|
28585
|
-
const [thumbPos, setThumbPos] =
|
|
28586
|
-
const [currentWidth, setCurrentWidth] =
|
|
28676
|
+
const [initialized, setInitialized] = useState62(false);
|
|
28677
|
+
const [thumbPos, setThumbPos] = useState62({ left: 0, width: 0 });
|
|
28678
|
+
const [currentWidth, setCurrentWidth] = useState62(0);
|
|
28587
28679
|
const selectedValue = selected || options[0].value;
|
|
28588
28680
|
const baseClassName = classNames72(
|
|
28589
28681
|
"Layer__tabs",
|
|
@@ -28681,7 +28773,7 @@ var TasksYearsTabs = () => {
|
|
|
28681
28773
|
badge: !y.completed && y.unresolvedTasks ? /* @__PURE__ */ jsx254(
|
|
28682
28774
|
TaskStatusBadge,
|
|
28683
28775
|
{
|
|
28684
|
-
status: y.unresolvedTasks ? "IN_PROGRESS_AWAITING_CUSTOMER" : "CLOSED_COMPLETE"
|
|
28776
|
+
status: y.unresolvedTasks ? "IN_PROGRESS_AWAITING_CUSTOMER" /* IN_PROGRESS_AWAITING_CUSTOMER */ : "CLOSED_COMPLETE" /* CLOSED_COMPLETE */,
|
|
28685
28777
|
tasksCount: y.unresolvedTasks
|
|
28686
28778
|
}
|
|
28687
28779
|
) : null
|
|
@@ -28729,7 +28821,7 @@ function TasksEmptyContainer({ children }) {
|
|
|
28729
28821
|
}
|
|
28730
28822
|
|
|
28731
28823
|
// src/components/Tasks/Tasks.tsx
|
|
28732
|
-
import { Fragment as
|
|
28824
|
+
import { Fragment as Fragment40, jsx as jsx256, jsxs as jsxs163 } from "react/jsx-runtime";
|
|
28733
28825
|
function Tasks({
|
|
28734
28826
|
mobile = false,
|
|
28735
28827
|
tasksHeader,
|
|
@@ -28762,7 +28854,7 @@ function Tasks({
|
|
|
28762
28854
|
/* @__PURE__ */ jsx256(Heading2, { size: "xs", level: 4, children: "Not Enrolled in Bookkeeping" }),
|
|
28763
28855
|
/* @__PURE__ */ jsx256(P, { children: "If you believe this is an error, please contact support." })
|
|
28764
28856
|
] }) }),
|
|
28765
|
-
children: () => /* @__PURE__ */ jsxs163(
|
|
28857
|
+
children: () => /* @__PURE__ */ jsxs163(Fragment40, { children: [
|
|
28766
28858
|
/* @__PURE__ */ jsx256(TasksYearsTabs, {}),
|
|
28767
28859
|
/* @__PURE__ */ jsx256(TasksMonthSelector, {}),
|
|
28768
28860
|
/* @__PURE__ */ jsx256(TasksPending, {}),
|
|
@@ -28776,20 +28868,20 @@ function Tasks({
|
|
|
28776
28868
|
}
|
|
28777
28869
|
|
|
28778
28870
|
// src/components/PlatformOnboarding/LinkAccounts.tsx
|
|
28779
|
-
import { useContext as
|
|
28871
|
+
import { useContext as useContext54 } from "react";
|
|
28780
28872
|
|
|
28781
28873
|
// src/components/PlatformOnboarding/Steps/LinkAccountsConfirmationStep.tsx
|
|
28782
|
-
import { useContext as
|
|
28874
|
+
import { useContext as useContext52 } from "react";
|
|
28783
28875
|
import { useForm as useForm2 } from "@tanstack/react-form";
|
|
28784
28876
|
|
|
28785
28877
|
// src/components/Wizard/Wizard.tsx
|
|
28786
28878
|
import {
|
|
28787
28879
|
Children,
|
|
28788
28880
|
createContext as createContext20,
|
|
28789
|
-
useCallback as
|
|
28790
|
-
useContext as
|
|
28881
|
+
useCallback as useCallback20,
|
|
28882
|
+
useContext as useContext51,
|
|
28791
28883
|
useMemo as useMemo45,
|
|
28792
|
-
useState as
|
|
28884
|
+
useState as useState63
|
|
28793
28885
|
} from "react";
|
|
28794
28886
|
import { jsxs as jsxs164 } from "react/jsx-runtime";
|
|
28795
28887
|
function useWizardStep({
|
|
@@ -28797,14 +28889,14 @@ function useWizardStep({
|
|
|
28797
28889
|
onComplete
|
|
28798
28890
|
}) {
|
|
28799
28891
|
const stepCount = steps.length;
|
|
28800
|
-
const [activeStepIndex, setActiveStepIndex] =
|
|
28801
|
-
const next =
|
|
28892
|
+
const [activeStepIndex, setActiveStepIndex] = useState63(0);
|
|
28893
|
+
const next = useCallback20(() => __async(null, null, function* () {
|
|
28802
28894
|
setActiveStepIndex((stepIndex) => Math.min(stepIndex + 1, stepCount - 1));
|
|
28803
28895
|
if (activeStepIndex === stepCount - 1 && onComplete) {
|
|
28804
28896
|
yield onComplete == null ? void 0 : onComplete();
|
|
28805
28897
|
}
|
|
28806
28898
|
}), [stepCount, activeStepIndex, onComplete]);
|
|
28807
|
-
const previous =
|
|
28899
|
+
const previous = useCallback20(() => setActiveStepIndex((stepIndex) => Math.max(stepIndex - 1, 0)), []);
|
|
28808
28900
|
const effectiveStepIndex = Math.min(activeStepIndex, stepCount - 1);
|
|
28809
28901
|
const currentStep = steps.at(effectiveStepIndex);
|
|
28810
28902
|
return { currentStep, next, previous };
|
|
@@ -28816,7 +28908,7 @@ var WizardContext = createContext20({
|
|
|
28816
28908
|
}
|
|
28817
28909
|
});
|
|
28818
28910
|
function useWizard() {
|
|
28819
|
-
return
|
|
28911
|
+
return useContext51(WizardContext);
|
|
28820
28912
|
}
|
|
28821
28913
|
function Wizard({
|
|
28822
28914
|
Header: Header4,
|
|
@@ -28870,7 +28962,7 @@ function LinkAccountsConfirmationStep() {
|
|
|
28870
28962
|
data: linkedAccounts,
|
|
28871
28963
|
loadingStatus: linkedAccountsLoadingStatus,
|
|
28872
28964
|
refetchAccounts
|
|
28873
|
-
} =
|
|
28965
|
+
} = useContext52(LinkedAccountsContext);
|
|
28874
28966
|
const effectiveLinkedAccounts = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
|
|
28875
28967
|
const { trigger } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
|
|
28876
28968
|
const { previous, next } = useWizard();
|
|
@@ -28943,7 +29035,7 @@ function LinkAccountsConfirmationStep() {
|
|
|
28943
29035
|
}
|
|
28944
29036
|
|
|
28945
29037
|
// src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
|
|
28946
|
-
import { useContext as
|
|
29038
|
+
import { useContext as useContext53 } from "react";
|
|
28947
29039
|
import pluralize4 from "pluralize";
|
|
28948
29040
|
|
|
28949
29041
|
// src/components/Separator/Separator.tsx
|
|
@@ -28954,7 +29046,7 @@ var Separator = ({ mbs, mbe }) => {
|
|
|
28954
29046
|
};
|
|
28955
29047
|
|
|
28956
29048
|
// src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
|
|
28957
|
-
import { Fragment as
|
|
29049
|
+
import { Fragment as Fragment41, jsx as jsx260, jsxs as jsxs166 } from "react/jsx-runtime";
|
|
28958
29050
|
function LinkAccountsLinkStep() {
|
|
28959
29051
|
const {
|
|
28960
29052
|
data,
|
|
@@ -28962,10 +29054,10 @@ function LinkAccountsLinkStep() {
|
|
|
28962
29054
|
error,
|
|
28963
29055
|
refetchAccounts,
|
|
28964
29056
|
addConnection
|
|
28965
|
-
} =
|
|
29057
|
+
} = useContext53(LinkedAccountsContext);
|
|
28966
29058
|
const { next } = useWizard();
|
|
28967
29059
|
const effectiveAccounts = data != null ? data : [];
|
|
28968
|
-
return /* @__PURE__ */ jsxs166(
|
|
29060
|
+
return /* @__PURE__ */ jsxs166(Fragment41, { children: [
|
|
28969
29061
|
/* @__PURE__ */ jsx260(
|
|
28970
29062
|
ConditionalList,
|
|
28971
29063
|
{
|
|
@@ -29025,7 +29117,7 @@ function LinkAccountsLinkStep() {
|
|
|
29025
29117
|
children: ({ item: account }) => /* @__PURE__ */ jsx260(BasicLinkedAccountContainer, { isSelected: true, children: /* @__PURE__ */ jsx260(BasicLinkedAccountContent, { account }) }, account.id)
|
|
29026
29118
|
}
|
|
29027
29119
|
),
|
|
29028
|
-
effectiveAccounts.length > 0 ? /* @__PURE__ */ jsxs166(
|
|
29120
|
+
effectiveAccounts.length > 0 ? /* @__PURE__ */ jsxs166(Fragment41, { children: [
|
|
29029
29121
|
/* @__PURE__ */ jsx260(Separator, { mbs: "lg", mbe: "lg" }),
|
|
29030
29122
|
/* @__PURE__ */ jsx260(HStack, { justify: "start", gap: "sm", children: /* @__PURE__ */ jsx260(Button, { onClick: () => {
|
|
29031
29123
|
void next();
|
|
@@ -29042,7 +29134,7 @@ function LinkAccounts(props) {
|
|
|
29042
29134
|
function LinkAccountsContent({
|
|
29043
29135
|
onComplete
|
|
29044
29136
|
}) {
|
|
29045
|
-
const { data: linkedAccounts, loadingStatus } =
|
|
29137
|
+
const { data: linkedAccounts, loadingStatus } = useContext54(LinkedAccountsContext);
|
|
29046
29138
|
const linkedAccountsNeedingConfirmation = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
|
|
29047
29139
|
const hideConfirmationStep = loadingStatus === "complete" && linkedAccountsNeedingConfirmation.length === 0;
|
|
29048
29140
|
return /* @__PURE__ */ jsx261("section", { className: "Layer__link-accounts Layer__component", children: /* @__PURE__ */ jsxs167(
|
|
@@ -29060,7 +29152,7 @@ function LinkAccountsContent({
|
|
|
29060
29152
|
}
|
|
29061
29153
|
|
|
29062
29154
|
// src/components/PlatformOnboarding/PlatformOnboarding.tsx
|
|
29063
|
-
import { useState as
|
|
29155
|
+
import { useState as useState65 } from "react";
|
|
29064
29156
|
|
|
29065
29157
|
// src/components/ProgressSteps/ProgressSteps.tsx
|
|
29066
29158
|
import { jsx as jsx262, jsxs as jsxs168 } from "react/jsx-runtime";
|
|
@@ -29249,7 +29341,7 @@ var TrendingUp = (_a) => {
|
|
|
29249
29341
|
var TrendingUp_default = TrendingUp;
|
|
29250
29342
|
|
|
29251
29343
|
// src/components/PlatformOnboarding/Steps/WelcomeStep.tsx
|
|
29252
|
-
import { Fragment as
|
|
29344
|
+
import { Fragment as Fragment42, jsx as jsx265, jsxs as jsxs171 } from "react/jsx-runtime";
|
|
29253
29345
|
var defaultTitle = "Welcome";
|
|
29254
29346
|
var defaultDescription = "Welcome to the platform onboarding process";
|
|
29255
29347
|
var WelcomeStep = ({ onNext, title = defaultTitle, description, stepsEnabled }) => {
|
|
@@ -29270,7 +29362,7 @@ var WelcomeStep = ({ onNext, title = defaultTitle, description, stepsEnabled })
|
|
|
29270
29362
|
}
|
|
29271
29363
|
return defaultDescription;
|
|
29272
29364
|
};
|
|
29273
|
-
return /* @__PURE__ */ jsxs171(
|
|
29365
|
+
return /* @__PURE__ */ jsxs171(Fragment42, { children: [
|
|
29274
29366
|
/* @__PURE__ */ jsxs171("div", { className: "Layer__platform-onboarding__welcome", children: [
|
|
29275
29367
|
/* @__PURE__ */ jsx265(Heading, { className: "Layer__platform-onboarding__heading", align: "left", children: title }),
|
|
29276
29368
|
/* @__PURE__ */ jsx265(Text, { status: "disabled", children: buildDescription() })
|
|
@@ -29347,12 +29439,12 @@ var WelcomeStepFooter = () => {
|
|
|
29347
29439
|
};
|
|
29348
29440
|
|
|
29349
29441
|
// src/components/PlatformOnboarding/Steps/SummaryStep.tsx
|
|
29350
|
-
import { Fragment as
|
|
29442
|
+
import { Fragment as Fragment43, jsx as jsx266, jsxs as jsxs172 } from "react/jsx-runtime";
|
|
29351
29443
|
var defaultTitle2 = "You\u2019re all set!";
|
|
29352
29444
|
var defaultDescription2 = "We\u2019re syncing your accounts. This process may take a while to complete.";
|
|
29353
29445
|
var defaultNextBtnText = "Go to dashboard";
|
|
29354
29446
|
var SummaryStep = ({ onNext, title = defaultTitle2, description = defaultDescription2, nextBtnText = defaultNextBtnText }) => {
|
|
29355
|
-
return /* @__PURE__ */ jsxs172(
|
|
29447
|
+
return /* @__PURE__ */ jsxs172(Fragment43, { children: [
|
|
29356
29448
|
/* @__PURE__ */ jsxs172("div", { className: "Layer__platform-onboarding__summary", children: [
|
|
29357
29449
|
/* @__PURE__ */ jsx266(Heading, { className: "Layer__platform-onboarding__heading", align: "left", children: title }),
|
|
29358
29450
|
/* @__PURE__ */ jsx266(Text, { status: "disabled", children: description })
|
|
@@ -29457,7 +29549,7 @@ function useBusinessPersonnel() {
|
|
|
29457
29549
|
// src/hooks/businessPersonnel/useCreateBusinessPersonnel.ts
|
|
29458
29550
|
import useSWRMutation16 from "swr/mutation";
|
|
29459
29551
|
import { useSWRConfig as useSWRConfig9 } from "swr";
|
|
29460
|
-
import { useCallback as
|
|
29552
|
+
import { useCallback as useCallback21 } from "react";
|
|
29461
29553
|
var createBusinessPersonnel = post(({ businessId }) => `/v1/businesses/${businessId}/personnel`);
|
|
29462
29554
|
function buildKey26({
|
|
29463
29555
|
access_token: accessToken,
|
|
@@ -29495,7 +29587,7 @@ function useCreateBusinessPersonnel() {
|
|
|
29495
29587
|
}
|
|
29496
29588
|
);
|
|
29497
29589
|
const { trigger: originalTrigger } = mutationResponse;
|
|
29498
|
-
const stableProxiedTrigger =
|
|
29590
|
+
const stableProxiedTrigger = useCallback21(
|
|
29499
29591
|
(...triggerParameters) => __async(null, null, function* () {
|
|
29500
29592
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
29501
29593
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -29529,7 +29621,7 @@ var updateBusinessPersonnel = post(({ businessId, businessPersonnelId }) => {
|
|
|
29529
29621
|
});
|
|
29530
29622
|
|
|
29531
29623
|
// src/hooks/businessPersonnel/useUpdateBusinessPersonnel.ts
|
|
29532
|
-
import { useCallback as
|
|
29624
|
+
import { useCallback as useCallback22 } from "react";
|
|
29533
29625
|
function buildKey27({
|
|
29534
29626
|
access_token: accessToken,
|
|
29535
29627
|
apiUrl,
|
|
@@ -29572,7 +29664,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
|
29572
29664
|
}
|
|
29573
29665
|
);
|
|
29574
29666
|
const { trigger: originalTrigger } = mutationResponse;
|
|
29575
|
-
const stableProxiedTrigger =
|
|
29667
|
+
const stableProxiedTrigger = useCallback22(
|
|
29576
29668
|
(...triggerParameters) => __async(null, null, function* () {
|
|
29577
29669
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
29578
29670
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -29599,7 +29691,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
|
29599
29691
|
// src/hooks/business/useUpdateBusiness.ts
|
|
29600
29692
|
import useSWRMutation18 from "swr/mutation";
|
|
29601
29693
|
import { useSWRConfig as useSWRConfig11 } from "swr";
|
|
29602
|
-
import { useCallback as
|
|
29694
|
+
import { useCallback as useCallback23 } from "react";
|
|
29603
29695
|
var BUSINESS_TAG_KEY = "business";
|
|
29604
29696
|
function buildKey28({
|
|
29605
29697
|
access_token: accessToken,
|
|
@@ -29637,7 +29729,7 @@ function useUpdateBusiness() {
|
|
|
29637
29729
|
}
|
|
29638
29730
|
);
|
|
29639
29731
|
const { trigger: originalTrigger } = mutationResponse;
|
|
29640
|
-
const stableProxiedTrigger =
|
|
29732
|
+
const stableProxiedTrigger = useCallback23(
|
|
29641
29733
|
(...triggerParameters) => __async(null, null, function* () {
|
|
29642
29734
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
29643
29735
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -29662,7 +29754,7 @@ function useUpdateBusiness() {
|
|
|
29662
29754
|
}
|
|
29663
29755
|
|
|
29664
29756
|
// src/components/BusinessForm/useBusinessForm.ts
|
|
29665
|
-
import { useState as
|
|
29757
|
+
import { useState as useState64 } from "react";
|
|
29666
29758
|
var getPerson = (personnel) => {
|
|
29667
29759
|
const owners = personnel == null ? void 0 : personnel.filter((p) => p.roles.find((x) => x.role === "OWNER"));
|
|
29668
29760
|
if (owners && owners.length > 0) {
|
|
@@ -29673,7 +29765,7 @@ var getPerson = (personnel) => {
|
|
|
29673
29765
|
var useBusinessForm = ({ onSuccess }) => {
|
|
29674
29766
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
29675
29767
|
const { business } = useLayerContext();
|
|
29676
|
-
const [submitError, setSubmitError] =
|
|
29768
|
+
const [submitError, setSubmitError] = useState64(void 0);
|
|
29677
29769
|
const { data: personnel } = useBusinessPersonnel();
|
|
29678
29770
|
const person = getPerson(personnel);
|
|
29679
29771
|
const { trigger: createBusinessPersonnel2 } = useCreateBusinessPersonnel();
|
|
@@ -29881,7 +29973,7 @@ var PhoneInput = (_a) => {
|
|
|
29881
29973
|
|
|
29882
29974
|
// src/components/BusinessForm/BusinessForm.tsx
|
|
29883
29975
|
import { isPossiblePhoneNumber } from "libphonenumber-js";
|
|
29884
|
-
import { Fragment as
|
|
29976
|
+
import { Fragment as Fragment44, jsx as jsx271, jsxs as jsxs174 } from "react/jsx-runtime";
|
|
29885
29977
|
var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
29886
29978
|
var _a;
|
|
29887
29979
|
const { form, submitError, isFormValid } = useBusinessForm({ onSuccess });
|
|
@@ -29905,7 +29997,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29905
29997
|
validators: {
|
|
29906
29998
|
onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Full name is required"
|
|
29907
29999
|
},
|
|
29908
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
30000
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "full_name", label: "Full name", children: /* @__PURE__ */ jsx271(
|
|
29909
30001
|
Input,
|
|
29910
30002
|
{
|
|
29911
30003
|
name: "full_name",
|
|
@@ -29918,7 +30010,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29918
30010
|
) }) })
|
|
29919
30011
|
}
|
|
29920
30012
|
),
|
|
29921
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "preferred_name", children: (field) => /* @__PURE__ */ jsx271(
|
|
30013
|
+
/* @__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(
|
|
29922
30014
|
Input,
|
|
29923
30015
|
{
|
|
29924
30016
|
name: "preferred_name",
|
|
@@ -29935,7 +30027,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29935
30027
|
validators: {
|
|
29936
30028
|
onSubmit: ({ value }) => validateEmailFormat(value, true) ? void 0 : "Email is invalid"
|
|
29937
30029
|
},
|
|
29938
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
30030
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(
|
|
29939
30031
|
InputGroup,
|
|
29940
30032
|
{
|
|
29941
30033
|
name: "email",
|
|
@@ -29962,7 +30054,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29962
30054
|
validators: {
|
|
29963
30055
|
onSubmit: ({ value }) => isPossiblePhoneNumber(value != null ? value : "", "US") ? void 0 : "Phone number is invalid"
|
|
29964
30056
|
},
|
|
29965
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
30057
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(
|
|
29966
30058
|
InputGroup,
|
|
29967
30059
|
{
|
|
29968
30060
|
name: "phone_number",
|
|
@@ -29989,7 +30081,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29989
30081
|
validators: {
|
|
29990
30082
|
onBlur: ({ value }) => notEmpty(value) ? void 0 : "Company name is required"
|
|
29991
30083
|
},
|
|
29992
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
30084
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "legal_name", label: "Company", children: /* @__PURE__ */ jsx271(
|
|
29993
30085
|
Input,
|
|
29994
30086
|
{
|
|
29995
30087
|
name: "legal_name",
|
|
@@ -30002,7 +30094,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30002
30094
|
) }) })
|
|
30003
30095
|
}
|
|
30004
30096
|
),
|
|
30005
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "dba", children: (field) => /* @__PURE__ */ jsx271(
|
|
30097
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "dba", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "dba", label: "DBA (optional)", children: /* @__PURE__ */ jsx271(
|
|
30006
30098
|
Input,
|
|
30007
30099
|
{
|
|
30008
30100
|
name: "dba",
|
|
@@ -30013,7 +30105,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30013
30105
|
errorMessage: field.state.meta.errors.join(", ")
|
|
30014
30106
|
}
|
|
30015
30107
|
) }) }) }),
|
|
30016
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "entity_type", children: (field) => /* @__PURE__ */ jsx271(
|
|
30108
|
+
/* @__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(
|
|
30017
30109
|
BusinessTypeSelect,
|
|
30018
30110
|
{
|
|
30019
30111
|
value: field.state.value,
|
|
@@ -30021,14 +30113,14 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30021
30113
|
}
|
|
30022
30114
|
) }) }) }),
|
|
30023
30115
|
/* @__PURE__ */ jsxs174("div", { className: "Layer__business-form__state-tin-fields", children: [
|
|
30024
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "us_state", children: (field) => /* @__PURE__ */ jsx271(
|
|
30116
|
+
/* @__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(
|
|
30025
30117
|
USStateSelect,
|
|
30026
30118
|
{
|
|
30027
30119
|
value: field.state.value,
|
|
30028
30120
|
onChange: (option) => field.handleChange(option.value)
|
|
30029
30121
|
}
|
|
30030
30122
|
) }) }) }),
|
|
30031
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "tin", children: (field) => /* @__PURE__ */ jsx271(
|
|
30123
|
+
/* @__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(
|
|
30032
30124
|
Input,
|
|
30033
30125
|
{
|
|
30034
30126
|
name: "tin",
|
|
@@ -30059,10 +30151,10 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30059
30151
|
};
|
|
30060
30152
|
|
|
30061
30153
|
// src/components/PlatformOnboarding/Steps/BusinessInfoStep.tsx
|
|
30062
|
-
import { Fragment as
|
|
30154
|
+
import { Fragment as Fragment45, jsx as jsx272, jsxs as jsxs175 } from "react/jsx-runtime";
|
|
30063
30155
|
var defaultTitle3 = "We\u2019ll use this information to contact you whenever we have questions on your books.";
|
|
30064
30156
|
var BusinessInfoStep = ({ title = defaultTitle3, onNext }) => {
|
|
30065
|
-
return /* @__PURE__ */ jsxs175(
|
|
30157
|
+
return /* @__PURE__ */ jsxs175(Fragment45, { children: [
|
|
30066
30158
|
/* @__PURE__ */ jsx272(Heading2, { children: title }),
|
|
30067
30159
|
/* @__PURE__ */ jsx272(BusinessForm2, { onSuccess: onNext })
|
|
30068
30160
|
] });
|
|
@@ -30089,7 +30181,7 @@ var PLATFORM_ONBOARDING_STEPS = [
|
|
|
30089
30181
|
}
|
|
30090
30182
|
];
|
|
30091
30183
|
var PlatformOnboarding = ({ onComplete }) => {
|
|
30092
|
-
const [step, setStep] =
|
|
30184
|
+
const [step, setStep] = useState65(PLATFORM_ONBOARDING_STEPS[0].id);
|
|
30093
30185
|
const isFirstStep = PLATFORM_ONBOARDING_STEPS[0].id === step;
|
|
30094
30186
|
const nextStep = () => {
|
|
30095
30187
|
const currentStepIndex = PLATFORM_ONBOARDING_STEPS.findIndex((s) => s.id === step);
|
|
@@ -30251,7 +30343,7 @@ var BookkeepingUpsellBar = ({
|
|
|
30251
30343
|
};
|
|
30252
30344
|
|
|
30253
30345
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
30254
|
-
import { useState as
|
|
30346
|
+
import { useState as useState66 } from "react";
|
|
30255
30347
|
|
|
30256
30348
|
// src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
|
|
30257
30349
|
import { jsx as jsx276 } from "react/jsx-runtime";
|
|
@@ -30331,7 +30423,7 @@ var BookkeepingOverview = ({
|
|
|
30331
30423
|
slotProps
|
|
30332
30424
|
}) => {
|
|
30333
30425
|
var _a, _b, _c, _d, _e, _f;
|
|
30334
|
-
const [pnlToggle, setPnlToggle] =
|
|
30426
|
+
const [pnlToggle, setPnlToggle] = useState66("expenses");
|
|
30335
30427
|
const [width] = useWindowSize();
|
|
30336
30428
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
30337
30429
|
const { upperContentRef, targetElementRef, upperElementInFocus } = useKeepInMobileViewport();
|
|
@@ -30462,7 +30554,7 @@ var BookkeepingOverview = ({
|
|
|
30462
30554
|
};
|
|
30463
30555
|
|
|
30464
30556
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
30465
|
-
import { useState as
|
|
30557
|
+
import { useState as useState67 } from "react";
|
|
30466
30558
|
import classNames75 from "classnames";
|
|
30467
30559
|
import { jsx as jsx278, jsxs as jsxs180 } from "react/jsx-runtime";
|
|
30468
30560
|
var AccountingOverview = ({
|
|
@@ -30478,7 +30570,7 @@ var AccountingOverview = ({
|
|
|
30478
30570
|
slotProps
|
|
30479
30571
|
}) => {
|
|
30480
30572
|
var _a, _b, _c, _d, _e;
|
|
30481
|
-
const [pnlToggle, setPnlToggle] =
|
|
30573
|
+
const [pnlToggle, setPnlToggle] = useState67("expenses");
|
|
30482
30574
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
30483
30575
|
return /* @__PURE__ */ jsx278(
|
|
30484
30576
|
ProfitAndLoss,
|
|
@@ -30645,7 +30737,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
30645
30737
|
};
|
|
30646
30738
|
|
|
30647
30739
|
// src/views/GeneralLedger/GeneralLedger.tsx
|
|
30648
|
-
import { useState as
|
|
30740
|
+
import { useState as useState68 } from "react";
|
|
30649
30741
|
import { jsx as jsx280, jsxs as jsxs182 } from "react/jsx-runtime";
|
|
30650
30742
|
var GeneralLedgerView = ({
|
|
30651
30743
|
title,
|
|
@@ -30654,7 +30746,7 @@ var GeneralLedgerView = ({
|
|
|
30654
30746
|
stringOverrides,
|
|
30655
30747
|
chartOfAccountsOptions
|
|
30656
30748
|
}) => {
|
|
30657
|
-
const [activeTab, setActiveTab] =
|
|
30749
|
+
const [activeTab, setActiveTab] = useState68("chartOfAccounts");
|
|
30658
30750
|
return /* @__PURE__ */ jsx280(ProfitAndLoss, { asContainer: false, children: /* @__PURE__ */ jsxs182(
|
|
30659
30751
|
View,
|
|
30660
30752
|
{
|
|
@@ -30696,9 +30788,9 @@ var GeneralLedgerView = ({
|
|
|
30696
30788
|
};
|
|
30697
30789
|
|
|
30698
30790
|
// src/views/ProjectProfitability/ProjectProfitability.tsx
|
|
30699
|
-
import { useState as
|
|
30791
|
+
import { useState as useState69 } from "react";
|
|
30700
30792
|
import Select4 from "react-select";
|
|
30701
|
-
import { Fragment as
|
|
30793
|
+
import { Fragment as Fragment46, jsx as jsx281, jsxs as jsxs183 } from "react/jsx-runtime";
|
|
30702
30794
|
var ProjectProfitabilityView = ({
|
|
30703
30795
|
valueOptions,
|
|
30704
30796
|
showTitle,
|
|
@@ -30706,9 +30798,9 @@ var ProjectProfitabilityView = ({
|
|
|
30706
30798
|
datePickerMode = "monthPicker",
|
|
30707
30799
|
csvMoneyFormat = "DOLLAR_STRING"
|
|
30708
30800
|
}) => {
|
|
30709
|
-
const [activeTab, setActiveTab] =
|
|
30710
|
-
const [tagFilter, setTagFilter] =
|
|
30711
|
-
const [pnlTagFilter, setPnlTagFilter] =
|
|
30801
|
+
const [activeTab, setActiveTab] = useState69("overview");
|
|
30802
|
+
const [tagFilter, setTagFilter] = useState69(null);
|
|
30803
|
+
const [pnlTagFilter, setPnlTagFilter] = useState69(
|
|
30712
30804
|
void 0
|
|
30713
30805
|
);
|
|
30714
30806
|
const isOptionSelected = (option, selectValue) => {
|
|
@@ -30771,7 +30863,7 @@ var ProjectProfitabilityView = ({
|
|
|
30771
30863
|
}
|
|
30772
30864
|
)
|
|
30773
30865
|
] }),
|
|
30774
|
-
/* @__PURE__ */ jsx281(Container, { name: "project", children: /* @__PURE__ */ jsxs183(
|
|
30866
|
+
/* @__PURE__ */ jsx281(Container, { name: "project", children: /* @__PURE__ */ jsxs183(Fragment46, { children: [
|
|
30775
30867
|
activeTab === "overview" && /* @__PURE__ */ jsx281(
|
|
30776
30868
|
AccountingOverview,
|
|
30777
30869
|
{
|
|
@@ -30807,8 +30899,8 @@ var ProjectProfitabilityView = ({
|
|
|
30807
30899
|
};
|
|
30808
30900
|
|
|
30809
30901
|
// src/views/Reports/Reports.tsx
|
|
30810
|
-
import { useState as
|
|
30811
|
-
import { Fragment as
|
|
30902
|
+
import { useState as useState70 } from "react";
|
|
30903
|
+
import { Fragment as Fragment47, jsx as jsx282, jsxs as jsxs184 } from "react/jsx-runtime";
|
|
30812
30904
|
var getOptions = (enabledReports) => {
|
|
30813
30905
|
return [
|
|
30814
30906
|
enabledReports.includes("profitAndLoss") ? {
|
|
@@ -30835,7 +30927,7 @@ var Reports = ({
|
|
|
30835
30927
|
statementOfCashFlowConfig
|
|
30836
30928
|
}) => {
|
|
30837
30929
|
var _a;
|
|
30838
|
-
const [activeTab, setActiveTab] =
|
|
30930
|
+
const [activeTab, setActiveTab] = useState70(enabledReports[0]);
|
|
30839
30931
|
const { view, containerRef } = useElementViewSize();
|
|
30840
30932
|
const options = getOptions(enabledReports);
|
|
30841
30933
|
const defaultTitle4 = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
|
|
@@ -30877,7 +30969,7 @@ var ReportsPanel = ({
|
|
|
30877
30969
|
statementOfCashFlowConfig,
|
|
30878
30970
|
view
|
|
30879
30971
|
}) => {
|
|
30880
|
-
return /* @__PURE__ */ jsxs184(
|
|
30972
|
+
return /* @__PURE__ */ jsxs184(Fragment47, { children: [
|
|
30881
30973
|
openReport === "profitAndLoss" && /* @__PURE__ */ jsx282(
|
|
30882
30974
|
ProfitAndLoss.Report,
|
|
30883
30975
|
__spreadValues({
|
|
@@ -30897,8 +30989,8 @@ var ReportsPanel = ({
|
|
|
30897
30989
|
};
|
|
30898
30990
|
|
|
30899
30991
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
30900
|
-
import { useContext as
|
|
30901
|
-
import { Fragment as
|
|
30992
|
+
import { useContext as useContext55, useRef as useRef24 } from "react";
|
|
30993
|
+
import { Fragment as Fragment48, jsx as jsx283, jsxs as jsxs185 } from "react/jsx-runtime";
|
|
30902
30994
|
var COMPONENT_NAME8 = "profit-and-loss";
|
|
30903
30995
|
var ProfitAndLossView = (props) => {
|
|
30904
30996
|
const containerRef = useRef24(null);
|
|
@@ -30912,7 +31004,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
30912
31004
|
"containerRef",
|
|
30913
31005
|
"stringOverrides"
|
|
30914
31006
|
]);
|
|
30915
|
-
const { sidebarScope } =
|
|
31007
|
+
const { sidebarScope } = useContext55(ProfitAndLoss.Context);
|
|
30916
31008
|
return /* @__PURE__ */ jsxs185(
|
|
30917
31009
|
Panel,
|
|
30918
31010
|
{
|
|
@@ -30943,7 +31035,7 @@ var Components = ({
|
|
|
30943
31035
|
hideTable = false,
|
|
30944
31036
|
stringOverrides
|
|
30945
31037
|
}) => {
|
|
30946
|
-
const { error, isLoading, isValidating, refetch } =
|
|
31038
|
+
const { error, isLoading, isValidating, refetch } = useContext55(
|
|
30947
31039
|
ProfitAndLoss.Context
|
|
30948
31040
|
);
|
|
30949
31041
|
if (!isLoading && error) {
|
|
@@ -30958,7 +31050,7 @@ var Components = ({
|
|
|
30958
31050
|
}
|
|
30959
31051
|
) });
|
|
30960
31052
|
}
|
|
30961
|
-
return /* @__PURE__ */ jsxs185(
|
|
31053
|
+
return /* @__PURE__ */ jsxs185(Fragment48, { children: [
|
|
30962
31054
|
!hideChart && /* @__PURE__ */ jsxs185("div", { className: `Layer__${COMPONENT_NAME8}__chart_with_summaries`, children: [
|
|
30963
31055
|
/* @__PURE__ */ jsxs185(
|
|
30964
31056
|
"div",
|
|
@@ -31004,6 +31096,7 @@ export {
|
|
|
31004
31096
|
Direction,
|
|
31005
31097
|
DisplayState,
|
|
31006
31098
|
GeneralLedgerView,
|
|
31099
|
+
Integrations,
|
|
31007
31100
|
Journal,
|
|
31008
31101
|
LayerProvider,
|
|
31009
31102
|
LinkAccounts,
|
|
@@ -31013,11 +31106,9 @@ export {
|
|
|
31013
31106
|
ProfitAndLoss,
|
|
31014
31107
|
ProfitAndLossView,
|
|
31015
31108
|
ProjectProfitabilityView,
|
|
31016
|
-
Quickbooks,
|
|
31017
31109
|
Reports,
|
|
31018
31110
|
StatementOfCashFlow,
|
|
31019
31111
|
Tasks,
|
|
31020
|
-
unstable_Integrations,
|
|
31021
31112
|
useBankTransactionsContext,
|
|
31022
31113
|
useDataSync,
|
|
31023
31114
|
useLayerContext
|