@flowselections/floriday-voorraad 1.0.0
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/_core-safelist.d.ts +2 -0
- package/dist-lib/_core-safelist.d.ts.map +1 -0
- package/dist-lib/_core-safelist.js +15 -0
- package/dist-lib/components/TemplatePage.d.ts +2 -0
- package/dist-lib/components/TemplatePage.d.ts.map +1 -0
- package/dist-lib/components/TemplatePage.js +4 -0
- package/dist-lib/components/settings/VoorraadSettingsCard.d.ts +2 -0
- package/dist-lib/components/settings/VoorraadSettingsCard.d.ts.map +1 -0
- package/dist-lib/components/settings/VoorraadSettingsCard.js +39 -0
- package/dist-lib/components/voorraad/ConnectionPicker.d.ts +8 -0
- package/dist-lib/components/voorraad/ConnectionPicker.d.ts.map +1 -0
- package/dist-lib/components/voorraad/ConnectionPicker.js +8 -0
- package/dist-lib/components/voorraad/ExcelExportButton.d.ts +6 -0
- package/dist-lib/components/voorraad/ExcelExportButton.d.ts.map +1 -0
- package/dist-lib/components/voorraad/ExcelExportButton.js +24 -0
- package/dist-lib/components/voorraad/VoorraadTable.d.ts +6 -0
- package/dist-lib/components/voorraad/VoorraadTable.d.ts.map +1 -0
- package/dist-lib/components/voorraad/VoorraadTable.js +22 -0
- package/dist-lib/hooks/useFloridayConnection.d.ts +9 -0
- package/dist-lib/hooks/useFloridayConnection.d.ts.map +1 -0
- package/dist-lib/hooks/useFloridayConnection.js +40 -0
- package/dist-lib/hooks/useVoorraadData.d.ts +7 -0
- package/dist-lib/hooks/useVoorraadData.d.ts.map +1 -0
- package/dist-lib/hooks/useVoorraadData.js +30 -0
- package/dist-lib/index.d.ts +5 -0
- package/dist-lib/index.d.ts.map +1 -0
- package/dist-lib/index.js +20 -0
- package/dist-lib/integrations/supabase/auth-attacher.d.ts +2 -0
- package/dist-lib/integrations/supabase/auth-attacher.d.ts.map +1 -0
- package/dist-lib/integrations/supabase/auth-attacher.js +12 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts +1029 -0
- package/dist-lib/integrations/supabase/auth-middleware.d.ts.map +1 -0
- package/dist-lib/integrations/supabase/auth-middleware.js +52 -0
- package/dist-lib/integrations/supabase/client.d.ts +1025 -0
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -0
- package/dist-lib/integrations/supabase/client.js +28 -0
- package/dist-lib/integrations/supabase/client.server.d.ts +1025 -0
- package/dist-lib/integrations/supabase/client.server.d.ts.map +1 -0
- package/dist-lib/integrations/supabase/client.server.js +30 -0
- package/dist-lib/integrations/supabase/types.d.ts +1112 -0
- package/dist-lib/integrations/supabase/types.d.ts.map +1 -0
- package/dist-lib/integrations/supabase/types.js +7 -0
- package/dist-lib/lib/floricode-client.d.ts +15 -0
- package/dist-lib/lib/floricode-client.d.ts.map +1 -0
- package/dist-lib/lib/floricode-client.js +34 -0
- package/dist-lib/lib/floriday-client.d.ts +51 -0
- package/dist-lib/lib/floriday-client.d.ts.map +1 -0
- package/dist-lib/lib/floriday-client.js +45 -0
- package/dist-lib/lib/floriday-payload.d.ts +152 -0
- package/dist-lib/lib/floriday-payload.d.ts.map +1 -0
- package/dist-lib/lib/floriday-payload.js +214 -0
- package/dist-lib/lib/utils.d.ts +3 -0
- package/dist-lib/lib/utils.d.ts.map +1 -0
- package/dist-lib/lib/utils.js +5 -0
- package/dist-lib/lib/validationSchemas.d.ts +15 -0
- package/dist-lib/lib/validationSchemas.d.ts.map +1 -0
- package/dist-lib/lib/validationSchemas.js +25 -0
- package/package.json +71 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_core-safelist.d.ts","sourceRoot":"","sources":["../src/_core-safelist.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Forceert Tailwind classes die uit @flowselections/core komen maar niet
|
|
2
|
+
// voorkomen in de eigen broncode van deze module.
|
|
3
|
+
// Zonder dit bestand worden deze classes weggeoptimaliseerd op de
|
|
4
|
+
// Lovable productie build.
|
|
5
|
+
const _safelist = [
|
|
6
|
+
// Layout — Sidebar en shell structuur
|
|
7
|
+
'h-full', 'flex-col', 'flex-1', 'min-h-screen', 'ml-64', 'pt-16',
|
|
8
|
+
'items-start', 'items-center', 'justify-between', 'border-t',
|
|
9
|
+
'w-64', 'h-screen', 'h-20', 'overflow-y-auto',
|
|
10
|
+
// Grid — InstellingenPage
|
|
11
|
+
'grid', 'lg:grid-cols-2', 'gap-6', 'p-6', 'space-y-6',
|
|
12
|
+
// Toggle/Switch — aan/uit zichtbaarheid
|
|
13
|
+
'data-[state=checked]:bg-primary', 'data-[state=unchecked]:bg-input',
|
|
14
|
+
];
|
|
15
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplatePage.d.ts","sourceRoot":"","sources":["../../src/components/TemplatePage.tsx"],"names":[],"mappings":"AAAA,wBAAgB,YAAY,4CAS3B"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
export function TemplatePage() {
|
|
3
|
+
return (_jsxs("div", { className: "p-6", children: [_jsx("h1", { className: "text-2xl font-semibold", children: "Module pagina" }), _jsx("p", { className: "text-muted-foreground mt-2", children: "Vervang dit component met de pagina's van jouw module." })] }));
|
|
4
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VoorraadSettingsCard.d.ts","sourceRoot":"","sources":["../../../src/components/settings/VoorraadSettingsCard.tsx"],"names":[],"mappings":"AAeA,wBAAgB,oBAAoB,4CA8DnC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { Card, CardContent, CardDescription, CardHeader, CardTitle, Button, Input, Label, supabase, toast, } from "@flowselections/core";
|
|
4
|
+
import { Package } from "lucide-react";
|
|
5
|
+
export function VoorraadSettingsCard() {
|
|
6
|
+
const [lowStockThreshold, setLowStockThreshold] = useState("");
|
|
7
|
+
const [loading, setLoading] = useState(true);
|
|
8
|
+
const [saving, setSaving] = useState(false);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
(async () => {
|
|
11
|
+
try {
|
|
12
|
+
const { data } = await supabase
|
|
13
|
+
.from("inventory_settings")
|
|
14
|
+
.select("*")
|
|
15
|
+
.limit(1)
|
|
16
|
+
.maybeSingle();
|
|
17
|
+
if (data && "low_stock_threshold" in data) {
|
|
18
|
+
setLowStockThreshold(String(data.low_stock_threshold ?? ""));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
finally {
|
|
22
|
+
setLoading(false);
|
|
23
|
+
}
|
|
24
|
+
})();
|
|
25
|
+
}, []);
|
|
26
|
+
const handleSave = async () => {
|
|
27
|
+
setSaving(true);
|
|
28
|
+
try {
|
|
29
|
+
toast.success("Instellingen opgeslagen");
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
toast.error("Fout bij het opslaan");
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
setSaving(false);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return (_jsxs(Card, { children: [_jsxs(CardHeader, { children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Package, { className: "h-5 w-5 text-primary" }), _jsx(CardTitle, { children: "Voorraad Instellingen" })] }), _jsx(CardDescription, { children: "Beheer drempelwaarden en standaarden voor de voorraad module" })] }), _jsxs(CardContent, { className: "space-y-4", children: [_jsxs("div", { className: "space-y-2", children: [_jsx(Label, { htmlFor: "threshold", children: "Lage-voorraad drempel" }), _jsx(Input, { id: "threshold", type: "number", value: lowStockThreshold, onChange: (e) => setLowStockThreshold(e.target.value), placeholder: "bv. 10", disabled: loading })] }), _jsx(Button, { onClick: handleSave, disabled: saving || loading, children: saving ? "Opslaan..." : "Opslaan" })] })] }));
|
|
39
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FloridayConnection } from "@/lib/floriday-client";
|
|
2
|
+
export declare function ConnectionPicker({ connections, activeId, onChange, disabled, }: {
|
|
3
|
+
connections: FloridayConnection[];
|
|
4
|
+
activeId: string | null;
|
|
5
|
+
onChange: (id: string) => void;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=ConnectionPicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConnectionPicker.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/ConnectionPicker.tsx"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAEhE,wBAAgB,gBAAgB,CAAC,EAC/B,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,QAAQ,GACT,EAAE;IACD,WAAW,EAAE,kBAAkB,EAAE,CAAC;IAClC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,2CAsBA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue, } from "@flowselections/core";
|
|
3
|
+
export function ConnectionPicker({ connections, activeId, onChange, disabled, }) {
|
|
4
|
+
if (connections.length === 0) {
|
|
5
|
+
return (_jsx("div", { className: "text-sm text-muted-foreground", children: "Geen actieve Floriday-connecties" }));
|
|
6
|
+
}
|
|
7
|
+
return (_jsxs(Select, { value: activeId ?? undefined, onValueChange: onChange, disabled: disabled, children: [_jsx(SelectTrigger, { className: "w-[260px]", children: _jsx(SelectValue, { placeholder: "Kies Floriday-connectie" }) }), _jsx(SelectContent, { children: connections.map((c) => (_jsx(SelectItem, { value: c.id, children: c.organization_name || c.label }, c.id))) })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExcelExportButton.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/ExcelExportButton.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,wBAAgB,iBAAiB,CAAC,EAChC,KAAK,EACL,QAAqB,GACtB,EAAE;IACD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,2CAyBA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import * as XLSX from "xlsx";
|
|
3
|
+
import { Button } from "@flowselections/core";
|
|
4
|
+
import { Download } from "lucide-react";
|
|
5
|
+
export function ExcelExportButton({ items, filename = "voorraad", }) {
|
|
6
|
+
const handle = () => {
|
|
7
|
+
const rows = items.map((i) => ({
|
|
8
|
+
Artikelnummer: i.articleNumber,
|
|
9
|
+
Productnaam: i.name,
|
|
10
|
+
"Liggende voorraad": i.quantity,
|
|
11
|
+
Minimum: i.minQuantity,
|
|
12
|
+
Gereserveerd: i.reservedQuantity,
|
|
13
|
+
Beschikbaar: i.availableQuantity,
|
|
14
|
+
Inkomend: i.incomingQuantity,
|
|
15
|
+
Economisch: i.economicQuantity,
|
|
16
|
+
}));
|
|
17
|
+
const ws = XLSX.utils.json_to_sheet(rows);
|
|
18
|
+
const wb = XLSX.utils.book_new();
|
|
19
|
+
XLSX.utils.book_append_sheet(wb, ws, "Voorraad");
|
|
20
|
+
const stamp = new Date().toISOString().slice(0, 10);
|
|
21
|
+
XLSX.writeFile(wb, `${filename}-${stamp}.xlsx`);
|
|
22
|
+
};
|
|
23
|
+
return (_jsxs(Button, { variant: "outline", onClick: handle, disabled: items.length === 0, children: [_jsx(Download, { className: "mr-2 h-4 w-4" }), "Excel export"] }));
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VoorraadTable.d.ts","sourceRoot":"","sources":["../../../src/components/voorraad/VoorraadTable.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAWvD,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,OAAO,GACR,EAAE;IACD,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,2CAoEA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Package } from "lucide-react";
|
|
3
|
+
const columns = [
|
|
4
|
+
{ key: "quantity", label: "Liggend" },
|
|
5
|
+
{ key: "minQuantity", label: "Minimum" },
|
|
6
|
+
{ key: "reservedQuantity", label: "Gereserveerd" },
|
|
7
|
+
{ key: "availableQuantity", label: "Beschikbaar" },
|
|
8
|
+
{ key: "incomingQuantity", label: "Inkomend" },
|
|
9
|
+
{ key: "economicQuantity", label: "Economisch" },
|
|
10
|
+
];
|
|
11
|
+
export function VoorraadTable({ items, loading, }) {
|
|
12
|
+
if (loading) {
|
|
13
|
+
return _jsx("p", { className: "text-sm text-muted-foreground p-6", children: "Voorraad laden..." });
|
|
14
|
+
}
|
|
15
|
+
if (items.length === 0) {
|
|
16
|
+
return (_jsx("p", { className: "text-sm text-muted-foreground p-6", children: "Geen producten gevonden voor deze connectie." }));
|
|
17
|
+
}
|
|
18
|
+
return (_jsx("div", { className: "overflow-x-auto", children: _jsxs("table", { className: "w-full text-sm", children: [_jsx("thead", { className: "bg-muted/50 text-left", children: _jsxs("tr", { children: [_jsx("th", { className: "p-3 w-14" }), _jsx("th", { className: "p-3", children: "Product" }), _jsx("th", { className: "p-3", children: "Artikelnummer" }), columns.map((c) => (_jsx("th", { className: "p-3 text-right whitespace-nowrap", children: c.label }, c.key)))] }) }), _jsx("tbody", { children: items.map((item) => {
|
|
19
|
+
const low = item.minQuantity > 0 && item.availableQuantity < item.minQuantity;
|
|
20
|
+
return (_jsxs("tr", { className: "border-t hover:bg-muted/30", children: [_jsx("td", { className: "p-2", children: item.imageUrl ? (_jsx("img", { src: item.imageUrl, alt: item.name, className: "h-10 w-10 rounded object-cover", loading: "lazy" })) : (_jsx("div", { className: "h-10 w-10 rounded bg-muted flex items-center justify-center", children: _jsx(Package, { className: "h-4 w-4 text-muted-foreground" }) })) }), _jsxs("td", { className: "p-3", children: [_jsx("div", { className: "font-medium text-foreground", children: item.name }), low && (_jsx("div", { className: "text-xs text-destructive", children: "onder minimumvoorraad" }))] }), _jsx("td", { className: "p-3 font-mono text-xs", children: item.articleNumber }), columns.map((c) => (_jsx("td", { className: "p-3 text-right tabular-nums", children: Number(item[c.key] ?? 0) }, c.key)))] }, item.id));
|
|
21
|
+
}) })] }) }));
|
|
22
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function useFloridayConnection(): {
|
|
2
|
+
connections: FloridayConnection[];
|
|
3
|
+
activeId: string | null;
|
|
4
|
+
setActiveId: (id: string) => void;
|
|
5
|
+
activeConnection: any;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=useFloridayConnection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFloridayConnection.d.ts","sourceRoot":"","sources":["../../src/hooks/useFloridayConnection.ts"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB;;;sBAyBV,MAAM;;;;EAahC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
import { floriday } from "@/lib/floriday-client";
|
|
3
|
+
const STORAGE_KEY = "voorraad.activeFloridayConnection";
|
|
4
|
+
export function useFloridayConnection() {
|
|
5
|
+
const [connections, setConnections] = useState([]);
|
|
6
|
+
const [activeId, setActiveIdState] = useState(null);
|
|
7
|
+
const [loading, setLoading] = useState(true);
|
|
8
|
+
const [error, setError] = useState(null);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
let mounted = true;
|
|
11
|
+
floriday
|
|
12
|
+
.listConnections()
|
|
13
|
+
.then((rows) => {
|
|
14
|
+
if (!mounted)
|
|
15
|
+
return;
|
|
16
|
+
setConnections(rows);
|
|
17
|
+
const stored = typeof window !== "undefined" ? localStorage.getItem(STORAGE_KEY) : null;
|
|
18
|
+
const pick = rows.find((r) => r.id === stored) ?? rows[0];
|
|
19
|
+
setActiveIdState(pick?.id ?? null);
|
|
20
|
+
})
|
|
21
|
+
.catch((e) => setError(e.message))
|
|
22
|
+
.finally(() => mounted && setLoading(false));
|
|
23
|
+
return () => {
|
|
24
|
+
mounted = false;
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
27
|
+
const setActiveId = (id) => {
|
|
28
|
+
setActiveIdState(id);
|
|
29
|
+
if (typeof window !== "undefined")
|
|
30
|
+
localStorage.setItem(STORAGE_KEY, id);
|
|
31
|
+
};
|
|
32
|
+
return {
|
|
33
|
+
connections,
|
|
34
|
+
activeId,
|
|
35
|
+
setActiveId,
|
|
36
|
+
activeConnection: connections.find((c) => c.id === activeId) ?? null,
|
|
37
|
+
loading,
|
|
38
|
+
error,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useVoorraadData.d.ts","sourceRoot":"","sources":["../../src/hooks/useVoorraadData.ts"],"names":[],"mappings":"AAGA,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI;;;;;EA4B1D"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { useCallback, useEffect, useState } from "react";
|
|
2
|
+
import { floriday } from "@/lib/floriday-client";
|
|
3
|
+
export function useVoorraadData(connectionId) {
|
|
4
|
+
const [items, setItems] = useState([]);
|
|
5
|
+
const [loading, setLoading] = useState(false);
|
|
6
|
+
const [error, setError] = useState(null);
|
|
7
|
+
const load = useCallback(async () => {
|
|
8
|
+
if (!connectionId) {
|
|
9
|
+
setItems([]);
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
setLoading(true);
|
|
13
|
+
setError(null);
|
|
14
|
+
try {
|
|
15
|
+
const data = await floriday.listTradeItems(connectionId);
|
|
16
|
+
setItems(data);
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
setError(e.message);
|
|
20
|
+
setItems([]);
|
|
21
|
+
}
|
|
22
|
+
finally {
|
|
23
|
+
setLoading(false);
|
|
24
|
+
}
|
|
25
|
+
}, [connectionId]);
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
load();
|
|
28
|
+
}, [load]);
|
|
29
|
+
return { items, loading, error, reload: load };
|
|
30
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAI1C,eAAO,MAAM,QAAQ,EAAE,UAYtB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// ============================================================================
|
|
2
|
+
// src/index.ts — MODULE CONTRACT (Voorraad)
|
|
3
|
+
// ============================================================================
|
|
4
|
+
import { Package } from "lucide-react";
|
|
5
|
+
export * from './_core-safelist';
|
|
6
|
+
export * from './components/TemplatePage';
|
|
7
|
+
import { VoorraadSettingsCard } from "./components/settings/VoorraadSettingsCard";
|
|
8
|
+
export const myModule = {
|
|
9
|
+
id: "voorraad",
|
|
10
|
+
name: "Voorraad",
|
|
11
|
+
version: "1.0.0",
|
|
12
|
+
nav: {
|
|
13
|
+
label: "Voorraad",
|
|
14
|
+
href: "/voorraad",
|
|
15
|
+
icon: Package,
|
|
16
|
+
},
|
|
17
|
+
settingsCards: [
|
|
18
|
+
{ component: VoorraadSettingsCard, order: 10 },
|
|
19
|
+
],
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-attacher.d.ts","sourceRoot":"","sources":["../../../src/integrations/supabase/auth-attacher.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,kBAAkB,mHAQ9B,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// This file is automatically generated. Do not edit it directly.
|
|
2
|
+
import { createMiddleware } from '@tanstack/react-start';
|
|
3
|
+
import { supabase } from './client';
|
|
4
|
+
// Must be registered as a global `functionMiddleware` in `src/start.ts`; otherwise
|
|
5
|
+
// the browser never attaches the bearer token to serverFn RPCs.
|
|
6
|
+
export const attachSupabaseAuth = createMiddleware({ type: 'function' }).client(async ({ next }) => {
|
|
7
|
+
const { data } = await supabase.auth.getSession();
|
|
8
|
+
const token = data.session?.access_token;
|
|
9
|
+
return next({
|
|
10
|
+
headers: token ? { Authorization: `Bearer ${token}` } : {},
|
|
11
|
+
});
|
|
12
|
+
});
|