@spaceinvoices/react-ui 0.4.2 → 0.4.3
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/cli/dist/index.js +1 -1
- package/package.json +1 -1
- package/src/components/advance-invoices/list/list-table.tsx +60 -0
- package/src/components/advance-invoices/list/locales/de.ts +1 -0
- package/src/components/advance-invoices/list/locales/en.ts +1 -0
- package/src/components/advance-invoices/list/locales/es.ts +1 -0
- package/src/components/advance-invoices/list/locales/fr.ts +1 -0
- package/src/components/advance-invoices/list/locales/hr.ts +1 -0
- package/src/components/advance-invoices/list/locales/it.ts +1 -0
- package/src/components/advance-invoices/list/locales/nl.ts +1 -0
- package/src/components/advance-invoices/list/locales/pl.ts +1 -0
- package/src/components/advance-invoices/list/locales/pt.ts +1 -0
- package/src/components/advance-invoices/list/locales/sl.ts +1 -0
- package/src/components/credit-notes/list/list-table.tsx +34 -6
- package/src/components/credit-notes/list/locales/de.ts +1 -1
- package/src/components/credit-notes/list/locales/en.ts +2 -0
- package/src/components/credit-notes/list/locales/es.ts +1 -1
- package/src/components/credit-notes/list/locales/fr.ts +1 -1
- package/src/components/credit-notes/list/locales/hr.ts +1 -1
- package/src/components/credit-notes/list/locales/it.ts +1 -1
- package/src/components/credit-notes/list/locales/nl.ts +1 -1
- package/src/components/credit-notes/list/locales/pl.ts +1 -1
- package/src/components/credit-notes/list/locales/pt.ts +1 -1
- package/src/components/credit-notes/list/locales/sl.ts +1 -1
- package/src/components/dashboard/collection-rate-card/use-collection-rate.ts +2 -2
- package/src/components/dashboard/invoice-status-chart/use-invoice-status.ts +3 -3
- package/src/components/dashboard/payment-methods-chart/use-payment-methods.ts +1 -1
- package/src/components/dashboard/payment-trend-chart/use-payment-trend.ts +1 -1
- package/src/components/dashboard/revenue-trend-chart/use-revenue-trend.ts +1 -1
- package/src/components/dashboard/shared/use-revenue-data.ts +4 -4
- package/src/components/dashboard/shared/use-stats-counts.ts +4 -4
- package/src/components/dashboard/shared/use-stats-query.ts +1 -1
- package/src/components/dashboard/tax-collected-card/use-tax-collected.ts +2 -2
- package/src/components/dashboard/top-customers-chart/use-top-customers.ts +1 -1
- package/src/components/delivery-notes/create/create-delivery-note-form.tsx +332 -0
- package/src/components/delivery-notes/create/locales/de.ts +50 -0
- package/src/components/delivery-notes/create/locales/es.ts +49 -0
- package/src/components/delivery-notes/create/locales/fr.ts +50 -0
- package/src/components/delivery-notes/create/locales/hr.ts +49 -0
- package/src/components/delivery-notes/create/locales/it.ts +49 -0
- package/src/components/delivery-notes/create/locales/nl.ts +50 -0
- package/src/components/delivery-notes/create/locales/pl.ts +49 -0
- package/src/components/delivery-notes/create/locales/pt.ts +50 -0
- package/src/components/delivery-notes/create/locales/sl.ts +49 -0
- package/src/components/delivery-notes/create/prepare-delivery-note-submission.ts +38 -0
- package/src/components/delivery-notes/create/use-delivery-note-customer-form.ts +1 -0
- package/src/components/delivery-notes/delivery-notes.hooks.ts +15 -0
- package/src/components/delivery-notes/list/index.ts +3 -0
- package/src/components/delivery-notes/list/list-row-actions.tsx +103 -0
- package/src/components/delivery-notes/list/list-table.tsx +214 -0
- package/src/components/delivery-notes/list/locales/de.ts +9 -0
- package/src/components/delivery-notes/list/locales/en.ts +11 -0
- package/src/components/delivery-notes/list/locales/es.ts +9 -0
- package/src/components/delivery-notes/list/locales/fr.ts +9 -0
- package/src/components/delivery-notes/list/locales/hr.ts +9 -0
- package/src/components/delivery-notes/list/locales/it.ts +9 -0
- package/src/components/delivery-notes/list/locales/nl.ts +9 -0
- package/src/components/delivery-notes/list/locales/pl.ts +9 -0
- package/src/components/delivery-notes/list/locales/pt.ts +9 -0
- package/src/components/delivery-notes/list/locales/sl.ts +9 -0
- package/src/components/delivery-notes/list/use-delivery-note-download.ts +63 -0
- package/src/components/documents/create/document-details-section.tsx +36 -32
- package/src/components/documents/create/live-preview.tsx +37 -10
- package/src/components/documents/create/prepare-document-submission.ts +1 -1
- package/src/components/documents/documents.hooks.ts +2 -1
- package/src/components/documents/shared/document-preview-display.tsx +12 -5
- package/src/components/documents/types.ts +10 -1
- package/src/components/documents/view/document-details-card.tsx +3 -3
- package/src/components/documents/view/document-payments-list.tsx +3 -3
- package/src/components/documents/view/document-relations-list.tsx +105 -0
- package/src/components/documents/view/locales/de.ts +21 -0
- package/src/components/documents/view/locales/es.ts +21 -0
- package/src/components/documents/view/locales/fr.ts +21 -0
- package/src/components/documents/view/locales/hr.ts +21 -0
- package/src/components/documents/view/locales/it.ts +21 -0
- package/src/components/documents/view/locales/nl.ts +21 -0
- package/src/components/documents/view/locales/pl.ts +21 -0
- package/src/components/documents/view/locales/pt.ts +21 -0
- package/src/components/documents/view/locales/sl.ts +21 -0
- package/src/components/documents/view/use-document-download.ts +5 -3
- package/src/components/entities/fina-settings-form/fina-settings-form.tsx +77 -65
- package/src/components/entities/fina-settings-form/fina-settings.hooks.ts +7 -2
- package/src/components/entities/furs-settings-form/furs-settings-form.tsx +10 -1
- package/src/components/entities/furs-settings-form/furs-settings.hooks.ts +7 -2
- package/src/components/entities/furs-settings-form/sections/general-settings-section.tsx +12 -4
- package/src/components/invoices/invoices-furs.hooks.ts +24 -9
- package/src/components/invoices/list/list-row-actions.tsx +3 -3
- package/src/components/invoices/list/list-table.tsx +68 -3
- package/src/components/invoices/list/locales/de.ts +1 -0
- package/src/components/invoices/list/locales/en.ts +1 -0
- package/src/components/invoices/list/locales/es.ts +1 -0
- package/src/components/invoices/list/locales/fr.ts +1 -0
- package/src/components/invoices/list/locales/hr.ts +1 -0
- package/src/components/invoices/list/locales/it.ts +1 -0
- package/src/components/invoices/list/locales/nl.ts +1 -0
- package/src/components/invoices/list/locales/pl.ts +1 -0
- package/src/components/invoices/list/locales/pt.ts +1 -0
- package/src/components/invoices/list/locales/sl.ts +1 -0
- package/src/components/items/item-list-table/item-list-row-actions.tsx +3 -2
- package/src/components/items/item-list-table/item-list-row.tsx +3 -2
- package/src/generated/schemas/deliverynote.ts +134 -0
- package/src/generated/schemas/entity.ts +4 -0
- package/src/generated/schemas/index.ts +3 -0
- package/src/generated/schemas/order.ts +5 -3
- package/src/generated/schemas/payment.ts +22 -2
- package/src/generated/schemas/renderadvanceinvoicepreview_body.ts +1 -0
- package/src/generated/schemas/rendercreditnotepreview_body.ts +1 -0
- package/src/generated/schemas/renderdeliverynotepreview_body.ts +185 -0
- package/src/generated/schemas/renderestimatepreview_body.ts +1 -0
- package/src/generated/schemas/renderinvoicepreview_body.ts +1 -0
- package/src/generated/schemas/startpdfexport_body.ts +18 -2
- package/src/generated/schemas/userfinasettings.ts +19 -0
- package/src/generated/schemas/webhook.ts +12 -0
- package/src/hooks/use-duplicate-document.ts +11 -3
- package/src/hooks/use-next-document-number.ts +2 -2
- package/src/providers/sdk-provider.tsx +5 -7
package/cli/dist/index.js
CHANGED
|
@@ -870,7 +870,7 @@ async function list(options = {}) {
|
|
|
870
870
|
|
|
871
871
|
// cli/src/index.ts
|
|
872
872
|
var program = new Command();
|
|
873
|
-
program.name("spaceinvoices-ui").description("CLI for adding Space Invoices React UI components to your project").version("0.4.
|
|
873
|
+
program.name("spaceinvoices-ui").description("CLI for adding Space Invoices React UI components to your project").version("0.4.3");
|
|
874
874
|
program.option("--local <path>", "Use local registry from specified path (for development)");
|
|
875
875
|
program.command("init").description("Initialize Space Invoices UI in your project").option("-y, --yes", "Skip prompts and use defaults").option("-f, --force", "Overwrite existing configuration").option("--cwd <path>", "Working directory (defaults to current directory)").action(async (options) => {
|
|
876
876
|
const globalOpts = program.opts();
|
package/package.json
CHANGED
|
@@ -184,6 +184,11 @@ export default function AdvanceInvoiceListTable({
|
|
|
184
184
|
align: "right",
|
|
185
185
|
cell: (advanceInvoice) => advanceInvoice.total_with_tax,
|
|
186
186
|
},
|
|
187
|
+
{
|
|
188
|
+
id: "status",
|
|
189
|
+
header: t("Status"),
|
|
190
|
+
cell: (advanceInvoice) => <AdvanceInvoiceStatusBadge advanceInvoice={advanceInvoice} t={t} />,
|
|
191
|
+
},
|
|
187
192
|
{
|
|
188
193
|
id: "actions",
|
|
189
194
|
header: "",
|
|
@@ -236,3 +241,58 @@ export default function AdvanceInvoiceListTable({
|
|
|
236
241
|
/>
|
|
237
242
|
);
|
|
238
243
|
}
|
|
244
|
+
|
|
245
|
+
/** Status badge for advance invoices */
|
|
246
|
+
function AdvanceInvoiceStatusBadge({
|
|
247
|
+
advanceInvoice,
|
|
248
|
+
t,
|
|
249
|
+
}: {
|
|
250
|
+
advanceInvoice: AdvanceInvoice;
|
|
251
|
+
t: (key: string) => string;
|
|
252
|
+
}) {
|
|
253
|
+
if ((advanceInvoice as any).voided_at) {
|
|
254
|
+
return (
|
|
255
|
+
<Badge variant="outline" className="border-red-500 bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-400">
|
|
256
|
+
{t("Voided")}
|
|
257
|
+
</Badge>
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
if ((advanceInvoice as any).is_draft) {
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
if (advanceInvoice.paid_in_full) {
|
|
264
|
+
return (
|
|
265
|
+
<Badge
|
|
266
|
+
variant="outline"
|
|
267
|
+
className="border-green-500 bg-green-50 text-green-700 dark:bg-green-950 dark:text-green-400"
|
|
268
|
+
>
|
|
269
|
+
{t("Paid")}
|
|
270
|
+
</Badge>
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
if (advanceInvoice.date_due && new Date(advanceInvoice.date_due) < new Date()) {
|
|
274
|
+
return (
|
|
275
|
+
<Badge
|
|
276
|
+
variant="outline"
|
|
277
|
+
className="border-orange-500 bg-orange-50 text-orange-700 dark:bg-orange-950 dark:text-orange-400"
|
|
278
|
+
>
|
|
279
|
+
{t("Overdue")}
|
|
280
|
+
</Badge>
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
if (advanceInvoice.total_paid > 0) {
|
|
284
|
+
return (
|
|
285
|
+
<Badge
|
|
286
|
+
variant="outline"
|
|
287
|
+
className="border-yellow-500 bg-yellow-50 text-yellow-700 dark:bg-yellow-950 dark:text-yellow-400"
|
|
288
|
+
>
|
|
289
|
+
{t("Partially Paid")}
|
|
290
|
+
</Badge>
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
return (
|
|
294
|
+
<Badge variant="outline" className="border-gray-500 bg-gray-50 text-gray-700 dark:bg-gray-800 dark:text-gray-400">
|
|
295
|
+
{t("Unpaid")}
|
|
296
|
+
</Badge>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
@@ -176,7 +176,7 @@ export default function CreditNoteListTable({
|
|
|
176
176
|
{
|
|
177
177
|
id: "status",
|
|
178
178
|
header: t("Status"),
|
|
179
|
-
cell: (creditNote) => <
|
|
179
|
+
cell: (creditNote) => <CreditNoteStatusBadge creditNote={creditNote} t={t} />,
|
|
180
180
|
},
|
|
181
181
|
{
|
|
182
182
|
id: "actions",
|
|
@@ -231,13 +231,41 @@ export default function CreditNoteListTable({
|
|
|
231
231
|
);
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
/**
|
|
235
|
-
function
|
|
234
|
+
/** Status badge for credit notes */
|
|
235
|
+
function CreditNoteStatusBadge({ creditNote, t }: { creditNote: CreditNote; t: (key: string) => string }) {
|
|
236
|
+
if ((creditNote as any).voided_at) {
|
|
237
|
+
return (
|
|
238
|
+
<Badge variant="outline" className="border-red-500 bg-red-50 text-red-700 dark:bg-red-950 dark:text-red-400">
|
|
239
|
+
{t("Voided")}
|
|
240
|
+
</Badge>
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
if ((creditNote as any).is_draft) {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
236
246
|
if (creditNote.paid_in_full) {
|
|
237
|
-
return
|
|
247
|
+
return (
|
|
248
|
+
<Badge
|
|
249
|
+
variant="outline"
|
|
250
|
+
className="border-green-500 bg-green-50 text-green-700 dark:bg-green-950 dark:text-green-400"
|
|
251
|
+
>
|
|
252
|
+
{t("Paid")}
|
|
253
|
+
</Badge>
|
|
254
|
+
);
|
|
238
255
|
}
|
|
239
256
|
if (creditNote.total_paid > 0) {
|
|
240
|
-
return
|
|
257
|
+
return (
|
|
258
|
+
<Badge
|
|
259
|
+
variant="outline"
|
|
260
|
+
className="border-yellow-500 bg-yellow-50 text-yellow-700 dark:bg-yellow-950 dark:text-yellow-400"
|
|
261
|
+
>
|
|
262
|
+
{t("Partially Paid")}
|
|
263
|
+
</Badge>
|
|
264
|
+
);
|
|
241
265
|
}
|
|
242
|
-
return
|
|
266
|
+
return (
|
|
267
|
+
<Badge variant="outline" className="border-gray-500 bg-gray-50 text-gray-700 dark:bg-gray-800 dark:text-gray-400">
|
|
268
|
+
{t("Unpaid")}
|
|
269
|
+
</Badge>
|
|
270
|
+
);
|
|
243
271
|
}
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
Overdue: "Überfällig",
|
|
29
29
|
Voided: "Storniert",
|
|
30
30
|
"Created At": "Erstellt am",
|
|
31
|
-
|
|
31
|
+
"Partially Paid": "Teilweise bezahlt",
|
|
32
32
|
Unshare: "Freigabe aufheben",
|
|
33
33
|
// Empty state translations
|
|
34
34
|
"Your list is empty": "Ihre Gutschriftenliste ist leer",
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
Overdue: "Vencido",
|
|
29
29
|
Voided: "Anulado",
|
|
30
30
|
"Created At": "Creado el",
|
|
31
|
-
|
|
31
|
+
"Partially Paid": "Parcialmente pagado",
|
|
32
32
|
Unshare: "Dejar de compartir",
|
|
33
33
|
// Empty state translations
|
|
34
34
|
"Your list is empty": "Su lista de notas de credito esta vacia",
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
Overdue: "En retard",
|
|
29
29
|
Voided: "Annule",
|
|
30
30
|
"Created At": "Cree le",
|
|
31
|
-
|
|
31
|
+
"Partially Paid": "Partiellement payé",
|
|
32
32
|
Unshare: "Supprimer le partage",
|
|
33
33
|
// Empty state translations
|
|
34
34
|
"Your list is empty": "Votre liste d'avoirs est vide",
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
Overdue: "Dospjelo",
|
|
29
29
|
Voided: "Stornirano",
|
|
30
30
|
"Created At": "Kreirano",
|
|
31
|
-
|
|
31
|
+
"Partially Paid": "Djelomično plaćeno",
|
|
32
32
|
Unshare: "Ukloni dijeljenje",
|
|
33
33
|
// Empty state translations
|
|
34
34
|
"Your list is empty": "Vasa lista odobrenja je prazna",
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
Overdue: "Scaduto",
|
|
29
29
|
Voided: "Annullato",
|
|
30
30
|
"Created At": "Creato il",
|
|
31
|
-
|
|
31
|
+
"Partially Paid": "Parzialmente pagato",
|
|
32
32
|
Unshare: "Rimuovi condivisione",
|
|
33
33
|
// Empty state translations
|
|
34
34
|
"Your list is empty": "La lista delle note di credito e vuota",
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
Overdue: "Achterstallig",
|
|
29
29
|
Voided: "Nietig verklaard",
|
|
30
30
|
"Created At": "Aangemaakt op",
|
|
31
|
-
|
|
31
|
+
"Partially Paid": "Gedeeltelijk betaald",
|
|
32
32
|
Unshare: "Delen opheffen",
|
|
33
33
|
// Empty state translations
|
|
34
34
|
"Your list is empty": "Uw lijst met creditnota's is leeg",
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
Overdue: "Zaległe",
|
|
29
29
|
Voided: "Anulowane",
|
|
30
30
|
"Created At": "Utworzono",
|
|
31
|
-
|
|
31
|
+
"Partially Paid": "Częściowo opłacona",
|
|
32
32
|
Unshare: "Cofnij udostepnienie",
|
|
33
33
|
// Empty state translations
|
|
34
34
|
"Your list is empty": "Twoja lista not kredytowych jest pusta",
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
Overdue: "Vencido",
|
|
29
29
|
Voided: "Anulado",
|
|
30
30
|
"Created At": "Criado em",
|
|
31
|
-
|
|
31
|
+
"Partially Paid": "Parcialmente pago",
|
|
32
32
|
Unshare: "Remover partilha",
|
|
33
33
|
// Empty state translations
|
|
34
34
|
"Your list is empty": "A sua lista de notas de credito esta vazia",
|
|
@@ -28,7 +28,7 @@ export default {
|
|
|
28
28
|
Overdue: "Zapadlo",
|
|
29
29
|
Voided: "Stornirano",
|
|
30
30
|
"Created At": "Ustvarjeno",
|
|
31
|
-
|
|
31
|
+
"Partially Paid": "Delno plačano",
|
|
32
32
|
Unshare: "Odstrani deljenje",
|
|
33
33
|
// Empty state translations
|
|
34
34
|
"Your list is empty": "Vaš seznam dobropisov je prazen",
|
|
@@ -35,7 +35,7 @@ export function useCollectionRateData(entityId: string | undefined) {
|
|
|
35
35
|
);
|
|
36
36
|
},
|
|
37
37
|
enabled: !!entityId && !!sdk,
|
|
38
|
-
staleTime:
|
|
38
|
+
staleTime: 120_000,
|
|
39
39
|
},
|
|
40
40
|
// Total collected (payments)
|
|
41
41
|
{
|
|
@@ -51,7 +51,7 @@ export function useCollectionRateData(entityId: string | undefined) {
|
|
|
51
51
|
);
|
|
52
52
|
},
|
|
53
53
|
enabled: !!entityId && !!sdk,
|
|
54
|
-
staleTime:
|
|
54
|
+
staleTime: 120_000,
|
|
55
55
|
},
|
|
56
56
|
],
|
|
57
57
|
});
|
|
@@ -36,7 +36,7 @@ export function useInvoiceStatusData(entityId: string | undefined) {
|
|
|
36
36
|
);
|
|
37
37
|
},
|
|
38
38
|
enabled: !!entityId && !!sdk,
|
|
39
|
-
staleTime:
|
|
39
|
+
staleTime: 120_000,
|
|
40
40
|
},
|
|
41
41
|
// Unpaid invoices grouped by overdue bucket (current = pending, others = overdue)
|
|
42
42
|
{
|
|
@@ -54,7 +54,7 @@ export function useInvoiceStatusData(entityId: string | undefined) {
|
|
|
54
54
|
);
|
|
55
55
|
},
|
|
56
56
|
enabled: !!entityId && !!sdk,
|
|
57
|
-
staleTime:
|
|
57
|
+
staleTime: 120_000,
|
|
58
58
|
},
|
|
59
59
|
// Total count to derive voided
|
|
60
60
|
{
|
|
@@ -71,7 +71,7 @@ export function useInvoiceStatusData(entityId: string | undefined) {
|
|
|
71
71
|
);
|
|
72
72
|
},
|
|
73
73
|
enabled: !!entityId && !!sdk,
|
|
74
|
-
staleTime:
|
|
74
|
+
staleTime: 120_000,
|
|
75
75
|
},
|
|
76
76
|
],
|
|
77
77
|
});
|
|
@@ -32,7 +32,7 @@ export function usePaymentMethodsData(entityId: string | undefined) {
|
|
|
32
32
|
);
|
|
33
33
|
},
|
|
34
34
|
enabled: !!entityId && !!sdk,
|
|
35
|
-
staleTime:
|
|
35
|
+
staleTime: 120_000,
|
|
36
36
|
select: (response) => {
|
|
37
37
|
const data = response.data || [];
|
|
38
38
|
return (data as StatsQueryDataItem[]).map((row) => ({
|
|
@@ -54,7 +54,7 @@ export function usePaymentTrendData(entityId: string | undefined) {
|
|
|
54
54
|
);
|
|
55
55
|
},
|
|
56
56
|
enabled: !!entityId && !!sdk,
|
|
57
|
-
staleTime:
|
|
57
|
+
staleTime: 120_000,
|
|
58
58
|
select: (response) => {
|
|
59
59
|
// Build a map of all months with 0 amount
|
|
60
60
|
const monthMap: Record<string, number> = {};
|
|
@@ -55,7 +55,7 @@ export function useRevenueTrendData(entityId: string | undefined) {
|
|
|
55
55
|
);
|
|
56
56
|
},
|
|
57
57
|
enabled: !!entityId && !!sdk,
|
|
58
|
-
staleTime:
|
|
58
|
+
staleTime: 120_000,
|
|
59
59
|
select: (response) => {
|
|
60
60
|
// Build a map of all months with 0 revenue
|
|
61
61
|
const monthMap: Record<string, number> = {};
|
|
@@ -61,7 +61,7 @@ export function useRevenueData(entityId: string | undefined) {
|
|
|
61
61
|
);
|
|
62
62
|
},
|
|
63
63
|
enabled: !!entityId && !!sdk,
|
|
64
|
-
staleTime:
|
|
64
|
+
staleTime: 120_000,
|
|
65
65
|
},
|
|
66
66
|
// This year revenue (using converted amounts for multi-currency support)
|
|
67
67
|
{
|
|
@@ -80,7 +80,7 @@ export function useRevenueData(entityId: string | undefined) {
|
|
|
80
80
|
);
|
|
81
81
|
},
|
|
82
82
|
enabled: !!entityId && !!sdk,
|
|
83
|
-
staleTime:
|
|
83
|
+
staleTime: 120_000,
|
|
84
84
|
},
|
|
85
85
|
// Outstanding (unpaid, not voided)
|
|
86
86
|
{
|
|
@@ -97,7 +97,7 @@ export function useRevenueData(entityId: string | undefined) {
|
|
|
97
97
|
);
|
|
98
98
|
},
|
|
99
99
|
enabled: !!entityId && !!sdk,
|
|
100
|
-
staleTime:
|
|
100
|
+
staleTime: 120_000,
|
|
101
101
|
},
|
|
102
102
|
// Overdue (past due date, unpaid)
|
|
103
103
|
{
|
|
@@ -118,7 +118,7 @@ export function useRevenueData(entityId: string | undefined) {
|
|
|
118
118
|
);
|
|
119
119
|
},
|
|
120
120
|
enabled: !!entityId && !!sdk,
|
|
121
|
-
staleTime:
|
|
121
|
+
staleTime: 120_000,
|
|
122
122
|
},
|
|
123
123
|
],
|
|
124
124
|
});
|
|
@@ -31,7 +31,7 @@ export function useStatsCountsData(entityId: string | undefined) {
|
|
|
31
31
|
);
|
|
32
32
|
},
|
|
33
33
|
enabled: !!entityId && !!sdk,
|
|
34
|
-
staleTime:
|
|
34
|
+
staleTime: 120_000,
|
|
35
35
|
},
|
|
36
36
|
// Estimates count
|
|
37
37
|
{
|
|
@@ -44,7 +44,7 @@ export function useStatsCountsData(entityId: string | undefined) {
|
|
|
44
44
|
);
|
|
45
45
|
},
|
|
46
46
|
enabled: !!entityId && !!sdk,
|
|
47
|
-
staleTime:
|
|
47
|
+
staleTime: 120_000,
|
|
48
48
|
},
|
|
49
49
|
// Customers count
|
|
50
50
|
{
|
|
@@ -57,7 +57,7 @@ export function useStatsCountsData(entityId: string | undefined) {
|
|
|
57
57
|
);
|
|
58
58
|
},
|
|
59
59
|
enabled: !!entityId && !!sdk,
|
|
60
|
-
staleTime:
|
|
60
|
+
staleTime: 120_000,
|
|
61
61
|
},
|
|
62
62
|
// Items count
|
|
63
63
|
{
|
|
@@ -70,7 +70,7 @@ export function useStatsCountsData(entityId: string | undefined) {
|
|
|
70
70
|
);
|
|
71
71
|
},
|
|
72
72
|
enabled: !!entityId && !!sdk,
|
|
73
|
-
staleTime:
|
|
73
|
+
staleTime: 120_000,
|
|
74
74
|
},
|
|
75
75
|
],
|
|
76
76
|
});
|
|
@@ -32,7 +32,7 @@ export function useStatsQuery<TData = StatsQueryResponse>(
|
|
|
32
32
|
return await sdk.entityStats.queryEntityStats(query, { entity_id: entityId });
|
|
33
33
|
},
|
|
34
34
|
enabled: !!entityId && !!sdk,
|
|
35
|
-
staleTime:
|
|
35
|
+
staleTime: 120_000, // 2 minutes
|
|
36
36
|
...options,
|
|
37
37
|
});
|
|
38
38
|
}
|
|
@@ -88,7 +88,7 @@ export function useTaxCollectedData(entityId: string | undefined) {
|
|
|
88
88
|
);
|
|
89
89
|
},
|
|
90
90
|
enabled: !!entityId && !!sdk,
|
|
91
|
-
staleTime:
|
|
91
|
+
staleTime: 120_000, // 1 minute
|
|
92
92
|
},
|
|
93
93
|
// Current year taxes - aggregated by rate using stats API
|
|
94
94
|
{
|
|
@@ -108,7 +108,7 @@ export function useTaxCollectedData(entityId: string | undefined) {
|
|
|
108
108
|
);
|
|
109
109
|
},
|
|
110
110
|
enabled: !!entityId && !!sdk,
|
|
111
|
-
staleTime:
|
|
111
|
+
staleTime: 120_000,
|
|
112
112
|
},
|
|
113
113
|
],
|
|
114
114
|
});
|