@layerfi/components 0.1.114-alpha.6 → 0.1.115-alpha
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 +1455 -857
- package/dist/esm/index.mjs +1446 -848
- package/dist/index.css +74 -116
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -70,7 +70,7 @@ const reactAriaComponents = require("react-aria-components");
|
|
|
70
70
|
const lucideReact = require("lucide-react");
|
|
71
71
|
const pluralize = require("pluralize");
|
|
72
72
|
const useResizeObserver = require("@react-hook/resize-observer");
|
|
73
|
-
const
|
|
73
|
+
const ReactSelect = require("react-select");
|
|
74
74
|
const reactDropzone = require("react-dropzone");
|
|
75
75
|
const reactForm = require("@tanstack/react-form");
|
|
76
76
|
const BaseCreatableSelect = require("react-select/creatable");
|
|
@@ -202,7 +202,7 @@ class ErrorHandlerClass {
|
|
|
202
202
|
}
|
|
203
203
|
const errorHandler = new ErrorHandlerClass();
|
|
204
204
|
const reportError = (payload) => errorHandler.onError(payload);
|
|
205
|
-
const version = "0.1.
|
|
205
|
+
const version = "0.1.115-alpha";
|
|
206
206
|
const pkg = {
|
|
207
207
|
version
|
|
208
208
|
};
|
|
@@ -673,7 +673,7 @@ function requestOAuthToken(_0) {
|
|
|
673
673
|
}).then((res) => res.json());
|
|
674
674
|
});
|
|
675
675
|
}
|
|
676
|
-
function buildKey$
|
|
676
|
+
function buildKey$14({
|
|
677
677
|
appId,
|
|
678
678
|
appSecret,
|
|
679
679
|
businessAccessToken,
|
|
@@ -716,7 +716,7 @@ function useAuth() {
|
|
|
716
716
|
businessAccessToken
|
|
717
717
|
} = useAuthInput();
|
|
718
718
|
return useSWR(
|
|
719
|
-
() => buildKey$
|
|
719
|
+
() => buildKey$14({ appId, appSecret, businessAccessToken, apiUrl, authUrl, scope }),
|
|
720
720
|
(key) => {
|
|
721
721
|
if (key.mode === "explicit") {
|
|
722
722
|
const { businessAccessToken: businessAccessToken2, apiUrl: apiUrl3 } = key;
|
|
@@ -751,7 +751,7 @@ const useLayerContext = () => {
|
|
|
751
751
|
return ctx;
|
|
752
752
|
};
|
|
753
753
|
const EXTERNAL_ACCOUNTS_TAG_KEY = "#external-accounts";
|
|
754
|
-
function buildKey
|
|
754
|
+
function buildKey$13({
|
|
755
755
|
access_token: accessToken,
|
|
756
756
|
apiUrl,
|
|
757
757
|
businessId
|
|
@@ -770,7 +770,7 @@ function useListExternalAccounts() {
|
|
|
770
770
|
const { apiUrl } = useEnvironment();
|
|
771
771
|
const { data: auth } = useAuth();
|
|
772
772
|
return useSWR(
|
|
773
|
-
() => buildKey
|
|
773
|
+
() => buildKey$13(__spreadProps(__spreadValues({}, auth), {
|
|
774
774
|
apiUrl,
|
|
775
775
|
businessId
|
|
776
776
|
})),
|
|
@@ -4053,7 +4053,7 @@ const BANK_ACCOUNTS_TAG_KEY = "#bank-accounts";
|
|
|
4053
4053
|
const getBankAccounts = get$1(
|
|
4054
4054
|
({ businessId }) => `/v1/businesses/${businessId}/bank-accounts`
|
|
4055
4055
|
);
|
|
4056
|
-
function buildKey$
|
|
4056
|
+
function buildKey$12({
|
|
4057
4057
|
access_token: accessToken,
|
|
4058
4058
|
apiUrl,
|
|
4059
4059
|
businessId
|
|
@@ -4074,7 +4074,7 @@ const useBankAccounts = () => {
|
|
|
4074
4074
|
const { apiUrl } = useEnvironment();
|
|
4075
4075
|
const { data: auth } = useAuth();
|
|
4076
4076
|
const { data, error, isLoading } = useSWR(
|
|
4077
|
-
() => buildKey$
|
|
4077
|
+
() => buildKey$12(__spreadProps(__spreadValues({}, auth), {
|
|
4078
4078
|
apiUrl,
|
|
4079
4079
|
businessId
|
|
4080
4080
|
})),
|
|
@@ -5515,7 +5515,7 @@ class ProfitAndLossReportSWRResponse {
|
|
|
5515
5515
|
return this.swrResponse.mutate;
|
|
5516
5516
|
}
|
|
5517
5517
|
}
|
|
5518
|
-
function buildKey$
|
|
5518
|
+
function buildKey$11({
|
|
5519
5519
|
access_token: accessToken,
|
|
5520
5520
|
apiUrl,
|
|
5521
5521
|
businessId,
|
|
@@ -5559,7 +5559,7 @@ function useProfitAndLossReport({ startDate, endDate, tagKey, tagValues, reporti
|
|
|
5559
5559
|
const { data } = useAuth();
|
|
5560
5560
|
const { businessId } = useLayerContext();
|
|
5561
5561
|
const response = useSWR(
|
|
5562
|
-
() => buildKey$
|
|
5562
|
+
() => buildKey$11(__spreadProps(__spreadValues({}, data), {
|
|
5563
5563
|
businessId,
|
|
5564
5564
|
startDate,
|
|
5565
5565
|
endDate,
|
|
@@ -5625,7 +5625,7 @@ class ProfitAndLossSummariesSWRResponse {
|
|
|
5625
5625
|
return this.swrResponse.mutate;
|
|
5626
5626
|
}
|
|
5627
5627
|
}
|
|
5628
|
-
function buildKey$
|
|
5628
|
+
function buildKey$10({
|
|
5629
5629
|
access_token: accessToken,
|
|
5630
5630
|
apiUrl,
|
|
5631
5631
|
businessId,
|
|
@@ -5672,7 +5672,7 @@ function useProfitAndLossSummaries({ startYear, startMonth, endYear, endMonth, t
|
|
|
5672
5672
|
const { data } = useAuth();
|
|
5673
5673
|
const { businessId } = useLayerContext();
|
|
5674
5674
|
const response = useSWR(
|
|
5675
|
-
() => buildKey$
|
|
5675
|
+
() => buildKey$10(__spreadProps(__spreadValues({}, data), {
|
|
5676
5676
|
businessId,
|
|
5677
5677
|
startYear,
|
|
5678
5678
|
startMonth,
|
|
@@ -5742,7 +5742,7 @@ const useProfitAndLossGlobalInvalidator = () => {
|
|
|
5742
5742
|
return { invalidateProfitAndLoss, debouncedInvalidateProfitAndLoss };
|
|
5743
5743
|
};
|
|
5744
5744
|
const CATEGORIZE_BANK_TRANSACTION_TAG = "#categorize-bank-transaction";
|
|
5745
|
-
function buildKey
|
|
5745
|
+
function buildKey$$({
|
|
5746
5746
|
access_token: accessToken,
|
|
5747
5747
|
apiUrl,
|
|
5748
5748
|
businessId
|
|
@@ -5765,7 +5765,7 @@ function useCategorizeBankTransaction({
|
|
|
5765
5765
|
const { debouncedInvalidateProfitAndLoss } = useProfitAndLossGlobalInvalidator();
|
|
5766
5766
|
const { invalidatePnlDetailLines } = usePnlDetailLinesInvalidator();
|
|
5767
5767
|
const mutationResponse = useSWRMutation(
|
|
5768
|
-
() => buildKey
|
|
5768
|
+
() => buildKey$$({
|
|
5769
5769
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
5770
5770
|
apiUrl: auth == null ? void 0 : auth.apiUrl,
|
|
5771
5771
|
businessId
|
|
@@ -5813,7 +5813,7 @@ function useCategorizeBankTransaction({
|
|
|
5813
5813
|
});
|
|
5814
5814
|
}
|
|
5815
5815
|
const MATCH_BANK_TRANSACTION_TAG = "#match-bank-transaction";
|
|
5816
|
-
function buildKey$
|
|
5816
|
+
function buildKey$_({
|
|
5817
5817
|
access_token: accessToken,
|
|
5818
5818
|
apiUrl,
|
|
5819
5819
|
businessId
|
|
@@ -5835,7 +5835,7 @@ function useMatchBankTransaction({
|
|
|
5835
5835
|
const { mutate } = useSWR.useSWRConfig();
|
|
5836
5836
|
const { debouncedInvalidateProfitAndLoss } = useProfitAndLossGlobalInvalidator();
|
|
5837
5837
|
const mutationResponse = useSWRMutation(
|
|
5838
|
-
() => buildKey$
|
|
5838
|
+
() => buildKey$_({
|
|
5839
5839
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
5840
5840
|
apiUrl: auth == null ? void 0 : auth.apiUrl,
|
|
5841
5841
|
businessId
|
|
@@ -6301,16 +6301,24 @@ const useAugmentedBankTransactions = (params) => {
|
|
|
6301
6301
|
}
|
|
6302
6302
|
return filtered;
|
|
6303
6303
|
}, [filters, data]);
|
|
6304
|
-
const
|
|
6305
|
-
|
|
6306
|
-
|
|
6307
|
-
|
|
6304
|
+
const updateLocalBankTransactions = (newBankTransactions) => {
|
|
6305
|
+
const transactionsById = new Map(
|
|
6306
|
+
newBankTransactions.map((bt) => [bt.id, bt])
|
|
6307
|
+
);
|
|
6308
|
+
for (const bt of newBankTransactions) {
|
|
6309
|
+
if (bt.update_categorization_rules_suggestion) {
|
|
6310
|
+
const decodedRuleSuggestion = decodeRulesSuggestion(bt.update_categorization_rules_suggestion);
|
|
6311
|
+
setRuleSuggestion(decodedRuleSuggestion);
|
|
6312
|
+
}
|
|
6308
6313
|
}
|
|
6309
6314
|
const updatedData = rawResponseData == null ? void 0 : rawResponseData.map((page) => {
|
|
6310
6315
|
var _a2;
|
|
6311
6316
|
return __spreadProps(__spreadValues({}, page), {
|
|
6312
6317
|
data: (_a2 = page.data) == null ? void 0 : _a2.map(
|
|
6313
|
-
(bt) =>
|
|
6318
|
+
(bt) => {
|
|
6319
|
+
var _a3;
|
|
6320
|
+
return (_a3 = transactionsById.get(bt.id)) != null ? _a3 : bt;
|
|
6321
|
+
}
|
|
6314
6322
|
)
|
|
6315
6323
|
});
|
|
6316
6324
|
});
|
|
@@ -6322,25 +6330,29 @@ const useAugmentedBankTransactions = (params) => {
|
|
|
6322
6330
|
const categorizeWithOptimisticUpdate = (bankTransactionId, newCategory, notify) => __async(null, null, function* () {
|
|
6323
6331
|
const existingTransaction = data == null ? void 0 : data.find(({ id }) => id === bankTransactionId);
|
|
6324
6332
|
if (existingTransaction) {
|
|
6325
|
-
|
|
6333
|
+
updateLocalBankTransactions([__spreadProps(__spreadValues({}, existingTransaction), {
|
|
6334
|
+
update_categorization_rules_suggestion: void 0,
|
|
6335
|
+
processing: true,
|
|
6336
|
+
error: void 0
|
|
6337
|
+
})]);
|
|
6326
6338
|
}
|
|
6327
6339
|
return categorizeBankTransaction2(__spreadValues({
|
|
6328
6340
|
bankTransactionId
|
|
6329
6341
|
}, newCategory)).then((updatedTransaction) => {
|
|
6330
|
-
|
|
6342
|
+
updateLocalBankTransactions([__spreadProps(__spreadValues({}, updatedTransaction), {
|
|
6331
6343
|
processing: false,
|
|
6332
6344
|
recently_categorized: true
|
|
6333
|
-
}));
|
|
6345
|
+
})]);
|
|
6334
6346
|
if (notify) {
|
|
6335
6347
|
addToast({ content: "Transaction confirmed" });
|
|
6336
6348
|
}
|
|
6337
6349
|
}).catch((error) => {
|
|
6338
6350
|
const targetedTransaction = data == null ? void 0 : data.find(({ id }) => id === bankTransactionId);
|
|
6339
6351
|
if (targetedTransaction) {
|
|
6340
|
-
|
|
6352
|
+
updateLocalBankTransactions([__spreadProps(__spreadValues({}, targetedTransaction), {
|
|
6341
6353
|
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
6342
6354
|
processing: false
|
|
6343
|
-
}));
|
|
6355
|
+
})]);
|
|
6344
6356
|
}
|
|
6345
6357
|
}).finally(() => {
|
|
6346
6358
|
var _a2;
|
|
@@ -6350,71 +6362,76 @@ const useAugmentedBankTransactions = (params) => {
|
|
|
6350
6362
|
const { trigger: matchBankTransaction2 } = useMatchBankTransaction({
|
|
6351
6363
|
mutateBankTransactions: mutate
|
|
6352
6364
|
});
|
|
6353
|
-
const matchWithOptimisticUpdate = (
|
|
6354
|
-
|
|
6355
|
-
|
|
6356
|
-
|
|
6357
|
-
processing: true,
|
|
6358
|
-
error: void 0
|
|
6359
|
-
}));
|
|
6360
|
-
}
|
|
6361
|
-
const transferBankTransaction = data == null ? void 0 : data.find(
|
|
6362
|
-
({ id, suggested_matches }) => id !== bankTransactionId && (suggested_matches == null ? void 0 : suggested_matches.some(({ id: id2 }) => id2 === suggestedMatchId))
|
|
6365
|
+
const matchWithOptimisticUpdate = (bankTransaction, suggestedMatchId, notify) => __async(null, null, function* () {
|
|
6366
|
+
var _a2, _b;
|
|
6367
|
+
const suggestedMatch = (_a2 = bankTransaction.suggested_matches) == null ? void 0 : _a2.find(
|
|
6368
|
+
(sm) => sm.id === suggestedMatchId
|
|
6363
6369
|
);
|
|
6364
|
-
|
|
6365
|
-
|
|
6370
|
+
const matchedTransferBankTransactionId = (_b = suggestedMatch == null ? void 0 : suggestedMatch.details) == null ? void 0 : _b.id;
|
|
6371
|
+
const matchedTransferBankTransaction = matchedTransferBankTransactionId ? data == null ? void 0 : data.find(({ id }) => id === matchedTransferBankTransactionId) : void 0;
|
|
6372
|
+
const transactionsToSetProcessing = [
|
|
6373
|
+
__spreadProps(__spreadValues({}, bankTransaction), { processing: true, error: void 0 })
|
|
6374
|
+
];
|
|
6375
|
+
if (matchedTransferBankTransaction) {
|
|
6376
|
+
transactionsToSetProcessing.push(__spreadProps(__spreadValues({}, matchedTransferBankTransaction), {
|
|
6366
6377
|
processing: true,
|
|
6367
6378
|
error: void 0
|
|
6368
6379
|
}));
|
|
6369
6380
|
}
|
|
6381
|
+
updateLocalBankTransactions(transactionsToSetProcessing);
|
|
6370
6382
|
return matchBankTransaction2({
|
|
6371
|
-
bankTransactionId,
|
|
6383
|
+
bankTransactionId: bankTransaction.id,
|
|
6372
6384
|
match_id: suggestedMatchId,
|
|
6373
6385
|
type: "Confirm_Match"
|
|
6374
6386
|
}).then((match) => {
|
|
6375
|
-
const
|
|
6376
|
-
|
|
6377
|
-
updateOneLocal(__spreadProps(__spreadValues({}, matchedTransaction), {
|
|
6387
|
+
const transactionsToUpdate = [
|
|
6388
|
+
__spreadProps(__spreadValues({}, bankTransaction), {
|
|
6378
6389
|
categorization_status: CategorizationStatus.MATCHED,
|
|
6379
6390
|
match,
|
|
6380
6391
|
processing: false,
|
|
6381
6392
|
recently_categorized: true
|
|
6382
|
-
})
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
({
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
updateOneLocal(__spreadProps(__spreadValues({}, matchedTransferTransaction), {
|
|
6393
|
+
})
|
|
6394
|
+
];
|
|
6395
|
+
if (matchedTransferBankTransaction) {
|
|
6396
|
+
transactionsToUpdate.push(__spreadProps(__spreadValues({}, matchedTransferBankTransaction), {
|
|
6397
|
+
categorization_status: CategorizationStatus.MATCHED,
|
|
6398
|
+
match,
|
|
6389
6399
|
processing: false,
|
|
6390
6400
|
recently_categorized: true
|
|
6391
6401
|
}));
|
|
6392
6402
|
}
|
|
6403
|
+
updateLocalBankTransactions(transactionsToUpdate);
|
|
6393
6404
|
if (notify) {
|
|
6394
6405
|
addToast({ content: "Transaction saved" });
|
|
6395
6406
|
}
|
|
6396
6407
|
}).catch((error) => {
|
|
6397
|
-
const
|
|
6398
|
-
|
|
6399
|
-
updateOneLocal(__spreadProps(__spreadValues({}, targetedTransaction), {
|
|
6408
|
+
const transactionsToResetProcessing = [
|
|
6409
|
+
__spreadProps(__spreadValues({}, bankTransaction), {
|
|
6400
6410
|
error: error instanceof Error ? error.message : "An unknown error occurred",
|
|
6401
6411
|
processing: false
|
|
6412
|
+
})
|
|
6413
|
+
];
|
|
6414
|
+
if (matchedTransferBankTransaction) {
|
|
6415
|
+
transactionsToResetProcessing.push(__spreadProps(__spreadValues({}, matchedTransferBankTransaction), {
|
|
6416
|
+
error: void 0,
|
|
6417
|
+
processing: false
|
|
6402
6418
|
}));
|
|
6403
6419
|
}
|
|
6420
|
+
updateLocalBankTransactions(transactionsToResetProcessing);
|
|
6404
6421
|
}).finally(() => {
|
|
6405
|
-
var
|
|
6406
|
-
(
|
|
6422
|
+
var _a3;
|
|
6423
|
+
(_a3 = eventCallbacks == null ? void 0 : eventCallbacks.onTransactionCategorized) == null ? void 0 : _a3.call(eventCallbacks);
|
|
6407
6424
|
});
|
|
6408
6425
|
});
|
|
6409
6426
|
const shouldHideAfterCategorize = () => {
|
|
6410
6427
|
return (filters == null ? void 0 : filters.categorizationStatus) === DisplayState.review;
|
|
6411
6428
|
};
|
|
6412
|
-
const removeAfterCategorize = (
|
|
6429
|
+
const removeAfterCategorize = (transactionIds) => {
|
|
6413
6430
|
if (shouldHideAfterCategorize()) {
|
|
6414
6431
|
const updatedData = rawResponseData == null ? void 0 : rawResponseData.map((page) => {
|
|
6415
6432
|
var _a2;
|
|
6416
6433
|
return __spreadProps(__spreadValues({}, page), {
|
|
6417
|
-
data: (_a2 = page.data) == null ? void 0 : _a2.filter((bt) => bt.id
|
|
6434
|
+
data: (_a2 = page.data) == null ? void 0 : _a2.filter((bt) => !transactionIds.includes(bt.id))
|
|
6418
6435
|
});
|
|
6419
6436
|
});
|
|
6420
6437
|
void mutate(updatedData, { revalidate: false });
|
|
@@ -6493,7 +6510,7 @@ const useAugmentedBankTransactions = (params) => {
|
|
|
6493
6510
|
isError: !!responseError,
|
|
6494
6511
|
categorize: categorizeWithOptimisticUpdate,
|
|
6495
6512
|
match: matchWithOptimisticUpdate,
|
|
6496
|
-
|
|
6513
|
+
updateLocalBankTransactions,
|
|
6497
6514
|
shouldHideAfterCategorize,
|
|
6498
6515
|
removeAfterCategorize,
|
|
6499
6516
|
display,
|
|
@@ -7861,7 +7878,7 @@ const getBookkeepingStatus = get$1(({ businessId }) => {
|
|
|
7861
7878
|
});
|
|
7862
7879
|
const BOOKKEEPING_TAG_KEY = "#bookkeeping";
|
|
7863
7880
|
const BOOKKEEPING_STATUS_TAG_KEY = "#bookkeeping-status";
|
|
7864
|
-
function buildKey$
|
|
7881
|
+
function buildKey$Z({
|
|
7865
7882
|
access_token: accessToken,
|
|
7866
7883
|
apiUrl,
|
|
7867
7884
|
businessId
|
|
@@ -7879,7 +7896,7 @@ function useBookkeepingStatus() {
|
|
|
7879
7896
|
const { data: auth } = useAuth();
|
|
7880
7897
|
const { businessId } = useLayerContext();
|
|
7881
7898
|
return useSWR(
|
|
7882
|
-
() => buildKey$
|
|
7899
|
+
() => buildKey$Z(__spreadProps(__spreadValues({}, auth), {
|
|
7883
7900
|
businessId
|
|
7884
7901
|
})),
|
|
7885
7902
|
({ accessToken, apiUrl, businessId: businessId2 }) => getBookkeepingStatus(
|
|
@@ -7919,6 +7936,50 @@ function isCategorizationEnabledForStatus(status) {
|
|
|
7919
7936
|
}
|
|
7920
7937
|
}
|
|
7921
7938
|
}
|
|
7939
|
+
const CATEGORIES_TAG_KEY = "#categories";
|
|
7940
|
+
function buildKey$Y({
|
|
7941
|
+
access_token: accessToken,
|
|
7942
|
+
apiUrl,
|
|
7943
|
+
businessId,
|
|
7944
|
+
mode
|
|
7945
|
+
}) {
|
|
7946
|
+
if (accessToken && apiUrl) {
|
|
7947
|
+
return {
|
|
7948
|
+
accessToken,
|
|
7949
|
+
apiUrl,
|
|
7950
|
+
businessId,
|
|
7951
|
+
mode,
|
|
7952
|
+
tags: [CATEGORIES_TAG_KEY]
|
|
7953
|
+
};
|
|
7954
|
+
}
|
|
7955
|
+
}
|
|
7956
|
+
const getCategories = get$1(({ businessId, mode }) => {
|
|
7957
|
+
const parameters = toDefinedSearchParameters({ mode });
|
|
7958
|
+
return `/v1/businesses/${businessId}/categories?${parameters}`;
|
|
7959
|
+
});
|
|
7960
|
+
function useCategories({ mode } = {}) {
|
|
7961
|
+
const { data: auth } = useAuth();
|
|
7962
|
+
const { businessId } = useLayerContext();
|
|
7963
|
+
return useSWR(
|
|
7964
|
+
() => buildKey$Y(__spreadProps(__spreadValues({}, auth), {
|
|
7965
|
+
businessId,
|
|
7966
|
+
mode
|
|
7967
|
+
})),
|
|
7968
|
+
({ accessToken, apiUrl, businessId: businessId2, mode: mode2 }) => getCategories(
|
|
7969
|
+
apiUrl,
|
|
7970
|
+
accessToken,
|
|
7971
|
+
{
|
|
7972
|
+
params: {
|
|
7973
|
+
businessId: businessId2,
|
|
7974
|
+
mode: mode2
|
|
7975
|
+
}
|
|
7976
|
+
}
|
|
7977
|
+
)().then(({ data }) => effect.Schema.decodeUnknownPromise(CategoryListSchema)(data)).then((categoryList) => categoryList.categories)
|
|
7978
|
+
);
|
|
7979
|
+
}
|
|
7980
|
+
function usePreloadCategories(options2) {
|
|
7981
|
+
useCategories(options2);
|
|
7982
|
+
}
|
|
7922
7983
|
const useElementSize = (callback) => {
|
|
7923
7984
|
const ref = react.useRef(null);
|
|
7924
7985
|
const resizeTimeout = react.useRef(null);
|
|
@@ -8046,15 +8107,15 @@ const BankTransactionsContext = react.createContext({
|
|
|
8046
8107
|
isError: false,
|
|
8047
8108
|
refetch: () => {
|
|
8048
8109
|
},
|
|
8049
|
-
categorize: () => Promise.resolve(
|
|
8050
|
-
match: () => Promise.resolve(
|
|
8110
|
+
categorize: () => Promise.resolve(),
|
|
8111
|
+
match: () => Promise.resolve(),
|
|
8051
8112
|
metadata: {
|
|
8052
8113
|
pagination: {
|
|
8053
8114
|
cursor: void 0,
|
|
8054
8115
|
has_more: false
|
|
8055
8116
|
}
|
|
8056
8117
|
},
|
|
8057
|
-
|
|
8118
|
+
updateLocalBankTransactions: () => void 0,
|
|
8058
8119
|
shouldHideAfterCategorize: () => false,
|
|
8059
8120
|
removeAfterCategorize: () => void 0,
|
|
8060
8121
|
display: DisplayState.review,
|
|
@@ -8337,7 +8398,7 @@ const useBusinessActivationDate = () => {
|
|
|
8337
8398
|
const { business } = useLayerContext();
|
|
8338
8399
|
return react.useMemo(() => getActivationDate(business), [business]);
|
|
8339
8400
|
};
|
|
8340
|
-
function buildKey$
|
|
8401
|
+
function buildKey$X({
|
|
8341
8402
|
access_token: accessToken,
|
|
8342
8403
|
apiUrl,
|
|
8343
8404
|
businessId
|
|
@@ -8355,7 +8416,7 @@ function useBankTransactionsDownload() {
|
|
|
8355
8416
|
const { data } = useAuth();
|
|
8356
8417
|
const { businessId } = useLayerContext();
|
|
8357
8418
|
return useSWRMutation(
|
|
8358
|
-
() => buildKey$
|
|
8419
|
+
() => buildKey$X(__spreadProps(__spreadValues({}, data), {
|
|
8359
8420
|
businessId
|
|
8360
8421
|
})),
|
|
8361
8422
|
({
|
|
@@ -8513,7 +8574,7 @@ const BulkCategorizeRequestSchema = effect.Schema.Struct({
|
|
|
8513
8574
|
transactions: effect.Schema.Array(CategorizeTransactionRequestSchema$1)
|
|
8514
8575
|
});
|
|
8515
8576
|
const bulkCategorize = post(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/bulk-categorize`);
|
|
8516
|
-
function buildKey$
|
|
8577
|
+
function buildKey$W({
|
|
8517
8578
|
access_token: accessToken,
|
|
8518
8579
|
apiUrl,
|
|
8519
8580
|
businessId
|
|
@@ -8532,7 +8593,7 @@ const useBulkCategorize = () => {
|
|
|
8532
8593
|
const { businessId, eventCallbacks } = useLayerContext();
|
|
8533
8594
|
const { forceReloadBankTransactions } = useBankTransactionsGlobalCacheActions();
|
|
8534
8595
|
const mutationResponse = useSWRMutation(
|
|
8535
|
-
() => buildKey$
|
|
8596
|
+
() => buildKey$W(__spreadProps(__spreadValues({}, data), {
|
|
8536
8597
|
businessId
|
|
8537
8598
|
})),
|
|
8538
8599
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg }) => bulkCategorize(
|
|
@@ -8802,50 +8863,6 @@ const Span = react.forwardRef(
|
|
|
8802
8863
|
);
|
|
8803
8864
|
}
|
|
8804
8865
|
);
|
|
8805
|
-
const CATEGORIES_TAG_KEY = "#categories";
|
|
8806
|
-
function buildKey$S({
|
|
8807
|
-
access_token: accessToken,
|
|
8808
|
-
apiUrl,
|
|
8809
|
-
businessId,
|
|
8810
|
-
mode
|
|
8811
|
-
}) {
|
|
8812
|
-
if (accessToken && apiUrl) {
|
|
8813
|
-
return {
|
|
8814
|
-
accessToken,
|
|
8815
|
-
apiUrl,
|
|
8816
|
-
businessId,
|
|
8817
|
-
mode,
|
|
8818
|
-
tags: [CATEGORIES_TAG_KEY]
|
|
8819
|
-
};
|
|
8820
|
-
}
|
|
8821
|
-
}
|
|
8822
|
-
const getCategories = get$1(({ businessId, mode }) => {
|
|
8823
|
-
const parameters = toDefinedSearchParameters({ mode });
|
|
8824
|
-
return `/v1/businesses/${businessId}/categories?${parameters}`;
|
|
8825
|
-
});
|
|
8826
|
-
function useCategories({ mode } = {}) {
|
|
8827
|
-
const { data: auth } = useAuth();
|
|
8828
|
-
const { businessId } = useLayerContext();
|
|
8829
|
-
return useSWR(
|
|
8830
|
-
() => buildKey$S(__spreadProps(__spreadValues({}, auth), {
|
|
8831
|
-
businessId,
|
|
8832
|
-
mode
|
|
8833
|
-
})),
|
|
8834
|
-
({ accessToken, apiUrl, businessId: businessId2, mode: mode2 }) => getCategories(
|
|
8835
|
-
apiUrl,
|
|
8836
|
-
accessToken,
|
|
8837
|
-
{
|
|
8838
|
-
params: {
|
|
8839
|
-
businessId: businessId2,
|
|
8840
|
-
mode: mode2
|
|
8841
|
-
}
|
|
8842
|
-
}
|
|
8843
|
-
)().then(({ data }) => effect.Schema.decodeUnknownPromise(CategoryListSchema)(data)).then((categoryList) => categoryList.categories)
|
|
8844
|
-
);
|
|
8845
|
-
}
|
|
8846
|
-
function usePreloadCategories(options2) {
|
|
8847
|
-
useCategories(options2);
|
|
8848
|
-
}
|
|
8849
8866
|
const Check = (_R) => {
|
|
8850
8867
|
var _S = _R, { size = 18 } = _S, props = __objRest(_S, ["size"]);
|
|
8851
8868
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -8902,7 +8919,7 @@ function buildCustomGroupHeading({
|
|
|
8902
8919
|
const defaultRenderedGroupHeading = react.useMemo(() => /* @__PURE__ */ jsxRuntime.jsx(Header$2, { size: "xs", variant: "subtle", children }), [children]);
|
|
8903
8920
|
const content = GroupHeading ? /* @__PURE__ */ jsxRuntime.jsx(GroupHeading, { group: restProps.data, fallback: defaultRenderedGroupHeading }) : defaultRenderedGroupHeading;
|
|
8904
8921
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8905
|
-
|
|
8922
|
+
ReactSelect.components.GroupHeading,
|
|
8906
8923
|
__spreadProps(__spreadValues({}, restProps), {
|
|
8907
8924
|
className: COMBO_BOX_CLASS_NAMES.GROUP_HEADING,
|
|
8908
8925
|
children: content
|
|
@@ -8927,7 +8944,7 @@ function buildCustomComboBoxOption({
|
|
|
8927
8944
|
/* @__PURE__ */ jsxRuntime.jsx(Span, { variant: "inherit", children })
|
|
8928
8945
|
] }), [children]);
|
|
8929
8946
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8930
|
-
|
|
8947
|
+
ReactSelect.components.Option,
|
|
8931
8948
|
__spreadProps(__spreadValues({}, restProps), {
|
|
8932
8949
|
className: classNames(
|
|
8933
8950
|
COMBO_BOX_CLASS_NAMES.OPTION,
|
|
@@ -8949,7 +8966,7 @@ function buildCustomClearIndicator() {
|
|
|
8949
8966
|
"children"
|
|
8950
8967
|
]);
|
|
8951
8968
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8952
|
-
|
|
8969
|
+
ReactSelect.components.ClearIndicator,
|
|
8953
8970
|
__spreadProps(__spreadValues({}, restProps), {
|
|
8954
8971
|
className: COMBO_BOX_CLASS_NAMES.CLEAR_INDICATOR,
|
|
8955
8972
|
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.X, { size: 16 })
|
|
@@ -8971,10 +8988,10 @@ function buildCustomDropdownIndicator() {
|
|
|
8971
8988
|
]);
|
|
8972
8989
|
const { isDisabled } = restProps;
|
|
8973
8990
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8974
|
-
|
|
8991
|
+
ReactSelect.components.DropdownIndicator,
|
|
8975
8992
|
__spreadProps(__spreadValues({}, restProps), {
|
|
8976
8993
|
className: COMBO_BOX_CLASS_NAMES.DROPDOWN_INDICATOR,
|
|
8977
|
-
children: !isDisabled
|
|
8994
|
+
children: !isDisabled ? /* @__PURE__ */ jsxRuntime.jsx(lucideReact.ChevronDown, { size: 16 }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {})
|
|
8978
8995
|
})
|
|
8979
8996
|
);
|
|
8980
8997
|
};
|
|
@@ -8987,7 +9004,7 @@ function buildCustomNoOptionsMessage({ EmptyMessage }) {
|
|
|
8987
9004
|
"children"
|
|
8988
9005
|
]);
|
|
8989
9006
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8990
|
-
|
|
9007
|
+
ReactSelect.components.NoOptionsMessage,
|
|
8991
9008
|
__spreadProps(__spreadValues({}, restProps), {
|
|
8992
9009
|
className: COMBO_BOX_CLASS_NAMES.NO_OPTIONS_MESSAGE,
|
|
8993
9010
|
children: EmptyMessage != null ? EmptyMessage : /* @__PURE__ */ jsxRuntime.jsx(Span, { children: "No matching options" })
|
|
@@ -9004,7 +9021,7 @@ function buildCustomPlaceholder({ placeholder }) {
|
|
|
9004
9021
|
]);
|
|
9005
9022
|
if (!placeholder) return null;
|
|
9006
9023
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9007
|
-
|
|
9024
|
+
ReactSelect.components.Placeholder,
|
|
9008
9025
|
__spreadProps(__spreadValues({}, restProps), {
|
|
9009
9026
|
className: COMBO_BOX_CLASS_NAMES.PLACEHOLDER,
|
|
9010
9027
|
children: /* @__PURE__ */ jsxRuntime.jsx(Span, { variant: "placeholder", ellipsis: true, children: placeholder })
|
|
@@ -9020,7 +9037,7 @@ function buildCustomSingleValue({ SelectedValue }) {
|
|
|
9020
9037
|
"children"
|
|
9021
9038
|
]);
|
|
9022
9039
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9023
|
-
|
|
9040
|
+
ReactSelect.components.SingleValue,
|
|
9024
9041
|
__spreadProps(__spreadValues({}, restProps), {
|
|
9025
9042
|
children: SelectedValue != null ? SelectedValue : children
|
|
9026
9043
|
})
|
|
@@ -9036,7 +9053,7 @@ function buildCustomMenuPortal() {
|
|
|
9036
9053
|
]);
|
|
9037
9054
|
const dataProperties = toDataProperties({ "react-aria-top-layer": true });
|
|
9038
9055
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9039
|
-
|
|
9056
|
+
ReactSelect.components.MenuPortal,
|
|
9040
9057
|
__spreadProps(__spreadValues({}, restProps), {
|
|
9041
9058
|
innerProps: dataProperties,
|
|
9042
9059
|
children
|
|
@@ -9111,7 +9128,7 @@ function ComboBox(_T) {
|
|
|
9111
9128
|
const CustomDropdownIndicatorRef = react.useRef(buildCustomDropdownIndicator());
|
|
9112
9129
|
return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "3xs", fluid: true, className: className ? `${className}__Container` : void 0, children: [
|
|
9113
9130
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
9114
|
-
|
|
9131
|
+
ReactSelect,
|
|
9115
9132
|
__spreadProps(__spreadValues({
|
|
9116
9133
|
inputId: effectiveInputId
|
|
9117
9134
|
}, ariaProps), {
|
|
@@ -10423,7 +10440,7 @@ const BankTransactionsCategorizeAllModal = ({
|
|
|
10423
10440
|
const { selectedIds } = useSelectedIds();
|
|
10424
10441
|
const { clearSelection } = useBulkSelectionActions();
|
|
10425
10442
|
const [selectedCategory, setSelectedCategory] = react.useState(null);
|
|
10426
|
-
const { trigger } = useBulkCategorize();
|
|
10443
|
+
const { trigger, isMutating } = useBulkCategorize();
|
|
10427
10444
|
const handleCategorizeModalClose = react.useCallback((isOpen2) => {
|
|
10428
10445
|
onOpenChange(isOpen2);
|
|
10429
10446
|
if (!isOpen2) {
|
|
@@ -10459,7 +10476,7 @@ const BankTransactionsCategorizeAllModal = ({
|
|
|
10459
10476
|
title: mode === "Categorize" ? "Categorize all selected transactions?" : "Recategorize all selected transactions?",
|
|
10460
10477
|
content: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "xs", children: [
|
|
10461
10478
|
/* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "3xs", children: [
|
|
10462
|
-
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: categorySelectId, children: "Select category" }),
|
|
10479
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { size: "sm", htmlFor: categorySelectId, children: "Select category" }),
|
|
10463
10480
|
useCategorySelectDrawer ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
10464
10481
|
CategorySelectDrawerWithTrigger,
|
|
10465
10482
|
{
|
|
@@ -10474,7 +10491,8 @@ const BankTransactionsCategorizeAllModal = ({
|
|
|
10474
10491
|
inputId: categorySelectId,
|
|
10475
10492
|
selectedValue: selectedCategory,
|
|
10476
10493
|
onSelectedValueChange: setSelectedCategory,
|
|
10477
|
-
includeSuggestedMatches: false
|
|
10494
|
+
includeSuggestedMatches: false,
|
|
10495
|
+
isDisabled: isMutating
|
|
10478
10496
|
}
|
|
10479
10497
|
)
|
|
10480
10498
|
] }),
|
|
@@ -10523,7 +10541,7 @@ const bulkMatchOrCategorize = post(
|
|
|
10523
10541
|
return `/v1/businesses/${businessId}/bank-transactions/bulk-match-or-categorize?${parameters}`;
|
|
10524
10542
|
}
|
|
10525
10543
|
);
|
|
10526
|
-
function buildKey$
|
|
10544
|
+
function buildKey$V({
|
|
10527
10545
|
access_token: accessToken,
|
|
10528
10546
|
apiUrl,
|
|
10529
10547
|
businessId
|
|
@@ -10548,7 +10566,7 @@ const useBulkMatchOrCategorize = () => {
|
|
|
10548
10566
|
return { transactions };
|
|
10549
10567
|
}, [selectedIds, transactionCategories]);
|
|
10550
10568
|
const mutationResponse = useSWRMutation(
|
|
10551
|
-
() => buildKey$
|
|
10569
|
+
() => buildKey$V(__spreadProps(__spreadValues({}, data), {
|
|
10552
10570
|
businessId
|
|
10553
10571
|
})),
|
|
10554
10572
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg }) => bulkMatchOrCategorize(
|
|
@@ -10618,7 +10636,7 @@ const BulkUncategorizeRequestSchema = effect.Schema.Struct({
|
|
|
10618
10636
|
)
|
|
10619
10637
|
});
|
|
10620
10638
|
const bulkUncategorize = post(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/bulk-uncategorize`);
|
|
10621
|
-
function buildKey$
|
|
10639
|
+
function buildKey$U({
|
|
10622
10640
|
access_token: accessToken,
|
|
10623
10641
|
apiUrl,
|
|
10624
10642
|
businessId
|
|
@@ -10637,7 +10655,7 @@ const useBulkUncategorize = () => {
|
|
|
10637
10655
|
const { businessId, eventCallbacks } = useLayerContext();
|
|
10638
10656
|
const { forceReloadBankTransactions } = useBankTransactionsGlobalCacheActions();
|
|
10639
10657
|
const mutationResponse = useSWRMutation(
|
|
10640
|
-
() => buildKey$
|
|
10658
|
+
() => buildKey$U(__spreadProps(__spreadValues({}, data), {
|
|
10641
10659
|
businessId
|
|
10642
10660
|
})),
|
|
10643
10661
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg }) => bulkUncategorize(
|
|
@@ -11041,7 +11059,7 @@ const mapRawCustomAccountToCustomAccount = (raw) => ({
|
|
|
11041
11059
|
userCreated: raw.user_created
|
|
11042
11060
|
});
|
|
11043
11061
|
const CUSTOM_ACCOUNTS_TAG_KEY = "#custom-accounts";
|
|
11044
|
-
function buildKey$
|
|
11062
|
+
function buildKey$T({
|
|
11045
11063
|
access_token: accessToken,
|
|
11046
11064
|
apiUrl,
|
|
11047
11065
|
businessId,
|
|
@@ -11068,7 +11086,7 @@ function useCustomAccounts({ userCreated } = {}) {
|
|
|
11068
11086
|
const { data } = useAuth();
|
|
11069
11087
|
const { businessId } = useLayerContext();
|
|
11070
11088
|
return useSWR(
|
|
11071
|
-
() => buildKey$
|
|
11089
|
+
() => buildKey$T(__spreadProps(__spreadValues({}, data), {
|
|
11072
11090
|
businessId,
|
|
11073
11091
|
userCreated
|
|
11074
11092
|
})),
|
|
@@ -11081,7 +11099,7 @@ function useCustomAccounts({ userCreated } = {}) {
|
|
|
11081
11099
|
)().then(({ data: data2 }) => data2 == null ? void 0 : data2.custom_accounts.map((account) => mapRawCustomAccountToCustomAccount(account)))
|
|
11082
11100
|
);
|
|
11083
11101
|
}
|
|
11084
|
-
function buildKey$
|
|
11102
|
+
function buildKey$S({
|
|
11085
11103
|
access_token: accessToken,
|
|
11086
11104
|
apiUrl,
|
|
11087
11105
|
businessId
|
|
@@ -11114,7 +11132,7 @@ function useCustomAccountParseCsv() {
|
|
|
11114
11132
|
const { data } = useAuth();
|
|
11115
11133
|
const { businessId } = useLayerContext();
|
|
11116
11134
|
return useSWRMutation(
|
|
11117
|
-
() => buildKey$
|
|
11135
|
+
() => buildKey$S(__spreadProps(__spreadValues({}, data), {
|
|
11118
11136
|
businessId
|
|
11119
11137
|
})),
|
|
11120
11138
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg: { customAccountId, file } }) => parseCsv(
|
|
@@ -11359,7 +11377,7 @@ function flattenValidationErrors(errors) {
|
|
|
11359
11377
|
);
|
|
11360
11378
|
}
|
|
11361
11379
|
const createCustomAccount = post(({ businessId }) => `/v1/businesses/${businessId}/custom-accounts`);
|
|
11362
|
-
function buildKey$
|
|
11380
|
+
function buildKey$R({
|
|
11363
11381
|
access_token: accessToken,
|
|
11364
11382
|
apiUrl,
|
|
11365
11383
|
businessId
|
|
@@ -11378,7 +11396,7 @@ function useCreateCustomAccount() {
|
|
|
11378
11396
|
const { businessId } = useLayerContext();
|
|
11379
11397
|
const { mutate } = useSWR.useSWRConfig();
|
|
11380
11398
|
const mutationResponse = useSWRMutation(
|
|
11381
|
-
() => buildKey$
|
|
11399
|
+
() => buildKey$R(__spreadProps(__spreadValues({}, data), {
|
|
11382
11400
|
businessId
|
|
11383
11401
|
})),
|
|
11384
11402
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg: body }) => createCustomAccount(
|
|
@@ -11915,10 +11933,63 @@ function FormNumberField({
|
|
|
11915
11933
|
})
|
|
11916
11934
|
);
|
|
11917
11935
|
}
|
|
11936
|
+
const SWITCH_CLASS_NAME = "Layer__UI__Switch";
|
|
11937
|
+
const Switch = react.forwardRef((_Va, ref) => {
|
|
11938
|
+
var _Wa = _Va, {
|
|
11939
|
+
children,
|
|
11940
|
+
className
|
|
11941
|
+
} = _Wa, props = __objRest(_Wa, [
|
|
11942
|
+
"children",
|
|
11943
|
+
"className"
|
|
11944
|
+
]);
|
|
11945
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11946
|
+
reactAriaComponents.Switch,
|
|
11947
|
+
__spreadProps(__spreadValues({}, props), {
|
|
11948
|
+
className: classNames(SWITCH_CLASS_NAME, className),
|
|
11949
|
+
ref,
|
|
11950
|
+
children: withRenderProp(children, (node) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
11951
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { slot: "indicator" }),
|
|
11952
|
+
node
|
|
11953
|
+
] }))
|
|
11954
|
+
})
|
|
11955
|
+
);
|
|
11956
|
+
});
|
|
11957
|
+
Switch.displayName = "Switch";
|
|
11958
|
+
const FORM_SWITCH_FIELD_CLASSNAME = "Layer__FormSwitchField";
|
|
11959
|
+
function FormSwitchField({
|
|
11960
|
+
label,
|
|
11961
|
+
className,
|
|
11962
|
+
inline = false,
|
|
11963
|
+
showLabel = true,
|
|
11964
|
+
isReadOnly = false
|
|
11965
|
+
}) {
|
|
11966
|
+
const field = useFieldContext();
|
|
11967
|
+
const { name, state, handleChange } = field;
|
|
11968
|
+
const { value } = state;
|
|
11969
|
+
const additionalAriaProps = !showLabel && { "aria-label": label };
|
|
11970
|
+
const switchClassNames = classNames(
|
|
11971
|
+
FORM_SWITCH_FIELD_CLASSNAME,
|
|
11972
|
+
inline && `${FORM_SWITCH_FIELD_CLASSNAME}--inline`,
|
|
11973
|
+
className
|
|
11974
|
+
);
|
|
11975
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11976
|
+
Switch,
|
|
11977
|
+
__spreadProps(__spreadValues({
|
|
11978
|
+
className: switchClassNames,
|
|
11979
|
+
isSelected: value,
|
|
11980
|
+
onChange: handleChange,
|
|
11981
|
+
name,
|
|
11982
|
+
isReadOnly,
|
|
11983
|
+
slot: "switch"
|
|
11984
|
+
}, additionalAriaProps), {
|
|
11985
|
+
children: showLabel && /* @__PURE__ */ jsxRuntime.jsx(Label, { slot: "label", size: "sm", htmlFor: name, children: label })
|
|
11986
|
+
})
|
|
11987
|
+
);
|
|
11988
|
+
}
|
|
11918
11989
|
const TEXTAREA_CLASS_NAME = "Layer__UI__TextArea";
|
|
11919
11990
|
const TextArea = react.forwardRef(
|
|
11920
|
-
function TextArea2(
|
|
11921
|
-
var
|
|
11991
|
+
function TextArea2(_Xa, ref) {
|
|
11992
|
+
var _Ya = _Xa, { resize = "none" } = _Ya, restProps = __objRest(_Ya, ["resize"]);
|
|
11922
11993
|
const dataProperties = toDataProperties({ resize });
|
|
11923
11994
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
11924
11995
|
reactAriaComponents.TextArea,
|
|
@@ -11929,8 +12000,8 @@ const TextArea = react.forwardRef(
|
|
|
11929
12000
|
);
|
|
11930
12001
|
}
|
|
11931
12002
|
);
|
|
11932
|
-
function FormTextAreaField(
|
|
11933
|
-
var
|
|
12003
|
+
function FormTextAreaField(_Za) {
|
|
12004
|
+
var __a = _Za, { placeholder } = __a, props = __objRest(__a, ["placeholder"]);
|
|
11934
12005
|
const field = useFieldContext();
|
|
11935
12006
|
const { name, state, handleChange, handleBlur } = field;
|
|
11936
12007
|
const { value } = state;
|
|
@@ -11950,8 +12021,8 @@ function FormTextAreaField(_Xa) {
|
|
|
11950
12021
|
}
|
|
11951
12022
|
) }));
|
|
11952
12023
|
}
|
|
11953
|
-
function FormTextField(
|
|
11954
|
-
var
|
|
12024
|
+
function FormTextField(_$a) {
|
|
12025
|
+
var _ab = _$a, { placeholder } = _ab, props = __objRest(_ab, ["placeholder"]);
|
|
11955
12026
|
const field = useFieldContext();
|
|
11956
12027
|
const { name, state, handleChange, handleBlur } = field;
|
|
11957
12028
|
const { value } = state;
|
|
@@ -11979,6 +12050,7 @@ const { useAppForm: useRawAppForm } = reactForm.createFormHook({
|
|
|
11979
12050
|
FormCheckboxField,
|
|
11980
12051
|
FormDateField,
|
|
11981
12052
|
FormNumberField,
|
|
12053
|
+
FormSwitchField,
|
|
11982
12054
|
FormTextAreaField,
|
|
11983
12055
|
FormTextField
|
|
11984
12056
|
},
|
|
@@ -12039,13 +12111,13 @@ const useCustomAccountForm = ({ onSuccess }) => {
|
|
|
12039
12111
|
const isFormValid = reactForm.useStore(form.store, (state) => state.isValid);
|
|
12040
12112
|
return { form, submitError, isFormValid };
|
|
12041
12113
|
};
|
|
12042
|
-
const Input = (
|
|
12043
|
-
var
|
|
12114
|
+
const Input = (_bb) => {
|
|
12115
|
+
var _cb = _bb, {
|
|
12044
12116
|
className,
|
|
12045
12117
|
isInvalid,
|
|
12046
12118
|
errorMessage,
|
|
12047
12119
|
leftText
|
|
12048
|
-
} =
|
|
12120
|
+
} = _cb, props = __objRest(_cb, [
|
|
12049
12121
|
"className",
|
|
12050
12122
|
"isInvalid",
|
|
12051
12123
|
"errorMessage",
|
|
@@ -12091,8 +12163,8 @@ const InputGroup = ({
|
|
|
12091
12163
|
children
|
|
12092
12164
|
] });
|
|
12093
12165
|
};
|
|
12094
|
-
const ChevronDownFill = (
|
|
12095
|
-
var
|
|
12166
|
+
const ChevronDownFill = (_db) => {
|
|
12167
|
+
var _eb = _db, { size = 18 } = _eb, props = __objRest(_eb, ["size"]);
|
|
12096
12168
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12097
12169
|
"svg",
|
|
12098
12170
|
__spreadProps(__spreadValues({
|
|
@@ -12117,6 +12189,21 @@ const ChevronDownFill = (_bb) => {
|
|
|
12117
12189
|
})
|
|
12118
12190
|
);
|
|
12119
12191
|
};
|
|
12192
|
+
const SelectMenuPortal = (_fb) => {
|
|
12193
|
+
var _gb = _fb, {
|
|
12194
|
+
children
|
|
12195
|
+
} = _gb, restProps = __objRest(_gb, [
|
|
12196
|
+
"children"
|
|
12197
|
+
]);
|
|
12198
|
+
const dataProperties = toDataProperties({ "react-aria-top-layer": true });
|
|
12199
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
12200
|
+
ReactSelect.components.MenuPortal,
|
|
12201
|
+
__spreadProps(__spreadValues({}, restProps), {
|
|
12202
|
+
innerProps: dataProperties,
|
|
12203
|
+
children
|
|
12204
|
+
})
|
|
12205
|
+
);
|
|
12206
|
+
};
|
|
12120
12207
|
const Select = ({
|
|
12121
12208
|
name,
|
|
12122
12209
|
options: options2,
|
|
@@ -12137,10 +12224,10 @@ const Select = ({
|
|
|
12137
12224
|
isInvalid ? "Layer__select--error" : "",
|
|
12138
12225
|
className
|
|
12139
12226
|
);
|
|
12140
|
-
const DropdownIndicator = react.useCallback((props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12227
|
+
const DropdownIndicator = react.useCallback((props) => /* @__PURE__ */ jsxRuntime.jsx(ReactSelect.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownFill, {}) })), []);
|
|
12141
12228
|
return /* @__PURE__ */ jsxRuntime.jsxs(DeprecatedTooltip, { disabled: !isInvalid || !errorMessage, children: [
|
|
12142
12229
|
/* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12143
|
-
|
|
12230
|
+
ReactSelect,
|
|
12144
12231
|
{
|
|
12145
12232
|
inputId,
|
|
12146
12233
|
name,
|
|
@@ -12153,7 +12240,7 @@ const Select = ({
|
|
|
12153
12240
|
onChange: (newValue) => newValue && onChange(newValue),
|
|
12154
12241
|
menuPortalTarget: document.body,
|
|
12155
12242
|
styles: { menuPortal: (base) => __spreadProps(__spreadValues({}, base), { zIndex: 9999 }) },
|
|
12156
|
-
components: { DropdownIndicator },
|
|
12243
|
+
components: { DropdownIndicator, MenuPortal: SelectMenuPortal },
|
|
12157
12244
|
isLoading,
|
|
12158
12245
|
isDisabled: disabled
|
|
12159
12246
|
}
|
|
@@ -12161,8 +12248,8 @@ const Select = ({
|
|
|
12161
12248
|
/* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipContent, { className: "Layer__tooltip", children: errorMessage })
|
|
12162
12249
|
] });
|
|
12163
12250
|
};
|
|
12164
|
-
const ErrorText = (
|
|
12165
|
-
var
|
|
12251
|
+
const ErrorText = (_hb) => {
|
|
12252
|
+
var _ib = _hb, { className } = _ib, props = __objRest(_ib, ["className"]);
|
|
12166
12253
|
return /* @__PURE__ */ jsxRuntime.jsx(Text, __spreadProps(__spreadValues({}, props), { status: "error", className }));
|
|
12167
12254
|
};
|
|
12168
12255
|
const accountTypeOptions = [
|
|
@@ -12297,7 +12384,7 @@ const CreatableSelect = ({
|
|
|
12297
12384
|
isInvalid ? "Layer__select--error" : "",
|
|
12298
12385
|
className
|
|
12299
12386
|
);
|
|
12300
|
-
const DropdownIndicator = react.useCallback((props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
12387
|
+
const DropdownIndicator = react.useCallback((props) => /* @__PURE__ */ jsxRuntime.jsx(ReactSelect.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownFill, {}) })), []);
|
|
12301
12388
|
return /* @__PURE__ */ jsxRuntime.jsxs(DeprecatedTooltip, { disabled: !isInvalid || !errorMessage, children: [
|
|
12302
12389
|
/* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
12303
12390
|
BaseCreatableSelect,
|
|
@@ -12316,7 +12403,7 @@ const CreatableSelect = ({
|
|
|
12316
12403
|
formatCreateLabel: formatCreateLabel2,
|
|
12317
12404
|
menuPortalTarget: document.body,
|
|
12318
12405
|
styles: { menuPortal: (base) => __spreadProps(__spreadValues({}, base), { zIndex: 9999 }) },
|
|
12319
|
-
components: { DropdownIndicator },
|
|
12406
|
+
components: { DropdownIndicator, MenuPortal: SelectMenuPortal },
|
|
12320
12407
|
isLoading,
|
|
12321
12408
|
isDisabled: disabled,
|
|
12322
12409
|
isClearable,
|
|
@@ -12501,7 +12588,7 @@ function UploadTransactionsUploadCsvStep({ selectedAccount, onSelectAccount, sel
|
|
|
12501
12588
|
const createCustomAccountTransactions = post(
|
|
12502
12589
|
({ businessId, customAccountId }) => `/v1/businesses/${businessId}/custom-accounts/${customAccountId}/transactions`
|
|
12503
12590
|
);
|
|
12504
|
-
function buildKey$
|
|
12591
|
+
function buildKey$Q({
|
|
12505
12592
|
access_token: accessToken,
|
|
12506
12593
|
apiUrl,
|
|
12507
12594
|
businessId
|
|
@@ -12520,7 +12607,7 @@ function useCreateCustomAccountTransactions() {
|
|
|
12520
12607
|
const { data } = useAuth();
|
|
12521
12608
|
const { businessId } = useLayerContext();
|
|
12522
12609
|
return useSWRMutation(
|
|
12523
|
-
() => buildKey$
|
|
12610
|
+
() => buildKey$Q(__spreadProps(__spreadValues({}, data), {
|
|
12524
12611
|
businessId
|
|
12525
12612
|
})),
|
|
12526
12613
|
({ accessToken, apiUrl, businessId: businessId2 }, _a) => {
|
|
@@ -13020,8 +13107,8 @@ const BulkActionsModule = ({ slots }) => {
|
|
|
13020
13107
|
/* @__PURE__ */ jsxRuntime.jsx(slots.BulkActions, {})
|
|
13021
13108
|
] });
|
|
13022
13109
|
};
|
|
13023
|
-
const DownloadCloud = (
|
|
13024
|
-
var
|
|
13110
|
+
const DownloadCloud = (_jb) => {
|
|
13111
|
+
var _kb = _jb, { size = 18 } = _kb, props = __objRest(_kb, ["size"]);
|
|
13025
13112
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13026
13113
|
"svg",
|
|
13027
13114
|
__spreadProps(__spreadValues({
|
|
@@ -13273,8 +13360,8 @@ function MonthCalendar({
|
|
|
13273
13360
|
const POPOVER_CLASS_NAME = "Layer__Popover";
|
|
13274
13361
|
const POPOVER_CLASS_NAMES = `Layer__Portal ${POPOVER_CLASS_NAME}`;
|
|
13275
13362
|
const Popover = react.forwardRef(
|
|
13276
|
-
function Popover2(
|
|
13277
|
-
var
|
|
13363
|
+
function Popover2(_lb, ref) {
|
|
13364
|
+
var _mb = _lb, { flexInline = false } = _mb, restProps = __objRest(_mb, ["flexInline"]);
|
|
13278
13365
|
const dataProperties = toDataProperties({ "flex-inline": flexInline });
|
|
13279
13366
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
13280
13367
|
reactAriaComponents.Popover,
|
|
@@ -13671,8 +13758,8 @@ const BankTransactionsHeader = ({
|
|
|
13671
13758
|
}
|
|
13672
13759
|
);
|
|
13673
13760
|
};
|
|
13674
|
-
const Inbox = (
|
|
13675
|
-
var
|
|
13761
|
+
const Inbox = (_nb) => {
|
|
13762
|
+
var _ob = _nb, { size = 18 } = _ob, props = __objRest(_ob, ["size"]);
|
|
13676
13763
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
13677
13764
|
"svg",
|
|
13678
13765
|
__spreadProps(__spreadValues({
|
|
@@ -13756,7 +13843,7 @@ function BankTransactionsTableEmptyStates({
|
|
|
13756
13843
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__table-state-container", children: StateComponent });
|
|
13757
13844
|
}
|
|
13758
13845
|
const REJECT_CATEGORIZATION_RULE_SUGGESTION_TAG = "#reject-categorization-rule-suggestion";
|
|
13759
|
-
function buildKey$
|
|
13846
|
+
function buildKey$P({
|
|
13760
13847
|
access_token: accessToken,
|
|
13761
13848
|
apiUrl,
|
|
13762
13849
|
businessId
|
|
@@ -13777,7 +13864,7 @@ function useRejectCategorizationRulesUpdateSuggestion() {
|
|
|
13777
13864
|
const { data: auth } = useAuth();
|
|
13778
13865
|
const { businessId } = useLayerContext();
|
|
13779
13866
|
const mutationResponse = useSWRMutation(
|
|
13780
|
-
() => buildKey$
|
|
13867
|
+
() => buildKey$P({
|
|
13781
13868
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
13782
13869
|
apiUrl: auth == null ? void 0 : auth.apiUrl,
|
|
13783
13870
|
businessId
|
|
@@ -13996,7 +14083,7 @@ function useCategorizationRulesGlobalCacheActions() {
|
|
|
13996
14083
|
return { patchCategorizationRuleByKey, forceReloadCategorizationRules };
|
|
13997
14084
|
}
|
|
13998
14085
|
const CREATE_CATEGORIZATION_RULE_TAG = "#create-categorization-rule";
|
|
13999
|
-
function buildKey$
|
|
14086
|
+
function buildKey$O({
|
|
14000
14087
|
access_token: accessToken,
|
|
14001
14088
|
apiUrl,
|
|
14002
14089
|
businessId
|
|
@@ -14024,7 +14111,7 @@ function useCreateCategorizationRule() {
|
|
|
14024
14111
|
const { invalidatePnlDetailLines } = usePnlDetailLinesInvalidator();
|
|
14025
14112
|
const { forceReloadCategorizationRules } = useCategorizationRulesGlobalCacheActions();
|
|
14026
14113
|
const mutationResponse = useSWRMutation(
|
|
14027
|
-
() => buildKey$
|
|
14114
|
+
() => buildKey$O({
|
|
14028
14115
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
14029
14116
|
apiUrl: auth == null ? void 0 : auth.apiUrl,
|
|
14030
14117
|
businessId
|
|
@@ -14154,8 +14241,8 @@ function asMutable(a) {
|
|
|
14154
14241
|
const CSS_PREFIX$1 = "Layer__UI__Table";
|
|
14155
14242
|
const getClassName = (component, additionalClassNames, withHidden) => classNames(`${CSS_PREFIX$1}-${component}`, withHidden && `${CSS_PREFIX$1}-${component}--hidden`, additionalClassNames);
|
|
14156
14243
|
const Table$1 = react.forwardRef(
|
|
14157
|
-
(
|
|
14158
|
-
var
|
|
14244
|
+
(_pb, ref) => {
|
|
14245
|
+
var _qb = _pb, { children, className } = _qb, restProps = __objRest(_qb, ["children", "className"]);
|
|
14159
14246
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14160
14247
|
reactAriaComponents.Table,
|
|
14161
14248
|
__spreadProps(__spreadValues({
|
|
@@ -14168,8 +14255,8 @@ const Table$1 = react.forwardRef(
|
|
|
14168
14255
|
}
|
|
14169
14256
|
);
|
|
14170
14257
|
Table$1.displayName = "Table";
|
|
14171
|
-
const TableHeaderInner = (
|
|
14172
|
-
var
|
|
14258
|
+
const TableHeaderInner = (_rb, ref) => {
|
|
14259
|
+
var _sb = _rb, { children, className, hideHeader } = _sb, restProps = __objRest(_sb, ["children", "className", "hideHeader"]);
|
|
14173
14260
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14174
14261
|
reactAriaComponents.TableHeader,
|
|
14175
14262
|
__spreadProps(__spreadValues({
|
|
@@ -14182,8 +14269,8 @@ const TableHeaderInner = (_nb, ref) => {
|
|
|
14182
14269
|
};
|
|
14183
14270
|
const TableHeader = react.forwardRef(TableHeaderInner);
|
|
14184
14271
|
TableHeader.displayName = "TableHeader";
|
|
14185
|
-
const TableBodyInner = (
|
|
14186
|
-
var
|
|
14272
|
+
const TableBodyInner = (_tb, ref) => {
|
|
14273
|
+
var _ub = _tb, { children, className } = _ub, restProps = __objRest(_ub, ["children", "className"]);
|
|
14187
14274
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14188
14275
|
reactAriaComponents.TableBody,
|
|
14189
14276
|
__spreadProps(__spreadValues({
|
|
@@ -14196,8 +14283,8 @@ const TableBodyInner = (_pb, ref) => {
|
|
|
14196
14283
|
};
|
|
14197
14284
|
const TableBody$1 = react.forwardRef(TableBodyInner);
|
|
14198
14285
|
TableBody$1.displayName = "TableBody";
|
|
14199
|
-
const RowInner = (
|
|
14200
|
-
var
|
|
14286
|
+
const RowInner = (_vb, ref) => {
|
|
14287
|
+
var _wb = _vb, { children, className, depth = 0 } = _wb, restProps = __objRest(_wb, ["children", "className", "depth"]);
|
|
14201
14288
|
const dataProperties = toDataProperties({ depth });
|
|
14202
14289
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14203
14290
|
reactAriaComponents.Row,
|
|
@@ -14212,8 +14299,8 @@ const RowInner = (_rb, ref) => {
|
|
|
14212
14299
|
const Row = react.forwardRef(RowInner);
|
|
14213
14300
|
Row.displayName = "Row";
|
|
14214
14301
|
const Column = react.forwardRef(
|
|
14215
|
-
(
|
|
14216
|
-
var
|
|
14302
|
+
(_xb, ref) => {
|
|
14303
|
+
var _yb = _xb, { children, className, textAlign = "left" } = _yb, restProps = __objRest(_yb, ["children", "className", "textAlign"]);
|
|
14217
14304
|
const dataProperties = toDataProperties({ "text-align": textAlign });
|
|
14218
14305
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14219
14306
|
reactAriaComponents.Column,
|
|
@@ -14228,8 +14315,8 @@ const Column = react.forwardRef(
|
|
|
14228
14315
|
);
|
|
14229
14316
|
Column.displayName = "Column";
|
|
14230
14317
|
const Cell = react.forwardRef(
|
|
14231
|
-
(
|
|
14232
|
-
var
|
|
14318
|
+
(_zb, ref) => {
|
|
14319
|
+
var _Ab = _zb, { children, className } = _Ab, restProps = __objRest(_Ab, ["children", "className"]);
|
|
14233
14320
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14234
14321
|
reactAriaComponents.Cell,
|
|
14235
14322
|
__spreadProps(__spreadValues({
|
|
@@ -14254,7 +14341,7 @@ const DEFAULT_NUM_ROWS = 15;
|
|
|
14254
14341
|
const HEADER_HEIGHT = 52;
|
|
14255
14342
|
const DEFAULT_TABLE_HEIGHT = DEFAULT_ROW_HEIGHT * DEFAULT_NUM_ROWS + HEADER_HEIGHT - 2;
|
|
14256
14343
|
const CSS_PREFIX = "Layer__UI__VirtualizedTable";
|
|
14257
|
-
const EMPTY_ARRAY$
|
|
14344
|
+
const EMPTY_ARRAY$2 = [];
|
|
14258
14345
|
const VirtualizedDataTable = ({
|
|
14259
14346
|
columnConfig,
|
|
14260
14347
|
data,
|
|
@@ -14279,7 +14366,7 @@ const VirtualizedDataTable = ({
|
|
|
14279
14366
|
}, [data, height, rowHeight, shrinkHeightToFitRows]);
|
|
14280
14367
|
const columnHelper = reactTable.createColumnHelper();
|
|
14281
14368
|
const columns = Object.values(columnConfig);
|
|
14282
|
-
const tableData = data != null ? data : EMPTY_ARRAY$
|
|
14369
|
+
const tableData = data != null ? data : EMPTY_ARRAY$2;
|
|
14283
14370
|
const columnDefs = columns.map((col) => {
|
|
14284
14371
|
return columnHelper.display({
|
|
14285
14372
|
id: col.id,
|
|
@@ -14570,7 +14657,7 @@ const useSaveBankTransactionRow = () => {
|
|
|
14570
14657
|
return;
|
|
14571
14658
|
}
|
|
14572
14659
|
if (isSuggestedMatchAsOption(selectedCategory)) {
|
|
14573
|
-
return matchBankTransaction2(bankTransaction
|
|
14660
|
+
return matchBankTransaction2(bankTransaction, selectedCategory.original.id);
|
|
14574
14661
|
}
|
|
14575
14662
|
if (isSplitAsOption(selectedCategory)) {
|
|
14576
14663
|
const splitCategorizationRequest = buildCategorizeBankTransactionPayloadForSplit(selectedCategory.original);
|
|
@@ -14606,8 +14693,8 @@ function useDelayedVisibility({
|
|
|
14606
14693
|
);
|
|
14607
14694
|
return { isVisible };
|
|
14608
14695
|
}
|
|
14609
|
-
const File = (
|
|
14610
|
-
var
|
|
14696
|
+
const File = (_Bb) => {
|
|
14697
|
+
var _Cb = _Bb, { size = 12 } = _Cb, props = __objRest(_Cb, ["size"]);
|
|
14611
14698
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14612
14699
|
"svg",
|
|
14613
14700
|
__spreadProps(__spreadValues({
|
|
@@ -14690,14 +14777,14 @@ const variants = {
|
|
|
14690
14777
|
}
|
|
14691
14778
|
}
|
|
14692
14779
|
};
|
|
14693
|
-
const AnimatedPresenceDiv = (
|
|
14694
|
-
var
|
|
14780
|
+
const AnimatedPresenceDiv = (_Db) => {
|
|
14781
|
+
var _Eb = _Db, {
|
|
14695
14782
|
children,
|
|
14696
14783
|
variant,
|
|
14697
14784
|
isOpen,
|
|
14698
14785
|
slotProps = { AnimatePresence: { initial: false } },
|
|
14699
14786
|
key
|
|
14700
|
-
} =
|
|
14787
|
+
} = _Eb, props = __objRest(_Eb, [
|
|
14701
14788
|
"children",
|
|
14702
14789
|
"variant",
|
|
14703
14790
|
"isOpen",
|
|
@@ -14772,7 +14859,7 @@ const getBookkeepingPeriods = get$1(({ businessId }) => {
|
|
|
14772
14859
|
return `/v1/businesses/${businessId}/bookkeeping/periods`;
|
|
14773
14860
|
});
|
|
14774
14861
|
const BOOKKEEPING_PERIODS_TAG_KEY = "#bookkeeping-periods";
|
|
14775
|
-
function buildKey$
|
|
14862
|
+
function buildKey$N({
|
|
14776
14863
|
access_token: accessToken,
|
|
14777
14864
|
apiUrl,
|
|
14778
14865
|
businessId,
|
|
@@ -14793,7 +14880,7 @@ function useBookkeepingPeriods() {
|
|
|
14793
14880
|
const { data, isLoading: isLoadingBookkeepingStatus } = useBookkeepingStatus();
|
|
14794
14881
|
const isActiveOrPaused = data ? isActiveOrPausedBookkeepingStatus(data.status) : false;
|
|
14795
14882
|
const swrResponse = useSWR(
|
|
14796
|
-
() => buildKey$
|
|
14883
|
+
() => buildKey$N(__spreadProps(__spreadValues({}, auth), {
|
|
14797
14884
|
businessId,
|
|
14798
14885
|
isActiveOrPaused
|
|
14799
14886
|
})),
|
|
@@ -14817,8 +14904,8 @@ function useBookkeepingPeriods() {
|
|
|
14817
14904
|
}
|
|
14818
14905
|
});
|
|
14819
14906
|
}
|
|
14820
|
-
const Clock = (
|
|
14821
|
-
var
|
|
14907
|
+
const Clock = (_Fb) => {
|
|
14908
|
+
var _Gb = _Fb, { size = 18 } = _Gb, props = __objRest(_Gb, ["size"]);
|
|
14822
14909
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14823
14910
|
"svg",
|
|
14824
14911
|
__spreadProps(__spreadValues({
|
|
@@ -15144,8 +15231,8 @@ const useSplitsForm = ({
|
|
|
15144
15231
|
saveLocalSplitsToCategoryStore
|
|
15145
15232
|
};
|
|
15146
15233
|
};
|
|
15147
|
-
const ScissorsFullOpen = (
|
|
15148
|
-
var
|
|
15234
|
+
const ScissorsFullOpen = (_Hb) => {
|
|
15235
|
+
var _Ib = _Hb, { size = 12 } = _Ib, props = __objRest(_Ib, ["size"]);
|
|
15149
15236
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15150
15237
|
"svg",
|
|
15151
15238
|
__spreadProps(__spreadValues({
|
|
@@ -15210,8 +15297,8 @@ const ScissorsFullOpen = (_Db) => {
|
|
|
15210
15297
|
})
|
|
15211
15298
|
);
|
|
15212
15299
|
};
|
|
15213
|
-
const Trash = (
|
|
15214
|
-
var
|
|
15300
|
+
const Trash = (_Jb) => {
|
|
15301
|
+
var _Kb = _Jb, { size = 18 } = _Kb, props = __objRest(_Kb, ["size"]);
|
|
15215
15302
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
15216
15303
|
"svg",
|
|
15217
15304
|
__spreadProps(__spreadValues({
|
|
@@ -15273,7 +15360,7 @@ const useReceipts = ({
|
|
|
15273
15360
|
const { businessId } = useLayerContext();
|
|
15274
15361
|
const { apiUrl } = useEnvironment();
|
|
15275
15362
|
const { data: auth } = useAuth();
|
|
15276
|
-
const {
|
|
15363
|
+
const { updateLocalBankTransactions } = useBankTransactionsContext();
|
|
15277
15364
|
const [receiptUrls, setReceiptUrls] = react.useState([]);
|
|
15278
15365
|
react.useEffect(() => {
|
|
15279
15366
|
if (isActive && receiptUrls.length === 0 && hasReceipts(bankTransaction)) {
|
|
@@ -15329,10 +15416,10 @@ const useReceipts = ({
|
|
|
15329
15416
|
documentType: "RECEIPT"
|
|
15330
15417
|
});
|
|
15331
15418
|
yield fetchDocuments();
|
|
15332
|
-
if (
|
|
15333
|
-
|
|
15419
|
+
if (((_a = result == null ? void 0 : result.data) == null ? void 0 : _a.id) && (bankTransaction == null ? void 0 : bankTransaction.document_ids) && bankTransaction.document_ids.length === 0) {
|
|
15420
|
+
updateLocalBankTransactions([__spreadProps(__spreadValues({}, bankTransaction), {
|
|
15334
15421
|
document_ids: [result.data.id]
|
|
15335
|
-
}));
|
|
15422
|
+
})]);
|
|
15336
15423
|
}
|
|
15337
15424
|
} catch (_err) {
|
|
15338
15425
|
const newReceiptUrls = receipts.map((url) => {
|
|
@@ -15406,8 +15493,8 @@ const ReceiptsProvider = ({
|
|
|
15406
15493
|
const contextData = useReceipts({ bankTransaction, isActive });
|
|
15407
15494
|
return /* @__PURE__ */ jsxRuntime.jsx(ReceiptsContext.Provider, { value: contextData, children });
|
|
15408
15495
|
};
|
|
15409
|
-
const Eye = (
|
|
15410
|
-
var
|
|
15496
|
+
const Eye = (_Lb) => {
|
|
15497
|
+
var _Mb = _Lb, { size = 18 } = _Mb, props = __objRest(_Mb, ["size"]);
|
|
15411
15498
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
15412
15499
|
"svg",
|
|
15413
15500
|
__spreadProps(__spreadValues({
|
|
@@ -15543,11 +15630,11 @@ const FileThumb = ({
|
|
|
15543
15630
|
}
|
|
15544
15631
|
);
|
|
15545
15632
|
};
|
|
15546
|
-
const TextButton = (
|
|
15547
|
-
var
|
|
15633
|
+
const TextButton = (_Nb) => {
|
|
15634
|
+
var _Ob = _Nb, {
|
|
15548
15635
|
className,
|
|
15549
15636
|
children
|
|
15550
|
-
} =
|
|
15637
|
+
} = _Ob, props = __objRest(_Ob, [
|
|
15551
15638
|
"className",
|
|
15552
15639
|
"children"
|
|
15553
15640
|
]);
|
|
@@ -15631,8 +15718,8 @@ const openReceiptInNewTab = (url, index2) => (e) => {
|
|
|
15631
15718
|
`);
|
|
15632
15719
|
}
|
|
15633
15720
|
};
|
|
15634
|
-
const BankTransactionReceiptsWithProvider = react.forwardRef((
|
|
15635
|
-
var
|
|
15721
|
+
const BankTransactionReceiptsWithProvider = react.forwardRef((_Pb, ref) => {
|
|
15722
|
+
var _Qb = _Pb, { bankTransaction, isActive } = _Qb, props = __objRest(_Qb, ["bankTransaction", "isActive"]);
|
|
15636
15723
|
return /* @__PURE__ */ jsxRuntime.jsx(ReceiptsProvider, { bankTransaction, isActive, children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionReceipts, __spreadProps(__spreadValues({}, props), { ref })) });
|
|
15637
15724
|
});
|
|
15638
15725
|
BankTransactionReceiptsWithProvider.displayName = "BankTransactionReceiptsWithProvider";
|
|
@@ -15799,8 +15886,8 @@ const transformCurrencyValue = (rawValue) => {
|
|
|
15799
15886
|
}
|
|
15800
15887
|
return cleaned;
|
|
15801
15888
|
};
|
|
15802
|
-
const AmountInput = (
|
|
15803
|
-
var
|
|
15889
|
+
const AmountInput = (_Rb) => {
|
|
15890
|
+
var _Sb = _Rb, {
|
|
15804
15891
|
onChange,
|
|
15805
15892
|
className,
|
|
15806
15893
|
leftText,
|
|
@@ -15808,7 +15895,7 @@ const AmountInput = (_Nb) => {
|
|
|
15808
15895
|
isInvalid,
|
|
15809
15896
|
badge,
|
|
15810
15897
|
placeholder = "$0.00"
|
|
15811
|
-
} =
|
|
15898
|
+
} = _Sb, props = __objRest(_Sb, [
|
|
15812
15899
|
"onChange",
|
|
15813
15900
|
"className",
|
|
15814
15901
|
"leftText",
|
|
@@ -16128,7 +16215,7 @@ const ToggleOption = ({
|
|
|
16128
16215
|
] });
|
|
16129
16216
|
};
|
|
16130
16217
|
const GET_BANK_TRANSACTION_METADATA_TAG_KEY = "#bank-transaction-metadata";
|
|
16131
|
-
function buildKey$
|
|
16218
|
+
function buildKey$M({
|
|
16132
16219
|
access_token: accessToken,
|
|
16133
16220
|
apiUrl,
|
|
16134
16221
|
businessId,
|
|
@@ -16148,7 +16235,7 @@ function useBankTransactionMetadata({ bankTransactionId }) {
|
|
|
16148
16235
|
const { data: auth } = useAuth();
|
|
16149
16236
|
const { businessId } = useLayerContext();
|
|
16150
16237
|
return useSWR(
|
|
16151
|
-
() => buildKey$
|
|
16238
|
+
() => buildKey$M(__spreadProps(__spreadValues({}, auth), {
|
|
16152
16239
|
businessId,
|
|
16153
16240
|
bankTransactionId
|
|
16154
16241
|
})),
|
|
@@ -16160,7 +16247,25 @@ function useBankTransactionMetadata({ bankTransactionId }) {
|
|
|
16160
16247
|
);
|
|
16161
16248
|
}
|
|
16162
16249
|
const UPDATE_BANK_TRANSACTION_METADATA_TAG_KEY = "#update-bank-transaction-metadata";
|
|
16163
|
-
|
|
16250
|
+
class UpdateBankTransactionMetadataSWRResponse {
|
|
16251
|
+
constructor(swrResponse) {
|
|
16252
|
+
__publicField(this, "swrResponse");
|
|
16253
|
+
this.swrResponse = swrResponse;
|
|
16254
|
+
}
|
|
16255
|
+
get data() {
|
|
16256
|
+
return this.swrResponse.data;
|
|
16257
|
+
}
|
|
16258
|
+
get trigger() {
|
|
16259
|
+
return this.swrResponse.trigger;
|
|
16260
|
+
}
|
|
16261
|
+
get isMutating() {
|
|
16262
|
+
return this.swrResponse.isMutating;
|
|
16263
|
+
}
|
|
16264
|
+
get isError() {
|
|
16265
|
+
return this.swrResponse.error !== void 0;
|
|
16266
|
+
}
|
|
16267
|
+
}
|
|
16268
|
+
function buildKey$L({
|
|
16164
16269
|
access_token: accessToken,
|
|
16165
16270
|
apiUrl,
|
|
16166
16271
|
businessId,
|
|
@@ -16180,8 +16285,8 @@ function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
|
|
|
16180
16285
|
const { data: auth } = useAuth();
|
|
16181
16286
|
const { businessId } = useLayerContext();
|
|
16182
16287
|
const { mutate } = useSWR.useSWRConfig();
|
|
16183
|
-
const
|
|
16184
|
-
() => buildKey$
|
|
16288
|
+
const rawMutationResponse = useSWRMutation(
|
|
16289
|
+
() => buildKey$L({
|
|
16185
16290
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
16186
16291
|
apiUrl: auth == null ? void 0 : auth.apiUrl,
|
|
16187
16292
|
businessId,
|
|
@@ -16206,6 +16311,7 @@ function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
|
|
|
16206
16311
|
throwOnError: false
|
|
16207
16312
|
}
|
|
16208
16313
|
);
|
|
16314
|
+
const mutationResponse = new UpdateBankTransactionMetadataSWRResponse(rawMutationResponse);
|
|
16209
16315
|
const { trigger: originalTrigger } = mutationResponse;
|
|
16210
16316
|
const stableProxiedTrigger = react.useCallback(
|
|
16211
16317
|
(...triggerParameters) => __async(null, null, function* () {
|
|
@@ -16231,28 +16337,44 @@ function useUpdateBankTransactionMetadata({ bankTransactionId, onSuccess }) {
|
|
|
16231
16337
|
});
|
|
16232
16338
|
}
|
|
16233
16339
|
const useBankTransactionMemo = ({ bankTransactionId }) => {
|
|
16234
|
-
const {
|
|
16235
|
-
|
|
16340
|
+
const {
|
|
16341
|
+
trigger: updateBankTransactionMetadata2,
|
|
16342
|
+
isMutating: isUpdatingMemo,
|
|
16343
|
+
isError: isErrorUpdatingMemo,
|
|
16344
|
+
data: updateResult
|
|
16345
|
+
} = useUpdateBankTransactionMetadata({ bankTransactionId });
|
|
16346
|
+
const { data: bankTransactionMetadata, mutate: mutateBankTransactionMetadata } = useBankTransactionMetadata({ bankTransactionId });
|
|
16236
16347
|
const form = reactForm.useForm({
|
|
16237
16348
|
defaultValues: {
|
|
16238
16349
|
memo: bankTransactionMetadata == null ? void 0 : bankTransactionMetadata.memo
|
|
16239
16350
|
},
|
|
16240
16351
|
onSubmit: (_0) => __async(null, [_0], function* ({ value }) {
|
|
16241
|
-
var _a;
|
|
16352
|
+
var _a, _b;
|
|
16242
16353
|
if (value.memo !== void 0 && form.state.isDirty) {
|
|
16243
|
-
|
|
16244
|
-
|
|
16354
|
+
const result = yield mutateBankTransactionMetadata(
|
|
16355
|
+
updateBankTransactionMetadata2({ memo: (_a = value.memo) != null ? _a : "" }),
|
|
16356
|
+
{ optimisticData: { memo: (_b = value.memo) != null ? _b : "" }, revalidate: false }
|
|
16357
|
+
);
|
|
16358
|
+
if (result !== void 0) {
|
|
16359
|
+
form.reset(value);
|
|
16360
|
+
}
|
|
16245
16361
|
}
|
|
16246
16362
|
})
|
|
16247
16363
|
});
|
|
16248
|
-
|
|
16364
|
+
const isSaved = !isUpdatingMemo && !isErrorUpdatingMemo && updateResult !== void 0 && !form.state.isDirty;
|
|
16365
|
+
return react.useMemo(() => ({
|
|
16366
|
+
form,
|
|
16367
|
+
isUpdatingMemo,
|
|
16368
|
+
isErrorUpdatingMemo,
|
|
16369
|
+
isSaved
|
|
16370
|
+
}), [form, isErrorUpdatingMemo, isUpdatingMemo, isSaved]);
|
|
16249
16371
|
};
|
|
16250
|
-
const Textarea = (
|
|
16251
|
-
var
|
|
16372
|
+
const Textarea = (_Tb) => {
|
|
16373
|
+
var _Ub = _Tb, {
|
|
16252
16374
|
className,
|
|
16253
16375
|
isInvalid,
|
|
16254
16376
|
errorMessage
|
|
16255
|
-
} =
|
|
16377
|
+
} = _Ub, props = __objRest(_Ub, [
|
|
16256
16378
|
"className",
|
|
16257
16379
|
"isInvalid",
|
|
16258
16380
|
"errorMessage"
|
|
@@ -16268,24 +16390,26 @@ const Textarea = (_Pb) => {
|
|
|
16268
16390
|
] });
|
|
16269
16391
|
};
|
|
16270
16392
|
const BankTransactionMemo = ({ bankTransactionId }) => {
|
|
16271
|
-
const form = useBankTransactionMemo({ bankTransactionId });
|
|
16393
|
+
const { form, isUpdatingMemo, isErrorUpdatingMemo, isSaved } = useBankTransactionMemo({ bankTransactionId });
|
|
16272
16394
|
return /* @__PURE__ */ jsxRuntime.jsx("form", { onBlur: () => void form.handleSubmit(), children: /* @__PURE__ */ jsxRuntime.jsx(form.Field, { name: "memo", children: (field) => {
|
|
16273
16395
|
var _a;
|
|
16274
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
16275
|
-
|
|
16276
|
-
|
|
16277
|
-
|
|
16278
|
-
|
|
16279
|
-
|
|
16280
|
-
|
|
16281
|
-
|
|
16282
|
-
|
|
16283
|
-
|
|
16284
|
-
|
|
16285
|
-
|
|
16286
|
-
|
|
16287
|
-
|
|
16288
|
-
|
|
16396
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "3xs", children: [
|
|
16397
|
+
/* @__PURE__ */ jsxRuntime.jsxs(HStack, { justify: "space-between", align: "baseline", children: [
|
|
16398
|
+
/* @__PURE__ */ jsxRuntime.jsx(Label, { htmlFor: "memo", size: "sm", weight: "bold", children: "Description" }),
|
|
16399
|
+
isUpdatingMemo && /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", weight: "bold", variant: "subtle", children: "Saving..." }),
|
|
16400
|
+
!isUpdatingMemo && isSaved && /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", status: "success", children: "Saved" }),
|
|
16401
|
+
!isUpdatingMemo && !isSaved && isErrorUpdatingMemo && /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", weight: "bold", status: "error", children: "Error saving" })
|
|
16402
|
+
] }),
|
|
16403
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
16404
|
+
Textarea,
|
|
16405
|
+
{
|
|
16406
|
+
name: "memo",
|
|
16407
|
+
placeholder: "Add description",
|
|
16408
|
+
value: (_a = field.state.value) != null ? _a : void 0,
|
|
16409
|
+
onChange: (e) => field.handleChange(e.target.value)
|
|
16410
|
+
}
|
|
16411
|
+
)
|
|
16412
|
+
] });
|
|
16289
16413
|
} }) });
|
|
16290
16414
|
};
|
|
16291
16415
|
const range$1 = (start, end) => {
|
|
@@ -16343,7 +16467,7 @@ function useMinMutatingMutation({
|
|
|
16343
16467
|
});
|
|
16344
16468
|
}
|
|
16345
16469
|
const SET_METADATA_ON_BANK_TRANSACTION_TAG_KEY = "#set-metadata-on-bank-transaction";
|
|
16346
|
-
function buildKey$
|
|
16470
|
+
function buildKey$K({
|
|
16347
16471
|
access_token: accessToken,
|
|
16348
16472
|
apiUrl,
|
|
16349
16473
|
businessId,
|
|
@@ -16369,7 +16493,7 @@ function useSetMetadataOnBankTransaction({
|
|
|
16369
16493
|
const { data } = useAuth();
|
|
16370
16494
|
const { businessId } = useLayerContext();
|
|
16371
16495
|
const mutationResponse = useSWRMutation(
|
|
16372
|
-
() => buildKey$
|
|
16496
|
+
() => buildKey$K(__spreadProps(__spreadValues({}, data), {
|
|
16373
16497
|
businessId,
|
|
16374
16498
|
bankTransactionId
|
|
16375
16499
|
})),
|
|
@@ -16952,7 +17076,7 @@ function BankTransactionCustomerVendorVisibilityProvider({
|
|
|
16952
17076
|
}
|
|
16953
17077
|
const REMOVE_TAG_FROM_BANK_TRANSACTION_TAG_KEY = "#remove-tag-from-bank-transaction";
|
|
16954
17078
|
const removeTagFromBankTransaction = del(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/tags`);
|
|
16955
|
-
function buildKey$
|
|
17079
|
+
function buildKey$J({
|
|
16956
17080
|
access_token: accessToken,
|
|
16957
17081
|
apiUrl,
|
|
16958
17082
|
businessId,
|
|
@@ -16972,7 +17096,7 @@ function useRemoveTagFromBankTransaction({ bankTransactionId }) {
|
|
|
16972
17096
|
const { data } = useAuth();
|
|
16973
17097
|
const { businessId } = useLayerContext();
|
|
16974
17098
|
const mutationResponse = useSWRMutation(
|
|
16975
|
-
() => buildKey$
|
|
17099
|
+
() => buildKey$J(__spreadProps(__spreadValues({}, data), {
|
|
16976
17100
|
businessId,
|
|
16977
17101
|
bankTransactionId
|
|
16978
17102
|
})),
|
|
@@ -17031,7 +17155,7 @@ function useRemoveTagFromBankTransaction({ bankTransactionId }) {
|
|
|
17031
17155
|
}
|
|
17032
17156
|
const TAG_BANK_TRANSACTION_TAG_KEY = "#tag-bank-transaction";
|
|
17033
17157
|
const tagBankTransaction = post(({ businessId }) => `/v1/businesses/${businessId}/bank-transactions/tags`);
|
|
17034
|
-
function buildKey$
|
|
17158
|
+
function buildKey$I({
|
|
17035
17159
|
access_token: accessToken,
|
|
17036
17160
|
apiUrl,
|
|
17037
17161
|
businessId,
|
|
@@ -17051,7 +17175,7 @@ function useTagBankTransaction({ bankTransactionId }) {
|
|
|
17051
17175
|
const { data } = useAuth();
|
|
17052
17176
|
const { businessId } = useLayerContext();
|
|
17053
17177
|
const mutationResponse = useSWRMutation(
|
|
17054
|
-
() => buildKey$
|
|
17178
|
+
() => buildKey$I(__spreadProps(__spreadValues({}, data), {
|
|
17055
17179
|
businessId,
|
|
17056
17180
|
bankTransactionId
|
|
17057
17181
|
})),
|
|
@@ -17166,7 +17290,7 @@ const FallbackWithSkeletonLoader = ({
|
|
|
17166
17290
|
return children;
|
|
17167
17291
|
};
|
|
17168
17292
|
const TAG_DIMENSION_BY_KEY_TAG_KEY = "#tag-dimension-by-key";
|
|
17169
|
-
function buildKey$
|
|
17293
|
+
function buildKey$H({
|
|
17170
17294
|
access_token: accessToken,
|
|
17171
17295
|
apiUrl,
|
|
17172
17296
|
businessId,
|
|
@@ -17210,7 +17334,7 @@ function useTagDimensionByKey({ isEnabled = true, dimensionKey }) {
|
|
|
17210
17334
|
const { apiUrl } = useEnvironment();
|
|
17211
17335
|
const { businessId } = useLayerContext();
|
|
17212
17336
|
const swrResponse = useSWR(
|
|
17213
|
-
() => buildKey$
|
|
17337
|
+
() => buildKey$H(__spreadProps(__spreadValues({}, auth), {
|
|
17214
17338
|
apiUrl,
|
|
17215
17339
|
isEnabled,
|
|
17216
17340
|
businessId,
|
|
@@ -17425,10 +17549,7 @@ function BankTransactionFormFields({
|
|
|
17425
17549
|
isReadOnly
|
|
17426
17550
|
}
|
|
17427
17551
|
),
|
|
17428
|
-
showDescriptions && /* @__PURE__ */ jsxRuntime.
|
|
17429
|
-
/* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", weight: "bold", children: "Description" }),
|
|
17430
|
-
/* @__PURE__ */ jsxRuntime.jsx(BankTransactionMemo, { bankTransactionId: bankTransaction.id })
|
|
17431
|
-
] })
|
|
17552
|
+
showDescriptions && /* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "sm", children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionMemo, { bankTransactionId: bankTransaction.id }) })
|
|
17432
17553
|
] });
|
|
17433
17554
|
}
|
|
17434
17555
|
const ExpandedBankTransactionRow = react.forwardRef(
|
|
@@ -17556,7 +17677,7 @@ const ExpandedBankTransactionRow = react.forwardRef(
|
|
|
17556
17677
|
if (!foundMatch) {
|
|
17557
17678
|
return;
|
|
17558
17679
|
}
|
|
17559
|
-
yield matchBankTransaction2(bankTransaction
|
|
17680
|
+
yield matchBankTransaction2(bankTransaction, foundMatch.id);
|
|
17560
17681
|
deselect(bankTransaction.id);
|
|
17561
17682
|
close2();
|
|
17562
17683
|
});
|
|
@@ -17657,8 +17778,7 @@ const ExpandedBankTransactionRow = react.forwardRef(
|
|
|
17657
17778
|
onSelectedValueChange: (value) => {
|
|
17658
17779
|
changeCategoryForSplitAtIndex(index2, value);
|
|
17659
17780
|
},
|
|
17660
|
-
|
|
17661
|
-
isDisabled: !categorizationEnabled,
|
|
17781
|
+
isDisabled: !categorizationEnabled || bankTransaction.processing,
|
|
17662
17782
|
includeSuggestedMatches: false
|
|
17663
17783
|
}
|
|
17664
17784
|
),
|
|
@@ -17837,6 +17957,8 @@ const BankTransactionRow = ({
|
|
|
17837
17957
|
const { setTransactionCategory } = useBankTransactionsCategoryActions();
|
|
17838
17958
|
const { selectedCategory } = useGetBankTransactionCategory(bankTransaction.id);
|
|
17839
17959
|
const { saveBankTransactionRow } = useSaveBankTransactionRow();
|
|
17960
|
+
const isBeingRemoved = bankTransaction.recently_categorized && shouldHideAfterCategorize();
|
|
17961
|
+
const displayAsCategorized = isBeingRemoved ? false : categorized;
|
|
17840
17962
|
react.useEffect(() => {
|
|
17841
17963
|
if (bankTransaction.error) {
|
|
17842
17964
|
setShowRetry(true);
|
|
@@ -17870,7 +17992,7 @@ const BankTransactionRow = ({
|
|
|
17870
17992
|
const openClassName = open ? `${className}--expanded` : "";
|
|
17871
17993
|
const rowClassName = classNames(
|
|
17872
17994
|
className,
|
|
17873
|
-
|
|
17995
|
+
isBeingRemoved && editable ? "Layer__bank-transaction-row--removing" : "",
|
|
17874
17996
|
open ? openClassName : "",
|
|
17875
17997
|
initialLoad ? "initial-load" : "",
|
|
17876
17998
|
isVisible ? "show" : ""
|
|
@@ -17979,12 +18101,12 @@ const BankTransactionRow = ({
|
|
|
17979
18101
|
className: "Layer__bank-transaction__submit-btn",
|
|
17980
18102
|
processing: bankTransaction.processing,
|
|
17981
18103
|
active: open,
|
|
17982
|
-
action:
|
|
18104
|
+
action: displayAsCategorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
|
|
17983
18105
|
disabled: selectedCategory === null,
|
|
17984
|
-
children:
|
|
18106
|
+
children: displayAsCategorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Confirm"
|
|
17985
18107
|
}
|
|
17986
18108
|
),
|
|
17987
|
-
!categorizationEnabled && !
|
|
18109
|
+
!categorizationEnabled && !displayAsCategorized && /* @__PURE__ */ jsxRuntime.jsx(VStack, { pis: "lg", fluid: true, children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) }),
|
|
17988
18110
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
17989
18111
|
IconButton,
|
|
17990
18112
|
{
|
|
@@ -18006,7 +18128,7 @@ const BankTransactionRow = ({
|
|
|
18006
18128
|
variant: "fade",
|
|
18007
18129
|
isOpen: categorizationEnabled && !categorized,
|
|
18008
18130
|
className: "Layer__BankTransactionRow__CategoryComboBoxMotionContent",
|
|
18009
|
-
slotProps: { AnimatePresence: { mode: "wait" } },
|
|
18131
|
+
slotProps: { AnimatePresence: { mode: "wait", initial: false } },
|
|
18010
18132
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18011
18133
|
BankTransactionCategoryComboBox,
|
|
18012
18134
|
{
|
|
@@ -18016,20 +18138,20 @@ const BankTransactionRow = ({
|
|
|
18016
18138
|
setTransactionCategory(bankTransaction.id, selectedCategory2);
|
|
18017
18139
|
setShowRetry(false);
|
|
18018
18140
|
},
|
|
18019
|
-
|
|
18141
|
+
isDisabled: bankTransaction.processing
|
|
18020
18142
|
}
|
|
18021
18143
|
)
|
|
18022
18144
|
},
|
|
18023
18145
|
"category-combobox"
|
|
18024
18146
|
),
|
|
18025
|
-
|
|
18147
|
+
displayAsCategorized && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18026
18148
|
BankTransactionsCategorizedSelectedValue,
|
|
18027
18149
|
{
|
|
18028
18150
|
bankTransaction,
|
|
18029
18151
|
className: "Layer__bank-transaction-row__category"
|
|
18030
18152
|
}
|
|
18031
18153
|
),
|
|
18032
|
-
|
|
18154
|
+
!displayAsCategorized && categorizationEnabled && showRetry && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18033
18155
|
RetryButton,
|
|
18034
18156
|
{
|
|
18035
18157
|
onClick: () => {
|
|
@@ -18043,7 +18165,7 @@ const BankTransactionRow = ({
|
|
|
18043
18165
|
children: "Retry"
|
|
18044
18166
|
}
|
|
18045
18167
|
),
|
|
18046
|
-
!
|
|
18168
|
+
!displayAsCategorized && categorizationEnabled && !showRetry && !isBeingRemoved && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18047
18169
|
SubmitButton,
|
|
18048
18170
|
{
|
|
18049
18171
|
onClick: () => {
|
|
@@ -18055,12 +18177,12 @@ const BankTransactionRow = ({
|
|
|
18055
18177
|
processing: bankTransaction.processing,
|
|
18056
18178
|
active: open,
|
|
18057
18179
|
disabled: selectedCategory === null,
|
|
18058
|
-
action:
|
|
18059
|
-
children:
|
|
18180
|
+
action: displayAsCategorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
|
|
18181
|
+
children: displayAsCategorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Confirm"
|
|
18060
18182
|
}
|
|
18061
18183
|
),
|
|
18062
|
-
!categorizationEnabled && !
|
|
18063
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18184
|
+
!categorizationEnabled && !displayAsCategorized && !isBeingRemoved && /* @__PURE__ */ jsxRuntime.jsx(VStack, { pis: "xs", fluid: true, children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) }),
|
|
18185
|
+
!isBeingRemoved && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18064
18186
|
IconButton,
|
|
18065
18187
|
{
|
|
18066
18188
|
onClick: toggleOpen,
|
|
@@ -18083,7 +18205,7 @@ const BankTransactionRow = ({
|
|
|
18083
18205
|
{
|
|
18084
18206
|
ref: expandedRowRef,
|
|
18085
18207
|
bankTransaction,
|
|
18086
|
-
categorized,
|
|
18208
|
+
categorized: displayAsCategorized,
|
|
18087
18209
|
isOpen: open,
|
|
18088
18210
|
close: () => setOpen(false),
|
|
18089
18211
|
containerWidth,
|
|
@@ -18189,6 +18311,7 @@ const BankTransactionsListItem = ({
|
|
|
18189
18311
|
const bookkeepingStatus = useEffectiveBookkeepingStatus();
|
|
18190
18312
|
const categorizationEnabled = isCategorizationEnabledForStatus(bookkeepingStatus);
|
|
18191
18313
|
const categorized = isCategorized(bankTransaction);
|
|
18314
|
+
const displayAsCategorized = bankTransaction.recently_categorized && shouldHideAfterCategorize() ? false : categorized;
|
|
18192
18315
|
const { isVisible } = useDelayedVisibility({ delay: index2 * 80 });
|
|
18193
18316
|
const { select, deselect } = useBulkSelectionActions();
|
|
18194
18317
|
const isSelected = useIdIsSelected();
|
|
@@ -18285,7 +18408,7 @@ const BankTransactionsListItem = ({
|
|
|
18285
18408
|
}
|
|
18286
18409
|
)
|
|
18287
18410
|
] }),
|
|
18288
|
-
!categorizationEnabled && !
|
|
18411
|
+
!categorizationEnabled && !displayAsCategorized && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__bank-transaction-list-item__processing-info", children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, {}) }),
|
|
18289
18412
|
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "Layer__bank-transaction-list-item__expanded-row", onClick: preventRowExpansion, children: /* @__PURE__ */ jsxRuntime.jsx(AnimatedPresenceDiv, { variant: "expand", isOpen: openExpandedRow, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
18290
18413
|
ExpandedBankTransactionRow,
|
|
18291
18414
|
{
|
|
@@ -18293,9 +18416,9 @@ const BankTransactionsListItem = ({
|
|
|
18293
18416
|
bankTransaction,
|
|
18294
18417
|
isOpen: openExpandedRow,
|
|
18295
18418
|
close: () => setOpenExpandedRow(false),
|
|
18296
|
-
categorized,
|
|
18419
|
+
categorized: displayAsCategorized,
|
|
18297
18420
|
asListItem: true,
|
|
18298
|
-
submitBtnText:
|
|
18421
|
+
submitBtnText: displayAsCategorized ? (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update" : (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Approve",
|
|
18299
18422
|
containerWidth,
|
|
18300
18423
|
showDescriptions,
|
|
18301
18424
|
showReceiptUploads,
|
|
@@ -18303,7 +18426,7 @@ const BankTransactionsListItem = ({
|
|
|
18303
18426
|
variant: "list"
|
|
18304
18427
|
}
|
|
18305
18428
|
) }, `expanded-${bankTransaction.id}`) }),
|
|
18306
|
-
!openExpandedRow && categorizationEnabled && !
|
|
18429
|
+
!openExpandedRow && categorizationEnabled && !displayAsCategorized && /* @__PURE__ */ jsxRuntime.jsx("div", { onClick: preventRowExpansion, children: /* @__PURE__ */ jsxRuntime.jsxs(HStack, { pi: "md", gap: "md", pb: "md", children: [
|
|
18307
18430
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
18308
18431
|
BankTransactionCategoryComboBox,
|
|
18309
18432
|
{
|
|
@@ -18313,7 +18436,7 @@ const BankTransactionsListItem = ({
|
|
|
18313
18436
|
setTransactionCategory(bankTransaction.id, selectedCategory2);
|
|
18314
18437
|
setShowRetry(false);
|
|
18315
18438
|
},
|
|
18316
|
-
|
|
18439
|
+
isDisabled: bankTransaction.processing
|
|
18317
18440
|
}
|
|
18318
18441
|
),
|
|
18319
18442
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -18323,14 +18446,14 @@ const BankTransactionsListItem = ({
|
|
|
18323
18446
|
onClick: handleSave,
|
|
18324
18447
|
className: showRetry ? "Layer__bank-transaction__retry-btn" : "Layer__bank-transaction__submit-btn",
|
|
18325
18448
|
processing: bankTransaction.processing,
|
|
18326
|
-
action: !
|
|
18449
|
+
action: !displayAsCategorized ? SubmitAction.SAVE : SubmitAction.UPDATE,
|
|
18327
18450
|
withRetry: true,
|
|
18328
18451
|
error: showRetry ? "Approval failed. Check connection and retry in few seconds." : void 0,
|
|
18329
|
-
children: showRetry ? "Retry" : !
|
|
18452
|
+
children: showRetry ? "Retry" : !displayAsCategorized ? (stringOverrides == null ? void 0 : stringOverrides.approveButtonText) || "Approve" : (stringOverrides == null ? void 0 : stringOverrides.updateButtonText) || "Update"
|
|
18330
18453
|
}
|
|
18331
18454
|
)
|
|
18332
18455
|
] }) }),
|
|
18333
|
-
!openExpandedRow &&
|
|
18456
|
+
!openExpandedRow && displayAsCategorized && /* @__PURE__ */ jsxRuntime.jsx(
|
|
18334
18457
|
BankTransactionsListItemCategory,
|
|
18335
18458
|
{
|
|
18336
18459
|
bankTransaction
|
|
@@ -18396,26 +18519,6 @@ const BankTransactionsList = ({
|
|
|
18396
18519
|
) })
|
|
18397
18520
|
] });
|
|
18398
18521
|
};
|
|
18399
|
-
const SWITCH_CLASS_NAME = "Layer__Switch";
|
|
18400
|
-
const Switch = react.forwardRef((_Rb, ref) => {
|
|
18401
|
-
var _Sb = _Rb, {
|
|
18402
|
-
children
|
|
18403
|
-
} = _Sb, props = __objRest(_Sb, [
|
|
18404
|
-
"children"
|
|
18405
|
-
]);
|
|
18406
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18407
|
-
reactAriaComponents.Switch,
|
|
18408
|
-
__spreadProps(__spreadValues({}, props), {
|
|
18409
|
-
className: SWITCH_CLASS_NAME,
|
|
18410
|
-
ref,
|
|
18411
|
-
children: withRenderProp(children, (node) => /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
18412
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { slot: "indicator" }),
|
|
18413
|
-
node
|
|
18414
|
-
] }))
|
|
18415
|
-
})
|
|
18416
|
-
);
|
|
18417
|
-
});
|
|
18418
|
-
Switch.displayName = "Switch";
|
|
18419
18522
|
const BankTransactionsMobileBulkActionsHeader = ({
|
|
18420
18523
|
bankTransactions,
|
|
18421
18524
|
bulkActionsEnabled,
|
|
@@ -18539,8 +18642,8 @@ const BankTransactionsMobileListItemCheckbox = ({
|
|
|
18539
18642
|
}
|
|
18540
18643
|
) });
|
|
18541
18644
|
};
|
|
18542
|
-
const Paperclip = (
|
|
18543
|
-
var
|
|
18645
|
+
const Paperclip = (_Vb) => {
|
|
18646
|
+
var _Wb = _Vb, { size = 20 } = _Wb, props = __objRest(_Wb, ["size"]);
|
|
18544
18647
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
18545
18648
|
"svg",
|
|
18546
18649
|
__spreadProps(__spreadValues({
|
|
@@ -18988,7 +19091,7 @@ const BankTransactionsMobileListMatchForm = ({
|
|
|
18988
19091
|
if (!foundMatch) {
|
|
18989
19092
|
return;
|
|
18990
19093
|
}
|
|
18991
|
-
yield matchBankTransaction2(bankTransaction
|
|
19094
|
+
yield matchBankTransaction2(bankTransaction, foundMatch.id, true);
|
|
18992
19095
|
});
|
|
18993
19096
|
const save = () => {
|
|
18994
19097
|
var _a2;
|
|
@@ -19424,6 +19527,7 @@ const BankTransactionsMobileListItem = ({
|
|
|
19424
19527
|
const { shouldHideAfterCategorize } = useBankTransactionsContext();
|
|
19425
19528
|
const categorized = isCategorized(bankTransaction);
|
|
19426
19529
|
const itemRef = react.useRef(null);
|
|
19530
|
+
const displayAsCategorized = bankTransaction.recently_categorized && shouldHideAfterCategorize() ? false : categorized;
|
|
19427
19531
|
const [open, setOpen] = react.useState(isFirstItem);
|
|
19428
19532
|
const openNext = () => {
|
|
19429
19533
|
if (editable && itemRef.current && itemRef.current.nextSibling) {
|
|
@@ -19510,11 +19614,11 @@ const BankTransactionsMobileListItem = ({
|
|
|
19510
19614
|
const isTransactionSelected = isSelected(bankTransaction.id);
|
|
19511
19615
|
const { renderInAppLink } = useInAppLinkContext();
|
|
19512
19616
|
const inAppLink = react.useMemo(() => {
|
|
19513
|
-
if (!
|
|
19617
|
+
if (!displayAsCategorized) {
|
|
19514
19618
|
return null;
|
|
19515
19619
|
}
|
|
19516
19620
|
return getInAppLink(bankTransaction, renderInAppLink);
|
|
19517
|
-
}, [
|
|
19621
|
+
}, [displayAsCategorized, bankTransaction, renderInAppLink]);
|
|
19518
19622
|
const { isVisible } = useDelayedVisibility({ delay: index2 * 20, initialVisibility: Boolean(initialLoad) });
|
|
19519
19623
|
const className = "Layer__bank-transaction-mobile-list-item";
|
|
19520
19624
|
const openClassName = open ? `${className}--expanded` : "";
|
|
@@ -19581,7 +19685,7 @@ const BankTransactionsMobileListItem = ({
|
|
|
19581
19685
|
]
|
|
19582
19686
|
}
|
|
19583
19687
|
),
|
|
19584
|
-
!open && (!categorizationEnabled && !
|
|
19688
|
+
!open && (!categorizationEnabled && !displayAsCategorized ? /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsProcessingInfo, { showAsBadge: true }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
19585
19689
|
BankTransactionsListItemCategory,
|
|
19586
19690
|
{
|
|
19587
19691
|
bankTransaction,
|
|
@@ -19796,8 +19900,8 @@ const BankTransactionsTable = ({
|
|
|
19796
19900
|
}
|
|
19797
19901
|
);
|
|
19798
19902
|
};
|
|
19799
|
-
const BackArrow = (
|
|
19800
|
-
var
|
|
19903
|
+
const BackArrow = (_Xb) => {
|
|
19904
|
+
var _Yb = _Xb, { size = 18 } = _Yb, props = __objRest(_Yb, ["size"]);
|
|
19801
19905
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19802
19906
|
"svg",
|
|
19803
19907
|
__spreadProps(__spreadValues({
|
|
@@ -19830,7 +19934,7 @@ const BaseDetailView = ({ name, onGoBack, slots, children, borderless = false })
|
|
|
19830
19934
|
] });
|
|
19831
19935
|
};
|
|
19832
19936
|
const ARCHIVE_CATEGORIZATION_RULE_TAG = "#archive-categorization-rule";
|
|
19833
|
-
function buildKey$
|
|
19937
|
+
function buildKey$G({
|
|
19834
19938
|
access_token: accessToken,
|
|
19835
19939
|
apiUrl,
|
|
19836
19940
|
businessId
|
|
@@ -19855,7 +19959,7 @@ function useArchiveCategorizationRule() {
|
|
|
19855
19959
|
const { businessId } = useLayerContext();
|
|
19856
19960
|
const { forceReloadCategorizationRules } = useCategorizationRulesGlobalCacheActions();
|
|
19857
19961
|
const mutationResponse = useSWRMutation(
|
|
19858
|
-
() => buildKey$
|
|
19962
|
+
() => buildKey$G({
|
|
19859
19963
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
19860
19964
|
apiUrl: auth == null ? void 0 : auth.apiUrl,
|
|
19861
19965
|
businessId
|
|
@@ -19965,8 +20069,8 @@ const usePaginationRange = ({
|
|
|
19965
20069
|
}, [totalCount, pageSize, siblingCount, currentPage]);
|
|
19966
20070
|
return paginationRange;
|
|
19967
20071
|
};
|
|
19968
|
-
const ChevronLeft = (
|
|
19969
|
-
var props = __objRest(
|
|
20072
|
+
const ChevronLeft = (_Zb) => {
|
|
20073
|
+
var props = __objRest(_Zb, []);
|
|
19970
20074
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19971
20075
|
"svg",
|
|
19972
20076
|
__spreadProps(__spreadValues({
|
|
@@ -19988,8 +20092,8 @@ const ChevronLeft = (_Xb) => {
|
|
|
19988
20092
|
})
|
|
19989
20093
|
);
|
|
19990
20094
|
};
|
|
19991
|
-
const PaginationButton = (
|
|
19992
|
-
var
|
|
20095
|
+
const PaginationButton = (__b) => {
|
|
20096
|
+
var _$b = __b, { children, isSelected } = _$b, buttonProps = __objRest(_$b, ["children", "isSelected"]);
|
|
19993
20097
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
19994
20098
|
Button,
|
|
19995
20099
|
__spreadProps(__spreadValues({
|
|
@@ -20071,7 +20175,6 @@ const Pagination = ({
|
|
|
20071
20175
|
) }, "page-next")
|
|
20072
20176
|
] }) }) });
|
|
20073
20177
|
};
|
|
20074
|
-
const EMPTY_ARRAY$2 = [];
|
|
20075
20178
|
function PaginatedTable({
|
|
20076
20179
|
data,
|
|
20077
20180
|
isLoading,
|
|
@@ -20082,7 +20185,8 @@ function PaginatedTable({
|
|
|
20082
20185
|
paginationProps,
|
|
20083
20186
|
slots
|
|
20084
20187
|
}) {
|
|
20085
|
-
|
|
20188
|
+
var _a;
|
|
20189
|
+
const { pageSize = 20, hasMore, fetchMore, initialPage = 0, onSetPage, autoResetPageIndexRef } = paginationProps;
|
|
20086
20190
|
const [pagination, setPagination] = react.useState({ pageIndex: initialPage, pageSize });
|
|
20087
20191
|
const columnHelper = reactTable.createColumnHelper();
|
|
20088
20192
|
const columns = Object.values(columnConfig);
|
|
@@ -20094,7 +20198,7 @@ function PaginatedTable({
|
|
|
20094
20198
|
});
|
|
20095
20199
|
});
|
|
20096
20200
|
const table2 = reactTable.useReactTable({
|
|
20097
|
-
data: data != null ? data :
|
|
20201
|
+
data: data != null ? data : [],
|
|
20098
20202
|
columns: columnDefs,
|
|
20099
20203
|
state: { pagination },
|
|
20100
20204
|
onPaginationChange: (updaterOrValue) => {
|
|
@@ -20104,7 +20208,7 @@ function PaginatedTable({
|
|
|
20104
20208
|
},
|
|
20105
20209
|
getPaginationRowModel: reactTable.getPaginationRowModel(),
|
|
20106
20210
|
getCoreRowModel: reactTable.getCoreRowModel(),
|
|
20107
|
-
autoResetPageIndex: false
|
|
20211
|
+
autoResetPageIndex: (_a = autoResetPageIndexRef == null ? void 0 : autoResetPageIndexRef.current) != null ? _a : false
|
|
20108
20212
|
});
|
|
20109
20213
|
const { rows } = table2.getRowModel();
|
|
20110
20214
|
const rowData = react.useMemo(() => rows.map((r) => r.original), [rows]);
|
|
@@ -20350,7 +20454,7 @@ const SuggestedCategorizationRuleUpdatesDrawer = ({
|
|
|
20350
20454
|
] }) });
|
|
20351
20455
|
};
|
|
20352
20456
|
const TAG_DIMENSIONS_TAG_KEY = "#tag-dimensions";
|
|
20353
|
-
function buildKey$
|
|
20457
|
+
function buildKey$F({
|
|
20354
20458
|
access_token: accessToken,
|
|
20355
20459
|
apiUrl,
|
|
20356
20460
|
businessId,
|
|
@@ -20393,7 +20497,7 @@ function useTagDimensions({ isEnabled = true } = {}) {
|
|
|
20393
20497
|
const { apiUrl } = useEnvironment();
|
|
20394
20498
|
const { businessId } = useLayerContext();
|
|
20395
20499
|
const swrResponse = useSWR(
|
|
20396
|
-
() => buildKey$
|
|
20500
|
+
() => buildKey$F(__spreadProps(__spreadValues({}, auth), {
|
|
20397
20501
|
apiUrl,
|
|
20398
20502
|
businessId,
|
|
20399
20503
|
isEnabled
|
|
@@ -20418,8 +20522,8 @@ function usePreloadTagDimensions(parameters) {
|
|
|
20418
20522
|
useTagDimensions(parameters);
|
|
20419
20523
|
}
|
|
20420
20524
|
const COMPONENT_NAME$c = "bank-transactions";
|
|
20421
|
-
const BankTransactions = (
|
|
20422
|
-
var
|
|
20525
|
+
const BankTransactions = (_ac) => {
|
|
20526
|
+
var _bc = _ac, {
|
|
20423
20527
|
onError,
|
|
20424
20528
|
showTags = false,
|
|
20425
20529
|
showCustomerVendor = false,
|
|
@@ -20427,7 +20531,7 @@ const BankTransactions = (__b) => {
|
|
|
20427
20531
|
applyGlobalDateRange = false,
|
|
20428
20532
|
mode,
|
|
20429
20533
|
renderInAppLink
|
|
20430
|
-
} =
|
|
20534
|
+
} = _bc, props = __objRest(_bc, [
|
|
20431
20535
|
"onError",
|
|
20432
20536
|
"showTags",
|
|
20433
20537
|
"showCustomerVendor",
|
|
@@ -20439,6 +20543,7 @@ const BankTransactions = (__b) => {
|
|
|
20439
20543
|
usePreloadTagDimensions({ isEnabled: showTags });
|
|
20440
20544
|
usePreloadCustomers({ isEnabled: showCustomerVendor });
|
|
20441
20545
|
usePreloadVendors({ isEnabled: showCustomerVendor });
|
|
20546
|
+
usePreloadCategories();
|
|
20442
20547
|
return /* @__PURE__ */ jsxRuntime.jsx(ErrorBoundary, { onError, children: /* @__PURE__ */ jsxRuntime.jsx(CategorizationRulesProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(BankTransactionsRouteStoreProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
20443
20548
|
BankTransactionsProvider,
|
|
20444
20549
|
{
|
|
@@ -20585,7 +20690,7 @@ const BankTransactionsTableView = ({
|
|
|
20585
20690
|
const [listView, setListView] = react.useState(false);
|
|
20586
20691
|
const [containerWidth, setContainerWidth] = react.useState(0);
|
|
20587
20692
|
const debounceContainerWidth = debounce(setContainerWidth, 500);
|
|
20588
|
-
const removeTransaction = (bankTransaction) => removeAfterCategorize(bankTransaction);
|
|
20693
|
+
const removeTransaction = (bankTransaction) => removeAfterCategorize([bankTransaction.id]);
|
|
20589
20694
|
const containerRef = useElementSize((_el, _en, size) => {
|
|
20590
20695
|
if ((size == null ? void 0 : size.height) && (size == null ? void 0 : size.height) >= 90) {
|
|
20591
20696
|
const newShift = -Math.floor(size.height / 2) + 6;
|
|
@@ -20792,8 +20897,8 @@ function QuickbooksContextProvider({ children }) {
|
|
|
20792
20897
|
const quickbooksContextData = useQuickbooks();
|
|
20793
20898
|
return /* @__PURE__ */ jsxRuntime.jsx(QuickbooksContext.Provider, { value: quickbooksContextData, children });
|
|
20794
20899
|
}
|
|
20795
|
-
const Cog = (
|
|
20796
|
-
var
|
|
20900
|
+
const Cog = (_cc) => {
|
|
20901
|
+
var _dc = _cc, { size = 12 } = _dc, props = __objRest(_dc, ["size"]);
|
|
20797
20902
|
const id = react.useId();
|
|
20798
20903
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20799
20904
|
"svg",
|
|
@@ -20814,8 +20919,8 @@ const Cog = (_ac) => {
|
|
|
20814
20919
|
})
|
|
20815
20920
|
);
|
|
20816
20921
|
};
|
|
20817
|
-
const QuickbooksIcon = (
|
|
20818
|
-
var
|
|
20922
|
+
const QuickbooksIcon = (_ec) => {
|
|
20923
|
+
var _fc = _ec, { size = 24 } = _fc, props = __objRest(_fc, ["size"]);
|
|
20819
20924
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20820
20925
|
"svg",
|
|
20821
20926
|
__spreadProps(__spreadValues({
|
|
@@ -20974,8 +21079,8 @@ function IntegrationsQuickbooksUnlinkConfirmationModal({ isOpen, onOpenChange })
|
|
|
20974
21079
|
}
|
|
20975
21080
|
);
|
|
20976
21081
|
}
|
|
20977
|
-
const MoreVertical = (
|
|
20978
|
-
var
|
|
21082
|
+
const MoreVertical = (_gc) => {
|
|
21083
|
+
var _hc = _gc, { size = 18 } = _hc, props = __objRest(_hc, ["size"]);
|
|
20979
21084
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
20980
21085
|
"svg",
|
|
20981
21086
|
__spreadProps(__spreadValues({
|
|
@@ -21204,8 +21309,8 @@ const IntegrationsComponent = ({
|
|
|
21204
21309
|
(quickbooksConnectionStatus == null ? void 0 : quickbooksConnectionStatus.is_connected) && /* @__PURE__ */ jsxRuntime.jsx(IntegrationsContent, {})
|
|
21205
21310
|
] });
|
|
21206
21311
|
};
|
|
21207
|
-
const PlusIcon = (
|
|
21208
|
-
var
|
|
21312
|
+
const PlusIcon = (_ic) => {
|
|
21313
|
+
var _jc = _ic, { size = 14 } = _jc, props = __objRest(_jc, ["size"]);
|
|
21209
21314
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21210
21315
|
"svg",
|
|
21211
21316
|
__spreadProps(__spreadValues({
|
|
@@ -21247,8 +21352,8 @@ const PlusIcon = (_gc) => {
|
|
|
21247
21352
|
})
|
|
21248
21353
|
);
|
|
21249
21354
|
};
|
|
21250
|
-
const InstitutionIcon = (
|
|
21251
|
-
var
|
|
21355
|
+
const InstitutionIcon = (_kc) => {
|
|
21356
|
+
var _lc = _kc, { size = 18 } = _lc, props = __objRest(_lc, ["size"]);
|
|
21252
21357
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
21253
21358
|
"svg",
|
|
21254
21359
|
__spreadProps(__spreadValues({
|
|
@@ -21608,7 +21713,7 @@ function LinkedAccountToConfirm({
|
|
|
21608
21713
|
) })
|
|
21609
21714
|
] });
|
|
21610
21715
|
}
|
|
21611
|
-
function buildKey$
|
|
21716
|
+
function buildKey$E({
|
|
21612
21717
|
access_token: accessToken,
|
|
21613
21718
|
apiUrl,
|
|
21614
21719
|
businessId
|
|
@@ -21666,7 +21771,7 @@ function useConfirmAndExcludeMultiple({ onSuccess }) {
|
|
|
21666
21771
|
const { data: auth } = useAuth();
|
|
21667
21772
|
const { businessId } = useLayerContext();
|
|
21668
21773
|
return useSWRMutation(
|
|
21669
|
-
() => buildKey$
|
|
21774
|
+
() => buildKey$E({
|
|
21670
21775
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
21671
21776
|
apiUrl: auth == null ? void 0 : auth.apiUrl,
|
|
21672
21777
|
businessId
|
|
@@ -21866,8 +21971,8 @@ const MenuItem = react.forwardRef(
|
|
|
21866
21971
|
);
|
|
21867
21972
|
const PILL_CLASS_NAME = "Layer__Pill";
|
|
21868
21973
|
const Pill = react.forwardRef(
|
|
21869
|
-
function Pill2(
|
|
21870
|
-
var
|
|
21974
|
+
function Pill2(_mc, ref) {
|
|
21975
|
+
var _nc = _mc, { children, status } = _nc, restProps = __objRest(_nc, ["children", "status"]);
|
|
21871
21976
|
const dataProperties = toDataProperties({ status });
|
|
21872
21977
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
21873
21978
|
reactAriaComponents.Button,
|
|
@@ -22230,8 +22335,8 @@ const LinkedAccountsContent = ({
|
|
|
22230
22335
|
};
|
|
22231
22336
|
const CALENDAR_CLASS_NAME = "Layer__UI__Calendar";
|
|
22232
22337
|
const Calendar = react.forwardRef(
|
|
22233
|
-
function Calendar2(
|
|
22234
|
-
var
|
|
22338
|
+
function Calendar2(_oc, ref) {
|
|
22339
|
+
var _pc = _oc, { className, isReadOnly } = _pc, restProps = __objRest(_pc, ["className", "isReadOnly"]);
|
|
22235
22340
|
const dataProperties = toDataProperties({ readonly: isReadOnly });
|
|
22236
22341
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22237
22342
|
reactAriaComponents.Calendar,
|
|
@@ -22245,8 +22350,8 @@ const Calendar = react.forwardRef(
|
|
|
22245
22350
|
);
|
|
22246
22351
|
const CALENDAR_GRID_CLASS_NAME = "Layer__UI__CalendarGrid";
|
|
22247
22352
|
const CalendarGrid = react.forwardRef(
|
|
22248
|
-
function CalendarGrid2(
|
|
22249
|
-
var
|
|
22353
|
+
function CalendarGrid2(_qc, ref) {
|
|
22354
|
+
var _rc = _qc, { className } = _rc, restProps = __objRest(_rc, ["className"]);
|
|
22250
22355
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22251
22356
|
reactAriaComponents.CalendarGrid,
|
|
22252
22357
|
__spreadProps(__spreadValues({}, restProps), {
|
|
@@ -22258,8 +22363,8 @@ const CalendarGrid = react.forwardRef(
|
|
|
22258
22363
|
);
|
|
22259
22364
|
const CALENDAR_GRID_BODY_CLASS_NAME = "Layer__UI__CalendarGridBody";
|
|
22260
22365
|
const CalendarGridBody = react.forwardRef(
|
|
22261
|
-
function CalendarGridBody2(
|
|
22262
|
-
var
|
|
22366
|
+
function CalendarGridBody2(_sc, ref) {
|
|
22367
|
+
var _tc = _sc, { className } = _tc, restProps = __objRest(_tc, ["className"]);
|
|
22263
22368
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22264
22369
|
reactAriaComponents.CalendarGridBody,
|
|
22265
22370
|
__spreadProps(__spreadValues({}, restProps), {
|
|
@@ -22271,8 +22376,8 @@ const CalendarGridBody = react.forwardRef(
|
|
|
22271
22376
|
);
|
|
22272
22377
|
const CALENDAR_CELL_CLASS_NAME = "Layer__UI__CalendarCell";
|
|
22273
22378
|
const CalendarCell = react.forwardRef(
|
|
22274
|
-
function CalendarCell2(
|
|
22275
|
-
var
|
|
22379
|
+
function CalendarCell2(_uc, ref) {
|
|
22380
|
+
var _vc = _uc, { className, size = "sm" } = _vc, restProps = __objRest(_vc, ["className", "size"]);
|
|
22276
22381
|
const dataProperties = toDataProperties({ size });
|
|
22277
22382
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22278
22383
|
reactAriaComponents.CalendarCell,
|
|
@@ -22285,8 +22390,8 @@ const CalendarCell = react.forwardRef(
|
|
|
22285
22390
|
);
|
|
22286
22391
|
const CALENDAR_GRID_HEADER_CLASS_NAME = "Layer__UI__CalendarGridHeader";
|
|
22287
22392
|
const CalendarGridHeader = react.forwardRef(
|
|
22288
|
-
function CalendarGridHeader2(
|
|
22289
|
-
var
|
|
22393
|
+
function CalendarGridHeader2(_wc, ref) {
|
|
22394
|
+
var _xc = _wc, { className } = _xc, restProps = __objRest(_xc, ["className"]);
|
|
22290
22395
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22291
22396
|
reactAriaComponents.CalendarGridHeader,
|
|
22292
22397
|
__spreadProps(__spreadValues({}, restProps), {
|
|
@@ -22298,8 +22403,8 @@ const CalendarGridHeader = react.forwardRef(
|
|
|
22298
22403
|
);
|
|
22299
22404
|
const CALENDAR_HEADER_CELL_CLASS_NAME = "Layer__UI__CalendarHeaderCell";
|
|
22300
22405
|
const CalendarHeaderCell = react.forwardRef(
|
|
22301
|
-
function CalendarHeaderCell2(
|
|
22302
|
-
var
|
|
22406
|
+
function CalendarHeaderCell2(_yc, ref) {
|
|
22407
|
+
var _zc = _yc, { className, size = "sm" } = _zc, restProps = __objRest(_zc, ["className", "size"]);
|
|
22303
22408
|
const dataProperties = toDataProperties({ size });
|
|
22304
22409
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
22305
22410
|
reactAriaComponents.CalendarHeaderCell,
|
|
@@ -22541,7 +22646,7 @@ const AccountFormBox = ({
|
|
|
22541
22646
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: `${CLASS_NAME$3}__success-banner`, children: /* @__PURE__ */ jsxRuntime.jsx(CheckCircle, { size: 36 }) })
|
|
22542
22647
|
] }));
|
|
22543
22648
|
};
|
|
22544
|
-
function buildKey$
|
|
22649
|
+
function buildKey$D({
|
|
22545
22650
|
access_token: accessToken,
|
|
22546
22651
|
apiUrl,
|
|
22547
22652
|
businessId,
|
|
@@ -22597,7 +22702,7 @@ function useBulkSetOpeningBalanceAndDate(data, { onSuccess }) {
|
|
|
22597
22702
|
return errors;
|
|
22598
22703
|
};
|
|
22599
22704
|
return useSWRMutation(
|
|
22600
|
-
() => buildKey$
|
|
22705
|
+
() => buildKey$D({ access_token: auth == null ? void 0 : auth.access_token, apiUrl: auth == null ? void 0 : auth.apiUrl, businessId, data }),
|
|
22601
22706
|
({ accessToken, apiUrl, businessId: businessId2, data: data2 }) => Promise.allSettled(
|
|
22602
22707
|
data2.map(
|
|
22603
22708
|
({ accountId, openingDate, openingBalance, isDateInvalid }) => {
|
|
@@ -22869,6 +22974,33 @@ const applyShare = (items, total) => {
|
|
|
22869
22974
|
});
|
|
22870
22975
|
});
|
|
22871
22976
|
};
|
|
22977
|
+
const createPnlLineItemComparator = (filters) => {
|
|
22978
|
+
return (a, b) => {
|
|
22979
|
+
switch (filters == null ? void 0 : filters.sortBy) {
|
|
22980
|
+
case "category":
|
|
22981
|
+
if ((filters == null ? void 0 : filters.sortDirection) === "asc") {
|
|
22982
|
+
return a.displayName.localeCompare(b.displayName);
|
|
22983
|
+
}
|
|
22984
|
+
return b.displayName.localeCompare(a.displayName);
|
|
22985
|
+
case "type":
|
|
22986
|
+
if ((filters == null ? void 0 : filters.sortDirection) === "asc") {
|
|
22987
|
+
return a.type.localeCompare(b.type);
|
|
22988
|
+
}
|
|
22989
|
+
return b.type.localeCompare(a.type);
|
|
22990
|
+
default:
|
|
22991
|
+
if ((filters == null ? void 0 : filters.sortDirection) === "asc") {
|
|
22992
|
+
return a.value - b.value;
|
|
22993
|
+
}
|
|
22994
|
+
return b.value - a.value;
|
|
22995
|
+
}
|
|
22996
|
+
};
|
|
22997
|
+
};
|
|
22998
|
+
const sortPnlLineItemsAndCalculateTotal = (items, filter) => {
|
|
22999
|
+
const sorted = items.sort(createPnlLineItemComparator(filter));
|
|
23000
|
+
const total = sorted.reduce((x, { value }) => x + value, 0);
|
|
23001
|
+
const withShare = applyShare(sorted, total);
|
|
23002
|
+
return { items: withShare, total };
|
|
23003
|
+
};
|
|
22872
23004
|
const useProfitAndLoss = ({ tagFilter, reportingBasis }) => {
|
|
22873
23005
|
var _a;
|
|
22874
23006
|
const [displayMode, setDisplayMode] = react.useState("month");
|
|
@@ -22894,85 +23026,20 @@ const useProfitAndLoss = ({ tagFilter, reportingBasis }) => {
|
|
|
22894
23026
|
})
|
|
22895
23027
|
}));
|
|
22896
23028
|
};
|
|
22897
|
-
const setFilterTypes = (scope, types) => {
|
|
22898
|
-
setFilters(__spreadProps(__spreadValues({}, filters), {
|
|
22899
|
-
[scope]: __spreadProps(__spreadValues({}, filters[scope]), {
|
|
22900
|
-
types
|
|
22901
|
-
})
|
|
22902
|
-
}));
|
|
22903
|
-
};
|
|
22904
23029
|
const { filteredDataRevenue, filteredTotalRevenue } = react.useMemo(() => {
|
|
22905
|
-
var _a2;
|
|
22906
23030
|
if (!data) {
|
|
22907
23031
|
return { filteredDataRevenue: [], filteredTotalRevenue: void 0 };
|
|
22908
23032
|
}
|
|
22909
23033
|
const items = collectRevenueItems(data);
|
|
22910
|
-
const
|
|
22911
|
-
const filtered = items.map((x) => {
|
|
22912
|
-
if (revenueTypeFilters && revenueTypeFilters.length > 0 && !revenueTypeFilters.includes(x.type)) {
|
|
22913
|
-
return __spreadProps(__spreadValues({}, x), { isHidden: true });
|
|
22914
|
-
}
|
|
22915
|
-
return x;
|
|
22916
|
-
});
|
|
22917
|
-
const sorted = filtered.sort((a, b) => {
|
|
22918
|
-
var _a3, _b, _c, _d;
|
|
22919
|
-
switch ((_a3 = filters["revenue"]) == null ? void 0 : _a3.sortBy) {
|
|
22920
|
-
case "category":
|
|
22921
|
-
if (((_b = filters["revenue"]) == null ? void 0 : _b.sortDirection) === "asc") {
|
|
22922
|
-
return a.displayName.localeCompare(b.displayName);
|
|
22923
|
-
}
|
|
22924
|
-
return b.displayName.localeCompare(a.displayName);
|
|
22925
|
-
case "type":
|
|
22926
|
-
if (((_c = filters["revenue"]) == null ? void 0 : _c.sortDirection) === "asc") {
|
|
22927
|
-
return a.type.localeCompare(b.type);
|
|
22928
|
-
}
|
|
22929
|
-
return b.type.localeCompare(a.type);
|
|
22930
|
-
default:
|
|
22931
|
-
if (((_d = filters["revenue"]) == null ? void 0 : _d.sortDirection) === "asc") {
|
|
22932
|
-
return a.value - b.value;
|
|
22933
|
-
}
|
|
22934
|
-
return b.value - a.value;
|
|
22935
|
-
}
|
|
22936
|
-
});
|
|
22937
|
-
const total = sorted.filter((x) => !x.isHidden).reduce((x, { value }) => x + value, 0);
|
|
22938
|
-
const withShare = applyShare(sorted, total);
|
|
23034
|
+
const { items: withShare, total } = sortPnlLineItemsAndCalculateTotal(items, filters["revenue"]);
|
|
22939
23035
|
return { filteredDataRevenue: withShare, filteredTotalRevenue: total };
|
|
22940
23036
|
}, [data, filters]);
|
|
22941
23037
|
const { filteredDataExpenses, filteredTotalExpenses } = react.useMemo(() => {
|
|
22942
|
-
var _a2;
|
|
22943
23038
|
if (!data) {
|
|
22944
23039
|
return { filteredDataExpenses: [], filteredTotalExpenses: void 0 };
|
|
22945
23040
|
}
|
|
22946
23041
|
const items = collectExpensesItems(data);
|
|
22947
|
-
const
|
|
22948
|
-
const filtered = items.map((x) => {
|
|
22949
|
-
if (expenseTypeFilters && expenseTypeFilters.length > 0 && !expenseTypeFilters.includes(x.type)) {
|
|
22950
|
-
return __spreadProps(__spreadValues({}, x), { isHidden: true });
|
|
22951
|
-
}
|
|
22952
|
-
return x;
|
|
22953
|
-
});
|
|
22954
|
-
const sorted = filtered.sort((a, b) => {
|
|
22955
|
-
var _a3, _b, _c, _d;
|
|
22956
|
-
switch ((_a3 = filters["expenses"]) == null ? void 0 : _a3.sortBy) {
|
|
22957
|
-
case "category":
|
|
22958
|
-
if (((_b = filters["expenses"]) == null ? void 0 : _b.sortDirection) === "asc") {
|
|
22959
|
-
return a.displayName.localeCompare(b.displayName);
|
|
22960
|
-
}
|
|
22961
|
-
return b.displayName.localeCompare(a.displayName);
|
|
22962
|
-
case "type":
|
|
22963
|
-
if (((_c = filters["expenses"]) == null ? void 0 : _c.sortDirection) === "asc") {
|
|
22964
|
-
return a.type.localeCompare(b.type);
|
|
22965
|
-
}
|
|
22966
|
-
return b.type.localeCompare(a.type);
|
|
22967
|
-
default:
|
|
22968
|
-
if (((_d = filters["expenses"]) == null ? void 0 : _d.sortDirection) === "asc") {
|
|
22969
|
-
return a.value - b.value;
|
|
22970
|
-
}
|
|
22971
|
-
return b.value - a.value;
|
|
22972
|
-
}
|
|
22973
|
-
});
|
|
22974
|
-
const total = sorted.filter((x) => !x.isHidden).reduce((x, { value }) => x + value, 0);
|
|
22975
|
-
const withShare = applyShare(sorted, total);
|
|
23042
|
+
const { items: withShare, total } = sortPnlLineItemsAndCalculateTotal(items, filters["expenses"]);
|
|
22976
23043
|
return { filteredDataExpenses: withShare, filteredTotalExpenses: total };
|
|
22977
23044
|
}, [data, filters]);
|
|
22978
23045
|
const refetch = react.useCallback(() => {
|
|
@@ -22992,7 +23059,6 @@ const useProfitAndLoss = ({ tagFilter, reportingBasis }) => {
|
|
|
22992
23059
|
setSidebarScope,
|
|
22993
23060
|
sortBy,
|
|
22994
23061
|
filters,
|
|
22995
|
-
setFilterTypes,
|
|
22996
23062
|
tagFilter,
|
|
22997
23063
|
dateRange,
|
|
22998
23064
|
selectedLineItem,
|
|
@@ -23177,8 +23243,6 @@ const ProfitAndLossContext = react.createContext({
|
|
|
23177
23243
|
},
|
|
23178
23244
|
sortBy: () => {
|
|
23179
23245
|
},
|
|
23180
|
-
setFilterTypes: () => {
|
|
23181
|
-
},
|
|
23182
23246
|
filters: {
|
|
23183
23247
|
expenses: void 0,
|
|
23184
23248
|
revenue: void 0
|
|
@@ -23196,7 +23260,7 @@ const isNotOnlyNoneTag = (compareOptions) => {
|
|
|
23196
23260
|
compareOptions == null ? void 0 : compareOptions.some((option) => option.tagFilterConfig.tagFilters !== "None")
|
|
23197
23261
|
);
|
|
23198
23262
|
};
|
|
23199
|
-
function buildKey$
|
|
23263
|
+
function buildKey$C({
|
|
23200
23264
|
access_token: accessToken,
|
|
23201
23265
|
apiUrl,
|
|
23202
23266
|
businessId,
|
|
@@ -23254,7 +23318,7 @@ function useProfitAndLossComparison({
|
|
|
23254
23318
|
const { data: auth } = useAuth();
|
|
23255
23319
|
const periods = preparePeriodsBody(dateRange, comparePeriods, comparisonPeriodMode);
|
|
23256
23320
|
const tagFilters = prepareFiltersBody(selectedCompareOptions);
|
|
23257
|
-
const queryKey = buildKey$
|
|
23321
|
+
const queryKey = buildKey$C(__spreadProps(__spreadValues({}, auth), {
|
|
23258
23322
|
businessId,
|
|
23259
23323
|
periods,
|
|
23260
23324
|
tagFilters,
|
|
@@ -23414,8 +23478,8 @@ const useProfitAndLossLTM = ({ currentDate, tagFilter, reportingBasis } = {
|
|
|
23414
23478
|
refetch
|
|
23415
23479
|
};
|
|
23416
23480
|
};
|
|
23417
|
-
const BarChart2 = (
|
|
23418
|
-
var
|
|
23481
|
+
const BarChart2 = (_Ac) => {
|
|
23482
|
+
var _Bc = _Ac, { size = 12 } = _Bc, props = __objRest(_Bc, ["size"]);
|
|
23419
23483
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
23420
23484
|
"svg",
|
|
23421
23485
|
__spreadProps(__spreadValues({
|
|
@@ -24205,11 +24269,11 @@ const ProfitAndLossChart = ({
|
|
|
24205
24269
|
isSyncing && !hasNonZeroData ? /* @__PURE__ */ jsxRuntime.jsx(ChartStateCard, {}) : null
|
|
24206
24270
|
] });
|
|
24207
24271
|
};
|
|
24208
|
-
const BackButton = (
|
|
24209
|
-
var
|
|
24272
|
+
const BackButton = (_Cc) => {
|
|
24273
|
+
var _Dc = _Cc, {
|
|
24210
24274
|
className,
|
|
24211
24275
|
textOnly = false
|
|
24212
|
-
} =
|
|
24276
|
+
} = _Dc, props = __objRest(_Dc, [
|
|
24213
24277
|
"className",
|
|
24214
24278
|
"textOnly"
|
|
24215
24279
|
]);
|
|
@@ -24257,8 +24321,8 @@ const TASKS_CHARTS_COLORS = {
|
|
|
24257
24321
|
done: "#3B9C63",
|
|
24258
24322
|
pending: "#DFA000"
|
|
24259
24323
|
};
|
|
24260
|
-
const SortArrows = (
|
|
24261
|
-
var
|
|
24324
|
+
const SortArrows = (_Ec) => {
|
|
24325
|
+
var _Fc = _Ec, { size = 13 } = _Fc, props = __objRest(_Fc, ["size"]);
|
|
24262
24326
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24263
24327
|
"svg",
|
|
24264
24328
|
__spreadProps(__spreadValues({
|
|
@@ -24325,39 +24389,12 @@ const SortArrows = (_Cc) => {
|
|
|
24325
24389
|
);
|
|
24326
24390
|
};
|
|
24327
24391
|
const UNCATEGORIZED_TYPES = ["UNCATEGORIZED_INFLOWS", "UNCATEGORIZED_OUTFLOWS"];
|
|
24328
|
-
const mapTypesToColors = (data, colorList = DEFAULT_CHART_COLOR_TYPE) => {
|
|
24329
|
-
const typeToColor = {};
|
|
24330
|
-
const typeToLastOpacity = {};
|
|
24331
|
-
let colorIndex = 0;
|
|
24332
|
-
return data.map((obj) => {
|
|
24333
|
-
var _a;
|
|
24334
|
-
const type = (_a = obj.name) != null ? _a : obj.type;
|
|
24335
|
-
if (type === "Uncategorized") {
|
|
24336
|
-
return {
|
|
24337
|
-
color: "#EEEEF0",
|
|
24338
|
-
opacity: 1
|
|
24339
|
-
};
|
|
24340
|
-
}
|
|
24341
|
-
if (!typeToColor[type]) {
|
|
24342
|
-
typeToColor[type] = colorList[colorIndex % colorList.length];
|
|
24343
|
-
colorIndex++;
|
|
24344
|
-
typeToLastOpacity[type] = 1;
|
|
24345
|
-
} else {
|
|
24346
|
-
typeToLastOpacity[type] -= 0.1;
|
|
24347
|
-
}
|
|
24348
|
-
const opacity = typeToLastOpacity[type];
|
|
24349
|
-
return {
|
|
24350
|
-
color: typeToColor[type],
|
|
24351
|
-
opacity
|
|
24352
|
-
};
|
|
24353
|
-
});
|
|
24354
|
-
};
|
|
24355
24392
|
const ValueIcon = ({
|
|
24356
24393
|
item,
|
|
24357
24394
|
typeColorMapping,
|
|
24358
24395
|
idx
|
|
24359
24396
|
}) => {
|
|
24360
|
-
if (item
|
|
24397
|
+
if (isLineItemUncategorized(item)) {
|
|
24361
24398
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24362
24399
|
"svg",
|
|
24363
24400
|
{
|
|
@@ -24424,7 +24461,7 @@ const DetailedTable = ({
|
|
|
24424
24461
|
);
|
|
24425
24462
|
};
|
|
24426
24463
|
const typeColorMapping = mapTypesToColors(filteredData, chartColorsList);
|
|
24427
|
-
const positiveTotal = filteredData.filter((x) =>
|
|
24464
|
+
const positiveTotal = filteredData.filter((x) => x.value > 0).reduce((sum, x) => sum + x.value, 0);
|
|
24428
24465
|
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "details-container", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "table", children: /* @__PURE__ */ jsxRuntime.jsxs("table", { children: [
|
|
24429
24466
|
/* @__PURE__ */ jsxRuntime.jsx("thead", { children: /* @__PURE__ */ jsxRuntime.jsxs("tr", { children: [
|
|
24430
24467
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
@@ -24465,16 +24502,16 @@ const DetailedTable = ({
|
|
|
24465
24502
|
}
|
|
24466
24503
|
)
|
|
24467
24504
|
] }) }),
|
|
24468
|
-
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: filteredData.
|
|
24505
|
+
/* @__PURE__ */ jsxRuntime.jsx("tbody", { children: filteredData.map((item, idx) => {
|
|
24469
24506
|
const share = item.value > 0 ? item.value / positiveTotal : 0;
|
|
24470
24507
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
24471
24508
|
"tr",
|
|
24472
24509
|
{
|
|
24473
24510
|
className: classNames(
|
|
24474
24511
|
"Layer__profit-and-loss-detailed-table__row",
|
|
24475
|
-
hoveredItem && hoveredItem === item.
|
|
24512
|
+
hoveredItem && hoveredItem.name === item.name ? "active" : ""
|
|
24476
24513
|
),
|
|
24477
|
-
onMouseEnter: () => setHoveredItem(item
|
|
24514
|
+
onMouseEnter: () => setHoveredItem(item),
|
|
24478
24515
|
onMouseLeave: () => setHoveredItem(void 0),
|
|
24479
24516
|
children: [
|
|
24480
24517
|
/* @__PURE__ */ jsxRuntime.jsx("td", { className: "category-col", children: item.displayName }),
|
|
@@ -24506,6 +24543,35 @@ const DetailedTable = ({
|
|
|
24506
24543
|
}) })
|
|
24507
24544
|
] }) }) });
|
|
24508
24545
|
};
|
|
24546
|
+
const isLineItemUncategorized = (item) => {
|
|
24547
|
+
return UNCATEGORIZED_TYPES.includes(item.name);
|
|
24548
|
+
};
|
|
24549
|
+
const mapTypesToColors = (data, colorList = DEFAULT_CHART_COLOR_TYPE) => {
|
|
24550
|
+
const nameToColor = {};
|
|
24551
|
+
const nameToLastOpacity = {};
|
|
24552
|
+
let colorIndex = 0;
|
|
24553
|
+
return data.map((lineItem) => {
|
|
24554
|
+
if (isLineItemUncategorized(lineItem)) {
|
|
24555
|
+
return {
|
|
24556
|
+
color: "#EEEEF0",
|
|
24557
|
+
opacity: 1
|
|
24558
|
+
};
|
|
24559
|
+
}
|
|
24560
|
+
const name = lineItem.name;
|
|
24561
|
+
if (!nameToColor[name]) {
|
|
24562
|
+
nameToColor[name] = colorList[colorIndex % colorList.length];
|
|
24563
|
+
colorIndex++;
|
|
24564
|
+
nameToLastOpacity[name] = 1;
|
|
24565
|
+
} else {
|
|
24566
|
+
nameToLastOpacity[name] -= 0.1;
|
|
24567
|
+
}
|
|
24568
|
+
const opacity = nameToLastOpacity[name];
|
|
24569
|
+
return {
|
|
24570
|
+
color: nameToColor[name],
|
|
24571
|
+
opacity
|
|
24572
|
+
};
|
|
24573
|
+
});
|
|
24574
|
+
};
|
|
24509
24575
|
const DetailedChart = ({
|
|
24510
24576
|
filteredData,
|
|
24511
24577
|
filteredTotal,
|
|
@@ -24516,18 +24582,9 @@ const DetailedChart = ({
|
|
|
24516
24582
|
showDatePicker = true
|
|
24517
24583
|
}) => {
|
|
24518
24584
|
const chartData = react.useMemo(
|
|
24519
|
-
() => filteredData.map((x) => {
|
|
24520
|
-
|
|
24521
|
-
|
|
24522
|
-
name: x.displayName,
|
|
24523
|
-
value: 0
|
|
24524
|
-
});
|
|
24525
|
-
}
|
|
24526
|
-
return __spreadProps(__spreadValues({}, x), {
|
|
24527
|
-
name: x.displayName,
|
|
24528
|
-
value: x.value > 0 ? x.value : 0
|
|
24529
|
-
});
|
|
24530
|
-
}),
|
|
24585
|
+
() => filteredData.map((x) => __spreadProps(__spreadValues({}, x), {
|
|
24586
|
+
value: x.value > 0 ? x.value : 0
|
|
24587
|
+
})),
|
|
24531
24588
|
[filteredData]
|
|
24532
24589
|
);
|
|
24533
24590
|
const noValue = chartData.length === 0 || !chartData.find((x) => x.value !== 0);
|
|
@@ -24573,7 +24630,7 @@ const DetailedChart = ({
|
|
|
24573
24630
|
{
|
|
24574
24631
|
data: chartData,
|
|
24575
24632
|
dataKey: "value",
|
|
24576
|
-
nameKey: "
|
|
24633
|
+
nameKey: "displayName",
|
|
24577
24634
|
cx: "50%",
|
|
24578
24635
|
cy: "50%",
|
|
24579
24636
|
innerRadius: "91%",
|
|
@@ -24586,7 +24643,7 @@ const DetailedChart = ({
|
|
|
24586
24643
|
chartData.map((entry, index2) => {
|
|
24587
24644
|
let fill = typeColorMapping[index2].color;
|
|
24588
24645
|
let active = true;
|
|
24589
|
-
if (hoveredItem && entry.name !== hoveredItem) {
|
|
24646
|
+
if (hoveredItem && entry.name !== hoveredItem.name) {
|
|
24590
24647
|
active = false;
|
|
24591
24648
|
fill = void 0;
|
|
24592
24649
|
}
|
|
@@ -24596,13 +24653,13 @@ const DetailedChart = ({
|
|
|
24596
24653
|
className: classNames(
|
|
24597
24654
|
"Layer__profit-and-loss-detailed-charts__pie",
|
|
24598
24655
|
hoveredItem && active ? "active" : "inactive",
|
|
24599
|
-
entry
|
|
24656
|
+
isLineItemUncategorized(entry) && "Layer__profit-and-loss-detailed-charts__pie--border"
|
|
24600
24657
|
),
|
|
24601
24658
|
style: {
|
|
24602
|
-
fill: entry
|
|
24659
|
+
fill: isLineItemUncategorized(entry) && fill ? "url(#layer-pie-dots-pattern)" : fill
|
|
24603
24660
|
},
|
|
24604
24661
|
opacity: typeColorMapping[index2].opacity,
|
|
24605
|
-
onMouseEnter: () => setHoveredItem(entry
|
|
24662
|
+
onMouseEnter: () => setHoveredItem(entry),
|
|
24606
24663
|
onMouseLeave: () => setHoveredItem(void 0)
|
|
24607
24664
|
},
|
|
24608
24665
|
`cell-${index2}`
|
|
@@ -24628,7 +24685,7 @@ const DetailedChart = ({
|
|
|
24628
24685
|
};
|
|
24629
24686
|
let text = "Total";
|
|
24630
24687
|
if (hoveredItem) {
|
|
24631
|
-
text = hoveredItem;
|
|
24688
|
+
text = hoveredItem.displayName;
|
|
24632
24689
|
}
|
|
24633
24690
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24634
24691
|
recharts.Text,
|
|
@@ -24661,7 +24718,7 @@ const DetailedChart = ({
|
|
|
24661
24718
|
let value = filteredTotal;
|
|
24662
24719
|
if (hoveredItem) {
|
|
24663
24720
|
value = (_b = filteredData.find(
|
|
24664
|
-
(x) => x.
|
|
24721
|
+
(x) => x.name === hoveredItem.name
|
|
24665
24722
|
)) == null ? void 0 : _b.value;
|
|
24666
24723
|
}
|
|
24667
24724
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -24695,7 +24752,7 @@ const DetailedChart = ({
|
|
|
24695
24752
|
};
|
|
24696
24753
|
if (hoveredItem) {
|
|
24697
24754
|
const item = filteredData.find(
|
|
24698
|
-
(x) => x.
|
|
24755
|
+
(x) => x.name === hoveredItem.name
|
|
24699
24756
|
);
|
|
24700
24757
|
const positiveTotal = chartData.reduce((sum, x) => sum + x.value, 0);
|
|
24701
24758
|
const value = (_b = item == null ? void 0 : item.value) != null ? _b : 0;
|
|
@@ -24720,7 +24777,7 @@ const DetailedChart = ({
|
|
|
24720
24777
|
{
|
|
24721
24778
|
data: [{ name: "Total", value: 1 }],
|
|
24722
24779
|
dataKey: "value",
|
|
24723
|
-
nameKey: "
|
|
24780
|
+
nameKey: "displayName",
|
|
24724
24781
|
cx: "50%",
|
|
24725
24782
|
cy: "50%",
|
|
24726
24783
|
innerRadius: "91%",
|
|
@@ -24750,7 +24807,7 @@ const DetailedChart = ({
|
|
|
24750
24807
|
};
|
|
24751
24808
|
let text = "Total";
|
|
24752
24809
|
if (hoveredItem) {
|
|
24753
|
-
text = hoveredItem;
|
|
24810
|
+
text = hoveredItem.displayName;
|
|
24754
24811
|
}
|
|
24755
24812
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24756
24813
|
recharts.Text,
|
|
@@ -24783,7 +24840,7 @@ const DetailedChart = ({
|
|
|
24783
24840
|
let value = filteredTotal;
|
|
24784
24841
|
if (hoveredItem) {
|
|
24785
24842
|
value = (_b = filteredData.find(
|
|
24786
|
-
(x) => x.
|
|
24843
|
+
(x) => x.name === hoveredItem.name
|
|
24787
24844
|
)) == null ? void 0 : _b.value;
|
|
24788
24845
|
}
|
|
24789
24846
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -24804,7 +24861,7 @@ const DetailedChart = ({
|
|
|
24804
24861
|
{
|
|
24805
24862
|
data: [{ name: "loading...", value: 1 }],
|
|
24806
24863
|
dataKey: "value",
|
|
24807
|
-
nameKey: "
|
|
24864
|
+
nameKey: "displayName",
|
|
24808
24865
|
cx: "50%",
|
|
24809
24866
|
cy: "50%",
|
|
24810
24867
|
innerRadius: "91%",
|
|
@@ -24923,11 +24980,11 @@ const LedgerAccountsContext = react.createContext({
|
|
|
24923
24980
|
fetchMore: () => {
|
|
24924
24981
|
}
|
|
24925
24982
|
});
|
|
24926
|
-
const CloseButton = (
|
|
24927
|
-
var
|
|
24983
|
+
const CloseButton = (_Gc) => {
|
|
24984
|
+
var _Hc = _Gc, {
|
|
24928
24985
|
className,
|
|
24929
24986
|
textOnly = false
|
|
24930
|
-
} =
|
|
24987
|
+
} = _Hc, props = __objRest(_Hc, [
|
|
24931
24988
|
"className",
|
|
24932
24989
|
"textOnly"
|
|
24933
24990
|
]);
|
|
@@ -25702,44 +25759,6 @@ function DetailReportModal({
|
|
|
25702
25759
|
}
|
|
25703
25760
|
);
|
|
25704
25761
|
}
|
|
25705
|
-
const Filters = ({
|
|
25706
|
-
filteredData,
|
|
25707
|
-
sidebarScope,
|
|
25708
|
-
filters,
|
|
25709
|
-
setFilterTypes
|
|
25710
|
-
}) => {
|
|
25711
|
-
var _a, _b, _c;
|
|
25712
|
-
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "filters", children: [
|
|
25713
|
-
/* @__PURE__ */ jsxRuntime.jsx(Text, { size: TextSize.sm, className: "Layer__label", children: "Filters" }),
|
|
25714
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25715
|
-
Select$1,
|
|
25716
|
-
{
|
|
25717
|
-
className: "Layer__select type-select",
|
|
25718
|
-
classNamePrefix: "Layer__select",
|
|
25719
|
-
value: sidebarScope && ((_a = filters[sidebarScope]) == null ? void 0 : _a.types) ? sidebarScope && ((_c = (_b = filters[sidebarScope]) == null ? void 0 : _b.types) == null ? void 0 : _c.map((x) => ({
|
|
25720
|
-
value: x,
|
|
25721
|
-
label: x
|
|
25722
|
-
}))) : [],
|
|
25723
|
-
isMulti: true,
|
|
25724
|
-
isClearable: false,
|
|
25725
|
-
options: [...new Set(filteredData == null ? void 0 : filteredData.map((x) => x.type))].map((x) => ({
|
|
25726
|
-
label: x,
|
|
25727
|
-
value: x
|
|
25728
|
-
})),
|
|
25729
|
-
onChange: (selected) => {
|
|
25730
|
-
setFilterTypes(
|
|
25731
|
-
sidebarScope != null ? sidebarScope : "expenses",
|
|
25732
|
-
selected.map((x) => x.value)
|
|
25733
|
-
);
|
|
25734
|
-
},
|
|
25735
|
-
components: {
|
|
25736
|
-
DropdownIndicator: (props) => /* @__PURE__ */ jsxRuntime.jsx(Select$1.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDown, {}) })),
|
|
25737
|
-
Placeholder: (props) => /* @__PURE__ */ jsxRuntime.jsx(Select$1.components.Placeholder, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__select__multi-all-placeholder-badge", children: "All" }) }))
|
|
25738
|
-
}
|
|
25739
|
-
}
|
|
25740
|
-
)
|
|
25741
|
-
] });
|
|
25742
|
-
};
|
|
25743
25762
|
const ProfitAndLossDetailedCharts = ({
|
|
25744
25763
|
scope,
|
|
25745
25764
|
hideClose = false,
|
|
@@ -25757,13 +25776,12 @@ const ProfitAndLossDetailedCharts = ({
|
|
|
25757
25776
|
filters,
|
|
25758
25777
|
dateRange,
|
|
25759
25778
|
sidebarScope,
|
|
25760
|
-
setSidebarScope
|
|
25761
|
-
setFilterTypes
|
|
25779
|
+
setSidebarScope
|
|
25762
25780
|
} = react.useContext(ProfitAndLossContext);
|
|
25763
25781
|
const theScope = scope ? scope : sidebarScope;
|
|
25764
25782
|
const data = theScope === "revenue" ? filteredDataRevenue : filteredDataExpenses;
|
|
25765
25783
|
const total = theScope === "revenue" ? filteredTotalRevenue : filteredTotalExpenses;
|
|
25766
|
-
const [hoveredItem, setHoveredItem] = react.useState();
|
|
25784
|
+
const [hoveredItem, setHoveredItem] = react.useState(void 0);
|
|
25767
25785
|
const [selectedItem, setSelectedItem] = react.useState(null);
|
|
25768
25786
|
const [isModalOpen, setIsModalOpen] = react.useState(false);
|
|
25769
25787
|
const handleValueClick = react.useCallback((item) => {
|
|
@@ -25812,31 +25830,20 @@ const ProfitAndLossDetailedCharts = ({
|
|
|
25812
25830
|
showDatePicker
|
|
25813
25831
|
}
|
|
25814
25832
|
),
|
|
25815
|
-
/* @__PURE__ */ jsxRuntime.
|
|
25816
|
-
|
|
25817
|
-
|
|
25818
|
-
|
|
25819
|
-
|
|
25820
|
-
|
|
25821
|
-
|
|
25822
|
-
|
|
25823
|
-
|
|
25824
|
-
|
|
25825
|
-
|
|
25826
|
-
|
|
25827
|
-
|
|
25828
|
-
|
|
25829
|
-
sidebarScope: theScope,
|
|
25830
|
-
filters,
|
|
25831
|
-
sortBy,
|
|
25832
|
-
hoveredItem,
|
|
25833
|
-
setHoveredItem,
|
|
25834
|
-
chartColorsList,
|
|
25835
|
-
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.detailedTableStringOverrides,
|
|
25836
|
-
onValueClick: handleValueClick
|
|
25837
|
-
}
|
|
25838
|
-
)
|
|
25839
|
-
] })
|
|
25833
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__profit-and-loss-detailed-charts__table-wrapper", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
25834
|
+
DetailedTable,
|
|
25835
|
+
{
|
|
25836
|
+
filteredData: data,
|
|
25837
|
+
sidebarScope: theScope,
|
|
25838
|
+
filters,
|
|
25839
|
+
sortBy,
|
|
25840
|
+
hoveredItem,
|
|
25841
|
+
setHoveredItem,
|
|
25842
|
+
chartColorsList,
|
|
25843
|
+
stringOverrides: stringOverrides == null ? void 0 : stringOverrides.detailedTableStringOverrides,
|
|
25844
|
+
onValueClick: handleValueClick
|
|
25845
|
+
}
|
|
25846
|
+
) })
|
|
25840
25847
|
] }),
|
|
25841
25848
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
25842
25849
|
DetailReportModal,
|
|
@@ -26099,7 +26106,7 @@ const getProfitAndLossDetailLinesExcel = (apiUrl, accessToken, params) => {
|
|
|
26099
26106
|
({ businessId: businessId2 }) => `/v1/businesses/${businessId2}/reports/profit-and-loss/lines/exports/excel?${queryParams.toString()}`
|
|
26100
26107
|
)(apiUrl, accessToken, { params: { businessId } });
|
|
26101
26108
|
};
|
|
26102
|
-
function buildKey$
|
|
26109
|
+
function buildKey$B({
|
|
26103
26110
|
access_token: accessToken,
|
|
26104
26111
|
apiUrl,
|
|
26105
26112
|
businessId,
|
|
@@ -26138,7 +26145,7 @@ function useProfitAndLossDetailLinesExport({
|
|
|
26138
26145
|
const { businessId } = useLayerContext();
|
|
26139
26146
|
const { apiUrl } = useEnvironment();
|
|
26140
26147
|
return useSWRMutation(
|
|
26141
|
-
() => buildKey$
|
|
26148
|
+
() => buildKey$B(__spreadProps(__spreadValues({}, auth), {
|
|
26142
26149
|
apiUrl,
|
|
26143
26150
|
businessId,
|
|
26144
26151
|
startDate,
|
|
@@ -26355,10 +26362,10 @@ const MultiSelect = ({
|
|
|
26355
26362
|
isInvalid ? "Layer__select--error" : "",
|
|
26356
26363
|
className
|
|
26357
26364
|
);
|
|
26358
|
-
const DropdownIndicator = react.useCallback((props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
26365
|
+
const DropdownIndicator = react.useCallback((props) => /* @__PURE__ */ jsxRuntime.jsx(ReactSelect.components.DropdownIndicator, __spreadProps(__spreadValues({}, props), { children: /* @__PURE__ */ jsxRuntime.jsx(ChevronDownFill, {}) })), []);
|
|
26359
26366
|
return /* @__PURE__ */ jsxRuntime.jsxs(DeprecatedTooltip, { disabled: !isInvalid || !errorMessage, children: [
|
|
26360
26367
|
/* @__PURE__ */ jsxRuntime.jsx(DeprecatedTooltipTrigger, { className: "Layer__input-tooltip", children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
26361
|
-
|
|
26368
|
+
ReactSelect,
|
|
26362
26369
|
{
|
|
26363
26370
|
inputId,
|
|
26364
26371
|
name,
|
|
@@ -26373,7 +26380,7 @@ const MultiSelect = ({
|
|
|
26373
26380
|
styles: __spreadValues({
|
|
26374
26381
|
menuPortal: (base) => __spreadProps(__spreadValues({}, base), { zIndex: 9999 })
|
|
26375
26382
|
}, styles),
|
|
26376
|
-
components: { DropdownIndicator },
|
|
26383
|
+
components: { DropdownIndicator, MenuPortal: SelectMenuPortal },
|
|
26377
26384
|
isLoading,
|
|
26378
26385
|
isDisabled: disabled,
|
|
26379
26386
|
isMulti: true
|
|
@@ -27174,7 +27181,13 @@ function ProfitAndLossSummariesMiniChart({
|
|
|
27174
27181
|
chartColorsList,
|
|
27175
27182
|
variants: variants2
|
|
27176
27183
|
}) {
|
|
27177
|
-
const
|
|
27184
|
+
const chartData = react.useMemo(
|
|
27185
|
+
() => data.map((x) => __spreadProps(__spreadValues({}, x), {
|
|
27186
|
+
value: x.value > 0 ? x.value : 0
|
|
27187
|
+
})),
|
|
27188
|
+
[data]
|
|
27189
|
+
);
|
|
27190
|
+
const typeColorMapping = mapTypesToColors(chartData, chartColorsList);
|
|
27178
27191
|
let chartDimension = 52;
|
|
27179
27192
|
let innerRadius = 10;
|
|
27180
27193
|
let outerRadius = 16;
|
|
@@ -27193,9 +27206,9 @@ function ProfitAndLossSummariesMiniChart({
|
|
|
27193
27206
|
return /* @__PURE__ */ jsxRuntime.jsx(recharts.PieChart, { width: chartDimension, height: chartDimension, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
27194
27207
|
recharts.Pie,
|
|
27195
27208
|
{
|
|
27196
|
-
data,
|
|
27209
|
+
data: chartData,
|
|
27197
27210
|
dataKey: "value",
|
|
27198
|
-
nameKey: "
|
|
27211
|
+
nameKey: "displayName",
|
|
27199
27212
|
cx: "50%",
|
|
27200
27213
|
cy: "50%",
|
|
27201
27214
|
innerRadius,
|
|
@@ -27206,7 +27219,7 @@ function ProfitAndLossSummariesMiniChart({
|
|
|
27206
27219
|
height: 36,
|
|
27207
27220
|
animationDuration: 250,
|
|
27208
27221
|
animationEasing: "ease-in-out",
|
|
27209
|
-
children:
|
|
27222
|
+
children: chartData.map((entry, index2) => {
|
|
27210
27223
|
const colorConfig = typeColorMapping[index2];
|
|
27211
27224
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
27212
27225
|
recharts.Cell,
|
|
@@ -27243,7 +27256,7 @@ function ProfitAndLossSummariesSummary({
|
|
|
27243
27256
|
const showPercentChange = percentChange !== void 0 && percentChange !== null && comparisonMonth;
|
|
27244
27257
|
const isGoodChange = showPercentChange && (isExpense ? percentChange < 0 : percentChange >= 0);
|
|
27245
27258
|
const arrow = showPercentChange && percentChange >= 0 ? "↑" : "↓";
|
|
27246
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", align: "center", children: [
|
|
27259
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", align: "center", overflow: "hidden", children: [
|
|
27247
27260
|
Chart && /* @__PURE__ */ jsxRuntime.jsx(
|
|
27248
27261
|
HStack,
|
|
27249
27262
|
{
|
|
@@ -27495,10 +27508,10 @@ function Internal_ProfitAndLossSummaries({
|
|
|
27495
27508
|
unstable_AdditionalListItems.map((item, index2) => /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossSummariesListItem, { children: item }, index2))
|
|
27496
27509
|
] }) });
|
|
27497
27510
|
}
|
|
27498
|
-
function ProfitAndLossSummaries(
|
|
27499
|
-
var
|
|
27511
|
+
function ProfitAndLossSummaries(_Ic) {
|
|
27512
|
+
var _Jc = _Ic, {
|
|
27500
27513
|
onTransactionsToReviewClick
|
|
27501
|
-
} =
|
|
27514
|
+
} = _Jc, restProps = __objRest(_Jc, [
|
|
27502
27515
|
"onTransactionsToReviewClick"
|
|
27503
27516
|
]);
|
|
27504
27517
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -27536,7 +27549,7 @@ ProfitAndLoss.Summaries = ProfitAndLossSummaries;
|
|
|
27536
27549
|
ProfitAndLoss.DetailedCharts = ProfitAndLossDetailedCharts;
|
|
27537
27550
|
ProfitAndLoss.Header = ProfitAndLossHeader;
|
|
27538
27551
|
ProfitAndLoss.Report = ProfitAndLossReport;
|
|
27539
|
-
function buildKey$
|
|
27552
|
+
function buildKey$A({
|
|
27540
27553
|
access_token: accessToken,
|
|
27541
27554
|
apiUrl,
|
|
27542
27555
|
businessId,
|
|
@@ -27559,7 +27572,7 @@ function useBalanceSheet({
|
|
|
27559
27572
|
const { apiUrl } = useEnvironment();
|
|
27560
27573
|
const { businessId } = useLayerContext();
|
|
27561
27574
|
return useSWR(
|
|
27562
|
-
() => buildKey$
|
|
27575
|
+
() => buildKey$A(__spreadProps(__spreadValues({}, auth), {
|
|
27563
27576
|
apiUrl,
|
|
27564
27577
|
businessId,
|
|
27565
27578
|
effectiveDate
|
|
@@ -27625,7 +27638,7 @@ const BALANCE_SHEET_ROWS = [
|
|
|
27625
27638
|
}
|
|
27626
27639
|
];
|
|
27627
27640
|
const DOWNLOAD_BALANCE_SHEET_TAG_KEY = "#download-balance-sheet";
|
|
27628
|
-
function buildKey$
|
|
27641
|
+
function buildKey$z({
|
|
27629
27642
|
access_token: accessToken,
|
|
27630
27643
|
apiUrl,
|
|
27631
27644
|
businessId,
|
|
@@ -27648,7 +27661,7 @@ function useBalanceSheetDownload({
|
|
|
27648
27661
|
const { data: auth } = useAuth();
|
|
27649
27662
|
const { businessId } = useLayerContext();
|
|
27650
27663
|
return useSWRMutation(
|
|
27651
|
-
() => buildKey$
|
|
27664
|
+
() => buildKey$z(__spreadProps(__spreadValues({}, auth), {
|
|
27652
27665
|
businessId,
|
|
27653
27666
|
effectiveDate
|
|
27654
27667
|
})),
|
|
@@ -27698,8 +27711,8 @@ function BalanceSheetDownloadButton({
|
|
|
27698
27711
|
/* @__PURE__ */ jsxRuntime.jsx(InvisibleDownload, { ref: invisibleDownloadRef })
|
|
27699
27712
|
] });
|
|
27700
27713
|
}
|
|
27701
|
-
const Collapse = (
|
|
27702
|
-
var props = __objRest(
|
|
27714
|
+
const Collapse = (_Kc) => {
|
|
27715
|
+
var props = __objRest(_Kc, []);
|
|
27703
27716
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
27704
27717
|
"svg",
|
|
27705
27718
|
__spreadProps(__spreadValues({
|
|
@@ -27732,8 +27745,8 @@ const Collapse = (_Ic) => {
|
|
|
27732
27745
|
})
|
|
27733
27746
|
);
|
|
27734
27747
|
};
|
|
27735
|
-
const Expand = (
|
|
27736
|
-
var props = __objRest(
|
|
27748
|
+
const Expand = (_Lc) => {
|
|
27749
|
+
var props = __objRest(_Lc, []);
|
|
27737
27750
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
27738
27751
|
"svg",
|
|
27739
27752
|
__spreadProps(__spreadValues({
|
|
@@ -28003,7 +28016,7 @@ const BalanceSheetView = ({
|
|
|
28003
28016
|
}
|
|
28004
28017
|
) });
|
|
28005
28018
|
};
|
|
28006
|
-
function buildKey$
|
|
28019
|
+
function buildKey$y({
|
|
28007
28020
|
access_token: accessToken,
|
|
28008
28021
|
apiUrl,
|
|
28009
28022
|
businessId,
|
|
@@ -28029,7 +28042,7 @@ function useStatementOfCashFlow({
|
|
|
28029
28042
|
const { apiUrl } = useEnvironment();
|
|
28030
28043
|
const { businessId } = useLayerContext();
|
|
28031
28044
|
return useSWR(
|
|
28032
|
-
buildKey$
|
|
28045
|
+
buildKey$y(__spreadProps(__spreadValues({}, auth), {
|
|
28033
28046
|
apiUrl,
|
|
28034
28047
|
businessId,
|
|
28035
28048
|
startDate,
|
|
@@ -28093,7 +28106,7 @@ const STATEMENT_OF_CASH_FLOW_ROWS = [
|
|
|
28093
28106
|
}
|
|
28094
28107
|
];
|
|
28095
28108
|
const DOWNLOAD_CASHFLOW_STATEMENT_TAG_KEY = "#download-cashflow-statement";
|
|
28096
|
-
function buildKey$
|
|
28109
|
+
function buildKey$x({
|
|
28097
28110
|
access_token: accessToken,
|
|
28098
28111
|
apiUrl,
|
|
28099
28112
|
businessId,
|
|
@@ -28119,7 +28132,7 @@ function useCashflowStatementDownload({
|
|
|
28119
28132
|
const { data: auth } = useAuth();
|
|
28120
28133
|
const { businessId } = useLayerContext();
|
|
28121
28134
|
return useSWRMutation(
|
|
28122
|
-
() => buildKey$
|
|
28135
|
+
() => buildKey$x(__spreadProps(__spreadValues({}, auth), {
|
|
28123
28136
|
businessId,
|
|
28124
28137
|
startDate,
|
|
28125
28138
|
endDate
|
|
@@ -28323,7 +28336,7 @@ const getLedgerAccountBalances = get$1(
|
|
|
28323
28336
|
return `/v1/businesses/${businessId}/ledger/balances?${parameters}`;
|
|
28324
28337
|
}
|
|
28325
28338
|
);
|
|
28326
|
-
function buildKey$
|
|
28339
|
+
function buildKey$w({
|
|
28327
28340
|
access_token: accessToken,
|
|
28328
28341
|
apiUrl,
|
|
28329
28342
|
businessId,
|
|
@@ -28345,7 +28358,7 @@ function useLedgerBalances(withDates, startDate, endDate) {
|
|
|
28345
28358
|
const { data } = useAuth();
|
|
28346
28359
|
const { businessId } = useLayerContext();
|
|
28347
28360
|
const response = useSWR(
|
|
28348
|
-
() => buildKey$
|
|
28361
|
+
() => buildKey$w(__spreadProps(__spreadValues({}, data), {
|
|
28349
28362
|
businessId,
|
|
28350
28363
|
startDate: withDates ? startDate : void 0,
|
|
28351
28364
|
endDate: withDates ? endDate : void 0
|
|
@@ -28687,7 +28700,7 @@ const LEDGER_ACCOUNT_SUBTYPES_FOR_TYPE = {
|
|
|
28687
28700
|
EXPENSE: EXPENSE_LEDGER_ACCOUNT_SUBTYPES
|
|
28688
28701
|
};
|
|
28689
28702
|
const deleteAccountFromLedger = del(({ businessId, accountId }) => `/v1/businesses/${businessId}/ledger/accounts/${accountId}`);
|
|
28690
|
-
function buildKey$
|
|
28703
|
+
function buildKey$v({
|
|
28691
28704
|
access_token: accessToken,
|
|
28692
28705
|
apiUrl,
|
|
28693
28706
|
businessId
|
|
@@ -28705,7 +28718,7 @@ function useDeleteAccountFromLedger() {
|
|
|
28705
28718
|
const { data } = useAuth();
|
|
28706
28719
|
const { businessId } = useLayerContext();
|
|
28707
28720
|
const mutationResponse = useSWRMutation(
|
|
28708
|
-
() => buildKey$
|
|
28721
|
+
() => buildKey$v(__spreadProps(__spreadValues({}, data), {
|
|
28709
28722
|
businessId
|
|
28710
28723
|
})),
|
|
28711
28724
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg: { accountId } }) => deleteAccountFromLedger(
|
|
@@ -29381,8 +29394,8 @@ const ChartOfAccountsContext = react.createContext(
|
|
|
29381
29394
|
}
|
|
29382
29395
|
}
|
|
29383
29396
|
);
|
|
29384
|
-
const Plus = (
|
|
29385
|
-
var
|
|
29397
|
+
const Plus = (_Mc) => {
|
|
29398
|
+
var _Nc = _Mc, { size = 14 } = _Nc, props = __objRest(_Nc, ["size"]);
|
|
29386
29399
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
29387
29400
|
"svg",
|
|
29388
29401
|
__spreadProps(__spreadValues({
|
|
@@ -29415,7 +29428,7 @@ const Plus = (_Kc) => {
|
|
|
29415
29428
|
})
|
|
29416
29429
|
);
|
|
29417
29430
|
};
|
|
29418
|
-
function buildKey$
|
|
29431
|
+
function buildKey$u({
|
|
29419
29432
|
access_token: accessToken,
|
|
29420
29433
|
apiUrl,
|
|
29421
29434
|
businessId,
|
|
@@ -29441,7 +29454,7 @@ function useAccountBalancesDownload({
|
|
|
29441
29454
|
const { data: auth } = useAuth();
|
|
29442
29455
|
const { businessId } = useLayerContext();
|
|
29443
29456
|
return useSWRMutation(
|
|
29444
|
-
() => buildKey$
|
|
29457
|
+
() => buildKey$u(__spreadProps(__spreadValues({}, auth), {
|
|
29445
29458
|
businessId,
|
|
29446
29459
|
startCutoff,
|
|
29447
29460
|
endCutoff
|
|
@@ -29749,8 +29762,8 @@ var LedgerAccountNodeType = /* @__PURE__ */ ((LedgerAccountNodeType2) => {
|
|
|
29749
29762
|
LedgerAccountNodeType2["Parent"] = "Parent";
|
|
29750
29763
|
return LedgerAccountNodeType2;
|
|
29751
29764
|
})(LedgerAccountNodeType || {});
|
|
29752
|
-
const Edit2 = (
|
|
29753
|
-
var
|
|
29765
|
+
const Edit2 = (_Oc) => {
|
|
29766
|
+
var _Pc = _Oc, { size = 18 } = _Pc, props = __objRest(_Pc, ["size"]);
|
|
29754
29767
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
29755
29768
|
"svg",
|
|
29756
29769
|
__spreadProps(__spreadValues({
|
|
@@ -31473,7 +31486,7 @@ var UpsertJournalEntryMode = /* @__PURE__ */ ((UpsertJournalEntryMode2) => {
|
|
|
31473
31486
|
return UpsertJournalEntryMode2;
|
|
31474
31487
|
})(UpsertJournalEntryMode || {});
|
|
31475
31488
|
const createJournalEntry = post(({ businessId }) => `/v1/businesses/${businessId}/ledger/journal-entries`);
|
|
31476
|
-
function buildKey$
|
|
31489
|
+
function buildKey$t({
|
|
31477
31490
|
access_token: accessToken,
|
|
31478
31491
|
apiUrl,
|
|
31479
31492
|
businessId
|
|
@@ -31500,7 +31513,7 @@ const useUpsertJournalEntry = (props) => {
|
|
|
31500
31513
|
const { debouncedInvalidateProfitAndLossSummaries } = useProfitAndLossSummariesCacheActions();
|
|
31501
31514
|
const { invalidate } = useGlobalCacheActions();
|
|
31502
31515
|
const rawMutationResponse = useSWRMutation(
|
|
31503
|
-
() => buildKey$
|
|
31516
|
+
() => buildKey$t(__spreadProps(__spreadValues({}, data), {
|
|
31504
31517
|
businessId
|
|
31505
31518
|
})),
|
|
31506
31519
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg: body }) => {
|
|
@@ -31814,7 +31827,7 @@ const JournalEntryDrawerHeader = ({ onSubmit, formState }) => {
|
|
|
31814
31827
|
] })
|
|
31815
31828
|
] });
|
|
31816
31829
|
};
|
|
31817
|
-
function buildKey$
|
|
31830
|
+
function buildKey$s({
|
|
31818
31831
|
access_token: accessToken,
|
|
31819
31832
|
apiUrl,
|
|
31820
31833
|
businessId,
|
|
@@ -31840,7 +31853,7 @@ function useJournalEntriesDownload({
|
|
|
31840
31853
|
const { data: auth } = useAuth();
|
|
31841
31854
|
const { businessId } = useLayerContext();
|
|
31842
31855
|
return useSWRMutation(
|
|
31843
|
-
() => buildKey$
|
|
31856
|
+
() => buildKey$s(__spreadProps(__spreadValues({}, auth), {
|
|
31844
31857
|
businessId,
|
|
31845
31858
|
startCutoff,
|
|
31846
31859
|
endCutoff
|
|
@@ -32431,8 +32444,8 @@ function usePaginatedList(list, pageSize) {
|
|
|
32431
32444
|
reset
|
|
32432
32445
|
};
|
|
32433
32446
|
}
|
|
32434
|
-
const SmileIcon = (
|
|
32435
|
-
var
|
|
32447
|
+
const SmileIcon = (_Qc) => {
|
|
32448
|
+
var _Rc = _Qc, { size = 12 } = _Rc, props = __objRest(_Rc, ["size"]);
|
|
32436
32449
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
32437
32450
|
"svg",
|
|
32438
32451
|
__spreadProps(__spreadValues({
|
|
@@ -32528,7 +32541,7 @@ function completeTaskWithUpload(baseUrl, accessToken, {
|
|
|
32528
32541
|
accessToken
|
|
32529
32542
|
);
|
|
32530
32543
|
}
|
|
32531
|
-
function buildKey$
|
|
32544
|
+
function buildKey$r({
|
|
32532
32545
|
access_token: accessToken,
|
|
32533
32546
|
apiUrl,
|
|
32534
32547
|
businessId
|
|
@@ -32547,7 +32560,7 @@ function useDeleteUploadsOnTask() {
|
|
|
32547
32560
|
const { businessId } = useLayerContext();
|
|
32548
32561
|
const { mutate } = useSWR.useSWRConfig();
|
|
32549
32562
|
const mutationResponse = useSWRMutation(
|
|
32550
|
-
() => buildKey$
|
|
32563
|
+
() => buildKey$r(__spreadProps(__spreadValues({}, auth), {
|
|
32551
32564
|
businessId
|
|
32552
32565
|
})),
|
|
32553
32566
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg: { taskId } }) => deleteUploadsOnTask(
|
|
@@ -32586,7 +32599,7 @@ function useDeleteUploadsOnTask() {
|
|
|
32586
32599
|
}
|
|
32587
32600
|
});
|
|
32588
32601
|
}
|
|
32589
|
-
function buildKey$
|
|
32602
|
+
function buildKey$q({
|
|
32590
32603
|
access_token: accessToken,
|
|
32591
32604
|
apiUrl,
|
|
32592
32605
|
businessId
|
|
@@ -32605,7 +32618,7 @@ function useSubmitUserResponseForTask() {
|
|
|
32605
32618
|
const { businessId } = useLayerContext();
|
|
32606
32619
|
const { mutate } = useSWR.useSWRConfig();
|
|
32607
32620
|
const mutationResponse = useSWRMutation(
|
|
32608
|
-
() => buildKey$
|
|
32621
|
+
() => buildKey$q(__spreadProps(__spreadValues({}, auth), {
|
|
32609
32622
|
businessId
|
|
32610
32623
|
})),
|
|
32611
32624
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg: { taskId, userResponse } }) => submitUserResponseForTask(
|
|
@@ -32651,7 +32664,7 @@ function useSubmitUserResponseForTask() {
|
|
|
32651
32664
|
}
|
|
32652
32665
|
});
|
|
32653
32666
|
}
|
|
32654
|
-
function buildKey$
|
|
32667
|
+
function buildKey$p({
|
|
32655
32668
|
access_token: accessToken,
|
|
32656
32669
|
apiUrl,
|
|
32657
32670
|
businessId
|
|
@@ -32670,7 +32683,7 @@ function useUpdateTaskUploadDescription() {
|
|
|
32670
32683
|
const { businessId } = useLayerContext();
|
|
32671
32684
|
const { mutate } = useSWR.useSWRConfig();
|
|
32672
32685
|
const mutationResponse = useSWRMutation(
|
|
32673
|
-
() => buildKey$
|
|
32686
|
+
() => buildKey$p(__spreadProps(__spreadValues({}, auth), {
|
|
32674
32687
|
businessId
|
|
32675
32688
|
})),
|
|
32676
32689
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg: { taskId, description } }) => updateTaskUploadsDescription(
|
|
@@ -32713,7 +32726,7 @@ function useUpdateTaskUploadDescription() {
|
|
|
32713
32726
|
}
|
|
32714
32727
|
});
|
|
32715
32728
|
}
|
|
32716
|
-
function buildKey$
|
|
32729
|
+
function buildKey$o({
|
|
32717
32730
|
access_token: accessToken,
|
|
32718
32731
|
apiUrl,
|
|
32719
32732
|
businessId
|
|
@@ -32732,7 +32745,7 @@ function useUploadDocumentsForTask() {
|
|
|
32732
32745
|
const { businessId } = useLayerContext();
|
|
32733
32746
|
const { mutate } = useSWR.useSWRConfig();
|
|
32734
32747
|
const mutationResponse = useSWRMutation(
|
|
32735
|
-
() => buildKey$
|
|
32748
|
+
() => buildKey$o(__spreadProps(__spreadValues({}, auth), {
|
|
32736
32749
|
businessId
|
|
32737
32750
|
})),
|
|
32738
32751
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg: { taskId, files, description } }) => completeTaskWithUpload(
|
|
@@ -33277,8 +33290,8 @@ const useBookkeepingYearsStatus = () => {
|
|
|
33277
33290
|
isLoading
|
|
33278
33291
|
};
|
|
33279
33292
|
};
|
|
33280
|
-
const ArrowRightCircle = (
|
|
33281
|
-
var
|
|
33293
|
+
const ArrowRightCircle = (_Sc) => {
|
|
33294
|
+
var _Tc = _Sc, { size = 18 } = _Tc, props = __objRest(_Tc, ["size"]);
|
|
33282
33295
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
33283
33296
|
"svg",
|
|
33284
33297
|
__spreadProps(__spreadValues({
|
|
@@ -34760,7 +34773,7 @@ class BookkeepingConfigurationSWRResponse {
|
|
|
34760
34773
|
return this.swrResponse.mutate;
|
|
34761
34774
|
}
|
|
34762
34775
|
}
|
|
34763
|
-
function buildKey$
|
|
34776
|
+
function buildKey$n({
|
|
34764
34777
|
access_token: accessToken,
|
|
34765
34778
|
apiUrl,
|
|
34766
34779
|
businessId
|
|
@@ -34781,7 +34794,7 @@ function useBookkeepingConfiguration() {
|
|
|
34781
34794
|
const { apiUrl } = useEnvironment();
|
|
34782
34795
|
const { data: auth } = useAuth();
|
|
34783
34796
|
const { businessId } = useLayerContext();
|
|
34784
|
-
const queryKey = buildKey$
|
|
34797
|
+
const queryKey = buildKey$n(__spreadProps(__spreadValues({}, auth), {
|
|
34785
34798
|
apiUrl,
|
|
34786
34799
|
businessId
|
|
34787
34800
|
}));
|
|
@@ -34968,7 +34981,7 @@ const BookOnboardingCallStep = ({ title = defaultTitle$3, description = defaultD
|
|
|
34968
34981
|
] });
|
|
34969
34982
|
};
|
|
34970
34983
|
const BUSINESS_TAG_KEY = "business";
|
|
34971
|
-
function buildKey$
|
|
34984
|
+
function buildKey$m({
|
|
34972
34985
|
access_token: accessToken,
|
|
34973
34986
|
apiUrl,
|
|
34974
34987
|
businessId
|
|
@@ -34987,7 +35000,7 @@ function useUpdateBusiness() {
|
|
|
34987
35000
|
const { businessId } = useLayerContext();
|
|
34988
35001
|
const { mutate } = useSWR.useSWRConfig();
|
|
34989
35002
|
const mutationResponse = useSWRMutation(
|
|
34990
|
-
() => buildKey$
|
|
35003
|
+
() => buildKey$m(__spreadProps(__spreadValues({}, data), {
|
|
34991
35004
|
businessId
|
|
34992
35005
|
})),
|
|
34993
35006
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg: body }) => updateBusiness(
|
|
@@ -35038,7 +35051,7 @@ function isPersonnelRole(role) {
|
|
|
35038
35051
|
return PERSONNEL_ROLES.includes(role);
|
|
35039
35052
|
}
|
|
35040
35053
|
const BUSINESS_PERSONNEL_TAG_KEY = "#business-personnel";
|
|
35041
|
-
function buildKey$
|
|
35054
|
+
function buildKey$l({
|
|
35042
35055
|
access_token: accessToken,
|
|
35043
35056
|
apiUrl,
|
|
35044
35057
|
businessId
|
|
@@ -35057,7 +35070,7 @@ function useBusinessPersonnel() {
|
|
|
35057
35070
|
const { data } = useAuth();
|
|
35058
35071
|
const { businessId } = useLayerContext();
|
|
35059
35072
|
return useSWR(
|
|
35060
|
-
() => buildKey$
|
|
35073
|
+
() => buildKey$l(__spreadProps(__spreadValues({}, data), {
|
|
35061
35074
|
businessId
|
|
35062
35075
|
})),
|
|
35063
35076
|
({ accessToken, apiUrl, businessId: businessId2 }) => getBusinessPersonnel(
|
|
@@ -35095,7 +35108,7 @@ function useBusinessPersonnel() {
|
|
|
35095
35108
|
);
|
|
35096
35109
|
}
|
|
35097
35110
|
const createBusinessPersonnel = post(({ businessId }) => `/v1/businesses/${businessId}/personnel`);
|
|
35098
|
-
function buildKey$
|
|
35111
|
+
function buildKey$k({
|
|
35099
35112
|
access_token: accessToken,
|
|
35100
35113
|
apiUrl,
|
|
35101
35114
|
businessId
|
|
@@ -35114,7 +35127,7 @@ function useCreateBusinessPersonnel() {
|
|
|
35114
35127
|
const { businessId } = useLayerContext();
|
|
35115
35128
|
const { mutate } = useSWR.useSWRConfig();
|
|
35116
35129
|
const mutationResponse = useSWRMutation(
|
|
35117
|
-
() => buildKey$
|
|
35130
|
+
() => buildKey$k(__spreadProps(__spreadValues({}, data), {
|
|
35118
35131
|
businessId
|
|
35119
35132
|
})),
|
|
35120
35133
|
({ accessToken, apiUrl, businessId: businessId2 }, { arg: body }) => createBusinessPersonnel(
|
|
@@ -35157,7 +35170,7 @@ function useCreateBusinessPersonnel() {
|
|
|
35157
35170
|
const updateBusinessPersonnel = post(({ businessId, businessPersonnelId }) => {
|
|
35158
35171
|
return `/v1/businesses/${businessId}/personnel/${businessPersonnelId}/update`;
|
|
35159
35172
|
});
|
|
35160
|
-
function buildKey$
|
|
35173
|
+
function buildKey$j({
|
|
35161
35174
|
access_token: accessToken,
|
|
35162
35175
|
apiUrl,
|
|
35163
35176
|
businessId,
|
|
@@ -35178,7 +35191,7 @@ function useUpdateBusinessPersonnel({ businessPersonnelId }) {
|
|
|
35178
35191
|
const { businessId } = useLayerContext();
|
|
35179
35192
|
const { mutate } = useSWR.useSWRConfig();
|
|
35180
35193
|
const mutationResponse = useSWRMutation(
|
|
35181
|
-
() => buildKey$
|
|
35194
|
+
() => buildKey$j(__spreadProps(__spreadValues({}, data), {
|
|
35182
35195
|
businessId,
|
|
35183
35196
|
businessPersonnelId
|
|
35184
35197
|
})),
|
|
@@ -35326,12 +35339,12 @@ const FormSection = ({ children, title }) => {
|
|
|
35326
35339
|
children
|
|
35327
35340
|
] });
|
|
35328
35341
|
};
|
|
35329
|
-
const PhoneInput = (
|
|
35330
|
-
var
|
|
35342
|
+
const PhoneInput = (_Uc) => {
|
|
35343
|
+
var _Vc = _Uc, {
|
|
35331
35344
|
value,
|
|
35332
35345
|
onChange,
|
|
35333
35346
|
placeholder = "Phone number"
|
|
35334
|
-
} =
|
|
35347
|
+
} = _Vc, props = __objRest(_Vc, [
|
|
35335
35348
|
"value",
|
|
35336
35349
|
"onChange",
|
|
35337
35350
|
"placeholder"
|
|
@@ -35623,8 +35636,8 @@ const SummaryStep = ({ onNext, title = defaultTitle$1, description = defaultDesc
|
|
|
35623
35636
|
/* @__PURE__ */ jsxRuntime.jsx(Button$1, { onClick: onNext, children: nextBtnText })
|
|
35624
35637
|
] });
|
|
35625
35638
|
};
|
|
35626
|
-
const Document = (
|
|
35627
|
-
var
|
|
35639
|
+
const Document = (_Wc) => {
|
|
35640
|
+
var _Xc = _Wc, { size = 20 } = _Xc, props = __objRest(_Xc, ["size"]);
|
|
35628
35641
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
35629
35642
|
"svg",
|
|
35630
35643
|
__spreadProps(__spreadValues({
|
|
@@ -35729,8 +35742,8 @@ const Document = (_Uc) => {
|
|
|
35729
35742
|
})
|
|
35730
35743
|
);
|
|
35731
35744
|
};
|
|
35732
|
-
const TrendingUp = (
|
|
35733
|
-
var
|
|
35745
|
+
const TrendingUp = (_Yc) => {
|
|
35746
|
+
var _Zc = _Yc, { size = 20 } = _Zc, props = __objRest(_Zc, ["size"]);
|
|
35734
35747
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
35735
35748
|
"svg",
|
|
35736
35749
|
__spreadProps(__spreadValues({
|
|
@@ -35987,8 +36000,8 @@ const PlatformOnboarding = ({ onComplete }) => {
|
|
|
35987
36000
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "Layer__platform-onboarding-layout__footer", children: renderStepFooter() })
|
|
35988
36001
|
] }) });
|
|
35989
36002
|
};
|
|
35990
|
-
const CoffeeIcon = (
|
|
35991
|
-
var
|
|
36003
|
+
const CoffeeIcon = (__c) => {
|
|
36004
|
+
var _$c = __c, { size = 11 } = _$c, props = __objRest(_$c, ["size"]);
|
|
35992
36005
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
35993
36006
|
"svg",
|
|
35994
36007
|
__spreadProps(__spreadValues({
|
|
@@ -36059,8 +36072,8 @@ const CoffeeIcon = (_Yc) => {
|
|
|
36059
36072
|
})
|
|
36060
36073
|
);
|
|
36061
36074
|
};
|
|
36062
|
-
const Link$1 = (
|
|
36063
|
-
var
|
|
36075
|
+
const Link$1 = (_ad) => {
|
|
36076
|
+
var _bd = _ad, {
|
|
36064
36077
|
className,
|
|
36065
36078
|
children,
|
|
36066
36079
|
variant = ButtonVariant.primary,
|
|
@@ -36070,7 +36083,7 @@ const Link$1 = (__c) => {
|
|
|
36070
36083
|
iconAsPrimary = false,
|
|
36071
36084
|
justify = "center",
|
|
36072
36085
|
fullWidth
|
|
36073
|
-
} =
|
|
36086
|
+
} = _bd, props = __objRest(_bd, [
|
|
36074
36087
|
"className",
|
|
36075
36088
|
"children",
|
|
36076
36089
|
"variant",
|
|
@@ -36162,8 +36175,8 @@ const BookkeepingUpsellBar = ({
|
|
|
36162
36175
|
onClick ? /* @__PURE__ */ jsxRuntime.jsx(Button$1, { variant: ButtonVariant.secondary, onClick, children: "Schedule a demo" }) : href ? /* @__PURE__ */ jsxRuntime.jsx(Link$1, { href, target: "_blank", variant: ButtonVariant.secondary, children: "Schedule a demo" }) : null
|
|
36163
36176
|
] });
|
|
36164
36177
|
};
|
|
36165
|
-
const ChevronRightFill = (
|
|
36166
|
-
var
|
|
36178
|
+
const ChevronRightFill = (_cd) => {
|
|
36179
|
+
var _dd = _cd, { size = 18 } = _dd, props = __objRest(_dd, ["size"]);
|
|
36167
36180
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
36168
36181
|
"svg",
|
|
36169
36182
|
__spreadProps(__spreadValues({
|
|
@@ -36190,7 +36203,7 @@ const ChevronRightFill = (_ad) => {
|
|
|
36190
36203
|
};
|
|
36191
36204
|
const DataTableHeader = ({ name, count, slotProps = {}, slots = {} }) => {
|
|
36192
36205
|
const { showCount, totalCount } = count != null ? count : {};
|
|
36193
|
-
const { Filters
|
|
36206
|
+
const { Filters, HeaderActions, HeaderFilters } = slots;
|
|
36194
36207
|
return /* @__PURE__ */ jsxRuntime.jsxs(VStack, { children: [
|
|
36195
36208
|
/* @__PURE__ */ jsxRuntime.jsxs(HStack, { justify: "space-between", align: "center", gap: "xs", className: "Layer__DataTableHeader__Header", children: [
|
|
36196
36209
|
/* @__PURE__ */ jsxRuntime.jsxs(HStack, { pis: "md", align: "center", gap: "xl", children: [
|
|
@@ -36205,8 +36218,8 @@ const DataTableHeader = ({ name, count, slotProps = {}, slots = {} }) => {
|
|
|
36205
36218
|
HeaderActions && /* @__PURE__ */ jsxRuntime.jsx(HeaderActions, {})
|
|
36206
36219
|
] })
|
|
36207
36220
|
] }),
|
|
36208
|
-
|
|
36209
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
36221
|
+
Filters && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { pis: "md", pie: "md", justify: "space-between", align: "center", className: "Layer__DataTableHeader__Filters", children: [
|
|
36222
|
+
/* @__PURE__ */ jsxRuntime.jsx(Filters, {}),
|
|
36210
36223
|
slotProps.ClearFiltersButton && /* @__PURE__ */ jsxRuntime.jsx(Button, __spreadProps(__spreadValues({ variant: "outlined" }, slotProps.ClearFiltersButton), { children: "Clear All Filters" }))
|
|
36211
36224
|
] })
|
|
36212
36225
|
] });
|
|
@@ -37131,7 +37144,7 @@ class InvoiceSummaryStatsSWRResponse {
|
|
|
37131
37144
|
return this.swrResponse.error !== void 0;
|
|
37132
37145
|
}
|
|
37133
37146
|
}
|
|
37134
|
-
function buildKey$
|
|
37147
|
+
function buildKey$i({
|
|
37135
37148
|
access_token: accessToken,
|
|
37136
37149
|
apiUrl,
|
|
37137
37150
|
businessId
|
|
@@ -37150,7 +37163,7 @@ function useInvoiceSummaryStats() {
|
|
|
37150
37163
|
const { data } = useAuth();
|
|
37151
37164
|
const { businessId } = useLayerContext();
|
|
37152
37165
|
const response = useSWR(
|
|
37153
|
-
() => buildKey$
|
|
37166
|
+
() => buildKey$i(__spreadProps(__spreadValues({}, data), {
|
|
37154
37167
|
businessId
|
|
37155
37168
|
})),
|
|
37156
37169
|
({ accessToken, apiUrl, businessId: businessId2 }) => getInvoiceSummaryStats(
|
|
@@ -37181,7 +37194,7 @@ var UpsertInvoiceMode = /* @__PURE__ */ ((UpsertInvoiceMode2) => {
|
|
|
37181
37194
|
})(UpsertInvoiceMode || {});
|
|
37182
37195
|
const createInvoice = post(({ businessId }) => `/v1/businesses/${businessId}/invoices`);
|
|
37183
37196
|
const updateInvoice = put(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}`);
|
|
37184
|
-
function buildKey$
|
|
37197
|
+
function buildKey$h({
|
|
37185
37198
|
access_token: accessToken,
|
|
37186
37199
|
apiUrl,
|
|
37187
37200
|
businessId,
|
|
@@ -37253,7 +37266,7 @@ const useUpsertInvoice = (props) => {
|
|
|
37253
37266
|
const { mode } = props;
|
|
37254
37267
|
const invoiceId = mode === "Update" ? props.invoiceId : void 0;
|
|
37255
37268
|
const rawMutationResponse = useSWRMutation(
|
|
37256
|
-
() => buildKey$
|
|
37269
|
+
() => buildKey$h(__spreadProps(__spreadValues({}, data), {
|
|
37257
37270
|
businessId,
|
|
37258
37271
|
invoiceId
|
|
37259
37272
|
})),
|
|
@@ -37522,7 +37535,7 @@ const RefundInvoiceReturnSchema = effect.Schema.Struct({
|
|
|
37522
37535
|
data: CustomerRefundSchema
|
|
37523
37536
|
});
|
|
37524
37537
|
const refundInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/refund`);
|
|
37525
|
-
function buildKey$
|
|
37538
|
+
function buildKey$g({
|
|
37526
37539
|
access_token: accessToken,
|
|
37527
37540
|
apiUrl,
|
|
37528
37541
|
businessId,
|
|
@@ -37567,7 +37580,7 @@ const useRefundInvoice = ({ invoiceId }) => {
|
|
|
37567
37580
|
return updateInvoiceWithRefund(invoice);
|
|
37568
37581
|
}, [invoiceId]);
|
|
37569
37582
|
const rawMutationResponse = useSWRMutation(
|
|
37570
|
-
() => buildKey$
|
|
37583
|
+
() => buildKey$g(__spreadProps(__spreadValues({}, data), {
|
|
37571
37584
|
businessId,
|
|
37572
37585
|
invoiceId
|
|
37573
37586
|
})),
|
|
@@ -37755,7 +37768,7 @@ const ResetInvoiceReturnSchema = effect.Schema.Struct({
|
|
|
37755
37768
|
data: InvoiceSchema
|
|
37756
37769
|
});
|
|
37757
37770
|
const resetInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/reset`);
|
|
37758
|
-
function buildKey$
|
|
37771
|
+
function buildKey$f({
|
|
37759
37772
|
access_token: accessToken,
|
|
37760
37773
|
apiUrl,
|
|
37761
37774
|
businessId,
|
|
@@ -37793,7 +37806,7 @@ const useResetInvoice = ({ invoiceId }) => {
|
|
|
37793
37806
|
const { data } = useAuth();
|
|
37794
37807
|
const { businessId } = useLayerContext();
|
|
37795
37808
|
const rawMutationResponse = useSWRMutation(
|
|
37796
|
-
() => buildKey$
|
|
37809
|
+
() => buildKey$f(__spreadProps(__spreadValues({}, data), {
|
|
37797
37810
|
businessId,
|
|
37798
37811
|
invoiceId
|
|
37799
37812
|
})),
|
|
@@ -37856,7 +37869,7 @@ const VoidInvoiceReturnSchema = effect.Schema.Struct({
|
|
|
37856
37869
|
data: InvoiceSchema
|
|
37857
37870
|
});
|
|
37858
37871
|
const voidInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/void`);
|
|
37859
|
-
function buildKey$
|
|
37872
|
+
function buildKey$e({
|
|
37860
37873
|
access_token: accessToken,
|
|
37861
37874
|
apiUrl,
|
|
37862
37875
|
businessId,
|
|
@@ -37894,7 +37907,7 @@ const useVoidInvoice = ({ invoiceId }) => {
|
|
|
37894
37907
|
const { data } = useAuth();
|
|
37895
37908
|
const { businessId } = useLayerContext();
|
|
37896
37909
|
const rawMutationResponse = useSWRMutation(
|
|
37897
|
-
() => buildKey$
|
|
37910
|
+
() => buildKey$e(__spreadProps(__spreadValues({}, data), {
|
|
37898
37911
|
businessId,
|
|
37899
37912
|
invoiceId
|
|
37900
37913
|
})),
|
|
@@ -38013,7 +38026,7 @@ const InvoiceWriteoffSchema = effect.Schema.Struct({
|
|
|
38013
38026
|
});
|
|
38014
38027
|
const CREATE_INVOICE_WRITEOFF_TAG_KEY = "#writeoff-invoice";
|
|
38015
38028
|
const writeoffInvoice = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/write-off`);
|
|
38016
|
-
function buildKey$
|
|
38029
|
+
function buildKey$d({
|
|
38017
38030
|
access_token: accessToken,
|
|
38018
38031
|
apiUrl,
|
|
38019
38032
|
businessId,
|
|
@@ -38064,7 +38077,7 @@ const useWriteoffInvoice = ({ invoiceId }) => {
|
|
|
38064
38077
|
return updateInvoiceWithWriteoff(invoice);
|
|
38065
38078
|
}, [invoiceId]);
|
|
38066
38079
|
const rawMutationResponse = useSWRMutation(
|
|
38067
|
-
() => buildKey$
|
|
38080
|
+
() => buildKey$d(__spreadProps(__spreadValues({}, data), {
|
|
38068
38081
|
businessId,
|
|
38069
38082
|
invoiceId
|
|
38070
38083
|
})),
|
|
@@ -39060,7 +39073,7 @@ var UpsertDedicatedInvoicePaymentMode = /* @__PURE__ */ ((UpsertDedicatedInvoice
|
|
|
39060
39073
|
})(UpsertDedicatedInvoicePaymentMode || {});
|
|
39061
39074
|
const createDedicatedInvoicePayment = post(({ businessId, invoiceId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/payment/`);
|
|
39062
39075
|
const updateDedicatedInvoicePayment = put(({ businessId, invoiceId, invoicePaymentId }) => `/v1/businesses/${businessId}/invoices/${invoiceId}/payment/${invoicePaymentId}`);
|
|
39063
|
-
function buildKey$
|
|
39076
|
+
function buildKey$c({
|
|
39064
39077
|
access_token: accessToken,
|
|
39065
39078
|
apiUrl,
|
|
39066
39079
|
businessId,
|
|
@@ -39145,7 +39158,7 @@ const useUpsertDedicatedInvoicePayment = (props) => {
|
|
|
39145
39158
|
return updateInvoiceWithPayment(invoice, invoicePayment);
|
|
39146
39159
|
}, [invoiceId]);
|
|
39147
39160
|
const rawMutationResponse = useSWRMutation(
|
|
39148
|
-
() => buildKey$
|
|
39161
|
+
() => buildKey$c(__spreadProps(__spreadValues({}, data), {
|
|
39149
39162
|
businessId,
|
|
39150
39163
|
invoiceId,
|
|
39151
39164
|
invoicePaymentId
|
|
@@ -39445,8 +39458,8 @@ const getClassnameForSubComponent = (className, suffix) => {
|
|
|
39445
39458
|
};
|
|
39446
39459
|
const METER_CLASS_NAME = "Layer__Meter";
|
|
39447
39460
|
const Meter = react.forwardRef(
|
|
39448
|
-
function Meter2(
|
|
39449
|
-
var
|
|
39461
|
+
function Meter2(_ed, ref) {
|
|
39462
|
+
var _fd = _ed, { className, label, meterOnly } = _fd, restProps = __objRest(_fd, ["className", "label", "meterOnly"]);
|
|
39450
39463
|
return /* @__PURE__ */ jsxRuntime.jsx(reactAriaComponents.Meter, __spreadProps(__spreadValues(__spreadProps(__spreadValues({}, restProps), { className: classNames(METER_CLASS_NAME, className), ref }), meterOnly && { "aria-label": label }), { children: ({ percentage, valueText }) => /* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "3xs", fluid: true, children: [
|
|
39451
39464
|
!meterOnly && /* @__PURE__ */ jsxRuntime.jsxs(HStack, { justify: "space-between", children: [
|
|
39452
39465
|
/* @__PURE__ */ jsxRuntime.jsx(Label, { slot: "label", children: label }),
|
|
@@ -39561,11 +39574,11 @@ const ProfitAndLossView = (props) => {
|
|
|
39561
39574
|
const containerRef = react.useRef(null);
|
|
39562
39575
|
return /* @__PURE__ */ jsxRuntime.jsx(Container, { name: COMPONENT_NAME$3, ref: containerRef, children: /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLoss, { children: /* @__PURE__ */ jsxRuntime.jsx(ProfitAndLossPanel, __spreadValues({ containerRef }, props)) }) });
|
|
39563
39576
|
};
|
|
39564
|
-
const ProfitAndLossPanel = (
|
|
39565
|
-
var
|
|
39577
|
+
const ProfitAndLossPanel = (_gd) => {
|
|
39578
|
+
var _hd = _gd, {
|
|
39566
39579
|
containerRef,
|
|
39567
39580
|
stringOverrides
|
|
39568
|
-
} =
|
|
39581
|
+
} = _hd, props = __objRest(_hd, [
|
|
39569
39582
|
"containerRef",
|
|
39570
39583
|
"stringOverrides"
|
|
39571
39584
|
]);
|
|
@@ -39828,13 +39841,13 @@ function ExpandableDataTable({
|
|
|
39828
39841
|
);
|
|
39829
39842
|
}
|
|
39830
39843
|
const UNIFIED_REPORT_TAG_KEY = "#unified-report";
|
|
39831
|
-
function buildKey$
|
|
39832
|
-
var
|
|
39844
|
+
function buildKey$b(_id) {
|
|
39845
|
+
var _jd = _id, {
|
|
39833
39846
|
access_token: accessToken,
|
|
39834
39847
|
apiUrl,
|
|
39835
39848
|
businessId,
|
|
39836
39849
|
report
|
|
39837
|
-
} =
|
|
39850
|
+
} = _jd, dateParams = __objRest(_jd, [
|
|
39838
39851
|
"access_token",
|
|
39839
39852
|
"apiUrl",
|
|
39840
39853
|
"businessId",
|
|
@@ -39850,8 +39863,8 @@ function buildKey$7(_gd) {
|
|
|
39850
39863
|
}, dateParams);
|
|
39851
39864
|
}
|
|
39852
39865
|
}
|
|
39853
|
-
const getUnifiedReport = get$1((
|
|
39854
|
-
var
|
|
39866
|
+
const getUnifiedReport = get$1((_kd) => {
|
|
39867
|
+
var _ld = _kd, { businessId, report } = _ld, dateParams = __objRest(_ld, ["businessId", "report"]);
|
|
39855
39868
|
const parameters = toDefinedSearchParameters(__spreadValues({}, dateParams));
|
|
39856
39869
|
return `/v1/businesses/${businessId}/reports/unified/${report}?${parameters}`;
|
|
39857
39870
|
});
|
|
@@ -39880,13 +39893,13 @@ class UnifiedReportSWRResponse {
|
|
|
39880
39893
|
return this.swrResponse.mutate;
|
|
39881
39894
|
}
|
|
39882
39895
|
}
|
|
39883
|
-
function useUnifiedReport(
|
|
39884
|
-
var
|
|
39896
|
+
function useUnifiedReport(_md) {
|
|
39897
|
+
var _nd = _md, { report } = _nd, dateParams = __objRest(_nd, ["report"]);
|
|
39885
39898
|
const { data: auth } = useAuth();
|
|
39886
39899
|
const { apiUrl } = useEnvironment();
|
|
39887
39900
|
const { businessId } = useLayerContext();
|
|
39888
39901
|
const swrResponse = useSWR(
|
|
39889
|
-
() => buildKey$
|
|
39902
|
+
() => buildKey$b(__spreadValues(__spreadProps(__spreadValues({}, auth), {
|
|
39890
39903
|
apiUrl,
|
|
39891
39904
|
businessId,
|
|
39892
39905
|
report
|
|
@@ -40002,7 +40015,7 @@ class DownloadUnifiedReportSWRResponse {
|
|
|
40002
40015
|
return this.swrResponse.error !== void 0;
|
|
40003
40016
|
}
|
|
40004
40017
|
}
|
|
40005
|
-
function buildKey$
|
|
40018
|
+
function buildKey$a({
|
|
40006
40019
|
access_token: accessToken,
|
|
40007
40020
|
apiUrl,
|
|
40008
40021
|
businessId,
|
|
@@ -40053,7 +40066,7 @@ function useUnifiedReportDownload({ onSuccess } = {}) {
|
|
|
40053
40066
|
const { businessId } = useLayerContext();
|
|
40054
40067
|
const reportWithDateParams = useUnifiedReportWithDateParams();
|
|
40055
40068
|
const rawMutationResponse = useSWRMutation(
|
|
40056
|
-
() => buildKey$
|
|
40069
|
+
() => buildKey$a(__spreadProps(__spreadValues({}, auth), {
|
|
40057
40070
|
businessId,
|
|
40058
40071
|
reportWithDateParams
|
|
40059
40072
|
})),
|
|
@@ -40429,7 +40442,7 @@ const useBills = () => {
|
|
|
40429
40442
|
refetch
|
|
40430
40443
|
};
|
|
40431
40444
|
};
|
|
40432
|
-
function buildKey$
|
|
40445
|
+
function buildKey$9({
|
|
40433
40446
|
access_token: accessToken,
|
|
40434
40447
|
apiUrl,
|
|
40435
40448
|
businessId,
|
|
@@ -40563,7 +40576,7 @@ const useBillsRecordPayment = ({ refetchAllBills }) => {
|
|
|
40563
40576
|
};
|
|
40564
40577
|
}, [billsToPay, paymentDate, paymentMethod]);
|
|
40565
40578
|
const createPaymentMutation = useSWRMutation(
|
|
40566
|
-
() => buildKey$
|
|
40579
|
+
() => buildKey$9({
|
|
40567
40580
|
access_token: auth == null ? void 0 : auth.access_token,
|
|
40568
40581
|
apiUrl: auth == null ? void 0 : auth.apiUrl,
|
|
40569
40582
|
businessId,
|
|
@@ -40892,7 +40905,7 @@ const BillsPaymentRecorded = ({
|
|
|
40892
40905
|
] })
|
|
40893
40906
|
] });
|
|
40894
40907
|
};
|
|
40895
|
-
function buildKey$
|
|
40908
|
+
function buildKey$8({
|
|
40896
40909
|
access_token: accessToken,
|
|
40897
40910
|
apiUrl,
|
|
40898
40911
|
businessId,
|
|
@@ -40913,7 +40926,7 @@ const useUnpaidBillsByVendor = ({ vendorId }) => {
|
|
|
40913
40926
|
const { data: auth } = useAuth();
|
|
40914
40927
|
const { apiUrl } = useEnvironment();
|
|
40915
40928
|
return useSWR(
|
|
40916
|
-
() => buildKey$
|
|
40929
|
+
() => buildKey$8(__spreadProps(__spreadValues({}, auth), {
|
|
40917
40930
|
apiUrl,
|
|
40918
40931
|
businessId,
|
|
40919
40932
|
vendorId
|
|
@@ -41411,19 +41424,19 @@ const VendorsProvider = ({ children }) => {
|
|
|
41411
41424
|
const vendors = useVendors();
|
|
41412
41425
|
return /* @__PURE__ */ jsxRuntime.jsx(VendorsContext.Provider, { value: vendors, children });
|
|
41413
41426
|
};
|
|
41414
|
-
const SelectVendor = (
|
|
41415
|
-
var
|
|
41427
|
+
const SelectVendor = (_od) => {
|
|
41428
|
+
var _pd = _od, { withContext = true } = _pd, props = __objRest(_pd, ["withContext"]);
|
|
41416
41429
|
if (withContext) {
|
|
41417
41430
|
return /* @__PURE__ */ jsxRuntime.jsx(VendorsProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectVendorContent, __spreadValues({}, props)) });
|
|
41418
41431
|
}
|
|
41419
41432
|
return /* @__PURE__ */ jsxRuntime.jsx(SelectVendorContent, __spreadValues({}, props));
|
|
41420
41433
|
};
|
|
41421
|
-
const SelectVendorContent = (
|
|
41422
|
-
var
|
|
41434
|
+
const SelectVendorContent = (_qd) => {
|
|
41435
|
+
var _rd = _qd, {
|
|
41423
41436
|
value,
|
|
41424
41437
|
onChange,
|
|
41425
41438
|
placeholder = "Select vendor"
|
|
41426
|
-
} =
|
|
41439
|
+
} = _rd, props = __objRest(_rd, [
|
|
41427
41440
|
"value",
|
|
41428
41441
|
"onChange",
|
|
41429
41442
|
"placeholder"
|
|
@@ -42190,8 +42203,8 @@ const BillsTableWithPanel = ({
|
|
|
42190
42203
|
}
|
|
42191
42204
|
);
|
|
42192
42205
|
};
|
|
42193
|
-
const Bills = (
|
|
42194
|
-
var
|
|
42206
|
+
const Bills = (_sd) => {
|
|
42207
|
+
var _td = _sd, { context = true } = _td, props = __objRest(_td, ["context"]);
|
|
42195
42208
|
if (context) {
|
|
42196
42209
|
return /* @__PURE__ */ jsxRuntime.jsx(BillsProvider, { children: /* @__PURE__ */ jsxRuntime.jsx(BillsContent, __spreadValues({}, props)) });
|
|
42197
42210
|
}
|
|
@@ -42249,8 +42262,8 @@ const getTimezoneDisplay = (date2) => {
|
|
|
42249
42262
|
};
|
|
42250
42263
|
const LINK_CLASS_NAME = "Layer__UI__Link";
|
|
42251
42264
|
const Link = react.forwardRef(
|
|
42252
|
-
function Link2(
|
|
42253
|
-
var
|
|
42265
|
+
function Link2(_ud, ref) {
|
|
42266
|
+
var _vd = _ud, {
|
|
42254
42267
|
children,
|
|
42255
42268
|
size = "md",
|
|
42256
42269
|
ellipsis,
|
|
@@ -42259,7 +42272,7 @@ const Link = react.forwardRef(
|
|
|
42259
42272
|
href,
|
|
42260
42273
|
target,
|
|
42261
42274
|
rel
|
|
42262
|
-
} =
|
|
42275
|
+
} = _vd, restProps = __objRest(_vd, [
|
|
42263
42276
|
"children",
|
|
42264
42277
|
"size",
|
|
42265
42278
|
"ellipsis",
|
|
@@ -42784,6 +42797,18 @@ const VehicleSchema = effect.Schema.Struct({
|
|
|
42784
42797
|
deletedAt: effect.pipe(
|
|
42785
42798
|
effect.Schema.propertySignature(effect.Schema.NullishOr(effect.Schema.Date)),
|
|
42786
42799
|
effect.Schema.fromKey("deleted_at")
|
|
42800
|
+
),
|
|
42801
|
+
archivedAt: effect.pipe(
|
|
42802
|
+
effect.Schema.propertySignature(effect.Schema.NullishOr(effect.Schema.Date)),
|
|
42803
|
+
effect.Schema.fromKey("archived_at")
|
|
42804
|
+
),
|
|
42805
|
+
isPrimary: effect.pipe(
|
|
42806
|
+
effect.Schema.propertySignature(effect.Schema.Boolean),
|
|
42807
|
+
effect.Schema.fromKey("is_primary")
|
|
42808
|
+
),
|
|
42809
|
+
isEligibleForDeletion: effect.pipe(
|
|
42810
|
+
effect.Schema.propertySignature(effect.Schema.Boolean),
|
|
42811
|
+
effect.Schema.fromKey("is_eligible_for_deletion")
|
|
42787
42812
|
)
|
|
42788
42813
|
});
|
|
42789
42814
|
effect.Schema.Struct({
|
|
@@ -42791,7 +42816,8 @@ effect.Schema.Struct({
|
|
|
42791
42816
|
year: effect.Schema.Number,
|
|
42792
42817
|
licensePlate: effect.Schema.String,
|
|
42793
42818
|
vin: effect.Schema.String,
|
|
42794
|
-
description: effect.Schema.String
|
|
42819
|
+
description: effect.Schema.String,
|
|
42820
|
+
isPrimary: effect.Schema.Boolean
|
|
42795
42821
|
});
|
|
42796
42822
|
const UpsertVehicleSchema = effect.Schema.Struct({
|
|
42797
42823
|
makeAndModel: effect.pipe(
|
|
@@ -42804,7 +42830,11 @@ const UpsertVehicleSchema = effect.Schema.Struct({
|
|
|
42804
42830
|
effect.Schema.fromKey("license_plate")
|
|
42805
42831
|
),
|
|
42806
42832
|
vin: effect.Schema.NullishOr(effect.Schema.String),
|
|
42807
|
-
description: effect.Schema.NullishOr(effect.Schema.String)
|
|
42833
|
+
description: effect.Schema.NullishOr(effect.Schema.String),
|
|
42834
|
+
isPrimary: effect.pipe(
|
|
42835
|
+
effect.Schema.propertySignature(effect.Schema.Boolean),
|
|
42836
|
+
effect.Schema.fromKey("is_primary")
|
|
42837
|
+
)
|
|
42808
42838
|
});
|
|
42809
42839
|
const CalendarDateFromSelf = effect.Schema.declare(
|
|
42810
42840
|
(input) => input instanceof date.CalendarDate
|
|
@@ -42951,6 +42981,7 @@ const TripsRouteStoreContext = react.createContext(
|
|
|
42951
42981
|
selectedVehicle: null,
|
|
42952
42982
|
purposeFilter: TripPurposeFilterValue.All
|
|
42953
42983
|
},
|
|
42984
|
+
currentTripsPage: 0,
|
|
42954
42985
|
setTableFilters: () => {
|
|
42955
42986
|
},
|
|
42956
42987
|
navigate: {
|
|
@@ -42958,6 +42989,10 @@ const TripsRouteStoreContext = react.createContext(
|
|
|
42958
42989
|
},
|
|
42959
42990
|
toVehicleManagement: () => {
|
|
42960
42991
|
}
|
|
42992
|
+
},
|
|
42993
|
+
actions: {
|
|
42994
|
+
setCurrentTripsPage: () => {
|
|
42995
|
+
}
|
|
42961
42996
|
}
|
|
42962
42997
|
}))
|
|
42963
42998
|
);
|
|
@@ -42975,6 +43010,15 @@ function useTripsNavigation() {
|
|
|
42975
43010
|
const store = react.useContext(TripsRouteStoreContext);
|
|
42976
43011
|
return zustand.useStore(store, (state) => state.navigate);
|
|
42977
43012
|
}
|
|
43013
|
+
function useCurrentTripsPage() {
|
|
43014
|
+
const store = react.useContext(TripsRouteStoreContext);
|
|
43015
|
+
const currentTripsPage = zustand.useStore(store, (state) => state.currentTripsPage);
|
|
43016
|
+
const setCurrentTripsPage = zustand.useStore(store, (state) => state.actions.setCurrentTripsPage);
|
|
43017
|
+
return react.useMemo(
|
|
43018
|
+
() => ({ currentTripsPage, setCurrentTripsPage }),
|
|
43019
|
+
[currentTripsPage, setCurrentTripsPage]
|
|
43020
|
+
);
|
|
43021
|
+
}
|
|
42978
43022
|
function TripsRouteStoreProvider(props) {
|
|
42979
43023
|
const [store] = react.useState(
|
|
42980
43024
|
() => zustand.createStore((set) => ({
|
|
@@ -42987,6 +43031,7 @@ function TripsRouteStoreProvider(props) {
|
|
|
42987
43031
|
selectedVehicle: null,
|
|
42988
43032
|
purposeFilter: TripPurposeFilterValue.All
|
|
42989
43033
|
},
|
|
43034
|
+
currentTripsPage: 0,
|
|
42990
43035
|
setTableFilters: (patchFilters) => {
|
|
42991
43036
|
set((state) => ({
|
|
42992
43037
|
tableFilters: __spreadValues(__spreadValues({}, state.tableFilters), patchFilters)
|
|
@@ -43009,65 +43054,28 @@ function TripsRouteStoreProvider(props) {
|
|
|
43009
43054
|
}
|
|
43010
43055
|
}));
|
|
43011
43056
|
}
|
|
43057
|
+
},
|
|
43058
|
+
actions: {
|
|
43059
|
+
setCurrentTripsPage: (page) => {
|
|
43060
|
+
set({ currentTripsPage: page });
|
|
43061
|
+
}
|
|
43012
43062
|
}
|
|
43013
43063
|
}))
|
|
43014
43064
|
);
|
|
43015
43065
|
return /* @__PURE__ */ jsxRuntime.jsx(TripsRouteStoreContext.Provider, { value: store, children: props.children });
|
|
43016
43066
|
}
|
|
43017
|
-
|
|
43018
|
-
|
|
43019
|
-
|
|
43020
|
-
|
|
43021
|
-
|
|
43022
|
-
|
|
43023
|
-
purpose: trip.purpose,
|
|
43024
|
-
startAddress: trip.startAddress || "",
|
|
43025
|
-
endAddress: trip.endAddress || "",
|
|
43026
|
-
description: trip.description || ""
|
|
43027
|
-
};
|
|
43028
|
-
}
|
|
43029
|
-
return {
|
|
43030
|
-
vehicle: null,
|
|
43031
|
-
tripDate: date.today(date.getLocalTimeZone()),
|
|
43032
|
-
distance: BIG_DECIMAL_ZERO,
|
|
43033
|
-
purpose: TripPurpose.Business,
|
|
43034
|
-
startAddress: "",
|
|
43035
|
-
endAddress: "",
|
|
43036
|
-
description: ""
|
|
43037
|
-
};
|
|
43038
|
-
};
|
|
43039
|
-
const validateTripForm = ({ trip }) => {
|
|
43040
|
-
const { vehicle, tripDate, distance, purpose } = trip;
|
|
43041
|
-
const errors = [];
|
|
43042
|
-
if (tripDate === null) {
|
|
43043
|
-
errors.push({ tripDate: "Trip date is a required field." });
|
|
43044
|
-
}
|
|
43045
|
-
if (tripDate && tripDate.compare(date.today(date.getLocalTimeZone())) > 0) {
|
|
43046
|
-
errors.push({ tripDate: "Trip date cannot be in the future." });
|
|
43047
|
-
}
|
|
43048
|
-
if (!effect.BigDecimal.isPositive(distance)) {
|
|
43049
|
-
errors.push({ distance: "Distance must be greater than zero." });
|
|
43050
|
-
}
|
|
43051
|
-
if (!purpose) {
|
|
43052
|
-
errors.push({ purpose: "Purpose is a required field." });
|
|
43067
|
+
function useAutoResetPageIndex(filters, data) {
|
|
43068
|
+
const autoResetPageIndexRef = react.useRef(false);
|
|
43069
|
+
const prevFiltersRef = react.useRef(filters);
|
|
43070
|
+
if (prevFiltersRef.current !== filters) {
|
|
43071
|
+
autoResetPageIndexRef.current = true;
|
|
43072
|
+
prevFiltersRef.current = filters;
|
|
43053
43073
|
}
|
|
43054
|
-
|
|
43055
|
-
|
|
43056
|
-
}
|
|
43057
|
-
return
|
|
43058
|
-
}
|
|
43059
|
-
const convertTripFormToUpsertTrip = (form) => {
|
|
43060
|
-
var _a;
|
|
43061
|
-
return {
|
|
43062
|
-
vehicleId: (_a = form.vehicle) == null ? void 0 : _a.id,
|
|
43063
|
-
tripDate: form.tripDate,
|
|
43064
|
-
distance: form.distance,
|
|
43065
|
-
purpose: form.purpose,
|
|
43066
|
-
startAddress: form.startAddress.trim() || null,
|
|
43067
|
-
endAddress: form.endAddress.trim() || null,
|
|
43068
|
-
description: form.description.trim() || null
|
|
43069
|
-
};
|
|
43070
|
-
};
|
|
43074
|
+
react.useEffect(() => {
|
|
43075
|
+
autoResetPageIndexRef.current = false;
|
|
43076
|
+
}, [data]);
|
|
43077
|
+
return autoResetPageIndexRef;
|
|
43078
|
+
}
|
|
43071
43079
|
const LIST_TRIPS_TAG_KEY = "#list-trips";
|
|
43072
43080
|
const ListTripsResponseSchema = effect.Schema.Struct({
|
|
43073
43081
|
data: effect.Schema.Array(TripSchema),
|
|
@@ -43191,6 +43199,243 @@ function useTripsGlobalCacheActions() {
|
|
|
43191
43199
|
);
|
|
43192
43200
|
return { patchTripByKey, forceReloadTrips };
|
|
43193
43201
|
}
|
|
43202
|
+
const ListVehiclesResponseSchema = effect.Schema.Struct({
|
|
43203
|
+
data: effect.Schema.Array(VehicleSchema)
|
|
43204
|
+
});
|
|
43205
|
+
const listVehicles = get$1(({ businessId, allowArchived }) => {
|
|
43206
|
+
const parameters = toDefinedSearchParameters({ allowArchived });
|
|
43207
|
+
return `/v1/businesses/${businessId}/mileage/vehicles?${parameters}`;
|
|
43208
|
+
});
|
|
43209
|
+
const VEHICLES_TAG_KEY = "#list-vehicles";
|
|
43210
|
+
function buildKey$7({
|
|
43211
|
+
access_token: accessToken,
|
|
43212
|
+
apiUrl,
|
|
43213
|
+
businessId,
|
|
43214
|
+
allowArchived
|
|
43215
|
+
}) {
|
|
43216
|
+
if (accessToken && apiUrl) {
|
|
43217
|
+
return {
|
|
43218
|
+
accessToken,
|
|
43219
|
+
apiUrl,
|
|
43220
|
+
businessId,
|
|
43221
|
+
allowArchived,
|
|
43222
|
+
tags: [VEHICLES_TAG_KEY]
|
|
43223
|
+
};
|
|
43224
|
+
}
|
|
43225
|
+
}
|
|
43226
|
+
class ListVehiclesSWRResponse {
|
|
43227
|
+
constructor(swrResponse) {
|
|
43228
|
+
__publicField(this, "swrResponse");
|
|
43229
|
+
this.swrResponse = swrResponse;
|
|
43230
|
+
}
|
|
43231
|
+
get data() {
|
|
43232
|
+
var _a;
|
|
43233
|
+
return (_a = this.swrResponse.data) == null ? void 0 : _a.data;
|
|
43234
|
+
}
|
|
43235
|
+
get isLoading() {
|
|
43236
|
+
return this.swrResponse.isLoading;
|
|
43237
|
+
}
|
|
43238
|
+
get isValidating() {
|
|
43239
|
+
return this.swrResponse.isValidating;
|
|
43240
|
+
}
|
|
43241
|
+
get isError() {
|
|
43242
|
+
return this.swrResponse.error !== void 0;
|
|
43243
|
+
}
|
|
43244
|
+
}
|
|
43245
|
+
function useListVehicles({ allowArchived } = {}) {
|
|
43246
|
+
const { data } = useAuth();
|
|
43247
|
+
const { businessId } = useLayerContext();
|
|
43248
|
+
const response = useSWR(
|
|
43249
|
+
() => buildKey$7(__spreadProps(__spreadValues({}, data), {
|
|
43250
|
+
businessId,
|
|
43251
|
+
allowArchived
|
|
43252
|
+
})),
|
|
43253
|
+
({ accessToken, apiUrl, businessId: businessId2, allowArchived: allowArchived2 }) => listVehicles(
|
|
43254
|
+
apiUrl,
|
|
43255
|
+
accessToken,
|
|
43256
|
+
{
|
|
43257
|
+
params: {
|
|
43258
|
+
businessId: businessId2,
|
|
43259
|
+
allowArchived: allowArchived2
|
|
43260
|
+
}
|
|
43261
|
+
}
|
|
43262
|
+
)().then(effect.Schema.decodeUnknownPromise(ListVehiclesResponseSchema))
|
|
43263
|
+
);
|
|
43264
|
+
return new ListVehiclesSWRResponse(response);
|
|
43265
|
+
}
|
|
43266
|
+
const withUpdatedVehicle = (updated) => (vehicle) => vehicle.id === updated.id ? updated : vehicle;
|
|
43267
|
+
function useVehiclesGlobalCacheActions() {
|
|
43268
|
+
const { patchCache, forceReload } = useGlobalCacheActions();
|
|
43269
|
+
const patchVehicleByKey = react.useCallback(
|
|
43270
|
+
(updatedVehicle) => patchCache(
|
|
43271
|
+
(tags) => tags.includes(VEHICLES_TAG_KEY),
|
|
43272
|
+
(currentData) => {
|
|
43273
|
+
if (!currentData) return currentData;
|
|
43274
|
+
return __spreadProps(__spreadValues({}, currentData), {
|
|
43275
|
+
data: currentData.data.map(withUpdatedVehicle(updatedVehicle))
|
|
43276
|
+
});
|
|
43277
|
+
}
|
|
43278
|
+
),
|
|
43279
|
+
[patchCache]
|
|
43280
|
+
);
|
|
43281
|
+
const forceReloadVehicles = react.useCallback(
|
|
43282
|
+
() => forceReload((tags) => tags.includes(VEHICLES_TAG_KEY)),
|
|
43283
|
+
[forceReload]
|
|
43284
|
+
);
|
|
43285
|
+
return { patchVehicleByKey, forceReloadVehicles };
|
|
43286
|
+
}
|
|
43287
|
+
const DELETE_TRIP_TAG_KEY = "#delete-trip";
|
|
43288
|
+
const deleteTrip = del(({ businessId, tripId }) => `/v1/businesses/${businessId}/mileage/trips/${tripId}`);
|
|
43289
|
+
function buildKey$6({
|
|
43290
|
+
access_token: accessToken,
|
|
43291
|
+
apiUrl,
|
|
43292
|
+
businessId,
|
|
43293
|
+
tripId
|
|
43294
|
+
}) {
|
|
43295
|
+
if (accessToken && apiUrl) {
|
|
43296
|
+
return {
|
|
43297
|
+
accessToken,
|
|
43298
|
+
apiUrl,
|
|
43299
|
+
businessId,
|
|
43300
|
+
tripId,
|
|
43301
|
+
tags: [DELETE_TRIP_TAG_KEY]
|
|
43302
|
+
};
|
|
43303
|
+
}
|
|
43304
|
+
}
|
|
43305
|
+
class DeleteTripSWRResponse {
|
|
43306
|
+
constructor(swrResponse) {
|
|
43307
|
+
__publicField(this, "swrResponse");
|
|
43308
|
+
this.swrResponse = swrResponse;
|
|
43309
|
+
}
|
|
43310
|
+
get trigger() {
|
|
43311
|
+
return this.swrResponse.trigger;
|
|
43312
|
+
}
|
|
43313
|
+
get isMutating() {
|
|
43314
|
+
return this.swrResponse.isMutating;
|
|
43315
|
+
}
|
|
43316
|
+
get isError() {
|
|
43317
|
+
return this.swrResponse.error !== void 0;
|
|
43318
|
+
}
|
|
43319
|
+
}
|
|
43320
|
+
const useDeleteTrip = ({ tripId }) => {
|
|
43321
|
+
const { data } = useAuth();
|
|
43322
|
+
const { businessId } = useLayerContext();
|
|
43323
|
+
const rawMutationResponse = useSWRMutation(
|
|
43324
|
+
() => buildKey$6(__spreadProps(__spreadValues({}, data), {
|
|
43325
|
+
businessId,
|
|
43326
|
+
tripId
|
|
43327
|
+
})),
|
|
43328
|
+
({ accessToken, apiUrl, businessId: businessId2, tripId: tripId2 }) => {
|
|
43329
|
+
return deleteTrip(
|
|
43330
|
+
apiUrl,
|
|
43331
|
+
accessToken,
|
|
43332
|
+
{ params: { businessId: businessId2, tripId: tripId2 } }
|
|
43333
|
+
);
|
|
43334
|
+
},
|
|
43335
|
+
{
|
|
43336
|
+
revalidate: false,
|
|
43337
|
+
throwOnError: true
|
|
43338
|
+
}
|
|
43339
|
+
);
|
|
43340
|
+
const mutationResponse = new DeleteTripSWRResponse(rawMutationResponse);
|
|
43341
|
+
const { forceReloadTrips } = useTripsGlobalCacheActions();
|
|
43342
|
+
const { forceReloadVehicles } = useVehiclesGlobalCacheActions();
|
|
43343
|
+
const originalTrigger = mutationResponse.trigger;
|
|
43344
|
+
const stableProxiedTrigger = react.useCallback(
|
|
43345
|
+
(...triggerParameters) => __async(null, null, function* () {
|
|
43346
|
+
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
43347
|
+
void forceReloadTrips();
|
|
43348
|
+
void forceReloadVehicles();
|
|
43349
|
+
return triggerResult;
|
|
43350
|
+
}),
|
|
43351
|
+
[originalTrigger, forceReloadTrips, forceReloadVehicles]
|
|
43352
|
+
);
|
|
43353
|
+
return new Proxy(mutationResponse, {
|
|
43354
|
+
get(target, prop) {
|
|
43355
|
+
if (prop === "trigger") {
|
|
43356
|
+
return stableProxiedTrigger;
|
|
43357
|
+
}
|
|
43358
|
+
return Reflect.get(target, prop);
|
|
43359
|
+
}
|
|
43360
|
+
});
|
|
43361
|
+
};
|
|
43362
|
+
function TripDeleteConfirmationModal({
|
|
43363
|
+
isOpen,
|
|
43364
|
+
onOpenChange,
|
|
43365
|
+
trip
|
|
43366
|
+
}) {
|
|
43367
|
+
const { trigger: deleteTrip2 } = useDeleteTrip({ tripId: trip.id });
|
|
43368
|
+
const onConfirm = react.useCallback(() => __async(null, null, function* () {
|
|
43369
|
+
yield deleteTrip2();
|
|
43370
|
+
}), [deleteTrip2]);
|
|
43371
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
43372
|
+
BaseConfirmationModal,
|
|
43373
|
+
{
|
|
43374
|
+
isOpen,
|
|
43375
|
+
onOpenChange,
|
|
43376
|
+
title: "Delete this trip?",
|
|
43377
|
+
description: "This trip will be permanently deleted. This action cannot be undone.",
|
|
43378
|
+
onConfirm,
|
|
43379
|
+
confirmLabel: "Delete trip",
|
|
43380
|
+
cancelLabel: "Cancel",
|
|
43381
|
+
errorText: "Failed to delete trip. Please check your connection and try again."
|
|
43382
|
+
}
|
|
43383
|
+
);
|
|
43384
|
+
}
|
|
43385
|
+
const getTripFormDefaultValues = (trip) => {
|
|
43386
|
+
if (trip) {
|
|
43387
|
+
return {
|
|
43388
|
+
vehicle: trip.vehicle,
|
|
43389
|
+
tripDate: trip.tripDate,
|
|
43390
|
+
distance: trip.distance,
|
|
43391
|
+
purpose: trip.purpose,
|
|
43392
|
+
startAddress: trip.startAddress || "",
|
|
43393
|
+
endAddress: trip.endAddress || "",
|
|
43394
|
+
description: trip.description || ""
|
|
43395
|
+
};
|
|
43396
|
+
}
|
|
43397
|
+
return {
|
|
43398
|
+
vehicle: null,
|
|
43399
|
+
tripDate: date.today(date.getLocalTimeZone()),
|
|
43400
|
+
distance: BIG_DECIMAL_ZERO,
|
|
43401
|
+
purpose: TripPurpose.Business,
|
|
43402
|
+
startAddress: "",
|
|
43403
|
+
endAddress: "",
|
|
43404
|
+
description: ""
|
|
43405
|
+
};
|
|
43406
|
+
};
|
|
43407
|
+
const validateTripForm = ({ trip }) => {
|
|
43408
|
+
const { vehicle, tripDate, distance, purpose } = trip;
|
|
43409
|
+
const errors = [];
|
|
43410
|
+
if (tripDate === null) {
|
|
43411
|
+
errors.push({ tripDate: "Trip date is a required field." });
|
|
43412
|
+
}
|
|
43413
|
+
if (tripDate && tripDate.compare(date.today(date.getLocalTimeZone())) > 0) {
|
|
43414
|
+
errors.push({ tripDate: "Trip date cannot be in the future." });
|
|
43415
|
+
}
|
|
43416
|
+
if (!effect.BigDecimal.isPositive(distance)) {
|
|
43417
|
+
errors.push({ distance: "Distance must be greater than zero." });
|
|
43418
|
+
}
|
|
43419
|
+
if (!purpose) {
|
|
43420
|
+
errors.push({ purpose: "Purpose is a required field." });
|
|
43421
|
+
}
|
|
43422
|
+
if (vehicle === null) {
|
|
43423
|
+
errors.push({ vehicle: "Vehicle is a required field." });
|
|
43424
|
+
}
|
|
43425
|
+
return errors.length > 0 ? errors : null;
|
|
43426
|
+
};
|
|
43427
|
+
const convertTripFormToUpsertTrip = (form) => {
|
|
43428
|
+
var _a;
|
|
43429
|
+
return {
|
|
43430
|
+
vehicleId: (_a = form.vehicle) == null ? void 0 : _a.id,
|
|
43431
|
+
tripDate: form.tripDate,
|
|
43432
|
+
distance: form.distance,
|
|
43433
|
+
purpose: form.purpose,
|
|
43434
|
+
startAddress: form.startAddress.trim() || null,
|
|
43435
|
+
endAddress: form.endAddress.trim() || null,
|
|
43436
|
+
description: form.description.trim() || null
|
|
43437
|
+
};
|
|
43438
|
+
};
|
|
43194
43439
|
const UPSERT_TRIP_TAG_KEY = "#upsert-trip";
|
|
43195
43440
|
var UpsertTripMode = /* @__PURE__ */ ((UpsertTripMode2) => {
|
|
43196
43441
|
UpsertTripMode2["Create"] = "Create";
|
|
@@ -43199,7 +43444,7 @@ var UpsertTripMode = /* @__PURE__ */ ((UpsertTripMode2) => {
|
|
|
43199
43444
|
})(UpsertTripMode || {});
|
|
43200
43445
|
const createTrip = post(({ businessId }) => `/v1/businesses/${businessId}/mileage/trips`);
|
|
43201
43446
|
const updateTrip = patch(({ businessId, tripId }) => `/v1/businesses/${businessId}/mileage/trips/${tripId}`);
|
|
43202
|
-
function buildKey$
|
|
43447
|
+
function buildKey$5({
|
|
43203
43448
|
access_token: accessToken,
|
|
43204
43449
|
apiUrl,
|
|
43205
43450
|
businessId,
|
|
@@ -43271,7 +43516,7 @@ const useUpsertTrip = (props) => {
|
|
|
43271
43516
|
const { mode } = props;
|
|
43272
43517
|
const tripId = mode === "Update" ? props.tripId : void 0;
|
|
43273
43518
|
const rawMutationResponse = useSWRMutation(
|
|
43274
|
-
() => buildKey$
|
|
43519
|
+
() => buildKey$5(__spreadProps(__spreadValues({}, data), {
|
|
43275
43520
|
businessId,
|
|
43276
43521
|
tripId
|
|
43277
43522
|
})),
|
|
@@ -43290,6 +43535,7 @@ const useUpsertTrip = (props) => {
|
|
|
43290
43535
|
);
|
|
43291
43536
|
const mutationResponse = new UpsertTripSWRResponse(rawMutationResponse);
|
|
43292
43537
|
const { patchTripByKey, forceReloadTrips } = useTripsGlobalCacheActions();
|
|
43538
|
+
const { forceReloadVehicles } = useVehiclesGlobalCacheActions();
|
|
43293
43539
|
const originalTrigger = mutationResponse.trigger;
|
|
43294
43540
|
const stableProxiedTrigger = react.useCallback(
|
|
43295
43541
|
(...triggerParameters) => __async(null, null, function* () {
|
|
@@ -43299,9 +43545,10 @@ const useUpsertTrip = (props) => {
|
|
|
43299
43545
|
} else {
|
|
43300
43546
|
void forceReloadTrips();
|
|
43301
43547
|
}
|
|
43548
|
+
void forceReloadVehicles();
|
|
43302
43549
|
return triggerResult;
|
|
43303
43550
|
}),
|
|
43304
|
-
[originalTrigger, mode, patchTripByKey, forceReloadTrips]
|
|
43551
|
+
[originalTrigger, mode, patchTripByKey, forceReloadTrips, forceReloadVehicles]
|
|
43305
43552
|
);
|
|
43306
43553
|
return new Proxy(mutationResponse, {
|
|
43307
43554
|
get(target, prop) {
|
|
@@ -43404,67 +43651,6 @@ const TripPurposeComboBox = ({ value, onValueChange, isReadOnly, className }) =>
|
|
|
43404
43651
|
)
|
|
43405
43652
|
] });
|
|
43406
43653
|
};
|
|
43407
|
-
const ListVehiclesResponseSchema = effect.Schema.Struct({
|
|
43408
|
-
data: effect.Schema.Array(VehicleSchema)
|
|
43409
|
-
});
|
|
43410
|
-
const listVehicles = get$1(({ businessId }) => {
|
|
43411
|
-
return `/v1/businesses/${businessId}/mileage/vehicles`;
|
|
43412
|
-
});
|
|
43413
|
-
const VEHICLES_TAG_KEY = "#list-vehicles";
|
|
43414
|
-
function buildKey$2({
|
|
43415
|
-
access_token: accessToken,
|
|
43416
|
-
apiUrl,
|
|
43417
|
-
businessId,
|
|
43418
|
-
query
|
|
43419
|
-
}) {
|
|
43420
|
-
if (accessToken && apiUrl) {
|
|
43421
|
-
return {
|
|
43422
|
-
accessToken,
|
|
43423
|
-
apiUrl,
|
|
43424
|
-
businessId,
|
|
43425
|
-
query,
|
|
43426
|
-
tags: [VEHICLES_TAG_KEY]
|
|
43427
|
-
};
|
|
43428
|
-
}
|
|
43429
|
-
}
|
|
43430
|
-
class ListVehiclesSWRResponse {
|
|
43431
|
-
constructor(swrResponse) {
|
|
43432
|
-
__publicField(this, "swrResponse");
|
|
43433
|
-
this.swrResponse = swrResponse;
|
|
43434
|
-
}
|
|
43435
|
-
get data() {
|
|
43436
|
-
var _a;
|
|
43437
|
-
return (_a = this.swrResponse.data) == null ? void 0 : _a.data;
|
|
43438
|
-
}
|
|
43439
|
-
get isLoading() {
|
|
43440
|
-
return this.swrResponse.isLoading;
|
|
43441
|
-
}
|
|
43442
|
-
get isValidating() {
|
|
43443
|
-
return this.swrResponse.isValidating;
|
|
43444
|
-
}
|
|
43445
|
-
get isError() {
|
|
43446
|
-
return this.swrResponse.error !== void 0;
|
|
43447
|
-
}
|
|
43448
|
-
}
|
|
43449
|
-
function useListVehicles() {
|
|
43450
|
-
const { data } = useAuth();
|
|
43451
|
-
const { businessId } = useLayerContext();
|
|
43452
|
-
const response = useSWR(
|
|
43453
|
-
() => buildKey$2(__spreadProps(__spreadValues({}, data), {
|
|
43454
|
-
businessId
|
|
43455
|
-
})),
|
|
43456
|
-
({ accessToken, apiUrl, businessId: businessId2 }) => listVehicles(
|
|
43457
|
-
apiUrl,
|
|
43458
|
-
accessToken,
|
|
43459
|
-
{
|
|
43460
|
-
params: {
|
|
43461
|
-
businessId: businessId2
|
|
43462
|
-
}
|
|
43463
|
-
}
|
|
43464
|
-
)().then(effect.Schema.decodeUnknownPromise(ListVehiclesResponseSchema))
|
|
43465
|
-
);
|
|
43466
|
-
return new ListVehiclesSWRResponse(response);
|
|
43467
|
-
}
|
|
43468
43654
|
const getVehicleDisplayName = (vehicle) => `${vehicle.year} ${vehicle.makeAndModel}`;
|
|
43469
43655
|
class VehicleAsOption {
|
|
43470
43656
|
constructor(vehicle) {
|
|
@@ -43683,7 +43869,7 @@ const TripsTableHeaderMenu = () => {
|
|
|
43683
43869
|
);
|
|
43684
43870
|
};
|
|
43685
43871
|
const COMPONENT_NAME = "TripsTable";
|
|
43686
|
-
const getColumnConfig = (onSelectTrip) => ({
|
|
43872
|
+
const getColumnConfig = ({ onSelectTrip, onDeleteTrip }) => ({
|
|
43687
43873
|
[
|
|
43688
43874
|
"TripDate"
|
|
43689
43875
|
/* TripDate */
|
|
@@ -43747,27 +43933,32 @@ const getColumnConfig = (onSelectTrip) => ({
|
|
|
43747
43933
|
cell: (row) => /* @__PURE__ */ jsxRuntime.jsx(Span, { ellipsis: true, withTooltip: true, children: row.description })
|
|
43748
43934
|
},
|
|
43749
43935
|
[
|
|
43750
|
-
"
|
|
43751
|
-
/*
|
|
43936
|
+
"Actions"
|
|
43937
|
+
/* Actions */
|
|
43752
43938
|
]: {
|
|
43753
|
-
id: "
|
|
43754
|
-
cell: (row) => /* @__PURE__ */ jsxRuntime.
|
|
43939
|
+
id: "Actions",
|
|
43940
|
+
cell: (row) => /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "3xs", children: [
|
|
43941
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { inset: true, icon: true, onPress: () => onSelectTrip(row), "aria-label": "View trip", variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { size: 20 }) }),
|
|
43942
|
+
/* @__PURE__ */ jsxRuntime.jsx(Button, { inset: true, icon: true, onPress: () => onDeleteTrip(row), "aria-label": "Delete trip", variant: "ghost", children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { size: 20 }) })
|
|
43943
|
+
] })
|
|
43755
43944
|
}
|
|
43756
43945
|
});
|
|
43757
43946
|
const TripsTable = () => {
|
|
43758
43947
|
var _a;
|
|
43759
43948
|
const [isTripDrawerOpen, setIsTripDrawerOpen] = react.useState(false);
|
|
43760
43949
|
const [selectedTrip, setSelectedTrip] = react.useState(null);
|
|
43950
|
+
const [tripToDelete, setTripToDelete] = react.useState(null);
|
|
43761
43951
|
const { tableFilters, setTableFilters } = useTripsTableFilters();
|
|
43762
43952
|
const { query, selectedVehicle, purposeFilter } = tableFilters;
|
|
43953
|
+
const { currentTripsPage, setCurrentTripsPage } = useCurrentTripsPage();
|
|
43763
43954
|
const { inputValue, searchQuery, handleInputChange } = useDebouncedSearchInput({ initialInputState: query });
|
|
43764
43955
|
react.useEffect(() => {
|
|
43765
43956
|
setTableFilters({ query: searchQuery });
|
|
43766
43957
|
}, [searchQuery, setTableFilters]);
|
|
43767
43958
|
const filterParams = react.useMemo(() => {
|
|
43768
43959
|
const params = {};
|
|
43769
|
-
if (
|
|
43770
|
-
params.query =
|
|
43960
|
+
if (query) {
|
|
43961
|
+
params.query = query;
|
|
43771
43962
|
}
|
|
43772
43963
|
if (selectedVehicle) {
|
|
43773
43964
|
params.vehicleId = selectedVehicle.id;
|
|
@@ -43776,9 +43967,10 @@ const TripsTable = () => {
|
|
|
43776
43967
|
params.purpose = purposeFilter;
|
|
43777
43968
|
}
|
|
43778
43969
|
return params;
|
|
43779
|
-
}, [
|
|
43970
|
+
}, [query, selectedVehicle, purposeFilter]);
|
|
43780
43971
|
const { data, isLoading, isError, size, setSize } = useListTrips(filterParams);
|
|
43781
43972
|
const trips = react.useMemo(() => data == null ? void 0 : data.flatMap(({ data: data2 }) => data2), [data]);
|
|
43973
|
+
const autoResetPageIndexRef = useAutoResetPageIndex(filterParams, data);
|
|
43782
43974
|
const paginationMeta = (_a = data == null ? void 0 : data[data.length - 1]) == null ? void 0 : _a.meta.pagination;
|
|
43783
43975
|
const hasMore = paginationMeta == null ? void 0 : paginationMeta.hasMore;
|
|
43784
43976
|
const fetchMore = react.useCallback(() => {
|
|
@@ -43790,17 +43982,23 @@ const TripsTable = () => {
|
|
|
43790
43982
|
setSelectedTrip(trip);
|
|
43791
43983
|
setIsTripDrawerOpen(true);
|
|
43792
43984
|
}, []);
|
|
43985
|
+
const onDeleteTrip = react.useCallback((trip) => {
|
|
43986
|
+
setTripToDelete(trip);
|
|
43987
|
+
}, []);
|
|
43793
43988
|
const onRecordTrip = react.useCallback(() => {
|
|
43794
43989
|
setSelectedTrip(null);
|
|
43795
43990
|
setIsTripDrawerOpen(true);
|
|
43796
43991
|
}, []);
|
|
43797
43992
|
const paginationProps = react.useMemo(() => {
|
|
43798
43993
|
return {
|
|
43994
|
+
initialPage: currentTripsPage,
|
|
43995
|
+
onSetPage: setCurrentTripsPage,
|
|
43799
43996
|
pageSize: 20,
|
|
43800
43997
|
hasMore,
|
|
43801
|
-
fetchMore
|
|
43998
|
+
fetchMore,
|
|
43999
|
+
autoResetPageIndexRef
|
|
43802
44000
|
};
|
|
43803
|
-
}, [fetchMore, hasMore]);
|
|
44001
|
+
}, [currentTripsPage, setCurrentTripsPage, fetchMore, hasMore, autoResetPageIndexRef]);
|
|
43804
44002
|
const handlePurposeFilterChange = react.useCallback((newPurposeFilter) => {
|
|
43805
44003
|
setTableFilters({ purposeFilter: newPurposeFilter });
|
|
43806
44004
|
}, [setTableFilters]);
|
|
@@ -43851,7 +44049,7 @@ const TripsTable = () => {
|
|
|
43851
44049
|
spacing: true
|
|
43852
44050
|
}
|
|
43853
44051
|
);
|
|
43854
|
-
const columnConfig = react.useMemo(() => getColumnConfig(onSelectTrip), [onSelectTrip]);
|
|
44052
|
+
const columnConfig = react.useMemo(() => getColumnConfig({ onSelectTrip, onDeleteTrip }), [onSelectTrip, onDeleteTrip]);
|
|
43855
44053
|
const HeaderFilters = react.useCallback(() => /* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "sm", align: "center", children: [
|
|
43856
44054
|
/* @__PURE__ */ jsxRuntime.jsx(PurposeToggle, {}),
|
|
43857
44055
|
/* @__PURE__ */ jsxRuntime.jsx(VehicleFilter, {})
|
|
@@ -43920,6 +44118,18 @@ const TripsTable = () => {
|
|
|
43920
44118
|
)
|
|
43921
44119
|
] })
|
|
43922
44120
|
}
|
|
44121
|
+
),
|
|
44122
|
+
tripToDelete && /* @__PURE__ */ jsxRuntime.jsx(
|
|
44123
|
+
TripDeleteConfirmationModal,
|
|
44124
|
+
{
|
|
44125
|
+
isOpen: !!tripToDelete,
|
|
44126
|
+
onOpenChange: (isOpen) => {
|
|
44127
|
+
if (!isOpen) {
|
|
44128
|
+
setTripToDelete(null);
|
|
44129
|
+
}
|
|
44130
|
+
},
|
|
44131
|
+
trip: tripToDelete
|
|
44132
|
+
}
|
|
43923
44133
|
)
|
|
43924
44134
|
] });
|
|
43925
44135
|
};
|
|
@@ -43930,7 +44140,8 @@ const getVehicleFormDefaultValues = (vehicle) => {
|
|
|
43930
44140
|
year: vehicle.year,
|
|
43931
44141
|
licensePlate: vehicle.licensePlate || "",
|
|
43932
44142
|
vin: vehicle.vin || "",
|
|
43933
|
-
description: vehicle.description || ""
|
|
44143
|
+
description: vehicle.description || "",
|
|
44144
|
+
isPrimary: vehicle.isPrimary
|
|
43934
44145
|
};
|
|
43935
44146
|
}
|
|
43936
44147
|
return {
|
|
@@ -43938,7 +44149,8 @@ const getVehicleFormDefaultValues = (vehicle) => {
|
|
|
43938
44149
|
year: Number.NaN,
|
|
43939
44150
|
licensePlate: "",
|
|
43940
44151
|
vin: "",
|
|
43941
|
-
description: ""
|
|
44152
|
+
description: "",
|
|
44153
|
+
isPrimary: false
|
|
43942
44154
|
};
|
|
43943
44155
|
};
|
|
43944
44156
|
const validateVehicleForm = ({ vehicle }) => {
|
|
@@ -43962,7 +44174,8 @@ const convertVehicleFormToUpsertVehicle = (form) => {
|
|
|
43962
44174
|
year: form.year,
|
|
43963
44175
|
licensePlate: form.licensePlate.trim() || null,
|
|
43964
44176
|
vin: form.vin.trim() || null,
|
|
43965
|
-
description: form.description.trim() || null
|
|
44177
|
+
description: form.description.trim() || null,
|
|
44178
|
+
isPrimary: form.isPrimary
|
|
43966
44179
|
};
|
|
43967
44180
|
};
|
|
43968
44181
|
const UPSERT_VEHICLE_TAG_KEY = "#upsert-vehicle";
|
|
@@ -43973,7 +44186,7 @@ var UpsertVehicleMode = /* @__PURE__ */ ((UpsertVehicleMode2) => {
|
|
|
43973
44186
|
})(UpsertVehicleMode || {});
|
|
43974
44187
|
const createVehicle = post(({ businessId }) => `/v1/businesses/${businessId}/mileage/vehicles`);
|
|
43975
44188
|
const updateVehicle = patch(({ businessId, vehicleId }) => `/v1/businesses/${businessId}/mileage/vehicles/${vehicleId}`);
|
|
43976
|
-
function buildKey$
|
|
44189
|
+
function buildKey$4({
|
|
43977
44190
|
access_token: accessToken,
|
|
43978
44191
|
apiUrl,
|
|
43979
44192
|
businessId,
|
|
@@ -43992,6 +44205,24 @@ function buildKey$1({
|
|
|
43992
44205
|
const UpsertVehicleReturnSchema = effect.Schema.Struct({
|
|
43993
44206
|
data: VehicleSchema
|
|
43994
44207
|
});
|
|
44208
|
+
class UpsertVehicleSWRResponse {
|
|
44209
|
+
constructor(swrResponse) {
|
|
44210
|
+
__publicField(this, "swrResponse");
|
|
44211
|
+
this.swrResponse = swrResponse;
|
|
44212
|
+
}
|
|
44213
|
+
get trigger() {
|
|
44214
|
+
return this.swrResponse.trigger;
|
|
44215
|
+
}
|
|
44216
|
+
get isMutating() {
|
|
44217
|
+
return this.swrResponse.isMutating;
|
|
44218
|
+
}
|
|
44219
|
+
get data() {
|
|
44220
|
+
return this.swrResponse.data;
|
|
44221
|
+
}
|
|
44222
|
+
get error() {
|
|
44223
|
+
return this.swrResponse.error;
|
|
44224
|
+
}
|
|
44225
|
+
}
|
|
43995
44226
|
const CreateParamsSchema = effect.Schema.Struct({
|
|
43996
44227
|
businessId: effect.Schema.UUID,
|
|
43997
44228
|
vehicleId: effect.Schema.Undefined
|
|
@@ -44025,11 +44256,10 @@ function getRequestFn(mode, params) {
|
|
|
44025
44256
|
const useUpsertVehicle = (props) => {
|
|
44026
44257
|
const { data } = useAuth();
|
|
44027
44258
|
const { businessId } = useLayerContext();
|
|
44028
|
-
const { mutate } = useSWR.useSWRConfig();
|
|
44029
44259
|
const { mode } = props;
|
|
44030
44260
|
const vehicleId = mode === "Update" ? props.vehicleId : void 0;
|
|
44031
44261
|
const rawMutationResponse = useSWRMutation(
|
|
44032
|
-
() => buildKey$
|
|
44262
|
+
() => buildKey$4(__spreadProps(__spreadValues({}, data), {
|
|
44033
44263
|
businessId,
|
|
44034
44264
|
vehicleId
|
|
44035
44265
|
})),
|
|
@@ -44047,43 +44277,31 @@ const useUpsertVehicle = (props) => {
|
|
|
44047
44277
|
}
|
|
44048
44278
|
);
|
|
44049
44279
|
const mutationResponse = new UpsertVehicleSWRResponse(rawMutationResponse);
|
|
44280
|
+
const { patchVehicleByKey, forceReloadVehicles } = useVehiclesGlobalCacheActions();
|
|
44281
|
+
const { forceReloadTrips } = useTripsGlobalCacheActions();
|
|
44050
44282
|
const originalTrigger = mutationResponse.trigger;
|
|
44051
44283
|
const stableProxiedTrigger = react.useCallback(
|
|
44052
44284
|
(...triggerParameters) => __async(null, null, function* () {
|
|
44053
44285
|
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
44054
|
-
|
|
44055
|
-
|
|
44056
|
-
|
|
44057
|
-
|
|
44058
|
-
|
|
44059
|
-
|
|
44060
|
-
});
|
|
44286
|
+
if (mode === "Update") {
|
|
44287
|
+
void patchVehicleByKey(triggerResult.data);
|
|
44288
|
+
void forceReloadTrips();
|
|
44289
|
+
} else {
|
|
44290
|
+
void forceReloadVehicles();
|
|
44291
|
+
}
|
|
44061
44292
|
return triggerResult;
|
|
44062
44293
|
}),
|
|
44063
|
-
[originalTrigger,
|
|
44294
|
+
[originalTrigger, mode, patchVehicleByKey, forceReloadTrips, forceReloadVehicles]
|
|
44064
44295
|
);
|
|
44065
|
-
return
|
|
44066
|
-
|
|
44296
|
+
return new Proxy(mutationResponse, {
|
|
44297
|
+
get(target, prop) {
|
|
44298
|
+
if (prop === "trigger") {
|
|
44299
|
+
return stableProxiedTrigger;
|
|
44300
|
+
}
|
|
44301
|
+
return Reflect.get(target, prop);
|
|
44302
|
+
}
|
|
44067
44303
|
});
|
|
44068
44304
|
};
|
|
44069
|
-
class UpsertVehicleSWRResponse {
|
|
44070
|
-
constructor(swrResponse) {
|
|
44071
|
-
__publicField(this, "swrResponse");
|
|
44072
|
-
this.swrResponse = swrResponse;
|
|
44073
|
-
}
|
|
44074
|
-
get trigger() {
|
|
44075
|
-
return this.swrResponse.trigger;
|
|
44076
|
-
}
|
|
44077
|
-
get isMutating() {
|
|
44078
|
-
return this.swrResponse.isMutating;
|
|
44079
|
-
}
|
|
44080
|
-
get data() {
|
|
44081
|
-
return this.swrResponse.data;
|
|
44082
|
-
}
|
|
44083
|
-
get error() {
|
|
44084
|
-
return this.swrResponse.error;
|
|
44085
|
-
}
|
|
44086
|
-
}
|
|
44087
44305
|
const useVehicleForm = (props) => {
|
|
44088
44306
|
const [submitError, setSubmitError] = react.useState(void 0);
|
|
44089
44307
|
const { onSuccess, vehicle } = props;
|
|
@@ -44199,6 +44417,15 @@ const VehicleForm = (props) => {
|
|
|
44199
44417
|
className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__Description`
|
|
44200
44418
|
}
|
|
44201
44419
|
) }),
|
|
44420
|
+
/* @__PURE__ */ jsxRuntime.jsx(form.AppField, { name: "isPrimary", children: (field) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
44421
|
+
field.FormSwitchField,
|
|
44422
|
+
{
|
|
44423
|
+
label: "Set as primary vehicle",
|
|
44424
|
+
inline: true,
|
|
44425
|
+
isReadOnly,
|
|
44426
|
+
className: `${VEHICLE_FORM_FIELD_CSS_PREFIX}__IsPrimary`
|
|
44427
|
+
}
|
|
44428
|
+
) }),
|
|
44202
44429
|
/* @__PURE__ */ jsxRuntime.jsx(VStack, { justify: "end", className: `${VEHICLE_FORM_CSS_PREFIX}__Submit`, children: /* @__PURE__ */ jsxRuntime.jsx(form.Subscribe, { selector: (state) => [state.canSubmit, state.isSubmitting], children: ([canSubmit, isSubmitting]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
44203
44430
|
Button,
|
|
44204
44431
|
{
|
|
@@ -44213,6 +44440,309 @@ const VehicleForm = (props) => {
|
|
|
44213
44440
|
) }) })
|
|
44214
44441
|
] });
|
|
44215
44442
|
};
|
|
44443
|
+
const ARCHIVE_VEHICLE_TAG_KEY = "#archive-vehicle";
|
|
44444
|
+
const ArchiveVehicleReturnSchema = effect.Schema.Struct({
|
|
44445
|
+
data: VehicleSchema
|
|
44446
|
+
});
|
|
44447
|
+
const archiveVehicle = post(({ businessId, vehicleId }) => `/v1/businesses/${businessId}/mileage/vehicles/${vehicleId}/archive`);
|
|
44448
|
+
function buildKey$3({
|
|
44449
|
+
access_token: accessToken,
|
|
44450
|
+
apiUrl,
|
|
44451
|
+
businessId,
|
|
44452
|
+
vehicleId
|
|
44453
|
+
}) {
|
|
44454
|
+
if (accessToken && apiUrl) {
|
|
44455
|
+
return {
|
|
44456
|
+
accessToken,
|
|
44457
|
+
apiUrl,
|
|
44458
|
+
businessId,
|
|
44459
|
+
vehicleId,
|
|
44460
|
+
tags: [ARCHIVE_VEHICLE_TAG_KEY]
|
|
44461
|
+
};
|
|
44462
|
+
}
|
|
44463
|
+
}
|
|
44464
|
+
class ArchiveVehicleSWRResponse {
|
|
44465
|
+
constructor(swrResponse) {
|
|
44466
|
+
__publicField(this, "swrResponse");
|
|
44467
|
+
this.swrResponse = swrResponse;
|
|
44468
|
+
}
|
|
44469
|
+
get data() {
|
|
44470
|
+
return this.swrResponse.data;
|
|
44471
|
+
}
|
|
44472
|
+
get trigger() {
|
|
44473
|
+
return this.swrResponse.trigger;
|
|
44474
|
+
}
|
|
44475
|
+
get isMutating() {
|
|
44476
|
+
return this.swrResponse.isMutating;
|
|
44477
|
+
}
|
|
44478
|
+
get isError() {
|
|
44479
|
+
return this.swrResponse.error !== void 0;
|
|
44480
|
+
}
|
|
44481
|
+
}
|
|
44482
|
+
const useArchiveVehicle = ({ vehicleId }) => {
|
|
44483
|
+
const { data } = useAuth();
|
|
44484
|
+
const { businessId } = useLayerContext();
|
|
44485
|
+
const rawMutationResponse = useSWRMutation(
|
|
44486
|
+
() => buildKey$3(__spreadProps(__spreadValues({}, data), {
|
|
44487
|
+
businessId,
|
|
44488
|
+
vehicleId
|
|
44489
|
+
})),
|
|
44490
|
+
({ accessToken, apiUrl, businessId: businessId2, vehicleId: vehicleId2 }) => {
|
|
44491
|
+
return archiveVehicle(
|
|
44492
|
+
apiUrl,
|
|
44493
|
+
accessToken,
|
|
44494
|
+
{ params: { businessId: businessId2, vehicleId: vehicleId2 } }
|
|
44495
|
+
).then(effect.Schema.decodeUnknownPromise(ArchiveVehicleReturnSchema));
|
|
44496
|
+
},
|
|
44497
|
+
{
|
|
44498
|
+
revalidate: false,
|
|
44499
|
+
throwOnError: true
|
|
44500
|
+
}
|
|
44501
|
+
);
|
|
44502
|
+
const mutationResponse = new ArchiveVehicleSWRResponse(rawMutationResponse);
|
|
44503
|
+
const { patchVehicleByKey } = useVehiclesGlobalCacheActions();
|
|
44504
|
+
const originalTrigger = mutationResponse.trigger;
|
|
44505
|
+
const stableProxiedTrigger = react.useCallback(
|
|
44506
|
+
(...triggerParameters) => __async(null, null, function* () {
|
|
44507
|
+
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
44508
|
+
void patchVehicleByKey(triggerResult.data);
|
|
44509
|
+
return triggerResult;
|
|
44510
|
+
}),
|
|
44511
|
+
[originalTrigger, patchVehicleByKey]
|
|
44512
|
+
);
|
|
44513
|
+
return new Proxy(mutationResponse, {
|
|
44514
|
+
get(target, prop) {
|
|
44515
|
+
if (prop === "trigger") {
|
|
44516
|
+
return stableProxiedTrigger;
|
|
44517
|
+
}
|
|
44518
|
+
return Reflect.get(target, prop);
|
|
44519
|
+
}
|
|
44520
|
+
});
|
|
44521
|
+
};
|
|
44522
|
+
function VehicleArchiveConfirmationModal({
|
|
44523
|
+
isOpen,
|
|
44524
|
+
onOpenChange,
|
|
44525
|
+
vehicle
|
|
44526
|
+
}) {
|
|
44527
|
+
const { trigger: archiveVehicle2 } = useArchiveVehicle({ vehicleId: vehicle.id });
|
|
44528
|
+
const onConfirm = react.useCallback(() => __async(null, null, function* () {
|
|
44529
|
+
yield archiveVehicle2();
|
|
44530
|
+
}), [archiveVehicle2]);
|
|
44531
|
+
const vehicleName = getVehicleDisplayName(vehicle);
|
|
44532
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
44533
|
+
BaseConfirmationModal,
|
|
44534
|
+
{
|
|
44535
|
+
isOpen,
|
|
44536
|
+
onOpenChange,
|
|
44537
|
+
title: "Archive this vehicle?",
|
|
44538
|
+
description: `${vehicleName} will be hidden from your active vehicles list. You can reactivate it at any time.`,
|
|
44539
|
+
onConfirm,
|
|
44540
|
+
confirmLabel: "Archive vehicle",
|
|
44541
|
+
cancelLabel: "Cancel",
|
|
44542
|
+
errorText: "Failed to archive vehicle. Please check your connection and try again."
|
|
44543
|
+
}
|
|
44544
|
+
);
|
|
44545
|
+
}
|
|
44546
|
+
const DELETE_VEHICLE_TAG_KEY = "#delete-vehicle";
|
|
44547
|
+
const deleteVehicle = del(({ businessId, vehicleId }) => `/v1/businesses/${businessId}/mileage/vehicles/${vehicleId}`);
|
|
44548
|
+
function buildKey$2({
|
|
44549
|
+
access_token: accessToken,
|
|
44550
|
+
apiUrl,
|
|
44551
|
+
businessId,
|
|
44552
|
+
vehicleId
|
|
44553
|
+
}) {
|
|
44554
|
+
if (accessToken && apiUrl) {
|
|
44555
|
+
return {
|
|
44556
|
+
accessToken,
|
|
44557
|
+
apiUrl,
|
|
44558
|
+
businessId,
|
|
44559
|
+
vehicleId,
|
|
44560
|
+
tags: [DELETE_VEHICLE_TAG_KEY]
|
|
44561
|
+
};
|
|
44562
|
+
}
|
|
44563
|
+
}
|
|
44564
|
+
class DeleteVehicleSWRResponse {
|
|
44565
|
+
constructor(swrResponse) {
|
|
44566
|
+
__publicField(this, "swrResponse");
|
|
44567
|
+
this.swrResponse = swrResponse;
|
|
44568
|
+
}
|
|
44569
|
+
get trigger() {
|
|
44570
|
+
return this.swrResponse.trigger;
|
|
44571
|
+
}
|
|
44572
|
+
get isMutating() {
|
|
44573
|
+
return this.swrResponse.isMutating;
|
|
44574
|
+
}
|
|
44575
|
+
get isError() {
|
|
44576
|
+
return this.swrResponse.error !== void 0;
|
|
44577
|
+
}
|
|
44578
|
+
}
|
|
44579
|
+
const useDeleteVehicle = ({ vehicleId }) => {
|
|
44580
|
+
const { data } = useAuth();
|
|
44581
|
+
const { businessId } = useLayerContext();
|
|
44582
|
+
const rawMutationResponse = useSWRMutation(
|
|
44583
|
+
() => buildKey$2(__spreadProps(__spreadValues({}, data), {
|
|
44584
|
+
businessId,
|
|
44585
|
+
vehicleId
|
|
44586
|
+
})),
|
|
44587
|
+
({ accessToken, apiUrl, businessId: businessId2, vehicleId: vehicleId2 }) => {
|
|
44588
|
+
return deleteVehicle(
|
|
44589
|
+
apiUrl,
|
|
44590
|
+
accessToken,
|
|
44591
|
+
{ params: { businessId: businessId2, vehicleId: vehicleId2 } }
|
|
44592
|
+
);
|
|
44593
|
+
},
|
|
44594
|
+
{
|
|
44595
|
+
revalidate: false,
|
|
44596
|
+
throwOnError: true
|
|
44597
|
+
}
|
|
44598
|
+
);
|
|
44599
|
+
const mutationResponse = new DeleteVehicleSWRResponse(rawMutationResponse);
|
|
44600
|
+
const { forceReloadVehicles } = useVehiclesGlobalCacheActions();
|
|
44601
|
+
const originalTrigger = mutationResponse.trigger;
|
|
44602
|
+
const stableProxiedTrigger = react.useCallback(
|
|
44603
|
+
(...triggerParameters) => __async(null, null, function* () {
|
|
44604
|
+
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
44605
|
+
void forceReloadVehicles();
|
|
44606
|
+
return triggerResult;
|
|
44607
|
+
}),
|
|
44608
|
+
[originalTrigger, forceReloadVehicles]
|
|
44609
|
+
);
|
|
44610
|
+
return new Proxy(mutationResponse, {
|
|
44611
|
+
get(target, prop) {
|
|
44612
|
+
if (prop === "trigger") {
|
|
44613
|
+
return stableProxiedTrigger;
|
|
44614
|
+
}
|
|
44615
|
+
return Reflect.get(target, prop);
|
|
44616
|
+
}
|
|
44617
|
+
});
|
|
44618
|
+
};
|
|
44619
|
+
function VehicleDeleteConfirmationModal({
|
|
44620
|
+
isOpen,
|
|
44621
|
+
onOpenChange,
|
|
44622
|
+
vehicle
|
|
44623
|
+
}) {
|
|
44624
|
+
const { trigger: deleteVehicle2 } = useDeleteVehicle({ vehicleId: vehicle.id });
|
|
44625
|
+
const onConfirm = react.useCallback(() => __async(null, null, function* () {
|
|
44626
|
+
yield deleteVehicle2();
|
|
44627
|
+
}), [deleteVehicle2]);
|
|
44628
|
+
const vehicleName = getVehicleDisplayName(vehicle);
|
|
44629
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
44630
|
+
BaseConfirmationModal,
|
|
44631
|
+
{
|
|
44632
|
+
isOpen,
|
|
44633
|
+
onOpenChange,
|
|
44634
|
+
title: "Delete this vehicle?",
|
|
44635
|
+
description: `${vehicleName} will be permanently deleted. This action cannot be undone.`,
|
|
44636
|
+
onConfirm,
|
|
44637
|
+
confirmLabel: "Delete vehicle",
|
|
44638
|
+
cancelLabel: "Cancel",
|
|
44639
|
+
errorText: "Failed to delete vehicle. Please check your connection and try again."
|
|
44640
|
+
}
|
|
44641
|
+
);
|
|
44642
|
+
}
|
|
44643
|
+
const REACTIVATE_VEHICLE_TAG_KEY = "#reactivate-vehicle";
|
|
44644
|
+
const ReactivateVehicleReturnSchema = effect.Schema.Struct({
|
|
44645
|
+
data: VehicleSchema
|
|
44646
|
+
});
|
|
44647
|
+
const reactivateVehicle = post(({ businessId, vehicleId }) => `/v1/businesses/${businessId}/mileage/vehicles/${vehicleId}/reactivate`);
|
|
44648
|
+
function buildKey$1({
|
|
44649
|
+
access_token: accessToken,
|
|
44650
|
+
apiUrl,
|
|
44651
|
+
businessId,
|
|
44652
|
+
vehicleId
|
|
44653
|
+
}) {
|
|
44654
|
+
if (accessToken && apiUrl) {
|
|
44655
|
+
return {
|
|
44656
|
+
accessToken,
|
|
44657
|
+
apiUrl,
|
|
44658
|
+
businessId,
|
|
44659
|
+
vehicleId,
|
|
44660
|
+
tags: [REACTIVATE_VEHICLE_TAG_KEY]
|
|
44661
|
+
};
|
|
44662
|
+
}
|
|
44663
|
+
}
|
|
44664
|
+
class ReactivateVehicleSWRResponse {
|
|
44665
|
+
constructor(swrResponse) {
|
|
44666
|
+
__publicField(this, "swrResponse");
|
|
44667
|
+
this.swrResponse = swrResponse;
|
|
44668
|
+
}
|
|
44669
|
+
get data() {
|
|
44670
|
+
return this.swrResponse.data;
|
|
44671
|
+
}
|
|
44672
|
+
get trigger() {
|
|
44673
|
+
return this.swrResponse.trigger;
|
|
44674
|
+
}
|
|
44675
|
+
get isMutating() {
|
|
44676
|
+
return this.swrResponse.isMutating;
|
|
44677
|
+
}
|
|
44678
|
+
get isError() {
|
|
44679
|
+
return this.swrResponse.error !== void 0;
|
|
44680
|
+
}
|
|
44681
|
+
}
|
|
44682
|
+
const useReactivateVehicle = ({ vehicleId }) => {
|
|
44683
|
+
const { data } = useAuth();
|
|
44684
|
+
const { businessId } = useLayerContext();
|
|
44685
|
+
const rawMutationResponse = useSWRMutation(
|
|
44686
|
+
() => buildKey$1(__spreadProps(__spreadValues({}, data), {
|
|
44687
|
+
businessId,
|
|
44688
|
+
vehicleId
|
|
44689
|
+
})),
|
|
44690
|
+
({ accessToken, apiUrl, businessId: businessId2, vehicleId: vehicleId2 }) => {
|
|
44691
|
+
return reactivateVehicle(
|
|
44692
|
+
apiUrl,
|
|
44693
|
+
accessToken,
|
|
44694
|
+
{ params: { businessId: businessId2, vehicleId: vehicleId2 } }
|
|
44695
|
+
).then(effect.Schema.decodeUnknownPromise(ReactivateVehicleReturnSchema));
|
|
44696
|
+
},
|
|
44697
|
+
{
|
|
44698
|
+
revalidate: false,
|
|
44699
|
+
throwOnError: true
|
|
44700
|
+
}
|
|
44701
|
+
);
|
|
44702
|
+
const mutationResponse = new ReactivateVehicleSWRResponse(rawMutationResponse);
|
|
44703
|
+
const { patchVehicleByKey } = useVehiclesGlobalCacheActions();
|
|
44704
|
+
const originalTrigger = mutationResponse.trigger;
|
|
44705
|
+
const stableProxiedTrigger = react.useCallback(
|
|
44706
|
+
(...triggerParameters) => __async(null, null, function* () {
|
|
44707
|
+
const triggerResult = yield originalTrigger(...triggerParameters);
|
|
44708
|
+
void patchVehicleByKey(triggerResult.data);
|
|
44709
|
+
return triggerResult;
|
|
44710
|
+
}),
|
|
44711
|
+
[originalTrigger, patchVehicleByKey]
|
|
44712
|
+
);
|
|
44713
|
+
return new Proxy(mutationResponse, {
|
|
44714
|
+
get(target, prop) {
|
|
44715
|
+
if (prop === "trigger") {
|
|
44716
|
+
return stableProxiedTrigger;
|
|
44717
|
+
}
|
|
44718
|
+
return Reflect.get(target, prop);
|
|
44719
|
+
}
|
|
44720
|
+
});
|
|
44721
|
+
};
|
|
44722
|
+
function VehicleReactivateConfirmationModal({
|
|
44723
|
+
isOpen,
|
|
44724
|
+
onOpenChange,
|
|
44725
|
+
vehicle
|
|
44726
|
+
}) {
|
|
44727
|
+
const { trigger: reactivateVehicle2 } = useReactivateVehicle({ vehicleId: vehicle.id });
|
|
44728
|
+
const onConfirm = react.useCallback(() => __async(null, null, function* () {
|
|
44729
|
+
yield reactivateVehicle2();
|
|
44730
|
+
}), [reactivateVehicle2]);
|
|
44731
|
+
const vehicleName = getVehicleDisplayName(vehicle);
|
|
44732
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
44733
|
+
BaseConfirmationModal,
|
|
44734
|
+
{
|
|
44735
|
+
isOpen,
|
|
44736
|
+
onOpenChange,
|
|
44737
|
+
title: "Reactivate this vehicle?",
|
|
44738
|
+
description: `${vehicleName} will be restored to your active vehicles list and available for tracking trips.`,
|
|
44739
|
+
onConfirm,
|
|
44740
|
+
confirmLabel: "Reactivate vehicle",
|
|
44741
|
+
cancelLabel: "Cancel",
|
|
44742
|
+
errorText: "Failed to reactivate vehicle. Please check your connection and try again."
|
|
44743
|
+
}
|
|
44744
|
+
);
|
|
44745
|
+
}
|
|
44216
44746
|
const VEHICLE_CARD_FIELDS = [
|
|
44217
44747
|
{ label: "Make and model", key: "makeAndModel" },
|
|
44218
44748
|
{ label: "Year", key: "year" },
|
|
@@ -44221,20 +44751,73 @@ const VEHICLE_CARD_FIELDS = [
|
|
|
44221
44751
|
{ label: "Description", key: "description" }
|
|
44222
44752
|
];
|
|
44223
44753
|
const VehicleCard = ({ vehicle, onEdit }) => {
|
|
44224
|
-
|
|
44225
|
-
|
|
44226
|
-
|
|
44227
|
-
|
|
44228
|
-
|
|
44229
|
-
|
|
44230
|
-
|
|
44231
|
-
/* @__PURE__ */ jsxRuntime.
|
|
44232
|
-
|
|
44233
|
-
|
|
44234
|
-
|
|
44754
|
+
const [isDeleteModalOpen, setIsDeleteModalOpen] = react.useState(false);
|
|
44755
|
+
const [isArchiveModalOpen, setIsArchiveModalOpen] = react.useState(false);
|
|
44756
|
+
const [isReactivateModalOpen, setIsReactivateModalOpen] = react.useState(false);
|
|
44757
|
+
const vehicleName = getVehicleDisplayName(vehicle);
|
|
44758
|
+
const isArchived = vehicle.archivedAt !== null && vehicle.archivedAt !== void 0;
|
|
44759
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
44760
|
+
/* @__PURE__ */ jsxRuntime.jsx(Card, { className: "Layer__VehicleCard", children: /* @__PURE__ */ jsxRuntime.jsxs(VStack, { pi: "md", pbs: "md", pbe: "xs", children: [
|
|
44761
|
+
/* @__PURE__ */ jsxRuntime.jsxs(VStack, { gap: "md", children: [
|
|
44762
|
+
/* @__PURE__ */ jsxRuntime.jsxs(HStack, { justify: "space-between", align: "center", gap: "md", children: [
|
|
44763
|
+
/* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "xs", className: "Layer__VehicleCard__Header", children: [
|
|
44764
|
+
/* @__PURE__ */ jsxRuntime.jsx(Heading$1, { size: "sm", ellipsis: true, children: vehicleName }),
|
|
44765
|
+
vehicle.isPrimary && /* @__PURE__ */ jsxRuntime.jsx(Badge, { size: BadgeSize.SMALL, variant: BadgeVariant.INFO, children: "Primary" }),
|
|
44766
|
+
isArchived && /* @__PURE__ */ jsxRuntime.jsx(Badge, { size: BadgeSize.SMALL, variant: BadgeVariant.WARNING, children: "Archived" })
|
|
44767
|
+
] }),
|
|
44768
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Car, { size: 20, className: "Layer__VehicleCard__Icon" })
|
|
44769
|
+
] }),
|
|
44770
|
+
/* @__PURE__ */ jsxRuntime.jsx(VStack, { gap: "xs", children: VEHICLE_CARD_FIELDS.map(({ label, key }) => /* @__PURE__ */ jsxRuntime.jsxs(HStack, { justify: "space-between", gap: "md", children: [
|
|
44771
|
+
/* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", variant: "subtle", children: label }),
|
|
44772
|
+
/* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", weight: "bold", withTooltip: true, children: vehicle[key] || "-" })
|
|
44773
|
+
] }, key)) })
|
|
44774
|
+
] }),
|
|
44775
|
+
/* @__PURE__ */ jsxRuntime.jsx(VStack, { pbs: "md", pbe: "xs", children: /* @__PURE__ */ jsxRuntime.jsx(Separator, {}) }),
|
|
44776
|
+
/* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "3xs", justify: "end", children: [
|
|
44777
|
+
!isArchived && /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", onPress: () => onEdit(vehicle), children: [
|
|
44778
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Edit, { size: 16 }),
|
|
44779
|
+
"Edit"
|
|
44780
|
+
] }),
|
|
44781
|
+
isArchived ? /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", onPress: () => setIsReactivateModalOpen(true), children: [
|
|
44782
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.RotateCcw, { size: 16 }),
|
|
44783
|
+
"Reactivate"
|
|
44784
|
+
] }) : vehicle.isEligibleForDeletion ? /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", onPress: () => setIsDeleteModalOpen(true), children: [
|
|
44785
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Trash2, { size: 16 }),
|
|
44786
|
+
"Delete"
|
|
44787
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "ghost", onPress: () => setIsArchiveModalOpen(true), children: [
|
|
44788
|
+
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Archive, { size: 16 }),
|
|
44789
|
+
"Archive"
|
|
44790
|
+
] })
|
|
44791
|
+
] })
|
|
44792
|
+
] }) }),
|
|
44793
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
44794
|
+
VehicleDeleteConfirmationModal,
|
|
44795
|
+
{
|
|
44796
|
+
isOpen: isDeleteModalOpen,
|
|
44797
|
+
onOpenChange: setIsDeleteModalOpen,
|
|
44798
|
+
vehicle
|
|
44799
|
+
}
|
|
44800
|
+
),
|
|
44801
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
44802
|
+
VehicleArchiveConfirmationModal,
|
|
44803
|
+
{
|
|
44804
|
+
isOpen: isArchiveModalOpen,
|
|
44805
|
+
onOpenChange: setIsArchiveModalOpen,
|
|
44806
|
+
vehicle
|
|
44807
|
+
}
|
|
44808
|
+
),
|
|
44809
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
44810
|
+
VehicleReactivateConfirmationModal,
|
|
44811
|
+
{
|
|
44812
|
+
isOpen: isReactivateModalOpen,
|
|
44813
|
+
onOpenChange: setIsReactivateModalOpen,
|
|
44814
|
+
vehicle
|
|
44815
|
+
}
|
|
44816
|
+
)
|
|
44817
|
+
] });
|
|
44235
44818
|
};
|
|
44236
|
-
const VehicleManagementGrid = ({ onEditVehicle }) => {
|
|
44237
|
-
const { data, isLoading, isError } = useListVehicles();
|
|
44819
|
+
const VehicleManagementGrid = ({ onEditVehicle, showArchived }) => {
|
|
44820
|
+
const { data, isLoading, isError } = useListVehicles({ allowArchived: showArchived });
|
|
44238
44821
|
const vehicles = react.useMemo(() => data ? asMutable(data) : void 0, [data]);
|
|
44239
44822
|
if (isLoading) {
|
|
44240
44823
|
return /* @__PURE__ */ jsxRuntime.jsx(VStack, { align: "center", justify: "center", pi: "lg", pb: "lg", children: /* @__PURE__ */ jsxRuntime.jsx(Loader, {}) });
|
|
@@ -44264,9 +44847,12 @@ const VehicleManagementGrid = ({ onEditVehicle }) => {
|
|
|
44264
44847
|
}
|
|
44265
44848
|
return /* @__PURE__ */ jsxRuntime.jsx(HStack, { className: "Layer__VehicleManagementGrid", children: vehicles.map((vehicle) => /* @__PURE__ */ jsxRuntime.jsx(VehicleCard, { vehicle, onEdit: onEditVehicle }, vehicle.id)) });
|
|
44266
44849
|
};
|
|
44267
|
-
const VehicleManagementDetailHeader = ({ onAddVehicle }) => {
|
|
44268
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { justify: "space-between", align: "center", fluid: true, pie: "md", children: [
|
|
44269
|
-
/* @__PURE__ */ jsxRuntime.
|
|
44850
|
+
const VehicleManagementDetailHeader = ({ onAddVehicle, showArchived, onShowArchivedChange }) => {
|
|
44851
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(HStack, { justify: "space-between", align: "center", fluid: true, pie: "md", gap: "3xl", children: [
|
|
44852
|
+
/* @__PURE__ */ jsxRuntime.jsxs(HStack, { gap: "md", align: "center", children: [
|
|
44853
|
+
/* @__PURE__ */ jsxRuntime.jsx(Heading$1, { size: "sm", children: "Manage vehicles" }),
|
|
44854
|
+
/* @__PURE__ */ jsxRuntime.jsx(Switch, { isSelected: showArchived, onChange: onShowArchivedChange, children: /* @__PURE__ */ jsxRuntime.jsx(Span, { size: "sm", noWrap: true, children: "Show archived" }) })
|
|
44855
|
+
] }),
|
|
44270
44856
|
/* @__PURE__ */ jsxRuntime.jsxs(Button, { variant: "solid", onPress: onAddVehicle, children: [
|
|
44271
44857
|
"Add Vehicle",
|
|
44272
44858
|
/* @__PURE__ */ jsxRuntime.jsx(lucideReact.Plus, { size: 14 })
|
|
@@ -44277,6 +44863,7 @@ const VehicleManagementDetail = () => {
|
|
|
44277
44863
|
const { toTripsTable } = useTripsNavigation();
|
|
44278
44864
|
const [isVehicleDrawerOpen, setIsVehicleDrawerOpen] = react.useState(false);
|
|
44279
44865
|
const [selectedVehicle, setSelectedVehicle] = react.useState(void 0);
|
|
44866
|
+
const [showArchived, setShowArchived] = react.useState(false);
|
|
44280
44867
|
const handleAddVehicle = react.useCallback(() => {
|
|
44281
44868
|
setSelectedVehicle(void 0);
|
|
44282
44869
|
setIsVehicleDrawerOpen(true);
|
|
@@ -44289,9 +44876,20 @@ const VehicleManagementDetail = () => {
|
|
|
44289
44876
|
setIsVehicleDrawerOpen(false);
|
|
44290
44877
|
setSelectedVehicle(void 0);
|
|
44291
44878
|
}, []);
|
|
44292
|
-
const
|
|
44293
|
-
|
|
44294
|
-
|
|
44879
|
+
const stateRef = react.useRef({ showArchived, setShowArchived, handleAddVehicle });
|
|
44880
|
+
stateRef.current = { showArchived, setShowArchived, handleAddVehicle };
|
|
44881
|
+
const HeaderRef = react.useRef(() => {
|
|
44882
|
+
const { showArchived: currentShowArchived, setShowArchived: currentSetShowArchived, handleAddVehicle: currentHandleAddVehicle } = stateRef.current;
|
|
44883
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
44884
|
+
VehicleManagementDetailHeader,
|
|
44885
|
+
{
|
|
44886
|
+
onAddVehicle: currentHandleAddVehicle,
|
|
44887
|
+
showArchived: currentShowArchived,
|
|
44888
|
+
onShowArchivedChange: currentSetShowArchived
|
|
44889
|
+
}
|
|
44890
|
+
);
|
|
44891
|
+
});
|
|
44892
|
+
const Header3 = HeaderRef.current;
|
|
44295
44893
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
44296
44894
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
44297
44895
|
BaseDetailView,
|
|
@@ -44299,7 +44897,7 @@ const VehicleManagementDetail = () => {
|
|
|
44299
44897
|
slots: { Header: Header3, BackIcon: BackArrow },
|
|
44300
44898
|
name: "VehicleManagementDetail",
|
|
44301
44899
|
onGoBack: toTripsTable,
|
|
44302
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(VehicleManagementGrid, { onEditVehicle: handleEditVehicle })
|
|
44900
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(VehicleManagementGrid, { onEditVehicle: handleEditVehicle, showArchived })
|
|
44303
44901
|
}
|
|
44304
44902
|
),
|
|
44305
44903
|
/* @__PURE__ */ jsxRuntime.jsx(Drawer, { isOpen: isVehicleDrawerOpen, onOpenChange: setIsVehicleDrawerOpen, "aria-label": selectedVehicle ? "Vehicle details" : "Add vehicle", children: ({ close: close2 }) => /* @__PURE__ */ jsxRuntime.jsxs(VStack, { pb: "lg", children: [
|
|
@@ -44378,7 +44976,7 @@ const ProjectProfitabilityView = ({
|
|
|
44378
44976
|
}
|
|
44379
44977
|
) }),
|
|
44380
44978
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
44381
|
-
|
|
44979
|
+
ReactSelect,
|
|
44382
44980
|
{
|
|
44383
44981
|
className: "Layer__category-menu Layer__select",
|
|
44384
44982
|
classNamePrefix: "Layer__select",
|
|
@@ -44965,14 +45563,14 @@ const BusinessProvider = ({
|
|
|
44965
45563
|
}
|
|
44966
45564
|
);
|
|
44967
45565
|
};
|
|
44968
|
-
const LayerProvider = (
|
|
44969
|
-
var
|
|
45566
|
+
const LayerProvider = (_wd) => {
|
|
45567
|
+
var _xd = _wd, {
|
|
44970
45568
|
appId,
|
|
44971
45569
|
appSecret,
|
|
44972
45570
|
businessAccessToken,
|
|
44973
45571
|
environment,
|
|
44974
45572
|
usePlaidSandbox
|
|
44975
|
-
} =
|
|
45573
|
+
} = _xd, restProps = __objRest(_xd, [
|
|
44976
45574
|
"appId",
|
|
44977
45575
|
"appSecret",
|
|
44978
45576
|
"businessAccessToken",
|