@layerfi/components 0.1.99 → 0.1.100
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +851 -765
- package/dist/esm/index.mjs +694 -607
- package/dist/index.css +4 -3
- 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.100";
|
|
5574
5574
|
|
|
5575
5575
|
// src/models/APIError.ts
|
|
5576
5576
|
var APIError = class _APIError extends Error {
|
|
@@ -5977,9 +5977,6 @@ var profitAndLossComparisonCsv = post(
|
|
|
5977
5977
|
|
|
5978
5978
|
// src/api/layer/quickbooks.ts
|
|
5979
5979
|
var syncFromQuickbooks = post(({ businessId }) => `/v1/businesses/${businessId}/quickbooks/sync-from`);
|
|
5980
|
-
var statusOfSyncFromQuickbooks = get(
|
|
5981
|
-
({ businessId }) => `/v1/businesses/${businessId}/quickbooks/sync-from/status`
|
|
5982
|
-
);
|
|
5983
5980
|
var initQuickbooksOAuth = post(({ businessId }) => `/v1/businesses/${businessId}/quickbooks/authorize`);
|
|
5984
5981
|
var unlinkQuickbooksConnection = post(({ businessId }) => `/v1/businesses/${businessId}/quickbooks/unlink`);
|
|
5985
5982
|
var statusOfQuickbooksConnection = get(
|
|
@@ -6053,7 +6050,6 @@ var Layer = {
|
|
|
6053
6050
|
updateOpeningBalance,
|
|
6054
6051
|
getStatementOfCashFlow,
|
|
6055
6052
|
syncFromQuickbooks,
|
|
6056
|
-
statusOfSyncFromQuickbooks,
|
|
6057
6053
|
statusOfQuickbooksConnection,
|
|
6058
6054
|
initQuickbooksOAuth,
|
|
6059
6055
|
unlinkQuickbooksConnection,
|
|
@@ -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
|
{
|
|
@@ -23232,7 +23320,7 @@ var ProfitAndLossTableComponent = ({
|
|
|
23232
23320
|
// src/components/ProfitAndLossTable/ProfitAndLossTableWithProvider.tsx
|
|
23233
23321
|
import { jsx as jsx204 } from "react/jsx-runtime";
|
|
23234
23322
|
var ProfitAndLossTableWithProvider = (props) => {
|
|
23235
|
-
const { compareModeActive } =
|
|
23323
|
+
const { compareModeActive } = useContext36(ProfitAndLoss.ComparisonContext);
|
|
23236
23324
|
return /* @__PURE__ */ jsx204(TableProvider, { children: compareModeActive ? /* @__PURE__ */ jsx204("div", { className: "Layer__compare__table__wrapper", children: /* @__PURE__ */ jsx204(ProfitAndLossCompareTable, __spreadValues({}, props)) }) : /* @__PURE__ */ jsx204(ProfitAndLossTableComponent, __spreadValues({}, props)) });
|
|
23237
23325
|
};
|
|
23238
23326
|
|
|
@@ -23337,10 +23425,10 @@ function useBalanceSheet({
|
|
|
23337
23425
|
}
|
|
23338
23426
|
|
|
23339
23427
|
// src/hooks/useElementViewSize/useElementViewSize.tsx
|
|
23340
|
-
import { useLayoutEffect as useLayoutEffect3, useRef as useRef22, useState as
|
|
23428
|
+
import { useLayoutEffect as useLayoutEffect3, useRef as useRef22, useState as useState49 } from "react";
|
|
23341
23429
|
var useElementViewSize = () => {
|
|
23342
23430
|
const containerRef = useRef22(null);
|
|
23343
|
-
const [view, setView] =
|
|
23431
|
+
const [view, setView] = useState49("desktop");
|
|
23344
23432
|
const resizeTimeout = useRef22(null);
|
|
23345
23433
|
useLayoutEffect3(() => {
|
|
23346
23434
|
const element = containerRef == null ? void 0 : containerRef.current;
|
|
@@ -23411,7 +23499,7 @@ var BalanceSheetExpandAllButton = ({
|
|
|
23411
23499
|
};
|
|
23412
23500
|
|
|
23413
23501
|
// src/components/BalanceSheetTable/BalanceSheetTable.tsx
|
|
23414
|
-
import { Fragment as
|
|
23502
|
+
import { Fragment as Fragment26, useEffect as useEffect33 } from "react";
|
|
23415
23503
|
import { jsx as jsx208, jsxs as jsxs128 } from "react/jsx-runtime";
|
|
23416
23504
|
var BalanceSheetTable = ({
|
|
23417
23505
|
data,
|
|
@@ -23435,7 +23523,7 @@ var BalanceSheetTable = ({
|
|
|
23435
23523
|
if (expandable) {
|
|
23436
23524
|
allRowKeys.push(rowKey);
|
|
23437
23525
|
}
|
|
23438
|
-
return /* @__PURE__ */ jsxs128(
|
|
23526
|
+
return /* @__PURE__ */ jsxs128(Fragment26, { children: [
|
|
23439
23527
|
/* @__PURE__ */ jsxs128(
|
|
23440
23528
|
TableRow,
|
|
23441
23529
|
{
|
|
@@ -23486,7 +23574,7 @@ var BalanceSheetTable = ({
|
|
|
23486
23574
|
/* @__PURE__ */ jsx208(TableCell, { isHeaderCell: true, children: (stringOverrides == null ? void 0 : stringOverrides.typeColumnHeader) || "Type" }),
|
|
23487
23575
|
/* @__PURE__ */ jsx208(TableCell, { isHeaderCell: true, align: "right" /* RIGHT */, children: (stringOverrides == null ? void 0 : stringOverrides.totalColumnHeader) || "Total" })
|
|
23488
23576
|
] }) }),
|
|
23489
|
-
/* @__PURE__ */ jsx208(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx208(
|
|
23577
|
+
/* @__PURE__ */ jsx208(TableBody, { children: config.map((row, idx) => /* @__PURE__ */ jsx208(Fragment26, { children: data[row.lineItem] && renderLineItem(
|
|
23490
23578
|
data[row.lineItem],
|
|
23491
23579
|
0,
|
|
23492
23580
|
row.lineItem,
|
|
@@ -23560,7 +23648,7 @@ function useBalanceSheetDownload({
|
|
|
23560
23648
|
}
|
|
23561
23649
|
|
|
23562
23650
|
// src/components/BalanceSheet/download/BalanceSheetDownloadButton.tsx
|
|
23563
|
-
import { Fragment as
|
|
23651
|
+
import { Fragment as Fragment27, jsx as jsx209, jsxs as jsxs129 } from "react/jsx-runtime";
|
|
23564
23652
|
function BalanceSheetDownloadButton({
|
|
23565
23653
|
effectiveDate,
|
|
23566
23654
|
iconOnly
|
|
@@ -23570,7 +23658,7 @@ function BalanceSheetDownloadButton({
|
|
|
23570
23658
|
effectiveDate,
|
|
23571
23659
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
23572
23660
|
});
|
|
23573
|
-
return /* @__PURE__ */ jsxs129(
|
|
23661
|
+
return /* @__PURE__ */ jsxs129(Fragment27, { children: [
|
|
23574
23662
|
/* @__PURE__ */ jsx209(
|
|
23575
23663
|
DownloadButton,
|
|
23576
23664
|
{
|
|
@@ -23660,7 +23748,7 @@ var BalanceSheetView = ({
|
|
|
23660
23748
|
};
|
|
23661
23749
|
|
|
23662
23750
|
// src/components/StatementOfCashFlowTable/StatementOfCashFlowTable.tsx
|
|
23663
|
-
import { Fragment as
|
|
23751
|
+
import { Fragment as Fragment28 } from "react";
|
|
23664
23752
|
import { jsx as jsx211, jsxs as jsxs131 } from "react/jsx-runtime";
|
|
23665
23753
|
var StatementOfCashFlowTable = ({
|
|
23666
23754
|
data,
|
|
@@ -23671,7 +23759,7 @@ var StatementOfCashFlowTable = ({
|
|
|
23671
23759
|
const renderLineItem = (lineItem, depth = 0, rowKey, rowIndex) => {
|
|
23672
23760
|
const expandable = !!lineItem.line_items && lineItem.line_items.length > 0;
|
|
23673
23761
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
23674
|
-
return /* @__PURE__ */ jsxs131(
|
|
23762
|
+
return /* @__PURE__ */ jsxs131(Fragment28, { children: [
|
|
23675
23763
|
/* @__PURE__ */ jsxs131(
|
|
23676
23764
|
TableRow,
|
|
23677
23765
|
{
|
|
@@ -23723,7 +23811,7 @@ var StatementOfCashFlowTable = ({
|
|
|
23723
23811
|
] }) }),
|
|
23724
23812
|
/* @__PURE__ */ jsx211(TableBody, { children: config.map((row, idx) => {
|
|
23725
23813
|
if (row.type === "line_item") {
|
|
23726
|
-
return /* @__PURE__ */ jsx211(
|
|
23814
|
+
return /* @__PURE__ */ jsx211(Fragment28, { children: data[row.lineItem] && renderLineItem(
|
|
23727
23815
|
data[row.lineItem],
|
|
23728
23816
|
0,
|
|
23729
23817
|
row.lineItem ? row.lineItem : "",
|
|
@@ -23849,7 +23937,7 @@ function useCashflowStatementDownload({
|
|
|
23849
23937
|
}
|
|
23850
23938
|
|
|
23851
23939
|
// src/components/StatementOfCashFlow/download/CashflowStatementDownloadButton.tsx
|
|
23852
|
-
import { Fragment as
|
|
23940
|
+
import { Fragment as Fragment29, jsx as jsx212, jsxs as jsxs132 } from "react/jsx-runtime";
|
|
23853
23941
|
function CashflowStatementDownloadButton({
|
|
23854
23942
|
startDate,
|
|
23855
23943
|
endDate,
|
|
@@ -23861,7 +23949,7 @@ function CashflowStatementDownloadButton({
|
|
|
23861
23949
|
endDate,
|
|
23862
23950
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
23863
23951
|
});
|
|
23864
|
-
return /* @__PURE__ */ jsxs132(
|
|
23952
|
+
return /* @__PURE__ */ jsxs132(Fragment29, { children: [
|
|
23865
23953
|
/* @__PURE__ */ jsx212(
|
|
23866
23954
|
DownloadButton,
|
|
23867
23955
|
{
|
|
@@ -24025,7 +24113,7 @@ var StatementOfCashFlowView = ({
|
|
|
24025
24113
|
};
|
|
24026
24114
|
|
|
24027
24115
|
// src/components/ChartOfAccounts/ChartOfAccounts.tsx
|
|
24028
|
-
import { useContext as
|
|
24116
|
+
import { useContext as useContext44 } from "react";
|
|
24029
24117
|
|
|
24030
24118
|
// src/contexts/ChartOfAccountsContext/ChartOfAccountsContext.tsx
|
|
24031
24119
|
import { createContext as createContext17 } from "react";
|
|
@@ -24084,7 +24172,7 @@ var LedgerAccountsContext = createContext18({
|
|
|
24084
24172
|
});
|
|
24085
24173
|
|
|
24086
24174
|
// src/hooks/useChartOfAccounts/useChartOfAccounts.tsx
|
|
24087
|
-
import { useEffect as useEffect34, useState as
|
|
24175
|
+
import { useEffect as useEffect34, useState as useState50 } from "react";
|
|
24088
24176
|
|
|
24089
24177
|
// src/components/ChartOfAccountsForm/constants.ts
|
|
24090
24178
|
var LEDGER_ACCOUNT_TYPES = [
|
|
@@ -24384,13 +24472,13 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
24384
24472
|
} = useLayerContext();
|
|
24385
24473
|
const { apiUrl } = useEnvironment();
|
|
24386
24474
|
const { data: auth } = useAuth();
|
|
24387
|
-
const [form, setForm] =
|
|
24388
|
-
const [sendingForm, setSendingForm] =
|
|
24389
|
-
const [apiError, setApiError] =
|
|
24390
|
-
const [startDate, setStartDate] =
|
|
24475
|
+
const [form, setForm] = useState50();
|
|
24476
|
+
const [sendingForm, setSendingForm] = useState50(false);
|
|
24477
|
+
const [apiError, setApiError] = useState50(void 0);
|
|
24478
|
+
const [startDate, setStartDate] = useState50(
|
|
24391
24479
|
initialStartDate != null ? initialStartDate : startOfMonth15(Date.now())
|
|
24392
24480
|
);
|
|
24393
|
-
const [endDate, setEndDate] =
|
|
24481
|
+
const [endDate, setEndDate] = useState50(
|
|
24394
24482
|
initialEndDate != null ? initialEndDate : endOfMonth12(Date.now())
|
|
24395
24483
|
);
|
|
24396
24484
|
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `chart-of-accounts-${businessId}-${startDate == null ? void 0 : startDate.valueOf()}-${endDate == null ? void 0 : endDate.valueOf()}`;
|
|
@@ -24605,17 +24693,17 @@ var useChartOfAccounts = ({ withDates, startDate: initialStartDate, endDate: ini
|
|
|
24605
24693
|
// src/hooks/useChartOfAccounts/useCreateChildAccount.tsx
|
|
24606
24694
|
import useSWRMutation9 from "swr/mutation";
|
|
24607
24695
|
import { useSWRConfig as useSWRConfig4 } from "swr";
|
|
24608
|
-
import { useCallback as
|
|
24696
|
+
import { useCallback as useCallback14 } from "react";
|
|
24609
24697
|
|
|
24610
24698
|
// src/hooks/useLedgerAccounts/useLedgerAccounts.tsx
|
|
24611
|
-
import { useEffect as useEffect35, useState as
|
|
24699
|
+
import { useEffect as useEffect35, useState as useState51 } from "react";
|
|
24612
24700
|
import useSWR15 from "swr";
|
|
24613
24701
|
var useLedgerAccounts = (showReversalEntries = false) => {
|
|
24614
24702
|
const { businessId, read, syncTimestamps, hasBeenTouched } = useLayerContext();
|
|
24615
24703
|
const { apiUrl } = useEnvironment();
|
|
24616
24704
|
const { data: auth } = useAuth();
|
|
24617
|
-
const [accountId, setAccountId] =
|
|
24618
|
-
const [selectedEntryId, setSelectedEntryId] =
|
|
24705
|
+
const [accountId, setAccountId] = useState51();
|
|
24706
|
+
const [selectedEntryId, setSelectedEntryId] = useState51();
|
|
24619
24707
|
const queryKey = businessId && accountId && (auth == null ? void 0 : auth.access_token) && `ledger-accounts-lines-${businessId}-${accountId}`;
|
|
24620
24708
|
const { data, isLoading, isValidating, error, mutate } = useSWR15(
|
|
24621
24709
|
queryKey,
|
|
@@ -24673,7 +24761,7 @@ var useLedgerAccounts = (showReversalEntries = false) => {
|
|
|
24673
24761
|
};
|
|
24674
24762
|
|
|
24675
24763
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTableWithPanel.tsx
|
|
24676
|
-
import { useContext as
|
|
24764
|
+
import { useContext as useContext40, useState as useState53 } from "react";
|
|
24677
24765
|
|
|
24678
24766
|
// src/icons/Plus.tsx
|
|
24679
24767
|
import { jsx as jsx215, jsxs as jsxs134 } from "react/jsx-runtime";
|
|
@@ -24714,11 +24802,11 @@ var Plus = (_a) => {
|
|
|
24714
24802
|
var Plus_default = Plus;
|
|
24715
24803
|
|
|
24716
24804
|
// src/components/ChartOfAccountsDatePicker/ChartOfAccountsDatePicker.tsx
|
|
24717
|
-
import { useContext as
|
|
24805
|
+
import { useContext as useContext37 } from "react";
|
|
24718
24806
|
import { endOfMonth as endOfMonth13, startOfMonth as startOfMonth16 } from "date-fns";
|
|
24719
24807
|
import { jsx as jsx216 } from "react/jsx-runtime";
|
|
24720
24808
|
var ChartOfAccountsDatePicker = () => {
|
|
24721
|
-
const { changeDateRange, dateRange } =
|
|
24809
|
+
const { changeDateRange, dateRange } = useContext37(ChartOfAccountsContext);
|
|
24722
24810
|
return /* @__PURE__ */ jsx216(
|
|
24723
24811
|
DatePicker,
|
|
24724
24812
|
{
|
|
@@ -24737,7 +24825,7 @@ var ChartOfAccountsDatePicker = () => {
|
|
|
24737
24825
|
};
|
|
24738
24826
|
|
|
24739
24827
|
// src/components/ChartOfAccountsForm/ChartOfAccountsForm.tsx
|
|
24740
|
-
import { useContext as
|
|
24828
|
+
import { useContext as useContext38, useMemo as useMemo33 } from "react";
|
|
24741
24829
|
|
|
24742
24830
|
// src/components/ChartOfAccountsForm/useParentOptions.ts
|
|
24743
24831
|
import { useMemo as useMemo32 } from "react";
|
|
@@ -24768,7 +24856,7 @@ var ChartOfAccountsForm = ({
|
|
|
24768
24856
|
submitForm,
|
|
24769
24857
|
sendingForm,
|
|
24770
24858
|
apiError
|
|
24771
|
-
} =
|
|
24859
|
+
} = useContext38(ChartOfAccountsContext);
|
|
24772
24860
|
const parentOptions = useParentOptions(data);
|
|
24773
24861
|
const entry = useMemo33(() => {
|
|
24774
24862
|
if ((form == null ? void 0 : form.action) === "edit" && form.accountId) {
|
|
@@ -24983,7 +25071,7 @@ var ChartOfAccountsSidebar = ({
|
|
|
24983
25071
|
};
|
|
24984
25072
|
|
|
24985
25073
|
// src/components/ChartOfAccountsTable/ChartOfAccountsTable.tsx
|
|
24986
|
-
import { Fragment as
|
|
25074
|
+
import { Fragment as Fragment30, useContext as useContext39, useEffect as useEffect36, useState as useState52 } from "react";
|
|
24987
25075
|
|
|
24988
25076
|
// src/icons/Edit2.tsx
|
|
24989
25077
|
import { jsx as jsx219 } from "react/jsx-runtime";
|
|
@@ -25043,10 +25131,10 @@ var ChartOfAccountsTableContent = ({
|
|
|
25043
25131
|
expandAll,
|
|
25044
25132
|
templateAccountsEditable
|
|
25045
25133
|
}) => {
|
|
25046
|
-
const { setAccountId } =
|
|
25047
|
-
const { editAccount } =
|
|
25134
|
+
const { setAccountId } = useContext39(LedgerAccountsContext);
|
|
25135
|
+
const { editAccount } = useContext39(ChartOfAccountsContext);
|
|
25048
25136
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
25049
|
-
const [accountsRowKeys, setAccountsRowKeys] =
|
|
25137
|
+
const [accountsRowKeys, setAccountsRowKeys] = useState52([]);
|
|
25050
25138
|
useEffect36(() => {
|
|
25051
25139
|
if (expandAll === "expanded") {
|
|
25052
25140
|
setIsOpen(accountsRowKeys);
|
|
@@ -25073,7 +25161,7 @@ var ChartOfAccountsTableContent = ({
|
|
|
25073
25161
|
var _a, _b;
|
|
25074
25162
|
const expandable = !!account.sub_accounts && account.sub_accounts.length > 0;
|
|
25075
25163
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
25076
|
-
return /* @__PURE__ */ jsxs136(
|
|
25164
|
+
return /* @__PURE__ */ jsxs136(Fragment30, { children: [
|
|
25077
25165
|
/* @__PURE__ */ jsxs136(
|
|
25078
25166
|
TableRow,
|
|
25079
25167
|
{
|
|
@@ -25205,7 +25293,7 @@ function useAccountBalancesDownload({
|
|
|
25205
25293
|
}
|
|
25206
25294
|
|
|
25207
25295
|
// src/components/ChartOfAccounts/download/AccountBalancesDownloadButton.tsx
|
|
25208
|
-
import { Fragment as
|
|
25296
|
+
import { Fragment as Fragment31, jsx as jsx221, jsxs as jsxs137 } from "react/jsx-runtime";
|
|
25209
25297
|
function AccountBalancesDownloadButton({
|
|
25210
25298
|
startCutoff,
|
|
25211
25299
|
endCutoff,
|
|
@@ -25217,7 +25305,7 @@ function AccountBalancesDownloadButton({
|
|
|
25217
25305
|
endCutoff,
|
|
25218
25306
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
25219
25307
|
});
|
|
25220
|
-
return /* @__PURE__ */ jsxs137(
|
|
25308
|
+
return /* @__PURE__ */ jsxs137(Fragment31, { children: [
|
|
25221
25309
|
/* @__PURE__ */ jsx221(
|
|
25222
25310
|
DownloadButton,
|
|
25223
25311
|
{
|
|
@@ -25249,8 +25337,8 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
25249
25337
|
templateAccountsEditable
|
|
25250
25338
|
}) => {
|
|
25251
25339
|
var _a;
|
|
25252
|
-
const { data, isLoading, addAccount, error, isValidating, refetch, form } =
|
|
25253
|
-
const [expandAll, setExpandAll] =
|
|
25340
|
+
const { data, isLoading, addAccount, error, isValidating, refetch, form } = useContext40(ChartOfAccountsContext);
|
|
25341
|
+
const [expandAll, setExpandAll] = useState53();
|
|
25254
25342
|
const cumulativeIndex = 0;
|
|
25255
25343
|
const accountsLength = (_a = data == null ? void 0 : data.accounts.length) != null ? _a : 0;
|
|
25256
25344
|
return /* @__PURE__ */ jsxs138(
|
|
@@ -25356,14 +25444,14 @@ var ChartOfAccountsTableWithPanel = ({
|
|
|
25356
25444
|
|
|
25357
25445
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
25358
25446
|
import {
|
|
25359
|
-
useContext as
|
|
25447
|
+
useContext as useContext43,
|
|
25360
25448
|
useEffect as useEffect38,
|
|
25361
25449
|
useMemo as useMemo35,
|
|
25362
|
-
useState as
|
|
25450
|
+
useState as useState55
|
|
25363
25451
|
} from "react";
|
|
25364
25452
|
|
|
25365
25453
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
25366
|
-
import { useContext as
|
|
25454
|
+
import { useContext as useContext41, useMemo as useMemo34 } from "react";
|
|
25367
25455
|
|
|
25368
25456
|
// src/utils/journal.ts
|
|
25369
25457
|
var getAccountIdentifierPayload = (journalLineItem) => {
|
|
@@ -25395,14 +25483,14 @@ import { parseISO as parseISO13, format as formatTime10 } from "date-fns";
|
|
|
25395
25483
|
import { jsx as jsx223, jsxs as jsxs139 } from "react/jsx-runtime";
|
|
25396
25484
|
var DateTime = ({
|
|
25397
25485
|
value,
|
|
25398
|
-
format:
|
|
25486
|
+
format: format8,
|
|
25399
25487
|
dateFormat,
|
|
25400
25488
|
timeFormat,
|
|
25401
25489
|
onlyDate,
|
|
25402
25490
|
onlyTime
|
|
25403
25491
|
}) => {
|
|
25404
|
-
if (
|
|
25405
|
-
return /* @__PURE__ */ jsx223(Text, { className: "Layer__datetime", children: formatTime10(parseISO13(value),
|
|
25492
|
+
if (format8) {
|
|
25493
|
+
return /* @__PURE__ */ jsx223(Text, { className: "Layer__datetime", children: formatTime10(parseISO13(value), format8) });
|
|
25406
25494
|
}
|
|
25407
25495
|
const date = formatTime10(parseISO13(value), dateFormat != null ? dateFormat : DATE_FORMAT);
|
|
25408
25496
|
const time = formatTime10(parseISO13(value), timeFormat != null ? timeFormat : TIME_FORMAT);
|
|
@@ -25469,7 +25557,7 @@ var DetailsListItem = ({
|
|
|
25469
25557
|
};
|
|
25470
25558
|
|
|
25471
25559
|
// src/components/LedgerAccountEntryDetails/LedgerAccountEntryDetails.tsx
|
|
25472
|
-
import { Fragment as
|
|
25560
|
+
import { Fragment as Fragment32, jsx as jsx226, jsxs as jsxs142 } from "react/jsx-runtime";
|
|
25473
25561
|
var SourceDetailView = ({
|
|
25474
25562
|
source,
|
|
25475
25563
|
stringOverrides
|
|
@@ -25477,7 +25565,7 @@ var SourceDetailView = ({
|
|
|
25477
25565
|
switch (source.type) {
|
|
25478
25566
|
case "Transaction_Ledger_Entry_Source": {
|
|
25479
25567
|
const transactionSource = source;
|
|
25480
|
-
return /* @__PURE__ */ jsxs142(
|
|
25568
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25481
25569
|
/* @__PURE__ */ jsx226(
|
|
25482
25570
|
DetailsListItem,
|
|
25483
25571
|
{
|
|
@@ -25505,7 +25593,7 @@ var SourceDetailView = ({
|
|
|
25505
25593
|
}
|
|
25506
25594
|
case "Invoice_Ledger_Entry_Source": {
|
|
25507
25595
|
const invoiceSource = source;
|
|
25508
|
-
return /* @__PURE__ */ jsxs142(
|
|
25596
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25509
25597
|
/* @__PURE__ */ jsx226(
|
|
25510
25598
|
DetailsListItem,
|
|
25511
25599
|
{
|
|
@@ -25526,7 +25614,7 @@ var SourceDetailView = ({
|
|
|
25526
25614
|
}
|
|
25527
25615
|
case "Manual_Ledger_Entry_Source": {
|
|
25528
25616
|
const manualSource = source;
|
|
25529
|
-
return /* @__PURE__ */ jsxs142(
|
|
25617
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25530
25618
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.memoLabel) || "Memo", children: manualSource.memo }),
|
|
25531
25619
|
/* @__PURE__ */ jsx226(
|
|
25532
25620
|
DetailsListItem,
|
|
@@ -25539,7 +25627,7 @@ var SourceDetailView = ({
|
|
|
25539
25627
|
}
|
|
25540
25628
|
case "Invoice_Payment_Ledger_Entry_Source": {
|
|
25541
25629
|
const invoicePaymentSource = source;
|
|
25542
|
-
return /* @__PURE__ */ jsxs142(
|
|
25630
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25543
25631
|
/* @__PURE__ */ jsx226(
|
|
25544
25632
|
DetailsListItem,
|
|
25545
25633
|
{
|
|
@@ -25552,7 +25640,7 @@ var SourceDetailView = ({
|
|
|
25552
25640
|
}
|
|
25553
25641
|
case "Refund_Ledger_Entry_Source": {
|
|
25554
25642
|
const refundSource = source;
|
|
25555
|
-
return /* @__PURE__ */ jsxs142(
|
|
25643
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25556
25644
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(refundSource.refunded_to_customer_amount)}` }),
|
|
25557
25645
|
/* @__PURE__ */ jsx226(
|
|
25558
25646
|
DetailsListItem,
|
|
@@ -25565,7 +25653,7 @@ var SourceDetailView = ({
|
|
|
25565
25653
|
}
|
|
25566
25654
|
case "Refund_Payment_Ledger_Entry_Source": {
|
|
25567
25655
|
const refundSource = source;
|
|
25568
|
-
return /* @__PURE__ */ jsxs142(
|
|
25656
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25569
25657
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(refundSource.refunded_to_customer_amount)}` }),
|
|
25570
25658
|
/* @__PURE__ */ jsx226(
|
|
25571
25659
|
DetailsListItem,
|
|
@@ -25578,7 +25666,7 @@ var SourceDetailView = ({
|
|
|
25578
25666
|
}
|
|
25579
25667
|
case "Opening_Balance_Ledger_Entry_Source": {
|
|
25580
25668
|
const openingBalanceSource = source;
|
|
25581
|
-
return /* @__PURE__ */ jsx226(
|
|
25669
|
+
return /* @__PURE__ */ jsx226(Fragment32, { children: /* @__PURE__ */ jsx226(
|
|
25582
25670
|
DetailsListItem,
|
|
25583
25671
|
{
|
|
25584
25672
|
label: (stringOverrides == null ? void 0 : stringOverrides.accountNameLabel) || "Account name",
|
|
@@ -25588,7 +25676,7 @@ var SourceDetailView = ({
|
|
|
25588
25676
|
}
|
|
25589
25677
|
case "Payout_Ledger_Entry_Source": {
|
|
25590
25678
|
const payoutSource = source;
|
|
25591
|
-
return /* @__PURE__ */ jsxs142(
|
|
25679
|
+
return /* @__PURE__ */ jsxs142(Fragment32, { children: [
|
|
25592
25680
|
/* @__PURE__ */ jsx226(DetailsListItem, { label: (stringOverrides == null ? void 0 : stringOverrides.amountLabel) || "Amount", children: `$${centsToDollars(payoutSource.paid_out_amount)}` }),
|
|
25593
25681
|
/* @__PURE__ */ jsx226(
|
|
25594
25682
|
DetailsListItem,
|
|
@@ -25607,7 +25695,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
25607
25695
|
stringOverrides
|
|
25608
25696
|
}) => {
|
|
25609
25697
|
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 } =
|
|
25698
|
+
const { entryData, isLoadingEntry, closeSelectedEntry, errorEntry } = useContext41(LedgerAccountsContext);
|
|
25611
25699
|
const { totalDebit, totalCredit } = useMemo34(() => {
|
|
25612
25700
|
var _a2;
|
|
25613
25701
|
let totalDebit2 = 0;
|
|
@@ -25754,7 +25842,7 @@ var LedgerAccountEntryDetails = ({
|
|
|
25754
25842
|
};
|
|
25755
25843
|
|
|
25756
25844
|
// src/components/LedgerAccount/LedgerAccountRow.tsx
|
|
25757
|
-
import { useContext as
|
|
25845
|
+
import { useContext as useContext42, useEffect as useEffect37, useState as useState54 } from "react";
|
|
25758
25846
|
import classNames67 from "classnames";
|
|
25759
25847
|
import { parseISO as parseISO14, format as formatTime11 } from "date-fns";
|
|
25760
25848
|
import { jsx as jsx227, jsxs as jsxs143 } from "react/jsx-runtime";
|
|
@@ -25765,8 +25853,8 @@ var LedgerAccountRow = ({
|
|
|
25765
25853
|
view
|
|
25766
25854
|
}) => {
|
|
25767
25855
|
var _a, _b, _c, _d, _e, _f;
|
|
25768
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } =
|
|
25769
|
-
const [showComponent, setShowComponent] =
|
|
25856
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext42(LedgerAccountsContext);
|
|
25857
|
+
const [showComponent, setShowComponent] = useState54(false);
|
|
25770
25858
|
useEffect37(() => {
|
|
25771
25859
|
if (initialLoad) {
|
|
25772
25860
|
const timeoutId = setTimeout(() => {
|
|
@@ -25903,7 +25991,7 @@ var LedgerAccountRow = ({
|
|
|
25903
25991
|
|
|
25904
25992
|
// src/components/LedgerAccount/LedgerAccountIndex.tsx
|
|
25905
25993
|
import classNames68 from "classnames";
|
|
25906
|
-
import { Fragment as
|
|
25994
|
+
import { Fragment as Fragment33, jsx as jsx228, jsxs as jsxs144 } from "react/jsx-runtime";
|
|
25907
25995
|
var LedgerAccount = ({
|
|
25908
25996
|
containerRef,
|
|
25909
25997
|
pageSize = 15,
|
|
@@ -25911,9 +25999,9 @@ var LedgerAccount = ({
|
|
|
25911
25999
|
stringOverrides
|
|
25912
26000
|
}) => {
|
|
25913
26001
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
25914
|
-
const [currentPage, setCurrentPage] =
|
|
25915
|
-
const [initialLoad, setInitialLoad] =
|
|
25916
|
-
const { data: accountData } =
|
|
26002
|
+
const [currentPage, setCurrentPage] = useState55(1);
|
|
26003
|
+
const [initialLoad, setInitialLoad] = useState55(true);
|
|
26004
|
+
const { data: accountData } = useContext43(ChartOfAccountsContext);
|
|
25917
26005
|
const {
|
|
25918
26006
|
data: rawData,
|
|
25919
26007
|
error,
|
|
@@ -25924,7 +26012,7 @@ var LedgerAccount = ({
|
|
|
25924
26012
|
selectedEntryId,
|
|
25925
26013
|
closeSelectedEntry,
|
|
25926
26014
|
refetch
|
|
25927
|
-
} =
|
|
26015
|
+
} = useContext43(LedgerAccountsContext);
|
|
25928
26016
|
useEffect38(() => {
|
|
25929
26017
|
if (!isLoading) {
|
|
25930
26018
|
const timeoutLoad = setTimeout(() => {
|
|
@@ -26002,12 +26090,12 @@ var LedgerAccount = ({
|
|
|
26002
26090
|
/* @__PURE__ */ jsxs144("table", { className: "Layer__table Layer__table--hover-effect Layer__ledger-account-table", children: [
|
|
26003
26091
|
/* @__PURE__ */ jsx228("thead", { children: /* @__PURE__ */ jsxs144("tr", { children: [
|
|
26004
26092
|
view !== "desktop" && /* @__PURE__ */ jsx228("th", {}),
|
|
26005
|
-
view === "desktop" && /* @__PURE__ */ jsxs144(
|
|
26093
|
+
view === "desktop" && /* @__PURE__ */ jsxs144(Fragment33, { children: [
|
|
26006
26094
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header", children: ((_b = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _b.dateColumnHeader) || "Date" }),
|
|
26007
26095
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header", children: ((_c = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _c.journalIdColumnHeader) || "Journal id #" }),
|
|
26008
26096
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header", children: ((_d = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _d.sourceColumnHeader) || "Source" })
|
|
26009
26097
|
] }),
|
|
26010
|
-
view !== "mobile" && /* @__PURE__ */ jsxs144(
|
|
26098
|
+
view !== "mobile" && /* @__PURE__ */ jsxs144(Fragment33, { children: [
|
|
26011
26099
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_e = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _e.debitColumnHeader) || "Debit" }),
|
|
26012
26100
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_f = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _f.creditColumnHeader) || "Credit" }),
|
|
26013
26101
|
/* @__PURE__ */ jsx228("th", { className: "Layer__table-header Layer__table-cell--amount", children: ((_g = stringOverrides == null ? void 0 : stringOverrides.ledgerEntriesTable) == null ? void 0 : _g.runningBalanceColumnHeader) || "Running balance" })
|
|
@@ -26080,7 +26168,7 @@ var ChartOfAccountsContent = ({
|
|
|
26080
26168
|
templateAccountsEditable,
|
|
26081
26169
|
showAddAccountButton
|
|
26082
26170
|
}) => {
|
|
26083
|
-
const { accountId } =
|
|
26171
|
+
const { accountId } = useContext44(LedgerAccountsContext);
|
|
26084
26172
|
const { view, containerRef } = useElementViewSize();
|
|
26085
26173
|
return /* @__PURE__ */ jsx229(Container, { name: "chart-of-accounts", ref: containerRef, asWidget, children: accountId ? /* @__PURE__ */ jsx229(
|
|
26086
26174
|
LedgerAccount,
|
|
@@ -26140,7 +26228,7 @@ var JournalContext = createContext19({
|
|
|
26140
26228
|
});
|
|
26141
26229
|
|
|
26142
26230
|
// src/hooks/useJournal/useJournal.tsx
|
|
26143
|
-
import { useEffect as useEffect39, useState as
|
|
26231
|
+
import { useEffect as useEffect39, useState as useState56 } from "react";
|
|
26144
26232
|
import useSWR16 from "swr";
|
|
26145
26233
|
var useJournal = () => {
|
|
26146
26234
|
const {
|
|
@@ -26152,11 +26240,11 @@ var useJournal = () => {
|
|
|
26152
26240
|
} = useLayerContext();
|
|
26153
26241
|
const { apiUrl } = useEnvironment();
|
|
26154
26242
|
const { data: auth } = useAuth();
|
|
26155
|
-
const [selectedEntryId, setSelectedEntryId] =
|
|
26156
|
-
const [form, setForm] =
|
|
26157
|
-
const [addingEntry, setAddingEntry] =
|
|
26158
|
-
const [sendingForm, setSendingForm] =
|
|
26159
|
-
const [apiError, setApiError] =
|
|
26243
|
+
const [selectedEntryId, setSelectedEntryId] = useState56();
|
|
26244
|
+
const [form, setForm] = useState56();
|
|
26245
|
+
const [addingEntry, setAddingEntry] = useState56(false);
|
|
26246
|
+
const [sendingForm, setSendingForm] = useState56(false);
|
|
26247
|
+
const [apiError, setApiError] = useState56(void 0);
|
|
26160
26248
|
const queryKey = businessId && (auth == null ? void 0 : auth.access_token) && `journal-lines-${businessId}`;
|
|
26161
26249
|
const { data, isLoading, isValidating, error, mutate } = useSWR16(
|
|
26162
26250
|
queryKey,
|
|
@@ -26409,13 +26497,13 @@ var useJournal = () => {
|
|
|
26409
26497
|
};
|
|
26410
26498
|
|
|
26411
26499
|
// src/components/JournalTable/JournalTableWithPanel.tsx
|
|
26412
|
-
import { useContext as
|
|
26500
|
+
import { useContext as useContext50, useMemo as useMemo38, useState as useState58 } from "react";
|
|
26413
26501
|
|
|
26414
26502
|
// src/components/JournalSidebar/JournalSidebar.tsx
|
|
26415
|
-
import { useContext as
|
|
26503
|
+
import { useContext as useContext48 } from "react";
|
|
26416
26504
|
|
|
26417
26505
|
// src/components/JournalEntryDetails/JournalEntryDetails.tsx
|
|
26418
|
-
import { useContext as
|
|
26506
|
+
import { useContext as useContext45, useMemo as useMemo36, useState as useState57 } from "react";
|
|
26419
26507
|
import { jsx as jsx230, jsxs as jsxs145 } from "react/jsx-runtime";
|
|
26420
26508
|
var JournalEntryDetails = () => {
|
|
26421
26509
|
var _a, _b, _c, _d;
|
|
@@ -26427,9 +26515,9 @@ var JournalEntryDetails = () => {
|
|
|
26427
26515
|
selectedEntryId,
|
|
26428
26516
|
reverseEntry,
|
|
26429
26517
|
refetch
|
|
26430
|
-
} =
|
|
26431
|
-
const [reverseEntryProcessing, setReverseEntryProcessing] =
|
|
26432
|
-
const [reverseEntryError, setReverseEntryError] =
|
|
26518
|
+
} = useContext45(JournalContext);
|
|
26519
|
+
const [reverseEntryProcessing, setReverseEntryProcessing] = useState57(false);
|
|
26520
|
+
const [reverseEntryError, setReverseEntryError] = useState57();
|
|
26433
26521
|
const entry = useMemo36(() => {
|
|
26434
26522
|
if (selectedEntryId && data) {
|
|
26435
26523
|
return data.find((x) => x.id === selectedEntryId);
|
|
@@ -26614,11 +26702,11 @@ var JournalEntryDetails = () => {
|
|
|
26614
26702
|
};
|
|
26615
26703
|
|
|
26616
26704
|
// src/components/JournalForm/JournalForm.tsx
|
|
26617
|
-
import { useContext as
|
|
26705
|
+
import { useContext as useContext47 } from "react";
|
|
26618
26706
|
|
|
26619
26707
|
// src/components/JournalForm/JournalFormEntryLines.tsx
|
|
26620
|
-
import { useContext as
|
|
26621
|
-
import { Fragment as
|
|
26708
|
+
import { useContext as useContext46, useMemo as useMemo37 } from "react";
|
|
26709
|
+
import { Fragment as Fragment34, jsx as jsx231, jsxs as jsxs146 } from "react/jsx-runtime";
|
|
26622
26710
|
function recursiveFlattenCategories(accounts) {
|
|
26623
26711
|
const flattenedResult = accounts.flatMap((a) => {
|
|
26624
26712
|
var _a;
|
|
@@ -26638,7 +26726,7 @@ var JournalFormEntryLines = ({
|
|
|
26638
26726
|
config
|
|
26639
26727
|
}) => {
|
|
26640
26728
|
const { data: categories } = useCategories({ mode: "ALL" });
|
|
26641
|
-
const { form } =
|
|
26729
|
+
const { form } = useContext46(JournalContext);
|
|
26642
26730
|
const { flattenedCategories, parentOptions } = useMemo37(() => {
|
|
26643
26731
|
const flattenedCategories2 = recursiveFlattenCategories(categories != null ? categories : []);
|
|
26644
26732
|
const parentOptions2 = [...flattenedCategories2].sort((a, b) => a.display_name.localeCompare(b.display_name)).map((account) => {
|
|
@@ -26719,7 +26807,7 @@ var JournalFormEntryLines = ({
|
|
|
26719
26807
|
]
|
|
26720
26808
|
);
|
|
26721
26809
|
};
|
|
26722
|
-
return /* @__PURE__ */ jsx231(
|
|
26810
|
+
return /* @__PURE__ */ jsx231(Fragment34, { children: ["DEBIT", "CREDIT"].map((direction, idx) => {
|
|
26723
26811
|
return /* @__PURE__ */ jsxs146(
|
|
26724
26812
|
"div",
|
|
26725
26813
|
{
|
|
@@ -26851,7 +26939,7 @@ var JournalForm = ({
|
|
|
26851
26939
|
changeFormData,
|
|
26852
26940
|
addEntryLine,
|
|
26853
26941
|
removeEntryLine
|
|
26854
|
-
} =
|
|
26942
|
+
} = useContext47(JournalContext);
|
|
26855
26943
|
return /* @__PURE__ */ jsxs147(
|
|
26856
26944
|
"form",
|
|
26857
26945
|
{
|
|
@@ -26999,7 +27087,7 @@ var JournalSidebar = ({
|
|
|
26999
27087
|
config,
|
|
27000
27088
|
stringOverrides
|
|
27001
27089
|
}) => {
|
|
27002
|
-
const { selectedEntryId } =
|
|
27090
|
+
const { selectedEntryId } = useContext48(JournalContext);
|
|
27003
27091
|
if (selectedEntryId !== "new") {
|
|
27004
27092
|
return /* @__PURE__ */ jsx233(JournalEntryDetails, {});
|
|
27005
27093
|
}
|
|
@@ -27007,7 +27095,7 @@ var JournalSidebar = ({
|
|
|
27007
27095
|
};
|
|
27008
27096
|
|
|
27009
27097
|
// src/components/JournalTable/JournalTable.tsx
|
|
27010
|
-
import { Fragment as
|
|
27098
|
+
import { Fragment as Fragment35, useContext as useContext49, useEffect as useEffect40 } from "react";
|
|
27011
27099
|
import { parseISO as parseISO15, format as formatTime12 } from "date-fns";
|
|
27012
27100
|
import { jsx as jsx234, jsxs as jsxs148 } from "react/jsx-runtime";
|
|
27013
27101
|
var accountName = (row) => {
|
|
@@ -27035,7 +27123,7 @@ var JournalTableContent = ({
|
|
|
27035
27123
|
data,
|
|
27036
27124
|
stringOverrides
|
|
27037
27125
|
}) => {
|
|
27038
|
-
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } =
|
|
27126
|
+
const { selectedEntryId, setSelectedEntryId, closeSelectedEntry } = useContext49(JournalContext);
|
|
27039
27127
|
const { isOpen, setIsOpen } = useTableExpandRow();
|
|
27040
27128
|
useEffect40(() => {
|
|
27041
27129
|
if (data.length > 0) {
|
|
@@ -27045,7 +27133,7 @@ var JournalTableContent = ({
|
|
|
27045
27133
|
const renderJournalRow = (row, index, rowKey, depth) => {
|
|
27046
27134
|
const expandable = !!row.line_items && row.line_items.length > 0;
|
|
27047
27135
|
const expanded = expandable ? isOpen(rowKey) : true;
|
|
27048
|
-
return /* @__PURE__ */ jsxs148(
|
|
27136
|
+
return /* @__PURE__ */ jsxs148(Fragment35, { children: [
|
|
27049
27137
|
/* @__PURE__ */ jsxs148(
|
|
27050
27138
|
TableRow,
|
|
27051
27139
|
{
|
|
@@ -27181,7 +27269,7 @@ function useJournalEntriesDownload({
|
|
|
27181
27269
|
}
|
|
27182
27270
|
|
|
27183
27271
|
// src/components/Journal/download/JournalEntriesDownloadButton.tsx
|
|
27184
|
-
import { Fragment as
|
|
27272
|
+
import { Fragment as Fragment36, jsx as jsx235, jsxs as jsxs149 } from "react/jsx-runtime";
|
|
27185
27273
|
function JournalEntriesDownloadButton({
|
|
27186
27274
|
startCutoff,
|
|
27187
27275
|
endCutoff,
|
|
@@ -27193,7 +27281,7 @@ function JournalEntriesDownloadButton({
|
|
|
27193
27281
|
endCutoff,
|
|
27194
27282
|
onSuccess: ({ presignedUrl }) => triggerInvisibleDownload({ url: presignedUrl })
|
|
27195
27283
|
});
|
|
27196
|
-
return /* @__PURE__ */ jsxs149(
|
|
27284
|
+
return /* @__PURE__ */ jsxs149(Fragment36, { children: [
|
|
27197
27285
|
/* @__PURE__ */ jsx235(
|
|
27198
27286
|
DownloadButton,
|
|
27199
27287
|
{
|
|
@@ -27221,7 +27309,7 @@ var JournalTableWithPanel = ({
|
|
|
27221
27309
|
stringOverrides,
|
|
27222
27310
|
view
|
|
27223
27311
|
}) => {
|
|
27224
|
-
const [currentPage, setCurrentPage] =
|
|
27312
|
+
const [currentPage, setCurrentPage] = useState58(1);
|
|
27225
27313
|
const {
|
|
27226
27314
|
data: rawData,
|
|
27227
27315
|
isLoading,
|
|
@@ -27230,7 +27318,7 @@ var JournalTableWithPanel = ({
|
|
|
27230
27318
|
refetch,
|
|
27231
27319
|
selectedEntryId,
|
|
27232
27320
|
addEntry
|
|
27233
|
-
} =
|
|
27321
|
+
} = useContext50(JournalContext);
|
|
27234
27322
|
const data = useMemo38(() => {
|
|
27235
27323
|
var _a;
|
|
27236
27324
|
const firstPageIndex = (currentPage - 1) * pageSize;
|
|
@@ -27427,7 +27515,7 @@ var SmileIcon = (_a) => {
|
|
|
27427
27515
|
var SmileIcon_default = SmileIcon;
|
|
27428
27516
|
|
|
27429
27517
|
// src/components/Tasks/TasksListItem.tsx
|
|
27430
|
-
import { useEffect as useEffect41, useMemo as useMemo39, useState as
|
|
27518
|
+
import { useEffect as useEffect41, useMemo as useMemo39, useState as useState59 } from "react";
|
|
27431
27519
|
import classNames69 from "classnames";
|
|
27432
27520
|
|
|
27433
27521
|
// src/utils/bookkeeping/tasks/getBookkeepingTaskStatusIcon.tsx
|
|
@@ -27485,7 +27573,7 @@ function completeTaskWithUpload(baseUrl, accessToken, {
|
|
|
27485
27573
|
}
|
|
27486
27574
|
|
|
27487
27575
|
// src/hooks/bookkeeping/periods/tasks/useSubmitResponseForTask.ts
|
|
27488
|
-
import { useCallback as
|
|
27576
|
+
import { useCallback as useCallback15 } from "react";
|
|
27489
27577
|
function buildKey21({
|
|
27490
27578
|
access_token: accessToken,
|
|
27491
27579
|
apiUrl,
|
|
@@ -27528,7 +27616,7 @@ function useSubmitUserResponseForTask() {
|
|
|
27528
27616
|
}
|
|
27529
27617
|
);
|
|
27530
27618
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27531
|
-
const stableProxiedTrigger =
|
|
27619
|
+
const stableProxiedTrigger = useCallback15(
|
|
27532
27620
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27533
27621
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27534
27622
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27555,7 +27643,7 @@ function useSubmitUserResponseForTask() {
|
|
|
27555
27643
|
// src/hooks/bookkeeping/periods/tasks/useUploadDocumentsForTask.ts
|
|
27556
27644
|
import { useSWRConfig as useSWRConfig6 } from "swr";
|
|
27557
27645
|
import useSWRMutation13 from "swr/mutation";
|
|
27558
|
-
import { useCallback as
|
|
27646
|
+
import { useCallback as useCallback16 } from "react";
|
|
27559
27647
|
function buildKey22({
|
|
27560
27648
|
access_token: accessToken,
|
|
27561
27649
|
apiUrl,
|
|
@@ -27594,7 +27682,7 @@ function useUploadDocumentsForTask() {
|
|
|
27594
27682
|
}
|
|
27595
27683
|
);
|
|
27596
27684
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27597
|
-
const stableProxiedTrigger =
|
|
27685
|
+
const stableProxiedTrigger = useCallback16(
|
|
27598
27686
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27599
27687
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27600
27688
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27621,7 +27709,7 @@ function useUploadDocumentsForTask() {
|
|
|
27621
27709
|
// src/hooks/bookkeeping/periods/tasks/useDeleteUploadsOnTask.ts
|
|
27622
27710
|
import { useSWRConfig as useSWRConfig7 } from "swr";
|
|
27623
27711
|
import useSWRMutation14 from "swr/mutation";
|
|
27624
|
-
import { useCallback as
|
|
27712
|
+
import { useCallback as useCallback17 } from "react";
|
|
27625
27713
|
function buildKey23({
|
|
27626
27714
|
access_token: accessToken,
|
|
27627
27715
|
apiUrl,
|
|
@@ -27657,7 +27745,7 @@ function useDeleteUploadsOnTask() {
|
|
|
27657
27745
|
}
|
|
27658
27746
|
);
|
|
27659
27747
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27660
|
-
const stableProxiedTrigger =
|
|
27748
|
+
const stableProxiedTrigger = useCallback17(
|
|
27661
27749
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27662
27750
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27663
27751
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27684,7 +27772,7 @@ function useDeleteUploadsOnTask() {
|
|
|
27684
27772
|
// src/hooks/bookkeeping/periods/tasks/useUpdateTaskUploadDescription.ts
|
|
27685
27773
|
import { useSWRConfig as useSWRConfig8 } from "swr";
|
|
27686
27774
|
import useSWRMutation15 from "swr/mutation";
|
|
27687
|
-
import { useCallback as
|
|
27775
|
+
import { useCallback as useCallback18 } from "react";
|
|
27688
27776
|
function buildKey24({
|
|
27689
27777
|
access_token: accessToken,
|
|
27690
27778
|
apiUrl,
|
|
@@ -27724,7 +27812,7 @@ function useUpdateTaskUploadDescription() {
|
|
|
27724
27812
|
}
|
|
27725
27813
|
);
|
|
27726
27814
|
const { trigger: originalTrigger } = mutationResponse;
|
|
27727
|
-
const stableProxiedTrigger =
|
|
27815
|
+
const stableProxiedTrigger = useCallback18(
|
|
27728
27816
|
(...triggerParameters) => __async(null, null, function* () {
|
|
27729
27817
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
27730
27818
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -27749,15 +27837,15 @@ function useUpdateTaskUploadDescription() {
|
|
|
27749
27837
|
}
|
|
27750
27838
|
|
|
27751
27839
|
// src/components/Tasks/TasksListItem.tsx
|
|
27752
|
-
import { Fragment as
|
|
27840
|
+
import { Fragment as Fragment37, jsx as jsx241, jsxs as jsxs152 } from "react/jsx-runtime";
|
|
27753
27841
|
var TasksListItem = ({
|
|
27754
27842
|
task,
|
|
27755
27843
|
defaultOpen
|
|
27756
27844
|
}) => {
|
|
27757
27845
|
var _a, _b;
|
|
27758
|
-
const [isOpen, setIsOpen] =
|
|
27759
|
-
const [userResponse, setUserResponse] =
|
|
27760
|
-
const [selectedFiles, setSelectedFiles] =
|
|
27846
|
+
const [isOpen, setIsOpen] = useState59(defaultOpen);
|
|
27847
|
+
const [userResponse, setUserResponse] = useState59((_a = task.user_response) != null ? _a : "");
|
|
27848
|
+
const [selectedFiles, setSelectedFiles] = useState59();
|
|
27761
27849
|
const { trigger: handleSubmitUserResponseForTask } = useSubmitUserResponseForTask();
|
|
27762
27850
|
const { trigger: handleUploadDocumentsForTask } = useUploadDocumentsForTask();
|
|
27763
27851
|
const { trigger: handleDeleteUploadsOnTask } = useDeleteUploadsOnTask();
|
|
@@ -27805,7 +27893,7 @@ var TasksListItem = ({
|
|
|
27805
27893
|
}
|
|
27806
27894
|
);
|
|
27807
27895
|
} else {
|
|
27808
|
-
return /* @__PURE__ */ jsxs152(
|
|
27896
|
+
return /* @__PURE__ */ jsxs152(Fragment37, { children: [
|
|
27809
27897
|
/* @__PURE__ */ jsx241(
|
|
27810
27898
|
Button,
|
|
27811
27899
|
{
|
|
@@ -27935,7 +28023,7 @@ var MobilePanel = ({ header, children, open: open2, onClose, className }) => {
|
|
|
27935
28023
|
};
|
|
27936
28024
|
|
|
27937
28025
|
// src/components/Tasks/TasksListMobile.tsx
|
|
27938
|
-
import { useState as
|
|
28026
|
+
import { useState as useState60 } from "react";
|
|
27939
28027
|
import { jsx as jsx243, jsxs as jsxs154 } from "react/jsx-runtime";
|
|
27940
28028
|
var MOBILE_SHOW_UNRESOLVED_TASKS_COUNT = 2;
|
|
27941
28029
|
var TasksListMobile = ({
|
|
@@ -27946,7 +28034,7 @@ var TasksListMobile = ({
|
|
|
27946
28034
|
pageSize,
|
|
27947
28035
|
setCurrentPage
|
|
27948
28036
|
}) => {
|
|
27949
|
-
const [showMobilePanel, setShowMobilePanel] =
|
|
28037
|
+
const [showMobilePanel, setShowMobilePanel] = useState60(false);
|
|
27950
28038
|
const unresolvedTasks = getIncompleteTasks(sortedTasks).slice(0, MOBILE_SHOW_UNRESOLVED_TASKS_COUNT);
|
|
27951
28039
|
return /* @__PURE__ */ jsxs154("div", { className: "Layer__tasks-list", children: [
|
|
27952
28040
|
unresolvedTasks.map((task, index) => /* @__PURE__ */ jsx243(
|
|
@@ -27994,9 +28082,9 @@ var TasksListMobile = ({
|
|
|
27994
28082
|
};
|
|
27995
28083
|
|
|
27996
28084
|
// src/hooks/array/usePaginatedList.ts
|
|
27997
|
-
import { useCallback as
|
|
28085
|
+
import { useCallback as useCallback19, useMemo as useMemo40, useState as useState61 } from "react";
|
|
27998
28086
|
function usePaginatedList(list, pageSize) {
|
|
27999
|
-
const [internalPageIndex, setInternalPageIndex] =
|
|
28087
|
+
const [internalPageIndex, setInternalPageIndex] = useState61(0);
|
|
28000
28088
|
const pageCount = Math.max(0, Math.ceil(list.length / pageSize));
|
|
28001
28089
|
const effectivePageIndex = Math.max(0, Math.min(internalPageIndex, pageCount - 1));
|
|
28002
28090
|
const pageItems = useMemo40(() => {
|
|
@@ -28005,16 +28093,16 @@ function usePaginatedList(list, pageSize) {
|
|
|
28005
28093
|
(effectivePageIndex + 1) * pageSize
|
|
28006
28094
|
);
|
|
28007
28095
|
}, [list, effectivePageIndex, pageSize]);
|
|
28008
|
-
const next =
|
|
28096
|
+
const next = useCallback19(() => {
|
|
28009
28097
|
setInternalPageIndex(Math.min(effectivePageIndex + 1, pageCount - 1));
|
|
28010
28098
|
}, [effectivePageIndex, pageCount]);
|
|
28011
|
-
const set2 =
|
|
28099
|
+
const set2 = useCallback19((pageIndex) => {
|
|
28012
28100
|
setInternalPageIndex(Math.max(0, Math.min(pageIndex, pageCount - 1)));
|
|
28013
28101
|
}, [pageCount]);
|
|
28014
|
-
const previous =
|
|
28102
|
+
const previous = useCallback19(() => {
|
|
28015
28103
|
setInternalPageIndex(Math.max(effectivePageIndex - 1, 0));
|
|
28016
28104
|
}, [effectivePageIndex]);
|
|
28017
|
-
const reset =
|
|
28105
|
+
const reset = useCallback19(() => {
|
|
28018
28106
|
setInternalPageIndex(0);
|
|
28019
28107
|
}, []);
|
|
28020
28108
|
return {
|
|
@@ -28030,7 +28118,7 @@ function usePaginatedList(list, pageSize) {
|
|
|
28030
28118
|
}
|
|
28031
28119
|
|
|
28032
28120
|
// src/components/Tasks/TasksList.tsx
|
|
28033
|
-
import { Fragment as
|
|
28121
|
+
import { Fragment as Fragment38, jsx as jsx244, jsxs as jsxs155 } from "react/jsx-runtime";
|
|
28034
28122
|
var TasksEmptyState = () => /* @__PURE__ */ jsxs155("div", { className: "Layer__tasks-empty-state", children: [
|
|
28035
28123
|
/* @__PURE__ */ jsx244("div", { className: "Layer__tasks-icon", children: /* @__PURE__ */ jsx244(SmileIcon_default, {}) }),
|
|
28036
28124
|
/* @__PURE__ */ jsxs155(Text, { size: "sm" /* sm */, children: [
|
|
@@ -28070,7 +28158,7 @@ function TasksList({ pageSize = 8, mobile }) {
|
|
|
28070
28158
|
}
|
|
28071
28159
|
);
|
|
28072
28160
|
}
|
|
28073
|
-
return /* @__PURE__ */ jsx244("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs155(
|
|
28161
|
+
return /* @__PURE__ */ jsx244("div", { className: "Layer__tasks-list", children: sortedTasks && sortedTasks.length > 0 ? /* @__PURE__ */ jsxs155(Fragment38, { children: [
|
|
28074
28162
|
pageItems.map((task, index) => /* @__PURE__ */ jsx244(
|
|
28075
28163
|
TasksListItem,
|
|
28076
28164
|
{
|
|
@@ -28093,7 +28181,7 @@ function TasksList({ pageSize = 8, mobile }) {
|
|
|
28093
28181
|
|
|
28094
28182
|
// src/components/Tasks/TasksPending.tsx
|
|
28095
28183
|
import { Cell as Cell4, Pie as Pie3, PieChart as PieChart4 } from "recharts";
|
|
28096
|
-
import { format as
|
|
28184
|
+
import { format as format6 } from "date-fns";
|
|
28097
28185
|
import classNames71 from "classnames";
|
|
28098
28186
|
|
|
28099
28187
|
// src/components/BookkeepingStatus/BookkeepingStatusDescription.tsx
|
|
@@ -28107,7 +28195,7 @@ var BookkeepingStatusDescription = ({ monthNumber, status, incompleteTasksCount
|
|
|
28107
28195
|
};
|
|
28108
28196
|
|
|
28109
28197
|
// src/components/Tasks/TasksPending.tsx
|
|
28110
|
-
import { Fragment as
|
|
28198
|
+
import { Fragment as Fragment39, jsx as jsx246, jsxs as jsxs156 } from "react/jsx-runtime";
|
|
28111
28199
|
var TasksPending = () => {
|
|
28112
28200
|
var _a, _b, _c, _d;
|
|
28113
28201
|
const { date } = useGlobalDate();
|
|
@@ -28130,7 +28218,7 @@ var TasksPending = () => {
|
|
|
28130
28218
|
);
|
|
28131
28219
|
return /* @__PURE__ */ jsxs156("div", { className: "Layer__tasks-pending", children: [
|
|
28132
28220
|
/* @__PURE__ */ jsxs156("div", { className: "Layer__tasks-pending-header", children: [
|
|
28133
|
-
/* @__PURE__ */ jsx246(Heading, { size: "secondary" /* secondary */, children:
|
|
28221
|
+
/* @__PURE__ */ jsx246(Heading, { size: "secondary" /* secondary */, children: format6(date, "MMMM yyyy") }),
|
|
28134
28222
|
(activePeriod == null ? void 0 : activePeriod.tasks) && activePeriod.tasks.length > 0 ? /* @__PURE__ */ jsxs156("div", { className: "Layer__tasks-pending-bar", children: [
|
|
28135
28223
|
/* @__PURE__ */ jsxs156(Text, { size: "sm" /* sm */, children: [
|
|
28136
28224
|
/* @__PURE__ */ jsx246("span", { className: taskStatusClassName, children: completedTaskCount }),
|
|
@@ -28169,8 +28257,8 @@ var TasksPending = () => {
|
|
|
28169
28257
|
) })
|
|
28170
28258
|
] }) : null
|
|
28171
28259
|
] }),
|
|
28172
|
-
/* @__PURE__ */ jsx246("div", { className: "Layer__tasks-pending-main", children: activePeriod && /* @__PURE__ */ jsxs156(
|
|
28173
|
-
/* @__PURE__ */ jsx246(
|
|
28260
|
+
/* @__PURE__ */ jsx246("div", { className: "Layer__tasks-pending-main", children: activePeriod && /* @__PURE__ */ jsxs156(Fragment39, { children: [
|
|
28261
|
+
/* @__PURE__ */ jsx246(BookkeepingStatus2, { status: activePeriod.status, monthNumber: activePeriod.month }),
|
|
28174
28262
|
/* @__PURE__ */ jsx246(
|
|
28175
28263
|
BookkeepingStatusDescription,
|
|
28176
28264
|
{
|
|
@@ -28185,16 +28273,16 @@ var TasksPending = () => {
|
|
|
28185
28273
|
|
|
28186
28274
|
// src/components/Tasks/TasksMonthSelector.tsx
|
|
28187
28275
|
import { useMemo as useMemo42 } from "react";
|
|
28188
|
-
import { format as
|
|
28276
|
+
import { format as format7, getMonth as getMonth3, getYear as getYear4, set } from "date-fns";
|
|
28189
28277
|
|
|
28190
28278
|
// src/components/Tasks/TaskStatusBadge.tsx
|
|
28191
28279
|
import pluralize2 from "pluralize";
|
|
28192
28280
|
import { jsx as jsx247, jsxs as jsxs157 } from "react/jsx-runtime";
|
|
28193
28281
|
var buildBadgeConfig = (status, tasksCount) => {
|
|
28194
28282
|
switch (status) {
|
|
28195
|
-
case "IN_PROGRESS_AWAITING_BOOKKEEPER"
|
|
28196
|
-
case "NOT_STARTED"
|
|
28197
|
-
case "CLOSING_IN_REVIEW"
|
|
28283
|
+
case "IN_PROGRESS_AWAITING_BOOKKEEPER" /* IN_PROGRESS_AWAITING_BOOKKEEPER */:
|
|
28284
|
+
case "NOT_STARTED" /* NOT_STARTED */:
|
|
28285
|
+
case "CLOSING_IN_REVIEW" /* CLOSING_IN_REVIEW */: {
|
|
28198
28286
|
return {
|
|
28199
28287
|
color: "info",
|
|
28200
28288
|
icon: /* @__PURE__ */ jsx247(Clock_default, { size: 12 }),
|
|
@@ -28202,8 +28290,8 @@ var buildBadgeConfig = (status, tasksCount) => {
|
|
|
28202
28290
|
labelShort: tasksCount ? `${tasksCount}` : void 0
|
|
28203
28291
|
};
|
|
28204
28292
|
}
|
|
28205
|
-
case "IN_PROGRESS_AWAITING_CUSTOMER"
|
|
28206
|
-
case "CLOSED_OPEN_TASKS"
|
|
28293
|
+
case "IN_PROGRESS_AWAITING_CUSTOMER" /* IN_PROGRESS_AWAITING_CUSTOMER */:
|
|
28294
|
+
case "CLOSED_OPEN_TASKS" /* CLOSED_OPEN_TASKS */: {
|
|
28207
28295
|
return {
|
|
28208
28296
|
color: "warning",
|
|
28209
28297
|
label: tasksCount ? pluralize2("task", tasksCount, true) : void 0,
|
|
@@ -28211,13 +28299,13 @@ var buildBadgeConfig = (status, tasksCount) => {
|
|
|
28211
28299
|
icon: /* @__PURE__ */ jsx247(AlertCircle_default, { size: 12 })
|
|
28212
28300
|
};
|
|
28213
28301
|
}
|
|
28214
|
-
case "CLOSED_COMPLETE"
|
|
28302
|
+
case "CLOSED_COMPLETE" /* CLOSED_COMPLETE */: {
|
|
28215
28303
|
return {
|
|
28216
28304
|
color: "success",
|
|
28217
28305
|
icon: /* @__PURE__ */ jsx247(CheckCircle_default, { size: 12 })
|
|
28218
28306
|
};
|
|
28219
28307
|
}
|
|
28220
|
-
case "BOOKKEEPING_NOT_ACTIVE"
|
|
28308
|
+
case "BOOKKEEPING_NOT_ACTIVE" /* BOOKKEEPING_NOT_ACTIVE */: {
|
|
28221
28309
|
return;
|
|
28222
28310
|
}
|
|
28223
28311
|
default: {
|
|
@@ -28311,12 +28399,12 @@ function TasksMonthSelector() {
|
|
|
28311
28399
|
year: activeYear,
|
|
28312
28400
|
month: index + 1,
|
|
28313
28401
|
tasks: [],
|
|
28314
|
-
status: "BOOKKEEPING_NOT_ACTIVE"
|
|
28402
|
+
status: "BOOKKEEPING_NOT_ACTIVE" /* BOOKKEEPING_NOT_ACTIVE */,
|
|
28315
28403
|
disabled: true
|
|
28316
28404
|
};
|
|
28317
28405
|
const total = (_b = (_a = taskData.tasks) == null ? void 0 : _a.length) != null ? _b : 0;
|
|
28318
28406
|
return __spreadValues({
|
|
28319
|
-
monthStr:
|
|
28407
|
+
monthStr: format7(date2, "MMM"),
|
|
28320
28408
|
date: date2,
|
|
28321
28409
|
completed: getCompletedTasks(taskData.tasks).length,
|
|
28322
28410
|
total
|
|
@@ -28514,7 +28602,7 @@ var TasksPanelNotification = ({
|
|
|
28514
28602
|
import { useMemo as useMemo44 } from "react";
|
|
28515
28603
|
|
|
28516
28604
|
// src/components/Tabs/Tabs.tsx
|
|
28517
|
-
import { useEffect as useEffect42, useState as
|
|
28605
|
+
import { useEffect as useEffect42, useState as useState62 } from "react";
|
|
28518
28606
|
|
|
28519
28607
|
// src/components/Tabs/Tab.tsx
|
|
28520
28608
|
import { jsx as jsx252, jsxs as jsxs161 } from "react/jsx-runtime";
|
|
@@ -28581,9 +28669,9 @@ import { jsx as jsx253, jsxs as jsxs162 } from "react/jsx-runtime";
|
|
|
28581
28669
|
import { createElement as createElement2 } from "react";
|
|
28582
28670
|
var STARTING_PADDING = 12;
|
|
28583
28671
|
var Tabs = ({ name, options, selected, onChange }) => {
|
|
28584
|
-
const [initialized, setInitialized] =
|
|
28585
|
-
const [thumbPos, setThumbPos] =
|
|
28586
|
-
const [currentWidth, setCurrentWidth] =
|
|
28672
|
+
const [initialized, setInitialized] = useState62(false);
|
|
28673
|
+
const [thumbPos, setThumbPos] = useState62({ left: 0, width: 0 });
|
|
28674
|
+
const [currentWidth, setCurrentWidth] = useState62(0);
|
|
28587
28675
|
const selectedValue = selected || options[0].value;
|
|
28588
28676
|
const baseClassName = classNames72(
|
|
28589
28677
|
"Layer__tabs",
|
|
@@ -28681,7 +28769,7 @@ var TasksYearsTabs = () => {
|
|
|
28681
28769
|
badge: !y.completed && y.unresolvedTasks ? /* @__PURE__ */ jsx254(
|
|
28682
28770
|
TaskStatusBadge,
|
|
28683
28771
|
{
|
|
28684
|
-
status: y.unresolvedTasks ? "IN_PROGRESS_AWAITING_CUSTOMER" : "CLOSED_COMPLETE"
|
|
28772
|
+
status: y.unresolvedTasks ? "IN_PROGRESS_AWAITING_CUSTOMER" /* IN_PROGRESS_AWAITING_CUSTOMER */ : "CLOSED_COMPLETE" /* CLOSED_COMPLETE */,
|
|
28685
28773
|
tasksCount: y.unresolvedTasks
|
|
28686
28774
|
}
|
|
28687
28775
|
) : null
|
|
@@ -28729,7 +28817,7 @@ function TasksEmptyContainer({ children }) {
|
|
|
28729
28817
|
}
|
|
28730
28818
|
|
|
28731
28819
|
// src/components/Tasks/Tasks.tsx
|
|
28732
|
-
import { Fragment as
|
|
28820
|
+
import { Fragment as Fragment40, jsx as jsx256, jsxs as jsxs163 } from "react/jsx-runtime";
|
|
28733
28821
|
function Tasks({
|
|
28734
28822
|
mobile = false,
|
|
28735
28823
|
tasksHeader,
|
|
@@ -28762,7 +28850,7 @@ function Tasks({
|
|
|
28762
28850
|
/* @__PURE__ */ jsx256(Heading2, { size: "xs", level: 4, children: "Not Enrolled in Bookkeeping" }),
|
|
28763
28851
|
/* @__PURE__ */ jsx256(P, { children: "If you believe this is an error, please contact support." })
|
|
28764
28852
|
] }) }),
|
|
28765
|
-
children: () => /* @__PURE__ */ jsxs163(
|
|
28853
|
+
children: () => /* @__PURE__ */ jsxs163(Fragment40, { children: [
|
|
28766
28854
|
/* @__PURE__ */ jsx256(TasksYearsTabs, {}),
|
|
28767
28855
|
/* @__PURE__ */ jsx256(TasksMonthSelector, {}),
|
|
28768
28856
|
/* @__PURE__ */ jsx256(TasksPending, {}),
|
|
@@ -28776,20 +28864,20 @@ function Tasks({
|
|
|
28776
28864
|
}
|
|
28777
28865
|
|
|
28778
28866
|
// src/components/PlatformOnboarding/LinkAccounts.tsx
|
|
28779
|
-
import { useContext as
|
|
28867
|
+
import { useContext as useContext54 } from "react";
|
|
28780
28868
|
|
|
28781
28869
|
// src/components/PlatformOnboarding/Steps/LinkAccountsConfirmationStep.tsx
|
|
28782
|
-
import { useContext as
|
|
28870
|
+
import { useContext as useContext52 } from "react";
|
|
28783
28871
|
import { useForm as useForm2 } from "@tanstack/react-form";
|
|
28784
28872
|
|
|
28785
28873
|
// src/components/Wizard/Wizard.tsx
|
|
28786
28874
|
import {
|
|
28787
28875
|
Children,
|
|
28788
28876
|
createContext as createContext20,
|
|
28789
|
-
useCallback as
|
|
28790
|
-
useContext as
|
|
28877
|
+
useCallback as useCallback20,
|
|
28878
|
+
useContext as useContext51,
|
|
28791
28879
|
useMemo as useMemo45,
|
|
28792
|
-
useState as
|
|
28880
|
+
useState as useState63
|
|
28793
28881
|
} from "react";
|
|
28794
28882
|
import { jsxs as jsxs164 } from "react/jsx-runtime";
|
|
28795
28883
|
function useWizardStep({
|
|
@@ -28797,14 +28885,14 @@ function useWizardStep({
|
|
|
28797
28885
|
onComplete
|
|
28798
28886
|
}) {
|
|
28799
28887
|
const stepCount = steps.length;
|
|
28800
|
-
const [activeStepIndex, setActiveStepIndex] =
|
|
28801
|
-
const next =
|
|
28888
|
+
const [activeStepIndex, setActiveStepIndex] = useState63(0);
|
|
28889
|
+
const next = useCallback20(() => __async(null, null, function* () {
|
|
28802
28890
|
setActiveStepIndex((stepIndex) => Math.min(stepIndex + 1, stepCount - 1));
|
|
28803
28891
|
if (activeStepIndex === stepCount - 1 && onComplete) {
|
|
28804
28892
|
yield onComplete == null ? void 0 : onComplete();
|
|
28805
28893
|
}
|
|
28806
28894
|
}), [stepCount, activeStepIndex, onComplete]);
|
|
28807
|
-
const previous =
|
|
28895
|
+
const previous = useCallback20(() => setActiveStepIndex((stepIndex) => Math.max(stepIndex - 1, 0)), []);
|
|
28808
28896
|
const effectiveStepIndex = Math.min(activeStepIndex, stepCount - 1);
|
|
28809
28897
|
const currentStep = steps.at(effectiveStepIndex);
|
|
28810
28898
|
return { currentStep, next, previous };
|
|
@@ -28816,7 +28904,7 @@ var WizardContext = createContext20({
|
|
|
28816
28904
|
}
|
|
28817
28905
|
});
|
|
28818
28906
|
function useWizard() {
|
|
28819
|
-
return
|
|
28907
|
+
return useContext51(WizardContext);
|
|
28820
28908
|
}
|
|
28821
28909
|
function Wizard({
|
|
28822
28910
|
Header: Header4,
|
|
@@ -28870,7 +28958,7 @@ function LinkAccountsConfirmationStep() {
|
|
|
28870
28958
|
data: linkedAccounts,
|
|
28871
28959
|
loadingStatus: linkedAccountsLoadingStatus,
|
|
28872
28960
|
refetchAccounts
|
|
28873
|
-
} =
|
|
28961
|
+
} = useContext52(LinkedAccountsContext);
|
|
28874
28962
|
const effectiveLinkedAccounts = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
|
|
28875
28963
|
const { trigger } = useConfirmAndExcludeMultiple({ onSuccess: refetchAccounts });
|
|
28876
28964
|
const { previous, next } = useWizard();
|
|
@@ -28943,7 +29031,7 @@ function LinkAccountsConfirmationStep() {
|
|
|
28943
29031
|
}
|
|
28944
29032
|
|
|
28945
29033
|
// src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
|
|
28946
|
-
import { useContext as
|
|
29034
|
+
import { useContext as useContext53 } from "react";
|
|
28947
29035
|
import pluralize4 from "pluralize";
|
|
28948
29036
|
|
|
28949
29037
|
// src/components/Separator/Separator.tsx
|
|
@@ -28954,7 +29042,7 @@ var Separator = ({ mbs, mbe }) => {
|
|
|
28954
29042
|
};
|
|
28955
29043
|
|
|
28956
29044
|
// src/components/PlatformOnboarding/Steps/LinkAccountsLinkStep.tsx
|
|
28957
|
-
import { Fragment as
|
|
29045
|
+
import { Fragment as Fragment41, jsx as jsx260, jsxs as jsxs166 } from "react/jsx-runtime";
|
|
28958
29046
|
function LinkAccountsLinkStep() {
|
|
28959
29047
|
const {
|
|
28960
29048
|
data,
|
|
@@ -28962,10 +29050,10 @@ function LinkAccountsLinkStep() {
|
|
|
28962
29050
|
error,
|
|
28963
29051
|
refetchAccounts,
|
|
28964
29052
|
addConnection
|
|
28965
|
-
} =
|
|
29053
|
+
} = useContext53(LinkedAccountsContext);
|
|
28966
29054
|
const { next } = useWizard();
|
|
28967
29055
|
const effectiveAccounts = data != null ? data : [];
|
|
28968
|
-
return /* @__PURE__ */ jsxs166(
|
|
29056
|
+
return /* @__PURE__ */ jsxs166(Fragment41, { children: [
|
|
28969
29057
|
/* @__PURE__ */ jsx260(
|
|
28970
29058
|
ConditionalList,
|
|
28971
29059
|
{
|
|
@@ -29025,7 +29113,7 @@ function LinkAccountsLinkStep() {
|
|
|
29025
29113
|
children: ({ item: account }) => /* @__PURE__ */ jsx260(BasicLinkedAccountContainer, { isSelected: true, children: /* @__PURE__ */ jsx260(BasicLinkedAccountContent, { account }) }, account.id)
|
|
29026
29114
|
}
|
|
29027
29115
|
),
|
|
29028
|
-
effectiveAccounts.length > 0 ? /* @__PURE__ */ jsxs166(
|
|
29116
|
+
effectiveAccounts.length > 0 ? /* @__PURE__ */ jsxs166(Fragment41, { children: [
|
|
29029
29117
|
/* @__PURE__ */ jsx260(Separator, { mbs: "lg", mbe: "lg" }),
|
|
29030
29118
|
/* @__PURE__ */ jsx260(HStack, { justify: "start", gap: "sm", children: /* @__PURE__ */ jsx260(Button, { onClick: () => {
|
|
29031
29119
|
void next();
|
|
@@ -29042,7 +29130,7 @@ function LinkAccounts(props) {
|
|
|
29042
29130
|
function LinkAccountsContent({
|
|
29043
29131
|
onComplete
|
|
29044
29132
|
}) {
|
|
29045
|
-
const { data: linkedAccounts, loadingStatus } =
|
|
29133
|
+
const { data: linkedAccounts, loadingStatus } = useContext54(LinkedAccountsContext);
|
|
29046
29134
|
const linkedAccountsNeedingConfirmation = linkedAccounts ? getAccountsNeedingConfirmation(linkedAccounts) : [];
|
|
29047
29135
|
const hideConfirmationStep = loadingStatus === "complete" && linkedAccountsNeedingConfirmation.length === 0;
|
|
29048
29136
|
return /* @__PURE__ */ jsx261("section", { className: "Layer__link-accounts Layer__component", children: /* @__PURE__ */ jsxs167(
|
|
@@ -29060,7 +29148,7 @@ function LinkAccountsContent({
|
|
|
29060
29148
|
}
|
|
29061
29149
|
|
|
29062
29150
|
// src/components/PlatformOnboarding/PlatformOnboarding.tsx
|
|
29063
|
-
import { useState as
|
|
29151
|
+
import { useState as useState65 } from "react";
|
|
29064
29152
|
|
|
29065
29153
|
// src/components/ProgressSteps/ProgressSteps.tsx
|
|
29066
29154
|
import { jsx as jsx262, jsxs as jsxs168 } from "react/jsx-runtime";
|
|
@@ -29249,7 +29337,7 @@ var TrendingUp = (_a) => {
|
|
|
29249
29337
|
var TrendingUp_default = TrendingUp;
|
|
29250
29338
|
|
|
29251
29339
|
// src/components/PlatformOnboarding/Steps/WelcomeStep.tsx
|
|
29252
|
-
import { Fragment as
|
|
29340
|
+
import { Fragment as Fragment42, jsx as jsx265, jsxs as jsxs171 } from "react/jsx-runtime";
|
|
29253
29341
|
var defaultTitle = "Welcome";
|
|
29254
29342
|
var defaultDescription = "Welcome to the platform onboarding process";
|
|
29255
29343
|
var WelcomeStep = ({ onNext, title = defaultTitle, description, stepsEnabled }) => {
|
|
@@ -29270,7 +29358,7 @@ var WelcomeStep = ({ onNext, title = defaultTitle, description, stepsEnabled })
|
|
|
29270
29358
|
}
|
|
29271
29359
|
return defaultDescription;
|
|
29272
29360
|
};
|
|
29273
|
-
return /* @__PURE__ */ jsxs171(
|
|
29361
|
+
return /* @__PURE__ */ jsxs171(Fragment42, { children: [
|
|
29274
29362
|
/* @__PURE__ */ jsxs171("div", { className: "Layer__platform-onboarding__welcome", children: [
|
|
29275
29363
|
/* @__PURE__ */ jsx265(Heading, { className: "Layer__platform-onboarding__heading", align: "left", children: title }),
|
|
29276
29364
|
/* @__PURE__ */ jsx265(Text, { status: "disabled", children: buildDescription() })
|
|
@@ -29347,12 +29435,12 @@ var WelcomeStepFooter = () => {
|
|
|
29347
29435
|
};
|
|
29348
29436
|
|
|
29349
29437
|
// src/components/PlatformOnboarding/Steps/SummaryStep.tsx
|
|
29350
|
-
import { Fragment as
|
|
29438
|
+
import { Fragment as Fragment43, jsx as jsx266, jsxs as jsxs172 } from "react/jsx-runtime";
|
|
29351
29439
|
var defaultTitle2 = "You\u2019re all set!";
|
|
29352
29440
|
var defaultDescription2 = "We\u2019re syncing your accounts. This process may take a while to complete.";
|
|
29353
29441
|
var defaultNextBtnText = "Go to dashboard";
|
|
29354
29442
|
var SummaryStep = ({ onNext, title = defaultTitle2, description = defaultDescription2, nextBtnText = defaultNextBtnText }) => {
|
|
29355
|
-
return /* @__PURE__ */ jsxs172(
|
|
29443
|
+
return /* @__PURE__ */ jsxs172(Fragment43, { children: [
|
|
29356
29444
|
/* @__PURE__ */ jsxs172("div", { className: "Layer__platform-onboarding__summary", children: [
|
|
29357
29445
|
/* @__PURE__ */ jsx266(Heading, { className: "Layer__platform-onboarding__heading", align: "left", children: title }),
|
|
29358
29446
|
/* @__PURE__ */ jsx266(Text, { status: "disabled", children: description })
|
|
@@ -29457,7 +29545,7 @@ function useBusinessPersonnel() {
|
|
|
29457
29545
|
// src/hooks/businessPersonnel/useCreateBusinessPersonnel.ts
|
|
29458
29546
|
import useSWRMutation16 from "swr/mutation";
|
|
29459
29547
|
import { useSWRConfig as useSWRConfig9 } from "swr";
|
|
29460
|
-
import { useCallback as
|
|
29548
|
+
import { useCallback as useCallback21 } from "react";
|
|
29461
29549
|
var createBusinessPersonnel = post(({ businessId }) => `/v1/businesses/${businessId}/personnel`);
|
|
29462
29550
|
function buildKey26({
|
|
29463
29551
|
access_token: accessToken,
|
|
@@ -29495,7 +29583,7 @@ function useCreateBusinessPersonnel() {
|
|
|
29495
29583
|
}
|
|
29496
29584
|
);
|
|
29497
29585
|
const { trigger: originalTrigger } = mutationResponse;
|
|
29498
|
-
const stableProxiedTrigger =
|
|
29586
|
+
const stableProxiedTrigger = useCallback21(
|
|
29499
29587
|
(...triggerParameters) => __async(null, null, function* () {
|
|
29500
29588
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
29501
29589
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -29529,7 +29617,7 @@ var updateBusinessPersonnel = post(({ businessId, businessPersonnelId }) => {
|
|
|
29529
29617
|
});
|
|
29530
29618
|
|
|
29531
29619
|
// src/hooks/businessPersonnel/useUpdateBusinessPersonnel.ts
|
|
29532
|
-
import { useCallback as
|
|
29620
|
+
import { useCallback as useCallback22 } from "react";
|
|
29533
29621
|
function buildKey27({
|
|
29534
29622
|
access_token: accessToken,
|
|
29535
29623
|
apiUrl,
|
|
@@ -29572,7 +29660,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
|
29572
29660
|
}
|
|
29573
29661
|
);
|
|
29574
29662
|
const { trigger: originalTrigger } = mutationResponse;
|
|
29575
|
-
const stableProxiedTrigger =
|
|
29663
|
+
const stableProxiedTrigger = useCallback22(
|
|
29576
29664
|
(...triggerParameters) => __async(null, null, function* () {
|
|
29577
29665
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
29578
29666
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -29599,7 +29687,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
|
29599
29687
|
// src/hooks/business/useUpdateBusiness.ts
|
|
29600
29688
|
import useSWRMutation18 from "swr/mutation";
|
|
29601
29689
|
import { useSWRConfig as useSWRConfig11 } from "swr";
|
|
29602
|
-
import { useCallback as
|
|
29690
|
+
import { useCallback as useCallback23 } from "react";
|
|
29603
29691
|
var BUSINESS_TAG_KEY = "business";
|
|
29604
29692
|
function buildKey28({
|
|
29605
29693
|
access_token: accessToken,
|
|
@@ -29637,7 +29725,7 @@ function useUpdateBusiness() {
|
|
|
29637
29725
|
}
|
|
29638
29726
|
);
|
|
29639
29727
|
const { trigger: originalTrigger } = mutationResponse;
|
|
29640
|
-
const stableProxiedTrigger =
|
|
29728
|
+
const stableProxiedTrigger = useCallback23(
|
|
29641
29729
|
(...triggerParameters) => __async(null, null, function* () {
|
|
29642
29730
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
29643
29731
|
void mutate((key) => withSWRKeyTags(
|
|
@@ -29662,7 +29750,7 @@ function useUpdateBusiness() {
|
|
|
29662
29750
|
}
|
|
29663
29751
|
|
|
29664
29752
|
// src/components/BusinessForm/useBusinessForm.ts
|
|
29665
|
-
import { useState as
|
|
29753
|
+
import { useState as useState64 } from "react";
|
|
29666
29754
|
var getPerson = (personnel) => {
|
|
29667
29755
|
const owners = personnel == null ? void 0 : personnel.filter((p) => p.roles.find((x) => x.role === "OWNER"));
|
|
29668
29756
|
if (owners && owners.length > 0) {
|
|
@@ -29673,7 +29761,7 @@ var getPerson = (personnel) => {
|
|
|
29673
29761
|
var useBusinessForm = ({ onSuccess }) => {
|
|
29674
29762
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
29675
29763
|
const { business } = useLayerContext();
|
|
29676
|
-
const [submitError, setSubmitError] =
|
|
29764
|
+
const [submitError, setSubmitError] = useState64(void 0);
|
|
29677
29765
|
const { data: personnel } = useBusinessPersonnel();
|
|
29678
29766
|
const person = getPerson(personnel);
|
|
29679
29767
|
const { trigger: createBusinessPersonnel2 } = useCreateBusinessPersonnel();
|
|
@@ -29881,7 +29969,7 @@ var PhoneInput = (_a) => {
|
|
|
29881
29969
|
|
|
29882
29970
|
// src/components/BusinessForm/BusinessForm.tsx
|
|
29883
29971
|
import { isPossiblePhoneNumber } from "libphonenumber-js";
|
|
29884
|
-
import { Fragment as
|
|
29972
|
+
import { Fragment as Fragment44, jsx as jsx271, jsxs as jsxs174 } from "react/jsx-runtime";
|
|
29885
29973
|
var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
29886
29974
|
var _a;
|
|
29887
29975
|
const { form, submitError, isFormValid } = useBusinessForm({ onSuccess });
|
|
@@ -29905,7 +29993,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29905
29993
|
validators: {
|
|
29906
29994
|
onSubmit: ({ value }) => notEmpty(value) ? void 0 : "Full name is required"
|
|
29907
29995
|
},
|
|
29908
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
29996
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "full_name", label: "Full name", children: /* @__PURE__ */ jsx271(
|
|
29909
29997
|
Input,
|
|
29910
29998
|
{
|
|
29911
29999
|
name: "full_name",
|
|
@@ -29918,7 +30006,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29918
30006
|
) }) })
|
|
29919
30007
|
}
|
|
29920
30008
|
),
|
|
29921
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "preferred_name", children: (field) => /* @__PURE__ */ jsx271(
|
|
30009
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "preferred_name", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "preferred_name", label: "Preferred name", children: /* @__PURE__ */ jsx271(
|
|
29922
30010
|
Input,
|
|
29923
30011
|
{
|
|
29924
30012
|
name: "preferred_name",
|
|
@@ -29935,7 +30023,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29935
30023
|
validators: {
|
|
29936
30024
|
onSubmit: ({ value }) => validateEmailFormat(value, true) ? void 0 : "Email is invalid"
|
|
29937
30025
|
},
|
|
29938
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
30026
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(
|
|
29939
30027
|
InputGroup,
|
|
29940
30028
|
{
|
|
29941
30029
|
name: "email",
|
|
@@ -29962,7 +30050,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29962
30050
|
validators: {
|
|
29963
30051
|
onSubmit: ({ value }) => isPossiblePhoneNumber(value != null ? value : "", "US") ? void 0 : "Phone number is invalid"
|
|
29964
30052
|
},
|
|
29965
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
30053
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(
|
|
29966
30054
|
InputGroup,
|
|
29967
30055
|
{
|
|
29968
30056
|
name: "phone_number",
|
|
@@ -29989,7 +30077,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
29989
30077
|
validators: {
|
|
29990
30078
|
onBlur: ({ value }) => notEmpty(value) ? void 0 : "Company name is required"
|
|
29991
30079
|
},
|
|
29992
|
-
children: (field) => /* @__PURE__ */ jsx271(
|
|
30080
|
+
children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "legal_name", label: "Company", children: /* @__PURE__ */ jsx271(
|
|
29993
30081
|
Input,
|
|
29994
30082
|
{
|
|
29995
30083
|
name: "legal_name",
|
|
@@ -30002,7 +30090,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30002
30090
|
) }) })
|
|
30003
30091
|
}
|
|
30004
30092
|
),
|
|
30005
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "dba", children: (field) => /* @__PURE__ */ jsx271(
|
|
30093
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "dba", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "dba", label: "DBA (optional)", children: /* @__PURE__ */ jsx271(
|
|
30006
30094
|
Input,
|
|
30007
30095
|
{
|
|
30008
30096
|
name: "dba",
|
|
@@ -30013,7 +30101,7 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30013
30101
|
errorMessage: field.state.meta.errors.join(", ")
|
|
30014
30102
|
}
|
|
30015
30103
|
) }) }) }),
|
|
30016
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "entity_type", children: (field) => /* @__PURE__ */ jsx271(
|
|
30104
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "entity_type", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "entity_type", label: "Entity type", children: /* @__PURE__ */ jsx271(
|
|
30017
30105
|
BusinessTypeSelect,
|
|
30018
30106
|
{
|
|
30019
30107
|
value: field.state.value,
|
|
@@ -30021,14 +30109,14 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30021
30109
|
}
|
|
30022
30110
|
) }) }) }),
|
|
30023
30111
|
/* @__PURE__ */ jsxs174("div", { className: "Layer__business-form__state-tin-fields", children: [
|
|
30024
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "us_state", children: (field) => /* @__PURE__ */ jsx271(
|
|
30112
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "us_state", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "us_state", label: "State", className: "Layer__business-form__state", children: /* @__PURE__ */ jsx271(
|
|
30025
30113
|
USStateSelect,
|
|
30026
30114
|
{
|
|
30027
30115
|
value: field.state.value,
|
|
30028
30116
|
onChange: (option) => field.handleChange(option.value)
|
|
30029
30117
|
}
|
|
30030
30118
|
) }) }) }),
|
|
30031
|
-
/* @__PURE__ */ jsx271(form.Field, { name: "tin", children: (field) => /* @__PURE__ */ jsx271(
|
|
30119
|
+
/* @__PURE__ */ jsx271(form.Field, { name: "tin", children: (field) => /* @__PURE__ */ jsx271(Fragment44, { children: /* @__PURE__ */ jsx271(InputGroup, { name: "tin", label: "Tax ID number (optional)", children: /* @__PURE__ */ jsx271(
|
|
30032
30120
|
Input,
|
|
30033
30121
|
{
|
|
30034
30122
|
name: "tin",
|
|
@@ -30059,10 +30147,10 @@ var BusinessForm2 = ({ stringOverrides, onSuccess }) => {
|
|
|
30059
30147
|
};
|
|
30060
30148
|
|
|
30061
30149
|
// src/components/PlatformOnboarding/Steps/BusinessInfoStep.tsx
|
|
30062
|
-
import { Fragment as
|
|
30150
|
+
import { Fragment as Fragment45, jsx as jsx272, jsxs as jsxs175 } from "react/jsx-runtime";
|
|
30063
30151
|
var defaultTitle3 = "We\u2019ll use this information to contact you whenever we have questions on your books.";
|
|
30064
30152
|
var BusinessInfoStep = ({ title = defaultTitle3, onNext }) => {
|
|
30065
|
-
return /* @__PURE__ */ jsxs175(
|
|
30153
|
+
return /* @__PURE__ */ jsxs175(Fragment45, { children: [
|
|
30066
30154
|
/* @__PURE__ */ jsx272(Heading2, { children: title }),
|
|
30067
30155
|
/* @__PURE__ */ jsx272(BusinessForm2, { onSuccess: onNext })
|
|
30068
30156
|
] });
|
|
@@ -30089,7 +30177,7 @@ var PLATFORM_ONBOARDING_STEPS = [
|
|
|
30089
30177
|
}
|
|
30090
30178
|
];
|
|
30091
30179
|
var PlatformOnboarding = ({ onComplete }) => {
|
|
30092
|
-
const [step, setStep] =
|
|
30180
|
+
const [step, setStep] = useState65(PLATFORM_ONBOARDING_STEPS[0].id);
|
|
30093
30181
|
const isFirstStep = PLATFORM_ONBOARDING_STEPS[0].id === step;
|
|
30094
30182
|
const nextStep = () => {
|
|
30095
30183
|
const currentStepIndex = PLATFORM_ONBOARDING_STEPS.findIndex((s) => s.id === step);
|
|
@@ -30251,7 +30339,7 @@ var BookkeepingUpsellBar = ({
|
|
|
30251
30339
|
};
|
|
30252
30340
|
|
|
30253
30341
|
// src/views/BookkeepingOverview/BookkeepingOverview.tsx
|
|
30254
|
-
import { useState as
|
|
30342
|
+
import { useState as useState66 } from "react";
|
|
30255
30343
|
|
|
30256
30344
|
// src/views/BookkeepingOverview/internal/BookkeepingProfitAndLossSummariesContainer.tsx
|
|
30257
30345
|
import { jsx as jsx276 } from "react/jsx-runtime";
|
|
@@ -30331,7 +30419,7 @@ var BookkeepingOverview = ({
|
|
|
30331
30419
|
slotProps
|
|
30332
30420
|
}) => {
|
|
30333
30421
|
var _a, _b, _c, _d, _e, _f;
|
|
30334
|
-
const [pnlToggle, setPnlToggle] =
|
|
30422
|
+
const [pnlToggle, setPnlToggle] = useState66("expenses");
|
|
30335
30423
|
const [width] = useWindowSize();
|
|
30336
30424
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
30337
30425
|
const { upperContentRef, targetElementRef, upperElementInFocus } = useKeepInMobileViewport();
|
|
@@ -30462,7 +30550,7 @@ var BookkeepingOverview = ({
|
|
|
30462
30550
|
};
|
|
30463
30551
|
|
|
30464
30552
|
// src/views/AccountingOverview/AccountingOverview.tsx
|
|
30465
|
-
import { useState as
|
|
30553
|
+
import { useState as useState67 } from "react";
|
|
30466
30554
|
import classNames75 from "classnames";
|
|
30467
30555
|
import { jsx as jsx278, jsxs as jsxs180 } from "react/jsx-runtime";
|
|
30468
30556
|
var AccountingOverview = ({
|
|
@@ -30478,7 +30566,7 @@ var AccountingOverview = ({
|
|
|
30478
30566
|
slotProps
|
|
30479
30567
|
}) => {
|
|
30480
30568
|
var _a, _b, _c, _d, _e;
|
|
30481
|
-
const [pnlToggle, setPnlToggle] =
|
|
30569
|
+
const [pnlToggle, setPnlToggle] = useState67("expenses");
|
|
30482
30570
|
const profitAndLossSummariesVariants = (_b = (_a = slotProps == null ? void 0 : slotProps.profitAndLoss) == null ? void 0 : _a.summaries) == null ? void 0 : _b.variants;
|
|
30483
30571
|
return /* @__PURE__ */ jsx278(
|
|
30484
30572
|
ProfitAndLoss,
|
|
@@ -30645,7 +30733,7 @@ var BankTransactionsWithLinkedAccounts = ({
|
|
|
30645
30733
|
};
|
|
30646
30734
|
|
|
30647
30735
|
// src/views/GeneralLedger/GeneralLedger.tsx
|
|
30648
|
-
import { useState as
|
|
30736
|
+
import { useState as useState68 } from "react";
|
|
30649
30737
|
import { jsx as jsx280, jsxs as jsxs182 } from "react/jsx-runtime";
|
|
30650
30738
|
var GeneralLedgerView = ({
|
|
30651
30739
|
title,
|
|
@@ -30654,7 +30742,7 @@ var GeneralLedgerView = ({
|
|
|
30654
30742
|
stringOverrides,
|
|
30655
30743
|
chartOfAccountsOptions
|
|
30656
30744
|
}) => {
|
|
30657
|
-
const [activeTab, setActiveTab] =
|
|
30745
|
+
const [activeTab, setActiveTab] = useState68("chartOfAccounts");
|
|
30658
30746
|
return /* @__PURE__ */ jsx280(ProfitAndLoss, { asContainer: false, children: /* @__PURE__ */ jsxs182(
|
|
30659
30747
|
View,
|
|
30660
30748
|
{
|
|
@@ -30696,9 +30784,9 @@ var GeneralLedgerView = ({
|
|
|
30696
30784
|
};
|
|
30697
30785
|
|
|
30698
30786
|
// src/views/ProjectProfitability/ProjectProfitability.tsx
|
|
30699
|
-
import { useState as
|
|
30787
|
+
import { useState as useState69 } from "react";
|
|
30700
30788
|
import Select4 from "react-select";
|
|
30701
|
-
import { Fragment as
|
|
30789
|
+
import { Fragment as Fragment46, jsx as jsx281, jsxs as jsxs183 } from "react/jsx-runtime";
|
|
30702
30790
|
var ProjectProfitabilityView = ({
|
|
30703
30791
|
valueOptions,
|
|
30704
30792
|
showTitle,
|
|
@@ -30706,9 +30794,9 @@ var ProjectProfitabilityView = ({
|
|
|
30706
30794
|
datePickerMode = "monthPicker",
|
|
30707
30795
|
csvMoneyFormat = "DOLLAR_STRING"
|
|
30708
30796
|
}) => {
|
|
30709
|
-
const [activeTab, setActiveTab] =
|
|
30710
|
-
const [tagFilter, setTagFilter] =
|
|
30711
|
-
const [pnlTagFilter, setPnlTagFilter] =
|
|
30797
|
+
const [activeTab, setActiveTab] = useState69("overview");
|
|
30798
|
+
const [tagFilter, setTagFilter] = useState69(null);
|
|
30799
|
+
const [pnlTagFilter, setPnlTagFilter] = useState69(
|
|
30712
30800
|
void 0
|
|
30713
30801
|
);
|
|
30714
30802
|
const isOptionSelected = (option, selectValue) => {
|
|
@@ -30771,7 +30859,7 @@ var ProjectProfitabilityView = ({
|
|
|
30771
30859
|
}
|
|
30772
30860
|
)
|
|
30773
30861
|
] }),
|
|
30774
|
-
/* @__PURE__ */ jsx281(Container, { name: "project", children: /* @__PURE__ */ jsxs183(
|
|
30862
|
+
/* @__PURE__ */ jsx281(Container, { name: "project", children: /* @__PURE__ */ jsxs183(Fragment46, { children: [
|
|
30775
30863
|
activeTab === "overview" && /* @__PURE__ */ jsx281(
|
|
30776
30864
|
AccountingOverview,
|
|
30777
30865
|
{
|
|
@@ -30807,8 +30895,8 @@ var ProjectProfitabilityView = ({
|
|
|
30807
30895
|
};
|
|
30808
30896
|
|
|
30809
30897
|
// src/views/Reports/Reports.tsx
|
|
30810
|
-
import { useState as
|
|
30811
|
-
import { Fragment as
|
|
30898
|
+
import { useState as useState70 } from "react";
|
|
30899
|
+
import { Fragment as Fragment47, jsx as jsx282, jsxs as jsxs184 } from "react/jsx-runtime";
|
|
30812
30900
|
var getOptions = (enabledReports) => {
|
|
30813
30901
|
return [
|
|
30814
30902
|
enabledReports.includes("profitAndLoss") ? {
|
|
@@ -30835,7 +30923,7 @@ var Reports = ({
|
|
|
30835
30923
|
statementOfCashFlowConfig
|
|
30836
30924
|
}) => {
|
|
30837
30925
|
var _a;
|
|
30838
|
-
const [activeTab, setActiveTab] =
|
|
30926
|
+
const [activeTab, setActiveTab] = useState70(enabledReports[0]);
|
|
30839
30927
|
const { view, containerRef } = useElementViewSize();
|
|
30840
30928
|
const options = getOptions(enabledReports);
|
|
30841
30929
|
const defaultTitle4 = enabledReports.length > 1 ? "Reports" : (_a = options.find((option) => option.value = enabledReports[0])) == null ? void 0 : _a.label;
|
|
@@ -30877,7 +30965,7 @@ var ReportsPanel = ({
|
|
|
30877
30965
|
statementOfCashFlowConfig,
|
|
30878
30966
|
view
|
|
30879
30967
|
}) => {
|
|
30880
|
-
return /* @__PURE__ */ jsxs184(
|
|
30968
|
+
return /* @__PURE__ */ jsxs184(Fragment47, { children: [
|
|
30881
30969
|
openReport === "profitAndLoss" && /* @__PURE__ */ jsx282(
|
|
30882
30970
|
ProfitAndLoss.Report,
|
|
30883
30971
|
__spreadValues({
|
|
@@ -30897,8 +30985,8 @@ var ReportsPanel = ({
|
|
|
30897
30985
|
};
|
|
30898
30986
|
|
|
30899
30987
|
// src/components/ProfitAndLossView/ProfitAndLossView.tsx
|
|
30900
|
-
import { useContext as
|
|
30901
|
-
import { Fragment as
|
|
30988
|
+
import { useContext as useContext55, useRef as useRef24 } from "react";
|
|
30989
|
+
import { Fragment as Fragment48, jsx as jsx283, jsxs as jsxs185 } from "react/jsx-runtime";
|
|
30902
30990
|
var COMPONENT_NAME8 = "profit-and-loss";
|
|
30903
30991
|
var ProfitAndLossView = (props) => {
|
|
30904
30992
|
const containerRef = useRef24(null);
|
|
@@ -30912,7 +31000,7 @@ var ProfitAndLossPanel = (_a) => {
|
|
|
30912
31000
|
"containerRef",
|
|
30913
31001
|
"stringOverrides"
|
|
30914
31002
|
]);
|
|
30915
|
-
const { sidebarScope } =
|
|
31003
|
+
const { sidebarScope } = useContext55(ProfitAndLoss.Context);
|
|
30916
31004
|
return /* @__PURE__ */ jsxs185(
|
|
30917
31005
|
Panel,
|
|
30918
31006
|
{
|
|
@@ -30943,7 +31031,7 @@ var Components = ({
|
|
|
30943
31031
|
hideTable = false,
|
|
30944
31032
|
stringOverrides
|
|
30945
31033
|
}) => {
|
|
30946
|
-
const { error, isLoading, isValidating, refetch } =
|
|
31034
|
+
const { error, isLoading, isValidating, refetch } = useContext55(
|
|
30947
31035
|
ProfitAndLoss.Context
|
|
30948
31036
|
);
|
|
30949
31037
|
if (!isLoading && error) {
|
|
@@ -30958,7 +31046,7 @@ var Components = ({
|
|
|
30958
31046
|
}
|
|
30959
31047
|
) });
|
|
30960
31048
|
}
|
|
30961
|
-
return /* @__PURE__ */ jsxs185(
|
|
31049
|
+
return /* @__PURE__ */ jsxs185(Fragment48, { children: [
|
|
30962
31050
|
!hideChart && /* @__PURE__ */ jsxs185("div", { className: `Layer__${COMPONENT_NAME8}__chart_with_summaries`, children: [
|
|
30963
31051
|
/* @__PURE__ */ jsxs185(
|
|
30964
31052
|
"div",
|
|
@@ -31004,6 +31092,7 @@ export {
|
|
|
31004
31092
|
Direction,
|
|
31005
31093
|
DisplayState,
|
|
31006
31094
|
GeneralLedgerView,
|
|
31095
|
+
Integrations,
|
|
31007
31096
|
Journal,
|
|
31008
31097
|
LayerProvider,
|
|
31009
31098
|
LinkAccounts,
|
|
@@ -31013,11 +31102,9 @@ export {
|
|
|
31013
31102
|
ProfitAndLoss,
|
|
31014
31103
|
ProfitAndLossView,
|
|
31015
31104
|
ProjectProfitabilityView,
|
|
31016
|
-
Quickbooks,
|
|
31017
31105
|
Reports,
|
|
31018
31106
|
StatementOfCashFlow,
|
|
31019
31107
|
Tasks,
|
|
31020
|
-
unstable_Integrations,
|
|
31021
31108
|
useBankTransactionsContext,
|
|
31022
31109
|
useDataSync,
|
|
31023
31110
|
useLayerContext
|