@layerfi/components 0.1.132-alpha.5 → 0.1.133-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 +80 -35
- package/dist/esm/index.mjs +79 -34
- package/dist/index.d.ts +4 -4
- package/package.json +1 -1
package/dist/cjs/index.cjs
CHANGED
|
@@ -246,6 +246,11 @@ var APIError = class APIError extends Error {
|
|
|
246
246
|
return (_this$messages = this.messages) === null || _this$messages === void 0 ? void 0 : _this$messages.map((x) => x.description);
|
|
247
247
|
}
|
|
248
248
|
};
|
|
249
|
+
var isAPIErrorOfType = (error, errorType) => {
|
|
250
|
+
var _error$messages;
|
|
251
|
+
if (!(error instanceof APIError)) return false;
|
|
252
|
+
return ((_error$messages = error.messages) === null || _error$messages === void 0 ? void 0 : _error$messages.some((message) => message.error_enum === errorType)) === true;
|
|
253
|
+
};
|
|
249
254
|
//#endregion
|
|
250
255
|
//#region src/utils/api/errorHandler.tsx
|
|
251
256
|
var ErrorHandlerClass = class {
|
|
@@ -278,7 +283,7 @@ var getIntlLocale = (locale) => {
|
|
|
278
283
|
};
|
|
279
284
|
var package_default = {
|
|
280
285
|
name: "@layerfi/components",
|
|
281
|
-
version: "0.1.
|
|
286
|
+
version: "0.1.133-alpha",
|
|
282
287
|
description: "Layer React Components",
|
|
283
288
|
main: "dist/cjs/index.cjs",
|
|
284
289
|
module: "dist/esm/index.mjs",
|
|
@@ -1678,6 +1683,8 @@ var linkedAccounts_default$1 = {
|
|
|
1678
1683
|
"ledger_balance": "Ledger balance",
|
|
1679
1684
|
"link_bank_accounts_and_credit_cards": "Link your bank accounts and credit cards",
|
|
1680
1685
|
"link_more_accounts_any_time": "You can link more accounts at any time from the Bank Transactions section",
|
|
1686
|
+
"link_your_bank_accounts": "Link your bank accounts",
|
|
1687
|
+
"link_your_bank_accounts_description": "Linking your bank accounts allows us to load your bank transactions and automatically categorize them.",
|
|
1681
1688
|
"linked_accounts": "Linked Accounts",
|
|
1682
1689
|
"loading_accounts": "Loading Your Accounts...",
|
|
1683
1690
|
"may_take_few_minutes": "This may take a few minutes",
|
|
@@ -1825,6 +1832,8 @@ var taxEstimates_default$1 = {
|
|
|
1825
1832
|
"no_tax_estimates_summary": "Get started with your tax estimates",
|
|
1826
1833
|
"no_tax_estimates_summary_description": "Start by importing and categorizing your bank transactions",
|
|
1827
1834
|
"no_tax_payments_to_display": "There are no tax payments to display.",
|
|
1835
|
+
"tax_due_is_negative_or_zero": "No taxes owed this year",
|
|
1836
|
+
"tax_due_is_negative_or_zero_description": "Your deductible losses exceed your income for this period, bringing your tax liability to zero.",
|
|
1828
1837
|
"tax_payments": "No tax payments found"
|
|
1829
1838
|
},
|
|
1830
1839
|
error: {
|
|
@@ -1839,6 +1848,7 @@ var taxEstimates_default$1 = {
|
|
|
1839
1848
|
"retrieve_tax_profile": "We couldn’t retrieve your tax profile. Please check your connection and try again.",
|
|
1840
1849
|
"while_loading_tax_details": "An error occurred while loading your tax details. Please check your connection and try again.",
|
|
1841
1850
|
"while_loading_tax_estimates": "An error occurred while loading your tax estimates. Please check your connection and try again.",
|
|
1851
|
+
"while_loading_tax_estimates_summary": "An error occurred while loading your tax summary. Please check your connection and try again.",
|
|
1842
1852
|
"while_loading_tax_payments": "An error occurred while loading your tax payments. Please check your connection and try again.",
|
|
1843
1853
|
"while_loading_tax_summary": "An error occurred while loading your tax summary. Please check your connection and try again."
|
|
1844
1854
|
},
|
|
@@ -1882,6 +1892,8 @@ var taxEstimates_default$1 = {
|
|
|
1882
1892
|
"quarter_taxes": "{{quarterLabel}} taxes",
|
|
1883
1893
|
"remaining_balance": "Remaining Balance",
|
|
1884
1894
|
"rolled_over_from_previous_quarter": "Rolled Over From Previous Quarter",
|
|
1895
|
+
"set_up_your_tax_profile": "Set up your tax profile",
|
|
1896
|
+
"set_up_your_tax_profile_description": "Configuring your tax profile allows us to provide you with tax estimates and avoid any surprises come tax time.",
|
|
1885
1897
|
"single": "Single",
|
|
1886
1898
|
"state": "State",
|
|
1887
1899
|
"tax_details": "Tax Details",
|
|
@@ -3106,6 +3118,8 @@ var linkedAccounts_default = {
|
|
|
3106
3118
|
"ledger_balance": "Solde du grand livre",
|
|
3107
3119
|
"link_bank_accounts_and_credit_cards": "Liez vos comptes bancaires et vos cartes de crédit",
|
|
3108
3120
|
"link_more_accounts_any_time": "Vous pouvez lier d’autres comptes en tout temps à partir de la section Transactions bancaires",
|
|
3121
|
+
"link_your_bank_accounts": "Liez vos comptes bancaires",
|
|
3122
|
+
"link_your_bank_accounts_description": "Lier vos comptes bancaires nous permet de charger vos opérations bancaires et de les catégoriser automatiquement.",
|
|
3109
3123
|
"linked_accounts": "Comptes liés",
|
|
3110
3124
|
"loading_accounts": "Chargement de vos comptes...",
|
|
3111
3125
|
"may_take_few_minutes": "Cela peut prendre quelques minutes",
|
|
@@ -3253,6 +3267,8 @@ var taxEstimates_default = {
|
|
|
3253
3267
|
"no_tax_estimates_summary": "Commencez vos estimations d’impôt",
|
|
3254
3268
|
"no_tax_estimates_summary_description": "Commencez par importer et catégoriser vos opérations bancaires",
|
|
3255
3269
|
"no_tax_payments_to_display": "Il n’y a aucun paiement d’impôt à afficher.",
|
|
3270
|
+
"tax_due_is_negative_or_zero": "Aucun impôt à payer cette année",
|
|
3271
|
+
"tax_due_is_negative_or_zero_description": "Vos pertes déductibles dépassent votre revenu pour cette période, ce qui ramène votre impôt à payer à zéro.",
|
|
3256
3272
|
"tax_payments": "Aucun paiement d’impôt trouvé"
|
|
3257
3273
|
},
|
|
3258
3274
|
error: {
|
|
@@ -3267,6 +3283,7 @@ var taxEstimates_default = {
|
|
|
3267
3283
|
"retrieve_tax_profile": "Nous n’avons pas pu récupérer votre profil fiscal. Veuillez vérifier votre connexion et réessayer.",
|
|
3268
3284
|
"while_loading_tax_details": "Une erreur s’est produite lors du chargement de vos détails fiscaux. Veuillez vérifier votre connexion et réessayer.",
|
|
3269
3285
|
"while_loading_tax_estimates": "Une erreur s’est produite lors du chargement de vos estimations d’impôt. Veuillez vérifier votre connexion et réessayer.",
|
|
3286
|
+
"while_loading_tax_estimates_summary": "Une erreur s'est produite lors du chargement de votre sommaire fiscal. Veuillez vérifier votre connexion et réessayer.",
|
|
3270
3287
|
"while_loading_tax_payments": "Une erreur s’est produite lors du chargement de vos paiements d’impôt. Veuillez vérifier votre connexion et réessayer.",
|
|
3271
3288
|
"while_loading_tax_summary": "Une erreur s’est produite lors du chargement de votre sommaire fiscal. Veuillez vérifier votre connexion et réessayer."
|
|
3272
3289
|
},
|
|
@@ -3280,7 +3297,7 @@ var taxEstimates_default = {
|
|
|
3280
3297
|
"categorization_incomplete": "Catégorisation incomplète",
|
|
3281
3298
|
"deductions": "Déductions",
|
|
3282
3299
|
"due": "Échéance",
|
|
3283
|
-
"due_at": "",
|
|
3300
|
+
"due_at": "Échéance le {{date}}",
|
|
3284
3301
|
"due_with_date": "Échéance : {{date}}",
|
|
3285
3302
|
"enter_amount": "Saisissez un montant",
|
|
3286
3303
|
"enter_area": "Saisissez la superficie",
|
|
@@ -3310,6 +3327,8 @@ var taxEstimates_default = {
|
|
|
3310
3327
|
"quarter_taxes": "Impôts du {{quarterLabel}}",
|
|
3311
3328
|
"remaining_balance": "Solde restant",
|
|
3312
3329
|
"rolled_over_from_previous_quarter": "Reporté du trimestre précédent",
|
|
3330
|
+
"set_up_your_tax_profile": "Configurez votre profil fiscal",
|
|
3331
|
+
"set_up_your_tax_profile_description": "La configuration de votre profil fiscal nous permet de vous fournir des estimations d'impôt et d'éviter les mauvaises surprises au moment des impôts.",
|
|
3313
3332
|
"single": "Célibataire",
|
|
3314
3333
|
"state": "État",
|
|
3315
3334
|
"tax_details": "Détails fiscaux",
|
|
@@ -3636,7 +3655,7 @@ var vehicles_default = {
|
|
|
3636
3655
|
"enter_vin": "Saisissez le NIV",
|
|
3637
3656
|
"license_plate": "Plaque d’immatriculation",
|
|
3638
3657
|
"make_model": "Marque et modèle",
|
|
3639
|
-
"unnamed_vehicle": "",
|
|
3658
|
+
"unnamed_vehicle": "Véhicule sans nom",
|
|
3640
3659
|
"vehicle": "Véhicule",
|
|
3641
3660
|
"vehicle_name_hidden_from_active_list": "{{vehicleName}} sera masqué de votre liste de véhicules actifs. Vous pourrez le réactiver en tout temps.",
|
|
3642
3661
|
"vehicle_name_restored_to_active_list": "{{vehicleName}} sera restauré dans votre liste de véhicules actifs et pourra être utilisé pour faire le suivi de vos déplacements.",
|
|
@@ -10781,6 +10800,11 @@ function keyLoader$9(previousPageData, { access_token: accessToken, apiUrl, busi
|
|
|
10781
10800
|
};
|
|
10782
10801
|
}
|
|
10783
10802
|
}
|
|
10803
|
+
var ListCustomersSWRResponse = class extends SWRInfiniteResult {
|
|
10804
|
+
get error() {
|
|
10805
|
+
return this.swrResponse.error;
|
|
10806
|
+
}
|
|
10807
|
+
};
|
|
10784
10808
|
function useListCustomers({ query, isEnabled = true } = {}) {
|
|
10785
10809
|
const withLocale = useLocalizedKey();
|
|
10786
10810
|
const { data } = useAuth();
|
|
@@ -10800,7 +10824,7 @@ function useListCustomers({ query, isEnabled = true } = {}) {
|
|
|
10800
10824
|
initialSize: 1
|
|
10801
10825
|
});
|
|
10802
10826
|
usePreserveInfiniteSize(swrResponse);
|
|
10803
|
-
return new
|
|
10827
|
+
return new ListCustomersSWRResponse(swrResponse);
|
|
10804
10828
|
}
|
|
10805
10829
|
function usePreloadCustomers(parameters) {
|
|
10806
10830
|
useListCustomers(parameters);
|
|
@@ -41723,12 +41747,14 @@ var CustomerAsOption = class {
|
|
|
41723
41747
|
}
|
|
41724
41748
|
};
|
|
41725
41749
|
var formatCreateLabel$1 = (inputValue, t) => inputValue ? t("customerVendor:action.create_customer_input_value", "Create customer \"{{inputValue}}\"", { inputValue }) : t("customerVendor:action.create_new_customer", "Create new customer");
|
|
41726
|
-
function CustomerSelector({ selectedCustomer, onSelectedCustomerChange, label, placeholder, isCreatable, onCreateCustomer, isReadOnly, inline, className, showLabel = true }) {
|
|
41750
|
+
function CustomerSelector({ selectedCustomer, onSelectedCustomerChange, label, placeholder, isCreatable, onCreateCustomer, isReadOnly, inline, className, hideSpecifiedIdNotFoundError, showLabel = true }) {
|
|
41727
41751
|
const { t } = (0, react_i18next.useTranslation)();
|
|
41728
41752
|
const resolvedLabel = label !== null && label !== void 0 ? label : t("customerVendor:label.customer", "Customer");
|
|
41729
41753
|
const combinedClassName = (0, classnames.default)("Layer__CustomerSelector", inline && "Layer__CustomerSelector--inline", className);
|
|
41730
41754
|
const { searchQuery, handleInputChange } = useDebouncedSearchInput({ initialInputState: () => "" });
|
|
41731
|
-
const { data, isLoading, isError } = useListCustomers({ query: searchQuery === "" ? void 0 : searchQuery });
|
|
41755
|
+
const { data, isLoading, isError, error } = useListCustomers({ query: searchQuery === "" ? void 0 : searchQuery });
|
|
41756
|
+
const shouldHideError = hideSpecifiedIdNotFoundError && isAPIErrorOfType(error, ApiEnumErrorType.SpecifiedIdNotFound);
|
|
41757
|
+
const shouldShowError = isError && !shouldHideError;
|
|
41732
41758
|
const options = (0, react.useMemo)(() => (data === null || data === void 0 ? void 0 : data.flatMap(({ data }) => data).map((customer) => new CustomerAsOption(customer))) || [], [data]);
|
|
41733
41759
|
const selectedCustomerId = selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.id;
|
|
41734
41760
|
const handleSelectionChange = (0, react.useCallback)((selectedOption) => {
|
|
@@ -41779,7 +41805,7 @@ function CustomerSelector({ selectedCustomer, onSelectedCustomerChange, label, p
|
|
|
41779
41805
|
ErrorMessage
|
|
41780
41806
|
},
|
|
41781
41807
|
isDisabled: isLoadingWithoutFallback || isError,
|
|
41782
|
-
isError,
|
|
41808
|
+
isError: shouldShowError,
|
|
41783
41809
|
isLoading: isLoadingWithoutFallback,
|
|
41784
41810
|
isReadOnly,
|
|
41785
41811
|
["aria-label"]: showLabel ? void 0 : resolvedLabel
|
|
@@ -47285,10 +47311,10 @@ var NoTaxProfileBanner = ({ onSetupTaxProfile }) => {
|
|
|
47285
47311
|
const { isMobile } = useSizeClass();
|
|
47286
47312
|
const { t } = (0, react_i18next.useTranslation)();
|
|
47287
47313
|
const Icon = isMobile ? null : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(lucide_react.Info, { size: 16 });
|
|
47288
|
-
const title = t("
|
|
47314
|
+
const title = t("taxEstimates:label.set_up_your_tax_profile", "Set up your tax profile");
|
|
47289
47315
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Banner, {
|
|
47290
47316
|
title,
|
|
47291
|
-
description: t("
|
|
47317
|
+
description: t("taxEstimates:label.set_up_your_tax_profile_description", "Configuring your tax profile allows us to provide you with tax estimates and avoid any surprises come tax time."),
|
|
47292
47318
|
slots: {
|
|
47293
47319
|
Icon,
|
|
47294
47320
|
Button: onSetupTaxProfile ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Button$1, {
|
|
@@ -47650,8 +47676,8 @@ var TaxEstimatesSummaryCardNegativeOrZero = () => {
|
|
|
47650
47676
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataState, {
|
|
47651
47677
|
className: "Layer__TaxEstimatesSummaryCard__DataState Layer__data-state--reset",
|
|
47652
47678
|
status: DataStateStatus.info,
|
|
47653
|
-
title: t("taxEstimates:
|
|
47654
|
-
description: t("taxEstimates:
|
|
47679
|
+
title: t("taxEstimates:empty.tax_due_is_negative_or_zero", "No taxes owed this year"),
|
|
47680
|
+
description: t("taxEstimates:empty.tax_due_is_negative_or_zero_description", "Your deductible losses exceed your income for this period, bringing your tax liability to zero.")
|
|
47655
47681
|
});
|
|
47656
47682
|
};
|
|
47657
47683
|
//#endregion
|
|
@@ -49878,11 +49904,16 @@ function buildKey$11({ access_token: accessToken, apiUrl, businessId }) {
|
|
|
49878
49904
|
tags: [ACTIVE_TIME_TRACKER_TAG_KEY]
|
|
49879
49905
|
};
|
|
49880
49906
|
}
|
|
49907
|
+
var ActiveTimeTrackerSWRResponse = class extends SWRQueryResult {
|
|
49908
|
+
get error() {
|
|
49909
|
+
return this.swrResponse.error;
|
|
49910
|
+
}
|
|
49911
|
+
};
|
|
49881
49912
|
function useActiveTimeTracker() {
|
|
49882
49913
|
const withLocale = useLocalizedKey();
|
|
49883
49914
|
const { data } = useAuth();
|
|
49884
49915
|
const { businessId } = useLayerContext();
|
|
49885
|
-
return new
|
|
49916
|
+
return new ActiveTimeTrackerSWRResponse((0, swr.default)(() => withLocale(buildKey$11(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }) => getActiveTimeTracker(apiUrl, accessToken, { params: { businessId } })().then(effect.Schema.decodeUnknownPromise(ActiveTimeTrackerResponseSchema)).then(({ data }) => {
|
|
49886
49917
|
var _data$timeEntry;
|
|
49887
49918
|
return (_data$timeEntry = data.timeEntry) !== null && _data$timeEntry !== void 0 ? _data$timeEntry : null;
|
|
49888
49919
|
})));
|
|
@@ -49933,11 +49964,16 @@ function buildKey$10({ access_token: accessToken, apiUrl, businessId, allowArchi
|
|
|
49933
49964
|
var listCatalogServices = get$1(({ businessId, allowArchived }) => {
|
|
49934
49965
|
return `/v1/businesses/${businessId}/catalog/services?${toDefinedSearchParameters({ allowArchived })}`;
|
|
49935
49966
|
});
|
|
49967
|
+
var ListCatalogServicesSWRResponse = class extends SWRQueryResult {
|
|
49968
|
+
get error() {
|
|
49969
|
+
return this.swrResponse.error;
|
|
49970
|
+
}
|
|
49971
|
+
};
|
|
49936
49972
|
function useListCatalogServices({ allowArchived, isEnabled = true } = {}) {
|
|
49937
49973
|
const withLocale = useLocalizedKey();
|
|
49938
49974
|
const { data } = useAuth();
|
|
49939
49975
|
const { businessId } = useLayerContext();
|
|
49940
|
-
return new
|
|
49976
|
+
return new ListCatalogServicesSWRResponse((0, swr.default)(() => withLocale(buildKey$10(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
49941
49977
|
businessId,
|
|
49942
49978
|
allowArchived,
|
|
49943
49979
|
isEnabled
|
|
@@ -51241,10 +51277,12 @@ var formatCreateLabel = (inputValue, t) => /* @__PURE__ */ (0, react_jsx_runtime
|
|
|
51241
51277
|
"aria-hidden": "true"
|
|
51242
51278
|
}), inputValue ? t("timeTracking:services.create_service_input_value", "Create service \"{{inputValue}}\"", { inputValue }) : t("timeTracking:services.add_service", "Add service")]
|
|
51243
51279
|
});
|
|
51244
|
-
function TimeEntryServiceSelector({ selectedServiceId, onSelectedServiceIdChange, placeholder, isReadOnly, isClearable, inline, className, showLabel = true, allowArchived, isCreatable, onCreateService }) {
|
|
51280
|
+
function TimeEntryServiceSelector({ selectedServiceId, onSelectedServiceIdChange, placeholder, isReadOnly, isClearable, inline, className, showLabel = true, hideSpecifiedIdNotFoundError, allowArchived, isCreatable, onCreateService }) {
|
|
51245
51281
|
const { t } = (0, react_i18next.useTranslation)();
|
|
51246
|
-
const { data: servicesResponse, isLoading, isError } = useListCatalogServices({ allowArchived });
|
|
51282
|
+
const { data: servicesResponse, isLoading, isError, error } = useListCatalogServices({ allowArchived });
|
|
51247
51283
|
const isLoadingWithoutFallback = isLoading && !servicesResponse;
|
|
51284
|
+
const shouldHideError = hideSpecifiedIdNotFoundError && isAPIErrorOfType(error, ApiEnumErrorType.SpecifiedIdNotFound);
|
|
51285
|
+
const shouldShowError = isError && !shouldHideError;
|
|
51248
51286
|
const shouldDisableComboBox = isLoadingWithoutFallback || isError;
|
|
51249
51287
|
const serviceOptions = (0, react.useMemo)(() => {
|
|
51250
51288
|
var _servicesResponse$dat;
|
|
@@ -51265,13 +51303,13 @@ function TimeEntryServiceSelector({ selectedServiceId, onSelectedServiceIdChange
|
|
|
51265
51303
|
children: t("timeTracking:label.no_services", "No services available")
|
|
51266
51304
|
}), [t]);
|
|
51267
51305
|
const ErrorMessage = (0, react.useMemo)(() => {
|
|
51268
|
-
if (!
|
|
51306
|
+
if (!shouldShowError) return null;
|
|
51269
51307
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(P, {
|
|
51270
51308
|
size: "xs",
|
|
51271
51309
|
status: "error",
|
|
51272
51310
|
children: t("timeTracking:error.load_services", "Failed to load services.")
|
|
51273
51311
|
});
|
|
51274
|
-
}, [
|
|
51312
|
+
}, [shouldShowError, t]);
|
|
51275
51313
|
const inputId = (0, react.useId)();
|
|
51276
51314
|
const sharedProps = {
|
|
51277
51315
|
selectedValue: selectedServiceForComboBox,
|
|
@@ -51285,7 +51323,7 @@ function TimeEntryServiceSelector({ selectedServiceId, onSelectedServiceIdChange
|
|
|
51285
51323
|
},
|
|
51286
51324
|
isClearable,
|
|
51287
51325
|
isDisabled: shouldDisableComboBox,
|
|
51288
|
-
isError,
|
|
51326
|
+
isError: shouldShowError,
|
|
51289
51327
|
isLoading: isLoadingWithoutFallback,
|
|
51290
51328
|
isReadOnly,
|
|
51291
51329
|
["aria-label"]: showLabel ? void 0 : t("timeTracking:label.service", "Service")
|
|
@@ -51626,21 +51664,24 @@ var ActiveTimeTracker = ({ isDrawerOpen, onDrawerOpenChange }) => {
|
|
|
51626
51664
|
const { t } = (0, react_i18next.useTranslation)();
|
|
51627
51665
|
const { isMobile } = useSizeClass();
|
|
51628
51666
|
const { formatSecondsAsDuration } = useIntlFormatter();
|
|
51629
|
-
const { data: activeEntry, isLoading, isError } = useActiveTimeTracker();
|
|
51667
|
+
const { data: activeEntry, isLoading, isError, error } = useActiveTimeTracker();
|
|
51630
51668
|
const elapsedSeconds = useElapsedSeconds(activeEntry === null || activeEntry === void 0 ? void 0 : activeEntry.createdAt);
|
|
51631
51669
|
const timerDisplayValue = (0, react.useMemo)(() => formatSecondsAsDuration(elapsedSeconds), [elapsedSeconds, formatSecondsAsDuration]);
|
|
51632
51670
|
if (isLoading) return null;
|
|
51633
|
-
if (isError)
|
|
51634
|
-
|
|
51635
|
-
|
|
51636
|
-
|
|
51637
|
-
|
|
51638
|
-
|
|
51639
|
-
|
|
51640
|
-
|
|
51671
|
+
if (isError) {
|
|
51672
|
+
if (isAPIErrorOfType(error, ApiEnumErrorType.SpecifiedIdNotFound)) return null;
|
|
51673
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Container, {
|
|
51674
|
+
name: "ActiveTimeTracker",
|
|
51675
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(VStack, {
|
|
51676
|
+
pi: "lg",
|
|
51677
|
+
pbe: "md",
|
|
51678
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DataState, {
|
|
51679
|
+
status: DataStateStatus.failed,
|
|
51680
|
+
title: t("timeTracking:error.load_active_timer", "Failed to load active timer. Please check your connection and try again.")
|
|
51681
|
+
})
|
|
51641
51682
|
})
|
|
51642
|
-
})
|
|
51643
|
-
}
|
|
51683
|
+
});
|
|
51684
|
+
}
|
|
51644
51685
|
if (activeEntry) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActiveTimeTrackerBanner, {
|
|
51645
51686
|
activeEntry,
|
|
51646
51687
|
timerDisplayValue
|
|
@@ -51827,7 +51868,8 @@ var TimeEntriesTableHeader = () => {
|
|
|
51827
51868
|
placeholder: t("timeTracking:label.all_services", "All Services"),
|
|
51828
51869
|
showLabel: false,
|
|
51829
51870
|
allowArchived: true,
|
|
51830
|
-
inline: true
|
|
51871
|
+
inline: true,
|
|
51872
|
+
hideSpecifiedIdNotFoundError: true
|
|
51831
51873
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CustomerSelector, {
|
|
51832
51874
|
selectedCustomer,
|
|
51833
51875
|
onSelectedCustomerChange: setSelectedCustomer,
|
|
@@ -51835,7 +51877,8 @@ var TimeEntriesTableHeader = () => {
|
|
|
51835
51877
|
className: "Layer__TimeEntriesTable__FilterCustomer",
|
|
51836
51878
|
placeholder: t("timeTracking:label.all_customers", "All Customers"),
|
|
51837
51879
|
showLabel: false,
|
|
51838
|
-
inline: true
|
|
51880
|
+
inline: true,
|
|
51881
|
+
hideSpecifiedIdNotFoundError: true
|
|
51839
51882
|
})]
|
|
51840
51883
|
}), [
|
|
51841
51884
|
selectedCustomer,
|
|
@@ -52107,7 +52150,8 @@ var TimeEntryCustomerField = ({ value, entryCustomer, isReadOnly, onChange }) =>
|
|
|
52107
52150
|
inline: true,
|
|
52108
52151
|
label: t("timeTracking:label.customer_optional", "Customer (optional)"),
|
|
52109
52152
|
placeholder: t("timeTracking:label.select_customer_short", "Select a customer"),
|
|
52110
|
-
className: "Layer__TimeEntryForm__Field__Customer"
|
|
52153
|
+
className: "Layer__TimeEntryForm__Field__Customer",
|
|
52154
|
+
hideSpecifiedIdNotFoundError: true
|
|
52111
52155
|
});
|
|
52112
52156
|
};
|
|
52113
52157
|
var TimeEntryForm = ({ onSuccess, entry, isReadOnly }) => {
|
|
@@ -52175,7 +52219,8 @@ var TimeEntryForm = ({ onSuccess, entry, isReadOnly }) => {
|
|
|
52175
52219
|
inline: true,
|
|
52176
52220
|
className: "Layer__TimeEntryForm__Field__Service",
|
|
52177
52221
|
isCreatable: !isReadOnly,
|
|
52178
|
-
onCreateService: handleCreateService
|
|
52222
|
+
onCreateService: handleCreateService,
|
|
52223
|
+
hideSpecifiedIdNotFoundError: true
|
|
52179
52224
|
})
|
|
52180
52225
|
}),
|
|
52181
52226
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(form.Field, {
|
|
@@ -53093,13 +53138,13 @@ exports.ProfitAndLoss = ProfitAndLoss;
|
|
|
53093
53138
|
exports.ProfitAndLossView = ProfitAndLossView;
|
|
53094
53139
|
exports.ProjectProfitabilityView = ProjectProfitabilityView;
|
|
53095
53140
|
exports.Reports = Reports;
|
|
53141
|
+
exports.SolopreneurOverview = SolopreneurOverview;
|
|
53096
53142
|
exports.StatementOfCashFlow = StatementOfCashFlow;
|
|
53097
53143
|
exports.SupportedLocale = SupportedLocale;
|
|
53098
53144
|
exports.Tasks = Tasks;
|
|
53145
|
+
exports.TaxEstimates = TaxEstimates;
|
|
53099
53146
|
exports.TimeTracking = TimeTracking;
|
|
53100
53147
|
exports.UnifiedReports = UnifiedReports;
|
|
53101
53148
|
exports.unstable_MileageSummaryCard = MileageSummaryCard;
|
|
53102
53149
|
exports.unstable_MileageTracking = unstable_MileageTracking;
|
|
53103
|
-
exports.unstable_SolopreneurOverview = SolopreneurOverview;
|
|
53104
|
-
exports.unstable_TaxEstimates = TaxEstimates;
|
|
53105
53150
|
exports.useLayerContext = useLayerContext;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -218,6 +218,11 @@ var APIError = class APIError extends Error {
|
|
|
218
218
|
return (_this$messages = this.messages) === null || _this$messages === void 0 ? void 0 : _this$messages.map((x) => x.description);
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
|
+
var isAPIErrorOfType = (error, errorType) => {
|
|
222
|
+
var _error$messages;
|
|
223
|
+
if (!(error instanceof APIError)) return false;
|
|
224
|
+
return ((_error$messages = error.messages) === null || _error$messages === void 0 ? void 0 : _error$messages.some((message) => message.error_enum === errorType)) === true;
|
|
225
|
+
};
|
|
221
226
|
//#endregion
|
|
222
227
|
//#region src/utils/api/errorHandler.tsx
|
|
223
228
|
var ErrorHandlerClass = class {
|
|
@@ -250,7 +255,7 @@ var getIntlLocale = (locale) => {
|
|
|
250
255
|
};
|
|
251
256
|
var package_default = {
|
|
252
257
|
name: "@layerfi/components",
|
|
253
|
-
version: "0.1.
|
|
258
|
+
version: "0.1.133-alpha",
|
|
254
259
|
description: "Layer React Components",
|
|
255
260
|
main: "dist/cjs/index.cjs",
|
|
256
261
|
module: "dist/esm/index.mjs",
|
|
@@ -1650,6 +1655,8 @@ var linkedAccounts_default$1 = {
|
|
|
1650
1655
|
"ledger_balance": "Ledger balance",
|
|
1651
1656
|
"link_bank_accounts_and_credit_cards": "Link your bank accounts and credit cards",
|
|
1652
1657
|
"link_more_accounts_any_time": "You can link more accounts at any time from the Bank Transactions section",
|
|
1658
|
+
"link_your_bank_accounts": "Link your bank accounts",
|
|
1659
|
+
"link_your_bank_accounts_description": "Linking your bank accounts allows us to load your bank transactions and automatically categorize them.",
|
|
1653
1660
|
"linked_accounts": "Linked Accounts",
|
|
1654
1661
|
"loading_accounts": "Loading Your Accounts...",
|
|
1655
1662
|
"may_take_few_minutes": "This may take a few minutes",
|
|
@@ -1797,6 +1804,8 @@ var taxEstimates_default$1 = {
|
|
|
1797
1804
|
"no_tax_estimates_summary": "Get started with your tax estimates",
|
|
1798
1805
|
"no_tax_estimates_summary_description": "Start by importing and categorizing your bank transactions",
|
|
1799
1806
|
"no_tax_payments_to_display": "There are no tax payments to display.",
|
|
1807
|
+
"tax_due_is_negative_or_zero": "No taxes owed this year",
|
|
1808
|
+
"tax_due_is_negative_or_zero_description": "Your deductible losses exceed your income for this period, bringing your tax liability to zero.",
|
|
1800
1809
|
"tax_payments": "No tax payments found"
|
|
1801
1810
|
},
|
|
1802
1811
|
error: {
|
|
@@ -1811,6 +1820,7 @@ var taxEstimates_default$1 = {
|
|
|
1811
1820
|
"retrieve_tax_profile": "We couldn’t retrieve your tax profile. Please check your connection and try again.",
|
|
1812
1821
|
"while_loading_tax_details": "An error occurred while loading your tax details. Please check your connection and try again.",
|
|
1813
1822
|
"while_loading_tax_estimates": "An error occurred while loading your tax estimates. Please check your connection and try again.",
|
|
1823
|
+
"while_loading_tax_estimates_summary": "An error occurred while loading your tax summary. Please check your connection and try again.",
|
|
1814
1824
|
"while_loading_tax_payments": "An error occurred while loading your tax payments. Please check your connection and try again.",
|
|
1815
1825
|
"while_loading_tax_summary": "An error occurred while loading your tax summary. Please check your connection and try again."
|
|
1816
1826
|
},
|
|
@@ -1854,6 +1864,8 @@ var taxEstimates_default$1 = {
|
|
|
1854
1864
|
"quarter_taxes": "{{quarterLabel}} taxes",
|
|
1855
1865
|
"remaining_balance": "Remaining Balance",
|
|
1856
1866
|
"rolled_over_from_previous_quarter": "Rolled Over From Previous Quarter",
|
|
1867
|
+
"set_up_your_tax_profile": "Set up your tax profile",
|
|
1868
|
+
"set_up_your_tax_profile_description": "Configuring your tax profile allows us to provide you with tax estimates and avoid any surprises come tax time.",
|
|
1857
1869
|
"single": "Single",
|
|
1858
1870
|
"state": "State",
|
|
1859
1871
|
"tax_details": "Tax Details",
|
|
@@ -3078,6 +3090,8 @@ var linkedAccounts_default = {
|
|
|
3078
3090
|
"ledger_balance": "Solde du grand livre",
|
|
3079
3091
|
"link_bank_accounts_and_credit_cards": "Liez vos comptes bancaires et vos cartes de crédit",
|
|
3080
3092
|
"link_more_accounts_any_time": "Vous pouvez lier d’autres comptes en tout temps à partir de la section Transactions bancaires",
|
|
3093
|
+
"link_your_bank_accounts": "Liez vos comptes bancaires",
|
|
3094
|
+
"link_your_bank_accounts_description": "Lier vos comptes bancaires nous permet de charger vos opérations bancaires et de les catégoriser automatiquement.",
|
|
3081
3095
|
"linked_accounts": "Comptes liés",
|
|
3082
3096
|
"loading_accounts": "Chargement de vos comptes...",
|
|
3083
3097
|
"may_take_few_minutes": "Cela peut prendre quelques minutes",
|
|
@@ -3225,6 +3239,8 @@ var taxEstimates_default = {
|
|
|
3225
3239
|
"no_tax_estimates_summary": "Commencez vos estimations d’impôt",
|
|
3226
3240
|
"no_tax_estimates_summary_description": "Commencez par importer et catégoriser vos opérations bancaires",
|
|
3227
3241
|
"no_tax_payments_to_display": "Il n’y a aucun paiement d’impôt à afficher.",
|
|
3242
|
+
"tax_due_is_negative_or_zero": "Aucun impôt à payer cette année",
|
|
3243
|
+
"tax_due_is_negative_or_zero_description": "Vos pertes déductibles dépassent votre revenu pour cette période, ce qui ramène votre impôt à payer à zéro.",
|
|
3228
3244
|
"tax_payments": "Aucun paiement d’impôt trouvé"
|
|
3229
3245
|
},
|
|
3230
3246
|
error: {
|
|
@@ -3239,6 +3255,7 @@ var taxEstimates_default = {
|
|
|
3239
3255
|
"retrieve_tax_profile": "Nous n’avons pas pu récupérer votre profil fiscal. Veuillez vérifier votre connexion et réessayer.",
|
|
3240
3256
|
"while_loading_tax_details": "Une erreur s’est produite lors du chargement de vos détails fiscaux. Veuillez vérifier votre connexion et réessayer.",
|
|
3241
3257
|
"while_loading_tax_estimates": "Une erreur s’est produite lors du chargement de vos estimations d’impôt. Veuillez vérifier votre connexion et réessayer.",
|
|
3258
|
+
"while_loading_tax_estimates_summary": "Une erreur s'est produite lors du chargement de votre sommaire fiscal. Veuillez vérifier votre connexion et réessayer.",
|
|
3242
3259
|
"while_loading_tax_payments": "Une erreur s’est produite lors du chargement de vos paiements d’impôt. Veuillez vérifier votre connexion et réessayer.",
|
|
3243
3260
|
"while_loading_tax_summary": "Une erreur s’est produite lors du chargement de votre sommaire fiscal. Veuillez vérifier votre connexion et réessayer."
|
|
3244
3261
|
},
|
|
@@ -3252,7 +3269,7 @@ var taxEstimates_default = {
|
|
|
3252
3269
|
"categorization_incomplete": "Catégorisation incomplète",
|
|
3253
3270
|
"deductions": "Déductions",
|
|
3254
3271
|
"due": "Échéance",
|
|
3255
|
-
"due_at": "",
|
|
3272
|
+
"due_at": "Échéance le {{date}}",
|
|
3256
3273
|
"due_with_date": "Échéance : {{date}}",
|
|
3257
3274
|
"enter_amount": "Saisissez un montant",
|
|
3258
3275
|
"enter_area": "Saisissez la superficie",
|
|
@@ -3282,6 +3299,8 @@ var taxEstimates_default = {
|
|
|
3282
3299
|
"quarter_taxes": "Impôts du {{quarterLabel}}",
|
|
3283
3300
|
"remaining_balance": "Solde restant",
|
|
3284
3301
|
"rolled_over_from_previous_quarter": "Reporté du trimestre précédent",
|
|
3302
|
+
"set_up_your_tax_profile": "Configurez votre profil fiscal",
|
|
3303
|
+
"set_up_your_tax_profile_description": "La configuration de votre profil fiscal nous permet de vous fournir des estimations d'impôt et d'éviter les mauvaises surprises au moment des impôts.",
|
|
3285
3304
|
"single": "Célibataire",
|
|
3286
3305
|
"state": "État",
|
|
3287
3306
|
"tax_details": "Détails fiscaux",
|
|
@@ -3608,7 +3627,7 @@ var vehicles_default = {
|
|
|
3608
3627
|
"enter_vin": "Saisissez le NIV",
|
|
3609
3628
|
"license_plate": "Plaque d’immatriculation",
|
|
3610
3629
|
"make_model": "Marque et modèle",
|
|
3611
|
-
"unnamed_vehicle": "",
|
|
3630
|
+
"unnamed_vehicle": "Véhicule sans nom",
|
|
3612
3631
|
"vehicle": "Véhicule",
|
|
3613
3632
|
"vehicle_name_hidden_from_active_list": "{{vehicleName}} sera masqué de votre liste de véhicules actifs. Vous pourrez le réactiver en tout temps.",
|
|
3614
3633
|
"vehicle_name_restored_to_active_list": "{{vehicleName}} sera restauré dans votre liste de véhicules actifs et pourra être utilisé pour faire le suivi de vos déplacements.",
|
|
@@ -7447,6 +7466,11 @@ function keyLoader$9(previousPageData, { access_token: accessToken, apiUrl, busi
|
|
|
7447
7466
|
};
|
|
7448
7467
|
}
|
|
7449
7468
|
}
|
|
7469
|
+
var ListCustomersSWRResponse = class extends SWRInfiniteResult {
|
|
7470
|
+
get error() {
|
|
7471
|
+
return this.swrResponse.error;
|
|
7472
|
+
}
|
|
7473
|
+
};
|
|
7450
7474
|
function useListCustomers({ query, isEnabled = true } = {}) {
|
|
7451
7475
|
const withLocale = useLocalizedKey();
|
|
7452
7476
|
const { data } = useAuth();
|
|
@@ -7466,7 +7490,7 @@ function useListCustomers({ query, isEnabled = true } = {}) {
|
|
|
7466
7490
|
initialSize: 1
|
|
7467
7491
|
});
|
|
7468
7492
|
usePreserveInfiniteSize(swrResponse);
|
|
7469
|
-
return new
|
|
7493
|
+
return new ListCustomersSWRResponse(swrResponse);
|
|
7470
7494
|
}
|
|
7471
7495
|
function usePreloadCustomers(parameters) {
|
|
7472
7496
|
useListCustomers(parameters);
|
|
@@ -38364,12 +38388,14 @@ var CustomerAsOption = class {
|
|
|
38364
38388
|
}
|
|
38365
38389
|
};
|
|
38366
38390
|
var formatCreateLabel$1 = (inputValue, t) => inputValue ? t("customerVendor:action.create_customer_input_value", "Create customer \"{{inputValue}}\"", { inputValue }) : t("customerVendor:action.create_new_customer", "Create new customer");
|
|
38367
|
-
function CustomerSelector({ selectedCustomer, onSelectedCustomerChange, label, placeholder, isCreatable, onCreateCustomer, isReadOnly, inline, className, showLabel = true }) {
|
|
38391
|
+
function CustomerSelector({ selectedCustomer, onSelectedCustomerChange, label, placeholder, isCreatable, onCreateCustomer, isReadOnly, inline, className, hideSpecifiedIdNotFoundError, showLabel = true }) {
|
|
38368
38392
|
const { t } = useTranslation();
|
|
38369
38393
|
const resolvedLabel = label !== null && label !== void 0 ? label : t("customerVendor:label.customer", "Customer");
|
|
38370
38394
|
const combinedClassName = classNames("Layer__CustomerSelector", inline && "Layer__CustomerSelector--inline", className);
|
|
38371
38395
|
const { searchQuery, handleInputChange } = useDebouncedSearchInput({ initialInputState: () => "" });
|
|
38372
|
-
const { data, isLoading, isError } = useListCustomers({ query: searchQuery === "" ? void 0 : searchQuery });
|
|
38396
|
+
const { data, isLoading, isError, error } = useListCustomers({ query: searchQuery === "" ? void 0 : searchQuery });
|
|
38397
|
+
const shouldHideError = hideSpecifiedIdNotFoundError && isAPIErrorOfType(error, ApiEnumErrorType.SpecifiedIdNotFound);
|
|
38398
|
+
const shouldShowError = isError && !shouldHideError;
|
|
38373
38399
|
const options = useMemo(() => (data === null || data === void 0 ? void 0 : data.flatMap(({ data }) => data).map((customer) => new CustomerAsOption(customer))) || [], [data]);
|
|
38374
38400
|
const selectedCustomerId = selectedCustomer === null || selectedCustomer === void 0 ? void 0 : selectedCustomer.id;
|
|
38375
38401
|
const handleSelectionChange = useCallback((selectedOption) => {
|
|
@@ -38420,7 +38446,7 @@ function CustomerSelector({ selectedCustomer, onSelectedCustomerChange, label, p
|
|
|
38420
38446
|
ErrorMessage
|
|
38421
38447
|
},
|
|
38422
38448
|
isDisabled: isLoadingWithoutFallback || isError,
|
|
38423
|
-
isError,
|
|
38449
|
+
isError: shouldShowError,
|
|
38424
38450
|
isLoading: isLoadingWithoutFallback,
|
|
38425
38451
|
isReadOnly,
|
|
38426
38452
|
["aria-label"]: showLabel ? void 0 : resolvedLabel
|
|
@@ -43926,10 +43952,10 @@ var NoTaxProfileBanner = ({ onSetupTaxProfile }) => {
|
|
|
43926
43952
|
const { isMobile } = useSizeClass();
|
|
43927
43953
|
const { t } = useTranslation();
|
|
43928
43954
|
const Icon = isMobile ? null : /* @__PURE__ */ jsx(Info, { size: 16 });
|
|
43929
|
-
const title = t("
|
|
43955
|
+
const title = t("taxEstimates:label.set_up_your_tax_profile", "Set up your tax profile");
|
|
43930
43956
|
return /* @__PURE__ */ jsx(Banner, {
|
|
43931
43957
|
title,
|
|
43932
|
-
description: t("
|
|
43958
|
+
description: t("taxEstimates:label.set_up_your_tax_profile_description", "Configuring your tax profile allows us to provide you with tax estimates and avoid any surprises come tax time."),
|
|
43933
43959
|
slots: {
|
|
43934
43960
|
Icon,
|
|
43935
43961
|
Button: onSetupTaxProfile ? /* @__PURE__ */ jsx(Button$1, {
|
|
@@ -44291,8 +44317,8 @@ var TaxEstimatesSummaryCardNegativeOrZero = () => {
|
|
|
44291
44317
|
return /* @__PURE__ */ jsx(DataState, {
|
|
44292
44318
|
className: "Layer__TaxEstimatesSummaryCard__DataState Layer__data-state--reset",
|
|
44293
44319
|
status: DataStateStatus.info,
|
|
44294
|
-
title: t("taxEstimates:
|
|
44295
|
-
description: t("taxEstimates:
|
|
44320
|
+
title: t("taxEstimates:empty.tax_due_is_negative_or_zero", "No taxes owed this year"),
|
|
44321
|
+
description: t("taxEstimates:empty.tax_due_is_negative_or_zero_description", "Your deductible losses exceed your income for this period, bringing your tax liability to zero.")
|
|
44296
44322
|
});
|
|
44297
44323
|
};
|
|
44298
44324
|
//#endregion
|
|
@@ -46519,11 +46545,16 @@ function buildKey$11({ access_token: accessToken, apiUrl, businessId }) {
|
|
|
46519
46545
|
tags: [ACTIVE_TIME_TRACKER_TAG_KEY]
|
|
46520
46546
|
};
|
|
46521
46547
|
}
|
|
46548
|
+
var ActiveTimeTrackerSWRResponse = class extends SWRQueryResult {
|
|
46549
|
+
get error() {
|
|
46550
|
+
return this.swrResponse.error;
|
|
46551
|
+
}
|
|
46552
|
+
};
|
|
46522
46553
|
function useActiveTimeTracker() {
|
|
46523
46554
|
const withLocale = useLocalizedKey();
|
|
46524
46555
|
const { data } = useAuth();
|
|
46525
46556
|
const { businessId } = useLayerContext();
|
|
46526
|
-
return new
|
|
46557
|
+
return new ActiveTimeTrackerSWRResponse(useSWR(() => withLocale(buildKey$11(_objectSpread2(_objectSpread2({}, data), {}, { businessId }))), ({ accessToken, apiUrl, businessId }) => getActiveTimeTracker(apiUrl, accessToken, { params: { businessId } })().then(Schema.decodeUnknownPromise(ActiveTimeTrackerResponseSchema)).then(({ data }) => {
|
|
46527
46558
|
var _data$timeEntry;
|
|
46528
46559
|
return (_data$timeEntry = data.timeEntry) !== null && _data$timeEntry !== void 0 ? _data$timeEntry : null;
|
|
46529
46560
|
})));
|
|
@@ -46574,11 +46605,16 @@ function buildKey$10({ access_token: accessToken, apiUrl, businessId, allowArchi
|
|
|
46574
46605
|
var listCatalogServices = get(({ businessId, allowArchived }) => {
|
|
46575
46606
|
return `/v1/businesses/${businessId}/catalog/services?${toDefinedSearchParameters({ allowArchived })}`;
|
|
46576
46607
|
});
|
|
46608
|
+
var ListCatalogServicesSWRResponse = class extends SWRQueryResult {
|
|
46609
|
+
get error() {
|
|
46610
|
+
return this.swrResponse.error;
|
|
46611
|
+
}
|
|
46612
|
+
};
|
|
46577
46613
|
function useListCatalogServices({ allowArchived, isEnabled = true } = {}) {
|
|
46578
46614
|
const withLocale = useLocalizedKey();
|
|
46579
46615
|
const { data } = useAuth();
|
|
46580
46616
|
const { businessId } = useLayerContext();
|
|
46581
|
-
return new
|
|
46617
|
+
return new ListCatalogServicesSWRResponse(useSWR(() => withLocale(buildKey$10(_objectSpread2(_objectSpread2({}, data), {}, {
|
|
46582
46618
|
businessId,
|
|
46583
46619
|
allowArchived,
|
|
46584
46620
|
isEnabled
|
|
@@ -47882,10 +47918,12 @@ var formatCreateLabel = (inputValue, t) => /* @__PURE__ */ jsxs(Span, {
|
|
|
47882
47918
|
"aria-hidden": "true"
|
|
47883
47919
|
}), inputValue ? t("timeTracking:services.create_service_input_value", "Create service \"{{inputValue}}\"", { inputValue }) : t("timeTracking:services.add_service", "Add service")]
|
|
47884
47920
|
});
|
|
47885
|
-
function TimeEntryServiceSelector({ selectedServiceId, onSelectedServiceIdChange, placeholder, isReadOnly, isClearable, inline, className, showLabel = true, allowArchived, isCreatable, onCreateService }) {
|
|
47921
|
+
function TimeEntryServiceSelector({ selectedServiceId, onSelectedServiceIdChange, placeholder, isReadOnly, isClearable, inline, className, showLabel = true, hideSpecifiedIdNotFoundError, allowArchived, isCreatable, onCreateService }) {
|
|
47886
47922
|
const { t } = useTranslation();
|
|
47887
|
-
const { data: servicesResponse, isLoading, isError } = useListCatalogServices({ allowArchived });
|
|
47923
|
+
const { data: servicesResponse, isLoading, isError, error } = useListCatalogServices({ allowArchived });
|
|
47888
47924
|
const isLoadingWithoutFallback = isLoading && !servicesResponse;
|
|
47925
|
+
const shouldHideError = hideSpecifiedIdNotFoundError && isAPIErrorOfType(error, ApiEnumErrorType.SpecifiedIdNotFound);
|
|
47926
|
+
const shouldShowError = isError && !shouldHideError;
|
|
47889
47927
|
const shouldDisableComboBox = isLoadingWithoutFallback || isError;
|
|
47890
47928
|
const serviceOptions = useMemo(() => {
|
|
47891
47929
|
var _servicesResponse$dat;
|
|
@@ -47906,13 +47944,13 @@ function TimeEntryServiceSelector({ selectedServiceId, onSelectedServiceIdChange
|
|
|
47906
47944
|
children: t("timeTracking:label.no_services", "No services available")
|
|
47907
47945
|
}), [t]);
|
|
47908
47946
|
const ErrorMessage = useMemo(() => {
|
|
47909
|
-
if (!
|
|
47947
|
+
if (!shouldShowError) return null;
|
|
47910
47948
|
return /* @__PURE__ */ jsx(P, {
|
|
47911
47949
|
size: "xs",
|
|
47912
47950
|
status: "error",
|
|
47913
47951
|
children: t("timeTracking:error.load_services", "Failed to load services.")
|
|
47914
47952
|
});
|
|
47915
|
-
}, [
|
|
47953
|
+
}, [shouldShowError, t]);
|
|
47916
47954
|
const inputId = useId();
|
|
47917
47955
|
const sharedProps = {
|
|
47918
47956
|
selectedValue: selectedServiceForComboBox,
|
|
@@ -47926,7 +47964,7 @@ function TimeEntryServiceSelector({ selectedServiceId, onSelectedServiceIdChange
|
|
|
47926
47964
|
},
|
|
47927
47965
|
isClearable,
|
|
47928
47966
|
isDisabled: shouldDisableComboBox,
|
|
47929
|
-
isError,
|
|
47967
|
+
isError: shouldShowError,
|
|
47930
47968
|
isLoading: isLoadingWithoutFallback,
|
|
47931
47969
|
isReadOnly,
|
|
47932
47970
|
["aria-label"]: showLabel ? void 0 : t("timeTracking:label.service", "Service")
|
|
@@ -48267,21 +48305,24 @@ var ActiveTimeTracker = ({ isDrawerOpen, onDrawerOpenChange }) => {
|
|
|
48267
48305
|
const { t } = useTranslation();
|
|
48268
48306
|
const { isMobile } = useSizeClass();
|
|
48269
48307
|
const { formatSecondsAsDuration } = useIntlFormatter();
|
|
48270
|
-
const { data: activeEntry, isLoading, isError } = useActiveTimeTracker();
|
|
48308
|
+
const { data: activeEntry, isLoading, isError, error } = useActiveTimeTracker();
|
|
48271
48309
|
const elapsedSeconds = useElapsedSeconds(activeEntry === null || activeEntry === void 0 ? void 0 : activeEntry.createdAt);
|
|
48272
48310
|
const timerDisplayValue = useMemo(() => formatSecondsAsDuration(elapsedSeconds), [elapsedSeconds, formatSecondsAsDuration]);
|
|
48273
48311
|
if (isLoading) return null;
|
|
48274
|
-
if (isError)
|
|
48275
|
-
|
|
48276
|
-
|
|
48277
|
-
|
|
48278
|
-
|
|
48279
|
-
|
|
48280
|
-
|
|
48281
|
-
|
|
48312
|
+
if (isError) {
|
|
48313
|
+
if (isAPIErrorOfType(error, ApiEnumErrorType.SpecifiedIdNotFound)) return null;
|
|
48314
|
+
return /* @__PURE__ */ jsx(Container, {
|
|
48315
|
+
name: "ActiveTimeTracker",
|
|
48316
|
+
children: /* @__PURE__ */ jsx(VStack, {
|
|
48317
|
+
pi: "lg",
|
|
48318
|
+
pbe: "md",
|
|
48319
|
+
children: /* @__PURE__ */ jsx(DataState, {
|
|
48320
|
+
status: DataStateStatus.failed,
|
|
48321
|
+
title: t("timeTracking:error.load_active_timer", "Failed to load active timer. Please check your connection and try again.")
|
|
48322
|
+
})
|
|
48282
48323
|
})
|
|
48283
|
-
})
|
|
48284
|
-
}
|
|
48324
|
+
});
|
|
48325
|
+
}
|
|
48285
48326
|
if (activeEntry) return /* @__PURE__ */ jsx(ActiveTimeTrackerBanner, {
|
|
48286
48327
|
activeEntry,
|
|
48287
48328
|
timerDisplayValue
|
|
@@ -48468,7 +48509,8 @@ var TimeEntriesTableHeader = () => {
|
|
|
48468
48509
|
placeholder: t("timeTracking:label.all_services", "All Services"),
|
|
48469
48510
|
showLabel: false,
|
|
48470
48511
|
allowArchived: true,
|
|
48471
|
-
inline: true
|
|
48512
|
+
inline: true,
|
|
48513
|
+
hideSpecifiedIdNotFoundError: true
|
|
48472
48514
|
}), /* @__PURE__ */ jsx(CustomerSelector, {
|
|
48473
48515
|
selectedCustomer,
|
|
48474
48516
|
onSelectedCustomerChange: setSelectedCustomer,
|
|
@@ -48476,7 +48518,8 @@ var TimeEntriesTableHeader = () => {
|
|
|
48476
48518
|
className: "Layer__TimeEntriesTable__FilterCustomer",
|
|
48477
48519
|
placeholder: t("timeTracking:label.all_customers", "All Customers"),
|
|
48478
48520
|
showLabel: false,
|
|
48479
|
-
inline: true
|
|
48521
|
+
inline: true,
|
|
48522
|
+
hideSpecifiedIdNotFoundError: true
|
|
48480
48523
|
})]
|
|
48481
48524
|
}), [
|
|
48482
48525
|
selectedCustomer,
|
|
@@ -48748,7 +48791,8 @@ var TimeEntryCustomerField = ({ value, entryCustomer, isReadOnly, onChange }) =>
|
|
|
48748
48791
|
inline: true,
|
|
48749
48792
|
label: t("timeTracking:label.customer_optional", "Customer (optional)"),
|
|
48750
48793
|
placeholder: t("timeTracking:label.select_customer_short", "Select a customer"),
|
|
48751
|
-
className: "Layer__TimeEntryForm__Field__Customer"
|
|
48794
|
+
className: "Layer__TimeEntryForm__Field__Customer",
|
|
48795
|
+
hideSpecifiedIdNotFoundError: true
|
|
48752
48796
|
});
|
|
48753
48797
|
};
|
|
48754
48798
|
var TimeEntryForm = ({ onSuccess, entry, isReadOnly }) => {
|
|
@@ -48816,7 +48860,8 @@ var TimeEntryForm = ({ onSuccess, entry, isReadOnly }) => {
|
|
|
48816
48860
|
inline: true,
|
|
48817
48861
|
className: "Layer__TimeEntryForm__Field__Service",
|
|
48818
48862
|
isCreatable: !isReadOnly,
|
|
48819
|
-
onCreateService: handleCreateService
|
|
48863
|
+
onCreateService: handleCreateService,
|
|
48864
|
+
hideSpecifiedIdNotFoundError: true
|
|
48820
48865
|
})
|
|
48821
48866
|
}),
|
|
48822
48867
|
/* @__PURE__ */ jsx(form.Field, {
|
|
@@ -49709,4 +49754,4 @@ var LayerProvider = (_ref) => {
|
|
|
49709
49754
|
});
|
|
49710
49755
|
};
|
|
49711
49756
|
//#endregion
|
|
49712
|
-
export { AccountingOverview, BalanceSheet, BankTransactions, BankTransactionsWithLinkedAccounts, BookkeepingOverview, BookkeepingUpsellBar, ChartOfAccounts, Direction, DisplayState, EntityName, GeneralLedgerView, GlobalDateRangeSelection, GlobalMonthPicker, Integrations, Invoices, Journal, LandingPage, LayerProvider, LinkAccounts, LinkedAccounts, Onboarding, ProfitAndLoss, ProfitAndLossView, ProjectProfitabilityView, Reports, StatementOfCashFlow, SupportedLocale, Tasks, TimeTracking, UnifiedReports, MileageSummaryCard as unstable_MileageSummaryCard, unstable_MileageTracking,
|
|
49757
|
+
export { AccountingOverview, BalanceSheet, BankTransactions, BankTransactionsWithLinkedAccounts, BookkeepingOverview, BookkeepingUpsellBar, ChartOfAccounts, Direction, DisplayState, EntityName, GeneralLedgerView, GlobalDateRangeSelection, GlobalMonthPicker, Integrations, Invoices, Journal, LandingPage, LayerProvider, LinkAccounts, LinkedAccounts, Onboarding, ProfitAndLoss, ProfitAndLossView, ProjectProfitabilityView, Reports, SolopreneurOverview, StatementOfCashFlow, SupportedLocale, Tasks, TaxEstimates, TimeTracking, UnifiedReports, MileageSummaryCard as unstable_MileageSummaryCard, unstable_MileageTracking, useLayerContext };
|
package/dist/index.d.ts
CHANGED
|
@@ -1022,6 +1022,8 @@ declare const _SIZE_VARIANTS: readonly ["sm", "lg"];
|
|
|
1022
1022
|
|
|
1023
1023
|
declare type SizeVariant = (typeof _SIZE_VARIANTS)[number];
|
|
1024
1024
|
|
|
1025
|
+
export declare const SolopreneurOverview: ({ interactionProps, chartColorsList, stringOverrides, }: SolopreneurOverviewProps) => JSX_2.Element;
|
|
1026
|
+
|
|
1025
1027
|
declare interface SolopreneurOverviewInteractionProps {
|
|
1026
1028
|
banner?: {
|
|
1027
1029
|
onSetupTaxProfile?: () => void;
|
|
@@ -1136,6 +1138,8 @@ declare interface TasksStringOverrides {
|
|
|
1136
1138
|
header?: string;
|
|
1137
1139
|
}
|
|
1138
1140
|
|
|
1141
|
+
export declare const TaxEstimates: ({ onClickReviewTransactions: onReviewClicked }: TaxEstimatesProps) => JSX_2.Element;
|
|
1142
|
+
|
|
1139
1143
|
declare type TaxEstimatesContextProviderProps = PropsWithChildren<{
|
|
1140
1144
|
onClickReviewTransactions?: (payload: TaxEstimatesReviewTransactionsPayload) => void;
|
|
1141
1145
|
}>;
|
|
@@ -1203,10 +1207,6 @@ export declare const unstable_MileageTracking: ({ showTitle }: {
|
|
|
1203
1207
|
showTitle?: boolean;
|
|
1204
1208
|
}) => JSX_2.Element;
|
|
1205
1209
|
|
|
1206
|
-
export declare const unstable_SolopreneurOverview: ({ interactionProps, chartColorsList, stringOverrides, }: SolopreneurOverviewProps) => JSX_2.Element;
|
|
1207
|
-
|
|
1208
|
-
export declare const unstable_TaxEstimates: ({ onClickReviewTransactions: onReviewClicked }: TaxEstimatesProps) => JSX_2.Element;
|
|
1209
|
-
|
|
1210
1210
|
export declare const useLayerContext: () => LayerContextShape;
|
|
1211
1211
|
|
|
1212
1212
|
declare type Variants = Partial<{
|