@flowselections/floriday-authenticatie-module 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/FlorydaySettingsCard.d.ts +2 -0
- package/dist-lib/components/settings/FlorydaySettingsCard.d.ts.map +1 -0
- package/dist-lib/components/settings/FlorydaySettingsCard.js +161 -0
- package/dist-lib/index.d.ts +6 -0
- package/dist-lib/index.d.ts.map +1 -0
- package/dist-lib/index.js +18 -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 +888 -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 +884 -0
- package/dist-lib/integrations/supabase/client.d.ts.map +1 -0
- package/dist-lib/integrations/supabase/client.js +14 -0
- package/dist-lib/integrations/supabase/client.server.d.ts +884 -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 +971 -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/error-capture.d.ts +2 -0
- package/dist-lib/lib/error-capture.d.ts.map +1 -0
- package/dist-lib/lib/error-capture.js +22 -0
- package/dist-lib/lib/error-page.d.ts +2 -0
- package/dist-lib/lib/error-page.d.ts.map +1 -0
- package/dist-lib/lib/error-page.js +36 -0
- package/dist-lib/lib/floriday.functions.d.ts +8073 -0
- package/dist-lib/lib/floriday.functions.d.ts.map +1 -0
- package/dist-lib/lib/floriday.functions.js +451 -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 +67 -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":"FlorydaySettingsCard.d.ts","sourceRoot":"","sources":["../../../src/components/settings/FlorydaySettingsCard.tsx"],"names":[],"mappings":"AA6CA,wBAAgB,oBAAoB,4CA+GnC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { ChevronDown } from "lucide-react";
|
|
4
|
+
import { useServerFn } from "@tanstack/react-start";
|
|
5
|
+
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
6
|
+
import { Card, Button, Input, Label, Badge, Tabs, TabsList, TabsTrigger, Select, SelectContent, SelectItem, SelectTrigger, SelectValue, AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, AlertDialogTrigger, toast, } from "@flowselections/core";
|
|
7
|
+
import florydayLogo from "@/assets/floriday-logo.png";
|
|
8
|
+
import { listFlorydayConnections, upsertFlorydayConnection, testFlorydayConnection, deleteFlorydayConnection, getFlorydaySettings, setFlorydayActiveEnvironment, listFlorydayWarehouses, updateFlorydayPublishingSettings, validateGln, } from "../../lib/floriday.functions";
|
|
9
|
+
export function FlorydaySettingsCard() {
|
|
10
|
+
const [open, setOpen] = useState(false);
|
|
11
|
+
const qc = useQueryClient();
|
|
12
|
+
const list = useServerFn(listFlorydayConnections);
|
|
13
|
+
const getSettings = useServerFn(getFlorydaySettings);
|
|
14
|
+
const setEnv = useServerFn(setFlorydayActiveEnvironment);
|
|
15
|
+
const { data: connections = [], isLoading } = useQuery({
|
|
16
|
+
queryKey: ["floriday-connections"],
|
|
17
|
+
queryFn: () => list(),
|
|
18
|
+
});
|
|
19
|
+
const { data: settings } = useQuery({
|
|
20
|
+
queryKey: ["floriday-settings"],
|
|
21
|
+
queryFn: () => getSettings(),
|
|
22
|
+
});
|
|
23
|
+
const activeEnv = settings?.active_environment ?? "staging";
|
|
24
|
+
const activeConn = connections.find((c) => c.environment === activeEnv) ?? null;
|
|
25
|
+
const envMutation = useMutation({
|
|
26
|
+
mutationFn: (env) => setEnv({ data: { environment: env } }),
|
|
27
|
+
onMutate: async (env) => {
|
|
28
|
+
await qc.cancelQueries({ queryKey: ["floriday-settings"] });
|
|
29
|
+
const prev = qc.getQueryData(["floriday-settings"]);
|
|
30
|
+
qc.setQueryData(["floriday-settings"], { active_environment: env });
|
|
31
|
+
return { prev };
|
|
32
|
+
},
|
|
33
|
+
onError: (e, _v, ctx) => {
|
|
34
|
+
if (ctx?.prev)
|
|
35
|
+
qc.setQueryData(["floriday-settings"], ctx.prev);
|
|
36
|
+
toast.error(e?.message ?? "Wisselen mislukt");
|
|
37
|
+
},
|
|
38
|
+
onSuccess: (_d, env) => {
|
|
39
|
+
toast.success(`Gebruik modus: ${env === "live" ? "Live omgeving" : "Testomgeving"}`);
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
return (_jsxs(Card, { className: "overflow-hidden border-border/60", children: [_jsxs("button", { type: "button", onClick: () => setOpen(o => !o), className: "w-full flex items-center gap-3 px-5 py-4 text-left hover:bg-muted/40 transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-inset", "aria-expanded": open, children: [_jsx("div", { className: "h-9 w-9 rounded-lg bg-muted/60 flex items-center justify-center shrink-0", children: _jsx("img", { src: florydayLogo, alt: "", className: "h-5 w-5 object-contain" }) }), _jsxs("div", { className: "flex-1 min-w-0", children: [_jsx("h3", { className: "font-semibold text-sm truncate", children: "Floriday koppeling" }), _jsxs("div", { className: "flex items-center gap-2 flex-wrap mt-1", children: [_jsx(Badge, { variant: activeEnv === "live" ? "default" : "secondary", className: "text-[10px] tracking-wide", children: activeEnv === "live" ? "Live omgeving" : "Testomgeving" }), _jsx(StatusIndicator, { connected: Boolean(activeConn) }), activeConn?.organization_name && (_jsxs("span", { className: "text-xs text-muted-foreground truncate", children: ["\u00B7 ", activeConn.organization_name] }))] }), _jsx("p", { className: "text-xs text-muted-foreground mt-1 truncate", children: "Verbind je Floriday-account om automatisch gegevens uit te wisselen met het platform." })] }), _jsx(ChevronDown, { className: `h-4 w-4 text-muted-foreground shrink-0 transition-transform ${open ? "rotate-180" : ""}` })] }), open && (_jsxs("div", { className: "border-t border-border/60 px-5 py-5 space-y-6 bg-muted/20", children: [_jsx(StepBlock, { number: 1, title: "Kies omgeving", description: "Kies of je wilt testen of live wilt werken.", children: _jsx(Tabs, { value: activeEnv, onValueChange: (v) => envMutation.mutate(v), children: _jsxs(TabsList, { className: "grid grid-cols-2 w-full max-w-xs", children: [_jsx(TabsTrigger, { value: "staging", disabled: envMutation.isPending, children: "Testomgeving" }), _jsx(TabsTrigger, { value: "live", disabled: envMutation.isPending, children: "Live omgeving" })] }) }) }), isLoading ? (_jsx("p", { className: "text-sm text-muted-foreground", children: "Laden\u2026" })) : (_jsx(EnvironmentForm, { env: activeEnv, label: activeEnv === "live" ? "Live omgeving" : "Testomgeving", connection: activeConn }, activeEnv)), _jsx("div", { className: "pt-2 border-t border-border/60", children: _jsx("a", { href: "https://developer.floriday.io/docs", target: "_blank", rel: "noopener noreferrer", className: "text-xs text-primary hover:underline inline-flex items-center gap-1", children: "Waar vind ik deze gegevens in Floriday?" }) })] }))] }));
|
|
43
|
+
}
|
|
44
|
+
function StatusIndicator({ connected }) {
|
|
45
|
+
const label = connected ? "Verbonden" : "Niet verbonden";
|
|
46
|
+
return (_jsxs("span", { className: "inline-flex items-center gap-1.5 text-xs text-muted-foreground", children: [_jsx("span", { "aria-label": label, className: `h-2 w-2 rounded-full ${connected ? "bg-emerald-500" : "bg-red-500"}` }), label] }));
|
|
47
|
+
}
|
|
48
|
+
function StepBlock({ number, title, description, children, }) {
|
|
49
|
+
return (_jsxs("div", { className: "space-y-2", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx("span", { className: "h-6 w-6 rounded-full bg-primary text-primary-foreground text-xs font-semibold flex items-center justify-center shrink-0", children: number }), _jsx("h4", { className: "font-medium text-sm", children: title })] }), description && (_jsx("p", { className: "text-xs text-muted-foreground pl-8", children: description })), _jsx("div", { className: "pl-8", children: children })] }));
|
|
50
|
+
}
|
|
51
|
+
function EnvironmentForm({ env, label, connection, }) {
|
|
52
|
+
const qc = useQueryClient();
|
|
53
|
+
const upsert = useServerFn(upsertFlorydayConnection);
|
|
54
|
+
const test = useServerFn(testFlorydayConnection);
|
|
55
|
+
const remove = useServerFn(deleteFlorydayConnection);
|
|
56
|
+
const [clientId, setClientId] = useState("");
|
|
57
|
+
const [clientSecret, setClientSecret] = useState("");
|
|
58
|
+
const [apiKey, setApiKey] = useState("");
|
|
59
|
+
const saveMutation = useMutation({
|
|
60
|
+
mutationFn: () => upsert({
|
|
61
|
+
data: {
|
|
62
|
+
environment: env,
|
|
63
|
+
client_id: clientId,
|
|
64
|
+
client_secret: clientSecret,
|
|
65
|
+
api_key: apiKey,
|
|
66
|
+
label,
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
onSuccess: () => {
|
|
70
|
+
toast.success(`${label}-koppeling opgeslagen`);
|
|
71
|
+
setClientId("");
|
|
72
|
+
setClientSecret("");
|
|
73
|
+
setApiKey("");
|
|
74
|
+
qc.invalidateQueries({ queryKey: ["floriday-connections"] });
|
|
75
|
+
qc.invalidateQueries({ queryKey: ["floriday-warehouses", env] });
|
|
76
|
+
},
|
|
77
|
+
onError: (e) => toast.error(e?.message ?? "Opslaan mislukt"),
|
|
78
|
+
});
|
|
79
|
+
const testMutation = useMutation({
|
|
80
|
+
mutationFn: () => test({ data: { environment: env } }),
|
|
81
|
+
onSuccess: async (res) => {
|
|
82
|
+
if (res.ok)
|
|
83
|
+
toast.success(`${label} koppeling OK`);
|
|
84
|
+
else
|
|
85
|
+
toast.error(`${label} mislukt: ${res.error}`);
|
|
86
|
+
qc.invalidateQueries({ queryKey: ["floriday-connections"] });
|
|
87
|
+
await qc.refetchQueries({ queryKey: ["floriday-warehouses", env], type: "active" });
|
|
88
|
+
},
|
|
89
|
+
onError: (e) => toast.error(e?.message ?? "Test mislukt"),
|
|
90
|
+
});
|
|
91
|
+
const deleteMutation = useMutation({
|
|
92
|
+
mutationFn: () => remove({ data: { id: connection.id } }),
|
|
93
|
+
onSuccess: () => {
|
|
94
|
+
toast.success(`${label}-koppeling verwijderd`);
|
|
95
|
+
qc.invalidateQueries({ queryKey: ["floriday-connections"] });
|
|
96
|
+
},
|
|
97
|
+
onError: (e) => toast.error(e?.message ?? "Verwijderen mislukt"),
|
|
98
|
+
});
|
|
99
|
+
return (_jsxs("div", { className: "space-y-6", children: [_jsx(StepBlock, { number: 2, title: "Vul verbindingsgegevens in", children: _jsxs("div", { className: "rounded-lg border border-border/60 bg-card p-4 space-y-4", children: [_jsxs("div", { className: "flex items-start justify-between gap-3", children: [_jsxs("div", { className: "flex items-center gap-2 flex-wrap", children: [_jsx("h4", { className: "font-medium text-sm", children: "Verbindingsgegevens" }), connection ? (_jsx(Badge, { variant: "default", className: "text-[10px]", children: "Actief" })) : (_jsx(Badge, { variant: "secondary", className: "text-[10px]", children: "Nog niet gekoppeld" }))] }), connection && (_jsxs(AlertDialog, { children: [_jsx(AlertDialogTrigger, { asChild: true, children: _jsx(Button, { variant: "ghost", size: "sm", disabled: deleteMutation.isPending, children: "Verwijderen" }) }), _jsxs(AlertDialogContent, { children: [_jsxs(AlertDialogHeader, { children: [_jsx(AlertDialogTitle, { children: "Koppeling verwijderen?" }), _jsxs(AlertDialogDescription, { children: ["Hiermee worden de opgeslagen Floriday-gegevens voor de ", label.toLowerCase(), " permanent verwijderd. Andere modules die deze koppeling gebruiken werken daarna niet meer totdat je opnieuw koppelt."] })] }), _jsxs(AlertDialogFooter, { children: [_jsx(AlertDialogCancel, { children: "Annuleren" }), _jsx(AlertDialogAction, { onClick: () => deleteMutation.mutate(), children: "Verwijderen" })] })] })] }))] }), _jsxs("div", { className: "grid gap-4", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: `${env}-client-id`, className: "text-xs", children: "Client ID" }), _jsx(Input, { id: `${env}-client-id`, value: clientId, onChange: e => setClientId(e.target.value), placeholder: connection ? connection.client_id_masked : "Floriday Client ID", className: connection ? "font-mono placeholder:font-mono placeholder:text-foreground/60" : undefined, autoComplete: "off" }), _jsx("p", { className: "text-[11px] text-muted-foreground", children: "Te vinden in je Floriday API-instellingen." }), connection && (_jsx("p", { className: "text-[11px] text-muted-foreground", children: "Laat leeg als je deze waarde niet wilt wijzigen." }))] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: `${env}-client-secret`, className: "text-xs", children: "Client Secret" }), _jsx(Input, { id: `${env}-client-secret`, type: "password", value: clientSecret, onChange: e => setClientSecret(e.target.value), placeholder: connection ? "••••••••" : "Floriday Client Secret", className: connection ? "placeholder:text-foreground/60" : undefined, autoComplete: "off" }), _jsx("p", { className: "text-[11px] text-muted-foreground", children: "Houd deze sleutel priv\u00E9." }), connection && (_jsx("p", { className: "text-[11px] text-muted-foreground", children: "Laat leeg als je deze waarde niet wilt wijzigen." }))] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: `${env}-api-key`, className: "text-xs", children: "API-sleutel" }), _jsx(Input, { id: `${env}-api-key`, type: "text", value: apiKey, onChange: e => setApiKey(e.target.value), placeholder: connection ? connection.api_key_masked : "X-Api-Key uit Floriday", className: connection ? "font-mono placeholder:font-mono placeholder:text-foreground/60" : undefined, autoComplete: "off" }), _jsx("p", { className: "text-[11px] text-muted-foreground", children: "Kopieer de API-sleutel uit Floriday." }), connection && (_jsx("p", { className: "text-[11px] text-muted-foreground", children: "Laat leeg als je deze waarde niet wilt wijzigen." }))] })] }), _jsx("div", { children: _jsx(Button, { size: "sm", onClick: () => saveMutation.mutate(), disabled: saveMutation.isPending ||
|
|
100
|
+
!clientId.trim() || !clientSecret.trim() || !apiKey.trim(), children: saveMutation.isPending ? "Opslaan…" : connection ? "Wijzigingen opslaan" : "Koppeling opslaan" }) })] }) }), _jsx(StepBlock, { number: 3, title: "Test de verbinding", description: "Controleer of je gegevens correct zijn en of de koppeling werkt.", children: _jsx(Button, { variant: "outline", size: "sm", onClick: () => testMutation.mutate(), disabled: !connection || testMutation.isPending, children: testMutation.isPending ? "Testen…" : "Verbinding testen" }) }), _jsx(StepBlock, { number: 4, title: "Publicatie-instellingen", description: "Vul je GLN-code in en kies het voorkeursmagazijn voor het publiceren van producten via Floriday.", children: _jsx(PublishingSettings, { env: env, connection: connection }) })] }));
|
|
101
|
+
}
|
|
102
|
+
function PublishingSettings({ env, connection, }) {
|
|
103
|
+
const qc = useQueryClient();
|
|
104
|
+
const listWarehouses = useServerFn(listFlorydayWarehouses);
|
|
105
|
+
const updateSettings = useServerFn(updateFlorydayPublishingSettings);
|
|
106
|
+
const [gln, setGln] = useState(connection?.gln_code ?? "");
|
|
107
|
+
const [warehouseId, setWarehouseId] = useState(connection?.preferred_warehouse_id ?? "");
|
|
108
|
+
const warehousesQuery = useQuery({
|
|
109
|
+
queryKey: ["floriday-warehouses", env],
|
|
110
|
+
queryFn: () => listWarehouses({ data: { environment: env } }),
|
|
111
|
+
enabled: Boolean(connection),
|
|
112
|
+
});
|
|
113
|
+
const warehouses = warehousesQuery.data && warehousesQuery.data.ok ? warehousesQuery.data.warehouses : [];
|
|
114
|
+
const warehousesError = warehousesQuery.data && !warehousesQuery.data.ok ? warehousesQuery.data.error : null;
|
|
115
|
+
// Auto-preselect het default-magazijn van Floriday wanneer de gebruiker
|
|
116
|
+
// nog geen keuze heeft gemaakt.
|
|
117
|
+
useEffect(() => {
|
|
118
|
+
if (warehouseId)
|
|
119
|
+
return;
|
|
120
|
+
if (!warehouses.length)
|
|
121
|
+
return;
|
|
122
|
+
const def = warehouses.find((w) => w.isDefault) ?? warehouses[0];
|
|
123
|
+
if (def)
|
|
124
|
+
setWarehouseId(def.id);
|
|
125
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
126
|
+
}, [warehouses.length]);
|
|
127
|
+
const saveMutation = useMutation({
|
|
128
|
+
mutationFn: () => {
|
|
129
|
+
const selected = warehouses.find((w) => w.id === warehouseId);
|
|
130
|
+
return updateSettings({
|
|
131
|
+
data: {
|
|
132
|
+
environment: env,
|
|
133
|
+
gln_code: gln,
|
|
134
|
+
preferred_warehouse_id: warehouseId || null,
|
|
135
|
+
preferred_warehouse_name: selected?.name ?? null,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
},
|
|
139
|
+
onSuccess: () => {
|
|
140
|
+
toast.success("Publicatie-instellingen opgeslagen");
|
|
141
|
+
qc.invalidateQueries({ queryKey: ["floriday-connections"] });
|
|
142
|
+
},
|
|
143
|
+
onError: (e) => toast.error(e?.message ?? "Opslaan mislukt"),
|
|
144
|
+
});
|
|
145
|
+
if (!connection) {
|
|
146
|
+
return (_jsx("p", { className: "text-xs text-muted-foreground", children: "Sla eerst je verbindingsgegevens op om publicatie-instellingen te beheren." }));
|
|
147
|
+
}
|
|
148
|
+
const glnError = gln.trim() ? validateGln(gln) : null;
|
|
149
|
+
return (_jsxs("div", { className: "rounded-lg border border-border/60 bg-card p-4 space-y-4", children: [_jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: `${env}-gln`, className: "text-xs", children: "GLN-code organisatie" }), _jsx(Input, { id: `${env}-gln`, value: gln, onChange: (e) => setGln(e.target.value.replace(/\s+/g, "")), placeholder: "Bijv. 8712345000005", inputMode: "numeric", maxLength: 13, autoComplete: "off", "aria-invalid": Boolean(glnError) }), glnError ? (_jsx("p", { className: "text-[11px] text-red-600", children: glnError })) : (_jsx("p", { className: "text-[11px] text-muted-foreground", children: "De Global Location Number van je organisatie in Floriday (13 cijfers)." }))] }), _jsxs("div", { className: "space-y-1", children: [_jsx(Label, { htmlFor: `${env}-warehouse`, className: "text-xs", children: "Voorkeursmagazijn" }), _jsxs(Select, { value: warehouseId || undefined, onValueChange: setWarehouseId, children: [_jsx(SelectTrigger, { id: `${env}-warehouse`, children: _jsx(SelectValue, { placeholder: warehousesQuery.isLoading
|
|
150
|
+
? "Magazijnen laden…"
|
|
151
|
+
: warehouses.length === 0
|
|
152
|
+
? "Geen magazijnen beschikbaar"
|
|
153
|
+
: "Kies een magazijn", children: (() => {
|
|
154
|
+
const selected = warehouses.find((w) => w.id === warehouseId);
|
|
155
|
+
if (!selected)
|
|
156
|
+
return null;
|
|
157
|
+
return (_jsxs("span", { className: "flex items-baseline gap-2 truncate", children: [_jsx("span", { className: "truncate", children: selected.name }), selected.gln && (_jsx("span", { className: "text-[11px] text-muted-foreground font-mono", children: selected.gln }))] }));
|
|
158
|
+
})() }) }), _jsx(SelectContent, { children: warehouses.map((w) => (_jsx(SelectItem, { value: w.id, children: _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { children: w.name }), w.gln && (_jsx("span", { className: "text-[11px] text-muted-foreground font-mono", children: w.gln }))] }) }, w.id))) })] }), _jsx("p", { className: "text-[11px] text-muted-foreground", children: "Alleen magazijnen die in Floriday aan je organisatie gekoppeld zijn." }), warehousesError && (_jsxs("p", { className: "text-[11px] text-red-600", children: ["Magazijnen niet beschikbaar: ", warehousesError] }))] }), _jsx("div", { children: _jsx(Button, { size: "sm", onClick: () => saveMutation.mutate(), disabled: saveMutation.isPending ||
|
|
159
|
+
Boolean(glnError) ||
|
|
160
|
+
(!gln.trim() && !warehouseId), children: saveMutation.isPending ? "Opslaan…" : "Instellingen opslaan" }) })] }));
|
|
161
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGvD,cAAc,kBAAkB,CAAC;AACjC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AAEzC,eAAO,MAAM,QAAQ,EAAE,UActB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Plug } from "lucide-react";
|
|
2
|
+
import { FlorydaySettingsCard } from "./components/settings/FlorydaySettingsCard";
|
|
3
|
+
export * from './_core-safelist';
|
|
4
|
+
export * from './components/TemplatePage';
|
|
5
|
+
export * from './lib/floriday.functions';
|
|
6
|
+
export const myModule = {
|
|
7
|
+
id: "floriday_connection",
|
|
8
|
+
name: "Floriday Connection",
|
|
9
|
+
version: "1.0.0",
|
|
10
|
+
nav: {
|
|
11
|
+
label: "Floriday koppeling",
|
|
12
|
+
href: "/floriday-connection",
|
|
13
|
+
icon: Plug,
|
|
14
|
+
},
|
|
15
|
+
settingsCards: [
|
|
16
|
+
{ component: FlorydaySettingsCard, order: 10 },
|
|
17
|
+
],
|
|
18
|
+
};
|
|
@@ -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
|
+
});
|