@flowselections/floriday-voorraad 1.0.29 → 1.0.31
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-lib/components/voorraad/StockSyncStatus.d.ts.map +1 -1
- package/dist-lib/components/voorraad/StockSyncStatus.js +20 -3
- package/dist-lib/components/voorraad/VoorraadPage.d.ts.map +1 -1
- package/dist-lib/components/voorraad/VoorraadPage.js +1 -4
- package/dist-lib/hooks/useStockSyncHealth.d.ts.map +1 -1
- package/dist-lib/hooks/useStockSyncHealth.js +7 -1
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +9404 -6816
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.d.ts +9404 -6816
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/client.server.d.ts +9404 -6816
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -1
- package/dist-lib/integrations/supabase/types.d.ts +9658 -7030
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -1
- package/dist-lib/lib/floricode-required-features.functions.d.ts +9404 -6816
- package/dist-lib/lib/floricode-required-features.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-customer-offer.functions.d.ts +9404 -6816
- package/dist-lib/lib/floriday-customer-offer.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-env.functions.d.ts +5819 -643
- package/dist-lib/lib/floriday-env.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-gateway.functions.d.ts +17319 -1791
- package/dist-lib/lib/floriday-gateway.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-stock-supply.server.d.ts +53 -0
- package/dist-lib/lib/floriday-stock-supply.server.d.ts.map +1 -0
- package/dist-lib/lib/floriday-stock-supply.server.js +151 -0
- package/dist-lib/lib/floriday-vbn-required.functions.d.ts +5819 -643
- package/dist-lib/lib/floriday-vbn-required.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-warehouse.functions.d.ts +8694 -930
- package/dist-lib/lib/floriday-warehouse.functions.d.ts.map +1 -1
- package/dist-lib/lib/floriday-writes.functions.d.ts +5819 -643
- package/dist-lib/lib/floriday-writes.functions.d.ts.map +1 -1
- package/dist-lib/lib/logistics-tasks.server.d.ts +17 -0
- package/dist-lib/lib/logistics-tasks.server.d.ts.map +1 -0
- package/dist-lib/lib/logistics-tasks.server.js +303 -0
- package/dist-lib/lib/module-runtime-config.functions.d.ts +1 -13
- package/dist-lib/lib/module-runtime-config.functions.d.ts.map +1 -1
- package/dist-lib/lib/module-runtime-config.functions.js +17 -93
- package/dist-lib/lib/module-runtime.server.d.ts +33 -0
- package/dist-lib/lib/module-runtime.server.d.ts.map +1 -0
- package/dist-lib/lib/module-runtime.server.js +184 -0
- package/dist-lib/lib/stock-sync.functions.d.ts +20445 -0
- package/dist-lib/lib/stock-sync.functions.d.ts.map +1 -0
- package/dist-lib/lib/stock-sync.functions.js +30 -0
- package/dist-lib/lib/supabase-admin.server.d.ts +15 -0
- package/dist-lib/lib/supabase-admin.server.d.ts.map +1 -0
- package/dist-lib/lib/supabase-admin.server.js +35 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StockSyncStatus.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/StockSyncStatus.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StockSyncStatus.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/StockSyncStatus.tsx"],"names":[],"mappings":"AAYA,wBAAgB,eAAe,uCA8D9B"}
|
|
@@ -1,12 +1,29 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
/**
|
|
3
3
|
* Subtiele melding op de voorraadpagina wanneer de push naar Floriday
|
|
4
|
-
* vastloopt of stilstaat
|
|
4
|
+
* vastloopt of stilstaat — alleen voor problemen van de laatste 24 uur,
|
|
5
|
+
* met een knop om ze meteen opnieuw te laten proberen.
|
|
5
6
|
*/
|
|
6
|
-
import { AlertTriangle } from "lucide-react";
|
|
7
|
+
import { AlertTriangle, RotateCw } from "lucide-react";
|
|
8
|
+
import { useMutation, useQueryClient } from "@tanstack/react-query";
|
|
9
|
+
import { useServerFn } from "@tanstack/react-start";
|
|
10
|
+
import { toast } from "sonner";
|
|
7
11
|
import { useStockSyncHealth } from "../../hooks/useStockSyncHealth";
|
|
12
|
+
import { retryFailedStockSync } from "../../lib/stock-sync.functions";
|
|
8
13
|
export function StockSyncStatus() {
|
|
9
14
|
const { data } = useStockSyncHealth();
|
|
15
|
+
const queryClient = useQueryClient();
|
|
16
|
+
const retry = useServerFn(retryFailedStockSync);
|
|
17
|
+
const mutation = useMutation({
|
|
18
|
+
mutationFn: () => retry({}),
|
|
19
|
+
onSuccess: (res) => {
|
|
20
|
+
toast.success(res?.restored
|
|
21
|
+
? `${res.restored} voorraadwijziging${res.restored === 1 ? "" : "en"} opnieuw ingepland.`
|
|
22
|
+
: "Niets meer om opnieuw te proberen.");
|
|
23
|
+
void queryClient.invalidateQueries({ queryKey: ["stock-sync-health"] });
|
|
24
|
+
},
|
|
25
|
+
onError: (e) => toast.error(e?.message ?? "Opnieuw proberen is niet gelukt."),
|
|
26
|
+
});
|
|
10
27
|
if (!data)
|
|
11
28
|
return null;
|
|
12
29
|
const { failed, stalePending, oldestPendingAt } = data;
|
|
@@ -19,5 +36,5 @@ export function StockSyncStatus() {
|
|
|
19
36
|
if (stalePending > 0) {
|
|
20
37
|
parts.push(`${stalePending} wacht${stalePending === 1 ? "" : "en"} langer dan 10 minuten`);
|
|
21
38
|
}
|
|
22
|
-
return (_jsxs("div", { className: "flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-800", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsxs("div", { children: [_jsx("span", { className: "font-medium", children: "Voorraadsync naar Floriday: " }), parts.join(" · "), ".", oldestPendingAt && (_jsxs("span", { className: "opacity-80", children: [" ", "Oudste wachtende regel: ", new Date(oldestPendingAt).toLocaleString("nl-NL"), "."] }))] })] }));
|
|
39
|
+
return (_jsxs("div", { className: "flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/10 px-3 py-2 text-sm text-amber-800", children: [_jsx(AlertTriangle, { className: "mt-0.5 h-4 w-4 shrink-0" }), _jsxs("div", { className: "flex-1", children: [_jsx("span", { className: "font-medium", children: "Voorraadsync naar Floriday: " }), parts.join(" · "), " (laatste 24 uur).", oldestPendingAt && (_jsxs("span", { className: "opacity-80", children: [" ", "Oudste wachtende regel: ", new Date(oldestPendingAt).toLocaleString("nl-NL"), "."] }))] }), failed > 0 && (_jsxs("button", { type: "button", className: "inline-flex shrink-0 items-center rounded-md border border-amber-500/40 bg-amber-500/10 px-2 py-1 text-xs font-medium text-amber-900 hover:bg-amber-500/20 disabled:opacity-50", disabled: mutation.isPending, onClick: () => mutation.mutate(), children: [_jsx(RotateCw, { className: `mr-1 h-3.5 w-3.5 ${mutation.isPending ? "animate-spin" : ""}` }), "Opnieuw proberen"] }))] }));
|
|
23
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VoorraadPage.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/VoorraadPage.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"VoorraadPage.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/VoorraadPage.tsx"],"names":[],"mappings":"AAgGA,wBAAgB,YAAY,gCA6O3B"}
|
|
@@ -4,10 +4,8 @@ import { Link } from "@tanstack/react-router";
|
|
|
4
4
|
import { Button, Card, Input, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@flowselections/core";
|
|
5
5
|
import { AlertTriangle, CheckCircle2, FileText, PackageX, Plus, Search, } from "lucide-react";
|
|
6
6
|
import { useFloridayConnection } from "../../hooks/useFloridayConnection";
|
|
7
|
-
import { useRegisterModuleBaseUrl } from "../../hooks/useRegisterModuleBaseUrl";
|
|
8
7
|
import { useVoorraadData } from "../../hooks/useVoorraadData";
|
|
9
8
|
import { StockSyncStatus } from "./StockSyncStatus";
|
|
10
|
-
import { LogistiekTakenCard } from "./LogistiekTakenCard";
|
|
11
9
|
import { ExcelExportButton } from "./ExcelExportButton";
|
|
12
10
|
import { StockBulkButtons } from "./StockBulkButtons";
|
|
13
11
|
import { VoorraadTable } from "./VoorraadTable";
|
|
@@ -36,7 +34,6 @@ function availableOf(i) {
|
|
|
36
34
|
return i.availableQuantity ?? i.quantity ?? 0;
|
|
37
35
|
}
|
|
38
36
|
export function VoorraadPage() {
|
|
39
|
-
useRegisterModuleBaseUrl();
|
|
40
37
|
const { activeId, error: connError } = useFloridayConnection();
|
|
41
38
|
const { items, loading, error, reload } = useVoorraadData(activeId);
|
|
42
39
|
const [search, setSearch] = useState("");
|
|
@@ -96,7 +93,7 @@ export function VoorraadPage() {
|
|
|
96
93
|
{ id: "out_of_stock", label: "Niet op voorraad", count: counts.outOfStock },
|
|
97
94
|
{ id: "below_min", label: "Onder minimum", count: counts.belowMin },
|
|
98
95
|
];
|
|
99
|
-
return (_jsxs("main", { className: "p-6 space-y-6", children: [_jsxs("header", { className: "grid grid-cols-[minmax(0,1fr)_auto] items-start gap-4", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight truncate", children: "Voorraad" }), _jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Beheer je artikelen en voorraadniveaus." })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { to: "/voorraad/publicaties", children: "Publicaties" }) }), _jsx(Button, { asChild: true, disabled: !activeId, size: "sm", children: _jsxs(Link, { to: "/voorraad/nieuw", children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), "Artikel toevoegen"] }) })] })] }), _jsx(StockSyncStatus, {}),
|
|
96
|
+
return (_jsxs("main", { className: "p-6 space-y-6", children: [_jsxs("header", { className: "grid grid-cols-[minmax(0,1fr)_auto] items-start gap-4", children: [_jsxs("div", { className: "min-w-0", children: [_jsx("h1", { className: "text-2xl font-bold tracking-tight truncate", children: "Voorraad" }), _jsx("p", { className: "text-sm text-muted-foreground mt-1", children: "Beheer je artikelen en voorraadniveaus." })] }), _jsxs("div", { className: "flex shrink-0 items-center gap-2", children: [_jsx(Button, { asChild: true, variant: "outline", size: "sm", children: _jsx(Link, { to: "/voorraad/publicaties", children: "Publicaties" }) }), _jsx(Button, { asChild: true, disabled: !activeId, size: "sm", children: _jsxs(Link, { to: "/voorraad/nieuw", children: [_jsx(Plus, { className: "mr-2 h-4 w-4" }), "Artikel toevoegen"] }) })] })] }), _jsx(StockSyncStatus, {}), connError && (_jsxs("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 text-destructive p-3 text-sm", children: ["Floriday-connectie laden mislukt: ", connError] })), error && (_jsxs("div", { className: "rounded-md border border-destructive/40 bg-destructive/10 text-destructive p-3 text-sm", children: ["Voorraad laden mislukt: ", error] })), _jsxs("div", { className: "grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4", children: [_jsx(KpiCard, { icon: _jsx(FileText, { className: "h-4 w-4" }), tone: "primary", label: "Artikelen", count: counts.total, active: stockFilter === "all", onClick: () => toggle("all") }), _jsx(KpiCard, { icon: _jsx(CheckCircle2, { className: "h-4 w-4" }), tone: "emerald", label: "Op voorraad", count: counts.inStock, active: stockFilter === "in_stock", onClick: () => toggle("in_stock") }), _jsx(KpiCard, { icon: _jsx(PackageX, { className: "h-4 w-4" }), tone: "rose", label: "Niet op voorraad", count: counts.outOfStock, active: stockFilter === "out_of_stock", onClick: () => toggle("out_of_stock") }), _jsx(KpiCard, { icon: _jsx(AlertTriangle, { className: "h-4 w-4" }), tone: "amber", label: "Onder minimum", count: counts.belowMin, active: stockFilter === "below_min", onClick: () => toggle("below_min") })] }), _jsxs(Card, { className: "overflow-hidden p-0", children: [_jsx("div", { className: "flex flex-wrap items-center gap-1 border-b px-4", children: TABS.map((t) => {
|
|
100
97
|
const active = stockFilter === t.id;
|
|
101
98
|
return (_jsxs("button", { type: "button", onClick: () => setStockFilter(t.id), className: `relative py-3 px-3 text-sm font-medium whitespace-nowrap transition-colors ${active
|
|
102
99
|
? "text-foreground"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useStockSyncHealth.d.ts","sourceRoot":"","sources":["../../src/hooks/useStockSyncHealth.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useStockSyncHealth.d.ts","sourceRoot":"","sources":["../../src/hooks/useStockSyncHealth.ts"],"names":[],"mappings":"AAaA,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC;AAED,wBAAgB,kBAAkB,oFAqCjC"}
|
|
@@ -1,19 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Gezondheid van de voorraad-push-wachtrij richting Floriday.
|
|
3
|
-
*
|
|
3
|
+
*
|
|
4
|
+
* Bewust een venster van 24 uur: oude, allang achterhaalde fouten mogen de
|
|
5
|
+
* gebruiker niet eindeloos blijven waarschuwen. Regels die door een nieuwere
|
|
6
|
+
* voorraadstand zijn vervangen (`superseded`) tellen niet mee.
|
|
4
7
|
*/
|
|
5
8
|
import { useQuery } from "@tanstack/react-query";
|
|
6
9
|
import { supabase } from "../integrations/supabase/client";
|
|
7
10
|
const STALE_MINUTES = 10;
|
|
11
|
+
const WINDOW_HOURS = 24;
|
|
8
12
|
export function useStockSyncHealth() {
|
|
9
13
|
return useQuery({
|
|
10
14
|
queryKey: ["stock-sync-health"],
|
|
11
15
|
refetchInterval: 60000,
|
|
12
16
|
queryFn: async () => {
|
|
17
|
+
const since = new Date(Date.now() - WINDOW_HOURS * 3600000).toISOString();
|
|
13
18
|
const { data, error } = await supabase
|
|
14
19
|
.from("floriday_continuous_stock_queue")
|
|
15
20
|
.select("status, created_at")
|
|
16
21
|
.in("status", ["pending", "failed"])
|
|
22
|
+
.gte("created_at", since)
|
|
17
23
|
.limit(1000);
|
|
18
24
|
if (error)
|
|
19
25
|
throw error;
|